@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,259 +0,0 @@
|
|
|
1
|
-
import type { JSONContent } from "@tiptap/core";
|
|
2
|
-
import type { RichTextDocument, RichTextJsonValue } from "./textTypes";
|
|
3
|
-
|
|
4
|
-
export type RichTextTextNode = JSONContent & { type: "text"; text: string };
|
|
5
|
-
|
|
6
|
-
export interface RichTextMarkStyle {
|
|
7
|
-
fontWeight?: number;
|
|
8
|
-
fontStyle?: "italic";
|
|
9
|
-
textDecorationLine?: "line-through";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function createRichTextFromPlainText(text: string): RichTextDocument {
|
|
13
|
-
const lines = text.split("\n");
|
|
14
|
-
return {
|
|
15
|
-
type: "doc",
|
|
16
|
-
content: lines.map((line) => ({
|
|
17
|
-
type: "paragraph",
|
|
18
|
-
content: line.length > 0 ? [{ type: "text", text: line }] : [],
|
|
19
|
-
})),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function getPlainTextFromRichText(
|
|
24
|
-
richTextDocument: RichTextDocument,
|
|
25
|
-
): string {
|
|
26
|
-
return richTextDocument.content
|
|
27
|
-
.map((node) => getPlainTextFromNode(node))
|
|
28
|
-
.join("\n");
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function validateRichTextDocument(value: unknown): RichTextDocument {
|
|
32
|
-
if (!value || typeof value !== "object") {
|
|
33
|
-
return createRichTextFromPlainText("");
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const candidate = value as Partial<RichTextDocument>;
|
|
37
|
-
const content = Array.isArray(candidate.content)
|
|
38
|
-
? candidate.content
|
|
39
|
-
.map((node) => sanitizeElementNode(node, 0))
|
|
40
|
-
.filter((node): node is JSONContent => node !== null)
|
|
41
|
-
: [];
|
|
42
|
-
|
|
43
|
-
return { type: "doc", attrs: sanitizeAttrs(candidate.attrs), content };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function renderRichTextDocumentToHtml(
|
|
47
|
-
richText: RichTextDocument,
|
|
48
|
-
): string {
|
|
49
|
-
return richText.content
|
|
50
|
-
.map((node) => renderRichTextBlockToHtml(node))
|
|
51
|
-
.join("");
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function isRichTextTextNode(
|
|
55
|
-
node: JSONContent,
|
|
56
|
-
): node is RichTextTextNode {
|
|
57
|
-
return node.type === "text" && typeof node.text === "string";
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function getRichTextTextNodeStyle(
|
|
61
|
-
node: RichTextTextNode,
|
|
62
|
-
): string | undefined {
|
|
63
|
-
const style = getRichTextMarkStyle(node.marks);
|
|
64
|
-
return style ? renderRichTextMarkStyle(style) : undefined;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function getRichTextMarkStyle(
|
|
68
|
-
marks: JSONContent["marks"],
|
|
69
|
-
): RichTextMarkStyle | undefined {
|
|
70
|
-
if (!marks || marks.length === 0) {
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const style: RichTextMarkStyle = {};
|
|
75
|
-
for (const mark of marks) {
|
|
76
|
-
switch (mark.type) {
|
|
77
|
-
case "bold":
|
|
78
|
-
case "strong":
|
|
79
|
-
style.fontWeight = 700;
|
|
80
|
-
break;
|
|
81
|
-
case "italic":
|
|
82
|
-
case "em":
|
|
83
|
-
style.fontStyle = "italic";
|
|
84
|
-
break;
|
|
85
|
-
case "strike":
|
|
86
|
-
case "s":
|
|
87
|
-
style.textDecorationLine = "line-through";
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return Object.keys(style).length > 0 ? style : undefined;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function getPlainTextFromNode(node: JSONContent): string {
|
|
96
|
-
if (isRichTextTextNode(node)) {
|
|
97
|
-
return node.text;
|
|
98
|
-
}
|
|
99
|
-
return (
|
|
100
|
-
node.content?.map((child) => getPlainTextFromNode(child)).join("") ?? ""
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function renderRichTextMarkStyle(style: RichTextMarkStyle): string {
|
|
105
|
-
const declarations: string[] = [];
|
|
106
|
-
if (style.fontWeight !== undefined) {
|
|
107
|
-
declarations.push(`font-weight:${String(style.fontWeight)}`);
|
|
108
|
-
}
|
|
109
|
-
if (style.fontStyle !== undefined) {
|
|
110
|
-
declarations.push(`font-style:${style.fontStyle}`);
|
|
111
|
-
}
|
|
112
|
-
if (style.textDecorationLine !== undefined) {
|
|
113
|
-
declarations.push(`text-decoration-line:${style.textDecorationLine}`);
|
|
114
|
-
}
|
|
115
|
-
return declarations.join(";");
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function renderRichTextBlockToHtml(node: JSONContent): string {
|
|
119
|
-
const children =
|
|
120
|
-
node.content?.map((child) => renderRichTextNodeToHtml(child)).join("") ?? "";
|
|
121
|
-
return `<p style="margin:0">${children.length > 0 ? children : "<br>"}</p>`;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function renderRichTextNodeToHtml(node: JSONContent): string {
|
|
125
|
-
if (isRichTextTextNode(node)) {
|
|
126
|
-
const style = getRichTextMarkStyle(node.marks);
|
|
127
|
-
const text = escapeHtml(node.text);
|
|
128
|
-
if (!style) {
|
|
129
|
-
return text;
|
|
130
|
-
}
|
|
131
|
-
return `<span style="${renderRichTextMarkStyle(style)}">${text}</span>`;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return node.content?.map((child) => renderRichTextNodeToHtml(child)).join("") ?? "";
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function escapeHtml(value: string): string {
|
|
138
|
-
return value
|
|
139
|
-
.replaceAll("&", "&")
|
|
140
|
-
.replaceAll("<", "<")
|
|
141
|
-
.replaceAll(">", ">");
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function sanitizeNode(value: unknown, depth: number): JSONContent | null {
|
|
145
|
-
if (!value || typeof value !== "object" || depth > 8) {
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
const candidate = value as Record<string, unknown>;
|
|
149
|
-
if (candidate.type === "text") {
|
|
150
|
-
const text = sanitizeTextNode(candidate);
|
|
151
|
-
return text.text.length > 0 ? text : null;
|
|
152
|
-
}
|
|
153
|
-
return sanitizeElementNode(candidate, depth);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function sanitizeElementNode(
|
|
157
|
-
value: unknown,
|
|
158
|
-
depth: number,
|
|
159
|
-
): JSONContent | null {
|
|
160
|
-
if (!value || typeof value !== "object") {
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
const candidate = value as Record<string, unknown>;
|
|
164
|
-
const type =
|
|
165
|
-
typeof candidate.type === "string" ? candidate.type : "paragraph";
|
|
166
|
-
const content = Array.isArray(candidate.content)
|
|
167
|
-
? candidate.content
|
|
168
|
-
.map((node) => sanitizeNode(node, depth + 1))
|
|
169
|
-
.filter((node): node is JSONContent => node !== null)
|
|
170
|
-
: [];
|
|
171
|
-
|
|
172
|
-
return { type, attrs: sanitizeAttrs(candidate.attrs), content };
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function sanitizeTextNode(value: Record<string, unknown>): JSONContent & {
|
|
176
|
-
type: "text";
|
|
177
|
-
text: string;
|
|
178
|
-
} {
|
|
179
|
-
return {
|
|
180
|
-
type: "text",
|
|
181
|
-
text: typeof value.text === "string" ? value.text : "",
|
|
182
|
-
marks: Array.isArray(value.marks)
|
|
183
|
-
? value.marks
|
|
184
|
-
.map(sanitizeMark)
|
|
185
|
-
.filter((mark): mark is NonNullable<JSONContent["marks"]>[number] =>
|
|
186
|
-
mark !== null,
|
|
187
|
-
)
|
|
188
|
-
: undefined,
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function sanitizeMark(
|
|
193
|
-
value: unknown,
|
|
194
|
-
): NonNullable<JSONContent["marks"]>[number] | null {
|
|
195
|
-
if (!value || typeof value !== "object") {
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
const candidate = value as Record<string, unknown>;
|
|
199
|
-
if (typeof candidate.type !== "string") {
|
|
200
|
-
return null;
|
|
201
|
-
}
|
|
202
|
-
return { type: candidate.type, attrs: sanitizeAttrs(candidate.attrs) };
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
function sanitizeAttrs(
|
|
206
|
-
attrs: unknown,
|
|
207
|
-
): Record<string, RichTextJsonValue> | undefined {
|
|
208
|
-
if (!attrs || typeof attrs !== "object") {
|
|
209
|
-
return undefined;
|
|
210
|
-
}
|
|
211
|
-
const entries = Object.entries(attrs)
|
|
212
|
-
.map(
|
|
213
|
-
([key, value]) => [key, sanitizeRichTextAttributeValue(value)] as const,
|
|
214
|
-
)
|
|
215
|
-
.filter(
|
|
216
|
-
(entry): entry is readonly [string, RichTextJsonValue] =>
|
|
217
|
-
entry[1] !== undefined,
|
|
218
|
-
);
|
|
219
|
-
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function sanitizeRichTextAttributeValue(
|
|
223
|
-
value: unknown,
|
|
224
|
-
depth = 0,
|
|
225
|
-
): RichTextJsonValue | undefined {
|
|
226
|
-
if (
|
|
227
|
-
value === null ||
|
|
228
|
-
typeof value === "string" ||
|
|
229
|
-
typeof value === "number" ||
|
|
230
|
-
typeof value === "boolean"
|
|
231
|
-
) {
|
|
232
|
-
return value;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (depth > 8) {
|
|
236
|
-
return undefined;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
if (Array.isArray(value)) {
|
|
240
|
-
return value
|
|
241
|
-
.map((item) => sanitizeRichTextAttributeValue(item, depth + 1))
|
|
242
|
-
.filter((item): item is RichTextJsonValue => item !== undefined);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
if (value && typeof value === "object") {
|
|
246
|
-
const entries = Object.entries(value)
|
|
247
|
-
.map(
|
|
248
|
-
([key, item]) =>
|
|
249
|
-
[key, sanitizeRichTextAttributeValue(item, depth + 1)] as const,
|
|
250
|
-
)
|
|
251
|
-
.filter(
|
|
252
|
-
(entry): entry is readonly [string, RichTextJsonValue] =>
|
|
253
|
-
entry[1] !== undefined,
|
|
254
|
-
);
|
|
255
|
-
return Object.fromEntries(entries);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
return undefined;
|
|
259
|
-
}
|
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ClickEditorEvent,
|
|
3
|
-
type Editor,
|
|
4
|
-
type ShapeRecord,
|
|
5
|
-
type LandInteractionHandler,
|
|
6
|
-
type PointerEditorEvent,
|
|
7
|
-
} from "@land/canvas-core";
|
|
8
|
-
import type { TextShapeRecord } from "./textTypes";
|
|
9
|
-
import { getDefaultTextShapeProps, isTextShapeRecord } from "./textShapeHelpers";
|
|
10
|
-
import {
|
|
11
|
-
ARROW_LABEL_INDEX_SUFFIX,
|
|
12
|
-
getArrowLabelLayout,
|
|
13
|
-
} from "./ArrowLabelBindingUtil";
|
|
14
|
-
import {
|
|
15
|
-
GEO_LABEL_INDEX_SUFFIX,
|
|
16
|
-
getGeoLabelLayout,
|
|
17
|
-
} from "./GeoLabelBindingUtil";
|
|
18
|
-
import {
|
|
19
|
-
ARROW_LABEL_BINDING_TYPE,
|
|
20
|
-
GEO_LABEL_BINDING_TYPE,
|
|
21
|
-
canPlaceCaretInTextShapeFromSelection,
|
|
22
|
-
createBoundTextLabelShape,
|
|
23
|
-
getTextLabelShapeForOwner,
|
|
24
|
-
startEditingTextLabel,
|
|
25
|
-
} from "./textLabelHelpers";
|
|
26
|
-
|
|
27
|
-
const TEXT_EDIT_HISTORY_MARK = "text.edit";
|
|
28
|
-
const ARROW_LABEL_EDIT_HISTORY_MARK = "arrow-label.edit";
|
|
29
|
-
const ARROW_LABEL_CREATE_HISTORY_MARK = "arrow-label.create";
|
|
30
|
-
const GEO_LABEL_EDIT_HISTORY_MARK = "geo-label.edit";
|
|
31
|
-
const GEO_LABEL_CREATE_HISTORY_MARK = "geo-label.create";
|
|
32
|
-
const TEXT_CARET_CLICK_MAX_DISTANCE_SQUARED = 9;
|
|
33
|
-
|
|
34
|
-
export function createTextInteractionHandler(): LandInteractionHandler {
|
|
35
|
-
let pendingCaretPointer: {
|
|
36
|
-
pointerId: number;
|
|
37
|
-
shapeId: TextShapeRecord["id"];
|
|
38
|
-
originPagePoint: { x: number; y: number };
|
|
39
|
-
} | null = null;
|
|
40
|
-
|
|
41
|
-
const clearPendingCaretPointer = (): void => {
|
|
42
|
-
pendingCaretPointer = null;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
id: "land.text.interactions",
|
|
47
|
-
editorEvent: {
|
|
48
|
-
handleEvent(editor, event) {
|
|
49
|
-
if (editor.getActiveToolId() !== "select") {
|
|
50
|
-
return "continue";
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (event.type === "pointer" && event.name === "pointer_up") {
|
|
54
|
-
return handleTextPointerUp(editor, event, pendingCaretPointer, () => {
|
|
55
|
-
pendingCaretPointer = null;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (event.type === "pointer" && event.name === "pointer_cancel") {
|
|
60
|
-
clearPendingCaretPointer();
|
|
61
|
-
return "continue";
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (!editor.isActiveToolInInitialState()) {
|
|
65
|
-
return "continue";
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (event.type === "keyboard" && event.name === "key_down") {
|
|
69
|
-
if (editor.getShapeEditingSession()) {
|
|
70
|
-
return "continue";
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (event.key !== "Enter" || event.altKey || event.accelKey) {
|
|
74
|
-
return "continue";
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const selectedShapeIds = editor.getSelectedShapeIds();
|
|
78
|
-
const [selectedShape] = editor.getSelectedShapes();
|
|
79
|
-
if (
|
|
80
|
-
selectedShapeIds.length !== 1 ||
|
|
81
|
-
!selectedShape ||
|
|
82
|
-
!isTextShapeRecord(selectedShape) ||
|
|
83
|
-
!editor.canEditShape(selectedShape)
|
|
84
|
-
) {
|
|
85
|
-
return "continue";
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
editor.startEditingShape(
|
|
89
|
-
{
|
|
90
|
-
shapeId: selectedShape.id,
|
|
91
|
-
entryMode: "selectAll",
|
|
92
|
-
markId: TEXT_EDIT_HISTORY_MARK,
|
|
93
|
-
},
|
|
94
|
-
"user",
|
|
95
|
-
);
|
|
96
|
-
return "handled";
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (event.type === "click" && event.name === "double_click") {
|
|
100
|
-
clearPendingCaretPointer();
|
|
101
|
-
return handleTextDoubleClick(editor, event);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (event.type === "pointer" && event.name === "pointer_down") {
|
|
105
|
-
clearPendingCaretPointer();
|
|
106
|
-
return handleTextPointerDown(editor, event, (pending) => {
|
|
107
|
-
pendingCaretPointer = pending;
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return "continue";
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function handleTextDoubleClick(
|
|
118
|
-
editor: Editor,
|
|
119
|
-
event: ClickEditorEvent,
|
|
120
|
-
): "continue" | "handled" {
|
|
121
|
-
const hit = editor.hitTestShape(event.pagePoint);
|
|
122
|
-
if (!hit) {
|
|
123
|
-
return "continue";
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (isTextShapeRecord(hit)) {
|
|
127
|
-
if (!editor.canEditShape(hit)) {
|
|
128
|
-
return "continue";
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
editor.startEditingShape(
|
|
132
|
-
{
|
|
133
|
-
shapeId: hit.id,
|
|
134
|
-
entryMode: "selectAll",
|
|
135
|
-
markId: TEXT_EDIT_HISTORY_MARK,
|
|
136
|
-
},
|
|
137
|
-
"user",
|
|
138
|
-
);
|
|
139
|
-
return "handled";
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (isGeoShapeRecord(hit)) {
|
|
143
|
-
return handleGeoLabelDoubleClick(editor, hit);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (isArrowShapeRecord(hit)) {
|
|
147
|
-
return handleArrowLabelDoubleClick(editor, hit);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return "continue";
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function handleArrowLabelDoubleClick(
|
|
154
|
-
editor: Editor,
|
|
155
|
-
owner: ShapeRecord,
|
|
156
|
-
): "continue" | "handled" {
|
|
157
|
-
if (owner.isLocked) {
|
|
158
|
-
return "continue";
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const existing = getTextLabelShapeForOwner(
|
|
162
|
-
editor,
|
|
163
|
-
owner.id,
|
|
164
|
-
ARROW_LABEL_BINDING_TYPE,
|
|
165
|
-
);
|
|
166
|
-
const label = existing ?? createArrowLabelTextShape(editor, owner);
|
|
167
|
-
startEditingTextLabel(editor, label, {
|
|
168
|
-
editMarkId: ARROW_LABEL_EDIT_HISTORY_MARK,
|
|
169
|
-
createMarkId: ARROW_LABEL_CREATE_HISTORY_MARK,
|
|
170
|
-
isExisting: !!existing,
|
|
171
|
-
});
|
|
172
|
-
return "handled";
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function handleGeoLabelDoubleClick(
|
|
176
|
-
editor: Editor,
|
|
177
|
-
owner: ShapeRecord,
|
|
178
|
-
): "continue" | "handled" {
|
|
179
|
-
if (owner.isLocked) {
|
|
180
|
-
return "continue";
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
const existing = getTextLabelShapeForOwner(
|
|
184
|
-
editor,
|
|
185
|
-
owner.id,
|
|
186
|
-
GEO_LABEL_BINDING_TYPE,
|
|
187
|
-
);
|
|
188
|
-
const label = existing ?? createGeoLabelTextShape(editor, owner);
|
|
189
|
-
startEditingTextLabel(editor, label, {
|
|
190
|
-
editMarkId: GEO_LABEL_EDIT_HISTORY_MARK,
|
|
191
|
-
createMarkId: GEO_LABEL_CREATE_HISTORY_MARK,
|
|
192
|
-
isExisting: !!existing,
|
|
193
|
-
});
|
|
194
|
-
return "handled";
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function handleTextPointerDown(
|
|
198
|
-
editor: Editor,
|
|
199
|
-
event: PointerEditorEvent,
|
|
200
|
-
setPendingCaretPointer: (pending: {
|
|
201
|
-
pointerId: number;
|
|
202
|
-
shapeId: TextShapeRecord["id"];
|
|
203
|
-
originPagePoint: { x: number; y: number };
|
|
204
|
-
}) => void,
|
|
205
|
-
): "continue" | "handled" {
|
|
206
|
-
const hit = editor.hitTestShape(event.pagePoint);
|
|
207
|
-
if (!hit || !isTextShapeRecord(hit) || !editor.canEditShape(hit)) {
|
|
208
|
-
return "continue";
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const activeEditingSession = editor.getShapeEditingSession();
|
|
212
|
-
if (activeEditingSession && activeEditingSession.shapeId !== hit.id) {
|
|
213
|
-
if (!editor.completeEditing("user")) {
|
|
214
|
-
return "handled";
|
|
215
|
-
}
|
|
216
|
-
editor.startEditingShape(
|
|
217
|
-
{
|
|
218
|
-
shapeId: hit.id,
|
|
219
|
-
entryMode: "placeCaret",
|
|
220
|
-
caretPagePoint: event.pagePoint,
|
|
221
|
-
markId: TEXT_EDIT_HISTORY_MARK,
|
|
222
|
-
preserveInteraction: true,
|
|
223
|
-
},
|
|
224
|
-
"user",
|
|
225
|
-
);
|
|
226
|
-
return "handled";
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (
|
|
230
|
-
!activeEditingSession &&
|
|
231
|
-
(event.clickCount ?? 1) < 2 &&
|
|
232
|
-
canPlaceCaretInTextShapeFromSelection(editor, hit.id)
|
|
233
|
-
) {
|
|
234
|
-
setPendingCaretPointer({
|
|
235
|
-
pointerId: event.pointerId,
|
|
236
|
-
shapeId: hit.id,
|
|
237
|
-
originPagePoint: { x: event.pagePoint.x, y: event.pagePoint.y },
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return "continue";
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
function isGeoShapeRecord(shape: ShapeRecord): boolean {
|
|
245
|
-
return shape.type === "geo";
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function isArrowShapeRecord(shape: ShapeRecord): boolean {
|
|
249
|
-
return shape.type === "arrow";
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
function createArrowLabelTextShape(
|
|
253
|
-
editor: Editor,
|
|
254
|
-
owner: ShapeRecord,
|
|
255
|
-
): TextShapeRecord {
|
|
256
|
-
const defaults = getDefaultTextShapeProps(editor);
|
|
257
|
-
const draftLabel = createDraftLabel(owner, {
|
|
258
|
-
...defaults,
|
|
259
|
-
autoSize: false,
|
|
260
|
-
textAlign: "middle",
|
|
261
|
-
});
|
|
262
|
-
const layout = getArrowLabelLayout(editor, draftLabel, owner);
|
|
263
|
-
|
|
264
|
-
return createBoundTextLabelShape(editor, {
|
|
265
|
-
bindingType: ARROW_LABEL_BINDING_TYPE,
|
|
266
|
-
owner,
|
|
267
|
-
historyMarkId: ARROW_LABEL_CREATE_HISTORY_MARK,
|
|
268
|
-
index: `${owner.index}${ARROW_LABEL_INDEX_SUFFIX}`,
|
|
269
|
-
layout,
|
|
270
|
-
bindingProps: {
|
|
271
|
-
labelPosition: 0.5,
|
|
272
|
-
},
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function createGeoLabelTextShape(
|
|
277
|
-
editor: Editor,
|
|
278
|
-
owner: ShapeRecord,
|
|
279
|
-
): TextShapeRecord {
|
|
280
|
-
const defaults = getDefaultTextShapeProps(editor);
|
|
281
|
-
const draftLabel = createDraftLabel(owner, {
|
|
282
|
-
...defaults,
|
|
283
|
-
autoSize: false,
|
|
284
|
-
textAlign: "middle",
|
|
285
|
-
});
|
|
286
|
-
const layout = getGeoLabelLayout(editor, draftLabel, owner);
|
|
287
|
-
|
|
288
|
-
return createBoundTextLabelShape(editor, {
|
|
289
|
-
bindingType: GEO_LABEL_BINDING_TYPE,
|
|
290
|
-
owner,
|
|
291
|
-
historyMarkId: GEO_LABEL_CREATE_HISTORY_MARK,
|
|
292
|
-
index: `${owner.index}${GEO_LABEL_INDEX_SUFFIX}`,
|
|
293
|
-
layout,
|
|
294
|
-
bindingProps: {
|
|
295
|
-
normalizedAnchor: { x: 0.5, y: 0.5 },
|
|
296
|
-
},
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
function createDraftLabel(
|
|
301
|
-
owner: ShapeRecord,
|
|
302
|
-
props: TextShapeRecord["props"],
|
|
303
|
-
): TextShapeRecord {
|
|
304
|
-
return {
|
|
305
|
-
id: "shape:draft",
|
|
306
|
-
typeName: "shape",
|
|
307
|
-
scope: "document",
|
|
308
|
-
type: "text",
|
|
309
|
-
parentId: owner.parentId,
|
|
310
|
-
index: `${owner.index}.label`,
|
|
311
|
-
x: 0,
|
|
312
|
-
y: 0,
|
|
313
|
-
rotation: 0,
|
|
314
|
-
scaleX: 1,
|
|
315
|
-
scaleY: 1,
|
|
316
|
-
opacity: 1,
|
|
317
|
-
isHidden: false,
|
|
318
|
-
isLocked: false,
|
|
319
|
-
meta: {},
|
|
320
|
-
props,
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
function handleTextPointerUp(
|
|
325
|
-
editor: Editor,
|
|
326
|
-
event: PointerEditorEvent,
|
|
327
|
-
pendingCaretPointer: {
|
|
328
|
-
pointerId: number;
|
|
329
|
-
shapeId: TextShapeRecord["id"];
|
|
330
|
-
originPagePoint: { x: number; y: number };
|
|
331
|
-
} | null,
|
|
332
|
-
clearPendingCaretPointer: () => void,
|
|
333
|
-
): "continue" | "handled" {
|
|
334
|
-
if (!pendingCaretPointer || pendingCaretPointer.pointerId !== event.pointerId) {
|
|
335
|
-
clearPendingCaretPointer();
|
|
336
|
-
return "continue";
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
clearPendingCaretPointer();
|
|
340
|
-
if ((event.clickCount ?? 1) >= 2) {
|
|
341
|
-
return "continue";
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
const dx = event.pagePoint.x - pendingCaretPointer.originPagePoint.x;
|
|
345
|
-
const dy = event.pagePoint.y - pendingCaretPointer.originPagePoint.y;
|
|
346
|
-
if (dx * dx + dy * dy > TEXT_CARET_CLICK_MAX_DISTANCE_SQUARED) {
|
|
347
|
-
return "continue";
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
const shape = editor.getShape(pendingCaretPointer.shapeId);
|
|
351
|
-
if (!shape || !isTextShapeRecord(shape) || !editor.canEditShape(shape)) {
|
|
352
|
-
return "continue";
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
editor.startEditingShape(
|
|
356
|
-
{
|
|
357
|
-
shapeId: shape.id,
|
|
358
|
-
entryMode: "placeCaret",
|
|
359
|
-
caretPagePoint: event.pagePoint,
|
|
360
|
-
markId: TEXT_EDIT_HISTORY_MARK,
|
|
361
|
-
preserveInteraction: true,
|
|
362
|
-
},
|
|
363
|
-
"user",
|
|
364
|
-
);
|
|
365
|
-
return "continue";
|
|
366
|
-
}
|