@goplasmatic/datalogic-ui 4.0.13 → 4.0.14
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.md +51 -47
- package/dist/datalogic_wasm-D6FdNS7Y.cjs +470 -0
- package/dist/datalogic_wasm-RwP1VzMM.js +373 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/datalogic_wasm-C1OsFEWV.cjs +0 -470
- package/dist/datalogic_wasm-C6O60ZDK.js +0 -373
package/README.md
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
# @goplasmatic/datalogic-ui
|
|
2
2
|
|
|
3
|
-
A React component library for visualizing and
|
|
4
|
-
|
|
5
|
-
## Demo
|
|
6
|
-
|
|
7
|
-

|
|
3
|
+
A React component library for visualizing, debugging, and editing JSONLogic expressions as interactive node-based flow diagrams.
|
|
8
4
|
|
|
9
5
|
## Features
|
|
10
6
|
|
|
11
7
|
- Visual representation of JSONLogic expressions as flow diagrams
|
|
12
|
-
- Support for all standard JSONLogic operators (logical, comparison, arithmetic, string, array, control flow)
|
|
13
|
-
- Tree-based automatic layout using dagre
|
|
14
|
-
-
|
|
15
|
-
-
|
|
8
|
+
- Support for all standard JSONLogic operators (logical, comparison, arithmetic, string, array, control flow, datetime, error handling)
|
|
9
|
+
- Tree-based automatic layout using @dagrejs/dagre
|
|
10
|
+
- Prop-based modes: read-only visualization, debugging with step-through trace, and full visual editing
|
|
11
|
+
- Editing mode with node selection, properties panel, context menus, and undo/redo
|
|
12
|
+
- Structure preserve mode for JSON templates with embedded JSONLogic
|
|
13
|
+
- Built-in WASM-based JSONLogic evaluation with execution tracing
|
|
16
14
|
- Light/dark theme support with system preference detection
|
|
17
15
|
|
|
18
16
|
## Installation
|
|
@@ -45,15 +43,9 @@ function App() {
|
|
|
45
43
|
|
|
46
44
|
## Usage Modes
|
|
47
45
|
|
|
48
|
-
The editor
|
|
46
|
+
The editor behavior is controlled by props rather than a mode enum. Different combinations of props enable different functionality:
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|------|-----------|-------------|
|
|
52
|
-
| ReadOnly | `'visualize'` | Static diagram visualization, no evaluation |
|
|
53
|
-
| Debugger | `'debug'` | Diagram with evaluation results and step-through debugging |
|
|
54
|
-
| Editor | `'edit'` | **Coming Soon** - Full visual builder with live evaluation |
|
|
55
|
-
|
|
56
|
-
### Mode 1: ReadOnly (`visualize`) - Default
|
|
48
|
+
### Read-only (default)
|
|
57
49
|
|
|
58
50
|
Simply render a JSONLogic expression as a flow diagram:
|
|
59
51
|
|
|
@@ -61,44 +53,54 @@ Simply render a JSONLogic expression as a flow diagram:
|
|
|
61
53
|
<DataLogicEditor value={expression} />
|
|
62
54
|
```
|
|
63
55
|
|
|
64
|
-
###
|
|
56
|
+
### With Debugger
|
|
65
57
|
|
|
66
|
-
|
|
58
|
+
Provide `data` to enable debugger controls with step-through execution trace:
|
|
67
59
|
|
|
68
60
|
```tsx
|
|
69
61
|
<DataLogicEditor
|
|
70
62
|
value={expression}
|
|
71
63
|
data={{ age: 25, status: "active" }}
|
|
72
|
-
mode="debug"
|
|
73
64
|
/>
|
|
74
65
|
```
|
|
75
66
|
|
|
76
|
-
###
|
|
67
|
+
### Editable
|
|
77
68
|
|
|
78
|
-
|
|
69
|
+
Enable full visual editing with node selection, properties panel, context menus, and undo/redo:
|
|
79
70
|
|
|
80
71
|
```tsx
|
|
81
|
-
// Coming Soon
|
|
82
72
|
<DataLogicEditor
|
|
83
73
|
value={expression}
|
|
84
74
|
onChange={setExpression}
|
|
85
|
-
|
|
86
|
-
mode="edit"
|
|
75
|
+
editable
|
|
87
76
|
/>
|
|
88
77
|
```
|
|
89
78
|
|
|
90
|
-
|
|
79
|
+
### Editable + Debugger
|
|
80
|
+
|
|
81
|
+
Combine editing with live debugging:
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
<DataLogicEditor
|
|
85
|
+
value={expression}
|
|
86
|
+
onChange={setExpression}
|
|
87
|
+
data={{ age: 25, status: "active" }}
|
|
88
|
+
editable
|
|
89
|
+
/>
|
|
90
|
+
```
|
|
91
91
|
|
|
92
92
|
## Props
|
|
93
93
|
|
|
94
94
|
| Prop | Type | Default | Description |
|
|
95
95
|
|------|------|---------|-------------|
|
|
96
96
|
| `value` | `JsonLogicValue \| null` | required | JSONLogic expression to render |
|
|
97
|
-
| `onChange` | `(expr: JsonLogicValue \| null) => void` | - | Callback when expression changes (
|
|
98
|
-
| `data` | `unknown` | - | Data context for evaluation
|
|
99
|
-
| `
|
|
100
|
-
| `theme` | `'light' \| 'dark'` | system | Theme override |
|
|
97
|
+
| `onChange` | `(expr: JsonLogicValue \| null) => void` | - | Callback when expression changes (only when `editable` is true) |
|
|
98
|
+
| `data` | `unknown` | - | Data context for evaluation. When provided, debugger controls become available |
|
|
99
|
+
| `theme` | `'light' \| 'dark'` | system | Theme override. If not provided, uses system preference |
|
|
101
100
|
| `className` | `string` | - | Additional CSS class |
|
|
101
|
+
| `preserveStructure` | `boolean` | `false` | Enable structure preserve mode for JSON templates with embedded JSONLogic |
|
|
102
|
+
| `onPreserveStructureChange` | `(value: boolean) => void` | - | Callback when preserve structure changes (from toolbar checkbox) |
|
|
103
|
+
| `editable` | `boolean` | `false` | Enable editing: node selection, properties panel, context menus, undo/redo |
|
|
102
104
|
|
|
103
105
|
## Exports
|
|
104
106
|
|
|
@@ -113,10 +115,15 @@ import { DataLogicEditor } from '@goplasmatic/datalogic-ui';
|
|
|
113
115
|
```tsx
|
|
114
116
|
import type {
|
|
115
117
|
DataLogicEditorProps,
|
|
116
|
-
DataLogicEditorMode,
|
|
117
118
|
JsonLogicValue,
|
|
118
119
|
LogicNode,
|
|
119
120
|
LogicEdge,
|
|
121
|
+
LogicNodeData,
|
|
122
|
+
OperatorNodeData,
|
|
123
|
+
VariableNodeData,
|
|
124
|
+
LiteralNodeData,
|
|
125
|
+
NodeEvaluationResult,
|
|
126
|
+
EvaluationResultsMap,
|
|
120
127
|
OperatorCategory,
|
|
121
128
|
} from '@goplasmatic/datalogic-ui';
|
|
122
129
|
```
|
|
@@ -150,11 +157,10 @@ The component respects the `data-theme` attribute on parent elements for theming
|
|
|
150
157
|
## Development
|
|
151
158
|
|
|
152
159
|
```bash
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
npm run lint # Run ESLint
|
|
160
|
+
pnpm install # Install dependencies
|
|
161
|
+
pnpm dev:ui # Start development server
|
|
162
|
+
pnpm build:ui:lib # Build library for publishing
|
|
163
|
+
pnpm lint:ui # Run ESLint
|
|
158
164
|
```
|
|
159
165
|
|
|
160
166
|
## Architecture
|
|
@@ -163,8 +169,8 @@ The main component is `DataLogicEditor` which:
|
|
|
163
169
|
|
|
164
170
|
1. Accepts a `value` prop (JSONLogic expression) and renders it as a flow diagram
|
|
165
171
|
2. Uses React Flow (`@xyflow/react`) for the node canvas
|
|
166
|
-
3. Internally loads WASM module for JSONLogic evaluation
|
|
167
|
-
4. Supports
|
|
172
|
+
3. Internally loads WASM module for JSONLogic evaluation and execution tracing
|
|
173
|
+
4. Supports read-only, debugger, and editable modes via props
|
|
168
174
|
|
|
169
175
|
### Data Flow
|
|
170
176
|
|
|
@@ -175,10 +181,9 @@ The main component is `DataLogicEditor` which:
|
|
|
175
181
|
|
|
176
182
|
### Node Types
|
|
177
183
|
|
|
178
|
-
- **OperatorNode
|
|
179
|
-
- **
|
|
180
|
-
- **
|
|
181
|
-
- **VerticalCellNode**: Renders vertical layouts for comparison chains and iterators
|
|
184
|
+
- **OperatorNode** (UnifiedOperatorNode): Renders all operators with cell-based argument display (and, or, if, var, val, ==, +, etc.)
|
|
185
|
+
- **LiteralNode**: Renders primitive values (strings, numbers, booleans, null)
|
|
186
|
+
- **StructureNode**: Renders JSON objects/arrays in structure preserve mode
|
|
182
187
|
|
|
183
188
|
## Tech Stack
|
|
184
189
|
|
|
@@ -186,13 +191,12 @@ The main component is `DataLogicEditor` which:
|
|
|
186
191
|
- TypeScript
|
|
187
192
|
- Vite
|
|
188
193
|
- React Flow (@xyflow/react)
|
|
189
|
-
- dagre (
|
|
194
|
+
- @dagrejs/dagre (graph layout)
|
|
195
|
+
- lucide-react (icons)
|
|
196
|
+
- @msgpack/msgpack (data serialization)
|
|
197
|
+
- fflate (compression)
|
|
190
198
|
- @goplasmatic/datalogic (bundled, for WASM evaluation)
|
|
191
199
|
|
|
192
|
-
## Roadmap
|
|
193
|
-
|
|
194
|
-
- **Full Visual Builder (Edit Mode)**: Interactive visual editing of JSONLogic expressions with drag-and-drop node creation, connection editing, and real-time evaluation feedback.
|
|
195
|
-
|
|
196
200
|
## Documentation
|
|
197
201
|
|
|
198
202
|
For complete documentation including all props, customization options, and advanced usage, see the [full documentation](https://goplasmatic.github.io/datalogic-rs/react-ui/installation.html).
|