@instructure/platform-block-content-editor 1.0.0 → 2.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.
- package/README.md +199 -0
- package/dist/components/blocks/LayoutContainer/LayoutContainer.d.ts.map +1 -1
- package/dist/contexts/AIActionContext.d.ts +38 -0
- package/dist/contexts/AIActionContext.d.ts.map +1 -0
- package/dist/contexts/BlockEditorApiContext.d.ts +78 -0
- package/dist/contexts/BlockEditorApiContext.d.ts.map +1 -1
- package/dist/contexts/RichTextEditorContext.d.ts +28 -0
- package/dist/contexts/RichTextEditorContext.d.ts.map +1 -0
- package/dist/editor/BlockContentEditor.d.ts +43 -0
- package/dist/editor/BlockContentEditor.d.ts.map +1 -0
- package/dist/editor/ai/BlockAIMenu.d.ts +17 -0
- package/dist/editor/ai/BlockAIMenu.d.ts.map +1 -0
- package/dist/editor/ai/BlockAIMenuContent.d.ts +17 -0
- package/dist/editor/ai/BlockAIMenuContent.d.ts.map +1 -0
- package/dist/editor/ai/PreviewBlockModal.d.ts +29 -0
- package/dist/editor/ai/PreviewBlockModal.d.ts.map +1 -0
- package/dist/editor/ai/aiMenuStyles.d.ts +23 -0
- package/dist/editor/ai/aiMenuStyles.d.ts.map +1 -0
- package/dist/editor/ai/aiTranslations.d.ts +79 -0
- package/dist/editor/ai/aiTranslations.d.ts.map +1 -0
- package/dist/editor/ai/aiTypes.d.ts +13 -0
- package/dist/editor/ai/aiTypes.d.ts.map +1 -0
- package/dist/editor/ai/constants.d.ts +8 -0
- package/dist/editor/ai/constants.d.ts.map +1 -0
- package/dist/editor/ai/index.d.ts +7 -0
- package/dist/editor/ai/index.d.ts.map +1 -0
- package/dist/editor/ai/useBlockAIPopover.d.ts +30 -0
- package/dist/editor/ai/useBlockAIPopover.d.ts.map +1 -0
- package/dist/editor/ai/useGenerateAltText.d.ts +11 -0
- package/dist/editor/ai/useGenerateAltText.d.ts.map +1 -0
- package/dist/editor/canvas/DesignerArea.d.ts +38 -0
- package/dist/editor/canvas/DesignerArea.d.ts.map +1 -0
- package/dist/editor/canvas/DesignerCanvas.d.ts +35 -0
- package/dist/editor/canvas/DesignerCanvas.d.ts.map +1 -0
- package/dist/editor/canvas/DropGridOverlay.d.ts +24 -0
- package/dist/editor/canvas/DropGridOverlay.d.ts.map +1 -0
- package/dist/editor/canvas/GridDndContext.d.ts +11 -0
- package/dist/editor/canvas/GridDndContext.d.ts.map +1 -0
- package/dist/editor/canvas/GridDndProvider.d.ts +17 -0
- package/dist/editor/canvas/GridDndProvider.d.ts.map +1 -0
- package/dist/editor/canvas/GridItemChild.d.ts +44 -0
- package/dist/editor/canvas/GridItemChild.d.ts.map +1 -0
- package/dist/editor/canvas/GridItemContainer.d.ts +49 -0
- package/dist/editor/canvas/GridItemContainer.d.ts.map +1 -0
- package/dist/editor/canvas/GridViewer.d.ts +114 -0
- package/dist/editor/canvas/GridViewer.d.ts.map +1 -0
- package/dist/editor/canvas/TwoColumnDesigner.d.ts +34 -0
- package/dist/editor/canvas/TwoColumnDesigner.d.ts.map +1 -0
- package/dist/editor/canvas/canvasStyles.d.ts +36 -0
- package/dist/editor/canvas/canvasStyles.d.ts.map +1 -0
- package/dist/editor/canvas/canvasTranslations.d.ts +64 -0
- package/dist/editor/canvas/canvasTranslations.d.ts.map +1 -0
- package/dist/editor/canvas/index.d.ts +5 -0
- package/dist/editor/canvas/index.d.ts.map +1 -0
- package/dist/editor/document/constants.d.ts +23 -0
- package/dist/editor/document/constants.d.ts.map +1 -0
- package/dist/editor/document/designerItemAction.d.ts +16 -0
- package/dist/editor/document/designerItemAction.d.ts.map +1 -0
- package/dist/editor/document/utils.d.ts +172 -0
- package/dist/editor/document/utils.d.ts.map +1 -0
- package/dist/editor/document/utils.test.d.ts +2 -0
- package/dist/editor/document/utils.test.d.ts.map +1 -0
- package/dist/editor/history/types.d.ts +25 -0
- package/dist/editor/history/types.d.ts.map +1 -0
- package/dist/editor/history/undoRedoManager.d.ts +3 -0
- package/dist/editor/history/undoRedoManager.d.ts.map +1 -0
- package/dist/editor/history/undoRedoManager.test.d.ts +2 -0
- package/dist/editor/history/undoRedoManager.test.d.ts.map +1 -0
- package/dist/editor/history/useUndoRedo.d.ts +11 -0
- package/dist/editor/history/useUndoRedo.d.ts.map +1 -0
- package/dist/editor/history/useUndoRedo.test.d.ts +2 -0
- package/dist/editor/history/useUndoRedo.test.d.ts.map +1 -0
- package/dist/editor/index.d.ts +16 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/preview/PreviewArea.d.ts +28 -0
- package/dist/editor/preview/PreviewArea.d.ts.map +1 -0
- package/dist/editor/preview/constants.d.ts +9 -0
- package/dist/editor/preview/constants.d.ts.map +1 -0
- package/dist/editor/preview/index.d.ts +3 -0
- package/dist/editor/preview/index.d.ts.map +1 -0
- package/dist/editor/preview/previewStyles.d.ts +19 -0
- package/dist/editor/preview/previewStyles.d.ts.map +1 -0
- package/dist/editor/sidebar/DesignerNav.d.ts +28 -0
- package/dist/editor/sidebar/DesignerNav.d.ts.map +1 -0
- package/dist/editor/sidebar/form/ComponentEditorForm.d.ts +12 -0
- package/dist/editor/sidebar/form/ComponentEditorForm.d.ts.map +1 -0
- package/dist/editor/sidebar/form/FormFieldWrapper.d.ts +13 -0
- package/dist/editor/sidebar/form/FormFieldWrapper.d.ts.map +1 -0
- package/dist/editor/sidebar/form/fieldRendererUtils.d.ts +24 -0
- package/dist/editor/sidebar/form/fieldRendererUtils.d.ts.map +1 -0
- package/dist/editor/sidebar/form/fieldRenderers.d.ts +6 -0
- package/dist/editor/sidebar/form/fieldRenderers.d.ts.map +1 -0
- package/dist/editor/sidebar/form/formTranslations.d.ts +92 -0
- package/dist/editor/sidebar/form/formTranslations.d.ts.map +1 -0
- package/dist/editor/sidebar/form/formUtils.d.ts +7 -0
- package/dist/editor/sidebar/form/formUtils.d.ts.map +1 -0
- package/dist/editor/sidebar/form/index.d.ts +7 -0
- package/dist/editor/sidebar/form/index.d.ts.map +1 -0
- package/dist/editor/sidebar/form/knowledgeCheckEditor.d.ts +10 -0
- package/dist/editor/sidebar/form/knowledgeCheckEditor.d.ts.map +1 -0
- package/dist/editor/sidebar/form/renderers/AltTextFieldRenderer.d.ts +4 -0
- package/dist/editor/sidebar/form/renderers/AltTextFieldRenderer.d.ts.map +1 -0
- package/dist/editor/sidebar/form/renderers/AnswerArrayFieldRenderer.d.ts +4 -0
- package/dist/editor/sidebar/form/renderers/AnswerArrayFieldRenderer.d.ts.map +1 -0
- package/dist/editor/sidebar/form/renderers/ObjectArrayFieldRenderer.d.ts +4 -0
- package/dist/editor/sidebar/form/renderers/ObjectArrayFieldRenderer.d.ts.map +1 -0
- package/dist/editor/sidebar/form/uploaders/FileUploader.d.ts +24 -0
- package/dist/editor/sidebar/form/uploaders/FileUploader.d.ts.map +1 -0
- package/dist/editor/sidebar/form/uploaders/ImageUploader.d.ts +8 -0
- package/dist/editor/sidebar/form/uploaders/ImageUploader.d.ts.map +1 -0
- package/dist/editor/sidebar/form/uploaders/VideoUploader.d.ts +8 -0
- package/dist/editor/sidebar/form/uploaders/VideoUploader.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/DesignerSideBar.d.ts +18 -0
- package/dist/editor/sidebar/panel/DesignerSideBar.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/MobileToolOverlay.d.ts +13 -0
- package/dist/editor/sidebar/panel/MobileToolOverlay.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/MobileToolbar.d.ts +10 -0
- package/dist/editor/sidebar/panel/MobileToolbar.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/ToolBody.d.ts +11 -0
- package/dist/editor/sidebar/panel/ToolBody.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/ToolContentContainer.d.ts +27 -0
- package/dist/editor/sidebar/panel/ToolContentContainer.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/ToolHeader.d.ts +24 -0
- package/dist/editor/sidebar/panel/ToolHeader.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/ToolHeaderActionsContext.d.ts +8 -0
- package/dist/editor/sidebar/panel/ToolHeaderActionsContext.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/ToolIconButtons.d.ts +19 -0
- package/dist/editor/sidebar/panel/ToolIconButtons.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/ToolWrapper.d.ts +16 -0
- package/dist/editor/sidebar/panel/ToolWrapper.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/constants.d.ts +23 -0
- package/dist/editor/sidebar/panel/constants.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/index.d.ts +5 -0
- package/dist/editor/sidebar/panel/index.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/panelStyles.d.ts +29 -0
- package/dist/editor/sidebar/panel/panelStyles.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/types.d.ts +83 -0
- package/dist/editor/sidebar/panel/types.d.ts.map +1 -0
- package/dist/editor/sidebar/panel/useFocusReturn.d.ts +8 -0
- package/dist/editor/sidebar/panel/useFocusReturn.d.ts.map +1 -0
- package/dist/editor/sidebar/sidebarTranslations.d.ts +53 -0
- package/dist/editor/sidebar/sidebarTranslations.d.ts.map +1 -0
- package/dist/editor/sidebar/tray/BlockTray.d.ts +30 -0
- package/dist/editor/sidebar/tray/BlockTray.d.ts.map +1 -0
- package/dist/editor/sidebar/tray/ComponentsTray.d.ts +4 -0
- package/dist/editor/sidebar/tray/ComponentsTray.d.ts.map +1 -0
- package/dist/editor/sidebar/tray/InteractiveTray.d.ts +4 -0
- package/dist/editor/sidebar/tray/InteractiveTray.d.ts.map +1 -0
- package/dist/editor/sidebar/tray/LayoutTray.d.ts +4 -0
- package/dist/editor/sidebar/tray/LayoutTray.d.ts.map +1 -0
- package/dist/editor/sidebar/tray/SharedTrayComponents.d.ts +64 -0
- package/dist/editor/sidebar/tray/SharedTrayComponents.d.ts.map +1 -0
- package/dist/editor/sidebar/tray/TemplatesPanel.d.ts +4 -0
- package/dist/editor/sidebar/tray/TemplatesPanel.d.ts.map +1 -0
- package/dist/editor/sidebar/tray/TrayDragLayer.d.ts +14 -0
- package/dist/editor/sidebar/tray/TrayDragLayer.d.ts.map +1 -0
- package/dist/editor/sidebar/tray/blockDefinitions.d.ts +11 -0
- package/dist/editor/sidebar/tray/blockDefinitions.d.ts.map +1 -0
- package/dist/editor/sidebar/tray/index.d.ts +9 -0
- package/dist/editor/sidebar/tray/index.d.ts.map +1 -0
- package/dist/editor/sidebar/tray/trayStyles.d.ts +20 -0
- package/dist/editor/sidebar/tray/trayStyles.d.ts.map +1 -0
- package/dist/editor/sidebar/useDesignerSelectionFocus.d.ts +51 -0
- package/dist/editor/sidebar/useDesignerSelectionFocus.d.ts.map +1 -0
- package/dist/editor/state/applyTemplatePatch.d.ts +46 -0
- package/dist/editor/state/applyTemplatePatch.d.ts.map +1 -0
- package/dist/editor/state/applyTemplatePatch.test.d.ts +2 -0
- package/dist/editor/state/applyTemplatePatch.test.d.ts.map +1 -0
- package/dist/editor/state/useBlockEditorState.d.ts +57 -0
- package/dist/editor/state/useBlockEditorState.d.ts.map +1 -0
- package/dist/editor/state/useBlockEditorState.test.d.ts +2 -0
- package/dist/editor/state/useBlockEditorState.test.d.ts.map +1 -0
- package/dist/editor/validation/templateDataValidator.d.ts +48 -0
- package/dist/editor/validation/templateDataValidator.d.ts.map +1 -0
- package/dist/editor/validation/templateDataValidator.test.d.ts +2 -0
- package/dist/editor/validation/templateDataValidator.test.d.ts.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14270 -1868
- package/dist/registry/blockRegistry.d.ts +8 -0
- package/dist/registry/blockRegistry.d.ts.map +1 -1
- package/dist/registry/defineBlock.d.ts +5 -0
- package/dist/registry/defineBlock.d.ts.map +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/zodExtensions.d.ts +2 -0
- package/dist/schema/zodExtensions.d.ts.map +1 -1
- package/dist/utils/useMediaQuery.d.ts +7 -0
- package/dist/utils/useMediaQuery.d.ts.map +1 -0
- package/dist/viewer/Viewer.d.ts +3 -1
- package/dist/viewer/Viewer.d.ts.map +1 -1
- package/dist/viewer/viewerStyles.d.ts +12 -0
- package/dist/viewer/viewerStyles.d.ts.map +1 -0
- package/locales/en.json +123 -1
- package/package.json +34 -1
package/README.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# @instructure/platform-block-content-editor
|
|
2
|
+
|
|
3
|
+
Host-agnostic **block content editor** for the Canvas activity builder: the blocks, their schemas,
|
|
4
|
+
the read path that renders a saved document, and the write path that authors one — all on native
|
|
5
|
+
InstUI, with every Canvas coupling behind an injectable seam. Owned by **foundation**.
|
|
6
|
+
|
|
7
|
+
This package ships **building blocks for rebuilding the editor, not a finished app.** There is one
|
|
8
|
+
convenient composition (`BlockContentEditor`), but everything it does is reproducible from the
|
|
9
|
+
exposed primitives, so a host can arrange the pieces however it needs (a tray or the preview in a
|
|
10
|
+
modal, a custom toolbar, its own layout).
|
|
11
|
+
|
|
12
|
+
> Deep design notes and invariants live in [`CLAUDE.md`](./CLAUDE.md); the block-authoring
|
|
13
|
+
> conventions in the `bce-block-authoring` skill; architecture decisions in the repo's `docs/adr/`.
|
|
14
|
+
> See [Documentation](#documentation) below.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
pnpm add @instructure/platform-block-content-editor
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
InstUI, React, and `zod` are **peer dependencies** — the host provides its single shared copy of
|
|
23
|
+
each (see the `peerDependencies` in `package.json`).
|
|
24
|
+
|
|
25
|
+
The package is **ESM-only** (`"type": "module"`, one `.` export plus `./locales/en.json`). Styles are
|
|
26
|
+
emotion runtime-injected — there is **no `./styles` import**. There is also **no `PlatformUiProvider`**:
|
|
27
|
+
BCE is host-agnostic through its own set of seam contexts (see [Seams](#seams--everything-canvas-specific-is-injected)),
|
|
28
|
+
not a single umbrella provider. A minimal host can render `Viewer` / `BlockContentEditor` with just
|
|
29
|
+
React, InstUI theming, and a composed registry.
|
|
30
|
+
|
|
31
|
+
## The registry (both paths need it)
|
|
32
|
+
|
|
33
|
+
There is deliberately **no default registry**: which blocks a document may contain is the host's
|
|
34
|
+
decision. Compose one from the shipped block factories — the keys are the **wire format** stored in
|
|
35
|
+
documents (`Header` → Banner, `QuoteBlock` → Quote, …):
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { defineRegistry, createBannerBlock, createTextBlock } from '@instructure/platform-block-content-editor'
|
|
39
|
+
|
|
40
|
+
const registry = defineRegistry({
|
|
41
|
+
Header: createBannerBlock({ label: t('Banner'), translations: {/* … */} }),
|
|
42
|
+
Text: createTextBlock({ label: t('Rich content editor'), translations: {/* … */} }),
|
|
43
|
+
// …the blocks this host offers, plus any host-owned blocks
|
|
44
|
+
})
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Compose with `defineRegistry(…)`; never annotate `: BlockRegistry` (it widens the type and silently
|
|
48
|
+
collapses every derived type — see CLAUDE.md).
|
|
49
|
+
|
|
50
|
+
## Read path — render a saved document
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { Viewer } from '@instructure/platform-block-content-editor'
|
|
54
|
+
|
|
55
|
+
<Viewer templateLayout={layout} templateData={data} componentRegistry={registry} />
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`Viewer` emits no wrapper and takes no `theme`; host-specific typography belongs on the host's
|
|
59
|
+
container. Unresolved blocks are reported via `onUnresolvedBlock`, never dropped or mutated.
|
|
60
|
+
|
|
61
|
+
## Write path — author a document
|
|
62
|
+
|
|
63
|
+
The **host owns the state engine** (so it owns save, undo/redo, dirty-tracking, and DB↔package
|
|
64
|
+
conversion). Call `useBlockEditorState` and hand the result to the editor:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import { useBlockEditorState, BlockContentEditor } from '@instructure/platform-block-content-editor'
|
|
68
|
+
|
|
69
|
+
function Builder() {
|
|
70
|
+
const engine = useBlockEditorState({ initialData, initialLayout, registry, onDirty })
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<BlockContentEditor
|
|
74
|
+
engine={engine}
|
|
75
|
+
registry={registry}
|
|
76
|
+
tools={[widgetTray, aiAssistantTool]} // host-tool slot (optional)
|
|
77
|
+
/>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`BlockContentEditor` composes the tool-panel sidebar over the drag-and-drop canvas: it builds the
|
|
83
|
+
registry-driven insertion trays, hoists a single DnD context so blocks can be **dragged** from a
|
|
84
|
+
tray onto the canvas, coordinates canvas↔panel selection focus, and routes a selected block to its
|
|
85
|
+
settings form. It is **authoring-only** — see Preview below.
|
|
86
|
+
|
|
87
|
+
### Or compose the primitives yourself
|
|
88
|
+
|
|
89
|
+
Every arrangement above is reproducible. Wrap your own layout in one `GridDndProvider` and drop a
|
|
90
|
+
bare `DesignerCanvas` and the trays inside it (so tray drag reaches the canvas), or use the
|
|
91
|
+
standalone `DesignerArea` (which self-wraps its own provider) when you don't need a shared context:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { GridDndProvider, DesignerCanvas, ComponentsTray, DesignerNavProvider } from '@instructure/platform-block-content-editor'
|
|
95
|
+
|
|
96
|
+
<GridDndProvider {...dndProps}>
|
|
97
|
+
<DesignerNavProvider><ComponentsTray registry={registry} onAddComponent={engine.addComponent} /></DesignerNavProvider>
|
|
98
|
+
<DesignerCanvas canvasRef={canvasRef} {...canvasProps} />
|
|
99
|
+
</GridDndProvider>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Also public: `DesignerSideBar` (the tool-panel chrome), `ComponentEditorForm` (the settings form),
|
|
103
|
+
`useDesignerNav` (the sidebar's view-navigation hook), `useDesignerSelectionFocus`, and the
|
|
104
|
+
block-level AI (`BlockAIMenu`, `useGenerateAltText`).
|
|
105
|
+
|
|
106
|
+
## Preview — the host presents it
|
|
107
|
+
|
|
108
|
+
`PreviewArea` is a framed student preview over the read-path `Viewer`, sized from a required,
|
|
109
|
+
controlled `viewport` prop (`'desktop' | 'mobile'`). It renders no switch of its own — the host
|
|
110
|
+
builds the Desktop/Mobile toggle and drives `viewport` from its own state. The package ships
|
|
111
|
+
**no modal**: how the preview is presented (modal, drawer, fullscreen, inline) is the host's choice.
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import { PreviewArea, PREVIEW_VIEWPORTS, type PreviewViewport } from '@instructure/platform-block-content-editor'
|
|
115
|
+
|
|
116
|
+
const [viewport, setViewport] = useState<PreviewViewport>(PREVIEW_VIEWPORTS.DESKTOP)
|
|
117
|
+
|
|
118
|
+
<Modal open={previewing} onDismiss={…}>
|
|
119
|
+
<div role="group" aria-label="Preview viewport">
|
|
120
|
+
<Button onClick={() => setViewport(PREVIEW_VIEWPORTS.DESKTOP)}>Desktop</Button>
|
|
121
|
+
<Button onClick={() => setViewport(PREVIEW_VIEWPORTS.MOBILE)}>Mobile</Button>
|
|
122
|
+
</div>
|
|
123
|
+
<PreviewArea
|
|
124
|
+
templateLayout={engine.templateLayout}
|
|
125
|
+
templateData={engine.templateData}
|
|
126
|
+
componentRegistry={registry}
|
|
127
|
+
viewport={viewport}
|
|
128
|
+
/>
|
|
129
|
+
</Modal>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Seams — everything Canvas-specific is injected
|
|
133
|
+
|
|
134
|
+
Blocks and the editor read only from context; the host provides the implementations:
|
|
135
|
+
|
|
136
|
+
| Context | What the host injects |
|
|
137
|
+
| --- | --- |
|
|
138
|
+
| `BrandColorContext` | the brand color (hex/`rgb()`), or `undefined` |
|
|
139
|
+
| `BlockTranslationsProvider` | resolved strings per block + designer chrome (bundled English is the fallback) |
|
|
140
|
+
| `RichTextRendererContext` | a renderer for RCE-authored HTML (read path); unset → sanitized fallback |
|
|
141
|
+
| `RichTextEditorContext` | the RCE editor component (write path); unset → plain `TextArea` |
|
|
142
|
+
| `AIActionContext` | the AI executor; **presence enables** the block-level AI, unset → hidden |
|
|
143
|
+
| `BlockEditorApiProvider` | host data hooks — image/video/widget URLs and the settings-form file upload/delete |
|
|
144
|
+
|
|
145
|
+
Each is host-agnostic: the host closes over Canvas course/plugin/file config **inside** its own
|
|
146
|
+
hook/component; the package only ever passes opaque ids and reads back resolved values.
|
|
147
|
+
|
|
148
|
+
### Wiring it up
|
|
149
|
+
|
|
150
|
+
The canonical nesting a host provides (the order proven by the `consumer/index.tsx` reintegration
|
|
151
|
+
fixture) — supply only the seams you use; each has a safe default:
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
<BrandColorContext.Provider value={brandColor}>
|
|
155
|
+
<DesignerModeContext.Provider value={false}>
|
|
156
|
+
<BlockEditorApiProvider value={hostDataHooks}> {/* image/video/widget + upload hooks */}
|
|
157
|
+
<RichTextRendererContext.Provider value={renderHtml}>
|
|
158
|
+
<RichTextEditorContext.Provider value={HostRceEditor}>
|
|
159
|
+
<AIActionContext.Provider value={executeAiToolUse}> {/* presence enables block-level AI */}
|
|
160
|
+
<BlockTranslationsProvider value={resolvedStrings}>
|
|
161
|
+
{/* <Viewer />, <BlockContentEditor />, <PreviewArea /> … */}
|
|
162
|
+
</BlockTranslationsProvider>
|
|
163
|
+
</AIActionContext.Provider>
|
|
164
|
+
</RichTextEditorContext.Provider>
|
|
165
|
+
</RichTextRendererContext.Provider>
|
|
166
|
+
</BlockEditorApiProvider>
|
|
167
|
+
</DesignerModeContext.Provider>
|
|
168
|
+
</BrandColorContext.Provider>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Reintegration gate
|
|
172
|
+
|
|
173
|
+
The public surface is the contract a host compiles against. `pnpm check:consumer` builds `dist/` and
|
|
174
|
+
type-checks the `consumer/` fixture against it, catching any exported inferred type that can't be
|
|
175
|
+
named across the `exports` map (TS2742) — which the package's own `type-check` never sees. Add
|
|
176
|
+
newly-exported symbols to `consumer/index.tsx`.
|
|
177
|
+
|
|
178
|
+
## Development
|
|
179
|
+
|
|
180
|
+
```sh
|
|
181
|
+
pnpm --filter @instructure/platform-block-content-editor test # vitest run
|
|
182
|
+
pnpm --filter @instructure/platform-block-content-editor type-check # tsc -p tsconfig.check.json
|
|
183
|
+
pnpm --filter @instructure/platform-block-content-editor build # vite build (+ .d.ts emit)
|
|
184
|
+
pnpm --filter @instructure/platform-block-content-editor check:consumer # the reintegration gate
|
|
185
|
+
pnpm storybook # 21 stories: every block + the editor
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Cross-package types resolve through built `dist/`, so run `pnpm build` once after a clone/pull
|
|
189
|
+
before `type-check`/`test` (see the gotchas in `CLAUDE.md`). Storybook needs Node ≥ 22.12.
|
|
190
|
+
|
|
191
|
+
## Documentation
|
|
192
|
+
|
|
193
|
+
- **This README** — how to consume the package.
|
|
194
|
+
- **`CLAUDE.md`** — what is true in `src/` right now: the read/write paths, the seams, the
|
|
195
|
+
non-negotiable invariants, and the build gotchas.
|
|
196
|
+
- **`bce-block-authoring` skill** (`.claude/skills/`) — the conventions for creating or modifying a
|
|
197
|
+
block (styling, accessibility, the schema toolkit, per-block translations), loaded on demand.
|
|
198
|
+
- **`docs/adr/`** (repo root) — architecture decision records; append-only.
|
|
199
|
+
- **In-file comments** — reasoning local to one file, especially the block barrels and `src/schema/`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/blocks/LayoutContainer/LayoutContainer.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAExE,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EAMR,kBAA6B,EAC7B,gBAA2B,EAC3B,MAAM,EACN,eAAwB,EACxB,UAAU,EACV,OAAO,EACP,UAAU,EACV,OAAO,EACP,KAAK,GACN,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"LayoutContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/blocks/LayoutContainer/LayoutContainer.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAExE,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EAMR,kBAA6B,EAC7B,gBAA2B,EAC3B,MAAM,EACN,eAAwB,EACxB,UAAU,EACV,OAAO,EACP,UAAU,EACV,OAAO,EACP,KAAK,GACN,EAAE,oBAAoB,kDAwDtB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** The tool invocation the block-level AI affordances send to the host executor. */
|
|
2
|
+
export interface AIToolUse {
|
|
3
|
+
toolUseId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
input: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
/** One JSON content block of a tool result. */
|
|
8
|
+
export interface AIToolResultJsonContent {
|
|
9
|
+
json: {
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/** One text content block of a tool result. */
|
|
14
|
+
export interface AIToolResultTextContent {
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
/** The result the host's executor resolves with. */
|
|
18
|
+
export interface AIToolResult {
|
|
19
|
+
toolUseId: string;
|
|
20
|
+
content: AIToolResultJsonContent[] | AIToolResultTextContent[];
|
|
21
|
+
status: 'success' | 'error' | 'aborted';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The host's AI executor. The host closes over its own invocation context (Canvas course id,
|
|
25
|
+
* chat context, the ignite client) inside this function, so the package never sees them — it
|
|
26
|
+
* only sends a `toolUse` and reads back a `ToolResult`. `signal` is preserved so the block AI
|
|
27
|
+
* menu's Stop button can abort an in-flight request.
|
|
28
|
+
*/
|
|
29
|
+
export type AIAction = (toolUse: AIToolUse, signal?: AbortSignal) => Promise<AIToolResult>;
|
|
30
|
+
/**
|
|
31
|
+
* The host's AI executor, or `undefined` when none is provided — in which case every block-level
|
|
32
|
+
* AI affordance (the per-block AI menu, the "Generate alt text" button) renders nothing. This is
|
|
33
|
+
* the renderer-seam twin of `RichTextRendererContext`, and it replaces the source's `isAiEnabled`
|
|
34
|
+
* gate: presence of the seam *is* the enablement.
|
|
35
|
+
*/
|
|
36
|
+
export declare const AIActionContext: import('react').Context<AIAction | undefined>;
|
|
37
|
+
export declare const useAIAction: () => AIAction | undefined;
|
|
38
|
+
//# sourceMappingURL=AIActionContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AIActionContext.d.ts","sourceRoot":"","sources":["../../src/contexts/AIActionContext.tsx"],"names":[],"mappings":"AAoBA,oFAAoF;AACpF,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B;AAED,+CAA+C;AAC/C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;CACjC;AAED,+CAA+C;AAC/C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAA;CACb;AAED,oDAAoD;AACpD,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,uBAAuB,EAAE,GAAG,uBAAuB,EAAE,CAAA;IAC9D,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;CACxC;AAED;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;AAE1F;;;;;GAKG;AACH,eAAO,MAAM,eAAe,+CAAiD,CAAA;AAE7E,eAAO,MAAM,WAAW,QAAO,QAAQ,GAAG,SAAwC,CAAA"}
|
|
@@ -69,6 +69,68 @@ export type UseVideoUrl = (assetId: string) => ResolvedVideo;
|
|
|
69
69
|
* not an invalid value.
|
|
70
70
|
*/
|
|
71
71
|
export type UseWidget = (widgetType: string) => ResolvedWidget;
|
|
72
|
+
/**
|
|
73
|
+
* A resolved uploaded file, as the settings-form uploaders need it for their *preview*
|
|
74
|
+
* (not the block's rendered/embed URL — that's `useImageUrl`/`useVideoUrl`). `url` is the
|
|
75
|
+
* displayable file URL; `displayName` labels the preview. For a video still processing,
|
|
76
|
+
* `mediaEntryId` may be absent and `isProcessing` true. `undefined`/false flags with a
|
|
77
|
+
* populated `url` means "ready".
|
|
78
|
+
*/
|
|
79
|
+
export interface ResolvedUploadedFile {
|
|
80
|
+
url?: string;
|
|
81
|
+
displayName?: string;
|
|
82
|
+
mediaEntryId?: string;
|
|
83
|
+
isLoading: boolean;
|
|
84
|
+
isProcessing?: boolean;
|
|
85
|
+
isError: boolean;
|
|
86
|
+
}
|
|
87
|
+
/** Resolve an `asset_id` to its uploaded-file preview data. `''` = nothing to resolve. */
|
|
88
|
+
export type UseUploadedFile = (assetId: string) => ResolvedUploadedFile;
|
|
89
|
+
/** Arguments the uploader hands the host's create-file mutation. */
|
|
90
|
+
export interface CreateFileArgs {
|
|
91
|
+
file: File;
|
|
92
|
+
displayName?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The host's file-upload mutation. The package passes only `{ file, displayName }` and
|
|
96
|
+
* stores the returned `id` as the block's `asset_id`; all host scoping (course/account,
|
|
97
|
+
* folder resolution, entity type) lives inside the host's implementation. `upload` rejects
|
|
98
|
+
* on failure — the uploader catches and surfaces an error message.
|
|
99
|
+
*/
|
|
100
|
+
export interface CreateFileHandle {
|
|
101
|
+
upload: (args: CreateFileArgs) => Promise<{
|
|
102
|
+
id: string;
|
|
103
|
+
}>;
|
|
104
|
+
isUploading: boolean;
|
|
105
|
+
error?: unknown;
|
|
106
|
+
}
|
|
107
|
+
export type UseCreateFile = () => CreateFileHandle;
|
|
108
|
+
/** Arguments the host's delete-file mutation takes — a single stored asset id. */
|
|
109
|
+
export interface DeleteFileArgs {
|
|
110
|
+
fileId: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The host's file-delete mutation, for cleaning up an asset a block no longer references.
|
|
114
|
+
* Unprovided, deletion is a silent no-op (cleanup is best-effort), rather than an error.
|
|
115
|
+
*/
|
|
116
|
+
export interface DeleteFileHandle {
|
|
117
|
+
deleteFile: (args: DeleteFileArgs) => Promise<void>;
|
|
118
|
+
}
|
|
119
|
+
export type UseDeleteFile = () => DeleteFileHandle;
|
|
120
|
+
/** Arguments the host's asset-bytes fetch takes — a single stored asset id. */
|
|
121
|
+
export interface FetchAssetArgs {
|
|
122
|
+
assetId: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The host's asset-bytes fetch: reads a stored `asset_id` back to a `Blob` on the host's own
|
|
126
|
+
* transport (credentials/CSRF/telemetry), so the package never fetches host content directly. The
|
|
127
|
+
* alt-text generator uses it to obtain the image bytes it sends to the AI. `fetchAsset` rejects on
|
|
128
|
+
* failure — the caller catches and surfaces an error message.
|
|
129
|
+
*/
|
|
130
|
+
export interface FetchAssetHandle {
|
|
131
|
+
fetchAsset: (args: FetchAssetArgs) => Promise<Blob>;
|
|
132
|
+
}
|
|
133
|
+
export type UseFetchAsset = () => FetchAssetHandle;
|
|
72
134
|
/**
|
|
73
135
|
* The host-injected data hooks the blocks call to resolve an opaque `asset_id`
|
|
74
136
|
* to the URL they render. The host owns the fetch (e.g. Canvas Files API via
|
|
@@ -108,6 +170,14 @@ export interface BlockEditorApi {
|
|
|
108
170
|
useImageUrl?: UseImageUrl;
|
|
109
171
|
useVideoUrl?: UseVideoUrl;
|
|
110
172
|
useWidget?: UseWidget;
|
|
173
|
+
/** Resolve a stored `asset_id` to preview data for the settings-form uploaders. */
|
|
174
|
+
useUploadedFile?: UseUploadedFile;
|
|
175
|
+
/** The host's file-upload mutation, driving the settings-form uploaders. */
|
|
176
|
+
useCreateFile?: UseCreateFile;
|
|
177
|
+
/** The host's file-delete mutation, for cleaning up orphaned uploads. */
|
|
178
|
+
useDeleteFile?: UseDeleteFile;
|
|
179
|
+
/** The host's asset-bytes fetch, reading a stored `asset_id` to a `Blob` for the alt-text AI. */
|
|
180
|
+
useFetchAsset?: UseFetchAsset;
|
|
111
181
|
}
|
|
112
182
|
export declare const BlockEditorApiContext: import('react').Context<BlockEditorApi>;
|
|
113
183
|
export declare const BlockEditorApiProvider: import('react').Provider<BlockEditorApi>;
|
|
@@ -117,4 +187,12 @@ export declare const useImageUrl: (assetId: string) => ResolvedImage;
|
|
|
117
187
|
export declare const useVideoUrl: (assetId: string) => ResolvedVideo;
|
|
118
188
|
/** Resolve a widget identifier to the host's component via the `useWidget` hook. */
|
|
119
189
|
export declare const useWidget: (widgetType: string) => ResolvedWidget;
|
|
190
|
+
/** Resolve an uploaded file's preview data via the host-provided `useUploadedFile` hook. */
|
|
191
|
+
export declare const useUploadedFile: (assetId: string) => ResolvedUploadedFile;
|
|
192
|
+
/** Obtain the host's file-upload mutation via the `useCreateFile` hook. */
|
|
193
|
+
export declare const useCreateFile: () => CreateFileHandle;
|
|
194
|
+
/** Obtain the host's file-delete mutation via the `useDeleteFile` hook. */
|
|
195
|
+
export declare const useDeleteFile: () => DeleteFileHandle;
|
|
196
|
+
/** Obtain the host's asset-bytes fetch via the `useFetchAsset` hook. */
|
|
197
|
+
export declare const useFetchAsset: () => FetchAssetHandle;
|
|
120
198
|
//# sourceMappingURL=BlockEditorApiContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockEditorApiContext.d.ts","sourceRoot":"","sources":["../../src/contexts/BlockEditorApiContext.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,aAAa,EAA6B,MAAM,OAAO,CAAA;AAErE;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAA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AAE,aAAa,CAAA;CAC9B;AAmBD,eAAO,MAAM,qBAAqB,yCAAoC,CAAA;AAEtE,eAAO,MAAM,sBAAsB,0CAAiC,CAAA;AAEpE,0EAA0E;AAC1E,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,aAG7C,CAAA;AAED,yEAAyE;AACzE,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,aAG7C,CAAA;AAED,oFAAoF;AACpF,eAAO,MAAM,SAAS,GAAI,YAAY,MAAM,KAAG,cAG9C,CAAA;AAED,4FAA4F;AAC5F,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,KAAG,oBAGjD,CAAA;AAED,2EAA2E;AAC3E,eAAO,MAAM,aAAa,QAAO,gBAGhC,CAAA;AAED,2EAA2E;AAC3E,eAAO,MAAM,aAAa,QAAO,gBAGhC,CAAA;AAED,wEAAwE;AACxE,eAAO,MAAM,aAAa,QAAO,gBAGhC,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The props the settings form hands a host-injected rich-text *editor* — the write-path
|
|
4
|
+
* twin of `RichTextRendererContext`'s read-path renderer. The contract is deliberately
|
|
5
|
+
* host-agnostic: host-specific wiring (Canvas course/context, RCE plugin config, JWT) is
|
|
6
|
+
* closed over by the host inside its own component, never passed across this seam.
|
|
7
|
+
*/
|
|
8
|
+
export interface RichTextEditorProps {
|
|
9
|
+
/** Current HTML value. */
|
|
10
|
+
value: string;
|
|
11
|
+
/** Called with the new HTML whenever the editor's content changes. */
|
|
12
|
+
onChange: (html: string) => void;
|
|
13
|
+
/** Accessible label for the editor's textarea. */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Stable id for the editor's textarea, derived from the field name. */
|
|
16
|
+
id: string;
|
|
17
|
+
/** Optional editor height (CSS length), e.g. `"400px"`. */
|
|
18
|
+
height?: string;
|
|
19
|
+
}
|
|
20
|
+
export type RichTextEditorComponent = ComponentType<RichTextEditorProps>;
|
|
21
|
+
/**
|
|
22
|
+
* The host's rich-text editor, or `undefined` when none is provided — in which case the
|
|
23
|
+
* settings form falls back to a plain `TextArea`. A host (e.g. Canvas) injects its own RCE
|
|
24
|
+
* here; stories, tests and hosts without an editor leave it `undefined`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const RichTextEditorContext: import('react').Context<RichTextEditorComponent | undefined>;
|
|
27
|
+
export declare const useRichTextEditor: () => RichTextEditorComponent | undefined;
|
|
28
|
+
//# sourceMappingURL=RichTextEditorContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RichTextEditorContext.d.ts","sourceRoot":"","sources":["../../src/contexts/RichTextEditorContext.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,aAAa,EAA6B,MAAM,OAAO,CAAA;AAErE;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,sEAAsE;IACtE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAA;IACb,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAA;IACV,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,uBAAuB,GAAG,aAAa,CAAC,mBAAmB,CAAC,CAAA;AAExE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,8DAAgE,CAAA;AAElG,eAAO,MAAM,iBAAiB,QAAO,uBAAuB,GAAG,SAC5B,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BlockRegistry } from '../registry';
|
|
2
|
+
import { Tool } from './sidebar/panel/types';
|
|
3
|
+
import { UseBlockEditorStateReturn } from './state/useBlockEditorState';
|
|
4
|
+
/** 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 type BuiltInToolId = (typeof BUILT_IN_TOOL_IDS)[number];
|
|
7
|
+
export interface BlockContentEditorProps<HostToolId extends string = never> {
|
|
8
|
+
/** The host-owned editor state (from `useBlockEditorState`). The host keeps save / undo /
|
|
9
|
+
* dirty / DB↔package conversion; this component only composes the authoring UI over it. */
|
|
10
|
+
engine: UseBlockEditorStateReturn;
|
|
11
|
+
/** The registry the document's blocks resolve against (same one passed to `useBlockEditorState`). */
|
|
12
|
+
registry: BlockRegistry;
|
|
13
|
+
/** 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
|
|
16
|
+
* lower `priority` renders before them (e.g. an Assistant docked at the top of the rail).
|
|
17
|
+
* Block-level AI is gated on the `AIAction` seam, not on a tool. */
|
|
18
|
+
tools?: Tool<HostToolId>[];
|
|
19
|
+
/** Which built-in trays to render, as a subset of `BUILT_IN_TOOL_IDS`; defaults to all four.
|
|
20
|
+
* Rendered in the canonical order regardless of the order given (e.g. a dashboard passes
|
|
21
|
+
* `['components', 'layout']`). */
|
|
22
|
+
builtInToolIds?: BuiltInToolId[];
|
|
23
|
+
/** The tool open on first render. Defaults to the first rendered built-in tray (`components`
|
|
24
|
+
* unless excluded), then the first host tool. */
|
|
25
|
+
initialToolId?: BuiltInToolId | HostToolId;
|
|
26
|
+
/** Panel height; forwarded to `DesignerSideBar` (defaults to `100%`). */
|
|
27
|
+
height?: number | string;
|
|
28
|
+
/** Shows the sidebar's rail collapse/expand toggle once a tool has been opened. */
|
|
29
|
+
hasExpandPanelButton?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The authoring editor: the tool-panel sidebar over the drag-and-drop canvas, wired to the
|
|
33
|
+
* host's state engine. It is one convenient composition of the package's primitives — a host
|
|
34
|
+
* that needs a different arrangement (the sidebar in a modal, a custom layout) composes
|
|
35
|
+
* `GridDndProvider` + `DesignerSideBar` + `DesignerCanvas` itself; nothing here is required.
|
|
36
|
+
*
|
|
37
|
+
* It holds only the panel's view/tool UI state; the document, selection, and history live in
|
|
38
|
+
* the `engine` the host owns. One shared `GridDndProvider` wraps both surfaces so tray drag
|
|
39
|
+
* sources reach the canvas droppables. It is authoring-only — the student preview
|
|
40
|
+
* (`PreviewArea`) is a separate export the host presents however it wants.
|
|
41
|
+
*/
|
|
42
|
+
export declare function BlockContentEditor<HostToolId extends string = never>({ engine, registry, tools: hostTools, builtInToolIds, initialToolId, height, hasExpandPanelButton, }: BlockContentEditorProps<HostToolId>): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
//# sourceMappingURL=BlockContentEditor.d.ts.map
|
|
@@ -0,0 +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;CAC/B;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,GACrB,EAAE,uBAAuB,CAAC,UAAU,CAAC,2CA8NrC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BlockRegistry } from '../../registry';
|
|
2
|
+
export interface BlockAIMenuProps {
|
|
3
|
+
componentType: string;
|
|
4
|
+
componentData: Record<string, unknown>;
|
|
5
|
+
/** Component instance ID, used to pick the edited entry from the AI's response. */
|
|
6
|
+
componentId?: string;
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
onOpen: () => void;
|
|
9
|
+
onApply: (newProps: Record<string, unknown>) => void;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
/** Composed by the host — needed to render the before/after preview and to resolve the block. */
|
|
12
|
+
componentRegistry: BlockRegistry;
|
|
13
|
+
/** Fires when the menu popover OR the preview modal is open, so the canvas can hold selection. */
|
|
14
|
+
onActiveChange?: (active: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const BlockAIMenu: ({ componentType, componentData, componentId, isOpen, onOpen, onApply, onClose, componentRegistry, onActiveChange, }: BlockAIMenuProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
//# sourceMappingURL=BlockAIMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockAIMenu.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/BlockAIMenu.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,aAAa,EAA4B,MAAM,gBAAgB,CAAA;AAQ7E,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACtC,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IACpD,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,iGAAiG;IACjG,iBAAiB,EAAE,aAAa,CAAA;IAChC,kGAAkG;IAClG,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;CAC3C;AAED,eAAO,MAAM,WAAW,GAAI,qHAUzB,gBAAgB,mDAkIlB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type MenuView = 'root' | 'prompt' | 'change-tone' | 'change-length' | 'change-reading-level';
|
|
2
|
+
export interface BlockAIMenuContentProps {
|
|
3
|
+
view: MenuView;
|
|
4
|
+
onSetView: (view: MenuView) => void;
|
|
5
|
+
onQuickAction: (instruction: string) => void;
|
|
6
|
+
activeInstruction?: string | null;
|
|
7
|
+
prompt: string;
|
|
8
|
+
onPromptChange: (value: string) => void;
|
|
9
|
+
isThinking: boolean;
|
|
10
|
+
error?: string | null;
|
|
11
|
+
previewFirst: boolean;
|
|
12
|
+
onPreviewFirstChange: (value: boolean) => void;
|
|
13
|
+
onSend: () => void;
|
|
14
|
+
onStop: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const BlockAIMenuContent: ({ view, onSetView, onQuickAction, activeInstruction, prompt, onPromptChange, isThinking, error, previewFirst, onPreviewFirstChange, onSend, onStop, }: BlockAIMenuContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=BlockAIMenuContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockAIMenuContent.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/BlockAIMenuContent.tsx"],"names":[],"mappings":"AAsCA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,aAAa,GAAG,eAAe,GAAG,sBAAsB,CAAA;AAkDnG,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;IACnC,aAAa,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAEjC,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,oBAAoB,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,uJAahC,uBAAuB,4CAyLzB,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BlockRegistry, LayoutNode, TemplateData, UnresolvedBlock } from '../../registry';
|
|
2
|
+
export interface PreviewBlockModalProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onReplace: () => void;
|
|
6
|
+
onRegenerate: (refinementText: string) => void;
|
|
7
|
+
isRegenerating?: boolean;
|
|
8
|
+
/** FOUND-62: the refinement/regenerate field is hidden by default. */
|
|
9
|
+
showRefinement?: boolean;
|
|
10
|
+
beforeLayout: LayoutNode[];
|
|
11
|
+
beforeData?: TemplateData;
|
|
12
|
+
afterLayout: LayoutNode[];
|
|
13
|
+
afterData?: TemplateData;
|
|
14
|
+
/** Composed by the host — same contract as `Viewer`; renders both diff panels. */
|
|
15
|
+
componentRegistry: BlockRegistry;
|
|
16
|
+
/** Forwarded to both `Viewer`s. */
|
|
17
|
+
onUnresolvedBlock?: (block: UnresolvedBlock) => void;
|
|
18
|
+
}
|
|
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.
|
|
27
|
+
*/
|
|
28
|
+
export declare const PreviewBlockModal: ({ open, onClose, onReplace, onRegenerate, isRegenerating, showRefinement, beforeLayout, beforeData, afterLayout, afterData, componentRegistry, onUnresolvedBlock, }: PreviewBlockModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
//# sourceMappingURL=PreviewBlockModal.d.ts.map
|
|
@@ -0,0 +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,4CA4KxB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The block-level AI menu's chrome CSS: the popover card, its interactive menu-item rows
|
|
3
|
+
* (hover/focus/disabled) and the free-text prompt row. None of it is expressible in InstUI
|
|
4
|
+
* props — it needs `:hover`/`:focus-visible`/`:disabled` states and a borderless input — so it
|
|
5
|
+
* is injected once as a global stylesheet keyed by stable class names, the same way the canvas
|
|
6
|
+
* and preview chrome are. The source's `theme.gradients.igniteAI` branding is neutralized to
|
|
7
|
+
* plain InstUI surface tokens; the AI accent lives in the colored AI icon on the trigger.
|
|
8
|
+
*/
|
|
9
|
+
export declare const AI_CLASS: {
|
|
10
|
+
readonly root: "bce-ai-menu-root";
|
|
11
|
+
readonly card: "bce-ai-menu-card";
|
|
12
|
+
readonly list: "bce-ai-menu-list";
|
|
13
|
+
readonly item: "bce-ai-menu-item";
|
|
14
|
+
readonly itemLabel: "bce-ai-menu-item-label";
|
|
15
|
+
readonly subHeader: "bce-ai-menu-subheader";
|
|
16
|
+
readonly input: "bce-ai-menu-input";
|
|
17
|
+
readonly footer: "bce-ai-menu-footer";
|
|
18
|
+
readonly thinkingBody: "bce-ai-menu-thinking";
|
|
19
|
+
readonly thinkingStatus: "bce-ai-menu-thinking-status";
|
|
20
|
+
};
|
|
21
|
+
/** Mounts the AI menu chrome stylesheet once, under the menu popover. */
|
|
22
|
+
export declare function AIMenuStyles(): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=aiMenuStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiMenuStyles.d.ts","sourceRoot":"","sources":["../../../src/editor/ai/aiMenuStyles.tsx"],"names":[],"mappings":"AAoBA;;;;;;;GAOG;AAEH,eAAO,MAAM,QAAQ;;;;;;;;;;;CAWX,CAAA;AAmBV,yEAAyE;AACzE,wBAAgB,YAAY,4CA+G3B"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strings the package owns for the block-level AI chrome — the per-block AI menu, the
|
|
3
|
+
* before/after preview, and the "Generate alt text" affordance. Consumed via
|
|
4
|
+
* `useBlockTranslations(DesignerAIEnglish)`, the same mechanism blocks use; there is
|
|
5
|
+
* deliberately no second translation context. The host overrides by placing a
|
|
6
|
+
* `BlockTranslationsProvider` above the editor; anything it omits falls back to the English
|
|
7
|
+
* below. Bundled English is intentionally product-neutral ("AI", not a brand name) — a host
|
|
8
|
+
* brands it through its own translations.
|
|
9
|
+
*
|
|
10
|
+
* Only the visible labels/chrome live here. The *instruction* strings the menu sends to the AI
|
|
11
|
+
* (e.g. "Make the tone more formal") are model prompts, not UI copy, so they stay as literals in
|
|
12
|
+
* `BlockAIMenuContent` and are not translated.
|
|
13
|
+
*/
|
|
14
|
+
export interface DesignerAITranslations {
|
|
15
|
+
/** Accessible label for the AI menu trigger on a block. `%{componentType}` is the block name. */
|
|
16
|
+
aiAssistFor: string;
|
|
17
|
+
/** Tooltip on the AI menu trigger. */
|
|
18
|
+
aiActions: string;
|
|
19
|
+
/** Back link from a submenu to the root menu. */
|
|
20
|
+
backToMenu: string;
|
|
21
|
+
/** Root action + prompt-view header: open a free-text regenerate prompt. */
|
|
22
|
+
regenerateWithPrompt: string;
|
|
23
|
+
/** Root action: open the tone submenu. */
|
|
24
|
+
changeTone: string;
|
|
25
|
+
/** Root action: open the length submenu. */
|
|
26
|
+
changeLength: string;
|
|
27
|
+
/** Root action: open the reading-level submenu. */
|
|
28
|
+
changeReadingLevel: string;
|
|
29
|
+
/** Tone submenu item labels. */
|
|
30
|
+
toneMoreFormal: string;
|
|
31
|
+
toneMoreFun: string;
|
|
32
|
+
toneMoreCasual: string;
|
|
33
|
+
toneMoreTechnical: string;
|
|
34
|
+
/** Length submenu item labels. */
|
|
35
|
+
lengthShorter: string;
|
|
36
|
+
lengthLonger: string;
|
|
37
|
+
/** Reading-level submenu item labels. */
|
|
38
|
+
readingBeginning: string;
|
|
39
|
+
readingNovice: string;
|
|
40
|
+
readingIntermediate: string;
|
|
41
|
+
readingAdvanced: string;
|
|
42
|
+
/** Prompt input label/placeholder. */
|
|
43
|
+
promptPlaceholder: string;
|
|
44
|
+
/** Toggle: show the before/after preview before applying. */
|
|
45
|
+
previewFirst: string;
|
|
46
|
+
/** Send the prompt. */
|
|
47
|
+
send: string;
|
|
48
|
+
/** In-flight status while the AI generates. */
|
|
49
|
+
thinking: string;
|
|
50
|
+
/** Stop an in-flight generation. */
|
|
51
|
+
stop: string;
|
|
52
|
+
/** Error shown in the AI menu when a generation fails or returns nothing usable. */
|
|
53
|
+
generationFailed: string;
|
|
54
|
+
/** Preview modal title. */
|
|
55
|
+
previewBlock: string;
|
|
56
|
+
/** Accessible group label for the Both/After/Before comparison switch. */
|
|
57
|
+
compareLabel: string;
|
|
58
|
+
/** Comparison switch options + panel headings. */
|
|
59
|
+
both: string;
|
|
60
|
+
before: string;
|
|
61
|
+
after: string;
|
|
62
|
+
/** Preview modal buttons. */
|
|
63
|
+
previewCancel: string;
|
|
64
|
+
acceptAndReplace: string;
|
|
65
|
+
/** Refinement field label/placeholder + its buttons (field hidden by default). */
|
|
66
|
+
refinementPlaceholder: string;
|
|
67
|
+
regenerate: string;
|
|
68
|
+
regenerating: string;
|
|
69
|
+
/** "Generate alt text" affordance on the alt-text field. */
|
|
70
|
+
generateAltText: string;
|
|
71
|
+
generating: string;
|
|
72
|
+
/** Errors surfaced by the alt-text affordance. */
|
|
73
|
+
failedToLoadImage: string;
|
|
74
|
+
failedToGenerate: string;
|
|
75
|
+
noDescription: string;
|
|
76
|
+
}
|
|
77
|
+
/** English bundled with this package — also the source for `locales/en.json`. */
|
|
78
|
+
export declare const DesignerAIEnglish: DesignerAITranslations;
|
|
79
|
+
//# sourceMappingURL=aiTranslations.d.ts.map
|
|
@@ -0,0 +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,oBAAoB,EAAE,MAAM,CAAA;IAC5B,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,E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