@nivaro/react 0.2.53 → 0.2.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +452 -4
  4. package/dist/index.js +644 -618
  5. package/dist/layout-editor.d.ts +252 -2
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/FormWhatsNew.js +60 -0
  10. package/dist/shared/components/ItemEditForm.js +3968 -3618
  11. package/dist/shared/components/JobsTray.js +100 -55
  12. package/dist/shared/components/MyWorkView.js +91 -89
  13. package/dist/shared/components/NotificationBell.js +80 -79
  14. package/dist/shared/components/ProfileView.js +568 -520
  15. package/dist/shared/components/RecordCompare.js +254 -0
  16. package/dist/shared/components/RecordReadView.js +598 -543
  17. package/dist/shared/components/ReportView.js +578 -543
  18. package/dist/shared/components/RowPresence.js +91 -0
  19. package/dist/shared/components/TipLayer.js +27 -27
  20. package/dist/shared/components/WidgetSlot.js +474 -458
  21. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  22. package/dist/shared/components/ai/AskPanel.js +139 -119
  23. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  24. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  25. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  26. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  27. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  28. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  29. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  30. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  31. package/dist/shared/components/chat/Composer.js +357 -303
  32. package/dist/shared/components/chat/MessageActions.js +92 -0
  33. package/dist/shared/components/chat/MessageFormat.js +290 -264
  34. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  35. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  36. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  37. package/dist/shared/components/chat/RoomParts.js +213 -274
  38. package/dist/shared/components/chat/ScreenClip.js +184 -0
  39. package/dist/shared/components/chat/chat-core.js +402 -483
  40. package/dist/shared/components/chat/chat-drafts.js +59 -0
  41. package/dist/shared/components/chat/chat-emoji.js +348 -0
  42. package/dist/shared/components/chat/chat-local-time.js +41 -0
  43. package/dist/shared/components/chat/chat-outbox.js +303 -0
  44. package/dist/shared/components/chat/chat-window.js +163 -0
  45. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  46. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  47. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  48. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  49. package/dist/shared/components/help-videos/api.js +80 -67
  50. package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
  51. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  52. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  53. package/dist/shared/components/item-edit/FieldAffordances.js +9 -8
  54. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  55. package/dist/shared/components/item-edit/FieldRow.js +382 -320
  56. package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
  57. package/dist/shared/components/item-edit/GroupSection.js +786 -639
  58. package/dist/shared/components/item-edit/HeaderTools.js +59 -56
  59. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  60. package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
  61. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  62. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  63. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  64. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  65. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  66. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  67. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  68. package/dist/shared/components/item-edit/lock-why.js +94 -0
  69. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  70. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  71. package/dist/shared/components/item-edit/useFormUsageBeacon.js +65 -0
  72. package/dist/shared/components/layout-editor/AddPanel.js +226 -151
  73. package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
  74. package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
  75. package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
  76. package/dist/shared/components/layout-editor/ChangeNote.js +147 -0
  77. package/dist/shared/components/layout-editor/CollabParts.js +175 -0
  78. package/dist/shared/components/layout-editor/DesignNode.js +311 -116
  79. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -26
  80. package/dist/shared/components/layout-editor/EditorTopBar.js +463 -175
  81. package/dist/shared/components/layout-editor/FindReplace.js +188 -0
  82. package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
  83. package/dist/shared/components/layout-editor/HistoryPanel.js +250 -109
  84. package/dist/shared/components/layout-editor/LayoutEditor.js +1196 -305
  85. package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
  86. package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
  87. package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
  88. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  89. package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
  90. package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
  91. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  92. package/dist/shared/components/layout-editor/StructureMenu.js +464 -0
  93. package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
  94. package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
  95. package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
  96. package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
  97. package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
  98. package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
  99. package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
  100. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
  101. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
  102. package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
  103. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
  104. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
  105. package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
  106. package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
  107. package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
  108. package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
  109. package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
  110. package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
  111. package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
  112. package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
  113. package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
  114. package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
  115. package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
  116. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
  117. package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
  118. package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
  119. package/dist/shared/components/layout-editor/assist/jump.js +142 -0
  120. package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
  121. package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
  122. package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
  123. package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
  124. package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
  125. package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
  126. package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
  127. package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
  128. package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
  129. package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
  130. package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
  131. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +388 -0
  132. package/dist/shared/components/layout-editor/collab/collab-api.js +80 -0
  133. package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
  134. package/dist/shared/components/layout-editor/commands/intents.js +214 -0
  135. package/dist/shared/components/layout-editor/commands/parse.js +242 -0
  136. package/dist/shared/components/layout-editor/design-context.js +26 -6
  137. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +181 -164
  138. package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
  139. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  140. package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
  141. package/dist/shared/components/layout-editor/draft-recovery.js +131 -0
  142. package/dist/shared/components/layout-editor/editor-notes.js +78 -0
  143. package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
  144. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  145. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  146. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  147. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  148. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  149. package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
  150. package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
  151. package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
  152. package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
  153. package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
  154. package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
  155. package/dist/shared/components/layout-editor/field-zones.js +116 -0
  156. package/dist/shared/components/layout-editor/form-map.js +138 -0
  157. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  158. package/dist/shared/components/layout-editor/history-api.js +87 -0
  159. package/dist/shared/components/layout-editor/inheritance.js +55 -0
  160. package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
  161. package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
  162. package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
  163. package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
  164. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  165. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
  166. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +179 -0
  167. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
  168. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +291 -141
  169. package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
  170. package/dist/shared/components/layout-editor/inspector/Inspector.js +282 -180
  171. package/dist/shared/components/layout-editor/inspector/LookTab.js +166 -109
  172. package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
  173. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  174. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
  175. package/dist/shared/components/layout-editor/inspector/PickerTab.js +146 -118
  176. package/dist/shared/components/layout-editor/inspector/RulesTab.js +162 -111
  177. package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
  178. package/dist/shared/components/layout-editor/inspector/kit.js +71 -70
  179. package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
  180. package/dist/shared/components/layout-editor/is-typing.js +9 -0
  181. package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
  182. package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
  183. package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
  184. package/dist/shared/components/layout-editor/load-error.js +37 -0
  185. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
  186. package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
  187. package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
  188. package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
  189. package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
  190. package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
  191. package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
  192. package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
  193. package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
  194. package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
  195. package/dist/shared/components/layout-editor/nav/find.js +20 -0
  196. package/dist/shared/components/layout-editor/nav/tree.js +142 -0
  197. package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
  198. package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
  199. package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
  200. package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
  201. package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
  202. package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
  203. package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
  204. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  205. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  206. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  207. package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
  208. package/dist/shared/components/layout-editor/overview/describe-conditions.js +24 -14
  209. package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
  210. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  211. package/dist/shared/components/layout-editor/panel-style.js +8 -7
  212. package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
  213. package/dist/shared/components/layout-editor/pin.js +25 -0
  214. package/dist/shared/components/layout-editor/presence.js +111 -0
  215. package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
  216. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
  217. package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
  218. package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
  219. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  220. package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
  221. package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
  222. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
  223. package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
  224. package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
  225. package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
  226. package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
  227. package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
  228. package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
  229. package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
  230. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  231. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  232. package/dist/shared/components/layout-editor/settings/FormSettings.js +125 -103
  233. package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
  234. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  235. package/dist/shared/components/layout-editor/settings/ToolsSection.js +215 -105
  236. package/dist/shared/components/layout-editor/settings/WhoSection.js +139 -100
  237. package/dist/shared/components/layout-editor/settings/controls.js +8 -8
  238. package/dist/shared/components/layout-editor/settings/settings-registry.js +142 -21
  239. package/dist/shared/components/layout-editor/shortcuts.js +88 -0
  240. package/dist/shared/components/layout-editor/show-when.js +35 -0
  241. package/dist/shared/components/layout-editor/slot-names.js +4 -3
  242. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  243. package/dist/shared/components/layout-editor/structure-ops.js +403 -0
  244. package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
  245. package/dist/shared/components/layout-editor/testing/TestingPanels.js +556 -0
  246. package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
  247. package/dist/shared/components/layout-editor/testing/testing-model.js +406 -0
  248. package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
  249. package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
  250. package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
  251. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  252. package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
  253. package/dist/shared/components/layout-editor/usage/UsagePanel.js +232 -0
  254. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  255. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  256. package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
  257. package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
  258. package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -306
  259. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  260. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  261. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  262. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  263. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  264. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  265. package/dist/shared/components/support/SuggestFormChange.js +143 -0
  266. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  267. package/dist/shared/components/support/SupportView.js +75 -73
  268. package/dist/shared/lib/ai-fill.js +37 -0
  269. package/dist/shared/lib/background-runs.js +150 -0
  270. package/dist/shared/lib/delivery-ack.js +9 -0
  271. package/dist/shared/lib/entry-badge-style.js +13 -0
  272. package/dist/shared/lib/entry-config.js +71 -0
  273. package/dist/shared/lib/form-sections.js +64 -0
  274. package/dist/shared/lib/form-structure.js +99 -0
  275. package/dist/shared/lib/form-usage-beacon.js +133 -0
  276. package/dist/shared/lib/jobs-tray.js +25 -23
  277. package/dist/shared/lib/keyset-pager.js +37 -0
  278. package/dist/shared/lib/layout-i18n.js +66 -0
  279. package/dist/shared/lib/layout-lint.js +490 -0
  280. package/dist/shared/lib/layout-ops.js +116 -110
  281. package/dist/shared/lib/layout-resolve.js +113 -0
  282. package/dist/shared/lib/placement-behaviour.js +144 -0
  283. package/dist/shared/lib/prefetch.js +149 -0
  284. package/dist/shared/lib/presence-hooks.js +199 -0
  285. package/dist/shared/lib/record-outbox.js +82 -81
  286. package/dist/shared/lib/replay-socket.js +93 -0
  287. package/dist/shared/lib/request-gate.js +51 -50
  288. package/dist/shared/lib/room-gaps.js +96 -0
  289. package/dist/shared/lib/screenshot.js +54 -28
  290. package/dist/shared/lib/search-log.js +27 -0
  291. package/dist/shared/lib/socket-realtime.js +101 -80
  292. package/dist/shared/lib/visible-when.js +34 -0
  293. package/dist/shared/lib/worker-socket.js +200 -0
  294. package/package.json +1 -1
