@nivaro/react 0.2.52 → 0.2.54

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 (191) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +116 -2
  4. package/dist/layout-editor.d.ts +248 -2
  5. package/dist/shared/components/FormWhatsNew.js +60 -0
  6. package/dist/shared/components/ItemEditForm.js +3994 -3876
  7. package/dist/shared/components/RecordReadView.js +219 -211
  8. package/dist/shared/components/TipLayer.js +27 -27
  9. package/dist/shared/components/help-videos/api.js +51 -41
  10. package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
  11. package/dist/shared/components/item-edit/FieldAffordances.js +7 -6
  12. package/dist/shared/components/item-edit/FieldRow.js +353 -304
  13. package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
  14. package/dist/shared/components/item-edit/GroupSection.js +419 -396
  15. package/dist/shared/components/item-edit/HeaderTools.js +59 -56
  16. package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
  17. package/dist/shared/components/item-edit/lock-why.js +87 -0
  18. package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -0
  19. package/dist/shared/components/layout-editor/AddPanel.js +204 -146
  20. package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
  21. package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
  22. package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
  23. package/dist/shared/components/layout-editor/ChangeNote.js +146 -0
  24. package/dist/shared/components/layout-editor/CollabParts.js +170 -0
  25. package/dist/shared/components/layout-editor/DesignNode.js +304 -115
  26. package/dist/shared/components/layout-editor/EditorCanvas.js +21 -20
  27. package/dist/shared/components/layout-editor/EditorTopBar.js +452 -175
  28. package/dist/shared/components/layout-editor/FindReplace.js +188 -0
  29. package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
  30. package/dist/shared/components/layout-editor/HistoryPanel.js +234 -109
  31. package/dist/shared/components/layout-editor/LayoutEditor.js +1101 -307
  32. package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
  33. package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
  34. package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
  35. package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
  36. package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
  37. package/dist/shared/components/layout-editor/StructureMenu.js +413 -0
  38. package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
  39. package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
  40. package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
  41. package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
  42. package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
  43. package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
  44. package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
  45. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
  46. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
  47. package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
  48. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
  49. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
  50. package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
  51. package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
  52. package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
  53. package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
  54. package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
  55. package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
  56. package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
  57. package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
  58. package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
  59. package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
  60. package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
  61. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
  62. package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
  63. package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
  64. package/dist/shared/components/layout-editor/assist/jump.js +142 -0
  65. package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
  66. package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
  67. package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
  68. package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
  69. package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
  70. package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
  71. package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
  72. package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
  73. package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
  74. package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
  75. package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
  76. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +342 -0
  77. package/dist/shared/components/layout-editor/collab/collab-api.js +77 -0
  78. package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
  79. package/dist/shared/components/layout-editor/commands/intents.js +214 -0
  80. package/dist/shared/components/layout-editor/commands/parse.js +242 -0
  81. package/dist/shared/components/layout-editor/design-context.js +26 -6
  82. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +179 -163
  83. package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
  84. package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
  85. package/dist/shared/components/layout-editor/draft-recovery.js +61 -0
  86. package/dist/shared/components/layout-editor/editor-notes.js +78 -0
  87. package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
  88. package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
  89. package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
  90. package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
  91. package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
  92. package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
  93. package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
  94. package/dist/shared/components/layout-editor/field-zones.js +116 -0
  95. package/dist/shared/components/layout-editor/form-map.js +138 -0
  96. package/dist/shared/components/layout-editor/history-api.js +87 -0
  97. package/dist/shared/components/layout-editor/inheritance.js +55 -0
  98. package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
  99. package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
  100. package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
  101. package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
  102. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
  103. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +175 -0
  104. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
  105. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +146 -92
  106. package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
  107. package/dist/shared/components/layout-editor/inspector/Inspector.js +256 -175
  108. package/dist/shared/components/layout-editor/inspector/LookTab.js +46 -40
  109. package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
  110. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
  111. package/dist/shared/components/layout-editor/inspector/PickerTab.js +167 -141
  112. package/dist/shared/components/layout-editor/inspector/RulesTab.js +175 -128
  113. package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
  114. package/dist/shared/components/layout-editor/inspector/kit.js +3 -3
  115. package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
  116. package/dist/shared/components/layout-editor/is-typing.js +9 -0
  117. package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
  118. package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
  119. package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
  120. package/dist/shared/components/layout-editor/load-error.js +37 -0
  121. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
  122. package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
  123. package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
  124. package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
  125. package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
  126. package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
  127. package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
  128. package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
  129. package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
  130. package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
  131. package/dist/shared/components/layout-editor/nav/find.js +20 -0
  132. package/dist/shared/components/layout-editor/nav/tree.js +142 -0
  133. package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
  134. package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
  135. package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
  136. package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
  137. package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
  138. package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
  139. package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
  140. package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
  141. package/dist/shared/components/layout-editor/overview/describe-conditions.js +18 -14
  142. package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
  143. package/dist/shared/components/layout-editor/panel-style.js +8 -7
  144. package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
  145. package/dist/shared/components/layout-editor/pin.js +25 -0
  146. package/dist/shared/components/layout-editor/presence.js +111 -0
  147. package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
  148. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
  149. package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
  150. package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
  151. package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
  152. package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
  153. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
  154. package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
  155. package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
  156. package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
  157. package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
  158. package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
  159. package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
  160. package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
  161. package/dist/shared/components/layout-editor/settings/FormSettings.js +123 -103
  162. package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
  163. package/dist/shared/components/layout-editor/settings/ToolsSection.js +174 -100
  164. package/dist/shared/components/layout-editor/settings/WhoSection.js +136 -100
  165. package/dist/shared/components/layout-editor/settings/controls.js +8 -8
  166. package/dist/shared/components/layout-editor/settings/settings-registry.js +35 -11
  167. package/dist/shared/components/layout-editor/shortcuts.js +88 -0
  168. package/dist/shared/components/layout-editor/show-when.js +35 -0
  169. package/dist/shared/components/layout-editor/slot-names.js +4 -3
  170. package/dist/shared/components/layout-editor/structure-ops.js +399 -0
  171. package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
  172. package/dist/shared/components/layout-editor/testing/TestingPanels.js +551 -0
  173. package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
  174. package/dist/shared/components/layout-editor/testing/testing-model.js +393 -0
  175. package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
  176. package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
  177. package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
  178. package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
  179. package/dist/shared/components/layout-editor/usage/UsagePanel.js +158 -0
  180. package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
  181. package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
  182. package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -307
  183. package/dist/shared/components/support/SuggestFormChange.js +143 -0
  184. package/dist/shared/lib/ai-fill.js +37 -0
  185. package/dist/shared/lib/form-usage-beacon.js +84 -0
  186. package/dist/shared/lib/layout-i18n.js +66 -0
  187. package/dist/shared/lib/layout-lint.js +490 -0
  188. package/dist/shared/lib/layout-ops.js +110 -106
  189. package/dist/shared/lib/screenshot.js +54 -28
  190. package/dist/shared/lib/visible-when.js +34 -0
  191. package/package.json +1 -1
