@instructure/platform-block-content-editor 3.5.0 → 4.0.0

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 (127) hide show
  1. package/README.md +80 -17
  2. package/dist/components/blocks/Banner/bannerPropsSchema.d.ts.map +1 -1
  3. package/dist/contexts/NutritionFactsContext.d.ts +19 -0
  4. package/dist/contexts/NutritionFactsContext.d.ts.map +1 -0
  5. package/dist/editor/BlockContentEditor.d.ts +23 -8
  6. package/dist/editor/BlockContentEditor.d.ts.map +1 -1
  7. package/dist/editor/ai/AIGenerationContext.d.ts +46 -0
  8. package/dist/editor/ai/AIGenerationContext.d.ts.map +1 -0
  9. package/dist/editor/ai/BlockAIMenu.d.ts.map +1 -1
  10. package/dist/editor/ai/BlockAIMenuContent.d.ts.map +1 -1
  11. package/dist/editor/ai/BlockGenerationOverlay.d.ts +16 -0
  12. package/dist/editor/ai/BlockGenerationOverlay.d.ts.map +1 -0
  13. package/dist/editor/ai/NutritionFactsDisclosure.d.ts +23 -0
  14. package/dist/editor/ai/NutritionFactsDisclosure.d.ts.map +1 -0
  15. package/dist/editor/ai/PreviewBlockModal.d.ts +2 -7
  16. package/dist/editor/ai/PreviewBlockModal.d.ts.map +1 -1
  17. package/dist/editor/ai/aiMenuStyles.d.ts +1 -0
  18. package/dist/editor/ai/aiMenuStyles.d.ts.map +1 -1
  19. package/dist/editor/ai/aiTranslations.d.ts +19 -0
  20. package/dist/editor/ai/aiTranslations.d.ts.map +1 -1
  21. package/dist/editor/ai/aiTypes.d.ts +2 -0
  22. package/dist/editor/ai/aiTypes.d.ts.map +1 -1
  23. package/dist/editor/ai/generationOverlayStyles.d.ts +18 -0
  24. package/dist/editor/ai/generationOverlayStyles.d.ts.map +1 -0
  25. package/dist/editor/ai/index.d.ts +2 -1
  26. package/dist/editor/ai/index.d.ts.map +1 -1
  27. package/dist/editor/ai/previewBlockStyles.d.ts +17 -0
  28. package/dist/editor/ai/previewBlockStyles.d.ts.map +1 -0
  29. package/dist/editor/ai/previewDiff.d.ts +73 -0
  30. package/dist/editor/ai/previewDiff.d.ts.map +1 -0
  31. package/dist/editor/ai/previewDiff.test.d.ts +2 -0
  32. package/dist/editor/ai/previewDiff.test.d.ts.map +1 -0
  33. package/dist/editor/canvas/DesignerArea.d.ts +8 -6
  34. package/dist/editor/canvas/DesignerArea.d.ts.map +1 -1
  35. package/dist/editor/canvas/DesignerCanvas.d.ts +2 -6
  36. package/dist/editor/canvas/DesignerCanvas.d.ts.map +1 -1
  37. package/dist/editor/canvas/GridDndContext.d.ts +0 -1
  38. package/dist/editor/canvas/GridDndContext.d.ts.map +1 -1
  39. package/dist/editor/canvas/GridDndProvider.d.ts +8 -3
  40. package/dist/editor/canvas/GridDndProvider.d.ts.map +1 -1
  41. package/dist/editor/canvas/GridItemChild.d.ts +2 -6
  42. package/dist/editor/canvas/GridItemChild.d.ts.map +1 -1
  43. package/dist/editor/canvas/GridItemContainer.d.ts.map +1 -1
  44. package/dist/editor/canvas/GridViewer.d.ts +5 -16
  45. package/dist/editor/canvas/GridViewer.d.ts.map +1 -1
  46. package/dist/editor/canvas/TwoColumnDesigner.d.ts +1 -6
  47. package/dist/editor/canvas/TwoColumnDesigner.d.ts.map +1 -1
  48. package/dist/editor/canvas/canvasStyles.d.ts +3 -0
  49. package/dist/editor/canvas/canvasStyles.d.ts.map +1 -1
  50. package/dist/editor/canvas/index.d.ts +1 -0
  51. package/dist/editor/canvas/index.d.ts.map +1 -1
  52. package/dist/editor/history/types.d.ts +6 -0
  53. package/dist/editor/history/types.d.ts.map +1 -1
  54. package/dist/editor/history/undoRedoManager.d.ts.map +1 -1
  55. package/dist/editor/history/useUndoRedo.d.ts +3 -4
  56. package/dist/editor/history/useUndoRedo.d.ts.map +1 -1
  57. package/dist/editor/index.d.ts +9 -4
  58. package/dist/editor/index.d.ts.map +1 -1
  59. package/dist/editor/sidebar/form/ComponentEditorForm.d.ts +3 -2
  60. package/dist/editor/sidebar/form/ComponentEditorForm.d.ts.map +1 -1
  61. package/dist/editor/sidebar/form/fieldRendererUtils.d.ts +2 -1
  62. package/dist/editor/sidebar/form/fieldRendererUtils.d.ts.map +1 -1
  63. package/dist/editor/sidebar/form/renderers/AltTextFieldRenderer.d.ts.map +1 -1
  64. package/dist/editor/sidebar/form/renderers/AnswerArrayFieldRenderer.d.ts +1 -1
  65. package/dist/editor/sidebar/form/renderers/AnswerArrayFieldRenderer.d.ts.map +1 -1
  66. package/dist/editor/sidebar/panel/DesignerSideBar.d.ts.map +1 -1
  67. package/dist/editor/sidebar/panel/ToolBody.d.ts +2 -1
  68. package/dist/editor/sidebar/panel/ToolBody.d.ts.map +1 -1
  69. package/dist/editor/sidebar/panel/ToolContentContainer.d.ts +3 -1
  70. package/dist/editor/sidebar/panel/ToolContentContainer.d.ts.map +1 -1
  71. package/dist/editor/sidebar/panel/ToolHeaderActionsContext.d.ts.map +1 -1
  72. package/dist/editor/sidebar/panel/panelStyles.d.ts +1 -0
  73. package/dist/editor/sidebar/panel/panelStyles.d.ts.map +1 -1
  74. package/dist/editor/sidebar/panel/types.d.ts +7 -1
  75. package/dist/editor/sidebar/panel/types.d.ts.map +1 -1
  76. package/dist/editor/sidebar/sidebarTranslations.d.ts +0 -8
  77. package/dist/editor/sidebar/sidebarTranslations.d.ts.map +1 -1
  78. package/dist/editor/sidebar/tray/BlockTray.d.ts +3 -4
  79. package/dist/editor/sidebar/tray/BlockTray.d.ts.map +1 -1
  80. package/dist/editor/sidebar/tray/SharedTrayComponents.d.ts +1 -1
  81. package/dist/editor/sidebar/tray/blockDefinitions.d.ts.map +1 -1
  82. package/dist/editor/sidebar/tray/index.d.ts +0 -2
  83. package/dist/editor/sidebar/tray/index.d.ts.map +1 -1
  84. package/dist/editor/sidebar/useDesignerSelectionFocus.d.ts +10 -1
  85. package/dist/editor/sidebar/useDesignerSelectionFocus.d.ts.map +1 -1
  86. package/dist/editor/state/blockDataStore.d.ts +13 -0
  87. package/dist/editor/state/blockDataStore.d.ts.map +1 -0
  88. package/dist/editor/state/blockDataStore.test.d.ts +2 -0
  89. package/dist/editor/state/blockDataStore.test.d.ts.map +1 -0
  90. package/dist/editor/state/selectionContext.d.ts +5 -0
  91. package/dist/editor/state/selectionContext.d.ts.map +1 -0
  92. package/dist/editor/state/selectionStore.d.ts +11 -0
  93. package/dist/editor/state/selectionStore.d.ts.map +1 -0
  94. package/dist/editor/state/useBlockData.d.ts +13 -0
  95. package/dist/editor/state/useBlockData.d.ts.map +1 -0
  96. package/dist/editor/state/useBlockEditorState.d.ts +10 -5
  97. package/dist/editor/state/useBlockEditorState.d.ts.map +1 -1
  98. package/dist/editor/state/useUndoRedoState.d.ts +9 -0
  99. package/dist/editor/state/useUndoRedoState.d.ts.map +1 -0
  100. package/dist/editor/state/useUndoRedoState.test.d.ts +2 -0
  101. package/dist/editor/state/useUndoRedoState.test.d.ts.map +1 -0
  102. package/dist/index.d.ts +1 -1
  103. package/dist/index.d.ts.map +1 -1
  104. package/dist/index.js +8389 -7401
  105. package/dist/registry/blockCatalogue.d.ts +1 -6
  106. package/dist/registry/blockCatalogue.d.ts.map +1 -1
  107. package/dist/registry/templateTypes.d.ts +2 -2
  108. package/dist/schema/schemaRegistry.d.ts +0 -17
  109. package/dist/schema/schemaRegistry.d.ts.map +1 -1
  110. package/dist/viewer/viewerStyles.d.ts +0 -3
  111. package/dist/viewer/viewerStyles.d.ts.map +1 -1
  112. package/locales/en.json +13 -6
  113. package/package.json +5 -1
  114. package/dist/components/blocks/LayoutContainer/LayoutContainer.d.ts +0 -3
  115. package/dist/components/blocks/LayoutContainer/LayoutContainer.d.ts.map +0 -1
  116. package/dist/components/blocks/LayoutContainer/createLayoutContainerBlock.d.ts +0 -22
  117. package/dist/components/blocks/LayoutContainer/createLayoutContainerBlock.d.ts.map +0 -1
  118. package/dist/components/blocks/LayoutContainer/getLayoutContainerViewProps.d.ts +0 -32
  119. package/dist/components/blocks/LayoutContainer/getLayoutContainerViewProps.d.ts.map +0 -1
  120. package/dist/components/blocks/LayoutContainer/index.d.ts +0 -5
  121. package/dist/components/blocks/LayoutContainer/index.d.ts.map +0 -1
  122. package/dist/components/blocks/LayoutContainer/layoutContainerPropsSchema.d.ts +0 -118
  123. package/dist/components/blocks/LayoutContainer/layoutContainerPropsSchema.d.ts.map +0 -1
  124. package/dist/editor/sidebar/tray/LayoutTray.d.ts +0 -4
  125. package/dist/editor/sidebar/tray/LayoutTray.d.ts.map +0 -1
  126. package/dist/editor/sidebar/tray/TemplatesPanel.d.ts +0 -4
  127. 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
