@nivaro/react 0.2.51 → 0.2.52

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 (117) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +204 -6
  4. package/dist/index.js +442 -439
  5. package/dist/layout-editor.d.ts +80 -0
  6. package/dist/layout-editor.js +11 -0
  7. package/dist/shared/components/ItemEditForm.js +4044 -3866
  8. package/dist/shared/components/RecordDrilldownSheet.js +114 -97
  9. package/dist/shared/components/RecordReadView.js +637 -570
  10. package/dist/shared/components/ai/ExplainButton.js +1 -1
  11. package/dist/shared/components/item-edit/GroupSection.js +489 -466
  12. package/dist/shared/components/item-edit/HeaderBand.js +47 -44
  13. package/dist/shared/components/item-edit/M2MStagingContext.js +3 -3
  14. package/dist/shared/components/item-edit/O2MStagingContext.js +1 -1
  15. package/dist/shared/components/item-edit/RecordGrantTools.js +206 -0
  16. package/dist/shared/components/item-edit/StepsBar.js +49 -43
  17. package/dist/shared/components/item-edit/SummaryPanel.js +1 -1
  18. package/dist/shared/components/item-edit/config-update.js +6 -0
  19. package/dist/shared/components/item-edit/layout-editing-quiet.js +25 -0
  20. package/dist/shared/components/layout-editor/AddPanel.js +301 -0
  21. package/dist/shared/components/layout-editor/DesignNode.js +173 -0
  22. package/dist/shared/components/layout-editor/EditorCanvas.js +52 -0
  23. package/dist/shared/components/layout-editor/EditorTopBar.js +241 -0
  24. package/dist/shared/components/layout-editor/HistoryPanel.js +179 -0
  25. package/dist/shared/components/layout-editor/LayoutEditor.js +393 -0
  26. package/dist/shared/components/layout-editor/LayoutsRail.js +89 -0
  27. package/dist/shared/components/layout-editor/add-target.js +103 -0
  28. package/dist/shared/components/layout-editor/bundle-to-active.js +86 -0
  29. package/dist/shared/components/layout-editor/canvases/PdfCanvas.js +90 -0
  30. package/dist/shared/components/layout-editor/canvases/TableColumnsCanvas.js +246 -0
  31. package/dist/shared/components/layout-editor/collection-meta.js +22 -0
  32. package/dist/shared/components/layout-editor/design-canvas.js +81 -0
  33. package/dist/shared/components/layout-editor/design-context.js +21 -0
  34. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +225 -0
  35. package/dist/shared/components/layout-editor/dnd/collision.js +107 -0
  36. package/dist/shared/components/layout-editor/dnd/node.js +164 -0
  37. package/dist/shared/components/layout-editor/dnd/order.js +122 -0
  38. package/dist/shared/components/layout-editor/editors/DefaultValuesEditor.js +223 -0
  39. package/dist/shared/components/layout-editor/editors/QuickPickerStepsEditor.js +129 -0
  40. package/dist/shared/components/layout-editor/editors/ReadPresentationEditor.js +134 -0
  41. package/dist/shared/components/layout-editor/editors/RecordConditionsEditor.js +249 -0
  42. package/dist/shared/components/layout-editor/editors/RolesPicker.js +77 -0
  43. package/dist/shared/components/layout-editor/editors/cascade-filters.js +556 -0
  44. package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +150 -0
  45. package/dist/shared/components/layout-editor/editors/controls.js +73 -0
  46. package/dist/shared/components/layout-editor/editors/editor-api.js +21 -0
  47. package/dist/shared/components/layout-editor/editors/editor-queries.js +25 -0
  48. package/dist/shared/components/layout-editor/editors/field-default-value.js +131 -0
  49. package/dist/shared/components/layout-editor/editors/grid-presets.js +310 -0
  50. package/dist/shared/components/layout-editor/editors/inline-display.js +157 -0
  51. package/dist/shared/components/layout-editor/editors/layout-picker.js +80 -0
  52. package/dist/shared/components/layout-editor/editors/layout-rows.js +55 -0
  53. package/dist/shared/components/layout-editor/editors/lock-conditions.js +109 -0
  54. package/dist/shared/components/layout-editor/editors/o2m-agg-field.js +25 -0
  55. package/dist/shared/components/layout-editor/editors/pdf-field-config.js +107 -0
  56. package/dist/shared/components/layout-editor/editors/report-widget-config.js +94 -0
  57. package/dist/shared/components/layout-editor/editors/row-rule-check.js +225 -0
  58. package/dist/shared/components/layout-editor/editors/row-rule-row.js +1353 -0
  59. package/dist/shared/components/layout-editor/editors/swap-config.js +245 -0
  60. package/dist/shared/components/layout-editor/focus-buffer.js +32 -0
  61. package/dist/shared/components/layout-editor/host.js +15 -0
  62. package/dist/shared/components/layout-editor/inspector/AdvancedTab.js +296 -0
  63. package/dist/shared/components/layout-editor/inspector/GridTab.js +767 -0
  64. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +456 -0
  65. package/dist/shared/components/layout-editor/inspector/HeaderItemInspector.js +268 -0
  66. package/dist/shared/components/layout-editor/inspector/Inspector.js +332 -0
  67. package/dist/shared/components/layout-editor/inspector/LookTab.js +310 -0
  68. package/dist/shared/components/layout-editor/inspector/PickerTab.js +333 -0
  69. package/dist/shared/components/layout-editor/inspector/RulesTab.js +323 -0
  70. package/dist/shared/components/layout-editor/inspector/SlotInspector.js +179 -0
  71. package/dist/shared/components/layout-editor/inspector/SubtitleInspector.js +154 -0
  72. package/dist/shared/components/layout-editor/inspector/WidgetInspector.js +262 -0
  73. package/dist/shared/components/layout-editor/inspector/applies.js +27 -0
  74. package/dist/shared/components/layout-editor/inspector/field-context.js +134 -0
  75. package/dist/shared/components/layout-editor/inspector/interfaces.js +126 -0
  76. package/dist/shared/components/layout-editor/inspector/kit.js +595 -0
  77. package/dist/shared/components/layout-editor/inspector/model.js +307 -0
  78. package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -0
  79. package/dist/shared/components/layout-editor/overview/describe-conditions.js +121 -0
  80. package/dist/shared/components/layout-editor/overview/overview-api.js +141 -0
  81. package/dist/shared/components/layout-editor/overview/purpose.js +62 -0
  82. package/dist/shared/components/layout-editor/overview/record-count.js +65 -0
  83. package/dist/shared/components/layout-editor/panel-frame.js +99 -0
  84. package/dist/shared/components/layout-editor/panel-style.js +19 -0
  85. package/dist/shared/components/layout-editor/pickers/field-picker.js +230 -0
  86. package/dist/shared/components/layout-editor/pickers/icon-picker.js +233 -0
  87. package/dist/shared/components/layout-editor/pickers/relation-label.js +34 -0
  88. package/dist/shared/components/layout-editor/pickers/relation-picker.js +136 -0
  89. package/dist/shared/components/layout-editor/record-queries.js +15 -0
  90. package/dist/shared/components/layout-editor/settings/AddendumSection.js +52 -0
  91. package/dist/shared/components/layout-editor/settings/ButtonsSection.js +45 -0
  92. package/dist/shared/components/layout-editor/settings/DefaultsSection.js +67 -0
  93. package/dist/shared/components/layout-editor/settings/FormSettings.js +146 -0
  94. package/dist/shared/components/layout-editor/settings/InheritanceSection.js +37 -0
  95. package/dist/shared/components/layout-editor/settings/LayoutSection.js +70 -0
  96. package/dist/shared/components/layout-editor/settings/PdfSection.js +176 -0
  97. package/dist/shared/components/layout-editor/settings/ReadSection.js +79 -0
  98. package/dist/shared/components/layout-editor/settings/TextSetting.js +55 -0
  99. package/dist/shared/components/layout-editor/settings/ToggleSetting.js +33 -0
  100. package/dist/shared/components/layout-editor/settings/ToolsSection.js +179 -0
  101. package/dist/shared/components/layout-editor/settings/WhoSection.js +213 -0
  102. package/dist/shared/components/layout-editor/settings/controls.js +214 -0
  103. package/dist/shared/components/layout-editor/settings/section-props.js +17 -0
  104. package/dist/shared/components/layout-editor/settings/settings-api.js +151 -0
  105. package/dist/shared/components/layout-editor/settings/settings-registry.js +445 -0
  106. package/dist/shared/components/layout-editor/slot-names.js +20 -0
  107. package/dist/shared/components/layout-editor/summary-pref.js +21 -0
  108. package/dist/shared/components/layout-editor/useLayoutDraft.js +474 -0
  109. package/dist/shared/components/pipeline/relations.js +28 -23
  110. package/dist/shared/components/ui/popover.js +17 -17
  111. package/dist/shared/components/ui/scroll-area.js +38 -0
  112. package/dist/shared/hooks/useRelationOptions.js +60 -0
  113. package/dist/shared/lib/layout-grants.js +9 -0
  114. package/dist/shared/lib/layout-ops.js +348 -0
  115. package/dist/shared/lib/layout-slots.js +11 -7
  116. package/dist/shared/lib/request-gate.js +1 -1
  117. package/package.json +5 -1
