@yuzhouu/canvas-kit 0.1.11 → 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 +47 -13
- 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/canvas-plugin-sdk/capability.d.ts +0 -6
- package/_vendor/canvas-plugin-sdk/index.d.ts +1 -16
- package/_vendor/canvas-plugin-sdk/plugin.d.ts +5 -52
- package/_vendor/canvas-plugin-sdk/setupExtension.d.ts +5 -0
- package/_vendor/canvas-product-contracts/actionRegistry.d.ts +4 -0
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/actions.d.ts +10 -16
- package/_vendor/canvas-product-contracts/capability.d.ts +8 -0
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/chrome.d.ts +1 -0
- package/_vendor/canvas-product-contracts/chromeRegistry.d.ts +9 -0
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/contextMenu.d.ts +4 -0
- package/_vendor/canvas-product-contracts/contextMenuRegistry.d.ts +4 -0
- package/_vendor/canvas-product-contracts/exportRegistry.d.ts +6 -0
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/exports.d.ts +1 -0
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/importRegistry.d.ts +1 -4
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/imports.d.ts +1 -0
- package/_vendor/canvas-product-contracts/index.d.ts +15 -0
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/productApi.d.ts +6 -5
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/services.d.ts +2 -1
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/toolbar.d.ts +3 -6
- package/_vendor/canvas-product-contracts/toolbarRegistry.d.ts +9 -0
- package/_vendor/plugin-arrow/api.d.ts +2 -2
- package/_vendor/plugin-frame/api.d.ts +2 -2
- package/_vendor/plugin-geo/api.d.ts +2 -2
- package/_vendor/plugin-group/groupContributions.d.ts +1 -1
- package/_vendor/plugin-group/productRuntime.d.ts +1 -1
- package/_vendor/plugin-image/cropRuntime.d.ts +1 -1
- package/_vendor/plugin-image/imageHostActionContract.d.ts +1 -1
- package/_vendor/plugin-image/productRuntime.d.ts +1 -1
- package/_vendor/plugin-image/runtimeShared.d.ts +1 -1
- package/_vendor/plugin-image/smudgeRuntime.d.ts +1 -1
- package/_vendor/plugin-image/styleRuntime.d.ts +1 -1
- package/_vendor/plugin-image/toolbarRuntime.d.ts +1 -1
- package/_vendor/plugin-runtime-clipboard/capability.d.ts +1 -0
- package/_vendor/{plugin-builtin-clipboard/clipboardContribution.d.ts → plugin-runtime-clipboard/clipboardActions.d.ts} +1 -6
- package/_vendor/{plugin-builtin-clipboard → plugin-runtime-clipboard}/clipboardService.d.ts +2 -2
- package/_vendor/plugin-runtime-clipboard/index.d.ts +4 -0
- package/_vendor/plugin-runtime-clipboard/plugin.d.ts +1 -0
- package/_vendor/{plugin-builtin-export → plugin-runtime-export}/canvasExportApi.d.ts +2 -2
- package/_vendor/{plugin-builtin-export → plugin-runtime-export}/index.d.ts +1 -1
- package/_vendor/{plugin-builtin-export → plugin-runtime-export}/plugin.d.ts +1 -1
- package/_vendor/plugin-text/api.d.ts +2 -2
- package/_vendor/plugin-text/feature.d.ts +1 -1
- 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/FloatingSelectionToolbarPageSpace.d.ts +1 -1
- package/chrome/toolbar/mergeToolbarGroups.d.ts +8 -0
- package/chrome/toolbar/toolbarLabels.d.ts +1 -1
- package/chrome/toolbar/useToolbarSurfaces.d.ts +1 -1
- package/chrome/types.d.ts +7 -8
- package/chrome/useCanvasKitChromeContext.d.ts +7 -7
- package/chrome/useCanvasKitLayerTree.d.ts +3 -2
- package/chrome/useChromeSurfaces.d.ts +1 -1
- package/chrome/useContextMenuSurface.d.ts +1 -1
- 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 +31 -27
- package/index.mjs +88 -111
- package/package.json +2 -2
- 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/{_vendor/plugin-builtin-import-host → plugins/runtime/import-host}/CanvasImportHost.d.ts +2 -1
- package/plugins/runtime/import-host/capability.d.ts +1 -0
- package/plugins/runtime/import-host/plugin.d.ts +1 -0
- package/plugins/runtime/keyboard-shortcuts/index.d.ts +1 -0
- package/plugins/runtime/keyboard-shortcuts/plugin.d.ts +1 -0
- package/plugins/runtime/keyboard-shortcuts/useCanvasKeyboardShortcuts.d.ts +6 -0
- package/plugins/runtime/tool-actions/capability.d.ts +1 -0
- package/{_vendor/plugin-builtin-tool-actions → plugins/runtime/tool-actions}/index.d.ts +1 -1
- package/plugins/runtime/tool-actions/plugin.d.ts +1 -0
- package/plugins/runtime/tool-actions/toolActions.d.ts +2 -0
- package/plugins/standard/clipboard/chrome.d.ts +2 -0
- package/plugins/standard/clipboard/contextMenu.d.ts +2 -0
- package/plugins/standard/clipboard/plugin.d.ts +1 -0
- package/plugins/standard/clipboard/shortcuts.d.ts +5 -0
- package/plugins/{standardCanvasKitPlugins.d.ts → standard/createStandardCanvasKitPlugins.d.ts} +2 -3
- package/plugins/standard/selection/actions.d.ts +21 -0
- package/plugins/standard/selection/chrome.d.ts +2 -0
- package/plugins/standard/selection/contextMenu.d.ts +2 -0
- package/plugins/standard/selection/plugin.d.ts +1 -0
- package/plugins/standard/selection/toolbar.d.ts +2 -0
- package/plugins/standard/tool-ui/contextMenu.d.ts +2 -0
- package/plugins/standard/tool-ui/plugin.d.ts +1 -0
- package/plugins/standard/tool-ui/toolbar.d.ts +2 -0
- package/plugins/standard/view/actions.d.ts +5 -0
- package/plugins/standard/view/chrome.d.ts +2 -0
- package/plugins/standard/view/contextMenu.d.ts +2 -0
- package/plugins/standard/view/plugin.d.ts +1 -0
- package/react/CanvasKitRoot.d.ts +3 -2
- package/react/useCanvasProductControllerLifecycle.d.ts +9 -0
- package/runtime/canvasKitActionContext.d.ts +17 -0
- package/runtime/canvasKitActionExecutor.d.ts +12 -0
- package/runtime/canvasKitCommandExecutor.d.ts +12 -3
- package/runtime/canvasKitPluginContracts.d.ts +13 -19
- package/{_vendor/canvas-plugin-sdk/lifecycle.d.ts → runtime/canvasKitPluginLifecycle.d.ts} +6 -5
- package/runtime/canvasKitPluginSetup.d.ts +9 -6
- package/{_vendor/canvas-plugin-sdk/pluginUi.d.ts → runtime/canvasKitPluginUi.d.ts} +5 -5
- package/runtime/canvasKitRuntime.d.ts +14 -5
- package/runtime/canvasKitRuntimeContracts.d.ts +8 -7
- package/runtime/canvasPluginGraph.d.ts +15 -0
- 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/runtime/registries/actionRegistry.d.ts +5 -0
- package/runtime/registries/chromeRegistry.d.ts +2 -0
- package/runtime/registries/contextMenuRegistry.d.ts +5 -0
- package/runtime/registries/exportRegistry.d.ts +2 -0
- package/runtime/registries/importRegistry.d.ts +2 -0
- package/runtime/registries/index.d.ts +7 -0
- package/runtime/registries/productApiRegistry.d.ts +5 -0
- package/runtime/registries/toolbarRegistry.d.ts +5 -0
- package/_vendor/canvas-plugin-sdk/actionRegistry.d.ts +0 -7
- package/_vendor/canvas-plugin-sdk/chromeRegistry.d.ts +0 -15
- package/_vendor/canvas-plugin-sdk/contextMenuRegistry.d.ts +0 -11
- package/_vendor/canvas-plugin-sdk/exportRegistry.d.ts +0 -9
- package/_vendor/canvas-plugin-sdk/toolbarRegistry.d.ts +0 -18
- package/_vendor/plugin-builtin-clipboard/clipboardChromeContributions.d.ts +0 -2
- package/_vendor/plugin-builtin-clipboard/clipboardContextMenuContributions.d.ts +0 -2
- package/_vendor/plugin-builtin-clipboard/index.d.ts +0 -3
- package/_vendor/plugin-builtin-clipboard/plugin.d.ts +0 -1
- package/_vendor/plugin-builtin-import-host/capability.d.ts +0 -1
- package/_vendor/plugin-builtin-import-host/plugin.d.ts +0 -1
- package/_vendor/plugin-builtin-tool-actions/capability.d.ts +0 -1
- package/_vendor/plugin-builtin-tool-actions/plugin.d.ts +0 -1
- package/_vendor/plugin-builtin-tool-actions/toolActions.d.ts +0 -2
- package/_vendor/plugin-connector/canvasRender.d.ts +0 -2
- package/_vendor/plugin-connector/connectorBindingUtil.d.ts +0 -28
- package/_vendor/plugin-connector/connectorBindings.d.ts +0 -8
- package/_vendor/plugin-connector/connectorGeometry.d.ts +0 -70
- package/_vendor/plugin-connector/connectorHandles.d.ts +0 -12
- package/_vendor/plugin-connector/connectorInteractions.d.ts +0 -3
- package/_vendor/plugin-connector/connectorMarker.d.ts +0 -7
- package/_vendor/plugin-connector/connectorModel.d.ts +0 -43
- package/_vendor/plugin-connector/connectorPortInteraction.d.ts +0 -13
- package/_vendor/plugin-connector/connectorPorts.d.ts +0 -23
- package/_vendor/plugin-connector/connectorRuntime.d.ts +0 -62
- package/_vendor/plugin-connector/connectorShapeUtil.d.ts +0 -29
- package/_vendor/plugin-connector/connectorTool.d.ts +0 -4
- package/_vendor/plugin-connector/constants.d.ts +0 -17
- package/_vendor/plugin-connector/editorRuntime.d.ts +0 -7
- package/_vendor/plugin-connector/feature.d.ts +0 -4
- package/_vendor/plugin-connector/index.d.ts +0 -18
- package/_vendor/plugin-connector/orthogonalRoute.d.ts +0 -9
- package/_vendor/plugin-connector/productRuntime.d.ts +0 -2
- package/_vendor/plugin-connector/quickConnect.d.ts +0 -28
- package/_vendor/plugin-connector/types.d.ts +0 -51
- package/_vendor/plugin-packaging/api.d.ts +0 -74
- package/_vendor/plugin-packaging/canvasRender.d.ts +0 -2
- package/_vendor/plugin-packaging/editorRuntime.d.ts +0 -2
- package/_vendor/plugin-packaging/feature.d.ts +0 -2
- package/_vendor/plugin-packaging/index.d.ts +0 -19
- package/_vendor/plugin-packaging/packagingArtwork.d.ts +0 -5
- package/_vendor/plugin-packaging/packagingDxf.d.ts +0 -9
- package/_vendor/plugin-packaging/packagingGeometry.d.ts +0 -74
- package/_vendor/plugin-packaging/packagingInteractions.d.ts +0 -2
- package/_vendor/plugin-packaging/packagingPdfExporter.d.ts +0 -25
- package/_vendor/plugin-packaging/packagingRuntime.d.ts +0 -11
- package/_vendor/plugin-packaging/packagingShapeUtil.d.ts +0 -34
- package/_vendor/plugin-packaging/packagingStyle.d.ts +0 -10
- package/_vendor/plugin-packaging/packagingSvgExporter.d.ts +0 -7
- package/_vendor/plugin-packaging/productRuntime.d.ts +0 -2
- package/_vendor/plugin-packaging/types.d.ts +0 -168
- package/_vendor/plugin-packaging/validation.d.ts +0 -3
- 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/es-DocrZgUh.mjs +0 -2
- 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/_vendor/{plugin-builtin-export → plugin-runtime-export}/blobDataUrl.d.ts +0 -0
- /package/_vendor/{plugin-builtin-export → plugin-runtime-export}/pngExport.d.ts +0 -0
- /package/_vendor/{plugin-builtin-export → plugin-runtime-export}/svgExport.d.ts +0 -0
- /package/{_vendor/plugin-builtin-import-host → plugins/runtime/import-host}/index.d.ts +0 -0
|
@@ -140,10 +140,7 @@ export interface ToolbarContribution {
|
|
|
140
140
|
when?(context: CanvasActionContext): boolean;
|
|
141
141
|
getGroups(context: CanvasActionContext): readonly ToolbarGroup[];
|
|
142
142
|
}
|
|
143
|
-
export interface
|
|
144
|
-
|
|
145
|
-
groupIdPrefix?: string;
|
|
143
|
+
export interface CanvasPluginToolbarSetup {
|
|
144
|
+
add(...contributions: readonly ToolbarContribution[]): void;
|
|
146
145
|
}
|
|
147
|
-
export declare
|
|
148
|
-
dedupeActionIdsAcrossSources?: boolean;
|
|
149
|
-
}): ToolbarGroup[];
|
|
146
|
+
export declare const canvasToolbarExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginToolbarSetup>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Editor } from "../canvas-core/index";
|
|
2
|
+
import type { CanvasActionContext } from "./actions";
|
|
3
|
+
import type { ToolbarChannel, ToolbarGroup } from "./toolbar";
|
|
4
|
+
export interface CanvasToolbarRegistry {
|
|
5
|
+
getStateRevision(): number;
|
|
6
|
+
subscribeToState(editor: Editor, listener: () => void): () => void;
|
|
7
|
+
getGroups(channel: ToolbarChannel, context: CanvasActionContext): ToolbarGroup[];
|
|
8
|
+
getChannels(): readonly ToolbarChannel[];
|
|
9
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ShapeColor, type ShapeId } from "../canvas-core/index";
|
|
2
|
-
import { type CanvasPluginApi, type CanvasShapeRef } from "../canvas-
|
|
2
|
+
import { type CanvasPluginApi, type CanvasShapeRef } from "../canvas-product-contracts/index";
|
|
3
3
|
import type { ArrowShapeProps } from "./types";
|
|
4
4
|
export interface ArrowBindingInput {
|
|
5
5
|
targetShapeId: ShapeId;
|
|
@@ -29,5 +29,5 @@ export interface ArrowInput {
|
|
|
29
29
|
export interface ArrowApi {
|
|
30
30
|
create(input: ArrowInput): CanvasShapeRef<"arrow"> | null;
|
|
31
31
|
}
|
|
32
|
-
export declare const arrowApiToken: import("../canvas-
|
|
32
|
+
export declare const arrowApiToken: import("../canvas-product-contracts/index").ProductApiToken<ArrowApi>;
|
|
33
33
|
export declare const arrowPluginApi: CanvasPluginApi<ArrowApi>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ShapeColor, ShapeId } from "../canvas-core/index";
|
|
2
|
-
import { type CanvasPluginApi, type CanvasShapeRef } from "../canvas-
|
|
2
|
+
import { type CanvasPluginApi, type CanvasShapeRef } from "../canvas-product-contracts/index";
|
|
3
3
|
export interface FrameInput {
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
@@ -15,5 +15,5 @@ export interface FrameApi {
|
|
|
15
15
|
create(input: FrameInput): CanvasShapeRef<"frame"> | null;
|
|
16
16
|
moveShapesToFrame(ids: ShapeId[], frameId: ShapeId): ShapeId[];
|
|
17
17
|
}
|
|
18
|
-
export declare const frameApiToken: import("../canvas-
|
|
18
|
+
export declare const frameApiToken: import("../canvas-product-contracts/index").ProductApiToken<FrameApi>;
|
|
19
19
|
export declare const framePluginApi: CanvasPluginApi<FrameApi>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ShapeColor } from "../canvas-core/index";
|
|
2
|
-
import { type CanvasPluginApi, type CanvasShapeRef } from "../canvas-
|
|
2
|
+
import { type CanvasPluginApi, type CanvasShapeRef } from "../canvas-product-contracts/index";
|
|
3
3
|
import type { GeoShapeProps } from "./types";
|
|
4
4
|
export interface GeoShapeInput {
|
|
5
5
|
x: number;
|
|
@@ -23,5 +23,5 @@ export interface GeoApi {
|
|
|
23
23
|
createHexagon(input: GeoShapeInput): CanvasShapeRef<"geo"> | null;
|
|
24
24
|
createStar(input: GeoShapeInput): CanvasShapeRef<"geo"> | null;
|
|
25
25
|
}
|
|
26
|
-
export declare const geoApiToken: import("../canvas-
|
|
26
|
+
export declare const geoApiToken: import("../canvas-product-contracts/index").ProductApiToken<GeoApi>;
|
|
27
27
|
export declare const geoPluginApi: CanvasPluginApi<GeoApi>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CanvasAction, type ContextMenuContribution, type ToolbarContribution } from "../canvas-
|
|
1
|
+
import { type CanvasAction, type ContextMenuContribution, type ToolbarContribution } from "../canvas-product-contracts/index";
|
|
2
2
|
export declare const GROUP_SELECTION_ACTION_ID = "group.selection.group";
|
|
3
3
|
export declare const UNGROUP_SELECTION_ACTION_ID = "group.selection.ungroup";
|
|
4
4
|
export declare const groupSelectionAction: CanvasAction;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CanvasPluginSetupContext } from "../canvas-plugin-sdk/index";
|
|
2
2
|
export declare function setupGroupProduct(context: CanvasPluginSetupContext): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type CanvasAction } from "../canvas-
|
|
1
|
+
import { type CanvasAction } from "../canvas-product-contracts/index";
|
|
2
2
|
export declare function createImageCropCanvasActions(): CanvasAction[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type CanvasAction } from "../canvas-
|
|
1
|
+
import { type CanvasAction } from "../canvas-product-contracts/index";
|
|
2
2
|
export declare function createImageHostToolbarActionContract(actionId: string): CanvasAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CanvasPluginSetupContext } from "../canvas-plugin-sdk/index";
|
|
2
2
|
export { IMAGE_CORNER_RADIUS_TOOLBAR_ACTION_ID, IMAGE_CROP_ASPECT_RATIO_TOOLBAR_ACTION_ID, IMAGE_CROP_DONE_TOOLBAR_ACTION_ID, IMAGE_CROP_RESET_TOOLBAR_ACTION_ID, IMAGE_CROP_TOOLBAR_ACTION_ID, IMAGE_CROP_ZOOM_TOOLBAR_ACTION_ID, IMAGE_DOWNLOAD_TOOLBAR_ACTION_ID, IMAGE_INSERT_TOOLBAR_ACTION_ID, IMAGE_REPLACE_TOOLBAR_ACTION_ID, } from "./actionIds";
|
|
3
3
|
export { isImageCropToolbarSession, isImageSmudgeToolbarSession, } from "./runtimeShared";
|
|
4
4
|
export declare function setupImageProduct(context: CanvasPluginSetupContext): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CanvasActionContext } from "../canvas-
|
|
1
|
+
import { type CanvasActionContext } from "../canvas-product-contracts/index";
|
|
2
2
|
import { type ImageShapeRecord } from "./types";
|
|
3
3
|
export declare function getSingleSelectedImageShape(context: CanvasActionContext): ImageShapeRecord | null;
|
|
4
4
|
export declare function isImageCropToolbarSession(context: CanvasActionContext): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type CanvasAction } from "../canvas-
|
|
1
|
+
import { type CanvasAction } from "../canvas-product-contracts/index";
|
|
2
2
|
export declare function createImageSmudgeCanvasActions(): CanvasAction[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CanvasAction, type ToolbarGroup } from "../canvas-
|
|
1
|
+
import { type CanvasAction, type ToolbarGroup } from "../canvas-product-contracts/index";
|
|
2
2
|
export declare function createImageStyleCanvasActions(): CanvasAction[];
|
|
3
3
|
export declare function createImageCornerRadiusToolbarGroup({ dataUiPrefix, id, order, }: {
|
|
4
4
|
dataUiPrefix: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type ContextMenuContribution, type ToolbarContribution } from "../canvas-
|
|
1
|
+
import { type ContextMenuContribution, type ToolbarContribution } from "../canvas-product-contracts/index";
|
|
2
2
|
export declare function createImageToolbarContributions(): ToolbarContribution[];
|
|
3
3
|
export declare function createImageContextMenuContributions(): ContextMenuContribution[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const canvasClipboardRuntimeCapability: import("../canvas-plugin-sdk/index").CanvasPluginValueToken<true>;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { type CanvasAction, type ProductServiceRegistry } from "../canvas-
|
|
2
|
-
import type { KeyboardShortcutInput } from "../canvas-core/index";
|
|
1
|
+
import { type CanvasAction, type ProductServiceRegistry } from "../canvas-product-contracts/index";
|
|
3
2
|
export declare const SYSTEM_CLIPBOARD_COPY_ACTION_ID = "system.clipboard.copy";
|
|
4
3
|
export declare const SYSTEM_CLIPBOARD_CUT_ACTION_ID = "system.clipboard.cut";
|
|
5
4
|
export declare const SYSTEM_CLIPBOARD_PASTE_ACTION_ID = "system.clipboard.paste";
|
|
6
5
|
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
6
|
export declare function createClipboardActions(services: ProductServiceRegistry): readonly CanvasAction[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { EditorClipboardPayload } from "../canvas-core/index";
|
|
2
|
-
import { type ProductServiceFactory, type ProductServiceRegistry } from "../canvas-
|
|
2
|
+
import { type ProductServiceFactory, type ProductServiceRegistry } from "../canvas-product-contracts/index";
|
|
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("../canvas-
|
|
8
|
+
export declare const canvasClipboardServiceToken: import("../canvas-product-contracts/index").ProductServiceToken<CanvasClipboardService>;
|
|
9
9
|
export declare function getCanvasClipboardService(services: ProductServiceRegistry): CanvasClipboardService | null;
|
|
10
10
|
export declare function memoryCanvasClipboardService(): ProductServiceFactory<CanvasClipboardService>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DefaultClipboardRuntimePlugin: import("../canvas-plugin-sdk/index").CanvasPlugin<(context: import("../canvas-plugin-sdk/index").CanvasPluginSetupContext) => void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Editor, ShapeId, ThemeColorResolver } from "../canvas-core/index";
|
|
2
|
-
import { type CanvasExportArtifact, type CanvasExportContribution, type CanvasExportFormat, type CanvasExportRegistry } from "../canvas-
|
|
2
|
+
import { type CanvasExportArtifact, type CanvasExportContribution, type CanvasExportFormat, type CanvasExportRegistry } from "../canvas-product-contracts/index";
|
|
3
3
|
import { type PngExportResult } from "./pngExport";
|
|
4
4
|
import { type SvgAssetInliner, type SvgExportResult } from "./svgExport";
|
|
5
5
|
export type CanvasExportTarget = {
|
|
@@ -30,7 +30,7 @@ export interface CanvasExportApi {
|
|
|
30
30
|
exportPng(input: CanvasPngExportInput): Promise<PngExportResult>;
|
|
31
31
|
exportSvg(input: CanvasSvgExportInput): Promise<SvgExportResult>;
|
|
32
32
|
}
|
|
33
|
-
export declare const canvasExportApiToken: import("../canvas-
|
|
33
|
+
export declare const canvasExportApiToken: import("../canvas-product-contracts/index").ProductApiToken<CanvasExportApi>;
|
|
34
34
|
export declare function createCanvasExportApi({ editor, exportRegistry, }: {
|
|
35
35
|
editor: Editor;
|
|
36
36
|
exportRegistry: CanvasExportRegistry;
|
|
@@ -3,6 +3,6 @@ export { canvasExportApiToken, createCanvasExportApi, createPngExportContributio
|
|
|
3
3
|
export type { CanvasExportAppearance, CanvasExportApi, CanvasGenericExportInput, CanvasExportTarget, CanvasPngExportInput, CanvasSvgExportInput, } from "./canvasExportApi";
|
|
4
4
|
export { exportEditorPng, } from "./pngExport";
|
|
5
5
|
export type { PngExportOptions, PngExportResult, } from "./pngExport";
|
|
6
|
-
export {
|
|
6
|
+
export { createDefaultCanvasExportPlugin } from "./plugin";
|
|
7
7
|
export { exportEditorSvg, } from "./svgExport";
|
|
8
8
|
export type { ExportStatus, SvgAssetInliner, SvgExportOptions, SvgExportResult, } from "./svgExport";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SvgAssetInliner } from "./svgExport";
|
|
2
2
|
import { type CanvasPlugin } from "../canvas-plugin-sdk/index";
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function createDefaultCanvasExportPlugin({ svgAssetInliners, }: {
|
|
4
4
|
svgAssetInliners: SvgAssetInliner[];
|
|
5
5
|
}): CanvasPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ShapeColor } from "../canvas-core/index";
|
|
2
|
-
import { type CanvasPluginApi, type CanvasShapeRef } from "../canvas-
|
|
2
|
+
import { type CanvasPluginApi, type CanvasShapeRef } from "../canvas-product-contracts/index";
|
|
3
3
|
import type { TextShapeProps } from "./textTypes";
|
|
4
4
|
export interface TextInput {
|
|
5
5
|
x: number;
|
|
@@ -16,5 +16,5 @@ export interface TextInput {
|
|
|
16
16
|
export interface TextApi {
|
|
17
17
|
create(input: TextInput): CanvasShapeRef<"text"> | null;
|
|
18
18
|
}
|
|
19
|
-
export declare const textApiToken: import("../canvas-
|
|
19
|
+
export declare const textApiToken: import("../canvas-product-contracts/index").ProductApiToken<TextApi>;
|
|
20
20
|
export declare const textPluginApi: CanvasPluginApi<TextApi>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type CanvasPlugin } from "../canvas-plugin-sdk/index";
|
|
2
2
|
import { type TextPluginOptions } from "./textFonts";
|
|
3
3
|
export declare function createTextPlugin(options?: Readonly<Partial<TextPluginOptions>>): CanvasPlugin;
|
|
4
|
-
export declare const Text: CanvasPlugin<import("../canvas-plugin-sdk/index").CanvasPluginSetup<import("../canvas-plugin-sdk/index").CanvasPluginSetupContext
|
|
4
|
+
export declare const Text: CanvasPlugin<import("../canvas-plugin-sdk/index").CanvasPluginSetup<import("../canvas-plugin-sdk/index").CanvasPluginSetupContext>>;
|
package/browser/persistence.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ProductPersistenceAdapter, ProductPersistenceLoadResult } from "../
|
|
1
|
+
import type { ProductPersistenceAdapter, ProductPersistenceLoadResult } from "../runtime/persistenceContracts";
|
|
2
2
|
import { CANVAS_KIT_IMAGE_BLOB_STORE, CANVAS_KIT_INDEXEDDB_NAME, CANVAS_KIT_INDEXEDDB_VERSION, CANVAS_KIT_SNAPSHOT_STORE } from "./indexedDb";
|
|
3
3
|
export declare const CANVAS_KIT_DOCUMENT_STORAGE_KEY = "canvas-kit.document";
|
|
4
4
|
export declare const CANVAS_KIT_SESSION_STORAGE_KEY = "canvas-kit.session";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const CANVAS_KIT_TOOL_IDS: readonly ["select", "hand", "rectangle", "ellipse", "rhombus", "triangle", "hexagon", "star", "arrow", "draw", "path", "text", "frame", "eraser", "laser"];
|
|
2
|
+
export type CanvasKitToolId = (typeof CANVAS_KIT_TOOL_IDS)[number];
|
|
3
|
+
export declare function assertCanvasKitToolId(toolId: string): asserts toolId is CanvasKitToolId;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { 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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type
|
|
2
|
+
import { type CanvasActionContext } from "../../_vendor/canvas-product-contracts/index";
|
|
3
3
|
export declare function FloatingSelectionToolbarPageSpace({ children, className, context, dataUi, horizontalAlign, offset, visible, }: {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
className?: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ToolbarGroup } from "../../_vendor/canvas-product-contracts/index";
|
|
2
|
+
export interface ToolbarGroupSource {
|
|
3
|
+
groups: readonly ToolbarGroup[];
|
|
4
|
+
groupIdPrefix?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function mergeToolbarGroups(sources: readonly ToolbarGroupSource[], options?: {
|
|
7
|
+
dedupeActionIdsAcrossSources?: boolean;
|
|
8
|
+
}): ToolbarGroup[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ToolbarGroup } from "../../_vendor/canvas-product-contracts/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,4 +1,4 @@
|
|
|
1
|
-
import { type CanvasActionContext, type CanvasToolbarRegistry, type ToolbarChannel, type ToolbarGroup, type ToolbarSurface } from "../../_vendor/canvas-
|
|
1
|
+
import { type CanvasActionContext, type CanvasToolbarRegistry, type ToolbarChannel, type ToolbarGroup, type ToolbarSurface } from "../../_vendor/canvas-product-contracts/index";
|
|
2
2
|
import { type Editor } from "../../_vendor/canvas-core/index";
|
|
3
3
|
export interface ToolbarSurfaces {
|
|
4
4
|
context: CanvasActionContext;
|
package/chrome/types.d.ts
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { type ActiveContextMenu, type CanvasActionContext, type CanvasActionValue } from "../_vendor/canvas-
|
|
2
|
-
import type {
|
|
3
|
-
import type { CanvasProductLayerNode } from "../
|
|
1
|
+
import { type ActiveContextMenu, type CanvasActionContext, type CanvasActionValue } from "../_vendor/canvas-product-contracts/index";
|
|
2
|
+
import type { CanvasKitToolId } from "../canvasKitTools";
|
|
3
|
+
import type { CanvasProductController, CanvasProductLayerNode } from "../controller";
|
|
4
4
|
import type { EditorSelectionMetadata, ShapeId } from "../_vendor/canvas-core/index";
|
|
5
5
|
import type { HistoryControls } from "./useHistoryControls";
|
|
6
6
|
import type { PageControls } from "./usePageControls";
|
|
7
7
|
import type { ZoomControlsState } from "./useZoomControls";
|
|
8
8
|
import type { ContextMenuSurface } from "./useContextMenuSurface";
|
|
9
|
-
import type { CanvasExportApi } from "../_vendor/plugin-
|
|
9
|
+
import type { CanvasExportApi } from "../_vendor/plugin-runtime-export/index";
|
|
10
10
|
import type { ToolbarSurfaces } from "./toolbar/useToolbarSurfaces";
|
|
11
11
|
import type { ChromeSurfaces } from "./useChromeSurfaces";
|
|
12
12
|
export type { EditorSelectionMetadata, EditorSelectionState, ShapeId, } from "../_vendor/canvas-core/index";
|
|
13
|
-
export type { CanvasActionContext, CanvasActionValue, ChromeCommandItem, ChromeItem, ChromeSection, ContextMenuCommandItem, ContextMenuItem, ContextMenuSection, ToolbarGroup, ToolbarItem, } from "../_vendor/canvas-
|
|
13
|
+
export type { CanvasActionContext, CanvasActionValue, ChromeCommandItem, ChromeItem, ChromeSection, ContextMenuCommandItem, ContextMenuItem, ContextMenuSection, ToolbarGroup, ToolbarItem, } from "../_vendor/canvas-product-contracts/index";
|
|
14
14
|
export type { HistoryControls } from "./useHistoryControls";
|
|
15
15
|
export type { PageControls } from "./usePageControls";
|
|
16
16
|
export type { ZoomControlsState } from "./useZoomControls";
|
|
17
17
|
export type { ContextMenuSurface } from "./useContextMenuSurface";
|
|
18
18
|
export type { ToolbarSurfaces, } from "./toolbar/useToolbarSurfaces";
|
|
19
19
|
export type { ChromeSurfaces } from "./useChromeSurfaces";
|
|
20
|
-
export type CanvasKitLayerNode = CanvasProductLayerNode;
|
|
21
20
|
export interface CanvasKitToolbarActionState {
|
|
22
21
|
value: CanvasActionValue | undefined;
|
|
23
22
|
isEnabled: boolean;
|
|
@@ -42,8 +41,8 @@ export interface CanvasKitLayerTreeSource {
|
|
|
42
41
|
getSnapshot(pageId?: string): readonly CanvasProductLayerNode[];
|
|
43
42
|
subscribe(onStoreChange: () => void): () => void;
|
|
44
43
|
}
|
|
45
|
-
export interface CanvasKitChromeContext<
|
|
46
|
-
controller:
|
|
44
|
+
export interface CanvasKitChromeContext<TToolId extends string = CanvasKitToolId> {
|
|
45
|
+
controller: CanvasProductController<TToolId>;
|
|
47
46
|
chromeSurfaces: ChromeSurfaces;
|
|
48
47
|
contextMenu: CanvasKitContextMenuState;
|
|
49
48
|
currentPageId: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type ActiveContextMenu, type CanvasActionContext, type CanvasActionRegistry, type CanvasChromeRegistry, type CanvasContextMenuRegistry, type CanvasToolbarRegistry } from "../_vendor/canvas-
|
|
1
|
+
import { type ActiveContextMenu, type CanvasActionContext, type CanvasActionRegistry, type CanvasChromeRegistry, type CanvasContextMenuRegistry, type CanvasToolbarRegistry } from "../_vendor/canvas-product-contracts/index";
|
|
2
2
|
import { type Editor } from "../_vendor/canvas-core/index";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { CanvasProductController } from "../controller";
|
|
4
|
+
import type { ExecuteCanvasKitAction } from "../runtime/canvasKitActionExecutor";
|
|
5
5
|
import type { CanvasKitChromeContext, CanvasKitGridControls } from "./types";
|
|
6
|
-
export declare function useCanvasKitChromeContext<
|
|
7
|
-
controller:
|
|
6
|
+
export declare function useCanvasKitChromeContext<TToolId extends string>({ controller, activeContextMenu, grid, onActiveContextMenuChange, actionRegistry, canShowPropertiesDuringEditing, chromeRegistry, contextMenuRegistry, editor, executeAction, toolbarRegistry, }: {
|
|
7
|
+
controller: CanvasProductController<TToolId>;
|
|
8
8
|
activeContextMenu: ActiveContextMenu | null;
|
|
9
9
|
grid: CanvasKitGridControls;
|
|
10
10
|
onActiveContextMenuChange: (activeContextMenu: ActiveContextMenu | null) => void;
|
|
@@ -13,6 +13,6 @@ export declare function useCanvasKitChromeContext<TController extends CanvasKitB
|
|
|
13
13
|
chromeRegistry: CanvasChromeRegistry;
|
|
14
14
|
contextMenuRegistry: CanvasContextMenuRegistry;
|
|
15
15
|
editor: Editor;
|
|
16
|
-
|
|
16
|
+
executeAction: ExecuteCanvasKitAction;
|
|
17
17
|
toolbarRegistry: CanvasToolbarRegistry;
|
|
18
|
-
}): CanvasKitChromeContext<
|
|
18
|
+
}): CanvasKitChromeContext<TToolId>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CanvasProductLayerNode } from "../controller";
|
|
2
|
+
import type { CanvasKitLayerTreeSource } from "./types";
|
|
2
3
|
export declare function useCanvasKitLayerTree(source: CanvasKitLayerTreeSource, options?: {
|
|
3
4
|
enabled?: boolean;
|
|
4
5
|
pageId?: string;
|
|
5
|
-
}): readonly
|
|
6
|
+
}): readonly CanvasProductLayerNode[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CanvasActionContext, type CanvasChromeRegistry, type ChromeChannel, type ChromeSection } from "../_vendor/canvas-product-contracts/index";
|
|
2
2
|
import type { Editor } from "../_vendor/canvas-core/index";
|
|
3
3
|
export interface ChromeSurfaces {
|
|
4
4
|
context: CanvasActionContext;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ActiveContextMenu, type CanvasContextMenuRegistry, type ContextMenuContext, type ContextMenuSection } from "../_vendor/canvas-
|
|
1
|
+
import { type ActiveContextMenu, type CanvasContextMenuRegistry, type ContextMenuContext, type ContextMenuSection } from "../_vendor/canvas-product-contracts/index";
|
|
2
2
|
import type { Editor } from "../_vendor/canvas-core/index";
|
|
3
3
|
export interface ContextMenuSurface {
|
|
4
4
|
context: ContextMenuContext | null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
|
-
import type {
|
|
2
|
+
import type { CanvasProductController } from "../controller";
|
|
3
3
|
export interface HistoryControls {
|
|
4
4
|
canUndo: boolean;
|
|
5
5
|
canRedo: boolean;
|
|
6
6
|
undo(): void;
|
|
7
7
|
redo(): void;
|
|
8
8
|
}
|
|
9
|
-
export declare function useHistoryControls({
|
|
9
|
+
export declare function useHistoryControls({ controller, editor, }: {
|
|
10
|
+
controller: CanvasProductController;
|
|
10
11
|
editor: Editor;
|
|
11
|
-
executeCommand: ExecuteCanvasKitCommand;
|
|
12
12
|
}): HistoryControls;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { Editor
|
|
2
|
-
import type {
|
|
1
|
+
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
|
+
import type { CanvasProductController, CanvasProductPageRef } from "../controller";
|
|
3
3
|
export interface PageControls {
|
|
4
|
-
pages: readonly
|
|
5
|
-
currentPage:
|
|
6
|
-
currentPageId:
|
|
4
|
+
pages: readonly CanvasProductPageRef[];
|
|
5
|
+
currentPage: CanvasProductPageRef | null;
|
|
6
|
+
currentPageId: string;
|
|
7
7
|
canDeleteCurrentPage: boolean;
|
|
8
8
|
createPage(): void;
|
|
9
9
|
deleteCurrentPage(): void;
|
|
10
10
|
renameCurrentPage(nextName: string): void;
|
|
11
|
-
selectPage(pageId:
|
|
11
|
+
selectPage(pageId: string): void;
|
|
12
12
|
}
|
|
13
|
-
export declare function usePageControls({
|
|
13
|
+
export declare function usePageControls({ controller, editor, }: {
|
|
14
|
+
controller: CanvasProductController;
|
|
14
15
|
editor: Editor;
|
|
15
|
-
executeCommand: ExecuteCanvasKitCommand;
|
|
16
16
|
}): PageControls;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
|
+
import type { CanvasProductController } from "../controller";
|
|
2
3
|
export interface ZoomControlsState {
|
|
3
4
|
zoom: number;
|
|
4
5
|
label: string;
|
|
@@ -6,4 +7,7 @@ export interface ZoomControlsState {
|
|
|
6
7
|
zoomOut(): void;
|
|
7
8
|
resetZoom(): void;
|
|
8
9
|
}
|
|
9
|
-
export declare function useZoomControls(editor
|
|
10
|
+
export declare function useZoomControls({ controller, editor, }: {
|
|
11
|
+
controller: CanvasProductController;
|
|
12
|
+
editor: Editor;
|
|
13
|
+
}): ZoomControlsState;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
|
+
export interface CanvasKitCommandToken<TId extends string = string> {
|
|
3
|
+
readonly id: TId;
|
|
4
|
+
}
|
|
5
|
+
export interface CanvasKitCommand<TArgs extends readonly unknown[], TResult, TId extends string = string> {
|
|
6
|
+
readonly id: TId;
|
|
7
|
+
readonly token: CanvasKitCommandToken<TId>;
|
|
8
|
+
run(editor: Editor, ...args: TArgs): TResult;
|
|
9
|
+
}
|
|
10
|
+
export type ExecuteCanvasKitDefinedCommand = <TArgs extends readonly unknown[], TResult>(command: CanvasKitCommand<TArgs, TResult>, ...args: TArgs) => TResult;
|
|
11
|
+
export declare function defineCanvasKitCommand<const TId extends string, TArgs extends readonly unknown[], TResult>(command: Omit<CanvasKitCommand<TArgs, TResult, TId>, "id">): CanvasKitCommand<TArgs, TResult, TId>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { CanvasKitCommandToken } from "./command";
|
|
2
|
+
export declare const CANVAS_KIT_COMMAND_TOKENS: Readonly<{
|
|
3
|
+
document: Readonly<{
|
|
4
|
+
updateMeta: CanvasKitCommandToken<"document.update-meta">;
|
|
5
|
+
}>;
|
|
6
|
+
session: Readonly<{
|
|
7
|
+
updateMeta: CanvasKitCommandToken<"session.update-meta">;
|
|
8
|
+
}>;
|
|
9
|
+
history: Readonly<{
|
|
10
|
+
clear: CanvasKitCommandToken<"history.clear">;
|
|
11
|
+
undo: CanvasKitCommandToken<"history.undo">;
|
|
12
|
+
redo: CanvasKitCommandToken<"history.redo">;
|
|
13
|
+
}>;
|
|
14
|
+
selection: Readonly<{
|
|
15
|
+
select: CanvasKitCommandToken<"selection.select">;
|
|
16
|
+
selectAll: CanvasKitCommandToken<"system.selection.select-all">;
|
|
17
|
+
delete: CanvasKitCommandToken<"system.selection.delete">;
|
|
18
|
+
duplicate: CanvasKitCommandToken<"system.selection.duplicate">;
|
|
19
|
+
resetRotation: CanvasKitCommandToken<"system.selection.reset-rotation">;
|
|
20
|
+
flipHorizontal: CanvasKitCommandToken<"system.selection.flip-horizontal">;
|
|
21
|
+
flipVertical: CanvasKitCommandToken<"system.selection.flip-vertical">;
|
|
22
|
+
setOpacity: CanvasKitCommandToken<"system.selection.set-opacity">;
|
|
23
|
+
align: CanvasKitCommandToken<"system.selection.align">;
|
|
24
|
+
distribute: CanvasKitCommandToken<"system.selection.distribute">;
|
|
25
|
+
}>;
|
|
26
|
+
shape: Readonly<{
|
|
27
|
+
delete: CanvasKitCommandToken<"shape.delete">;
|
|
28
|
+
update: CanvasKitCommandToken<"shape.update">;
|
|
29
|
+
updateMeta: CanvasKitCommandToken<"shape.update-meta">;
|
|
30
|
+
}>;
|
|
31
|
+
layer: Readonly<{
|
|
32
|
+
setHidden: CanvasKitCommandToken<"layer.set-hidden">;
|
|
33
|
+
setLocked: CanvasKitCommandToken<"layer.set-locked">;
|
|
34
|
+
group: CanvasKitCommandToken<"layer.group">;
|
|
35
|
+
ungroup: CanvasKitCommandToken<"layer.ungroup">;
|
|
36
|
+
sendBackward: CanvasKitCommandToken<"layer.send-backward">;
|
|
37
|
+
bringForward: CanvasKitCommandToken<"layer.bring-forward">;
|
|
38
|
+
sendToBack: CanvasKitCommandToken<"layer.send-to-back">;
|
|
39
|
+
bringToFront: CanvasKitCommandToken<"layer.bring-to-front">;
|
|
40
|
+
moveToPlacement: CanvasKitCommandToken<"layer.move-to-placement">;
|
|
41
|
+
}>;
|
|
42
|
+
tool: Readonly<{
|
|
43
|
+
setActive: CanvasKitCommandToken<"editor.tool.set-active-tool">;
|
|
44
|
+
toggleLocked: CanvasKitCommandToken<"editor.tool.toggle-locked">;
|
|
45
|
+
}>;
|
|
46
|
+
view: Readonly<{
|
|
47
|
+
centerOnShape: CanvasKitCommandToken<"view.center-on-shape">;
|
|
48
|
+
setCamera: CanvasKitCommandToken<"view.set-camera">;
|
|
49
|
+
zoomIn: CanvasKitCommandToken<"system.view.zoom-in">;
|
|
50
|
+
zoomOut: CanvasKitCommandToken<"system.view.zoom-out">;
|
|
51
|
+
resetZoom: CanvasKitCommandToken<"system.view.reset-zoom">;
|
|
52
|
+
reset: CanvasKitCommandToken<"view.reset">;
|
|
53
|
+
}>;
|
|
54
|
+
page: Readonly<{
|
|
55
|
+
create: CanvasKitCommandToken<"page.create">;
|
|
56
|
+
rename: CanvasKitCommandToken<"page.rename">;
|
|
57
|
+
updateMeta: CanvasKitCommandToken<"page.update-meta">;
|
|
58
|
+
delete: CanvasKitCommandToken<"page.delete">;
|
|
59
|
+
select: CanvasKitCommandToken<"page.select">;
|
|
60
|
+
}>;
|
|
61
|
+
}>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const updateDocumentMetaCommand: import("./command").CanvasKitCommand<[patch: Record<string, unknown>], void, "document.update-meta">;
|
|
2
|
+
export declare const updateSessionMetaCommand: import("./command").CanvasKitCommand<[patch: Record<string, unknown>], void, "session.update-meta">;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const clearHistoryCommand: import("./command").CanvasKitCommand<[], void, "history.clear">;
|
|
2
|
+
export declare const undoCommand: import("./command").CanvasKitCommand<[], boolean, "history.undo">;
|
|
3
|
+
export declare const redoCommand: import("./command").CanvasKitCommand<[], boolean, "history.redo">;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { CanvasKitCommand, CanvasKitCommandToken, ExecuteCanvasKitDefinedCommand, } from "./command";
|
|
2
|
+
export { CANVAS_KIT_COMMAND_TOKENS } from "./commandTokens";
|
|
3
|
+
export { updateDocumentMetaCommand, updateSessionMetaCommand, } from "./documentCommands";
|
|
4
|
+
export { clearHistoryCommand, redoCommand, undoCommand, } from "./historyCommands";
|
|
5
|
+
export { bringShapesForwardCommand, bringShapesToFrontCommand, groupShapesCommand, moveShapesToLayerPlacementCommand, sendShapesBackwardCommand, sendShapesToBackCommand, setShapesHiddenCommand, setShapesLockedCommand, ungroupShapesCommand, } from "./layerCommands";
|
|
6
|
+
export { createPageCommand, deletePageCommand, renamePageCommand, selectPageCommand, updatePageMetaCommand, } from "./pageCommands";
|
|
7
|
+
export { alignSelectionCommand, deleteSelectionCommand, distributeSelectionCommand, duplicateSelectionCommand, flipSelectionHorizontalCommand, flipSelectionVerticalCommand, resetSelectionRotationCommand, selectAllCommand, selectShapesCommand, setSelectionOpacityCommand, } from "./selectionCommands";
|
|
8
|
+
export type { CanvasSelectionAlignMode, CanvasSelectionDistributeAxis, } from "./selectionCommands";
|
|
9
|
+
export { deleteShapesCommand, updateShapeMetaCommand, updateShapesCommand, } from "./shapeCommands";
|
|
10
|
+
export { setActiveToolCommand, toggleToolLockedCommand, } from "./toolCommands";
|
|
11
|
+
export { centerOnShapeCommand, resetViewCommand, resetZoomCommand, setCameraCommand, zoomInCommand, zoomOutCommand, } from "./viewCommands";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ShapeId } from "../_vendor/canvas-core/index";
|
|
2
|
+
import type { CanvasProductLayerPlacement, CanvasProductLayerPlacementResult } from "../contracts/canvasProductControllerContracts";
|
|
3
|
+
export declare const setShapesHiddenCommand: import("./command").CanvasKitCommand<[input: {
|
|
4
|
+
ids: ShapeId[];
|
|
5
|
+
isHidden: boolean;
|
|
6
|
+
}], `shape:${string}`[], "layer.set-hidden">;
|
|
7
|
+
export declare const setShapesLockedCommand: import("./command").CanvasKitCommand<[input: {
|
|
8
|
+
ids: ShapeId[];
|
|
9
|
+
isLocked: boolean;
|
|
10
|
+
}], `shape:${string}`[], "layer.set-locked">;
|
|
11
|
+
export declare const groupShapesCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], `shape:${string}` | null, "layer.group">;
|
|
12
|
+
export declare const ungroupShapesCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], `shape:${string}`[], "layer.ungroup">;
|
|
13
|
+
export declare const sendShapesBackwardCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], boolean, "layer.send-backward">;
|
|
14
|
+
export declare const bringShapesForwardCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], boolean, "layer.bring-forward">;
|
|
15
|
+
export declare const sendShapesToBackCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], boolean, "layer.send-to-back">;
|
|
16
|
+
export declare const bringShapesToFrontCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], boolean, "layer.bring-to-front">;
|
|
17
|
+
export declare const moveShapesToLayerPlacementCommand: import("./command").CanvasKitCommand<[input: {
|
|
18
|
+
ids: ShapeId[];
|
|
19
|
+
placement: CanvasProductLayerPlacement;
|
|
20
|
+
}], CanvasProductLayerPlacementResult, "layer.move-to-placement">;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CanvasProductCreatePageInput } from "../contracts/canvasProductControllerContracts";
|
|
2
|
+
export declare const createPageCommand: import("./command").CanvasKitCommand<[input?: CanvasProductCreatePageInput | undefined], import("../_vendor/canvas-core/index").PageRecord, "page.create">;
|
|
3
|
+
export declare const renamePageCommand: import("./command").CanvasKitCommand<[input: {
|
|
4
|
+
pageId: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}], void, "page.rename">;
|
|
7
|
+
export declare const updatePageMetaCommand: import("./command").CanvasKitCommand<[input: {
|
|
8
|
+
pageId: string;
|
|
9
|
+
patch: Record<string, unknown>;
|
|
10
|
+
}], `page:${string}` | null, "page.update-meta">;
|
|
11
|
+
export declare const deletePageCommand: import("./command").CanvasKitCommand<[pageId: string], boolean, "page.delete">;
|
|
12
|
+
export declare const selectPageCommand: import("./command").CanvasKitCommand<[pageId: string], void, "page.select">;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type CanvasSelectionAlignMode = "left" | "horizontal-center" | "right" | "top" | "vertical-center" | "bottom";
|
|
2
|
+
export type CanvasSelectionDistributeAxis = "horizontal" | "vertical";
|
|
3
|
+
export declare const selectShapesCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], void, "selection.select">;
|
|
4
|
+
export declare const selectAllCommand: import("./command").CanvasKitCommand<[], void, "system.selection.select-all">;
|
|
5
|
+
export declare const deleteSelectionCommand: import("./command").CanvasKitCommand<[], void, "system.selection.delete">;
|
|
6
|
+
export declare const duplicateSelectionCommand: import("./command").CanvasKitCommand<[], `shape:${string}`[], "system.selection.duplicate">;
|
|
7
|
+
export declare const resetSelectionRotationCommand: import("./command").CanvasKitCommand<[], void, "system.selection.reset-rotation">;
|
|
8
|
+
export declare const flipSelectionHorizontalCommand: import("./command").CanvasKitCommand<[], void, "system.selection.flip-horizontal">;
|
|
9
|
+
export declare const flipSelectionVerticalCommand: import("./command").CanvasKitCommand<[], void, "system.selection.flip-vertical">;
|
|
10
|
+
export declare const setSelectionOpacityCommand: import("./command").CanvasKitCommand<[opacity: number], void, "system.selection.set-opacity">;
|
|
11
|
+
export declare const alignSelectionCommand: import("./command").CanvasKitCommand<[mode: CanvasSelectionAlignMode], boolean, "system.selection.align">;
|
|
12
|
+
export declare const distributeSelectionCommand: import("./command").CanvasKitCommand<[axis: CanvasSelectionDistributeAxis], boolean, "system.selection.distribute">;
|