From 4af5c8b1b6b62fff7e061581b0795e8e3e23d114 Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 22 May 2020 15:29:59 +0200 Subject: [PATCH 1/6] script: make builtin script use parent locals --- src/client/widgets/scripts/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/widgets/scripts/script.js b/src/client/widgets/scripts/script.js index c0f8e0fe..62e74285 100644 --- a/src/client/widgets/scripts/script.js +++ b/src/client/widgets/scripts/script.js @@ -105,7 +105,7 @@ class Script extends Widget { this.scriptLock = true try { - this.script(context, this.parsersLocalScope) + this.script(context, this.builtIn ? this.parent.parsersLocalScope : this.parsersLocalScope) } catch(e) { console.log(e) } From 4b9b8677a0231419717bd635877d72815110003a Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 22 May 2020 15:33:36 +0200 Subject: [PATCH 2/6] script: add updateProp() to force prop check on a widget --- resources/docs/docs/widgets/scripting.md | 8 ++++++++ src/client/widgets/scripts/script-vm.js | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/resources/docs/docs/widgets/scripting.md b/resources/docs/docs/widgets/scripting.md index 53899106..d4f82c6b 100644 --- a/resources/docs/docs/widgets/scripting.md +++ b/resources/docs/docs/widgets/scripting.md @@ -64,6 +64,14 @@ Returns the property called `"name"` of the first matching widget. ---- +#### `updateProp`: `function(id, name)` +- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget. +- `name`: property name. + +Forcers a widget to check if one of its properties has changed and update itself if needed. + +---- + #### `httpGet`: `function(url, callback)` - `url`: url of the resource to fetch (local url only) diff --git a/src/client/widgets/scripts/script-vm.js b/src/client/widgets/scripts/script-vm.js index 575783b0..b2f0e9e4 100644 --- a/src/client/widgets/scripts/script-vm.js +++ b/src/client/widgets/scripts/script-vm.js @@ -132,6 +132,21 @@ class ScriptVm extends Vm { } + this.sandbox.contentWindow.updateProp = (id, prop)=>{ + + var widgets = this.resolveId(id), + widget = this.getWidget() + + if (widget.builtIn) widget = widget.parent + + for (var i = widgets.length - 1; i >= 0; i--) { + + widgets[i].updateProps(Array.isArray(prop) ? prop : [prop], widget) + + } + + } + this.sandbox.contentWindow.httpGet = (url, callback)=>{ var parser = urlParser(url), @@ -263,7 +278,7 @@ class ScriptVm extends Vm { } - for (var imports of ['set', 'get', 'getProp', 'send', 'httpGet', 'stateGet', 'stateSet', 'storage', + for (var imports of ['set', 'get', 'getProp', 'updateProp', 'send', 'httpGet', 'stateGet', 'stateSet', 'storage', 'setInterval', 'clearInterval', 'setTimeout', 'clearTimeout']) { this.sanitize(this.sandbox.contentWindow[imports]) } From f8e8df63c17eb5ec21ec9a5d4c813eb6ac591c5d Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 22 May 2020 16:35:27 +0200 Subject: [PATCH 3/6] plot: small dots, false by default --- src/client/widgets/graphs/plot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/widgets/graphs/plot.js b/src/client/widgets/graphs/plot.js index d1edd1ac..8cc8325e 100644 --- a/src/client/widgets/graphs/plot.js +++ b/src/client/widgets/graphs/plot.js @@ -23,7 +23,7 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte logScaleX: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm\'s base.'}, logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm\'s base.'}, origin: {type: 'number', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it.'}, - dots: {type: 'boolean', value: true, help: 'Draw dots on the line'}, + dots: {type: 'boolean', value: false, help: 'Draw dots on the line'}, bars: {type: 'boolean', value: false, help: 'Set to `true` to use draw bars instead (disables `logScaleX` and forces `x axis` even spacing)'}, pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'}, @@ -186,7 +186,7 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte this.ctx.lineWidth = 2 * PXSCALE for (var i = 0; i < points.length; i += 2) { this.ctx.beginPath() - this.ctx.arc(points[i], points[i + 1], 3 * PXSCALE, 0, 2*Math.PI) + this.ctx.arc(points[i], points[i + 1], 2 * PXSCALE, 0, 2*Math.PI) this.ctx.fill() this.ctx.stroke() } From ad67f8833d7948c39f2a115b7b9e57c278f65972 Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 22 May 2020 16:35:39 +0200 Subject: [PATCH 4/6] ui: padding in simple message modals --- src/scss/ui/modal.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scss/ui/modal.scss b/src/scss/ui/modal.scss index be085193..b16a8adc 100644 --- a/src/scss/ui/modal.scss +++ b/src/scss/ui/modal.scss @@ -101,8 +101,9 @@ $padding: 8rem; white-space: normal; line-height: 150%; background: var(--color-background); - padding-top:8rem; + padding: $padding; overflow-x: auto; } + } } From 60c6dac12629dbaffb03fbba9845f6debd489752 Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 22 May 2020 18:52:45 +0200 Subject: [PATCH 5/6] docs: css update --- resources/docs/docs/customization/css-tips.md | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/resources/docs/docs/customization/css-tips.md b/resources/docs/docs/customization/css-tips.md index 3a2db74c..58fc3018 100644 --- a/resources/docs/docs/customization/css-tips.md +++ b/resources/docs/docs/customization/css-tips.md @@ -1,5 +1,11 @@ # CSS Tips +## Browser inspector + + +Hit `F12` to open the developers tools panel. The html/css inspector helps retreiving the class names needed to style specific parts of the widgets + + ## Inline syntax For simple use cases, the `css` property can be written as a HTML inline styles (without any CSS selector). CSS rules will apply to the widget element. @@ -84,19 +90,3 @@ Media queries can also be used: [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) declared in the [default theme](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/scss/themes/default.scss) can be overriden. Widgets also rely on CSS variables for the style properties (colors, padding, etc). These are documented in the widgets' `css` property description. - -## Other tips - -#### Use the inspector - -Hit `F12` to open the developers tools panel. The html/css inspector helps retreiving the class names needed to style specific parts of the widgets. - -#### Panel's background-color - -This works for panel, strip and tabs: - -```css -> .panel { - background-color: red; -} -``` From 3c82da0557139f47d2eb2824a0b8cef4c31679c8 Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 22 May 2020 19:08:41 +0200 Subject: [PATCH 6/6] filebrowser: input margin fix --- src/scss/ui/filebrowser.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scss/ui/filebrowser.scss b/src/scss/ui/filebrowser.scss index 2818d40c..b04a1f42 100644 --- a/src/scss/ui/filebrowser.scss +++ b/src/scss/ui/filebrowser.scss @@ -69,7 +69,7 @@ $padding: 8rem; // border: $padding solid var(--color-ui-background); padding: $padding; background: var(--color-ui-background); - .btn, input { + .btn { margin: 1rem; margin-left: $padding; text-overflow: clip; @@ -82,6 +82,7 @@ $padding: 8rem; .save-as { flex:1; border: 0; + margin: 1rem; padding: 0 10rem; font-size: 120%; position: relative;