@ea-lab/reactive-json-docs 0.3.0 → 0.5.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 (52) hide show
  1. package/package.json +2 -2
  2. package/public/rjbuild/docs/advanced-concepts/data-mapping.md +76 -0
  3. package/public/rjbuild/docs/advanced-concepts/data-mapping.yaml +140 -0
  4. package/public/rjbuild/docs/advanced-concepts/data-processors.md +373 -0
  5. package/public/rjbuild/docs/advanced-concepts/data-processors.yaml +309 -0
  6. package/public/rjbuild/docs/advanced-concepts/index.md +10 -0
  7. package/public/rjbuild/docs/advanced-concepts/index.yaml +16 -0
  8. package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/component-development-guide-llm.md +2 -0
  9. package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/component-development.md +1 -1
  10. package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/component-development.yaml +1 -1
  11. package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/plugin-system.md +2 -0
  12. package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/plugin-system.yaml +2 -0
  13. package/public/rjbuild/docs/core/action/Hide.md +1 -1
  14. package/public/rjbuild/docs/core/action/Hide.yaml +10 -10
  15. package/public/rjbuild/docs/core/action/ReactOnEvent.md +12 -12
  16. package/public/rjbuild/docs/core/action/ReactOnEvent.yaml +61 -101
  17. package/public/rjbuild/docs/core/action/Redirect.md +10 -2
  18. package/public/rjbuild/docs/core/action/Redirect.yaml +18 -51
  19. package/public/rjbuild/docs/core/action/VisuallyHide.yaml +10 -12
  20. package/public/rjbuild/docs/core/action/index.md +19 -204
  21. package/public/rjbuild/docs/core/action/index.yaml +19 -264
  22. package/public/rjbuild/docs/core/dataMapping/index.md +31 -0
  23. package/public/rjbuild/docs/core/dataMapping/index.yaml +24 -0
  24. package/public/rjbuild/docs/core/dataMapping/simpleMapping.md +131 -0
  25. package/public/rjbuild/docs/core/dataMapping/simpleMapping.yaml +376 -0
  26. package/public/rjbuild/docs/core/element/form/DateField.md +1 -1
  27. package/public/rjbuild/docs/core/element/form/DateField.yaml +4 -4
  28. package/public/rjbuild/docs/core/element/form/SelectField.yaml +2 -2
  29. package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.md +4 -3
  30. package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.yaml +114 -6
  31. package/public/rjbuild/docs/core/example/website.yaml +10 -10
  32. package/public/rjbuild/docs/core/reaction/index.md +17 -229
  33. package/public/rjbuild/docs/core/reaction/index.yaml +14 -242
  34. package/public/rjbuild/docs/core/reaction/setData.md +1 -1
  35. package/public/rjbuild/docs/core/reaction/setData.yaml +1 -1
  36. package/public/rjbuild/docs/docs-components/index.md +0 -2
  37. package/public/rjbuild/docs/docs-components/index.yaml +0 -2
  38. package/public/rjbuild/docs/getting-started/actions.md +294 -0
  39. package/public/rjbuild/docs/getting-started/actions.yaml +403 -0
  40. package/public/rjbuild/docs/{getting-started.md → getting-started/index.md} +30 -6
  41. package/public/rjbuild/docs/{getting-started.yaml → getting-started/index.yaml} +22 -6
  42. package/public/rjbuild/docs/getting-started/reactions.md +301 -0
  43. package/public/rjbuild/docs/getting-started/reactions.yaml +300 -0
  44. package/public/rjbuild/docs/getting-started/rjbuild-structure.md +358 -0
  45. package/public/rjbuild/docs/getting-started/rjbuild-structure.yaml +421 -0
  46. package/public/rjbuild/docs/{template.md → getting-started/template-contexts-data-binding.md} +16 -12
  47. package/public/rjbuild/docs/{template.yaml → getting-started/template-contexts-data-binding.yaml} +28 -14
  48. package/public/rjbuild/docs/install.yaml +682 -681
  49. /package/public/rjbuild/docs/{core/reaction → advanced-concepts}/forward-update.md +0 -0
  50. /package/public/rjbuild/docs/{core/reaction → advanced-concepts}/forward-update.yaml +0 -0
  51. /package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/index.md +0 -0
  52. /package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/index.yaml +0 -0
