@ea-lab/reactive-json-docs 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/package.json +5 -2
  2. package/public/rjbuild/docs/advanced-concepts/index.md +1 -0
  3. package/public/rjbuild/docs/advanced-concepts/index.yaml +1 -0
  4. package/public/rjbuild/docs/advanced-concepts/plugins/component-development.md +1 -1
  5. package/public/rjbuild/docs/advanced-concepts/plugins/component-development.yaml +1 -1
  6. package/public/rjbuild/docs/core/action/Attribute/SetAttributeValue.md +93 -0
  7. package/public/rjbuild/docs/core/action/Attribute/SetAttributeValue.yaml +141 -0
  8. package/public/rjbuild/docs/core/action/Attribute/ToggleAttributeValue.md +267 -0
  9. package/public/rjbuild/docs/core/action/Attribute/ToggleAttributeValue.yaml +244 -0
  10. package/public/rjbuild/docs/core/action/Attribute/UnsetAttribute.md +108 -0
  11. package/public/rjbuild/docs/core/action/Attribute/UnsetAttribute.yaml +135 -0
  12. package/public/rjbuild/docs/core/action/Attribute/UnsetAttributeValue.md +135 -0
  13. package/public/rjbuild/docs/core/action/Attribute/UnsetAttributeValue.yaml +185 -0
  14. package/public/rjbuild/docs/core/action/Hide.md +1 -1
  15. package/public/rjbuild/docs/core/action/Hide.yaml +10 -10
  16. package/public/rjbuild/docs/core/action/ReactOnEvent.md +12 -12
  17. package/public/rjbuild/docs/core/action/ReactOnEvent.yaml +61 -101
  18. package/public/rjbuild/docs/core/action/Redirect.md +10 -2
  19. package/public/rjbuild/docs/core/action/Redirect.yaml +18 -51
  20. package/public/rjbuild/docs/core/action/VisuallyHide.yaml +10 -12
  21. package/public/rjbuild/docs/core/action/index.md +24 -203
  22. package/public/rjbuild/docs/core/action/index.yaml +24 -263
  23. package/public/rjbuild/docs/core/element/form/DateField.md +1 -1
  24. package/public/rjbuild/docs/core/element/form/DateField.yaml +4 -4
  25. package/public/rjbuild/docs/core/element/form/SelectField.yaml +2 -2
  26. package/public/rjbuild/docs/core/example/website.yaml +10 -10
  27. package/public/rjbuild/docs/core/reaction/index.md +17 -229
  28. package/public/rjbuild/docs/core/reaction/index.yaml +14 -242
  29. package/public/rjbuild/docs/core/reaction/setData.md +1 -1
  30. package/public/rjbuild/docs/core/reaction/setData.yaml +1 -1
  31. package/public/rjbuild/docs/docs-components/index.md +0 -2
  32. package/public/rjbuild/docs/docs-components/index.yaml +0 -2
  33. package/public/rjbuild/docs/getting-started/actions.md +294 -0
  34. package/public/rjbuild/docs/getting-started/actions.yaml +403 -0
  35. package/public/rjbuild/docs/getting-started/index.md +30 -6
  36. package/public/rjbuild/docs/getting-started/index.yaml +20 -6
  37. package/public/rjbuild/docs/getting-started/reactions.md +301 -0
  38. package/public/rjbuild/docs/getting-started/reactions.yaml +300 -0
  39. package/public/rjbuild/docs/getting-started/rjbuild-structure.md +10 -4
  40. package/public/rjbuild/docs/getting-started/rjbuild-structure.yaml +10 -4
  41. package/public/rjbuild/docs/getting-started/{template.md → template-contexts-data-binding.md} +16 -12
  42. package/public/rjbuild/docs/getting-started/{template.yaml → template-contexts-data-binding.yaml} +28 -14
  43. /package/public/rjbuild/docs/{core/reaction → advanced-concepts}/forward-update.md +0 -0
  44. /package/public/rjbuild/docs/{core/reaction → advanced-concepts}/forward-update.yaml +0 -0
