oasis-editor 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/__tests__/app/PersistenceService.test.d.ts +1 -0
- package/dist/__tests__/app/footnoteUiCommands.test.d.ts +1 -0
- package/dist/__tests__/commands/text.test.d.ts +1 -0
- package/dist/__tests__/core/editorPluginIntegration.test.d.ts +1 -0
- package/dist/__tests__/core/editorState.test.d.ts +1 -0
- package/dist/__tests__/core/footnotes.test.d.ts +1 -0
- package/dist/__tests__/core/model.test.d.ts +1 -0
- package/dist/__tests__/core/pluginCollection.test.d.ts +1 -0
- package/dist/__tests__/core/tableCommands.test.d.ts +1 -0
- package/dist/__tests__/export/docxExport.test.d.ts +1 -0
- package/dist/__tests__/export/footnotesExport.test.d.ts +1 -0
- package/dist/__tests__/export/pdfWriter.test.d.ts +1 -0
- package/dist/__tests__/export/underlineStyle.test.d.ts +1 -0
- package/dist/__tests__/import/docxComplexSmoke.test.d.ts +1 -0
- package/dist/__tests__/import/docxImport.test.d.ts +1 -0
- package/dist/__tests__/import/footnotesImport.test.d.ts +1 -0
- package/dist/__tests__/integration/documentFlow.test.d.ts +1 -0
- package/dist/__tests__/ui/CanvasTableLayout.test.d.ts +1 -0
- package/dist/__tests__/ui/canvasHitTestService.test.d.ts +1 -0
- package/dist/__tests__/ui/canvasLayoutSnapshot.test.d.ts +1 -0
- package/dist/__tests__/ui/canvasSelectionGeometry.test.d.ts +1 -0
- package/dist/__tests__/ui/canvasTextRendering.test.d.ts +1 -0
- package/dist/__tests__/ui/composeMeasuredParagraphLines.test.d.ts +1 -0
- package/dist/__tests__/ui/dialog.test.d.ts +1 -0
- package/dist/__tests__/ui/fontDialog.test.d.ts +1 -0
- package/dist/__tests__/ui/footnotesLayout.test.d.ts +1 -0
- package/dist/__tests__/ui/layoutIdentity.test.d.ts +1 -0
- package/dist/__tests__/ui/layoutProjection.test.d.ts +1 -0
- package/dist/__tests__/ui/registry.test.d.ts +1 -0
- package/dist/__tests__/ui/tabs.test.d.ts +1 -0
- package/dist/__tests__/ui/textMeasurementAlignment.test.d.ts +1 -0
- package/dist/__tests__/word-parity/fixtures/corpus.d.ts +10 -0
- package/dist/__tests__/word-parity/fixtures/loremFixtures.d.ts +8 -0
- package/dist/__tests__/word-parity/wordLayout.word-parity.d.ts +1 -0
- package/dist/app/bootstrap/createOasisEditorApp.d.ts +6 -0
- package/dist/app/bootstrap/createOasisEditorContainer.d.ts +6 -0
- package/dist/app/clipboard/htmlClipboardParser.d.ts +3 -0
- package/dist/app/controllers/EditorCommandRegistry.d.ts +23 -0
- package/dist/app/controllers/EditorCommandsController.d.ts +53 -0
- package/dist/app/controllers/documentIO/DocumentExporter.d.ts +11 -0
- package/dist/app/controllers/documentIO/DocumentImporter.d.ts +17 -0
- package/dist/app/controllers/documentIO/ImageInsertionService.d.ts +14 -0
- package/dist/app/controllers/documentIO/downloadBlob.d.ts +1 -0
- package/dist/app/controllers/tableOpsCellSpanCommands.d.ts +21 -0
- package/dist/app/controllers/tableOpsGuards.d.ts +19 -0
- package/dist/app/controllers/tableOpsMutationCommands.d.ts +4 -0
- package/dist/app/controllers/tableOpsRowColumnCommands.d.ts +12 -0
- package/dist/app/controllers/tableOpsSelectionAwareCommands.d.ts +20 -0
- package/dist/app/controllers/tableOpsSelectionNavigation.d.ts +7 -0
- package/dist/app/controllers/tableOpsSelectionRanges.d.ts +34 -0
- package/dist/app/controllers/useEditorClipboard.d.ts +28 -0
- package/dist/app/controllers/useEditorDocumentIO.d.ts +31 -0
- package/dist/app/controllers/useEditorFindReplace.d.ts +28 -0
- package/dist/app/controllers/useEditorHistoryActions.d.ts +21 -0
- package/dist/app/controllers/useEditorImageOperations.d.ts +72 -0
- package/dist/app/controllers/useEditorKeyboard.d.ts +50 -0
- package/dist/app/controllers/useEditorLayout.d.ts +42 -0
- package/dist/app/controllers/useEditorNavigation.d.ts +22 -0
- package/dist/app/controllers/useEditorPersistence.d.ts +16 -0
- package/dist/app/controllers/useEditorRevision.d.ts +12 -0
- package/dist/app/controllers/useEditorStyle.d.ts +23 -0
- package/dist/app/controllers/useEditorSurfaceEvents.d.ts +44 -0
- package/dist/app/controllers/useEditorTableDrag.d.ts +29 -0
- package/dist/app/controllers/useEditorTableOperations.d.ts +45 -0
- package/dist/app/controllers/useEditorTableResize.d.ts +32 -0
- package/dist/app/controllers/useEditorTextDrag.d.ts +38 -0
- package/dist/app/controllers/useEditorTextInput.d.ts +27 -0
- package/dist/app/services/FindReplaceService.d.ts +12 -0
- package/dist/app/services/PersistenceService.d.ts +11 -0
- package/dist/assets/Arimo-Bold.ttf +0 -0
- package/dist/assets/Arimo-BoldItalic.ttf +0 -0
- package/dist/assets/Arimo-Italic.ttf +0 -0
- package/dist/assets/Arimo-Regular.ttf +0 -0
- package/dist/assets/Carlito-Bold.ttf +0 -0
- package/dist/assets/Carlito-BoldItalic.ttf +0 -0
- package/dist/assets/Carlito-Italic.ttf +0 -0
- package/dist/assets/Carlito-Regular.ttf +0 -0
- package/dist/assets/Roboto-Italic.ttf +0 -0
- package/dist/assets/Roboto-Medium.ttf +0 -0
- package/dist/assets/Roboto-MediumItalic.ttf +0 -0
- package/dist/assets/Roboto-Regular.ttf +0 -0
- package/dist/assets/Tinos-Bold.ttf +0 -0
- package/dist/assets/Tinos-BoldItalic.ttf +0 -0
- package/dist/assets/Tinos-Italic.ttf +0 -0
- package/dist/assets/Tinos-Regular.ttf +0 -0
- package/dist/assets/importDocxWorker-DIQ28Lka.js +12 -0
- package/dist/core/Editor.d.ts +33 -0
- package/dist/core/cloneState.d.ts +8 -0
- package/dist/core/commands/CommandBus.d.ts +9 -0
- package/dist/core/commands/CommandRef.d.ts +10 -0
- package/dist/core/commands/CommandRegistry.d.ts +10 -0
- package/dist/core/commands/block.d.ts +11 -0
- package/dist/core/commands/clipboard.d.ts +13 -0
- package/dist/core/commands/footnotes.d.ts +27 -0
- package/dist/core/commands/history.d.ts +7 -0
- package/dist/core/commands/image.d.ts +15 -0
- package/dist/core/commands/link.d.ts +4 -0
- package/dist/core/commands/list.d.ts +10 -0
- package/dist/core/commands/misc.d.ts +3 -0
- package/dist/core/commands/selection.d.ts +12 -0
- package/dist/core/commands/table.d.ts +10 -0
- package/dist/core/commands/text.d.ts +12 -0
- package/dist/core/commands/utils.d.ts +69 -0
- package/dist/core/editorCommands.d.ts +14 -0
- package/dist/core/editorState.d.ts +66 -0
- package/dist/core/engine.d.ts +13 -0
- package/dist/core/footnotes.d.ts +42 -0
- package/dist/core/headings.d.ts +9 -0
- package/dist/core/model/queries.d.ts +8 -0
- package/dist/core/model.d.ts +447 -0
- package/dist/core/plugin.d.ts +64 -0
- package/dist/core/plugins/PluginCollection.d.ts +16 -0
- package/dist/core/selection.d.ts +19 -0
- package/dist/core/tableLayout.d.ts +13 -0
- package/dist/core/textStyleMappings.d.ts +8 -0
- package/dist/core/wordBoundaries.d.ts +7 -0
- package/dist/demo/OasisSiteApp.d.ts +1 -0
- package/dist/export/docx/docxTypes.d.ts +66 -0
- package/dist/export/docx/exportEditorDocumentToDocx.d.ts +4 -0
- package/dist/export/docx/footnotesXml.d.ts +40 -0
- package/dist/export/docx/tableXml.d.ts +4 -0
- package/dist/export/docx/textXml.d.ts +6 -0
- package/dist/export/docx/xmlUtils.d.ts +10 -0
- package/dist/export/pdf/OasisPdfWriter.d.ts +93 -0
- package/dist/export/pdf/draw/drawBlockList.d.ts +5 -0
- package/dist/export/pdf/draw/drawFragment.d.ts +7 -0
- package/dist/export/pdf/draw/drawPageBackground.d.ts +3 -0
- package/dist/export/pdf/draw/drawParagraph.d.ts +5 -0
- package/dist/export/pdf/draw/drawTable.d.ts +5 -0
- package/dist/export/pdf/draw/fragmentGeometry.d.ts +12 -0
- package/dist/export/pdf/draw/lists.d.ts +6 -0
- package/dist/export/pdf/exportEditorDocumentToPdf.d.ts +4 -0
- package/dist/export/pdf/fonts/PdfFontRegistry.d.ts +28 -0
- package/dist/export/pdf/fonts/collectPdfFontFamilies.d.ts +3 -0
- package/dist/export/pdf/images.d.ts +4 -0
- package/dist/export/pdf/layout/PdfTextMeasurer.d.ts +24 -0
- package/dist/export/pdf/layout/layoutParagraph.d.ts +37 -0
- package/dist/export/pdf/units.d.ts +6 -0
- package/dist/i18n/index.d.ts +7 -0
- package/dist/i18n/locales/en.d.ts +251 -0
- package/dist/i18n/locales/pt-BR.d.ts +251 -0
- package/dist/import/docx/assetRegistry.d.ts +18 -0
- package/dist/import/docx/footnotes.d.ts +17 -0
- package/dist/import/docx/headerFooter.d.ts +7 -0
- package/dist/import/docx/importDocxInWorker.d.ts +8 -0
- package/dist/import/docx/importDocxToEditorDocument.d.ts +7 -0
- package/dist/import/docx/importDocxWorker.d.ts +1 -0
- package/dist/import/docx/numbering.d.ts +9 -0
- package/dist/import/docx/paragraphs.d.ts +12 -0
- package/dist/import/docx/relationships.d.ts +4 -0
- package/dist/import/docx/runs.d.ts +41 -0
- package/dist/import/docx/sectionProperties.d.ts +16 -0
- package/dist/import/docx/settings.d.ts +4 -0
- package/dist/import/docx/styles.d.ts +24 -0
- package/dist/import/docx/tables.d.ts +8 -0
- package/dist/import/docx/themeFonts.d.ts +12 -0
- package/dist/import/docx/units.d.ts +9 -0
- package/dist/import/docx/xmlHelpers.d.ts +15 -0
- package/dist/index.d.ts +43 -0
- package/dist/layoutProjection/blockHeights.d.ts +1 -0
- package/dist/layoutProjection/blocksPagination.d.ts +18 -0
- package/dist/layoutProjection/constants.d.ts +1 -0
- package/dist/layoutProjection/documentLayout.d.ts +7 -0
- package/dist/layoutProjection/footnotePagination.d.ts +21 -0
- package/dist/layoutProjection/headerFooterFootnotes.d.ts +4 -0
- package/dist/layoutProjection/headerFooterProjection.d.ts +14 -0
- package/dist/layoutProjection/index.d.ts +7 -0
- package/dist/layoutProjection/paragraphPagination.d.ts +20 -0
- package/dist/layoutProjection/paragraphProjection.d.ts +1 -0
- package/dist/layoutProjection/sectionPagination.d.ts +35 -0
- package/dist/layoutProjection/tablePagination.d.ts +14 -0
- package/dist/layoutProjection/tableProjection.d.ts +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/oasis-editor.css +1 -0
- package/dist/oasis-editor.js +80464 -0
- package/dist/oasis-editor.umd.cjs +24 -0
- package/dist/plugins/internal/createEssentialsPlugin.d.ts +135 -0
- package/dist/plugins/internal/essentialsCommandBuilders.d.ts +10 -0
- package/dist/plugins/internal/essentialsCommandGroups.d.ts +39 -0
- package/dist/testing/wordLayoutParity.d.ts +62 -0
- package/dist/ui/OasisEditorApp.d.ts +4 -0
- package/dist/ui/OasisEditorAppProps.d.ts +49 -0
- package/dist/ui/OasisEditorContainer.d.ts +6 -0
- package/dist/ui/OasisEditorEditor.d.ts +103 -0
- package/dist/ui/app/EditorDialogsLayer.d.ts +26 -0
- package/dist/ui/app/EditorDragLayers.d.ts +20 -0
- package/dist/ui/app/EditorWorkspace.d.ts +37 -0
- package/dist/ui/app/buildEditorViewProps.d.ts +59 -0
- package/dist/ui/app/createEditorEssentialsPlugin.d.ts +42 -0
- package/dist/ui/app/createRuntimeCommandHost.d.ts +29 -0
- package/dist/ui/app/fontOptions.d.ts +5 -0
- package/dist/ui/app/shouldShowCaret.d.ts +9 -0
- package/dist/ui/app/useCanvasSurfaceHitResolver.d.ts +16 -0
- package/dist/ui/app/useEditorAppState.d.ts +11 -0
- package/dist/ui/app/useEditorContextMenuClipboard.d.ts +33 -0
- package/dist/ui/app/useEditorDialogs.d.ts +38 -0
- package/dist/ui/app/useEditorFocus.d.ts +11 -0
- package/dist/ui/app/useEditorFontOptions.d.ts +17 -0
- package/dist/ui/app/useEditorInteractionWiring.d.ts +64 -0
- package/dist/ui/app/useEditorRuntimeBootstrap.d.ts +33 -0
- package/dist/ui/app/useEditorRuntimePlugins.d.ts +14 -0
- package/dist/ui/app/useEditorTransactions.d.ts +20 -0
- package/dist/ui/app/useEditorUiOptions.d.ts +24 -0
- package/dist/ui/app/useFontDialogBridge.d.ts +31 -0
- package/dist/ui/canvas/CanvasDebug.d.ts +125 -0
- package/dist/ui/canvas/CanvasGeometry.d.ts +35 -0
- package/dist/ui/canvas/CanvasHitTestService.d.ts +37 -0
- package/dist/ui/canvas/CanvasLayoutSnapshot.d.ts +93 -0
- package/dist/ui/canvas/CanvasSelectionGeometry.d.ts +20 -0
- package/dist/ui/canvas/CanvasTableLayout.d.ts +65 -0
- package/dist/ui/canvas/canvasBlockPainter.d.ts +4 -0
- package/dist/ui/canvas/canvasImageCache.d.ts +1 -0
- package/dist/ui/canvas/canvasPageRenderer.d.ts +18 -0
- package/dist/ui/canvas/canvasParagraphPainter.d.ts +12 -0
- package/dist/ui/canvas/canvasTablePainter.d.ts +3 -0
- package/dist/ui/canvas/listNumbering.d.ts +3 -0
- package/dist/ui/caretGeometry.d.ts +30 -0
- package/dist/ui/clipboardImage.d.ts +2 -0
- package/dist/ui/components/CanvasEditorSurface.d.ts +5 -0
- package/dist/ui/components/CaretOverlay.d.ts +9 -0
- package/dist/ui/components/ContextMenu/ContextMenu.d.ts +19 -0
- package/dist/ui/components/Dialogs/Dialog.d.ts +17 -0
- package/dist/ui/components/Dialogs/FontDialog.d.ts +67 -0
- package/dist/ui/components/Dialogs/FontDialogModel.d.ts +15 -0
- package/dist/ui/components/Dialogs/ImageAltDialog.d.ts +8 -0
- package/dist/ui/components/Dialogs/LineSpacingDialog.d.ts +17 -0
- package/dist/ui/components/Dialogs/LinkDialog.d.ts +8 -0
- package/dist/ui/components/DropCaret.d.ts +16 -0
- package/dist/ui/components/FindReplace/FindReplaceDialog.d.ts +7 -0
- package/dist/ui/components/FloatingToolbar/FloatingTableToolbar.d.ts +11 -0
- package/dist/ui/components/Menubar/Menubar.d.ts +7 -0
- package/dist/ui/components/Menubar/defaultMenuItems.d.ts +3 -0
- package/dist/ui/components/Menubar/menuRegistry.d.ts +28 -0
- package/dist/ui/components/Outline/OutlinePanel.d.ts +10 -0
- package/dist/ui/components/PageBreak.d.ts +4 -0
- package/dist/ui/components/RevisionOverlay.d.ts +6 -0
- package/dist/ui/components/SelectionOverlay.d.ts +11 -0
- package/dist/ui/components/Tabs/Tabs.d.ts +18 -0
- package/dist/ui/components/TitleBar/TitleBar.d.ts +6 -0
- package/dist/ui/components/Toolbar/LineSpacingButton.d.ts +6 -0
- package/dist/ui/components/Toolbar/Toolbar.d.ts +15 -0
- package/dist/ui/components/Toolbar/ToolbarOverflowManager.d.ts +13 -0
- package/dist/ui/components/Toolbar/controls/ListOptionsControl.d.ts +7 -0
- package/dist/ui/components/Toolbar/controls/UnderlineControl.d.ts +10 -0
- package/dist/ui/components/Toolbar/groups/MetricGroup.d.ts +6 -0
- package/dist/ui/components/Toolbar/groups/SectionGroup.d.ts +6 -0
- package/dist/ui/components/Toolbar/groups/TableGroup.d.ts +6 -0
- package/dist/ui/components/Toolbar/presets/defaultPalette.d.ts +4 -0
- package/dist/ui/components/Toolbar/presets/defaultToolbar.d.ts +9 -0
- package/dist/ui/components/Toolbar/primitives/Button.d.ts +11 -0
- package/dist/ui/components/Toolbar/primitives/ColorPicker.d.ts +22 -0
- package/dist/ui/components/Toolbar/primitives/GridPicker.d.ts +12 -0
- package/dist/ui/components/Toolbar/primitives/Menu.d.ts +20 -0
- package/dist/ui/components/Toolbar/primitives/Popover.d.ts +34 -0
- package/dist/ui/components/Toolbar/primitives/Select.d.ts +12 -0
- package/dist/ui/components/Toolbar/primitives/Separator.d.ts +6 -0
- package/dist/ui/components/Toolbar/primitives/SplitButton.d.ts +30 -0
- package/dist/ui/components/Toolbar/primitives/useDismiss.d.ts +15 -0
- package/dist/ui/components/Toolbar/primitives/usePopoverPosition.d.ts +31 -0
- package/dist/ui/components/Toolbar/registry/ToolbarRegistry.d.ts +23 -0
- package/dist/ui/components/Toolbar/renderers/ToolbarItemRenderer.d.ts +13 -0
- package/dist/ui/components/Toolbar/renderers/renderers.d.ts +14 -0
- package/dist/ui/components/Toolbar/schema/items.d.ts +136 -0
- package/dist/ui/components/Toolbar/schema/palette.d.ts +15 -0
- package/dist/ui/components/Toolbar/state/bindItem.d.ts +28 -0
- package/dist/ui/components/Toolbar/state/createToolbarApi.d.ts +14 -0
- package/dist/ui/components/Toolbar/underlineStyles.d.ts +16 -0
- package/dist/ui/editorHistory.d.ts +25 -0
- package/dist/ui/editorUiTypes.d.ts +65 -0
- package/dist/ui/imageGeometry.d.ts +15 -0
- package/dist/ui/layoutIdentity.d.ts +23 -0
- package/dist/ui/layoutInvalidation.d.ts +9 -0
- package/dist/ui/mount.d.ts +10 -0
- package/dist/ui/shells/BalloonShell.d.ts +3 -0
- package/dist/ui/shells/DocumentShell.d.ts +29 -0
- package/dist/ui/shells/InlineShell.d.ts +3 -0
- package/dist/ui/tableGeometry.d.ts +16 -0
- package/dist/ui/tableUiUtils.d.ts +5 -0
- package/dist/ui/textMeasurement.d.ts +14 -0
- package/dist/ui/toolbarStyleState.d.ts +46 -0
- package/dist/ui/utils/IconManager.d.ts +2 -0
- package/dist/utils/indexeddb.d.ts +12 -0
- package/dist/utils/logger.d.ts +22 -0
- package/dist/utils/performanceMetrics.d.ts +58 -0
- package/dist/utils/throttle.d.ts +4 -0
- package/package.json +65 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Accessor } from '../../solid-js';
|
|
2
|
+
import { EditorLayoutParagraph, EditorState } from '../../../../core/model.js';
|
|
3
|
+
import { SurfaceHit } from '../../../canvas/CanvasHitTestService.js';
|
|
4
|
+
|
|
5
|
+
export declare function createCanvasSurfaceHitResolver(deps: {
|
|
6
|
+
state: Accessor<EditorState>;
|
|
7
|
+
surfaceRef: Accessor<HTMLDivElement | null>;
|
|
8
|
+
viewportRef: Accessor<HTMLElement | null>;
|
|
9
|
+
measuredBlockHeights: Accessor<Record<string, number>>;
|
|
10
|
+
measuredParagraphLayouts: Accessor<Record<string, EditorLayoutParagraph>>;
|
|
11
|
+
layoutMode: Accessor<"fast" | "wordParity">;
|
|
12
|
+
}): {
|
|
13
|
+
resolveSurfaceHitAtPoint: (clientX: number, clientY: number, _context?: {
|
|
14
|
+
forDrag?: boolean;
|
|
15
|
+
}) => SurfaceHit | null;
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EditorDocument, EditorState } from '../../../../core/model.js';
|
|
2
|
+
|
|
3
|
+
export declare function createEditorAppState(options: {
|
|
4
|
+
initialDocument?: EditorDocument;
|
|
5
|
+
initialState?: EditorState;
|
|
6
|
+
}): {
|
|
7
|
+
state: EditorState;
|
|
8
|
+
setStateSignal: import('../../solid-js').Setter<EditorState>;
|
|
9
|
+
commitState: (next: EditorState) => void;
|
|
10
|
+
getStateSnapshot: () => EditorState;
|
|
11
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EditorState } from '../../../../core/model.js';
|
|
2
|
+
import { ContextMenuItem } from '../../../components/ContextMenu/ContextMenu.js';
|
|
3
|
+
import { EditorLogger } from '../../../../utils/logger.js';
|
|
4
|
+
|
|
5
|
+
interface ContextMenuState {
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
export interface EditorContextMenuClipboardDeps {
|
|
11
|
+
state: () => EditorState;
|
|
12
|
+
isReadOnly: () => boolean;
|
|
13
|
+
logger: EditorLogger;
|
|
14
|
+
setContextMenu: (state: ContextMenuState) => void;
|
|
15
|
+
clearPreferredColumn: () => void;
|
|
16
|
+
resetTransactionGrouping: () => void;
|
|
17
|
+
applyTransactionalState: (producer: (current: EditorState) => EditorState, options?: {
|
|
18
|
+
mergeKey?: string;
|
|
19
|
+
}) => void;
|
|
20
|
+
applyTableAwareParagraphEdit: (state: EditorState, edit: (state: EditorState) => EditorState) => EditorState;
|
|
21
|
+
focusInput: () => void;
|
|
22
|
+
promptForLink: () => void;
|
|
23
|
+
openFontDialog: () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare function createEditorContextMenuClipboard(deps: EditorContextMenuClipboardDeps): {
|
|
26
|
+
buildContextMenuItems: () => ContextMenuItem[];
|
|
27
|
+
closeContextMenu: () => void;
|
|
28
|
+
handleEditorContextMenu: (event: MouseEvent) => void;
|
|
29
|
+
programmaticCopy: () => Promise<void>;
|
|
30
|
+
programmaticCut: () => Promise<void>;
|
|
31
|
+
programmaticPaste: () => Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FontDialogInitialValues } from '../../../components/Dialogs/FontDialog.js';
|
|
2
|
+
|
|
3
|
+
export declare function createEditorDialogs(): {
|
|
4
|
+
linkDialog: import('../../solid-js').Accessor<{
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
initialHref: string;
|
|
7
|
+
}>;
|
|
8
|
+
setLinkDialog: import('../../solid-js').Setter<{
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
initialHref: string;
|
|
11
|
+
}>;
|
|
12
|
+
imageAltDialog: import('../../solid-js').Accessor<{
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
initialAlt: string;
|
|
15
|
+
}>;
|
|
16
|
+
setImageAltDialog: import('../../solid-js').Setter<{
|
|
17
|
+
isOpen: boolean;
|
|
18
|
+
initialAlt: string;
|
|
19
|
+
}>;
|
|
20
|
+
contextMenu: import('../../solid-js').Accessor<{
|
|
21
|
+
isOpen: boolean;
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
}>;
|
|
25
|
+
setContextMenu: import('../../solid-js').Setter<{
|
|
26
|
+
isOpen: boolean;
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
}>;
|
|
30
|
+
fontDialog: import('../../solid-js').Accessor<{
|
|
31
|
+
isOpen: boolean;
|
|
32
|
+
initial: FontDialogInitialValues;
|
|
33
|
+
}>;
|
|
34
|
+
setFontDialog: import('../../solid-js').Setter<{
|
|
35
|
+
isOpen: boolean;
|
|
36
|
+
initial: FontDialogInitialValues;
|
|
37
|
+
}>;
|
|
38
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function createEditorFocusController(): {
|
|
2
|
+
focused: import('../../solid-js').Accessor<boolean>;
|
|
3
|
+
setFocused: import('../../solid-js').Setter<boolean>;
|
|
4
|
+
focusInput: () => void;
|
|
5
|
+
focusInputAfterPointerSelection: () => void;
|
|
6
|
+
viewportRef: HTMLDivElement | undefined;
|
|
7
|
+
surfaceRef: HTMLDivElement | undefined;
|
|
8
|
+
textareaRef: HTMLTextAreaElement | undefined;
|
|
9
|
+
importInputRef: HTMLInputElement | undefined;
|
|
10
|
+
imageInputRef: HTMLInputElement | undefined;
|
|
11
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EditorState } from '../../../../core/model.js';
|
|
2
|
+
import { ToolbarStyleState } from '../../../toolbarStyleState.js';
|
|
3
|
+
|
|
4
|
+
export interface EditorFontOptionsContext {
|
|
5
|
+
state: () => EditorState;
|
|
6
|
+
toolbarStyleState: () => ToolbarStyleState;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Owns the font-family / font-size option lists offered by the toolbar and font
|
|
10
|
+
* dialog, including the lazily-loaded local font catalogue. Keeps the local-font
|
|
11
|
+
* permission probe and its cache signal out of the composition root.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createEditorFontOptions(ctx: EditorFontOptionsContext): {
|
|
14
|
+
computeFontFamilyOptions: () => string[];
|
|
15
|
+
computeFontSizeOptions: () => number[];
|
|
16
|
+
loadLocalFontFamilyOptions: () => Promise<void>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { EditorState } from '../../../../core/model.js';
|
|
2
|
+
import { EditorLogger } from '../../../../utils/logger.js';
|
|
3
|
+
import { createEditorClipboardController } from '../../../../app/controllers/useEditorClipboard.js';
|
|
4
|
+
import { createEditorTableResize } from '../../../../app/controllers/useEditorTableResize.js';
|
|
5
|
+
import { createEditorTableDrag } from '../../../../app/controllers/useEditorTableDrag.js';
|
|
6
|
+
import { createEditorSurfaceEvents } from '../../../../app/controllers/useEditorSurfaceEvents.js';
|
|
7
|
+
import { createEditorTextInput } from '../../../../app/controllers/useEditorTextInput.js';
|
|
8
|
+
import { createEditorTextDrag } from '../../../../app/controllers/useEditorTextDrag.js';
|
|
9
|
+
import { createEditorNavigation } from '../../../../app/controllers/useEditorNavigation.js';
|
|
10
|
+
import { createEditorRevisionController } from '../../../../app/controllers/useEditorRevision.js';
|
|
11
|
+
import { createEditorTableOperations } from '../../../../app/controllers/useEditorTableOperations.js';
|
|
12
|
+
import { createEditorImageOperations } from '../../../../app/controllers/useEditorImageOperations.js';
|
|
13
|
+
import { createEditorStyleController } from '../../../../app/controllers/useEditorStyle.js';
|
|
14
|
+
|
|
15
|
+
type TableDragParams = Parameters<typeof createEditorTableDrag>[0];
|
|
16
|
+
type TextDragParams = Parameters<typeof createEditorTextDrag>[0];
|
|
17
|
+
type NavigationParams = Parameters<typeof createEditorNavigation>[0];
|
|
18
|
+
type ClipboardParams = Parameters<typeof createEditorClipboardController>[0];
|
|
19
|
+
/**
|
|
20
|
+
* Shared kernel + heavy operation controllers consumed by the interaction
|
|
21
|
+
* (gesture / input / clipboard / navigation) cluster. The heavy controllers
|
|
22
|
+
* (`tableOps`, `imageOps`, `styleController`) and the surface resolvers are
|
|
23
|
+
* cross-cutting and stay owned by the composition root; this hook only wires
|
|
24
|
+
* the pointer/keyboard interaction controllers on top of them.
|
|
25
|
+
*/
|
|
26
|
+
export interface EditorInteractionWiringContext {
|
|
27
|
+
state: EditorState;
|
|
28
|
+
applyState: NavigationParams["applyState"];
|
|
29
|
+
applyTransactionalState: TextDragParams["applyTransactionalState"];
|
|
30
|
+
isReadOnly: TextDragParams["isReadOnly"];
|
|
31
|
+
logger: EditorLogger;
|
|
32
|
+
focusInput: TableDragParams["focusInput"];
|
|
33
|
+
focusInputAfterPointerSelection: TextDragParams["focusInputAfterPointerSelection"];
|
|
34
|
+
clearPreferredColumn: TextDragParams["clearPreferredColumn"];
|
|
35
|
+
resetTransactionGrouping: TextDragParams["resetTransactionGrouping"];
|
|
36
|
+
surfaceRef: () => HTMLDivElement | undefined;
|
|
37
|
+
viewportRef: () => HTMLDivElement | undefined;
|
|
38
|
+
caretBox: NavigationParams["caretBox"];
|
|
39
|
+
preferredColumnX: NavigationParams["preferredColumnX"];
|
|
40
|
+
setPreferredColumnX: NavigationParams["setPreferredColumnX"];
|
|
41
|
+
resolveSurfaceHitAtPoint: TextDragParams["resolveSurfaceHitAtPoint"];
|
|
42
|
+
resolvePositionAtSurfacePoint: TableDragParams["resolvePositionAtSurfacePoint"];
|
|
43
|
+
tableOps: ReturnType<typeof createEditorTableOperations>;
|
|
44
|
+
imageOps: ReturnType<typeof createEditorImageOperations>;
|
|
45
|
+
styleController: ReturnType<typeof createEditorStyleController>;
|
|
46
|
+
getForcePlainTextPaste: () => boolean;
|
|
47
|
+
setForcePlainTextPaste: (value: boolean) => void;
|
|
48
|
+
insertImageFromFile: ClipboardParams["insertImageFromFile"];
|
|
49
|
+
}
|
|
50
|
+
export interface EditorInteractionWiring {
|
|
51
|
+
tableResize: ReturnType<typeof createEditorTableResize>;
|
|
52
|
+
tableDrag: ReturnType<typeof createEditorTableDrag>;
|
|
53
|
+
revisionController: ReturnType<typeof createEditorRevisionController>;
|
|
54
|
+
textDrag: ReturnType<typeof createEditorTextDrag>;
|
|
55
|
+
surfaceEvents: ReturnType<typeof createEditorSurfaceEvents>;
|
|
56
|
+
textInput: ReturnType<typeof createEditorTextInput>;
|
|
57
|
+
navigation: ReturnType<typeof createEditorNavigation>;
|
|
58
|
+
handleCopy: ReturnType<typeof createEditorClipboardController>["handleCopy"];
|
|
59
|
+
handleCut: ReturnType<typeof createEditorClipboardController>["handleCut"];
|
|
60
|
+
handlePaste: ReturnType<typeof createEditorClipboardController>["handlePaste"];
|
|
61
|
+
handleDrop: ReturnType<typeof createEditorClipboardController>["handleDrop"];
|
|
62
|
+
}
|
|
63
|
+
export declare function useEditorInteractionWiring(ctx: EditorInteractionWiringContext): EditorInteractionWiring;
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createEditorEssentialsRuntimePlugin } from '../../createEditorEssentialsPlugin.js';
|
|
2
|
+
import { useEditorRuntimePlugins } from '../../useEditorRuntimePlugins.js';
|
|
3
|
+
import { createRuntimeCommandHost } from '../../createRuntimeCommandHost.js';
|
|
4
|
+
|
|
5
|
+
type EssentialsPluginDeps = Parameters<typeof createEditorEssentialsRuntimePlugin>[0];
|
|
6
|
+
type RuntimePluginsConfig = Parameters<typeof useEditorRuntimePlugins>[0];
|
|
7
|
+
type RuntimeCommandHostConfig = Parameters<typeof createRuntimeCommandHost>[0];
|
|
8
|
+
type RuntimeCommandHost = ReturnType<typeof createRuntimeCommandHost>;
|
|
9
|
+
/**
|
|
10
|
+
* Bootstraps the plugin runtime: it builds the Essentials plugin, registers all
|
|
11
|
+
* runtime plugins / the toolbar registry, spins up the command host and owns the
|
|
12
|
+
* runtime's mount (initialize) and cleanup (dispose) lifecycle. The composition
|
|
13
|
+
* root only feeds the already-built controllers in and consumes the host facade.
|
|
14
|
+
*/
|
|
15
|
+
export interface EditorRuntimeBootstrapContext {
|
|
16
|
+
essentials: EssentialsPluginDeps;
|
|
17
|
+
externalPlugins: RuntimePluginsConfig["externalPlugins"];
|
|
18
|
+
customizeToolbar: RuntimePluginsConfig["customizeToolbar"];
|
|
19
|
+
initialDocument: RuntimeCommandHostConfig["initialDocument"];
|
|
20
|
+
focusEditor: RuntimeCommandHostConfig["focusEditor"];
|
|
21
|
+
logger: RuntimeCommandHostConfig["logger"];
|
|
22
|
+
onReady: RuntimeCommandHostConfig["onReady"];
|
|
23
|
+
onSettled: RuntimeCommandHostConfig["onSettled"];
|
|
24
|
+
}
|
|
25
|
+
export interface EditorRuntimeBootstrap {
|
|
26
|
+
toolbarRegistry: ReturnType<typeof useEditorRuntimePlugins>["toolbarRegistry"];
|
|
27
|
+
runtimeReady: RuntimeCommandHost["runtimeReady"];
|
|
28
|
+
runtimeEditor: RuntimeCommandHost["runtimeEditor"];
|
|
29
|
+
commandStateOf: RuntimeCommandHost["commandStateOf"];
|
|
30
|
+
toolbarHost: RuntimeCommandHost["toolbarHost"];
|
|
31
|
+
}
|
|
32
|
+
export declare function useEditorRuntimeBootstrap(ctx: EditorRuntimeBootstrapContext): EditorRuntimeBootstrap;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OasisPlugin } from '../../../../core/plugin.js';
|
|
2
|
+
import { ToolbarRegistry } from '../../../components/Toolbar/registry/ToolbarRegistry.js';
|
|
3
|
+
|
|
4
|
+
export interface EditorRuntimePluginsOptions {
|
|
5
|
+
essentialsPlugin: OasisPlugin;
|
|
6
|
+
externalPlugins?: OasisPlugin[];
|
|
7
|
+
customizeToolbar?: (registry: ToolbarRegistry) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface EditorRuntimePlugins {
|
|
10
|
+
runtimePlugins: OasisPlugin[];
|
|
11
|
+
toolbarRegistry: ToolbarRegistry;
|
|
12
|
+
dispose: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function useEditorRuntimePlugins(options: EditorRuntimePluginsOptions): EditorRuntimePlugins;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EditorState } from '../../../../core/model.js';
|
|
2
|
+
import { EditorHistoryState, EditorTransactionOptions } from '../../../editorHistory.js';
|
|
3
|
+
import { LayoutInvalidation } from '../../../../app/controllers/useEditorLayout.js';
|
|
4
|
+
|
|
5
|
+
export interface EditorTransactionsContext {
|
|
6
|
+
stateSnapshot: () => EditorState;
|
|
7
|
+
commitState: (state: EditorState) => void;
|
|
8
|
+
cloneState: (state: EditorState) => EditorState;
|
|
9
|
+
applyLayoutInvalidation: (invalidation: LayoutInvalidation) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function useEditorTransactions(ctx: EditorTransactionsContext): {
|
|
12
|
+
undoStack: import('../../solid-js').Accessor<EditorState[]>;
|
|
13
|
+
redoStack: import('../../solid-js').Accessor<EditorState[]>;
|
|
14
|
+
applyTransactionalState: (producer: (current: EditorState) => EditorState, options?: EditorTransactionOptions) => void;
|
|
15
|
+
applyHistoryState: (nextState: EditorState) => void;
|
|
16
|
+
resetTransactionGrouping: () => void;
|
|
17
|
+
updateHistoryState: (updater: (current: EditorHistoryState) => EditorHistoryState) => void;
|
|
18
|
+
getHistoryState: () => EditorHistoryState;
|
|
19
|
+
clearHistory: () => void;
|
|
20
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { InlineShell } from '../../../shells/InlineShell.js';
|
|
2
|
+
import { OasisEditorAppDocumentProps, OasisEditorAppUiProps, OasisEditorLoadingOptions } from '../../../OasisEditorAppProps.js';
|
|
3
|
+
|
|
4
|
+
export interface EditorUiOptionsContext {
|
|
5
|
+
ui: () => OasisEditorAppUiProps;
|
|
6
|
+
documentOptions: () => OasisEditorAppDocumentProps;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the editor's UI/document option accessors, applying defaults in one
|
|
10
|
+
* place so the composition root doesn't carry a dozen `?? default` getters.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createEditorUiOptions(ctx: EditorUiOptionsContext): {
|
|
13
|
+
showChrome: () => boolean;
|
|
14
|
+
showTitleBar: () => boolean;
|
|
15
|
+
showMenubar: () => boolean;
|
|
16
|
+
showToolbar: () => boolean;
|
|
17
|
+
showOutline: () => boolean;
|
|
18
|
+
layoutMode: () => "fast" | "wordParity";
|
|
19
|
+
isReadOnly: () => boolean;
|
|
20
|
+
useComposedShell: () => boolean;
|
|
21
|
+
loadingOptions: () => OasisEditorLoadingOptions | undefined;
|
|
22
|
+
loadingLabel: () => string;
|
|
23
|
+
shellComponent: () => typeof InlineShell;
|
|
24
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { EditorSelection, EditorState } from '../../../../core/model.js';
|
|
2
|
+
import { FontDialogApplyValues, FontDialogInitialValues } from '../../../components/Dialogs/FontDialog.js';
|
|
3
|
+
import { ToolbarStyleState } from '../../../toolbarStyleState.js';
|
|
4
|
+
|
|
5
|
+
interface FontDialogState {
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
initial: FontDialogInitialValues;
|
|
8
|
+
}
|
|
9
|
+
export interface FontDialogBridgeDeps {
|
|
10
|
+
toolbarStyleState: () => ToolbarStyleState;
|
|
11
|
+
selection: () => EditorSelection;
|
|
12
|
+
isReadOnly: () => boolean;
|
|
13
|
+
loadLocalFontFamilyOptions: () => Promise<void>;
|
|
14
|
+
setFontDialog: (state: FontDialogState) => void;
|
|
15
|
+
setContextMenu: (state: {
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}) => void;
|
|
20
|
+
clearPreferredColumn: () => void;
|
|
21
|
+
resetTransactionGrouping: () => void;
|
|
22
|
+
applyTransactionalState: (producer: (current: EditorState) => EditorState, options?: {
|
|
23
|
+
mergeKey?: string;
|
|
24
|
+
}) => void;
|
|
25
|
+
focusInput: () => void;
|
|
26
|
+
}
|
|
27
|
+
export declare function createFontDialogBridge(deps: FontDialogBridgeDeps): {
|
|
28
|
+
openFontDialog: () => void;
|
|
29
|
+
applyFontDialogValues: (values: FontDialogApplyValues, original: FontDialogInitialValues) => void;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { SurfaceHit } from '../../CanvasHitTestService.js';
|
|
2
|
+
import { CanvasLayoutSnapshot, CanvasSnapshotParagraph } from '../../CanvasLayoutSnapshot.js';
|
|
3
|
+
import { EditorEditingZone, EditorState } from '../../../../core/model.js';
|
|
4
|
+
|
|
5
|
+
export interface CanvasDebugMissEvent {
|
|
6
|
+
timestamp: number;
|
|
7
|
+
reason: string;
|
|
8
|
+
clientX: number;
|
|
9
|
+
clientY: number;
|
|
10
|
+
}
|
|
11
|
+
export interface CanvasDebugHitSnapshot {
|
|
12
|
+
timestamp: number;
|
|
13
|
+
zone: SurfaceHit["zone"];
|
|
14
|
+
paragraphId: string;
|
|
15
|
+
paragraphOffset: number;
|
|
16
|
+
source: SurfaceHit["source"];
|
|
17
|
+
missReason?: string;
|
|
18
|
+
resolvedFromParagraph: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface CanvasDebugLayoutSnapshot {
|
|
21
|
+
surfaceRect: {
|
|
22
|
+
left: number;
|
|
23
|
+
top: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
};
|
|
27
|
+
pages: Array<{
|
|
28
|
+
index: number;
|
|
29
|
+
left: number;
|
|
30
|
+
top: number;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
bodyTop: number;
|
|
34
|
+
bodyBottom: number;
|
|
35
|
+
}>;
|
|
36
|
+
paragraphs: Array<{
|
|
37
|
+
paragraphId: string;
|
|
38
|
+
paragraphIndex: number;
|
|
39
|
+
zone: CanvasSnapshotParagraph["zone"];
|
|
40
|
+
pageIndex: number;
|
|
41
|
+
startOffset: number;
|
|
42
|
+
endOffset: number;
|
|
43
|
+
textLength: number;
|
|
44
|
+
left: number;
|
|
45
|
+
top: number;
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
lines: Array<{
|
|
49
|
+
startOffset: number;
|
|
50
|
+
endOffset: number;
|
|
51
|
+
top: number;
|
|
52
|
+
height: number;
|
|
53
|
+
slots: Array<{
|
|
54
|
+
offset: number;
|
|
55
|
+
left: number;
|
|
56
|
+
top: number;
|
|
57
|
+
height: number;
|
|
58
|
+
}>;
|
|
59
|
+
}>;
|
|
60
|
+
tableCell?: {
|
|
61
|
+
tableId: string;
|
|
62
|
+
rowIndex: number;
|
|
63
|
+
cellIndex: number;
|
|
64
|
+
left: number;
|
|
65
|
+
top: number;
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
};
|
|
69
|
+
}>;
|
|
70
|
+
inlineImages: Array<{
|
|
71
|
+
paragraphId: string;
|
|
72
|
+
paragraphIndex: number;
|
|
73
|
+
zone: EditorEditingZone;
|
|
74
|
+
pageIndex: number;
|
|
75
|
+
startOffset: number;
|
|
76
|
+
endOffset: number;
|
|
77
|
+
left: number;
|
|
78
|
+
top: number;
|
|
79
|
+
width: number;
|
|
80
|
+
height: number;
|
|
81
|
+
}>;
|
|
82
|
+
unsupportedRegions: Array<{
|
|
83
|
+
pageIndex: number;
|
|
84
|
+
zone: EditorEditingZone;
|
|
85
|
+
left: number;
|
|
86
|
+
top: number;
|
|
87
|
+
width: number;
|
|
88
|
+
height: number;
|
|
89
|
+
reason: string;
|
|
90
|
+
}>;
|
|
91
|
+
}
|
|
92
|
+
export interface OasisCanvasDebugApi {
|
|
93
|
+
getLastHit: () => CanvasDebugHitSnapshot | null;
|
|
94
|
+
getLayoutSnapshot: () => CanvasDebugLayoutSnapshot | null;
|
|
95
|
+
getSelection: () => CanvasDebugSelectionSnapshot | null;
|
|
96
|
+
getMissEvents: () => CanvasDebugMissEvent[];
|
|
97
|
+
clearMissEvents: () => void;
|
|
98
|
+
}
|
|
99
|
+
declare global {
|
|
100
|
+
interface Window {
|
|
101
|
+
__oasisCanvasDebug?: OasisCanvasDebugApi;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export interface CanvasDebugSelectionSnapshot {
|
|
105
|
+
anchor: {
|
|
106
|
+
paragraphId: string;
|
|
107
|
+
runId: string;
|
|
108
|
+
offset: number;
|
|
109
|
+
};
|
|
110
|
+
focus: {
|
|
111
|
+
paragraphId: string;
|
|
112
|
+
runId: string;
|
|
113
|
+
offset: number;
|
|
114
|
+
};
|
|
115
|
+
activeZone: EditorEditingZone;
|
|
116
|
+
activeSectionIndex: number;
|
|
117
|
+
}
|
|
118
|
+
export declare function syncCanvasDebugApiVisibility(): void;
|
|
119
|
+
export declare function recordCanvasDebugHit(hit: SurfaceHit | null): void;
|
|
120
|
+
export declare function recordCanvasDebugLayoutSnapshot(snapshot: CanvasLayoutSnapshot | null): void;
|
|
121
|
+
export declare function recordCanvasDebugSelection(state: EditorState): void;
|
|
122
|
+
export declare function recordCanvasDebugMissEvent(reason: string, details: {
|
|
123
|
+
clientX: number;
|
|
124
|
+
clientY: number;
|
|
125
|
+
}): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { EditorPosition } from '../../../../core/model.js';
|
|
2
|
+
import { CanvasLayoutSnapshot, CanvasSnapshotParagraph } from '../../CanvasLayoutSnapshot.js';
|
|
3
|
+
|
|
4
|
+
export interface CanvasRectLike {
|
|
5
|
+
left: number;
|
|
6
|
+
top: number;
|
|
7
|
+
right: number;
|
|
8
|
+
bottom: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
export interface CanvasCharRect {
|
|
13
|
+
left: number;
|
|
14
|
+
right: number;
|
|
15
|
+
top: number;
|
|
16
|
+
bottom: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}
|
|
19
|
+
export declare function getParagraphEntries(snapshot: CanvasLayoutSnapshot, paragraphId: string): CanvasSnapshotParagraph[];
|
|
20
|
+
export declare function getParagraphRectFromSnapshot(snapshot: CanvasLayoutSnapshot, paragraphId: string, boundary?: "start" | "end"): CanvasRectLike | null;
|
|
21
|
+
export declare function getCaretRectFromSnapshot(snapshot: CanvasLayoutSnapshot, position: EditorPosition, paragraphOffset: number): CanvasRectLike | null;
|
|
22
|
+
/**
|
|
23
|
+
* Equivalent to the legacy `collectParagraphCharRects` but derived entirely
|
|
24
|
+
* from the canvas snapshot. Returns one rect per visual character slot in
|
|
25
|
+
* paragraph order (across page splits when a paragraph spans multiple pages).
|
|
26
|
+
*/
|
|
27
|
+
export declare function collectParagraphCharRectsFromSnapshot(snapshot: CanvasLayoutSnapshot, paragraphId: string): CanvasCharRect[];
|
|
28
|
+
/**
|
|
29
|
+
* Resolves the absolute viewport `y` for the first/last line of a paragraph
|
|
30
|
+
* (used by Outline / DocumentShell scroll-to-paragraph).
|
|
31
|
+
*/
|
|
32
|
+
export declare function getParagraphScrollAnchor(snapshot: CanvasLayoutSnapshot, paragraphId: string): {
|
|
33
|
+
left: number;
|
|
34
|
+
top: number;
|
|
35
|
+
} | null;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { EditorEditingZone, EditorPosition, EditorState } from '../../../../core/model.js';
|
|
2
|
+
import { CanvasLayoutSnapshot } from '../../CanvasLayoutSnapshot.js';
|
|
3
|
+
|
|
4
|
+
export interface SurfaceHitImage {
|
|
5
|
+
paragraphId: string;
|
|
6
|
+
paragraphOffset: number;
|
|
7
|
+
startOffset: number;
|
|
8
|
+
endOffset: number;
|
|
9
|
+
left: number;
|
|
10
|
+
top: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}
|
|
14
|
+
export interface SurfaceHit {
|
|
15
|
+
zone: EditorEditingZone;
|
|
16
|
+
footnoteId?: string;
|
|
17
|
+
paragraphId: string;
|
|
18
|
+
paragraphOffset: number;
|
|
19
|
+
position: EditorPosition;
|
|
20
|
+
source: "canvas-layout";
|
|
21
|
+
missReason?: string;
|
|
22
|
+
resolvedFromParagraph: boolean;
|
|
23
|
+
tableCellAnchorPosition?: EditorPosition;
|
|
24
|
+
caretViewport?: {
|
|
25
|
+
left: number;
|
|
26
|
+
top: number;
|
|
27
|
+
height: number;
|
|
28
|
+
};
|
|
29
|
+
image?: SurfaceHitImage;
|
|
30
|
+
}
|
|
31
|
+
export interface ResolveCanvasHitOptions {
|
|
32
|
+
snapshot: CanvasLayoutSnapshot;
|
|
33
|
+
state: EditorState;
|
|
34
|
+
clientX: number;
|
|
35
|
+
clientY: number;
|
|
36
|
+
}
|
|
37
|
+
export declare function resolveCanvasSurfaceHitAtPoint(options: ResolveCanvasHitOptions): SurfaceHit | null;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { EditorEditingZone, EditorLayoutParagraph, EditorParagraphNode, EditorPosition, EditorState } from '../../../../core/model.js';
|
|
2
|
+
import { CanvasUnsupportedReason } from '../../CanvasTableLayout.js';
|
|
3
|
+
|
|
4
|
+
export interface CanvasSnapshotSlot {
|
|
5
|
+
offset: number;
|
|
6
|
+
left: number;
|
|
7
|
+
top: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CanvasSnapshotLine {
|
|
11
|
+
startOffset: number;
|
|
12
|
+
endOffset: number;
|
|
13
|
+
top: number;
|
|
14
|
+
height: number;
|
|
15
|
+
slots: CanvasSnapshotSlot[];
|
|
16
|
+
}
|
|
17
|
+
export interface CanvasSnapshotTableCellInfo {
|
|
18
|
+
tableId: string;
|
|
19
|
+
rowIndex: number;
|
|
20
|
+
cellIndex: number;
|
|
21
|
+
left: number;
|
|
22
|
+
top: number;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
anchorPosition: EditorPosition;
|
|
26
|
+
}
|
|
27
|
+
export interface CanvasSnapshotParagraph {
|
|
28
|
+
paragraph: EditorParagraphNode;
|
|
29
|
+
paragraphId: string;
|
|
30
|
+
paragraphIndex: number;
|
|
31
|
+
zone: EditorEditingZone;
|
|
32
|
+
footnoteId?: string;
|
|
33
|
+
pageIndex: number;
|
|
34
|
+
startOffset: number;
|
|
35
|
+
endOffset: number;
|
|
36
|
+
textLength: number;
|
|
37
|
+
left: number;
|
|
38
|
+
top: number;
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
lines: CanvasSnapshotLine[];
|
|
42
|
+
tableCell?: CanvasSnapshotTableCellInfo;
|
|
43
|
+
}
|
|
44
|
+
export interface CanvasSnapshotInlineImage {
|
|
45
|
+
paragraphId: string;
|
|
46
|
+
paragraphIndex: number;
|
|
47
|
+
zone: EditorEditingZone;
|
|
48
|
+
footnoteId?: string;
|
|
49
|
+
pageIndex: number;
|
|
50
|
+
startOffset: number;
|
|
51
|
+
endOffset: number;
|
|
52
|
+
left: number;
|
|
53
|
+
top: number;
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
}
|
|
57
|
+
export interface CanvasSnapshotPage {
|
|
58
|
+
index: number;
|
|
59
|
+
left: number;
|
|
60
|
+
top: number;
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
bodyTop: number;
|
|
64
|
+
bodyBottom: number;
|
|
65
|
+
footerTop?: number;
|
|
66
|
+
footnoteTop?: number;
|
|
67
|
+
footnoteSeparatorTop?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface CanvasLayoutSnapshot {
|
|
70
|
+
surfaceRect: DOMRect;
|
|
71
|
+
pages: CanvasSnapshotPage[];
|
|
72
|
+
paragraphs: CanvasSnapshotParagraph[];
|
|
73
|
+
paragraphsById: Map<string, CanvasSnapshotParagraph[]>;
|
|
74
|
+
inlineImages: CanvasSnapshotInlineImage[];
|
|
75
|
+
unsupportedRegions: Array<{
|
|
76
|
+
pageIndex: number;
|
|
77
|
+
zone: EditorEditingZone;
|
|
78
|
+
footnoteId?: string;
|
|
79
|
+
left: number;
|
|
80
|
+
top: number;
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
reason: CanvasUnsupportedReason;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
export interface BuildCanvasLayoutSnapshotOptions {
|
|
87
|
+
surface: HTMLElement;
|
|
88
|
+
state: EditorState;
|
|
89
|
+
measuredBlockHeights?: Record<string, number>;
|
|
90
|
+
measuredParagraphLayouts?: Record<string, EditorLayoutParagraph>;
|
|
91
|
+
layoutMode?: "fast" | "wordParity";
|
|
92
|
+
}
|
|
93
|
+
export declare function buildCanvasLayoutSnapshot(options: BuildCanvasLayoutSnapshotOptions): CanvasLayoutSnapshot | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EditorState } from '../../../../core/model.js';
|
|
2
|
+
import { CaretBox, InputBox, SelectionBox } from '../../../editorUiTypes.js';
|
|
3
|
+
import { CanvasLayoutSnapshot } from '../../CanvasLayoutSnapshot.js';
|
|
4
|
+
|
|
5
|
+
export interface SelectedImageSelectionBox {
|
|
6
|
+
paragraphId: string;
|
|
7
|
+
startOffset: number;
|
|
8
|
+
endOffset: number;
|
|
9
|
+
left: number;
|
|
10
|
+
top: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}
|
|
14
|
+
export interface CanvasSelectionGeometryResult {
|
|
15
|
+
selectionBoxes: SelectionBox[];
|
|
16
|
+
caretBox: CaretBox;
|
|
17
|
+
inputBox: InputBox;
|
|
18
|
+
selectedImageBox: SelectedImageSelectionBox | null;
|
|
19
|
+
}
|
|
20
|
+
export declare function computeCanvasSelectionGeometry(snapshot: CanvasLayoutSnapshot, state: EditorState): CanvasSelectionGeometryResult;
|