docs: css variables

This commit is contained in:
bordun 2020-04-06 17:01:06 +02:00
parent 8de2c8b3bf
commit 86c98a1b33
8 changed files with 94 additions and 17 deletions

View file

@ -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

View file

@ -1,4 +1,7 @@
<!-- This file is generated automatically from the widget class declarations. See scripts/build-widget-reference.js -->
## Common
<div class="accordion" data-category="generic" markdown="1">
<h6 class="accordionlink" id="generic_properties"><a class="headerlink" href="#generic_properties">Generic properties</a></h3>
@ -27,7 +30,16 @@
| <h6 id="alphaFillOff" class="dynamic">alphaFillOff<a class="headerlink" href="#alphaFillOff" title="Permanent link">#</a></h6> | `number` | <code>"auto"</code> | Fill color opacity (off). |
| <h6 id="alphaFillOn" class="dynamic">alphaFillOn<a class="headerlink" href="#alphaFillOn" title="Permanent link">#</a></h6> | `number` | <code>"auto"</code> | Fill color opacity (on). |
| <h6 id="padding" class="dynamic">padding<a class="headerlink" href="#padding" title="Permanent link">#</a></h6> | `number` | <code>"auto"</code> | Inner spacing. |
| <h6 id="css" class="dynamic">css<a class="headerlink" href="#css" title="Permanent link">#</a></h6> | `string` | <code>""</code> | CSS rules. See <a href="https://openstagecontrol.ammd.net/docs/css-tips/">documentation</a>. |
| <h6 id="css" class="dynamic">css<a class="headerlink" href="#css" title="Permanent link">#</a></h6> | `string` | <code>""</code> | CSS rules. See <a href="https://openstagecontrol.ammd.net/docs/customization/css-tips/">documentation</a>.<br/><br/>Available css variables:<br/>- `--color-widget`: `colorWidget`
<br/>- `--color-fill`: `colorFill`
<br/>- `--color-stroke`: `colorStroke`
<br/>- `--color-text`: `colorText`
<br/>- `--color-background`: `colorPanel`
<br/>- `--widget-padding`: `padding`
<br/>- `--alpha-fill-on`: `alphaFillOn`
<br/>- `--alpha-fill-off`: `alphaFillOff`
<br/>- `--alpha-stroke`: `alphaStroke`
|
| <h6 class="thead2" id="value">value<a class="headerlink" href="#value" title="Permanent link">#</a></h6> ||||
| <h6 id="value" class="dynamic">value<a class="headerlink" href="#value" title="Permanent link">#</a></h6> | `*` | <code>""</code> | Define the widget's value depending on other widget's values / properties using the advanced property syntax |
| <h6 id="default" class="">default<a class="headerlink" href="#default" title="Permanent link">#</a></h6> | `*` | <code>""</code> | If set, the widget will be initialized with this value when the session is loaded. |
@ -52,6 +64,18 @@
| property | type |default | description |
| --- | --- | --- | --- |
| <h6 class="thead2" id="button_style">style<a class="headerlink" href="#button_style" title="Permanent link">#</a></h6> ||||
| <h6 id="button_css" class="dynamic">css<a class="headerlink" href="#button_css" title="Permanent link">#</a></h6> | `string` | <code>""</code> | CSS rules. See <a href="https://openstagecontrol.ammd.net/docs/customization/css-tips/">documentation</a>.<br/><br/>Available css variables:<br/>- `--color-widget`: `colorWidget`
<br/>- `--color-fill`: `colorFill`
<br/>- `--color-stroke`: `colorStroke`
<br/>- `--color-text`: `colorText`
<br/>- `--color-background`: `colorPanel`
<br/>- `--widget-padding`: `padding`
<br/>- `--alpha-fill-on`: `alphaFillOn`
<br/>- `--alpha-fill-off`: `alphaFillOff`
<br/>- `--alpha-stroke`: `alphaStroke`
<br/>- `--color-text-on`: `colorTextOn`
|
| <h6 class="thead2" id="button_button">button<a class="headerlink" href="#button_button" title="Permanent link">#</a></h6> ||||
| <h6 id="button_on" class="dynamic">on<a class="headerlink" href="#button_on" title="Permanent link">#</a></h6> | `*` | <code>1</code> | Set to `null` to send send no argument in the osc message |
| <h6 id="button_off" class="dynamic">off<a class="headerlink" href="#button_off" title="Permanent link">#</a></h6> | `*` | <code>0</code> | 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 |
| --- | --- | --- | --- |
| <h6 class="thead2" id="switch_style">style<a class="headerlink" href="#switch_style" title="Permanent link">#</a></h6> ||||
| <h6 id="switch_css" class="dynamic">css<a class="headerlink" href="#switch_css" title="Permanent link">#</a></h6> | `string` | <code>""</code> | CSS rules. See <a href="https://openstagecontrol.ammd.net/docs/customization/css-tips/">documentation</a>.<br/><br/>Available css variables:<br/>- `--color-widget`: `colorWidget`
<br/>- `--color-fill`: `colorFill`
<br/>- `--color-stroke`: `colorStroke`
<br/>- `--color-text`: `colorText`
<br/>- `--color-background`: `colorPanel`
<br/>- `--widget-padding`: `padding`
<br/>- `--alpha-fill-on`: `alphaFillOn`
<br/>- `--alpha-fill-off`: `alphaFillOff`
<br/>- `--alpha-stroke`: `alphaStroke`
<br/>- `--color-text-on`: `colorTextOn`
|
| <h6 class="thead2" id="switch_switch">switch<a class="headerlink" href="#switch_switch" title="Permanent link">#</a></h6> ||||
| <h6 id="switch_layout" class="">layout<a class="headerlink" href="#switch_layout" title="Permanent link">#</a></h6> | `string` | <code>"vertical"</code> | Choices: `vertical`, `horizontal`, `grid` |
| <h6 id="switch_gridTemplate" class="">gridTemplate<a class="headerlink" href="#switch_gridTemplate" title="Permanent link">#</a></h6> | `string`&vert;<br/>`number` | <code>""</code> | 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 |
| --- | --- | --- | --- |
| <h6 class="thead2" id="fader_style">style<a class="headerlink" href="#fader_style" title="Permanent link">#</a></h6> ||||
| <h6 id="fader_css" class="dynamic">css<a class="headerlink" href="#fader_css" title="Permanent link">#</a></h6> | `string` | <code>""</code> | CSS rules. See <a href="https://openstagecontrol.ammd.net/docs/customization/css-tips/">documentation</a>.<br/><br/>Available css variables:<br/>- `--color-widget`: `colorWidget`
<br/>- `--color-fill`: `colorFill`
<br/>- `--color-stroke`: `colorStroke`
<br/>- `--color-text`: `colorText`
<br/>- `--color-background`: `colorPanel`
<br/>- `--widget-padding`: `padding`
<br/>- `--alpha-fill-on`: `alphaFillOn`
<br/>- `--alpha-fill-off`: `alphaFillOff`
<br/>- `--alpha-stroke`: `alphaStroke`
<br/>- `--alpha-pips`: `alphaPips`
<br/>- `--alpha-pips-text`: `alphaPipsText`
|
| <h6 class="thead2" id="fader_fader">fader<a class="headerlink" href="#fader_fader" title="Permanent link">#</a></h6> ||||
| <h6 id="fader_design" class="">design<a class="headerlink" href="#fader_design" title="Permanent link">#</a></h6> | `string` | <code>"default"</code> | Design style<br/><br/>Choices: `default`, `round`, `compact` |
| <h6 id="fader_horizontal" class="">horizontal<a class="headerlink" href="#fader_horizontal" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to display the fader horizontally |
@ -580,6 +629,19 @@
| property | type |default | description |
| --- | --- | --- | --- |
| <h6 class="thead2" id="knob_style">style<a class="headerlink" href="#knob_style" title="Permanent link">#</a></h6> ||||
| <h6 id="knob_css" class="dynamic">css<a class="headerlink" href="#knob_css" title="Permanent link">#</a></h6> | `string` | <code>""</code> | CSS rules. See <a href="https://openstagecontrol.ammd.net/docs/customization/css-tips/">documentation</a>.<br/><br/>Available css variables:<br/>- `--color-widget`: `colorWidget`
<br/>- `--color-fill`: `colorFill`
<br/>- `--color-stroke`: `colorStroke`
<br/>- `--color-text`: `colorText`
<br/>- `--color-background`: `colorPanel`
<br/>- `--widget-padding`: `padding`
<br/>- `--alpha-fill-on`: `alphaFillOn`
<br/>- `--alpha-fill-off`: `alphaFillOff`
<br/>- `--alpha-stroke`: `alphaStroke`
<br/>- `--alpha-pips`: `alphaPips`
<br/>- `--alpha-pips-text`: `alphaPipsText`
|
| <h6 class="thead2" id="knob_knob">knob<a class="headerlink" href="#knob_knob" title="Permanent link">#</a></h6> ||||
| <h6 id="knob_mode" class="">mode<a class="headerlink" href="#knob_mode" title="Permanent link">#</a></h6> | `string` | <code>"vertical"</code> | - `circular`: relative move in circular motion<br/>- `snap`: snap to touch position and move in vertical motion<br/>- `vertical`: relative move in vertical motion<br/><br/>Choices: `vertical`, `circular`, `snap` |
| <h6 id="knob_spring" class="dynamic">spring<a class="headerlink" href="#knob_spring" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | When set to `true`, the widget will go back to its `default` value when released |
@ -625,6 +687,19 @@
| property | type |default | description |
| --- | --- | --- | --- |
| <h6 class="thead2" id="range_style">style<a class="headerlink" href="#range_style" title="Permanent link">#</a></h6> ||||
| <h6 id="range_css" class="dynamic">css<a class="headerlink" href="#range_css" title="Permanent link">#</a></h6> | `string` | <code>""</code> | CSS rules. See <a href="https://openstagecontrol.ammd.net/docs/customization/css-tips/">documentation</a>.<br/><br/>Available css variables:<br/>- `--color-widget`: `colorWidget`
<br/>- `--color-fill`: `colorFill`
<br/>- `--color-stroke`: `colorStroke`
<br/>- `--color-text`: `colorText`
<br/>- `--color-background`: `colorPanel`
<br/>- `--widget-padding`: `padding`
<br/>- `--alpha-fill-on`: `alphaFillOn`
<br/>- `--alpha-fill-off`: `alphaFillOff`
<br/>- `--alpha-stroke`: `alphaStroke`
<br/>- `--alpha-pips`: `alphaPips`
<br/>- `--alpha-pips-text`: `alphaPipsText`
|
| <h6 class="thead2" id="range_fader">fader<a class="headerlink" href="#range_fader" title="Permanent link">#</a></h6> ||||
| <h6 id="range_design" class="">design<a class="headerlink" href="#range_design" title="Permanent link">#</a></h6> | `string` | <code>"default"</code> | Design style<br/><br/>Choices: `default`, `round`, `compact` |
| <h6 id="range_horizontal" class="">horizontal<a class="headerlink" href="#range_horizontal" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to display the fader horizontally |

View file

@ -8,6 +8,9 @@ var widgets = require('../src/client/widgets'),
doc.push(`
## Common
<div class="accordion" data-category="generic" markdown="1">
<h6 class="accordionlink" id="generic_properties"><a class="headerlink" href="#generic_properties">Generic properties</a></h3>

View file

@ -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)
}

View file

@ -31,7 +31,7 @@ class Switch extends MenuBase {
]},
colorTextOn: {type: 'string', value: 'auto', help: 'Defines the widget\'s text color when active.'},
})
}, [], {}, Switch)
}

View file

@ -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 <a href="https://openstagecontrol.ammd.net/docs/css-tips/">documentation</a>.'},
css: {type: 'string', value: '', help: [
'CSS rules. See <a href="https://openstagecontrol.ammd.net/docs/customization/css-tips/">documentation</a>.',
'Available css variables:',
...Class.cssVariables.map(x=>'- `' + x.css + '`: `' + x.js + '`\n')
]},
_value: 'value',

View file

@ -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)
}

View file

@ -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)
}