@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
@@ -7,7 +7,7 @@ import { normalizeReplayMasking as B, buildReplayMaskingOptions as z } from "../
7
7
  import { normalizeReplaySampling as x, replaySampleDraw as Ae, currentReplayRoute as _, isReplayRouteSampled as Y, attributeChunkRoutes as ee } from "../shared/lib/replay-sampling.js";
8
8
  import { emitReplayTap as Ce, setReplayRecorderMode as N, registerReplayCapture as Ie, clipEndOffset as _e, withClipKind as De } from "../shared/lib/replay-capture.js";
9
9
  import { instrumentConsole as qe, instrumentRequests as Le, redactSecrets as Te } from "../shared/lib/replay-context.js";
10
- const Pe = "nivaro-react@0.2.52", j = 1e4, Ne = 150, Me = 3e3, Oe = 600, Ue = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
10
+ const Pe = "nivaro-react@0.2.54", j = 1e4, Ne = 150, Me = 3e3, Oe = 600, Ue = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
11
11
  function We(n) {
12
12
  return typeof n.url != "string" || typeof fetch != "function" ? null : (d, u) => {
13
13
  const c = typeof n.getToken == "function" ? n.getToken() : void 0, a = { "Content-Type": "application/json" };
package/dist/index.d.ts CHANGED
@@ -1984,6 +1984,42 @@ declare interface DesignDnd {
1984
1984
  dropIndicator?(t: DesignTarget): CSSProperties | null;
1985
1985
  }
1986
1986
 
1987
+ declare interface DesignMark {
1988
+ text: string;
1989
+ tone: 'violet' | 'emerald' | 'amber' | 'slate';
1990
+ /** Instant tooltip (data-tip) with the detail. */
1991
+ tip?: string;
1992
+ highlight?: boolean;
1993
+ /** A small icon before the text (a pinned section's pin, #2628). */
1994
+ icon?: 'pin';
1995
+ /**
1996
+ * Where the tag ranks when a node has more than fit (DesignNode shows two,
1997
+ * then "+n"): `preview` (a preview mode's own tag) ranks with the role
1998
+ * mark, `loop` (a rule loop) next, plain rule and state tags after, `ai`
1999
+ * (an AI finding) last but one, "from <parent>" last. A highlighted tag
2000
+ * without a kind ranks as a loop.
2001
+ */
2002
+ kind?: 'preview' | 'loop' | 'ai';
2003
+ /** Clickable: opens what the tag explains (the node is selected first). */
2004
+ onClick?: () => void;
2005
+ }
2006
+
2007
+ declare interface DesignOverlay {
2008
+ /** Classes tinting the node (background + ring), light and dark. */
2009
+ className: string;
2010
+ /** Rendered in the node's badge row; clicks reach it (data-design-pass). */
2011
+ chip: ReactNode;
2012
+ }
2013
+
2014
+ declare interface DesignPeer {
2015
+ id: string;
2016
+ name: string;
2017
+ /** Outline classes for the node they selected (light and dark). */
2018
+ outline: string;
2019
+ /** Name tag classes. */
2020
+ chip: string;
2021
+ }
2022
+
1987
2023
  declare type DesignTarget = {
1988
2024
  kind: 'field';
1989
2025
  field: string;
@@ -2002,6 +2038,12 @@ declare type DesignTarget = {
2002
2038
 
2003
2039
  declare type DetailTab = 'calls' | 'submissions' | 'obligations' | 'contracts';
2004
2040
 
2041
+ declare interface DiffMark {
2042
+ kind: 'added' | 'moved' | 'removed' | 'changed';
2043
+ /** moved: "from Basics"; changed: the settings that differ. */
2044
+ detail?: string;
2045
+ }
2046
+
2005
2047
  declare type DigestFrequency = 'instant' | 'daily' | 'weekly';
2006
2048
 
2007
2049
  declare type DimensionCascadeRule = {
@@ -2253,6 +2295,22 @@ export declare interface DrilldownViewOverride {
2253
2295
 
2254
2296
  export declare const DrilldownViewsContext: React_2.Context<Record<string, DrilldownViewOverride>>;
2255
2297
 
2298
+ /**
2299
+ * Notes on the canvas (#2608): a short note an admin pins to a field or a
2300
+ * section ("Finance asked for this in Q3"). It lives in the layout — a
2301
+ * placement's `overrides.editor_note`, a section's `editor_note` column — so
2302
+ * it saves, undoes and versions like every other layout change, and only the
2303
+ * layout editor ever shows it (record pages get layouts without notes).
2304
+ */
2305
+ declare interface EditorNote {
2306
+ text: string;
2307
+ /** Who wrote it (user id) and their name when they wrote it. */
2308
+ by: string | null;
2309
+ by_name: string | null;
2310
+ /** ISO time it was written. */
2311
+ at: string;
2312
+ }
2313
+
2256
2314
  /**
2257
2315
  * The ids a filter surface should PRE-SELECT for a dimension. Restrictions are
2258
2316
  * server-enforced regardless, so the seeded selection must reflect them:
@@ -2705,6 +2763,12 @@ export declare function focusRecordTarget(target: {
2705
2763
  rowId?: string;
2706
2764
  }): void;
2707
2765
 
2766
+ /** A press of Expand all or Collapse all; `seq` changes on every press. */
2767
+ declare interface FoldSignal {
2768
+ open: boolean;
2769
+ seq: number;
2770
+ }
2771
+
2708
2772
  /** The window event a host's socket layer dispatches on `client:force-refresh`. */
2709
2773
  export declare const FORCE_RELOAD_EVENT = "nvr:force-refresh";
2710
2774
 
@@ -3263,7 +3327,9 @@ export declare function HelpVideoButton({ collection, item, page, pageLabel, com
3263
3327
  }): JSX.Element;
3264
3328
 
3265
3329
  export declare type HelpVideoContext = {
3266
- kind: 'collection' | 'page';
3330
+ /** field / section (#2615): `key` is the collection, `state_key` the field
3331
+ * name or the section's group key. */
3332
+ kind: 'collection' | 'page' | 'field' | 'section';
3267
3333
  key: string;
3268
3334
  state_key: string | null;
3269
3335
  };
@@ -4433,6 +4499,9 @@ export declare interface ItemEditFormProps {
4433
4499
  * admin's ItemEdit page renders its own copies in the page header;
4434
4500
  * headless hosts opt in. */
4435
4501
  showGrantedTools?: boolean;
4502
+ /** Extra rows for the record's More menu, above Delete (e.g. a host's Edit layout).
4503
+ * Rows that open something outside the menu set `data-nvr-menu-close`. */
4504
+ moreMenuItems?: ReactNode;
4436
4505
  /** Scroll to + flash a field on load (deep links: ?focus=<field>). */
4437
4506
  focusField?: string | null;
4438
4507
  /**
@@ -4614,6 +4683,11 @@ declare interface LadderTier {
4614
4683
  notify: string;
4615
4684
  }
4616
4685
 
4686
+ declare interface LastChange {
4687
+ by: string | null;
4688
+ at: string | null;
4689
+ }
4690
+
4617
4691
  /**
4618
4692
  * How long a layout save's config:update can still arrive after the save itself: the server's
4619
4693
  * per-collection push gap (config-live MIN_GAP_MS, 2 s) plus socket delivery.
@@ -4634,7 +4708,9 @@ declare interface LayoutAssignment {
4634
4708
 
4635
4709
  declare interface LayoutDesign {
4636
4710
  selected: DesignTarget | null;
4637
- onSelect(t: DesignTarget): void;
4711
+ onSelect(t: DesignTarget, opts?: SelectOptions): void;
4712
+ /** Everything selected (several fields after Shift-click); absent = just `selected`. */
4713
+ selection?: DesignTarget[];
4638
4714
  showHidden: boolean;
4639
4715
  /** Parent layout name when the node comes from an inherited layout, else null. */
4640
4716
  inheritedFrom(t: DesignTarget): string | null;
@@ -4642,6 +4718,31 @@ declare interface LayoutDesign {
4642
4718
  /** "Preview as role": what that role's field permissions do to the node
4643
4719
  * (hidden: faint with a tag, still selectable; read-only: a lock tag). */
4644
4720
  roleMark?(t: DesignTarget): RoleMark | null;
4721
+ /** Preview modes' tags on a node (role differences, what-if changes, state
4722
+ * requirements). `highlight` rings the node so differences stand out. */
4723
+ marks?(t: DesignTarget): DesignMark[];
4724
+ /** "Who sees this field" overlay: a tint and a clickable chip on the node. */
4725
+ overlay?(t: DesignTarget): DesignOverlay | null;
4726
+ /** How often a field is filled across the collection's records (#2588); null = unknown or off. */
4727
+ fillRate?(field: string): number | null;
4728
+ /** #2608: the editor note pinned to the node, shown as a marker on the canvas. */
4729
+ note?(t: DesignTarget): EditorNote | null;
4730
+ /** Expand all / Collapse all (#2627): every section folds open or shut;
4731
+ * open also lays every step and tab out one under another. */
4732
+ fold?: FoldSignal | null;
4733
+ /** Find / outline / breadcrumb (#2620): open the step, tab or section holding this. */
4734
+ reveal?: RevealSignal | null;
4735
+ /** An unsaved change touched this node (#2629): a dot until it is saved. */
4736
+ unsaved?(t: DesignTarget): boolean;
4737
+ /** Other people in the editor who have this node selected (#2651). */
4738
+ peers?(t: DesignTarget): DesignPeer[];
4739
+ /** "Show on canvas" (#2591): what a comparison says happened to the node.
4740
+ * 'removed' nodes are ghosts put back for the comparison: faint, never dragged or selected. */
4741
+ diffMark?(t: DesignTarget): DiffMark | null;
4742
+ /** Sections: who last changed it and when (#2611), from version history. */
4743
+ lastChange?(t: DesignTarget): LastChange | null;
4744
+ /** A new record's starting value for the field, as grey placeholder text (#2633). */
4745
+ ghost?(field: string): string | null;
4645
4746
  }
4646
4747
 
4647
4748
  /**
@@ -4654,6 +4755,8 @@ declare interface LayoutDesignProp {
4654
4755
  /** Preview record (its values, steps and rules); null/absent = no values. */
4655
4756
  record?: Record<string, unknown> | null;
4656
4757
  context: LayoutDesign;
4758
+ /** Preview the record as if it were in this pipeline state (state key). */
4759
+ stateKey?: string | null;
4657
4760
  /** Something on the canvas tried to write and was refused (tests, dev tooling). */
4658
4761
  onRefusedWrite?: (w: RefusedWrite) => void;
4659
4762
  }
@@ -7787,6 +7890,12 @@ export declare function restoreMetadata(qc: MetadataQueryClient, id: MetadataIde
7787
7890
  now?: () => number;
7788
7891
  }): Promise<number>;
7789
7892
 
7893
+ /** A request to bring `target` into view; `seq` changes on every request. */
7894
+ declare interface RevealSignal {
7895
+ target: DesignTarget;
7896
+ seq: number;
7897
+ }
7898
+
7790
7899
  declare type ReviewListColumnFormat = 'currency' | 'number' | 'date' | 'datetime' | 'flag';
7791
7900
 
7792
7901
  declare interface ReviewListColumnSpec {
@@ -8149,6 +8258,11 @@ declare interface Segment {
8149
8258
 
8150
8259
  export declare function SelectField({ field, value, onChange, error, disabled, readOnly, inputId, errorId }: FieldComponentProps): JSX.Element;
8151
8260
 
8261
+ declare interface SelectOptions {
8262
+ /** Shift / ⌘ / Ctrl-click: add the target to the selection, or take it out. */
8263
+ additive?: boolean;
8264
+ }
8265
+
8152
8266
  declare interface SendInput {
8153
8267
  text: string;
8154
8268
  mentions?: string[];
@@ -19,6 +19,59 @@ export declare function ExplainButton({ kind, params, label, size, autoRun }: {
19
19
  autoRun?: boolean;
20
20
  }): JSX.Element | null;
21
21
 
22
+ /** Group JSON settings (summary_fields, swap_config, …) travel as their stored JSON text. */
23
+ declare interface GroupPatch {
24
+ label?: string;
25
+ type?: string;
26
+ icon?: string | null;
27
+ is_collapsed?: boolean;
28
+ tab_mode?: string | null;
29
+ hide_when_empty?: boolean;
30
+ visibility_mode?: string | null;
31
+ summary_fields?: string | null;
32
+ summary_hide_empty?: boolean;
33
+ swap_config?: string | null;
34
+ skip_if_filled?: string | null;
35
+ content?: string | null;
36
+ content_tone?: string | null;
37
+ visible_when?: string | null;
38
+ hidden_for_roles?: string | null;
39
+ locked_for_roles?: string | null;
40
+ read_width?: string | null;
41
+ /** #2608: an editor-only note, JSON {text, by, by_name, at}. Never sent to record pages. */
42
+ editor_note?: string | null;
43
+ /** Label translations per locale, JSON `{ "es": { "label": "…" } }` (#2665). */
44
+ i18n?: string | null;
45
+ }
46
+
47
+ declare interface GroupRow {
48
+ id?: number;
49
+ key: string;
50
+ parent_key: string | null;
51
+ sort: number;
52
+ label: string;
53
+ type: string;
54
+ icon: string | null;
55
+ is_collapsed: boolean;
56
+ tab_mode: string | null;
57
+ hide_when_empty: boolean;
58
+ visibility_mode: string | null;
59
+ summary_fields: string | null;
60
+ summary_hide_empty: boolean;
61
+ swap_config: string | null;
62
+ skip_if_filled: string | null;
63
+ content: string | null;
64
+ content_tone: string | null;
65
+ visible_when: string | null;
66
+ hidden_for_roles: string | null;
67
+ locked_for_roles: string | null;
68
+ read_width: string | null;
69
+ /** #2608 — absent on databases without the column (migration 460). */
70
+ editor_note?: string | null;
71
+ /** Label translations per locale (#2665); absent before migration 465. */
72
+ i18n?: string | null;
73
+ }
74
+
22
75
  /**
23
76
  * After Edit layout mode closes, the record page re-reads its layouts, read and
24
77
  * file views and field settings. Hosts call it once the editor's `saved`
@@ -26,7 +79,14 @@ export declare function ExplainButton({ kind, params, label, size, autoRun }: {
26
79
  */
27
80
  export declare function invalidateRecordLayoutQueries(qc: QueryClient, collection: string): void;
28
81
 
29
- export declare function LayoutEditor({ collection, layoutId, onBack, mode, onLayoutChange, previewRecordId, portalContainer }: LayoutEditorProps): JSX.Element;
82
+ declare interface LayoutBundle {
83
+ layout: LayoutRow;
84
+ groups: GroupRow[];
85
+ placements: PlacementRow[];
86
+ rev: string;
87
+ }
88
+
89
+ export declare function LayoutEditor({ collection, layoutId, onBack, mode, onLayoutChange, previewRecordId, portalContainer, onDirtyChange }: LayoutEditorProps): JSX.Element;
30
90
 
31
91
  /**
32
92
  * What the layout editor needs from the app that hosts it. The editor lives in
@@ -37,12 +97,14 @@ export declare interface LayoutEditorHost {
37
97
  isAdmin: boolean;
38
98
  navigate(to: string): void;
39
99
  /** Admin-only AI review panel for a layout. Omitted by hosts that do not offer it. */
40
- aiReviewSlot?: (layoutId: number) => ReactNode;
100
+ aiReviewSlot?: (layoutId: number, ctx?: LayoutReviewContext) => ReactNode;
41
101
  /** Admin-only "explain this" control for a layout part. */
42
102
  explainSlot?: (subject: object) => ReactNode;
43
103
  /** Shown above the editor when this instance's layouts are overwritten elsewhere. */
44
104
  warning: string | null;
45
105
  recordLink(collection: string, id: string): string;
106
+ /** Where a layout of any collection opens in this host (find a field across forms). */
107
+ layoutLink?(collection: string, layoutId: number): string;
46
108
  }
47
109
 
48
110
  export declare const LayoutEditorHostContext: Context<LayoutEditorHost>;
@@ -53,6 +115,8 @@ export declare const LayoutEditorHostContext: Context<LayoutEditorHost>;
53
115
  * the right, and a top bar with Preview as, Show hidden, History, Undo / Redo
54
116
  * and the save status. One editor for every host: the Layouts tab (`page`)
55
117
  * and a record page's Edit layout mode (`overlay`, over the whole page).
118
+ * Changes wait for Save unless the top bar's Autosave is on (#2619); leaving
119
+ * with unsaved changes asks first (Save / Discard / Keep editing).
56
120
  */
57
121
  export declare interface LayoutEditorProps {
58
122
  collection: string;
@@ -73,6 +137,188 @@ export declare interface LayoutEditorProps {
73
137
  * the editor is declared in (its scroll/pointer lock would make a body
74
138
  * portal dead), else document.body. */
75
139
  portalContainer?: HTMLElement | null;
140
+ /** Unsaved changes appeared / went — for hosts that guard their own navigation. */
141
+ onDirtyChange?: (dirty: boolean) => void;
142
+ }
143
+
144
+ declare type LayoutOp = {
145
+ op: 'place';
146
+ field: string;
147
+ group_key: string | null;
148
+ index: number;
149
+ patch?: PlacementPatch;
150
+ } | {
151
+ op: 'move';
152
+ from: PlacementKey;
153
+ to_group_key: string | null;
154
+ index: number;
155
+ } | {
156
+ op: 'update_placement';
157
+ at: PlacementKey;
158
+ patch: PlacementPatch;
159
+ } | {
160
+ op: 'remove';
161
+ at: PlacementKey;
162
+ } | {
163
+ op: 'group_create';
164
+ key: string;
165
+ label: string;
166
+ group_type: string;
167
+ parent_key: string | null;
168
+ index: number;
169
+ patch?: GroupPatch;
170
+ } | {
171
+ op: 'group_update';
172
+ key: string;
173
+ patch: GroupPatch;
174
+ } | {
175
+ op: 'group_move';
176
+ key: string;
177
+ parent_key: string | null;
178
+ index: number;
179
+ } | {
180
+ op: 'group_remove';
181
+ key: string;
182
+ placements: 'ungroup' | 'delete';
183
+ } | {
184
+ op: 'layout_update';
185
+ patch: LayoutPatch;
186
+ };
187
+
188
+ /** The layout settings PATCH /collection-layouts/:id accepts. */
189
+ declare type LayoutPatch = Partial<{
190
+ name: string;
191
+ slug: string | null;
192
+ create_label: string | null;
193
+ create_hidden: boolean;
194
+ sort: number;
195
+ is_active: boolean;
196
+ disable_comments: boolean;
197
+ disable_tasks: boolean;
198
+ tab_mode: string;
199
+ validate_before_next: boolean;
200
+ summary_enabled: boolean;
201
+ summary_hide_empty: boolean;
202
+ ai_enabled: boolean;
203
+ accordion_mode: boolean;
204
+ disable_revisions: boolean;
205
+ disable_clone: boolean;
206
+ disable_delete: boolean;
207
+ row_order_field: string | null;
208
+ pdf_theme: string | null;
209
+ pdf_template_id: number | null;
210
+ pdf_cover_enabled: boolean;
211
+ pdf_cover_title_field: string | null;
212
+ pdf_cover_subtitle: string | null;
213
+ pdf_show_logo: boolean;
214
+ pdf_page_size: string;
215
+ pdf_orientation: string;
216
+ pdf_button_label: string | null;
217
+ conditions: {
218
+ role_ids?: string[];
219
+ } | null;
220
+ allow_schedule: boolean;
221
+ allow_disable_pickers: boolean;
222
+ layout_type: string;
223
+ addendum_layout_id: number | null;
224
+ workflow_template_id: string | null;
225
+ single_active_addendum: boolean;
226
+ addendum_default_view: boolean;
227
+ record_conditions: Array<{
228
+ field: string;
229
+ op: string;
230
+ value?: unknown;
231
+ }> | null;
232
+ default_values: Record<string, unknown> | null;
233
+ display_mode: string | null;
234
+ parent_layout_id: number | null;
235
+ hide_integrity_banner: boolean;
236
+ hide_sla_banner: boolean;
237
+ changes_tray: boolean;
238
+ dossier_enabled: boolean;
239
+ dossier_label: string | null;
240
+ quick_picker: string[] | null;
241
+ sheet_width: number | null;
242
+ header_fields: string[] | null;
243
+ hide_empty: boolean;
244
+ /** Required change note (#2654): null = off, 'note' = a reason, 'note_ticket' = reason + ticket. */
245
+ change_note: 'note' | 'note_ticket' | null;
246
+ }>;
247
+
248
+ /**
249
+ * What the editor hands the AI review slot (#2587): the draft, so a reviewed
250
+ * change set lands through it as ONE undo step instead of a server-side write
251
+ * the open draft would only learn about as "someone else saved".
252
+ */
253
+ declare interface LayoutReviewContext {
254
+ bundle: LayoutBundle;
255
+ apply(ops: LayoutOp[], opts: {
256
+ label: string;
257
+ }): void;
258
+ /** Why these ops would not apply to the draft as it is now (the ops twin), or null. */
259
+ check(ops: LayoutOp[]): string | null;
260
+ }
261
+
262
+ declare type LayoutRow = Record<string, unknown> & {
263
+ id: number;
264
+ collection: string;
265
+ };
266
+
267
+ /**
268
+ * Layout ops — the layout editor's save model. The editor applies small ops
269
+ * to a LayoutBundle optimistically; the API applies the same ops to the
270
+ * stored layout and writes the difference.
271
+ *
272
+ * TWIN FILE: api/src/services/layout-ops-apply.ts and
273
+ * packages/shared/src/lib/layout-ops.ts must stay byte-identical (the API
274
+ * cannot import packages/shared; an API test compares the two files). Golden
275
+ * cases both suites run: packages/shared/src/lib/layout-ops.fixtures.json.
276
+ *
277
+ * Ordering: after every op `sort` is renumbered 0..n-1 per container —
278
+ * placements per group_key (null = the Ungrouped zone), groups per
279
+ * parent_key. The top level (parent_key null) is the record page's vertical
280
+ * order: top-level groups, the Ungrouped zone (pseudo group `__ungrouped__`,
281
+ * stored as the `__ungrouped_pos__` row) and the slot cards (isCanvasSlot:
282
+ * CANVAS_SLOT_KEYS, `__owners__`, `__pdf__` and `__ext_<key>__` placements
283
+ * with group_key null), which therefore take no part in the Ungrouped zone's
284
+ * own order. Equal stored sorts keep the order the record page shows: the
285
+ * canvas tie order, then row id (new rows last).
286
+ */
287
+ declare type PlacementKey = {
288
+ field: string;
289
+ group_key: string | null;
290
+ };
291
+
292
+ declare interface PlacementPatch {
293
+ label_override?: string | null;
294
+ is_visible?: boolean;
295
+ default_expanded?: boolean;
296
+ col_span?: number | null;
297
+ overrides?: unknown;
298
+ show_row_revisions?: boolean;
299
+ allow_revision_restore?: boolean | null;
300
+ lock_conditions?: string | null;
301
+ input_bindings?: unknown;
302
+ widget_id?: number | null;
303
+ show_approval_chain?: boolean;
304
+ }
305
+
306
+ declare interface PlacementRow {
307
+ id?: number;
308
+ field: string;
309
+ group_key: string | null;
310
+ sort: number;
311
+ label_override: string | null;
312
+ is_visible: boolean;
313
+ default_expanded: boolean;
314
+ col_span: number | null;
315
+ overrides: unknown;
316
+ show_row_revisions: boolean;
317
+ allow_revision_restore: boolean | null;
318
+ lock_conditions: string | null;
319
+ input_bindings: unknown;
320
+ widget_id: number | null;
321
+ show_approval_chain: boolean;
76
322
  }
77
323
 
78
324
  export declare function useLayoutEditorHost(): LayoutEditorHost;
@@ -0,0 +1,60 @@
1
+ import { jsxs as a, jsx as r } from "react/jsx-runtime";
2
+ import { useQueryClient as f, useQuery as v } from "@tanstack/react-query";
3
+ import { Sparkles as w, X as x } from "lucide-react";
4
+ import { useRef as y, useEffect as p } from "react";
5
+ import { useNivaroClient as b } from "../context.js";
6
+ import { get as k, post as m } from "../lib/commands.js";
7
+ function C({ layoutId: n }) {
8
+ var c;
9
+ const s = b(), d = f(), o = ["form-whats-new", n], { data: e } = v({
10
+ queryKey: o,
11
+ queryFn: async () => {
12
+ const t = await s.request(
13
+ k(`/layout-collab/${n}/whats-new`)
14
+ );
15
+ return (t == null ? void 0 : t.data) ?? null;
16
+ },
17
+ staleTime: 5 * 6e4,
18
+ retry: !1
19
+ }), l = y(null);
20
+ if (p(() => {
21
+ !(e != null && e.mark) || !e.rev || l.current === e.rev || (l.current = e.rev, s.request(m(`/layout-collab/${n}/whats-new/seen`, { rev: e.rev })).catch(() => {
22
+ }));
23
+ }, [s, e, n]), !((c = e == null ? void 0 : e.lines) != null && c.length) || !e.rev) return null;
24
+ const u = e.rev, h = () => {
25
+ d.setQueryData(o, { ...e, lines: null, mark: !1 }), s.request(m(`/layout-collab/${n}/whats-new/seen`, { rev: u })).catch(() => {
26
+ });
27
+ }, i = e.changed_at ? new Date(e.changed_at).toLocaleDateString(void 0, { month: "short", day: "numeric" }) : null;
28
+ return /* @__PURE__ */ a(
29
+ "div",
30
+ {
31
+ "data-form-whats-new": "",
32
+ role: "status",
33
+ className: "mb-2 flex items-start gap-2 rounded-md border border-nvr-cyan/40 bg-nvr-cyan/5 px-3 py-2 text-[12px] text-slate-700 dark:text-foreground",
34
+ children: [
35
+ /* @__PURE__ */ r(w, { className: "mt-[1px] h-3.5 w-3.5 shrink-0 text-[#007a99] dark:text-nvr-cyan" }),
36
+ /* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: [
37
+ /* @__PURE__ */ a("div", { className: "font-semibold text-[#007a99] dark:text-nvr-cyan", children: [
38
+ "What’s new on this form",
39
+ (e.changed_by || i) && /* @__PURE__ */ r("span", { className: "ml-1.5 font-normal text-slate-500 dark:text-muted-foreground", children: [e.changed_by, i].filter(Boolean).join(" · ") })
40
+ ] }),
41
+ /* @__PURE__ */ r("ul", { className: "mt-0.5 space-y-0.5", children: e.lines.map((t) => /* @__PURE__ */ r("li", { className: "break-words", children: t }, t)) })
42
+ ] }),
43
+ /* @__PURE__ */ r(
44
+ "button",
45
+ {
46
+ type: "button",
47
+ "aria-label": "Dismiss what’s new",
48
+ "data-tip": "Got it",
49
+ onClick: h,
50
+ className: "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-nvr-cyan/10 hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground",
51
+ children: /* @__PURE__ */ r(x, { className: "h-3.5 w-3.5" })
52
+ }
53
+ )
54
+ ]
55
+ }
56
+ );
57
+ }
58
+ export {
59
+ C as FormWhatsNew
60
+ };