@yuzhouu/canvas-kit 0.1.11 → 0.1.13

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 (229) hide show
  1. package/README.md +47 -13
  2. package/_vendor/canvas-core/bindings/bindingUtil.d.ts +1 -0
  3. package/_vendor/canvas-core/editor/clipboard.d.ts +1 -1
  4. package/_vendor/canvas-core/editor/commands.d.ts +0 -2
  5. package/_vendor/canvas-core/editor/managers/bindingManager.d.ts +4 -0
  6. package/_vendor/canvas-core/editor/queries/shapeTransforms.d.ts +3 -4
  7. package/_vendor/canvas-core/editor/resizeGeometry.d.ts +20 -0
  8. package/_vendor/canvas-core/editor/selectionResizeCapabilities.d.ts +2 -0
  9. package/_vendor/canvas-core/geometry/mat.d.ts +2 -3
  10. package/_vendor/canvas-core/index.d.ts +4 -2
  11. package/_vendor/canvas-core/schema/records.d.ts +0 -1
  12. package/_vendor/canvas-core/schema/snapshots.d.ts +2 -2
  13. package/_vendor/canvas-core/shapes/childTransformPolicy.d.ts +16 -0
  14. package/_vendor/canvas-core/shapes/shapeUtil.d.ts +3 -3
  15. package/_vendor/canvas-plugin-sdk/capability.d.ts +0 -6
  16. package/_vendor/canvas-plugin-sdk/index.d.ts +1 -16
  17. package/_vendor/canvas-plugin-sdk/plugin.d.ts +5 -52
  18. package/_vendor/canvas-plugin-sdk/setupExtension.d.ts +5 -0
  19. package/_vendor/canvas-product-contracts/actionRegistry.d.ts +4 -0
  20. package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/actions.d.ts +10 -16
  21. package/_vendor/canvas-product-contracts/capability.d.ts +8 -0
  22. package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/chrome.d.ts +1 -0
  23. package/_vendor/canvas-product-contracts/chromeRegistry.d.ts +9 -0
  24. package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/contextMenu.d.ts +4 -0
  25. package/_vendor/canvas-product-contracts/contextMenuRegistry.d.ts +4 -0
  26. package/_vendor/canvas-product-contracts/exportRegistry.d.ts +6 -0
  27. package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/exports.d.ts +1 -0
  28. package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/importRegistry.d.ts +1 -4
  29. package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/imports.d.ts +1 -0
  30. package/_vendor/canvas-product-contracts/index.d.ts +15 -0
  31. package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/productApi.d.ts +6 -5
  32. package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/services.d.ts +2 -1
  33. package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/toolbar.d.ts +3 -6
  34. package/_vendor/canvas-product-contracts/toolbarRegistry.d.ts +9 -0
  35. package/_vendor/plugin-arrow/api.d.ts +2 -2
  36. package/_vendor/plugin-frame/api.d.ts +2 -2
  37. package/_vendor/plugin-geo/api.d.ts +2 -2
  38. package/_vendor/plugin-group/groupContributions.d.ts +1 -1
  39. package/_vendor/plugin-group/productRuntime.d.ts +1 -1
  40. package/_vendor/plugin-image/cropRuntime.d.ts +1 -1
  41. package/_vendor/plugin-image/imageHostActionContract.d.ts +1 -1
  42. package/_vendor/plugin-image/productRuntime.d.ts +1 -1
  43. package/_vendor/plugin-image/runtimeShared.d.ts +1 -1
  44. package/_vendor/plugin-image/smudgeRuntime.d.ts +1 -1
  45. package/_vendor/plugin-image/styleRuntime.d.ts +1 -1
  46. package/_vendor/plugin-image/toolbarRuntime.d.ts +1 -1
  47. package/_vendor/plugin-runtime-clipboard/capability.d.ts +1 -0
  48. package/_vendor/{plugin-builtin-clipboard/clipboardContribution.d.ts → plugin-runtime-clipboard/clipboardActions.d.ts} +1 -6
  49. package/_vendor/{plugin-builtin-clipboard → plugin-runtime-clipboard}/clipboardService.d.ts +2 -2
  50. package/_vendor/plugin-runtime-clipboard/index.d.ts +4 -0
  51. package/_vendor/plugin-runtime-clipboard/plugin.d.ts +1 -0
  52. package/_vendor/{plugin-builtin-export → plugin-runtime-export}/canvasExportApi.d.ts +2 -2
  53. package/_vendor/{plugin-builtin-export → plugin-runtime-export}/index.d.ts +1 -1
  54. package/_vendor/{plugin-builtin-export → plugin-runtime-export}/plugin.d.ts +1 -1
  55. package/_vendor/plugin-text/api.d.ts +2 -2
  56. package/_vendor/plugin-text/feature.d.ts +1 -1
  57. package/_vendor/plugin-text/textShapeHelpers.d.ts +0 -1
  58. package/browser/persistence.d.ts +1 -1
  59. package/canvasKitTools.d.ts +3 -0
  60. package/chrome/contextMenuRuntime.d.ts +7 -0
  61. package/chrome/toolbar/FloatingSelectionToolbarPageSpace.d.ts +1 -1
  62. package/chrome/toolbar/mergeToolbarGroups.d.ts +8 -0
  63. package/chrome/toolbar/toolbarLabels.d.ts +1 -1
  64. package/chrome/toolbar/useToolbarSurfaces.d.ts +1 -1
  65. package/chrome/types.d.ts +7 -8
  66. package/chrome/useCanvasKitChromeContext.d.ts +7 -7
  67. package/chrome/useCanvasKitLayerTree.d.ts +3 -2
  68. package/chrome/useChromeSurfaces.d.ts +1 -1
  69. package/chrome/useContextMenuSurface.d.ts +1 -1
  70. package/chrome/useHistoryControls.d.ts +3 -3
  71. package/chrome/usePageControls.d.ts +8 -8
  72. package/chrome/useZoomControls.d.ts +5 -1
  73. package/commands/command.d.ts +11 -0
  74. package/commands/commandTokens.d.ts +61 -0
  75. package/commands/documentCommands.d.ts +2 -0
  76. package/commands/historyCommands.d.ts +3 -0
  77. package/commands/index.d.ts +11 -0
  78. package/commands/layerCommands.d.ts +20 -0
  79. package/commands/pageCommands.d.ts +12 -0
  80. package/commands/selectionCommands.d.ts +12 -0
  81. package/commands/shapeCommands.d.ts +8 -0
  82. package/commands/toolCommands.d.ts +2 -0
  83. package/commands/viewCommands.d.ts +10 -0
  84. package/contracts/canvasProductControllerContracts.d.ts +32 -0
  85. package/{core/product-controller → controller}/canvasProductController.d.ts +27 -55
  86. package/controller/index.d.ts +3 -0
  87. package/{core/product-controller/productLayerTree.d.ts → controller/layerTree.d.ts} +1 -1
  88. package/index.d.ts +31 -27
  89. package/index.mjs +88 -111
  90. package/package.json +2 -2
  91. package/plugins/host/image/api/imageHostApi.d.ts +11 -0
  92. package/plugins/host/image/api/imageHostApiContract.d.ts +60 -0
  93. package/{features → plugins/host}/image/asset/imageAssetService.d.ts +3 -2
  94. package/{features → plugins/host}/image/asset/imageBlobStore.d.ts +2 -2
  95. package/{features → plugins/host}/image/asset/imageFileHelpers.d.ts +1 -1
  96. package/{features → plugins/host}/image/asset/svgImageAssetInliner.d.ts +1 -1
  97. package/{features → plugins/host}/image/import/ImageImportController.d.ts +2 -2
  98. package/{features → plugins/host}/image/index.d.ts +4 -4
  99. package/plugins/host/image/plugin.d.ts +1 -0
  100. package/{features → plugins/host}/image/smudge/imageSmudgeHostActions.d.ts +3 -3
  101. package/{features → plugins/host}/image/toolbar/imageHostActions.d.ts +8 -24
  102. package/{features → plugins/host}/image/toolbar/imageToolbarHostBridge.d.ts +2 -2
  103. package/{features → plugins/host}/text/link/TextLinkHoverPopover.d.ts +1 -1
  104. package/plugins/host/text/textHostPlugin.d.ts +5 -0
  105. package/plugins/host/text/textSvgAssetInliner.d.ts +3 -0
  106. package/plugins/host/text/textSvgAssetPlugin.d.ts +2 -0
  107. package/{_vendor/plugin-builtin-import-host → plugins/runtime/import-host}/CanvasImportHost.d.ts +2 -1
  108. package/plugins/runtime/import-host/capability.d.ts +1 -0
  109. package/plugins/runtime/import-host/plugin.d.ts +1 -0
  110. package/plugins/runtime/keyboard-shortcuts/index.d.ts +1 -0
  111. package/plugins/runtime/keyboard-shortcuts/plugin.d.ts +1 -0
  112. package/plugins/runtime/keyboard-shortcuts/useCanvasKeyboardShortcuts.d.ts +6 -0
  113. package/plugins/runtime/tool-actions/capability.d.ts +1 -0
  114. package/{_vendor/plugin-builtin-tool-actions → plugins/runtime/tool-actions}/index.d.ts +1 -1
  115. package/plugins/runtime/tool-actions/plugin.d.ts +1 -0
  116. package/plugins/runtime/tool-actions/toolActions.d.ts +2 -0
  117. package/plugins/standard/clipboard/chrome.d.ts +2 -0
  118. package/plugins/standard/clipboard/contextMenu.d.ts +2 -0
  119. package/plugins/standard/clipboard/plugin.d.ts +1 -0
  120. package/plugins/standard/clipboard/shortcuts.d.ts +5 -0
  121. package/plugins/{standardCanvasKitPlugins.d.ts → standard/createStandardCanvasKitPlugins.d.ts} +2 -3
  122. package/plugins/standard/selection/actions.d.ts +21 -0
  123. package/plugins/standard/selection/chrome.d.ts +2 -0
  124. package/plugins/standard/selection/contextMenu.d.ts +2 -0
  125. package/plugins/standard/selection/plugin.d.ts +1 -0
  126. package/plugins/standard/selection/toolbar.d.ts +2 -0
  127. package/plugins/standard/tool-ui/contextMenu.d.ts +2 -0
  128. package/plugins/standard/tool-ui/plugin.d.ts +1 -0
  129. package/plugins/standard/tool-ui/toolbar.d.ts +2 -0
  130. package/plugins/standard/view/actions.d.ts +5 -0
  131. package/plugins/standard/view/chrome.d.ts +2 -0
  132. package/plugins/standard/view/contextMenu.d.ts +2 -0
  133. package/plugins/standard/view/plugin.d.ts +1 -0
  134. package/react/CanvasKitRoot.d.ts +3 -2
  135. package/react/useCanvasProductControllerLifecycle.d.ts +9 -0
  136. package/runtime/canvasKitActionContext.d.ts +17 -0
  137. package/runtime/canvasKitActionExecutor.d.ts +12 -0
  138. package/runtime/canvasKitCommandExecutor.d.ts +12 -3
  139. package/runtime/canvasKitPluginContracts.d.ts +13 -19
  140. package/{_vendor/canvas-plugin-sdk/lifecycle.d.ts → runtime/canvasKitPluginLifecycle.d.ts} +6 -5
  141. package/runtime/canvasKitPluginSetup.d.ts +9 -6
  142. package/{_vendor/canvas-plugin-sdk/pluginUi.d.ts → runtime/canvasKitPluginUi.d.ts} +5 -5
  143. package/runtime/canvasKitRuntime.d.ts +14 -5
  144. package/runtime/canvasKitRuntimeContracts.d.ts +8 -7
  145. package/runtime/canvasPluginGraph.d.ts +15 -0
  146. package/runtime/createCanvasKitCommandAction.d.ts +10 -0
  147. package/runtime/createCanvasKitEditor.d.ts +7 -0
  148. package/{core/runtime/runtimeContracts.d.ts → runtime/persistenceContracts.d.ts} +1 -6
  149. package/runtime/persistenceCoordinator.d.ts +1 -1
  150. package/{core/runtime/productAssets.d.ts → runtime/productAssetResolvers.d.ts} +11 -2
  151. package/runtime/productServiceRegistry.d.ts +8 -0
  152. package/runtime/registries/actionRegistry.d.ts +5 -0
  153. package/runtime/registries/chromeRegistry.d.ts +2 -0
  154. package/runtime/registries/contextMenuRegistry.d.ts +5 -0
  155. package/runtime/registries/exportRegistry.d.ts +2 -0
  156. package/runtime/registries/importRegistry.d.ts +2 -0
  157. package/runtime/registries/index.d.ts +7 -0
  158. package/runtime/registries/productApiRegistry.d.ts +5 -0
  159. package/runtime/registries/toolbarRegistry.d.ts +5 -0
  160. package/_vendor/canvas-plugin-sdk/actionRegistry.d.ts +0 -7
  161. package/_vendor/canvas-plugin-sdk/chromeRegistry.d.ts +0 -15
  162. package/_vendor/canvas-plugin-sdk/contextMenuRegistry.d.ts +0 -11
  163. package/_vendor/canvas-plugin-sdk/exportRegistry.d.ts +0 -9
  164. package/_vendor/canvas-plugin-sdk/toolbarRegistry.d.ts +0 -18
  165. package/_vendor/plugin-builtin-clipboard/clipboardChromeContributions.d.ts +0 -2
  166. package/_vendor/plugin-builtin-clipboard/clipboardContextMenuContributions.d.ts +0 -2
  167. package/_vendor/plugin-builtin-clipboard/index.d.ts +0 -3
  168. package/_vendor/plugin-builtin-clipboard/plugin.d.ts +0 -1
  169. package/_vendor/plugin-builtin-import-host/capability.d.ts +0 -1
  170. package/_vendor/plugin-builtin-import-host/plugin.d.ts +0 -1
  171. package/_vendor/plugin-builtin-tool-actions/capability.d.ts +0 -1
  172. package/_vendor/plugin-builtin-tool-actions/plugin.d.ts +0 -1
  173. package/_vendor/plugin-builtin-tool-actions/toolActions.d.ts +0 -2
  174. package/_vendor/plugin-connector/canvasRender.d.ts +0 -2
  175. package/_vendor/plugin-connector/connectorBindingUtil.d.ts +0 -28
  176. package/_vendor/plugin-connector/connectorBindings.d.ts +0 -8
  177. package/_vendor/plugin-connector/connectorGeometry.d.ts +0 -70
  178. package/_vendor/plugin-connector/connectorHandles.d.ts +0 -12
  179. package/_vendor/plugin-connector/connectorInteractions.d.ts +0 -3
  180. package/_vendor/plugin-connector/connectorMarker.d.ts +0 -7
  181. package/_vendor/plugin-connector/connectorModel.d.ts +0 -43
  182. package/_vendor/plugin-connector/connectorPortInteraction.d.ts +0 -13
  183. package/_vendor/plugin-connector/connectorPorts.d.ts +0 -23
  184. package/_vendor/plugin-connector/connectorRuntime.d.ts +0 -62
  185. package/_vendor/plugin-connector/connectorShapeUtil.d.ts +0 -29
  186. package/_vendor/plugin-connector/connectorTool.d.ts +0 -4
  187. package/_vendor/plugin-connector/constants.d.ts +0 -17
  188. package/_vendor/plugin-connector/editorRuntime.d.ts +0 -7
  189. package/_vendor/plugin-connector/feature.d.ts +0 -4
  190. package/_vendor/plugin-connector/index.d.ts +0 -18
  191. package/_vendor/plugin-connector/orthogonalRoute.d.ts +0 -9
  192. package/_vendor/plugin-connector/productRuntime.d.ts +0 -2
  193. package/_vendor/plugin-connector/quickConnect.d.ts +0 -28
  194. package/_vendor/plugin-connector/types.d.ts +0 -51
  195. package/_vendor/plugin-packaging/api.d.ts +0 -74
  196. package/_vendor/plugin-packaging/canvasRender.d.ts +0 -2
  197. package/_vendor/plugin-packaging/editorRuntime.d.ts +0 -2
  198. package/_vendor/plugin-packaging/feature.d.ts +0 -2
  199. package/_vendor/plugin-packaging/index.d.ts +0 -19
  200. package/_vendor/plugin-packaging/packagingArtwork.d.ts +0 -5
  201. package/_vendor/plugin-packaging/packagingDxf.d.ts +0 -9
  202. package/_vendor/plugin-packaging/packagingGeometry.d.ts +0 -74
  203. package/_vendor/plugin-packaging/packagingInteractions.d.ts +0 -2
  204. package/_vendor/plugin-packaging/packagingPdfExporter.d.ts +0 -25
  205. package/_vendor/plugin-packaging/packagingRuntime.d.ts +0 -11
  206. package/_vendor/plugin-packaging/packagingShapeUtil.d.ts +0 -34
  207. package/_vendor/plugin-packaging/packagingStyle.d.ts +0 -10
  208. package/_vendor/plugin-packaging/packagingSvgExporter.d.ts +0 -7
  209. package/_vendor/plugin-packaging/productRuntime.d.ts +0 -2
  210. package/_vendor/plugin-packaging/types.d.ts +0 -168
  211. package/_vendor/plugin-packaging/validation.d.ts +0 -3
  212. package/controller/canvasKitController.d.ts +0 -28
  213. package/core/index.d.ts +0 -7
  214. package/core/product-controller/index.d.ts +0 -2
  215. package/core/runtime/productEditor.d.ts +0 -3
  216. package/core/runtime/productServices.d.ts +0 -20
  217. package/es-DocrZgUh.mjs +0 -2
  218. package/features/context-menu/contextMenuRuntime.d.ts +0 -13
  219. package/features/image/controller/imageProductController.d.ts +0 -27
  220. package/features/image/imageHostPlugin.d.ts +0 -1
  221. package/features/image/smudge/imageSmudgeTypes.d.ts +0 -25
  222. package/features/text/textHostPlugin.d.ts +0 -5
  223. package/features/text/textSvgAssetInliner.d.ts +0 -3
  224. package/features/text/textSvgAssetPlugin.d.ts +0 -2
  225. package/react/useCanvasKitControllerLifecycle.d.ts +0 -8
  226. /package/_vendor/{plugin-builtin-export → plugin-runtime-export}/blobDataUrl.d.ts +0 -0
  227. /package/_vendor/{plugin-builtin-export → plugin-runtime-export}/pngExport.d.ts +0 -0
  228. /package/_vendor/{plugin-builtin-export → plugin-runtime-export}/svgExport.d.ts +0 -0
  229. /package/{_vendor/plugin-builtin-import-host → plugins/runtime/import-host}/index.d.ts +0 -0
