@ea-lab/reactive-json-docs 0.1.6 → 0.1.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ea-lab/reactive-json-docs",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
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": [
@@ -190,4 +190,17 @@ export const MyAction = (props) => {
190
190
  ### Integration Requirements
191
191
  - Components must accept props in the standard format
192
192
  - Form components should implement proper data binding
193
- - Action components should not interfere with normal rendering
193
+ - Action components should not interfere with normal rendering
194
+
195
+ ## Making Your Components Available
196
+
197
+ Now that you've learned how to create custom React components that integrate seamlessly with Reactive-JSON, the next step is understanding how to make them available in your applications.
198
+
199
+ Your custom components need to be registered through the plugin system. For complete guidance on plugin registration, organization, and advanced management patterns, continue to the dedicated [Plugin System Guide](plugin-system).
200
+
201
+ This guide will show you how to:
202
+ - Register your components using the plugin system
203
+ - Organize and structure your plugins effectively
204
+ - Combine multiple plugin sources seamlessly
205
+ - Create reusable plugin collections
206
+ - Handle complex plugin dependencies and distribution patterns
@@ -210,6 +210,19 @@ renderView:
210
210
  - Form components should implement proper data binding
211
211
  - Action components should not interfere with normal rendering
212
212
 
213
+ ## Making Your Components Available
214
+
215
+ Now that you've learned how to create custom React components that integrate seamlessly with Reactive-JSON, the next step is understanding how to make them available in your applications.
216
+
217
+ Your custom components need to be registered through the plugin system. For complete guidance on plugin registration, organization, and advanced management patterns, continue to the dedicated [Plugin System Guide](plugin-system).
218
+
219
+ This guide will show you how to:
220
+ - Register your components using the plugin system
221
+ - Organize and structure your plugins effectively
222
+ - Combine multiple plugin sources seamlessly
223
+ - Create reusable plugin collections
224
+ - Handle complex plugin dependencies and distribution patterns
225
+
213
226
  templates:
214
227
 
215
228
  data: {}
@@ -39,25 +39,23 @@ export const myPlugin = {
39
39
  Then, register the plugin with the ReactiveJsonRoot component:
40
40
 
41
41
  ```jsx
42
- import { ReactiveJsonRoot } from "@ea-lab/reactive-json";
42
+ import { ReactiveJsonRoot, mergeComponentCollections } from "@ea-lab/reactive-json";
43
43
  import { myPlugin } from "./plugins/myPlugin.js";
44
44
 
45
45
  const App = () => {
46
46
  return (
47
47
  <ReactiveJsonRoot
48
- plugins={[myPlugin]}
48
+ plugins={mergeComponentCollections([myPlugin])}
49
49
  />
50
50
  );
51
51
  };
52
52
  ```
53
53
 
54
- The plugin is now available throughout the application.
55
-
56
54
  You can now use the components in your RjBuild configuration:
57
55
 
58
56
  ```jsx
59
57
  import React from 'react';
60
- import { ReactiveJsonRoot } from "@ea-lab/reactive-json";
58
+ import { ReactiveJsonRoot, mergeComponentCollections } from "@ea-lab/reactive-json";
61
59
  import { myPlugin } from "./plugins/myPlugin.js";
62
60
 
63
61
  const App = () => {
@@ -75,7 +73,7 @@ const App = () => {
75
73
  return (
76
74
  <ReactiveJsonRoot
77
75
  rjBuild={rjBuildConfig}
78
- plugins={[myPlugin]}
76
+ plugins={mergeComponentCollections([myPlugin])}
79
77
  />
80
78
  );
81
79
  };
@@ -83,60 +81,93 @@ const App = () => {
83
81
 
84
82
  The plugin is now available throughout the application.
85
83
 
86
- ## Multi-Plugin Application
84
+ ## Multi-Plugin Application & Plugin Merging
87
85
 
88
- Applications can use multiple plugins, allowing for modular component organization.
86
+ When your application needs multiple plugins from different sources, you can combine them using `mergeComponentCollections`.
87
+
88
+ ### Multiple Plugin Usage
89
89
 
90
90
  ```jsx
91
- import { uiPlugin } from "./plugins/uiPlugin.js";
92
- import { formPlugin } from "./plugins/formPlugin.js";
93
- import { chartsPlugin } from "./plugins/chartsPlugin.js";
91
+ import { ReactiveJsonRoot, mergeComponentCollections } from "@ea-lab/reactive-json";
92
+ import { chartjsComponents } from "@ea-lab/reactive-json-chartjs";
93
+ import { customPlugins } from "./plugins/customPlugins.js";
94
+ import { thirdPartyPlugin } from "third-party-reactive-json-plugin";
94
95
 
95
96
  const App = () => {
96
97
  return (
97
98
  <ReactiveJsonRoot
98
99
  rjBuild={rjBuildConfig}
99
- plugins={[
100
- uiPlugin,
101
- formPlugin,
102
- chartsPlugin
103
- ]}
100
+ plugins={mergeComponentCollections([
101
+ chartjsComponents,
102
+ customPlugins,
103
+ thirdPartyPlugin
104
+ ])}
104
105
  />
105
106
  );
106
107
  };
107
108
  ```
108
109
 
109
- ## Plugin Development Patterns
110
+ ### Custom ReactiveJsonRoot Wrapper
110
111
 
111
- ### Standalone Plugin
112
+ 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.
112
113
 
113
- For single-purpose plugins with a few related components:
114
+ #### Benefits of Centralized Plugin Management
114
115
 
115
- ```javascript
116
- export const simplePlugin = {
117
- element: {
118
- Alert: AlertComponent,
119
- Badge: BadgeComponent,
120
- }
116
+ - **Consistency**: Ensures all parts of your application have access to the same set of components
117
+ - **Maintainability**: Update plugin dependencies in one place
118
+ - **Simplicity**: Other components only need to import your wrapper, not individual plugins
119
+ - **Standardization**: Enforces a consistent plugin configuration across teams
120
+
121
+ #### Implementation Example
122
+
123
+ ```jsx
124
+ import { ReactiveJsonRoot, mergeComponentCollections } from "@ea-lab/reactive-json";
125
+ import { chartjsComponents } from "@ea-lab/reactive-json-chartjs";
126
+ import { customPlugins } from "./plugins/customPlugins.js";
127
+ import { companyUIComponents } from "@company/reactive-json-ui";
128
+
129
+ export const CustomReactiveJsonRoot = (props) => {
130
+ const additionalProps = {};
131
+
132
+ // Centralize all plugin dependencies for the entire application
133
+ additionalProps.plugins = mergeComponentCollections([
134
+ chartjsComponents, // Third-party charting components
135
+ customPlugins, // Application-specific components
136
+ companyUIComponents // Company-wide design system
137
+ ]);
138
+
139
+ const finalProps = { ...props, ...additionalProps };
140
+
141
+ return <ReactiveJsonRoot {...finalProps} />;
142
+ };
143
+ ```
144
+
145
+ #### Usage Across Your Application
146
+
147
+ Once created, your wrapper simplifies usage throughout your application:
148
+
149
+ ```jsx
150
+ import { CustomReactiveJsonRoot } from "./components/CustomReactiveJsonRoot";
151
+
152
+ // Component A
153
+ export const Dashboard = () => {
154
+ return (
155
+ <CustomReactiveJsonRoot rjBuild={dashboardConfig} />
156
+ );
157
+ };
158
+
159
+ // Component B
160
+ export const ReportPage = () => {
161
+ return (
162
+ <CustomReactiveJsonRoot rjBuild={reportConfig} />
163
+ );
121
164
  };
122
165
  ```
123
166
 
124
167
  ## Best Practices
125
168
 
126
- ### Plugin Organization
127
169
  1. **Group related components** in the same plugin
128
170
  2. **Use descriptive names** for components and plugins
129
171
  3. **Document component props** and usage patterns
130
172
  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
173
+ 5. **Choose non-conflicting names** with existing components
@@ -22,7 +22,9 @@ renderView:
22
22
 
23
23
  First, regroup your components in a plugin object.
24
24
 
25
- ```jsx
25
+ - type: SyntaxHighlighter
26
+ language: jsx
27
+ content: |
26
28
  // myPlugin.js
27
29
  import { MyButton } from "./components/MyButton.jsx";
28
30
  import { MyForm } from "./components/MyForm.jsx";
@@ -37,111 +39,158 @@ renderView:
37
39
  MyAction,
38
40
  }
39
41
  };
40
- ```
41
42
 
43
+ - type: Markdown
44
+ content: |
42
45
  Then, register the plugin with the ReactiveJsonRoot component:
43
46
 
44
- ```jsx
45
- import { ReactiveJsonRoot } from "@ea-lab/reactive-json";
47
+ - type: SyntaxHighlighter
48
+ language: jsx
49
+ content: |
50
+ import { ReactiveJsonRoot, mergeComponentCollections } from "@ea-lab/reactive-json";
46
51
  import { myPlugin } from "./plugins/myPlugin.js";
47
52
 
48
53
  const App = () => {
49
54
  return (
50
55
  <ReactiveJsonRoot
51
- plugins={[myPlugin]}
56
+ plugins={mergeComponentCollections([myPlugin])}
52
57
  />
53
58
  );
54
59
  };
55
- ```
56
-
57
- The plugin is now available throughout the application.
58
60
 
61
+ - type: Markdown
62
+ content: |
59
63
  You can now use the components in your RjBuild configuration:
60
64
 
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
- ```
65
+ - type: SyntaxHighlighter
66
+ language: jsx
67
+ content: |
68
+ import React from 'react';
69
+ import { ReactiveJsonRoot, mergeComponentCollections } from "@ea-lab/reactive-json";
70
+ import { myPlugin } from "./plugins/myPlugin.js";
71
+
72
+ const App = () => {
73
+ const rjBuildConfig = {
74
+ renderView: [
75
+ {
76
+ type: "MyButton",
77
+ content: "Click me!",
78
+ customProperty: "some value"
79
+ }
80
+ ],
81
+ data: {}
82
+ };
83
+
84
+ return (
85
+ <ReactiveJsonRoot
86
+ rjBuild={rjBuildConfig}
87
+ plugins={mergeComponentCollections([myPlugin])}
88
+ />
89
+ );
90
+ };
86
91
 
92
+ - type: Markdown
93
+ content: |
87
94
  The plugin is now available throughout the application.
88
95
 
89
- ## Multi-Plugin Application
90
-
91
- Applications can use multiple plugins, allowing for modular component organization.
96
+ ## Multi-Plugin Application & Plugin Merging
97
+
98
+ When your application needs multiple plugins from different sources, you can combine them using `mergeComponentCollections`.
99
+
100
+ ### Multiple Plugin Usage
92
101
 
93
- ```jsx
94
- import { uiPlugin } from "./plugins/uiPlugin.js";
95
- import { formPlugin } from "./plugins/formPlugin.js";
96
- import { chartsPlugin } from "./plugins/chartsPlugin.js";
102
+ - type: SyntaxHighlighter
103
+ language: jsx
104
+ content: |
105
+ import { ReactiveJsonRoot, mergeComponentCollections } from "@ea-lab/reactive-json";
106
+ import { chartjsComponents } from "@ea-lab/reactive-json-chartjs";
107
+ import { customPlugins } from "./plugins/customPlugins.js";
108
+ import { thirdPartyPlugin } from "third-party-reactive-json-plugin";
97
109
 
98
110
  const App = () => {
99
111
  return (
100
112
  <ReactiveJsonRoot
101
113
  rjBuild={rjBuildConfig}
102
- plugins={[
103
- uiPlugin,
104
- formPlugin,
105
- chartsPlugin
106
- ]}
114
+ plugins={mergeComponentCollections([
115
+ chartjsComponents,
116
+ customPlugins,
117
+ thirdPartyPlugin
118
+ ])}
107
119
  />
108
120
  );
109
121
  };
110
- ```
111
122
 
112
- ## Plugin Development Patterns
123
+ - type: Markdown
124
+ content: |
125
+ ### Custom ReactiveJsonRoot Wrapper
126
+
127
+ 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.
128
+
129
+ #### Benefits of Centralized Plugin Management
130
+
131
+ - **Consistency**: Ensures all parts of your application have access to the same set of components
132
+ - **Maintainability**: Update plugin dependencies in one place
133
+ - **Simplicity**: Other components only need to import your wrapper, not individual plugins
134
+ - **Standardization**: Enforces a consistent plugin configuration across teams
135
+
136
+ #### Implementation Example
137
+
138
+ - type: SyntaxHighlighter
139
+ language: jsx
140
+ content: |
141
+ import { ReactiveJsonRoot, mergeComponentCollections } from "@ea-lab/reactive-json";
142
+ import { chartjsComponents } from "@ea-lab/reactive-json-chartjs";
143
+ import { customPlugins } from "./plugins/customPlugins.js";
144
+ import { companyUIComponents } from "@company/reactive-json-ui";
145
+
146
+ export const CustomReactiveJsonRoot = (props) => {
147
+ const additionalProps = {};
148
+
149
+ // Centralize all plugin dependencies for the entire application
150
+ additionalProps.plugins = mergeComponentCollections([
151
+ chartjsComponents, // Third-party charting components
152
+ customPlugins, // Application-specific components
153
+ companyUIComponents // Company-wide design system
154
+ ]);
155
+
156
+ const finalProps = { ...props, ...additionalProps };
157
+
158
+ return <ReactiveJsonRoot {...finalProps} />;
159
+ };
160
+
161
+ - type: Markdown
162
+ content: |
163
+ #### Usage Across Your Application
164
+
165
+ Once created, your wrapper simplifies usage throughout your application:
113
166
 
114
- ### Standalone Plugin
167
+ - type: SyntaxHighlighter
168
+ language: jsx
169
+ content: |
170
+ import { CustomReactiveJsonRoot } from "./components/CustomReactiveJsonRoot";
115
171
 
116
- For single-purpose plugins with a few related components:
172
+ // Component A
173
+ export const Dashboard = () => {
174
+ return (
175
+ <CustomReactiveJsonRoot rjBuild={dashboardConfig} />
176
+ );
177
+ };
117
178
 
118
- ```javascript
119
- export const simplePlugin = {
120
- element: {
121
- Alert: AlertComponent,
122
- Badge: BadgeComponent,
123
- }
179
+ // Component B
180
+ export const ReportPage = () => {
181
+ return (
182
+ <CustomReactiveJsonRoot rjBuild={reportConfig} />
183
+ );
124
184
  };
125
- ```
126
185
 
186
+ - type: Markdown
187
+ content: |
127
188
  ## Best Practices
128
189
 
129
- ### Plugin Organization
130
190
  1. **Group related components** in the same plugin
131
191
  2. **Use descriptive names** for components and plugins
132
192
  3. **Document component props** and usage patterns
133
193
  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
194
+ 5. **Choose non-conflicting names** with existing components
146
195
 
147
196
  templates: