diff --git a/CHANGELOG.md b/CHANGELOG.md index 5efa2b70..62a06368 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog -## 1.30.5 +## 1.31.0 + +- widgets + - clone, fragment: add `scoped` property. This allows making a clone self-contained (independant from its original) by prefixing all widget ids automatically (and transparently resolving unprefixed ids in advanced syntaxes and scripts within the scope) - bug fixes - midi: unrecognized `no_auto_note_off` option diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 5c76e3c7..c579ad94 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -425,11 +425,11 @@ class Widget extends EventEmitter { if (this.meta.scopable) { var parent = this.parent do { - if (parent.getProp('scopedId')) { + if (parent.getProp('scoped')) { this.scopes.push(parent.scopeId) } parent = parent.parent - } while (parent.meta.scopable || parent.getProp('scopedId')) + } while (parent.meta.scopable || parent.getProp('scoped')) for (var i=0; i < this.scopes.length; i++) { this.scopes[i] = this.scopes.slice(i).reverse().join('/') + '/' } diff --git a/src/client/widgets/containers/clone.mjs b/src/client/widgets/containers/clone.mjs index 287a4ba5..5133ec5d 100644 --- a/src/client/widgets/containers/clone.mjs +++ b/src/client/widgets/containers/clone.mjs @@ -23,9 +23,10 @@ class Clone extends Container() { class_specific: { widgetId: {type: 'string', value: '', help: '`id` of the widget to clone'}, - scopedId: {type: 'boolean|string', value: false, help: [ + scoped: {type: 'boolean|string', value: false, help: [ 'Set to `true` to prefix all cloned `id`s inside the clone with a unique identifier and make the clone independent from its original. All `@{}` blocks and scripts will be prefixed automatically so that they resolve to widgets within the clone if possible, falling back to unprefixed ids otherwise. `linkId` will be prefixed as well but will only resolve within the clone.', - 'Set to a string to define the `ìd` prefix manually (a trailing slash will be added automatically).' + '`clone` and `scrollbar` widgets will prioritize targets closer to their scope, falling back to farther target.', + 'Set this property to a string to define the `ìd` prefix manually (a trailing slash will be added automatically). This can be useful if one must access a scoped widget via scripting or remote control commands.' ]}, props: {type: 'object', value: {}, editor: 'javascript', syntaxChecker: false, help: 'Cloned widget\'s properties to override'}, }, @@ -54,7 +55,7 @@ class Clone extends Container() { this.targetRank = null this.cloneClass = [] - this.scopeId = this.getProp('scopedId') === true ? this.hash : this.getProp('scopedId') === false ? '' : this.getProp('scopedId') + this.scopeId = this.getProp('scoped') === true ? this.hash : this.getProp('scoped') === false ? '' : this.getProp('scoped') this.modalBreakout = 0 diff --git a/src/client/widgets/containers/fragment.mjs b/src/client/widgets/containers/fragment.mjs index 0ed04281..0979425f 100644 --- a/src/client/widgets/containers/fragment.mjs +++ b/src/client/widgets/containers/fragment.mjs @@ -29,9 +29,10 @@ class Fragment extends Container() { class_specific: { file: {type: 'string', value: '', help: 'Fragment file path (relative to the session or theme file location by default, falling back to absolute path)'}, fallback: {type: 'string', value: '', help: 'Fallack fragment file path, loaded if `file` can\'t be opened'}, - scopedId: {type: 'boolean|string', value: false, help: [ - 'Set to `true` to prefix all widget `id`s inside the clone with a unique identifier and make the fragment self-contained. All `@{}` blocks and scripts will be prefixed automatically so that they resolve to widgets within the fragment if possible, falling back to unprefixed ids otherwise. `linkId` will be prefixed as well but will only resolve within the fragment.', - 'Set to a string to define the `ìd` prefix manually (a trailing slash will be added automatically).' + scoped: {type: 'boolean|string', value: false, help: [ + 'Set to `true` to prefix all cloned `id`s inside the clone with a unique identifier and make the clone independent from its original. All `@{}` blocks and scripts will be prefixed automatically so that they resolve to widgets within the clone if possible, falling back to unprefixed ids otherwise. `linkId` will be prefixed as well but will only resolve within the clone.', + '`clone` and `scrollbar` widgets will prioritize targets closer to their scope, falling back to farther target.', + 'Set this property to a string to define the `ìd` prefix manually (a trailing slash will be added automatically). This can be useful if one must access a scoped widget via scripting or remote control commands.' ]}, props: {type: 'object', value: {}, editor: 'javascript', syntaxChecker: false, help: 'Fragment widget\'s properties to override'}, }, @@ -55,7 +56,7 @@ class Fragment extends Container() { this.noValueState = true - this.scopeId = this.getProp('scopedId') === true ? this.hash : this.getProp('scopedId') === false ? '' : this.getProp('scopedId') + this.scopeId = this.getProp('scoped') === true ? this.hash : this.getProp('scoped') === false ? '' : this.getProp('scoped') this.modalBreakout = 0