@ea-lab/reactive-json-docs 0.3.0 → 0.4.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 (27) 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 +9 -0
  7. package/public/rjbuild/docs/advanced-concepts/index.yaml +15 -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}/plugin-system.md +2 -0
  10. package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/plugin-system.yaml +2 -0
  11. package/public/rjbuild/docs/core/dataMapping/index.md +31 -0
  12. package/public/rjbuild/docs/core/dataMapping/index.yaml +24 -0
  13. package/public/rjbuild/docs/core/dataMapping/simpleMapping.md +131 -0
  14. package/public/rjbuild/docs/core/dataMapping/simpleMapping.yaml +376 -0
  15. package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.md +4 -3
  16. package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.yaml +114 -6
  17. package/public/rjbuild/docs/{getting-started.md → getting-started/index.md} +2 -2
  18. package/public/rjbuild/docs/{getting-started.yaml → getting-started/index.yaml} +4 -2
  19. package/public/rjbuild/docs/getting-started/rjbuild-structure.md +352 -0
  20. package/public/rjbuild/docs/getting-started/rjbuild-structure.yaml +415 -0
  21. package/public/rjbuild/docs/install.yaml +682 -681
  22. /package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/component-development.md +0 -0
  23. /package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/component-development.yaml +0 -0
  24. /package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/index.md +0 -0
  25. /package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/index.yaml +0 -0
  26. /package/public/rjbuild/docs/{template.md → getting-started/template.md} +0 -0
  27. /package/public/rjbuild/docs/{template.yaml → getting-started/template.yaml} +0 -0