package/README.md CHANGED
@@ -81,12 +81,18 @@ belong on `CanvasKitRoot`. Export appearance is supplied to each export request;
81
81
  it is not stored on the Root or Runtime.
82
82
 
83
83
  `plugins` is the complete caller-supplied plugin graph. Before compiling it,
84
- CanvasKit adds a built-in default provider for generic tool actions or the
85
- export API only when the graph does not already provide the corresponding
86
- capability token. A plugin that provides `canvasToolActionsCapability` or
87
- `canvasExportApiToken` therefore replaces that built-in implementation.
88
- Built-in defaults and caller plugins use the same `CanvasPlugin` contract and
89
- compile into one dependency graph.
84
+ CanvasKit adds Runtime default providers for clipboard behavior, import host,
85
+ generic tool actions, and the export API only when the graph does not already
86
+ provide the corresponding capability token. A plugin that provides
87
+ `canvasClipboardRuntimeCapability`, `canvasToolActionsCapability`, or
88
+ `canvasExportApiToken` therefore replaces that default implementation. Runtime
89
+ defaults and caller plugins use the same `CanvasPlugin` contract and compile
90
+ into one dependency graph.
91
+
92
+ CanvasKit-specific import, keyboard, and tool-action defaults live with the
93
+ composition root under `src/plugins/runtime`. Reusable clipboard and export
94
+ capabilities remain independent Runtime plugin packages. Physical ownership
95
+ does not change capability replacement semantics.
90
96
 
91
97
  ## Startup result
92
98
 
@@ -180,18 +186,20 @@ Nested arrays are groups only; they do not need IDs and are flattened in declara
180
186
 
181
187
  Runtime creation compiles the graph, creates Editor and the Runtime resource owner, runs each setup once in dependency order, then seals all registries. Sealing validates duplicate IDs and action references, materializes registered APIs, and prevents later registration.
182
188
 
183
- Packaging is intentionally outside the standard plugin profile. Products that
184
- need it add the public plugin explicitly:
189
+ Connector and Packaging are composed outside CanvasKit and are intentionally
190
+ absent from the standard plugin profile. Products that need them depend on their
191
+ plugin packages and add them explicitly:
185
192
 
186
193
  ```ts
187
194
  import {
188
- Packaging,
189
195
  createStandardCanvasKitPlugins,
190
196
  type CanvasKitRuntimeOptions,
191
197
  } from "@land/canvas-kit";
198
+ import { Connector } from "@land/plugin-connector";
199
+ import { Packaging } from "@land/plugin-packaging";
192
200
 
193
201
  const options: CanvasKitRuntimeOptions = {
194
- plugins: [createStandardCanvasKitPlugins(), Packaging],
202
+ plugins: [Connector, createStandardCanvasKitPlugins(), Packaging],
195
203
  };
196
204
  ```
197
205
 
@@ -203,17 +211,43 @@ const options: CanvasKitRuntimeOptions = {
203
211
  - `ui`
204
212
  - `lifecycle.beforeReady()`, `lifecycle.beforeCommand()`, and `lifecycle.defer()`
205
213
 
206
- `setup` returns nothing. Every owned resource registers cleanup through `lifecycle.defer()`, which gives Runtime one cleanup protocol and reverse-order resource stack. `beforeReady` runs serially during `start()` after restore/seed and asset preparation. `beforeCommand` is a repeatable interceptor executed by the Runtime-bound command executor.
214
+ `setup` returns nothing. Every owned resource registers cleanup through `lifecycle.defer()`, which gives Runtime one cleanup protocol and reverse-order resource stack. `beforeReady` runs serially during `start()` after restore/seed and asset preparation. `beforeCommand` is a repeatable interceptor executed by the Runtime-bound command executor after Runtime is ready. Public Controller and action writes are rejected outside the ready state; seed uses a private bootstrap executor, so restore, seed, and `beforeReady` initialization do not trigger it. Parameterized built-in actions validate their value before the hook runs. Controller writes and built-in actions reuse the same internal command definitions, whose IDs come from the public read-only `CANVAS_KIT_COMMAND_TOKENS` catalog.
207
215
 
208
216
  The set-active-tool and tool-lock actions are provided by the replaceable
209
- built-in default for `canvasToolActionsCapability`, so shape toolbar plugins do
217
+ Runtime default for `canvasToolActionsCapability`, so shape toolbar plugins do
210
218
  not depend on the standard profile installing a Tool action provider.
211
219
  Components share one props contract and render between Canvas and chrome; there
212
220
  are no component slots.
213
221
 
214
222
  ## Public controller
215
223
 
216
- External code should work through `runtime.controller` or the controller supplied to `onControllerReady`. The controller exposes document, selection, page, tool, camera, layer, history, export, built-in shape creation, and registered API operations without exposing the raw store.
224
+ External code should work through `runtime.controller` or the controller supplied to `onControllerReady`. The controller exposes document, selection, page, tool, camera, layer, history, export, standard shape creation, and registered API operations without exposing the raw store.
225
+
226
+ Controller reads are available immediately for assembly and inspection, but
227
+ Controller writes require `await runtime.start()`. Plugins can match
228
+ `beforeCommand` events against stable command identities without importing
229
+ internals:
230
+
231
+ ```ts
232
+ import {
233
+ CANVAS_KIT_COMMAND_TOKENS,
234
+ canvasKitLifecycleExtension,
235
+ defineCanvasPlugin,
236
+ } from "@land/canvas-kit";
237
+
238
+ const analyticsPlugin = defineCanvasPlugin({
239
+ id: "example.command-analytics",
240
+ setup(context) {
241
+ context
242
+ .get(canvasKitLifecycleExtension)
243
+ .beforeCommand(({ commandId }) => {
244
+ if (commandId === CANVAS_KIT_COMMAND_TOKENS.layer.bringToFront.id) {
245
+ // Record the product command.
246
+ }
247
+ });
248
+ },
249
+ });
250
+ ```
217
251
 
218
252
  ### Export API
219
253
 
@@ -66,3 +66,4 @@ export declare abstract class BindingUtil<B extends BindingRecordBase = BindingR
66
66
  getSelectionCompanionFrameGeometries?(editor: Editor, binding: B, context: BindingSelectionCompanionFrameContext): SelectionOverlayFrameGeometryState[];
67
67
  }
68
68
  export declare function resolveShapeHierarchyRootId(shapeId: ShapeRecord["id"], bindings: readonly BindingRecord[], getBindingUtil: (binding: BindingRecord) => BindingUtil): ShapeRecord["id"];
69
+ export declare function resolveShapeHierarchyRootIds(shapeIds: readonly ShapeRecord["id"][], bindings: readonly BindingRecord[], getBindingUtil: (binding: BindingRecord) => BindingUtil): ReadonlyMap<ShapeRecord["id"], ShapeRecord["id"]>;
@@ -4,7 +4,7 @@ import type { AssetId, AssetRecord, BindingRecord, ShapeId, ShapeRecord } from "
4
4
  import type { Editor } from "./editor";
