@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
@@ -1,206 +1,242 @@
1
- import { jsxs as a, Fragment as u, jsx as o } from "react/jsx-runtime";
2
- import { useState as _ } from "react";
3
- import { RecordConditionsEditor as O, RecordConditionsJson as R } from "../editors/RecordConditionsEditor.js";
4
- import { RolesPicker as A } from "../editors/RolesPicker.js";
5
- import { LAYOUT_TYPES as w } from "../overview/OverviewActions.js";
6
- import { useRoleNames as D } from "../overview/overview-api.js";
7
- import { Setting as y, smallBtn as s, quietText as C, Segmented as z } from "./controls.js";
8
- import { changeLabel as N, flag as x } from "./section-props.js";
9
- import { useFieldSources as F, useCollectionLayoutList as Y } from "./settings-api.js";
10
- import { layoutKindOf as j } from "./settings-registry.js";
11
- import { TextSetting as v } from "./TextSetting.js";
12
- import { ToggleSetting as I } from "./ToggleSetting.js";
13
- const f = (e) => {
14
- var t;
15
- return ((t = w.find((n) => n.type === e)) == null ? void 0 : t.label) ?? e;
16
- }, K = (e) => e.toLowerCase().replace(/[^a-z0-9_]/g, "_"), S = (e) => e.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_|_$/g, "");
17
- function M(e) {
18
- let t = e;
19
- if (typeof t == "string")
1
+ import { jsxs as a, Fragment as u, jsx as n } from "react/jsx-runtime";
2
+ import { useState as y } from "react";
3
+ import { RecordConditionsEditor as I, RecordConditionsJson as z } from "../editors/RecordConditionsEditor.js";
4
+ import { RolesPicker as F } from "../editors/RolesPicker.js";
5
+ import { DependencyDiagram as w } from "../ops/DependencyDiagram.js";
6
+ import { useLayoutDependencies as L } from "../ops/ops-api.js";
7
+ import { LAYOUT_TYPES as D } from "../overview/OverviewActions.js";
8
+ import { useRoleNames as P } from "../overview/overview-api.js";
9
+ import { roleIdsPatch as Y } from "../testing/testing-model.js";
10
+ import { Setting as p, smallBtn as d, quietText as x, Segmented as j } from "./controls.js";
11
+ import { changeLabel as _, flag as C } from "./section-props.js";
12
+ import { useFieldSources as K, useCollectionLayoutList as M } from "./settings-api.js";
13
+ import { layoutKindOf as U } from "./settings-registry.js";
14
+ import { TextSetting as S } from "./TextSetting.js";
15
+ import { ToggleSetting as $ } from "./ToggleSetting.js";
16
+ const g = (t) => {
17
+ var e;
18
+ return ((e = D.find((o) => o.type === t)) == null ? void 0 : e.label) ?? t;
19
+ }, B = (t) => t.toLowerCase().replace(/[^a-z0-9_]/g, "_"), v = (t) => t.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_|_$/g, "");
20
+ function E(t) {
21
+ let e = t;
22
+ if (typeof e == "string")
20
23
  try {
21
- t = JSON.parse(t);
24
+ e = JSON.parse(e);
22
25
  } catch {
23
26
  return [];
24
27
  }
25
- const n = t == null ? void 0 : t.role_ids;
26
- return Array.isArray(n) ? n.map(String) : [];
28
+ const o = e == null ? void 0 : e.role_ids;
29
+ return Array.isArray(o) ? o.map(String) : [];
27
30
  }
