@nivaro/react 0.2.54 → 0.2.56

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.
Files changed (151) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +367 -2
  4. package/dist/index.js +645 -616
  5. package/dist/layout-editor.d.ts +4 -0
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/ItemEditForm.js +4066 -3832
  10. package/dist/shared/components/JobsTray.js +100 -55
  11. package/dist/shared/components/MyWorkView.js +91 -89
  12. package/dist/shared/components/NotificationBell.js +80 -79
  13. package/dist/shared/components/ProfileView.js +568 -520
  14. package/dist/shared/components/RecordCompare.js +254 -0
  15. package/dist/shared/components/RecordReadView.js +599 -552
  16. package/dist/shared/components/ReportView.js +578 -543
  17. package/dist/shared/components/RowPresence.js +91 -0
  18. package/dist/shared/components/WidgetSlot.js +474 -458
  19. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  20. package/dist/shared/components/ai/AskPanel.js +139 -119
  21. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  22. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  23. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  24. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  25. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  26. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  27. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  28. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  29. package/dist/shared/components/chat/Composer.js +357 -303
  30. package/dist/shared/components/chat/MessageActions.js +92 -0
  31. package/dist/shared/components/chat/MessageFormat.js +290 -264
  32. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  33. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  34. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  35. package/dist/shared/components/chat/RoomParts.js +213 -274
  36. package/dist/shared/components/chat/ScreenClip.js +184 -0
  37. package/dist/shared/components/chat/chat-core.js +402 -483
  38. package/dist/shared/components/chat/chat-drafts.js +59 -0
  39. package/dist/shared/components/chat/chat-emoji.js +348 -0
  40. package/dist/shared/components/chat/chat-local-time.js +41 -0
  41. package/dist/shared/components/chat/chat-outbox.js +303 -0
  42. package/dist/shared/components/chat/chat-window.js +163 -0
  43. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  44. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  45. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  46. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  47. package/dist/shared/components/help-videos/api.js +76 -73
  48. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  49. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  50. package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
  51. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  52. package/dist/shared/components/item-edit/FieldRow.js +292 -279
  53. package/dist/shared/components/item-edit/GroupSection.js +698 -574
  54. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  55. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  56. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  57. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  58. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  59. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  60. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  61. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  62. package/dist/shared/components/item-edit/lock-why.js +39 -32
  63. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  64. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  65. package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
  66. package/dist/shared/components/layout-editor/AddPanel.js +134 -117
  67. package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
  68. package/dist/shared/components/layout-editor/CollabParts.js +80 -75
  69. package/dist/shared/components/layout-editor/DesignNode.js +126 -120
  70. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
  71. package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
  72. package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
  73. package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
  74. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  75. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  76. package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
  77. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
  78. package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
  79. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
  80. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  81. package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
  82. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  83. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  84. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  85. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  86. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  87. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  88. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  89. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
  90. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
  91. package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
  92. package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
  93. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  94. package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
  95. package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
  96. package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
  97. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  98. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  99. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  100. package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
  101. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  102. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  103. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  104. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  105. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  106. package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
  107. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  108. package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
  109. package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
  110. package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
  111. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  112. package/dist/shared/components/layout-editor/structure-ops.js +81 -77
  113. package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
  114. package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
  115. package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
  116. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  117. package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
  118. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  119. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  120. package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
  121. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  122. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  123. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  124. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  125. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  126. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  127. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  128. package/dist/shared/components/support/SupportView.js +75 -73
  129. package/dist/shared/lib/background-runs.js +150 -0
  130. package/dist/shared/lib/delivery-ack.js +9 -0
  131. package/dist/shared/lib/entry-badge-style.js +13 -0
  132. package/dist/shared/lib/entry-config.js +71 -0
  133. package/dist/shared/lib/form-sections.js +64 -0
  134. package/dist/shared/lib/form-structure.js +99 -0
  135. package/dist/shared/lib/form-usage-beacon.js +101 -52
  136. package/dist/shared/lib/jobs-tray.js +25 -23
  137. package/dist/shared/lib/keyset-pager.js +37 -0
  138. package/dist/shared/lib/layout-ops.js +84 -82
  139. package/dist/shared/lib/layout-resolve.js +113 -0
  140. package/dist/shared/lib/placement-behaviour.js +144 -0
  141. package/dist/shared/lib/prefetch.js +149 -0
  142. package/dist/shared/lib/presence-hooks.js +199 -0
  143. package/dist/shared/lib/record-outbox.js +82 -81
  144. package/dist/shared/lib/replay-socket.js +93 -0
  145. package/dist/shared/lib/request-gate.js +51 -50
  146. package/dist/shared/lib/room-gaps.js +96 -0
  147. package/dist/shared/lib/search-log.js +27 -0
  148. package/dist/shared/lib/socket-realtime.js +101 -80
  149. package/dist/shared/lib/stale-chunk.js +60 -0
  150. package/dist/shared/lib/worker-socket.js +200 -0
  151. package/package.json +1 -1
