@ea-lab/reactive-json-docs 0.8.0 → 1.0.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 (104) hide show
  1. package/package.json +7 -5
  2. package/public/rjbuild/docs/advanced-concepts/attribute-transformers.md +168 -0
  3. package/public/rjbuild/docs/advanced-concepts/attribute-transformers.yaml +151 -0
  4. package/public/rjbuild/docs/advanced-concepts/data-mapping.md +6 -6
  5. package/public/rjbuild/docs/advanced-concepts/data-mapping.yaml +7 -7
  6. package/public/rjbuild/docs/advanced-concepts/data-processors.md +7 -7
  7. package/public/rjbuild/docs/advanced-concepts/data-processors.yaml +7 -7
  8. package/public/rjbuild/docs/advanced-concepts/forward-update.md +2 -2
  9. package/public/rjbuild/docs/advanced-concepts/forward-update.yaml +2 -2
  10. package/public/rjbuild/docs/advanced-concepts/index.md +1 -0
  11. package/public/rjbuild/docs/advanced-concepts/index.yaml +1 -0
  12. package/public/rjbuild/docs/advanced-concepts/plugins/component-development.md +1 -1
  13. package/public/rjbuild/docs/advanced-concepts/plugins/component-development.yaml +1 -1
  14. package/public/rjbuild/docs/advanced-concepts/plugins/plugin-system.md +48 -2
  15. package/public/rjbuild/docs/advanced-concepts/plugins/plugin-system.yaml +54 -2
  16. package/public/rjbuild/docs/core/action/Attribute/SetAttributeValue.md +2 -0
  17. package/public/rjbuild/docs/core/action/Attribute/SetAttributeValue.yaml +2 -0
  18. package/public/rjbuild/docs/core/action/Attribute/ToggleAttributeValue.md +2 -0
  19. package/public/rjbuild/docs/core/action/Attribute/ToggleAttributeValue.yaml +2 -0
  20. package/public/rjbuild/docs/core/action/Attribute/UnsetAttribute.md +2 -0
  21. package/public/rjbuild/docs/core/action/Attribute/UnsetAttribute.yaml +2 -0
  22. package/public/rjbuild/docs/core/action/Attribute/UnsetAttributeValue.md +2 -0
  23. package/public/rjbuild/docs/core/action/Attribute/UnsetAttributeValue.yaml +2 -0
  24. package/public/rjbuild/docs/core/action/Attribute/index.md +121 -0
  25. package/public/rjbuild/docs/core/action/Attribute/index.yaml +77 -0
  26. package/public/rjbuild/docs/core/attributeTransformer/index.md +17 -0
  27. package/public/rjbuild/docs/core/attributeTransformer/index.yaml +24 -0
  28. package/public/rjbuild/docs/core/attributeTransformer/setAttributeValue.md +101 -0
  29. package/public/rjbuild/docs/core/attributeTransformer/setAttributeValue.yaml +144 -0
  30. package/public/rjbuild/docs/core/attributeTransformer/toggleAttributeValue.md +269 -0
  31. package/public/rjbuild/docs/core/attributeTransformer/toggleAttributeValue.yaml +247 -0
  32. package/public/rjbuild/docs/core/attributeTransformer/unsetAttribute.md +114 -0
  33. package/public/rjbuild/docs/core/attributeTransformer/unsetAttribute.yaml +138 -0
  34. package/public/rjbuild/docs/core/attributeTransformer/unsetAttributeValue.md +140 -0
  35. package/public/rjbuild/docs/core/attributeTransformer/unsetAttributeValue.yaml +187 -0
  36. package/public/rjbuild/docs/core/dataMapping/simpleMapping.yaml +14 -4
  37. package/public/rjbuild/docs/core/element/form/Input.md +307 -0
  38. package/public/rjbuild/docs/core/element/form/Input.yaml +572 -0
  39. package/public/rjbuild/docs/core/element/special/Count.yaml +99 -31
  40. package/public/rjbuild/docs/core/element/special/DataFilter.yaml +118 -38
  41. package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.yaml +154 -34
  42. package/public/rjbuild/docs/core/element/special/Switch.md +5 -5
  43. package/public/rjbuild/docs/core/element/special/Switch.yaml +9 -18
  44. package/public/rjbuild/docs/core/example/html.md +2 -2
  45. package/public/rjbuild/docs/core/example/html.yaml +2 -3
  46. package/public/rjbuild/docs/core/example/native-html-forms.md +245 -0
  47. package/public/rjbuild/docs/core/example/native-html-forms.yaml +393 -0
  48. package/public/rjbuild/docs/core/hook/index.md +38 -0
  49. package/public/rjbuild/docs/core/hook/index.yaml +44 -0
  50. package/public/rjbuild/docs/core/hook/usePagination.md +286 -0
  51. package/public/rjbuild/docs/core/hook/usePagination.yaml +319 -0
  52. package/public/rjbuild/docs/core/hook/useTransformedAttributes.md +130 -0
  53. package/public/rjbuild/docs/core/hook/useTransformedAttributes.yaml +164 -0
  54. package/public/rjbuild/docs/core/reaction/addData.md +17 -3
  55. package/public/rjbuild/docs/core/reaction/addData.yaml +53 -9
  56. package/public/rjbuild/docs/core/reaction/fetchData.yaml +44 -8
  57. package/public/rjbuild/docs/core/reaction/setData.md +18 -4
  58. package/public/rjbuild/docs/core/reaction/setData.yaml +18 -4
  59. package/public/rjbuild/docs/docs-components/Mermaid.md +254 -0
  60. package/public/rjbuild/docs/docs-components/Mermaid.yaml +339 -0
  61. package/public/rjbuild/docs/docs-components/index.yaml +1 -0
  62. package/public/rjbuild/docs/getting-started/actions.md +1 -1
  63. package/public/rjbuild/docs/index.yaml +2 -1
  64. package/public/rjbuild/docs/install.md +2 -5
  65. package/public/rjbuild/docs/install.yaml +4 -10
  66. package/public/rjbuild/docs/{core → integration/bootstrap}/action/Popover.md +1 -1
  67. package/public/rjbuild/docs/{core → integration/bootstrap}/action/Tooltip.md +1 -1
  68. package/public/rjbuild/docs/integration/bootstrap/element/html/AccordionItem.md +69 -0
  69. package/public/rjbuild/docs/integration/bootstrap/element/html/Modal.md +127 -0
  70. package/public/rjbuild/docs/integration/bootstrap/element/html/Tabs.md +150 -0
  71. package/public/rjbuild/docs/integration/bootstrap/element/html/index.md +13 -0
  72. package/public/rjbuild/docs/integration/bootstrap/element/special/index.md +19 -0
  73. package/public/rjbuild/docs/integration/bootstrap/example/website.md +41 -0
  74. package/public/rjbuild/docs/integration/bootstrap/overview.md +69 -0
  75. package/public/rjbuild/docs/integration/bootstrap/overview.yaml +87 -0
  76. /package/public/rjbuild/docs/{core → integration/bootstrap}/action/Popover.yaml +0 -0
  77. /package/public/rjbuild/docs/{core → integration/bootstrap}/action/Tooltip.yaml +0 -0
  78. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/CheckBoxField.md +0 -0
  79. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/CheckBoxField.yaml +0 -0
  80. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/DateField.md +0 -0
  81. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/DateField.yaml +0 -0
  82. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/NumberField.md +0 -0
  83. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/NumberField.yaml +0 -0
  84. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/SelectField.md +0 -0
  85. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/SelectField.yaml +0 -0
  86. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextAreaField.md +0 -0
  87. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextAreaField.yaml +0 -0
  88. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextField.md +0 -0
  89. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextField.yaml +0 -0
  90. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/formElementsCommon.md +0 -0
  91. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/index.md +0 -0
  92. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/index.yaml +0 -0
  93. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/AccordionItem.yaml +0 -0
  94. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/Modal.yaml +0 -0
  95. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/Tabs.yaml +0 -0
  96. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/special/BootstrapElement.md +0 -0
  97. /package/public/rjbuild/docs/{core → integration/bootstrap}/element/special/BootstrapElement.yaml +0 -0
  98. /package/public/rjbuild/docs/{core → integration/bootstrap}/example/accordion.md +0 -0
  99. /package/public/rjbuild/docs/{core → integration/bootstrap}/example/accordion.yaml +0 -0
  100. /package/public/rjbuild/docs/{core → integration/bootstrap}/example/dynamic-content.md +0 -0
  101. /package/public/rjbuild/docs/{core → integration/bootstrap}/example/dynamic-content.yaml +0 -0
  102. /package/public/rjbuild/docs/{core → integration/bootstrap}/example/website.yaml +0 -0
  103. /package/public/rjbuild/docs/{chartjs → integration/chartjs}/components.yaml +0 -0
  104. /package/public/rjbuild/docs/{chartjs → integration/chartjs}/overview.yaml +0 -0