@@ -0,0 +1,376 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # SimpleMapping Data Mapper
5
+
6
+ SimpleMapping is the core data mapping processor in Reactive-JSON that enables selective dispatch and transformation of HTTP response data to specific locations in your application state.
7
+
8
+ ## Properties
9
+
10
+ ### stringMap Configuration
11
+
12
+ - type: DefinitionList
13
+ content:
14
+ - term:
15
+ code: value
16
+ after: " (required)"
17
+ details:
18
+ type: Markdown
19
+ content: |
20
+ Source path in the HTTP response (e.g., `user.firstName`)
21
+ - term:
22
+ code: required
23
+ after: " (optional, default: true)"
24
+ details:
25
+ type: Markdown
26
+ content: |
27
+ Whether the source value must exist
28
+ - term:
29
+ code: defaultValue
30
+ after: " (optional)"
31
+ details:
32
+ type: Markdown
33
+ content: |
34
+ Fallback value when source is missing and not required
35
+ - term:
36
+ code: updateMode
37
+ after: " (optional, default: \"replace\")"
38
+ details:
39
+ type: Markdown
40
+ content: |
41
+ How to apply the value (`"replace"`, `"add"`, `"move"`, `"remove"`)
42
+
43
+ - type: Markdown
44
+ content: |
45
+ ### onErrorMap Configuration
46
+
47
+ The `onErrorMap` works like `stringMap`, but provides fallback values when main mappings fail.
48
+
49
+ Same key-value structure as `stringMap` (destination → configuration)
50
+ Applied only when corresponding `stringMap` entries fail and are marked as `required: true`.
51
+
52
+ - type: DefinitionList
53
+ content:
54
+ - term:
55
+ code: value
56
+ after: " (required)"
57
+ details:
58
+ type: Markdown
59
+ content: |
60
+ Can be either static values (e.g., `Error occurred`) or template references (e.g., `~~.errorTimestamp`)
61
+
62
+ - type: Markdown
63
+ content: |
64
+ ## Basic Syntax
65
+
66
+ - type: TabbedSerializer
67
+ yamlSerializedContent: |
68
+ dataMapping:
69
+ simpleMapping:
70
+ stringMap:
71
+ "~~.app.data.path":
72
+ value: "response.data.path"
73
+ required: true
74
+ defaultValue: "fallback"
75
+ updateMode: "replace"
76
+ onErrorMap:
77
+ "~~.error.path":
78
+ value: "Error message or ~~.template.reference"
79
+
80
+ - type: Markdown
81
+ content: |
82
+ ## Live Example
83
+
84
+ - type: RjBuildDescriber
85
+ title: "Basic Data Mapping Example"
86
+ description:
87
+ - type: Markdown
88
+ content: |
89
+ This example demonstrates how to map API response fields to specific locations in your application state using the simpleMapping processor.
90
+ toDescribe:
91
+ renderView:
92
+ - type: div
93
+ attributes:
94
+ class: "mb-4"
95
+ content:
96
+ - type: Markdown
97
+ content: "**Simulated API Response:**"
98
+ - type: TabbedSerializer
99
+ yamlSerializedContent: |
100
+ user:
101
+ firstName: "John"
102
+ lastName: "Doe"
103
+ email: "john@example.com"
104
+ preferences:
105
+ theme: "dark"
106
+ language: "en"
107
+ notifications: true
108
+ profile:
109
+ avatar: "/images/john-avatar.png"
110
+ bio: "Software developer passionate about React and data processing"
111
+ metadata:
112
+ requestId: "req_12345"
113
+ timestamp: "2024-01-15T10:30:00Z"
114
+ version: "v1.2.3"
115
+ status: "success"
116
+
117
+ - type: BsButton
118
+ content: "Simulate API Call with Data Mapping"
119
+ attributes:
120
+ class: "btn btn-primary mb-3"
121
+ actions:
122
+ - what: fetchData
123
+ on: click
124
+ url: "/mockup-api/fetchData/data-mapping-example.json"
125
+ updateOnlyData: true
126
+ dataMapping:
127
+ simpleMapping:
128
+ stringMap:
129
+ "~~.profile.displayName":
130
+ value: "user.firstName"
131
+ "~~.profile.email":
132
+ value: "user.email"
133
+ "~~.settings.theme":
134
+ value: "user.preferences.theme"
135
+ required: false
136
+ defaultValue: "light"
137
+ "~~.settings.language":
138
+ value: "user.preferences.language"
139
+ required: false
140
+ defaultValue: "en"
141
+ "~~.profile.fullName":
142
+ value: "user.fullName"
143
+ required: false
144
+ defaultValue: "Anonymous User"
145
+
146
+ - type: Markdown
147
+ content: |
148
+ **Current Application State (after mapping):**
149
+
150
+ - type: div
151
+ attributes:
152
+ class: "card mb-3"
153
+ content:
154
+ - type: div
155
+ attributes:
156
+ class: "card-header"
157
+ content: "Profile Data"
158
+ - type: div
159
+ attributes:
160
+ class: "card-body"
161
+ content:
162
+ - type: p
163
+ content:
164
+ - "Display Name: "
165
+ - type: strong
166
+ content: ~~.profile.displayName
167
+ - type: p
168
+ content:
169
+ - "Email: "
170
+ - type: strong
171
+ content: ~~.profile.email
172
+ - type: p
173
+ content:
174
+ - "Full Name: "
175
+ - type: strong
176
+ content: ~~.profile.fullName
177
+
178
+ - type: div
179
+ attributes:
180
+ class: "card"
181
+ content:
182
+ - type: div
183
+ attributes:
184
+ class: "card-header"
185
+ content: "Settings Data"
186
+ - type: div
187
+ attributes:
188
+ class: "card-body"
189
+ content:
190
+ - type: p
191
+ content:
192
+ - "Theme: "
193
+ - type: span
194
+ attributes:
195
+ class: "badge bg-primary"
196
+ content: ~~.settings.theme
197
+ - type: p
198
+ content:
199
+ - "Language: "
200
+ - type: span
201
+ attributes:
202
+ class: "badge bg-secondary"
203
+ content: ~~.settings.language
204
+
205
+ data:
206
+ profile: {}
207
+ settings: {}
208
+
209
+ - type: RjBuildDescriber
210
+ title: "Error Handling with onErrorMap"
211
+ description:
212
+ - type: Markdown
213
+ content: |
214
+ This example shows how to provide fallback values when required data fields are missing from the API response, demonstrating graceful error handling.
215
+ toDescribe:
216
+ renderView:
217
+ - type: div
218
+ attributes:
219
+ class: "mb-3"
220
+ content:
221
+ - type: Markdown
222
+ content: |
223
+ **API Response (missing user data):**
224
+ ```json
225
+ {
226
+ "status": "ok",
227
+ "timestamp": "2024-06-01T12:00:00Z"
228
+ }
229
+ ```
230
+
231
+ The mapping below tries to extract `user.name` and `user.email` which don't exist in this response, triggering the `onErrorMap` fallback values.
232
+
233
+ - type: BsButton
234
+ content: "Test Missing Data Handling"
235
+ attributes:
236
+ class: "btn btn-warning mb-3"
237
+ actions:
238
+ - what: fetchData
239
+ on: click
240
+ url: "/mockup-api/fetchData/status.json"
241
+ updateOnlyData: true
242
+ dataMapping:
243
+ simpleMapping:
244
+ stringMap:
245
+ "~~.profile.name":
246
+ value: "user.name"
247
+ required: true
248
+ "~~.profile.email":
249
+ value: "user.email"
250
+ required: true
251
+ "~~.profile.department":
252
+ value: "user.department"
253
+ required: false
254
+ defaultValue: "No department"
255
+ onErrorMap:
256
+ "~~.profile.status":
257
+ value: "Error loading profile"
258
+ "~~.profile.name":
259
+ value: "Unknown User"
260
+ "~~.profile.email":
261
+ value: "unknown@example.com"
262
+ "~~.profile.loadedAt":
263
+ value: "~~.currentTimestamp"
264
+
265
+ - type: Markdown
266
+ content: |
267
+ **Profile State (after error handling):**
268
+
269
+ - type: div
270
+ attributes:
271
+ class: "card"
272
+ content:
273
+ - type: div
274
+ attributes:
275
+ class: "card-header"
276
+ content: "Profile Data"
277
+ - type: div
278
+ attributes:
279
+ class: "card-body"
280
+ content:
281
+ - type: p
282
+ content:
283
+ - "Status: "
284
+ - type: span
285
+ attributes:
286
+ class: "badge bg-warning"
287
+ content: ~~.profile.status
288
+ - type: p
289
+ content:
290
+ - "Name: "
291
+ - type: strong
292
+ content: ~~.profile.name
293
+ - type: p
294
+ content:
295
+ - "Email: "
296
+ - type: strong
297
+ content: ~~.profile.email
298
+ - type: p
299
+ content:
300
+ - "Loaded At: "
301
+ - type: em
302
+ content: ~~.profile.loadedAt
303
+
304
+ data:
305
+ profile: {}
306
+ currentTimestamp: "2024-01-15T10:30:00Z"
307
+
308
+ - type: Markdown
309
+ content: |
310
+ ## Advanced Configuration Examples
311
+
312
+ ### Complex Data Structure Mapping
313
+
314
+ - type: TabbedSerializer
315
+ yamlSerializedContent: |
316
+ dataMapping:
317
+ simpleMapping:
318
+ stringMap:
319
+ "~~.currentOrder.id":
320
+ value: "order.id"
321
+ "~~.currentOrder.customerName":
322
+ value: "order.customer.name"
323
+ "~~.currentOrder.customerEmail":
324
+ value: "order.customer.contact.email"
325
+ "~~.currentOrder.total":
326
+ value: "order.billing.total"
327
+ "~~.currentOrder.currency":
328
+ value: "order.billing.currency"
329
+ required: false
330
+ defaultValue: "USD"
331
+
332
+ - type: Markdown
333
+ content: |
334
+ ### Integration with additionalDataSources
335
+
336
+ - type: TabbedSerializer
337
+ yamlSerializedContent: |
338
+ additionalDataSource:
339
+ - src: "/api/user-profile"
340
+ blocking: true
341
+ dataMapping:
342
+ simpleMapping:
343
+ stringMap:
344
+ "~~.profile.displayName": { value: "user.name" }
345
+ "~~.profile.email": { value: "user.email" }
346
+ "~~.settings.theme":
347
+ value: "user.preferences.theme"
348
+ required: false
349
+ defaultValue: "light"
350
+
351
+ - type: Markdown
352
+ content: |
353
+ ### Integration with Template Context
354
+
355
+ - type: TabbedSerializer
356
+ yamlSerializedContent: |
357
+ dataMapping:
358
+ simpleMapping:
359
+ stringMap:
360
+ "~~.pagination.currentPage":
361
+ value: "meta.page"
362
+ required: false
363
+ defaultValue: "~~.pagination.page" # Use current page as default
364
+
365
+ - type: Markdown
366
+ content: |
367
+ ## About the Data Mapping System
368
+
369
+ For information about the broader Data Mapping system and how to create custom mappers, see the **[Data Mapping Overview](../../advanced-concepts/data-mapping)**.
370
+
371
+ templates:
372
+
373
+ data:
374
+ profile: {}
375
+ settings: {}
376
+ currentTimestamp: "2024-01-15T10:30:00Z"
@@ -18,9 +18,10 @@ With the `sharedUpdates` feature, the component can also propagate data changes
18
18
  - `data`: Initial data.
