diff --git a/resources/docs/docs/remote-control.md b/resources/docs/docs/remote-control.md index d5c93062..214468a8 100644 --- a/resources/docs/docs/remote-control.md +++ b/resources/docs/docs/remote-control.md @@ -5,35 +5,28 @@ All widgets that send osc messages respond to the same messages. Additionnaly, O ---- -#### `/EDIT id options` +#### `/EDIT id properties options` Apply a set of options to an existing widget by replacing the old ones with the new ones. - `id`: `string`, widget's `id` -- `options`: `string`, [JSON5](https://github.com/json5/json5) stringified object defining the new properties to merge +- `properties`: `string`, [JSON5](https://github.com/json5/json5) stringified object defining the new properties to merge - example: `{"label":"New Label", "color":"red"}` +- `options` (optional): `string`, [JSON5](https://github.com/json5/json5) stringified object defining extra option flags: + - `noWarning`: set to `true` to prevent further warning when exiting. -!!! info "" - Editing a widget can be cpu expensive, hence updating the UI continuously is not a good idea +!!! danger "Warning" + Editing widgets is cpu expensive; for small and recurrent changes, consider using [osc listeners](./widgets/advanced-syntaxes.md) instead. ---- -#### `/EDIT/MERGE id options` +#### `/EDIT/MERGE id properties options` Apply a set of options to an existing widget by merging them to the widget's options. - -- `id`: `string`, widget's `id` -- `options`: `string`, [JSON5](https://github.com/json5/json5) stringified object defining the new properties to merge - - example: `{"label":"New Label", "color":"red"}` - -!!! info "" - Editing a widget can be cpu expensive, hence updating the UI continuously is not a good idea - - ---- #### `/EDIT/UNDO` diff --git a/resources/docs/docs/widgets/properties-reference.md b/resources/docs/docs/widgets/properties-reference.md index 878759a9..cf654c13 100644 --- a/resources/docs/docs/widgets/properties-reference.md +++ b/resources/docs/docs/widgets/properties-reference.md @@ -14,7 +14,7 @@ | --- | --- | --- | --- | |
type#
| `string` | "auto" | | |
id#
| `string` | "auto" | Widgets sharing the same `id` will act as clones and update each other's value(s) without sending extra osc messages. | - |
label#
| `string`|
`boolean` | "auto" | Set to `false` to hide completely

Insert icons using the prefix ^ followed by the icon's name : ^play, ^pause, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free) | + |
label#
| `string`|
`boolean` | "auto" | Set to `false` to hide completely
- Insert icons using the prefix ^ followed by the icon's name : `^play`, `^pause`, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free)
- Icons can be transformed with the following suffixes: `.flip-[horizontal|vertical|both]`, `.rotate-[90|180|270]`, `.spin`, `.pulse`. Example: `^play.flip-horizontal` | |
visible#
| `boolean` | true | Set to `false` to hide the widget. | |
interaction#
| `boolean` | true | Set to `false` to disable pointer interactions. | @@ -165,19 +165,30 @@ | property | type |default | description | | --- | --- | --- | --- | |
colorPanel#
| `string` | "auto" | Panel background color. Set to "auto" to inherit from parent widget. | + |
variables#
| `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | + |
traversing#
| `boolean` | false | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget | + + === "panel: widget container" + + | property | type |default | description | + | --- | --- | --- | --- | |
layout#
| `string` | "default" | Defines how children are laid out.

Choices: `default`, `vertical`, `horizontal`, `grid` | |
justify#
| `string` | "start" | If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.

Choices: `start`, `end`, `center`, `space-around`, `space-between` | |
gridTemplate#
| `string`|
`number` | "" | If `layout` is `grid`, can be either a number of columns of a value css grid-template definition. | - |
verticalTabs#
| `boolean` | false | Set to `true` to display for vertical tab layout | - |
traversing#
| `boolean` | false | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget | |
scroll#
| `boolean` | true | Set to `false` to disable scrollbars | - |
variables#
| `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | + |
innerPadding#
| `boolean` | true | Set to `false` to make the `padding` property apply only between children and not at the container's inner boundaries. | + + === "panel: tab container" + + | property | type |default | description | + | --- | --- | --- | --- | + |
verticalTabs#
| `boolean` | false | Set to `true` to display for vertical tab layout | === "value" | property | type |default | description | | --- | --- | --- | --- | - |
value#
| `integer` | "" | Defines currently widgeted tab in the widget

A tab can be opened only by setting its parent's value | + |
value#
| `integer` | "" | Defines currently selected tab in the widget