@@ -148,7 +148,7 @@ renderView:
148
148
  type: div
149
149
  attributes:
150
150
  style:
151
- border: "1px solid #ccc"
151
+ border: "1px solid currentColor"
152
152
  borderRadius: 8px
153
153
  padding: 1rem
154
154
  content:
@@ -190,7 +190,7 @@ renderView:
190
190
  flex: "1 1 200px"
191
191
  margin: 0.5rem
192
192
  padding: 1rem
193
- backgroundColor: "#f0f0f0"
193
+ border: "1px solid currentColor"
194
194
  content: ~.text
195
195
  data:
196
196
  items:
@@ -214,21 +214,21 @@ renderView:
214
214
  display: grid
215
215
  gridTemplateColumns: ~.gridColumns
216
216
  gap: ~.spacing
217
- backgroundColor: ~.theme.backgroundColor
217
+ border: ~.theme.border
218
218
  templates:
219
219
  imageItem:
220
220
  type: div
221
221
  attributes:
222
222
  style:
223
223
  padding: 1rem
224
- border: "1px solid #ddd"
224
+ border: "1px solid currentColor"
225
225
  content: ~.title
226
226
  data:
227
227
  layoutClass: "photo-gallery"
228
228
  gridColumns: "repeat(3, 1fr)"