19
19
  - `debugMode`: Enable debug mode and related wrapper components.
20
20
  - `sharedUpdates` (boolean, optional): Enable upstream data propagation to parent (default: false).
21
- - `dataOverrideEvaluationDepth` (number, optional): Special evaluation depth for dataOverride property.
22
- - `actions` (array, optional): Action components to apply (passed to `ActionDependant` wrapper).
23
- - Other standard component properties (e.g., `attributes`) are passed to the `ActionDependant` wrapper.
21
+ - `dataOverrideEvaluationDepth` (number, optional): Special evaluation depth for dataOverride property (default: 10).
22
+
23
+ ### Standard properties
24
+ - `actions` (array, optional): Actions to attach to the subroot.
24
25
 
25
26
  ## Behavior
26
27
  - Renders a new `ReactiveJsonRoot` with the provided options.
@@ -8,13 +8,121 @@ renderView:
8
8
  With the `sharedUpdates` feature, the component can also propagate data changes back to the parent, enabling seamless communication between parent and subroot when working with shared data references.
9
9
 
10
10
  ## Properties
11
- - `rjOptions` (object, required): Options to pass to the subroot - accepts **all** `ReactiveJsonRoot` properties.
12
- - Direct properties: `rjBuildUrl`, `dataOverride`, `headersForRjBuild`, `debugMode`, etc.
13
- - For inline content: use `maybeRawAppRjBuild` containing `renderView`, `templates`, `data`.
14
- - `sharedUpdates` (boolean, optional): Enable upstream data propagation to parent (default: false).
15
- - `dataOverrideEvaluationDepth` (number, optional): Special evaluation depth for dataOverride property.
16
- - Other properties are passed to the underlying `ActionDependant` wrapper.
17
11
 
