@yuzhouu/canvas-kit 0.1.7 → 0.1.8
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 +5 -1
- package/_vendor/canvas-core/editor/commands.d.ts +10 -1
- package/_vendor/canvas-core/editor/createEditorWithRuntimePlugins.d.ts +6 -0
- package/_vendor/canvas-core/editor/editor.d.ts +6 -1
- package/_vendor/canvas-core/editor/index.d.ts +1 -1
- package/_vendor/canvas-core/editor/managers/documentSnapshotManager.d.ts +1 -1
- package/_vendor/canvas-core/editor/managers/snapCalculations.d.ts +34 -4
- package/_vendor/canvas-core/editor/managers/snapManager.d.ts +7 -0
- package/_vendor/canvas-core/editor/managers/snapTypes.d.ts +15 -0
- package/_vendor/canvas-core/editor/middleMousePanInteraction.d.ts +2 -0
- package/_vendor/canvas-core/index.d.ts +6 -6
- package/_vendor/canvas-core/plugins/{editorPlugin.d.ts → editorRuntimePlugin.d.ts} +3 -3
- package/_vendor/canvas-core/plugins/index.d.ts +1 -1
- package/_vendor/canvas-core/schema/records.d.ts +10 -1
- package/_vendor/canvas-core/shapes/shapeUtil.d.ts +13 -4
- package/_vendor/canvas-core/shapes/types.d.ts +2 -2
- package/_vendor/canvas-react/components/CanvasView.d.ts +3 -3
- package/_vendor/canvas-react/components/useCanvasDomEvents.d.ts +2 -0
- package/_vendor/canvas-react/host/actionRegistry.d.ts +15 -0
- package/_vendor/canvas-react/host/{canvasPlugin.d.ts → canvasRenderPlugin.d.ts} +5 -5
- package/_vendor/canvas-react/host/canvasRenderPluginHost.d.ts +2 -0
- package/_vendor/canvas-react/host/canvasRenderPluginHostManifest.d.ts +2 -0
- package/_vendor/canvas-react/host/canvasRenderPluginHostRuntime.d.ts +3 -0
- package/_vendor/canvas-react/host/canvasRenderPluginHostTypes.d.ts +104 -0
- package/_vendor/canvas-react/host/canvasRenderPluginHostValidation.d.ts +11 -0
- package/_vendor/canvas-react/host/contextMenuRegistry.d.ts +8 -3
- package/_vendor/canvas-react/host/domEventGuards.d.ts +3 -3
- package/_vendor/canvas-react/host/extension.d.ts +4 -4
- package/_vendor/canvas-react/host/index.d.ts +5 -4
- package/_vendor/canvas-react/host/overlayRegistry.d.ts +3 -3
- package/_vendor/canvas-react/host/rendererRegistry.d.ts +3 -3
- package/_vendor/canvas-react/host/toolbarRegistry.d.ts +9 -13
- package/_vendor/plugin-arrow/canvasRender.d.ts +2 -0
- package/_vendor/plugin-arrow/{editor.d.ts → editorRuntime.d.ts} +2 -2
- package/_vendor/plugin-arrow/index.d.ts +2 -2
- package/_vendor/plugin-draw/canvasRender.d.ts +2 -0
- package/_vendor/plugin-draw/{editor.d.ts → editorRuntime.d.ts} +2 -2
- package/_vendor/plugin-draw/index.d.ts +2 -2
- package/_vendor/plugin-eraser/canvasRender.d.ts +2 -0
- package/_vendor/plugin-eraser/editorRuntime.d.ts +2 -0
- package/_vendor/plugin-eraser/index.d.ts +2 -2
- package/_vendor/plugin-frame/{canvas.d.ts → canvasRender.d.ts} +2 -2
- package/_vendor/plugin-frame/{editor.d.ts → editorRuntime.d.ts} +2 -2
- package/_vendor/plugin-frame/index.d.ts +2 -2
- package/_vendor/plugin-geo/{canvas.d.ts → canvasRender.d.ts} +2 -2
- package/_vendor/plugin-geo/{editor.d.ts → editorRuntime.d.ts} +2 -2
- package/_vendor/plugin-geo/geoGeometry.d.ts +19 -3
- package/_vendor/plugin-geo/index.d.ts +2 -2
- package/_vendor/plugin-geo/types.d.ts +1 -0
- package/_vendor/plugin-group/{canvas.d.ts → canvasRender.d.ts} +2 -2
- package/_vendor/plugin-group/{editor.d.ts → editorRuntime.d.ts} +2 -2
- package/_vendor/plugin-group/index.d.ts +2 -2
- package/_vendor/plugin-image/{editor.d.ts → actionIds.d.ts} +0 -8
- package/_vendor/plugin-image/canvasRender.d.ts +2 -0
- package/_vendor/plugin-image/cropRuntime.d.ts +2 -0
- package/_vendor/plugin-image/editorRuntime.d.ts +5 -0
- package/_vendor/plugin-image/imageHostActionContract.d.ts +2 -0
- package/_vendor/plugin-image/imageShapeUtil.d.ts +2 -1
- package/_vendor/plugin-image/imageSvgExporter.d.ts +6 -0
- package/_vendor/plugin-image/index.d.ts +8 -4
- package/_vendor/plugin-image/runtimeShared.d.ts +5 -0
- package/_vendor/plugin-image/smudge.d.ts +56 -0
- package/_vendor/plugin-image/smudgeInteractions.d.ts +2 -0
- package/_vendor/plugin-image/smudgeRuntime.d.ts +2 -0
- package/_vendor/plugin-image/styleRuntime.d.ts +17 -0
- package/_vendor/plugin-image/toolbarRuntime.d.ts +3 -0
- package/_vendor/plugin-image/types.d.ts +16 -1
- package/_vendor/plugin-laser/canvasRender.d.ts +2 -0
- package/_vendor/plugin-laser/editorRuntime.d.ts +2 -0
- package/_vendor/plugin-laser/index.d.ts +2 -2
- package/_vendor/plugin-text/canvasRender.d.ts +5 -0
- package/_vendor/plugin-text/editorRuntime.d.ts +5 -0
- package/_vendor/plugin-text/host/RichTextLinkPopover.d.ts +14 -0
- package/_vendor/plugin-text/host/richTextRendering.d.ts +9 -1
- package/_vendor/plugin-text/index.d.ts +2 -0
- package/_vendor/plugin-text/richTextLinks.d.ts +3 -0
- package/_vendor/plugin-text/richTextUtils.d.ts +2 -1
- package/browser/indexedDb.d.ts +10 -0
- package/browser/persistence.d.ts +2 -4
- package/builtins/controller/createBuiltInCanvasController.d.ts +1 -1
- package/builtins/controller/layerController.d.ts +1 -1
- package/builtins/controller/shapeCreationController.d.ts +6 -2
- package/builtins/index.d.ts +1 -1
- package/chrome/toolbar/CanvasKitWheelCapture.d.ts +2 -0
- package/chrome/{FloatingSelectionToolbarPageSpace.d.ts → toolbar/FloatingSelectionToolbarPageSpace.d.ts} +1 -1
- package/{core/features → chrome}/toolbar/toolbarLabels.d.ts +1 -1
- package/chrome/{bindings → toolbar}/useToolbarSurfaces.d.ts +2 -2
- package/chrome/types.d.ts +12 -8
- package/chrome/useCanvasKitChromeContext.d.ts +6 -4
- package/chrome/{bindings/useCanvasKitLayerTree.d.ts → useCanvasKitLayerTree.d.ts} +1 -1
- package/chrome/{bindings/useContextMenuSurface.d.ts → useContextMenuSurface.d.ts} +3 -3
- package/chrome/useHistoryControls.d.ts +12 -0
- package/chrome/usePageControls.d.ts +16 -0
- package/chrome/{bindings/useSvgExport.d.ts → useSvgExport.d.ts} +2 -2
- package/chrome/useZoomControls.d.ts +9 -0
- package/controller/canvasKitController.d.ts +10 -7
- package/core/api/apiRegistry.d.ts +12 -0
- package/core/index.d.ts +4 -19
- package/core/{controller → product-controller}/canvasProductController.d.ts +17 -4
- package/core/product-controller/index.d.ts +2 -0
- package/core/runtime/productDefinition.d.ts +5 -4
- package/core/runtime/productHost.d.ts +5 -2
- package/{core/features/actions/canvasActionContext.d.ts → features/actions/actionRuntime.d.ts} +7 -1
- package/{core/features → features}/clipboard/clipboardContextMenuContributions.d.ts +1 -1
- package/features/clipboard/clipboardContribution.d.ts +11 -0
- package/features/clipboard/clipboardHostExtension.d.ts +2 -0
- package/{core/features → features}/clipboard/clipboardService.d.ts +3 -3
- package/features/context-menu/contextMenuRuntime.d.ts +13 -0
- package/{core/features → features}/export/svgExport.d.ts +1 -1
- package/features/image/asset/imageAssetService.d.ts +11 -0
- package/features/image/{imageBlobStore.d.ts → asset/imageBlobStore.d.ts} +3 -2
- package/features/image/asset/imageFileHelpers.d.ts +49 -0
- package/features/image/{svgImageAssetInliner.d.ts → asset/svgImageAssetInliner.d.ts} +1 -1
- package/features/image/controller/imageProductController.d.ts +27 -0
- package/features/image/imageHostExtension.d.ts +10 -5
- package/features/image/{ImageImportController.d.ts → import/ImageImportController.d.ts} +3 -3
- package/features/image/{useImageImport.d.ts → import/useImageImport.d.ts} +3 -4
- package/features/image/index.d.ts +17 -15
- package/features/image/smudge/imageSmudgeHostActions.d.ts +10 -0
- package/features/image/smudge/imageSmudgeTypes.d.ts +24 -0
- package/features/image/toolbar/imageHostActions.d.ts +69 -0
- package/features/image/{imageToolbarHostBridge.d.ts → toolbar/imageToolbarHostBridge.d.ts} +2 -2
- package/features/keyboard/keyboardShortcutHostExtension.d.ts +2 -0
- package/features/keyboard/useCanvasKitKeyboardShortcuts.d.ts +6 -0
- package/{react → features/persistence}/CanvasKitPersistenceNotice.d.ts +1 -1
- package/features/persistence/persistenceHostExtension.d.ts +2 -0
- package/{core/features/actions/canvasActions.d.ts → features/selection/selectionActions.d.ts} +3 -9
- package/{core/features/toolbar → features/selection}/selectionContextMenuContributions.d.ts +1 -1
- package/features/selection/selectionHostExtension.d.ts +2 -0
- package/features/selection/selectionToolbarContributions.d.ts +2 -0
- package/features/tool/toolActions.d.ts +2 -0
- package/{core/features/toolbar → features/tool}/toolContextMenuContributions.d.ts +1 -1
- package/features/tool/toolHostExtension.d.ts +2 -0
- package/features/tool/toolToolbarContributions.d.ts +2 -0
- package/features/view/viewActions.d.ts +5 -0
- package/{core/features/context-menu → features/view}/viewContextMenuContributions.d.ts +1 -1
- package/features/view/viewHostExtension.d.ts +2 -0
- package/host/defaultHostExtensions.d.ts +2 -0
- package/index.d.ts +12 -7
- package/index.mjs +96 -76
- package/package.json +1 -1
- package/product/canvasKitProduct.d.ts +8 -7
- package/react/useCanvasKitController.d.ts +1 -1
- package/react/useCanvasKitRuntime.d.ts +1 -1
- package/runtime/canvasKitHostContracts.d.ts +135 -0
- package/runtime/canvasKitHostFeatureHooks.d.ts +12 -0
- package/runtime/canvasKitRuntime.d.ts +8 -6
- package/runtime/canvasKitRuntimePlan.d.ts +50 -0
- package/_vendor/canvas-core/editor/createEditorWithPlugins.d.ts +0 -6
- package/_vendor/canvas-react/host/pluginHost.d.ts +0 -2
- package/_vendor/canvas-react/host/pluginHostManifest.d.ts +0 -2
- package/_vendor/canvas-react/host/pluginHostRuntime.d.ts +0 -3
- package/_vendor/canvas-react/host/pluginHostTypes.d.ts +0 -102
- package/_vendor/canvas-react/host/pluginHostValidation.d.ts +0 -11
- package/_vendor/plugin-arrow/canvas.d.ts +0 -2
- package/_vendor/plugin-draw/canvas.d.ts +0 -2
- package/_vendor/plugin-eraser/canvas.d.ts +0 -2
- package/_vendor/plugin-eraser/editor.d.ts +0 -2
- package/_vendor/plugin-image/canvas.d.ts +0 -2
- package/_vendor/plugin-laser/canvas.d.ts +0 -2
- package/_vendor/plugin-laser/editor.d.ts +0 -2
- package/_vendor/plugin-text/canvas.d.ts +0 -5
- package/_vendor/plugin-text/editor.d.ts +0 -5
- package/chrome/bindings/useCanvasKitChromeControls.d.ts +0 -27
- package/core/controller/featureControllerRegistry.d.ts +0 -12
- package/core/controller/index.d.ts +0 -4
- package/core/features/clipboard/clipboardContribution.d.ts +0 -19
- package/core/features/context-menu/contextMenuActions.d.ts +0 -12
- package/core/features/context-menu/contextMenuContext.d.ts +0 -6
- package/core/features/context-menu/contextMenuContribution.d.ts +0 -4
- package/core/features/hostActionIds.d.ts +0 -1
- package/core/features/toolbar/toolbarContribution.d.ts +0 -4
- package/core/runtime/productContributions.d.ts +0 -9
- package/features/image/imageAssetService.d.ts +0 -7
- package/features/image/imageFileHelpers.d.ts +0 -35
- package/features/image/imageHostActions.d.ts +0 -36
- package/features/image/imageProductController.d.ts +0 -22
- package/features/image/imageProductToolbarActions.d.ts +0 -2
- package/react/useCanvasKitKeyboardShortcuts.d.ts +0 -6
- package/runtime/canvasKitHostExtensions.d.ts +0 -19
- package/runtime/canvasKitRuntimeInitializer.d.ts +0 -11
- /package/chrome/{CanvasKitFloatingToolbarLayer.d.ts → toolbar/CanvasKitFloatingToolbarLayer.d.ts} +0 -0
- /package/core/{controller → product-controller}/productLayerTree.d.ts +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface RichTextLinkHoverState {
|
|
2
|
+
href: string;
|
|
3
|
+
path: readonly number[];
|
|
4
|
+
rect: DOMRect;
|
|
5
|
+
}
|
|
6
|
+
export declare function RichTextLinkPopover({ link, onApply, onKeepVisible, onClear, }: {
|
|
7
|
+
link: RichTextLinkHoverState | null;
|
|
8
|
+
onApply(input: {
|
|
9
|
+
path: readonly number[];
|
|
10
|
+
href: string | null;
|
|
11
|
+
}): void;
|
|
12
|
+
onKeepVisible(): void;
|
|
13
|
+
onClear(): void;
|
|
14
|
+
}): import("react").ReactPortal | null;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { RichTextDocument } from "../textTypes";
|
|
3
|
-
export
|
|
3
|
+
export interface RichTextRenderLinkHandlers {
|
|
4
|
+
onPointerEnter?(input: {
|
|
5
|
+
href: string;
|
|
6
|
+
path: readonly number[];
|
|
7
|
+
element: HTMLSpanElement;
|
|
8
|
+
}): void;
|
|
9
|
+
onPointerLeave?(): void;
|
|
10
|
+
}
|
|
11
|
+
export declare function renderRichTextDocument(richText: RichTextDocument, linkHandlers?: RichTextRenderLinkHandlers): ReactNode;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { Text, createTextFeatureBundle } from "./feature";
|
|
2
|
+
export { createTextEditorRuntimePlugin } from "./editorRuntime";
|
|
3
|
+
export { createTextCanvasRenderPlugin } from "./canvasRender";
|
|
2
4
|
export { DEFAULT_TEXT_FONT, HOST_TEXT_FONT, createDefaultTextFontCatalog, createDefaultTextExtensionOptions, } from "./textFonts";
|
|
3
5
|
export { createRichTextFromPlainText, getPlainTextFromRichText, validateRichTextDocument, } from "./richTextUtils";
|
|
4
6
|
export { isTextShapeRecord, updateTextShapeRichText, } from "./textShapeHelpers";
|
|
@@ -7,7 +7,7 @@ export type RichTextTextNode = JSONContent & {
|
|
|
7
7
|
export interface RichTextMarkStyle {
|
|
8
8
|
fontWeight?: number;
|
|
9
9
|
fontStyle?: "italic";
|
|
10
|
-
textDecorationLine?:
|
|
10
|
+
textDecorationLine?: string;
|
|
11
11
|
}
|
|
12
12
|
export declare function createRichTextFromPlainText(text: string): RichTextDocument;
|
|
13
13
|
export declare function getPlainTextFromRichText(richTextDocument: RichTextDocument): string;
|
|
@@ -16,3 +16,4 @@ export declare function renderRichTextDocumentToHtml(richText: RichTextDocument)
|
|
|
16
16
|
export declare function isRichTextTextNode(node: JSONContent): node is RichTextTextNode;
|
|
17
17
|
export declare function getRichTextTextNodeStyle(node: RichTextTextNode): string | undefined;
|
|
18
18
|
export declare function getRichTextMarkStyle(marks: JSONContent["marks"]): RichTextMarkStyle | undefined;
|
|
19
|
+
export declare function getRichTextLinkHref(marks: JSONContent["marks"]): string | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const LAND_DOCUMENT_INDEXEDDB_NAME = "land.canvas.persistence";
|
|
2
|
+
export declare const LAND_DOCUMENT_INDEXEDDB_STORE = "snapshots";
|
|
3
|
+
export declare const LAND_IMAGE_BLOB_INDEXEDDB_STORE = "imageBlobs";
|
|
4
|
+
export declare const LAND_DOCUMENT_INDEXEDDB_VERSION = 2;
|
|
5
|
+
export declare function openLandCanvasDatabase(): Promise<IDBDatabase | null>;
|
|
6
|
+
export declare function readLandCanvasStoreValue(storeName: string, key: IDBValidKey): Promise<unknown | null>;
|
|
7
|
+
export declare function readLandCanvasStoreValues(storeName: string, keys: readonly IDBValidKey[]): Promise<readonly unknown[] | null>;
|
|
8
|
+
export declare function writeLandCanvasStoreValues(storeName: string, entries: readonly (readonly [IDBValidKey, unknown])[]): Promise<void>;
|
|
9
|
+
export declare function deleteLandCanvasStoreValue(storeName: string, key: IDBValidKey): Promise<void>;
|
|
10
|
+
export declare function getAllLandCanvasStoreKeys(storeName: string): Promise<IDBValidKey[] | null>;
|
package/browser/persistence.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { Editor, StoreSnapshot } from "../_vendor/canvas-core/index";
|
|
2
2
|
import type { ProductPersistenceAdapter } from "../core/runtime/productDefinition";
|
|
3
3
|
import { type PersistedEditorSnapshots } from "./localSnapshotRestore";
|
|
4
|
-
|
|
5
|
-
export declare const LAND_DOCUMENT_INDEXEDDB_STORE = "snapshots";
|
|
6
|
-
export declare const LAND_IMAGE_BLOB_INDEXEDDB_STORE = "imageBlobs";
|
|
4
|
+
import { LAND_DOCUMENT_INDEXEDDB_NAME, LAND_DOCUMENT_INDEXEDDB_STORE, LAND_DOCUMENT_INDEXEDDB_VERSION, LAND_IMAGE_BLOB_INDEXEDDB_STORE } from "./indexedDb";
|
|
7
5
|
export declare const LAND_DOCUMENT_STORAGE_KEY = "land.canvas.document";
|
|
8
6
|
export declare const LAND_SESSION_STORAGE_KEY = "land.canvas.session";
|
|
9
|
-
export
|
|
7
|
+
export { LAND_DOCUMENT_INDEXEDDB_NAME, LAND_DOCUMENT_INDEXEDDB_STORE, LAND_DOCUMENT_INDEXEDDB_VERSION, LAND_IMAGE_BLOB_INDEXEDDB_STORE, };
|
|
10
8
|
export interface LocalSnapshotPersistenceOptions {
|
|
11
9
|
storageNamespace?: string;
|
|
12
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ShapeId } from "../../_vendor/canvas-core/index";
|
|
2
|
-
import type { CanvasProductController, CanvasProductControllerSnapshot, CanvasProductControllerOptions, CanvasProductSessionSnapshot } from "../../core/controller";
|
|
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
5
|
export interface BuiltInCanvasControllerSnapshot<TToolId extends string = string> extends CanvasProductControllerSnapshot<TToolId> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AssetId, Editor } from "../../_vendor/canvas-core/index";
|
|
2
2
|
import type { GeoShapeKind } from "../../_vendor/plugin-geo/index";
|
|
3
|
-
import type { CanvasProductLayerNode } from "../../core/controller";
|
|
3
|
+
import type { CanvasProductLayerNode } from "../../core/product-controller";
|
|
4
4
|
export interface BuiltInCanvasLayerNode extends CanvasProductLayerNode {
|
|
5
5
|
geoKind?: GeoShapeKind;
|
|
6
6
|
imageAssetId?: AssetId | null;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Editor, ShapeColor, ShapeId } from "../../_vendor/canvas-core/index";
|
|
2
2
|
import { type ArrowShapeProps } from "../../_vendor/plugin-arrow/index";
|
|
3
|
+
import type { GeoShapeProps } from "../../_vendor/plugin-geo/index";
|
|
3
4
|
import { type TextShapeProps } from "../../_vendor/plugin-text/index";
|
|
4
|
-
import type { CanvasProductShapeRef } from "../../core/controller";
|
|
5
|
+
import type { CanvasProductShapeRef } from "../../core/product-controller";
|
|
5
6
|
export interface BuiltInCanvasShapeInput {
|
|
6
7
|
x: number;
|
|
7
8
|
y: number;
|
|
@@ -12,6 +13,9 @@ export interface BuiltInCanvasShapeInput {
|
|
|
12
13
|
strokeWidth?: number;
|
|
13
14
|
meta?: Record<string, unknown>;
|
|
14
15
|
}
|
|
16
|
+
export interface BuiltInCanvasRectangleInput extends BuiltInCanvasShapeInput {
|
|
17
|
+
cornerRadiusPercent?: GeoShapeProps["cornerRadiusPercent"];
|
|
18
|
+
}
|
|
15
19
|
export interface BuiltInCanvasTextInput {
|
|
16
20
|
x: number;
|
|
17
21
|
y: number;
|
|
@@ -53,7 +57,7 @@ export interface BuiltInCanvasArrowInput {
|
|
|
53
57
|
meta?: Record<string, unknown>;
|
|
54
58
|
}
|
|
55
59
|
export interface BuiltInGeoController {
|
|
56
|
-
createRectangle(input:
|
|
60
|
+
createRectangle(input: BuiltInCanvasRectangleInput): CanvasProductShapeRef | null;
|
|
57
61
|
createEllipse(input: BuiltInCanvasShapeInput): CanvasProductShapeRef | null;
|
|
58
62
|
createDiamond(input: BuiltInCanvasShapeInput): CanvasProductShapeRef | null;
|
|
59
63
|
createTriangle(input: BuiltInCanvasShapeInput): CanvasProductShapeRef | null;
|
package/builtins/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { builtInCanvasExtensions, createBuiltInCanvasExtensions, hasBuiltInCanva
|
|
|
2
2
|
export type { BuiltInCanvasExtension, BuiltInCanvasExtensionOptions, } from "./extensions";
|
|
3
3
|
export { createBuiltInCanvasController, useBuiltInCanvasController, } from "./controller/createBuiltInCanvasController";
|
|
4
4
|
export type { BuiltInCanvasController, BuiltInCanvasControllerSnapshot, BuiltInCanvasLayerNode, } from "./controller/createBuiltInCanvasController";
|
|
5
|
-
export type { BuiltInArrowController, BuiltInCanvasArrowBindingInput, BuiltInCanvasArrowInput, BuiltInCanvasFrameInput, BuiltInCanvasShapeCreationControllers, BuiltInCanvasShapeInput, BuiltInCanvasTextInput, BuiltInFrameController, BuiltInGeoController, BuiltInTextController, } from "./controller/shapeCreationController";
|
|
5
|
+
export type { BuiltInArrowController, BuiltInCanvasArrowBindingInput, BuiltInCanvasArrowInput, BuiltInCanvasFrameInput, BuiltInCanvasRectangleInput, BuiltInCanvasShapeCreationControllers, BuiltInCanvasShapeInput, BuiltInCanvasTextInput, BuiltInFrameController, BuiltInGeoController, BuiltInTextController, } from "./controller/shapeCreationController";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { ToolbarSurfaces } from "./
|
|
2
|
+
import type { ToolbarSurfaces } from "./useToolbarSurfaces";
|
|
3
3
|
export declare function FloatingSelectionToolbarPageSpace({ children, className, dataUi, offset, surfaces, }: {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
className?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ToolbarGroup } from "
|
|
1
|
+
import { type ToolbarGroup } from "../../_vendor/canvas-core/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,5 +1,5 @@
|
|
|
1
1
|
import type { Editor, CanvasActionContext, ToolbarGroup } from "../../_vendor/canvas-core/index";
|
|
2
|
-
import type {
|
|
2
|
+
import type { CanvasRenderPluginHostRuntime } from "../../_vendor/canvas-react/host/index";
|
|
3
3
|
export interface FloatingSelectionToolbarPageAnchor {
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
@@ -22,5 +22,5 @@ export interface ToolbarSurfaces {
|
|
|
22
22
|
export declare function useToolbarSurfaces({ canShowContextToolbarDuringEditing, editor, pluginHostRuntime, }: {
|
|
23
23
|
canShowContextToolbarDuringEditing?: (context: CanvasActionContext) => boolean;
|
|
24
24
|
editor: Editor;
|
|
25
|
-
pluginHostRuntime:
|
|
25
|
+
pluginHostRuntime: CanvasRenderPluginHostRuntime;
|
|
26
26
|
}): ToolbarSurfaces;
|
package/chrome/types.d.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import type { CanvasKitController, CanvasKitBaseController } from "../controller/canvasKitController";
|
|
2
2
|
import type { BuiltInCanvasLayerNode } from "../builtins";
|
|
3
3
|
import type { ActiveContextMenu, EditorSelectionState, ShapeId, CanvasActionValue, CanvasActionContext } from "../_vendor/canvas-core/index";
|
|
4
|
-
import type { HistoryControls
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
4
|
+
import type { HistoryControls } from "./useHistoryControls";
|
|
5
|
+
import type { PageControls } from "./usePageControls";
|
|
6
|
+
import type { ZoomControlsState } from "./useZoomControls";
|
|
7
|
+
import type { ContextMenuSurface } from "./useContextMenuSurface";
|
|
8
|
+
import type { SvgExportControls } from "./useSvgExport";
|
|
9
|
+
import type { ToolbarSurfaces } from "./toolbar/useToolbarSurfaces";
|
|
8
10
|
import type { ProductPersistenceStatus } from "../core";
|
|
9
11
|
export type { ContextMenuCommandItem, ContextMenuItem, ContextMenuSection, EditorSelectionState, ShapeId, CanvasActionValue, CanvasActionContext, ToolbarGroup, ToolbarItem, } from "../_vendor/canvas-core/index";
|
|
10
|
-
export type { HistoryControls
|
|
11
|
-
export type {
|
|
12
|
-
export type {
|
|
13
|
-
export type {
|
|
12
|
+
export type { HistoryControls } from "./useHistoryControls";
|
|
13
|
+
export type { PageControls } from "./usePageControls";
|
|
14
|
+
export type { ZoomControlsState } from "./useZoomControls";
|
|
15
|
+
export type { ContextMenuSurface } from "./useContextMenuSurface";
|
|
16
|
+
export type { SvgExportControls, } from "./useSvgExport";
|
|
17
|
+
export type { ToolbarSurfaces, } from "./toolbar/useToolbarSurfaces";
|
|
14
18
|
export type CanvasKitLayerNode = BuiltInCanvasLayerNode;
|
|
15
19
|
export interface CanvasKitToolbarActionState {
|
|
16
20
|
value: CanvasActionValue | undefined;
|
|
@@ -2,15 +2,17 @@ import { type RefObject } from "react";
|
|
|
2
2
|
import { type ActiveContextMenu } from "../_vendor/canvas-core/index";
|
|
3
3
|
import type { CanvasKitBaseController } from "../controller/canvasKitController";
|
|
4
4
|
import type { CanvasKitRuntime } from "../runtime/canvasKitRuntime";
|
|
5
|
-
import type {
|
|
6
|
-
import type { ProductServiceRegistry } from "../core";
|
|
5
|
+
import type { CanvasKitChromeSlot, CanvasKitHostFeature } from "../runtime/canvasKitHostContracts";
|
|
6
|
+
import type { ProductApiRegistry, ProductServiceRegistry } from "../core";
|
|
7
7
|
import type { CanvasKitChromeContext, CanvasKitGridControls, CanvasKitPersistenceControls } from "./types";
|
|
8
|
-
export declare function useCanvasKitChromeContext<TController extends CanvasKitBaseController>({ controller, activeContextMenu, editor, grid,
|
|
8
|
+
export declare function useCanvasKitChromeContext<TController extends CanvasKitBaseController>({ apis, controller, activeContextMenu, chromeSlots, editor, grid, hostFeatures, onActiveContextMenuChange, persistence, pluginHostRuntime, services, themeRootRef, }: {
|
|
9
|
+
apis: ProductApiRegistry;
|
|
9
10
|
controller: TController;
|
|
10
11
|
activeContextMenu: ActiveContextMenu | null;
|
|
12
|
+
chromeSlots: readonly CanvasKitChromeSlot<string, unknown>[];
|
|
11
13
|
editor: CanvasKitRuntime["editor"];
|
|
12
14
|
grid: CanvasKitGridControls;
|
|
13
|
-
|
|
15
|
+
hostFeatures: readonly CanvasKitHostFeature[];
|
|
14
16
|
onActiveContextMenuChange: (activeContextMenu: ActiveContextMenu | null) => void;
|
|
15
17
|
persistence: CanvasKitPersistenceControls;
|
|
16
18
|
pluginHostRuntime: CanvasKitRuntime["pluginHostRuntime"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CanvasKitLayerTreeSource, CanvasKitLayerNode } from "
|
|
1
|
+
import type { CanvasKitLayerTreeSource, CanvasKitLayerNode } from "./types";
|
|
2
2
|
export declare function useCanvasKitLayerTree(source: CanvasKitLayerTreeSource, options?: {
|
|
3
3
|
enabled?: boolean;
|
|
4
4
|
pageId?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ContextMenuContext, ActiveContextMenu, ContextMenuSection, Editor } from "
|
|
2
|
-
import type {
|
|
1
|
+
import type { ContextMenuContext, ActiveContextMenu, ContextMenuSection, Editor } from "../_vendor/canvas-core/index";
|
|
2
|
+
import type { CanvasRenderPluginHostRuntime } from "../_vendor/canvas-react/host/index";
|
|
3
3
|
export interface ContextMenuSurface {
|
|
4
4
|
context: ContextMenuContext | null;
|
|
5
5
|
activeContextMenu: ActiveContextMenu | null;
|
|
@@ -8,5 +8,5 @@ export interface ContextMenuSurface {
|
|
|
8
8
|
export declare function useContextMenuSurface({ editor, activeContextMenu, pluginHostRuntime, }: {
|
|
9
9
|
editor: Editor;
|
|
10
10
|
activeContextMenu: ActiveContextMenu | null;
|
|
11
|
-
pluginHostRuntime:
|
|
11
|
+
pluginHostRuntime: CanvasRenderPluginHostRuntime;
|
|
12
12
|
}): ContextMenuSurface;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
|
+
import type { CanvasKitHostFeature } from "../runtime/canvasKitHostContracts";
|
|
3
|
+
export interface HistoryControls {
|
|
4
|
+
canUndo: boolean;
|
|
5
|
+
canRedo: boolean;
|
|
6
|
+
undo(): void;
|
|
7
|
+
redo(): void;
|
|
8
|
+
}
|
|
9
|
+
export declare function useHistoryControls({ editor, hostFeatures, }: {
|
|
10
|
+
editor: Editor;
|
|
11
|
+
hostFeatures: readonly CanvasKitHostFeature[];
|
|
12
|
+
}): HistoryControls;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Editor, PageId, PageRecord } from "../_vendor/canvas-core/index";
|
|
2
|
+
import type { CanvasKitHostFeature } from "../runtime/canvasKitHostContracts";
|
|
3
|
+
export interface PageControls {
|
|
4
|
+
pages: readonly PageRecord[];
|
|
5
|
+
currentPage: PageRecord | null;
|
|
6
|
+
currentPageId: PageId;
|
|
7
|
+
canDeleteCurrentPage: boolean;
|
|
8
|
+
createPage(): void;
|
|
9
|
+
deleteCurrentPage(): void;
|
|
10
|
+
renameCurrentPage(nextName: string): void;
|
|
11
|
+
selectPage(pageId: PageId): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function usePageControls({ editor, hostFeatures, }: {
|
|
14
|
+
editor: Editor;
|
|
15
|
+
hostFeatures: readonly CanvasKitHostFeature[];
|
|
16
|
+
}): PageControls;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
|
-
import type { Editor, ShapeId } from "
|
|
3
|
-
import { type ExportStatus as ProductExportStatus, type SvgAssetInliner as ProductSvgAssetInliner, type SvgExportResult as ProductSvgExportResult } from "
|
|
2
|
+
import type { Editor, ShapeId } from "../_vendor/canvas-core/index";
|
|
3
|
+
import { type ExportStatus as ProductExportStatus, type SvgAssetInliner as ProductSvgAssetInliner, type SvgExportResult as ProductSvgExportResult } from "../features/export/svgExport";
|
|
4
4
|
export type ExportStatus = ProductExportStatus;
|
|
5
5
|
export type SvgAssetInliner = ProductSvgAssetInliner;
|
|
6
6
|
export type SvgExportResult = ProductSvgExportResult;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
|
+
export interface ZoomControlsState {
|
|
3
|
+
zoom: number;
|
|
4
|
+
label: string;
|
|
5
|
+
zoomIn(): void;
|
|
6
|
+
zoomOut(): void;
|
|
7
|
+
resetZoom(): void;
|
|
8
|
+
}
|
|
9
|
+
export declare function useZoomControls(editor: Editor): ZoomControlsState;
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import { type CanvasProductController, type CanvasProductControllerContext, type CanvasProductSessionSnapshot } from "../core/controller";
|
|
2
|
-
import type {
|
|
3
|
-
import { type BuiltInCanvasController, type BuiltInCanvasControllerSnapshot, type BuiltInCanvasFrameInput, type BuiltInCanvasShapeInput, type BuiltInCanvasTextInput } from "../builtins";
|
|
4
|
-
import {
|
|
1
|
+
import { type CanvasProductController, type CanvasProductControllerContext, type CanvasProductSessionSnapshot } from "../core/product-controller";
|
|
2
|
+
import type { CanvasRenderPluginHostRuntime } from "../_vendor/canvas-react/host/index";
|
|
3
|
+
import { type BuiltInCanvasController, type BuiltInCanvasControllerSnapshot, type BuiltInCanvasFrameInput, type BuiltInCanvasRectangleInput, type BuiltInCanvasShapeInput, type BuiltInCanvasTextInput } from "../builtins";
|
|
4
|
+
import type { CanvasKitControllerSlot } from "../runtime/canvasKitHostContracts";
|
|
5
5
|
export type CanvasKitShapeInput = BuiltInCanvasShapeInput;
|
|
6
|
+
export type CanvasKitRectangleInput = BuiltInCanvasRectangleInput;
|
|
6
7
|
export type CanvasKitTextInput = BuiltInCanvasTextInput;
|
|
7
8
|
export type CanvasKitFrameInput = BuiltInCanvasFrameInput;
|
|
8
9
|
export interface CanvasKitBaseController<TToolId extends string = string> extends CanvasProductController<TToolId> {
|
|
9
10
|
}
|
|
11
|
+
export interface CanvasKitControllerSlots {
|
|
12
|
+
}
|
|
10
13
|
export declare const CANVAS_KIT_TOOL_IDS: readonly ["select", "hand", "rectangle", "ellipse", "diamond", "triangle", "hexagon", "star", "arrow", "draw", "path", "text", "frame", "eraser", "laser"];
|
|
11
14
|
export type CanvasKitToolId = (typeof CANVAS_KIT_TOOL_IDS)[number];
|
|
12
15
|
export interface CanvasKitControllerSnapshot<TToolId extends string = CanvasKitToolId> extends BuiltInCanvasControllerSnapshot<TToolId> {
|
|
13
16
|
productId: string;
|
|
14
17
|
session: CanvasProductSessionSnapshot<TToolId>;
|
|
15
18
|
}
|
|
16
|
-
export interface CanvasKitController<TToolId extends string = CanvasKitToolId> extends BuiltInCanvasController<TToolId
|
|
17
|
-
image: ImageProductController | null;
|
|
19
|
+
export interface CanvasKitController<TToolId extends string = CanvasKitToolId> extends BuiltInCanvasController<TToolId>, CanvasKitControllerSlots {
|
|
18
20
|
snapshot(): CanvasKitControllerSnapshot<TToolId>;
|
|
19
21
|
}
|
|
20
22
|
export interface CanvasKitControllerRuntimeContext extends Omit<CanvasProductControllerContext, "pluginHostRuntime"> {
|
|
21
|
-
|
|
23
|
+
controllerSlots: readonly CanvasKitControllerSlot<string, unknown>[];
|
|
24
|
+
pluginHostRuntime: CanvasRenderPluginHostRuntime;
|
|
22
25
|
}
|
|
23
26
|
export interface CanvasKitControllerOptions<TToolId extends string = CanvasKitToolId> extends CanvasKitControllerRuntimeContext {
|
|
24
27
|
assertToolId?: (toolId: string) => asserts toolId is TToolId;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ProductApiToken<TApi> {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly __api?: TApi;
|
|
4
|
+
}
|
|
5
|
+
export interface ProductApiRegistry {
|
|
6
|
+
get<TApi>(token: ProductApiToken<TApi>): TApi | null;
|
|
7
|
+
}
|
|
8
|
+
export interface ProductApiRegistryRuntime extends ProductApiRegistry {
|
|
9
|
+
register<TApi>(token: ProductApiToken<TApi>, api: TApi): void;
|
|
10
|
+
}
|
|
11
|
+
export declare function createProductApiToken<TApi>(id: string): ProductApiToken<TApi>;
|
|
12
|
+
export declare function createProductApiRegistry(): ProductApiRegistryRuntime;
|
package/core/index.d.ts
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
export { createDefaultCanvasProductEditor } from "./runtime/productEditor";
|
|
2
2
|
export { cleanupProductAssetsAfterRestore, preloadProductAssets, resolveProductAssetUrl, } from "./runtime/productAssets";
|
|
3
|
-
export {
|
|
3
|
+
export { createProductApiRegistry, createProductApiToken, } from "./api/apiRegistry";
|
|
4
4
|
export { createProductServiceRegistry, createProductServiceToken, requireProductService, } from "./runtime/productServices";
|
|
5
|
-
export { CANVAS_KIT_HOST_ACTION_IDS } from "./features/hostActionIds";
|
|
6
5
|
export type { CanvasProductRuntimeInitializer, CanvasProductRuntimeInitializerContext, CreateCanvasProductEditorOptions, ProductPersistenceAdapter, ProductPersistenceRestoreResult, ProductPersistenceStatus, } from "./runtime/productDefinition";
|
|
7
|
-
export type {
|
|
8
|
-
export type { ProductContextMenuRegistry, ProductPluginHostRuntime, ProductToolbarRegistry, } from "./runtime/productHost";
|
|
6
|
+
export type { ProductActionRegistry, ProductContextMenuRegistry, ProductPluginHostRuntime, ProductToolbarRegistry, } from "./runtime/productHost";
|
|
9
7
|
export type { ProductAssetResolverService, ProductServiceFactory, ProductServiceFactoryContext, ProductServiceRegistry, ProductServiceRegistryRuntime, ProductServiceToken, } from "./runtime/productServices";
|
|
10
|
-
export type {
|
|
11
|
-
export type { CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductShapeData, CanvasProductShapeUpdate, } from "./controller";
|
|
12
|
-
export { SYSTEM_SELECTION_BRING_FORWARD_ACTION_ID, SYSTEM_SELECTION_BRING_TO_FRONT_ACTION_ID, SYSTEM_SELECTION_DELETE_ACTION_ID, SYSTEM_SELECTION_DUPLICATE_ACTION_ID, SYSTEM_SELECTION_FLIP_HORIZONTAL_ACTION_ID, SYSTEM_SELECTION_FLIP_VERTICAL_ACTION_ID, SYSTEM_SELECTION_GROUP_ACTION_ID, SYSTEM_SELECTION_RESET_ROTATION_ACTION_ID, SYSTEM_SELECTION_SELECT_ALL_ACTION_ID, SYSTEM_SELECTION_SEND_BACKWARD_ACTION_ID, SYSTEM_SELECTION_SEND_TO_BACK_ACTION_ID, SYSTEM_SELECTION_UNGROUP_ACTION_ID, runCanvasAction, } from "./features/actions/canvasActions";
|
|
13
|
-
export { createToolbarProductContribution } from "./features/toolbar/toolbarContribution";
|
|
14
|
-
export { createCanvasActionContext } from "./features/actions/canvasActionContext";
|
|
15
|
-
export { getActiveToolLabel, getSelectionToolbarTitle, } from "./features/toolbar/toolbarLabels";
|
|
16
|
-
export { SYSTEM_VIEW_RESET_ZOOM_ACTION_ID, SYSTEM_VIEW_ZOOM_IN_ACTION_ID, SYSTEM_VIEW_ZOOM_OUT_ACTION_ID, runContextMenuAction, } from "./features/context-menu/contextMenuActions";
|
|
17
|
-
export { createContextMenuProductContribution } from "./features/context-menu/contextMenuContribution";
|
|
18
|
-
export { createContextMenuContext, getContextMenuContributionTarget, } from "./features/context-menu/contextMenuContext";
|
|
19
|
-
export { canvasClipboardServiceToken, memoryCanvasClipboardService, } from "./features/clipboard/clipboardService";
|
|
20
|
-
export type { CanvasClipboardService } from "./features/clipboard/clipboardService";
|
|
21
|
-
export { SYSTEM_CLIPBOARD_COPY_ACTION_ID, SYSTEM_CLIPBOARD_CUT_ACTION_ID, SYSTEM_CLIPBOARD_PASTE_ACTION_ID, SYSTEM_CLIPBOARD_PASTE_AT_POINT_ACTION_ID, createClipboardProductContribution, registerClipboardActions, } from "./features/clipboard/clipboardContribution";
|
|
22
|
-
export { getCanvasClipboardService, } from "./features/clipboard/clipboardService";
|
|
23
|
-
export { exportEditorSvg, getSvgExportStatus, } from "./features/export/svgExport";
|
|
24
|
-
export type { ExportStatus, SvgAssetInliner, SvgExportOptions, SvgExportResult, } from "./features/export/svgExport";
|
|
8
|
+
export type { ProductApiRegistry, ProductApiRegistryRuntime, ProductApiToken, } from "./api/apiRegistry";
|
|
9
|
+
export type { CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductCreatePageInput, CanvasProductDocumentRef, CanvasProductShapeData, CanvasProductShapeUpdate, } from "./product-controller";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Camera, ChangeSource, Editor, LayerOrderDirection, LayerOrderEdge, ReparentShapePlacementFailureReason, ShapeId } from "../../_vendor/canvas-core/index";
|
|
2
2
|
import type { ProductServiceRegistry } from "../runtime/productServices";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ProductApiRegistry } from "../api/apiRegistry";
|
|
4
4
|
export interface CanvasProductShapeRef {
|
|
5
5
|
id: ShapeId;
|
|
6
6
|
type: string;
|
|
@@ -52,8 +52,13 @@ export interface CanvasProductSessionSnapshot<TToolId extends string = string> {
|
|
|
52
52
|
isToolLocked: boolean;
|
|
53
53
|
pages: CanvasProductSessionPageState[];
|
|
54
54
|
}
|
|
55
|
+
export interface CanvasProductDocumentRef {
|
|
56
|
+
id: string;
|
|
57
|
+
meta: Record<string, unknown>;
|
|
58
|
+
}
|
|
55
59
|
export interface CanvasProductControllerSnapshot<TToolId extends string = string> {
|
|
56
60
|
productId: string;
|
|
61
|
+
document: CanvasProductDocumentRef;
|
|
57
62
|
pageId: string;
|
|
58
63
|
activeToolId: TToolId;
|
|
59
64
|
selectedShapeIds: ShapeId[];
|
|
@@ -105,9 +110,14 @@ export interface CanvasProductPageRef {
|
|
|
105
110
|
id: string;
|
|
106
111
|
name: string;
|
|
107
112
|
index: string;
|
|
113
|
+
meta: Record<string, unknown>;
|
|
114
|
+
}
|
|
115
|
+
export interface CanvasProductCreatePageInput {
|
|
116
|
+
name?: string;
|
|
117
|
+
meta?: Record<string, unknown>;
|
|
108
118
|
}
|
|
109
119
|
export interface CanvasProductController<TToolId extends string = string> {
|
|
110
|
-
|
|
120
|
+
apis: ProductApiRegistry;
|
|
111
121
|
snapshot(): CanvasProductControllerSnapshot<TToolId>;
|
|
112
122
|
subscribe(listener: CanvasProductControllerChangeListener<TToolId>): () => void;
|
|
113
123
|
clearHistory(): void;
|
|
@@ -115,6 +125,8 @@ export interface CanvasProductController<TToolId extends string = string> {
|
|
|
115
125
|
canRedo(): boolean;
|
|
116
126
|
undo(): boolean;
|
|
117
127
|
redo(): boolean;
|
|
128
|
+
getDocument(): CanvasProductDocumentRef;
|
|
129
|
+
updateDocumentMeta(patch: Record<string, unknown>): CanvasProductDocumentRef;
|
|
118
130
|
select(ids: ShapeId[]): void;
|
|
119
131
|
selectAll(): void;
|
|
120
132
|
deleteSelection(): void;
|
|
@@ -139,8 +151,9 @@ export interface CanvasProductController<TToolId extends string = string> {
|
|
|
139
151
|
setCamera(camera: Partial<Camera>, pageId?: string): void;
|
|
140
152
|
resetView(): void;
|
|
141
153
|
getPages(): CanvasProductPageRef[];
|
|
142
|
-
createPage(
|
|
154
|
+
createPage(input?: CanvasProductCreatePageInput): CanvasProductPageRef;
|
|
143
155
|
renamePage(pageId: string, name: string): void;
|
|
156
|
+
updatePageMeta(pageId: string, patch: Record<string, unknown>): string | null;
|
|
144
157
|
deletePage(pageId: string): boolean;
|
|
145
158
|
selectPage(pageId: string): void;
|
|
146
159
|
exportSelectionSvg(): string | null;
|
|
@@ -150,7 +163,7 @@ export interface CanvasProductControllerContext {
|
|
|
150
163
|
editor: Editor;
|
|
151
164
|
services: ProductServiceRegistry;
|
|
152
165
|
pluginHostRuntime: unknown;
|
|
153
|
-
|
|
166
|
+
apis: ProductApiRegistry;
|
|
154
167
|
productId: string;
|
|
155
168
|
}
|
|
156
169
|
export interface CanvasProductControllerOptions<TToolId extends string = string> extends CanvasProductControllerContext {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { createCanvasProductController } from "./canvasProductController";
|
|
2
|
+
export type { CanvasProductController, CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductControllerContext, CanvasProductControllerOptions, CanvasProductControllerSnapshot, CanvasProductCreatePageInput, CanvasProductDocumentRef, CanvasProductLayerActionState, CanvasProductLayerNode, CanvasProductLayerPlacement, CanvasProductLayerPlacementFailureReason, CanvasProductLayerPlacementResult, CanvasProductPageRef, CanvasProductShapeData, CanvasProductSessionPageState, CanvasProductSessionSnapshot, CanvasProductShapeRef, CanvasProductShapeUpdate, } from "./canvasProductController";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AssetId, Editor,
|
|
2
|
-
import type {
|
|
1
|
+
import type { AssetId, Editor, LandEditorRuntimePlugin } from "../../_vendor/canvas-core/index";
|
|
2
|
+
import type { ProductApiRegistryRuntime } from "../api/apiRegistry";
|
|
3
3
|
import type { ProductPluginHostRuntime } from "./productHost";
|
|
4
4
|
import type { ProductServiceRegistry } from "./productServices";
|
|
5
5
|
export interface ProductPersistenceRestoreResult {
|
|
@@ -19,12 +19,13 @@ export interface ProductPersistenceAdapter {
|
|
|
19
19
|
discardUnsupportedRecords?(editor: Editor): Promise<ProductPersistenceRestoreResult | void>;
|
|
20
20
|
}
|
|
21
21
|
export interface CreateCanvasProductEditorOptions {
|
|
22
|
-
|
|
22
|
+
editorRuntimePlugins: readonly LandEditorRuntimePlugin[];
|
|
23
|
+
documentMeta?: Record<string, unknown>;
|
|
23
24
|
resolveAssetUrl?: (assetId: AssetId) => string | null;
|
|
24
25
|
}
|
|
25
26
|
export interface CanvasProductRuntimeInitializerContext<TPluginHostRuntime extends ProductPluginHostRuntime = ProductPluginHostRuntime> {
|
|
26
27
|
productId: string;
|
|
27
|
-
|
|
28
|
+
apis: ProductApiRegistryRuntime;
|
|
28
29
|
editor: Editor;
|
|
29
30
|
pluginHostRuntime: TPluginHostRuntime;
|
|
30
31
|
services: ProductServiceRegistry;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ContextMenuContribution, CanvasAction, ToolbarContribution } from "../../_vendor/canvas-core/index";
|
|
2
|
-
export interface
|
|
2
|
+
export interface ProductActionRegistry {
|
|
3
3
|
registerAction(action: CanvasAction): void;
|
|
4
4
|
registerHostAction(action: CanvasAction): void;
|
|
5
|
-
registerContribution(contribution: ToolbarContribution): void;
|
|
6
5
|
getAction(actionId: string): CanvasAction | null;
|
|
7
6
|
getDuplicateActionIds(): string[];
|
|
7
|
+
}
|
|
8
|
+
export interface ProductToolbarRegistry {
|
|
9
|
+
registerContribution(contribution: ToolbarContribution): void;
|
|
8
10
|
getDuplicateContributionIds(): string[];
|
|
9
11
|
}
|
|
10
12
|
export interface ProductContextMenuRegistry {
|
|
@@ -12,6 +14,7 @@ export interface ProductContextMenuRegistry {
|
|
|
12
14
|
getDuplicateContributionIds(): string[];
|
|
13
15
|
}
|
|
14
16
|
export interface ProductPluginHostRuntime {
|
|
17
|
+
actionRegistry: ProductActionRegistry;
|
|
15
18
|
toolbarRegistry: ProductToolbarRegistry;
|
|
16
19
|
contextMenuRegistry: ProductContextMenuRegistry;
|
|
17
20
|
}
|
package/{core/features/actions/canvasActionContext.d.ts → features/actions/actionRuntime.d.ts}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CanvasActionContext, Editor } from "../../_vendor/canvas-core/index";
|
|
2
|
+
import type { ProductPluginHostRuntime } from "../../core/runtime/productHost";
|
|
2
3
|
export declare function createCanvasActionContext({ editor, toolState, selectionState, }: {
|
|
3
4
|
editor: Editor;
|
|
4
5
|
toolState: {
|
|
@@ -13,3 +14,8 @@ export declare function createCanvasActionContext({ editor, toolState, selection
|
|
|
13
14
|
isMixedFrameAndPointHandleSelection: boolean;
|
|
14
15
|
};
|
|
15
16
|
}): CanvasActionContext;
|
|
17
|
+
export declare function runCanvasAction({ context, pluginHostRuntime, actionId, }: {
|
|
18
|
+
context: CanvasActionContext;
|
|
19
|
+
pluginHostRuntime: ProductPluginHostRuntime;
|
|
20
|
+
actionId: string;
|
|
21
|
+
}): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ContextMenuContribution } from "
|
|
1
|
+
import type { ContextMenuContribution } from "../../_vendor/canvas-core/index";
|
|
2
2
|
export declare const clipboardContextMenuContributions: readonly ContextMenuContribution[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CanvasAction, KeyboardShortcutInput } from "../../_vendor/canvas-core/index";
|
|
2
|
+
import type { ProductServiceRegistry } from "../../core/runtime/productServices";
|
|
3
|
+
export declare const SYSTEM_CLIPBOARD_COPY_ACTION_ID = "system.clipboard.copy";
|
|
4
|
+
export declare const SYSTEM_CLIPBOARD_CUT_ACTION_ID = "system.clipboard.cut";
|
|
5
|
+
export declare const SYSTEM_CLIPBOARD_PASTE_ACTION_ID = "system.clipboard.paste";
|
|
6
|
+
export declare const SYSTEM_CLIPBOARD_PASTE_AT_POINT_ACTION_ID = "system.clipboard.paste-at-point";
|
|
7
|
+
export declare const clipboardActionShortcuts: readonly {
|
|
8
|
+
actionId: string;
|
|
9
|
+
shortcut: KeyboardShortcutInput;
|
|
10
|
+
}[];
|
|
11
|
+
export declare function createClipboardActions(services: ProductServiceRegistry): readonly CanvasAction[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { EditorClipboardPayload } from "
|
|
2
|
-
import { type ProductServiceFactory, type ProductServiceRegistry } from "../../runtime/productServices";
|
|
1
|
+
import type { EditorClipboardPayload } from "../../_vendor/canvas-core/index";
|
|
2
|
+
import { type ProductServiceFactory, type ProductServiceRegistry } from "../../core/runtime/productServices";
|
|
3
3
|
export interface CanvasClipboardService {
|
|
4
4
|
write(payload: EditorClipboardPayload): Promise<void>;
|
|
5
5
|
read(): Promise<EditorClipboardPayload | null>;
|
|
6
6
|
getMemoryPayload(): EditorClipboardPayload | null;
|
|
7
7
|
}
|
|
8
|
-
export declare const canvasClipboardServiceToken: import("
|
|
8
|
+
export declare const canvasClipboardServiceToken: import("../../core").ProductServiceToken<CanvasClipboardService>;
|
|
9
9
|
export declare function getCanvasClipboardService(services: ProductServiceRegistry): CanvasClipboardService | null;
|
|
10
10
|
export declare function memoryCanvasClipboardService(): ProductServiceFactory<CanvasClipboardService>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CanvasActionValue, ContextMenuContext, ContextMenuContributionTarget, ContextMenuTarget, Editor } from "../../_vendor/canvas-core/index";
|
|
2
|
+
import type { ProductPluginHostRuntime } from "../../core/runtime/productHost";
|
|
3
|
+
export declare function createContextMenuContext({ editor, menu, }: {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
menu: ContextMenuContext["menu"];
|
|
6
|
+
}): ContextMenuContext;
|
|
7
|
+
export declare function getContextMenuContributionTarget(target: ContextMenuTarget, editor: Editor): ContextMenuContributionTarget;
|
|
8
|
+
export declare function runContextMenuAction({ actionId, context, pluginHostRuntime, value, }: {
|
|
9
|
+
actionId: string;
|
|
10
|
+
context: ContextMenuContext;
|
|
11
|
+
pluginHostRuntime: ProductPluginHostRuntime;
|
|
12
|
+
value?: CanvasActionValue;
|
|
13
|
+
}): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Editor, ExportIntegrityReport, ShapeCapabilityManifest, ShapeId, SvgExportSkippedShape, SvgThemeColorResolver } from "
|
|
1
|
+
import type { Editor, ExportIntegrityReport, ShapeCapabilityManifest, ShapeId, SvgExportSkippedShape, SvgThemeColorResolver } from "../../_vendor/canvas-core/index";
|
|
2
2
|
export interface SvgAssetInliner {
|
|
3
3
|
inline(input: {
|
|
4
4
|
editor: Editor;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Editor } from "../../../_vendor/canvas-core/index";
|
|
2
|
+
import { type ProductAssetResolverService, type ProductServiceFactory } from "../../../core";
|
|
3
|
+
import { type ImageObjectUrlStore } from "./imageBlobStore";
|
|
4
|
+
export interface ImageAssetService extends ProductAssetResolverService {
|
|
5
|
+
objectUrls: ImageObjectUrlStore;
|
|
6
|
+
}
|
|
7
|
+
export interface ImageAssetServiceOptions {
|
|
8
|
+
flushSnapshot?: (editor: Editor) => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const imageAssetServiceToken: import("../../../core").ProductServiceToken<ImageAssetService>;
|
|
11
|
+
export declare function localImageAssetService({ flushSnapshot, }?: ImageAssetServiceOptions): ProductServiceFactory<ImageAssetService>;
|