@yuzhouu/canvas-kit 0.1.12 → 0.1.13
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 +27 -1
- package/_vendor/canvas-core/bindings/bindingUtil.d.ts +1 -0
- package/_vendor/canvas-core/editor/clipboard.d.ts +1 -1
- package/_vendor/canvas-core/editor/commands.d.ts +0 -2
- package/_vendor/canvas-core/editor/managers/bindingManager.d.ts +4 -0
- package/_vendor/canvas-core/editor/queries/shapeTransforms.d.ts +3 -4
- package/_vendor/canvas-core/editor/resizeGeometry.d.ts +20 -0
- package/_vendor/canvas-core/editor/selectionResizeCapabilities.d.ts +2 -0
- package/_vendor/canvas-core/geometry/mat.d.ts +2 -3
- package/_vendor/canvas-core/index.d.ts +4 -2
- package/_vendor/canvas-core/schema/records.d.ts +0 -1
- package/_vendor/canvas-core/schema/snapshots.d.ts +2 -2
- package/_vendor/canvas-core/shapes/childTransformPolicy.d.ts +16 -0
- package/_vendor/canvas-core/shapes/shapeUtil.d.ts +3 -3
- package/_vendor/plugin-text/textShapeHelpers.d.ts +0 -1
- package/browser/persistence.d.ts +1 -1
- package/canvasKitTools.d.ts +3 -0
- package/chrome/contextMenuRuntime.d.ts +7 -0
- package/chrome/toolbar/toolbarLabels.d.ts +1 -1
- package/chrome/types.d.ts +4 -5
- package/chrome/useCanvasKitChromeContext.d.ts +6 -6
- package/chrome/useCanvasKitLayerTree.d.ts +3 -2
- package/chrome/useHistoryControls.d.ts +3 -3
- package/chrome/usePageControls.d.ts +8 -8
- package/chrome/useZoomControls.d.ts +5 -1
- package/commands/command.d.ts +11 -0
- package/commands/commandTokens.d.ts +61 -0
- package/commands/documentCommands.d.ts +2 -0
- package/commands/historyCommands.d.ts +3 -0
- package/commands/index.d.ts +11 -0
- package/commands/layerCommands.d.ts +20 -0
- package/commands/pageCommands.d.ts +12 -0
- package/commands/selectionCommands.d.ts +12 -0
- package/commands/shapeCommands.d.ts +8 -0
- package/commands/toolCommands.d.ts +2 -0
- package/commands/viewCommands.d.ts +10 -0
- package/contracts/canvasProductControllerContracts.d.ts +32 -0
- package/{core/product-controller → controller}/canvasProductController.d.ts +27 -55
- package/controller/index.d.ts +3 -0
- package/{core/product-controller/productLayerTree.d.ts → controller/layerTree.d.ts} +1 -1
- package/index.d.ts +17 -15
- package/index.mjs +88 -88
- package/package.json +1 -1
- package/plugins/host/image/api/imageHostApi.d.ts +11 -0
- package/plugins/host/image/api/imageHostApiContract.d.ts +60 -0
- package/{features → plugins/host}/image/asset/imageAssetService.d.ts +3 -2
- package/{features → plugins/host}/image/asset/imageBlobStore.d.ts +2 -2
- package/{features → plugins/host}/image/asset/imageFileHelpers.d.ts +1 -1
- package/{features → plugins/host}/image/asset/svgImageAssetInliner.d.ts +1 -1
- package/{features → plugins/host}/image/import/ImageImportController.d.ts +2 -2
- package/{features → plugins/host}/image/index.d.ts +4 -4
- package/plugins/host/image/plugin.d.ts +1 -0
- package/{features → plugins/host}/image/smudge/imageSmudgeHostActions.d.ts +3 -3
- package/{features → plugins/host}/image/toolbar/imageHostActions.d.ts +8 -24
- package/{features → plugins/host}/image/toolbar/imageToolbarHostBridge.d.ts +2 -2
- package/{features → plugins/host}/text/link/TextLinkHoverPopover.d.ts +1 -1
- package/plugins/host/text/textHostPlugin.d.ts +5 -0
- package/plugins/host/text/textSvgAssetInliner.d.ts +3 -0
- package/plugins/host/text/textSvgAssetPlugin.d.ts +2 -0
- package/plugins/runtime/keyboard-shortcuts/useCanvasKeyboardShortcuts.d.ts +3 -5
- package/plugins/standard/selection/actions.d.ts +13 -13
- package/plugins/standard/tool-ui/contextMenu.d.ts +1 -1
- package/plugins/standard/view/actions.d.ts +4 -4
- package/react/CanvasKitRoot.d.ts +3 -2
- package/react/useCanvasProductControllerLifecycle.d.ts +9 -0
- package/runtime/canvasKitActionExecutor.d.ts +12 -0
- package/runtime/canvasKitCommandExecutor.d.ts +11 -2
- package/runtime/canvasKitPluginContracts.d.ts +6 -10
- package/runtime/canvasKitPluginLifecycle.d.ts +2 -2
- package/runtime/canvasKitPluginSetup.d.ts +6 -5
- package/runtime/canvasKitPluginUi.d.ts +2 -0
- package/runtime/canvasKitRuntime.d.ts +14 -5
- package/runtime/canvasKitRuntimeContracts.d.ts +8 -7
- package/runtime/createCanvasKitCommandAction.d.ts +10 -0
- package/runtime/createCanvasKitEditor.d.ts +7 -0
- package/{core/runtime/runtimeContracts.d.ts → runtime/persistenceContracts.d.ts} +1 -6
- package/runtime/persistenceCoordinator.d.ts +1 -1
- package/{core/runtime/productAssets.d.ts → runtime/productAssetResolvers.d.ts} +11 -2
- package/runtime/productServiceRegistry.d.ts +8 -0
- package/controller/canvasKitController.d.ts +0 -28
- package/core/index.d.ts +0 -7
- package/core/product-controller/index.d.ts +0 -2
- package/core/runtime/productEditor.d.ts +0 -3
- package/core/runtime/productServices.d.ts +0 -20
- package/features/context-menu/contextMenuRuntime.d.ts +0 -13
- package/features/image/controller/imageProductController.d.ts +0 -27
- package/features/image/imageHostPlugin.d.ts +0 -1
- package/features/image/smudge/imageSmudgeTypes.d.ts +0 -25
- package/features/text/textHostPlugin.d.ts +0 -5
- package/features/text/textSvgAssetInliner.d.ts +0 -3
- package/features/text/textSvgAssetPlugin.d.ts +0 -2
- package/react/useCanvasKitControllerLifecycle.d.ts +0 -8
package/package.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Editor } from "../../../../_vendor/canvas-core/index";
|
|
2
|
+
import type { ProductServiceRegistry } from "../../../../_vendor/canvas-product-contracts/index";
|
|
3
|
+
import { canvasKitImageHostApiToken, type CanvasKitImageHostApi } from "./imageHostApiContract";
|
|
4
|
+
export interface CanvasKitImageHostApiRuntimeOptions {
|
|
5
|
+
flushSnapshot?: () => Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare function createCanvasKitImageHostApi({ editor, flushSnapshot, services, }: CanvasKitImageHostApiRuntimeOptions & {
|
|
8
|
+
editor: Editor;
|
|
9
|
+
services: ProductServiceRegistry;
|
|
10
|
+
}): CanvasKitImageHostApi | null;
|
|
11
|
+
export { canvasKitImageHostApiToken };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { AssetId, ShapeId, Vec } from "../../../../_vendor/canvas-core/index";
|
|
2
|
+
import type { ImageShapeCrop, ImageSmudgeBrush, ImageSmudgeStroke } from "../../../../_vendor/plugin-image/index";
|
|
3
|
+
export type CanvasKitImageInsertStrategy = "auto" | "copy" | "link";
|
|
4
|
+
export type CanvasKitImageInsertSource = {
|
|
5
|
+
type: "file";
|
|
6
|
+
file: File;
|
|
7
|
+
} | {
|
|
8
|
+
type: "blob";
|
|
9
|
+
blob: Blob;
|
|
10
|
+
name?: string;
|
|
11
|
+
mimeType?: string;
|
|
12
|
+
originalUrl?: string;
|
|
13
|
+
} | {
|
|
14
|
+
type: "url";
|
|
15
|
+
url: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
altText?: string;
|
|
18
|
+
};
|
|
19
|
+
export interface CanvasKitImageInsertSize {
|
|
20
|
+
w: number;
|
|
21
|
+
h: number;
|
|
22
|
+
}
|
|
23
|
+
export interface CanvasKitImageInsertInput {
|
|
24
|
+
source: CanvasKitImageInsertSource;
|
|
25
|
+
pagePoint?: Vec;
|
|
26
|
+
size?: CanvasKitImageInsertSize;
|
|
27
|
+
strategy?: CanvasKitImageInsertStrategy;
|
|
28
|
+
}
|
|
29
|
+
export interface CanvasKitImageReplaceInput {
|
|
30
|
+
file: File;
|
|
31
|
+
}
|
|
32
|
+
export interface CanvasKitImageSmudgeConfirmPayload {
|
|
33
|
+
shapeId: ShapeId;
|
|
34
|
+
sourceAssetId: AssetId | null;
|
|
35
|
+
imageBlob: Blob;
|
|
36
|
+
maskBlob?: Blob;
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
crop: ImageShapeCrop | null;
|
|
40
|
+
strokes: ImageSmudgeStroke[];
|
|
41
|
+
}
|
|
42
|
+
export interface CanvasKitImageSmudgeController {
|
|
43
|
+
start(input?: {
|
|
44
|
+
shapeId?: ShapeId;
|
|
45
|
+
brush?: Partial<ImageSmudgeBrush>;
|
|
46
|
+
}): boolean;
|
|
47
|
+
setBrush(brush: Partial<ImageSmudgeBrush>): boolean;
|
|
48
|
+
cancel(): void;
|
|
49
|
+
confirm(input?: {
|
|
50
|
+
replace?: boolean;
|
|
51
|
+
}): Promise<CanvasKitImageSmudgeConfirmPayload | null>;
|
|
52
|
+
isActive(): boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface CanvasKitImageHostApi {
|
|
55
|
+
insert(input: CanvasKitImageInsertInput): Promise<ShapeId | null>;
|
|
56
|
+
replaceSelection(input: CanvasKitImageReplaceInput): Promise<boolean>;
|
|
57
|
+
downloadSelectionOriginal(): Promise<void>;
|
|
58
|
+
smudge: CanvasKitImageSmudgeController;
|
|
59
|
+
}
|
|
60
|
+
export declare const canvasKitImageHostApiToken: import("../../../../_vendor/canvas-product-contracts/index").ProductApiToken<CanvasKitImageHostApi>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ProductServiceFactory } from "../../../../_vendor/canvas-product-contracts/index";
|
|
2
|
+
import type { ProductAssetResolverService } from "../../../../runtime/productAssetResolvers";
|
|
2
3
|
import { type ImageObjectUrlStore } from "./imageBlobStore";
|
|
3
4
|
export interface ImageAssetService extends ProductAssetResolverService {
|
|
4
5
|
objectUrls: ImageObjectUrlStore;
|
|
@@ -6,5 +7,5 @@ export interface ImageAssetService extends ProductAssetResolverService {
|
|
|
6
7
|
export interface ImageAssetServiceOptions {
|
|
7
8
|
flushSnapshot?: () => Promise<void>;
|
|
8
9
|
}
|
|
9
|
-
export declare const imageAssetServiceToken: import("
|
|
10
|
+
export declare const imageAssetServiceToken: import("../../../../_vendor/canvas-product-contracts/index").ProductServiceToken<ImageAssetService>;
|
|
10
11
|
export declare function localImageAssetService({ flushSnapshot, }?: ImageAssetServiceOptions): ProductServiceFactory<ImageAssetService>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AssetId, Editor } from "
|
|
2
|
-
export { readBlobAsDataUrl } from "
|
|
1
|
+
import type { AssetId, Editor } from "../../../../_vendor/canvas-core/index";
|
|
2
|
+
export { readBlobAsDataUrl } from "../../../../_vendor/plugin-runtime-export/index";
|
|
3
3
|
export interface ImageBlobWriteResult {
|
|
4
4
|
storageKey: string;
|
|
5
5
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type SvgAssetInliner } from "
|
|
1
|
+
import { type SvgAssetInliner } from "../../../../_vendor/plugin-runtime-export/index";
|
|
2
2
|
import type { ImageAssetService } from "./imageAssetService";
|
|
3
3
|
export declare function createImageSvgAssetInliner(imageAssetService: ImageAssetService): SvgAssetInliner;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Editor } from "
|
|
2
|
-
import { type CanvasImportRegistry } from "
|
|
1
|
+
import type { Editor } from "../../../../_vendor/canvas-core/index";
|
|
2
|
+
import { type CanvasImportRegistry } from "../../../../_vendor/canvas-product-contracts/index";
|
|
3
3
|
import type { ImageAssetService } from "../asset/imageAssetService";
|
|
4
4
|
import type { ImageToolbarHostBridge } from "../toolbar/imageToolbarHostBridge";
|
|
5
5
|
export declare const ImageImportController: import("react").NamedExoticComponent<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ImageImportController } from "./import/ImageImportController";
|
|
2
|
-
export {
|
|
3
|
-
export type {
|
|
4
|
-
export type {
|
|
2
|
+
export { canvasKitImageHostApiToken, createCanvasKitImageHostApi, } from "./api/imageHostApi";
|
|
3
|
+
export type { CanvasKitImageHostApiRuntimeOptions, } from "./api/imageHostApi";
|
|
4
|
+
export type { CanvasKitImageHostApi, CanvasKitImageInsertInput, CanvasKitImageInsertSize, CanvasKitImageInsertSource, CanvasKitImageInsertStrategy, CanvasKitImageReplaceInput, CanvasKitImageSmudgeConfirmPayload, CanvasKitImageSmudgeController, } from "./api/imageHostApiContract";
|
|
5
5
|
export { imageAssetServiceToken, localImageAssetService, } from "./asset/imageAssetService";
|
|
6
6
|
export type { ImageAssetService } from "./asset/imageAssetService";
|
|
7
7
|
export { createImageToolbarHostBridge, ImageToolbarHostBridge, imageToolbarHostBridgeService, imageToolbarHostBridgeToken, } from "./toolbar/imageToolbarHostBridge";
|
|
@@ -9,7 +9,7 @@ export type { ImageToolbarHostBridgeHandlers } from "./toolbar/imageToolbarHostB
|
|
|
9
9
|
export { cleanupUnreferencedImageBlobs, createImageObjectUrlStore, createImageStorageKey, deleteImageBlob, getAllImageBlobStorageKeys, getLocalImageAssetStorageKey, getRemoteImageAssetUrl, getReferencedImageStorageKeys, readImageBlob, readImageBlobAsDataUrl, writeImageBlob, } from "./asset/imageBlobStore";
|
|
10
10
|
export type { ImageBlobWriteResult, ImageObjectUrlStore, } from "./asset/imageBlobStore";
|
|
11
11
|
export { downloadSelectedImageOriginal, createImageToolbarActions, getFirstImageFile, insertImageIntoEditor, replaceSelectedImageFromFile, } from "./toolbar/imageHostActions";
|
|
12
|
-
export type {
|
|
12
|
+
export type { InsertImageInput, ReplaceSelectedImageFileInput, } from "./toolbar/imageHostActions";
|
|
13
13
|
export { confirmImageSmudgeSession } from "./smudge/imageSmudgeHostActions";
|
|
14
14
|
export type { ConfirmImageSmudgeSessionInput } from "./smudge/imageSmudgeHostActions";
|
|
15
15
|
export { createImageSvgAssetInliner } from "./asset/svgImageAssetInliner";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ImageHostPlugin: import("../../..").CanvasPlugin;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Editor } from "
|
|
1
|
+
import type { Editor } from "../../../../_vendor/canvas-core/index";
|
|
2
|
+
import type { CanvasKitImageSmudgeConfirmPayload } from "../api/imageHostApiContract";
|
|
2
3
|
import { type ImageObjectUrlStore } from "../asset/imageBlobStore";
|
|
3
|
-
import type { ImageSmudgeConfirmPayload } from "./imageSmudgeTypes";
|
|
4
4
|
export interface ConfirmImageSmudgeSessionInput {
|
|
5
5
|
editor: Editor;
|
|
6
6
|
imageObjectUrls: ImageObjectUrlStore;
|
|
7
7
|
flushSnapshot?: () => Promise<void>;
|
|
8
8
|
replace?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export declare function confirmImageSmudgeSession({ editor, imageObjectUrls, flushSnapshot, replace, }: ConfirmImageSmudgeSessionInput): Promise<
|
|
10
|
+
export declare function confirmImageSmudgeSession({ editor, imageObjectUrls, flushSnapshot, replace, }: ConfirmImageSmudgeSessionInput): Promise<CanvasKitImageSmudgeConfirmPayload | null>;
|
|
@@ -1,34 +1,18 @@
|
|
|
1
|
-
import { type CanvasAction } from "
|
|
2
|
-
import { type AssetId, type Editor, type ShapeId, Vec } from "
|
|
3
|
-
import { type ImageAssetRecord, type ImageShapeRecord } from "
|
|
1
|
+
import { type CanvasAction } from "../../../../_vendor/canvas-product-contracts/index";
|
|
2
|
+
import { type AssetId, type Editor, type ShapeId, Vec } from "../../../../_vendor/canvas-core/index";
|
|
3
|
+
import { type ImageAssetRecord, type ImageShapeRecord } from "../../../../_vendor/plugin-image/index";
|
|
4
|
+
import type { CanvasKitImageInsertSize, CanvasKitImageInsertSource, CanvasKitImageInsertStrategy } from "../api/imageHostApiContract";
|
|
4
5
|
import { type ImageObjectUrlStore } from "../asset/imageBlobStore";
|
|
5
6
|
import type { ImageToolbarHostBridge } from "./imageToolbarHostBridge";
|
|
6
|
-
import { type LocalImageBlobInput } from "../asset/imageFileHelpers";
|
|
7
7
|
export { getFirstImageFile } from "../asset/imageFileHelpers";
|
|
8
|
-
export type ImageInsertStrategy = "auto" | "copy" | "link";
|
|
9
|
-
export type ImageInsertSource = {
|
|
10
|
-
type: "file";
|
|
11
|
-
file: File;
|
|
12
|
-
} | ({
|
|
13
|
-
type: "blob";
|
|
14
|
-
} & LocalImageBlobInput) | {
|
|
15
|
-
type: "url";
|
|
16
|
-
url: string;
|
|
17
|
-
name?: string;
|
|
18
|
-
altText?: string;
|
|
19
|
-
};
|
|
20
|
-
export interface ImageInsertSize {
|
|
21
|
-
w: number;
|
|
22
|
-
h: number;
|
|
23
|
-
}
|
|
24
8
|
export interface InsertImageInput {
|
|
25
9
|
editor: Editor;
|
|
26
10
|
imageObjectUrls: ImageObjectUrlStore;
|
|
27
|
-
source:
|
|
11
|
+
source: CanvasKitImageInsertSource;
|
|
28
12
|
pagePoint?: Vec;
|
|
29
|
-
size?:
|
|
13
|
+
size?: CanvasKitImageInsertSize;
|
|
30
14
|
flushSnapshot?: () => Promise<void>;
|
|
31
|
-
strategy?:
|
|
15
|
+
strategy?: CanvasKitImageInsertStrategy;
|
|
32
16
|
}
|
|
33
17
|
export interface ReplaceSelectedImageFileInput {
|
|
34
18
|
editor: Editor;
|
|
@@ -46,7 +30,7 @@ export declare function localizeRemoteImageAsset({ assetId, editor, flushSnapsho
|
|
|
46
30
|
editor: Editor;
|
|
47
31
|
flushSnapshot?: () => Promise<void>;
|
|
48
32
|
imageObjectUrls: ImageObjectUrlStore;
|
|
49
|
-
source: Extract<
|
|
33
|
+
source: Extract<CanvasKitImageInsertSource, {
|
|
50
34
|
type: "url";
|
|
51
35
|
}>;
|
|
52
36
|
}): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ProductServiceFactory } from "
|
|
1
|
+
import { type ProductServiceFactory } from "../../../../_vendor/canvas-product-contracts/index";
|
|
2
2
|
export interface ImageToolbarHostBridgeHandlers {
|
|
3
3
|
openInsertFilePicker(): void;
|
|
4
4
|
openReplaceFilePicker(): void;
|
|
@@ -10,5 +10,5 @@ export declare class ImageToolbarHostBridge {
|
|
|
10
10
|
openReplaceFilePicker(): void;
|
|
11
11
|
}
|
|
12
12
|
export declare function createImageToolbarHostBridge(): ImageToolbarHostBridge;
|
|
13
|
-
export declare const imageToolbarHostBridgeToken: import("
|
|
13
|
+
export declare const imageToolbarHostBridgeToken: import("../../../../_vendor/canvas-product-contracts/index").ProductServiceToken<ImageToolbarHostBridge>;
|
|
14
14
|
export declare function imageToolbarHostBridgeService(): ProductServiceFactory<ImageToolbarHostBridge>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { TextLinkPopoverPresenter } from "
|
|
2
|
+
import type { TextLinkPopoverPresenter } from "../../../../_vendor/plugin-text/index";
|
|
3
3
|
export interface TextLinkHoverPopoverIcons {
|
|
4
4
|
open: ReactNode;
|
|
5
5
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type TextLinkPopoverPresenter } from "../../../_vendor/plugin-text/index";
|
|
2
|
+
import { type CanvasPlugin } from "../../../runtime/canvasKitPluginContracts";
|
|
3
|
+
export declare function createTextHostPlugin({ presenter, }: {
|
|
4
|
+
presenter: TextLinkPopoverPresenter;
|
|
5
|
+
}): CanvasPlugin;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Editor } from "../../../_vendor/canvas-core/index";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare function useCanvasKeyboardShortcuts({ actionRegistry, editor, executeCommand, }: {
|
|
5
|
-
actionRegistry: CanvasActionRegistry;
|
|
2
|
+
import type { ExecuteCanvasKitAction } from "../../../runtime/canvasKitActionExecutor";
|
|
3
|
+
export declare function useCanvasKeyboardShortcuts({ editor, executeAction, }: {
|
|
6
4
|
editor: Editor;
|
|
7
|
-
|
|
5
|
+
executeAction: ExecuteCanvasKitAction;
|
|
8
6
|
}): void;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { type CanvasAction, type CanvasActionContext } from "../../../_vendor/canvas-product-contracts/index";
|
|
2
2
|
import type { KeyboardShortcutInput } from "../../../_vendor/canvas-core/index";
|
|
3
|
-
export declare const SYSTEM_SELECTION_DELETE_ACTION_ID
|
|
4
|
-
export declare const SYSTEM_SELECTION_DUPLICATE_ACTION_ID
|
|
5
|
-
export declare const SYSTEM_SELECTION_SELECT_ALL_ACTION_ID
|
|
6
|
-
export declare const SYSTEM_SELECTION_RESET_ROTATION_ACTION_ID
|
|
7
|
-
export declare const SYSTEM_SELECTION_FLIP_HORIZONTAL_ACTION_ID
|
|
8
|
-
export declare const SYSTEM_SELECTION_FLIP_VERTICAL_ACTION_ID
|
|
9
|
-
export declare const SYSTEM_SELECTION_SEND_TO_BACK_ACTION_ID
|
|
10
|
-
export declare const SYSTEM_SELECTION_SEND_BACKWARD_ACTION_ID
|
|
11
|
-
export declare const SYSTEM_SELECTION_BRING_FORWARD_ACTION_ID
|
|
12
|
-
export declare const SYSTEM_SELECTION_BRING_TO_FRONT_ACTION_ID
|
|
13
|
-
export declare const SYSTEM_SELECTION_SET_OPACITY_ACTION_ID
|
|
14
|
-
export declare const SYSTEM_SELECTION_ALIGN_ACTION_ID
|
|
15
|
-
export declare const SYSTEM_SELECTION_DISTRIBUTE_ACTION_ID
|
|
3
|
+
export declare const SYSTEM_SELECTION_DELETE_ACTION_ID: "system.selection.delete";
|
|
4
|
+
export declare const SYSTEM_SELECTION_DUPLICATE_ACTION_ID: "system.selection.duplicate";
|
|
5
|
+
export declare const SYSTEM_SELECTION_SELECT_ALL_ACTION_ID: "system.selection.select-all";
|
|
6
|
+
export declare const SYSTEM_SELECTION_RESET_ROTATION_ACTION_ID: "system.selection.reset-rotation";
|
|
7
|
+
export declare const SYSTEM_SELECTION_FLIP_HORIZONTAL_ACTION_ID: "system.selection.flip-horizontal";
|
|
8
|
+
export declare const SYSTEM_SELECTION_FLIP_VERTICAL_ACTION_ID: "system.selection.flip-vertical";
|
|
9
|
+
export declare const SYSTEM_SELECTION_SEND_TO_BACK_ACTION_ID: "layer.send-to-back";
|
|
10
|
+
export declare const SYSTEM_SELECTION_SEND_BACKWARD_ACTION_ID: "layer.send-backward";
|
|
11
|
+
export declare const SYSTEM_SELECTION_BRING_FORWARD_ACTION_ID: "layer.bring-forward";
|
|
12
|
+
export declare const SYSTEM_SELECTION_BRING_TO_FRONT_ACTION_ID: "layer.bring-to-front";
|
|
13
|
+
export declare const SYSTEM_SELECTION_SET_OPACITY_ACTION_ID: "system.selection.set-opacity";
|
|
14
|
+
export declare const SYSTEM_SELECTION_ALIGN_ACTION_ID: "system.selection.align";
|
|
15
|
+
export declare const SYSTEM_SELECTION_DISTRIBUTE_ACTION_ID: "system.selection.distribute";
|
|
16
16
|
export declare const selectionActionShortcuts: readonly {
|
|
17
17
|
actionId: string;
|
|
18
18
|
shortcut: KeyboardShortcutInput;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ContextMenuContribution } from "../../../_vendor/canvas-product-contracts/index";
|
|
2
2
|
export declare const toolContextMenuContributions: readonly ContextMenuContribution[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const SYSTEM_VIEW_ZOOM_IN_ACTION_ID
|
|
3
|
-
export declare const SYSTEM_VIEW_ZOOM_OUT_ACTION_ID
|
|
4
|
-
export declare const SYSTEM_VIEW_RESET_ZOOM_ACTION_ID
|
|
1
|
+
import type { CanvasAction } from "../../../_vendor/canvas-product-contracts/index";
|
|
2
|
+
export declare const SYSTEM_VIEW_ZOOM_IN_ACTION_ID: "system.view.zoom-in";
|
|
3
|
+
export declare const SYSTEM_VIEW_ZOOM_OUT_ACTION_ID: "system.view.zoom-out";
|
|
4
|
+
export declare const SYSTEM_VIEW_RESET_ZOOM_ACTION_ID: "system.view.reset-zoom";
|
|
5
5
|
export declare const viewActions: readonly CanvasAction[];
|
package/react/CanvasKitRoot.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CanvasKitToolId } from "../canvasKitTools";
|
|
2
|
+
import type { CanvasProductController } from "../controller";
|
|
2
3
|
import type { CanvasKitRuntime } from "../runtime/canvasKitRuntimeContracts";
|
|
3
4
|
export interface CanvasKitRootProps {
|
|
4
5
|
runtime: CanvasKitRuntime;
|
|
5
|
-
onControllerReady?: (controller:
|
|
6
|
+
onControllerReady?: (controller: CanvasProductController<CanvasKitToolId>) => void;
|
|
6
7
|
onControllerDispose?: () => void;
|
|
7
8
|
exposeControllerOnWindow?: boolean;
|
|
8
9
|
windowKey?: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CanvasKitToolId } from "../canvasKitTools";
|
|
2
|
+
import type { CanvasProductController } from "../controller";
|
|
3
|
+
export declare function useCanvasProductControllerLifecycle({ controller, exposeControllerOnWindow, onControllerDispose, onControllerReady, windowKey, }: {
|
|
4
|
+
controller: CanvasProductController<CanvasKitToolId>;
|
|
5
|
+
exposeControllerOnWindow: boolean;
|
|
6
|
+
onControllerDispose?: () => void;
|
|
7
|
+
onControllerReady?: (controller: CanvasProductController<CanvasKitToolId>) => void;
|
|
8
|
+
windowKey: string;
|
|
9
|
+
}): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type CanvasActionContext, type CanvasActionRegistry, type CanvasActionValue } from "../_vendor/canvas-product-contracts/index";
|
|
2
|
+
import type { CanvasKitCommandExecutor } from "./canvasKitCommandExecutor";
|
|
3
|
+
export interface CanvasKitActionExecutionInput {
|
|
4
|
+
actionId: string;
|
|
5
|
+
context: CanvasActionContext;
|
|
6
|
+
value?: CanvasActionValue;
|
|
7
|
+
}
|
|
8
|
+
export type ExecuteCanvasKitAction = (input: CanvasKitActionExecutionInput) => boolean;
|
|
9
|
+
export declare function createCanvasKitActionExecutor({ actionRegistry, commandExecutor, }: {
|
|
10
|
+
actionRegistry: CanvasActionRegistry;
|
|
11
|
+
commandExecutor: CanvasKitCommandExecutor;
|
|
12
|
+
}): ExecuteCanvasKitAction;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CanvasActionContext } from "../_vendor/canvas-product-contracts/index";
|
|
2
2
|
import type { Editor } from "../_vendor/canvas-core/index";
|
|
3
|
+
import type { CanvasKitCommand, ExecuteCanvasKitDefinedCommand } from "../commands";
|
|
3
4
|
import type { CanvasPluginBeforeCommand } from "./canvasKitPluginContracts";
|
|
4
5
|
export interface CanvasKitCommandInput<TResult> {
|
|
5
6
|
commandId: string;
|
|
@@ -7,7 +8,15 @@ export interface CanvasKitCommandInput<TResult> {
|
|
|
7
8
|
run(): TResult;
|
|
8
9
|
}
|
|
9
10
|
export type ExecuteCanvasKitCommand = <TResult>(input: CanvasKitCommandInput<TResult>) => TResult;
|
|
10
|
-
export
|
|
11
|
+
export interface CanvasKitCommandExecutor {
|
|
12
|
+
execute: ExecuteCanvasKitDefinedCommand;
|
|
13
|
+
executeBootstrap: ExecuteCanvasKitDefinedCommand;
|
|
14
|
+
executeFromAction: <TArgs extends readonly unknown[], TResult>(command: CanvasKitCommand<TArgs, TResult>, context: CanvasActionContext, ...args: TArgs) => TResult;
|
|
15
|
+
executeAction: ExecuteCanvasKitCommand;
|
|
16
|
+
}
|
|
17
|
+
export declare function createCanvasKitCommandExecutor({ assertCanBootstrap, assertCanExecute, editor, hooks, }: {
|
|
18
|
+
assertCanBootstrap?: () => void;
|
|
19
|
+
assertCanExecute?: () => void;
|
|
11
20
|
editor: Editor;
|
|
12
21
|
hooks: readonly CanvasPluginBeforeCommand[];
|
|
13
|
-
}):
|
|
22
|
+
}): CanvasKitCommandExecutor;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { type CanvasPlugin as SdkCanvasPlugin, type CanvasPluginDefinition as SdkCanvasPluginDefinition, type CanvasPluginSetup
|
|
2
|
-
import { type CanvasPluginApi as SdkCanvasPluginApi, type CanvasPluginApiContext, type CanvasPluginApiSetup } from "../_vendor/canvas-product-contracts/index";
|
|
3
|
-
import type { ProductAssetResolverService
|
|
1
|
+
import { type CanvasPlugin as SdkCanvasPlugin, type CanvasPluginDefinition as SdkCanvasPluginDefinition, type CanvasPluginSetup, type CanvasPluginSetupExtension } from "../_vendor/canvas-plugin-sdk/index";
|
|
2
|
+
import { type CanvasPluginApi as SdkCanvasPluginApi, type CanvasPluginApiContext, type CanvasPluginApiSetup, type ProductServiceRegistry, type ProductServiceToken } from "../_vendor/canvas-product-contracts/index";
|
|
3
|
+
import type { ProductAssetResolverService } from "./productAssetResolvers";
|
|
4
4
|
import type { SvgAssetInliner } from "../_vendor/plugin-runtime-export/index";
|
|
5
|
+
export type { CanvasPluginSetup, CanvasPluginSetupContext, } from "../_vendor/canvas-plugin-sdk/index";
|
|
5
6
|
export type { CanvasPluginBeforeCommand, CanvasPluginBeforeCommandContext, CanvasPluginBeforeReady, CanvasPluginBeforeReadyContext, CanvasPluginLifecycleSetup, CanvasPluginPersistence, } from "./canvasKitPluginLifecycle";
|
|
6
7
|
export { canvasKitLifecycleExtension, canvasKitPersistenceExtension, } from "./canvasKitPluginLifecycle";
|
|
7
8
|
export type { CanvasPluginComponent, CanvasPluginComponentProps, CanvasPluginProvider, CanvasPluginUiSetup, } from "./canvasKitPluginUi";
|
|
@@ -17,16 +18,11 @@ export interface CanvasKitPluginAssetSetup {
|
|
|
17
18
|
addSvgInliners(...inliners: readonly SvgAssetInliner[]): void;
|
|
18
19
|
}
|
|
19
20
|
export declare const canvasKitAssetsExtension: CanvasPluginSetupExtension<CanvasKitPluginAssetSetup>;
|
|
20
|
-
export type
|
|
21
|
-
export type CanvasKitPluginUiSetup = import("./canvasKitPluginUi").CanvasPluginUiSetup;
|
|
22
|
-
export type CanvasKitPluginPersistence = import("./canvasKitPluginLifecycle").CanvasPluginPersistence;
|
|
23
|
-
export type CanvasKitPluginSetupContext = SdkCanvasPluginSetupContext;
|
|
24
|
-
export type CanvasKitPluginSetup = SdkCanvasPluginSetup<CanvasKitPluginSetupContext>;
|
|
25
|
-
export type CanvasPlugin = Omit<SdkCanvasPlugin<CanvasKitPluginSetup>, "editor" | "render" | "setup"> & {
|
|
21
|
+
export type CanvasPlugin = Omit<SdkCanvasPlugin<CanvasPluginSetup>, "editor" | "render" | "setup"> & {
|
|
26
22
|
readonly editor?: unknown;
|
|
27
23
|
readonly render?: unknown;
|
|
28
24
|
readonly setup?: (...args: never[]) => unknown;
|
|
29
25
|
};
|
|
30
|
-
export type CanvasPluginDefinition = SdkCanvasPluginDefinition<
|
|
26
|
+
export type CanvasPluginDefinition = SdkCanvasPluginDefinition<CanvasPluginSetup>;
|
|
31
27
|
export type CanvasPluginInput = CanvasPlugin | readonly CanvasPluginInput[];
|
|
32
28
|
export declare function defineCanvasPlugin(plugin: CanvasPluginDefinition): CanvasPlugin;
|
|
@@ -3,7 +3,7 @@ import { type CanvasActionContext, type ProductServiceRegistry } from "../_vendo
|
|
|
3
3
|
export interface CanvasPluginPersistence {
|
|
4
4
|
flush(): Promise<void>;
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface CanvasKitStartupResult {
|
|
7
7
|
documentSource: "restored" | "seeded" | "empty";
|
|
8
8
|
sessionRestored: boolean;
|
|
9
9
|
warnings: readonly unknown[];
|
|
@@ -13,7 +13,7 @@ export interface CanvasPluginBeforeReadyContext {
|
|
|
13
13
|
persistence: CanvasPluginPersistence | null;
|
|
14
14
|
productId: string;
|
|
15
15
|
signal: AbortSignal;
|
|
16
|
-
startup:
|
|
16
|
+
startup: CanvasKitStartupResult;
|
|
17
17
|
services: ProductServiceRegistry;
|
|
18
18
|
}
|
|
19
19
|
export interface CanvasPluginBeforeCommandContext {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type CanvasPlugin as SdkCanvasPlugin } from "../_vendor/canvas-plugin-sdk/index";
|
|
2
|
-
import { type CanvasActionContext, type CanvasChromeRegistry, type CanvasContextMenuRegistry, type CanvasImportRegistry, type CanvasToolbarRegistry, type ProductApiRegistry } from "../_vendor/canvas-product-contracts/index";
|
|
2
|
+
import { type CanvasActionContext, type CanvasChromeRegistry, type CanvasContextMenuRegistry, type CanvasImportRegistry, type CanvasToolbarRegistry, type ProductApiRegistry, type ProductServiceToken } from "../_vendor/canvas-product-contracts/index";
|
|
3
3
|
import type { Editor } from "../_vendor/canvas-core/index";
|
|
4
|
-
import type { ProductAssetResolverService
|
|
4
|
+
import type { ProductAssetResolverService } from "./productAssetResolvers";
|
|
5
|
+
import type { ProductServiceRegistryRuntime } from "./productServiceRegistry";
|
|
5
6
|
import type { SvgAssetInliner } from "../_vendor/plugin-runtime-export/index";
|
|
6
|
-
import type {
|
|
7
|
+
import type { CanvasPluginBeforeCommand, CanvasPluginBeforeReady, CanvasPluginComponent, CanvasPluginPersistence, CanvasPluginProvider, CanvasPluginSetup } from "./canvasKitPluginContracts";
|
|
7
8
|
import { createCanvasActionRegistry } from "./registries";
|
|
8
9
|
export interface CanvasKitPluginSetupResult {
|
|
9
10
|
readonly actionRegistry: ReturnType<typeof createCanvasActionRegistry>;
|
|
@@ -20,14 +21,14 @@ export interface CanvasKitPluginSetupResult {
|
|
|
20
21
|
canShowPropertiesDuringEditing(context: CanvasActionContext): boolean;
|
|
21
22
|
}
|
|
22
23
|
export interface CanvasKitPluginSetupSession {
|
|
23
|
-
install(plugin: SdkCanvasPlugin<
|
|
24
|
+
install(plugin: SdkCanvasPlugin<CanvasPluginSetup>): void;
|
|
24
25
|
seal(): CanvasKitPluginSetupResult;
|
|
25
26
|
}
|
|
26
27
|
export declare function createCanvasKitPluginSetupSession({ assetResolverTokens, defer, editor, persistence, productId, services, svgAssetInliners, }: {
|
|
27
28
|
assetResolverTokens: ProductServiceToken<ProductAssetResolverService>[];
|
|
28
29
|
defer(dispose: () => void): void;
|
|
29
30
|
editor: Editor;
|
|
30
|
-
persistence:
|
|
31
|
+
persistence: CanvasPluginPersistence | null;
|
|
31
32
|
productId: string;
|
|
32
33
|
services: ProductServiceRegistryRuntime;
|
|
33
34
|
svgAssetInliners: SvgAssetInliner[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
2
|
import { type CanvasActionContext, type CanvasActionRegistry, type CanvasImportRegistry, type ProductServiceRegistry } from "../_vendor/canvas-product-contracts/index";
|
|
3
3
|
import type { ComponentType, ReactNode } from "react";
|
|
4
|
+
import type { ExecuteCanvasKitAction } from "./canvasKitActionExecutor";
|
|
4
5
|
export interface CanvasCommandInput<TResult> {
|
|
5
6
|
commandId: string;
|
|
6
7
|
context?: CanvasActionContext;
|
|
@@ -10,6 +11,7 @@ export type ExecuteCanvasCommand = <TResult>(input: CanvasCommandInput<TResult>)
|
|
|
10
11
|
export interface CanvasPluginComponentProps {
|
|
11
12
|
actionRegistry: CanvasActionRegistry;
|
|
12
13
|
editor: Editor;
|
|
14
|
+
executeAction: ExecuteCanvasKitAction;
|
|
13
15
|
executeCommand: ExecuteCanvasCommand;
|
|
14
16
|
getHostElement(): HTMLElement | null;
|
|
15
17
|
imports: CanvasImportRegistry;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
|
-
import { type CanvasActionContext, type CanvasActionRegistry, type CanvasChromeRegistry, type CanvasContextMenuRegistry, type CanvasImportRegistry, type CanvasToolbarRegistry } from "../_vendor/canvas-product-contracts/index";
|
|
2
|
+
import { type CanvasActionContext, type CanvasActionRegistry, type CanvasChromeRegistry, type CanvasContextMenuRegistry, type CanvasImportRegistry, type CanvasToolbarRegistry, type ProductServiceToken } from "../_vendor/canvas-product-contracts/index";
|
|
3
3
|
import { type CanvasRenderRuntime } from "../_vendor/canvas-react/host/index";
|
|
4
|
-
import { type
|
|
5
|
-
import { type
|
|
4
|
+
import { type CanvasProductController } from "../controller";
|
|
5
|
+
import { type ProductAssetResolverService } from "./productAssetResolvers";
|
|
6
|
+
import type { ProductPersistenceAdapter } from "./persistenceContracts";
|
|
7
|
+
import { type ProductServiceRegistryRuntime } from "./productServiceRegistry";
|
|
8
|
+
import { type CanvasKitToolId } from "../canvasKitTools";
|
|
6
9
|
import { createCanvasKitCommandExecutor } from "./canvasKitCommandExecutor";
|
|
10
|
+
import { createCanvasKitActionExecutor } from "./canvasKitActionExecutor";
|
|
7
11
|
import type { CanvasPluginBeforeReady, CanvasPluginComponent, CanvasPluginProvider } from "./canvasKitPluginContracts";
|
|
8
12
|
import { PersistenceCoordinator } from "./persistenceCoordinator";
|
|
9
13
|
import { type CanvasKitResourceScope } from "./canvasKitResourceScope";
|
|
@@ -16,7 +20,10 @@ export interface CanvasKitRuntimeInternals {
|
|
|
16
20
|
readonly beforeReadyHooks: readonly CanvasPluginBeforeReady[];
|
|
17
21
|
readonly cleanDocumentSnapshot: unknown;
|
|
18
22
|
readonly cleanSessionSnapshot: unknown;
|
|
19
|
-
readonly
|
|
23
|
+
readonly commandBootstrap: {
|
|
24
|
+
active: boolean;
|
|
25
|
+
};
|
|
26
|
+
readonly controller: CanvasProductController<CanvasKitToolId>;
|
|
20
27
|
readonly editor: Editor;
|
|
21
28
|
mountedOwner: object | null;
|
|
22
29
|
readonly persistence: ProductPersistenceAdapter | null;
|
|
@@ -30,13 +37,15 @@ export interface CanvasKitRuntimeInternals {
|
|
|
30
37
|
readonly toolbarRegistry: CanvasToolbarRegistry;
|
|
31
38
|
readonly contextMenuRegistry: CanvasContextMenuRegistry;
|
|
32
39
|
readonly importRegistry: CanvasImportRegistry;
|
|
33
|
-
readonly
|
|
40
|
+
readonly executeAction: ReturnType<typeof createCanvasKitActionExecutor>;
|
|
41
|
+
readonly executeCommand: ReturnType<typeof createCanvasKitCommandExecutor>["executeAction"];
|
|
34
42
|
readonly providers: readonly CanvasPluginProvider[];
|
|
35
43
|
readonly components: readonly CanvasPluginComponent[];
|
|
36
44
|
readonly chrome?: CanvasKitChromeRenderer;
|
|
37
45
|
canShowPropertiesDuringEditing(context: CanvasActionContext): boolean;
|
|
38
46
|
};
|
|
39
47
|
readonly seedDocument?: CanvasKitDocumentSeed;
|
|
48
|
+
readonly seedController: CanvasProductController<CanvasKitToolId>;
|
|
40
49
|
readonly services: ProductServiceRegistryRuntime;
|
|
41
50
|
readonly shouldSkipStoredSnapshots?: () => boolean;
|
|
42
51
|
startPromise: Promise<CanvasKitStartupResult> | null;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { CanvasProductController } from "../controller";
|
|
3
|
+
import type { ProductPersistenceAdapter } from "./persistenceContracts";
|
|
3
4
|
import type { CanvasKitChromeContext } from "../chrome/types";
|
|
4
|
-
import type {
|
|
5
|
+
import type { CanvasKitToolId } from "../canvasKitTools";
|
|
5
6
|
import type { CanvasPluginInput } from "./canvasKitPluginContracts";
|
|
6
|
-
import type {
|
|
7
|
-
export type
|
|
8
|
-
export type
|
|
7
|
+
import type { CanvasKitStartupResult } from "./canvasKitPluginLifecycle";
|
|
8
|
+
export type { CanvasKitStartupResult } from "./canvasKitPluginLifecycle";
|
|
9
|
+
export type CanvasKitChromeRenderer = (context: CanvasKitChromeContext<CanvasKitToolId>) => ReactNode;
|
|
10
|
+
export type CanvasKitDocumentSeed = (controller: CanvasProductController<CanvasKitToolId>) => void;
|
|
9
11
|
export interface CanvasKitRuntimeOptions {
|
|
10
12
|
id?: string;
|
|
11
13
|
chrome?: CanvasKitChromeRenderer;
|
|
@@ -16,9 +18,8 @@ export interface CanvasKitRuntimeOptions {
|
|
|
16
18
|
plugins?: readonly CanvasPluginInput[];
|
|
17
19
|
storageNamespace?: string;
|
|
18
20
|
}
|
|
19
|
-
export type CanvasKitStartupResult = CanvasPluginStartupResult;
|
|
20
21
|
export interface CanvasKitRuntime {
|
|
21
|
-
readonly controller:
|
|
22
|
+
readonly controller: CanvasProductController<CanvasKitToolId>;
|
|
22
23
|
start(): Promise<CanvasKitStartupResult>;
|
|
23
24
|
dispose(): void;
|
|
24
25
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CanvasAction, CanvasActionRunInput, CanvasActionValue } from "../_vendor/canvas-product-contracts/index";
|
|
2
|
+
import type { CanvasKitCommand } from "../commands";
|
|
3
|
+
import type { CanvasKitCommandExecutor } from "./canvasKitCommandExecutor";
|
|
4
|
+
type CanvasActionBehavior<TValue extends CanvasActionValue> = Omit<CanvasAction<TValue>, "id" | "run">;
|
|
5
|
+
export declare function createVoidCanvasKitCommandAction<TValue extends CanvasActionValue = CanvasActionValue>(command: CanvasKitCommand<[], unknown>, behavior?: CanvasActionBehavior<TValue>): CanvasAction<TValue>;
|
|
6
|
+
export declare function createCanvasKitCommandAction<TArgs extends readonly unknown[], TValue extends CanvasActionValue = CanvasActionValue>(command: CanvasKitCommand<TArgs, unknown>, behavior: CanvasActionBehavior<TValue> & {
|
|
7
|
+
toCommandArgs(input: CanvasActionRunInput<TValue>): TArgs | null;
|
|
8
|
+
}): CanvasAction<TValue>;
|
|
9
|
+
export declare function executeCanvasKitCommandAction(executor: CanvasKitCommandExecutor, action: CanvasAction, input: CanvasActionRunInput<CanvasActionValue>): boolean | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type AssetId, type Editor, type EditorPlugin } from "../_vendor/canvas-core/index";
|
|
2
|
+
export interface CreateCanvasKitEditorOptions {
|
|
3
|
+
editorPlugins: readonly EditorPlugin[];
|
|
4
|
+
documentMeta?: Record<string, unknown>;
|
|
5
|
+
resolveAssetUrl?: (assetId: AssetId) => string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function createCanvasKitEditor(options: CreateCanvasKitEditorOptions): Editor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DocumentSnapshot, SessionSnapshot } from "../_vendor/canvas-core/index";
|
|
2
2
|
export interface ProductPersistenceLoadResult {
|
|
3
3
|
documentSnapshot: unknown | null;
|
|
4
4
|
sessionSnapshot: unknown | null;
|
|
@@ -10,8 +10,3 @@ export interface ProductPersistenceAdapter {
|
|
|
10
10
|
saveDocument?(snapshot: DocumentSnapshot): Promise<void>;
|
|
11
11
|
saveSession?(snapshot: SessionSnapshot): Promise<void>;
|
|
12
12
|
}
|
|
13
|
-
export interface CreateCanvasProductEditorOptions {
|
|
14
|
-
editorPlugins: readonly EditorPlugin[];
|
|
15
|
-
documentMeta?: Record<string, unknown>;
|
|
16
|
-
resolveAssetUrl?: (assetId: AssetId) => string | null;
|
|
17
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
|
-
import type { ProductPersistenceAdapter } from "
|
|
2
|
+
import type { ProductPersistenceAdapter } from "./persistenceContracts";
|
|
3
3
|
export declare class PersistenceCoordinator {
|
|
4
4
|
private readonly editor;
|
|
5
5
|
private readonly adapter;
|