@goplasmatic/datalogic-ui 0.1.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/LICENSE +201 -0
- package/README.md +198 -0
- package/dist/datalogic_wasm-r9jsW6oT.js +314 -0
- package/dist/datalogic_wasm-r9jsW6oT.js.map +1 -0
- package/dist/datalogic_wasm-vS4KZjmk.cjs +410 -0
- package/dist/datalogic_wasm-vS4KZjmk.cjs.map +1 -0
- package/dist/demo.gif +0 -0
- package/dist/index.cjs +9007 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +166 -0
- package/dist/index.js +8791 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.json +11 -0
- package/dist/robots.txt +4 -0
- package/dist/styles.css +1987 -0
- package/package.json +91 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { Edge } from '@xyflow/react';
|
|
2
|
+
import { JSX } from 'react/jsx-runtime';
|
|
3
|
+
import { Node as Node_2 } from '@xyflow/react';
|
|
4
|
+
|
|
5
|
+
export declare function applyTreeLayout(nodes: LogicNode[], edges?: LogicEdge[]): LogicNode[];
|
|
6
|
+
|
|
7
|
+
declare interface ArgSummary {
|
|
8
|
+
icon: IconName;
|
|
9
|
+
label: string;
|
|
10
|
+
valueType: 'string' | 'number' | 'boolean' | 'null' | 'array' | 'date' | 'expression';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare interface BaseNodeData extends Record<string, unknown> {
|
|
14
|
+
type: VisualNodeType;
|
|
15
|
+
parentId?: string;
|
|
16
|
+
argIndex?: number;
|
|
17
|
+
branchType?: 'yes' | 'no';
|
|
18
|
+
expression?: JsonLogicValue;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export declare const CATEGORY_COLORS: Record<OperatorCategory, string>;
|
|
22
|
+
|
|
23
|
+
declare interface CellData {
|
|
24
|
+
type: 'inline' | 'branch';
|
|
25
|
+
rowLabel?: string;
|
|
26
|
+
label?: string;
|
|
27
|
+
icon?: IconName;
|
|
28
|
+
branchId?: string;
|
|
29
|
+
index: number;
|
|
30
|
+
summary?: ArgSummary;
|
|
31
|
+
conditionBranchId?: string;
|
|
32
|
+
thenBranchId?: string;
|
|
33
|
+
conditionText?: string;
|
|
34
|
+
thenText?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare interface ConversionResult {
|
|
38
|
+
nodes: LogicNode[];
|
|
39
|
+
edges: LogicEdge[];
|
|
40
|
+
rootId: string | null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export declare function DataLogicEditor({ value, onChange: _onChange, data, mode, theme: themeProp, className, }: DataLogicEditorProps): JSX.Element;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Editor operating mode:
|
|
47
|
+
* - 'visualize' (ReadOnly): Static diagram visualization, no evaluation
|
|
48
|
+
* - 'debug' (Debugger): Diagram with evaluation results and step-through debugging
|
|
49
|
+
* - 'edit' (Editor+Debugger): Coming Soon - Full visual builder with live evaluation
|
|
50
|
+
*/
|
|
51
|
+
export declare type DataLogicEditorMode = 'visualize' | 'debug' | 'edit';
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Props for the DataLogicEditor component (public API)
|
|
55
|
+
*/
|
|
56
|
+
export declare interface DataLogicEditorProps {
|
|
57
|
+
/** JSONLogic expression to render */
|
|
58
|
+
value: JsonLogicValue | null;
|
|
59
|
+
/** Callback when expression changes (only in 'edit' mode - Coming Soon) */
|
|
60
|
+
onChange?: (expr: JsonLogicValue | null) => void;
|
|
61
|
+
/** Data context for evaluation (used in 'debug' and 'edit' modes) */
|
|
62
|
+
data?: unknown;
|
|
63
|
+
/**
|
|
64
|
+
* Editor operating mode:
|
|
65
|
+
* - 'visualize' (default): Static diagram visualization, no evaluation
|
|
66
|
+
* - 'debug': Diagram with evaluation results and step-through debugging
|
|
67
|
+
* - 'edit': Coming Soon - Full visual builder with live evaluation
|
|
68
|
+
*/
|
|
69
|
+
mode?: DataLogicEditorMode;
|
|
70
|
+
/** Theme override - 'light' or 'dark'. If not provided, uses system preference */
|
|
71
|
+
theme?: 'light' | 'dark';
|
|
72
|
+
/** Additional CSS class */
|
|
73
|
+
className?: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export declare interface DecisionNodeData extends BaseNodeData {
|
|
77
|
+
type: 'decision';
|
|
78
|
+
conditionText: string;
|
|
79
|
+
conditionExpression: JsonLogicValue;
|
|
80
|
+
isConditionComplex: boolean;
|
|
81
|
+
conditionBranchId?: string;
|
|
82
|
+
yesBranchId: string;
|
|
83
|
+
noBranchId: string;
|
|
84
|
+
collapsed?: boolean;
|
|
85
|
+
expressionText?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export declare type EvaluationResultsMap = Map<string, NodeEvaluationResult>;
|
|
89
|
+
|
|
90
|
+
declare type IconName = 'scale' | 'diamond' | 'calculator' | 'repeat' | 'type' | 'box' | 'git-merge' | 'text' | 'hash' | 'toggle-left' | 'toggle-right' | 'check' | 'x' | 'ban' | 'list' | 'calendar' | 'cog' | 'database' | 'boxes' | 'circle-help' | 'circle-x' | 'git-commit-horizontal' | 'search' | 'divide' | 'quote';
|
|
91
|
+
|
|
92
|
+
declare type JsonLogicExpression = {
|
|
93
|
+
[operator: string]: JsonLogicValue | JsonLogicValue[];
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
declare type JsonLogicPrimitive = string | number | boolean | null;
|
|
97
|
+
|
|
98
|
+
export declare function jsonLogicToNodes(expr: JsonLogicValue | null): ConversionResult;
|
|
99
|
+
|
|
100
|
+
export declare type JsonLogicValue = JsonLogicPrimitive | JsonLogicPrimitive[] | JsonLogicExpression | JsonLogicValue[];
|
|
101
|
+
|
|
102
|
+
export declare interface LiteralNodeData extends BaseNodeData {
|
|
103
|
+
type: 'literal';
|
|
104
|
+
value: JsonLogicValue;
|
|
105
|
+
valueType: 'string' | 'number' | 'boolean' | 'null' | 'array';
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export declare type LogicEdge = Edge;
|
|
109
|
+
|
|
110
|
+
export declare type LogicNode = Node_2<LogicNodeData>;
|
|
111
|
+
|
|
112
|
+
export declare type LogicNodeData = OperatorNodeData | VariableNodeData | LiteralNodeData | VerticalCellNodeData | DecisionNodeData;
|
|
113
|
+
|
|
114
|
+
export declare interface NodeEvaluationResult {
|
|
115
|
+
value: unknown;
|
|
116
|
+
error: string | null;
|
|
117
|
+
type: 'boolean' | 'number' | 'string' | 'null' | 'array' | 'object' | 'undefined';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export declare type OperatorCategory = 'variable' | 'comparison' | 'logical' | 'arithmetic' | 'string' | 'array' | 'control' | 'datetime' | 'error' | 'literal';
|
|
121
|
+
|
|
122
|
+
declare interface OperatorMeta {
|
|
123
|
+
name: string;
|
|
124
|
+
category: OperatorCategory;
|
|
125
|
+
label: string;
|
|
126
|
+
description: string;
|
|
127
|
+
minArgs?: number;
|
|
128
|
+
maxArgs?: number;
|
|
129
|
+
argLabels?: string[];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export declare interface OperatorNodeData extends BaseNodeData {
|
|
133
|
+
type: 'operator';
|
|
134
|
+
operator: string;
|
|
135
|
+
category: OperatorCategory;
|
|
136
|
+
label: string;
|
|
137
|
+
childIds: string[];
|
|
138
|
+
collapsed?: boolean;
|
|
139
|
+
expressionText?: string;
|
|
140
|
+
inlineDisplay?: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export declare const OPERATORS: Record<string, OperatorMeta>;
|
|
144
|
+
|
|
145
|
+
export declare interface VariableNodeData extends BaseNodeData {
|
|
146
|
+
type: 'variable';
|
|
147
|
+
operator: 'var' | 'val' | 'exists';
|
|
148
|
+
path: string;
|
|
149
|
+
defaultValue?: JsonLogicValue;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export declare interface VerticalCellNodeData extends BaseNodeData {
|
|
153
|
+
type: 'verticalCell';
|
|
154
|
+
operator: string;
|
|
155
|
+
category: OperatorCategory;
|
|
156
|
+
label: string;
|
|
157
|
+
icon: IconName;
|
|
158
|
+
cells: CellData[];
|
|
159
|
+
collapsed?: boolean;
|
|
160
|
+
expressionText?: string;
|
|
161
|
+
collapsedCellIndices?: number[];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
declare type VisualNodeType = 'operator' | 'variable' | 'literal' | 'verticalCell' | 'decision';
|
|
165
|
+
|
|
166
|
+
export { }
|