@@ -3,39 +3,39 @@ import { useSensors as tt, useSensor as T, PointerSensor as et, KeyboardSensor a
3
3
  import { getEventCoordinates as it } from "@dnd-kit/utilities";
4
4
  import { useState as _, useRef as K, useMemo as B, useCallback as at, createContext as lt, useLayoutEffect as dt, useContext as ct } from "react";
5
5
  import { createPortal as ut } from "react-dom";
6
- import { UNGROUPED_KEY as F } from "../../../lib/layout-ops.js";
6
+ import { UNGROUPED_KEY as z } from "../../../lib/layout-ops.js";
7
7
  import { targetKey as m } from "../design-context.js";
8
8
  import { typedKeyboardCoordinates as ft, nodeData as k } from "./collision.js";
9
9
  import { DndStore as pt, DndStoreContext as gt, NO_DND as yt, IDLE as G } from "./node.js";
10
10
  import { railAwareCollision as ht, railDropData as q, copyableGroup as Y } from "./rail-drop.js";
11
11
  import { dropLabel as bt, landsOnCanvas as j, placeAfterDrop as mt, orderAfterDrop as Ct } from "./order.js";
12
- const H = lt(yt);
12
+ const F = lt(yt);
13
13
  function Gt() {
14
- return ct(H);
14
+ return ct(F);
15
15
  }
16
16
  const A = 3, P = 20;
17
- function St(c, t, e, p) {
17
+ function St(u, t, e, p) {
18
18
  var o;
19
- if (c.body) {
19
+ if (u.body) {
20
20
  const S = e - 2 * P, b = p && S > 0 ? Math.min(p, S) : void 0, x = b ? { left: P, width: b } : { left: P, right: P };
21
- return c.side === "before" ? { top: (((o = t.headerHeight) == null ? void 0 : o.call(t)) ?? 0) + 4, height: A, ...x } : { bottom: 8, height: A, ...x };
21
+ return u.side === "before" ? { top: (((o = t.headerHeight) == null ? void 0 : o.call(t)) ?? 0) + 4, height: A, ...x } : { bottom: 8, height: A, ...x };
22
22
  }
23
- if (c.axis === "x")
24
- return { top: 0, bottom: 0, width: A, [c.side === "before" ? "left" : "right"]: -4 };
23
+ if (u.axis === "x")
24
+ return { top: 0, bottom: 0, width: A, [u.side === "before" ? "left" : "right"]: -4 };
25
25
  const y = t.role.kind === "item" && p && e ? Math.min(p, e) : void 0;
26
26
  return {
27
- [c.side === "before" ? "top" : "bottom"]: -6,
27
+ [u.side === "before" ? "top" : "bottom"]: -6,
28
28
  height: A,
29
29
  left: 0,
30
30
  ...y ? { width: y } : { right: 0 }
31
31
  };
32
32
  }
33
- const wt = (c, t) => {
33
+ const wt = (u, t) => {
34
34
  var e, p;
35
- return ((p = (e = (c ?? []).find((y) => y.id === t)) == null ? void 0 : e.data) == null ? void 0 : p.hint) ?? null;
35
+ return ((p = (e = (u ?? []).find((y) => y.id === t)) == null ? void 0 : e.data) == null ? void 0 : p.hint) ?? null;
36
36
  };
37
- function Dt(c) {
38
- for (let t = c; t && t !== document.documentElement; ) {
37
+ function Dt(u) {
38
+ for (let t = u; t && t !== document.documentElement; ) {
39
39
  const e = getComputedStyle(t);
40
40
  if (e.transform && e.transform !== "none" || e.perspective && e.perspective !== "none" || e.filter && e.filter !== "none" || /paint|layout|strict|content/.test(e.contain ?? "") || /transform|perspective|filter/.test(e.willChange ?? "")) {
41
41
  const y = t.getBoundingClientRect();
@@ -45,8 +45,8 @@ function Dt(c) {
45
45
  }
46
46
  return { x: 0, y: 0 };
47
47
  }
48
- function kt(c) {
49
- const t = c.cloneNode(!0);
48
+ function kt(u) {
49
+ const t = u.cloneNode(!0);
50
50
  for (const e of [t, ...Array.from(t.querySelectorAll("*"))])
51
51
  for (const p of ["data-design-target", "data-selected", "data-drop-slot", "id"])
52
52
  e.removeAttribute(p);
@@ -61,13 +61,13 @@ function kt(c) {
61
61
  return t.removeAttribute("data-header-folded"), t.setAttribute("inert", ""), Object.assign(t.style, { margin: "0", width: "100%", opacity: "1", outline: "none" }), t;
62
62
  }
63
63
  const R = 320;
64
- function xt({ node: c }) {
64
+ function xt({ node: u }) {
65
65
  const t = K(null);
66
66
  return dt(() => {
67
67
  const e = t.current;
68
68
  if (e)
69
- return e.replaceChildren(kt(c)), () => e.replaceChildren();
70
- }, [c]), /* @__PURE__ */ C(
69
+ return e.replaceChildren(kt(u)), () => e.replaceChildren();
70
+ }, [u]), /* @__PURE__ */ C(
71
71
  "div",
72
72
  {
73
73
  ref: t,
@@ -77,7 +77,7 @@ function xt({ node: c }) {
77
77
  }
78
78
  );
79
79
  }
80
- const L = { kind: "group", key: F }, Et = { droppable: { strategy: ot.Always } }, Ot = {
80
+ const L = { kind: "group", key: z }, Et = { droppable: { strategy: ot.Always } }, Ot = {
81
81
  start: [D.Space],
82
82
  cancel: [D.Esc],
83
83
  end: [D.Space, D.Enter, D.Tab]
@@ -85,26 +85,26 @@ const L = { kind: "group", key: F }, Et = { droppable: { strategy: ot.Always } }
85
85
  draggable: "Press space to pick this up. Use the arrow keys to choose where it goes, then space or enter to drop it, or escape to cancel."
86
86
  };
87
87
  function qt({
88
- bundle: c,
88
+ bundle: u,
89
89
  apply: t,
90
90
  onDragActive: e,
91
91
  onDropOnLayout: p,
92
92
  children: y
93
93
  }) {
94
94
  const [o] = _(() => new pt());
95
- o.bundle = c;
95
+ o.bundle = u;
96
96
  const S = K(t);
97
97
  S.current = t;
98
98
  const b = K(p);
99
99
  b.current = p;
100
100
  const [x] = _(
101
- () => ht((r) => !!b.current && Y(o.bundle, r) != null)
102
- ), z = B(
101
+ () => ht((n) => !!b.current && Y(o.bundle, n) != null)
102
+ ), H = B(
103
103
  () => ({
104
104
  draggableProps: () => ({}),
105
- isDragging: (r) => o.state.activeKey === m(r),
106
- dropSlot: (r) => o.state.overKey === m(r) ? o.state.side : null,
107
- dropIndicator: (r) => o.state.overKey === m(r) ? o.state.indicator : null
105
+ isDragging: (n) => o.state.activeKey === m(n),
106
+ dropSlot: (n) => o.state.overKey === m(n) ? o.state.side : null,
107
+ dropIndicator: (n) => o.state.overKey === m(n) ? o.state.indicator : null
108
108
  }),
109
109
  [o]
110
110
  ), V = tt(
@@ -114,92 +114,93 @@ function qt({
114
114
  keyboardCodes: Ot
115
115
  })
116
116
  ), [w, M] = _(null), h = at(
117
- (r) => {
118
- var l, a, f, u;
119
- const n = k(r == null ? void 0 : r.data.current);
120
- if (!n) return "this";
121
- if (n.add) return n.add.label;
122
- const d = n.target;
117
+ (n) => {
118
+ var l, i, c, f;
119
+ const r = k(n == null ? void 0 : n.data.current);
120
+ if (!r) return "this";
121
+ if (r.add) return r.add.label;
122
+ const d = r.target;
123
123
  if (d.kind === "group")
124
- return d.key === "__ungrouped__" ? "Ungrouped fields" : ((a = (l = o.bundle) == null ? void 0 : l.groups.find((g) => g.key === d.key)) == null ? void 0 : a.label) ?? "section";
125
- const i = o.nodes.get(m(d));
126
- return ((u = (f = i == null ? void 0 : i.querySelector("label, [data-header-label]")) == null ? void 0 : f.textContent) == null ? void 0 : u.trim()) || (d.kind === "slot" ? "panel" : "field");
124
+ return d.key === "__ungrouped__" ? "Ungrouped fields" : ((i = (l = o.bundle) == null ? void 0 : l.groups.find((g) => g.key === d.key)) == null ? void 0 : i.label) ?? "section";
125
+ const a = o.nodes.get(m(d));
126
+ return ((f = (c = a == null ? void 0 : a.querySelector("label, [data-header-label]")) == null ? void 0 : c.textContent) == null ? void 0 : f.trim()) || (d.kind === "slot" ? "panel" : "field");
127
127
  },
128
128
  [o]
129
129
  ), X = B(
130
130
  () => ({
131
- onDragStart: ({ active: r }) => `Picked up ${h(r)}.`,
132
- onDragOver: ({ active: r, over: n }) => n ? `${h(r)} is over ${h(n)}.` : `${h(r)} is not over a place it can go.`,
133
- onDragEnd: ({ active: r, over: n }) => n ? `Dropped ${h(r)} by ${h(n)}.` : `Dropped ${h(r)}.`,
134
- onDragCancel: ({ active: r }) => `Cancelled. ${h(r)} stays where it was.`
131
+ onDragStart: ({ active: n }) => `Picked up ${h(n)}.`,
132
+ onDragOver: ({ active: n, over: r }) => r ? `${h(n)} is over ${h(r)}.` : `${h(n)} is not over a place it can go.`,
133
+ onDragEnd: ({ active: n, over: r }) => r ? `Dropped ${h(n)} by ${h(r)}.` : `Dropped ${h(n)}.`,
134
+ onDragCancel: ({ active: n }) => `Cancelled. ${h(n)} stays where it was.`
135
135
  }),
136
136
  [h]
137
137
  ), $ = () => {
138
138
  o.set(G), M(null), e == null || e(!1);
139
- }, J = ({ active: r, activatorEvent: n }) => {
139
+ }, J = ({ active: n, activatorEvent: r }) => {
140
140
  e == null || e(!0);
141
- const d = k(r.data.current);
141
+ const d = k(n.data.current);
142
142
  if (!d) return;
143
- const i = m(d.target);
144
- o.set({ ...G, activeKey: i });
145
- const s = o.nodes.get(i);
143
+ const a = m(d.target);
144
+ o.set({ ...G, activeKey: a });
145
+ const s = o.nodes.get(a);
146
146
  if (!s || typeof document > "u") return;
147
- const l = s.closest("[role=dialog]") ?? document.body, a = Dt(l), f = s.getBoundingClientRect(), u = it(n), g = u ? u.y - f.top : 0, O = f.height > R && g > R - 32 ? g - R / 2 : 0, v = ({ transform: N }) => ({
147
+ const l = s.closest("[role=dialog]") ?? document.body, i = Dt(l), c = s.getBoundingClientRect(), f = it(r), g = f ? f.y - c.top : 0, O = c.height > R && g > R - 32 ? g - R / 2 : 0, v = ({ transform: N }) => ({
148
148
  ...N,
149
- x: N.x - a.x,
150
- y: N.y - a.y + O
149
+ x: N.x - i.x,
150
+ y: N.y - i.y + O
151
151
  });
152
- M({ node: s, host: l, height: Math.min(f.height, R), shift: v });
152
+ M({ node: s, host: l, height: Math.min(c.height, R), shift: v });
153
153
  }, E = K({
154
154
  bundle: null,
155
155
  map: /* @__PURE__ */ new Map()
156
- }), I = (r, n, d) => {
157
- const i = k(r.data.current), s = k(n == null ? void 0 : n.data.current), l = wt(d, n == null ? void 0 : n.id), a = o.bundle;
158
- if (!i || !s || !l || !a || !n) return null;
159
- E.current.bundle !== a && (E.current = { bundle: a, map: /* @__PURE__ */ new Map() });
160
- const f = `${r.id}|${n.id}|${l.side}`;
161
- let u = E.current.map.get(f);
162
- return u || (u = i.add ? mt(a, i.add.field, s.target, l.side, i.add.patch) : Ct(a, i.target, s.target, l.side), j(a, i.target, s.target) && !o.nodes.has(m(L)) && (u = []), E.current.map.set(f, u)), { a: i, o: s, hint: l, ops: u };
163
- }, U = ({ active: r, over: n, collisions: d }) => {
156
+ }), I = (n, r, d) => {
157
+ const a = k(n.data.current), s = k(r == null ? void 0 : r.data.current), l = wt(d, r == null ? void 0 : r.id), i = o.bundle;
158
+ if (!a || !s || !l || !i || !r) return null;
159
+ E.current.bundle !== i && (E.current = { bundle: i, map: /* @__PURE__ */ new Map() });
160
+ const c = `${n.id}|${r.id}|${l.side}`;
161
+ let f = E.current.map.get(c);
162
+ return f || (f = a.add ? mt(i, a.add.field, s.target, l.side, a.add.patch) : Ct(i, a.target, s.target, l.side), j(i, a.target, s.target) && !o.nodes.has(m(L)) && (f = []), E.current.map.set(c, f)), { a, o: s, hint: l, ops: f };
163
+ }, U = ({ active: n, over: r, collisions: d }) => {
164
164
  var g, O;
165
- if (n && q(n.data.current)) {
166
- o.set({ overKey: String(n.id), side: null, indicator: null });
165
+ if (r && q(r.data.current)) {
166
+ o.set({ overKey: String(r.id), side: null, indicator: null });
167
167
  return;
168
168
  }
169
- const i = I(r, n, d);
170
- if (!i || i.ops.length === 0 || !n) {
169
+ const a = I(n, r, d);
170
+ if (!a || a.ops.length === 0 || !r) {
171
171
  o.set({ overKey: null, side: null, indicator: null });
172
172
  return;
173
173
  }
174
- let { o: s, hint: l } = i, a = String(n.id);
175
- o.bundle && j(o.bundle, i.a.target, s.target) && (a = m(L), s = {
174
+ let { o: s, hint: l } = a, i = String(r.id);
175
+ o.bundle && j(o.bundle, a.a.target, s.target) && (i = m(L), s = {
176
176
  target: L,
177
- role: { kind: "group", key: F, parent: null, body: !0 }
177
+ role: { kind: "group", key: z, parent: null, body: !0 }
178
178
  }, l = { side: l.side, axis: "y", body: !1 });
179
- const f = ((g = o.nodes.get(a)) == null ? void 0 : g.getBoundingClientRect().width) ?? 0, u = ((O = r.rect.current.initial) == null ? void 0 : O.width) ?? null;
179
+ const c = ((g = o.nodes.get(i)) == null ? void 0 : g.getBoundingClientRect().width) ?? 0, f = ((O = n.rect.current.initial) == null ? void 0 : O.width) ?? null;
180
180
  o.set({
181
- overKey: a,
181
+ overKey: i,
182
182
  side: l.side,
183
- indicator: St(l, s, f, u)
183
+ indicator: St(l, s, c, f)
184
184
  });
185
- }, Q = ({ active: r, over: n, collisions: d }) => {
186
- var f, u;
187
- const i = q(n == null ? void 0 : n.data.current);
188
- if (i) {
189
- const g = Y(o.bundle, k(r.data.current));
190
- $(), g && ((f = b.current) == null || f.call(b, g, i.railLayoutId));
185
+ }, Q = ({ active: n, over: r, collisions: d }) => {
186
+ var c, f;
187
+ const a = q(r == null ? void 0 : r.data.current);
188
+ if (a) {
189
+ const g = Y(o.bundle, k(n.data.current));
190
+ $(), g && ((c = b.current) == null || c.call(b, g, a.railLayoutId));
191
191
  return;
192
192
  }
193
- const s = I(r, n, d), l = o.bundle;
193
+ const s = I(n, r, d), l = o.bundle;
194
194
  if ($(), !(s != null && s.ops.length) || !l) return;
195
- const a = s.a.add;
196
- S.current(s.ops, { label: a ? `Add ${a.label}` : bt(l, s.a.target) }), (u = a == null ? void 0 : a.onAdded) == null || u.call(a, s.ops);
197
- }, Z = (r) => {
198
- var d, i, s, l;
199
- const n = (i = (d = r.target) == null ? void 0 : d.closest) == null ? void 0 : i.call(d, "[data-design-target]");
200
- n && ((l = (s = o.activators.get(n)) == null ? void 0 : s()) == null || l(r));
195
+ const i = s.a.add;
196
+ S.current(s.ops, { label: i ? `Add ${i.label}` : bt(l, s.a.target) }), (f = i == null ? void 0 : i.onAdded) == null || f.call(i, s.ops);
197
+ }, Z = (n) => {
198
+ var d, a, s, l, i, c;
199
+ if ((a = (d = n.target) == null ? void 0 : d.closest) != null && a.call(d, "[data-design-resize]")) return;
200
+ const r = (l = (s = n.target) == null ? void 0 : s.closest) == null ? void 0 : l.call(s, "[data-design-target]");
201
+ r && ((c = (i = o.activators.get(r)) == null ? void 0 : i()) == null || c(n));
201
202
  };
202
- return /* @__PURE__ */ C(gt.Provider, { value: o, children: /* @__PURE__ */ C(H.Provider, { value: z, children: /* @__PURE__ */ W(
203
+ return /* @__PURE__ */ C(gt.Provider, { value: o, children: /* @__PURE__ */ C(F.Provider, { value: H, children: /* @__PURE__ */ W(
203
204
  rt,
204
205
  {
205
206
  sensors: V,
@@ -1,22 +1,24 @@
1
- var M = Object.defineProperty;
2
- var P = (e, t, i) => t in e ? M(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
3
- var b = (e, t, i) => P(e, typeof t != "symbol" ? t + "" : t, i);
1
+ var J = Object.defineProperty;
2
+ var M = (e, t, i) => t in e ? J(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
3
+ var g = (e, t, i) => M(e, typeof t != "symbol" ? t + "" : t, i);
4
4
  import { useDraggable as _, useDroppable as w } from "@dnd-kit/core";
5
- import { createContext as H, useContext as S, useId as $, useRef as y, useCallback as R, useEffect as L, useSyncExternalStore as E } from "react";
6
- import { isCanvasSlot as q } from "../../../lib/layout-ops.js";
7
- import { targetKey as x } from "../design-context.js";
8
- import { dndRole as B } from "./collision.js";
9
- const z = { activeKey: null, overKey: null, side: null, indicator: null };
5
+ import { createContext as P, useContext as S, useId as $, useRef as y, useCallback as R, useEffect as H, useSyncExternalStore as z } from "react";
6
+ import { isCanvasSlot as L } from "../../../lib/layout-ops.js";
7
+ import { targetKey as E } from "../design-context.js";
8
+ import { dndRole as O } from "./collision.js";
9
+ const q = { activeKey: null, overKey: null, side: null, indicator: null };
10
10
  class Y {
11
11
  constructor() {
12
- b(this, "bundle", null);
13
- b(this, "state", z);
12
+ g(this, "bundle", null);
13
+ g(this, "state", q);
14
14
  /** Registered element → its pointer activator (dnd-kit's onPointerDown). */
15
- b(this, "activators", /* @__PURE__ */ new WeakMap());
15
+ g(this, "activators", /* @__PURE__ */ new WeakMap());
16
16
  /** Droppable id → registered element (the overlay copies it, the drop line measures it). */
17
- b(this, "nodes", /* @__PURE__ */ new Map());
18
- b(this, "subs", /* @__PURE__ */ new Set());
19
- b(this, "subscribe", (t) => (this.subs.add(t), () => {
17
+ g(this, "nodes", /* @__PURE__ */ new Map());
18
+ /** A width is being dragged on the canvas (#2701): the column guides show. */
19
+ g(this, "resizing", !1);
20
+ g(this, "subs", /* @__PURE__ */ new Set());
21
+ g(this, "subscribe", (t) => (this.subs.add(t), () => {
20
22
  this.subs.delete(t);
21
23
  }));
22
24
  }
@@ -24,9 +26,19 @@ class Y {
24
26
  const i = { ...this.state, ...t }, n = this.state;
25
27
  if (!(i.activeKey === n.activeKey && i.overKey === n.overKey && i.side === n.side && JSON.stringify(i.indicator) === JSON.stringify(n.indicator))) {
26
28
  this.state = i;
27
- for (const o of this.subs) o();
29
+ for (const r of this.subs) r();
28
30
  }
29
31
  }
32
+ setResizing(t) {
33
+ if (this.resizing !== t) {
34
+ this.resizing = t;
35
+ for (const i of this.subs) i();
36
+ }
37
+ }
38
+ /** Column guides (#2701): on while something drags or a width is dragged. */
39
+ guidesOn() {
40
+ return this.state.activeKey !== null || this.resizing;
41
+ }
30
42
  /** What one node renders from: a node re-renders only when its slice changes. */
31
43
  slice(t) {
32
44
  const i = this.state, n = i.overKey === t ? `${i.side}${JSON.stringify(i.indicator)}` : "";
@@ -37,11 +49,11 @@ class Y {
37
49
  i && this.nodes.get(t) === i && this.nodes.delete(t), n && this.nodes.set(t, n);
38
50
  }
39
51
  }
40
- const m = H(null), F = {
52
+ const m = P(null), F = {
41
53
  draggableProps: () => ({}),
42
54
  isDragging: () => !1,
43
55
  dropSlot: () => null
44
- }, O = () => () => {
56
+ }, x = () => () => {
45
57
  };
46
58
  function G(e) {
47
59
  if (!e) return 0;
@@ -52,63 +64,63 @@ function G(e) {
52
64
  return t ? t.getBoundingClientRect().bottom - e.getBoundingClientRect().top : 0;
53
65
  }
54
66
  function tt(e, t, i = {}) {
55
- var A, K;
56
- const n = S(m), o = x(t), c = $(), l = y(null), s = n != null && n.bundle ? B(n.bundle, t) : null, a = !!n && !!s && !i.disabled && e !== F, u = a ? o : `${o}#${c}`, d = s ? {
67
+ var N, A;
68
+ const n = S(m), r = E(t), c = $(), l = y(null), s = n != null && n.bundle ? O(n.bundle, t) : null, a = !!n && !!s && !i.disabled && e !== F, u = a ? r : `${r}#${c}`, d = s ? {
57
69
  target: t,
58
70
  role: s,
59
71
  headerHeight: s.kind === "group" ? () => G(l.current) : void 0
60
- } : void 0, r = _({ id: u, data: d, disabled: !a }), v = w({ id: u, data: d, disabled: !a || !!i.noDrop });
61
- E(
62
- (n == null ? void 0 : n.subscribe) ?? O,
63
- () => (n == null ? void 0 : n.slice(o)) ?? "",
72
+ } : void 0, o = _({ id: u, data: d, disabled: !a }), h = w({ id: u, data: d, disabled: !a || !!i.noDrop });
73
+ z(
74
+ (n == null ? void 0 : n.subscribe) ?? x,
75
+ () => (n == null ? void 0 : n.slice(r)) ?? "",
64
76
  () => ""
65
77
  );
66
- const D = y(r.listeners);
67
- D.current = r.listeners;
68
- const { setNodeRef: p, setActivatorNodeRef: k } = r, g = v.setNodeRef, J = R(
69
- (f) => {
70
- n == null || n.track(o, l.current, f), l.current = f, p(f), g(f), k(f), f && n && n.activators.set(
71
- f,
78
+ const D = y(o.listeners);
79
+ D.current = o.listeners;
80
+ const { setNodeRef: p, setActivatorNodeRef: v } = o, f = h.setNodeRef, I = R(
81
+ (b) => {
82
+ n == null || n.track(r, l.current, b), l.current = b, p(b), f(b), v(b), b && n && n.activators.set(
83
+ b,
72
84
  () => {
73
85
  var C;
74
86
  return (C = D.current) == null ? void 0 : C.onPointerDown;
75
87
  }
76
88
  );
77
89
  },
78
- [o, k, p, g, n]
90
+ [r, v, p, f, n]
79
91
  );
80
92
  if (!n)
81
93
  return {
82
94
  props: e.draggableProps(t, i.disabled ? { disabled: !0 } : void 0),
83
95
  dragging: e.isDragging(t),
84
96
  slot: e.dropSlot(t),
85
- indicator: ((A = e.dropIndicator) == null ? void 0 : A.call(e, t)) ?? null
97
+ indicator: ((N = e.dropIndicator) == null ? void 0 : N.call(e, t)) ?? null
86
98
  };
87
- const h = n.state, N = h.overKey === o;
99
+ const k = n.state, K = k.overKey === r;
88
100
  return {
89
101
  // The pointer activator is not spread here: LayoutDndProvider relays
90
102
  // pointerdown to it. The keyboard one stays on the node.
91
- props: a ? { ref: J, ...r.attributes, onKeyDown: (K = r.listeners) == null ? void 0 : K.onKeyDown } : {},
92
- dragging: h.activeKey === o,
93
- slot: N ? h.side : null,
94
- indicator: N ? h.indicator : null
103
+ props: a ? { ref: I, ...o.attributes, onKeyDown: (A = o.listeners) == null ? void 0 : A.onKeyDown } : {},
104
+ dragging: k.activeKey === r,
105
+ slot: K ? k.side : null,
106
+ indicator: K ? k.indicator : null
95
107
  };
96
108
  }
97
109
  function et(e) {
98
- const t = S(m), i = `body:${e}`, n = t != null && t.bundle ? B(t.bundle, { kind: "group", key: e }) : null, o = (n == null ? void 0 : n.kind) === "group" && n.body, c = w({
110
+ const t = S(m), i = `body:${e}`, n = t != null && t.bundle ? O(t.bundle, { kind: "group", key: e }) : null, r = (n == null ? void 0 : n.kind) === "group" && n.body, c = w({
99
111
  id: i,
100
112
  data: { target: { kind: "group", key: e }, role: { kind: "body", key: e } },
101
- disabled: !o
113
+ disabled: !r
102
114
  });
103
- E(
104
- (t == null ? void 0 : t.subscribe) ?? O,
115
+ z(
116
+ (t == null ? void 0 : t.subscribe) ?? x,
105
117
  () => (t == null ? void 0 : t.slice(i)) ?? "",
106
118
  () => ""
107
119
  );
108
120
  const l = y(null), s = c.setNodeRef, a = R(
109
121
  (d) => {
110
- const r = (d == null ? void 0 : d.parentElement) ?? null;
111
- t == null || t.track(i, l.current, r), l.current = r, s(r), r && getComputedStyle(r).position === "static" && (r.style.position = "relative");
122
+ const o = (d == null ? void 0 : d.parentElement) ?? null;
123
+ t == null || t.track(i, l.current, o), l.current = o, s(o), o && getComputedStyle(o).position === "static" && (o.style.position = "relative");
112
124
  },
113
125
  [i, s, t]
114
126
  ), u = (t == null ? void 0 : t.state.overKey) === i;
@@ -118,14 +130,14 @@ function et(e) {
118
130
  indicator: u ? (t == null ? void 0 : t.state.indicator) ?? null : null
119
131
  };
120
132
  }
121
- const I = "__add__";
133
+ const B = "__add__";
122
134
  function T(e, t) {
123
- return t === "header" ? { kind: "header" } : q({ field: e, group_key: null }) ? { kind: "group", key: e, parent: null, body: !1 } : { kind: "item", zone: I };
135
+ return t === "header" ? { kind: "header" } : L({ field: e, group_key: null }) ? { kind: "group", key: e, parent: null, body: !1 } : { kind: "item", zone: B };
124
136
  }
125
137
  const W = 400;
126
138
  function nt(e) {
127
- const t = S(m), i = $(), n = !!t && !!e, o = { kind: "field", field: (e == null ? void 0 : e.field) ?? i, group_key: I }, c = x(o), l = e ? {
128
- target: o,
139
+ const t = S(m), i = $(), n = !!t && !!e, r = { kind: "field", field: (e == null ? void 0 : e.field) ?? i, group_key: B }, c = E(r), l = e ? {
140
+ target: r,
129
141
  role: T(e.field, e.to),
130
142
  add: {
131
143
  field: e.field,
@@ -133,29 +145,29 @@ function nt(e) {
133
145
  patch: e.patch,
134
146
  onAdded: e.onAdded
135
147
  }
136
- } : void 0, s = _({ id: n ? c : `${c}#${i}`, data: l, disabled: !n }), a = y(null), { setNodeRef: u, setActivatorNodeRef: d } = s, r = R(
137
- (g) => {
138
- t == null || t.track(c, a.current, g), a.current = g, u(g), d(g);
148
+ } : void 0, s = _({ id: n ? c : `${c}#${i}`, data: l, disabled: !n }), a = y(null), { setNodeRef: u, setActivatorNodeRef: d } = s, o = R(
149
+ (f) => {
150
+ t == null || t.track(c, a.current, f), a.current = f, u(f), d(f);
139
151
  },
140
152
  [c, d, u, t]
141
- ), v = y(0), D = y(!1);
142
- L(() => {
143
- D.current && !s.isDragging && (v.current = Date.now()), D.current = s.isDragging;
153
+ ), h = y(0), D = y(!1);
154
+ H(() => {
155
+ D.current && !s.isDragging && (h.current = Date.now()), D.current = s.isDragging;
144
156
  }, [s.isDragging]);
145
- const p = s.isDragging, k = R(
146
- () => p || Date.now() - v.current < W,
157
+ const p = s.isDragging, v = R(
158
+ () => p || Date.now() - h.current < W,
147
159
  [p]
148
160
  );
149
161
  return {
150
- props: n ? { ref: r, ...s.attributes, ...s.listeners } : {},
162
+ props: n ? { ref: o, ...s.attributes, ...s.listeners } : {},
151
163
  dragging: p,
152
- clickBlocked: k
164
+ clickBlocked: v
153
165
  };
154
166
  }
155
167
  export {
156
168
  Y as DndStore,
157
169
  m as DndStoreContext,
158
- z as IDLE,
170
+ q as IDLE,
159
171
  F as NO_DND,
160
172
  T as addRole,
161
173
  nt as useAddDragSource,