@@ -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,192 @@ 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
+ /** How people enter data on the form (#2702 #2707 #2708 #2710 #2728): presets, keyboard, tab order, mode, badge. */
247
+ entry_config: Record<string, unknown> | null;
248
+ /** A section as an email body (#2725): the group key whose fields notification emails show. */
249
+ email_summary_group: string | null;
250
+ }>;
251
+
252
+ /**
253
+ * What the editor hands the AI review slot (#2587): the draft, so a reviewed
254
+ * change set lands through it as ONE undo step instead of a server-side write
255
+ * the open draft would only learn about as "someone else saved".
256
+ */
257
+ declare interface LayoutReviewContext {
258
+ bundle: LayoutBundle;
259
+ apply(ops: LayoutOp[], opts: {
260
+ label: string;
261
+ }): void;
262
+ /** Why these ops would not apply to the draft as it is now (the ops twin), or null. */
263
+ check(ops: LayoutOp[]): string | null;
264
+ }
265
+
266
+ declare type LayoutRow = Record<string, unknown> & {
267
+ id: number;
268
+ collection: string;
269
+ };
270
+
271
+ /**
272
+ * Layout ops — the layout editor's save model. The editor applies small ops
273
+ * to a LayoutBundle optimistically; the API applies the same ops to the
274
+ * stored layout and writes the difference.
275
+ *
276
+ * TWIN FILE: api/src/services/layout-ops-apply.ts and
277
+ * packages/shared/src/lib/layout-ops.ts must stay byte-identical (the API
278
+ * cannot import packages/shared; an API test compares the two files). Golden
279
+ * cases both suites run: packages/shared/src/lib/layout-ops.fixtures.json.
280
+ *
281
+ * Ordering: after every op `sort` is renumbered 0..n-1 per container —
282
+ * placements per group_key (null = the Ungrouped zone), groups per
283
+ * parent_key. The top level (parent_key null) is the record page's vertical
284
+ * order: top-level groups, the Ungrouped zone (pseudo group `__ungrouped__`,
285
+ * stored as the `__ungrouped_pos__` row) and the slot cards (isCanvasSlot:
286
+ * CANVAS_SLOT_KEYS, `__owners__`, `__pdf__` and `__ext_<key>__` placements
287
+ * with group_key null), which therefore take no part in the Ungrouped zone's
288
+ * own order. Equal stored sorts keep the order the record page shows: the
289
+ * canvas tie order, then row id (new rows last).
290
+ */
291
+ declare type PlacementKey = {
292
+ field: string;
293
+ group_key: string | null;
294
+ };
295
+
296
+ declare interface PlacementPatch {
297
+ label_override?: string | null;
298
+ is_visible?: boolean;
299
+ default_expanded?: boolean;
300
+ col_span?: number | null;
301
+ overrides?: unknown;
302
+ show_row_revisions?: boolean;
303
+ allow_revision_restore?: boolean | null;
304
+ lock_conditions?: string | null;
305
+ input_bindings?: unknown;
306
+ widget_id?: number | null;
307
+ show_approval_chain?: boolean;
308
+ }
309
+
310
+ declare interface PlacementRow {
311
+ id?: number;
312
+ field: string;
313
+ group_key: string | null;
314
+ sort: number;
315
+ label_override: string | null;
316
+ is_visible: boolean;
317
+ default_expanded: boolean;
318
+ col_span: number | null;
319
+ overrides: unknown;
320
+ show_row_revisions: boolean;
321
+ allow_revision_restore: boolean | null;
322
+ lock_conditions: string | null;
323
+ input_bindings: unknown;
324
+ widget_id: number | null;
325
+ show_approval_chain: boolean;
76
326
  }
