@yuzhouu/canvas-kit 0.1.5 → 0.1.7
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/_vendor/canvas-core/editor/commands.d.ts +1 -0
- package/_vendor/canvas-core/editor/editor.d.ts +8 -1
- package/_vendor/canvas-core/editor/managers/interactionTransientManager.d.ts +7 -1
- package/_vendor/canvas-core/editor/managers/shapeHierarchyManager.d.ts +3 -0
- package/_vendor/canvas-core/editor/managers/spatialIndexManager.d.ts +1 -0
- package/_vendor/canvas-core/editor/selection.d.ts +4 -0
- package/_vendor/canvas-core/editor/selectionBindingSegments.d.ts +7 -0
- package/_vendor/canvas-core/editor/selectionOverlay.d.ts +0 -1
- package/_vendor/canvas-core/index.d.ts +2 -2
- package/_vendor/canvas-core/reactivity.d.ts +3 -1
- package/_vendor/canvas-core/shapes/shapeUtil.d.ts +8 -3
- package/_vendor/canvas-react/components/ShapeLayer.d.ts +1 -4
- package/_vendor/canvas-react/components/overlays/BindingGuide.d.ts +1 -1
- package/_vendor/canvas-react/components/overlays/SelectionPathOverlay.d.ts +7 -0
- package/_vendor/canvas-react/components/overlays/TerminalBindingGuidesOverlay.d.ts +1 -0
- package/_vendor/canvas-react/components/useCanvasDomEvents.d.ts +1 -2
- package/_vendor/plugin-arrow/arrowBindingTargets.d.ts +3 -0
- package/_vendor/plugin-arrow/arrowBindingUtil.d.ts +1 -1
- package/_vendor/plugin-arrow/arrowShapeUtil.d.ts +4 -3
- package/_vendor/plugin-arrow/arrowTerminalCommands.d.ts +1 -0
- package/_vendor/plugin-draw/drawShapeUtil.d.ts +1 -0
- package/_vendor/plugin-frame/frameShapeUtil.d.ts +2 -0
- package/_vendor/plugin-geo/geoShapeUtil.d.ts +1 -0
- package/_vendor/plugin-group/groupShapeUtil.d.ts +2 -1
- package/_vendor/plugin-image/cornerRadius.d.ts +6 -0
- package/_vendor/plugin-image/editor.d.ts +1 -0
- package/_vendor/plugin-image/imageShapeUtil.d.ts +1 -0
- package/_vendor/plugin-image/index.d.ts +1 -1
- package/_vendor/plugin-image/types.d.ts +1 -0
- package/_vendor/plugin-text/textShapeUtil.d.ts +1 -0
- package/builtins/controller/shapeCreationController.d.ts +3 -0
- package/builtins/extensions.d.ts +2 -1
- package/chrome/bindings/useCanvasKitLayerTree.d.ts +5 -0
- package/chrome/types.d.ts +5 -1
- package/chrome/useCanvasKitChromeContext.d.ts +1 -1
- package/controller/canvasKitController.d.ts +1 -1
- package/core/controller/canvasProductController.d.ts +46 -1
- package/core/controller/index.d.ts +1 -1
- package/core/index.d.ts +1 -0
- package/index.d.ts +4 -1
- package/index.mjs +76 -66
- package/package.json +1 -1
|
@@ -41,7 +41,7 @@ import type { DuplicateSelectionInput, EditorClipboardPayload, PasteClipboardPay
|
|
|
41
41
|
import { InteractionHandlerRegistry } from "./interactions";
|
|
42
42
|
import { SelectionHandleInteractionRegistry } from "./selectionHandleInteractions";
|
|
43
43
|
import { type SelectedShapeOverlayItem } from "./selectionOverlay";
|
|
44
|
-
import type { BindingPreviewState, SnapIndicatorState, SelectionBindingSegment, SelectionHandle, SelectionFrame, SelectionOverlayFrameState, SelectionOverlayFrameGeometryState, SelectionOverlayFrameStyleState, SelectionOverlayHandleAnchorsState, SelectionOverlayHandleCountsState, SelectionOverlayHandlesState, SelectionOverlayState } from "./selection";
|
|
44
|
+
import type { BindingPreviewState, SnapIndicatorState, SelectionBindingSegment, TerminalBindingGuideState, SelectionHandle, SelectionFrame, SelectionOverlayFrameState, SelectionOverlayFrameGeometryState, SelectionOverlayFrameStyleState, SelectionOverlayHandleAnchorsState, SelectionOverlayHandleCountsState, SelectionOverlayHandlesState, SelectionOverlayState } from "./selection";
|
|
45
45
|
export interface EditorOptions {
|
|
46
46
|
shapeUtils?: ShapeUtil[];
|
|
47
47
|
shapeSvgExporters?: ShapeSvgExporter[];
|
|
@@ -213,7 +213,9 @@ export declare class Editor {
|
|
|
213
213
|
readonly laserTrailActiveSignal: Signal<boolean>;
|
|
214
214
|
readonly bindingPreviewSignal: Signal<BindingPreviewState | null>;
|
|
215
215
|
readonly bindingPreviewActiveSignal: Signal<boolean>;
|
|
216
|
+
readonly terminalBindingGuidesSignal: Signal<TerminalBindingGuideState[]>;
|
|
216
217
|
readonly dropTargetShapeIdSignal: Signal<ShapeId | null>;
|
|
218
|
+
readonly hoveredShapeIdSignal: Signal<ShapeId | null>;
|
|
217
219
|
readonly selectionTranslationActiveSignal: Signal<boolean>;
|
|
218
220
|
readonly snapIndicatorsSignal: Signal<SnapIndicatorState[]>;
|
|
219
221
|
readonly snapIndicatorsActiveSignal: Signal<boolean>;
|
|
@@ -249,6 +251,7 @@ export declare class Editor {
|
|
|
249
251
|
readonly shapeEditingStateSignal: import("../../signals/index").Computed<EditorShapeEditingState>;
|
|
250
252
|
readonly currentCameraSignal: import("../../signals/index").Computed<Camera>;
|
|
251
253
|
readonly selectedShapeIdsSignal: import("../../signals/index").Computed<`shape:${string}`[]>;
|
|
254
|
+
readonly selectionCountSignal: import("../../signals/index").Computed<number>;
|
|
252
255
|
readonly selectedShapeIdSetSignal: import("../../signals/index").Computed<Set<`shape:${string}`>>;
|
|
253
256
|
readonly selectedShapesSignal: import("../../signals/index").Computed<ShapeRecord[]>;
|
|
254
257
|
readonly selectedShapeOverlayItemsSignal: import("../../signals/index").Computed<SelectedShapeOverlayItem[]>;
|
|
@@ -272,6 +275,7 @@ export declare class Editor {
|
|
|
272
275
|
private readonly shapeDocumentVisibleSignals;
|
|
273
276
|
private readonly shapeEditingSessionSignals;
|
|
274
277
|
private readonly shapeDropTargetSignals;
|
|
278
|
+
private readonly shapeHoveredSignals;
|
|
275
279
|
private readonly shapeErasingSignals;
|
|
276
280
|
private readonly shapeSelectedDescendantTransformAncestorSignals;
|
|
277
281
|
private lastPointerDownForClickCount;
|
|
@@ -390,6 +394,7 @@ export declare class Editor {
|
|
|
390
394
|
getShapeDocumentVisibleSignal(id: ShapeId): Signal<boolean>;
|
|
391
395
|
getShapeEditingSessionForShapeSignal(id: ShapeId): Signal<ShapeEditingSession | null>;
|
|
392
396
|
getShapeDropTargetSignal(id: ShapeId): Signal<boolean>;
|
|
397
|
+
getShapeHoveredSignal(id: ShapeId): Signal<boolean>;
|
|
393
398
|
getShapeErasingSignal(id: ShapeId): Signal<boolean>;
|
|
394
399
|
getShapeSelectedDescendantTransformAncestorSignal(id: ShapeId): Signal<boolean>;
|
|
395
400
|
getBinding(id: BindingId): BindingRecord | undefined;
|
|
@@ -464,7 +469,9 @@ export declare class Editor {
|
|
|
464
469
|
finishLaserTrail(sessionId: number): void;
|
|
465
470
|
clearLaserTrail(sessionId: number): void;
|
|
466
471
|
setBindingPreview(preview: BindingPreviewState | null): void;
|
|
472
|
+
setTerminalBindingGuides(guides: readonly TerminalBindingGuideState[] | null): void;
|
|
467
473
|
setDropTargetShapeId(shapeId: ShapeId | null): void;
|
|
474
|
+
setHoveredShapeId(shapeId: ShapeId | null): void;
|
|
468
475
|
setSelectionTranslationActive(active: boolean): void;
|
|
469
476
|
setSnapIndicators(indicators: SnapIndicatorState[] | null): void;
|
|
470
477
|
setTerminalBindingResolver(resolver: TerminalBindingResolver): void;
|
|
@@ -4,7 +4,7 @@ import type { Box } from "../../geometry/box";
|
|
|
4
4
|
import type { Vec } from "../../geometry/vec";
|
|
5
5
|
import type { ShapeId } from "../../schema/records";
|
|
6
6
|
import type { Editor } from "../editor";
|
|
7
|
-
import type { BindingPreviewState, SnapIndicatorState } from "../selection";
|
|
7
|
+
import type { BindingPreviewState, SnapIndicatorState, TerminalBindingGuideState } from "../selection";
|
|
8
8
|
export interface LaserTrailState {
|
|
9
9
|
sessionId: number;
|
|
10
10
|
phase: "active" | "ending";
|
|
@@ -28,8 +28,12 @@ export declare class InteractionTransientManager {
|
|
|
28
28
|
private readonly _bindingPreviewSignal;
|
|
29
29
|
readonly bindingPreviewSignal: Signal<BindingPreviewState | null>;
|
|
30
30
|
readonly bindingPreviewActiveSignal: import("../../../signals/index").Computed<boolean>;
|
|
31
|
+
private readonly _terminalBindingGuidesSignal;
|
|
32
|
+
readonly terminalBindingGuidesSignal: Signal<TerminalBindingGuideState[]>;
|
|
31
33
|
private readonly _dropTargetShapeIdSignal;
|
|
32
34
|
readonly dropTargetShapeIdSignal: Signal<ShapeId | null>;
|
|
35
|
+
private readonly _hoveredShapeIdSignal;
|
|
36
|
+
readonly hoveredShapeIdSignal: Signal<ShapeId | null>;
|
|
33
37
|
private readonly _selectionTranslationActiveSignal;
|
|
34
38
|
readonly selectionTranslationActiveSignal: Signal<boolean>;
|
|
35
39
|
private terminalBindingResolver;
|
|
@@ -46,7 +50,9 @@ export declare class InteractionTransientManager {
|
|
|
46
50
|
finishLaserTrail(sessionId: number): void;
|
|
47
51
|
clearLaserTrail(sessionId: number): void;
|
|
48
52
|
setBindingPreview(preview: BindingPreviewState | null): void;
|
|
53
|
+
setTerminalBindingGuides(guides: readonly TerminalBindingGuideState[] | null): void;
|
|
49
54
|
setDropTargetShapeId(shapeId: ShapeId | null): void;
|
|
55
|
+
setHoveredShapeId(shapeId: ShapeId | null): void;
|
|
50
56
|
setSelectionTranslationActive(active: boolean): void;
|
|
51
57
|
setSnapIndicators(indicators: SnapIndicatorState[] | null): void;
|
|
52
58
|
setTerminalBindingResolver(resolver: TerminalBindingResolver): void;
|
|
@@ -27,6 +27,9 @@ export declare class ShapeHierarchyManager {
|
|
|
27
27
|
canUngroupShapes(ids: readonly ShapeId[]): boolean;
|
|
28
28
|
ungroupShapes(ids: readonly ShapeId[], source?: ChangeSource): ShapeId[];
|
|
29
29
|
ungroupSelection(source?: ChangeSource): ShapeId[];
|
|
30
|
+
private getOutermostUngroupableShapeIds;
|
|
31
|
+
private isShapeDescendantOfAny;
|
|
32
|
+
private removeUngroupedContainerShapes;
|
|
30
33
|
getSelectionSiblingOrderState(): ShapeSiblingOrderState | null;
|
|
31
34
|
canMoveSelectionWithinParent(direction: ShapeSiblingOrderDirection): boolean;
|
|
32
35
|
canMoveSelectionInParentOrder(direction: ShapeSiblingOrderDirection): boolean;
|
|
@@ -8,6 +8,7 @@ export interface SpatialQueryOptions {
|
|
|
8
8
|
}
|
|
9
9
|
export interface ShapeAtPointOptions extends SpatialQueryOptions {
|
|
10
10
|
filter?: (shape: ShapeRecord) => boolean;
|
|
11
|
+
hitTest?: "point" | "bindingTarget";
|
|
11
12
|
}
|
|
12
13
|
export interface ShapeLineSegmentHitTestOptions extends SpatialQueryOptions {
|
|
13
14
|
margin?: number;
|
|
@@ -118,6 +118,10 @@ export interface SelectionBindingSegment {
|
|
|
118
118
|
boundaryPagePoint: Vec;
|
|
119
119
|
guidePath?: string | null;
|
|
120
120
|
}
|
|
121
|
+
export interface TerminalBindingGuideState extends SelectionBindingSegment {
|
|
122
|
+
ownerShapeId: ShapeId;
|
|
123
|
+
targetShapeId?: ShapeId | null;
|
|
124
|
+
}
|
|
121
125
|
export interface PointSnapIndicatorState {
|
|
122
126
|
id: string;
|
|
123
127
|
type: "points";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SelectionBindingSegment, TerminalBindingGuideState } from "./selection";
|
|
2
|
+
export declare function cloneSelectionBindingSegment<T extends SelectionBindingSegment>(segment: T): T;
|
|
3
|
+
export declare function cloneSelectionBindingSegments<T extends SelectionBindingSegment>(segments: readonly T[]): T[];
|
|
4
|
+
export declare function areSelectionBindingSegmentsEqual(a: SelectionBindingSegment, b: SelectionBindingSegment): boolean;
|
|
5
|
+
export declare function areSelectionBindingSegmentArraysEqual(a: readonly SelectionBindingSegment[], b: readonly SelectionBindingSegment[]): boolean;
|
|
6
|
+
export declare function areTerminalBindingGuideStatesEqual(a: TerminalBindingGuideState, b: TerminalBindingGuideState): boolean;
|
|
7
|
+
export declare function areTerminalBindingGuideStateArraysEqual(a: readonly TerminalBindingGuideState[], b: readonly TerminalBindingGuideState[]): boolean;
|
|
@@ -18,7 +18,6 @@ export interface SelectionHandleState {
|
|
|
18
18
|
middleHandles: SelectionBindingMiddleHandle[];
|
|
19
19
|
customHandles: SelectionCustomHandle[];
|
|
20
20
|
}
|
|
21
|
-
export declare function areSelectionBindingSegmentArraysEqual(a: readonly SelectionBindingSegment[], b: readonly SelectionBindingSegment[]): boolean;
|
|
22
21
|
export declare function areSelectedShapeOverlayItemsEqual(a: SelectedShapeOverlayItem[], b: SelectedShapeOverlayItem[]): boolean;
|
|
23
22
|
export declare function areSelectionOverlayFrameStatesEqual(a: SelectionOverlayFrameState | null, b: SelectionOverlayFrameState | null): boolean;
|
|
24
23
|
export declare function areSelectionOverlayFrameGeometryStatesEqual(a: SelectionOverlayFrameGeometryState | null, b: SelectionOverlayFrameGeometryState | null): boolean;
|
|
@@ -3,7 +3,7 @@ export { createEditorWithPlugins, type CreateEditorWithPluginsOptions, } from ".
|
|
|
3
3
|
export { distanceBetweenSegments, distanceToSegment, nearestPointOnSegment, segmentsIntersect, } from "./geometry";
|
|
4
4
|
export { getShapeGeometry, getShapeExportBounds, getShapeExportPageBounds, getShapeExportToPageTransform, getShapeLocalBounds, getShapeLocalToPageTransform, getShapePositionedOutlineVertices, getShapePositionedToPageTransform, getShapePageBounds, getShapePageCenter, getShapePageCorners, getShapePageOutlineVertices, pagePointToShapePositionedPoint, positionedShapePointToPagePoint, getShapeRenderBounds, getShapeRenderToPageTransform, } from "./editor/queries/shapeTransforms";
|
|
5
5
|
export type { ShapeGeometry } from "./editor/queries/shapeTransforms";
|
|
6
|
-
export type { BindingPreviewState, GapSnapIndicatorGapState, GapSnapIndicatorState, PointSnapIndicatorState, SnapIndicatorState, SelectionBindingSegment, SelectionBindingMiddleHandle, SelectionBindingMiddleHandleAnchor, SelectionBindingTerminalHandle, SelectionBindingTerminalHandleAnchor, SelectionCustomHandle, SelectionCustomHandleAnchor, SelectionHandle, SelectionOverlayFrameState, SelectionOverlayFrameGeometryState, SelectionOverlayFrameStyleState, SelectionOverlayHandleAnchorsState, SelectionOverlayHandleCountsState, SelectionOverlayHandlesState, SelectionOverlayState, SelectionResizeHandle, SelectionResizeHandleAnchor, SelectionResizeHandleId, SelectionRotateHandle, SelectionRotateHandleAnchor, SelectionRotateHandleId, SelectionMirrorAxis, } from "./editor/selection";
|
|
6
|
+
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, SelectionRotateHandle, SelectionRotateHandleAnchor, SelectionRotateHandleId, SelectionMirrorAxis, } from "./editor/selection";
|
|
7
7
|
export { flipSelectionLocalBounds, getSelectionLocalBoundsFromPagePoints, mapSelectionLocalBoundsBetweenBounds, mapSelectionLocalPointBetweenBounds, mirrorSelectionLocalPoint, rotateSelectionPagePoint, selectionLocalPointToPagePoint, selectionPagePointToLocalPoint, } from "./editor/selection";
|
|
8
8
|
export { getAnchoredSelectionResizeLocalBounds, getAspectRatioLockedSelectionResizeBounds, getCenteredSelectionResizeBounds, getConstrainedSelectionResizeBounds, getSelectionResizeBounds, getSelectionResizeScalesFromBounds, isSelectionResizeCorner, normalizeSelectionResizeBoundsFromEdges, selectionResizeHandleMovesBottomEdge, selectionResizeHandleMovesLeftEdge, selectionResizeHandleMovesRightEdge, selectionResizeHandleMovesTopEdge, } from "./editor/resizeGeometry";
|
|
9
9
|
export { InteractionHandlerRegistry } from "./editor/interactions";
|
|
@@ -26,7 +26,7 @@ export type { DocumentSnapshot, SessionSnapshot, SnapshotMigration, } from "./sc
|
|
|
26
26
|
export { createDocumentSnapshotSupport, filterDocumentSnapshotBySupport, getDocumentSnapshotRequirements, getUnsupportedDocumentSnapshotRequirements, } from "./schema/snapshotSupport";
|
|
27
27
|
export type { DocumentSnapshotRequirements, DocumentSnapshotSupport, FilterDocumentSnapshotBySupportResult, UnsupportedDocumentSnapshotRequirements, } from "./schema/snapshotSupport";
|
|
28
28
|
export { ShapeUtil } from "./shapes/shapeUtil";
|
|
29
|
-
export type { ShapeBoundsSnapGeometry, ShapeBrushSelectInput, ShapeBrushWrapInput, ShapeBindingPointInput, ShapeEditEndResult, ShapeGeometryInput, ShapeHandleSnapContext, ShapeHandleSnapGeometry, ShapeLineSegmentHitTestInput, ShapePointHitTestInput, ShapeSelectionHandleAnchorInput, ShapeSelectionHandleAnchors, ShapeSelectionFrameInput, ShapeSelectionFlipAxis, ShapeSelectionFlipInput, ShapeSelectionOverlayInfo, ShapeSelectionOverlayInfoInput, ShapeSelectionPagePoints, ShapeSelectionPagePointsInput, ShapeSelectionResizeAspectRatioLockInput, ShapeSelectionResizeInput, ShapeSelectionTranslateInput, } from "./shapes/shapeUtil";
|
|
29
|
+
export type { ShapeBoundsSnapGeometry, ShapeBrushSelectInput, ShapeBrushWrapInput, ShapeBindingPointInput, ShapeBindingTargetHitTestInput, ShapeEditEndResult, ShapeGeometryInput, ShapeHandleSnapContext, ShapeHandleSnapGeometry, ShapeLineSegmentHitTestInput, ShapePointHitTestInput, ShapeSelectionHandleAnchorInput, ShapeSelectionHandleAnchors, ShapeSelectionFrameInput, ShapeSelectionFlipAxis, ShapeSelectionFlipInput, ShapeSelectionOverlayInfo, ShapeSelectionOverlayInfoInput, ShapeSelectionPagePoints, ShapeSelectionPagePointsInput, ShapeSelectionResizeAspectRatioLockInput, ShapeSelectionResizeInput, ShapeSelectionTranslateInput, } from "./shapes/shapeUtil";
|
|
30
30
|
export type { LaserTrailState } from "./editor/managers/interactionTransientManager";
|
|
31
31
|
export type { HandleSnapContext, HandleSnapInput, HandleSnapMode, HandleSnapResult, HandleSnapSnapshot, HandleSnapSnapshotInput, ResizeSnapInput, ResizeSnapResult, ResizeSnapSnapshot, SnapAxis, SnapCoordinateSpace, TranslateSnapInput, TranslateSnapResult, TranslateSnapSnapshot, } from "./editor/managers/snapTypes";
|
|
32
32
|
export { ShapeUtilRegistry } from "./shapes/shapeUtilRegistry";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export interface ReadonlyValue<T> {
|
|
2
2
|
get(): T;
|
|
3
3
|
}
|
|
4
|
-
export declare function observeValue<T>(name: string, value: ReadonlyValue<T>, onChange: () => void
|
|
4
|
+
export declare function observeValue<T>(name: string, value: ReadonlyValue<T>, onChange: () => void, options?: {
|
|
5
|
+
fireImmediately?: boolean;
|
|
6
|
+
}): () => void;
|
|
@@ -63,6 +63,8 @@ export interface ShapePointHitTestInput extends ShapeGeometryInput {
|
|
|
63
63
|
pagePoint: Vec;
|
|
64
64
|
positionedPoint: Vec;
|
|
65
65
|
}
|
|
66
|
+
export interface ShapeBindingTargetHitTestInput extends ShapePointHitTestInput {
|
|
67
|
+
}
|
|
66
68
|
export interface ShapeBoundsSnapGeometry {
|
|
67
69
|
points?: readonly Vec[];
|
|
68
70
|
}
|
|
@@ -124,9 +126,10 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
|
|
|
124
126
|
canUseSelectionFrameHandles(_shape: S, _input: ShapeSelectionFrameInput): boolean;
|
|
125
127
|
getSelectionTargetId(shape: S, _input: ShapeSelectionFrameInput): ShapeId;
|
|
126
128
|
getTranslateTargetId(shape: S, _input: ShapeSelectionTranslateInput): ShapeId;
|
|
127
|
-
|
|
129
|
+
isTransformDescendantContainer(_shape: S): boolean;
|
|
128
130
|
shouldRotateDescendants(shape: S): boolean;
|
|
129
|
-
|
|
131
|
+
canUngroupChildren(_shape: S): boolean;
|
|
132
|
+
canStartTranslateFromSelectionBounds(_shape: S, _input: ShapeSelectionFrameInput): boolean;
|
|
130
133
|
canSnap(_shape: S): boolean;
|
|
131
134
|
getBoundsSnapGeometry(_shape: S): ShapeBoundsSnapGeometry;
|
|
132
135
|
getHandleSnapGeometry(shape: S): ShapeHandleSnapGeometry;
|
|
@@ -138,9 +141,11 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
|
|
|
138
141
|
getLocalToPageTransform(shape: S): Mat;
|
|
139
142
|
canEdit(_shape: S): boolean;
|
|
140
143
|
canReceiveChildren(_shape: S): boolean;
|
|
144
|
+
canReceiveTerminalBinding(_shape: S, _input?: ShapeGeometryInput): boolean;
|
|
141
145
|
repairLoadedShape(_shape: S): S | null;
|
|
142
146
|
onEditEnd(_shape: S): ShapeEditEndResult | void;
|
|
143
147
|
hitTest(shape: S, positionedPoint: Vec, _input?: ShapePointHitTestInput): boolean;
|
|
148
|
+
hitTestBindingTarget(shape: S, positionedPoint: Vec, input?: ShapeBindingTargetHitTestInput): boolean;
|
|
144
149
|
hitTestLineSegment(shape: S, input: ShapeLineSegmentHitTestInput): boolean;
|
|
145
|
-
resolveBindingPoint(
|
|
150
|
+
resolveBindingPoint(shape: S, input: ShapeBindingPointInput): Vec;
|
|
146
151
|
}
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function ShapeLayer({ hoveredShapeId, }: {
|
|
3
|
-
hoveredShapeId?: ShapeId | null;
|
|
4
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare function ShapeLayer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,7 @@ export interface PagePointLike {
|
|
|
2
2
|
x: number;
|
|
3
3
|
y: number;
|
|
4
4
|
}
|
|
5
|
-
export type DashedGuideSegmentKind = "binding-preview" | "selection-binding";
|
|
5
|
+
export type DashedGuideSegmentKind = "binding-preview" | "selection-binding" | "terminal-binding-guide";
|
|
6
6
|
export declare function DashedGuideSegment({ start, end, startInset, endInset, strokeWidth, dashSize, gapSize, kind, terminal, }: {
|
|
7
7
|
start: PagePointLike;
|
|
8
8
|
end: PagePointLike;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
import { type SelectionBindingSegment } from "../../../canvas-core/index";
|
|
2
|
+
import { type DashedGuideSegmentKind } from "./BindingGuide";
|
|
1
3
|
export declare const SelectionPathOverlay: import("react").NamedExoticComponent<object>;
|
|
4
|
+
export declare const BindingSegmentsOverlay: import("react").NamedExoticComponent<{
|
|
5
|
+
bindingSegments: readonly SelectionBindingSegment[];
|
|
6
|
+
kind?: DashedGuideSegmentKind;
|
|
7
|
+
strokeWidth: number;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TerminalBindingGuidesOverlay: import("react").NamedExoticComponent<object>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MouseEvent as ReactMouseEvent, type PointerEvent as ReactPointerEvent, type RefObject } from "react";
|
|
2
|
-
import { type ActiveContextMenu, type Editor, type ShapeEditingSession
|
|
2
|
+
import { type ActiveContextMenu, type Editor, type ShapeEditingSession } from "../../canvas-core/index";
|
|
3
3
|
import type { CanvasDomEventGuardRegistry } from "../host/domEventGuards";
|
|
4
4
|
export interface CanvasDomEventHandlers {
|
|
5
5
|
onPointerDown: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
@@ -8,7 +8,6 @@ export interface CanvasDomEventHandlers {
|
|
|
8
8
|
export interface CanvasDomEventState {
|
|
9
9
|
containerRef: RefObject<HTMLDivElement | null>;
|
|
10
10
|
handlers: CanvasDomEventHandlers;
|
|
11
|
-
hoveredShapeId: ShapeId | null;
|
|
12
11
|
isPointerActive: boolean;
|
|
13
12
|
surfaceCursor: string | undefined;
|
|
14
13
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Editor, ShapeRecord } from "../canvas-core/index";
|
|
2
|
+
export declare function canReceiveArrowBindingTarget(editor: Editor, shape: ShapeRecord | undefined): shape is ShapeRecord;
|
|
3
|
+
export declare function getPreferredArrowBindingTarget(editor: Editor, candidates: readonly ShapeRecord[]): ShapeRecord | null;
|
|
@@ -4,7 +4,7 @@ export declare class ArrowBindingUtil extends BindingUtil<ArrowBindingRecord> {
|
|
|
4
4
|
readonly type: "arrow";
|
|
5
5
|
getDefaultProps(): ArrowBindingRecord["props"];
|
|
6
6
|
validateProps(props: unknown): ArrowBindingRecord["props"];
|
|
7
|
-
canBind(
|
|
7
|
+
canBind(editor: Editor, _binding: ArrowBindingRecord, context: {
|
|
8
8
|
fromShape: ShapeRecord;
|
|
9
9
|
toShape: ShapeRecord;
|
|
10
10
|
}): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box, ShapeUtil, Vec, type ShapeBrushWrapInput, type ShapeGeometryInput, type ShapeSelectionHandleAnchorInput, type ShapeSelectionHandleAnchors, type ShapeLineSegmentHitTestInput, type ShapeSelectionOverlayInfo, type ShapeSelectionOverlayInfoInput, type ShapeSelectionPagePointsInput, type ShapeSelectionPagePoints, type ShapePointHitTestInput, type ShapeUpdate } from "../canvas-core/index";
|
|
1
|
+
import { Box, ShapeUtil, Vec, type ShapeBrushWrapInput, type ShapeGeometryInput, type ShapeSelectionHandleAnchorInput, type ShapeSelectionHandleAnchors, type ShapeSelectionFrameInput, type ShapeLineSegmentHitTestInput, type ShapeSelectionOverlayInfo, type ShapeSelectionOverlayInfoInput, type ShapeSelectionPagePointsInput, type ShapeSelectionPagePoints, type ShapePointHitTestInput, type ShapeUpdate } from "../canvas-core/index";
|
|
2
2
|
import { type ArrowShapeProps, type ArrowShapeRecord } from "./types";
|
|
3
3
|
export declare class ArrowShapeUtil extends ShapeUtil<ArrowShapeRecord> {
|
|
4
4
|
readonly type: "arrow";
|
|
@@ -12,8 +12,9 @@ export declare class ArrowShapeUtil extends ShapeUtil<ArrowShapeRecord> {
|
|
|
12
12
|
updateSelectionPagePoints(shape: ArrowShapeRecord, input: ShapeSelectionPagePointsInput): ShapeUpdate;
|
|
13
13
|
isWrappedByBrush(shape: ArrowShapeRecord, input: ShapeBrushWrapInput): boolean;
|
|
14
14
|
getSelectionPagePoints(shape: ArrowShapeRecord): ShapeSelectionPagePoints;
|
|
15
|
-
contributesToSelectionFrame(_shape: ArrowShapeRecord): boolean;
|
|
16
|
-
|
|
15
|
+
contributesToSelectionFrame(_shape: ArrowShapeRecord, input: ShapeSelectionFrameInput): boolean;
|
|
16
|
+
canUseSelectionFrameHandles(_shape: ArrowShapeRecord, input: ShapeSelectionFrameInput): boolean;
|
|
17
|
+
canStartTranslateFromSelectionBounds(_shape: ArrowShapeRecord, input: ShapeSelectionFrameInput): boolean;
|
|
17
18
|
getSelectionHandleAnchors(shape: ArrowShapeRecord, input: ShapeSelectionHandleAnchorInput): ShapeSelectionHandleAnchors;
|
|
18
19
|
getSelectionOverlayInfo(shape: ArrowShapeRecord, input: ShapeSelectionOverlayInfoInput): ShapeSelectionOverlayInfo;
|
|
19
20
|
hitTest(shape: ArrowShapeRecord, point: Vec, input?: ShapePointHitTestInput): boolean;
|
|
@@ -7,6 +7,7 @@ export interface CreateArrowInput {
|
|
|
7
7
|
endBinding?: TerminalBindingTargetInput | null;
|
|
8
8
|
props?: Partial<ArrowShapeProps>;
|
|
9
9
|
parentId?: PageId;
|
|
10
|
+
meta?: Record<string, unknown>;
|
|
10
11
|
}
|
|
11
12
|
export declare function createArrow(editor: Editor, input: CreateArrowInput, source?: ChangeSource): ArrowShapeRecord;
|
|
12
13
|
export declare function applyResolvedTerminalBinding(editor: Editor, shapeId: ShapeId | null, terminal: ArrowTerminal, resolvedBinding: ResolvedTerminalBinding, source?: ChangeSource): ArrowShapeRecord | null;
|
|
@@ -8,6 +8,7 @@ export declare class DrawShapeUtil extends ShapeUtil<DrawShapeRecord> {
|
|
|
8
8
|
getLocalBounds(shape: DrawShapeRecord): Box;
|
|
9
9
|
getRenderBounds(shape: DrawShapeRecord): Box;
|
|
10
10
|
getExportBounds(shape: DrawShapeRecord): Box;
|
|
11
|
+
canReceiveTerminalBinding(_shape: DrawShapeRecord): boolean;
|
|
11
12
|
getSelectionResizeLocalBounds(shape: DrawShapeRecord): Box;
|
|
12
13
|
resizeSelectionBounds(shape: DrawShapeRecord, input: ShapeSelectionResizeInput): ShapeUpdate;
|
|
13
14
|
flipSelectionBounds(shape: DrawShapeRecord, input: ShapeSelectionFlipInput): ShapeUpdate;
|
|
@@ -15,9 +15,11 @@ export declare class FrameShapeUtil extends ShapeUtil<FrameShapeRecord> {
|
|
|
15
15
|
getBounds(shape: FrameShapeRecord): Box;
|
|
16
16
|
getPointHitTestBounds(shape: FrameShapeRecord): Box;
|
|
17
17
|
canReceiveChildren(_shape: FrameShapeRecord): boolean;
|
|
18
|
+
canReceiveTerminalBinding(_shape: FrameShapeRecord): boolean;
|
|
18
19
|
shouldRotateDescendants(_shape: FrameShapeRecord): boolean;
|
|
19
20
|
getChildClipLocalBounds(shape: FrameShapeRecord): Box | null;
|
|
20
21
|
canSelectByBrush(shape: FrameShapeRecord, input: ShapeBrushSelectInput): boolean;
|
|
21
22
|
hitTest(shape: FrameShapeRecord, positionedPoint: Vec): boolean;
|
|
23
|
+
hitTestBindingTarget(shape: FrameShapeRecord, positionedPoint: Vec): boolean;
|
|
22
24
|
hitTestLineSegment(shape: FrameShapeRecord, input: ShapeLineSegmentHitTestInput): boolean;
|
|
23
25
|
}
|
|
@@ -5,6 +5,7 @@ export declare class GeoShapeUtil extends ShapeUtil<GeoShapeRecord> {
|
|
|
5
5
|
getDefaultProps(): GeoShapeProps;
|
|
6
6
|
validateProps(props: unknown): GeoShapeProps;
|
|
7
7
|
getBounds(shape: GeoShapeRecord): Box;
|
|
8
|
+
canReceiveTerminalBinding(_shape: GeoShapeRecord): boolean;
|
|
8
9
|
getPositionedOutlineVertices(shape: GeoShapeRecord): Vec[];
|
|
9
10
|
getHandleSnapGeometry(shape: GeoShapeRecord): ShapeHandleSnapGeometry;
|
|
10
11
|
hitTest(shape: GeoShapeRecord, positionedPoint: Vec): boolean;
|
|
@@ -10,6 +10,7 @@ export declare class GroupShapeUtil extends ShapeUtil<GroupShapeRecord> {
|
|
|
10
10
|
validateProps(props: unknown): GroupShapeProps;
|
|
11
11
|
getBounds(shape: GroupShapeRecord): Box;
|
|
12
12
|
hitTest(_shape: GroupShapeRecord, _positionedPoint: Vec): boolean;
|
|
13
|
-
|
|
13
|
+
isTransformDescendantContainer(_shape: GroupShapeRecord): boolean;
|
|
14
|
+
canUngroupChildren(_shape: GroupShapeRecord): boolean;
|
|
14
15
|
canReceiveChildren(_shape: GroupShapeRecord): boolean;
|
|
15
16
|
}
|
|
@@ -8,6 +8,7 @@ export declare const IMAGE_CROP_DONE_TOOLBAR_ACTION_ID = "image.crop.done";
|
|
|
8
8
|
export declare const IMAGE_CROP_ZOOM_TOOLBAR_ACTION_ID = "image.crop.zoom";
|
|
9
9
|
export declare const IMAGE_CROP_ASPECT_RATIO_TOOLBAR_ACTION_ID = "image.crop.aspect-ratio";
|
|
10
10
|
export declare const IMAGE_CROP_RESET_TOOLBAR_ACTION_ID = "image.crop.reset";
|
|
11
|
+
export declare const IMAGE_CORNER_RADIUS_TOOLBAR_ACTION_ID = "image.corner-radius";
|
|
11
12
|
export declare class ImageShapeSvgExporter implements ShapeSvgExporter<ImageShapeRecord> {
|
|
12
13
|
readonly type: "image";
|
|
13
14
|
toSvg(shape: ImageShapeRecord, context: SvgExportContext): SvgNode | null;
|
|
@@ -5,6 +5,7 @@ export declare class ImageShapeUtil extends ShapeUtil<ImageShapeRecord> {
|
|
|
5
5
|
getDefaultProps(): ImageShapeProps;
|
|
6
6
|
validateProps(props: unknown): ImageShapeProps;
|
|
7
7
|
getBounds(shape: ImageShapeRecord): Box;
|
|
8
|
+
canReceiveTerminalBinding(_shape: ImageShapeRecord): boolean;
|
|
8
9
|
getSelectionResizeAspectRatioLock(_shape: ImageShapeRecord, input: ShapeSelectionResizeAspectRatioLockInput): boolean | null;
|
|
9
10
|
canEdit(_shape: ImageShapeRecord): boolean;
|
|
10
11
|
getSelectionHandleAnchors(shape: ImageShapeRecord, input: ShapeSelectionHandleAnchorInput): ShapeSelectionHandleAnchors;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { IMAGE_CROP_ASPECT_RATIO_TOOLBAR_ACTION_ID, IMAGE_CROP_DONE_TOOLBAR_ACTION_ID, IMAGE_CROP_RESET_TOOLBAR_ACTION_ID, IMAGE_CROP_TOOLBAR_ACTION_ID, IMAGE_CROP_ZOOM_TOOLBAR_ACTION_ID, IMAGE_DOWNLOAD_TOOLBAR_ACTION_ID, IMAGE_INSERT_TOOLBAR_ACTION_ID, IMAGE_REPLACE_TOOLBAR_ACTION_ID, ImageShapeSvgExporter, createImageEditorPlugin, isImageCropToolbarSession, } from "./editor";
|
|
1
|
+
export { IMAGE_CROP_ASPECT_RATIO_TOOLBAR_ACTION_ID, IMAGE_CROP_DONE_TOOLBAR_ACTION_ID, IMAGE_CROP_RESET_TOOLBAR_ACTION_ID, IMAGE_CROP_TOOLBAR_ACTION_ID, IMAGE_CROP_ZOOM_TOOLBAR_ACTION_ID, IMAGE_CORNER_RADIUS_TOOLBAR_ACTION_ID, IMAGE_DOWNLOAD_TOOLBAR_ACTION_ID, IMAGE_INSERT_TOOLBAR_ACTION_ID, IMAGE_REPLACE_TOOLBAR_ACTION_ID, ImageShapeSvgExporter, createImageEditorPlugin, isImageCropToolbarSession, } from "./editor";
|
|
2
2
|
export { createImageCanvasPlugin } from "./canvas";
|
|
3
3
|
export { createImageCropInteractionHandler, createImageCropSelectionHandleInteractionHandler, } from "./cropInteractions";
|
|
4
4
|
export { getImageCropModeMarkId } from "./crop";
|
|
@@ -8,6 +8,7 @@ export declare class TextShapeUtil extends ShapeUtil<TextShapeRecord> {
|
|
|
8
8
|
getLocalBounds(shape: TextShapeRecord): Box;
|
|
9
9
|
getRenderBounds(shape: TextShapeRecord): Box;
|
|
10
10
|
getExportBounds(shape: TextShapeRecord): Box;
|
|
11
|
+
canReceiveTerminalBinding(_shape: TextShapeRecord): boolean;
|
|
11
12
|
canEdit(_shape: TextShapeRecord): boolean;
|
|
12
13
|
contributesToSelectionFrame(shape: TextShapeRecord, input: ShapeSelectionFrameInput): boolean;
|
|
13
14
|
canUseSelectionFrameHandles(shape: TextShapeRecord, input: ShapeSelectionFrameInput): boolean;
|
|
@@ -10,6 +10,7 @@ export interface BuiltInCanvasShapeInput {
|
|
|
10
10
|
fill?: ShapeColor;
|
|
11
11
|
stroke?: ShapeColor;
|
|
12
12
|
strokeWidth?: number;
|
|
13
|
+
meta?: Record<string, unknown>;
|
|
13
14
|
}
|
|
14
15
|
export interface BuiltInCanvasTextInput {
|
|
15
16
|
x: number;
|
|
@@ -21,6 +22,7 @@ export interface BuiltInCanvasTextInput {
|
|
|
21
22
|
color?: ShapeColor;
|
|
22
23
|
size?: TextShapeProps["size"];
|
|
23
24
|
textAlign?: TextShapeProps["textAlign"];
|
|
25
|
+
meta?: Record<string, unknown>;
|
|
24
26
|
}
|
|
25
27
|
export interface BuiltInCanvasFrameInput extends BuiltInCanvasShapeInput {
|
|
26
28
|
name?: string;
|
|
@@ -48,6 +50,7 @@ export interface BuiltInCanvasArrowInput {
|
|
|
48
50
|
headEnd?: ArrowShapeProps["headEnd"];
|
|
49
51
|
startBinding?: BuiltInCanvasArrowBindingInput | null;
|
|
50
52
|
endBinding?: BuiltInCanvasArrowBindingInput | null;
|
|
53
|
+
meta?: Record<string, unknown>;
|
|
51
54
|
}
|
|
52
55
|
export interface BuiltInGeoController {
|
|
53
56
|
createRectangle(input: BuiltInCanvasShapeInput): CanvasProductShapeRef | null;
|
package/builtins/extensions.d.ts
CHANGED
|
@@ -9,9 +9,10 @@ export interface BuiltInCanvasExtensionOptions {
|
|
|
9
9
|
group?: boolean;
|
|
10
10
|
image?: boolean;
|
|
11
11
|
laser?: boolean;
|
|
12
|
+
path?: boolean;
|
|
12
13
|
text?: boolean | LandExtensionOptionsInput<TextExtensionOptions>;
|
|
13
14
|
}
|
|
14
|
-
export declare const builtInCanvasExtensions: readonly [import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<TextExtensionOptions>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>];
|
|
15
|
+
export declare const builtInCanvasExtensions: readonly [import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<TextExtensionOptions>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>];
|
|
15
16
|
export type BuiltInCanvasExtension = (typeof builtInCanvasExtensions)[number];
|
|
16
17
|
export declare function createBuiltInCanvasExtensions(options?: BuiltInCanvasExtensionOptions): readonly BuiltInCanvasExtension[];
|
|
17
18
|
export declare function hasBuiltInCanvasExtension(extensions: readonly BuiltInCanvasExtension[], name: keyof BuiltInCanvasExtensionOptions): boolean;
|
package/chrome/types.d.ts
CHANGED
|
@@ -37,13 +37,17 @@ export interface CanvasKitPersistenceControls {
|
|
|
37
37
|
isDiscardingUnsupportedRecords: boolean;
|
|
38
38
|
status: ProductPersistenceStatus | null;
|
|
39
39
|
}
|
|
40
|
+
export interface CanvasKitLayerTreeSource {
|
|
41
|
+
getSnapshot(pageId?: string): readonly BuiltInCanvasLayerNode[];
|
|
42
|
+
subscribe(onStoreChange: () => void): () => void;
|
|
43
|
+
}
|
|
40
44
|
export interface CanvasKitChromeContext<TController extends CanvasKitBaseController = CanvasKitController> {
|
|
41
45
|
controller: TController;
|
|
42
46
|
contextMenu: CanvasKitContextMenuState;
|
|
43
47
|
currentPageId: string;
|
|
44
48
|
currentPageShapeIds: readonly ShapeId[];
|
|
45
49
|
history: HistoryControls;
|
|
46
|
-
|
|
50
|
+
layerTree: CanvasKitLayerTreeSource;
|
|
47
51
|
pages: PageControls;
|
|
48
52
|
selection: EditorSelectionState;
|
|
49
53
|
selectedShapeIds: readonly ShapeId[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
|
-
import type
|
|
2
|
+
import { type ActiveContextMenu } from "../_vendor/canvas-core/index";
|
|
3
3
|
import type { CanvasKitBaseController } from "../controller/canvasKitController";
|
|
4
4
|
import type { CanvasKitRuntime } from "../runtime/canvasKitRuntime";
|
|
5
5
|
import type { CanvasKitHostExtension } from "../runtime/canvasKitHostExtensions";
|
|
@@ -7,7 +7,7 @@ export type CanvasKitTextInput = BuiltInCanvasTextInput;
|
|
|
7
7
|
export type CanvasKitFrameInput = BuiltInCanvasFrameInput;
|
|
8
8
|
export interface CanvasKitBaseController<TToolId extends string = string> extends CanvasProductController<TToolId> {
|
|
9
9
|
}
|
|
10
|
-
export declare const CANVAS_KIT_TOOL_IDS: readonly ["select", "hand", "rectangle", "ellipse", "diamond", "triangle", "hexagon", "star", "arrow", "draw", "text", "frame", "eraser", "laser"];
|
|
10
|
+
export declare const CANVAS_KIT_TOOL_IDS: readonly ["select", "hand", "rectangle", "ellipse", "diamond", "triangle", "hexagon", "star", "arrow", "draw", "path", "text", "frame", "eraser", "laser"];
|
|
11
11
|
export type CanvasKitToolId = (typeof CANVAS_KIT_TOOL_IDS)[number];
|
|
12
12
|
export interface CanvasKitControllerSnapshot<TToolId extends string = CanvasKitToolId> extends BuiltInCanvasControllerSnapshot<TToolId> {
|
|
13
13
|
productId: string;
|
|
@@ -1,10 +1,42 @@
|
|
|
1
|
-
import type { Camera, Editor, LayerOrderDirection, LayerOrderEdge, ReparentShapePlacementFailureReason, ShapeId } from "../../_vendor/canvas-core/index";
|
|
1
|
+
import type { Camera, ChangeSource, Editor, LayerOrderDirection, LayerOrderEdge, ReparentShapePlacementFailureReason, ShapeId } from "../../_vendor/canvas-core/index";
|
|
2
2
|
import type { ProductServiceRegistry } from "../runtime/productServices";
|
|
3
3
|
import type { ProductFeatureControllerRegistry } from "./featureControllerRegistry";
|
|
4
4
|
export interface CanvasProductShapeRef {
|
|
5
5
|
id: ShapeId;
|
|
6
6
|
type: string;
|
|
7
7
|
}
|
|
8
|
+
export interface CanvasProductShapeData {
|
|
9
|
+
id: ShapeId;
|
|
10
|
+
type: string;
|
|
11
|
+
parentId: string;
|
|
12
|
+
pageId: string | null;
|
|
13
|
+
index: string;
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
rotation: number;
|
|
17
|
+
scaleX: number;
|
|
18
|
+
scaleY: number;
|
|
19
|
+
opacity: number;
|
|
20
|
+
isHidden: boolean;
|
|
21
|
+
isLocked: boolean;
|
|
22
|
+
props: Record<string, unknown>;
|
|
23
|
+
meta: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface CanvasProductShapeUpdate {
|
|
26
|
+
id: ShapeId;
|
|
27
|
+
x?: number;
|
|
28
|
+
y?: number;
|
|
29
|
+
rotation?: number;
|
|
30
|
+
scaleX?: number;
|
|
31
|
+
scaleY?: number;
|
|
32
|
+
opacity?: number;
|
|
33
|
+
isHidden?: boolean;
|
|
34
|
+
isLocked?: boolean;
|
|
35
|
+
parentId?: string;
|
|
36
|
+
index?: string;
|
|
37
|
+
props?: Record<string, unknown>;
|
|
38
|
+
meta?: Record<string, unknown>;
|
|
39
|
+
}
|
|
8
40
|
export interface CanvasProductSessionPageState {
|
|
9
41
|
pageId: string;
|
|
10
42
|
selectedShapeIds: ShapeId[];
|
|
@@ -28,6 +60,14 @@ export interface CanvasProductControllerSnapshot<TToolId extends string = string
|
|
|
28
60
|
shapeCount: number;
|
|
29
61
|
session: CanvasProductSessionSnapshot<TToolId>;
|
|
30
62
|
}
|
|
63
|
+
export type CanvasProductControllerChangeKey = "document" | "session" | "pageId" | "activeToolId" | "selectedShapeIds" | "shapeCount";
|
|
64
|
+
export interface CanvasProductControllerChange<TToolId extends string = string> {
|
|
65
|
+
source: ChangeSource;
|
|
66
|
+
changes: readonly CanvasProductControllerChangeKey[];
|
|
67
|
+
snapshot: CanvasProductControllerSnapshot<TToolId>;
|
|
68
|
+
previousSnapshot: CanvasProductControllerSnapshot<TToolId>;
|
|
69
|
+
}
|
|
70
|
+
export type CanvasProductControllerChangeListener<TToolId extends string = string> = (change: CanvasProductControllerChange<TToolId>) => void;
|
|
31
71
|
export interface CanvasProductLayerNode {
|
|
32
72
|
id: ShapeId;
|
|
33
73
|
parentId: string;
|
|
@@ -69,6 +109,7 @@ export interface CanvasProductPageRef {
|
|
|
69
109
|
export interface CanvasProductController<TToolId extends string = string> {
|
|
70
110
|
features: ProductFeatureControllerRegistry;
|
|
71
111
|
snapshot(): CanvasProductControllerSnapshot<TToolId>;
|
|
112
|
+
subscribe(listener: CanvasProductControllerChangeListener<TToolId>): () => void;
|
|
72
113
|
clearHistory(): void;
|
|
73
114
|
canUndo(): boolean;
|
|
74
115
|
canRedo(): boolean;
|
|
@@ -78,6 +119,10 @@ export interface CanvasProductController<TToolId extends string = string> {
|
|
|
78
119
|
selectAll(): void;
|
|
79
120
|
deleteSelection(): void;
|
|
80
121
|
deleteShapes(ids: ShapeId[]): void;
|
|
122
|
+
getShape(id: ShapeId): CanvasProductShapeData | null;
|
|
123
|
+
getShapes(ids?: ShapeId[]): CanvasProductShapeData[];
|
|
124
|
+
updateShapes(updates: CanvasProductShapeUpdate[]): ShapeId[];
|
|
125
|
+
updateShapeMeta(id: ShapeId, patch: Record<string, unknown>): ShapeId | null;
|
|
81
126
|
duplicateSelection(): ShapeId[];
|
|
82
127
|
centerOnShape(id: ShapeId): boolean;
|
|
83
128
|
getLayerTree(pageId?: string): CanvasProductLayerNode[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createProductFeatureControllerRegistry, createProductFeatureControllerToken, } from "./featureControllerRegistry";
|
|
2
2
|
export type { ProductFeatureControllerRegistry, ProductFeatureControllerRegistryRuntime, ProductFeatureControllerToken, } from "./featureControllerRegistry";
|
|
3
3
|
export { createCanvasProductController } from "./canvasProductController";
|
|
4
|
-
export type { CanvasProductController, CanvasProductControllerContext, CanvasProductControllerOptions, CanvasProductControllerSnapshot, CanvasProductLayerActionState, CanvasProductLayerNode, CanvasProductLayerPlacement, CanvasProductLayerPlacementFailureReason, CanvasProductLayerPlacementResult, CanvasProductPageRef, CanvasProductSessionPageState, CanvasProductSessionSnapshot, CanvasProductShapeRef, } from "./canvasProductController";
|
|
4
|
+
export type { CanvasProductController, CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductControllerContext, CanvasProductControllerOptions, CanvasProductControllerSnapshot, CanvasProductLayerActionState, CanvasProductLayerNode, CanvasProductLayerPlacement, CanvasProductLayerPlacementFailureReason, CanvasProductLayerPlacementResult, CanvasProductPageRef, CanvasProductShapeData, CanvasProductSessionPageState, CanvasProductSessionSnapshot, CanvasProductShapeRef, CanvasProductShapeUpdate, } from "./canvasProductController";
|
package/core/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type { CanvasProductRuntimeContribution, } from "./runtime/productContrib
|
|
|
8
8
|
export type { ProductContextMenuRegistry, ProductPluginHostRuntime, ProductToolbarRegistry, } from "./runtime/productHost";
|
|
9
9
|
export type { ProductAssetResolverService, ProductServiceFactory, ProductServiceFactoryContext, ProductServiceRegistry, ProductServiceRegistryRuntime, ProductServiceToken, } from "./runtime/productServices";
|
|
10
10
|
export type { ProductFeatureControllerRegistry, ProductFeatureControllerRegistryRuntime, ProductFeatureControllerToken, } from "./controller/featureControllerRegistry";
|
|
11
|
+
export type { CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductShapeData, CanvasProductShapeUpdate, } from "./controller";
|
|
11
12
|
export { SYSTEM_SELECTION_BRING_FORWARD_ACTION_ID, SYSTEM_SELECTION_BRING_TO_FRONT_ACTION_ID, SYSTEM_SELECTION_DELETE_ACTION_ID, SYSTEM_SELECTION_DUPLICATE_ACTION_ID, SYSTEM_SELECTION_FLIP_HORIZONTAL_ACTION_ID, SYSTEM_SELECTION_FLIP_VERTICAL_ACTION_ID, SYSTEM_SELECTION_GROUP_ACTION_ID, SYSTEM_SELECTION_RESET_ROTATION_ACTION_ID, SYSTEM_SELECTION_SELECT_ALL_ACTION_ID, SYSTEM_SELECTION_SEND_BACKWARD_ACTION_ID, SYSTEM_SELECTION_SEND_TO_BACK_ACTION_ID, SYSTEM_SELECTION_UNGROUP_ACTION_ID, runCanvasAction, } from "./features/actions/canvasActions";
|
|
12
13
|
export { createToolbarProductContribution } from "./features/toolbar/toolbarContribution";
|
|
13
14
|
export { createCanvasActionContext } from "./features/actions/canvasActionContext";
|
package/index.d.ts
CHANGED
|
@@ -4,12 +4,15 @@ export type { TextExtensionOptions, TextFontDefinition, TextFontFaceSource, Text
|
|
|
4
4
|
export type { CustomShapeColorRef, ShapeColor, ShapeColorRef, ThemeColorSlot, ThemeColorTokenName, ThemeShapeColorRef, } from "./_vendor/canvas-core/index";
|
|
5
5
|
export { CanvasKitFloatingToolbarLayer, } from "./chrome/CanvasKitFloatingToolbarLayer";
|
|
6
6
|
export { FloatingSelectionToolbarPageSpace, } from "./chrome/FloatingSelectionToolbarPageSpace";
|
|
7
|
+
export { useCanvasKitLayerTree, } from "./chrome/bindings/useCanvasKitLayerTree";
|
|
7
8
|
import "./index.css";
|
|
8
9
|
export { createCanvasKitController, createCanvasKitControllerWithTools, } from "./controller/canvasKitController";
|
|
9
10
|
export { CanvasKitRoot } from "./react/CanvasKitRoot";
|
|
10
11
|
export { defineCanvasKit } from "./product/canvasKitProduct";
|
|
11
12
|
export { CANVAS_KIT_TOOL_IDS } from "./controller/canvasKitController";
|
|
12
13
|
export type { CanvasKitController, CanvasKitControllerRuntimeContext, CanvasKitControllerOptions, CanvasKitControllerSnapshot, CanvasKitControllerWithToolsOptions, CanvasKitBaseController, CanvasKitControllerWithTools, CanvasKitFrameInput, CanvasKitShapeInput, CanvasKitTextInput, CanvasKitToolId, } from "./controller/canvasKitController";
|
|
13
|
-
export type {
|
|
14
|
+
export type { BuiltInCanvasArrowInput as CanvasKitArrowInput } from "./builtins";
|
|
15
|
+
export type { CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductShapeData, CanvasProductShapeUpdate, } from "./core";
|
|
16
|
+
export type { CanvasKitChromeContext, CanvasKitContextMenuState, CanvasKitGridControls, CanvasKitLayerNode, CanvasKitLayerTreeSource, CanvasKitPersistenceControls, CanvasKitToolbarActionState, CanvasKitToolbarRuntime, ContextMenuCommandItem, ContextMenuItem, ContextMenuSection, EditorSelectionState, HistoryControls, PageControls, ShapeId, SvgExportControls, CanvasActionValue, CanvasActionContext, ToolbarGroup, ToolbarItem, ToolbarSurfaces, ZoomControlsState, } from "./chrome/types";
|
|
14
17
|
export type { CanvasKitDocumentSeed, CanvasKitExtensionOptions, CanvasKitProduct, CanvasKitProductOptions, CanvasKitChromeRenderer, } from "./product/canvasKitProduct";
|
|
15
18
|
export type { ExportStatus, ProductPersistenceStatus, } from "./core";
|