@@ -0,0 +1,185 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # UnsetAttributeValue
5
+
6
+ Removes a specific value from an HTML attribute while preserving other values.
7
+
8
+ ## Basic Syntax
9
+
10
+ - type: TabbedSerializer
11
+ yamlSerializedContent: |
12
+ actions:
13
+ # Remove CSS class
14
+ - what: unsetAttributeValue
15
+ name: "class"
16
+ value: "highlighted"
17
+
18
+ # Remove with template
19
+ - what: unsetAttributeValue
20
+ name: "data-tags"
21
+ value: ~.tagToRemove
22
+
23
+ - type: Markdown
24
+ content: |
25
+ ## Properties
26
+
27
+ - type: DefinitionList
28
+ content:
29
+ - term:
30
+ code: name
31
+ after: "(string, required)"
32
+ details: The name of the attribute to modify.
33
+ - term:
34
+ code: separator
35
+ after: "(string, optional)"
36
+ details:
37
+ type: Markdown
38
+ content: |
39
+ The separator used between values. Default: `" "` (space).
40
+ - term:
41
+ code: unsetAllOccurrences
42
+ after: "(boolean, optional)"
43
+ details:
44
+ type: Markdown
45
+ content: |
46
+ When `true` (default), removes all occurrences of the value from the attribute. When `false`, removes the number of elements defined by `unsetCount`.
47
+ - term:
48
+ code: unsetCount
49
+ after: "(number, optional)"
50
+ details:
51
+ type: Markdown
52
+ content: |
53
+ Specifies the number of objects to remove. Supports template evaluation and is cast to integer. When `0`, removes nothing. When `1` or more, removes the specified number of elements starting from the beginning of the string. When `-1` or less, removes the specified number of elements starting from the end of the string. When undefined or invalid, defaults to removing all occurrences (equivalent to `unsetAllOccurrences: true`).
54
+ - term:
55
+ code: value
56
+ after: "(string, required)"
57
+ details:
58
+ type: Markdown
59
+ content: |
60
+ The value to remove from the attribute. Supports template evaluation (e.g., `~.dynamicValue`, `~~.globalValue`). Automatically converted to string if not already.
61
+
62
+ - type: Markdown
63
+ content: |
64
+ ## Behavior
65
+
66
+ - **Selective removal**: Removes only the specified value from the attribute.
67
+ - **Occurrence control**: Removes all occurrences by default, or only the first when configured.
68
+ - **Count control**: When `unsetCount` is specified, controls the exact number of elements to remove and the direction (from beginning or end).
69
+ - **Preservation**: Other values in the attribute remain intact.
70
+
71
+ ## Logic Reference
72
+
73
+ ### Behavior Matrix
74
+
75
+ | `unsetAllOccurrences` | `unsetCount` | Behavior | Notes |
76
+ |:---------------------:|:------------:|:---------|:------|
77
+ | `true` | *ignored* | **Removes ALL occurrences** | `unsetCount` is completely ignored |
78
+ | `false` | `1` | Removes **1 occurrence** from beginning | Default behavior when `unsetCount` is valid |
79
+ | `false` | `2` | Removes **2 occurrences** from beginning | |
80
+ | `false` | `-1` | Removes **1 occurrence** from end | |
81
+ | `false` | `-2` | Removes **2 occurrences** from end | |
82
+ | `false` | `0` | **Removes nothing** | |
83
+ | `false` | `undefined` | **Removes ALL occurrences** | Fallback to "all" behavior |
84
+ | `false` | `null` | **Removes ALL occurrences** | Fallback to "all" behavior |
85
+ | `false` | `"invalid"` | **Removes ALL occurrences** | Fallback to "all" behavior |
86
+ | `undefined` | `1` | Removes **1 occurrence** from beginning | `unsetAllOccurrences` defaults to `true`, but valid `unsetCount` applies |
87
+ | `undefined` | `-1` | Removes **1 occurrence** from end | |
88
+ | `undefined` | `0` | **Removes nothing** | |
89
+ | `undefined` | `undefined` | **Removes ALL occurrences** | Complete default behavior |
90
+
91
+ ### Logic Summary
92
+
93
+ 1. **If `unsetAllOccurrences: true`** → removes ALL, ignores `unsetCount`
94
+ 2. **If `unsetAllOccurrences: false` AND `unsetCount` valid** → uses `unsetCount`
95
+ 3. **If `unsetCount` invalid/undefined** → fallback to "remove ALL" even if `unsetAllOccurrences: false`
96
+ 4. **If nothing is defined** → default behavior = "remove ALL"
97
+
98
+ This logic ensures there is always a defined behavior, with an intelligent fallback to "remove all" when parameters are invalid.
99
+
100
+ ## Common Use Cases
101
+
102
+ - **CSS class removal**: Removing specific CSS classes while keeping others.
103
+ - **Data attribute cleanup**: Removing specific values from space-separated data attributes.
104
+ - **Conditional styling**: Removing styling classes based on state changes.
105
+
106
+ - type: RjBuildDescriber
107
+ title: "UnsetAttributeValue Action Examples"
108
+ description:
109
+ - type: Markdown
110
+ content: |
111
+ This example demonstrates how to selectively remove specific CSS classes using the `UnsetAttributeValue` action.
112
+
113
+ **Expected behavior:**
114
+ - Initially, the input field has both 'readonly' and 'highlighted' classes (readonly + visual styling)
115
+ - Click "Remove 'highlighted' class" to remove only the 'highlighted' class (removing visual styling but keeping readonly)
116
+ - Click "Reset" to restore the original classes
117
+ - Notice how only the specified value is removed while other classes remain intact
118
+
119
+ Try interacting with the buttons to see how specific classes are selectively removed.
120
+
121
+ toDescribe:
122
+ renderView:
123
+ - type: button
124
+ content: "Remove 'highlighted' class"
125
+ actions:
126
+ - what: setData
127
+ on: click
128
+ path: ~.removeHighlight
129
+ value: true
130
+ stopPropagation: true
131
+
132
+ - type: button
133
+ content: "Reset"
134
+ actions:
135
+ - what: setData
136
+ on: click
137
+ path: ~.removeHighlight
138
+ value: false
139
+ stopPropagation: true
140
+
141
+ - type: input
142
+ attributes:
143
+ type: "text"
144
+ value: "This input has multiple classes..."
145
+ class: "uav-readonly uav-highlighted"
146
+ readonly: "readonly"
147
+ style:
148
+ padding: "10px"
149
+ border: "2px solid #007bff"
150
+ borderRadius: "4px"
151
+ fontSize: "16px"
152
+ margin: "10px 0"
153
+ width: "300px"
154
+ display: "block"
155
+ actions:
156
+ - what: unsetAttributeValue
157
+ name: "class"
158
+ value: "uav-highlighted"
159
+ when: ~.removeHighlight
160
+ is: true
161
+
162
+ - type: style
163
+ content: |
164
+ .uav-readonly {
165
+ cursor: not-allowed !important;
166
+ opacity: 0.7 !important;
167
+ }
168
+ .uav-highlighted {
169
+ border-color: #ffc107 !important;
170
+ outline: 2px solid #ffc107 !important;
171
+ outline-offset: 2px !important;
172
+ }
173
+
174
+ data:
175
+ removeHighlight: false
176
+
177
+ - type: Markdown
178
+ content: |
179
+ ## Notes
180
+
181
+ - Only removes exact matches of the specified value.
182
+ - Maintains the integrity of other attribute values.
183
+ - Works with any space-separated attribute values.
184
+ - Safe to use even if the value doesn't exist in the attribute.
185
+ - The value property supports full template evaluation including `~.localData`, `~~.globalData`, `~>nearestKey`, and `~~>globalKey` patterns.
@@ -19,4 +19,4 @@ renderView:
19
19
  ```
20
20
 
21
21
  ## Limitation
22
- - The element no longer exists in the DOM, so no events can be attached to it.
22
+ - When hidden, the element no longer exists in the DOM, so no events can be attached to it.
@@ -30,31 +30,31 @@ renderView:
30
30
  actions:
31
31
  - what: setData
32
32
  on: click
33
- path: "shouldHide"
34
- value: ~.shouldHide
35
- is: false
33
+ path: ~.shouldHide
34
+ value: "true"
35
+ when: ~.shouldHide
36
+ is: "false"
36
37
  - what: setData
37
38
  on: click
38
- path: "shouldHide"
39
- value: ~.shouldHide
40
- is: true
39
+ path: ~.shouldHide
40
+ value: "false"
41
41
  when: ~.shouldHide
42
- is: false
42
+ is: "true"
43
43
 
44
44
  - type: div
45
45
  content: "This text will be hidden when shouldHide is true."
46
46
  actions:
47
47
  - what: hide
48
48
  when: ~.shouldHide
49
- is: true
49
+ is: "true"
50
50
 
51
51
  - type: div
52
52
  content: ["Current state: shouldHide = ", ~.shouldHide]
53
53
 
54
54
  data:
55
- shouldHide: false
55
+ shouldHide: "false"
56
56
 
57
57
  - type: Markdown
58
58
  content: |
59
59
  ## Limitation
60
- - The element no longer exists in the DOM, so no events can be attached to it.
60
+ - When hidden, the element no longer exists in the DOM, so no events can be attached to it.
@@ -1,8 +1,8 @@
1
1
  # ReactOnEvent
2
2
 
3
- **Type**: Internal Action Component
3
+ ReactOnEvent is an internal action component that is automatically instantiated by the Actions system when reactions with event handlers (`on: "eventName"`) are detected. It should **not** be used directly as an element type.
4
4
 
5
- **Description**: ReactOnEvent is an internal action component that is automatically instantiated by the Actions system when reactions with event handlers (`on: "eventName"`) are detected. It should **not** be used directly as an element type.
5
+ > **Important**: It should **not** be used directly as an element type. The Reactive-JSON engine will automatically instantiate it when needed.
6
6
 
7
7
  ## How it Works
8
8
 
@@ -43,8 +43,8 @@ ReactOnEvent supports any DOM event by prefixing with `on` and capitalizing the
43
43
 
44
44
  Some events have special handling and **do not** use ReactOnEvent:
45
45
 
46
- - `on: "message"` → Uses MessageListener component (listens on window)
47
- - `on: "hashchange"` → Uses HashChangeListener component (listens on window)
46
+ - `on: "message"` → Uses the [MessageListener](MessageListener.md) component (listens on window)
47
+ - `on: "hashchange"` → Uses the [HashChangeListener](HashChangeListener.md) component (listens on window)
48
48
 
49
49
  ## Event Propagation Control
50
50
 
@@ -67,15 +67,15 @@ actions:
67
67
  - **Context preservation**: Maintains access to global and template data contexts
68
68
  - **Early termination**: Supports `stopPropagation: true` to halt reaction chain execution
69
69
 
70
+ ## Important Notes
71
+
72
+ - **Never use `type: ReactOnEvent`** in your renderView - it's an internal component
73
+ - **Use `actions` with `on: "eventName"`** - this is the correct way to handle events
74
+ - **ReactOnEvent is automatically instantiated** by the Actions system when needed
75
+ - **Event propagation is stopped by default** - use `stopPropagation: false` to change this
76
+
70
77
  ## Related Components
71
78
 
72
79
  - **[MessageListener](MessageListener.md)**: Handles `on: "message"` events
73
80
  - **[HashChangeListener](HashChangeListener.md)**: Handles `on: "hashchange"` events
74
- - **[Reactions System](../reaction/index.md)**: The actual reaction functions that ReactOnEvent executes
75
-
76
- ## Important Notes
77
-
78
- - **Not for direct use**: Never use `type: ReactOnEvent` in your renderView
79
- - **Automatic instantiation**: The Actions system creates this component automatically
80
- - **Internal implementation**: This is part of the framework's internal architecture
81
- - **Event binding**: Events are bound to the actual DOM elements, not wrapper components
81
+ - **[Reactions System](../../getting-started/reactions.md)**: The actual reaction functions that ReactOnEvent executes
@@ -3,9 +3,9 @@ renderView:
3
3
  content: |
4
4
  # ReactOnEvent
5
5
 
6
- **Type**: Internal Action Component
7
-
8
- **Description**: ReactOnEvent is an internal action component that is automatically instantiated by the Actions system when reactions with event handlers (`on: "eventName"`) are detected. It should **not** be used directly as an element type.
6
+ ReactOnEvent is an internal action component that is automatically instantiated by the Actions system when reactions with event handlers (`on: "eventName"`) are detected.
7
+
8
+ > **Important**: It should **not** be used directly as an element type. The Reactive-JSON engine will automatically instantiate it when needed.
9
9
 
10
10
  ## How it Works
11
11
 
@@ -16,105 +16,66 @@ renderView:
16
16
  3. Creates a ReactOnEvent component that attaches the appropriate event listeners
17
17
  4. Wraps the target element with these event handlers
18
18
 
19
- - type: RjBuildDescriber
20
- title: "Correct Usage: Reactions with Events"
21
- description:
22
- - type: Markdown
23
- content: |
24
- This example shows the **correct** way to use event handling in Reactive-JSON.
25
-
26
- ReactOnEvent is automatically created by the system when you use `on: "eventName"` in actions.
19
+ ## Usage Pattern
27
20
 
28
- toDescribe:
29
- renderView:
30
- - type: div
31
- content:
32
- - type: button
33
- content: "Click me"
34
- actions:
35
- - what: setData
36
- on: click # ReactOnEvent handles this automatically
37
- path: "clicked"
38
- value: true
39
- - what: setData
40
- on: click
41
- path: "clickCount"
42
- value: 1
43
- when: ~.clickCount
44
- isEmpty: true
45
- - what: setData
46
- on: click
47
- path: "clickCount"
48
- value: "~.clickCount + 1"
49
- when: ~.clickCount
50
- isEmpty: "not"
51
-
52
- - type: input
53
- props:
54
- type: "text"
55
- placeholder: "Type something..."
56
- actions:
57
- - what: setData
58
- on: change # ReactOnEvent handles this automatically
59
- path: "inputValue"
60
- value: "~event.target.value"
61
-
62
- - type: div
63
- content: "Mouse over this area"
64
- props:
65
- style:
66
- padding: "10px"
67
- border: "1px solid #ccc"
68
- backgroundColor: "~.hovered ? '#f0f0f0' : 'white'"
69
- actions:
70
- - what: setData
71
- on: mouseover # ReactOnEvent handles this automatically
72
- path: "hovered"
73
- value: true
74
- - what: setData
75
- on: mouseleave # ReactOnEvent handles this automatically
76
- path: "hovered"
77
- value: false
78
-
79
- - type: div
80
- content:
81
- - type: div
82
- content: ["Button clicked: ", ~.clicked]
83
-
84
- - type: div
85
- content: ["Click count: ", ~.clickCount]
86
-
87
- - type: div
88
- content: ["Input value: '", ~.inputValue, "'"]
89
-
90
- - type: div
91
- content: ["Mouse hover state: ", ~.hovered]
21
+ Instead of using ReactOnEvent directly, you define reactions in the `actions` array of any element:
92
22
 
23
+ ```yaml
24
+ renderView:
93
25
  - type: button