229
229
  spacing: "2rem"
230
230
  theme:
231
- backgroundColor: "#f5f5f5"
231
+ border: "1px solid currentColor"
232
232
  galleries:
233
233
  - title: "Photo 1"
234
234
  - title: "Photo 2"
@@ -227,7 +227,7 @@ renderView:
227
227
  gridTemplateColumns: "repeat(auto-fill, minmax(200px, 1fr))"
228
228
  gap: 1rem
229
229
  padding: 1rem
230
- backgroundColor: "#f8f9fa"
230
+ border: "1px solid currentColor"
231
231
  borderRadius: 8px
232
232
  before:
233
233
  type: h3
@@ -238,31 +238,28 @@ renderView:
238
238
  style:
239
239
  textAlign: center
240
240
  marginTop: 1rem
241
- color: "#666"
242
241
  content: "End of product list"
243
242
  templates:
244
243
  productCard:
245
244
  type: div
246
245
  attributes:
247
246
  style:
248
- border: "1px solid #ddd"
247
+ border: "1px solid currentColor"
249
248
  borderRadius: 8px
250
249
  padding: 1rem
251
- backgroundColor: white
252
250
  textAlign: center
253
251
  content:
254
252
  - type: h4
255
253
  attributes:
256
254
  style:
257
255
  margin: "0 0 0.5rem 0"
258
- color: "#333"
259
256
  content: ~.name
260
257
  - type: p
261
258
  attributes:
262
259
  style:
263
260
  margin: 0
264
- color: "#666"
265
261
  fontSize: "0.9rem"
262
+ opacity: 0.8
266
263
  content: ~.description
267
264
  data:
268
265
  products:
