@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,51 +1,52 @@
1
- import { jsxs as s, jsx as a, Fragment as X } from "react/jsx-runtime";
2
- import { useQueryClient as Z, useQuery as M, useMutation as U } from "@tanstack/react-query";
3
- import { Bookmark as Q } from "lucide-react";
1
+ import { jsxs as s, jsx as a, Fragment as I } from "react/jsx-runtime";
2
+ import { useQueryClient as ee, useQuery as Q, useMutation as te } from "@tanstack/react-query";
3
+ import { Bookmark as D } from "lucide-react";
4
4
  import { useState as h } from "react";
5
5
  import { toast as G } from "sonner";
6
- import { useNivaroClient as I } from "../../context.js";
7
- import { get as P, post as ee } from "../../lib/commands.js";
8
- import { ExplainDiffButton as te } from "./assist/ExplainDiff.js";
9
- import { useVersionNaming as ae, fetchVersionBundle as ne } from "./history-api.js";
10
- import { SessionHistory as re } from "./SessionHistory.js";
11
- import { slotName as se } from "./slot-names.js";
12
- import { layoutDraftKeys as A, parseSaveFailure as R } from "./useLayoutDraft.js";
13
- function oe(t) {
6
+ import { useNivaroClient as ae } from "../../context.js";
7
+ import { get as R, post as ne } from "../../lib/commands.js";
8
+ import { ExplainDiffButton as re } from "./assist/ExplainDiff.js";
9
+ import { useVersionNaming as se, fetchVersionBundle as oe } from "./history-api.js";
10
+ import { RestorePieceButton as ie } from "./RestorePiece.js";
11
+ import { SessionHistory as le } from "./SessionHistory.js";
12
+ import { slotName as de } from "./slot-names.js";
13
+ import { layoutDraftKeys as W, parseSaveFailure as V } from "./useLayoutDraft.js";
14
+ function ce(t) {
14
15
  return /^before\b/i.test(t) ? t : `Before: ${t}`;
15
16
  }
16
- const V = A.versions, ie = A.bundle;
17
+ const H = W.versions, me = W.bundle;
17
18
  function N(t) {
18
19
  if (t == null || t === "") return "empty";
19
20
  if (typeof t == "object") {
20
- const r = JSON.stringify(t);
21
- return r.length > 60 ? `${r.slice(0, 57)}…` : r;
21
+ const n = JSON.stringify(t);
22
+ return n.length > 60 ? `${n.slice(0, 57)}…` : n;
22
23
  }
23
24
  return String(t);
24
25
  }
25
- const D = (t) => t.map((r) => `${r.field} ${N(r.from)} → ${N(r.to)}`), F = (t) => t.startsWith("__") ? se(t) : t;
26
- function le(t) {
27
- const r = [];
28
- for (const n of t.layout)
29
- r.push({ kind: "Form", text: `${n.field}: ${N(n.from)} → ${N(n.to)}` });
30
- for (const n of t.groups.added) r.push({ kind: "Group added", text: n });
31
- for (const n of t.groups.removed) r.push({ kind: "Group removed", text: n });
32
- for (const n of t.groups.changed)
33
- r.push({ kind: "Group", text: `${n.label}: ${D(n.changes).join(" · ")}` });
34
- for (const n of t.assignments.added) r.push({ kind: "Field added", text: F(n) });
35
- for (const n of t.assignments.removed)
36
- r.push({ kind: "Field removed", text: F(n) });
37
- for (const n of t.assignments.changed)
38
- r.push({
26
+ const O = (t) => t.map((n) => `${n.field} ${N(n.from)} → ${N(n.to)}`), F = (t) => t.startsWith("__") ? de(t) : t;
27
+ function ue(t) {
28
+ const n = [];
29
+ for (const r of t.layout)
30
+ n.push({ kind: "Form", text: `${r.field}: ${N(r.from)} → ${N(r.to)}` });
31
+ for (const r of t.groups.added) n.push({ kind: "Group added", text: r });
32
+ for (const r of t.groups.removed) n.push({ kind: "Group removed", text: r });
33
+ for (const r of t.groups.changed)
34
+ n.push({ kind: "Group", text: `${r.label}: ${O(r.changes).join(" · ")}` });
35
+ for (const r of t.assignments.added) n.push({ kind: "Field added", text: F(r) });
36
+ for (const r of t.assignments.removed)
37
+ n.push({ kind: "Field removed", text: F(r) });
38
+ for (const r of t.assignments.changed)
39
+ n.push({
39
40
  kind: "Field",
40
- text: `${F(n.label)}: ${D(n.changes).join(" · ")}`
41
+ text: `${F(r.label)}: ${O(r.changes).join(" · ")}`
41
42
  });
42
- return r;
43
+ return n;
43
44
  }
44
- function de({ diff: t }) {
45
- const [r, n] = h(!1);
45
+ function pe({ diff: t }) {
46
+ const [n, r] = h(!1);
46
47
  if (t.total === 0)
47
48
  return /* @__PURE__ */ a("p", { className: "mt-1 text-[12px] text-slate-500 dark:text-slate-400", children: "Nothing differs from that version. The form is exactly as it was saved." });
48
- const l = le(t), x = r ? l : l.slice(0, 12);
49
+ const l = ue(t), x = n ? l : l.slice(0, 12);
49
50
  return /* @__PURE__ */ s("div", { className: "mt-1", children: [
50
51
  t.warnings.map((o) => /* @__PURE__ */ a(
51
52
  "p",
@@ -62,101 +63,104 @@ function de({ diff: t }) {
62
63
  t.total === 1 ? "" : "s",
63
64
  t.from.created_at ? ` since ${new Date(t.from.created_at).toLocaleString()}` : ""
64
65
  ] }),
65
- /* @__PURE__ */ a("ul", { className: "mt-1 space-y-0.5", children: x.map((o, d) => (
66
+ /* @__PURE__ */ a("ul", { className: "mt-1 space-y-0.5", children: x.map((o, c) => (
66
67
  // biome-ignore lint/suspicious/noArrayIndexKey: ordered diff rows
67
68
  /* @__PURE__ */ s("li", { className: "flex gap-2 text-[12px]", children: [
68
69
  /* @__PURE__ */ a("span", { className: "w-24 shrink-0 text-[11px] text-slate-500 dark:text-slate-400", children: o.kind }),
69
70
  /* @__PURE__ */ a("span", { className: "min-w-0 break-words text-slate-700 dark:text-slate-200", children: o.text })
70
- ] }, d)
71
+ ] }, c)
71
72
  )) }),
72
73
  l.length > 12 && /* @__PURE__ */ a(
73
74
  "button",
74
75
  {
75
76
  type: "button",
76
- onClick: () => n((o) => !o),
77
+ onClick: () => r((o) => !o),
77
78
  className: "mt-1 text-[11px] text-slate-500 underline dark:text-slate-400",
78
- children: r ? "Show fewer" : `Show all ${l.length}`
79
+ children: n ? "Show fewer" : `Show all ${l.length}`
79
80
  }
80
81
  )
81
82
  ] });
82
83
  }
83
- function ve({
84
+ function _e({
84
85
  layoutId: t,
85
- onRestored: r,
86
- unsavedCount: n = 0,
86
+ onRestored: n,
87
+ unsavedCount: r = 0,
87
88
  onDiscardUnsaved: l,
88
89
  session: x,
89
90
  onJump: o,
90
- onShowOnCanvas: d
91
+ onShowOnCanvas: c,
92
+ bundle: _,
93
+ onApply: S,
94
+ fieldLabel: Y
91
95
  }) {
92
- const g = I(), k = Z(), [f, _] = h(null), [H, v] = h(null), { data: c = [], isLoading: O } = M({
93
- queryKey: V(t),
94
- queryFn: () => g.request(P(`/collection-layouts/${t}/versions`)).then((e) => e.data ?? []),
96
+ const g = ae(), k = ee(), [f, q] = h(null), [A, v] = h(null), { data: m = [], isLoading: z } = Q({
97
+ queryKey: H(t),
98
+ queryFn: () => g.request(R(`/collection-layouts/${t}/versions`)).then((e) => e.data ?? []),
95
99
  staleTime: 0,
96
100
  refetchOnMount: "always"
97
- }), m = f ?? (c.length > 0 ? "newest" : null), { data: u, isLoading: W } = M({
98
- queryKey: ["layout-editor", "version-diff", t, m],
101
+ }), u = f ?? (m.length > 0 ? "newest" : null), { data: p, isLoading: J } = Q({
102
+ queryKey: ["layout-editor", "version-diff", t, u],
99
103
  queryFn: () => g.request(
100
- P(`/collection-layouts/${t}/versions/${m}/diff`, { against: "current" })
104
+ R(`/collection-layouts/${t}/versions/${u}/diff`, { against: "current" })
101
105
  ).then((e) => e.data),
102
- enabled: m != null,
106
+ enabled: u != null,
103
107
  staleTime: 0,
104
108
  refetchOnMount: "always"
105
- }), b = U({
106
- mutationFn: (e) => g.request(ee(`/collection-layouts/${t}/versions/${e}/restore`)),
109
+ }), b = te({
110
+ mutationFn: (e) => g.request(ne(`/collection-layouts/${t}/versions/${e}/restore`)),
107
111
  onSuccess: () => {
108
- v(null), l == null || l(), k.invalidateQueries({ queryKey: ie(t) }), k.invalidateQueries({ queryKey: V(t) }), k.invalidateQueries({ queryKey: ["layout-editor", "version-diff", t] }), r == null || r();
112
+ v(null), l == null || l(), k.invalidateQueries({ queryKey: me(t) }), k.invalidateQueries({ queryKey: H(t) }), k.invalidateQueries({ queryKey: ["layout-editor", "version-diff", t] }), n == null || n();
109
113
  }
110
- }), y = c.find((e) => e.id === f), { nameVersion: Y, nameCurrent: z } = ae(t), [w, $] = h(null), [S, q] = h(""), [C, K] = h(null), L = (e, i = "") => {
111
- $(e), q(i);
112
- }, j = () => {
113
- const e = w, i = S.trim();
114
+ }), y = m.find((e) => e.id === f), { nameVersion: X, nameCurrent: Z } = se(t), [w, $] = h(null), [K, L] = h(""), [C, j] = h(null), B = (e, i = "") => {
115
+ $(e), L(i);
116
+ }, T = () => {
117
+ const e = w, i = K.trim();
114
118
  if ($(null), e == null) return;
115
- const E = { onError: (J) => G.error(R(J, "Not named").message) };
116
- e === "current" ? i && z.mutate(i, E) : Y.mutate({ versionId: e, name: i || null }, E);
117
- }, T = async (e) => {
118
- if (d) {
119
- K(e.id);
119
+ const P = { onError: (U) => G.error(V(U, "Not named").message) };
120
+ e === "current" ? i && Z.mutate(i, P) : X.mutate({ versionId: e, name: i || null }, P);
121
+ }, E = async (e) => {
122
+ if (c) {
123
+ j(e.id);
120
124
  try {
121
- const i = await ne(g, t, e.id);
122
- d(i, e.name ? `“${e.name}” (v${e.version})` : `version ${e.version}`);
125
+ const i = await oe(g, t, e.id);
126
+ c(i, e.name ? `“${e.name}” (v${e.version})` : `version ${e.version}`);
123
127
  } catch (i) {
124
- G.error(R(i, "That version could not be read").message);
128
+ G.error(V(i, "That version could not be read").message);
125
129
  } finally {
126
- K(null);
130
+ j(null);
127
131
  }
128
132
  }
129
- }, B = /* @__PURE__ */ a(
133
+ }, M = /* @__PURE__ */ a(
130
134
  "input",
131
135
  {
132
136
  autoFocus: !0,
133
137
  "aria-label": "Version name",
134
- value: S,
138
+ value: K,
135
139
  maxLength: 120,
136
140
  placeholder: "e.g. Go-live baseline",
137
- onChange: (e) => q(e.target.value),
141
+ onChange: (e) => L(e.target.value),
138
142
  onKeyDown: (e) => {
139
- e.key === "Enter" && j(), e.key === "Escape" && (e.stopPropagation(), $(null));
143
+ e.key === "Enter" && T(), e.key === "Escape" && (e.stopPropagation(), $(null));
140
144
  },
141
- onBlur: j,
145
+ onBlur: T,
142
146
  className: "h-6 w-full min-w-0 rounded border border-nvr-cyan bg-white px-1.5 text-[12px] outline-none dark:bg-background dark:text-foreground"
143
147
  }
144
- ), p = "rounded border border-slate-200 px-1.5 py-0.5 text-[11px] hover:bg-slate-50 dark:border-border dark:hover:bg-muted";
148
+ ), d = "rounded border border-slate-200 px-1.5 py-0.5 text-[11px] hover:bg-slate-50 dark:border-border dark:hover:bg-muted";
145
149
  return /* @__PURE__ */ s("div", { className: "flex flex-col gap-2 text-[12px]", "data-layout-history": !0, children: [
146
- x && o && /* @__PURE__ */ a(re, { session: x, onJump: o }),
147
- c.length > 0 && /* @__PURE__ */ s("div", { className: "rounded-lg border border-slate-200 bg-slate-50 p-2 dark:border-border dark:bg-muted/40", children: [
150
+ x && o && /* @__PURE__ */ a(le, { session: x, onJump: o }),
151
+ m.length > 0 && /* @__PURE__ */ s("div", { className: "rounded-lg border border-slate-200 bg-slate-50 p-2 dark:border-border dark:bg-muted/40", children: [
148
152
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-2", children: [
149
153
  /* @__PURE__ */ a("p", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: f == null ? "What the last save changed" : `Version ${(y == null ? void 0 : y.version) ?? "?"} compared with now` }),
150
154
  /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
151
- d && u && u.total > 0 && /* @__PURE__ */ a(
155
+ c && p && p.total > 0 && /* @__PURE__ */ a(
152
156
  "button",
153
157
  {
154
158
  type: "button",
155
159
  "data-show-on-canvas": "",
156
160
  disabled: C != null,
157
161
  onClick: () => {
158
- const e = y ?? c[0];
159
- e && T(e);
162
+ const e = y ?? m[0];
163
+ e && E(e);
160
164
  },
161
165
  "data-tip": "Mark what differs on the form itself: added, moved, changed, removed",
162
166
  className: "text-[11px] text-slate-600 underline dark:text-slate-300",
@@ -167,53 +171,53 @@ function ve({
167
171
  "button",
168
172
  {
169
173
  type: "button",
170
- onClick: () => _(null),
174
+ onClick: () => q(null),
171
175
  className: "text-[11px] text-slate-500 underline dark:text-slate-400",
172
176
  children: "Show last save"
173
177
  }
174
178
  )
175
179
  ] })
176
180
  ] }),
177
- W && /* @__PURE__ */ a("p", { className: "mt-1 text-slate-500", children: "Comparing…" }),
178
- u && /* @__PURE__ */ a(de, { diff: u }),
179
- u && u.total > 0 && m != null && /* @__PURE__ */ a(
180
- te,
181
+ J && /* @__PURE__ */ a("p", { className: "mt-1 text-slate-500", children: "Comparing…" }),
182
+ p && /* @__PURE__ */ a(pe, { diff: p }),
183
+ p && p.total > 0 && u != null && /* @__PURE__ */ a(
184
+ re,
181
185
  {
182
186
  className: "mt-2",
183
- a: { layout_id: t, version: m },
187
+ a: { layout_id: t, version: u },
184
188
  b: { layout_id: t, version: "current" }
185
189
  },
186
- String(m)
190
+ String(u)
187
191
  )
188
192
  ] }),
189
193
  b.isError && /* @__PURE__ */ a("p", { className: "text-[12px] text-[#9c2f47] dark:text-[#f08aa1]", children: "Restore failed. Nothing was changed." }),
190
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2", "data-name-current": "", children: w === "current" ? B : /* @__PURE__ */ s(
194
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-2", "data-name-current": "", children: w === "current" ? M : /* @__PURE__ */ s(
191
195
  "button",
192
196
  {
193
197
  type: "button",
194
- onClick: () => L("current"),
198
+ onClick: () => B("current"),
195
199
  "data-tip": "Keep the form as it is saved now, under a name, beyond the rolling 30 versions",
196
- className: `${p} inline-flex items-center gap-1`,
200
+ className: `${d} inline-flex items-center gap-1`,
197
201
  children: [
198
- /* @__PURE__ */ a(Q, { className: "h-3 w-3" }),
202
+ /* @__PURE__ */ a(D, { className: "h-3 w-3" }),
199
203
  "Name the saved form…"
200
204
  ]
201
205
  }
202
206
  ) }),
203
- O ? /* @__PURE__ */ a("p", { className: "text-slate-500", children: "Loading history…" }) : c.length === 0 ? /* @__PURE__ */ a("p", { className: "text-slate-500 dark:text-slate-400", children: "No versions yet. One is saved before every change." }) : /* @__PURE__ */ a("ul", { className: "max-h-64 space-y-1 overflow-y-auto", children: c.map((e) => /* @__PURE__ */ s(
207
+ z ? /* @__PURE__ */ a("p", { className: "text-slate-500", children: "Loading history…" }) : m.length === 0 ? /* @__PURE__ */ a("p", { className: "text-slate-500 dark:text-slate-400", children: "No versions yet. One is saved before every change." }) : /* @__PURE__ */ a("ul", { className: "max-h-64 space-y-1 overflow-y-auto", children: m.map((e) => /* @__PURE__ */ s(
204
208
  "li",
205
209
  {
206
210
  className: "flex items-center justify-between gap-2 rounded border border-slate-100 px-2 py-1 dark:border-border/60",
207
211
  children: [
208
212
  /* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
209
- w === e.id ? B : e.name && /* @__PURE__ */ s(
213
+ w === e.id ? M : e.name && /* @__PURE__ */ s(
210
214
  "span",
211
215
  {
212
216
  "data-version-name": e.name,
213
217
  "data-tip": "Named: kept beyond the rolling 30 versions",
214
218
  className: "mr-1 inline-flex max-w-full items-center gap-0.5 rounded bg-slate-100 px-1 text-[11px] font-medium text-slate-700 dark:bg-muted dark:text-slate-200",
215
219
  children: [
216
- /* @__PURE__ */ a(Q, { className: "h-3 w-3 shrink-0" }),
220
+ /* @__PURE__ */ a(D, { className: "h-3 w-3 shrink-0" }),
217
221
  /* @__PURE__ */ a("span", { className: "truncate", children: e.name })
218
222
  ]
219
223
  }
@@ -224,7 +228,7 @@ function ve({
224
228
  ] }),
225
229
  " ",
226
230
  /* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-slate-400", children: [
227
- e.note ? `${oe(e.note)} · ` : "",
231
+ e.note ? `${ce(e.note)} · ` : "",
228
232
  new Date(e.created_at).toLocaleString(),
229
233
  e.created_by_name ? ` · ${e.created_by_name}` : ""
230
234
  ] })
@@ -235,9 +239,9 @@ function ve({
235
239
  {
236
240
  type: "button",
237
241
  "data-version-name-edit": e.version,
238
- onClick: () => L(e.id, e.name ?? ""),
242
+ onClick: () => B(e.id, e.name ?? ""),
239
243
  "data-tip": e.name ? "Rename, or clear the name to let it be pruned again" : "Name this version so it is kept beyond the rolling 30",
240
- className: p,
244
+ className: d,
241
245
  children: e.name ? "Rename" : "Name"
242
246
  }
243
247
  ),
@@ -248,24 +252,36 @@ function ve({
248
252
  "data-tip": "See what differs from the form now",
249
253
  "data-version-diff": e.version,
250
254
  "data-setting": "tool.version_diff",
251
- onClick: () => _(e.id),
252
- className: `${p} ${f === e.id ? "border-nvr-cyan text-nvr-navy dark:text-nvr-cyan" : ""}`,
255
+ onClick: () => q(e.id),
256
+ className: `${d} ${f === e.id ? "border-nvr-cyan text-nvr-navy dark:text-nvr-cyan" : ""}`,
253
257
  children: "Compare"
254
258
  }
255
259
  ),
256
- d && /* @__PURE__ */ a(
260
+ c && /* @__PURE__ */ a(
257
261
  "button",
258
262
  {
259
263
  type: "button",
260
264
  "data-version-canvas": e.version,
261
265
  disabled: C != null,
262
- onClick: () => void T(e),
266
+ onClick: () => void E(e),
263
267
  "data-tip": "Mark on the form what differs from this version",
264
- className: p,
268
+ className: d,
265
269
  children: C === e.id ? "…" : "Canvas"
266
270
  }
267
271
  ),
268
- H === e.id ? /* @__PURE__ */ s(X, { children: [
272
+ _ && S && /* @__PURE__ */ a(
273
+ ie,
274
+ {
275
+ layoutId: t,
276
+ version: e,
277
+ bundle: _,
278
+ onApply: S,
279
+ fieldLabel: Y,
280
+ onDone: n,
281
+ className: d
282
+ }
283
+ ),
284
+ A === e.id ? /* @__PURE__ */ s(I, { children: [
269
285
  /* @__PURE__ */ a(
270
286
  "button",
271
287
  {
@@ -273,12 +289,12 @@ function ve({
273
289
  "data-restore-confirm": e.id,
274
290
  disabled: b.isPending,
275
291
  onClick: () => b.mutate(e.id),
276
- "data-tip": n > 0 ? `Your ${n} unsaved ${n === 1 ? "change is" : "changes are"} dropped` : void 0,
292
+ "data-tip": r > 0 ? `Your ${r} unsaved ${r === 1 ? "change is" : "changes are"} dropped` : void 0,
277
293
  className: "rounded bg-nvr-cyan px-1.5 py-0.5 text-[11px] text-white disabled:opacity-60",
278
- children: b.isPending ? "Restoring…" : n > 0 ? "Restore, drop unsaved" : "Yes, restore"
294
+ children: b.isPending ? "Restoring…" : r > 0 ? "Restore, drop unsaved" : "Yes, restore"
279
295
  }
280
296
  ),
281
- /* @__PURE__ */ a("button", { type: "button", onClick: () => v(null), className: p, children: "Cancel" })
297
+ /* @__PURE__ */ a("button", { type: "button", onClick: () => v(null), className: d, children: "Cancel" })
282
298
  ] }) : /* @__PURE__ */ a(
283
299
  "button",
284
300
  {
@@ -287,7 +303,7 @@ function ve({
287
303
  "data-setting": "tool.version_restore",
288
304
  "data-tip": "Replace the form with this version. The current one is kept as a version first.",
289
305
  onClick: () => v(e.id),
290
- className: p,
306
+ className: d,
291
307
  children: "Restore"
292
308
  }
293
309
  )
@@ -299,6 +315,6 @@ function ve({
299
315
  ] });
300
316
  }
301
317
  export {
302
- ve as HistoryPanel,
303
- oe as versionNoteLabel
318
+ _e as HistoryPanel,
319
+ ce as versionNoteLabel
304
320
  };