@signalsafe/content-editor-react 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -2
- package/dist/BootstrapBlockRenderer.d.ts +10 -0
- package/dist/BootstrapBlockRenderer.js +256 -0
- package/dist/BootstrapInlineCanvasEditor.d.ts +11 -0
- package/dist/BootstrapInlineCanvasEditor.js +38 -0
- package/dist/BootstrapInlineText.d.ts +9 -0
- package/dist/BootstrapInlineText.js +121 -0
- package/dist/BootstrapNavigationBlocks.d.ts +13 -0
- package/dist/BootstrapNavigationBlocks.js +33 -0
- package/dist/BootstrapProgressGroup.d.ts +11 -0
- package/dist/BootstrapProgressGroup.js +13 -0
- package/dist/BootstrapProperties.d.ts +15 -0
- package/dist/BootstrapProperties.js +217 -0
- package/dist/CanvasTheme.d.ts +25 -0
- package/dist/CanvasTheme.js +34 -0
- package/dist/CollectionRowActions.d.ts +19 -0
- package/dist/CollectionRowActions.js +9 -0
- package/dist/ColorModeSelect.d.ts +9 -0
- package/dist/ColorModeSelect.js +28 -0
- package/dist/ColumnContent.d.ts +6 -0
- package/dist/ColumnContent.js +6 -0
- package/dist/ComponentPicker.d.ts +10 -0
- package/dist/ComponentPicker.js +22 -0
- package/dist/ComponentPickerIcon.d.ts +3 -0
- package/dist/ComponentPickerIcon.js +52 -0
- package/dist/ContentEditor.d.ts +16 -0
- package/dist/ContentEditor.js +73 -0
- package/dist/ContentImage.d.ts +16 -0
- package/dist/ContentImage.js +45 -0
- package/dist/ContentInteractionProvider.d.ts +21 -0
- package/dist/ContentInteractionProvider.js +102 -0
- package/dist/ContentKeyboardHelp.d.ts +4 -0
- package/dist/ContentKeyboardHelp.js +8 -0
- package/dist/ContentOutline.d.ts +20 -0
- package/dist/ContentOutline.js +71 -0
- package/dist/ContentRuntime.d.ts +28 -0
- package/dist/ContentRuntime.js +13 -0
- package/dist/EditorActionIcon.d.ts +18 -0
- package/dist/EditorActionIcon.js +32 -0
- package/dist/EditorCanvasScroll.d.ts +6 -0
- package/dist/EditorCanvasScroll.js +82 -0
- package/dist/EditorCanvasSettings.d.ts +5 -0
- package/dist/EditorCanvasSettings.js +21 -0
- package/dist/EditorCanvasToolbar.d.ts +16 -0
- package/dist/EditorCanvasToolbar.js +22 -0
- package/dist/EditorCollectionAdd.d.ts +6 -0
- package/dist/EditorCollectionAdd.js +6 -0
- package/dist/EditorCollectionRow.d.ts +18 -0
- package/dist/EditorCollectionRow.js +6 -0
- package/dist/EditorCommandBar.d.ts +7 -0
- package/dist/EditorCommandBar.js +9 -0
- package/dist/EditorContainerFields.d.ts +17 -0
- package/dist/EditorContainerFields.js +27 -0
- package/dist/EditorHistoryControls.d.ts +8 -0
- package/dist/EditorHistoryControls.js +6 -0
- package/dist/EditorIssuesPanel.d.ts +5 -0
- package/dist/EditorIssuesPanel.js +6 -0
- package/dist/EditorLayoutMenu.d.ts +23 -0
- package/dist/EditorLayoutMenu.js +13 -0
- package/dist/EditorMenuChoice.d.ts +8 -0
- package/dist/EditorMenuChoice.js +6 -0
- package/dist/EditorPanel.d.ts +10 -0
- package/dist/EditorPanel.js +12 -0
- package/dist/EditorPreviewToggle.d.ts +6 -0
- package/dist/EditorPreviewToggle.js +6 -0
- package/dist/EditorSidebarLayout.d.ts +8 -0
- package/dist/EditorSidebarLayout.js +29 -0
- package/dist/EditorStatusBar.d.ts +5 -0
- package/dist/EditorStatusBar.js +8 -0
- package/dist/EditorStatusBarContext.d.ts +2 -0
- package/dist/EditorStatusBarContext.js +3 -0
- package/dist/EditorSubmenu.d.ts +18 -0
- package/dist/EditorSubmenu.js +74 -0
- package/dist/EditorTabs.d.ts +9 -0
- package/dist/EditorTabs.js +28 -0
- package/dist/EditorTemplateMenu.d.ts +12 -0
- package/dist/EditorTemplateMenu.js +7 -0
- package/dist/EditorViewportSelect.d.ts +30 -0
- package/dist/EditorViewportSelect.js +17 -0
- package/dist/EditorWorkflowActions.d.ts +12 -0
- package/dist/EditorWorkflowActions.js +6 -0
- package/dist/EmptyContent.d.ts +6 -0
- package/dist/EmptyContent.js +18 -0
- package/dist/InlineCanvasEditor.d.ts +7 -0
- package/dist/InlineCanvasEditor.js +12 -0
- package/dist/InteractiveBootstrapBlocks.d.ts +17 -0
- package/dist/InteractiveBootstrapBlocks.js +434 -0
- package/dist/JsonEditor.css +163 -0
- package/dist/JsonTextEditor.d.ts +11 -0
- package/dist/JsonTextEditor.js +70 -0
- package/dist/JsonViewer.d.ts +15 -0
- package/dist/JsonViewer.js +109 -0
- package/dist/LayoutPresets.d.ts +8 -0
- package/dist/LayoutPresets.js +66 -0
- package/dist/LayoutPropertyFields.d.ts +8 -0
- package/dist/LayoutPropertyFields.js +43 -0
- package/dist/MarkdownEditor.d.ts +13 -0
- package/dist/MarkdownEditor.js +82 -0
- package/dist/PracticeInputBlock.d.ts +12 -0
- package/dist/PracticeInputBlock.js +21 -0
- package/dist/ReadableButton.d.ts +5 -0
- package/dist/ReadableButton.js +20 -0
- package/dist/ReadableDropdownSurface.d.ts +6 -0
- package/dist/ReadableDropdownSurface.js +16 -0
- package/dist/ReadableDropdownToggle.d.ts +2 -0
- package/dist/ReadableDropdownToggle.js +14 -0
- package/dist/ReadableFormSelect.d.ts +3 -0
- package/dist/ReadableFormSelect.js +10 -0
- package/dist/ReorderHandle.d.ts +15 -0
- package/dist/ReorderHandle.js +31 -0
- package/dist/ReorderTarget.d.ts +10 -0
- package/dist/ReorderTarget.js +7 -0
- package/dist/SpacingEditor.d.ts +9 -0
- package/dist/SpacingEditor.js +53 -0
- package/dist/authoringActions.d.ts +18 -0
- package/dist/authoringActions.js +172 -0
- package/dist/authoringText.d.ts +4 -0
- package/dist/authoringText.js +45 -0
- package/dist/authoringUuid.d.ts +2 -0
- package/dist/authoringUuid.js +11 -0
- package/dist/bootstrapFamilies.d.ts +10 -0
- package/dist/bootstrapFamilies.js +151 -0
- package/dist/bootstrapGridImport.d.ts +8 -0
- package/dist/bootstrapGridImport.js +122 -0
- package/dist/bootstrapGridMigration.d.ts +3 -0
- package/dist/bootstrapGridMigration.js +27 -0
- package/dist/bootstrapRegistry.d.ts +69 -0
- package/dist/bootstrapRegistry.js +966 -0
- package/dist/canvasPreferences.d.ts +27 -0
- package/dist/canvasPreferences.js +28 -0
- package/dist/collectionNavigation.d.ts +20 -0
- package/dist/collectionNavigation.js +38 -0
- package/dist/componentPickerFamilies.d.ts +5 -0
- package/dist/componentPickerFamilies.js +40 -0
- package/dist/componentPolicy.d.ts +31 -0
- package/dist/componentPolicy.js +25 -0
- package/dist/componentValidation.d.ts +23707 -0
- package/dist/componentValidation.js +7 -0
- package/dist/content-editor.css +584 -0
- package/dist/content-layout.css +597 -0
- package/dist/contentContainment.d.ts +4 -0
- package/dist/contentContainment.js +117 -0
- package/dist/contentCssPath.d.ts +5 -0
- package/dist/contentCssPath.js +63 -0
- package/dist/contentEditingCommands.d.ts +35 -0
- package/dist/contentEditingCommands.js +69 -0
- package/dist/contentInsertion.d.ts +3 -0
- package/dist/contentInsertion.js +16 -0
- package/dist/contentModel.d.ts +3 -0
- package/dist/contentModel.js +1 -0
- package/dist/contentTreeValidation.d.ts +8 -0
- package/dist/contentTreeValidation.js +211 -0
- package/dist/contracts/semantics.gen.d.ts +2 -0
- package/dist/contracts/semantics.gen.js +3 -0
- package/dist/contracts/types.gen.d.ts +3741 -0
- package/dist/contracts/types.gen.js +1 -0
- package/dist/contracts/zod.gen.d.ts +62365 -0
- package/dist/contracts/zod.gen.js +3036 -0
- package/dist/controlBackgroundIconContrast.d.ts +3 -0
- package/dist/controlBackgroundIconContrast.js +60 -0
- package/dist/dropdownContrast.d.ts +5 -0
- package/dist/dropdownContrast.js +34 -0
- package/dist/editor-ui-colors.css +40 -0
- package/dist/editorThemes.d.ts +10 -0
- package/dist/editorThemes.js +12 -0
- package/dist/inlineMarkup.d.ts +6 -0
- package/dist/inlineMarkup.js +171 -0
- package/dist/layout.d.ts +17 -0
- package/dist/layout.js +37 -0
- package/dist/nestedComponentLabel.d.ts +2 -0
- package/dist/nestedComponentLabel.js +17 -0
- package/dist/responsiveLayout.d.ts +51 -0
- package/dist/responsiveLayout.js +97 -0
- package/dist/slideAppearance.d.ts +25 -0
- package/dist/slideAppearance.js +283 -0
- package/dist/source-manifest.json +105 -0
- package/dist/spacingShorthand.d.ts +12 -0
- package/dist/spacingShorthand.js +47 -0
- package/dist/themes/canvas-themes.css +131 -0
- package/dist/useCanvasSelectionScroll.d.ts +3 -0
- package/dist/useCanvasSelectionScroll.js +51 -0
- package/dist/useContentHistory.d.ts +40 -0
- package/dist/useContentHistory.js +42 -0
- package/dist/useContentReorderTarget.d.ts +6 -0
- package/dist/useContentReorderTarget.js +44 -0
- package/dist/useContentSelection.d.ts +10 -0
- package/dist/useContentSelection.js +23 -0
- package/dist/useDropdownContrast.d.ts +16 -0
- package/dist/useDropdownContrast.js +145 -0
- package/dist/useEditorControlContrast.d.ts +3 -0
- package/dist/useEditorControlContrast.js +188 -0
- package/dist/useSiteThemeStyles.d.ts +3 -0
- package/dist/useSiteThemeStyles.js +30 -0
- package/dist/useValidationFocus.d.ts +5 -0
- package/dist/useValidationFocus.js +17 -0
- package/package.json +74 -5
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export declare const EDITOR_CONTAINER_WIDTHS: readonly ["fluid", "fixed", "sm", "md", "lg", "xl", "xxl"];
|
|
3
|
+
export type EditorContainerWidth = typeof EDITOR_CONTAINER_WIDTHS[number];
|
|
4
|
+
export declare function editorContainerFluid(width: EditorContainerWidth): boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
5
|
+
export declare const EDITOR_BACKGROUNDS: readonly ["transparent", "body", "primary", "secondary", "success", "info", "warning", "danger", "light", "dark"];
|
|
6
|
+
export declare const EDITOR_PADDING: readonly [0, 1, 2, 3, 4, 5];
|
|
7
|
+
/** Root page/slide fields share labels, spacing and option presentation. */
|
|
8
|
+
export declare function EditorContainerFields({ title, name, width, padding, background, onWidth, onPadding, onBackground }: Readonly<{
|
|
9
|
+
title: string;
|
|
10
|
+
name: ReactNode;
|
|
11
|
+
width: EditorContainerWidth;
|
|
12
|
+
padding: number;
|
|
13
|
+
background: string;
|
|
14
|
+
onWidth: (value: EditorContainerWidth) => void;
|
|
15
|
+
onPadding: (value: number) => void;
|
|
16
|
+
onBackground: (value: typeof EDITOR_BACKGROUNDS[number]) => void;
|
|
17
|
+
}>): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useEditorControlContrast } from './useEditorControlContrast.js';
|
|
4
|
+
export const EDITOR_CONTAINER_WIDTHS = ['fluid', 'fixed', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
|
5
|
+
export function editorContainerFluid(width) {
|
|
6
|
+
return width === 'fluid' ? true : width === 'fixed' ? false : width;
|
|
7
|
+
}
|
|
8
|
+
export const EDITOR_BACKGROUNDS = ['transparent', 'body', 'primary', 'secondary', 'success', 'info', 'warning', 'danger', 'light', 'dark'];
|
|
9
|
+
export const EDITOR_PADDING = [0, 1, 2, 3, 4, 5];
|
|
10
|
+
/** Root page/slide fields share labels, spacing and option presentation. */
|
|
11
|
+
export function EditorContainerFields({ title, name, width, padding, background, onWidth, onPadding, onBackground }) {
|
|
12
|
+
const contrast = useRef(null);
|
|
13
|
+
useEditorControlContrast(contrast);
|
|
14
|
+
return _jsxs("div", { ref: contrast, className: "editor-container-fields", children: [name, _jsxs("label", { children: [title, " container", _jsx("select", { className: "form-select", value: width, onChange: event => {
|
|
15
|
+
const option = EDITOR_CONTAINER_WIDTHS.find(item => item === event.currentTarget.value);
|
|
16
|
+
if (option)
|
|
17
|
+
onWidth(option);
|
|
18
|
+
}, children: EDITOR_CONTAINER_WIDTHS.map(option => _jsx("option", { value: option, children: option === 'fluid' ? 'Full width' : option === 'fixed' ? 'Responsive fixed width' : `Full width below ${option}` }, option)) })] }), _jsxs("label", { children: [title, " padding", _jsx("select", { className: "form-select", value: padding, onChange: event => {
|
|
19
|
+
const option = EDITOR_PADDING.find(item => String(item) === event.currentTarget.value);
|
|
20
|
+
if (option !== undefined)
|
|
21
|
+
onPadding(option);
|
|
22
|
+
}, children: EDITOR_PADDING.map(value => _jsx("option", { value: value, children: value }, value)) })] }), _jsxs("label", { children: [title, " background", _jsx("select", { className: "form-select", value: background, onChange: event => {
|
|
23
|
+
const option = EDITOR_BACKGROUNDS.find(item => item === event.currentTarget.value);
|
|
24
|
+
if (option)
|
|
25
|
+
onBackground(option);
|
|
26
|
+
}, children: EDITOR_BACKGROUNDS.map(value => _jsx("option", { value: value, children: value }, value)) })] })] });
|
|
27
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** One pair of command buttons preserves native disabled and keyboard behavior in both hosts. */
|
|
2
|
+
export declare function EditorHistoryControls({ canUndo, canRedo, undo, redo, disabled }: Readonly<{
|
|
3
|
+
canUndo: boolean;
|
|
4
|
+
canRedo: boolean;
|
|
5
|
+
undo: () => void;
|
|
6
|
+
redo: () => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}>): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { EditorActionIcon } from './EditorActionIcon.js';
|
|
3
|
+
/** One pair of command buttons preserves native disabled and keyboard behavior in both hosts. */
|
|
4
|
+
export function EditorHistoryControls({ canUndo, canRedo, undo, redo, disabled = false }) {
|
|
5
|
+
return _jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "btn btn-sm btn-link editor-command-icon", "aria-label": "Undo", title: "Undo (Ctrl/\u2318 Z)", disabled: disabled || !canUndo, onClick: undo, children: _jsx(EditorActionIcon, { action: "undo" }) }), _jsx("button", { type: "button", className: "btn btn-sm btn-link editor-command-icon", "aria-label": "Redo", title: "Redo (Ctrl/\u2318 Shift Z)", disabled: disabled || !canRedo, onClick: redo, children: _jsx(EditorActionIcon, { action: "redo" }) })] });
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ListGroup } from 'react-bootstrap';
|
|
3
|
+
import { EditorPanel } from './EditorPanel.js';
|
|
4
|
+
export function EditorIssuesPanel({ count, children }) {
|
|
5
|
+
return _jsx(EditorPanel, { label: "Issues", title: `Issues (${count})`, fields: false, className: "editor-issues-panel mt-3", children: children ?? _jsx(ListGroup, { variant: "flush", as: "ul", className: "list-unstyled", children: _jsx(ListGroup.Item, { as: "li", children: _jsx("em", { className: "text-muted", children: "No issues" }) }) }) });
|
|
6
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EditorColorMode } from './editorThemes.js';
|
|
2
|
+
export type EditorSiteTheme = Readonly<{
|
|
3
|
+
themes: readonly string[];
|
|
4
|
+
theme: string;
|
|
5
|
+
onThemeChange: (theme: string) => void;
|
|
6
|
+
mode: EditorColorMode;
|
|
7
|
+
onModeChange: (mode: EditorColorMode) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
type PanelState = Readonly<{
|
|
11
|
+
left: boolean;
|
|
12
|
+
right: boolean;
|
|
13
|
+
showRight: boolean;
|
|
14
|
+
controls: string;
|
|
15
|
+
toggleLeft: () => void;
|
|
16
|
+
toggleRight: () => void;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function EditorLayoutMenu({ site, panels, compact }: Readonly<{
|
|
19
|
+
site?: EditorSiteTheme;
|
|
20
|
+
panels?: PanelState;
|
|
21
|
+
compact?: boolean;
|
|
22
|
+
}>): import("react").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { ReadableDropdownToggle } from './ReadableDropdownToggle.js';
|
|
3
|
+
import { ReadableDropdownSurface } from './ReadableDropdownSurface.js';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { Dropdown } from 'react-bootstrap';
|
|
6
|
+
import { EditorMenuChoice } from './EditorMenuChoice.js';
|
|
7
|
+
import { EditorSubmenu, useEditorSubmenus } from './EditorSubmenu.js';
|
|
8
|
+
export function EditorLayoutMenu({ site, panels, compact = false }) {
|
|
9
|
+
const [open, setOpen] = useState(false);
|
|
10
|
+
const submenus = useEditorSubmenus();
|
|
11
|
+
return _jsxs(Dropdown, { show: open, onToggle: next => { setOpen(next); if (!next)
|
|
12
|
+
submenus.reset(); }, children: [_jsx(Dropdown.Toggle, { as: ReadableDropdownToggle, size: "sm", variant: compact ? "link" : "outline-secondary", className: compact ? "editor-command-link" : undefined, disabled: site?.disabled, children: "Layout" }), _jsxs(Dropdown.Menu, { as: ReadableDropdownSurface, role: "menu", "aria-label": "Layout", children: [site && _jsxs(_Fragment, { children: [_jsx(EditorSubmenu, { ...submenus.item('Theme'), label: "Theme", menuLabel: "Site theme", parentOpen: open, children: site.themes.map(value => _jsx(EditorMenuChoice, { radio: true, label: value.charAt(0).toUpperCase() + value.slice(1), checked: site.theme === value, onChange: () => site.onThemeChange(value) }, value)) }), _jsxs(EditorSubmenu, { ...submenus.item('Variant'), label: "Variant", menuLabel: "Site variant", parentOpen: open, children: [_jsx(EditorMenuChoice, { radio: true, label: "Light", checked: site.mode === 'light', onChange: () => site.onModeChange('light') }), _jsx(EditorMenuChoice, { radio: true, label: "Dark", checked: site.mode === 'dark', onChange: () => site.onModeChange('dark') })] })] }), panels && _jsxs(EditorSubmenu, { ...submenus.item('Panels'), label: "Panels", menuLabel: "Panels", parentOpen: open, children: [_jsx(EditorMenuChoice, { label: "Left sidebar", checked: panels.left, controls: panels.controls, onChange: panels.toggleLeft }), panels.showRight && _jsx(EditorMenuChoice, { label: "Right sidebar", checked: panels.right, controls: panels.controls, onChange: panels.toggleRight })] })] })] });
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function EditorMenuChoice({ label, checked, onChange, radio, disabled, controls }: Readonly<{
|
|
2
|
+
label: string;
|
|
3
|
+
checked: boolean;
|
|
4
|
+
onChange: () => void;
|
|
5
|
+
radio?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
controls?: string;
|
|
8
|
+
}>): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dropdown } from 'react-bootstrap';
|
|
3
|
+
import { EditorActionIcon } from './EditorActionIcon.js';
|
|
4
|
+
export function EditorMenuChoice({ label, checked, onChange, radio = false, disabled = false, controls }) {
|
|
5
|
+
return _jsx(Dropdown.Item, { as: "button", role: radio ? 'menuitemradio' : 'menuitemcheckbox', "aria-checked": checked, "aria-controls": controls, disabled: disabled, onClick: onChange, children: _jsxs("span", { className: "d-inline-flex align-items-center gap-2", children: [_jsx("span", { className: "editor-menu-check", "aria-hidden": "true", children: checked && _jsx(EditorActionIcon, { action: "done" }) }), label] }) });
|
|
6
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** Native disclosure semantics and one header/body layout in every editor. */
|
|
3
|
+
export declare function EditorPanel({ title, actions, children, fields, className, label }: Readonly<{
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
actions?: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
fields?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
}>): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useEditorControlContrast } from './useEditorControlContrast.js';
|
|
4
|
+
/** Native disclosure semantics and one header/body layout in every editor. */
|
|
5
|
+
export function EditorPanel({ title, actions, children, fields = true, className = '', label }) {
|
|
6
|
+
const contrast = useRef(null);
|
|
7
|
+
useEditorControlContrast(contrast);
|
|
8
|
+
return _jsxs("details", { ref: contrast, className: `editor-panel ${className}`, open: true, "aria-label": label, children: [_jsxs("summary", { className: "editor-panel-header", onClick: event => {
|
|
9
|
+
if (event.target instanceof Element && event.target.closest('button'))
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
}, children: [_jsx("span", { className: "editor-panel-title", children: title }), actions && _jsx("span", { className: "panel-header-actions", children: actions })] }), _jsx("div", { className: `editor-panel-content${fields ? ' editor-panel-fields' : ''}`, children: children })] });
|
|
12
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Preview is a mode toggle with the same wording and accessibility in every host. */
|
|
2
|
+
export declare function EditorPreviewToggle({ preview, onChange, disabled }: Readonly<{
|
|
3
|
+
preview: boolean;
|
|
4
|
+
onChange: (preview: boolean) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}>): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ReadableButton } from './ReadableButton.js';
|
|
3
|
+
/** Preview is a mode toggle with the same wording and accessibility in every host. */
|
|
4
|
+
export function EditorPreviewToggle({ preview, onChange, disabled = false }) {
|
|
5
|
+
return _jsx(ReadableButton, { type: "button", className: "btn btn-sm btn-outline-secondary", "aria-pressed": preview, disabled: disabled, onClick: () => onChange(!preview), children: preview ? 'Back to editing' : 'Preview' });
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type EditorSiteTheme } from './EditorLayoutMenu.js';
|
|
2
|
+
import { type HTMLAttributes } from 'react';
|
|
3
|
+
/** Keeps disclosure controls mounted while each sidebar and its editing state stay intact. */
|
|
4
|
+
export declare function EditorSidebarLayout({ children, className, showRight, controlsTarget, siteTheme, ...attributes }: HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
showRight?: boolean;
|
|
6
|
+
controlsTarget?: HTMLElement | null;
|
|
7
|
+
siteTheme?: EditorSiteTheme;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEditorControlContrast } from './useEditorControlContrast.js';
|
|
3
|
+
import { EditorStatusBarContext } from './EditorStatusBarContext.js';
|
|
4
|
+
import { EditorLayoutMenu } from './EditorLayoutMenu.js';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
6
|
+
import { useId, useLayoutEffect, useState, useRef, useCallback } from 'react';
|
|
7
|
+
/** Keeps disclosure controls mounted while each sidebar and its editing state stay intact. */
|
|
8
|
+
export function EditorSidebarLayout({ children, className = '', showRight = true, controlsTarget, siteTheme, ...attributes }) {
|
|
9
|
+
const id = useId();
|
|
10
|
+
const contrast = useRef(null);
|
|
11
|
+
const statusContrast = useRef(null);
|
|
12
|
+
useEditorControlContrast(contrast);
|
|
13
|
+
useEditorControlContrast(statusContrast);
|
|
14
|
+
const [left, setLeft] = useState(true);
|
|
15
|
+
const [right, setRight] = useState(true);
|
|
16
|
+
const [statusTarget, setStatusTarget] = useState(null);
|
|
17
|
+
const setStatus = useCallback((node) => { statusContrast.current = node; setStatusTarget(node); }, []);
|
|
18
|
+
const [statusHeight, setStatusHeight] = useState(0);
|
|
19
|
+
useLayoutEffect(() => {
|
|
20
|
+
if (!statusTarget)
|
|
21
|
+
return;
|
|
22
|
+
const measure = () => setStatusHeight(statusTarget.getBoundingClientRect().height);
|
|
23
|
+
measure();
|
|
24
|
+
const observer = new ResizeObserver(measure);
|
|
25
|
+
observer.observe(statusTarget);
|
|
26
|
+
return () => observer.disconnect();
|
|
27
|
+
}, [statusTarget]);
|
|
28
|
+
return _jsxs(EditorStatusBarContext.Provider, { value: statusTarget, children: [_jsxs("div", { ...attributes, ref: contrast, id: id, className: className, "data-left-collapsed": !left, "data-right-collapsed": !showRight || !right, children: [controlsTarget && createPortal(_jsx(EditorLayoutMenu, { compact: true, site: siteTheme, panels: { left, right, showRight, controls: id, toggleLeft: () => setLeft(value => !value), toggleRight: () => setRight(value => !value) } }), controlsTarget), children] }), _jsx("div", { "aria-hidden": "true", style: { height: statusHeight } }), _jsx("footer", { ref: setStatus, className: "editor-page-statusbar" })] });
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import { EditorStatusBarContext } from './EditorStatusBarContext.js';
|
|
4
|
+
/** Place selection controls in the page footer, retaining standalone canvas support. */
|
|
5
|
+
export function EditorStatusBar({ children }) {
|
|
6
|
+
const target = useContext(EditorStatusBarContext);
|
|
7
|
+
return target === undefined ? children : target && children ? createPortal(children, target) : null;
|
|
8
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/** Native menu styling with explicit submenu keyboard navigation and viewport-aware positioning. */
|
|
3
|
+
export declare function EditorSubmenu({ label, menuLabel, parentOpen, open, onToggle, children }: Readonly<{
|
|
4
|
+
label: string;
|
|
5
|
+
menuLabel: string;
|
|
6
|
+
parentOpen: boolean;
|
|
7
|
+
open: boolean;
|
|
8
|
+
onToggle: (open: boolean) => void;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}>): import("react").JSX.Element;
|
|
11
|
+
/** An editor menu has one active flyout; late close events cannot close its newly opened sibling. */
|
|
12
|
+
export declare function useEditorSubmenus(): {
|
|
13
|
+
reset: () => void;
|
|
14
|
+
item: (name: string) => {
|
|
15
|
+
open: boolean;
|
|
16
|
+
onToggle: (next: boolean) => void;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ReadableDropdownSurface } from './ReadableDropdownSurface.js';
|
|
3
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
import { Dropdown } from 'react-bootstrap';
|
|
5
|
+
function nextMenuIndex(key, current, last) {
|
|
6
|
+
switch (key) {
|
|
7
|
+
case 'Home': return 0;
|
|
8
|
+
case 'End': return last;
|
|
9
|
+
case 'ArrowDown': return Math.min(current + 1, last);
|
|
10
|
+
case 'ArrowUp': return Math.max(current - 1, 0);
|
|
11
|
+
default: return undefined;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** Native menu styling with explicit submenu keyboard navigation and viewport-aware positioning. */
|
|
15
|
+
export function EditorSubmenu({ label, menuLabel, parentOpen, open, onToggle, children }) {
|
|
16
|
+
const toggle = useRef(null);
|
|
17
|
+
const menu = useRef(null);
|
|
18
|
+
const focusFirst = useRef(false);
|
|
19
|
+
useLayoutEffect(() => {
|
|
20
|
+
if (open && focusFirst.current) {
|
|
21
|
+
focusFirst.current = false;
|
|
22
|
+
menu.current?.querySelector('.dropdown-item:not(.disabled)')?.focus();
|
|
23
|
+
}
|
|
24
|
+
}, [open]);
|
|
25
|
+
function key(event) {
|
|
26
|
+
if (open && event.target instanceof HTMLElement && menu.current?.contains(event.target)) {
|
|
27
|
+
const items = Array.from(menu.current.querySelectorAll('.dropdown-item:not(.disabled):not(:disabled)'));
|
|
28
|
+
const next = nextMenuIndex(event.key, items.indexOf(event.target), items.length - 1);
|
|
29
|
+
if (next !== undefined) {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
event.stopPropagation();
|
|
32
|
+
items[next]?.focus();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (open && (event.key === 'Escape' || event.key === 'ArrowLeft')) {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
event.stopPropagation();
|
|
38
|
+
onToggle(false);
|
|
39
|
+
toggle.current?.focus();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return _jsxs(Dropdown, { drop: "start", show: open && parentOpen, onToggle: onToggle, className: "editor-submenu", onKeyDown: key, children: [_jsx(Dropdown.Toggle, { ref: toggle, as: "button", type: "button", className: "dropdown-item", role: "menuitem", "aria-haspopup": "menu", onKeyDown: event => {
|
|
43
|
+
if (event.key === 'ArrowRight') {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
event.stopPropagation();
|
|
46
|
+
if (open)
|
|
47
|
+
menu.current?.querySelector('.dropdown-item:not(.disabled)')?.focus();
|
|
48
|
+
else {
|
|
49
|
+
focusFirst.current = true;
|
|
50
|
+
onToggle(true);
|
|
51
|
+
}
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const items = Array.from(event.currentTarget.closest('.dropdown-menu')?.querySelectorAll(':scope > .editor-submenu > .dropdown-toggle') ?? []);
|
|
55
|
+
const next = nextMenuIndex(event.key, items.indexOf(event.currentTarget), items.length - 1);
|
|
56
|
+
if (next !== undefined) {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
event.stopPropagation();
|
|
59
|
+
onToggle(false);
|
|
60
|
+
items[next]?.focus();
|
|
61
|
+
}
|
|
62
|
+
}, children: label }), _jsx(Dropdown.Menu, { as: ReadableDropdownSurface, ref: menu, role: "menu", "aria-label": menuLabel, className: "editor-choice-menu", popperConfig: { strategy: 'fixed', modifiers: [{ name: 'preventOverflow', options: { rootBoundary: 'viewport', altAxis: true, padding: 8 } }] }, children: open && parentOpen ? children : null })] });
|
|
63
|
+
}
|
|
64
|
+
/** An editor menu has one active flyout; late close events cannot close its newly opened sibling. */
|
|
65
|
+
export function useEditorSubmenus() {
|
|
66
|
+
const [active, setActive] = useState(null);
|
|
67
|
+
return {
|
|
68
|
+
reset: () => setActive(null),
|
|
69
|
+
item: (name) => ({
|
|
70
|
+
open: active === name,
|
|
71
|
+
onToggle: (next) => setActive(current => next ? name : current === name ? null : current),
|
|
72
|
+
}),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Controlled tabs share roving focus, keyboard navigation and panel relationships. */
|
|
2
|
+
export declare function EditorTabs<T extends string>({ id, label, items, value, onChange, panelId }: Readonly<{
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
items: readonly T[];
|
|
6
|
+
value: T;
|
|
7
|
+
onChange: (value: T) => void;
|
|
8
|
+
panelId?: string | ((name: T, index: number) => string);
|
|
9
|
+
}>): import("react").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useEditorControlContrast } from './useEditorControlContrast.js';
|
|
4
|
+
function nextTab(key, index, count) {
|
|
5
|
+
switch (key) {
|
|
6
|
+
case 'ArrowRight': return (index + 1) % count;
|
|
7
|
+
case 'ArrowLeft': return (index + count - 1) % count;
|
|
8
|
+
case 'Home': return 0;
|
|
9
|
+
case 'End': return count - 1;
|
|
10
|
+
default: return undefined;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** Controlled tabs share roving focus, keyboard navigation and panel relationships. */
|
|
14
|
+
export function EditorTabs({ id, label, items, value, onChange, panelId }) {
|
|
15
|
+
const contrast = useRef(null);
|
|
16
|
+
useEditorControlContrast(contrast);
|
|
17
|
+
function key(event, index) {
|
|
18
|
+
const target = nextTab(event.key, index, items.length);
|
|
19
|
+
const next = target === undefined ? undefined : items[target];
|
|
20
|
+
if (next === undefined)
|
|
21
|
+
return;
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
onChange(next);
|
|
24
|
+
const buttons = event.currentTarget.parentElement?.querySelectorAll('[role="tab"]');
|
|
25
|
+
buttons?.item(target ?? 0)?.focus();
|
|
26
|
+
}
|
|
27
|
+
return _jsx("div", { ref: contrast, role: "tablist", "aria-label": label, className: "nav nav-tabs editor-tabs", children: items.map((name, index) => _jsx("button", { type: "button", role: "tab", id: `${id}-${index}`, "aria-controls": typeof panelId === 'function' ? panelId(name, index) : panelId ?? `${id}-panel-${name}`, "aria-selected": value === name, tabIndex: value === name ? 0 : -1, className: `nav-link${value === name ? ' active' : ''}`, onKeyDown: event => key(event, index), onClick: () => onChange(name), children: name }, name)) });
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type EditorTemplateChoice = Readonly<{
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
onSelect: () => void;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function EditorTemplateMenu({ items, children }: Readonly<{
|
|
10
|
+
items: readonly EditorTemplateChoice[];
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}>): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dropdown } from 'react-bootstrap';
|
|
3
|
+
import { ReadableDropdownToggle } from './ReadableDropdownToggle.js';
|
|
4
|
+
import { ReadableDropdownSurface } from './ReadableDropdownSurface.js';
|
|
5
|
+
export function EditorTemplateMenu({ items, children }) {
|
|
6
|
+
return _jsxs(Dropdown, { children: [_jsx(Dropdown.Toggle, { as: ReadableDropdownToggle, variant: "link", className: "editor-command-link", size: "sm", children: "Templates" }), _jsxs(Dropdown.Menu, { as: ReadableDropdownSurface, role: "menu", "aria-label": "Templates", children: [items.map(item => _jsxs(Dropdown.Item, { role: "menuitem", disabled: item.disabled, as: "button", type: "button", onClick: item.onSelect, children: [item.icon && _jsx("span", { className: "me-2", "aria-hidden": "true", children: item.icon }), item.label] }, item.id)), children] })] });
|
|
7
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const EDITOR_VIEWPORT_PRESETS: readonly [{
|
|
2
|
+
readonly width: 375;
|
|
3
|
+
readonly label: "xs (<576px)";
|
|
4
|
+
}, {
|
|
5
|
+
readonly width: 576;
|
|
6
|
+
readonly label: "sm (576px)";
|
|
7
|
+
}, {
|
|
8
|
+
readonly width: 768;
|
|
9
|
+
readonly label: "md (768px)";
|
|
10
|
+
}, {
|
|
11
|
+
readonly width: 992;
|
|
12
|
+
readonly label: "lg (992px)";
|
|
13
|
+
}, {
|
|
14
|
+
readonly width: 1200;
|
|
15
|
+
readonly label: "xl (1200px)";
|
|
16
|
+
}, {
|
|
17
|
+
readonly width: 1400;
|
|
18
|
+
readonly label: "xxl (1400px)";
|
|
19
|
+
}];
|
|
20
|
+
/** Hosts retain their document values; canvas controls share one presentation. */
|
|
21
|
+
export declare function EditorViewportSelect<Value extends string>({ label, value, options, onChange }: Readonly<{
|
|
22
|
+
label: string;
|
|
23
|
+
value: Value;
|
|
24
|
+
options: readonly Readonly<{
|
|
25
|
+
id: Value;
|
|
26
|
+
label: string;
|
|
27
|
+
width?: number;
|
|
28
|
+
}>[];
|
|
29
|
+
onChange: (value: Value) => void;
|
|
30
|
+
}>): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export const EDITOR_VIEWPORT_PRESETS = [
|
|
3
|
+
{ width: 375, label: 'xs (<576px)' },
|
|
4
|
+
{ width: 576, label: 'sm (576px)' },
|
|
5
|
+
{ width: 768, label: 'md (768px)' },
|
|
6
|
+
{ width: 992, label: 'lg (992px)' },
|
|
7
|
+
{ width: 1200, label: 'xl (1200px)' },
|
|
8
|
+
{ width: 1400, label: 'xxl (1400px)' },
|
|
9
|
+
];
|
|
10
|
+
/** Hosts retain their document values; canvas controls share one presentation. */
|
|
11
|
+
export function EditorViewportSelect({ label, value, options, onChange }) {
|
|
12
|
+
return _jsx("select", { "aria-label": label, className: "form-select form-select-sm w-auto", value: value, onChange: event => {
|
|
13
|
+
const option = options.find(item => item.id === event.currentTarget.value);
|
|
14
|
+
if (option)
|
|
15
|
+
onChange(option.id);
|
|
16
|
+
}, children: options.map(option => _jsx("option", { value: option.id, children: option.label }, option.id)) });
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Hosts own saving and review; the shared controls own their presentation. */
|
|
2
|
+
export declare function EditorWorkflowActions({ onReview, onSave, onCancel, reviewType, reviewDisabled, saveDisabled, cancelDisabled, saving, failed }: Readonly<{
|
|
3
|
+
onReview?: () => void;
|
|
4
|
+
onSave: () => void;
|
|
5
|
+
onCancel?: () => void;
|
|
6
|
+
reviewType?: 'button' | 'submit';
|
|
7
|
+
reviewDisabled?: boolean;
|
|
8
|
+
saveDisabled?: boolean;
|
|
9
|
+
cancelDisabled?: boolean;
|
|
10
|
+
saving?: boolean;
|
|
11
|
+
failed?: boolean;
|
|
12
|
+
}>): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ReadableButton } from './ReadableButton.js';
|
|
3
|
+
/** Hosts own saving and review; the shared controls own their presentation. */
|
|
4
|
+
export function EditorWorkflowActions({ onReview, onSave, onCancel, reviewType = 'button', reviewDisabled = false, saveDisabled = false, cancelDisabled = false, saving = false, failed = false }) {
|
|
5
|
+
return _jsxs(_Fragment, { children: [_jsx(ReadableButton, { type: reviewType, className: "btn btn-primary btn-sm", disabled: reviewDisabled, onClick: onReview, children: "Review" }), _jsx(ReadableButton, { type: "button", className: "btn btn-outline-secondary btn-sm", disabled: saveDisabled, onClick: onSave, children: saving ? 'Saving…' : failed ? 'Retry save' : 'Save draft' }), onCancel && _jsx(ReadableButton, { type: "button", className: "btn btn-outline-secondary btn-sm", disabled: cancelDisabled, onClick: onCancel, children: "Cancel" })] });
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { type BootstrapBlockType } from './bootstrapRegistry.js';
|
|
3
|
+
/** One insertion guide with valid native markup for each empty container. */
|
|
4
|
+
export declare function EmptyContent({ type, onClick, onPointerDown, className, ...props }: Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> & {
|
|
5
|
+
type: BootstrapBlockType;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { bootstrapBlockDefinition } from './bootstrapRegistry.js';
|
|
3
|
+
/** One insertion guide with valid native markup for each empty container. */
|
|
4
|
+
export function EmptyContent({ type, onClick, onPointerDown, className = '', ...props }) {
|
|
5
|
+
const button = _jsxs("button", { ...props, type: "button", className: `content-empty-component ${className}`, onPointerDown: event => { event.stopPropagation(); onPointerDown?.(event); }, onClick: event => { event.stopPropagation(); onClick?.(event); }, children: ["Add content to ", bootstrapBlockDefinition(type).label] });
|
|
6
|
+
switch (type) {
|
|
7
|
+
case 'Table': return _jsx("caption", { children: button });
|
|
8
|
+
case 'TableHead':
|
|
9
|
+
case 'TableBody':
|
|
10
|
+
case 'TableFoot': return _jsx("tr", { children: _jsx("td", { children: button }) });
|
|
11
|
+
case 'TableRow': return _jsx("td", { children: button });
|
|
12
|
+
case 'Row': return _jsx("div", { className: "col-12", children: button });
|
|
13
|
+
case 'ContentList':
|
|
14
|
+
case 'ListGroup': return _jsx("li", { className: "list-unstyled", children: button });
|
|
15
|
+
case 'DescriptionList': return _jsx("dd", { children: button });
|
|
16
|
+
default: return button;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { EditorActionIcon } from './EditorActionIcon.js';
|
|
3
|
+
import { MarkdownEditor } from './MarkdownEditor.js';
|
|
4
|
+
export function InlineCanvasEditor({ type, text, headingLevel, onChange, onClose, }) {
|
|
5
|
+
return (_jsx("fieldset", { "aria-label": "Inline text editor", tabIndex: -1, className: "content-inline-editor", "data-block-type": type, "data-heading-level": headingLevel ?? 2, "data-puck-overlay-portal": "true", onPointerDown: (event) => event.stopPropagation(), onKeyDownCapture: (event) => {
|
|
6
|
+
if (event.key === 'Escape') {
|
|
7
|
+
event.preventDefault();
|
|
8
|
+
event.stopPropagation();
|
|
9
|
+
onClose();
|
|
10
|
+
}
|
|
11
|
+
}, children: _jsx("div", { role: "presentation", onClick: (event) => event.stopPropagation(), children: _jsx(MarkdownEditor, { toolbarEnd: _jsx("button", { type: "button", className: "btn btn-sm btn-outline-primary ms-auto", "aria-label": "Done editing", title: "Done editing", onClick: onClose, children: _jsx(EditorActionIcon, { action: "done" }) }), hideLabel: true, focusOnMount: true, label: `Edit ${type.toLowerCase()} on canvas`, markdown: text, onChange: onChange }) }) }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import type { BootstrapBlock } from "./bootstrapRegistry.js";
|
|
3
|
+
type BlockSurface = HTMLAttributes<HTMLElement> & Readonly<{
|
|
4
|
+
ref?: (node: HTMLElement | null) => void;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const INTERACTIVE_BLOCK_TYPES: readonly ["Group", "Ratio", "Accordion", "AccordionItem", "Tabs", "Tab", "Button", "ButtonGroup", "Reveal", "Tooltip", "Popover", "Carousel", "CarouselItem", "Progress", "Modal", "Offcanvas", "Dropdown", "DropdownItem", "Toast", "FormControl", "FormSelect", "FormRange", "PracticeInput", "PracticeSelect", "PracticeCheck", "PracticeRange", "Breadcrumb", "BreadcrumbItem", "Video", "Audio", "Embed"];
|
|
7
|
+
type InteractiveType = (typeof INTERACTIVE_BLOCK_TYPES)[number];
|
|
8
|
+
export type InteractiveBlock = Extract<BootstrapBlock, {
|
|
9
|
+
type: InteractiveType;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function isInteractiveBlock(block: BootstrapBlock): block is InteractiveBlock;
|
|
12
|
+
export declare function InteractiveBootstrapBlock({ block, children, shared, }: Readonly<{
|
|
13
|
+
block: InteractiveBlock;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
shared: BlockSurface;
|
|
16
|
+
}>): import("react").JSX.Element;
|
|
17
|
+
export {};
|