@@ -298,7 +295,7 @@ renderView:
298
295
  gap: 1rem
299
296
  justifyContent: center
300
297
  padding: 1rem
301
- border: "2px dashed #ccc"
298
+ border: "2px dashed currentColor"
302
299
  borderRadius: 8px
303
300
  after:
304
301
  type: PageControls
@@ -309,10 +306,9 @@ renderView:
309
306
  style:
310
307
  flex: "0 1 150px"
311
308
  padding: 1rem
312
- backgroundColor: "#e3f2fd"
309
+ border: "1px solid currentColor"
313
310
  borderRadius: 8px
314
311
  textAlign: center
315
- border: "1px solid #90caf9"
316
312
  content: ~.title
317
313
  data:
318
314
  cards:
@@ -343,15 +339,14 @@ renderView:
343
339
  gridTemplateColumns: ~.wrapperConfig.columns
344
340
  gap: ~.wrapperConfig.spacing
345
341
  padding: ~.wrapperConfig.padding
346
- backgroundColor: ~.theme.background
347
342
  border: ~.theme.border
348
343
  borderRadius: ~.theme.borderRadius
349
344
  before:
350
345
  type: h3
351
346
  attributes:
352
347
  style:
353
- color: ~.theme.titleColor
354
348
  textAlign: center
349
+ fontWeight: bold
355
350
  content: ~.title
356
351
  templates:
357
352
  dynamicCard:
@@ -359,10 +354,10 @@ renderView:
359
354
  attributes:
360
355
  style:
361
356
  padding: 1rem
362
- backgroundColor: ~.theme.cardBackground
357
+ border: ~.theme.cardBorder
363
358
  borderRadius: 6px
364
359
  textAlign: center
365
- color: ~.theme.textColor
360
+
366
361
  content: ~.name
367
362
  data:
368
363
  title: "Dynamic Gallery"
@@ -372,12 +367,8 @@ renderView:
372
367
  spacing: "1.5rem"
373
368
  padding: "2rem"
374
369
  theme:
375
- background: "#e8f4fd"
376
- border: "2px solid #2196f3"
370
+ border: "2px solid currentColor"
377
371
  borderRadius: "12px"
378
- titleColor: "#1976d2"
379
- cardBackground: "#ffffff"
380
- textColor: "#333333"
381
372
  items:
382
373
  - name: "Element A"
383
374
  - name: "Element B"
@@ -39,7 +39,7 @@ HTML attributes are supported through the `attributes` property. Each attribute
39
39
  > When using inline styles, you must use a specific structure:
40
40
  > - Use an object with CSS properties as keys
41
41
  > - Use camelCase for property names instead of hyphen-based CSS casing
42
- > - For example, use `backgroundColor` instead of `background-color`
42
+ > - For example, use `borderRadius` instead of `border-radius`
43
43
 
44
44
  ### Example with Attributes and Styles
