@yuzhouu/canvas-kit 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +158 -102
- package/_vendor/canvas-core/bindings/bindingUtil.d.ts +8 -0
- package/_vendor/canvas-core/editor/cameraPanSession.d.ts +9 -0
- package/_vendor/canvas-core/editor/canvasPanInteraction.d.ts +2 -0
- package/_vendor/canvas-core/editor/commands.d.ts +15 -3
- package/_vendor/canvas-core/editor/createEditorWithPlugins.d.ts +6 -0
- package/_vendor/canvas-core/editor/editor.d.ts +24 -26
- package/_vendor/canvas-core/editor/editorComputedHelpers.d.ts +4 -2
- package/_vendor/canvas-core/editor/historyManager.d.ts +22 -1
- package/_vendor/canvas-core/editor/index.d.ts +2 -2
- package/_vendor/canvas-core/editor/interactions.d.ts +10 -1
- package/_vendor/canvas-core/editor/managers/bindingManager.d.ts +1 -0
- package/_vendor/canvas-core/editor/managers/inputsManager.d.ts +3 -0
- package/_vendor/canvas-core/editor/managers/interactionTransientManager.d.ts +0 -26
- package/_vendor/canvas-core/editor/managers/queryManager.d.ts +13 -1
- package/_vendor/canvas-core/editor/managers/selectionLayoutManager.d.ts +2 -0
- package/_vendor/canvas-core/editor/managers/shapeGeometryManager.d.ts +3 -2
- package/_vendor/canvas-core/editor/managers/shapeHierarchyManager.d.ts +6 -2
- package/_vendor/canvas-core/editor/managers/shapeReparenting.d.ts +3 -2
- package/_vendor/canvas-core/editor/managers/snapTypes.d.ts +1 -0
- package/_vendor/canvas-core/editor/managers/spatialIndexManager.d.ts +1 -0
- package/_vendor/canvas-core/editor/queries/shapeTransforms.d.ts +32 -12
- package/_vendor/canvas-core/editor/selection.d.ts +19 -5
- package/_vendor/canvas-core/editor/selectionOverlay.d.ts +4 -3
- package/_vendor/canvas-core/editor/selectionResizeCapabilities.d.ts +9 -0
- package/_vendor/canvas-core/editor/shapeTransformSpace.d.ts +6 -0
- package/_vendor/canvas-core/exports/svg.d.ts +1 -0
- package/_vendor/canvas-core/geometry/index.d.ts +1 -0
- package/_vendor/canvas-core/geometry/mat.d.ts +6 -2
- package/_vendor/canvas-core/geometry/polygon.d.ts +7 -0
- package/_vendor/canvas-core/geometry/vec.d.ts +0 -2
- package/_vendor/canvas-core/index.d.ts +14 -20
- package/_vendor/canvas-core/plugins/editorRuntimePlugin.d.ts +4 -10
- package/_vendor/canvas-core/plugins/editorRuntimeRegistry.d.ts +19 -0
- package/_vendor/canvas-core/plugins/index.d.ts +2 -1
- package/_vendor/canvas-core/schema/records.d.ts +2 -7
- package/_vendor/canvas-core/schema/snapshots.d.ts +10 -19
- package/_vendor/canvas-core/shapes/colors.d.ts +1 -2
- package/_vendor/canvas-core/shapes/shapeUtil.d.ts +52 -14
- package/_vendor/canvas-core/tools/select/selectToolHelpers.d.ts +9 -6
- package/_vendor/canvas-core/tools/select/states/draggingSelectionHandleInteractionState.d.ts +3 -3
- package/_vendor/canvas-core/tools/select/states/pointingSelectionHandleInteractionState.d.ts +2 -1
- package/_vendor/canvas-plugin-sdk/actionRegistry.d.ts +7 -0
- package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/actions.d.ts +2 -4
- package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/contextMenu.d.ts +25 -30
- package/_vendor/canvas-plugin-sdk/contextMenuRegistry.d.ts +11 -0
- package/_vendor/canvas-plugin-sdk/index.d.ts +7 -0
- package/_vendor/canvas-plugin-sdk/plugin.d.ts +39 -0
- package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/toolbar.d.ts +22 -1
- package/_vendor/canvas-plugin-sdk/toolbarRegistry.d.ts +19 -0
- package/_vendor/canvas-react/components/CanvasView.d.ts +2 -2
- package/_vendor/canvas-react/components/canvasKeyboardEvents.d.ts +13 -0
- package/_vendor/canvas-react/components/useCanvasDomEvents.d.ts +4 -3
- package/_vendor/canvas-react/contextMenuRequest.d.ts +19 -0
- package/_vendor/canvas-react/host/canvasRenderPlugin.d.ts +7 -1
- package/_vendor/canvas-react/host/canvasRenderRuntime.d.ts +13 -0
- package/_vendor/canvas-react/host/domEventGuards.d.ts +3 -3
- package/_vendor/canvas-react/host/index.d.ts +2 -8
- package/_vendor/canvas-react/host/overlayRegistry.d.ts +3 -3
- package/_vendor/canvas-react/host/rendererRegistry.d.ts +7 -4
- package/_vendor/canvas-react/index.d.ts +1 -0
- package/_vendor/plugin-arrow/arrowGeometry.d.ts +6 -4
- package/_vendor/plugin-arrow/arrowShapeUtil.d.ts +5 -3
- package/_vendor/plugin-arrow/arrowTerminalCommands.d.ts +2 -2
- package/_vendor/plugin-arrow/canvasRender.d.ts +2 -2
- package/_vendor/plugin-arrow/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-arrow/feature.d.ts +2 -3
- package/_vendor/plugin-arrow/index.d.ts +2 -2
- package/_vendor/plugin-draw/canvasRender.d.ts +2 -2
- package/_vendor/plugin-draw/drawGeometry.d.ts +4 -7
- package/_vendor/plugin-draw/drawShapeUtil.d.ts +2 -2
- package/_vendor/plugin-draw/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-draw/feature.d.ts +2 -3
- package/_vendor/plugin-draw/index.d.ts +3 -3
- package/_vendor/plugin-eraser/canvasRender.d.ts +2 -2
- package/_vendor/plugin-eraser/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-eraser/eraserRuntime.d.ts +12 -0
- package/_vendor/plugin-eraser/feature.d.ts +2 -3
- package/_vendor/plugin-eraser/index.d.ts +3 -2
- package/_vendor/plugin-frame/canvasRender.d.ts +2 -2
- package/_vendor/plugin-frame/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-frame/feature.d.ts +2 -3
- package/_vendor/plugin-frame/frameShapeUtil.d.ts +4 -2
- package/_vendor/plugin-frame/index.d.ts +2 -2
- package/_vendor/plugin-geo/canvasRender.d.ts +2 -2
- package/_vendor/plugin-geo/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-geo/feature.d.ts +2 -3
- package/_vendor/plugin-geo/geoShapeUtil.d.ts +1 -1
- package/_vendor/plugin-geo/index.d.ts +2 -2
- package/_vendor/plugin-group/canvasRender.d.ts +2 -2
- package/_vendor/plugin-group/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-group/feature.d.ts +2 -3
- package/_vendor/plugin-group/groupContributions.d.ts +7 -0
- package/_vendor/plugin-group/groupShapeUtil.d.ts +24 -5
- package/_vendor/plugin-group/index.d.ts +3 -2
- package/_vendor/plugin-image/canvasRender.d.ts +2 -2
- package/_vendor/plugin-image/cropRuntime.d.ts +1 -1
- package/_vendor/plugin-image/cropSession.d.ts +5 -3
- package/_vendor/plugin-image/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-image/feature.d.ts +2 -3
- package/_vendor/plugin-image/imageHostActionContract.d.ts +1 -1
- package/_vendor/plugin-image/imageShapeUtil.d.ts +3 -3
- package/_vendor/plugin-image/index.d.ts +4 -4
- package/_vendor/plugin-image/runtimeShared.d.ts +1 -1
- package/_vendor/plugin-image/smudge.d.ts +6 -2
- package/_vendor/plugin-image/smudgeRuntime.d.ts +1 -1
- package/_vendor/plugin-image/styleRuntime.d.ts +1 -1
- package/_vendor/plugin-image/toolbarRuntime.d.ts +1 -1
- package/_vendor/plugin-laser/canvasRender.d.ts +2 -2
- package/_vendor/plugin-laser/editorRuntime.d.ts +4 -2
- package/_vendor/plugin-laser/feature.d.ts +2 -3
- package/_vendor/plugin-laser/index.d.ts +3 -2
- package/_vendor/plugin-laser/laserRuntime.d.ts +18 -0
- package/_vendor/plugin-packaging/canvasRender.d.ts +2 -0
- package/_vendor/plugin-packaging/editorRuntime.d.ts +2 -0
- package/_vendor/plugin-packaging/feature.d.ts +2 -0
- package/_vendor/plugin-packaging/index.d.ts +17 -0
- package/_vendor/plugin-packaging/packagingArtwork.d.ts +5 -0
- package/_vendor/plugin-packaging/packagingDxf.d.ts +9 -0
- package/_vendor/plugin-packaging/packagingGeometry.d.ts +74 -0
- package/_vendor/plugin-packaging/packagingInteractions.d.ts +2 -0
- package/_vendor/plugin-packaging/packagingPdfExporter.d.ts +25 -0
- package/_vendor/plugin-packaging/packagingRuntime.d.ts +11 -0
- package/_vendor/plugin-packaging/packagingShapeUtil.d.ts +34 -0
- package/_vendor/plugin-packaging/packagingStyle.d.ts +10 -0
- package/_vendor/plugin-packaging/packagingSvgExporter.d.ts +7 -0
- package/_vendor/plugin-packaging/productRuntime.d.ts +2 -0
- package/_vendor/plugin-packaging/types.d.ts +168 -0
- package/_vendor/plugin-packaging/validation.d.ts +3 -0
- package/_vendor/plugin-path/PathDraftOverlay.d.ts +1 -0
- package/_vendor/plugin-path/PathEditInsertPreviewOverlay.d.ts +1 -0
- package/_vendor/plugin-path/PathShapeRenderer.d.ts +12 -0
- package/_vendor/plugin-path/canvasRender.d.ts +2 -0
- package/_vendor/plugin-path/editorRuntime.d.ts +21 -0
- package/_vendor/plugin-path/feature.d.ts +2 -0
- package/_vendor/plugin-path/index.d.ts +7 -0
- package/_vendor/plugin-path/pathBoolean.d.ts +13 -0
- package/_vendor/plugin-path/pathDraft.d.ts +10 -0
- package/_vendor/plugin-path/pathEditPreview.d.ts +11 -0
- package/_vendor/plugin-path/pathEditSelection.d.ts +24 -0
- package/_vendor/plugin-path/pathEditSnap.d.ts +6 -0
- package/_vendor/plugin-path/pathGeometry.d.ts +74 -0
- package/_vendor/plugin-path/pathHandles.d.ts +18 -0
- package/_vendor/plugin-path/pathInteractions.d.ts +7 -0
- package/_vendor/plugin-path/pathShapeUtil.d.ts +28 -0
- package/_vendor/plugin-path/pathSvg.d.ts +3 -0
- package/_vendor/plugin-path/pathTool.d.ts +39 -0
- package/_vendor/plugin-path/types.d.ts +36 -0
- package/_vendor/plugin-text/arrowLabelBindingUtil.d.ts +6 -1
- package/_vendor/plugin-text/canvasRender.d.ts +6 -3
- package/_vendor/plugin-text/editorRuntime.d.ts +9 -3
- package/_vendor/plugin-text/feature.d.ts +4 -4
- package/_vendor/plugin-text/geoLabelBindingUtil.d.ts +6 -1
- package/_vendor/plugin-text/host/RichTextEditingBox.d.ts +4 -1
- package/_vendor/plugin-text/host/TiptapTextEditor.d.ts +5 -2
- package/_vendor/plugin-text/host/richTextRendering.d.ts +0 -1
- package/_vendor/plugin-text/host/textFormattingApi.d.ts +16 -0
- package/_vendor/plugin-text/host/textShapeRendererRuntime.d.ts +3 -1
- package/_vendor/plugin-text/host/tiptapTextEditorController.d.ts +4 -1
- package/_vendor/plugin-text/index.d.ts +7 -4
- package/_vendor/plugin-text/richTextUtils.d.ts +6 -0
- package/_vendor/plugin-text/shapeWideTextFormatting.d.ts +8 -0
- package/_vendor/plugin-text/textFonts.d.ts +6 -3
- package/_vendor/plugin-text/textFormatting.d.ts +45 -0
- package/_vendor/plugin-text/textFormattingSession.d.ts +6 -0
- package/_vendor/plugin-text/textLabelHelpers.d.ts +9 -4
- package/_vendor/plugin-text/textLinkPopoverPresentation.d.ts +18 -0
- package/_vendor/plugin-text/textShapeHelpers.d.ts +1 -0
- package/_vendor/plugin-text/textShapeUtil.d.ts +5 -4
- package/_vendor/signals/effect.d.ts +0 -4
- package/_vendor/signals/index.d.ts +1 -1
- package/_vendor/store/store.d.ts +4 -0
- package/browser/persistence.d.ts +5 -16
- package/builtins/controller/createBuiltInCanvasController.d.ts +2 -0
- package/builtins/controller/packagingController.d.ts +71 -0
- package/builtins/index.d.ts +4 -2
- package/builtins/plugins.d.ts +16 -0
- package/chrome/floating/CanvasKitFloatingPortal.d.ts +6 -0
- package/chrome/floating/useCanvasKitFloatingPosition.d.ts +11 -0
- package/chrome/toolbar/CanvasKitFloatingToolbarLayer.d.ts +1 -1
- package/chrome/toolbar/toolbarLabels.d.ts +1 -1
- package/chrome/toolbar/useToolbarSurfaces.d.ts +6 -10
- package/chrome/types.d.ts +5 -10
- package/chrome/useCanvasKitChromeContext.d.ts +13 -13
- package/chrome/useContextMenuSurface.d.ts +4 -4
- package/chrome/useHistoryControls.d.ts +3 -3
- package/chrome/usePageControls.d.ts +3 -3
- package/controller/canvasKitController.d.ts +5 -9
- package/core/index.d.ts +1 -2
- package/core/product-controller/canvasProductController.d.ts +2 -1
- package/core/runtime/productAssets.d.ts +4 -2
- package/core/runtime/productEditor.d.ts +1 -1
- package/core/runtime/productServices.d.ts +6 -2
- package/core/runtime/runtimeContracts.d.ts +17 -0
- package/es-DocrZgUh.mjs +2 -0
- package/features/actions/actionRuntime.d.ts +2 -7
- package/features/clipboard/clipboardContextMenuContributions.d.ts +1 -1
- package/features/clipboard/clipboardContribution.d.ts +2 -1
- package/features/clipboard/clipboardPlugin.d.ts +1 -0
- package/features/clipboard/clipboardService.d.ts +1 -1
- package/features/context-menu/contextMenuRuntime.d.ts +4 -4
- package/features/image/asset/imageAssetService.d.ts +1 -1
- package/features/image/asset/imageBlobStore.d.ts +6 -2
- package/features/image/controller/imageProductController.d.ts +1 -1
- package/features/image/imageProductPlugin.d.ts +1 -0
- package/features/image/smudge/imageSmudgeHostActions.d.ts +1 -1
- package/features/image/toolbar/imageHostActions.d.ts +13 -2
- package/features/image/toolbar/imageToolbarHostBridge.d.ts +1 -1
- package/features/keyboard/keyboardShortcutPlugin.d.ts +1 -0
- package/features/keyboard/useCanvasKitKeyboardShortcuts.d.ts +5 -3
- package/features/selection/selectionActions.d.ts +2 -3
- package/features/selection/selectionContextMenuContributions.d.ts +1 -1
- package/features/selection/selectionPlugin.d.ts +1 -0
- package/features/selection/selectionToolbarContributions.d.ts +1 -1
- package/features/text/link/TextLinkHoverPopover.d.ts +6 -0
- package/features/text/textProductPlugin.d.ts +5 -0
- package/features/tool/toolActions.d.ts +1 -1
- package/features/tool/toolContextMenuContributions.d.ts +1 -1
- package/features/tool/toolPlugin.d.ts +1 -0
- package/features/tool/toolToolbarContributions.d.ts +1 -1
- package/features/view/viewActions.d.ts +1 -1
- package/features/view/viewContextMenuContributions.d.ts +1 -1
- package/features/view/viewPlugin.d.ts +1 -0
- package/index.css +1 -1
- package/index.d.ts +23 -9
- package/index.mjs +84 -96
- package/package.json +12 -9
- package/product/standardCanvasKitPlugins.d.ts +4 -0
- package/react/CanvasKitRoot.d.ts +10 -5
- package/react/useCanvasKitControllerLifecycle.d.ts +8 -0
- package/react/useCanvasKitRuntime.d.ts +2 -4
- package/runtime/canvasKitCommandExecutor.d.ts +13 -0
- package/runtime/canvasKitPluginContracts.d.ts +79 -0
- package/runtime/canvasKitPlugins.d.ts +33 -0
- package/runtime/canvasKitRuntime.d.ts +46 -19
- package/runtime/canvasKitRuntimeContracts.d.ts +37 -0
- package/_vendor/canvas-core/editor/createEditorWithRuntimePlugins.d.ts +0 -6
- package/_vendor/canvas-core/editor/middleMousePanInteraction.d.ts +0 -2
- package/_vendor/canvas-core/schema/snapshotSupport.d.ts +0 -43
- package/_vendor/canvas-react/host/actionRegistry.d.ts +0 -15
- package/_vendor/canvas-react/host/canvasRenderPluginHost.d.ts +0 -2
- package/_vendor/canvas-react/host/canvasRenderPluginHostManifest.d.ts +0 -2
- package/_vendor/canvas-react/host/canvasRenderPluginHostRuntime.d.ts +0 -3
- package/_vendor/canvas-react/host/canvasRenderPluginHostTypes.d.ts +0 -104
- package/_vendor/canvas-react/host/canvasRenderPluginHostValidation.d.ts +0 -11
- package/_vendor/canvas-react/host/contextMenuRegistry.d.ts +0 -17
- package/_vendor/canvas-react/host/extension.d.ts +0 -37
- package/_vendor/canvas-react/host/toolbarRegistry.d.ts +0 -20
- package/_vendor/plugin-text/host/RichTextLinkPopover.d.ts +0 -14
- package/_vendor/plugin-text/host/RichTextToolbar.d.ts +0 -8
- package/_vendor/plugin-text/host/richTextBubbleMenuPositionSync.d.ts +0 -7
- package/browser/localSnapshotRestore.d.ts +0 -13
- package/builtins/extensions.d.ts +0 -18
- package/core/runtime/productDefinition.d.ts +0 -33
- package/core/runtime/productHost.d.ts +0 -20
- package/features/clipboard/clipboardHostExtension.d.ts +0 -2
- package/features/image/imageHostExtension.d.ts +0 -10
- package/features/keyboard/keyboardShortcutHostExtension.d.ts +0 -2
- package/features/persistence/CanvasKitPersistenceNotice.d.ts +0 -4
- package/features/persistence/persistenceHostExtension.d.ts +0 -2
- package/features/selection/selectionHostExtension.d.ts +0 -2
- package/features/tool/toolHostExtension.d.ts +0 -2
- package/features/view/viewHostExtension.d.ts +0 -2
- package/host/defaultHostExtensions.d.ts +0 -2
- package/product/canvasKitProduct.d.ts +0 -51
- package/react/useCanvasKitController.d.ts +0 -5
- package/react/useCanvasKitStartup.d.ts +0 -9
- package/runtime/canvasKitHostContracts.d.ts +0 -135
- package/runtime/canvasKitHostFeatureHooks.d.ts +0 -12
- package/runtime/canvasKitRuntimePlan.d.ts +0 -50
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { ShapeColor, ShapeRecordBase } from "../canvas-core/index";
|
|
2
|
+
export type Affine2d = readonly [
|
|
3
|
+
a: number,
|
|
4
|
+
b: number,
|
|
5
|
+
c: number,
|
|
6
|
+
d: number,
|
|
7
|
+
e: number,
|
|
8
|
+
f: number
|
|
9
|
+
];
|
|
10
|
+
export type PackagingUnit = "mm" | "cm" | "m" | "in" | "pt" | "px" | "unitless";
|
|
11
|
+
export type PackagingCoordinateSystem = "top-left-y-down";
|
|
12
|
+
export type PackagingSurfaceSide = "outside" | "inside";
|
|
13
|
+
export interface PackagingDocument {
|
|
14
|
+
schemaVersion: 1;
|
|
15
|
+
id: string;
|
|
16
|
+
revision: string;
|
|
17
|
+
name: string;
|
|
18
|
+
unit: PackagingUnit;
|
|
19
|
+
coordinateSystem: PackagingCoordinateSystem;
|
|
20
|
+
sheetBounds?: {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
w: number;
|
|
24
|
+
h: number;
|
|
25
|
+
};
|
|
26
|
+
points: PackagingPoint[];
|
|
27
|
+
edges: PackagingEdge[];
|
|
28
|
+
faces: PackagingFace[];
|
|
29
|
+
surfaces: PackagingSurfaces;
|
|
30
|
+
source?: {
|
|
31
|
+
provider?: string;
|
|
32
|
+
externalId?: string;
|
|
33
|
+
revision?: string;
|
|
34
|
+
};
|
|
35
|
+
meta?: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
export interface PackagingPoint {
|
|
38
|
+
id: string;
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
}
|
|
42
|
+
export interface PackagingCoordinate {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
}
|
|
46
|
+
export type PackagingEdgeOperation = "cut" | "crease" | "perforation" | "score" | "half-cut" | "kiss-cut" | "annotation" | "construction" | "custom";
|
|
47
|
+
export type PackagingEdgeGeometry = {
|
|
48
|
+
type: "line";
|
|
49
|
+
} | {
|
|
50
|
+
type: "quadratic";
|
|
51
|
+
control: {
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
};
|
|
55
|
+
} | {
|
|
56
|
+
type: "cubic";
|
|
57
|
+
control1: {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
};
|
|
61
|
+
control2: {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
};
|
|
65
|
+
} | {
|
|
66
|
+
type: "arc";
|
|
67
|
+
radiusX: number;
|
|
68
|
+
radiusY: number;
|
|
69
|
+
rotation: number;
|
|
70
|
+
largeArc: boolean;
|
|
71
|
+
sweep: boolean;
|
|
72
|
+
};
|
|
73
|
+
export interface PackagingEdge {
|
|
74
|
+
id: string;
|
|
75
|
+
fromPointId: string;
|
|
76
|
+
toPointId: string;
|
|
77
|
+
geometry: PackagingEdgeGeometry;
|
|
78
|
+
operation: PackagingEdgeOperation;
|
|
79
|
+
visible?: boolean;
|
|
80
|
+
meta?: Record<string, unknown>;
|
|
81
|
+
}
|
|
82
|
+
export interface PackagingDirectedEdgeRef {
|
|
83
|
+
edgeId: string;
|
|
84
|
+
direction: "forward" | "reverse";
|
|
85
|
+
}
|
|
86
|
+
export interface PackagingLoop {
|
|
87
|
+
edges: PackagingDirectedEdgeRef[];
|
|
88
|
+
}
|
|
89
|
+
export interface PackagingFace {
|
|
90
|
+
id: string;
|
|
91
|
+
name?: string;
|
|
92
|
+
role?: string;
|
|
93
|
+
outer: PackagingLoop;
|
|
94
|
+
holes?: PackagingLoop[];
|
|
95
|
+
artworkFrame?: {
|
|
96
|
+
uvToDocument: Affine2d;
|
|
97
|
+
};
|
|
98
|
+
meta?: Record<string, unknown>;
|
|
99
|
+
}
|
|
100
|
+
export interface PackagingPrepress {
|
|
101
|
+
bleedContours: PackagingBleedContour[];
|
|
102
|
+
safeZones: PackagingSafeZone[];
|
|
103
|
+
}
|
|
104
|
+
export interface PackagingSurface {
|
|
105
|
+
prepress?: PackagingPrepress;
|
|
106
|
+
meta?: Record<string, unknown>;
|
|
107
|
+
}
|
|
108
|
+
export interface PackagingSurfaces {
|
|
109
|
+
outside: PackagingSurface;
|
|
110
|
+
inside: PackagingSurface;
|
|
111
|
+
}
|
|
112
|
+
export interface PackagingBleedContour {
|
|
113
|
+
id: string;
|
|
114
|
+
name?: string;
|
|
115
|
+
cutEdgeIds: string[];
|
|
116
|
+
minimumBleed: number;
|
|
117
|
+
contour: PackagingClosedContour;
|
|
118
|
+
meta?: Record<string, unknown>;
|
|
119
|
+
}
|
|
120
|
+
export interface PackagingSafeZone {
|
|
121
|
+
id: string;
|
|
122
|
+
name?: string;
|
|
123
|
+
faceId: string;
|
|
124
|
+
minimumClearance: number;
|
|
125
|
+
contour: PackagingClosedContour;
|
|
126
|
+
meta?: Record<string, unknown>;
|
|
127
|
+
}
|
|
128
|
+
export interface PackagingClosedContour {
|
|
129
|
+
start: PackagingCoordinate;
|
|
130
|
+
segments: PackagingContourSegment[];
|
|
131
|
+
}
|
|
132
|
+
export type PackagingContourSegment = {
|
|
133
|
+
type: "line";
|
|
134
|
+
to: PackagingCoordinate;
|
|
135
|
+
} | {
|
|
136
|
+
type: "quadratic";
|
|
137
|
+
control: PackagingCoordinate;
|
|
138
|
+
to: PackagingCoordinate;
|
|
139
|
+
} | {
|
|
140
|
+
type: "cubic";
|
|
141
|
+
control1: PackagingCoordinate;
|
|
142
|
+
control2: PackagingCoordinate;
|
|
143
|
+
to: PackagingCoordinate;
|
|
144
|
+
} | {
|
|
145
|
+
type: "arc";
|
|
146
|
+
radiusX: number;
|
|
147
|
+
radiusY: number;
|
|
148
|
+
rotation: number;
|
|
149
|
+
largeArc: boolean;
|
|
150
|
+
sweep: boolean;
|
|
151
|
+
to: PackagingCoordinate;
|
|
152
|
+
};
|
|
153
|
+
export interface PackagingShapeProps {
|
|
154
|
+
document: PackagingDocument;
|
|
155
|
+
viewSide: PackagingSurfaceSide;
|
|
156
|
+
faceFill: ShapeColor;
|
|
157
|
+
faceFillOverrides: Record<string, ShapeColor>;
|
|
158
|
+
showBleed: boolean;
|
|
159
|
+
clipToBleed: boolean;
|
|
160
|
+
dielineOnTop: boolean;
|
|
161
|
+
showSafeZones: boolean;
|
|
162
|
+
showCanvasBoundsMarks: boolean;
|
|
163
|
+
}
|
|
164
|
+
export type PackagingShapeRecord = ShapeRecordBase<"packaging", PackagingShapeProps>;
|
|
165
|
+
export interface PackagingHoverState {
|
|
166
|
+
packagingShapeId: PackagingShapeRecord["id"];
|
|
167
|
+
faceId: string;
|
|
168
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PathDraftOverlay(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PathEditInsertPreviewOverlay(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ShapeColor, type ShapeEditingSession } from "../canvas-core/index";
|
|
2
|
+
import type { PathShapeRecord } from "./types";
|
|
3
|
+
interface PathShapeSvgProps {
|
|
4
|
+
shape: PathShapeRecord;
|
|
5
|
+
isHovered?: boolean;
|
|
6
|
+
shapeEditingSession?: ShapeEditingSession | null;
|
|
7
|
+
fill?: ShapeColor;
|
|
8
|
+
stroke?: ShapeColor;
|
|
9
|
+
strokeWidth?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function PathShapeSvg({ shape, isHovered, shapeEditingSession, fill, stroke, strokeWidth, }: PathShapeSvgProps): import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type CanvasProductContribution } from "../canvas-plugin-sdk/index";
|
|
2
|
+
import { type EditorPlugin, type ShapeSvgExporter, type SvgExportContext, type SvgNode } from "../canvas-core/index";
|
|
3
|
+
import { type PathShapeRecord } from "./types";
|
|
4
|
+
export declare const PATH_EDIT_TOOLBAR_ACTION_ID = "path.edit";
|
|
5
|
+
export declare const PATH_EDIT_SNAP_ACTION_ID = "path.edit.snap-nodes";
|
|
6
|
+
export declare const PATH_BOOLEAN_UNION_ACTION_ID = "path.boolean.union";
|
|
7
|
+
export declare const PATH_BOOLEAN_SUBTRACT_ACTION_ID = "path.boolean.subtract";
|
|
8
|
+
export declare const PATH_BOOLEAN_INTERSECT_ACTION_ID = "path.boolean.intersect";
|
|
9
|
+
export declare const PATH_BOOLEAN_XOR_ACTION_ID = "path.boolean.xor";
|
|
10
|
+
export declare const PATH_NODE_DELETE_ACTION_ID = "path.node.delete";
|
|
11
|
+
export declare const PATH_NODE_MAKE_CURVE_ACTION_ID = "path.node.make-curve";
|
|
12
|
+
export declare const PATH_NODE_REMOVE_HANDLES_ACTION_ID = "path.node.remove-handles";
|
|
13
|
+
export declare const PATH_NODE_MERGE_ACTION_ID = "path.node.merge";
|
|
14
|
+
export declare const PATH_NODE_JOIN_ACTION_ID = "path.node.join";
|
|
15
|
+
export declare const PATH_NODE_SEPARATE_ACTION_ID = "path.node.separate";
|
|
16
|
+
export declare class PathShapeSvgExporter implements ShapeSvgExporter<PathShapeRecord> {
|
|
17
|
+
readonly type: "path";
|
|
18
|
+
toSvg(shape: PathShapeRecord, context: SvgExportContext): SvgNode | null;
|
|
19
|
+
}
|
|
20
|
+
export declare function createPathEditorPlugin(): EditorPlugin;
|
|
21
|
+
export declare function createPathProductContribution(): CanvasProductContribution;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createPathCanvasRenderPlugin } from "./canvasRender";
|
|
2
|
+
export { PATH_BOOLEAN_INTERSECT_ACTION_ID, PATH_BOOLEAN_SUBTRACT_ACTION_ID, PATH_BOOLEAN_UNION_ACTION_ID, PATH_BOOLEAN_XOR_ACTION_ID, PATH_EDIT_TOOLBAR_ACTION_ID, PATH_EDIT_SNAP_ACTION_ID, PATH_NODE_DELETE_ACTION_ID, PATH_NODE_JOIN_ACTION_ID, PATH_NODE_MAKE_CURVE_ACTION_ID, PATH_NODE_MERGE_ACTION_ID, PATH_NODE_REMOVE_HANDLES_ACTION_ID, PATH_NODE_SEPARATE_ACTION_ID, PathShapeSvgExporter, createPathEditorPlugin, createPathProductContribution, } from "./editorRuntime";
|
|
3
|
+
export { Path } from "./feature";
|
|
4
|
+
export { PATH_CONTROL_HANDLE_TYPE, PATH_NODE_HANDLE_TYPE, createPathControlHandleId, createPathNodeHandleId, parsePathHandle, type PathControlHandleKind, type PathControlHandleInfo, type PathHandleInfo, type PathNodeHandleInfo, } from "./pathHandles";
|
|
5
|
+
export { PathShapeUtil } from "./pathShapeUtil";
|
|
6
|
+
export { PathTool } from "./pathTool";
|
|
7
|
+
export { PATH_FILL_RULES, PATH_NODE_KINDS, isPathFillRule, isPathNodeKind, isPathShapeRecord, type PathFillRule, type PathHandle, type PathNode, type PathNodeKind, type PathShapeProps, type PathShapeRecord, type PathSubpath, } from "./types";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type MultiPolygon } from "polygon-clipping";
|
|
2
|
+
import { Vec } from "../canvas-core/index";
|
|
3
|
+
import type { PathShapeProps, PathShapeRecord, PathSubpath } from "./types";
|
|
4
|
+
export type PathBooleanOperation = "union" | "subtract" | "intersect" | "xor";
|
|
5
|
+
export interface PathBooleanOperand {
|
|
6
|
+
shape: PathShapeRecord;
|
|
7
|
+
localToPage: {
|
|
8
|
+
applyToPoint(point: Vec): Vec;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare function getPathBooleanOperandPolygon(operand: PathBooleanOperand): MultiPolygon;
|
|
12
|
+
export declare function getPathBooleanResultPageSubpaths(operation: PathBooleanOperation, operands: readonly PathBooleanOperand[]): PathSubpath[];
|
|
13
|
+
export declare function getNormalizedPathBooleanResult(operation: PathBooleanOperation, operands: readonly PathBooleanOperand[], style: Pick<PathShapeProps, "fill" | "stroke" | "strokeWidth">): import("./pathGeometry").NormalizedPathShape | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PathShapeRecord, PathSubpath } from "./types";
|
|
2
|
+
export interface PathDraftMeta {
|
|
3
|
+
subpathId: string | null;
|
|
4
|
+
previewNodeId: string | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function getPathDraftMeta(shape: Pick<PathShapeRecord, "meta">): PathDraftMeta;
|
|
7
|
+
export declare function getPathDraftPreviewNodeId(shape: Pick<PathShapeRecord, "meta">): string | null;
|
|
8
|
+
export declare function setPathDraftMeta(meta: Record<string, unknown>, draft: PathDraftMeta): Record<string, unknown>;
|
|
9
|
+
export declare function clearPathDraftMeta(meta: Record<string, unknown>): Record<string, unknown>;
|
|
10
|
+
export declare function withoutPathDraftPreviewNode(subpaths: readonly PathSubpath[], previewNodeId: string | null): PathSubpath[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Vec, type Editor, type ShapeId } from "../canvas-core/index";
|
|
2
|
+
export interface PathEditInsertPreview {
|
|
3
|
+
shapeId: ShapeId;
|
|
4
|
+
subpathId: string;
|
|
5
|
+
startNodeId: string;
|
|
6
|
+
endNodeId: string;
|
|
7
|
+
t: number;
|
|
8
|
+
pagePoint: Vec;
|
|
9
|
+
}
|
|
10
|
+
export declare function getPathEditInsertPreview(editor: Editor): PathEditInsertPreview | null;
|
|
11
|
+
export declare function setPathEditInsertPreview(editor: Editor, preview: PathEditInsertPreview | null): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Editor, type ShapeId } from "../canvas-core/index";
|
|
2
|
+
import { type PathNodeRef } from "./pathGeometry";
|
|
3
|
+
import { type PathNode, type PathShapeRecord } from "./types";
|
|
4
|
+
export interface PathEditSelection {
|
|
5
|
+
shapeId: ShapeId;
|
|
6
|
+
nodes: PathNodeRef[];
|
|
7
|
+
primary: PathNodeRef;
|
|
8
|
+
}
|
|
9
|
+
export interface SelectedPathEditNodeEntry {
|
|
10
|
+
ref: PathNodeRef;
|
|
11
|
+
node: PathNode;
|
|
12
|
+
}
|
|
13
|
+
export interface SelectedPathEditNodes {
|
|
14
|
+
selection: PathEditSelection;
|
|
15
|
+
shape: PathShapeRecord;
|
|
16
|
+
entries: SelectedPathEditNodeEntry[];
|
|
17
|
+
}
|
|
18
|
+
export declare function getPathEditSelection(editor: Editor): PathEditSelection | null;
|
|
19
|
+
export declare function getSelectedPathEditNodes(editor: Editor): SelectedPathEditNodes | null;
|
|
20
|
+
export declare function clearPathEditSelection(editor: Editor): void;
|
|
21
|
+
export declare function setPathEditSelectionForNode(editor: Editor, shape: PathShapeRecord, subpathId: string, nodeId: string): void;
|
|
22
|
+
export declare function setPathEditSelectionForNodeEntries(editor: Editor, shape: PathShapeRecord, refs: readonly PathNodeRef[], primaryRef?: PathNodeRef | null): void;
|
|
23
|
+
export declare function togglePathEditSelectionForNode(editor: Editor, shape: PathShapeRecord, subpathId: string, nodeId: string): void;
|
|
24
|
+
export declare function isPathEditSelectionNodeSelected(selection: PathEditSelection, subpathId: string, nodeId: string): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Editor } from "../canvas-core/index";
|
|
2
|
+
export declare function isPathEditSnapEnabled(editor: Editor): boolean;
|
|
3
|
+
export declare function setPathEditSnapEnabled(editor: Editor, enabled: boolean): boolean;
|
|
4
|
+
export declare function togglePathEditSnap(editor: Editor): boolean;
|
|
5
|
+
export declare function resetPathEditSnap(editor: Editor): void;
|
|
6
|
+
export declare function setupPathEditLifecycle(editor: Editor): () => void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Box, Vec } from "../canvas-core/index";
|
|
2
|
+
import type { PathHandle, PathNode, PathShapeProps, PathShapeRecord, PathSubpath } from "./types";
|
|
3
|
+
export interface FlattenedPathSubpath {
|
|
4
|
+
id: string;
|
|
5
|
+
closed: boolean;
|
|
6
|
+
points: Vec[];
|
|
7
|
+
}
|
|
8
|
+
export interface PathSegmentHit {
|
|
9
|
+
subpathId: string;
|
|
10
|
+
startNodeId: string;
|
|
11
|
+
endNodeId: string;
|
|
12
|
+
t: number;
|
|
13
|
+
point: Vec;
|
|
14
|
+
distance: number;
|
|
15
|
+
}
|
|
16
|
+
export interface PathNodeRef {
|
|
17
|
+
subpathId: string;
|
|
18
|
+
nodeId: string;
|
|
19
|
+
}
|
|
20
|
+
export type PathNodeOperation = "merge" | "join" | "separate";
|
|
21
|
+
export interface PathNodeOperationResult {
|
|
22
|
+
subpaths: PathSubpath[];
|
|
23
|
+
selectedNodes: PathNodeRef[];
|
|
24
|
+
primaryNode: PathNodeRef | null;
|
|
25
|
+
}
|
|
26
|
+
export interface PathShapeGeometry {
|
|
27
|
+
path: string | null;
|
|
28
|
+
pointBounds: Box;
|
|
29
|
+
localBounds: Box;
|
|
30
|
+
renderBounds: Box;
|
|
31
|
+
outlineVertices: Vec[];
|
|
32
|
+
flattenedSubpaths: FlattenedPathSubpath[];
|
|
33
|
+
}
|
|
34
|
+
export interface NormalizedPathShape {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
subpaths: PathSubpath[];
|
|
38
|
+
geometry: PathShapeGeometry;
|
|
39
|
+
}
|
|
40
|
+
export declare function clonePathHandle(handle: PathHandle): PathHandle;
|
|
41
|
+
export declare function clonePathNode(node: PathNode): PathNode;
|
|
42
|
+
export declare function clonePathSubpath(subpath: PathSubpath): PathSubpath;
|
|
43
|
+
export declare function clonePathSubpaths(subpaths: readonly PathSubpath[]): PathSubpath[];
|
|
44
|
+
export declare function getNodePoint(node: PathNode): Vec;
|
|
45
|
+
export declare function getNodeInPoint(node: PathNode): Vec;
|
|
46
|
+
export declare function getNodeOutPoint(node: PathNode): Vec;
|
|
47
|
+
export declare function flattenPathSubpath(subpath: PathSubpath): FlattenedPathSubpath;
|
|
48
|
+
export declare function getPathShapeLocalGeometry(shape: Pick<PathShapeRecord, "props">): PathShapeGeometry;
|
|
49
|
+
export declare function translatePathSubpaths(subpaths: readonly PathSubpath[], dx: number, dy: number): PathSubpath[];
|
|
50
|
+
export declare function mapPathSubpaths(subpaths: readonly PathSubpath[], mapPoint: (point: Vec) => Vec): PathSubpath[];
|
|
51
|
+
export declare function normalizePathShapeFromPageSubpaths(pageSubpaths: readonly PathSubpath[], props: Pick<PathShapeProps, "strokeWidth" | "fill" | "stroke" | "fillRule">): NormalizedPathShape;
|
|
52
|
+
export declare function resizePathShapeToLocalBounds(shape: PathShapeRecord, targetBounds: Box): PathSubpath[];
|
|
53
|
+
export declare function getPathShapePageSubpaths(shape: PathShapeRecord, localToPage: {
|
|
54
|
+
applyToPoint(point: Vec): Vec;
|
|
55
|
+
}): PathSubpath[];
|
|
56
|
+
export declare function getPathShapePagePath(shape: PathShapeRecord, localToPage: {
|
|
57
|
+
applyToPoint(point: Vec): Vec;
|
|
58
|
+
}): string | null;
|
|
59
|
+
export declare function hitTestPathStroke(flattenedSubpaths: readonly FlattenedPathSubpath[], point: Vec, margin: number): boolean;
|
|
60
|
+
export declare function findPathSegmentAtLocalPoint(subpaths: readonly PathSubpath[], point: Vec, margin: number): PathSegmentHit | null;
|
|
61
|
+
export declare function hitTestPathFill(flattenedSubpaths: readonly FlattenedPathSubpath[], point: Vec, fillRule: "nonzero" | "evenodd"): boolean;
|
|
62
|
+
export declare function getPathSubpathById(subpaths: readonly PathSubpath[], subpathId: string): PathSubpath | null;
|
|
63
|
+
export declare function getPathNodeById(subpaths: readonly PathSubpath[], subpathId: string, nodeId: string): PathNode | null;
|
|
64
|
+
export declare function updatePathNode(subpaths: readonly PathSubpath[], subpathId: string, nodeId: string, update: (node: PathNode) => PathNode): PathSubpath[];
|
|
65
|
+
export declare function updatePathNodeEntries(subpaths: readonly PathSubpath[], entries: readonly PathNodeRef[], update: (node: PathNode) => PathNode): PathSubpath[];
|
|
66
|
+
export declare function setPathNodeCurveHandles(subpaths: readonly PathSubpath[], subpathId: string, nodeId: string): PathSubpath[];
|
|
67
|
+
export declare function removePathNodeHandles(subpaths: readonly PathSubpath[], subpathId: string, nodeId: string): PathSubpath[];
|
|
68
|
+
export declare function removePathNodeEntries(subpaths: readonly PathSubpath[], entries: readonly PathNodeRef[]): PathSubpath[];
|
|
69
|
+
export declare function canApplyPathNodeOperation(subpaths: readonly PathSubpath[], refs: readonly PathNodeRef[], operation: PathNodeOperation): boolean;
|
|
70
|
+
export declare function applyPathNodeOperation(subpaths: readonly PathSubpath[], refsInput: readonly PathNodeRef[], operation: PathNodeOperation, primaryRef?: PathNodeRef | null): PathNodeOperationResult | null;
|
|
71
|
+
export declare function insertPathNodeAfter(subpaths: readonly PathSubpath[], subpathId: string, afterNodeId: string, node: PathNode): PathSubpath[];
|
|
72
|
+
export declare function insertPathNodeAtSegment(subpaths: readonly PathSubpath[], hit: PathSegmentHit, nodeId: string): PathSubpath[];
|
|
73
|
+
export declare function arePathSubpathsEmpty(subpaths: readonly PathSubpath[]): boolean;
|
|
74
|
+
export declare function sanitizePathSubpaths(subpaths: readonly PathSubpath[]): PathSubpath[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const PATH_NODE_HANDLE_TYPE = "path.node";
|
|
2
|
+
export declare const PATH_CONTROL_HANDLE_TYPE = "path.control";
|
|
3
|
+
export type PathControlHandleKind = "in" | "out";
|
|
4
|
+
export interface PathNodeHandleInfo {
|
|
5
|
+
type: typeof PATH_NODE_HANDLE_TYPE;
|
|
6
|
+
subpathId: string;
|
|
7
|
+
nodeId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface PathControlHandleInfo {
|
|
10
|
+
type: typeof PATH_CONTROL_HANDLE_TYPE;
|
|
11
|
+
subpathId: string;
|
|
12
|
+
nodeId: string;
|
|
13
|
+
handle: PathControlHandleKind;
|
|
14
|
+
}
|
|
15
|
+
export type PathHandleInfo = PathNodeHandleInfo | PathControlHandleInfo;
|
|
16
|
+
export declare function createPathNodeHandleId(subpathId: string, nodeId: string): string;
|
|
17
|
+
export declare function createPathControlHandleId(subpathId: string, nodeId: string, handle: PathControlHandleKind): string;
|
|
18
|
+
export declare function parsePathHandle(type: string, id: string): PathHandleInfo | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Editor, type LandInteractionHandler, type SelectionHandleInteractionHandler } from "../canvas-core/index";
|
|
2
|
+
import { type PathNodeOperation, type PathNodeRef } from "./pathGeometry";
|
|
3
|
+
import { type PathShapeRecord } from "./types";
|
|
4
|
+
export declare function deletePathEditNodes(editor: Editor, shape: PathShapeRecord, entries: readonly PathNodeRef[]): void;
|
|
5
|
+
export declare function runSelectedPathNodeOperation(editor: Editor, operation: PathNodeOperation): boolean;
|
|
6
|
+
export declare function createPathSelectionHandleInteractionHandler(): SelectionHandleInteractionHandler;
|
|
7
|
+
export declare function createPathInteractionHandler(): LandInteractionHandler;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Box, ShapeUtil, Vec, type ShapeBrushSelectInput, type ShapeBrushWrapInput, type ShapeHandleSnapGeometry, type ShapeLineSegmentHitTestInput, type ShapePointHitTestInput, type ShapeSelectionHandleAnchorInput, type ShapeSelectionHandleAnchors, type ShapeSelectionFrameInput, type ShapeSelectionOverlayInfo, type ShapeSelectionOverlayInfoInput, type ShapeSelectionResizeInput, type ShapeUpdate } from "../canvas-core/index";
|
|
2
|
+
import { type PathShapeProps, type PathShapeRecord } from "./types";
|
|
3
|
+
export declare class PathShapeUtil extends ShapeUtil<PathShapeRecord> {
|
|
4
|
+
readonly type: "path";
|
|
5
|
+
getDefaultProps(): PathShapeProps;
|
|
6
|
+
validateProps(props: unknown): PathShapeProps;
|
|
7
|
+
getPositionedBounds(shape: PathShapeRecord): Box;
|
|
8
|
+
getLocalBounds(shape: PathShapeRecord): Box;
|
|
9
|
+
getRenderBounds(shape: PathShapeRecord): Box;
|
|
10
|
+
getExportBounds(shape: PathShapeRecord): Box;
|
|
11
|
+
getSelectionResizeLocalBounds(shape: PathShapeRecord): Box;
|
|
12
|
+
resizeSelectionBounds(shape: PathShapeRecord, input: ShapeSelectionResizeInput): ShapeUpdate;
|
|
13
|
+
getPositionedOutlineVertices(shape: PathShapeRecord): Vec[];
|
|
14
|
+
getHandleSnapGeometry(shape: PathShapeRecord): ShapeHandleSnapGeometry;
|
|
15
|
+
canReceiveTerminalBinding(_shape: PathShapeRecord): boolean;
|
|
16
|
+
canEdit(_shape: PathShapeRecord): boolean;
|
|
17
|
+
canUseSelectionResizeHandles(shape: PathShapeRecord, input: ShapeSelectionFrameInput): boolean;
|
|
18
|
+
canUseSelectionRotateHandle(shape: PathShapeRecord, input: ShapeSelectionFrameInput): boolean;
|
|
19
|
+
getSelectionHandleAnchors(shape: PathShapeRecord, input: ShapeSelectionHandleAnchorInput): ShapeSelectionHandleAnchors;
|
|
20
|
+
getSelectionOverlayInfo(shape: PathShapeRecord, input: ShapeSelectionOverlayInfoInput): ShapeSelectionOverlayInfo;
|
|
21
|
+
hitTest(shape: PathShapeRecord, positionedPoint: Vec, _input?: ShapePointHitTestInput): boolean;
|
|
22
|
+
hitTestLineSegment(shape: PathShapeRecord, input: ShapeLineSegmentHitTestInput): boolean;
|
|
23
|
+
isWrappedByBrush(shape: PathShapeRecord, input: ShapeBrushWrapInput): boolean;
|
|
24
|
+
canSelectByBrush(shape: PathShapeRecord, input: ShapeBrushSelectInput): boolean;
|
|
25
|
+
onEditEnd(shape: PathShapeRecord): {
|
|
26
|
+
deleteShapeIds: `shape:${string}`[];
|
|
27
|
+
} | undefined;
|
|
28
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { StateNode, Vec, type Editor, type ShapeId } from "../canvas-core/index";
|
|
2
|
+
import { type PathNode } from "./types";
|
|
3
|
+
interface PathDraft {
|
|
4
|
+
shapeId: ShapeId;
|
|
5
|
+
subpathId: string;
|
|
6
|
+
lastNodeId: string;
|
|
7
|
+
createdShape: boolean;
|
|
8
|
+
previewNodeId: string | null;
|
|
9
|
+
}
|
|
10
|
+
interface DraggingPathNodeInfo {
|
|
11
|
+
shapeId: ShapeId;
|
|
12
|
+
subpathId: string;
|
|
13
|
+
nodeId: string;
|
|
14
|
+
originPagePoint: Vec;
|
|
15
|
+
startNode: PathNode;
|
|
16
|
+
finishOnPointerUp: boolean;
|
|
17
|
+
}
|
|
18
|
+
interface PathPointerModifiers {
|
|
19
|
+
altKey: boolean;
|
|
20
|
+
shiftKey: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare class PathTool extends StateNode {
|
|
23
|
+
draft: PathDraft | null;
|
|
24
|
+
constructor(editor: Editor);
|
|
25
|
+
protected onEnter(): void;
|
|
26
|
+
protected onExit(): void;
|
|
27
|
+
isInInitialState(): boolean;
|
|
28
|
+
startOrExtend(point: Vec, modifiers: PathPointerModifiers): DraggingPathNodeInfo | null;
|
|
29
|
+
updateNodeDrag(info: DraggingPathNodeInfo, point: Vec, modifiers: PathPointerModifiers): void;
|
|
30
|
+
updatePreview(point: Vec, modifiers: Pick<PathPointerModifiers, "shiftKey">): void;
|
|
31
|
+
private canFinishDraft;
|
|
32
|
+
finishDraft(options?: {
|
|
33
|
+
switchToSelect?: boolean;
|
|
34
|
+
}): void;
|
|
35
|
+
finishDraftAndEdit(): void;
|
|
36
|
+
cancelDraft(): void;
|
|
37
|
+
hasDraft(): boolean;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type BaseRecord, type ShapeColor, type ShapeRecordBase } from "../canvas-core/index";
|
|
2
|
+
export declare const PATH_FILL_RULES: readonly ["nonzero", "evenodd"];
|
|
3
|
+
export declare const PATH_NODE_KINDS: readonly ["corner", "smooth", "symmetric"];
|
|
4
|
+
export type PathFillRule = (typeof PATH_FILL_RULES)[number];
|
|
5
|
+
export type PathNodeKind = (typeof PATH_NODE_KINDS)[number];
|
|
6
|
+
export interface PathHandle {
|
|
7
|
+
dx: number;
|
|
8
|
+
dy: number;
|
|
9
|
+
}
|
|
10
|
+
export interface PathNode {
|
|
11
|
+
id: string;
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
in?: PathHandle | null;
|
|
15
|
+
out?: PathHandle | null;
|
|
16
|
+
kind: PathNodeKind;
|
|
17
|
+
}
|
|
18
|
+
export interface PathSubpath {
|
|
19
|
+
id: string;
|
|
20
|
+
closed: boolean;
|
|
21
|
+
nodes: PathNode[];
|
|
22
|
+
}
|
|
23
|
+
export interface PathShapeProps {
|
|
24
|
+
subpaths: PathSubpath[];
|
|
25
|
+
fill: ShapeColor;
|
|
26
|
+
stroke: ShapeColor;
|
|
27
|
+
strokeWidth: number;
|
|
28
|
+
fillRule: PathFillRule;
|
|
29
|
+
}
|
|
30
|
+
export interface PathShapeRecord extends ShapeRecordBase<"path", PathShapeProps> {
|
|
31
|
+
type: "path";
|
|
32
|
+
props: PathShapeProps;
|
|
33
|
+
}
|
|
34
|
+
export declare function isPathShapeRecord(record: BaseRecord | null | undefined): record is PathShapeRecord;
|
|
35
|
+
export declare function isPathFillRule(value: unknown): value is PathFillRule;
|
|
36
|
+
export declare function isPathNodeKind(value: unknown): value is PathNodeKind;
|
|
@@ -15,7 +15,11 @@ export declare class ArrowLabelBindingUtil extends BindingUtil<ArrowLabelBinding
|
|
|
15
15
|
readonly type = "arrow-label";
|
|
16
16
|
getDefaultProps(): ArrowLabelBindingProps;
|
|
17
17
|
validateProps(props: unknown): ArrowLabelBindingProps;
|
|
18
|
-
canBind(_editor: Editor,
|
|
18
|
+
canBind(_editor: Editor, binding: ArrowLabelBindingRecord, context: {
|
|
19
|
+
fromShape: ShapeRecord;
|
|
20
|
+
toShape: ShapeRecord;
|
|
21
|
+
}): boolean;
|
|
22
|
+
canUseShapeHierarchy(_binding: ArrowLabelBindingRecord, context: {
|
|
19
23
|
fromShape: ShapeRecord;
|
|
20
24
|
toShape: ShapeRecord;
|
|
21
25
|
}): boolean;
|
|
@@ -34,6 +38,7 @@ export declare class ArrowLabelBindingUtil extends BindingUtil<ArrowLabelBinding
|
|
|
34
38
|
}): BindingUtilEffect | void;
|
|
35
39
|
onBeforeDeleteBinding(_editor: Editor, binding: ArrowLabelBindingRecord): BindingUtilEffect | void;
|
|
36
40
|
getExportShapeIds(_editor: Editor, binding: ArrowLabelBindingRecord): TextShapeRecord["id"][];
|
|
41
|
+
getShapeHierarchyRootId(binding: ArrowLabelBindingRecord, shapeId: ShapeRecord["id"]): ShapeRecord["id"] | null;
|
|
37
42
|
getSelectionCompanionFrameGeometries(editor: Editor, binding: ArrowLabelBindingRecord, context: BindingSelectionCompanionFrameContext): SelectionOverlayFrameGeometryState[];
|
|
38
43
|
private syncLabelPosition;
|
|
39
44
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type TextFontCatalog } from "./textFonts";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import type { TextTiptapEditorChangeHandler } from "./textFormatting";
|
|
3
|
+
import { type CanvasRenderPlugin } from "../canvas-react/host/index";
|
|
4
|
+
export declare function createTextCanvasRenderPlugin({ fontCatalog, formattingToolbar, onTiptapEditorChange, }?: {
|
|
4
5
|
fontCatalog?: TextFontCatalog;
|
|
5
|
-
|
|
6
|
+
formattingToolbar?: boolean;
|
|
7
|
+
onTiptapEditorChange?: TextTiptapEditorChangeHandler;
|
|
8
|
+
}): CanvasRenderPlugin;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type CanvasProductContribution } from "../canvas-plugin-sdk/index";
|
|
2
|
+
import { type EditorPlugin } from "../canvas-core/index";
|
|
2
3
|
import { type TextFontCatalog } from "./textFonts";
|
|
3
|
-
export declare function
|
|
4
|
+
export declare function createTextEditorPlugin({ fontCatalog, selectionFormattingToolbar, }?: {
|
|
4
5
|
fontCatalog?: TextFontCatalog;
|
|
5
|
-
|
|
6
|
+
selectionFormattingToolbar?: boolean;
|
|
7
|
+
}): EditorPlugin;
|
|
8
|
+
export declare function createTextProductContribution({ fontCatalog, selectionFormattingToolbar, }?: {
|
|
9
|
+
fontCatalog?: TextFontCatalog;
|
|
10
|
+
selectionFormattingToolbar?: boolean;
|
|
11
|
+
}): CanvasProductContribution;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
3
|
-
export declare function
|
|
4
|
-
export declare const Text: import("../canvas-
|
|
1
|
+
import { type CanvasPlugin } from "../canvas-plugin-sdk/index";
|
|
2
|
+
import { type TextPluginOptions } from "./textFonts";
|
|
3
|
+
export declare function createTextPlugin(options?: Readonly<Partial<TextPluginOptions>>): CanvasPlugin;
|
|
4
|
+
export declare const Text: CanvasPlugin<import("../canvas-plugin-sdk/index").CanvasProductFactory>;
|
|
@@ -19,7 +19,11 @@ export declare class GeoLabelBindingUtil extends BindingUtil<GeoLabelBindingReco
|
|
|
19
19
|
readonly type = "geo-label";
|
|
20
20
|
getDefaultProps(): GeoLabelBindingProps;
|
|
21
21
|
validateProps(props: unknown): GeoLabelBindingProps;
|
|
22
|
-
canBind(_editor: Editor,
|
|
22
|
+
canBind(_editor: Editor, binding: GeoLabelBindingRecord, context: {
|
|
23
|
+
fromShape: ShapeRecord;
|
|
24
|
+
toShape: ShapeRecord;
|
|
25
|
+
}): boolean;
|
|
26
|
+
canUseShapeHierarchy(_binding: GeoLabelBindingRecord, context: {
|
|
23
27
|
fromShape: ShapeRecord;
|
|
24
28
|
toShape: ShapeRecord;
|
|
25
29
|
}): boolean;
|
|
@@ -38,6 +42,7 @@ export declare class GeoLabelBindingUtil extends BindingUtil<GeoLabelBindingReco
|
|
|
38
42
|
}): BindingUtilEffect | void;
|
|
39
43
|
onBeforeDeleteBinding(editor: Editor, binding: GeoLabelBindingRecord): BindingUtilEffect | void;
|
|
40
44
|
getExportShapeIds(_editor: Editor, binding: GeoLabelBindingRecord): TextShapeRecord["id"][];
|
|
45
|
+
getShapeHierarchyRootId(binding: GeoLabelBindingRecord, shapeId: ShapeRecord["id"]): ShapeRecord["id"] | null;
|
|
41
46
|
private syncLabelPosition;
|
|
42
47
|
}
|
|
43
48
|
export declare function getGeoLabelLayout(editor: Editor, label: TextShapeRecord, owner: ShapeRecord): Pick<TextShapeRecord, "x" | "y" | "rotation"> & {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { TextShapeRecord } from "../textTypes";
|
|
2
2
|
import type { TextFontCatalog } from "../textFonts";
|
|
3
|
-
|
|
3
|
+
import type { TextTiptapEditorChangeHandler } from "../textFormatting";
|
|
4
|
+
export declare function ShapeEditingSessionBox({ shapeId, markId, fontCatalog, formattingToolbar, onTiptapEditorChange, }: {
|
|
4
5
|
shapeId: TextShapeRecord["id"];
|
|
5
6
|
markId: string;
|
|
6
7
|
fontCatalog: TextFontCatalog;
|
|
8
|
+
formattingToolbar?: boolean;
|
|
9
|
+
onTiptapEditorChange?: TextTiptapEditorChangeHandler;
|
|
7
10
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -3,8 +3,9 @@ import { type Editor as TiptapEditor } from "@tiptap/react";
|
|
|
3
3
|
import type { Editor as LandEditor } from "../../canvas-core/index";
|
|
4
4
|
import type { RichTextDocument, TextShapeRecord } from "../textTypes";
|
|
5
5
|
import type { TextFontCatalog } from "../textFonts";
|
|
6
|
+
import type { TextTiptapEditorChangeHandler, TextTiptapEditorHandle } from "../textFormatting";
|
|
6
7
|
import { type TiptapTextEditorController } from "./tiptapTextEditorController";
|
|
7
|
-
export interface TiptapTextEditorHandle {
|
|
8
|
+
export interface TiptapTextEditorHandle extends TextTiptapEditorHandle {
|
|
8
9
|
readonly editor: TiptapEditor;
|
|
9
10
|
readonly controller: TiptapTextEditorController;
|
|
10
11
|
}
|
|
@@ -15,6 +16,8 @@ export interface TiptapTextEditorProps {
|
|
|
15
16
|
initialRichText: RichTextDocument;
|
|
16
17
|
className: string;
|
|
17
18
|
editorStyle: CSSProperties;
|
|
19
|
+
formattingToolbar?: boolean;
|
|
20
|
+
onTiptapEditorChange?: TextTiptapEditorChangeHandler;
|
|
18
21
|
onReady(handle: TiptapTextEditorHandle): void;
|
|
19
22
|
onDispose(handle: TiptapTextEditorHandle): void;
|
|
20
23
|
onRichTextChange(input: {
|
|
@@ -23,4 +26,4 @@ export interface TiptapTextEditorProps {
|
|
|
23
26
|
richText: RichTextDocument;
|
|
24
27
|
}): void;
|
|
25
28
|
}
|
|
26
|
-
export declare function TiptapTextEditor({ landEditor, shape, fontCatalog, initialRichText, className, editorStyle, onReady, onDispose, onRichTextChange, }: TiptapTextEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare function TiptapTextEditor({ landEditor, shape, fontCatalog, initialRichText, className, editorStyle, formattingToolbar, onTiptapEditorChange, onReady, onDispose, onRichTextChange, }: TiptapTextEditorProps): import("react/jsx-runtime").JSX.Element;
|