@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
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strings the package owns for the designer chrome — the drag-and-drop canvas that is
|
|
3
|
+
* not part of any one block. Consumed via `useBlockTranslations(DesignerChromeEnglish)`,
|
|
4
|
+
* the same mechanism blocks use; there is deliberately no second translation context.
|
|
5
|
+
* The host overrides by placing a `BlockTranslationsProvider` above the designer;
|
|
6
|
+
* anything it omits falls back to the English below.
|
|
7
|
+
*
|
|
8
|
+
* `%{name}` markers are interpolated by `translate('<key>', { … })`.
|
|
9
|
+
*/
|
|
10
|
+
export interface DesignerChromeTranslations {
|
|
11
|
+
/** Fallback name for a block whose type has no registered label, in a11y announcements. */
|
|
12
|
+
item: string;
|
|
13
|
+
/** Screen-reader announcement when a component is picked up for keyboard drag. */
|
|
14
|
+
pickedUp: string;
|
|
15
|
+
/** Screen-reader announcement while dragging over nothing droppable. */
|
|
16
|
+
notOverDropArea: string;
|
|
17
|
+
/** Lowercase column name, interpolated mid-sentence into a drag announcement. */
|
|
18
|
+
leftColumn: string;
|
|
19
|
+
/** Lowercase column name, interpolated mid-sentence into a drag announcement. */
|
|
20
|
+
rightColumn: string;
|
|
21
|
+
/** Screen-reader announcement while dragging over a TwoColumn column. */
|
|
22
|
+
isOverColumn: string;
|
|
23
|
+
/** Screen-reader announcement while dragging over another block. */
|
|
24
|
+
isOver: string;
|
|
25
|
+
/** Screen-reader announcement when a component is dropped. */
|
|
26
|
+
wasDropped: string;
|
|
27
|
+
/** Screen-reader announcement when a component is dropped into a TwoColumn column. */
|
|
28
|
+
wasDroppedIntoColumn: string;
|
|
29
|
+
/** Screen-reader announcement when a keyboard drag is cancelled. */
|
|
30
|
+
dragCancelled: string;
|
|
31
|
+
/** Screen-reader instructions attached to every draggable component. */
|
|
32
|
+
dragInstructions: string;
|
|
33
|
+
/** Toolbar `aria-label` for a component's floating action bar. */
|
|
34
|
+
componentActions: string;
|
|
35
|
+
/** Drag-handle screen-reader label. */
|
|
36
|
+
dragToReorder: string;
|
|
37
|
+
/** Drag-handle tooltip. */
|
|
38
|
+
dragAndDrop: string;
|
|
39
|
+
/** Duplicate button screen-reader label. */
|
|
40
|
+
duplicateComponent: string;
|
|
41
|
+
/** Duplicate button tooltip. */
|
|
42
|
+
duplicate: string;
|
|
43
|
+
/** Delete button screen-reader label. */
|
|
44
|
+
deleteComponent: string;
|
|
45
|
+
/** Delete button tooltip and confirm action. */
|
|
46
|
+
delete: string;
|
|
47
|
+
/** Delete confirmation prompt. */
|
|
48
|
+
deleteConfirmation: string;
|
|
49
|
+
/** Cancel button in the delete confirmation. */
|
|
50
|
+
cancel: string;
|
|
51
|
+
/** Component overlay `aria-label` opening the settings for a block. */
|
|
52
|
+
editComponent: string;
|
|
53
|
+
/** `aria-label` for the group wrapping a block on the canvas. */
|
|
54
|
+
componentGroup: string;
|
|
55
|
+
/** `aria-label` for the left drop zone of a TwoColumn block. */
|
|
56
|
+
leftColumnLabel: string;
|
|
57
|
+
/** `aria-label` for the right drop zone of a TwoColumn block. */
|
|
58
|
+
rightColumnLabel: string;
|
|
59
|
+
/** Empty-column placeholder in a TwoColumn block. */
|
|
60
|
+
dropBlocksHere: string;
|
|
61
|
+
}
|
|
62
|
+
/** English bundled with this package — also the source for `locales/en.json`. */
|
|
63
|
+
export declare const DesignerChromeEnglish: DesignerChromeTranslations;
|
|
64
|
+
//# sourceMappingURL=canvasTranslations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvasTranslations.d.ts","sourceRoot":"","sources":["../../../src/editor/canvas/canvasTranslations.ts"],"names":[],"mappings":"AAkBA;;;;;;;;GAQG;AACH,M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0,0 +1,5 @@
|
|
|
1
|
+
export { DesignerArea, type DesignerAreaProps } from './DesignerArea';
|
|
2
|
+
export { DesignerCanvas, type DesignerCanvasProps } from './DesignerCanvas';
|
|
3
|
+
export { GridDndProvider, type GridDndProviderProps } from './GridDndProvider';
|
|
4
|
+
export { type DesignerChromeTranslations, DesignerChromeEnglish, } from './canvasTranslations';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/canvas/index.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC3E,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAC9E,OAAO,EACL,KAAK,0BAA0B,EAC/B,qBAAqB,GACtB,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Grid layout dimensions. */
|
|
2
|
+
export declare const GRID_COLUMNS = 15;
|
|
3
|
+
export declare const GRID_ROWS = 100;
|
|
4
|
+
/**
|
|
5
|
+
* Grid cell sizing. Fixed values rather than dynamic calculations, because inline
|
|
6
|
+
* CSS works better with explicit pixel values.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CELL_SIZE = 67;
|
|
9
|
+
export declare const GAP_SIZE = 16;
|
|
10
|
+
/** Default page width for the designer canvas (matches the 1280px content width). */
|
|
11
|
+
export declare const DEFAULT_PAGE_WIDTH = 1280;
|
|
12
|
+
/**
|
|
13
|
+
* Height constraint for interactive/activity components, which otherwise default to
|
|
14
|
+
* spanning the full grid.
|
|
15
|
+
*/
|
|
16
|
+
export declare const INTERACTABLE_COMPONENT_HEIGHT: number;
|
|
17
|
+
/** Minimum component dimensions. */
|
|
18
|
+
export declare const MIN_COMPONENT_COLSPAN = 1;
|
|
19
|
+
export declare const MIN_COMPONENT_ROWSPAN = 1;
|
|
20
|
+
/** Default component dimensions for newly added components. */
|
|
21
|
+
export declare const DEFAULT_COMPONENT_COLSPAN = 15;
|
|
22
|
+
export declare const DEFAULT_COMPONENT_ROWSPAN = 5;
|
|
23
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/editor/document/constants.ts"],"names":[],"mappings":"AAkBA,8BAA8B;AAC9B,eAAO,MAAM,YAAY,KAAK,CAAA;AAC9B,eAAO,MAAM,SAAS,MAAM,CAAA;AAE5B;;;GAGG;AACH,eAAO,MAAM,SAAS,KAAK,CAAA;AAC3B,eAAO,MAAM,QAAQ,KAAK,CAAA;AAE1B,qFAAqF;AACrF,eAAO,MAAM,kBAAkB,OAAO,CAAA;AAEtC;;;GAGG;AACH,eAAO,MAAM,6BAA6B,QAAiB,CAAA;AAE3D,oCAAoC;AACpC,eAAO,MAAM,qBAAqB,IAAI,CAAA;AACtC,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAC3C,eAAO,MAAM,yBAAyB,IAAI,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The toolbar actions a designer item can expose. A caller hides a subset per block
|
|
3
|
+
* via `hiddenActions` — e.g. a pre-built data-driven widget shows only Move and Delete.
|
|
4
|
+
*
|
|
5
|
+
* Lives in the document model rather than the canvas chrome because the host's
|
|
6
|
+
* per-block configuration (which actions to hide) is expressed against these values.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DesignerItemAction: {
|
|
9
|
+
readonly Move: "move";
|
|
10
|
+
readonly Edit: "edit";
|
|
11
|
+
readonly Ai: "ai";
|
|
12
|
+
readonly Duplicate: "duplicate";
|
|
13
|
+
readonly Delete: "delete";
|
|
14
|
+
};
|
|
15
|
+
export type DesignerItemAction = (typeof DesignerItemAction)[keyof typeof DesignerItemAction];
|
|
16
|
+
//# sourceMappingURL=designerItemAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"designerItemAction.d.ts","sourceRoot":"","sources":["../../../src/editor/document/designerItemAction.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAA"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { LayoutNode, TemplateData } from '../../registry';
|
|
2
|
+
/**
|
|
3
|
+
* The tree helpers are generic over `<T extends LayoutNode>` so a host's registry-typed
|
|
4
|
+
* layout flows through a call and back out unchanged. `LayoutNode.props` is `object`, so the
|
|
5
|
+
* grid-positioning fields are read through a cast to `GridPositionProps`, the same way the
|
|
6
|
+
* read-path renderer does.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Vertical gap (px) between stacked blocks in the canvas — shared by the sorting strategies
|
|
10
|
+
* and the tray-insert placeholder box so they stay visually consistent.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ITEM_GAP = 16;
|
|
13
|
+
/**
|
|
14
|
+
* Parse a ToolPanel item-edit view string like "item-tabs-2" into its field name and
|
|
15
|
+
* zero-based index. Returns null for any other view shape.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseItemEditView(view: string): {
|
|
18
|
+
fieldName: string;
|
|
19
|
+
index: number;
|
|
20
|
+
} | null;
|
|
21
|
+
/**
|
|
22
|
+
* Item count at which an opted-in array-of-objects field (via `.zodManageLayer()`) collapses
|
|
23
|
+
* its inline list into a "Manage" sub-panel.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MANAGE_LAYER_THRESHOLD = 5;
|
|
26
|
+
/**
|
|
27
|
+
* Parse a ToolPanel manage-layer view string like "manage-items" into its field name.
|
|
28
|
+
* Returns null for any other view shape.
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseManageView(view: string): {
|
|
31
|
+
fieldName: string;
|
|
32
|
+
} | null;
|
|
33
|
+
/**
|
|
34
|
+
* Adjust column and row spans to fit within grid boundaries. Handles components that extend
|
|
35
|
+
* beyond grid dimensions, and applies the height constraint for interactive components.
|
|
36
|
+
*/
|
|
37
|
+
export declare function adjustSpan(column: number, row: number, width: number | undefined, height: number | undefined, rowSpan: number): {
|
|
38
|
+
colSpan: number;
|
|
39
|
+
rowSpan: number;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Find the maximum occupied row by examining `gridRow + rowSpan` for all nodes recursively.
|
|
43
|
+
* Used to determine where to place new components.
|
|
44
|
+
*/
|
|
45
|
+
export declare function findMaxOccupiedRow(layout: LayoutNode[]): number;
|
|
46
|
+
/** Get template data for a component by id. */
|
|
47
|
+
export declare function getTemplateDataById(templateData: TemplateData, id: string): object | undefined;
|
|
48
|
+
/** Update template data for a specific component (immutable). */
|
|
49
|
+
export declare function updateTemplateDataById(templateData: TemplateData, id: string, newData: object): TemplateData;
|
|
50
|
+
/** Remove template data for a specific component (immutable). */
|
|
51
|
+
export declare function removeTemplateDataById(templateData: TemplateData, id: string): TemplateData;
|
|
52
|
+
/**
|
|
53
|
+
* Recursively collect all node ids from a node and its descendants. Used when deleting a
|
|
54
|
+
* container to also remove template data for all children.
|
|
55
|
+
*/
|
|
56
|
+
export declare function collectAllNodeIds(node: LayoutNode): string[];
|
|
57
|
+
/**
|
|
58
|
+
* A path to a node in the layout tree. Each element is either a numeric index or the string
|
|
59
|
+
* "children" — e.g. `[0, "children", 1]` means `layout[0].children[1]`.
|
|
60
|
+
*/
|
|
61
|
+
export type TreePath = (number | string)[];
|
|
62
|
+
/** Result of `findNodeById`. */
|
|
63
|
+
export interface FindNodeResult<T extends LayoutNode> {
|
|
64
|
+
node: T;
|
|
65
|
+
path: TreePath;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Where a dragged tray component should land in the layout tree. Resolved by the designer's
|
|
69
|
+
* drag handling and consumed by `useBlockEditorState`'s `addComponent`.
|
|
70
|
+
*/
|
|
71
|
+
export type TrayDropTarget = {
|
|
72
|
+
type: 'grid-cell';
|
|
73
|
+
column: number;
|
|
74
|
+
row: number;
|
|
75
|
+
} | {
|
|
76
|
+
type: 'twocol-column';
|
|
77
|
+
column: number;
|
|
78
|
+
parentId: string;
|
|
79
|
+
} | {
|
|
80
|
+
type: 'canvas-item';
|
|
81
|
+
parentPath: TreePath;
|
|
82
|
+
index: number;
|
|
83
|
+
column?: number;
|
|
84
|
+
};
|
|
85
|
+
/** Find a node by id in the layout tree, returning the node and its path, or null. */
|
|
86
|
+
export declare function findNodeById<T extends LayoutNode>(templateLayout: T[], id: string, currentPath?: TreePath): FindNodeResult<T> | null;
|
|
87
|
+
/** Get the node at a specific path in the tree. */
|
|
88
|
+
export declare function getNodeAtPath<T extends LayoutNode>(templateLayout: T[], path: TreePath): T | null;
|
|
89
|
+
/** Update a node at a specific path in the tree (immutable), merging the updates in. */
|
|
90
|
+
export declare function updateNodeAtPath<T extends LayoutNode>(templateLayout: T[], path: TreePath, updates: Partial<T>): T[];
|
|
91
|
+
/** Remove a node at a specific path in the tree (immutable). */
|
|
92
|
+
export declare function removeNodeAtPath<T extends LayoutNode>(templateLayout: T[], path: TreePath): T[];
|
|
93
|
+
/** Insert a node at a specific path and index (helper for `moveNodeInTree`). */
|
|
94
|
+
export declare function insertNodeAtPath<T extends LayoutNode>(templateLayout: T[], path: TreePath, index: number, node: T): T[];
|
|
95
|
+
/**
|
|
96
|
+
* Renumber all root-level grid-positioned nodes to match array order, resetting gridColumn to
|
|
97
|
+
* 0 for a single-column layout.
|
|
98
|
+
*/
|
|
99
|
+
export declare function renumberRootGridPositions<T extends LayoutNode>(layout: T[]): T[];
|
|
100
|
+
/**
|
|
101
|
+
* Move a node from one location to another in the tree (immutable).
|
|
102
|
+
*
|
|
103
|
+
* @param sourcePath - Path to the node to move
|
|
104
|
+
* @param targetParentPath - Path to the target parent (empty array for root)
|
|
105
|
+
* @param targetIndex - Index within the target parent
|
|
106
|
+
*/
|
|
107
|
+
export declare function moveNodeInTree<T extends LayoutNode>(templateLayout: T[], sourcePath: TreePath, targetParentPath: TreePath, targetIndex: number): T[];
|
|
108
|
+
/**
|
|
109
|
+
* Resolve where a new (not-yet-in-the-tree) item should be inserted when hovering over an
|
|
110
|
+
* existing sortable node during a drag. `insertAfter` is the caller's already-decided
|
|
111
|
+
* before/after choice; this only resolves the tree position for it. Works at any nesting depth
|
|
112
|
+
* since it derives from `findNodeById`'s full-tree search.
|
|
113
|
+
*/
|
|
114
|
+
export interface SortableInsertTarget {
|
|
115
|
+
parentPath: TreePath;
|
|
116
|
+
index: number;
|
|
117
|
+
gridColumn?: number;
|
|
118
|
+
}
|
|
119
|
+
export declare function resolveSortableInsertTarget<T extends LayoutNode>(templateLayout: T[], overId: string, insertAfter: boolean): SortableInsertTarget | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Shallow equality for TreePath arrays (e.g. comparing a resolved insert target's parentPath
|
|
122
|
+
* against the current recursion level's path).
|
|
123
|
+
*/
|
|
124
|
+
export declare function pathsEqual(a: TreePath, b: TreePath): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Map a flat index into a node's full `children` array (as resolved by
|
|
127
|
+
* `resolveSortableInsertTarget`, which doesn't know about column splitting) to a local index
|
|
128
|
+
* within one column's filtered sub-list — e.g. TwoColumn's left/right children.
|
|
129
|
+
*/
|
|
130
|
+
export declare function localInsertIndex(columnItems: {
|
|
131
|
+
index: number;
|
|
132
|
+
}[], flatIndex: number): number;
|
|
133
|
+
/**
|
|
134
|
+
* Find the real root-level block occupying a given grid position, if any. Used to double-check
|
|
135
|
+
* an empty-cell droppable's own occupancy classification before trusting it.
|
|
136
|
+
*/
|
|
137
|
+
export declare function findBlockAtGridPosition<T extends LayoutNode>(templateLayout: T[], row: number, column: number): T | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* The sorting strategy to use. Always "grid": the custom grid sorting strategy handles both
|
|
140
|
+
* single- and multi-column layouts, including vertical movement.
|
|
141
|
+
*/
|
|
142
|
+
export declare function getSortingStrategy(): 'grid';
|
|
143
|
+
export declare function sortByGridRow<T extends LayoutNode>(layout: T[]): T[];
|
|
144
|
+
export declare function normalizeGridPositions<T extends LayoutNode>(layout: T[]): T[];
|
|
145
|
+
/**
|
|
146
|
+
* Resolve grid position conflicts then sort nodes to match visual order. Normalization runs
|
|
147
|
+
* before sorting so the sort operates on clean, conflict-free gridRow values.
|
|
148
|
+
*/
|
|
149
|
+
export declare function reconcileGridLayout<T extends LayoutNode>(layout: T[]): T[];
|
|
150
|
+
/** Result of `cloneNodeWithNewIds`: the cloned node and an old-id → new-id mapping. */
|
|
151
|
+
export interface CloneResult<T extends LayoutNode> {
|
|
152
|
+
clonedNode: T;
|
|
153
|
+
idMapping: Map<string, string>;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Recursively clone a node and generate new unique ids for it and all its descendants.
|
|
157
|
+
*/
|
|
158
|
+
export declare function cloneNodeWithNewIds<T extends LayoutNode>(node: T): CloneResult<T>;
|
|
159
|
+
/**
|
|
160
|
+
* Clone template data entries for a node and all its descendants, using the id mapping from
|
|
161
|
+
* `cloneNodeWithNewIds`.
|
|
162
|
+
*/
|
|
163
|
+
export declare function cloneTemplateDataForNode(templateData: TemplateData, idMapping: Map<string, string>): TemplateData;
|
|
164
|
+
/**
|
|
165
|
+
* Insert a node after a specific node in the layout. Handles root-level and nested insertions.
|
|
166
|
+
* For root-level insertions, increments gridRow for the duplicate and all subsequent nodes.
|
|
167
|
+
*/
|
|
168
|
+
export declare function insertNodeAfter<T extends LayoutNode>(templateLayout: T[], targetPath: TreePath, nodeToInsert: T): {
|
|
169
|
+
layout: T[];
|
|
170
|
+
insertedPath: TreePath;
|
|
171
|
+
};
|
|
172
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/editor/document/utils.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAqB,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AASjF;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,QAAQ,KAAK,CAAA;AAE1B;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAI3F;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAA;AAEvC;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAI1E;AAMD;;;GAGG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,MAAM,GACd;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAiBtC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAsB/D;AAMD,+CAA+C;AAC/C,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE9F;AAED,iEAAiE;AACjE,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,GACd,YAAY,CAEd;AAED,iEAAiE;AACjE,wBAAgB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../../src/editor/document/utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LayoutNode, TemplateData } from '../../registry';
|
|
2
|
+
export interface ActivitySnapshot {
|
|
3
|
+
layout: LayoutNode[];
|
|
4
|
+
data: TemplateData;
|
|
5
|
+
}
|
|
6
|
+
export interface UndoRedoState<T> {
|
|
7
|
+
past: T[];
|
|
8
|
+
present: T;
|
|
9
|
+
future: T[];
|
|
10
|
+
}
|
|
11
|
+
export interface UndoRedoOptions {
|
|
12
|
+
limit?: number;
|
|
13
|
+
mergeWindowMs?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface UndoRedoManager<T> {
|
|
16
|
+
getState(): UndoRedoState<T>;
|
|
17
|
+
getPresent(): T;
|
|
18
|
+
push(state: T, mergeKey?: string): void;
|
|
19
|
+
undo(): T | undefined;
|
|
20
|
+
redo(): T | undefined;
|
|
21
|
+
canUndo(): boolean;
|
|
22
|
+
canRedo(): boolean;
|
|
23
|
+
clear(newPresent?: T): void;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/editor/history/types.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,UAAU,EAAE,CAAA;IACpB,IAAI,EAAE,YAAY,CAAA;CACnB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,IAAI,EAAE,CAAC,EAAE,CAAA;IACT,OAAO,EAAE,CAAC,CAAA;IACV,MAAM,EAAE,CAAC,EAAE,CAAA;CACZ;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,QAAQ,IAAI,aAAa,CAAC,CAAC,CAAC,CAAA;IAC5B,UAAU,IAAI,CAAC,CAAA;IACf,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvC,IAAI,IAAI,CAAC,GAAG,SAAS,CAAA;IACrB,IAAI,IAAI,CAAC,GAAG,SAAS,CAAA;IACrB,OAAO,IAAI,OAAO,CAAA;IAClB,OAAO,IAAI,OAAO,CAAA;IAClB,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,CAAA;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undoRedoManager.d.ts","sourceRoot":"","sources":["../../../src/editor/history/undoRedoManager.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAiB,MAAM,SAAS,CAAA;AAK9E,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,YAAY,EAAE,CAAC,EACf,OAAO,CAAC,EAAE,eAAe,GACxB,eAAe,CAAC,CAAC,CAAC,CAqFpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undoRedoManager.test.d.ts","sourceRoot":"","sources":["../../../src/editor/history/undoRedoManager.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActivitySnapshot, UndoRedoOptions } from './types';
|
|
2
|
+
export declare function useUndoRedo(initialState: ActivitySnapshot, options?: UndoRedoOptions): {
|
|
3
|
+
state: ActivitySnapshot;
|
|
4
|
+
canUndo: boolean;
|
|
5
|
+
canRedo: boolean;
|
|
6
|
+
pushState: (state: ActivitySnapshot, mergeKey?: string) => void;
|
|
7
|
+
undo: () => ActivitySnapshot | undefined;
|
|
8
|
+
redo: () => ActivitySnapshot | undefined;
|
|
9
|
+
clear: (newPresent?: ActivitySnapshot) => void;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useUndoRedo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUndoRedo.d.ts","sourceRoot":"","sources":["../../../src/editor/history/useUndoRedo.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAGhE,wBAAgB,WAAW,CAAC,YAAY,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,eAAe;;;;uBAMzE,gBAAgB,aAAa,MAAM;;;yBAoB7B,gBAAgB;EAgBjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUndoRedo.test.d.ts","sourceRoot":"","sources":["../../../src/editor/history/useUndoRedo.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { useBlockEditorState, type UseBlockEditorStateOptions, type UseBlockEditorStateReturn, type AddComponentResult, type DeleteComponentResult, type DuplicateComponentResult, } from './state/useBlockEditorState';
|
|
2
|
+
export { applyTemplatePatch, type TemplatePatch } from './state/applyTemplatePatch';
|
|
3
|
+
export type { ActivitySnapshot } from './history/types';
|
|
4
|
+
export type { TrayDropTarget, TreePath } from './document/utils';
|
|
5
|
+
export { DesignerItemAction } from './document/designerItemAction';
|
|
6
|
+
export { BlockContentEditor, type BlockContentEditorProps, BUILT_IN_TOOL_IDS, type BuiltInToolId, } from './BlockContentEditor';
|
|
7
|
+
export { DesignerArea, type DesignerAreaProps, DesignerCanvas, type DesignerCanvasProps, GridDndProvider, type GridDndProviderProps, DesignerChromeEnglish, type DesignerChromeTranslations, } from './canvas';
|
|
8
|
+
export * from './sidebar/panel';
|
|
9
|
+
export * from './sidebar/DesignerNav';
|
|
10
|
+
export { ComponentEditorForm, type ComponentEditorFormProps, DesignerFormEnglish, type DesignerFormTranslations, } from './sidebar/form';
|
|
11
|
+
export { BlockTray, type BlockTrayProps, ComponentsTray, LayoutTray, InteractiveTray, TemplatesPanel, SkipToSelectedComponentLink, getTrayBlockDefinitionsByCategory, type TrayBlockDefinition, } from './sidebar/tray';
|
|
12
|
+
export { useDesignerSelectionFocus, type DesignerSelectionFocusHandlers, } from './sidebar/useDesignerSelectionFocus';
|
|
13
|
+
export { DesignerSidebarEnglish, type DesignerSidebarTranslations, } from './sidebar/sidebarTranslations';
|
|
14
|
+
export * from './preview';
|
|
15
|
+
export { BlockAIMenu, type BlockAIMenuProps, PreviewBlockModal, type PreviewBlockModalProps, useGenerateAltText, type AIInlineTemplateContentPayload, DesignerAIEnglish, type DesignerAITranslations, } from './ai';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/editor/index.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,GAC9B,MAAM,6BAA6B,CAAA;AAGpC,OAAO,EAAE,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAEnF,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAGvD,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAGlE,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAA;AAI7B,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,cAAc,EACd,KAAK,mBAAmB,EACxB,eAAe,EACf,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,UAAU,CAAA;AAGjB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,SAAS,EACT,KAAK,cAAc,EACnB,cAAc,EACd,UAAU,EACV,eAAe,EACf,cAAc,EACd,2BAA2B,EAC3B,iCAAiC,EACjC,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,yBAAyB,EACzB,KAAK,8BAA8B,GACpC,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,sBAAsB,EACtB,KAAK,2BAA2B,GACjC,MAAM,+BAA+B,CAAA;AAGtC,cAAc,WAAW,CAAA;AAGzB,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,kBAAkB,EAClB,KAAK,8BAA8B,EACnC,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,MAAM,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BlockRegistry, LayoutNode, TemplateData, UnresolvedBlock } from '../../registry';
|
|
2
|
+
import { PreviewViewport } from './constants';
|
|
3
|
+
export interface PreviewAreaProps {
|
|
4
|
+
/** Structure: which block, where, and what nests inside what. */
|
|
5
|
+
templateLayout: LayoutNode[];
|
|
6
|
+
/** Content, keyed by node id. Overrides matching layout props. */
|
|
7
|
+
templateData?: TemplateData;
|
|
8
|
+
/** Composed by the host — see `create<Name>Block`. Same contract as `Viewer`. */
|
|
9
|
+
componentRegistry: BlockRegistry;
|
|
10
|
+
/** Shown as the page title above the rendered document. */
|
|
11
|
+
objectName?: string;
|
|
12
|
+
/** Which device width the frame simulates. Controlled — the host owns the switch UI that drives it. */
|
|
13
|
+
viewport: PreviewViewport;
|
|
14
|
+
/** Forwarded to the `Viewer` — one call per node the registry could not resolve. */
|
|
15
|
+
onUnresolvedBlock?: (block: UnresolvedBlock) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The learner-facing preview of an authored document: a shaded "student browser" frame around
|
|
19
|
+
* the read-path `Viewer`, resized to the `viewport` prop. It renders no switch of its own — the
|
|
20
|
+
* host decides how to offer Desktop/Mobile (or any other) selection and drives `viewport`
|
|
21
|
+
* accordingly. It is an inline area — how it is presented (modal, drawer, fullscreen, inline) and
|
|
22
|
+
* any surrounding chrome is the host's choice. Brand color, translations and host data hooks come
|
|
23
|
+
* from the host's own providers above it, exactly as for the `Viewer`; no `theme`/`isEditMode` is
|
|
24
|
+
* injected. The `Viewer` runs with designer mode off so blocks render their student — not
|
|
25
|
+
* authoring — state.
|
|
26
|
+
*/
|
|
27
|
+
export declare function PreviewArea({ templateLayout, templateData, componentRegistry, objectName, viewport, onUnresolvedBlock, }: PreviewAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=PreviewArea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewArea.d.ts","sourceRoot":"","sources":["../../../src/editor/preview/PreviewArea.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAE9F,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,aAAa,CAAA;AAGnE,MAAM,WAAW,gBAAgB;IAC/B,iEAAiE;IACjE,cAAc,EAAE,UAAU,EAAE,CAAA;IAC5B,kEAAkE;IAClE,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,iFAAiF;IACjF,iBAAiB,EAAE,aAAa,CAAA;IAChC,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uGAAuG;IACvG,QAAQ,EAAE,eAAe,CAAA;IACzB,oFAAoF;IACpF,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;CACrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,EAC1B,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,iBAAiB,GAClB,EAAE,gBAAgB,2CA2BlB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The two device widths the preview frame simulates. */
|
|
2
|
+
export declare const PREVIEW_VIEWPORTS: {
|
|
3
|
+
readonly DESKTOP: "desktop";
|
|
4
|
+
readonly MOBILE: "mobile";
|
|
5
|
+
};
|
|
6
|
+
export type PreviewViewport = (typeof PREVIEW_VIEWPORTS)[keyof typeof PREVIEW_VIEWPORTS];
|
|
7
|
+
/** Frame width per viewport — fed to the stylesheet as a custom property (see `PreviewArea`). */
|
|
8
|
+
export declare const VIEWPORT_WIDTHS: Record<PreviewViewport, string>;
|
|
9
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/editor/preview/constants.ts"],"names":[],"mappings":"AAkBA,yDAAyD;AACzD,eAAO,MAAM,iBAAiB;;;CAGpB,CAAA;AAEV,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA;AAExF,iGAAiG;AACjG,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAG3D,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/preview/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The student preview's chrome CSS: the outer column, the shaded "student browser" frame whose
|
|
3
|
+
* width the host-driven `viewport` prop animates, and the white page surface that scrolls the
|
|
4
|
+
* rendered document. None of it is expressible in InstUI props — it needs a gradient background,
|
|
5
|
+
* an animated `max-width` and a media query — so, like the canvas and tool panel chrome, it is
|
|
6
|
+
* injected once as a global stylesheet keyed by stable class names. The per-viewport width varies
|
|
7
|
+
* at runtime and is fed in as the `FRAME_WIDTH_VAR` custom property (not an inline `max-width`,
|
|
8
|
+
* which would outrank the phone media query below).
|
|
9
|
+
*/
|
|
10
|
+
export declare const PREVIEW_CLASS: {
|
|
11
|
+
readonly root: "bce-preview";
|
|
12
|
+
readonly frame: "bce-preview-frame";
|
|
13
|
+
readonly topNav: "bce-preview-top-nav";
|
|
14
|
+
readonly page: "bce-preview-page";
|
|
15
|
+
};
|
|
16
|
+
export declare const FRAME_WIDTH_VAR = "--bce-preview-frame-width";
|
|
17
|
+
/** Mounts the preview chrome stylesheet once, under the preview area. */
|
|
18
|
+
export declare function PreviewChromeStyles(): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=previewStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"previewStyles.d.ts","sourceRoot":"","sources":["../../../src/editor/preview/previewStyles.tsx"],"names":[],"mappings":"AAoBA;;;;;;;;GAQG;AAEH,eAAO,MAAM,aAAa;;;;;CAKhB,CAAA;AAEV,eAAO,MAAM,eAAe,8BAA8B,CAAA;AAqB1D,yEAAyE;AACzE,wBAAgB,mBAAmB,4CAyDlC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface DesignerNavState {
|
|
3
|
+
view: string;
|
|
4
|
+
subtitle?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface DesignerNavContextValue {
|
|
7
|
+
/** Push a new view onto the history stack. */
|
|
8
|
+
navigate: (view: string, subtitle?: string) => void;
|
|
9
|
+
/** Swap the current view without pushing history (array-item paging). */
|
|
10
|
+
replace: (view: string, subtitle?: string) => void;
|
|
11
|
+
/** Pop back to the previous view, or the default view if the stack is empty. */
|
|
12
|
+
back: () => void;
|
|
13
|
+
state: DesignerNavState;
|
|
14
|
+
canGoBack: boolean;
|
|
15
|
+
isAtRootView: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface DesignerNavProviderProps {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
defaultView?: string;
|
|
20
|
+
/** Controlled view — when set, the parent owns `state.view`. */
|
|
21
|
+
view?: DesignerNavState;
|
|
22
|
+
/** Fired whenever `navigate`/`replace`/`back` would change the view. */
|
|
23
|
+
onViewChange?: (view: DesignerNavState) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare function DesignerNavProvider({ children, defaultView, view: controlledView, onViewChange, }: DesignerNavProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
/** Access designer navigation. Throws outside a `DesignerNavProvider`. */
|
|
27
|
+
export declare function useDesignerNav(): DesignerNavContextValue;
|
|
28
|
+
//# sourceMappingURL=DesignerNav.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignerNav.d.ts","sourceRoot":"","sources":["../../../src/editor/sidebar/DesignerNav.tsx"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AAEd,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,8CAA8C;IAC9C,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACnD,yEAAyE;IACzE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAClD,gFAAgF;IAChF,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,KAAK,EAAE,gBAAgB,CAAA;IACvB,SAAS,EAAE,OAAO,CAAA;IAClB,YAAY,EAAE,OAAO,CAAA;CACtB;AAID,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,SAAS,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gEAAgE;IAChE,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,wEAAwE;IACxE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAChD;AAED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,WAAoB,EACpB,IAAI,EAAE,cAAc,EACpB,YAAY,GACb,EAAE,wBAAwB,2CA8D1B;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,IAAI,uBAAuB,CAMxD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { BlockRegistry } from '../../../registry';
|
|
3
|
+
export interface ComponentEditorFormProps {
|
|
4
|
+
componentType: string;
|
|
5
|
+
componentProps: Record<string, unknown>;
|
|
6
|
+
componentId?: string;
|
|
7
|
+
onChange: (props: Record<string, unknown>, nodeId?: string) => void;
|
|
8
|
+
/** The host-composed registry the selected block resolves against. */
|
|
9
|
+
registry: BlockRegistry;
|
|
10
|
+
}
|
|
11
|
+
export declare function ComponentEditorForm({ componentType, componentProps, componentId, onChange, registry, }: ComponentEditorFormProps): ReactElement | null;
|
|
12
|
+
//# sourceMappingURL=ComponentEditorForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComponentEditorForm.d.ts","sourceRoot":"","sources":["../../../../src/editor/sidebar/form/ComponentEditorForm.tsx"],"names":[],"mappings":"AAiCA,OAAO,EAEL,KAAK,YAAY,EAKlB,MAAM,OAAO,CAAA;AAYd,OAAO,EAAE,KAAK,aAAa,EAAqB,MAAM,mBAAmB,CAAA;AA2KzE,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACnE,sEAAsE;IACtE,QAAQ,EAAE,aAAa,CAAA;CACxB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,aAAa,EACb,cAAc,EACd,WAAW,EACX,QAAQ,EACR,QAAQ,GACT,EAAE,wBAAwB,GAAG,YAAY,GAAG,IAAI,CAoKhD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FieldError } from 'react-hook-form';
|
|
3
|
+
interface FormFieldWrapperProps {
|
|
4
|
+
label: string;
|
|
5
|
+
name: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
error?: FieldError;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
as?: 'label' | 'div';
|
|
10
|
+
}
|
|
11
|
+
export declare function FormFieldWrapper({ label, name, required, error, children, as, }: FormFieldWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=FormFieldWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormFieldWrapper.d.ts","sourceRoot":"","sources":["../../../../src/editor/sidebar/form/FormFieldWrapper.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,QAAQ,EAAE,SAAS,CAAA;IACnB,EAAE,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;CACrB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,EAAE,GACH,EAAE,qBAAqB,2CAmBvB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FormMessage } from '@instructure/ui-form-field';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { Control, FieldError, FieldValues } from 'react-hook-form';
|
|
4
|
+
import { FormFieldMetadata } from '../../../schema';
|
|
5
|
+
export interface FieldRenderProps {
|
|
6
|
+
metadata: FormFieldMetadata;
|
|
7
|
+
control: Control<FieldValues>;
|
|
8
|
+
fieldError?: FieldError;
|
|
9
|
+
onFieldChange: () => void;
|
|
10
|
+
setValue?: (name: string, value: any, options?: any) => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* True when this renderer is being shown inside a manage-layer sub-panel
|
|
14
|
+
* (see .zodManageLayer()) rather than inline in the main form. Only
|
|
15
|
+
* ObjectArrayFieldRenderer consumes this — it skips the collapse-to-
|
|
16
|
+
* summary-row behavior while already inside its own sub-panel.
|
|
17
|
+
*/
|
|
18
|
+
isManageLayer?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export type FieldRenderFn = (props: FieldRenderProps) => ReactElement;
|
|
21
|
+
/** Build the InstUI form messages for a field's validation error, if any. */
|
|
22
|
+
export declare function useFieldMessages(fieldError?: FieldError): FormMessage[];
|
|
23
|
+
export declare function generateId(): string;
|
|
24
|
+
//# sourceMappingURL=fieldRendererUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldRendererUtils.d.ts","sourceRoot":"","sources":["../../../../src/editor/sidebar/form/fieldRendererUtils.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAC7B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,aAAa,EAAE,MAAM,IAAI,CAAA;IAEzB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,gBAAgB,KAAK,YAAY,CAAA;AAErE,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,WAAW,EAAE,CAGvE;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FormFieldMetadata, FormFieldType } from '../../../schema';
|
|
2
|
+
import { FieldRenderFn } from './fieldRendererUtils';
|
|
3
|
+
export type { FieldRenderFn, FieldRenderProps } from './fieldRendererUtils';
|
|
4
|
+
export declare const fieldRendererRegistry: Record<FormFieldType, FieldRenderFn>;
|
|
5
|
+
export declare function getFieldRenderer(type: FormFieldType, metadata?: FormFieldMetadata): FieldRenderFn;
|
|
6
|
+
//# sourceMappingURL=fieldRenderers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldRenderers.d.ts","sourceRoot":"","sources":["../../../../src/editor/sidebar/form/fieldRenderers.tsx"],"names":[],"mappings":"AAoCA,OAAO,EAAE,KAAK,iBAAiB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEvE,OAAO,EAAE,KAAK,aAAa,EAA2C,MAAM,sBAAsB,CAAA;AAQlG,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAghB3E,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,aAAa,EAAE,aAAa,CAiBtE,CAAA;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,aAAa,CAKjG"}
|