@ea-lab/reactive-json-docs 0.1.2 → 0.1.4
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/README-npm.md +2 -2
- package/README.md +2 -2
- package/package.json +3 -3
- package/public/rjbuild/docs/core/element/html/SyntaxHighlighter.yaml +293 -0
- package/public/rjbuild/docs/docs-components/SyntaxHighlighter.md +154 -0
- package/public/rjbuild/docs/docs-components/SyntaxHighlighter.yaml +167 -0
- package/public/rjbuild/docs/docs-components/index.md +28 -0
- package/public/rjbuild/docs/docs-components/index.yaml +35 -0
- package/public/rjbuild/docs/extend/component-development-guide-llm.md +383 -0
- package/public/rjbuild/docs/extend/component-development.md +193 -0
- package/public/rjbuild/docs/extend/component-development.yaml +215 -0
- package/public/rjbuild/docs/extend/index.md +20 -0
- package/public/rjbuild/docs/extend/index.yaml +29 -0
- package/public/rjbuild/docs/extend/plugin-system.md +142 -0
- package/public/rjbuild/docs/extend/plugin-system.yaml +147 -0
- package/public/rjbuild/docs/index.yaml +67 -0
- package/public/rjbuild/component-doc/index.yaml +0 -13
- /package/public/rjbuild/{component-doc → docs}/chartjs/components.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/chartjs/overview.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/HashChangeListener.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/HashChangeListener.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/Hide.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/Hide.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/MessageListener.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/MessageListener.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/Popover.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/Popover.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/ReactOnEvent.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/ReactOnEvent.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/Redirect.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/Redirect.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/Tooltip.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/Tooltip.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/VisuallyHide.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/VisuallyHide.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/index.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/action/index.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/CheckBoxField.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/CheckBoxField.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/DateField.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/DateField.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/NumberField.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/NumberField.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/SelectField.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/SelectField.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/TextAreaField.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/TextAreaField.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/TextField.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/TextField.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/formElementsCommon.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/index.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/form/index.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/html/AccordionItem.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/html/FolderSortableTree.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/html/FormatNumeral.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/html/Html.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/html/LabelFromValue.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/html/Modal.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/html/PreformattedMarkup.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/html/SortableTreeItemCollapseButton.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/html/Tabs.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/BootstrapElement.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/BootstrapElement.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/Count.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/Count.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/DataFilter.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/DataFilter.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/DelayedActions.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/DelayedActions.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/PageControls.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/PageControls.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/Phantom.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/Phantom.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/ReactiveJsonSubroot.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/ReactiveJsonSubroot.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/Switch.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/element/special/Switch.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/example/accordion.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/example/accordion.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/example/dynamic-content.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/example/dynamic-content.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/example/html.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/example/html.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/example/website.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/addData.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/addData.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/fetchData.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/fetchData.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/index.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/index.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/moveData.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/moveData.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/postMessage.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/postMessage.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/redirectNow.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/redirectNow.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/removeData.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/removeData.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/setClipboardData.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/setClipboardData.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/setData.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/setData.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/submitData.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/submitData.yaml +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/triggerEvent.md +0 -0
- /package/public/rjbuild/{component-doc → docs}/core/reaction/triggerEvent.yaml +0 -0
package/README-npm.md
CHANGED
|
@@ -22,12 +22,12 @@ npm install @ea-lab/reactive-json-docs
|
|
|
22
22
|
|
|
23
23
|
Tell your LLM about this package:
|
|
24
24
|
|
|
25
|
-
> "I have the npm package `@ea-lab/reactive-json-docs` installed, which contains complete documentation for @ea-lab/reactive-json and plugins. The documentation is located in `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/
|
|
25
|
+
> "I have the npm package `@ea-lab/reactive-json-docs` installed, which contains complete documentation for @ea-lab/reactive-json and plugins. The documentation is located in `node_modules/@ea-lab/reactive-json-docs/public/rjbuild/docs/`. Can you help me understand how to use Reactive-JSON components?"
|
|
26
26
|
|
|
27
27
|
### Structure
|
|
28
28
|
|
|
29
29
|
```
|
|
30
|
-
|
|
30
|
+
docs/
|
|
31
31
|
├── index.yaml # Main index
|
|
32
32
|
├── core/
|
|
33
33
|
│ ├── action/ # Actions (Hide, Show, Redirect...)
|
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ The following is the specific documentation for the *reactive-json-docs* project
|
|
|
40
40
|
|
|
41
41
|
This directory contains the structured documentation files for *reactive-json*.
|
|
42
42
|
|
|
43
|
-
The `/public/rjbuild/
|
|
43
|
+
The `/public/rjbuild/docs` directory contains the main documentation in YAML format:
|
|
44
44
|
- **Core components**: Actions, form elements, HTML elements, special components
|
|
45
45
|
- **Integrations**: Chart.js and other plugin documentation
|
|
46
46
|
- **Examples**: Complete use cases and implementation demos
|
|
@@ -82,5 +82,5 @@ Build the documentation website:
|
|
|
82
82
|
npm run build
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
The documentation files in `/public/rjbuild/
|
|
85
|
+
The documentation files in `/public/rjbuild/docs` are the source of truth
|
|
86
86
|
for all reactive-json component documentation.
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ea-lab/reactive-json-docs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Complete documentation for Reactive-JSON - Components, examples and LLM-parsable guides",
|
|
5
|
-
"main": "public/rjbuild/
|
|
5
|
+
"main": "public/rjbuild/docs/index.yaml",
|
|
6
6
|
"files": [
|
|
7
|
-
"public/rjbuild/
|
|
7
|
+
"public/rjbuild/docs/**/*",
|
|
8
8
|
"README-npm.md"
|
|
9
9
|
],
|
|
10
10
|
"keywords": [
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# SyntaxHighlighter
|
|
5
|
+
|
|
6
|
+
The `SyntaxHighlighter` component provides syntax highlighting for code snippets using the react-syntax-highlighter library. It supports multiple programming languages and themes, making it perfect for displaying formatted code in documentation or tutorials.
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
- `content` (string, required): The code content to highlight (supports template evaluation)
|
|
10
|
+
- `language` (string, optional): Programming language for syntax highlighting (default: "text")
|
|
11
|
+
- `style` (object, optional): Custom style theme for highlighting (overrides automatic dark mode detection)
|
|
12
|
+
- `lightStyle` (object, optional): Style theme for light mode (supports template evaluation)
|
|
13
|
+
- `darkStyle` (object, optional): Style theme for dark mode (supports template evaluation)
|
|
14
|
+
- `showLineNumbers` (boolean, optional): Whether to display line numbers (default: false)
|
|
15
|
+
- `wrapLines` (boolean, optional): Whether to wrap lines (default: false)
|
|
16
|
+
- `wrapLongLines` (boolean, optional): Whether to wrap long lines (default: false)
|
|
17
|
+
- `attributes` (object, optional): HTML attributes for the wrapper div
|
|
18
|
+
|
|
19
|
+
**Automatic Dark Mode**: The component automatically detects the user's color scheme preference and uses appropriate themes:
|
|
20
|
+
- Light mode: `docco` theme by default
|
|
21
|
+
- Dark mode: `atomOneDark` theme by default
|
|
22
|
+
|
|
23
|
+
**Supported languages**: javascript, python, java, html, css, yaml, json, markdown, bash, sql, and many more.
|
|
24
|
+
|
|
25
|
+
- type: RjBuildDescriber
|
|
26
|
+
title: "Example: Basic JavaScript highlighting"
|
|
27
|
+
description:
|
|
28
|
+
- type: Markdown
|
|
29
|
+
content: |
|
|
30
|
+
Basic usage with JavaScript syntax highlighting.
|
|
31
|
+
toDescribe:
|
|
32
|
+
renderView:
|
|
33
|
+
- type: SyntaxHighlighter
|
|
34
|
+
content: |
|
|
35
|
+
function greetUser(name) {
|
|
36
|
+
if (!name) {
|
|
37
|
+
return "Hello, anonymous!";
|
|
38
|
+
}
|
|
39
|
+
return `Hello, ${name}!`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const user = "World";
|
|
43
|
+
console.log(greetUser(user));
|
|
44
|
+
language: "javascript"
|
|
45
|
+
showLineNumbers: true
|
|
46
|
+
data: {}
|
|
47
|
+
|
|
48
|
+
- type: RjBuildDescriber
|
|
49
|
+
title: "Example: Interactive code editor"
|
|
50
|
+
description:
|
|
51
|
+
- type: Markdown
|
|
52
|
+
content: |
|
|
53
|
+
Dynamic content with template evaluation. Try editing the code in the text area below:
|
|
54
|
+
toDescribe:
|
|
55
|
+
renderView:
|
|
56
|
+
- type: TextField
|
|
57
|
+
label: "Language"
|
|
58
|
+
dataLocation: ~.code_language
|
|
59
|
+
defaultFieldValue: "python"
|
|
60
|
+
- type: TextAreaField
|
|
61
|
+
label: "Code Content"
|
|
62
|
+
dataLocation: ~.code_content
|
|
63
|
+
inputAttributes:
|
|
64
|
+
rows: 8
|
|
65
|
+
- type: SyntaxHighlighter
|
|
66
|
+
content: ~.code_content
|
|
67
|
+
language: ~.code_language
|
|
68
|
+
showLineNumbers: true
|
|
69
|
+
wrapLongLines: true
|
|
70
|
+
attributes:
|
|
71
|
+
style:
|
|
72
|
+
marginTop: "1rem"
|
|
73
|
+
data:
|
|
74
|
+
code_language: "python"
|
|
75
|
+
code_content: |
|
|
76
|
+
def fibonacci(n):
|
|
77
|
+
"""Generate Fibonacci sequence up to n terms."""
|
|
78
|
+
if n <= 0:
|
|
79
|
+
return []
|
|
80
|
+
elif n == 1:
|
|
81
|
+
return [0]
|
|
82
|
+
elif n == 2:
|
|
83
|
+
return [0, 1]
|
|
84
|
+
|
|
85
|
+
sequence = [0, 1]
|
|
86
|
+
for i in range(2, n):
|
|
87
|
+
sequence.append(sequence[i-1] + sequence[i-2])
|
|
88
|
+
|
|
89
|
+
return sequence
|
|
90
|
+
|
|
91
|
+
# Generate first 10 Fibonacci numbers
|
|
92
|
+
result = fibonacci(10)
|
|
93
|
+
print(f"First 10 Fibonacci numbers: {result}")
|
|
94
|
+
|
|
95
|
+
- type: RjBuildDescriber
|
|
96
|
+
title: "Example: Multiple language support"
|
|
97
|
+
description:
|
|
98
|
+
- type: Markdown
|
|
99
|
+
content: |
|
|
100
|
+
Demonstration of different programming languages with syntax highlighting.
|
|
101
|
+
toDescribe:
|
|
102
|
+
renderView:
|
|
103
|
+
- type: h3
|
|
104
|
+
content: "HTML Example"
|
|
105
|
+
- type: SyntaxHighlighter
|
|
106
|
+
content: |
|
|
107
|
+
<!DOCTYPE html>
|
|
108
|
+
<html lang="en">
|
|
109
|
+
<head>
|
|
110
|
+
<meta charset="UTF-8">
|
|
111
|
+
<title>Hello World</title>
|
|
112
|
+
</head>
|
|
113
|
+
<body>
|
|
114
|
+
<h1>Welcome to React!</h1>
|
|
115
|
+
<p class="intro">This is a sample HTML document.</p>
|
|
116
|
+
</body>
|
|
117
|
+
</html>
|
|
118
|
+
language: "html"
|
|
119
|
+
|
|
120
|
+
- type: h3
|
|
121
|
+
content: "CSS Example"
|
|
122
|
+
- type: SyntaxHighlighter
|
|
123
|
+
content: |
|
|
124
|
+
.container {
|
|
125
|
+
max-width: 1200px;
|
|
126
|
+
margin: 0 auto;
|
|
127
|
+
padding: 2rem;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.button {
|
|
131
|
+
background: linear-gradient(45deg, #007bff, #0056b3);
|
|
132
|
+
color: white;
|
|
133
|
+
border: none;
|
|
134
|
+
padding: 0.75rem 1.5rem;
|
|
135
|
+
border-radius: 0.375rem;
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
transition: all 0.2s ease;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.button:hover {
|
|
141
|
+
transform: translateY(-2px);
|
|
142
|
+
box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
|
|
143
|
+
}
|
|
144
|
+
language: "css"
|
|
145
|
+
|
|
146
|
+
- type: h3
|
|
147
|
+
content: "YAML Configuration"
|
|
148
|
+
- type: SyntaxHighlighter
|
|
149
|
+
content: |
|
|
150
|
+
renderView:
|
|
151
|
+
- type: SyntaxHighlighter
|
|
152
|
+
content: ~.code_snippet
|
|
153
|
+
language: ~.selected_language
|
|
154
|
+
showLineNumbers: true
|
|
155
|
+
attributes:
|
|
156
|
+
className: "code-block"
|
|
157
|
+
|
|
158
|
+
data:
|
|
159
|
+
code_snippet: "console.log('Hello, World!');"
|
|
160
|
+
selected_language: "javascript"
|
|
161
|
+
language: "yaml"
|
|
162
|
+
data: {}
|
|
163
|
+
|
|
164
|
+
- type: RjBuildDescriber
|
|
165
|
+
title: "Example: Dark mode support"
|
|
166
|
+
description:
|
|
167
|
+
- type: Markdown
|
|
168
|
+
content: |
|
|
169
|
+
The component automatically detects your system's color scheme preference. Try switching between light and dark mode in your system settings to see the automatic theme change. You can also specify custom themes for each mode.
|
|
170
|
+
toDescribe:
|
|
171
|
+
renderView:
|
|
172
|
+
- type: h3
|
|
173
|
+
content: "Automatic theme selection (changes with your system preference)"
|
|
174
|
+
- type: SyntaxHighlighter
|
|
175
|
+
content: |
|
|
176
|
+
// This code block automatically adapts to your theme preference
|
|
177
|
+
const greetUser = (name) => {
|
|
178
|
+
const greeting = name ? `Hello, ${name}!` : "Hello, World!";
|
|
179
|
+
console.log(greeting);
|
|
180
|
+
return greeting;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// Try switching your system to dark mode to see the change
|
|
184
|
+
greetUser("Developer");
|
|
185
|
+
language: "javascript"
|
|
186
|
+
showLineNumbers: true
|
|
187
|
+
|
|
188
|
+
- type: h3
|
|
189
|
+
content: "Custom themes for light and dark modes"
|
|
190
|
+
- type: SyntaxHighlighter
|
|
191
|
+
content: |
|
|
192
|
+
def fibonacci_generator(limit):
|
|
193
|
+
"""Generator for Fibonacci sequence up to limit."""
|
|
194
|
+
a, b = 0, 1
|
|
195
|
+
while a < limit:
|
|
196
|
+
yield a
|
|
197
|
+
a, b = b, a + b
|
|
198
|
+
|
|
199
|
+
# Use the generator
|
|
200
|
+
for number in fibonacci_generator(100):
|
|
201
|
+
print(f"Fibonacci: {number}")
|
|
202
|
+
language: "python"
|
|
203
|
+
lightStyle: "~.custom_light_theme"
|
|
204
|
+
darkStyle: "~.custom_dark_theme"
|
|
205
|
+
showLineNumbers: true
|
|
206
|
+
data:
|
|
207
|
+
custom_light_theme: null # Will use default light theme
|
|
208
|
+
custom_dark_theme: null # Will use default dark theme
|
|
209
|
+
|
|
210
|
+
- type: Markdown
|
|
211
|
+
content: |
|
|
212
|
+
## Supported Languages
|
|
213
|
+
|
|
214
|
+
The component supports all languages provided by react-syntax-highlighter, including:
|
|
215
|
+
|
|
216
|
+
**Web Technologies**: html, css, javascript, typescript, jsx, tsx, json, xml
|
|
217
|
+
|
|
218
|
+
**Popular Languages**: python, java, c, cpp, csharp, php, ruby, go, rust, swift, kotlin
|
|
219
|
+
|
|
220
|
+
**Data & Config**: yaml, json, sql, markdown, ini, toml
|
|
221
|
+
|
|
222
|
+
**Shell & Scripts**: bash, powershell, batch, dockerfile
|
|
223
|
+
|
|
224
|
+
**And many more**: Check the react-syntax-highlighter documentation for a complete list.
|
|
225
|
+
|
|
226
|
+
- type: Markdown
|
|
227
|
+
content: |
|
|
228
|
+
## Dark Mode Support
|
|
229
|
+
|
|
230
|
+
The component automatically adapts to the user's system color scheme preference:
|
|
231
|
+
|
|
232
|
+
### Automatic Theme Detection
|
|
233
|
+
- **Light mode**: Uses the `docco` theme by default (clean, minimal highlighting)
|
|
234
|
+
- **Dark mode**: Uses the `atomOneDark` theme by default (modern dark theme with good contrast)
|
|
235
|
+
- **Real-time switching**: Themes change instantly when the user switches their system preference
|
|
236
|
+
|
|
237
|
+
### Custom Theme Configuration
|
|
238
|
+
|
|
239
|
+
You can override the automatic behavior using these properties:
|
|
240
|
+
|
|
241
|
+
```yaml
|
|
242
|
+
- type: SyntaxHighlighter
|
|
243
|
+
content: ~.code
|
|
244
|
+
language: "javascript"
|
|
245
|
+
# Override both modes with a single theme
|
|
246
|
+
style: "~.my_custom_theme"
|
|
247
|
+
|
|
248
|
+
# OR specify different themes for each mode
|
|
249
|
+
lightStyle: "~.my_light_theme"
|
|
250
|
+
darkStyle: "~.my_dark_theme"
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Popular Themes
|
|
254
|
+
|
|
255
|
+
**Light themes**: `docco`, `github`, `googlecode`, `idea`, `qtcreator_light`, `vs`
|
|
256
|
+
|
|
257
|
+
**Dark themes**: `atomOneDark`, `darcula`, `vs2015`, `androidstudio`, `tomorrow-night`, `monokai`
|
|
258
|
+
|
|
259
|
+
- type: Markdown
|
|
260
|
+
content: |
|
|
261
|
+
## Styling and Themes
|
|
262
|
+
|
|
263
|
+
The component supports all react-syntax-highlighter themes. The style can be:
|
|
264
|
+
- A static style object imported from react-syntax-highlighter themes
|
|
265
|
+
- A template-evaluated value from your data context
|
|
266
|
+
- Any valid react-syntax-highlighter style configuration
|
|
267
|
+
- Different themes for light and dark modes using `lightStyle` and `darkStyle` properties
|
|
268
|
+
|
|
269
|
+
- type: Markdown
|
|
270
|
+
content: |
|
|
271
|
+
## Integration with Actions
|
|
272
|
+
|
|
273
|
+
Like all Reactive-JSON components, SyntaxHighlighter supports the action system:
|
|
274
|
+
|
|
275
|
+
```yaml
|
|
276
|
+
- type: SyntaxHighlighter
|
|
277
|
+
content: ~.user_code
|
|
278
|
+
language: "javascript"
|
|
279
|
+
actions:
|
|
280
|
+
- what: setData
|
|
281
|
+
when: ~.user_code
|
|
282
|
+
contains: "console.log"
|
|
283
|
+
path: ~.has_console_output
|
|
284
|
+
value: true
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
- type: Markdown
|
|
288
|
+
content: |
|
|
289
|
+
## Limitations
|
|
290
|
+
- Style themes must be compatible with react-syntax-highlighter
|
|
291
|
+
- Large code blocks may impact performance
|
|
292
|
+
- Line numbers display depends on the chosen theme
|
|
293
|
+
- Custom syntax definitions are not supported through the template system
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# SyntaxHighlighter
|
|
2
|
+
|
|
3
|
+
**Package**: @ea-lab/reactive-json-docs
|
|
4
|
+
|
|
5
|
+
The `SyntaxHighlighter` component provides advanced syntax highlighting for code examples with automatic dark mode support. It uses the react-syntax-highlighter library under the hood and adapts to the current theme.
|
|
6
|
+
|
|
7
|
+
## Properties
|
|
8
|
+
|
|
9
|
+
- `content` (string, required): The code content to highlight (supports template evaluation)
|
|
10
|
+
- `language` (string, optional): Programming language for syntax highlighting (default: "text", supports template evaluation)
|
|
11
|
+
- `style` (object, optional): Custom syntax highlighting style object (supports template evaluation)
|
|
12
|
+
- `lightStyle` (object, optional): Style to use in light mode (supports template evaluation)
|
|
13
|
+
- `darkStyle` (object, optional): Style to use in dark mode (supports template evaluation)
|
|
14
|
+
- `showLineNumbers` (boolean, optional): Whether to display line numbers (default: false)
|
|
15
|
+
- `wrapLines` (boolean, optional): Whether to wrap lines (default: false)
|
|
16
|
+
- `wrapLongLines` (boolean, optional): Whether to wrap long lines (default: false)
|
|
17
|
+
- `attributes` (object, optional): HTML attributes for the wrapper div
|
|
18
|
+
|
|
19
|
+
## Theme Support
|
|
20
|
+
|
|
21
|
+
The component automatically adapts to dark/light mode:
|
|
22
|
+
- **Light Mode**: Uses `docco` style by default, or `lightStyle` if provided
|
|
23
|
+
- **Dark Mode**: Uses `atomOneDark` style by default, or `darkStyle` if provided
|
|
24
|
+
- **Override**: Use `style` property to force a specific style regardless of theme
|
|
25
|
+
|
|
26
|
+
## Supported Languages
|
|
27
|
+
|
|
28
|
+
The component supports all languages available in react-syntax-highlighter, including:
|
|
29
|
+
- `javascript`, `jsx` - JavaScript and React
|
|
30
|
+
- `typescript`, `tsx` - TypeScript
|
|
31
|
+
- `python` - Python
|
|
32
|
+
- `yaml`, `yml` - YAML
|
|
33
|
+
- `json` - JSON
|
|
34
|
+
- `html`, `xml` - HTML and XML
|
|
35
|
+
- `css`, `scss` - CSS and Sass
|
|
36
|
+
- `sql` - SQL
|
|
37
|
+
- `bash`, `shell` - Shell scripts
|
|
38
|
+
- Many more...
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
### Basic Code Highlighting
|
|
43
|
+
|
|
44
|
+
Simple code highlighting for JavaScript with automatic theme adaptation:
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
renderView:
|
|
48
|
+
- type: SyntaxHighlighter
|
|
49
|
+
language: javascript
|
|
50
|
+
content: |
|
|
51
|
+
function greetUser(name) {
|
|
52
|
+
const message = `Hello, ${name}!`;
|
|
53
|
+
console.log(message);
|
|
54
|
+
return message;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
greetUser("Developer");
|
|
58
|
+
|
|
59
|
+
data: {}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### YAML Configuration Example
|
|
63
|
+
|
|
64
|
+
Highlighting YAML configuration with line numbers enabled:
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
renderView:
|
|
68
|
+
- type: SyntaxHighlighter
|
|
69
|
+
language: yaml
|
|
70
|
+
showLineNumbers: true
|
|
71
|
+
content: |
|
|
72
|
+
renderView:
|
|
73
|
+
- type: button
|
|
74
|
+
content: "Click me"
|
|
75
|
+
actions:
|
|
76
|
+
- what: setData
|
|
77
|
+
on: click
|
|
78
|
+
path: ~.clicked
|
|
79
|
+
value: true
|
|
80
|
+
|
|
81
|
+
data:
|
|
82
|
+
clicked: false
|
|
83
|
+
|
|
84
|
+
data: {}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### JSX Component Example
|
|
88
|
+
|
|
89
|
+
React JSX code with proper syntax highlighting:
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
renderView:
|
|
93
|
+
- type: SyntaxHighlighter
|
|
94
|
+
language: jsx
|
|
95
|
+
wrapLongLines: true
|
|
96
|
+
content: |
|
|
97
|
+
import React from 'react';
|
|
98
|
+
import { ActionDependant } from "@ea-lab/reactive-json/dist/engine";
|
|
99
|
+
|
|
100
|
+
export const CustomButton = ({ props }) => {
|
|
101
|
+
const handleClick = () => {
|
|
102
|
+
console.log('Button clicked!');
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<ActionDependant {...props}>
|
|
107
|
+
<button onClick={handleClick} className="custom-btn">
|
|
108
|
+
{props.content || 'Default Text'}
|
|
109
|
+
</button>
|
|
110
|
+
</ActionDependant>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
data: {}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Dynamic Content
|
|
118
|
+
|
|
119
|
+
The component supports template evaluation for dynamic content:
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
renderView:
|
|
123
|
+
- type: SyntaxHighlighter
|
|
124
|
+
language: ~.selectedLanguage
|
|
125
|
+
content: ~.codeSnippet
|
|
126
|
+
|
|
127
|
+
data:
|
|
128
|
+
selectedLanguage: "python"
|
|
129
|
+
codeSnippet: |
|
|
130
|
+
def hello_world():
|
|
131
|
+
print("Hello, World!")
|
|
132
|
+
return True
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Custom Styling
|
|
136
|
+
|
|
137
|
+
You can provide custom styles for different themes:
|
|
138
|
+
|
|
139
|
+
```yaml
|
|
140
|
+
renderView:
|
|
141
|
+
- type: SyntaxHighlighter
|
|
142
|
+
language: javascript
|
|
143
|
+
lightStyle: ~.customLightTheme
|
|
144
|
+
darkStyle: ~.customDarkTheme
|
|
145
|
+
content: "console.log('Themed code');"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Best Practices
|
|
149
|
+
|
|
150
|
+
1. **Language Specification**: Always specify the language for proper highlighting
|
|
151
|
+
2. **Content Length**: For very long code blocks, consider enabling line wrapping
|
|
152
|
+
3. **Line Numbers**: Use line numbers for code that will be referenced by line
|
|
153
|
+
4. **Theme Consistency**: Let the component handle theme switching automatically
|
|
154
|
+
5. **Template Evaluation**: Use template patterns for dynamic code examples
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# SyntaxHighlighter
|
|
5
|
+
|
|
6
|
+
**Package**: @ea-lab/reactive-json-docs
|
|
7
|
+
|
|
8
|
+
The `SyntaxHighlighter` component provides advanced syntax highlighting for code examples with automatic dark mode support. It uses the react-syntax-highlighter library under the hood and adapts to the current theme.
|
|
9
|
+
|
|
10
|
+
## Properties
|
|
11
|
+
|
|
12
|
+
- `content` (string, required): The code content to highlight (supports template evaluation)
|
|
13
|
+
- `language` (string, optional): Programming language for syntax highlighting (default: "text", supports template evaluation)
|
|
14
|
+
- `style` (object, optional): Custom syntax highlighting style object (supports template evaluation)
|
|
15
|
+
- `lightStyle` (object, optional): Style to use in light mode (supports template evaluation)
|
|
16
|
+
- `darkStyle` (object, optional): Style to use in dark mode (supports template evaluation)
|
|
17
|
+
- `showLineNumbers` (boolean, optional): Whether to display line numbers (default: false)
|
|
18
|
+
- `wrapLines` (boolean, optional): Whether to wrap lines (default: false)
|
|
19
|
+
- `wrapLongLines` (boolean, optional): Whether to wrap long lines (default: false)
|
|
20
|
+
- `attributes` (object, optional): HTML attributes for the wrapper div
|
|
21
|
+
|
|
22
|
+
## Theme Support
|
|
23
|
+
|
|
24
|
+
The component automatically adapts to dark/light mode:
|
|
25
|
+
- **Light Mode**: Uses `docco` style by default, or `lightStyle` if provided
|
|
26
|
+
- **Dark Mode**: Uses `atomOneDark` style by default, or `darkStyle` if provided
|
|
27
|
+
- **Override**: Use `style` property to force a specific style regardless of theme
|
|
28
|
+
|
|
29
|
+
## Supported Languages
|
|
30
|
+
|
|
31
|
+
The component supports all languages available in react-syntax-highlighter, including:
|
|
32
|
+
- `javascript`, `jsx` - JavaScript and React
|
|
33
|
+
- `typescript`, `tsx` - TypeScript
|
|
34
|
+
- `python` - Python
|
|
35
|
+
- `yaml`, `yml` - YAML
|
|
36
|
+
- `json` - JSON
|
|
37
|
+
- `html`, `xml` - HTML and XML
|
|
38
|
+
- `css`, `scss` - CSS and Sass
|
|
39
|
+
- `sql` - SQL
|
|
40
|
+
- `bash`, `shell` - Shell scripts
|
|
41
|
+
- Many more...
|
|
42
|
+
|
|
43
|
+
- type: RjBuildDescriber
|
|
44
|
+
title: "Basic Code Highlighting"
|
|
45
|
+
description:
|
|
46
|
+
- type: Markdown
|
|
47
|
+
content: |
|
|
48
|
+
Simple code highlighting for JavaScript with automatic theme adaptation.
|
|
49
|
+
|
|
50
|
+
toDescribe:
|
|
51
|
+
renderView:
|
|
52
|
+
- type: SyntaxHighlighter
|
|
53
|
+
language: javascript
|
|
54
|
+
content: |
|
|
55
|
+
function greetUser(name) {
|
|
56
|
+
const message = `Hello, ${name}!`;
|
|
57
|
+
console.log(message);
|
|
58
|
+
return message;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
greetUser("Developer");
|
|
62
|
+
|
|
63
|
+
data: {}
|
|
64
|
+
|
|
65
|
+
- type: RjBuildDescriber
|
|
66
|
+
title: "YAML Configuration Example"
|
|
67
|
+
description:
|
|
68
|
+
- type: Markdown
|
|
69
|
+
content: |
|
|
70
|
+
Highlighting YAML configuration with line numbers enabled.
|
|
71
|
+
|
|
72
|
+
toDescribe:
|
|
73
|
+
renderView:
|
|
74
|
+
- type: SyntaxHighlighter
|
|
75
|
+
language: yaml
|
|
76
|
+
showLineNumbers: true
|
|
77
|
+
content: |
|
|
78
|
+
renderView:
|
|
79
|
+
- type: button
|
|
80
|
+
content: "Click me"
|
|
81
|
+
actions:
|
|
82
|
+
- what: setData
|
|
83
|
+
on: click
|
|
84
|
+
path: ~.clicked
|
|
85
|
+
value: true
|
|
86
|
+
|
|
87
|
+
data:
|
|
88
|
+
clicked: false
|
|
89
|
+
|
|
90
|
+
data: {}
|
|
91
|
+
|
|
92
|
+
- type: RjBuildDescriber
|
|
93
|
+
title: "JSX Component Example"
|
|
94
|
+
description:
|
|
95
|
+
- type: Markdown
|
|
96
|
+
content: |
|
|
97
|
+
React JSX code with proper syntax highlighting.
|
|
98
|
+
|
|
99
|
+
toDescribe:
|
|
100
|
+
renderView:
|
|
101
|
+
- type: SyntaxHighlighter
|
|
102
|
+
language: jsx
|
|
103
|
+
wrapLongLines: true
|
|
104
|
+
content: |
|
|
105
|
+
import React from 'react';
|
|
106
|
+
import { ActionDependant } from "@ea-lab/reactive-json/dist/engine";
|
|
107
|
+
|
|
108
|
+
export const CustomButton = ({ props }) => {
|
|
109
|
+
const handleClick = () => {
|
|
110
|
+
console.log('Button clicked!');
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<ActionDependant {...props}>
|
|
115
|
+
<button onClick={handleClick} className="custom-btn">
|
|
116
|
+
{props.content || 'Default Text'}
|
|
117
|
+
</button>
|
|
118
|
+
</ActionDependant>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
data: {}
|
|
123
|
+
|
|
124
|
+
- type: Markdown
|
|
125
|
+
content: |
|
|
126
|
+
## Dynamic Content
|
|
127
|
+
|
|
128
|
+
The component supports template evaluation for dynamic content:
|
|
129
|
+
|
|
130
|
+
```yaml
|
|
131
|
+
renderView:
|
|
132
|
+
- type: SyntaxHighlighter
|
|
133
|
+
language: ~.selectedLanguage
|
|
134
|
+
content: ~.codeSnippet
|
|
135
|
+
|
|
136
|
+
data:
|
|
137
|
+
selectedLanguage: "python"
|
|
138
|
+
codeSnippet: |
|
|
139
|
+
def hello_world():
|
|
140
|
+
print("Hello, World!")
|
|
141
|
+
return True
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Custom Styling
|
|
145
|
+
|
|
146
|
+
You can provide custom styles for different themes:
|
|
147
|
+
|
|
148
|
+
```yaml
|
|
149
|
+
renderView:
|
|
150
|
+
- type: SyntaxHighlighter
|
|
151
|
+
language: javascript
|
|
152
|
+
lightStyle: ~.customLightTheme
|
|
153
|
+
darkStyle: ~.customDarkTheme
|
|
154
|
+
content: "console.log('Themed code');"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Best Practices
|
|
158
|
+
|
|
159
|
+
1. **Language Specification**: Always specify the language for proper highlighting
|
|
160
|
+
2. **Content Length**: For very long code blocks, consider enabling line wrapping
|
|
161
|
+
3. **Line Numbers**: Use line numbers for code that will be referenced by line
|
|
162
|
+
4. **Theme Consistency**: Let the component handle theme switching automatically
|
|
163
|
+
5. **Template Evaluation**: Use template patterns for dynamic code examples
|
|
164
|
+
|
|
165
|
+
templates:
|
|
166
|
+
|
|
167
|
+
data: {}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Documentation Components
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This section documents components that are specific to the reactive-json-docs package. These components are not part of the core Reactive-JSON library but are provided by the documentation system to enhance the presentation of examples and technical content.
|
|
6
|
+
|
|
7
|
+
**Important**: These components are only available when using reactive-json-docs and are not included in the core @ea-lab/reactive-json package.
|
|
8
|
+
|
|
9
|
+
## Available Components
|
|
10
|
+
|
|
11
|
+
The documentation system provides specialized components for:
|
|
12
|
+
- **Code Highlighting**: Syntax highlighting for code examples
|
|
13
|
+
- **Documentation Layout**: Components for organizing documentation content
|
|
14
|
+
- **Interactive Examples**: Components for demonstrating Reactive-JSON features
|
|
15
|
+
|
|
16
|
+
## Usage Context
|
|
17
|
+
|
|
18
|
+
These components are designed for use in:
|
|
19
|
+
- Documentation websites
|
|
20
|
+
- Code examples and tutorials
|
|
21
|
+
- Technical content presentation
|
|
22
|
+
- Educational materials
|
|
23
|
+
|
|
24
|
+
They integrate seamlessly with core Reactive-JSON components and follow the same configuration patterns.
|
|
25
|
+
|
|
26
|
+
## Component List
|
|
27
|
+
|
|
28
|
+
- **[SyntaxHighlighter](SyntaxHighlighter.md)**: Advanced syntax highlighting with dark mode support
|