@yuzhouu/canvas-kit 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +204 -101
- package/_vendor/canvas-core/bindings/bindingUtil.d.ts +23 -0
- package/_vendor/canvas-core/bindings/terminalPorts.d.ts +67 -0
- package/_vendor/canvas-core/editor/bindingReactionScope.d.ts +7 -0
- package/_vendor/canvas-core/editor/cameraPanSession.d.ts +9 -0
- package/_vendor/canvas-core/editor/canvasPanInteraction.d.ts +2 -0
- package/_vendor/canvas-core/editor/commands.d.ts +16 -4
- package/_vendor/canvas-core/editor/createEditorWithPlugins.d.ts +6 -0
- package/_vendor/canvas-core/editor/editor.d.ts +44 -31
- package/_vendor/canvas-core/editor/editorComputedHelpers.d.ts +5 -2
- package/_vendor/canvas-core/editor/historyManager.d.ts +24 -6
- package/_vendor/canvas-core/editor/index.d.ts +2 -2
- package/_vendor/canvas-core/editor/interactions.d.ts +41 -8
- package/_vendor/canvas-core/editor/managers/bindingManager.d.ts +2 -6
- package/_vendor/canvas-core/editor/managers/inputsManager.d.ts +3 -0
- package/_vendor/canvas-core/editor/managers/interactionTransientManager.d.ts +0 -26
- package/_vendor/canvas-core/editor/managers/queryManager.d.ts +26 -1
- package/_vendor/canvas-core/editor/managers/selectionLayoutManager.d.ts +5 -0
- package/_vendor/canvas-core/editor/managers/selectionOverlayManager.d.ts +1 -0
- package/_vendor/canvas-core/editor/managers/shapeEditingManager.d.ts +4 -0
- package/_vendor/canvas-core/editor/managers/shapeGeometryManager.d.ts +3 -2
- package/_vendor/canvas-core/editor/managers/shapeHierarchyManager.d.ts +7 -2
- package/_vendor/canvas-core/editor/managers/shapeReparenting.d.ts +3 -2
- package/_vendor/canvas-core/editor/managers/snapCalculations.d.ts +4 -1
- package/_vendor/canvas-core/editor/managers/snapGeometry.d.ts +2 -1
- package/_vendor/canvas-core/editor/managers/snapTypes.d.ts +1 -0
- package/_vendor/canvas-core/editor/managers/spatialIndexManager.d.ts +1 -0
- package/_vendor/canvas-core/editor/operationManager.d.ts +74 -0
- package/_vendor/canvas-core/editor/queries/shapeTransforms.d.ts +32 -12
- package/_vendor/canvas-core/editor/selection.d.ts +19 -5
- package/_vendor/canvas-core/editor/selectionOverlay.d.ts +7 -4
- package/_vendor/canvas-core/editor/selectionResizeCapabilities.d.ts +9 -0
- package/_vendor/canvas-core/editor/shapeTransformSpace.d.ts +6 -0
- package/_vendor/canvas-core/exports/svg.d.ts +3 -3
- package/_vendor/canvas-core/geometry/contentCutout.d.ts +8 -0
- package/_vendor/canvas-core/geometry/index.d.ts +1 -0
- package/_vendor/canvas-core/geometry/mat.d.ts +6 -2
- package/_vendor/canvas-core/geometry/polygon.d.ts +7 -0
- package/_vendor/canvas-core/geometry/vec.d.ts +0 -2
- package/_vendor/canvas-core/index.d.ts +21 -23
- package/_vendor/canvas-core/plugins/editorRuntimePlugin.d.ts +4 -10
- package/_vendor/canvas-core/plugins/editorRuntimeRegistry.d.ts +19 -0
- package/_vendor/canvas-core/plugins/index.d.ts +2 -1
- package/_vendor/canvas-core/schema/records.d.ts +2 -7
- package/_vendor/canvas-core/schema/snapshots.d.ts +10 -19
- package/_vendor/canvas-core/shapes/colors.d.ts +3 -3
- package/_vendor/canvas-core/shapes/shapeUtil.d.ts +97 -13
- package/_vendor/canvas-core/tools/select/selectToolHelpers.d.ts +18 -8
- package/_vendor/canvas-core/tools/select/states/draggingPluginInteractionState.d.ts +16 -0
- package/_vendor/canvas-core/tools/select/states/index.d.ts +1 -1
- package/_vendor/canvas-core/tools/select/states/pointingSelectionHandleInteractionState.d.ts +3 -2
- package/_vendor/canvas-core/tools/select/states/pointingShapeState.d.ts +1 -1
- package/_vendor/canvas-core/tools/select/states/resizingState.d.ts +1 -1
- package/_vendor/canvas-core/tools/select/states/rotatingState.d.ts +1 -1
- package/_vendor/canvas-core/tools/select/states/selectStateNode.d.ts +6 -2
- package/_vendor/canvas-core/tools/select/states/translatingState.d.ts +1 -1
- package/_vendor/canvas-plugin-sdk/actionRegistry.d.ts +7 -0
- package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/actions.d.ts +21 -6
- package/_vendor/canvas-plugin-sdk/capability.d.ts +16 -0
- package/_vendor/canvas-plugin-sdk/chrome.d.ts +52 -0
- package/_vendor/canvas-plugin-sdk/chromeRegistry.d.ts +15 -0
- package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/contextMenu.d.ts +25 -30
- package/_vendor/canvas-plugin-sdk/contextMenuRegistry.d.ts +11 -0
- package/_vendor/canvas-plugin-sdk/exportRegistry.d.ts +9 -0
- package/_vendor/canvas-plugin-sdk/exports.d.ts +26 -0
- package/_vendor/canvas-plugin-sdk/importRegistry.d.ts +10 -0
- package/_vendor/canvas-plugin-sdk/imports.d.ts +38 -0
- package/_vendor/canvas-plugin-sdk/index.d.ts +18 -0
- package/_vendor/canvas-plugin-sdk/lifecycle.d.ts +31 -0
- package/_vendor/canvas-plugin-sdk/plugin.d.ts +76 -0
- package/_vendor/canvas-plugin-sdk/pluginUi.d.ts +37 -0
- package/_vendor/canvas-plugin-sdk/productApi.d.ts +28 -0
- package/_vendor/canvas-plugin-sdk/services.d.ts +20 -0
- package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/toolbar.d.ts +48 -5
- package/_vendor/canvas-plugin-sdk/toolbarRegistry.d.ts +18 -0
- package/_vendor/canvas-react/components/CanvasView.d.ts +2 -2
- package/_vendor/canvas-react/components/canvasKeyboardEvents.d.ts +13 -0
- package/_vendor/canvas-react/components/useCanvasDomEvents.d.ts +4 -3
- package/_vendor/canvas-react/contextMenuRequest.d.ts +19 -0
- package/_vendor/canvas-react/host/canvasRenderPlugin.d.ts +22 -5
- package/_vendor/canvas-react/host/canvasRenderRuntime.d.ts +13 -0
- package/_vendor/canvas-react/host/domEventGuards.d.ts +3 -3
- package/_vendor/canvas-react/host/index.d.ts +3 -9
- package/_vendor/canvas-react/host/overlayRegistry.d.ts +3 -3
- package/_vendor/canvas-react/host/rendererRegistry.d.ts +7 -4
- package/_vendor/canvas-react/index.d.ts +1 -0
- package/_vendor/plugin-arrow/api.d.ts +33 -0
- package/_vendor/plugin-arrow/arrowGeometry.d.ts +7 -4
- package/_vendor/plugin-arrow/arrowHeadGeometry.d.ts +8 -0
- package/_vendor/plugin-arrow/arrowShapeUtil.d.ts +7 -4
- package/_vendor/plugin-arrow/arrowTerminalCommands.d.ts +2 -2
- package/_vendor/plugin-arrow/canvasRender.d.ts +2 -2
- package/_vendor/plugin-arrow/editorRuntime.d.ts +2 -2
- package/_vendor/plugin-arrow/feature.d.ts +2 -3
- package/_vendor/plugin-arrow/index.d.ts +5 -2
- package/_vendor/plugin-arrow/productRuntime.d.ts +2 -0
- package/_vendor/plugin-builtin-clipboard/clipboardChromeContributions.d.ts +2 -0
- package/{features/clipboard → _vendor/plugin-builtin-clipboard}/clipboardContextMenuContributions.d.ts +1 -1
- package/{features/clipboard → _vendor/plugin-builtin-clipboard}/clipboardContribution.d.ts +2 -2
- package/{features/clipboard → _vendor/plugin-builtin-clipboard}/clipboardService.d.ts +3 -3
- package/_vendor/plugin-builtin-clipboard/index.d.ts +3 -0
- package/_vendor/plugin-builtin-clipboard/plugin.d.ts +1 -0
- package/_vendor/plugin-builtin-export/blobDataUrl.d.ts +1 -0
- package/_vendor/plugin-builtin-export/canvasExportApi.d.ts +43 -0
- package/_vendor/plugin-builtin-export/index.d.ts +8 -0
- package/_vendor/plugin-builtin-export/plugin.d.ts +5 -0
- package/_vendor/plugin-builtin-export/pngExport.d.ts +15 -0
- package/{features/export → _vendor/plugin-builtin-export}/svgExport.d.ts +9 -2
- package/_vendor/plugin-builtin-import-host/CanvasImportHost.d.ts +3 -0
- package/_vendor/plugin-builtin-import-host/capability.d.ts +1 -0
- package/_vendor/plugin-builtin-import-host/index.d.ts +2 -0
- package/_vendor/plugin-builtin-import-host/plugin.d.ts +1 -0
- package/_vendor/plugin-builtin-tool-actions/capability.d.ts +1 -0
- package/_vendor/plugin-builtin-tool-actions/index.d.ts +2 -0
- package/_vendor/plugin-builtin-tool-actions/plugin.d.ts +1 -0
- package/_vendor/plugin-builtin-tool-actions/toolActions.d.ts +2 -0
- package/_vendor/plugin-connector/canvasRender.d.ts +2 -0
- package/_vendor/plugin-connector/connectorBindingUtil.d.ts +28 -0
- package/_vendor/plugin-connector/connectorBindings.d.ts +8 -0
- package/_vendor/plugin-connector/connectorGeometry.d.ts +70 -0
- package/_vendor/plugin-connector/connectorHandles.d.ts +12 -0
- package/_vendor/plugin-connector/connectorInteractions.d.ts +3 -0
- package/_vendor/plugin-connector/connectorMarker.d.ts +7 -0
- package/_vendor/plugin-connector/connectorModel.d.ts +43 -0
- package/_vendor/plugin-connector/connectorPortInteraction.d.ts +13 -0
- package/_vendor/plugin-connector/connectorPorts.d.ts +23 -0
- package/_vendor/plugin-connector/connectorRuntime.d.ts +62 -0
- package/_vendor/plugin-connector/connectorShapeUtil.d.ts +29 -0
- package/_vendor/plugin-connector/connectorTool.d.ts +4 -0
- package/_vendor/plugin-connector/constants.d.ts +17 -0
- package/_vendor/plugin-connector/editorRuntime.d.ts +7 -0
- package/_vendor/plugin-connector/feature.d.ts +4 -0
- package/_vendor/plugin-connector/index.d.ts +18 -0
- package/_vendor/plugin-connector/orthogonalRoute.d.ts +9 -0
- package/_vendor/plugin-connector/productRuntime.d.ts +2 -0
- package/_vendor/plugin-connector/quickConnect.d.ts +28 -0
- package/_vendor/plugin-connector/types.d.ts +51 -0
- package/_vendor/plugin-draw/DrawShapeRenderer.d.ts +5 -2
- package/_vendor/plugin-draw/canvasRender.d.ts +2 -2
- package/_vendor/plugin-draw/drawGeometry.d.ts +4 -7
- package/_vendor/plugin-draw/drawPath.d.ts +7 -1
- package/_vendor/plugin-draw/drawShapeUtil.d.ts +2 -2
- package/_vendor/plugin-draw/editorRuntime.d.ts +3 -3
- package/_vendor/plugin-draw/feature.d.ts +2 -3
- package/_vendor/plugin-draw/index.d.ts +4 -3
- package/_vendor/plugin-draw/productRuntime.d.ts +2 -0
- package/_vendor/plugin-eraser/canvasRender.d.ts +2 -2
- package/_vendor/plugin-eraser/editorRuntime.d.ts +2 -2
- package/_vendor/plugin-eraser/eraserRuntime.d.ts +12 -0
- package/_vendor/plugin-eraser/feature.d.ts +2 -3
- package/_vendor/plugin-eraser/index.d.ts +4 -2
- package/_vendor/plugin-eraser/productRuntime.d.ts +2 -0
- package/_vendor/plugin-frame/api.d.ts +19 -0
- package/_vendor/plugin-frame/canvasRender.d.ts +5 -5
- package/_vendor/plugin-frame/editorRuntime.d.ts +2 -2
- package/_vendor/plugin-frame/feature.d.ts +2 -3
- package/_vendor/plugin-frame/frameShapeUtil.d.ts +12 -2
- package/_vendor/plugin-frame/index.d.ts +5 -2
- package/_vendor/plugin-frame/productRuntime.d.ts +2 -0
- package/_vendor/plugin-geo/api.d.ts +27 -0
- package/_vendor/plugin-geo/canvasRender.d.ts +5 -5
- package/_vendor/plugin-geo/editorRuntime.d.ts +3 -3
- package/_vendor/plugin-geo/feature.d.ts +2 -3
- package/_vendor/plugin-geo/geoShapeUtil.d.ts +1 -1
- package/_vendor/plugin-geo/geoStrokeStyle.d.ts +2 -0
- package/_vendor/plugin-geo/geoTools.d.ts +1 -1
- package/_vendor/plugin-geo/index.d.ts +8 -5
- package/_vendor/plugin-geo/productRuntime.d.ts +2 -0
- package/_vendor/plugin-geo/types.d.ts +5 -1
- package/_vendor/plugin-group/canvasRender.d.ts +3 -4
- package/_vendor/plugin-group/editorRuntime.d.ts +2 -2
- package/_vendor/plugin-group/feature.d.ts +2 -3
- package/_vendor/plugin-group/groupContributions.d.ts +7 -0
- package/_vendor/plugin-group/groupShapeUtil.d.ts +24 -5
- package/_vendor/plugin-group/index.d.ts +4 -2
- package/_vendor/plugin-group/productRuntime.d.ts +2 -0
- package/_vendor/plugin-image/canvasRender.d.ts +2 -2
- package/_vendor/plugin-image/cropRuntime.d.ts +1 -1
- package/_vendor/plugin-image/cropSession.d.ts +5 -3
- package/_vendor/plugin-image/editorRuntime.d.ts +2 -4
- package/_vendor/plugin-image/feature.d.ts +2 -3
- package/_vendor/plugin-image/imageHostActionContract.d.ts +1 -1
- package/_vendor/plugin-image/imageShapeUtil.d.ts +3 -3
- package/_vendor/plugin-image/index.d.ts +5 -4
- package/_vendor/plugin-image/productRuntime.d.ts +4 -0
- package/_vendor/plugin-image/runtimeShared.d.ts +1 -1
- package/_vendor/plugin-image/smudge.d.ts +6 -2
- package/_vendor/plugin-image/smudgeRuntime.d.ts +1 -1
- package/_vendor/plugin-image/styleRuntime.d.ts +6 -1
- package/_vendor/plugin-image/toolbarRuntime.d.ts +1 -1
- package/_vendor/plugin-laser/canvasRender.d.ts +2 -2
- package/_vendor/plugin-laser/editorRuntime.d.ts +2 -2
- package/_vendor/plugin-laser/feature.d.ts +2 -3
- package/_vendor/plugin-laser/index.d.ts +4 -2
- package/_vendor/plugin-laser/laserRuntime.d.ts +18 -0
- package/_vendor/plugin-laser/productRuntime.d.ts +2 -0
- package/_vendor/plugin-packaging/api.d.ts +74 -0
- package/_vendor/plugin-packaging/canvasRender.d.ts +2 -0
- package/_vendor/plugin-packaging/editorRuntime.d.ts +2 -0
- package/_vendor/plugin-packaging/feature.d.ts +2 -0
- package/_vendor/plugin-packaging/index.d.ts +19 -0
- package/_vendor/plugin-packaging/packagingArtwork.d.ts +5 -0
- package/_vendor/plugin-packaging/packagingDxf.d.ts +9 -0
- package/_vendor/plugin-packaging/packagingGeometry.d.ts +74 -0
- package/_vendor/plugin-packaging/packagingInteractions.d.ts +2 -0
- package/_vendor/plugin-packaging/packagingPdfExporter.d.ts +25 -0
- package/_vendor/plugin-packaging/packagingRuntime.d.ts +11 -0
- package/_vendor/plugin-packaging/packagingShapeUtil.d.ts +34 -0
- package/_vendor/plugin-packaging/packagingStyle.d.ts +10 -0
- package/_vendor/plugin-packaging/packagingSvgExporter.d.ts +7 -0
- package/_vendor/plugin-packaging/productRuntime.d.ts +2 -0
- package/_vendor/plugin-packaging/types.d.ts +168 -0
- package/_vendor/plugin-packaging/validation.d.ts +3 -0
- package/_vendor/plugin-path/PathDraftOverlay.d.ts +1 -0
- package/_vendor/plugin-path/PathEditInsertPreviewOverlay.d.ts +1 -0
- package/_vendor/plugin-path/PathShapeRenderer.d.ts +15 -0
- package/_vendor/plugin-path/canvasRender.d.ts +2 -0
- package/_vendor/plugin-path/editorRuntime.d.ts +7 -0
- package/_vendor/plugin-path/feature.d.ts +2 -0
- package/_vendor/plugin-path/index.d.ts +8 -0
- package/_vendor/plugin-path/pathBoolean.d.ts +13 -0
- package/_vendor/plugin-path/pathDraft.d.ts +10 -0
- package/_vendor/plugin-path/pathEditPreview.d.ts +11 -0
- package/_vendor/plugin-path/pathEditSelection.d.ts +24 -0
- package/_vendor/plugin-path/pathEditSnap.d.ts +6 -0
- package/_vendor/plugin-path/pathGeometry.d.ts +74 -0
- package/_vendor/plugin-path/pathHandles.d.ts +18 -0
- package/_vendor/plugin-path/pathHistory.d.ts +13 -0
- package/_vendor/plugin-path/pathInteractions.d.ts +7 -0
- package/_vendor/plugin-path/pathShapeUtil.d.ts +30 -0
- package/_vendor/plugin-path/pathSvg.d.ts +3 -0
- package/_vendor/plugin-path/pathTool.d.ts +42 -0
- package/_vendor/plugin-path/productRuntime.d.ts +15 -0
- package/_vendor/plugin-path/types.d.ts +36 -0
- package/_vendor/plugin-text/api.d.ts +20 -0
- package/_vendor/plugin-text/canvasRender.d.ts +6 -3
- package/_vendor/plugin-text/capabilities.d.ts +2 -0
- package/_vendor/plugin-text/editorRuntime.d.ts +3 -3
- package/_vendor/plugin-text/feature.d.ts +4 -4
- package/_vendor/plugin-text/geoLabelBindingUtil.d.ts +6 -3
- package/_vendor/plugin-text/host/RichTextEditingBox.d.ts +4 -1
- package/_vendor/plugin-text/host/TiptapTextEditor.d.ts +6 -3
- package/_vendor/plugin-text/host/initialTextBackground.d.ts +2 -0
- package/_vendor/plugin-text/host/richTextRendering.d.ts +1 -2
- package/_vendor/plugin-text/host/textEditingBoxStyle.d.ts +1 -1
- package/_vendor/plugin-text/host/textEntryFocus.d.ts +2 -1
- package/_vendor/plugin-text/host/textFormattingApi.d.ts +16 -0
- package/_vendor/plugin-text/host/textMeasurement.d.ts +10 -2
- package/_vendor/plugin-text/host/textShapeRendererRuntime.d.ts +3 -1
- package/_vendor/plugin-text/host/tiptapTextEditorController.d.ts +4 -1
- package/_vendor/plugin-text/index.d.ts +11 -4
- package/_vendor/plugin-text/pathLabelBindingUtil.d.ts +55 -0
- package/_vendor/plugin-text/productRuntime.d.ts +6 -0
- package/_vendor/plugin-text/richTextUtils.d.ts +9 -2
- package/_vendor/plugin-text/shapeWideTextFormatting.d.ts +12 -0
- package/_vendor/plugin-text/textFonts.d.ts +6 -3
- package/_vendor/plugin-text/textFormatting.d.ts +47 -0
- package/_vendor/plugin-text/textFormattingSession.d.ts +6 -0
- package/_vendor/plugin-text/textLabelHelpers.d.ts +32 -6
- package/_vendor/plugin-text/textLinkPopoverPresentation.d.ts +18 -0
- package/_vendor/plugin-text/textShapeHelpers.d.ts +1 -0
- package/_vendor/plugin-text/textShapeUtil.d.ts +9 -5
- package/_vendor/plugin-text/textTypes.d.ts +1 -0
- package/_vendor/signals/core.d.ts +1 -0
- package/_vendor/signals/effect.d.ts +0 -4
- package/_vendor/signals/index.d.ts +2 -2
- package/_vendor/store/history.d.ts +1 -1
- package/_vendor/store/store.d.ts +6 -0
- package/browser/indexedDb.d.ts +10 -10
- package/browser/persistence.d.ts +6 -38
- package/chrome/floating/CanvasKitFloatingPortal.d.ts +6 -0
- package/chrome/floating/useCanvasKitFloatingPosition.d.ts +11 -0
- package/chrome/toolbar/CanvasKitFloatingToolbarLayer.d.ts +1 -1
- package/chrome/toolbar/FloatingSelectionToolbarPageSpace.d.ts +5 -3
- package/chrome/toolbar/toolbarLabels.d.ts +1 -1
- package/chrome/toolbar/useToolbarSurfaces.d.ts +11 -16
- package/chrome/types.d.ts +15 -17
- package/chrome/useCanvasKitChromeContext.d.ts +12 -15
- package/chrome/useChromeSurfaces.d.ts +12 -0
- package/chrome/useContextMenuSurface.d.ts +4 -4
- package/chrome/useHistoryControls.d.ts +3 -3
- package/chrome/usePageControls.d.ts +3 -3
- package/controller/canvasKitController.d.ts +5 -16
- package/core/index.d.ts +4 -6
- package/core/product-controller/canvasProductController.d.ts +42 -12
- package/core/product-controller/index.d.ts +1 -1
- package/core/runtime/productAssets.d.ts +4 -2
- package/core/runtime/productEditor.d.ts +1 -1
- package/core/runtime/productServices.d.ts +11 -21
- package/core/runtime/runtimeContracts.d.ts +17 -0
- package/es-DocrZgUh.mjs +2 -0
- package/features/context-menu/contextMenuRuntime.d.ts +4 -4
- package/features/image/asset/imageAssetService.d.ts +2 -3
- package/features/image/asset/imageBlobStore.d.ts +7 -2
- package/features/image/asset/imageFileHelpers.d.ts +0 -6
- package/features/image/asset/svgImageAssetInliner.d.ts +1 -1
- package/features/image/controller/imageProductController.d.ts +2 -2
- package/features/image/imageHostPlugin.d.ts +1 -0
- package/features/image/import/ImageImportController.d.ts +3 -1
- package/features/image/index.d.ts +1 -3
- package/features/image/smudge/imageSmudgeHostActions.d.ts +2 -2
- package/features/image/toolbar/imageHostActions.d.ts +17 -7
- package/features/image/toolbar/imageToolbarHostBridge.d.ts +1 -1
- package/features/text/link/TextLinkHoverPopover.d.ts +6 -0
- package/features/text/textHostPlugin.d.ts +5 -0
- package/features/text/textSvgAssetInliner.d.ts +3 -0
- package/features/text/textSvgAssetPlugin.d.ts +2 -0
- package/index.css +1 -1
- package/index.d.ts +36 -12
- package/index.mjs +111 -96
- package/package.json +12 -9
- package/plugins/standardCanvasKitPlugins.d.ts +16 -0
- package/react/CanvasKitRoot.d.ts +10 -5
- package/react/useCanvasKitControllerLifecycle.d.ts +8 -0
- package/react/useCanvasKitRuntime.d.ts +2 -4
- package/runtime/canvasKitCommandExecutor.d.ts +13 -0
- package/runtime/canvasKitPluginContracts.d.ts +34 -0
- package/runtime/canvasKitPluginSetup.d.ts +32 -0
- package/runtime/canvasKitResourceScope.d.ts +5 -0
- package/runtime/canvasKitRuntime.d.ts +48 -19
- package/runtime/canvasKitRuntimeContracts.d.ts +34 -0
- package/runtime/persistenceCoordinator.d.ts +33 -0
- package/_vendor/canvas-core/editor/createEditorWithRuntimePlugins.d.ts +0 -6
- package/_vendor/canvas-core/editor/middleMousePanInteraction.d.ts +0 -2
- package/_vendor/canvas-core/schema/snapshotSupport.d.ts +0 -43
- package/_vendor/canvas-core/tools/select/states/draggingSelectionHandleInteractionState.d.ts +0 -15
- package/_vendor/canvas-react/host/actionRegistry.d.ts +0 -15
- package/_vendor/canvas-react/host/canvasRenderPluginHost.d.ts +0 -2
- package/_vendor/canvas-react/host/canvasRenderPluginHostManifest.d.ts +0 -2
- package/_vendor/canvas-react/host/canvasRenderPluginHostRuntime.d.ts +0 -3
- package/_vendor/canvas-react/host/canvasRenderPluginHostTypes.d.ts +0 -104
- package/_vendor/canvas-react/host/canvasRenderPluginHostValidation.d.ts +0 -11
- package/_vendor/canvas-react/host/contextMenuRegistry.d.ts +0 -17
- package/_vendor/canvas-react/host/extension.d.ts +0 -37
- package/_vendor/canvas-react/host/toolbarRegistry.d.ts +0 -20
- package/_vendor/plugin-text/arrowLabelBindingUtil.d.ts +0 -42
- package/_vendor/plugin-text/host/RichTextLinkPopover.d.ts +0 -14
- package/_vendor/plugin-text/host/RichTextToolbar.d.ts +0 -8
- package/_vendor/plugin-text/host/richTextBubbleMenuPositionSync.d.ts +0 -7
- package/browser/localSnapshotRestore.d.ts +0 -13
- package/builtins/controller/createBuiltInCanvasController.d.ts +0 -16
- package/builtins/controller/layerController.d.ts +0 -9
- package/builtins/controller/shapeCreationController.d.ts +0 -83
- package/builtins/extensions.d.ts +0 -18
- package/builtins/index.d.ts +0 -5
- package/chrome/useSvgExport.d.ts +0 -15
- package/core/api/apiRegistry.d.ts +0 -12
- package/core/runtime/productDefinition.d.ts +0 -33
- package/core/runtime/productHost.d.ts +0 -20
- package/features/actions/actionRuntime.d.ts +0 -21
- package/features/clipboard/clipboardHostExtension.d.ts +0 -2
- package/features/image/imageHostExtension.d.ts +0 -10
- package/features/image/import/useImageImport.d.ts +0 -16
- package/features/keyboard/keyboardShortcutHostExtension.d.ts +0 -2
- package/features/keyboard/useCanvasKitKeyboardShortcuts.d.ts +0 -6
- package/features/persistence/CanvasKitPersistenceNotice.d.ts +0 -4
- package/features/persistence/persistenceHostExtension.d.ts +0 -2
- package/features/selection/selectionActions.d.ts +0 -20
- package/features/selection/selectionContextMenuContributions.d.ts +0 -2
- package/features/selection/selectionHostExtension.d.ts +0 -2
- package/features/selection/selectionToolbarContributions.d.ts +0 -2
- package/features/tool/toolActions.d.ts +0 -2
- package/features/tool/toolContextMenuContributions.d.ts +0 -2
- package/features/tool/toolHostExtension.d.ts +0 -2
- package/features/tool/toolToolbarContributions.d.ts +0 -2
- package/features/view/viewActions.d.ts +0 -5
- package/features/view/viewContextMenuContributions.d.ts +0 -2
- package/features/view/viewHostExtension.d.ts +0 -2
- package/host/defaultHostExtensions.d.ts +0 -2
- package/product/canvasKitProduct.d.ts +0 -51
- package/react/useCanvasKitController.d.ts +0 -5
- package/react/useCanvasKitStartup.d.ts +0 -9
- package/runtime/canvasKitHostContracts.d.ts +0 -135
- package/runtime/canvasKitHostFeatureHooks.d.ts +0 -12
- package/runtime/canvasKitRuntimePlan.d.ts +0 -50
package/README.md
CHANGED
|
@@ -1,151 +1,254 @@
|
|
|
1
1
|
# @land/canvas-kit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
CanvasKit is the public composition root for the Land canvas. It compiles one graph of `CanvasPlugin` objects and nested plugin groups to assemble an isolated Runtime, then exposes a controller-oriented API without exposing Editor, services, registries, or private render data.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## React usage
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
pnpm add @land/canvas-kit react react-dom
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Basic Usage
|
|
7
|
+
Keep the options object stable. The hook uses reference identity to decide when to replace a Runtime.
|
|
12
8
|
|
|
13
9
|
```tsx
|
|
14
|
-
import { useMemo } from "react";
|
|
15
10
|
import {
|
|
16
11
|
CanvasKitRoot,
|
|
17
|
-
|
|
12
|
+
useCanvasKitRuntime,
|
|
13
|
+
type CanvasKitRuntimeOptions,
|
|
18
14
|
} from "@land/canvas-kit";
|
|
19
|
-
|
|
15
|
+
|
|
16
|
+
const RUNTIME_OPTIONS: CanvasKitRuntimeOptions = {
|
|
17
|
+
id: "my-canvas",
|
|
18
|
+
storageNamespace: "my-app.canvas",
|
|
19
|
+
};
|
|
20
20
|
|
|
21
21
|
export function App() {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
console.log(controller.snapshot());
|
|
27
|
-
},
|
|
28
|
-
}),
|
|
29
|
-
[],
|
|
30
|
-
);
|
|
22
|
+
const state = useCanvasKitRuntime(RUNTIME_OPTIONS);
|
|
23
|
+
|
|
24
|
+
if (state.status === "error") throw state.error;
|
|
25
|
+
if (state.status !== "ready") return null;
|
|
31
26
|
|
|
32
27
|
return (
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
<CanvasKitRoot
|
|
29
|
+
runtime={state.runtime}
|
|
30
|
+
onControllerReady={(controller) => {
|
|
31
|
+
controller.setTool("select");
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
36
34
|
);
|
|
37
35
|
}
|
|
38
36
|
```
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
Use a module-level constant or `useMemo` for `CanvasKitRuntimeOptions`. An inline object creates and disposes a Runtime after every render.
|
|
41
39
|
|
|
42
|
-
##
|
|
40
|
+
## Imperative usage
|
|
43
41
|
|
|
44
|
-
|
|
42
|
+
The creator owns the complete lifecycle:
|
|
45
43
|
|
|
46
44
|
```tsx
|
|
47
|
-
import {
|
|
45
|
+
import { createRoot } from "react-dom/client";
|
|
48
46
|
import {
|
|
49
47
|
CanvasKitRoot,
|
|
50
|
-
|
|
51
|
-
type CanvasKitController,
|
|
52
|
-
type CanvasKitChromeContext,
|
|
48
|
+
createCanvasKitRuntime,
|
|
53
49
|
} from "@land/canvas-kit";
|
|
54
|
-
import "@land/canvas-kit/style.css";
|
|
55
50
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
);
|
|
51
|
+
const runtime = createCanvasKitRuntime({ persistence: null });
|
|
52
|
+
const startup = await runtime.start();
|
|
53
|
+
|
|
54
|
+
const root = createRoot(document.getElementById("app")!);
|
|
55
|
+
root.render(<CanvasKitRoot runtime={runtime} />);
|
|
56
|
+
|
|
57
|
+
// Later:
|
|
58
|
+
root.unmount();
|
|
59
|
+
runtime.dispose();
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
One Runtime can be mounted by only one `CanvasKitRoot` at a time. `CanvasKitRoot` requires a ready Runtime and never calls `start()` or `dispose()`.
|
|
63
|
+
|
|
64
|
+
## Runtime options
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
interface CanvasKitRuntimeOptions {
|
|
68
|
+
id?: string;
|
|
69
|
+
chrome?: CanvasKitChromeRenderer;
|
|
70
|
+
documentMeta?: Record<string, unknown>;
|
|
71
|
+
persistence?: ProductPersistenceAdapter | null;
|
|
72
|
+
seedDocument?: CanvasKitDocumentSeed;
|
|
73
|
+
shouldSkipStoredSnapshots?: () => boolean;
|
|
74
|
+
plugins?: readonly CanvasPluginInput[];
|
|
75
|
+
storageNamespace?: string;
|
|
82
76
|
}
|
|
77
|
+
```
|
|
83
78
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
defineCanvasKit({
|
|
88
|
-
chrome: (context) => <MyChrome context={context} />,
|
|
89
|
-
}),
|
|
90
|
-
[],
|
|
91
|
-
);
|
|
79
|
+
Controller callbacks, window exposure, and `windowKey` are mount concerns and
|
|
80
|
+
belong on `CanvasKitRoot`. Export appearance is supplied to each export request;
|
|
81
|
+
it is not stored on the Root or Runtime.
|
|
92
82
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
83
|
+
`plugins` is the complete caller-supplied plugin graph. Before compiling it,
|
|
84
|
+
CanvasKit adds a built-in default provider for generic tool actions or the
|
|
85
|
+
export API only when the graph does not already provide the corresponding
|
|
86
|
+
capability token. A plugin that provides `canvasToolActionsCapability` or
|
|
87
|
+
`canvasExportApiToken` therefore replaces that built-in implementation.
|
|
88
|
+
Built-in defaults and caller plugins use the same `CanvasPlugin` contract and
|
|
89
|
+
compile into one dependency graph.
|
|
90
|
+
|
|
91
|
+
## Startup result
|
|
92
|
+
|
|
93
|
+
`runtime.start()` is single-flight and idempotent. It returns:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
interface CanvasKitStartupResult {
|
|
97
|
+
documentSource: "restored" | "seeded" | "empty";
|
|
98
|
+
sessionRestored: boolean;
|
|
99
|
+
warnings: readonly unknown[];
|
|
98
100
|
}
|
|
99
101
|
```
|
|
100
102
|
|
|
101
|
-
|
|
103
|
+
Startup loads snapshots, resets to a clean document/session, restores the document or seeds after a clean fallback, restores session state, clears history, prepares assets, runs `beforeReady`, and starts Runtime-owned persistence coordination. Recoverable load/restore/asset/hook errors are returned in `warnings`. Synchronous assembly and seed failures are fatal.
|
|
102
104
|
|
|
103
|
-
|
|
105
|
+
Disposal aborts startup and unwinds one Runtime-owned disposer stack in reverse creation order. Persistence, plugin setup resources, Editor, and services all enter that stack. A disposed Runtime cannot restart.
|
|
104
106
|
|
|
105
|
-
##
|
|
107
|
+
## Persistence adapter
|
|
106
108
|
|
|
107
|
-
|
|
108
|
-
snapshot also contains unsupported shape or binding types. Unsupported raw
|
|
109
|
-
records are preserved outside the live editor and merged back into future saves.
|
|
110
|
-
When this happens, `CanvasKitRoot` shows a persistence notice and custom
|
|
111
|
-
chrome can inspect `context.persistence.status` or call
|
|
112
|
-
`context.persistence.discardUnsupportedRecords?.()` after explicit user
|
|
113
|
-
confirmation.
|
|
109
|
+
Persistence is IO-only; Runtime owns restore and seed ordering.
|
|
114
110
|
|
|
115
|
-
|
|
111
|
+
```ts
|
|
112
|
+
interface ProductPersistenceAdapter {
|
|
113
|
+
load?(options: {
|
|
114
|
+
signal: AbortSignal;
|
|
115
|
+
}): Promise<{
|
|
116
|
+
documentSnapshot: unknown | null;
|
|
117
|
+
sessionSnapshot: unknown | null;
|
|
118
|
+
}>;
|
|
119
|
+
saveDocument?(snapshot: DocumentSnapshot): Promise<void>;
|
|
120
|
+
saveSession?(snapshot: SessionSnapshot): Promise<void>;
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Runtime captures document state from operation commits, captures session state
|
|
125
|
+
independently, applies trailing debounce, retries transient write failures, and
|
|
126
|
+
passes immutable snapshots to the adapter. When no document snapshot exists,
|
|
127
|
+
`seedDocument` runs once. Session restore happens after seed so persisted camera
|
|
128
|
+
and selection state win.
|
|
129
|
+
|
|
130
|
+
## Plugin authoring
|
|
131
|
+
|
|
132
|
+
Use `defineCanvasPlugin()` and pass plugins or nested plugin groups through Runtime options:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
import {
|
|
136
|
+
createProductServiceToken,
|
|
137
|
+
createStandardCanvasKitPlugins,
|
|
138
|
+
defineCanvasPlugin,
|
|
139
|
+
type CanvasKitRuntimeOptions,
|
|
140
|
+
} from "@land/canvas-kit";
|
|
141
|
+
|
|
142
|
+
const analyticsToken = createProductServiceToken<{ track(name: string): void }>(
|
|
143
|
+
"example.analytics",
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
const analyticsPlugin = defineCanvasPlugin({
|
|
147
|
+
id: "example.analytics",
|
|
148
|
+
provides: [analyticsToken],
|
|
149
|
+
setup(context) {
|
|
150
|
+
const analytics = context.services.add({
|
|
151
|
+
token: analyticsToken,
|
|
152
|
+
create: () => ({ track: console.log }),
|
|
153
|
+
});
|
|
154
|
+
context.actions.add({
|
|
155
|
+
id: "example.track",
|
|
156
|
+
run: () => analytics.track("canvas-action"),
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const reportingPlugin = defineCanvasPlugin({
|
|
162
|
+
id: "example.reporting",
|
|
163
|
+
requires: [analyticsToken],
|
|
164
|
+
setup(context) {
|
|
165
|
+
context.services.get(analyticsToken)?.track("runtime-ready");
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const options: CanvasKitRuntimeOptions = {
|
|
170
|
+
plugins: [
|
|
171
|
+
createStandardCanvasKitPlugins(),
|
|
172
|
+
[analyticsPlugin, reportingPlugin],
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
`CanvasPlugin` has optional `editor`, `render`, and `setup` entries. `requires` lives at the plugin top level, so one dependency order applies to editor/render creation and setup installation. Depend on a plugin object when the whole extension must exist; depend on a typed API, service, or value capability token when only that cross-plugin contract matters. Providers declare those tokens in `provides` and register the matching implementation during setup. Raw `{ id }` dependency objects are rejected.
|
|
116
178
|
|
|
117
|
-
|
|
179
|
+
Nested arrays are groups only; they do not need IDs and are flattened in declaration order. Optional features are included or omitted explicitly.
|
|
118
180
|
|
|
119
|
-
|
|
120
|
-
- `CanvasKitHostExtension[]` installs product-host behavior such as clipboard, toolbar, context menu, image import, asset URL resolution, SVG asset inlining, and controller components.
|
|
121
|
-
- Service factories and asset resolver tokens wire product-level services into runtime.
|
|
122
|
-
- `CanvasKitRuntime` creates services, the plugin host runtime, the editor, controller registry, and then runs product runtime setup.
|
|
181
|
+
Runtime creation compiles the graph, creates Editor and the Runtime resource owner, runs each setup once in dependency order, then seals all registries. Sealing validates duplicate IDs and action references, materializes registered APIs, and prevents later registration.
|
|
123
182
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
of being hard-coded in chrome or canvas runtime modules.
|
|
183
|
+
Packaging is intentionally outside the standard plugin profile. Products that
|
|
184
|
+
need it add the public plugin explicitly:
|
|
127
185
|
|
|
128
|
-
|
|
186
|
+
```ts
|
|
187
|
+
import {
|
|
188
|
+
Packaging,
|
|
189
|
+
createStandardCanvasKitPlugins,
|
|
190
|
+
type CanvasKitRuntimeOptions,
|
|
191
|
+
} from "@land/canvas-kit";
|
|
192
|
+
|
|
193
|
+
const options: CanvasKitRuntimeOptions = {
|
|
194
|
+
plugins: [createStandardCanvasKitPlugins(), Packaging],
|
|
195
|
+
};
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
`setup(context)` installs capabilities through focused registrars:
|
|
199
|
+
|
|
200
|
+
- `actions`, `toolbar`, `contextMenu`, and `apis`
|
|
201
|
+
- `services`
|
|
202
|
+
- `assets`
|
|
203
|
+
- `ui`
|
|
204
|
+
- `lifecycle.beforeReady()`, `lifecycle.beforeCommand()`, and `lifecycle.defer()`
|
|
129
205
|
|
|
130
|
-
|
|
206
|
+
`setup` returns nothing. Every owned resource registers cleanup through `lifecycle.defer()`, which gives Runtime one cleanup protocol and reverse-order resource stack. `beforeReady` runs serially during `start()` after restore/seed and asset preparation. `beforeCommand` is a repeatable interceptor executed by the Runtime-bound command executor.
|
|
131
207
|
|
|
132
|
-
The
|
|
208
|
+
The set-active-tool and tool-lock actions are provided by the replaceable
|
|
209
|
+
built-in default for `canvasToolActionsCapability`, so shape toolbar plugins do
|
|
210
|
+
not depend on the standard profile installing a Tool action provider.
|
|
211
|
+
Components share one props contract and render between Canvas and chrome; there
|
|
212
|
+
are no component slots.
|
|
133
213
|
|
|
134
|
-
|
|
135
|
-
- `@land/canvas-kit/style.css`
|
|
214
|
+
## Public controller
|
|
136
215
|
|
|
137
|
-
|
|
216
|
+
External code should work through `runtime.controller` or the controller supplied to `onControllerReady`. The controller exposes document, selection, page, tool, camera, layer, history, export, built-in shape creation, and registered API operations without exposing the raw store.
|
|
138
217
|
|
|
139
|
-
|
|
218
|
+
### Export API
|
|
140
219
|
|
|
141
|
-
|
|
220
|
+
SVG and PNG export are async registered APIs so resource preparation and
|
|
221
|
+
embedding complete before a result is returned:
|
|
142
222
|
|
|
143
|
-
```
|
|
144
|
-
|
|
223
|
+
```ts
|
|
224
|
+
import { canvasExportApiToken } from "@land/canvas-kit";
|
|
225
|
+
|
|
226
|
+
const exportApi = runtime.controller.apis.get(canvasExportApiToken);
|
|
227
|
+
if (!exportApi) throw new Error("Canvas export API is unavailable.");
|
|
228
|
+
|
|
229
|
+
const pagePng = await exportApi.exportPng({
|
|
230
|
+
appearance: {
|
|
231
|
+
resolveThemeColor(token, fallback) {
|
|
232
|
+
return currentTheme.tokens[token] ?? fallback;
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
scope: "page",
|
|
236
|
+
pixelRatio: 2,
|
|
237
|
+
});
|
|
238
|
+
const selectedSvg = await exportApi.exportSvg({ scope: "selection" });
|
|
239
|
+
const customSvg = await exportApi.exportSvg({ shapeIds: [shapeId] });
|
|
145
240
|
```
|
|
146
241
|
|
|
147
|
-
|
|
242
|
+
`exportPng()` resolves with an `image/png` Blob and `exportSvg()` resolves with
|
|
243
|
+
a self-contained SVG string when export succeeds. The API deliberately exposes
|
|
244
|
+
no loading state; callers own pending-state presentation around the returned
|
|
245
|
+
Promise. SVG and PNG share one internal lock and reject a concurrent export.
|
|
246
|
+
When `appearance.resolveThemeColor` is omitted, core color fallbacks are used.
|
|
247
|
+
|
|
248
|
+
## Styles
|
|
148
249
|
|
|
149
|
-
|
|
150
|
-
|
|
250
|
+
The package root imports its base styles. Published consumers may also use the explicit stylesheet export when their bundler requires it:
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
import "@land/canvas-kit/style.css";
|
|
151
254
|
```
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import type { Editor } from "../editor/editor";
|
|
2
2
|
import type { SelectionOverlayFrameGeometryState } from "../editor/selection";
|
|
3
|
+
import type { Vec } from "../geometry/vec";
|
|
3
4
|
import type { BindingId, BindingRecord, BindingRecordBase, ShapeRecord } from "../schema/records";
|
|
4
5
|
export interface BindingUtilEffect {
|
|
5
6
|
shapes?: ShapeRecord[];
|
|
6
7
|
bindings?: BindingRecord[];
|
|
7
8
|
deleteShapeIds?: ShapeRecord["id"][];
|
|
8
9
|
deleteBindingIds?: BindingId[];
|
|
10
|
+
/** Suppress these bindings while applying this effect and its derived writes. */
|
|
11
|
+
suppressBindingIds?: BindingId[];
|
|
9
12
|
}
|
|
10
13
|
export interface BindingShapeChangeContext {
|
|
11
14
|
before: ShapeRecord;
|
|
12
15
|
after: ShapeRecord;
|
|
13
16
|
role: "from" | "to";
|
|
17
|
+
reason: "self" | "ancestry";
|
|
14
18
|
}
|
|
15
19
|
export interface BindingShapeDeleteContext {
|
|
16
20
|
shape: ShapeRecord;
|
|
@@ -27,6 +31,10 @@ export interface BindingShapeGeometryDependencyContext {
|
|
|
27
31
|
shape: ShapeRecord;
|
|
28
32
|
role: "from" | "to";
|
|
29
33
|
}
|
|
34
|
+
export interface BindingTargetShapeContentCutoutContext {
|
|
35
|
+
fromShape: ShapeRecord;
|
|
36
|
+
toShape: ShapeRecord;
|
|
37
|
+
}
|
|
30
38
|
export declare abstract class BindingUtil<B extends BindingRecordBase = BindingRecordBase> {
|
|
31
39
|
abstract readonly type: B["type"];
|
|
32
40
|
abstract getDefaultProps(): B["props"];
|
|
@@ -36,10 +44,25 @@ export declare abstract class BindingUtil<B extends BindingRecordBase = BindingR
|
|
|
36
44
|
onBindingCreate?(editor: Editor, binding: B): BindingUtilEffect | void;
|
|
37
45
|
onBindingUpdate?(editor: Editor, before: B, after: B): BindingUtilEffect | void;
|
|
38
46
|
onBindingLoad?(editor: Editor, binding: B): BindingUtilEffect | void;
|
|
47
|
+
onInvalidBindingLoad?(editor: Editor, binding: B): BindingUtilEffect | void;
|
|
39
48
|
onAfterShapeChange?(editor: Editor, binding: B, context: BindingShapeChangeContext): BindingUtilEffect | void;
|
|
40
49
|
onBeforeDeleteShape?(editor: Editor, binding: B, context: BindingShapeDeleteContext): BindingUtilEffect | void;
|
|
41
50
|
onBeforeDeleteBinding?(editor: Editor, binding: B): BindingUtilEffect | void;
|
|
42
51
|
getExportShapeIds?(editor: Editor, binding: B): ShapeRecord["id"][];
|
|
52
|
+
/**
|
|
53
|
+
* Map a hierarchy companion (for example, a bound label) to the shape that
|
|
54
|
+
* owns its group lifecycle and selection semantics.
|
|
55
|
+
*/
|
|
56
|
+
getShapeHierarchyRootId?(binding: B, shapeId: ShapeRecord["id"]): ShapeRecord["id"] | null;
|
|
57
|
+
canUseShapeHierarchy?(binding: B, context: BindingEndpointContext): boolean;
|
|
43
58
|
getGeometryDependentShapeIds?(editor: Editor, binding: B, context: BindingShapeGeometryDependencyContext): ShapeRecord["id"][];
|
|
59
|
+
/**
|
|
60
|
+
* Return polygons in the target shape's local space that should be removed
|
|
61
|
+
* from its rendered content. This lets a binding-owned companion such as a
|
|
62
|
+
* text label create a transparent gap without coupling the target plugin to
|
|
63
|
+
* the companion shape implementation.
|
|
64
|
+
*/
|
|
65
|
+
getTargetShapeContentCutoutLocalPolygons?(editor: Editor, binding: B, context: BindingTargetShapeContentCutoutContext): readonly (readonly Vec[])[];
|
|
44
66
|
getSelectionCompanionFrameGeometries?(editor: Editor, binding: B, context: BindingSelectionCompanionFrameContext): SelectionOverlayFrameGeometryState[];
|
|
45
67
|
}
|
|
68
|
+
export declare function resolveShapeHierarchyRootId(shapeId: ShapeRecord["id"], bindings: readonly BindingRecord[], getBindingUtil: (binding: BindingRecord) => BindingUtil): ShapeRecord["id"];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Editor } from "../editor/editor";
|
|
2
|
+
import { Vec } from "../geometry/vec";
|
|
3
|
+
import type { ShapeRecord } from "../schema/records";
|
|
4
|
+
export type TerminalBindingPortId = "top" | "right" | "bottom" | "left" | (string & {});
|
|
5
|
+
export interface ShapeTerminalBindingPort {
|
|
6
|
+
id: TerminalBindingPortId;
|
|
7
|
+
normalizedAnchor: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
outwardNormal: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface ResolvedShapeTerminalBindingPort {
|
|
17
|
+
id: TerminalBindingPortId;
|
|
18
|
+
normalizedAnchor: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
};
|
|
22
|
+
pagePoint: Vec;
|
|
23
|
+
pageOutwardNormal: Vec;
|
|
24
|
+
}
|
|
25
|
+
export declare const DEFAULT_TERMINAL_BINDING_PORTS: readonly [{
|
|
26
|
+
readonly id: "top";
|
|
27
|
+
readonly normalizedAnchor: {
|
|
28
|
+
readonly x: 0.5;
|
|
29
|
+
readonly y: 0;
|
|
30
|
+
};
|
|
31
|
+
readonly outwardNormal: {
|
|
32
|
+
readonly x: 0;
|
|
33
|
+
readonly y: -1;
|
|
34
|
+
};
|
|
35
|
+
}, {
|
|
36
|
+
readonly id: "right";
|
|
37
|
+
readonly normalizedAnchor: {
|
|
38
|
+
readonly x: 1;
|
|
39
|
+
readonly y: 0.5;
|
|
40
|
+
};
|
|
41
|
+
readonly outwardNormal: {
|
|
42
|
+
readonly x: 1;
|
|
43
|
+
readonly y: 0;
|
|
44
|
+
};
|
|
45
|
+
}, {
|
|
46
|
+
readonly id: "bottom";
|
|
47
|
+
readonly normalizedAnchor: {
|
|
48
|
+
readonly x: 0.5;
|
|
49
|
+
readonly y: 1;
|
|
50
|
+
};
|
|
51
|
+
readonly outwardNormal: {
|
|
52
|
+
readonly x: 0;
|
|
53
|
+
readonly y: 1;
|
|
54
|
+
};
|
|
55
|
+
}, {
|
|
56
|
+
readonly id: "left";
|
|
57
|
+
readonly normalizedAnchor: {
|
|
58
|
+
readonly x: 0;
|
|
59
|
+
readonly y: 0.5;
|
|
60
|
+
};
|
|
61
|
+
readonly outwardNormal: {
|
|
62
|
+
readonly x: -1;
|
|
63
|
+
readonly y: 0;
|
|
64
|
+
};
|
|
65
|
+
}];
|
|
66
|
+
export declare function getResolvedShapeTerminalBindingPorts(editor: Editor, shape: ShapeRecord): ResolvedShapeTerminalBindingPort[];
|
|
67
|
+
export declare function getResolvedShapeTerminalBindingPort(editor: Editor, shape: ShapeRecord, portId: TerminalBindingPortId): ResolvedShapeTerminalBindingPort | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BindingId } from "../schema/records";
|
|
2
|
+
import type { Editor } from "./editor";
|
|
3
|
+
declare const SYNCHRONOUS_CALLBACK_ERROR = "Binding reaction scope callbacks must be synchronous";
|
|
4
|
+
type SynchronousCallbackGuard<T> = T extends PromiseLike<unknown> ? [error: typeof SYNCHRONOUS_CALLBACK_ERROR] : [];
|
|
5
|
+
export declare function getSuppressedBindingReactionIds(editor: Editor): ReadonlySet<BindingId>;
|
|
6
|
+
export declare function runWithSuppressedBindingReactions<T>(editor: Editor, bindingIds: Iterable<BindingId>, callback: () => T, ..._synchronousCallbackGuard: SynchronousCallbackGuard<T>): T;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Vec } from "../geometry/vec";
|
|
2
|
+
import type { Camera } from "../schema/records";
|
|
3
|
+
import type { Editor } from "./editor";
|
|
4
|
+
export interface CameraPanSession {
|
|
5
|
+
originScreenPoint: Vec;
|
|
6
|
+
originCamera: Camera;
|
|
7
|
+
}
|
|
8
|
+
export declare function createCameraPanSession(editor: Editor, originScreenPoint: Vec): CameraPanSession;
|
|
9
|
+
export declare function updateCameraPanSession(editor: Editor, session: CameraPanSession, screenPoint: Vec): void;
|
|
@@ -4,6 +4,16 @@ import type { AssetId, AssetRecord, AssetRecordBase, BindingId, BindingRecordBas
|
|
|
4
4
|
export interface EditorCommandOptions {
|
|
5
5
|
source?: ChangeSource;
|
|
6
6
|
}
|
|
7
|
+
export interface CreateShapesOptions extends EditorCommandOptions {
|
|
8
|
+
/** Defer spatial containment until an interactive creation gesture completes. */
|
|
9
|
+
autoReparent?: boolean;
|
|
10
|
+
/** Internal: allow a container to receive children later in the same atomic command. */
|
|
11
|
+
deferMinimumChildRepair?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface UpdateShapesOptions extends EditorCommandOptions {
|
|
14
|
+
/** Suppress these bindings while applying this update and its derived writes. */
|
|
15
|
+
suppressBindingIds?: ReadonlySet<BindingId>;
|
|
16
|
+
}
|
|
7
17
|
export interface CreateShapeInput {
|
|
8
18
|
type: ShapeRecordBase["type"];
|
|
9
19
|
x: number;
|
|
@@ -14,6 +24,7 @@ export interface CreateShapeInput {
|
|
|
14
24
|
opacity?: number;
|
|
15
25
|
isHidden?: boolean;
|
|
16
26
|
rotation?: number;
|
|
27
|
+
skewX?: number;
|
|
17
28
|
scaleX?: number;
|
|
18
29
|
scaleY?: number;
|
|
19
30
|
isLocked?: boolean;
|
|
@@ -35,6 +46,7 @@ export interface ShapeUpdate {
|
|
|
35
46
|
x?: number;
|
|
36
47
|
y?: number;
|
|
37
48
|
rotation?: number;
|
|
49
|
+
skewX?: number;
|
|
38
50
|
scaleX?: number;
|
|
39
51
|
scaleY?: number;
|
|
40
52
|
opacity?: number;
|
|
@@ -57,7 +69,7 @@ export interface StartEditingShapeInput {
|
|
|
57
69
|
y: number;
|
|
58
70
|
};
|
|
59
71
|
markId?: string;
|
|
60
|
-
|
|
72
|
+
reuseActiveOperation?: boolean;
|
|
61
73
|
preserveInteraction?: boolean;
|
|
62
74
|
}
|
|
63
75
|
export interface CreateBindingInput {
|
|
@@ -106,19 +118,19 @@ export interface EditorCommands {
|
|
|
106
118
|
updateDocumentMeta(input: UpdateDocumentMetaInput, options?: EditorCommandOptions): DocumentMetadataRecord;
|
|
107
119
|
updatePageMeta(input: UpdatePageMetaInput, options?: EditorCommandOptions): PageRecord | null;
|
|
108
120
|
movePage(input: MovePageInput, options?: EditorCommandOptions): void;
|
|
109
|
-
createShapes(inputs: CreateShapeInput[], options?:
|
|
121
|
+
createShapes(inputs: CreateShapeInput[], options?: CreateShapesOptions): ShapeRecord[];
|
|
110
122
|
/**
|
|
111
123
|
* Persist already-built shape records (with their existing ids) through the
|
|
112
124
|
* command pipeline. Used by paste/duplicate where ids must be assigned before
|
|
113
125
|
* parent/binding remapping. Prefer `createShapes` for fresh shapes.
|
|
114
126
|
*/
|
|
115
127
|
createShapesFromRecords(records: ShapeRecord[], options?: EditorCommandOptions): ShapeRecord[];
|
|
116
|
-
updateShapes(updates: ShapeUpdate[], options?:
|
|
128
|
+
updateShapes(updates: ShapeUpdate[], options?: UpdateShapesOptions): void;
|
|
117
129
|
/**
|
|
118
130
|
* Move shapes to a new parent, appending shapes that are entering that parent
|
|
119
131
|
* to the end of its child order in the order provided by `ids`.
|
|
120
132
|
*/
|
|
121
|
-
reparentShapes(input: ReparentShapesInput, options?: EditorCommandOptions):
|
|
133
|
+
reparentShapes(input: ReparentShapesInput, options?: EditorCommandOptions): boolean;
|
|
122
134
|
deleteShapes(ids: ShapeId[], options?: EditorCommandOptions): void;
|
|
123
135
|
createAsset(input: CreateAssetInput, options?: EditorCommandOptions): AssetRecord;
|
|
124
136
|
/**
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type EditorPlugin } from "../plugins";
|
|
2
|
+
import { Editor, type EditorOptions } from "./editor";
|
|
3
|
+
export interface CreateEditorWithPluginsOptions extends Omit<EditorOptions, "shapeUtils" | "shapeSvgExporters" | "bindingUtils" | "shapeCapabilities"> {
|
|
4
|
+
plugins?: readonly EditorPlugin[];
|
|
5
|
+
}
|
|
6
|
+
export declare function createEditorWithPlugins(options?: CreateEditorWithPluginsOptions): Editor;
|