77
327
 
78
328
  export declare function useLayoutEditorHost(): LayoutEditorHost;
@@ -0,0 +1,117 @@
1
+ import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
+ import { AlertCircle as g, Timer as h, Loader2 as b } from "lucide-react";
3
+ import { useState as v, useEffect as k } from "react";
4
+ import { useBackgroundRun as w, clock as o, runProgress as y } from "../lib/background-runs.js";
5
+ import { cn as u } from "../lib/utils.js";
6
+ function _({
7
+ className: s,
8
+ ...f
9
+ }) {
10
+ var p, m;
11
+ const e = w(f), d = (p = e.run) != null && p.started_at ? Date.parse(e.run.started_at) : null, [x, c] = v(() => Date.now());
12
+ if (k(() => {
13
+ if (e.phase !== "running") return;
14
+ c(Date.now());
15
+ const r = setInterval(() => c(Date.now()), 1e3);
16
+ return () => clearInterval(r);
17
+ }, [e.phase]), e.phase === "idle" || e.phase === "done") return null;
18
+ if (e.phase === "error")
19
+ return /* @__PURE__ */ a(
20
+ "div",
21
+ {
22
+ "data-background-run": "error",
23
+ role: "alert",
24
+ className: u("flex flex-wrap items-center gap-x-2 gap-y-1 text-[12px]", s),
25
+ children: [
26
+ /* @__PURE__ */ t(g, { className: "h-3.5 w-3.5 shrink-0 text-rose-500" }),
27
+ /* @__PURE__ */ t("span", { className: "min-w-0 text-rose-700 dark:text-rose-300", children: e.error ?? "The background run failed." }),
28
+ /* @__PURE__ */ t(
29
+ "button",
30
+ {
31
+ type: "button",
32
+ onClick: e.start,
33
+ className: "rounded text-[12px] font-medium text-slate-600 underline-offset-2 hover:text-slate-900 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-slate-300 dark:hover:text-white",
34
+ children: "Try again"
35
+ }
36
+ )
37
+ ]
38
+ }
39
+ );
40
+ if (e.phase === "running") {
41
+ const r = d ? Math.max(0, x - d) : 0, i = ((m = e.run) == null ? void 0 : m.expected_ms) ?? null, n = y(r, i);
42
+ return /* @__PURE__ */ a(
43
+ "div",
44
+ {
45
+ "data-background-run": "running",
46
+ "aria-live": "polite",
47
+ className: u("flex w-full min-w-0 flex-col gap-1.5", s),
48
+ children: [
49
+ /* @__PURE__ */ t(
50
+ "div",
51
+ {
52
+ role: "progressbar",
53
+ "aria-label": "Background run",
54
+ "aria-valuemin": 0,
55
+ "aria-valuemax": 100,
56
+ "aria-valuenow": n == null ? void 0 : Math.round(n * 100),
57
+ className: "relative h-1 w-full overflow-hidden rounded-full bg-slate-100 dark:bg-slate-800",
58
+ children: n == null ? /* @__PURE__ */ t("div", { className: "nvr-bgrun-sweep absolute inset-y-0 left-0 w-1/3 rounded-full bg-nvr-cyan/70" }) : /* @__PURE__ */ t(
59
+ "div",
60
+ {
61
+ className: "h-full w-full origin-left rounded-full bg-nvr-cyan transition-transform duration-1000 ease-linear motion-reduce:transition-none",
62
+ style: { transform: `scaleX(${n})` }
63
+ }
64
+ )
65
+ }
66
+ ),
67
+ /* @__PURE__ */ a("p", { className: "text-[12px] text-slate-600 dark:text-slate-300", children: [
68
+ "Running in the background",
69
+ /* @__PURE__ */ t("span", { className: "text-slate-400 dark:text-slate-500", children: " · " }),
70
+ /* @__PURE__ */ a("span", { className: "tabular-nums", children: [
71
+ o(r),
72
+ i ? ` of about ${o(i)}` : ""
73
+ ] })
74
+ ] }),
75
+ /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: "You can leave this page. Your jobs tray says when it is ready." }),
76
+ /* @__PURE__ */ t("style", { children: N })
77
+ ]
78
+ }
79
+ );
80
+ }
81
+ const l = e.typicalMs;
82
+ return /* @__PURE__ */ a(
83
+ "div",
84
+ {
85
+ "data-background-run": "offer",
86
+ className: u("flex flex-wrap items-center gap-x-3 gap-y-1.5", s),
87
+ children: [
88
+ /* @__PURE__ */ a("span", { className: "inline-flex min-w-0 items-center gap-1.5 text-[12px] text-slate-600 dark:text-slate-300", children: [
89
+ /* @__PURE__ */ t(h, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
90
+ l && l >= 1e3 ? `This usually takes about ${o(l)}.` : "This is taking a while."
91
+ ] }),
92
+ /* @__PURE__ */ a(
93
+ "button",
94
+ {
95
+ type: "button",
96
+ onClick: e.start,
97
+ disabled: e.phase === "starting",
98
+ "data-background-run-start": !0,
99
+ className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-slate-200 bg-white px-2.5 text-[12px] font-medium text-slate-700 transition-colors duration-150 hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:pointer-events-none disabled:opacity-60 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-200 dark:hover:bg-slate-800",
100
+ children: [
101
+ e.phase === "starting" && /* @__PURE__ */ t(b, { className: "h-3 w-3 animate-spin" }),
102
+ "Run in background"
103
+ ]
104
+ }
105
+ )
106
+ ]
107
+ }
108
+ );
109
+ }
110
+ const N = `
111
+ @keyframes nvr-bgrun-sweep { from { transform: translateX(-100%) } to { transform: translateX(300%) } }
112
+ .nvr-bgrun-sweep { animation: nvr-bgrun-sweep 1.6s cubic-bezier(0.25, 1, 0.5, 1) infinite }
113
+ @media (prefers-reduced-motion: reduce) { .nvr-bgrun-sweep { animation: none; width: 100%; opacity: .5 } }
114
+ `;
115
+ export {
116
+ _ as BackgroundRunOffer
117
+ };