@nivaro/react 0.3.36 → 0.3.37
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/components/slots/CommentsSlot.js +44 -36
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/shared/components/AgentBadge.js +26 -0
- package/dist/shared/components/AgentQuestionsCard.js +198 -0
- package/dist/shared/components/ItemEditForm.js +3329 -3263
- package/dist/shared/components/McpConnectionScope.js +480 -0
- package/dist/shared/components/MyWorkView.js +223 -208
- package/dist/shared/components/RecordReadView.js +620 -575
- package/dist/shared/components/chat/ChatPanel.js +683 -671
- package/dist/shared/components/imports/DownloadSampleButton.js +69 -0
- package/dist/shared/components/imports/ImportConsole.js +106 -104
- package/dist/shared/components/imports/RunDetailSheet.js +11 -10
- package/dist/shared/components/item-edit/FieldAffordances.js +32 -32
- package/dist/shared/components/item-edit/FormTour.js +279 -0
- package/dist/shared/components/item-edit/GroupSection.js +377 -360
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +28 -28
- package/dist/shared/components/item-edit/entry/EntryStrip.js +30 -26
- package/dist/shared/components/item-edit/form-density.js +36 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -46
- package/dist/shared/components/item-edit/usePersonalDefaults.js +312 -296
- package/dist/shared/components/layout-editor/AddPanel.js +349 -192
- package/dist/shared/components/layout-editor/DesignNode.js +126 -112
- package/dist/shared/components/layout-editor/EditorTopBar.js +123 -103
- package/dist/shared/components/layout-editor/LayoutEditor.js +829 -751
- package/dist/shared/components/layout-editor/PlaceTools.js +334 -0
- package/dist/shared/components/layout-editor/SlashInsert.js +252 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +285 -242
- package/dist/shared/components/layout-editor/add-target.js +54 -43
- package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +238 -155
- package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +1 -1
- package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +15 -12
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +347 -189
- package/dist/shared/components/layout-editor/dnd/TrashZone.js +60 -32
- package/dist/shared/components/layout-editor/dnd/UndoChip.js +76 -0
- package/dist/shared/components/layout-editor/dnd/merge-drop.js +33 -0
- package/dist/shared/components/layout-editor/dnd/multi-drop.js +87 -0
- package/dist/shared/components/layout-editor/dnd/node.js +115 -105
- package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
- package/dist/shared/components/layout-editor/dnd/trash-drop.js +34 -28
- package/dist/shared/components/layout-editor/dnd/trash-links.js +97 -0
- package/dist/shared/components/layout-editor/even-row.js +86 -0
- package/dist/shared/components/layout-editor/field-list.js +99 -0
- package/dist/shared/components/layout-editor/format-painter.js +102 -0
- package/dist/shared/components/layout-editor/grid-guides.js +15 -13
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +150 -132
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +57 -53
- package/dist/shared/components/layout-editor/inspector/EvenRowAction.js +31 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +154 -141
- package/dist/shared/components/layout-editor/inspector/Inspector.js +209 -178
- package/dist/shared/components/layout-editor/inspector/LookTab.js +106 -98
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +38 -37
- package/dist/shared/components/layout-editor/inspector/kit.js +280 -223
- package/dist/shared/components/layout-editor/keyboard-move.js +15 -15
- package/dist/shared/components/layout-editor/lint/LabelStyle.js +201 -0
- package/dist/shared/components/layout-editor/lint/LintPanel.js +132 -84
- package/dist/shared/components/layout-editor/lint/lint-api.js +65 -28
- package/dist/shared/components/layout-editor/nav/NavTools.js +14 -12
- package/dist/shared/components/layout-editor/nav/ZoomControls.js +145 -0
- package/dist/shared/components/layout-editor/nav/useEditorNav.js +34 -32
- package/dist/shared/components/layout-editor/nav/view-prefs.js +100 -15
- package/dist/shared/components/layout-editor/outputs/LayoutFile.js +89 -0
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +272 -195
- package/dist/shared/components/layout-editor/outputs/layout-file-plan.js +176 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +71 -37
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +16 -11
- package/dist/shared/components/layout-editor/overview/purpose.js +5 -5
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/pin.js +37 -19
- package/dist/shared/components/layout-editor/place-clip.js +257 -0
- package/dist/shared/components/layout-editor/preview/PreviewModes.js +27 -26
- package/dist/shared/components/layout-editor/preview/PreviewPanes.js +148 -117
- package/dist/shared/components/layout-editor/preview/SampleRecord.js +113 -0
- package/dist/shared/components/layout-editor/preview/preview-model.js +79 -60
- package/dist/shared/components/layout-editor/preview/sample-record.js +105 -0
- package/dist/shared/components/layout-editor/removed-log.js +151 -0
- package/dist/shared/components/layout-editor/reuse/LibraryRows.js +109 -78
- package/dist/shared/components/layout-editor/reuse/linked-sections.js +373 -0
- package/dist/shared/components/layout-editor/revert-element.js +140 -0
- package/dist/shared/components/layout-editor/section-structure.js +193 -170
- package/dist/shared/components/layout-editor/settings/EntrySection.js +63 -45
- package/dist/shared/components/layout-editor/settings/LayoutSection.js +63 -32
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +179 -137
- package/dist/shared/components/layout-editor/settings/WhoSection.js +18 -17
- package/dist/shared/components/layout-editor/settings/settings-registry.js +24 -0
- package/dist/shared/components/layout-editor/shortcuts.js +21 -16
- package/dist/shared/components/layout-editor/structure-ops.js +221 -195
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +133 -85
- package/dist/shared/components/layout-editor/usage/refusal-lens.js +130 -0
- package/dist/shared/components/layout-editor/usage/usage-api.js +12 -11
- package/dist/shared/components/panels/CommentPanel.js +47 -45
- package/dist/shared/components/panels/RevisionsPanel.js +66 -64
- package/dist/shared/components/panels/TaskPanel.js +395 -332
- package/dist/shared/components/profile/AgentsPanel.js +196 -147
- package/dist/shared/components/profile/ConnectionRollback.js +329 -0
- package/dist/shared/components/profile/MyDefaultsCard.js +526 -520
- package/dist/shared/lib/entry-config.js +22 -22
- package/dist/shared/lib/form-usage-beacon.js +91 -55
- package/dist/shared/lib/layout-lint.js +530 -284
- package/dist/shared/lib/layout-resolve.js +58 -44
- package/package.json +1 -1
|
@@ -1,68 +1,96 @@
|
|
|
1
|
-
import { jsxs as s, jsx as
|
|
2
|
-
import { useDroppable as
|
|
3
|
-
import { Trash2 as
|
|
4
|
-
import { useSyncExternalStore as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { TRASH_DROP_ID as
|
|
7
|
-
const
|
|
1
|
+
import { jsxs as s, jsx as r, Fragment as m } from "react/jsx-runtime";
|
|
2
|
+
import { useDroppable as h } from "@dnd-kit/core";
|
|
3
|
+
import { Trash2 as b, Link2 as x } from "lucide-react";
|
|
4
|
+
import { useSyncExternalStore as p, useCallback as u } from "react";
|
|
5
|
+
import { cn as d } from "../../../lib/utils.js";
|
|
6
|
+
import { TRASH_DROP_ID as i } from "./trash-drop.js";
|
|
7
|
+
const f = `
|
|
8
8
|
@keyframes nvr-trash-in{from{opacity:0;transform:translate(-50%,12px)}to{opacity:1;transform:translate(-50%,0)}}
|
|
9
9
|
[data-layout-trash]{animation:nvr-trash-in 160ms cubic-bezier(0.25,1,0.5,1) both}
|
|
10
10
|
@media (prefers-reduced-motion: reduce){[data-layout-trash]{animation:none}}
|
|
11
|
-
`,
|
|
12
|
-
function
|
|
11
|
+
`, k = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, y = 3;
|
|
12
|
+
function j({
|
|
13
13
|
store: e,
|
|
14
|
-
plan:
|
|
15
|
-
name:
|
|
14
|
+
plan: t,
|
|
15
|
+
name: n,
|
|
16
|
+
warning: o = null
|
|
16
17
|
}) {
|
|
17
|
-
const { setNodeRef:
|
|
18
|
-
id:
|
|
18
|
+
const { setNodeRef: l } = h({
|
|
19
|
+
id: i,
|
|
19
20
|
data: { layoutTrash: !0 }
|
|
20
|
-
}),
|
|
21
|
+
}), a = p(
|
|
21
22
|
e.subscribe,
|
|
22
|
-
|
|
23
|
+
u(() => e.state.overKey === i, [e]),
|
|
23
24
|
() => !1
|
|
24
|
-
),
|
|
25
|
+
), c = t.kind === "section" ? t.holds > 0 ? `With its ${k(t.holds, "field")} · their data is kept` : "It holds no fields" : (t.count ?? 1) > 1 ? "Their data is kept" : "Its data is kept";
|
|
25
26
|
return /* @__PURE__ */ s(
|
|
26
27
|
"div",
|
|
27
28
|
{
|
|
28
|
-
ref:
|
|
29
|
+
ref: l,
|
|
29
30
|
"data-layout-trash": "",
|
|
30
|
-
"data-over":
|
|
31
|
+
"data-over": a ? "" : void 0,
|
|
31
32
|
style: { left: "50%", transform: "translateX(-50%)" },
|
|
32
|
-
className:
|
|
33
|
+
className: d(
|
|
33
34
|
"pointer-events-auto fixed bottom-6 z-[1001] flex min-w-[240px] max-w-[min(420px,calc(100vw-32px))] items-center gap-3 rounded-xl border-2 px-4 py-3 shadow-lg transition-colors duration-150 motion-reduce:transition-none",
|
|
34
|
-
|
|
35
|
+
a ? "border-solid border-red-400 bg-red-50 text-red-800 dark:border-red-500/70 dark:bg-[#3b1219] dark:text-red-100" : "border-dashed border-slate-300 bg-white text-slate-600 dark:border-slate-600 dark:bg-card dark:text-slate-300"
|
|
35
36
|
),
|
|
36
37
|
children: [
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ r("style", { children: f }),
|
|
39
|
+
/* @__PURE__ */ r(
|
|
39
40
|
"span",
|
|
40
41
|
{
|
|
41
42
|
"aria-hidden": !0,
|
|
42
|
-
className:
|
|
43
|
+
className: d(
|
|
43
44
|
"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg transition-colors duration-150 motion-reduce:transition-none",
|
|
44
|
-
|
|
45
|
+
a ? "bg-red-600 text-white" : "bg-slate-100 text-slate-500 dark:bg-slate-800 dark:text-slate-300"
|
|
45
46
|
),
|
|
46
|
-
children: /* @__PURE__ */
|
|
47
|
+
children: /* @__PURE__ */ r(b, { className: "h-4 w-4" })
|
|
47
48
|
}
|
|
48
49
|
),
|
|
49
50
|
/* @__PURE__ */ s("span", { className: "min-w-0", children: [
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ r("span", { className: "block truncate text-[13px] font-semibold", children: a ? `Release to remove ${n}` : "Drop here to remove" }),
|
|
52
|
+
/* @__PURE__ */ r(
|
|
52
53
|
"span",
|
|
53
54
|
{
|
|
54
|
-
className:
|
|
55
|
+
className: d(
|
|
55
56
|
"block truncate text-[11.5px]",
|
|
56
|
-
|
|
57
|
+
a ? "text-red-700 dark:text-red-200/90" : "text-slate-500 dark:text-slate-400"
|
|
57
58
|
),
|
|
58
|
-
children:
|
|
59
|
+
children: a ? c : "From this form only · Undo brings it back"
|
|
59
60
|
}
|
|
60
|
-
)
|
|
61
|
+
),
|
|
62
|
+
o && /* @__PURE__ */ r(N, { warning: o, over: a })
|
|
63
|
+
] })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function N({ warning: e, over: t }) {
|
|
69
|
+
const n = e.effects.slice(0, y), o = e.effects.length - n.length;
|
|
70
|
+
return /* @__PURE__ */ s(
|
|
71
|
+
"span",
|
|
72
|
+
{
|
|
73
|
+
"data-trash-links": e.count,
|
|
74
|
+
className: d(
|
|
75
|
+
"mt-1.5 block border-t pt-1.5 text-[11.5px]",
|
|
76
|
+
t ? "border-red-200 text-red-800 dark:border-red-500/30 dark:text-red-100" : "border-slate-200 text-amber-800 dark:border-slate-700 dark:text-amber-200"
|
|
77
|
+
),
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ s("span", { className: "flex items-center gap-1 font-medium", children: [
|
|
80
|
+
/* @__PURE__ */ r(x, { "aria-hidden": !0, className: "h-3 w-3 shrink-0" }),
|
|
81
|
+
/* @__PURE__ */ r("span", { className: "truncate", children: e.headline })
|
|
82
|
+
] }),
|
|
83
|
+
t && /* @__PURE__ */ s(m, { children: [
|
|
84
|
+
/* @__PURE__ */ s("span", { className: "mt-0.5 block truncate", children: [
|
|
85
|
+
n.join(" · "),
|
|
86
|
+
o > 0 ? ` · +${o} more` : ""
|
|
87
|
+
] }),
|
|
88
|
+
/* @__PURE__ */ r("span", { className: "block truncate text-red-700/90 dark:text-red-200/80", children: "Off the form, nobody can change it here" })
|
|
61
89
|
] })
|
|
62
90
|
]
|
|
63
91
|
}
|
|
64
92
|
);
|
|
65
93
|
}
|
|
66
94
|
export {
|
|
67
|
-
|
|
95
|
+
j as TrashZone
|
|
68
96
|
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsxs as c, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Undo2 as w } from "lucide-react";
|
|
3
|
+
import { useState as y, useRef as v, useEffect as u } from "react";
|
|
4
|
+
const g = 6e3, k = `
|
|
5
|
+
@keyframes nvr-undo-chip-in{from{opacity:0;transform:translate(-50%,calc(-100% + 6px))}to{opacity:1;transform:translate(-50%,-100%)}}
|
|
6
|
+
[data-trash-undo-chip]{animation:nvr-undo-chip-in 140ms cubic-bezier(0.25,1,0.5,1) both}
|
|
7
|
+
@media (prefers-reduced-motion: reduce){[data-trash-undo-chip]{animation:none}}
|
|
8
|
+
`;
|
|
9
|
+
function b(n, r, e = 120) {
|
|
10
|
+
const i = Math.min(Math.max(n.x, 16 + e), Math.max(16 + e, r.width - 16 - e)), d = Math.min(Math.max(n.y - 16, 56), r.height - 16);
|
|
11
|
+
return { left: i, top: d };
|
|
12
|
+
}
|
|
13
|
+
function P({
|
|
14
|
+
label: n,
|
|
15
|
+
point: r,
|
|
16
|
+
origin: e,
|
|
17
|
+
stillUndoable: i,
|
|
18
|
+
onUndo: d,
|
|
19
|
+
onClose: h
|
|
20
|
+
}) {
|
|
21
|
+
const [l, a] = y(!1), t = v(h);
|
|
22
|
+
t.current = h, u(() => {
|
|
23
|
+
i || t.current();
|
|
24
|
+
}, [i]), u(() => {
|
|
25
|
+
if (l) return;
|
|
26
|
+
const o = setTimeout(() => t.current(), g);
|
|
27
|
+
return () => clearTimeout(o);
|
|
28
|
+
}, [l]), u(() => {
|
|
29
|
+
const o = (x) => {
|
|
30
|
+
x.key === "Escape" && t.current();
|
|
31
|
+
};
|
|
32
|
+
return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
|
|
33
|
+
}, []);
|
|
34
|
+
const m = typeof window > "u" ? { width: 1024, height: 768 } : { width: window.innerWidth, height: window.innerHeight }, { left: p, top: f } = b(r, m);
|
|
35
|
+
return /* @__PURE__ */ c(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
role: "status",
|
|
39
|
+
"data-trash-undo-chip": "",
|
|
40
|
+
onPointerEnter: () => a(!0),
|
|
41
|
+
onPointerLeave: () => a(!1),
|
|
42
|
+
onFocus: () => a(!0),
|
|
43
|
+
onBlur: () => a(!1),
|
|
44
|
+
style: { left: p - e.x, top: f - e.y, transform: "translate(-50%, -100%)" },
|
|
45
|
+
className: "pointer-events-auto fixed z-[1001] flex max-w-[240px] items-center gap-1 rounded-lg bg-white py-1 pl-2.5 pr-1 text-[12.5px] text-slate-700 shadow-lg ring-1 ring-slate-900/10 dark:bg-card dark:text-slate-200 dark:ring-white/10",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ s("style", { children: k }),
|
|
48
|
+
/* @__PURE__ */ c("span", { className: "min-w-0 truncate", children: [
|
|
49
|
+
"Removed ",
|
|
50
|
+
/* @__PURE__ */ s("span", { className: "font-medium text-slate-900 dark:text-foreground", children: n })
|
|
51
|
+
] }),
|
|
52
|
+
/* @__PURE__ */ s("span", { "aria-hidden": !0, className: "text-slate-300 dark:text-slate-600", children: "·" }),
|
|
53
|
+
/* @__PURE__ */ c(
|
|
54
|
+
"button",
|
|
55
|
+
{
|
|
56
|
+
type: "button",
|
|
57
|
+
"data-trash-undo": "",
|
|
58
|
+
onClick: () => {
|
|
59
|
+
d(), t.current();
|
|
60
|
+
},
|
|
61
|
+
className: "inline-flex h-7 shrink-0 items-center gap-1 rounded-md px-2 font-medium text-nvr-cyan hover:bg-nvr-cyan/10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-nvr-cyan [@media(pointer:coarse)]:h-9 [@media(pointer:coarse)]:px-3",
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ s(w, { "aria-hidden": !0, className: "h-3.5 w-3.5" }),
|
|
64
|
+
"Undo"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
g as UNDO_CHIP_MS,
|
|
74
|
+
P as UndoChip,
|
|
75
|
+
b as chipPosition
|
|
76
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { nodeData as s } from "./collision.js";
|
|
2
|
+
const h = 12;
|
|
3
|
+
function b(t, i, o, n) {
|
|
4
|
+
return i <= 0 || n.y < t.top || n.y > t.top + i || n.x < t.left || n.x > t.left + t.width ? !1 : o === "x" ? n.x >= t.left + t.width / 4 && n.x <= t.left + t.width * 3 / 4 : n.y >= t.top + Math.min(h, i / 3);
|
|
5
|
+
}
|
|
6
|
+
function x(t, i) {
|
|
7
|
+
return (o) => {
|
|
8
|
+
var f, l;
|
|
9
|
+
const n = t(o), a = n[0], u = o.pointerCoordinates, c = s(o.active.data.current);
|
|
10
|
+
if (!a || !u || !c || c.add || c.role.kind !== "group") return n;
|
|
11
|
+
const e = a.data, r = s((f = e == null ? void 0 : e.droppableContainer) == null ? void 0 : f.data.current);
|
|
12
|
+
if ((r == null ? void 0 : r.role.kind) !== "group" || !e.hint) return n;
|
|
13
|
+
const d = o.droppableRects.get(a.id), g = ((l = r.headerHeight) == null ? void 0 : l.call(r)) ?? 0;
|
|
14
|
+
return !d || !b(d, g, e.hint.axis, u) || !i(c, r) ? n : [{ ...a, data: { ...e, hint: { ...e.hint, merge: !0 } } }, ...n.slice(1)];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function m(t) {
|
|
18
|
+
return {
|
|
19
|
+
top: 0,
|
|
20
|
+
left: 0,
|
|
21
|
+
right: 0,
|
|
22
|
+
height: t > 0 ? t : "100%",
|
|
23
|
+
borderRadius: 8,
|
|
24
|
+
backgroundColor: "rgb(var(--nvr-cyan-rgb, 0 206 255) / 0.1)",
|
|
25
|
+
boxShadow: "inset 0 0 0 2px rgb(var(--nvr-cyan-rgb, 0 206 255))"
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
h as MERGE_EDGE,
|
|
30
|
+
b as inMergeZone,
|
|
31
|
+
x as mergeAwareCollision,
|
|
32
|
+
m as mergeIndicatorStyle
|
|
33
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { applyLayoutOps as g, UNGROUPED_KEY as P, isCanvasSlot as c } from "../../../lib/layout-ops.js";
|
|
2
|
+
import { isMultiSelectable as m, targetKey as k } from "../design-context.js";
|
|
3
|
+
import { plural as O, inPageOrder as w, selectedPlacements as z, normalizedBundle as a } from "../field-zones.js";
|
|
4
|
+
import { placementPatchOf as D } from "../inspector/model.js";
|
|
5
|
+
import { pinLocked as A, unpinnedPatch as C } from "../pin.js";
|
|
6
|
+
import { duplicatePlan as K } from "../structure-ops.js";
|
|
7
|
+
import { dndRole as L, bodyZone as M } from "./collision.js";
|
|
8
|
+
import { landsOnCanvas as b, orderAfterDrop as h, placeAfterDrop as E } from "./order.js";
|
|
9
|
+
function T(t, o, r) {
|
|
10
|
+
if (!t || o.length < 2 || !m(r)) return [r];
|
|
11
|
+
const u = k(r);
|
|
12
|
+
if (!o.some((n) => k(n) === u)) return [r];
|
|
13
|
+
if (!o.every(m)) return [r];
|
|
14
|
+
const d = w(t, z(t, o)), p = [];
|
|
15
|
+
for (const n of d) {
|
|
16
|
+
const e = o.find(
|
|
17
|
+
(f) => f.kind !== "group" && f.kind !== "header" && f.field === n.field && f.group_key === n.group_key
|
|
18
|
+
);
|
|
19
|
+
e && !A(t, e) && p.push(e);
|
|
20
|
+
}
|
|
21
|
+
return p.length > 1 && p.some((n) => k(n) === u) ? p : [r];
|
|
22
|
+
}
|
|
23
|
+
function _(t, o) {
|
|
24
|
+
const r = L(t, o);
|
|
25
|
+
if (r) {
|
|
26
|
+
if (r.kind === "item") return r.zone;
|
|
27
|
+
if (r.kind === "group" && r.body) return M(r.key);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function R(t, o, r, u) {
|
|
31
|
+
const d = a(t);
|
|
32
|
+
if (o.kind === "header") return [];
|
|
33
|
+
if (o.kind === "group") {
|
|
34
|
+
if (o.key === P) return [];
|
|
35
|
+
const e = K(d, o);
|
|
36
|
+
if (!e.ok) return [];
|
|
37
|
+
const f = e.ops[0];
|
|
38
|
+
if ((f == null ? void 0 : f.op) !== "group_create") return [];
|
|
39
|
+
let l;
|
|
40
|
+
try {
|
|
41
|
+
l = g(d, e.ops);
|
|
42
|
+
} catch {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
const i = r.kind === "group" && r.key === o.key ? { kind: "group", key: o.key } : r, s = h(l, { kind: "group", key: f.key }, i, u);
|
|
46
|
+
return [...e.ops, ...s];
|
|
47
|
+
}
|
|
48
|
+
if (c(o)) return [];
|
|
49
|
+
const p = d.placements.find((e) => e.field === o.field && e.group_key === o.group_key);
|
|
50
|
+
if (!p) return [];
|
|
51
|
+
const n = _(d, r);
|
|
52
|
+
return n === void 0 || c({ field: o.field, group_key: n }) ? [] : E(d, o.field, r, u, C(D(p)));
|
|
53
|
+
}
|
|
54
|
+
function Y(t, o, r, u, d) {
|
|
55
|
+
const p = k(r);
|
|
56
|
+
if (o.some((i) => k(i) === p)) return [];
|
|
57
|
+
let n = a(t);
|
|
58
|
+
const e = _(n, r);
|
|
59
|
+
if (e === void 0) return [];
|
|
60
|
+
const f = [];
|
|
61
|
+
let l = { over: r, side: u };
|
|
62
|
+
for (const i of o) {
|
|
63
|
+
if (i.kind !== "field" && i.kind !== "slot" || b(n, i, l.over)) continue;
|
|
64
|
+
const s = d === "copy" ? R(n, i, l.over, l.side) : h(n, i, l.over, l.side);
|
|
65
|
+
let y = null;
|
|
66
|
+
if (s.length) {
|
|
67
|
+
try {
|
|
68
|
+
n = g(n, s);
|
|
69
|
+
} catch {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
f.push(...s), y = { kind: i.kind, field: i.field, group_key: e };
|
|
73
|
+
} else d === "move" && i.group_key === e && (y = i);
|
|
74
|
+
y && (l = { over: y, side: "after" });
|
|
75
|
+
}
|
|
76
|
+
return f;
|
|
77
|
+
}
|
|
78
|
+
function j(t, o) {
|
|
79
|
+
const r = t.every((u) => u.kind === "field") ? "field" : "item";
|
|
80
|
+
return `${o === "copy" ? "Copy" : "Move"} ${O(t.length, r)}`;
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
T as carriedTargets,
|
|
84
|
+
R as copyAfterDrop,
|
|
85
|
+
Y as dropMany,
|
|
86
|
+
j as manyLabel
|
|
87
|
+
};
|
|
@@ -1,37 +1,45 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var g = (
|
|
4
|
-
import { useDraggable as
|
|
5
|
-
import { createContext as
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var J = (n, e, i) => e in n ? I(n, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : n[e] = i;
|
|
3
|
+
var g = (n, e, i) => J(n, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
+
import { useDraggable as K, useDroppable as _ } from "@dnd-kit/core";
|
|
5
|
+
import { createContext as M, useContext as S, useId as $, useRef as y, useCallback as m, useEffect as H, useSyncExternalStore as w } from "react";
|
|
6
6
|
import { isCanvasSlot as L } from "../../../lib/layout-ops.js";
|
|
7
|
-
import { targetKey as
|
|
8
|
-
import { dndRole as
|
|
9
|
-
const
|
|
10
|
-
|
|
7
|
+
import { targetKey as z } from "../design-context.js";
|
|
8
|
+
import { dndRole as E } from "./collision.js";
|
|
9
|
+
const P = {
|
|
10
|
+
activeKey: null,
|
|
11
|
+
overKey: null,
|
|
12
|
+
side: null,
|
|
13
|
+
indicator: null,
|
|
14
|
+
carried: null,
|
|
15
|
+
copy: !1,
|
|
16
|
+
merge: null
|
|
17
|
+
};
|
|
18
|
+
class X {
|
|
11
19
|
constructor() {
|
|
12
20
|
g(this, "bundle", null);
|
|
13
|
-
g(this, "state",
|
|
14
|
-
/** Registered element → its
|
|
21
|
+
g(this, "state", P);
|
|
22
|
+
/** Registered element → its activators (dnd-kit's onPointerDown, onTouchStart). */
|
|
15
23
|
g(this, "activators", /* @__PURE__ */ new WeakMap());
|
|
16
24
|
/** Droppable id → registered element (the overlay copies it, the drop line measures it). */
|
|
17
25
|
g(this, "nodes", /* @__PURE__ */ new Map());
|
|
18
26
|
/** A width is being dragged on the canvas (#2701): the column guides show. */
|
|
19
27
|
g(this, "resizing", !1);
|
|
20
28
|
g(this, "subs", /* @__PURE__ */ new Set());
|
|
21
|
-
g(this, "subscribe", (
|
|
22
|
-
this.subs.delete(
|
|
29
|
+
g(this, "subscribe", (e) => (this.subs.add(e), () => {
|
|
30
|
+
this.subs.delete(e);
|
|
23
31
|
}));
|
|
24
32
|
}
|
|
25
|
-
set(
|
|
26
|
-
const i = { ...this.state, ...
|
|
27
|
-
if (!(i.activeKey ===
|
|
33
|
+
set(e) {
|
|
34
|
+
const i = { ...this.state, ...e }, t = this.state;
|
|
35
|
+
if (!(i.activeKey === t.activeKey && i.overKey === t.overKey && i.side === t.side && i.copy === t.copy && i.merge === t.merge && i.carried === t.carried && JSON.stringify(i.indicator) === JSON.stringify(t.indicator))) {
|
|
28
36
|
this.state = i;
|
|
29
37
|
for (const r of this.subs) r();
|
|
30
38
|
}
|
|
31
39
|
}
|
|
32
|
-
setResizing(
|
|
33
|
-
if (this.resizing !==
|
|
34
|
-
this.resizing =
|
|
40
|
+
setResizing(e) {
|
|
41
|
+
if (this.resizing !== e) {
|
|
42
|
+
this.resizing = e;
|
|
35
43
|
for (const i of this.subs) i();
|
|
36
44
|
}
|
|
37
45
|
}
|
|
@@ -40,137 +48,139 @@ class Y {
|
|
|
40
48
|
return this.state.activeKey !== null || this.resizing;
|
|
41
49
|
}
|
|
42
50
|
/** What one node renders from: a node re-renders only when its slice changes. */
|
|
43
|
-
slice(
|
|
44
|
-
const i = this.state,
|
|
45
|
-
return `${
|
|
51
|
+
slice(e) {
|
|
52
|
+
const i = this.state, t = i.overKey === e ? `${i.side}${i.merge ?? ""}${JSON.stringify(i.indicator)}` : "";
|
|
53
|
+
return `${this.isCarried(e) ? 1 : 0}|${t}`;
|
|
54
|
+
}
|
|
55
|
+
/** Is the node `key` part of the current drag (the dragged one, or carried with it)? */
|
|
56
|
+
isCarried(e) {
|
|
57
|
+
var t;
|
|
58
|
+
const i = this.state;
|
|
59
|
+
return i.activeKey === e || (((t = i.carried) == null ? void 0 : t.includes(e)) ?? !1);
|
|
46
60
|
}
|
|
47
61
|
/** Remember `el` under `id` (and forget the element it replaces). */
|
|
48
|
-
track(
|
|
49
|
-
i && this.nodes.get(
|
|
62
|
+
track(e, i, t) {
|
|
63
|
+
i && this.nodes.get(e) === i && this.nodes.delete(e), t && this.nodes.set(e, t);
|
|
50
64
|
}
|
|
51
65
|
}
|
|
52
|
-
const
|
|
66
|
+
const C = M(null), q = {
|
|
53
67
|
draggableProps: () => ({}),
|
|
54
68
|
isDragging: () => !1,
|
|
55
69
|
dropSlot: () => null
|
|
56
|
-
},
|
|
70
|
+
}, O = () => () => {
|
|
57
71
|
};
|
|
58
|
-
function
|
|
59
|
-
if (!
|
|
60
|
-
if (
|
|
61
|
-
const
|
|
62
|
-
(i) => i.closest("[data-design-target]") ===
|
|
72
|
+
function F(n) {
|
|
73
|
+
if (!n) return 0;
|
|
74
|
+
if (n.hasAttribute("data-design-tab")) return n.getBoundingClientRect().height;
|
|
75
|
+
const e = Array.from(n.querySelectorAll("[data-design-group-header]")).find(
|
|
76
|
+
(i) => i.closest("[data-design-target]") === n
|
|
63
77
|
);
|
|
64
|
-
return
|
|
78
|
+
return e ? e.getBoundingClientRect().bottom - n.getBoundingClientRect().top : 0;
|
|
65
79
|
}
|
|
66
|
-
function
|
|
80
|
+
function Y(n, e, i = {}) {
|
|
67
81
|
var N, A;
|
|
68
|
-
const
|
|
69
|
-
target:
|
|
82
|
+
const t = S(C), r = z(e), c = $(), l = y(null), s = t != null && t.bundle ? E(t.bundle, e) : null, a = !!t && !!s && !i.disabled && n !== q, u = a ? r : `${r}#${c}`, d = s ? {
|
|
83
|
+
target: e,
|
|
70
84
|
role: s,
|
|
71
|
-
headerHeight: s.kind === "group" ? () =>
|
|
72
|
-
} : void 0, o =
|
|
73
|
-
|
|
74
|
-
(
|
|
75
|
-
() => (
|
|
85
|
+
headerHeight: s.kind === "group" ? () => F(l.current) : void 0
|
|
86
|
+
} : void 0, o = K({ id: u, data: d, disabled: !a }), D = _({ id: u, data: d, disabled: !a || !!i.noDrop });
|
|
87
|
+
w(
|
|
88
|
+
(t == null ? void 0 : t.subscribe) ?? O,
|
|
89
|
+
() => (t == null ? void 0 : t.slice(r)) ?? "",
|
|
76
90
|
() => ""
|
|
77
91
|
);
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
const { setNodeRef:
|
|
81
|
-
(
|
|
82
|
-
|
|
83
|
-
b,
|
|
84
|
-
() => {
|
|
85
|
-
var C;
|
|
86
|
-
return (C = D.current) == null ? void 0 : C.onPointerDown;
|
|
87
|
-
}
|
|
88
|
-
);
|
|
92
|
+
const h = y(o.listeners);
|
|
93
|
+
h.current = o.listeners;
|
|
94
|
+
const { setNodeRef: b, setActivatorNodeRef: v } = o, f = D.setNodeRef, B = m(
|
|
95
|
+
(p) => {
|
|
96
|
+
t == null || t.track(r, l.current, p), l.current = p, b(p), f(p), v(p), p && t && t.activators.set(p, () => h.current);
|
|
89
97
|
},
|
|
90
|
-
[r, v,
|
|
98
|
+
[r, v, b, f, t]
|
|
91
99
|
);
|
|
92
|
-
if (!
|
|
100
|
+
if (!t)
|
|
93
101
|
return {
|
|
94
|
-
props:
|
|
95
|
-
dragging:
|
|
96
|
-
slot:
|
|
97
|
-
indicator: ((N =
|
|
102
|
+
props: n.draggableProps(e, i.disabled ? { disabled: !0 } : void 0),
|
|
103
|
+
dragging: n.isDragging(e),
|
|
104
|
+
slot: n.dropSlot(e),
|
|
105
|
+
indicator: ((N = n.dropIndicator) == null ? void 0 : N.call(n, e)) ?? null,
|
|
106
|
+
merge: null
|
|
98
107
|
};
|
|
99
|
-
const k =
|
|
108
|
+
const k = t.state, R = k.overKey === r;
|
|
100
109
|
return {
|
|
101
|
-
// The pointer
|
|
102
|
-
// pointerdown to
|
|
103
|
-
props: a ? { ref:
|
|
104
|
-
dragging:
|
|
105
|
-
slot:
|
|
106
|
-
indicator:
|
|
110
|
+
// The pointer and touch activators are not spread here: LayoutDndProvider
|
|
111
|
+
// relays pointerdown and touchstart to them. The keyboard one stays on the node.
|
|
112
|
+
props: a ? { ref: B, ...o.attributes, onKeyDown: (A = o.listeners) == null ? void 0 : A.onKeyDown } : {},
|
|
113
|
+
dragging: t.isCarried(r),
|
|
114
|
+
slot: R ? k.side : null,
|
|
115
|
+
indicator: R ? k.indicator : null,
|
|
116
|
+
merge: R ? k.merge : null
|
|
107
117
|
};
|
|
108
118
|
}
|
|
109
|
-
function
|
|
110
|
-
const
|
|
119
|
+
function ee(n) {
|
|
120
|
+
const e = S(C), i = `body:${n}`, t = e != null && e.bundle ? E(e.bundle, { kind: "group", key: n }) : null, r = (t == null ? void 0 : t.kind) === "group" && t.body, c = _({
|
|
111
121
|
id: i,
|
|
112
|
-
data: { target: { kind: "group", key:
|
|
122
|
+
data: { target: { kind: "group", key: n }, role: { kind: "body", key: n } },
|
|
113
123
|
disabled: !r
|
|
114
124
|
});
|
|
115
|
-
|
|
116
|
-
(
|
|
117
|
-
() => (
|
|
125
|
+
w(
|
|
126
|
+
(e == null ? void 0 : e.subscribe) ?? O,
|
|
127
|
+
() => (e == null ? void 0 : e.slice(i)) ?? "",
|
|
118
128
|
() => ""
|
|
119
129
|
);
|
|
120
|
-
const l = y(null), s = c.setNodeRef, a =
|
|
130
|
+
const l = y(null), s = c.setNodeRef, a = m(
|
|
121
131
|
(d) => {
|
|
122
132
|
const o = (d == null ? void 0 : d.parentElement) ?? null;
|
|
123
|
-
|
|
133
|
+
e == null || e.track(i, l.current, o), l.current = o, s(o), o && getComputedStyle(o).position === "static" && (o.style.position = "relative");
|
|
124
134
|
},
|
|
125
|
-
[i, s,
|
|
126
|
-
), u = (
|
|
135
|
+
[i, s, e]
|
|
136
|
+
), u = (e == null ? void 0 : e.state.overKey) === i;
|
|
127
137
|
return {
|
|
128
138
|
ref: a,
|
|
129
|
-
slot: u ? (
|
|
130
|
-
indicator: u ? (
|
|
139
|
+
slot: u ? (e == null ? void 0 : e.state.side) ?? null : null,
|
|
140
|
+
indicator: u ? (e == null ? void 0 : e.state.indicator) ?? null : null
|
|
131
141
|
};
|
|
132
142
|
}
|
|
133
|
-
const
|
|
134
|
-
function
|
|
135
|
-
return
|
|
143
|
+
const x = "__add__";
|
|
144
|
+
function G(n, e) {
|
|
145
|
+
return e === "header" ? { kind: "header" } : L({ field: n, group_key: null }) ? { kind: "group", key: n, parent: null, body: !1 } : { kind: "item", zone: x };
|
|
136
146
|
}
|
|
137
|
-
const
|
|
138
|
-
function
|
|
139
|
-
const
|
|
147
|
+
const T = 400;
|
|
148
|
+
function te(n) {
|
|
149
|
+
const e = S(C), i = $(), t = !!e && !!n, r = { kind: "field", field: (n == null ? void 0 : n.field) ?? i, group_key: x }, c = z(r), l = n ? {
|
|
140
150
|
target: r,
|
|
141
|
-
role:
|
|
151
|
+
role: G(n.field, n.to),
|
|
142
152
|
add: {
|
|
143
|
-
field:
|
|
144
|
-
label:
|
|
145
|
-
patch:
|
|
146
|
-
onAdded:
|
|
153
|
+
field: n.field,
|
|
154
|
+
label: n.label,
|
|
155
|
+
patch: n.patch,
|
|
156
|
+
onAdded: n.onAdded
|
|
147
157
|
}
|
|
148
|
-
} : void 0, s =
|
|
158
|
+
} : void 0, s = K({ id: t ? c : `${c}#${i}`, data: l, disabled: !t }), a = y(null), { setNodeRef: u, setActivatorNodeRef: d } = s, o = m(
|
|
149
159
|
(f) => {
|
|
150
|
-
|
|
160
|
+
e == null || e.track(c, a.current, f), a.current = f, u(f), d(f);
|
|
151
161
|
},
|
|
152
|
-
[c, d, u,
|
|
153
|
-
),
|
|
162
|
+
[c, d, u, e]
|
|
163
|
+
), D = y(0), h = y(!1);
|
|
154
164
|
H(() => {
|
|
155
|
-
|
|
165
|
+
h.current && !s.isDragging && (D.current = Date.now()), h.current = s.isDragging;
|
|
156
166
|
}, [s.isDragging]);
|
|
157
|
-
const
|
|
158
|
-
() =>
|
|
159
|
-
[
|
|
167
|
+
const b = s.isDragging, v = m(
|
|
168
|
+
() => b || Date.now() - D.current < T,
|
|
169
|
+
[b]
|
|
160
170
|
);
|
|
161
171
|
return {
|
|
162
|
-
props:
|
|
163
|
-
dragging:
|
|
172
|
+
props: t ? { ref: o, ...s.attributes, ...s.listeners } : {},
|
|
173
|
+
dragging: b,
|
|
164
174
|
clickBlocked: v
|
|
165
175
|
};
|
|
166
176
|
}
|
|
167
177
|
export {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
178
|
+
X as DndStore,
|
|
179
|
+
C as DndStoreContext,
|
|
180
|
+
P as IDLE,
|
|
181
|
+
q as NO_DND,
|
|
182
|
+
G as addRole,
|
|
183
|
+
te as useAddDragSource,
|
|
184
|
+
Y as useDesignDndNode,
|
|
185
|
+
ee as useDesignDropBody
|
|
176
186
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var s = Object.defineProperty;
|
|
2
|
+
var c = (t, e, n) => e in t ? s(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var r = (t, e, n) => c(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { PointerSensor as a } from "@dnd-kit/core";
|
|
5
|
+
import { TouchSensor as h } from "@dnd-kit/core";
|
|
6
|
+
const d = { distance: 4 }, p = { delay: 250, tolerance: 8 };
|
|
7
|
+
class i extends a {
|
|
8
|
+
}
|
|
9
|
+
r(i, "activators", [
|
|
10
|
+
{
|
|
11
|
+
eventName: "onPointerDown",
|
|
12
|
+
handler: (e, n) => {
|
|
13
|
+
var o;
|
|
14
|
+
return ((o = e.nativeEvent) == null ? void 0 : o.pointerType) === "touch" ? !1 : a.activators[0].handler(e, n);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
]);
|
|
18
|
+
export {
|
|
19
|
+
d as MOUSE_ACTIVATION,
|
|
20
|
+
i as MousePointerSensor,
|
|
21
|
+
p as TOUCH_ACTIVATION,
|
|
22
|
+
h as TouchSensor
|
|
23
|
+
};
|