94
- content: "Reset all"
26
+ content: "Click me"
95
27
  actions:
96
28
  - what: setData
97
- on: click
98
- path: "clicked"
99
- value: false
100
- - what: setData
101
- on: click
102
- path: "clickCount"
103
- value: 0
104
- - what: setData
105
- on: click
106
- path: "inputValue"
107
- value: ""
108
- - what: setData
109
- on: click
110
- path: "hovered"
111
- value: false
29
+ on: click # This triggers ReactOnEvent internally
30
+ path: "buttonClicked"
31
+ value: true
32
+ ```
33
+
34
+ ## Supported Event Types
35
+
36
+ ReactOnEvent supports any DOM event by prefixing with `on` and capitalizing the first letter:
37
+
38
+ - `on: click` → `onClick`
39
+ - `on: change` → `onChange`
40
+ - `on: mouseover` → `onMouseOver`
41
+ - `on: keydown` → `onKeyDown`
42
+ - `on: submit` → `onSubmit`
43
+ - etc.
44
+
45
+ ## Special Event Handling
46
+
47
+ Some events have special handling and **do not** use ReactOnEvent:
48
+
49
+ - `on: "message"` → Uses the [MessageListener](MessageListener.md) component (listens on window)
50
+ - `on: "hashchange"` → Uses the [HashChangeListener](HashChangeListener.md) component (listens on window)
51
+
52
+ ## Event Propagation Control
53
+
54
+ By default, ReactOnEvent stops event propagation. You can control this behavior:
55
+
56
+ ```yaml
57
+ actions:
58
+ - what: setData
59
+ on: click
60
+ path: "clicked"
61
+ value: true
62
+ stopPropagation: false # Allow event to continue propagating
63
+ ```
64
+
65
+ ## Event Placeholders
66
+
67
+ ReactOnEvent supports special placeholders to access event data:
68
+
69
+ - `<reactive-json:event-new-value>`: Returns the most relevant value from form events (checked for checkboxes, value for inputs)
70
+ - `<reactive-json:event>.propertyPath`: Access any event property (e.g., `.data.message` for MessageEvent, `.key` for KeyboardEvent)
71
+
72
+ ## Technical Implementation
112
73
 
113
- data:
114
- clicked: false
115
- clickCount: 0
116
- inputValue: ""
117
- hovered: false
74
+ - **Event attachment**: Uses React's event system via `cloneElement`
75
+ - **Multiple events**: Can handle multiple event types on the same element
76
+ - **Reaction execution**: Executes reactions in the order they appear
77
+ - **Context preservation**: Maintains access to global and template data contexts
78
+ - **Early termination**: Supports `stopPropagation: true` to halt reaction chain execution
118
79
 
119
80
  - type: Markdown
120
81
  content: |
@@ -125,9 +86,8 @@ renderView:
125
86
  - **ReactOnEvent is automatically instantiated** by the Actions system when needed
126
87
  - **Event propagation is stopped by default** - use `stopPropagation: false` to change this
127
88
 
128
- ## Related Documentation
89
+ ## Related Components
129
90
 
130
- - **[Actions System](index.md)**: Learn about the actions system that uses ReactOnEvent
131
- - **[Reactions](../reaction/index.md)**: The reaction functions that ReactOnEvent executes
132
- - **[MessageListener](MessageListener.md)**: For `on: "message"` events
133
- - **[HashChangeListener](HashChangeListener.md)**: For `on: "hashchange"` events
91
+ - **[MessageListener](MessageListener.md)**: Handles `on: "message"` events
92
+ - **[HashChangeListener](HashChangeListener.md)**: Handles `on: "hashchange"` events
93
+ - **[Reactions System](../../getting-started/reactions.md)**: The actual reaction functions that ReactOnEvent executes
@@ -6,14 +6,22 @@
6
6
  - `to`: destination URL
7
7
 
8
8
  ## Example
9
+
10
+ The following example will redirect the current page when the user clicks on the button.
11
+
9
12
  ```yaml