@@ -94,6 +108,14 @@ settings form (and your RCE). Only the host knows its RCE's overlay DOM, so the
94
108
  `.tox-menu` / `.tox-dialog` / `.tox-pop` floating-UI classes. A hand-composed sidebar passes the
95
109
  same predicate to `useDesignerSelectionFocus`.
96
110
 
111
+ **Host tools.** A host tool keeps its own view and stays mounted when the block selection clears
112
+ (focus leaving the editor deselects; only the block-settings trays reset with it), so an assistant's
113
+ chat survives a modal, a window switch, or a click outside. To confirm before a tool holding unsaved
114
+ work unmounts, pass `onBeforeToolChange(nextToolId, proceed)`: switching, closing, or collapsing the
115
+ tool from the sidebar waits for `proceed()`. A tool's `background` and `bodyBackground` override the
116
+ panel and body fills (any CSS `background`, gradients included); `variant: 'dark-surface'` sets the
117
+ light-on-dark header.
118
+
97
119
  ### Or compose the primitives yourself
98
120
 
99
121
  Every arrangement above is reproducible. Wrap your own layout in one `GridDndProvider` and drop a
@@ -103,7 +125,7 @@ standalone `DesignerArea` (which self-wraps its own provider) when you don't nee
103
125
  ```tsx
104
126
  import { GridDndProvider, DesignerCanvas, ComponentsTray, DesignerNavProvider } from '@instructure/platform-block-content-editor'
105
127
 
106
- <GridDndProvider {...dndProps}>
128
+ <GridDndProvider store={engine.store} {...dndProps}>
107
129
  <DesignerNavProvider><ComponentsTray registry={registry} onAddComponent={engine.addComponent} /></DesignerNavProvider>
108
130
  <DesignerCanvas canvasRef={canvasRef} {...canvasProps} />
109
131
  </GridDndProvider>
@@ -113,30 +135,71 @@ Also public: `DesignerSideBar` (the tool-panel chrome), `ComponentEditorForm` (t
113
135
  `useDesignerNav` (the sidebar's view-navigation hook), `useDesignerSelectionFocus`, and the
114
136
  block-level AI (`BlockAIMenu`, `useGenerateAltText`).
115
137
 
116
- ## Preview — the host presents it
138
+ ## Preview — the host drives it
117
139
 
118
140
  `PreviewArea` is a framed student preview over the read-path `Viewer`, sized from a required,
119
141
  controlled `viewport` prop (`'desktop' | 'mobile'`). It renders no switch of its own — the host
120
- builds the Desktop/Mobile toggle and drives `viewport` from its own state. The package ships
121
- **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.
122
152
 
123
153
  ```tsx
