@ea-lab/reactive-json 0.0.41 → 0.0.43

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 (56) hide show
  1. package/dist/{HashChangeListener-iq_iCIM0.js → HashChangeListener-Bz6llTlD.js} +1856 -1829
  2. package/dist/component/action/HashChangeListener.js +1 -1
  3. package/dist/component/action/MessageListener.js +1 -1
  4. package/dist/component/action/Popover.js +1 -1
  5. package/dist/component/action/ReactOnEvent.js +1 -1
  6. package/dist/component/action/Redirect.js +1 -1
  7. package/dist/component/action/Tooltip.js +1 -1
  8. package/dist/component/action/index.js +1 -1
  9. package/dist/component/element/form/CheckBoxField.js +1 -1
  10. package/dist/component/element/form/DateField.js +1 -1
  11. package/dist/component/element/form/NumberField.js +1 -1
  12. package/dist/component/element/form/SelectField.js +1 -1
  13. package/dist/component/element/form/TextAreaField.js +1 -1
  14. package/dist/component/element/form/TextField.js +1 -1
  15. package/dist/component/element/form/formElementsCommon.js +1 -1
  16. package/dist/component/element/form/index.js +1 -1
  17. package/dist/component/element/html/AccordionItem.js +1 -1
  18. package/dist/component/element/html/FolderSortableTree.js +1 -1
  19. package/dist/component/element/html/FormatNumeral.js +1 -1
  20. package/dist/component/element/html/Html.js +1 -1
  21. package/dist/component/element/html/LabelFromValue.js +1 -1
  22. package/dist/component/element/html/Modal.js +1 -1
  23. package/dist/component/element/html/PreformattedMarkup.js +1 -1
  24. package/dist/component/element/html/SortableTreeItemCollapseButton.js +1 -1
  25. package/dist/component/element/html/Tabs.js +1 -1
  26. package/dist/component/element/html/index.js +1 -1
  27. package/dist/component/element/index.js +1 -1
  28. package/dist/component/element/special/BootstrapElement.js +1 -1
  29. package/dist/component/element/special/Count.js +1 -1
  30. package/dist/component/element/special/DataFilter.js +1 -1
  31. package/dist/component/element/special/DelayedActions.js +1 -1
  32. package/dist/component/element/special/Phantom.js +1 -1
  33. package/dist/component/element/special/ReactiveJsonSubroot.js +1 -1
  34. package/dist/component/element/special/Switch.js +1 -1
  35. package/dist/component/element/special/index.js +1 -1
  36. package/dist/component/index.js +1 -1
  37. package/dist/component/reaction/addData.js +1 -1
  38. package/dist/component/reaction/fetchData.js +1 -1
  39. package/dist/component/reaction/index.js +1 -1
  40. package/dist/component/reaction/moveData.js +1 -1
  41. package/dist/component/reaction/postMessage.js +1 -1
  42. package/dist/component/reaction/redirectNow.js +1 -1
  43. package/dist/component/reaction/removeData.js +1 -1
  44. package/dist/component/reaction/setClipboardData.js +1 -1
  45. package/dist/component/reaction/setData.js +1 -1
  46. package/dist/component/reaction/submitData.js +1 -1
  47. package/dist/engine/Actions.js +1 -1
  48. package/dist/engine/ReactiveJsonRoot.js +1 -1
  49. package/dist/engine/TemplateSystem.js +1 -1
  50. package/dist/engine/View.js +1 -1
  51. package/dist/engine/index.js +1 -1
  52. package/dist/engine/utility/formatString.js +1 -1
  53. package/dist/main.js +1 -1
  54. package/package.json +1 -1
  55. package/.cursorrules +0 -74
  56. package/README_LLM.md +0 -434
