@nivaro/react 0.3.34 → 0.3.36

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 (26) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +5 -4
  4. package/dist/shared/components/ItemEditForm.js +2009 -1996
  5. package/dist/shared/components/RecordReadView.js +88 -85
  6. package/dist/shared/components/item-edit/FieldAffordances.js +351 -307
  7. package/dist/shared/components/item-edit/FieldRow.js +453 -447
  8. package/dist/shared/components/item-edit/PersonalDefaultControl.js +228 -0
  9. package/dist/shared/components/item-edit/PersonalDefaultPill.js +9 -39
  10. package/dist/shared/components/item-edit/RecordLiveSync.js +115 -110
  11. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +27 -27
  12. package/dist/shared/components/item-edit/live-record-marks.js +13 -0
  13. package/dist/shared/components/item-edit/usePersonalDefaults.js +314 -230
  14. package/dist/shared/components/layout-editor/DesignNode.js +79 -78
  15. package/dist/shared/components/layout-editor/EditorCanvas.js +25 -17
  16. package/dist/shared/components/layout-editor/EditorTopBar.js +230 -188
  17. package/dist/shared/components/layout-editor/LayoutEditor.js +370 -369
  18. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +218 -182
  19. package/dist/shared/components/layout-editor/dnd/TrashZone.js +68 -0
  20. package/dist/shared/components/layout-editor/dnd/rail-drop.js +4 -4
  21. package/dist/shared/components/layout-editor/dnd/trash-drop.js +52 -0
  22. package/dist/shared/components/layout-editor/inspector/kit.js +1 -1
  23. package/dist/shared/components/layout-editor/panel-frame.js +1 -1
  24. package/dist/shared/components/layout-editor/personal-default-marks.js +40 -0
  25. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +2 -2
  26. package/package.json +1 -1
@@ -1,19 +1,19 @@
1
- import { jsx as i, Fragment as S, jsxs as m } from "react/jsx-runtime";
2
- import { EyeOff as xe, Lock as ye, Pin as Ne } from "lucide-react";
3
- import { isValidElement as re, Fragment as _e, cloneElement as De } from "react";
4
- import { cn as f, formatRelative as we } from "../../lib/utils.js";
5
- import { useLayoutDesign as oe, targetKey as Ce, isSelectedIn as $e } from "./design-context.js";
6
- import { useDesignDndNode as Te, NO_DND as Re, useDesignDropBody as ze } from "./dnd/node.js";
7
- import { ResizeHandle as je } from "./grid-guides.js";
8
- import { NoteMarker as Fe } from "./NoteMarker.js";
9
- import { FillChip as Me } from "./usage/FillChip.js";
1
+ import { jsx as o, Fragment as S, jsxs as m } from "react/jsx-runtime";
2
+ import { EyeOff as xe, Lock as ye, Pin as Ne, UserRound as _e } from "lucide-react";
3
+ import { isValidElement as re, Fragment as De, cloneElement as we } from "react";
4
+ import { cn as f, formatRelative as Ce } from "../../lib/utils.js";
5
+ import { useLayoutDesign as oe, targetKey as $e, isSelectedIn as Te } from "./design-context.js";
6
+ import { useDesignDndNode as Re, NO_DND as ze, useDesignDropBody as je } from "./dnd/node.js";
7
+ import { ResizeHandle as Fe } from "./grid-guides.js";
8
+ import { NoteMarker as Me } from "./NoteMarker.js";
9
+ import { FillChip as Ae } from "./usage/FillChip.js";
10
10
  const te = (e, a) => {
11
11
  typeof e == "function" ? e(a) : e && typeof e == "object" && (e.current = a);
12
12
  };