@@ -0,0 +1,20 @@
1
+ import { walk as a, KIND_WORDS as l } from "./tree.js";
2
+ function s(t) {
3
+ const o = t.trim().toLowerCase();
4
+ return (...r) => !o || r.some((i) => i == null ? void 0 : i.toLowerCase().includes(o));
5
+ }
6
+ function k(t, o, r = 50) {
7
+ if (!o.trim()) return [];
8
+ const i = s(o), d = o.trim().toLowerCase();
9
+ return a(t).filter((e) => e.node.target != null && i(e.node.label, e.node.key)).map((e) => ({
10
+ node: e.node,
11
+ where: e.path.map((n) => n.label).join(" › "),
12
+ rank: (e.node.kind === "field" || e.node.kind === "panel" || e.node.kind === "widget" ? 0 : 2) + (e.node.label.toLowerCase().includes(d) ? 0 : 1)
13
+ })).map((e, n) => ({ ...e, i: n })).sort((e, n) => e.rank - n.rank || e.i - n.i).slice(0, r).map(({ node: e, where: n }) => ({ node: e, where: n }));
14
+ }
15
+ const p = (t) => l[t.kind];
16
+ export {
17
+ k as findHits,
18
+ p as kindWord,
19
+ s as textMatcher
20
+ };
@@ -0,0 +1,142 @@
1
+ import { isCanvasSlot as b, UNGROUPED_KEY as c, HEADER_GROUP_KEY as y } from "../../../lib/layout-ops.js";
2
+ import { titleCase as w } from "../../../lib/utils.js";
3
+ import { targetKey as p } from "../design-context.js";
4
+ import { normalizedBundle as R } from "../field-zones.js";
5
+ import { readOverrides as x } from "../inspector/model.js";
6
+ import { slotName as U } from "../slot-names.js";
7
+ const D = {
8
+ header: "Header strip",
9
+ step: "Step",
10
+ tab: "Tab",
11
+ "steps-holder": "Steps holder",
12
+ "tabs-holder": "Tabs holder",
13
+ section: "Section",
14
+ text: "Text block",
15
+ info: "Record info",
16
+ ungrouped: "Ungrouped fields",
17
+ panel: "Panel",
18
+ widget: "Widget",
19
+ field: "Field"
20
+ };
21
+ function T(e, n) {
22
+ const o = /* @__PURE__ */ new Set(), r = e.groups.find((d) => d.key === c), s = e.groups.filter((d) => d.key !== c);
23
+ let u = e.placements;
24
+ if (n) {
25
+ const d = new Set(s.map((i) => i.key)), l = new Set(u.map((i) => i.field));
26
+ for (const i of n.groups)
27
+ i.key === c || d.has(i.key) || (s.push(i), o.add(p({ kind: "group", key: i.key })));
28
+ const f = n.placements.filter((i) => !l.has(i.field));
29
+ for (const i of f) o.add(p(v(i)));
30
+ u = [...u, ...f];
31
+ }
32
+ return { groups: s, placements: u, inherited: o, ungroupedSort: r ? r.sort : null };
33
+ }
34
+ function v(e) {
35
+ return e.group_key === y ? { kind: "header", field: e.field } : {
36
+ kind: e.field.startsWith("__") ? "slot" : "field",
37
+ field: e.field,
38
+ group_key: e.group_key
39
+ };
40
+ }
41
+ const S = (e) => [...e].sort((n, o) => n.sort - o.sort);
42
+ function K(e, n, o) {
43
+ return n.type === "tab" ? (o ? o.tab_mode : e.layout.tab_mode) === "steps" ? "step" : "tab" : n.type === "container" ? n.tab_mode === "steps" ? "steps-holder" : "tabs-holder" : n.type === "content" || n.type === "text" ? "text" : n.type === "metadata" ? "info" : "section";
44
+ }
45
+ const O = (e) => e.label || w(e.key);
46
+ function P(e, n) {
47
+ if (e.label_override) return e.label_override;
48
+ const o = x(e).label;
49
+ return typeof o == "string" && o ? o : e.field.startsWith("__") ? e.widget_id != null ? "Widget" : U(e.field) : n(e.field) || w(e.field.split(".").pop() ?? e.field);
50
+ }
51
+ function g(e, n, o) {
52
+ const r = v(e), s = e.field.startsWith("__");
53
+ return {
54
+ id: p(r),
55
+ target: r,
56
+ kind: s ? e.widget_id != null ? "widget" : "panel" : "field",
57
+ label: P(e, o),
58
+ key: e.field,
59
+ hidden: x(e).hidden === !0 || e.is_visible === !1,
60
+ inherited: n.inherited.has(p(r)),
61
+ children: []
62
+ };
63
+ }
64
+ function A(e, n, o) {
65
+ const r = T(R(e), n), s = (t) => S(r.placements.filter((a) => a.group_key === t && !b(a))).map(
66
+ (a) => g(a, r, o)
67
+ ), u = (t, a) => {
68
+ const k = { kind: "group", key: t.key }, N = t.type === "container" ? S(r.groups.filter((m) => m.parent_key === t.key)).map((m) => u(m, t)) : s(t.key);
69
+ return {
70
+ id: p(k),
71
+ target: k,
72
+ kind: K(e, t, a),
73
+ label: O(t),
74
+ key: t.key,
75
+ hidden: !1,
76
+ inherited: r.inherited.has(p(k)),
77
+ children: N
78
+ };
79
+ }, d = [], l = s(y), f = r.placements.find((t) => t.field === "__subtitle__");
80
+ if (l.length > 0 || f) {
81
+ const t = f ? [g(f, r, o), ...l] : l;
82
+ d.push({
83
+ id: "header",
84
+ target: null,
85
+ kind: "header",
86
+ label: D.header,
87
+ key: y,
88
+ hidden: !1,
89
+ inherited: !1,
90
+ children: t
91
+ });
92
+ }
93
+ const i = s(null).filter((t) => t.key !== "__subtitle__"), W = [
94
+ ...r.groups.filter((t) => t.parent_key === null).map((t) => ({ sort: t.sort, node: u(t, null) })),
95
+ ...r.placements.filter((t) => b(t)).map((t) => ({ sort: t.sort, node: g(t, r, o) }))
96
+ ], E = {
97
+ id: p({ kind: "group", key: c }),
98
+ target: { kind: "group", key: c },
99
+ kind: "ungrouped",
100
+ label: "Ungrouped",
101
+ key: c,
102
+ hidden: !1,
103
+ inherited: !1,
104
+ children: i
105
+ }, _ = [...W].sort((t, a) => t.sort - a.sort), h = _.map((t) => t.node);
106
+ if (i.length > 0) {
107
+ const t = r.ungroupedSort, a = t === null ? -1 : _.findIndex((k) => k.sort > t);
108
+ h.splice(a < 0 ? h.length : a, 0, E);
109
+ }
110
+ return [...d, ...h];
111
+ }
112
+ function C(e, n = []) {
113
+ const o = [];
114
+ for (const r of e)
115
+ o.push({ node: r, path: n }), o.push(...C(r.children, [...n, r]));
116
+ return o;
117
+ }
118
+ function B(e, n) {
119
+ var u;
120
+ const o = n.kind === "group" ? ((u = e.groups.find((d) => d.key === n.key)) == null ? void 0 : u.parent_key) ?? null : n.kind === "header" ? null : n.group_key, r = [];
121
+ let s = o;
122
+ for (let d = 0; s && s !== c && s !== y && d < 8; d++) {
123
+ const l = e.groups.find((i) => i.key === s);
124
+ if (!l) break;
125
+ const f = l.parent_key ? e.groups.find((i) => i.key === l.parent_key) ?? null : null;
126
+ r.unshift({
127
+ target: { kind: "group", key: l.key },
128
+ label: O(l),
129
+ kind: K(e, l, f)
130
+ }), s = l.parent_key;
131
+ }
132
+ return r;
133
+ }
134
+ export {
135
+ D as KIND_WORDS,
136
+ A as buildOutline,
137
+ B as crumbsOf,
138
+ K as groupKind,
139
+ P as placementLabel,
140
+ v as placementTarget,
141
+ C as walk
142
+ };
@@ -0,0 +1,101 @@
1
+ import { useState as l, useRef as h, useMemo as S, useCallback as y, useEffect as j } from "react";
2
+ import { toast as z } from "sonner";
3
+ import { targetKey as B } from "../design-context.js";
4
+ import { isTyping as G } from "../is-typing.js";
5
+ import { buildOutline as J } from "./tree.js";
6
+ import { useViewPref as A } from "./view-prefs.js";
7
+ function Q(a, s, f, d) {
8
+ let r = 0;
9
+ const c = () => {
10
+ const i = document.querySelector(
11
+ `[data-layout-editor] [data-editor-canvas] [data-design-target="${CSS.escape(a)}"]`
12
+ );
13
+ if (i) return f(i);
14
+ r++, d(r), r < s && window.setTimeout(c, 120);
15
+ };
16
+ requestAnimationFrame(c);
17
+ }
18
+ function te({
19
+ bodyRef: a,
20
+ bundle: s,
21
+ parent: f,
22
+ fields: d,
23
+ onSelect: r,
24
+ showHidden: c,
25
+ setShowHidden: i,
26
+ canvasShown: C
27
+ }) {
28
+ const [_, b] = l(null), [L, x] = l(null), [D, p] = l(!1), [H, M] = l(0), [P, k] = l(!1), [R, T] = A("outline"), [V, I] = A("compact"), m = h(0), K = h(c);
29
+ K.current = c;
30
+ const q = S(() => {
31
+ const t = new Map(d.map((e) => [e.field, e.label ?? null]));
32
+ return (e) => t.get(e);
33
+ }, [d]), E = S(
34
+ () => s ? J(s, f, q) : [],
35
+ [s, f, q]
36
+ ), w = y(
37
+ (t, e) => {
38
+ if (r(t, e), m.current += 1, x({ target: t, seq: m.current }), !C) return;
39
+ const n = (t.kind === "field" || t.kind === "slot" && t.group_key !== null) && t.field !== "__subtitle__";
40
+ let g = !1;
41
+ Q(
42
+ B(t),
43
+ 14,
44
+ (o) => {
45
+ var u;
46
+ (u = o.scrollIntoView) == null || u.call(o, { block: "center" }), e != null && e.focus && o.focus({ preventScroll: !0 });
47
+ },
48
+ (o) => {
49
+ o === 4 && n && !K.current && !g && (g = !0, i(!0), z.info("Show hidden is on: what you picked is hidden on this form"));
50
+ }
51
+ );
52
+ },
53
+ [r, i, C]
54
+ ), v = h(!1), N = y((t) => {
55
+ v.current && (v.current = !1, t.preventDefault());
56
+ }, []), $ = y(
57
+ (t) => {
58
+ t.node.target && (v.current = !0, p(!1), w(t.node.target, { focus: !0 }));
59
+ },
60
+ [w]
61
+ ), F = y((t) => {
62
+ m.current += 1, b({ open: t, seq: m.current });
63
+ }, []);
64
+ return j(() => {
65
+ const t = (e) => {
66
+ var o, u;
67
+ const n = e.target instanceof HTMLElement ? e.target : null;
68
+ if (!(!(!n || n === document.body || n === document.documentElement || (o = a.current) != null && o.contains(n) || (u = n.closest) != null && u.call(n, "[data-radix-popper-content-wrapper]")) || e.defaultPrevented)) {
69
+ if ((e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === "f") {
70
+ e.preventDefault(), k(!1), p(!0), M((O) => O + 1);
71
+ return;
72
+ }
73
+ e.key === "?" && !e.metaKey && !e.ctrlKey && !e.altKey && !G(n) && (e.preventDefault(), p(!1), k((O) => !O));
74
+ }
75
+ };
76
+ return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
77
+ }, [a]), {
78
+ nodes: E,
79
+ fold: _,
80
+ reveal: L,
81
+ selectAndReveal: w,
82
+ expandAll: () => F(!0),
83
+ collapseAll: () => F(!1),
84
+ find: {
85
+ open: D,
86
+ onOpenChange: p,
87
+ nodes: E,
88
+ onPick: $,
89
+ focusSeq: H,
90
+ onCloseAutoFocus: N
91
+ },
92
+ shortcuts: { open: P, onOpenChange: k },
93
+ outlineOpen: R,
94
+ setOutlineOpen: T,
95
+ compact: V,
96
+ setCompact: I
97
+ };
98
+ }
99
+ export {
100
+ te as useEditorNav
101
+ };
@@ -0,0 +1,34 @@
1
+ import { useState as a, useCallback as l } from "react";
2
+ const o = {
3
+ compact: "nvr_layout_editor_compact",
4
+ outline: "nvr_layout_editor_outline"
5
+ };
6
+ function i(t) {
7
+ try {
8
+ return localStorage.getItem(o[t]) === "1";
9
+ } catch {
10
+ return !1;
11
+ }
12
+ }
13
+ function u(t, e) {
14
+ try {
15
+ e ? localStorage.setItem(o[t], "1") : localStorage.removeItem(o[t]);
16
+ } catch {
17
+ }
18
+ }
19
+ function f(t) {
20
+ const [e, c] = a(() => i(t)), n = l(
21
+ (r) => {
22
+ c(r), u(t, r);
23
+ },
24
+ [t]
25
+ );
26
+ return [e, n];
27
+ }
28
+ const m = 0.8;
29
+ export {
30
+ m as COMPACT_ZOOM,
31
+ i as readViewPref,
32
+ f as useViewPref,
33
+ u as writeViewPref
34
+ };
@@ -0,0 +1,143 @@
1
+ import { jsx as t, jsxs as r, Fragment as v } from "react/jsx-runtime";
2
+ import { useQueryClient as N } from "@tanstack/react-query";
3
+ import { Loader2 as b, ExternalLink as w } from "lucide-react";
4
+ import { useState as p } from "react";
5
+ import { toast as x } from "sonner";
6
+ import { useNivaroClient as q } from "../../../context.js";
7
+ import { cn as y, formatRelative as C } from "../../../lib/utils.js";
8
+ import { useLayoutEditorHost as _ } from "../host.js";
9
+ import { LoadError as L } from "../load-error.js";
10
+ import { apiFailure as R } from "../overview/overview-api.js";
11
+ import { useChangeRequests as D, resolveChangeRequest as E, opsKeys as K } from "./ops-api.js";
12
+ const c = "inline-flex h-7 items-center gap-1 whitespace-nowrap rounded-md border border-slate-200 bg-white px-2 text-[12px] font-medium text-slate-700 transition-colors hover:bg-slate-50 disabled:opacity-50 dark:border-border dark:bg-card dark:text-foreground dark:hover:bg-muted";
13
+ function G({
14
+ collection: e,
15
+ layoutId: s,
16
+ className: m
17
+ }) {
18
+ const { data: l, isLoading: u, isError: n, refetch: i } = D(e), o = (l ?? []).filter((a) => a.layout_id === s), d = (l ?? []).filter((a) => a.layout_id !== s);
19
+ return /* @__PURE__ */ t("div", { className: y("space-y-2", m), "data-change-requests": s, children: u ? /* @__PURE__ */ t(b, { className: "h-3.5 w-3.5 animate-spin text-slate-400" }) : n ? /* @__PURE__ */ t(L, { what: "the suggested changes", onRetry: () => void i() }) : o.length === 0 && d.length === 0 ? /* @__PURE__ */ t(
20
+ "p",
21
+ {
22
+ className: "text-[12px] text-slate-500 dark:text-muted-foreground",
23
+ "data-change-requests-empty": !0,
24
+ children: "No suggested changes. People send them from a record’s More menu → Suggest a form change."
25
+ }
26
+ ) : /* @__PURE__ */ r(v, { children: [
27
+ o.length === 0 && /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "None about this form." }),
28
+ o.map((a) => /* @__PURE__ */ t(f, { r: a, collection: e }, a.id)),
29
+ d.length > 0 && /* @__PURE__ */ r("details", { className: "group", children: [
30
+ /* @__PURE__ */ r("summary", { className: "cursor-pointer text-[12px] font-medium text-slate-600 dark:text-muted-foreground", children: [
31
+ d.length,
32
+ " about other forms of this collection"
33
+ ] }),
34
+ /* @__PURE__ */ t("div", { className: "mt-1.5 space-y-2", children: d.map((a) => /* @__PURE__ */ t(f, { r: a, collection: e }, a.id)) })
35
+ ] })
36
+ ] }) });
37
+ }
38
+ function f({ r: e, collection: s }) {
39
+ const m = q(), l = N(), u = _(), [n, i] = p(null), [o, d] = p(""), [a, g] = p(!1), k = async () => {
40
+ if (n) {
41
+ g(!0);
42
+ try {
43
+ await E(m, e.id, n, o.trim()), x.success(
44
+ n === "accept" ? "Marked done — they were told" : "Declined — they were told"
45
+ ), l.invalidateQueries({ queryKey: K.requests(s) }), l.invalidateQueries({ queryKey: ["support-tickets"] });
46
+ } catch (h) {
47
+ x.error(R(h, "Could not close the suggestion").message);
48
+ } finally {
49
+ g(!1);
50
+ }
51
+ }
52
+ };
53
+ return /* @__PURE__ */ r(
54
+ "div",
55
+ {
56
+ className: "rounded-md border border-slate-200 bg-white p-2.5 text-[12.5px] dark:border-border dark:bg-card",
57
+ "data-change-request": e.id,
58
+ children: [
59
+ /* @__PURE__ */ t("p", { className: "whitespace-pre-wrap break-words text-slate-800 dark:text-foreground", children: e.message || e.title }),
60
+ /* @__PURE__ */ r("div", { className: "mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
61
+ e.field && /* @__PURE__ */ t("span", { className: "rounded bg-slate-100 px-1.5 py-px text-slate-700 dark:bg-white/10 dark:text-foreground", children: e.field_label ?? e.field }),
62
+ e.layout_name && e.layout_id != null && /* @__PURE__ */ r("span", { children: [
63
+ "on “",
64
+ e.layout_name,
65
+ "”"
66
+ ] }),
67
+ /* @__PURE__ */ t("span", { children: e.requester_name ?? "Someone" }),
68
+ e.created_at && /* @__PURE__ */ t("span", { children: C(e.created_at) }),
69
+ /* @__PURE__ */ r(
70
+ "a",
71
+ {
72
+ href: u.recordLink(s, e.item),
73
+ target: "_blank",
74
+ rel: "noreferrer",
75
+ className: "inline-flex items-center gap-0.5 text-[#0089ad] hover:underline dark:text-nvr-cyan",
76
+ children: [
77
+ e.record_label,
78
+ /* @__PURE__ */ t(w, { className: "h-3 w-3" })
79
+ ]
80
+ }
81
+ )
82
+ ] }),
83
+ n ? /* @__PURE__ */ r("div", { className: "mt-2 space-y-1.5", children: [
84
+ /* @__PURE__ */ t(
85
+ "textarea",
86
+ {
87
+ value: o,
88
+ onChange: (h) => d(h.target.value),
89
+ rows: 2,
90
+ placeholder: n === "accept" ? "Optional: what changed" : "Optional: why not",
91
+ "aria-label": "Note to the requester",
92
+ className: "w-full rounded-md border border-slate-200 bg-white px-2 py-1.5 text-[12.5px] text-slate-900 outline-none focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-foreground"
93
+ }
94
+ ),
95
+ /* @__PURE__ */ r("div", { className: "flex gap-1.5", children: [
96
+ /* @__PURE__ */ r(
97
+ "button",
98
+ {
99
+ type: "button",
100
+ className: y(
101
+ c,
102
+ n === "accept" ? "border-nvr-cyan/60 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-red-200 text-red-700 dark:border-red-500/40 dark:text-red-300"
103
+ ),
104
+ disabled: a,
105
+ onClick: () => void k(),
106
+ "data-change-request-confirm": n,
107
+ children: [
108
+ a && /* @__PURE__ */ t(b, { className: "h-3 w-3 animate-spin" }),
109
+ n === "accept" ? "Mark done and tell them" : "Decline and tell them"
110
+ ]
111
+ }
112
+ ),
113
+ /* @__PURE__ */ t("button", { type: "button", className: c, onClick: () => i(null), children: "Cancel" })
114
+ ] })
115
+ ] }) : /* @__PURE__ */ r("div", { className: "mt-2 flex gap-1.5", children: [
116
+ /* @__PURE__ */ t(
117
+ "button",
118
+ {
119
+ type: "button",
120
+ className: c,
121
+ onClick: () => i("accept"),
122
+ "data-change-request-accept": e.id,
123
+ children: "Accept"
124
+ }
125
+ ),
126
+ /* @__PURE__ */ t(
127
+ "button",
128
+ {
129
+ type: "button",
130
+ className: c,
131
+ onClick: () => i("decline"),
132
+ "data-change-request-decline": e.id,
133
+ children: "Decline"
134
+ }
135
+ )
136
+ ] })
137
+ ]
138
+ }
139
+ );
140
+ }
141
+ export {
142
+ G as ChangeRequestsPanel
143
+ };
@@ -0,0 +1,179 @@
1
+ import { jsxs as a, jsx as o, Fragment as _ } from "react/jsx-runtime";
2
+ import { useRef as M, useState as R, useCallback as B, useLayoutEffect as E } from "react";
3
+ import { cn as c } from "../../../lib/utils.js";
4
+ import { Skeleton as S } from "../../ui/skeleton.js";
5
+ import { LoadError as A } from "../load-error.js";
6
+ import { useLayoutDependencies as F } from "./ops-api.js";
7
+ const O = {
8
+ grouped: "Form",
9
+ summary: "Summary",
10
+ detail: "Drill-down",
11
+ file: "PDF",
12
+ addendum: "Addendum",
13
+ table: "Grid columns"
14
+ };
15
+ function v(t, r) {
16
+ return !r || r === "rename" ? !1 : t.breaks.includes(r);
17
+ }
18
+ function j(t, r) {
19
+ const s = t.length;
20
+ if (s === 0) return "Nothing stored here uses this form.";
21
+ const l = `${s} ${s === 1 ? "thing uses" : "things use"} this form`;
22
+ if (!r) return `${l}.`;
23
+ if (r === "rename")
24
+ return `${l}. Renaming keeps every one working: they find it by its id or link name.`;
25
+ const i = t.filter((m) => v(m, r)).length;
26
+ return i === 0 ? `${l}. None of them depends on what you are changing.` : `${i} of ${s} ${r === "slug" ? "find it by its link name and stop finding it when the link name changes" : r === "type" ? "expect this kind of layout and may stop working as another kind" : "stop working when it is deleted"}.`;
27
+ }
28
+ function H({
29
+ layoutId: t,
30
+ change: r,
31
+ className: s,
32
+ compact: l
33
+ }) {
34
+ const { data: i, isLoading: u, isError: m, refetch: h } = F(t);
35
+ return u ? /* @__PURE__ */ a("div", { className: c("space-y-2", s), "data-dependency-diagram": "loading", children: [
36
+ /* @__PURE__ */ o(S, { className: "h-4 w-2/3" }),
37
+ /* @__PURE__ */ o(S, { className: "h-20 w-full" })
38
+ ] }) : m || !i ? /* @__PURE__ */ o(A, { what: "what uses this form", onRetry: () => void h(), className: s }) : /* @__PURE__ */ o(P, { data: i, change: r, className: s, compact: l });
39
+ }
40
+ function P({
41
+ data: t,
42
+ change: r,
43
+ className: s,
44
+ compact: l
45
+ }) {
46
+ const i = M(null), u = M(null), [m, h] = R([]), [w, z] = R({ w: 0, h: 0 }), L = t.groups.map((e) => ({ ...e, nodes: t.nodes.filter((n) => n.group === e.id) })).filter((e) => e.nodes.length > 0 || e.id === "extensions"), f = B(() => {
47
+ const e = i.current, n = u.current;
48
+ if (!e || !n) return;
49
+ const d = e.getBoundingClientRect(), p = n.getBoundingClientRect(), x = Math.floor(p.right - d.left), N = Math.floor(p.top - d.top + p.height / 2), g = [];
50
+ for (const k of e.querySelectorAll("[data-dep-node]")) {
51
+ const b = k.getBoundingClientRect(), y = Math.floor(b.left - d.left), $ = Math.floor(b.top - d.top + b.height / 2), D = Math.max(12, (y - x) / 2);
52
+ g.push({
53
+ key: k.dataset.depNode ?? String(g.length),
54
+ broken: k.dataset.broken === "true",
55
+ d: `M ${x} ${N} C ${x + D} ${N}, ${y - D} ${$}, ${y} ${$}`
56
+ });
57
+ }
58
+ h(g), z({ w: Math.floor(d.width), h: Math.floor(d.height) });
59
+ }, []);
60
+ E(() => {
61
+ f();
62
+ const e = i.current;
63
+ if (!e || typeof ResizeObserver > "u") return;
64
+ const n = new ResizeObserver(() => f());
65
+ return n.observe(e), () => n.disconnect();
66
+ }, [f, t, r]);
67
+ const C = t.nodes.filter((e) => v(e, r)).length;
68
+ return /* @__PURE__ */ a("div", { className: c("space-y-2", s), "data-dependency-diagram": t.layout.id, children: [
69
+ /* @__PURE__ */ o(
70
+ "p",
71
+ {
72
+ className: c(
73
+ "text-[12px]",
74
+ C ? "font-medium text-red-700 dark:text-red-300" : "text-slate-600 dark:text-muted-foreground"
75
+ ),
76
+ "data-dependency-summary": !0,
77
+ children: j(t.nodes, r)
78
+ }
79
+ ),
80
+ /* @__PURE__ */ a(
81
+ "div",
82
+ {
83
+ ref: i,
84
+ className: c(
85
+ "relative grid items-center",
86
+ l ? "grid-cols-[96px_1fr] gap-x-7" : "grid-cols-[minmax(120px,28%)_1fr] gap-x-12"
87
+ ),
88
+ children: [
89
+ /* @__PURE__ */ o(
90
+ "svg",
91
+ {
92
+ "aria-hidden": "true",
93
+ className: "pointer-events-none absolute inset-0 overflow-visible",
94
+ width: w.w,
95
+ height: w.h,
96
+ children: m.map((e) => /* @__PURE__ */ o(
97
+ "path",
98
+ {
99
+ d: e.d,
100
+ fill: "none",
101
+ strokeWidth: e.broken ? 1.75 : 1.25,
102
+ strokeDasharray: e.key.startsWith("ext-unchecked") ? "3 3" : void 0,
103
+ className: e.broken ? "stroke-red-400 dark:stroke-red-400/80" : "stroke-slate-300 dark:stroke-slate-600"
104
+ },
105
+ e.key
106
+ ))
107
+ }
108
+ ),
109
+ /* @__PURE__ */ a(
110
+ "div",
111
+ {
112
+ ref: u,
113
+ className: "relative z-[1] rounded-lg border border-nvr-cyan/60 bg-nvr-cyan/10 px-2.5 py-2 text-[12px]",
114
+ "data-dep-source": !0,
115
+ children: [
116
+ /* @__PURE__ */ o("div", { className: "font-semibold leading-tight text-slate-900 dark:text-foreground", children: t.layout.name }),
117
+ /* @__PURE__ */ a("div", { className: "mt-0.5 text-[11px] text-slate-600 dark:text-muted-foreground", children: [
118
+ O[t.layout.layout_type] ?? t.layout.layout_type,
119
+ t.layout.slug ? /* @__PURE__ */ a(_, { children: [
120
+ " · ",
121
+ /* @__PURE__ */ o("code", { className: "font-mono", children: t.layout.slug })
122
+ ] }) : null
123
+ ] })
124
+ ]
125
+ }
126
+ ),
127
+ /* @__PURE__ */ o("div", { className: "relative z-[1] min-w-0 space-y-2.5 py-1", children: L.map((e) => /* @__PURE__ */ a("div", { "data-dep-lane": e.id, children: [
128
+ /* @__PURE__ */ o("div", { className: "mb-1 text-[11px] font-medium text-slate-500 dark:text-muted-foreground", children: e.label }),
129
+ /* @__PURE__ */ a("div", { className: "space-y-1", children: [
130
+ e.nodes.map((n) => {
131
+ const d = v(n, r);
132
+ return /* @__PURE__ */ a(
133
+ "div",
134
+ {
135
+ "data-dep-node": `${n.kind}:${n.id}`,
136
+ "data-broken": d,
137
+ className: c(
138
+ "rounded-md border px-2 py-1 text-[12px] leading-snug",
139
+ d ? "border-red-300 bg-red-50 text-red-900 dark:border-red-500/40 dark:bg-red-500/10 dark:text-red-200" : "border-slate-200 bg-white text-slate-700 dark:border-border dark:bg-card dark:text-foreground"
140
+ ),
141
+ children: [
142
+ /* @__PURE__ */ o("span", { className: "break-words", children: n.label }),
143
+ /* @__PURE__ */ o(
144
+ "span",
145
+ {
146
+ className: c(
147
+ "ml-1.5 whitespace-nowrap text-[10.5px]",
148
+ d ? "text-red-700 dark:text-red-300" : "text-slate-400 dark:text-muted-foreground"
149
+ ),
150
+ children: d ? "breaks" : `by ${n.by === "slug" ? "link name" : n.by === "id" ? "id" : "id or link name"}`
151
+ }
152
+ )
153
+ ]
154
+ },
155
+ `${n.kind}:${n.id}`
156
+ );
157
+ }),
158
+ e.id === "extensions" && /* @__PURE__ */ o(
159
+ "div",
160
+ {
161
+ "data-dep-node": "ext-unchecked",
162
+ "data-broken": "false",
163
+ className: "rounded-md border border-dashed border-slate-300 px-2 py-1 text-[11.5px] text-slate-500 dark:border-border dark:text-muted-foreground",
164
+ children: t.extensions.note
165
+ }
166
+ )
167
+ ] })
168
+ ] }, e.id)) })
169
+ ]
170
+ }
171
+ )
172
+ ] });
173
+ }
174
+ export {
175
+ H as DependencyDiagram,
176
+ P as DependencyDiagramView,
177
+ v as breaksOn,
178
+ j as impactSentence
179
+ };