10
13
  renderView:
11
14
  - type: button
12
- content: "Go to Google"
15
+ content: "Go to EA Lab"
13
16
  actions:
14
17
  - what: redirect
15
- to: "https://www.google.com"
18
+ to: "https://ea-lab.io"
19
+ when: ~~.allowRedirect
20
+ is: "true"
21
+ - what: setData
16
22
  on: click
23
+ path: ~~.allowRedirect
24
+ value: "true"
17
25
  ```
18
26
 
19
27
  ## Limitation
@@ -8,59 +8,26 @@ renderView:
8
8
  ## Properties
9
9
  - `to`: destination URL
10
10
 
11
- - type: RjBuildDescriber
12
- title: "Redirect Action Example"
13
- description:
14
- - type: Markdown
15
- content: |
16
- This example demonstrates the `redirect` action. **Warning**: clicking the button below will actually redirect you!
17
-
18
- For demonstration purposes, this redirects to a safe page (the current page), but in real usage you would specify any URL.
19
-
20
- toDescribe:
21
- renderView:
22
- - type: div
23
- content:
24
- - type: button
25
- content: "Redirect to Current Page (Safe Demo)"
26
- actions:
27
- - what: redirect
28
- on: click
29
- to: "."
30
-
31
- - type: div
32
- content: "↑ Click the button above to see the redirect in action"
33
-
34
- - type: button
35
- content: "Conditional Redirect (Google)"
36
- actions:
37
- - what: redirect
38
- on: click
39
- to: "https://www.google.com"
40
- when: ~.allowRedirect
41
- is: true
42
-
43
- - type: button
44
- content: "Toggle Redirect Permission"
45
- actions:
46
- - what: setData
47
- on: click
48
- path: "allowRedirect"
49
- value: ~.allowRedirect
50
- is: false
51
- - what: setData
52
- on: click
53
- path: "allowRedirect"
54
- value: ~.allowRedirect
55
- is: true
56
- when: ~.allowRedirect
57
- is: false
11
+ - type: Markdown
12
+ content: |
13
+ ## Example
58
14
 
59
- - type: div
60
- content: ["Redirect allowed: ", ~.allowRedirect]
15
+ The following example will redirect the current page when the user clicks on the button.
61
16
 
62
- data:
63
- allowRedirect: false
17
+ ```yaml
18
+ renderView:
19
+ - type: button
20
+ content: "Go to EA Lab"
21
+ actions:
22
+ - what: redirect
23
+ to: "https://ea-lab.io"
24
+ when: ~~.allowRedirect
25
+ is: "true"
26
+ - what: setData
27
+ on: click
28
+ path: ~~.allowRedirect
29
+ value: "true"
30
+ ```
64
31
 
65
32
  - type: Markdown
66
33
  content: |
@@ -29,32 +29,30 @@ renderView:
29
29
  actions:
30
30
  - what: setData
31
31
  on: click
32
- path: "shouldVisuallyHide"
33
- value: ~.shouldVisuallyHide
34
- is: false
32
+ path: ~.shouldVisuallyHide
33
+ value: "false"
34
+ when: ~.shouldVisuallyHide
35
+ is: "true"
36
+ stopPropagation: true
35
37
  - what: setData
36
38
  on: click
37
- path: "shouldVisuallyHide"
38
- value: ~.shouldVisuallyHide
39
- is: true
39
+ path: ~.shouldVisuallyHide
40
+ value: "true"
40
41
  when: ~.shouldVisuallyHide
41
- is: false
42
+ is: "false"
42
43
 
43
44
  - type: div
44
45
  content: "This text will be visually hidden but remains in the DOM."
45
46
  actions:
46
47
  - what: visuallyHide
47
48
  when: ~.shouldVisuallyHide
48
- is: true
49
+ is: "true"
49
50
 
50
51
  - type: div
51
52
  content: ["Current state: shouldVisuallyHide = ", ~.shouldVisuallyHide]
52
53
 
53
- - type: div
54
- content: "↑ Notice the space is preserved even when hidden"
55
-
56
54
  data:
57
- shouldVisuallyHide: false
55
+ shouldVisuallyHide: "false"
58
56
 
59
57
  - type: Markdown
60
58
  content: |