@yuzhouu/canvas-kit 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (492) hide show
  1. package/_vendor/canvas-core/bindings/BindingUtil.d.ts +45 -0
  2. package/_vendor/canvas-core/bindings/BindingUtilRegistry.d.ts +8 -0
  3. package/_vendor/canvas-core/bindings/arrow/arrowBindingHelpers.d.ts +28 -0
  4. package/_vendor/canvas-core/contextMenu.d.ts +62 -0
  5. package/_vendor/canvas-core/editor/Editor.d.ts +564 -0
  6. package/_vendor/canvas-core/editor/HistoryManager.d.ts +18 -0
  7. package/_vendor/canvas-core/editor/StateNode.d.ts +31 -0
  8. package/_vendor/canvas-core/editor/camera.d.ts +3 -0
  9. package/_vendor/canvas-core/editor/clipboard.d.ts +43 -0
  10. package/_vendor/canvas-core/editor/commands.d.ts +126 -0
  11. package/_vendor/canvas-core/editor/edgeScroll.d.ts +5 -0
  12. package/_vendor/canvas-core/editor/editorComputedHelpers.d.ts +21 -0
  13. package/_vendor/canvas-core/editor/editorSelectionTransforms.d.ts +6 -0
  14. package/_vendor/canvas-core/editor/events.d.ts +71 -0
  15. package/_vendor/canvas-core/editor/{index.ts → index.d.ts} +1 -5
  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 +52 -0
  24. package/_vendor/canvas-core/editor/managers/QueryManager.d.ts +76 -0
  25. package/_vendor/canvas-core/editor/managers/RenderWindowManager.d.ts +25 -0
  26. package/_vendor/canvas-core/editor/managers/SelectionLayoutManager.d.ts +29 -0
  27. package/_vendor/canvas-core/editor/managers/SelectionManager.d.ts +21 -0
  28. package/_vendor/canvas-core/editor/managers/SelectionOverlayManager.d.ts +23 -0
  29. package/_vendor/canvas-core/editor/managers/ShapeEditingManager.d.ts +29 -0
  30. package/_vendor/canvas-core/editor/managers/ShapeGeometryManager.d.ts +42 -0
  31. package/_vendor/canvas-core/editor/managers/ShapeHierarchyManager.d.ts +58 -0
  32. package/_vendor/canvas-core/editor/managers/SideEffectManager.d.ts +23 -0
  33. package/_vendor/canvas-core/editor/managers/SnapManager.d.ts +29 -0
  34. package/_vendor/canvas-core/editor/managers/SnapSnapshotBuilder.d.ts +22 -0
  35. package/_vendor/canvas-core/editor/managers/SpatialIndexManager.d.ts +30 -0
  36. package/_vendor/canvas-core/editor/managers/ToolManager.d.ts +25 -0
  37. package/_vendor/canvas-core/editor/managers/queryState.d.ts +18 -0
  38. package/_vendor/canvas-core/editor/managers/selectionGeometry.d.ts +28 -0
  39. package/_vendor/canvas-core/editor/managers/shapeOrder.d.ts +14 -0
  40. package/_vendor/canvas-core/editor/managers/shapeReparenting.d.ts +6 -0
  41. package/_vendor/canvas-core/editor/managers/snapCalculations.d.ts +40 -0
  42. package/_vendor/canvas-core/editor/managers/snapGeometry.d.ts +26 -0
  43. package/_vendor/canvas-core/editor/managers/snapIndicators.d.ts +22 -0
  44. package/_vendor/canvas-core/editor/managers/snapTypes.d.ts +98 -0
  45. package/_vendor/canvas-core/editor/queries/shapeTransforms.d.ts +27 -0
  46. package/_vendor/canvas-core/editor/renderWindow.d.ts +30 -0
  47. package/_vendor/canvas-core/editor/resizeGeometry.d.ts +97 -0
  48. package/_vendor/canvas-core/editor/selection.d.ts +224 -0
  49. package/_vendor/canvas-core/editor/selectionHandleInteractions.d.ts +11 -0
  50. package/_vendor/canvas-core/editor/selectionOverlay.d.ts +31 -0
  51. package/_vendor/canvas-core/exports/integrity.d.ts +32 -0
  52. package/_vendor/canvas-core/exports/svg.d.ts +48 -0
  53. package/_vendor/canvas-core/geometry/Box.d.ts +19 -0
  54. package/_vendor/canvas-core/geometry/Ellipse2d.d.ts +16 -0
  55. package/_vendor/canvas-core/geometry/Geometry2d.d.ts +15 -0
  56. package/_vendor/canvas-core/geometry/Mat.d.ts +28 -0
  57. package/_vendor/canvas-core/geometry/Polyline2d.d.ts +14 -0
  58. package/_vendor/canvas-core/geometry/Rectangle2d.d.ts +16 -0
  59. package/_vendor/canvas-core/geometry/Vec.d.ts +37 -0
  60. package/_vendor/canvas-core/geometry/{index.ts → index.d.ts} +1 -6
  61. package/_vendor/canvas-core/geometry/segments.d.ts +5 -0
  62. package/_vendor/canvas-core/index.d.ts +57 -0
  63. package/_vendor/canvas-core/plugins/index.d.ts +1 -0
  64. package/_vendor/canvas-core/plugins/types.d.ts +27 -0
  65. package/_vendor/canvas-core/reactivity.d.ts +4 -0
  66. package/_vendor/canvas-core/schema/records.d.ts +112 -0
  67. package/_vendor/canvas-core/schema/snapshots.d.ts +27 -0
  68. package/_vendor/canvas-core/shapes/ShapeUtil.d.ts +133 -0
  69. package/_vendor/canvas-core/shapes/ShapeUtilRegistry.d.ts +9 -0
  70. package/_vendor/canvas-core/shapes/capabilities.d.ts +25 -0
  71. package/_vendor/canvas-core/shapes/types.d.ts +2 -0
  72. package/_vendor/canvas-core/toolbar.d.ts +117 -0
  73. package/_vendor/canvas-core/tools/hand/HandTool.d.ts +5 -0
  74. package/_vendor/canvas-core/tools/select/SelectTool.d.ts +5 -0
  75. package/_vendor/canvas-core/tools/select/selectContainment.d.ts +11 -0
  76. package/_vendor/canvas-core/tools/select/selectToolHelpers.d.ts +161 -0
  77. package/_vendor/canvas-core/tools/select/states/BrushingState.d.ts +19 -0
  78. package/_vendor/canvas-core/tools/select/states/DraggingSelectionHandleInteractionState.d.ts +15 -0
  79. package/_vendor/canvas-core/tools/select/states/IdleState.d.ts +8 -0
  80. package/_vendor/canvas-core/tools/select/states/PointingCanvasState.d.ts +11 -0
  81. package/_vendor/canvas-core/tools/select/states/PointingResizeHandleState.d.ts +10 -0
  82. package/_vendor/canvas-core/tools/select/states/PointingRotateHandleState.d.ts +10 -0
  83. package/_vendor/canvas-core/tools/select/states/PointingSelectionHandleInteractionState.d.ts +10 -0
  84. package/_vendor/canvas-core/tools/select/states/PointingShapeState.d.ts +12 -0
  85. package/_vendor/canvas-core/tools/select/states/ResizingState.d.ts +16 -0
  86. package/_vendor/canvas-core/tools/select/states/RotatingState.d.ts +14 -0
  87. package/_vendor/canvas-core/tools/select/states/SelectStateNode.d.ts +60 -0
  88. package/_vendor/canvas-core/tools/select/states/TranslatingState.d.ts +16 -0
  89. package/_vendor/canvas-plugin-api/feature.d.ts +37 -0
  90. package/_vendor/canvas-plugin-api/index.d.ts +57 -0
  91. package/_vendor/canvas-product-react/api/apiRegistry.d.ts +12 -0
  92. package/_vendor/canvas-product-react/api/canvasProductApi.d.ts +124 -0
  93. package/_vendor/canvas-product-react/api/index.d.ts +4 -0
  94. package/_vendor/canvas-product-react/capabilities/clipboard/clipboardService.d.ts +9 -0
  95. package/_vendor/canvas-product-react/capabilities/clipboard/systemClipboard.d.ts +16 -0
  96. package/_vendor/canvas-product-react/capabilities/context-menu/systemContextMenu.d.ts +17 -0
  97. package/_vendor/canvas-product-react/capabilities/context-menu/useContextMenuSurface.d.ts +12 -0
  98. package/_vendor/canvas-product-react/capabilities/export/useSvgExport.d.ts +29 -0
  99. package/_vendor/canvas-product-react/capabilities/history/useHistoryControls.d.ts +8 -0
  100. package/_vendor/canvas-product-react/capabilities/pages/usePageControls.d.ts +12 -0
  101. package/_vendor/canvas-product-react/capabilities/toolbar/systemToolbar.d.ts +32 -0
  102. package/_vendor/canvas-product-react/capabilities/toolbar/useToolbarSurfaces.d.ts +19 -0
  103. package/_vendor/canvas-product-react/capabilities/zoom/useZoomControls.d.ts +9 -0
  104. package/_vendor/canvas-product-react/index.d.ts +24 -0
  105. package/_vendor/canvas-product-react/persistence/index.d.ts +2 -0
  106. package/_vendor/canvas-product-react/persistence/localSnapshotPersistence.d.ts +40 -0
  107. package/_vendor/canvas-product-react/runtime/CanvasProductRoot.d.ts +4 -0
  108. package/_vendor/canvas-product-react/runtime/productDefinition.d.ts +45 -0
  109. package/_vendor/canvas-product-react/runtime/productServices.d.ts +31 -0
  110. package/_vendor/canvas-react/components/CanvasView.d.ts +11 -0
  111. package/_vendor/canvas-react/components/OverlayLayer.d.ts +1 -0
  112. package/_vendor/canvas-react/components/PageSpace.d.ts +6 -0
  113. package/_vendor/canvas-react/components/ShapeLayer.d.ts +1 -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/CanvasRendererRegistryContext.d.ts +3 -0
  117. package/_vendor/canvas-react/host/contextMenuRegistry.d.ts +12 -0
  118. package/_vendor/canvas-react/host/domEventGuards.d.ts +11 -0
  119. package/_vendor/canvas-react/host/index.d.ts +8 -0
  120. package/_vendor/canvas-react/host/pluginHost.d.ts +93 -0
  121. package/_vendor/canvas-react/host/rendererRegistry.d.ts +12 -0
  122. package/_vendor/canvas-react/host/toolbarRegistry.d.ts +24 -0
  123. package/_vendor/plugin-arrow/ArrowBindingUtil.d.ts +27 -0
  124. package/_vendor/plugin-arrow/ArrowShapeUtil.d.ts +20 -0
  125. package/_vendor/plugin-arrow/ArrowTool.d.ts +4 -0
  126. package/_vendor/plugin-arrow/arrowGeometry.d.ts +50 -0
  127. package/_vendor/plugin-arrow/arrowTerminalBindingResolver.d.ts +21 -0
  128. package/_vendor/plugin-arrow/arrowTerminalCommands.d.ts +12 -0
  129. package/_vendor/plugin-arrow/canvas.d.ts +2 -0
  130. package/_vendor/plugin-arrow/core.d.ts +7 -0
  131. package/_vendor/plugin-arrow/feature.d.ts +3 -0
  132. package/_vendor/plugin-arrow/index.d.ts +11 -0
  133. package/_vendor/plugin-arrow/selectionHandleInteractions.d.ts +3 -0
  134. package/_vendor/plugin-arrow/types.d.ts +31 -0
  135. package/_vendor/plugin-draw/DrawShapeRenderer.d.ts +8 -0
  136. package/_vendor/plugin-draw/DrawShapeUtil.d.ts +21 -0
  137. package/_vendor/plugin-draw/DrawTool.d.ts +6 -0
  138. package/_vendor/plugin-draw/canvas.d.ts +2 -0
  139. package/_vendor/plugin-draw/core.d.ts +7 -0
  140. package/_vendor/plugin-draw/drawGeometry.d.ts +45 -0
  141. package/_vendor/plugin-draw/drawHitTest.d.ts +11 -0
  142. package/_vendor/plugin-draw/drawInterpolation.d.ts +5 -0
  143. package/_vendor/plugin-draw/drawPath.d.ts +37 -0
  144. package/_vendor/plugin-draw/drawSegments.d.ts +11 -0
  145. package/_vendor/plugin-draw/drawSelectionTransform.d.ts +18 -0
  146. package/_vendor/plugin-draw/drawShapeGeometry.d.ts +33 -0
  147. package/_vendor/plugin-draw/drawStrokeGeometry.d.ts +17 -0
  148. package/_vendor/plugin-draw/feature.d.ts +3 -0
  149. package/_vendor/plugin-draw/index.d.ts +13 -0
  150. package/_vendor/plugin-draw/types.d.ts +23 -0
  151. package/_vendor/plugin-eraser/EraserTool.d.ts +5 -0
  152. package/_vendor/plugin-eraser/canvas.d.ts +2 -0
  153. package/_vendor/plugin-eraser/core.d.ts +2 -0
  154. package/_vendor/plugin-eraser/feature.d.ts +3 -0
  155. package/_vendor/plugin-frame/FrameShapeUtil.d.ts +22 -0
  156. package/_vendor/plugin-frame/FrameTool.d.ts +6 -0
  157. package/_vendor/plugin-frame/canvas.d.ts +8 -0
  158. package/_vendor/plugin-frame/core.d.ts +7 -0
  159. package/_vendor/plugin-frame/feature.d.ts +3 -0
  160. package/_vendor/plugin-geo/GeoShapeUtil.d.ts +13 -0
  161. package/_vendor/plugin-geo/GeoTools.d.ts +17 -0
  162. package/_vendor/plugin-geo/canvas.d.ts +11 -0
  163. package/_vendor/plugin-geo/core.d.ts +7 -0
  164. package/_vendor/plugin-geo/feature.d.ts +3 -0
  165. package/_vendor/plugin-geo/types.d.ts +15 -0
  166. package/_vendor/plugin-group/GroupShapeUtil.d.ts +15 -0
  167. package/_vendor/plugin-group/canvas.d.ts +10 -0
  168. package/_vendor/plugin-group/core.d.ts +7 -0
  169. package/_vendor/plugin-group/feature.d.ts +3 -0
  170. package/_vendor/plugin-image/ImageShapeUtil.d.ts +10 -0
  171. package/_vendor/plugin-image/canvas.d.ts +2 -0
  172. package/_vendor/plugin-image/core.d.ts +16 -0
  173. package/_vendor/plugin-image/crop.d.ts +112 -0
  174. package/_vendor/plugin-image/cropInteractions.d.ts +3 -0
  175. package/_vendor/plugin-image/cropSession.d.ts +4 -0
  176. package/_vendor/plugin-image/feature.d.ts +3 -0
  177. package/_vendor/plugin-image/index.d.ts +8 -0
  178. package/_vendor/plugin-image/types.d.ts +37 -0
  179. package/_vendor/plugin-image-product-react/ImageImportController.d.ts +9 -0
  180. package/_vendor/plugin-image-product-react/imageAssetService.d.ts +7 -0
  181. package/_vendor/plugin-image-product-react/imageBlobStore.d.ts +25 -0
  182. package/_vendor/plugin-image-product-react/imageHostActions.d.ts +35 -0
  183. package/_vendor/plugin-image-product-react/imageProductApi.d.ts +21 -0
  184. package/_vendor/plugin-image-product-react/imageToolbarHostBridge.d.ts +14 -0
  185. package/_vendor/plugin-image-product-react/imageToolbarRuntime.d.ts +2 -0
  186. package/_vendor/plugin-image-product-react/index.d.ts +16 -0
  187. package/_vendor/plugin-image-product-react/snapshotGuards.d.ts +1 -0
  188. package/_vendor/plugin-image-product-react/svgImageAssetInliner.d.ts +3 -0
  189. package/_vendor/plugin-image-product-react/useImageImport.d.ts +16 -0
  190. package/_vendor/plugin-laser/LaserTool.d.ts +4 -0
  191. package/_vendor/plugin-laser/canvas.d.ts +2 -0
  192. package/_vendor/plugin-laser/core.d.ts +2 -0
  193. package/_vendor/plugin-laser/feature.d.ts +3 -0
  194. package/_vendor/plugin-text/ArrowLabelBindingUtil.d.ts +42 -0
  195. package/_vendor/plugin-text/GeoLabelBindingUtil.d.ts +45 -0
  196. package/_vendor/plugin-text/TextShapeSvgExporter.d.ts +6 -0
  197. package/_vendor/plugin-text/TextShapeUtil.d.ts +19 -0
  198. package/_vendor/plugin-text/TextTool.d.ts +4 -0
  199. package/_vendor/plugin-text/canvas.d.ts +2 -0
  200. package/_vendor/plugin-text/core.d.ts +2 -0
  201. package/_vendor/plugin-text/feature.d.ts +3 -0
  202. package/_vendor/plugin-text/host/RichTextEditingBox.d.ts +5 -0
  203. package/_vendor/plugin-text/host/RichTextToolbar.d.ts +6 -0
  204. package/_vendor/plugin-text/host/TiptapTextEditor.d.ts +24 -0
  205. package/_vendor/plugin-text/host/richTextRendering.d.ts +3 -0
  206. package/_vendor/plugin-text/host/textDomSelection.d.ts +7 -0
  207. package/_vendor/plugin-text/host/textEditingBoxStyle.d.ts +3 -0
  208. package/_vendor/plugin-text/host/textEntryFocus.d.ts +22 -0
  209. package/_vendor/plugin-text/host/textFontLoader.d.ts +2 -0
  210. package/_vendor/plugin-text/host/textMeasurement.d.ts +12 -0
  211. package/_vendor/plugin-text/host/textMeasurementSync.d.ts +10 -0
  212. package/_vendor/plugin-text/host/textRangeSelection.d.ts +14 -0
  213. package/_vendor/plugin-text/host/textShapeRendererRuntime.d.ts +8 -0
  214. package/_vendor/plugin-text/host/textShapeSync.d.ts +17 -0
  215. package/_vendor/plugin-text/host/tiptapTextEditorController.d.ts +33 -0
  216. package/_vendor/plugin-text/index.d.ts +4 -0
  217. package/_vendor/plugin-text/richTextUtils.d.ts +18 -0
  218. package/_vendor/plugin-text/textInteractions.d.ts +2 -0
  219. package/_vendor/plugin-text/textLabelHelpers.d.ts +44 -0
  220. package/_vendor/plugin-text/textShapeHelpers.d.ts +21 -0
  221. package/_vendor/plugin-text/textStyle.d.ts +9 -0
  222. package/_vendor/plugin-text/textTypes.d.ts +28 -0
  223. package/_vendor/signals/atom.d.ts +9 -0
  224. package/_vendor/signals/computed.d.ts +11 -0
  225. package/_vendor/signals/core.d.ts +17 -0
  226. package/_vendor/signals/effect.d.ts +29 -0
  227. package/_vendor/signals/types.d.ts +15 -0
  228. package/_vendor/store/Store.d.ts +26 -0
  229. package/_vendor/store/diff.d.ts +9 -0
  230. package/_vendor/store/history.d.ts +37 -0
  231. package/_vendor/store/index.d.ts +5 -0
  232. package/_vendor/store/types.d.ts +27 -0
  233. package/api/canvasKitApi.d.ts +2 -2
  234. package/index.css +1 -1
  235. package/index.d.ts +0 -1
  236. package/index.mjs +1 -1
  237. package/package.json +1 -1
  238. package/product/Shell.d.ts +2 -2
  239. package/product/chromeContext.d.ts +8 -8
  240. package/product/createCanvasKitEditor.d.ts +1 -1
  241. package/product/persistence.d.ts +1 -1
  242. package/product/product.d.ts +1 -1
  243. package/product/useCanvasClipboardShortcuts.d.ts +2 -2
  244. package/product-CxN5NN6u.mjs +4 -0
  245. package/product.mjs +1 -1
  246. package/standard/extensions.d.ts +1 -1
  247. package/standard/standardApi.d.ts +5 -5
  248. package/standard-R17_x8HU.mjs +44 -0
  249. package/standard.mjs +1 -1
  250. package/_vendor/canvas-core/bindings/BindingUtil.ts +0 -92
  251. package/_vendor/canvas-core/bindings/BindingUtilRegistry.ts +0 -22
  252. package/_vendor/canvas-core/bindings/arrow/arrowBindingHelpers.ts +0 -52
  253. package/_vendor/canvas-core/contextMenu.ts +0 -85
  254. package/_vendor/canvas-core/editor/Editor.ts +0 -2614
  255. package/_vendor/canvas-core/editor/HistoryManager.ts +0 -83
  256. package/_vendor/canvas-core/editor/StateNode.ts +0 -162
  257. package/_vendor/canvas-core/editor/camera.ts +0 -6
  258. package/_vendor/canvas-core/editor/clipboard.ts +0 -478
  259. package/_vendor/canvas-core/editor/commands.ts +0 -833
  260. package/_vendor/canvas-core/editor/edgeScroll.ts +0 -37
  261. package/_vendor/canvas-core/editor/editorComputedHelpers.ts +0 -257
  262. package/_vendor/canvas-core/editor/editorSelectionTransforms.ts +0 -116
  263. package/_vendor/canvas-core/editor/events.ts +0 -93
  264. package/_vendor/canvas-core/editor/interactions.ts +0 -101
  265. package/_vendor/canvas-core/editor/internal.ts +0 -22
  266. package/_vendor/canvas-core/editor/managers/BindingManager.ts +0 -262
  267. package/_vendor/canvas-core/editor/managers/CameraManager.ts +0 -147
  268. package/_vendor/canvas-core/editor/managers/ClipboardManager.ts +0 -32
  269. package/_vendor/canvas-core/editor/managers/DocumentSnapshotManager.ts +0 -256
  270. package/_vendor/canvas-core/editor/managers/InputsManager.ts +0 -319
  271. package/_vendor/canvas-core/editor/managers/InteractionTransientManager.ts +0 -218
  272. package/_vendor/canvas-core/editor/managers/QueryManager.ts +0 -837
  273. package/_vendor/canvas-core/editor/managers/RenderWindowManager.ts +0 -347
  274. package/_vendor/canvas-core/editor/managers/SelectionLayoutManager.ts +0 -196
  275. package/_vendor/canvas-core/editor/managers/SelectionManager.ts +0 -98
  276. package/_vendor/canvas-core/editor/managers/SelectionOverlayManager.ts +0 -308
  277. package/_vendor/canvas-core/editor/managers/ShapeEditingManager.ts +0 -226
  278. package/_vendor/canvas-core/editor/managers/ShapeGeometryManager.ts +0 -162
  279. package/_vendor/canvas-core/editor/managers/ShapeHierarchyManager.ts +0 -797
  280. package/_vendor/canvas-core/editor/managers/SideEffectManager.ts +0 -83
  281. package/_vendor/canvas-core/editor/managers/SnapManager.ts +0 -433
  282. package/_vendor/canvas-core/editor/managers/SnapSnapshotBuilder.ts +0 -430
  283. package/_vendor/canvas-core/editor/managers/SpatialIndexManager.ts +0 -354
  284. package/_vendor/canvas-core/editor/managers/ToolManager.ts +0 -81
  285. package/_vendor/canvas-core/editor/managers/queryState.ts +0 -583
  286. package/_vendor/canvas-core/editor/managers/selectionGeometry.ts +0 -287
  287. package/_vendor/canvas-core/editor/managers/shapeOrder.ts +0 -350
  288. package/_vendor/canvas-core/editor/managers/shapeReparenting.ts +0 -160
  289. package/_vendor/canvas-core/editor/managers/snapCalculations.ts +0 -412
  290. package/_vendor/canvas-core/editor/managers/snapGeometry.ts +0 -202
  291. package/_vendor/canvas-core/editor/managers/snapIndicators.ts +0 -403
  292. package/_vendor/canvas-core/editor/managers/snapTypes.ts +0 -122
  293. package/_vendor/canvas-core/editor/queries/shapeTransforms.ts +0 -171
  294. package/_vendor/canvas-core/editor/renderWindow.ts +0 -439
  295. package/_vendor/canvas-core/editor/resizeGeometry.ts +0 -654
  296. package/_vendor/canvas-core/editor/selection.ts +0 -489
  297. package/_vendor/canvas-core/editor/selectionHandleInteractions.ts +0 -43
  298. package/_vendor/canvas-core/editor/selectionOverlay.ts +0 -567
  299. package/_vendor/canvas-core/exports/integrity.ts +0 -174
  300. package/_vendor/canvas-core/exports/svg.ts +0 -494
  301. package/_vendor/canvas-core/geometry/Box.ts +0 -80
  302. package/_vendor/canvas-core/geometry/Ellipse2d.ts +0 -67
  303. package/_vendor/canvas-core/geometry/Geometry2d.ts +0 -52
  304. package/_vendor/canvas-core/geometry/Mat.ts +0 -92
  305. package/_vendor/canvas-core/geometry/Polyline2d.ts +0 -63
  306. package/_vendor/canvas-core/geometry/Rectangle2d.ts +0 -64
  307. package/_vendor/canvas-core/geometry/Vec.ts +0 -123
  308. package/_vendor/canvas-core/geometry/segments.ts +0 -65
  309. package/_vendor/canvas-core/index.ts +0 -391
  310. package/_vendor/canvas-core/plugins/index.ts +0 -5
  311. package/_vendor/canvas-core/plugins/types.ts +0 -53
  312. package/_vendor/canvas-core/reactivity.ts +0 -16
  313. package/_vendor/canvas-core/schema/records.ts +0 -221
  314. package/_vendor/canvas-core/schema/snapshots.ts +0 -527
  315. package/_vendor/canvas-core/shapes/ShapeUtil.ts +0 -516
  316. package/_vendor/canvas-core/shapes/ShapeUtilRegistry.ts +0 -26
  317. package/_vendor/canvas-core/shapes/capabilities.ts +0 -67
  318. package/_vendor/canvas-core/shapes/types.ts +0 -20
  319. package/_vendor/canvas-core/toolbar.ts +0 -148
  320. package/_vendor/canvas-core/tools/hand/HandTool.ts +0 -75
  321. package/_vendor/canvas-core/tools/select/SelectTool.ts +0 -33
  322. package/_vendor/canvas-core/tools/select/selectContainment.ts +0 -104
  323. package/_vendor/canvas-core/tools/select/selectToolHelpers.ts +0 -801
  324. package/_vendor/canvas-core/tools/select/states/BrushingState.ts +0 -145
  325. package/_vendor/canvas-core/tools/select/states/DraggingSelectionHandleInteractionState.ts +0 -116
  326. package/_vendor/canvas-core/tools/select/states/IdleState.ts +0 -159
  327. package/_vendor/canvas-core/tools/select/states/PointingCanvasState.ts +0 -41
  328. package/_vendor/canvas-core/tools/select/states/PointingResizeHandleState.ts +0 -78
  329. package/_vendor/canvas-core/tools/select/states/PointingRotateHandleState.ts +0 -64
  330. package/_vendor/canvas-core/tools/select/states/PointingSelectionHandleInteractionState.ts +0 -34
  331. package/_vendor/canvas-core/tools/select/states/PointingShapeState.ts +0 -140
  332. package/_vendor/canvas-core/tools/select/states/ResizingState.ts +0 -171
  333. package/_vendor/canvas-core/tools/select/states/RotatingState.ts +0 -124
  334. package/_vendor/canvas-core/tools/select/states/SelectStateNode.ts +0 -128
  335. package/_vendor/canvas-core/tools/select/states/TranslatingState.ts +0 -139
  336. package/_vendor/canvas-plugin-api/feature.ts +0 -204
  337. package/_vendor/canvas-plugin-api/index.ts +0 -142
  338. package/_vendor/canvas-product-react/api/apiRegistry.ts +0 -35
  339. package/_vendor/canvas-product-react/api/canvasProductApi.ts +0 -422
  340. package/_vendor/canvas-product-react/api/index.ts +0 -31
  341. package/_vendor/canvas-product-react/capabilities/clipboard/clipboardService.ts +0 -36
  342. package/_vendor/canvas-product-react/capabilities/clipboard/systemClipboard.ts +0 -245
  343. package/_vendor/canvas-product-react/capabilities/context-menu/systemContextMenu.ts +0 -396
  344. package/_vendor/canvas-product-react/capabilities/context-menu/useContextMenuSurface.ts +0 -59
  345. package/_vendor/canvas-product-react/capabilities/export/useSvgExport.ts +0 -156
  346. package/_vendor/canvas-product-react/capabilities/history/useHistoryControls.ts +0 -23
  347. package/_vendor/canvas-product-react/capabilities/pages/usePageControls.ts +0 -41
  348. package/_vendor/canvas-product-react/capabilities/toolbar/systemToolbar.ts +0 -490
  349. package/_vendor/canvas-product-react/capabilities/toolbar/useToolbarSurfaces.ts +0 -92
  350. package/_vendor/canvas-product-react/capabilities/zoom/useZoomControls.ts +0 -27
  351. package/_vendor/canvas-product-react/index.ts +0 -84
  352. package/_vendor/canvas-product-react/persistence/index.ts +0 -18
  353. package/_vendor/canvas-product-react/persistence/localSnapshotPersistence.ts +0 -294
  354. package/_vendor/canvas-product-react/runtime/CanvasProductRoot.tsx +0 -250
  355. package/_vendor/canvas-product-react/runtime/productDefinition.ts +0 -72
  356. package/_vendor/canvas-product-react/runtime/productServices.ts +0 -96
  357. package/_vendor/canvas-react/components/CanvasView.tsx +0 -796
  358. package/_vendor/canvas-react/components/OverlayLayer.tsx +0 -879
  359. package/_vendor/canvas-react/components/PageSpace.tsx +0 -34
  360. package/_vendor/canvas-react/components/ShapeLayer.tsx +0 -428
  361. package/_vendor/canvas-react/hooks/useEditor.ts +0 -11
  362. package/_vendor/canvas-react/hooks/useValue.ts +0 -14
  363. package/_vendor/canvas-react/host/CanvasRendererRegistryContext.tsx +0 -14
  364. package/_vendor/canvas-react/host/contextMenuRegistry.ts +0 -61
  365. package/_vendor/canvas-react/host/domEventGuards.ts +0 -61
  366. package/_vendor/canvas-react/host/index.ts +0 -38
  367. package/_vendor/canvas-react/host/pluginHost.ts +0 -635
  368. package/_vendor/canvas-react/host/rendererRegistry.tsx +0 -58
  369. package/_vendor/canvas-react/host/toolbarRegistry.ts +0 -100
  370. package/_vendor/plugin-arrow/ArrowBindingUtil.ts +0 -239
  371. package/_vendor/plugin-arrow/ArrowShapeUtil.ts +0 -311
  372. package/_vendor/plugin-arrow/ArrowTool.ts +0 -208
  373. package/_vendor/plugin-arrow/arrowGeometry.ts +0 -441
  374. package/_vendor/plugin-arrow/arrowTerminalBindingResolver.ts +0 -253
  375. package/_vendor/plugin-arrow/arrowTerminalCommands.ts +0 -230
  376. package/_vendor/plugin-arrow/canvas.tsx +0 -92
  377. package/_vendor/plugin-arrow/core.ts +0 -409
  378. package/_vendor/plugin-arrow/feature.ts +0 -20
  379. package/_vendor/plugin-arrow/index.ts +0 -28
  380. package/_vendor/plugin-arrow/selectionHandleInteractions.ts +0 -154
  381. package/_vendor/plugin-arrow/types.ts +0 -63
  382. package/_vendor/plugin-draw/DrawShapeRenderer.tsx +0 -60
  383. package/_vendor/plugin-draw/DrawShapeUtil.ts +0 -372
  384. package/_vendor/plugin-draw/DrawTool.ts +0 -444
  385. package/_vendor/plugin-draw/canvas.tsx +0 -24
  386. package/_vendor/plugin-draw/core.ts +0 -515
  387. package/_vendor/plugin-draw/drawGeometry.ts +0 -491
  388. package/_vendor/plugin-draw/drawHitTest.ts +0 -271
  389. package/_vendor/plugin-draw/drawInterpolation.ts +0 -250
  390. package/_vendor/plugin-draw/drawPath.ts +0 -550
  391. package/_vendor/plugin-draw/drawSegments.ts +0 -106
  392. package/_vendor/plugin-draw/drawSelectionTransform.ts +0 -67
  393. package/_vendor/plugin-draw/drawShapeGeometry.ts +0 -307
  394. package/_vendor/plugin-draw/drawStrokeGeometry.ts +0 -454
  395. package/_vendor/plugin-draw/feature.ts +0 -20
  396. package/_vendor/plugin-draw/index.ts +0 -31
  397. package/_vendor/plugin-draw/types.ts +0 -36
  398. package/_vendor/plugin-eraser/EraserTool.ts +0 -297
  399. package/_vendor/plugin-eraser/canvas.tsx +0 -616
  400. package/_vendor/plugin-eraser/core.ts +0 -49
  401. package/_vendor/plugin-eraser/feature.ts +0 -20
  402. package/_vendor/plugin-frame/FrameShapeUtil.ts +0 -173
  403. package/_vendor/plugin-frame/FrameTool.ts +0 -225
  404. package/_vendor/plugin-frame/canvas.tsx +0 -75
  405. package/_vendor/plugin-frame/core.ts +0 -534
  406. package/_vendor/plugin-frame/feature.ts +0 -20
  407. package/_vendor/plugin-geo/GeoShapeUtil.ts +0 -463
  408. package/_vendor/plugin-geo/GeoTools.ts +0 -247
  409. package/_vendor/plugin-geo/canvas.tsx +0 -90
  410. package/_vendor/plugin-geo/core.ts +0 -495
  411. package/_vendor/plugin-geo/feature.ts +0 -20
  412. package/_vendor/plugin-geo/types.ts +0 -27
  413. package/_vendor/plugin-group/GroupShapeUtil.ts +0 -59
  414. package/_vendor/plugin-group/canvas.tsx +0 -59
  415. package/_vendor/plugin-group/core.ts +0 -40
  416. package/_vendor/plugin-group/feature.ts +0 -20
  417. package/_vendor/plugin-image/ImageShapeUtil.ts +0 -95
  418. package/_vendor/plugin-image/canvas.tsx +0 -212
  419. package/_vendor/plugin-image/core.ts +0 -542
  420. package/_vendor/plugin-image/crop.ts +0 -770
  421. package/_vendor/plugin-image/cropInteractions.ts +0 -350
  422. package/_vendor/plugin-image/cropSession.ts +0 -38
  423. package/_vendor/plugin-image/feature.ts +0 -20
  424. package/_vendor/plugin-image/index.ts +0 -29
  425. package/_vendor/plugin-image/types.ts +0 -55
  426. package/_vendor/plugin-image-product-react/ImageImportController.tsx +0 -143
  427. package/_vendor/plugin-image-product-react/imageAssetService.ts +0 -52
  428. package/_vendor/plugin-image-product-react/imageBlobStore.ts +0 -315
  429. package/_vendor/plugin-image-product-react/imageHostActions.ts +0 -438
  430. package/_vendor/plugin-image-product-react/imageProductApi.ts +0 -88
  431. package/_vendor/plugin-image-product-react/imageToolbarHostBridge.ts +0 -48
  432. package/_vendor/plugin-image-product-react/imageToolbarRuntime.ts +0 -21
  433. package/_vendor/plugin-image-product-react/index.ts +0 -60
  434. package/_vendor/plugin-image-product-react/snapshotGuards.ts +0 -33
  435. package/_vendor/plugin-image-product-react/svgImageAssetInliner.ts +0 -54
  436. package/_vendor/plugin-image-product-react/useImageImport.ts +0 -64
  437. package/_vendor/plugin-laser/LaserTool.ts +0 -154
  438. package/_vendor/plugin-laser/canvas.tsx +0 -645
  439. package/_vendor/plugin-laser/core.ts +0 -49
  440. package/_vendor/plugin-laser/feature.ts +0 -20
  441. package/_vendor/plugin-text/ArrowLabelBindingUtil.ts +0 -336
  442. package/_vendor/plugin-text/GeoLabelBindingUtil.ts +0 -391
  443. package/_vendor/plugin-text/TextShapeSvgExporter.ts +0 -101
  444. package/_vendor/plugin-text/TextShapeUtil.ts +0 -284
  445. package/_vendor/plugin-text/TextTool.ts +0 -228
  446. package/_vendor/plugin-text/canvas.tsx +0 -115
  447. package/_vendor/plugin-text/core.ts +0 -422
  448. package/_vendor/plugin-text/feature.ts +0 -20
  449. package/_vendor/plugin-text/host/RichTextEditingBox.tsx +0 -144
  450. package/_vendor/plugin-text/host/RichTextToolbar.tsx +0 -266
  451. package/_vendor/plugin-text/host/TiptapTextEditor.tsx +0 -191
  452. package/_vendor/plugin-text/host/richTextRendering.tsx +0 -49
  453. package/_vendor/plugin-text/host/textDomSelection.ts +0 -93
  454. package/_vendor/plugin-text/host/textEditingBoxStyle.ts +0 -36
  455. package/_vendor/plugin-text/host/textEntryFocus.ts +0 -307
  456. package/_vendor/plugin-text/host/textFontLoader.ts +0 -149
  457. package/_vendor/plugin-text/host/textMeasurement.ts +0 -258
  458. package/_vendor/plugin-text/host/textMeasurementSync.ts +0 -77
  459. package/_vendor/plugin-text/host/textRangeSelection.ts +0 -134
  460. package/_vendor/plugin-text/host/textShapeRendererRuntime.tsx +0 -89
  461. package/_vendor/plugin-text/host/textShapeSync.ts +0 -173
  462. package/_vendor/plugin-text/host/tiptapTextEditorController.ts +0 -148
  463. package/_vendor/plugin-text/index.ts +0 -18
  464. package/_vendor/plugin-text/richTextUtils.ts +0 -259
  465. package/_vendor/plugin-text/textInteractions.ts +0 -366
  466. package/_vendor/plugin-text/textLabelHelpers.ts +0 -235
  467. package/_vendor/plugin-text/textShapeHelpers.ts +0 -123
  468. package/_vendor/plugin-text/textStyle.ts +0 -96
  469. package/_vendor/plugin-text/textTypes.ts +0 -48
  470. package/_vendor/signals/atom.ts +0 -74
  471. package/_vendor/signals/computed.ts +0 -132
  472. package/_vendor/signals/core.ts +0 -130
  473. package/_vendor/signals/effect.ts +0 -117
  474. package/_vendor/signals/types.ts +0 -17
  475. package/_vendor/store/Store.ts +0 -171
  476. package/_vendor/store/diff.ts +0 -229
  477. package/_vendor/store/history.ts +0 -177
  478. package/_vendor/store/index.ts +0 -32
  479. package/_vendor/store/types.ts +0 -37
  480. package/internal-modules.d.ts +0 -187
  481. package/product-iyBbEPIs.mjs +0 -4
  482. package/standard-BmrxwqpJ.mjs +0 -44
  483. /package/_vendor/canvas-core/tools/{index.ts → index.d.ts} +0 -0
  484. /package/_vendor/canvas-core/tools/select/states/{index.ts → index.d.ts} +0 -0
  485. /package/_vendor/canvas-react/components/{index.ts → index.d.ts} +0 -0
  486. /package/_vendor/canvas-react/{index.ts → index.d.ts} +0 -0
  487. /package/_vendor/plugin-eraser/{index.ts → index.d.ts} +0 -0
  488. /package/_vendor/plugin-frame/{index.ts → index.d.ts} +0 -0
  489. /package/_vendor/plugin-geo/{index.ts → index.d.ts} +0 -0
  490. /package/_vendor/plugin-group/{index.ts → index.d.ts} +0 -0
  491. /package/_vendor/plugin-laser/{index.ts → index.d.ts} +0 -0
  492. /package/_vendor/signals/{index.ts → index.d.ts} +0 -0