12
+ - type: TabbedSerializer
13
+ yamlSerializedContent: |
14
+ # Complete rjOptions structure.
15
+ - type: ReactiveJsonSubroot
16
+ # Component-specific properties.
17
+ sharedUpdates: true
18
+ dataOverrideEvaluationDepth: 10
19
+
20
+ # Subroot configuration.
21
+ rjOptions:
22
+ # Loading from URL.
23
+ rjBuildUrl: "/path/to/rjbuild.yaml"
24
+ rjBuildFetchMethod: "GET" # or "POST".
25
+ headersForRjBuild:
26
+ Authorization: "Bearer token"
27
+ Content-Type: "application/json"
28
+
29
+ # OR inline definition.
30
+ maybeRawAppRjBuild:
31
+ renderView:
32
+ - type: div
33
+ content: "Subroot content."
34
+ templates:
35
+ myTemplate:
36
+ type: span
37
+ content: ~.value
38
+ data:
39
+ initialValue: "Hello World"
40
+
41
+ # Data replacement.
42
+ dataOverride: ~~.userData
43
+
44
+ # Debug mode.
45
+ debugMode: true
46
+
47
+ # Standard actions.
48
+ actions:
49
+ - what: hide
50
+ when: ~.condition
51
+
52
+ - type: DefinitionList
53
+ content:
54
+ - term:
55
+ code: rjOptions
56
+ after: " (object, required)"
57
+ details:
58
+ - type: Markdown
59
+ content: "Options to pass to the subroot - accepts **all** `ReactiveJsonRoot` properties including:"
60
+
61
+ - type: DefinitionList
62
+ content:
63
+ - term:
64
+ code: rjOptions.rjBuildUrl
65
+ details: "URL to load the RjBuild from."
66
+
67
+ - term:
68
+ code: rjOptions.rjBuildFetchMethod
69
+ details: "HTTP method (\"GET\" or \"POST\")."
70
+
71
+ - term:
72
+ code: rjOptions.headersForRjBuild
73
+ details: "Headers for the request."
74
+
75
+ - term:
76
+ code: rjOptions.dataOverride
77
+ details: "Override data for the loaded/defined RjBuild."
78
+
79
+ - term:
80
+ code: rjOptions.maybeRawAppRjBuild
81
+ details:
82
+ - type: Markdown
83
+ content: "Inline RjBuild content (string or object) containing:"
84
+
85
+ - type: DefinitionList
86
+ content:
87
+ - term:
88
+ code: rjOptions.maybeRawAppRjBuild.renderView
89
+ details: "View definition."
90
+
91
+ - term:
92
+ code: rjOptions.maybeRawAppRjBuild.templates
93
+ details: "Template definitions."
94
+
95
+ - term:
96
+ code: rjOptions.maybeRawAppRjBuild.data
97
+ details: "Initial data."
98
+
99
+ - term:
100
+ code: rjOptions.debugMode
101
+ details: "Enable debug mode and related wrapper components."
102
+
103
+ - term:
104
+ code: sharedUpdates
105
+ after: " (boolean, optional)"
106
+ details: "Enable upstream data propagation to parent (default: false)."
107
+
108
+ - term:
109
+ code: dataOverrideEvaluationDepth
110
+ after: " (number, optional)"
111
+ details: "Special evaluation depth for dataOverride property (default: 10)."
112
+
113
+ - type: Markdown
114
+ content: |
115
+ ### Standard properties
116
+
117
+ - type: DefinitionList
118
+ content:
119
+ - term:
120
+ code: actions
121
+ after: " (array, optional)"
122
+ details: "Actions to attach to the subroot."
123
+
124
+ - type: Markdown
125
+ content: |
18
126
  ## Behavior
