@yuzhouu/canvas-kit 0.1.3 → 0.1.4
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 +80 -78
- package/_vendor/canvas-core/bindings/{BindingUtil.d.ts → bindingUtil.d.ts} +1 -1
- package/_vendor/canvas-core/bindings/{BindingUtilRegistry.d.ts → bindingUtilRegistry.d.ts} +1 -1
- package/_vendor/canvas-core/bindings/terminalBinding.d.ts +28 -0
- package/_vendor/canvas-core/editor/clipboard.d.ts +2 -2
- package/_vendor/canvas-core/editor/commands.d.ts +6 -1
- package/_vendor/canvas-core/editor/createEditorWithPlugins.d.ts +6 -0
- package/_vendor/canvas-core/editor/edgeScroll.d.ts +1 -1
- package/_vendor/canvas-core/editor/{Editor.d.ts → editor.d.ts} +46 -51
- package/_vendor/canvas-core/editor/editorComputedHelpers.d.ts +5 -5
- package/_vendor/canvas-core/editor/editorSelectionTransforms.d.ts +2 -2
- package/_vendor/canvas-core/editor/events.d.ts +1 -1
- package/_vendor/canvas-core/editor/{HistoryManager.d.ts → historyManager.d.ts} +1 -1
- package/_vendor/canvas-core/editor/index.d.ts +10 -7
- package/_vendor/canvas-core/editor/interactions.d.ts +2 -2
- package/_vendor/canvas-core/editor/internal.d.ts +1 -1
- package/_vendor/canvas-core/editor/managers/{BindingManager.d.ts → bindingManager.d.ts} +1 -1
- package/_vendor/canvas-core/editor/managers/{CameraManager.d.ts → cameraManager.d.ts} +2 -2
- package/_vendor/canvas-core/editor/managers/{ClipboardManager.d.ts → clipboardManager.d.ts} +1 -1
- package/_vendor/canvas-core/editor/managers/{DocumentSnapshotManager.d.ts → documentSnapshotManager.d.ts} +1 -1
- package/_vendor/canvas-core/editor/managers/{InputsManager.d.ts → inputsManager.d.ts} +1 -1
- package/_vendor/canvas-core/editor/managers/{InteractionTransientManager.d.ts → interactionTransientManager.d.ts} +13 -10
- package/_vendor/canvas-core/editor/managers/{QueryManager.d.ts → queryManager.d.ts} +7 -6
- package/_vendor/canvas-core/editor/managers/{RenderWindowManager.d.ts → renderWindowManager.d.ts} +1 -1
- package/_vendor/canvas-core/editor/managers/selectionGeometry.d.ts +5 -5
- package/_vendor/canvas-core/editor/managers/{SelectionLayoutManager.d.ts → selectionLayoutManager.d.ts} +2 -2
- package/_vendor/canvas-core/editor/managers/{SelectionManager.d.ts → selectionManager.d.ts} +1 -1
- package/_vendor/canvas-core/editor/managers/{SelectionOverlayManager.d.ts → selectionOverlayManager.d.ts} +4 -3
- package/_vendor/canvas-core/editor/managers/{ShapeEditingManager.d.ts → shapeEditingManager.d.ts} +1 -1
- package/_vendor/canvas-core/editor/managers/{ShapeGeometryManager.d.ts → shapeGeometryManager.d.ts} +5 -5
- package/_vendor/canvas-core/editor/managers/{ShapeHierarchyManager.d.ts → shapeHierarchyManager.d.ts} +3 -6
- package/_vendor/canvas-core/editor/managers/shapeOrder.d.ts +1 -1
- package/_vendor/canvas-core/editor/managers/shapeReparenting.d.ts +1 -1
- package/_vendor/canvas-core/editor/managers/shortcutManager.d.ts +56 -0
- package/_vendor/canvas-core/editor/managers/snapCalculations.d.ts +2 -2
- package/_vendor/canvas-core/editor/managers/snapGeometry.d.ts +2 -2
- package/_vendor/canvas-core/editor/managers/snapIndicators.d.ts +2 -2
- package/_vendor/canvas-core/editor/managers/{SnapManager.d.ts → snapManager.d.ts} +1 -1
- package/_vendor/canvas-core/editor/managers/{SnapSnapshotBuilder.d.ts → snapSnapshotBuilder.d.ts} +1 -1
- package/_vendor/canvas-core/editor/managers/snapTypes.d.ts +2 -2
- package/_vendor/canvas-core/editor/managers/{SpatialIndexManager.d.ts → spatialIndexManager.d.ts} +4 -4
- package/_vendor/canvas-core/editor/managers/{ToolManager.d.ts → toolManager.d.ts} +4 -5
- package/_vendor/canvas-core/editor/queries/shapeTransforms.d.ts +4 -4
- package/_vendor/canvas-core/editor/renderWindow.d.ts +1 -1
- package/_vendor/canvas-core/editor/resizeGeometry.d.ts +2 -2
- package/_vendor/canvas-core/editor/selection.d.ts +26 -19
- package/_vendor/canvas-core/editor/selectionHandleInteractions.d.ts +1 -1
- package/_vendor/canvas-core/editor/selectionOverlay.d.ts +7 -5
- package/_vendor/canvas-core/editor/{StateNode.d.ts → stateNode.d.ts} +1 -1
- package/_vendor/canvas-core/exports/integrity.d.ts +1 -1
- package/_vendor/canvas-core/exports/svg.d.ts +6 -2
- package/_vendor/canvas-core/geometry/{Box.d.ts → box.d.ts} +1 -1
- package/_vendor/canvas-core/geometry/{Ellipse2d.d.ts → ellipse2d.d.ts} +3 -3
- package/_vendor/canvas-core/geometry/{Geometry2d.d.ts → geometry2d.d.ts} +2 -2
- package/_vendor/canvas-core/geometry/index.d.ts +7 -7
- package/_vendor/canvas-core/geometry/{Mat.d.ts → mat.d.ts} +1 -1
- package/_vendor/canvas-core/geometry/{Polyline2d.d.ts → polyline2d.d.ts} +3 -3
- package/_vendor/canvas-core/geometry/{Rectangle2d.d.ts → rectangle2d.d.ts} +3 -3
- package/_vendor/canvas-core/geometry/segments.d.ts +1 -1
- package/_vendor/canvas-core/index.d.ts +33 -31
- package/_vendor/canvas-core/plugins/{types.d.ts → editorPlugin.d.ts} +10 -9
- package/_vendor/canvas-core/plugins/index.d.ts +1 -1
- package/_vendor/canvas-core/schema/snapshotSupport.d.ts +43 -0
- package/_vendor/canvas-core/schema/snapshots.d.ts +6 -2
- package/_vendor/canvas-core/shapes/capabilities.d.ts +1 -1
- package/_vendor/canvas-core/shapes/colors.d.ts +26 -0
- package/_vendor/canvas-core/shapes/{ShapeUtil.d.ts → shapeUtil.d.ts} +22 -9
- package/_vendor/canvas-core/shapes/{ShapeUtilRegistry.d.ts → shapeUtilRegistry.d.ts} +1 -1
- package/_vendor/canvas-core/surfaces/actions.d.ts +35 -0
- package/_vendor/canvas-core/{contextMenu.d.ts → surfaces/contextMenu.d.ts} +11 -9
- package/_vendor/canvas-core/{toolbar.d.ts → surfaces/toolbar.d.ts} +17 -38
- package/_vendor/canvas-core/tools/hand/handTool.d.ts +5 -0
- package/_vendor/canvas-core/tools/index.d.ts +2 -2
- package/_vendor/canvas-core/tools/select/selectContainment.d.ts +5 -4
- package/_vendor/canvas-core/tools/select/selectTool.d.ts +5 -0
- package/_vendor/canvas-core/tools/select/selectToolHelpers.d.ts +3 -3
- package/_vendor/canvas-core/tools/select/states/{BrushingState.d.ts → brushingState.d.ts} +3 -3
- package/_vendor/canvas-core/tools/select/states/{DraggingSelectionHandleInteractionState.d.ts → draggingSelectionHandleInteractionState.d.ts} +3 -3
- package/_vendor/canvas-core/tools/select/states/{IdleState.d.ts → idleState.d.ts} +2 -2
- package/_vendor/canvas-core/tools/select/states/index.d.ts +11 -11
- package/_vendor/canvas-core/tools/select/states/{PointingCanvasState.d.ts → pointingCanvasState.d.ts} +3 -3
- package/_vendor/canvas-core/tools/select/states/{PointingResizeHandleState.d.ts → pointingResizeHandleState.d.ts} +3 -3
- package/_vendor/canvas-core/tools/select/states/{PointingRotateHandleState.d.ts → pointingRotateHandleState.d.ts} +3 -3
- package/_vendor/canvas-core/tools/select/states/{PointingSelectionHandleInteractionState.d.ts → pointingSelectionHandleInteractionState.d.ts} +3 -3
- package/_vendor/canvas-core/tools/select/states/{PointingShapeState.d.ts → pointingShapeState.d.ts} +3 -3
- package/_vendor/canvas-core/tools/select/states/{ResizingState.d.ts → resizingState.d.ts} +3 -3
- package/_vendor/canvas-core/tools/select/states/{RotatingState.d.ts → rotatingState.d.ts} +3 -3
- package/_vendor/canvas-core/tools/select/states/{SelectStateNode.d.ts → selectStateNode.d.ts} +2 -2
- package/_vendor/canvas-core/tools/select/states/{TranslatingState.d.ts → translatingState.d.ts} +5 -4
- package/_vendor/canvas-react/components/CanvasView.d.ts +7 -4
- package/_vendor/canvas-react/components/PageSpace.d.ts +1 -1
- package/_vendor/canvas-react/components/ShapeLayer.d.ts +4 -1
- package/_vendor/canvas-react/components/index.d.ts +0 -2
- package/_vendor/canvas-react/components/overlays/BindingGuide.d.ts +24 -0
- package/_vendor/canvas-react/components/overlays/BindingPreviewOverlay.d.ts +1 -0
- package/_vendor/canvas-react/components/overlays/BrushBoxOverlay.d.ts +1 -0
- package/_vendor/canvas-react/components/overlays/OverlaySvgRoot.d.ts +1 -0
- package/_vendor/canvas-react/components/overlays/SelectionFrameOverlay.d.ts +1 -0
- package/_vendor/canvas-react/components/overlays/SelectionHandlesOverlay.d.ts +1 -0
- package/_vendor/canvas-react/components/overlays/SelectionOverlaySvg.d.ts +1 -0
- package/_vendor/canvas-react/components/overlays/SelectionPathOverlay.d.ts +1 -0
- package/_vendor/canvas-react/components/overlays/ShapeOutlineOverlay.d.ts +8 -0
- package/_vendor/canvas-react/components/overlays/SnapIndicatorsOverlay.d.ts +1 -0
- package/_vendor/canvas-react/components/useCanvasDomEvents.d.ts +21 -0
- package/_vendor/canvas-react/dom.d.ts +10 -0
- package/_vendor/canvas-react/host/canvasOverlayRegistryContext.d.ts +3 -0
- package/_vendor/{canvas-plugin-api/index.d.ts → canvas-react/host/canvasPlugin.d.ts} +24 -8
- package/_vendor/canvas-react/host/contextMenuRegistry.d.ts +3 -3
- package/_vendor/canvas-react/host/domEventGuards.d.ts +1 -1
- package/_vendor/{canvas-plugin-api/feature.d.ts → canvas-react/host/extension.d.ts} +3 -3
- package/_vendor/canvas-react/host/index.d.ts +8 -3
- package/_vendor/canvas-react/host/overlayRegistry.d.ts +18 -0
- package/_vendor/canvas-react/host/pluginHost.d.ts +2 -93
- package/_vendor/canvas-react/host/pluginHostManifest.d.ts +2 -0
- package/_vendor/canvas-react/host/pluginHostRuntime.d.ts +3 -0
- package/_vendor/canvas-react/host/pluginHostTypes.d.ts +102 -0
- package/_vendor/canvas-react/host/pluginHostValidation.d.ts +11 -0
- package/_vendor/canvas-react/host/rendererRegistry.d.ts +1 -1
- package/_vendor/canvas-react/host/toolbarRegistry.d.ts +7 -7
- package/_vendor/canvas-react/index.d.ts +2 -1
- package/_vendor/plugin-arrow/arrowBindingAnchors.d.ts +5 -0
- package/_vendor/plugin-arrow/arrowBindingGeometry.d.ts +28 -0
- package/_vendor/plugin-arrow/arrowGeometry.d.ts +24 -0
- package/_vendor/plugin-arrow/{ArrowShapeUtil.d.ts → arrowShapeUtil.d.ts} +5 -4
- package/_vendor/plugin-arrow/arrowTerminalBindingResolver.d.ts +5 -6
- package/_vendor/plugin-arrow/arrowTerminalCommands.d.ts +4 -4
- package/_vendor/plugin-arrow/canvas.d.ts +1 -1
- package/_vendor/plugin-arrow/{core.d.ts → editor.d.ts} +2 -2
- package/_vendor/plugin-arrow/feature.d.ts +2 -2
- package/_vendor/plugin-arrow/index.d.ts +6 -5
- package/_vendor/plugin-arrow/types.d.ts +2 -2
- package/_vendor/plugin-draw/DrawShapeRenderer.d.ts +4 -2
- package/_vendor/plugin-draw/canvas.d.ts +1 -1
- package/_vendor/plugin-draw/drawHitTest.d.ts +2 -2
- package/_vendor/plugin-draw/editor.d.ts +7 -0
- package/_vendor/plugin-draw/feature.d.ts +2 -2
- package/_vendor/plugin-draw/index.d.ts +3 -3
- package/_vendor/plugin-draw/types.d.ts +3 -3
- package/_vendor/plugin-eraser/canvas.d.ts +1 -1
- package/_vendor/plugin-eraser/editor.d.ts +2 -0
- package/_vendor/plugin-eraser/feature.d.ts +2 -2
- package/_vendor/plugin-eraser/index.d.ts +2 -2
- package/_vendor/plugin-frame/canvas.d.ts +4 -3
- package/_vendor/plugin-frame/editor.d.ts +7 -0
- package/_vendor/plugin-frame/feature.d.ts +2 -2
- package/_vendor/plugin-frame/{FrameShapeUtil.d.ts → frameShapeUtil.d.ts} +4 -3
- package/_vendor/plugin-frame/{FrameTool.d.ts → frameTool.d.ts} +1 -1
- package/_vendor/plugin-frame/index.d.ts +4 -4
- package/_vendor/plugin-geo/canvas.d.ts +6 -4
- package/_vendor/plugin-geo/editor.d.ts +7 -0
- package/_vendor/plugin-geo/feature.d.ts +2 -2
- package/_vendor/plugin-geo/geoGeometry.d.ts +8 -0
- package/_vendor/plugin-geo/{GeoTools.d.ts → geoTools.d.ts} +9 -0
- package/_vendor/plugin-geo/index.d.ts +4 -4
- package/_vendor/plugin-geo/types.d.ts +6 -4
- package/_vendor/plugin-group/canvas.d.ts +5 -5
- package/_vendor/plugin-group/editor.d.ts +7 -0
- package/_vendor/plugin-group/feature.d.ts +2 -2
- package/_vendor/plugin-group/index.d.ts +3 -3
- package/_vendor/plugin-image/canvas.d.ts +1 -1
- package/_vendor/plugin-image/{core.d.ts → editor.d.ts} +3 -3
- package/_vendor/plugin-image/feature.d.ts +2 -2
- package/_vendor/plugin-image/{ImageShapeUtil.d.ts → imageShapeUtil.d.ts} +2 -1
- package/_vendor/plugin-image/index.d.ts +2 -2
- package/_vendor/plugin-laser/canvas.d.ts +1 -1
- package/_vendor/plugin-laser/editor.d.ts +2 -0
- package/_vendor/plugin-laser/feature.d.ts +2 -2
- package/_vendor/plugin-laser/index.d.ts +2 -2
- package/_vendor/plugin-text/canvas.d.ts +1 -1
- package/_vendor/plugin-text/editor.d.ts +2 -0
- package/_vendor/plugin-text/feature.d.ts +2 -2
- package/_vendor/plugin-text/host/RichTextToolbar.d.ts +3 -1
- package/_vendor/plugin-text/host/richTextBubbleMenuPositionSync.d.ts +7 -0
- package/_vendor/plugin-text/textShapeSvgExporter.d.ts +6 -0
- package/_vendor/plugin-text/textTypes.d.ts +2 -2
- package/_vendor/store/index.d.ts +1 -1
- package/_vendor/store/{Store.d.ts → store.d.ts} +7 -1
- package/browser/localSnapshotRestore.d.ts +13 -0
- package/{_vendor/canvas-product-react/persistence/localSnapshotPersistence.d.ts → browser/persistence.d.ts} +16 -10
- package/builtins/controller/createBuiltInCanvasController.d.ts +16 -0
- package/builtins/controller/layerController.d.ts +9 -0
- package/builtins/controller/shapeCreationController.d.ts +74 -0
- package/builtins/extensions.d.ts +15 -0
- package/builtins/index.d.ts +5 -0
- package/chrome/CanvasKitFloatingToolbarLayer.d.ts +6 -0
- package/chrome/FloatingSelectionToolbarPageSpace.d.ts +9 -0
- package/chrome/bindings/useCanvasKitChromeControls.d.ts +27 -0
- package/chrome/bindings/useContextMenuSurface.d.ts +12 -0
- package/chrome/bindings/useSvgExport.d.ts +15 -0
- package/chrome/bindings/useToolbarSurfaces.d.ts +26 -0
- package/chrome/types.d.ts +66 -0
- package/chrome/useCanvasKitChromeContext.d.ts +19 -0
- package/controller/canvasKitController.d.ts +36 -0
- package/{_vendor/canvas-product-react/api/canvasProductApi.d.ts → core/controller/canvasProductController.d.ts} +11 -21
- package/core/controller/featureControllerRegistry.d.ts +12 -0
- package/core/controller/index.d.ts +4 -0
- package/core/controller/productLayerTree.d.ts +10 -0
- package/core/features/actions/canvasActionContext.d.ts +15 -0
- package/core/features/actions/canvasActions.d.ts +26 -0
- package/core/features/clipboard/clipboardContextMenuContributions.d.ts +2 -0
- package/core/features/clipboard/clipboardContribution.d.ts +19 -0
- package/{_vendor/canvas-product-react/capabilities → core/features}/clipboard/clipboardService.d.ts +3 -2
- package/core/features/context-menu/contextMenuActions.d.ts +12 -0
- package/core/features/context-menu/contextMenuContext.d.ts +6 -0
- package/core/features/context-menu/contextMenuContribution.d.ts +4 -0
- package/core/features/context-menu/viewContextMenuContributions.d.ts +2 -0
- package/{_vendor/canvas-product-react/capabilities/export/useSvgExport.d.ts → core/features/export/svgExport.d.ts} +11 -7
- package/core/features/hostActionIds.d.ts +1 -0
- package/core/features/toolbar/selectionContextMenuContributions.d.ts +2 -0
- package/core/features/toolbar/toolContextMenuContributions.d.ts +2 -0
- package/core/features/toolbar/toolbarContribution.d.ts +4 -0
- package/core/features/toolbar/toolbarLabels.d.ts +8 -0
- package/core/index.d.ts +23 -0
- package/core/runtime/productAssets.d.ts +18 -0
- package/core/runtime/productContributions.d.ts +9 -0
- package/core/runtime/productDefinition.d.ts +32 -0
- package/core/runtime/productEditor.d.ts +3 -0
- package/core/runtime/productHost.d.ts +17 -0
- package/{_vendor/canvas-product-react → core}/runtime/productServices.d.ts +1 -2
- package/{_vendor/plugin-image-product-react → features/image}/ImageImportController.d.ts +2 -2
- package/{_vendor/plugin-image-product-react → features/image}/imageAssetService.d.ts +2 -2
- package/{_vendor/plugin-image-product-react → features/image}/imageBlobStore.d.ts +1 -1
- package/features/image/imageFileHelpers.d.ts +35 -0
- package/{_vendor/plugin-image-product-react → features/image}/imageHostActions.d.ts +13 -12
- package/features/image/imageHostExtension.d.ts +5 -0
- package/features/image/imageProductController.d.ts +22 -0
- package/features/image/imageProductToolbarActions.d.ts +2 -0
- package/{_vendor/plugin-image-product-react → features/image}/imageToolbarHostBridge.d.ts +2 -2
- package/{_vendor/plugin-image-product-react → features/image}/index.d.ts +4 -5
- package/{_vendor/plugin-image-product-react → features/image}/svgImageAssetInliner.d.ts +1 -1
- package/{_vendor/plugin-image-product-react → features/image}/useImageImport.d.ts +5 -4
- package/index.css +1 -2
- package/index.d.ts +12 -14
- package/index.mjs +66 -1
- package/package.json +1 -11
- package/product/canvasKitProduct.d.ts +59 -0
- package/react/CanvasKitPersistenceNotice.d.ts +4 -0
- package/react/CanvasKitRoot.d.ts +5 -0
- package/react/useCanvasKitController.d.ts +5 -0
- package/{product/useCanvasClipboardShortcuts.d.ts → react/useCanvasKitKeyboardShortcuts.d.ts} +1 -1
- package/react/useCanvasKitRuntime.d.ts +4 -0
- package/react/useCanvasKitStartup.d.ts +9 -0
- package/runtime/canvasKitHostExtensions.d.ts +19 -0
- package/runtime/canvasKitRuntime.d.ts +19 -0
- package/runtime/canvasKitRuntimeInitializer.d.ts +11 -0
- package/_vendor/canvas-core/bindings/arrow/arrowBindingHelpers.d.ts +0 -28
- package/_vendor/canvas-core/tools/hand/HandTool.d.ts +0 -5
- package/_vendor/canvas-core/tools/select/SelectTool.d.ts +0 -5
- package/_vendor/canvas-product-react/api/apiRegistry.d.ts +0 -12
- package/_vendor/canvas-product-react/api/index.d.ts +0 -4
- package/_vendor/canvas-product-react/capabilities/clipboard/systemClipboard.d.ts +0 -16
- package/_vendor/canvas-product-react/capabilities/context-menu/systemContextMenu.d.ts +0 -17
- package/_vendor/canvas-product-react/capabilities/context-menu/useContextMenuSurface.d.ts +0 -12
- package/_vendor/canvas-product-react/capabilities/history/useHistoryControls.d.ts +0 -8
- package/_vendor/canvas-product-react/capabilities/pages/usePageControls.d.ts +0 -12
- package/_vendor/canvas-product-react/capabilities/toolbar/systemToolbar.d.ts +0 -32
- package/_vendor/canvas-product-react/capabilities/toolbar/useToolbarSurfaces.d.ts +0 -19
- package/_vendor/canvas-product-react/capabilities/zoom/useZoomControls.d.ts +0 -9
- package/_vendor/canvas-product-react/index.d.ts +0 -24
- package/_vendor/canvas-product-react/persistence/index.d.ts +0 -2
- package/_vendor/canvas-product-react/runtime/CanvasProductRoot.d.ts +0 -4
- package/_vendor/canvas-product-react/runtime/productDefinition.d.ts +0 -45
- package/_vendor/plugin-draw/core.d.ts +0 -7
- package/_vendor/plugin-eraser/core.d.ts +0 -2
- package/_vendor/plugin-frame/core.d.ts +0 -7
- package/_vendor/plugin-geo/core.d.ts +0 -7
- package/_vendor/plugin-group/core.d.ts +0 -7
- package/_vendor/plugin-image-product-react/imageProductApi.d.ts +0 -21
- package/_vendor/plugin-image-product-react/imageToolbarRuntime.d.ts +0 -2
- package/_vendor/plugin-image-product-react/snapshotGuards.d.ts +0 -1
- package/_vendor/plugin-laser/core.d.ts +0 -2
- package/_vendor/plugin-text/TextShapeSvgExporter.d.ts +0 -6
- package/_vendor/plugin-text/core.d.ts +0 -2
- package/api/canvasKitApi.d.ts +0 -29
- package/product/Shell.d.ts +0 -19
- package/product/chromeContext.d.ts +0 -70
- package/product/createCanvasKitEditor.d.ts +0 -6
- package/product/index.d.ts +0 -7
- package/product/persistence.d.ts +0 -3
- package/product/product.d.ts +0 -22
- package/product-CxN5NN6u.mjs +0 -4
- package/product.mjs +0 -1
- package/standard/extensions.d.ts +0 -1
- package/standard/index.d.ts +0 -3
- package/standard/standardApi.d.ts +0 -91
- package/standard-R17_x8HU.mjs +0 -44
- package/standard.mjs +0 -1
- /package/_vendor/canvas-core/editor/managers/{SideEffectManager.d.ts → sideEffectManager.d.ts} +0 -0
- /package/_vendor/canvas-core/geometry/{Vec.d.ts → vec.d.ts} +0 -0
- /package/_vendor/canvas-react/host/{CanvasRendererRegistryContext.d.ts → canvasRendererRegistryContext.d.ts} +0 -0
- /package/_vendor/plugin-arrow/{ArrowBindingUtil.d.ts → arrowBindingUtil.d.ts} +0 -0
- /package/_vendor/plugin-arrow/{ArrowTool.d.ts → arrowTool.d.ts} +0 -0
- /package/_vendor/plugin-draw/{DrawShapeUtil.d.ts → drawShapeUtil.d.ts} +0 -0
- /package/_vendor/plugin-draw/{DrawTool.d.ts → drawTool.d.ts} +0 -0
- /package/_vendor/plugin-eraser/{EraserTool.d.ts → eraserTool.d.ts} +0 -0
- /package/_vendor/plugin-geo/{GeoShapeUtil.d.ts → geoShapeUtil.d.ts} +0 -0
- /package/_vendor/plugin-group/{GroupShapeUtil.d.ts → groupShapeUtil.d.ts} +0 -0
- /package/_vendor/plugin-laser/{LaserTool.d.ts → laserTool.d.ts} +0 -0
- /package/_vendor/plugin-text/{ArrowLabelBindingUtil.d.ts → arrowLabelBindingUtil.d.ts} +0 -0
- /package/_vendor/plugin-text/{GeoLabelBindingUtil.d.ts → geoLabelBindingUtil.d.ts} +0 -0
- /package/_vendor/plugin-text/{TextShapeUtil.d.ts → textShapeUtil.d.ts} +0 -0
- /package/_vendor/plugin-text/{TextTool.d.ts → textTool.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,102 +1,82 @@
|
|
|
1
1
|
# @land/canvas-kit
|
|
2
2
|
|
|
3
|
-
`@land/canvas-kit`
|
|
3
|
+
`@land/canvas-kit` is the public React SDK for the Land canvas kit. It includes the product runtime, built-in canvas extensions, image integration, persistence, chrome context, and typed controller surface behind one package root.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- `CanvasKit`,用于直接嵌入标准画布套件
|
|
8
|
-
- `createCanvasKitApi` 和 `CanvasKitApi`,用于编辑器自动化
|
|
9
|
-
- `createCanvasKitProduct`,用于较底层的 `CanvasProductRoot` 产品组合
|
|
10
|
-
- `@land/canvas-kit/product`,用于自定义产品 chrome
|
|
11
|
-
- `@land/canvas-kit/standard`,用于标准内置插件扩展与类型化 API
|
|
12
|
-
- 打包进发布产物的 Land 内部依赖
|
|
13
|
-
- 作为 peer dependency 的 `react` 和 `react-dom`
|
|
14
|
-
|
|
15
|
-
## 文档
|
|
16
|
-
|
|
17
|
-
- [使用文档](./docs/使用文档.md) - 基于 `apps/professional` 和 `apps/zen` 示例的使用指南。
|
|
18
|
-
- [API 文档](./docs/API文档.md) - `.`、`./product` 和 `./standard` 三个入口的完整 API 参考。
|
|
19
|
-
|
|
20
|
-
## 安装
|
|
5
|
+
## Install
|
|
21
6
|
|
|
22
7
|
```bash
|
|
23
8
|
pnpm add @land/canvas-kit react react-dom
|
|
24
9
|
```
|
|
25
10
|
|
|
26
|
-
##
|
|
11
|
+
## Basic Usage
|
|
27
12
|
|
|
28
13
|
```tsx
|
|
29
|
-
import {
|
|
14
|
+
import { useMemo } from "react";
|
|
30
15
|
import {
|
|
31
|
-
|
|
32
|
-
|
|
16
|
+
CanvasKitRoot,
|
|
17
|
+
defineCanvasKit,
|
|
33
18
|
} from "@land/canvas-kit";
|
|
34
19
|
import "@land/canvas-kit/style.css";
|
|
35
20
|
|
|
36
21
|
export function App() {
|
|
37
|
-
const
|
|
22
|
+
const product = useMemo(
|
|
23
|
+
() =>
|
|
24
|
+
defineCanvasKit({
|
|
25
|
+
onControllerReady(controller) {
|
|
26
|
+
console.log(controller.snapshot());
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
[],
|
|
30
|
+
);
|
|
38
31
|
|
|
39
32
|
return (
|
|
40
33
|
<div style={{ width: "100%", height: "100vh" }}>
|
|
41
|
-
<
|
|
42
|
-
ref={apiRef}
|
|
43
|
-
onReady={(api) => {
|
|
44
|
-
console.log(api.snapshot());
|
|
45
|
-
}}
|
|
46
|
-
/>
|
|
34
|
+
<CanvasKitRoot product={product} />
|
|
47
35
|
</div>
|
|
48
36
|
);
|
|
49
37
|
}
|
|
50
38
|
```
|
|
51
39
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## 注意事项
|
|
55
|
-
|
|
56
|
-
- 默认的 `canvas-kit` 产品包含画布表面、标准插件、产品运行时,以及插件自带的编辑 UI,例如文本行内格式工具条。
|
|
57
|
-
- 它不会注册产品级 chrome 面板、工具栏或上下文菜单。
|
|
40
|
+
The host element must provide a size. `CanvasKitRoot` fills the space provided by its parent and mounts the canvas runtime for the product.
|
|
58
41
|
|
|
59
|
-
##
|
|
42
|
+
## Custom Chrome
|
|
60
43
|
|
|
61
|
-
`
|
|
44
|
+
Use the `chrome` option when you want to provide your own toolbar, panels, or menus while keeping the kit runtime and built-in extensions.
|
|
62
45
|
|
|
63
46
|
```tsx
|
|
64
47
|
import { useMemo } from "react";
|
|
65
|
-
import { CanvasProductRoot } from "@land/canvas-product-react";
|
|
66
48
|
import {
|
|
67
|
-
|
|
49
|
+
CanvasKitRoot,
|
|
50
|
+
defineCanvasKit,
|
|
51
|
+
type CanvasKitController,
|
|
68
52
|
type CanvasKitChromeContext,
|
|
69
|
-
} from "@land/canvas-kit
|
|
70
|
-
import { type CanvasKitApi } from "@land/canvas-kit";
|
|
53
|
+
} from "@land/canvas-kit";
|
|
71
54
|
import "@land/canvas-kit/style.css";
|
|
72
55
|
|
|
73
|
-
function MyChrome({
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
56
|
+
function MyChrome({
|
|
57
|
+
context,
|
|
58
|
+
}: {
|
|
59
|
+
context: CanvasKitChromeContext<CanvasKitController>;
|
|
60
|
+
}) {
|
|
77
61
|
return (
|
|
78
62
|
<>
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<aside className="my-context-panel">
|
|
97
|
-
{toolbarSurfaces.contextToolbarTitle}
|
|
98
|
-
</aside>
|
|
99
|
-
) : null}
|
|
63
|
+
<button
|
|
64
|
+
type="button"
|
|
65
|
+
disabled={!context.history.canUndo}
|
|
66
|
+
onClick={context.history.undo}
|
|
67
|
+
>
|
|
68
|
+
Undo
|
|
69
|
+
</button>
|
|
70
|
+
<button type="button" onClick={context.zoom.zoomIn}>
|
|
71
|
+
Zoom in
|
|
72
|
+
</button>
|
|
73
|
+
<button
|
|
74
|
+
type="button"
|
|
75
|
+
disabled={context.selection.count === 0}
|
|
76
|
+
onClick={() => context.controller.deleteShapes([...context.selectedShapeIds])}
|
|
77
|
+
>
|
|
78
|
+
Delete
|
|
79
|
+
</button>
|
|
100
80
|
</>
|
|
101
81
|
);
|
|
102
82
|
}
|
|
@@ -104,41 +84,63 @@ function MyChrome({ context }: { context: CanvasKitChromeContext<CanvasKitApi> }
|
|
|
104
84
|
export function App() {
|
|
105
85
|
const product = useMemo(
|
|
106
86
|
() =>
|
|
107
|
-
|
|
87
|
+
defineCanvasKit({
|
|
108
88
|
chrome: (context) => <MyChrome context={context} />,
|
|
109
|
-
exposeApiOnWindow: true,
|
|
110
89
|
}),
|
|
111
90
|
[],
|
|
112
91
|
);
|
|
113
92
|
|
|
114
93
|
return (
|
|
115
94
|
<div style={{ width: "100%", height: "100vh" }}>
|
|
116
|
-
<
|
|
95
|
+
<CanvasKitRoot product={product} />
|
|
117
96
|
</div>
|
|
118
97
|
);
|
|
119
98
|
}
|
|
120
99
|
```
|
|
121
100
|
|
|
122
|
-
|
|
101
|
+
Chrome should operate through `CanvasKitChromeContext` and `context.controller`. The product shell owns canvas mounting, so custom chrome should render controls and overlays rather than the canvas itself. It should not import `@land/canvas-core`, `@land/canvas-react`, built-in plugin packages, or kit internals.
|
|
123
102
|
|
|
124
|
-
|
|
103
|
+
The package no longer exposes a one-component direct render entry. Apps should define a product with `defineCanvasKit` and render it through `CanvasKitRoot`.
|
|
125
104
|
|
|
126
|
-
|
|
105
|
+
## Local Persistence
|
|
127
106
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
107
|
+
Default browser persistence restores supported records even when a saved
|
|
108
|
+
snapshot also contains unsupported shape or binding types. Unsupported raw
|
|
109
|
+
records are preserved outside the live editor and merged back into future saves.
|
|
110
|
+
When this happens, `CanvasKitRoot` shows a persistence notice and custom
|
|
111
|
+
chrome can inspect `context.persistence.status` or call
|
|
112
|
+
`context.persistence.discardUnsupportedRecords?.()` after explicit user
|
|
113
|
+
confirmation.
|
|
114
|
+
|
|
115
|
+
## Internal Assembly
|
|
116
|
+
|
|
117
|
+
The public product remains opaque. Internally, `defineCanvasKit()` resolves options into explicit product fields:
|
|
118
|
+
|
|
119
|
+
- `LandExtension[]` installs editor/canvas plugins through `@land/canvas-react/host`.
|
|
120
|
+
- `CanvasKitHostExtension[]` installs product-host behavior such as clipboard, toolbar, context menu, image import, asset URL resolution, SVG asset inlining, and controller components.
|
|
121
|
+
- Service factories and asset resolver tokens wire product-level services into runtime.
|
|
122
|
+
- `CanvasKitRuntime` creates services, the plugin host runtime, the editor, controller registry, and then runs product runtime setup.
|
|
123
|
+
|
|
124
|
+
This keeps app chrome on the root package controller while keeping browser-specific host behavior out of concrete shape plugins and out of `canvas-core`.
|
|
125
|
+
|
|
126
|
+
## Public Exports
|
|
127
|
+
|
|
128
|
+
The published package intentionally exposes only:
|
|
129
|
+
|
|
130
|
+
- `@land/canvas-kit`
|
|
131
|
+
- `@land/canvas-kit/style.css`
|
|
132
|
+
|
|
133
|
+
Package subpaths are internal implementation details.
|
|
132
134
|
|
|
133
|
-
##
|
|
135
|
+
## Local Build
|
|
134
136
|
|
|
135
|
-
|
|
137
|
+
Run from the workspace root:
|
|
136
138
|
|
|
137
139
|
```bash
|
|
138
140
|
pnpm build:canvas-kit:bundle
|
|
139
141
|
```
|
|
140
142
|
|
|
141
|
-
|
|
143
|
+
The publish-ready output is written to:
|
|
142
144
|
|
|
143
145
|
```text
|
|
144
146
|
packages/canvas-kit/dist-component/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Editor } from "../editor/
|
|
1
|
+
import type { Editor } from "../editor/editor";
|
|
2
2
|
import type { SelectionOverlayFrameGeometryState } from "../editor/selection";
|
|
3
3
|
import type { BindingId, BindingRecord, BindingRecordBase, ShapeRecord } from "../schema/records";
|
|
4
4
|
export interface BindingUtilEffect {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BindingRecordBase } from "../schema/records";
|
|
2
|
-
import { BindingUtil } from "./
|
|
2
|
+
import { BindingUtil } from "./bindingUtil";
|
|
3
3
|
export declare class BindingUtilRegistry {
|
|
4
4
|
private readonly registry;
|
|
5
5
|
register<B extends BindingRecordBase>(util: BindingUtil<B>): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Vec } from "../geometry/vec";
|
|
2
|
+
import type { Editor } from "../editor/editor";
|
|
3
|
+
import type { BindingPreviewState } from "../editor/selection";
|
|
4
|
+
import type { ShapeId } from "../schema/records";
|
|
5
|
+
export interface ConnectionPoint {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}
|
|
9
|
+
export type ConnectionTerminal = "start" | "end";
|
|
10
|
+
export interface TerminalBindingTargetInput {
|
|
11
|
+
targetShapeId: ShapeId;
|
|
12
|
+
normalizedAnchor: ConnectionPoint;
|
|
13
|
+
}
|
|
14
|
+
export interface ResolvedTerminalBinding {
|
|
15
|
+
pagePoint: Vec;
|
|
16
|
+
binding: TerminalBindingTargetInput | null;
|
|
17
|
+
preview: BindingPreviewState | null;
|
|
18
|
+
}
|
|
19
|
+
export interface TerminalBindingResolverInput {
|
|
20
|
+
terminal: ConnectionTerminal;
|
|
21
|
+
rawPagePoint: Vec;
|
|
22
|
+
oppositePagePoint: Vec;
|
|
23
|
+
excludeShapeId?: ShapeId;
|
|
24
|
+
ignoreTargets?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export type TerminalBindingResolver = (editor: Editor, input: TerminalBindingResolverInput) => ResolvedTerminalBinding;
|
|
27
|
+
export declare function getFreeTerminalBinding({ rawPagePoint, }: TerminalBindingResolverInput): ResolvedTerminalBinding;
|
|
28
|
+
export declare function resolveTerminalBindingAtPoint(editor: Editor, input: TerminalBindingResolverInput): ResolvedTerminalBinding;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChangeSource } from "../../store/index";
|
|
2
|
-
import { Vec } from "../geometry/
|
|
2
|
+
import { Vec } from "../geometry/vec";
|
|
3
3
|
import type { AssetId, AssetRecord, BindingRecord, ShapeId, ShapeRecord } from "../schema/records";
|
|
4
|
-
import type { Editor } from "./
|
|
4
|
+
import type { Editor } from "./editor";
|
|
5
5
|
export interface EditorClipboardPayload {
|
|
6
6
|
type: "land/clipboard";
|
|
7
7
|
version: 1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Editor } from "./
|
|
1
|
+
import type { Editor } from "./editor";
|
|
2
2
|
import type { ChangeSource } from "../../store/index";
|
|
3
3
|
import type { AssetId, AssetRecord, AssetRecordBase, BindingId, BindingRecordBase, BindingRecord, Camera, PageId, PageRecord, ShapeId, ShapeParentId, ShapeRecordBase, ShapeRecord, ShapeEditingEntryMode } from "../schema/records";
|
|
4
4
|
export interface EditorCommandOptions {
|
|
@@ -37,6 +37,7 @@ export interface ShapeUpdate {
|
|
|
37
37
|
rotation?: number;
|
|
38
38
|
scaleX?: number;
|
|
39
39
|
scaleY?: number;
|
|
40
|
+
opacity?: number;
|
|
40
41
|
isHidden?: boolean;
|
|
41
42
|
isLocked?: boolean;
|
|
42
43
|
parentId?: ShapeParentId;
|
|
@@ -103,6 +104,10 @@ export interface EditorCommands {
|
|
|
103
104
|
*/
|
|
104
105
|
createShapesFromRecords(records: ShapeRecord[], options?: EditorCommandOptions): ShapeRecord[];
|
|
105
106
|
updateShapes(updates: ShapeUpdate[], options?: EditorCommandOptions): void;
|
|
107
|
+
/**
|
|
108
|
+
* Move shapes to a new parent, appending shapes that are entering that parent
|
|
109
|
+
* to the end of its child order in the order provided by `ids`.
|
|
110
|
+
*/
|
|
106
111
|
reparentShapes(input: ReparentShapesInput, options?: EditorCommandOptions): void;
|
|
107
112
|
deleteShapes(ids: ShapeId[], options?: EditorCommandOptions): void;
|
|
108
113
|
createAsset(input: CreateAssetInput, options?: EditorCommandOptions): AssetRecord;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type LandEditorPlugin } from "../plugins";
|
|
2
|
+
import { Editor, type EditorOptions } from "./editor";
|
|
3
|
+
export interface CreateEditorWithPluginsOptions extends Omit<EditorOptions, "shapeUtils" | "shapeSvgExporters" | "bindingUtils" | "shapeCapabilities"> {
|
|
4
|
+
editorPlugins?: readonly LandEditorPlugin[];
|
|
5
|
+
}
|
|
6
|
+
export declare function createEditorWithPlugins(options?: CreateEditorWithPluginsOptions): Editor;
|
|
@@ -1,46 +1,47 @@
|
|
|
1
1
|
import { type Signal } from "../../signals/index";
|
|
2
|
-
import type {
|
|
3
|
-
import type { BindingUtil } from "../bindings/
|
|
4
|
-
import { BindingUtilRegistry } from "../bindings/
|
|
5
|
-
import { Box } from "../geometry/
|
|
6
|
-
import { Mat } from "../geometry/
|
|
7
|
-
import { Vec } from "../geometry/
|
|
2
|
+
import type { TerminalBindingResolver, TerminalBindingResolverInput, ResolvedTerminalBinding } from "../bindings/terminalBinding";
|
|
3
|
+
import type { BindingUtil } from "../bindings/bindingUtil";
|
|
4
|
+
import { BindingUtilRegistry } from "../bindings/bindingUtilRegistry";
|
|
5
|
+
import { Box } from "../geometry/box";
|
|
6
|
+
import { Mat } from "../geometry/mat";
|
|
7
|
+
import { Vec } from "../geometry/vec";
|
|
8
8
|
import { type BindingId, type BindingRecord, type AssetId, type AssetRecord, type Camera, type PageId, type PageRecord, type EditorRecord, type RecordScope, type SessionRecord, type ShapeId, type ShapeParentId, type ShapeRecord, type ShapeEditingEntryRequest, type ShapeEditingSession } from "../schema/records";
|
|
9
9
|
import { type DocumentSnapshot, type SessionSnapshot } from "../schema/snapshots";
|
|
10
|
-
import type { ShapeSelectionFlipAxis, ShapeUtil } from "../shapes/
|
|
11
|
-
import { ShapeUtilRegistry } from "../shapes/
|
|
10
|
+
import type { ShapeSelectionFlipAxis, ShapeUtil } from "../shapes/shapeUtil";
|
|
11
|
+
import { ShapeUtilRegistry } from "../shapes/shapeUtilRegistry";
|
|
12
12
|
import { ShapeSvgExporterRegistry, type ShapeSvgExporter, type SvgExportOptions, type SvgExportResult } from "../exports/svg";
|
|
13
13
|
import { type ExportIntegrityRepairResult, type ExportIntegrityReport } from "../exports/integrity";
|
|
14
14
|
import { type ShapeCapabilityDefinition, type ShapeCapabilityManifest } from "../shapes/capabilities";
|
|
15
15
|
import { Store, type ChangeSource, type StoreChange } from "../../store/index";
|
|
16
16
|
import { type CreateAssetInput, type CreateBindingInput, type CreatePageInput, type CreateShapeInput, type StartEditingShapeInput, type EditorCommands } from "./commands";
|
|
17
17
|
import type { CancelEditorEvent, EditorEvent } from "./events";
|
|
18
|
-
import { HistoryManager, type HistoryState } from "./
|
|
19
|
-
import { BindingManager } from "./managers/
|
|
20
|
-
import { CameraManager } from "./managers/
|
|
21
|
-
import { ClipboardManager } from "./managers/
|
|
22
|
-
import { DocumentSnapshotManager } from "./managers/
|
|
23
|
-
import { InputsManager } from "./managers/
|
|
24
|
-
import { InteractionTransientManager, type LaserTrailState } from "./managers/
|
|
25
|
-
import { QueryManager, type ShapeContainment } from "./managers/
|
|
26
|
-
import { SpatialIndexManager, type ShapeAtPointOptions, type ShapeLineSegmentHitTestOptions, type SpatialQueryOptions } from "./managers/
|
|
27
|
-
import { SnapManager } from "./managers/
|
|
28
|
-
import { SideEffectManager } from "./managers/
|
|
29
|
-
import { SelectionLayoutManager } from "./managers/
|
|
30
|
-
import { SelectionManager } from "./managers/
|
|
31
|
-
import { SelectionOverlayManager } from "./managers/
|
|
32
|
-
import { ShapeEditingManager } from "./managers/
|
|
33
|
-
import { ShapeGeometryManager } from "./managers/
|
|
34
|
-
import { ShapeHierarchyManager } from "./managers/
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
18
|
+
import { HistoryManager, type HistoryState } from "./historyManager";
|
|
19
|
+
import { BindingManager } from "./managers/bindingManager";
|
|
20
|
+
import { CameraManager } from "./managers/cameraManager";
|
|
21
|
+
import { ClipboardManager } from "./managers/clipboardManager";
|
|
22
|
+
import { DocumentSnapshotManager } from "./managers/documentSnapshotManager";
|
|
23
|
+
import { InputsManager } from "./managers/inputsManager";
|
|
24
|
+
import { InteractionTransientManager, type LaserTrailState } from "./managers/interactionTransientManager";
|
|
25
|
+
import { QueryManager, type ShapeContainment } from "./managers/queryManager";
|
|
26
|
+
import { SpatialIndexManager, type ShapeAtPointOptions, type ShapeLineSegmentHitTestOptions, type SpatialQueryOptions } from "./managers/spatialIndexManager";
|
|
27
|
+
import { SnapManager } from "./managers/snapManager";
|
|
28
|
+
import { SideEffectManager } from "./managers/sideEffectManager";
|
|
29
|
+
import { SelectionLayoutManager } from "./managers/selectionLayoutManager";
|
|
30
|
+
import { SelectionManager } from "./managers/selectionManager";
|
|
31
|
+
import { SelectionOverlayManager } from "./managers/selectionOverlayManager";
|
|
32
|
+
import { ShapeEditingManager } from "./managers/shapeEditingManager";
|
|
33
|
+
import { ShapeGeometryManager } from "./managers/shapeGeometryManager";
|
|
34
|
+
import { ShapeHierarchyManager } from "./managers/shapeHierarchyManager";
|
|
35
|
+
import { ShortcutManager } from "./managers/shortcutManager";
|
|
36
|
+
import { RenderWindowManager } from "./managers/renderWindowManager";
|
|
37
|
+
import { ToolManager } from "./managers/toolManager";
|
|
37
38
|
import type { ShapeGeometry } from "./queries/shapeTransforms";
|
|
38
39
|
import { editorStoreSymbol } from "./internal";
|
|
39
40
|
import type { DuplicateSelectionInput, EditorClipboardPayload, PasteClipboardPayloadInput } from "./clipboard";
|
|
40
41
|
import { InteractionHandlerRegistry } from "./interactions";
|
|
41
42
|
import { SelectionHandleInteractionRegistry } from "./selectionHandleInteractions";
|
|
42
43
|
import { type SelectedShapeOverlayItem } from "./selectionOverlay";
|
|
43
|
-
import type {
|
|
44
|
+
import type { BindingPreviewState, SnapIndicatorState, SelectionBindingSegment, SelectionHandle, SelectionFrame, SelectionOverlayFrameState, SelectionOverlayFrameGeometryState, SelectionOverlayFrameStyleState, SelectionOverlayHandleAnchorsState, SelectionOverlayHandleCountsState, SelectionOverlayHandlesState, SelectionOverlayState } from "./selection";
|
|
44
45
|
export interface EditorOptions {
|
|
45
46
|
shapeUtils?: ShapeUtil[];
|
|
46
47
|
shapeSvgExporters?: ShapeSvgExporter[];
|
|
@@ -103,19 +104,6 @@ export interface ShapeGroupState {
|
|
|
103
104
|
shapeIds: ShapeId[];
|
|
104
105
|
bounds: Box;
|
|
105
106
|
}
|
|
106
|
-
export interface LayerTreeNode {
|
|
107
|
-
id: ShapeId;
|
|
108
|
-
parentId: ShapeParentId;
|
|
109
|
-
pageId: PageId;
|
|
110
|
-
type: ShapeRecord["type"];
|
|
111
|
-
childIds: ShapeId[];
|
|
112
|
-
index: number;
|
|
113
|
-
depth: number;
|
|
114
|
-
isHidden: boolean;
|
|
115
|
-
isLocked: boolean;
|
|
116
|
-
isEffectivelyHidden: boolean;
|
|
117
|
-
isEffectivelyLocked: boolean;
|
|
118
|
-
}
|
|
119
107
|
export type LayerOrderDirection = "backward" | "forward";
|
|
120
108
|
export type LayerOrderEdge = "back" | "front";
|
|
121
109
|
export type ShapePropsPatch = Record<string, unknown>;
|
|
@@ -140,7 +128,7 @@ export interface EditorSelectionState {
|
|
|
140
128
|
frameBounds: Box | null;
|
|
141
129
|
frameRotation: number;
|
|
142
130
|
frameRotationCenter: Vec | null;
|
|
143
|
-
|
|
131
|
+
selectionAnchorPagePoint: Vec | null;
|
|
144
132
|
}
|
|
145
133
|
export interface EditorRenderHostDebugState {
|
|
146
134
|
culledCount: number;
|
|
@@ -180,6 +168,7 @@ export interface EditorOverlayDebugState {
|
|
|
180
168
|
interface ReadonlyStore {
|
|
181
169
|
readonly recordsSignal: Signal<Map<string, EditorRecord>>;
|
|
182
170
|
get(id: string): EditorRecord | undefined;
|
|
171
|
+
getRecordSignal(id: string): Signal<EditorRecord | undefined>;
|
|
183
172
|
getAll(): EditorRecord[];
|
|
184
173
|
getByScope(scope: RecordScope): EditorRecord[];
|
|
185
174
|
listen(listener: (change: StoreChange<EditorRecord>) => void): () => void;
|
|
@@ -190,6 +179,7 @@ export declare class Editor {
|
|
|
190
179
|
readonly inputs: InputsManager;
|
|
191
180
|
readonly snapshots: DocumentSnapshotManager;
|
|
192
181
|
readonly clipboard: ClipboardManager;
|
|
182
|
+
readonly shortcuts: ShortcutManager;
|
|
193
183
|
readonly tools: ToolManager;
|
|
194
184
|
readonly camera: CameraManager;
|
|
195
185
|
readonly selection: SelectionManager;
|
|
@@ -221,9 +211,10 @@ export declare class Editor {
|
|
|
221
211
|
readonly eraserTrailActiveSignal: Signal<boolean>;
|
|
222
212
|
readonly laserTrailSignal: Signal<LaserTrailState | null>;
|
|
223
213
|
readonly laserTrailActiveSignal: Signal<boolean>;
|
|
224
|
-
readonly bindingPreviewSignal: Signal<
|
|
214
|
+
readonly bindingPreviewSignal: Signal<BindingPreviewState | null>;
|
|
225
215
|
readonly bindingPreviewActiveSignal: Signal<boolean>;
|
|
226
216
|
readonly dropTargetShapeIdSignal: Signal<ShapeId | null>;
|
|
217
|
+
readonly selectionTranslationActiveSignal: Signal<boolean>;
|
|
227
218
|
readonly snapIndicatorsSignal: Signal<SnapIndicatorState[]>;
|
|
228
219
|
readonly snapIndicatorsActiveSignal: Signal<boolean>;
|
|
229
220
|
get viewportScreenSizeSignal(): Signal<{
|
|
@@ -248,7 +239,7 @@ export declare class Editor {
|
|
|
248
239
|
readonly retainedShapeIdsSignal: Signal<ShapeId[]>;
|
|
249
240
|
readonly selectionPageBoundsSignal: Signal<Box | null>;
|
|
250
241
|
readonly selectionFrameBoundsSignal: Signal<Box | null>;
|
|
251
|
-
readonly
|
|
242
|
+
readonly selectionAnchorPagePointSignal: Signal<Vec | null>;
|
|
252
243
|
readonly pagesSignal: import("../../signals/index").Computed<PageRecord[]>;
|
|
253
244
|
readonly currentPageSignal: import("../../signals/index").Computed<PageRecord | null>;
|
|
254
245
|
readonly pageStateSignal: import("../../signals/index").Computed<EditorPageState>;
|
|
@@ -288,7 +279,8 @@ export declare class Editor {
|
|
|
288
279
|
private currentPointerClickCount;
|
|
289
280
|
readonly selectionOverlayFrameGeometrySignal: Signal<SelectionOverlayFrameGeometryState | null>;
|
|
290
281
|
readonly selectionOverlayCompanionFrameGeometriesSignal: Signal<SelectionOverlayFrameGeometryState[]>;
|
|
291
|
-
readonly
|
|
282
|
+
readonly selectionOverlayPathSignal: Signal<string | null>;
|
|
283
|
+
readonly selectionOverlayBindingSegmentsSignal: Signal<SelectionBindingSegment[]>;
|
|
292
284
|
readonly selectionOverlayFrameStyleSignal: Signal<SelectionOverlayFrameStyleState>;
|
|
293
285
|
readonly selectionOverlayFrameSignal: Signal<SelectionOverlayFrameState | null>;
|
|
294
286
|
readonly selectionOverlayHandleAnchorsSignal: Signal<SelectionOverlayHandleAnchorsState | null>;
|
|
@@ -297,9 +289,12 @@ export declare class Editor {
|
|
|
297
289
|
readonly selectionOverlaySignal: Signal<SelectionOverlayState | null>;
|
|
298
290
|
readonly overlayDebugStateSignal: Signal<EditorOverlayDebugState>;
|
|
299
291
|
constructor(options?: EditorOptions);
|
|
292
|
+
private registerBuiltInShortcuts;
|
|
300
293
|
private registerBuiltInSideEffects;
|
|
301
294
|
dispatch(event: EditorEvent): void;
|
|
302
295
|
handleInteractionEvent(event: EditorEvent): boolean;
|
|
296
|
+
private runKeyboardShortcutTarget;
|
|
297
|
+
private runEditorKeyboardShortcut;
|
|
303
298
|
private normalizeEvent;
|
|
304
299
|
private getDoubleClickEvent;
|
|
305
300
|
listen(listener: (change: StoreChange<EditorRecord>) => void): () => void;
|
|
@@ -336,8 +331,6 @@ export declare class Editor {
|
|
|
336
331
|
getSelectionParentOrderState(): ShapeSelectionSiblingOrderState | null;
|
|
337
332
|
getSelectionGroupState(): ShapeGroupState | null;
|
|
338
333
|
canGroupSelection(): boolean;
|
|
339
|
-
getLayerTree(pageId?: PageId): LayerTreeNode[];
|
|
340
|
-
getLayerNode(id: ShapeId): LayerTreeNode | null;
|
|
341
334
|
canGroupShapes(ids: readonly ShapeId[]): boolean;
|
|
342
335
|
groupShapes(ids: readonly ShapeId[], source?: ChangeSource): ShapeRecord | null;
|
|
343
336
|
groupSelection(source?: ChangeSource): ShapeRecord | null;
|
|
@@ -421,6 +414,7 @@ export declare class Editor {
|
|
|
421
414
|
getShapeExportTraversalIds(shapeIds: Iterable<ShapeId>): ShapeId[];
|
|
422
415
|
getShapeContainment(containerId: ShapeId, shapeId: ShapeId): ShapeContainment | null;
|
|
423
416
|
getContainingShapeParentId(shapeIds: Iterable<ShapeId>): ShapeParentId | null;
|
|
417
|
+
getContainingShapeParentIdAtPoint(shapeIds: Iterable<ShapeId>, point: Vec): ShapeParentId | null;
|
|
424
418
|
getContainingParentIdForShapeRecord(shape: ShapeRecord): ShapeParentId | null;
|
|
425
419
|
getShapeClipAncestorIds(shapeId: ShapeId): ShapeId[];
|
|
426
420
|
getShapeClipAncestorIdsSignal(shapeId: ShapeId): Signal<ShapeId[]>;
|
|
@@ -456,7 +450,7 @@ export declare class Editor {
|
|
|
456
450
|
isPointInSelectionBounds(point: Vec): boolean;
|
|
457
451
|
getSelectionFrameLocalBoundsPoint(point: Vec): Vec | null;
|
|
458
452
|
getSelectionPageOutlineVertices(): Vec[];
|
|
459
|
-
|
|
453
|
+
getSelectionAnchorPagePoint(): Vec | null;
|
|
460
454
|
hitTestSelectionHandle(point: Vec): SelectionHandle | null;
|
|
461
455
|
setBrushBox(brushBox: Box | null): void;
|
|
462
456
|
getErasingShapeIds(): ShapeId[];
|
|
@@ -469,11 +463,12 @@ export declare class Editor {
|
|
|
469
463
|
setLaserTrail(sessionId: number, points: readonly Vec[]): void;
|
|
470
464
|
finishLaserTrail(sessionId: number): void;
|
|
471
465
|
clearLaserTrail(sessionId: number): void;
|
|
472
|
-
setBindingPreview(preview:
|
|
466
|
+
setBindingPreview(preview: BindingPreviewState | null): void;
|
|
473
467
|
setDropTargetShapeId(shapeId: ShapeId | null): void;
|
|
468
|
+
setSelectionTranslationActive(active: boolean): void;
|
|
474
469
|
setSnapIndicators(indicators: SnapIndicatorState[] | null): void;
|
|
475
|
-
|
|
476
|
-
|
|
470
|
+
setTerminalBindingResolver(resolver: TerminalBindingResolver): void;
|
|
471
|
+
resolveTerminalBinding(input: TerminalBindingResolverInput): ResolvedTerminalBinding;
|
|
477
472
|
clearSelectionTransients(): void;
|
|
478
473
|
hitTestShape(point: Vec): ShapeRecord | null;
|
|
479
474
|
hitTestShapesAtPoint(point: Vec, options?: ShapeAtPointOptions): ShapeRecord[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Box } from "../geometry/
|
|
2
|
-
import type { Vec } from "../geometry/
|
|
1
|
+
import type { Box } from "../geometry/box";
|
|
2
|
+
import type { Vec } from "../geometry/vec";
|
|
3
3
|
import type { AssetId, PageId, ShapeId, ShapeRecord } from "../schema/records";
|
|
4
|
-
import type {
|
|
5
|
-
import type { EditorOverlayDebugState, EditorRenderHostDebugState, RenderItem } from "./
|
|
4
|
+
import type { BindingPreviewState } from "./selection";
|
|
5
|
+
import type { EditorOverlayDebugState, EditorRenderHostDebugState, RenderItem } from "./editor";
|
|
6
6
|
export declare function areShapeIdArraysEqual(a: ShapeId[], b: ShapeId[]): boolean;
|
|
7
7
|
export declare function areVecsEqual(a: Vec | null, b: Vec | null): boolean;
|
|
8
8
|
export declare function areVecArraysEqual(a: readonly Vec[], b: readonly Vec[]): boolean;
|
|
@@ -12,7 +12,7 @@ export declare function areRenderHostDebugStatesEqual(a: EditorRenderHostDebugSt
|
|
|
12
12
|
export declare function areOverlayDebugStatesEqual(a: EditorOverlayDebugState, b: EditorOverlayDebugState): boolean;
|
|
13
13
|
export declare function getBoxDebugSummary(box: Box | null): string;
|
|
14
14
|
export declare function getShapePageIdFromParentChain(shape: ShapeRecord, shapeById: ReadonlyMap<ShapeId, ShapeRecord>, pageIds: ReadonlySet<PageId>): PageId | null;
|
|
15
|
-
export declare function areBindingPreviewStatesEqual(a:
|
|
15
|
+
export declare function areBindingPreviewStatesEqual(a: BindingPreviewState | null, b: BindingPreviewState | null): boolean;
|
|
16
16
|
export declare function areRenderItemsEqual(a: RenderItem[], b: RenderItem[]): boolean;
|
|
17
17
|
export declare function areShapeIdSetsEqual(a: Set<ShapeId>, b: Set<ShapeId>): boolean;
|
|
18
18
|
export declare function getCommonShapeType(shapes: readonly ShapeRecord[]): ShapeRecord["type"] | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChangeSource } from "../../store/index";
|
|
2
|
-
import type { ShapeSelectionFlipAxis } from "../shapes/
|
|
2
|
+
import type { ShapeSelectionFlipAxis } from "../shapes/shapeUtil";
|
|
3
3
|
import type { ShapeUpdate } from "./commands";
|
|
4
|
-
import type { Editor } from "./
|
|
4
|
+
import type { Editor } from "./editor";
|
|
5
5
|
export declare function resetEditorSelectionRotation(editor: Editor, source?: ChangeSource): void;
|
|
6
6
|
export declare function getEditorSelectionFlipUpdates(editor: Editor, axis: ShapeSelectionFlipAxis): ShapeUpdate[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type StoreHistoryEntry, type StoreHistoryState } from "../../store/index";
|
|
2
2
|
import { type DocumentRecord } from "../schema/records";
|
|
3
|
-
import type { Editor } from "./
|
|
3
|
+
import type { Editor } from "./editor";
|
|
4
4
|
export type HistoryState = StoreHistoryState;
|
|
5
5
|
export declare class HistoryManager {
|
|
6
6
|
private readonly editor;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export { Editor } from "./
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
1
|
+
export { Editor } from "./editor";
|
|
2
|
+
export { createEditorWithPlugins, type CreateEditorWithPluginsOptions, } from "./createEditorWithPlugins";
|
|
3
|
+
export { StateNode } from "./stateNode";
|
|
4
|
+
export { HistoryManager } from "./historyManager";
|
|
5
|
+
export { InputsManager } from "./managers/inputsManager";
|
|
6
|
+
export { QueryManager } from "./managers/queryManager";
|
|
7
|
+
export { ShortcutManager, formatKeyboardShortcut, normalizeKeyboardShortcut, } from "./managers/shortcutManager";
|
|
8
|
+
export type { EditorKeyboardShortcutCommand, KeyboardShortcutBinding, KeyboardShortcutChord, KeyboardShortcutEventLike, KeyboardShortcutInput, KeyboardShortcutTarget, } from "./managers/shortcutManager";
|
|
9
|
+
export { SpatialIndexManager, type ShapeAtPointOptions, type SpatialQueryOptions, } from "./managers/spatialIndexManager";
|
|
10
|
+
export { ToolManager } from "./managers/toolManager";
|
|
8
11
|
export type { EditorEvent } from "./events";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChangeSource } from "../../store/index";
|
|
2
|
-
import type { Vec } from "../geometry/
|
|
2
|
+
import type { Vec } from "../geometry/vec";
|
|
3
3
|
import type { ShapeId, ShapeRecord } from "../schema/records";
|
|
4
|
-
import type { Editor } from "./
|
|
4
|
+
import type { Editor } from "./editor";
|
|
5
5
|
import type { EditorEvent } from "./events";
|
|
6
6
|
import type { SelectionHandle } from "./selection";
|
|
7
7
|
import type { HandleSnapContext, HandleSnapMode } from "./managers/snapTypes";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChangeSource } from "../../../store/index";
|
|
2
2
|
import { type BindingId, type BindingRecord, type ShapeId, type ShapeRecord } from "../../schema/records";
|
|
3
|
-
import type { Editor } from "../
|
|
3
|
+
import type { Editor } from "../editor";
|
|
4
4
|
export interface ShapeChangeEntry {
|
|
5
5
|
before: ShapeRecord;
|
|
6
6
|
after: ShapeRecord;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type Signal } from "../../../signals/index";
|
|
2
2
|
import type { ChangeSource } from "../../../store/index";
|
|
3
|
-
import { Vec } from "../../geometry/
|
|
3
|
+
import { Vec } from "../../geometry/vec";
|
|
4
4
|
import { type Camera } from "../../schema/records";
|
|
5
5
|
import type { PageId } from "../../schema/records";
|
|
6
|
-
import type { Editor } from "../
|
|
6
|
+
import type { Editor } from "../editor";
|
|
7
7
|
/**
|
|
8
8
|
* Camera and viewport-screen-size state for the editor. Owns the viewport size
|
|
9
9
|
* atom (viewport + camera together define the page<->screen transform) and the
|