@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
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import type { AssetId, Editor } from "
|
|
2
|
-
import type {
|
|
1
|
+
import type { AssetId, Editor } from "../_vendor/canvas-core/index";
|
|
2
|
+
import type { ProductServiceRegistry, ProductServiceToken } from "../_vendor/canvas-product-contracts/index";
|
|
3
|
+
export interface ProductAssetResolverService {
|
|
4
|
+
resolveAssetUrl(editor: Editor, assetId: AssetId): string | null;
|
|
5
|
+
preloadForEditor?(editor: Editor, options: {
|
|
6
|
+
signal: AbortSignal;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
cleanupAfterRestore?(editor: Editor, options: {
|
|
9
|
+
signal: AbortSignal;
|
|
10
|
+
}): Promise<void> | void;
|
|
11
|
+
}
|
|
3
12
|
export declare function resolveProductAssetUrl({ assetResolverTokens, assetId, editor, services, }: {
|
|
4
13
|
assetResolverTokens: readonly ProductServiceToken<ProductAssetResolverService>[];
|
|
5
14
|
assetId: AssetId;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ProductServiceFactory, type ProductServiceSetup } from "../_vendor/canvas-product-contracts/index";
|
|
2
|
+
export interface ProductServiceRegistryRuntime extends ProductServiceSetup {
|
|
3
|
+
dispose(): void;
|
|
4
|
+
}
|
|
5
|
+
export declare function createProductServiceRegistry({ factories, productId, }: {
|
|
6
|
+
factories?: readonly ProductServiceFactory<unknown>[];
|
|
7
|
+
productId: string;
|
|
8
|
+
}): ProductServiceRegistryRuntime;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type CanvasProductController, type CanvasProductControllerSnapshot, type CanvasProductControllerContext, type CanvasProductSessionSnapshot } from "../core/product-controller";
|
|
2
|
-
export interface CanvasKitBaseController<TToolId extends string = string> extends CanvasProductController<TToolId> {
|
|
3
|
-
}
|
|
4
|
-
export declare const CANVAS_KIT_TOOL_IDS: readonly ["select", "hand", "rectangle", "ellipse", "rhombus", "triangle", "hexagon", "star", "arrow", "draw", "path", "text", "frame", "eraser", "laser"];
|
|
5
|
-
export type CanvasKitToolId = (typeof CANVAS_KIT_TOOL_IDS)[number];
|
|
6
|
-
export interface CanvasKitControllerSnapshot<TToolId extends string = CanvasKitToolId> extends CanvasProductControllerSnapshot<TToolId> {
|
|
7
|
-
productId: string;
|
|
8
|
-
session: CanvasProductSessionSnapshot<TToolId>;
|
|
9
|
-
}
|
|
10
|
-
export interface CanvasKitController<TToolId extends string = CanvasKitToolId> extends CanvasKitBaseController<TToolId> {
|
|
11
|
-
snapshot(): CanvasKitControllerSnapshot<TToolId>;
|
|
12
|
-
}
|
|
13
|
-
export interface CanvasKitControllerRuntimeContext extends CanvasProductControllerContext {
|
|
14
|
-
}
|
|
15
|
-
export interface CanvasKitControllerOptions<TToolId extends string = CanvasKitToolId> extends CanvasKitControllerRuntimeContext {
|
|
16
|
-
assertToolId?: (toolId: string) => asserts toolId is TToolId;
|
|
17
|
-
}
|
|
18
|
-
export interface CanvasKitControllerWithToolsOptions<TToolId extends string> extends CanvasKitControllerRuntimeContext {
|
|
19
|
-
assertToolId: (toolId: string) => asserts toolId is TToolId;
|
|
20
|
-
}
|
|
21
|
-
export type CanvasKitControllerWithTools<TToolId extends string> = CanvasKitController<TToolId>;
|
|
22
|
-
declare global {
|
|
23
|
-
interface Window {
|
|
24
|
-
landCanvasKit?: CanvasKitController;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export declare function createCanvasKitController(context: CanvasKitControllerOptions<CanvasKitToolId>): CanvasKitController;
|
|
28
|
-
export declare function createCanvasKitControllerWithTools<TToolId extends string>(context: CanvasKitControllerWithToolsOptions<TToolId>): CanvasKitControllerWithTools<TToolId>;
|
package/core/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { createDefaultCanvasProductEditor } from "./runtime/productEditor";
|
|
2
|
-
export { createCanvasProductController } from "./product-controller";
|
|
3
|
-
export { cleanupProductAssetsAfterRestore, preloadProductAssets, resolveProductAssetUrl, } from "./runtime/productAssets";
|
|
4
|
-
export { createProductServiceRegistry, createProductServiceToken, requireProductService, } from "./runtime/productServices";
|
|
5
|
-
export type { CreateCanvasProductEditorOptions, ProductPersistenceAdapter, ProductPersistenceLoadResult, } from "./runtime/runtimeContracts";
|
|
6
|
-
export type { ProductAssetResolverService, ProductServiceFactory, ProductServiceFactoryContext, ProductServiceRegistry, ProductServiceRegistryRuntime, ProductServiceSetup, ProductServiceToken, } from "./runtime/productServices";
|
|
7
|
-
export type { CanvasProductAssetData, CanvasProductController, CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductCommittedChange, CanvasProductCreatePageInput, CanvasProductDocumentRef, CanvasProductLayerNode, CanvasProductShapeData, CanvasProductShapeUpdate, CanvasProductRealtimeChange, CanvasProductSubscriptionOptions, } from "./product-controller";
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { createCanvasProductController } from "./canvasProductController";
|
|
2
|
-
export type { CanvasProductAssetData, CanvasProductController, CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductCommittedChange, CanvasProductControllerContext, CanvasProductControllerOptions, CanvasProductControllerSnapshot, CanvasProductCreatePageInput, CanvasProductDocumentRef, CanvasProductLayerActionState, CanvasProductLayerNode, CanvasProductLayerPlacement, CanvasProductLayerPlacementFailureReason, CanvasProductLayerPlacementResult, CanvasProductPageRef, CanvasProductShapeData, CanvasProductSessionPageState, CanvasProductSessionSnapshot, CanvasProductShapeUpdate, CanvasProductRealtimeChange, CanvasProductSubscriptionOptions, } from "./canvasProductController";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { AssetId, Editor } from "../../_vendor/canvas-core/index";
|
|
2
|
-
import { createProductServiceToken, requireProductService, type ProductServiceFactory, type ProductServiceFactoryContext, type ProductServiceRegistry, type ProductServiceSetup, type ProductServiceToken } from "../../_vendor/canvas-product-contracts/index";
|
|
3
|
-
export { createProductServiceToken, requireProductService, };
|
|
4
|
-
export type { ProductServiceFactory, ProductServiceFactoryContext, ProductServiceRegistry, ProductServiceSetup, ProductServiceToken, };
|
|
5
|
-
export interface ProductServiceRegistryRuntime extends ProductServiceSetup {
|
|
6
|
-
dispose(): void;
|
|
7
|
-
}
|
|
8
|
-
export interface ProductAssetResolverService {
|
|
9
|
-
resolveAssetUrl(editor: Editor, assetId: AssetId): string | null;
|
|
10
|
-
preloadForEditor?(editor: Editor, options: {
|
|
11
|
-
signal: AbortSignal;
|
|
12
|
-
}): Promise<void>;
|
|
13
|
-
cleanupAfterRestore?(editor: Editor, options: {
|
|
14
|
-
signal: AbortSignal;
|
|
15
|
-
}): Promise<void> | void;
|
|
16
|
-
}
|
|
17
|
-
export declare function createProductServiceRegistry({ factories, productId, }: {
|
|
18
|
-
factories?: readonly ProductServiceFactory<unknown>[];
|
|
19
|
-
productId: string;
|
|
20
|
-
}): ProductServiceRegistryRuntime;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type CanvasActionValue, type CanvasActionRegistry, type ContextMenuContext, type ContextMenuContributionTarget, type ContextMenuTarget } from "../../_vendor/canvas-product-contracts/index";
|
|
2
|
-
import type { Editor } from "../../_vendor/canvas-core/index";
|
|
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({ actionRegistry, actionId, context, value, }: {
|
|
9
|
-
actionRegistry: CanvasActionRegistry;
|
|
10
|
-
actionId: string;
|
|
11
|
-
context: ContextMenuContext;
|
|
12
|
-
value?: CanvasActionValue;
|
|
13
|
-
}): void;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Editor, ShapeId, Vec } from "../../../_vendor/canvas-core/index";
|
|
2
|
-
import { type ProductServiceRegistry } from "../../../core";
|
|
3
|
-
import { type ImageInsertSource, type ImageInsertStrategy, type ImageInsertSize } from "../toolbar/imageHostActions";
|
|
4
|
-
import type { ImageSmudgeController } from "../smudge/imageSmudgeTypes";
|
|
5
|
-
export interface ImageInsertInput {
|
|
6
|
-
source: ImageInsertSource;
|
|
7
|
-
pagePoint?: Vec;
|
|
8
|
-
size?: ImageInsertSize;
|
|
9
|
-
strategy?: ImageInsertStrategy;
|
|
10
|
-
}
|
|
11
|
-
export interface ImageReplaceInput {
|
|
12
|
-
file: File;
|
|
13
|
-
}
|
|
14
|
-
export interface ImageProductController {
|
|
15
|
-
insertImage(input: ImageInsertInput): Promise<ShapeId | null>;
|
|
16
|
-
replaceSelectedImage(input: ImageReplaceInput): Promise<boolean>;
|
|
17
|
-
downloadSelectedImageOriginal(): Promise<void>;
|
|
18
|
-
smudge: ImageSmudgeController;
|
|
19
|
-
}
|
|
20
|
-
export declare const imageProductControllerToken: import("../../../_vendor/canvas-product-contracts/index").ProductApiToken<ImageProductController>;
|
|
21
|
-
export interface ImageProductControllerRuntimeOptions {
|
|
22
|
-
flushSnapshot?: () => Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
export declare function createImageProductController({ editor, flushSnapshot, services, }: ImageProductControllerRuntimeOptions & {
|
|
25
|
-
editor: Editor;
|
|
26
|
-
services: ProductServiceRegistry;
|
|
27
|
-
}): ImageProductController | null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ImageHostPlugin: import("../..").CanvasPlugin;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { AssetId, ShapeId } from "../../../_vendor/canvas-core/index";
|
|
2
|
-
import type { ImageShapeCrop, ImageSmudgeBrush, ImageSmudgeStroke } from "../../../_vendor/plugin-image/index";
|
|
3
|
-
export type { ImageShapeCrop, ImageSmudgeBrush, ImageSmudgeStroke, ImageSmudgeStrokePoint, } from "../../../_vendor/plugin-image/index";
|
|
4
|
-
export interface ImageSmudgeConfirmPayload {
|
|
5
|
-
shapeId: ShapeId;
|
|
6
|
-
sourceAssetId: AssetId | null;
|
|
7
|
-
imageBlob: Blob;
|
|
8
|
-
maskBlob?: Blob;
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
crop: ImageShapeCrop | null;
|
|
12
|
-
strokes: ImageSmudgeStroke[];
|
|
13
|
-
}
|
|
14
|
-
export interface ImageSmudgeController {
|
|
15
|
-
start(input?: {
|
|
16
|
-
shapeId?: ShapeId;
|
|
17
|
-
brush?: Partial<ImageSmudgeBrush>;
|
|
18
|
-
}): boolean;
|
|
19
|
-
setBrush(brush: Partial<ImageSmudgeBrush>): boolean;
|
|
20
|
-
cancel(): void;
|
|
21
|
-
confirm(input?: {
|
|
22
|
-
replace?: boolean;
|
|
23
|
-
}): Promise<ImageSmudgeConfirmPayload | null>;
|
|
24
|
-
isActive(): boolean;
|
|
25
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
import type { CanvasKitController } from "../controller/canvasKitController";
|
|
2
|
-
export declare function useCanvasKitControllerLifecycle({ controller, exposeControllerOnWindow, onControllerDispose, onControllerReady, windowKey, }: {
|
|
3
|
-
controller: CanvasKitController;
|
|
4
|
-
exposeControllerOnWindow: boolean;
|
|
5
|
-
onControllerDispose?: () => void;
|
|
6
|
-
onControllerReady?: (controller: CanvasKitController) => void;
|
|
7
|
-
windowKey: string;
|
|
8
|
-
}): void;
|