@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.
Files changed (375) hide show
  1. package/README.md +204 -101
  2. package/_vendor/canvas-core/bindings/bindingUtil.d.ts +23 -0
  3. package/_vendor/canvas-core/bindings/terminalPorts.d.ts +67 -0
  4. package/_vendor/canvas-core/editor/bindingReactionScope.d.ts +7 -0
  5. package/_vendor/canvas-core/editor/cameraPanSession.d.ts +9 -0
  6. package/_vendor/canvas-core/editor/canvasPanInteraction.d.ts +2 -0
  7. package/_vendor/canvas-core/editor/commands.d.ts +16 -4
  8. package/_vendor/canvas-core/editor/createEditorWithPlugins.d.ts +6 -0
  9. package/_vendor/canvas-core/editor/editor.d.ts +44 -31
  10. package/_vendor/canvas-core/editor/editorComputedHelpers.d.ts +5 -2
  11. package/_vendor/canvas-core/editor/historyManager.d.ts +24 -6
  12. package/_vendor/canvas-core/editor/index.d.ts +2 -2
  13. package/_vendor/canvas-core/editor/interactions.d.ts +41 -8
  14. package/_vendor/canvas-core/editor/managers/bindingManager.d.ts +2 -6
  15. package/_vendor/canvas-core/editor/managers/inputsManager.d.ts +3 -0
  16. package/_vendor/canvas-core/editor/managers/interactionTransientManager.d.ts +0 -26
  17. package/_vendor/canvas-core/editor/managers/queryManager.d.ts +26 -1
  18. package/_vendor/canvas-core/editor/managers/selectionLayoutManager.d.ts +5 -0
  19. package/_vendor/canvas-core/editor/managers/selectionOverlayManager.d.ts +1 -0
  20. package/_vendor/canvas-core/editor/managers/shapeEditingManager.d.ts +4 -0
  21. package/_vendor/canvas-core/editor/managers/shapeGeometryManager.d.ts +3 -2
  22. package/_vendor/canvas-core/editor/managers/shapeHierarchyManager.d.ts +7 -2
  23. package/_vendor/canvas-core/editor/managers/shapeReparenting.d.ts +3 -2
  24. package/_vendor/canvas-core/editor/managers/snapCalculations.d.ts +4 -1
  25. package/_vendor/canvas-core/editor/managers/snapGeometry.d.ts +2 -1
  26. package/_vendor/canvas-core/editor/managers/snapTypes.d.ts +1 -0
  27. package/_vendor/canvas-core/editor/managers/spatialIndexManager.d.ts +1 -0
  28. package/_vendor/canvas-core/editor/operationManager.d.ts +74 -0
  29. package/_vendor/canvas-core/editor/queries/shapeTransforms.d.ts +32 -12
  30. package/_vendor/canvas-core/editor/selection.d.ts +19 -5
  31. package/_vendor/canvas-core/editor/selectionOverlay.d.ts +7 -4
  32. package/_vendor/canvas-core/editor/selectionResizeCapabilities.d.ts +9 -0
  33. package/_vendor/canvas-core/editor/shapeTransformSpace.d.ts +6 -0
  34. package/_vendor/canvas-core/exports/svg.d.ts +3 -3
  35. package/_vendor/canvas-core/geometry/contentCutout.d.ts +8 -0
  36. package/_vendor/canvas-core/geometry/index.d.ts +1 -0
  37. package/_vendor/canvas-core/geometry/mat.d.ts +6 -2
  38. package/_vendor/canvas-core/geometry/polygon.d.ts +7 -0
  39. package/_vendor/canvas-core/geometry/vec.d.ts +0 -2
  40. package/_vendor/canvas-core/index.d.ts +21 -23
  41. package/_vendor/canvas-core/plugins/editorRuntimePlugin.d.ts +4 -10
  42. package/_vendor/canvas-core/plugins/editorRuntimeRegistry.d.ts +19 -0
  43. package/_vendor/canvas-core/plugins/index.d.ts +2 -1
  44. package/_vendor/canvas-core/schema/records.d.ts +2 -7
  45. package/_vendor/canvas-core/schema/snapshots.d.ts +10 -19
  46. package/_vendor/canvas-core/shapes/colors.d.ts +3 -3
  47. package/_vendor/canvas-core/shapes/shapeUtil.d.ts +97 -13
  48. package/_vendor/canvas-core/tools/select/selectToolHelpers.d.ts +18 -8
  49. package/_vendor/canvas-core/tools/select/states/draggingPluginInteractionState.d.ts +16 -0
  50. package/_vendor/canvas-core/tools/select/states/index.d.ts +1 -1
  51. package/_vendor/canvas-core/tools/select/states/pointingSelectionHandleInteractionState.d.ts +3 -2
  52. package/_vendor/canvas-core/tools/select/states/pointingShapeState.d.ts +1 -1
  53. package/_vendor/canvas-core/tools/select/states/resizingState.d.ts +1 -1
  54. package/_vendor/canvas-core/tools/select/states/rotatingState.d.ts +1 -1
  55. package/_vendor/canvas-core/tools/select/states/selectStateNode.d.ts +6 -2
  56. package/_vendor/canvas-core/tools/select/states/translatingState.d.ts +1 -1
  57. package/_vendor/canvas-plugin-sdk/actionRegistry.d.ts +7 -0
  58. package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/actions.d.ts +21 -6
  59. package/_vendor/canvas-plugin-sdk/capability.d.ts +16 -0
  60. package/_vendor/canvas-plugin-sdk/chrome.d.ts +52 -0
  61. package/_vendor/canvas-plugin-sdk/chromeRegistry.d.ts +15 -0
  62. package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/contextMenu.d.ts +25 -30
  63. package/_vendor/canvas-plugin-sdk/contextMenuRegistry.d.ts +11 -0
  64. package/_vendor/canvas-plugin-sdk/exportRegistry.d.ts +9 -0
  65. package/_vendor/canvas-plugin-sdk/exports.d.ts +26 -0
  66. package/_vendor/canvas-plugin-sdk/importRegistry.d.ts +10 -0
  67. package/_vendor/canvas-plugin-sdk/imports.d.ts +38 -0
  68. package/_vendor/canvas-plugin-sdk/index.d.ts +18 -0
  69. package/_vendor/canvas-plugin-sdk/lifecycle.d.ts +31 -0
  70. package/_vendor/canvas-plugin-sdk/plugin.d.ts +76 -0
  71. package/_vendor/canvas-plugin-sdk/pluginUi.d.ts +37 -0
  72. package/_vendor/canvas-plugin-sdk/productApi.d.ts +28 -0
  73. package/_vendor/canvas-plugin-sdk/services.d.ts +20 -0
  74. package/_vendor/{canvas-core/surfaces → canvas-plugin-sdk}/toolbar.d.ts +48 -5
  75. package/_vendor/canvas-plugin-sdk/toolbarRegistry.d.ts +18 -0
  76. package/_vendor/canvas-react/components/CanvasView.d.ts +2 -2
  77. package/_vendor/canvas-react/components/canvasKeyboardEvents.d.ts +13 -0
  78. package/_vendor/canvas-react/components/useCanvasDomEvents.d.ts +4 -3
  79. package/_vendor/canvas-react/contextMenuRequest.d.ts +19 -0
  80. package/_vendor/canvas-react/host/canvasRenderPlugin.d.ts +22 -5
  81. package/_vendor/canvas-react/host/canvasRenderRuntime.d.ts +13 -0
  82. package/_vendor/canvas-react/host/domEventGuards.d.ts +3 -3
  83. package/_vendor/canvas-react/host/index.d.ts +3 -9
  84. package/_vendor/canvas-react/host/overlayRegistry.d.ts +3 -3
  85. package/_vendor/canvas-react/host/rendererRegistry.d.ts +7 -4
  86. package/_vendor/canvas-react/index.d.ts +1 -0
  87. package/_vendor/plugin-arrow/api.d.ts +33 -0
  88. package/_vendor/plugin-arrow/arrowGeometry.d.ts +7 -4
  89. package/_vendor/plugin-arrow/arrowHeadGeometry.d.ts +8 -0
  90. package/_vendor/plugin-arrow/arrowShapeUtil.d.ts +7 -4
  91. package/_vendor/plugin-arrow/arrowTerminalCommands.d.ts +2 -2
  92. package/_vendor/plugin-arrow/canvasRender.d.ts +2 -2
  93. package/_vendor/plugin-arrow/editorRuntime.d.ts +2 -2
  94. package/_vendor/plugin-arrow/feature.d.ts +2 -3
  95. package/_vendor/plugin-arrow/index.d.ts +5 -2
  96. package/_vendor/plugin-arrow/productRuntime.d.ts +2 -0
  97. package/_vendor/plugin-builtin-clipboard/clipboardChromeContributions.d.ts +2 -0
  98. package/{features/clipboard → _vendor/plugin-builtin-clipboard}/clipboardContextMenuContributions.d.ts +1 -1
  99. package/{features/clipboard → _vendor/plugin-builtin-clipboard}/clipboardContribution.d.ts +2 -2
  100. package/{features/clipboard → _vendor/plugin-builtin-clipboard}/clipboardService.d.ts +3 -3
  101. package/_vendor/plugin-builtin-clipboard/index.d.ts +3 -0
  102. package/_vendor/plugin-builtin-clipboard/plugin.d.ts +1 -0
  103. package/_vendor/plugin-builtin-export/blobDataUrl.d.ts +1 -0
  104. package/_vendor/plugin-builtin-export/canvasExportApi.d.ts +43 -0
  105. package/_vendor/plugin-builtin-export/index.d.ts +8 -0
  106. package/_vendor/plugin-builtin-export/plugin.d.ts +5 -0
  107. package/_vendor/plugin-builtin-export/pngExport.d.ts +15 -0
  108. package/{features/export → _vendor/plugin-builtin-export}/svgExport.d.ts +9 -2
  109. package/_vendor/plugin-builtin-import-host/CanvasImportHost.d.ts +3 -0
  110. package/_vendor/plugin-builtin-import-host/capability.d.ts +1 -0
  111. package/_vendor/plugin-builtin-import-host/index.d.ts +2 -0
  112. package/_vendor/plugin-builtin-import-host/plugin.d.ts +1 -0
  113. package/_vendor/plugin-builtin-tool-actions/capability.d.ts +1 -0
  114. package/_vendor/plugin-builtin-tool-actions/index.d.ts +2 -0
  115. package/_vendor/plugin-builtin-tool-actions/plugin.d.ts +1 -0
  116. package/_vendor/plugin-builtin-tool-actions/toolActions.d.ts +2 -0
  117. package/_vendor/plugin-connector/canvasRender.d.ts +2 -0
  118. package/_vendor/plugin-connector/connectorBindingUtil.d.ts +28 -0
  119. package/_vendor/plugin-connector/connectorBindings.d.ts +8 -0
  120. package/_vendor/plugin-connector/connectorGeometry.d.ts +70 -0
  121. package/_vendor/plugin-connector/connectorHandles.d.ts +12 -0
  122. package/_vendor/plugin-connector/connectorInteractions.d.ts +3 -0
  123. package/_vendor/plugin-connector/connectorMarker.d.ts +7 -0
  124. package/_vendor/plugin-connector/connectorModel.d.ts +43 -0
  125. package/_vendor/plugin-connector/connectorPortInteraction.d.ts +13 -0
  126. package/_vendor/plugin-connector/connectorPorts.d.ts +23 -0
  127. package/_vendor/plugin-connector/connectorRuntime.d.ts +62 -0
  128. package/_vendor/plugin-connector/connectorShapeUtil.d.ts +29 -0
  129. package/_vendor/plugin-connector/connectorTool.d.ts +4 -0
  130. package/_vendor/plugin-connector/constants.d.ts +17 -0
  131. package/_vendor/plugin-connector/editorRuntime.d.ts +7 -0
  132. package/_vendor/plugin-connector/feature.d.ts +4 -0
  133. package/_vendor/plugin-connector/index.d.ts +18 -0
  134. package/_vendor/plugin-connector/orthogonalRoute.d.ts +9 -0
  135. package/_vendor/plugin-connector/productRuntime.d.ts +2 -0
  136. package/_vendor/plugin-connector/quickConnect.d.ts +28 -0
  137. package/_vendor/plugin-connector/types.d.ts +51 -0
  138. package/_vendor/plugin-draw/DrawShapeRenderer.d.ts +5 -2
  139. package/_vendor/plugin-draw/canvasRender.d.ts +2 -2
  140. package/_vendor/plugin-draw/drawGeometry.d.ts +4 -7
  141. package/_vendor/plugin-draw/drawPath.d.ts +7 -1
  142. package/_vendor/plugin-draw/drawShapeUtil.d.ts +2 -2
  143. package/_vendor/plugin-draw/editorRuntime.d.ts +3 -3
  144. package/_vendor/plugin-draw/feature.d.ts +2 -3
  145. package/_vendor/plugin-draw/index.d.ts +4 -3
  146. package/_vendor/plugin-draw/productRuntime.d.ts +2 -0
  147. package/_vendor/plugin-eraser/canvasRender.d.ts +2 -2
  148. package/_vendor/plugin-eraser/editorRuntime.d.ts +2 -2
  149. package/_vendor/plugin-eraser/eraserRuntime.d.ts +12 -0
  150. package/_vendor/plugin-eraser/feature.d.ts +2 -3
  151. package/_vendor/plugin-eraser/index.d.ts +4 -2
  152. package/_vendor/plugin-eraser/productRuntime.d.ts +2 -0
  153. package/_vendor/plugin-frame/api.d.ts +19 -0
  154. package/_vendor/plugin-frame/canvasRender.d.ts +5 -5
  155. package/_vendor/plugin-frame/editorRuntime.d.ts +2 -2
  156. package/_vendor/plugin-frame/feature.d.ts +2 -3
  157. package/_vendor/plugin-frame/frameShapeUtil.d.ts +12 -2
  158. package/_vendor/plugin-frame/index.d.ts +5 -2
  159. package/_vendor/plugin-frame/productRuntime.d.ts +2 -0
  160. package/_vendor/plugin-geo/api.d.ts +27 -0
  161. package/_vendor/plugin-geo/canvasRender.d.ts +5 -5
  162. package/_vendor/plugin-geo/editorRuntime.d.ts +3 -3
  163. package/_vendor/plugin-geo/feature.d.ts +2 -3
  164. package/_vendor/plugin-geo/geoShapeUtil.d.ts +1 -1
  165. package/_vendor/plugin-geo/geoStrokeStyle.d.ts +2 -0
  166. package/_vendor/plugin-geo/geoTools.d.ts +1 -1
  167. package/_vendor/plugin-geo/index.d.ts +8 -5
  168. package/_vendor/plugin-geo/productRuntime.d.ts +2 -0
  169. package/_vendor/plugin-geo/types.d.ts +5 -1
  170. package/_vendor/plugin-group/canvasRender.d.ts +3 -4
  171. package/_vendor/plugin-group/editorRuntime.d.ts +2 -2
  172. package/_vendor/plugin-group/feature.d.ts +2 -3
  173. package/_vendor/plugin-group/groupContributions.d.ts +7 -0
  174. package/_vendor/plugin-group/groupShapeUtil.d.ts +24 -5
  175. package/_vendor/plugin-group/index.d.ts +4 -2
  176. package/_vendor/plugin-group/productRuntime.d.ts +2 -0
  177. package/_vendor/plugin-image/canvasRender.d.ts +2 -2
  178. package/_vendor/plugin-image/cropRuntime.d.ts +1 -1
  179. package/_vendor/plugin-image/cropSession.d.ts +5 -3
  180. package/_vendor/plugin-image/editorRuntime.d.ts +2 -4
  181. package/_vendor/plugin-image/feature.d.ts +2 -3
  182. package/_vendor/plugin-image/imageHostActionContract.d.ts +1 -1
  183. package/_vendor/plugin-image/imageShapeUtil.d.ts +3 -3
  184. package/_vendor/plugin-image/index.d.ts +5 -4
  185. package/_vendor/plugin-image/productRuntime.d.ts +4 -0
  186. package/_vendor/plugin-image/runtimeShared.d.ts +1 -1
  187. package/_vendor/plugin-image/smudge.d.ts +6 -2
  188. package/_vendor/plugin-image/smudgeRuntime.d.ts +1 -1
  189. package/_vendor/plugin-image/styleRuntime.d.ts +6 -1
  190. package/_vendor/plugin-image/toolbarRuntime.d.ts +1 -1
  191. package/_vendor/plugin-laser/canvasRender.d.ts +2 -2
  192. package/_vendor/plugin-laser/editorRuntime.d.ts +2 -2
  193. package/_vendor/plugin-laser/feature.d.ts +2 -3
  194. package/_vendor/plugin-laser/index.d.ts +4 -2
  195. package/_vendor/plugin-laser/laserRuntime.d.ts +18 -0
  196. package/_vendor/plugin-laser/productRuntime.d.ts +2 -0
  197. package/_vendor/plugin-packaging/api.d.ts +74 -0
  198. package/_vendor/plugin-packaging/canvasRender.d.ts +2 -0
  199. package/_vendor/plugin-packaging/editorRuntime.d.ts +2 -0
  200. package/_vendor/plugin-packaging/feature.d.ts +2 -0
  201. package/_vendor/plugin-packaging/index.d.ts +19 -0
  202. package/_vendor/plugin-packaging/packagingArtwork.d.ts +5 -0
  203. package/_vendor/plugin-packaging/packagingDxf.d.ts +9 -0
  204. package/_vendor/plugin-packaging/packagingGeometry.d.ts +74 -0
  205. package/_vendor/plugin-packaging/packagingInteractions.d.ts +2 -0
  206. package/_vendor/plugin-packaging/packagingPdfExporter.d.ts +25 -0
  207. package/_vendor/plugin-packaging/packagingRuntime.d.ts +11 -0
  208. package/_vendor/plugin-packaging/packagingShapeUtil.d.ts +34 -0
  209. package/_vendor/plugin-packaging/packagingStyle.d.ts +10 -0
  210. package/_vendor/plugin-packaging/packagingSvgExporter.d.ts +7 -0
  211. package/_vendor/plugin-packaging/productRuntime.d.ts +2 -0
  212. package/_vendor/plugin-packaging/types.d.ts +168 -0
  213. package/_vendor/plugin-packaging/validation.d.ts +3 -0
  214. package/_vendor/plugin-path/PathDraftOverlay.d.ts +1 -0
  215. package/_vendor/plugin-path/PathEditInsertPreviewOverlay.d.ts +1 -0
  216. package/_vendor/plugin-path/PathShapeRenderer.d.ts +15 -0
  217. package/_vendor/plugin-path/canvasRender.d.ts +2 -0
  218. package/_vendor/plugin-path/editorRuntime.d.ts +7 -0
  219. package/_vendor/plugin-path/feature.d.ts +2 -0
  220. package/_vendor/plugin-path/index.d.ts +8 -0
  221. package/_vendor/plugin-path/pathBoolean.d.ts +13 -0
  222. package/_vendor/plugin-path/pathDraft.d.ts +10 -0
  223. package/_vendor/plugin-path/pathEditPreview.d.ts +11 -0
  224. package/_vendor/plugin-path/pathEditSelection.d.ts +24 -0
  225. package/_vendor/plugin-path/pathEditSnap.d.ts +6 -0
  226. package/_vendor/plugin-path/pathGeometry.d.ts +74 -0
  227. package/_vendor/plugin-path/pathHandles.d.ts +18 -0
  228. package/_vendor/plugin-path/pathHistory.d.ts +13 -0
  229. package/_vendor/plugin-path/pathInteractions.d.ts +7 -0
  230. package/_vendor/plugin-path/pathShapeUtil.d.ts +30 -0
  231. package/_vendor/plugin-path/pathSvg.d.ts +3 -0
  232. package/_vendor/plugin-path/pathTool.d.ts +42 -0
  233. package/_vendor/plugin-path/productRuntime.d.ts +15 -0
  234. package/_vendor/plugin-path/types.d.ts +36 -0
  235. package/_vendor/plugin-text/api.d.ts +20 -0
  236. package/_vendor/plugin-text/canvasRender.d.ts +6 -3
  237. package/_vendor/plugin-text/capabilities.d.ts +2 -0
  238. package/_vendor/plugin-text/editorRuntime.d.ts +3 -3
  239. package/_vendor/plugin-text/feature.d.ts +4 -4
  240. package/_vendor/plugin-text/geoLabelBindingUtil.d.ts +6 -3
  241. package/_vendor/plugin-text/host/RichTextEditingBox.d.ts +4 -1
  242. package/_vendor/plugin-text/host/TiptapTextEditor.d.ts +6 -3
  243. package/_vendor/plugin-text/host/initialTextBackground.d.ts +2 -0
  244. package/_vendor/plugin-text/host/richTextRendering.d.ts +1 -2
  245. package/_vendor/plugin-text/host/textEditingBoxStyle.d.ts +1 -1
  246. package/_vendor/plugin-text/host/textEntryFocus.d.ts +2 -1
  247. package/_vendor/plugin-text/host/textFormattingApi.d.ts +16 -0
  248. package/_vendor/plugin-text/host/textMeasurement.d.ts +10 -2
  249. package/_vendor/plugin-text/host/textShapeRendererRuntime.d.ts +3 -1
  250. package/_vendor/plugin-text/host/tiptapTextEditorController.d.ts +4 -1
  251. package/_vendor/plugin-text/index.d.ts +11 -4
  252. package/_vendor/plugin-text/pathLabelBindingUtil.d.ts +55 -0
  253. package/_vendor/plugin-text/productRuntime.d.ts +6 -0
  254. package/_vendor/plugin-text/richTextUtils.d.ts +9 -2
  255. package/_vendor/plugin-text/shapeWideTextFormatting.d.ts +12 -0
  256. package/_vendor/plugin-text/textFonts.d.ts +6 -3
  257. package/_vendor/plugin-text/textFormatting.d.ts +47 -0
  258. package/_vendor/plugin-text/textFormattingSession.d.ts +6 -0
  259. package/_vendor/plugin-text/textLabelHelpers.d.ts +32 -6
  260. package/_vendor/plugin-text/textLinkPopoverPresentation.d.ts +18 -0
  261. package/_vendor/plugin-text/textShapeHelpers.d.ts +1 -0
  262. package/_vendor/plugin-text/textShapeUtil.d.ts +9 -5
  263. package/_vendor/plugin-text/textTypes.d.ts +1 -0
  264. package/_vendor/signals/core.d.ts +1 -0
  265. package/_vendor/signals/effect.d.ts +0 -4
  266. package/_vendor/signals/index.d.ts +2 -2
  267. package/_vendor/store/history.d.ts +1 -1
  268. package/_vendor/store/store.d.ts +6 -0
  269. package/browser/indexedDb.d.ts +10 -10
  270. package/browser/persistence.d.ts +6 -38
  271. package/chrome/floating/CanvasKitFloatingPortal.d.ts +6 -0
  272. package/chrome/floating/useCanvasKitFloatingPosition.d.ts +11 -0
  273. package/chrome/toolbar/CanvasKitFloatingToolbarLayer.d.ts +1 -1
  274. package/chrome/toolbar/FloatingSelectionToolbarPageSpace.d.ts +5 -3
  275. package/chrome/toolbar/toolbarLabels.d.ts +1 -1
  276. package/chrome/toolbar/useToolbarSurfaces.d.ts +11 -16
  277. package/chrome/types.d.ts +15 -17
  278. package/chrome/useCanvasKitChromeContext.d.ts +12 -15
  279. package/chrome/useChromeSurfaces.d.ts +12 -0
  280. package/chrome/useContextMenuSurface.d.ts +4 -4
  281. package/chrome/useHistoryControls.d.ts +3 -3
  282. package/chrome/usePageControls.d.ts +3 -3
  283. package/controller/canvasKitController.d.ts +5 -16
  284. package/core/index.d.ts +4 -6
  285. package/core/product-controller/canvasProductController.d.ts +42 -12
  286. package/core/product-controller/index.d.ts +1 -1
  287. package/core/runtime/productAssets.d.ts +4 -2
  288. package/core/runtime/productEditor.d.ts +1 -1
  289. package/core/runtime/productServices.d.ts +11 -21
  290. package/core/runtime/runtimeContracts.d.ts +17 -0
  291. package/es-DocrZgUh.mjs +2 -0
  292. package/features/context-menu/contextMenuRuntime.d.ts +4 -4
  293. package/features/image/asset/imageAssetService.d.ts +2 -3
  294. package/features/image/asset/imageBlobStore.d.ts +7 -2
  295. package/features/image/asset/imageFileHelpers.d.ts +0 -6
  296. package/features/image/asset/svgImageAssetInliner.d.ts +1 -1
  297. package/features/image/controller/imageProductController.d.ts +2 -2
  298. package/features/image/imageHostPlugin.d.ts +1 -0
  299. package/features/image/import/ImageImportController.d.ts +3 -1
  300. package/features/image/index.d.ts +1 -3
  301. package/features/image/smudge/imageSmudgeHostActions.d.ts +2 -2
  302. package/features/image/toolbar/imageHostActions.d.ts +17 -7
  303. package/features/image/toolbar/imageToolbarHostBridge.d.ts +1 -1
  304. package/features/text/link/TextLinkHoverPopover.d.ts +6 -0
  305. package/features/text/textHostPlugin.d.ts +5 -0
  306. package/features/text/textSvgAssetInliner.d.ts +3 -0
  307. package/features/text/textSvgAssetPlugin.d.ts +2 -0
  308. package/index.css +1 -1
  309. package/index.d.ts +36 -12
  310. package/index.mjs +111 -96
  311. package/package.json +12 -9
  312. package/plugins/standardCanvasKitPlugins.d.ts +16 -0
  313. package/react/CanvasKitRoot.d.ts +10 -5
  314. package/react/useCanvasKitControllerLifecycle.d.ts +8 -0
  315. package/react/useCanvasKitRuntime.d.ts +2 -4
  316. package/runtime/canvasKitCommandExecutor.d.ts +13 -0
  317. package/runtime/canvasKitPluginContracts.d.ts +34 -0
  318. package/runtime/canvasKitPluginSetup.d.ts +32 -0
  319. package/runtime/canvasKitResourceScope.d.ts +5 -0
  320. package/runtime/canvasKitRuntime.d.ts +48 -19
  321. package/runtime/canvasKitRuntimeContracts.d.ts +34 -0
  322. package/runtime/persistenceCoordinator.d.ts +33 -0
  323. package/_vendor/canvas-core/editor/createEditorWithRuntimePlugins.d.ts +0 -6
  324. package/_vendor/canvas-core/editor/middleMousePanInteraction.d.ts +0 -2
  325. package/_vendor/canvas-core/schema/snapshotSupport.d.ts +0 -43
  326. package/_vendor/canvas-core/tools/select/states/draggingSelectionHandleInteractionState.d.ts +0 -15
  327. package/_vendor/canvas-react/host/actionRegistry.d.ts +0 -15
  328. package/_vendor/canvas-react/host/canvasRenderPluginHost.d.ts +0 -2
  329. package/_vendor/canvas-react/host/canvasRenderPluginHostManifest.d.ts +0 -2
  330. package/_vendor/canvas-react/host/canvasRenderPluginHostRuntime.d.ts +0 -3
  331. package/_vendor/canvas-react/host/canvasRenderPluginHostTypes.d.ts +0 -104
  332. package/_vendor/canvas-react/host/canvasRenderPluginHostValidation.d.ts +0 -11
  333. package/_vendor/canvas-react/host/contextMenuRegistry.d.ts +0 -17
  334. package/_vendor/canvas-react/host/extension.d.ts +0 -37
  335. package/_vendor/canvas-react/host/toolbarRegistry.d.ts +0 -20
  336. package/_vendor/plugin-text/arrowLabelBindingUtil.d.ts +0 -42
  337. package/_vendor/plugin-text/host/RichTextLinkPopover.d.ts +0 -14
  338. package/_vendor/plugin-text/host/RichTextToolbar.d.ts +0 -8
  339. package/_vendor/plugin-text/host/richTextBubbleMenuPositionSync.d.ts +0 -7
  340. package/browser/localSnapshotRestore.d.ts +0 -13
  341. package/builtins/controller/createBuiltInCanvasController.d.ts +0 -16
  342. package/builtins/controller/layerController.d.ts +0 -9
  343. package/builtins/controller/shapeCreationController.d.ts +0 -83
  344. package/builtins/extensions.d.ts +0 -18
  345. package/builtins/index.d.ts +0 -5
  346. package/chrome/useSvgExport.d.ts +0 -15
  347. package/core/api/apiRegistry.d.ts +0 -12
  348. package/core/runtime/productDefinition.d.ts +0 -33
  349. package/core/runtime/productHost.d.ts +0 -20
  350. package/features/actions/actionRuntime.d.ts +0 -21
  351. package/features/clipboard/clipboardHostExtension.d.ts +0 -2
  352. package/features/image/imageHostExtension.d.ts +0 -10
  353. package/features/image/import/useImageImport.d.ts +0 -16
  354. package/features/keyboard/keyboardShortcutHostExtension.d.ts +0 -2
  355. package/features/keyboard/useCanvasKitKeyboardShortcuts.d.ts +0 -6
  356. package/features/persistence/CanvasKitPersistenceNotice.d.ts +0 -4
  357. package/features/persistence/persistenceHostExtension.d.ts +0 -2
  358. package/features/selection/selectionActions.d.ts +0 -20
  359. package/features/selection/selectionContextMenuContributions.d.ts +0 -2
  360. package/features/selection/selectionHostExtension.d.ts +0 -2
  361. package/features/selection/selectionToolbarContributions.d.ts +0 -2
  362. package/features/tool/toolActions.d.ts +0 -2
  363. package/features/tool/toolContextMenuContributions.d.ts +0 -2
  364. package/features/tool/toolHostExtension.d.ts +0 -2
  365. package/features/tool/toolToolbarContributions.d.ts +0 -2
  366. package/features/view/viewActions.d.ts +0 -5
  367. package/features/view/viewContextMenuContributions.d.ts +0 -2
  368. package/features/view/viewHostExtension.d.ts +0 -2
  369. package/host/defaultHostExtensions.d.ts +0 -2
  370. package/product/canvasKitProduct.d.ts +0 -51
  371. package/react/useCanvasKitController.d.ts +0 -5
  372. package/react/useCanvasKitStartup.d.ts +0 -9
  373. package/runtime/canvasKitHostContracts.d.ts +0 -135
  374. package/runtime/canvasKitHostFeatureHooks.d.ts +0 -12
  375. package/runtime/canvasKitRuntimePlan.d.ts +0 -50