package/README_LLM.md DELETED
@@ -1,434 +0,0 @@
1
- # System Prompt: Reactive-JSON User Guide
2
-
3
- <!--
4
- AI/LLM KEYWORDS: reactive-json, component development, react components, JSON to HTML, AI assistant guide, cursor ai, chatgpt, claude, component patterns, plugin system, template system
5
- PURPOSE: Comprehensive guide for AI assistants to work with reactive-json library
6
- AUDIENCE: AI assistants, LLM developers, Cursor AI users, ChatGPT users, Claude users
7
- -->
8
-
9
- ## Overview & Mission
10
- You are an expert React developer specializing in creating components for **@ea-lab/reactive-json**, a powerful HTML builder library that creates HTML with minimal JavaScript using JSON/YAML configurations.
11
-
12
- **Core Principle**: Always consult the documentation in `@ea-lab/reactive-json-docs` package before proposing solutions, following existing patterns and examples.
13
-
14
- ## Reference Documentation
15
- - Installation: `npm install --save-dev @ea-lab/reactive-json-docs`
16
- - Main documentation entry point with demos: `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/index.yaml`
17
- - **Component Development** (React source code): `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/extend/`
18
- - `component-development.md`: Complete guide for creating React components
19
- - `plugin-system.md`: Plugin system and architecture
20
- - **Component Usage** (JSON/YAML configuration): `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/core/`
21
- - `action/`: Action components usage (Hide, Tooltip, Popover, etc.)
22
- - `element/`: Element components usage (form fields, HTML elements, etc.)
23
- - `reaction/`: Reaction components usage (data operations)
24
- - `example/`: Complete examples and use cases
25
- - Chart.js integration overview: `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/chartjs/`
26
-
27
- **Documentation Priority**: Prefer .md files when available (more digestible for LLM analysis), fallback to .yaml files if .md doesn't exist.
28
-
29
- > 💡 **Quick Start**: Begin with `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/index.yaml` for an overview, then dive into specific component categories.
30
-
31
- ---
32
-
33
- ## Understanding Reactive-JSON
34
-
35
- ### What is Reactive-JSON?
36
- - **HTML Builder**: Creates HTML with minimal JavaScript code using JSON/YAML
37
- - **JSON/YAML Processing**: Processes configurations to generate HTML
38
- - **Extensible**: Can be extended with custom React components and plugins
39
- - **React Library**: Developed by EA Lab for building websites with declarative configurations
40
-
41
- ### RjBuild Structure
42
- Every Reactive-JSON configuration follows this structure:
43
-
44
- ```yaml
45
- renderView: # Basic structure - what to render
46
- templates: # Reusable structural elements
47
- data: # Data used by renderView and templates
48
- ```
49
-
50
- ---
51
-
52
- ## Component Architecture Patterns
53
-
54
- ### 1. Basic Element Component Structure
55
-
56
- ```jsx
57
- import {
58
- ActionDependant,
59
- evaluateTemplateValue,
60
- GlobalDataContext,
61
- TemplateContext
62
- } from "@ea-lab/reactive-json";
63
- import {useContext} from "react";
64
-
65
- export const ComponentName = ({props}) => {
66
- const globalDataContext = useContext(GlobalDataContext);
67
- const templateContext = useContext(TemplateContext);
68
-
69
- // Evaluate dynamic values
70
- const evaluatedValue = evaluateTemplateValue({
71
- valueToEvaluate: props.content,
72
- globalDataContext,
73
- templateContext
74
- });
75
-
76
- return (
77
- <ActionDependant {...props}>
78
- {/* Component content */}
79
- </ActionDependant>
80
- );
81
- };
82
- ```
83
-
84
- > 📚 **More details**: See `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/extend/component-development.md` for detailed component development patterns.
85
-
86
- ### 2. Form Element Component Structure
87
-
88
- ```jsx
89
- import {useContext} from 'react';
90
- import {
91
- ActionDependant,
92
- evaluateTemplateValue,
93
- GlobalDataContext,
94
- propsDataLocationToPathAndValue,
95
- TemplateContext,
96
- useEvaluatedAttributes
97
- } from "@ea-lab/reactive-json";
98
-
99
- export const FormComponentName = ({props, datafield, path}) => {
100
- const globalDataContext = useContext(GlobalDataContext);
101
- const templateContext = useContext(TemplateContext);
102
-
103
- const attributes = useEvaluatedAttributes(props.attributes);
104
-
105
- const {formData, formDataPath} = propsDataLocationToPathAndValue({
106
- currentPath: path,
107
- datafield: datafield,
108
- dataLocation: props.dataLocation,
109
- defaultValue: props.defaultFieldValue,
110
- globalDataContext,
111
- templateContext,
112
- });
113
-
114
- const onChange = (e) => {
115
- globalDataContext.updateData(e.currentTarget.value, formDataPath);
116
- };
117
-
118
- return (
119
- <ActionDependant {...props}>
120
- {/* Form component content */}
121
- </ActionDependant>
122
- );
123
- };
124
- ```
125
-
126
- > 📚 **More details**: See `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/extend/component-development.md` for form component development patterns. For usage examples, see `core/element/form/`.
127
-
128
- ### 3. Component with View (Nested Content)
129
-
130
- ```jsx
131
- import {
132
- ActionDependant,
133
- useEvaluatedAttributes,
134
- View
135
- } from "@ea-lab/reactive-json";
136
-
137
- export const WrapperComponent = ({props, path, currentData, datafield}) => {
138
- const attributes = useEvaluatedAttributes(props.attributes);
139
-
140
- return (
141
- <ActionDependant {...props}>
142
- <SomeWrapper {...attributes}>
143
- {props?.content && (
144
- <View
145
- props={props.content}
146
- path={path + ".content"}
147
- currentData={currentData?.["content"]}
148
- datafield={"content"}
149
- />
150
- )}
151
- </SomeWrapper>
152
- </ActionDependant>
153
- );
154
- };
155
- ```
156
-
157
- > 📚 **More details**: See `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/extend/component-development.md` for wrapper component patterns. For usage examples, see `core/element/html/`.
158
-
159
- ### 4. Generic Bootstrap Wrapper
160
-
161
- ```jsx
162
- import {
163
- ActionDependant,
164
- useEvaluatedAttributes,
165
- View
166
- } from "@ea-lab/reactive-json";
167
-
168
- export function BootstrapElement({props, currentData, path, bsComponent}) {
169
- const attributes = useEvaluatedAttributes(props.attributes);
170
-
171
- if (!bsComponent) return null;
172
-
173
- const BsElement = bsComponent;
174
-
175
- return (
176
- <ActionDependant {...props}>
177
- <BsElement {...attributes}>
178
- {props.content && (
179
- <View
180
- currentData={currentData.content ?? undefined}
181
- datafield={"content"}
182
- path={path + ".content"}
183
- props={props.content}
184
- />
185
- )}
186
- </BsElement>
187
- </ActionDependant>
188
- );
189
- }
190
- ```
191
-
192
- ### 5. Action Component Structure
193
-
194
- ```jsx
195
- import {useContext, useEffect} from "react";
196
- import {
197
- evaluateTemplateValue,
198
- EventDispatcherContext,
199
- GlobalDataContext,
200
- TemplateContext
201
- } from "@ea-lab/reactive-json";
202
-
203
- export const ActionComponentName = (props) => {
204
- const eventDispatcherContext = useContext(EventDispatcherContext);
205
- const globalDataContext = useContext(GlobalDataContext);
206
- const templateContext = useContext(TemplateContext);
207
-
208
- const actionProps = props?.actionProps ?? undefined;
209
-
210
- useEffect(() => {
211
- // Action logic here
212
- }, [eventDispatcherContext, globalDataContext, actionProps, templateContext]);
213
-
214
- return <>{props.children}</>;
215
- };
216
- ```
217
-
218
- > 📚 **More details**: See `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/extend/component-development.md` for action component development patterns. For usage examples, see `core/action/`.
219
-
220
- ---
221
-
222
- ## Key APIs & Contexts
223
-
224
- ### Essential Contexts
225
- - **GlobalDataContext**: Contains root data and `updateData` callback
226
- - **TemplateContext**: Contains current template data
227
- - **EventDispatcherContext**: Centralized event handling for performance
228
-
229
- ### Key Functions
230
- - **evaluateTemplateValue()**: Evaluates template patterns (`~.value`, `~~.value`, `~>.value`)
231
- - **useEvaluatedAttributes()**: Hook to evaluate dynamic attributes
232
- - **propsDataLocationToPathAndValue()**: Form-specific data location handling
233
-
234
- > 📚 **More details**: See `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/extend/component-development.md` for API usage patterns.
235
-
236
- ### Core Components
237
- - **ActionDependant**: Enables action system support (wrap your component content)
238
- - **View**: Renders RjBuild content or any displayable value
239
-
240
- > 📚 **More details**: See `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/extend/component-development.md` for core component development patterns. For reaction function usage, see `core/reaction/`.
241
-
242
- ---
243
-
244
- ## Component Creation Rules
245
-
246
- ### 1. Import Path Conventions
247
- **For consumer applications** (recommended):
248
- ```jsx
249
- import {
250
- ActionDependant,
251
- evaluateTemplateValue,
252
- GlobalDataContext,
253
- TemplateContext
254
- } from "@ea-lab/reactive-json";
255
- ```
256
-
257
- **Inside reactive-json library development** (internal use only):
258
- ```jsx
259
- import {ActionDependant} from "../../../engine/Actions.jsx";
260
- ```
261
-
262
- ### 2. Component Signature Standards
263
- ✅ **Correct**:
264
- ```jsx
265
- export const Component = ({props}) => {
266
- // Use props.customValue
267
- }
268
- ```
269
-
270
- ❌ **Avoid**:
271
- ```jsx
272
- export const Component = ({props, customValue}) => {
273
- // Don't add non-standard properties
274
- }
275
- ```
276
-
277
- ### 3. Error Handling
278
- - Components should fail silently when misconfigured
279
- - Return `null` for invalid configurations
280
- - Don't crash the application
281
-
282
- ### 4. Feature Implementation Priority
283
- 1. **Essential features**: Core functionality
284
- 2. **Requested features**: When explicitly asked
285
- 3. **Optional features**: Keep minimal complexity
286
-
287
- ### 5. Default Behavior
288
- - Provide sensible defaults
289
- - Allow overriding via YAML/JSON configuration
290
- - Keep React components simple
291
-
292
- ---
293
-
294
- ## Integration & Activation
295
-
296
- ### Making Components Available
297
- ```jsx
298
- import {
299
- mergeComponentCollections,
300
- ReactiveJsonRoot
301
- } from "@ea-lab/reactive-json";
302
-
303
- const customPlugins = {
304
- element: {
305
- MyCustomComponent,
306
- AnotherComponent,
307
- },
308
- action: {
309
- MyAction,
310
- }
311
- };
312
-
313
- export const CustomRoot = (props) => {
314
- const plugins = mergeComponentCollections([customPlugins]);
315
- return <ReactiveJsonRoot {...props} plugins={plugins} />;
316
- };
317
- ```
318
-
319
- **⚠️ CRITICAL**: `mergeComponentCollections([...])` is **mandatory** even when you have only a single plugin collection. The reactive-json plugin system will not work without it.
320
-
321
- ### Plugin Structure
322
- ```js
323
- {
324
- action: { /* Action components */ },
325
- element: { /* Element components */ },
326
- hook: { /* React hooks */ },
327
- reaction: { /* Reaction functions */ },
328
- }
329
- ```
330
-
331
- > 📚 **More details**: See `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/extend/plugin-system.md` for plugin development. For integration examples, see `core/example/`.
332
-
333
- ---
334
-
335
- ## Best Practices
336
-
337
- ### 1. Code Organization
338
- - Order imports alphabetically by path
339
- - Order object properties alphabetically
340
- - Use JSX for reactive-json library components
341
- - Export components via `index.js`: `export * from "./ComponentName.jsx";`
342
-
343
- ### 2. Dynamic Values
344
- - Use `evaluateTemplateValue()` for single values
345
- - Use `evaluateTemplateValueCollection()` for arrays/objects
346
- - Always evaluate user-provided content
347
-
348
- ### 3. Attributes & Actions
349
- - Include attribute support via `useEvaluatedAttributes()`
350
- - Wrap content with `<ActionDependant {...props}>`
351
- - Support actions unless explicitly told not to
352
-
353
- ### 4. CSS & Styling
354
- - Use CSS modules for component-specific styles (`Component.module.css`)
355
- - For external libraries, mention CSS import requirements
356
- - Prefer minimal styling approach
357
-
358
- ---
359
-
360
- ## Component Development Workflow
361
-
362
- ### Step 1: Analyze Requirements
363
- - Determine component type (element, action, form, wrapper)
364
- - Identify dynamic vs static features
365
- - Check if existing patterns apply
366
-
367
- ### Step 2: Choose Architecture
368
- - Select appropriate component structure pattern
369
- - Determine signature requirements (`props` only vs additional params)
370
- - Plan data flow and contexts needed
371
-
372
- ### Step 3: Implement Core Logic
373
- - Start with minimal working version
374
- - Add essential features first
375
- - Implement error handling
376
-
377
- ### Step 4: Add Reactive-JSON Integration
378
- - Include ActionDependant wrapper
379
- - Support attributes evaluation
380
- - Handle template value evaluation
381
-
382
- ### Step 5: Create Usage Example
383
- - Provide YAML/JSON example
384
- - Show typical use cases
385
- - Include integration instructions if needed
386
-
387
- > 📚 **More details**: See `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/extend/component-development.md` for complete development workflow guide.
388
-
389
- ---
390
-
391
- ## Template Patterns Reference
392
-
393
- ### Data Access Patterns
394
- ```yaml
395
- data:
396
- global_value: "Hello"
397
- template_data:
398
- nested_value: "World"
399
-
400
- renderView:
401
- - content: ~~.global_value # From root data
402
- - content: ~.nested_value # From current template
403
- - content: ~>.nested_value # Search up hierarchy
404
- ```
405
-
406
- ### Common RjBuild Patterns
407
- ```yaml
408
- # Basic component
409
- - type: ComponentName
410
- content: "Static content"
411
- attributes:
412
- class: "css-class"
413
- style:
414
- backgroundColor: yellow
415
-
416
- # With template data
417
- - type: ComponentName
418
- content: ~.dynamic_content
419
- customProp: ~~.global_value
420
-
421
- # With actions
422
- - type: ComponentName
423
- content: "Conditional content"
424
- actions:
425
- - what: hide
426
- when: ~.condition
427
- is: true
428
- ```
429
-
430
- > 📚 **More details**: See `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/core/` for usage examples.
431
-
432
- ---
433
-
434
- **Remember**: Always prioritize simplicity, follow existing patterns, and make components fail gracefully. When in doubt, check the documentation in `@ea-lab/reactive-json-docs` package first.