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

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.
@@ -0,0 +1,220 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # Reactive-JSON Getting Started Guide
5
+
6
+ ## Introduction
7
+
8
+ Reactive-JSON is a powerful library that allows you to create interactive user interfaces using only JSON/YAML configurations. No need to write complex JavaScript code - simply define your interface and its behavior declaratively.
9
+
10
+ - type: RjBuildDescriber
11
+ title: "Installation and Basic Structure"
12
+ description:
13
+ - type: Markdown
14
+ content: |
15
+ To get started with Reactive-JSON, install the package via npm and create your first configuration.
16
+
17
+ The basic structure includes three main sections:
18
+ - `renderView`: Defines what should be rendered
19
+ - `templates`: Defines reusable templates (optional)
20
+ - `data`: Defines the data to be used (optional)
21
+ toDescribe:
22
+ renderView:
23
+ - type: div
24
+ content: "Hello World!"
25
+ templates:
26
+ myTemplate:
27
+ type: div
28
+ content: "Template content"
29
+ data:
30
+ message: "Hello!"
31
+
32
+ - type: Markdown
33
+ content: |
34
+ ## Key Concepts
35
+
36
+ ### 1. Template System
37
+
38
+ Reactive-JSON uses three main notations to access data:
39
+ - `~.` : Local context (relative to current template)
40
+ - `~~.` : Global context (access to global data)
41
+ - `~>field` : Access to a specific parent context
42
+
43
+ - type: RjBuildDescriber
44
+ title: "Template System Example"
45
+ description:
46
+ - type: Markdown
47
+ content: |
48
+ This example shows how to use different types of data access in a template.
49
+ The component accesses local data with `~.` and global data with `~~.`.
50
+ toDescribe:
51
+ templates:
52
+ userCard:
53
+ type: div
54
+ content:
55
+ - type: div
56
+ content: ["Name: ", ~.name]
57
+ - type: div
58
+ content: ["Admin: ", ~~.isAdmin]
59
+ data:
60
+ name: "John Doe"
61
+ isAdmin: true
62
+
63
+ - type: Markdown
64
+ content: |
65
+ ### 2. Basic Elements
66
+
67
+ Reactive-JSON provides several types of elements:
68
+
69
+ #### HTML Elements
70
+ - Div, Button, Modal, Accordion, etc.
71
+
72
+ - type: RjBuildDescriber
73
+ title: "HTML Elements Example"
74
+ description:
75
+ - type: Markdown
76
+ content: |
77
+ Basic HTML elements like buttons and divs are easy to use.
78
+ toDescribe:
79
+ renderView:
80
+ - type: button
81
+ content: "Click me"
82
+
83
+ - type: Markdown
84
+ content: |
85
+ #### Form Fields
86
+ - TextField, SelectField, CheckBoxField, etc.
87
+
88
+ - type: RjBuildDescriber
89
+ title: "Form Fields Example"
90
+ description:
91
+ - type: Markdown
92
+ content: |
93
+ Form fields use `dataLocation` to bind data.
94
+ toDescribe:
95
+ renderView:
96
+ - type: TextField
97
+ label: "Username"
98
+ dataLocation: ~.username
99
+ data:
100
+ username: ""
101
+
102
+ - type: Markdown
103
+ content: |
104
+ #### Special Elements
105
+ - DataFilter, Switch, Count, etc.
106
+
107
+ - type: RjBuildDescriber
108
+ title: "Special Element Example (Switch)"
109
+ description:
110
+ - type: Markdown
111
+ content: |
112
+ The Switch component is used to iterate over data collections.
113
+ toDescribe:
114
+ renderView:
115
+ - type: Switch
116
+ content: ~.items
117
+ template:
118
+ type: div
119
+ content: ~.name
120
+ data:
121
+ items:
122
+ - name: "Item 1"
123
+ - name: "Item 2"
124
+
125
+ - type: Markdown
126
+ content: |
127
+ ### 3. Actions and Reactions
128
+
129
+ #### Actions
130
+ Actions modify element behavior.
131
+
132
+ - type: RjBuildDescriber
133
+ title: "Action Example"
134
+ description:
135
+ - type: Markdown
136
+ content: |
137
+ Actions can be conditional, like hiding an element based on a condition.
138
+ toDescribe:
139
+ renderView:
140
+ - type: div
141
+ content: "Hidden content"
142
+ actions:
143
+ - what: hide
144
+ when: ~.shouldHide
145
+ is: true
146
+ data:
147
+ shouldHide: true
148
+
149
+ - type: Markdown
150
+ content: |
151
+ #### Reactions
152
+ Reactions respond to user events.
153
+
154
+ - type: RjBuildDescriber
155
+ title: "Reaction Example"
156
+ description:
157
+ - type: Markdown
158
+ content: |
159
+ Reactions allow responding to events like clicks.
160
+ toDescribe:
161
+ renderView:
162
+ - type: button
163
+ content: "Save"
164
+ actions:
165
+ - what: setData
166
+ on: click
167
+ path: ~.saved
168
+ value: true
169
+ data:
170
+ saved: false
171
+
172
+ - type: Markdown
173
+ content: |
174
+ ## Complete Example
175
+
176
+ Here's a simple example of an interactive form:
177
+
178
+ - type: RjBuildDescriber
179
+ title: "Complete Interactive Form"
180
+ description:
181
+ - type: Markdown
182
+ content: |
183
+ This example combines several concepts:
184
+ - Form fields with data binding
185
+ - User event reactions
186
+ - Data validation
187
+ - Form submission
188
+ toDescribe:
189
+ renderView:
190
+ - type: div
191
+ content:
192
+ - type: TextField
193
+ label: "Name"
194
+ dataLocation: ~.form.name
195
+ - type: TextField
196
+ label: "Email"
197
+ dataLocation: ~.form.email
198
+ - type: button
199
+ content: "Submit"
200
+ actions:
201
+ - what: submitData
202
+ on: click
203
+ url: "/api/submit"
204
+ data: ~.form
205
+ when: ~.form.name
206
+ isEmpty: not
207
+ data:
208
+ form:
209
+ name: ""
210
+ email: ""
211
+
212
+ - type: Markdown
213
+ content: |
214
+ ## Next Steps
215
+
216
+ 1. Explore the [complete examples](/docs/core/example) to see Reactive-JSON in action
217
+ 2. Check out the [elements documentation](/docs/core/element) to discover all available components
218
+ 3. Learn how to use the [action system](/docs/core/action) to create interactive interfaces
219
+ 4. Discover the [reaction system](/docs/core/reaction) to handle user interactions
220
+ 5. If needed, learn how to [extend Reactive-JSON](/docs/extend) with your own components
@@ -24,6 +24,11 @@ renderView:
24
24
 