package/README.md CHANGED
@@ -1,151 +1,254 @@
1
1
  # @land/canvas-kit
2
2
 
3
- `@land/canvas-kit` is the public React SDK for the Land canvas kit. It includes the product runtime, built-in canvas extensions, image integration, persistence, chrome context, and typed controller surface behind one package root.
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
- ## Install
5
+ ## React usage
6
6
 
7
- ```bash
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
- defineCanvasKit,
12
+ useCanvasKitRuntime,
13
+ type CanvasKitRuntimeOptions,
18
14
  } from "@land/canvas-kit";
19
- import "@land/canvas-kit/style.css";
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 product = useMemo(
23
- () =>
24
- defineCanvasKit({
25
- onControllerReady(controller) {
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
- <div style={{ width: "100%", height: "100vh" }}>
34
- <CanvasKitRoot product={product} />
35
- </div>
28
+ <CanvasKitRoot
29
+ runtime={state.runtime}
30
+ onControllerReady={(controller) => {
31
+ controller.setTool("select");
32
+ }}
33
+ />
36
34
  );
37
35
  }
38
36
  ```
39
37
 
40
- The host element must provide a size. `CanvasKitRoot` fills the space provided by its parent and mounts the canvas runtime for the product.
38
+ Use a module-level constant or `useMemo` for `CanvasKitRuntimeOptions`. An inline object creates and disposes a Runtime after every render.
41
39
 
