mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-25 15:00:25 +01:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95faaae30d | ||
|
|
ae027aa11a | ||
|
|
41d13aa83d |
No files matched your search
@@ -51,7 +51,7 @@ none of these frontend controls has passed a worn-headset check yet.
|
||||
| --- | --- | --- |
|
||||
| `definePlugin` with `content`, `titleView` | Renders a React panel and optional title | Local browser with ProtonDB Badges; host unit test |
|
||||
| Official `@decky/rollup` JSX (`SP_JSX.jsx`, `jsxs`, `Fragment`) | Creates React elements in the isolated panel | Sample bundle smoke test; host unit test |
|
||||
| `PanelSection`, rows, buttons, toggles, dropdowns | Local touch-sized controls; disabled controls stay inert during a backend call | Local browser and host unit test |
|
||||
| `PanelSection`, rows, buttons, toggles, dropdowns | Local touch-sized controls | Local browser and host unit test |
|
||||
| Optional `settings`, `frameyQuickActions` | Separate settings tab; up to eight actions with result text | Host unit test; these fields are Framey additions |
|
||||
| `serverAPI.call` / `callable` | Calls only that plugin's Decky Python backend via the headset service | Fake Frame e2e for setting read/write across CEF calls, update, and reinstall; host unit test. Real Decky persistence remains unverified. |
|
||||
| `toaster.toast` | Visible toast inside the plugin panel; `dismiss` and optional `onClick` | Host unit test; no Steam system notification |
|
||||
|
||||
@@ -29,24 +29,6 @@ const fragments=window.SP_JSX.jsxs(window.SP_JSX.Fragment,{children:['one','two'
|
||||
assert.equal(fragments.type,React.Fragment);
|
||||
assert.deepEqual(fragments.children,[['one','two']]);
|
||||
const nodes=(tree,type)=>[...(tree?.type===type?[tree]:[]),...(tree?.children||[]).flatMap(child=>nodes(child,type))];
|
||||
// Official Decky controls use disabled while a backend call is in progress.
|
||||
// A disabled control must stay inert even if an event handler is invoked.
|
||||
let changed=0;
|
||||
const toggle=nodes(window.DFL.ToggleField({label:'Enabled',checked:true,disabled:true,
|
||||
onChange:()=>changed++}),'input')[0];
|
||||
const dropdown=nodes(window.DFL.DropdownItem({label:'Mode',disabled:true,rgOptions:[{data:'a',label:'A'}],
|
||||
onChange:()=>changed++}),'select')[0];
|
||||
const button=nodes(window.DFL.ButtonItem({label:'Reload',description:'Read setting',disabled:true,
|
||||
onClick:()=>changed++}),'button')[0];
|
||||
for(const control of [toggle,dropdown,button])assert.equal(control.props.disabled,true);
|
||||
toggle.props.onChange({target:{checked:false}});
|
||||
dropdown.props.onChange({target:{value:'a'}});
|
||||
button.props.onClick({});
|
||||
assert.equal(changed,0);
|
||||
const readyButton=nodes(window.DFL.ButtonItem({label:'Reload',onClick:()=>changed++}),'button')[0];
|
||||
assert.equal(readyButton.props.disabled,false);
|
||||
readyButton.props.onClick({});
|
||||
assert.equal(changed,1);
|
||||
let called=0;
|
||||
const plugin={content:{type:'content'},settings:{type:'settings'},titleView:{type:'title'},
|
||||
frameyQuickActions:[{label:'Refresh data',onClick:async()=>{called++;return 'Fresh';}},
|
||||
|
||||
+6
-9
@@ -46,16 +46,13 @@
|
||||
const passthrough = tag => ({children, ...props}) => R.createElement(tag, props, children);
|
||||
const Field = ({label, description, children}) => R.createElement('label', null,
|
||||
R.createElement('strong', null, label), description && R.createElement('small', null, description), children);
|
||||
const ToggleField = ({label, description, checked, disabled, onChange}) => R.createElement(Field, {label, description},
|
||||
R.createElement('input', {type:'checkbox', checked:!!checked, disabled:!!disabled,
|
||||
onChange:e=>{if(!disabled)onChange?.(e.target.checked);}}));
|
||||
const DropdownItem = ({label, description, rgOptions=[], selectedOption, disabled, onChange}) => R.createElement(Field, {label, description},
|
||||
R.createElement('select', {value:String(selectedOption ?? ''), disabled:!!disabled,
|
||||
onChange:e=>{if(!disabled)onChange?.(rgOptions.find(x=>String(x.data)===e.target.value));}},
|
||||
const ToggleField = ({label, description, checked, onChange}) => R.createElement(Field, {label, description},
|
||||
R.createElement('input', {type:'checkbox', checked:!!checked, onChange:e=>onChange?.(e.target.checked)}));
|
||||
const DropdownItem = ({label, description, rgOptions=[], selectedOption, onChange}) => R.createElement(Field, {label, description},
|
||||
R.createElement('select', {value:String(selectedOption ?? ''), onChange:e=>onChange?.(rgOptions.find(x=>String(x.data)===e.target.value))},
|
||||
rgOptions.map(x=>R.createElement('option', {key:String(x.data), value:String(x.data)}, x.label))));
|
||||
const ButtonItem = ({label, description, children, disabled, onClick}) => R.createElement(Field, {label, description},
|
||||
R.createElement('button', {type:'button', disabled:!!disabled,
|
||||
onClick:e=>{if(!disabled)onClick?.(e);}}, children || label));
|
||||
const ButtonItem = ({label, children, onClick}) => R.createElement(Field, {label},
|
||||
R.createElement('button', {type:'button', onClick}, children || label));
|
||||
const PanelSection = ({title, children}) => R.createElement('section', null,
|
||||
title && R.createElement('h2', null, title), children);
|
||||
const ConfirmModal = ({strTitle, strOKButtonText, onOK, children}) => R.createElement('section', null,
|
||||
|
||||
Reference in new issue
Block a user