@yuzhouu/canvas-kit 0.1.12 → 0.1.13
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 +27 -1
- package/_vendor/canvas-core/bindings/bindingUtil.d.ts +1 -0
- package/_vendor/canvas-core/editor/clipboard.d.ts +1 -1
- package/_vendor/canvas-core/editor/commands.d.ts +0 -2
- package/_vendor/canvas-core/editor/managers/bindingManager.d.ts +4 -0
- package/_vendor/canvas-core/editor/queries/shapeTransforms.d.ts +3 -4
- package/_vendor/canvas-core/editor/resizeGeometry.d.ts +20 -0
- package/_vendor/canvas-core/editor/selectionResizeCapabilities.d.ts +2 -0
- package/_vendor/canvas-core/geometry/mat.d.ts +2 -3
- package/_vendor/canvas-core/index.d.ts +4 -2
- package/_vendor/canvas-core/schema/records.d.ts +0 -1
- package/_vendor/canvas-core/schema/snapshots.d.ts +2 -2
- package/_vendor/canvas-core/shapes/childTransformPolicy.d.ts +16 -0
- package/_vendor/canvas-core/shapes/shapeUtil.d.ts +3 -3
- package/_vendor/plugin-text/textShapeHelpers.d.ts +0 -1
- package/browser/persistence.d.ts +1 -1
- package/canvasKitTools.d.ts +3 -0
- package/chrome/contextMenuRuntime.d.ts +7 -0
- package/chrome/toolbar/toolbarLabels.d.ts +1 -1
- package/chrome/types.d.ts +4 -5
- package/chrome/useCanvasKitChromeContext.d.ts +6 -6
- package/chrome/useCanvasKitLayerTree.d.ts +3 -2
- package/chrome/useHistoryControls.d.ts +3 -3
- package/chrome/usePageControls.d.ts +8 -8
- package/chrome/useZoomControls.d.ts +5 -1
- package/commands/command.d.ts +11 -0
- package/commands/commandTokens.d.ts +61 -0
- package/commands/documentCommands.d.ts +2 -0
- package/commands/historyCommands.d.ts +3 -0
- package/commands/index.d.ts +11 -0
- package/commands/layerCommands.d.ts +20 -0
- package/commands/pageCommands.d.ts +12 -0
- package/commands/selectionCommands.d.ts +12 -0
- package/commands/shapeCommands.d.ts +8 -0
- package/commands/toolCommands.d.ts +2 -0
- package/commands/viewCommands.d.ts +10 -0
- package/contracts/canvasProductControllerContracts.d.ts +32 -0
- package/{core/product-controller → controller}/canvasProductController.d.ts +27 -55
- package/controller/index.d.ts +3 -0
- package/{core/product-controller/productLayerTree.d.ts → controller/layerTree.d.ts} +1 -1
- package/index.d.ts +17 -15
- package/index.mjs +88 -88
- package/package.json +1 -1
- package/plugins/host/image/api/imageHostApi.d.ts +11 -0
- package/plugins/host/image/api/imageHostApiContract.d.ts +60 -0
- package/{features → plugins/host}/image/asset/imageAssetService.d.ts +3 -2
- package/{features → plugins/host}/image/asset/imageBlobStore.d.ts +2 -2
- package/{features → plugins/host}/image/asset/imageFileHelpers.d.ts +1 -1
- package/{features → plugins/host}/image/asset/svgImageAssetInliner.d.ts +1 -1
- package/{features → plugins/host}/image/import/ImageImportController.d.ts +2 -2
- package/{features → plugins/host}/image/index.d.ts +4 -4
- package/plugins/host/image/plugin.d.ts +1 -0
- package/{features → plugins/host}/image/smudge/imageSmudgeHostActions.d.ts +3 -3
- package/{features → plugins/host}/image/toolbar/imageHostActions.d.ts +8 -24
- package/{features → plugins/host}/image/toolbar/imageToolbarHostBridge.d.ts +2 -2
- package/{features → plugins/host}/text/link/TextLinkHoverPopover.d.ts +1 -1
- package/plugins/host/text/textHostPlugin.d.ts +5 -0
- package/plugins/host/text/textSvgAssetInliner.d.ts +3 -0
- package/plugins/host/text/textSvgAssetPlugin.d.ts +2 -0
- package/plugins/runtime/keyboard-shortcuts/useCanvasKeyboardShortcuts.d.ts +3 -5
- package/plugins/standard/selection/actions.d.ts +13 -13
- package/plugins/standard/tool-ui/contextMenu.d.ts +1 -1
- package/plugins/standard/view/actions.d.ts +4 -4
- package/react/CanvasKitRoot.d.ts +3 -2
- package/react/useCanvasProductControllerLifecycle.d.ts +9 -0
- package/runtime/canvasKitActionExecutor.d.ts +12 -0
- package/runtime/canvasKitCommandExecutor.d.ts +11 -2
- package/runtime/canvasKitPluginContracts.d.ts +6 -10
- package/runtime/canvasKitPluginLifecycle.d.ts +2 -2
- package/runtime/canvasKitPluginSetup.d.ts +6 -5
- package/runtime/canvasKitPluginUi.d.ts +2 -0
- package/runtime/canvasKitRuntime.d.ts +14 -5
- package/runtime/canvasKitRuntimeContracts.d.ts +8 -7
- package/runtime/createCanvasKitCommandAction.d.ts +10 -0
- package/runtime/createCanvasKitEditor.d.ts +7 -0
- package/{core/runtime/runtimeContracts.d.ts → runtime/persistenceContracts.d.ts} +1 -6
- package/runtime/persistenceCoordinator.d.ts +1 -1
- package/{core/runtime/productAssets.d.ts → runtime/productAssetResolvers.d.ts} +11 -2
- package/runtime/productServiceRegistry.d.ts +8 -0
- package/controller/canvasKitController.d.ts +0 -28
- package/core/index.d.ts +0 -7
- package/core/product-controller/index.d.ts +0 -2
- package/core/runtime/productEditor.d.ts +0 -3
- package/core/runtime/productServices.d.ts +0 -20
- package/features/context-menu/contextMenuRuntime.d.ts +0 -13
- package/features/image/controller/imageProductController.d.ts +0 -27
- package/features/image/imageHostPlugin.d.ts +0 -1
- package/features/image/smudge/imageSmudgeTypes.d.ts +0 -25
- package/features/text/textHostPlugin.d.ts +0 -5
- package/features/text/textSvgAssetInliner.d.ts +0 -3
- package/features/text/textSvgAssetPlugin.d.ts +0 -2
- package/react/useCanvasKitControllerLifecycle.d.ts +0 -8
package/README.md
CHANGED
|
@@ -211,7 +211,7 @@ const options: CanvasKitRuntimeOptions = {
|
|
|
211
211
|
- `ui`
|
|
212
212
|
- `lifecycle.beforeReady()`, `lifecycle.beforeCommand()`, and `lifecycle.defer()`
|
|
213
213
|
|
|
214
|
-
`setup` returns nothing. Every owned resource registers cleanup through `lifecycle.defer()`, which gives Runtime one cleanup protocol and reverse-order resource stack. `beforeReady` runs serially during `start()` after restore/seed and asset preparation. `beforeCommand` is a repeatable interceptor executed by the Runtime-bound command executor.
|
|
214
|
+
`setup` returns nothing. Every owned resource registers cleanup through `lifecycle.defer()`, which gives Runtime one cleanup protocol and reverse-order resource stack. `beforeReady` runs serially during `start()` after restore/seed and asset preparation. `beforeCommand` is a repeatable interceptor executed by the Runtime-bound command executor after Runtime is ready. Public Controller and action writes are rejected outside the ready state; seed uses a private bootstrap executor, so restore, seed, and `beforeReady` initialization do not trigger it. Parameterized built-in actions validate their value before the hook runs. Controller writes and built-in actions reuse the same internal command definitions, whose IDs come from the public read-only `CANVAS_KIT_COMMAND_TOKENS` catalog.
|
|
215
215
|
|
|
216
216
|
The set-active-tool and tool-lock actions are provided by the replaceable
|
|
217
217
|
Runtime default for `canvasToolActionsCapability`, so shape toolbar plugins do
|
|
@@ -223,6 +223,32 @@ are no component slots.
|
|
|
223
223
|
|
|
224
224
|
External code should work through `runtime.controller` or the controller supplied to `onControllerReady`. The controller exposes document, selection, page, tool, camera, layer, history, export, standard shape creation, and registered API operations without exposing the raw store.
|
|
225
225
|
|
|
226
|
+
Controller reads are available immediately for assembly and inspection, but
|
|
227
|
+
Controller writes require `await runtime.start()`. Plugins can match
|
|
228
|
+
`beforeCommand` events against stable command identities without importing
|
|
229
|
+
internals:
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
import {
|
|
233
|
+
CANVAS_KIT_COMMAND_TOKENS,
|
|
234
|
+
canvasKitLifecycleExtension,
|
|
235
|
+
defineCanvasPlugin,
|
|
236
|
+
} from "@land/canvas-kit";
|
|
237
|
+
|
|
238
|
+
const analyticsPlugin = defineCanvasPlugin({
|
|
239
|
+
id: "example.command-analytics",
|
|
240
|
+
setup(context) {
|
|
241
|
+
context
|
|
242
|
+
.get(canvasKitLifecycleExtension)
|
|
243
|
+
.beforeCommand(({ commandId }) => {
|
|
244
|
+
if (commandId === CANVAS_KIT_COMMAND_TOKENS.layer.bringToFront.id) {
|
|
245
|
+
// Record the product command.
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
```
|
|
251
|
+
|
|
226
252
|
### Export API
|
|
227
253
|
|
|
228
254
|
SVG and PNG export are async registered APIs so resource preparation and
|
|
@@ -66,3 +66,4 @@ export declare abstract class BindingUtil<B extends BindingRecordBase = BindingR
|
|
|
66
66
|
getSelectionCompanionFrameGeometries?(editor: Editor, binding: B, context: BindingSelectionCompanionFrameContext): SelectionOverlayFrameGeometryState[];
|
|
67
67
|
}
|
|
68
68
|
export declare function resolveShapeHierarchyRootId(shapeId: ShapeRecord["id"], bindings: readonly BindingRecord[], getBindingUtil: (binding: BindingRecord) => BindingUtil): ShapeRecord["id"];
|
|
69
|
+
export declare function resolveShapeHierarchyRootIds(shapeIds: readonly ShapeRecord["id"][], bindings: readonly BindingRecord[], getBindingUtil: (binding: BindingRecord) => BindingUtil): ReadonlyMap<ShapeRecord["id"], ShapeRecord["id"]>;
|
|
@@ -4,7 +4,7 @@ import type { AssetId, AssetRecord, BindingRecord, ShapeId, ShapeRecord } from "
|
|
|
4
4
|
import type { Editor } from "./editor";
|
|
5
5
|
export interface EditorClipboardPayload {
|
|
6
6
|
type: "land/clipboard";
|
|
7
|
-
version:
|
|
7
|
+
version: 2;
|
|
8
8
|
source: {
|
|
9
9
|
app: "land";
|
|
10
10
|
documentId?: string;
|
|
@@ -24,7 +24,6 @@ export interface CreateShapeInput {
|
|
|
24
24
|
opacity?: number;
|
|
25
25
|
isHidden?: boolean;
|
|
26
26
|
rotation?: number;
|
|
27
|
-
skewX?: number;
|
|
28
27
|
scaleX?: number;
|
|
29
28
|
scaleY?: number;
|
|
30
29
|
isLocked?: boolean;
|
|
@@ -46,7 +45,6 @@ export interface ShapeUpdate {
|
|
|
46
45
|
x?: number;
|
|
47
46
|
y?: number;
|
|
48
47
|
rotation?: number;
|
|
49
|
-
skewX?: number;
|
|
50
48
|
scaleX?: number;
|
|
51
49
|
scaleY?: number;
|
|
52
50
|
opacity?: number;
|
|
@@ -15,9 +15,13 @@ export declare class BindingManager {
|
|
|
15
15
|
repairLoadedBindings(source: ChangeSource): void;
|
|
16
16
|
handleShapeChanges(changes: ShapeChangeEntry[], source: ChangeSource): void;
|
|
17
17
|
getShapeHierarchyRootId(shapeId: ShapeId): ShapeId;
|
|
18
|
+
getShapeHierarchyRootIds(shapeIds: readonly ShapeId[]): ReadonlyMap<ShapeId, ShapeId>;
|
|
19
|
+
getShapeHierarchyMemberIds(shapeIds: readonly ShapeId[]): ShapeId[];
|
|
18
20
|
cleanupBindingsForDeletedShapes(ids: ShapeId[], source: ChangeSource): void;
|
|
19
21
|
cleanupBindings(ids: BindingId[], source: ChangeSource): void;
|
|
20
22
|
private applyEffect;
|
|
23
|
+
private syncShapeHierarchyState;
|
|
24
|
+
private getShapeHierarchyContext;
|
|
21
25
|
private getAllBindings;
|
|
22
26
|
private getExclusiveBindingKey;
|
|
23
27
|
}
|
|
@@ -13,7 +13,6 @@ export interface ShapeTransformFields {
|
|
|
13
13
|
x: number;
|
|
14
14
|
y: number;
|
|
15
15
|
rotation: number;
|
|
16
|
-
skewX: number;
|
|
17
16
|
scaleX: number;
|
|
18
17
|
scaleY: number;
|
|
19
18
|
}
|
|
@@ -24,9 +23,9 @@ export interface ShapeTransformDecompositionOptions {
|
|
|
24
23
|
preferredScaleYSign?: number;
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
|
-
*
|
|
28
|
-
* translate/rotate/
|
|
29
|
-
*
|
|
26
|
+
* Strictly decompose a local-to-parent affine transform into the shape model's
|
|
27
|
+
* translate/rotate/scale fields. Non-orthogonal matrices cannot be represented
|
|
28
|
+
* without shear and therefore return null.
|
|
30
29
|
*/
|
|
31
30
|
export declare function getShapeTransformFieldsFromMatrix(matrix: Mat, localBounds: Box, options?: ShapeTransformDecompositionOptions): ShapeTransformFields | null;
|
|
32
31
|
export declare function getShapeLocalBounds<S extends ShapeRecord>(shape: S, util: ShapeUtil<S>): Box;
|
|
@@ -10,6 +10,26 @@ export interface SelectionResizeScalesResult {
|
|
|
10
10
|
scaleX: number;
|
|
11
11
|
scaleY: number;
|
|
12
12
|
}
|
|
13
|
+
/** Gets the axis-aligned size after applying a shape's scale. */
|
|
14
|
+
export declare function getSelectionResizeDimensionsFromLocal({ localWidth, localHeight, scaleX, scaleY, }: {
|
|
15
|
+
localWidth: number;
|
|
16
|
+
localHeight: number;
|
|
17
|
+
scaleX: number;
|
|
18
|
+
scaleY: number;
|
|
19
|
+
}): {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
};
|
|
23
|
+
/** Recovers intrinsic dimensions from an axis-aligned scaled size. */
|
|
24
|
+
export declare function getLocalDimensionsFromSelectionResize({ width, height, scaleX, scaleY, }: {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
scaleX: number;
|
|
28
|
+
scaleY: number;
|
|
29
|
+
}): {
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
};
|
|
13
33
|
export declare function selectionResizeHandleMovesLeftEdge(handleId: SelectionResizeHandleId): boolean;
|
|
14
34
|
export declare function selectionResizeHandleMovesRightEdge(handleId: SelectionResizeHandleId): boolean;
|
|
15
35
|
export declare function selectionResizeHandleMovesTopEdge(handleId: SelectionResizeHandleId): boolean;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ShapeRecord } from "../schema/records";
|
|
2
2
|
import type { Editor } from "./editor";
|
|
3
3
|
import { type SelectionResizeHandleId, type SelectionResizeMode } from "./selection";
|
|
4
|
+
export type SelectionResizeRotationCompatibility = "parallel" | "perpendicular";
|
|
5
|
+
export declare function getSelectionResizeRotationCompatibility(left: number, right: number): SelectionResizeRotationCompatibility | null;
|
|
4
6
|
export declare function areSelectionResizeRotationsCompatible(left: number, right: number): boolean;
|
|
5
7
|
export declare function areSelectionResizeTargetRotationsCompatible(editor: Editor, resizeTargetShapes: readonly ShapeRecord[], selectionRotation: number): boolean;
|
|
6
8
|
export declare function intersectSelectionResizeModes(modeSets: readonly (readonly SelectionResizeMode[])[]): SelectionResizeMode[];
|
|
@@ -16,7 +16,6 @@ export declare class Mat {
|
|
|
16
16
|
static Identity(): Mat;
|
|
17
17
|
static Translate(x: number, y: number): Mat;
|
|
18
18
|
static Rotate(angle: number): Mat;
|
|
19
|
-
static SkewX(angle: number): Mat;
|
|
20
19
|
static Scale(sx: number, sy: number): Mat;
|
|
21
20
|
/** Compose: this × other */
|
|
22
21
|
compose(other: Mat): Mat;
|
|
@@ -27,6 +26,6 @@ export declare class Mat {
|
|
|
27
26
|
invert(): Mat;
|
|
28
27
|
toCssString(): string;
|
|
29
28
|
toSvgString(): string;
|
|
30
|
-
/** Create a transform for a shape: translate * rotate *
|
|
31
|
-
static ForShape(x: number, y: number, rotation: number, scaleX?: number, scaleY?: number
|
|
29
|
+
/** Create a transform for a shape: translate * rotate * scale. */
|
|
30
|
+
static ForShape(x: number, y: number, rotation: number, scaleX?: number, scaleY?: number): Mat;
|
|
32
31
|
}
|
|
@@ -8,7 +8,7 @@ export { getShapeGeometry, getShapeExportBounds, getShapeExportPageBounds, getSh
|
|
|
8
8
|
export type { ShapeGeometry, ShapeTransformDecompositionOptions, ShapeTransformFields, } from "./editor/queries/shapeTransforms";
|
|
9
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
10
|
export { SELECTION_RESIZE_ALL_MODES, SELECTION_RESIZE_ASPECT_RATIO_LOCKED_ONLY_MODES, SELECTION_RESIZE_CORNER_HANDLE_IDS, SELECTION_RESIZE_FREE_ONLY_MODES, SELECTION_RESIZE_HANDLE_IDS, flipSelectionLocalBounds, getSelectionLocalBoundsFromPagePoints, mapSelectionLocalBoundsBetweenBounds, mapSelectionLocalPointBetweenBounds, mirrorSelectionLocalPoint, rotateSelectionPagePoint, selectionLocalPointToPagePoint, selectionPagePointToLocalPoint, } from "./editor/selection";
|
|
11
|
-
export { getAnchoredSelectionResizeLocalBounds, getAspectRatioLockedSelectionResizeBounds, getCenteredSelectionResizeBounds, getConstrainedSelectionResizeBounds, getSelectionResizeBounds, getSelectionResizeScalesFromBounds, isSelectionResizeCorner, normalizeSelectionResizeBoundsFromEdges, selectionResizeHandleMovesBottomEdge, selectionResizeHandleMovesLeftEdge, selectionResizeHandleMovesRightEdge, selectionResizeHandleMovesTopEdge, } from "./editor/resizeGeometry";
|
|
11
|
+
export { getAnchoredSelectionResizeLocalBounds, getAspectRatioLockedSelectionResizeBounds, getCenteredSelectionResizeBounds, getConstrainedSelectionResizeBounds, getLocalDimensionsFromSelectionResize, getSelectionResizeBounds, getSelectionResizeDimensionsFromLocal, getSelectionResizeScalesFromBounds, isSelectionResizeCorner, normalizeSelectionResizeBoundsFromEdges, selectionResizeHandleMovesBottomEdge, selectionResizeHandleMovesLeftEdge, selectionResizeHandleMovesRightEdge, selectionResizeHandleMovesTopEdge, } from "./editor/resizeGeometry";
|
|
12
12
|
export { InteractionHandlerRegistry } from "./editor/interactions";
|
|
13
13
|
export { SelectionHandleInteractionRegistry } from "./editor/selectionHandleInteractions";
|
|
14
14
|
export { ShortcutManager, formatKeyboardShortcut, normalizeKeyboardShortcut, } from "./editor/managers/shortcutManager";
|
|
@@ -29,7 +29,9 @@ export type { ChangeSource, RecordUpdate, RecordsDiff, ScopedStoreRecord, StoreR
|
|
|
29
29
|
export { SnapshotParseError, parseDocumentSnapshot, parseSessionSnapshot, } from "./schema/snapshots";
|
|
30
30
|
export type { DocumentSnapshot, SessionSnapshot } from "./schema/snapshots";
|
|
31
31
|
export { ShapeUtil } from "./shapes/shapeUtil";
|
|
32
|
-
export
|
|
32
|
+
export { CHILD_TRANSFORM_POLICY_EPSILON, formatChildTransformPolicyViolation, getChildTransformPolicyViolation, } from "./shapes/childTransformPolicy";
|
|
33
|
+
export type { ChildTransformPolicy, ChildTransformPolicyProvider, ChildTransformPolicyViolation, } from "./shapes/childTransformPolicy";
|
|
34
|
+
export type { ShapeBoundsSnapGeometry, ShapeBrushSelectInput, ShapeBrushWrapInput, ShapeClipboardCopyInput, ShapeBindingPointInput, 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";
|
|
33
35
|
export type { HandleSnapContext, HandleSnapInput, HandleSnapMode, HandleSnapResult, HandleSnapSnapshot, HandleSnapSnapshotInput, ResizeSnapInput, ResizeSnapResult, ResizeSnapSnapshot, SnapAxis, SnapCoordinateSpace, SnapPointIndex, SnapPointIndexEntry, SnapPointKind, TranslateSnapInput, TranslateSnapResult, TranslateSnapSnapshot, } from "./editor/managers/snapTypes";
|
|
34
36
|
export { ShapeUtilRegistry } from "./shapes/shapeUtilRegistry";
|
|
35
37
|
export { resolveTerminalBindingAtPoint, } from "./bindings/terminalBinding";
|
|
@@ -2,12 +2,12 @@ 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, 3>;
|
|
6
6
|
export type SessionSnapshot = StoreSnapshot<SessionRecord, 1>;
|
|
7
7
|
export declare class SnapshotParseError extends Error {
|
|
8
8
|
constructor(message: string);
|
|
9
9
|
}
|
|
10
|
-
declare const CURRENT_DOCUMENT_SNAPSHOT_VERSION:
|
|
10
|
+
declare const CURRENT_DOCUMENT_SNAPSHOT_VERSION: 3;
|
|
11
11
|
declare const CURRENT_SESSION_SNAPSHOT_VERSION: 1;
|
|
12
12
|
export declare function getSnapshotEnvelope(snapshot: unknown, kind: "document"): {
|
|
13
13
|
schemaVersion: typeof CURRENT_DOCUMENT_SNAPSHOT_VERSION;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ShapeRecordBase } from "../schema/records";
|
|
2
|
+
export type ChildTransformPolicy = "isometry" | "similarity";
|
|
3
|
+
export declare const CHILD_TRANSFORM_POLICY_EPSILON = 1e-8;
|
|
4
|
+
export interface ChildTransformPolicyProvider<S extends ShapeRecordBase = ShapeRecordBase> {
|
|
5
|
+
canReceiveChildren(shape: S): boolean;
|
|
6
|
+
getChildTransformPolicy(shape: S): ChildTransformPolicy;
|
|
7
|
+
}
|
|
8
|
+
export interface ChildTransformPolicyViolation {
|
|
9
|
+
shapeId: ShapeRecordBase["id"];
|
|
10
|
+
shapeType: ShapeRecordBase["type"];
|
|
11
|
+
policy: ChildTransformPolicy;
|
|
12
|
+
scaleX: number;
|
|
13
|
+
scaleY: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function getChildTransformPolicyViolation<S extends ShapeRecordBase>(shape: S, provider: ChildTransformPolicyProvider<S>, epsilon?: number): ChildTransformPolicyViolation | null;
|
|
16
|
+
export declare function formatChildTransformPolicyViolation(violation: ChildTransformPolicyViolation): string;
|
|
@@ -7,6 +7,7 @@ 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
9
|
import { type ShapeTerminalBindingPort } from "../bindings/terminalPorts";
|
|
10
|
+
import type { ChildTransformPolicy } from "./childTransformPolicy";
|
|
10
11
|
export interface ShapeEditEndResult {
|
|
11
12
|
deleteShapeIds?: ShapeId[];
|
|
12
13
|
}
|
|
@@ -94,8 +95,6 @@ export interface ShapePointHitTestInput extends ShapeGeometryInput {
|
|
|
94
95
|
pagePoint: Vec;
|
|
95
96
|
positionedPoint: Vec;
|
|
96
97
|
}
|
|
97
|
-
export interface ShapeBindingTargetHitTestInput extends ShapePointHitTestInput {
|
|
98
|
-
}
|
|
99
98
|
export interface ShapeTerminalBindingOutline {
|
|
100
99
|
points: readonly Vec[];
|
|
101
100
|
closed: boolean;
|
|
@@ -226,6 +225,7 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
|
|
|
226
225
|
getLocalToPageTransform(shape: S): Mat;
|
|
227
226
|
canEdit(_shape: S): boolean;
|
|
228
227
|
canReceiveChildren(_shape: S): boolean;
|
|
228
|
+
getChildTransformPolicy(_shape: S): ChildTransformPolicy;
|
|
229
229
|
canReceiveChild(shape: S, _child: ShapeRecordBase): boolean;
|
|
230
230
|
isChildVisible(_shape: S, _child: ShapeRecordBase, _input: ShapeChildVisibilityInput): boolean;
|
|
231
231
|
getChildPlacementMeta(_shape: S, child: ShapeRecordBase, _input: ShapeChildPlacementInput): Record<string, unknown>;
|
|
@@ -238,7 +238,7 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
|
|
|
238
238
|
repairLoadedShape(_shape: S): S | null;
|
|
239
239
|
onEditEnd(_shape: S, _input: ShapeEditEndInput): ShapeEditEndResult | void;
|
|
240
240
|
hitTest(shape: S, positionedPoint: Vec, _input?: ShapePointHitTestInput): boolean;
|
|
241
|
-
hitTestBindingTarget(shape: S, positionedPoint: Vec, input?:
|
|
241
|
+
hitTestBindingTarget(shape: S, positionedPoint: Vec, input?: ShapePointHitTestInput): boolean;
|
|
242
242
|
hitTestLineSegment(shape: S, input: ShapeLineSegmentHitTestInput): boolean;
|
|
243
243
|
resolveBindingPoint(shape: S, input: ShapeBindingPointInput): Vec;
|
|
244
244
|
}
|
package/browser/persistence.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ProductPersistenceAdapter, ProductPersistenceLoadResult } from "../
|
|
1
|
+
import type { ProductPersistenceAdapter, ProductPersistenceLoadResult } from "../runtime/persistenceContracts";
|
|
2
2
|
import { CANVAS_KIT_IMAGE_BLOB_STORE, CANVAS_KIT_INDEXEDDB_NAME, CANVAS_KIT_INDEXEDDB_VERSION, CANVAS_KIT_SNAPSHOT_STORE } from "./indexedDb";
|
|
3
3
|
export declare const CANVAS_KIT_DOCUMENT_STORAGE_KEY = "canvas-kit.document";
|
|
4
4
|
export declare const CANVAS_KIT_SESSION_STORAGE_KEY = "canvas-kit.session";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const CANVAS_KIT_TOOL_IDS: readonly ["select", "hand", "rectangle", "ellipse", "rhombus", "triangle", "hexagon", "star", "arrow", "draw", "path", "text", "frame", "eraser", "laser"];
|
|
2
|
+
export type CanvasKitToolId = (typeof CANVAS_KIT_TOOL_IDS)[number];
|
|
3
|
+
export declare function assertCanvasKitToolId(toolId: string): asserts toolId is CanvasKitToolId;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ContextMenuContext, type ContextMenuContributionTarget, type ContextMenuTarget } from "../_vendor/canvas-product-contracts/index";
|
|
2
|
+
import type { Editor } from "../_vendor/canvas-core/index";
|
|
3
|
+
export declare function createContextMenuContext({ editor, menu, }: {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
menu: ContextMenuContext["menu"];
|
|
6
|
+
}): ContextMenuContext;
|
|
7
|
+
export declare function getContextMenuContributionTarget(target: ContextMenuTarget, editor: Editor): ContextMenuContributionTarget;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ToolbarGroup } from "../../_vendor/canvas-product-contracts/index";
|
|
2
2
|
export declare function getActiveToolLabel(groups: readonly ToolbarGroup[], activeToolId: string): string;
|
|
3
3
|
export declare function getSelectionToolbarTitle({ commonShapeType, count, isMixedFrameAndPointHandleSelection, singleShapeType, }: {
|
|
4
4
|
commonShapeType: string | null;
|
package/chrome/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ActiveContextMenu, type CanvasActionContext, type CanvasActionValue } from "../_vendor/canvas-product-contracts/index";
|
|
2
|
-
import type {
|
|
3
|
-
import type { CanvasProductLayerNode } from "../
|
|
2
|
+
import type { CanvasKitToolId } from "../canvasKitTools";
|
|
3
|
+
import type { CanvasProductController, CanvasProductLayerNode } from "../controller";
|
|
4
4
|
import type { EditorSelectionMetadata, ShapeId } from "../_vendor/canvas-core/index";
|
|
5
5
|
import type { HistoryControls } from "./useHistoryControls";
|
|
6
6
|
import type { PageControls } from "./usePageControls";
|
|
@@ -17,7 +17,6 @@ export type { ZoomControlsState } from "./useZoomControls";
|
|
|
17
17
|
export type { ContextMenuSurface } from "./useContextMenuSurface";
|
|
18
18
|
export type { ToolbarSurfaces, } from "./toolbar/useToolbarSurfaces";
|
|
19
19
|
export type { ChromeSurfaces } from "./useChromeSurfaces";
|
|
20
|
-
export type CanvasKitLayerNode = CanvasProductLayerNode;
|
|
21
20
|
export interface CanvasKitToolbarActionState {
|
|
22
21
|
value: CanvasActionValue | undefined;
|
|
23
22
|
isEnabled: boolean;
|
|
@@ -42,8 +41,8 @@ export interface CanvasKitLayerTreeSource {
|
|
|
42
41
|
getSnapshot(pageId?: string): readonly CanvasProductLayerNode[];
|
|
43
42
|
subscribe(onStoreChange: () => void): () => void;
|
|
44
43
|
}
|
|
45
|
-
export interface CanvasKitChromeContext<
|
|
46
|
-
controller:
|
|
44
|
+
export interface CanvasKitChromeContext<TToolId extends string = CanvasKitToolId> {
|
|
45
|
+
controller: CanvasProductController<TToolId>;
|
|
47
46
|
chromeSurfaces: ChromeSurfaces;
|
|
48
47
|
contextMenu: CanvasKitContextMenuState;
|
|
49
48
|
currentPageId: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type ActiveContextMenu, type CanvasActionContext, type CanvasActionRegistry, type CanvasChromeRegistry, type CanvasContextMenuRegistry, type CanvasToolbarRegistry } from "../_vendor/canvas-product-contracts/index";
|
|
2
2
|
import { type Editor } from "../_vendor/canvas-core/index";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { CanvasProductController } from "../controller";
|
|
4
|
+
import type { ExecuteCanvasKitAction } from "../runtime/canvasKitActionExecutor";
|
|
5
5
|
import type { CanvasKitChromeContext, CanvasKitGridControls } from "./types";
|
|
6
|
-
export declare function useCanvasKitChromeContext<
|
|
7
|
-
controller:
|
|
6
|
+
export declare function useCanvasKitChromeContext<TToolId extends string>({ controller, activeContextMenu, grid, onActiveContextMenuChange, actionRegistry, canShowPropertiesDuringEditing, chromeRegistry, contextMenuRegistry, editor, executeAction, toolbarRegistry, }: {
|
|
7
|
+
controller: CanvasProductController<TToolId>;
|
|
8
8
|
activeContextMenu: ActiveContextMenu | null;
|
|
9
9
|
grid: CanvasKitGridControls;
|
|
10
10
|
onActiveContextMenuChange: (activeContextMenu: ActiveContextMenu | null) => void;
|
|
@@ -13,6 +13,6 @@ export declare function useCanvasKitChromeContext<TController extends CanvasKitB
|
|
|
13
13
|
chromeRegistry: CanvasChromeRegistry;
|
|
14
14
|
contextMenuRegistry: CanvasContextMenuRegistry;
|
|
15
15
|
editor: Editor;
|
|
16
|
-
|
|
16
|
+
executeAction: ExecuteCanvasKitAction;
|
|
17
17
|
toolbarRegistry: CanvasToolbarRegistry;
|
|
18
|
-
}): CanvasKitChromeContext<
|
|
18
|
+
}): CanvasKitChromeContext<TToolId>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CanvasProductLayerNode } from "../controller";
|
|
2
|
+
import type { CanvasKitLayerTreeSource } from "./types";
|
|
2
3
|
export declare function useCanvasKitLayerTree(source: CanvasKitLayerTreeSource, options?: {
|
|
3
4
|
enabled?: boolean;
|
|
4
5
|
pageId?: string;
|
|
5
|
-
}): readonly
|
|
6
|
+
}): readonly CanvasProductLayerNode[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
|
-
import type {
|
|
2
|
+
import type { CanvasProductController } from "../controller";
|
|
3
3
|
export interface HistoryControls {
|
|
4
4
|
canUndo: boolean;
|
|
5
5
|
canRedo: boolean;
|
|
6
6
|
undo(): void;
|
|
7
7
|
redo(): void;
|
|
8
8
|
}
|
|
9
|
-
export declare function useHistoryControls({
|
|
9
|
+
export declare function useHistoryControls({ controller, editor, }: {
|
|
10
|
+
controller: CanvasProductController;
|
|
10
11
|
editor: Editor;
|
|
11
|
-
executeCommand: ExecuteCanvasKitCommand;
|
|
12
12
|
}): HistoryControls;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { Editor
|
|
2
|
-
import type {
|
|
1
|
+
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
|
+
import type { CanvasProductController, CanvasProductPageRef } from "../controller";
|
|
3
3
|
export interface PageControls {
|
|
4
|
-
pages: readonly
|
|
5
|
-
currentPage:
|
|
6
|
-
currentPageId:
|
|
4
|
+
pages: readonly CanvasProductPageRef[];
|
|
5
|
+
currentPage: CanvasProductPageRef | null;
|
|
6
|
+
currentPageId: string;
|
|
7
7
|
canDeleteCurrentPage: boolean;
|
|
8
8
|
createPage(): void;
|
|
9
9
|
deleteCurrentPage(): void;
|
|
10
10
|
renameCurrentPage(nextName: string): void;
|
|
11
|
-
selectPage(pageId:
|
|
11
|
+
selectPage(pageId: string): void;
|
|
12
12
|
}
|
|
13
|
-
export declare function usePageControls({
|
|
13
|
+
export declare function usePageControls({ controller, editor, }: {
|
|
14
|
+
controller: CanvasProductController;
|
|
14
15
|
editor: Editor;
|
|
15
|
-
executeCommand: ExecuteCanvasKitCommand;
|
|
16
16
|
}): PageControls;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
|
+
import type { CanvasProductController } from "../controller";
|
|
2
3
|
export interface ZoomControlsState {
|
|
3
4
|
zoom: number;
|
|
4
5
|
label: string;
|
|
@@ -6,4 +7,7 @@ export interface ZoomControlsState {
|
|
|
6
7
|
zoomOut(): void;
|
|
7
8
|
resetZoom(): void;
|
|
8
9
|
}
|
|
9
|
-
export declare function useZoomControls(editor
|
|
10
|
+
export declare function useZoomControls({ controller, editor, }: {
|
|
11
|
+
controller: CanvasProductController;
|
|
12
|
+
editor: Editor;
|
|
13
|
+
}): ZoomControlsState;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Editor } from "../_vendor/canvas-core/index";
|
|
2
|
+
export interface CanvasKitCommandToken<TId extends string = string> {
|
|
3
|
+
readonly id: TId;
|
|
4
|
+
}
|
|
5
|
+
export interface CanvasKitCommand<TArgs extends readonly unknown[], TResult, TId extends string = string> {
|
|
6
|
+
readonly id: TId;
|
|
7
|
+
readonly token: CanvasKitCommandToken<TId>;
|
|
8
|
+
run(editor: Editor, ...args: TArgs): TResult;
|
|
9
|
+
}
|
|
10
|
+
export type ExecuteCanvasKitDefinedCommand = <TArgs extends readonly unknown[], TResult>(command: CanvasKitCommand<TArgs, TResult>, ...args: TArgs) => TResult;
|
|
11
|
+
export declare function defineCanvasKitCommand<const TId extends string, TArgs extends readonly unknown[], TResult>(command: Omit<CanvasKitCommand<TArgs, TResult, TId>, "id">): CanvasKitCommand<TArgs, TResult, TId>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { CanvasKitCommandToken } from "./command";
|
|
2
|
+
export declare const CANVAS_KIT_COMMAND_TOKENS: Readonly<{
|
|
3
|
+
document: Readonly<{
|
|
4
|
+
updateMeta: CanvasKitCommandToken<"document.update-meta">;
|
|
5
|
+
}>;
|
|
6
|
+
session: Readonly<{
|
|
7
|
+
updateMeta: CanvasKitCommandToken<"session.update-meta">;
|
|
8
|
+
}>;
|
|
9
|
+
history: Readonly<{
|
|
10
|
+
clear: CanvasKitCommandToken<"history.clear">;
|
|
11
|
+
undo: CanvasKitCommandToken<"history.undo">;
|
|
12
|
+
redo: CanvasKitCommandToken<"history.redo">;
|
|
13
|
+
}>;
|
|
14
|
+
selection: Readonly<{
|
|
15
|
+
select: CanvasKitCommandToken<"selection.select">;
|
|
16
|
+
selectAll: CanvasKitCommandToken<"system.selection.select-all">;
|
|
17
|
+
delete: CanvasKitCommandToken<"system.selection.delete">;
|
|
18
|
+
duplicate: CanvasKitCommandToken<"system.selection.duplicate">;
|
|
19
|
+
resetRotation: CanvasKitCommandToken<"system.selection.reset-rotation">;
|
|
20
|
+
flipHorizontal: CanvasKitCommandToken<"system.selection.flip-horizontal">;
|
|
21
|
+
flipVertical: CanvasKitCommandToken<"system.selection.flip-vertical">;
|
|
22
|
+
setOpacity: CanvasKitCommandToken<"system.selection.set-opacity">;
|
|
23
|
+
align: CanvasKitCommandToken<"system.selection.align">;
|
|
24
|
+
distribute: CanvasKitCommandToken<"system.selection.distribute">;
|
|
25
|
+
}>;
|
|
26
|
+
shape: Readonly<{
|
|
27
|
+
delete: CanvasKitCommandToken<"shape.delete">;
|
|
28
|
+
update: CanvasKitCommandToken<"shape.update">;
|
|
29
|
+
updateMeta: CanvasKitCommandToken<"shape.update-meta">;
|
|
30
|
+
}>;
|
|
31
|
+
layer: Readonly<{
|
|
32
|
+
setHidden: CanvasKitCommandToken<"layer.set-hidden">;
|
|
33
|
+
setLocked: CanvasKitCommandToken<"layer.set-locked">;
|
|
34
|
+
group: CanvasKitCommandToken<"layer.group">;
|
|
35
|
+
ungroup: CanvasKitCommandToken<"layer.ungroup">;
|
|
36
|
+
sendBackward: CanvasKitCommandToken<"layer.send-backward">;
|
|
37
|
+
bringForward: CanvasKitCommandToken<"layer.bring-forward">;
|
|
38
|
+
sendToBack: CanvasKitCommandToken<"layer.send-to-back">;
|
|
39
|
+
bringToFront: CanvasKitCommandToken<"layer.bring-to-front">;
|
|
40
|
+
moveToPlacement: CanvasKitCommandToken<"layer.move-to-placement">;
|
|
41
|
+
}>;
|
|
42
|
+
tool: Readonly<{
|
|
43
|
+
setActive: CanvasKitCommandToken<"editor.tool.set-active-tool">;
|
|
44
|
+
toggleLocked: CanvasKitCommandToken<"editor.tool.toggle-locked">;
|
|
45
|
+
}>;
|
|
46
|
+
view: Readonly<{
|
|
47
|
+
centerOnShape: CanvasKitCommandToken<"view.center-on-shape">;
|
|
48
|
+
setCamera: CanvasKitCommandToken<"view.set-camera">;
|
|
49
|
+
zoomIn: CanvasKitCommandToken<"system.view.zoom-in">;
|
|
50
|
+
zoomOut: CanvasKitCommandToken<"system.view.zoom-out">;
|
|
51
|
+
resetZoom: CanvasKitCommandToken<"system.view.reset-zoom">;
|
|
52
|
+
reset: CanvasKitCommandToken<"view.reset">;
|
|
53
|
+
}>;
|
|
54
|
+
page: Readonly<{
|
|
55
|
+
create: CanvasKitCommandToken<"page.create">;
|
|
56
|
+
rename: CanvasKitCommandToken<"page.rename">;
|
|
57
|
+
updateMeta: CanvasKitCommandToken<"page.update-meta">;
|
|
58
|
+
delete: CanvasKitCommandToken<"page.delete">;
|
|
59
|
+
select: CanvasKitCommandToken<"page.select">;
|
|
60
|
+
}>;
|
|
61
|
+
}>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const updateDocumentMetaCommand: import("./command").CanvasKitCommand<[patch: Record<string, unknown>], void, "document.update-meta">;
|
|
2
|
+
export declare const updateSessionMetaCommand: import("./command").CanvasKitCommand<[patch: Record<string, unknown>], void, "session.update-meta">;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const clearHistoryCommand: import("./command").CanvasKitCommand<[], void, "history.clear">;
|
|
2
|
+
export declare const undoCommand: import("./command").CanvasKitCommand<[], boolean, "history.undo">;
|
|
3
|
+
export declare const redoCommand: import("./command").CanvasKitCommand<[], boolean, "history.redo">;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { CanvasKitCommand, CanvasKitCommandToken, ExecuteCanvasKitDefinedCommand, } from "./command";
|
|
2
|
+
export { CANVAS_KIT_COMMAND_TOKENS } from "./commandTokens";
|
|
3
|
+
export { updateDocumentMetaCommand, updateSessionMetaCommand, } from "./documentCommands";
|
|
4
|
+
export { clearHistoryCommand, redoCommand, undoCommand, } from "./historyCommands";
|
|
5
|
+
export { bringShapesForwardCommand, bringShapesToFrontCommand, groupShapesCommand, moveShapesToLayerPlacementCommand, sendShapesBackwardCommand, sendShapesToBackCommand, setShapesHiddenCommand, setShapesLockedCommand, ungroupShapesCommand, } from "./layerCommands";
|
|
6
|
+
export { createPageCommand, deletePageCommand, renamePageCommand, selectPageCommand, updatePageMetaCommand, } from "./pageCommands";
|
|
7
|
+
export { alignSelectionCommand, deleteSelectionCommand, distributeSelectionCommand, duplicateSelectionCommand, flipSelectionHorizontalCommand, flipSelectionVerticalCommand, resetSelectionRotationCommand, selectAllCommand, selectShapesCommand, setSelectionOpacityCommand, } from "./selectionCommands";
|
|
8
|
+
export type { CanvasSelectionAlignMode, CanvasSelectionDistributeAxis, } from "./selectionCommands";
|
|
9
|
+
export { deleteShapesCommand, updateShapeMetaCommand, updateShapesCommand, } from "./shapeCommands";
|
|
10
|
+
export { setActiveToolCommand, toggleToolLockedCommand, } from "./toolCommands";
|
|
11
|
+
export { centerOnShapeCommand, resetViewCommand, resetZoomCommand, setCameraCommand, zoomInCommand, zoomOutCommand, } from "./viewCommands";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ShapeId } from "../_vendor/canvas-core/index";
|
|
2
|
+
import type { CanvasProductLayerPlacement, CanvasProductLayerPlacementResult } from "../contracts/canvasProductControllerContracts";
|
|
3
|
+
export declare const setShapesHiddenCommand: import("./command").CanvasKitCommand<[input: {
|
|
4
|
+
ids: ShapeId[];
|
|
5
|
+
isHidden: boolean;
|
|
6
|
+
}], `shape:${string}`[], "layer.set-hidden">;
|
|
7
|
+
export declare const setShapesLockedCommand: import("./command").CanvasKitCommand<[input: {
|
|
8
|
+
ids: ShapeId[];
|
|
9
|
+
isLocked: boolean;
|
|
10
|
+
}], `shape:${string}`[], "layer.set-locked">;
|
|
11
|
+
export declare const groupShapesCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], `shape:${string}` | null, "layer.group">;
|
|
12
|
+
export declare const ungroupShapesCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], `shape:${string}`[], "layer.ungroup">;
|
|
13
|
+
export declare const sendShapesBackwardCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], boolean, "layer.send-backward">;
|
|
14
|
+
export declare const bringShapesForwardCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], boolean, "layer.bring-forward">;
|
|
15
|
+
export declare const sendShapesToBackCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], boolean, "layer.send-to-back">;
|
|
16
|
+
export declare const bringShapesToFrontCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], boolean, "layer.bring-to-front">;
|
|
17
|
+
export declare const moveShapesToLayerPlacementCommand: import("./command").CanvasKitCommand<[input: {
|
|
18
|
+
ids: ShapeId[];
|
|
19
|
+
placement: CanvasProductLayerPlacement;
|
|
20
|
+
}], CanvasProductLayerPlacementResult, "layer.move-to-placement">;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CanvasProductCreatePageInput } from "../contracts/canvasProductControllerContracts";
|
|
2
|
+
export declare const createPageCommand: import("./command").CanvasKitCommand<[input?: CanvasProductCreatePageInput | undefined], import("../_vendor/canvas-core/index").PageRecord, "page.create">;
|
|
3
|
+
export declare const renamePageCommand: import("./command").CanvasKitCommand<[input: {
|
|
4
|
+
pageId: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}], void, "page.rename">;
|
|
7
|
+
export declare const updatePageMetaCommand: import("./command").CanvasKitCommand<[input: {
|
|
8
|
+
pageId: string;
|
|
9
|
+
patch: Record<string, unknown>;
|
|
10
|
+
}], `page:${string}` | null, "page.update-meta">;
|
|
11
|
+
export declare const deletePageCommand: import("./command").CanvasKitCommand<[pageId: string], boolean, "page.delete">;
|
|
12
|
+
export declare const selectPageCommand: import("./command").CanvasKitCommand<[pageId: string], void, "page.select">;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type CanvasSelectionAlignMode = "left" | "horizontal-center" | "right" | "top" | "vertical-center" | "bottom";
|
|
2
|
+
export type CanvasSelectionDistributeAxis = "horizontal" | "vertical";
|
|
3
|
+
export declare const selectShapesCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], void, "selection.select">;
|
|
4
|
+
export declare const selectAllCommand: import("./command").CanvasKitCommand<[], void, "system.selection.select-all">;
|
|
5
|
+
export declare const deleteSelectionCommand: import("./command").CanvasKitCommand<[], void, "system.selection.delete">;
|
|
6
|
+
export declare const duplicateSelectionCommand: import("./command").CanvasKitCommand<[], `shape:${string}`[], "system.selection.duplicate">;
|
|
7
|
+
export declare const resetSelectionRotationCommand: import("./command").CanvasKitCommand<[], void, "system.selection.reset-rotation">;
|
|
8
|
+
export declare const flipSelectionHorizontalCommand: import("./command").CanvasKitCommand<[], void, "system.selection.flip-horizontal">;
|
|
9
|
+
export declare const flipSelectionVerticalCommand: import("./command").CanvasKitCommand<[], void, "system.selection.flip-vertical">;
|
|
10
|
+
export declare const setSelectionOpacityCommand: import("./command").CanvasKitCommand<[opacity: number], void, "system.selection.set-opacity">;
|
|
11
|
+
export declare const alignSelectionCommand: import("./command").CanvasKitCommand<[mode: CanvasSelectionAlignMode], boolean, "system.selection.align">;
|
|
12
|
+
export declare const distributeSelectionCommand: import("./command").CanvasKitCommand<[axis: CanvasSelectionDistributeAxis], boolean, "system.selection.distribute">;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ShapeId } from "../_vendor/canvas-core/index";
|
|
2
|
+
import type { CanvasProductShapeUpdate } from "../contracts/canvasProductControllerContracts";
|
|
3
|
+
export declare const deleteShapesCommand: import("./command").CanvasKitCommand<[ids: `shape:${string}`[]], void, "shape.delete">;
|
|
4
|
+
export declare const updateShapesCommand: import("./command").CanvasKitCommand<[updates: CanvasProductShapeUpdate[]], `shape:${string}`[], "shape.update">;
|
|
5
|
+
export declare const updateShapeMetaCommand: import("./command").CanvasKitCommand<[input: {
|
|
6
|
+
id: ShapeId;
|
|
7
|
+
patch: Record<string, unknown>;
|
|
8
|
+
}], `shape:${string}` | null, "shape.update-meta">;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Camera } from "../_vendor/canvas-core/index";
|
|
2
|
+
export declare const centerOnShapeCommand: import("./command").CanvasKitCommand<[id: `shape:${string}`], boolean, "view.center-on-shape">;
|
|
3
|
+
export declare const setCameraCommand: import("./command").CanvasKitCommand<[input: {
|
|
4
|
+
camera: Partial<Camera>;
|
|
5
|
+
pageId?: string;
|
|
6
|
+
}], void, "view.set-camera">;
|
|
7
|
+
export declare const zoomInCommand: import("./command").CanvasKitCommand<[], void, "system.view.zoom-in">;
|
|
8
|
+
export declare const zoomOutCommand: import("./command").CanvasKitCommand<[], void, "system.view.zoom-out">;
|
|
9
|
+
export declare const resetZoomCommand: import("./command").CanvasKitCommand<[], void, "system.view.reset-zoom">;
|
|
10
|
+
export declare const resetViewCommand: import("./command").CanvasKitCommand<[], void, "view.reset">;
|