@goplasmatic/dataflow-ui 2.0.15 → 2.0.16

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.cjs CHANGED
@@ -24303,6 +24303,21 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
24303
24303
  state.currentStepIndex,
24304
24304
  traceNodeMap
24305
24305
  ]);
24306
+ const errorNodeIds = React.useMemo(() => {
24307
+ const ids = /* @__PURE__ */ new Set();
24308
+ for (let i = 0; i <= state.currentStepIndex; i++) {
24309
+ const step = state.steps[i];
24310
+ if (step == null ? void 0 : step.error) {
24311
+ const traceId = `trace-${step.node_id}`;
24312
+ ids.add(traceNodeMap.get(traceId) ?? traceId);
24313
+ }
24314
+ }
24315
+ return ids;
24316
+ }, [
24317
+ state.steps,
24318
+ state.currentStepIndex,
24319
+ traceNodeMap
24320
+ ]);
24306
24321
  const parentMap = React.useMemo(() => {
24307
24322
  const map = /* @__PURE__ */ new Map();
24308
24323
  for (const node of nodes) {
@@ -24358,6 +24373,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
24358
24373
  currentStep,
24359
24374
  currentNodeId,
24360
24375
  executedNodeIds,
24376
+ errorNodeIds,
24361
24377
  pathNodeIds,
24362
24378
  play,
24363
24379
  pause,
@@ -24372,6 +24388,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
24372
24388
  currentStep,
24373
24389
  currentNodeId,
24374
24390
  executedNodeIds,
24391
+ errorNodeIds,
24375
24392
  pathNodeIds,
24376
24393
  play,
24377
24394
  pause,
@@ -24401,12 +24418,14 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
24401
24418
  const isCurrent = context.currentNodeId === nodeId;
24402
24419
  const isExecuted = context.executedNodeIds.has(nodeId);
24403
24420
  const isOnPath = context.pathNodeIds.has(nodeId);
24421
+ const isError = context.errorNodeIds.has(nodeId);
24404
24422
  const isPending = !isCurrent && !isExecuted && !isOnPath;
24405
24423
  return {
24406
24424
  isCurrent,
24407
24425
  isExecuted,
24408
24426
  isPending,
24409
24427
  isOnPath,
24428
+ isError,
24410
24429
  step: isCurrent ? context.currentStep : null
24411
24430
  };
24412
24431
  }, [
@@ -24759,8 +24778,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
24759
24778
  selectedNodeId
24760
24779
  ]);
24761
24780
  const clearSelection = React.useCallback(() => {
24762
- setSelectedNodeId(null);
24763
- setSelectedNodeIds(/* @__PURE__ */ new Set());
24781
+ setSelectedNodeId((prev) => prev === null ? prev : null);
24782
+ setSelectedNodeIds((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Set());
24764
24783
  }, []);
24765
24784
  const selectAllNodes = React.useCallback(() => {
24766
24785
  const allIds = new Set(internalNodes.map((n) => n.id));
@@ -26364,14 +26383,15 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26364
26383
  const propertyPanelFocusRef = React.useRef(null);
26365
26384
  const nodes = isEditMode ? internalNodes : propNodes;
26366
26385
  const selection2 = useSelectionState(nodes, internalNodes);
26367
- const history = useHistoryState(nodesRef, setInternalNodes, onNodesChange, selection2.clearSelection);
26386
+ const { setSelectedNodeId, setSelectedNodeIds, selectNode: selectionSelectNode, setSelection: selectionSetSelection, toggleNodeSelection: selectionToggleNodeSelection, addToSelection: selectionAddToSelection, clearSelection: selectionClearSelection, selectAllNodes: selectionSelectAllNodes, selectChildren: selectionSelectChildren } = selection2;
26387
+ const history = useHistoryState(nodesRef, setInternalNodes, onNodesChange, selectionClearSelection);
26368
26388
  const clipboard = useClipboardState({
26369
26389
  selectedNode: selection2.selectedNode,
26370
26390
  internalNodes,
26371
26391
  pushToUndoStack: history.pushToUndoStack,
26372
26392
  setInternalNodes,
26373
26393
  onNodesChange,
26374
- setSelectedNodeId: selection2.setSelectedNodeId,
26394
+ setSelectedNodeId,
26375
26395
  setPanelValues,
26376
26396
  hasEditedRef
26377
26397
  });
@@ -26380,7 +26400,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26380
26400
  setInternalNodes,
26381
26401
  onNodesChange,
26382
26402
  selectedNodeId: selection2.selectedNodeId,
26383
- setSelectedNodeId: selection2.setSelectedNodeId,
26403
+ setSelectedNodeId,
26384
26404
  setPanelValues,
26385
26405
  hasEditedRef,
26386
26406
  nodes,
@@ -26398,15 +26418,15 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26398
26418
  React.useEffect(() => {
26399
26419
  setIsEditMode(initialEditMode);
26400
26420
  if (!initialEditMode) {
26401
- selection2.setSelectedNodeId(null);
26402
- selection2.setSelectedNodeIds(/* @__PURE__ */ new Set());
26403
- setPanelValues({});
26404
- setInternalNodes(propNodes);
26421
+ setSelectedNodeId(null);
26422
+ setSelectedNodeIds(/* @__PURE__ */ new Set());
26423
+ setPanelValues((prev) => Object.keys(prev).length === 0 ? prev : {});
26405
26424
  hasEditedRef.current = false;
26406
26425
  }
26407
26426
  }, [
26408
26427
  initialEditMode,
26409
- propNodes
26428
+ setSelectedNodeId,
26429
+ setSelectedNodeIds
26410
26430
  ]);
26411
26431
  React.useEffect(() => {
26412
26432
  nodesRef.current = internalNodes;
@@ -26416,12 +26436,13 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26416
26436
  const setEditMode = React.useCallback((enabled) => {
26417
26437
  setIsEditMode(enabled);
26418
26438
  if (!enabled) {
26419
- selection2.setSelectedNodeId(null);
26420
- selection2.setSelectedNodeIds(/* @__PURE__ */ new Set());
26439
+ setSelectedNodeId(null);
26440
+ setSelectedNodeIds(/* @__PURE__ */ new Set());
26421
26441
  setPanelValues({});
26422
26442
  }
26423
26443
  }, [
26424
- selection2
26444
+ setSelectedNodeId,
26445
+ setSelectedNodeIds
26425
26446
  ]);
26426
26447
  const updatePanelValue = React.useCallback((fieldId, value2) => {
26427
26448
  setPanelValues((prev) => ({
@@ -26433,50 +26454,50 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26433
26454
  setPanelValues(values ?? {});
26434
26455
  }, []);
26435
26456
  const selectNode = React.useCallback((nodeId) => {
26436
- selection2.selectNode(nodeId);
26457
+ selectionSelectNode(nodeId);
26437
26458
  setPanelValues({});
26438
26459
  }, [
26439
- selection2
26460
+ selectionSelectNode
26440
26461
  ]);
26441
26462
  const setSelectionWrapped = React.useCallback((nodeIds) => {
26442
- selection2.setSelection(nodeIds);
26463
+ selectionSetSelection(nodeIds);
26443
26464
  setPanelValues({});
26444
26465
  }, [
26445
- selection2
26466
+ selectionSetSelection
26446
26467
  ]);
26447
26468
  const toggleNodeSelection = React.useCallback((nodeId) => {
26448
- selection2.toggleNodeSelection(nodeId);
26469
+ selectionToggleNodeSelection(nodeId);
26449
26470
  setPanelValues({});
26450
26471
  }, [
26451
- selection2
26472
+ selectionToggleNodeSelection
26452
26473
  ]);
26453
26474
  const addToSelection = React.useCallback((nodeId) => {
26454
- selection2.addToSelection(nodeId);
26475
+ selectionAddToSelection(nodeId);
26455
26476
  setPanelValues({});
26456
26477
  }, [
26457
- selection2
26478
+ selectionAddToSelection
26458
26479
  ]);
26459
26480
  const clearSelection = React.useCallback(() => {
26460
- selection2.clearSelection();
26461
- setPanelValues({});
26481
+ selectionClearSelection();
26482
+ setPanelValues((prev) => Object.keys(prev).length === 0 ? prev : {});
26462
26483
  }, [
26463
- selection2
26484
+ selectionClearSelection
26464
26485
  ]);
26465
26486
  const selectAllNodes = React.useCallback(() => {
26466
- selection2.selectAllNodes();
26487
+ selectionSelectAllNodes();
26467
26488
  setPanelValues({});
26468
26489
  }, [
26469
- selection2
26490
+ selectionSelectAllNodes
26470
26491
  ]);
26471
26492
  const selectChildren = React.useCallback((nodeId) => {
26472
- selection2.selectChildren(nodeId);
26493
+ selectionSelectChildren(nodeId);
26473
26494
  setPanelValues({});
26474
26495
  }, [
26475
- selection2
26496
+ selectionSelectChildren
26476
26497
  ]);
26477
26498
  const focusPropertyPanel = React.useCallback((nodeId, fieldId) => {
26478
- selection2.setSelectedNodeId(nodeId);
26479
- selection2.setSelectedNodeIds(/* @__PURE__ */ new Set([
26499
+ setSelectedNodeId(nodeId);
26500
+ setSelectedNodeIds(/* @__PURE__ */ new Set([
26480
26501
  nodeId
26481
26502
  ]));
26482
26503
  setPanelValues({});
@@ -26485,7 +26506,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26485
26506
  (_a = propertyPanelFocusRef.current) == null ? void 0 : _a.focusField(fieldId);
26486
26507
  }, 100);
26487
26508
  }, [
26488
- selection2
26509
+ setSelectedNodeId,
26510
+ setSelectedNodeIds
26489
26511
  ]);
26490
26512
  const applyPanelChanges = React.useCallback(() => {
26491
26513
  if (!selection2.selectedNode || Object.keys(panelValues).length === 0) {
@@ -26574,12 +26596,52 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26574
26596
  children: children2
26575
26597
  });
26576
26598
  }
26599
+ const noop2 = (..._2) => {
26600
+ };
26601
+ const noopFalse = (..._2) => false;
26602
+ const readOnlyDefault = {
26603
+ selectedNodeId: null,
26604
+ selectedNodeIds: /* @__PURE__ */ new Set(),
26605
+ isEditMode: false,
26606
+ panelValues: {},
26607
+ selectedNode: null,
26608
+ selectedNodes: [],
26609
+ nodes: [],
26610
+ selectNode: noop2,
26611
+ setSelection: noop2,
26612
+ toggleNodeSelection: noop2,
26613
+ addToSelection: noop2,
26614
+ clearSelection: noop2,
26615
+ selectAllNodes: noop2,
26616
+ isNodeSelected: noopFalse,
26617
+ setEditMode: noop2,
26618
+ updatePanelValue: noop2,
26619
+ resetPanelValues: noop2,
26620
+ updateNode: noop2,
26621
+ deleteNode: noop2,
26622
+ applyPanelChanges: noop2,
26623
+ addArgumentToNode: noop2,
26624
+ removeArgumentFromNode: noop2,
26625
+ getChildNodes: (() => []),
26626
+ createNode: noop2,
26627
+ hasNodes: () => false,
26628
+ insertNodeOnEdge: noop2,
26629
+ undo: noop2,
26630
+ redo: noop2,
26631
+ canUndo: false,
26632
+ canRedo: false,
26633
+ copyNode: noop2,
26634
+ pasteNode: noop2,
26635
+ canPaste: false,
26636
+ wrapNodeInOperator: noop2,
26637
+ duplicateNode: noop2,
26638
+ selectChildren: noop2,
26639
+ focusPropertyPanel: noop2,
26640
+ propertyPanelFocusRef: React.createRef()
26641
+ };
26577
26642
  function useEditorContext() {
26578
26643
  const context = React.useContext(EditorContext);
26579
- if (!context) {
26580
- throw new Error("useEditorContext must be used within an EditorProvider");
26581
- }
26582
- return context;
26644
+ return context ?? readOnlyDefault;
26583
26645
  }
26584
26646
  function useDebugClassName(nodeId) {
26585
26647
  const debugState = useNodeDebugState(nodeId);
@@ -26588,7 +26650,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26588
26650
  debugState.isCurrent && "debug-current",
26589
26651
  debugState.isExecuted && "debug-executed",
26590
26652
  debugState.isPending && "debug-pending",
26591
- debugState.isOnPath && !debugState.isCurrent && "debug-on-path"
26653
+ debugState.isOnPath && !debugState.isCurrent && "debug-on-path",
26654
+ debugState.isError && "debug-error"
26592
26655
  ].filter(Boolean).join(" ");
26593
26656
  }
26594
26657
  function useNodeCollapse(nodeId) {
@@ -26613,6 +26676,11 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26613
26676
  setNodes
26614
26677
  ]);
26615
26678
  }
26679
+ function extractErrorMessage(err, fallback) {
26680
+ if (err instanceof Error) return err.message;
26681
+ if (typeof err === "string") return err;
26682
+ return fallback;
26683
+ }
26616
26684
  function useWasmEvaluator(options = {}) {
26617
26685
  const { preserveStructure = false } = options;
26618
26686
  const [ready, setReady] = React.useState(false);
@@ -26625,7 +26693,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26625
26693
  try {
26626
26694
  setLoading(true);
26627
26695
  setError(null);
26628
- const wasm2 = await Promise.resolve().then(() => require("./datalogic_wasm-CrfXtaOs-Bn3jizlo.cjs"));
26696
+ const wasm2 = await Promise.resolve().then(() => require("./datalogic_wasm-RwP1VzMM-CRoSygcJ.cjs"));
26629
26697
  await wasm2.default();
26630
26698
  if (!cancelled) {
26631
26699
  moduleRef.current = {
@@ -26658,7 +26726,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26658
26726
  const resultStr = moduleRef.current.evaluate(logicStr, dataStr, preserveStructure);
26659
26727
  return JSON.parse(resultStr);
26660
26728
  } catch (err) {
26661
- throw new Error(err instanceof Error ? err.message : "Evaluation failed");
26729
+ throw new Error(extractErrorMessage(err, "Evaluation failed"));
26662
26730
  }
26663
26731
  }, [
26664
26732
  preserveStructure
@@ -26676,7 +26744,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26676
26744
  const resultStr = moduleRef.current.evaluate_with_trace(logicStr, dataStr, preserveStructure);
26677
26745
  return JSON.parse(resultStr);
26678
26746
  } catch (err) {
26679
- throw new Error(err instanceof Error ? err.message : "Trace evaluation failed");
26747
+ throw new Error(extractErrorMessage(err, "Trace evaluation failed"));
26680
26748
  }
26681
26749
  }, [
26682
26750
  preserveStructure
@@ -26693,7 +26761,6 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26693
26761
  const { focusPropertyPanel, nodes: editorNodes } = useEditorContext();
26694
26762
  const [contextMenu, setContextMenu] = React.useState(null);
26695
26763
  const handleNodeContextMenu = React.useCallback((event, node) => {
26696
- if (!isEditMode) return;
26697
26764
  event.preventDefault();
26698
26765
  setContextMenu({
26699
26766
  type: "node",
@@ -26705,7 +26772,6 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26705
26772
  isEditMode
26706
26773
  ]);
26707
26774
  const handlePaneContextMenu = React.useCallback((event) => {
26708
- if (!isEditMode) return;
26709
26775
  event.preventDefault();
26710
26776
  setContextMenu({
26711
26777
  type: "canvas",
@@ -26716,7 +26782,6 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26716
26782
  isEditMode
26717
26783
  ]);
26718
26784
  const handleNodeDoubleClick = React.useCallback((_event, node) => {
26719
- if (!isEditMode) return;
26720
26785
  let fieldId;
26721
26786
  switch (node.data.type) {
26722
26787
  case "literal":
@@ -26774,6 +26839,33 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26774
26839
  contextMenuNode
26775
26840
  };
26776
26841
  }
26842
+ function useSystemTheme() {
26843
+ const [systemTheme, setSystemTheme] = React.useState(() => {
26844
+ if (typeof window === "undefined") return "light";
26845
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
26846
+ });
26847
+ React.useEffect(() => {
26848
+ if (typeof window === "undefined") return;
26849
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
26850
+ const handler = (e) => {
26851
+ setSystemTheme(e.matches ? "dark" : "light");
26852
+ };
26853
+ mediaQuery.addEventListener("change", handler);
26854
+ return () => mediaQuery.removeEventListener("change", handler);
26855
+ }, []);
26856
+ return systemTheme;
26857
+ }
26858
+ const MOBILE_BREAKPOINT = 1024;
26859
+ function useIsMobile() {
26860
+ const [isMobile, setIsMobile] = React.useState(() => typeof window !== "undefined" ? window.innerWidth <= MOBILE_BREAKPOINT : false);
26861
+ React.useEffect(() => {
26862
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT}px)`);
26863
+ const handler = (e) => setIsMobile(e.matches);
26864
+ mql.addEventListener("change", handler);
26865
+ return () => mql.removeEventListener("change", handler);
26866
+ }, []);
26867
+ return isMobile;
26868
+ }
26777
26869
  const NodeInputHandles = React.memo(function NodeInputHandles2({ nodeId, color: color2 }) {
26778
26870
  const hasTopConnection = useIsHandleConnected(nodeId, "top");
26779
26871
  const hasLeftConnection = useIsHandleConnected(nodeId, "left");
@@ -26987,7 +27079,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26987
27079
  children: [
26988
27080
  jsxRuntime.jsx("span", {
26989
27081
  className: "debug-info-label",
26990
- children: hasError ? "Error:" : "Result:"
27082
+ children: hasError ? "Error:" : "Result:"
26991
27083
  }),
26992
27084
  hasError ? jsxRuntime.jsx("pre", {
26993
27085
  className: "debug-info-value debug-info-error",
@@ -27498,7 +27590,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
27498
27590
  let enabledIndex = -1;
27499
27591
  return jsxRuntime.jsx("div", {
27500
27592
  ref: menuRef,
27501
- className: "context-menu",
27593
+ className: "dl-context-menu",
27502
27594
  style: {
27503
27595
  left: position.x,
27504
27596
  top: position.y
@@ -27508,7 +27600,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
27508
27600
  children: filteredItems.map((item, itemIndex) => {
27509
27601
  if (item.id === "divider") {
27510
27602
  return jsxRuntime.jsx("div", {
27511
- className: "context-menu-divider",
27603
+ className: "dl-context-menu-divider",
27512
27604
  role: "separator"
27513
27605
  }, `divider-${itemIndex}`);
27514
27606
  }
@@ -27518,14 +27610,14 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
27518
27610
  const currentEnabledIndex = enabledIndex;
27519
27611
  const isFocused = !item.disabled && focusedIndex === currentEnabledIndex;
27520
27612
  return jsxRuntime.jsxs("div", {
27521
- className: item.submenu ? "context-menu-submenu" : void 0,
27613
+ className: item.submenu ? "dl-context-menu-submenu" : void 0,
27522
27614
  children: [
27523
27615
  jsxRuntime.jsxs("button", {
27524
27616
  type: "button",
27525
27617
  className: [
27526
- "context-menu-item",
27527
- item.danger && "context-menu-item--danger",
27528
- isFocused && "context-menu-item--focused"
27618
+ "dl-context-menu-item",
27619
+ item.danger && "dl-context-menu-item--danger",
27620
+ isFocused && "dl-context-menu-item--focused"
27529
27621
  ].filter(Boolean).join(" "),
27530
27622
  disabled: item.disabled,
27531
27623
  onClick: () => handleItemClick(item),
@@ -27534,19 +27626,19 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
27534
27626
  tabIndex: -1,
27535
27627
  children: [
27536
27628
  item.icon && jsxRuntime.jsx("span", {
27537
- className: "context-menu-item-icon",
27629
+ className: "dl-context-menu-item-icon",
27538
27630
  children: item.icon
27539
27631
  }),
27540
27632
  jsxRuntime.jsx("span", {
27541
- className: "context-menu-item-label",
27633
+ className: "dl-context-menu-item-label",
27542
27634
  children: item.label
27543
27635
  }),
27544
27636
  item.shortcut && jsxRuntime.jsx("span", {
27545
- className: "context-menu-item-shortcut",
27637
+ className: "dl-context-menu-item-shortcut",
27546
27638
  children: item.shortcut
27547
27639
  }),
27548
27640
  item.submenu && jsxRuntime.jsx("span", {
27549
- className: "context-menu-item-arrow",
27641
+ className: "dl-context-menu-item-arrow",
27550
27642
  children: jsxRuntime.jsx(ChevronRight2, {
27551
27643
  size: 14
27552
27644
  })
@@ -27554,7 +27646,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
27554
27646
  ]
27555
27647
  }),
27556
27648
  item.submenu && openSubmenuId === item.id && jsxRuntime.jsx("div", {
27557
- className: "context-menu-submenu-content",
27649
+ className: "dl-context-menu-submenu-content",
27558
27650
  children: jsxRuntime.jsx(ContextMenuSubmenu, {
27559
27651
  items: item.submenu,
27560
27652
  onClose
@@ -27587,23 +27679,23 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
27587
27679
  }
27588
27680
  }, []);
27589
27681
  return jsxRuntime.jsx("div", {
27590
- className: "context-menu",
27682
+ className: "dl-context-menu",
27591
27683
  role: "menu",
27592
27684
  children: items.map((item, itemIndex) => {
27593
27685
  if (item.id === "divider") {
27594
27686
  return jsxRuntime.jsx("div", {
27595
- className: "context-menu-divider",
27687
+ className: "dl-context-menu-divider",
27596
27688
  role: "separator"
27597
27689
  }, `divider-${itemIndex}`);
27598
27690
  }
27599
27691
  return jsxRuntime.jsxs("div", {
27600
- className: item.submenu ? "context-menu-submenu" : void 0,
27692
+ className: item.submenu ? "dl-context-menu-submenu" : void 0,
27601
27693
  children: [
27602
27694
  jsxRuntime.jsxs("button", {
27603
27695
  type: "button",
27604
27696
  className: [
27605
- "context-menu-item",
27606
- item.danger && "context-menu-item--danger"
27697
+ "dl-context-menu-item",
27698
+ item.danger && "dl-context-menu-item--danger"
27607
27699
  ].filter(Boolean).join(" "),
27608
27700
  disabled: item.disabled,
27609
27701
  onClick: () => handleItemClick(item),
@@ -27612,19 +27704,19 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
27612
27704
  tabIndex: -1,
27613
27705
  children: [
27614
27706
  item.icon && jsxRuntime.jsx("span", {
27615
- className: "context-menu-item-icon",
27707
+ className: "dl-context-menu-item-icon",
27616
27708
  children: item.icon
27617
27709
  }),
27618
27710
  jsxRuntime.jsx("span", {
27619
- className: "context-menu-item-label",
27711
+ className: "dl-context-menu-item-label",
27620
27712
  children: item.label
27621
27713
  }),
27622
27714
  item.shortcut && jsxRuntime.jsx("span", {
27623
- className: "context-menu-item-shortcut",
27715
+ className: "dl-context-menu-item-shortcut",
27624
27716
  children: item.shortcut
27625
27717
  }),
27626
27718
  item.submenu && jsxRuntime.jsx("span", {
27627
- className: "context-menu-item-arrow",
27719
+ className: "dl-context-menu-item-arrow",
27628
27720
  children: jsxRuntime.jsx(ChevronRight2, {
27629
27721
  size: 14
27630
27722
  })
@@ -27632,7 +27724,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
27632
27724
  ]
27633
27725
  }),
27634
27726
  item.submenu && openSubmenuId === item.id && jsxRuntime.jsx("div", {
27635
- className: "context-menu-submenu-content",
27727
+ className: "dl-context-menu-submenu-content",
27636
27728
  children: jsxRuntime.jsx(ContextMenuSubmenu2, {
27637
27729
  items: item.submenu,
27638
27730
  onClose
@@ -28327,7 +28419,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
28327
28419
  const canCollapse = data.cells.length > 1;
28328
28420
  const isCollapsed = canCollapse ? data.collapsed ?? false : false;
28329
28421
  return jsxRuntime.jsxs("div", {
28330
- className: `vertical-cell-node ${selected2 ? "selected" : ""} ${isCollapsed ? "collapsed" : ""} ${debugClassName}`,
28422
+ className: `dl-node vertical-cell-node ${selected2 ? "selected" : ""} ${isCollapsed ? "collapsed" : ""} ${debugClassName}`,
28331
28423
  style: {
28332
28424
  borderColor: color2,
28333
28425
  backgroundColor: `${color2}10`
@@ -28382,7 +28474,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
28382
28474
  canAddArg && jsxRuntime.jsxs("button", {
28383
28475
  ref: addButtonRef,
28384
28476
  type: "button",
28385
- className: "add-arg-button add-arg-button--vertical",
28477
+ className: "dl-add-arg-button dl-add-arg-button--vertical",
28386
28478
  onClick: handleAddArgumentClick,
28387
28479
  title: remainingSlots ? `${addArgumentLabel} (${remainingSlots} more available)` : addArgumentLabel,
28388
28480
  children: [
@@ -28390,7 +28482,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
28390
28482
  size: 12
28391
28483
  }),
28392
28484
  jsxRuntime.jsx("span", {
28393
- className: "add-arg-button-label",
28485
+ className: "dl-add-arg-button-label",
28394
28486
  children: remainingSlots ? `${addArgumentLabel} (${remainingSlots} more)` : addArgumentLabel
28395
28487
  })
28396
28488
  ]
@@ -28412,7 +28504,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
28412
28504
  const typeIcon = LITERAL_TYPE_ICONS[data.valueType];
28413
28505
  const debugClassName = useDebugClassName(id2);
28414
28506
  return jsxRuntime.jsxs("div", {
28415
- className: `literal-node ${selected2 ? "selected" : ""} ${debugClassName}`,
28507
+ className: `dl-node literal-node ${selected2 ? "selected" : ""} ${debugClassName}`,
28416
28508
  style: {
28417
28509
  borderColor: color2,
28418
28510
  backgroundColor: `${color2}20`
@@ -28471,7 +28563,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
28471
28563
  data.formattedJson
28472
28564
  ]);
28473
28565
  return jsxRuntime.jsxs("div", {
28474
- className: `structure-node ${selected2 ? "selected" : ""} ${isCollapsed ? "collapsed" : ""} ${debugClassName}`,
28566
+ className: `dl-node structure-node ${selected2 ? "selected" : ""} ${isCollapsed ? "collapsed" : ""} ${debugClassName}`,
28475
28567
  style: {
28476
28568
  borderColor: STRUCTURE_COLOR,
28477
28569
  backgroundColor: `${STRUCTURE_COLOR}10`
@@ -29060,21 +29152,21 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
29060
29152
  return null;
29061
29153
  }
29062
29154
  return jsxRuntime.jsx("div", {
29063
- className: `debugger-controls--${variant}`,
29155
+ className: `dl-debugger-controls--${variant}`,
29064
29156
  children: jsxRuntime.jsxs("div", {
29065
- className: "debugger-controls-inner",
29157
+ className: "dl-debugger-controls-inner",
29066
29158
  children: [
29067
29159
  jsxRuntime.jsx("div", {
29068
- className: "debugger-icon",
29160
+ className: "dl-debugger-icon",
29069
29161
  children: jsxRuntime.jsx(Bug, {
29070
29162
  size: variant === "inline" ? 15 : 18
29071
29163
  })
29072
29164
  }),
29073
29165
  jsxRuntime.jsxs("div", {
29074
- className: "debugger-buttons",
29166
+ className: "dl-debugger-buttons",
29075
29167
  children: [
29076
29168
  jsxRuntime.jsx("button", {
29077
- className: "debugger-btn",
29169
+ className: "dl-debugger-btn",
29078
29170
  onClick: reset,
29079
29171
  disabled: isAtStart,
29080
29172
  title: "Reset to start (Home)",
@@ -29083,7 +29175,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
29083
29175
  })
29084
29176
  }),
29085
29177
  jsxRuntime.jsx("button", {
29086
- className: "debugger-btn",
29178
+ className: "dl-debugger-btn",
29087
29179
  onClick: stepBackward,
29088
29180
  disabled: isAtStart,
29089
29181
  title: "Step backward (Left Arrow)",
@@ -29092,7 +29184,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
29092
29184
  })
29093
29185
  }),
29094
29186
  jsxRuntime.jsx("button", {
29095
- className: "debugger-btn debugger-btn-primary",
29187
+ className: "dl-debugger-btn dl-debugger-btn-primary",
29096
29188
  onClick: isPlaying ? pause : play,
29097
29189
  title: isPlaying ? "Pause (Space)" : "Play (Space)",
29098
29190
  children: isPlaying ? jsxRuntime.jsx(Pause2, {
@@ -29102,7 +29194,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
29102
29194
  })
29103
29195
  }),
29104
29196
  jsxRuntime.jsx("button", {
29105
- className: "debugger-btn",
29197
+ className: "dl-debugger-btn",
29106
29198
  onClick: stepForward,
29107
29199
  disabled: isAtEnd,
29108
29200
  title: "Step forward (Right Arrow)",
@@ -29111,7 +29203,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
29111
29203
  })
29112
29204
  }),
29113
29205
  jsxRuntime.jsx("button", {
29114
- className: "debugger-btn",
29206
+ className: "dl-debugger-btn",
29115
29207
  onClick: () => goToStep(totalSteps - 1),
29116
29208
  disabled: isAtEnd,
29117
29209
  title: "Jump to end (End)",
@@ -29122,32 +29214,32 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
29122
29214
  ]
29123
29215
  }),
29124
29216
  jsxRuntime.jsxs("div", {
29125
- className: "debugger-step-counter",
29217
+ className: "dl-debugger-step-counter",
29126
29218
  children: [
29127
29219
  jsxRuntime.jsx("span", {
29128
- className: "step-current",
29220
+ className: "dl-step-current",
29129
29221
  children: isAtInitial ? 0 : currentStepIndex + 1
29130
29222
  }),
29131
29223
  jsxRuntime.jsx("span", {
29132
- className: "step-separator",
29224
+ className: "dl-step-separator",
29133
29225
  children: "/"
29134
29226
  }),
29135
29227
  jsxRuntime.jsx("span", {
29136
- className: "step-total",
29228
+ className: "dl-step-total",
29137
29229
  children: totalSteps
29138
29230
  })
29139
29231
  ]
29140
29232
  }),
29141
29233
  jsxRuntime.jsxs("div", {
29142
- className: "debugger-speed",
29234
+ className: "dl-debugger-speed",
29143
29235
  children: [
29144
29236
  jsxRuntime.jsx("label", {
29145
- className: "speed-label",
29237
+ className: "dl-speed-label",
29146
29238
  children: "Speed"
29147
29239
  }),
29148
29240
  jsxRuntime.jsx("input", {
29149
29241
  type: "range",
29150
- className: "speed-slider",
29242
+ className: "dl-speed-slider",
29151
29243
  min: 100,
29152
29244
  max: 2e3,
29153
29245
  step: 100,
@@ -30615,33 +30707,6 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
30615
30707
  ]
30616
30708
  });
30617
30709
  });
30618
- function useSystemTheme() {
30619
- const [systemTheme, setSystemTheme] = React.useState(() => {
30620
- if (typeof window === "undefined") return "light";
30621
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
30622
- });
30623
- React.useEffect(() => {
30624
- if (typeof window === "undefined") return;
30625
- const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
30626
- const handler = (e) => {
30627
- setSystemTheme(e.matches ? "dark" : "light");
30628
- };
30629
- mediaQuery.addEventListener("change", handler);
30630
- return () => mediaQuery.removeEventListener("change", handler);
30631
- }, []);
30632
- return systemTheme;
30633
- }
30634
- const MOBILE_BREAKPOINT = 1024;
30635
- function useIsMobile() {
30636
- const [isMobile, setIsMobile] = React.useState(() => window.innerWidth <= MOBILE_BREAKPOINT);
30637
- React.useEffect(() => {
30638
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT}px)`);
30639
- const handler = (e) => setIsMobile(e.matches);
30640
- mql.addEventListener("change", handler);
30641
- return () => mql.removeEventListener("change", handler);
30642
- }, []);
30643
- return isMobile;
30644
- }
30645
30710
  const literalPanelConfig = {
30646
30711
  sections: [
30647
30712
  {
@@ -31242,7 +31307,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
31242
31307
  children: [
31243
31308
  jsxRuntime.jsx("button", {
31244
31309
  type: "button",
31245
- className: "toolbar-btn",
31310
+ className: "dl-toolbar-btn",
31246
31311
  onClick: undo,
31247
31312
  disabled: !canUndo,
31248
31313
  title: "Undo (Cmd/Ctrl+Z)",
@@ -31252,7 +31317,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
31252
31317
  }),
31253
31318
  jsxRuntime.jsx("button", {
31254
31319
  type: "button",
31255
- className: "toolbar-btn",
31320
+ className: "dl-toolbar-btn",
31256
31321
  onClick: redo,
31257
31322
  disabled: !canRedo,
31258
31323
  title: "Redo (Cmd/Ctrl+Shift+Z)",
@@ -31276,7 +31341,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
31276
31341
  className: "logic-editor-toolbar-spacer"
31277
31342
  }),
31278
31343
  onPreserveStructureChange && jsxRuntime.jsxs("label", {
31279
- className: "preserve-structure-toggle",
31344
+ className: "dl-preserve-structure-toggle",
31280
31345
  children: [
31281
31346
  jsxRuntime.jsx("input", {
31282
31347
  type: "checkbox",
@@ -31292,9 +31357,87 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
31292
31357
  });
31293
31358
  });
31294
31359
  const emptyResults = /* @__PURE__ */ new Map();
31295
- function DataLogicEditorInner({ initialNodes, initialEdges, readOnly, evaluationResults, theme, showDebugger, isEditMode }) {
31360
+ function ReadOnlyEditorInner({ initialNodes, initialEdges, theme, showDebugger }) {
31361
+ const bgColor = theme === "dark" ? "#404040" : "#cccccc";
31362
+ const [nodes, , onNodesChange] = useNodesState(initialNodes);
31363
+ const [, , onEdgesChange] = useEdgesState(initialEdges);
31364
+ const hiddenNodeIds = React.useMemo(() => getHiddenNodeIds(nodes), [
31365
+ nodes
31366
+ ]);
31367
+ const nodeIds = React.useMemo(() => new Set(nodes.map((n) => n.id)), [
31368
+ nodes
31369
+ ]);
31370
+ const visibleNodes = React.useMemo(() => nodes.filter((node) => !hiddenNodeIds.has(node.id)), [
31371
+ nodes,
31372
+ hiddenNodeIds
31373
+ ]);
31374
+ const currentEdges = React.useMemo(() => buildEdgesFromNodes(nodes), [
31375
+ nodes
31376
+ ]);
31377
+ const visibleEdges = React.useMemo(() => currentEdges.filter((edge) => nodeIds.has(edge.source) && nodeIds.has(edge.target) && !hiddenNodeIds.has(edge.source) && !hiddenNodeIds.has(edge.target)), [
31378
+ currentEdges,
31379
+ nodeIds,
31380
+ hiddenNodeIds
31381
+ ]);
31382
+ return jsxRuntime.jsx(EvaluationContext.Provider, {
31383
+ value: emptyResults,
31384
+ children: jsxRuntime.jsxs(ConnectedHandlesProvider, {
31385
+ edges: visibleEdges,
31386
+ children: [
31387
+ jsxRuntime.jsx(ReactFlowProvider, {
31388
+ children: jsxRuntime.jsxs(index$1, {
31389
+ nodes: visibleNodes,
31390
+ edges: visibleEdges,
31391
+ onNodesChange,
31392
+ onEdgesChange,
31393
+ nodeTypes: nodeTypes2,
31394
+ edgeTypes,
31395
+ fitView: true,
31396
+ fitViewOptions: {
31397
+ padding: REACT_FLOW_OPTIONS.fitViewPadding,
31398
+ maxZoom: REACT_FLOW_OPTIONS.maxZoom
31399
+ },
31400
+ minZoom: 0.1,
31401
+ maxZoom: 2,
31402
+ defaultEdgeOptions: {
31403
+ type: "default",
31404
+ animated: false
31405
+ },
31406
+ children: [
31407
+ jsxRuntime.jsx(Background, {
31408
+ color: bgColor,
31409
+ gap: 20,
31410
+ size: 1
31411
+ }),
31412
+ jsxRuntime.jsx(Controls, {
31413
+ showInteractive: false
31414
+ }),
31415
+ showDebugger && jsxRuntime.jsx(DebuggerControls2, {}),
31416
+ jsxRuntime.jsx(AutoFitView, {
31417
+ nodeCount: initialNodes.length
31418
+ })
31419
+ ]
31420
+ })
31421
+ }),
31422
+ visibleNodes.length === 0 && jsxRuntime.jsxs("div", {
31423
+ className: "logic-editor-empty",
31424
+ children: [
31425
+ jsxRuntime.jsx("p", {
31426
+ children: "No expression"
31427
+ }),
31428
+ jsxRuntime.jsx("p", {
31429
+ className: "logic-editor-empty-hint",
31430
+ children: "Enter valid JSONLogic in the input panel to visualize it"
31431
+ })
31432
+ ]
31433
+ })
31434
+ ]
31435
+ })
31436
+ });
31437
+ }
31438
+ function EditableEditorInner({ initialNodes, initialEdges, evaluationResults, theme, showDebugger }) {
31296
31439
  const bgColor = theme === "dark" ? "#404040" : "#cccccc";
31297
- const { contextMenu, handleNodeContextMenu, handlePaneContextMenu, handleNodeDoubleClick, handleCloseContextMenu, handleEditProperties, contextMenuNode } = useContextMenu(isEditMode);
31440
+ const { contextMenu, handleNodeContextMenu, handlePaneContextMenu, handleNodeDoubleClick, handleCloseContextMenu, handleEditProperties, contextMenuNode } = useContextMenu(true);
31298
31441
  const { nodes: editorNodes } = useEditorContext();
31299
31442
  const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
31300
31443
  const [, , onEdgesChange] = useEdgesState(initialEdges);
@@ -31306,7 +31449,6 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
31306
31449
  ]);
31307
31450
  const prevNodeIdsRef = React.useRef(new Set(initialNodes.map((n) => n.id)));
31308
31451
  React.useEffect(() => {
31309
- if (!isEditMode) return;
31310
31452
  const currentIds = new Set(editorNodes.map((n) => n.id));
31311
31453
  const prevIds = prevNodeIdsRef.current;
31312
31454
  const structureChanged = currentIds.size !== prevIds.size || [
@@ -31320,7 +31462,6 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
31320
31462
  }
31321
31463
  }, [
31322
31464
  editorNodes,
31323
- isEditMode,
31324
31465
  setNodes
31325
31466
  ]);
31326
31467
  const hiddenNodeIds = React.useMemo(() => getHiddenNodeIds(nodes), [
@@ -31336,14 +31477,13 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
31336
31477
  const currentEdges = React.useMemo(() => buildEdgesFromNodes(nodes), [
31337
31478
  nodes
31338
31479
  ]);
31339
- const visibleEdges = React.useMemo(() => currentEdges.filter((edge) => nodeIds.has(edge.source) && nodeIds.has(edge.target) && !hiddenNodeIds.has(edge.source) && !hiddenNodeIds.has(edge.target)).map((edge) => isEditMode ? {
31480
+ const visibleEdges = React.useMemo(() => currentEdges.filter((edge) => nodeIds.has(edge.source) && nodeIds.has(edge.target) && !hiddenNodeIds.has(edge.source) && !hiddenNodeIds.has(edge.target)).map((edge) => ({
31340
31481
  ...edge,
31341
31482
  type: "editable"
31342
- } : edge), [
31483
+ })), [
31343
31484
  currentEdges,
31344
31485
  nodeIds,
31345
- hiddenNodeIds,
31346
- isEditMode
31486
+ hiddenNodeIds
31347
31487
  ]);
31348
31488
  return jsxRuntime.jsx(EvaluationContext.Provider, {
31349
31489
  value: evaluationResults,
@@ -31354,8 +31494,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
31354
31494
  children: jsxRuntime.jsxs(index$1, {
31355
31495
  nodes: visibleNodes,
31356
31496
  edges: visibleEdges,
31357
- onNodesChange: readOnly ? void 0 : onNodesChange,
31358
- onEdgesChange: readOnly ? void 0 : onEdgesChange,
31497
+ onNodesChange,
31498
+ onEdgesChange,
31359
31499
  nodeTypes: nodeTypes2,
31360
31500
  edgeTypes,
31361
31501
  fitView: true,
@@ -31379,7 +31519,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
31379
31519
  size: 1
31380
31520
  }),
31381
31521
  jsxRuntime.jsx(Controls, {
31382
- showInteractive: !readOnly
31522
+ showInteractive: true
31383
31523
  }),
31384
31524
  showDebugger && jsxRuntime.jsx(DebuggerControls2, {}),
31385
31525
  jsxRuntime.jsx(NodeSelectionHandler, {}),
@@ -31435,7 +31575,6 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
31435
31575
  });
31436
31576
  const expressionKey = `${editor.nodes.length}-${editor.edges.length}-${((_a = editor.nodes[0]) == null ? void 0 : _a.id) ?? "empty"}`;
31437
31577
  const hasDebugger = evalEnabled && editor.usingTraceMode && editor.steps.length > 0;
31438
- const readOnly = false;
31439
31578
  const handleNodesChange = React.useCallback((nodes) => {
31440
31579
  if (!onChange) return;
31441
31580
  if (onChangeTimerRef.current) {
@@ -31475,25 +31614,71 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
31475
31614
  })
31476
31615
  });
31477
31616
  }
31478
- const editorInner = jsxRuntime.jsx(DataLogicEditorInner, {
31617
+ const editorClassName = [
31618
+ "logic-editor",
31619
+ className
31620
+ ].filter(Boolean).join(" ");
31621
+ if (!isEditMode) {
31622
+ const readOnlyInner = jsxRuntime.jsx(ReadOnlyEditorInner, {
31623
+ initialNodes: editor.nodes,
31624
+ initialEdges: editor.edges,
31625
+ theme: resolvedTheme,
31626
+ showDebugger: false
31627
+ }, expressionKey);
31628
+ return jsxRuntime.jsx("div", {
31629
+ className: editorClassName,
31630
+ "data-theme": resolvedTheme,
31631
+ children: hasDebugger ? jsxRuntime.jsxs(DebuggerProvider2, {
31632
+ steps: editor.steps,
31633
+ traceNodeMap: editor.traceNodeMap,
31634
+ nodes: editor.nodes,
31635
+ children: [
31636
+ jsxRuntime.jsx(EditorToolbar, {
31637
+ isEditMode: false,
31638
+ hasDebugger,
31639
+ preserveStructure,
31640
+ onPreserveStructureChange
31641
+ }),
31642
+ jsxRuntime.jsx("div", {
31643
+ className: "logic-editor-body",
31644
+ children: jsxRuntime.jsx("div", {
31645
+ className: "logic-editor-main",
31646
+ children: readOnlyInner
31647
+ })
31648
+ })
31649
+ ]
31650
+ }) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
31651
+ children: [
31652
+ jsxRuntime.jsx(EditorToolbar, {
31653
+ isEditMode: false,
31654
+ hasDebugger,
31655
+ preserveStructure,
31656
+ onPreserveStructureChange
31657
+ }),
31658
+ jsxRuntime.jsx("div", {
31659
+ className: "logic-editor-body",
31660
+ children: jsxRuntime.jsx("div", {
31661
+ className: "logic-editor-main",
31662
+ children: readOnlyInner
31663
+ })
31664
+ })
31665
+ ]
31666
+ })
31667
+ });
31668
+ }
31669
+ const editableInner = jsxRuntime.jsx(EditableEditorInner, {
31479
31670
  initialNodes: editor.nodes,
31480
31671
  initialEdges: editor.edges,
31481
- readOnly,
31482
31672
  evaluationResults: emptyResults,
31483
31673
  theme: resolvedTheme,
31484
- showDebugger: false,
31485
- isEditMode
31674
+ showDebugger: false
31486
31675
  }, expressionKey);
31487
- const editorClassName = [
31488
- "logic-editor",
31489
- className
31490
- ].filter(Boolean).join(" ");
31491
31676
  return jsxRuntime.jsxs(EditorProvider, {
31492
31677
  nodes: editor.nodes,
31493
31678
  initialEditMode: isEditMode,
31494
31679
  onNodesChange: handleNodesChange,
31495
31680
  children: [
31496
- isEditMode && jsxRuntime.jsx(KeyboardHandler, {}),
31681
+ jsxRuntime.jsx(KeyboardHandler, {}),
31497
31682
  jsxRuntime.jsx("div", {
31498
31683
  className: editorClassName,
31499
31684
  "data-theme": resolvedTheme,
@@ -31513,9 +31698,9 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
31513
31698
  children: [
31514
31699
  jsxRuntime.jsx("div", {
31515
31700
  className: "logic-editor-main",
31516
- children: editorInner
31701
+ children: editableInner
31517
31702
  }),
31518
- isEditMode && jsxRuntime.jsx(PropertiesPanel, {})
31703
+ jsxRuntime.jsx(PropertiesPanel, {})
31519
31704
  ]
31520
31705
  })
31521
31706
  ]
@@ -31532,9 +31717,9 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
31532
31717
  children: [
31533
31718
  jsxRuntime.jsx("div", {
31534
31719
  className: "logic-editor-main",
31535
- children: editorInner
31720
+ children: editableInner
31536
31721
  }),
31537
- isEditMode && jsxRuntime.jsx(PropertiesPanel, {})
31722
+ jsxRuntime.jsx(PropertiesPanel, {})
31538
31723
  ]
31539
31724
  })
31540
31725
  ]
@@ -32288,12 +32473,14 @@ function WorkflowFlowView({
32288
32473
  }
32289
32474
  function DataLogicView({ value, data }) {
32290
32475
  const { resolvedTheme } = useTheme();
32476
+ const [preserveStructure, setPreserveStructure] = React.useState(true);
32291
32477
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-details-content", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-details-logic-editor", "data-theme": resolvedTheme, children: /* @__PURE__ */ jsxRuntime.jsx(
32292
32478
  DataLogicEditor,
32293
32479
  {
32294
32480
  value,
32295
32481
  theme: resolvedTheme,
32296
- preserveStructure: true,
32482
+ preserveStructure,
32483
+ onPreserveStructureChange: setPreserveStructure,
32297
32484
  className: "df-datalogic-viewer",
32298
32485
  data
32299
32486
  }
@@ -32310,6 +32497,7 @@ function TaskContent({ selection: selection2 }) {
32310
32497
  const { task } = selection2;
32311
32498
  const { resolvedTheme } = useTheme();
32312
32499
  const dbgContext = useDebuggerOptional();
32500
+ const [preserveStructure, setPreserveStructure] = React.useState(true);
32313
32501
  const functionName = task.function.name;
32314
32502
  const input = task.function.input;
32315
32503
  let debugData;
@@ -32331,7 +32519,8 @@ function TaskContent({ selection: selection2 }) {
32331
32519
  {
32332
32520
  value: visualData,
32333
32521
  theme: resolvedTheme,
32334
- preserveStructure: true,
32522
+ preserveStructure,
32523
+ onPreserveStructureChange: setPreserveStructure,
32335
32524
  className: "df-datalogic-viewer",
32336
32525
  data: debugData
32337
32526
  }
@@ -32347,7 +32536,8 @@ function TaskContent({ selection: selection2 }) {
32347
32536
  {
32348
32537
  value: andExpression,
32349
32538
  theme: resolvedTheme,
32350
- preserveStructure: true,
32539
+ preserveStructure,
32540
+ onPreserveStructureChange: setPreserveStructure,
32351
32541
  className: "df-datalogic-viewer",
32352
32542
  data: debugData
32353
32543
  }
@@ -32358,7 +32548,8 @@ function TaskContent({ selection: selection2 }) {
32358
32548
  {
32359
32549
  value: task.function.input,
32360
32550
  theme: resolvedTheme,
32361
- preserveStructure: true,
32551
+ preserveStructure,
32552
+ onPreserveStructureChange: setPreserveStructure,
32362
32553
  className: "df-datalogic-viewer"
32363
32554
  }
32364
32555
  ) }) });
@@ -32367,6 +32558,7 @@ function MappingContent({ selection: selection2 }) {
32367
32558
  const { mapping } = selection2;
32368
32559
  const { resolvedTheme } = useTheme();
32369
32560
  const dbgContext = useDebuggerOptional();
32561
+ const [preserveStructure, setPreserveStructure] = React.useState(true);
32370
32562
  const visualData = {
32371
32563
  [mapping.path]: mapping.logic
32372
32564
  };
@@ -32382,7 +32574,8 @@ function MappingContent({ selection: selection2 }) {
32382
32574
  {
32383
32575
  value: visualData,
32384
32576
  theme: resolvedTheme,
32385
- preserveStructure: true,
32577
+ preserveStructure,
32578
+ onPreserveStructureChange: setPreserveStructure,
32386
32579
  className: "df-datalogic-viewer",
32387
32580
  data: debugData
32388
32581
  }
@@ -32392,6 +32585,7 @@ function ValidationRuleContent({ selection: selection2 }) {
32392
32585
  const { rule } = selection2;
32393
32586
  const { resolvedTheme } = useTheme();
32394
32587
  const dbgContext = useDebuggerOptional();
32588
+ const [preserveStructure, setPreserveStructure] = React.useState(true);
32395
32589
  let debugData;
32396
32590
  if ((dbgContext == null ? void 0 : dbgContext.state.isActive) && dbgContext.currentStep) {
32397
32591
  const step = dbgContext.currentStep;
@@ -32404,7 +32598,8 @@ function ValidationRuleContent({ selection: selection2 }) {
32404
32598
  {
32405
32599
  value: rule.logic,
32406
32600
  theme: resolvedTheme,
32407
- preserveStructure: true,
32601
+ preserveStructure,
32602
+ onPreserveStructureChange: setPreserveStructure,
32408
32603
  className: "df-datalogic-viewer",
32409
32604
  data: debugData
32410
32605
  }