@instructure/platform-block-content-editor 3.6.0 → 4.0.1

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 (113) hide show
  1. package/README.md +72 -17
  2. package/dist/editor/BlockContentEditor.d.ts +16 -8
  3. package/dist/editor/BlockContentEditor.d.ts.map +1 -1
  4. package/dist/editor/ai/AIGenerationContext.d.ts +46 -0
  5. package/dist/editor/ai/AIGenerationContext.d.ts.map +1 -0
  6. package/dist/editor/ai/BlockAIMenu.d.ts.map +1 -1
  7. package/dist/editor/ai/BlockGenerationOverlay.d.ts +16 -0
  8. package/dist/editor/ai/BlockGenerationOverlay.d.ts.map +1 -0
  9. package/dist/editor/ai/PreviewBlockModal.d.ts +2 -7
  10. package/dist/editor/ai/PreviewBlockModal.d.ts.map +1 -1
  11. package/dist/editor/ai/aiTranslations.d.ts +17 -0
  12. package/dist/editor/ai/aiTranslations.d.ts.map +1 -1
  13. package/dist/editor/ai/aiTypes.d.ts +2 -0
  14. package/dist/editor/ai/aiTypes.d.ts.map +1 -1
  15. package/dist/editor/ai/generationOverlayStyles.d.ts +18 -0
  16. package/dist/editor/ai/generationOverlayStyles.d.ts.map +1 -0
  17. package/dist/editor/ai/index.d.ts +2 -1
  18. package/dist/editor/ai/index.d.ts.map +1 -1
  19. package/dist/editor/ai/previewBlockStyles.d.ts +17 -0
  20. package/dist/editor/ai/previewBlockStyles.d.ts.map +1 -0
  21. package/dist/editor/ai/previewDiff.d.ts +73 -0
  22. package/dist/editor/ai/previewDiff.d.ts.map +1 -0
  23. package/dist/editor/ai/previewDiff.test.d.ts +2 -0
  24. package/dist/editor/ai/previewDiff.test.d.ts.map +1 -0
  25. package/dist/editor/canvas/DesignerArea.d.ts +8 -6
  26. package/dist/editor/canvas/DesignerArea.d.ts.map +1 -1
  27. package/dist/editor/canvas/DesignerCanvas.d.ts +2 -6
  28. package/dist/editor/canvas/DesignerCanvas.d.ts.map +1 -1
  29. package/dist/editor/canvas/GridDndContext.d.ts +0 -1
  30. package/dist/editor/canvas/GridDndContext.d.ts.map +1 -1
  31. package/dist/editor/canvas/GridDndProvider.d.ts +8 -3
  32. package/dist/editor/canvas/GridDndProvider.d.ts.map +1 -1
  33. package/dist/editor/canvas/GridItemChild.d.ts.map +1 -1
  34. package/dist/editor/canvas/GridItemContainer.d.ts.map +1 -1
  35. package/dist/editor/canvas/GridViewer.d.ts +5 -16
  36. package/dist/editor/canvas/GridViewer.d.ts.map +1 -1
  37. package/dist/editor/canvas/TwoColumnDesigner.d.ts +1 -6
  38. package/dist/editor/canvas/TwoColumnDesigner.d.ts.map +1 -1
  39. package/dist/editor/canvas/canvasStyles.d.ts +3 -0
  40. package/dist/editor/canvas/canvasStyles.d.ts.map +1 -1
  41. package/dist/editor/canvas/index.d.ts +1 -0
  42. package/dist/editor/canvas/index.d.ts.map +1 -1
  43. package/dist/editor/history/types.d.ts +6 -0
  44. package/dist/editor/history/types.d.ts.map +1 -1
  45. package/dist/editor/history/undoRedoManager.d.ts.map +1 -1
  46. package/dist/editor/history/useUndoRedo.d.ts +3 -4
  47. package/dist/editor/history/useUndoRedo.d.ts.map +1 -1
  48. package/dist/editor/index.d.ts +9 -4
  49. package/dist/editor/index.d.ts.map +1 -1
  50. package/dist/editor/sidebar/form/ComponentEditorForm.d.ts +3 -2
  51. package/dist/editor/sidebar/form/ComponentEditorForm.d.ts.map +1 -1
  52. package/dist/editor/sidebar/form/fieldRendererUtils.d.ts +2 -1
  53. package/dist/editor/sidebar/form/fieldRendererUtils.d.ts.map +1 -1
  54. package/dist/editor/sidebar/form/renderers/AnswerArrayFieldRenderer.d.ts +1 -1
  55. package/dist/editor/sidebar/form/renderers/AnswerArrayFieldRenderer.d.ts.map +1 -1
  56. package/dist/editor/sidebar/panel/ToolContentContainer.d.ts.map +1 -1
  57. package/dist/editor/sidebar/panel/ToolHeaderActionsContext.d.ts.map +1 -1
  58. package/dist/editor/sidebar/panel/panelStyles.d.ts +1 -0
  59. package/dist/editor/sidebar/panel/panelStyles.d.ts.map +1 -1
  60. package/dist/editor/sidebar/panel/types.d.ts +3 -0
  61. package/dist/editor/sidebar/panel/types.d.ts.map +1 -1
  62. package/dist/editor/sidebar/sidebarTranslations.d.ts +0 -8
  63. package/dist/editor/sidebar/sidebarTranslations.d.ts.map +1 -1
  64. package/dist/editor/sidebar/tray/BlockTray.d.ts +3 -4
  65. package/dist/editor/sidebar/tray/BlockTray.d.ts.map +1 -1
  66. package/dist/editor/sidebar/tray/SharedTrayComponents.d.ts +1 -1
  67. package/dist/editor/sidebar/tray/blockDefinitions.d.ts.map +1 -1
  68. package/dist/editor/sidebar/tray/index.d.ts +0 -2
  69. package/dist/editor/sidebar/tray/index.d.ts.map +1 -1
  70. package/dist/editor/sidebar/useDesignerSelectionFocus.d.ts +10 -1
  71. package/dist/editor/sidebar/useDesignerSelectionFocus.d.ts.map +1 -1
  72. package/dist/editor/state/blockDataStore.d.ts +13 -0
  73. package/dist/editor/state/blockDataStore.d.ts.map +1 -0
  74. package/dist/editor/state/blockDataStore.test.d.ts +2 -0
  75. package/dist/editor/state/blockDataStore.test.d.ts.map +1 -0
  76. package/dist/editor/state/selectionContext.d.ts +5 -0
  77. package/dist/editor/state/selectionContext.d.ts.map +1 -0
  78. package/dist/editor/state/selectionStore.d.ts +11 -0
  79. package/dist/editor/state/selectionStore.d.ts.map +1 -0
  80. package/dist/editor/state/useBlockData.d.ts +13 -0
  81. package/dist/editor/state/useBlockData.d.ts.map +1 -0
  82. package/dist/editor/state/useBlockEditorState.d.ts +10 -5
  83. package/dist/editor/state/useBlockEditorState.d.ts.map +1 -1
  84. package/dist/editor/state/useUndoRedoState.d.ts +9 -0
  85. package/dist/editor/state/useUndoRedoState.d.ts.map +1 -0
  86. package/dist/editor/state/useUndoRedoState.test.d.ts +2 -0
  87. package/dist/editor/state/useUndoRedoState.test.d.ts.map +1 -0
  88. package/dist/index.d.ts +0 -1
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +8543 -7647
  91. package/dist/registry/blockCatalogue.d.ts +1 -6
  92. package/dist/registry/blockCatalogue.d.ts.map +1 -1
  93. package/dist/registry/templateTypes.d.ts +2 -2
  94. package/dist/schema/schemaRegistry.d.ts +0 -17
  95. package/dist/schema/schemaRegistry.d.ts.map +1 -1
  96. package/dist/viewer/viewerStyles.d.ts +0 -3
  97. package/dist/viewer/viewerStyles.d.ts.map +1 -1
  98. package/locales/en.json +11 -5
  99. package/package.json +4 -2
  100. package/dist/components/blocks/LayoutContainer/LayoutContainer.d.ts +0 -3
  101. package/dist/components/blocks/LayoutContainer/LayoutContainer.d.ts.map +0 -1
  102. package/dist/components/blocks/LayoutContainer/createLayoutContainerBlock.d.ts +0 -22
  103. package/dist/components/blocks/LayoutContainer/createLayoutContainerBlock.d.ts.map +0 -1
  104. package/dist/components/blocks/LayoutContainer/getLayoutContainerViewProps.d.ts +0 -32
  105. package/dist/components/blocks/LayoutContainer/getLayoutContainerViewProps.d.ts.map +0 -1
  106. package/dist/components/blocks/LayoutContainer/index.d.ts +0 -5
  107. package/dist/components/blocks/LayoutContainer/index.d.ts.map +0 -1
  108. package/dist/components/blocks/LayoutContainer/layoutContainerPropsSchema.d.ts +0 -118
  109. package/dist/components/blocks/LayoutContainer/layoutContainerPropsSchema.d.ts.map +0 -1
  110. package/dist/editor/sidebar/tray/LayoutTray.d.ts +0 -4
  111. package/dist/editor/sidebar/tray/LayoutTray.d.ts.map +0 -1
  112. package/dist/editor/sidebar/tray/TemplatesPanel.d.ts +0 -4
  113. package/dist/editor/sidebar/tray/TemplatesPanel.d.ts.map +0 -1
