@yuzhouu/canvas-kit 0.1.8 → 0.1.10
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 +158 -102
- package/_vendor/canvas-core/bindings/bindingUtil.d.ts +8 -0
- package/_vendor/canvas-core/editor/cameraPanSession.d.ts +9 -0
- package/_vendor/canvas-core/editor/canvasPanInteraction.d.ts +2 -0
- package/_vendor/canvas-core/editor/commands.d.ts +15 -3
- package/_vendor/canvas-core/editor/createEditorWithPlugins.d.ts +6 -0
- package/_vendor/canvas-core/editor/editor.d.ts +24 -26
- package/_vendor/canvas-core/editor/editorComputedHelpers.d.ts +4 -2
- package/_vendor/canvas-core/editor/historyManager.d.ts +22 -1
- package/_vendor/canvas-core/editor/index.d.ts +2 -2
- package/_vendor/canvas-core/editor/interactions.d.ts +10 -1
- package/_vendor/canvas-core/editor/managers/bindingManager.d.ts +1 -0
- package/_vendor/canvas-core/editor/managers/inputsManager.d.ts +3 -0
- package/_vendor/canvas-core/editor/managers/interactionTransientManager.d.ts +0 -26
- package/_vendor/canvas-core/editor/managers/queryManager.d.ts +13 -1
- package/_vendor/canvas-core/editor/managers/selectionLayoutManager.d.ts +2 -0
- package/_vendor/canvas-core/editor/managers/shapeGeometryManager.d.ts +3 -2
- package/_vendor/canvas-core/editor/managers/shapeHierarchyManager.d.ts +6 -2
- package/_vendor/canvas-core/editor/managers/shapeReparenting.d.ts +3 -2
- package/_vendor/canvas-core/editor/managers/snapTypes.d.ts +1 -0
- package/_vendor/canvas-core/editor/managers/spatialIndexManager.d.ts +1 -0
- package/_vendor/canvas-core/editor/queries/shapeTransforms.d.ts +32 -12
- package/_vendor/canvas-core/editor/selection.d.ts +19 -5
- package/_vendor/canvas-core/editor/selectionOverlay.d.ts +4 -3
- package/_vendor/canvas-core/editor/selectionResizeCapabilities.d.ts +9 -0
- package/_vendor/canvas-core/editor/shapeTransformSpace.d.ts +6 -0
- package/_vendor/canvas-core/exports/svg.d.ts +1 -0
- package/_vendor/canvas-core/geometry/index.d.ts +1 -0
- package/_vendor/canvas-core/geometry/mat.d.ts +6 -2
- package/_vendor/canvas-core/geometry/polygon.d.ts +7 -0
- package/_vendor/canvas-core/geometry/vec.d.ts +0 -2
- package/_vendor/canvas-core/index.d.ts +14 -20
- package/_vendor/canvas-core/plugins/editorRuntimePlugin.d.ts +4 -10
- package/_vendor/canvas-core/plugins/editorRuntimeRegistry.d.ts +19 -0
- package/_vendor/canvas-core/plugins/index.d.ts +2 -1
- package/_vendor/canvas-core/schema/records.d.ts +2 -7
- package/_vendor/canvas-core/schema/snapshots.d.ts +10 -19
- package/_vendor/canvas-core/shapes/colors.d.ts +1 -2
- package/_vendor/canvas-core/shapes/shapeUtil.d.ts +52 -14
- package/_vendor/canvas-core/tools/select/selectToolHelpers.d.ts +9 -6
- package/_vendor/canvas-core/tools/select/states/draggingSelectionHandleInteractionState.d.ts +3 -3
- package/_vendor/canvas-core/tools/select/states/pointingSelectionHandleInteractionState.d.ts +2 -1
- package/_vendor/canvas-plugin-sdk/actionRegistry.d.ts +7 -0
- package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/actions.d.ts +2 -4
- package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/contextMenu.d.ts +25 -30
- package/_vendor/canvas-plugin-sdk/contextMenuRegistry.d.ts +11 -0
- package/_vendor/canvas-plugin-sdk/index.d.ts +7 -0
- package/_vendor/canvas-plugin-sdk/plugin.d.ts +39 -0
- package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/toolbar.d.ts +32 -1
- package/_vendor/canvas-plugin-sdk/toolbarRegistry.d.ts +19 -0
- package/_vendor/canvas-react/components/CanvasView.d.ts +2 -2
- package/_vendor/canvas-react/components/canvasKeyboardEvents.d.ts +13 -0
- package/_vendor/canvas-react/components/useCanvasDomEvents.d.ts +4 -3
- package/_vendor/canvas-react/contextMenuRequest.d.ts +19 -0
- package/_vendor/canvas-react/host/canvasRenderPlugin.d.ts +7 -1
- package/_vendor/canvas-react/host/canvasRenderRuntime.d.ts +13 -0
- package/_vendor/canvas-react/host/domEventGuards.d.ts +3 -3
- package/_vendor/canvas-react/host/index.d.ts +2 -8
- package/_vendor/canvas-react/host/overlayRegistry.d.ts +3 -3
- package/_vendor/canvas-react/host/rendererRegistry.d.ts +7 -4
- package/_vendor/canvas-react/index.d.ts +1 -0
- package/_vendor/plugin-arrow/arrowGeometry.d.ts +6 -4
- package/_vendor/plugin-arrow/arrowShapeUtil.d.ts +5 -3
- package/_vendor/plugin-arrow/arrowTerminalCommands.d.ts +2 -2
- package/_vendor/plugin-arrow/canvasRender.d.ts +2 -2
- package/_vendor/plugin-arrow/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-arrow/feature.d.ts +2 -3
- package/_vendor/plugin-arrow/index.d.ts +2 -2
- package/_vendor/plugin-draw/canvasRender.d.ts +2 -2
- package/_vendor/plugin-draw/drawGeometry.d.ts +4 -7
- package/_vendor/plugin-draw/drawShapeUtil.d.ts +2 -2
- package/_vendor/plugin-draw/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-draw/feature.d.ts +2 -3
- package/_vendor/plugin-draw/index.d.ts +3 -3
- package/_vendor/plugin-eraser/canvasRender.d.ts +2 -2
- package/_vendor/plugin-eraser/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-eraser/eraserRuntime.d.ts +12 -0
- package/_vendor/plugin-eraser/feature.d.ts +2 -3
- package/_vendor/plugin-eraser/index.d.ts +3 -2
- package/_vendor/plugin-frame/canvasRender.d.ts +2 -2
- package/_vendor/plugin-frame/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-frame/feature.d.ts +2 -3
- package/_vendor/plugin-frame/frameShapeUtil.d.ts +4 -2
- package/_vendor/plugin-frame/index.d.ts +2 -2
- package/_vendor/plugin-geo/canvasRender.d.ts +2 -2
- package/_vendor/plugin-geo/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-geo/feature.d.ts +2 -3
- package/_vendor/plugin-geo/geoShapeUtil.d.ts +1 -1
- package/_vendor/plugin-geo/index.d.ts +2 -2
- package/_vendor/plugin-group/canvasRender.d.ts +2 -2
- package/_vendor/plugin-group/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-group/feature.d.ts +2 -3
- package/_vendor/plugin-group/groupContributions.d.ts +7 -0
- package/_vendor/plugin-group/groupShapeUtil.d.ts +24 -5
- package/_vendor/plugin-group/index.d.ts +3 -2
- package/_vendor/plugin-image/canvasRender.d.ts +2 -2
- package/_vendor/plugin-image/cropRuntime.d.ts +1 -1
- package/_vendor/plugin-image/cropSession.d.ts +5 -3
- package/_vendor/plugin-image/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-image/feature.d.ts +2 -3
- package/_vendor/plugin-image/imageHostActionContract.d.ts +1 -1
- package/_vendor/plugin-image/imageShapeUtil.d.ts +3 -3
- package/_vendor/plugin-image/index.d.ts +4 -4
- package/_vendor/plugin-image/runtimeShared.d.ts +1 -1
- package/_vendor/plugin-image/smudge.d.ts +13 -2
- package/_vendor/plugin-image/smudgeRuntime.d.ts +1 -1
- package/_vendor/plugin-image/styleRuntime.d.ts +1 -1
- package/_vendor/plugin-image/toolbarRuntime.d.ts +1 -1
- package/_vendor/plugin-laser/canvasRender.d.ts +2 -2
- package/_vendor/plugin-laser/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-laser/feature.d.ts +2 -3
- package/_vendor/plugin-laser/index.d.ts +3 -2
- package/_vendor/plugin-laser/laserRuntime.d.ts +18 -0
- package/_vendor/plugin-packaging/canvasRender.d.ts +2 -0
- package/_vendor/plugin-packaging/editorRuntime.d.ts +2 -0
- package/_vendor/plugin-packaging/feature.d.ts +2 -0
- package/_vendor/plugin-packaging/index.d.ts +17 -0
- package/_vendor/plugin-packaging/packagingArtwork.d.ts +5 -0
- package/_vendor/plugin-packaging/packagingDxf.d.ts +9 -0
- package/_vendor/plugin-packaging/packagingGeometry.d.ts +74 -0
- package/_vendor/plugin-packaging/packagingInteractions.d.ts +2 -0
- package/_vendor/plugin-packaging/packagingPdfExporter.d.ts +25 -0
- package/_vendor/plugin-packaging/packagingRuntime.d.ts +11 -0
- package/_vendor/plugin-packaging/packagingShapeUtil.d.ts +34 -0
- package/_vendor/plugin-packaging/packagingStyle.d.ts +10 -0
- package/_vendor/plugin-packaging/packagingSvgExporter.d.ts +7 -0
- package/_vendor/plugin-packaging/productRuntime.d.ts +2 -0
- package/_vendor/plugin-packaging/types.d.ts +168 -0
- package/_vendor/plugin-packaging/validation.d.ts +3 -0
- package/_vendor/plugin-path/PathDraftOverlay.d.ts +1 -0
- package/_vendor/plugin-path/PathEditInsertPreviewOverlay.d.ts +1 -0
- package/_vendor/plugin-path/PathShapeRenderer.d.ts +12 -0
- package/_vendor/plugin-path/canvasRender.d.ts +2 -0
- package/_vendor/plugin-path/editorRuntime.d.ts +21 -0
- package/_vendor/plugin-path/feature.d.ts +2 -0
- package/_vendor/plugin-path/index.d.ts +7 -0
- package/_vendor/plugin-path/pathBoolean.d.ts +13 -0
- package/_vendor/plugin-path/pathDraft.d.ts +10 -0
- package/_vendor/plugin-path/pathEditPreview.d.ts +11 -0
- package/_vendor/plugin-path/pathEditSelection.d.ts +24 -0
- package/_vendor/plugin-path/pathEditSnap.d.ts +6 -0
- package/_vendor/plugin-path/pathGeometry.d.ts +74 -0
- package/_vendor/plugin-path/pathHandles.d.ts +18 -0
- package/_vendor/plugin-path/pathInteractions.d.ts +7 -0
- package/_vendor/plugin-path/pathShapeUtil.d.ts +28 -0
- package/_vendor/plugin-path/pathSvg.d.ts +3 -0
- package/_vendor/plugin-path/pathTool.d.ts +39 -0
- package/_vendor/plugin-path/types.d.ts +36 -0
- package/_vendor/plugin-text/arrowLabelBindingUtil.d.ts +6 -1
- package/_vendor/plugin-text/canvasRender.d.ts +6 -3
- package/_vendor/plugin-text/editorRuntime.d.ts +9 -3
- package/_vendor/plugin-text/feature.d.ts +4 -4
- package/_vendor/plugin-text/geoLabelBindingUtil.d.ts +6 -1
- package/_vendor/plugin-text/host/RichTextEditingBox.d.ts +4 -1
- package/_vendor/plugin-text/host/TiptapTextEditor.d.ts +5 -2
- package/_vendor/plugin-text/host/richTextRendering.d.ts +0 -1
- package/_vendor/plugin-text/host/textFormattingApi.d.ts +16 -0
- package/_vendor/plugin-text/host/textShapeRendererRuntime.d.ts +3 -1
- package/_vendor/plugin-text/host/tiptapTextEditorController.d.ts +4 -1
- package/_vendor/plugin-text/index.d.ts +7 -4
- package/_vendor/plugin-text/richTextUtils.d.ts +6 -0
- package/_vendor/plugin-text/shapeWideTextFormatting.d.ts +8 -0
- package/_vendor/plugin-text/textFonts.d.ts +6 -3
- package/_vendor/plugin-text/textFormatting.d.ts +45 -0
- package/_vendor/plugin-text/textFormattingSession.d.ts +6 -0
- package/_vendor/plugin-text/textLabelHelpers.d.ts +9 -4
- package/_vendor/plugin-text/textLinkPopoverPresentation.d.ts +18 -0
- package/_vendor/plugin-text/textShapeHelpers.d.ts +1 -0
- package/_vendor/plugin-text/textShapeUtil.d.ts +5 -4
- package/_vendor/signals/effect.d.ts +0 -4
- package/_vendor/signals/index.d.ts +1 -1
- package/_vendor/store/store.d.ts +4 -0
- package/browser/persistence.d.ts +5 -16
- package/builtins/controller/createBuiltInCanvasController.d.ts +2 -0
- package/builtins/controller/packagingController.d.ts +71 -0
- package/builtins/index.d.ts +4 -2
- package/builtins/plugins.d.ts +16 -0
- package/chrome/floating/CanvasKitFloatingPortal.d.ts +6 -0
- package/chrome/floating/useCanvasKitFloatingPosition.d.ts +11 -0
- package/chrome/toolbar/CanvasKitFloatingToolbarLayer.d.ts +1 -1
- package/chrome/toolbar/toolbarLabels.d.ts +1 -1
- package/chrome/toolbar/useToolbarSurfaces.d.ts +6 -10
- package/chrome/types.d.ts +5 -10
- package/chrome/useCanvasKitChromeContext.d.ts +13 -13
- package/chrome/useContextMenuSurface.d.ts +4 -4
- package/chrome/useHistoryControls.d.ts +3 -3
- package/chrome/usePageControls.d.ts +3 -3
- package/controller/canvasKitController.d.ts +5 -9
- package/core/index.d.ts +1 -2
- package/core/product-controller/canvasProductController.d.ts +2 -1
- package/core/runtime/productAssets.d.ts +4 -2
- package/core/runtime/productEditor.d.ts +1 -1
- package/core/runtime/productServices.d.ts +6 -2
- package/core/runtime/runtimeContracts.d.ts +17 -0
- package/es-DocrZgUh.mjs +2 -0
- package/features/actions/actionRuntime.d.ts +2 -7
- package/features/clipboard/clipboardContextMenuContributions.d.ts +1 -1
- package/features/clipboard/clipboardContribution.d.ts +2 -1
- package/features/clipboard/clipboardPlugin.d.ts +1 -0
- package/features/clipboard/clipboardService.d.ts +1 -1
- package/features/context-menu/contextMenuRuntime.d.ts +4 -4
- package/features/image/asset/imageAssetService.d.ts +1 -1
- package/features/image/asset/imageBlobStore.d.ts +6 -2
- package/features/image/controller/imageProductController.d.ts +1 -1
- package/features/image/imageProductPlugin.d.ts +1 -0
- package/features/image/smudge/imageSmudgeHostActions.d.ts +1 -1
- package/features/image/smudge/imageSmudgeTypes.d.ts +1 -0
- package/features/image/toolbar/imageHostActions.d.ts +13 -2
- package/features/image/toolbar/imageToolbarHostBridge.d.ts +1 -1
- package/features/keyboard/keyboardShortcutPlugin.d.ts +1 -0
- package/features/keyboard/useCanvasKitKeyboardShortcuts.d.ts +5 -3
- package/features/selection/selectionActions.d.ts +2 -3
- package/features/selection/selectionContextMenuContributions.d.ts +1 -1
- package/features/selection/selectionPlugin.d.ts +1 -0
- package/features/selection/selectionToolbarContributions.d.ts +1 -1
- package/features/text/link/TextLinkHoverPopover.d.ts +6 -0
- package/features/text/textProductPlugin.d.ts +5 -0
- package/features/tool/toolActions.d.ts +1 -1
- package/features/tool/toolContextMenuContributions.d.ts +1 -1
- package/features/tool/toolPlugin.d.ts +1 -0
- package/features/tool/toolToolbarContributions.d.ts +1 -1
- package/features/view/viewActions.d.ts +1 -1
- package/features/view/viewContextMenuContributions.d.ts +1 -1
- package/features/view/viewPlugin.d.ts +1 -0
- package/index.css +1 -1
- package/index.d.ts +23 -9
- package/index.mjs +84 -96
- package/package.json +12 -9
- package/product/standardCanvasKitPlugins.d.ts +4 -0
- package/react/CanvasKitRoot.d.ts +10 -5
- package/react/useCanvasKitControllerLifecycle.d.ts +8 -0
- package/react/useCanvasKitRuntime.d.ts +2 -4
- package/runtime/canvasKitCommandExecutor.d.ts +13 -0
- package/runtime/canvasKitPluginContracts.d.ts +79 -0
- package/runtime/canvasKitPlugins.d.ts +33 -0
- package/runtime/canvasKitRuntime.d.ts +46 -19
- package/runtime/canvasKitRuntimeContracts.d.ts +37 -0
- package/_vendor/canvas-core/editor/createEditorWithRuntimePlugins.d.ts +0 -6
- package/_vendor/canvas-core/editor/middleMousePanInteraction.d.ts +0 -2
- package/_vendor/canvas-core/schema/snapshotSupport.d.ts +0 -43
- package/_vendor/canvas-react/host/actionRegistry.d.ts +0 -15
- package/_vendor/canvas-react/host/canvasRenderPluginHost.d.ts +0 -2
- package/_vendor/canvas-react/host/canvasRenderPluginHostManifest.d.ts +0 -2
- package/_vendor/canvas-react/host/canvasRenderPluginHostRuntime.d.ts +0 -3
- package/_vendor/canvas-react/host/canvasRenderPluginHostTypes.d.ts +0 -104
- package/_vendor/canvas-react/host/canvasRenderPluginHostValidation.d.ts +0 -11
- package/_vendor/canvas-react/host/contextMenuRegistry.d.ts +0 -17
- package/_vendor/canvas-react/host/extension.d.ts +0 -37
- package/_vendor/canvas-react/host/toolbarRegistry.d.ts +0 -20
- package/_vendor/plugin-text/host/RichTextLinkPopover.d.ts +0 -14
- package/_vendor/plugin-text/host/RichTextToolbar.d.ts +0 -8
- package/_vendor/plugin-text/host/richTextBubbleMenuPositionSync.d.ts +0 -7
- package/browser/localSnapshotRestore.d.ts +0 -13
- package/builtins/extensions.d.ts +0 -18
- package/core/runtime/productDefinition.d.ts +0 -33
- package/core/runtime/productHost.d.ts +0 -20
- package/features/clipboard/clipboardHostExtension.d.ts +0 -2
- package/features/image/imageHostExtension.d.ts +0 -10
- package/features/keyboard/keyboardShortcutHostExtension.d.ts +0 -2
- package/features/persistence/CanvasKitPersistenceNotice.d.ts +0 -4
- package/features/persistence/persistenceHostExtension.d.ts +0 -2
- package/features/selection/selectionHostExtension.d.ts +0 -2
- package/features/tool/toolHostExtension.d.ts +0 -2
- package/features/view/viewHostExtension.d.ts +0 -2
- package/host/defaultHostExtensions.d.ts +0 -2
- package/product/canvasKitProduct.d.ts +0 -51
- package/react/useCanvasKitController.d.ts +0 -5
- package/react/useCanvasKitStartup.d.ts +0 -9
- package/runtime/canvasKitHostContracts.d.ts +0 -135
- package/runtime/canvasKitHostFeatureHooks.d.ts +0 -12
- package/runtime/canvasKitRuntimePlan.d.ts +0 -50
|
@@ -59,6 +59,7 @@ export interface ShapeRecordBase<Type extends string = string, Props extends obj
|
|
|
59
59
|
x: number;
|
|
60
60
|
y: number;
|
|
61
61
|
rotation: number;
|
|
62
|
+
skewX: number;
|
|
62
63
|
scaleX: number;
|
|
63
64
|
scaleY: number;
|
|
64
65
|
opacity: number;
|
|
@@ -85,9 +86,6 @@ export interface AssetRecordBase<Type extends string = string, Props extends obj
|
|
|
85
86
|
export type ShapeRecord = ShapeRecordBase<string, object>;
|
|
86
87
|
export type BindingRecord = BindingRecordBase<string, object>;
|
|
87
88
|
export type AssetRecord = AssetRecordBase<string, object>;
|
|
88
|
-
export type AnyShapeRecord = ShapeRecord;
|
|
89
|
-
export type AnyBindingRecord = BindingRecord;
|
|
90
|
-
export type AnyAssetRecord = AssetRecord;
|
|
91
89
|
export interface SessionRecord extends BaseRecord {
|
|
92
90
|
id: SessionId;
|
|
93
91
|
typeName: "session";
|
|
@@ -100,7 +98,7 @@ export interface SessionRecord extends BaseRecord {
|
|
|
100
98
|
pageCameraById: PageCameraById;
|
|
101
99
|
pageSelectedShapeIdsById: PageSelectionById;
|
|
102
100
|
}
|
|
103
|
-
export type DocumentRecord = DocumentMetadataRecord | PageRecord |
|
|
101
|
+
export type DocumentRecord = DocumentMetadataRecord | PageRecord | ShapeRecord | BindingRecord | AssetRecord;
|
|
104
102
|
export type EditorRecord = DocumentRecord | SessionRecord;
|
|
105
103
|
export declare const DEFAULT_DOCUMENT_ID: DocumentId;
|
|
106
104
|
export declare const DEFAULT_PAGE_ID: PageId;
|
|
@@ -112,10 +110,7 @@ export declare function createDefaultSession(currentPageId?: PageId): SessionRec
|
|
|
112
110
|
export declare function isPageRecord(record: BaseRecord | null | undefined): record is PageRecord;
|
|
113
111
|
export declare function isDocumentMetadataRecord(record: BaseRecord | null | undefined): record is DocumentMetadataRecord;
|
|
114
112
|
export declare function isShapeRecord(record: BaseRecord | null | undefined): record is ShapeRecord;
|
|
115
|
-
export declare function isAnyShapeRecord(record: BaseRecord | null | undefined): record is AnyShapeRecord;
|
|
116
113
|
export declare function isSessionRecord(record: BaseRecord | null | undefined): record is SessionRecord;
|
|
117
114
|
export declare function isBindingRecord(record: BaseRecord | null | undefined): record is BindingRecord;
|
|
118
|
-
export declare function isAnyBindingRecord(record: BaseRecord | null | undefined): record is AnyBindingRecord;
|
|
119
115
|
export declare function isAssetRecord(record: BaseRecord | null | undefined): record is AssetRecord;
|
|
120
|
-
export declare function isAnyAssetRecord(record: BaseRecord | null | undefined): record is AnyAssetRecord;
|
|
121
116
|
export declare function isDocumentRecord(record: EditorRecord): record is DocumentRecord;
|
|
@@ -2,30 +2,21 @@ import type { ShapeUtilRegistry } from "../shapes/shapeUtilRegistry";
|
|
|
2
2
|
import type { BindingUtilRegistry } from "../bindings/bindingUtilRegistry";
|
|
3
3
|
import type { StoreSnapshot } from "../../store/index";
|
|
4
4
|
import { type DocumentRecord, type SessionRecord } from "./records";
|
|
5
|
-
export type DocumentSnapshot = StoreSnapshot<DocumentRecord,
|
|
5
|
+
export type DocumentSnapshot = StoreSnapshot<DocumentRecord, 2>;
|
|
6
6
|
export type SessionSnapshot = StoreSnapshot<SessionRecord, 1>;
|
|
7
7
|
export declare class SnapshotParseError extends Error {
|
|
8
8
|
constructor(message: string);
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
up: (records: unknown[]) => unknown[];
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Apply forward migration steps to bring a records array from `fromVersion` up
|
|
22
|
-
* to `toVersion`. Throws if a step is missing or the snapshot is newer than the
|
|
23
|
-
* supported version (no down-migration).
|
|
24
|
-
*/
|
|
25
|
-
export declare function migrateSnapshotRecords(records: unknown[], fromVersion: number, toVersion: number, migrations: readonly SnapshotMigration[], kind?: "document" | "session"): unknown[];
|
|
26
|
-
export declare function getSnapshotEnvelope(snapshot: unknown, kind: "document" | "session"): {
|
|
27
|
-
schemaVersion: number;
|
|
10
|
+
declare const CURRENT_DOCUMENT_SNAPSHOT_VERSION: 2;
|
|
11
|
+
declare const CURRENT_SESSION_SNAPSHOT_VERSION: 1;
|
|
12
|
+
export declare function getSnapshotEnvelope(snapshot: unknown, kind: "document"): {
|
|
13
|
+
schemaVersion: typeof CURRENT_DOCUMENT_SNAPSHOT_VERSION;
|
|
14
|
+
records: unknown[];
|
|
15
|
+
};
|
|
16
|
+
export declare function getSnapshotEnvelope(snapshot: unknown, kind: "session"): {
|
|
17
|
+
schemaVersion: typeof CURRENT_SESSION_SNAPSHOT_VERSION;
|
|
28
18
|
records: unknown[];
|
|
29
19
|
};
|
|
30
20
|
export declare function parseDocumentSnapshot(snapshot: unknown, shapeUtils: ShapeUtilRegistry, bindingUtils: BindingUtilRegistry): DocumentSnapshot;
|
|
31
21
|
export declare function parseSessionSnapshot(snapshot: unknown): SessionSnapshot;
|
|
22
|
+
export {};
|
|
@@ -9,8 +9,7 @@ export interface CustomShapeColorRef {
|
|
|
9
9
|
kind: "custom";
|
|
10
10
|
value: string;
|
|
11
11
|
}
|
|
12
|
-
export type
|
|
13
|
-
export type ShapeColor = string | ShapeColorRef;
|
|
12
|
+
export type ShapeColor = ThemeShapeColorRef | CustomShapeColorRef;
|
|
14
13
|
export declare const LAND_THEME_COLOR_TOKEN_BY_SLOT: Record<ThemeColorSlot, ThemeColorTokenName>;
|
|
15
14
|
export declare const LAND_DEFAULT_THEME_COLOR_FALLBACKS: Record<ThemeColorSlot, string>;
|
|
16
15
|
export declare function createThemeShapeColor(slot: ThemeColorSlot): ThemeShapeColorRef;
|
|
@@ -2,10 +2,10 @@ import { Box } from "../geometry/box";
|
|
|
2
2
|
import { Mat } from "../geometry/mat";
|
|
3
3
|
import { Vec } from "../geometry/vec";
|
|
4
4
|
import type { Editor } from "../editor/editor";
|
|
5
|
-
import type { ShapeUpdate } from "../editor/commands";
|
|
5
|
+
import type { CreateShapeInput, ShapeUpdate } from "../editor/commands";
|
|
6
6
|
import { type SelectionMirrorAxis } from "../editor/selection";
|
|
7
|
-
import type { SelectionBindingMiddleHandleAnchor, SelectionBindingSegment, SelectionBindingTerminalHandleAnchor, SelectionCustomHandleAnchor, SelectionHandle, SelectionResizeHandleId } from "../editor/selection";
|
|
8
|
-
import type { ShapeId, ShapeRecordBase } from "../schema/records";
|
|
7
|
+
import type { SelectionBindingMiddleHandleAnchor, SelectionBindingSegment, SelectionBindingTerminalHandleAnchor, SelectionCustomHandleAnchor, SelectionHandle, SelectionResizeHandleId, SelectionResizeMode } from "../editor/selection";
|
|
8
|
+
import type { ShapeId, ShapeParentId, ShapeRecordBase } from "../schema/records";
|
|
9
9
|
export interface ShapeEditEndResult {
|
|
10
10
|
deleteShapeIds?: ShapeId[];
|
|
11
11
|
}
|
|
@@ -13,11 +13,13 @@ export interface ShapeEditEndInput {
|
|
|
13
13
|
editor: Editor;
|
|
14
14
|
}
|
|
15
15
|
export interface ShapeBindingPointInput {
|
|
16
|
+
editor: Editor;
|
|
16
17
|
rawPagePoint: Vec;
|
|
17
18
|
oppositePagePoint: Vec;
|
|
18
19
|
}
|
|
19
20
|
export interface ShapeSelectionResizeInput {
|
|
20
21
|
handleId: SelectionResizeHandleId;
|
|
22
|
+
isOnlyResizeTarget: boolean;
|
|
21
23
|
pageCenter: Vec;
|
|
22
24
|
selectionLocalBounds: Box;
|
|
23
25
|
scaleX: number;
|
|
@@ -26,10 +28,15 @@ export interface ShapeSelectionResizeInput {
|
|
|
26
28
|
selectionRotation: number;
|
|
27
29
|
selectionRotationCenter: Vec;
|
|
28
30
|
}
|
|
29
|
-
export interface
|
|
31
|
+
export interface ShapeSelectionResizeCapabilityInput {
|
|
32
|
+
editor: Editor;
|
|
33
|
+
isOnlyResizeTarget: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface ShapeSelectionTransformCapabilityInput {
|
|
30
36
|
editor: Editor;
|
|
37
|
+
}
|
|
38
|
+
export interface ShapeSelectionResizeModesInput extends ShapeSelectionResizeCapabilityInput {
|
|
31
39
|
handleId: SelectionResizeHandleId;
|
|
32
|
-
isOnlySelected: boolean;
|
|
33
40
|
}
|
|
34
41
|
export type ShapeSelectionFlipAxis = SelectionMirrorAxis;
|
|
35
42
|
export interface ShapeSelectionFlipInput {
|
|
@@ -42,8 +49,10 @@ export interface ShapeSelectionFlipInput {
|
|
|
42
49
|
export type ShapeSelectionPagePoints = readonly [Vec, Vec];
|
|
43
50
|
export interface ShapeSelectionPagePointsInput {
|
|
44
51
|
pagePoints: ShapeSelectionPagePoints;
|
|
52
|
+
pageMiddlePoint?: Vec;
|
|
45
53
|
}
|
|
46
54
|
export interface ShapeBrushWrapInput {
|
|
55
|
+
editor: Editor;
|
|
47
56
|
brushBounds: Box;
|
|
48
57
|
pageOutlineVertices: readonly Vec[];
|
|
49
58
|
pageBounds: Box | null;
|
|
@@ -51,17 +60,29 @@ export interface ShapeBrushWrapInput {
|
|
|
51
60
|
export interface ShapeBrushSelectInput extends ShapeBrushWrapInput {
|
|
52
61
|
isWrapping: boolean;
|
|
53
62
|
}
|
|
63
|
+
export interface ShapeGroupingInput {
|
|
64
|
+
parentId: ShapeParentId;
|
|
65
|
+
parentLocalBounds: Box;
|
|
66
|
+
}
|
|
54
67
|
export interface ShapeLineSegmentHitTestInput {
|
|
55
68
|
editor?: Editor;
|
|
56
69
|
pageStart: Vec;
|
|
57
70
|
pageEnd: Vec;
|
|
71
|
+
pageMargin: number;
|
|
58
72
|
positionedStart: Vec;
|
|
59
73
|
positionedEnd: Vec;
|
|
60
|
-
|
|
74
|
+
positionedMargin: number;
|
|
61
75
|
}
|
|
62
76
|
export interface ShapeGeometryInput {
|
|
63
77
|
editor: Editor;
|
|
64
78
|
}
|
|
79
|
+
export interface ShapeChildVisibilityInput {
|
|
80
|
+
editor: Editor;
|
|
81
|
+
}
|
|
82
|
+
export interface ShapeChildPlacementInput {
|
|
83
|
+
editor: Editor;
|
|
84
|
+
reason: "create" | "reparent";
|
|
85
|
+
}
|
|
65
86
|
export interface ShapePointHitTestInput extends ShapeGeometryInput {
|
|
66
87
|
pagePoint: Vec;
|
|
67
88
|
positionedPoint: Vec;
|
|
@@ -92,9 +113,7 @@ export interface ShapeSelectionHandleAnchorInput {
|
|
|
92
113
|
isOnlySelected: boolean;
|
|
93
114
|
editor: Editor;
|
|
94
115
|
}
|
|
95
|
-
export
|
|
96
|
-
editor: Editor;
|
|
97
|
-
}
|
|
116
|
+
export type ShapeSelectionFrameInput = ShapeSelectionTransformCapabilityInput;
|
|
98
117
|
export interface ShapeSelectionTranslateInput {
|
|
99
118
|
editor: Editor;
|
|
100
119
|
}
|
|
@@ -118,31 +137,45 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
|
|
|
118
137
|
abstract readonly type: S["type"];
|
|
119
138
|
abstract getDefaultProps(): S["props"];
|
|
120
139
|
abstract validateProps(props: unknown): S["props"];
|
|
121
|
-
abstract
|
|
122
|
-
|
|
140
|
+
abstract getLocalBounds(shape: S): Box;
|
|
141
|
+
getPositionedBounds(shape: S): Box;
|
|
123
142
|
getRenderBounds(shape: S): Box;
|
|
124
143
|
getPointHitTestBounds(shape: S, _input?: ShapeGeometryInput): Box;
|
|
125
144
|
getExportBounds(shape: S): Box;
|
|
126
145
|
getChildClipLocalBounds(_shape: S): Box | null;
|
|
146
|
+
getChildClipLocalPolygons(shape: S): readonly (readonly Vec[])[] | null;
|
|
127
147
|
getChildExportClipLocalBounds(shape: S): Box | null;
|
|
148
|
+
getChildExportClipLocalPolygons(shape: S): readonly (readonly Vec[])[] | null;
|
|
128
149
|
getSelectionResizeLocalBounds(shape: S): Box;
|
|
129
150
|
resizeSelectionBounds(shape: S, input: ShapeSelectionResizeInput): ShapeUpdate;
|
|
130
|
-
|
|
151
|
+
getAllowedSelectionResizeModes(_shape: S, _input: ShapeSelectionResizeModesInput): readonly SelectionResizeMode[];
|
|
152
|
+
getSelectionResizeHandleIds(_shape: S, _input: ShapeSelectionResizeCapabilityInput): readonly SelectionResizeHandleId[];
|
|
131
153
|
flipSelectionBounds(shape: S, input: ShapeSelectionFlipInput): ShapeUpdate;
|
|
132
154
|
updateSelectionPagePoints(shape: S, _input: ShapeSelectionPagePointsInput): ShapeUpdate;
|
|
133
155
|
getSelectionPagePoints(_shape: S): ShapeSelectionPagePoints | null;
|
|
156
|
+
getSelectionPageMiddlePoint(_shape: S): Vec | null;
|
|
134
157
|
contributesToSelectionFrame(_shape: S, _input: ShapeSelectionFrameInput): boolean;
|
|
135
|
-
|
|
158
|
+
canParticipateInSelectionResize(_shape: S, _input: ShapeSelectionTransformCapabilityInput): boolean;
|
|
159
|
+
canParticipateInSelectionRotation(_shape: S, _input: ShapeSelectionTransformCapabilityInput): boolean;
|
|
160
|
+
canUseSelectionResizeHandles(shape: S, input: ShapeSelectionFrameInput): boolean;
|
|
161
|
+
canUseSelectionRotateHandle(shape: S, input: ShapeSelectionFrameInput): boolean;
|
|
136
162
|
getSelectionTargetId(shape: S, _input: ShapeSelectionFrameInput): ShapeId;
|
|
137
163
|
getTranslateTargetId(shape: S, _input: ShapeSelectionTranslateInput): ShapeId;
|
|
138
|
-
|
|
164
|
+
isSelectionTransformContainer(_shape: S): boolean;
|
|
139
165
|
shouldRotateDescendants(shape: S): boolean;
|
|
166
|
+
shouldResizeDescendants(_shape: S): boolean;
|
|
167
|
+
getResizeToFitDescendantsProps(_shape: S, _descendantBounds: Box): S["props"] | null;
|
|
168
|
+
getMinimumChildCount(_shape: S): number;
|
|
169
|
+
contributesToExportBounds(_shape: S): boolean;
|
|
140
170
|
canUngroupChildren(_shape: S): boolean;
|
|
171
|
+
getGroupingShapeCreateInput(_input: ShapeGroupingInput): CreateShapeInput | null;
|
|
141
172
|
canStartTranslateFromSelectionBounds(_shape: S, _input: ShapeSelectionFrameInput): boolean;
|
|
142
173
|
canSnap(_shape: S): boolean;
|
|
174
|
+
canSnapChildrenToSelf(_shape: S): boolean;
|
|
143
175
|
getBoundsSnapGeometry(_shape: S): ShapeBoundsSnapGeometry;
|
|
144
176
|
getHandleSnapGeometry(shape: S): ShapeHandleSnapGeometry;
|
|
145
177
|
getPositionedOutlineVertices(shape: S): Vec[];
|
|
178
|
+
getSelectionFramePositionedOutlineVertices(_shape: S, _input: ShapeSelectionFrameInput): Vec[] | null;
|
|
146
179
|
getSelectionHandleAnchors(_shape: S, _input: ShapeSelectionHandleAnchorInput): ShapeSelectionHandleAnchors;
|
|
147
180
|
getSelectionOverlayInfo(_shape: S, _input: ShapeSelectionOverlayInfoInput): ShapeSelectionOverlayInfo;
|
|
148
181
|
isWrappedByBrush(_shape: S, input: ShapeBrushWrapInput): boolean;
|
|
@@ -150,6 +183,11 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
|
|
|
150
183
|
getLocalToPageTransform(shape: S): Mat;
|
|
151
184
|
canEdit(_shape: S): boolean;
|
|
152
185
|
canReceiveChildren(_shape: S): boolean;
|
|
186
|
+
canReceiveChild(shape: S, _child: ShapeRecordBase): boolean;
|
|
187
|
+
isChildVisible(_shape: S, _child: ShapeRecordBase, _input: ShapeChildVisibilityInput): boolean;
|
|
188
|
+
getChildPlacementMeta(_shape: S, child: ShapeRecordBase, _input: ShapeChildPlacementInput): Record<string, unknown>;
|
|
189
|
+
canAutomaticallyReceiveChildren(shape: S): boolean;
|
|
190
|
+
canBeDirectlyBrushSelected(_shape: S): boolean;
|
|
153
191
|
canReceiveTerminalBinding(_shape: S, _input?: ShapeGeometryInput): boolean;
|
|
154
192
|
repairLoadedShape(_shape: S): S | null;
|
|
155
193
|
onEditEnd(_shape: S, _input: ShapeEditEndInput): ShapeEditEndResult | void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Box } from "../../geometry/box";
|
|
2
|
+
import { Mat } from "../../geometry/mat";
|
|
2
3
|
import { Vec } from "../../geometry/vec";
|
|
3
4
|
import type { ShapeUpdate } from "../../editor/commands";
|
|
4
5
|
import type { Editor } from "../../editor/editor";
|
|
5
6
|
import type { PointerEditorEvent, TickEditorEvent } from "../../editor/events";
|
|
6
|
-
import type { SelectionResizeHandleId, SelectionResizePointShapeSnapshot, SelectionResizeShapeSnapshot, SelectionRotationTransform, SelectionRotatePointShapeSnapshot, SelectionRotateShapeSnapshot } from "../../editor/selection";
|
|
7
|
+
import type { SelectionResizeHandleId, SelectionResizeMode, SelectionResizePointShapeSnapshot, SelectionResizeShapeSnapshot, SelectionRotationTransform, SelectionRotatePointShapeSnapshot, SelectionRotateShapeSnapshot } from "../../editor/selection";
|
|
7
8
|
import type { HandleSnapSnapshot, ResizeSnapSnapshot, TranslateSnapSnapshot } from "../../editor/managers/snapTypes";
|
|
8
9
|
import type { SelectionHandleInteractionSession } from "../../editor/selectionHandleInteractions";
|
|
9
10
|
import type { ShapeId, ShapeRecord } from "../../schema/records";
|
|
@@ -42,11 +43,12 @@ export interface TranslatingShapeSnapshot {
|
|
|
42
43
|
id: ShapeId;
|
|
43
44
|
x: number;
|
|
44
45
|
y: number;
|
|
46
|
+
startLocalToPage: Mat;
|
|
45
47
|
}
|
|
46
48
|
export interface TranslatingInfo {
|
|
47
49
|
originPagePoint: Vec;
|
|
48
50
|
previousSelection: ShapeId[];
|
|
49
|
-
|
|
51
|
+
movingShapeIds: ShapeId[];
|
|
50
52
|
startBounds: Box | null;
|
|
51
53
|
snapSnapshot: TranslateSnapSnapshot;
|
|
52
54
|
snapRotation: number;
|
|
@@ -76,7 +78,7 @@ export interface ResizingInfo extends PointingResizeHandleInfo {
|
|
|
76
78
|
shapes: SelectionResizeShapeSnapshot[];
|
|
77
79
|
pointShapes: SelectionResizePointShapeSnapshot[];
|
|
78
80
|
updates: ShapeUpdate[];
|
|
79
|
-
|
|
81
|
+
allowedResizeModes: readonly SelectionResizeMode[];
|
|
80
82
|
lastPagePointX: number;
|
|
81
83
|
lastPagePointY: number;
|
|
82
84
|
lastShiftKey: boolean;
|
|
@@ -108,6 +110,8 @@ export interface PointingSelectionHandleInteractionInfo {
|
|
|
108
110
|
export interface DraggingSelectionHandleInteractionInfo extends PointingSelectionHandleInteractionInfo {
|
|
109
111
|
lastPagePointX: number;
|
|
110
112
|
lastPagePointY: number;
|
|
113
|
+
lastShiftKey: boolean;
|
|
114
|
+
lastAltKey: boolean;
|
|
111
115
|
lastAccelKey: boolean;
|
|
112
116
|
}
|
|
113
117
|
export interface SelectionDragInput {
|
|
@@ -146,11 +150,10 @@ export declare function normalizeAngle(angle: number): number;
|
|
|
146
150
|
export declare function snapAngle(angle: number, step: number): number;
|
|
147
151
|
export declare function getBoxCorners(bounds: Box): Vec[];
|
|
148
152
|
export declare function getShapeSelectionResizePageOutlineVertices(editor: Editor, shape: ShapeRecord): Vec[];
|
|
149
|
-
export declare function getResizedShapeUpdate(editor: Editor, shape: SelectionResizeShapeSnapshot, startBounds: Box, nextBounds: Box, scaleX: number, scaleY: number, handleId: SelectionResizeHandleId, isResizingFromCenter: boolean, rotationCenter: Vec, selectionRotation: number, update: ShapeUpdate): void;
|
|
153
|
+
export declare function getResizedShapeUpdate(editor: Editor, shape: SelectionResizeShapeSnapshot, startBounds: Box, nextBounds: Box, scaleX: number, scaleY: number, handleId: SelectionResizeHandleId, isOnlyResizeTarget: boolean, isResizingFromCenter: boolean, rotationCenter: Vec, selectionRotation: number, update: ShapeUpdate): void;
|
|
150
154
|
export declare function getSelectionTransform(rotationCenter: Vec, selectionRotation: number): SelectionRotationTransform;
|
|
151
155
|
export declare function getResizedPagePointsUpdate(editor: Editor, shape: SelectionResizePointShapeSnapshot, startBounds: Box, nextBounds: Box, scaleX: number, scaleY: number, handleId: SelectionResizeHandleId, isResizingFromCenter: boolean, rotationCenter: Vec, selectionRotation: number, update: ShapeUpdate): void;
|
|
152
|
-
export declare function
|
|
153
|
-
export declare function getRotatedShapeUpdate(shape: SelectionRotateShapeSnapshot, center: Vec, delta: number, update: ShapeUpdate): void;
|
|
156
|
+
export declare function getRotatedShapeUpdate(editor: Editor, shape: SelectionRotateShapeSnapshot, center: Vec, delta: number, update: ShapeUpdate): void;
|
|
154
157
|
export declare function getRotatedPagePointsUpdate(editor: Editor, shape: SelectionRotatePointShapeSnapshot, center: Vec, delta: number, update: ShapeUpdate): void;
|
|
155
158
|
export declare function createTranslatingUpdates(shapes: TranslatingShapeSnapshot[]): ShapeUpdate[];
|
|
156
159
|
export declare function getTranslateShapeSnapshots(editor: Editor, selectedShapeIds: ShapeId[]): TranslatingShapeSnapshot[];
|
package/_vendor/canvas-core/tools/select/states/draggingSelectionHandleInteractionState.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Editor } from "../../../editor/editor";
|
|
2
2
|
import { StateNode } from "../../../editor/stateNode";
|
|
3
|
-
import type { PointerEditorEvent } from "../../../editor/events";
|
|
3
|
+
import type { CancelEditorEvent, PointerEditorEvent } from "../../../editor/events";
|
|
4
4
|
import { type DraggingSelectionHandleInteractionInfo } from "../selectToolHelpers";
|
|
5
5
|
import { DraggingStateNode, type DragApplyInput } from "./selectStateNode";
|
|
6
6
|
export declare class DraggingSelectionHandleInteractionState extends DraggingStateNode<DraggingSelectionHandleInteractionInfo> {
|
|
@@ -8,8 +8,8 @@ export declare class DraggingSelectionHandleInteractionState extends DraggingSta
|
|
|
8
8
|
constructor(editor: Editor, parent: StateNode);
|
|
9
9
|
protected getHistoryMark(info: DraggingSelectionHandleInteractionInfo): string;
|
|
10
10
|
protected onPointerUp(event: PointerEditorEvent): void;
|
|
11
|
-
protected onCancel(): void;
|
|
11
|
+
protected onCancel(event: CancelEditorEvent): void;
|
|
12
12
|
protected onInfoExit(): void;
|
|
13
|
-
protected apply({ pagePoint, accelKey }: DragApplyInput): void;
|
|
13
|
+
protected apply({ pagePoint, shiftKey, altKey, accelKey }: DragApplyInput): void;
|
|
14
14
|
private complete;
|
|
15
15
|
}
|
package/_vendor/canvas-core/tools/select/states/pointingSelectionHandleInteractionState.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Editor } from "../../../editor/editor";
|
|
2
|
+
import type { CancelEditorEvent } from "../../../editor/events";
|
|
2
3
|
import { StateNode } from "../../../editor/stateNode";
|
|
3
4
|
import { type PointingSelectionHandleInteractionInfo } from "../selectToolHelpers";
|
|
4
5
|
import { PointingStateNode } from "./selectStateNode";
|
|
@@ -6,5 +7,5 @@ export declare class PointingSelectionHandleInteractionState extends PointingSta
|
|
|
6
7
|
constructor(editor: Editor, parent: StateNode);
|
|
7
8
|
protected onDragThresholdExceeded(): void;
|
|
8
9
|
protected onPointerUp(): void;
|
|
9
|
-
protected onCancel(): void;
|
|
10
|
+
protected onCancel(event: CancelEditorEvent): void;
|
|
10
11
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CanvasAction } from "./actions";
|
|
2
|
+
export declare class CanvasActionRegistry {
|
|
3
|
+
private readonly actions;
|
|
4
|
+
registerAction(action: CanvasAction): void;
|
|
5
|
+
getAction(actionId: string): CanvasAction | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function createCanvasActionRegistry(actions?: readonly CanvasAction[]): CanvasActionRegistry;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { Editor } from "../
|
|
2
|
-
import type { ShapeId, ShapeRecordBase } from "../schema/records";
|
|
3
|
-
import type { ShapeColorRef } from "../shapes/colors";
|
|
1
|
+
import type { Editor, ShapeColor, ShapeId, ShapeRecordBase } from "../canvas-core/index";
|
|
4
2
|
export interface CanvasSelectionSnapshot {
|
|
5
3
|
selectedShapeIds: readonly ShapeId[];
|
|
6
4
|
selectedShapes: readonly ShapeRecordBase[];
|
|
@@ -19,7 +17,7 @@ export interface CanvasActionContext {
|
|
|
19
17
|
selection: CanvasSelectionSnapshot;
|
|
20
18
|
tool: CanvasToolSnapshot;
|
|
21
19
|
}
|
|
22
|
-
export type CanvasActionValue = string | number | boolean | null |
|
|
20
|
+
export type CanvasActionValue = string | number | boolean | null | ShapeColor | {
|
|
23
21
|
readonly [key: string]: CanvasActionValue;
|
|
24
22
|
} | readonly CanvasActionValue[];
|
|
25
23
|
export interface CanvasActionRunInput<TValue extends CanvasActionValue> {
|
|
@@ -1,32 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ShapeId, ShapeRecordBase } from "../schema/records";
|
|
1
|
+
import type { CanvasContextMenuRequest, CanvasContextMenuTarget } from "../canvas-react/index";
|
|
3
2
|
import type { CanvasActionContext, CanvasActionValue } from "./actions";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export interface ContextMenuShapeTarget {
|
|
8
|
-
type: "shape";
|
|
9
|
-
shapeId: ShapeId;
|
|
10
|
-
shapeType: ShapeRecordBase["type"];
|
|
11
|
-
selected: boolean;
|
|
12
|
-
}
|
|
13
|
-
export interface ContextMenuSelectionTarget {
|
|
14
|
-
type: "selection";
|
|
15
|
-
selectedShapeIds: readonly ShapeId[];
|
|
16
|
-
}
|
|
17
|
-
export type ContextMenuTarget = ContextMenuCanvasTarget | ContextMenuShapeTarget | ContextMenuSelectionTarget;
|
|
18
|
-
export interface ActiveContextMenu {
|
|
19
|
-
anchor: {
|
|
20
|
-
screenPoint: Vec;
|
|
21
|
-
pagePoint: Vec;
|
|
22
|
-
};
|
|
23
|
-
target: ContextMenuTarget;
|
|
24
|
-
}
|
|
3
|
+
export type ContextMenuTarget = CanvasContextMenuTarget;
|
|
4
|
+
export type ActiveContextMenu = CanvasContextMenuRequest;
|
|
25
5
|
export interface ContextMenuContext extends CanvasActionContext {
|
|
26
6
|
menu: ActiveContextMenu;
|
|
27
7
|
}
|
|
28
8
|
export type ContextMenuContributionTarget = "canvas" | "selection" | "shape" | "any";
|
|
29
|
-
export
|
|
9
|
+
export type ContextMenuItem = {
|
|
30
10
|
kind: "command";
|
|
31
11
|
id: string;
|
|
32
12
|
actionId: string;
|
|
@@ -36,18 +16,33 @@ export interface ContextMenuCommandItem {
|
|
|
36
16
|
shortcut?: string;
|
|
37
17
|
tone?: "default" | "destructive";
|
|
38
18
|
dataUi?: string;
|
|
39
|
-
}
|
|
40
|
-
export interface ContextMenuSeparatorItem {
|
|
19
|
+
} | {
|
|
41
20
|
kind: "separator";
|
|
42
21
|
id: string;
|
|
43
|
-
}
|
|
44
|
-
export interface ContextMenuBadgeItem {
|
|
22
|
+
} | {
|
|
45
23
|
kind: "badge";
|
|
46
24
|
id: string;
|
|
47
25
|
label: string;
|
|
48
26
|
dataUi?: string;
|
|
49
|
-
}
|
|
50
|
-
export type
|
|
27
|
+
};
|
|
28
|
+
export type ContextMenuCommandItem = Extract<ContextMenuItem, {
|
|
29
|
+
kind: "command";
|
|
30
|
+
}>;
|
|
31
|
+
export type ContextMenuSeparatorItem = Extract<ContextMenuItem, {
|
|
32
|
+
kind: "separator";
|
|
33
|
+
}>;
|
|
34
|
+
export type ContextMenuBadgeItem = Extract<ContextMenuItem, {
|
|
35
|
+
kind: "badge";
|
|
36
|
+
}>;
|
|
37
|
+
export type ContextMenuCanvasTarget = Extract<ContextMenuTarget, {
|
|
38
|
+
type: "canvas";
|
|
39
|
+
}>;
|
|
40
|
+
export type ContextMenuShapeTarget = Extract<ContextMenuTarget, {
|
|
41
|
+
type: "shape";
|
|
42
|
+
}>;
|
|
43
|
+
export type ContextMenuSelectionTarget = Extract<ContextMenuTarget, {
|
|
44
|
+
type: "selection";
|
|
45
|
+
}>;
|
|
51
46
|
export interface ContextMenuSection {
|
|
52
47
|
id: string;
|
|
53
48
|
order?: number;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ContextMenuContext, ContextMenuContribution, ContextMenuContributionTarget, ContextMenuSection } from "./contextMenu";
|
|
2
|
+
export declare class CanvasContextMenuRegistry {
|
|
3
|
+
private readonly contributions;
|
|
4
|
+
private readonly contributionsByTarget;
|
|
5
|
+
private readonly contributionIndexes;
|
|
6
|
+
private nextContributionIndex;
|
|
7
|
+
registerContribution(contribution: ContextMenuContribution): void;
|
|
8
|
+
getSections(target: ContextMenuContributionTarget, context: ContextMenuContext): ContextMenuSection[];
|
|
9
|
+
private addToIndex;
|
|
10
|
+
}
|
|
11
|
+
export declare function createCanvasContextMenuRegistry(contributions?: readonly ContextMenuContribution[]): CanvasContextMenuRegistry;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { EditorPlugin, KeyboardShortcutInput, ShapeRecordBase } from "../canvas-core/index";
|
|
2
|
+
import type { CanvasRenderPlugin } from "../canvas-react/host/index";
|
|
3
|
+
import type { CanvasAction } from "./actions";
|
|
4
|
+
import type { ContextMenuContribution } from "./contextMenu";
|
|
5
|
+
import type { ToolbarContribution } from "./toolbar";
|
|
6
|
+
export interface CanvasActionShortcut {
|
|
7
|
+
actionId: string;
|
|
8
|
+
shortcut: KeyboardShortcutInput;
|
|
9
|
+
}
|
|
10
|
+
export interface CanvasProductContribution {
|
|
11
|
+
actions?: readonly CanvasAction[];
|
|
12
|
+
actionShortcuts?: readonly CanvasActionShortcut[];
|
|
13
|
+
toolbarContributions?: readonly ToolbarContribution[];
|
|
14
|
+
contextMenuContributions?: readonly ContextMenuContribution[];
|
|
15
|
+
}
|
|
16
|
+
export type CanvasProductFactory = () => CanvasProductContribution;
|
|
17
|
+
type CanvasProductFactoryLike = (...args: never[]) => object;
|
|
18
|
+
export interface CanvasPluginReference {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
}
|
|
21
|
+
export interface CanvasPlugin<TProductFactory extends CanvasProductFactoryLike = CanvasProductFactory> extends CanvasPluginReference {
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly requires?: readonly CanvasPluginReference[];
|
|
24
|
+
readonly editor?: EditorPlugin;
|
|
25
|
+
readonly render?: CanvasRenderPlugin;
|
|
26
|
+
readonly product?: TProductFactory;
|
|
27
|
+
}
|
|
28
|
+
export type CanvasPluginInput<TProductFactory extends CanvasProductFactoryLike = CanvasProductFactory> = CanvasPlugin<TProductFactory> | readonly CanvasPluginInput<TProductFactory>[];
|
|
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"][];
|
|
36
|
+
}
|
|
37
|
+
export declare function defineCanvasPlugin<TProductFactory extends CanvasProductFactoryLike = CanvasProductFactory>(plugin: CanvasPlugin<TProductFactory>): CanvasPlugin<TProductFactory>;
|
|
38
|
+
export declare function compileCanvasPlugins<TProductFactory extends CanvasProductFactoryLike>(input: readonly CanvasPluginInput<TProductFactory>[]): CompiledCanvasPlugins<TProductFactory>;
|
|
39
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Editor } from "../canvas-core/index";
|
|
1
2
|
import type { CanvasActionContext, CanvasActionValue } from "./actions";
|
|
2
3
|
export declare const SET_ACTIVE_TOOL_TOOLBAR_ACTION_ID = "editor.tool.set-active-tool";
|
|
3
4
|
export declare const TOGGLE_TOOL_LOCKED_TOOLBAR_ACTION_ID = "editor.tool.toggle-locked";
|
|
@@ -13,6 +14,13 @@ export interface ToolbarButtonItem {
|
|
|
13
14
|
shortcut?: string;
|
|
14
15
|
dataUi?: string;
|
|
15
16
|
}
|
|
17
|
+
export interface ToolbarCheckboxItem {
|
|
18
|
+
kind: "checkbox";
|
|
19
|
+
id: string;
|
|
20
|
+
actionId: string;
|
|
21
|
+
label: string;
|
|
22
|
+
dataUi?: string;
|
|
23
|
+
}
|
|
16
24
|
export interface ToolbarSegmentedOption {
|
|
17
25
|
value: string;
|
|
18
26
|
label: string;
|
|
@@ -38,6 +46,14 @@ export interface ToolbarSwatchesItem {
|
|
|
38
46
|
label: string;
|
|
39
47
|
options: readonly ToolbarSwatchOption[];
|
|
40
48
|
}
|
|
49
|
+
export interface ToolbarColorPresetOption {
|
|
50
|
+
id: string;
|
|
51
|
+
label: string;
|
|
52
|
+
hexColor: string;
|
|
53
|
+
opacity?: number;
|
|
54
|
+
value?: CanvasActionValue;
|
|
55
|
+
dataUi?: string;
|
|
56
|
+
}
|
|
41
57
|
export interface ToolbarStepperOption {
|
|
42
58
|
value: number;
|
|
43
59
|
label: string;
|
|
@@ -56,7 +72,21 @@ export interface ToolbarTextInputItem {
|
|
|
56
72
|
id: string;
|
|
57
73
|
actionId: string;
|
|
58
74
|
label: string;
|
|
75
|
+
icon?: string;
|
|
76
|
+
presentation?: "inline" | "popover";
|
|
59
77
|
placeholder?: string;
|
|
78
|
+
validate?(value: string): boolean;
|
|
79
|
+
dataUi?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface ToolbarColorInputItem {
|
|
82
|
+
kind: "color-input";
|
|
83
|
+
id: string;
|
|
84
|
+
actionId: string;
|
|
85
|
+
label: string;
|
|
86
|
+
fallback?: string;
|
|
87
|
+
includeAlpha?: boolean;
|
|
88
|
+
opacityFallback?: number;
|
|
89
|
+
presets?: readonly ToolbarColorPresetOption[];
|
|
60
90
|
dataUi?: string;
|
|
61
91
|
}
|
|
62
92
|
export interface ToolbarSliderItem {
|
|
@@ -79,7 +109,7 @@ export interface ToolbarSeparatorItem {
|
|
|
79
109
|
kind: "separator";
|
|
80
110
|
id: string;
|
|
81
111
|
}
|
|
82
|
-
export type ToolbarItem = ToolbarButtonItem | ToolbarSegmentedItem | ToolbarSwatchesItem | ToolbarStepperItem | ToolbarTextInputItem | ToolbarSliderItem | ToolbarBadgeItem | ToolbarSeparatorItem;
|
|
112
|
+
export type ToolbarItem = ToolbarButtonItem | ToolbarCheckboxItem | ToolbarSegmentedItem | ToolbarSwatchesItem | ToolbarStepperItem | ToolbarTextInputItem | ToolbarColorInputItem | ToolbarSliderItem | ToolbarBadgeItem | ToolbarSeparatorItem;
|
|
83
113
|
export interface ToolbarGroup {
|
|
84
114
|
id: string;
|
|
85
115
|
order?: number;
|
|
@@ -91,6 +121,7 @@ export interface ToolbarContribution {
|
|
|
91
121
|
placement?: ToolbarPlacement;
|
|
92
122
|
order?: number;
|
|
93
123
|
actionIds: readonly string[];
|
|
124
|
+
subscribe?(editor: Editor, listener: () => void): () => void;
|
|
94
125
|
when?(context: CanvasActionContext): boolean;
|
|
95
126
|
getGroups(context: CanvasActionContext): readonly ToolbarGroup[];
|
|
96
127
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Editor } from "../canvas-core/index";
|
|
2
|
+
import type { CanvasActionContext } from "./actions";
|
|
3
|
+
import type { ToolbarContribution, ToolbarGroup, ToolbarPlacement, ToolbarSurface } from "./toolbar";
|
|
4
|
+
export declare class CanvasToolbarRegistry {
|
|
5
|
+
private readonly contributions;
|
|
6
|
+
private readonly contributionsBySurface;
|
|
7
|
+
private readonly contributionsBySurfaceAndPlacement;
|
|
8
|
+
private readonly contributionIndexes;
|
|
9
|
+
private nextContributionIndex;
|
|
10
|
+
private stateRevision;
|
|
11
|
+
registerContribution(contribution: ToolbarContribution): void;
|
|
12
|
+
getStateRevision(): number;
|
|
13
|
+
subscribeToState(editor: Editor, listener: () => void): () => void;
|
|
14
|
+
getGroups(surface: ToolbarSurface, context: CanvasActionContext, options?: {
|
|
15
|
+
placement?: ToolbarPlacement;
|
|
16
|
+
}): ToolbarGroup[];
|
|
17
|
+
private addToIndexes;
|
|
18
|
+
}
|
|
19
|
+
export declare function createCanvasToolbarRegistry(contributions?: readonly ToolbarContribution[]): CanvasToolbarRegistry;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CanvasContextMenuRequest } from "../contextMenuRequest";
|
|
2
2
|
import type { CanvasRenderPluginComponent, CanvasRenderPluginProvider } from "../host/canvasRenderPlugin";
|
|
3
3
|
import { type CanvasRendererRegistry } from "../host/rendererRegistry";
|
|
4
4
|
import { type CanvasOverlayRegistry } from "../host/overlayRegistry";
|
|
@@ -7,7 +7,7 @@ export declare function Canvas({ canvasComponents, canvasProviders, domEventGuar
|
|
|
7
7
|
canvasComponents?: readonly CanvasRenderPluginComponent[];
|
|
8
8
|
canvasProviders?: readonly CanvasRenderPluginProvider[];
|
|
9
9
|
domEventGuardRegistry?: CanvasDomEventGuardRegistry;
|
|
10
|
-
onContextMenuRequest?: (
|
|
10
|
+
onContextMenuRequest?: (request: CanvasContextMenuRequest) => void;
|
|
11
11
|
overlayRegistry?: CanvasOverlayRegistry;
|
|
12
12
|
rendererRegistry?: CanvasRendererRegistry;
|
|
13
13
|
showGrid?: boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Editor, KeyboardEditorEvent } from "../../canvas-core/index";
|
|
2
|
+
export declare function createKeyboardEvent(name: KeyboardEditorEvent["name"], event: KeyboardEvent): KeyboardEditorEvent;
|
|
3
|
+
export declare function routeCanvasKeyUp(editor: Editor, event: KeyboardEvent, isEditableTarget: boolean): void;
|
|
4
|
+
export declare function getKeyboardShortcutEvent(event: KeyboardEvent): {
|
|
5
|
+
key: string;
|
|
6
|
+
shiftKey: boolean;
|
|
7
|
+
altKey: boolean;
|
|
8
|
+
ctrlKey: boolean;
|
|
9
|
+
metaKey: boolean;
|
|
10
|
+
accelKey: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function isCanvasPanKey(event: Pick<KeyboardEvent, "code">): boolean;
|
|
13
|
+
export declare function isCanvasPanKeyEventTarget(target: EventTarget | null, container: HTMLElement): boolean;
|