@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,25 +1,43 @@
|
|
|
1
|
-
import { UNGROUPED_KEY as p } from "../../lib/layout-ops.js";
|
|
2
|
-
import { asObject as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
return !!
|
|
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
|
|
8
|
-
const
|
|
9
|
-
return
|
|
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
|
|
12
|
-
|
|
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(
|
|
17
|
-
return n
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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",
|
|
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
|
|
19
|
-
return
|
|
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
|
|
28
|
+
function re({
|
|
28
29
|
collection: n,
|
|
29
30
|
value: t,
|
|
30
|
-
onChange:
|
|
31
|
+
onChange: a,
|
|
31
32
|
layout: s,
|
|
32
33
|
fields: d
|
|
33
34
|
}) {
|
|
34
|
-
const { data:
|
|
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,
|
|
40
|
-
const { [e]:
|
|
41
|
-
|
|
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((
|
|
44
|
-
value: `${e.id}::${
|
|
45
|
-
label: x.length > 1 ? `${e.name} · ${
|
|
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) =>
|
|
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
|
-
|
|
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
|
|
73
|
-
const [
|
|
74
|
-
c && f &&
|
|
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:
|
|
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:
|
|
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,
|
|
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
|
-
|
|
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(
|
|
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: () =>
|
|
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: () =>
|
|
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
|
-
|
|
223
|
+
re as PreviewModes,
|
|
223
224
|
y as fieldName
|
|
224
225
|
};
|