doc: @props
This commit is contained in:
parent
0295d6feb3
commit
5c09070265
2 changed files with 29 additions and 12 deletions
|
|
@ -17,6 +17,21 @@ All widgets share a set of generic properties described below. Each widget type
|
|||
}
|
||||
```
|
||||
|
||||
## Property inheritance
|
||||
|
||||
Widgets can use each other's property values by using the following syntaxes:
|
||||
|
||||
- `@{this.propertyName}`
|
||||
- `@{parent.propertyName}`
|
||||
- `@{widgetId.propertyName}` (where `widgetId` is the target widget's `id`)
|
||||
|
||||
It can be used to:
|
||||
|
||||
- concatenate strings: `/@{parent.id}/some_suffix`
|
||||
- define object value: `["@{parent.id}"]`
|
||||
|
||||
If the retreived property is an object (`[] / {}`), it can be used as is or one can retreive a specfic item from it: `@{parent.variables.0}` will try to return the first item of the parent's `variables` property.
|
||||
|
||||
----
|
||||
### Basics
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ If the retreived property is an object (`[] / {}`), it can be used as is or one
|
|||
|
||||
## Panel
|
||||
|
||||
Panels can contains tabs or widgets. These can be absolutely positioned and can overflow their parent's size (which will then display scrollbars).
|
||||
Panels can contains tabs or widgets. These can be absolutely positioned and can overflow their parent's size (which will then display scrollbars). When a panel contains tabs, it can send and receive its active tab's index through osc.
|
||||
|
||||
|
||||
```js
|
||||
|
|
@ -38,16 +38,6 @@ Panels can contains tabs or widgets. These can be absolutely positioned and can
|
|||
- usage: each element of the `array` must be a tab `object`. A panel cannot contain widgets and tabs simultaneously.
|
||||
|
||||
|
||||
#### `layout`
|
||||
- type: `string`
|
||||
- default: `''`
|
||||
- usage: `layout` must be a valid [Visual Format Language](https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/VisualFormatLanguage.html) expression. It accepts the [Extended Visual Format Language](https://github.com/IjzerenHein/autolayout.js#extended-visual-format-language-evfl) as well. Widgets are targeted using their `id` or their index prefixed with a `$` (`$0, $1, etc`), the latter method being incompatible with the [range spread operator](https://github.com/IjzerenHein/autolayout.js#view-ranges-spread-operator). Expressions can be tested and debugged with the online [Visual Format Editor](https://rawgit.com/IjzerenHein/visualformat-editor/master/dist/index.html).
|
||||
|
||||
#### `spacing`
|
||||
- type: `integer|array`
|
||||
- default: `0`
|
||||
- usage: spacing size used in `layout` expression, can be set as a `[vertical,horizontal]` array.
|
||||
|
||||
#### `variables`
|
||||
- type: `*`
|
||||
- default: `{}`
|
||||
|
|
@ -59,6 +49,18 @@ Panels can contains tabs or widgets. These can be absolutely positioned and can
|
|||
- `@{parent.variables}` useful when nesting containers
|
||||
|
||||
|
||||
#### `layout`
|
||||
- type: `string`
|
||||
- default: `''`
|
||||
- usage: `layout` must be a valid [Visual Format Language](https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/VisualFormatLanguage.html) expression. It accepts the [Extended Visual Format Language](https://github.com/IjzerenHein/autolayout.js#extended-visual-format-language-evfl) as well. Widgets are targeted using their `id` or their index prefixed with a `$` (`$0, $1, etc`), the latter method being incompatible with the [range spread operator](https://github.com/IjzerenHein/autolayout.js#view-ranges-spread-operator). Expressions can be tested and debugged with the online [Visual Format Editor](https://rawgit.com/IjzerenHein/visualformat-editor/master/dist/index.html).
|
||||
- note: this only applies when the panel contains widgets, not tabs
|
||||
|
||||
#### `spacing`
|
||||
- type: `integer|array`
|
||||
- default: `0`
|
||||
- usage: spacing size used in `layout` expression, can be set as a `[vertical,horizontal]` array.
|
||||
- note: this only applies when the panel contains widgets, not tabs
|
||||
|
||||
----
|
||||
|
||||
## Strip
|
||||
|
|
@ -92,7 +94,7 @@ Unidirectionnal panel with stretching capability.
|
|||
|
||||
## Modal
|
||||
|
||||
Modals are buttons that turn into a centered popup panels when enabled. They can be enabled via osc (1 to enable, 0 to disable).
|
||||
Modals are buttons that turn into a centered popup panels when enabled. They can only contain widgets. They can send and receive their state via osc (1 to enable, 0 to disable).
|
||||
|
||||
```js
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue