@yuzhouu/canvas-kit 0.1.10 → 0.1.12

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 (281) hide show
  1. package/README.md +95 -40
  2. package/_vendor/canvas-core/bindings/bindingUtil.d.ts +15 -0
  3. package/_vendor/canvas-core/bindings/terminalPorts.d.ts +67 -0
  4. package/_vendor/canvas-core/editor/bindingReactionScope.d.ts +7 -0
  5. package/_vendor/canvas-core/editor/commands.d.ts +3 -3
  6. package/_vendor/canvas-core/editor/editor.d.ts +20 -5
  7. package/_vendor/canvas-core/editor/editorComputedHelpers.d.ts +1 -0
  8. package/_vendor/canvas-core/editor/historyManager.d.ts +2 -5
  9. package/_vendor/canvas-core/editor/interactions.d.ts +33 -9
  10. package/_vendor/canvas-core/editor/managers/bindingManager.d.ts +1 -6
  11. package/_vendor/canvas-core/editor/managers/queryManager.d.ts +13 -0
  12. package/_vendor/canvas-core/editor/managers/selectionLayoutManager.d.ts +3 -0
  13. package/_vendor/canvas-core/editor/managers/selectionOverlayManager.d.ts +1 -0
  14. package/_vendor/canvas-core/editor/managers/shapeEditingManager.d.ts +4 -0
  15. package/_vendor/canvas-core/editor/managers/shapeHierarchyManager.d.ts +1 -0
  16. package/_vendor/canvas-core/editor/managers/snapCalculations.d.ts +4 -1
  17. package/_vendor/canvas-core/editor/managers/snapGeometry.d.ts +2 -1
  18. package/_vendor/canvas-core/editor/operationManager.d.ts +74 -0
  19. package/_vendor/canvas-core/editor/selectionOverlay.d.ts +3 -1
  20. package/_vendor/canvas-core/exports/svg.d.ts +2 -3
  21. package/_vendor/canvas-core/geometry/contentCutout.d.ts +8 -0
  22. package/_vendor/canvas-core/index.d.ts +9 -5
  23. package/_vendor/canvas-core/shapes/colors.d.ts +2 -1
  24. package/_vendor/canvas-core/shapes/shapeUtil.d.ts +47 -1
  25. package/_vendor/canvas-core/tools/select/selectToolHelpers.d.ts +9 -2
  26. package/_vendor/canvas-core/tools/select/states/{draggingSelectionHandleInteractionState.d.ts → draggingPluginInteractionState.d.ts} +5 -4
  27. package/_vendor/canvas-core/tools/select/states/index.d.ts +1 -1
  28. package/_vendor/canvas-core/tools/select/states/pointingSelectionHandleInteractionState.d.ts +2 -2
  29. package/_vendor/canvas-core/tools/select/states/pointingShapeState.d.ts +1 -1
  30. package/_vendor/canvas-core/tools/select/states/resizingState.d.ts +1 -1
  31. package/_vendor/canvas-core/tools/select/states/rotatingState.d.ts +1 -1
  32. package/_vendor/canvas-core/tools/select/states/selectStateNode.d.ts +6 -2
  33. package/_vendor/canvas-core/tools/select/states/translatingState.d.ts +1 -1
  34. package/_vendor/canvas-plugin-sdk/capability.d.ts +10 -0
  35. package/_vendor/canvas-plugin-sdk/index.d.ts +2 -6
  36. package/_vendor/canvas-plugin-sdk/plugin.d.ts +18 -28
  37. package/_vendor/canvas-plugin-sdk/setupExtension.d.ts +5 -0
  38. package/_vendor/canvas-product-contracts/actionRegistry.d.ts +4 -0
  39. package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/actions.d.ts +14 -3
  40. package/_vendor/canvas-product-contracts/capability.d.ts +8 -0
  41. package/_vendor/canvas-product-contracts/chrome.d.ts +53 -0
  42. package/_vendor/canvas-product-contracts/chromeRegistry.d.ts +9 -0
  43. package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/contextMenu.d.ts +4 -0
  44. package/_vendor/canvas-product-contracts/contextMenuRegistry.d.ts +4 -0
  45. package/_vendor/canvas-product-contracts/exportRegistry.d.ts +6 -0
  46. package/_vendor/canvas-product-contracts/exports.d.ts +27 -0
  47. package/_vendor/canvas-product-contracts/importRegistry.d.ts +7 -0
  48. package/_vendor/canvas-product-contracts/imports.d.ts +39 -0
  49. package/_vendor/canvas-product-contracts/index.d.ts +15 -0
  50. package/_vendor/canvas-product-contracts/productApi.d.ts +29 -0
  51. package/_vendor/canvas-product-contracts/services.d.ts +21 -0
  52. package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/toolbar.d.ts +23 -4
  53. package/_vendor/canvas-product-contracts/toolbarRegistry.d.ts +9 -0
  54. package/_vendor/canvas-react/host/canvasRenderPlugin.d.ts +15 -4
  55. package/_vendor/canvas-react/host/index.d.ts +2 -2
  56. package/_vendor/plugin-arrow/api.d.ts +33 -0
  57. package/_vendor/plugin-arrow/arrowGeometry.d.ts +2 -1
  58. package/_vendor/plugin-arrow/arrowHeadGeometry.d.ts +8 -0
  59. package/_vendor/plugin-arrow/arrowShapeUtil.d.ts +2 -1
  60. package/_vendor/plugin-arrow/editorRuntime.d.ts +0 -2
  61. package/_vendor/plugin-arrow/feature.d.ts +2 -2
  62. package/_vendor/plugin-arrow/index.d.ts +4 -1
  63. package/_vendor/plugin-arrow/productRuntime.d.ts +2 -0
  64. package/_vendor/plugin-draw/DrawShapeRenderer.d.ts +5 -2
  65. package/_vendor/plugin-draw/drawPath.d.ts +7 -1
  66. package/_vendor/plugin-draw/editorRuntime.d.ts +1 -3
  67. package/_vendor/plugin-draw/feature.d.ts +2 -2
  68. package/_vendor/plugin-draw/index.d.ts +2 -1
  69. package/_vendor/plugin-draw/productRuntime.d.ts +2 -0
  70. package/_vendor/plugin-eraser/editorRuntime.d.ts +1 -3
  71. package/_vendor/plugin-eraser/feature.d.ts +2 -2
  72. package/_vendor/plugin-eraser/index.d.ts +2 -1
  73. package/_vendor/plugin-eraser/productRuntime.d.ts +2 -0
  74. package/_vendor/plugin-frame/api.d.ts +19 -0
  75. package/_vendor/plugin-frame/canvasRender.d.ts +3 -3
  76. package/_vendor/plugin-frame/editorRuntime.d.ts +0 -2
  77. package/_vendor/plugin-frame/feature.d.ts +2 -2
  78. package/_vendor/plugin-frame/frameShapeUtil.d.ts +8 -0
  79. package/_vendor/plugin-frame/index.d.ts +4 -1
  80. package/_vendor/plugin-frame/productRuntime.d.ts +2 -0
  81. package/_vendor/plugin-geo/api.d.ts +27 -0
  82. package/_vendor/plugin-geo/canvasRender.d.ts +3 -3
  83. package/_vendor/plugin-geo/editorRuntime.d.ts +1 -3
  84. package/_vendor/plugin-geo/feature.d.ts +2 -2
  85. package/_vendor/plugin-geo/geoStrokeStyle.d.ts +2 -0
  86. package/_vendor/plugin-geo/geoTools.d.ts +1 -1
  87. package/_vendor/plugin-geo/index.d.ts +7 -4
  88. package/_vendor/plugin-geo/productRuntime.d.ts +2 -0
  89. package/_vendor/plugin-geo/types.d.ts +5 -1
  90. package/_vendor/plugin-group/canvasRender.d.ts +1 -2
  91. package/_vendor/plugin-group/editorRuntime.d.ts +0 -2
  92. package/_vendor/plugin-group/feature.d.ts +2 -2
  93. package/_vendor/plugin-group/groupContributions.d.ts +1 -1
  94. package/_vendor/plugin-group/index.d.ts +2 -1
  95. package/_vendor/plugin-group/productRuntime.d.ts +2 -0
  96. package/_vendor/plugin-image/cropRuntime.d.ts +1 -1
  97. package/_vendor/plugin-image/editorRuntime.d.ts +0 -4
  98. package/_vendor/plugin-image/feature.d.ts +2 -2
  99. package/_vendor/plugin-image/imageHostActionContract.d.ts +1 -1
  100. package/_vendor/plugin-image/index.d.ts +2 -1
  101. package/_vendor/plugin-image/productRuntime.d.ts +4 -0
  102. package/_vendor/plugin-image/runtimeShared.d.ts +1 -1
  103. package/_vendor/plugin-image/smudgeRuntime.d.ts +1 -1
  104. package/_vendor/plugin-image/styleRuntime.d.ts +6 -1
  105. package/_vendor/plugin-image/toolbarRuntime.d.ts +1 -1
  106. package/_vendor/plugin-laser/editorRuntime.d.ts +1 -3
  107. package/_vendor/plugin-laser/feature.d.ts +2 -2
  108. package/_vendor/plugin-laser/index.d.ts +2 -1
  109. package/_vendor/plugin-laser/productRuntime.d.ts +2 -0
  110. package/_vendor/plugin-path/PathShapeRenderer.d.ts +5 -2
  111. package/_vendor/plugin-path/editorRuntime.d.ts +1 -15
  112. package/_vendor/plugin-path/feature.d.ts +2 -2
  113. package/_vendor/plugin-path/index.d.ts +2 -1
  114. package/_vendor/plugin-path/pathHistory.d.ts +13 -0
  115. package/_vendor/plugin-path/pathShapeUtil.d.ts +3 -1
  116. package/_vendor/plugin-path/pathTool.d.ts +3 -0
  117. package/_vendor/plugin-path/productRuntime.d.ts +15 -0
  118. package/_vendor/plugin-runtime-clipboard/capability.d.ts +1 -0
  119. package/{features/clipboard/clipboardContribution.d.ts → _vendor/plugin-runtime-clipboard/clipboardActions.d.ts} +1 -7
  120. package/{features/clipboard → _vendor/plugin-runtime-clipboard}/clipboardService.d.ts +3 -3
  121. package/_vendor/plugin-runtime-clipboard/index.d.ts +4 -0
  122. package/_vendor/plugin-runtime-clipboard/plugin.d.ts +1 -0
  123. package/_vendor/plugin-runtime-export/blobDataUrl.d.ts +1 -0
  124. package/_vendor/plugin-runtime-export/canvasExportApi.d.ts +43 -0
  125. package/_vendor/plugin-runtime-export/index.d.ts +8 -0
  126. package/_vendor/plugin-runtime-export/plugin.d.ts +5 -0
  127. package/_vendor/plugin-runtime-export/pngExport.d.ts +15 -0
  128. package/{features/export → _vendor/plugin-runtime-export}/svgExport.d.ts +9 -2
  129. package/_vendor/plugin-text/api.d.ts +20 -0
  130. package/_vendor/plugin-text/capabilities.d.ts +2 -0
  131. package/_vendor/plugin-text/editorRuntime.d.ts +2 -8
  132. package/_vendor/plugin-text/feature.d.ts +1 -1
  133. package/_vendor/plugin-text/geoLabelBindingUtil.d.ts +0 -2
  134. package/_vendor/plugin-text/host/TiptapTextEditor.d.ts +1 -1
  135. package/_vendor/plugin-text/host/initialTextBackground.d.ts +2 -0
  136. package/_vendor/plugin-text/host/richTextRendering.d.ts +1 -1
  137. package/_vendor/plugin-text/host/textEditingBoxStyle.d.ts +1 -1
  138. package/_vendor/plugin-text/host/textEntryFocus.d.ts +2 -1
  139. package/_vendor/plugin-text/host/textMeasurement.d.ts +10 -2
  140. package/_vendor/plugin-text/index.d.ts +7 -3
  141. package/_vendor/plugin-text/pathLabelBindingUtil.d.ts +55 -0
  142. package/_vendor/plugin-text/productRuntime.d.ts +6 -0
  143. package/_vendor/plugin-text/richTextUtils.d.ts +3 -2
  144. package/_vendor/plugin-text/shapeWideTextFormatting.d.ts +4 -0
  145. package/_vendor/plugin-text/textFormatting.d.ts +2 -0
  146. package/_vendor/plugin-text/textLabelHelpers.d.ts +23 -2
  147. package/_vendor/plugin-text/textShapeUtil.d.ts +5 -2
  148. package/_vendor/plugin-text/textTypes.d.ts +1 -0
  149. package/_vendor/signals/core.d.ts +1 -0
  150. package/_vendor/signals/index.d.ts +1 -1
  151. package/_vendor/store/history.d.ts +1 -1
  152. package/_vendor/store/store.d.ts +2 -0
  153. package/browser/indexedDb.d.ts +10 -10
  154. package/browser/persistence.d.ts +4 -25
  155. package/chrome/floating/useCanvasKitFloatingPosition.d.ts +1 -1
  156. package/chrome/toolbar/FloatingSelectionToolbarPageSpace.d.ts +5 -3
  157. package/chrome/toolbar/mergeToolbarGroups.d.ts +8 -0
  158. package/chrome/toolbar/toolbarLabels.d.ts +1 -1
  159. package/chrome/toolbar/useToolbarSurfaces.d.ts +9 -10
  160. package/chrome/types.d.ts +12 -9
  161. package/chrome/useCanvasKitChromeContext.d.ts +4 -7
  162. package/chrome/useChromeSurfaces.d.ts +12 -0
  163. package/chrome/useContextMenuSurface.d.ts +1 -1
  164. package/controller/canvasKitController.d.ts +4 -11
  165. package/core/index.d.ts +3 -4
  166. package/core/product-controller/canvasProductController.d.ts +40 -11
  167. package/core/product-controller/index.d.ts +1 -1
  168. package/core/runtime/productServices.d.ts +5 -19
  169. package/core/runtime/runtimeContracts.d.ts +3 -3
  170. package/features/context-menu/contextMenuRuntime.d.ts +1 -1
  171. package/features/image/asset/imageAssetService.d.ts +2 -3
  172. package/features/image/asset/imageBlobStore.d.ts +1 -0
  173. package/features/image/asset/imageFileHelpers.d.ts +0 -6
  174. package/features/image/asset/svgImageAssetInliner.d.ts +1 -1
  175. package/features/image/controller/imageProductController.d.ts +2 -2
  176. package/features/image/imageHostPlugin.d.ts +1 -0
  177. package/features/image/import/ImageImportController.d.ts +3 -1
  178. package/features/image/index.d.ts +1 -3
  179. package/features/image/smudge/imageSmudgeHostActions.d.ts +1 -1
  180. package/features/image/toolbar/imageHostActions.d.ts +8 -9
  181. package/features/image/toolbar/imageToolbarHostBridge.d.ts +1 -1
  182. package/features/text/{textProductPlugin.d.ts → textHostPlugin.d.ts} +1 -1
  183. package/features/text/textSvgAssetInliner.d.ts +3 -0
  184. package/features/text/textSvgAssetPlugin.d.ts +2 -0
  185. package/index.css +1 -1
  186. package/index.d.ts +31 -19
  187. package/index.mjs +88 -84
  188. package/package.json +2 -2
  189. package/plugins/runtime/import-host/CanvasImportHost.d.ts +4 -0
  190. package/plugins/runtime/import-host/capability.d.ts +1 -0
  191. package/plugins/runtime/import-host/index.d.ts +2 -0
  192. package/plugins/runtime/import-host/plugin.d.ts +1 -0
  193. package/plugins/runtime/keyboard-shortcuts/index.d.ts +1 -0
  194. package/plugins/runtime/keyboard-shortcuts/plugin.d.ts +1 -0
  195. package/plugins/runtime/keyboard-shortcuts/useCanvasKeyboardShortcuts.d.ts +8 -0
  196. package/plugins/runtime/tool-actions/capability.d.ts +1 -0
  197. package/plugins/runtime/tool-actions/index.d.ts +2 -0
  198. package/plugins/runtime/tool-actions/plugin.d.ts +1 -0
  199. package/plugins/runtime/tool-actions/toolActions.d.ts +2 -0
  200. package/plugins/standard/clipboard/chrome.d.ts +2 -0
  201. package/plugins/standard/clipboard/contextMenu.d.ts +2 -0
  202. package/plugins/standard/clipboard/plugin.d.ts +1 -0
  203. package/plugins/standard/clipboard/shortcuts.d.ts +5 -0
  204. package/plugins/standard/createStandardCanvasKitPlugins.d.ts +15 -0
  205. package/{features/selection/selectionActions.d.ts → plugins/standard/selection/actions.d.ts} +4 -2
  206. package/plugins/standard/selection/chrome.d.ts +2 -0
  207. package/plugins/standard/selection/contextMenu.d.ts +2 -0
  208. package/plugins/standard/selection/plugin.d.ts +1 -0
  209. package/plugins/standard/selection/toolbar.d.ts +2 -0
  210. package/plugins/standard/tool-ui/contextMenu.d.ts +2 -0
  211. package/plugins/standard/tool-ui/plugin.d.ts +1 -0
  212. package/plugins/standard/tool-ui/toolbar.d.ts +2 -0
  213. package/{features/view/viewActions.d.ts → plugins/standard/view/actions.d.ts} +1 -1
  214. package/plugins/standard/view/chrome.d.ts +2 -0
  215. package/plugins/standard/view/contextMenu.d.ts +2 -0
  216. package/plugins/standard/view/plugin.d.ts +1 -0
  217. package/{features/actions/actionRuntime.d.ts → runtime/canvasKitActionContext.d.ts} +3 -2
  218. package/runtime/canvasKitCommandExecutor.d.ts +1 -1
  219. package/runtime/canvasKitPluginContracts.d.ts +29 -76
  220. package/runtime/canvasKitPluginLifecycle.d.ts +32 -0
  221. package/runtime/canvasKitPluginSetup.d.ts +34 -0
  222. package/runtime/canvasKitPluginUi.d.ts +35 -0
  223. package/runtime/canvasKitResourceScope.d.ts +5 -0
  224. package/runtime/canvasKitRuntime.d.ts +9 -7
  225. package/runtime/canvasKitRuntimeContracts.d.ts +2 -5
  226. package/runtime/canvasPluginGraph.d.ts +15 -0
  227. package/runtime/persistenceCoordinator.d.ts +33 -0
  228. package/runtime/registries/actionRegistry.d.ts +5 -0
  229. package/runtime/registries/chromeRegistry.d.ts +2 -0
  230. package/runtime/registries/contextMenuRegistry.d.ts +5 -0
  231. package/runtime/registries/exportRegistry.d.ts +2 -0
  232. package/runtime/registries/importRegistry.d.ts +2 -0
  233. package/runtime/registries/index.d.ts +7 -0
  234. package/runtime/registries/productApiRegistry.d.ts +5 -0
  235. package/runtime/registries/toolbarRegistry.d.ts +5 -0
  236. package/_vendor/canvas-plugin-sdk/actionRegistry.d.ts +0 -7
  237. package/_vendor/canvas-plugin-sdk/contextMenuRegistry.d.ts +0 -11
  238. package/_vendor/canvas-plugin-sdk/toolbarRegistry.d.ts +0 -19
  239. package/_vendor/plugin-packaging/canvasRender.d.ts +0 -2
  240. package/_vendor/plugin-packaging/editorRuntime.d.ts +0 -2
  241. package/_vendor/plugin-packaging/feature.d.ts +0 -2
  242. package/_vendor/plugin-packaging/index.d.ts +0 -17
  243. package/_vendor/plugin-packaging/packagingArtwork.d.ts +0 -5
  244. package/_vendor/plugin-packaging/packagingDxf.d.ts +0 -9
  245. package/_vendor/plugin-packaging/packagingGeometry.d.ts +0 -74
  246. package/_vendor/plugin-packaging/packagingInteractions.d.ts +0 -2
  247. package/_vendor/plugin-packaging/packagingPdfExporter.d.ts +0 -25
  248. package/_vendor/plugin-packaging/packagingRuntime.d.ts +0 -11
  249. package/_vendor/plugin-packaging/packagingShapeUtil.d.ts +0 -34
  250. package/_vendor/plugin-packaging/packagingStyle.d.ts +0 -10
  251. package/_vendor/plugin-packaging/packagingSvgExporter.d.ts +0 -7
  252. package/_vendor/plugin-packaging/productRuntime.d.ts +0 -2
  253. package/_vendor/plugin-packaging/types.d.ts +0 -168
  254. package/_vendor/plugin-packaging/validation.d.ts +0 -3
  255. package/_vendor/plugin-text/arrowLabelBindingUtil.d.ts +0 -47
  256. package/builtins/controller/createBuiltInCanvasController.d.ts +0 -18
  257. package/builtins/controller/layerController.d.ts +0 -9
  258. package/builtins/controller/packagingController.d.ts +0 -71
  259. package/builtins/controller/shapeCreationController.d.ts +0 -83
  260. package/builtins/index.d.ts +0 -7
  261. package/builtins/plugins.d.ts +0 -16
  262. package/chrome/useSvgExport.d.ts +0 -15
  263. package/core/api/apiRegistry.d.ts +0 -12
  264. package/es-DocrZgUh.mjs +0 -2
  265. package/features/clipboard/clipboardContextMenuContributions.d.ts +0 -2
  266. package/features/clipboard/clipboardPlugin.d.ts +0 -1
  267. package/features/image/imageProductPlugin.d.ts +0 -1
  268. package/features/image/import/useImageImport.d.ts +0 -16
  269. package/features/keyboard/keyboardShortcutPlugin.d.ts +0 -1
  270. package/features/keyboard/useCanvasKitKeyboardShortcuts.d.ts +0 -8
  271. package/features/selection/selectionContextMenuContributions.d.ts +0 -2
  272. package/features/selection/selectionPlugin.d.ts +0 -1
  273. package/features/selection/selectionToolbarContributions.d.ts +0 -2
  274. package/features/tool/toolActions.d.ts +0 -2
  275. package/features/tool/toolContextMenuContributions.d.ts +0 -2
  276. package/features/tool/toolPlugin.d.ts +0 -1
  277. package/features/tool/toolToolbarContributions.d.ts +0 -2
  278. package/features/view/viewContextMenuContributions.d.ts +0 -2
  279. package/features/view/viewPlugin.d.ts +0 -1
  280. package/product/standardCanvasKitPlugins.d.ts +0 -4
  281. package/runtime/canvasKitPlugins.d.ts +0 -33
@@ -0,0 +1 @@
1
+ export declare function readBlobAsDataUrl(blob: Blob): Promise<string | null>;
@@ -0,0 +1,43 @@
1
+ import type { Editor, ShapeId, ThemeColorResolver } from "../canvas-core/index";
2
+ import { type CanvasExportArtifact, type CanvasExportContribution, type CanvasExportFormat, type CanvasExportRegistry } from "../canvas-product-contracts/index";
3
+ import { type PngExportResult } from "./pngExport";
4
+ import { type SvgAssetInliner, type SvgExportResult } from "./svgExport";
5
+ export type CanvasExportTarget = {
6
+ scope: "page" | "selection";
7
+ shapeIds?: never;
8
+ } | {
9
+ scope?: never;
10
+ shapeIds: readonly ShapeId[];
11
+ };
12
+ export interface CanvasExportAppearance {
13
+ readonly resolveThemeColor?: ThemeColorResolver;
14
+ }
15
+ export type CanvasSvgExportInput = CanvasExportTarget & {
16
+ appearance?: CanvasExportAppearance;
17
+ padding?: number;
18
+ };
19
+ export type CanvasPngExportInput = CanvasSvgExportInput & {
20
+ background?: string;
21
+ pixelRatio?: number;
22
+ };
23
+ export type CanvasGenericExportInput = CanvasExportTarget & {
24
+ format: string;
25
+ options?: unknown;
26
+ };
27
+ export interface CanvasExportApi {
28
+ getFormats(): readonly CanvasExportFormat[];
29
+ export(input: CanvasGenericExportInput): Promise<CanvasExportArtifact>;
30
+ exportPng(input: CanvasPngExportInput): Promise<PngExportResult>;
31
+ exportSvg(input: CanvasSvgExportInput): Promise<SvgExportResult>;
32
+ }
33
+ export declare const canvasExportApiToken: import("../canvas-product-contracts/index").ProductApiToken<CanvasExportApi>;
34
+ export declare function createCanvasExportApi({ editor, exportRegistry, }: {
35
+ editor: Editor;
36
+ exportRegistry: CanvasExportRegistry;
37
+ }): CanvasExportApi;
38
+ export declare function createSvgExportContribution({ assetInliners, }: {
39
+ assetInliners: readonly SvgAssetInliner[];
40
+ }): CanvasExportContribution;
41
+ export declare function createPngExportContribution({ assetInliners, }: {
42
+ assetInliners: readonly SvgAssetInliner[];
43
+ }): CanvasExportContribution;
@@ -0,0 +1,8 @@
1
+ export { readBlobAsDataUrl } from "./blobDataUrl";
2
+ export { canvasExportApiToken, createCanvasExportApi, createPngExportContribution, createSvgExportContribution, } from "./canvasExportApi";
3
+ export type { CanvasExportAppearance, CanvasExportApi, CanvasGenericExportInput, CanvasExportTarget, CanvasPngExportInput, CanvasSvgExportInput, } from "./canvasExportApi";
4
+ export { exportEditorPng, } from "./pngExport";
5
+ export type { PngExportOptions, PngExportResult, } from "./pngExport";
6
+ export { createDefaultCanvasExportPlugin } from "./plugin";
7
+ export { exportEditorSvg, } from "./svgExport";
8
+ export type { ExportStatus, SvgAssetInliner, SvgExportOptions, SvgExportResult, } from "./svgExport";
@@ -0,0 +1,5 @@
1
+ import type { SvgAssetInliner } from "./svgExport";
2
+ import { type CanvasPlugin } from "../canvas-plugin-sdk/index";
3
+ export declare function createDefaultCanvasExportPlugin({ svgAssetInliners, }: {
4
+ svgAssetInliners: SvgAssetInliner[];
5
+ }): CanvasPlugin;
@@ -0,0 +1,15 @@
1
+ import type { ShapeId, SvgExportSkippedShape } from "../canvas-core/index";
2
+ import { type ExportStatus, type SvgExportOptions } from "./svgExport";
3
+ export interface PngExportOptions extends SvgExportOptions {
4
+ background?: string;
5
+ pixelRatio?: number;
6
+ }
7
+ export interface PngExportResult {
8
+ status: ExportStatus;
9
+ blob: Blob | null;
10
+ width: number | null;
11
+ height: number | null;
12
+ exportedShapeIds: readonly ShapeId[];
13
+ skippedShapes: readonly SvgExportSkippedShape[];
14
+ }
15
+ export declare function exportEditorPng({ background, pixelRatio, ...svgOptions }: PngExportOptions): Promise<PngExportResult>;
@@ -1,7 +1,12 @@
1
- import type { Editor, ExportIntegrityReport, ShapeCapabilityManifest, ShapeId, SvgExportSkippedShape, SvgThemeColorResolver } from "../../_vendor/canvas-core/index";
1
+ import type { Editor, ExportIntegrityReport, ShapeCapabilityManifest, ShapeId, ShapeRecord, SvgExportSkippedShape, ThemeColorResolver } from "../canvas-core/index";
2
2
  export interface SvgAssetInliner {
3
+ prepare?(input: {
4
+ editor: Editor;
5
+ requestedShapeIds: readonly ShapeId[];
6
+ }): Promise<void>;
3
7
  inline(input: {
4
8
  editor: Editor;
9
+ exportedShapes: readonly ShapeRecord[];
5
10
  exportedShapeIds: readonly ShapeId[];
6
11
  svg: string;
7
12
  }): Promise<string>;
@@ -16,6 +21,8 @@ export type ExportStatus = {
16
21
  export interface SvgExportResult {
17
22
  status: ExportStatus;
18
23
  svg: string | null;
24
+ width: number | null;
25
+ height: number | null;
19
26
  exportedShapeIds: readonly ShapeId[];
20
27
  skippedShapes: readonly SvgExportSkippedShape[];
21
28
  }
@@ -23,7 +30,7 @@ export interface SvgExportOptions {
23
30
  assetInliners?: readonly SvgAssetInliner[];
24
31
  editor: Editor;
25
32
  padding?: number;
26
- resolveThemeColor?: SvgThemeColorResolver;
33
+ resolveThemeColor?: ThemeColorResolver;
27
34
  shapeIds: readonly ShapeId[];
28
35
  }
29
36
  export declare function exportEditorSvg({ assetInliners, editor, padding, resolveThemeColor, shapeIds, }: SvgExportOptions): Promise<SvgExportResult>;
@@ -0,0 +1,20 @@
1
+ import type { ShapeColor } from "../canvas-core/index";
2
+ import { type CanvasPluginApi, type CanvasShapeRef } from "../canvas-product-contracts/index";
3
+ import type { TextShapeProps } from "./textTypes";
4
+ export interface TextInput {
5
+ x: number;
6
+ y: number;
7
+ text: string;
8
+ w?: number;
9
+ h?: number;
10
+ font?: TextShapeProps["font"];
11
+ color?: ShapeColor;
12
+ size?: TextShapeProps["size"];
13
+ textAlign?: TextShapeProps["textAlign"];
14
+ meta?: Record<string, unknown>;
15
+ }
16
+ export interface TextApi {
17
+ create(input: TextInput): CanvasShapeRef<"text"> | null;
18
+ }
19
+ export declare const textApiToken: import("../canvas-product-contracts/index").ProductApiToken<TextApi>;
20
+ export declare const textPluginApi: CanvasPluginApi<TextApi>;
@@ -0,0 +1,2 @@
1
+ import type { TextFontCatalog } from "./textFonts";
2
+ export declare const textFontCatalogCapability: import("../canvas-plugin-sdk/index").CanvasPluginValueToken<TextFontCatalog>;
@@ -1,11 +1,5 @@
1
- import { type CanvasProductContribution } from "../canvas-plugin-sdk/index";
2
- import { type EditorPlugin } from "../canvas-core/index";
1
+ import type { EditorPlugin } from "../canvas-core/index";
3
2
  import { type TextFontCatalog } from "./textFonts";
4
- export declare function createTextEditorPlugin({ fontCatalog, selectionFormattingToolbar, }?: {
3
+ export declare function createTextEditorPlugin({ fontCatalog, }?: {
5
4
  fontCatalog?: TextFontCatalog;
6
- selectionFormattingToolbar?: boolean;
7
5
  }): EditorPlugin;
8
- export declare function createTextProductContribution({ fontCatalog, selectionFormattingToolbar, }?: {
9
- fontCatalog?: TextFontCatalog;
10
- selectionFormattingToolbar?: boolean;
11
- }): CanvasProductContribution;
@@ -1,4 +1,4 @@
1
1
  import { type CanvasPlugin } from "../canvas-plugin-sdk/index";
2
2
  import { type TextPluginOptions } from "./textFonts";
3
3
  export declare function createTextPlugin(options?: Readonly<Partial<TextPluginOptions>>): CanvasPlugin;
4
- export declare const Text: CanvasPlugin<import("../canvas-plugin-sdk/index").CanvasProductFactory>;
4
+ export declare const Text: CanvasPlugin<import("../canvas-plugin-sdk/index").CanvasPluginSetup<import("../canvas-plugin-sdk/index").CanvasPluginSetupContext>>;
@@ -1,8 +1,6 @@
1
1
  import { BindingUtil, type BindingRecordBase, type BindingUtilEffect, type Editor, type ShapeRecord } from "../canvas-core/index";
2
2
  import { GEO_LABEL_BINDING_TYPE } from "./textLabelHelpers";
3
3
  import type { TextShapeRecord } from "./textTypes";
4
- export declare const GEO_LABEL_EDGE_PADDING = 16;
5
- export declare const GEO_LABEL_MIN_WIDTH = 16;
6
4
  export declare const GEO_LABEL_INDEX_SUFFIX = ".label";
7
5
  export interface GeoLabelBindingProps {
8
6
  normalizedAnchor: {
@@ -1,6 +1,6 @@
1
1
  import { type CSSProperties } from "react";
2
2
  import { type Editor as TiptapEditor } from "@tiptap/react";
3
- import type { Editor as LandEditor } from "../../canvas-core/index";
3
+ import { type Editor as LandEditor } from "../../canvas-core/index";
4
4
  import type { RichTextDocument, TextShapeRecord } from "../textTypes";
5
5
  import type { TextFontCatalog } from "../textFonts";
6
6
  import type { TextTiptapEditorChangeHandler, TextTiptapEditorHandle } from "../textFormatting";
@@ -0,0 +1,2 @@
1
+ import type { Editor as TiptapEditor } from "@tiptap/react";
2
+ export declare function applyInitialTextBackgroundToEmptyEditor(editor: TiptapEditor, backgroundColor: string | null): boolean;
@@ -7,4 +7,4 @@ export interface RichTextRenderLinkHandlers {
7
7
  }): void;
8
8
  onPointerLeave?(): void;
9
9
  }
10
- export declare function renderRichTextDocument(richText: RichTextDocument, linkHandlers?: RichTextRenderLinkHandlers): ReactNode;
10
+ export declare function renderRichTextDocument(richText: RichTextDocument, linkHandlers?: RichTextRenderLinkHandlers, defaultBackgroundColor?: string): ReactNode;
@@ -1,4 +1,4 @@
1
1
  import { type CSSProperties } from "react";
2
2
  import type { TextShapeRecord } from "../textTypes";
3
3
  import type { TextFontCatalog } from "../textFonts";
4
- export declare function useTextEditingBoxStyle(shape: TextShapeRecord, fontCatalog: TextFontCatalog): CSSProperties;
4
+ export declare function useTextEditingBoxStyle(shape: TextShapeRecord, fontCatalog: TextFontCatalog, paddingInline?: number): CSSProperties;
@@ -11,7 +11,7 @@ export declare function focusTextEditorWhenMounted({ editor, controller, shapeId
11
11
  onApplied?: (request: ShapeEditingEntryRequest | null) => void;
12
12
  attempt?: number;
13
13
  }): void;
14
- export declare function useTextEditingEntryFocus({ editor, shapeId, session, tiptapEditor, richTextController, entryRequest, consumedEntryRequestIdRef, }: {
14
+ export declare function useTextEditingEntryFocus({ editor, shapeId, session, tiptapEditor, richTextController, entryRequest, consumedEntryRequestIdRef, onEntryFocusApplied, }: {
15
15
  editor: Editor;
16
16
  shapeId: TextShapeRecord["id"];
17
17
  session: ShapeEditingSession;
@@ -19,4 +19,5 @@ export declare function useTextEditingEntryFocus({ editor, shapeId, session, tip
19
19
  richTextController: TiptapTextEditorController | null;
20
20
  entryRequest: ShapeEditingEntryRequest | null;
21
21
  consumedEntryRequestIdRef: MutableRefObject<number | null>;
22
+ onEntryFocusApplied?: () => void;
22
23
  }): void;
@@ -1,13 +1,21 @@
1
1
  import type { Editor as TiptapEditor } from "@tiptap/react";
2
2
  import type { RichTextDocument, TextShapeRecord } from "../textTypes";
3
3
  import type { TextFontCatalog } from "../textFonts";
4
+ import { type TextLabelLayoutConstraints } from "../textLabelHelpers";
4
5
  export declare const TEXT_AUTO_SIZE_MIN_W = 16;
5
- export declare function measureTextShapeFromEditor(textEditor: TiptapEditor, shape: TextShapeRecord, fontCatalog: TextFontCatalog): {
6
+ export declare function measureTextShapeFromEditor(textEditor: TiptapEditor, shape: TextShapeRecord, fontCatalog: TextFontCatalog, labelLayout?: TextLabelLayoutConstraints | null): {
6
7
  w: number;
7
8
  h: number;
8
9
  } | undefined;
9
- export declare function measureTextShapeFromRichText(richText: RichTextDocument, shape: TextShapeRecord, fontCatalog: TextFontCatalog): {
10
+ export declare function measureTextShapeFromRichText(richText: RichTextDocument, shape: TextShapeRecord, fontCatalog: TextFontCatalog, labelLayout?: TextLabelLayoutConstraints | null): {
10
11
  w: number;
11
12
  h: number;
12
13
  } | undefined;
13
14
  export declare function applyTextShapeElementStyles(element: HTMLElement, shape: TextShapeRecord, fontCatalog: TextFontCatalog): void;
15
+ export declare function resolveMeasuredTextShapeSize(shape: TextShapeRecord, measuredSize: {
16
+ w: number;
17
+ h: number;
18
+ }, labelLayout?: TextLabelLayoutConstraints | null): {
19
+ w: number;
20
+ h: number;
21
+ } | undefined;
@@ -1,11 +1,15 @@
1
1
  export { Text, createTextPlugin } from "./feature";
2
- export { createTextEditorPlugin, createTextProductContribution } from "./editorRuntime";
2
+ export { textFontCatalogCapability } from "./capabilities";
3
+ export { textApiToken } from "./api";
4
+ export type { TextApi, TextInput } from "./api";
5
+ export { createTextEditorPlugin } from "./editorRuntime";
6
+ export { createTextProductSetup } from "./productRuntime";
3
7
  export { createTextCanvasRenderPlugin } from "./canvasRender";
4
- export { DEFAULT_TEXT_FONT, HOST_TEXT_FONT, createDefaultTextFontCatalog, createDefaultTextPluginOptions, } from "./textFonts";
8
+ export { DEFAULT_TEXT_FONT, HOST_TEXT_FONT, createDefaultTextFontCatalog, createDefaultTextPluginOptions, createTextFontCatalog, } from "./textFonts";
5
9
  export { createRichTextFromPlainText, getPlainTextFromRichText, validateRichTextDocument, } from "./richTextUtils";
6
10
  export { isTextShapeRecord, updateTextShapeRichText, } from "./textShapeHelpers";
7
11
  export { TextLinkPopoverPresenterProvider, } from "./textLinkPopoverPresentation";
8
12
  export type { TextLinkPopoverPresenter, TextLinkPopoverPresenterProps, } from "./textLinkPopoverPresentation";
9
- export type { TextPluginOptions, TextFontDefinition, TextFontFaceSource, TextFontSource, TextStylesheetFontSource, TextSystemFontSource, } from "./textFonts";
13
+ export type { TextPluginOptions, TextFontDefinition, TextFontCatalog, TextFontFaceSource, TextFontSource, TextStylesheetFontSource, TextSystemFontSource, } from "./textFonts";
10
14
  export type { RichTextDocument, TextShapeAlign, TextShapeFont, TextShapeProps, TextShapeRecord, TextShapeSize, } from "./textTypes";
11
15
  export type { TextFormattingApi, TextFormattingMixed, TextFormattingSnapshot, TextFormattingTarget, TextFormattingValue, TextInlineFormat, TextTiptapEditorChangeHandler, TextTiptapEditorHandle, } from "./textFormatting";
@@ -0,0 +1,55 @@
1
+ import { BindingUtil, type BindingRecord, type BindingRecordBase, type BindingUtilEffect, type BindingSelectionCompanionFrameContext, type Editor, type SelectionOverlayFrameGeometryState, type ShapeLabelPathGeometry, type ShapeRecord, Vec } from "../canvas-core/index";
2
+ import { PATH_LABEL_BINDING_TYPE } from "./textLabelHelpers";
3
+ import type { TextShapeRecord } from "./textTypes";
4
+ export declare const PATH_LABEL_INDEX_SUFFIX = ".label";
5
+ export interface PathLabelBindingProps {
6
+ labelPosition: number;
7
+ }
8
+ export interface PathLabelBindingRecord extends BindingRecordBase<typeof PATH_LABEL_BINDING_TYPE, PathLabelBindingProps> {
9
+ type: typeof PATH_LABEL_BINDING_TYPE;
10
+ props: PathLabelBindingProps;
11
+ }
12
+ export declare function isPathLabelBindingRecord(record: BindingRecord | null | undefined): record is PathLabelBindingRecord;
13
+ export declare class PathLabelBindingUtil extends BindingUtil<PathLabelBindingRecord> {
14
+ readonly type = "path-label";
15
+ getDefaultProps(): PathLabelBindingProps;
16
+ validateProps(props: unknown): PathLabelBindingProps;
17
+ canBind(editor: Editor, binding: PathLabelBindingRecord, context: {
18
+ fromShape: ShapeRecord;
19
+ toShape: ShapeRecord;
20
+ }): boolean;
21
+ canUseShapeHierarchy(_binding: PathLabelBindingRecord, context: {
22
+ fromShape: ShapeRecord;
23
+ toShape: ShapeRecord;
24
+ }, editor?: Editor): boolean;
25
+ getExclusiveBindingKey(binding: PathLabelBindingRecord): string;
26
+ onBindingCreate(editor: Editor, binding: PathLabelBindingRecord): BindingUtilEffect | void;
27
+ onBindingUpdate(editor: Editor, _before: PathLabelBindingRecord, after: PathLabelBindingRecord): BindingUtilEffect | void;
28
+ onBindingLoad(editor: Editor, binding: PathLabelBindingRecord): BindingUtilEffect | void;
29
+ getGeometryDependentShapeIds(_editor: Editor, binding: PathLabelBindingRecord, context: {
30
+ role: "from" | "to";
31
+ }): ShapeRecord["id"][];
32
+ getTargetShapeContentCutoutLocalPolygons(editor: Editor, _binding: PathLabelBindingRecord, context: {
33
+ fromShape: ShapeRecord;
34
+ toShape: ShapeRecord;
35
+ }): readonly (readonly Vec[])[];
36
+ onAfterShapeChange(editor: Editor, binding: PathLabelBindingRecord, _context: {
37
+ role: "from" | "to";
38
+ }): BindingUtilEffect | void;
39
+ onBeforeDeleteShape(_editor: Editor, binding: PathLabelBindingRecord, context: {
40
+ role: "from" | "to";
41
+ }): BindingUtilEffect | void;
42
+ onBeforeDeleteBinding(_editor: Editor, binding: PathLabelBindingRecord): BindingUtilEffect | void;
43
+ getExportShapeIds(_editor: Editor, binding: PathLabelBindingRecord): TextShapeRecord["id"][];
44
+ getShapeHierarchyRootId(binding: PathLabelBindingRecord, shapeId: ShapeRecord["id"]): ShapeRecord["id"] | null;
45
+ getSelectionCompanionFrameGeometries(editor: Editor, binding: PathLabelBindingRecord, context: BindingSelectionCompanionFrameContext): SelectionOverlayFrameGeometryState[];
46
+ private syncLabelPosition;
47
+ }
48
+ export declare function getPathLabelLayout(editor: Editor, label: TextShapeRecord, owner: ShapeRecord, labelPosition?: number): Pick<TextShapeRecord, "x" | "y" | "rotation"> & {
49
+ props: Pick<TextShapeRecord["props"], "w">;
50
+ };
51
+ export declare function getPathLabelOwnerGeometry(editor: Editor, owner: ShapeRecord): ShapeLabelPathGeometry | null;
52
+ export declare function getPathLabelPositionRange(editor: Editor, label: TextShapeRecord, pathGeometry: ShapeLabelPathGeometry): {
53
+ start: number;
54
+ end: number;
55
+ };
@@ -0,0 +1,6 @@
1
+ import { type CanvasPluginSetup } from "../canvas-plugin-sdk/index";
2
+ import { type TextFontCatalog } from "./textFonts";
3
+ export declare function createTextProductSetup({ fontCatalog, selectionFormattingToolbar, }?: {
4
+ fontCatalog?: TextFontCatalog;
5
+ selectionFormattingToolbar?: boolean;
6
+ }): CanvasPluginSetup;
@@ -7,6 +7,7 @@ export type RichTextTextNode = JSONContent & {
7
7
  export type RichTextBlockTextAlign = "left" | "center" | "right";
8
8
  export interface RichTextMarkStyle {
9
9
  color?: string;
10
+ backgroundColor?: string;
10
11
  fontFamily?: string;
11
12
  fontSize?: string;
12
13
  fontWeight?: number;
@@ -19,7 +20,7 @@ export declare function getPlainTextFromRichText(richTextDocument: RichTextDocum
19
20
  export declare function validateRichTextDocument(value: unknown): RichTextDocument;
20
21
  export declare function renderRichTextDocumentToHtml(richText: RichTextDocument): string;
21
22
  export declare function isRichTextTextNode(node: JSONContent): node is RichTextTextNode;
22
- export declare function getRichTextTextNodeStyle(node: RichTextTextNode): string | undefined;
23
+ export declare function getRichTextTextNodeStyle(node: RichTextTextNode, defaultBackgroundColor?: string): string | undefined;
23
24
  export declare function getRichTextBlockTextAlign(node: JSONContent): RichTextBlockTextAlign | undefined;
24
- export declare function getRichTextMarkStyle(marks: JSONContent["marks"]): RichTextMarkStyle | undefined;
25
+ export declare function getRichTextMarkStyle(marks: JSONContent["marks"], defaultBackgroundColor?: string): RichTextMarkStyle | undefined;
25
26
  export declare function getRichTextLinkHref(marks: JSONContent["marks"]): string | undefined;
@@ -2,7 +2,11 @@ import type { RichTextDocument } from "./textTypes";
2
2
  export type ShapeWideTextInlineFormat = "bold" | "italic" | "strike" | "underline";
3
3
  export type ShapeWideTextStyleProperty = "color" | "font" | "size" | "textAlign";
4
4
  export type ShapeWideTextFormatState = boolean | "mixed";
5
+ export type ShapeWideTextBackgroundColorState = string | "mixed" | null;
5
6
  export declare function getShapeWideTextFormatState(richText: RichTextDocument, format: ShapeWideTextInlineFormat): ShapeWideTextFormatState;
6
7
  export declare function setShapeWideTextFormat(richText: RichTextDocument, format: ShapeWideTextInlineFormat, enabled: boolean): RichTextDocument;
8
+ export declare function getShapeWideTextBackgroundColor(richText: RichTextDocument): ShapeWideTextBackgroundColorState;
9
+ export declare function setShapeWideTextBackgroundColor(richText: RichTextDocument, backgroundColor: string | null): RichTextDocument;
10
+ export declare function fillMissingShapeWideTextBackgroundColor(richText: RichTextDocument, backgroundColor: string): RichTextDocument;
7
11
  export declare function clearShapeWideTextStyleOverride(richText: RichTextDocument, property: ShapeWideTextStyleProperty): RichTextDocument;
8
12
  export declare function clearShapeWideTextFormatting(richText: RichTextDocument): RichTextDocument;
@@ -13,6 +13,7 @@ export interface TextFormattingSnapshot {
13
13
  strike: boolean | TextFormattingMixed;
14
14
  underline: boolean | TextFormattingMixed;
15
15
  color: TextFormattingValue<string>;
16
+ backgroundColor: TextFormattingValue<string>;
16
17
  font: TextFormattingValue<TextShapeFont>;
17
18
  size: TextFormattingValue<TextShapeSize>;
18
19
  textAlign: TextFormattingValue<TextShapeAlign>;
@@ -26,6 +27,7 @@ export interface TextFormattingApi {
26
27
  focus(): void;
27
28
  toggle(format: TextInlineFormat): boolean;
28
29
  setColor(color: string | null): boolean;
30
+ setBackgroundColor(color: string | null): boolean;
29
31
  setFont(font: TextShapeFont | null): boolean;
30
32
  setSize(size: TextShapeSize | null): boolean;
31
33
  setTextAlign(align: TextShapeAlign): boolean;
@@ -1,11 +1,20 @@
1
1
  import { type Editor, type ShapeId, type ShapeParentId, type ShapeRecord, type ShapeTransformFields } from "../canvas-core/index";
2
2
  import type { TextShapeProps, TextShapeRecord } from "./textTypes";
3
- export declare const ARROW_LABEL_BINDING_TYPE = "arrow-label";
3
+ export declare const PATH_LABEL_BINDING_TYPE = "path-label";
4
4
  export declare const GEO_LABEL_BINDING_TYPE = "geo-label";
5
- export type TextLabelBindingType = typeof ARROW_LABEL_BINDING_TYPE | typeof GEO_LABEL_BINDING_TYPE;
5
+ export declare const PATH_LABEL_MAX_WIDTH = 120;
6
+ export declare const PATH_LABEL_MIN_WIDTH = 24;
7
+ export declare const PATH_LABEL_PADDING = 4.25;
8
+ export declare const GEO_LABEL_MIN_WIDTH = 16;
9
+ export declare const GEO_LABEL_PADDING = 16;
10
+ export type TextLabelBindingType = typeof PATH_LABEL_BINDING_TYPE | typeof GEO_LABEL_BINDING_TYPE;
6
11
  export interface TextLabelBehavior {
7
12
  selectionTarget: "label" | "owner";
13
+ hoverTarget: "label" | "owner";
14
+ hoverDecorationTarget: "label" | "owner";
8
15
  translateTarget: "label" | "owner";
16
+ canSnap: boolean;
17
+ canReceiveTerminalBinding: boolean;
9
18
  contributesToSelectionFrame: boolean;
10
19
  canUseSelectionResizeHandles: boolean;
11
20
  canUseSelectionRotateHandle: boolean;
@@ -18,6 +27,12 @@ export interface TextLabelTargetInfo {
18
27
  bindingType: TextLabelBindingType;
19
28
  behavior: TextLabelBehavior;
20
29
  }
30
+ export interface TextLabelLayoutConstraints {
31
+ minWidth: number;
32
+ maxWidth: number;
33
+ paddingInline: number;
34
+ }
35
+ export declare function getTextLabelPaddingInline(constraints: TextLabelLayoutConstraints | null, width: number): number;
21
36
  export interface TextLabelCreateOptions {
22
37
  bindingType: TextLabelBindingType;
23
38
  owner: ShapeRecord;
@@ -34,9 +49,15 @@ export declare function getTextLabelParentLocalTransform(editor: Editor, label:
34
49
  export declare function getTextLabelShapeForOwner(editor: Editor, ownerId: ShapeId, bindingType: TextLabelBindingType): TextShapeRecord | null;
35
50
  export declare function createBoundTextLabelShape(editor: Editor, options: TextLabelCreateOptions): TextShapeRecord | null;
36
51
  export declare function getTextLabelTargetInfo(editor: Editor, shapeId: ShapeId): TextLabelTargetInfo | null;
52
+ export declare function getTextLabelLayoutConstraintsForOwner(editor: Editor, label: TextShapeRecord, owner: ShapeRecord, bindingType: TextLabelBindingType): TextLabelLayoutConstraints;
53
+ export declare function getTextLabelLayoutConstraints(editor: Editor, label: TextShapeRecord): TextLabelLayoutConstraints | null;
37
54
  export declare function getTextLabelBehavior(bindingType: TextLabelBindingType): TextLabelBehavior;
38
55
  export declare function getTextLabelSelectionTargetId(editor: Editor, shapeId: ShapeId): ShapeId | null;
56
+ export declare function getTextLabelHoverTargetId(editor: Editor, shapeId: ShapeId): ShapeId | null;
57
+ export declare function getTextLabelHoverDecorationTargetId(editor: Editor, shapeId: ShapeId): ShapeId | null;
39
58
  export declare function getTextLabelTranslateTargetId(editor: Editor, shapeId: ShapeId): ShapeId | null;
59
+ export declare function textLabelCanReceiveTerminalBinding(editor: Editor, shapeId: ShapeId): boolean | null;
60
+ export declare function textLabelCanSnap(editor: Editor, shapeId: ShapeId): boolean | null;
40
61
  export declare function textLabelContributesToSelectionFrame(editor: Editor, shapeId: ShapeId): boolean | null;
41
62
  export declare function textLabelCanUseSelectionResizeHandles(editor: Editor, shapeId: ShapeId): boolean | null;
42
63
  export declare function textLabelCanUseSelectionRotateHandle(editor: Editor, shapeId: ShapeId): boolean | null;
@@ -1,4 +1,4 @@
1
- import { Box, ShapeUtil, type ShapeId, type ShapeEditEndResult, type ShapeSelectionFrameInput, type ShapeSelectionResizeInput, type ShapeSelectionResizeModesInput, type ShapeSelectionTranslateInput, type ShapeUpdate } from "../canvas-core/index";
1
+ import { Box, ShapeUtil, type ShapeId, type ShapeEditEndResult, type ShapeGeometryInput, type ShapeHoverTargetInput, type ShapeSelectionFrameInput, type ShapeSelectionResizeInput, type ShapeSelectionResizeModesInput, type ShapeSelectionTranslateInput, type ShapeUpdate } from "../canvas-core/index";
2
2
  import { type TextShapeProps, type TextShapeRecord } from "./textTypes";
3
3
  export declare class TextShapeUtil extends ShapeUtil<TextShapeRecord> {
4
4
  readonly type: "text";
@@ -8,12 +8,15 @@ export declare class TextShapeUtil extends ShapeUtil<TextShapeRecord> {
8
8
  getLocalBounds(shape: TextShapeRecord): Box;
9
9
  getRenderBounds(shape: TextShapeRecord): Box;
10
10
  getExportBounds(shape: TextShapeRecord): Box;
11
- canReceiveTerminalBinding(_shape: TextShapeRecord): boolean;
11
+ canSnap(shape: TextShapeRecord, input?: ShapeGeometryInput): boolean;
12
+ canReceiveTerminalBinding(shape: TextShapeRecord, input?: ShapeGeometryInput): boolean;
12
13
  canEdit(_shape: TextShapeRecord): boolean;
13
14
  contributesToSelectionFrame(shape: TextShapeRecord, input: ShapeSelectionFrameInput): boolean;
14
15
  canUseSelectionResizeHandles(shape: TextShapeRecord, input: ShapeSelectionFrameInput): boolean;
15
16
  canUseSelectionRotateHandle(shape: TextShapeRecord, input: ShapeSelectionFrameInput): boolean;
16
17
  getSelectionTargetId(shape: TextShapeRecord, input: ShapeSelectionFrameInput): ShapeId;
18
+ getHoverTargetId(shape: TextShapeRecord, input: ShapeHoverTargetInput): ShapeId;
19
+ getHoverDecorationTargetId(shape: TextShapeRecord, input: ShapeHoverTargetInput): ShapeId;
17
20
  getTranslateTargetId(shape: TextShapeRecord, input: ShapeSelectionTranslateInput): ShapeId;
18
21
  resizeSelectionBounds(shape: TextShapeRecord, input: ShapeSelectionResizeInput): ShapeUpdate;
19
22
  getAllowedSelectionResizeModes(_shape: TextShapeRecord, input: ShapeSelectionResizeModesInput): readonly ["free"] | readonly ["aspect_ratio_locked"];
@@ -20,6 +20,7 @@ export interface TextShapeProps {
20
20
  font: TextShapeFont;
21
21
  size: TextShapeSize;
22
22
  color: ShapeColor;
23
+ backgroundColor: ShapeColor;
23
24
  textAlign: TextShapeAlign;
24
25
  }
25
26
  export interface TextShapeRecord extends ShapeRecordBase<"text", TextShapeProps> {
@@ -7,6 +7,7 @@ interface Transaction {
7
7
  export declare function getCurrentTransaction(): Transaction | null;
8
8
  export declare function transact(fn: () => void): void;
9
9
  export declare function noteInitialValue(atom: _Atom<any>, previousValue: any): void;
10
+ export declare function isComputingSignal(): boolean;
10
11
  export declare function startCapture(child: Child): void;
11
12
  export declare function stopCapture(): Set<Signal<any>>;
12
13
  export declare function maybeCaptureParent(parent: Signal<any>): void;
@@ -4,6 +4,6 @@ export { computed, isComputed, UNINITIALIZED } from "./computed";
4
4
  export type { Computed } from "./computed";
5
5
  export { effect, EffectScheduler } from "./effect";
6
6
  export type { EffectSchedulerOptions } from "./effect";
7
- export { transact, getGlobalEpoch } from "./core";
7
+ export { transact, getGlobalEpoch, isComputingSignal, } from "./core";
8
8
  export { RESET_VALUE } from "./types";
9
9
  export type { Signal, Child } from "./types";
@@ -27,7 +27,7 @@ export declare class StoreHistoryBuffer<TRecord extends StoreRecord = StoreRecor
27
27
  readonly state: Signal<StoreHistoryState>;
28
28
  clear(): void;
29
29
  mark(id: string): void;
30
- append(diff: RecordsDiff<TRecord>): void;
30
+ append(diff: RecordsDiff<TRecord>, label?: string): void;
31
31
  bailToMark(id: string): RecordsDiff<TRecord> | null;
32
32
  squashToMark(id: string, label?: string): StoreHistoryEntry<TRecord> | null;
33
33
  undo(): StoreHistoryEntry<TRecord> | null;
@@ -12,6 +12,8 @@ export declare class Store<TRecord extends StoreRecord = StoreRecord> {
12
12
  private pendingSource;
13
13
  constructor(initialRecords: TRecord[]);
14
14
  get(id: string): TRecord | undefined;
15
+ getActiveAtomicOperationRevision(): number | null;
16
+ getActiveAtomicOperationSnapshot(): TRecord[];
15
17
  /**
16
18
  * Per-record reactive read that still respects draft records during atomic
17
19
  * mutations. Use this inside computed values instead of wrapping `get(id)`.
@@ -1,10 +1,10 @@
1
- export declare const LAND_DOCUMENT_INDEXEDDB_NAME = "land.canvas.persistence";
2
- export declare const LAND_DOCUMENT_INDEXEDDB_STORE = "snapshots";
3
- export declare const LAND_IMAGE_BLOB_INDEXEDDB_STORE = "imageBlobs";
4
- export declare const LAND_DOCUMENT_INDEXEDDB_VERSION = 2;
5
- export declare function openLandCanvasDatabase(): Promise<IDBDatabase | null>;
6
- export declare function readLandCanvasStoreValue(storeName: string, key: IDBValidKey): Promise<unknown | null>;
7
- export declare function readLandCanvasStoreValues(storeName: string, keys: readonly IDBValidKey[]): Promise<readonly unknown[] | null>;
8
- export declare function writeLandCanvasStoreValues(storeName: string, entries: readonly (readonly [IDBValidKey, unknown])[]): Promise<void>;
9
- export declare function deleteLandCanvasStoreValue(storeName: string, key: IDBValidKey): Promise<void>;
10
- export declare function getAllLandCanvasStoreKeys(storeName: string): Promise<IDBValidKey[] | null>;
1
+ export declare const CANVAS_KIT_INDEXEDDB_NAME = "canvas-kit.persistence";
2
+ export declare const CANVAS_KIT_SNAPSHOT_STORE = "snapshots";
3
+ export declare const CANVAS_KIT_IMAGE_BLOB_STORE = "imageBlobs";
4
+ export declare const CANVAS_KIT_INDEXEDDB_VERSION = 2;
5
+ export declare function openCanvasKitDatabase(): Promise<IDBDatabase | null>;
6
+ export declare function readCanvasKitStoreValue(storeName: string, key: IDBValidKey): Promise<unknown | null>;
7
+ export declare function readCanvasKitStoreValues(storeName: string, keys: readonly IDBValidKey[]): Promise<readonly unknown[] | null>;
8
+ export declare function writeCanvasKitStoreValues(storeName: string, entries: readonly (readonly [IDBValidKey, unknown])[]): Promise<void>;
9
+ export declare function deleteCanvasKitStoreValue(storeName: string, key: IDBValidKey): Promise<void>;
10
+ export declare function getAllCanvasKitStoreKeys(storeName: string): Promise<IDBValidKey[] | null>;
@@ -1,33 +1,12 @@
1
- import type { Editor } from "../_vendor/canvas-core/index";
2
1
  import type { ProductPersistenceAdapter, ProductPersistenceLoadResult } from "../core/runtime/runtimeContracts";
3
- import { LAND_DOCUMENT_INDEXEDDB_NAME, LAND_DOCUMENT_INDEXEDDB_STORE, LAND_DOCUMENT_INDEXEDDB_VERSION, LAND_IMAGE_BLOB_INDEXEDDB_STORE } from "./indexedDb";
4
- export declare const LAND_DOCUMENT_STORAGE_KEY = "land.canvas.document";
5
- export declare const LAND_SESSION_STORAGE_KEY = "land.canvas.session";
6
- export { LAND_DOCUMENT_INDEXEDDB_NAME, LAND_DOCUMENT_INDEXEDDB_STORE, LAND_DOCUMENT_INDEXEDDB_VERSION, LAND_IMAGE_BLOB_INDEXEDDB_STORE, };
2
+ import { CANVAS_KIT_IMAGE_BLOB_STORE, CANVAS_KIT_INDEXEDDB_NAME, CANVAS_KIT_INDEXEDDB_VERSION, CANVAS_KIT_SNAPSHOT_STORE } from "./indexedDb";
3
+ export declare const CANVAS_KIT_DOCUMENT_STORAGE_KEY = "canvas-kit.document";
4
+ export declare const CANVAS_KIT_SESSION_STORAGE_KEY = "canvas-kit.session";
5
+ export { CANVAS_KIT_IMAGE_BLOB_STORE, CANVAS_KIT_INDEXEDDB_NAME, CANVAS_KIT_INDEXEDDB_VERSION, CANVAS_KIT_SNAPSHOT_STORE, };
7
6
  export interface LocalSnapshotPersistenceOptions {
8
7
  storageNamespace?: string;
9
8
  }
10
9
  export declare function createLocalSnapshotPersistence(options?: LocalSnapshotPersistenceOptions): ProductPersistenceAdapter;
11
- export declare class PersistenceManager {
12
- private readonly editor;
13
- private static readonly SAVE_DELAY_MS;
14
- private readonly options;
15
- private unsubscribe;
16
- private saveTimeoutId;
17
- private hasPendingSave;
18
- private isSaving;
19
- private saveAgainAfterCurrentSave;
20
- constructor(editor: Editor, options?: LocalSnapshotPersistenceOptions);
21
- start(): void;
22
- stop(): void;
23
- flush(): void;
24
- private save;
25
- private scheduleSave;
26
- private cancelScheduledSave;
27
- private readonly flushWhenHidden;
28
- private readonly flushWhenPageIsLeaving;
29
- }
30
- export declare function persistEditorSnapshot(editor: Editor, options?: LocalSnapshotPersistenceOptions): Promise<void>;
31
10
  export declare function readPersistedEditorSnapshots(options?: LocalSnapshotPersistenceOptions): Promise<ProductPersistenceLoadResult>;
32
11
  export declare function readPersistedDocumentSnapshot(): Promise<unknown | null>;
33
12
  export declare function readPersistedSessionSnapshot(): Promise<unknown | null>;
@@ -6,6 +6,6 @@ export declare function useCanvasKitFloatingPosition({ editor, fallbackPlacement
6
6
  fallbackPlacements: readonly Placement[];
7
7
  floatingRef: RefObject<HTMLElement | null>;
8
8
  getReferenceElement(): ReferenceElement | null;
9
- offset: number;
9
+ offset?: number;
10
10
  placement: Placement;
11
11
  }): void;
@@ -1,9 +1,11 @@
1
1
  import { type ReactNode } from "react";
2
- import type { ToolbarSurfaces } from "./useToolbarSurfaces";
3
- export declare function FloatingSelectionToolbarPageSpace({ children, className, dataUi, offset, surfaces, }: {
2
+ import { type CanvasActionContext } from "../../_vendor/canvas-product-contracts/index";
3
+ export declare function FloatingSelectionToolbarPageSpace({ children, className, context, dataUi, horizontalAlign, offset, visible, }: {
4
4
  children: ReactNode;
5
5
  className?: string;
6
+ context: CanvasActionContext;
6
7
  dataUi?: string;
8
+ horizontalAlign?: "center" | "start";
7
9
  offset?: number;
8
- surfaces: ToolbarSurfaces;
10
+ visible?: boolean;
9
11
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,8 @@
1
+ import { type ToolbarGroup } from "../../_vendor/canvas-product-contracts/index";
2
+ export interface ToolbarGroupSource {
3
+ groups: readonly ToolbarGroup[];
4
+ groupIdPrefix?: string;
5
+ }
6
+ export declare function mergeToolbarGroups(sources: readonly ToolbarGroupSource[], options?: {
7
+ dedupeActionIdsAcrossSources?: boolean;
8
+ }): ToolbarGroup[];
@@ -1,4 +1,4 @@
1
- import { type ToolbarGroup } from "../../_vendor/canvas-plugin-sdk/index";
1
+ import { type ToolbarGroup } from "../../_vendor/canvas-product-contracts/index";
2
2
  export declare function getActiveToolLabel(groups: readonly ToolbarGroup[], activeToolId: string): string;
3
3
  export declare function getSelectionToolbarTitle({ commonShapeType, count, isMixedFrameAndPointHandleSelection, singleShapeType, }: {
4
4
  commonShapeType: string | null;