@ea-lab/reactive-json-docs 1.4.0 → 1.4.1
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.
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@ attributeTransforms:
|
|
|
24
24
|
name: "style"
|
|
25
25
|
value:
|
|
26
26
|
borderColor: "#3b82f6"
|
|
27
|
-
backgroundColor: "
|
|
27
|
+
backgroundColor: "var(--bs-secondary-bg-subtle, rgba(0, 0, 0, 0.05))"
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
## Properties
|
|
@@ -92,6 +92,8 @@ renderView:
|
|
|
92
92
|
margin: "10px 0"
|
|
93
93
|
width: "300px"
|
|
94
94
|
display: "block"
|
|
95
|
+
backgroundColor: "var(--bs-secondary-bg-subtle, rgba(0, 0, 0, 0.05))"
|
|
96
|
+
color: "#212529"
|
|
95
97
|
attributeTransforms:
|
|
96
98
|
- what: setAttributeValue
|
|
97
99
|
name: "class"
|
|
@@ -129,26 +131,25 @@ renderView:
|
|
|
129
131
|
- type: div
|
|
130
132
|
attributes:
|
|
131
133
|
style:
|
|
132
|
-
padding: "
|
|
133
|
-
|
|
134
|
+
padding: "20px"
|
|
135
|
+
borderWidth: "2px"
|
|
136
|
+
borderStyle: "solid"
|
|
137
|
+
borderColor: "#007bff #007bff"
|
|
134
138
|
borderRadius: "4px"
|
|
139
|
+
backgroundColor: "var(--bs-secondary-bg-subtle, rgba(0, 0, 0, 0.05))"
|
|
140
|
+
color: "#212529"
|
|
135
141
|
attributeTransforms:
|
|
136
142
|
# Merge additional style properties without losing existing ones
|
|
137
143
|
- what: setAttributeValue
|
|
138
144
|
name: "style"
|
|
139
145
|
value:
|
|
140
|
-
borderColor: "#3b82f6"
|
|
141
|
-
backgroundColor: "#f0f0f0"
|
|
146
|
+
borderColor: "#007bff var(--bs-primary, #3b82f6)"
|
|
142
147
|
when: ~.isHighlighted
|
|
143
148
|
is: true
|
|
144
149
|
# Result when isHighlighted is true:
|
|
145
|
-
#
|
|
146
|
-
#
|
|
147
|
-
#
|
|
148
|
-
# borderRadius: "4px",
|
|
149
|
-
# borderColor: "#3b82f6",
|
|
150
|
-
# backgroundColor: "#f0f0f0"
|
|
151
|
-
# }
|
|
150
|
+
# The modification changes the highlight color for vertical borders (left and right)
|
|
151
|
+
# borderColor becomes: "#007bff var(--bs-primary, #3b82f6)"
|
|
152
|
+
# (horizontal borders stay #007bff, vertical borders change to primary color)
|
|
152
153
|
|
|
153
154
|
data:
|
|
154
155
|
isHighlighted: false
|
|
@@ -163,20 +164,28 @@ renderView:
|
|
|
163
164
|
style:
|
|
164
165
|
padding: "10px"
|
|
165
166
|
border: "2px solid #007bff"
|
|
167
|
+
backgroundColor: "var(--bs-secondary-bg-subtle, rgba(0, 0, 0, 0.05))"
|
|
168
|
+
color: "#212529"
|
|
166
169
|
attributeTransforms:
|
|
167
170
|
# Completely replace the style object
|
|
168
171
|
- what: setAttributeValue
|
|
169
172
|
name: "style"
|
|
170
173
|
mode: "replace"
|
|
171
174
|
value:
|
|
172
|
-
backgroundColor: "#
|
|
173
|
-
color: "#
|
|
175
|
+
backgroundColor: "var(--bs-primary-bg-subtle, #d4f0ec)"
|
|
176
|
+
color: "var(--bs-primary-text-emphasis, #2b6b5a)"
|
|
177
|
+
padding: "15px"
|
|
178
|
+
borderRadius: "8px"
|
|
179
|
+
border: "2px solid var(--bs-primary, #44a08d)"
|
|
174
180
|
# Result:
|
|
175
181
|
# style: {
|
|
176
|
-
# backgroundColor: "#
|
|
177
|
-
# color: "#
|
|
182
|
+
# backgroundColor: "var(--bs-primary-bg-subtle, #d4f0ec)",
|
|
183
|
+
# color: "var(--bs-primary-text-emphasis, #2b6b5a)",
|
|
184
|
+
# padding: "15px",
|
|
185
|
+
# borderRadius: "8px",
|
|
186
|
+
# border: "2px solid var(--bs-primary, #44a08d)"
|
|
178
187
|
# }
|
|
179
|
-
# (original
|
|
188
|
+
# (original styles are completely replaced)
|
|
180
189
|
```
|
|
181
190
|
|
|
182
191
|
## Notes
|
|
@@ -189,6 +198,7 @@ renderView:
|
|
|
189
198
|
- **Replace mode**: Use when you need complete control over the attribute value. In object mode, completely replaces the entire object.
|
|
190
199
|
- **Duplicate prevention**: Only applies to append mode, and works for string values in both string mode and object mode.
|
|
191
200
|
- **Object merging**: In object mode append, nested objects are merged recursively. Properties that don't match the expected format for append are replaced (new value has precedence).
|
|
201
|
+
- **Extended properties vs shorthand**: When transformations are required, prefer using extended CSS properties (e.g., `borderWidth`, `borderStyle`, `borderColor`) instead of shorthand properties (e.g., `border`). This ensures the browser handles property modifications correctly. When you modify a single property like `borderColor` on an element that uses the shorthand `border`, the browser may decompose the shorthand into individual properties, which can lead to unexpected behavior. Using extended properties from the start avoids this issue.
|
|
192
202
|
- **Template evaluation**: The value property supports full template evaluation including `~.localData`, `~~.globalData`, `~>nearestKey`, and `~~>globalKey` patterns.
|
|
193
203
|
- **Conditional execution**: Supports the same condition system as actions (`when`, `is`, `isEmpty`, `isNotEmpty`, etc.).
|
|
194
204
|
- **Undefined handling**: `undefined` values are ignored in append mode but assigned in replace mode.
|
|
@@ -28,7 +28,7 @@ renderView:
|
|
|
28
28
|
name: "style"
|
|
29
29
|
value:
|
|
30
30
|
borderColor: "#3b82f6"
|
|
31
|
-
backgroundColor: "
|
|
31
|
+
backgroundColor: "var(--bs-secondary-bg-subtle, rgba(0, 0, 0, 0.05))"
|
|
32
32
|
|
|
33
33
|
- type: Markdown
|
|
34
34
|
content: |
|
|
@@ -141,6 +141,8 @@ renderView:
|
|
|
141
141
|
margin: "10px 0"
|
|
142
142
|
width: "300px"
|
|
143
143
|
display: "block"
|
|
144
|
+
backgroundColor: "var(--bs-secondary-bg-subtle, rgba(0, 0, 0, 0.05))"
|
|
145
|
+
color: "#212529"
|
|
144
146
|
actions:
|
|
145
147
|
- what: setData
|
|
146
148
|
on: change
|
|
@@ -177,6 +179,7 @@ renderView:
|
|
|
177
179
|
**Expected behavior:**
|
|
178
180
|
- The div has initial styles (padding, border, borderRadius)
|
|
179
181
|
- When `isHighlighted` is true, additional style properties are merged
|
|
182
|
+
- The modification changes the highlight color for vertical borders (left and right), as `borderColor` contains two colors
|
|
180
183
|
- The original styles are preserved, and new properties are added
|
|
181
184
|
- Try toggling the highlight to see the style merge in action
|
|
182
185
|
|
|
@@ -186,15 +189,18 @@ renderView:
|
|
|
186
189
|
attributes:
|
|
187
190
|
style:
|
|
188
191
|
padding: "10px"
|
|
189
|
-
|
|
192
|
+
borderWidth: "5px"
|
|
193
|
+
borderStyle: "solid"
|
|
194
|
+
borderColor: "black"
|
|
190
195
|
borderRadius: "4px"
|
|
196
|
+
backgroundColor: "var(--bs-secondary-bg-subtle, rgba(0, 0, 0, 0.05))"
|
|
197
|
+
color: "#212529"
|
|
191
198
|
attributeTransforms:
|
|
192
199
|
# Merge additional style properties without losing existing ones
|
|
193
200
|
- what: setAttributeValue
|
|
194
201
|
name: "style"
|
|
195
202
|
value:
|
|
196
|
-
borderColor: "#3b82f6"
|
|
197
|
-
backgroundColor: "#f0f0f0"
|
|
203
|
+
borderColor: "var(--bs-primary, #3b82f6)"
|
|
198
204
|
when: ~.isHighlighted
|
|
199
205
|
is: true
|
|
200
206
|
content: "Click to toggle highlight"
|
|
@@ -205,7 +211,15 @@ renderView:
|
|
|
205
211
|
- what: setData
|
|
206
212
|
on: click
|
|
207
213
|
path: ~.isHighlighted
|
|
208
|
-
value:
|
|
214
|
+
value: true
|
|
215
|
+
when: ~.isHighlighted
|
|
216
|
+
is: false
|
|
217
|
+
- what: setData
|
|
218
|
+
on: click
|
|
219
|
+
path: ~.isHighlighted
|
|
220
|
+
value: false
|
|
221
|
+
when: ~.isHighlighted
|
|
222
|
+
is: true
|
|
209
223
|
|
|
210
224
|
data:
|
|
211
225
|
isHighlighted: false
|
|
@@ -229,14 +243,19 @@ renderView:
|
|
|
229
243
|
style:
|
|
230
244
|
padding: "10px"
|
|
231
245
|
border: "2px solid #007bff"
|
|
246
|
+
backgroundColor: "var(--bs-secondary-bg-subtle, rgba(0, 0, 0, 0.05))"
|
|
247
|
+
color: "#212529"
|
|
232
248
|
attributeTransforms:
|
|
233
249
|
# Completely replace the style object
|
|
234
250
|
- what: setAttributeValue
|
|
235
251
|
name: "style"
|
|
236
252
|
mode: "replace"
|
|
237
253
|
value:
|
|
238
|
-
backgroundColor: "#
|
|
239
|
-
color: "#
|
|
254
|
+
backgroundColor: "var(--bs-primary-bg-subtle, #d4f0ec)"
|
|
255
|
+
color: "var(--bs-primary-text-emphasis, #2b6b5a)"
|
|
256
|
+
padding: "15px"
|
|
257
|
+
borderRadius: "8px"
|
|
258
|
+
border: "2px solid var(--bs-primary, #44a08d)"
|
|
240
259
|
content: "This div's style was completely replaced"
|
|
241
260
|
|
|
242
261
|
- type: Markdown
|
|
@@ -251,6 +270,7 @@ renderView:
|
|
|
251
270
|
- **Replace mode**: Use when you need complete control over the attribute value. In object mode, completely replaces the entire object.
|
|
252
271
|
- **Duplicate prevention**: Only applies to append mode, and works for string values in both string mode and object mode.
|
|
253
272
|
- **Object merging**: In object mode append, nested objects are merged recursively. Properties that don't match the expected format for append are replaced (new value has precedence).
|
|
273
|
+
- **Extended properties vs shorthand**: When transformations are required, prefer using extended CSS properties (e.g., `borderWidth`, `borderStyle`, `borderColor`) instead of shorthand properties (e.g., `border`). This ensures the browser handles property modifications correctly. When you modify a single property like `borderColor` on an element that uses the shorthand `border`, the browser may decompose the shorthand into individual properties, which can lead to unexpected behavior. Using extended properties from the start avoids this issue.
|
|
254
274
|
- **Template evaluation**: The value property supports full template evaluation including `~.localData`, `~~.globalData`, `~>nearestKey`, and `~~>globalKey` patterns.
|
|
255
275
|
- **Conditional execution**: Supports the same condition system as actions (`when`, `is`, `isEmpty`, `isNotEmpty`, etc.).
|
|
256
276
|
- **Undefined handling**: `undefined` values are ignored in append mode but assigned in replace mode.
|