@nivaro/react 0.3.35 → 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.
Files changed (106) hide show
  1. package/dist/components/slots/CommentsSlot.js +44 -36
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +13 -4
  5. package/dist/shared/components/AgentBadge.js +26 -0
  6. package/dist/shared/components/AgentQuestionsCard.js +198 -0
  7. package/dist/shared/components/ItemEditForm.js +3329 -3263
  8. package/dist/shared/components/McpConnectionScope.js +480 -0
  9. package/dist/shared/components/MyWorkView.js +223 -208
  10. package/dist/shared/components/RecordReadView.js +620 -572
  11. package/dist/shared/components/chat/ChatPanel.js +683 -671
  12. package/dist/shared/components/imports/DownloadSampleButton.js +69 -0
  13. package/dist/shared/components/imports/ImportConsole.js +106 -104
  14. package/dist/shared/components/imports/RunDetailSheet.js +11 -10
  15. package/dist/shared/components/item-edit/FieldAffordances.js +32 -32
  16. package/dist/shared/components/item-edit/FormTour.js +279 -0
  17. package/dist/shared/components/item-edit/GroupSection.js +377 -360
  18. package/dist/shared/components/item-edit/PersonalDefaultControl.js +80 -63
  19. package/dist/shared/components/item-edit/entry/EntryStrip.js +30 -26
  20. package/dist/shared/components/item-edit/form-density.js +36 -0
  21. package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -46
  22. package/dist/shared/components/item-edit/usePersonalDefaults.js +312 -296
  23. package/dist/shared/components/layout-editor/AddPanel.js +349 -192
  24. package/dist/shared/components/layout-editor/DesignNode.js +146 -131
  25. package/dist/shared/components/layout-editor/EditorCanvas.js +25 -17
  26. package/dist/shared/components/layout-editor/EditorTopBar.js +268 -206
  27. package/dist/shared/components/layout-editor/LayoutEditor.js +810 -731
  28. package/dist/shared/components/layout-editor/PlaceTools.js +334 -0
  29. package/dist/shared/components/layout-editor/SlashInsert.js +252 -0
  30. package/dist/shared/components/layout-editor/StructureMenu.js +285 -242
  31. package/dist/shared/components/layout-editor/add-target.js +54 -43
  32. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +238 -155
  33. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +1 -1
  34. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +15 -12
  35. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +379 -185
  36. package/dist/shared/components/layout-editor/dnd/TrashZone.js +96 -0
  37. package/dist/shared/components/layout-editor/dnd/UndoChip.js +76 -0
  38. package/dist/shared/components/layout-editor/dnd/merge-drop.js +33 -0
  39. package/dist/shared/components/layout-editor/dnd/multi-drop.js +87 -0
  40. package/dist/shared/components/layout-editor/dnd/node.js +115 -105
  41. package/dist/shared/components/layout-editor/dnd/rail-drop.js +4 -4
  42. package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
  43. package/dist/shared/components/layout-editor/dnd/trash-drop.js +58 -0
  44. package/dist/shared/components/layout-editor/dnd/trash-links.js +97 -0
  45. package/dist/shared/components/layout-editor/even-row.js +86 -0
  46. package/dist/shared/components/layout-editor/field-list.js +99 -0
  47. package/dist/shared/components/layout-editor/format-painter.js +102 -0
  48. package/dist/shared/components/layout-editor/grid-guides.js +15 -13
  49. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +150 -132
  50. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +57 -53
  51. package/dist/shared/components/layout-editor/inspector/EvenRowAction.js +31 -0
  52. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +154 -141
  53. package/dist/shared/components/layout-editor/inspector/Inspector.js +209 -178
  54. package/dist/shared/components/layout-editor/inspector/LookTab.js +106 -98
  55. package/dist/shared/components/layout-editor/inspector/RulesTab.js +38 -37
  56. package/dist/shared/components/layout-editor/inspector/kit.js +280 -223
  57. package/dist/shared/components/layout-editor/keyboard-move.js +15 -15
  58. package/dist/shared/components/layout-editor/lint/LabelStyle.js +201 -0
  59. package/dist/shared/components/layout-editor/lint/LintPanel.js +132 -84
  60. package/dist/shared/components/layout-editor/lint/lint-api.js +65 -28
  61. package/dist/shared/components/layout-editor/nav/NavTools.js +14 -12
  62. package/dist/shared/components/layout-editor/nav/ZoomControls.js +145 -0
  63. package/dist/shared/components/layout-editor/nav/useEditorNav.js +34 -32
  64. package/dist/shared/components/layout-editor/nav/view-prefs.js +100 -15
  65. package/dist/shared/components/layout-editor/outputs/LayoutFile.js +89 -0
  66. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +272 -195
  67. package/dist/shared/components/layout-editor/outputs/layout-file-plan.js +176 -0
  68. package/dist/shared/components/layout-editor/outputs/output-api.js +71 -37
  69. package/dist/shared/components/layout-editor/overview/describe-conditions.js +16 -11
  70. package/dist/shared/components/layout-editor/overview/purpose.js +5 -5
  71. package/dist/shared/components/layout-editor/panel-frame.js +1 -1
  72. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  73. package/dist/shared/components/layout-editor/personal-default-marks.js +40 -0
  74. package/dist/shared/components/layout-editor/pin.js +37 -19
  75. package/dist/shared/components/layout-editor/place-clip.js +257 -0
  76. package/dist/shared/components/layout-editor/preview/PreviewModes.js +27 -26
  77. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +149 -118
  78. package/dist/shared/components/layout-editor/preview/SampleRecord.js +113 -0
  79. package/dist/shared/components/layout-editor/preview/preview-model.js +79 -60
  80. package/dist/shared/components/layout-editor/preview/sample-record.js +105 -0
  81. package/dist/shared/components/layout-editor/removed-log.js +151 -0
  82. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +109 -78
  83. package/dist/shared/components/layout-editor/reuse/linked-sections.js +373 -0
  84. package/dist/shared/components/layout-editor/revert-element.js +140 -0
  85. package/dist/shared/components/layout-editor/section-structure.js +193 -170
  86. package/dist/shared/components/layout-editor/settings/EntrySection.js +63 -45
  87. package/dist/shared/components/layout-editor/settings/LayoutSection.js +63 -32
  88. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +179 -137
  89. package/dist/shared/components/layout-editor/settings/WhoSection.js +18 -17
  90. package/dist/shared/components/layout-editor/settings/settings-registry.js +24 -0
  91. package/dist/shared/components/layout-editor/shortcuts.js +21 -16
  92. package/dist/shared/components/layout-editor/structure-ops.js +221 -195
  93. package/dist/shared/components/layout-editor/usage/UsagePanel.js +133 -85
  94. package/dist/shared/components/layout-editor/usage/refusal-lens.js +130 -0
  95. package/dist/shared/components/layout-editor/usage/usage-api.js +12 -11
  96. package/dist/shared/components/panels/CommentPanel.js +47 -45
  97. package/dist/shared/components/panels/RevisionsPanel.js +66 -64
  98. package/dist/shared/components/panels/TaskPanel.js +395 -332
  99. package/dist/shared/components/profile/AgentsPanel.js +196 -147
  100. package/dist/shared/components/profile/ConnectionRollback.js +329 -0
  101. package/dist/shared/components/profile/MyDefaultsCard.js +526 -520
  102. package/dist/shared/lib/entry-config.js +22 -22
  103. package/dist/shared/lib/form-usage-beacon.js +91 -55
  104. package/dist/shared/lib/layout-lint.js +530 -284
  105. package/dist/shared/lib/layout-resolve.js +58 -44
  106. package/package.json +1 -1
