@ea-lab/reactive-json-docs 0.7.0 → 1.0.0-alpha.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.
- package/package.json +7 -5
- package/public/rjbuild/docs/advanced-concepts/data-processors.md +2 -2
- package/public/rjbuild/docs/advanced-concepts/plugins/component-development-guide-llm.md +14 -14
- package/public/rjbuild/docs/advanced-concepts/plugins/plugin-system.md +47 -1
- package/public/rjbuild/docs/advanced-concepts/plugins/plugin-system.yaml +53 -1
- package/public/rjbuild/docs/core/action/HashChangeListener.md +1 -1
- package/public/rjbuild/docs/core/action/HashChangeListener.yaml +24 -6
- package/public/rjbuild/docs/core/action/Hide.md +2 -2
- package/public/rjbuild/docs/core/action/Hide.yaml +4 -3
- package/public/rjbuild/docs/core/action/MessageListener.md +4 -4
- package/public/rjbuild/docs/core/action/MessageListener.yaml +18 -6
- package/public/rjbuild/docs/core/action/ReactOnEvent.md +4 -4
- package/public/rjbuild/docs/core/action/ReactOnEvent.yaml +4 -4
- package/public/rjbuild/docs/core/action/Redirect.md +2 -2
- package/public/rjbuild/docs/core/action/Redirect.yaml +8 -2
- package/public/rjbuild/docs/core/action/VisuallyHide.md +2 -2
- package/public/rjbuild/docs/core/action/VisuallyHide.yaml +2 -2
- package/public/rjbuild/docs/core/dataMapping/simpleMapping.md +5 -5
- package/public/rjbuild/docs/core/dataMapping/simpleMapping.yaml +90 -60
- package/public/rjbuild/docs/core/element/debug/VariablesDebug.md +59 -0
- package/public/rjbuild/docs/core/element/debug/VariablesDebug.yaml +71 -0
- package/public/rjbuild/docs/core/element/form/Input.md +307 -0
- package/public/rjbuild/docs/core/element/form/Input.yaml +572 -0
- package/public/rjbuild/docs/core/element/html/FolderSortableTree.yaml +40 -12
- package/public/rjbuild/docs/core/element/html/FormatNumeral.yaml +21 -7
- package/public/rjbuild/docs/core/element/html/Html.yaml +26 -9
- package/public/rjbuild/docs/core/element/html/LabelFromValue.yaml +25 -8
- package/public/rjbuild/docs/core/element/html/PreformattedMarkup.yaml +23 -7
- package/public/rjbuild/docs/core/element/html/SortableTreeItemCollapseButton.yaml +7 -6
- package/public/rjbuild/docs/core/element/html/SyntaxHighlighter.yaml +56 -20
- package/public/rjbuild/docs/core/element/special/Count.md +8 -10
- package/public/rjbuild/docs/core/element/special/Count.yaml +121 -40
- package/public/rjbuild/docs/core/element/special/DataFilter.md +40 -41
- package/public/rjbuild/docs/core/element/special/DataFilter.yaml +197 -81
- package/public/rjbuild/docs/core/element/special/DelayedActions.md +13 -15
- package/public/rjbuild/docs/core/element/special/DelayedActions.yaml +32 -13
- package/public/rjbuild/docs/core/element/special/PageControls.md +8 -10
- package/public/rjbuild/docs/core/element/special/PageControls.yaml +9 -8
- package/public/rjbuild/docs/core/element/special/Phantom.md +9 -11
- package/public/rjbuild/docs/core/element/special/Phantom.yaml +22 -9
- package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.md +7 -9
- package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.yaml +167 -49
- package/public/rjbuild/docs/core/element/special/Switch.md +36 -38
- package/public/rjbuild/docs/core/element/special/Switch.yaml +68 -40
- package/public/rjbuild/docs/core/example/html.md +2 -2
- package/public/rjbuild/docs/core/example/html.yaml +2 -3
- package/public/rjbuild/docs/core/example/native-html-forms.md +245 -0
- package/public/rjbuild/docs/core/example/native-html-forms.yaml +393 -0
- package/public/rjbuild/docs/core/reaction/addData.md +17 -5
- package/public/rjbuild/docs/core/reaction/addData.yaml +70 -11
- package/public/rjbuild/docs/core/reaction/fetchData.md +1 -2
- package/public/rjbuild/docs/core/reaction/fetchData.yaml +84 -19
- package/public/rjbuild/docs/core/reaction/moveData.md +0 -4
- package/public/rjbuild/docs/core/reaction/moveData.yaml +28 -6
- package/public/rjbuild/docs/core/reaction/postMessage.md +0 -4
- package/public/rjbuild/docs/core/reaction/postMessage.yaml +29 -6
- package/public/rjbuild/docs/core/reaction/redirectNow.md +0 -4
- package/public/rjbuild/docs/core/reaction/redirectNow.yaml +10 -3
- package/public/rjbuild/docs/core/reaction/removeData.md +2 -6
- package/public/rjbuild/docs/core/reaction/removeData.yaml +40 -2
- package/public/rjbuild/docs/core/reaction/setClipboardData.md +0 -4
- package/public/rjbuild/docs/core/reaction/setClipboardData.yaml +10 -3
- package/public/rjbuild/docs/core/reaction/setData.md +18 -8
- package/public/rjbuild/docs/core/reaction/setData.yaml +43 -11
- package/public/rjbuild/docs/core/reaction/submitData.md +2 -3
- package/public/rjbuild/docs/core/reaction/submitData.yaml +43 -7
- package/public/rjbuild/docs/core/reaction/triggerEvent.md +0 -4
- package/public/rjbuild/docs/core/reaction/triggerEvent.yaml +25 -11
- package/public/rjbuild/docs/docs-components/Mermaid.md +254 -0
- package/public/rjbuild/docs/docs-components/Mermaid.yaml +339 -0
- package/public/rjbuild/docs/docs-components/index.yaml +1 -0
- package/public/rjbuild/docs/getting-started/actions.md +1 -1
- package/public/rjbuild/docs/index.yaml +2 -1
- package/public/rjbuild/docs/install.md +26 -29
- package/public/rjbuild/docs/install.yaml +4 -10
- package/public/rjbuild/docs/integration/bootstrap/action/Popover.md +26 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/action/Popover.yaml +28 -5
- package/public/rjbuild/docs/{core → integration/bootstrap}/action/Tooltip.md +4 -4
- package/public/rjbuild/docs/{core → integration/bootstrap}/action/Tooltip.yaml +16 -3
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/CheckBoxField.md +8 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/CheckBoxField.yaml +40 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/DateField.md +5 -5
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/DateField.yaml +27 -5
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/NumberField.md +7 -7
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/NumberField.yaml +32 -7
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/SelectField.md +9 -9
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/SelectField.yaml +46 -9
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextAreaField.md +8 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextAreaField.yaml +36 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextField.md +8 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextField.yaml +38 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/formElementsCommon.md +2 -4
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/index.md +0 -2
- package/public/rjbuild/docs/integration/bootstrap/element/html/AccordionItem.md +69 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/AccordionItem.yaml +19 -7
- package/public/rjbuild/docs/integration/bootstrap/element/html/Modal.md +127 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/Modal.yaml +35 -12
- package/public/rjbuild/docs/integration/bootstrap/element/html/Tabs.md +150 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/Tabs.yaml +24 -15
- package/public/rjbuild/docs/integration/bootstrap/element/html/index.md +13 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/special/BootstrapElement.md +4 -6
- package/public/rjbuild/docs/integration/bootstrap/element/special/BootstrapElement.yaml +29 -0
- package/public/rjbuild/docs/integration/bootstrap/element/special/index.md +19 -0
- package/public/rjbuild/docs/integration/bootstrap/example/website.md +41 -0
- package/public/rjbuild/docs/integration/bootstrap/overview.md +69 -0
- package/public/rjbuild/docs/integration/bootstrap/overview.yaml +87 -0
- package/public/rjbuild/docs/core/action/Popover.md +0 -26
- package/public/rjbuild/docs/core/element/special/BootstrapElement.yaml +0 -18
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/index.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/accordion.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/accordion.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/dynamic-content.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/dynamic-content.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/website.yaml +0 -0
- /package/public/rjbuild/docs/{chartjs → integration/chartjs}/components.yaml +0 -0
- /package/public/rjbuild/docs/{chartjs → integration/chartjs}/overview.yaml +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ea-lab/reactive-json-docs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.0",
|
|
4
4
|
"description": "Complete documentation for Reactive-JSON - Components, examples and LLM-parsable guides",
|
|
5
5
|
"main": "public/rjbuild/docs/index.yaml",
|
|
6
6
|
"files": [
|
|
@@ -26,17 +26,17 @@
|
|
|
26
26
|
"private": false,
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@craco/craco": "^7.1.0",
|
|
29
|
-
"@ea-lab/reactive-json": "^0.
|
|
30
|
-
"@ea-lab/reactive-json-chartjs": "^0.0
|
|
29
|
+
"@ea-lab/reactive-json": "^1.0.0-alpha.6",
|
|
30
|
+
"@ea-lab/reactive-json-chartjs": "^1.0.0",
|
|
31
31
|
"@npmcli/fs": "^4.0.0",
|
|
32
32
|
"@reduxjs/toolkit": "^2.6.1",
|
|
33
33
|
"@testing-library/jest-dom": "^6.6.3",
|
|
34
34
|
"@testing-library/react": "^16.3.0",
|
|
35
35
|
"@testing-library/user-event": "^14.6.1",
|
|
36
|
-
"bootstrap": "^5.3.
|
|
36
|
+
"bootstrap": "^5.3.7",
|
|
37
37
|
"lodash": "^4.17.21",
|
|
38
38
|
"react": "^19.1.0",
|
|
39
|
-
"react-bootstrap": "^2.10.
|
|
39
|
+
"react-bootstrap": "^2.10.10",
|
|
40
40
|
"react-dom": "^19.1.0",
|
|
41
41
|
"react-markdown": "^10.1.0",
|
|
42
42
|
"react-redux": "^9.2.0",
|
|
@@ -77,6 +77,8 @@
|
|
|
77
77
|
]
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
+
"@ea-lab/reactive-json-bootstrap": "^0.0.2",
|
|
81
|
+
"mermaid": "^11.10.1",
|
|
80
82
|
"remark-gfm": "^4.0.1"
|
|
81
83
|
}
|
|
82
84
|
}
|
|
@@ -164,7 +164,7 @@ const dateFormatProcessor = ({ requestContext, responseContext, dataToProcess, o
|
|
|
164
164
|
};
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
###
|
|
167
|
+
### Conditional Processing
|
|
168
168
|
|
|
169
169
|
```javascript
|
|
170
170
|
const userDataProcessor = ({ requestContext, responseContext, dataToProcess, originalDataToProcess }) => {
|
|
@@ -268,7 +268,7 @@ const safeProcessor = ({ requestContext, responseContext, dataToProcess, origina
|
|
|
268
268
|
};
|
|
269
269
|
```
|
|
270
270
|
|
|
271
|
-
###
|
|
271
|
+
### Descriptive IDs and Ordering
|
|
272
272
|
Use clear names and logical ordering:
|
|
273
273
|
|
|
274
274
|
```javascript
|
|
@@ -28,7 +28,7 @@ data: # Data used by renderView and templates
|
|
|
28
28
|
|
|
29
29
|
## Component Architecture Patterns
|
|
30
30
|
|
|
31
|
-
###
|
|
31
|
+
### Basic Element Component Structure
|
|
32
32
|
|
|
33
33
|
```jsx
|
|
34
34
|
import {ActionDependant} from "@ea-lab/reactive-json/dist/engine";
|
|
@@ -56,7 +56,7 @@ export const ComponentName = ({props}) => {
|
|
|
56
56
|
};
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
###
|
|
59
|
+
### Form Element Component Structure
|
|
60
60
|
|
|
61
61
|
```jsx
|
|
62
62
|
import {useContext} from 'react';
|
|
@@ -93,7 +93,7 @@ export const FormComponentName = ({props, datafield, path}) => {
|
|
|
93
93
|
};
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
###
|
|
96
|
+
### Component with View (Nested Content)
|
|
97
97
|
|
|
98
98
|
```jsx
|
|
99
99
|
import {View} from "@ea-lab/reactive-json/dist/engine";
|
|
@@ -120,7 +120,7 @@ export const WrapperComponent = ({props, path, currentData, datafield}) => {
|
|
|
120
120
|
};
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
###
|
|
123
|
+
### Generic Bootstrap Wrapper
|
|
124
124
|
|
|
125
125
|
```jsx
|
|
126
126
|
import {ActionDependant} from "@ea-lab/reactive-json/dist/engine";
|
|
@@ -151,7 +151,7 @@ export function BootstrapElement({props, currentData, path, bsComponent}) {
|
|
|
151
151
|
}
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
###
|
|
154
|
+
### Action Component Structure
|
|
155
155
|
|
|
156
156
|
```jsx
|
|
157
157
|
import {useContext, useEffect} from "react";
|
|
@@ -200,7 +200,7 @@ Other specialized contexts are available.
|
|
|
200
200
|
|
|
201
201
|
## Component Creation Rules
|
|
202
202
|
|
|
203
|
-
###
|
|
203
|
+
### Import Path Conventions
|
|
204
204
|
|
|
205
205
|
**Consumer application** (package imports - **RECOMMENDED**):
|
|
206
206
|
```jsx
|
|
@@ -219,7 +219,7 @@ import {GlobalDataContext} from "../../../engine/GlobalDataContext.jsx";
|
|
|
219
219
|
|
|
220
220
|
> **Important Note**: The relative path syntax (`../../../engine/`) is reserved for developing internal components within the reactive-json package. For all other use cases, use package imports with `@ea-lab/reactive-json/dist/engine`.
|
|
221
221
|
|
|
222
|
-
###
|
|
222
|
+
### Component Signature Standards
|
|
223
223
|
✅ **Correct**:
|
|
224
224
|
```jsx
|
|
225
225
|
export const Component = ({props}) => {
|
|
@@ -234,17 +234,17 @@ export const Component = ({props, customValue}) => {
|
|
|
234
234
|
}
|
|
235
235
|
```
|
|
236
236
|
|
|
237
|
-
###
|
|
237
|
+
### Error Handling
|
|
238
238
|
- Components should fail silently when misconfigured
|
|
239
239
|
- Return `null` for invalid configurations
|
|
240
240
|
- Don't crash the application
|
|
241
241
|
|
|
242
|
-
###
|
|
242
|
+
### Feature Implementation Priority
|
|
243
243
|
1. **Essential features**: Core functionality
|
|
244
244
|
2. **Requested features**: When explicitly asked
|
|
245
245
|
3. **Optional features**: Keep minimal complexity
|
|
246
246
|
|
|
247
|
-
###
|
|
247
|
+
### Default Behavior
|
|
248
248
|
- Provide sensible defaults
|
|
249
249
|
- Allow overriding via YAML/JSON configuration
|
|
250
250
|
- Keep React components simple
|
|
@@ -289,23 +289,23 @@ export const CustomRoot = (props) => {
|
|
|
289
289
|
|
|
290
290
|
## Best Practices
|
|
291
291
|
|
|
292
|
-
###
|
|
292
|
+
### Code Organization
|
|
293
293
|
- Order imports alphabetically by path
|
|
294
294
|
- Order object properties alphabetically
|
|
295
295
|
- Use JSX for reactive-json library components
|
|
296
296
|
- Export components via `index.js`: `export * from "./ComponentName.jsx";`
|
|
297
297
|
|
|
298
|
-
###
|
|
298
|
+
### Dynamic Values
|
|
299
299
|
- Use `evaluateTemplateValue()` for single values
|
|
300
300
|
- Use `evaluateTemplateValueCollection()` for arrays/objects
|
|
301
301
|
- Always evaluate user-provided content
|
|
302
302
|
|
|
303
|
-
###
|
|
303
|
+
### Attributes & Actions
|
|
304
304
|
- Include attribute support via `useEvaluatedAttributes()`
|
|
305
305
|
- Wrap content with `<ActionDependant {...props}>`
|
|
306
306
|
- Support actions unless explicitly told not to
|
|
307
307
|
|
|
308
|
-
###
|
|
308
|
+
### CSS & Styling
|
|
309
309
|
- Use CSS modules for component-specific styles (`Component.module.css`)
|
|
310
310
|
- For external libraries, mention CSS import requirements
|
|
311
311
|
- Prefer minimal styling approach
|
|
@@ -109,6 +109,51 @@ const App = () => {
|
|
|
109
109
|
};
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
+
### Component Override Behavior
|
|
113
|
+
|
|
114
|
+
When using `mergeComponentCollections` with multiple plugins, **the last component with a given name takes precedence**. This allows you to override default components with custom implementations.
|
|
115
|
+
|
|
116
|
+
```jsx
|
|
117
|
+
import { ReactiveJsonRoot, mergeComponentCollections } from "@ea-lab/reactive-json";
|
|
118
|
+
import { defaultComponents } from "@ea-lab/reactive-json";
|
|
119
|
+
import { customComponents } from "./plugins/customComponents.js";
|
|
120
|
+
|
|
121
|
+
const plugins = mergeComponentCollections([
|
|
122
|
+
defaultComponents, // Contains a "Button" component
|
|
123
|
+
customComponents // Also contains a "Button" component - this one will be used
|
|
124
|
+
]);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
This override mechanism is particularly useful for:
|
|
128
|
+
|
|
129
|
+
- **Customizing default components**: Replace built-in components with your own implementations
|
|
130
|
+
- **Theme customization**: Override components to match your design system
|
|
131
|
+
- **Feature enhancement**: Add functionality to existing components
|
|
132
|
+
- **Third-party integration**: Replace components with versions from external libraries
|
|
133
|
+
|
|
134
|
+
**Example: Overriding a Default Button**
|
|
135
|
+
|
|
136
|
+
```jsx
|
|
137
|
+
// Default plugin has a basic Button
|
|
138
|
+
const defaultPlugin = {
|
|
139
|
+
element: {
|
|
140
|
+
Button: BasicButton // Simple button implementation
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// Your custom plugin overrides it
|
|
145
|
+
const customPlugin = {
|
|
146
|
+
element: {
|
|
147
|
+
Button: EnhancedButton // Button with animations and custom styling
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// EnhancedButton will be used everywhere "Button" is referenced
|
|
152
|
+
const plugins = mergeComponentCollections([defaultPlugin, customPlugin]);
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**⚠️ Important**: Component names must match exactly (case-sensitive) for the override to work. The order in the `mergeComponentCollections` array determines precedence.
|
|
156
|
+
|
|
112
157
|
### Custom ReactiveJsonRoot Wrapper
|
|
113
158
|
|
|
114
159
|
Creating a custom wrapper allows you to **centralize plugin inclusion** across your entire application. Instead of manually importing and merging plugins in every component that uses Reactive-JSON, you define them once in a wrapper component.
|
|
@@ -172,4 +217,5 @@ export const ReportPage = () => {
|
|
|
172
217
|
2. **Use descriptive names** for components and plugins
|
|
173
218
|
3. **Document component props** and usage patterns
|
|
174
219
|
4. **Provide examples** for complex components
|
|
175
|
-
5. **
|
|
220
|
+
5. **Be intentional with component names** - use unique names unless you specifically want to override existing components
|
|
221
|
+
6. **Document overrides** when replacing default components to help other developers understand the customization
|
|
@@ -124,6 +124,57 @@ renderView:
|
|
|
124
124
|
|
|
125
125
|
- type: Markdown
|
|
126
126
|
content: |
|
|
127
|
+
### Component Override Behavior
|
|
128
|
+
|
|
129
|
+
When using `mergeComponentCollections` with multiple plugins, **the last component with a given name takes precedence**. This allows you to override default components with custom implementations.
|
|
130
|
+
|
|
131
|
+
- type: SyntaxHighlighter
|
|
132
|
+
language: jsx
|
|
133
|
+
content: |
|
|
134
|
+
import { ReactiveJsonRoot, mergeComponentCollections } from "@ea-lab/reactive-json";
|
|
135
|
+
import { defaultComponents } from "@ea-lab/reactive-json";
|
|
136
|
+
import { customComponents } from "./plugins/customComponents.js";
|
|
137
|
+
|
|
138
|
+
const plugins = mergeComponentCollections([
|
|
139
|
+
defaultComponents, // Contains a "Button" component
|
|
140
|
+
customComponents // Also contains a "Button" component - this one will be used
|
|
141
|
+
]);
|
|
142
|
+
|
|
143
|
+
- type: Markdown
|
|
144
|
+
content: |
|
|
145
|
+
This override mechanism is particularly useful for:
|
|
146
|
+
|
|
147
|
+
- **Customizing default components**: Replace built-in components with your own implementations
|
|
148
|
+
- **Theme customization**: Override components to match your design system
|
|
149
|
+
- **Feature enhancement**: Add functionality to existing components
|
|
150
|
+
- **Third-party integration**: Replace components with versions from external libraries
|
|
151
|
+
|
|
152
|
+
**Example: Overriding a Default Button**
|
|
153
|
+
|
|
154
|
+
- type: SyntaxHighlighter
|
|
155
|
+
language: jsx
|
|
156
|
+
content: |
|
|
157
|
+
// Default plugin has a basic Button
|
|
158
|
+
const defaultPlugin = {
|
|
159
|
+
element: {
|
|
160
|
+
Button: BasicButton // Simple button implementation
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
// Your custom plugin overrides it
|
|
165
|
+
const customPlugin = {
|
|
166
|
+
element: {
|
|
167
|
+
Button: EnhancedButton // Button with animations and custom styling
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// EnhancedButton will be used everywhere "Button" is referenced
|
|
172
|
+
const plugins = mergeComponentCollections([defaultPlugin, customPlugin]);
|
|
173
|
+
|
|
174
|
+
- type: Markdown
|
|
175
|
+
content: |
|
|
176
|
+
**⚠️ Important**: Component names must match exactly (case-sensitive) for the override to work. The order in the `mergeComponentCollections` array determines precedence.
|
|
177
|
+
|
|
127
178
|
### Custom ReactiveJsonRoot Wrapper
|
|
128
179
|
|
|
129
180
|
Creating a custom wrapper allows you to **centralize plugin inclusion** across your entire application. Instead of manually importing and merging plugins in every component that uses Reactive-JSON, you define them once in a wrapper component.
|
|
@@ -193,6 +244,7 @@ renderView:
|
|
|
193
244
|
2. **Use descriptive names** for components and plugins
|
|
194
245
|
3. **Document component props** and usage patterns
|
|
195
246
|
4. **Provide examples** for complex components
|
|
196
|
-
5. **
|
|
247
|
+
5. **Be intentional with component names** - use unique names unless you specifically want to override existing components
|
|
248
|
+
6. **Document overrides** when replacing default components to help other developers understand the customization
|
|
197
249
|
|
|
198
250
|
templates:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# HashChangeListener
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Listens to hash changes (URL fragment) in the window and executes a reaction function in response. This is an internal action component that is automatically used when you specify `on: "hashchange"` in your actions.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -3,7 +3,7 @@ renderView:
|
|
|
3
3
|
content: |
|
|
4
4
|
# HashChangeListener
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Listens to hash changes (URL fragment) in the window and executes a reaction function in response. This is an internal action component that is automatically used when you specify `on: "hashchange"` in your actions.
|
|
7
7
|
|
|
8
8
|
## Usage
|
|
9
9
|
|
|
@@ -11,12 +11,30 @@ renderView:
|
|
|
11
11
|
|
|
12
12
|
## Properties
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
- type: DefinitionList
|
|
15
|
+
content:
|
|
16
|
+
- term:
|
|
17
|
+
code: what
|
|
18
|
+
after: "(string, required)"
|
|
19
|
+
details:
|
|
20
|
+
type: Markdown
|
|
21
|
+
content: "name of the reaction function to execute (e.g., `setData`, `fetchData`, `submitData`)"
|
|
22
|
+
- term:
|
|
23
|
+
code: whenHashIs
|
|
24
|
+
after: "(string, optional)"
|
|
25
|
+
details:
|
|
26
|
+
type: Markdown
|
|
27
|
+
content: "hash value that should trigger the reaction (includes the `#` character)"
|
|
28
|
+
- term:
|
|
29
|
+
code: whenHashWas
|
|
30
|
+
after: "(string, optional)"
|
|
31
|
+
details:
|
|
32
|
+
type: Markdown
|
|
33
|
+
content: "previous hash value that should trigger the reaction (includes the `#` character)"
|
|
15
34
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- All other properties are passed as arguments to the reaction function
|
|
35
|
+
- type: Markdown
|
|
36
|
+
content: |
|
|
37
|
+
All other properties are passed as arguments to the reaction function.
|
|
20
38
|
|
|
21
39
|
- type: RjBuildDescriber
|
|
22
40
|
title: "HashChangeListener Example"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Hide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Completely hides the element and cancels any subsequent actions.
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
|
-
|
|
6
|
+
None.
|
|
7
7
|
|
|
8
8
|
## Behavior
|
|
9
9
|
- The element and its children are not rendered in the DOM.
|
|
@@ -3,10 +3,11 @@ renderView:
|
|
|
3
3
|
content: |
|
|
4
4
|
# Hide
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Completely hides the element and cancels any subsequent actions.
|
|
7
7
|
|
|
8
8
|
## Properties
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
None.
|
|
10
11
|
|
|
11
12
|
## Behavior
|
|
12
13
|
- The element and its children are not rendered in the DOM.
|
|
@@ -18,7 +19,7 @@ renderView:
|
|
|
18
19
|
- type: Markdown
|
|
19
20
|
content: |
|
|
20
21
|
This example shows how the `hide` action completely removes an element from the DOM based on a condition.
|
|
21
|
-
|
|
22
|
+
|
|
22
23
|
Try toggling the visibility to see how the `hide` action works differently from just making something invisible.
|
|
23
24
|
|
|
24
25
|
toDescribe:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MessageListener
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Executes a reaction when receiving a message via `window.postMessage`. This is an internal action component that is automatically used when you specify `on: "message"` in your actions.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -10,9 +10,9 @@ MessageListener is **not** used directly as an element type. Instead, it is auto
|
|
|
10
10
|
|
|
11
11
|
When using `on: "message"` in actions, you can specify:
|
|
12
12
|
|
|
13
|
-
- `what` (required):
|
|
14
|
-
- `whenMessageIs` (optional):
|
|
15
|
-
- All other properties are passed as arguments to the reaction function
|
|
13
|
+
- `what` (required): Name of the reaction function to execute (e.g., `setData`, `fetchData`, `submitData`, etc.).
|
|
14
|
+
- `whenMessageIs` (optional): Message value to react to (deep comparison with the received message data)
|
|
15
|
+
- All other properties are passed as arguments to the reaction function.
|
|
16
16
|
|
|
17
17
|
## Behavior
|
|
18
18
|
|
|
@@ -3,7 +3,7 @@ renderView:
|
|
|
3
3
|
content: |
|
|
4
4
|
# MessageListener
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Executes a reaction when receiving a message via `window.postMessage`. This is an internal action component that is automatically used when you specify `on: "message"` in your actions.
|
|
7
7
|
|
|
8
8
|
## Usage
|
|
9
9
|
|
|
@@ -11,11 +11,23 @@ renderView:
|
|
|
11
11
|
|
|
12
12
|
## Properties
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
- type: DefinitionList
|
|
15
|
+
content:
|
|
16
|
+
- term:
|
|
17
|
+
code: what
|
|
18
|
+
after: "(string, required)"
|
|
19
|
+
details:
|
|
20
|
+
type: Markdown
|
|
21
|
+
content: "Name of the reaction function to execute (e.g., `setData`, `fetchData`, `submitData`)."
|
|
22
|
+
- term:
|
|
23
|
+
code: whenMessageIs
|
|
24
|
+
after: "(any, optional)"
|
|
25
|
+
details:
|
|
26
|
+
type: Markdown
|
|
27
|
+
content: "Message value to react to. Uses deep comparison with the received message data."
|
|
28
|
+
- type: Markdown
|
|
29
|
+
content: |
|
|
30
|
+
All other properties are passed as arguments to the reaction function.
|
|
19
31
|
|
|
20
32
|
- type: RjBuildDescriber
|
|
21
33
|
title: "MessageListener Example"
|
|
@@ -8,10 +8,10 @@ ReactOnEvent is an internal action component that is automatically instantiated
|
|
|
8
8
|
|
|
9
9
|
When you define actions with event handlers (like `on: "click"`), the Actions system automatically:
|
|
10
10
|
|
|
11
|
-
1. Collects all reactions with event handlers for the element
|
|
12
|
-
2. Groups them by event type (click, change, mouseover, etc.)
|
|
13
|
-
3. Creates a ReactOnEvent component that attaches the appropriate event listeners
|
|
14
|
-
4. Wraps the target element with these event handlers
|
|
11
|
+
1. Collects all reactions with event handlers for the element.
|
|
12
|
+
2. Groups them by event type (click, change, mouseover, etc.).
|
|
13
|
+
3. Creates a ReactOnEvent component that attaches the appropriate event listeners.
|
|
14
|
+
4. Wraps the target element with these event handlers.
|
|
15
15
|
|
|
16
16
|
## Usage Pattern
|
|
17
17
|
|
|
@@ -11,10 +11,10 @@ renderView:
|
|
|
11
11
|
|
|
12
12
|
When you define actions with event handlers (like `on: "click"`), the Actions system automatically:
|
|
13
13
|
|
|
14
|
-
1. Collects all reactions with event handlers for the element
|
|
15
|
-
2. Groups them by event type (click, change, mouseover, etc.)
|
|
16
|
-
3. Creates a ReactOnEvent component that attaches the appropriate event listeners
|
|
17
|
-
4. Wraps the target element with these event handlers
|
|
14
|
+
1. Collects all reactions with event handlers for the element.
|
|
15
|
+
2. Groups them by event type (click, change, mouseover, etc.).
|
|
16
|
+
3. Creates a ReactOnEvent component that attaches the appropriate event listeners.
|
|
17
|
+
4. Wraps the target element with these event handlers.
|
|
18
18
|
|
|
19
19
|
## Usage Pattern
|
|
20
20
|
|
|
@@ -3,10 +3,16 @@ renderView:
|
|
|
3
3
|
content: |
|
|
4
4
|
# Redirect
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Redirects the user to a given URL if the condition is met.
|
|
7
7
|
|
|
8
8
|
## Properties
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
- type: DefinitionList
|
|
11
|
+
content:
|
|
12
|
+
- term:
|
|
13
|
+
code: to
|
|
14
|
+
after: "(string, required)"
|
|
15
|
+
details: "Destination URL."
|
|
10
16
|
|
|
11
17
|
- type: Markdown
|
|
12
18
|
content: |
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# VisuallyHide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Visually hides the element but keeps it in the DOM (useful for accessibility or to keep the element reactive to events).
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
|
-
|
|
6
|
+
None.
|
|
7
7
|
|
|
8
8
|
## Behavior
|
|
9
9
|
- The element is rendered in the DOM but with `display: none`.
|
|
@@ -3,10 +3,10 @@ renderView:
|
|
|
3
3
|
content: |
|
|
4
4
|
# VisuallyHide
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Visually hides the element but keeps it in the DOM (useful for accessibility or to keep the element reactive to events).
|
|
7
7
|
|
|
8
8
|
## Properties
|
|
9
|
-
|
|
9
|
+
None.
|
|
10
10
|
|
|
11
11
|
## Behavior
|
|
12
12
|
- The element is rendered in the DOM but with `display: none`.
|
|
@@ -6,14 +6,14 @@ SimpleMapping is the core data mapping processor in Reactive-JSON that enables s
|
|
|
6
6
|
|
|
7
7
|
### stringMap Configuration
|
|
8
8
|
|
|
9
|
-
- `value` (string, required): Source path in the HTTP response (e.g., `user.firstName`)
|
|
10
|
-
- `required` (boolean, optional, default: true): Whether the source value must exist
|
|
11
|
-
- `defaultValue` (any, optional): Fallback value when source is missing and not required
|
|
12
|
-
- `updateMode` (string, optional, default: "replace"): How to apply the value (`replace`, `add`, `move`, `remove`)
|
|
9
|
+
- `value` (string, required): Source path in the HTTP response (e.g., `user.firstName`).
|
|
10
|
+
- `required` (boolean, optional, default: true): Whether the source value must exist.
|
|
11
|
+
- `defaultValue` (any, optional): Fallback value when source is missing and not required.
|
|
12
|
+
- `updateMode` (string, optional, default: "replace"): How to apply the value (`replace`, `add`, `move`, `remove`).
|
|
13
13
|
|
|
14
14
|
### onErrorMap Configuration
|
|
15
15
|
|
|
16
|
-
- `value` (string, required): Can be either static values (e.g., `Error occurred`) or template references (e.g., `~~.errorTimestamp`)
|
|
16
|
+
- `value` (string, required): Can be either static values (e.g., `Error occurred`) or template references (e.g., `~~.errorTimestamp`).
|
|
17
17
|
|
|
18
18
|
## Configuration Structure
|
|
19
19
|
|