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