@nivaro/react 0.2.54 → 0.2.55

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 (150) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +339 -2
  4. package/dist/index.js +644 -618
  5. package/dist/layout-editor.d.ts +4 -0
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/ItemEditForm.js +4066 -3832
  10. package/dist/shared/components/JobsTray.js +100 -55
  11. package/dist/shared/components/MyWorkView.js +91 -89
  12. package/dist/shared/components/NotificationBell.js +80 -79
  13. package/dist/shared/components/ProfileView.js +568 -520
  14. package/dist/shared/components/RecordCompare.js +254 -0
  15. package/dist/shared/components/RecordReadView.js +599 -552
  16. package/dist/shared/components/ReportView.js +578 -543
  17. package/dist/shared/components/RowPresence.js +91 -0
  18. package/dist/shared/components/WidgetSlot.js +474 -458
  19. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  20. package/dist/shared/components/ai/AskPanel.js +139 -119
  21. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  22. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  23. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  24. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  25. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  26. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  27. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  28. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  29. package/dist/shared/components/chat/Composer.js +357 -303
  30. package/dist/shared/components/chat/MessageActions.js +92 -0
  31. package/dist/shared/components/chat/MessageFormat.js +290 -264
  32. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  33. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  34. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  35. package/dist/shared/components/chat/RoomParts.js +213 -274
  36. package/dist/shared/components/chat/ScreenClip.js +184 -0
  37. package/dist/shared/components/chat/chat-core.js +402 -483
  38. package/dist/shared/components/chat/chat-drafts.js +59 -0
  39. package/dist/shared/components/chat/chat-emoji.js +348 -0
  40. package/dist/shared/components/chat/chat-local-time.js +41 -0
  41. package/dist/shared/components/chat/chat-outbox.js +303 -0
  42. package/dist/shared/components/chat/chat-window.js +163 -0
  43. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  44. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  45. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  46. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  47. package/dist/shared/components/help-videos/api.js +76 -73
  48. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  49. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  50. package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
  51. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  52. package/dist/shared/components/item-edit/FieldRow.js +292 -279
  53. package/dist/shared/components/item-edit/GroupSection.js +698 -574
  54. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  55. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  56. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  57. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  58. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  59. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  60. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  61. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  62. package/dist/shared/components/item-edit/lock-why.js +39 -32
  63. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  64. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  65. package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
  66. package/dist/shared/components/layout-editor/AddPanel.js +134 -117
  67. package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
  68. package/dist/shared/components/layout-editor/CollabParts.js +80 -75
  69. package/dist/shared/components/layout-editor/DesignNode.js +126 -120
  70. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
  71. package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
  72. package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
  73. package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
  74. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  75. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  76. package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
  77. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
  78. package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
  79. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
  80. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  81. package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
  82. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  83. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  84. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  85. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  86. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  87. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  88. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  89. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
  90. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
  91. package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
  92. package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
  93. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  94. package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
  95. package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
  96. package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
  97. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  98. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  99. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  100. package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
  101. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  102. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  103. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  104. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  105. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  106. package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
  107. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  108. package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
  109. package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
  110. package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
  111. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  112. package/dist/shared/components/layout-editor/structure-ops.js +81 -77
  113. package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
  114. package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
  115. package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
  116. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  117. package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
  118. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  119. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  120. package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
  121. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  122. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  123. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  124. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  125. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  126. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  127. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  128. package/dist/shared/components/support/SupportView.js +75 -73
  129. package/dist/shared/lib/background-runs.js +150 -0
  130. package/dist/shared/lib/delivery-ack.js +9 -0
  131. package/dist/shared/lib/entry-badge-style.js +13 -0
  132. package/dist/shared/lib/entry-config.js +71 -0
  133. package/dist/shared/lib/form-sections.js +64 -0
  134. package/dist/shared/lib/form-structure.js +99 -0
  135. package/dist/shared/lib/form-usage-beacon.js +101 -52
  136. package/dist/shared/lib/jobs-tray.js +25 -23
  137. package/dist/shared/lib/keyset-pager.js +37 -0
  138. package/dist/shared/lib/layout-ops.js +84 -82
  139. package/dist/shared/lib/layout-resolve.js +113 -0
  140. package/dist/shared/lib/placement-behaviour.js +144 -0
  141. package/dist/shared/lib/prefetch.js +149 -0
  142. package/dist/shared/lib/presence-hooks.js +199 -0
  143. package/dist/shared/lib/record-outbox.js +82 -81
  144. package/dist/shared/lib/replay-socket.js +93 -0
  145. package/dist/shared/lib/request-gate.js +51 -50
  146. package/dist/shared/lib/room-gaps.js +96 -0
  147. package/dist/shared/lib/search-log.js +27 -0
  148. package/dist/shared/lib/socket-realtime.js +101 -80
  149. package/dist/shared/lib/worker-socket.js +200 -0
  150. package/package.json +1 -1
