@goplasmatic/datalogic-ui 0.1.0 → 0.1.1

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/dist/index.d.ts CHANGED
@@ -40,7 +40,7 @@ declare interface ConversionResult {
40
40
  rootId: string | null;
41
41
  }
42
42
 
43
- export declare function DataLogicEditor({ value, onChange: _onChange, data, mode, theme: themeProp, className, }: DataLogicEditorProps): JSX.Element;
43
+ export declare function DataLogicEditor({ value, onChange: _onChange, data, mode, theme: themeProp, className, preserveStructure, }: DataLogicEditorProps): JSX.Element;
44
44
 
45
45
  /**
46
46
  * Editor operating mode:
@@ -71,6 +71,12 @@ export declare interface DataLogicEditorProps {
71
71
  theme?: 'light' | 'dark';
72
72
  /** Additional CSS class */
73
73
  className?: string;
74
+ /**
75
+ * Enable structure preserve mode for JSON templates with embedded JSONLogic.
76
+ * When true, multi-key objects and arrays are treated as data structures
77
+ * with embedded JSONLogic expressions, rather than invalid JSONLogic.
78
+ */
79
+ preserveStructure?: boolean;
74
80
  }
75
81
 
76
82
  export declare interface DecisionNodeData extends BaseNodeData {
@@ -87,7 +93,7 @@ export declare interface DecisionNodeData extends BaseNodeData {
87
93
 
88
94
  export declare type EvaluationResultsMap = Map<string, NodeEvaluationResult>;
89
95
 
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';
96
+ 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' | 'braces';
91
97
 
92
98
  declare type JsonLogicExpression = {
93
99
  [operator: string]: JsonLogicValue | JsonLogicValue[];
@@ -95,7 +101,12 @@ declare type JsonLogicExpression = {
95
101
 
96
102
  declare type JsonLogicPrimitive = string | number | boolean | null;
97
103
 
98
- export declare function jsonLogicToNodes(expr: JsonLogicValue | null): ConversionResult;
104
+ export declare function jsonLogicToNodes(expr: JsonLogicValue | null, options?: JsonLogicToNodesOptions): ConversionResult;
105
+
106
+ declare interface JsonLogicToNodesOptions {
107
+ /** Enable structure preserve mode for JSON templates with embedded JSONLogic */
108
+ preserveStructure?: boolean;
109
+ }
99
110
 
100
111
  export declare type JsonLogicValue = JsonLogicPrimitive | JsonLogicPrimitive[] | JsonLogicExpression | JsonLogicValue[];
101
112
 
@@ -109,7 +120,7 @@ export declare type LogicEdge = Edge;
109
120
 
110
121
  export declare type LogicNode = Node_2<LogicNodeData>;
111
122
 
112
- export declare type LogicNodeData = OperatorNodeData | VariableNodeData | LiteralNodeData | VerticalCellNodeData | DecisionNodeData;
123
+ export declare type LogicNodeData = OperatorNodeData | VariableNodeData | LiteralNodeData | VerticalCellNodeData | DecisionNodeData | StructureNodeData;
113
124
 
114
125
  export declare interface NodeEvaluationResult {
115
126
  value: unknown;
@@ -142,6 +153,25 @@ export declare interface OperatorNodeData extends BaseNodeData {
142
153
 
143
154
  export declare const OPERATORS: Record<string, OperatorMeta>;
144
155
 
156
+ declare interface StructureElement {
157
+ type: 'inline' | 'expression';
158
+ path: string[];
159
+ key?: string;
160
+ value?: JsonLogicValue;
161
+ branchId?: string;
162
+ startOffset: number;
163
+ endOffset: number;
164
+ }
165
+
166
+ declare interface StructureNodeData extends BaseNodeData {
167
+ type: 'structure';
168
+ isArray: boolean;
169
+ formattedJson: string;
170
+ elements: StructureElement[];
171
+ collapsed?: boolean;
172
+ expressionText?: string;
173
+ }
174
+
145
175
  export declare interface VariableNodeData extends BaseNodeData {
146
176
  type: 'variable';
147
177
  operator: 'var' | 'val' | 'exists';
@@ -161,6 +191,6 @@ export declare interface VerticalCellNodeData extends BaseNodeData {
161
191
  collapsedCellIndices?: number[];
162
192
  }
163
193
 
164
- declare type VisualNodeType = 'operator' | 'variable' | 'literal' | 'verticalCell' | 'decision';
194
+ declare type VisualNodeType = 'operator' | 'variable' | 'literal' | 'verticalCell' | 'decision' | 'structure';
165
195
 
166
196
  export { }