124
- 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'
125
155
 
156
+ const [isPreviewOn, setIsPreviewOn] = useState(false)
126
157
  const [viewport, setViewport] = useState<PreviewViewport>(PREVIEW_VIEWPORTS.DESKTOP)
127
158
 
128
- <Modal open={previewing} onDismiss={…}>
129
- <div role="group" aria-label="Preview viewport">
130
- <Button onClick={() => setViewport(PREVIEW_VIEWPORTS.DESKTOP)}>Desktop</Button>
131
- <Button onClick={() => setViewport(PREVIEW_VIEWPORTS.MOBILE)}>Mobile</Button>
132
- </div>
133
- <PreviewArea
134
- templateLayout={engine.templateLayout}
135
- templateData={engine.templateData}
136
- componentRegistry={registry}
137
- viewport={viewport}
138
- />
139
- </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
+ />
140
203
  ```
141
204
 
142
205
  ## Seams — everything Canvas-specific is injected
@@ -1 +1 @@
1
- {"version":3,"file":"bannerPropsSchema.d.ts","sourceRoot":"","sources":["../../../../src/components/blocks/Banner/bannerPropsSchema.ts"],"names":[],"mappings":"AAmBA,OAAO,+BAA+B,CAAA;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB,iDAAiD;AACjD,eAAO,MAAM,wBAAwB,yDAAuD,CAAA;AAE5F,oGAAoG;AACpG,eAAO,MAAM,iBAAiB,kDAAgD,CAAA;AAE9E,wDAAwD;AACxD,eAAO,MAAM,0BAA0B,6CAA2C,CAAA;AAWlF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkF5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC3D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC3D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AACzE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAE7E,eAAO,MAAM,kBAAkB,EAAE,WAYhC,CAAA;AAED,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;EAAuD,CAAA"}
1
+ {"version":3,"file":"bannerPropsSchema.d.ts","sourceRoot":"","sources":["../../../../src/components/blocks/Banner/bannerPropsSchema.ts"],"names":[],"mappings":"AAmBA,OAAO,+BAA+B,CAAA;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB,iDAAiD;AACjD,eAAO,MAAM,wBAAwB,yDAAuD,CAAA;AAE5F,oGAAoG;AACpG,eAAO,MAAM,iBAAiB,kDAAgD,CAAA;AAE9E,wDAAwD;AACxD,eAAO,MAAM,0BAA0B,6CAA2C,CAAA;AAWlF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmF5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC3D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC3D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AACzE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAE7E,eAAO,MAAM,kBAAkB,EAAE,WAYhC,CAAA;AAED,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;EAAuD,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { NutritionFactsProps } from '@instructure/platform-nutrition-facts';
2
+ /**
3
+ * AI Nutrition Facts disclosure data per block-level AI surface. The host builds each
4
+ * `NutritionFactsProps` from its own AI-info source (Canvas config the package must not import);
5
+ * an absent entry means that surface shows no ⓘ, so surfaces can be wired independently.
6
+ */
7
+ export interface BlockAINutritionFacts {
8
+ /** The block AI menu and generate prompt. */
9
+ contentGeneration?: NutritionFactsProps;
10
+ /** The alt-text field's "Generate alt text" affordance. */
11
+ altText?: NutritionFactsProps;
12
+ }
13
+ /**
14
+ * Host-provided disclosure data, or `undefined` when none is given. The disclosure twin of
15
+ * `AIActionContext`: per-surface presence is the enablement for that ⓘ.
16
+ */
17
+ export declare const NutritionFactsContext: import('react').Context<BlockAINutritionFacts | undefined>;
18
+ export declare const useNutritionFacts: () => BlockAINutritionFacts | undefined;
19
+ //# sourceMappingURL=NutritionFactsContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NutritionFactsContext.d.ts","sourceRoot":"","sources":["../../src/contexts/NutritionFactsContext.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAEhF;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,6CAA6C;IAC7C,iBAAiB,CAAC,EAAE,mBAAmB,CAAA;IACvC,2DAA2D;IAC3D,OAAO,CAAC,EAAE,mBAAmB,CAAA;CAC9B;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,4DAA8D,CAAA;AAEhG,eAAO,MAAM,iBAAiB,QAAO,qBAAqB,GAAG,SAC1B,CAAA"}
@@ -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
@@ -35,6 +42,13 @@ export interface BlockContentEditorProps<HostToolId extends string = never> {
35
42
  * deselects the block and unmounts its settings form. See `useDesignerSelectionFocus`.
36
43
  */
37
44
  isEditorOverlayOpen?: () => boolean;
45
+ /**
46
+ * Called before the author switches, closes, or collapses the open tool from the sidebar. The
47
+ * change waits for `proceed`; not calling it cancels the change. Lets a host confirm before a tool
48
+ * holding unsaved work unmounts (e.g. an assistant's chat). Without it, the change is immediate.
49
+ * Opening a block's settings from the canvas is not routed through here.
50
+ */
51
+ onBeforeToolChange?: (nextToolId: BuiltInToolId | HostToolId | null, proceed: () => void) => void;
38
52
  }
39
53
  /**
40
54
  * The authoring editor: the tool-panel sidebar over the drag-and-drop canvas, wired to the
@@ -44,8 +58,9 @@ export interface BlockContentEditorProps<HostToolId extends string = never> {
44
58
  *
45
59
  * It holds only the panel's view/tool UI state; the document, selection, and history live in
46
60
  * the `engine` the host owns. One shared `GridDndProvider` wraps both surfaces so tray drag
47
- * sources reach the canvas droppables. It is authoring-only — the student preview
48
- * (`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.
49
64
  */
