@yuzhouu/canvas-kit 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_vendor/canvas-core/bindings/BindingUtil.d.ts +45 -0
- package/_vendor/canvas-core/bindings/BindingUtilRegistry.d.ts +8 -0
- package/_vendor/canvas-core/bindings/arrow/arrowBindingHelpers.d.ts +28 -0
- package/_vendor/canvas-core/contextMenu.d.ts +62 -0
- package/_vendor/canvas-core/editor/Editor.d.ts +564 -0
- package/_vendor/canvas-core/editor/HistoryManager.d.ts +18 -0
- package/_vendor/canvas-core/editor/StateNode.d.ts +31 -0
- package/_vendor/canvas-core/editor/camera.d.ts +3 -0
- package/_vendor/canvas-core/editor/clipboard.d.ts +43 -0
- package/_vendor/canvas-core/editor/commands.d.ts +126 -0
- package/_vendor/canvas-core/editor/edgeScroll.d.ts +5 -0
- package/_vendor/canvas-core/editor/editorComputedHelpers.d.ts +21 -0
- package/_vendor/canvas-core/editor/editorSelectionTransforms.d.ts +6 -0
- package/_vendor/canvas-core/editor/events.d.ts +71 -0
- package/_vendor/canvas-core/editor/{index.ts → index.d.ts} +1 -5
- package/_vendor/canvas-core/editor/interactions.d.ts +51 -0
- package/_vendor/canvas-core/editor/internal.d.ts +7 -0
- package/_vendor/canvas-core/editor/managers/BindingManager.d.ts +27 -0
- package/_vendor/canvas-core/editor/managers/CameraManager.d.ts +39 -0
- package/_vendor/canvas-core/editor/managers/ClipboardManager.d.ts +14 -0
- package/_vendor/canvas-core/editor/managers/DocumentSnapshotManager.d.ts +28 -0
- package/_vendor/canvas-core/editor/managers/InputsManager.d.ts +44 -0
- package/_vendor/canvas-core/editor/managers/InteractionTransientManager.d.ts +52 -0
- package/_vendor/canvas-core/editor/managers/QueryManager.d.ts +76 -0
- package/_vendor/canvas-core/editor/managers/RenderWindowManager.d.ts +25 -0
- package/_vendor/canvas-core/editor/managers/SelectionLayoutManager.d.ts +29 -0
- package/_vendor/canvas-core/editor/managers/SelectionManager.d.ts +21 -0
- package/_vendor/canvas-core/editor/managers/SelectionOverlayManager.d.ts +23 -0
- package/_vendor/canvas-core/editor/managers/ShapeEditingManager.d.ts +29 -0
- package/_vendor/canvas-core/editor/managers/ShapeGeometryManager.d.ts +42 -0
- package/_vendor/canvas-core/editor/managers/ShapeHierarchyManager.d.ts +58 -0
- package/_vendor/canvas-core/editor/managers/SideEffectManager.d.ts +23 -0
- package/_vendor/canvas-core/editor/managers/SnapManager.d.ts +29 -0
- package/_vendor/canvas-core/editor/managers/SnapSnapshotBuilder.d.ts +22 -0
- package/_vendor/canvas-core/editor/managers/SpatialIndexManager.d.ts +30 -0
- package/_vendor/canvas-core/editor/managers/ToolManager.d.ts +25 -0
- package/_vendor/canvas-core/editor/managers/queryState.d.ts +18 -0
- package/_vendor/canvas-core/editor/managers/selectionGeometry.d.ts +28 -0
- package/_vendor/canvas-core/editor/managers/shapeOrder.d.ts +14 -0
- package/_vendor/canvas-core/editor/managers/shapeReparenting.d.ts +6 -0
- package/_vendor/canvas-core/editor/managers/snapCalculations.d.ts +40 -0
- package/_vendor/canvas-core/editor/managers/snapGeometry.d.ts +26 -0
- package/_vendor/canvas-core/editor/managers/snapIndicators.d.ts +22 -0
- package/_vendor/canvas-core/editor/managers/snapTypes.d.ts +98 -0
- package/_vendor/canvas-core/editor/queries/shapeTransforms.d.ts +27 -0
- package/_vendor/canvas-core/editor/renderWindow.d.ts +30 -0
- package/_vendor/canvas-core/editor/resizeGeometry.d.ts +97 -0
- package/_vendor/canvas-core/editor/selection.d.ts +224 -0
- package/_vendor/canvas-core/editor/selectionHandleInteractions.d.ts +11 -0
- package/_vendor/canvas-core/editor/selectionOverlay.d.ts +31 -0
- package/_vendor/canvas-core/exports/integrity.d.ts +32 -0
- package/_vendor/canvas-core/exports/svg.d.ts +48 -0
- package/_vendor/canvas-core/geometry/Box.d.ts +19 -0
- package/_vendor/canvas-core/geometry/Ellipse2d.d.ts +16 -0
- package/_vendor/canvas-core/geometry/Geometry2d.d.ts +15 -0
- package/_vendor/canvas-core/geometry/Mat.d.ts +28 -0
- package/_vendor/canvas-core/geometry/Polyline2d.d.ts +14 -0
- package/_vendor/canvas-core/geometry/Rectangle2d.d.ts +16 -0
- package/_vendor/canvas-core/geometry/Vec.d.ts +37 -0
- package/_vendor/canvas-core/geometry/{index.ts → index.d.ts} +1 -6
- package/_vendor/canvas-core/geometry/segments.d.ts +5 -0
- package/_vendor/canvas-core/index.d.ts +57 -0
- package/_vendor/canvas-core/plugins/index.d.ts +1 -0
- package/_vendor/canvas-core/plugins/types.d.ts +27 -0
- package/_vendor/canvas-core/reactivity.d.ts +4 -0
- package/_vendor/canvas-core/schema/records.d.ts +112 -0
- package/_vendor/canvas-core/schema/snapshots.d.ts +27 -0
- package/_vendor/canvas-core/shapes/ShapeUtil.d.ts +133 -0
- package/_vendor/canvas-core/shapes/ShapeUtilRegistry.d.ts +9 -0
- package/_vendor/canvas-core/shapes/capabilities.d.ts +25 -0
- package/_vendor/canvas-core/shapes/types.d.ts +2 -0
- package/_vendor/canvas-core/toolbar.d.ts +117 -0
- package/_vendor/canvas-core/tools/hand/HandTool.d.ts +5 -0
- package/_vendor/canvas-core/tools/select/SelectTool.d.ts +5 -0
- package/_vendor/canvas-core/tools/select/selectContainment.d.ts +11 -0
- package/_vendor/canvas-core/tools/select/selectToolHelpers.d.ts +161 -0
- package/_vendor/canvas-core/tools/select/states/BrushingState.d.ts +19 -0
- package/_vendor/canvas-core/tools/select/states/DraggingSelectionHandleInteractionState.d.ts +15 -0
- package/_vendor/canvas-core/tools/select/states/IdleState.d.ts +8 -0
- package/_vendor/canvas-core/tools/select/states/PointingCanvasState.d.ts +11 -0
- package/_vendor/canvas-core/tools/select/states/PointingResizeHandleState.d.ts +10 -0
- package/_vendor/canvas-core/tools/select/states/PointingRotateHandleState.d.ts +10 -0
- package/_vendor/canvas-core/tools/select/states/PointingSelectionHandleInteractionState.d.ts +10 -0
- package/_vendor/canvas-core/tools/select/states/PointingShapeState.d.ts +12 -0
- package/_vendor/canvas-core/tools/select/states/ResizingState.d.ts +16 -0
- package/_vendor/canvas-core/tools/select/states/RotatingState.d.ts +14 -0
- package/_vendor/canvas-core/tools/select/states/SelectStateNode.d.ts +60 -0
- package/_vendor/canvas-core/tools/select/states/TranslatingState.d.ts +16 -0
- package/_vendor/canvas-plugin-api/feature.d.ts +37 -0
- package/_vendor/canvas-plugin-api/index.d.ts +57 -0
- package/_vendor/canvas-product-react/api/apiRegistry.d.ts +12 -0
- package/_vendor/canvas-product-react/api/canvasProductApi.d.ts +124 -0
- package/_vendor/canvas-product-react/api/index.d.ts +4 -0
- package/_vendor/canvas-product-react/capabilities/clipboard/clipboardService.d.ts +9 -0
- package/_vendor/canvas-product-react/capabilities/clipboard/systemClipboard.d.ts +16 -0
- package/_vendor/canvas-product-react/capabilities/context-menu/systemContextMenu.d.ts +17 -0
- package/_vendor/canvas-product-react/capabilities/context-menu/useContextMenuSurface.d.ts +12 -0
- package/_vendor/canvas-product-react/capabilities/export/useSvgExport.d.ts +29 -0
- package/_vendor/canvas-product-react/capabilities/history/useHistoryControls.d.ts +8 -0
- package/_vendor/canvas-product-react/capabilities/pages/usePageControls.d.ts +12 -0
- package/_vendor/canvas-product-react/capabilities/toolbar/systemToolbar.d.ts +32 -0
- package/_vendor/canvas-product-react/capabilities/toolbar/useToolbarSurfaces.d.ts +19 -0
- package/_vendor/canvas-product-react/capabilities/zoom/useZoomControls.d.ts +9 -0
- package/_vendor/canvas-product-react/index.d.ts +24 -0
- package/_vendor/canvas-product-react/persistence/index.d.ts +2 -0
- package/_vendor/canvas-product-react/persistence/localSnapshotPersistence.d.ts +40 -0
- package/_vendor/canvas-product-react/runtime/CanvasProductRoot.d.ts +4 -0
- package/_vendor/canvas-product-react/runtime/productDefinition.d.ts +45 -0
- package/_vendor/canvas-product-react/runtime/productServices.d.ts +31 -0
- package/_vendor/canvas-react/components/CanvasView.d.ts +11 -0
- package/_vendor/canvas-react/components/OverlayLayer.d.ts +1 -0
- package/_vendor/canvas-react/components/PageSpace.d.ts +6 -0
- package/_vendor/canvas-react/components/ShapeLayer.d.ts +1 -0
- package/_vendor/canvas-react/hooks/useEditor.d.ts +3 -0
- package/_vendor/canvas-react/hooks/useValue.d.ts +2 -0
- package/_vendor/canvas-react/host/CanvasRendererRegistryContext.d.ts +3 -0
- package/_vendor/canvas-react/host/contextMenuRegistry.d.ts +12 -0
- package/_vendor/canvas-react/host/domEventGuards.d.ts +11 -0
- package/_vendor/canvas-react/host/index.d.ts +8 -0
- package/_vendor/canvas-react/host/pluginHost.d.ts +93 -0
- package/_vendor/canvas-react/host/rendererRegistry.d.ts +12 -0
- package/_vendor/canvas-react/host/toolbarRegistry.d.ts +24 -0
- package/_vendor/plugin-arrow/ArrowBindingUtil.d.ts +27 -0
- package/_vendor/plugin-arrow/ArrowShapeUtil.d.ts +20 -0
- package/_vendor/plugin-arrow/ArrowTool.d.ts +4 -0
- package/_vendor/plugin-arrow/arrowGeometry.d.ts +50 -0
- package/_vendor/plugin-arrow/arrowTerminalBindingResolver.d.ts +21 -0
- package/_vendor/plugin-arrow/arrowTerminalCommands.d.ts +12 -0
- package/_vendor/plugin-arrow/canvas.d.ts +2 -0
- package/_vendor/plugin-arrow/core.d.ts +7 -0
- package/_vendor/plugin-arrow/feature.d.ts +3 -0
- package/_vendor/plugin-arrow/index.d.ts +11 -0
- package/_vendor/plugin-arrow/selectionHandleInteractions.d.ts +3 -0
- package/_vendor/plugin-arrow/types.d.ts +31 -0
- package/_vendor/plugin-draw/DrawShapeRenderer.d.ts +8 -0
- package/_vendor/plugin-draw/DrawShapeUtil.d.ts +21 -0
- package/_vendor/plugin-draw/DrawTool.d.ts +6 -0
- package/_vendor/plugin-draw/canvas.d.ts +2 -0
- package/_vendor/plugin-draw/core.d.ts +7 -0
- package/_vendor/plugin-draw/drawGeometry.d.ts +45 -0
- package/_vendor/plugin-draw/drawHitTest.d.ts +11 -0
- package/_vendor/plugin-draw/drawInterpolation.d.ts +5 -0
- package/_vendor/plugin-draw/drawPath.d.ts +37 -0
- package/_vendor/plugin-draw/drawSegments.d.ts +11 -0
- package/_vendor/plugin-draw/drawSelectionTransform.d.ts +18 -0
- package/_vendor/plugin-draw/drawShapeGeometry.d.ts +33 -0
- package/_vendor/plugin-draw/drawStrokeGeometry.d.ts +17 -0
- package/_vendor/plugin-draw/feature.d.ts +3 -0
- package/_vendor/plugin-draw/index.d.ts +13 -0
- package/_vendor/plugin-draw/types.d.ts +23 -0
- package/_vendor/plugin-eraser/EraserTool.d.ts +5 -0
- package/_vendor/plugin-eraser/canvas.d.ts +2 -0
- package/_vendor/plugin-eraser/core.d.ts +2 -0
- package/_vendor/plugin-eraser/feature.d.ts +3 -0
- package/_vendor/plugin-frame/FrameShapeUtil.d.ts +22 -0
- package/_vendor/plugin-frame/FrameTool.d.ts +6 -0
- package/_vendor/plugin-frame/canvas.d.ts +8 -0
- package/_vendor/plugin-frame/core.d.ts +7 -0
- package/_vendor/plugin-frame/feature.d.ts +3 -0
- package/_vendor/plugin-geo/GeoShapeUtil.d.ts +13 -0
- package/_vendor/plugin-geo/GeoTools.d.ts +17 -0
- package/_vendor/plugin-geo/canvas.d.ts +11 -0
- package/_vendor/plugin-geo/core.d.ts +7 -0
- package/_vendor/plugin-geo/feature.d.ts +3 -0
- package/_vendor/plugin-geo/types.d.ts +15 -0
- package/_vendor/plugin-group/GroupShapeUtil.d.ts +15 -0
- package/_vendor/plugin-group/canvas.d.ts +10 -0
- package/_vendor/plugin-group/core.d.ts +7 -0
- package/_vendor/plugin-group/feature.d.ts +3 -0
- package/_vendor/plugin-image/ImageShapeUtil.d.ts +10 -0
- package/_vendor/plugin-image/canvas.d.ts +2 -0
- package/_vendor/plugin-image/core.d.ts +16 -0
- package/_vendor/plugin-image/crop.d.ts +112 -0
- package/_vendor/plugin-image/cropInteractions.d.ts +3 -0
- package/_vendor/plugin-image/cropSession.d.ts +4 -0
- package/_vendor/plugin-image/feature.d.ts +3 -0
- package/_vendor/plugin-image/index.d.ts +8 -0
- package/_vendor/plugin-image/types.d.ts +37 -0
- package/_vendor/plugin-image-product-react/ImageImportController.d.ts +9 -0
- package/_vendor/plugin-image-product-react/imageAssetService.d.ts +7 -0
- package/_vendor/plugin-image-product-react/imageBlobStore.d.ts +25 -0
- package/_vendor/plugin-image-product-react/imageHostActions.d.ts +35 -0
- package/_vendor/plugin-image-product-react/imageProductApi.d.ts +21 -0
- package/_vendor/plugin-image-product-react/imageToolbarHostBridge.d.ts +14 -0
- package/_vendor/plugin-image-product-react/imageToolbarRuntime.d.ts +2 -0
- package/_vendor/plugin-image-product-react/index.d.ts +16 -0
- package/_vendor/plugin-image-product-react/snapshotGuards.d.ts +1 -0
- package/_vendor/plugin-image-product-react/svgImageAssetInliner.d.ts +3 -0
- package/_vendor/plugin-image-product-react/useImageImport.d.ts +16 -0
- package/_vendor/plugin-laser/LaserTool.d.ts +4 -0
- package/_vendor/plugin-laser/canvas.d.ts +2 -0
- package/_vendor/plugin-laser/core.d.ts +2 -0
- package/_vendor/plugin-laser/feature.d.ts +3 -0
- package/_vendor/plugin-text/ArrowLabelBindingUtil.d.ts +42 -0
- package/_vendor/plugin-text/GeoLabelBindingUtil.d.ts +45 -0
- package/_vendor/plugin-text/TextShapeSvgExporter.d.ts +6 -0
- package/_vendor/plugin-text/TextShapeUtil.d.ts +19 -0
- package/_vendor/plugin-text/TextTool.d.ts +4 -0
- package/_vendor/plugin-text/canvas.d.ts +2 -0
- package/_vendor/plugin-text/core.d.ts +2 -0
- package/_vendor/plugin-text/feature.d.ts +3 -0
- package/_vendor/plugin-text/host/RichTextEditingBox.d.ts +5 -0
- package/_vendor/plugin-text/host/RichTextToolbar.d.ts +6 -0
- package/_vendor/plugin-text/host/TiptapTextEditor.d.ts +24 -0
- package/_vendor/plugin-text/host/richTextRendering.d.ts +3 -0
- package/_vendor/plugin-text/host/textDomSelection.d.ts +7 -0
- package/_vendor/plugin-text/host/textEditingBoxStyle.d.ts +3 -0
- package/_vendor/plugin-text/host/textEntryFocus.d.ts +22 -0
- package/_vendor/plugin-text/host/textFontLoader.d.ts +2 -0
- package/_vendor/plugin-text/host/textMeasurement.d.ts +12 -0
- package/_vendor/plugin-text/host/textMeasurementSync.d.ts +10 -0
- package/_vendor/plugin-text/host/textRangeSelection.d.ts +14 -0
- package/_vendor/plugin-text/host/textShapeRendererRuntime.d.ts +8 -0
- package/_vendor/plugin-text/host/textShapeSync.d.ts +17 -0
- package/_vendor/plugin-text/host/tiptapTextEditorController.d.ts +33 -0
- package/_vendor/plugin-text/index.d.ts +4 -0
- package/_vendor/plugin-text/richTextUtils.d.ts +18 -0
- package/_vendor/plugin-text/textInteractions.d.ts +2 -0
- package/_vendor/plugin-text/textLabelHelpers.d.ts +44 -0
- package/_vendor/plugin-text/textShapeHelpers.d.ts +21 -0
- package/_vendor/plugin-text/textStyle.d.ts +9 -0
- package/_vendor/plugin-text/textTypes.d.ts +28 -0
- package/_vendor/signals/atom.d.ts +9 -0
- package/_vendor/signals/computed.d.ts +11 -0
- package/_vendor/signals/core.d.ts +17 -0
- package/_vendor/signals/effect.d.ts +29 -0
- package/_vendor/signals/types.d.ts +15 -0
- package/_vendor/store/Store.d.ts +26 -0
- package/_vendor/store/diff.d.ts +9 -0
- package/_vendor/store/history.d.ts +37 -0
- package/_vendor/store/index.d.ts +5 -0
- package/_vendor/store/types.d.ts +27 -0
- package/api/canvasKitApi.d.ts +2 -2
- package/index.css +1 -1
- package/index.d.ts +0 -1
- package/index.mjs +1 -1
- package/package.json +1 -1
- package/product/Shell.d.ts +2 -2
- package/product/chromeContext.d.ts +8 -8
- package/product/createCanvasKitEditor.d.ts +1 -1
- package/product/persistence.d.ts +1 -1
- package/product/product.d.ts +1 -1
- package/product/useCanvasClipboardShortcuts.d.ts +2 -2
- package/product-CxN5NN6u.mjs +4 -0
- package/product.mjs +1 -1
- package/standard/extensions.d.ts +1 -1
- package/standard/standardApi.d.ts +5 -5
- package/standard-R17_x8HU.mjs +44 -0
- package/standard.mjs +1 -1
- package/_vendor/canvas-core/bindings/BindingUtil.ts +0 -92
- package/_vendor/canvas-core/bindings/BindingUtilRegistry.ts +0 -22
- package/_vendor/canvas-core/bindings/arrow/arrowBindingHelpers.ts +0 -52
- package/_vendor/canvas-core/contextMenu.ts +0 -85
- package/_vendor/canvas-core/editor/Editor.ts +0 -2614
- package/_vendor/canvas-core/editor/HistoryManager.ts +0 -83
- package/_vendor/canvas-core/editor/StateNode.ts +0 -162
- package/_vendor/canvas-core/editor/camera.ts +0 -6
- package/_vendor/canvas-core/editor/clipboard.ts +0 -478
- package/_vendor/canvas-core/editor/commands.ts +0 -833
- package/_vendor/canvas-core/editor/edgeScroll.ts +0 -37
- package/_vendor/canvas-core/editor/editorComputedHelpers.ts +0 -257
- package/_vendor/canvas-core/editor/editorSelectionTransforms.ts +0 -116
- package/_vendor/canvas-core/editor/events.ts +0 -93
- package/_vendor/canvas-core/editor/interactions.ts +0 -101
- package/_vendor/canvas-core/editor/internal.ts +0 -22
- package/_vendor/canvas-core/editor/managers/BindingManager.ts +0 -262
- package/_vendor/canvas-core/editor/managers/CameraManager.ts +0 -147
- package/_vendor/canvas-core/editor/managers/ClipboardManager.ts +0 -32
- package/_vendor/canvas-core/editor/managers/DocumentSnapshotManager.ts +0 -256
- package/_vendor/canvas-core/editor/managers/InputsManager.ts +0 -319
- package/_vendor/canvas-core/editor/managers/InteractionTransientManager.ts +0 -218
- package/_vendor/canvas-core/editor/managers/QueryManager.ts +0 -837
- package/_vendor/canvas-core/editor/managers/RenderWindowManager.ts +0 -347
- package/_vendor/canvas-core/editor/managers/SelectionLayoutManager.ts +0 -196
- package/_vendor/canvas-core/editor/managers/SelectionManager.ts +0 -98
- package/_vendor/canvas-core/editor/managers/SelectionOverlayManager.ts +0 -308
- package/_vendor/canvas-core/editor/managers/ShapeEditingManager.ts +0 -226
- package/_vendor/canvas-core/editor/managers/ShapeGeometryManager.ts +0 -162
- package/_vendor/canvas-core/editor/managers/ShapeHierarchyManager.ts +0 -797
- package/_vendor/canvas-core/editor/managers/SideEffectManager.ts +0 -83
- package/_vendor/canvas-core/editor/managers/SnapManager.ts +0 -433
- package/_vendor/canvas-core/editor/managers/SnapSnapshotBuilder.ts +0 -430
- package/_vendor/canvas-core/editor/managers/SpatialIndexManager.ts +0 -354
- package/_vendor/canvas-core/editor/managers/ToolManager.ts +0 -81
- package/_vendor/canvas-core/editor/managers/queryState.ts +0 -583
- package/_vendor/canvas-core/editor/managers/selectionGeometry.ts +0 -287
- package/_vendor/canvas-core/editor/managers/shapeOrder.ts +0 -350
- package/_vendor/canvas-core/editor/managers/shapeReparenting.ts +0 -160
- package/_vendor/canvas-core/editor/managers/snapCalculations.ts +0 -412
- package/_vendor/canvas-core/editor/managers/snapGeometry.ts +0 -202
- package/_vendor/canvas-core/editor/managers/snapIndicators.ts +0 -403
- package/_vendor/canvas-core/editor/managers/snapTypes.ts +0 -122
- package/_vendor/canvas-core/editor/queries/shapeTransforms.ts +0 -171
- package/_vendor/canvas-core/editor/renderWindow.ts +0 -439
- package/_vendor/canvas-core/editor/resizeGeometry.ts +0 -654
- package/_vendor/canvas-core/editor/selection.ts +0 -489
- package/_vendor/canvas-core/editor/selectionHandleInteractions.ts +0 -43
- package/_vendor/canvas-core/editor/selectionOverlay.ts +0 -567
- package/_vendor/canvas-core/exports/integrity.ts +0 -174
- package/_vendor/canvas-core/exports/svg.ts +0 -494
- package/_vendor/canvas-core/geometry/Box.ts +0 -80
- package/_vendor/canvas-core/geometry/Ellipse2d.ts +0 -67
- package/_vendor/canvas-core/geometry/Geometry2d.ts +0 -52
- package/_vendor/canvas-core/geometry/Mat.ts +0 -92
- package/_vendor/canvas-core/geometry/Polyline2d.ts +0 -63
- package/_vendor/canvas-core/geometry/Rectangle2d.ts +0 -64
- package/_vendor/canvas-core/geometry/Vec.ts +0 -123
- package/_vendor/canvas-core/geometry/segments.ts +0 -65
- package/_vendor/canvas-core/index.ts +0 -391
- package/_vendor/canvas-core/plugins/index.ts +0 -5
- package/_vendor/canvas-core/plugins/types.ts +0 -53
- package/_vendor/canvas-core/reactivity.ts +0 -16
- package/_vendor/canvas-core/schema/records.ts +0 -221
- package/_vendor/canvas-core/schema/snapshots.ts +0 -527
- package/_vendor/canvas-core/shapes/ShapeUtil.ts +0 -516
- package/_vendor/canvas-core/shapes/ShapeUtilRegistry.ts +0 -26
- package/_vendor/canvas-core/shapes/capabilities.ts +0 -67
- package/_vendor/canvas-core/shapes/types.ts +0 -20
- package/_vendor/canvas-core/toolbar.ts +0 -148
- package/_vendor/canvas-core/tools/hand/HandTool.ts +0 -75
- package/_vendor/canvas-core/tools/select/SelectTool.ts +0 -33
- package/_vendor/canvas-core/tools/select/selectContainment.ts +0 -104
- package/_vendor/canvas-core/tools/select/selectToolHelpers.ts +0 -801
- package/_vendor/canvas-core/tools/select/states/BrushingState.ts +0 -145
- package/_vendor/canvas-core/tools/select/states/DraggingSelectionHandleInteractionState.ts +0 -116
- package/_vendor/canvas-core/tools/select/states/IdleState.ts +0 -159
- package/_vendor/canvas-core/tools/select/states/PointingCanvasState.ts +0 -41
- package/_vendor/canvas-core/tools/select/states/PointingResizeHandleState.ts +0 -78
- package/_vendor/canvas-core/tools/select/states/PointingRotateHandleState.ts +0 -64
- package/_vendor/canvas-core/tools/select/states/PointingSelectionHandleInteractionState.ts +0 -34
- package/_vendor/canvas-core/tools/select/states/PointingShapeState.ts +0 -140
- package/_vendor/canvas-core/tools/select/states/ResizingState.ts +0 -171
- package/_vendor/canvas-core/tools/select/states/RotatingState.ts +0 -124
- package/_vendor/canvas-core/tools/select/states/SelectStateNode.ts +0 -128
- package/_vendor/canvas-core/tools/select/states/TranslatingState.ts +0 -139
- package/_vendor/canvas-plugin-api/feature.ts +0 -204
- package/_vendor/canvas-plugin-api/index.ts +0 -142
- package/_vendor/canvas-product-react/api/apiRegistry.ts +0 -35
- package/_vendor/canvas-product-react/api/canvasProductApi.ts +0 -422
- package/_vendor/canvas-product-react/api/index.ts +0 -31
- package/_vendor/canvas-product-react/capabilities/clipboard/clipboardService.ts +0 -36
- package/_vendor/canvas-product-react/capabilities/clipboard/systemClipboard.ts +0 -245
- package/_vendor/canvas-product-react/capabilities/context-menu/systemContextMenu.ts +0 -396
- package/_vendor/canvas-product-react/capabilities/context-menu/useContextMenuSurface.ts +0 -59
- package/_vendor/canvas-product-react/capabilities/export/useSvgExport.ts +0 -156
- package/_vendor/canvas-product-react/capabilities/history/useHistoryControls.ts +0 -23
- package/_vendor/canvas-product-react/capabilities/pages/usePageControls.ts +0 -41
- package/_vendor/canvas-product-react/capabilities/toolbar/systemToolbar.ts +0 -490
- package/_vendor/canvas-product-react/capabilities/toolbar/useToolbarSurfaces.ts +0 -92
- package/_vendor/canvas-product-react/capabilities/zoom/useZoomControls.ts +0 -27
- package/_vendor/canvas-product-react/index.ts +0 -84
- package/_vendor/canvas-product-react/persistence/index.ts +0 -18
- package/_vendor/canvas-product-react/persistence/localSnapshotPersistence.ts +0 -294
- package/_vendor/canvas-product-react/runtime/CanvasProductRoot.tsx +0 -250
- package/_vendor/canvas-product-react/runtime/productDefinition.ts +0 -72
- package/_vendor/canvas-product-react/runtime/productServices.ts +0 -96
- package/_vendor/canvas-react/components/CanvasView.tsx +0 -796
- package/_vendor/canvas-react/components/OverlayLayer.tsx +0 -879
- package/_vendor/canvas-react/components/PageSpace.tsx +0 -34
- package/_vendor/canvas-react/components/ShapeLayer.tsx +0 -428
- package/_vendor/canvas-react/hooks/useEditor.ts +0 -11
- package/_vendor/canvas-react/hooks/useValue.ts +0 -14
- package/_vendor/canvas-react/host/CanvasRendererRegistryContext.tsx +0 -14
- package/_vendor/canvas-react/host/contextMenuRegistry.ts +0 -61
- package/_vendor/canvas-react/host/domEventGuards.ts +0 -61
- package/_vendor/canvas-react/host/index.ts +0 -38
- package/_vendor/canvas-react/host/pluginHost.ts +0 -635
- package/_vendor/canvas-react/host/rendererRegistry.tsx +0 -58
- package/_vendor/canvas-react/host/toolbarRegistry.ts +0 -100
- package/_vendor/plugin-arrow/ArrowBindingUtil.ts +0 -239
- package/_vendor/plugin-arrow/ArrowShapeUtil.ts +0 -311
- package/_vendor/plugin-arrow/ArrowTool.ts +0 -208
- package/_vendor/plugin-arrow/arrowGeometry.ts +0 -441
- package/_vendor/plugin-arrow/arrowTerminalBindingResolver.ts +0 -253
- package/_vendor/plugin-arrow/arrowTerminalCommands.ts +0 -230
- package/_vendor/plugin-arrow/canvas.tsx +0 -92
- package/_vendor/plugin-arrow/core.ts +0 -409
- package/_vendor/plugin-arrow/feature.ts +0 -20
- package/_vendor/plugin-arrow/index.ts +0 -28
- package/_vendor/plugin-arrow/selectionHandleInteractions.ts +0 -154
- package/_vendor/plugin-arrow/types.ts +0 -63
- package/_vendor/plugin-draw/DrawShapeRenderer.tsx +0 -60
- package/_vendor/plugin-draw/DrawShapeUtil.ts +0 -372
- package/_vendor/plugin-draw/DrawTool.ts +0 -444
- package/_vendor/plugin-draw/canvas.tsx +0 -24
- package/_vendor/plugin-draw/core.ts +0 -515
- package/_vendor/plugin-draw/drawGeometry.ts +0 -491
- package/_vendor/plugin-draw/drawHitTest.ts +0 -271
- package/_vendor/plugin-draw/drawInterpolation.ts +0 -250
- package/_vendor/plugin-draw/drawPath.ts +0 -550
- package/_vendor/plugin-draw/drawSegments.ts +0 -106
- package/_vendor/plugin-draw/drawSelectionTransform.ts +0 -67
- package/_vendor/plugin-draw/drawShapeGeometry.ts +0 -307
- package/_vendor/plugin-draw/drawStrokeGeometry.ts +0 -454
- package/_vendor/plugin-draw/feature.ts +0 -20
- package/_vendor/plugin-draw/index.ts +0 -31
- package/_vendor/plugin-draw/types.ts +0 -36
- package/_vendor/plugin-eraser/EraserTool.ts +0 -297
- package/_vendor/plugin-eraser/canvas.tsx +0 -616
- package/_vendor/plugin-eraser/core.ts +0 -49
- package/_vendor/plugin-eraser/feature.ts +0 -20
- package/_vendor/plugin-frame/FrameShapeUtil.ts +0 -173
- package/_vendor/plugin-frame/FrameTool.ts +0 -225
- package/_vendor/plugin-frame/canvas.tsx +0 -75
- package/_vendor/plugin-frame/core.ts +0 -534
- package/_vendor/plugin-frame/feature.ts +0 -20
- package/_vendor/plugin-geo/GeoShapeUtil.ts +0 -463
- package/_vendor/plugin-geo/GeoTools.ts +0 -247
- package/_vendor/plugin-geo/canvas.tsx +0 -90
- package/_vendor/plugin-geo/core.ts +0 -495
- package/_vendor/plugin-geo/feature.ts +0 -20
- package/_vendor/plugin-geo/types.ts +0 -27
- package/_vendor/plugin-group/GroupShapeUtil.ts +0 -59
- package/_vendor/plugin-group/canvas.tsx +0 -59
- package/_vendor/plugin-group/core.ts +0 -40
- package/_vendor/plugin-group/feature.ts +0 -20
- package/_vendor/plugin-image/ImageShapeUtil.ts +0 -95
- package/_vendor/plugin-image/canvas.tsx +0 -212
- package/_vendor/plugin-image/core.ts +0 -542
- package/_vendor/plugin-image/crop.ts +0 -770
- package/_vendor/plugin-image/cropInteractions.ts +0 -350
- package/_vendor/plugin-image/cropSession.ts +0 -38
- package/_vendor/plugin-image/feature.ts +0 -20
- package/_vendor/plugin-image/index.ts +0 -29
- package/_vendor/plugin-image/types.ts +0 -55
- package/_vendor/plugin-image-product-react/ImageImportController.tsx +0 -143
- package/_vendor/plugin-image-product-react/imageAssetService.ts +0 -52
- package/_vendor/plugin-image-product-react/imageBlobStore.ts +0 -315
- package/_vendor/plugin-image-product-react/imageHostActions.ts +0 -438
- package/_vendor/plugin-image-product-react/imageProductApi.ts +0 -88
- package/_vendor/plugin-image-product-react/imageToolbarHostBridge.ts +0 -48
- package/_vendor/plugin-image-product-react/imageToolbarRuntime.ts +0 -21
- package/_vendor/plugin-image-product-react/index.ts +0 -60
- package/_vendor/plugin-image-product-react/snapshotGuards.ts +0 -33
- package/_vendor/plugin-image-product-react/svgImageAssetInliner.ts +0 -54
- package/_vendor/plugin-image-product-react/useImageImport.ts +0 -64
- package/_vendor/plugin-laser/LaserTool.ts +0 -154
- package/_vendor/plugin-laser/canvas.tsx +0 -645
- package/_vendor/plugin-laser/core.ts +0 -49
- package/_vendor/plugin-laser/feature.ts +0 -20
- package/_vendor/plugin-text/ArrowLabelBindingUtil.ts +0 -336
- package/_vendor/plugin-text/GeoLabelBindingUtil.ts +0 -391
- package/_vendor/plugin-text/TextShapeSvgExporter.ts +0 -101
- package/_vendor/plugin-text/TextShapeUtil.ts +0 -284
- package/_vendor/plugin-text/TextTool.ts +0 -228
- package/_vendor/plugin-text/canvas.tsx +0 -115
- package/_vendor/plugin-text/core.ts +0 -422
- package/_vendor/plugin-text/feature.ts +0 -20
- package/_vendor/plugin-text/host/RichTextEditingBox.tsx +0 -144
- package/_vendor/plugin-text/host/RichTextToolbar.tsx +0 -266
- package/_vendor/plugin-text/host/TiptapTextEditor.tsx +0 -191
- package/_vendor/plugin-text/host/richTextRendering.tsx +0 -49
- package/_vendor/plugin-text/host/textDomSelection.ts +0 -93
- package/_vendor/plugin-text/host/textEditingBoxStyle.ts +0 -36
- package/_vendor/plugin-text/host/textEntryFocus.ts +0 -307
- package/_vendor/plugin-text/host/textFontLoader.ts +0 -149
- package/_vendor/plugin-text/host/textMeasurement.ts +0 -258
- package/_vendor/plugin-text/host/textMeasurementSync.ts +0 -77
- package/_vendor/plugin-text/host/textRangeSelection.ts +0 -134
- package/_vendor/plugin-text/host/textShapeRendererRuntime.tsx +0 -89
- package/_vendor/plugin-text/host/textShapeSync.ts +0 -173
- package/_vendor/plugin-text/host/tiptapTextEditorController.ts +0 -148
- package/_vendor/plugin-text/index.ts +0 -18
- package/_vendor/plugin-text/richTextUtils.ts +0 -259
- package/_vendor/plugin-text/textInteractions.ts +0 -366
- package/_vendor/plugin-text/textLabelHelpers.ts +0 -235
- package/_vendor/plugin-text/textShapeHelpers.ts +0 -123
- package/_vendor/plugin-text/textStyle.ts +0 -96
- package/_vendor/plugin-text/textTypes.ts +0 -48
- package/_vendor/signals/atom.ts +0 -74
- package/_vendor/signals/computed.ts +0 -132
- package/_vendor/signals/core.ts +0 -130
- package/_vendor/signals/effect.ts +0 -117
- package/_vendor/signals/types.ts +0 -17
- package/_vendor/store/Store.ts +0 -171
- package/_vendor/store/diff.ts +0 -229
- package/_vendor/store/history.ts +0 -177
- package/_vendor/store/index.ts +0 -32
- package/_vendor/store/types.ts +0 -37
- package/internal-modules.d.ts +0 -187
- package/product-iyBbEPIs.mjs +0 -4
- package/standard-BmrxwqpJ.mjs +0 -44
- /package/_vendor/canvas-core/tools/{index.ts → index.d.ts} +0 -0
- /package/_vendor/canvas-core/tools/select/states/{index.ts → index.d.ts} +0 -0
- /package/_vendor/canvas-react/components/{index.ts → index.d.ts} +0 -0
- /package/_vendor/canvas-react/{index.ts → index.d.ts} +0 -0
- /package/_vendor/plugin-eraser/{index.ts → index.d.ts} +0 -0
- /package/_vendor/plugin-frame/{index.ts → index.d.ts} +0 -0
- /package/_vendor/plugin-geo/{index.ts → index.d.ts} +0 -0
- /package/_vendor/plugin-group/{index.ts → index.d.ts} +0 -0
- /package/_vendor/plugin-laser/{index.ts → index.d.ts} +0 -0
- /package/_vendor/signals/{index.ts → index.d.ts} +0 -0
|
@@ -1,833 +0,0 @@
|
|
|
1
|
-
import type { Editor } from "./Editor";
|
|
2
|
-
import type { ChangeSource } from "@land/store";
|
|
3
|
-
import type {
|
|
4
|
-
AssetId,
|
|
5
|
-
AssetRecord,
|
|
6
|
-
AssetRecordBase,
|
|
7
|
-
BindingId,
|
|
8
|
-
BindingRecordBase,
|
|
9
|
-
BindingRecord,
|
|
10
|
-
Camera,
|
|
11
|
-
PageId,
|
|
12
|
-
PageRecord,
|
|
13
|
-
ShapeId,
|
|
14
|
-
ShapeParentId,
|
|
15
|
-
ShapeRecordBase,
|
|
16
|
-
ShapeRecord,
|
|
17
|
-
ShapeEditingEntryMode,
|
|
18
|
-
} from "../schema/records";
|
|
19
|
-
import { getEditorStore } from "./internal";
|
|
20
|
-
|
|
21
|
-
export interface EditorCommandOptions {
|
|
22
|
-
source?: ChangeSource;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface CreateShapeInput {
|
|
26
|
-
type: ShapeRecordBase["type"];
|
|
27
|
-
x: number;
|
|
28
|
-
y: number;
|
|
29
|
-
props?: Record<string, unknown>;
|
|
30
|
-
parentId?: ShapeParentId;
|
|
31
|
-
index?: string;
|
|
32
|
-
opacity?: number;
|
|
33
|
-
isHidden?: boolean;
|
|
34
|
-
rotation?: number;
|
|
35
|
-
scaleX?: number;
|
|
36
|
-
scaleY?: number;
|
|
37
|
-
isLocked?: boolean;
|
|
38
|
-
meta?: Record<string, unknown>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface CreateAssetInput {
|
|
42
|
-
id?: AssetId;
|
|
43
|
-
type: AssetRecordBase["type"];
|
|
44
|
-
props?: Record<string, unknown>;
|
|
45
|
-
meta?: Record<string, unknown>;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface UpdateAssetInput {
|
|
49
|
-
id: AssetId;
|
|
50
|
-
props?: Record<string, unknown>;
|
|
51
|
-
meta?: Record<string, unknown>;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface ShapeUpdate {
|
|
55
|
-
id: ShapeId;
|
|
56
|
-
x?: number;
|
|
57
|
-
y?: number;
|
|
58
|
-
rotation?: number;
|
|
59
|
-
scaleX?: number;
|
|
60
|
-
scaleY?: number;
|
|
61
|
-
isHidden?: boolean;
|
|
62
|
-
isLocked?: boolean;
|
|
63
|
-
parentId?: ShapeParentId;
|
|
64
|
-
index?: string;
|
|
65
|
-
props?: Record<string, unknown>;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface ReparentShapesInput {
|
|
69
|
-
ids: ShapeId[];
|
|
70
|
-
parentId: ShapeParentId;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export interface StartEditingShapeInput {
|
|
74
|
-
shapeId: ShapeId;
|
|
75
|
-
entryMode?: ShapeEditingEntryMode;
|
|
76
|
-
caretPagePoint?: { x: number; y: number };
|
|
77
|
-
markId?: string;
|
|
78
|
-
reuseExistingMark?: boolean;
|
|
79
|
-
preserveInteraction?: boolean;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface CreateBindingInput {
|
|
83
|
-
id?: BindingId;
|
|
84
|
-
type: BindingRecordBase["type"];
|
|
85
|
-
fromId: ShapeId;
|
|
86
|
-
toId: ShapeId;
|
|
87
|
-
props?: Record<string, unknown>;
|
|
88
|
-
meta?: Record<string, unknown>;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface UpdateBindingInput {
|
|
92
|
-
id: BindingId;
|
|
93
|
-
fromId?: ShapeId;
|
|
94
|
-
toId?: ShapeId;
|
|
95
|
-
props?: Record<string, unknown>;
|
|
96
|
-
meta?: Record<string, unknown>;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface CreatePageInput {
|
|
100
|
-
name?: string;
|
|
101
|
-
index?: string;
|
|
102
|
-
meta?: Record<string, unknown>;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface RenamePageInput {
|
|
106
|
-
id: PageId;
|
|
107
|
-
name: string;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export interface MovePageInput {
|
|
111
|
-
id: PageId;
|
|
112
|
-
toIndex: number;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface SetCameraInput {
|
|
116
|
-
pageId?: PageId;
|
|
117
|
-
camera: Partial<Camera>;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface EditorCommands {
|
|
121
|
-
createPage(
|
|
122
|
-
input?: CreatePageInput,
|
|
123
|
-
options?: EditorCommandOptions,
|
|
124
|
-
): PageRecord;
|
|
125
|
-
deletePage(id: PageId, options?: EditorCommandOptions): boolean;
|
|
126
|
-
renamePage(input: RenamePageInput, options?: EditorCommandOptions): void;
|
|
127
|
-
movePage(input: MovePageInput, options?: EditorCommandOptions): void;
|
|
128
|
-
createShapes(
|
|
129
|
-
inputs: CreateShapeInput[],
|
|
130
|
-
options?: EditorCommandOptions,
|
|
131
|
-
): ShapeRecord[];
|
|
132
|
-
/**
|
|
133
|
-
* Persist already-built shape records (with their existing ids) through the
|
|
134
|
-
* command pipeline. Used by paste/duplicate where ids must be assigned before
|
|
135
|
-
* parent/binding remapping. Prefer `createShapes` for fresh shapes.
|
|
136
|
-
*/
|
|
137
|
-
createShapesFromRecords(
|
|
138
|
-
records: ShapeRecord[],
|
|
139
|
-
options?: EditorCommandOptions,
|
|
140
|
-
): ShapeRecord[];
|
|
141
|
-
updateShapes(updates: ShapeUpdate[], options?: EditorCommandOptions): void;
|
|
142
|
-
reparentShapes(
|
|
143
|
-
input: ReparentShapesInput,
|
|
144
|
-
options?: EditorCommandOptions,
|
|
145
|
-
): void;
|
|
146
|
-
deleteShapes(ids: ShapeId[], options?: EditorCommandOptions): void;
|
|
147
|
-
createAsset(
|
|
148
|
-
input: CreateAssetInput,
|
|
149
|
-
options?: EditorCommandOptions,
|
|
150
|
-
): AssetRecord;
|
|
151
|
-
/**
|
|
152
|
-
* Persist already-built asset records (with their existing ids) through the
|
|
153
|
-
* command pipeline. Used by paste/duplicate. Prefer `createAsset` otherwise.
|
|
154
|
-
*/
|
|
155
|
-
createAssetsFromRecords(
|
|
156
|
-
records: AssetRecord[],
|
|
157
|
-
options?: EditorCommandOptions,
|
|
158
|
-
): AssetRecord[];
|
|
159
|
-
updateAsset(
|
|
160
|
-
input: UpdateAssetInput,
|
|
161
|
-
options?: EditorCommandOptions,
|
|
162
|
-
): AssetRecord | null;
|
|
163
|
-
deleteAsset(id: AssetId, options?: EditorCommandOptions): boolean;
|
|
164
|
-
createBinding(
|
|
165
|
-
input: CreateBindingInput,
|
|
166
|
-
options?: EditorCommandOptions,
|
|
167
|
-
): BindingRecord;
|
|
168
|
-
updateBinding(
|
|
169
|
-
input: UpdateBindingInput,
|
|
170
|
-
options?: EditorCommandOptions,
|
|
171
|
-
): BindingRecord | null;
|
|
172
|
-
deleteBinding(id: BindingId, options?: EditorCommandOptions): boolean;
|
|
173
|
-
setCurrentPageId(id: PageId, options?: EditorCommandOptions): void;
|
|
174
|
-
setCamera(input: SetCameraInput, options?: EditorCommandOptions): void;
|
|
175
|
-
setSelectedShapeIds(ids: ShapeId[], options?: EditorCommandOptions): void;
|
|
176
|
-
setActiveTool(toolId: string, options?: EditorCommandOptions): void;
|
|
177
|
-
setToolLocked(locked: boolean, options?: EditorCommandOptions): void;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export function createEditorCommands(editor: Editor): EditorCommands {
|
|
181
|
-
return {
|
|
182
|
-
createPage(input, options) {
|
|
183
|
-
return createPage(editor, input, options);
|
|
184
|
-
},
|
|
185
|
-
deletePage(id, options) {
|
|
186
|
-
return deletePage(editor, id, options);
|
|
187
|
-
},
|
|
188
|
-
renamePage(input, options) {
|
|
189
|
-
renamePage(editor, input, options);
|
|
190
|
-
},
|
|
191
|
-
movePage(input, options) {
|
|
192
|
-
movePage(editor, input, options);
|
|
193
|
-
},
|
|
194
|
-
createShapes(inputs, options) {
|
|
195
|
-
return createShapes(editor, inputs, options);
|
|
196
|
-
},
|
|
197
|
-
createShapesFromRecords(records, options) {
|
|
198
|
-
return createShapesFromRecords(editor, records, options);
|
|
199
|
-
},
|
|
200
|
-
updateShapes(updates, options) {
|
|
201
|
-
updateShapes(editor, updates, options);
|
|
202
|
-
},
|
|
203
|
-
reparentShapes(input, options) {
|
|
204
|
-
reparentShapes(editor, input, options);
|
|
205
|
-
},
|
|
206
|
-
deleteShapes(ids, options) {
|
|
207
|
-
deleteShapes(editor, ids, options);
|
|
208
|
-
},
|
|
209
|
-
createAsset(input, options) {
|
|
210
|
-
return createAsset(editor, input, options);
|
|
211
|
-
},
|
|
212
|
-
createAssetsFromRecords(records, options) {
|
|
213
|
-
return createAssetsFromRecords(editor, records, options);
|
|
214
|
-
},
|
|
215
|
-
updateAsset(input, options) {
|
|
216
|
-
return updateAsset(editor, input, options);
|
|
217
|
-
},
|
|
218
|
-
deleteAsset(id, options) {
|
|
219
|
-
return deleteAsset(editor, id, options);
|
|
220
|
-
},
|
|
221
|
-
createBinding(input, options) {
|
|
222
|
-
return createBinding(editor, input, options);
|
|
223
|
-
},
|
|
224
|
-
updateBinding(input, options) {
|
|
225
|
-
return updateBinding(editor, input, options);
|
|
226
|
-
},
|
|
227
|
-
deleteBinding(id, options) {
|
|
228
|
-
return deleteBinding(editor, id, options);
|
|
229
|
-
},
|
|
230
|
-
setCurrentPageId(id, options) {
|
|
231
|
-
setCurrentPageId(editor, id, options);
|
|
232
|
-
},
|
|
233
|
-
setCamera(input, options) {
|
|
234
|
-
setCamera(editor, input, options);
|
|
235
|
-
},
|
|
236
|
-
setSelectedShapeIds(ids, options) {
|
|
237
|
-
setSelectedShapeIds(editor, ids, options);
|
|
238
|
-
},
|
|
239
|
-
setActiveTool(toolId, options) {
|
|
240
|
-
setActiveTool(editor, toolId, options);
|
|
241
|
-
},
|
|
242
|
-
setToolLocked(locked, options) {
|
|
243
|
-
setToolLocked(editor, locked, options);
|
|
244
|
-
},
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function normalizePageOrder(pages: PageRecord[]): PageRecord[] {
|
|
249
|
-
return pages.map((page, index) => ({
|
|
250
|
-
...page,
|
|
251
|
-
index: String(index + 1).padStart(4, "0"),
|
|
252
|
-
}));
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function createPage(
|
|
256
|
-
editor: Editor,
|
|
257
|
-
input?: CreatePageInput,
|
|
258
|
-
options?: EditorCommandOptions,
|
|
259
|
-
): PageRecord {
|
|
260
|
-
const source = options?.source ?? "user";
|
|
261
|
-
const nextPage = editor.createPageRecord(input);
|
|
262
|
-
let createdPage = nextPage;
|
|
263
|
-
|
|
264
|
-
getEditorStore(editor).atomic(() => {
|
|
265
|
-
const pages = normalizePageOrder([...editor.getPages(), nextPage]);
|
|
266
|
-
createdPage = pages.find((page) => page.id === nextPage.id) ?? nextPage;
|
|
267
|
-
getEditorStore(editor).put(pages, source);
|
|
268
|
-
editor.ensurePageSessionState(createdPage.id, source);
|
|
269
|
-
}, source);
|
|
270
|
-
|
|
271
|
-
return createdPage;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
function deletePage(
|
|
275
|
-
editor: Editor,
|
|
276
|
-
id: PageId,
|
|
277
|
-
options?: EditorCommandOptions,
|
|
278
|
-
): boolean {
|
|
279
|
-
const source = options?.source ?? "user";
|
|
280
|
-
const pages = editor.getPages();
|
|
281
|
-
if (pages.length <= 1) {
|
|
282
|
-
return false;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
const pageIndex = pages.findIndex((page) => page.id === id);
|
|
286
|
-
if (pageIndex < 0) {
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
const shapeIds = editor.getShapesForPage(id).map((shape) => shape.id);
|
|
291
|
-
const nextPages = normalizePageOrder(pages.filter((page) => page.id !== id));
|
|
292
|
-
const fallbackPageId =
|
|
293
|
-
pages[pageIndex + 1]?.id ?? pages[pageIndex - 1]?.id ?? pages[0]?.id;
|
|
294
|
-
const nextCurrentPageId =
|
|
295
|
-
editor.getCurrentPageId() === id && fallbackPageId
|
|
296
|
-
? fallbackPageId
|
|
297
|
-
: editor.getCurrentPageId();
|
|
298
|
-
|
|
299
|
-
getEditorStore(editor).atomic(() => {
|
|
300
|
-
if (shapeIds.length > 0) {
|
|
301
|
-
deleteShapes(editor, shapeIds, options);
|
|
302
|
-
}
|
|
303
|
-
getEditorStore(editor).remove([id], source);
|
|
304
|
-
editor.removePageSessionState(id, nextCurrentPageId, source);
|
|
305
|
-
getEditorStore(editor).put(nextPages, source);
|
|
306
|
-
}, source);
|
|
307
|
-
|
|
308
|
-
return true;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
function renamePage(
|
|
312
|
-
editor: Editor,
|
|
313
|
-
input: RenamePageInput,
|
|
314
|
-
options?: EditorCommandOptions,
|
|
315
|
-
): void {
|
|
316
|
-
const source = options?.source ?? "user";
|
|
317
|
-
const current = editor.getPage(input.id);
|
|
318
|
-
if (!current) {
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
const name = input.name.trim();
|
|
323
|
-
if (!name || name === current.name) {
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
getEditorStore(editor).atomic(() => {
|
|
328
|
-
getEditorStore(editor).put([{ ...current, name }], source);
|
|
329
|
-
}, source);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
function movePage(
|
|
333
|
-
editor: Editor,
|
|
334
|
-
input: MovePageInput,
|
|
335
|
-
options?: EditorCommandOptions,
|
|
336
|
-
): void {
|
|
337
|
-
const source = options?.source ?? "user";
|
|
338
|
-
const pages = editor.getPages();
|
|
339
|
-
const fromIndex = pages.findIndex((page) => page.id === input.id);
|
|
340
|
-
if (fromIndex < 0) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
const toIndex = Math.max(0, Math.min(input.toIndex, pages.length - 1));
|
|
345
|
-
if (fromIndex === toIndex) {
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
const nextPages = [...pages];
|
|
350
|
-
const [movedPage] = nextPages.splice(fromIndex, 1);
|
|
351
|
-
if (!movedPage) {
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
nextPages.splice(toIndex, 0, movedPage);
|
|
355
|
-
|
|
356
|
-
getEditorStore(editor).atomic(() => {
|
|
357
|
-
getEditorStore(editor).put(normalizePageOrder(nextPages), source);
|
|
358
|
-
}, source);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
function createShapes(
|
|
362
|
-
editor: Editor,
|
|
363
|
-
inputs: CreateShapeInput[],
|
|
364
|
-
options?: EditorCommandOptions,
|
|
365
|
-
): ShapeRecord[] {
|
|
366
|
-
const created: ShapeRecord[] = [];
|
|
367
|
-
const source = options?.source ?? "user";
|
|
368
|
-
|
|
369
|
-
getEditorStore(editor).atomic(() => {
|
|
370
|
-
const records = inputs.map((input) => {
|
|
371
|
-
const record = editor.createShapeRecord(input);
|
|
372
|
-
if (source !== "user" || input.parentId) {
|
|
373
|
-
return record;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
const parentId = editor.getContainingParentIdForShapeRecord(record);
|
|
377
|
-
return parentId && parentId !== record.parentId
|
|
378
|
-
? ({ ...record, parentId } as ShapeRecord)
|
|
379
|
-
: record;
|
|
380
|
-
});
|
|
381
|
-
created.push(...records);
|
|
382
|
-
getEditorStore(editor).put(records, source);
|
|
383
|
-
}, source);
|
|
384
|
-
|
|
385
|
-
return created;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
function createShapesFromRecords(
|
|
389
|
-
editor: Editor,
|
|
390
|
-
records: ShapeRecord[],
|
|
391
|
-
options?: EditorCommandOptions,
|
|
392
|
-
): ShapeRecord[] {
|
|
393
|
-
const source = options?.source ?? "user";
|
|
394
|
-
if (records.length === 0) {
|
|
395
|
-
return [];
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
getEditorStore(editor).atomic(() => {
|
|
399
|
-
getEditorStore(editor).put(records, source);
|
|
400
|
-
}, source);
|
|
401
|
-
|
|
402
|
-
return records;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
export function reparentShapeToContainingParent(
|
|
406
|
-
editor: Editor,
|
|
407
|
-
shapeId: ShapeId,
|
|
408
|
-
options?: EditorCommandOptions,
|
|
409
|
-
): void {
|
|
410
|
-
const shape = editor.getShape(shapeId);
|
|
411
|
-
if (!shape) {
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
const parentId = editor.getContainingParentIdForShapeRecord(shape);
|
|
416
|
-
if (!parentId || parentId === shape.parentId) {
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
editor.commands.reparentShapes({ ids: [shapeId], parentId }, options);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
function updateShapes(
|
|
424
|
-
editor: Editor,
|
|
425
|
-
updates: ShapeUpdate[],
|
|
426
|
-
options?: EditorCommandOptions,
|
|
427
|
-
): void {
|
|
428
|
-
const source = options?.source ?? "user";
|
|
429
|
-
|
|
430
|
-
getEditorStore(editor).atomic(() => {
|
|
431
|
-
const nextRecords: ShapeRecord[] = [];
|
|
432
|
-
const changes: Array<{ before: ShapeRecord; after: ShapeRecord }> = [];
|
|
433
|
-
for (const update of updates) {
|
|
434
|
-
const current = editor.getShape(update.id);
|
|
435
|
-
if (!current) continue;
|
|
436
|
-
|
|
437
|
-
const nextX = update.x ?? current.x;
|
|
438
|
-
const nextY = update.y ?? current.y;
|
|
439
|
-
const nextRotation = update.rotation ?? current.rotation;
|
|
440
|
-
const nextScaleX = update.scaleX ?? current.scaleX;
|
|
441
|
-
const nextScaleY = update.scaleY ?? current.scaleY;
|
|
442
|
-
const nextIsHidden = update.isHidden ?? current.isHidden;
|
|
443
|
-
const nextIsLocked = update.isLocked ?? current.isLocked;
|
|
444
|
-
const nextParentId = update.parentId ?? current.parentId;
|
|
445
|
-
const nextIndex = update.index ?? current.index;
|
|
446
|
-
|
|
447
|
-
if (!editor.canUseShapeParent(nextParentId, current.id)) {
|
|
448
|
-
throw new Error(`Invalid parent id for shape ${current.id}`);
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
if (
|
|
452
|
-
!update.props &&
|
|
453
|
-
nextX === current.x &&
|
|
454
|
-
nextY === current.y &&
|
|
455
|
-
nextRotation === current.rotation &&
|
|
456
|
-
nextScaleX === current.scaleX &&
|
|
457
|
-
nextScaleY === current.scaleY &&
|
|
458
|
-
nextIsHidden === current.isHidden &&
|
|
459
|
-
nextIsLocked === current.isLocked &&
|
|
460
|
-
nextParentId === current.parentId &&
|
|
461
|
-
nextIndex === current.index
|
|
462
|
-
) {
|
|
463
|
-
continue;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
const util = editor.shapeUtils.get(current.type);
|
|
467
|
-
const nextRecord: ShapeRecord = {
|
|
468
|
-
...current,
|
|
469
|
-
x: nextX,
|
|
470
|
-
y: nextY,
|
|
471
|
-
rotation: nextRotation,
|
|
472
|
-
scaleX: nextScaleX,
|
|
473
|
-
scaleY: nextScaleY,
|
|
474
|
-
isHidden: nextIsHidden,
|
|
475
|
-
isLocked: nextIsLocked,
|
|
476
|
-
parentId: nextParentId,
|
|
477
|
-
index: nextIndex,
|
|
478
|
-
props: update.props
|
|
479
|
-
? util.validateProps({
|
|
480
|
-
...current.props,
|
|
481
|
-
...update.props,
|
|
482
|
-
})
|
|
483
|
-
: current.props,
|
|
484
|
-
} as ShapeRecord;
|
|
485
|
-
nextRecords.push(nextRecord);
|
|
486
|
-
changes.push({ before: current, after: nextRecord });
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
if (nextRecords.length === 0) {
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
getEditorStore(editor).put(nextRecords, source);
|
|
494
|
-
editor.bindings.handleShapeChanges(changes, source);
|
|
495
|
-
syncTransformDescendantAncestorBounds(editor, changes, source);
|
|
496
|
-
}, source);
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
function syncTransformDescendantAncestorBounds(
|
|
500
|
-
editor: Editor,
|
|
501
|
-
changes: Array<{ before: ShapeRecord; after: ShapeRecord }>,
|
|
502
|
-
source: ChangeSource,
|
|
503
|
-
): void {
|
|
504
|
-
const changedIds = new Set(changes.map((change) => change.after.id));
|
|
505
|
-
const ancestorIds = new Set<ShapeId>();
|
|
506
|
-
for (const change of changes) {
|
|
507
|
-
collectTransformDescendantAncestorIds(editor, change.before, ancestorIds);
|
|
508
|
-
collectTransformDescendantAncestorIds(editor, change.after, ancestorIds);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
const updates: ShapeRecord[] = [];
|
|
512
|
-
const bindingChanges: Array<{ before: ShapeRecord; after: ShapeRecord }> = [];
|
|
513
|
-
for (const ancestorId of ancestorIds) {
|
|
514
|
-
if (changedIds.has(ancestorId)) {
|
|
515
|
-
continue;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
const ancestor = editor.getShape(ancestorId);
|
|
519
|
-
if (!ancestor || ancestor.rotation !== 0 || ancestor.scaleX !== 1 || ancestor.scaleY !== 1) {
|
|
520
|
-
continue;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
const bounds = editor.getDescendantPageBounds(ancestor.id);
|
|
524
|
-
if (!bounds) {
|
|
525
|
-
continue;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
const props = ancestor.props as Record<string, unknown>;
|
|
529
|
-
if (typeof props.w !== "number" || typeof props.h !== "number") {
|
|
530
|
-
continue;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
if (
|
|
534
|
-
ancestor.x === bounds.x &&
|
|
535
|
-
ancestor.y === bounds.y &&
|
|
536
|
-
props.w === bounds.w &&
|
|
537
|
-
props.h === bounds.h
|
|
538
|
-
) {
|
|
539
|
-
continue;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
const util = editor.shapeUtils.get(ancestor.type);
|
|
543
|
-
const nextRecord = {
|
|
544
|
-
...ancestor,
|
|
545
|
-
x: bounds.x,
|
|
546
|
-
y: bounds.y,
|
|
547
|
-
props: util.validateProps({
|
|
548
|
-
...props,
|
|
549
|
-
w: bounds.w,
|
|
550
|
-
h: bounds.h,
|
|
551
|
-
}),
|
|
552
|
-
} as ShapeRecord;
|
|
553
|
-
updates.push(nextRecord);
|
|
554
|
-
bindingChanges.push({ before: ancestor, after: nextRecord });
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
if (updates.length === 0) {
|
|
558
|
-
return;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
getEditorStore(editor).put(updates, source);
|
|
562
|
-
editor.bindings.handleShapeChanges(bindingChanges, source);
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
function collectTransformDescendantAncestorIds(
|
|
566
|
-
editor: Editor,
|
|
567
|
-
shape: ShapeRecord,
|
|
568
|
-
ids: Set<ShapeId>,
|
|
569
|
-
): void {
|
|
570
|
-
const seen = new Set<ShapeId>([shape.id]);
|
|
571
|
-
let parentId = shape.parentId;
|
|
572
|
-
while (parentId.startsWith("shape:")) {
|
|
573
|
-
const parent = editor.getShape(parentId as ShapeId);
|
|
574
|
-
if (!parent || seen.has(parent.id)) {
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
seen.add(parent.id);
|
|
578
|
-
if (editor.getShapeUtil(parent).shouldTransformDescendants(parent)) {
|
|
579
|
-
ids.add(parent.id);
|
|
580
|
-
}
|
|
581
|
-
parentId = parent.parentId;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
function reparentShapes(
|
|
586
|
-
editor: Editor,
|
|
587
|
-
input: ReparentShapesInput,
|
|
588
|
-
options?: EditorCommandOptions,
|
|
589
|
-
): void {
|
|
590
|
-
const ids = Array.from(new Set(input.ids));
|
|
591
|
-
if (ids.length === 0) {
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
updateShapes(
|
|
596
|
-
editor,
|
|
597
|
-
ids.map((id) => ({ id, parentId: input.parentId })),
|
|
598
|
-
options,
|
|
599
|
-
);
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
function deleteShapes(
|
|
603
|
-
editor: Editor,
|
|
604
|
-
ids: ShapeId[],
|
|
605
|
-
options?: EditorCommandOptions,
|
|
606
|
-
): void {
|
|
607
|
-
const source = options?.source ?? "user";
|
|
608
|
-
const idsWithDescendants = editor.getShapeIdsIncludingDescendants(ids);
|
|
609
|
-
const assetIdsToCleanup = editor.getUnreferencedAssetIdsAfterShapeDelete(
|
|
610
|
-
idsWithDescendants,
|
|
611
|
-
);
|
|
612
|
-
|
|
613
|
-
getEditorStore(editor).atomic(() => {
|
|
614
|
-
editor.sideEffects.runBeforeDelete(
|
|
615
|
-
"shape",
|
|
616
|
-
idsWithDescendants,
|
|
617
|
-
source,
|
|
618
|
-
);
|
|
619
|
-
getEditorStore(editor).remove(idsWithDescendants, source);
|
|
620
|
-
if (assetIdsToCleanup.length > 0) {
|
|
621
|
-
getEditorStore(editor).remove(assetIdsToCleanup, source);
|
|
622
|
-
}
|
|
623
|
-
editor.sideEffects.runAfterDelete("shape", idsWithDescendants, source);
|
|
624
|
-
}, source);
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
function createAsset(
|
|
628
|
-
editor: Editor,
|
|
629
|
-
input: CreateAssetInput,
|
|
630
|
-
options?: EditorCommandOptions,
|
|
631
|
-
): AssetRecord {
|
|
632
|
-
const source = options?.source ?? "user";
|
|
633
|
-
const asset = editor.createAssetRecord(input);
|
|
634
|
-
|
|
635
|
-
getEditorStore(editor).atomic(() => {
|
|
636
|
-
getEditorStore(editor).put([asset], source);
|
|
637
|
-
}, source);
|
|
638
|
-
|
|
639
|
-
return asset;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
function createAssetsFromRecords(
|
|
643
|
-
editor: Editor,
|
|
644
|
-
records: AssetRecord[],
|
|
645
|
-
options?: EditorCommandOptions,
|
|
646
|
-
): AssetRecord[] {
|
|
647
|
-
const source = options?.source ?? "user";
|
|
648
|
-
if (records.length === 0) {
|
|
649
|
-
return [];
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
getEditorStore(editor).atomic(() => {
|
|
653
|
-
getEditorStore(editor).put(records, source);
|
|
654
|
-
}, source);
|
|
655
|
-
|
|
656
|
-
return records;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
function updateAsset(
|
|
660
|
-
editor: Editor,
|
|
661
|
-
input: UpdateAssetInput,
|
|
662
|
-
options?: EditorCommandOptions,
|
|
663
|
-
): AssetRecord | null {
|
|
664
|
-
const source = options?.source ?? "user";
|
|
665
|
-
const current = editor.getAsset(input.id);
|
|
666
|
-
if (!current) {
|
|
667
|
-
return null;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
const next: AssetRecord = {
|
|
671
|
-
...current,
|
|
672
|
-
props: input.props ? { ...current.props, ...input.props } : current.props,
|
|
673
|
-
meta: input.meta ?? current.meta,
|
|
674
|
-
};
|
|
675
|
-
|
|
676
|
-
getEditorStore(editor).atomic(() => {
|
|
677
|
-
getEditorStore(editor).put([next], source);
|
|
678
|
-
}, source);
|
|
679
|
-
|
|
680
|
-
return next;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
function deleteAsset(
|
|
684
|
-
editor: Editor,
|
|
685
|
-
id: AssetId,
|
|
686
|
-
options?: EditorCommandOptions,
|
|
687
|
-
): boolean {
|
|
688
|
-
const source = options?.source ?? "user";
|
|
689
|
-
if (!editor.getAsset(id)) {
|
|
690
|
-
return false;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
getEditorStore(editor).atomic(() => {
|
|
694
|
-
getEditorStore(editor).remove([id], source);
|
|
695
|
-
}, source);
|
|
696
|
-
|
|
697
|
-
return true;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
function canWriteBinding(editor: Editor, binding: BindingRecord): boolean {
|
|
701
|
-
return editor.bindings.canBind(binding);
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
function createBinding(
|
|
705
|
-
editor: Editor,
|
|
706
|
-
input: CreateBindingInput,
|
|
707
|
-
options?: EditorCommandOptions,
|
|
708
|
-
): BindingRecord {
|
|
709
|
-
const source = options?.source ?? "user";
|
|
710
|
-
const binding = editor.createBindingRecord(input);
|
|
711
|
-
if (!canWriteBinding(editor, binding)) {
|
|
712
|
-
throw new Error(`Invalid binding endpoints for ${binding.type} binding`);
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
getEditorStore(editor).atomic(() => {
|
|
716
|
-
const conflictingIds = editor.bindings
|
|
717
|
-
.getConflictingBindings(binding)
|
|
718
|
-
.map((candidate) => candidate.id);
|
|
719
|
-
if (conflictingIds.length > 0) {
|
|
720
|
-
editor.bindings.cleanupBindings(conflictingIds, source);
|
|
721
|
-
}
|
|
722
|
-
getEditorStore(editor).put([binding], source);
|
|
723
|
-
editor.bindings.syncCreatedBinding(binding, source);
|
|
724
|
-
}, source);
|
|
725
|
-
|
|
726
|
-
return binding;
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
function updateBinding(
|
|
730
|
-
editor: Editor,
|
|
731
|
-
input: UpdateBindingInput,
|
|
732
|
-
options?: EditorCommandOptions,
|
|
733
|
-
): BindingRecord | null {
|
|
734
|
-
const source = options?.source ?? "user";
|
|
735
|
-
const current = editor.getBinding(input.id);
|
|
736
|
-
if (!current) {
|
|
737
|
-
return null;
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
const util = editor.getBindingUtil(current);
|
|
741
|
-
const next: BindingRecord = {
|
|
742
|
-
...current,
|
|
743
|
-
fromId: input.fromId ?? current.fromId,
|
|
744
|
-
toId: input.toId ?? current.toId,
|
|
745
|
-
props: input.props
|
|
746
|
-
? util.validateProps({ ...current.props, ...input.props })
|
|
747
|
-
: current.props,
|
|
748
|
-
meta: input.meta ?? current.meta,
|
|
749
|
-
};
|
|
750
|
-
if (!canWriteBinding(editor, next)) {
|
|
751
|
-
throw new Error(`Invalid binding endpoints for ${next.type} binding`);
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
getEditorStore(editor).atomic(() => {
|
|
755
|
-
const conflictingIds = editor.bindings
|
|
756
|
-
.getConflictingBindings(next)
|
|
757
|
-
.map((candidate) => candidate.id);
|
|
758
|
-
if (conflictingIds.length > 0) {
|
|
759
|
-
editor.bindings.cleanupBindings(conflictingIds, source);
|
|
760
|
-
}
|
|
761
|
-
getEditorStore(editor).put([next], source);
|
|
762
|
-
editor.bindings.syncUpdatedBinding(current, next, source);
|
|
763
|
-
}, source);
|
|
764
|
-
|
|
765
|
-
return next;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
function deleteBinding(
|
|
769
|
-
editor: Editor,
|
|
770
|
-
id: BindingId,
|
|
771
|
-
options?: EditorCommandOptions,
|
|
772
|
-
): boolean {
|
|
773
|
-
const source = options?.source ?? "user";
|
|
774
|
-
const binding = editor.getBinding(id);
|
|
775
|
-
if (!binding) {
|
|
776
|
-
return false;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
getEditorStore(editor).atomic(() => {
|
|
780
|
-
editor.bindings.cleanupBindings([binding.id], source);
|
|
781
|
-
getEditorStore(editor).remove([binding.id], source);
|
|
782
|
-
}, source);
|
|
783
|
-
|
|
784
|
-
return true;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
function setCurrentPageId(
|
|
788
|
-
editor: Editor,
|
|
789
|
-
id: PageId,
|
|
790
|
-
options?: EditorCommandOptions,
|
|
791
|
-
): void {
|
|
792
|
-
const source = options?.source ?? "system";
|
|
793
|
-
editor.setCurrentPage(id, source);
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
function setCamera(
|
|
797
|
-
editor: Editor,
|
|
798
|
-
input: SetCameraInput,
|
|
799
|
-
options?: EditorCommandOptions,
|
|
800
|
-
): void {
|
|
801
|
-
const source = options?.source ?? "system";
|
|
802
|
-
editor.setCamera(input.camera, { pageId: input.pageId, source });
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
function setSelectedShapeIds(
|
|
806
|
-
editor: Editor,
|
|
807
|
-
ids: ShapeId[],
|
|
808
|
-
options?: EditorCommandOptions,
|
|
809
|
-
): void {
|
|
810
|
-
const source = options?.source ?? "user";
|
|
811
|
-
editor.setSelectedShapeIds(ids, { source });
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
function setActiveTool(
|
|
815
|
-
editor: Editor,
|
|
816
|
-
toolId: string,
|
|
817
|
-
options?: EditorCommandOptions,
|
|
818
|
-
): void {
|
|
819
|
-
const source = options?.source ?? "system";
|
|
820
|
-
editor.completeEditing(source);
|
|
821
|
-
editor.tools.setActiveTool(toolId);
|
|
822
|
-
editor.updateSession({ activeToolId: toolId }, source);
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
function setToolLocked(
|
|
826
|
-
editor: Editor,
|
|
827
|
-
locked: boolean,
|
|
828
|
-
options?: EditorCommandOptions,
|
|
829
|
-
): void {
|
|
830
|
-
const source = options?.source ?? "system";
|
|
831
|
-
editor.tools.setToolLocked(locked);
|
|
832
|
-
editor.updateSession({ isToolLocked: locked }, source);
|
|
833
|
-
}
|