package/README.md CHANGED
@@ -79,6 +79,20 @@ function Builder() {
79
79
  }
80
80
  ```
81
81
 
82
+ **Reading the document.** Block content lives in a store outside React state, so typing in one
83
+ block re-renders only that block, not your page. The engine has no reactive `templateData`. Read it
84
+ when you need it, or subscribe in the one component that renders it:
85
+
86
+ ```tsx
87
+ const save = () => api.save({ layout: engine.templateLayout, data: engine.getTemplateData() })
88
+
89
+ const data = useTemplateData(engine) // re-renders on every edit
90
+ const blockCount = useTemplateDataSelector(engine, d => Object.keys(d).length) // only when the count changes
91
+ ```
92
+
93
+ A selector must return a primitive or a stable reference. A new object on every call re-renders
94
+ forever.
95
+
82
96
  `BlockContentEditor` composes the tool-panel sidebar over the drag-and-drop canvas: it builds the
83
97
  registry-driven insertion trays, hoists a single DnD context so blocks can be **dragged** from a
84
98
  tray onto the canvas, coordinates canvas↔panel selection focus, and routes a selected block to its
@@ -111,7 +125,7 @@ standalone `DesignerArea` (which self-wraps its own provider) when you don't nee
111
125
  ```tsx
112
126
  import { GridDndProvider, DesignerCanvas, ComponentsTray, DesignerNavProvider } from '@instructure/platform-block-content-editor'
113
127
 
114
- <GridDndProvider {...dndProps}>
128
+ <GridDndProvider store={engine.store} {...dndProps}>
115
129
  <DesignerNavProvider><ComponentsTray registry={registry} onAddComponent={engine.addComponent} /></DesignerNavProvider>
116
130
  <DesignerCanvas canvasRef={canvasRef} {...canvasProps} />
117
131
  </GridDndProvider>