45
45
  ```yaml
@@ -48,7 +48,7 @@ renderView:
48
48
  attributes:
49
49
  data-attr: Hello!
50
50
  style:
51
- backgroundColor: rgb(250,242,0)
51
+ border: "2px solid rgb(250,242,0)"
52
52
  padding: 0.5em
53
53
  content:
54
54
  - "This is a "
@@ -60,15 +60,14 @@ renderView:
60
60
  specify an object with the CSS property as the key, and CSS value as the value.
61
61
  Each key must be using **camelCase** instead of the usual hyphen-based CSS casing.
62
62
 
63
- In the following example, `backgroundColor` is used for the `background-color`
64
- CSS property.
63
+ In the following example, `border` is used to add visual styling.
65
64
  toDescribe:
66
65
  renderView:
67
66
  - type: div
68
67
  attributes:
69
68
  data-attr: Hello!
70
69
  style:
71
- backgroundColor: rgb(250,242,0)
70
+ border: "2px solid rgb(250,242,0)"
72
71
  padding: 0.5em
73
72
  content:
74
73
  - "This is a "
@@ -0,0 +1,245 @@
1
+ # Native HTML Forms
2
+
3
+ This guide explains how to use native HTML form elements (`input`, `select`, `textarea`) with Reactive-JSON's reaction system to create interactive forms with proper data synchronization.
4
+
5
+ ## Core Concept: Reactions for Data Synchronization
6
+
7
+ Native HTML elements require explicit **reactions** to synchronize user input with your data. This is done using the `setData` reaction triggered by user events.
8
+
9
+ ### Basic Structure
10
+
11
+ ```yaml
12
+ - type: input
13
+ attributes:
14
+ type: "text"
15
+ value: ~.fieldName # Display current data value
16
+ actions:
17
+ - what: setData # Reaction to update data
18
+ on: input # Event that triggers the reaction
19
+ path: ~.fieldName # Data path to update
20
+ value: "<reactive-json:event-new-value>" # Value from the event
21
+ ```
22
+
23
+ ## Event Value Patterns
24
+
25
+ ### Forward Update Pattern (Recommended)
26
+
27
+ Use `<reactive-json:event-new-value>` for automatic value detection:
28
+
29
+ - **Auto-detects the correct property**: `event.target.value` for inputs, `event.target.checked` for checkboxes
30
+ - **Simplifies configuration**: No need to specify which property to access
31
+ - **Works for all form elements**: text, number, checkbox, select, textarea, etc.
32
+
33
+ ### Alternative Explicit Syntax
34
+
35
+ For specific control, you can explicitly access event properties:
36
+
37
+ - `<reactive-json:event>.target.value` - Direct access to input value
38
+ - `<reactive-json:event>.target.checked` - Direct access to checkbox state
39
+ - `<reactive-json:event>.target.selectedIndex` - Access to select index
40
+
41
+ ## Event Types for Different Use Cases
42
+
43
+ - **`on: input`** - Real-time updates as user types (immediate feedback)
44
+ - **`on: change`** - Updates when user commits the change (varies by element type):
45
+ - Text inputs: when value changes AND field loses focus
46
+ - Checkboxes/Radio: immediately when checked/unchecked
47
+ - Select: immediately when option is selected
48
+ - **`on: blur`** - Updates when user leaves the field (regardless of value change)
49
+ - **`on: focus`** - Triggered when user enters the field
50
+
51
+ ## Common Patterns
52
+
53
+ ### Label Association
54
+
55
+ Use the `for` attribute to associate labels with form elements for accessibility:
56
+
57
+ ```yaml
58
+ - type: label
59
+ attributes:
60
+ for: "username-field"
61
+ content: "Username:"
62
+ - type: input
63
+ attributes:
64
+ id: "username-field"
65
+ type: "text"
66
+ value: ~.username
67
+ actions:
68
+ - what: setData
69
+ on: input
70
+ path: ~.username
71
+ value: "<reactive-json:event-new-value>"
72
+ ```
73
+
74
+ **Note**: Reactive-JSON automatically converts the HTML `for` attribute to React's `htmlFor` property.
75
+
76
+ ### Text Input
77
+ ```yaml
78
+ - type: input
79
+ attributes:
80
+ type: "text"
81
+ value: ~.fieldName
82
+ actions:
83
+ - what: setData
84
+ on: input
85
+ path: ~.fieldName
86
+ value: "<reactive-json:event-new-value>"
87
+ ```
88
+
89
+ ### Checkbox
90
+ ```yaml
91
+ - type: input
92
+ attributes:
93
+ type: "checkbox"
94
+ checked: ~.isSelected
95
+ actions:
96
+ - what: setData
97
+ on: change
98
+ path: ~.isSelected
99
+ value: "<reactive-json:event-new-value>"
100
+ ```
101
+
102
+ ### Select Dropdown
103
+ ```yaml
104
+ - type: select
105
+ attributes:
106
+ value: ~.selectedOption
107
+ content:
108
+ - type: option
109
+ attributes:
110
+ value: "option1"
111
+ content: "Option 1"
112
+ actions:
113
+ - what: setData
114
+ on: change
115
+ path: ~.selectedOption
116
+ value: "<reactive-json:event-new-value>"
117
+ ```
118
+
119
+ ### Textarea
120
+ ```yaml
121
+ - type: textarea
122
+ attributes:
123
+ value: ~.description
124
+ placeholder: "Enter description..."
125
+ rows: 4
126
+ actions:
127
+ - what: setData
128
+ on: input
129
+ path: ~.description
130
+ value: "<reactive-json:event-new-value>"
131
+ ```
132
+
133
+ ### Number Input
134
+ ```yaml
135
+ - type: input
136
+ attributes:
137
+ type: "number"
138
+ value: ~.quantity
139
+ min: 0
140
+ max: 100
141
+ actions:
142
+ - what: setData
143
+ on: input
144
+ path: ~.quantity
145
+ value: "<reactive-json:event-new-value>"
146
+ ```
147
+
148
+ ### Radio Buttons
149
+ ```yaml
150
+ - type: input
151
+ attributes:
152
+ type: "radio"
153
+ name: "size"
154
+ value: "small"
155
+ checked: ~.selectedSize
156
+ actions:
157
+ - what: setData
158
+ on: change
159
+ path: ~.selectedSize
160
+ value: "small"
161
+
162
+ - type: input
163
+ attributes:
164
+ type: "radio"
165
+ name: "size"
166
+ value: "large"
167
+ checked: ~.selectedSize
168
+ actions:
169
+ - what: setData
170
+ on: change
171
+ path: ~.selectedSize
172
+ value: "large"
173
+ ```
174
+
175
+ ## Advanced Patterns
176
+
177
+ ### Form Validation with Conditional Actions
178
+ ```yaml
179
+ - type: input
180
+ attributes:
181
+ type: "email"
182
+ value: ~.email
183
+ actions:
184
+ - what: setData
185
+ on: input
186
+ path: ~.email
187
+ value: "<reactive-json:event-new-value>"
188
+ - what: setData
189
+ on: blur
190
+ path: ~.emailValid
191
+ value: "<reactive-json:event>.target.validity.valid"
192
+ ```
193
+
194
+ ### Multiple Field Updates
195
+ ```yaml
196
+ - type: input
197
+ attributes:
198
+ type: "text"
199
+ value: ~.firstName
200
+ actions:
201
+ - what: setData
202
+ on: input
203
+ path: ~.firstName
204
+ value: "<reactive-json:event-new-value>"
205
+ - what: setData
206
+ on: input
207
+ path: ~.fullName
208
+ value: ["<reactive-json:event-new-value>", " ", ~.lastName]
209
+ ```
210
+
211
+ ## Simplification Alternatives
212
+
213
+ For simpler configuration and built-in styling, consider using pre-built form components:
214
+
215
+ - **Reactive-JSON Bootstrap**: `TextField`, `SelectField`, `CheckBoxField`, etc. with automatic data synchronization
216
+ - **Custom component libraries**: Create your own reusable form components with embedded reactions
217
+
218
+ Example with Bootstrap components:
219
+ ```yaml
220
+ # Simpler alternative using reactive-json-bootstrap
221
+ - type: TextField
222
+ label: "Username:"
223
+ dataLocation: ~.username # Automatic synchronization
224
+
225
+ # Equivalent native implementation
226
+ - type: label
227
+ content: "Username:"
228
+ - type: input
229
+ attributes:
230
+ type: "text"
231
+ value: ~.username
232
+ actions:
233
+ - what: setData
234
+ on: input
235
+ path: ~.username
236
+ value: "<reactive-json:event-new-value>"
237
+ ```
238
+
239
+ ## Best Practices
240
+
241
+ 1. **Always include `setData` reactions** for interactive elements
242
+ 2. **Choose appropriate events**: `input` for real-time updates, `change` for committed changes
243
+ 3. **Use `<reactive-json:event-new-value>`** for automatic value detection
244
+ 4. **Consider pre-built components** for complex forms to reduce configuration
245
+ 5. **Test data flow** to ensure changes are properly synchronized