@yuzhouu/canvas-kit 0.1.10 → 0.1.11
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 +82 -35
- 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/actions.d.ts +19 -2
- package/_vendor/canvas-plugin-sdk/capability.d.ts +16 -0
- package/_vendor/canvas-plugin-sdk/chrome.d.ts +52 -0
- package/_vendor/canvas-plugin-sdk/chromeRegistry.d.ts +15 -0
- package/_vendor/canvas-plugin-sdk/exportRegistry.d.ts +9 -0
- package/_vendor/canvas-plugin-sdk/exports.d.ts +26 -0
- package/_vendor/canvas-plugin-sdk/importRegistry.d.ts +10 -0
- package/_vendor/canvas-plugin-sdk/imports.d.ts +38 -0
- package/_vendor/canvas-plugin-sdk/index.d.ts +11 -0
- package/_vendor/canvas-plugin-sdk/lifecycle.d.ts +31 -0
- package/_vendor/canvas-plugin-sdk/plugin.d.ts +54 -17
- package/_vendor/canvas-plugin-sdk/pluginUi.d.ts +37 -0
- package/_vendor/canvas-plugin-sdk/productApi.d.ts +28 -0
- package/_vendor/canvas-plugin-sdk/services.d.ts +20 -0
- package/_vendor/canvas-plugin-sdk/toolbar.d.ts +26 -4
- package/_vendor/canvas-plugin-sdk/toolbarRegistry.d.ts +5 -6
- 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-builtin-clipboard/clipboardChromeContributions.d.ts +2 -0
- package/{features/clipboard → _vendor/plugin-builtin-clipboard}/clipboardContextMenuContributions.d.ts +1 -1
- package/{features/clipboard → _vendor/plugin-builtin-clipboard}/clipboardContribution.d.ts +2 -3
- package/{features/clipboard → _vendor/plugin-builtin-clipboard}/clipboardService.d.ts +3 -3
- package/_vendor/plugin-builtin-clipboard/index.d.ts +3 -0
- package/_vendor/plugin-builtin-clipboard/plugin.d.ts +1 -0
- package/_vendor/plugin-builtin-export/blobDataUrl.d.ts +1 -0
- package/_vendor/plugin-builtin-export/canvasExportApi.d.ts +43 -0
- package/_vendor/plugin-builtin-export/index.d.ts +8 -0
- package/_vendor/plugin-builtin-export/plugin.d.ts +5 -0
- package/_vendor/plugin-builtin-export/pngExport.d.ts +15 -0
- package/{features/export → _vendor/plugin-builtin-export}/svgExport.d.ts +9 -2
- package/_vendor/plugin-builtin-import-host/CanvasImportHost.d.ts +3 -0
- package/_vendor/plugin-builtin-import-host/capability.d.ts +1 -0
- package/_vendor/plugin-builtin-import-host/index.d.ts +2 -0
- package/_vendor/plugin-builtin-import-host/plugin.d.ts +1 -0
- package/_vendor/plugin-builtin-tool-actions/capability.d.ts +1 -0
- package/_vendor/plugin-builtin-tool-actions/index.d.ts +2 -0
- package/_vendor/plugin-builtin-tool-actions/plugin.d.ts +1 -0
- package/_vendor/plugin-builtin-tool-actions/toolActions.d.ts +2 -0
- package/_vendor/plugin-connector/canvasRender.d.ts +2 -0
- package/_vendor/plugin-connector/connectorBindingUtil.d.ts +28 -0
- package/_vendor/plugin-connector/connectorBindings.d.ts +8 -0
- package/_vendor/plugin-connector/connectorGeometry.d.ts +70 -0
- package/_vendor/plugin-connector/connectorHandles.d.ts +12 -0
- package/_vendor/plugin-connector/connectorInteractions.d.ts +3 -0
- package/_vendor/plugin-connector/connectorMarker.d.ts +7 -0
- package/_vendor/plugin-connector/connectorModel.d.ts +43 -0
- package/_vendor/plugin-connector/connectorPortInteraction.d.ts +13 -0
- package/_vendor/plugin-connector/connectorPorts.d.ts +23 -0
- package/_vendor/plugin-connector/connectorRuntime.d.ts +62 -0
- package/_vendor/plugin-connector/connectorShapeUtil.d.ts +29 -0
- package/_vendor/plugin-connector/connectorTool.d.ts +4 -0
- package/_vendor/plugin-connector/constants.d.ts +17 -0
- package/_vendor/plugin-connector/editorRuntime.d.ts +7 -0
- package/_vendor/plugin-connector/feature.d.ts +4 -0
- package/_vendor/plugin-connector/index.d.ts +18 -0
- package/_vendor/plugin-connector/orthogonalRoute.d.ts +9 -0
- package/_vendor/plugin-connector/productRuntime.d.ts +2 -0
- package/_vendor/plugin-connector/quickConnect.d.ts +28 -0
- package/_vendor/plugin-connector/types.d.ts +51 -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/index.d.ts +2 -1
- package/_vendor/plugin-group/productRuntime.d.ts +2 -0
- package/_vendor/plugin-image/editorRuntime.d.ts +0 -4
- package/_vendor/plugin-image/feature.d.ts +2 -2
- package/_vendor/plugin-image/index.d.ts +2 -1
- package/_vendor/plugin-image/productRuntime.d.ts +4 -0
- package/_vendor/plugin-image/styleRuntime.d.ts +5 -0
- 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/{builtins/controller/packagingController.d.ts → _vendor/plugin-packaging/api.d.ts} +13 -10
- package/_vendor/plugin-packaging/feature.d.ts +2 -2
- package/_vendor/plugin-packaging/index.d.ts +3 -1
- package/_vendor/plugin-packaging/productRuntime.d.ts +2 -2
- 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-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/useToolbarSurfaces.d.ts +9 -10
- package/chrome/types.d.ts +11 -8
- package/chrome/useCanvasKitChromeContext.d.ts +4 -7
- package/chrome/useChromeSurfaces.d.ts +12 -0
- 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/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 +7 -8
- 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 +28 -18
- package/index.mjs +111 -84
- package/package.json +1 -1
- package/plugins/standardCanvasKitPlugins.d.ts +16 -0
- package/runtime/canvasKitPluginContracts.d.ts +31 -76
- package/runtime/canvasKitPluginSetup.d.ts +32 -0
- package/runtime/canvasKitResourceScope.d.ts +5 -0
- package/runtime/canvasKitRuntime.d.ts +9 -7
- package/runtime/canvasKitRuntimeContracts.d.ts +2 -5
- package/runtime/persistenceCoordinator.d.ts +33 -0
- 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/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/features/actions/actionRuntime.d.ts +0 -16
- 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/selectionActions.d.ts +0 -19
- 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/viewActions.d.ts +0 -5
- 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
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Editor } from "../canvas-core/index";
|
|
2
|
+
import type { CanvasActionContext } from "./actions";
|
|
3
|
+
import type { ChromeChannel, ChromeContribution, ChromeSection } from "./chrome";
|
|
4
|
+
export declare class CanvasChromeRegistry {
|
|
5
|
+
private readonly contributions;
|
|
6
|
+
private readonly channels;
|
|
7
|
+
private readonly contributionsByChannel;
|
|
8
|
+
private stateRevision;
|
|
9
|
+
constructor(contributions?: readonly ChromeContribution[]);
|
|
10
|
+
getChannels(): readonly ChromeChannel[];
|
|
11
|
+
getStateRevision(): number;
|
|
12
|
+
subscribeToState(editor: Editor, listener: () => void): () => void;
|
|
13
|
+
getSections(channel: ChromeChannel, context: CanvasActionContext): ChromeSection[];
|
|
14
|
+
}
|
|
15
|
+
export declare function createCanvasChromeRegistry(contributions?: readonly ChromeContribution[]): CanvasChromeRegistry;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CanvasExportArtifact, CanvasExportContribution, CanvasExportFormat, CanvasExportProviderInput } from "./exports";
|
|
2
|
+
export declare class CanvasExportRegistry {
|
|
3
|
+
private readonly contributionsByFormat;
|
|
4
|
+
constructor(contributions?: readonly CanvasExportContribution[]);
|
|
5
|
+
getFormats(): readonly CanvasExportFormat[];
|
|
6
|
+
hasFormat(format: string): boolean;
|
|
7
|
+
export(format: string, input: CanvasExportProviderInput): Promise<CanvasExportArtifact>;
|
|
8
|
+
}
|
|
9
|
+
export declare function createCanvasExportRegistry(contributions?: readonly CanvasExportContribution[]): CanvasExportRegistry;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CanvasImportContext, CanvasImportContribution, CanvasImportPreview, CanvasImportRequest, CanvasImportResult } from "./imports";
|
|
2
|
+
export declare class CanvasImportRegistry {
|
|
3
|
+
private readonly contributions;
|
|
4
|
+
constructor(contributions?: readonly CanvasImportContribution[]);
|
|
5
|
+
getContributions(): readonly CanvasImportContribution[];
|
|
6
|
+
canImport(request: CanvasImportRequest): boolean;
|
|
7
|
+
canImportPreview(preview: CanvasImportPreview): boolean;
|
|
8
|
+
import(request: CanvasImportRequest, context: CanvasImportContext): Promise<CanvasImportResult>;
|
|
9
|
+
}
|
|
10
|
+
export declare function createCanvasImportRegistry(contributions?: readonly CanvasImportContribution[]): CanvasImportRegistry;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
export * from "./actions";
|
|
2
2
|
export * from "./actionRegistry";
|
|
3
|
+
export * from "./capability";
|
|
4
|
+
export * from "./chrome";
|
|
5
|
+
export * from "./chromeRegistry";
|
|
3
6
|
export * from "./contextMenu";
|
|
4
7
|
export * from "./contextMenuRegistry";
|
|
8
|
+
export * from "./exports";
|
|
9
|
+
export * from "./exportRegistry";
|
|
10
|
+
export * from "./imports";
|
|
11
|
+
export * from "./importRegistry";
|
|
12
|
+
export * from "./lifecycle";
|
|
5
13
|
export * from "./plugin";
|
|
14
|
+
export * from "./pluginUi";
|
|
15
|
+
export * from "./productApi";
|
|
16
|
+
export * from "./services";
|
|
6
17
|
export * from "./toolbar";
|
|
7
18
|
export * from "./toolbarRegistry";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Editor } from "../canvas-core/index";
|
|
2
|
+
import type { CanvasActionContext } from "./actions";
|
|
3
|
+
import type { ProductServiceRegistry } from "./services";
|
|
4
|
+
export interface CanvasPluginPersistence {
|
|
5
|
+
flush(): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export interface CanvasPluginStartupResult {
|
|
8
|
+
documentSource: "restored" | "seeded" | "empty";
|
|
9
|
+
sessionRestored: boolean;
|
|
10
|
+
warnings: readonly unknown[];
|
|
11
|
+
}
|
|
12
|
+
export interface CanvasPluginBeforeReadyContext {
|
|
13
|
+
editor: Editor;
|
|
14
|
+
persistence: CanvasPluginPersistence | null;
|
|
15
|
+
productId: string;
|
|
16
|
+
signal: AbortSignal;
|
|
17
|
+
startup: CanvasPluginStartupResult;
|
|
18
|
+
services: ProductServiceRegistry;
|
|
19
|
+
}
|
|
20
|
+
export interface CanvasPluginBeforeCommandContext {
|
|
21
|
+
commandId: string;
|
|
22
|
+
context?: CanvasActionContext;
|
|
23
|
+
editor: Editor;
|
|
24
|
+
}
|
|
25
|
+
export type CanvasPluginBeforeReady = (context: CanvasPluginBeforeReadyContext) => Promise<void> | void;
|
|
26
|
+
export type CanvasPluginBeforeCommand = (context: CanvasPluginBeforeCommandContext) => void;
|
|
27
|
+
export interface CanvasPluginLifecycleSetup {
|
|
28
|
+
beforeCommand(hook: CanvasPluginBeforeCommand): void;
|
|
29
|
+
beforeReady(hook: CanvasPluginBeforeReady): void;
|
|
30
|
+
defer(dispose: () => void): void;
|
|
31
|
+
}
|
|
@@ -1,39 +1,76 @@
|
|
|
1
|
-
import type { EditorPlugin, KeyboardShortcutInput, ShapeRecordBase } from "../canvas-core/index";
|
|
1
|
+
import type { EditorPlugin, Editor, KeyboardShortcutInput, ShapeRecordBase } from "../canvas-core/index";
|
|
2
2
|
import type { CanvasRenderPlugin } from "../canvas-react/host/index";
|
|
3
3
|
import type { CanvasAction } from "./actions";
|
|
4
4
|
import type { ContextMenuContribution } from "./contextMenu";
|
|
5
|
+
import type { CanvasPluginChromeSetup } from "./chrome";
|
|
6
|
+
import type { CanvasPluginImportSetup } from "./imports";
|
|
7
|
+
import type { CanvasPluginExportSetup } from "./exports";
|
|
8
|
+
import type { CanvasPluginLifecycleSetup, CanvasPluginPersistence } from "./lifecycle";
|
|
9
|
+
import type { CanvasPluginUiSetup } from "./pluginUi";
|
|
10
|
+
import type { ProductServiceSetup } from "./services";
|
|
5
11
|
import type { ToolbarContribution } from "./toolbar";
|
|
12
|
+
import type { CanvasPluginApi, CanvasPluginApiContext } from "./productApi";
|
|
13
|
+
import { type CanvasPluginCapabilitySetup, type CanvasPluginCapabilityToken } from "./capability";
|
|
6
14
|
export interface CanvasActionShortcut {
|
|
7
15
|
actionId: string;
|
|
8
16
|
shortcut: KeyboardShortcutInput;
|
|
9
17
|
}
|
|
10
|
-
export interface
|
|
11
|
-
actions
|
|
12
|
-
|
|
13
|
-
toolbarContributions?: readonly ToolbarContribution[];
|
|
14
|
-
contextMenuContributions?: readonly ContextMenuContribution[];
|
|
18
|
+
export interface CanvasPluginActionSetup {
|
|
19
|
+
add(...actions: readonly CanvasAction[]): void;
|
|
20
|
+
addShortcuts(...shortcuts: readonly CanvasActionShortcut[]): void;
|
|
15
21
|
}
|
|
16
|
-
export
|
|
17
|
-
|
|
22
|
+
export interface CanvasPluginToolbarSetup {
|
|
23
|
+
add(...contributions: readonly ToolbarContribution[]): void;
|
|
24
|
+
}
|
|
25
|
+
export interface CanvasPluginContextMenuSetup {
|
|
26
|
+
add(...contributions: readonly ContextMenuContribution[]): void;
|
|
27
|
+
}
|
|
28
|
+
export interface CanvasPluginApiSetup<TApiContext extends CanvasPluginApiContext = CanvasPluginApiContext> {
|
|
29
|
+
add<TApi>(api: CanvasPluginApi<TApi, TApiContext>): void;
|
|
30
|
+
}
|
|
31
|
+
export interface CanvasPluginSetupContext<TApiContext extends CanvasPluginApiContext = CanvasPluginApiContext> {
|
|
32
|
+
readonly actions: CanvasPluginActionSetup;
|
|
33
|
+
readonly apis: CanvasPluginApiSetup<TApiContext>;
|
|
34
|
+
readonly capabilities: CanvasPluginCapabilitySetup;
|
|
35
|
+
readonly chrome: CanvasPluginChromeSetup;
|
|
36
|
+
readonly contextMenu: CanvasPluginContextMenuSetup;
|
|
37
|
+
readonly editor: Editor;
|
|
38
|
+
readonly exports: CanvasPluginExportSetup;
|
|
39
|
+
readonly imports: CanvasPluginImportSetup;
|
|
40
|
+
readonly lifecycle: CanvasPluginLifecycleSetup;
|
|
41
|
+
readonly persistence: CanvasPluginPersistence | null;
|
|
42
|
+
readonly productId: string;
|
|
43
|
+
readonly services: ProductServiceSetup;
|
|
44
|
+
readonly toolbar: CanvasPluginToolbarSetup;
|
|
45
|
+
readonly ui: CanvasPluginUiSetup;
|
|
46
|
+
}
|
|
47
|
+
export type CanvasPluginSetup<TContext extends CanvasPluginSetupContext = CanvasPluginSetupContext> = (context: TContext) => void;
|
|
48
|
+
type CanvasPluginSetupLike = (context: never) => unknown;
|
|
18
49
|
export interface CanvasPluginReference {
|
|
19
50
|
readonly id: string;
|
|
51
|
+
readonly __canvasPluginReferenceBrand: "CanvasPluginReference";
|
|
20
52
|
}
|
|
21
|
-
export
|
|
53
|
+
export type CanvasPluginRequirement = CanvasPluginReference | CanvasPluginCapabilityToken;
|
|
54
|
+
export interface CanvasPluginDefinition<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup> {
|
|
22
55
|
readonly id: string;
|
|
23
|
-
readonly
|
|
56
|
+
readonly provides?: readonly CanvasPluginCapabilityToken[];
|
|
57
|
+
readonly requires?: readonly CanvasPluginRequirement[];
|
|
24
58
|
readonly editor?: EditorPlugin;
|
|
25
59
|
readonly render?: CanvasRenderPlugin;
|
|
26
|
-
readonly
|
|
60
|
+
readonly setup?: TSetup;
|
|
61
|
+
}
|
|
62
|
+
export interface CanvasPlugin<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup> extends CanvasPluginDefinition<TSetup>, CanvasPluginReference {
|
|
27
63
|
}
|
|
28
|
-
export type CanvasPluginInput<
|
|
29
|
-
export interface CompiledCanvasPlugins<
|
|
30
|
-
readonly plugins: readonly CanvasPlugin<
|
|
64
|
+
export type CanvasPluginInput<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup> = CanvasPlugin<TSetup> | readonly CanvasPluginInput<TSetup>[];
|
|
65
|
+
export interface CompiledCanvasPlugins<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup> {
|
|
66
|
+
readonly plugins: readonly CanvasPlugin<TSetup>[];
|
|
31
67
|
readonly pluginIds: readonly string[];
|
|
32
68
|
readonly editorPlugins: readonly EditorPlugin[];
|
|
33
69
|
readonly renderPlugins: readonly CanvasRenderPlugin[];
|
|
34
|
-
readonly productFactories: readonly TProductFactory[];
|
|
35
70
|
readonly shapeTypes: readonly ShapeRecordBase["type"][];
|
|
36
71
|
}
|
|
37
|
-
export declare function defineCanvasPlugin<
|
|
38
|
-
export declare function compileCanvasPlugins<
|
|
72
|
+
export declare function defineCanvasPlugin<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup>(plugin: CanvasPluginDefinition<TSetup>): CanvasPlugin<TSetup>;
|
|
73
|
+
export declare function compileCanvasPlugins<TSetup extends CanvasPluginSetupLike>(input: readonly CanvasPluginInput<TSetup>[]): CompiledCanvasPlugins<TSetup>;
|
|
74
|
+
export declare function assertValidCanvasPluginGraph<TSetup extends CanvasPluginSetupLike>(input: readonly CanvasPluginInput<TSetup>[]): void;
|
|
75
|
+
export declare function hasCanvasPluginCapabilityProvider<TSetup extends CanvasPluginSetupLike>(input: readonly CanvasPluginInput<TSetup>[], token: CanvasPluginCapabilityToken): boolean;
|
|
39
76
|
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Editor } from "../canvas-core/index";
|
|
2
|
+
import type { ComponentType, ReactNode } from "react";
|
|
3
|
+
import type { CanvasActionContext } from "./actions";
|
|
4
|
+
import type { CanvasActionRegistry } from "./actionRegistry";
|
|
5
|
+
import type { CanvasImportRegistry } from "./importRegistry";
|
|
6
|
+
import type { ProductServiceRegistry } from "./services";
|
|
7
|
+
export interface CanvasCommandInput<TResult> {
|
|
8
|
+
commandId: string;
|
|
9
|
+
context?: CanvasActionContext;
|
|
10
|
+
run(): TResult;
|
|
11
|
+
}
|
|
12
|
+
export type ExecuteCanvasCommand = <TResult>(input: CanvasCommandInput<TResult>) => TResult;
|
|
13
|
+
export interface CanvasPluginComponentProps {
|
|
14
|
+
actionRegistry: CanvasActionRegistry;
|
|
15
|
+
editor: Editor;
|
|
16
|
+
executeCommand: ExecuteCanvasCommand;
|
|
17
|
+
getHostElement(): HTMLElement | null;
|
|
18
|
+
imports: CanvasImportRegistry;
|
|
19
|
+
services: ProductServiceRegistry;
|
|
20
|
+
}
|
|
21
|
+
export interface CanvasPluginProvider {
|
|
22
|
+
id: string;
|
|
23
|
+
order?: number;
|
|
24
|
+
component: ComponentType<{
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
export interface CanvasPluginComponent {
|
|
29
|
+
id: string;
|
|
30
|
+
order?: number;
|
|
31
|
+
component: ComponentType<CanvasPluginComponentProps>;
|
|
32
|
+
}
|
|
33
|
+
export interface CanvasPluginUiSetup {
|
|
34
|
+
addComponents(...components: readonly CanvasPluginComponent[]): void;
|
|
35
|
+
addProviders(...providers: readonly CanvasPluginProvider[]): void;
|
|
36
|
+
allowPropertiesDuringEditing(predicate: (context: CanvasActionContext) => boolean): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Editor, ShapeId } from "../canvas-core/index";
|
|
2
|
+
import type { CanvasPluginCapabilityRegistry, CanvasPluginCapabilityToken } from "./capability";
|
|
3
|
+
import type { CanvasExportRegistry } from "./exportRegistry";
|
|
4
|
+
export interface ProductApiToken<TApi> extends CanvasPluginCapabilityToken<TApi, "api"> {
|
|
5
|
+
readonly __api?: TApi;
|
|
6
|
+
}
|
|
7
|
+
export interface ProductApiRegistry {
|
|
8
|
+
get<TApi>(token: ProductApiToken<TApi>): TApi | null;
|
|
9
|
+
}
|
|
10
|
+
export interface ProductApiRegistryRuntime extends ProductApiRegistry {
|
|
11
|
+
register<TApi>(token: ProductApiToken<TApi>, api: TApi): void;
|
|
12
|
+
}
|
|
13
|
+
export interface CanvasShapeRef<TType extends string = string> {
|
|
14
|
+
id: ShapeId;
|
|
15
|
+
type: TType;
|
|
16
|
+
}
|
|
17
|
+
export interface CanvasPluginApiContext {
|
|
18
|
+
apis: ProductApiRegistry;
|
|
19
|
+
capabilities: CanvasPluginCapabilityRegistry;
|
|
20
|
+
editor: Editor;
|
|
21
|
+
exportRegistry: CanvasExportRegistry;
|
|
22
|
+
}
|
|
23
|
+
export interface CanvasPluginApi<TApi, TContext extends CanvasPluginApiContext = CanvasPluginApiContext> {
|
|
24
|
+
token: ProductApiToken<TApi>;
|
|
25
|
+
create(context: TContext): TApi | null;
|
|
26
|
+
}
|
|
27
|
+
export declare function createProductApiToken<TApi>(id: string): ProductApiToken<TApi>;
|
|
28
|
+
export declare function createProductApiRegistry(): ProductApiRegistryRuntime;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CanvasPluginCapabilityToken } from "./capability";
|
|
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 function createProductServiceToken<TService>(id: string): ProductServiceToken<TService>;
|
|
20
|
+
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,22 @@ 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 ToolbarGroupSource {
|
|
144
|
+
groups: readonly ToolbarGroup[];
|
|
145
|
+
groupIdPrefix?: string;
|
|
146
|
+
}
|
|
147
|
+
export declare function mergeToolbarGroups(sources: readonly ToolbarGroupSource[], options?: {
|
|
148
|
+
dedupeActionIdsAcrossSources?: boolean;
|
|
149
|
+
}): ToolbarGroup[];
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import type { Editor } from "../canvas-core/index";
|
|
2
2
|
import type { CanvasActionContext } from "./actions";
|
|
3
|
-
import type { ToolbarContribution, ToolbarGroup
|
|
3
|
+
import type { ToolbarChannel, ToolbarContribution, ToolbarGroup } from "./toolbar";
|
|
4
4
|
export declare class CanvasToolbarRegistry {
|
|
5
5
|
private readonly contributions;
|
|
6
|
-
private readonly
|
|
7
|
-
private readonly
|
|
6
|
+
private readonly channels;
|
|
7
|
+
private readonly contributionsByChannel;
|
|
8
8
|
private readonly contributionIndexes;
|
|
9
9
|
private nextContributionIndex;
|
|
10
10
|
private stateRevision;
|
|
11
11
|
registerContribution(contribution: ToolbarContribution): void;
|
|
12
12
|
getStateRevision(): number;
|
|
13
13
|
subscribeToState(editor: Editor, listener: () => void): () => void;
|
|
14
|
-
getGroups(
|
|
15
|
-
|
|
16
|
-
}): ToolbarGroup[];
|
|
14
|
+
getGroups(channel: ToolbarChannel, context: CanvasActionContext): ToolbarGroup[];
|
|
15
|
+
getChannels(): readonly ToolbarChannel[];
|
|
17
16
|
private addToIndexes;
|
|
18
17
|
}
|
|
19
18
|
export declare function createCanvasToolbarRegistry(contributions?: readonly ToolbarContribution[]): CanvasToolbarRegistry;
|
|
@@ -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-plugin-sdk/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-plugin-sdk/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";
|