@@ -0,0 +1,403 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # Actions System
5
+
6
+ The Reactive-JSON actions system allows you to modify element behavior and appearance based on dynamic conditions. Actions are applied to individual elements and can control visibility, display tooltips, redirect users, or trigger other behaviors based on the current data state.
7
+
8
+ Actions enable the UI to adapt automatically based on the application's state. They differ from [reactions](./reactions), which execute in response to user events; actions are evaluated continuously based on data conditions.
9
+
10
+ - type: Markdown
11
+ content: |
12
+ ## Basic Syntax
13
+
14
+ Actions are defined as part of the `actions` array on any element. Each action has the following structure:
15
+
16
+ - type: DefinitionList
17
+ content:
18
+ - term:
19
+ code: what
20
+ details: "The type of action to execute."
21
+ - term:
22
+ code: when
23
+ after: " (optional)"
24
+ details:
25
+ type: Markdown
26
+ content: "Data field reference to evaluate for the condition that determines when the action should execute. Supports various conditional operators: `is`, `isNot`, `isEmpty`, `contains`, `containsNot`, `containedBy`, `containedByNot`, numeric comparisons (`>`, `<`, `>=`, `<=`), and complex conditions (`andConditions`, `orConditions`). For detailed information about each condition type, see the [conditional operators reference](#conditional-operators) below."
27
+
28
+ - type: Markdown
29
+ content: |
30
+ In addition to these core properties, actions support action-specific properties that vary depending on the action type. For example, a `hide` action only requires the condition properties, while a `redirect` action needs a `to` property specifying the destination URL.
31
+
32
+ - type: TabbedSerializer
33
+ yamlSerializedContent: |
34
+ renderView:
35
+ - type: CheckBoxField
36
+ dataLocation: ~.show_advanced
37
+ options:
38
+ - value: true
39
+ label: "Show advanced settings"
40
+
41
+ - type: div
42
+ content: "Advanced Settings Panel"
43
+ actions:
44
+ - what: hide # Action type
45
+ when: ~.show_advanced # Condition to evaluate
46
+ isNot: true # Expected value
47
+
48
+ - type: RjBuildDescriber
49
+ title: "Basic Action Demonstration"
50
+ description:
51
+ - type: Markdown
52
+ content: |
53
+ This example demonstrates how actions adapt the UI based on application state.
54
+
55
+ When you check the checkbox, the "Advanced Settings Panel" becomes visible. The action continuously evaluates the condition and shows/hides content accordingly.
56
+
57
+ toDescribe:
58
+ renderView:
59
+ - type: CheckBoxField
60
+ dataLocation: ~.show_advanced
61
+ options:
62
+ - value: true
63
+ label: "Show advanced settings"
64
+
65
+ - type: div
66
+ content: "Basic Settings"
67
+ attributes:
68
+ style:
69
+ padding: "15px"
70
+ border: "2px solid var(--bs-border-color, #dee2e6)"
71
+ borderRadius: "8px"
72
+ margin: "10px 0"
73
+
74
+ - type: div
75
+ content: "Advanced Settings Panel"
76
+ attributes:
77
+ style:
78
+ padding: "15px"
79
+ border: "2px dashed var(--bs-border-color, #dee2e6)"
80
+ borderRadius: "8px"
81
+ margin: "10px 0"
82
+ fontStyle: "italic"
83
+ actions:
84
+ - what: hide # Action type
85
+ when: ~.show_advanced # Condition to evaluate
86
+ isNot: true # Expected value
87
+
88
+ data:
89
+ show_advanced: false
90
+
91
+ - type: Markdown
92
+ content: |
93
+ ## Action Types
94
+
95
+ Reactive-JSON provides several built-in actions:
96
+
97
+ ### Visibility Control
98
+ - **[hide](../core/action/Hide)**: Completely hides the element and its children
99
+ - **[visuallyHide](../core/action/VisuallyHide)**: Visually hides the element while keeping it accessible to screen readers
100
+
101
+ ### User Interaction
102
+ - **[tooltip](../core/action/Tooltip)**: Displays a tooltip on hover
103
+ - **[popover](../core/action/Popover)**: Shows a more complex popover on click
104
+
105
+ ### Navigation
106
+ - **[redirect](../core/action/Redirect)**: Redirects to a specified URL
107
+
108
+ For detailed documentation of each action, including properties and examples, see their respective documentation pages.
109
+
110
+ - type: RjBuildDescriber
111
+ title: "Basic Conditional Actions"
112
+ description:
113
+ - type: Markdown
114
+ content: |
115
+ This example shows simple conditional actions using `is` and `isEmpty` conditions.
116
+
117
+ toDescribe:
118
+ renderView:
119
+ - type: div
120
+ content:
121
+ - type: label
122
+ content: "Status: "
123
+ - type: SelectField
124
+ dataLocation: ~.status
125
+ options:
126
+ - value: "inactive"
127
+ label: "Inactive"
128
+ - value: "active"
129
+ label: "Active"
130
+
131
+ - type: br
132
+
133
+ - type: label
134
+ content: "Text: "
135
+ - type: TextField
136
+ dataLocation: ~.text_input
137
+ placeholder: "Type something..."
138
+
139
+ - type: div
140
+ content:
141
+ - type: div
142
+ content: "This shows only when status is 'active'"
143
+ attributes:
144
+ style:
145
+ padding: "10px"
146
+ border: "1px solid var(--bs-border-color, #dee2e6)"
147
+ margin: "5px 0"
148
+ actions:
149
+ - what: hide
150
+ when: ~.status
151
+ isNot: "active"
152
+
153
+ - type: div
154
+ content: "This shows only when text is not empty"
155
+ attributes:
156
+ style:
157
+ padding: "10px"
158
+ border: "1px solid var(--bs-border-color, #dee2e6)"
159
+ margin: "5px 0"
160
+ actions:
161
+ - what: hide
162
+ when: ~.text_input
163
+ isEmpty: true
164
+
165
+ data:
166
+ status: "inactive"
167
+ text_input: ""
168
+
169
+ - type: RjBuildDescriber
170
+ title: "Tooltip Action Example"
171
+ description:
172
+ - type: Markdown
173
+ content: |
174
+ This example demonstrates the tooltip action with conditional display.
175
+
176
+ toDescribe:
177
+ renderView:
178
+ - type: div
179
+ content:
180
+ - type: button
181
+ content: "Hover for help (when enabled)"
182
+ actions:
183
+ - what: tooltip
184
+ content: "This is a helpful tooltip!"
185
+ placement: "top"
186
+ when: ~.show_tooltips
187
+ is: true
188
+
189
+ - type: br
190
+ - type: br
191
+
192
+ - type: label
193
+ content:
194
+ - type: CheckBoxField
195
+ dataLocation: ~.show_tooltips
196
+ options:
197
+ - value: true
198
+ label: ""
199
+ - " Enable tooltips"
200
+
201
+ data:
202
+ show_tooltips: true
203
+
204
+ - type: RjBuildDescriber
205
+ title: "Practical Form Example"
206
+ description:
207
+ - type: Markdown
208
+ content: |
209
+ This example shows a simple form with conditional submit button and validation messages.
210
+
211
+ toDescribe:
212
+ renderView:
213
+ - type: div
214
+ content:
215
+ - type: h4
216
+ content: "Simple Contact Form"
217
+
218
+ - type: div
219
+ content:
220
+ - type: label
221
+ content: "Name: "
222
+ - type: TextField
223
+ dataLocation: ~.form.name
224
+ placeholder: "Enter your name"
225
+
226
+ - type: br
227
+
228
+ - type: div
229
+ content:
230
+ - type: label
231
+ content: "Email: "
232
+ - type: TextField
233
+ dataLocation: ~.form.email
234
+ inputType: "email"
235
+ placeholder: "Enter your email"
236
+
237
+ - type: br
238
+
239
+ - type: div
240
+ content: "Please fill in both fields"
241
+ attributes:
242
+ style:
243
+ color: "var(--bs-danger, #dc3545)"
244
+ fontSize: "14px"
245
+ actions:
246
+ - what: hide
247
+ andConditions:
248
+ - when: ~.form.name
249
+ isNotEmpty:
250
+ - when: ~.form.email
251
+ isNotEmpty:
252
+
253
+ - type: button
254
+ content: "Submit"
255
+ attributes:
256
+ style:
257
+ border: "1px solid var(--bs-border-color, #dee2e6)"
258
+ padding: "8px 16px"
259
+ actions:
260
+ - what: hide
261
+ when: ~.form.name
262
+ isEmpty: true
263
+ - what: hide
264
+ when: ~.form.email
265
+ isEmpty: true
266
+ - what: setData
267
+ on: click
268
+ path: ~.submitted
269
+ value: true
270
+
271
+ - type: div
272
+ content: "✅ Form submitted successfully!"
273
+ attributes:
274
+ style:
275
+ color: "var(--bs-success, #198754)"
276
+ marginTop: "10px"
277
+ fontWeight: "bold"
278
+ actions:
279
+ - what: hide
280
+ when: ~.submitted
281
+ isNot: true
282
+
283
+ data:
284
+ form:
285
+ name: ""
286
+ email: ""
287
+ submitted: false
288
+
289
+ - type: h2
290
+ content: "Conditional Operators"
291
+ attributes:
292
+ id: conditional-operators
293
+
294
+ - type: Markdown
295
+ content: |
296
+ Actions support the following conditional operators when using the `when` property:
297
+
298
+ - type: DefinitionList
299
+ content:
300
+ - term:
301
+ code: is
302
+ details: "Value equals exactly the specified value."
303
+ - term:
304
+ code: isNot
305
+ details: "Value is different from the specified value."
306
+ - term:
307
+ code: isEmpty
308
+ details:
309
+ type: Markdown
310
+ content: "Value is empty (null, undefined, empty string, empty array, or empty object). The presence of the property is sufficient (value doesn't matter, can be `null` in JSON). Use `isEmpty:` to check if empty, or `isEmpty: \"not\"` to check if not empty (alternatively, use `isNotEmpty:`)."
311
+ - term:
312
+ code: isNotEmpty
313
+ details:
314
+ type: Markdown
315
+ content: "Value is not empty (shorthand for `isEmpty: \"not\"`). The presence of the property is sufficient - the value doesn't matter and can be `null` in JSON."
316
+ - term:
317
+ code: contains
318
+ details: "Value contains the specified substring or array element."
319
+ - term:
320
+ code: containsNot
321
+ details: "Value does not contain the specified substring or array element."
322
+ - term:
323
+ code: containedBy
324
+ details: "Value is contained within the specified array or string."
325
+ - term:
326
+ code: containedByNot
327
+ details: "Value is not contained within the specified array or string."
328
+ - term:
329
+ code: ">"
330
+ details: "Value is greater than the specified number or date."
331
+ - term:
332
+ code: "<"
333
+ details: "Value is less than the specified number or date."
334
+ - term:
335
+ code: ">="
336
+ details: "Value is greater than or equal to the specified number or date."
337
+ - term:
338
+ code: "<="
339
+ details: "Value is less than or equal to the specified number or date."
340
+ - term:
341
+ code: andConditions
342
+ after: " (array)"
343
+ details:
344
+ type: Markdown
345
+ content: |
346
+ All nested conditions must be true for the action to execute.
347
+
348
+ ```yaml
349
+ # Example: Hide when both status is active AND user has admin role
350
+ andConditions:
351
+ - when: ~.status
352
+ is: "active"
353
+ - when: ~.user_role
354
+ is: "admin"
355
+ ```
356
+ - term:
357
+ code: orConditions
358
+ after: " (array)"
359
+ details: "At least one nested condition must be true for the action to execute."
360
+
361
+ - type: Markdown
362
+ content: |
363
+
364
+ ## Execution Order
365
+ - Actions are evaluated in the order they appear in the array.
366
+ - Conditions are evaluated before action execution.
367
+ - Some actions (like `hide`) prevent subsequent actions from executing.
368
+
369
+ ## State-Driven Behavior
370
+ - Actions continuously evaluate their conditions based on current data.
371
+ - No explicit triggers needed - they respond automatically to data changes.
372
+ - Perfect for creating adaptive interfaces that respond to application state.
373
+
374
+ - type: Markdown
375
+ content: |
376
+ ## Technical Limitations
377
+
378
+ 1. **Execution order**: Actions are evaluated in definition order and cannot be reordered dynamically.
379
+ 2. **Hide behavior**: Once an element is hidden with the `hide` action, no subsequent actions execute.
380
+ 3. **Synchronous evaluation**: All conditions and actions are evaluated synchronously.
381
+ 4. **Data scope**: Actions can only access data from the current template context and global context.
382
+ 5. **No side effects**: Actions cannot directly modify global state or trigger reactions.
383
+ 6. **External dependencies**: Some actions (tooltip, popover) require React Bootstrap components.
384
+
385
+ ## Best Practices
386
+
387
+ 1. **Keep conditions simple**: Avoid overly complex condition logic for better maintainability.
388
+ 2. **Consider performance**: Minimize frequently-evaluated complex conditions.
389
+ 3. **Use appropriate actions**: Choose `visuallyHide` over `hide` when content should remain accessible.
390
+ 4. **Test thoroughly**: Verify action behavior with different data states.
391
+ 5. **Document complex logic**: Add comments for non-obvious conditional logic.
392
+ 6. **Order matters**: Place critical actions (like `hide`) early in the action array when appropriate.
393
+
394
+ ## Next Steps
395
+
396
+ Now that you understand how actions work to adapt the UI based on application state, learn about **[Reactions](./reactions)** to handle user events and trigger behaviors in response to user interactions.
397
+
398
+ Actions and reactions work together to create fully interactive applications: actions provide state-driven UI adaptation, while reactions enable event-driven behavior.
399
+
400
+ ## Related Documentation
401
+
402
+ - **[Reactions System](./reactions)**: Learn about handling user events and state changes.
403
+ - **[Template System](../getting-started/template-contexts-data-binding)**: Understand data binding and template expressions.
@@ -1,5 +1,29 @@
1
1
  # Reactive-JSON Getting Started Guide
