@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,244 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # ToggleAttributeValue
5
+
6
+ Toggles the presence of a specific value in an HTML attribute. Supports both simple on-off toggles and cyclic toggling through multiple values.
7
+
8
+ ## Important Notes
9
+
10
+ ### Action-Based Behavior
11
+ `ToggleAttributeValue` is an **action component** that operates based on data state changes, not direct event triggers. It requires a state variable in your data to activate the toggle behavior. This means you cannot directly use `on: click` with `ToggleAttributeValue` - instead, you must use `setData` with `on: click` to change a state variable, then use `when/is` conditions on the toggle action to respond to that state change.
12
+
13
+ ### Base Attribute Detection
14
+ `ToggleAttributeValue` determines what to toggle by examining the **original attributes** defined in your component's props, not the current DOM state. This means:
15
+
16
+ - ✅ **Stable behavior**: The toggle always works relative to the initial attribute values
17
+ - ✅ **No infinite loops**: Changes don't trigger recursive re-evaluation
18
+ - ⚠️ **Limitation**: The toggle cannot detect or work with values that were dynamically added by other attribute actions (`SetAttributeValue`, `UnsetAttributeValue`)
19
+
20
+ **Example**: If your component initially has `class="base"` and another action adds `"dynamic"`, the toggle will only work with `"base"` and won't see `"dynamic"`.
21
+
22
+ ## Basic Syntax
23
+
24
+ - type: TabbedSerializer
25
+ yamlSerializedContent: |
26
+ actions:
27
+ # Toggle CSS class.
28
+ - what: toggleAttributeValue
29
+ name: "class"
30
+ value: "active"
31
+
32
+ # Cyclic toggle with array.
33
+ - what: toggleAttributeValue
34
+ name: "class"
35
+ value: ["theme-light", "theme-dark", "theme-auto", ""]
36
+
37
+ # Keep attribute when empty.
38
+ - what: toggleAttributeValue
39
+ name: "data-optional"
40
+ value: "enabled"
41
+ keepAttributeWhenEmpty: true
42
+
43
+ # Conditional toggle.
44
+ - what: toggleAttributeValue
45
+ name: "data-features"
46
+ value: ~.featureName
47
+ when: ~.shouldToggle
48
+ is: true
49
+
50
+ - type: Markdown
51
+ content: |
52
+ ## Properties
53
+
54
+ - type: DefinitionList
55
+ content:
56
+ - term:
57
+ code: keepAttributeWhenEmpty
58
+ after: "(boolean, optional)"
59
+ details:
60
+ type: Markdown
61
+ content: |
62
+ Whether to keep the attribute when it becomes empty. If `false`, the attribute is removed when no values remain. Default: `false`.
63
+ - term:
64
+ code: name
65
+ after: "(string, required)"
66
+ details: The name of the attribute to modify.
67
+ - term:
68
+ code: separator
69
+ after: "(string, optional)"
70
+ details:
71
+ type: Markdown
72
+ content: |
73
+ The separator used between values. Default: `" "` (space).
74
+ - term:
75
+ code: value
76
+ after: "(string|array, required)"
77
+ details:
78
+ type: Markdown
79
+ content: |
80
+ The value(s) to toggle in the attribute. Can be a single string or an array of strings for cyclic toggling. Supports template evaluation (e.g., `~.dynamicValue`, `~~.globalValue`). Automatically converted to string if not already.
81
+
82
+ - type: Markdown
83
+ content: |
84
+
85
+ ## Behavior
86
+
87
+ ### Simple Toggle (string value)
88
+ - **Smart toggle**: Automatically adds the value if missing, removes it if present.
89
+ - **Preservation**: Other values in the attribute remain intact.
90
+ - **Empty handling**: By default, removes the entire attribute if no values remain. Set `keepAttributeWhenEmpty` to `true` to preserve empty attributes.
91
+
92
+ #### Common Examples
93
+
94
+ - type: TabbedSerializer
95
+ yamlSerializedContent: |
96
+ # Toggle CSS class.
97
+ - what: toggleAttributeValue
98
+ name: "class"
99
+ value: "active"
100
+
101
+ # Toggle readonly attribute.
102
+ - what: toggleAttributeValue
103
+ name: "readonly"
104
+ value: "readonly"
105
+
106
+ # Toggle checked attribute.
107
+ - what: toggleAttributeValue
108
+ name: "checked"
109
+ value: "checked"
110
+
111
+ - type: Markdown
112
+ content: |
113
+
114
+ ### Cyclic Toggle (array value)
115
+ - **Cyclic behavior**: When `value` is an array, the action cycles through the values in order.
116
+ - **Sequential rotation**: Each toggle moves to the next value in the array.
117
+ - **Empty values handling**: Empty strings (`""`) in the array represent the absence of the value.
118
+ - **Clean detection**: Values are split by separator and empty values (from double separators) are filtered out during detection.
119
+ - **First match priority**: If multiple array values are already present, only the first detected value is replaced.
120
+ - **Default fallback**: If no array values are present, the first array value is applied.
121
+ - **Empty value filtering**: Attributes with empty values from double separators (e.g., `"val1,,val2,"`) are cleaned during detection, treating them as `"val1 val2"`.
122
+ - **Single value arrays**: Arrays with one value behave identically to string values (toggle between value and empty).
123
+ - **Empty string inclusion**: Including `""` in arrays explicitly defines an "empty state" in the cycle.
124
+
125
+ #### Array Behavior Examples
126
+
127
+ ##### Four-step cycle with empty state
128
+ ```yaml
129
+ # Starting with class="theme-light"
130
+ # Clicks will progress: theme-light → theme-dark → theme-auto → "" → theme-light → ...
131
+ value: ["theme-light", "theme-dark", "theme-auto", ""]
132
+ ```
133
+
134
+ ##### Simple alternation
135
+ ```yaml
136
+ # Starting with class="size-small"
137
+ # Clicks will alternate: size-small → size-large → size-small → ...
138
+ value: ["size-small", "size-large"]
139
+ ```
140
+
141
+ ##### Single value array (equivalent to string)
142
+ ```yaml
143
+ # Equivalent to value: "highlight"
144
+ # Toggles: highlight → "" → highlight → ...
145
+ value: ["highlight"]
146
+ ```
147
+
148
+ ## Common Use Cases
149
+
150
+ - **CSS class toggling**: Adding/removing CSS classes based on state changes.
151
+ - **Data attribute management**: Toggling specific values in space-separated data attributes.
152
+ - **Interactive styling**: Toggle styling classes for user interactions.
153
+ - **Feature flags**: Toggle feature-related classes or data attributes.
154
+ - **State cycling**: Cycle through multiple states (e.g., theme variants, size options).
155
+ - **Multi-step processes**: Progress through sequential steps with visual indicators.
156
+
157
+ - type: RjBuildDescriber
158
+ title: "ToggleAttributeValue Action Examples"
159
+ description:
160
+ - type: Markdown
161
+ content: |
162
+ This example demonstrates how to toggle the readonly attribute using the `ToggleAttributeValue` action.
163
+
164
+ **Expected behavior:**
165
+ - Initially, the input field is editable (normal appearance)
166
+ - Click "Toggle readonly" to make the input readonly (you cannot type in it + visual changes)
167
+ - Click "Toggle readonly" again to make it editable again
168
+ - Click "Reset" to return to the initial state (editable)
169
+ - The toggle action automatically adds/removes the 'readonly' value from the class attribute
170
+
171
+ Try interacting with the buttons to see how the readonly state toggles.
172
+
173
+ toDescribe:
174
+ renderView:
175
+ - type: button
176
+ content: "Toggle readonly"
177
+ actions:
178
+ - what: setData
179
+ on: click
180
+ path: ~.shouldToggle
181
+ value: "yes"
182
+ when: ~.shouldToggle
183
+ is: "no"
184
+ stopPropagation: true
185
+ - what: setData
186
+ on: click
187
+ path: ~.shouldToggle
188
+ value: "no"
189
+ when: ~.shouldToggle
190
+ is: "yes"
191
+ stopPropagation: true
192
+
193
+ - type: button
194
+ content: "Reset"
195
+ actions:
196
+ - what: setData
197
+ on: click
198
+ path: ~.shouldToggle
199
+ value: "no"
200
+ stopPropagation: true
201
+
202
+ - type: input
203
+ attributes:
204
+ type: "text"
205
+ placeholder: "Try typing here when readonly is removed..."
206
+ value: ~.input_value
207
+ class: "tav-demo-input"
208
+ style:
209
+ padding: "10px"
210
+ border: "2px solid #007bff"
211
+ borderRadius: "4px"
212
+ fontSize: "16px"
213
+ margin: "10px 0"
214
+ width: "300px"
215
+ display: "block"
216
+ actions:
217
+ - what: toggleAttributeValue
218
+ name: "class"
219
+ value: "tav-readonly"
220
+ when: ~.shouldToggle
221
+ is: "yes"
222
+ - what: setData
223
+ on: change
224
+ path: ~.input_value
225
+ value: <reactive-json:event-new-value>
226
+ - type: style
227
+ content: |
228
+ .tav-readonly {
229
+ cursor: not-allowed !important;
230
+ opacity: 0.7 !important;
231
+ border-color: #6c757d !important;
232
+ pointer-events: none !important;
233
+ }
234
+
235
+ data:
236
+ shouldToggle: "no"
237
+ input_value: ""
238
+ - type: Markdown
239
+ content: |
240
+ ## Notes
241
+
242
+ - The `value` property supports full template evaluation including `~.localData`, `~~.globalData`, `~>nearestKey`, and `~~>globalKey` patterns.
243
+ - More efficient than separate SetAttributeValue/UnsetAttributeValue actions for toggle scenarios.
244
+ - Works with any space-separated attribute values (class, data attributes, etc.).
@@ -0,0 +1,108 @@
1
+ # UnsetAttribute
2
+
3
+ Completely removes an HTML attribute from an element.
4
+
5
+ ## Basic Syntax
6
+
7
+ ```yaml
8
+ actions:
9
+ # Remove entire attribute
10
+ - what: unsetAttribute
11
+ name: "class"
12
+
13
+ # Conditional removal
14
+ - what: unsetAttribute
15
+ name: "style"
16
+ when: ~.useDefaultStyling
17
+ is: true
18
+ ```
19
+
20
+ ## Properties
21
+
22
+ - **name** *(string, required)*: The name of the attribute to remove completely.
23
+
24
+ ## Behavior
25
+
26
+ - **Complete removal**: Removes the entire attribute and all its values from the DOM element.
27
+ - **Attribute deletion**: The attribute is completely deleted, not just emptied.
28
+ - **Irreversible**: Once removed, the attribute must be explicitly set again to restore it.
29
+
30
+ ## Common Use Cases
31
+
32
+ - **Conditional attribute presence**: Removing attributes entirely based on conditions.
33
+ - **Accessibility cleanup**: Removing ARIA attributes when not needed.
34
+ - **Data attribute management**: Completely removing data-* attributes.
35
+ - **Style reset**: Removing inline style attributes to fall back to CSS.
36
+
37
+ ## Example
38
+
39
+ ```yaml
40
+ renderView:
41
+ - type: button
42
+ content: "Remove readonly attribute"
43
+ actions:
44
+ - what: setData
45
+ on: click
46
+ path: ~.makeEditable
47
+ value: true
48
+ stopPropagation: true
49
+
50
+ - type: button
51
+ content: "Reset"
52
+ actions:
53
+ - what: setData
54
+ on: click
55
+ path: ~.makeEditable
56
+ value: false
57
+ stopPropagation: true
58
+
59
+ - type: input
60
+ attributes:
61
+ type: "text"
62
+ value: ~.input_value
63
+ placeholder: "Try typing here when readonly is removed..."
64
+ class: "ua-demo-input"
65
+ readonly: "readonly"
66
+ style:
67
+ padding: "10px"
68
+ border: "2px solid #007bff"
69
+ borderRadius: "4px"
70
+ fontSize: "16px"
71
+ margin: "10px 0"
72
+ width: "300px"
73
+ display: "block"
74
+ actions:
75
+ - what: unsetAttribute
76
+ name: "readonly"
77
+ when: ~.makeEditable
78
+ is: true
79
+ - what: setData
80
+ on: change
81
+ path: ~.input_value
82
+ value: <reactive-json:event-new-value>
83
+
84
+ - type: style
85
+ content: |
86
+ .ua-demo-input[readonly] {
87
+ cursor: not-allowed !important;
88
+ opacity: 0.7 !important;
89
+ border-color: #6c757d !important;
90
+ }
91
+ .ua-demo-input:not([readonly]) {
92
+ border-color: #28a745 !important;
93
+ outline: 2px solid #28a745 !important;
94
+ outline-offset: 2px !important;
95
+ }
96
+
97
+ data:
98
+ makeEditable: false
99
+ input_value: ""
100
+ ```
101
+
102
+ ## Notes
103
+
104
+ - This action **completely removes the entire attribute**, not just specific values.
105
+ - Use `UnsetAttributeValue` if you only want to remove specific values.
106
+ - The attribute can be restored using `SetAttributeValue` if needed.
107
+ - **Important**: To set an empty attribute (not remove it), use `SetAttributeValue` with an empty string value.
108
+ - Useful for conditional attribute presence rather than conditional values.
@@ -0,0 +1,135 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # UnsetAttribute
5
+
6
+ Completely removes an HTML attribute from an element.
7
+
8
+ ## Basic Syntax
9
+
10
+ - type: TabbedSerializer
11
+ yamlSerializedContent: |
12
+ actions:
13
+ # Remove entire attribute
14
+ - what: unsetAttribute
15
+ name: "class"
16
+
17
+ # Conditional removal
18
+ - what: unsetAttribute
19
+ name: "style"
20
+ when: ~.useDefaultStyling
21
+ is: true
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 remove completely.
33
+
34
+ - type: Markdown
35
+ content: |
36
+
37
+ ## Behavior
38
+
39
+ - **Complete removal**: Removes the entire attribute and all its values from the DOM element.
40
+ - **Attribute deletion**: The attribute is completely deleted, not just emptied.
41
+ - **Irreversible**: Once removed, the attribute must be explicitly set again to restore it.
42
+
43
+ ## Common Use Cases
44
+
45
+ - **Conditional attribute presence**: Removing attributes entirely based on conditions.
46
+ - **Accessibility cleanup**: Removing ARIA attributes when not needed.
47
+ - **Data attribute management**: Completely removing data-* attributes.
48
+ - **Style reset**: Removing inline style attributes to fall back to CSS.
49
+
50
+ - type: RjBuildDescriber
51
+ title: "UnsetAttribute Action Examples"
52
+ description:
53
+ - type: Markdown
54
+ content: |
55
+ This example demonstrates how to completely remove HTML attributes using the `UnsetAttribute` action.
56
+
57
+ **Expected behavior:**
58
+ - Initially, the input field is read-only (you cannot type in it) and has visual styling
59
+ - Click "Remove readonly attribute" to remove the entire readonly attribute - the input becomes editable
60
+ - Click "Reset" to restore the readonly attribute - the input becomes read-only again
61
+ - The action completely removes the entire attribute, not just its value
62
+
63
+ Try interacting with the buttons to see how the readonly attribute is completely removed/restored.
64
+
65
+ toDescribe:
66
+ renderView:
67
+ - type: button
68
+ content: "Remove readonly attribute"
69
+ actions:
70
+ - what: setData
71
+ on: click
72
+ path: ~.makeEditable
73
+ value: true
74
+ stopPropagation: true
75
+
76
+ - type: button
77
+ content: "Reset"
78
+ actions:
79
+ - what: setData
80
+ on: click
81
+ path: ~.makeEditable
82
+ value: false
83
+ stopPropagation: true
84
+
85
+ - type: input
86
+ attributes:
87
+ type: "text"
88
+ value: ~.input_value
89
+ placeholder: "Try typing here when readonly is removed..."
90
+ class: "ua-demo-input"
91
+ readonly: "readonly"
92
+ style:
93
+ padding: "10px"
94
+ border: "2px solid #007bff"
95
+ borderRadius: "4px"
96
+ fontSize: "16px"
97
+ margin: "10px 0"
98
+ width: "300px"
99
+ display: "block"
100
+ actions:
101
+ - what: unsetAttribute
102
+ name: "readonly"
103
+ when: ~.makeEditable
104
+ is: true
105
+ - what: setData
106
+ on: change
107
+ path: ~.input_value
108
+ value: <reactive-json:event-new-value>
109
+
110
+ - type: style
111
+ content: |
112
+ .ua-demo-input[readonly] {
113
+ cursor: not-allowed !important;
114
+ opacity: 0.7 !important;
115
+ border-color: #6c757d !important;
116
+ }
117
+ .ua-demo-input:not([readonly]) {
118
+ border-color: #28a745 !important;
119
+ outline: 2px solid #28a745 !important;
120
+ outline-offset: 2px !important;
121
+ }
122
+
123
+ data:
124
+ makeEditable: false
125
+ input_value: ""
126
+
127
+ - type: Markdown
128
+ content: |
129
+ ## Notes
130
+
131
+ - This action **completely removes the entire attribute**, not just specific values.
132
+ - Use `UnsetAttributeValue` if you only want to remove specific values.
133
+ - The attribute can be restored using `SetAttributeValue` if needed.
134
+ - **Important**: To set an empty attribute (not remove it), use `SetAttributeValue` with an empty string value.
135
+ - Useful for conditional attribute presence rather than conditional values.
@@ -0,0 +1,135 @@
1
+ # UnsetAttributeValue
2
+
3
+ Removes a specific value from an HTML attribute while preserving other values.
4
+
5
+ ## Basic Syntax
6
+
7
+ ```yaml
8
+ actions:
9
+ # Remove CSS class
10
+ - what: unsetAttributeValue
11
+ name: "class"
12
+ value: "highlighted"
13
+
14
+ # Remove with template
15
+ - what: unsetAttributeValue
16
+ name: "data-tags"
17
+ value: ~.tagToRemove
18
+ ```
19
+
20
+ ## Properties
21
+
22
+ - **name** *(string, required)*: The name of the attribute to modify.
23
+ - **separator** *(string, optional)*: The separator used between values. Default: `" "` (space).
24
+ - **unsetAllOccurrences** *(boolean, optional)*: When `true` (default), removes all occurrences of the value from the attribute. When `false`, removes the number of elements defined by `unsetCount`.
25
+ - **unsetCount** *(number, optional)*: 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`).
26
+ - **value** *(string, required)*: The value to remove from the attribute. Supports template evaluation (e.g., `~.dynamicValue`, `~~.globalValue`). Automatically converted to string if not already.
27
+
28
+ ## Behavior
29
+
30
+ - **Selective removal**: Removes only the specified value from the attribute.
31
+ - **Occurrence control**: Removes all occurrences by default, or only the first when configured.
32
+ - **Count control**: When `unsetCount` is specified, controls the exact number of elements to remove and the direction (from beginning or end).
33
+ - **Preservation**: Other values in the attribute remain intact.
34
+
35
+ ## Logic Reference
36
+
37
+ ### Behavior Matrix
38
+
39
+ | `unsetAllOccurrences` | `unsetCount` | Behavior | Notes |
40
+ |:---------------------:|:------------:|:---------|:------|
41
+ | `true` | *ignored* | **Removes ALL occurrences** | `unsetCount` is completely ignored |
42
+ | `false` | `1` | Removes **1 occurrence** from beginning | Default behavior when `unsetCount` is valid |
43
+ | `false` | `2` | Removes **2 occurrences** from beginning | |
44
+ | `false` | `-1` | Removes **1 occurrence** from end | |
45
+ | `false` | `-2` | Removes **2 occurrences** from end | |
46
+ | `false` | `0` | **Removes nothing** | |
47
+ | `false` | `undefined` | **Removes ALL occurrences** | Fallback to "all" behavior |
48
+ | `false` | `null` | **Removes ALL occurrences** | Fallback to "all" behavior |
49
+ | `false` | `"invalid"` | **Removes ALL occurrences** | Fallback to "all" behavior |
50
+ | `undefined` | `1` | Removes **1 occurrence** from beginning | `unsetAllOccurrences` defaults to `true`, but valid `unsetCount` applies |
51
+ | `undefined` | `-1` | Removes **1 occurrence** from end | |
52
+ | `undefined` | `0` | **Removes nothing** | |
53
+ | `undefined` | `undefined` | **Removes ALL occurrences** | Complete default behavior |
54
+
55
+ ### Logic Summary
56
+
57
+ 1. **If `unsetAllOccurrences: true`** → removes ALL, ignores `unsetCount`
58
+ 2. **If `unsetAllOccurrences: false` AND `unsetCount` valid** → uses `unsetCount`
59
+ 3. **If `unsetCount` invalid/undefined** → fallback to "remove ALL" even if `unsetAllOccurrences: false`
60
+ 4. **If nothing is defined** → default behavior = "remove ALL"
61
+
62
+ This logic ensures there is always a defined behavior, with an intelligent fallback to "remove all" when parameters are invalid.
63
+
64
+ ## Common Use Cases
65
+
66
+ - **CSS class removal**: Removing specific CSS classes while keeping others.
67
+ - **Data attribute cleanup**: Removing specific values from space-separated data attributes.
68
+ - **Conditional styling**: Removing styling classes based on state changes.
69
+
70
+ ## Example
71
+
72
+ ```yaml
73
+ renderView:
74
+ - type: button
75
+ content: "Remove 'highlighted' class"
76
+ actions:
77
+ - what: setData
78
+ on: click
79
+ path: ~.removeHighlight
80
+ value: true
81
+ stopPropagation: true
82
+
83
+ - type: button
84
+ content: "Reset"
85
+ actions:
86
+ - what: setData
87
+ on: click
88
+ path: ~.removeHighlight
89
+ value: false
90
+ stopPropagation: true
91
+
92
+ - type: input
93
+ attributes:
94
+ type: "text"
95
+ value: "This input has multiple classes..."
96
+ class: "uav-readonly uav-highlighted"
97
+ readonly: "readonly"
98
+ style:
99
+ padding: "10px"
100
+ border: "2px solid #007bff"
101
+ borderRadius: "4px"
102
+ fontSize: "16px"
103
+ margin: "10px 0"
104
+ width: "300px"
105
+ display: "block"
106
+ actions:
107
+ - what: unsetAttributeValue
108
+ name: "class"
109
+ value: "uav-highlighted"
110
+ when: ~.removeHighlight
111
+ is: true
112
+
113
+ - type: style
114
+ content: |
115
+ .uav-readonly {
116
+ cursor: not-allowed !important;
117
+ opacity: 0.7 !important;
118
+ }
119
+ .uav-highlighted {
120
+ border-color: #ffc107 !important;
121
+ outline: 2px solid #ffc107 !important;
122
+ outline-offset: 2px !important;
123
+ }
124
+
125
+ data:
126
+ removeHighlight: false
127
+ ```
128
+
129
+ ## Notes
130
+
131
+ - Only removes exact matches of the specified value.
132
+ - Maintains the integrity of other attribute values.
133
+ - Works with any space-separated attribute values.
134
+ - Safe to use even if the value doesn't exist in the attribute.
135
+ - The value property supports full template evaluation including `~.localData`, `~~.globalData`, `~>nearestKey`, and `~~>globalKey` patterns.