A tab can be opened only by setting its parent's value | === "children" @@ -194,6 +205,12 @@ | property | type |default | description | | --- | --- | --- | --- | | | `boolean` | false | Set to `true` to make the modal require a double tap to open instead of a single tap | + | | `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | + + === "modal: popup" + + | property | type |default | description | + | --- | --- | --- | --- | | | `string` | "" | Alternative label for the modal popup | | | `number`|
`percentage` | "80%" | Modal popup's size | | | `number`|
`percentage` | "80%" | Modal popup's size | @@ -204,7 +221,7 @@ | | `string`|
`number` | "" | If `layout` is `grid`, can be either a number of columns of a value css grid-template definition. | | | `boolean` | false | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget | | | `boolean` | true | Set to `false` to disable scrollbars | - | | `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | + | | `boolean` | true | Set to `false` to make the `padding` property apply only between children and not at the container's inner boundaries. | === "value" @@ -236,18 +253,24 @@ ??? api "
matrix#
" Generic matrix for creating rows/columns of widgets. - === "matrix" + === "matrix: widgets" | property | type |default | description | | --- | --- | --- | --- | |
widgetType#
| `string` | "button" | Defines the type of the widgets in the matrix | + |
quantity#
| `number` | 4 | Defines the number of widgets in the matrix | + |
start#
| `integer` | 0 | First widget's index | + |
props#
| `object` | \{} | Defines a set of property to override the widgets' defaults.

Formulas in this field are resolved with an extra variable representing each widget's index: `$`

Note: by default, the widgets inherit from the matrix' `id` and osc properties (`id` and `address` are appended with `/$`) | + + === "matrix: layout" + + | property | type |default | description | + | --- | --- | --- | --- | |
colorPanel#
| `string` | "auto" | Panel background color. Set to "auto" to inherit from parent widget. | |
layout#
| `string` | "horizontal" | Defines how children are laid out.

Choices: `horizontal`, `vertical`, `grid` | |
gridTemplate#
| `string`|
`number` | "" | If `layout` is `grid`, can be either a number of columns of a value css grid-template definition. | - |
quantity#
| `number` | 4 | Defines the number of widgets in the matrix | - |
start#
| `integer` | 0 | First widget's index | |
traversing#
| `boolean` | true | Set to `false` to disable traversing gestures | - |
props#
| `object` | \{} | Defines a set of property to override the widgets' defaults.

Formulas in this field are resolved with an extra variable representing each widget's index: `$`

Note: by default, the widgets inherit from the matrix' `id` and osc properties (`id` and `address` are appended with `/$`) | + |
innerPadding#
| `boolean` | true | Set to `false` to make the `padding` property apply only between children and not at the container's inner boundaries. | ??? api "
keyboard#
" Piano keyboard. @@ -293,13 +316,24 @@ | property | type |default | description | | --- | --- | --- | --- | |
colorPanel#
| `string` | "auto" | Panel background color. Set to "auto" to inherit from parent widget. | + |
variables#
| `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | + |
traversing#
| `boolean` | false | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget | + + === "panel: widget container" + + | property | type |default | description | + | --- | --- | --- | --- | |
layout#
| `string` | "default" | Defines how children are laid out.

Choices: `default`, `vertical`, `horizontal`, `grid` | |
justify#
| `string` | "start" | If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.

Choices: `start`, `end`, `center`, `space-around`, `space-between` | |
gridTemplate#
| `string`|
`number` | "" | If `layout` is `grid`, can be either a number of columns of a value css grid-template definition. | - |
verticalTabs#
| `boolean` | false | Set to `true` to display for vertical tab layout | - |
traversing#
| `boolean` | false | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget | |
scroll#
| `boolean` | true | Set to `false` to disable scrollbars | - |
variables#
| `*` | "" | Defines one or more arbitrary variables that can be inherited by children widgets | + |
innerPadding#
| `boolean` | true | Set to `false` to make the `padding` property apply only between children and not at the container's inner boundaries. | + + === "panel: tab container" + + | property | type |default | description | + | --- | --- | --- | --- | + |
verticalTabs#
| `boolean` | false | Set to `true` to display for vertical tab layout | === "value" @@ -317,18 +351,29 @@ ??? api "
tab#
" Tabbed panel widget - === "tab" + === "panel" | property | type |default | description | | --- | --- | --- | --- | |
colorPanel#
| `string` | "auto" | Panel background color. Set to "auto" to inherit from parent widget. | + |
variables#
| `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | + |
traversing#
| `boolean` | false | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget | + + === "panel: widget container" + + | property | type |default | description | + | --- | --- | --- | --- | |
layout#
| `string` | "default" | Defines how children are laid out.

Choices: `default`, `vertical`, `horizontal`, `grid` | |
justify#
| `string` | "start" | If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.

Choices: `start`, `end`, `center`, `space-around`, `space-between` | |
gridTemplate#
| `string`|
`number` | "" | If `layout` is `grid`, can be either a number of columns of a value css grid-template definition. | - |
verticalTabs#
| `boolean` | false | Set to `true` to display for vertical tab layout | - |
traversing#
| `boolean` | false | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget | |
scroll#
| `boolean` | true | Set to `false` to disable scrollbars | - |
variables#
| `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | + |
innerPadding#
| `boolean` | true | Set to `false` to make the `padding` property apply only between children and not at the container's inner boundaries. | + + === "panel: tab container" + + | property | type |default | description | + | --- | --- | --- | --- | + |
verticalTabs#
| `boolean` | false | Set to `true` to display for vertical tab layout | === "value" diff --git a/src/client/remote-control.js b/src/client/remote-control.js index c791f991..58b555ad 100644 --- a/src/client/remote-control.js +++ b/src/client/remote-control.js @@ -4,14 +4,15 @@ var {updateWidget} = require('./editor/data-workers'), stateManager = require('./managers/state'), deepExtend = require('deep-extend'), notifications = require('./ui/notifications') - + var callbacks = { '/EDIT': function(args) { if (READ_ONLY) return - var [id, json] = args, + var [id, json, opts] = args, newdata = typeof json == 'string' ? JSON.parseFlex(json) : json, + options = typeof opts == 'string' ? JSON.parseFlex(opts) : {}, widgets = widgetManager.getWidgetById(id) if (!widgets.length) return @@ -33,13 +34,16 @@ var callbacks = { editor.pushHistory() + if (options.noWarning) editor.unsavedSession = false + }, '/EDIT/MERGE': function(args) { if (READ_ONLY) return - var [id, json] = args, + var [id, json, opts] = args, newdata = typeof json == 'string' ? JSON.parseFlex(json) : json, + options = typeof opts == 'string' ? JSON.parseFlex(opts) : {}, widgets = widgetManager.getWidgetById(id) if (!widgets.length) return @@ -59,6 +63,8 @@ var callbacks = { editor.pushHistory() + if (options.noWarning) editor.unsavedSession = false + }, '/EDIT/UNDO': function(args) {