@ea-lab/reactive-json-docs 0.7.0 → 1.0.0-alpha.0
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 +7 -5
- package/public/rjbuild/docs/advanced-concepts/data-processors.md +2 -2
- package/public/rjbuild/docs/advanced-concepts/plugins/component-development-guide-llm.md +14 -14
- package/public/rjbuild/docs/advanced-concepts/plugins/plugin-system.md +47 -1
- package/public/rjbuild/docs/advanced-concepts/plugins/plugin-system.yaml +53 -1
- package/public/rjbuild/docs/core/action/HashChangeListener.md +1 -1
- package/public/rjbuild/docs/core/action/HashChangeListener.yaml +24 -6
- package/public/rjbuild/docs/core/action/Hide.md +2 -2
- package/public/rjbuild/docs/core/action/Hide.yaml +4 -3
- package/public/rjbuild/docs/core/action/MessageListener.md +4 -4
- package/public/rjbuild/docs/core/action/MessageListener.yaml +18 -6
- package/public/rjbuild/docs/core/action/ReactOnEvent.md +4 -4
- package/public/rjbuild/docs/core/action/ReactOnEvent.yaml +4 -4
- package/public/rjbuild/docs/core/action/Redirect.md +2 -2
- package/public/rjbuild/docs/core/action/Redirect.yaml +8 -2
- package/public/rjbuild/docs/core/action/VisuallyHide.md +2 -2
- package/public/rjbuild/docs/core/action/VisuallyHide.yaml +2 -2
- package/public/rjbuild/docs/core/dataMapping/simpleMapping.md +5 -5
- package/public/rjbuild/docs/core/dataMapping/simpleMapping.yaml +90 -60
- package/public/rjbuild/docs/core/element/debug/VariablesDebug.md +59 -0
- package/public/rjbuild/docs/core/element/debug/VariablesDebug.yaml +71 -0
- package/public/rjbuild/docs/core/element/form/Input.md +307 -0
- package/public/rjbuild/docs/core/element/form/Input.yaml +572 -0
- package/public/rjbuild/docs/core/element/html/FolderSortableTree.yaml +40 -12
- package/public/rjbuild/docs/core/element/html/FormatNumeral.yaml +21 -7
- package/public/rjbuild/docs/core/element/html/Html.yaml +26 -9
- package/public/rjbuild/docs/core/element/html/LabelFromValue.yaml +25 -8
- package/public/rjbuild/docs/core/element/html/PreformattedMarkup.yaml +23 -7
- package/public/rjbuild/docs/core/element/html/SortableTreeItemCollapseButton.yaml +7 -6
- package/public/rjbuild/docs/core/element/html/SyntaxHighlighter.yaml +56 -20
- package/public/rjbuild/docs/core/element/special/Count.md +8 -10
- package/public/rjbuild/docs/core/element/special/Count.yaml +121 -40
- package/public/rjbuild/docs/core/element/special/DataFilter.md +40 -41
- package/public/rjbuild/docs/core/element/special/DataFilter.yaml +197 -81
- package/public/rjbuild/docs/core/element/special/DelayedActions.md +13 -15
- package/public/rjbuild/docs/core/element/special/DelayedActions.yaml +32 -13
- package/public/rjbuild/docs/core/element/special/PageControls.md +8 -10
- package/public/rjbuild/docs/core/element/special/PageControls.yaml +9 -8
- package/public/rjbuild/docs/core/element/special/Phantom.md +9 -11
- package/public/rjbuild/docs/core/element/special/Phantom.yaml +22 -9
- package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.md +7 -9
- package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.yaml +167 -49
- package/public/rjbuild/docs/core/element/special/Switch.md +36 -38
- package/public/rjbuild/docs/core/element/special/Switch.yaml +68 -40
- package/public/rjbuild/docs/core/example/html.md +2 -2
- package/public/rjbuild/docs/core/example/html.yaml +2 -3
- package/public/rjbuild/docs/core/example/native-html-forms.md +245 -0
- package/public/rjbuild/docs/core/example/native-html-forms.yaml +393 -0
- package/public/rjbuild/docs/core/reaction/addData.md +17 -5
- package/public/rjbuild/docs/core/reaction/addData.yaml +70 -11
- package/public/rjbuild/docs/core/reaction/fetchData.md +1 -2
- package/public/rjbuild/docs/core/reaction/fetchData.yaml +84 -19
- package/public/rjbuild/docs/core/reaction/moveData.md +0 -4
- package/public/rjbuild/docs/core/reaction/moveData.yaml +28 -6
- package/public/rjbuild/docs/core/reaction/postMessage.md +0 -4
- package/public/rjbuild/docs/core/reaction/postMessage.yaml +29 -6
- package/public/rjbuild/docs/core/reaction/redirectNow.md +0 -4
- package/public/rjbuild/docs/core/reaction/redirectNow.yaml +10 -3
- package/public/rjbuild/docs/core/reaction/removeData.md +2 -6
- package/public/rjbuild/docs/core/reaction/removeData.yaml +40 -2
- package/public/rjbuild/docs/core/reaction/setClipboardData.md +0 -4
- package/public/rjbuild/docs/core/reaction/setClipboardData.yaml +10 -3
- package/public/rjbuild/docs/core/reaction/setData.md +18 -8
- package/public/rjbuild/docs/core/reaction/setData.yaml +43 -11
- package/public/rjbuild/docs/core/reaction/submitData.md +2 -3
- package/public/rjbuild/docs/core/reaction/submitData.yaml +43 -7
- package/public/rjbuild/docs/core/reaction/triggerEvent.md +0 -4
- package/public/rjbuild/docs/core/reaction/triggerEvent.yaml +25 -11
- package/public/rjbuild/docs/docs-components/Mermaid.md +254 -0
- package/public/rjbuild/docs/docs-components/Mermaid.yaml +339 -0
- package/public/rjbuild/docs/docs-components/index.yaml +1 -0
- package/public/rjbuild/docs/getting-started/actions.md +1 -1
- package/public/rjbuild/docs/index.yaml +2 -1
- package/public/rjbuild/docs/install.md +26 -29
- package/public/rjbuild/docs/install.yaml +4 -10
- package/public/rjbuild/docs/integration/bootstrap/action/Popover.md +26 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/action/Popover.yaml +28 -5
- package/public/rjbuild/docs/{core → integration/bootstrap}/action/Tooltip.md +4 -4
- package/public/rjbuild/docs/{core → integration/bootstrap}/action/Tooltip.yaml +16 -3
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/CheckBoxField.md +8 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/CheckBoxField.yaml +40 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/DateField.md +5 -5
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/DateField.yaml +27 -5
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/NumberField.md +7 -7
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/NumberField.yaml +32 -7
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/SelectField.md +9 -9
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/SelectField.yaml +46 -9
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextAreaField.md +8 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextAreaField.yaml +36 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextField.md +8 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextField.yaml +38 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/formElementsCommon.md +2 -4
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/index.md +0 -2
- package/public/rjbuild/docs/integration/bootstrap/element/html/AccordionItem.md +69 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/AccordionItem.yaml +19 -7
- package/public/rjbuild/docs/integration/bootstrap/element/html/Modal.md +127 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/Modal.yaml +35 -12
- package/public/rjbuild/docs/integration/bootstrap/element/html/Tabs.md +150 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/Tabs.yaml +24 -15
- package/public/rjbuild/docs/integration/bootstrap/element/html/index.md +13 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/special/BootstrapElement.md +4 -6
- package/public/rjbuild/docs/integration/bootstrap/element/special/BootstrapElement.yaml +29 -0
- package/public/rjbuild/docs/integration/bootstrap/element/special/index.md +19 -0
- package/public/rjbuild/docs/integration/bootstrap/example/website.md +41 -0
- package/public/rjbuild/docs/integration/bootstrap/overview.md +69 -0
- package/public/rjbuild/docs/integration/bootstrap/overview.yaml +87 -0
- package/public/rjbuild/docs/core/action/Popover.md +0 -26
- package/public/rjbuild/docs/core/element/special/BootstrapElement.yaml +0 -18
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/index.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/accordion.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/accordion.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/dynamic-content.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/dynamic-content.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/website.yaml +0 -0
- /package/public/rjbuild/docs/{chartjs → integration/chartjs}/components.yaml +0 -0
- /package/public/rjbuild/docs/{chartjs → integration/chartjs}/overview.yaml +0 -0
|
@@ -7,15 +7,31 @@ renderView:
|
|
|
7
7
|
|
|
8
8
|
## Properties
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
- type: DefinitionList
|
|
11
|
+
content:
|
|
12
|
+
- term:
|
|
13
|
+
code: eventName
|
|
14
|
+
after: "(string, required)"
|
|
15
|
+
details:
|
|
16
|
+
type: Markdown
|
|
17
|
+
content: "The name of the event to dispatch on the target element(s) (e.g., `click`, `focus`)"
|
|
18
|
+
- term:
|
|
19
|
+
code: selector
|
|
20
|
+
after: "(string, required)"
|
|
21
|
+
details: "A CSS selector to identify the target element(s) that will receive the event"
|
|
22
|
+
- term:
|
|
23
|
+
code: selectorBase
|
|
24
|
+
after: "(string, optional)"
|
|
25
|
+
details:
|
|
26
|
+
type: Markdown
|
|
27
|
+
content: |
|
|
28
|
+
Defines the starting point for the `selector` search.
|
|
29
|
+
- If omitted, the search starts from the `document` root.
|
|
30
|
+
- If set to `'currentEventTarget'`, the search starts from the element that triggered the reaction.
|
|
31
|
+
- If set to another CSS selector, the search starts from the closest ancestor matching that selector.
|
|
18
32
|
|
|
33
|
+
- type: Markdown
|
|
34
|
+
content: |
|
|
19
35
|
## Behavior
|
|
20
36
|
|
|
21
37
|
- When triggered, the reaction searches for elements matching the `selector` within the scope defined by `selectorBase`.
|
|
@@ -32,9 +48,7 @@ renderView:
|
|
|
32
48
|
- type: RjBuildDescriber
|
|
33
49
|
title: "Triggering a click on another element"
|
|
34
50
|
description: |
|
|
35
|
-
In this example, clicking the first button does not update the status directly. Instead, it dispatches a `click` event on the second button.
|
|
36
|
-
The second button has its own `click` reaction that updates the status.
|
|
37
|
-
Therefore, clicking either button will result in the same final action: the status text gets updated.
|
|
51
|
+
In this example, clicking the first button (`Trigger a click...`) does not update the status directly. Instead, it dispatches a `click` event on the second button (`Update the status`). The second button has its own `click` reaction that updates the status. Therefore, clicking either button will result in the same final action: the status text gets updated.
|
|
38
52
|
toDescribe:
|
|
39
53
|
renderView:
|
|
40
54
|
- type: button
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# Mermaid
|
|
2
|
+
|
|
3
|
+
**Package**: @ea-lab/reactive-json-docs
|
|
4
|
+
|
|
5
|
+
The `Mermaid` component enables the creation of beautiful diagrams and flowcharts using Mermaid syntax. It supports automatic dark mode adaptation and provides seamless integration with the reactive-json system.
|
|
6
|
+
|
|
7
|
+
## Properties
|
|
8
|
+
|
|
9
|
+
- `content` (string, required): The Mermaid diagram definition (supports template evaluation)
|
|
10
|
+
- `attributes` (object, optional): HTML attributes for the wrapper div
|
|
11
|
+
- `mermaidConfig` (object, optional): Custom Mermaid configuration to override defaults
|
|
12
|
+
|
|
13
|
+
## Theme Support
|
|
14
|
+
|
|
15
|
+
The component automatically adapts to dark/light mode:
|
|
16
|
+
- **Light Mode**: Uses default Mermaid light theme with custom color variables
|
|
17
|
+
- **Dark Mode**: Uses Mermaid dark theme with enhanced contrast and visibility
|
|
18
|
+
- **Automatic Switching**: Theme changes dynamically based on the current mode
|
|
19
|
+
|
|
20
|
+
## Supported Diagram Types
|
|
21
|
+
|
|
22
|
+
The component supports all Mermaid diagram types, including:
|
|
23
|
+
|
|
24
|
+
- **Flowcharts**: Decision trees, process flows, system diagrams
|
|
25
|
+
- **Sequence Diagrams**: Interaction flows, API calls, communication patterns
|
|
26
|
+
- **Class Diagrams**: Object-oriented design, database schemas
|
|
27
|
+
- **State Diagrams**: State machines, workflow states
|
|
28
|
+
- **Entity Relationship Diagrams**: Database relationships
|
|
29
|
+
- **User Journey**: User experience flows
|
|
30
|
+
- **Gantt Charts**: Project timelines, task scheduling
|
|
31
|
+
- **Pie Charts**: Data visualization
|
|
32
|
+
- **Git Graphs**: Version control workflows
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Basic Flowchart
|
|
37
|
+
|
|
38
|
+
Simple flowchart demonstrating decision logic:
|
|
39
|
+
|
|
40
|
+
```yaml
|
|
41
|
+
renderView:
|
|
42
|
+
- type: Mermaid
|
|
43
|
+
content: |
|
|
44
|
+
flowchart TD
|
|
45
|
+
A[Start] --> B{Is it working?}
|
|
46
|
+
B -->|Yes| C[Great!]
|
|
47
|
+
B -->|No| D[Fix it]
|
|
48
|
+
D --> B
|
|
49
|
+
C --> E[End]
|
|
50
|
+
|
|
51
|
+
data: {}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Sequence Diagram
|
|
55
|
+
|
|
56
|
+
User authentication flow with multiple actors:
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
renderView:
|
|
60
|
+
- type: Mermaid
|
|
61
|
+
content: |
|
|
62
|
+
sequenceDiagram
|
|
63
|
+
participant U as User
|
|
64
|
+
participant F as Frontend
|
|
65
|
+
participant A as Auth Service
|
|
66
|
+
participant D as Database
|
|
67
|
+
|
|
68
|
+
U->>F: Login Request
|
|
69
|
+
F->>A: Validate Credentials
|
|
70
|
+
A->>D: Check User
|
|
71
|
+
D-->>A: User Data
|
|
72
|
+
A-->>F: JWT Token
|
|
73
|
+
F-->>U: Login Success
|
|
74
|
+
|
|
75
|
+
data: {}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### State Diagram
|
|
79
|
+
|
|
80
|
+
Application state transitions:
|
|
81
|
+
|
|
82
|
+
```yaml
|
|
83
|
+
renderView:
|
|
84
|
+
- type: Mermaid
|
|
85
|
+
content: |
|
|
86
|
+
stateDiagram-v2
|
|
87
|
+
[*] --> Loading
|
|
88
|
+
Loading --> Success : Data Loaded
|
|
89
|
+
Loading --> Error : Failed
|
|
90
|
+
Success --> Loading : Refresh
|
|
91
|
+
Error --> Loading : Retry
|
|
92
|
+
Success --> [*] : Complete
|
|
93
|
+
Error --> [*] : Give Up
|
|
94
|
+
|
|
95
|
+
data: {}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Class Diagram
|
|
99
|
+
|
|
100
|
+
Object-oriented design example:
|
|
101
|
+
|
|
102
|
+
```yaml
|
|
103
|
+
renderView:
|
|
104
|
+
- type: Mermaid
|
|
105
|
+
content: |
|
|
106
|
+
classDiagram
|
|
107
|
+
class ReactiveJson {
|
|
108
|
+
+render()
|
|
109
|
+
+updateData()
|
|
110
|
+
+evaluateTemplate()
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
class Component {
|
|
114
|
+
+props
|
|
115
|
+
+render()
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
class ActionDependant {
|
|
119
|
+
+handleActions()
|
|
120
|
+
+processEvents()
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
ReactiveJson --> Component
|
|
124
|
+
Component --> ActionDependant
|
|
125
|
+
|
|
126
|
+
data: {}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Dynamic Content
|
|
130
|
+
|
|
131
|
+
The component supports template evaluation for dynamic diagrams:
|
|
132
|
+
|
|
133
|
+
```yaml
|
|
134
|
+
renderView:
|
|
135
|
+
- type: Mermaid
|
|
136
|
+
content: ~.diagramDefinition
|
|
137
|
+
|
|
138
|
+
data:
|
|
139
|
+
diagramDefinition: |
|
|
140
|
+
flowchart LR
|
|
141
|
+
A[Input Data] --> B[Process]
|
|
142
|
+
B --> C[Output]
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Advanced Examples
|
|
146
|
+
|
|
147
|
+
### User Journey
|
|
148
|
+
|
|
149
|
+
Complete user experience flow:
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
renderView:
|
|
153
|
+
- type: Mermaid
|
|
154
|
+
content: |
|
|
155
|
+
journey
|
|
156
|
+
title User Registration Journey
|
|
157
|
+
section Discovery
|
|
158
|
+
Visit Website: 3: User
|
|
159
|
+
Browse Features: 4: User
|
|
160
|
+
Read Documentation: 3: User
|
|
161
|
+
section Registration
|
|
162
|
+
Click Sign Up: 5: User
|
|
163
|
+
Fill Form: 2: User
|
|
164
|
+
Verify Email: 1: User
|
|
165
|
+
section Onboarding
|
|
166
|
+
Complete Profile: 4: User
|
|
167
|
+
First Login: 5: User
|
|
168
|
+
Explore Dashboard: 5: User
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Entity Relationship Diagram
|
|
172
|
+
|
|
173
|
+
Database schema representation:
|
|
174
|
+
|
|
175
|
+
```yaml
|
|
176
|
+
renderView:
|
|
177
|
+
- type: Mermaid
|
|
178
|
+
content: |
|
|
179
|
+
erDiagram
|
|
180
|
+
USERS {
|
|
181
|
+
int id PK
|
|
182
|
+
string email UK
|
|
183
|
+
string password
|
|
184
|
+
datetime created_at
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
PROFILES {
|
|
188
|
+
int id PK
|
|
189
|
+
int user_id FK
|
|
190
|
+
string first_name
|
|
191
|
+
string last_name
|
|
192
|
+
text bio
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
POSTS {
|
|
196
|
+
int id PK
|
|
197
|
+
int author_id FK
|
|
198
|
+
string title
|
|
199
|
+
text content
|
|
200
|
+
datetime published_at
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
USERS ||--|| PROFILES : has
|
|
204
|
+
USERS ||--o{ POSTS : creates
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Custom Configuration
|
|
208
|
+
|
|
209
|
+
You can customize Mermaid behavior using the `mermaidConfig` property:
|
|
210
|
+
|
|
211
|
+
```yaml
|
|
212
|
+
renderView:
|
|
213
|
+
- type: Mermaid
|
|
214
|
+
mermaidConfig:
|
|
215
|
+
themeVariables:
|
|
216
|
+
primaryColor: "#ff6b6b"
|
|
217
|
+
primaryBorderColor: "#ff6b6b"
|
|
218
|
+
lineColor: "#333333"
|
|
219
|
+
flowchart:
|
|
220
|
+
nodeSpacing: 100
|
|
221
|
+
rankSpacing: 150
|
|
222
|
+
curve: "linear"
|
|
223
|
+
content: |
|
|
224
|
+
flowchart TD
|
|
225
|
+
A[Custom Colors] --> B{Decision}
|
|
226
|
+
B -->|Yes| C[Success]
|
|
227
|
+
B -->|No| D[Retry]
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
The `mermaidConfig` is deeply merged with default configuration, allowing you to override specific properties while keeping others.
|
|
231
|
+
|
|
232
|
+
## Error Handling
|
|
233
|
+
|
|
234
|
+
The component provides graceful error handling:
|
|
235
|
+
- Syntax errors are logged to console with detailed information
|
|
236
|
+
- Invalid diagram content doesn't display anything (silent failure)
|
|
237
|
+
- Error messages are in English for consistency
|
|
238
|
+
- Original content and error details are included in console logs for debugging
|
|
239
|
+
|
|
240
|
+
## Best Practices
|
|
241
|
+
|
|
242
|
+
1. **Syntax Validation**: Test diagram syntax before deployment
|
|
243
|
+
2. **Content Length**: Keep diagrams readable by limiting complexity
|
|
244
|
+
3. **Template Evaluation**: Use template patterns for dynamic diagram generation
|
|
245
|
+
4. **Responsive Design**: Consider diagram size on different screen sizes
|
|
246
|
+
5. **Performance**: Cache static diagrams when possible
|
|
247
|
+
6. **Accessibility**: Provide text alternatives for complex diagrams
|
|
248
|
+
|
|
249
|
+
## Integration Tips
|
|
250
|
+
|
|
251
|
+
- Combine with other reactive-json components for interactive documentation
|
|
252
|
+
- Use with `Switch` component for tabbed diagram views
|
|
253
|
+
- Integrate with data fetching for dynamic diagram generation
|
|
254
|
+
- Leverage template system for personalized diagrams based on user data
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# Mermaid
|
|
5
|
+
|
|
6
|
+
**Package**: @ea-lab/reactive-json-docs
|
|
7
|
+
|
|
8
|
+
The `Mermaid` component enables the creation of beautiful diagrams and flowcharts using Mermaid syntax. It supports automatic dark mode adaptation and provides seamless integration with the reactive-json system.
|
|
9
|
+
|
|
10
|
+
## Properties
|
|
11
|
+
|
|
12
|
+
- `content` (string, required): The Mermaid diagram definition (supports template evaluation)
|
|
13
|
+
- `attributes` (object, optional): HTML attributes for the wrapper div
|
|
14
|
+
- `mermaidConfig` (object, optional): Custom Mermaid configuration to override defaults
|
|
15
|
+
|
|
16
|
+
## Theme Support
|
|
17
|
+
|
|
18
|
+
The component automatically adapts to dark/light mode:
|
|
19
|
+
- **Light Mode**: Uses default Mermaid light theme with custom color variables
|
|
20
|
+
- **Dark Mode**: Uses Mermaid dark theme with enhanced contrast and visibility
|
|
21
|
+
- **Automatic Switching**: Theme changes dynamically based on the current mode
|
|
22
|
+
|
|
23
|
+
## Supported Diagram Types
|
|
24
|
+
|
|
25
|
+
The component supports all Mermaid diagram types, including:
|
|
26
|
+
- **Flowcharts**: Decision trees, process flows, system diagrams
|
|
27
|
+
- **Sequence Diagrams**: Interaction flows, API calls, communication patterns
|
|
28
|
+
- **Class Diagrams**: Object-oriented design, database schemas
|
|
29
|
+
- **State Diagrams**: State machines, workflow states
|
|
30
|
+
- **Entity Relationship Diagrams**: Database relationships
|
|
31
|
+
- **User Journey**: User experience flows
|
|
32
|
+
- **Gantt Charts**: Project timelines, task scheduling
|
|
33
|
+
- **Pie Charts**: Data visualization
|
|
34
|
+
- **Git Graphs**: Version control workflows
|
|
35
|
+
|
|
36
|
+
- type: RjBuildDescriber
|
|
37
|
+
title: "Basic Flowchart"
|
|
38
|
+
description:
|
|
39
|
+
- type: Markdown
|
|
40
|
+
content: |
|
|
41
|
+
Simple flowchart demonstrating decision logic with automatic theme adaptation.
|
|
42
|
+
|
|
43
|
+
toDescribe:
|
|
44
|
+
renderView:
|
|
45
|
+
- type: Mermaid
|
|
46
|
+
content: |
|
|
47
|
+
flowchart TD
|
|
48
|
+
A[Start] --> B{Is it working?}
|
|
49
|
+
B -->|Yes| C[Great!]
|
|
50
|
+
B -->|No| D[Fix it]
|
|
51
|
+
D --> B
|
|
52
|
+
C --> E[End]
|
|
53
|
+
|
|
54
|
+
data: {}
|
|
55
|
+
|
|
56
|
+
- type: RjBuildDescriber
|
|
57
|
+
title: "Sequence Diagram"
|
|
58
|
+
description:
|
|
59
|
+
- type: Markdown
|
|
60
|
+
content: |
|
|
61
|
+
User authentication flow with multiple actors demonstrating interaction patterns.
|
|
62
|
+
|
|
63
|
+
toDescribe:
|
|
64
|
+
renderView:
|
|
65
|
+
- type: Mermaid
|
|
66
|
+
content: |
|
|
67
|
+
sequenceDiagram
|
|
68
|
+
participant U as User
|
|
69
|
+
participant F as Frontend
|
|
70
|
+
participant A as Auth Service
|
|
71
|
+
participant D as Database
|
|
72
|
+
|
|
73
|
+
U->>F: Login Request
|
|
74
|
+
F->>A: Validate Credentials
|
|
75
|
+
A->>D: Check User
|
|
76
|
+
D-->>A: User Data
|
|
77
|
+
A-->>F: JWT Token
|
|
78
|
+
F-->>U: Login Success
|
|
79
|
+
|
|
80
|
+
data: {}
|
|
81
|
+
|
|
82
|
+
- type: RjBuildDescriber
|
|
83
|
+
title: "State Diagram"
|
|
84
|
+
description:
|
|
85
|
+
- type: Markdown
|
|
86
|
+
content: |
|
|
87
|
+
Application state transitions showing different states and their relationships.
|
|
88
|
+
|
|
89
|
+
toDescribe:
|
|
90
|
+
renderView:
|
|
91
|
+
- type: Mermaid
|
|
92
|
+
content: |
|
|
93
|
+
stateDiagram-v2
|
|
94
|
+
[*] --> Loading
|
|
95
|
+
Loading --> Success : Data Loaded
|
|
96
|
+
Loading --> Error : Failed
|
|
97
|
+
Success --> Loading : Refresh
|
|
98
|
+
Error --> Loading : Retry
|
|
99
|
+
Success --> [*] : Complete
|
|
100
|
+
Error --> [*] : Give Up
|
|
101
|
+
|
|
102
|
+
data: {}
|
|
103
|
+
|
|
104
|
+
- type: RjBuildDescriber
|
|
105
|
+
title: "Class Diagram"
|
|
106
|
+
description:
|
|
107
|
+
- type: Markdown
|
|
108
|
+
content: |
|
|
109
|
+
Object-oriented design example showing reactive-json component relationships.
|
|
110
|
+
|
|
111
|
+
toDescribe:
|
|
112
|
+
renderView:
|
|
113
|
+
- type: Mermaid
|
|
114
|
+
content: |
|
|
115
|
+
classDiagram
|
|
116
|
+
class ReactiveJson {
|
|
117
|
+
+render()
|
|
118
|
+
+updateData()
|
|
119
|
+
+evaluateTemplate()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
class Component {
|
|
123
|
+
+props
|
|
124
|
+
+render()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
class ActionDependant {
|
|
128
|
+
+handleActions()
|
|
129
|
+
+processEvents()
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
ReactiveJson --> Component
|
|
133
|
+
Component --> ActionDependant
|
|
134
|
+
|
|
135
|
+
data: {}
|
|
136
|
+
|
|
137
|
+
- type: RjBuildDescriber
|
|
138
|
+
title: "Custom Configuration Example"
|
|
139
|
+
description:
|
|
140
|
+
- type: Markdown
|
|
141
|
+
content: |
|
|
142
|
+
Demonstration of custom Mermaid configuration using `mermaidConfig` property with custom colors and spacing.
|
|
143
|
+
|
|
144
|
+
toDescribe:
|
|
145
|
+
renderView:
|
|
146
|
+
- type: Mermaid
|
|
147
|
+
mermaidConfig:
|
|
148
|
+
themeVariables:
|
|
149
|
+
primaryColor: "#ff6b6b"
|
|
150
|
+
primaryBorderColor: "#ff6b6b"
|
|
151
|
+
lineColor: "#333333"
|
|
152
|
+
primaryTextColor: "#ffffff"
|
|
153
|
+
flowchart:
|
|
154
|
+
nodeSpacing: 80
|
|
155
|
+
rankSpacing: 120
|
|
156
|
+
curve: "linear"
|
|
157
|
+
content: |
|
|
158
|
+
flowchart TD
|
|
159
|
+
A[Custom Colors] --> B{Decision Node}
|
|
160
|
+
B -->|Yes Path| C[Success State]
|
|
161
|
+
B -->|No Path| D[Alternative]
|
|
162
|
+
D --> E[Retry Process]
|
|
163
|
+
E --> B
|
|
164
|
+
C --> F[Complete]
|
|
165
|
+
|
|
166
|
+
data: {}
|
|
167
|
+
|
|
168
|
+
- type: Markdown
|
|
169
|
+
content: |
|
|
170
|
+
## Dynamic Content
|
|
171
|
+
|
|
172
|
+
The component supports template evaluation for dynamic diagrams:
|
|
173
|
+
|
|
174
|
+
```yaml
|
|
175
|
+
renderView:
|
|
176
|
+
- type: Mermaid
|
|
177
|
+
content: ~.diagramDefinition
|
|
178
|
+
|
|
179
|
+
data:
|
|
180
|
+
diagramDefinition: |
|
|
181
|
+
flowchart LR
|
|
182
|
+
A[Input Data] --> B[Process]
|
|
183
|
+
B --> C[Output]
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Custom Configuration
|
|
187
|
+
|
|
188
|
+
You can customize Mermaid behavior using the `mermaidConfig` property:
|
|
189
|
+
|
|
190
|
+
```yaml
|
|
191
|
+
renderView:
|
|
192
|
+
- type: Mermaid
|
|
193
|
+
mermaidConfig:
|
|
194
|
+
themeVariables:
|
|
195
|
+
primaryColor: "#ff6b6b"
|
|
196
|
+
primaryBorderColor: "#ff6b6b"
|
|
197
|
+
lineColor: "#333333"
|
|
198
|
+
flowchart:
|
|
199
|
+
nodeSpacing: 100
|
|
200
|
+
rankSpacing: 150
|
|
201
|
+
curve: "linear"
|
|
202
|
+
content: |
|
|
203
|
+
flowchart TD
|
|
204
|
+
A[Custom Colors] --> B{Decision}
|
|
205
|
+
B -->|Yes| C[Success]
|
|
206
|
+
B -->|No| D[Retry]
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The `mermaidConfig` is deeply merged with default configuration, allowing you to override specific properties while keeping others.
|
|
210
|
+
|
|
211
|
+
### Default Configuration
|
|
212
|
+
|
|
213
|
+
The component provides sensible defaults that are automatically applied:
|
|
214
|
+
|
|
215
|
+
```javascript
|
|
216
|
+
// Light mode defaults
|
|
217
|
+
{
|
|
218
|
+
startOnLoad: false,
|
|
219
|
+
theme: "default",
|
|
220
|
+
themeVariables: {
|
|
221
|
+
primaryColor: "#0066cc",
|
|
222
|
+
primaryTextColor: "#000000",
|
|
223
|
+
primaryBorderColor: "#0066cc",
|
|
224
|
+
lineColor: "#000000",
|
|
225
|
+
// ... more variables
|
|
226
|
+
},
|
|
227
|
+
flowchart: {
|
|
228
|
+
useMaxWidth: true,
|
|
229
|
+
htmlLabels: true,
|
|
230
|
+
},
|
|
231
|
+
sequence: {
|
|
232
|
+
useMaxWidth: true,
|
|
233
|
+
},
|
|
234
|
+
gantt: {
|
|
235
|
+
useMaxWidth: true,
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Configuration Merging
|
|
241
|
+
|
|
242
|
+
Your `mermaidConfig` is deeply merged with defaults:
|
|
243
|
+
- **Partial overrides**: Only specify properties you want to change
|
|
244
|
+
- **Theme variables**: Mix default and custom theme variables
|
|
245
|
+
- **Diagram-specific**: Override settings for specific diagram types
|
|
246
|
+
- **Dark mode**: Automatic adaptation while preserving your customizations
|
|
247
|
+
|
|
248
|
+
## Advanced Examples
|
|
249
|
+
|
|
250
|
+
### User Journey
|
|
251
|
+
|
|
252
|
+
Complete user experience flow:
|
|
253
|
+
|
|
254
|
+
```yaml
|
|
255
|
+
renderView:
|
|
256
|
+
- type: Mermaid
|
|
257
|
+
content: |
|
|
258
|
+
journey
|
|
259
|
+
title User Registration Journey
|
|
260
|
+
section Discovery
|
|
261
|
+
Visit Website: 3: User
|
|
262
|
+
Browse Features: 4: User
|
|
263
|
+
Read Documentation: 3: User
|
|
264
|
+
section Registration
|
|
265
|
+
Click Sign Up: 5: User
|
|
266
|
+
Fill Form: 2: User
|
|
267
|
+
Verify Email: 1: User
|
|
268
|
+
section Onboarding
|
|
269
|
+
Complete Profile: 4: User
|
|
270
|
+
First Login: 5: User
|
|
271
|
+
Explore Dashboard: 5: User
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Entity Relationship Diagram
|
|
275
|
+
|
|
276
|
+
Database schema representation:
|
|
277
|
+
|
|
278
|
+
```yaml
|
|
279
|
+
renderView:
|
|
280
|
+
- type: Mermaid
|
|
281
|
+
content: |
|
|
282
|
+
erDiagram
|
|
283
|
+
USERS {
|
|
284
|
+
int id PK
|
|
285
|
+
string email UK
|
|
286
|
+
string password
|
|
287
|
+
datetime created_at
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
PROFILES {
|
|
291
|
+
int id PK
|
|
292
|
+
int user_id FK
|
|
293
|
+
string first_name
|
|
294
|
+
string last_name
|
|
295
|
+
text bio
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
POSTS {
|
|
299
|
+
int id PK
|
|
300
|
+
int author_id FK
|
|
301
|
+
string title
|
|
302
|
+
text content
|
|
303
|
+
datetime published_at
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
USERS ||--|| PROFILES : has
|
|
307
|
+
USERS ||--o{ POSTS : creates
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## Error Handling
|
|
311
|
+
|
|
312
|
+
The component provides graceful error handling:
|
|
313
|
+
- Syntax errors are logged to console with detailed information
|
|
314
|
+
- Invalid diagram content doesn't display anything (silent failure)
|
|
315
|
+
- Error messages are in English for consistency
|
|
316
|
+
- Original content and error details are included in console logs for debugging
|
|
317
|
+
|
|
318
|
+
## Best Practices
|
|
319
|
+
|
|
320
|
+
1. **Syntax Validation**: Test diagram syntax before deployment
|
|
321
|
+
2. **Content Length**: Keep diagrams readable by limiting complexity
|
|
322
|
+
3. **Template Evaluation**: Use template patterns for dynamic diagram generation
|
|
323
|
+
4. **Responsive Design**: Consider diagram size on different screen sizes
|
|
324
|
+
5. **Performance**: Cache static diagrams when possible
|
|
325
|
+
6. **Accessibility**: Provide text alternatives for complex diagrams
|
|
326
|
+
7. **Configuration**: Use `mermaidConfig` sparingly - defaults are optimized
|
|
327
|
+
8. **Error Monitoring**: Check browser console for diagram rendering issues
|
|
328
|
+
|
|
329
|
+
## Integration Tips
|
|
330
|
+
|
|
331
|
+
- Combine with other reactive-json components for interactive documentation
|
|
332
|
+
- Use with `Switch` component for tabbed diagram views
|
|
333
|
+
- Integrate with data fetching for dynamic diagram generation
|
|
334
|
+
- Leverage template system for personalized diagrams based on user data
|
|
335
|
+
- Override specific diagram types with custom `mermaidConfig` when needed
|
|
336
|
+
|
|
337
|
+
templates:
|
|
338
|
+
|
|
339
|
+
data: {}
|
|
@@ -271,7 +271,7 @@ Actions support the following conditional operators when using the `when` proper
|
|
|
271
271
|
3. **Synchronous evaluation**: All conditions and actions are evaluated synchronously.
|
|
272
272
|
4. **Data scope**: Actions can only access data from the current template context and global context.
|
|
273
273
|
5. **No side effects**: Actions cannot directly modify global state or trigger reactions.
|
|
274
|
-
6. **External dependencies**: Some actions (
|
|
274
|
+
6. **External dependencies**: Some actions may require specific plugin integrations (e.g., tooltips and popovers are available through the Bootstrap integration).
|
|
275
275
|
|
|
276
276
|
## Best Practices
|
|
277
277
|
|
|
@@ -16,7 +16,7 @@ renderView:
|
|
|
16
16
|
- **🎯 Declarative**: Define your UI structure and behavior in JSON/YAML
|
|
17
17
|
- **⚡ Reactive**: Automatic state management and data binding
|
|
18
18
|
- **🔧 Extensible**: Rich set of built-in components and actions
|
|
19
|
-
-
|
|
19
|
+
- **🧩 Plugin System**: Modular architecture with specialized integrations
|
|
20
20
|
- **🎨 Flexible**: Support for custom components and styling
|
|
21
21
|
- **📊 Data-Driven**: Built-in data operations and API integration
|
|
22
22
|
|
|
@@ -52,6 +52,7 @@ renderView:
|
|
|
52
52
|
|
|
53
53
|
### Integrations
|
|
54
54
|
|
|
55
|
+
- **Bootstrap Integration** - Form fields, styled components, and UI elements
|
|
55
56
|
- **Chart.js Integration** - Create interactive charts and visualizations
|
|
56
57
|
|
|
57
58
|
- type: Markdown
|