@yuzhouu/canvas-kit 0.1.8 → 0.1.10
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 +158 -102
- package/_vendor/canvas-core/bindings/bindingUtil.d.ts +8 -0
- package/_vendor/canvas-core/editor/cameraPanSession.d.ts +9 -0
- package/_vendor/canvas-core/editor/canvasPanInteraction.d.ts +2 -0
- package/_vendor/canvas-core/editor/commands.d.ts +15 -3
- package/_vendor/canvas-core/editor/createEditorWithPlugins.d.ts +6 -0
- package/_vendor/canvas-core/editor/editor.d.ts +24 -26
- package/_vendor/canvas-core/editor/editorComputedHelpers.d.ts +4 -2
- package/_vendor/canvas-core/editor/historyManager.d.ts +22 -1
- package/_vendor/canvas-core/editor/index.d.ts +2 -2
- package/_vendor/canvas-core/editor/interactions.d.ts +10 -1
- package/_vendor/canvas-core/editor/managers/bindingManager.d.ts +1 -0
- package/_vendor/canvas-core/editor/managers/inputsManager.d.ts +3 -0
- package/_vendor/canvas-core/editor/managers/interactionTransientManager.d.ts +0 -26
- package/_vendor/canvas-core/editor/managers/queryManager.d.ts +13 -1
- package/_vendor/canvas-core/editor/managers/selectionLayoutManager.d.ts +2 -0
- package/_vendor/canvas-core/editor/managers/shapeGeometryManager.d.ts +3 -2
- package/_vendor/canvas-core/editor/managers/shapeHierarchyManager.d.ts +6 -2
- package/_vendor/canvas-core/editor/managers/shapeReparenting.d.ts +3 -2
- package/_vendor/canvas-core/editor/managers/snapTypes.d.ts +1 -0
- package/_vendor/canvas-core/editor/managers/spatialIndexManager.d.ts +1 -0
- package/_vendor/canvas-core/editor/queries/shapeTransforms.d.ts +32 -12
- package/_vendor/canvas-core/editor/selection.d.ts +19 -5
- package/_vendor/canvas-core/editor/selectionOverlay.d.ts +4 -3
- package/_vendor/canvas-core/editor/selectionResizeCapabilities.d.ts +9 -0
- package/_vendor/canvas-core/editor/shapeTransformSpace.d.ts +6 -0
- package/_vendor/canvas-core/exports/svg.d.ts +1 -0
- package/_vendor/canvas-core/geometry/index.d.ts +1 -0
- package/_vendor/canvas-core/geometry/mat.d.ts +6 -2
- package/_vendor/canvas-core/geometry/polygon.d.ts +7 -0
- package/_vendor/canvas-core/geometry/vec.d.ts +0 -2
- package/_vendor/canvas-core/index.d.ts +14 -20
- package/_vendor/canvas-core/plugins/editorRuntimePlugin.d.ts +4 -10
- package/_vendor/canvas-core/plugins/editorRuntimeRegistry.d.ts +19 -0
- package/_vendor/canvas-core/plugins/index.d.ts +2 -1
- package/_vendor/canvas-core/schema/records.d.ts +2 -7
- package/_vendor/canvas-core/schema/snapshots.d.ts +10 -19
- package/_vendor/canvas-core/shapes/colors.d.ts +1 -2
- package/_vendor/canvas-core/shapes/shapeUtil.d.ts +52 -14
- package/_vendor/canvas-core/tools/select/selectToolHelpers.d.ts +9 -6
- package/_vendor/canvas-core/tools/select/states/draggingSelectionHandleInteractionState.d.ts +3 -3
- package/_vendor/canvas-core/tools/select/states/pointingSelectionHandleInteractionState.d.ts +2 -1
- package/_vendor/canvas-plugin-sdk/actionRegistry.d.ts +7 -0
- package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/actions.d.ts +2 -4
- package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/contextMenu.d.ts +25 -30
- package/_vendor/canvas-plugin-sdk/contextMenuRegistry.d.ts +11 -0
- package/_vendor/canvas-plugin-sdk/index.d.ts +7 -0
- package/_vendor/canvas-plugin-sdk/plugin.d.ts +39 -0
- package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/toolbar.d.ts +32 -1
- package/_vendor/canvas-plugin-sdk/toolbarRegistry.d.ts +19 -0
- package/_vendor/canvas-react/components/CanvasView.d.ts +2 -2
- package/_vendor/canvas-react/components/canvasKeyboardEvents.d.ts +13 -0
- package/_vendor/canvas-react/components/useCanvasDomEvents.d.ts +4 -3
- package/_vendor/canvas-react/contextMenuRequest.d.ts +19 -0
- package/_vendor/canvas-react/host/canvasRenderPlugin.d.ts +7 -1
- package/_vendor/canvas-react/host/canvasRenderRuntime.d.ts +13 -0
- package/_vendor/canvas-react/host/domEventGuards.d.ts +3 -3
- package/_vendor/canvas-react/host/index.d.ts +2 -8
- package/_vendor/canvas-react/host/overlayRegistry.d.ts +3 -3
- package/_vendor/canvas-react/host/rendererRegistry.d.ts +7 -4
- package/_vendor/canvas-react/index.d.ts +1 -0
- package/_vendor/plugin-arrow/arrowGeometry.d.ts +6 -4
- package/_vendor/plugin-arrow/arrowShapeUtil.d.ts +5 -3
- package/_vendor/plugin-arrow/arrowTerminalCommands.d.ts +2 -2
- package/_vendor/plugin-arrow/canvasRender.d.ts +2 -2
- package/_vendor/plugin-arrow/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-arrow/feature.d.ts +2 -3
- package/_vendor/plugin-arrow/index.d.ts +2 -2
- package/_vendor/plugin-draw/canvasRender.d.ts +2 -2
- package/_vendor/plugin-draw/drawGeometry.d.ts +4 -7
- package/_vendor/plugin-draw/drawShapeUtil.d.ts +2 -2
- package/_vendor/plugin-draw/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-draw/feature.d.ts +2 -3
- package/_vendor/plugin-draw/index.d.ts +3 -3
- package/_vendor/plugin-eraser/canvasRender.d.ts +2 -2
- package/_vendor/plugin-eraser/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-eraser/eraserRuntime.d.ts +12 -0
- package/_vendor/plugin-eraser/feature.d.ts +2 -3
- package/_vendor/plugin-eraser/index.d.ts +3 -2
- package/_vendor/plugin-frame/canvasRender.d.ts +2 -2
- package/_vendor/plugin-frame/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-frame/feature.d.ts +2 -3
- package/_vendor/plugin-frame/frameShapeUtil.d.ts +4 -2
- package/_vendor/plugin-frame/index.d.ts +2 -2
- package/_vendor/plugin-geo/canvasRender.d.ts +2 -2
- package/_vendor/plugin-geo/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-geo/feature.d.ts +2 -3
- package/_vendor/plugin-geo/geoShapeUtil.d.ts +1 -1
- package/_vendor/plugin-geo/index.d.ts +2 -2
- package/_vendor/plugin-group/canvasRender.d.ts +2 -2
- package/_vendor/plugin-group/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-group/feature.d.ts +2 -3
- package/_vendor/plugin-group/groupContributions.d.ts +7 -0
- package/_vendor/plugin-group/groupShapeUtil.d.ts +24 -5
- package/_vendor/plugin-group/index.d.ts +3 -2
- package/_vendor/plugin-image/canvasRender.d.ts +2 -2
- package/_vendor/plugin-image/cropRuntime.d.ts +1 -1
- package/_vendor/plugin-image/cropSession.d.ts +5 -3
- package/_vendor/plugin-image/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-image/feature.d.ts +2 -3
- package/_vendor/plugin-image/imageHostActionContract.d.ts +1 -1
- package/_vendor/plugin-image/imageShapeUtil.d.ts +3 -3
- package/_vendor/plugin-image/index.d.ts +4 -4
- package/_vendor/plugin-image/runtimeShared.d.ts +1 -1
- package/_vendor/plugin-image/smudge.d.ts +13 -2
- package/_vendor/plugin-image/smudgeRuntime.d.ts +1 -1
- package/_vendor/plugin-image/styleRuntime.d.ts +1 -1
- package/_vendor/plugin-image/toolbarRuntime.d.ts +1 -1
- package/_vendor/plugin-laser/canvasRender.d.ts +2 -2
- package/_vendor/plugin-laser/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-laser/feature.d.ts +2 -3
- package/_vendor/plugin-laser/index.d.ts +3 -2
- package/_vendor/plugin-laser/laserRuntime.d.ts +18 -0
- package/_vendor/plugin-packaging/canvasRender.d.ts +2 -0
- package/_vendor/plugin-packaging/editorRuntime.d.ts +2 -0
- package/_vendor/plugin-packaging/feature.d.ts +2 -0
- package/_vendor/plugin-packaging/index.d.ts +17 -0
- package/_vendor/plugin-packaging/packagingArtwork.d.ts +5 -0
- package/_vendor/plugin-packaging/packagingDxf.d.ts +9 -0
- package/_vendor/plugin-packaging/packagingGeometry.d.ts +74 -0
- package/_vendor/plugin-packaging/packagingInteractions.d.ts +2 -0
- package/_vendor/plugin-packaging/packagingPdfExporter.d.ts +25 -0
- package/_vendor/plugin-packaging/packagingRuntime.d.ts +11 -0
- package/_vendor/plugin-packaging/packagingShapeUtil.d.ts +34 -0
- package/_vendor/plugin-packaging/packagingStyle.d.ts +10 -0
- package/_vendor/plugin-packaging/packagingSvgExporter.d.ts +7 -0
- package/_vendor/plugin-packaging/productRuntime.d.ts +2 -0
- package/_vendor/plugin-packaging/types.d.ts +168 -0
- package/_vendor/plugin-packaging/validation.d.ts +3 -0
- package/_vendor/plugin-path/PathDraftOverlay.d.ts +1 -0
- package/_vendor/plugin-path/PathEditInsertPreviewOverlay.d.ts +1 -0
- package/_vendor/plugin-path/PathShapeRenderer.d.ts +12 -0
- package/_vendor/plugin-path/canvasRender.d.ts +2 -0
- package/_vendor/plugin-path/editorRuntime.d.ts +21 -0
- package/_vendor/plugin-path/feature.d.ts +2 -0
- package/_vendor/plugin-path/index.d.ts +7 -0
- package/_vendor/plugin-path/pathBoolean.d.ts +13 -0
- package/_vendor/plugin-path/pathDraft.d.ts +10 -0
- package/_vendor/plugin-path/pathEditPreview.d.ts +11 -0
- package/_vendor/plugin-path/pathEditSelection.d.ts +24 -0
- package/_vendor/plugin-path/pathEditSnap.d.ts +6 -0
- package/_vendor/plugin-path/pathGeometry.d.ts +74 -0
- package/_vendor/plugin-path/pathHandles.d.ts +18 -0
- package/_vendor/plugin-path/pathInteractions.d.ts +7 -0
- package/_vendor/plugin-path/pathShapeUtil.d.ts +28 -0
- package/_vendor/plugin-path/pathSvg.d.ts +3 -0
- package/_vendor/plugin-path/pathTool.d.ts +39 -0
- package/_vendor/plugin-path/types.d.ts +36 -0
- package/_vendor/plugin-text/arrowLabelBindingUtil.d.ts +6 -1
- package/_vendor/plugin-text/canvasRender.d.ts +6 -3
- package/_vendor/plugin-text/editorRuntime.d.ts +9 -3
- package/_vendor/plugin-text/feature.d.ts +4 -4
- package/_vendor/plugin-text/geoLabelBindingUtil.d.ts +6 -1
- package/_vendor/plugin-text/host/RichTextEditingBox.d.ts +4 -1
- package/_vendor/plugin-text/host/TiptapTextEditor.d.ts +5 -2
- package/_vendor/plugin-text/host/richTextRendering.d.ts +0 -1
- package/_vendor/plugin-text/host/textFormattingApi.d.ts +16 -0
- package/_vendor/plugin-text/host/textShapeRendererRuntime.d.ts +3 -1
- package/_vendor/plugin-text/host/tiptapTextEditorController.d.ts +4 -1
- package/_vendor/plugin-text/index.d.ts +7 -4
- package/_vendor/plugin-text/richTextUtils.d.ts +6 -0
- package/_vendor/plugin-text/shapeWideTextFormatting.d.ts +8 -0
- package/_vendor/plugin-text/textFonts.d.ts +6 -3
- package/_vendor/plugin-text/textFormatting.d.ts +45 -0
- package/_vendor/plugin-text/textFormattingSession.d.ts +6 -0
- package/_vendor/plugin-text/textLabelHelpers.d.ts +9 -4
- package/_vendor/plugin-text/textLinkPopoverPresentation.d.ts +18 -0
- package/_vendor/plugin-text/textShapeHelpers.d.ts +1 -0
- package/_vendor/plugin-text/textShapeUtil.d.ts +5 -4
- package/_vendor/signals/effect.d.ts +0 -4
- package/_vendor/signals/index.d.ts +1 -1
- package/_vendor/store/store.d.ts +4 -0
- package/browser/persistence.d.ts +5 -16
- package/builtins/controller/createBuiltInCanvasController.d.ts +2 -0
- package/builtins/controller/packagingController.d.ts +71 -0
- package/builtins/index.d.ts +4 -2
- package/builtins/plugins.d.ts +16 -0
- package/chrome/floating/CanvasKitFloatingPortal.d.ts +6 -0
- package/chrome/floating/useCanvasKitFloatingPosition.d.ts +11 -0
- package/chrome/toolbar/CanvasKitFloatingToolbarLayer.d.ts +1 -1
- package/chrome/toolbar/toolbarLabels.d.ts +1 -1
- package/chrome/toolbar/useToolbarSurfaces.d.ts +6 -10
- package/chrome/types.d.ts +5 -10
- package/chrome/useCanvasKitChromeContext.d.ts +13 -13
- package/chrome/useContextMenuSurface.d.ts +4 -4
- package/chrome/useHistoryControls.d.ts +3 -3
- package/chrome/usePageControls.d.ts +3 -3
- package/controller/canvasKitController.d.ts +5 -9
- package/core/index.d.ts +1 -2
- package/core/product-controller/canvasProductController.d.ts +2 -1
- package/core/runtime/productAssets.d.ts +4 -2
- package/core/runtime/productEditor.d.ts +1 -1
- package/core/runtime/productServices.d.ts +6 -2
- package/core/runtime/runtimeContracts.d.ts +17 -0
- package/es-DocrZgUh.mjs +2 -0
- package/features/actions/actionRuntime.d.ts +2 -7
- package/features/clipboard/clipboardContextMenuContributions.d.ts +1 -1
- package/features/clipboard/clipboardContribution.d.ts +2 -1
- package/features/clipboard/clipboardPlugin.d.ts +1 -0
- package/features/clipboard/clipboardService.d.ts +1 -1
- package/features/context-menu/contextMenuRuntime.d.ts +4 -4
- package/features/image/asset/imageAssetService.d.ts +1 -1
- package/features/image/asset/imageBlobStore.d.ts +6 -2
- package/features/image/controller/imageProductController.d.ts +1 -1
- package/features/image/imageProductPlugin.d.ts +1 -0
- package/features/image/smudge/imageSmudgeHostActions.d.ts +1 -1
- package/features/image/smudge/imageSmudgeTypes.d.ts +1 -0
- package/features/image/toolbar/imageHostActions.d.ts +13 -2
- package/features/image/toolbar/imageToolbarHostBridge.d.ts +1 -1
- package/features/keyboard/keyboardShortcutPlugin.d.ts +1 -0
- package/features/keyboard/useCanvasKitKeyboardShortcuts.d.ts +5 -3
- package/features/selection/selectionActions.d.ts +2 -3
- package/features/selection/selectionContextMenuContributions.d.ts +1 -1
- package/features/selection/selectionPlugin.d.ts +1 -0
- package/features/selection/selectionToolbarContributions.d.ts +1 -1
- package/features/text/link/TextLinkHoverPopover.d.ts +6 -0
- package/features/text/textProductPlugin.d.ts +5 -0
- package/features/tool/toolActions.d.ts +1 -1
- package/features/tool/toolContextMenuContributions.d.ts +1 -1
- package/features/tool/toolPlugin.d.ts +1 -0
- package/features/tool/toolToolbarContributions.d.ts +1 -1
- package/features/view/viewActions.d.ts +1 -1
- package/features/view/viewContextMenuContributions.d.ts +1 -1
- package/features/view/viewPlugin.d.ts +1 -0
- package/index.css +1 -1
- package/index.d.ts +23 -9
- package/index.mjs +84 -96
- package/package.json +12 -9
- package/product/standardCanvasKitPlugins.d.ts +4 -0
- package/react/CanvasKitRoot.d.ts +10 -5
- package/react/useCanvasKitControllerLifecycle.d.ts +8 -0
- package/react/useCanvasKitRuntime.d.ts +2 -4
- package/runtime/canvasKitCommandExecutor.d.ts +13 -0
- package/runtime/canvasKitPluginContracts.d.ts +79 -0
- package/runtime/canvasKitPlugins.d.ts +33 -0
- package/runtime/canvasKitRuntime.d.ts +46 -19
- package/runtime/canvasKitRuntimeContracts.d.ts +37 -0
- package/_vendor/canvas-core/editor/createEditorWithRuntimePlugins.d.ts +0 -6
- package/_vendor/canvas-core/editor/middleMousePanInteraction.d.ts +0 -2
- package/_vendor/canvas-core/schema/snapshotSupport.d.ts +0 -43
- package/_vendor/canvas-react/host/actionRegistry.d.ts +0 -15
- package/_vendor/canvas-react/host/canvasRenderPluginHost.d.ts +0 -2
- package/_vendor/canvas-react/host/canvasRenderPluginHostManifest.d.ts +0 -2
- package/_vendor/canvas-react/host/canvasRenderPluginHostRuntime.d.ts +0 -3
- package/_vendor/canvas-react/host/canvasRenderPluginHostTypes.d.ts +0 -104
- package/_vendor/canvas-react/host/canvasRenderPluginHostValidation.d.ts +0 -11
- package/_vendor/canvas-react/host/contextMenuRegistry.d.ts +0 -17
- package/_vendor/canvas-react/host/extension.d.ts +0 -37
- package/_vendor/canvas-react/host/toolbarRegistry.d.ts +0 -20
- package/_vendor/plugin-text/host/RichTextLinkPopover.d.ts +0 -14
- package/_vendor/plugin-text/host/RichTextToolbar.d.ts +0 -8
- package/_vendor/plugin-text/host/richTextBubbleMenuPositionSync.d.ts +0 -7
- package/browser/localSnapshotRestore.d.ts +0 -13
- package/builtins/extensions.d.ts +0 -18
- package/core/runtime/productDefinition.d.ts +0 -33
- package/core/runtime/productHost.d.ts +0 -20
- package/features/clipboard/clipboardHostExtension.d.ts +0 -2
- package/features/image/imageHostExtension.d.ts +0 -10
- package/features/keyboard/keyboardShortcutHostExtension.d.ts +0 -2
- package/features/persistence/CanvasKitPersistenceNotice.d.ts +0 -4
- package/features/persistence/persistenceHostExtension.d.ts +0 -2
- package/features/selection/selectionHostExtension.d.ts +0 -2
- package/features/tool/toolHostExtension.d.ts +0 -2
- package/features/view/viewHostExtension.d.ts +0 -2
- package/host/defaultHostExtensions.d.ts +0 -2
- package/product/canvasKitProduct.d.ts +0 -51
- package/react/useCanvasKitController.d.ts +0 -5
- package/react/useCanvasKitStartup.d.ts +0 -9
- package/runtime/canvasKitHostContracts.d.ts +0 -135
- package/runtime/canvasKitHostFeatureHooks.d.ts +0 -12
- package/runtime/canvasKitRuntimePlan.d.ts +0 -50
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Editor as LandEditor } from "../../canvas-core/index";
|
|
2
|
+
import type { Editor as TiptapEditor } from "@tiptap/core";
|
|
3
|
+
import type { TextFormattingApi, TextFormattingSnapshot } from "../textFormatting";
|
|
4
|
+
import type { TextFontCatalog } from "../textFonts";
|
|
5
|
+
import type { TextShapeRecord } from "../textTypes";
|
|
6
|
+
export declare function createTextFormattingApi({ editor, fontCatalog, landEditor, shapeId, }: {
|
|
7
|
+
editor: TiptapEditor;
|
|
8
|
+
fontCatalog: TextFontCatalog;
|
|
9
|
+
landEditor: LandEditor;
|
|
10
|
+
shapeId: TextShapeRecord["id"];
|
|
11
|
+
}): TextFormattingApi;
|
|
12
|
+
export declare function getTextFormattingSnapshot({ editor, fontCatalog, shape, }: {
|
|
13
|
+
editor: TiptapEditor;
|
|
14
|
+
fontCatalog: TextFontCatalog;
|
|
15
|
+
shape: TextShapeRecord;
|
|
16
|
+
}): TextFormattingSnapshot;
|
|
@@ -2,8 +2,10 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import type { Editor } from "../../canvas-core/index";
|
|
3
3
|
import type { TextShapeRecord } from "../textTypes";
|
|
4
4
|
import type { TextFontCatalog } from "../textFonts";
|
|
5
|
+
import type { TextTiptapEditorChangeHandler } from "../textFormatting";
|
|
5
6
|
export interface TextShapeRendererRuntime {
|
|
7
|
+
hasEditingSession: boolean;
|
|
6
8
|
isEditingThisShape: boolean;
|
|
7
9
|
editingHost: ReactNode;
|
|
8
10
|
}
|
|
9
|
-
export declare function useTextShapeRendererRuntime(editor: Editor, shape: TextShapeRecord, fontCatalog: TextFontCatalog): TextShapeRendererRuntime;
|
|
11
|
+
export declare function useTextShapeRendererRuntime(editor: Editor, shape: TextShapeRecord, fontCatalog: TextFontCatalog, formattingToolbar?: boolean, onTiptapEditorChange?: TextTiptapEditorChangeHandler): TextShapeRendererRuntime;
|
|
@@ -2,12 +2,14 @@ import type { Editor as TiptapEditor } from "@tiptap/react";
|
|
|
2
2
|
import { type Editor, type ShapeId } from "../../canvas-core/index";
|
|
3
3
|
import type { RichTextDocument, TextShapeRecord } from "../textTypes";
|
|
4
4
|
import type { TextFontCatalog } from "../textFonts";
|
|
5
|
+
import type { TextFormattingApi } from "../textFormatting";
|
|
5
6
|
export interface TiptapTextSelectionSnapshot {
|
|
6
7
|
type: string | null;
|
|
7
8
|
text: string | null;
|
|
8
9
|
}
|
|
9
10
|
export interface TiptapTextEditorController {
|
|
10
11
|
readonly shapeId: ShapeId;
|
|
12
|
+
readonly formatting: TextFormattingApi;
|
|
11
13
|
getValue(): RichTextDocument;
|
|
12
14
|
setValue(value: RichTextDocument): void;
|
|
13
15
|
isDestroyed(): boolean;
|
|
@@ -28,8 +30,9 @@ export interface TiptapTextEditorController {
|
|
|
28
30
|
} | undefined;
|
|
29
31
|
onCompositionStateChange(listener: (isComposing: boolean) => void): () => void;
|
|
30
32
|
}
|
|
31
|
-
export declare function createTiptapTextEditorController({ shapeId, editor, fontCatalog, }: {
|
|
33
|
+
export declare function createTiptapTextEditorController({ shapeId, editor, fontCatalog, landEditor, }: {
|
|
32
34
|
shapeId: ShapeId;
|
|
33
35
|
editor: TiptapEditor;
|
|
34
36
|
fontCatalog: TextFontCatalog;
|
|
37
|
+
landEditor: Editor;
|
|
35
38
|
}): TiptapTextEditorController;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export { Text,
|
|
2
|
-
export {
|
|
1
|
+
export { Text, createTextPlugin } from "./feature";
|
|
2
|
+
export { createTextEditorPlugin, createTextProductContribution } from "./editorRuntime";
|
|
3
3
|
export { createTextCanvasRenderPlugin } from "./canvasRender";
|
|
4
|
-
export { DEFAULT_TEXT_FONT, HOST_TEXT_FONT, createDefaultTextFontCatalog,
|
|
4
|
+
export { DEFAULT_TEXT_FONT, HOST_TEXT_FONT, createDefaultTextFontCatalog, createDefaultTextPluginOptions, } from "./textFonts";
|
|
5
5
|
export { createRichTextFromPlainText, getPlainTextFromRichText, validateRichTextDocument, } from "./richTextUtils";
|
|
6
6
|
export { isTextShapeRecord, updateTextShapeRichText, } from "./textShapeHelpers";
|
|
7
|
-
export
|
|
7
|
+
export { TextLinkPopoverPresenterProvider, } from "./textLinkPopoverPresentation";
|
|
8
|
+
export type { TextLinkPopoverPresenter, TextLinkPopoverPresenterProps, } from "./textLinkPopoverPresentation";
|
|
9
|
+
export type { TextPluginOptions, TextFontDefinition, TextFontFaceSource, TextFontSource, TextStylesheetFontSource, TextSystemFontSource, } from "./textFonts";
|
|
8
10
|
export type { RichTextDocument, TextShapeAlign, TextShapeFont, TextShapeProps, TextShapeRecord, TextShapeSize, } from "./textTypes";
|
|
11
|
+
export type { TextFormattingApi, TextFormattingMixed, TextFormattingSnapshot, TextFormattingTarget, TextFormattingValue, TextInlineFormat, TextTiptapEditorChangeHandler, TextTiptapEditorHandle, } from "./textFormatting";
|
|
@@ -4,9 +4,14 @@ export type RichTextTextNode = JSONContent & {
|
|
|
4
4
|
type: "text";
|
|
5
5
|
text: string;
|
|
6
6
|
};
|
|
7
|
+
export type RichTextBlockTextAlign = "left" | "center" | "right";
|
|
7
8
|
export interface RichTextMarkStyle {
|
|
9
|
+
color?: string;
|
|
10
|
+
fontFamily?: string;
|
|
11
|
+
fontSize?: string;
|
|
8
12
|
fontWeight?: number;
|
|
9
13
|
fontStyle?: "italic";
|
|
14
|
+
lineHeight?: string;
|
|
10
15
|
textDecorationLine?: string;
|
|
11
16
|
}
|
|
12
17
|
export declare function createRichTextFromPlainText(text: string): RichTextDocument;
|
|
@@ -15,5 +20,6 @@ export declare function validateRichTextDocument(value: unknown): RichTextDocume
|
|
|
15
20
|
export declare function renderRichTextDocumentToHtml(richText: RichTextDocument): string;
|
|
16
21
|
export declare function isRichTextTextNode(node: JSONContent): node is RichTextTextNode;
|
|
17
22
|
export declare function getRichTextTextNodeStyle(node: RichTextTextNode): string | undefined;
|
|
23
|
+
export declare function getRichTextBlockTextAlign(node: JSONContent): RichTextBlockTextAlign | undefined;
|
|
18
24
|
export declare function getRichTextMarkStyle(marks: JSONContent["marks"]): RichTextMarkStyle | undefined;
|
|
19
25
|
export declare function getRichTextLinkHref(marks: JSONContent["marks"]): string | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RichTextDocument } from "./textTypes";
|
|
2
|
+
export type ShapeWideTextInlineFormat = "bold" | "italic" | "strike" | "underline";
|
|
3
|
+
export type ShapeWideTextStyleProperty = "color" | "font" | "size" | "textAlign";
|
|
4
|
+
export type ShapeWideTextFormatState = boolean | "mixed";
|
|
5
|
+
export declare function getShapeWideTextFormatState(richText: RichTextDocument, format: ShapeWideTextInlineFormat): ShapeWideTextFormatState;
|
|
6
|
+
export declare function setShapeWideTextFormat(richText: RichTextDocument, format: ShapeWideTextInlineFormat, enabled: boolean): RichTextDocument;
|
|
7
|
+
export declare function clearShapeWideTextStyleOverride(richText: RichTextDocument, property: ShapeWideTextStyleProperty): RichTextDocument;
|
|
8
|
+
export declare function clearShapeWideTextFormatting(richText: RichTextDocument): RichTextDocument;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TextShapeFont } from "./textTypes";
|
|
2
|
+
import type { TextTiptapEditorChangeHandler } from "./textFormatting";
|
|
2
3
|
export declare const DEFAULT_TEXT_FONT: "default";
|
|
3
4
|
export declare const DEFAULT_TEXT_FONT_LABEL = "Default";
|
|
4
5
|
export interface TextSystemFontSource {
|
|
@@ -32,15 +33,17 @@ export interface TextFontCatalog {
|
|
|
32
33
|
readonly fontOptions: readonly TextFontDefinition[];
|
|
33
34
|
readonly fontsById: ReadonlyMap<TextShapeFont, TextFontDefinition>;
|
|
34
35
|
}
|
|
35
|
-
export type
|
|
36
|
+
export type TextPluginOptions = {
|
|
36
37
|
defaultFont: TextFontDefinition;
|
|
37
38
|
defaultFontLabel: string;
|
|
38
39
|
fonts: readonly TextFontDefinition[];
|
|
40
|
+
formattingToolbar?: boolean;
|
|
41
|
+
onTiptapEditorChange?: TextTiptapEditorChangeHandler;
|
|
39
42
|
};
|
|
40
43
|
export declare const HOST_TEXT_FONT: TextFontDefinition;
|
|
41
|
-
export declare function
|
|
44
|
+
export declare function createDefaultTextPluginOptions(): TextPluginOptions;
|
|
42
45
|
export declare function createDefaultTextFontCatalog(): TextFontCatalog;
|
|
43
|
-
export declare function createTextFontCatalog(options: Readonly<
|
|
46
|
+
export declare function createTextFontCatalog(options: Readonly<TextPluginOptions>): TextFontCatalog;
|
|
44
47
|
export declare function isUsableFontId(value: unknown): value is TextShapeFont;
|
|
45
48
|
export declare function isTextFontInCatalog(fontCatalog: TextFontCatalog, font: unknown): font is TextShapeFont;
|
|
46
49
|
export declare function resolveTextFont(fontCatalog: TextFontCatalog, font: TextShapeFont): TextFontDefinition;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ShapeId } from "../canvas-core/index";
|
|
2
|
+
import type { Editor as TiptapEditor } from "@tiptap/core";
|
|
3
|
+
import type { TextShapeAlign, TextShapeFont, TextShapeSize } from "./textTypes";
|
|
4
|
+
export type TextFormattingMixed = "mixed";
|
|
5
|
+
export type TextFormattingValue<T> = T | TextFormattingMixed | null;
|
|
6
|
+
export type TextFormattingTarget = "selection" | "shape";
|
|
7
|
+
export type TextInlineFormat = "bold" | "italic" | "strike" | "underline";
|
|
8
|
+
export interface TextFormattingSnapshot {
|
|
9
|
+
shapeId: ShapeId;
|
|
10
|
+
target: TextFormattingTarget;
|
|
11
|
+
bold: boolean | TextFormattingMixed;
|
|
12
|
+
italic: boolean | TextFormattingMixed;
|
|
13
|
+
strike: boolean | TextFormattingMixed;
|
|
14
|
+
underline: boolean | TextFormattingMixed;
|
|
15
|
+
color: TextFormattingValue<string>;
|
|
16
|
+
font: TextFormattingValue<TextShapeFont>;
|
|
17
|
+
size: TextFormattingValue<TextShapeSize>;
|
|
18
|
+
textAlign: TextFormattingValue<TextShapeAlign>;
|
|
19
|
+
linkHref: TextFormattingValue<string>;
|
|
20
|
+
canSetLink: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface TextFormattingApi {
|
|
23
|
+
readonly shapeId: ShapeId;
|
|
24
|
+
getSnapshot(): TextFormattingSnapshot | null;
|
|
25
|
+
subscribe(listener: () => void): () => void;
|
|
26
|
+
focus(): void;
|
|
27
|
+
toggle(format: TextInlineFormat): boolean;
|
|
28
|
+
setColor(color: string | null): boolean;
|
|
29
|
+
setFont(font: TextShapeFont | null): boolean;
|
|
30
|
+
setSize(size: TextShapeSize | null): boolean;
|
|
31
|
+
setTextAlign(align: TextShapeAlign): boolean;
|
|
32
|
+
setLink(href: string | null): boolean;
|
|
33
|
+
clearFormatting(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Escape hatch for extensions that need native Tiptap commands. Prefer the
|
|
36
|
+
* semantic methods above so shape defaults, sanitization, and rendering stay
|
|
37
|
+
* synchronized.
|
|
38
|
+
*/
|
|
39
|
+
getUnsafeTiptapEditor(): TiptapEditor | null;
|
|
40
|
+
}
|
|
41
|
+
export interface TextTiptapEditorHandle {
|
|
42
|
+
readonly shapeId: ShapeId;
|
|
43
|
+
readonly formatting: TextFormattingApi;
|
|
44
|
+
}
|
|
45
|
+
export type TextTiptapEditorChangeHandler = (handle: TextTiptapEditorHandle | null) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Editor } from "../canvas-core/index";
|
|
2
|
+
import type { TextFormattingApi, TextFormattingSnapshot } from "./textFormatting";
|
|
3
|
+
export declare function activateTextFormattingSession(editor: Editor, api: TextFormattingApi): () => void;
|
|
4
|
+
export declare function getActiveTextFormattingApi(editor: Editor): TextFormattingApi | null;
|
|
5
|
+
export declare function getActiveTextFormattingSnapshot(editor: Editor): TextFormattingSnapshot | null;
|
|
6
|
+
export declare function subscribeToTextFormattingSession(editor: Editor, listener: () => void): () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Editor, type ShapeId, type ShapeParentId, type ShapeRecord, type ShapeTransformFields } from "../canvas-core/index";
|
|
2
2
|
import type { TextShapeProps, TextShapeRecord } from "./textTypes";
|
|
3
3
|
export declare const ARROW_LABEL_BINDING_TYPE = "arrow-label";
|
|
4
4
|
export declare const GEO_LABEL_BINDING_TYPE = "geo-label";
|
|
@@ -7,7 +7,8 @@ export interface TextLabelBehavior {
|
|
|
7
7
|
selectionTarget: "label" | "owner";
|
|
8
8
|
translateTarget: "label" | "owner";
|
|
9
9
|
contributesToSelectionFrame: boolean;
|
|
10
|
-
|
|
10
|
+
canUseSelectionResizeHandles: boolean;
|
|
11
|
+
canUseSelectionRotateHandle: boolean;
|
|
11
12
|
canPlaceCaretWhenOwnerSelected: boolean;
|
|
12
13
|
showsCompanionFrameWhenOwnerSelected: boolean;
|
|
13
14
|
}
|
|
@@ -27,14 +28,18 @@ export interface TextLabelCreateOptions {
|
|
|
27
28
|
};
|
|
28
29
|
bindingProps?: Record<string, unknown>;
|
|
29
30
|
}
|
|
31
|
+
export type TextLabelPageLayout = TextLabelCreateOptions["layout"];
|
|
32
|
+
export declare function getTextLabelOwnerPageRotation(editor: Editor, owner: ShapeRecord): number;
|
|
33
|
+
export declare function getTextLabelParentLocalTransform(editor: Editor, label: TextShapeRecord, targetParentId: ShapeParentId, pageLayout: TextLabelPageLayout): ShapeTransformFields | null;
|
|
30
34
|
export declare function getTextLabelShapeForOwner(editor: Editor, ownerId: ShapeId, bindingType: TextLabelBindingType): TextShapeRecord | null;
|
|
31
|
-
export declare function createBoundTextLabelShape(editor: Editor, options: TextLabelCreateOptions): TextShapeRecord;
|
|
35
|
+
export declare function createBoundTextLabelShape(editor: Editor, options: TextLabelCreateOptions): TextShapeRecord | null;
|
|
32
36
|
export declare function getTextLabelTargetInfo(editor: Editor, shapeId: ShapeId): TextLabelTargetInfo | null;
|
|
33
37
|
export declare function getTextLabelBehavior(bindingType: TextLabelBindingType): TextLabelBehavior;
|
|
34
38
|
export declare function getTextLabelSelectionTargetId(editor: Editor, shapeId: ShapeId): ShapeId | null;
|
|
35
39
|
export declare function getTextLabelTranslateTargetId(editor: Editor, shapeId: ShapeId): ShapeId | null;
|
|
36
40
|
export declare function textLabelContributesToSelectionFrame(editor: Editor, shapeId: ShapeId): boolean | null;
|
|
37
|
-
export declare function
|
|
41
|
+
export declare function textLabelCanUseSelectionResizeHandles(editor: Editor, shapeId: ShapeId): boolean | null;
|
|
42
|
+
export declare function textLabelCanUseSelectionRotateHandle(editor: Editor, shapeId: ShapeId): boolean | null;
|
|
38
43
|
export declare function textLabelShowsCompanionFrameWhenOwnerSelected(editor: Editor, shapeId: ShapeId): boolean | null;
|
|
39
44
|
export declare function canPlaceCaretInTextShapeFromSelection(editor: Editor, shapeId: ShapeId): boolean;
|
|
40
45
|
export declare function startEditingTextLabel(editor: Editor, label: TextShapeRecord, options: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ComponentType, type ReactNode } from "react";
|
|
2
|
+
export interface TextLinkPopoverPresenterProps {
|
|
3
|
+
anchorElement: HTMLElement;
|
|
4
|
+
href: string;
|
|
5
|
+
onOpen(): void;
|
|
6
|
+
onPopoverPointerEnter(): void;
|
|
7
|
+
onPopoverPointerLeave(): void;
|
|
8
|
+
}
|
|
9
|
+
export type TextLinkPopoverPresenter = ComponentType<TextLinkPopoverPresenterProps>;
|
|
10
|
+
export declare function TextLinkPopoverPresenterProvider({ children, presenter, }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
presenter: TextLinkPopoverPresenter | null;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function useTextLinkPopoverPresenter(): TextLinkPopoverPresenter | null;
|
|
15
|
+
export declare function shouldShowTextLinkPopover({ isEditing, isOnlySelected, }: {
|
|
16
|
+
isEditing: boolean;
|
|
17
|
+
isOnlySelected: boolean;
|
|
18
|
+
}): boolean;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { Box, ShapeUtil, type ShapeId, type ShapeEditEndResult, type ShapeSelectionFrameInput, type
|
|
1
|
+
import { Box, ShapeUtil, type ShapeId, type ShapeEditEndResult, type ShapeSelectionFrameInput, type ShapeSelectionResizeInput, type ShapeSelectionResizeModesInput, type ShapeSelectionTranslateInput, type ShapeUpdate } from "../canvas-core/index";
|
|
2
2
|
import { type TextShapeProps, type TextShapeRecord } from "./textTypes";
|
|
3
3
|
export declare class TextShapeUtil extends ShapeUtil<TextShapeRecord> {
|
|
4
4
|
readonly type: "text";
|
|
5
5
|
getDefaultProps(): TextShapeProps;
|
|
6
6
|
validateProps(props: unknown): TextShapeProps;
|
|
7
|
-
|
|
7
|
+
getPositionedBounds(shape: TextShapeRecord): Box;
|
|
8
8
|
getLocalBounds(shape: TextShapeRecord): Box;
|
|
9
9
|
getRenderBounds(shape: TextShapeRecord): Box;
|
|
10
10
|
getExportBounds(shape: TextShapeRecord): Box;
|
|
11
11
|
canReceiveTerminalBinding(_shape: TextShapeRecord): boolean;
|
|
12
12
|
canEdit(_shape: TextShapeRecord): boolean;
|
|
13
13
|
contributesToSelectionFrame(shape: TextShapeRecord, input: ShapeSelectionFrameInput): boolean;
|
|
14
|
-
|
|
14
|
+
canUseSelectionResizeHandles(shape: TextShapeRecord, input: ShapeSelectionFrameInput): boolean;
|
|
15
|
+
canUseSelectionRotateHandle(shape: TextShapeRecord, input: ShapeSelectionFrameInput): boolean;
|
|
15
16
|
getSelectionTargetId(shape: TextShapeRecord, input: ShapeSelectionFrameInput): ShapeId;
|
|
16
17
|
getTranslateTargetId(shape: TextShapeRecord, input: ShapeSelectionTranslateInput): ShapeId;
|
|
17
18
|
resizeSelectionBounds(shape: TextShapeRecord, input: ShapeSelectionResizeInput): ShapeUpdate;
|
|
18
|
-
|
|
19
|
+
getAllowedSelectionResizeModes(_shape: TextShapeRecord, input: ShapeSelectionResizeModesInput): readonly ["free"] | readonly ["aspect_ratio_locked"];
|
|
19
20
|
onEditEnd(shape: TextShapeRecord): ShapeEditEndResult | void;
|
|
20
21
|
}
|
|
@@ -23,7 +23,3 @@ export declare class EffectScheduler {
|
|
|
23
23
|
* Returns a cleanup function to stop the effect.
|
|
24
24
|
*/
|
|
25
25
|
export declare function effect(name: string, fn: () => void, opts?: EffectSchedulerOptions): () => void;
|
|
26
|
-
/**
|
|
27
|
-
* Alias: react() — same as effect()
|
|
28
|
-
*/
|
|
29
|
-
export declare function react(name: string, fn: () => void, opts?: EffectSchedulerOptions): () => void;
|
|
@@ -2,7 +2,7 @@ export { atom, isAtom } from "./atom";
|
|
|
2
2
|
export type { Atom } from "./atom";
|
|
3
3
|
export { computed, isComputed, UNINITIALIZED } from "./computed";
|
|
4
4
|
export type { Computed } from "./computed";
|
|
5
|
-
export { effect,
|
|
5
|
+
export { effect, EffectScheduler } from "./effect";
|
|
6
6
|
export type { EffectSchedulerOptions } from "./effect";
|
|
7
7
|
export { transact, getGlobalEpoch } from "./core";
|
|
8
8
|
export { RESET_VALUE } from "./types";
|
package/_vendor/store/store.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ type StoreListener<TRecord extends StoreRecord> = (change: StoreChange<TRecord>)
|
|
|
4
4
|
type ScopedRecord<TRecord extends StoreRecord> = Extract<TRecord, ScopedStoreRecord>;
|
|
5
5
|
export declare class Store<TRecord extends StoreRecord = StoreRecord> {
|
|
6
6
|
readonly recordsSignal: Atom<Map<string, TRecord>>;
|
|
7
|
+
private readonly draftRevisionSignal;
|
|
7
8
|
private readonly recordSignals;
|
|
8
9
|
private readonly listeners;
|
|
9
10
|
private transactionDepth;
|
|
@@ -22,11 +23,14 @@ export declare class Store<TRecord extends StoreRecord = StoreRecord> {
|
|
|
22
23
|
}>>;
|
|
23
24
|
listen(listener: StoreListener<TRecord>): () => void;
|
|
24
25
|
atomic(fn: () => void, source?: ChangeSource): void;
|
|
26
|
+
private runAtomic;
|
|
25
27
|
put(records: TRecord[], source?: ChangeSource): void;
|
|
26
28
|
remove(ids: string[], source?: ChangeSource): void;
|
|
27
29
|
replaceAll(records: TRecord[], source?: ChangeSource): void;
|
|
28
30
|
applyDiff<TChangeRecord extends TRecord>(diff: RecordsDiff<TChangeRecord>, source?: ChangeSource): void;
|
|
29
31
|
private getMutableRecords;
|
|
30
32
|
private getReadableRecords;
|
|
33
|
+
private bumpDraftRevision;
|
|
34
|
+
private notifyListeners;
|
|
31
35
|
}
|
|
32
36
|
export {};
|
package/browser/persistence.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Editor
|
|
2
|
-
import type { ProductPersistenceAdapter } from "../core/runtime/
|
|
3
|
-
import { type PersistedEditorSnapshots } from "./localSnapshotRestore";
|
|
1
|
+
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
|
+
import type { ProductPersistenceAdapter, ProductPersistenceLoadResult } from "../core/runtime/runtimeContracts";
|
|
4
3
|
import { LAND_DOCUMENT_INDEXEDDB_NAME, LAND_DOCUMENT_INDEXEDDB_STORE, LAND_DOCUMENT_INDEXEDDB_VERSION, LAND_IMAGE_BLOB_INDEXEDDB_STORE } from "./indexedDb";
|
|
5
4
|
export declare const LAND_DOCUMENT_STORAGE_KEY = "land.canvas.document";
|
|
6
5
|
export declare const LAND_SESSION_STORAGE_KEY = "land.canvas.session";
|
|
@@ -12,19 +11,13 @@ export declare function createLocalSnapshotPersistence(options?: LocalSnapshotPe
|
|
|
12
11
|
export declare class PersistenceManager {
|
|
13
12
|
private readonly editor;
|
|
14
13
|
private static readonly SAVE_DELAY_MS;
|
|
15
|
-
private readonly getDocumentSnapshot;
|
|
16
14
|
private readonly options;
|
|
17
15
|
private unsubscribe;
|
|
18
16
|
private saveTimeoutId;
|
|
19
17
|
private hasPendingSave;
|
|
20
18
|
private isSaving;
|
|
21
19
|
private saveAgainAfterCurrentSave;
|
|
22
|
-
constructor(editor: Editor,
|
|
23
|
-
getDocumentSnapshot?: () => StoreSnapshot<{
|
|
24
|
-
id: string;
|
|
25
|
-
}>;
|
|
26
|
-
options?: LocalSnapshotPersistenceOptions;
|
|
27
|
-
});
|
|
20
|
+
constructor(editor: Editor, options?: LocalSnapshotPersistenceOptions);
|
|
28
21
|
start(): void;
|
|
29
22
|
stop(): void;
|
|
30
23
|
flush(): void;
|
|
@@ -34,11 +27,7 @@ export declare class PersistenceManager {
|
|
|
34
27
|
private readonly flushWhenHidden;
|
|
35
28
|
private readonly flushWhenPageIsLeaving;
|
|
36
29
|
}
|
|
37
|
-
export declare function persistEditorSnapshot(editor: Editor, options?: LocalSnapshotPersistenceOptions
|
|
38
|
-
|
|
39
|
-
id: string;
|
|
40
|
-
}>;
|
|
41
|
-
}): Promise<void>;
|
|
42
|
-
export declare function readPersistedEditorSnapshots(options?: LocalSnapshotPersistenceOptions): Promise<PersistedEditorSnapshots>;
|
|
30
|
+
export declare function persistEditorSnapshot(editor: Editor, options?: LocalSnapshotPersistenceOptions): Promise<void>;
|
|
31
|
+
export declare function readPersistedEditorSnapshots(options?: LocalSnapshotPersistenceOptions): Promise<ProductPersistenceLoadResult>;
|
|
43
32
|
export declare function readPersistedDocumentSnapshot(): Promise<unknown | null>;
|
|
44
33
|
export declare function readPersistedSessionSnapshot(): Promise<unknown | null>;
|
|
@@ -2,11 +2,13 @@ import type { ShapeId } from "../../_vendor/canvas-core/index";
|
|
|
2
2
|
import type { CanvasProductController, CanvasProductControllerSnapshot, CanvasProductControllerOptions, CanvasProductSessionSnapshot } from "../../core/product-controller";
|
|
3
3
|
import { type BuiltInCanvasShapeCreationControllers } from "./shapeCreationController";
|
|
4
4
|
import { type BuiltInCanvasLayerNode } from "./layerController";
|
|
5
|
+
import { type PackagingController } from "./packagingController";
|
|
5
6
|
export interface BuiltInCanvasControllerSnapshot<TToolId extends string = string> extends CanvasProductControllerSnapshot<TToolId> {
|
|
6
7
|
productId: string;
|
|
7
8
|
session: CanvasProductSessionSnapshot<TToolId>;
|
|
8
9
|
}
|
|
9
10
|
export interface BuiltInCanvasController<TToolId extends string = string> extends CanvasProductController<TToolId>, BuiltInCanvasShapeCreationControllers {
|
|
11
|
+
packaging: PackagingController | null;
|
|
10
12
|
snapshot(): BuiltInCanvasControllerSnapshot<TToolId>;
|
|
11
13
|
getLayerTree(pageId?: string): BuiltInCanvasLayerNode[];
|
|
12
14
|
getLayerNode(id: ShapeId): BuiltInCanvasLayerNode | null;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type Editor, type PageId, type ShapeColor, type ShapeId } from "../../_vendor/canvas-core/index";
|
|
2
|
+
import { type PackagingDocument, type PackagingDxfImportOptions, type PackagingPdfExportOptions, type PackagingPdfExportResult, type PackagingSurfaceSide } from "../../_vendor/plugin-packaging/index";
|
|
3
|
+
import type { CanvasProductShapeRef } from "../../core/product-controller";
|
|
4
|
+
export interface CanvasKitPackagingInput {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
document: PackagingDocument;
|
|
8
|
+
viewSide?: PackagingSurfaceSide;
|
|
9
|
+
faceFill?: ShapeColor;
|
|
10
|
+
faceFillOverrides?: Record<string, ShapeColor>;
|
|
11
|
+
showBleed?: boolean;
|
|
12
|
+
clipToBleed?: boolean;
|
|
13
|
+
dielineOnTop?: boolean;
|
|
14
|
+
showSafeZones?: boolean;
|
|
15
|
+
showCanvasBoundsMarks?: boolean;
|
|
16
|
+
meta?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
export interface CanvasKitPackagingDxfImportInput {
|
|
19
|
+
source: string;
|
|
20
|
+
fileName?: string;
|
|
21
|
+
pagePoint?: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
};
|
|
25
|
+
options?: Omit<PackagingDxfImportOptions, "fileName">;
|
|
26
|
+
}
|
|
27
|
+
export interface PackagingController {
|
|
28
|
+
create(input: CanvasKitPackagingInput): CanvasProductShapeRef | null;
|
|
29
|
+
importDxf(input: CanvasKitPackagingDxfImportInput): CanvasProductShapeRef | null;
|
|
30
|
+
updateDocument(input: {
|
|
31
|
+
packagingId: ShapeId;
|
|
32
|
+
document: PackagingDocument;
|
|
33
|
+
expectedRevision?: string;
|
|
34
|
+
}): CanvasProductShapeRef | null;
|
|
35
|
+
getDocument(packagingId: ShapeId): PackagingDocument | null;
|
|
36
|
+
exportPdf(input: {
|
|
37
|
+
packagingId: ShapeId;
|
|
38
|
+
options?: PackagingPdfExportOptions;
|
|
39
|
+
}): Promise<PackagingPdfExportResult | null>;
|
|
40
|
+
attachShapes(input: {
|
|
41
|
+
packagingId: ShapeId;
|
|
42
|
+
shapeIds: ShapeId[];
|
|
43
|
+
}): ShapeId[];
|
|
44
|
+
detachShapes(input: {
|
|
45
|
+
packagingId: ShapeId;
|
|
46
|
+
shapeIds: ShapeId[];
|
|
47
|
+
destinationPageId?: PageId;
|
|
48
|
+
}): ShapeId[];
|
|
49
|
+
hitTestFace(input: {
|
|
50
|
+
packagingId: ShapeId;
|
|
51
|
+
pagePoint: {
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
};
|
|
55
|
+
}): {
|
|
56
|
+
faceId: string;
|
|
57
|
+
localPoint: {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
};
|
|
61
|
+
faceUv: {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
} | null;
|
|
65
|
+
} | null;
|
|
66
|
+
getCoveredFaces(input: {
|
|
67
|
+
packagingId: ShapeId;
|
|
68
|
+
shapeId: ShapeId;
|
|
69
|
+
}): string[];
|
|
70
|
+
}
|
|
71
|
+
export declare function createPackagingController(editor: Editor): PackagingController;
|
package/builtins/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
1
|
+
export { builtInCanvasPlugins, createBuiltInCanvasPlugins, } from "./plugins";
|
|
2
|
+
export type { BuiltInCanvasPlugin, BuiltInCanvasPluginOptions, } from "./plugins";
|
|
3
3
|
export { createBuiltInCanvasController, useBuiltInCanvasController, } from "./controller/createBuiltInCanvasController";
|
|
4
4
|
export type { BuiltInCanvasController, BuiltInCanvasControllerSnapshot, BuiltInCanvasLayerNode, } from "./controller/createBuiltInCanvasController";
|
|
5
5
|
export type { BuiltInArrowController, BuiltInCanvasArrowBindingInput, BuiltInCanvasArrowInput, BuiltInCanvasFrameInput, BuiltInCanvasRectangleInput, BuiltInCanvasShapeCreationControllers, BuiltInCanvasShapeInput, BuiltInCanvasTextInput, BuiltInFrameController, BuiltInGeoController, BuiltInTextController, } from "./controller/shapeCreationController";
|
|
6
|
+
export { createPackagingController } from "./controller/packagingController";
|
|
7
|
+
export type { CanvasKitPackagingDxfImportInput, CanvasKitPackagingInput, PackagingController, } from "./controller/packagingController";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type TextPluginOptions } from "../_vendor/plugin-text/index";
|
|
2
|
+
export interface BuiltInCanvasPluginOptions {
|
|
3
|
+
arrow?: boolean;
|
|
4
|
+
draw?: boolean;
|
|
5
|
+
eraser?: boolean;
|
|
6
|
+
frame?: boolean;
|
|
7
|
+
geo?: boolean;
|
|
8
|
+
group?: boolean;
|
|
9
|
+
image?: boolean;
|
|
10
|
+
laser?: boolean;
|
|
11
|
+
path?: boolean;
|
|
12
|
+
text?: boolean | Partial<TextPluginOptions>;
|
|
13
|
+
}
|
|
14
|
+
export declare const builtInCanvasPlugins: readonly [import("../_vendor/canvas-plugin-sdk/index").CanvasPlugin<typeof import("../_vendor/plugin-geo/index").createGeoProductContribution>, import("../_vendor/canvas-plugin-sdk/index").CanvasPlugin<typeof import("../_vendor/plugin-draw/index").createDrawProductContribution>, import("../_vendor/canvas-plugin-sdk/index").CanvasPlugin<typeof import("../_vendor/plugin-arrow/index").createArrowProductContribution>, import("../_vendor/canvas-plugin-sdk/index").CanvasPlugin<typeof import("../_vendor/plugin-eraser/index").createEraserProductContribution>, import("../_vendor/canvas-plugin-sdk/index").CanvasPlugin<typeof import("../_vendor/plugin-laser/index").createLaserProductContribution>, import("../_vendor/canvas-plugin-sdk/index").CanvasPlugin<typeof import("../_vendor/plugin-path/index").createPathProductContribution>, import("../_vendor/canvas-plugin-sdk/index").CanvasPlugin<typeof import("../_vendor/plugin-image/index").createImageProductContribution>, import("../_vendor/canvas-plugin-sdk/index").CanvasPlugin<import("../_vendor/canvas-plugin-sdk/index").CanvasProductFactory>, import("../_vendor/canvas-plugin-sdk/index").CanvasPlugin<typeof import("../_vendor/plugin-frame/index").createFrameProductContribution>, import("../_vendor/canvas-plugin-sdk/index").CanvasPlugin<typeof import("../_vendor/plugin-group/index").createGroupProductContribution>];
|
|
15
|
+
export type BuiltInCanvasPlugin = (typeof builtInCanvasPlugins)[number];
|
|
16
|
+
export declare function createBuiltInCanvasPlugins(options?: BuiltInCanvasPluginOptions): readonly BuiltInCanvasPlugin[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare function CanvasKitFloatingPortalProvider({ children, }: {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function CanvasKitFloatingPortalHost(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function useCanvasKitFloatingPortalTarget(): HTMLDivElement | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
import { type Placement, type ReferenceElement } from "@floating-ui/dom";
|
|
3
|
+
import { type Editor } from "../../_vendor/canvas-core/index";
|
|
4
|
+
export declare function useCanvasKitFloatingPosition({ editor, fallbackPlacements, floatingRef, getReferenceElement, offset, placement, }: {
|
|
5
|
+
editor: Editor;
|
|
6
|
+
fallbackPlacements: readonly Placement[];
|
|
7
|
+
floatingRef: RefObject<HTMLElement | null>;
|
|
8
|
+
getReferenceElement(): ReferenceElement | null;
|
|
9
|
+
offset: number;
|
|
10
|
+
placement: Placement;
|
|
11
|
+
}): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ToolbarGroup } from "../../_vendor/canvas-
|
|
1
|
+
import { type ToolbarGroup } from "../../_vendor/canvas-plugin-sdk/index";
|
|
2
2
|
export declare function getActiveToolLabel(groups: readonly ToolbarGroup[], activeToolId: string): string;
|
|
3
3
|
export declare function getSelectionToolbarTitle({ commonShapeType, count, isMixedFrameAndPointHandleSelection, singleShapeType, }: {
|
|
4
4
|
commonShapeType: string | null;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type
|
|
3
|
-
export interface FloatingSelectionToolbarPageAnchor {
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
}
|
|
1
|
+
import { type CanvasActionContext, type CanvasToolbarRegistry, type ToolbarGroup } from "../../_vendor/canvas-plugin-sdk/index";
|
|
2
|
+
import { type Editor } from "../../_vendor/canvas-core/index";
|
|
7
3
|
export interface ToolbarSurfaces {
|
|
8
4
|
context: CanvasActionContext;
|
|
9
5
|
activeToolId: string;
|
|
@@ -12,15 +8,15 @@ export interface ToolbarSurfaces {
|
|
|
12
8
|
selectionCount: number;
|
|
13
9
|
hasMixedSelectionRotation: boolean;
|
|
14
10
|
toolChromeToolbarGroups: readonly ToolbarGroup[];
|
|
11
|
+
toolFloatingToolbarGroups: readonly ToolbarGroup[];
|
|
15
12
|
contextToolbarGroups: readonly ToolbarGroup[];
|
|
16
13
|
floatingSelectionToolbarGroups: readonly ToolbarGroup[];
|
|
17
|
-
floatingSelectionToolbarPageAnchor: FloatingSelectionToolbarPageAnchor | null;
|
|
18
14
|
contextToolbarTitle: string;
|
|
19
15
|
showContextToolbar: boolean;
|
|
20
|
-
|
|
16
|
+
canShowFloatingSelectionToolbar: boolean;
|
|
21
17
|
}
|
|
22
|
-
export declare function useToolbarSurfaces({ canShowContextToolbarDuringEditing, editor,
|
|
18
|
+
export declare function useToolbarSurfaces({ canShowContextToolbarDuringEditing, editor, toolbarRegistry, }: {
|
|
23
19
|
canShowContextToolbarDuringEditing?: (context: CanvasActionContext) => boolean;
|
|
24
20
|
editor: Editor;
|
|
25
|
-
|
|
21
|
+
toolbarRegistry: CanvasToolbarRegistry;
|
|
26
22
|
}): ToolbarSurfaces;
|
package/chrome/types.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { type ActiveContextMenu, type CanvasActionContext, type CanvasActionValue } from "../_vendor/canvas-plugin-sdk/index";
|
|
1
2
|
import type { CanvasKitController, CanvasKitBaseController } from "../controller/canvasKitController";
|
|
2
3
|
import type { BuiltInCanvasLayerNode } from "../builtins";
|
|
3
|
-
import type {
|
|
4
|
+
import type { EditorSelectionMetadata, ShapeId } from "../_vendor/canvas-core/index";
|
|
4
5
|
import type { HistoryControls } from "./useHistoryControls";
|
|
5
6
|
import type { PageControls } from "./usePageControls";
|
|
6
7
|
import type { ZoomControlsState } from "./useZoomControls";
|
|
7
8
|
import type { ContextMenuSurface } from "./useContextMenuSurface";
|
|
8
9
|
import type { SvgExportControls } from "./useSvgExport";
|
|
9
10
|
import type { ToolbarSurfaces } from "./toolbar/useToolbarSurfaces";
|
|
10
|
-
|
|
11
|
-
export type {
|
|
11
|
+
export type { EditorSelectionMetadata, EditorSelectionState, ShapeId, } from "../_vendor/canvas-core/index";
|
|
12
|
+
export type { CanvasActionContext, CanvasActionValue, ContextMenuCommandItem, ContextMenuItem, ContextMenuSection, ToolbarGroup, ToolbarItem, } from "../_vendor/canvas-plugin-sdk/index";
|
|
12
13
|
export type { HistoryControls } from "./useHistoryControls";
|
|
13
14
|
export type { PageControls } from "./usePageControls";
|
|
14
15
|
export type { ZoomControlsState } from "./useZoomControls";
|
|
@@ -36,11 +37,6 @@ export interface CanvasKitGridControls {
|
|
|
36
37
|
isVisible: boolean;
|
|
37
38
|
setIsVisible(isVisible: boolean): void;
|
|
38
39
|
}
|
|
39
|
-
export interface CanvasKitPersistenceControls {
|
|
40
|
-
discardUnsupportedRecords: (() => Promise<void>) | null;
|
|
41
|
-
isDiscardingUnsupportedRecords: boolean;
|
|
42
|
-
status: ProductPersistenceStatus | null;
|
|
43
|
-
}
|
|
44
40
|
export interface CanvasKitLayerTreeSource {
|
|
45
41
|
getSnapshot(pageId?: string): readonly BuiltInCanvasLayerNode[];
|
|
46
42
|
subscribe(onStoreChange: () => void): () => void;
|
|
@@ -53,9 +49,8 @@ export interface CanvasKitChromeContext<TController extends CanvasKitBaseControl
|
|
|
53
49
|
history: HistoryControls;
|
|
54
50
|
layerTree: CanvasKitLayerTreeSource;
|
|
55
51
|
pages: PageControls;
|
|
56
|
-
selection:
|
|
52
|
+
selection: EditorSelectionMetadata;
|
|
57
53
|
selectedShapeIds: readonly ShapeId[];
|
|
58
|
-
persistence: CanvasKitPersistenceControls;
|
|
59
54
|
svgExport: SvgExportControls;
|
|
60
55
|
toolbarRuntime: CanvasKitToolbarRuntime;
|
|
61
56
|
toolbarSurfaces: ToolbarSurfaces;
|