25
25
  ### Core Components
26
26
 
27
+ - **Template System** - Understand data binding and context management
28
+ - Local Context - Using `~.` for template-scoped data
29
+ - Global Context - Using `~~.` for application-wide data
30
+ - Parent Context - Using `~>` for parent template access
31
+
27
32
  - **Elements** - Form fields, HTML elements, and special components
28
33
  - Form Fields - Input fields, selects, checkboxes, etc.
29
34
  - HTML Elements - Divs, modals, accordions, syntax highlighting, etc.
@@ -0,0 +1,168 @@
1
+ # Reactive-JSON Installation Guide (Vite + React)
2
+
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
+
5
+ ## ⚠️ Important Rule
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.
8
+
9
+ ## Table of Contents
10
+
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)
20
+
21
+ ---
22
+
23
+ ## 1. Collecting User Information
24
+
25
+ Ask the user for:
26
+
27
+ - **Project name**
28
+ - **TypeScript?** (yes/no)
29
+ - **Documentation repositories location** (absolute path)
30
+
31
+ Remember:
32
+
33
+ | Variable | Description |
34
+ | -------- | ----------- |
35
+ | `<project_name>` | Project name |
36
+ | `<use_typescript>` | `true` or `false` |
37
+ | `<docs_location>` | Absolute path for repositories |
38
+
39
+ ---
40
+
41
+ ## 2. Documentation Repositories Setup
42
+
43
+ ```bash
44
+ cd <docs_location>
45
+ git clone https://github.com/Ealab-collab/reactive-json.git
46
+ git clone https://github.com/Ealab-collab/reactive-json-docs.git
47
+ ```
48
+
49
+ > These repositories are used **only** for Cursor to index the documentation and will **not** be included in the final project.
50
+
51
+ If repositories are already cloned, proceed directly to step 3.
52
+
53
+ ---
54
+
55
+ ## 3. Cursor Workspace Configuration
56
+
57
+ **Manual action required!**
58
+
59
+ 1. Open `File > Add Folder to Workspace`
60
+ 2. Add `<docs_location>/reactive-json`
61
+ 3. Add `<docs_location>/reactive-json-docs`
62
+
63
+ Make sure these folders appear in the explorer before continuing.
64
+
65
+ ---
66
+
67
+ ## 4. Vite Project Initialization
68
+
69
+ ```bash
70
+ # With TypeScript
71
+ npm create vite@latest <project_name> -- --template react-ts
72
+
73
+ # With JavaScript
74
+ npm create vite@latest <project_name> -- --template react
75
+
76
+ cd <project_name>
77
+ ```
78
+
79
+ ---
80
+
81
+ ## 5. Dependencies Installation
82
+
83
+ ```bash
84
+ npm install
85
+ npm install @ea-lab/reactive-json bootstrap react-bootstrap axios clsx dnd-kit-sortable-tree html-react-parser js-yaml jsonpath lodash
86
+ ```
87
+
88
+ ---
89
+
90
+ ## 6. Cursor Rules Creation
91
+
92
+ Copy rules from documentation repositories **before** any code modification:
93
+
94
+ ```bash
95
+ # Create rules directory
96
+ mkdir -p .cursor/rules
97
+
98
+ # Copy rules from reactive-json
99
+ cp -r <docs_location>/reactive-json/.cursor/rules/* .cursor/rules/
100
+
101
+ # Copy and merge rules from reactive-json-docs
102
+ cp -r <docs_location>/reactive-json-docs/.cursor/rules/* .cursor/rules/
103
+ ```
104
+
105
+ These rules contain all the necessary directives to work effectively with reactive-json, including:
106
+ - Required documentation rules
107
+ - Component creation rules
108
+ - Code language rules
109
+ - And other project-specific rules
110
+
111
+ ---
112
+
113
+ ## 7. Generated Project Cleanup
114
+
115
+ Remove unnecessary files:
116
+
117
+ - `src/App.css`
118
+ - `src/index.css` (keep only base styles)
119
+ - `public/vite.svg`
120
+ - `src/assets/react.svg`
121
+
122
+ Modify `src/main.tsx` (or `src/main.jsx`):
123
+
124
+ ```typescript
125
+ import React from 'react'
126
+ import ReactDOM from 'react-dom/client'
127
+ import App from './App.tsx'
128
+ import 'bootstrap/dist/css/bootstrap.min.css'
129
+
130
+ ReactDOM.createRoot(document.getElementById('root')!).render(
131
+ <App />
132
+ )
133
+ ```
134
+
135
+ ---
136
+
137
+ ## 8. Basic Configuration with ReactiveJsonRoot
138
+
139
+ `src/App.tsx`:
140
+
141
+ ```typescript
142
+ import { ReactiveJsonRoot } from '@ea-lab/reactive-json'
143
+ import 'bootstrap/dist/css/bootstrap.min.css'
144
+
145
+ function App() {
146
+ return <ReactiveJsonRoot dataUrl="/config.yaml" dataFetchMethod="GET" />
147
+ }
148
+
149
+ export default App
150
+ ```
151
+
152
+ `public/config.yaml`:
153
+
154
+ ```yaml
155
+ renderView:
156
+ - type: h1
157
+ content: "Ready to start!"
158
+ ```
159
+
160
+ ---
161
+
162
+ ## 9. Final Verification
163
+
164
+ ```bash
165
+ npm run dev
166
+ ```
167
+
168
+ If the "Ready to start!" message appears without errors, the installation is complete! You can start developing your application with Reactive-JSON.