19
127
  - Renders a new `ReactiveJsonRoot` with the provided options.
20
128
  - The subroot is typically isolated from the parent for data, templates, and rendering¹.
@@ -53,7 +53,7 @@ data:
53
53
  isAdmin: true
54
54
  ```
55
55
 
56
- > 💡 **Advanced navigation:** For complex hierarchical data access, see the [Template System documentation](/docs/template) which covers `~>key` and `~~>key` notations.
56
+ > 💡 **Advanced navigation:** For complex hierarchical data access, see the [Template System documentation](/docs/getting-started/template) which covers `~>key` and `~~>key` notations.
57
57
 
58
58
  ### Basic Elements
59
59
 
@@ -156,4 +156,4 @@ data:
156
156
  2. Check out the [elements documentation](/docs/core/element) to discover all available components
157
157
  3. Learn how to use the [action system](/docs/core/action) to create interactive interfaces
158
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
159
+ 5. If needed, learn how to [extend Reactive-JSON](/docs/advanced-concepts/plugins) with your own components
@@ -3,6 +3,8 @@ renderView:
3
3
  content: |
4
4
  # Reactive-JSON Getting Started Guide
5
5
 
6
+ > Dev note: This page needs to be rewritten.
7
+
6
8
  ## Introduction
7
9
 
8
10
  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 +41,7 @@ renderView:
39
41
  - `~.` : Local context (relative to current template)
40
42
  - `~~.` : Global context (access to global data)
41
43
 
42
- > 💡 **Advanced navigation:** For complex hierarchical data access, see the [Template System documentation](/docs/template) which covers `~>key` and `~~>key` notations.
44
+ > 💡 **Advanced navigation:** For complex hierarchical data access, see the [Template System documentation](/docs/getting-started/template) which covers `~>key` and `~~>key` notations.
43
45
 
44
46
  - type: RjBuildDescriber
45
47
  title: "Template System Example"
@@ -221,4 +223,4 @@ renderView:
221
223
  2. Check out the [elements documentation](/docs/core/element) to discover all available components
222
224
  3. Learn how to use the [action system](/docs/core/action) to create interactive interfaces
223
225
  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
226
+ 5. If needed, learn how to [extend Reactive-JSON](/docs/advanced-concepts/plugins) with your own components