28
- function ee(e) {
29
- const { layout: t, collection: n } = e, { fields: m, columns: i, relations: c } = F(n), { data: h = [] } = D(!0), d = M(t.conditions);
31
+ function ce(t) {
32
+ const { layout: e, collection: o } = t, { fields: c, columns: l, relations: i } = K(o), { data: m = [] } = P(!0), f = E(e.conditions);
30
33
  return /* @__PURE__ */ a(u, { children: [
31
- /* @__PURE__ */ o(P, { ...e }),
32
- /* @__PURE__ */ o(
33
- y,
34
+ /* @__PURE__ */ n(J, { ...t }),
35
+ /* @__PURE__ */ n(
36
+ p,
34
37
  {
35
38
  k: "layout.record_conditions",
36
- note: /* @__PURE__ */ o(
37
- R,
39
+ note: /* @__PURE__ */ n(
40
+ z,
38
41
  {
39
- value: t.record_conditions,
40
- onApply: (r) => e.set({ record_conditions: r }, N("layout.record_conditions"))
42
+ value: e.record_conditions,
43
+ onApply: (s) => t.set({ record_conditions: s }, _("layout.record_conditions"))
41
44
  }
42
45
  ),
43
- children: /* @__PURE__ */ o(
44
- O,
46
+ children: /* @__PURE__ */ n(
47
+ I,
45
48
  {
46
49
  json: !1,
47
- collection: n,
48
- value: t.record_conditions,
49
- fields: m,
50
- columns: i,
51
- relations: c,
52
- onBlur: e.flush,
53
- onChange: (r, { text: b }) => (b ? e.setText : e.set)(
54
- { record_conditions: r },
55
- N("layout.record_conditions")
50
+ collection: o,
51
+ value: e.record_conditions,
52
+ fields: c,
53
+ columns: l,
54
+ relations: i,
55
+ onBlur: t.flush,
56
+ onChange: (s, { text: h }) => (h ? t.setText : t.set)(
57
+ { record_conditions: s },
58
+ _("layout.record_conditions")
56
59
  )
57
60
  }
58
61
  )
59
62
  }
60
63
  ),
61
- /* @__PURE__ */ o(y, { k: "layout.conditions.role_ids", children: /* @__PURE__ */ o(
62
- A,
64
+ /* @__PURE__ */ n(p, { k: "layout.conditions.role_ids", children: /* @__PURE__ */ n(
65
+ F,
63
66
  {
64
- value: d,
65
- roles: h,
66
- onChange: (r) => e.set(
67
- { conditions: r.length ? { role_ids: r } : null },
68
- r.length > d.length ? "Add a role" : "Remove a role"
67
+ value: f,
68
+ roles: m,
69
+ onChange: (s) => t.set(
70
+ // Keeps the layout's pinned test records (conditions.testing).
71
+ Y(e.conditions, s),
72
+ s.length > f.length ? "Add a role" : "Remove a role"
69
73
  )
70
74
  }
71
75
  ) }),
72
- /* @__PURE__ */ o(
73
- v,
76
+ /* @__PURE__ */ n(
77
+ S,
74
78
  {
75
79
  k: "layout.slug",
76
- props: e,
80
+ props: t,
77
81
  mono: !0,
78
82
  placeholder: "e.g. unit_order",
79
- sanitize: K,
83
+ sanitize: B,
80
84
  blurOnly: !0,
81
- extra: !t.slug && typeof t.name == "string" && S(t.name) ? /* @__PURE__ */ o(
85
+ extra: !e.slug && typeof e.name == "string" && v(e.name) ? /* @__PURE__ */ n(
82
86
  "button",
83
87
  {
84
88
  type: "button",
85
- className: s,
86
- onClick: () => e.set({ slug: S(String(t.name)) }, "Generate link name"),
89
+ className: d,
90
+ onClick: () => t.set({ slug: v(String(e.name)) }, "Generate link name"),
87
91
  children: "Generate"
88
92
  }
89
93
  ) : null,
90
- note: t.slug ? /* @__PURE__ */ a(u, { children: [
94
+ note: e.slug ? /* @__PURE__ */ a(u, { children: [
91
95
  "Opens with ",
92
96
  /* @__PURE__ */ a("code", { className: "font-mono", children: [
93
97
  "?layout=",
94
- String(t.slug)
95
- ] })
98
+ String(e.slug)
99
+ ] }),
100
+ /* @__PURE__ */ n(G, { layoutId: Number(e.id) })
96
101
  ] }) : null
97
102
  }
98
103
  ),
99
- /* @__PURE__ */ o(
100
- v,
104
+ /* @__PURE__ */ n(
105
+ S,
101
106
  {
102
107
  k: "layout.create_label",
103
- props: e,
104
- placeholder: typeof t.name == "string" ? t.name : ""
108
+ props: t,
109
+ placeholder: typeof e.name == "string" ? e.name : ""
105
110
  }
106
111
  ),
107
- /* @__PURE__ */ o(I, { k: "layout.create_hidden", props: e })
112
+ /* @__PURE__ */ n($, { k: "layout.create_hidden", props: t })
108
113
  ] });
109
114
  }
110
- function P(e) {
111
- const { layout: t, kind: n, bundle: m } = e, [i, c] = _(null), h = m.placements.length + m.groups.length, d = (l) => e.set({ layout_type: l }, `Change kind to ${f(l)}`), r = x(t.is_active), [b, g] = _(!1), p = Y(e.collection).find(
112
- (l) => l.id !== Number(t.id) && j(l) === n && x(l.is_active)
113
- ), k = n === "grouped" ? "form" : `${f(n).toLowerCase()} layout`, L = () => {
114
- e.set({ is_active: !0 }, "Make default", { undoable: !1 }), g(!1);
115
- }, T = n === "file" ? null : /* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-2", children: r ? /* @__PURE__ */ a("span", { className: C, "data-default-layout": !0, children: [
115
+ function G({ layoutId: t }) {
116
+ const { data: e } = L(t), [o, c] = y(!1), l = ((e == null ? void 0 : e.nodes) ?? []).filter((i) => i.breaks.includes("slug")).length;
117
+ return l ? /* @__PURE__ */ a(u, { children: [
118
+ " · ",
119
+ /* @__PURE__ */ a(
120
+ "button",
121
+ {
122
+ type: "button",
123
+ "data-slug-users": !0,
124
+ className: "font-medium text-amber-700 hover:underline dark:text-amber-300",
125
+ onClick: () => c((i) => !i),
126
+ children: [
127
+ l,
128
+ " ",
129
+ l === 1 ? "thing finds" : "things find",
130
+ " it by this name"
131
+ ]
132
+ }
133
+ ),
134
+ o && /* @__PURE__ */ n(w, { layoutId: t, change: "slug", compact: !0, className: "mt-2" })
135
+ ] }) : null;
136
+ }
137
+ function J(t) {
138
+ const { layout: e, kind: o, bundle: c } = t, [l, i] = y(null), { data: m } = L(Number(e.id)), f = ((m == null ? void 0 : m.nodes.length) ?? 0) > 0, s = c.placements.length + c.groups.length, h = (r) => t.set({ layout_type: r }, `Change kind to ${g(r)}`), T = C(e.is_active), [O, b] = y(!1), k = M(t.collection).find(
139
+ (r) => r.id !== Number(e.id) && U(r) === o && C(r.is_active)
140
+ ), N = o === "grouped" ? "form" : `${g(o).toLowerCase()} layout`, R = () => {
141
+ t.set({ is_active: !0 }, "Make default", { undoable: !1 }), b(!1);
142
+ }, A = o === "file" ? null : /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2", children: T ? /* @__PURE__ */ a("span", { className: x, "data-default-layout": !0, children: [
116
143
  "This is the default ",
117
- f(n).toLowerCase(),
144
+ g(o).toLowerCase(),
118
145
  " layout: records no rule or role catches use it."
119
- ] }) : b ? /* @__PURE__ */ a(
146
+ ] }) : O ? /* @__PURE__ */ a(
120
147
  "div",
121
148
  {
122
149
  "data-make-default-confirm": !0,
123
150
  className: "w-full rounded-md border border-amber-300 bg-amber-50 p-2 text-[12px] text-amber-900 dark:border-amber-400/30 dark:bg-amber-400/10 dark:text-amber-200",
124
151
  children: [
125
152
  /* @__PURE__ */ a("p", { children: [
126
- p ? /* @__PURE__ */ a(u, { children: [
127
- /* @__PURE__ */ o("strong", { className: "font-semibold", children: p.name }),
153
+ k ? /* @__PURE__ */ a(u, { children: [
154
+ /* @__PURE__ */ n("strong", { className: "font-semibold", children: k.name }),
128
155
  " stops being the default",
129
156
  " ",
130
- k,
157
+ N,
131
158
  " for records no rule catches."
132
159
  ] }) : /* @__PURE__ */ a(u, { children: [
133
160
  "No ",
134
- k,
161
+ N,
135
162
  " is the default yet; this one becomes it."
136
163
  ] }),
137
164
  " ",
138
165
  "This cannot be undone with Undo."
139
166
  ] }),
140
167
  /* @__PURE__ */ a("div", { className: "mt-1.5 flex gap-1.5", children: [
141
- /* @__PURE__ */ o(
168
+ /* @__PURE__ */ n(
142
169
  "button",
143
170
  {
144
171
  type: "button",
145
172
  "data-action": "make-default-confirm",
146
- className: s,
147
- onClick: L,
173
+ className: d,
174
+ onClick: R,
148
175
  children: "Yes, make default"
149
176
  }
150
177
  ),
151
- /* @__PURE__ */ o("button", { type: "button", className: s, onClick: () => g(!1), children: "Cancel" })
178
+ /* @__PURE__ */ n("button", { type: "button", className: d, onClick: () => b(!1), children: "Cancel" })
152
179
  ] })
153
180
  ]
154
181
  }
155
182
  ) : /* @__PURE__ */ a(u, { children: [
156
- /* @__PURE__ */ o(
183
+ /* @__PURE__ */ n(
157
184
  "button",
158
185
  {
159
186
  type: "button",
160
187
  "data-action": "make-default",
161
- className: s,
162
- onClick: () => g(!0),
188
+ className: d,
189
+ onClick: () => b(!0),
163
190
  children: "Make default"
164
191
  }
165
192
  ),
166
- /* @__PURE__ */ o("span", { className: C, children: "Records no rule or role catches would open with this layout." })
193
+ /* @__PURE__ */ n("span", { className: x, children: "Records no rule or role catches would open with this layout." })
167
194
  ] }) });
168
- return /* @__PURE__ */ a(y, { k: "layout.layout_type", note: T, children: [
169
- /* @__PURE__ */ o(
170
- z,
195
+ return /* @__PURE__ */ a(p, { k: "layout.layout_type", note: A, children: [
196
+ /* @__PURE__ */ n(
197
+ j,
171
198
  {
172
199
  ariaLabel: "Kind of layout",
173
- value: n,
174
- options: w.map((l) => ({ value: l.type, label: l.label })),
175
- onChange: (l) => h > 0 ? c(l) : d(l)
200
+ value: o,
201
+ options: D.map((r) => ({ value: r.type, label: r.label })),
202
+ onChange: (r) => s > 0 || f ? i(r) : h(r)
176
203
  }
177
204
  ),
178
- i && /* @__PURE__ */ a(
205
+ l && /* @__PURE__ */ a(
179
206
  "div",
180
207
  {
181
- "data-kind-confirm": i,
208
+ "data-kind-confirm": l,
182
209
  className: "rounded-md border border-amber-300 bg-amber-50 p-2.5 text-[12px] text-amber-900 dark:border-amber-400/30 dark:bg-amber-400/10 dark:text-amber-200",
183
210
  children: [
184
211
  /* @__PURE__ */ a("p", { children: [
185
212
  "Make this a ",
186
- f(i),
213
+ g(l),
187
214
  " layout? Its sections and fields stay, but",
188
215
  " ",
189
- i === "file" ? "tabs, widgets and slot cards do not appear in a PDF." : i === "table" ? "grid columns use only its fields, not its sections." : "some of them may not apply to this kind."
216
+ l === "file" ? "tabs, widgets and slot cards do not appear in a PDF." : l === "table" ? "grid columns use only its fields, not its sections." : "some of them may not apply to this kind."
190
217
  ] }),
218
+ f && /* @__PURE__ */ n(
219
+ w,
220
+ {
221
+ layoutId: Number(e.id),
222
+ change: "type",
223
+ compact: !0,
224
+ className: "mt-2 rounded-md bg-white p-2 text-slate-800 dark:bg-card dark:text-foreground"
225
+ }
226
+ ),
191
227
  /* @__PURE__ */ a("div", { className: "mt-1.5 flex gap-1.5", children: [
192
- /* @__PURE__ */ o(
228
+ /* @__PURE__ */ n(
193
229
  "button",
194
230
  {
195
231
  type: "button",
196
- className: s,
232
+ className: d,
197
233
  onClick: () => {
198
- d(i), c(null);
234
+ h(l), i(null);
199
235
  },
200
236
  children: "Yes, change it"
201
237
  }
202
238
  ),
203
- /* @__PURE__ */ o("button", { type: "button", className: s, onClick: () => c(null), children: "Cancel" })
239
+ /* @__PURE__ */ n("button", { type: "button", className: d, onClick: () => i(null), children: "Cancel" })
204
240
  ] })
205
241
  ]
206
242
  }
@@ -208,6 +244,6 @@ function P(e) {
208
244
  ] });
209
245
  }
210
246
  export {
211
- ee as WhoSection,
212
- K as sanitizeSlug
247
+ ce as WhoSection,
248
+ B as sanitizeSlug
213
249
  };
@@ -1,10 +1,10 @@
1
- import { jsxs as l, jsx as t } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
2
  import { ChevronsUpDown as k, Check as f, X as w } from "lucide-react";
3
- import { createContext as C, isValidElement as S, useState as T, useContext as P } from "react";
3
+ import { createContext as C, useState as S, isValidElement as T, useContext as P } from "react";
4
4
  import { cn as i } from "../../../lib/utils.js";
5
5
  import { Command as j, CommandInput as O, CommandList as V, CommandEmpty as B, CommandItem as b } from "../../ui/command.js";
6
6
  import { Popover as D, PopoverTrigger as E, PopoverContent as I } from "../../ui/popover.js";
7
- import { inputBase as v, effectText as $, labelText as q, segOption as U, segTrack as X } from "../panel-style.js";
7
+ import { inputBase as v, effectText as $, segOption as q, segTrack as U, labelText as X } from "../panel-style.js";
8
8
  import { settingDef as z } from "./settings-registry.js";
9
9
  const A = C(null);
10
10
  function F(e) {
@@ -21,10 +21,10 @@ function L({
21
21
  }) {
22
22
  const s = F(e), d = z(e);
23
23
  if (!s || !d) return null;
24
- const m = S(n) && n.type === G;
24
+ const m = T(n) && n.type === G;
25
25
  return /* @__PURE__ */ l("div", { "data-setting": e, className: "space-y-1.5", children: [
26
26
  /* @__PURE__ */ l("div", { className: "flex min-h-5 items-center justify-between gap-3", children: [
27
- /* @__PURE__ */ t("label", { htmlFor: c, className: i(q, "min-w-0"), children: d.label }),
27
+ /* @__PURE__ */ t("label", { htmlFor: c, className: i(X, "min-w-0"), children: d.label }),
28
28
  m && /* @__PURE__ */ t("div", { className: "flex shrink-0 items-center", children: n })
29
29
  ] }),
30
30
  n && !m && /* @__PURE__ */ t("div", { children: n }),
@@ -75,7 +75,7 @@ function ee({
75
75
  "fieldset",
76
76
  {
77
77
  "aria-label": r,
78
- className: i("m-0 min-w-0 border-0", X(n.length)),
78
+ className: i("m-0 min-w-0 border-0", U(n.length)),
79
79
  children: n.map((s) => /* @__PURE__ */ t(
80
80
  "button",
81
81
  {
@@ -83,7 +83,7 @@ function ee({
83
83
  "aria-pressed": e === s.value,
84
84
  disabled: c,
85
85
  onClick: () => e !== s.value && o(s.value),
86
- className: U(e === s.value),
86
+ className: q(e === s.value),
87
87
  children: s.label
88
88
  },
89
89
  s.value
@@ -102,7 +102,7 @@ function te({
102
102
  className: m,
103
103
  emptyText: N = "Nothing to pick"
104
104
  }) {
105
- const [y, u] = T(!1), p = n.find((a) => a.value === e), h = (a) => {
105
+ const [y, u] = S(!1), p = n.find((a) => a.value === e), h = (a) => {
106
106
  o(a), u(!1);
107
107
  }, x = "gap-1.5 px-2 py-1 text-[12px] text-slate-700 data-[selected=true]:bg-muted dark:text-foreground";
108
108
  return /* @__PURE__ */ l(D, { open: y, onOpenChange: u, children: [
@@ -8,7 +8,7 @@ const y = [
8
8
  { id: "defaults", title: "Defaults for new records" },
9
9
  { id: "inheritance", title: "Inheritance" },
10
10
  { id: "tools", title: "AI review, previews, version history" }
11
- ], o = ["grouped", "table", "file", "addendum", "detail", "summary"], t = ["grouped", "table", "detail", "summary"], n = ["grouped", "detail", "summary"], r = ["grouped"], c = [
11
+ ], o = ["grouped", "table", "file", "addendum", "detail", "summary"], t = ["grouped", "table", "detail", "summary"], l = ["grouped", "detail", "summary"], r = ["grouped"], c = [
12
12
  // ── Who gets this form ────────────────────────────────────────────────────
13
13
  {
14
14
  key: "layout.layout_type",
@@ -95,14 +95,14 @@ const y = [
95
95
  section: "buttons",
96
96
  label: "Dossier button",
97
97
  effect: "Adds a Dossier button on saved records: one PDF with values, workflow history, comments and tasks. Only the default form's switch counts.",
98
- types: n
98
+ types: l
99
99
  },
100
100
  {
101
101
  key: "layout.dossier_label",
102
102
  section: "buttons",
103
103
  label: "Dossier button label",
104
104
  effect: "Text on the Dossier button. Empty shows “Dossier”. Only the default form's label counts.",
105
- types: n
105
+ types: l
106
106
  },
107
107
  {
108
108
  key: "layout.disable_comments",
@@ -180,14 +180,14 @@ const y = [
180
180
  section: "read",
181
181
  label: "Summary side panel",
182
182
  effect: "Shows a side panel with the summary fields beside the form.",
183
- types: n
183
+ types: l
184
184
  },
185
185
  {
186
186
  key: "layout.summary_hide_empty",
187
187
  section: "read",
188
188
  label: "Summary: hide empty fields",
189
189
  effect: "Fields with no value are left out of the summary panel.",
190
- types: n
190
+ types: l
191
191
  },
192
192
  {
193
193
  key: "layout.display_mode",
@@ -383,6 +383,14 @@ const y = [
383
383
  effect: "AI looks for problems (missing required fields, odd order) and offers fixes you can undo.",
384
384
  types: o
385
385
  },
386
+ {
387
+ key: "tool.ai_text",
388
+ section: "tools",
389
+ label: "AI wording",
390
+ effect: "AI checks labels, help and choices against the glossary and plain language, and drafts section intros, placeholders and translations; you pick what to apply.",
391
+ types: t,
392
+ keywords: "glossary intro placeholder choices reading level plain language translation"
393
+ },
386
394
  {
387
395
  key: "tool.version_history",
388
396
  section: "tools",
@@ -404,6 +412,22 @@ const y = [
404
412
  effect: "Puts the layout back exactly as a version was; the current one is kept as a version.",
405
413
  types: o
406
414
  },
415
+ {
416
+ key: "layout.change_note",
417
+ section: "tools",
418
+ label: "Ask why on every save",
419
+ effect: "Save asks for a short reason, and a ticket link if you choose, and keeps it with the version in History.",
420
+ types: o,
421
+ keywords: "change note reason ticket audit required"
422
+ },
423
+ {
424
+ key: "tool.cost_limit",
425
+ section: "tools",
426
+ label: "Form cost limit",
427
+ effect: "Test and Check impact warn when opening a record on this form takes more requests than this.",
428
+ types: l,
429
+ keywords: "requests pickers grids widgets queries slow"
430
+ },
407
431
  {
408
432
  key: "tool.layout_drift",
409
433
  section: "tools",
@@ -422,16 +446,16 @@ function p(e) {
422
446
  function u(e, s) {
423
447
  const a = s.toLowerCase().split(/\s+/).filter(Boolean);
424
448
  if (a.length === 0) return !0;
425
- const l = `${e.label} ${e.effect} ${e.key} ${e.keywords ?? ""}`.toLowerCase();
426
- return a.every((i) => l.includes(i));
449
+ const i = `${e.label} ${e.effect} ${e.key} ${e.keywords ?? ""}`.toLowerCase();
450
+ return a.every((n) => i.includes(n));
427
451
  }
428
452
  function m(e, s = "") {
429
453
  const a = [];
430
- for (const l of y) {
431
- const i = c.filter(
432
- (d) => d.section === l.id && d.types.includes(e) && u(d, s)
454
+ for (const i of y) {
455
+ const n = c.filter(
456
+ (d) => d.section === i.id && d.types.includes(e) && u(d, s)
433
457
  );
434
- i.length && a.push({ section: l, settings: i });
458
+ n.length && a.push({ section: i, settings: n });
435
459
  }
436
460
  return a;
437
461
  }
@@ -0,0 +1,88 @@
1
+ const l = ["Editing", "Moving", "Finding", "Saving", "View"], r = [
2
+ { id: "undo", area: "Editing", keys: [["mod", "z"]], label: "Undo" },
3
+ {
4
+ id: "redo",
5
+ area: "Editing",
6
+ keys: [
7
+ ["shift", "mod", "z"],
8
+ ["ctrl", "y"]
9
+ ],
10
+ label: "Redo"
11
+ },
12
+ { id: "duplicate", area: "Editing", keys: [["mod", "d"]], label: "Duplicate the selection" },
13
+ {
14
+ id: "select-more",
15
+ area: "Editing",
16
+ keys: [
17
+ ["shift", "click"],
18
+ ["mod", "click"]
19
+ ],
20
+ label: "Select several fields"
21
+ },
22
+ {
23
+ id: "alt-move",
24
+ area: "Moving",
25
+ keys: [
26
+ ["alt", "↑"],
27
+ ["alt", "↓"]
28
+ ],
29
+ label: "Move the selection up or down one place"
30
+ },
31
+ {
32
+ id: "alt-move-across",
33
+ area: "Moving",
34
+ keys: [
35
+ ["alt", "←"],
36
+ ["alt", "→"]
37
+ ],
38
+ label: "Move a field to the previous or next section; a tab or step left or right"
39
+ },
40
+ {
41
+ id: "keyboard-drag",
42
+ area: "Moving",
43
+ keys: [["space"]],
44
+ label: "Pick up the focused field or section, arrows to move it, Space to drop"
45
+ },
46
+ { id: "cancel-drag", area: "Moving", keys: [["esc"]], label: "Cancel a drag" },
47
+ { id: "find", area: "Finding", keys: [["mod", "f"]], label: "Find a field on the form" },
48
+ { id: "palette", area: "Finding", keys: [["mod", "k"]], label: "Open the command palette" },
49
+ { id: "save", area: "Saving", keys: [["mod", "s"]], label: "Save changes" },
50
+ { id: "shortcuts", area: "View", keys: [["?"]], label: "Show these shortcuts" },
51
+ {
52
+ id: "close",
53
+ area: "View",
54
+ keys: [["esc"]],
55
+ label: "Close the editor (record page), or the open popover"
56
+ }
57
+ ];
58
+ function d() {
59
+ return l.map((e) => ({
60
+ area: e,
61
+ items: r.filter((a) => a.area === e)
62
+ })).filter((e) => e.items.length > 0);
63
+ }
64
+ function s() {
65
+ var a;
66
+ if (typeof navigator > "u") return !0;
67
+ const e = ((a = navigator.userAgentData) == null ? void 0 : a.platform) ?? navigator.platform ?? navigator.userAgent;
68
+ return /mac|iphone|ipad|ipod/i.test(e ?? "");
69
+ }
70
+ const i = {
71
+ mod: "⌘",
72
+ shift: "⇧",
73
+ alt: "⌥",
74
+ ctrl: "Ctrl",
75
+ esc: "Esc",
76
+ space: "Space",
77
+ click: "click"
78
+ }, n = { ...i, mod: "Ctrl", shift: "Shift", alt: "Alt" };
79
+ function c(e, a = s()) {
80
+ const o = a ? i : n;
81
+ return e.map((t) => o[t] ?? (t.length === 1 ? t.toUpperCase() : t));
82
+ }
83
+ export {
84
+ l as SHORTCUT_AREAS,
85
+ s as isMacLike,
86
+ c as keyLabels,
87
+ d as shortcutGroups
88
+ };
@@ -0,0 +1,35 @@
1
+ import { titleCase as d } from "../../lib/utils.js";
2
+ import { segmentsText as g, describeConditions as h } from "./overview/describe-conditions.js";
3
+ const b = (t) => t.length <= 1 ? t[0] ?? "" : `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
4
+ function v(t, l, r = {}) {
5
+ var s;
6
+ const o = typeof t == "string" ? m(t) : t;
7
+ if (!Array.isArray(o) || !o.length) return null;
8
+ const n = [], f = new Map(l.map((e) => [e.field, e]));
9
+ for (const e of o) {
10
+ if (!(e != null && e.field)) continue;
11
+ if (e.op === "in") {
12
+ const p = ((s = f.get(e.field)) == null ? void 0 : s.label) || d(e.field), a = String(e.value ?? "").split(",").map((i) => i.trim()).filter(Boolean).map((i) => {
13
+ var u;
14
+ return ((u = r[e.field]) == null ? void 0 : u[i]) ?? i;
15
+ });
16
+ n.push(`${p} is ${b(a)}`);
17
+ continue;
18
+ }
19
+ const c = { field: e.field, op: e.op ?? "eq", value: e.value };
20
+ n.push(g(h([c], l, r)));
21
+ }
22
+ return n.length ? n.join(" and ") : null;
23
+ }
24
+ function m(t) {
25
+ try {
26
+ return JSON.parse(t);
27
+ } catch {
28
+ return null;
29
+ }
30
+ }
31
+ export {
32
+ v as describeShowWhen,
33
+ b as orList,
34
+ m as safeParse
35
+ };
@@ -8,13 +8,14 @@ const r = {
8
8
  __subtitle__: "Subtitle",
9
9
  __addendums__: "Addendums",
10
10
  __referenced_by__: "Referenced by",
11
- __related_records__: "Related records"
11
+ __related_records__: "Related records",
12
+ __ungrouped_pos__: "Fields outside sections"
12
13
  };
13
- function s(_) {
14
+ function n(_) {
14
15
  if (r[_]) return r[_];
15
16
  const e = _.match(/^__ext_([a-z][a-z0-9-]*)__$/);
16
17
  return e ? t(e[1].replace(/-/g, "_")) : /^__widget_\d+__$/.test(_) ? "Widget" : t(_.replace(/^_+|_+$/g, ""));
17
18
  }
18
19
  export {
19
- s as slotName
20
+ n as slotName
20
21
  };