@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
|
@@ -13,6 +13,7 @@ export declare class ShapeEditingManager {
|
|
|
13
13
|
private readonly entryRequestAtom;
|
|
14
14
|
readonly entryRequestSignal: Signal<ShapeEditingEntryRequest | null>;
|
|
15
15
|
private nextEntryRequestId;
|
|
16
|
+
private operation;
|
|
16
17
|
constructor(editor: Editor);
|
|
17
18
|
canEditShape(shapeOrId: ShapeRecord | ShapeId | null | undefined): boolean;
|
|
18
19
|
start(input: StartEditingShapeInput, source?: ChangeSource): ShapeEditingSession | null;
|
|
@@ -21,9 +22,12 @@ export declare class ShapeEditingManager {
|
|
|
21
22
|
setComposition(isComposing: boolean, source?: ChangeSource): void;
|
|
22
23
|
consumeEntryRequest(requestId: number): void;
|
|
23
24
|
removeShapeIds(ids: ShapeId[], source?: ChangeSource): void;
|
|
25
|
+
prepareForShapeRemoval(ids: readonly ShapeId[], source?: ChangeSource): void;
|
|
24
26
|
end(options: {
|
|
25
27
|
runEditEnd: boolean;
|
|
26
28
|
source: ChangeSource;
|
|
27
29
|
}): void;
|
|
30
|
+
cancelOperation(): void;
|
|
31
|
+
private commitOperation;
|
|
28
32
|
private publishEntryRequest;
|
|
29
33
|
}
|
|
@@ -49,6 +49,7 @@ export declare class ShapeHierarchyManager {
|
|
|
49
49
|
getShapeIdsForSelectionRotation(shapeIds: Iterable<ShapeId>): ShapeId[];
|
|
50
50
|
getSelectionTransformTargetShapes(): ShapeRecord[];
|
|
51
51
|
canResizeSelection(): boolean;
|
|
52
|
+
canFlipSelection(): boolean;
|
|
52
53
|
canRotateSelection(): boolean;
|
|
53
54
|
getSelectionResizeTargetShapes(): ShapeRecord[];
|
|
54
55
|
getSelectionRotationTargetShapes(): ShapeRecord[];
|
|
@@ -2,10 +2,12 @@ import { Box } from "../../geometry/box";
|
|
|
2
2
|
import { Vec } from "../../geometry/vec";
|
|
3
3
|
import type { ShapeId } from "../../schema/records";
|
|
4
4
|
import type { SelectionResizeHandleId } from "../selection";
|
|
5
|
-
import type { ResizeSnapInput, SnapAxis, SnapNode, SnapPointIndex, SnapPoint } from "./snapTypes";
|
|
5
|
+
import type { ResizeSnapInput, SnapAxis, SnapNode, SnapPointIndex, SnapPoint, SnapPointKind } from "./snapTypes";
|
|
6
6
|
export interface PointSnapPair {
|
|
7
7
|
selectionPoint: Vec;
|
|
8
|
+
selectionPointKind?: SnapPointKind;
|
|
8
9
|
candidatePoint: Vec;
|
|
10
|
+
candidatePointKind?: SnapPointKind;
|
|
9
11
|
candidatePointId: string;
|
|
10
12
|
candidateNodeId: ShapeId;
|
|
11
13
|
}
|
|
@@ -36,6 +38,7 @@ export type AxisSnap = PointAxisSnap | GapAxisSnap;
|
|
|
36
38
|
export interface PointSnapOptions {
|
|
37
39
|
previousCandidatePointIds?: ReadonlySet<string>;
|
|
38
40
|
releaseThreshold?: number;
|
|
41
|
+
selectionPointKinds?: readonly (SnapPointKind | undefined)[];
|
|
39
42
|
switchDistance?: number;
|
|
40
43
|
stats?: PointSnapStats;
|
|
41
44
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Box } from "../../geometry/box";
|
|
2
2
|
import { Vec } from "../../geometry/vec";
|
|
3
|
-
import type { SnapAxis } from "./snapTypes";
|
|
3
|
+
import type { SnapAxis, SnapPointKind } from "./snapTypes";
|
|
4
4
|
export declare const EPSILON = 1e-8;
|
|
5
|
+
export declare const BOX_SNAP_POINT_KINDS: readonly SnapPointKind[];
|
|
5
6
|
export declare function areVecsEqual(left: Vec, right: Vec): boolean;
|
|
6
7
|
export declare function getBoxSnapPoints(bounds: Box): Vec[];
|
|
7
8
|
export declare function getAxisValue(point: Vec, axis: SnapAxis): number;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type ChangeSource, type RecordsDiff } from "../../store/index";
|
|
2
|
+
import { type DocumentRecord } from "../schema/records";
|
|
3
|
+
import type { DocumentSnapshot, SessionSnapshot } from "../schema/snapshots";
|
|
4
|
+
import type { Editor } from "./editor";
|
|
5
|
+
export type EditorOperationHistory = "record" | "ignore";
|
|
6
|
+
export interface EditorOperationOptions {
|
|
7
|
+
kind: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
source?: ChangeSource;
|
|
10
|
+
history?: EditorOperationHistory;
|
|
11
|
+
}
|
|
12
|
+
export interface EditorCommit {
|
|
13
|
+
id: string;
|
|
14
|
+
revision: number;
|
|
15
|
+
kind: string;
|
|
16
|
+
label: string;
|
|
17
|
+
source: ChangeSource;
|
|
18
|
+
history: EditorOperationHistory;
|
|
19
|
+
diff: RecordsDiff<DocumentRecord>;
|
|
20
|
+
snapshot: DocumentSnapshot;
|
|
21
|
+
sessionSnapshot: SessionSnapshot;
|
|
22
|
+
}
|
|
23
|
+
export interface EditorOperation {
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly kind: string;
|
|
26
|
+
readonly source: ChangeSource;
|
|
27
|
+
readonly isActive: boolean;
|
|
28
|
+
commit(): EditorCommit | null;
|
|
29
|
+
cancel(): void;
|
|
30
|
+
}
|
|
31
|
+
interface EditorOperationState {
|
|
32
|
+
id: string;
|
|
33
|
+
kind: string;
|
|
34
|
+
label: string;
|
|
35
|
+
source: ChangeSource;
|
|
36
|
+
history: EditorOperationHistory;
|
|
37
|
+
parent: EditorOperationState | null;
|
|
38
|
+
diff: RecordsDiff<DocumentRecord>;
|
|
39
|
+
status: "active" | "committed" | "cancelled";
|
|
40
|
+
handle: EditorOperationHandle;
|
|
41
|
+
}
|
|
42
|
+
type CommitListener = (commit: EditorCommit) => void;
|
|
43
|
+
declare class EditorOperationHandle implements EditorOperation {
|
|
44
|
+
private readonly manager;
|
|
45
|
+
readonly state: EditorOperationState;
|
|
46
|
+
constructor(manager: EditorOperationManager, state: EditorOperationState);
|
|
47
|
+
get id(): string;
|
|
48
|
+
get kind(): string;
|
|
49
|
+
get source(): ChangeSource;
|
|
50
|
+
get isActive(): boolean;
|
|
51
|
+
commit(): EditorCommit | null;
|
|
52
|
+
cancel(): void;
|
|
53
|
+
}
|
|
54
|
+
export declare class EditorOperationManager {
|
|
55
|
+
private readonly editor;
|
|
56
|
+
private readonly stack;
|
|
57
|
+
private readonly commitListeners;
|
|
58
|
+
private readonly commitQueue;
|
|
59
|
+
private nextOperationId;
|
|
60
|
+
private revision;
|
|
61
|
+
private isPublishing;
|
|
62
|
+
constructor(editor: Editor);
|
|
63
|
+
begin(options: EditorOperationOptions): EditorOperation;
|
|
64
|
+
run<T>(options: EditorOperationOptions, fn: () => T): T;
|
|
65
|
+
getActive(): EditorOperation | null;
|
|
66
|
+
subscribe(listener: CommitListener): () => void;
|
|
67
|
+
commit(state: EditorOperationState): EditorCommit | null;
|
|
68
|
+
cancel(state: EditorOperationState): void;
|
|
69
|
+
private handleStoreChange;
|
|
70
|
+
private getActiveState;
|
|
71
|
+
private assertTopActive;
|
|
72
|
+
private enqueueCommit;
|
|
73
|
+
}
|
|
74
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vec } from "../geometry/vec";
|
|
2
2
|
import type { ShapeId, ShapeRecord } from "../schema/records";
|
|
3
|
-
import type { ShapeSelectionHandleAnchors } from "../shapes/shapeUtil";
|
|
3
|
+
import type { ShapeSelectionHandleAnchors, ShapeSelectionPathStyle } from "../shapes/shapeUtil";
|
|
4
4
|
import { type SelectionBindingMiddleHandle, type SelectionBindingSegment, type SelectionBindingTerminalHandle, type SelectionCustomHandle, type SelectionFrame, type SelectionOverlayFrameGeometryState, type SelectionOverlayFrameState, type SelectionOverlayFrameStyleState, type SelectionOverlayHandleAnchorsState, type SelectionOverlayHandleCountsState, type SelectionOverlayHandlesState, type SelectionResizeHandle, type SelectionResizeHandleId, type SelectionRotateHandle } from "./selection";
|
|
5
5
|
export interface SelectedShapeOverlayItem {
|
|
6
6
|
id: ShapeId;
|
|
@@ -9,6 +9,8 @@ export interface SelectedShapeOverlayItem {
|
|
|
9
9
|
endPagePoint: Vec | null;
|
|
10
10
|
middlePagePoint: Vec | null;
|
|
11
11
|
path: string | null;
|
|
12
|
+
pathStyle: ShapeSelectionPathStyle | null;
|
|
13
|
+
pageClipPath: string | null;
|
|
12
14
|
bindingSegments: readonly SelectionBindingSegment[];
|
|
13
15
|
}
|
|
14
16
|
export interface SelectionHandleState {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box } from "../geometry/box";
|
|
2
2
|
import type { Editor } from "../editor/editor";
|
|
3
3
|
import type { AssetId, ShapeId, ShapeRecordBase } from "../schema/records";
|
|
4
|
-
import { type ShapeColor, type
|
|
4
|
+
import { type ShapeColor, type ThemeColorResolver } from "../shapes/colors";
|
|
5
5
|
export type SvgAttributeValue = string | number | boolean | null | undefined;
|
|
6
6
|
export interface SvgElementNode {
|
|
7
7
|
tag: string;
|
|
@@ -16,7 +16,6 @@ export interface SvgExportContext {
|
|
|
16
16
|
resolveAssetUrl(assetId: AssetId): string | null;
|
|
17
17
|
resolveColor(color: ShapeColor): string;
|
|
18
18
|
}
|
|
19
|
-
export type SvgThemeColorResolver = (token: ThemeColorTokenName, fallback: string) => string;
|
|
20
19
|
export interface ShapeSvgExporter<S extends ShapeRecordBase = ShapeRecordBase> {
|
|
21
20
|
type: S["type"];
|
|
22
21
|
toSvg(shape: S, context: SvgExportContext): SvgNode | null;
|
|
@@ -25,7 +24,7 @@ export interface ShapeSvgExporter<S extends ShapeRecordBase = ShapeRecordBase> {
|
|
|
25
24
|
export interface SvgExportOptions {
|
|
26
25
|
padding?: number;
|
|
27
26
|
background?: string;
|
|
28
|
-
resolveThemeColor?:
|
|
27
|
+
resolveThemeColor?: ThemeColorResolver;
|
|
29
28
|
}
|
|
30
29
|
export interface SvgExportResult {
|
|
31
30
|
svg: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Box } from "./box";
|
|
2
|
+
import { Mat } from "./mat";
|
|
3
|
+
import { Vec } from "./vec";
|
|
4
|
+
export declare function getShapeContentClipPath({ outputBounds, cutoutLocalPolygons, localToOutput, }: {
|
|
5
|
+
outputBounds: Box;
|
|
6
|
+
cutoutLocalPolygons: readonly (readonly Vec[])[];
|
|
7
|
+
localToOutput?: Mat;
|
|
8
|
+
}): string | null;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { Editor } from "./editor/editor";
|
|
2
2
|
export { createEditorWithPlugins, type CreateEditorWithPluginsOptions, } from "./editor/createEditorWithPlugins";
|
|
3
3
|
export { HistoryManager, type HistoryScope, type HistoryScopeState, type HistoryState, } from "./editor/historyManager";
|
|
4
|
+
export { EditorOperationManager, type EditorCommit, type EditorOperation, type EditorOperationHistory, type EditorOperationOptions, } from "./editor/operationManager";
|
|
4
5
|
export { doesLineSegmentIntersectPolygon, distanceBetweenSegments, distanceToSegment, getPolygonsBounds, isPointInPolygon, isPointInPolygons, isValidPolygon, nearestPointOnSegment, segmentsIntersect, } from "./geometry";
|
|
6
|
+
export { getShapeContentClipPath } from "./geometry/contentCutout";
|
|
5
7
|
export { getShapeGeometry, getShapeExportBounds, getShapeExportPageBounds, getShapeExportToPageTransform, getShapeLocalBounds, getShapeLocalToPageTransform, getShapeTransformFieldsFromMatrix, getShapePositionedOutlineVertices, getShapePositionedToPageTransform, getShapePageBounds, getShapePageCenter, getShapePageCorners, getShapePageOutlineVertices, pagePointToShapePositionedPoint, positionedShapePointToPagePoint, getShapeRenderBounds, getShapeRenderToPageTransform, } from "./editor/queries/shapeTransforms";
|
|
6
8
|
export type { ShapeGeometry, ShapeTransformDecompositionOptions, ShapeTransformFields, } from "./editor/queries/shapeTransforms";
|
|
7
9
|
export type { BindingPreviewState, GapSnapIndicatorGapState, GapSnapIndicatorState, PointSnapIndicatorState, SnapIndicatorState, SelectionBindingSegment, TerminalBindingGuideState, SelectionBindingMiddleHandle, SelectionBindingMiddleHandleAnchor, SelectionBindingTerminalHandle, SelectionBindingTerminalHandleAnchor, SelectionCustomHandle, SelectionCustomHandleAnchor, SelectionHandle, SelectionOverlayFrameState, SelectionOverlayFrameGeometryState, SelectionOverlayFrameStyleState, SelectionOverlayHandleAnchorsState, SelectionOverlayHandleCountsState, SelectionOverlayHandlesState, SelectionOverlayState, SelectionResizeHandle, SelectionResizeHandleAnchor, SelectionResizeHandleId, SelectionResizeMode, SelectionRotateHandle, SelectionRotateHandleAnchor, SelectionRotateHandleId, SelectionMirrorAxis, } from "./editor/selection";
|
|
@@ -10,12 +12,14 @@ export { getAnchoredSelectionResizeLocalBounds, getAspectRatioLockedSelectionRes
|
|
|
10
12
|
export { InteractionHandlerRegistry } from "./editor/interactions";
|
|
11
13
|
export { SelectionHandleInteractionRegistry } from "./editor/selectionHandleInteractions";
|
|
12
14
|
export { ShortcutManager, formatKeyboardShortcut, normalizeKeyboardShortcut, } from "./editor/managers/shortcutManager";
|
|
13
|
-
export type { EditorEventInteractionDecision, EditorEventInteractionHandler, LandInteractionHandler, SelectionHandleInteractionHandler, SelectionHandleInteractionInput, SelectionHandleInteractionSession, SelectionHandleInteractionUpdateResult, } from "./editor/interactions";
|
|
15
|
+
export type { EditorEventInteractionDecision, EditorEventInteractionHandler, LandInteractionHandler, PointerDragInteractionSession, PointerDragInteractionUpdateResult, SelectionHandleInteractionHandler, SelectionHandleInteractionInput, SelectionHandleInteractionSession, SelectionHandleInteractionUpdateResult, ShapePointerInteractionHandler, ShapePointerInteractionInput, } from "./editor/interactions";
|
|
14
16
|
export type { EditorKeyboardShortcutCommand, KeyboardShortcutBinding, KeyboardShortcutChord, KeyboardShortcutEventLike, KeyboardShortcutInput, KeyboardShortcutTarget, } from "./editor/managers/shortcutManager";
|
|
15
17
|
export type { ContainerBoundsQueryOptions, EditorPageState, EditorOverlayDebugState, EditorRenderHostDebugState, EditorSelectionMetadata, EditorSelectionState, LayerOrderDirection, LayerOrderEdge, ReparentShapePlacementInput, ReparentShapePlacementFailureReason, ReparentShapePlacementResult, ShapeSiblingOrderDirection, ShapeSiblingOrderEdge, ShapeSiblingOrderState, ShapeGroupState, ShapeSelectionSiblingOrderState, ShapePropsPatch, EditorToolState, EditorShapeEditingState, } from "./editor/editor";
|
|
16
18
|
export type { ShapeContainment } from "./editor/managers/queryManager";
|
|
17
19
|
export type { ShapeAtPointOptions, ShapeLineSegmentHitTestOptions, SpatialQueryOptions, } from "./editor/managers/spatialIndexManager";
|
|
18
20
|
export type { TerminalBindingTargetInput, ConnectionPoint, ConnectionTerminal, TerminalBindingResolver, TerminalBindingResolverInput, ResolvedTerminalBinding, } from "./bindings/terminalBinding";
|
|
21
|
+
export { DEFAULT_TERMINAL_BINDING_PORTS, getResolvedShapeTerminalBindingPort, getResolvedShapeTerminalBindingPorts, } from "./bindings/terminalPorts";
|
|
22
|
+
export type { ResolvedShapeTerminalBindingPort, ShapeTerminalBindingPort, TerminalBindingPortId, } from "./bindings/terminalPorts";
|
|
19
23
|
export type { EditorCommandOptions, EditorCommands, CreateAssetInput, CreateBindingInput, CreatePageInput, MovePageInput, RenamePageInput, ReparentShapesInput, CreateShapeInput, SetCameraInput, ShapeUpdate, StartEditingShapeInput, UpdateAssetInput, UpdateBindingInput, UpdateDocumentMetaInput, UpdatePageMetaInput, } from "./editor/commands";
|
|
20
24
|
export { reparentShapeToContainingParent } from "./editor/commands";
|
|
21
25
|
export { isEditorClipboardPayload, } from "./editor/clipboard";
|
|
@@ -25,25 +29,25 @@ export type { ChangeSource, RecordUpdate, RecordsDiff, ScopedStoreRecord, StoreR
|
|
|
25
29
|
export { SnapshotParseError, parseDocumentSnapshot, parseSessionSnapshot, } from "./schema/snapshots";
|
|
26
30
|
export type { DocumentSnapshot, SessionSnapshot } from "./schema/snapshots";
|
|
27
31
|
export { ShapeUtil } from "./shapes/shapeUtil";
|
|
28
|
-
export type { ShapeBoundsSnapGeometry, ShapeBrushSelectInput, ShapeBrushWrapInput, ShapeBindingPointInput, ShapeBindingTargetHitTestInput, ShapeChildPlacementInput, ShapeChildVisibilityInput, ShapeEditEndInput, ShapeEditEndResult, ShapeGeometryInput, ShapeGroupingInput, ShapeHandleSnapContext, ShapeHandleSnapGeometry, ShapeLineSegmentHitTestInput, ShapePointHitTestInput, ShapeSnapPoint, ShapeSnapPointKind, ShapeSelectionHandleAnchorInput, ShapeSelectionHandleAnchors, ShapeSelectionFrameInput, ShapeSelectionFlipAxis, ShapeSelectionFlipInput, ShapeSelectionOverlayInfo, ShapeSelectionOverlayInfoInput, ShapeSelectionPagePoints, ShapeSelectionPagePointsInput, ShapeSelectionResizeInput, ShapeSelectionResizeCapabilityInput, ShapeSelectionResizeModesInput, ShapeSelectionTransformCapabilityInput, ShapeSelectionTranslateInput, } from "./shapes/shapeUtil";
|
|
32
|
+
export type { ShapeBoundsSnapGeometry, ShapeBrushSelectInput, ShapeBrushWrapInput, ShapeClipboardCopyInput, ShapeBindingPointInput, ShapeBindingTargetHitTestInput, ShapeChildPlacementInput, ShapeChildVisibilityInput, ShapeEditEndInput, ShapeEditEndResult, ShapeGeometryInput, ShapeGroupingInput, ShapeHandleSnapContext, ShapeHandleSnapGeometry, ShapeHoverTargetInput, ShapeLineSegmentHitTestInput, ShapeLabelPathGeometry, ShapeLabelPathNearestPositionOptions, ShapePointHitTestInput, ShapeSnapPoint, ShapeSnapPointKind, ShapeTerminalBindingOutline, ShapeSelectionHandleAnchorInput, ShapeSelectionHandleAnchors, ShapeSelectionFrameInput, ShapeSelectionFlipAxis, ShapeSelectionFlipInput, ShapeSelectionOverlayInfo, ShapeSelectionOverlayInfoInput, ShapeSelectionPathStyle, ShapeSelectionPagePoints, ShapeSelectionPagePointsInput, ShapeSelectionResizeInput, ShapeSelectionResizeCapabilityInput, ShapeSelectionResizeModesInput, ShapeSelectionTransformCapabilityInput, ShapeSelectionTranslateInput, } from "./shapes/shapeUtil";
|
|
29
33
|
export type { HandleSnapContext, HandleSnapInput, HandleSnapMode, HandleSnapResult, HandleSnapSnapshot, HandleSnapSnapshotInput, ResizeSnapInput, ResizeSnapResult, ResizeSnapSnapshot, SnapAxis, SnapCoordinateSpace, SnapPointIndex, SnapPointIndexEntry, SnapPointKind, TranslateSnapInput, TranslateSnapResult, TranslateSnapSnapshot, } from "./editor/managers/snapTypes";
|
|
30
34
|
export { ShapeUtilRegistry } from "./shapes/shapeUtilRegistry";
|
|
31
35
|
export { resolveTerminalBindingAtPoint, } from "./bindings/terminalBinding";
|
|
32
36
|
export { ShapeSvgExporterRegistry, exportShapesToSvgString, renderSvgNode, } from "./exports/svg";
|
|
33
|
-
export type { ShapeSvgExporter, SvgAttributeValue, SvgElementNode, SvgExportContext, SvgExportOptions, SvgExportResult, SvgExportSkipReason, SvgExportSkippedShape,
|
|
37
|
+
export type { ShapeSvgExporter, SvgAttributeValue, SvgElementNode, SvgExportContext, SvgExportOptions, SvgExportResult, SvgExportSkipReason, SvgExportSkippedShape, SvgNode, } from "./exports/svg";
|
|
34
38
|
export { getExportIntegrityReport, repairExportIntegrity, } from "./exports/integrity";
|
|
35
39
|
export type { ExportIntegrityIssue, ExportIntegrityIssueKind, ExportIntegrityRepairResult, ExportIntegrityReport, } from "./exports/integrity";
|
|
36
40
|
export { getShapeCapabilityManifest } from "./shapes/capabilities";
|
|
37
41
|
export type { ShapeCapabilityDefinition, ShapeCapabilityManifest, ShapeCapabilityManifestEntry, ShapeCapabilitySupport, } from "./shapes/capabilities";
|
|
38
42
|
export { BindingUtil } from "./bindings/bindingUtil";
|
|
39
|
-
export type { BindingSelectionCompanionFrameContext, BindingUtilEffect, } from "./bindings/bindingUtil";
|
|
43
|
+
export type { BindingSelectionCompanionFrameContext, BindingTargetShapeContentCutoutContext, BindingUtilEffect, } from "./bindings/bindingUtil";
|
|
40
44
|
export { BindingUtilRegistry } from "./bindings/bindingUtilRegistry";
|
|
41
45
|
export { StateNode } from "./editor/stateNode";
|
|
42
46
|
export { getEdgeScrollDelta } from "./editor/edgeScroll";
|
|
43
47
|
export { HandTool } from "./tools/hand/handTool";
|
|
44
48
|
export { SelectTool } from "./tools/select/selectTool";
|
|
45
49
|
export { LAND_DEFAULT_THEME_COLOR_FALLBACKS, LAND_THEME_COLOR_SLOTS, LAND_THEME_COLOR_TOKEN_BY_SLOT, areShapeColorsEqual, createCustomShapeColor, createThemeShapeColor, getThemeColorTokenName, isCustomShapeColorRef, isShapeColor, isThemeShapeColorRef, isTransparentShapeColor, normalizeShapeColor, resolveShapeColor, shapeColorToCssColor, } from "./shapes/colors";
|
|
46
|
-
export type { CustomShapeColorRef, ShapeColor, ThemeColorSlot, ThemeColorTokenName, ThemeShapeColorRef, } from "./shapes/colors";
|
|
50
|
+
export type { CustomShapeColorRef, ShapeColor, ThemeColorSlot, ThemeColorResolver, ThemeColorTokenName, ThemeShapeColorRef, } from "./shapes/colors";
|
|
47
51
|
export { getEditorOptionsFromPlugins, setupEditorPlugins, type EditorPlugin, createEditorRuntimeToken, EditorRuntimeRegistry, type EditorRuntimeToken, } from "./plugins";
|
|
48
52
|
export { DEFAULT_CAMERA, DEFAULT_DOCUMENT_ID, DEFAULT_PAGE_ID, DEFAULT_SESSION_ID, createDefaultDocument, createDefaultPage, createDefaultSession, isAssetRecord, isBindingRecord, isDocumentRecord, isDocumentMetadataRecord, isPageRecord, isSessionRecord, isShapeRecord, type AssetId, type AssetRecord, type AssetRecordBase, type BaseRecord, type BindingId, type BindingRecordBase, type BindingRecord, type Camera, type DocumentId, type DocumentMetadataRecord, type DocumentRecord, type EditorRecord, type PageCameraById, type PageId, type PageSelectionById, type PageRecord, type RecordScope, type SessionRecord, type ShapeId, type ShapeParentId, type ShapeRecordBase, type ShapeRecord, type ShapeEditingEntryRequest, type ShapeEditingEntryMode, type ShapeEditingPoint, type ShapeEditingSession, } from "./schema/records";
|
|
49
53
|
export { Vec } from "./geometry/vec";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const LAND_THEME_COLOR_SLOTS: readonly ["fill-blue", "fill-green", "fill-red", "fill-amber", "fill-white", "fill-slate", "stroke-blue", "stroke-green", "stroke-red", "stroke-orange", "stroke-slate", "stroke-muted", "text-slate", "text-blue", "text-green", "text-red"];
|
|
2
2
|
export type ThemeColorSlot = (typeof LAND_THEME_COLOR_SLOTS)[number];
|
|
3
3
|
export type ThemeColorTokenName = `--land-shape-${ThemeColorSlot}`;
|
|
4
|
+
export type ThemeColorResolver = (token: ThemeColorTokenName, fallback: string) => string;
|
|
4
5
|
export interface ThemeShapeColorRef {
|
|
5
6
|
kind: "theme";
|
|
6
7
|
slot: ThemeColorSlot;
|
|
@@ -20,6 +21,6 @@ export declare function isShapeColor(value: unknown): value is ShapeColor;
|
|
|
20
21
|
export declare function getThemeColorTokenName(slot: ThemeColorSlot): ThemeColorTokenName;
|
|
21
22
|
export declare function normalizeShapeColor(value: unknown, fallback: ShapeColor): ShapeColor;
|
|
22
23
|
export declare function shapeColorToCssColor(color: ShapeColor): string;
|
|
23
|
-
export declare function resolveShapeColor(color: ShapeColor, resolveThemeColor?:
|
|
24
|
+
export declare function resolveShapeColor(color: ShapeColor, resolveThemeColor?: ThemeColorResolver): string;
|
|
24
25
|
export declare function isTransparentShapeColor(color: ShapeColor): boolean;
|
|
25
26
|
export declare function areShapeColorsEqual(left: ShapeColor | null | undefined, right: ShapeColor | null | undefined): boolean;
|
|
@@ -6,6 +6,7 @@ import type { CreateShapeInput, ShapeUpdate } from "../editor/commands";
|
|
|
6
6
|
import { type SelectionMirrorAxis } from "../editor/selection";
|
|
7
7
|
import type { SelectionBindingMiddleHandleAnchor, SelectionBindingSegment, SelectionBindingTerminalHandleAnchor, SelectionCustomHandleAnchor, SelectionHandle, SelectionResizeHandleId, SelectionResizeMode } from "../editor/selection";
|
|
8
8
|
import type { ShapeId, ShapeParentId, ShapeRecordBase } from "../schema/records";
|
|
9
|
+
import { type ShapeTerminalBindingPort } from "../bindings/terminalPorts";
|
|
9
10
|
export interface ShapeEditEndResult {
|
|
10
11
|
deleteShapeIds?: ShapeId[];
|
|
11
12
|
}
|
|
@@ -34,6 +35,8 @@ export interface ShapeSelectionResizeCapabilityInput {
|
|
|
34
35
|
}
|
|
35
36
|
export interface ShapeSelectionTransformCapabilityInput {
|
|
36
37
|
editor: Editor;
|
|
38
|
+
/** Set by aggregate capability checks; omitted by frame-only queries. */
|
|
39
|
+
isOnlyAffectedShape?: boolean;
|
|
37
40
|
}
|
|
38
41
|
export interface ShapeSelectionResizeModesInput extends ShapeSelectionResizeCapabilityInput {
|
|
39
42
|
handleId: SelectionResizeHandleId;
|
|
@@ -76,6 +79,10 @@ export interface ShapeLineSegmentHitTestInput {
|
|
|
76
79
|
export interface ShapeGeometryInput {
|
|
77
80
|
editor: Editor;
|
|
78
81
|
}
|
|
82
|
+
export interface ShapeClipboardCopyInput {
|
|
83
|
+
editor: Editor;
|
|
84
|
+
copiedShapeIds: ReadonlySet<ShapeId>;
|
|
85
|
+
}
|
|
79
86
|
export interface ShapeChildVisibilityInput {
|
|
80
87
|
editor: Editor;
|
|
81
88
|
}
|
|
@@ -89,6 +96,10 @@ export interface ShapePointHitTestInput extends ShapeGeometryInput {
|
|
|
89
96
|
}
|
|
90
97
|
export interface ShapeBindingTargetHitTestInput extends ShapePointHitTestInput {
|
|
91
98
|
}
|
|
99
|
+
export interface ShapeTerminalBindingOutline {
|
|
100
|
+
points: readonly Vec[];
|
|
101
|
+
closed: boolean;
|
|
102
|
+
}
|
|
92
103
|
export type ShapeSnapPointKind = "corner" | "edge_midpoint" | "center" | "custom";
|
|
93
104
|
export interface ShapeSnapPoint {
|
|
94
105
|
point: Vec;
|
|
@@ -114,23 +125,50 @@ export interface ShapeSelectionHandleAnchorInput {
|
|
|
114
125
|
editor: Editor;
|
|
115
126
|
}
|
|
116
127
|
export type ShapeSelectionFrameInput = ShapeSelectionTransformCapabilityInput;
|
|
128
|
+
export interface ShapeHoverTargetInput {
|
|
129
|
+
editor: Editor;
|
|
130
|
+
}
|
|
117
131
|
export interface ShapeSelectionTranslateInput {
|
|
118
132
|
editor: Editor;
|
|
119
133
|
}
|
|
120
134
|
export interface ShapeSelectionOverlayInfoInput {
|
|
121
135
|
editor: Editor;
|
|
122
136
|
}
|
|
137
|
+
export interface ShapeLabelPathNearestPositionOptions {
|
|
138
|
+
hintPosition?: number;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* A page-space path that can host a bound label. Positions are normalized by
|
|
142
|
+
* the owner-defined path measure so labels preserve their relative placement
|
|
143
|
+
* when the owner geometry changes.
|
|
144
|
+
*/
|
|
145
|
+
export interface ShapeLabelPathGeometry {
|
|
146
|
+
length: number;
|
|
147
|
+
defaultPosition: number;
|
|
148
|
+
getPointAt(position: number): Vec;
|
|
149
|
+
getNearestPosition(point: Vec, options?: ShapeLabelPathNearestPositionOptions): number;
|
|
150
|
+
}
|
|
123
151
|
export interface ShapeSelectionHandleAnchors {
|
|
124
152
|
terminalHandleAnchors: readonly SelectionBindingTerminalHandleAnchor[];
|
|
125
153
|
middleHandleAnchors: readonly SelectionBindingMiddleHandleAnchor[];
|
|
126
154
|
customHandleAnchors?: readonly SelectionCustomHandleAnchor[];
|
|
127
155
|
}
|
|
156
|
+
export interface ShapeSelectionPathStyle {
|
|
157
|
+
localPath: string;
|
|
158
|
+
localDecorationPaths: readonly string[];
|
|
159
|
+
localBounds: Box;
|
|
160
|
+
localToPage: Mat;
|
|
161
|
+
strokeWidth: number;
|
|
162
|
+
strokeDasharray?: string;
|
|
163
|
+
}
|
|
128
164
|
export interface ShapeSelectionOverlayInfo {
|
|
129
165
|
usesSelectionPathOverlay: boolean;
|
|
130
166
|
startPagePoint: Vec | null;
|
|
131
167
|
endPagePoint: Vec | null;
|
|
132
168
|
middlePagePoint: Vec | null;
|
|
133
169
|
path: string | null;
|
|
170
|
+
pathStyle: ShapeSelectionPathStyle | null;
|
|
171
|
+
pageClipPath?: string | null;
|
|
134
172
|
bindingSegments?: readonly SelectionBindingSegment[];
|
|
135
173
|
}
|
|
136
174
|
export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordBase> {
|
|
@@ -156,10 +194,14 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
|
|
|
156
194
|
getSelectionPageMiddlePoint(_shape: S): Vec | null;
|
|
157
195
|
contributesToSelectionFrame(_shape: S, _input: ShapeSelectionFrameInput): boolean;
|
|
158
196
|
canParticipateInSelectionResize(_shape: S, _input: ShapeSelectionTransformCapabilityInput): boolean;
|
|
197
|
+
canParticipateInSelectionFlip(shape: S, input: ShapeSelectionTransformCapabilityInput): boolean;
|
|
159
198
|
canParticipateInSelectionRotation(_shape: S, _input: ShapeSelectionTransformCapabilityInput): boolean;
|
|
160
199
|
canUseSelectionResizeHandles(shape: S, input: ShapeSelectionFrameInput): boolean;
|
|
161
200
|
canUseSelectionRotateHandle(shape: S, input: ShapeSelectionFrameInput): boolean;
|
|
201
|
+
canParticipateInSelectionTranslation(_shape: S, _input: ShapeSelectionTranslateInput): boolean;
|
|
162
202
|
getSelectionTargetId(shape: S, _input: ShapeSelectionFrameInput): ShapeId;
|
|
203
|
+
getHoverTargetId(shape: S, _input: ShapeHoverTargetInput): ShapeId;
|
|
204
|
+
getHoverDecorationTargetId(shape: S, _input: ShapeHoverTargetInput): ShapeId;
|
|
163
205
|
getTranslateTargetId(shape: S, _input: ShapeSelectionTranslateInput): ShapeId;
|
|
164
206
|
isSelectionTransformContainer(_shape: S): boolean;
|
|
165
207
|
shouldRotateDescendants(shape: S): boolean;
|
|
@@ -170,7 +212,7 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
|
|
|
170
212
|
canUngroupChildren(_shape: S): boolean;
|
|
171
213
|
getGroupingShapeCreateInput(_input: ShapeGroupingInput): CreateShapeInput | null;
|
|
172
214
|
canStartTranslateFromSelectionBounds(_shape: S, _input: ShapeSelectionFrameInput): boolean;
|
|
173
|
-
canSnap(_shape: S): boolean;
|
|
215
|
+
canSnap(_shape: S, _input?: ShapeGeometryInput): boolean;
|
|
174
216
|
canSnapChildrenToSelf(_shape: S): boolean;
|
|
175
217
|
getBoundsSnapGeometry(_shape: S): ShapeBoundsSnapGeometry;
|
|
176
218
|
getHandleSnapGeometry(shape: S): ShapeHandleSnapGeometry;
|
|
@@ -178,6 +220,7 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
|
|
|
178
220
|
getSelectionFramePositionedOutlineVertices(_shape: S, _input: ShapeSelectionFrameInput): Vec[] | null;
|
|
179
221
|
getSelectionHandleAnchors(_shape: S, _input: ShapeSelectionHandleAnchorInput): ShapeSelectionHandleAnchors;
|
|
180
222
|
getSelectionOverlayInfo(_shape: S, _input: ShapeSelectionOverlayInfoInput): ShapeSelectionOverlayInfo;
|
|
223
|
+
getLabelPathGeometry(_shape: S, _input: ShapeSelectionOverlayInfoInput): ShapeLabelPathGeometry | null;
|
|
181
224
|
isWrappedByBrush(_shape: S, input: ShapeBrushWrapInput): boolean;
|
|
182
225
|
canSelectByBrush(shape: S, input: ShapeBrushSelectInput): boolean;
|
|
183
226
|
getLocalToPageTransform(shape: S): Mat;
|
|
@@ -189,6 +232,9 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
|
|
|
189
232
|
canAutomaticallyReceiveChildren(shape: S): boolean;
|
|
190
233
|
canBeDirectlyBrushSelected(_shape: S): boolean;
|
|
191
234
|
canReceiveTerminalBinding(_shape: S, _input?: ShapeGeometryInput): boolean;
|
|
235
|
+
getTerminalBindingPorts(shape: S, input: ShapeGeometryInput): readonly ShapeTerminalBindingPort[];
|
|
236
|
+
getTerminalBindingOutlines(shape: S, input: ShapeGeometryInput): readonly ShapeTerminalBindingOutline[];
|
|
237
|
+
canCopyToClipboard(_shape: S, _input: ShapeClipboardCopyInput): boolean;
|
|
192
238
|
repairLoadedShape(_shape: S): S | null;
|
|
193
239
|
onEditEnd(_shape: S, _input: ShapeEditEndInput): ShapeEditEndResult | void;
|
|
194
240
|
hitTest(shape: S, positionedPoint: Vec, _input?: ShapePointHitTestInput): boolean;
|
|
@@ -5,7 +5,8 @@ import type { ShapeUpdate } from "../../editor/commands";
|
|
|
5
5
|
import type { Editor } from "../../editor/editor";
|
|
6
6
|
import type { PointerEditorEvent, TickEditorEvent } from "../../editor/events";
|
|
7
7
|
import type { SelectionResizeHandleId, SelectionResizeMode, SelectionResizePointShapeSnapshot, SelectionResizeShapeSnapshot, SelectionRotationTransform, SelectionRotatePointShapeSnapshot, SelectionRotateShapeSnapshot } from "../../editor/selection";
|
|
8
|
-
import type { HandleSnapSnapshot, ResizeSnapSnapshot, TranslateSnapSnapshot } from "../../editor/managers/snapTypes";
|
|
8
|
+
import type { HandleSnapMode, HandleSnapSnapshot, ResizeSnapSnapshot, TranslateSnapSnapshot } from "../../editor/managers/snapTypes";
|
|
9
|
+
import type { PointerDragInteractionSession } from "../../editor/interactions";
|
|
9
10
|
import type { SelectionHandleInteractionSession } from "../../editor/selectionHandleInteractions";
|
|
10
11
|
import type { ShapeId, ShapeRecord } from "../../schema/records";
|
|
11
12
|
export declare const DRAG_START_DISTANCE = 3;
|
|
@@ -38,6 +39,7 @@ export interface PointingShapeInfo {
|
|
|
38
39
|
wasSelected: boolean;
|
|
39
40
|
fromSelectionBounds: boolean;
|
|
40
41
|
quickClickSelectionTargetId: ShapeId | null;
|
|
42
|
+
dragSession: PointerDragInteractionSession | null;
|
|
41
43
|
}
|
|
42
44
|
export interface TranslatingShapeSnapshot {
|
|
43
45
|
id: ShapeId;
|
|
@@ -107,7 +109,12 @@ export interface PointingSelectionHandleInteractionInfo {
|
|
|
107
109
|
session: SelectionHandleInteractionSession;
|
|
108
110
|
snapSnapshot: HandleSnapSnapshot | null;
|
|
109
111
|
}
|
|
110
|
-
export interface
|
|
112
|
+
export interface DraggingPluginInteractionInfo {
|
|
113
|
+
originPagePoint: Vec;
|
|
114
|
+
previousSelection: ShapeId[];
|
|
115
|
+
session: PointerDragInteractionSession;
|
|
116
|
+
snapMode: HandleSnapMode;
|
|
117
|
+
snapSnapshot: HandleSnapSnapshot | null;
|
|
111
118
|
lastPagePointX: number;
|
|
112
119
|
lastPagePointY: number;
|
|
113
120
|
lastShiftKey: boolean;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { Editor } from "../../../editor/editor";
|
|
2
2
|
import { StateNode } from "../../../editor/stateNode";
|
|
3
3
|
import type { CancelEditorEvent, PointerEditorEvent } from "../../../editor/events";
|
|
4
|
-
import { type
|
|
4
|
+
import { type DraggingPluginInteractionInfo } from "../selectToolHelpers";
|
|
5
5
|
import { DraggingStateNode, type DragApplyInput } from "./selectStateNode";
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class DraggingPluginInteractionState extends DraggingStateNode<DraggingPluginInteractionInfo> {
|
|
7
7
|
protected readonly tickMode: "apply_after_scroll";
|
|
8
8
|
constructor(editor: Editor, parent: StateNode);
|
|
9
|
-
protected
|
|
9
|
+
protected getOperationKind(info: DraggingPluginInteractionInfo): string;
|
|
10
|
+
protected onDragStart(): void;
|
|
10
11
|
protected onPointerUp(event: PointerEditorEvent): void;
|
|
11
12
|
protected onCancel(event: CancelEditorEvent): void;
|
|
12
13
|
protected onInfoExit(): void;
|
|
13
|
-
protected apply({ pagePoint, shiftKey, altKey, accelKey }: DragApplyInput): void;
|
|
14
|
+
protected apply({ pagePoint, shiftKey, altKey, accelKey, }: DragApplyInput): void;
|
|
14
15
|
private complete;
|
|
15
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { BrushingState } from "./brushingState";
|
|
2
|
-
export {
|
|
2
|
+
export { DraggingPluginInteractionState } from "./draggingPluginInteractionState";
|
|
3
3
|
export { IdleState } from "./idleState";
|
|
4
4
|
export { PointingCanvasState } from "./pointingCanvasState";
|
|
5
5
|
export { PointingResizeHandleState } from "./pointingResizeHandleState";
|
package/_vendor/canvas-core/tools/select/states/pointingSelectionHandleInteractionState.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Editor } from "../../../editor/editor";
|
|
2
|
-
import type { CancelEditorEvent } from "../../../editor/events";
|
|
2
|
+
import type { CancelEditorEvent, PointerEditorEvent } from "../../../editor/events";
|
|
3
3
|
import { StateNode } from "../../../editor/stateNode";
|
|
4
4
|
import { type PointingSelectionHandleInteractionInfo } from "../selectToolHelpers";
|
|
5
5
|
import { PointingStateNode } from "./selectStateNode";
|
|
6
6
|
export declare class PointingSelectionHandleInteractionState extends PointingStateNode<PointingSelectionHandleInteractionInfo> {
|
|
7
7
|
constructor(editor: Editor, parent: StateNode);
|
|
8
8
|
protected onDragThresholdExceeded(): void;
|
|
9
|
-
protected onPointerUp(): void;
|
|
9
|
+
protected onPointerUp(event: PointerEditorEvent): void;
|
|
10
10
|
protected onCancel(event: CancelEditorEvent): void;
|
|
11
11
|
}
|
|
@@ -6,7 +6,7 @@ import { PointingStateNode } from "./selectStateNode";
|
|
|
6
6
|
export declare class PointingShapeState extends PointingStateNode<PointingShapeInfo> {
|
|
7
7
|
constructor(editor: Editor, parent: StateNode);
|
|
8
8
|
protected onInfoEnter(): void;
|
|
9
|
-
protected onDragThresholdExceeded(): void;
|
|
9
|
+
protected onDragThresholdExceeded(event: PointerEditorEvent): void;
|
|
10
10
|
protected onPointerUp(event: PointerEditorEvent): void;
|
|
11
11
|
protected onCancel(): void;
|
|
12
12
|
}
|
|
@@ -5,7 +5,7 @@ import { DraggingStateNode, type DragApplyInput } from "./selectStateNode";
|
|
|
5
5
|
export declare class ResizingState extends DraggingStateNode<ResizingInfo> {
|
|
6
6
|
protected readonly tickMode: "apply_after_scroll_or_without_screen_point";
|
|
7
7
|
constructor(editor: Editor, parent: StateNode);
|
|
8
|
-
protected
|
|
8
|
+
protected getOperationKind(): string;
|
|
9
9
|
protected onDragStart(): void;
|
|
10
10
|
protected onPointerUp(): void;
|
|
11
11
|
protected onCancel(): void;
|
|
@@ -5,7 +5,7 @@ import { DraggingStateNode, type DragApplyInput } from "./selectStateNode";
|
|
|
5
5
|
export declare class RotatingState extends DraggingStateNode<RotatingInfo> {
|
|
6
6
|
protected readonly tickMode: "apply_after_scroll";
|
|
7
7
|
constructor(editor: Editor, parent: StateNode);
|
|
8
|
-
protected
|
|
8
|
+
protected getOperationKind(): string;
|
|
9
9
|
protected onPointerUp(): void;
|
|
10
10
|
protected onCancel(): void;
|
|
11
11
|
protected apply({ pagePoint, shiftKey, accelKey }: DragApplyInput): void;
|
|
@@ -2,6 +2,7 @@ import type { Vec } from "../../../geometry/vec";
|
|
|
2
2
|
import { StateNode } from "../../../editor/stateNode";
|
|
3
3
|
import type { PointerEditorEvent, TickEditorEvent } from "../../../editor/events";
|
|
4
4
|
import { type EdgeScrollTickMode } from "../selectToolHelpers";
|
|
5
|
+
import type { EditorOperation } from "../../../editor/operationManager";
|
|
5
6
|
/**
|
|
6
7
|
* Base for every select-tool state that carries a transient `info` payload.
|
|
7
8
|
* Centralises the identical `info` lifecycle (assign on enter, clear on exit)
|
|
@@ -43,10 +44,11 @@ export interface DragApplyInput {
|
|
|
43
44
|
* completion/cancellation and any extra cleanup.
|
|
44
45
|
*/
|
|
45
46
|
export declare abstract class DraggingStateNode<T> extends InfoStateNode<T> {
|
|
47
|
+
protected operation: EditorOperation | null;
|
|
46
48
|
/** Edge-scroll behaviour for this gesture's tick handling. */
|
|
47
49
|
protected abstract readonly tickMode: EdgeScrollTickMode;
|
|
48
|
-
/**
|
|
49
|
-
protected abstract
|
|
50
|
+
/** Stable operation kind for this gesture. */
|
|
51
|
+
protected abstract getOperationKind(info: T): string;
|
|
50
52
|
/** Apply one drag sample. Implementations must guard on `this.info`. */
|
|
51
53
|
protected abstract apply(input: DragApplyInput): void;
|
|
52
54
|
protected onInfoEnter(): void;
|
|
@@ -57,4 +59,6 @@ export declare abstract class DraggingStateNode<T> extends InfoStateNode<T> {
|
|
|
57
59
|
protected onKeyDown(): void;
|
|
58
60
|
protected onKeyUp(): void;
|
|
59
61
|
protected applyFromInputs(): void;
|
|
62
|
+
protected commitOperation(): void;
|
|
63
|
+
protected cancelOperation(): void;
|
|
60
64
|
}
|
|
@@ -6,7 +6,7 @@ import { DraggingStateNode, type DragApplyInput } from "./selectStateNode";
|
|
|
6
6
|
export declare class TranslatingState extends DraggingStateNode<TranslatingInfo> {
|
|
7
7
|
protected readonly tickMode: "always_apply";
|
|
8
8
|
constructor(editor: Editor, parent: StateNode);
|
|
9
|
-
protected
|
|
9
|
+
protected getOperationKind(): string;
|
|
10
10
|
protected onDragStart(): void;
|
|
11
11
|
protected onPointerUp(event: PointerEditorEvent): void;
|
|
12
12
|
protected onCancel(): void;
|
|
@@ -5,6 +5,7 @@ export interface CanvasSelectionSnapshot {
|
|
|
5
5
|
count: number;
|
|
6
6
|
singleShapeType: ShapeRecordBase["type"] | null;
|
|
7
7
|
commonShapeType: ShapeRecordBase["type"] | null;
|
|
8
|
+
canFlip: boolean;
|
|
8
9
|
canResetRotation: boolean;
|
|
9
10
|
isMixedFrameAndPointHandleSelection: boolean;
|
|
10
11
|
}
|
|
@@ -24,10 +25,26 @@ export interface CanvasActionRunInput<TValue extends CanvasActionValue> {
|
|
|
24
25
|
context: CanvasActionContext;
|
|
25
26
|
value: TValue;
|
|
26
27
|
}
|
|
28
|
+
export type CanvasActionAvailability = "inapplicable" | "disabled" | "enabled";
|
|
27
29
|
export interface CanvasAction<TValue extends CanvasActionValue = CanvasActionValue> {
|
|
28
30
|
id: string;
|
|
29
|
-
|
|
30
|
-
isEnabled?(context: CanvasActionContext): boolean;
|
|
31
|
+
getAvailability?(context: CanvasActionContext): CanvasActionAvailability;
|
|
31
32
|
getValue?(context: CanvasActionContext): TValue;
|
|
32
33
|
run(input: CanvasActionRunInput<TValue>): void;
|
|
33
34
|
}
|
|
35
|
+
export declare function resolveCanvasActionAvailability(action: CanvasAction, context: CanvasActionContext): CanvasActionAvailability;
|
|
36
|
+
export declare function createCanvasActionContext({ editor, toolState, selectionState, }: {
|
|
37
|
+
editor: Editor;
|
|
38
|
+
toolState: {
|
|
39
|
+
activeToolId: string;
|
|
40
|
+
isToolLocked: boolean;
|
|
41
|
+
};
|
|
42
|
+
selectionState: {
|
|
43
|
+
count: number;
|
|
44
|
+
singleShapeType: CanvasActionContext["selection"]["singleShapeType"];
|
|
45
|
+
commonShapeType: CanvasActionContext["selection"]["commonShapeType"];
|
|
46
|
+
canFlipSelection: boolean;
|
|
47
|
+
canResetSelectionRotation: boolean;
|
|
48
|
+
isMixedFrameAndPointHandleSelection: boolean;
|
|
49
|
+
};
|
|
50
|
+
}): CanvasActionContext;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type CanvasPluginCapabilityKind = "api" | "service" | "value";
|
|
2
|
+
export interface CanvasPluginCapabilityToken<TValue = unknown, TKind extends CanvasPluginCapabilityKind = CanvasPluginCapabilityKind> {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly kind: TKind;
|
|
5
|
+
readonly __value?: TValue;
|
|
6
|
+
}
|
|
7
|
+
export interface CanvasPluginValueToken<TValue> extends CanvasPluginCapabilityToken<TValue, "value"> {
|
|
8
|
+
}
|
|
9
|
+
export interface CanvasPluginCapabilityRegistry {
|
|
10
|
+
get<TValue>(token: CanvasPluginValueToken<TValue>): TValue | null;
|
|
11
|
+
}
|
|
12
|
+
export interface CanvasPluginCapabilitySetup extends CanvasPluginCapabilityRegistry {
|
|
13
|
+
provide<TValue>(token: CanvasPluginValueToken<TValue>, value: TValue): void;
|
|
14
|
+
}
|
|
15
|
+
export declare function createCanvasPluginValueToken<TValue>(id: string): CanvasPluginValueToken<TValue>;
|
|
16
|
+
export declare function isCanvasPluginCapabilityToken(value: unknown): value is CanvasPluginCapabilityToken;
|