@yuzhouu/canvas-kit 0.1.10 → 0.1.12
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 +95 -40
- package/_vendor/canvas-core/bindings/bindingUtil.d.ts +15 -0
- package/_vendor/canvas-core/bindings/terminalPorts.d.ts +67 -0
- package/_vendor/canvas-core/editor/bindingReactionScope.d.ts +7 -0
- package/_vendor/canvas-core/editor/commands.d.ts +3 -3
- package/_vendor/canvas-core/editor/editor.d.ts +20 -5
- package/_vendor/canvas-core/editor/editorComputedHelpers.d.ts +1 -0
- package/_vendor/canvas-core/editor/historyManager.d.ts +2 -5
- package/_vendor/canvas-core/editor/interactions.d.ts +33 -9
- package/_vendor/canvas-core/editor/managers/bindingManager.d.ts +1 -6
- package/_vendor/canvas-core/editor/managers/queryManager.d.ts +13 -0
- package/_vendor/canvas-core/editor/managers/selectionLayoutManager.d.ts +3 -0
- package/_vendor/canvas-core/editor/managers/selectionOverlayManager.d.ts +1 -0
- package/_vendor/canvas-core/editor/managers/shapeEditingManager.d.ts +4 -0
- package/_vendor/canvas-core/editor/managers/shapeHierarchyManager.d.ts +1 -0
- package/_vendor/canvas-core/editor/managers/snapCalculations.d.ts +4 -1
- package/_vendor/canvas-core/editor/managers/snapGeometry.d.ts +2 -1
- package/_vendor/canvas-core/editor/operationManager.d.ts +74 -0
- package/_vendor/canvas-core/editor/selectionOverlay.d.ts +3 -1
- package/_vendor/canvas-core/exports/svg.d.ts +2 -3
- package/_vendor/canvas-core/geometry/contentCutout.d.ts +8 -0
- package/_vendor/canvas-core/index.d.ts +9 -5
- package/_vendor/canvas-core/shapes/colors.d.ts +2 -1
- package/_vendor/canvas-core/shapes/shapeUtil.d.ts +47 -1
- package/_vendor/canvas-core/tools/select/selectToolHelpers.d.ts +9 -2
- package/_vendor/canvas-core/tools/select/states/{draggingSelectionHandleInteractionState.d.ts → draggingPluginInteractionState.d.ts} +5 -4
- package/_vendor/canvas-core/tools/select/states/index.d.ts +1 -1
- package/_vendor/canvas-core/tools/select/states/pointingSelectionHandleInteractionState.d.ts +2 -2
- package/_vendor/canvas-core/tools/select/states/pointingShapeState.d.ts +1 -1
- package/_vendor/canvas-core/tools/select/states/resizingState.d.ts +1 -1
- package/_vendor/canvas-core/tools/select/states/rotatingState.d.ts +1 -1
- package/_vendor/canvas-core/tools/select/states/selectStateNode.d.ts +6 -2
- package/_vendor/canvas-core/tools/select/states/translatingState.d.ts +1 -1
- package/_vendor/canvas-plugin-sdk/capability.d.ts +10 -0
- package/_vendor/canvas-plugin-sdk/index.d.ts +2 -6
- package/_vendor/canvas-plugin-sdk/plugin.d.ts +18 -28
- 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 +14 -3
- package/_vendor/canvas-product-contracts/capability.d.ts +8 -0
- package/_vendor/canvas-product-contracts/chrome.d.ts +53 -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-product-contracts/exports.d.ts +27 -0
- package/_vendor/canvas-product-contracts/importRegistry.d.ts +7 -0
- package/_vendor/canvas-product-contracts/imports.d.ts +39 -0
- package/_vendor/canvas-product-contracts/index.d.ts +15 -0
- package/_vendor/canvas-product-contracts/productApi.d.ts +29 -0
- package/_vendor/canvas-product-contracts/services.d.ts +21 -0
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/toolbar.d.ts +23 -4
- package/_vendor/canvas-product-contracts/toolbarRegistry.d.ts +9 -0
- package/_vendor/canvas-react/host/canvasRenderPlugin.d.ts +15 -4
- package/_vendor/canvas-react/host/index.d.ts +2 -2
- package/_vendor/plugin-arrow/api.d.ts +33 -0
- package/_vendor/plugin-arrow/arrowGeometry.d.ts +2 -1
- package/_vendor/plugin-arrow/arrowHeadGeometry.d.ts +8 -0
- package/_vendor/plugin-arrow/arrowShapeUtil.d.ts +2 -1
- package/_vendor/plugin-arrow/editorRuntime.d.ts +0 -2
- package/_vendor/plugin-arrow/feature.d.ts +2 -2
- package/_vendor/plugin-arrow/index.d.ts +4 -1
- package/_vendor/plugin-arrow/productRuntime.d.ts +2 -0
- package/_vendor/plugin-draw/DrawShapeRenderer.d.ts +5 -2
- package/_vendor/plugin-draw/drawPath.d.ts +7 -1
- package/_vendor/plugin-draw/editorRuntime.d.ts +1 -3
- package/_vendor/plugin-draw/feature.d.ts +2 -2
- package/_vendor/plugin-draw/index.d.ts +2 -1
- package/_vendor/plugin-draw/productRuntime.d.ts +2 -0
- package/_vendor/plugin-eraser/editorRuntime.d.ts +1 -3
- package/_vendor/plugin-eraser/feature.d.ts +2 -2
- package/_vendor/plugin-eraser/index.d.ts +2 -1
- package/_vendor/plugin-eraser/productRuntime.d.ts +2 -0
- package/_vendor/plugin-frame/api.d.ts +19 -0
- package/_vendor/plugin-frame/canvasRender.d.ts +3 -3
- package/_vendor/plugin-frame/editorRuntime.d.ts +0 -2
- package/_vendor/plugin-frame/feature.d.ts +2 -2
- package/_vendor/plugin-frame/frameShapeUtil.d.ts +8 -0
- package/_vendor/plugin-frame/index.d.ts +4 -1
- package/_vendor/plugin-frame/productRuntime.d.ts +2 -0
- package/_vendor/plugin-geo/api.d.ts +27 -0
- package/_vendor/plugin-geo/canvasRender.d.ts +3 -3
- package/_vendor/plugin-geo/editorRuntime.d.ts +1 -3
- package/_vendor/plugin-geo/feature.d.ts +2 -2
- package/_vendor/plugin-geo/geoStrokeStyle.d.ts +2 -0
- package/_vendor/plugin-geo/geoTools.d.ts +1 -1
- package/_vendor/plugin-geo/index.d.ts +7 -4
- package/_vendor/plugin-geo/productRuntime.d.ts +2 -0
- package/_vendor/plugin-geo/types.d.ts +5 -1
- package/_vendor/plugin-group/canvasRender.d.ts +1 -2
- package/_vendor/plugin-group/editorRuntime.d.ts +0 -2
- package/_vendor/plugin-group/feature.d.ts +2 -2
- package/_vendor/plugin-group/groupContributions.d.ts +1 -1
- package/_vendor/plugin-group/index.d.ts +2 -1
- package/_vendor/plugin-group/productRuntime.d.ts +2 -0
- package/_vendor/plugin-image/cropRuntime.d.ts +1 -1
- package/_vendor/plugin-image/editorRuntime.d.ts +0 -4
- package/_vendor/plugin-image/feature.d.ts +2 -2
- package/_vendor/plugin-image/imageHostActionContract.d.ts +1 -1
- package/_vendor/plugin-image/index.d.ts +2 -1
- package/_vendor/plugin-image/productRuntime.d.ts +4 -0
- 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 +6 -1
- package/_vendor/plugin-image/toolbarRuntime.d.ts +1 -1
- package/_vendor/plugin-laser/editorRuntime.d.ts +1 -3
- package/_vendor/plugin-laser/feature.d.ts +2 -2
- package/_vendor/plugin-laser/index.d.ts +2 -1
- package/_vendor/plugin-laser/productRuntime.d.ts +2 -0
- package/_vendor/plugin-path/PathShapeRenderer.d.ts +5 -2
- package/_vendor/plugin-path/editorRuntime.d.ts +1 -15
- package/_vendor/plugin-path/feature.d.ts +2 -2
- package/_vendor/plugin-path/index.d.ts +2 -1
- package/_vendor/plugin-path/pathHistory.d.ts +13 -0
- package/_vendor/plugin-path/pathShapeUtil.d.ts +3 -1
- package/_vendor/plugin-path/pathTool.d.ts +3 -0
- package/_vendor/plugin-path/productRuntime.d.ts +15 -0
- package/_vendor/plugin-runtime-clipboard/capability.d.ts +1 -0
- package/{features/clipboard/clipboardContribution.d.ts → _vendor/plugin-runtime-clipboard/clipboardActions.d.ts} +1 -7
- package/{features/clipboard → _vendor/plugin-runtime-clipboard}/clipboardService.d.ts +3 -3
- package/_vendor/plugin-runtime-clipboard/index.d.ts +4 -0
- package/_vendor/plugin-runtime-clipboard/plugin.d.ts +1 -0
- package/_vendor/plugin-runtime-export/blobDataUrl.d.ts +1 -0
- package/_vendor/plugin-runtime-export/canvasExportApi.d.ts +43 -0
- package/_vendor/plugin-runtime-export/index.d.ts +8 -0
- package/_vendor/plugin-runtime-export/plugin.d.ts +5 -0
- package/_vendor/plugin-runtime-export/pngExport.d.ts +15 -0
- package/{features/export → _vendor/plugin-runtime-export}/svgExport.d.ts +9 -2
- package/_vendor/plugin-text/api.d.ts +20 -0
- package/_vendor/plugin-text/capabilities.d.ts +2 -0
- package/_vendor/plugin-text/editorRuntime.d.ts +2 -8
- package/_vendor/plugin-text/feature.d.ts +1 -1
- package/_vendor/plugin-text/geoLabelBindingUtil.d.ts +0 -2
- package/_vendor/plugin-text/host/TiptapTextEditor.d.ts +1 -1
- package/_vendor/plugin-text/host/initialTextBackground.d.ts +2 -0
- package/_vendor/plugin-text/host/richTextRendering.d.ts +1 -1
- package/_vendor/plugin-text/host/textEditingBoxStyle.d.ts +1 -1
- package/_vendor/plugin-text/host/textEntryFocus.d.ts +2 -1
- package/_vendor/plugin-text/host/textMeasurement.d.ts +10 -2
- package/_vendor/plugin-text/index.d.ts +7 -3
- package/_vendor/plugin-text/pathLabelBindingUtil.d.ts +55 -0
- package/_vendor/plugin-text/productRuntime.d.ts +6 -0
- package/_vendor/plugin-text/richTextUtils.d.ts +3 -2
- package/_vendor/plugin-text/shapeWideTextFormatting.d.ts +4 -0
- package/_vendor/plugin-text/textFormatting.d.ts +2 -0
- package/_vendor/plugin-text/textLabelHelpers.d.ts +23 -2
- package/_vendor/plugin-text/textShapeUtil.d.ts +5 -2
- package/_vendor/plugin-text/textTypes.d.ts +1 -0
- package/_vendor/signals/core.d.ts +1 -0
- package/_vendor/signals/index.d.ts +1 -1
- package/_vendor/store/history.d.ts +1 -1
- package/_vendor/store/store.d.ts +2 -0
- package/browser/indexedDb.d.ts +10 -10
- package/browser/persistence.d.ts +4 -25
- package/chrome/floating/useCanvasKitFloatingPosition.d.ts +1 -1
- package/chrome/toolbar/FloatingSelectionToolbarPageSpace.d.ts +5 -3
- package/chrome/toolbar/mergeToolbarGroups.d.ts +8 -0
- package/chrome/toolbar/toolbarLabels.d.ts +1 -1
- package/chrome/toolbar/useToolbarSurfaces.d.ts +9 -10
- package/chrome/types.d.ts +12 -9
- package/chrome/useCanvasKitChromeContext.d.ts +4 -7
- package/chrome/useChromeSurfaces.d.ts +12 -0
- package/chrome/useContextMenuSurface.d.ts +1 -1
- package/controller/canvasKitController.d.ts +4 -11
- package/core/index.d.ts +3 -4
- package/core/product-controller/canvasProductController.d.ts +40 -11
- package/core/product-controller/index.d.ts +1 -1
- package/core/runtime/productServices.d.ts +5 -19
- package/core/runtime/runtimeContracts.d.ts +3 -3
- package/features/context-menu/contextMenuRuntime.d.ts +1 -1
- package/features/image/asset/imageAssetService.d.ts +2 -3
- package/features/image/asset/imageBlobStore.d.ts +1 -0
- package/features/image/asset/imageFileHelpers.d.ts +0 -6
- package/features/image/asset/svgImageAssetInliner.d.ts +1 -1
- package/features/image/controller/imageProductController.d.ts +2 -2
- package/features/image/imageHostPlugin.d.ts +1 -0
- package/features/image/import/ImageImportController.d.ts +3 -1
- package/features/image/index.d.ts +1 -3
- package/features/image/smudge/imageSmudgeHostActions.d.ts +1 -1
- package/features/image/toolbar/imageHostActions.d.ts +8 -9
- package/features/image/toolbar/imageToolbarHostBridge.d.ts +1 -1
- package/features/text/{textProductPlugin.d.ts → textHostPlugin.d.ts} +1 -1
- package/features/text/textSvgAssetInliner.d.ts +3 -0
- package/features/text/textSvgAssetPlugin.d.ts +2 -0
- package/index.css +1 -1
- package/index.d.ts +31 -19
- package/index.mjs +88 -84
- package/package.json +2 -2
- package/plugins/runtime/import-host/CanvasImportHost.d.ts +4 -0
- package/plugins/runtime/import-host/capability.d.ts +1 -0
- package/plugins/runtime/import-host/index.d.ts +2 -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 +8 -0
- package/plugins/runtime/tool-actions/capability.d.ts +1 -0
- package/plugins/runtime/tool-actions/index.d.ts +2 -0
- 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/standard/createStandardCanvasKitPlugins.d.ts +15 -0
- package/{features/selection/selectionActions.d.ts → plugins/standard/selection/actions.d.ts} +4 -2
- 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/{features/view/viewActions.d.ts → plugins/standard/view/actions.d.ts} +1 -1
- 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/{features/actions/actionRuntime.d.ts → runtime/canvasKitActionContext.d.ts} +3 -2
- package/runtime/canvasKitCommandExecutor.d.ts +1 -1
- package/runtime/canvasKitPluginContracts.d.ts +29 -76
- package/runtime/canvasKitPluginLifecycle.d.ts +32 -0
- package/runtime/canvasKitPluginSetup.d.ts +34 -0
- package/runtime/canvasKitPluginUi.d.ts +35 -0
- package/runtime/canvasKitResourceScope.d.ts +5 -0
- package/runtime/canvasKitRuntime.d.ts +9 -7
- package/runtime/canvasKitRuntimeContracts.d.ts +2 -5
- package/runtime/canvasPluginGraph.d.ts +15 -0
- package/runtime/persistenceCoordinator.d.ts +33 -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/contextMenuRegistry.d.ts +0 -11
- package/_vendor/canvas-plugin-sdk/toolbarRegistry.d.ts +0 -19
- 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 -17
- 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/_vendor/plugin-text/arrowLabelBindingUtil.d.ts +0 -47
- package/builtins/controller/createBuiltInCanvasController.d.ts +0 -18
- package/builtins/controller/layerController.d.ts +0 -9
- package/builtins/controller/packagingController.d.ts +0 -71
- package/builtins/controller/shapeCreationController.d.ts +0 -83
- package/builtins/index.d.ts +0 -7
- package/builtins/plugins.d.ts +0 -16
- package/chrome/useSvgExport.d.ts +0 -15
- package/core/api/apiRegistry.d.ts +0 -12
- package/es-DocrZgUh.mjs +0 -2
- package/features/clipboard/clipboardContextMenuContributions.d.ts +0 -2
- package/features/clipboard/clipboardPlugin.d.ts +0 -1
- package/features/image/imageProductPlugin.d.ts +0 -1
- package/features/image/import/useImageImport.d.ts +0 -16
- package/features/keyboard/keyboardShortcutPlugin.d.ts +0 -1
- package/features/keyboard/useCanvasKitKeyboardShortcuts.d.ts +0 -8
- package/features/selection/selectionContextMenuContributions.d.ts +0 -2
- package/features/selection/selectionPlugin.d.ts +0 -1
- package/features/selection/selectionToolbarContributions.d.ts +0 -2
- package/features/tool/toolActions.d.ts +0 -2
- package/features/tool/toolContextMenuContributions.d.ts +0 -2
- package/features/tool/toolPlugin.d.ts +0 -1
- package/features/tool/toolToolbarContributions.d.ts +0 -2
- package/features/view/viewContextMenuContributions.d.ts +0 -2
- package/features/view/viewPlugin.d.ts +0 -1
- package/product/standardCanvasKitPlugins.d.ts +0 -4
- package/runtime/canvasKitPlugins.d.ts +0 -33
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { type CanvasActionContext, type CanvasToolbarRegistry, type ToolbarGroup } 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;
|
|
5
|
+
channels: readonly ToolbarChannel[];
|
|
6
|
+
getGroups(channel: ToolbarChannel): readonly ToolbarGroup[];
|
|
7
|
+
isSurfaceActive(surface: ToolbarSurface): boolean;
|
|
5
8
|
activeToolId: string;
|
|
6
9
|
activeToolLabel: string;
|
|
7
10
|
isToolLocked: boolean;
|
|
11
|
+
isEditing: boolean;
|
|
12
|
+
canShowPropertiesDuringEditing: boolean;
|
|
8
13
|
selectionCount: number;
|
|
9
14
|
hasMixedSelectionRotation: boolean;
|
|
10
|
-
|
|
11
|
-
toolFloatingToolbarGroups: readonly ToolbarGroup[];
|
|
12
|
-
contextToolbarGroups: readonly ToolbarGroup[];
|
|
13
|
-
floatingSelectionToolbarGroups: readonly ToolbarGroup[];
|
|
14
|
-
contextToolbarTitle: string;
|
|
15
|
-
showContextToolbar: boolean;
|
|
16
|
-
canShowFloatingSelectionToolbar: boolean;
|
|
15
|
+
selectionLabel: string;
|
|
17
16
|
}
|
|
18
|
-
export declare function useToolbarSurfaces({
|
|
19
|
-
|
|
17
|
+
export declare function useToolbarSurfaces({ canShowPropertiesDuringEditing, editor, toolbarRegistry, }: {
|
|
18
|
+
canShowPropertiesDuringEditing?: (context: CanvasActionContext) => boolean;
|
|
20
19
|
editor: Editor;
|
|
21
20
|
toolbarRegistry: CanvasToolbarRegistry;
|
|
22
21
|
}): ToolbarSurfaces;
|
package/chrome/types.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { type ActiveContextMenu, type CanvasActionContext, type CanvasActionValue } from "../_vendor/canvas-
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import { type ActiveContextMenu, type CanvasActionContext, type CanvasActionValue } from "../_vendor/canvas-product-contracts/index";
|
|
2
|
+
import type { CanvasKitBaseController, CanvasKitController } from "../controller/canvasKitController";
|
|
3
|
+
import type { CanvasProductLayerNode } from "../core";
|
|
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 {
|
|
9
|
+
import type { CanvasExportApi } from "../_vendor/plugin-runtime-export/index";
|
|
10
10
|
import type { ToolbarSurfaces } from "./toolbar/useToolbarSurfaces";
|
|
11
|
+
import type { ChromeSurfaces } from "./useChromeSurfaces";
|
|
11
12
|
export type { EditorSelectionMetadata, EditorSelectionState, ShapeId, } from "../_vendor/canvas-core/index";
|
|
12
|
-
export type { CanvasActionContext, CanvasActionValue, 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";
|
|
13
14
|
export type { HistoryControls } from "./useHistoryControls";
|
|
14
15
|
export type { PageControls } from "./usePageControls";
|
|
15
16
|
export type { ZoomControlsState } from "./useZoomControls";
|
|
16
17
|
export type { ContextMenuSurface } from "./useContextMenuSurface";
|
|
17
|
-
export type { SvgExportControls, } from "./useSvgExport";
|
|
18
18
|
export type { ToolbarSurfaces, } from "./toolbar/useToolbarSurfaces";
|
|
19
|
-
export type
|
|
19
|
+
export type { ChromeSurfaces } from "./useChromeSurfaces";
|
|
20
|
+
export type CanvasKitLayerNode = CanvasProductLayerNode;
|
|
20
21
|
export interface CanvasKitToolbarActionState {
|
|
21
22
|
value: CanvasActionValue | undefined;
|
|
22
23
|
isEnabled: boolean;
|
|
@@ -38,20 +39,22 @@ export interface CanvasKitGridControls {
|
|
|
38
39
|
setIsVisible(isVisible: boolean): void;
|
|
39
40
|
}
|
|
40
41
|
export interface CanvasKitLayerTreeSource {
|
|
41
|
-
getSnapshot(pageId?: string): readonly
|
|
42
|
+
getSnapshot(pageId?: string): readonly CanvasProductLayerNode[];
|
|
42
43
|
subscribe(onStoreChange: () => void): () => void;
|
|
43
44
|
}
|
|
44
45
|
export interface CanvasKitChromeContext<TController extends CanvasKitBaseController = CanvasKitController> {
|
|
45
46
|
controller: TController;
|
|
47
|
+
chromeSurfaces: ChromeSurfaces;
|
|
46
48
|
contextMenu: CanvasKitContextMenuState;
|
|
47
49
|
currentPageId: string;
|
|
48
50
|
currentPageShapeIds: readonly ShapeId[];
|
|
51
|
+
sessionMeta: Readonly<Record<string, unknown>>;
|
|
49
52
|
history: HistoryControls;
|
|
50
53
|
layerTree: CanvasKitLayerTreeSource;
|
|
51
54
|
pages: PageControls;
|
|
52
55
|
selection: EditorSelectionMetadata;
|
|
53
56
|
selectedShapeIds: readonly ShapeId[];
|
|
54
|
-
|
|
57
|
+
exportApi: CanvasExportApi;
|
|
55
58
|
toolbarRuntime: CanvasKitToolbarRuntime;
|
|
56
59
|
toolbarSurfaces: ToolbarSurfaces;
|
|
57
60
|
grid: CanvasKitGridControls;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type RefObject } from "react";
|
|
1
|
+
import { type ActiveContextMenu, type CanvasActionContext, type CanvasActionRegistry, type CanvasChromeRegistry, type CanvasContextMenuRegistry, type CanvasToolbarRegistry } from "../_vendor/canvas-product-contracts/index";
|
|
3
2
|
import { type Editor } from "../_vendor/canvas-core/index";
|
|
4
3
|
import type { CanvasKitBaseController } from "../controller/canvasKitController";
|
|
5
|
-
import type { SvgAssetInliner } from "../features/export/svgExport";
|
|
6
4
|
import type { ExecuteCanvasKitCommand } from "../runtime/canvasKitCommandExecutor";
|
|
7
5
|
import type { CanvasKitChromeContext, CanvasKitGridControls } from "./types";
|
|
8
|
-
export declare function useCanvasKitChromeContext<TController extends CanvasKitBaseController>({ controller, activeContextMenu, grid, onActiveContextMenuChange, actionRegistry,
|
|
6
|
+
export declare function useCanvasKitChromeContext<TController extends CanvasKitBaseController>({ controller, activeContextMenu, grid, onActiveContextMenuChange, actionRegistry, canShowPropertiesDuringEditing, chromeRegistry, contextMenuRegistry, editor, executeCommand, toolbarRegistry, }: {
|
|
9
7
|
controller: TController;
|
|
10
8
|
activeContextMenu: ActiveContextMenu | null;
|
|
11
9
|
grid: CanvasKitGridControls;
|
|
12
10
|
onActiveContextMenuChange: (activeContextMenu: ActiveContextMenu | null) => void;
|
|
13
11
|
actionRegistry: CanvasActionRegistry;
|
|
14
|
-
|
|
12
|
+
canShowPropertiesDuringEditing(context: CanvasActionContext): boolean;
|
|
13
|
+
chromeRegistry: CanvasChromeRegistry;
|
|
15
14
|
contextMenuRegistry: CanvasContextMenuRegistry;
|
|
16
15
|
editor: Editor;
|
|
17
16
|
executeCommand: ExecuteCanvasKitCommand;
|
|
18
|
-
svgAssetInliners: readonly SvgAssetInliner[];
|
|
19
|
-
themeRootRef: RefObject<HTMLElement | null>;
|
|
20
17
|
toolbarRegistry: CanvasToolbarRegistry;
|
|
21
18
|
}): CanvasKitChromeContext<TController>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type CanvasActionContext, type CanvasChromeRegistry, type ChromeChannel, type ChromeSection } from "../_vendor/canvas-product-contracts/index";
|
|
2
|
+
import type { Editor } from "../_vendor/canvas-core/index";
|
|
3
|
+
export interface ChromeSurfaces {
|
|
4
|
+
context: CanvasActionContext;
|
|
5
|
+
channels: readonly ChromeChannel[];
|
|
6
|
+
getSections(channel: ChromeChannel): readonly ChromeSection[];
|
|
7
|
+
}
|
|
8
|
+
export declare function useChromeSurfaces({ context, editor, registry, }: {
|
|
9
|
+
context: CanvasActionContext;
|
|
10
|
+
editor: Editor;
|
|
11
|
+
registry: CanvasChromeRegistry;
|
|
12
|
+
}): ChromeSurfaces;
|
|
@@ -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,20 +1,13 @@
|
|
|
1
|
-
import { type CanvasProductController, type CanvasProductControllerContext, type CanvasProductSessionSnapshot } from "../core/product-controller";
|
|
2
|
-
import { type BuiltInCanvasController, type BuiltInCanvasControllerSnapshot, type BuiltInCanvasFrameInput, type BuiltInCanvasRectangleInput, type BuiltInCanvasShapeInput, type BuiltInCanvasTextInput, type CanvasKitPackagingDxfImportInput, type CanvasKitPackagingInput } from "../builtins";
|
|
3
|
-
export type CanvasKitShapeInput = BuiltInCanvasShapeInput;
|
|
4
|
-
export type CanvasKitRectangleInput = BuiltInCanvasRectangleInput;
|
|
5
|
-
export type CanvasKitTextInput = BuiltInCanvasTextInput;
|
|
6
|
-
export type CanvasKitFrameInput = BuiltInCanvasFrameInput;
|
|
7
|
-
export type { CanvasKitPackagingInput };
|
|
8
|
-
export type { CanvasKitPackagingDxfImportInput };
|
|
1
|
+
import { type CanvasProductController, type CanvasProductControllerSnapshot, type CanvasProductControllerContext, type CanvasProductSessionSnapshot } from "../core/product-controller";
|
|
9
2
|
export interface CanvasKitBaseController<TToolId extends string = string> extends CanvasProductController<TToolId> {
|
|
10
3
|
}
|
|
11
|
-
export declare const CANVAS_KIT_TOOL_IDS: readonly ["select", "hand", "rectangle", "ellipse", "
|
|
4
|
+
export declare const CANVAS_KIT_TOOL_IDS: readonly ["select", "hand", "rectangle", "ellipse", "rhombus", "triangle", "hexagon", "star", "arrow", "draw", "path", "text", "frame", "eraser", "laser"];
|
|
12
5
|
export type CanvasKitToolId = (typeof CANVAS_KIT_TOOL_IDS)[number];
|
|
13
|
-
export interface CanvasKitControllerSnapshot<TToolId extends string = CanvasKitToolId> extends
|
|
6
|
+
export interface CanvasKitControllerSnapshot<TToolId extends string = CanvasKitToolId> extends CanvasProductControllerSnapshot<TToolId> {
|
|
14
7
|
productId: string;
|
|
15
8
|
session: CanvasProductSessionSnapshot<TToolId>;
|
|
16
9
|
}
|
|
17
|
-
export interface CanvasKitController<TToolId extends string = CanvasKitToolId> extends
|
|
10
|
+
export interface CanvasKitController<TToolId extends string = CanvasKitToolId> extends CanvasKitBaseController<TToolId> {
|
|
18
11
|
snapshot(): CanvasKitControllerSnapshot<TToolId>;
|
|
19
12
|
}
|
|
20
13
|
export interface CanvasKitControllerRuntimeContext extends CanvasProductControllerContext {
|
package/core/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export { createDefaultCanvasProductEditor } from "./runtime/productEditor";
|
|
2
|
+
export { createCanvasProductController } from "./product-controller";
|
|
2
3
|
export { cleanupProductAssetsAfterRestore, preloadProductAssets, resolveProductAssetUrl, } from "./runtime/productAssets";
|
|
3
|
-
export { createProductApiRegistry, createProductApiToken, } from "./api/apiRegistry";
|
|
4
4
|
export { createProductServiceRegistry, createProductServiceToken, requireProductService, } from "./runtime/productServices";
|
|
5
5
|
export type { CreateCanvasProductEditorOptions, ProductPersistenceAdapter, ProductPersistenceLoadResult, } from "./runtime/runtimeContracts";
|
|
6
|
-
export type { ProductAssetResolverService, ProductServiceFactory, ProductServiceFactoryContext, ProductServiceRegistry, ProductServiceRegistryRuntime, ProductServiceToken, } from "./runtime/productServices";
|
|
7
|
-
export type {
|
|
8
|
-
export type { CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductCreatePageInput, CanvasProductDocumentRef, CanvasProductShapeData, CanvasProductShapeUpdate, } from "./product-controller";
|
|
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,10 +1,6 @@
|
|
|
1
|
-
import type { Camera, ChangeSource, Editor, LayerOrderDirection, LayerOrderEdge, ReparentShapePlacementFailureReason, ShapeId } from "../../_vendor/canvas-core/index";
|
|
1
|
+
import type { AssetId, Camera, ChangeSource, Editor, LayerOrderDirection, LayerOrderEdge, ReparentShapePlacementFailureReason, ShapeId } from "../../_vendor/canvas-core/index";
|
|
2
|
+
import { type ProductApiRegistry } from "../../_vendor/canvas-product-contracts/index";
|
|
2
3
|
import type { ProductServiceRegistry } from "../runtime/productServices";
|
|
3
|
-
import type { ProductApiRegistry } from "../api/apiRegistry";
|
|
4
|
-
export interface CanvasProductShapeRef {
|
|
5
|
-
id: ShapeId;
|
|
6
|
-
type: string;
|
|
7
|
-
}
|
|
8
4
|
export interface CanvasProductShapeData {
|
|
9
5
|
id: ShapeId;
|
|
10
6
|
type: string;
|
|
@@ -23,6 +19,12 @@ export interface CanvasProductShapeData {
|
|
|
23
19
|
props: Record<string, unknown>;
|
|
24
20
|
meta: Record<string, unknown>;
|
|
25
21
|
}
|
|
22
|
+
export interface CanvasProductAssetData {
|
|
23
|
+
id: AssetId;
|
|
24
|
+
type: string;
|
|
25
|
+
props: Record<string, unknown>;
|
|
26
|
+
meta: Record<string, unknown>;
|
|
27
|
+
}
|
|
26
28
|
export interface CanvasProductShapeUpdate {
|
|
27
29
|
id: ShapeId;
|
|
28
30
|
x?: number;
|
|
@@ -52,6 +54,7 @@ export interface CanvasProductSessionSnapshot<TToolId extends string = string> {
|
|
|
52
54
|
currentPageId: string;
|
|
53
55
|
activeToolId: TToolId;
|
|
54
56
|
isToolLocked: boolean;
|
|
57
|
+
meta: Record<string, unknown>;
|
|
55
58
|
pages: CanvasProductSessionPageState[];
|
|
56
59
|
}
|
|
57
60
|
export interface CanvasProductDocumentRef {
|
|
@@ -68,13 +71,39 @@ export interface CanvasProductControllerSnapshot<TToolId extends string = string
|
|
|
68
71
|
session: CanvasProductSessionSnapshot<TToolId>;
|
|
69
72
|
}
|
|
70
73
|
export type CanvasProductControllerChangeKey = "document" | "session" | "pageId" | "activeToolId" | "selectedShapeIds" | "shapeCount";
|
|
71
|
-
export interface
|
|
74
|
+
export interface CanvasProductRealtimeChange<TToolId extends string = string> {
|
|
75
|
+
delivery: "realtime";
|
|
72
76
|
source: ChangeSource;
|
|
73
77
|
changes: readonly CanvasProductControllerChangeKey[];
|
|
74
78
|
snapshot: CanvasProductControllerSnapshot<TToolId>;
|
|
75
79
|
previousSnapshot: CanvasProductControllerSnapshot<TToolId>;
|
|
76
80
|
}
|
|
81
|
+
export interface CanvasProductCommittedChange<TToolId extends string = string> {
|
|
82
|
+
delivery: "committed";
|
|
83
|
+
source: ChangeSource;
|
|
84
|
+
commit: {
|
|
85
|
+
id: string;
|
|
86
|
+
revision: number;
|
|
87
|
+
kind: string;
|
|
88
|
+
label: string;
|
|
89
|
+
};
|
|
90
|
+
changes: readonly CanvasProductControllerChangeKey[];
|
|
91
|
+
affectedShapeIds: {
|
|
92
|
+
added: readonly ShapeId[];
|
|
93
|
+
updated: readonly ShapeId[];
|
|
94
|
+
removed: readonly ShapeId[];
|
|
95
|
+
};
|
|
96
|
+
snapshot: CanvasProductControllerSnapshot<TToolId>;
|
|
97
|
+
}
|
|
98
|
+
export type CanvasProductControllerChange<TToolId extends string = string> = CanvasProductRealtimeChange<TToolId> | CanvasProductCommittedChange<TToolId>;
|
|
77
99
|
export type CanvasProductControllerChangeListener<TToolId extends string = string> = (change: CanvasProductControllerChange<TToolId>) => void;
|
|
100
|
+
export type CanvasProductSubscriptionOptions = {
|
|
101
|
+
delivery?: "realtime";
|
|
102
|
+
scope?: "all" | "document" | "session";
|
|
103
|
+
} | {
|
|
104
|
+
delivery: "committed";
|
|
105
|
+
scope: "document";
|
|
106
|
+
};
|
|
78
107
|
export interface CanvasProductLayerNode {
|
|
79
108
|
id: ShapeId;
|
|
80
109
|
parentId: string;
|
|
@@ -83,7 +112,6 @@ export interface CanvasProductLayerNode {
|
|
|
83
112
|
childIds: ShapeId[];
|
|
84
113
|
siblingIndex: number;
|
|
85
114
|
depth: number;
|
|
86
|
-
displayName: string;
|
|
87
115
|
canReceiveChildren: boolean;
|
|
88
116
|
isHidden: boolean;
|
|
89
117
|
isLocked: boolean;
|
|
@@ -121,7 +149,7 @@ export interface CanvasProductCreatePageInput {
|
|
|
121
149
|
export interface CanvasProductController<TToolId extends string = string> {
|
|
122
150
|
apis: ProductApiRegistry;
|
|
123
151
|
snapshot(): CanvasProductControllerSnapshot<TToolId>;
|
|
124
|
-
subscribe(listener: CanvasProductControllerChangeListener<TToolId
|
|
152
|
+
subscribe(listener: CanvasProductControllerChangeListener<TToolId>, options?: CanvasProductSubscriptionOptions): () => void;
|
|
125
153
|
clearHistory(): void;
|
|
126
154
|
canUndo(): boolean;
|
|
127
155
|
canRedo(): boolean;
|
|
@@ -129,10 +157,13 @@ export interface CanvasProductController<TToolId extends string = string> {
|
|
|
129
157
|
redo(): boolean;
|
|
130
158
|
getDocument(): CanvasProductDocumentRef;
|
|
131
159
|
updateDocumentMeta(patch: Record<string, unknown>): CanvasProductDocumentRef;
|
|
160
|
+
updateSessionMeta(patch: Record<string, unknown>): CanvasProductSessionSnapshot<TToolId>;
|
|
132
161
|
select(ids: ShapeId[]): void;
|
|
133
162
|
selectAll(): void;
|
|
134
163
|
deleteSelection(): void;
|
|
135
164
|
deleteShapes(ids: ShapeId[]): void;
|
|
165
|
+
getAsset(id: AssetId): CanvasProductAssetData | null;
|
|
166
|
+
resolveAssetUrl(id: AssetId): string | null;
|
|
136
167
|
getShape(id: ShapeId): CanvasProductShapeData | null;
|
|
137
168
|
getShapes(ids?: ShapeId[]): CanvasProductShapeData[];
|
|
138
169
|
updateShapes(updates: CanvasProductShapeUpdate[]): ShapeId[];
|
|
@@ -158,8 +189,6 @@ export interface CanvasProductController<TToolId extends string = string> {
|
|
|
158
189
|
updatePageMeta(pageId: string, patch: Record<string, unknown>): string | null;
|
|
159
190
|
deletePage(pageId: string): boolean;
|
|
160
191
|
selectPage(pageId: string): void;
|
|
161
|
-
exportSelectionSvg(): string | null;
|
|
162
|
-
exportPageSvg(): string | null;
|
|
163
192
|
}
|
|
164
193
|
export interface CanvasProductControllerContext {
|
|
165
194
|
editor: Editor;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { createCanvasProductController } from "./canvasProductController";
|
|
2
|
-
export type { CanvasProductController, CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductControllerContext, CanvasProductControllerOptions, CanvasProductControllerSnapshot, CanvasProductCreatePageInput, CanvasProductDocumentRef, CanvasProductLayerActionState, CanvasProductLayerNode, CanvasProductLayerPlacement, CanvasProductLayerPlacementFailureReason, CanvasProductLayerPlacementResult, CanvasProductPageRef, CanvasProductShapeData, CanvasProductSessionPageState, CanvasProductSessionSnapshot,
|
|
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 +1,8 @@
|
|
|
1
1
|
import type { AssetId, Editor } from "../../_vendor/canvas-core/index";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export interface ProductServiceFactoryContext {
|
|
7
|
-
productId: string;
|
|
8
|
-
}
|
|
9
|
-
export interface ProductServiceFactory<TService> {
|
|
10
|
-
token: ProductServiceToken<TService>;
|
|
11
|
-
create(context: ProductServiceFactoryContext): TService;
|
|
12
|
-
dispose?(service: TService): void;
|
|
13
|
-
}
|
|
14
|
-
export interface ProductServiceRegistry {
|
|
15
|
-
get<TService>(token: ProductServiceToken<TService>): TService | null;
|
|
16
|
-
}
|
|
17
|
-
export interface ProductServiceRegistryRuntime extends ProductServiceRegistry {
|
|
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 {
|
|
18
6
|
dispose(): void;
|
|
19
7
|
}
|
|
20
8
|
export interface ProductAssetResolverService {
|
|
@@ -26,9 +14,7 @@ export interface ProductAssetResolverService {
|
|
|
26
14
|
signal: AbortSignal;
|
|
27
15
|
}): Promise<void> | void;
|
|
28
16
|
}
|
|
29
|
-
export declare function createProductServiceToken<TService>(id: string): ProductServiceToken<TService>;
|
|
30
17
|
export declare function createProductServiceRegistry({ factories, productId, }: {
|
|
31
|
-
factories
|
|
18
|
+
factories?: readonly ProductServiceFactory<unknown>[];
|
|
32
19
|
productId: string;
|
|
33
20
|
}): ProductServiceRegistryRuntime;
|
|
34
|
-
export declare function requireProductService<TService>(services: ProductServiceRegistry, token: ProductServiceToken<TService>): TService;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssetId,
|
|
1
|
+
import type { AssetId, DocumentSnapshot, EditorPlugin, SessionSnapshot } from "../../_vendor/canvas-core/index";
|
|
2
2
|
export interface ProductPersistenceLoadResult {
|
|
3
3
|
documentSnapshot: unknown | null;
|
|
4
4
|
sessionSnapshot: unknown | null;
|
|
@@ -7,8 +7,8 @@ export interface ProductPersistenceAdapter {
|
|
|
7
7
|
load?(options: {
|
|
8
8
|
signal: AbortSignal;
|
|
9
9
|
}): Promise<ProductPersistenceLoadResult>;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
saveDocument?(snapshot: DocumentSnapshot): Promise<void>;
|
|
11
|
+
saveSession?(snapshot: SessionSnapshot): Promise<void>;
|
|
12
12
|
}
|
|
13
13
|
export interface CreateCanvasProductEditorOptions {
|
|
14
14
|
editorPlugins: readonly EditorPlugin[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CanvasActionValue, type CanvasActionRegistry, type ContextMenuContext, type ContextMenuContributionTarget, type ContextMenuTarget } from "../../_vendor/canvas-
|
|
1
|
+
import { type CanvasActionValue, type CanvasActionRegistry, type ContextMenuContext, type ContextMenuContributionTarget, type ContextMenuTarget } from "../../_vendor/canvas-product-contracts/index";
|
|
2
2
|
import type { Editor } from "../../_vendor/canvas-core/index";
|
|
3
3
|
export declare function createContextMenuContext({ editor, menu, }: {
|
|
4
4
|
editor: Editor;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { Editor } from "../../../_vendor/canvas-core/index";
|
|
2
1
|
import { type ProductAssetResolverService, type ProductServiceFactory } from "../../../core";
|
|
3
2
|
import { type ImageObjectUrlStore } from "./imageBlobStore";
|
|
4
3
|
export interface ImageAssetService extends ProductAssetResolverService {
|
|
5
4
|
objectUrls: ImageObjectUrlStore;
|
|
6
5
|
}
|
|
7
6
|
export interface ImageAssetServiceOptions {
|
|
8
|
-
flushSnapshot?: (
|
|
7
|
+
flushSnapshot?: () => Promise<void>;
|
|
9
8
|
}
|
|
10
|
-
export declare const imageAssetServiceToken: import("
|
|
9
|
+
export declare const imageAssetServiceToken: import("../../../_vendor/canvas-product-contracts/index").ProductServiceToken<ImageAssetService>;
|
|
11
10
|
export declare function localImageAssetService({ flushSnapshot, }?: ImageAssetServiceOptions): ProductServiceFactory<ImageAssetService>;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type { Editor } from "../../../_vendor/canvas-core/index";
|
|
2
|
-
import { isEditableEventTarget } from "../../../_vendor/canvas-react/index";
|
|
3
1
|
import type { ImageAssetSource } from "../../../_vendor/plugin-image/index";
|
|
4
|
-
export { isEditableEventTarget };
|
|
5
2
|
export interface PreparedImageAssetInput {
|
|
6
3
|
name: string;
|
|
7
4
|
source: ImageAssetSource;
|
|
@@ -35,9 +32,6 @@ export declare function fitImageSize({ height, width, }: {
|
|
|
35
32
|
h: number;
|
|
36
33
|
};
|
|
37
34
|
export declare function getFirstImageFile(files: Iterable<File>): File | null;
|
|
38
|
-
export declare function getFirstImageFileFromDataTransfer(dataTransfer: DataTransfer | null): File | null;
|
|
39
|
-
export declare function hasImageFileItem(dataTransfer: DataTransfer | null): boolean;
|
|
40
|
-
export declare function getDropPagePoint(editor: Editor, event: DragEvent): import("../../../_vendor/canvas-core/index").Vec;
|
|
41
35
|
export declare function downloadObjectUrl({ filename, url, }: {
|
|
42
36
|
filename: string;
|
|
43
37
|
url: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type
|
|
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;
|
|
@@ -17,9 +17,9 @@ export interface ImageProductController {
|
|
|
17
17
|
downloadSelectedImageOriginal(): Promise<void>;
|
|
18
18
|
smudge: ImageSmudgeController;
|
|
19
19
|
}
|
|
20
|
-
export declare const imageProductControllerToken: import("
|
|
20
|
+
export declare const imageProductControllerToken: import("../../../_vendor/canvas-product-contracts/index").ProductApiToken<ImageProductController>;
|
|
21
21
|
export interface ImageProductControllerRuntimeOptions {
|
|
22
|
-
flushSnapshot?: (
|
|
22
|
+
flushSnapshot?: () => Promise<void>;
|
|
23
23
|
}
|
|
24
24
|
export declare function createImageProductController({ editor, flushSnapshot, services, }: ImageProductControllerRuntimeOptions & {
|
|
25
25
|
editor: Editor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ImageHostPlugin: import("../..").CanvasPlugin;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Editor } from "../../../_vendor/canvas-core/index";
|
|
2
|
+
import { type CanvasImportRegistry } from "../../../_vendor/canvas-product-contracts/index";
|
|
2
3
|
import type { ImageAssetService } from "../asset/imageAssetService";
|
|
3
4
|
import type { ImageToolbarHostBridge } from "../toolbar/imageToolbarHostBridge";
|
|
4
5
|
export declare const ImageImportController: import("react").NamedExoticComponent<{
|
|
5
6
|
editor: Editor;
|
|
6
7
|
hostBridge?: ImageToolbarHostBridge;
|
|
7
8
|
imageAssetService: ImageAssetService;
|
|
8
|
-
|
|
9
|
+
imports: CanvasImportRegistry;
|
|
10
|
+
flushSnapshot?: () => Promise<void>;
|
|
9
11
|
}>;
|
|
@@ -8,10 +8,8 @@ export { createImageToolbarHostBridge, ImageToolbarHostBridge, imageToolbarHostB
|
|
|
8
8
|
export type { ImageToolbarHostBridgeHandlers } from "./toolbar/imageToolbarHostBridge";
|
|
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
|
-
export { downloadSelectedImageOriginal, createImageToolbarActions,
|
|
11
|
+
export { downloadSelectedImageOriginal, createImageToolbarActions, getFirstImageFile, insertImageIntoEditor, replaceSelectedImageFromFile, } from "./toolbar/imageHostActions";
|
|
12
12
|
export type { ImageInsertSource, ImageInsertSize, ImageInsertStrategy, 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";
|
|
16
|
-
export { useImageImport } from "./import/useImageImport";
|
|
17
|
-
export type { ImageImportControls } from "./import/useImageImport";
|
|
@@ -4,7 +4,7 @@ import type { ImageSmudgeConfirmPayload } from "./imageSmudgeTypes";
|
|
|
4
4
|
export interface ConfirmImageSmudgeSessionInput {
|
|
5
5
|
editor: Editor;
|
|
6
6
|
imageObjectUrls: ImageObjectUrlStore;
|
|
7
|
-
flushSnapshot?: (
|
|
7
|
+
flushSnapshot?: () => Promise<void>;
|
|
8
8
|
replace?: boolean;
|
|
9
9
|
}
|
|
10
10
|
export declare function confirmImageSmudgeSession({ editor, imageObjectUrls, flushSnapshot, replace, }: ConfirmImageSmudgeSessionInput): Promise<ImageSmudgeConfirmPayload | null>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type CanvasAction } from "../../../_vendor/canvas-
|
|
1
|
+
import { type CanvasAction } from "../../../_vendor/canvas-product-contracts/index";
|
|
2
2
|
import { type AssetId, type Editor, type ShapeId, Vec } from "../../../_vendor/canvas-core/index";
|
|
3
3
|
import { type ImageAssetRecord, type ImageShapeRecord } from "../../../_vendor/plugin-image/index";
|
|
4
4
|
import { type ImageObjectUrlStore } from "../asset/imageBlobStore";
|
|
5
5
|
import type { ImageToolbarHostBridge } from "./imageToolbarHostBridge";
|
|
6
6
|
import { type LocalImageBlobInput } from "../asset/imageFileHelpers";
|
|
7
|
-
export {
|
|
7
|
+
export { getFirstImageFile } from "../asset/imageFileHelpers";
|
|
8
8
|
export type ImageInsertStrategy = "auto" | "copy" | "link";
|
|
9
9
|
export type ImageInsertSource = {
|
|
10
10
|
type: "file";
|
|
@@ -27,14 +27,14 @@ export interface InsertImageInput {
|
|
|
27
27
|
source: ImageInsertSource;
|
|
28
28
|
pagePoint?: Vec;
|
|
29
29
|
size?: ImageInsertSize;
|
|
30
|
-
flushSnapshot?: (
|
|
30
|
+
flushSnapshot?: () => Promise<void>;
|
|
31
31
|
strategy?: ImageInsertStrategy;
|
|
32
32
|
}
|
|
33
33
|
export interface ReplaceSelectedImageFileInput {
|
|
34
34
|
editor: Editor;
|
|
35
35
|
file: File;
|
|
36
36
|
imageObjectUrls: ImageObjectUrlStore;
|
|
37
|
-
flushSnapshot?: (
|
|
37
|
+
flushSnapshot?: () => Promise<void>;
|
|
38
38
|
}
|
|
39
39
|
interface ImageShapeAssetReplacementResult {
|
|
40
40
|
assetId: AssetId;
|
|
@@ -44,7 +44,7 @@ export declare function insertImageIntoEditor({ editor, imageObjectUrls, pagePoi
|
|
|
44
44
|
export declare function localizeRemoteImageAsset({ assetId, editor, flushSnapshot, imageObjectUrls, source, }: {
|
|
45
45
|
assetId: AssetId;
|
|
46
46
|
editor: Editor;
|
|
47
|
-
flushSnapshot?: (
|
|
47
|
+
flushSnapshot?: () => Promise<void>;
|
|
48
48
|
imageObjectUrls: ImageObjectUrlStore;
|
|
49
49
|
source: Extract<ImageInsertSource, {
|
|
50
50
|
type: "url";
|
|
@@ -59,14 +59,13 @@ export declare function replaceImageShapeFromBlob({ blob, canCommit, editor, flu
|
|
|
59
59
|
blob: Blob;
|
|
60
60
|
canCommit?: () => boolean;
|
|
61
61
|
editor: Editor;
|
|
62
|
-
flushSnapshot?: (
|
|
62
|
+
flushSnapshot?: () => Promise<void>;
|
|
63
63
|
imageObjectUrls: ImageObjectUrlStore;
|
|
64
64
|
name: string;
|
|
65
65
|
shape: ImageShapeRecord;
|
|
66
66
|
}): Promise<ImageShapeAssetReplacementResult | null>;
|
|
67
|
-
export declare function flushImageSnapshotBestEffort({
|
|
68
|
-
|
|
69
|
-
flushSnapshot?: (editor: Editor) => Promise<void>;
|
|
67
|
+
export declare function flushImageSnapshotBestEffort({ flushSnapshot, operation, }: {
|
|
68
|
+
flushSnapshot?: () => Promise<void>;
|
|
70
69
|
operation: string;
|
|
71
70
|
}): Promise<void>;
|
|
72
71
|
export declare function readImageAssetSourceBlob({ asset, imageObjectUrls, }: {
|
|
@@ -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 TextLinkPopoverPresenter } from "../../_vendor/plugin-text/index";
|
|
2
2
|
import { type CanvasPlugin } from "../../runtime/canvasKitPluginContracts";
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function createTextHostPlugin({ presenter, }: {
|
|
4
4
|
presenter: TextLinkPopoverPresenter;
|
|
5
5
|
}): CanvasPlugin;
|
package/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
:root{--land-selection:#2563eb;--land-canvas-bg:oklch(97.7% .004 95);--land-canvas-grid-minor:oklch(82% .01 95);--land-shape-fill-blue:#dbeafe;--land-shape-fill-green:#dcfce7;--land-shape-fill-red:#fee2e2;--land-shape-fill-amber:#fff7ed;--land-shape-fill-white:#f8fafc;--land-shape-fill-slate:#e2e8f0;--land-shape-stroke-blue:#1d4ed8;--land-shape-stroke-green:#15803d;--land-shape-stroke-red:#dc2626;--land-shape-stroke-orange:#ea580c;--land-shape-stroke-slate:#334155;--land-shape-stroke-muted:#94a3b8;--land-shape-text-slate:#0f172a;--land-shape-text-blue:#1d4ed8;--land-shape-text-green:#15803d;--land-shape-text-red:#dc2626;--canvas-background:var(--land-canvas-bg);--canvas-dot:var(--land-canvas-grid-minor);--border:oklch(84% .012 240);--accent:oklch(90% .024 210);--accent-foreground:oklch(24% .03 235);--muted-foreground:oklch(45% .018 245);--chrome-background:oklch(100% 5.96046e-8 none/.94);--chrome-foreground:oklch(18% .018 255);--chrome-border:color-mix(in oklch, var(--border) 88%, oklch(22% .02 255));--chrome-border-width:1px;--chrome-radius:.5rem;--chrome-control-radius:.375rem;--chrome-control-border-width:0px;--chrome-spacing:.25rem;--toolbar-control-size:1.75rem;--toolbar-floating-offset
|
|
1
|
+
:root{--land-selection:#2563eb;--land-canvas-bg:oklch(97.7% .004 95);--land-canvas-grid-minor:oklch(82% .01 95);--land-shape-fill-blue:#dbeafe;--land-shape-fill-green:#dcfce7;--land-shape-fill-red:#fee2e2;--land-shape-fill-amber:#fff7ed;--land-shape-fill-white:#f8fafc;--land-shape-fill-slate:#e2e8f0;--land-shape-stroke-blue:#1d4ed8;--land-shape-stroke-green:#15803d;--land-shape-stroke-red:#dc2626;--land-shape-stroke-orange:#ea580c;--land-shape-stroke-slate:#334155;--land-shape-stroke-muted:#94a3b8;--land-shape-text-slate:#0f172a;--land-shape-text-blue:#1d4ed8;--land-shape-text-green:#15803d;--land-shape-text-red:#dc2626;--canvas-background:var(--land-canvas-bg);--canvas-dot:var(--land-canvas-grid-minor);--border:oklch(84% .012 240);--accent:oklch(90% .024 210);--accent-foreground:oklch(24% .03 235);--muted-foreground:oklch(45% .018 245);--chrome-background:oklch(100% 5.96046e-8 none/.94);--chrome-foreground:oklch(18% .018 255);--chrome-border:color-mix(in oklch, var(--border) 88%, oklch(22% .02 255));--chrome-border-width:1px;--chrome-radius:.5rem;--chrome-control-radius:.375rem;--chrome-control-border-width:0px;--chrome-spacing:.25rem;--toolbar-control-size:1.75rem;--toolbar-floating-offset:2.375rem;--toolbar-floating-shift-padding:.5rem;--toolbar-title-padding-inline:.5rem;--toolbar-title-font-size:.75rem;--toolbar-title-line-height:1rem;--toolbar-separator-width:1px;--toolbar-separator-height:1.25rem;--toolbar-separator-margin-inline:.25rem;--toolbar-button-font-size:.8125rem;--shadow-chrome:0 14px 34px -26px #0f172a6b, 0 6px 16px -12px #0f172a3d}.land-canvas-kit__shell,.land-canvas-kit__shell *{box-sizing:border-box}.land-canvas-kit__shell{background:linear-gradient(var(--land-canvas-bg,var(--canvas-background)), var(--land-canvas-bg,var(--canvas-background))), var(--land-canvas-bg,var(--canvas-background));width:100%;height:100%;color:var(--chrome-foreground)}.land-canvas-kit__viewport{width:100%;height:100%;position:relative;overflow:hidden}.land-canvas__surface{touch-action:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:relative;overflow:hidden;background-color:var(--land-canvas-bg,var(--canvas-background))!important}.land-canvas__grid-background,.land-canvas__shape-layer,.land-canvas__shape-page-space,.land-canvas__overlay-layer,.land-canvas__overlay-page-space,.land-canvas__eraser-trail-page-space,.land-canvas__laser-trail-page-space,.land-canvas__floating-portal-host,.land-canvas__floating-toolbar-layer,.land-canvas__floating-selection-page-space{position:absolute;inset:0}.land-canvas__grid-background,.land-canvas__overlay-layer,.land-canvas__eraser-trail-page-space,.land-canvas__laser-trail-page-space,.land-canvas__floating-portal-host,.land-canvas__floating-toolbar-layer,.land-canvas__floating-selection-page-space,.land-canvas__floating-selection-anchor{pointer-events:none}.land-canvas__floating-portal-host{isolation:isolate;z-index:30}.land-canvas__floating-selection-anchor{z-index:30;position:absolute}.land-canvas-kit__text-link-popover{z-index:40;visibility:hidden;box-sizing:border-box;align-items:center;gap:var(--chrome-spacing);border:var(--chrome-border-width) solid var(--chrome-border);border-radius:var(--chrome-radius);background:var(--chrome-background);max-width:min(360px,100vw - 24px);color:var(--chrome-foreground);box-shadow:var(--shadow-chrome);padding:var(--chrome-spacing);pointer-events:auto;will-change:transform;display:flex;position:fixed;top:0;left:0}.land-canvas-kit__text-link-popover button:focus-visible{outline:2px solid var(--land-selection);outline-offset:1px}.land-canvas-kit__text-link-popover-icon-button,.land-canvas-kit__text-link-popover-link{border:var(--chrome-control-border-width) solid transparent;border-radius:var(--chrome-control-radius);cursor:pointer;background:0 0;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.land-canvas-kit__text-link-popover-icon-button{width:var(--toolbar-control-size);height:var(--toolbar-control-size);color:var(--muted-foreground);flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.land-canvas-kit__text-link-popover-link{min-width:0;max-width:min(260px,100vw - 7rem);color:var(--chrome-foreground);padding:0 var(--toolbar-title-padding-inline);font-size:var(--toolbar-title-font-size);line-height:var(--toolbar-title-line-height);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.land-canvas-kit__text-link-popover-icon-button:hover,.land-canvas-kit__text-link-popover-link:hover{background:var(--chrome-control-hover-background,var(--accent));color:var(--chrome-control-hover-foreground,var(--accent-foreground,var(--chrome-foreground)))}.land-text-editor__content{white-space:pre-wrap;overflow-wrap:break-word;outline:none;width:100%;height:100%;min-height:100%}.land-text-editor__content p{margin:0}.land-text-editor__content .land-rich-text-selection{background:color-mix(in srgb, var(--land-selection) 24%, transparent)}
|
|
2
2
|
/*$vite$:1*/
|