@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,415 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # RjBuild File Structure
5
+
6
+ ## What is an RjBuild?
7
+
8
+ An **RjBuild** is the standard file format used by Reactive-JSON to build interactive web applications. It is a JSON or YAML structure that completely describes a user interface, its data, and behavior, without requiring traditional JavaScript code.
9
+
10
+ > By extension, we also call "RjBuild" any fragment of this structure, particularly a portion of `renderView` and `templates` that can be reused or included in other RjBuilds.
11
+
12
+ ### Supported Formats
13
+
14
+ An RjBuild can be written in two formats:
15
+
16
+ - **YAML** (recommended): More readable and easier to write for humans, ideal for creation and maintenance
17
+ - **JSON**: Standard supported format, useful for programmatic generation or integration with existing tools
18
+
19
+ **YAML is preferable** for most use cases as it offers better readability, allows comments, and is more tolerant of minor syntax errors.
20
+
21
+ ## Basic Structure of an RjBuild
22
+
23
+ Any RjBuild file can contain up to four main sections:
24
+
25
+ - `renderView`: User interface structure (required)
26
+ - `templates`: Reusable components (optional)
27
+ - `data`: Initial state and data (optional)
28
+ - `additionalDataSource`: External data sources (optional)
29
+
30
+ - type: TabbedSerializer
31
+ yamlSerializedContent: |
32
+ renderView: # User interface structure (required)
33
+ - type: div
34
+ content: "Hello World"
35
+
36
+ templates: # Reusable components (optional)
37
+ myComponent:
38
+ type: div
39
+ content: "Template content"
40
+
41
+ data: # Initial state and data (optional)
42
+ message: "Welcome!"
43
+ user:
44
+ name: "John"
45
+
46
+ additionalDataSource: # External data sources (optional)
47
+ - src: "/api/data.json"
48
+ path: ~~.dynamicData
49
+
50
+ - type: Markdown
51
+ content: |
52
+
53
+ ## Section `renderView` (Required)
54
+
55
+ The `renderView` section defines the **user interface** that will be displayed. It is the only required section of an RjBuild.
56
+
57
+ ### Role
58
+ - Determines the visual structure of the application
59
+ - Defines the components to display and their organization
60
+ - Specifies interactions and behaviors
61
+
62
+ ### Structure
63
+
64
+ - type: TabbedSerializer
65
+ yamlSerializedContent: |
66
+ renderView:
67
+ - type: ComponentName # Type of component to render
68
+ content: "Content" # Component content
69
+ attributes: # HTML attributes (optional)
70
+ class: "css-class"
71
+ actions: # Interactive actions (optional)
72
+ - what: hide
73
+ on: click
74
+
75
+ - type: Markdown
76
+ content: |
77
+
78
+ ### Examples
79
+
80
+ #### Simple interface
81
+
82
+ - type: TabbedSerializer
83
+ yamlSerializedContent: |
84
+ renderView:
85
+ - type: div
86
+ content:
87
+ - type: h1
88
+ content: "My Application"
89
+ - type: p
90
+ content: "Welcome!"
91
+
92
+ - type: Markdown
93
+ content: |
94
+
95
+ #### With dynamic data
96
+
97
+ - type: TabbedSerializer
98
+ yamlSerializedContent: |
99
+ renderView:
100
+ - type: div
101
+ content: ["Hello ", ~~.user.name, "!"]
102
+
103
+ data:
104
+ user:
105
+ name: "Marie"
106
+
107
+ - type: Markdown
108
+ content: |
109
+
110
+ ## Section `data` (Optional)
111
+
112
+ The `data` section contains the **initial state** of the application. This data can be read and modified by components.
113
+
114
+ ### Role
115
+ - Provides the initial state of the application
116
+ - Stores data modifiable by user interactions
117
+ - Enables data sharing between components
118
+
119
+ ### Structure
120
+
121
+ - type: TabbedSerializer
122
+ yamlSerializedContent: |
123
+ data:
124
+ # Simple data
125
+ title: "My Site"
126
+ isLoggedIn: false
127
+
128
+ # Objects
129
+ user:
130
+ name: "John"
131
+ email: "john@example.com"
132
+
133
+ # Arrays
134
+ items:
135
+ - name: "Item 1"
136
+ active: true
137
+ - name: "Item 2"
138
+ active: false
139
+
140
+ - type: Markdown
141
+ content: |
142
+ ### Data Access
143
+
144
+ To use data in a component, you can use the following syntax:
145
+
146
+ - **`~~.`**: Global access to data from anywhere in the RjBuild
147
+ - **`~.`**: Local access to data from the current context (template)
148
+
149
+ ### Usage Examples
150
+
151
+ #### Forms with state
152
+
153
+ - type: TabbedSerializer
154
+ yamlSerializedContent: |
155
+ renderView:
156
+ - type: TextField
157
+ label: "Name"
158
+ dataLocation: ~~.user.name
159
+ - type: div
160
+ content: ["Entered name: ", ~~.user.name]
161
+
162
+ data:
163
+ user:
164
+ name: "Initial value"
165
+
166
+ - type: Markdown
167
+ content: |
168
+
169
+ #### Conditional display
170
+
171
+ - type: TabbedSerializer
172
+ yamlSerializedContent: |
173
+ renderView:
174
+ - type: div
175
+ content: "User is logged in!"
176
+ actions:
177
+ - what: hide
178
+ when: ~~.isLoggedIn
179
+ is: false
180
+
181
+ data:
182
+ isLoggedIn: true
183
+
184
+ - type: Markdown
185
+ content: |
186
+ > You can get more information about data access in the [template system documentation](/docs/getting-started/template).
187
+
188
+ ## Section `templates` (Optional)
189
+
190
+ The `templates` section defines **reusable components** that can be used in `renderView` or other templates.
191
+
192
+ ### Role
193
+ - Avoids code duplication
194
+ - Enables reuse of complex structures
195
+ - Facilitates maintenance and modifications
196
+
197
+ ### Structure
198
+
199
+ - type: TabbedSerializer
200
+ yamlSerializedContent: |
201
+ templates:
202
+ templateName: # Template name
203
+ type: ComponentName # Template structure
204
+ content: "Content"
205
+
206
+ multipleComponents: # Template with multiple components
207
+ - type: div
208
+ content: "Component 1"
209
+ - type: p
210
+ content: "Component 2"
211
+
212
+ - type: Markdown
213
+ content: |
214
+
215
+ ### Using templates
216
+
217
+ - type: TabbedSerializer
218
+ yamlSerializedContent: |
219
+ renderView:
220
+ - load: templateName # Loads and displays the template
221
+
222
+ templates:
223
+ templateName:
224
+ type: div
225
+ content: "I am a reusable template!"
226
+
227
+ - type: Markdown
228
+ content: |
229
+
230
+ ### Data Context
231
+ Templates create their own **data context** when used with components like `Switch`:
232
+
233
+ - type: TabbedSerializer
234
+ yamlSerializedContent: |
235
+ renderView:
236
+ - type: Switch
237
+ content: ~~.users # Iterates over each user
238
+ singleOption:
239
+ load: userCard # Each user uses the template
240
+
241
+ templates:
242
+ userCard:
243
+ type: div
244
+ content:
245
+ - "Name: "
246
+ - ~.name # Local access to current user's name
247
+ - " (Admin: "
248
+ - ~~.isAdmin # Global access to settings
249
+
250
+ data:
251
+ isAdmin: true
252
+ users:
253
+ - name: "Alice"
254
+ - name: "Bob"
255
+
256
+ - type: Markdown
257
+ content: |
258
+
259
+ ## Section `additionalDataSource` (Optional)
260
+
261
+ The `additionalDataSource` section allows **loading data from external sources** during application initialization.
262
+
263
+ ### Role
264
+ - Integrates dynamic data from APIs
265
+ - Enables asynchronous data loading
266
+ - Separates static data from dynamic data
267
+
268
+ ### Structure
269
+
270
+ - type: TabbedSerializer
271
+ yamlSerializedContent: |
272
+ additionalDataSource:
273
+ - src: "/api/endpoint" # Source URL (required)
274
+ path: ~~.targetPath # Where to place the data (optional)
275
+ method: GET # HTTP method (optional, default: GET)
276
+ blocking: true # Block rendering (optional, default: false)
277
+
278
+ - type: Markdown
279
+ content: |
280
+
281
+ ### Properties
282
+ - **`src`** (required): URL of the data source
283
+ - **`path`** (optional): Path where to place the data (template syntax)
284
+ - **`method`** (optional): HTTP method (GET, POST, etc.)
285
+ - **`dataMapping`** (optional): Configure selective data dispatch using mapping processors
286
+ - **`blocking`** (optional): If `true`, waits for loading before displaying
287
+
288
+ ### Loading Modes
289
+
290
+ #### Blocking loading
291
+
292
+ - type: TabbedSerializer
293
+ yamlSerializedContent: |
294
+ additionalDataSource:
295
+ - src: "/api/user-profile.json"
296
+ path: ~~.currentUser
297
+ blocking: true # Page waits for loading
298
+
299
+ - type: Markdown
300
+ content: |
301
+
302
+ #### Non-blocking loading
303
+
304
+ - type: TabbedSerializer
305
+ yamlSerializedContent: |
306
+ additionalDataSource:
307
+ - src: "/api/notifications.json"
308
+ path: ~~.notifications
309
+ blocking: false # Page displays immediately
310
+
311
+ - type: Markdown
312
+ content: |
313
+
314
+ ### Data Placement
315
+
316
+ #### With specific path
317
+
318
+ - type: TabbedSerializer
319
+ yamlSerializedContent: |
320
+ additionalDataSource:
321
+ - src: "/api/user.json"
322
+ path: ~~.currentUser
323
+
324
+ # Data will be placed in data.currentUser
325
+
326
+ - type: Markdown
327
+ content: |
328
+
329
+ #### Root-level merge
330
+
331
+ - type: TabbedSerializer
332
+ yamlSerializedContent: |
333
+ additionalDataSource:
334
+ - src: "/api/config.json"
335
+ # No path = direct merge into data
336
+
337
+ - type: Markdown
338
+ content: |
339
+
340
+ ### Data Mapping Integration
341
+
342
+ Data Mapping can be used with `additionalDataSource` to selectively dispatch response data to specific locations:
343
+
344
+ - type: TabbedSerializer
345
+ yamlSerializedContent: |
346
+ additionalDataSource:
347
+ - src: "/api/user-profile"
348
+ blocking: true
349
+ dataMapping:
350
+ simpleMapping:
351
+ stringMap:
352
+ "profile.displayName": { value: "user.name" }
353
+ "profile.email": { value: "user.email" }
354
+ "settings.theme":
355
+ value: "user.preferences.theme"
356
+ required: false
357
+ defaultValue: "light"
358
+
359
+ - type: Markdown
360
+ content: |
361
+
362
+ **Note**: When `dataMapping` is configured, it takes priority over the `path` property. For more details, see [Data Mapping Documentation](../advanced-concepts/data-mapping).
363
+
364
+ ### Complete Example
365
+
366
+ - type: TabbedSerializer
367
+ yamlSerializedContent: |
368
+ renderView:
369
+ - type: div
370
+ content:
371
+ - type: h1
372
+ content: ["Hello ", ~~.currentUser.name]
373
+ - type: p
374
+ content: ["Version: ", ~~.systemConfig.version]
375
+
376
+ data:
377
+ currentUser:
378
+ name: "Loading..." # Temporary value
379
+ systemConfig:
380
+ version: "Loading..."
381
+
382
+ additionalDataSource:
383
+ # Critical user data (blocking)
384
+ - src: "/api/user-profile.json"
385
+ path: ~~.currentUser
386
+ blocking: true
387
+
388
+ # System configuration (non-blocking)
389
+ - src: "/api/system-config.json"
390
+ path: ~~.systemConfig
391
+ blocking: false
392
+
393
+ - type: Markdown
394
+ content: |
395
+
396
+ ## Best Practices
397
+
398
+ ### Organization
399
+ 1. **Logical structure**: Organize your data by functional domain
400
+ 2. **Reusable templates**: Create templates to avoid duplication
401
+ 3. **Default values**: Provide temporary values for external data
402
+
403
+ ### Performance
404
+ 1. **Smart loading**: Use `blocking: true` only for critical data
405
+ 2. **Minimal data**: Load only necessary data
406
+ 3. **Optimized templates**: Avoid overly complex templates
407
+
408
+ ### Maintainability
409
+ 1. **Consistent naming**: Use clear conventions for templates and data
410
+ 2. **Documentation**: Comment complex sections
411
+ 3. **Validation**: Verify the structure of your external data
412
+
413
+ templates:
414
+
415
+ data: