@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,39 +1,29 @@
|
|
|
1
|
-
import type { EditorPlugin,
|
|
1
|
+
import type { EditorPlugin, Editor } from "../canvas-core/index";
|
|
2
2
|
import type { CanvasRenderPlugin } from "../canvas-react/host/index";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import type { CanvasPluginCapabilityToken } from "./capability";
|
|
4
|
+
import type { CanvasPluginSetupExtension } from "./setupExtension";
|
|
5
|
+
export interface CanvasPluginSetupContext {
|
|
6
|
+
readonly editor: Editor;
|
|
7
|
+
readonly productId: string;
|
|
8
|
+
get<TValue>(extension: CanvasPluginSetupExtension<TValue>): TValue;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
actionShortcuts?: readonly CanvasActionShortcut[];
|
|
13
|
-
toolbarContributions?: readonly ToolbarContribution[];
|
|
14
|
-
contextMenuContributions?: readonly ContextMenuContribution[];
|
|
15
|
-
}
|
|
16
|
-
export type CanvasProductFactory = () => CanvasProductContribution;
|
|
17
|
-
type CanvasProductFactoryLike = (...args: never[]) => object;
|
|
10
|
+
export type CanvasPluginSetup<TContext extends CanvasPluginSetupContext = CanvasPluginSetupContext> = (context: TContext) => void;
|
|
11
|
+
type CanvasPluginSetupLike = (context: never) => unknown;
|
|
18
12
|
export interface CanvasPluginReference {
|
|
19
13
|
readonly id: string;
|
|
14
|
+
readonly __canvasPluginReferenceBrand: "CanvasPluginReference";
|
|
20
15
|
}
|
|
21
|
-
export
|
|
16
|
+
export type CanvasPluginRequirement = CanvasPluginReference | CanvasPluginCapabilityToken;
|
|
17
|
+
export interface CanvasPluginDefinition<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup> {
|
|
22
18
|
readonly id: string;
|
|
23
|
-
readonly
|
|
19
|
+
readonly provides?: readonly CanvasPluginCapabilityToken[];
|
|
20
|
+
readonly requires?: readonly CanvasPluginRequirement[];
|
|
24
21
|
readonly editor?: EditorPlugin;
|
|
25
22
|
readonly render?: CanvasRenderPlugin;
|
|
26
|
-
readonly
|
|
23
|
+
readonly setup?: TSetup;
|
|
27
24
|
}
|
|
28
|
-
export
|
|
29
|
-
export interface CompiledCanvasPlugins<TProductFactory extends CanvasProductFactoryLike = CanvasProductFactory> {
|
|
30
|
-
readonly plugins: readonly CanvasPlugin<TProductFactory>[];
|
|
31
|
-
readonly pluginIds: readonly string[];
|
|
32
|
-
readonly editorPlugins: readonly EditorPlugin[];
|
|
33
|
-
readonly renderPlugins: readonly CanvasRenderPlugin[];
|
|
34
|
-
readonly productFactories: readonly TProductFactory[];
|
|
35
|
-
readonly shapeTypes: readonly ShapeRecordBase["type"][];
|
|
25
|
+
export interface CanvasPlugin<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup> extends CanvasPluginDefinition<TSetup>, CanvasPluginReference {
|
|
36
26
|
}
|
|
37
|
-
export
|
|
38
|
-
export declare function
|
|
27
|
+
export type CanvasPluginInput<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup> = CanvasPlugin<TSetup> | readonly CanvasPluginInput<TSetup>[];
|
|
28
|
+
export declare function defineCanvasPlugin<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup>(plugin: CanvasPluginDefinition<TSetup>): CanvasPlugin<TSetup>;
|
|
39
29
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { Editor, ShapeColor, ShapeId, ShapeRecordBase } from "../canvas-core/index";
|
|
1
|
+
import type { Editor, KeyboardShortcutInput, ShapeColor, ShapeId, ShapeRecordBase } from "../canvas-core/index";
|
|
2
2
|
export interface CanvasSelectionSnapshot {
|
|
3
3
|
selectedShapeIds: readonly ShapeId[];
|
|
4
4
|
selectedShapes: readonly ShapeRecordBase[];
|
|
5
5
|
count: number;
|
|
6
6
|
singleShapeType: ShapeRecordBase["type"] | null;
|
|
7
7
|
commonShapeType: ShapeRecordBase["type"] | null;
|
|
8
|
+
canFlip: boolean;
|
|
8
9
|
canResetRotation: boolean;
|
|
9
10
|
isMixedFrameAndPointHandleSelection: boolean;
|
|
10
11
|
}
|
|
@@ -24,10 +25,20 @@ export interface CanvasActionRunInput<TValue extends CanvasActionValue> {
|
|
|
24
25
|
context: CanvasActionContext;
|
|
25
26
|
value: TValue;
|
|
26
27
|
}
|
|
28
|
+
export type CanvasActionAvailability = "inapplicable" | "disabled" | "enabled";
|
|
27
29
|
export interface CanvasAction<TValue extends CanvasActionValue = CanvasActionValue> {
|
|
28
30
|
id: string;
|
|
29
|
-
|
|
30
|
-
isEnabled?(context: CanvasActionContext): boolean;
|
|
31
|
+
getAvailability?(context: CanvasActionContext): CanvasActionAvailability;
|
|
31
32
|
getValue?(context: CanvasActionContext): TValue;
|
|
32
33
|
run(input: CanvasActionRunInput<TValue>): void;
|
|
33
34
|
}
|
|
35
|
+
export interface CanvasActionShortcut {
|
|
36
|
+
actionId: string;
|
|
37
|
+
shortcut: KeyboardShortcutInput;
|
|
38
|
+
}
|
|
39
|
+
export interface CanvasPluginActionSetup {
|
|
40
|
+
add(...actions: readonly CanvasAction[]): void;
|
|
41
|
+
addShortcuts(...shortcuts: readonly CanvasActionShortcut[]): void;
|
|
42
|
+
}
|
|
43
|
+
export declare const canvasActionsExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginActionSetup>;
|
|
44
|
+
export declare function resolveCanvasActionAvailability(action: CanvasAction, context: CanvasActionContext): CanvasActionAvailability;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CanvasPluginValueToken } from "../canvas-plugin-sdk/index";
|
|
2
|
+
export interface CanvasPluginCapabilityRegistry {
|
|
3
|
+
get<TValue>(token: CanvasPluginValueToken<TValue>): TValue | null;
|
|
4
|
+
}
|
|
5
|
+
export interface CanvasPluginCapabilitySetup extends CanvasPluginCapabilityRegistry {
|
|
6
|
+
provide<TValue>(token: CanvasPluginValueToken<TValue>, value: TValue): void;
|
|
7
|
+
}
|
|
8
|
+
export declare const canvasCapabilitiesExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginCapabilitySetup>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CanvasActionContext, CanvasActionValue } from "./actions";
|
|
2
|
+
import type { Editor } from "../canvas-core/index";
|
|
3
|
+
export interface ChromeChannel<TId extends string = string> {
|
|
4
|
+
readonly id: TId;
|
|
5
|
+
}
|
|
6
|
+
export declare function createChromeChannel<const TId extends string>(id: TId): ChromeChannel<TId>;
|
|
7
|
+
export declare const chromeChannels: {
|
|
8
|
+
readonly mainMenu: ChromeChannel<"land.chrome.main-menu">;
|
|
9
|
+
readonly commandPalette: ChromeChannel<"land.chrome.command-palette">;
|
|
10
|
+
readonly inspector: ChromeChannel<"land.chrome.inspector">;
|
|
11
|
+
readonly status: ChromeChannel<"land.chrome.status">;
|
|
12
|
+
};
|
|
13
|
+
export type ChromeItem = {
|
|
14
|
+
kind: "command";
|
|
15
|
+
id: string;
|
|
16
|
+
actionId: string;
|
|
17
|
+
label: string;
|
|
18
|
+
icon?: string;
|
|
19
|
+
value?: CanvasActionValue;
|
|
20
|
+
shortcut?: string;
|
|
21
|
+
tone?: "default" | "destructive";
|
|
22
|
+
dataUi?: string;
|
|
23
|
+
} | {
|
|
24
|
+
kind: "separator";
|
|
25
|
+
id: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: "badge";
|
|
28
|
+
id: string;
|
|
29
|
+
label: string;
|
|
30
|
+
dataUi?: string;
|
|
31
|
+
};
|
|
32
|
+
export type ChromeCommandItem = Extract<ChromeItem, {
|
|
33
|
+
kind: "command";
|
|
34
|
+
}>;
|
|
35
|
+
export interface ChromeSection {
|
|
36
|
+
id: string;
|
|
37
|
+
order?: number;
|
|
38
|
+
title?: string;
|
|
39
|
+
items: readonly ChromeItem[];
|
|
40
|
+
}
|
|
41
|
+
export interface ChromeContribution {
|
|
42
|
+
id: string;
|
|
43
|
+
channel: ChromeChannel;
|
|
44
|
+
order?: number;
|
|
45
|
+
actionIds: readonly string[];
|
|
46
|
+
subscribe?(editor: Editor, listener: () => void): () => void;
|
|
47
|
+
when?(context: CanvasActionContext): boolean;
|
|
48
|
+
getSections(context: CanvasActionContext): readonly ChromeSection[];
|
|
49
|
+
}
|
|
50
|
+
export interface CanvasPluginChromeSetup {
|
|
51
|
+
add(...contributions: readonly ChromeContribution[]): void;
|
|
52
|
+
}
|
|
53
|
+
export declare const canvasChromeExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginChromeSetup>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Editor } from "../canvas-core/index";
|
|
2
|
+
import type { CanvasActionContext } from "./actions";
|
|
3
|
+
import type { ChromeChannel, ChromeSection } from "./chrome";
|
|
4
|
+
export interface CanvasChromeRegistry {
|
|
5
|
+
getChannels(): readonly ChromeChannel[];
|
|
6
|
+
getStateRevision(): number;
|
|
7
|
+
subscribeToState(editor: Editor, listener: () => void): () => void;
|
|
8
|
+
getSections(channel: ChromeChannel, context: CanvasActionContext): ChromeSection[];
|
|
9
|
+
}
|
|
@@ -57,3 +57,7 @@ export interface ContextMenuContribution {
|
|
|
57
57
|
when?(context: ContextMenuContext): boolean;
|
|
58
58
|
getSections(context: ContextMenuContext): readonly ContextMenuSection[];
|
|
59
59
|
}
|
|
60
|
+
export interface CanvasPluginContextMenuSetup {
|
|
61
|
+
add(...contributions: readonly ContextMenuContribution[]): void;
|
|
62
|
+
}
|
|
63
|
+
export declare const canvasContextMenuExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginContextMenuSetup>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CanvasExportArtifact, CanvasExportFormat, CanvasExportProviderInput } from "./exports";
|
|
2
|
+
export interface CanvasExportRegistry {
|
|
3
|
+
getFormats(): readonly CanvasExportFormat[];
|
|
4
|
+
hasFormat(format: string): boolean;
|
|
5
|
+
export(format: string, input: CanvasExportProviderInput): Promise<CanvasExportArtifact>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Editor, ShapeId } from "../canvas-core/index";
|
|
2
|
+
export interface CanvasExportFormat {
|
|
3
|
+
format: string;
|
|
4
|
+
label: string;
|
|
5
|
+
mimeType: string;
|
|
6
|
+
fileExtension: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CanvasExportProviderInput {
|
|
9
|
+
editor: Editor;
|
|
10
|
+
shapeIds: readonly ShapeId[];
|
|
11
|
+
options?: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface CanvasExportPayload {
|
|
14
|
+
data: Blob | string | Uint8Array | null;
|
|
15
|
+
result?: unknown;
|
|
16
|
+
status?: unknown;
|
|
17
|
+
}
|
|
18
|
+
export interface CanvasExportArtifact extends CanvasExportFormat, CanvasExportPayload {
|
|
19
|
+
}
|
|
20
|
+
export interface CanvasExportContribution extends CanvasExportFormat {
|
|
21
|
+
id: string;
|
|
22
|
+
export(input: CanvasExportProviderInput): CanvasExportPayload | Promise<CanvasExportPayload>;
|
|
23
|
+
}
|
|
24
|
+
export interface CanvasPluginExportSetup {
|
|
25
|
+
add(...contributions: readonly CanvasExportContribution[]): void;
|
|
26
|
+
}
|
|
27
|
+
export declare const canvasExportsExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginExportSetup>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CanvasImportContext, CanvasImportContribution, CanvasImportPreview, CanvasImportRequest, CanvasImportResult } from "./imports";
|
|
2
|
+
export interface CanvasImportRegistry {
|
|
3
|
+
getContributions(): readonly CanvasImportContribution[];
|
|
4
|
+
canImport(request: CanvasImportRequest): boolean;
|
|
5
|
+
canImportPreview(preview: CanvasImportPreview): boolean;
|
|
6
|
+
import(request: CanvasImportRequest, context: CanvasImportContext): Promise<CanvasImportResult>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Editor, Vec } from "../canvas-core/index";
|
|
2
|
+
export type CanvasImportSource = "clipboard" | "drop" | "file-picker";
|
|
3
|
+
export interface CanvasImportRequest {
|
|
4
|
+
source: CanvasImportSource;
|
|
5
|
+
files: readonly File[];
|
|
6
|
+
text?: string;
|
|
7
|
+
html?: string;
|
|
8
|
+
urls?: readonly string[];
|
|
9
|
+
pagePoint?: Vec;
|
|
10
|
+
}
|
|
11
|
+
export interface CanvasImportPreview {
|
|
12
|
+
source: "drop";
|
|
13
|
+
dataTypes: readonly string[];
|
|
14
|
+
fileTypes: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export type CanvasImportResult = "handled" | "ignored";
|
|
17
|
+
export interface CanvasImportContext {
|
|
18
|
+
editor: Editor;
|
|
19
|
+
}
|
|
20
|
+
export interface CanvasImportContribution {
|
|
21
|
+
id: string;
|
|
22
|
+
order?: number;
|
|
23
|
+
/**
|
|
24
|
+
* A synchronous, payload-free check used during dragover, when browsers may
|
|
25
|
+
* hide file and URL values until drop.
|
|
26
|
+
*/
|
|
27
|
+
acceptsPreview?(preview: CanvasImportPreview): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Returning true claims the native paste/drop event. If import() later
|
|
30
|
+
* returns ignored, later contributions may run, but browser default handling
|
|
31
|
+
* remains suppressed for that claimed event.
|
|
32
|
+
*/
|
|
33
|
+
accepts(request: CanvasImportRequest): boolean;
|
|
34
|
+
import(request: CanvasImportRequest, context: CanvasImportContext): CanvasImportResult | Promise<CanvasImportResult>;
|
|
35
|
+
}
|
|
36
|
+
export interface CanvasPluginImportSetup {
|
|
37
|
+
add(...contributions: readonly CanvasImportContribution[]): void;
|
|
38
|
+
}
|
|
39
|
+
export declare const canvasImportsExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginImportSetup>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./actions";
|
|
2
|
+
export * from "./actionRegistry";
|
|
3
|
+
export * from "./capability";
|
|
4
|
+
export * from "./chrome";
|
|
5
|
+
export * from "./chromeRegistry";
|
|
6
|
+
export * from "./contextMenu";
|
|
7
|
+
export * from "./contextMenuRegistry";
|
|
8
|
+
export * from "./exports";
|
|
9
|
+
export * from "./exportRegistry";
|
|
10
|
+
export * from "./imports";
|
|
11
|
+
export * from "./importRegistry";
|
|
12
|
+
export * from "./productApi";
|
|
13
|
+
export * from "./services";
|
|
14
|
+
export * from "./toolbar";
|
|
15
|
+
export * from "./toolbarRegistry";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Editor, ShapeId } from "../canvas-core/index";
|
|
2
|
+
import { type CanvasPluginCapabilityToken } from "../canvas-plugin-sdk/index";
|
|
3
|
+
import type { CanvasPluginCapabilityRegistry } from "./capability";
|
|
4
|
+
import type { CanvasExportRegistry } from "./exportRegistry";
|
|
5
|
+
export interface ProductApiToken<TApi> extends CanvasPluginCapabilityToken<TApi, "api"> {
|
|
6
|
+
readonly __api?: TApi;
|
|
7
|
+
}
|
|
8
|
+
export interface ProductApiRegistry {
|
|
9
|
+
get<TApi>(token: ProductApiToken<TApi>): TApi | null;
|
|
10
|
+
}
|
|
11
|
+
export interface CanvasShapeRef<TType extends string = string> {
|
|
12
|
+
id: ShapeId;
|
|
13
|
+
type: TType;
|
|
14
|
+
}
|
|
15
|
+
export interface CanvasPluginApiContext {
|
|
16
|
+
apis: ProductApiRegistry;
|
|
17
|
+
capabilities: CanvasPluginCapabilityRegistry;
|
|
18
|
+
editor: Editor;
|
|
19
|
+
exportRegistry: CanvasExportRegistry;
|
|
20
|
+
}
|
|
21
|
+
export interface CanvasPluginApi<TApi, TContext extends CanvasPluginApiContext = CanvasPluginApiContext> {
|
|
22
|
+
token: ProductApiToken<TApi>;
|
|
23
|
+
create(context: TContext): TApi | null;
|
|
24
|
+
}
|
|
25
|
+
export interface CanvasPluginApiSetup<TContext extends CanvasPluginApiContext = CanvasPluginApiContext> {
|
|
26
|
+
add<TApi>(api: CanvasPluginApi<TApi, TContext>): void;
|
|
27
|
+
}
|
|
28
|
+
export declare const canvasApisExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginApiSetup<CanvasPluginApiContext>>;
|
|
29
|
+
export declare function createProductApiToken<TApi>(id: string): ProductApiToken<TApi>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type CanvasPluginCapabilityToken } from "../canvas-plugin-sdk/index";
|
|
2
|
+
export interface ProductServiceToken<TService> extends CanvasPluginCapabilityToken<TService, "service"> {
|
|
3
|
+
readonly __service?: TService;
|
|
4
|
+
}
|
|
5
|
+
export interface ProductServiceFactoryContext {
|
|
6
|
+
productId: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ProductServiceFactory<TService> {
|
|
9
|
+
token: ProductServiceToken<TService>;
|
|
10
|
+
create(context: ProductServiceFactoryContext): TService;
|
|
11
|
+
dispose?(service: TService): void;
|
|
12
|
+
}
|
|
13
|
+
export interface ProductServiceRegistry {
|
|
14
|
+
get<TService>(token: ProductServiceToken<TService>): TService | null;
|
|
15
|
+
}
|
|
16
|
+
export interface ProductServiceSetup extends ProductServiceRegistry {
|
|
17
|
+
add<TService>(factory: ProductServiceFactory<TService>): TService;
|
|
18
|
+
}
|
|
19
|
+
export declare const canvasServicesExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<ProductServiceSetup>;
|
|
20
|
+
export declare function createProductServiceToken<TService>(id: string): ProductServiceToken<TService>;
|
|
21
|
+
export declare function requireProductService<TService>(services: ProductServiceRegistry, token: ProductServiceToken<TService>): TService;
|
|
@@ -3,7 +3,17 @@ import type { CanvasActionContext, CanvasActionValue } from "./actions";
|
|
|
3
3
|
export declare const SET_ACTIVE_TOOL_TOOLBAR_ACTION_ID = "editor.tool.set-active-tool";
|
|
4
4
|
export declare const TOGGLE_TOOL_LOCKED_TOOLBAR_ACTION_ID = "editor.tool.toggle-locked";
|
|
5
5
|
export type ToolbarSurface = "selection" | "tool";
|
|
6
|
-
export type
|
|
6
|
+
export type ToolbarGroupPresentation = "primary" | "overflow";
|
|
7
|
+
export interface ToolbarChannel<TId extends string = string> {
|
|
8
|
+
readonly id: TId;
|
|
9
|
+
}
|
|
10
|
+
export declare function createToolbarChannel<const TId extends string>(id: TId): ToolbarChannel<TId>;
|
|
11
|
+
export declare const toolbarChannels: {
|
|
12
|
+
readonly toolSwitcher: ToolbarChannel<"land.toolbar.tool-switcher">;
|
|
13
|
+
readonly toolOptions: ToolbarChannel<"land.toolbar.tool-options">;
|
|
14
|
+
readonly selectionProperties: ToolbarChannel<"land.toolbar.selection-properties">;
|
|
15
|
+
readonly selectionQuickActions: ToolbarChannel<"land.toolbar.selection-quick-actions">;
|
|
16
|
+
};
|
|
7
17
|
export interface ToolbarButtonItem {
|
|
8
18
|
kind: "button";
|
|
9
19
|
id: string;
|
|
@@ -31,6 +41,8 @@ export interface ToolbarSegmentedItem {
|
|
|
31
41
|
kind: "segmented";
|
|
32
42
|
id: string;
|
|
33
43
|
actionId: string;
|
|
44
|
+
label?: string;
|
|
45
|
+
icon?: string;
|
|
34
46
|
options: readonly ToolbarSegmentedOption[];
|
|
35
47
|
}
|
|
36
48
|
export interface ToolbarSwatchOption {
|
|
@@ -75,6 +87,7 @@ export interface ToolbarTextInputItem {
|
|
|
75
87
|
icon?: string;
|
|
76
88
|
presentation?: "inline" | "popover";
|
|
77
89
|
placeholder?: string;
|
|
90
|
+
suffix?: string;
|
|
78
91
|
validate?(value: string): boolean;
|
|
79
92
|
dataUi?: string;
|
|
80
93
|
}
|
|
@@ -83,8 +96,10 @@ export interface ToolbarColorInputItem {
|
|
|
83
96
|
id: string;
|
|
84
97
|
actionId: string;
|
|
85
98
|
label: string;
|
|
99
|
+
previewStyle?: "solid" | "outline";
|
|
86
100
|
fallback?: string;
|
|
87
|
-
|
|
101
|
+
/** Embed opacity in the color value by default, or send it separately. */
|
|
102
|
+
opacityMode?: "embedded" | "separate";
|
|
88
103
|
opacityFallback?: number;
|
|
89
104
|
presets?: readonly ToolbarColorPresetOption[];
|
|
90
105
|
dataUi?: string;
|
|
@@ -113,15 +128,19 @@ export type ToolbarItem = ToolbarButtonItem | ToolbarCheckboxItem | ToolbarSegme
|
|
|
113
128
|
export interface ToolbarGroup {
|
|
114
129
|
id: string;
|
|
115
130
|
order?: number;
|
|
131
|
+
presentation?: ToolbarGroupPresentation;
|
|
116
132
|
items: readonly ToolbarItem[];
|
|
117
133
|
}
|
|
118
134
|
export interface ToolbarContribution {
|
|
119
135
|
id: string;
|
|
120
|
-
|
|
121
|
-
placement?: ToolbarPlacement;
|
|
136
|
+
channel: ToolbarChannel;
|
|
122
137
|
order?: number;
|
|
123
138
|
actionIds: readonly string[];
|
|
124
139
|
subscribe?(editor: Editor, listener: () => void): () => void;
|
|
125
140
|
when?(context: CanvasActionContext): boolean;
|
|
126
141
|
getGroups(context: CanvasActionContext): readonly ToolbarGroup[];
|
|
127
142
|
}
|
|
143
|
+
export interface CanvasPluginToolbarSetup {
|
|
144
|
+
add(...contributions: readonly ToolbarContribution[]): void;
|
|
145
|
+
}
|
|
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,17 +1,28 @@
|
|
|
1
1
|
import type { ComponentType, ReactNode } from "react";
|
|
2
|
-
import type { Editor, SelectionCustomHandle,
|
|
2
|
+
import type { Editor, SelectionCustomHandle, ShapeEditingSession, ShapeRecordBase } from "../../canvas-core/index";
|
|
3
3
|
export interface ShapeRendererProps<S extends ShapeRecordBase = ShapeRecordBase> {
|
|
4
4
|
shape: S;
|
|
5
5
|
editor: Editor;
|
|
6
6
|
isSelected: boolean;
|
|
7
|
-
isHovered: boolean;
|
|
8
7
|
shapeEditingSession: ShapeEditingSession | null;
|
|
9
8
|
}
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Rendered inside the shape's render-bounds host. SVG coordinates should match
|
|
11
|
+
* the shape util's `getRenderBounds()` coordinate space.
|
|
12
|
+
*/
|
|
13
|
+
export interface ShapeHoverRendererProps<S extends ShapeRecordBase = ShapeRecordBase> {
|
|
14
|
+
shape: S;
|
|
15
|
+
editor: Editor;
|
|
16
|
+
/** Local-space width that renders as the standard hover width on screen. */
|
|
17
|
+
strokeWidth: number;
|
|
18
|
+
}
|
|
19
|
+
export declare const SHAPE_HOVER_STROKE = "var(--land-shape-hover, var(--land-selection, #2563eb))";
|
|
20
|
+
/** Standard hover stroke width in screen pixels. */
|
|
21
|
+
export declare const SHAPE_HOVER_STROKE_WIDTH = 2;
|
|
12
22
|
export interface RegisteredShapeRenderer<S extends ShapeRecordBase = ShapeRecordBase> {
|
|
13
23
|
type: S["type"];
|
|
14
24
|
component: ComponentType<ShapeRendererProps<S>>;
|
|
25
|
+
hoverComponent?: ComponentType<ShapeHoverRendererProps<S>>;
|
|
15
26
|
foregroundComponent?: ComponentType<ShapeRendererProps<S>>;
|
|
16
27
|
}
|
|
17
28
|
export type AnyRegisteredShapeRenderer = RegisteredShapeRenderer<any>;
|
|
@@ -3,6 +3,6 @@ export { CanvasOverlayRegistryContext, useCanvasOverlayRegistry, } from "./canva
|
|
|
3
3
|
export { CanvasDomEventGuardRegistry, createCanvasDomEventGuardRegistry, } from "./domEventGuards";
|
|
4
4
|
export { CanvasOverlayRegistry, createCanvasOverlayRegistry, } from "./overlayRegistry";
|
|
5
5
|
export { CanvasRendererRegistry, createCanvasRendererRegistry, } from "./rendererRegistry";
|
|
6
|
-
export type { AnyRegisteredSelectionCustomHandleRenderer, AnyRegisteredShapeRenderer, CanvasOverlayContribution, CanvasOverlayLayer, CanvasDomEventGuard, CanvasDomEventGuardCursorInput, CanvasDomEventGuardDecision, CanvasDomEventGuardInput, CanvasDomEventGuardName, CanvasRenderPluginComponent, CanvasRenderPluginProvider, CanvasRenderPlugin, RegisteredSelectionCustomHandleRenderer, RegisteredShapeRenderer, SelectionCustomHandleRendererProps, ShapeRendererProps, ShapeOpacityModifier, } from "./canvasRenderPlugin";
|
|
7
|
-
export {
|
|
6
|
+
export type { AnyRegisteredSelectionCustomHandleRenderer, AnyRegisteredShapeRenderer, CanvasOverlayContribution, CanvasOverlayLayer, CanvasDomEventGuard, CanvasDomEventGuardCursorInput, CanvasDomEventGuardDecision, CanvasDomEventGuardInput, CanvasDomEventGuardName, CanvasRenderPluginComponent, CanvasRenderPluginProvider, CanvasRenderPlugin, RegisteredSelectionCustomHandleRenderer, RegisteredShapeRenderer, SelectionCustomHandleRendererProps, ShapeHoverRendererProps, ShapeRendererProps, ShapeOpacityModifier, } from "./canvasRenderPlugin";
|
|
7
|
+
export { SHAPE_HOVER_STROKE, SHAPE_HOVER_STROKE_WIDTH, } from "./canvasRenderPlugin";
|
|
8
8
|
export { createCanvasRenderRuntime, type CanvasRenderRuntime, } from "./canvasRenderRuntime";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ShapeColor, type ShapeId } from "../canvas-core/index";
|
|
2
|
+
import { type CanvasPluginApi, type CanvasShapeRef } from "../canvas-product-contracts/index";
|
|
3
|
+
import type { ArrowShapeProps } from "./types";
|
|
4
|
+
export interface ArrowBindingInput {
|
|
5
|
+
targetShapeId: ShapeId;
|
|
6
|
+
normalizedAnchor: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface ArrowInput {
|
|
12
|
+
start: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
end: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
20
|
+
bend?: number;
|
|
21
|
+
stroke?: ShapeColor;
|
|
22
|
+
strokeWidth?: number;
|
|
23
|
+
headStart?: ArrowShapeProps["headStart"];
|
|
24
|
+
headEnd?: ArrowShapeProps["headEnd"];
|
|
25
|
+
startBinding?: ArrowBindingInput | null;
|
|
26
|
+
endBinding?: ArrowBindingInput | null;
|
|
27
|
+
meta?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
export interface ArrowApi {
|
|
30
|
+
create(input: ArrowInput): CanvasShapeRef<"arrow"> | null;
|
|
31
|
+
}
|
|
32
|
+
export declare const arrowApiToken: import("../canvas-product-contracts/index").ProductApiToken<ArrowApi>;
|
|
33
|
+
export declare const arrowPluginApi: CanvasPluginApi<ArrowApi>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box, Vec, type Editor } from "../canvas-core/index";
|
|
1
|
+
import { Box, Vec, type Editor, type ShapeLabelPathGeometry } from "../canvas-core/index";
|
|
2
2
|
import type { ArrowShapeProps, ArrowShapeRecord, ArrowTerminal } from "./types";
|
|
3
3
|
export declare const ARROW_CURVE_EPSILON = 0.000001;
|
|
4
4
|
export interface ArrowInfoTerminal {
|
|
@@ -51,6 +51,7 @@ export declare function getArrowInfo(shape: ArrowShapeRecord): ArrowInfo;
|
|
|
51
51
|
export declare function getArrowLocalInfo(shape: ArrowShapeRecord): ArrowInfo;
|
|
52
52
|
export declare function getArrowBendFromMiddlePagePoint(start: Vec, end: Vec, point: Vec): number;
|
|
53
53
|
export declare function getArrowHitDistance(info: ArrowInfo, point: Vec): number;
|
|
54
|
+
export declare function getArrowLabelPathGeometry(info: ArrowInfo): ShapeLabelPathGeometry;
|
|
54
55
|
export declare function getArrowInfoFromPoints(start: Vec, end: Vec, rawBend: unknown): ArrowInfo;
|
|
55
56
|
export declare function getArrowInfoFromArc({ start, end, middle, bend, arc, startHandle, endHandle, }: {
|
|
56
57
|
start: Vec;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Vec } from "../canvas-core/index";
|
|
2
|
+
import type { ArrowInfo } from "./arrowGeometry";
|
|
3
|
+
import type { ArrowShapeProps } from "./types";
|
|
4
|
+
export interface ArrowHeadPathGeometry {
|
|
5
|
+
path: string | null;
|
|
6
|
+
points: readonly Vec[];
|
|
7
|
+
}
|
|
8
|
+
export declare function getArrowHeadPathGeometry(info: ArrowInfo, input: Pick<ArrowShapeProps, "headStart" | "headEnd" | "strokeWidth">): ArrowHeadPathGeometry;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box, ShapeUtil, Vec, type ShapeBrushWrapInput, type ShapeGeometryInput, type ShapeSelectionHandleAnchorInput, type ShapeSelectionHandleAnchors, type ShapeSelectionFrameInput, type ShapeLineSegmentHitTestInput, type ShapeSelectionOverlayInfo, type ShapeSelectionOverlayInfoInput, type ShapeSelectionPagePointsInput, type ShapeSelectionPagePoints, type ShapePointHitTestInput, type ShapeUpdate } from "../canvas-core/index";
|
|
1
|
+
import { Box, ShapeUtil, Vec, type ShapeBrushWrapInput, type ShapeGeometryInput, type ShapeSelectionHandleAnchorInput, type ShapeSelectionHandleAnchors, type ShapeSelectionFrameInput, type ShapeLineSegmentHitTestInput, type ShapeLabelPathGeometry, type ShapeSelectionOverlayInfo, type ShapeSelectionOverlayInfoInput, type ShapeSelectionPagePointsInput, type ShapeSelectionPagePoints, type ShapePointHitTestInput, type ShapeUpdate } from "../canvas-core/index";
|
|
2
2
|
import { type ArrowShapeProps, type ArrowShapeRecord } from "./types";
|
|
3
3
|
export declare class ArrowShapeUtil extends ShapeUtil<ArrowShapeRecord> {
|
|
4
4
|
readonly type: "arrow";
|
|
@@ -19,6 +19,7 @@ export declare class ArrowShapeUtil extends ShapeUtil<ArrowShapeRecord> {
|
|
|
19
19
|
canStartTranslateFromSelectionBounds(_shape: ArrowShapeRecord, input: ShapeSelectionFrameInput): boolean;
|
|
20
20
|
getSelectionHandleAnchors(shape: ArrowShapeRecord, input: ShapeSelectionHandleAnchorInput): ShapeSelectionHandleAnchors;
|
|
21
21
|
getSelectionOverlayInfo(shape: ArrowShapeRecord, input: ShapeSelectionOverlayInfoInput): ShapeSelectionOverlayInfo;
|
|
22
|
+
getLabelPathGeometry(shape: ArrowShapeRecord, input: ShapeSelectionOverlayInfoInput): ShapeLabelPathGeometry;
|
|
22
23
|
hitTest(shape: ArrowShapeRecord, point: Vec, input?: ShapePointHitTestInput): boolean;
|
|
23
24
|
hitTestLineSegment(shape: ArrowShapeRecord, input: ShapeLineSegmentHitTestInput): boolean;
|
|
24
25
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type CanvasProductContribution } from "../canvas-plugin-sdk/index";
|
|
2
1
|
import { type EditorPlugin, type ShapeSvgExporter, type SvgExportContext, type SvgNode } from "../canvas-core/index";
|
|
3
2
|
import type { ArrowShapeRecord } from "./types";
|
|
4
3
|
export declare class ArrowShapeSvgExporter implements ShapeSvgExporter<ArrowShapeRecord> {
|
|
@@ -6,4 +5,3 @@ export declare class ArrowShapeSvgExporter implements ShapeSvgExporter<ArrowShap
|
|
|
6
5
|
toSvg(shape: ArrowShapeRecord, context: SvgExportContext): SvgNode;
|
|
7
6
|
}
|
|
8
7
|
export declare function createArrowEditorPlugin(): EditorPlugin;
|
|
9
|
-
export declare function createArrowProductContribution(): CanvasProductContribution;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const Arrow: import("../canvas-plugin-sdk/index").CanvasPlugin<typeof
|
|
1
|
+
import { setupArrowProduct } from "./productRuntime";
|
|
2
|
+
export declare const Arrow: import("../canvas-plugin-sdk/index").CanvasPlugin<typeof setupArrowProduct>;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export { ArrowBindingUtil } from "./arrowBindingUtil";
|
|
2
|
+
export { arrowApiToken } from "./api";
|
|
3
|
+
export type { ArrowApi, ArrowBindingInput, ArrowInput, } from "./api";
|
|
2
4
|
export { ArrowShapeUtil } from "./arrowShapeUtil";
|
|
3
5
|
export { ArrowTool } from "./arrowTool";
|
|
4
|
-
export { ArrowShapeSvgExporter, createArrowEditorPlugin
|
|
6
|
+
export { ArrowShapeSvgExporter, createArrowEditorPlugin } from "./editorRuntime";
|
|
7
|
+
export { setupArrowProduct } from "./productRuntime";
|
|
5
8
|
export { createArrowCanvasRenderPlugin } from "./canvasRender";
|
|
6
9
|
export { Arrow } from "./feature";
|
|
7
10
|
export { isArrowBindingRecord, isArrowShapeRecord, type ArrowBindingProps, type ArrowBindingRecord, type ArrowPoint, type ArrowShapeProps, type ArrowShapeRecord, type ArrowTerminal, } from "./types";
|
|
@@ -2,9 +2,12 @@ import { type ShapeColor } from "../canvas-core/index";
|
|
|
2
2
|
import type { DrawShapeRecord } from "./types";
|
|
3
3
|
interface DrawShapeSvgProps {
|
|
4
4
|
shape: DrawShapeRecord;
|
|
5
|
-
isHovered?: boolean;
|
|
6
5
|
stroke?: ShapeColor;
|
|
7
6
|
strokeWidth?: number;
|
|
8
7
|
}
|
|
9
|
-
export declare function DrawShapeSvg({ shape,
|
|
8
|
+
export declare function DrawShapeSvg({ shape, stroke, strokeWidth, }: DrawShapeSvgProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export declare function DrawShapeHoverSvg({ shape, strokeWidth, }: {
|
|
10
|
+
shape: DrawShapeRecord;
|
|
11
|
+
strokeWidth: number;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
10
13
|
export {};
|
|
@@ -13,6 +13,10 @@ export interface DrawInputPointGuardOptions {
|
|
|
13
13
|
hardMaxPointCount: number;
|
|
14
14
|
maxDistanceMultiplier: number;
|
|
15
15
|
}
|
|
16
|
+
export interface DrawInputPointGuardState {
|
|
17
|
+
anchorPoint: DrawShapePoint;
|
|
18
|
+
hasProvisionalPoint: boolean;
|
|
19
|
+
}
|
|
16
20
|
export interface DrawPointSamplingResult {
|
|
17
21
|
points: DrawShapePoint[];
|
|
18
22
|
rawPointCount: number;
|
|
@@ -29,7 +33,9 @@ export declare function cloneDrawSegment(segment: DrawShapeSegment): DrawShapeSe
|
|
|
29
33
|
export declare function getFlattenedDrawSegmentPoints(segments: readonly DrawShapeSegment[]): DrawShapePoint[];
|
|
30
34
|
export declare function getDrawSegmentsFromPoints(points: readonly DrawShapePoint[]): DrawShapeSegment[];
|
|
31
35
|
export declare function getDrawInputPointGuardOptions(strokeWidth: number, isPen: boolean): DrawInputPointGuardOptions;
|
|
32
|
-
export declare function appendGuardedDrawPoint(points: DrawShapePoint[], point: DrawShapePoint, options: DrawInputPointGuardOptions
|
|
36
|
+
export declare function appendGuardedDrawPoint(points: DrawShapePoint[], point: DrawShapePoint, options: DrawInputPointGuardOptions, state: DrawInputPointGuardState, appendOptions?: {
|
|
37
|
+
force?: boolean;
|
|
38
|
+
}): DrawInputPointGuardState;
|
|
33
39
|
export declare function sampleDrawPoints(points: readonly DrawShapePoint[], options: DrawPointSamplingOptions): DrawPointSamplingResult;
|
|
34
40
|
export declare function getDrawCenterlinePathFromPoints(points: readonly DrawShapePoint[]): string | null;
|
|
35
41
|
export declare function getClosedDrawCenterlinePathFromPoints(points: readonly DrawShapePoint[]): string | null;
|