@@ -0,0 +1,40 @@
1
+ import { useMemo as f } from "react";
2
+ const i = (t, e) => `${e ?? ""}\0${t}`;
3
+ function c(t) {
4
+ if (typeof t == "string")
5
+ try {
6
+ const e = JSON.parse(t);
7
+ return e && typeof e == "object" ? e : {};
8
+ } catch {
9
+ return {};
10
+ }
11
+ return t && typeof t == "object" ? t : {};
12
+ }
13
+ function l(t) {
14
+ const e = /* @__PURE__ */ new Set();
15
+ for (const n of t.placements)
16
+ c(n.overrides).personal_default === !0 && e.add(i(n.field, n.group_key));
17
+ return e;
18
+ }
19
+ const u = {
20
+ text: "Personal default",
21
+ tone: "slate",
22
+ icon: "person",
23
+ kind: "personal",
24
+ tip: "People can save their own starting value for this field on this form. New records start with it."
25
+ };
26
+ function a(t, e) {
27
+ const n = t.placements;
28
+ return f(() => {
29
+ const r = l({ placements: n });
30
+ return r.size === 0 ? e : (o) => {
31
+ const s = (e == null ? void 0 : e(o)) ?? [];
32
+ return o.kind !== "field" || !r.has(i(o.field, o.group_key)) ? s : [...s, u];
33
+ };
34
+ }, [n, e]);
35
+ }
36
+ export {
37
+ u as PERSONAL_DEFAULT_MARK,
38
+ l as personalDefaultPlacements,
39
+ a as usePersonalDefaultMarks
40
+ };
@@ -1,25 +1,43 @@
1
- import { UNGROUPED_KEY as p } from "../../lib/layout-ops.js";
2
- import { asObject as u, withKey as s } from "./inspector/model.js";
3
- const f = "editor_pinned", i = (r, n) => r.groups.find((e) => e.key === n) ?? null;
4
- function t(r) {
5
- return !!r && u(r.swap_config)[f] === !0;
1
+ import { HEADER_GROUP_KEY as c, UNGROUPED_KEY as p } from "../../lib/layout-ops.js";
2
+ import { asObject as i, withKey as l } from "./inspector/model.js";
3
+ const u = "editor_pinned", o = (n, e) => n.groups.find((r) => r.key === e) ?? null;
4
+ function f(n) {
5
+ return !!n && i(n.swap_config)[u] === !0;
6
6
  }
7
- function l(r, n) {
8
- const e = s(u(r), f, n ? !0 : void 0);
9
- return e ? JSON.stringify(e) : null;
7
+ function g(n, e) {
8
+ const r = l(i(n), u, e ? !0 : void 0);
9
+ return r ? JSON.stringify(r) : null;
10
10
  }
11
- function o(r, n) {
12
- if (!n || n === p) return !1;
13
- const e = i(r, n);
14
- return e ? t(e) ? !0 : !!e.parent_key && t(i(r, e.parent_key)) : !1;
11
+ function s(n) {
12
+ return !!n && i(n.overrides)[u] === !0;
15
13
  }
16
- function a(r, n) {
17
- return n.kind === "group" ? o(r, n.key) : n.kind === "field" || n.kind === "slot" ? o(r, n.group_key) : !1;
14
+ function a(n, e) {
15
+ return l(i(n), u, e ? !0 : void 0);
16
+ }
17
+ function m(n) {
18
+ return s({ overrides: n.overrides }) ? { ...n, overrides: a(n.overrides, !1) } : n;
19
+ }
20
+ function k(n, e) {
21
+ if (e.kind === "group") return null;
22
+ const r = e.kind === "header" ? c : e.group_key;
23
+ return n.placements.find((t) => t.field === e.field && (t.group_key ?? null) === r) ?? null;
24
+ }
25
+ function d(n, e) {
26
+ if (!e || e === p) return !1;
27
+ const r = o(n, e);
28
+ return r ? f(r) ? !0 : !!r.parent_key && f(o(n, r.parent_key)) : !1;
29
+ }
30
+ function v(n, e) {
31
+ return e.kind === "group" ? d(n, e.key) : s(k(n, e)) ? !0 : e.kind === "field" || e.kind === "slot" ? d(n, e.group_key) : !1;
18
32
  }
19
33
  export {
20
- f as PIN_KEY,
21
- t as isPinned,
22
- a as pinLocked,
23
- o as pinnedZone,
24
- l as withPin
34
+ u as PIN_KEY,
35
+ f as isPinned,
36
+ s as isPlacementPinned,
37
+ v as pinLocked,
38
+ d as pinnedZone,
39
+ k as placementOf,
40
+ m as unpinnedPatch,
41
+ g as withPin,
42
+ a as withPlacementPin
25
43
  };
@@ -0,0 +1,257 @@
1
+ var Y = Object.defineProperty;
2
+ var B = (n, e, t) => e in n ? Y(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var P = (n, e, t) => B(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { withGroupStructure as D } from "../../lib/form-structure.js";
5
+ import { UNGROUPED_KEY as R, HEADER_GROUP_KEY as C, isCanvasSlot as v, applyLayoutOps as J, GROUP_PATCH_KEYS as M } from "../../lib/layout-ops.js";
6
+ import { titleCase as m } from "../../lib/utils.js";
7
+ import { fieldSpot as q, slotSpot as Q, newGroupKey as V } from "./add-target.js";
8
+ import { normalizedBundle as T, inPageOrder as X, plural as z, zoneItems as Z } from "./field-zones.js";
9
+ import { placementPatchOf as F } from "./inspector/model.js";
10
+ import { withPin as x } from "./pin.js";
11
+ import { slotName as K } from "./slot-names.js";
12
+ import { refuse as w } from "./structure-ops.js";
13
+ import { humanizeOpError as ee } from "./useLayoutDraft.js";
14
+ const E = "nivaro-layout-clip", ge = "nvr:layout-editor:clip", te = (n) => [...n].sort((e, t) => e.sort - t.sort);
15
+ function oe(n) {
16
+ const e = {};
17
+ for (const t of M)
18
+ t === "label" || t === "type" || t === "editor_note" || n[t] !== void 0 && (e[t] = n[t]);
19
+ return e.swap_config = D(x(n.swap_config, !1), { sticky: !1 }), e;
20
+ }
21
+ function U(n, e) {
22
+ return {
23
+ key: e.key,
24
+ label: e.label,
25
+ type: e.type,
26
+ settings: oe(e),
27
+ placements: Z(n, e.key).map((t) => ({
28
+ field: t.field,
29
+ from_group: e.key,
30
+ patch: F(t)
31
+ })),
32
+ children: te(n.groups.filter((t) => t.parent_key === e.key)).map((t) => U(n, t))
33
+ };
34
+ }
35
+ function _e(n, e, t) {
36
+ if (e.length === 0) return { ok: !1, reason: "Select a field or section to copy" };
37
+ const s = T(n), o = {
38
+ marker: E,
39
+ v: 1,
40
+ collection: t.collection,
41
+ layout_id: t.layoutId,
42
+ layout_name: t.layoutName
43
+ }, u = e.filter((r) => r.kind === "group");
44
+ if (u.length > 0) {
45
+ if (e.length > 1) return { ok: !1, reason: "Copy one section at a time" };
46
+ const r = u[0].key;
47
+ if (r === R) return { ok: !1, reason: "Ungrouped is not a section" };
48
+ const p = s.groups.find((i) => i.key === r);
49
+ return p ? {
50
+ ok: !0,
51
+ clip: {
52
+ ...o,
53
+ label: p.label || m(p.key),
54
+ kind: "group",
55
+ placements: [],
56
+ group: U(s, p)
57
+ }
58
+ } : { ok: !1, reason: "This comes from the parent form: override it here first" };
59
+ }
60
+ const l = [];
61
+ for (const r of e) {
62
+ if (r.kind === "group") continue;
63
+ const p = r.kind === "header" ? C : r.group_key, i = s.placements.find((d) => d.field === r.field && d.group_key === p);
64
+ i && !l.includes(i) && l.push(i);
65
+ }
66
+ if (l.length === 0)
67
+ return { ok: !1, reason: "This comes from the parent form: override it here first" };
68
+ const k = X(s, l), f = (r) => {
69
+ var p;
70
+ return r.startsWith("__") ? K(r) : ((p = t.fieldLabel) == null ? void 0 : p.call(t, r)) ?? m(r);
71
+ };
72
+ return {
73
+ ok: !0,
74
+ clip: {
75
+ ...o,
76
+ label: k.length === 1 ? f(k[0].field) : z(k.length, "field"),
77
+ kind: "fields",
78
+ placements: k.map((r) => ({
79
+ field: r.field,
80
+ from_group: r.group_key,
81
+ patch: F(r)
82
+ })),
83
+ group: null
84
+ }
85
+ };
86
+ }
87
+ const be = (n) => JSON.stringify(n);
88
+ function we(n) {
89
+ if (!(n != null && n.includes(E))) return null;
90
+ try {
91
+ const e = JSON.parse(n);
92
+ return !e || e.marker !== E || e.v !== 1 || typeof e.collection != "string" || e.kind !== "fields" && e.kind !== "group" || !Array.isArray(e.placements) || e.kind === "group" && (!e.group || typeof e.group.key != "string") ? null : e;
93
+ } catch {
94
+ return null;
95
+ }
96
+ }
97
+ const G = (n, e) => e != null && !n.startsWith("__") && !e.has(n);
98
+ class ne {
99
+ constructor(e, t) {
100
+ P(this, "ops", []);
101
+ P(this, "skipped", []);
102
+ P(this, "label", (e) => e.startsWith("__") ? K(e) : this.name(e));
103
+ this.w = e, this.name = t;
104
+ }
105
+ try(e, t) {
106
+ try {
107
+ return this.w = J(this.w, [e]), this.ops.push(e), !0;
108
+ } catch (s) {
109
+ return this.skipped.push(`${t}: ${ee(s.message)}`), !1;
110
+ }
111
+ }
112
+ zoneHas(e, t) {
113
+ return this.w.placements.some((s) => s.field === e && s.group_key === t);
114
+ }
115
+ }
116
+ function ie(n, e) {
117
+ if (e === null) return "Ungrouped";
118
+ if (e === C) return "the header strip";
119
+ const t = n.groups.find((s) => s.key === e);
120
+ return t ? t.label || m(t.key) : m(e);
121
+ }
122
+ function re(n, e, t) {
123
+ const s = (e == null ? void 0 : e.kind) === "group" ? e.key : e && e.kind !== "header" ? e.group_key : null, o = s ? n.groups.find((i) => i.key === s) : void 0, u = (o == null ? void 0 : o.type) === "container" ? o : o != null && o.parent_key ? n.groups.find((i) => i.key === o.parent_key) : null, l = n.groups.filter((i) => i.parent_key === null), k = l.length + n.placements.filter(v).length;
124
+ if (t === "tab" && u) {
125
+ const i = n.groups.filter((d) => d.parent_key === u.key);
126
+ return {
127
+ parent_key: u.key,
128
+ index: o && o.parent_key === u.key ? o.sort + 1 : i.length,
129
+ asSection: !1
130
+ };
131
+ }
132
+ let f = k;
133
+ const r = u ?? (o && o.parent_key === null ? o : null);
134
+ if (r) f = r.sort + 1;
135
+ else if (s === null && e && e.kind !== "group" && e.kind !== "header") {
136
+ const i = n.groups.find((d) => d.key === R);
137
+ i && (f = i.sort + 1);
138
+ }
139
+ const p = l.some((i) => i.type === "tab");
140
+ return { parent_key: null, index: f, asSection: t === "tab" && !p };
141
+ }
142
+ function $e(n, e, t) {
143
+ var N;
144
+ if (e.collection !== t.collection)
145
+ return w(
146
+ `That was copied from a ${m(e.collection)} form. Paste it into a form of the same collection.`
147
+ );
148
+ const s = T(n), o = new ne(s, t.fieldLabel ?? m), u = e.layout_id != null && Number(e.layout_id) === Number(s.layout.id), l = [];
149
+ if (e.kind === "group" && e.group) {
150
+ const a = re(s, t.selected, e.group.type);
151
+ let c = 0;
152
+ const $ = (h, H, L, j) => {
153
+ const b = V(o.w, h.key), I = j && a.asSection ? "section" : h.type, W = j && u ? `${h.label || m(h.key)} (copy)` : h.label;
154
+ if (!o.try(
155
+ {
156
+ op: "group_create",
157
+ key: b,
158
+ label: W,
159
+ group_type: I,
160
+ parent_key: H,
161
+ index: L,
162
+ patch: h.settings
163
+ },
164
+ h.label || m(h.key)
165
+ )) return b;
166
+ let A = 0;
167
+ for (const y of h.placements) {
168
+ if (G(y.field, t.knownFields)) {
169
+ l.push(o.label(y.field));
170
+ continue;
171
+ }
172
+ o.w.placements.some((S) => S.field === y.field && !v(S)) && c++, o.try(
173
+ { op: "place", field: y.field, group_key: b, index: A, patch: y.patch },
174
+ o.label(y.field)
175
+ ) && A++;
176
+ }
177
+ return h.children.forEach((y, S) => {
178
+ $(y, b, S, !1);
179
+ }), b;
180
+ }, O = $(e.group, a.parent_key, a.index, !0);
181
+ if (o.ops.length === 0)
182
+ return w(o.skipped[0] ?? `${e.label} cannot be pasted here`);
183
+ const g = [];
184
+ return !u && e.layout_name && g.push(`From ${e.layout_name}`), a.asSection && g.push("Pasted as a section: this form shows no tabs at the top"), c && g.push(
185
+ `${z(c, "field")} already on this form now ${c === 1 ? "shows" : "show"} in two places`
186
+ ), l.length && g.push(`Not in this collection, skipped: ${l.join(", ")}`), g.push(...o.skipped), {
187
+ ok: !0,
188
+ ops: o.ops,
189
+ label: `Paste ${e.label}`,
190
+ notes: g,
191
+ select: { kind: "group", key: O },
192
+ skipped: [...l, ...o.skipped]
193
+ };
194
+ }
195
+ const k = ((N = t.selected) == null ? void 0 : N.kind) === "header", f = q(s, t.selected, k ? "header" : "form");
196
+ let r = f.index, p = null;
197
+ const i = [];
198
+ for (const a of e.placements) {
199
+ const c = o.label(a.field);
200
+ if (G(a.field, t.knownFields)) {
201
+ l.push(c);
202
+ continue;
203
+ }
204
+ if (v({ field: a.field, group_key: null })) {
205
+ if (o.w.placements.some((O) => O.field === a.field)) {
206
+ i.push(c);
207
+ continue;
208
+ }
209
+ const $ = Q(o.w, t.selected);
210
+ o.try(
211
+ { op: "place", field: a.field, group_key: null, index: $.index, patch: a.patch },
212
+ c
213
+ ) && (p ?? (p = { kind: "slot", field: a.field, group_key: null }));
214
+ continue;
215
+ }
216
+ if (o.zoneHas(a.field, f.group_key)) {
217
+ i.push(c);
218
+ continue;
219
+ }
220
+ o.try(
221
+ { op: "place", field: a.field, group_key: f.group_key, index: r, patch: a.patch },
222
+ c
223
+ ) && (r++, p ?? (p = f.group_key === C ? { kind: "header", field: a.field } : {
224
+ kind: a.field.startsWith("__") ? "slot" : "field",
225
+ field: a.field,
226
+ group_key: f.group_key
227
+ }));
228
+ }
229
+ const d = ie(o.w, f.group_key);
230
+ if (o.ops.length === 0)
231
+ return l.length && !i.length && !o.skipped.length ? w(`This collection has no ${l.join(", ")}: nothing to paste`) : i.length && !l.length && !o.skipped.length ? w(
232
+ `${i.join(", ")} ${i.length === 1 ? "is" : "are"} already in ${d}. Select another section first.`
233
+ ) : w(
234
+ [
235
+ l.length ? `Not in this collection: ${l.join(", ")}` : "",
236
+ i.length ? `Already in ${d}: ${i.join(", ")}` : "",
237
+ ...o.skipped
238
+ ].filter(Boolean).join(". ")
239
+ );
240
+ const _ = [];
241
+ return !u && e.layout_name && _.push(`From ${e.layout_name}`), l.length && _.push(`Not in this collection, skipped: ${l.join(", ")}`), i.length && _.push(`Already in ${d}, skipped: ${i.join(", ")}`), _.push(...o.skipped), {
242
+ ok: !0,
243
+ ops: o.ops,
244
+ label: `Paste ${e.label}`,
245
+ notes: _,
246
+ select: p ?? void 0,
247
+ skipped: [...l, ...i, ...o.skipped]
248
+ };
249
+ }
250
+ export {
251
+ E as CLIP_MARKER,
252
+ ge as CLIP_STORAGE_KEY,
253
+ _e as makeClip,
254
+ we as parseClip,
255
+ $e as pastePlan,
256
+ be as serializeClip
257
+ };
@@ -8,15 +8,16 @@ import { useRoleNames as X } from "../overview/overview-api.js";
8
8
  import { segOption as _, segTrack as q } from "../panel-style.js";
9
9
  import { useCollectionPipelines as z } from "./preview-api.js";
10
10
  import { drivingFields as B } from "./preview-model.js";
11
- const G = "mb-1 block text-[11.5px] font-semibold text-slate-600 dark:text-muted-foreground", p = "mt-1 text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", H = "h-8 w-full rounded-md border border-slate-200 bg-white px-2.5 text-[12.5px] text-slate-800 outline-none placeholder:text-slate-400 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-foreground dark:placeholder:text-muted-foreground", L = "inline-flex h-6 items-center rounded-full border border-slate-200 px-2 text-[12px] text-slate-700 transition-colors hover:bg-muted dark:border-border dark:text-foreground", $ = [
11
+ const G = "mb-1 block text-[11.5px] font-semibold text-slate-600 dark:text-muted-foreground", p = "mt-1 text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", H = "h-8 w-full rounded-md border border-slate-200 bg-white px-2.5 text-[12.5px] text-slate-800 outline-none placeholder:text-slate-400 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-foreground dark:placeholder:text-muted-foreground", D = "inline-flex h-6 items-center rounded-full border border-slate-200 px-2 text-[12px] text-slate-700 transition-colors hover:bg-muted dark:border-border dark:text-foreground", L = [
12
12
  { value: "desktop", label: "Desktop", tip: "The full canvas width" },
13
13
  { value: "tablet", label: "Tablet", tip: "768 px wide" },
14
- { value: "phone", label: "Phone", tip: "390 px wide" }
14
+ { value: "phone", label: "Phone", tip: "390 px wide" },
15
+ { value: "all", label: "All", tip: "Desktop, tablet and phone side by side" }
15
16
  ];
16
17
  function y(n, t) {
17
18
  var s;
18
- const r = (s = n.find((d) => d.field === t)) == null ? void 0 : s.label;
19
- return r != null && r.trim() ? r.trim() : V(t);
19
+ const a = (s = n.find((d) => d.field === t)) == null ? void 0 : s.label;
20
+ return a != null && a.trim() ? a.trim() : V(t);
20
21
  }
21
22
  function m({ title: n, children: t }) {
22
23
  return /* @__PURE__ */ o("div", { className: "mt-3 border-t border-slate-100 pt-3 dark:border-border", children: [
@@ -24,25 +25,25 @@ function m({ title: n, children: t }) {
24
25
  t
25
26
  ] });
26
27
  }
27
- function ae({
28
+ function re({
28
29
  collection: n,
29
30
  value: t,
30
- onChange: r,
31
+ onChange: a,
31
32
  layout: s,
32
33
  fields: d
33
34
  }) {
34
- const { data: D = [] } = X(!0), {
35
+ const { data: $ = [] } = X(!0), {
35
36
  data: x = [],
36
37
  isLoading: P,
37
38
  isError: T,
38
39
  refetch: E
39
- } = z(n, !0), h = M(() => s ? B(s) : [], [s]), [O, W] = I(""), [g, C] = I(""), i = h.find((e) => e.field === O) ?? h[0] ?? null, u = t.values ?? {}, k = (e, a) => r({ ...t, values: { ...u, [e]: a } }), F = (e) => {
40
- const { [e]: a, ...b } = u;
41
- r({ ...t, values: Object.keys(b).length > 0 ? b : null });
40
+ } = z(n, !0), h = M(() => s ? B(s) : [], [s]), [O, W] = I(""), [g, C] = I(""), i = h.find((e) => e.field === O) ?? h[0] ?? null, u = t.values ?? {}, k = (e, r) => a({ ...t, values: { ...u, [e]: r } }), F = (e) => {
41
+ const { [e]: r, ...b } = u;
42
+ a({ ...t, values: Object.keys(b).length > 0 ? b : null });
42
43
  }, w = x.flatMap(
43
- (e) => e.states.map((a) => ({
44
- value: `${e.id}::${a.id}`,
45
- label: x.length > 1 ? `${e.name} · ${a.label}` : a.label
44
+ (e) => e.states.map((r) => ({
45
+ value: `${e.id}::${r.id}`,
46
+ label: x.length > 1 ? `${e.name} · ${r.label}` : r.label
46
47
  }))
47
48
  );
48
49
  return /* @__PURE__ */ o("div", { "data-preview-modes": "", children: [
@@ -51,13 +52,13 @@ function ae({
51
52
  N,
52
53
  {
53
54
  value: t.compareRoleId ?? "",
54
- onChange: (e) => r({ ...t, compareRoleId: e || null }),
55
+ onChange: (e) => a({ ...t, compareRoleId: e || null }),
55
56
  ariaLabel: "Compare with role",
56
57
  disabled: !t.roleId,
57
58
  className: "h-8 text-[12.5px]",
58
59
  options: [
59
60
  { value: "", label: "No comparison" },
60
- ...D.filter((e) => e.id !== t.roleId).map((e) => ({ value: e.id, label: e.name }))
61
+ ...$.filter((e) => e.id !== t.roleId).map((e) => ({ value: e.id, label: e.name }))
61
62
  ]
62
63
  }
63
64
  ),
@@ -69,9 +70,9 @@ function ae({
69
70
  {
70
71
  value: t.state ? `${t.state.pipelineId}::${t.state.id}` : "",
71
72
  onChange: (e) => {
72
- if (!e) return r({ ...t, state: null });
73
- const [a, b] = e.split("::"), c = x.find((v) => v.id === a), f = c == null ? void 0 : c.states.find((v) => v.id === b);
74
- c && f && r({
73
+ if (!e) return a({ ...t, state: null });
74
+ const [r, b] = e.split("::"), c = x.find((v) => v.id === r), f = c == null ? void 0 : c.states.find((v) => v.id === b);
75
+ c && f && a({
75
76
  ...t,
76
77
  state: { pipelineId: c.id, id: f.id, key: f.key, label: f.label }
77
78
  });
@@ -107,7 +108,7 @@ function ae({
107
108
  "button",
108
109
  {
109
110
  type: "button",
110
- className: L,
111
+ className: D,
111
112
  onClick: () => k(i.field, e),
112
113
  children: e
113
114
  },
@@ -117,7 +118,7 @@ function ae({
117
118
  "button",
118
119
  {
119
120
  type: "button",
120
- className: L,
121
+ className: D,
121
122
  onClick: () => k(i.field, null),
122
123
  children: "Empty"
123
124
  }
@@ -153,7 +154,7 @@ function ae({
153
154
  }
154
155
  )
155
156
  ] }),
156
- Object.keys(u).length > 0 && /* @__PURE__ */ l("ul", { className: "mt-2 flex flex-wrap gap-1", children: Object.entries(u).map(([e, a]) => /* @__PURE__ */ o(
157
+ Object.keys(u).length > 0 && /* @__PURE__ */ l("ul", { className: "mt-2 flex flex-wrap gap-1", children: Object.entries(u).map(([e, r]) => /* @__PURE__ */ o(
157
158
  "li",
158
159
  {
159
160
  className: "inline-flex max-w-full items-center gap-1 rounded-full bg-nvr-cyan/10 px-2 py-0.5 text-[12px] text-slate-800 dark:text-foreground",
@@ -161,7 +162,7 @@ function ae({
161
162
  /* @__PURE__ */ o("span", { className: "truncate", children: [
162
163
  y(d, e),
163
164
  " = ",
164
- a == null || a === "" ? "empty" : String(a)
165
+ r == null || r === "" ? "empty" : String(r)
165
166
  ] }),
166
167
  /* @__PURE__ */ l(
167
168
  "button",
@@ -178,13 +179,13 @@ function ae({
178
179
  e
179
180
  )) })
180
181
  ] }) }),
181
- /* @__PURE__ */ l(m, { title: "Device", children: /* @__PURE__ */ l("div", { className: q($.length), children: $.map((e) => /* @__PURE__ */ l(
182
+ /* @__PURE__ */ l(m, { title: "Device", children: /* @__PURE__ */ l("div", { className: q(L.length), children: L.map((e) => /* @__PURE__ */ l(
182
183
  "button",
183
184
  {
184
185
  type: "button",
185
186
  "aria-pressed": (t.device ?? "desktop") === e.value,
186
187
  "data-tip": e.tip,
187
- onClick: () => r({ ...t, device: e.value }),
188
+ onClick: () => a({ ...t, device: e.value }),
188
189
  className: _((t.device ?? "desktop") === e.value),
189
190
  children: e.label
190
191
  },
@@ -199,7 +200,7 @@ function ae({
199
200
  role: "switch",
200
201
  "aria-checked": !!t.who,
201
202
  "aria-label": "Who sees each field",
202
- onClick: () => r({ ...t, who: !t.who }),
203
+ onClick: () => a({ ...t, who: !t.who }),
203
204
  className: j(
204
205
  "relative h-4 w-7 shrink-0 rounded-full transition-colors",
205
206
  t.who ? "bg-nvr-cyan" : "bg-slate-300 dark:bg-border"
@@ -219,6 +220,6 @@ function ae({
219
220
  ] });
220
221
  }
221
222
  export {
222
- ae as PreviewModes,
223
+ re as PreviewModes,
223
224
  y as fieldName
224
225
  };