@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.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +99 -98
- package/dist/index.d.ts +367 -2
- package/dist/index.js +645 -616
- package/dist/layout-editor.d.ts +4 -0
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/ItemEditForm.js +4066 -3832
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +599 -552
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +76 -73
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +292 -279
- package/dist/shared/components/item-edit/GroupSection.js +698 -574
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +39 -32
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
- package/dist/shared/components/layout-editor/AddPanel.js +134 -117
- package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
- package/dist/shared/components/layout-editor/CollabParts.js +80 -75
- package/dist/shared/components/layout-editor/DesignNode.js +126 -120
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
- package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
- package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
- package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
- package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
- package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
- package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
- package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
- package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
- package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +81 -77
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
- package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
- package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +101 -52
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-ops.js +84 -82
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/stale-chunk.js +60 -0
- package/dist/shared/lib/worker-socket.js +200 -0
- 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
|
|
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
|
|
12
|
+
const F = lt(yt);
|
|
13
13
|
function Gt() {
|
|
14
|
-
return ct(
|
|
14
|
+
return ct(F);
|
|
15
15
|
}
|
|
16
16
|
const A = 3, P = 20;
|
|
17
|
-
function St(
|
|
17
|
+
function St(u, t, e, p) {
|
|
18
18
|
var o;
|
|
19
|
-
if (
|
|
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
|
|
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 (
|
|
24
|
-
return { top: 0, bottom: 0, width: A, [
|
|
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
|
-
[
|
|
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 = (
|
|
33
|
+
const wt = (u, t) => {
|
|
34
34
|
var e, p;
|
|
35
|
-
return ((p = (e = (
|
|
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(
|
|
38
|
-
for (let t =
|
|
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(
|
|
49
|
-
const t =
|
|
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:
|
|
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(
|
|
70
|
-
}, [
|
|
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:
|
|
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:
|
|
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 =
|
|
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((
|
|
102
|
-
),
|
|
101
|
+
() => ht((n) => !!b.current && Y(o.bundle, n) != null)
|
|
102
|
+
), H = B(
|
|
103
103
|
() => ({
|
|
104
104
|
draggableProps: () => ({}),
|
|
105
|
-
isDragging: (
|
|
106
|
-
dropSlot: (
|
|
107
|
-
dropIndicator: (
|
|
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
|
-
(
|
|
118
|
-
var l,
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
121
|
-
if (
|
|
122
|
-
const d =
|
|
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" : ((
|
|
125
|
-
const
|
|
126
|
-
return ((
|
|
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:
|
|
132
|
-
onDragOver: ({ active:
|
|
133
|
-
onDragEnd: ({ active:
|
|
134
|
-
onDragCancel: ({ active:
|
|
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:
|
|
139
|
+
}, J = ({ active: n, activatorEvent: r }) => {
|
|
140
140
|
e == null || e(!0);
|
|
141
|
-
const d = k(
|
|
141
|
+
const d = k(n.data.current);
|
|
142
142
|
if (!d) return;
|
|
143
|
-
const
|
|
144
|
-
o.set({ ...G, activeKey:
|
|
145
|
-
const s = o.nodes.get(
|
|
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,
|
|
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 -
|
|
150
|
-
y: N.y -
|
|
149
|
+
x: N.x - i.x,
|
|
150
|
+
y: N.y - i.y + O
|
|
151
151
|
});
|
|
152
|
-
M({ node: s, host: l, height: Math.min(
|
|
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 = (
|
|
157
|
-
const
|
|
158
|
-
if (!
|
|
159
|
-
E.current.bundle !==
|
|
160
|
-
const
|
|
161
|
-
let
|
|
162
|
-
return
|
|
163
|
-
}, U = ({ active:
|
|
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 (
|
|
166
|
-
o.set({ overKey: String(
|
|
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
|
|
170
|
-
if (!
|
|
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 } =
|
|
175
|
-
o.bundle && j(o.bundle,
|
|
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:
|
|
177
|
+
role: { kind: "group", key: z, parent: null, body: !0 }
|
|
178
178
|
}, l = { side: l.side, axis: "y", body: !1 });
|
|
179
|
-
const
|
|
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:
|
|
181
|
+
overKey: i,
|
|
182
182
|
side: l.side,
|
|
183
|
-
indicator: St(l, s,
|
|
183
|
+
indicator: St(l, s, c, f)
|
|
184
184
|
});
|
|
185
|
-
}, Q = ({ active:
|
|
186
|
-
var
|
|
187
|
-
const
|
|
188
|
-
if (
|
|
189
|
-
const g = Y(o.bundle, k(
|
|
190
|
-
$(), g && ((
|
|
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(
|
|
193
|
+
const s = I(n, r, d), l = o.bundle;
|
|
194
194
|
if ($(), !(s != null && s.ops.length) || !l) return;
|
|
195
|
-
const
|
|
196
|
-
S.current(s.ops, { label:
|
|
197
|
-
}, Z = (
|
|
198
|
-
var d,
|
|
199
|
-
|
|
200
|
-
|
|
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(
|
|
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
|
|
2
|
-
var
|
|
3
|
-
var
|
|
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
|
|
6
|
-
import { isCanvasSlot as
|
|
7
|
-
import { targetKey as
|
|
8
|
-
import { dndRole as
|
|
9
|
-
const
|
|
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
|
-
|
|
13
|
-
|
|
12
|
+
g(this, "bundle", null);
|
|
13
|
+
g(this, "state", q);
|
|
14
14
|
/** Registered element → its pointer activator (dnd-kit's onPointerDown). */
|
|
15
|
-
|
|
15
|
+
g(this, "activators", /* @__PURE__ */ new WeakMap());
|
|
16
16
|
/** Droppable id → registered element (the overlay copies it, the drop line measures it). */
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
|
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 =
|
|
52
|
+
const m = P(null), F = {
|
|
41
53
|
draggableProps: () => ({}),
|
|
42
54
|
isDragging: () => !1,
|
|
43
55
|
dropSlot: () => null
|
|
44
|
-
},
|
|
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
|
|
56
|
-
const n = S(m),
|
|
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,
|
|
61
|
-
|
|
62
|
-
(n == null ? void 0 : n.subscribe) ??
|
|
63
|
-
() => (n == null ? void 0 : n.slice(
|
|
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(
|
|
67
|
-
D.current =
|
|
68
|
-
const { setNodeRef: p, setActivatorNodeRef:
|
|
69
|
-
(
|
|
70
|
-
n == null || n.track(
|
|
71
|
-
|
|
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
|
-
[
|
|
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: ((
|
|
97
|
+
indicator: ((N = e.dropIndicator) == null ? void 0 : N.call(e, t)) ?? null
|
|
86
98
|
};
|
|
87
|
-
const
|
|
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:
|
|
92
|
-
dragging:
|
|
93
|
-
slot:
|
|
94
|
-
indicator:
|
|
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 ?
|
|
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: !
|
|
113
|
+
disabled: !r
|
|
102
114
|
});
|
|
103
|
-
|
|
104
|
-
(t == null ? void 0 : t.subscribe) ??
|
|
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
|
|
111
|
-
t == null || t.track(i, l.current,
|
|
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
|
|
133
|
+
const B = "__add__";
|
|
122
134
|
function T(e, t) {
|
|
123
|
-
return t === "header" ? { kind: "header" } :
|
|
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,
|
|
128
|
-
target:
|
|
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,
|
|
137
|
-
(
|
|
138
|
-
t == null || t.track(c, a.current,
|
|
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
|
-
),
|
|
142
|
-
|
|
143
|
-
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,
|
|
146
|
-
() => p || Date.now() -
|
|
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:
|
|
162
|
+
props: n ? { ref: o, ...s.attributes, ...s.listeners } : {},
|
|
151
163
|
dragging: p,
|
|
152
|
-
clickBlocked:
|
|
164
|
+
clickBlocked: v
|
|
153
165
|
};
|
|
154
166
|
}
|
|
155
167
|
export {
|
|
156
168
|
Y as DndStore,
|
|
157
169
|
m as DndStoreContext,
|
|
158
|
-
|
|
170
|
+
q as IDLE,
|
|
159
171
|
F as NO_DND,
|
|
160
172
|
T as addRole,
|
|
161
173
|
nt as useAddDragSource,
|