13
13
  function ne(...e) {
14
14
  const a = {};
15
- for (const o of e)
16
- for (const [r, d] of Object.entries(o)) {
15
+ for (const i of e)
16
+ for (const [r, d] of Object.entries(i)) {
17
17
  const c = a[r];
18
18
  d !== void 0 && (c === void 0 ? a[r] = d : r === "className" ? a[r] = `${c} ${d}` : r === "style" ? a[r] = { ...c, ...d } : r === "ref" ? a[r] = (n) => {
19
19
  te(c, n), te(d, n);
@@ -23,43 +23,43 @@ function ne(...e) {
23
23
  }
24
24
  return a;
25
25
  }
26
- const Ae = {
26
+ const Ie = {
27
27
  violet: "bg-violet-50 text-violet-800 ring-violet-200 dark:bg-violet-500/15 dark:text-violet-200 dark:ring-violet-500/30",
28
28
  emerald: "bg-emerald-50 text-emerald-800 ring-emerald-200 dark:bg-emerald-500/15 dark:text-emerald-200 dark:ring-emerald-500/30",
29
29
  amber: "bg-amber-50 text-amber-800 ring-amber-200 dark:bg-amber-500/15 dark:text-amber-200 dark:ring-amber-500/30",
30
30
  slate: "bg-slate-100 text-slate-700 ring-slate-200 dark:bg-slate-800 dark:text-slate-200 dark:ring-slate-700"
31
- }, Ie = "inline-block max-w-[260px] truncate rounded px-1 text-left text-[11px] ring-1", Oe = [
31
+ }, Oe = "inline-block max-w-[260px] truncate rounded px-1 text-left text-[11px] ring-1", Ee = [
32
32
  "data-[rule-dependent]:outline-dashed data-[rule-dependent]:outline-2 data-[rule-dependent]:outline-amber-400 dark:data-[rule-dependent]:outline-amber-400/80",
33
33
  "data-[rule-drives]:after:pointer-events-none data-[rule-drives]:after:absolute data-[rule-drives]:after:-bottom-2 data-[rule-drives]:after:right-1 data-[rule-drives]:after:z-10 data-[rule-drives]:after:rounded data-[rule-drives]:after:bg-amber-50 data-[rule-drives]:after:px-1 data-[rule-drives]:after:text-[11px] data-[rule-drives]:after:text-amber-800 data-[rule-drives]:after:ring-1 data-[rule-drives]:after:ring-amber-200 data-[rule-drives]:after:content-[attr(data-rule-drives)] dark:data-[rule-drives]:after:bg-[#413727] dark:data-[rule-drives]:after:text-amber-200 dark:data-[rule-drives]:after:ring-amber-500/30"
34
34
  ].join(" "), ie = {
35
35
  before: { top: -5, left: 0, right: 0, height: 3 },
36
36
  after: { bottom: -5, left: 0, right: 0, height: 3 }
37
37
  };
38
- function Ee({
38
+ function Ke({
39
39
  target: e,
40
40
  children: a,
41
- inline: o,
41
+ inline: i,
42
42
  asChild: r,
43
43
  pass: d,
44
44
  ...c
45
45
  }) {
46
46
  var G, H, U, V, Z, X, q, J, Q, Y;
47
- const n = oe(), g = (n == null ? void 0 : n.inheritedFrom(e)) ?? null, se = c["data-design-copy"] !== void 0, le = c["data-header-folded"] !== void 0, l = ((G = n == null ? void 0 : n.diffMark) == null ? void 0 : G.call(n, e)) ?? null, _ = (l == null ? void 0 : l.kind) === "removed", v = !n || !!g || se || _, D = Te((n == null ? void 0 : n.dnd) ?? Re, e, { disabled: v, noDrop: le });
48
- if (!n) return /* @__PURE__ */ i(S, { children: a });
49
- const ce = Ce(e), w = $e(n, e), s = ((H = n.roleMark) == null ? void 0 : H.call(n, e)) ?? null, R = ((U = n.marks) == null ? void 0 : U.call(n, e)) ?? [], b = ((V = n.overlay) == null ? void 0 : V.call(n, e)) ?? null, L = ((Z = n.unsaved) == null ? void 0 : Z.call(n, e)) ?? !1, k = ((X = n.peers) == null ? void 0 : X.call(n, e)) ?? [], ue = R.some((t) => t.highlight), B = ((q = n.note) == null ? void 0 : q.call(n, e)) ?? null, z = B ? /* @__PURE__ */ i(Fe, { note: B }) : null, j = v ? {} : D.props, pe = D.dragging, C = v ? null : D.slot, p = r && re(a) ? a : null, ge = (p == null ? void 0 : p.props.className) ?? "", me = /(^|\s)(absolute|fixed|sticky|relative)(\s|$)/.test(ge), he = f(
47
+ const n = oe(), g = (n == null ? void 0 : n.inheritedFrom(e)) ?? null, se = c["data-design-copy"] !== void 0, le = c["data-header-folded"] !== void 0, l = ((G = n == null ? void 0 : n.diffMark) == null ? void 0 : G.call(n, e)) ?? null, _ = (l == null ? void 0 : l.kind) === "removed", v = !n || !!g || se || _, D = Re((n == null ? void 0 : n.dnd) ?? ze, e, { disabled: v, noDrop: le });
48
+ if (!n) return /* @__PURE__ */ o(S, { children: a });
49
+ const ce = $e(e), w = Te(n, e), s = ((H = n.roleMark) == null ? void 0 : H.call(n, e)) ?? null, R = ((U = n.marks) == null ? void 0 : U.call(n, e)) ?? [], b = ((V = n.overlay) == null ? void 0 : V.call(n, e)) ?? null, L = ((Z = n.unsaved) == null ? void 0 : Z.call(n, e)) ?? !1, k = ((X = n.peers) == null ? void 0 : X.call(n, e)) ?? [], ue = R.some((t) => t.highlight), B = ((q = n.note) == null ? void 0 : q.call(n, e)) ?? null, z = B ? /* @__PURE__ */ o(Me, { note: B }) : null, j = v ? {} : D.props, pe = D.dragging, C = v ? null : D.slot, p = r && re(a) ? a : null, ge = (p == null ? void 0 : p.props.className) ?? "", me = /(^|\s)(absolute|fixed|sticky|relative)(\s|$)/.test(ge), he = f(
50
50
  !me && "relative",
51
51
  "cursor-pointer rounded-md outline-offset-2",
52
- !p && (o ? "inline-block" : "block"),
52
+ !p && (i ? "inline-block" : "block"),
53
53
  w ? "outline outline-2 outline-nvr-cyan" : k.length > 0 ? `outline outline-2 ${k[0].outline}` : ue ? "outline-dashed outline-2 outline-violet-400 dark:outline-violet-400/70" : "hover:outline hover:outline-1 hover:outline-slate-300 dark:hover:outline-slate-600",
54
54
  b == null ? void 0 : b.className,
55
55
  "focus-visible:outline focus-visible:outline-2 focus-visible:outline-nvr-cyan",
56
- Oe,
56
+ Ee,
57
57
  // The section's "Changed by" shows while the pointer is over it.
58
58
  "[&:hover>[data-design-last-change]]:visible",
59
59
  pe && "opacity-40",
60
60
  // Hidden for the previewed role: faint, its tags not.
61
61
  (s == null ? void 0 : s.kind) === "hidden" && "[&>:not([data-design-badges])]:opacity-40",
62
- l && Ge[l.kind],
62
+ l && He[l.kind],
63
63
  _ && "cursor-default [&>:not([data-design-badges])]:opacity-40"
64
64
  ), fe = (t) => {
65
65
  const u = t.target;
@@ -88,7 +88,7 @@ function Ee({
88
88
  className: he,
89
89
  onClickCapture: fe,
90
90
  onKeyDown: be
91
- }, ke = (s == null ? void 0 : s.kind) === "hidden" ? xe : ye, M = e.kind === "field" || e.kind === "header" ? ((Q = n.fillRate) == null ? void 0 : Q.call(n, e.field)) ?? null : null, y = e.kind === "group" && !x ? ((Y = n.lastChange) == null ? void 0 : Y.call(n, e)) ?? null : null, P = y && [y.by ? `by ${y.by}` : null, y.at ? we(y.at) : null].filter(Boolean).join(" · ") || null, A = P && !l ? /* @__PURE__ */ m(
91
+ }, ke = (s == null ? void 0 : s.kind) === "hidden" ? xe : ye, M = e.kind === "field" || e.kind === "header" ? ((Q = n.fillRate) == null ? void 0 : Q.call(n, e.field)) ?? null : null, y = e.kind === "group" && !x ? ((Y = n.lastChange) == null ? void 0 : Y.call(n, e)) ?? null : null, P = y && [y.by ? `by ${y.by}` : null, y.at ? Ce(y.at) : null].filter(Boolean).join(" · ") || null, A = P && !l ? /* @__PURE__ */ m(
92
92
  "span",
93
93
  {
94
94
  "data-design-last-change": "",
@@ -102,7 +102,7 @@ function Ee({
102
102
  ]
103
103
  }
104
104
  ) : null, h = [];
105
- l && h.push({ rank: 0, text: We(l), node: /* @__PURE__ */ i(ae, { diff: l }) }), s && h.push({
105
+ l && h.push({ rank: 0, text: Ge(l), node: /* @__PURE__ */ o(ae, { diff: l }) }), s && h.push({
106
106
  rank: 1,
107
107
  text: `${s.kind === "hidden" ? "Hidden" : "Read-only"} for ${s.role}`,
108
108
  node: /* @__PURE__ */ m(
@@ -111,7 +111,7 @@ function Ee({
111
111
  "data-design-role-tag": s.kind,
112
112
  className: "inline-flex items-center gap-0.5 rounded bg-amber-50 px-1 text-[11px] text-amber-800 ring-1 ring-amber-200 dark:bg-amber-500/15 dark:text-amber-200 dark:ring-amber-500/30",
113
113
  children: [
114
- /* @__PURE__ */ i(ke, { "aria-hidden": !0, className: "h-3 w-3" }),
114
+ /* @__PURE__ */ o(ke, { "aria-hidden": !0, className: "h-3 w-3" }),
115
115
  s.kind === "hidden" ? "Hidden" : "Read-only",
116
116
  " for ",
117
117
  s.role
@@ -121,22 +121,23 @@ function Ee({
121
121
  }), b && h.push({
122
122
  rank: 1,
123
123
  text: "Who sees it",
124
- node: /* @__PURE__ */ i("span", { "data-design-pass": "", className: "pointer-events-auto", children: b.chip })
124
+ node: /* @__PURE__ */ o("span", { "data-design-pass": "", className: "pointer-events-auto", children: b.chip })
125
125
  }), R.forEach((t, u) => {
126
126
  const N = f(
127
- Ie,
127
+ Oe,
128
128
  t.icon && "inline-flex items-center gap-0.5",
129
129
  t.onClick || t.tip ? "pointer-events-auto" : null,
130
130
  t.onClick && "hover:brightness-95",
131
- Ae[t.tone]
131
+ Ie[t.tone]
132
132
  ), ee = /* @__PURE__ */ m(S, { children: [
133
- t.icon === "pin" && /* @__PURE__ */ i(Ne, { "aria-hidden": !0, className: "h-3 w-3" }),
133
+ t.icon === "pin" && /* @__PURE__ */ o(Ne, { "aria-hidden": !0, className: "h-3 w-3" }),
134
+ t.icon === "person" && /* @__PURE__ */ o(_e, { "aria-hidden": !0, className: "h-3 w-3" }),
134
135
  t.text
135
136
  ] });
136
137
  h.push({
137
- rank: Le(t),
138
+ rank: Be(t),
138
139
  text: t.text,
139
- node: t.onClick ? /* @__PURE__ */ i(
140
+ node: t.onClick ? /* @__PURE__ */ o(
140
141
  "button",
141
142
  {
142
143
  type: "button",
@@ -148,7 +149,7 @@ function Ee({
148
149
  children: ee
149
150
  },
150
151
  `${u}:${t.text}`
151
- ) : /* @__PURE__ */ i(
152
+ ) : /* @__PURE__ */ o(
152
153
  "span",
153
154
  {
154
155
  "data-design-mark": "",
@@ -167,9 +168,9 @@ function Ee({
167
168
  g
168
169
  ] })
169
170
  });
170
- const { shown: ve, rest: $ } = Be(h), W = R.length > 0 || b != null || k.length > 0, T = x && !l ? [...h.map((t) => t.text), ...k.map((t) => t.name)] : [];
171
+ const { shown: ve, rest: $ } = Pe(h), W = R.length > 0 || b != null || k.length > 0, T = x && !l ? [...h.map((t) => t.text), ...k.map((t) => t.name)] : [];
171
172
  T.length > 0 && (F["data-tip"] = g && !s && !W ? `From ${g}` : T.join(" · "));
172
- const I = x && l ? /* @__PURE__ */ i("span", { "data-design-badges": "", className: "pointer-events-none absolute -top-2 right-0 z-10", children: /* @__PURE__ */ i(ae, { diff: l }) }) : T.length > 0 ? /* @__PURE__ */ i(
173
+ const I = x && l ? /* @__PURE__ */ o("span", { "data-design-badges": "", className: "pointer-events-none absolute -top-2 right-0 z-10", children: /* @__PURE__ */ o(ae, { diff: l }) }) : T.length > 0 ? /* @__PURE__ */ o(
173
174
  "span",
174
175
  {
175
176
  "data-design-badges": "",
@@ -177,7 +178,7 @@ function Ee({
177
178
  "pointer-events-none absolute left-1/2 top-1 z-10 h-1.5 w-1.5 -translate-x-1/2 rounded-full",
178
179
  g && !s && !W ? "bg-slate-500 dark:bg-slate-400" : "bg-violet-500 dark:bg-violet-400"
179
180
  ),
180
- children: /* @__PURE__ */ i("span", { className: "sr-only", children: T.join(" · ") })
181
+ children: /* @__PURE__ */ o("span", { className: "sr-only", children: T.join(" · ") })
181
182
  }
182
183
  ) : h.length > 0 || k.length > 0 || M != null ? /* @__PURE__ */ m(
183
184
  "span",
@@ -185,10 +186,10 @@ function Ee({
185
186
  "data-design-badges": "",
186
187
  className: "pointer-events-none absolute -top-2 right-1 z-10 flex items-center gap-1",
187
188
  children: [
188
- M != null && /* @__PURE__ */ i(Me, { pct: M }),
189
+ M != null && /* @__PURE__ */ o(Ae, { pct: M }),
189
190
  ve.map((t, u) => (
190
191
  // biome-ignore lint/suspicious/noArrayIndexKey: ranked tags of one node, rebuilt each render
191
- /* @__PURE__ */ i(_e, { children: t.node }, u)
192
+ /* @__PURE__ */ o(De, { children: t.node }, u)
192
193
  )),
193
194
  $.length > 0 && /* @__PURE__ */ m(
194
195
  "span",
@@ -202,7 +203,7 @@ function Ee({
202
203
  ]
203
204
  }
204
205
  ),
205
- k.map((t) => /* @__PURE__ */ i(
206
+ k.map((t) => /* @__PURE__ */ o(
206
207
  "span",
207
208
  {
208
209
  "data-design-peer": t.id,
@@ -211,13 +212,13 @@ function Ee({
211
212
  "pointer-events-auto inline-flex h-4 w-4 items-center justify-center rounded-full text-[9px] font-semibold ring-1",
212
213
  t.chip
213
214
  ),
214
- children: Pe(t.name)
215
+ children: We(t.name)
215
216
  },
216
217
  t.id
217
218
  ))
218
219
  ]
219
220
  }
220
- ) : null, O = L ? /* @__PURE__ */ i(
221
+ ) : null, O = L ? /* @__PURE__ */ o(
221
222
  "span",
222
223
  {
223
224
  "data-unsaved-dot": "",
@@ -226,9 +227,9 @@ function Ee({
226
227
  // A step clips its corners away: the dot sits inside, before the arrow.
227
228
  x ? "right-4 top-1" : "-left-1 -top-1"
228
229
  ),
229
- children: /* @__PURE__ */ i("span", { className: "sr-only", children: "unsaved change" })
230
+ children: /* @__PURE__ */ o("span", { className: "sr-only", children: "unsaved change" })
230
231
  }
231
- ) : null, E = C ? /* @__PURE__ */ i(
232
+ ) : null, E = C ? /* @__PURE__ */ o(
232
233
  "span",
233
234
  {
234
235
  "aria-hidden": !0,
@@ -236,13 +237,13 @@ function Ee({
236
237
  className: "pointer-events-none absolute z-30 rounded-full bg-nvr-cyan shadow-[0_0_0_2px_#fff] dark:shadow-[0_0_0_2px_#0f172a]",
237
238
  style: D.indicator ?? ie[C]
238
239
  }
239
- ) : null, K = w && !v && n.resizeWidth && (e.kind === "field" || e.kind === "slot") && e.group_key !== null ? /* @__PURE__ */ i(je, { onCommit: (t) => {
240
+ ) : null, K = w && !v && n.resizeWidth && (e.kind === "field" || e.kind === "slot") && e.group_key !== null ? /* @__PURE__ */ o(Fe, { onCommit: (t) => {
240
241
  var u;
241
242
  return (u = n.resizeWidth) == null ? void 0 : u.call(n, e, t);
242
243
  } }) : null;
243
244
  if (p) {
244
245
  const { children: t, ...u } = p.props;
245
- return De(
246
+ return we(
246
247
  p,
247
248
  // The child's own classes, style, ref and handlers are kept and merged.
248
249
  ne(u, c, j, F),
@@ -257,7 +258,7 @@ function Ee({
257
258
  ] }) : t
258
259
  );
259
260
  }
260
- return /* @__PURE__ */ m(o ? "span" : "div", { ...ne(c, j, F), children: [
261
+ return /* @__PURE__ */ m(i ? "span" : "div", { ...ne(c, j, F), children: [
261
262
  O,
262
263
  I,
263
264
  A,
@@ -267,32 +268,32 @@ function Ee({
267
268
  a
268
269
  ] });
269
270
  }
270
- function Ke(e, a, o, r = {}) {
271
- if (!e || o == null || o === !1) return o;
272
- const d = re(o) ? o.key ?? void 0 : void 0;
273
- return /* @__PURE__ */ i(Ee, { target: a, ...r, children: o }, d);
271
+ function Se(e, a, i, r = {}) {
272
+ if (!e || i == null || i === !1) return i;
273
+ const d = re(i) ? i.key ?? void 0 : void 0;
274
+ return /* @__PURE__ */ o(Ke, { target: a, ...r, children: i }, d);
274
275
  }
275
- function tt() {
276
+ function nt() {
276
277
  const e = oe();
277
- return (a, o, r) => Ke(e, a, o, r);
278
+ return (a, i, r) => Se(e, a, i, r);
278
279
  }
279
- function nt({ groupKey: e }) {
280
- const { ref: a, slot: o, indicator: r } = ze(e);
281
- return /* @__PURE__ */ i(
280
+ function at({ groupKey: e }) {
281
+ const { ref: a, slot: i, indicator: r } = je(e);
282
+ return /* @__PURE__ */ o(
282
283
  "span",
283
284
  {
284
285
  ref: a,
285
286
  "aria-hidden": !0,
286
- hidden: !o,
287
+ hidden: !i,
287
288
  "data-design-drop-body": e,
288
- "data-design-drop-indicator": o ?? void 0,
289
+ "data-design-drop-indicator": i ?? void 0,
289
290
  className: "pointer-events-none absolute z-30 rounded-full bg-nvr-cyan shadow-[0_0_0_2px_#fff] dark:shadow-[0_0_0_2px_#0f172a]",
290
- style: o ? r ?? ie[o] : void 0
291
+ style: i ? r ?? ie[i] : void 0
291
292
  }
292
293
  );
293
294
  }
294
- function at() {
295
- return /* @__PURE__ */ i(
295
+ function rt() {
296
+ return /* @__PURE__ */ o(
296
297
  "div",
297
298
  {
298
299
  "data-design-drop-zone": "",
@@ -301,25 +302,25 @@ function at() {
301
302
  }
302
303
  );
303
304
  }
304
- const Se = 2;
305
- function Le(e) {
306
- return e.kind === "preview" ? 1 : e.kind === "ai" ? 4 : e.kind === "loop" || e.highlight ? 2 : 3;
305
+ const Le = 2;
306
+ function Be(e) {
307
+ return e.kind === "preview" ? 1 : e.kind === "ai" ? 4 : e.kind === "loop" || e.kind === "personal" || e.highlight ? 2 : 3;
307
308
  }
308
- function Be(e, a = Se) {
309
- const o = e.map((r, d) => ({ c: r, i: d })).sort((r, d) => r.c.rank - d.c.rank || r.i - d.i).map((r) => r.c);
310
- return { shown: o.slice(0, a), rest: o.slice(a) };
309
+ function Pe(e, a = Le) {
310
+ const i = e.map((r, d) => ({ c: r, i: d })).sort((r, d) => r.c.rank - d.c.rank || r.i - d.i).map((r) => r.c);
311
+ return { shown: i.slice(0, a), rest: i.slice(a) };
311
312
  }
312
- function Pe(e) {
313
- return e.trim().split(/\s+/).filter(Boolean).slice(0, 2).map((o) => {
313
+ function We(e) {
314
+ return e.trim().split(/\s+/).filter(Boolean).slice(0, 2).map((i) => {
314
315
  var r;
315
- return ((r = o[0]) == null ? void 0 : r.toUpperCase()) ?? "";
316
+ return ((r = i[0]) == null ? void 0 : r.toUpperCase()) ?? "";
316
317
  }).join("") || "?";
317
318
  }
318
- function We(e) {
319
+ function Ge(e) {
319
320
  const a = de[e.kind].text;
320
321
  return e.kind === "moved" && e.detail ? `Moved ${e.detail}` : e.kind === "changed" && e.detail ? `${a}: ${e.detail}` : a;
321
322
  }
322
- const Ge = {
323
+ const He = {
323
324
  added: "ring-2 ring-emerald-500/70 dark:ring-emerald-400/60",
324
325
  moved: "ring-2 ring-amber-500/70 dark:ring-amber-400/60",
325
326
  changed: "ring-1 ring-violet-500/60 dark:ring-violet-400/50",
@@ -351,18 +352,18 @@ function ae({ diff: e }) {
351
352
  className: f("inline-flex items-center rounded px-1 text-[11px] ring-1", a.cls),
352
353
  children: [
353
354
  e.kind === "moved" && e.detail ? `Moved ${e.detail}` : a.text,
354
- e.kind === "changed" && e.detail && /* @__PURE__ */ i("span", { className: "ml-1 max-w-[160px] truncate opacity-80", children: e.detail })
355
+ e.kind === "changed" && e.detail && /* @__PURE__ */ o("span", { className: "ml-1 max-w-[160px] truncate opacity-80", children: e.detail })
355
356
  ]
356
357
  }
357
358
  );
358
359
  }
359
360
  export {
360
- nt as DesignDropBody,
361
- at as DesignDropZone,
362
- Ee as DesignNode,
363
- Se as MAX_NODE_TAGS,
364
- Ke as designWrap,
365
- Le as markRank,
366
- Be as rankChips,
367
- tt as useDesignWrap
361
+ at as DesignDropBody,
362
+ rt as DesignDropZone,
363
+ Ke as DesignNode,
364
+ Le as MAX_NODE_TAGS,
365
+ Se as designWrap,
366
+ Be as markRank,
367
+ Pe as rankChips,
368
+ nt as useDesignWrap
368
369
  };
@@ -1,6 +1,6 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { useMemo as p } from "react";
3
- import { ItemEditForm as x } from "../ItemEditForm.js";
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { useMemo as x } from "react";
3
+ import { ItemEditForm as p } from "../ItemEditForm.js";
4
4
  import { PlacementTextContext as h } from "../item-edit/placement-behaviour.js";
5
5
  import { RecordReadView as C } from "../RecordReadView.js";
6
6
  import { PdfCanvas as P } from "./canvases/PdfCanvas.js";
@@ -21,34 +21,42 @@ function T(e) {
21
21
  }
22
22
  }
23
23
  function F(e) {
24
- const { data: t = [] } = s(e.collection);
25
- return /* @__PURE__ */ r(w, { ...e, fields: t });
24
+ const { data: r = [] } = s(e.collection);
25
+ return /* @__PURE__ */ t(w, { ...e, fields: r });
26
26
  }
27
27
  function b(e) {
28
- const { data: t = [] } = s(e.collection);
29
- return /* @__PURE__ */ r(P, { ...e, fields: t });
28
+ const { data: r = [] } = s(e.collection);
29
+ return /* @__PURE__ */ t(P, { ...e, fields: r });
30
30
  }
31
31
  function N({
32
32
  collection: e,
33
- bundle: t,
33
+ bundle: r,
34
34
  layout: l,
35
- record: d,
35
+ record: m,
36
36
  stateKey: n = null,
37
- roleId: m = null,
38
- design: o,
37
+ roleId: d = null,
38
+ design: a,
39
39
  apply: c,
40
40
  whenIdle: u
41
41
  }) {
42
- const a = T(String(t.layout.layout_type ?? "grouped")), v = p(() => ({ stateKey: n, roleId: m }), [n, m]);
43
- let i;
44
- return a === "item-edit-form" ? i = /* @__PURE__ */ r(
45
- x,
42
+ const i = T(String(r.layout.layout_type ?? "grouped")), v = x(() => ({ stateKey: n, roleId: d }), [n, d]);
43
+ let o;
44
+ return i === "item-edit-form" ? o = /* @__PURE__ */ t(
45
+ p,
46
46
  {
47
47
  collection: e,
48
48
  documentTitle: !1,
49
- design: { layout: l, record: d, context: o, stateKey: n }
49
+ design: { layout: l, record: m, context: a, stateKey: n }
50
50
  }
51
- ) : a === "read-view" ? i = /* @__PURE__ */ r(C, { collection: e, design: { layout: l, record: d, context: o } }) : a === "pdf" ? i = /* @__PURE__ */ r(f.Provider, { value: o, children: /* @__PURE__ */ r(b, { bundle: t, collection: e, whenIdle: u }) }) : i = /* @__PURE__ */ r(f.Provider, { value: o, children: /* @__PURE__ */ r(F, { bundle: t, apply: c, collection: e }) }), /* @__PURE__ */ r("div", { "data-editor-canvas": "", "data-renderer": a, className: "flex min-h-full flex-col", children: /* @__PURE__ */ r(h.Provider, { value: v, children: i }) });
51
+ ) : i === "read-view" ? o = /* @__PURE__ */ t(C, { collection: e, design: { layout: l, record: m, context: a } }) : i === "pdf" ? o = /* @__PURE__ */ t(f.Provider, { value: a, children: /* @__PURE__ */ t(b, { bundle: r, collection: e, whenIdle: u }) }) : o = /* @__PURE__ */ t(f.Provider, { value: a, children: /* @__PURE__ */ t(F, { bundle: r, apply: c, collection: e }) }), /* @__PURE__ */ t(
52
+ "div",
53
+ {
54
+ "data-editor-canvas": "",
55
+ "data-renderer": i,
56
+ className: i === "item-edit-form" ? "flex min-h-0 flex-1 flex-col" : "flex flex-1 flex-col",
57
+ children: /* @__PURE__ */ t(h.Provider, { value: v, children: o })
58
+ }
59
+ );
52
60
  }
53
61
  export {
54
62
  N as EditorCanvas,