@@ -121,30 +135,71 @@ Also public: `DesignerSideBar` (the tool-panel chrome), `ComponentEditorForm` (t
121
135
  `useDesignerNav` (the sidebar's view-navigation hook), `useDesignerSelectionFocus`, and the
122
136
  block-level AI (`BlockAIMenu`, `useGenerateAltText`).
123
137
 
124
- ## Preview — the host presents it
138
+ ## Preview — the host drives it
125
139
 
126
140
  `PreviewArea` is a framed student preview over the read-path `Viewer`, sized from a required,
127
141
  controlled `viewport` prop (`'desktop' | 'mobile'`). It renders no switch of its own — the host
128
- builds the Desktop/Mobile toggle and drives `viewport` from its own state. The package ships
129
- **no modal**: how the preview is presented (modal, drawer, fullscreen, inline) is the host's choice.
142
+ builds the Desktop/Mobile toggle and drives `viewport` from its own state.
143
+
144
+ Inside `BlockContentEditor`, preview is a mode: `isPreviewOn` hides the sidebar and swaps the
145
+ canvas for `PreviewArea` in place. **No Preview button and no device selector ship here** — both
146
+ controls, and their wording, are the host's.
147
+
148
+ `previewViewport` is independent of it: the device the editor **simulates**, never the browser
149
+ window. `mobile` narrows the *design area* to an editable phone-width column and sizes the preview
150
+ to match. Blocks stack correctly there because none of them read the viewport — their breakpoints
151
+ are container queries.
130
152
 
131
153
  ```tsx
132
- import { PreviewArea, PREVIEW_VIEWPORTS, type PreviewViewport } from '@instructure/platform-block-content-editor'
154
+ import { BlockContentEditor, EDITOR_CHROME_PROPS, PREVIEW_VIEWPORTS, type PreviewViewport } from '@instructure/platform-block-content-editor'
133
155
 
156
+ const [isPreviewOn, setIsPreviewOn] = useState(false)
134
157
  const [viewport, setViewport] = useState<PreviewViewport>(PREVIEW_VIEWPORTS.DESKTOP)
135
158
 
136
- <Modal open={previewing} onDismiss={…}>
137
- <div role="group" aria-label="Preview viewport">
138
- <Button onClick={() => setViewport(PREVIEW_VIEWPORTS.DESKTOP)}>Desktop</Button>
139
- <Button onClick={() => setViewport(PREVIEW_VIEWPORTS.MOBILE)}>Mobile</Button>
140
- </div>
141
- <PreviewArea
142
- templateLayout={engine.templateLayout}
143
- templateData={engine.templateData}
144
- componentRegistry={registry}
145
- viewport={viewport}
146
- />
147
- </Modal>
159
+ <div {...EDITOR_CHROME_PROPS}>
160
+ <Button aria-pressed={isPreviewOn} onClick={() => setIsPreviewOn(on => !on)}>
161
+ {isPreviewOn ? 'Preview On' : 'Preview Off'}
162
+ </Button>
163
+
164
+ {/* Not gated on preview — Mobile narrows the design area too. */}
165
+ <div role="group" aria-label="Simulated device">
166
+ <Button onClick={() => setViewport(PREVIEW_VIEWPORTS.DESKTOP)}>Desktop</Button>
167
+ <Button onClick={() => setViewport(PREVIEW_VIEWPORTS.MOBILE)}>Mobile</Button>
168
+ </div>
169
+ </div>
170
+
171
+ <BlockContentEditor
172
+ engine={engine}
173
+ registry={registry}
174
+ isPreviewOn={isPreviewOn}
175
+ previewViewport={viewport}
176
+ />
177
+ ```
178
+
179
+ Spread `EDITOR_CHROME_PROPS` on the toolbar holding these controls, or clicking Preview (or Save,
180
+ or Undo) deselects the block the author was editing. Focus leaving the toolbar for somewhere outside
181
+ the editor still deselects; while preview is on, nothing does.
182
+
183
+ The sidebar and canvas are hidden, not unmounted, so panel width, open tool, selection and canvas
184
+ scroll are as the author left them. The sidebar's own mobile layout still keys off the real window
185
+ — simulating a phone narrows the content, not the editor's chrome. Composing the canvas by hand?
186
+ Set `CANVAS_WIDTH_VAR` on any ancestor of it.
187
+
188
+ `PreviewArea` remains standalone: a host that wants the preview elsewhere (a modal, a drawer, its
189
+ own route) renders it directly and skips `isPreviewOn`. It re-renders on every edit, so subscribe
190
+ with `useTemplateData` in the component that renders it, not above the editor.
191
+
192
+ ```tsx
193
+ import { PreviewArea, useTemplateData } from '@instructure/platform-block-content-editor'
194
+
195
+ const templateData = useTemplateData(engine)
196
+
197
+ <PreviewArea
198
+ templateLayout={engine.templateLayout}
199
+ templateData={templateData}
200
+ componentRegistry={registry}
201
+ viewport={viewport}
202
+ />
148
203
  ```
149
204
 
150
205
  ## Seams — everything Canvas-specific is injected
@@ -1,8 +1,9 @@
1
1
  import { BlockRegistry } from '../registry';
2
+ import { PreviewViewport } from './preview';
2
3
  import { Tool } from './sidebar/panel/types';
3
4
  import { UseBlockEditorStateReturn } from './state/useBlockEditorState';
4
5
  /** The trays the package ships. A host appends its own tools (widget tray, AI assistant). */
5
- export declare const BUILT_IN_TOOL_IDS: readonly ["components", "interactive", "layout", "templates"];
6
+ export declare const BUILT_IN_TOOL_IDS: readonly ["components", "interactive"];
6
7
  export type BuiltInToolId = (typeof BUILT_IN_TOOL_IDS)[number];
7
8
  export interface BlockContentEditorProps<HostToolId extends string = never> {
8
9
  /** The host-owned editor state (from `useBlockEditorState`). The host keeps save / undo /
@@ -11,14 +12,14 @@ export interface BlockContentEditorProps<HostToolId extends string = never> {
11
12
  /** The registry the document's blocks resolve against (same one passed to `useBlockEditorState`). */
12
13
  registry: BlockRegistry;
13
14
  /** Host tools — the host-tool slot (a widget tray, the IgniteAI Assistant). Rendered
14
- * alongside the built-ins in one rail; the built-ins carry `priority` 0-3, so a host tool
15
- * with no `priority` set renders after all four (e.g. a widget tray), while one that sets a
15
+ * alongside the built-ins in one rail; the built-ins carry `priority` 0-1, so a host tool
16
+ * with no `priority` set renders after both (e.g. a widget tray), while one that sets a
16
17
  * lower `priority` renders before them (e.g. an Assistant docked at the top of the rail).
17
18
  * Block-level AI is gated on the `AIAction` seam, not on a tool. */
18
19
  tools?: Tool<HostToolId>[];
19
- /** Which built-in trays to render, as a subset of `BUILT_IN_TOOL_IDS`; defaults to all four.
20
+ /** Which built-in trays to render, as a subset of `BUILT_IN_TOOL_IDS`; defaults to both.
20
21
  * Rendered in the canonical order regardless of the order given (e.g. a dashboard passes
21
- * `['components', 'layout']`). */
22
+ * `['components']`). */
22
23
  builtInToolIds?: BuiltInToolId[];
23
24
  /** The tool open on first render. Defaults to the first rendered built-in tray (`components`
24
25
  * unless excluded), then the first host tool. */
@@ -27,6 +28,12 @@ export interface BlockContentEditorProps<HostToolId extends string = never> {
27
28
  height?: number | string;
28
29
  /** Shows the sidebar's rail collapse/expand toggle once a tool has been opened. */
29
30
  hasExpandPanelButton?: boolean;
31
+ /** Host-owned preview mode: hides the sidebar and swaps the canvas for `PreviewArea`. Both
32
+ * stay mounted, so panel width, open tool, selection and canvas scroll survive. */
33
+ isPreviewOn?: boolean;
34
+ /** The device the editor *simulates* — never the browser window. `mobile` narrows the design
35
+ * area to an editable phone-width column and sizes the preview to match, preview on or off. */
36
+ previewViewport?: PreviewViewport;
30
37
  /**
31
38
  * Reports whether a host rich-text-editor overlay (a dialog, tray, or menu the RCE portals to
32
39
  * `document.body` and gives focus to) is open. While it returns true, the canvas↔panel selection
@@ -51,8 +58,9 @@ export interface BlockContentEditorProps<HostToolId extends string = never> {
51
58
  *
52
59
  * It holds only the panel's view/tool UI state; the document, selection, and history live in
53
60
  * the `engine` the host owns. One shared `GridDndProvider` wraps both surfaces so tray drag
54
- * sources reach the canvas droppables. It is authoring-only — the student preview
55
- * (`PreviewArea`) is a separate export the host presents however it wants.
61
+ * sources reach the canvas droppables. `isPreviewOn` swaps the canvas for the student preview in
62
+ * place — this composition's layout call; `PreviewArea` stays standalone for a host that wants
63
+ * its own presentation.
56
64
  */
57
- export declare function BlockContentEditor<HostToolId extends string = never>({ engine, registry, tools: hostTools, builtInToolIds, initialToolId, height, hasExpandPanelButton, isEditorOverlayOpen, onBeforeToolChange, }: BlockContentEditorProps<HostToolId>): import("react/jsx-runtime").JSX.Element;
65
+ export declare function BlockContentEditor<HostToolId extends string = never>({ engine, registry, tools, builtInToolIds, initialToolId, height, hasExpandPanelButton, isPreviewOn, previewViewport, isEditorOverlayOpen, onBeforeToolChange, }: BlockContentEditorProps<HostToolId>): import("react/jsx-runtime").JSX.Element;
58
66
  //# sourceMappingURL=BlockContentEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BlockContentEditor.d.ts","sourceRoot":"","sources":["../../src/editor/BlockContentEditor.tsx"],"names":[],"mappings":"AA4BA,OAAO,EAAE,KAAK,aAAa,EAAqB,MAAM,aAAa,CAAA;AAOnE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAQjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,+DAAgE,CAAA;AAC9F,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAmC9D,MAAM,WAAW,uBAAuB,CAAC,UAAU,SAAS,MAAM,GAAG,KAAK;IACxE;+FAC2F;IAC3F,MAAM,EAAE,yBAAyB,CAAA;IACjC,qGAAqG;IACrG,QAAQ,EAAE,aAAa,CAAA;IACvB;;;;wEAIoE;IACpE,KAAK,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,CAAA;IAC1B;;sCAEkC;IAClC,cAAc,CAAC,EAAE,aAAa,EAAE,CAAA;IAChC;qDACiD;IACjD,aAAa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,CAAA;IACvB;;;;wEAIoE;IACpE,KAAK,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,CAAA;IAC1B;;4BAEwB;IACxB,cAAc,CAAC,EAAE,aAAa,EAAE,CAAA;IAChC;qDACiD;IACjD,aAAa,CAAC,EAAE,aAAa,GAAG,UAAU,CAAA;IAC1C,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,mFAAmF;IACnF,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;uFACmF;IACnF,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;mGAC+F;IAC/F,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,OAAO,CAAA;IACnC;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,GAAG,UAAU,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;CAClG;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,SAAS,MAAM,GAAG,KAAK,EAAE,EACpE,MAAM,EACN,QAAQ,EACR,KAAK,EACL,cAAuC,EACvC,aAAa,EACb,MAAM,EACN,oBAAoB,EACpB,WAAmB,EACnB,eAA2C,EAC3C,mBAAmB,EACnB,kBAAkB,GACnB,EAAE,uBAAuB,CAAC,UAAU,CAAC,2CA+HrC"}
@@ -0,0 +1,46 @@
1
+ import { ReactNode } from 'react';
2
+ import { BlockRegistry } from '../../registry';
3
+ import { AIGenerationPhase } from './aiTypes';
4
+ export declare const UPDATED_DURATION_MS = 10000;
5
+ type ApplyProps = (props: Record<string, unknown>) => void;
6
+ interface GenerationTarget {
7
+ blockId: string;
8
+ componentType: string;
9
+ componentId?: string;
10
+ componentData: Record<string, unknown>;
11
+ previewFirst: boolean;
12
+ instructionScope?: string;
13
+ /** Fallback when no form is registered and there is no `onApplyToBlock`. */
14
+ onApply?: ApplyProps;
15
+ componentRegistry: BlockRegistry;
16
+ }
17
+ export type AIGenerationSurface = 'canvas' | 'panel';
18
+ export interface StartGenerationParams extends GenerationTarget {
19
+ instruction: string;
20
+ /** The surface whose menu started it; that overlay takes focus for its Stop button. */
21
+ origin?: AIGenerationSurface;
22
+ }
23
+ export interface AIGenerationContextValue {
24
+ activeBlockId: string | null;
25
+ startedFrom: AIGenerationSurface | null;
26
+ phaseFor: (blockId: string) => AIGenerationPhase;
27
+ /** Cancels any generation already in flight. */
28
+ start: (params: StartGenerationParams) => void;
29
+ stop: () => void;
30
+ openPreview: () => void;
31
+ discard: () => void;
32
+ /** Routes applies for `blockId` through its open form. Returns the unregister function. */
33
+ registerFormApply: (blockId: string, apply: ApplyProps) => () => void;
34
+ }
35
+ export interface AIGenerationProviderProps {
36
+ children: ReactNode;
37
+ /** e.g. `(id, props) => engine.changeComponent(props, id)`. */
38
+ onApplyToBlock?: (blockId: string, props: Record<string, unknown>) => void;
39
+ /** A generation whose block has been deleted is stopped. */
40
+ hasBlock?: (blockId: string) => boolean;
41
+ }
42
+ /** `null` without a provider, in which case `BlockAIMenu` keeps its in-popover flow. */
43
+ export declare const useAIGeneration: () => AIGenerationContextValue | null;
44
+ export declare function AIGenerationProvider({ children, onApplyToBlock, hasBlock, }: AIGenerationProviderProps): import("react/jsx-runtime").JSX.Element;
45
+ export {};
46
+ //# sourceMappingURL=AIGenerationContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIGenerationContext.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/AIGenerationContext.tsx"],"names":[],"mappings":"AAkBA;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,SAAS,EAOf,MAAM,OAAO,CAAA;AAGd,OAAO,KAAK,EAAE,aAAa,EAA4B,MAAM,gBAAgB,CAAA;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAkC,MAAM,WAAW,CAAA;AAGlF,eAAO,MAAM,mBAAmB,QAAS,CAA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AC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;IAC1C;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC,WAAW,CAAC,CAAA;CACxD;AAED,eAAO,MAAM,WAAW,GAAI,wNAgBzB,gBAAgB,mDAkNlB,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { AIGenerationPhase } from './aiTypes';
2
+ export interface BlockGenerationOverlayProps {
3
+ phase: Exclude<AIGenerationPhase, 'idle'>;
4
+ onStop?: () => void;
5
+ onOpenPreview?: () => void;
6
+ onDiscard?: () => void;
7
+ /**
8
+ * `panel` spans the width with the actions at the trailing edge, and draws no "updated" stroke:
9
+ * the stroke marks the block itself.
10
+ */
11
+ surface?: 'canvas' | 'panel';
12
+ /** Set on the surface whose AI menu started the generation, which takes focus for Stop. */
13
+ takeFocusOnStart?: boolean;
14
+ }
15
+ export declare const BlockGenerationOverlay: ({ phase, onStop, onOpenPreview, onDiscard, surface, takeFocusOnStart, }: BlockGenerationOverlayProps) => import("react/jsx-runtime").JSX.Element;
16
+ //# sourceMappingURL=BlockGenerationOverlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlockGenerationOverlay.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/BlockGenerationOverlay.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAKlD,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,OAAO,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAA;IACzC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAC5B,2FAA2F;IAC3F,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B;AASD,eAAO,MAAM,sBAAsB,GAAI,yEAOpC,2BAA2B,4CAkM7B,CAAA"}
@@ -17,13 +17,8 @@ export interface PreviewBlockModalProps {
17
17
  onUnresolvedBlock?: (block: UnresolvedBlock) => void;
18
18
  }
19
19
  /**
20
- * A fullscreen before/after diff of an AI-proposed block change: the current block ("Before")
21
- * beside the AI's version ("After"), a Both/After/Before switch, an optional refinement field,
22
- * and Cancel / Accept-and-replace. The two panels are the read-path `Viewer` run with designer
23
- * mode off (so blocks show their student state), reached through the modal portal — brand color,
24
- * translations and host data hooks come from the host's providers above, as everywhere else. The
25
- * source's IgniteAI gradient is dropped for a neutral, themeable surface; the AI accent is the
26
- * colored icon in the header.
20
+ * A fullscreen before/after preview of an AI-proposed block change. Both columns stay mounted (the
21
+ * switch only hides one) so the "Show changes" diff can always read both sides.
27
22
  */
28
23
  export declare const PreviewBlockModal: ({ open, onClose, onReplace, onRegenerate, isRegenerating, showRefinement, beforeLayout, beforeData, afterLayout, afterData, componentRegistry, onUnresolvedBlock, }: PreviewBlockModalProps) => import("react/jsx-runtime").JSX.Element;
29
24
  //# sourceMappingURL=PreviewBlockModal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PreviewBlockModal.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/PreviewBlockModal.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAS9F,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,YAAY,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,sEAAsE;IACtE,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,YAAY,EAAE,UAAU,EAAE,CAAA;IAC1B,UAAU,CAAC,EAAE,YAAY,CAAA;IACzB,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,SAAS,CAAC,EAAE,YAAY,CAAA;IACxB,kFAAkF;IAClF,iBAAiB,EAAE,aAAa,CAAA;IAChC,mCAAmC;IACnC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;CACrD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAAI,qKAa/B,sBAAsB,4CAgLxB,CAAA"}
1
+ {"version":3,"file":"PreviewBlockModal.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/PreviewBlockModal.tsx"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAY9F,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,YAAY,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,sEAAsE;IACtE,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,YAAY,EAAE,UAAU,EAAE,CAAA;IAC1B,UAAU,CAAC,EAAE,YAAY,CAAA;IACzB,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,SAAS,CAAC,EAAE,YAAY,CAAA;IACxB,kFAAkF;IAClF,iBAAiB,EAAE,aAAa,CAAA;IAChC,mCAAmC;IACnC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;CACrD;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,qKAa/B,sBAAsB,4CA4SxB,CAAA"}
@@ -53,6 +53,16 @@ export interface DesignerAITranslations {
53
53
  thinking: string;
54
54
  /** Stop an in-flight generation. */
55
55
  stop: string;
56
+ /** Generation-overlay bar: a result is ready to preview (with "preview first" on). */
57
+ previewReady: string;
58
+ /** Generation-overlay bar: open the before/after preview of the ready result. */
59
+ openPreview: string;
60
+ /** Generation-overlay bar: discard the pending result and revert the block to its original. */
61
+ discardResult: string;
62
+ /** Generation-overlay bar: the block was just replaced (shown briefly, then cleared). */
63
+ blockUpdated: string;
64
+ /** Screen-reader alert announced once when the block is updated. */
65
+ blockUpdatedAlert: string;
56
66
  /** Error shown in the AI menu when a generation fails or returns nothing usable. */
57
67
  generationFailed: string;
58
68
  /** Preview modal title. */
@@ -63,8 +73,15 @@ export interface DesignerAITranslations {
63
73
  both: string;
64
74
  before: string;
65
75
  after: string;
76
+ /** Toggle: outline what the AI removed, added, or edited within the content. */
77
+ showChanges: string;
78
+ /** Diff badges shown on changed content when "Show changes" is on. */
79
+ diffRemoved: string;
80
+ diffAdded: string;
81
+ diffChanged: string;
66
82
  /** Preview modal buttons. */
67
83
  previewCancel: string;
84
+ rejectAndClose: string;
68
85
  acceptAndReplace: string;
69
86
  /** Refinement field label/placeholder + its buttons (field hidden by default). */
70
87
  refinementPlaceholder: string;
@@ -1 +1 @@
1
- {"version":3,"file":"aiTranslations.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/aiTranslations.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,sBAAsB;IACrC,iGAAiG;IACjG,WAAW,EAAE,MAAM,CAAA;IACnB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAA;IAClB,4EAA4E;IAC5E,gBAAgB,EAAE,MAAM,CAAA;IACxB,6FAA6F;IAC7F,cAAc,EAAE,MAAM,CAAA;IACtB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CA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ACzB,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,gGAAgG;IAChG,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED,iFAAiF;AACjF,eAAO,MAAM,iBAAiB,EAAE,sBA0C/B,CAAA"}
1
+ {"version":3,"file":"aiTranslations.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/aiTranslations.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,sBAAsB;IACrC,iGAAiG;IACjG,WAAW,EAAE,MAAM,CAAA;IACnB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAA;IAClB,4EAA4E;IAC5E,gBAAgB,EAAE,MAAM,CAAA;IACxB,6FAA6F;IAC7F,cAAc,EAAE,MAAM,CAAA;IACtB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAA;IACpB,mDAAmD;IACnD,kBAAkB,EAAE,MAAM,CAAA;IAC1B,gCAAgC;IAChC,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,kCAAkC;IAClC,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;IACvB,sCAAsC;IACtC,iBAAiB,EAAE,MAAM,CAAA;IACzB,kEAAkE;IAClE,oBAAoB,EAAE,MAAM,CAAA;IAC5B,6DAA6D;IAC7D,YAAY,EAAE,MAAM,CAAA;IACpB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,+CAA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@ export interface AIInlineTemplateContentPayload {
10
10
  props: Record<string, unknown>;
11
11
  }[];
12
12
  }
13
+ /** A block's AI-generation phase. `preview-ready` only occurs with "Preview first" on. */
14
+ export type AIGenerationPhase = 'idle' | 'generating' | 'preview-ready' | 'updated';
13
15
  //# sourceMappingURL=aiTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aiTypes.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/aiTypes.ts"],"names":[],"mappings":"AAkBA;;;;;GAKG;AACH,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EAAE,CAAA;CAC/D"}
1
+ {"version":3,"file":"aiTypes.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/aiTypes.ts"],"names":[],"mappings":"AAkBA;;;;;GAKG;AACH,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EAAE,CAAA;CAC/D;AAED,0FAA0F;AAC1F,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,YAAY,GAAG,eAAe,GAAG,SAAS,CAAA"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Chrome CSS for the AI-generation overlay, injected once as a global stylesheet like the AI menu
3
+ * and canvas chrome: `backdrop-filter` and the gradient bar aren't expressible in InstUI props. The
4
+ * scrim blurs through `backdrop-filter`, so a surface only has to be `position: relative`.
5
+ */
6
+ export declare const AI_OVERLAY_CLASS: {
7
+ readonly root: "bce-ai-gen-overlay-root";
8
+ readonly scrim: "bce-ai-gen-overlay-scrim";
9
+ readonly updatedStroke: "bce-ai-gen-overlay-updated-stroke";
10
+ readonly bar: "bce-ai-gen-overlay-bar";
11
+ readonly barFullWidth: "bce-ai-gen-overlay-bar--full";
12
+ readonly status: "bce-ai-gen-overlay-status";
13
+ readonly stopButton: "bce-ai-gen-overlay-stop";
14
+ readonly openButton: "bce-ai-gen-overlay-open";
15
+ readonly iconAction: "bce-ai-gen-overlay-icon-action";
16
+ };
17
+ export declare function GenerationOverlayStyles(): import("react/jsx-runtime").JSX.Element;
18
+ //# sourceMappingURL=generationOverlayStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generationOverlayStyles.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/generationOverlayStyles.tsx"],"names":[],"mappings":"AAoBA;;;;GAIG;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;CAUnB,CAAA;AAgBV,wBAAgB,uBAAuB,4CAyKtC"}
@@ -3,5 +3,6 @@ export { PreviewBlockModal, type PreviewBlockModalProps } from './PreviewBlockMo
3
3
  export { useGenerateAltText } from './useGenerateAltText';
4
4
  export { PREVIEW_BLOCK_VIEWS, type PreviewBlockView } from './constants';
5
5
  export { type DesignerAITranslations, DesignerAIEnglish } from './aiTranslations';
6
- export type { AIInlineTemplateContentPayload } from './aiTypes';
6
+ export type { AIGenerationPhase, AIInlineTemplateContentPayload } from './aiTypes';
7
+ export { AIGenerationProvider, type AIGenerationProviderProps } from './AIGenerationContext';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,OAAO,EAAE,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EAAE,KAAK,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACjF,YAAY,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,OAAO,EAAE,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EAAE,KAAK,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACjF,YAAY,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAA;AAElF,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The preview modal's chrome — what InstUI props can't express (the segmented switch, the column
3
+ * cards, the diff callouts) — as one global stylesheet, like the AI menu's.
4
+ */
5
+ export declare const PREVIEW_CLASS: {
6
+ readonly column: "bce-preview-column";
7
+ readonly title: "bce-preview-title";
8
+ readonly card: "bce-preview-card";
9
+ readonly switchGroup: "bce-preview-switch";
10
+ readonly switchOption: "bce-preview-switch-option";
11
+ readonly switchActive: "is-active";
12
+ readonly toggleWrap: "bce-preview-toggle";
13
+ /** The phone toolbar: switch and toggle each full width. */
14
+ readonly stacked: "bce-preview-stacked";
15
+ };
16
+ export declare function PreviewBlockStyles(): import("react/jsx-runtime").JSX.Element;
17
+ //# sourceMappingURL=previewBlockStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"previewBlockStyles.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/previewBlockStyles.tsx"],"names":[],"mappings":"AAgCA;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;IAQxB,4DAA4D;;CAEpD,CAAA;AAyBV,wBAAgB,kBAAkB,4CAqKjC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The "Show changes" diff. The modal never sees a block's html, so this diffs the rendered DOM:
3
+ * blocks paired by layout id first, then sections (a heading and the blocks under it) inside a
4
+ * block whose words changed.
5
+ */
6
+ /** A section's role in the diff. `removed` only appears on the Before side, `added` only on After. */
7
+ export type DiffStatus = 'unchanged' | 'added' | 'removed' | 'changed';
8
+ export interface DiffResult {
9
+ before: DiffStatus[];
10
+ after: DiffStatus[];
11
+ }
12
+ /**
13
+ * Sørensen–Dice word overlap, 0–1: enough to tell a light edit from a different passage without a
14
+ * character-level edit distance.
15
+ */
16
+ export declare const similarity: (a: string, b: string) => number;
17
+ /**
18
+ * LCS matches are `unchanged`. Leftovers in each gap pair up in order: a similar pair is one
19
+ * `changed` edit, a dissimilar one splits into `removed` + `added`.
20
+ */
21
+ export declare const diffContent: (before: string[], after: string[], { threshold }?: {
22
+ threshold?: number;
23
+ }) => DiffResult;
24
+ /** Read by the stylesheet in `previewBlockStyles`. */
25
+ export declare const DIFF_CLASS: {
26
+ readonly unit: "bce-diff-unit";
27
+ /** A callout wrapping a whole block, not a section inside one. */
28
+ readonly block: "bce-diff-block";
29
+ readonly removed: "bce-diff-removed";
30
+ readonly added: "bce-diff-added";
31
+ readonly changed: "bce-diff-changed";
32
+ };
33
+ /** Carries the localized badge text into the `::after` badge. */
34
+ export declare const DIFF_LABEL_VAR = "--bce-diff-label";
35
+ /** A run of adjacent sibling blocks boxed as one. */
36
+ export interface DiffSection {
37
+ els: HTMLElement[];
38
+ text: string;
39
+ /** The text plus a styling token, so a restyle with identical words still reads as a change. */
40
+ key: string;
41
+ }
42
+ /**
43
+ * A heading opens a section that absorbs the blocks directly after it; other blocks stand alone.
44
+ * Only top-level blocks count, so a list is one block, not its items.
45
+ */
46
+ export declare const collectDiffSections: (root: HTMLElement) => DiffSection[];
47
+ export interface DiffLabels {
48
+ removed: string;
49
+ added: string;
50
+ changed: string;
51
+ }
52
+ /** Wraps each non-`unchanged` section in a callout, so a heading and its content share one box. */
53
+ export declare const applyDiffAnnotations: (sections: DiffSection[], statuses: DiffStatus[], labels: DiffLabels) => void;
54
+ /** Unwraps every callout under `root`. */
55
+ export declare const clearDiffAnnotations: (root: HTMLElement) => void;
56
+ /** `sections`: same styling, different words — diff inside the block. */
57
+ export type BlockDiffStatus = DiffStatus | 'sections';
58
+ export interface BlockDiffInput {
59
+ id: string;
60
+ text: string;
61
+ style: string;
62
+ }
63
+ /**
64
+ * Pairs blocks by id. A one-sided block is Removed/Added and a restyled one Changed, each boxed
65
+ * whole so the block's own fill sits inside the outline.
66
+ */
67
+ export declare const planBlockDiff: (before: BlockDiffInput[], after: BlockDiffInput[]) => {
68
+ before: BlockDiffStatus[];
69
+ after: BlockDiffStatus[];
70
+ };
71
+ /** Falls back to a whole-card section diff when the blocks can't be matched to the layout. */
72
+ export declare const annotateContentDiff: (beforeRoot: HTMLElement, afterRoot: HTMLElement, beforeIds: string[], afterIds: string[], labels: DiffLabels) => void;
73
+ //# sourceMappingURL=previewDiff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"previewDiff.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/previewDiff.ts"],"names":[],"mappings":"AAkBA;;;;GAIG;AAEH,sGAAsG;AACtG,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;AAEtE,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,UAAU,EAAE,CAAA;IACpB,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB;AAYD;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAkBjD,CAAA;AAkCD;;;GAGG;AACH,eAAO,MAAM,WAAW,GACtB,QAAQ,MAAM,EAAE,EAChB,OAAO,MAAM,EAAE,EACf,gBA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,UAAU,MAAM,EAAE,EAClB,QAAQ,UAAU,KACjB,IAiCF,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=previewDiff.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"previewDiff.test.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/previewDiff.test.ts"],"names":[],"mappings":""}
@@ -1,15 +1,17 @@
1
1
  import { RefObject } from 'react';
2
- import { BlockRegistry, LayoutNode, TemplateData } from '../../registry';
2
+ import { BlockRegistry, LayoutNode } from '../../registry';
3
3
  import { TrayDropTarget, TreePath } from '../document/utils';
4
+ import { BlockDataStore } from '../state/blockDataStore';
5
+ import { SelectionStore } from '../state/selectionStore';
4
6
  export interface DesignerAreaProps {
5
7
  /** The layout tree to author. */
6
8
  templateLayout: LayoutNode[];
7
- /** Content props keyed by node id. */
8
- templateData: TemplateData;
9
+ /** `useBlockEditorState().store`. */
10
+ store: BlockDataStore;
9
11
  /** The registry the document's blocks resolve against. */
10
12
  componentRegistry: BlockRegistry;
11
- /** The engine's selected component id (drives the selection chrome). */
12
- selectedComponentId: string | null;
13
+ /** `useBlockEditorState().selection`. */
14
+ selection: SelectionStore;
13
15
  /** Commit a new layout (e.g. `useBlockEditorState().changeLayout`). */
14
16
  onLayoutChange: (layout: LayoutNode[]) => void;
15
17
  /** A block was selected on the canvas. */
@@ -34,5 +36,5 @@ export interface DesignerAreaProps {
34
36
  * host that wants tray drag sources to reach the canvas across a shared context composes
35
37
  * `GridDndProvider` around both the sidebar and a bare `DesignerCanvas` instead.
36
38
  */
37
- export declare function DesignerArea({ templateLayout, templateData, componentRegistry, selectedComponentId, onLayoutChange, onSelectComponent, onAddComponent, onDeleteNode, onDuplicateNode, onAIApply, canvasRef: externalCanvasRef, }: DesignerAreaProps): import("react/jsx-runtime").JSX.Element;
39
+ export declare function DesignerArea({ templateLayout, store, componentRegistry, selection, onLayoutChange, onSelectComponent, onAddComponent, onDeleteNode, onDuplicateNode, onAIApply, canvasRef: externalCanvasRef, }: DesignerAreaProps): import("react/jsx-runtime").JSX.Element;
38
40
  //# sourceMappingURL=DesignerArea.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DesignerArea.d.ts","sourceRoot":"","sources":["../../../src/editor/canvas/DesignerArea.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,SAAS,EAAU,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAIjE,MAAM,WAAW,iBAAiB;IAChC,iCAAiC;IACjC,cAAc,EAAE,UAAU,EAAE,CAAA;IAC5B,sCAAsC;IACtC,YAAY,EAAE,YAAY,CAAA;IAC1B,0DAA0D;IAC1D,iBAAiB,EAAE,aAAa,CAAA;IAChC,wEAAwE;IACxE,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,uEAAuE;IACvE,cAAc,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,IAAI,CAAA;IAC9C,0CAA0C;IAC1C,iBAAiB,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;IACnE,gFAAgF;IAChF,cAAc,CAAC,EAAE,CACf,aAAa,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,cAAc,EAC3B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACpC,IAAI,CAAA;IACT,qEAAqE;IACrE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,2EAA2E;IAC3E,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,gFAAgF;IAChF,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,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aAAa,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,cAAc,EAC3B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACpC,IAAI,CAAA;IACT,qEAAqE;IACrE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,2EAA2E;IAC3E,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,gFAAgF;IAChF,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IACvE;kFAC8E;IAC9E,SAAS,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,CAAA;CACtC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,EAC3B,cAAc,EACd,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,SAAS,EACT,SAAS,EAAE,iBAAiB,GAC7B,EAAE,iBAAiB,2CA0BnB"}
@@ -1,15 +1,11 @@
1
1
  import { RefObject } from 'react';
2
- import { BlockRegistry, LayoutNode, TemplateData } from '../../registry';
2
+ import { BlockRegistry, LayoutNode } from '../../registry';
3
3
  import { TreePath } from '../document/utils';
4
4
  export interface DesignerCanvasProps {
5
5
  /** The layout tree to author. */
6
6
  templateLayout: LayoutNode[];
7
- /** Content props keyed by node id. */
8
- templateData: TemplateData;
9
7
  /** The registry the document's blocks resolve against. */
10
8
  componentRegistry: BlockRegistry;
11
- /** The engine's selected component id (drives the selection chrome). */
12
- selectedComponentId: string | null;
13
9
  /** Commit a new layout (e.g. `useBlockEditorState().changeLayout`). */
14
10
  onLayoutChange: (layout: LayoutNode[]) => void;
15
11
  /** A block was selected on the canvas. */
@@ -31,5 +27,5 @@ export interface DesignerCanvasProps {
31
27
  * and renders this. Turns on `DesignerModeContext` for the blocks it renders (its one owned
32
28
  * piece of context); brand color, block data and translations come from the host's providers.
33
29
  */
34
- export declare function DesignerCanvas({ templateLayout, templateData, componentRegistry, selectedComponentId, onLayoutChange, onSelectComponent, onDeleteNode, onDuplicateNode, onAIApply, canvasRef: externalCanvasRef, }: DesignerCanvasProps): import("react/jsx-runtime").JSX.Element;
30
+ export declare function DesignerCanvas({ templateLayout, componentRegistry, onLayoutChange, onSelectComponent, onDeleteNode, onDuplicateNode, onAIApply, canvasRef: externalCanvasRef, }: DesignerCanvasProps): import("react/jsx-runtime").JSX.Element;
35
31
  //# sourceMappingURL=DesignerCanvas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DesignerCanvas.d.ts","sourceRoot":"","sources":["../../../src/editor/canvas/DesignerCanvas.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,SAAS,EAAU,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAIjD,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,cAAc,EAAE,UAAU,EAAE,CAAA;IAC5B,sCAAsC;IACtC,YAAY,EAAE,YAAY,CAAA;IAC1B,0DAA0D;IAC1D,iBAAiB,EAAE,aAAa,CAAA;IAChC,wEAAwE;IACxE,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,uEAAuE;IACvE,cAAc,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,IAAI,CAAA;IAC9C,0CAA0C;IAC1C,iBAAiB,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;IACnE,qEAAqE;IACrE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,2E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AAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,2CAA2C;IAC3C,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IACvE;kFAC8E;IAC9E,SAAS,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,CAAA;CACtC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAC7B,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,SAAS,EACT,SAAS,EAAE,iBAAiB,GAC7B,EAAE,mBAAmB,2CAmBrB"}
@@ -2,7 +2,6 @@ import { SortableInsertTarget } from '../document/utils';
2
2
  /** DnD state shared from the provider down to the canvas without prop drilling. */
3
3
  export interface GridDndContextValue {
4
4
  activeId: string | null;
5
- isSortingContainer: boolean;
6
5
  numRows: number;
7
6
  trayInsertTarget: SortableInsertTarget | null;
8
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GridDndContext.d.ts","sourceRoot":"","sources":["../../../src/editor/canvas/GridDndContext.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAE7D,mFAAmF;AACnF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,kBAAkB,EAAE,OAAO,CAAA;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,oBAAoB,GAAG,IAAI,CAAA;CAC9C;AAED,eAAO,MAAM,cAAc,qDAAkD,CAAA;AAE7E,wBAAgB,iBAAiB,IAAI,mBAAmB,CAMvD"}
1
+ {"version":3,"file":"GridDndContext.d.ts","sourceRoot":"","sources":["../../../src/editor/canvas/GridDndContext.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAE7D,mFAAmF;AACnF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,oBAAoB,GAAG,IAAI,CAAA;CAC9C;AAED,eAAO,MAAM,cAAc,qDAAkD,CAAA;AAE7E,wBAAgB,iBAAiB,IAAI,mBAAmB,CAMvD"}
@@ -1,9 +1,14 @@
1
1
  import { ReactNode, RefObject } from 'react';
2
- import { BlockRegistry, LayoutNode, TemplateData } from '../../registry';
2
+ import { BlockRegistry, LayoutNode } from '../../registry';
3
3
  import { TrayDropTarget } from '../document/utils';
4
+ import { BlockDataStore } from '../state/blockDataStore';
5
+ import { SelectionStore } from '../state/selectionStore';
4
6
  export interface GridDndProviderProps {
5
7
  templateLayout: LayoutNode[];
6
- templateData: TemplateData;
8
+ /** `useBlockEditorState().store`, provided to everything inside. */
9
+ store: BlockDataStore;
10
+ /** `useBlockEditorState().selection`, provided to everything inside. */
11
+ selection: SelectionStore;
7
12
  componentRegistry: BlockRegistry;
8
13
  onLayoutChange: (layout: LayoutNode[]) => void;
9
14
  /** Optional callback for handling tray component drops. */
@@ -13,5 +18,5 @@ export interface GridDndProviderProps {
13
18
  children: ReactNode;
14
19
  }
15
20
  /** The single `DndContext` for the designer, wiring `useGridDnd` in and rendering the overlays. */
16
- export declare function GridDndProvider({ templateLayout, templateData, componentRegistry, onLayoutChange, onAddFromTray, canvasRef, children, }: GridDndProviderProps): import("react/jsx-runtime").JSX.Element;
21
+ export declare function GridDndProvider({ templateLayout, store, selection, componentRegistry, onLayoutChange, onAddFromTray, canvasRef, children, }: GridDndProviderProps): import("react/jsx-runtime").JSX.Element;
17
22
  //# sourceMappingURL=GridDndProvider.d.ts.map