@yuzhouu/canvas-kit 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (563) hide show
  1. package/README.md +80 -78
  2. package/_vendor/canvas-core/bindings/bindingUtil.d.ts +45 -0
  3. package/_vendor/canvas-core/bindings/bindingUtilRegistry.d.ts +8 -0
  4. package/_vendor/canvas-core/bindings/terminalBinding.d.ts +28 -0
  5. package/_vendor/canvas-core/editor/camera.d.ts +3 -0
  6. package/_vendor/canvas-core/editor/clipboard.d.ts +43 -0
  7. package/_vendor/canvas-core/editor/commands.d.ts +131 -0
  8. package/_vendor/canvas-core/editor/createEditorWithPlugins.d.ts +6 -0
  9. package/_vendor/canvas-core/editor/edgeScroll.d.ts +5 -0
  10. package/_vendor/canvas-core/editor/editor.d.ts +559 -0
  11. package/_vendor/canvas-core/editor/editorComputedHelpers.d.ts +21 -0
  12. package/_vendor/canvas-core/editor/editorSelectionTransforms.d.ts +6 -0
  13. package/_vendor/canvas-core/editor/events.d.ts +71 -0
  14. package/_vendor/canvas-core/editor/historyManager.d.ts +18 -0
  15. package/_vendor/canvas-core/editor/index.d.ts +11 -0
  16. package/_vendor/canvas-core/editor/interactions.d.ts +51 -0
  17. package/_vendor/canvas-core/editor/internal.d.ts +7 -0
  18. package/_vendor/canvas-core/editor/managers/bindingManager.d.ts +27 -0
  19. package/_vendor/canvas-core/editor/managers/cameraManager.d.ts +39 -0
  20. package/_vendor/canvas-core/editor/managers/clipboardManager.d.ts +14 -0
  21. package/_vendor/canvas-core/editor/managers/documentSnapshotManager.d.ts +28 -0
  22. package/_vendor/canvas-core/editor/managers/inputsManager.d.ts +44 -0
  23. package/_vendor/canvas-core/editor/managers/interactionTransientManager.d.ts +55 -0
  24. package/_vendor/canvas-core/editor/managers/queryManager.d.ts +77 -0
  25. package/_vendor/canvas-core/editor/managers/queryState.d.ts +18 -0
  26. package/_vendor/canvas-core/editor/managers/renderWindowManager.d.ts +25 -0
  27. package/_vendor/canvas-core/editor/managers/selectionGeometry.d.ts +28 -0
  28. package/_vendor/canvas-core/editor/managers/selectionLayoutManager.d.ts +29 -0
  29. package/_vendor/canvas-core/editor/managers/selectionManager.d.ts +21 -0
  30. package/_vendor/canvas-core/editor/managers/selectionOverlayManager.d.ts +24 -0
  31. package/_vendor/canvas-core/editor/managers/shapeEditingManager.d.ts +29 -0
  32. package/_vendor/canvas-core/editor/managers/shapeGeometryManager.d.ts +42 -0
  33. package/_vendor/canvas-core/editor/managers/shapeHierarchyManager.d.ts +55 -0
  34. package/_vendor/canvas-core/editor/managers/shapeOrder.d.ts +14 -0
  35. package/_vendor/canvas-core/editor/managers/shapeReparenting.d.ts +6 -0
  36. package/_vendor/canvas-core/editor/managers/shortcutManager.d.ts +56 -0
  37. package/_vendor/canvas-core/editor/managers/sideEffectManager.d.ts +23 -0
  38. package/_vendor/canvas-core/editor/managers/snapCalculations.d.ts +40 -0
  39. package/_vendor/canvas-core/editor/managers/snapGeometry.d.ts +26 -0
  40. package/_vendor/canvas-core/editor/managers/snapIndicators.d.ts +22 -0
  41. package/_vendor/canvas-core/editor/managers/snapManager.d.ts +29 -0
  42. package/_vendor/canvas-core/editor/managers/snapSnapshotBuilder.d.ts +22 -0
  43. package/_vendor/canvas-core/editor/managers/snapTypes.d.ts +98 -0
  44. package/_vendor/canvas-core/editor/managers/spatialIndexManager.d.ts +30 -0
  45. package/_vendor/canvas-core/editor/managers/toolManager.d.ts +24 -0
  46. package/_vendor/canvas-core/editor/queries/shapeTransforms.d.ts +27 -0
  47. package/_vendor/canvas-core/editor/renderWindow.d.ts +30 -0
  48. package/_vendor/canvas-core/editor/resizeGeometry.d.ts +97 -0
  49. package/_vendor/canvas-core/editor/selection.d.ts +231 -0
  50. package/_vendor/canvas-core/editor/selectionHandleInteractions.d.ts +11 -0
  51. package/_vendor/canvas-core/editor/selectionOverlay.d.ts +33 -0
  52. package/_vendor/canvas-core/editor/stateNode.d.ts +31 -0
  53. package/_vendor/canvas-core/exports/integrity.d.ts +32 -0
  54. package/_vendor/canvas-core/exports/svg.d.ts +52 -0
  55. package/_vendor/canvas-core/geometry/box.d.ts +19 -0
  56. package/_vendor/canvas-core/geometry/ellipse2d.d.ts +16 -0
  57. package/_vendor/canvas-core/geometry/geometry2d.d.ts +15 -0
  58. package/_vendor/canvas-core/geometry/index.d.ts +8 -0
  59. package/_vendor/canvas-core/geometry/mat.d.ts +28 -0
  60. package/_vendor/canvas-core/geometry/polyline2d.d.ts +14 -0
  61. package/_vendor/canvas-core/geometry/rectangle2d.d.ts +16 -0
  62. package/_vendor/canvas-core/geometry/segments.d.ts +5 -0
  63. package/_vendor/canvas-core/geometry/vec.d.ts +37 -0
  64. package/_vendor/canvas-core/index.d.ts +59 -0
  65. package/_vendor/canvas-core/plugins/editorPlugin.d.ts +28 -0
  66. package/_vendor/canvas-core/plugins/index.d.ts +1 -0
  67. package/_vendor/canvas-core/reactivity.d.ts +4 -0
  68. package/_vendor/canvas-core/schema/records.d.ts +112 -0
  69. package/_vendor/canvas-core/schema/snapshotSupport.d.ts +43 -0
  70. package/_vendor/canvas-core/schema/snapshots.d.ts +31 -0
  71. package/_vendor/canvas-core/shapes/capabilities.d.ts +25 -0
  72. package/_vendor/canvas-core/shapes/colors.d.ts +26 -0
  73. package/_vendor/canvas-core/shapes/shapeUtil.d.ts +146 -0
  74. package/_vendor/canvas-core/shapes/shapeUtilRegistry.d.ts +9 -0
  75. package/_vendor/canvas-core/shapes/types.d.ts +2 -0
  76. package/_vendor/canvas-core/surfaces/actions.d.ts +35 -0
  77. package/_vendor/canvas-core/surfaces/contextMenu.d.ts +64 -0
  78. package/_vendor/canvas-core/surfaces/toolbar.d.ts +96 -0
  79. package/_vendor/canvas-core/tools/hand/handTool.d.ts +5 -0
  80. package/_vendor/canvas-core/tools/index.d.ts +2 -0
  81. package/_vendor/canvas-core/tools/select/selectContainment.d.ts +12 -0
  82. package/_vendor/canvas-core/tools/select/selectTool.d.ts +5 -0
  83. package/_vendor/canvas-core/tools/select/selectToolHelpers.d.ts +161 -0
  84. package/_vendor/canvas-core/tools/select/states/brushingState.d.ts +19 -0
  85. package/_vendor/canvas-core/tools/select/states/draggingSelectionHandleInteractionState.d.ts +15 -0
  86. package/_vendor/canvas-core/tools/select/states/idleState.d.ts +8 -0
  87. package/_vendor/canvas-core/tools/select/states/index.d.ts +11 -0
  88. package/_vendor/canvas-core/tools/select/states/pointingCanvasState.d.ts +11 -0
  89. package/_vendor/canvas-core/tools/select/states/pointingResizeHandleState.d.ts +10 -0
  90. package/_vendor/canvas-core/tools/select/states/pointingRotateHandleState.d.ts +10 -0
  91. package/_vendor/canvas-core/tools/select/states/pointingSelectionHandleInteractionState.d.ts +10 -0
  92. package/_vendor/canvas-core/tools/select/states/pointingShapeState.d.ts +12 -0
  93. package/_vendor/canvas-core/tools/select/states/resizingState.d.ts +16 -0
  94. package/_vendor/canvas-core/tools/select/states/rotatingState.d.ts +14 -0
  95. package/_vendor/canvas-core/tools/select/states/selectStateNode.d.ts +60 -0
  96. package/_vendor/canvas-core/tools/select/states/translatingState.d.ts +17 -0
  97. package/_vendor/canvas-react/components/CanvasView.d.ts +14 -0
  98. package/_vendor/canvas-react/components/OverlayLayer.d.ts +1 -0
  99. package/_vendor/canvas-react/components/PageSpace.d.ts +6 -0
  100. package/_vendor/canvas-react/components/ShapeLayer.d.ts +4 -0
  101. package/_vendor/canvas-react/components/index.d.ts +2 -0
  102. package/_vendor/canvas-react/components/overlays/BindingGuide.d.ts +24 -0
  103. package/_vendor/canvas-react/components/overlays/BindingPreviewOverlay.d.ts +1 -0
  104. package/_vendor/canvas-react/components/overlays/BrushBoxOverlay.d.ts +1 -0
  105. package/_vendor/canvas-react/components/overlays/OverlaySvgRoot.d.ts +1 -0
  106. package/_vendor/canvas-react/components/overlays/SelectionFrameOverlay.d.ts +1 -0
  107. package/_vendor/canvas-react/components/overlays/SelectionHandlesOverlay.d.ts +1 -0
  108. package/_vendor/canvas-react/components/overlays/SelectionOverlaySvg.d.ts +1 -0
  109. package/_vendor/canvas-react/components/overlays/SelectionPathOverlay.d.ts +1 -0
  110. package/_vendor/canvas-react/components/overlays/ShapeOutlineOverlay.d.ts +8 -0
  111. package/_vendor/canvas-react/components/overlays/SnapIndicatorsOverlay.d.ts +1 -0
  112. package/_vendor/canvas-react/components/useCanvasDomEvents.d.ts +21 -0
  113. package/_vendor/canvas-react/dom.d.ts +10 -0
  114. package/_vendor/canvas-react/hooks/useEditor.d.ts +3 -0
  115. package/_vendor/canvas-react/hooks/useValue.d.ts +2 -0
  116. package/_vendor/canvas-react/host/canvasOverlayRegistryContext.d.ts +3 -0
  117. package/_vendor/canvas-react/host/canvasPlugin.d.ts +73 -0
  118. package/_vendor/canvas-react/host/canvasRendererRegistryContext.d.ts +3 -0
  119. package/_vendor/canvas-react/host/contextMenuRegistry.d.ts +12 -0
  120. package/_vendor/canvas-react/host/domEventGuards.d.ts +11 -0
  121. package/_vendor/canvas-react/host/extension.d.ts +37 -0
  122. package/_vendor/canvas-react/host/index.d.ts +13 -0
  123. package/_vendor/canvas-react/host/overlayRegistry.d.ts +18 -0
  124. package/_vendor/canvas-react/host/pluginHost.d.ts +2 -0
  125. package/_vendor/canvas-react/host/pluginHostManifest.d.ts +2 -0
  126. package/_vendor/canvas-react/host/pluginHostRuntime.d.ts +3 -0
  127. package/_vendor/canvas-react/host/pluginHostTypes.d.ts +102 -0
  128. package/_vendor/canvas-react/host/pluginHostValidation.d.ts +11 -0
  129. package/_vendor/canvas-react/host/rendererRegistry.d.ts +12 -0
  130. package/_vendor/canvas-react/host/toolbarRegistry.d.ts +24 -0
  131. package/_vendor/canvas-react/index.d.ts +4 -0
  132. package/_vendor/plugin-arrow/arrowBindingAnchors.d.ts +5 -0
  133. package/_vendor/plugin-arrow/arrowBindingGeometry.d.ts +28 -0
  134. package/_vendor/plugin-arrow/arrowBindingUtil.d.ts +27 -0
  135. package/_vendor/plugin-arrow/arrowGeometry.d.ts +74 -0
  136. package/_vendor/plugin-arrow/arrowShapeUtil.d.ts +21 -0
  137. package/_vendor/plugin-arrow/arrowTerminalBindingResolver.d.ts +20 -0
  138. package/_vendor/plugin-arrow/arrowTerminalCommands.d.ts +12 -0
  139. package/_vendor/plugin-arrow/arrowTool.d.ts +4 -0
  140. package/_vendor/plugin-arrow/canvas.d.ts +2 -0
  141. package/_vendor/plugin-arrow/editor.d.ts +7 -0
  142. package/_vendor/plugin-arrow/feature.d.ts +3 -0
  143. package/_vendor/plugin-arrow/index.d.ts +12 -0
  144. package/_vendor/plugin-arrow/selectionHandleInteractions.d.ts +3 -0
  145. package/_vendor/plugin-arrow/types.d.ts +31 -0
  146. package/_vendor/plugin-draw/DrawShapeRenderer.d.ts +10 -0
  147. package/_vendor/plugin-draw/canvas.d.ts +2 -0
  148. package/_vendor/plugin-draw/drawGeometry.d.ts +45 -0
  149. package/_vendor/plugin-draw/drawHitTest.d.ts +11 -0
  150. package/_vendor/plugin-draw/drawInterpolation.d.ts +5 -0
  151. package/_vendor/plugin-draw/drawPath.d.ts +37 -0
  152. package/_vendor/plugin-draw/drawSegments.d.ts +11 -0
  153. package/_vendor/plugin-draw/drawSelectionTransform.d.ts +18 -0
  154. package/_vendor/plugin-draw/drawShapeGeometry.d.ts +33 -0
  155. package/_vendor/plugin-draw/drawShapeUtil.d.ts +21 -0
  156. package/_vendor/plugin-draw/drawStrokeGeometry.d.ts +17 -0
  157. package/_vendor/plugin-draw/drawTool.d.ts +6 -0
  158. package/_vendor/plugin-draw/editor.d.ts +7 -0
  159. package/_vendor/plugin-draw/feature.d.ts +3 -0
  160. package/_vendor/plugin-draw/index.d.ts +13 -0
  161. package/_vendor/plugin-draw/types.d.ts +23 -0
  162. package/_vendor/plugin-eraser/canvas.d.ts +2 -0
  163. package/_vendor/plugin-eraser/editor.d.ts +2 -0
  164. package/_vendor/plugin-eraser/eraserTool.d.ts +5 -0
  165. package/_vendor/plugin-eraser/feature.d.ts +3 -0
  166. package/_vendor/plugin-eraser/{index.ts → index.d.ts} +2 -2
  167. package/_vendor/plugin-frame/canvas.d.ts +9 -0
  168. package/_vendor/plugin-frame/editor.d.ts +7 -0
  169. package/_vendor/plugin-frame/feature.d.ts +3 -0
  170. package/_vendor/plugin-frame/frameShapeUtil.d.ts +23 -0
  171. package/_vendor/plugin-frame/frameTool.d.ts +6 -0
  172. package/_vendor/plugin-frame/index.d.ts +6 -0
  173. package/_vendor/plugin-geo/canvas.d.ts +13 -0
  174. package/_vendor/plugin-geo/editor.d.ts +7 -0
  175. package/_vendor/plugin-geo/feature.d.ts +3 -0
  176. package/_vendor/plugin-geo/geoGeometry.d.ts +8 -0
  177. package/_vendor/plugin-geo/geoShapeUtil.d.ts +13 -0
  178. package/_vendor/plugin-geo/geoTools.d.ts +26 -0
  179. package/_vendor/plugin-geo/index.d.ts +7 -0
  180. package/_vendor/plugin-geo/types.d.ts +17 -0
  181. package/_vendor/plugin-group/canvas.d.ts +10 -0
  182. package/_vendor/plugin-group/editor.d.ts +7 -0
  183. package/_vendor/plugin-group/feature.d.ts +3 -0
  184. package/_vendor/plugin-group/groupShapeUtil.d.ts +15 -0
  185. package/_vendor/plugin-group/index.d.ts +5 -0
  186. package/_vendor/plugin-image/canvas.d.ts +2 -0
  187. package/_vendor/plugin-image/crop.d.ts +112 -0
  188. package/_vendor/plugin-image/cropInteractions.d.ts +3 -0
  189. package/_vendor/plugin-image/cropSession.d.ts +4 -0
  190. package/_vendor/plugin-image/editor.d.ts +16 -0
  191. package/_vendor/plugin-image/feature.d.ts +3 -0
  192. package/_vendor/plugin-image/imageShapeUtil.d.ts +11 -0
  193. package/_vendor/plugin-image/index.d.ts +8 -0
  194. package/_vendor/plugin-image/types.d.ts +37 -0
  195. package/_vendor/plugin-laser/canvas.d.ts +2 -0
  196. package/_vendor/plugin-laser/editor.d.ts +2 -0
  197. package/_vendor/plugin-laser/feature.d.ts +3 -0
  198. package/_vendor/plugin-laser/{index.ts → index.d.ts} +2 -2
  199. package/_vendor/plugin-laser/laserTool.d.ts +4 -0
  200. package/_vendor/plugin-text/arrowLabelBindingUtil.d.ts +42 -0
  201. package/_vendor/plugin-text/canvas.d.ts +2 -0
  202. package/_vendor/plugin-text/editor.d.ts +2 -0
  203. package/_vendor/plugin-text/feature.d.ts +3 -0
  204. package/_vendor/plugin-text/geoLabelBindingUtil.d.ts +45 -0
  205. package/_vendor/plugin-text/host/RichTextEditingBox.d.ts +5 -0
  206. package/_vendor/plugin-text/host/RichTextToolbar.d.ts +8 -0
  207. package/_vendor/plugin-text/host/TiptapTextEditor.d.ts +24 -0
  208. package/_vendor/plugin-text/host/richTextBubbleMenuPositionSync.d.ts +7 -0
  209. package/_vendor/plugin-text/host/richTextRendering.d.ts +3 -0
  210. package/_vendor/plugin-text/host/textDomSelection.d.ts +7 -0
  211. package/_vendor/plugin-text/host/textEditingBoxStyle.d.ts +3 -0
  212. package/_vendor/plugin-text/host/textEntryFocus.d.ts +22 -0
  213. package/_vendor/plugin-text/host/textFontLoader.d.ts +2 -0
  214. package/_vendor/plugin-text/host/textMeasurement.d.ts +12 -0
  215. package/_vendor/plugin-text/host/textMeasurementSync.d.ts +10 -0
  216. package/_vendor/plugin-text/host/textRangeSelection.d.ts +14 -0
  217. package/_vendor/plugin-text/host/textShapeRendererRuntime.d.ts +8 -0
  218. package/_vendor/plugin-text/host/textShapeSync.d.ts +17 -0
  219. package/_vendor/plugin-text/host/tiptapTextEditorController.d.ts +33 -0
  220. package/_vendor/plugin-text/index.d.ts +4 -0
  221. package/_vendor/plugin-text/richTextUtils.d.ts +18 -0
  222. package/_vendor/plugin-text/textInteractions.d.ts +2 -0
  223. package/_vendor/plugin-text/textLabelHelpers.d.ts +44 -0
  224. package/_vendor/plugin-text/textShapeHelpers.d.ts +21 -0
  225. package/_vendor/plugin-text/textShapeSvgExporter.d.ts +6 -0
  226. package/_vendor/plugin-text/textShapeUtil.d.ts +19 -0
  227. package/_vendor/plugin-text/textStyle.d.ts +9 -0
  228. package/_vendor/plugin-text/textTool.d.ts +4 -0
  229. package/_vendor/plugin-text/textTypes.d.ts +28 -0
  230. package/_vendor/signals/atom.d.ts +9 -0
  231. package/_vendor/signals/computed.d.ts +11 -0
  232. package/_vendor/signals/core.d.ts +17 -0
  233. package/_vendor/signals/effect.d.ts +29 -0
  234. package/_vendor/signals/types.d.ts +15 -0
  235. package/_vendor/store/diff.d.ts +9 -0
  236. package/_vendor/store/history.d.ts +37 -0
  237. package/_vendor/store/index.d.ts +5 -0
  238. package/_vendor/store/store.d.ts +32 -0
  239. package/_vendor/store/types.d.ts +27 -0
  240. package/browser/localSnapshotRestore.d.ts +13 -0
  241. package/browser/persistence.d.ts +46 -0
  242. package/builtins/controller/createBuiltInCanvasController.d.ts +16 -0
  243. package/builtins/controller/layerController.d.ts +9 -0
  244. package/builtins/controller/shapeCreationController.d.ts +74 -0
  245. package/builtins/extensions.d.ts +15 -0
  246. package/builtins/index.d.ts +5 -0
  247. package/chrome/CanvasKitFloatingToolbarLayer.d.ts +6 -0
  248. package/chrome/FloatingSelectionToolbarPageSpace.d.ts +9 -0
  249. package/chrome/bindings/useCanvasKitChromeControls.d.ts +27 -0
  250. package/chrome/bindings/useContextMenuSurface.d.ts +12 -0
  251. package/chrome/bindings/useSvgExport.d.ts +15 -0
  252. package/chrome/bindings/useToolbarSurfaces.d.ts +26 -0
  253. package/chrome/types.d.ts +66 -0
  254. package/chrome/useCanvasKitChromeContext.d.ts +19 -0
  255. package/controller/canvasKitController.d.ts +36 -0
  256. package/core/controller/canvasProductController.d.ts +114 -0
  257. package/core/controller/featureControllerRegistry.d.ts +12 -0
  258. package/core/controller/index.d.ts +4 -0
  259. package/core/controller/productLayerTree.d.ts +10 -0
  260. package/core/features/actions/canvasActionContext.d.ts +15 -0
  261. package/core/features/actions/canvasActions.d.ts +26 -0
  262. package/core/features/clipboard/clipboardContextMenuContributions.d.ts +2 -0
  263. package/core/features/clipboard/clipboardContribution.d.ts +19 -0
  264. package/core/features/clipboard/clipboardService.d.ts +10 -0
  265. package/core/features/context-menu/contextMenuActions.d.ts +12 -0
  266. package/core/features/context-menu/contextMenuContext.d.ts +6 -0
  267. package/core/features/context-menu/contextMenuContribution.d.ts +4 -0
  268. package/core/features/context-menu/viewContextMenuContributions.d.ts +2 -0
  269. package/core/features/export/svgExport.d.ts +33 -0
  270. package/core/features/hostActionIds.d.ts +1 -0
  271. package/core/features/toolbar/selectionContextMenuContributions.d.ts +2 -0
  272. package/core/features/toolbar/toolContextMenuContributions.d.ts +2 -0
  273. package/core/features/toolbar/toolbarContribution.d.ts +4 -0
  274. package/core/features/toolbar/toolbarLabels.d.ts +8 -0
  275. package/core/index.d.ts +23 -0
  276. package/core/runtime/productAssets.d.ts +18 -0
  277. package/core/runtime/productContributions.d.ts +9 -0
  278. package/core/runtime/productDefinition.d.ts +32 -0
  279. package/core/runtime/productEditor.d.ts +3 -0
  280. package/core/runtime/productHost.d.ts +17 -0
  281. package/core/runtime/productServices.d.ts +30 -0
  282. package/features/image/ImageImportController.d.ts +9 -0
  283. package/features/image/imageAssetService.d.ts +7 -0
  284. package/features/image/imageBlobStore.d.ts +25 -0
  285. package/features/image/imageFileHelpers.d.ts +35 -0
  286. package/features/image/imageHostActions.d.ts +36 -0
  287. package/features/image/imageHostExtension.d.ts +5 -0
  288. package/features/image/imageProductController.d.ts +22 -0
  289. package/features/image/imageProductToolbarActions.d.ts +2 -0
  290. package/features/image/imageToolbarHostBridge.d.ts +14 -0
  291. package/features/image/index.d.ts +15 -0
  292. package/features/image/svgImageAssetInliner.d.ts +3 -0
  293. package/features/image/useImageImport.d.ts +17 -0
  294. package/index.css +1 -2
  295. package/index.d.ts +12 -15
  296. package/index.mjs +66 -1
  297. package/package.json +1 -11
  298. package/product/canvasKitProduct.d.ts +59 -0
  299. package/react/CanvasKitPersistenceNotice.d.ts +4 -0
  300. package/react/CanvasKitRoot.d.ts +5 -0
  301. package/react/useCanvasKitController.d.ts +5 -0
  302. package/react/useCanvasKitKeyboardShortcuts.d.ts +6 -0
  303. package/react/useCanvasKitRuntime.d.ts +4 -0
  304. package/react/useCanvasKitStartup.d.ts +9 -0
  305. package/runtime/canvasKitHostExtensions.d.ts +19 -0
  306. package/runtime/canvasKitRuntime.d.ts +19 -0
  307. package/runtime/canvasKitRuntimeInitializer.d.ts +11 -0
  308. package/_vendor/canvas-core/bindings/BindingUtil.ts +0 -92
  309. package/_vendor/canvas-core/bindings/BindingUtilRegistry.ts +0 -22
  310. package/_vendor/canvas-core/bindings/arrow/arrowBindingHelpers.ts +0 -52
  311. package/_vendor/canvas-core/contextMenu.ts +0 -85
  312. package/_vendor/canvas-core/editor/Editor.ts +0 -2614
  313. package/_vendor/canvas-core/editor/HistoryManager.ts +0 -83
  314. package/_vendor/canvas-core/editor/StateNode.ts +0 -162
  315. package/_vendor/canvas-core/editor/camera.ts +0 -6
  316. package/_vendor/canvas-core/editor/clipboard.ts +0 -478
  317. package/_vendor/canvas-core/editor/commands.ts +0 -833
  318. package/_vendor/canvas-core/editor/edgeScroll.ts +0 -37
  319. package/_vendor/canvas-core/editor/editorComputedHelpers.ts +0 -257
  320. package/_vendor/canvas-core/editor/editorSelectionTransforms.ts +0 -116
  321. package/_vendor/canvas-core/editor/events.ts +0 -93
  322. package/_vendor/canvas-core/editor/index.ts +0 -12
  323. package/_vendor/canvas-core/editor/interactions.ts +0 -101
  324. package/_vendor/canvas-core/editor/internal.ts +0 -22
  325. package/_vendor/canvas-core/editor/managers/BindingManager.ts +0 -262
  326. package/_vendor/canvas-core/editor/managers/CameraManager.ts +0 -147
  327. package/_vendor/canvas-core/editor/managers/ClipboardManager.ts +0 -32
  328. package/_vendor/canvas-core/editor/managers/DocumentSnapshotManager.ts +0 -256
  329. package/_vendor/canvas-core/editor/managers/InputsManager.ts +0 -319
  330. package/_vendor/canvas-core/editor/managers/InteractionTransientManager.ts +0 -218
  331. package/_vendor/canvas-core/editor/managers/QueryManager.ts +0 -837
  332. package/_vendor/canvas-core/editor/managers/RenderWindowManager.ts +0 -347
  333. package/_vendor/canvas-core/editor/managers/SelectionLayoutManager.ts +0 -196
  334. package/_vendor/canvas-core/editor/managers/SelectionManager.ts +0 -98
  335. package/_vendor/canvas-core/editor/managers/SelectionOverlayManager.ts +0 -308
  336. package/_vendor/canvas-core/editor/managers/ShapeEditingManager.ts +0 -226
  337. package/_vendor/canvas-core/editor/managers/ShapeGeometryManager.ts +0 -162
  338. package/_vendor/canvas-core/editor/managers/ShapeHierarchyManager.ts +0 -797
  339. package/_vendor/canvas-core/editor/managers/SideEffectManager.ts +0 -83
  340. package/_vendor/canvas-core/editor/managers/SnapManager.ts +0 -433
  341. package/_vendor/canvas-core/editor/managers/SnapSnapshotBuilder.ts +0 -430
  342. package/_vendor/canvas-core/editor/managers/SpatialIndexManager.ts +0 -354
  343. package/_vendor/canvas-core/editor/managers/ToolManager.ts +0 -81
  344. package/_vendor/canvas-core/editor/managers/queryState.ts +0 -583
  345. package/_vendor/canvas-core/editor/managers/selectionGeometry.ts +0 -287
  346. package/_vendor/canvas-core/editor/managers/shapeOrder.ts +0 -350
  347. package/_vendor/canvas-core/editor/managers/shapeReparenting.ts +0 -160
  348. package/_vendor/canvas-core/editor/managers/snapCalculations.ts +0 -412
  349. package/_vendor/canvas-core/editor/managers/snapGeometry.ts +0 -202
  350. package/_vendor/canvas-core/editor/managers/snapIndicators.ts +0 -403
  351. package/_vendor/canvas-core/editor/managers/snapTypes.ts +0 -122
  352. package/_vendor/canvas-core/editor/queries/shapeTransforms.ts +0 -171
  353. package/_vendor/canvas-core/editor/renderWindow.ts +0 -439
  354. package/_vendor/canvas-core/editor/resizeGeometry.ts +0 -654
  355. package/_vendor/canvas-core/editor/selection.ts +0 -489
  356. package/_vendor/canvas-core/editor/selectionHandleInteractions.ts +0 -43
  357. package/_vendor/canvas-core/editor/selectionOverlay.ts +0 -567
  358. package/_vendor/canvas-core/exports/integrity.ts +0 -174
  359. package/_vendor/canvas-core/exports/svg.ts +0 -494
  360. package/_vendor/canvas-core/geometry/Box.ts +0 -80
  361. package/_vendor/canvas-core/geometry/Ellipse2d.ts +0 -67
  362. package/_vendor/canvas-core/geometry/Geometry2d.ts +0 -52
  363. package/_vendor/canvas-core/geometry/Mat.ts +0 -92
  364. package/_vendor/canvas-core/geometry/Polyline2d.ts +0 -63
  365. package/_vendor/canvas-core/geometry/Rectangle2d.ts +0 -64
  366. package/_vendor/canvas-core/geometry/Vec.ts +0 -123
  367. package/_vendor/canvas-core/geometry/index.ts +0 -13
  368. package/_vendor/canvas-core/geometry/segments.ts +0 -65
  369. package/_vendor/canvas-core/index.ts +0 -391
  370. package/_vendor/canvas-core/plugins/index.ts +0 -5
  371. package/_vendor/canvas-core/plugins/types.ts +0 -53
  372. package/_vendor/canvas-core/reactivity.ts +0 -16
  373. package/_vendor/canvas-core/schema/records.ts +0 -221
  374. package/_vendor/canvas-core/schema/snapshots.ts +0 -527
  375. package/_vendor/canvas-core/shapes/ShapeUtil.ts +0 -516
  376. package/_vendor/canvas-core/shapes/ShapeUtilRegistry.ts +0 -26
  377. package/_vendor/canvas-core/shapes/capabilities.ts +0 -67
  378. package/_vendor/canvas-core/shapes/types.ts +0 -20
  379. package/_vendor/canvas-core/toolbar.ts +0 -148
  380. package/_vendor/canvas-core/tools/hand/HandTool.ts +0 -75
  381. package/_vendor/canvas-core/tools/index.ts +0 -2
  382. package/_vendor/canvas-core/tools/select/SelectTool.ts +0 -33
  383. package/_vendor/canvas-core/tools/select/selectContainment.ts +0 -104
  384. package/_vendor/canvas-core/tools/select/selectToolHelpers.ts +0 -801
  385. package/_vendor/canvas-core/tools/select/states/BrushingState.ts +0 -145
  386. package/_vendor/canvas-core/tools/select/states/DraggingSelectionHandleInteractionState.ts +0 -116
  387. package/_vendor/canvas-core/tools/select/states/IdleState.ts +0 -159
  388. package/_vendor/canvas-core/tools/select/states/PointingCanvasState.ts +0 -41
  389. package/_vendor/canvas-core/tools/select/states/PointingResizeHandleState.ts +0 -78
  390. package/_vendor/canvas-core/tools/select/states/PointingRotateHandleState.ts +0 -64
  391. package/_vendor/canvas-core/tools/select/states/PointingSelectionHandleInteractionState.ts +0 -34
  392. package/_vendor/canvas-core/tools/select/states/PointingShapeState.ts +0 -140
  393. package/_vendor/canvas-core/tools/select/states/ResizingState.ts +0 -171
  394. package/_vendor/canvas-core/tools/select/states/RotatingState.ts +0 -124
  395. package/_vendor/canvas-core/tools/select/states/SelectStateNode.ts +0 -128
  396. package/_vendor/canvas-core/tools/select/states/TranslatingState.ts +0 -139
  397. package/_vendor/canvas-core/tools/select/states/index.ts +0 -11
  398. package/_vendor/canvas-plugin-api/feature.ts +0 -204
  399. package/_vendor/canvas-plugin-api/index.ts +0 -142
  400. package/_vendor/canvas-product-react/api/apiRegistry.ts +0 -35
  401. package/_vendor/canvas-product-react/api/canvasProductApi.ts +0 -422
  402. package/_vendor/canvas-product-react/api/index.ts +0 -31
  403. package/_vendor/canvas-product-react/capabilities/clipboard/clipboardService.ts +0 -36
  404. package/_vendor/canvas-product-react/capabilities/clipboard/systemClipboard.ts +0 -245
  405. package/_vendor/canvas-product-react/capabilities/context-menu/systemContextMenu.ts +0 -396
  406. package/_vendor/canvas-product-react/capabilities/context-menu/useContextMenuSurface.ts +0 -59
  407. package/_vendor/canvas-product-react/capabilities/export/useSvgExport.ts +0 -156
  408. package/_vendor/canvas-product-react/capabilities/history/useHistoryControls.ts +0 -23
  409. package/_vendor/canvas-product-react/capabilities/pages/usePageControls.ts +0 -41
  410. package/_vendor/canvas-product-react/capabilities/toolbar/systemToolbar.ts +0 -490
  411. package/_vendor/canvas-product-react/capabilities/toolbar/useToolbarSurfaces.ts +0 -92
  412. package/_vendor/canvas-product-react/capabilities/zoom/useZoomControls.ts +0 -27
  413. package/_vendor/canvas-product-react/index.ts +0 -84
  414. package/_vendor/canvas-product-react/persistence/index.ts +0 -18
  415. package/_vendor/canvas-product-react/persistence/localSnapshotPersistence.ts +0 -294
  416. package/_vendor/canvas-product-react/runtime/CanvasProductRoot.tsx +0 -250
  417. package/_vendor/canvas-product-react/runtime/productDefinition.ts +0 -72
  418. package/_vendor/canvas-product-react/runtime/productServices.ts +0 -96
  419. package/_vendor/canvas-react/components/CanvasView.tsx +0 -796
  420. package/_vendor/canvas-react/components/OverlayLayer.tsx +0 -879
  421. package/_vendor/canvas-react/components/PageSpace.tsx +0 -34
  422. package/_vendor/canvas-react/components/ShapeLayer.tsx +0 -428
  423. package/_vendor/canvas-react/components/index.ts +0 -4
  424. package/_vendor/canvas-react/hooks/useEditor.ts +0 -11
  425. package/_vendor/canvas-react/hooks/useValue.ts +0 -14
  426. package/_vendor/canvas-react/host/CanvasRendererRegistryContext.tsx +0 -14
  427. package/_vendor/canvas-react/host/contextMenuRegistry.ts +0 -61
  428. package/_vendor/canvas-react/host/domEventGuards.ts +0 -61
  429. package/_vendor/canvas-react/host/index.ts +0 -38
  430. package/_vendor/canvas-react/host/pluginHost.ts +0 -635
  431. package/_vendor/canvas-react/host/rendererRegistry.tsx +0 -58
  432. package/_vendor/canvas-react/host/toolbarRegistry.ts +0 -100
  433. package/_vendor/canvas-react/index.ts +0 -3
  434. package/_vendor/plugin-arrow/ArrowBindingUtil.ts +0 -239
  435. package/_vendor/plugin-arrow/ArrowShapeUtil.ts +0 -311
  436. package/_vendor/plugin-arrow/ArrowTool.ts +0 -208
  437. package/_vendor/plugin-arrow/arrowGeometry.ts +0 -441
  438. package/_vendor/plugin-arrow/arrowTerminalBindingResolver.ts +0 -253
  439. package/_vendor/plugin-arrow/arrowTerminalCommands.ts +0 -230
  440. package/_vendor/plugin-arrow/canvas.tsx +0 -92
  441. package/_vendor/plugin-arrow/core.ts +0 -409
  442. package/_vendor/plugin-arrow/feature.ts +0 -20
  443. package/_vendor/plugin-arrow/index.ts +0 -28
  444. package/_vendor/plugin-arrow/selectionHandleInteractions.ts +0 -154
  445. package/_vendor/plugin-arrow/types.ts +0 -63
  446. package/_vendor/plugin-draw/DrawShapeRenderer.tsx +0 -60
  447. package/_vendor/plugin-draw/DrawShapeUtil.ts +0 -372
  448. package/_vendor/plugin-draw/DrawTool.ts +0 -444
  449. package/_vendor/plugin-draw/canvas.tsx +0 -24
  450. package/_vendor/plugin-draw/core.ts +0 -515
  451. package/_vendor/plugin-draw/drawGeometry.ts +0 -491
  452. package/_vendor/plugin-draw/drawHitTest.ts +0 -271
  453. package/_vendor/plugin-draw/drawInterpolation.ts +0 -250
  454. package/_vendor/plugin-draw/drawPath.ts +0 -550
  455. package/_vendor/plugin-draw/drawSegments.ts +0 -106
  456. package/_vendor/plugin-draw/drawSelectionTransform.ts +0 -67
  457. package/_vendor/plugin-draw/drawShapeGeometry.ts +0 -307
  458. package/_vendor/plugin-draw/drawStrokeGeometry.ts +0 -454
  459. package/_vendor/plugin-draw/feature.ts +0 -20
  460. package/_vendor/plugin-draw/index.ts +0 -31
  461. package/_vendor/plugin-draw/types.ts +0 -36
  462. package/_vendor/plugin-eraser/EraserTool.ts +0 -297
  463. package/_vendor/plugin-eraser/canvas.tsx +0 -616
  464. package/_vendor/plugin-eraser/core.ts +0 -49
  465. package/_vendor/plugin-eraser/feature.ts +0 -20
  466. package/_vendor/plugin-frame/FrameShapeUtil.ts +0 -173
  467. package/_vendor/plugin-frame/FrameTool.ts +0 -225
  468. package/_vendor/plugin-frame/canvas.tsx +0 -75
  469. package/_vendor/plugin-frame/core.ts +0 -534
  470. package/_vendor/plugin-frame/feature.ts +0 -20
  471. package/_vendor/plugin-frame/index.ts +0 -6
  472. package/_vendor/plugin-geo/GeoShapeUtil.ts +0 -463
  473. package/_vendor/plugin-geo/GeoTools.ts +0 -247
  474. package/_vendor/plugin-geo/canvas.tsx +0 -90
  475. package/_vendor/plugin-geo/core.ts +0 -495
  476. package/_vendor/plugin-geo/feature.ts +0 -20
  477. package/_vendor/plugin-geo/index.ts +0 -7
  478. package/_vendor/plugin-geo/types.ts +0 -27
  479. package/_vendor/plugin-group/GroupShapeUtil.ts +0 -59
  480. package/_vendor/plugin-group/canvas.tsx +0 -59
  481. package/_vendor/plugin-group/core.ts +0 -40
  482. package/_vendor/plugin-group/feature.ts +0 -20
  483. package/_vendor/plugin-group/index.ts +0 -5
  484. package/_vendor/plugin-image/ImageShapeUtil.ts +0 -95
  485. package/_vendor/plugin-image/canvas.tsx +0 -212
  486. package/_vendor/plugin-image/core.ts +0 -542
  487. package/_vendor/plugin-image/crop.ts +0 -770
  488. package/_vendor/plugin-image/cropInteractions.ts +0 -350
  489. package/_vendor/plugin-image/cropSession.ts +0 -38
  490. package/_vendor/plugin-image/feature.ts +0 -20
  491. package/_vendor/plugin-image/index.ts +0 -29
  492. package/_vendor/plugin-image/types.ts +0 -55
  493. package/_vendor/plugin-image-product-react/ImageImportController.tsx +0 -143
  494. package/_vendor/plugin-image-product-react/imageAssetService.ts +0 -52
  495. package/_vendor/plugin-image-product-react/imageBlobStore.ts +0 -315
  496. package/_vendor/plugin-image-product-react/imageHostActions.ts +0 -438
  497. package/_vendor/plugin-image-product-react/imageProductApi.ts +0 -88
  498. package/_vendor/plugin-image-product-react/imageToolbarHostBridge.ts +0 -48
  499. package/_vendor/plugin-image-product-react/imageToolbarRuntime.ts +0 -21
  500. package/_vendor/plugin-image-product-react/index.ts +0 -60
  501. package/_vendor/plugin-image-product-react/snapshotGuards.ts +0 -33
  502. package/_vendor/plugin-image-product-react/svgImageAssetInliner.ts +0 -54
  503. package/_vendor/plugin-image-product-react/useImageImport.ts +0 -64
  504. package/_vendor/plugin-laser/LaserTool.ts +0 -154
  505. package/_vendor/plugin-laser/canvas.tsx +0 -645
  506. package/_vendor/plugin-laser/core.ts +0 -49
  507. package/_vendor/plugin-laser/feature.ts +0 -20
  508. package/_vendor/plugin-text/ArrowLabelBindingUtil.ts +0 -336
  509. package/_vendor/plugin-text/GeoLabelBindingUtil.ts +0 -391
  510. package/_vendor/plugin-text/TextShapeSvgExporter.ts +0 -101
  511. package/_vendor/plugin-text/TextShapeUtil.ts +0 -284
  512. package/_vendor/plugin-text/TextTool.ts +0 -228
  513. package/_vendor/plugin-text/canvas.tsx +0 -115
  514. package/_vendor/plugin-text/core.ts +0 -422
  515. package/_vendor/plugin-text/feature.ts +0 -20
  516. package/_vendor/plugin-text/host/RichTextEditingBox.tsx +0 -144
  517. package/_vendor/plugin-text/host/RichTextToolbar.tsx +0 -266
  518. package/_vendor/plugin-text/host/TiptapTextEditor.tsx +0 -191
  519. package/_vendor/plugin-text/host/richTextRendering.tsx +0 -49
  520. package/_vendor/plugin-text/host/textDomSelection.ts +0 -93
  521. package/_vendor/plugin-text/host/textEditingBoxStyle.ts +0 -36
  522. package/_vendor/plugin-text/host/textEntryFocus.ts +0 -307
  523. package/_vendor/plugin-text/host/textFontLoader.ts +0 -149
  524. package/_vendor/plugin-text/host/textMeasurement.ts +0 -258
  525. package/_vendor/plugin-text/host/textMeasurementSync.ts +0 -77
  526. package/_vendor/plugin-text/host/textRangeSelection.ts +0 -134
  527. package/_vendor/plugin-text/host/textShapeRendererRuntime.tsx +0 -89
  528. package/_vendor/plugin-text/host/textShapeSync.ts +0 -173
  529. package/_vendor/plugin-text/host/tiptapTextEditorController.ts +0 -148
  530. package/_vendor/plugin-text/index.ts +0 -18
  531. package/_vendor/plugin-text/richTextUtils.ts +0 -259
  532. package/_vendor/plugin-text/textInteractions.ts +0 -366
  533. package/_vendor/plugin-text/textLabelHelpers.ts +0 -235
  534. package/_vendor/plugin-text/textShapeHelpers.ts +0 -123
  535. package/_vendor/plugin-text/textStyle.ts +0 -96
  536. package/_vendor/plugin-text/textTypes.ts +0 -48
  537. package/_vendor/signals/atom.ts +0 -74
  538. package/_vendor/signals/computed.ts +0 -132
  539. package/_vendor/signals/core.ts +0 -130
  540. package/_vendor/signals/effect.ts +0 -117
  541. package/_vendor/signals/types.ts +0 -17
  542. package/_vendor/store/Store.ts +0 -171
  543. package/_vendor/store/diff.ts +0 -229
  544. package/_vendor/store/history.ts +0 -177
  545. package/_vendor/store/index.ts +0 -32
  546. package/_vendor/store/types.ts +0 -37
  547. package/api/canvasKitApi.d.ts +0 -29
  548. package/internal-modules.d.ts +0 -187
  549. package/product/Shell.d.ts +0 -19
  550. package/product/chromeContext.d.ts +0 -70
  551. package/product/createCanvasKitEditor.d.ts +0 -6
  552. package/product/index.d.ts +0 -7
  553. package/product/persistence.d.ts +0 -3
  554. package/product/product.d.ts +0 -22
  555. package/product/useCanvasClipboardShortcuts.d.ts +0 -6
  556. package/product-iyBbEPIs.mjs +0 -4
  557. package/product.mjs +0 -1
  558. package/standard/extensions.d.ts +0 -1
  559. package/standard/index.d.ts +0 -3
  560. package/standard/standardApi.d.ts +0 -91
  561. package/standard-BmrxwqpJ.mjs +0 -44
  562. package/standard.mjs +0 -1
  563. /package/_vendor/signals/{index.ts → index.d.ts} +0 -0