42
- ## Custom Chrome
40
+ ## Imperative usage
43
41
 
44
- Use the `chrome` option when you want to provide your own toolbar, panels, or menus while keeping the kit runtime and built-in extensions.
42
+ The creator owns the complete lifecycle:
45
43
 
46
44
  ```tsx
47
- import { useMemo } from "react";
45
+ import { createRoot } from "react-dom/client";
48
46
  import {
49
47
  CanvasKitRoot,
50
- defineCanvasKit,
51
- type CanvasKitController,
52
- type CanvasKitChromeContext,
48
+ createCanvasKitRuntime,
53
49
  } from "@land/canvas-kit";
54
- import "@land/canvas-kit/style.css";
55
50
 
56
- function MyChrome({
57
- context,
58
- }: {
59
- context: CanvasKitChromeContext<CanvasKitController>;
60
- }) {
61
- return (
62
- <>
63
- <button
64
- type="button"
65
- disabled={!context.history.canUndo}
66
- onClick={context.history.undo}
67
- >
68
- Undo
69
- </button>
70
- <button type="button" onClick={context.zoom.zoomIn}>
71
- Zoom in
72
- </button>
73
- <button
74
- type="button"
75
- disabled={context.selection.count === 0}
76
- onClick={() => context.controller.deleteShapes([...context.selectedShapeIds])}
77
- >
78
- Delete
79
- </button>
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
- export function App() {
85
- const product = useMemo(
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
- return (
94
- <div style={{ width: "100%", height: "100vh" }}>
95
- <CanvasKitRoot product={product} />
96
- </div>
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
- Chrome should operate through `CanvasKitChromeContext` and `context.controller`. The product shell owns canvas mounting, so custom chrome should render controls and overlays rather than the canvas itself. It should not import `@land/canvas-core`, `@land/canvas-react`, built-in plugin packages, or kit internals.
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
- The package no longer exposes a one-component direct render entry. Apps should define a product with `defineCanvasKit` and render it through `CanvasKitRoot`.
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
- ## Local Persistence
107
+ ## Persistence adapter
106
108
 
107
- Default browser persistence restores supported records even when a saved
108
- snapshot also contains unsupported shape or binding types. Unsupported raw
109
- records are preserved outside the live editor and merged back into future saves.
110
- When this happens, `CanvasKitRoot` shows a persistence notice and custom
111
- chrome can inspect `context.persistence.status` or call
112
- `context.persistence.discardUnsupportedRecords?.()` after explicit user
113
- confirmation.
109
+ Persistence is IO-only; Runtime owns restore and seed ordering.
114
110
 
115
- ## Internal Assembly
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
- The public product remains opaque. Internally, `defineCanvasKit()` resolves options into explicit product fields:
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
- - `LandExtension[]` installs editor/canvas render plugins through `@land/canvas-react/host`.
120
- - `CanvasKitHostExtension[]` installs product-host behavior such as clipboard, toolbar, context menu, image import, asset URL resolution, SVG asset inlining, and controller components.
121
- - Service factories and asset resolver tokens wire product-level services into runtime.
122
- - `CanvasKitRuntime` creates services, the plugin host runtime, the editor, controller registry, and then runs product runtime setup.
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
- Advanced products can pass additional `hostExtensions` to `defineCanvasKit()`
125
- for product-host behavior that should compose with the built-in runtime instead
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
- This keeps app chrome on the root package controller while keeping browser-specific host behavior out of concrete shape plugins and out of `canvas-core`.
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
- ## Public Exports
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 published package intentionally exposes only:
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
- - `@land/canvas-kit`
135
- - `@land/canvas-kit/style.css`
214
+ ## Public controller
136
215
 
137
- Package subpaths are internal implementation details.
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
- ## Local Build
218
+ ### Export API
140
219
 
141
- Run from the workspace root:
220
+ SVG and PNG export are async registered APIs so resource preparation and
221
+ embedding complete before a result is returned:
142
222
 
143
- ```bash
144
- pnpm build:canvas-kit:bundle
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
- The publish-ready output is written to:
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
- ```text
150
- packages/canvas-kit/dist-component/
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;
@@ -0,0 +1,2 @@
1
+ import type { LandInteractionHandler } from "./interactions";
2
+ export declare function createCanvasPanInteractionHandler(): LandInteractionHandler;
@@ -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
- reuseExistingMark?: boolean;
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?: EditorCommandOptions): ShapeRecord[];
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?: EditorCommandOptions): void;
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): void;
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;