@@ -1,542 +0,0 @@
1
- import {
2
- type ContextMenuContribution,
3
- type LandCorePlugin,
4
- type ShapeSvgExporter,
5
- type SvgExportContext,
6
- type SvgNode,
7
- type ToolbarAction,
8
- type ToolbarContext,
9
- type ToolbarContribution,
10
- type ToolbarGroup,
11
- } from "@land/canvas-core";
12
- import {
13
- formatImageCropViewBox,
14
- getImageCropAspectRatioPresetValue,
15
- getImageCropResetUpdate,
16
- getImageCropModeMarkId,
17
- getImageCropRect,
18
- getImageCropUpdateFromAspectRatioPreset,
19
- getImageCropUpdateFromZoom,
20
- IMAGE_CROP_ASPECT_RATIO_PRESETS,
21
- isImageCropModeForShape,
22
- } from "./crop";
23
- import {
24
- clearImageCropSessionBaseline,
25
- getImageCropSessionBaseline,
26
- rememberImageCropSessionBaseline,
27
- } from "./cropSession";
28
- import { createImageCropInteractionHandler } from "./cropInteractions";
29
- import { ImageShapeUtil } from "./ImageShapeUtil";
30
- import { isImageShapeRecord, type ImageShapeRecord } from "./types";
31
-
32
- export const IMAGE_REPLACE_TOOLBAR_ACTION_ID = "image.replace";
33
- export const IMAGE_DOWNLOAD_TOOLBAR_ACTION_ID = "image.download-original";
34
- export const IMAGE_INSERT_TOOLBAR_ACTION_ID = "image.insert";
35
- export const IMAGE_CROP_TOOLBAR_ACTION_ID = "image.crop";
36
- export const IMAGE_CROP_DONE_TOOLBAR_ACTION_ID = "image.crop.done";
37
- export const IMAGE_CROP_ZOOM_TOOLBAR_ACTION_ID = "image.crop.zoom";
38
- export const IMAGE_CROP_ASPECT_RATIO_TOOLBAR_ACTION_ID =
39
- "image.crop.aspect-ratio";
40
- export const IMAGE_CROP_RESET_TOOLBAR_ACTION_ID = "image.crop.reset";
41
-
42
- export class ImageShapeSvgExporter
43
- implements ShapeSvgExporter<ImageShapeRecord>
44
- {
45
- readonly type = "image" as const;
46
-
47
- toSvg(shape: ImageShapeRecord, context: SvgExportContext): SvgNode | null {
48
- const { assetId, altText, crop, h, w } = shape.props;
49
- if (!assetId) {
50
- return null;
51
- }
52
- const href = context.resolveAssetUrl(assetId);
53
- if (!href) {
54
- return null;
55
- }
56
-
57
- const cropRect = getImageCropRect(crop);
58
- if (cropRect) {
59
- return {
60
- tag: "svg",
61
- attrs: {
62
- x: 0,
63
- y: 0,
64
- width: w,
65
- height: h,
66
- viewBox: formatImageCropViewBox(cropRect),
67
- preserveAspectRatio: "none",
68
- overflow: "hidden",
69
- },
70
- children: [
71
- {
72
- tag: "image",
73
- attrs: {
74
- href,
75
- x: 0,
76
- y: 0,
77
- width: 1,
78
- height: 1,
79
- preserveAspectRatio: "none",
80
- "aria-label": altText || undefined,
81
- },
82
- },
83
- ],
84
- };
85
- }
86
-
87
- return {
88
- tag: "image",
89
- attrs: {
90
- href,
91
- width: w,
92
- height: h,
93
- preserveAspectRatio: "none",
94
- "aria-label": altText || undefined,
95
- },
96
- };
97
- }
98
- }
99
-
100
- export function createImageCorePlugin(): LandCorePlugin {
101
- return {
102
- id: "land.image",
103
- shapeCapabilities: [
104
- {
105
- type: "image",
106
- schemaProps: ["w", "h", "assetId", "crop", "altText"],
107
- reactRenderer: "supported",
108
- toolbarEntry: "supported",
109
- notes: [
110
- "Image shape util, SVG exporter, and React renderer live in @land/plugin-image. Asset records store serializable metadata plus a host storageKey; File/Blob/object URL/download behavior stays in the web host.",
111
- ],
112
- },
113
- ],
114
- shapeUtils: [new ImageShapeUtil()],
115
- shapeSvgExporters: [new ImageShapeSvgExporter()],
116
- interactionHandlers: [createImageCropInteractionHandler()],
117
- toolbarActions: [
118
- createImageHostToolbarActionContract(IMAGE_INSERT_TOOLBAR_ACTION_ID),
119
- createImageHostToolbarActionContract(IMAGE_REPLACE_TOOLBAR_ACTION_ID),
120
- createImageHostToolbarActionContract(IMAGE_DOWNLOAD_TOOLBAR_ACTION_ID),
121
- createImageCropToolbarAction(),
122
- createImageCropDoneToolbarAction(),
123
- createImageCropZoomToolbarAction(),
124
- createImageCropAspectRatioToolbarAction(),
125
- createImageCropResetToolbarAction(),
126
- ],
127
- toolbarContributions: [
128
- createImageToolToolbarContribution(),
129
- createImageSelectionToolbarContribution(),
130
- ],
131
- contextMenuContributions: [createImageContextMenuContribution()],
132
- };
133
- }
134
-
135
- function getSingleSelectedImageShape(
136
- context: ToolbarContext,
137
- ): ImageShapeRecord | null {
138
- if (
139
- context.selection.count !== 1 ||
140
- context.selection.singleShapeType !== "image"
141
- ) {
142
- return null;
143
- }
144
- const [shape] = context.selection.selectedShapes;
145
- return isImageShapeRecord(shape) ? shape : null;
146
- }
147
-
148
- export function isImageCropToolbarSession(context: ToolbarContext): boolean {
149
- const shape = getSingleSelectedImageShape(context);
150
- const session = context.editor.getShapeEditingSession();
151
- return !!(
152
- shape &&
153
- session?.shapeId === shape.id &&
154
- isImageCropModeForShape(shape, session.markId)
155
- );
156
- }
157
-
158
- function createImageHostToolbarActionContract(actionId: string): ToolbarAction {
159
- return {
160
- id: actionId,
161
- isVisible() {
162
- return false;
163
- },
164
- isEnabled() {
165
- return false;
166
- },
167
- run() {
168
- throw new Error(
169
- `Image toolbar action ${actionId} requires a host implementation.`,
170
- );
171
- },
172
- };
173
- }
174
-
175
- function createImageCropToolbarAction(): ToolbarAction<boolean> {
176
- return {
177
- id: IMAGE_CROP_TOOLBAR_ACTION_ID,
178
- isVisible(context) {
179
- return !!getSingleSelectedImageShape(context) &&
180
- !isImageCropToolbarSession(context);
181
- },
182
- isEnabled(context) {
183
- const shape = getSingleSelectedImageShape(context);
184
- return !!shape && !shape.isLocked;
185
- },
186
- getValue(context) {
187
- return isImageCropToolbarSession(context);
188
- },
189
- run({ context }) {
190
- const shape = getSingleSelectedImageShape(context);
191
- if (!shape || shape.isLocked) {
192
- return;
193
- }
194
-
195
- const session = context.editor.getShapeEditingSession();
196
- if (
197
- session?.shapeId === shape.id &&
198
- isImageCropModeForShape(shape, session.markId)
199
- ) {
200
- context.editor.completeEditing("user");
201
- return;
202
- }
203
-
204
- const nextSession = context.editor.startEditingShape(
205
- {
206
- shapeId: shape.id,
207
- markId: getImageCropModeMarkId(shape.id),
208
- entryMode: "focusEnd",
209
- },
210
- "user",
211
- );
212
- if (nextSession) {
213
- rememberImageCropSessionBaseline(shape);
214
- }
215
- },
216
- };
217
- }
218
-
219
- function createImageCropDoneToolbarAction(): ToolbarAction {
220
- return {
221
- id: IMAGE_CROP_DONE_TOOLBAR_ACTION_ID,
222
- isVisible(context) {
223
- return isImageCropToolbarSession(context);
224
- },
225
- isEnabled(context) {
226
- return isImageCropToolbarSession(context);
227
- },
228
- run({ context }) {
229
- const shape = getSingleSelectedImageShape(context);
230
- if (!shape) {
231
- return;
232
- }
233
- if (context.editor.completeEditing("user")) {
234
- clearImageCropSessionBaseline(shape.id);
235
- }
236
- },
237
- };
238
- }
239
-
240
- function createImageCropZoomToolbarAction(): ToolbarAction<number> {
241
- return {
242
- id: IMAGE_CROP_ZOOM_TOOLBAR_ACTION_ID,
243
- isVisible(context) {
244
- return isImageCropToolbarSession(context);
245
- },
246
- isEnabled(context) {
247
- const shape = getSingleSelectedImageShape(context);
248
- return !!shape && !shape.isLocked;
249
- },
250
- run({ context, value }) {
251
- const shape = getSingleSelectedImageShape(context);
252
- if (!shape || shape.isLocked || (value !== -1 && value !== 1)) {
253
- return;
254
- }
255
-
256
- const update = getImageCropUpdateFromZoom({
257
- direction: value === 1 ? "in" : "out",
258
- shape,
259
- });
260
- if (!update) {
261
- return;
262
- }
263
-
264
- context.editor.commands.updateShapes([update], { source: "user" });
265
- },
266
- };
267
- }
268
-
269
- function createImageCropAspectRatioToolbarAction(): ToolbarAction<string | null> {
270
- return {
271
- id: IMAGE_CROP_ASPECT_RATIO_TOOLBAR_ACTION_ID,
272
- isVisible(context) {
273
- return isImageCropToolbarSession(context);
274
- },
275
- isEnabled(context) {
276
- const shape = getSingleSelectedImageShape(context);
277
- return !!shape && !shape.isLocked;
278
- },
279
- getValue(context) {
280
- const shape = getSingleSelectedImageShape(context);
281
- return shape ? getImageCropAspectRatioPresetValue(shape) : null;
282
- },
283
- run({ context, value }) {
284
- const shape = getSingleSelectedImageShape(context);
285
- if (!shape || shape.isLocked || typeof value !== "string") {
286
- return;
287
- }
288
-
289
- const preset = IMAGE_CROP_ASPECT_RATIO_PRESETS.find(
290
- (candidate) => candidate.value === value,
291
- );
292
- if (!preset) {
293
- return;
294
- }
295
-
296
- const update = getImageCropUpdateFromAspectRatioPreset({
297
- preset: preset.value,
298
- shape,
299
- });
300
- if (!update) {
301
- return;
302
- }
303
-
304
- context.editor.commands.updateShapes([update], { source: "user" });
305
- },
306
- };
307
- }
308
-
309
- function createImageCropResetToolbarAction(): ToolbarAction {
310
- return {
311
- id: IMAGE_CROP_RESET_TOOLBAR_ACTION_ID,
312
- isVisible(context) {
313
- return isImageCropToolbarSession(context);
314
- },
315
- isEnabled(context) {
316
- const shape = getSingleSelectedImageShape(context);
317
- return !!shape && !shape.isLocked && !!shape.props.crop;
318
- },
319
- run({ context }) {
320
- const shape = getSingleSelectedImageShape(context);
321
- if (!shape || shape.isLocked) {
322
- return;
323
- }
324
-
325
- const baselineShape = getImageCropSessionBaseline(shape.id) ?? shape;
326
- const update = getImageCropResetUpdate({
327
- baselineShape,
328
- shape,
329
- });
330
- if (!update) {
331
- return;
332
- }
333
-
334
- context.editor.commands.updateShapes([update], { source: "user" });
335
- },
336
- };
337
- }
338
-
339
- function createImageToolToolbarContribution(): ToolbarContribution {
340
- return {
341
- id: "image.tool-toolbar",
342
- surface: "tool",
343
- placement: "chrome",
344
- order: 55,
345
- actionIds: [IMAGE_INSERT_TOOLBAR_ACTION_ID],
346
- getGroups() {
347
- return [
348
- {
349
- id: "image.tools",
350
- items: [
351
- {
352
- kind: "button",
353
- id: IMAGE_INSERT_TOOLBAR_ACTION_ID,
354
- actionId: IMAGE_INSERT_TOOLBAR_ACTION_ID,
355
- label: "Image",
356
- icon: "image-plus",
357
- dataUi: "insert-image-tool-button",
358
- },
359
- ],
360
- },
361
- ];
362
- },
363
- };
364
- }
365
-
366
- function createImageSelectionToolbarContribution(): ToolbarContribution {
367
- return {
368
- id: "image.selection-toolbar",
369
- surface: "selection",
370
- order: 30,
371
- actionIds: [
372
- IMAGE_CROP_TOOLBAR_ACTION_ID,
373
- IMAGE_CROP_DONE_TOOLBAR_ACTION_ID,
374
- IMAGE_CROP_ZOOM_TOOLBAR_ACTION_ID,
375
- IMAGE_CROP_ASPECT_RATIO_TOOLBAR_ACTION_ID,
376
- IMAGE_CROP_RESET_TOOLBAR_ACTION_ID,
377
- IMAGE_REPLACE_TOOLBAR_ACTION_ID,
378
- IMAGE_DOWNLOAD_TOOLBAR_ACTION_ID,
379
- ],
380
- when(context) {
381
- return (
382
- context.selection.count === 1 &&
383
- context.selection.singleShapeType === "image"
384
- );
385
- },
386
- getGroups(context) {
387
- const groups: ToolbarGroup[] = [];
388
- if (isImageCropToolbarSession(context)) {
389
- groups.push(
390
- {
391
- id: "image.crop-zoom",
392
- order: 10,
393
- items: [
394
- {
395
- kind: "stepper" as const,
396
- id: "image.crop.zoom-stepper",
397
- actionId: IMAGE_CROP_ZOOM_TOOLBAR_ACTION_ID,
398
- label: "Zoom",
399
- options: [
400
- {
401
- value: -1,
402
- label: "-",
403
- dataUi: "image-crop-zoom-out-button",
404
- },
405
- {
406
- value: 1,
407
- label: "+",
408
- dataUi: "image-crop-zoom-in-button",
409
- },
410
- ],
411
- },
412
- ],
413
- },
414
- {
415
- id: "image.crop-aspect",
416
- order: 20,
417
- items: [
418
- {
419
- kind: "segmented" as const,
420
- id: "image.crop.aspect-ratio-segmented",
421
- actionId: IMAGE_CROP_ASPECT_RATIO_TOOLBAR_ACTION_ID,
422
- options: IMAGE_CROP_ASPECT_RATIO_PRESETS.map((preset) => ({
423
- value: preset.value,
424
- label: preset.label,
425
- dataUi: `image-crop-aspect-${preset.value.replace(":", "-")}-button`,
426
- })),
427
- },
428
- ],
429
- },
430
- {
431
- id: "image.crop-actions",
432
- order: 30,
433
- items: [
434
- {
435
- kind: "button" as const,
436
- id: IMAGE_CROP_RESET_TOOLBAR_ACTION_ID,
437
- actionId: IMAGE_CROP_RESET_TOOLBAR_ACTION_ID,
438
- label: "Reset crop",
439
- icon: "rotate-ccw",
440
- dataUi: "reset-image-crop-button",
441
- },
442
- ],
443
- },
444
- );
445
- }
446
-
447
- groups.push({
448
- id: "image.asset",
449
- order: 40,
450
- items: [
451
- {
452
- kind: "button" as const,
453
- id: IMAGE_CROP_TOOLBAR_ACTION_ID,
454
- actionId: IMAGE_CROP_TOOLBAR_ACTION_ID,
455
- label: "Crop image",
456
- icon: "crop",
457
- dataUi: "crop-image-button",
458
- },
459
- {
460
- kind: "button" as const,
461
- id: IMAGE_CROP_DONE_TOOLBAR_ACTION_ID,
462
- actionId: IMAGE_CROP_DONE_TOOLBAR_ACTION_ID,
463
- label: "Done cropping",
464
- icon: "check",
465
- dataUi: "done-cropping-button",
466
- },
467
- {
468
- kind: "button" as const,
469
- id: IMAGE_REPLACE_TOOLBAR_ACTION_ID,
470
- actionId: IMAGE_REPLACE_TOOLBAR_ACTION_ID,
471
- label: "Replace image",
472
- icon: "image-plus",
473
- dataUi: "replace-image-button",
474
- },
475
- {
476
- kind: "button" as const,
477
- id: IMAGE_DOWNLOAD_TOOLBAR_ACTION_ID,
478
- actionId: IMAGE_DOWNLOAD_TOOLBAR_ACTION_ID,
479
- label: "Download original",
480
- icon: "download",
481
- dataUi: "download-image-original-button",
482
- },
483
- ],
484
- });
485
-
486
- return groups;
487
- },
488
- };
489
- }
490
-
491
- function createImageContextMenuContribution(): ContextMenuContribution {
492
- return {
493
- id: "image.shape-context-menu",
494
- target: "selection",
495
- order: 30,
496
- actionIds: [
497
- IMAGE_CROP_TOOLBAR_ACTION_ID,
498
- IMAGE_REPLACE_TOOLBAR_ACTION_ID,
499
- IMAGE_DOWNLOAD_TOOLBAR_ACTION_ID,
500
- ],
501
- when(context) {
502
- return (
503
- context.selection.count === 1 &&
504
- context.selection.singleShapeType === "image"
505
- );
506
- },
507
- getSections() {
508
- return [
509
- {
510
- id: "image.asset-context-menu",
511
- title: "Image",
512
- items: [
513
- {
514
- kind: "command",
515
- id: IMAGE_CROP_TOOLBAR_ACTION_ID,
516
- actionId: IMAGE_CROP_TOOLBAR_ACTION_ID,
517
- label: "Crop image",
518
- icon: "crop",
519
- dataUi: "context-menu-crop-image-button",
520
- },
521
- {
522
- kind: "command",
523
- id: IMAGE_REPLACE_TOOLBAR_ACTION_ID,
524
- actionId: IMAGE_REPLACE_TOOLBAR_ACTION_ID,
525
- label: "Replace image",
526
- icon: "image-plus",
527
- dataUi: "context-menu-replace-image-button",
528
- },
529
- {
530
- kind: "command",
531
- id: IMAGE_DOWNLOAD_TOOLBAR_ACTION_ID,
532
- actionId: IMAGE_DOWNLOAD_TOOLBAR_ACTION_ID,
533
- label: "Download original",
534
- icon: "download",
535
- dataUi: "context-menu-download-image-original-button",
536
- },
537
- ],
538
- },
539
- ];
540
- },
541
- };
542
- }