@ea-lab/reactive-json-docs 0.1.3 → 0.1.4
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 +1 -1
- package/public/rjbuild/docs/core/element/html/SyntaxHighlighter.yaml +293 -0
- package/public/rjbuild/docs/docs-components/SyntaxHighlighter.md +154 -0
- package/public/rjbuild/docs/docs-components/SyntaxHighlighter.yaml +167 -0
- package/public/rjbuild/docs/docs-components/index.md +28 -0
- package/public/rjbuild/docs/docs-components/index.yaml +35 -0
- package/public/rjbuild/docs/extend/component-development-guide-llm.md +383 -0
- package/public/rjbuild/docs/extend/component-development.md +193 -0
- package/public/rjbuild/docs/extend/component-development.yaml +215 -0
- package/public/rjbuild/docs/extend/index.md +20 -0
- package/public/rjbuild/docs/extend/index.yaml +29 -0
- package/public/rjbuild/docs/extend/plugin-system.md +142 -0
- package/public/rjbuild/docs/extend/plugin-system.yaml +147 -0
- package/public/rjbuild/docs/index.yaml +60 -6
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# Component Development Guide
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
Creating custom components for Reactive-JSON involves building React components that follow specific patterns and integrate with the library's context system. This guide covers the essential patterns, APIs, and best practices for component development.
|
|
9
|
+
|
|
10
|
+
## Core Concepts
|
|
11
|
+
|
|
12
|
+
### Component Architecture
|
|
13
|
+
Reactive-JSON components follow these key principles:
|
|
14
|
+
- **Context Integration**: Use React contexts for data access and manipulation
|
|
15
|
+
- **Template Evaluation**: Support dynamic values through template patterns
|
|
16
|
+
- **Action/reaction Support**: Enable the action system through proper wrapping
|
|
17
|
+
- **Consistent Props**: Follow standard property patterns for consistency
|
|
18
|
+
|
|
19
|
+
### Essential Contexts
|
|
20
|
+
All components have access to these React contexts:
|
|
21
|
+
- **GlobalDataContext**: Contains root data and `updateData` callback
|
|
22
|
+
- **TemplateContext**: Contains current template data for evaluation
|
|
23
|
+
|
|
24
|
+
Other specialized contexts are available.
|
|
25
|
+
- **EventDispatcherContext**: Centralized event handling system, mostly used by the [reaction system](/docs/core/reaction/index).
|
|
26
|
+
- **PaginationContext**: Used by components that integrate pagination, such as [Switch](/docs/core/element/special/Switch).
|
|
27
|
+
|
|
28
|
+
## Basic Element Component
|
|
29
|
+
|
|
30
|
+
This example shows the structure of a basic element component that displays content and supports the action system.
|
|
31
|
+
|
|
32
|
+
- type: SyntaxHighlighter
|
|
33
|
+
language: jsx
|
|
34
|
+
content: |
|
|
35
|
+
import { ActionDependant } from "@ea-lab/reactive-json/dist/engine";
|
|
36
|
+
import { GlobalDataContext } from "@ea-lab/reactive-json/dist/engine";
|
|
37
|
+
import { TemplateContext } from "@ea-lab/reactive-json/dist/engine";
|
|
38
|
+
import { evaluateTemplateValue } from "@ea-lab/reactive-json/dist/engine";
|
|
39
|
+
import { useContext } from "react";
|
|
40
|
+
|
|
41
|
+
export const MyComponent = ({ props }) => {
|
|
42
|
+
const globalDataContext = useContext(GlobalDataContext);
|
|
43
|
+
const templateContext = useContext(TemplateContext);
|
|
44
|
+
|
|
45
|
+
// Evaluate dynamic values
|
|
46
|
+
const evaluatedContent = evaluateTemplateValue({
|
|
47
|
+
valueToEvaluate: props.content,
|
|
48
|
+
globalDataContext,
|
|
49
|
+
templateContext
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<ActionDependant {...props}>
|
|
54
|
+
<div className="my-component">
|
|
55
|
+
{evaluatedContent}
|
|
56
|
+
</div>
|
|
57
|
+
</ActionDependant>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
- type: Markdown
|
|
62
|
+
content: |
|
|
63
|
+
## Form Component Pattern
|
|
64
|
+
|
|
65
|
+
Form components handle user input and provide two-way data binding with the global data context.
|
|
66
|
+
|
|
67
|
+
- type: SyntaxHighlighter
|
|
68
|
+
language: jsx
|
|
69
|
+
content: |
|
|
70
|
+
import { useContext } from 'react';
|
|
71
|
+
import { GlobalDataContext } from "@ea-lab/reactive-json/dist/engine";
|
|
72
|
+
import { ActionDependant } from "@ea-lab/reactive-json/dist/engine";
|
|
73
|
+
import { TemplateContext } from "@ea-lab/reactive-json/dist/engine";
|
|
74
|
+
import { useEvaluatedAttributes } from "@ea-lab/reactive-json/dist/engine";
|
|
75
|
+
import { propsDataLocationToPathAndValue } from "@ea-lab/reactive-json/dist/engine";
|
|
76
|
+
|
|
77
|
+
export const MyFormField = ({ props, datafield, path }) => {
|
|
78
|
+
const globalDataContext = useContext(GlobalDataContext);
|
|
79
|
+
const templateContext = useContext(TemplateContext);
|
|
80
|
+
|
|
81
|
+
const attributes = useEvaluatedAttributes(props.attributes);
|
|
82
|
+
|
|
83
|
+
const { formData, formDataPath } = propsDataLocationToPathAndValue({
|
|
84
|
+
currentPath: path,
|
|
85
|
+
datafield: datafield,
|
|
86
|
+
dataLocation: props.dataLocation,
|
|
87
|
+
defaultValue: props.defaultFieldValue,
|
|
88
|
+
globalDataContext,
|
|
89
|
+
templateContext,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const onChange = (e) => {
|
|
93
|
+
globalDataContext.updateData(e.currentTarget.value, formDataPath);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<ActionDependant {...props}>
|
|
98
|
+
<input
|
|
99
|
+
type="text"
|
|
100
|
+
value={formData || ''}
|
|
101
|
+
onChange={onChange}
|
|
102
|
+
{...attributes}
|
|
103
|
+
/>
|
|
104
|
+
</ActionDependant>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
- type: Markdown
|
|
109
|
+
content: |
|
|
110
|
+
|
|
111
|
+
## Component with Nested Content
|
|
112
|
+
|
|
113
|
+
Components that render nested RjBuild content use the View component to process child elements.
|
|
114
|
+
|
|
115
|
+
- type: SyntaxHighlighter
|
|
116
|
+
language: jsx
|
|
117
|
+
content: |
|
|
118
|
+
import { View } from "@ea-lab/reactive-json/dist/engine";
|
|
119
|
+
import { useEvaluatedAttributes } from "@ea-lab/reactive-json/dist/engine";
|
|
120
|
+
import { ActionDependant } from "@ea-lab/reactive-json/dist/engine";
|
|
121
|
+
|
|
122
|
+
export const MyWrapper = ({ props, path, currentData, datafield }) => {
|
|
123
|
+
const attributes = useEvaluatedAttributes(props.attributes);
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<ActionDependant {...props}>
|
|
127
|
+
<div className="my-wrapper" {...attributes}>
|
|
128
|
+
{props?.content && (
|
|
129
|
+
<View
|
|
130
|
+
props={props.content}
|
|
131
|
+
path={path + ".content"}
|
|
132
|
+
currentData={currentData?.["content"]}
|
|
133
|
+
datafield={"content"}
|
|
134
|
+
/>
|
|
135
|
+
)}
|
|
136
|
+
</div>
|
|
137
|
+
</ActionDependant>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
- type: Markdown
|
|
142
|
+
content: |
|
|
143
|
+
|
|
144
|
+
## Key APIs and Utilities
|
|
145
|
+
|
|
146
|
+
### Template Evaluation
|
|
147
|
+
- **evaluateTemplateValue()**: Evaluates template patterns like `~.value`, `~~.value`, `~>.value`
|
|
148
|
+
- **evaluateTemplateValueCollection()**: Evaluates collections and arrays with template patterns, supports multiple elements
|
|
149
|
+
- **useEvaluatedAttributes()**: Hook to evaluate dynamic attributes object
|
|
150
|
+
|
|
151
|
+
### Data Management
|
|
152
|
+
- **propsDataLocationToPathAndValue()**: Handles form data location and path resolution
|
|
153
|
+
- **GlobalDataContext.updateData()**: Updates data at specified path
|
|
154
|
+
|
|
155
|
+
### Component Integration
|
|
156
|
+
- **ActionDependant**: Wrapper that enables action system support
|
|
157
|
+
- **View**: Renders RjBuild content or any displayable value
|
|
158
|
+
|
|
159
|
+
## Action Component Pattern
|
|
160
|
+
|
|
161
|
+
Action components perform side effects and don't render visible content. They wrap their children and react to events or data changes. The conditional system (`when`, `is`, etc.) is handled by Actions.jsx, not by the action component itself.
|
|
162
|
+
|
|
163
|
+
- type: SyntaxHighlighter
|
|
164
|
+
language: jsx
|
|
165
|
+
content: |
|
|
166
|
+
import { useContext, useEffect } from "react";
|
|
167
|
+
import { EventDispatcherContext } from "@ea-lab/reactive-json/dist/engine";
|
|
168
|
+
import { GlobalDataContext } from "@ea-lab/reactive-json/dist/engine";
|
|
169
|
+
import { TemplateContext } from "@ea-lab/reactive-json/dist/engine";
|
|
170
|
+
import { evaluateTemplateValue } from "@ea-lab/reactive-json/dist/engine";
|
|
171
|
+
|
|
172
|
+
export const MyAction = (props) => {
|
|
173
|
+
const eventDispatcherContext = useContext(EventDispatcherContext);
|
|
174
|
+
const globalDataContext = useContext(GlobalDataContext);
|
|
175
|
+
const templateContext = useContext(TemplateContext);
|
|
176
|
+
|
|
177
|
+
const actionProps = props?.actionProps ?? undefined;
|
|
178
|
+
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
// Action logic - this runs when Actions.jsx determines conditions are met
|
|
181
|
+
// No need to check conditions here, Actions.jsx handles that
|
|
182
|
+
if (actionProps?.targetElement) {
|
|
183
|
+
// Perform the action on the target element
|
|
184
|
+
actionProps.targetElement.style.display = 'none';
|
|
185
|
+
}
|
|
186
|
+
}, [actionProps, eventDispatcherContext, globalDataContext, templateContext]);
|
|
187
|
+
|
|
188
|
+
return <>{props.children}</>;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
- type: Markdown
|
|
192
|
+
content: |
|
|
193
|
+
|
|
194
|
+
## Best Practices
|
|
195
|
+
|
|
196
|
+
### Component Guidelines
|
|
197
|
+
1. **Always wrap content with ActionDependant** to enable action system
|
|
198
|
+
2. **Use provided contexts** for data access and manipulation
|
|
199
|
+
3. **Evaluate template values** using provided utilities
|
|
200
|
+
4. **Handle attributes properly** using useEvaluatedAttributes
|
|
201
|
+
5. **Follow naming conventions** for consistency
|
|
202
|
+
|
|
203
|
+
### Performance Considerations
|
|
204
|
+
- Use React hooks efficiently to avoid unnecessary re-renders
|
|
205
|
+
- Memoize expensive computations when appropriate
|
|
206
|
+
- Leverage the EventDispatcherContext for optimal event handling
|
|
207
|
+
|
|
208
|
+
### Integration Requirements
|
|
209
|
+
- Components must accept props in the standard format
|
|
210
|
+
- Form components should implement proper data binding
|
|
211
|
+
- Action components should not interfere with normal rendering
|
|
212
|
+
|
|
213
|
+
templates:
|
|
214
|
+
|
|
215
|
+
data: {}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Extending Reactive-JSON
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Reactive-JSON is designed to be extensible through custom React components and plugins. This section provides comprehensive documentation on how to extend the library with your own components and integrate them using the plugin system.
|
|
6
|
+
|
|
7
|
+
The extension system allows you to:
|
|
8
|
+
- Create custom React components that integrate seamlessly with Reactive-JSON
|
|
9
|
+
- Define plugins to organize and distribute your components
|
|
10
|
+
- Use existing React libraries and wrap them for Reactive-JSON compatibility
|
|
11
|
+
- Build reusable component libraries for your organization
|
|
12
|
+
|
|
13
|
+
## Getting Started
|
|
14
|
+
|
|
15
|
+
To start extending Reactive-JSON:
|
|
16
|
+
|
|
17
|
+
1. **[Component Development](component-development)**: Learn how to create custom React components that integrate with Reactive-JSON
|
|
18
|
+
2. **[Plugin System](plugin-system)**: Understand how to organize and distribute your components using the plugin system
|
|
19
|
+
|
|
20
|
+
Each section provides detailed examples, best practices, and common patterns to help you build robust extensions.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# Extending Reactive-JSON
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
Reactive-JSON is designed to be extensible through custom React components and plugins. This section provides comprehensive documentation on how to extend the library with your own components and integrate them using the plugin system.
|
|
9
|
+
|
|
10
|
+
The extension system allows you to:
|
|
11
|
+
- Create custom React components that integrate seamlessly with Reactive-JSON
|
|
12
|
+
- Define plugins to organize and distribute your components
|
|
13
|
+
- Use existing React libraries and wrap them for Reactive-JSON compatibility
|
|
14
|
+
- Build reusable component libraries for your organization
|
|
15
|
+
|
|
16
|
+
- type: Markdown
|
|
17
|
+
content: |
|
|
18
|
+
## Getting Started
|
|
19
|
+
|
|
20
|
+
To start extending Reactive-JSON:
|
|
21
|
+
|
|
22
|
+
1. **[Component Development](component-development)**: Learn how to create custom React components that integrate with Reactive-JSON
|
|
23
|
+
2. **[Plugin System](plugin-system)**: Understand how to organize and distribute your components using the plugin system
|
|
24
|
+
|
|
25
|
+
Each section provides detailed examples, best practices, and common patterns to help you build robust extensions.
|
|
26
|
+
|
|
27
|
+
templates:
|
|
28
|
+
|
|
29
|
+
data: {}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Plugin System Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The Reactive-JSON plugin system provides a structured way to organize, distribute, and integrate custom components. Plugins allow you to package related components together and make them available to Reactive-JSON applications through a simple registration mechanism.
|
|
6
|
+
|
|
7
|
+
## Plugin Structure
|
|
8
|
+
|
|
9
|
+
A plugin is a JavaScript object that exports components organized by type. The standard plugin structure includes:
|
|
10
|
+
|
|
11
|
+
- **element**: Display components, form fields, and interactive elements
|
|
12
|
+
- **action**: Components that perform side effects or modify behavior
|
|
13
|
+
- **reaction**: Event-driven components that respond to user interactions
|
|
14
|
+
- **hook**: React hooks that provide additional functionality
|
|
15
|
+
|
|
16
|
+
## Plugin Registration
|
|
17
|
+
|
|
18
|
+
Plugins are registered with the ReactiveJsonRoot component to make components available throughout the application.
|
|
19
|
+
|
|
20
|
+
First, regroup your components in a plugin object.
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
// myPlugin.js
|
|
24
|
+
import { MyButton } from "./components/MyButton.jsx";
|
|
25
|
+
import { MyForm } from "./components/MyForm.jsx";
|
|
26
|
+
import { MyAction } from "./components/MyAction.jsx";
|
|
27
|
+
|
|
28
|
+
export const myPlugin = {
|
|
29
|
+
element: {
|
|
30
|
+
MyButton,
|
|
31
|
+
MyForm,
|
|
32
|
+
},
|
|
33
|
+
action: {
|
|
34
|
+
MyAction,
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Then, register the plugin with the ReactiveJsonRoot component:
|
|
40
|
+
|
|
41
|
+
```jsx
|
|
42
|
+
import { ReactiveJsonRoot } from "@ea-lab/reactive-json";
|
|
43
|
+
import { myPlugin } from "./plugins/myPlugin.js";
|
|
44
|
+
|
|
45
|
+
const App = () => {
|
|
46
|
+
return (
|
|
47
|
+
<ReactiveJsonRoot
|
|
48
|
+
plugins={[myPlugin]}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The plugin is now available throughout the application.
|
|
55
|
+
|
|
56
|
+
You can now use the components in your RjBuild configuration:
|
|
57
|
+
|
|
58
|
+
```jsx
|
|
59
|
+
import React from 'react';
|
|
60
|
+
import { ReactiveJsonRoot } from "@ea-lab/reactive-json";
|
|
61
|
+
import { myPlugin } from "./plugins/myPlugin.js";
|
|
62
|
+
|
|
63
|
+
const App = () => {
|
|
64
|
+
const rjBuildConfig = {
|
|
65
|
+
renderView: [
|
|
66
|
+
{
|
|
67
|
+
type: "MyButton",
|
|
68
|
+
content: "Click me!",
|
|
69
|
+
customProperty: "some value"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
data: {}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<ReactiveJsonRoot
|
|
77
|
+
rjBuild={rjBuildConfig}
|
|
78
|
+
plugins={[myPlugin]}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The plugin is now available throughout the application.
|
|
85
|
+
|
|
86
|
+
## Multi-Plugin Application
|
|
87
|
+
|
|
88
|
+
Applications can use multiple plugins, allowing for modular component organization.
|
|
89
|
+
|
|
90
|
+
```jsx
|
|
91
|
+
import { uiPlugin } from "./plugins/uiPlugin.js";
|
|
92
|
+
import { formPlugin } from "./plugins/formPlugin.js";
|
|
93
|
+
import { chartsPlugin } from "./plugins/chartsPlugin.js";
|
|
94
|
+
|
|
95
|
+
const App = () => {
|
|
96
|
+
return (
|
|
97
|
+
<ReactiveJsonRoot
|
|
98
|
+
rjBuild={rjBuildConfig}
|
|
99
|
+
plugins={[
|
|
100
|
+
uiPlugin,
|
|
101
|
+
formPlugin,
|
|
102
|
+
chartsPlugin
|
|
103
|
+
]}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Plugin Development Patterns
|
|
110
|
+
|
|
111
|
+
### Standalone Plugin
|
|
112
|
+
|
|
113
|
+
For single-purpose plugins with a few related components:
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
export const simplePlugin = {
|
|
117
|
+
element: {
|
|
118
|
+
Alert: AlertComponent,
|
|
119
|
+
Badge: BadgeComponent,
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Best Practices
|
|
125
|
+
|
|
126
|
+
### Plugin Organization
|
|
127
|
+
1. **Group related components** in the same plugin
|
|
128
|
+
2. **Use descriptive names** for components and plugins
|
|
129
|
+
3. **Document component props** and usage patterns
|
|
130
|
+
4. **Provide examples** for complex components
|
|
131
|
+
|
|
132
|
+
### Distribution
|
|
133
|
+
1. **Package as npm modules** for easy distribution
|
|
134
|
+
2. **Include TypeScript definitions** if using TypeScript
|
|
135
|
+
3. **Provide clear documentation** and examples
|
|
136
|
+
4. **Follow semantic versioning** for releases
|
|
137
|
+
|
|
138
|
+
### Performance
|
|
139
|
+
1. **Lazy load large plugins** when possible
|
|
140
|
+
2. **Avoid global state** in plugin components
|
|
141
|
+
3. **Use React best practices** for component implementation
|
|
142
|
+
4. **Test plugin compatibility** with different Reactive-JSON versions
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# Plugin System Guide
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
The Reactive-JSON plugin system provides a structured way to organize, distribute, and integrate custom components. Plugins allow you to package related components together and make them available to Reactive-JSON applications through a simple registration mechanism.
|
|
9
|
+
|
|
10
|
+
## Plugin Structure
|
|
11
|
+
|
|
12
|
+
A plugin is a JavaScript object that exports components organized by type. The standard plugin structure includes:
|
|
13
|
+
|
|
14
|
+
- **element**: Display components, form fields, and interactive elements
|
|
15
|
+
- **action**: Components that perform side effects or modify behavior
|
|
16
|
+
- **reaction**: Event-driven components that respond to user interactions
|
|
17
|
+
- **hook**: React hooks that provide additional functionality
|
|
18
|
+
|
|
19
|
+
## Plugin Registration
|
|
20
|
+
|
|
21
|
+
Plugins are registered with the ReactiveJsonRoot component to make components available throughout the application.
|
|
22
|
+
|
|
23
|
+
First, regroup your components in a plugin object.
|
|
24
|
+
|
|
25
|
+
```jsx
|
|
26
|
+
// myPlugin.js
|
|
27
|
+
import { MyButton } from "./components/MyButton.jsx";
|
|
28
|
+
import { MyForm } from "./components/MyForm.jsx";
|
|
29
|
+
import { MyAction } from "./components/MyAction.jsx";
|
|
30
|
+
|
|
31
|
+
export const myPlugin = {
|
|
32
|
+
element: {
|
|
33
|
+
MyButton,
|
|
34
|
+
MyForm,
|
|
35
|
+
},
|
|
36
|
+
action: {
|
|
37
|
+
MyAction,
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then, register the plugin with the ReactiveJsonRoot component:
|
|
43
|
+
|
|
44
|
+
```jsx
|
|
45
|
+
import { ReactiveJsonRoot } from "@ea-lab/reactive-json";
|
|
46
|
+
import { myPlugin } from "./plugins/myPlugin.js";
|
|
47
|
+
|
|
48
|
+
const App = () => {
|
|
49
|
+
return (
|
|
50
|
+
<ReactiveJsonRoot
|
|
51
|
+
plugins={[myPlugin]}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The plugin is now available throughout the application.
|
|
58
|
+
|
|
59
|
+
You can now use the components in your RjBuild configuration:
|
|
60
|
+
|
|
61
|
+
```jsx
|
|
62
|
+
import React from 'react';
|
|
63
|
+
import { ReactiveJsonRoot } from "@ea-lab/reactive-json";
|
|
64
|
+
import { myPlugin } from "./plugins/myPlugin.js";
|
|
65
|
+
|
|
66
|
+
const App = () => {
|
|
67
|
+
const rjBuildConfig = {
|
|
68
|
+
renderView: [
|
|
69
|
+
{
|
|
70
|
+
type: "MyButton",
|
|
71
|
+
content: "Click me!",
|
|
72
|
+
customProperty: "some value"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
data: {}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<ReactiveJsonRoot
|
|
80
|
+
rjBuild={rjBuildConfig}
|
|
81
|
+
plugins={[myPlugin]}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The plugin is now available throughout the application.
|
|
88
|
+
|
|
89
|
+
## Multi-Plugin Application
|
|
90
|
+
|
|
91
|
+
Applications can use multiple plugins, allowing for modular component organization.
|
|
92
|
+
|
|
93
|
+
```jsx
|
|
94
|
+
import { uiPlugin } from "./plugins/uiPlugin.js";
|
|
95
|
+
import { formPlugin } from "./plugins/formPlugin.js";
|
|
96
|
+
import { chartsPlugin } from "./plugins/chartsPlugin.js";
|
|
97
|
+
|
|
98
|
+
const App = () => {
|
|
99
|
+
return (
|
|
100
|
+
<ReactiveJsonRoot
|
|
101
|
+
rjBuild={rjBuildConfig}
|
|
102
|
+
plugins={[
|
|
103
|
+
uiPlugin,
|
|
104
|
+
formPlugin,
|
|
105
|
+
chartsPlugin
|
|
106
|
+
]}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Plugin Development Patterns
|
|
113
|
+
|
|
114
|
+
### Standalone Plugin
|
|
115
|
+
|
|
116
|
+
For single-purpose plugins with a few related components:
|
|
117
|
+
|
|
118
|
+
```javascript
|
|
119
|
+
export const simplePlugin = {
|
|
120
|
+
element: {
|
|
121
|
+
Alert: AlertComponent,
|
|
122
|
+
Badge: BadgeComponent,
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Best Practices
|
|
128
|
+
|
|
129
|
+
### Plugin Organization
|
|
130
|
+
1. **Group related components** in the same plugin
|
|
131
|
+
2. **Use descriptive names** for components and plugins
|
|
132
|
+
3. **Document component props** and usage patterns
|
|
133
|
+
4. **Provide examples** for complex components
|
|
134
|
+
|
|
135
|
+
### Distribution
|
|
136
|
+
1. **Package as npm modules** for easy distribution
|
|
137
|
+
2. **Include TypeScript definitions** if using TypeScript
|
|
138
|
+
3. **Provide clear documentation** and examples
|
|
139
|
+
4. **Follow semantic versioning** for releases
|
|
140
|
+
|
|
141
|
+
### Performance
|
|
142
|
+
1. **Lazy load large plugins** when possible
|
|
143
|
+
2. **Avoid global state** in plugin components
|
|
144
|
+
3. **Use React best practices** for component implementation
|
|
145
|
+
4. **Test plugin compatibility** with different Reactive-JSON versions
|
|
146
|
+
|
|
147
|
+
templates:
|
|
@@ -1,12 +1,66 @@
|
|
|
1
1
|
renderView:
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# Reactive-JSON Documentation
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
content: Demo pages
|
|
6
|
+
Welcome to the comprehensive documentation for **Reactive-JSON** - a powerful library that transforms JSON configurations into interactive React components.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
## What is Reactive-JSON?
|
|
9
|
+
|
|
10
|
+
Reactive-JSON is a declarative framework that allows you to build dynamic, interactive user interfaces using simple JSON or YAML configurations. No JavaScript boilerplate, no complex state management - just pure declarative power.
|
|
11
|
+
|
|
12
|
+
- type: Markdown
|
|
13
|
+
content: |
|
|
14
|
+
## Key Features
|
|
15
|
+
|
|
16
|
+
- **🎯 Declarative**: Define your UI structure and behavior in JSON/YAML
|
|
17
|
+
- **⚡ Reactive**: Automatic state management and data binding
|
|
18
|
+
- **🔧 Extensible**: Rich set of built-in components and actions
|
|
19
|
+
- **📱 Bootstrap Ready**: Seamlessly integrates with Bootstrap styling
|
|
20
|
+
- **🎨 Flexible**: Support for custom components and styling
|
|
21
|
+
- **📊 Data-Driven**: Built-in data operations and API integration
|
|
22
|
+
|
|
23
|
+
## Documentation Sections
|
|
24
|
+
|
|
25
|
+
### Core Components
|
|
26
|
+
|
|
27
|
+
- **Elements** - Form fields, HTML elements, and special components
|
|
28
|
+
- Form Fields - Input fields, selects, checkboxes, etc.
|
|
29
|
+
- HTML Elements - Divs, modals, accordions, syntax highlighting, etc.
|
|
30
|
+
- Special Elements - Advanced components like data filters, pagination, etc.
|
|
31
|
+
|
|
32
|
+
- **Actions** - Interactive behaviors and UI modifications
|
|
33
|
+
- Control element visibility, tooltips, redirects, and event handling
|
|
34
|
+
|
|
35
|
+
- **Reactions** - Data operations and side effects
|
|
36
|
+
- Fetch data, submit forms, manipulate state, and trigger events
|
|
37
|
+
|
|
38
|
+
### Examples & Tutorials
|
|
39
|
+
|
|
40
|
+
- **Complete Examples** - Real-world use cases and patterns
|
|
41
|
+
- Interactive forms, dynamic content, website layouts, and more
|
|
42
|
+
|
|
43
|
+
### Extensions
|
|
44
|
+
|
|
45
|
+
- **Component Development** - Create custom components
|
|
46
|
+
- **Plugin System** - Extend Reactive-JSON functionality
|
|
47
|
+
|
|
48
|
+
### Integrations
|
|
49
|
+
|
|
50
|
+
- **Chart.js Integration** - Create interactive charts and visualizations
|
|
51
|
+
|
|
52
|
+
- type: Markdown
|
|
53
|
+
content: |
|
|
54
|
+
## Getting Started
|
|
55
|
+
|
|
56
|
+
1. **Explore the Examples** - Check out the complete examples to see Reactive-JSON in action
|
|
57
|
+
2. **Learn the Basics** - Start with form elements and actions
|
|
58
|
+
3. **Try Interactive Features** - Experiment with reactions for data operations
|
|
59
|
+
4. **Build Something** - Use the documentation as your guide to create your first Reactive-JSON application
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
**Ready to build something amazing?** Pick a section from the sidebar and start exploring!
|
|
10
64
|
|
|
11
65
|
templates:
|
|
12
66
|
|