@@ -1,515 +0,0 @@
1
- import {
2
- SET_ACTIVE_TOOL_TOOLBAR_ACTION_ID,
3
- type ContextMenuContribution,
4
- type LandCorePlugin,
5
- type ShapeSvgExporter,
6
- type SvgNode,
7
- type ToolbarAction,
8
- type ToolbarActionValue,
9
- type ToolbarContribution,
10
- } from "@land/canvas-core";
11
- import { DrawShapeUtil } from "./DrawShapeUtil";
12
- import { DrawTool } from "./DrawTool";
13
- import { getDrawShapeLocalGeometry } from "./drawGeometry";
14
- import {
15
- isDrawShapeRecord,
16
- type DrawShapeProps,
17
- type DrawShapeRecord,
18
- } from "./types";
19
-
20
- export class DrawShapeSvgExporter implements ShapeSvgExporter<DrawShapeRecord> {
21
- readonly type = "draw" as const;
22
-
23
- toSvg(shape: DrawShapeRecord): SvgNode | null {
24
- const geometry = getDrawShapeLocalGeometry(shape);
25
- if (!geometry.path && !geometry.selectionPath) {
26
- return null;
27
- }
28
-
29
- const children: SvgNode[] = [];
30
- if (geometry.fillPath && shape.props.fill !== "transparent") {
31
- children.push({
32
- tag: "path",
33
- attrs: {
34
- d: geometry.fillPath,
35
- fill: shape.props.fill,
36
- stroke: "none",
37
- },
38
- });
39
- }
40
- if (shape.props.isClosed && geometry.selectionPath) {
41
- children.push({
42
- tag: "path",
43
- attrs: {
44
- d: geometry.selectionPath,
45
- fill: "none",
46
- stroke: shape.props.stroke,
47
- "stroke-width": shape.props.strokeWidth,
48
- "stroke-linecap": "round",
49
- "stroke-linejoin": "round",
50
- },
51
- });
52
- } else if (geometry.path) {
53
- children.push({
54
- tag: "path",
55
- attrs: {
56
- d: geometry.path,
57
- fill: shape.props.stroke,
58
- stroke: "none",
59
- },
60
- });
61
- }
62
-
63
- return {
64
- tag: "g",
65
- children,
66
- };
67
- }
68
- }
69
-
70
- export function createDrawCorePlugin(): LandCorePlugin {
71
- return {
72
- id: "land.draw",
73
- shapeCapabilities: [
74
- {
75
- type: "draw",
76
- schemaProps: [
77
- "segments",
78
- "stroke",
79
- "strokeWidth",
80
- "fill",
81
- "isClosed",
82
- "isPen",
83
- ],
84
- reactRenderer: "supported",
85
- toolbarEntry: "supported",
86
- notes: [
87
- "Draw stores raw segments as document truth and derives a shared freehand stroke geometry for render, hit test, brush wrap, and SVG export.",
88
- ],
89
- },
90
- ],
91
- shapeUtils: [new DrawShapeUtil()],
92
- shapeSvgExporters: [new DrawShapeSvgExporter()],
93
- toolbarActions: [
94
- createSetDrawClosedToolbarAction(),
95
- createSetDrawStyleToolbarAction("fill"),
96
- createSetDrawStyleToolbarAction("stroke"),
97
- createSetDrawStyleToolbarAction("strokeWidth"),
98
- createSetDrawDefaultClosedToolbarAction(),
99
- createSetDrawDefaultStyleToolbarAction("fill"),
100
- createSetDrawDefaultStyleToolbarAction("stroke"),
101
- createSetDrawDefaultStyleToolbarAction("strokeWidth"),
102
- ],
103
- toolbarContributions: [
104
- createDrawToolToolbarContribution(),
105
- createDrawDefaultStyleToolbarContribution(),
106
- createDrawSelectionToolbarContribution(),
107
- ],
108
- contextMenuContributions: [createDrawContextMenuContribution()],
109
- setup(editor) {
110
- editor.tools.register(
111
- "draw",
112
- (currentEditor) => new DrawTool(currentEditor),
113
- { shortcut: "p" },
114
- );
115
- },
116
- };
117
- }
118
-
119
- function createDrawContextMenuContribution(): ContextMenuContribution {
120
- return {
121
- id: "draw.shape-context-menu",
122
- target: "selection",
123
- order: 35,
124
- actionIds: ["draw.set-closed"],
125
- when(context) {
126
- return context.selection.commonShapeType === "draw";
127
- },
128
- getSections(context) {
129
- const currentValue = getCommonDrawClosedValue(
130
- context.selection.selectedShapes,
131
- );
132
- const nextValue = currentValue === "closed" ? "open" : "closed";
133
- return [
134
- {
135
- id: "draw.context-menu",
136
- title: "Draw",
137
- items: [
138
- {
139
- kind: "command",
140
- id: "draw.toggle-closed",
141
- actionId: "draw.set-closed",
142
- value: nextValue,
143
- label:
144
- nextValue === "closed" ? "Close freehand" : "Open freehand",
145
- icon: "pencil",
146
- dataUi: "context-menu-toggle-draw-closed-button",
147
- },
148
- ],
149
- },
150
- ];
151
- },
152
- };
153
- }
154
-
155
- const DRAW_STROKE_SWATCHES = [
156
- { value: "#1d4ed8", label: "Blue", color: "#1d4ed8" },
157
- { value: "#15803d", label: "Green", color: "#15803d" },
158
- { value: "#dc2626", label: "Red", color: "#dc2626" },
159
- { value: "#334155", label: "Slate", color: "#334155" },
160
- ] as const;
161
-
162
- const DRAW_FILL_SWATCHES = [
163
- { value: "transparent", label: "None", color: "transparent" },
164
- { value: "#dbeafe", label: "Blue", color: "#dbeafe" },
165
- { value: "#dcfce7", label: "Green", color: "#dcfce7" },
166
- { value: "#fee2e2", label: "Red", color: "#fee2e2" },
167
- { value: "#f8fafc", label: "White", color: "#f8fafc" },
168
- ] as const;
169
-
170
- const DRAW_STROKE_WIDTH_OPTIONS = [
171
- { value: 4, label: "4" },
172
- { value: 6, label: "6" },
173
- { value: 8, label: "8" },
174
- { value: 10, label: "10" },
175
- ] as const;
176
-
177
- const DRAW_CLOSED_OPTIONS = [
178
- { value: "open", label: "Open" },
179
- { value: "closed", label: "Closed" },
180
- ] as const;
181
-
182
- function createDrawToolToolbarContribution(): ToolbarContribution {
183
- return {
184
- id: "draw.tool-toolbar",
185
- surface: "tool",
186
- placement: "chrome",
187
- order: 45,
188
- actionIds: [SET_ACTIVE_TOOL_TOOLBAR_ACTION_ID],
189
- getGroups() {
190
- return [
191
- {
192
- id: "draw.tools",
193
- items: [
194
- {
195
- kind: "button",
196
- id: "draw.tool.draw",
197
- actionId: SET_ACTIVE_TOOL_TOOLBAR_ACTION_ID,
198
- value: "draw",
199
- label: "Draw",
200
- shortcut: "P",
201
- icon: "pencil",
202
- dataUi: "draw-tool-button",
203
- },
204
- ],
205
- },
206
- ];
207
- },
208
- };
209
- }
210
-
211
- function createDrawSelectionToolbarContribution(): ToolbarContribution {
212
- return {
213
- id: "draw.selection-toolbar",
214
- surface: "selection",
215
- order: 20,
216
- actionIds: [
217
- "draw.set-closed",
218
- "draw.set-fill",
219
- "draw.set-stroke",
220
- "draw.set-strokeWidth",
221
- ],
222
- when(context) {
223
- return context.selection.commonShapeType === "draw";
224
- },
225
- getGroups() {
226
- return getDrawStyleToolbarGroups({
227
- closedActionId: "draw.set-closed",
228
- fillActionId: "draw.set-fill",
229
- strokeActionId: "draw.set-stroke",
230
- strokeWidthActionId: "draw.set-strokeWidth",
231
- dataUiPrefix: "draw",
232
- });
233
- },
234
- };
235
- }
236
-
237
- function createDrawDefaultStyleToolbarContribution(): ToolbarContribution {
238
- return {
239
- id: "draw.default-style.tool-toolbar",
240
- surface: "tool",
241
- order: 46,
242
- actionIds: [
243
- "draw.default-closed",
244
- "draw.default-fill",
245
- "draw.default-stroke",
246
- "draw.default-strokeWidth",
247
- ],
248
- when(context) {
249
- return context.tool.activeToolId === "draw";
250
- },
251
- getGroups() {
252
- return getDrawStyleToolbarGroups({
253
- closedActionId: "draw.default-closed",
254
- fillActionId: "draw.default-fill",
255
- strokeActionId: "draw.default-stroke",
256
- strokeWidthActionId: "draw.default-strokeWidth",
257
- dataUiPrefix: "draw-default",
258
- });
259
- },
260
- };
261
- }
262
-
263
- function getDrawStyleToolbarGroups({
264
- closedActionId,
265
- fillActionId,
266
- strokeActionId,
267
- strokeWidthActionId,
268
- dataUiPrefix,
269
- }: {
270
- closedActionId: string;
271
- fillActionId: string;
272
- strokeActionId: string;
273
- strokeWidthActionId: string;
274
- dataUiPrefix: string;
275
- }) {
276
- return [
277
- {
278
- id: `${dataUiPrefix}.style-closed`,
279
- items: [
280
- {
281
- kind: "segmented" as const,
282
- id: `${dataUiPrefix}.closed`,
283
- actionId: closedActionId,
284
- options: DRAW_CLOSED_OPTIONS.map((option) => ({
285
- ...option,
286
- dataUi: `${dataUiPrefix}-${option.value}-button`,
287
- })),
288
- },
289
- ],
290
- },
291
- {
292
- id: `${dataUiPrefix}.style-fill`,
293
- items: [
294
- {
295
- kind: "swatches" as const,
296
- id: `${dataUiPrefix}.fill`,
297
- actionId: fillActionId,
298
- label: "Fill",
299
- options: DRAW_FILL_SWATCHES.map((option) => ({
300
- ...option,
301
- dataUi: `${dataUiPrefix}-fill-${option.label.toLowerCase()}-button`,
302
- })),
303
- },
304
- ],
305
- },
306
- {
307
- id: `${dataUiPrefix}.style-stroke`,
308
- items: [
309
- {
310
- kind: "swatches" as const,
311
- id: `${dataUiPrefix}.stroke`,
312
- actionId: strokeActionId,
313
- label: "Stroke",
314
- options: DRAW_STROKE_SWATCHES.map((option) => ({
315
- ...option,
316
- dataUi: `${dataUiPrefix}-stroke-${option.label.toLowerCase()}-button`,
317
- })),
318
- },
319
- ],
320
- },
321
- {
322
- id: `${dataUiPrefix}.style-stroke-width`,
323
- items: [
324
- {
325
- kind: "stepper" as const,
326
- id: `${dataUiPrefix}.stroke-width`,
327
- actionId: strokeWidthActionId,
328
- label: "Stroke width",
329
- dataUi: `${dataUiPrefix}-stroke-width-control`,
330
- options: DRAW_STROKE_WIDTH_OPTIONS.map((option) => ({
331
- ...option,
332
- dataUi: `${dataUiPrefix}-stroke-width-${option.value}-button`,
333
- })),
334
- },
335
- ],
336
- },
337
- ];
338
- }
339
-
340
- function createSetDrawStyleToolbarAction(
341
- prop: "fill" | "stroke" | "strokeWidth",
342
- ): ToolbarAction<ToolbarActionValue> {
343
- return {
344
- id: `draw.set-${prop}`,
345
- isVisible(context) {
346
- return context.selection.commonShapeType === "draw";
347
- },
348
- isEnabled(context) {
349
- return context.selection.count > 0;
350
- },
351
- getValue(context) {
352
- return getCommonDrawPropValue(context.selection.selectedShapes, prop);
353
- },
354
- run({ context, value }) {
355
- if (!isValidDrawStyleValue(prop, value)) {
356
- return;
357
- }
358
- const updates = context.selection.selectedShapes
359
- .filter(isDrawShapeRecord)
360
- .filter((shape) => !shape.isLocked)
361
- .map((shape) => ({
362
- id: shape.id,
363
- props: {
364
- [prop]: value,
365
- },
366
- }));
367
- if (updates.length === 0) {
368
- return;
369
- }
370
- context.editor.commands.updateShapes(updates, { source: "user" });
371
- },
372
- };
373
- }
374
-
375
- function createSetDrawDefaultStyleToolbarAction(
376
- prop: "fill" | "stroke" | "strokeWidth",
377
- ): ToolbarAction<ToolbarActionValue> {
378
- return {
379
- id: `draw.default-${prop}`,
380
- isVisible(context) {
381
- return context.tool.activeToolId === "draw";
382
- },
383
- getValue(context) {
384
- return context.editor.getDefaultShapeProps<DrawShapeProps>("draw")[prop];
385
- },
386
- run({ context, value }) {
387
- if (!isValidDrawStyleValue(prop, value)) {
388
- return;
389
- }
390
- context.editor.updateDefaultShapeProps("draw", { [prop]: value });
391
- },
392
- };
393
- }
394
-
395
- function createSetDrawClosedToolbarAction(): ToolbarAction<string | null> {
396
- return {
397
- id: "draw.set-closed",
398
- isVisible(context) {
399
- return context.selection.commonShapeType === "draw";
400
- },
401
- isEnabled(context) {
402
- return context.selection.count > 0;
403
- },
404
- getValue(context) {
405
- return getCommonDrawClosedValue(context.selection.selectedShapes);
406
- },
407
- run({ context, value }) {
408
- const isClosed = parseDrawClosedToolbarValue(value);
409
- if (isClosed === null) {
410
- return;
411
- }
412
- const updates = context.selection.selectedShapes
413
- .filter(isDrawShapeRecord)
414
- .filter((shape) => !shape.isLocked)
415
- .map((shape) => ({
416
- id: shape.id,
417
- props: {
418
- isClosed,
419
- },
420
- }));
421
- if (updates.length === 0) {
422
- return;
423
- }
424
- context.editor.commands.updateShapes(updates, { source: "user" });
425
- },
426
- };
427
- }
428
-
429
- function createSetDrawDefaultClosedToolbarAction(): ToolbarAction<string | null> {
430
- return {
431
- id: "draw.default-closed",
432
- isVisible(context) {
433
- return context.tool.activeToolId === "draw";
434
- },
435
- getValue(context) {
436
- return context.editor.getDefaultShapeProps<DrawShapeProps>("draw").isClosed
437
- ? "closed"
438
- : "open";
439
- },
440
- run({ context, value }) {
441
- const isClosed = parseDrawClosedToolbarValue(value);
442
- if (isClosed === null) {
443
- return;
444
- }
445
- context.editor.updateDefaultShapeProps("draw", { isClosed });
446
- },
447
- };
448
- }
449
-
450
- function getCommonDrawPropValue(
451
- selectedShapes: readonly { type: string; props: object }[],
452
- prop: "fill" | "stroke" | "strokeWidth",
453
- ): ToolbarActionValue {
454
- let value: ToolbarActionValue | undefined;
455
- for (const shape of selectedShapes) {
456
- if (shape.type !== "draw") {
457
- continue;
458
- }
459
- const nextValue = (shape.props as DrawShapeProps)[prop];
460
- if (value === undefined) {
461
- value = nextValue;
462
- continue;
463
- }
464
- if (value !== nextValue) {
465
- return null;
466
- }
467
- }
468
- return value ?? null;
469
- }
470
-
471
- function getCommonDrawClosedValue(
472
- selectedShapes: readonly { type: string; props: object }[],
473
- ): string | null {
474
- let isClosed: boolean | undefined;
475
- for (const shape of selectedShapes) {
476
- if (shape.type !== "draw") {
477
- continue;
478
- }
479
- const nextValue = (shape.props as DrawShapeProps).isClosed;
480
- if (isClosed === undefined) {
481
- isClosed = nextValue;
482
- continue;
483
- }
484
- if (isClosed !== nextValue) {
485
- return null;
486
- }
487
- }
488
- if (isClosed === undefined) {
489
- return null;
490
- }
491
- return isClosed ? "closed" : "open";
492
- }
493
-
494
- function parseDrawClosedToolbarValue(value: ToolbarActionValue): boolean | null {
495
- if (value === "closed") {
496
- return true;
497
- }
498
- if (value === "open") {
499
- return false;
500
- }
501
- return null;
502
- }
503
-
504
- function isValidDrawStyleValue(
505
- prop: "fill" | "stroke" | "strokeWidth",
506
- value: ToolbarActionValue,
507
- ): boolean {
508
- if (prop === "strokeWidth") {
509
- return DRAW_STROKE_WIDTH_OPTIONS.some((option) => option.value === value);
510
- }
511
- if (prop === "fill") {
512
- return DRAW_FILL_SWATCHES.some((option) => option.value === value);
513
- }
514
- return DRAW_STROKE_SWATCHES.some((option) => option.value === value);
515
- }