5
5
  export interface EditorClipboardPayload {
6
6
  type: "land/clipboard";
7
- version: 1;
7
+ version: 2;
8
8
  source: {
9
9
  app: "land";
10
10
  documentId?: string;
@@ -24,7 +24,6 @@ export interface CreateShapeInput {
24
24
  opacity?: number;
25
25
  isHidden?: boolean;
26
26
  rotation?: number;
27
- skewX?: number;
28
27
  scaleX?: number;
29
28
  scaleY?: number;
30
29
  isLocked?: boolean;
@@ -46,7 +45,6 @@ export interface ShapeUpdate {
46
45
  x?: number;
47
46
  y?: number;
48
47
  rotation?: number;
49
- skewX?: number;
50
48
  scaleX?: number;
51
49
  scaleY?: number;
52
50
  opacity?: number;
@@ -15,9 +15,13 @@ export declare class BindingManager {
15
15
  repairLoadedBindings(source: ChangeSource): void;
16
16
  handleShapeChanges(changes: ShapeChangeEntry[], source: ChangeSource): void;
17
17
  getShapeHierarchyRootId(shapeId: ShapeId): ShapeId;
18
+ getShapeHierarchyRootIds(shapeIds: readonly ShapeId[]): ReadonlyMap<ShapeId, ShapeId>;
19
+ getShapeHierarchyMemberIds(shapeIds: readonly ShapeId[]): ShapeId[];
18
20
  cleanupBindingsForDeletedShapes(ids: ShapeId[], source: ChangeSource): void;
19
21
  cleanupBindings(ids: BindingId[], source: ChangeSource): void;
20
22
  private applyEffect;
23
+ private syncShapeHierarchyState;
24
+ private getShapeHierarchyContext;
21
25
  private getAllBindings;
22
26
  private getExclusiveBindingKey;
23
27
  }
@@ -13,7 +13,6 @@ export interface ShapeTransformFields {
13
13
  x: number;
14
14
  y: number;
15
15
  rotation: number;
16
- skewX: number;
17
16
  scaleX: number;
18
17
  scaleY: number;
19
18
  }
@@ -24,9 +23,9 @@ export interface ShapeTransformDecompositionOptions {
24
23
  preferredScaleYSign?: number;
25
24
  }
26
25
  /**
27
- * Decompose a shape's local-to-parent affine transform into its canonical
28
- * translate/rotate/skewX/scale record fields. Axis-collapsed transforms remain
29
- * representable; unsupported rank-one shears return null.
26
+ * Strictly decompose a local-to-parent affine transform into the shape model's
27
+ * translate/rotate/scale fields. Non-orthogonal matrices cannot be represented
28
+ * without shear and therefore return null.
30
29
  */
31
30
  export declare function getShapeTransformFieldsFromMatrix(matrix: Mat, localBounds: Box, options?: ShapeTransformDecompositionOptions): ShapeTransformFields | null;
32
31
  export declare function getShapeLocalBounds<S extends ShapeRecord>(shape: S, util: ShapeUtil<S>): Box;
@@ -10,6 +10,26 @@ export interface SelectionResizeScalesResult {
10
10
  scaleX: number;
11
11
  scaleY: number;
12
12
  }
13
+ /** Gets the axis-aligned size after applying a shape's scale. */
14
+ export declare function getSelectionResizeDimensionsFromLocal({ localWidth, localHeight, scaleX, scaleY, }: {
15
+ localWidth: number;
16
+ localHeight: number;
17
+ scaleX: number;
18
+ scaleY: number;
19
+ }): {
20
+ width: number;
21
+ height: number;
22
+ };
23
+ /** Recovers intrinsic dimensions from an axis-aligned scaled size. */
24
+ export declare function getLocalDimensionsFromSelectionResize({ width, height, scaleX, scaleY, }: {
25
+ width: number;
26
+ height: number;
27
+ scaleX: number;
28
+ scaleY: number;
29
+ }): {
30
+ width: number;
31
+ height: number;
32
+ };
13
33
  export declare function selectionResizeHandleMovesLeftEdge(handleId: SelectionResizeHandleId): boolean;
14
34
  export declare function selectionResizeHandleMovesRightEdge(handleId: SelectionResizeHandleId): boolean;
15
35
  export declare function selectionResizeHandleMovesTopEdge(handleId: SelectionResizeHandleId): boolean;
@@ -1,6 +1,8 @@
1
1
  import type { ShapeRecord } from "../schema/records";
2
2
  import type { Editor } from "./editor";
3
3
  import { type SelectionResizeHandleId, type SelectionResizeMode } from "./selection";
4
+ export type SelectionResizeRotationCompatibility = "parallel" | "perpendicular";
5
+ export declare function getSelectionResizeRotationCompatibility(left: number, right: number): SelectionResizeRotationCompatibility | null;
4
6
  export declare function areSelectionResizeRotationsCompatible(left: number, right: number): boolean;
5
7
  export declare function areSelectionResizeTargetRotationsCompatible(editor: Editor, resizeTargetShapes: readonly ShapeRecord[], selectionRotation: number): boolean;
6
8
  export declare function intersectSelectionResizeModes(modeSets: readonly (readonly SelectionResizeMode[])[]): SelectionResizeMode[];
@@ -16,7 +16,6 @@ export declare class Mat {
16
16
  static Identity(): Mat;
17
17
  static Translate(x: number, y: number): Mat;
18
18
  static Rotate(angle: number): Mat;
19
- static SkewX(angle: number): Mat;
20
19
  static Scale(sx: number, sy: number): Mat;
21
20
  /** Compose: this × other */
22
21
  compose(other: Mat): Mat;
@@ -27,6 +26,6 @@ export declare class Mat {
27
26
  invert(): Mat;
28
27
  toCssString(): string;
29
28
  toSvgString(): string;
30
- /** Create a transform for a shape: translate * rotate * skewX * scale. */
31
- static ForShape(x: number, y: number, rotation: number, scaleX?: number, scaleY?: number, skewX?: number): Mat;
29
+ /** Create a transform for a shape: translate * rotate * scale. */
30
+ static ForShape(x: number, y: number, rotation: number, scaleX?: number, scaleY?: number): Mat;
32
31
  }
@@ -8,7 +8,7 @@ export { getShapeGeometry, getShapeExportBounds, getShapeExportPageBounds, getSh
8
8
  export type { ShapeGeometry, ShapeTransformDecompositionOptions, ShapeTransformFields, } from "./editor/queries/shapeTransforms";
9
9
  export type { BindingPreviewState, GapSnapIndicatorGapState, GapSnapIndicatorState, PointSnapIndicatorState, SnapIndicatorState, SelectionBindingSegment, TerminalBindingGuideState, SelectionBindingMiddleHandle, SelectionBindingMiddleHandleAnchor, SelectionBindingTerminalHandle, SelectionBindingTerminalHandleAnchor, SelectionCustomHandle, SelectionCustomHandleAnchor, SelectionHandle, SelectionOverlayFrameState, SelectionOverlayFrameGeometryState, SelectionOverlayFrameStyleState, SelectionOverlayHandleAnchorsState, SelectionOverlayHandleCountsState, SelectionOverlayHandlesState, SelectionOverlayState, SelectionResizeHandle, SelectionResizeHandleAnchor, SelectionResizeHandleId, SelectionResizeMode, SelectionRotateHandle, SelectionRotateHandleAnchor, SelectionRotateHandleId, SelectionMirrorAxis, } from "./editor/selection";
10
10
  export { SELECTION_RESIZE_ALL_MODES, SELECTION_RESIZE_ASPECT_RATIO_LOCKED_ONLY_MODES, SELECTION_RESIZE_CORNER_HANDLE_IDS, SELECTION_RESIZE_FREE_ONLY_MODES, SELECTION_RESIZE_HANDLE_IDS, flipSelectionLocalBounds, getSelectionLocalBoundsFromPagePoints, mapSelectionLocalBoundsBetweenBounds, mapSelectionLocalPointBetweenBounds, mirrorSelectionLocalPoint, rotateSelectionPagePoint, selectionLocalPointToPagePoint, selectionPagePointToLocalPoint, } from "./editor/selection";
11
- export { getAnchoredSelectionResizeLocalBounds, getAspectRatioLockedSelectionResizeBounds, getCenteredSelectionResizeBounds, getConstrainedSelectionResizeBounds, getSelectionResizeBounds, getSelectionResizeScalesFromBounds, isSelectionResizeCorner, normalizeSelectionResizeBoundsFromEdges, selectionResizeHandleMovesBottomEdge, selectionResizeHandleMovesLeftEdge, selectionResizeHandleMovesRightEdge, selectionResizeHandleMovesTopEdge, } from "./editor/resizeGeometry";
11
+ export { getAnchoredSelectionResizeLocalBounds, getAspectRatioLockedSelectionResizeBounds, getCenteredSelectionResizeBounds, getConstrainedSelectionResizeBounds, getLocalDimensionsFromSelectionResize, getSelectionResizeBounds, getSelectionResizeDimensionsFromLocal, getSelectionResizeScalesFromBounds, isSelectionResizeCorner, normalizeSelectionResizeBoundsFromEdges, selectionResizeHandleMovesBottomEdge, selectionResizeHandleMovesLeftEdge, selectionResizeHandleMovesRightEdge, selectionResizeHandleMovesTopEdge, } from "./editor/resizeGeometry";
12
12
  export { InteractionHandlerRegistry } from "./editor/interactions";
13
13
  export { SelectionHandleInteractionRegistry } from "./editor/selectionHandleInteractions";
14
14
  export { ShortcutManager, formatKeyboardShortcut, normalizeKeyboardShortcut, } from "./editor/managers/shortcutManager";
@@ -29,7 +29,9 @@ export type { ChangeSource, RecordUpdate, RecordsDiff, ScopedStoreRecord, StoreR
29
29
  export { SnapshotParseError, parseDocumentSnapshot, parseSessionSnapshot, } from "./schema/snapshots";
30
30
  export type { DocumentSnapshot, SessionSnapshot } from "./schema/snapshots";
31
31
  export { ShapeUtil } from "./shapes/shapeUtil";
32
- export type { ShapeBoundsSnapGeometry, ShapeBrushSelectInput, ShapeBrushWrapInput, ShapeClipboardCopyInput, ShapeBindingPointInput, ShapeBindingTargetHitTestInput, ShapeChildPlacementInput, ShapeChildVisibilityInput, ShapeEditEndInput, ShapeEditEndResult, ShapeGeometryInput, ShapeGroupingInput, ShapeHandleSnapContext, ShapeHandleSnapGeometry, ShapeHoverTargetInput, ShapeLineSegmentHitTestInput, ShapeLabelPathGeometry, ShapeLabelPathNearestPositionOptions, ShapePointHitTestInput, ShapeSnapPoint, ShapeSnapPointKind, ShapeTerminalBindingOutline, ShapeSelectionHandleAnchorInput, ShapeSelectionHandleAnchors, ShapeSelectionFrameInput, ShapeSelectionFlipAxis, ShapeSelectionFlipInput, ShapeSelectionOverlayInfo, ShapeSelectionOverlayInfoInput, ShapeSelectionPathStyle, ShapeSelectionPagePoints, ShapeSelectionPagePointsInput, ShapeSelectionResizeInput, ShapeSelectionResizeCapabilityInput, ShapeSelectionResizeModesInput, ShapeSelectionTransformCapabilityInput, ShapeSelectionTranslateInput, } from "./shapes/shapeUtil";
32
+ export { CHILD_TRANSFORM_POLICY_EPSILON, formatChildTransformPolicyViolation, getChildTransformPolicyViolation, } from "./shapes/childTransformPolicy";
33
+ export type { ChildTransformPolicy, ChildTransformPolicyProvider, ChildTransformPolicyViolation, } from "./shapes/childTransformPolicy";
34
+ export type { ShapeBoundsSnapGeometry, ShapeBrushSelectInput, ShapeBrushWrapInput, ShapeClipboardCopyInput, ShapeBindingPointInput, ShapeChildPlacementInput, ShapeChildVisibilityInput, ShapeEditEndInput, ShapeEditEndResult, ShapeGeometryInput, ShapeGroupingInput, ShapeHandleSnapContext, ShapeHandleSnapGeometry, ShapeHoverTargetInput, ShapeLineSegmentHitTestInput, ShapeLabelPathGeometry, ShapeLabelPathNearestPositionOptions, ShapePointHitTestInput, ShapeSnapPoint, ShapeSnapPointKind, ShapeTerminalBindingOutline, ShapeSelectionHandleAnchorInput, ShapeSelectionHandleAnchors, ShapeSelectionFrameInput, ShapeSelectionFlipAxis, ShapeSelectionFlipInput, ShapeSelectionOverlayInfo, ShapeSelectionOverlayInfoInput, ShapeSelectionPathStyle, ShapeSelectionPagePoints, ShapeSelectionPagePointsInput, ShapeSelectionResizeInput, ShapeSelectionResizeCapabilityInput, ShapeSelectionResizeModesInput, ShapeSelectionTransformCapabilityInput, ShapeSelectionTranslateInput, } from "./shapes/shapeUtil";
33
35
  export type { HandleSnapContext, HandleSnapInput, HandleSnapMode, HandleSnapResult, HandleSnapSnapshot, HandleSnapSnapshotInput, ResizeSnapInput, ResizeSnapResult, ResizeSnapSnapshot, SnapAxis, SnapCoordinateSpace, SnapPointIndex, SnapPointIndexEntry, SnapPointKind, TranslateSnapInput, TranslateSnapResult, TranslateSnapSnapshot, } from "./editor/managers/snapTypes";
34
36
  export { ShapeUtilRegistry } from "./shapes/shapeUtilRegistry";
35
37
  export { resolveTerminalBindingAtPoint, } from "./bindings/terminalBinding";
@@ -59,7 +59,6 @@ export interface ShapeRecordBase<Type extends string = string, Props extends obj
59
59
  x: number;
60
60
  y: number;
61
61
  rotation: number;
62
- skewX: number;
63
62
  scaleX: number;
64
63
  scaleY: number;
65
64
  opacity: number;
@@ -2,12 +2,12 @@ import type { ShapeUtilRegistry } from "../shapes/shapeUtilRegistry";
2
2
  import type { BindingUtilRegistry } from "../bindings/bindingUtilRegistry";
3
3
  import type { StoreSnapshot } from "../../store/index";
4
4
  import { type DocumentRecord, type SessionRecord } from "./records";
5
- export type DocumentSnapshot = StoreSnapshot<DocumentRecord, 2>;
5
+ export type DocumentSnapshot = StoreSnapshot<DocumentRecord, 3>;
6
6
  export type SessionSnapshot = StoreSnapshot<SessionRecord, 1>;
7
7
  export declare class SnapshotParseError extends Error {
8
8
  constructor(message: string);
9
9
  }
10
- declare const CURRENT_DOCUMENT_SNAPSHOT_VERSION: 2;
10
+ declare const CURRENT_DOCUMENT_SNAPSHOT_VERSION: 3;
11
11
  declare const CURRENT_SESSION_SNAPSHOT_VERSION: 1;
12
12
  export declare function getSnapshotEnvelope(snapshot: unknown, kind: "document"): {
13
13
  schemaVersion: typeof CURRENT_DOCUMENT_SNAPSHOT_VERSION;
@@ -0,0 +1,16 @@
1
+ import type { ShapeRecordBase } from "../schema/records";
2
+ export type ChildTransformPolicy = "isometry" | "similarity";
3
+ export declare const CHILD_TRANSFORM_POLICY_EPSILON = 1e-8;
4
+ export interface ChildTransformPolicyProvider<S extends ShapeRecordBase = ShapeRecordBase> {
5
+ canReceiveChildren(shape: S): boolean;
6
+ getChildTransformPolicy(shape: S): ChildTransformPolicy;
7
+ }
8
+ export interface ChildTransformPolicyViolation {
9
+ shapeId: ShapeRecordBase["id"];
10
+ shapeType: ShapeRecordBase["type"];
11
+ policy: ChildTransformPolicy;
12
+ scaleX: number;
13
+ scaleY: number;
14
+ }
15
+ export declare function getChildTransformPolicyViolation<S extends ShapeRecordBase>(shape: S, provider: ChildTransformPolicyProvider<S>, epsilon?: number): ChildTransformPolicyViolation | null;
16
+ export declare function formatChildTransformPolicyViolation(violation: ChildTransformPolicyViolation): string;
@@ -7,6 +7,7 @@ import { type SelectionMirrorAxis } from "../editor/selection";
7
7
  import type { SelectionBindingMiddleHandleAnchor, SelectionBindingSegment, SelectionBindingTerminalHandleAnchor, SelectionCustomHandleAnchor, SelectionHandle, SelectionResizeHandleId, SelectionResizeMode } from "../editor/selection";
8
8
  import type { ShapeId, ShapeParentId, ShapeRecordBase } from "../schema/records";
9
9
  import { type ShapeTerminalBindingPort } from "../bindings/terminalPorts";
10
+ import type { ChildTransformPolicy } from "./childTransformPolicy";
10
11
  export interface ShapeEditEndResult {
11
12
  deleteShapeIds?: ShapeId[];
12
13
  }
@@ -94,8 +95,6 @@ export interface ShapePointHitTestInput extends ShapeGeometryInput {
94
95
  pagePoint: Vec;
95
96
  positionedPoint: Vec;
96
97
  }
97
- export interface ShapeBindingTargetHitTestInput extends ShapePointHitTestInput {
98
- }
99
98
  export interface ShapeTerminalBindingOutline {
100
99
  points: readonly Vec[];
101
100
  closed: boolean;
@@ -226,6 +225,7 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
226
225
  getLocalToPageTransform(shape: S): Mat;
227
226
  canEdit(_shape: S): boolean;
228
227
  canReceiveChildren(_shape: S): boolean;
228
+ getChildTransformPolicy(_shape: S): ChildTransformPolicy;
229
229
  canReceiveChild(shape: S, _child: ShapeRecordBase): boolean;
230
230
  isChildVisible(_shape: S, _child: ShapeRecordBase, _input: ShapeChildVisibilityInput): boolean;
231
231
  getChildPlacementMeta(_shape: S, child: ShapeRecordBase, _input: ShapeChildPlacementInput): Record<string, unknown>;
@@ -238,7 +238,7 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
238
238
  repairLoadedShape(_shape: S): S | null;
239
239
  onEditEnd(_shape: S, _input: ShapeEditEndInput): ShapeEditEndResult | void;
240
240
  hitTest(shape: S, positionedPoint: Vec, _input?: ShapePointHitTestInput): boolean;
241
- hitTestBindingTarget(shape: S, positionedPoint: Vec, input?: ShapeBindingTargetHitTestInput): boolean;
241
+ hitTestBindingTarget(shape: S, positionedPoint: Vec, input?: ShapePointHitTestInput): boolean;
242
242
  hitTestLineSegment(shape: S, input: ShapeLineSegmentHitTestInput): boolean;
243
243
  resolveBindingPoint(shape: S, input: ShapeBindingPointInput): Vec;
244
244
  }
@@ -6,11 +6,5 @@ export interface CanvasPluginCapabilityToken<TValue = unknown, TKind extends Can
6
6
  }
7
7
  export interface CanvasPluginValueToken<TValue> extends CanvasPluginCapabilityToken<TValue, "value"> {
8
8
  }
9
- export interface CanvasPluginCapabilityRegistry {
10
- get<TValue>(token: CanvasPluginValueToken<TValue>): TValue | null;
11
- }
12
- export interface CanvasPluginCapabilitySetup extends CanvasPluginCapabilityRegistry {
13
- provide<TValue>(token: CanvasPluginValueToken<TValue>, value: TValue): void;
14
- }
15
9
  export declare function createCanvasPluginValueToken<TValue>(id: string): CanvasPluginValueToken<TValue>;
16
10
  export declare function isCanvasPluginCapabilityToken(value: unknown): value is CanvasPluginCapabilityToken;
@@ -1,18 +1,3 @@
1
- export * from "./actions";
2
- export * from "./actionRegistry";
3
1
  export * from "./capability";
4
- export * from "./chrome";
5
- export * from "./chromeRegistry";
6
- export * from "./contextMenu";
7
- export * from "./contextMenuRegistry";
8
- export * from "./exports";
9
- export * from "./exportRegistry";
10
- export * from "./imports";
11
- export * from "./importRegistry";
12
- export * from "./lifecycle";
13
2
  export * from "./plugin";
14
- export * from "./pluginUi";
15
- export * from "./productApi";
16
- export * from "./services";
17
- export * from "./toolbar";
18
- export * from "./toolbarRegistry";
3
+ export * from "./setupExtension";
@@ -1,48 +1,11 @@
1
- import type { EditorPlugin, Editor, KeyboardShortcutInput, ShapeRecordBase } from "../canvas-core/index";
1
+ import type { EditorPlugin, Editor } from "../canvas-core/index";
2
2
  import type { CanvasRenderPlugin } from "../canvas-react/host/index";
3
- import type { CanvasAction } from "./actions";
4
- import type { ContextMenuContribution } from "./contextMenu";
5
- import type { CanvasPluginChromeSetup } from "./chrome";
6
- import type { CanvasPluginImportSetup } from "./imports";
7
- import type { CanvasPluginExportSetup } from "./exports";
8
- import type { CanvasPluginLifecycleSetup, CanvasPluginPersistence } from "./lifecycle";
9
- import type { CanvasPluginUiSetup } from "./pluginUi";
10
- import type { ProductServiceSetup } from "./services";
11
- import type { ToolbarContribution } from "./toolbar";
12
- import type { CanvasPluginApi, CanvasPluginApiContext } from "./productApi";
13
- import { type CanvasPluginCapabilitySetup, type CanvasPluginCapabilityToken } from "./capability";
14
- export interface CanvasActionShortcut {
15
- actionId: string;
16
- shortcut: KeyboardShortcutInput;
17
- }
18
- export interface CanvasPluginActionSetup {
19
- add(...actions: readonly CanvasAction[]): void;
20
- addShortcuts(...shortcuts: readonly CanvasActionShortcut[]): void;
21
- }
22
- export interface CanvasPluginToolbarSetup {
23
- add(...contributions: readonly ToolbarContribution[]): void;
24
- }
25
- export interface CanvasPluginContextMenuSetup {
26
- add(...contributions: readonly ContextMenuContribution[]): void;
27
- }
28
- export interface CanvasPluginApiSetup<TApiContext extends CanvasPluginApiContext = CanvasPluginApiContext> {
29
- add<TApi>(api: CanvasPluginApi<TApi, TApiContext>): void;
30
- }
31
- export interface CanvasPluginSetupContext<TApiContext extends CanvasPluginApiContext = CanvasPluginApiContext> {
32
- readonly actions: CanvasPluginActionSetup;
33
- readonly apis: CanvasPluginApiSetup<TApiContext>;
34
- readonly capabilities: CanvasPluginCapabilitySetup;
35
- readonly chrome: CanvasPluginChromeSetup;
36
- readonly contextMenu: CanvasPluginContextMenuSetup;
3
+ import type { CanvasPluginCapabilityToken } from "./capability";
4
+ import type { CanvasPluginSetupExtension } from "./setupExtension";
5
+ export interface CanvasPluginSetupContext {
37
6
  readonly editor: Editor;
38
- readonly exports: CanvasPluginExportSetup;
39
- readonly imports: CanvasPluginImportSetup;
40
- readonly lifecycle: CanvasPluginLifecycleSetup;
41
- readonly persistence: CanvasPluginPersistence | null;
42
7
  readonly productId: string;
43
- readonly services: ProductServiceSetup;
44
- readonly toolbar: CanvasPluginToolbarSetup;
45
- readonly ui: CanvasPluginUiSetup;
8
+ get<TValue>(extension: CanvasPluginSetupExtension<TValue>): TValue;
46
9
  }
47
10
  export type CanvasPluginSetup<TContext extends CanvasPluginSetupContext = CanvasPluginSetupContext> = (context: TContext) => void;
48
11
  type CanvasPluginSetupLike = (context: never) => unknown;
@@ -62,15 +25,5 @@ export interface CanvasPluginDefinition<TSetup extends CanvasPluginSetupLike = C
62
25
  export interface CanvasPlugin<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup> extends CanvasPluginDefinition<TSetup>, CanvasPluginReference {
63
26
  }
64
27
  export type CanvasPluginInput<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup> = CanvasPlugin<TSetup> | readonly CanvasPluginInput<TSetup>[];
65
- export interface CompiledCanvasPlugins<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup> {
66
- readonly plugins: readonly CanvasPlugin<TSetup>[];
67
- readonly pluginIds: readonly string[];
68
- readonly editorPlugins: readonly EditorPlugin[];
69
- readonly renderPlugins: readonly CanvasRenderPlugin[];
70
- readonly shapeTypes: readonly ShapeRecordBase["type"][];
71
- }
72
28
  export declare function defineCanvasPlugin<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup>(plugin: CanvasPluginDefinition<TSetup>): CanvasPlugin<TSetup>;
73
- export declare function compileCanvasPlugins<TSetup extends CanvasPluginSetupLike>(input: readonly CanvasPluginInput<TSetup>[]): CompiledCanvasPlugins<TSetup>;
74
- export declare function assertValidCanvasPluginGraph<TSetup extends CanvasPluginSetupLike>(input: readonly CanvasPluginInput<TSetup>[]): void;
75
- export declare function hasCanvasPluginCapabilityProvider<TSetup extends CanvasPluginSetupLike>(input: readonly CanvasPluginInput<TSetup>[], token: CanvasPluginCapabilityToken): boolean;
76
29
  export {};
@@ -0,0 +1,5 @@
1
+ export interface CanvasPluginSetupExtension<TValue> {
2
+ readonly id: string;
3
+ readonly __value?: TValue;
4
+ }
5
+ export declare function createCanvasPluginSetupExtension<TValue>(id: string): CanvasPluginSetupExtension<TValue>;
@@ -0,0 +1,4 @@
1
+ import type { CanvasAction } from "./actions";
2
+ export interface CanvasActionRegistry {
3
+ getAction(actionId: string): CanvasAction | null;
4
+ }
@@ -1,4 +1,4 @@
1
- import type { Editor, ShapeColor, ShapeId, ShapeRecordBase } from "../canvas-core/index";
1
+ import type { Editor, KeyboardShortcutInput, ShapeColor, ShapeId, ShapeRecordBase } from "../canvas-core/index";
2
2
  export interface CanvasSelectionSnapshot {
3
3
  selectedShapeIds: readonly ShapeId[];
4
4
  selectedShapes: readonly ShapeRecordBase[];
@@ -32,19 +32,13 @@ export interface CanvasAction<TValue extends CanvasActionValue = CanvasActionVal
32
32
  getValue?(context: CanvasActionContext): TValue;
33
33
  run(input: CanvasActionRunInput<TValue>): void;
34
34
  }
35
+ export interface CanvasActionShortcut {
36
+ actionId: string;
37
+ shortcut: KeyboardShortcutInput;
38
+ }
39
+ export interface CanvasPluginActionSetup {
40
+ add(...actions: readonly CanvasAction[]): void;
41
+ addShortcuts(...shortcuts: readonly CanvasActionShortcut[]): void;
42
+ }
43
+ export declare const canvasActionsExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginActionSetup>;
35
44
  export declare function resolveCanvasActionAvailability(action: CanvasAction, context: CanvasActionContext): CanvasActionAvailability;
36
- export declare function createCanvasActionContext({ editor, toolState, selectionState, }: {
37
- editor: Editor;
38
- toolState: {
39
- activeToolId: string;
40
- isToolLocked: boolean;
41
- };
42
- selectionState: {
43
- count: number;
44
- singleShapeType: CanvasActionContext["selection"]["singleShapeType"];
45
- commonShapeType: CanvasActionContext["selection"]["commonShapeType"];
46
- canFlipSelection: boolean;
47
- canResetSelectionRotation: boolean;
48
- isMixedFrameAndPointHandleSelection: boolean;
49
- };
50
- }): CanvasActionContext;
@@ -0,0 +1,8 @@
1
+ import { type CanvasPluginValueToken } from "../canvas-plugin-sdk/index";
2
+ export interface CanvasPluginCapabilityRegistry {
3
+ get<TValue>(token: CanvasPluginValueToken<TValue>): TValue | null;
4
+ }
5
+ export interface CanvasPluginCapabilitySetup extends CanvasPluginCapabilityRegistry {
6
+ provide<TValue>(token: CanvasPluginValueToken<TValue>, value: TValue): void;
7
+ }
8
+ export declare const canvasCapabilitiesExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginCapabilitySetup>;
@@ -50,3 +50,4 @@ export interface ChromeContribution {
50
50
  export interface CanvasPluginChromeSetup {
51
51
  add(...contributions: readonly ChromeContribution[]): void;
52
52
  }
53
+ export declare const canvasChromeExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginChromeSetup>;
@@ -0,0 +1,9 @@
1
+ import type { Editor } from "../canvas-core/index";
2
+ import type { CanvasActionContext } from "./actions";
3
+ import type { ChromeChannel, ChromeSection } from "./chrome";
4
+ export interface CanvasChromeRegistry {
5
+ getChannels(): readonly ChromeChannel[];
6
+ getStateRevision(): number;
7
+ subscribeToState(editor: Editor, listener: () => void): () => void;
8
+ getSections(channel: ChromeChannel, context: CanvasActionContext): ChromeSection[];
9
+ }
@@ -57,3 +57,7 @@ export interface ContextMenuContribution {
57
57
  when?(context: ContextMenuContext): boolean;
58
58
  getSections(context: ContextMenuContext): readonly ContextMenuSection[];
59
59
  }
60
+ export interface CanvasPluginContextMenuSetup {
61
+ add(...contributions: readonly ContextMenuContribution[]): void;
62
+ }
63
+ export declare const canvasContextMenuExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginContextMenuSetup>;
@@ -0,0 +1,4 @@
1
+ import type { ContextMenuContext, ContextMenuContributionTarget, ContextMenuSection } from "./contextMenu";
2
+ export interface CanvasContextMenuRegistry {
3
+ getSections(target: ContextMenuContributionTarget, context: ContextMenuContext): ContextMenuSection[];
4
+ }
@@ -0,0 +1,6 @@
1
+ import type { CanvasExportArtifact, CanvasExportFormat, CanvasExportProviderInput } from "./exports";
2
+ export interface CanvasExportRegistry {
3
+ getFormats(): readonly CanvasExportFormat[];
4
+ hasFormat(format: string): boolean;
5
+ export(format: string, input: CanvasExportProviderInput): Promise<CanvasExportArtifact>;
6
+ }
@@ -24,3 +24,4 @@ export interface CanvasExportContribution extends CanvasExportFormat {
24
24
  export interface CanvasPluginExportSetup {
25
25
  add(...contributions: readonly CanvasExportContribution[]): void;
26
26
  }
27
+ export declare const canvasExportsExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginExportSetup>;
@@ -1,10 +1,7 @@
1
1
  import type { CanvasImportContext, CanvasImportContribution, CanvasImportPreview, CanvasImportRequest, CanvasImportResult } from "./imports";
2
- export declare class CanvasImportRegistry {
3
- private readonly contributions;
4
- constructor(contributions?: readonly CanvasImportContribution[]);
2
+ export interface CanvasImportRegistry {
5
3
  getContributions(): readonly CanvasImportContribution[];
6
4
  canImport(request: CanvasImportRequest): boolean;
7
5
  canImportPreview(preview: CanvasImportPreview): boolean;
8
6
  import(request: CanvasImportRequest, context: CanvasImportContext): Promise<CanvasImportResult>;
9
7
  }
10
- export declare function createCanvasImportRegistry(contributions?: readonly CanvasImportContribution[]): CanvasImportRegistry;
@@ -36,3 +36,4 @@ export interface CanvasImportContribution {
36
36
  export interface CanvasPluginImportSetup {
37
37
  add(...contributions: readonly CanvasImportContribution[]): void;
38
38
  }
39
+ export declare const canvasImportsExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginImportSetup>;
@@ -0,0 +1,15 @@
1
+ export * from "./actions";
2
+ export * from "./actionRegistry";
3
+ export * from "./capability";
4
+ export * from "./chrome";
5
+ export * from "./chromeRegistry";
6
+ export * from "./contextMenu";
7
+ export * from "./contextMenuRegistry";
8
+ export * from "./exports";
9
+ export * from "./exportRegistry";
10
+ export * from "./imports";
11
+ export * from "./importRegistry";
12
+ export * from "./productApi";
13
+ export * from "./services";
14
+ export * from "./toolbar";
15
+ export * from "./toolbarRegistry";
@@ -1,5 +1,6 @@
1
1
  import type { Editor, ShapeId } from "../canvas-core/index";
2
- import type { CanvasPluginCapabilityRegistry, CanvasPluginCapabilityToken } from "./capability";
2
+ import { type CanvasPluginCapabilityToken } from "../canvas-plugin-sdk/index";
3
+ import type { CanvasPluginCapabilityRegistry } from "./capability";
3
4
  import type { CanvasExportRegistry } from "./exportRegistry";
4
5
  export interface ProductApiToken<TApi> extends CanvasPluginCapabilityToken<TApi, "api"> {
5
6
  readonly __api?: TApi;
@@ -7,9 +8,6 @@ export interface ProductApiToken<TApi> extends CanvasPluginCapabilityToken<TApi,
7
8
  export interface ProductApiRegistry {
8
9
  get<TApi>(token: ProductApiToken<TApi>): TApi | null;
9
10
  }
10
- export interface ProductApiRegistryRuntime extends ProductApiRegistry {
11
- register<TApi>(token: ProductApiToken<TApi>, api: TApi): void;
12
- }
13
11
  export interface CanvasShapeRef<TType extends string = string> {
14
12
  id: ShapeId;
15
13
  type: TType;
@@ -24,5 +22,8 @@ export interface CanvasPluginApi<TApi, TContext extends CanvasPluginApiContext =
24
22
  token: ProductApiToken<TApi>;
25
23
  create(context: TContext): TApi | null;
26
24
  }
25
+ export interface CanvasPluginApiSetup<TContext extends CanvasPluginApiContext = CanvasPluginApiContext> {
26
+ add<TApi>(api: CanvasPluginApi<TApi, TContext>): void;
27
+ }
28
+ export declare const canvasApisExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginApiSetup<CanvasPluginApiContext>>;
27
29
  export declare function createProductApiToken<TApi>(id: string): ProductApiToken<TApi>;
28
- export declare function createProductApiRegistry(): ProductApiRegistryRuntime;
@@ -1,4 +1,4 @@
1
- import type { CanvasPluginCapabilityToken } from "./capability";
1
+ import { type CanvasPluginCapabilityToken } from "../canvas-plugin-sdk/index";
2
2
  export interface ProductServiceToken<TService> extends CanvasPluginCapabilityToken<TService, "service"> {
3
3
  readonly __service?: TService;
4
4
  }
@@ -16,5 +16,6 @@ export interface ProductServiceRegistry {
16
16
  export interface ProductServiceSetup extends ProductServiceRegistry {
17
17
  add<TService>(factory: ProductServiceFactory<TService>): TService;
18
18
  }
19
+ export declare const canvasServicesExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<ProductServiceSetup>;
19
20
  export declare function createProductServiceToken<TService>(id: string): ProductServiceToken<TService>;
20
21
  export declare function requireProductService<TService>(services: ProductServiceRegistry, token: ProductServiceToken<TService>): TService;