@nivaro/react 0.2.53 → 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 +113 -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 +4058 -3942
  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
@@ -1,146 +1,166 @@
1
- import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
- import { Search as w, X as T } from "lucide-react";
3
- import { useState as B, useMemo as m, useCallback as F } from "react";
4
- import { cn as p } from "../../../lib/utils.js";
5
- import { PanelHeader as q } from "../panel-frame.js";
6
- import { groupTitle as A } from "../panel-style.js";
7
- import { AddendumSection as I } from "./AddendumSection.js";
8
- import { ButtonsSection as M } from "./ButtonsSection.js";
9
- import { inputCls as O, quietText as P, VisibleSettingsContext as R } from "./controls.js";
10
- import { DefaultsSection as _ } from "./DefaultsSection.js";
11
- import { InheritanceSection as j } from "./InheritanceSection.js";
12
- import { LayoutSection as D } from "./LayoutSection.js";
13
- import { PdfSection as E } from "./PdfSection.js";
14
- import { ReadSection as W } from "./ReadSection.js";
15
- import { layoutKindOf as $, visibleSections as z } from "./settings-registry.js";
16
- import { ToolsSection as H } from "./ToolsSection.js";
17
- import { WhoSection as K } from "./WhoSection.js";
18
- const L = {
19
- who: K,
20
- layout: D,
21
- buttons: M,
22
- read: W,
23
- pdf: E,
24
- addendum: I,
25
- defaults: _,
26
- inheritance: j,
27
- tools: H
1
+ import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
+ import { Search as T, X as B, MessageCircleQuestion as F } from "lucide-react";
3
+ import { useState as M, useMemo as c, useCallback as q } from "react";
4
+ import { cn as u } from "../../../lib/utils.js";
5
+ import { isWhereQuestion as I } from "../assist/settings-index.js";
6
+ import { PanelHeader as O } from "../panel-frame.js";
7
+ import { groupTitle as P } from "../panel-style.js";
8
+ import { AddendumSection as Q } from "./AddendumSection.js";
9
+ import { ButtonsSection as R } from "./ButtonsSection.js";
10
+ import { inputCls as _, quietText as j, VisibleSettingsContext as A } from "./controls.js";
11
+ import { DefaultsSection as D } from "./DefaultsSection.js";
12
+ import { InheritanceSection as E } from "./InheritanceSection.js";
13
+ import { LayoutSection as L } from "./LayoutSection.js";
14
+ import { PdfSection as W } from "./PdfSection.js";
15
+ import { ReadSection as $ } from "./ReadSection.js";
16
+ import { layoutKindOf as z, visibleSections as H } from "./settings-registry.js";
17
+ import { ToolsSection as K } from "./ToolsSection.js";
18
+ import { WhoSection as V } from "./WhoSection.js";
19
+ const X = {
20
+ who: V,
21
+ layout: L,
22
+ buttons: R,
23
+ read: $,
24
+ pdf: W,
25
+ addendum: Q,
26
+ defaults: D,
27
+ inheritance: E,
28
+ tools: K
28
29
  };
29
- function dt({
30
- bundle: r,
31
- apply: c,
32
- flush: n,
33
- collection: u,
34
- onPreviewRole: g,
35
- previewRoleId: y,
36
- onPreviewRoleChange: S
30
+ function pt({
31
+ bundle: a,
32
+ apply: d,
33
+ flush: m,
34
+ collection: p,
35
+ onPreviewRole: y,
36
+ previewRoleId: x,
37
+ onPreviewRoleChange: v,
38
+ onAskWhere: f
37
39
  }) {
38
- const [a, f] = B(""), i = $(r.layout), l = m(() => z(i, a), [i, a]), x = m(
39
- () => new Set(l.flatMap((t) => t.settings.map((e) => e.key))),
40
- [l]
41
- ), h = F(() => n == null ? void 0 : n(), [n]), v = m(
40
+ const [r, h] = M(""), s = z(a.layout), n = c(() => H(s, r), [s, r]), S = c(
41
+ () => new Set(n.flatMap((t) => t.settings.map((e) => e.key))),
42
+ [n]
43
+ ), b = q(() => m == null ? void 0 : m(), [m]), k = c(
42
44
  () => ({
43
- bundle: r,
44
- layout: r.layout,
45
- kind: i,
46
- collection: u,
47
- set: (t, e, s) => c(
45
+ bundle: a,
46
+ layout: a.layout,
47
+ kind: s,
48
+ collection: p,
49
+ set: (t, e, l) => d(
48
50
  [{ op: "layout_update", patch: t }],
49
- (s == null ? void 0 : s.undoable) === !1 ? { label: e, undoable: !1 } : { label: e }
51
+ (l == null ? void 0 : l.undoable) === !1 ? { label: e, undoable: !1 } : { label: e }
50
52
  ),
51
- setText: (t, e) => c([{ op: "layout_update", patch: t }], { label: e, text: !0 }),
52
- flush: h
53
+ setText: (t, e) => d([{ op: "layout_update", patch: t }], { label: e, text: !0 }),
54
+ flush: b,
55
+ apply: (t, e) => d(t, e)
53
56
  }),
54
- [r, i, u, c, h]
55
- ), k = typeof r.layout.name == "string" ? r.layout.name : "", N = (t) => {
56
- const e = t.currentTarget, s = e.getBoundingClientRect().top;
57
- for (const b of e.querySelectorAll("[data-section-title]")) {
58
- const C = e.scrollTop > 0 && Math.abs(b.getBoundingClientRect().top - s) < 1;
59
- b.toggleAttribute("data-stuck", C);
57
+ [a, s, p, d, b]
58
+ ), N = typeof a.layout.name == "string" ? a.layout.name : "", C = (t) => {
59
+ const e = t.currentTarget, l = e.getBoundingClientRect().top;
60
+ for (const g of e.querySelectorAll("[data-section-title]")) {
61
+ const w = e.scrollTop > 0 && Math.abs(g.getBoundingClientRect().top - l) < 1;
62
+ g.toggleAttribute("data-stuck", w);
60
63
  }
61
64
  };
62
- return /* @__PURE__ */ d("div", { className: "flex h-full min-h-0 flex-col", "data-form-settings": i, children: [
65
+ return /* @__PURE__ */ i("div", { className: "flex h-full min-h-0 flex-col", "data-form-settings": s, children: [
63
66
  /* @__PURE__ */ o(
64
- q,
67
+ O,
65
68
  {
66
69
  eyebrow: "Form settings",
67
- title: k || "This form",
70
+ title: N || "This form",
68
71
  sub: "Who gets this form and how it behaves",
69
- children: /* @__PURE__ */ d("div", { className: "relative", children: [
70
- /* @__PURE__ */ o(w, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
72
+ children: /* @__PURE__ */ i("div", { className: "relative", children: [
73
+ /* @__PURE__ */ o(T, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
71
74
  /* @__PURE__ */ o(
72
75
  "input",
73
76
  {
74
- value: a,
75
- onChange: (t) => f(t.target.value),
77
+ value: r,
78
+ onChange: (t) => h(t.target.value),
76
79
  placeholder: "Find a setting…",
77
80
  "aria-label": "Find a setting",
78
81
  "data-settings-search": !0,
79
- className: p(O, "pl-8 pr-8")
82
+ className: u(_, "pl-8 pr-8")
80
83
  }
81
84
  ),
82
- a && /* @__PURE__ */ o(
85
+ r && /* @__PURE__ */ o(
83
86
  "button",
84
87
  {
85
88
  type: "button",
86
89
  "aria-label": "Clear search",
87
- onClick: () => f(""),
90
+ onClick: () => h(""),
88
91
  className: "absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 text-slate-400 hover:text-slate-700 dark:hover:text-foreground",
89
- children: /* @__PURE__ */ o(T, { className: "h-3.5 w-3.5" })
92
+ children: /* @__PURE__ */ o(B, { className: "h-3.5 w-3.5" })
90
93
  }
91
94
  )
92
95
  ] })
93
96
  }
94
97
  ),
95
- /* @__PURE__ */ o(
98
+ /* @__PURE__ */ i(
96
99
  "div",
97
100
  {
98
101
  "data-panel-body": "",
99
- onScroll: N,
102
+ onScroll: C,
100
103
  className: "min-h-0 flex-1 overflow-y-auto px-4 pb-8",
101
- children: l.length === 0 ? /* @__PURE__ */ d("p", { className: p("py-8 text-center", P), children: [
102
- "No setting matches “",
103
- a.trim(),
104
- "”."
105
- ] }) : /* @__PURE__ */ o(R.Provider, { value: x, children: l.map(({ section: t }) => {
106
- const e = L[t.id];
107
- return /* @__PURE__ */ d(
108
- "section",
104
+ children: [
105
+ f && r.trim() && (n.length === 0 || I(r)) && /* @__PURE__ */ i(
106
+ "button",
109
107
  {
110
- "data-section": t.id,
111
- "aria-labelledby": `form-settings-${t.id}`,
112
- className: "border-t border-slate-100 pb-6 first:border-t-0 dark:border-border/60",
108
+ type: "button",
109
+ "data-settings-ask": "",
110
+ onClick: () => f(r.trim()),
111
+ className: "mt-3 inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[12px] font-medium text-slate-600 transition-colors hover:bg-muted hover:text-slate-900 dark:text-muted-foreground dark:hover:text-foreground",
113
112
  children: [
114
- /* @__PURE__ */ o(
115
- "h3",
116
- {
117
- id: `form-settings-${t.id}`,
118
- "data-section-title": "",
119
- className: p(
120
- A,
121
- "sticky top-0 z-10 -mx-4 border-b border-transparent bg-white px-4 pb-3 pt-4 data-[stuck]:border-slate-200 dark:bg-card dark:data-[stuck]:border-border"
122
- ),
123
- children: t.title
124
- }
125
- ),
126
- /* @__PURE__ */ o("div", { className: "space-y-5", children: /* @__PURE__ */ o(
127
- e,
128
- {
129
- ...v,
130
- onPreviewRole: g,
131
- previewRoleId: y,
132
- onPreviewRoleChange: S
133
- }
134
- ) })
113
+ /* @__PURE__ */ o(F, { className: "h-3.5 w-3.5 text-nvr-cyan" }),
114
+ "Look everywhere for “",
115
+ r.trim(),
116
+ "”"
135
117
  ]
136
- },
137
- t.id
138
- );
139
- }) })
118
+ }
119
+ ),
120
+ n.length === 0 ? /* @__PURE__ */ i("p", { className: u("py-8 text-center", j), children: [
121
+ "No setting matches “",
122
+ r.trim(),
123
+ "”."
124
+ ] }) : /* @__PURE__ */ o(A.Provider, { value: S, children: n.map(({ section: t }) => {
125
+ const e = X[t.id];
126
+ return /* @__PURE__ */ i(
127
+ "section",
128
+ {
129
+ "data-section": t.id,
130
+ "aria-labelledby": `form-settings-${t.id}`,
131
+ className: "border-t border-slate-100 pb-6 first:border-t-0 dark:border-border/60",
132
+ children: [
133
+ /* @__PURE__ */ o(
134
+ "h3",
135
+ {
136
+ id: `form-settings-${t.id}`,
137
+ "data-section-title": "",
138
+ className: u(
139
+ P,
140
+ "sticky top-0 z-10 -mx-4 border-b border-transparent bg-white px-4 pb-3 pt-4 data-[stuck]:border-slate-200 dark:bg-card dark:data-[stuck]:border-border"
141
+ ),
142
+ children: t.title
143
+ }
144
+ ),
145
+ /* @__PURE__ */ o("div", { className: "space-y-5", children: /* @__PURE__ */ o(
146
+ e,
147
+ {
148
+ ...k,
149
+ onPreviewRole: y,
150
+ previewRoleId: x,
151
+ onPreviewRoleChange: v
152
+ }
153
+ ) })
154
+ ]
155
+ },
156
+ t.id
157
+ );
158
+ }) })
159
+ ]
140
160
  }
141
161
  )
142
162
  ] });
143
163
  }
144
164
  export {
145
- dt as FormSettings
165
+ pt as FormSettings
146
166
  };
@@ -27,7 +27,7 @@ function L(o) {
27
27
  e.map((t) => t.name).join(", "),
28
28
  " ",
29
29
  e.length === 1 ? "inherits" : "inherit",
30
- " from this layout, so it cannot inherit from another."
30
+ " from this form, so it cannot inherit from another."
31
31
  ] }) : null
32
32
  }
33
33
  );
@@ -1,47 +1,91 @@
1
- import { jsxs as m, Fragment as b, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as h, Fragment as S, jsx as t } from "react/jsx-runtime";
2
2
  import { useQuery as C } from "@tanstack/react-query";
3
- import { ExternalLink as I } from "lucide-react";
4
- import { useState as x, useRef as R, useEffect as N } from "react";
5
- import { useNivaroClient as P } from "../../../context.js";
6
- import { get as A } from "../../../lib/commands.js";
7
- import { cn as p } from "../../../lib/utils.js";
8
- import { HistoryPanel as L } from "../HistoryPanel.js";
3
+ import { ExternalLink as $ } from "lucide-react";
4
+ import { useState as N, useRef as I, useEffect as x, useMemo as L } from "react";
5
+ import { useNivaroClient as R } from "../../../context.js";
6
+ import { get as T } from "../../../lib/commands.js";
7
+ import { applyLayoutOps as E } from "../../../lib/layout-ops.js";
8
+ import { cn as g } from "../../../lib/utils.js";
9
+ import { AiTextTools as O } from "../ai-text/AiTextTools.js";
10
+ import { HistoryPanel as P } from "../HistoryPanel.js";
9
11
  import { useLayoutEditorHost as _ } from "../host.js";
10
- import { useRoleNames as T } from "../overview/overview-api.js";
11
- import { tintCard as q, labelText as E } from "../panel-style.js";
12
- import { RelationPicker as F } from "../pickers/relation-picker.js";
13
- import { Setting as y, smallBtn as S, quietText as f, PickList as j, useSettingVisible as g } from "./controls.js";
14
- import { useRolePreview as D } from "./settings-api.js";
15
- import { settingDef as v } from "./settings-registry.js";
16
- function le(t) {
17
- const l = Number(t.layout.id);
18
- return /* @__PURE__ */ m(b, { children: [
19
- /* @__PURE__ */ e(H, { ...t }),
20
- /* @__PURE__ */ e(B, { ...t }),
21
- /* @__PURE__ */ e(k, { k: "tool.describe", layoutId: l }),
22
- /* @__PURE__ */ e(k, { k: "tool.ai_review", layoutId: l }),
23
- /* @__PURE__ */ e(K, { layoutId: l }),
24
- /* @__PURE__ */ e(Q, { layoutId: l })
12
+ import { LayoutOpsBlocks as q } from "../ops/LayoutOpsBlocks.js";
13
+ import { useRoleNames as F } from "../overview/overview-api.js";
14
+ import { tintCard as H, labelText as j } from "../panel-style.js";
15
+ import { RelationPicker as B } from "../pickers/relation-picker.js";
16
+ import { CostLimitSetting as D } from "../testing/CostLimitSetting.js";
17
+ import { humanizeOpError as z } from "../useLayoutDraft.js";
18
+ import { Setting as y, smallBtn as A, quietText as m, PickList as G, useSettingVisible as v, Segmented as K } from "./controls.js";
19
+ import { useRolePreview as M } from "./settings-api.js";
20
+ import { settingDef as k } from "./settings-registry.js";
21
+ function Ne(e) {
22
+ const r = Number(e.layout.id);
23
+ return /* @__PURE__ */ h(S, { children: [
24
+ /* @__PURE__ */ t(V, { ...e }),
25
+ /* @__PURE__ */ t(J, { ...e }),
26
+ /* @__PURE__ */ t(b, { k: "tool.describe", layoutId: r }),
27
+ /* @__PURE__ */ t(b, { k: "tool.ai_review", layoutId: r, bundle: e.bundle, apply: e.apply }),
28
+ /* @__PURE__ */ t(X, { ...e }),
29
+ /* @__PURE__ */ t(D, { ...e }),
30
+ /* @__PURE__ */ t(Y, { layoutId: r }),
31
+ /* @__PURE__ */ t(U, { ...e }),
32
+ /* @__PURE__ */ t(Z, { layoutId: r }),
33
+ /* @__PURE__ */ t(
34
+ q,
35
+ {
36
+ collection: e.collection,
37
+ layoutId: r,
38
+ name: String(e.layout.name ?? "")
39
+ }
40
+ )
25
41
  ] });
26
42
  }
27
- function H({ collection: t, layout: l }) {
28
- const o = _(), [i, n] = x(null), r = l.slug ? String(l.slug) : null, c = i ? `${o.recordLink(t, i)}${r ? `?layout=${encodeURIComponent(r)}` : ""}` : null;
29
- return /* @__PURE__ */ e(
43
+ const Q = {
44
+ off: "Turn off Ask why on every save",
45
+ note: "Ask for a reason on every save",
46
+ note_ticket: "Ask for a reason and a ticket on every save"
47
+ };
48
+ function U({ layout: e, set: r }) {
49
+ const n = e.change_note, a = n === "note" || n === "note_ticket" ? n : "off";
50
+ return /* @__PURE__ */ t(
51
+ y,
52
+ {
53
+ k: "layout.change_note",
54
+ control: /* @__PURE__ */ t(
55
+ K,
56
+ {
57
+ ariaLabel: "Ask why on every save",
58
+ value: a,
59
+ options: [
60
+ { value: "off", label: "Off" },
61
+ { value: "note", label: "Reason" },
62
+ { value: "note_ticket", label: "Reason + ticket" }
63
+ ],
64
+ onChange: (o) => r({ change_note: o === "off" ? null : o }, Q[o])
65
+ }
66
+ ),
67
+ note: a === "off" ? null : "Autosave stays off for this form: every save waits for its reason."
68
+ }
69
+ );
70
+ }
71
+ function V({ collection: e, layout: r }) {
72
+ const n = _(), [a, o] = N(null), l = r.slug ? String(r.slug) : null, c = a ? `${n.recordLink(e, a)}${l ? `?layout=${encodeURIComponent(l)}` : ""}` : null;
73
+ return /* @__PURE__ */ t(
30
74
  y,
31
75
  {
32
76
  k: "tool.preview_record",
33
- note: r ? `The record opens pinned to this layout (?layout=${r}).` : "Without a link name the record opens on whichever layout it resolves to.",
34
- children: /* @__PURE__ */ m("div", { className: "flex flex-wrap items-center gap-1.5", children: [
35
- /* @__PURE__ */ e("div", { className: "min-w-[180px] flex-1", children: /* @__PURE__ */ e(
36
- F,
77
+ note: l ? `The record opens pinned to this form (?layout=${l}).` : "Without a link name the record opens on whichever layout it resolves to.",
78
+ children: /* @__PURE__ */ h("div", { className: "flex flex-wrap items-center gap-1.5", children: [
79
+ /* @__PURE__ */ t("div", { className: "min-w-[180px] flex-1", children: /* @__PURE__ */ t(
80
+ B,
37
81
  {
38
- relatedCollection: t,
39
- value: i,
40
- onChange: (s) => n(s == null || s === "" ? null : String(s)),
82
+ relatedCollection: e,
83
+ value: a,
84
+ onChange: (s) => o(s == null || s === "" ? null : String(s)),
41
85
  placeholder: "Pick a record…"
42
86
  }
43
87
  ) }),
44
- /* @__PURE__ */ m(
88
+ /* @__PURE__ */ h(
45
89
  "a",
46
90
  {
47
91
  href: c ?? void 0,
@@ -49,9 +93,9 @@ function H({ collection: t, layout: l }) {
49
93
  rel: "noreferrer",
50
94
  "aria-disabled": !c,
51
95
  "data-layout-record-preview-open": !0,
52
- className: p(S, !c && "pointer-events-none opacity-40"),
96
+ className: g(A, !c && "pointer-events-none opacity-40"),
53
97
  children: [
54
- /* @__PURE__ */ e(I, { className: "h-3.5 w-3.5" }),
98
+ /* @__PURE__ */ t($, { className: "h-3.5 w-3.5" }),
55
99
  "Open in a new tab"
56
100
  ]
57
101
  }
@@ -60,120 +104,150 @@ function H({ collection: t, layout: l }) {
60
104
  }
61
105
  );
62
106
  }
63
- function O(t, l) {
64
- var r;
65
- if (t.role.admin_access)
66
- return `As ${t.role.name}: admin — default layout, every field.`;
67
- if (!t.can_read) return `As ${t.role.name}: cannot read ${l} at all.`;
68
- const o = [`gets “${((r = t.layout) == null ? void 0 : r.name) ?? "no layout"}”`], i = t.hidden_fields.length, n = t.readonly_fields.length;
69
- return i && o.push(`${i} field${i === 1 ? "" : "s"} hidden`), n && o.push(`${n} read-only`), t.can_update || o.push("cannot edit"), `As ${t.role.name}: ${o.join(" · ")}`;
107
+ function W(e, r) {
108
+ var l;
109
+ if (e.role.admin_access)
110
+ return `As ${e.role.name}: admin — default layout, every field.`;
111
+ if (!e.can_read) return `As ${e.role.name}: cannot read ${r} at all.`;
112
+ const n = [`gets “${((l = e.layout) == null ? void 0 : l.name) ?? "no layout"}”`], a = e.hidden_fields.length, o = e.readonly_fields.length;
113
+ return a && n.push(`${a} field${a === 1 ? "" : "s"} hidden`), o && n.push(`${o} read-only`), e.can_update || n.push("cannot edit"), `As ${e.role.name}: ${n.join(" · ")}`;
70
114
  }
71
- function B({
72
- collection: t,
73
- onPreviewRole: l,
74
- previewRoleId: o,
75
- onPreviewRoleChange: i
115
+ function J({
116
+ collection: e,
117
+ onPreviewRole: r,
118
+ previewRoleId: n,
119
+ onPreviewRoleChange: a
76
120
  }) {
77
- const { data: n = [] } = T(!0), [r, c] = x(null), s = i ? o ?? null : r, h = i ?? c, { data: a = null, isFetching: $ } = D(t, s), u = R(l);
78
- return u.current = l, N(() => {
121
+ const { data: o = [] } = F(!0), [l, c] = N(null), s = a ? n ?? null : l, u = a ?? c, { data: i = null, isFetching: p } = M(e, s), f = I(r);
122
+ return f.current = r, x(() => {
79
123
  var d;
80
- (d = u.current) == null || d.call(u, s ? a : null);
81
- }, [s, a]), N(() => () => {
124
+ (d = f.current) == null || d.call(f, s ? i : null);
125
+ }, [s, i]), x(() => () => {
82
126
  var d;
83
- return (d = u.current) == null ? void 0 : d.call(u, null);
84
- }, []), /* @__PURE__ */ e(
127
+ return (d = f.current) == null ? void 0 : d.call(f, null);
128
+ }, []), /* @__PURE__ */ t(
85
129
  y,
86
130
  {
87
131
  k: "tool.preview_as_role",
88
- control: /* @__PURE__ */ e(
89
- j,
132
+ control: /* @__PURE__ */ t(
133
+ G,
90
134
  {
91
135
  ariaLabel: "Preview as role",
92
136
  value: s,
93
- options: [...n].sort((d, w) => d.name.localeCompare(w.name)).map((d) => ({ value: d.id, label: d.name })),
137
+ options: [...o].sort((d, w) => d.name.localeCompare(w.name)).map((d) => ({ value: d.id, label: d.name })),
94
138
  clearLabel: "Nobody (off)",
95
- onChange: h
139
+ onChange: u
96
140
  }
97
141
  ),
98
- children: s && /* @__PURE__ */ e("div", { "data-role-preview": !0, className: p(q, "p-3 text-[12px]"), children: $ && !a ? /* @__PURE__ */ e("p", { className: f, children: "Checking…" }) : a ? /* @__PURE__ */ m(b, { children: [
99
- /* @__PURE__ */ e(
142
+ children: s && /* @__PURE__ */ t("div", { "data-role-preview": !0, className: g(H, "p-3 text-[12px]"), children: p && !i ? /* @__PURE__ */ t("p", { className: m, children: "Checking…" }) : i ? /* @__PURE__ */ h(S, { children: [
143
+ /* @__PURE__ */ t(
100
144
  "p",
101
145
  {
102
- className: p(
146
+ className: g(
103
147
  "text-slate-700 dark:text-foreground",
104
- !a.can_read && "text-[#9c2f47] dark:text-[#f08aa1]"
148
+ !i.can_read && "text-[#9c2f47] dark:text-[#f08aa1]"
105
149
  ),
106
- children: O(a, t)
150
+ children: W(i, e)
107
151
  }
108
152
  ),
109
- a.note && /* @__PURE__ */ e("p", { className: p("mt-1", f), children: a.note })
110
- ] }) : /* @__PURE__ */ e("p", { className: f, children: "Could not preview this role." }) })
153
+ i.note && /* @__PURE__ */ t("p", { className: g("mt-1", m), children: i.note })
154
+ ] }) : /* @__PURE__ */ t("p", { className: m, children: "Could not preview this role." }) })
111
155
  }
112
156
  );
113
157
  }
114
- function k({ k: t, layoutId: l }) {
115
- var n, r;
116
- const o = _(), i = t === "tool.ai_review" ? (n = o.aiReviewSlot) == null ? void 0 : n.call(o, l) : (r = o.explainSlot) == null ? void 0 : r.call(o, {
158
+ function b({
159
+ k: e,
160
+ layoutId: r,
161
+ bundle: n,
162
+ apply: a
163
+ }) {
164
+ var s, u;
165
+ const o = _(), l = L(
166
+ () => n && a ? {
167
+ bundle: n,
168
+ apply: a,
169
+ check: (i) => {
170
+ try {
171
+ return E(n, i), null;
172
+ } catch (p) {
173
+ return z(p instanceof Error ? p.message : String(p));
174
+ }
175
+ }
176
+ } : void 0,
177
+ [n, a]
178
+ ), c = e === "tool.ai_review" ? (s = o.aiReviewSlot) == null ? void 0 : s.call(o, r, l) : (u = o.explainSlot) == null ? void 0 : u.call(o, {
117
179
  kind: "config",
118
180
  type: "layout",
119
- id: l,
120
- label: "Describe this layout"
181
+ id: r,
182
+ label: "Describe this form"
121
183
  });
122
- return /* @__PURE__ */ e(y, { k: t, children: i ?? /* @__PURE__ */ e("p", { className: f, children: "Not offered in this app." }) });
184
+ return /* @__PURE__ */ t(y, { k: e, children: c ?? /* @__PURE__ */ t("p", { className: m, children: "Not offered in this app." }) });
185
+ }
186
+ function X({ layout: e, bundle: r, collection: n, apply: a }) {
187
+ const o = _();
188
+ return /* @__PURE__ */ t(y, { k: "tool.ai_text", children: o.isAdmin && a ? /* @__PURE__ */ t(
189
+ O,
190
+ {
191
+ layoutId: Number(e.id),
192
+ bundle: r,
193
+ collection: n,
194
+ apply: a
195
+ }
196
+ ) : /* @__PURE__ */ t("p", { className: m, children: "Not offered here: administrators only." }) });
123
197
  }
124
- function K({ layoutId: t }) {
125
- var r, c;
126
- const l = g("tool.version_history"), o = g("tool.version_diff"), i = g("tool.version_restore");
127
- if (!l && !o && !i) return null;
128
- const n = v("tool.version_history");
129
- return /* @__PURE__ */ m("div", { "data-setting": "tool.version_history", className: "space-y-1.5", children: [
130
- /* @__PURE__ */ e("p", { className: E, children: n == null ? void 0 : n.label }),
131
- /* @__PURE__ */ e(L, { layoutId: t }),
132
- /* @__PURE__ */ m("p", { className: f, children: [
133
- n == null ? void 0 : n.effect,
198
+ function Y({ layoutId: e }) {
199
+ var l, c;
200
+ const r = v("tool.version_history"), n = v("tool.version_diff"), a = v("tool.version_restore");
201
+ if (!r && !n && !a) return null;
202
+ const o = k("tool.version_history");
203
+ return /* @__PURE__ */ h("div", { "data-setting": "tool.version_history", className: "space-y-1.5", children: [
204
+ /* @__PURE__ */ t("p", { className: j, children: o == null ? void 0 : o.label }),
205
+ /* @__PURE__ */ t(P, { layoutId: e }),
206
+ /* @__PURE__ */ h("p", { className: m, children: [
207
+ o == null ? void 0 : o.effect,
134
208
  " ",
135
- (r = v("tool.version_diff")) == null ? void 0 : r.effect,
209
+ (l = k("tool.version_diff")) == null ? void 0 : l.effect,
136
210
  " ",
137
- (c = v("tool.version_restore")) == null ? void 0 : c.effect
211
+ (c = k("tool.version_restore")) == null ? void 0 : c.effect
138
212
  ] })
139
213
  ] });
140
214
  }
141
- function Q({ layoutId: t }) {
142
- const l = P(), [o, i] = x(!1), { data: n, isFetching: r, isError: c, refetch: s } = C({
215
+ function Z({ layoutId: e }) {
216
+ const r = R(), [n, a] = N(!1), { data: o, isFetching: l, isError: c, refetch: s } = C({
143
217
  queryKey: ["layout-editor", "drift"],
144
- queryFn: () => l.request(A("/collection-layouts/drift")).then((a) => Array.isArray(a == null ? void 0 : a.data) ? a.data : []),
145
- enabled: o,
218
+ queryFn: () => r.request(T("/collection-layouts/drift")).then((i) => Array.isArray(i == null ? void 0 : i.data) ? i.data : []),
219
+ enabled: n,
146
220
  staleTime: 0
147
- }), h = n == null ? void 0 : n.find((a) => Number(a.layout_id) === t);
148
- return /* @__PURE__ */ m(
221
+ }), u = o == null ? void 0 : o.find((i) => Number(i.layout_id) === e);
222
+ return /* @__PURE__ */ h(
149
223
  y,
150
224
  {
151
225
  k: "tool.layout_drift",
152
- control: /* @__PURE__ */ e(
226
+ control: /* @__PURE__ */ t(
153
227
  "button",
154
228
  {
155
229
  type: "button",
156
- className: S,
157
- disabled: r,
158
- onClick: () => o ? void s() : i(!0),
159
- children: r ? "Checking…" : "Check now"
230
+ className: A,
231
+ disabled: l,
232
+ onClick: () => n ? void s() : a(!0),
233
+ children: l ? "Checking…" : "Check now"
160
234
  }
161
235
  ),
162
236
  children: [
163
- o && !r && c && /* @__PURE__ */ e("p", { className: "text-[12px] text-[#9c2f47] dark:text-[#f08aa1]", children: "The check failed." }),
164
- o && n && !r && /* @__PURE__ */ e("div", { "data-layout-drift": !0, className: "text-[12px]", children: h ? /* @__PURE__ */ e("ul", { className: "space-y-1", children: h.warnings.map((a) => /* @__PURE__ */ e(
237
+ n && !l && c && /* @__PURE__ */ t("p", { className: "text-[12px] text-[#9c2f47] dark:text-[#f08aa1]", children: "The check failed." }),
238
+ n && o && !l && /* @__PURE__ */ t("div", { "data-layout-drift": !0, className: "text-[12px]", children: u ? /* @__PURE__ */ t("ul", { className: "space-y-1", children: u.warnings.map((i) => /* @__PURE__ */ t(
165
239
  "li",
166
240
  {
167
241
  className: "rounded bg-[#fae6eb] px-1.5 py-1 text-[#9c2f47] dark:bg-[#3d1621] dark:text-[#f08aa1]",
168
- children: a
242
+ children: i
169
243
  },
170
- a
171
- )) }) : /* @__PURE__ */ e("p", { className: f, children: "No drift: the layout matches its last saved version." }) })
244
+ i
245
+ )) }) : /* @__PURE__ */ t("p", { className: m, children: "No drift: the form matches its last saved version." }) })
172
246
  ]
173
247
  }
174
248
  );
175
249
  }
176
250
  export {
177
- le as ToolsSection,
178
- O as rolePreviewSummary
251
+ Ne as ToolsSection,
252
+ W as rolePreviewSummary
179
253
  };