2
2
 
3
+
4
+
5
+ ## Topics
6
+
7
+ - **[RjBuild structure](rjbuild-structure.md)**:
8
+ - **[Template system](template-contexts-data-binding.md)**:
9
+ - **[Actions](actions.md)**: Make the UI reflect the state of the app.
10
+ - **[Reactions](reactions.md)**: Bring interactivity to your app, such as performing HTTP requests, edit the app state on events…
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
3
27
  ## Introduction
4
28
 
5
29
  Reactive-JSON is a powerful library that allows you to create interactive user interfaces using only JSON/YAML configurations. No need to write complex JavaScript code - simply define your interface and its behavior declaratively.
@@ -53,7 +77,7 @@ data:
53
77
  isAdmin: true
54
78
  ```
55
79
 
56
- > 💡 **Advanced navigation:** For complex hierarchical data access, see the [Template System documentation](/docs/template) which covers `~>key` and `~~>key` notations.
80
+ > 💡 **Advanced navigation:** For complex hierarchical data access, see the [Template System documentation](/docs/getting-started/template-contexts-data-binding) which covers `~>key` and `~~>key` notations.
57
81
 
58
82
  ### Basic Elements
59
83
 
@@ -152,8 +176,8 @@ data:
152
176
 
153
177
  ## Next Steps
154
178
 
155
- 1. Explore the [complete examples](/docs/core/example) to see Reactive-JSON in action
156
- 2. Check out the [elements documentation](/docs/core/element) to discover all available components
157
- 3. Learn how to use the [action system](/docs/core/action) to create interactive interfaces
158
- 4. Discover the [reaction system](/docs/core/reaction) to handle user interactions
159
- 5. If needed, learn how to [extend Reactive-JSON](/docs/extend) with your own components
179
+ Now that you have an overview of Reactive-JSON, continue with the getting started guide to master the fundamentals:
180
+
181
+ **[RjBuild Structure](./rjbuild-structure)** - Learn about the core structure of Reactive-JSON configurations and how data, templates, and views work together.
182
+
183
+ This systematic approach will give you a solid foundation for building interactive applications with Reactive-JSON.
@@ -3,6 +3,22 @@ renderView:
3
3
  content: |
4
4
  # Reactive-JSON Getting Started Guide
5
5
 
6
+ > Dev note: This page needs to be rewritten.
7
+
8
+
9
+ ## Topics
10
+
11
+ - **[RjBuild structure](rjbuild-structure)**:
12
+ - **[Template, contexts, and data binding](template-contexts-data-binding)**:
13
+ - **[Actions](actions)**: Make the UI reflect the state of the app.
14
+ - **[Reactions](reactions)**: Bring interactivity to your app, such as performing HTTP requests, edit the app state on events…
15
+
16
+
17
+
18
+
19
+
20
+
21
+
6
22
  ## Introduction
7
23
 
8
24
  Reactive-JSON is a powerful library that allows you to create interactive user interfaces using only JSON/YAML configurations. No need to write complex JavaScript code - simply define your interface and its behavior declaratively.
@@ -39,7 +55,7 @@ renderView:
39
55
  - `~.` : Local context (relative to current template)
40
56
  - `~~.` : Global context (access to global data)
41
57
 
42
- > 💡 **Advanced navigation:** For complex hierarchical data access, see the [Template System documentation](/docs/template) which covers `~>key` and `~~>key` notations.
58
+ > 💡 **Advanced navigation:** For complex hierarchical data access, see the [Template System documentation](/docs/getting-started/template-contexts-data-binding) which covers `~>key` and `~~>key` notations.
43
59
 
44
60
  - type: RjBuildDescriber
45
61
  title: "Template System Example"
@@ -217,8 +233,8 @@ renderView:
217
233
  content: |
218
234
  ## Next Steps
219
235
 
220
- 1. Explore the [complete examples](/docs/core/example) to see Reactive-JSON in action
221
- 2. Check out the [elements documentation](/docs/core/element) to discover all available components
222
- 3. Learn how to use the [action system](/docs/core/action) to create interactive interfaces
223
- 4. Discover the [reaction system](/docs/core/reaction) to handle user interactions
224
- 5. If needed, learn how to [extend Reactive-JSON](/docs/extend) with your own components
236
+ Now that you have an overview of Reactive-JSON, continue with the getting started guide to master the fundamentals:
237
+
238
+ **[RjBuild Structure](./rjbuild-structure)** - Learn about the core structure of Reactive-JSON configurations and how data, templates, and views work together.
239
+
240
+ This systematic approach will give you a solid foundation for building interactive applications with Reactive-JSON.