@archie/devtools 0.0.21 → 0.0.22

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.
@@ -38,7 +38,7 @@ __export(client_exports, {
38
38
  module.exports = __toCommonJS(client_exports);
39
39
 
40
40
  // src/client/dnd/DndProvider.tsx
41
- var import_react19 = require("react");
41
+ var import_react18 = require("react");
42
42
 
43
43
  // node_modules/@dnd-kit/core/dist/core.esm.js
44
44
  var import_react3 = __toESM(require("react"));
@@ -4315,6 +4315,9 @@ function findMetaOwnerElement(el) {
4315
4315
  }
4316
4316
  function resolveHostElementFromFiberChain(el) {
4317
4317
  if (shouldIgnoreAsVirtualRuntime(el)) return null;
4318
+ if (el.hasAttribute("data-dnd-force-allow")) {
4319
+ return el;
4320
+ }
4318
4321
  const directMeta = getDirectEditorMeta(el);
4319
4322
  const ownerMeta = directMeta ?? getEditorMeta(el);
4320
4323
  if (isPassthroughMeta(ownerMeta)) {
@@ -4670,8 +4673,8 @@ function buildEmptyArrangeSessionState() {
4670
4673
  var useDesignModeStore = create((set, get) => ({
4671
4674
  // UI state
4672
4675
  enabled: false,
4673
- hoveredSelector: null,
4674
4676
  selectedSelector: null,
4677
+ inspectorSelectedNodeIds: [],
4675
4678
  historyMode: "local",
4676
4679
  inspectorTheme: DEFAULT_INSPECTOR_THEME,
4677
4680
  canUndo: false,
@@ -4687,16 +4690,23 @@ var useDesignModeStore = create((set, get) => ({
4687
4690
  // UI actions
4688
4691
  toggle: () => set((s) => ({ enabled: !s.enabled, ...buildEmptyArrangeSessionState() })),
4689
4692
  setEnabled: (enabled) => set({ enabled }),
4690
- setHovered: (selector) => set({ hoveredSelector: selector }),
4691
4693
  setSelected: (selector) => set({ selectedSelector: selector }),
4694
+ setInspectorSelection: (nodeIds) => {
4695
+ const next = nodeIds.filter((id) => typeof id === "string" && id.length > 0);
4696
+ const prev = get().inspectorSelectedNodeIds;
4697
+ if (prev.length === next.length && prev.every((id, i) => id === next[i])) {
4698
+ return;
4699
+ }
4700
+ set({ inspectorSelectedNodeIds: next });
4701
+ },
4692
4702
  setHistoryMode: (historyMode) => set({ historyMode }),
4693
4703
  setInspectorTheme: (theme) => set((s) => ({ inspectorTheme: mergeInspectorTheme({ ...s.inspectorTheme, ...theme }) })),
4694
4704
  setHistoryAvailability: (canUndo, canRedo) => set({ canUndo, canRedo }),
4695
4705
  requestUndo: () => set((s) => ({ undoRequestId: s.undoRequestId + 1 })),
4696
4706
  requestRedo: () => set((s) => ({ redoRequestId: s.redoRequestId + 1 })),
4697
4707
  resetAll: () => set({
4698
- hoveredSelector: null,
4699
4708
  selectedSelector: null,
4709
+ inspectorSelectedNodeIds: [],
4700
4710
  canUndo: false,
4701
4711
  canRedo: false
4702
4712
  }),
@@ -4814,9 +4824,13 @@ var useDesignModeStore = create((set, get) => ({
4814
4824
  inspectorRef,
4815
4825
  displayName,
4816
4826
  html,
4827
+ tsxCode,
4828
+ tsxImports,
4817
4829
  containerId,
4818
4830
  containerNodeKey,
4819
- index
4831
+ index,
4832
+ beforeSiblingInspectorRef,
4833
+ beforeSiblingNodeKey
4820
4834
  }) => {
4821
4835
  const now = Date.now();
4822
4836
  const normalizedOperationId = operationId ?? buildFallbackOperationId(now, nodeId);
@@ -4828,9 +4842,13 @@ var useDesignModeStore = create((set, get) => ({
4828
4842
  inspectorRef,
4829
4843
  displayName,
4830
4844
  html,
4845
+ tsxCode: tsxCode ?? null,
4846
+ tsxImports: tsxImports ?? null,
4831
4847
  containerId,
4832
4848
  containerNodeKey,
4833
4849
  index,
4850
+ beforeSiblingInspectorRef: beforeSiblingInspectorRef ?? null,
4851
+ beforeSiblingNodeKey: beforeSiblingNodeKey ?? null,
4834
4852
  at: now
4835
4853
  };
4836
4854
  set((s) => {
@@ -4908,7 +4926,7 @@ var useDesignModeStore = create((set, get) => ({
4908
4926
  }));
4909
4927
 
4910
4928
  // src/client/dnd/design-mode/DesignModeOverlay.tsx
4911
- var import_react17 = require("react");
4929
+ var import_react16 = require("react");
4912
4930
 
4913
4931
  // src/client/dnd/design-mode/useElementScanner.ts
4914
4932
  var import_react6 = require("react");
@@ -5437,14 +5455,14 @@ function handlePosition(dir) {
5437
5455
  };
5438
5456
  return positions[dir];
5439
5457
  }
5440
- function getOutlineStyle(rect, isSelected, isHovered, inspectorTheme) {
5458
+ function getOutlineStyle(rect, isSelected, inspectorTheme) {
5441
5459
  return {
5442
5460
  ...OUTLINE_BASE_STYLE,
5443
5461
  left: rect.left,
5444
5462
  top: rect.top,
5445
5463
  width: rect.width,
5446
5464
  height: rect.height,
5447
- border: isSelected ? `2px solid ${inspectorTheme.accent}` : isHovered ? `2px dashed ${inspectorTheme.hover}` : `1px dashed ${inspectorTheme.shared}`,
5465
+ border: isSelected ? `2px solid ${inspectorTheme.accent}` : `1px dashed ${inspectorTheme.shared}`,
5448
5466
  backgroundColor: isSelected ? inspectorTheme.accentSoft : "transparent"
5449
5467
  };
5450
5468
  }
@@ -5474,11 +5492,13 @@ function ElementHighlight({
5474
5492
  elements,
5475
5493
  draggingNodeId,
5476
5494
  activeEl,
5495
+ arrangeSelectedNodeId,
5496
+ externalDragActive,
5477
5497
  onResizeHandlePointerDown
5478
5498
  }) {
5479
- const hoveredSelector = useDesignModeStore((s) => s.hoveredSelector);
5480
- const selectedSelector = useDesignModeStore((s) => s.selectedSelector);
5481
5499
  const inspectorTheme = useDesignModeStore((s) => s.inspectorTheme);
5500
+ const internalDragInProgress = draggingNodeId !== null;
5501
+ const overlayVisible = arrangeSelectedNodeId !== null || internalDragInProgress;
5482
5502
  const containerRef = (0, import_react7.useRef)(null);
5483
5503
  const rafRef = (0, import_react7.useRef)(0);
5484
5504
  const syncPositions = (0, import_react7.useCallback)(() => {
@@ -5502,7 +5522,6 @@ function ElementHighlight({
5502
5522
  }
5503
5523
  }, [elements]);
5504
5524
  (0, import_react7.useEffect)(() => {
5505
- if (draggingNodeId) return;
5506
5525
  let running = true;
5507
5526
  const loop = () => {
5508
5527
  if (!running) return;
@@ -5514,8 +5533,9 @@ function ElementHighlight({
5514
5533
  running = false;
5515
5534
  cancelAnimationFrame(rafRef.current);
5516
5535
  };
5517
- }, [syncPositions, draggingNodeId]);
5518
- if (draggingNodeId) return null;
5536
+ }, [syncPositions]);
5537
+ if (!overlayVisible) return null;
5538
+ if (externalDragActive) return null;
5519
5539
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
5520
5540
  "div",
5521
5541
  {
@@ -5525,10 +5545,10 @@ function ElementHighlight({
5525
5545
  children: elements.map((el) => {
5526
5546
  if (el.nodeId === draggingNodeId) return null;
5527
5547
  if (activeEl && activeEl !== el.element && activeEl.contains(el.element)) return null;
5528
- const isHovered = el.nodeId === hoveredSelector;
5529
- const isSelected = el.nodeId === selectedSelector;
5548
+ const isSelected = el.nodeId === arrangeSelectedNodeId;
5549
+ if (!isSelected && !internalDragInProgress) return null;
5530
5550
  const rect = el.element.getBoundingClientRect();
5531
- const showLabel = isHovered || isSelected;
5551
+ const showLabel = isSelected;
5532
5552
  const labelTop = isSelected ? Math.max(0, rect.top - 20) : rect.top;
5533
5553
  const labelLeft = isSelected ? rect.left + 12 : rect.left;
5534
5554
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
@@ -5537,7 +5557,7 @@ function ElementHighlight({
5537
5557
  {
5538
5558
  "data-outline-for": el.nodeId,
5539
5559
  "data-design-mode-ui": true,
5540
- style: getOutlineStyle(rect, isSelected, isHovered, inspectorTheme),
5560
+ style: getOutlineStyle(rect, isSelected, inspectorTheme),
5541
5561
  children: isSelected && HANDLES.map((dir) => {
5542
5562
  const pos = handlePosition(dir);
5543
5563
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
@@ -5832,6 +5852,57 @@ function buildRectSlotRect(children, nodeMap, cRect, i, n, rows) {
5832
5852
  };
5833
5853
  }
5834
5854
 
5855
+ // src/client/dnd/design-mode/inserted-descendants.ts
5856
+ var NON_DRAGGABLE_DESCENDANT_TAGS = /* @__PURE__ */ new Set([
5857
+ // SVG internals — the whole <svg> is the unit; its parts must stay together.
5858
+ "svg",
5859
+ "path",
5860
+ "circle",
5861
+ "rect",
5862
+ "line",
5863
+ "polyline",
5864
+ "polygon",
5865
+ "g",
5866
+ "defs",
5867
+ "use",
5868
+ // <select>/<option>: options live inside their <select>, never standalone.
5869
+ "option",
5870
+ "optgroup",
5871
+ // Table internals: only meaningful in their <table> tree.
5872
+ "caption",
5873
+ "thead",
5874
+ "tbody",
5875
+ "tfoot",
5876
+ "tr",
5877
+ "th",
5878
+ "td",
5879
+ "col",
5880
+ "colgroup",
5881
+ // Self-closing inline atoms with no draggable surface.
5882
+ "br",
5883
+ "wbr",
5884
+ "hr",
5885
+ // Non-rendered metadata.
5886
+ "script",
5887
+ "style",
5888
+ "meta",
5889
+ "link",
5890
+ "title",
5891
+ "noscript",
5892
+ // Replaced media controls handled by their parent player.
5893
+ "source",
5894
+ "track"
5895
+ ]);
5896
+ function markInsertedDescendants(root) {
5897
+ const descendants = root.querySelectorAll("*");
5898
+ for (const node of descendants) {
5899
+ const tag = node.tagName.toLowerCase();
5900
+ if (NON_DRAGGABLE_DESCENDANT_TAGS.has(tag)) continue;
5901
+ node.setAttribute("data-dnd-force-allow", "");
5902
+ node.setAttribute("data-dnd-moved", "");
5903
+ }
5904
+ }
5905
+
5835
5906
  // src/client/dnd/design-mode/history.ts
5836
5907
  function applyInsertCommand(command, direction, resolveNodeElement) {
5837
5908
  if (direction === "undo") {
@@ -5854,6 +5925,7 @@ function applyInsertCommand(command, direction, resolveNodeElement) {
5854
5925
  (c) => c instanceof HTMLElement
5855
5926
  );
5856
5927
  container.insertBefore(newEl, kids[command.index] ?? null);
5928
+ markInsertedDescendants(newEl);
5857
5929
  return true;
5858
5930
  }
5859
5931
  var DEFAULT_LIMIT = 300;
@@ -6379,6 +6451,8 @@ function serializeArrangeChange(event, index) {
6379
6451
  containerId: event.kind === "insert" ? event.containerId : void 0,
6380
6452
  containerNodeKey: event.kind === "insert" ? event.containerNodeKey : void 0,
6381
6453
  insertIndex: event.kind === "insert" ? event.index : void 0,
6454
+ beforeSiblingInspectorRef: event.kind === "insert" ? event.beforeSiblingInspectorRef : void 0,
6455
+ beforeSiblingNodeKey: event.kind === "insert" ? event.beforeSiblingNodeKey : void 0,
6382
6456
  summary: summarizeEditorChangeEvent(event),
6383
6457
  at: event.at
6384
6458
  };
@@ -6676,50 +6750,8 @@ function useOverlayRefs(undoRequestId, redoRequestId) {
6676
6750
  }), []);
6677
6751
  }
6678
6752
 
6679
- // src/client/dnd/design-mode/useHoverDetection.ts
6680
- var import_react12 = require("react");
6681
- function useHoverDetection({
6682
- enabled,
6683
- activeDrag,
6684
- elementsRef,
6685
- setHovered
6686
- }) {
6687
- (0, import_react12.useEffect)(() => {
6688
- if (!enabled) {
6689
- setHovered(null);
6690
- return;
6691
- }
6692
- let lastNodeId = null;
6693
- const fn = (e) => {
6694
- if (activeDrag) return;
6695
- let best = null;
6696
- let bestArea = Infinity;
6697
- for (const sc of elementsRef.current) {
6698
- const r = sc.rect;
6699
- if (e.clientX >= r.left && e.clientX <= r.right && e.clientY >= r.top && e.clientY <= r.bottom) {
6700
- const a = r.width * r.height;
6701
- if (a < bestArea) {
6702
- bestArea = a;
6703
- best = sc;
6704
- }
6705
- }
6706
- }
6707
- const nodeId = best?.nodeId ?? null;
6708
- if (nodeId !== lastNodeId) {
6709
- lastNodeId = nodeId;
6710
- setHovered(nodeId);
6711
- }
6712
- };
6713
- document.addEventListener("mousemove", fn);
6714
- return () => {
6715
- document.removeEventListener("mousemove", fn);
6716
- setHovered(null);
6717
- };
6718
- }, [enabled, setHovered, activeDrag]);
6719
- }
6720
-
6721
6753
  // src/client/dnd/design-mode/useDragVisualLoop.ts
6722
- var import_react13 = require("react");
6754
+ var import_react12 = require("react");
6723
6755
 
6724
6756
  // src/client/dnd/design-mode/quadtree.ts
6725
6757
  function overlaps(a, b) {
@@ -7608,7 +7640,7 @@ function useDragVisualLoop({
7608
7640
  setInsideRect,
7609
7641
  setDropLine
7610
7642
  }) {
7611
- (0, import_react13.useEffect)(() => {
7643
+ (0, import_react12.useEffect)(() => {
7612
7644
  const engine = refs.engineRef.current;
7613
7645
  const snapshot = refs.snapshotRef.current;
7614
7646
  if (!activeDrag || !engine || !snapshot) return;
@@ -7838,7 +7870,7 @@ function useDragVisualLoop({
7838
7870
  }
7839
7871
 
7840
7872
  // src/client/dnd/design-mode/useDragLifecycle.ts
7841
- var import_react14 = require("react");
7873
+ var import_react13 = require("react");
7842
7874
  function buildRuntimeIdentityLocal(nodeId, resolveNodeElement, effectiveLaneSnapshot) {
7843
7875
  if (!nodeId) return null;
7844
7876
  const element = resolveNodeElement(nodeId);
@@ -8023,8 +8055,8 @@ function useDragLifecycle({
8023
8055
  setInsideRect,
8024
8056
  setDropLine
8025
8057
  }) {
8026
- const [activeDrag, setActiveDrag] = (0, import_react14.useState)(null);
8027
- const clearDragState = (0, import_react14.useCallback)(() => {
8058
+ const [activeDrag, setActiveDrag] = (0, import_react13.useState)(null);
8059
+ const clearDragState = (0, import_react13.useCallback)(() => {
8028
8060
  refs.animatorRef.current.clear();
8029
8061
  const activeEl = refs.activeElRef.current;
8030
8062
  refs.activeElRef.current = null;
@@ -8051,7 +8083,7 @@ function useDragLifecycle({
8051
8083
  setActiveDrag(null);
8052
8084
  resume();
8053
8085
  }, [clearCommitLaneCache, resume]);
8054
- const classifyCommandType = (0, import_react14.useCallback)((from, to, isNest) => {
8086
+ const classifyCommandType = (0, import_react13.useCallback)((from, to, isNest) => {
8055
8087
  if (isNest) return "nest";
8056
8088
  if (from.parentNodeId === to.parentNodeId) return "reorder";
8057
8089
  if (from.parentNodeId) {
@@ -8061,7 +8093,7 @@ function useDragLifecycle({
8061
8093
  }
8062
8094
  return "moveCrossContainer";
8063
8095
  }, [resolveNodeElement]);
8064
- const handleDragStart = (0, import_react14.useCallback)(({ active }) => {
8096
+ const handleDragStart = (0, import_react13.useCallback)(({ active }) => {
8065
8097
  if (refs.resizeSessionRef.current || Date.now() < refs.resizeDragBlockUntilRef.current) return;
8066
8098
  const activeId = active.id;
8067
8099
  const found = refs.draggableNodeMapRef.current.get(activeId) ?? refs.nodeMapRef.current.get(activeId);
@@ -8117,7 +8149,7 @@ function useDragLifecycle({
8117
8149
  element: anchorScanned.element
8118
8150
  });
8119
8151
  }, [clearCommitLaneCache, getCommitLaneSnapshot, getCurrentCommitPlacement, pause, selectElement]);
8120
- const handleDragEnd = (0, import_react14.useCallback)(({ active }) => {
8152
+ const handleDragEnd = (0, import_react13.useCallback)(({ active }) => {
8121
8153
  const activeEl = refs.activeElRef.current;
8122
8154
  const fallbackActiveId = active.id;
8123
8155
  const dragSession = refs.dragSessionAnchorRef.current;
@@ -8223,14 +8255,14 @@ function useDragLifecycle({
8223
8255
  clearDragState();
8224
8256
  syncHistoryAvailability();
8225
8257
  }, [applyCommand, classifyCommandType, clearDragState, getCurrentCommitPlacement, recordMoveChange, resolveNodeElement, selectElement, syncHistoryAvailability]);
8226
- const handleDragCancel = (0, import_react14.useCallback)(() => {
8258
+ const handleDragCancel = (0, import_react13.useCallback)(() => {
8227
8259
  clearDragState();
8228
8260
  }, [clearDragState]);
8229
8261
  return { activeDrag, handleDragStart, handleDragEnd, handleDragCancel };
8230
8262
  }
8231
8263
 
8232
8264
  // src/client/dnd/design-mode/useResizeSession.ts
8233
- var import_react15 = require("react");
8265
+ var import_react14 = require("react");
8234
8266
  var RESIZE_POINTER_TOLERANCE_PX = 2;
8235
8267
  var RESIZE_DRAG_BLOCK_MS = 180;
8236
8268
  var RESIZE_MIN = 24;
@@ -8241,7 +8273,7 @@ function useResizeSession({
8241
8273
  recordResizeChange,
8242
8274
  syncHistoryAvailability
8243
8275
  }) {
8244
- const handleResizeHandlePointerDown = (0, import_react15.useCallback)((e, nodeId, dir) => {
8276
+ const handleResizeHandlePointerDown = (0, import_react14.useCallback)((e, nodeId, dir) => {
8245
8277
  if (refs.resizeSessionRef.current) return;
8246
8278
  const selectedEl = refs.nodeMapRef.current.get(nodeId)?.element ?? document.querySelector(`[data-dnd-node-id="${nodeId}"]`);
8247
8279
  if (!selectedEl) return;
@@ -8287,7 +8319,7 @@ function useResizeSession({
8287
8319
  };
8288
8320
  pointerTarget?.setPointerCapture?.(e.pointerId);
8289
8321
  }, []);
8290
- const handleResizePointerMove = (0, import_react15.useCallback)((e) => {
8322
+ const handleResizePointerMove = (0, import_react14.useCallback)((e) => {
8291
8323
  const session = refs.resizeSessionRef.current;
8292
8324
  if (!session || e.pointerId !== session.pointerId) return;
8293
8325
  const dx = e.clientX - session.startX;
@@ -8333,7 +8365,7 @@ function useResizeSession({
8333
8365
  element.style.width = `${Math.round(Math.min(newW, window.innerWidth))}px`;
8334
8366
  element.style.height = `${Math.round(Math.min(newH, window.innerHeight))}px`;
8335
8367
  }, []);
8336
- const handleResizePointerUp = (0, import_react15.useCallback)((e) => {
8368
+ const handleResizePointerUp = (0, import_react14.useCallback)((e) => {
8337
8369
  const session = refs.resizeSessionRef.current;
8338
8370
  if (!session || e.pointerId !== session.pointerId) return;
8339
8371
  refs.resizeSessionRef.current = null;
@@ -8402,7 +8434,7 @@ function useResizeSession({
8402
8434
  });
8403
8435
  syncHistoryAvailability();
8404
8436
  }, [applyCommand, recordResizeChange, syncHistoryAvailability]);
8405
- (0, import_react15.useEffect)(() => {
8437
+ (0, import_react14.useEffect)(() => {
8406
8438
  if (!enabled) return;
8407
8439
  const handleResizePointerCancel = (e) => {
8408
8440
  const session = refs.resizeSessionRef.current;
@@ -8427,8 +8459,13 @@ function useResizeSession({
8427
8459
  }
8428
8460
 
8429
8461
  // src/client/dnd/design-mode/useExternalDragLoop.ts
8430
- var import_react16 = require("react");
8462
+ var import_react15 = require("react");
8431
8463
  var EXTERNAL_DRAG_ACTIVE_ID = "__external-drag-placeholder__";
8464
+ var insertNodeIdCounter = 0;
8465
+ function nextInsertNodeId() {
8466
+ insertNodeIdCounter += 1;
8467
+ return `insert:${Date.now()}:${insertNodeIdCounter}`;
8468
+ }
8432
8469
  function useExternalDragLoop({
8433
8470
  externalDrag,
8434
8471
  refs,
@@ -8436,9 +8473,9 @@ function useExternalDragLoop({
8436
8473
  resolveNodeElement,
8437
8474
  setDropLine
8438
8475
  }) {
8439
- const engineRef = (0, import_react16.useRef)(null);
8440
- const lastIntentRef = (0, import_react16.useRef)(null);
8441
- (0, import_react16.useEffect)(() => {
8476
+ const engineRef = (0, import_react15.useRef)(null);
8477
+ const lastIntentRef = (0, import_react15.useRef)(null);
8478
+ (0, import_react15.useEffect)(() => {
8442
8479
  if (!externalDrag) {
8443
8480
  engineRef.current = null;
8444
8481
  lastIntentRef.current = null;
@@ -8528,7 +8565,7 @@ function commitExternalDrop(x, y, engine, component, refs, resolveNodeElement, s
8528
8565
  setDropLine(null);
8529
8566
  return;
8530
8567
  }
8531
- const nodeId = `insert:${Date.now()}`;
8568
+ const nodeId = nextInsertNodeId();
8532
8569
  newElement.setAttribute(DND_NODE_ID_ATTR, nodeId);
8533
8570
  newElement.setAttribute("data-dnd-force-allow", "");
8534
8571
  newElement.setAttribute("data-dnd-moved", "");
@@ -8537,6 +8574,23 @@ function commitExternalDrop(x, y, engine, component, refs, resolveNodeElement, s
8537
8574
  );
8538
8575
  const beforeChild = children[intent.index] ?? null;
8539
8576
  containerEl.insertBefore(newElement, beforeChild);
8577
+ markInsertedDescendants(newElement);
8578
+ const postInsertChildren = Array.from(containerEl.children).filter(
8579
+ (child) => child instanceof HTMLElement
8580
+ );
8581
+ let beforeSiblingEl = null;
8582
+ let beforeSiblingNodeId = null;
8583
+ const startIdx = postInsertChildren.indexOf(newElement) + 1;
8584
+ for (let i = startIdx; i < postInsertChildren.length; i += 1) {
8585
+ const candidate = postInsertChildren[i];
8586
+ const candidateNodeId = candidate.getAttribute(DND_NODE_ID_ATTR);
8587
+ if (!candidateNodeId) continue;
8588
+ const isEarlierInsert = candidateNodeId.startsWith("insert:");
8589
+ if (!isEarlierInsert && !getInspectorRefFromElement(candidate)) continue;
8590
+ beforeSiblingEl = candidate;
8591
+ beforeSiblingNodeId = candidateNodeId;
8592
+ break;
8593
+ }
8540
8594
  const insertCommand = {
8541
8595
  type: "insert",
8542
8596
  nodeId,
@@ -8562,6 +8616,15 @@ function commitExternalDrop(x, y, engine, component, refs, resolveNodeElement, s
8562
8616
  inspectorRef: getInspectorRefFromElement(containerEl)
8563
8617
  };
8564
8618
  }
8619
+ let beforeSiblingIdentity = null;
8620
+ if (beforeSiblingEl && beforeSiblingNodeId) {
8621
+ beforeSiblingIdentity = {
8622
+ nodeId: beforeSiblingNodeId,
8623
+ nodeKey: getNodeKeyFromElement(beforeSiblingEl),
8624
+ selector: buildNodeSelector(beforeSiblingNodeId),
8625
+ inspectorRef: getInspectorRefFromElement(beforeSiblingEl)
8626
+ };
8627
+ }
8565
8628
  const operationId = `${insertCommand.at}:${nodeId}`;
8566
8629
  useDesignModeStore.getState().recordInsertChange({
8567
8630
  operationId,
@@ -8570,9 +8633,13 @@ function commitExternalDrop(x, y, engine, component, refs, resolveNodeElement, s
8570
8633
  inspectorRef,
8571
8634
  displayName: component.displayName,
8572
8635
  html: component.html,
8636
+ tsxCode: component.tsxCode ?? null,
8637
+ tsxImports: component.tsxImports ?? null,
8573
8638
  containerId: intent.containerId,
8574
8639
  containerNodeKey,
8575
- index: intent.index
8640
+ index: intent.index,
8641
+ beforeSiblingInspectorRef: beforeSiblingIdentity?.inspectorRef ?? null,
8642
+ beforeSiblingNodeKey: beforeSiblingIdentity?.nodeKey ?? null
8576
8643
  });
8577
8644
  dispatchRuntimeEvent({
8578
8645
  type: "element-inserted",
@@ -8581,8 +8648,11 @@ function commitExternalDrop(x, y, engine, component, refs, resolveNodeElement, s
8581
8648
  nodeKey,
8582
8649
  displayName: component.displayName,
8583
8650
  html: component.html,
8651
+ tsxCode: component.tsxCode ?? null,
8652
+ tsxImports: component.tsxImports ?? null,
8584
8653
  container: containerIdentity,
8585
- index: intent.index
8654
+ index: intent.index,
8655
+ beforeSibling: beforeSiblingIdentity
8586
8656
  });
8587
8657
  }
8588
8658
  setDropLine(null);
@@ -8633,12 +8703,16 @@ function HitArea({
8633
8703
  selectedNodeId,
8634
8704
  onResizeHandlePointerDown
8635
8705
  }) {
8636
- const { setNodeRef, listeners, attributes, isDragging } = useDraggable({ id: scanned.nodeId });
8637
- (0, import_react17.useEffect)(() => {
8706
+ const isSelected = scanned.nodeId === selectedNodeId;
8707
+ const { setNodeRef, listeners, attributes, isDragging } = useDraggable({
8708
+ id: scanned.nodeId,
8709
+ disabled: !isSelected
8710
+ });
8711
+ (0, import_react16.useEffect)(() => {
8638
8712
  setNodeRef(scanned.element);
8639
8713
  return () => setNodeRef(null);
8640
8714
  }, [setNodeRef, scanned.element]);
8641
- (0, import_react17.useLayoutEffect)(() => {
8715
+ (0, import_react16.useLayoutEffect)(() => {
8642
8716
  const el = scanned.element;
8643
8717
  if (isDragging) {
8644
8718
  el.style.opacity = "0";
@@ -8646,16 +8720,26 @@ function HitArea({
8646
8720
  el.style.removeProperty("opacity");
8647
8721
  }
8648
8722
  }, [isDragging, scanned.element]);
8649
- (0, import_react17.useEffect)(() => () => {
8723
+ (0, import_react16.useEffect)(() => () => {
8650
8724
  scanned.element.style.removeProperty("opacity");
8651
8725
  scanned.element.style.removeProperty("transform");
8652
8726
  scanned.element.style.removeProperty("transition");
8653
8727
  scanned.element.style.removeProperty("will-change");
8654
8728
  }, [scanned.element]);
8655
- const divRef = (0, import_react17.useRef)(null);
8656
- const [hoverResizeHandle, setHoverResizeHandle] = (0, import_react17.useState)(null);
8657
- const isSelected = scanned.nodeId === selectedNodeId;
8658
- (0, import_react17.useEffect)(() => {
8729
+ const divRef = (0, import_react16.useRef)(null);
8730
+ const [hoverResizeHandle, setHoverResizeHandle] = (0, import_react16.useState)(null);
8731
+ const justDraggedRef = (0, import_react16.useRef)(false);
8732
+ (0, import_react16.useEffect)(() => {
8733
+ if (isDragging) {
8734
+ justDraggedRef.current = true;
8735
+ return;
8736
+ }
8737
+ const id = window.setTimeout(() => {
8738
+ justDraggedRef.current = false;
8739
+ }, 0);
8740
+ return () => window.clearTimeout(id);
8741
+ }, [isDragging]);
8742
+ (0, import_react16.useEffect)(() => {
8659
8743
  const div = divRef.current;
8660
8744
  if (!div) return;
8661
8745
  const onWheel = (e) => {
@@ -8671,7 +8755,7 @@ function HitArea({
8671
8755
  return () => div.removeEventListener("wheel", onWheel);
8672
8756
  }, []);
8673
8757
  const { left, top, width, height } = scanned.rect;
8674
- const cursor = isDragging ? "grabbing" : isSelected && hoverResizeHandle ? resizeCursorFromHandle(hoverResizeHandle) : "grab";
8758
+ const cursor = isDragging ? "grabbing" : !isSelected ? "default" : hoverResizeHandle ? resizeCursorFromHandle(hoverResizeHandle) : "grab";
8675
8759
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
8676
8760
  "div",
8677
8761
  {
@@ -8702,6 +8786,35 @@ function HitArea({
8702
8786
  ...attributes,
8703
8787
  ...listeners,
8704
8788
  onClick: (e) => {
8789
+ if (justDraggedRef.current) {
8790
+ e.preventDefault();
8791
+ e.stopPropagation();
8792
+ return;
8793
+ }
8794
+ const stack = document.elementsFromPoint(e.clientX, e.clientY);
8795
+ for (const candidate of stack) {
8796
+ if (!(candidate instanceof HTMLElement)) continue;
8797
+ if (candidate.hasAttribute("data-design-mode-ui")) continue;
8798
+ if (candidate === scanned.element) break;
8799
+ const candidateNodeId = candidate.getAttribute("data-dnd-node-id");
8800
+ if (candidateNodeId && candidateNodeId !== scanned.nodeId) {
8801
+ e.preventDefault();
8802
+ e.stopPropagation();
8803
+ candidate.dispatchEvent(
8804
+ new MouseEvent("mousedown", {
8805
+ bubbles: true,
8806
+ cancelable: true,
8807
+ clientX: e.clientX,
8808
+ clientY: e.clientY,
8809
+ metaKey: e.metaKey,
8810
+ ctrlKey: e.ctrlKey,
8811
+ shiftKey: e.shiftKey,
8812
+ altKey: e.altKey
8813
+ })
8814
+ );
8815
+ return;
8816
+ }
8817
+ }
8705
8818
  e.preventDefault();
8706
8819
  e.stopPropagation();
8707
8820
  onActivate(scanned.nodeId);
@@ -8712,9 +8825,11 @@ function HitArea({
8712
8825
  function DesignModeOverlay() {
8713
8826
  const enabled = useDesignModeStore((s) => s.enabled);
8714
8827
  const historyMode = useDesignModeStore((s) => s.historyMode);
8715
- const setHovered = useDesignModeStore((s) => s.setHovered);
8716
8828
  const selectElement = useDesignModeStore((s) => s.setSelected);
8717
- const selectedSelector = useDesignModeStore((s) => s.selectedSelector);
8829
+ const inspectorSelectedNodeIds = useDesignModeStore(
8830
+ (s) => s.inspectorSelectedNodeIds
8831
+ );
8832
+ const arrangeSelectedNodeId = inspectorSelectedNodeIds.length === 1 ? inspectorSelectedNodeIds[0] : null;
8718
8833
  const setHistoryAvailability = useDesignModeStore((s) => s.setHistoryAvailability);
8719
8834
  const undoRequestId = useDesignModeStore((s) => s.undoRequestId);
8720
8835
  const redoRequestId = useDesignModeStore((s) => s.redoRequestId);
@@ -8728,28 +8843,35 @@ function DesignModeOverlay() {
8728
8843
  const exportChangesForAI = useDesignModeStore((s) => s.exportChangesForAI);
8729
8844
  const externalDrag = useDesignModeStore((s) => s.externalDrag);
8730
8845
  const { elements, pause, resume } = useElementScanner(enabled);
8731
- const nodeMap = (0, import_react17.useMemo)(() => {
8846
+ const nodeMap = (0, import_react16.useMemo)(() => {
8732
8847
  const m = /* @__PURE__ */ new Map();
8733
8848
  for (const el of elements) m.set(el.nodeId, el);
8734
8849
  return m;
8735
8850
  }, [elements]);
8736
- const draggableElements = (0, import_react17.useMemo)(() => {
8851
+ const draggableElements = (0, import_react16.useMemo)(() => {
8737
8852
  if (elements.length === 0) return [];
8738
8853
  const projection = buildProjection(elements);
8739
8854
  return collectDraggableAnchors(elements, projection, nodeMap).filter(
8740
8855
  (el) => el.draggable !== false
8741
8856
  );
8742
8857
  }, [elements, nodeMap]);
8858
+ const arrangeHitAreaElement = (0, import_react16.useMemo)(() => {
8859
+ if (!arrangeSelectedNodeId) return null;
8860
+ if (externalDrag) return null;
8861
+ return draggableElements.find(
8862
+ (candidate) => candidate.nodeId === arrangeSelectedNodeId
8863
+ ) ?? null;
8864
+ }, [arrangeSelectedNodeId, externalDrag, draggableElements]);
8743
8865
  const refs = useOverlayRefs(undoRequestId, redoRequestId);
8744
8866
  refs.elementsRef.current = elements;
8745
8867
  refs.nodeMapRef.current = nodeMap;
8746
- (0, import_react17.useEffect)(() => {
8868
+ (0, import_react16.useEffect)(() => {
8747
8869
  const m = /* @__PURE__ */ new Map();
8748
8870
  for (const el of draggableElements) m.set(el.nodeId, el);
8749
8871
  refs.draggableNodeMapRef.current = m;
8750
8872
  }, [draggableElements]);
8751
- const [grabFeedback, setGrabFeedback] = (0, import_react17.useState)(null);
8752
- (0, import_react17.useEffect)(() => {
8873
+ const [grabFeedback, setGrabFeedback] = (0, import_react16.useState)(null);
8874
+ (0, import_react16.useEffect)(() => {
8753
8875
  if (!enabled) return;
8754
8876
  const onPointerDown = (e) => {
8755
8877
  if (!shouldShowGrabFeedback(
@@ -8763,21 +8885,21 @@ function DesignModeOverlay() {
8763
8885
  document.addEventListener("pointerdown", onPointerDown, true);
8764
8886
  return () => document.removeEventListener("pointerdown", onPointerDown, true);
8765
8887
  }, [enabled]);
8766
- (0, import_react17.useEffect)(() => {
8888
+ (0, import_react16.useEffect)(() => {
8767
8889
  if (!grabFeedback) return;
8768
8890
  const t = setTimeout(() => setGrabFeedback(null), 1400);
8769
8891
  return () => clearTimeout(t);
8770
8892
  }, [grabFeedback]);
8771
- const resolveNodeElement = (0, import_react17.useCallback)((nodeId) => {
8893
+ const resolveNodeElement = (0, import_react16.useCallback)((nodeId) => {
8772
8894
  const known = refs.nodeMapRef.current.get(nodeId)?.element;
8773
8895
  if (known) return known;
8774
8896
  return document.querySelector(buildNodeSelector(nodeId));
8775
8897
  }, []);
8776
- const clearCommitLaneCache = (0, import_react17.useCallback)(() => {
8898
+ const clearCommitLaneCache = (0, import_react16.useCallback)(() => {
8777
8899
  refs.commitLaneCacheRef.current.clear();
8778
8900
  refs.sourceCommitLaneRef.current = null;
8779
8901
  }, []);
8780
- const getCommitLaneSnapshot = (0, import_react17.useCallback)((laneContainerId) => {
8902
+ const getCommitLaneSnapshot = (0, import_react16.useCallback)((laneContainerId) => {
8781
8903
  if (!laneContainerId) return null;
8782
8904
  if (refs.commitLaneCacheRef.current.has(laneContainerId)) {
8783
8905
  return refs.commitLaneCacheRef.current.get(laneContainerId) ?? null;
@@ -8786,11 +8908,11 @@ function DesignModeOverlay() {
8786
8908
  refs.commitLaneCacheRef.current.set(laneContainerId, snapshot);
8787
8909
  return snapshot;
8788
8910
  }, []);
8789
- const getCurrentCommitPlacement = (0, import_react17.useCallback)((anchorNodeId, laneContainerId) => {
8911
+ const getCurrentCommitPlacement = (0, import_react16.useCallback)((anchorNodeId, laneContainerId) => {
8790
8912
  const lane = getCommitLaneSnapshot(laneContainerId);
8791
8913
  return resolveCurrentCommitPlacement(lane, anchorNodeId);
8792
8914
  }, [getCommitLaneSnapshot]);
8793
- const applyCommand = (0, import_react17.useCallback)((command, direction) => {
8915
+ const applyCommand = (0, import_react16.useCallback)((command, direction) => {
8794
8916
  if (command.type === "resize") {
8795
8917
  const resCmd = command;
8796
8918
  const targetId = resCmd.targetNodeId ?? resCmd.nodeId;
@@ -8813,28 +8935,28 @@ function DesignModeOverlay() {
8813
8935
  clearCommitLaneCache();
8814
8936
  return true;
8815
8937
  }, [clearCommitLaneCache, resolveNodeElement]);
8816
- const syncHistoryAvailability = (0, import_react17.useCallback)(() => {
8938
+ const syncHistoryAvailability = (0, import_react16.useCallback)(() => {
8817
8939
  if (historyMode === "host") {
8818
8940
  setHistoryAvailability(false, false);
8819
8941
  return;
8820
8942
  }
8821
8943
  setHistoryAvailability(refs.historyRef.current.canUndo(), refs.historyRef.current.canRedo());
8822
8944
  }, [historyMode, setHistoryAvailability]);
8823
- (0, import_react17.useEffect)(() => {
8945
+ (0, import_react16.useEffect)(() => {
8824
8946
  refs.historyRef.current.clear();
8825
8947
  syncHistoryAvailability();
8826
8948
  }, [enabled, syncHistoryAvailability]);
8827
8949
  const sensors = useSensors(
8828
8950
  useSensor(PointerSensor, { activationConstraint: { distance: 8 } })
8829
8951
  );
8830
- const collisionDetection = (0, import_react17.useCallback)(
8952
+ const collisionDetection = (0, import_react16.useCallback)(
8831
8953
  (args) => createDesignModeCollisionDetection(refs.blockedContainerIdsRef.current)(args),
8832
8954
  []
8833
8955
  // eslint-disable-line react-hooks/exhaustive-deps -- refs are stable
8834
8956
  );
8835
- const [insideRect, setInsideRect] = (0, import_react17.useState)(null);
8836
- const [dropLine, setDropLine] = (0, import_react17.useState)(null);
8837
- (0, import_react17.useEffect)(() => {
8957
+ const [insideRect, setInsideRect] = (0, import_react16.useState)(null);
8958
+ const [dropLine, setDropLine] = (0, import_react16.useState)(null);
8959
+ (0, import_react16.useEffect)(() => {
8838
8960
  if (!enabled) return;
8839
8961
  const fn = (e) => {
8840
8962
  refs.mouseRef.current = { x: e.clientX, y: e.clientY };
@@ -8842,7 +8964,7 @@ function DesignModeOverlay() {
8842
8964
  window.addEventListener("pointermove", fn, { capture: true, passive: true });
8843
8965
  return () => window.removeEventListener("pointermove", fn, { capture: true });
8844
8966
  }, [enabled]);
8845
- (0, import_react17.useEffect)(() => {
8967
+ (0, import_react16.useEffect)(() => {
8846
8968
  if (!enabled) return;
8847
8969
  if (historyMode !== "local") return;
8848
8970
  const onKeyDown = (e) => {
@@ -8871,7 +8993,7 @@ function DesignModeOverlay() {
8871
8993
  setInsideRect,
8872
8994
  setDropLine
8873
8995
  });
8874
- (0, import_react17.useEffect)(() => {
8996
+ (0, import_react16.useEffect)(() => {
8875
8997
  if (!enabled || activeDrag) return;
8876
8998
  if (undoRequestId === refs.processedUndoIdRef.current) return;
8877
8999
  refs.processedUndoIdRef.current = undoRequestId;
@@ -8888,7 +9010,7 @@ function DesignModeOverlay() {
8888
9010
  });
8889
9011
  syncHistoryAvailability();
8890
9012
  }, [undoRequestId, enabled, activeDrag, applyCommand, resume, selectElement, syncHistoryAvailability, undoLastChange]);
8891
- (0, import_react17.useEffect)(() => {
9013
+ (0, import_react16.useEffect)(() => {
8892
9014
  if (!enabled || activeDrag || historyMode !== "local") return;
8893
9015
  if (redoRequestId === refs.processedRedoIdRef.current) return;
8894
9016
  refs.processedRedoIdRef.current = redoRequestId;
@@ -8900,18 +9022,18 @@ function DesignModeOverlay() {
8900
9022
  }
8901
9023
  syncHistoryAvailability();
8902
9024
  }, [redoRequestId, enabled, activeDrag, applyCommand, historyMode, resume, selectElement, syncHistoryAvailability, redoLastChange]);
8903
- (0, import_react17.useEffect)(() => {
9025
+ (0, import_react16.useEffect)(() => {
8904
9026
  syncHistoryAvailability();
8905
9027
  }, [syncHistoryAvailability]);
8906
- (0, import_react17.useEffect)(() => {
9028
+ (0, import_react16.useEffect)(() => {
8907
9029
  dispatchRuntimeEvent({
8908
9030
  type: "design-mode-changed",
8909
9031
  mode: enabled ? "design" : "off"
8910
9032
  });
8911
9033
  }, [enabled]);
8912
- (0, import_react17.useEffect)(() => {
9034
+ (0, import_react16.useEffect)(() => {
8913
9035
  const aiOutput = exportChangesForAI();
8914
- const updatedAt = orderedChanges.length > 0 ? orderedChanges[orderedChanges.length - 1]?.at ?? Date.now() : Date.now();
9036
+ const updatedAt = Date.now();
8915
9037
  dispatchRuntimeEvent({
8916
9038
  type: "arrange-session-changed",
8917
9039
  session: buildArrangeSessionSnapshot({
@@ -8922,12 +9044,11 @@ function DesignModeOverlay() {
8922
9044
  })
8923
9045
  });
8924
9046
  }, [enabled, exportChangesForAI, orderedChanges]);
8925
- (0, import_react17.useEffect)(() => {
9047
+ (0, import_react16.useEffect)(() => {
8926
9048
  if (!enabled) return;
8927
9049
  document.body.classList.add("design-mode-active");
8928
9050
  return () => document.body.classList.remove("design-mode-active");
8929
9051
  }, [enabled]);
8930
- useHoverDetection({ enabled, activeDrag, elementsRef: refs.elementsRef, setHovered });
8931
9052
  useDesignModeAutoScroll({
8932
9053
  active: !!activeDrag,
8933
9054
  mouseRef: refs.mouseRef,
@@ -8966,19 +9087,21 @@ function DesignModeOverlay() {
8966
9087
  elements,
8967
9088
  draggingNodeId: activeDrag?.nodeId ?? null,
8968
9089
  activeEl: refs.activeElRef.current,
9090
+ arrangeSelectedNodeId,
9091
+ externalDragActive: externalDrag !== null,
8969
9092
  onResizeHandlePointerDown: handleResizeHandlePointerDown
8970
9093
  }
8971
9094
  ),
8972
- draggableElements.map((el) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
9095
+ arrangeHitAreaElement && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
8973
9096
  HitArea,
8974
9097
  {
8975
- scanned: el,
9098
+ scanned: arrangeHitAreaElement,
8976
9099
  onActivate: selectElement,
8977
- selectedNodeId: selectedSelector,
9100
+ selectedNodeId: arrangeHitAreaElement.nodeId,
8978
9101
  onResizeHandlePointerDown: handleResizeHandlePointerDown
8979
9102
  },
8980
- el.nodeId
8981
- )),
9103
+ arrangeHitAreaElement.nodeId
9104
+ ),
8982
9105
  grabFeedback ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
8983
9106
  "div",
8984
9107
  {
@@ -9045,8 +9168,8 @@ function DesignModeOverlay() {
9045
9168
  }
9046
9169
 
9047
9170
  // src/client/dnd/design-mode/DesignModeErrorBoundary.tsx
9048
- var import_react18 = __toESM(require("react"));
9049
- var DesignModeErrorBoundary = class extends import_react18.default.Component {
9171
+ var import_react17 = __toESM(require("react"));
9172
+ var DesignModeErrorBoundary = class extends import_react17.default.Component {
9050
9173
  constructor(props) {
9051
9174
  super(props);
9052
9175
  this.state = { hasError: false };
@@ -9087,13 +9210,13 @@ function DndProvider({ children }) {
9087
9210
  const setHistoryMode = useDesignModeStore((s) => s.setHistoryMode);
9088
9211
  const setInspectorTheme = useDesignModeStore((s) => s.setInspectorTheme);
9089
9212
  const requestUndo = useDesignModeStore((s) => s.requestUndo);
9090
- const transitionDesignMode = (0, import_react19.useCallback)((nextEnabled) => {
9213
+ const transitionDesignMode = (0, import_react18.useCallback)((nextEnabled) => {
9091
9214
  const designModeState = useDesignModeStore.getState();
9092
9215
  if (designModeState.enabled === nextEnabled) return;
9093
9216
  designModeState.resetArrangeSession();
9094
9217
  designModeState.setEnabled(nextEnabled);
9095
9218
  }, []);
9096
- (0, import_react19.useEffect)(() => {
9219
+ (0, import_react18.useEffect)(() => {
9097
9220
  const handleKeyDown = (e) => {
9098
9221
  if (e.ctrlKey && e.shiftKey && e.key === "D") {
9099
9222
  e.preventDefault();
@@ -9103,7 +9226,7 @@ function DndProvider({ children }) {
9103
9226
  window.addEventListener("keydown", handleKeyDown);
9104
9227
  return () => window.removeEventListener("keydown", handleKeyDown);
9105
9228
  }, [transitionDesignMode]);
9106
- (0, import_react19.useEffect)(() => {
9229
+ (0, import_react18.useEffect)(() => {
9107
9230
  const handleHostCommand = (event) => {
9108
9231
  const detail = event.detail;
9109
9232
  if (!detail || typeof detail !== "object") return;
@@ -9162,10 +9285,29 @@ function DndProvider({ children }) {
9162
9285
  setInspectorTheme,
9163
9286
  requestUndo
9164
9287
  ]);
9288
+ (0, import_react18.useEffect)(() => {
9289
+ const bridgeWindow = window;
9290
+ const bridge = {
9291
+ setInspectorSelection: (nodeIds) => {
9292
+ useDesignModeStore.getState().setInspectorSelection(nodeIds);
9293
+ }
9294
+ };
9295
+ bridgeWindow.__ARCHIE_DESIGN_MODE__ = bridge;
9296
+ const pending = bridgeWindow.__ARCHIE_DESIGN_MODE_PENDING__;
9297
+ if (Array.isArray(pending)) {
9298
+ bridge.setInspectorSelection(pending);
9299
+ delete bridgeWindow.__ARCHIE_DESIGN_MODE_PENDING__;
9300
+ }
9301
+ return () => {
9302
+ if (bridgeWindow.__ARCHIE_DESIGN_MODE__ === bridge) {
9303
+ delete bridgeWindow.__ARCHIE_DESIGN_MODE__;
9304
+ }
9305
+ };
9306
+ }, []);
9165
9307
  const pointerSensor = useSensor(PointerSensor, { activationConstraint: { distance: 8 } });
9166
9308
  const keyboardSensor = useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates });
9167
9309
  const sensors = useSensors(pointerSensor, keyboardSensor);
9168
- const handleDragStart = (0, import_react19.useCallback)(
9310
+ const handleDragStart = (0, import_react18.useCallback)(
9169
9311
  (event) => {
9170
9312
  const { active } = event;
9171
9313
  const element = document.querySelector(`[data-canvas-node="${active.id}"]`);
@@ -9173,7 +9315,7 @@ function DndProvider({ children }) {
9173
9315
  },
9174
9316
  [setActive]
9175
9317
  );
9176
- const handleDragEnd = (0, import_react19.useCallback)(
9318
+ const handleDragEnd = (0, import_react18.useCallback)(
9177
9319
  (event) => {
9178
9320
  const { active, over } = event;
9179
9321
  const dragEndEvent = {
@@ -9189,7 +9331,7 @@ function DndProvider({ children }) {
9189
9331
  },
9190
9332
  [dragEndHandlers, setActive]
9191
9333
  );
9192
- const handleDesignModeCrash = (0, import_react19.useCallback)(() => {
9334
+ const handleDesignModeCrash = (0, import_react18.useCallback)(() => {
9193
9335
  const designModeState = useDesignModeStore.getState();
9194
9336
  designModeState.resetAll();
9195
9337
  designModeState.resetArrangeSession();
@@ -9233,13 +9375,12 @@ function DndProvider({ children }) {
9233
9375
  }
9234
9376
 
9235
9377
  // src/client/useArchieDevToolsRuntime.ts
9236
- var import_react21 = require("react");
9378
+ var import_react20 = require("react");
9237
9379
 
9238
9380
  // src/client/archieLocalInspectorEnv.ts
9239
- var import_meta = {};
9240
9381
  function readArchieLocalInspectorFlag() {
9241
9382
  try {
9242
- return import_meta.env?.VITE_ARCHIE_LOCAL_INSPECTOR === "true";
9383
+ return false;
9243
9384
  } catch {
9244
9385
  return false;
9245
9386
  }
@@ -9424,13 +9565,13 @@ function setupArchieRouteListener(router) {
9424
9565
  }
9425
9566
 
9426
9567
  // src/client/runtime/domMetaSanitizer.ts
9427
- var import_react20 = __toESM(require("react"));
9568
+ var import_react19 = __toESM(require("react"));
9428
9569
  var _installed = false;
9429
9570
  function installDomMetaSanitizer() {
9430
9571
  if (_installed) return;
9431
9572
  _installed = true;
9432
- const _origCE = import_react20.default.createElement.bind(import_react20.default);
9433
- import_react20.default.createElement = function patchedCreateElement(type, props, ...children) {
9573
+ const _origCE = import_react19.default.createElement.bind(import_react19.default);
9574
+ import_react19.default.createElement = function patchedCreateElement(type, props, ...children) {
9434
9575
  if (typeof type === "string" && props != null && "__editorMeta" in props) {
9435
9576
  const { __editorMeta: _stripped, ...rest } = props;
9436
9577
  return _origCE(type, rest, ...children);
@@ -9458,9 +9599,9 @@ function useArchieDevToolsRuntime({
9458
9599
  inspectorOptions
9459
9600
  }) {
9460
9601
  const stableOptionsKey = JSON.stringify(inspectorOptions ?? null);
9461
- const inspectorOptionsRef = (0, import_react21.useRef)(inspectorOptions);
9602
+ const inspectorOptionsRef = (0, import_react20.useRef)(inspectorOptions);
9462
9603
  inspectorOptionsRef.current = inspectorOptions;
9463
- (0, import_react21.useEffect)(() => {
9604
+ (0, import_react20.useEffect)(() => {
9464
9605
  if (process.env.NODE_ENV !== "development") {
9465
9606
  return;
9466
9607
  }