@ea-lab/reactive-json-docs 0.1.9 → 0.1.11

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.9",
3
+ "version": "0.1.11",
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,7 +26,7 @@
26
26
  "private": false,
27
27
  "devDependencies": {
28
28
  "@craco/craco": "^7.1.0",
29
- "@ea-lab/reactive-json": "^0.0.44",
29
+ "@ea-lab/reactive-json": "^0.0.45",
30
30
  "@ea-lab/reactive-json-chartjs": "^0.0.23",
31
31
  "@npmcli/fs": "^4.0.0",
32
32
  "@reduxjs/toolkit": "^2.6.1",
@@ -34,7 +34,7 @@ renderView:
34
34
  export const YourComponent = () => {
35
35
 
36
36
  const rjRootProps = {
37
- // Set your own props to rjRootProps such as dataUrl.
37
+ // Set your own props to rjRootProps such as rjBuildUrl.
38
38
  // ...
39
39
  };
40
40
 
@@ -5,7 +5,7 @@
5
5
  The `ReactiveJsonSubroot` component allows you to render a new Reactive-JSON root inside an existing application. It is useful for embedding a sub-application, isolating a part of the data tree, or rendering a separate rjbuild with its own options.
6
6
 
7
7
  ## Properties
8
- - `rjOptions` (object, required): Options to pass to the subroot (such as `dataUrl`, `data`, `renderView`, etc.)
8
+ - `rjOptions` (object, required): Options to pass to the subroot (such as `rjBuildUrl`, `data`, `renderView`, etc.)
9
9
  - Other properties are passed to the underlying `ReactiveJsonRoot`
10
10
 
11
11
  ## Behavior
@@ -19,7 +19,7 @@ The `ReactiveJsonSubroot` component allows you to render a new Reactive-JSON roo
19
19
  renderView:
20
20
  - type: ReactiveJsonSubroot
21
21
  rjOptions:
22
- dataUrl: "/rjs-build/home.yaml"
22
+ rjBuildUrl: "/rjs-build/home.yaml"
23
23
  ```
24
24
 
25
25
  ## Limitations
@@ -6,7 +6,7 @@ renderView:
6
6
  The `ReactiveJsonSubroot` component allows you to render a new Reactive-JSON root inside an existing application. It is useful for embedding a sub-application, isolating a part of the data tree, or rendering a separate rjbuild with its own options.
7
7
 
8
8
  ## Properties
9
- - `rjOptions` (object, required): Options to pass to the subroot (such as `dataUrl`, `data`, `renderView`, etc.)
9
+ - `rjOptions` (object, required): Options to pass to the subroot (such as `rjBuildUrl`, `data`, `renderView`, etc.)
10
10
  - Other properties are passed to the underlying `ReactiveJsonRoot`
11
11
 
12
12
  ## Behavior
@@ -22,16 +22,16 @@ renderView:
22
22
  renderView:
23
23
  - type: ReactiveJsonSubroot
24
24
  rjOptions:
25
- dataUrl: "/rjbuild/component/message.yaml"
25
+ rjBuildUrl: "/rjbuild/component/message.yaml"
26
26
 
27
27
  - type: RjBuildDescriber
28
28
  title: Example with inline JSON data
29
- description: This example demonstrates two approaches for using ReactiveJsonSubroot with inline data. The first shows passing JSON data directly as a string via maybeRawAppData. The second shows loading subroot options dynamically from the main RjBuild's data using template interpolation. Both approaches are useful for embedding sub-applications without external files.
29
+ description: This example demonstrates two approaches for using ReactiveJsonSubroot with inline data. The first shows passing JSON data directly as a string via maybeRawAppRjBuild. The second shows loading subroot options dynamically from the main RjBuild's data using template interpolation. Both approaches are useful for embedding sub-applications without external files.
30
30
  toDescribe:
31
31
  renderView:
32
32
  - type: ReactiveJsonSubroot
33
33
  rjOptions:
34
- maybeRawAppData: '{"data":{"userName":"Alice","messageCount":3},"renderView":[{"type":"div","attributes":{"style":{"padding":"1rem","border":"1px solid #ddd","borderRadius":"8px","backgroundColor":"#f9f9f9"}},"content":[{"type":"h3","content":"~~.userName"},{"type":"p","content":["You have ","~~.messageCount"," new messages."]},{"type":"button","content":"Mark as read","attributes":{"style":{"backgroundColor":"#007bff","color":"white","border":"none","padding":"0.5rem 1rem","borderRadius":"4px"}}}]}]}'
34
+ maybeRawAppRjBuild: '{"data":{"userName":"Alice","messageCount":3},"renderView":[{"type":"div","attributes":{"style":{"padding":"1rem","border":"1px solid #ddd","borderRadius":"8px","backgroundColor":"#f9f9f9"}},"content":[{"type":"h3","content":"~~.userName"},{"type":"p","content":["You have ","~~.messageCount"," new messages."]},{"type":"button","content":"Mark as read","attributes":{"style":{"backgroundColor":"#007bff","color":"white","border":"none","padding":"0.5rem 1rem","borderRadius":"4px"}}}]}]}'
35
35
 
36
36
  - type: hr
37
37
 
@@ -39,7 +39,7 @@ renderView:
39
39
  rjOptions: ~~.subrootToLoad
40
40
  data:
41
41
  subrootToLoad:
42
- maybeRawAppData:
42
+ maybeRawAppRjBuild:
43
43
  renderView:
44
44
  - type: div
45
45
  content: This second subroot is loaded from the "data" key of the main root.
@@ -2,83 +2,166 @@
2
2
 
3
3
  > **Tip**: In the interactive version of this documentation, a button is available to automatically copy the initialization prompt. Copy it and paste it into Cursor to start the step-by-step assistant.
4
4
 
5
- ## ⚠️ Important Rule
5
+ ## ⚠️ Important Rules
6
6
 
7
- **DO NOT SKIP STEPS** unless explicitly requested by the user. Each step is critical for the proper functioning of the project and must be executed in the defined order.
7
+ **NEVER SKIP STEPS** unless explicitly requested by the user. Each step is critical for the proper functioning of the project and must be executed in the defined chronological order.
8
+
9
+ When user feedback is required, wait for it and do not continue until this feedback is given.
10
+
11
+ Adapt commands according to the execution environment (Windows, Ubuntu, Mac...).
8
12
 
9
13
  ## Table of Contents
10
14
 
11
- 1. [Collecting User Information](#1-collecting-user-information)
12
- 2. [Documentation Repositories Setup](#2-documentation-repositories-setup)
13
- 3. [Cursor Workspace Configuration](#3-cursor-workspace-configuration)
14
- 4. [Vite Project Initialization](#4-vite-project-initialization)
15
- 5. [Dependencies Installation](#5-dependencies-installation)
16
- 6. [Cursor Rules Creation](#6-cursor-rules-creation)
17
- 7. [Generated Project Cleanup](#7-generated-project-cleanup)
18
- 8. [Basic Configuration with ReactiveJsonRoot](#8-basic-configuration-with-reactivejsonroot)
19
- 9. [Final Verification](#9-final-verification)
15
+ 1. [Project Directory Confirmation](#1-project-directory-confirmation)
16
+ 2. [Collecting User Information](#2-collecting-user-information)
17
+ 3. [Documentation Repositories Setup](#3-documentation-repositories-setup)
18
+ 4. [Cursor Workspace Configuration](#4-cursor-workspace-configuration)
19
+ 5. [Vite Project Initialization](#5-vite-project-initialization)
20
+ 6. [Project Structure Verification](#6-project-structure-verification)
21
+ 7. [Dependencies Installation](#7-dependencies-installation)
22
+ 8. [Cursor Project Rules Creation](#8-cursor-project-rules-creation)
23
+ 9. [Generated Project Cleanup](#9-generated-project-cleanup)
24
+ 10. [Basic Configuration with ReactiveJsonRoot](#10-basic-configuration-with-reactivejsonroot)
25
+ 11. [Routing Configuration (Optional)](#11-routing-configuration-optional)
26
+ 12. [Final Verification](#12-final-verification)
27
+
28
+ ## Chronological Steps
29
+
30
+ ### 1. Project Directory Confirmation
31
+
32
+ **Action:** Show the user if the IDE is opened in the directory where the project will
33
+ be initialized, then ask for confirmation:
34
+
35
+ - Execute the command:
36
+ ```bash
37
+ pwd
38
+ ```
39
+ - Show the user this info:
40
+ > **IMPORTANT: Directory Confirmation Required**
41
+ >
42
+ > **Current directory:** `[Display the result of pwd command]`
43
+ >
44
+ > **This directory will become your project root.** All project files will be created here.
45
+ - Ask the user for confirmation:
46
+ > **Do you confirm that this is the correct location before continuing?** If the location is wrong,
47
+ > please open in your IDE the location where the project will be created and restart the
48
+ > installation procedure.
49
+ - User feedback required.
50
+ - When user confirms, note the project directory as `<project_dir>` and go to the next step.
20
51
 
21
52
  ---
22
53
 
23
- ## 1. Collecting User Information
54
+ ### 2. Collecting User Information
24
55
 
25
- Ask the user for:
56
+ **Action:** Ask the user for the following information:
26
57
 
27
- - **Project name**
28
- - **TypeScript?** (yes/no)
29
- - **Documentation repositories location** (absolute path)
58
+ - **TypeScript**: Ask if the user wants to use TypeScript (yes/no)
59
+ - **Documentation repositories location**: Absolute path where to clone reactive-json and reactive-json-docs repositories. When the user gives a relative path, convert it to absolute
60
+ and ask for confirmation.
30
61
 
31
- Remember:
62
+ **Important:** For documentation location, **NEVER** place them in the current project directory. Propose by default: `~/cursor-docs/` or let the user specify another location outside the current project.
32
63
 
33
- | Variable | Description |
34
- | -------- | ----------- |
35
- | `<project_name>` | Project name |
36
- | `<use_typescript>` | `true` or `false` |
37
- | `<docs_location>` | Absolute path for repositories |
64
+ **Variables to remember:**
65
+ - `<use_typescript>`: true/false based on the answer
66
+ - `<docs_location>`: Absolute path for repositories (must be outside current directory)
67
+
68
+ **Validation:** Verify that `<docs_location>` is not within the current project directory.
69
+ When invalid, ask again the location with valid suggestions.
38
70
 
39
71
  ---
40
72
 
41
- ## 2. Documentation Repositories Setup
73
+ ### 3. Documentation Repositories Setup
74
+
75
+ **Action:** Clone the required documentation repositories
76
+
77
+ **Commands to execute:**
42
78
 
43
79
  ```bash
80
+ mkdir -p <docs_location>
44
81
  cd <docs_location>
45
82
  git clone https://github.com/Ealab-collab/reactive-json.git
46
83
  git clone https://github.com/Ealab-collab/reactive-json-docs.git
47
84
  ```
48
85
 
49
- > These repositories are used **only** for Cursor to index the documentation and will **not** be included in the final project.
86
+ **Important:** Explain to the user that these repositories are **only** for Cursor to index the documentation and will **not** be included in the final project.
50
87
 
51
- If repositories are already cloned, proceed directly to step 3.
88
+ **Note:** If the user indicates that the repositories are already cloned, proceed directly to step 4 (Cursor Workspace Configuration) as it is essential to add the folders to the workspace even if they already exist.
52
89
 
53
90
  ---
54
91
 
55
- ## 3. Cursor Workspace Configuration
92
+ ### 4. Cursor Workspace Configuration
56
93
 
57
- **Manual action required!**
94
+ **Action:** Ask the user to add repositories to the workspace
58
95
 
59
- 1. Open `File > Add Folder to Workspace`
60
- 2. Add `<docs_location>/reactive-json`
61
- 3. Add `<docs_location>/reactive-json-docs`
96
+ **Instructions to give to the user:**
62
97
 
63
- Make sure these folders appear in the explorer before continuing.
98
+ > **IMPORTANT: Manual Action Required**
99
+ >
100
+ > Before continuing, you must add the cloned repositories to your Cursor workspace:
101
+ >
102
+ > 1. Go to `File > Add Folder to Workspace`
103
+ > 2. Add the folder `<docs_location>/reactive-json`
104
+ > 3. Add the folder `<docs_location>/reactive-json-docs`
105
+ >
106
+ > **Confirm that this step is completed before continuing.**
64
107
 
65
108
  ---
66
109
 
67
- ## 4. Vite Project Initialization
110
+ ### 5. Vite Project Initialization
111
+
112
+ **Action:** Create the project with Vite in the current directory
113
+
114
+ **Commands to execute:**
68
115
 
69
116
  ```bash
70
- # With TypeScript
71
- npm create vite@latest <project_name> -- --template react-ts
117
+ # Return to project directory
118
+ cd <project_dir>
119
+
120
+ # If TypeScript
121
+ npm create vite@latest . -- --template react-ts
72
122
 
73
- # With JavaScript
74
- npm create vite@latest <project_name> -- --template react
123
+ # If JavaScript
124
+ npm create vite@latest . -- --template react
125
+ ```
126
+
127
+ ---
128
+
129
+ ### 6. Project Structure Verification
75
130
 
76
- cd <project_name>
131
+ **Action:** Verify the project structure is correct
132
+
133
+ **Commands to execute:**
134
+
135
+ ```bash
136
+ ls -la
77
137
  ```
78
138
 
139
+ **Verification checklist:**
140
+
141
+ 1. **package.json** must be at the root of the current directory
142
+ 2. **src/** folder must be present
143
+ 3. **public/** folder must be present
144
+ 4. **The reactive-json and reactive-json-docs repositories must NOT be in this directory** (they should only be in the workspace)
145
+
146
+ **Instructions:**
147
+
148
+ > **IMPORTANT: Project Structure Verification**
149
+ >
150
+ > Please verify the following:
151
+ >
152
+ > ✅ `package.json` is at the root of your current directory
153
+ > ✅ `src/` and `public/` folders are present
154
+ > ✅ `reactive-json/` and `reactive-json-docs/` folders are NOT in this directory
155
+ >
156
+ > If any of these conditions are not met, **STOP** and resolve the issues before continuing.
157
+
79
158
  ---
80
159
 
81
- ## 5. Dependencies Installation
160
+ ### 7. Dependencies Installation
161
+
162
+ **Action:** Install required packages
163
+
164
+ **Commands to execute:**
82
165
 
83
166
  ```bash
84
167
  npm install
@@ -87,14 +170,21 @@ npm install @ea-lab/reactive-json bootstrap react-bootstrap axios clsx dnd-kit-s
87
170
 
88
171
  ---
89
172
 
90
- ## 6. Cursor Rules Creation
173
+ ### 8. Cursor Project Rules Creation
174
+
175
+ **Action:** Copy Cursor rules from documentation repositories
91
176
 
92
- Copy rules from documentation repositories **before** any code modification:
177
+ **IMPORTANT:** This step must be done **immediately after installing dependencies** so that Cursor applies the rules during all subsequent code modifications.
93
178
 
179
+ **Instructions:**
180
+
181
+ 1. Create the `.cursor/rules/` folder in your project:
94
182
  ```bash
95
- # Create rules directory
96
183
  mkdir -p .cursor/rules
184
+ ```
97
185
 
186
+ 2. Copy and merge rules from documentation repositories:
187
+ ```bash
98
188
  # Copy rules from reactive-json
99
189
  cp -r <docs_location>/reactive-json/.cursor/rules/* .cursor/rules/
100
190
 
@@ -110,21 +200,25 @@ These rules contain all the necessary directives to work effectively with reacti
110
200
 
111
201
  ---
112
202
 
113
- ## 7. Generated Project Cleanup
203
+ ### 9. Generated Project Cleanup
114
204
 
115
- Remove unnecessary files:
205
+ **Action:** Remove/clean files generated by Vite
116
206
 
207
+ **Files to delete:**
117
208
  - `src/App.css`
118
209
  - `src/index.css` (keep only base styles)
119
210
  - `public/vite.svg`
120
211
  - `src/assets/react.svg`
121
212
 
122
- Modify `src/main.tsx` (or `src/main.jsx`):
213
+ **Files to modify:**
214
+
215
+ **`src/main.tsx` (or `src/main.jsx`):**
123
216
 
124
- ```typescript
217
+ ```javascript
125
218
  import React from 'react'
126
219
  import ReactDOM from 'react-dom/client'
127
220
  import App from './App.tsx'
221
+ // Import Bootstrap styles for reactive-json
128
222
  import 'bootstrap/dist/css/bootstrap.min.css'
129
223
 
130
224
  ReactDOM.createRoot(document.getElementById('root')!).render(
@@ -136,22 +230,26 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
136
230
 
137
231
  ---
138
232
 
139
- ## 8. Basic Configuration with ReactiveJsonRoot
233
+ ### 10. Basic Configuration with ReactiveJsonRoot
234
+
235
+ **Action:** Configure the base component with an external YAML file
236
+
237
+ **IMPORTANT:** Always use an external YAML file for configuration. Never pass configuration directly in props.
140
238
 
141
- `src/App.tsx`:
239
+ **`src/App.tsx` (or `src/App.jsx`):**
142
240
 
143
- ```typescript
241
+ ```javascript
144
242
  import { ReactiveJsonRoot } from '@ea-lab/reactive-json'
145
243
  import 'bootstrap/dist/css/bootstrap.min.css'
146
244
 
147
245
  function App() {
148
- return <ReactiveJsonRoot dataUrl="/config.yaml" dataFetchMethod="GET" />
246
+ return <ReactiveJsonRoot rjBuildUrl="/config.yaml" rjBuildFetchMethod="GET" />
149
247
  }
150
248
 
151
249
  export default App
152
250
  ```
153
251
 
154
- `public/config.yaml`:
252
+ **`public/config.yaml`:**
155
253
 
156
254
  ```yaml
157
255
  renderView:
@@ -161,10 +259,142 @@ renderView:
161
259
 
162
260
  ---
163
261
 
164
- ## 9. Final Verification
262
+ ### 11. Routing Configuration (Optional)
263
+
264
+ **Action:** Ask the user if they want to add routing for application organization
265
+
266
+ **Question to ask:**
267
+
268
+ > **Optional: React Router Setup**
269
+ >
270
+ > Do you want to add React Router (react-router-dom) to organize your application with multiple pages/routes?
271
+ >
272
+ > This is useful if you plan to create a multi-page application.
273
+ >
274
+ > **Answer: Yes/No**
275
+
276
+ **If YES, execute the following:**
277
+
278
+ **Install react-router-dom:**
279
+ ```bash
280
+ npm install react-router-dom
281
+ # If TypeScript
282
+ npm install --save-dev @types/react-router-dom
283
+ ```
284
+
285
+ **Create routing structure:**
286
+
287
+ **`src/components/Navigation.tsx` (or `.jsx`):**
288
+ ```javascript
289
+ import { Link, useLocation } from 'react-router-dom'
290
+
291
+ export default function Navigation() {
292
+ const location = useLocation()
293
+
294
+ const navItems = [
295
+ { path: '/', label: 'Home' },
296
+ // Add or remove items here according to your needs
297
+ ]
298
+
299
+ return (
300
+ <nav className="navbar navbar-expand-lg navbar-light bg-light mb-4">
301
+ <div className="container">
302
+ <Link className="navbar-brand" to="/">
303
+ My App
304
+ </Link>
305
+
306
+ <div className="navbar-nav">
307
+ {navItems.map((item) => (
308
+ <Link
309
+ key={item.path}
310
+ className={`nav-link ${location.pathname === item.path ? 'active' : ''}`}
311
+ to={item.path}
312
+ >
313
+ {item.label}
314
+ </Link>
315
+ ))}
316
+ </div>
317
+ </div>
318
+ </nav>
319
+ )
320
+ }
321
+ ```
322
+
323
+ **`src/config/routes.ts` (or `.js`):**
324
+ ```javascript
325
+ export const routeMapping = [
326
+ { path: '/', rjbuild: '/pages/home.yaml' },
327
+ // Add or remove routes here according to your needs
328
+ // Example: { path: '/about', rjbuild: '/pages/about.yaml' }
329
+ ]
330
+ ```
331
+
332
+ **Update `src/App.tsx` (or `.jsx`):**
333
+ ```javascript
334
+ import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
335
+ import { ReactiveJsonRoot } from '@ea-lab/reactive-json'
336
+ import { routeMapping } from './config/routes'
337
+ import Navigation from './components/Navigation'
338
+ import 'bootstrap/dist/css/bootstrap.min.css'
339
+
340
+ function App() {
341
+ return (
342
+ <Router>
343
+ <div>
344
+ <Navigation />
345
+ <div className="container">
346
+ <Routes>
347
+ {routeMapping.map((route) => (
348
+ <Route
349
+ key={route.path}
350
+ path={route.path}
351
+ element={
352
+ <ReactiveJsonRoot
353
+ rjBuildUrl={route.rjbuild}
354
+ rjBuildFetchMethod="GET"
355
+ />
356
+ }
357
+ />
358
+ ))}
359
+ </Routes>
360
+ </div>
361
+ </div>
362
+ </Router>
363
+ )
364
+ }
365
+
366
+ export default App
367
+ ```
368
+
369
+ **Create page configuration:**
370
+ ```bash
371
+ mkdir -p public/pages
372
+ mkdir -p src/config
373
+ ```
374
+
375
+ **`public/pages/home.yaml`:**
376
+ ```yaml
377
+ renderView:
378
+ - type: h1
379
+ content: "Welcome to your React + Reactive-JSON app!"
380
+ - type: p
381
+ content: "Your routing is now configured with a navigation bar. You can add more pages in src/pages/ and routes in the App component."
382
+ ```
383
+
384
+ **If NO, keep the simple configuration from step 10.**
385
+
386
+ ---
387
+
388
+ ### 12. Final Verification
389
+
390
+ **Action:** Launch development server
165
391
 
166
392
  ```bash
167
393
  npm run dev
168
394
  ```
169
395
 
170
- If the "Ready to start!" message appears without errors, the installation is complete! You can start developing your application with Reactive-JSON.
396
+ If the server starts without errors and you see the expected message in your browser, the installation is successful. You can start developing your application with reactive-json.
397
+
398
+ **Expected results:**
399
+ - **Without routing:** "Ready to start!" message
400
+ - **With routing:** "Welcome to your React + Reactive-JSON app!" message with a navigation bar at the top of the page allowing navigation between pages