@@ -1,61 +1,131 @@
1
- import { useState as y, useRef as b, useEffect as R, useCallback as w } from "react";
2
- const k = "nvr:layout-draft:", u = (e, n) => `${k}${n.toLowerCase()}:${e}`;
3
- function D(e) {
4
- const n = e;
5
- return !!n && typeof n.label == "string" && Array.isArray(n.ops);
1
+ import { useState as C, useRef as h, useCallback as y, useEffect as D } from "react";
2
+ const F = "nvr:layout-draft:", k = (e, t) => `${F}${t.toLowerCase()}:${e}`, J = 1200;
3
+ function q(e) {
4
+ const t = e;
5
+ return !!t && typeof t.label == "string" && Array.isArray(t.ops);
6
6
  }
7
- function $(e, n) {
7
+ function G(e, t) {
8
8
  try {
9
- const r = window.localStorage.getItem(u(e, n));
9
+ const r = window.localStorage.getItem(k(e, t));
10
10
  if (!r) return null;
11
- const t = JSON.parse(r);
12
- return (t == null ? void 0 : t.v) !== 1 || t.layoutId !== e || typeof t.baseRev != "string" || !Array.isArray(t.steps) || t.steps.length === 0 || !t.steps.every(D) ? null : t;
11
+ const n = JSON.parse(r);
12
+ return (n == null ? void 0 : n.v) !== 1 || n.layoutId !== e || typeof n.baseRev != "string" || !Array.isArray(n.steps) || n.steps.length === 0 || !n.steps.every(q) ? null : n;
13
13
  } catch {
14
14
  return null;
15
15
  }
16
16
  }
17
- function A(e) {
17
+ function L(e) {
18
18
  try {
19
- window.localStorage.setItem(u(e.layoutId, e.userId), JSON.stringify(e));
19
+ window.localStorage.setItem(k(e.layoutId, e.userId), JSON.stringify(e));
20
20
  } catch {
21
21
  }
22
22
  }
23
- function f(e, n) {
23
+ function E(e, t) {
24
24
  try {
25
- window.localStorage.removeItem(u(e, n));
25
+ window.localStorage.removeItem(k(e, t));
26
26
  } catch {
27
27
  }
28
28
  }
29
- function C(e, n, r) {
30
- var S;
31
- const [t, c] = y(null), a = b(null), l = b(!1), s = r ? `${r}:${n}` : null, p = ((S = e.bundle) == null ? void 0 : S.rev) ?? null;
32
- R(() => {
33
- if (!s || !r || !p || a.current === s || (a.current = s, l.current = !1, c(null), e.unsavedSteps.length > 0)) return;
34
- const o = $(n, r);
35
- o && (o.baseRev === e.baseRev ? (l.current = !0, c({ kind: "offer", draft: o })) : (f(n, r), c({ kind: "dropped", draft: o })));
36
- }, [s, r, p, n, e.unsavedSteps.length, e.baseRev]);
37
- const i = e.unsavedSteps, v = e.status === "saving";
38
- R(() => {
39
- !s || !r || a.current !== s || l.current || v || (i.length > 0 && e.baseRev ? A({
40
- v: 1,
41
- layoutId: n,
42
- userId: r,
43
- baseRev: e.baseRev,
44
- steps: i.map((o) => ({ label: o.label, ops: o.ops })),
45
- at: Date.now()
46
- }) : i.length === 0 && f(n, r));
47
- }, [s, r, n, i, v, e.baseRev, t]);
48
- const g = e.restore, h = w(() => {
49
- (t == null ? void 0 : t.kind) === "offer" && (l.current = !1, c(null), g(t.draft.steps));
50
- }, [t, g]), m = w(() => {
51
- (t == null ? void 0 : t.kind) === "offer" && r && f(n, r), l.current = !1, c(null);
52
- }, [t, r, n]);
53
- return { state: t, recover: h, dismiss: m };
29
+ function M(e, t, r) {
30
+ if (!e || e.steps.length === 0) return null;
31
+ const n = Date.parse(e.saved_at);
32
+ return {
33
+ v: 1,
34
+ layoutId: t,
35
+ userId: r,
36
+ baseRev: e.base_rev,
37
+ steps: e.steps,
38
+ at: Number.isFinite(n) ? n : 0
39
+ };
40
+ }
41
+ function P(e, t) {
42
+ return e ? t ? e.at > t.at ? e : t : e : t;
43
+ }
44
+ function Y(e, t, r, n) {
45
+ var _;
46
+ const [c, w] = C(null), [K, v] = C("idle"), m = h(null), b = h(!1), p = h(!1), a = h(null), u = r ? `${r}:${t}` : null, $ = ((_ = e.bundle) == null ? void 0 : _.rev) ?? null, T = !n || n.settled, R = (n == null ? void 0 : n.draft) ?? null, i = !!n && n.available, o = n == null ? void 0 : n.writer, A = h(o);
47
+ A.current = o;
48
+ const S = y(() => {
49
+ var l;
50
+ const s = a.current;
51
+ s && (clearTimeout(s.timer), a.current = null, (l = A.current) == null || l.write(s.layoutId, { steps: s.steps, baseRev: s.baseRev }).catch(() => {
52
+ }));
53
+ }, []);
54
+ D(() => S, [S]), D(() => {
55
+ if (!u || !r || !$ || !T || m.current === u || (S(), m.current = u, b.current = !1, p.current = !!R, w(null), v(i ? "idle" : "off"), e.unsavedSteps.length > 0)) return;
56
+ const s = G(t, r), l = M(R, t, r), f = P(s, l);
57
+ f && (b.current = !0, w({
58
+ kind: "offer",
59
+ draft: f,
60
+ stale: f.baseRev !== e.baseRev,
61
+ source: f === l ? "server" : "browser"
62
+ }));
63
+ }, [
64
+ u,
65
+ r,
66
+ $,
67
+ t,
68
+ e.unsavedSteps.length,
69
+ e.baseRev,
70
+ T,
71
+ R,
72
+ i,
73
+ S
74
+ ]);
75
+ const g = e.unsavedSteps, N = e.status === "saving";
76
+ D(() => {
77
+ if (!(!u || !r || m.current !== u || b.current || N))
78
+ if (a.current && (clearTimeout(a.current.timer), a.current = null), g.length > 0 && e.baseRev) {
79
+ const s = {
80
+ v: 1,
81
+ layoutId: t,
82
+ userId: r,
83
+ baseRev: e.baseRev,
84
+ steps: g.map((f) => ({ label: f.label, ops: f.ops })),
85
+ at: Date.now()
86
+ };
87
+ if (L(s), !o || !i) return;
88
+ v("pending");
89
+ const l = setTimeout(() => {
90
+ a.current = null, o.write(t, { steps: s.steps, baseRev: s.baseRev }).then(() => {
91
+ p.current = !0, v("kept");
92
+ }).catch(() => v("failed"));
93
+ }, J);
94
+ a.current = { timer: l, layoutId: t, steps: s.steps, baseRev: s.baseRev };
95
+ } else g.length === 0 && (E(t, r), o && i && p.current && (p.current = !1, o.clear(t).catch(() => {
96
+ })), i && v("idle"));
97
+ }, [u, r, t, g, N, e.baseRev, c, o, i]);
98
+ const O = e.restore, d = y(() => {
99
+ (c == null ? void 0 : c.kind) === "offer" && (b.current = !1, w(null), O(c.draft.steps));
100
+ }, [c, O]), x = y(() => {
101
+ (c == null ? void 0 : c.kind) === "offer" && r && (E(t, r), o && i && p.current && (p.current = !1, o.clear(t).catch(() => {
102
+ }))), b.current = !1, w(null);
103
+ }, [c, r, t, o, i]);
104
+ return { state: c, recover: d, dismiss: x, sync: K };
105
+ }
106
+ function j(e) {
107
+ const t = "Only you see these changes until you save (⌘S).";
108
+ switch (e) {
109
+ case "kept":
110
+ return `${t} Kept for you on the server: carry on from any browser.`;
111
+ case "pending":
112
+ return `${t} Keeping them for you on the server…`;
113
+ case "failed":
114
+ return `${t} They are kept in this browser; the server copy could not be written.`;
115
+ case "off":
116
+ return `${t} They are kept in this browser.`;
117
+ default:
118
+ return t;
119
+ }
54
120
  }
55
121
  export {
56
- f as clearStoredDraft,
57
- $ as readStoredDraft,
58
- u as storedDraftKey,
59
- C as useDraftRecovery,
60
- A as writeStoredDraft
122
+ J as STAGED_SYNC_MS,
123
+ E as clearStoredDraft,
124
+ M as fromServerDraft,
125
+ P as pickDraft,
126
+ G as readStoredDraft,
127
+ j as stagedTip,
128
+ k as storedDraftKey,
129
+ Y as useDraftRecovery,
130
+ L as writeStoredDraft
61
131
  };
@@ -0,0 +1,149 @@
1
+ import { jsxs as s, jsx as t, Fragment as _ } from "react/jsx-runtime";
2
+ import { Bookmark as R } from "lucide-react";
3
+ import { useState as f } from "react";
4
+ import { toast as N } from "sonner";
5
+ import { entryConfigOf as O, ENTRY_PRESETS_MAX as k, PRESET_PARTS as B, sanitizeEntryConfig as L } from "../../../lib/entry-config.js";
6
+ import { cn as S } from "../../../lib/utils.js";
7
+ import { Popover as j, PopoverTrigger as q, PopoverContent as D } from "../../ui/popover.js";
8
+ import { effectText as m } from "../panel-style.js";
9
+ import { barBtn as F } from "../toolbar-kit.js";
10
+ import { partsSet as P, presetSummary as z, PART_LABEL as K, presetOps as M, capturePreset as W } from "./presets.js";
11
+ function ee({
12
+ bundle: C,
13
+ rows: l,
14
+ apply: h,
15
+ className: E
16
+ }) {
17
+ const [T, i] = f(!1), u = O(C.layout), n = u.presets ?? [], r = l.length === 1 ? l[0] : null, [d, g] = f(""), [c, x] = f([]), b = r ? P(r) : [], w = (e) => {
18
+ i(e), e && (g(""), x(r ? P(r) : []));
19
+ }, y = () => {
20
+ if (!r || !d.trim() || c.length === 0) return;
21
+ const e = W(d, r, c), a = L({ ...u, presets: [...n, e] });
22
+ h([{ op: "layout_update", patch: { entry_config: a } }], {
23
+ label: `Save preset “${e.name}”`
24
+ }), i(!1), N.success(`Saved the preset “${e.name}”`);
25
+ }, A = (e) => {
26
+ const a = n.find(($) => $.id === e);
27
+ if (!a) return;
28
+ const { ops: p, changed: o } = M(a, l);
29
+ if (!o) {
30
+ N.info(`Already set like “${a.name}”`), i(!1);
31
+ return;
32
+ }
33
+ h(p, {
34
+ label: `Apply preset “${a.name}” to ${o} ${o === 1 ? "field" : "fields"}`
35
+ }), i(!1);
36
+ }, v = n.length >= k;
37
+ return /* @__PURE__ */ s(j, { open: T, onOpenChange: w, children: [
38
+ /* @__PURE__ */ t(q, { asChild: !0, children: /* @__PURE__ */ s(
39
+ "button",
40
+ {
41
+ type: "button",
42
+ "data-placement-presets": "",
43
+ "data-tip": "Save these settings under a name, or apply a saved bundle",
44
+ className: S(F, E),
45
+ children: [
46
+ /* @__PURE__ */ t(R, { className: "h-3.5 w-3.5 shrink-0" }),
47
+ "Presets",
48
+ n.length > 0 && /* @__PURE__ */ t("span", { className: "tabular-nums text-slate-500 dark:text-muted-foreground", children: n.length })
49
+ ]
50
+ }
51
+ ) }),
52
+ /* @__PURE__ */ s(
53
+ D,
54
+ {
55
+ side: "left",
56
+ align: "start",
57
+ className: "w-[300px] space-y-3 p-3 text-[12px]",
58
+ "data-presets-popover": "",
59
+ children: [
60
+ /* @__PURE__ */ s("div", { className: "space-y-1", children: [
61
+ /* @__PURE__ */ s("p", { className: "m-0 text-[12.5px] font-medium text-slate-900 dark:text-foreground", children: [
62
+ "Apply to ",
63
+ l.length === 1 ? "this field" : `${l.length} fields`
64
+ ] }),
65
+ n.length === 0 ? /* @__PURE__ */ s("p", { className: m, children: [
66
+ "No presets yet.",
67
+ " ",
68
+ r ? "Save this field’s settings below." : "Select one field to save its settings as a preset."
69
+ ] }) : /* @__PURE__ */ t("ul", { className: "m-0 max-h-48 list-none space-y-0.5 overflow-y-auto p-0", children: n.map((e) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ s(
70
+ "button",
71
+ {
72
+ type: "button",
73
+ "data-preset-apply": e.id,
74
+ onClick: () => A(e.id),
75
+ className: "flex w-full flex-col rounded-md px-2 py-1.5 text-left transition-colors hover:bg-muted",
76
+ children: [
77
+ /* @__PURE__ */ t("span", { className: "truncate text-[12.5px] font-medium text-slate-800 dark:text-foreground", children: e.name }),
78
+ /* @__PURE__ */ t("span", { className: S(m, "truncate"), children: z(e) })
79
+ ]
80
+ }
81
+ ) }, e.id)) })
82
+ ] }),
83
+ r && /* @__PURE__ */ s("div", { className: "space-y-2 border-t border-slate-200 pt-3 dark:border-border", children: [
84
+ /* @__PURE__ */ t("p", { className: "m-0 text-[12.5px] font-medium text-slate-900 dark:text-foreground", children: "Save this field’s settings" }),
85
+ b.length === 0 ? /* @__PURE__ */ t("p", { className: m, children: "Nothing is set on this field yet: change its width, make it required or add help text first." }) : /* @__PURE__ */ s(_, { children: [
86
+ /* @__PURE__ */ s("fieldset", { className: "m-0 grid grid-cols-2 gap-x-3 gap-y-1 border-0 p-0", children: [
87
+ /* @__PURE__ */ t("legend", { className: "sr-only", children: "What the preset sets" }),
88
+ B.filter((e) => b.includes(e)).map((e) => /* @__PURE__ */ s(
89
+ "label",
90
+ {
91
+ className: "flex items-center gap-1.5 text-slate-700 dark:text-foreground",
92
+ children: [
93
+ /* @__PURE__ */ t(
94
+ "input",
95
+ {
96
+ type: "checkbox",
97
+ checked: c.includes(e),
98
+ onChange: (a) => x(
99
+ (p) => a.target.checked ? [...p, e] : p.filter((o) => o !== e)
100
+ )
101
+ }
102
+ ),
103
+ K[e]
104
+ ]
105
+ },
106
+ e
107
+ ))
108
+ ] }),
109
+ /* @__PURE__ */ t(
110
+ "input",
111
+ {
112
+ type: "text",
113
+ "aria-label": "Preset name",
114
+ placeholder: "Name, e.g. Narrow and required",
115
+ maxLength: 60,
116
+ value: d,
117
+ onChange: (e) => g(e.target.value),
118
+ onKeyDown: (e) => {
119
+ e.key === "Enter" && (e.preventDefault(), y());
120
+ },
121
+ className: "h-8 w-full rounded-md border border-slate-200 bg-white px-2 text-[12.5px] outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:border-border dark:bg-background"
122
+ }
123
+ ),
124
+ /* @__PURE__ */ t(
125
+ "button",
126
+ {
127
+ type: "button",
128
+ "data-preset-save": "",
129
+ disabled: !d.trim() || c.length === 0 || v,
130
+ onClick: y,
131
+ className: "h-7 rounded-md bg-nvr-cyan px-2.5 text-[12px] font-medium text-white transition-colors hover:bg-[#00b8e0] disabled:opacity-40",
132
+ children: "Save preset"
133
+ }
134
+ ),
135
+ v && /* @__PURE__ */ s("p", { className: m, children: [
136
+ "This form holds ",
137
+ k,
138
+ " presets: delete one in Form settings first."
139
+ ] })
140
+ ] })
141
+ ] })
142
+ ]
143
+ }
144
+ )
145
+ ] });
146
+ }
147
+ export {
148
+ ee as PlacementPresets
149
+ };
@@ -0,0 +1,10 @@
1
+ import { createContext as t, useContext as r } from "react";
2
+ const e = t({
3
+ tabOrderActive: !1,
4
+ startTabOrder: () => {
5
+ }
6
+ }), n = () => r(e);
7
+ export {
8
+ e as EntryEditorContext,
9
+ n as useEntryEditor
10
+ };
@@ -0,0 +1,71 @@
1
+ import { sanitizeEntryConfig as a, ENTRY_PRESETS_MAX as p, PRESET_PARTS as h } from "../../../lib/entry-config.js";
2
+ import { readOverrides as l, withKey as _ } from "../inspector/model.js";
3
+ const k = {
4
+ width: "Width",
5
+ required: "Required",
6
+ help: "Help text",
7
+ placeholder: "Placeholder",
8
+ input: "Input and format",
9
+ lock: "Lock rule"
10
+ }, d = {
11
+ width: [],
12
+ required: ["required"],
13
+ help: ["note"],
14
+ placeholder: ["placeholder"],
15
+ input: ["interface", "options"],
16
+ lock: []
17
+ };
18
+ function y(n) {
19
+ const e = l(n);
20
+ return h.filter((t) => t === "width" ? n.col_span != null : t === "lock" ? !!n.lock_conditions : d[t].some((o) => e[o] !== void 0));
21
+ }
22
+ const g = () => `p${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`;
23
+ function P(n, e, t) {
24
+ const o = l(e), c = {};
25
+ for (const s of t) for (const i of d[s]) o[i] !== void 0 && (c[i] = o[i]);
26
+ const r = { id: g(), name: n.trim(), parts: [...t] };
27
+ return t.includes("width") && (r.col_span = e.col_span ?? null), Object.keys(c).length && (r.overrides = c), t.includes("lock") && (r.lock_conditions = e.lock_conditions ?? null), r;
28
+ }
29
+ function m(n, e) {
30
+ var r;
31
+ const t = {};
32
+ let o = l(e), c = !1;
33
+ for (const s of n.parts)
34
+ if (s === "width") {
35
+ const i = n.col_span ?? null;
36
+ (e.col_span ?? null) !== i && (t.col_span = i);
37
+ } else if (s === "lock") {
38
+ const i = n.lock_conditions ?? null;
39
+ (e.lock_conditions ?? null) !== i && (t.lock_conditions = i);
40
+ } else
41
+ for (const i of d[s]) {
42
+ const u = (r = n.overrides) == null ? void 0 : r[i], f = o == null ? void 0 : o[i];
43
+ JSON.stringify(u) !== JSON.stringify(f) && (o = _(o ?? {}, i, u), c = !0);
44
+ }
45
+ return c && (t.overrides = o), Object.keys(t).length ? t : null;
46
+ }
47
+ function E(n, e) {
48
+ const t = [];
49
+ for (const o of e) {
50
+ const c = m(n, o);
51
+ c && t.push({
52
+ op: "update_placement",
53
+ at: { field: o.field, group_key: o.group_key },
54
+ patch: c
55
+ });
56
+ }
57
+ return { ops: t, changed: t.length };
58
+ }
59
+ function R(n, e) {
60
+ return a({ ...n, presets: e.slice(0, p) });
61
+ }
62
+ const O = (n) => n.parts.length ? n.parts.map((e) => k[e]).join(", ") : "Nothing set";
63
+ export {
64
+ k as PART_LABEL,
65
+ P as capturePreset,
66
+ y as partsSet,
67
+ E as presetOps,
68
+ m as presetPatch,
69
+ O as presetSummary,
70
+ R as withPresets
71
+ };
@@ -0,0 +1,110 @@
1
+ import { jsx as l, jsxs as s } from "react/jsx-runtime";
2
+ import { Undo2 as N, X as C, Check as O } from "lucide-react";
3
+ import { useState as m, useCallback as d, useMemo as T } from "react";
4
+ import { entryConfigOf as j, sanitizeEntryConfig as _ } from "../../../lib/entry-config.js";
5
+ import { cn as f } from "../../../lib/utils.js";
6
+ function z(e, t) {
7
+ return e.includes(t) ? e.filter((r) => r !== t) : [...e, t];
8
+ }
9
+ function E(e, t) {
10
+ const r = j(e.layout);
11
+ return [{ op: "layout_update", patch: { entry_config: _({ ...r, tab_order: t.length ? t : void 0 }) } }];
12
+ }
13
+ function A(e, t) {
14
+ const [r, c] = m(!1), [i, u] = m([]), p = d(() => {
15
+ u([]), c(!0);
16
+ }, []), h = d(() => c(!1), []), x = d(() => {
17
+ c(!1), e && i.length > 0 && t(E(e, i), { label: "Set the tab order" });
18
+ }, [e, i, t]), g = d(() => u((a) => a.slice(0, -1)), []), k = d(
19
+ (a) => (n, o) => {
20
+ if (r && (n.kind === "field" || n.kind === "header")) {
21
+ const v = n.field;
22
+ u((w) => z(w, v));
23
+ return;
24
+ }
25
+ a(n, o);
26
+ },
27
+ [r]
28
+ ), b = T(() => new Map(i.map((a, n) => [a, n + 1])), [i]), y = d(
29
+ (a) => r ? (n) => {
30
+ if (n.kind !== "field" && n.kind !== "header") return (a == null ? void 0 : a(n)) ?? null;
31
+ const o = b.get(n.field);
32
+ return {
33
+ // Outlines, like the design shell's own: they sit outside the field (offset)
34
+ // instead of hugging its label, and a dashed one reads as "not yet".
35
+ className: f(
36
+ "cursor-pointer",
37
+ o ? "bg-nvr-cyan/[0.06] outline outline-2 outline-nvr-cyan" : "outline-dashed outline-1 outline-slate-300 dark:outline-slate-600"
38
+ ),
39
+ chip: (
40
+ // An empty dashed ring on a field not numbered yet: a "Click" word on every
41
+ // field shouted over the form and collided with its other tags.
42
+ /* @__PURE__ */ l(
43
+ "span",
44
+ {
45
+ "data-tab-order-chip": o ?? "",
46
+ role: "img",
47
+ "data-tip": o ? "Click to take it out" : "Click to number it",
48
+ "aria-label": o ? `Tab stop ${o}` : "Not in the tab order yet",
49
+ className: f(
50
+ "inline-flex h-5 min-w-5 items-center justify-center rounded-full text-[11px] font-semibold tabular-nums",
51
+ o ? "bg-nvr-cyan px-1.5 text-white" : "border border-dashed border-slate-400 bg-white dark:border-slate-500 dark:bg-card"
52
+ ),
53
+ children: o ?? null
54
+ }
55
+ )
56
+ )
57
+ };
58
+ } : a,
59
+ [r, b]
60
+ );
61
+ return { active: r, order: i, start: p, cancel: h, done: x, undoLast: g, intercept: k, overlay: y };
62
+ }
63
+ function B({ editor: e }) {
64
+ if (!e.active) return null;
65
+ const t = e.order.length, r = "inline-flex h-7 items-center gap-1 rounded-md border border-slate-200 bg-white px-2 text-[12px] font-medium text-slate-700 hover:bg-slate-50 disabled:opacity-40 dark:border-border dark:bg-card dark:text-foreground dark:hover:bg-muted";
66
+ return /* @__PURE__ */ s(
67
+ "div",
68
+ {
69
+ role: "status",
70
+ "data-tab-order-bar": "",
71
+ className: "sticky top-0 z-30 flex flex-wrap items-center gap-2 border-b border-nvr-cyan/40 bg-white px-4 py-2 text-[12.5px] text-slate-700 dark:bg-card dark:text-foreground",
72
+ children: [
73
+ /* @__PURE__ */ s("p", { className: "m-0 min-w-0 flex-1", children: [
74
+ /* @__PURE__ */ l("span", { className: "font-medium", children: "Tab order." }),
75
+ " Click fields in the order Tab should visit them.",
76
+ " ",
77
+ /* @__PURE__ */ l("span", { className: "text-slate-500 dark:text-muted-foreground", children: t === 0 ? "Fields you skip follow in page order." : `${t} numbered; click a number again to take it out.` })
78
+ ] }),
79
+ /* @__PURE__ */ s("button", { type: "button", className: r, disabled: t === 0, onClick: e.undoLast, children: [
80
+ /* @__PURE__ */ l(N, { className: "h-3.5 w-3.5" }),
81
+ "Undo last"
82
+ ] }),
83
+ /* @__PURE__ */ s("button", { type: "button", className: r, onClick: e.cancel, children: [
84
+ /* @__PURE__ */ l(C, { className: "h-3.5 w-3.5" }),
85
+ "Cancel"
86
+ ] }),
87
+ /* @__PURE__ */ s(
88
+ "button",
89
+ {
90
+ type: "button",
91
+ "data-tab-order-done": "",
92
+ disabled: t === 0,
93
+ onClick: e.done,
94
+ className: "inline-flex h-7 items-center gap-1 rounded-md bg-nvr-cyan px-2.5 text-[12px] font-medium text-white hover:bg-nvr-cyan/90 disabled:opacity-40",
95
+ children: [
96
+ /* @__PURE__ */ l(O, { className: "h-3.5 w-3.5" }),
97
+ "Done"
98
+ ]
99
+ }
100
+ )
101
+ ]
102
+ }
103
+ );
104
+ }
105
+ export {
106
+ B as TabOrderBar,
107
+ E as tabOrderOps,
108
+ z as toggleInOrder,
109
+ A as useTabOrderEditor
110
+ };
@@ -0,0 +1,37 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { Sun as s, Moon as i } from "lucide-react";
3
+ import { useState as c, useEffect as d } from "react";
4
+ import { ToolButton as m } from "../toolbar-kit.js";
5
+ const a = () => typeof document < "u" && document.documentElement.classList.contains("dark");
6
+ function f() {
7
+ const [e, r] = c(a);
8
+ return d(() => {
9
+ const t = new MutationObserver(() => r(a()));
10
+ return t.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), () => t.disconnect();
11
+ }, []), e;
12
+ }
13
+ const k = (e, r) => e && !r ? "dark" : "";
14
+ function w({
15
+ on: e,
16
+ onChange: r,
17
+ appDark: t,
18
+ disabled: n
19
+ }) {
20
+ return /* @__PURE__ */ o(
21
+ m,
22
+ {
23
+ label: "Preview in dark",
24
+ icon: e ? /* @__PURE__ */ o(s, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ o(i, { className: "h-3.5 w-3.5" }),
25
+ hint: t ? "The app is already dark. Switch the app to light to preview the form in dark." : "Show the canvas in the dark theme; the app stays as it is",
26
+ checked: e && !t,
27
+ disabled: n || t,
28
+ onClick: () => r(!e),
29
+ data: { "data-editor-theme-preview": "" }
30
+ }
31
+ );
32
+ }
33
+ export {
34
+ w as ThemePreviewTool,
35
+ k as previewThemeClass,
36
+ f as useAppIsDark
37
+ };