50
- export declare function BlockContentEditor<HostToolId extends string = never>({ engine, registry, tools: hostTools, builtInToolIds, initialToolId, height, hasExpandPanelButton, isEditorOverlayOpen, }: 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;
51
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,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;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,OAAO,CAAA;CACpC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,SAAS,MAAM,GAAG,KAAK,EAAE,EACpE,MAAM,EACN,QAAQ,EACR,KAAK,EAAE,SAAS,EAChB,cAAuC,EACvC,aAAa,EACb,MAAM,EACN,oBAAoB,EACpB,mBAAmB,GACpB,EAAE,uBAAuB,CAAC,UAAU,CAAC,2CAgQrC"}
1
+ {"version":3,"file":"BlockContentEditor.d.ts","sourceRoot":"","sources":["../../src/editor/BlockContentEditor.tsx"],"names":[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AG,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,CAAA;AAEzC,KAAK,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;AAE1D,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACtC,YAAY,EAAE,OAAO,CAAA;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,iBAAiB,EAAE,aAAa,CAAA;CACjC;AAED,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,OAAO,CAAA;AAEpD,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D,WAAW,EAAE,MAAM,CAAA;IACnB,uFAAuF;IACvF,MAAM,CAAC,EAAE,mBAAmB,CAAA;CAC7B;AAED,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,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BAAoB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAC9C,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAED,eAAO,MAAM,kBAAkB,GAAI,4KAehC,uBAAuB,4CAsPzB,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"}
@@ -0,0 +1,23 @@
1
+ import { NutritionFactsProps } from '@instructure/platform-nutrition-facts';
2
+ /**
3
+ * The icon-only disclosure trigger — used in the generate-prompt header and the "Generate alt
4
+ * text" affordance.
5
+ *
6
+ * The wrapper span carries `DESIGNER_OVERLAY_ATTR` while the modal is open so the tool panel's
7
+ * focus-out (`useDesignerSelectionFocus`) holds the block selection rather than deselecting and
8
+ * unmounting this disclosure — `AiInformation` portals its focus-taking modal to the body with no
9
+ * marker of its own. Only this inline trigger needs it; the menu-row and prompt-header placements
10
+ * sit inside the already-marked `BlockAIMenu` popover.
11
+ */
12
+ export declare function NutritionFactsIconTrigger({ data }: {
13
+ data: NutritionFactsProps;
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ /**
16
+ * The disclosure as a full-width menu row matching the AI menu's other rows (icon + label, no
17
+ * chevron since it opens a modal rather than a submenu). Render inside the root menu's `<ul>`,
18
+ * wrapped in its own `<li>`.
19
+ */
20
+ export declare function NutritionFactsMenuRow({ data }: {
21
+ data: NutritionFactsProps;
22
+ }): import("react/jsx-runtime").JSX.Element;
23
+ //# sourceMappingURL=NutritionFactsDisclosure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NutritionFactsDisclosure.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/NutritionFactsDisclosure.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAShF;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,2CAoChF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,2CAc5E"}
@@ -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"}
@@ -26,6 +26,7 @@ export declare const AI_CLASS: {
26
26
  readonly item: "bce-ai-menu-item";
27
27
  readonly itemLabel: "bce-ai-menu-item-label";
28
28
  readonly subHeader: "bce-ai-menu-subheader";
29
+ readonly promptBackHeader: "bce-ai-menu-prompt-back-header";
29
30
  readonly gradientTitle: "bce-ai-menu-gradient-title";
30
31
  readonly promptHeader: "bce-ai-menu-prompt-header";
31
32
  readonly charCount: "bce-ai-menu-char-count";
@@ -1 +1 @@
1
- {"version":3,"file":"aiMenuStyles.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/aiMenuStyles.tsx"],"names":[],"mappings":"AAoBA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,cAAc,YAAY,CAAA;AAEvC;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,WAAW,CAAA;AAEzC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;IAcnB,kGAAkG;;;IAGlG,oFAAoF;;;IAGpF,oFAAoF;;;CAG5E,CAAA;AAyBV,yEAAyE;AACzE,wBAAgB,YAAY,4CA8J3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,4CAkF9B"}
1
+ {"version":3,"file":"aiMenuStyles.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/aiMenuStyles.tsx"],"names":[],"mappings":"AAoBA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,cAAc,YAAY,CAAA;AAEvC;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,WAAW,CAAA;AAEzC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;IAenB,kGAAkG;;;IAGlG,oFAAoF;;;IAGpF,oFAAoF;;;CAG5E,CAAA;AAyBV,yEAAyE;AACzE,wBAAgB,YAAY,4CA0K3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,4CAkF9B"}
@@ -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;
@@ -77,6 +94,8 @@ export interface DesignerAITranslations {
77
94
  failedToLoadImage: string;
78
95
  failedToGenerate: string;
79
96
  noDescription: string;
97
+ /** Label/tooltip for the AI Nutrition Facts disclosure — the menu row and the icon triggers. */
98
+ aiNutritionFacts: string;
80
99
  }
81
100
  /** English bundled with this package — also the source for `locales/en.json`. */
82
101
  export declare const DesignerAIEnglish: DesignerAITranslations;
@@ -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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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,gBAA2C;IAAE,SAAS,CAAC,EAAE,MAAM,CA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