diff --git a/resources/docs/docs/customization/css-tips.md b/resources/docs/docs/customization/css-tips.md
index ebd93d37..3a2db74c 100644
--- a/resources/docs/docs/customization/css-tips.md
+++ b/resources/docs/docs/customization/css-tips.md
@@ -46,16 +46,9 @@ Multiple classes can be added (one per `class` statement). Custom classes are al
Z-Axis ordering can be set using the `z-index` rule. Absolutely positionned widgets (when `top` or `left` is different from `auto`) have `z-index:10;` by default.
-## Layering: `pointer-events`
-
-To make a widget ignore interactions (ie to be able to click through it), add `pointer-events:none;`.
-
-!!! info ""
- This is always ignored when the editor is enabled.
-
## Responsive sizing
-In most cases, using percentages in `height` and `width` will do. CSS `calc()` function can help in some cases (set the corresponding property to `auto` to avoid conflicts):
+In most cases, using `vertical`, `horizontal` or `grid` layouts as well as using percentages in `height` and `width` will do. CSS `calc()` function can help in some cases (set the corresponding property to `auto` to avoid conflicts):
```css
:host {
@@ -86,9 +79,11 @@ Media queries can also be used:
- use `%` for font-size
-## CSS Variables
+## CSS variables
-CSS Variables declared in the [default theme](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/scss/themes/default.scss) can be overriden. Some widgets also use specific CSS variables (mostly to define colors) documented on their respective pages.
+[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
diff --git a/resources/docs/docs/widgets/properties-reference.md b/resources/docs/docs/widgets/properties-reference.md
index ab7e8777..a04275ab 100644
--- a/resources/docs/docs/widgets/properties-reference.md
+++ b/resources/docs/docs/widgets/properties-reference.md
@@ -1,4 +1,7 @@
+
+## Common
+
@@ -27,7 +30,16 @@
| alphaFillOff
| `number` | "auto" | Fill color opacity (off). |
| alphaFillOn
| `number` | "auto" | Fill color opacity (on). |
| padding
| `number` | "auto" | Inner spacing. |
-| css
| `string` | "" | CSS rules. See documentation. |
+| css
| `string` | "" | CSS rules. See documentation.
Available css variables:
- `--color-widget`: `colorWidget`
+
- `--color-fill`: `colorFill`
+
- `--color-stroke`: `colorStroke`
+
- `--color-text`: `colorText`
+
- `--color-background`: `colorPanel`
+
- `--widget-padding`: `padding`
+
- `--alpha-fill-on`: `alphaFillOn`
+
- `--alpha-fill-off`: `alphaFillOff`
+
- `--alpha-stroke`: `alphaStroke`
+|
| value
||||
| value
| `*` | "" | Define the widget's value depending on other widget's values / properties using the advanced property syntax |
| default
| `*` | "" | If set, the widget will be initialized with this value when the session is loaded. |
@@ -52,6 +64,18 @@
| property | type |default | description |
| --- | --- | --- | --- |
+| ||||
+| | `string` | "" | CSS rules. See documentation.
Available css variables:
- `--color-widget`: `colorWidget`
+
- `--color-fill`: `colorFill`
+
- `--color-stroke`: `colorStroke`
+
- `--color-text`: `colorText`
+
- `--color-background`: `colorPanel`
+
- `--widget-padding`: `padding`
+
- `--alpha-fill-on`: `alphaFillOn`
+
- `--alpha-fill-off`: `alphaFillOff`
+
- `--alpha-stroke`: `alphaStroke`
+
- `--color-text-on`: `colorTextOn`
+|
| ||||
| | `*` | 1 | Set to `null` to send send no argument in the osc message |
| | `*` | 0 | Set to `null` to send send no argument in the osc message. Must be different from `on`. |
@@ -69,6 +93,18 @@
| property | type |default | description |
| --- | --- | --- | --- |
+| style
||||
+| css
| `string` | "" | CSS rules. See documentation.
Available css variables:
- `--color-widget`: `colorWidget`
+
- `--color-fill`: `colorFill`
+
- `--color-stroke`: `colorStroke`
+
- `--color-text`: `colorText`
+
- `--color-background`: `colorPanel`
+
- `--widget-padding`: `padding`
+
- `--alpha-fill-on`: `alphaFillOn`
+
- `--alpha-fill-off`: `alphaFillOff`
+
- `--alpha-stroke`: `alphaStroke`
+
- `--color-text-on`: `colorTextOn`
+|
| switch
||||
| layout
| `string` | "vertical" | Choices: `vertical`, `horizontal`, `grid` |
| gridTemplate
| `string`|
`number` | "" | If `layout` is `grid`, can be either a number of columns of a value css grid-template definition. |
@@ -553,6 +589,19 @@
| property | type |default | description |
| --- | --- | --- | --- |
+| style
||||
+| css
| `string` | "" | CSS rules. See documentation.
Available css variables:
- `--color-widget`: `colorWidget`
+
- `--color-fill`: `colorFill`
+
- `--color-stroke`: `colorStroke`
+
- `--color-text`: `colorText`
+
- `--color-background`: `colorPanel`
+
- `--widget-padding`: `padding`
+
- `--alpha-fill-on`: `alphaFillOn`
+
- `--alpha-fill-off`: `alphaFillOff`
+
- `--alpha-stroke`: `alphaStroke`
+
- `--alpha-pips`: `alphaPips`
+
- `--alpha-pips-text`: `alphaPipsText`
+|
| fader
||||
| design
| `string` | "default" | Design style
Choices: `default`, `round`, `compact` |
| horizontal
| `boolean` | false | Set to `true` to display the fader horizontally |
@@ -580,6 +629,19 @@
| property | type |default | description |
| --- | --- | --- | --- |
+| style
||||
+| css
| `string` | "" | CSS rules. See documentation.
Available css variables:
- `--color-widget`: `colorWidget`
+
- `--color-fill`: `colorFill`
+
- `--color-stroke`: `colorStroke`
+
- `--color-text`: `colorText`
+
- `--color-background`: `colorPanel`
+
- `--widget-padding`: `padding`
+
- `--alpha-fill-on`: `alphaFillOn`
+
- `--alpha-fill-off`: `alphaFillOff`
+
- `--alpha-stroke`: `alphaStroke`
+
- `--alpha-pips`: `alphaPips`
+
- `--alpha-pips-text`: `alphaPipsText`
+|
| knob
||||
| mode
| `string` | "vertical" | - `circular`: relative move in circular motion
- `snap`: snap to touch position and move in vertical motion
- `vertical`: relative move in vertical motion
Choices: `vertical`, `circular`, `snap` |
| spring
| `boolean` | false | When set to `true`, the widget will go back to its `default` value when released |
@@ -625,6 +687,19 @@
| property | type |default | description |
| --- | --- | --- | --- |
+| style
||||
+| css
| `string` | "" | CSS rules. See documentation.
Available css variables:
- `--color-widget`: `colorWidget`
+
- `--color-fill`: `colorFill`
+
- `--color-stroke`: `colorStroke`
+
- `--color-text`: `colorText`
+
- `--color-background`: `colorPanel`
+
- `--widget-padding`: `padding`
+
- `--alpha-fill-on`: `alphaFillOn`
+
- `--alpha-fill-off`: `alphaFillOff`
+
- `--alpha-stroke`: `alphaStroke`
+
- `--alpha-pips`: `alphaPips`
+
- `--alpha-pips-text`: `alphaPipsText`
+|
| fader
||||
| design
| `string` | "default" | Design style
Choices: `default`, `round`, `compact` |
| horizontal
| `boolean` | false | Set to `true` to display the fader horizontally |
diff --git a/scripts/build-widgets-reference.js b/scripts/build-widgets-reference.js
index d69018cb..6816c183 100644
--- a/scripts/build-widgets-reference.js
+++ b/scripts/build-widgets-reference.js
@@ -8,6 +8,9 @@ var widgets = require('../src/client/widgets'),
doc.push(`
+
+ ## Common
+
diff --git a/src/client/widgets/basics/button.js b/src/client/widgets/basics/button.js
index 16a9888c..ca21a4a6 100644
--- a/src/client/widgets/basics/button.js
+++ b/src/client/widgets/basics/button.js
@@ -33,7 +33,7 @@ class Button extends Widget {
doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the button require a double tap to be pushed instead of a single tap'},
colorTextOn: {type: 'string', value: 'auto', help: 'Defines the widget\'s text color when active.'},
- })
+ }, [], {}, Button)
}
diff --git a/src/client/widgets/basics/switch.js b/src/client/widgets/basics/switch.js
index c624ce8d..d7c994f6 100644
--- a/src/client/widgets/basics/switch.js
+++ b/src/client/widgets/basics/switch.js
@@ -31,7 +31,7 @@ class Switch extends MenuBase {
]},
colorTextOn: {type: 'string', value: 'auto', help: 'Defines the widget\'s text color when active.'},
- })
+ }, [], {}, Switch)
}
diff --git a/src/client/widgets/common/widget.js b/src/client/widgets/common/widget.js
index c63a4086..7230a00b 100644
--- a/src/client/widgets/common/widget.js
+++ b/src/client/widgets/common/widget.js
@@ -44,7 +44,7 @@ class Widget extends EventEmitter {
}
- static defaults(insert={}, except=[], push={}) {
+ static defaults(insert={}, except=[], push={}, Class=Widget) {
var defaults = {
@@ -88,7 +88,11 @@ class Widget extends EventEmitter {
- css: {type: 'string', value: '', help: 'CSS rules. See documentation.'},
+ css: {type: 'string', value: '', help: [
+ 'CSS rules. See documentation.',
+ 'Available css variables:',
+ ...Class.cssVariables.map(x=>'- `' + x.css + '`: `' + x.js + '`\n')
+ ]},
_value: 'value',
diff --git a/src/client/widgets/sliders/fader.js b/src/client/widgets/sliders/fader.js
index 07bb2426..4a7e1457 100644
--- a/src/client/widgets/sliders/fader.js
+++ b/src/client/widgets/sliders/fader.js
@@ -52,7 +52,7 @@ module.exports = class Fader extends Slider {
touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`'},
- })
+ }, Fader)
}
diff --git a/src/client/widgets/sliders/knob.js b/src/client/widgets/sliders/knob.js
index 2d6888e0..64a75f8a 100644
--- a/src/client/widgets/sliders/knob.js
+++ b/src/client/widgets/sliders/knob.js
@@ -48,7 +48,7 @@ module.exports = class Knob extends Slider {
touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`'},
- })
+ }, Knob)
}