@@ -0,0 +1,80 @@
1
+ import { Context } from 'react';
2
+ import { JSX } from 'react';
3
+ import type { QueryClient } from '@tanstack/react-query';
4
+ import { ReactNode } from 'react';
5
+
6
+ /**
7
+ * Admin-only "Explain" for an operations event (issue, slow request, failed run, readiness
8
+ * check, partner/webhook failure, slow page, config, data model). One POST to
9
+ * /ai-explain/:kind with kind-specific params; the answer is a suggestion and says so.
10
+ * Host-agnostic: it reads the ambient Nivaro client, admin flag and navigation context, and
11
+ * renders nothing for a non-admin (the route is admin-only too).
12
+ */
13
+ export declare function ExplainButton({ kind, params, label, size, autoRun }: {
14
+ kind: string;
15
+ params: Record<string, unknown>;
16
+ label?: string;
17
+ size?: 'sm' | 'default';
18
+ /** Run once on mount (the button was already clicked to reveal this). */
19
+ autoRun?: boolean;
20
+ }): JSX.Element | null;
21
+
22
+ /**
23
+ * After Edit layout mode closes, the record page re-reads its layouts, read and
24
+ * file views and field settings. Hosts call it once the editor's `saved`
25
+ * promise settles (LayoutEditor onBack), so the refetch sees the last save.
26
+ */
27
+ export declare function invalidateRecordLayoutQueries(qc: QueryClient, collection: string): void;
28
+
29
+ export declare function LayoutEditor({ collection, layoutId, onBack, mode, onLayoutChange, previewRecordId, portalContainer }: LayoutEditorProps): JSX.Element;
30
+
31
+ /**
32
+ * What the layout editor needs from the app that hosts it. The editor lives in
33
+ * @nivaro/shared and may not import admin code: anything admin-only (AI review,
34
+ * explain, routing, the admin gate) comes in through this contract.
35
+ */
36
+ export declare interface LayoutEditorHost {
37
+ isAdmin: boolean;
38
+ navigate(to: string): void;
39
+ /** Admin-only AI review panel for a layout. Omitted by hosts that do not offer it. */
40
+ aiReviewSlot?: (layoutId: number) => ReactNode;
41
+ /** Admin-only "explain this" control for a layout part. */
42
+ explainSlot?: (subject: object) => ReactNode;
43
+ /** Shown above the editor when this instance's layouts are overwritten elsewhere. */
44
+ warning: string | null;
45
+ recordLink(collection: string, id: string): string;
46
+ }
47
+
48
+ export declare const LayoutEditorHostContext: Context<LayoutEditorHost>;
49
+
50
+ /**
51
+ * The layout editor (spec §7.2): layouts rail and Add panel on the left, the
52
+ * real form in design mode in the centre, the inspector (or Form settings) on
53
+ * the right, and a top bar with Preview as, Show hidden, History, Undo / Redo
54
+ * and the save status. One editor for every host: the Layouts tab (`page`)
55
+ * and a record page's Edit layout mode (`overlay`, over the whole page).
56
+ */
57
+ export declare interface LayoutEditorProps {
58
+ collection: string;
59
+ layoutId: number;
60
+ /**
61
+ * Leave the editor. `saved` resolves once the last edit has reached the
62
+ * server (or failed): hosts close at once and re-read what the record page
63
+ * renders after it (invalidateRecordLayoutQueries), so the refetch cannot
64
+ * beat the save.
65
+ */
66
+ onBack: (saved: Promise<void>) => void;
67
+ mode: 'page' | 'overlay';
68
+ /** Another layout was picked in the rail — hosts mirror it into the URL. */
69
+ onLayoutChange?: (layoutId: number) => void;
70
+ /** Open the preview on this record (the record page that opened the editor). */
71
+ previewRecordId?: string | null;
72
+ /** Overlay mode: where the overlay mounts. Default: the modal dialog/sheet
73
+ * the editor is declared in (its scroll/pointer lock would make a body
74
+ * portal dead), else document.body. */
75
+ portalContainer?: HTMLElement | null;
76
+ }
77
+
78
+ export declare function useLayoutEditorHost(): LayoutEditorHost;
79
+
80
+ export { }
@@ -0,0 +1,11 @@
1
+ import { ExplainButton as r } from "./shared/components/ai/ExplainButton.js";
2
+ import { LayoutEditor as a } from "./shared/components/layout-editor/LayoutEditor.js";
3
+ import { LayoutEditorHostContext as u, useLayoutEditorHost as x } from "./shared/components/layout-editor/host.js";
4
+ import { invalidateRecordLayoutQueries as p } from "./shared/components/layout-editor/record-queries.js";
5
+ export {
6
+ r as ExplainButton,
7
+ a as LayoutEditor,
8
+ u as LayoutEditorHostContext,
9
+ p as invalidateRecordLayoutQueries,
10
+ x as useLayoutEditorHost
11
+ };