@yuzhouu/canvas-kit 0.1.7 → 0.1.9

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 (184) hide show
  1. package/README.md +5 -1
  2. package/_vendor/canvas-core/editor/commands.d.ts +10 -1
  3. package/_vendor/canvas-core/editor/createEditorWithRuntimePlugins.d.ts +6 -0
  4. package/_vendor/canvas-core/editor/editor.d.ts +6 -1
  5. package/_vendor/canvas-core/editor/index.d.ts +1 -1
  6. package/_vendor/canvas-core/editor/managers/documentSnapshotManager.d.ts +1 -1
  7. package/_vendor/canvas-core/editor/managers/snapCalculations.d.ts +34 -4
  8. package/_vendor/canvas-core/editor/managers/snapManager.d.ts +7 -0
  9. package/_vendor/canvas-core/editor/managers/snapTypes.d.ts +15 -0
  10. package/_vendor/canvas-core/editor/middleMousePanInteraction.d.ts +2 -0
  11. package/_vendor/canvas-core/index.d.ts +7 -7
  12. package/_vendor/canvas-core/plugins/{editorPlugin.d.ts → editorRuntimePlugin.d.ts} +3 -3
  13. package/_vendor/canvas-core/plugins/index.d.ts +1 -1
  14. package/_vendor/canvas-core/schema/records.d.ts +10 -1
  15. package/_vendor/canvas-core/shapes/shapeUtil.d.ts +13 -4
  16. package/_vendor/canvas-core/shapes/types.d.ts +2 -2
  17. package/_vendor/canvas-core/surfaces/toolbar.d.ts +11 -1
  18. package/_vendor/canvas-react/components/CanvasView.d.ts +3 -3
  19. package/_vendor/canvas-react/components/useCanvasDomEvents.d.ts +2 -0
  20. package/_vendor/canvas-react/host/actionRegistry.d.ts +15 -0
  21. package/_vendor/canvas-react/host/{canvasPlugin.d.ts → canvasRenderPlugin.d.ts} +5 -5
  22. package/_vendor/canvas-react/host/canvasRenderPluginHost.d.ts +2 -0
  23. package/_vendor/canvas-react/host/canvasRenderPluginHostManifest.d.ts +2 -0
  24. package/_vendor/canvas-react/host/canvasRenderPluginHostRuntime.d.ts +3 -0
  25. package/_vendor/canvas-react/host/canvasRenderPluginHostTypes.d.ts +104 -0
  26. package/_vendor/canvas-react/host/canvasRenderPluginHostValidation.d.ts +11 -0
  27. package/_vendor/canvas-react/host/contextMenuRegistry.d.ts +8 -3
  28. package/_vendor/canvas-react/host/domEventGuards.d.ts +3 -3
  29. package/_vendor/canvas-react/host/extension.d.ts +4 -4
  30. package/_vendor/canvas-react/host/index.d.ts +5 -4
  31. package/_vendor/canvas-react/host/overlayRegistry.d.ts +3 -3
  32. package/_vendor/canvas-react/host/rendererRegistry.d.ts +3 -3
  33. package/_vendor/canvas-react/host/toolbarRegistry.d.ts +9 -13
  34. package/_vendor/plugin-arrow/canvasRender.d.ts +2 -0
  35. package/_vendor/plugin-arrow/{editor.d.ts → editorRuntime.d.ts} +2 -2
  36. package/_vendor/plugin-arrow/index.d.ts +2 -2
  37. package/_vendor/plugin-draw/canvasRender.d.ts +2 -0
  38. package/_vendor/plugin-draw/{editor.d.ts → editorRuntime.d.ts} +2 -2
  39. package/_vendor/plugin-draw/index.d.ts +2 -2
  40. package/_vendor/plugin-eraser/canvasRender.d.ts +2 -0
  41. package/_vendor/plugin-eraser/editorRuntime.d.ts +2 -0
  42. package/_vendor/plugin-eraser/index.d.ts +2 -2
  43. package/_vendor/plugin-frame/{canvas.d.ts → canvasRender.d.ts} +2 -2
  44. package/_vendor/plugin-frame/{editor.d.ts → editorRuntime.d.ts} +2 -2
  45. package/_vendor/plugin-frame/index.d.ts +2 -2
  46. package/_vendor/plugin-geo/{canvas.d.ts → canvasRender.d.ts} +2 -2
  47. package/_vendor/plugin-geo/{editor.d.ts → editorRuntime.d.ts} +2 -2
  48. package/_vendor/plugin-geo/geoGeometry.d.ts +19 -3
  49. package/_vendor/plugin-geo/index.d.ts +2 -2
  50. package/_vendor/plugin-geo/types.d.ts +1 -0
  51. package/_vendor/plugin-group/{canvas.d.ts → canvasRender.d.ts} +2 -2
  52. package/_vendor/plugin-group/{editor.d.ts → editorRuntime.d.ts} +2 -2
  53. package/_vendor/plugin-group/index.d.ts +2 -2
  54. package/_vendor/plugin-image/{editor.d.ts → actionIds.d.ts} +0 -8
  55. package/_vendor/plugin-image/canvasRender.d.ts +2 -0
  56. package/_vendor/plugin-image/cropRuntime.d.ts +2 -0
  57. package/_vendor/plugin-image/editorRuntime.d.ts +5 -0
  58. package/_vendor/plugin-image/imageHostActionContract.d.ts +2 -0
  59. package/_vendor/plugin-image/imageShapeUtil.d.ts +2 -1
  60. package/_vendor/plugin-image/imageSvgExporter.d.ts +6 -0
  61. package/_vendor/plugin-image/index.d.ts +8 -4
  62. package/_vendor/plugin-image/runtimeShared.d.ts +5 -0
  63. package/_vendor/plugin-image/smudge.d.ts +63 -0
  64. package/_vendor/plugin-image/smudgeInteractions.d.ts +2 -0
  65. package/_vendor/plugin-image/smudgeRuntime.d.ts +2 -0
  66. package/_vendor/plugin-image/styleRuntime.d.ts +17 -0
  67. package/_vendor/plugin-image/toolbarRuntime.d.ts +3 -0
  68. package/_vendor/plugin-image/types.d.ts +16 -1
  69. package/_vendor/plugin-laser/canvasRender.d.ts +2 -0
  70. package/_vendor/plugin-laser/editorRuntime.d.ts +2 -0
  71. package/_vendor/plugin-laser/index.d.ts +2 -2
  72. package/_vendor/plugin-text/canvasRender.d.ts +5 -0
  73. package/_vendor/plugin-text/editorRuntime.d.ts +5 -0
  74. package/_vendor/plugin-text/host/RichTextLinkPopover.d.ts +14 -0
  75. package/_vendor/plugin-text/host/richTextRendering.d.ts +9 -1
  76. package/_vendor/plugin-text/index.d.ts +2 -0
  77. package/_vendor/plugin-text/richTextLinks.d.ts +3 -0
  78. package/_vendor/plugin-text/richTextUtils.d.ts +2 -1
  79. package/browser/indexedDb.d.ts +10 -0
  80. package/browser/persistence.d.ts +2 -4
  81. package/builtins/controller/createBuiltInCanvasController.d.ts +1 -1
  82. package/builtins/controller/layerController.d.ts +1 -1
  83. package/builtins/controller/shapeCreationController.d.ts +6 -2
  84. package/builtins/index.d.ts +1 -1
  85. package/chrome/toolbar/CanvasKitWheelCapture.d.ts +2 -0
  86. package/chrome/{FloatingSelectionToolbarPageSpace.d.ts → toolbar/FloatingSelectionToolbarPageSpace.d.ts} +1 -1
  87. package/{core/features → chrome}/toolbar/toolbarLabels.d.ts +1 -1
  88. package/chrome/{bindings → toolbar}/useToolbarSurfaces.d.ts +2 -2
  89. package/chrome/types.d.ts +12 -8
  90. package/chrome/useCanvasKitChromeContext.d.ts +6 -4
  91. package/chrome/{bindings/useCanvasKitLayerTree.d.ts → useCanvasKitLayerTree.d.ts} +1 -1
  92. package/chrome/{bindings/useContextMenuSurface.d.ts → useContextMenuSurface.d.ts} +3 -3
  93. package/chrome/useHistoryControls.d.ts +12 -0
  94. package/chrome/usePageControls.d.ts +16 -0
  95. package/chrome/{bindings/useSvgExport.d.ts → useSvgExport.d.ts} +2 -2
  96. package/chrome/useZoomControls.d.ts +9 -0
  97. package/controller/canvasKitController.d.ts +10 -7
  98. package/core/api/apiRegistry.d.ts +12 -0
  99. package/core/index.d.ts +4 -19
  100. package/core/{controller → product-controller}/canvasProductController.d.ts +17 -4
  101. package/core/product-controller/index.d.ts +2 -0
  102. package/core/runtime/productDefinition.d.ts +5 -4
  103. package/core/runtime/productHost.d.ts +5 -2
  104. package/{core/features/actions/canvasActionContext.d.ts → features/actions/actionRuntime.d.ts} +7 -1
  105. package/{core/features → features}/clipboard/clipboardContextMenuContributions.d.ts +1 -1
  106. package/features/clipboard/clipboardContribution.d.ts +11 -0
  107. package/features/clipboard/clipboardHostExtension.d.ts +2 -0
  108. package/{core/features → features}/clipboard/clipboardService.d.ts +3 -3
  109. package/features/context-menu/contextMenuRuntime.d.ts +13 -0
  110. package/{core/features → features}/export/svgExport.d.ts +1 -1
  111. package/features/image/asset/imageAssetService.d.ts +11 -0
  112. package/features/image/{imageBlobStore.d.ts → asset/imageBlobStore.d.ts} +3 -2
  113. package/features/image/asset/imageFileHelpers.d.ts +49 -0
  114. package/features/image/{svgImageAssetInliner.d.ts → asset/svgImageAssetInliner.d.ts} +1 -1
  115. package/features/image/controller/imageProductController.d.ts +27 -0
  116. package/features/image/imageHostExtension.d.ts +10 -5
  117. package/features/image/{ImageImportController.d.ts → import/ImageImportController.d.ts} +3 -3
  118. package/features/image/{useImageImport.d.ts → import/useImageImport.d.ts} +3 -4
  119. package/features/image/index.d.ts +17 -15
  120. package/features/image/smudge/imageSmudgeHostActions.d.ts +10 -0
  121. package/features/image/smudge/imageSmudgeTypes.d.ts +25 -0
  122. package/features/image/toolbar/imageHostActions.d.ts +69 -0
  123. package/features/image/{imageToolbarHostBridge.d.ts → toolbar/imageToolbarHostBridge.d.ts} +2 -2
  124. package/features/keyboard/keyboardShortcutHostExtension.d.ts +2 -0
  125. package/features/keyboard/useCanvasKitKeyboardShortcuts.d.ts +6 -0
  126. package/{react → features/persistence}/CanvasKitPersistenceNotice.d.ts +1 -1
  127. package/features/persistence/persistenceHostExtension.d.ts +2 -0
  128. package/{core/features/actions/canvasActions.d.ts → features/selection/selectionActions.d.ts} +3 -9
  129. package/{core/features/toolbar → features/selection}/selectionContextMenuContributions.d.ts +1 -1
  130. package/features/selection/selectionHostExtension.d.ts +2 -0
  131. package/features/selection/selectionToolbarContributions.d.ts +2 -0
  132. package/features/tool/toolActions.d.ts +2 -0
  133. package/{core/features/toolbar → features/tool}/toolContextMenuContributions.d.ts +1 -1
  134. package/features/tool/toolHostExtension.d.ts +2 -0
  135. package/features/tool/toolToolbarContributions.d.ts +2 -0
  136. package/features/view/viewActions.d.ts +5 -0
  137. package/{core/features/context-menu → features/view}/viewContextMenuContributions.d.ts +1 -1
  138. package/features/view/viewHostExtension.d.ts +2 -0
  139. package/host/defaultHostExtensions.d.ts +2 -0
  140. package/index.d.ts +12 -7
  141. package/index.mjs +96 -76
  142. package/package.json +1 -1
  143. package/product/canvasKitProduct.d.ts +8 -7
  144. package/react/useCanvasKitController.d.ts +1 -1
  145. package/react/useCanvasKitRuntime.d.ts +1 -1
  146. package/runtime/canvasKitHostContracts.d.ts +135 -0
  147. package/runtime/canvasKitHostFeatureHooks.d.ts +12 -0
  148. package/runtime/canvasKitRuntime.d.ts +8 -6
  149. package/runtime/canvasKitRuntimePlan.d.ts +50 -0
  150. package/_vendor/canvas-core/editor/createEditorWithPlugins.d.ts +0 -6
  151. package/_vendor/canvas-react/host/pluginHost.d.ts +0 -2
  152. package/_vendor/canvas-react/host/pluginHostManifest.d.ts +0 -2
  153. package/_vendor/canvas-react/host/pluginHostRuntime.d.ts +0 -3
  154. package/_vendor/canvas-react/host/pluginHostTypes.d.ts +0 -102
  155. package/_vendor/canvas-react/host/pluginHostValidation.d.ts +0 -11
  156. package/_vendor/plugin-arrow/canvas.d.ts +0 -2
  157. package/_vendor/plugin-draw/canvas.d.ts +0 -2
  158. package/_vendor/plugin-eraser/canvas.d.ts +0 -2
  159. package/_vendor/plugin-eraser/editor.d.ts +0 -2
  160. package/_vendor/plugin-image/canvas.d.ts +0 -2
  161. package/_vendor/plugin-laser/canvas.d.ts +0 -2
  162. package/_vendor/plugin-laser/editor.d.ts +0 -2
  163. package/_vendor/plugin-text/canvas.d.ts +0 -5
  164. package/_vendor/plugin-text/editor.d.ts +0 -5
  165. package/chrome/bindings/useCanvasKitChromeControls.d.ts +0 -27
  166. package/core/controller/featureControllerRegistry.d.ts +0 -12
  167. package/core/controller/index.d.ts +0 -4
  168. package/core/features/clipboard/clipboardContribution.d.ts +0 -19
  169. package/core/features/context-menu/contextMenuActions.d.ts +0 -12
  170. package/core/features/context-menu/contextMenuContext.d.ts +0 -6
  171. package/core/features/context-menu/contextMenuContribution.d.ts +0 -4
  172. package/core/features/hostActionIds.d.ts +0 -1
  173. package/core/features/toolbar/toolbarContribution.d.ts +0 -4
  174. package/core/runtime/productContributions.d.ts +0 -9
  175. package/features/image/imageAssetService.d.ts +0 -7
  176. package/features/image/imageFileHelpers.d.ts +0 -35
  177. package/features/image/imageHostActions.d.ts +0 -36
  178. package/features/image/imageProductController.d.ts +0 -22
  179. package/features/image/imageProductToolbarActions.d.ts +0 -2
  180. package/react/useCanvasKitKeyboardShortcuts.d.ts +0 -6
  181. package/runtime/canvasKitHostExtensions.d.ts +0 -19
  182. package/runtime/canvasKitRuntimeInitializer.d.ts +0 -11
  183. /package/chrome/{CanvasKitFloatingToolbarLayer.d.ts → toolbar/CanvasKitFloatingToolbarLayer.d.ts} +0 -0
  184. /package/core/{controller → product-controller}/productLayerTree.d.ts +0 -0
@@ -0,0 +1,63 @@
1
+ import type { Editor, ShapeId } from "../canvas-core/index";
2
+ import type { ImageShapeRecord } from "./types";
3
+ export declare const IMAGE_SMUDGE_TOOLBAR_ACTION_ID = "image.smudge";
4
+ export declare const IMAGE_SMUDGE_CANCEL_TOOLBAR_ACTION_ID = "image.smudge.cancel";
5
+ export declare const IMAGE_SMUDGE_CONFIRM_TOOLBAR_ACTION_ID = "image.smudge.confirm";
6
+ export declare const IMAGE_SMUDGE_BRUSH_SIZE_TOOLBAR_ACTION_ID = "image.smudge.brush-size";
7
+ export declare const IMAGE_SMUDGE_BRUSH_COLOR_TOOLBAR_ACTION_ID = "image.smudge.brush-color";
8
+ export declare const IMAGE_SMUDGE_HISTORY_MARK_PREFIX = "image.smudge:";
9
+ export declare const IMAGE_SMUDGE_MODE_ENTRY_MARK_PREFIX = "image.smudge:edit:";
10
+ export declare const DEFAULT_IMAGE_SMUDGE_BRUSH_SIZE = 24;
11
+ export declare const DEFAULT_IMAGE_SMUDGE_BRUSH_COLOR = "#ffff00";
12
+ export declare const IMAGE_SMUDGE_BRUSH_SIZE_MIN = 1;
13
+ export declare const IMAGE_SMUDGE_BRUSH_SIZE_MAX = 128;
14
+ export interface ImageSmudgeBrush {
15
+ size: number;
16
+ color?: string;
17
+ opacity?: number;
18
+ }
19
+ export interface ImageSmudgeStrokePoint {
20
+ x: number;
21
+ y: number;
22
+ pressure?: number;
23
+ }
24
+ export interface ImageSmudgeStroke {
25
+ id: string;
26
+ points: ImageSmudgeStrokePoint[];
27
+ brush: ImageSmudgeBrush;
28
+ }
29
+ export interface ImageSmudgeConfirmInput {
30
+ replace?: boolean;
31
+ }
32
+ export type ImageSmudgeSessionSnapshot = Readonly<{
33
+ shapeId: ShapeId;
34
+ brush: ImageSmudgeBrush;
35
+ strokes: readonly ImageSmudgeStroke[];
36
+ }>;
37
+ type ImageSmudgeSubscriber = () => void;
38
+ type ImageSmudgeConfirmHandler = (input?: ImageSmudgeConfirmInput) => Promise<unknown>;
39
+ export declare function getImageSmudgeModeMarkId(shapeId: ShapeId): string;
40
+ export declare function isImageSmudgeModeForShape(shape: ImageShapeRecord, markId: string | null | undefined): boolean;
41
+ export declare function isImageSmudgeToolbarActionId(actionId: string): boolean;
42
+ export declare function normalizeImageSmudgeBrush(brush?: Partial<ImageSmudgeBrush>): ImageSmudgeBrush;
43
+ export declare function startImageSmudgeSession({ brush, editor, shape, }: {
44
+ brush?: Partial<ImageSmudgeBrush>;
45
+ editor: Editor;
46
+ shape: ImageShapeRecord;
47
+ }): boolean;
48
+ export declare function cancelImageSmudgeSession(editor: Editor): void;
49
+ export declare function completeImageSmudgeSession(editor: Editor): void;
50
+ export declare function cancelImageSmudgeSessionIfActive(editor: Editor): boolean;
51
+ export declare function clearImageSmudgeSessionForShape(editor: Editor, shapeId: ShapeId): void;
52
+ export declare function updateImageSmudgeBrush(editor: Editor, brush: Partial<ImageSmudgeBrush>): boolean;
53
+ export declare function getImageSmudgeSessionSnapshot(editor: Editor, shapeId: ShapeId): ImageSmudgeSessionSnapshot | null;
54
+ export declare function getActiveImageSmudgeSession(editor: Editor): ImageSmudgeSessionSnapshot | null;
55
+ export declare function subscribeImageSmudgeSession(editor: Editor, subscriber: ImageSmudgeSubscriber): () => void;
56
+ export declare function beginImageSmudgeStroke(editor: Editor, point: ImageSmudgeStrokePoint): void;
57
+ export declare function addImageSmudgeStrokePoint(editor: Editor, point: ImageSmudgeStrokePoint): void;
58
+ export declare function appendImageSmudgeStrokePoint(editor: Editor, point: ImageSmudgeStrokePoint): void;
59
+ export declare function endImageSmudgeStroke(editor: Editor): void;
60
+ export declare function registerImageSmudgeConfirmHandler(editor: Editor, handler: ImageSmudgeConfirmHandler): () => void;
61
+ export declare function requestImageSmudgeConfirm(editor: Editor, input?: ImageSmudgeConfirmInput): Promise<unknown>;
62
+ export declare function cloneImageSmudgeStrokes(strokes: readonly ImageSmudgeStroke[]): ImageSmudgeStroke[];
63
+ export {};
@@ -0,0 +1,2 @@
1
+ import { type LandInteractionHandler } from "../canvas-core/index";
2
+ export declare function createImageSmudgeInteractionHandler(): LandInteractionHandler;
@@ -0,0 +1,2 @@
1
+ import type { CanvasAction } from "../canvas-core/index";
2
+ export declare function createImageSmudgeCanvasActions(): CanvasAction[];
@@ -0,0 +1,17 @@
1
+ import { type CanvasAction, type ToolbarGroup } from "../canvas-core/index";
2
+ export declare function createImageStyleCanvasActions(): CanvasAction[];
3
+ export declare function createImageCornerRadiusToolbarGroup({ dataUiPrefix, id, order, }: {
4
+ dataUiPrefix: string;
5
+ id: string;
6
+ order: number;
7
+ }): ToolbarGroup;
8
+ export declare function createImageCornerRadiusToolbarItem({ dataUiPrefix, }: {
9
+ dataUiPrefix: string;
10
+ }): {
11
+ kind: "text-input";
12
+ id: string;
13
+ actionId: string;
14
+ label: string;
15
+ placeholder: string;
16
+ dataUi: string;
17
+ };
@@ -0,0 +1,3 @@
1
+ import type { ContextMenuContribution, ToolbarContribution } from "../canvas-core/index";
2
+ export declare function createImageToolbarContributions(): ToolbarContribution[];
3
+ export declare function createImageContextMenuContributions(): ContextMenuContribution[];
@@ -1,9 +1,24 @@
1
1
  import { type AssetId, type AssetRecordBase, type BaseRecord, type ShapeRecordBase } from "../canvas-core/index";
2
+ export type ImageRemoteCopyState = {
3
+ status: "pending-local-copy";
4
+ } | {
5
+ status: "copy-failed";
6
+ errorMessage?: string;
7
+ };
8
+ export type ImageAssetSource = {
9
+ kind: "local";
10
+ storageKey: string;
11
+ originalUrl?: string;
12
+ } | {
13
+ kind: "remote";
14
+ url: string;
15
+ copyState?: ImageRemoteCopyState;
16
+ };
2
17
  export interface ImageAssetProps {
3
18
  w: number;
4
19
  h: number;
5
20
  name: string;
6
- storageKey: string;
21
+ source: ImageAssetSource;
7
22
  mimeType: string | null;
8
23
  fileSize?: number;
9
24
  isAnimated: boolean;
@@ -0,0 +1,2 @@
1
+ import { type LandCanvasRenderPlugin } from "../canvas-react/host/index";
2
+ export declare function createLaserCanvasRenderPlugin(): LandCanvasRenderPlugin;
@@ -0,0 +1,2 @@
1
+ import { type LandEditorRuntimePlugin } from "../canvas-core/index";
2
+ export declare function createLaserEditorRuntimePlugin(): LandEditorRuntimePlugin;
@@ -1,4 +1,4 @@
1
1
  export { LaserTool } from "./laserTool";
2
- export { createLaserCanvasPlugin } from "./canvas";
3
- export { createLaserEditorPlugin } from "./editor";
2
+ export { createLaserCanvasRenderPlugin } from "./canvasRender";
3
+ export { createLaserEditorRuntimePlugin } from "./editorRuntime";
4
4
  export { Laser, createLaserFeatureBundle } from "./feature";
@@ -0,0 +1,5 @@
1
+ import { type TextFontCatalog } from "./textFonts";
2
+ import { type LandCanvasRenderPlugin } from "../canvas-react/host/index";
3
+ export declare function createTextCanvasRenderPlugin({ fontCatalog, }?: {
4
+ fontCatalog?: TextFontCatalog;
5
+ }): LandCanvasRenderPlugin;
@@ -0,0 +1,5 @@
1
+ import { type LandEditorRuntimePlugin } from "../canvas-core/index";
2
+ import { type TextFontCatalog } from "./textFonts";
3
+ export declare function createTextEditorRuntimePlugin({ fontCatalog, }?: {
4
+ fontCatalog?: TextFontCatalog;
5
+ }): LandEditorRuntimePlugin;
@@ -0,0 +1,14 @@
1
+ export interface RichTextLinkHoverState {
2
+ href: string;
3
+ path: readonly number[];
4
+ rect: DOMRect;
5
+ }
6
+ export declare function RichTextLinkPopover({ link, onApply, onKeepVisible, onClear, }: {
7
+ link: RichTextLinkHoverState | null;
8
+ onApply(input: {
9
+ path: readonly number[];
10
+ href: string | null;
11
+ }): void;
12
+ onKeepVisible(): void;
13
+ onClear(): void;
14
+ }): import("react").ReactPortal | null;
@@ -1,3 +1,11 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { RichTextDocument } from "../textTypes";
3
- export declare function renderRichTextDocument(richText: RichTextDocument): ReactNode;
3
+ export interface RichTextRenderLinkHandlers {
4
+ onPointerEnter?(input: {
5
+ href: string;
6
+ path: readonly number[];
7
+ element: HTMLSpanElement;
8
+ }): void;
9
+ onPointerLeave?(): void;
10
+ }
11
+ export declare function renderRichTextDocument(richText: RichTextDocument, linkHandlers?: RichTextRenderLinkHandlers): ReactNode;
@@ -1,4 +1,6 @@
1
1
  export { Text, createTextFeatureBundle } from "./feature";
2
+ export { createTextEditorRuntimePlugin } from "./editorRuntime";
3
+ export { createTextCanvasRenderPlugin } from "./canvasRender";
2
4
  export { DEFAULT_TEXT_FONT, HOST_TEXT_FONT, createDefaultTextFontCatalog, createDefaultTextExtensionOptions, } from "./textFonts";
3
5
  export { createRichTextFromPlainText, getPlainTextFromRichText, validateRichTextDocument, } from "./richTextUtils";
4
6
  export { isTextShapeRecord, updateTextShapeRichText, } from "./textShapeHelpers";
@@ -0,0 +1,3 @@
1
+ export declare function normalizeRichTextLinkHref(value: string): string | null;
2
+ export declare function isAllowedRichTextLinkHref(value: string): boolean;
3
+ export declare function openRichTextLink(href: string): void;
@@ -7,7 +7,7 @@ export type RichTextTextNode = JSONContent & {
7
7
  export interface RichTextMarkStyle {
8
8
  fontWeight?: number;
9
9
  fontStyle?: "italic";
10
- textDecorationLine?: "line-through";
10
+ textDecorationLine?: string;
11
11
  }
12
12
  export declare function createRichTextFromPlainText(text: string): RichTextDocument;
13
13
  export declare function getPlainTextFromRichText(richTextDocument: RichTextDocument): string;
@@ -16,3 +16,4 @@ export declare function renderRichTextDocumentToHtml(richText: RichTextDocument)
16
16
  export declare function isRichTextTextNode(node: JSONContent): node is RichTextTextNode;
17
17
  export declare function getRichTextTextNodeStyle(node: RichTextTextNode): string | undefined;
18
18
  export declare function getRichTextMarkStyle(marks: JSONContent["marks"]): RichTextMarkStyle | undefined;
19
+ export declare function getRichTextLinkHref(marks: JSONContent["marks"]): string | undefined;
@@ -0,0 +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,12 +1,10 @@
1
1
  import type { Editor, StoreSnapshot } from "../_vendor/canvas-core/index";
2
2
  import type { ProductPersistenceAdapter } from "../core/runtime/productDefinition";
3
3
  import { type PersistedEditorSnapshots } from "./localSnapshotRestore";
4
- export declare const LAND_DOCUMENT_INDEXEDDB_NAME = "land.canvas.persistence";
5
- export declare const LAND_DOCUMENT_INDEXEDDB_STORE = "snapshots";
6
- export declare const LAND_IMAGE_BLOB_INDEXEDDB_STORE = "imageBlobs";
4
+ import { LAND_DOCUMENT_INDEXEDDB_NAME, LAND_DOCUMENT_INDEXEDDB_STORE, LAND_DOCUMENT_INDEXEDDB_VERSION, LAND_IMAGE_BLOB_INDEXEDDB_STORE } from "./indexedDb";
7
5
  export declare const LAND_DOCUMENT_STORAGE_KEY = "land.canvas.document";
8
6
  export declare const LAND_SESSION_STORAGE_KEY = "land.canvas.session";
9
- export declare const LAND_DOCUMENT_INDEXEDDB_VERSION = 2;
7
+ export { LAND_DOCUMENT_INDEXEDDB_NAME, LAND_DOCUMENT_INDEXEDDB_STORE, LAND_DOCUMENT_INDEXEDDB_VERSION, LAND_IMAGE_BLOB_INDEXEDDB_STORE, };
10
8
  export interface LocalSnapshotPersistenceOptions {
11
9
  storageNamespace?: string;
12
10
  }
@@ -1,5 +1,5 @@
1
1
  import type { ShapeId } from "../../_vendor/canvas-core/index";
2
- import type { CanvasProductController, CanvasProductControllerSnapshot, CanvasProductControllerOptions, CanvasProductSessionSnapshot } from "../../core/controller";
2
+ import type { CanvasProductController, CanvasProductControllerSnapshot, CanvasProductControllerOptions, CanvasProductSessionSnapshot } from "../../core/product-controller";
3
3
  import { type BuiltInCanvasShapeCreationControllers } from "./shapeCreationController";
4
4
  import { type BuiltInCanvasLayerNode } from "./layerController";
5
5
  export interface BuiltInCanvasControllerSnapshot<TToolId extends string = string> extends CanvasProductControllerSnapshot<TToolId> {
@@ -1,6 +1,6 @@
1
1
  import type { AssetId, Editor } from "../../_vendor/canvas-core/index";
2
2
  import type { GeoShapeKind } from "../../_vendor/plugin-geo/index";
3
- import type { CanvasProductLayerNode } from "../../core/controller";
3
+ import type { CanvasProductLayerNode } from "../../core/product-controller";
4
4
  export interface BuiltInCanvasLayerNode extends CanvasProductLayerNode {
5
5
  geoKind?: GeoShapeKind;
6
6
  imageAssetId?: AssetId | null;
@@ -1,7 +1,8 @@
1
1
  import type { Editor, ShapeColor, ShapeId } from "../../_vendor/canvas-core/index";
2
2
  import { type ArrowShapeProps } from "../../_vendor/plugin-arrow/index";
3
+ import type { GeoShapeProps } from "../../_vendor/plugin-geo/index";
3
4
  import { type TextShapeProps } from "../../_vendor/plugin-text/index";
4
- import type { CanvasProductShapeRef } from "../../core/controller";
5
+ import type { CanvasProductShapeRef } from "../../core/product-controller";
5
6
  export interface BuiltInCanvasShapeInput {
6
7
  x: number;
7
8
  y: number;
@@ -12,6 +13,9 @@ export interface BuiltInCanvasShapeInput {
12
13
  strokeWidth?: number;
13
14
  meta?: Record<string, unknown>;
14
15
  }
16
+ export interface BuiltInCanvasRectangleInput extends BuiltInCanvasShapeInput {
17
+ cornerRadiusPercent?: GeoShapeProps["cornerRadiusPercent"];
18
+ }
15
19
  export interface BuiltInCanvasTextInput {
16
20
  x: number;
17
21
  y: number;
@@ -53,7 +57,7 @@ export interface BuiltInCanvasArrowInput {
53
57
  meta?: Record<string, unknown>;
54
58
  }
55
59
  export interface BuiltInGeoController {
56
- createRectangle(input: BuiltInCanvasShapeInput): CanvasProductShapeRef | null;
60
+ createRectangle(input: BuiltInCanvasRectangleInput): CanvasProductShapeRef | null;
57
61
  createEllipse(input: BuiltInCanvasShapeInput): CanvasProductShapeRef | null;
58
62
  createDiamond(input: BuiltInCanvasShapeInput): CanvasProductShapeRef | null;
59
63
  createTriangle(input: BuiltInCanvasShapeInput): CanvasProductShapeRef | null;
@@ -2,4 +2,4 @@ export { builtInCanvasExtensions, createBuiltInCanvasExtensions, hasBuiltInCanva
2
2
  export type { BuiltInCanvasExtension, BuiltInCanvasExtensionOptions, } from "./extensions";
3
3
  export { createBuiltInCanvasController, useBuiltInCanvasController, } from "./controller/createBuiltInCanvasController";
4
4
  export type { BuiltInCanvasController, BuiltInCanvasControllerSnapshot, BuiltInCanvasLayerNode, } from "./controller/createBuiltInCanvasController";
5
- export type { BuiltInArrowController, BuiltInCanvasArrowBindingInput, BuiltInCanvasArrowInput, BuiltInCanvasFrameInput, BuiltInCanvasShapeCreationControllers, BuiltInCanvasShapeInput, BuiltInCanvasTextInput, BuiltInFrameController, BuiltInGeoController, BuiltInTextController, } from "./controller/shapeCreationController";
5
+ export type { BuiltInArrowController, BuiltInCanvasArrowBindingInput, BuiltInCanvasArrowInput, BuiltInCanvasFrameInput, BuiltInCanvasRectangleInput, BuiltInCanvasShapeCreationControllers, BuiltInCanvasShapeInput, BuiltInCanvasTextInput, BuiltInFrameController, BuiltInGeoController, BuiltInTextController, } from "./controller/shapeCreationController";
@@ -0,0 +1,2 @@
1
+ import { type RefObject } from "react";
2
+ export declare function useCanvasKitWheelCapture(ref: RefObject<HTMLElement | null>): void;
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
- import type { ToolbarSurfaces } from "./bindings/useToolbarSurfaces";
2
+ import type { ToolbarSurfaces } from "./useToolbarSurfaces";
3
3
  export declare function FloatingSelectionToolbarPageSpace({ children, className, dataUi, offset, surfaces, }: {
4
4
  children: ReactNode;
5
5
  className?: string;
@@ -1,4 +1,4 @@
1
- import { type ToolbarGroup } from "../../../_vendor/canvas-core/index";
1
+ import { type ToolbarGroup } from "../../_vendor/canvas-core/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;
@@ -1,5 +1,5 @@
1
1
  import type { Editor, CanvasActionContext, ToolbarGroup } from "../../_vendor/canvas-core/index";
2
- import type { CanvasPluginHostRuntime } from "../../_vendor/canvas-react/host/index";
2
+ import type { CanvasRenderPluginHostRuntime } from "../../_vendor/canvas-react/host/index";
3
3
  export interface FloatingSelectionToolbarPageAnchor {
4
4
  x: number;
5
5
  y: number;
@@ -22,5 +22,5 @@ export interface ToolbarSurfaces {
22
22
  export declare function useToolbarSurfaces({ canShowContextToolbarDuringEditing, editor, pluginHostRuntime, }: {
23
23
  canShowContextToolbarDuringEditing?: (context: CanvasActionContext) => boolean;
24
24
  editor: Editor;
25
- pluginHostRuntime: CanvasPluginHostRuntime;
25
+ pluginHostRuntime: CanvasRenderPluginHostRuntime;
26
26
  }): ToolbarSurfaces;
package/chrome/types.d.ts CHANGED
@@ -1,16 +1,20 @@
1
1
  import type { CanvasKitController, CanvasKitBaseController } from "../controller/canvasKitController";
2
2
  import type { BuiltInCanvasLayerNode } from "../builtins";
3
3
  import type { ActiveContextMenu, EditorSelectionState, ShapeId, CanvasActionValue, CanvasActionContext } from "../_vendor/canvas-core/index";
4
- import type { HistoryControls, PageControls, ZoomControlsState } from "./bindings/useCanvasKitChromeControls";
5
- import type { ContextMenuSurface } from "./bindings/useContextMenuSurface";
6
- import type { SvgExportControls } from "./bindings/useSvgExport";
7
- import type { ToolbarSurfaces } from "./bindings/useToolbarSurfaces";
4
+ import type { HistoryControls } from "./useHistoryControls";
5
+ import type { PageControls } from "./usePageControls";
6
+ import type { ZoomControlsState } from "./useZoomControls";
7
+ import type { ContextMenuSurface } from "./useContextMenuSurface";
8
+ import type { SvgExportControls } from "./useSvgExport";
9
+ import type { ToolbarSurfaces } from "./toolbar/useToolbarSurfaces";
8
10
  import type { ProductPersistenceStatus } from "../core";
9
11
  export type { ContextMenuCommandItem, ContextMenuItem, ContextMenuSection, EditorSelectionState, ShapeId, CanvasActionValue, CanvasActionContext, ToolbarGroup, ToolbarItem, } from "../_vendor/canvas-core/index";
10
- export type { HistoryControls, PageControls, ZoomControlsState, } from "./bindings/useCanvasKitChromeControls";
11
- export type { ContextMenuSurface } from "./bindings/useContextMenuSurface";
12
- export type { SvgExportControls, } from "./bindings/useSvgExport";
13
- export type { ToolbarSurfaces, } from "./bindings/useToolbarSurfaces";
12
+ export type { HistoryControls } from "./useHistoryControls";
13
+ export type { PageControls } from "./usePageControls";
14
+ export type { ZoomControlsState } from "./useZoomControls";
15
+ export type { ContextMenuSurface } from "./useContextMenuSurface";
16
+ export type { SvgExportControls, } from "./useSvgExport";
17
+ export type { ToolbarSurfaces, } from "./toolbar/useToolbarSurfaces";
14
18
  export type CanvasKitLayerNode = BuiltInCanvasLayerNode;
15
19
  export interface CanvasKitToolbarActionState {
16
20
  value: CanvasActionValue | undefined;
@@ -2,15 +2,17 @@ import { type RefObject } from "react";
2
2
  import { type ActiveContextMenu } from "../_vendor/canvas-core/index";
3
3
  import type { CanvasKitBaseController } from "../controller/canvasKitController";
4
4
  import type { CanvasKitRuntime } from "../runtime/canvasKitRuntime";
5
- import type { CanvasKitHostExtension } from "../runtime/canvasKitHostExtensions";
6
- import type { ProductServiceRegistry } from "../core";
5
+ import type { CanvasKitChromeSlot, CanvasKitHostFeature } from "../runtime/canvasKitHostContracts";
6
+ import type { ProductApiRegistry, ProductServiceRegistry } from "../core";
7
7
  import type { CanvasKitChromeContext, CanvasKitGridControls, CanvasKitPersistenceControls } from "./types";
8
- export declare function useCanvasKitChromeContext<TController extends CanvasKitBaseController>({ controller, activeContextMenu, editor, grid, hostExtensions, onActiveContextMenuChange, persistence, pluginHostRuntime, services, themeRootRef, }: {
8
+ export declare function useCanvasKitChromeContext<TController extends CanvasKitBaseController>({ apis, controller, activeContextMenu, chromeSlots, editor, grid, hostFeatures, onActiveContextMenuChange, persistence, pluginHostRuntime, services, themeRootRef, }: {
9
+ apis: ProductApiRegistry;
9
10
  controller: TController;
10
11
  activeContextMenu: ActiveContextMenu | null;
12
+ chromeSlots: readonly CanvasKitChromeSlot<string, unknown>[];
11
13
  editor: CanvasKitRuntime["editor"];
12
14
  grid: CanvasKitGridControls;
13
- hostExtensions: readonly CanvasKitHostExtension[];
15
+ hostFeatures: readonly CanvasKitHostFeature[];
14
16
  onActiveContextMenuChange: (activeContextMenu: ActiveContextMenu | null) => void;
15
17
  persistence: CanvasKitPersistenceControls;
16
18
  pluginHostRuntime: CanvasKitRuntime["pluginHostRuntime"];
@@ -1,4 +1,4 @@
1
- import type { CanvasKitLayerTreeSource, CanvasKitLayerNode } from "../types";
1
+ import type { CanvasKitLayerTreeSource, CanvasKitLayerNode } from "./types";
2
2
  export declare function useCanvasKitLayerTree(source: CanvasKitLayerTreeSource, options?: {
3
3
  enabled?: boolean;
4
4
  pageId?: string;
@@ -1,5 +1,5 @@
1
- import type { ContextMenuContext, ActiveContextMenu, ContextMenuSection, Editor } from "../../_vendor/canvas-core/index";
2
- import type { CanvasPluginHostRuntime } from "../../_vendor/canvas-react/host/index";
1
+ import type { ContextMenuContext, ActiveContextMenu, ContextMenuSection, Editor } from "../_vendor/canvas-core/index";
2
+ import type { CanvasRenderPluginHostRuntime } from "../_vendor/canvas-react/host/index";
3
3
  export interface ContextMenuSurface {
4
4
  context: ContextMenuContext | null;
5
5
  activeContextMenu: ActiveContextMenu | null;
@@ -8,5 +8,5 @@ export interface ContextMenuSurface {
8
8
  export declare function useContextMenuSurface({ editor, activeContextMenu, pluginHostRuntime, }: {
9
9
  editor: Editor;
10
10
  activeContextMenu: ActiveContextMenu | null;
11
- pluginHostRuntime: CanvasPluginHostRuntime;
11
+ pluginHostRuntime: CanvasRenderPluginHostRuntime;
12
12
  }): ContextMenuSurface;
@@ -0,0 +1,12 @@
1
+ import type { Editor } from "../_vendor/canvas-core/index";
2
+ import type { CanvasKitHostFeature } from "../runtime/canvasKitHostContracts";
3
+ export interface HistoryControls {
4
+ canUndo: boolean;
5
+ canRedo: boolean;
6
+ undo(): void;
7
+ redo(): void;
8
+ }
9
+ export declare function useHistoryControls({ editor, hostFeatures, }: {
10
+ editor: Editor;
11
+ hostFeatures: readonly CanvasKitHostFeature[];
12
+ }): HistoryControls;
@@ -0,0 +1,16 @@
1
+ import type { Editor, PageId, PageRecord } from "../_vendor/canvas-core/index";
2
+ import type { CanvasKitHostFeature } from "../runtime/canvasKitHostContracts";
3
+ export interface PageControls {
4
+ pages: readonly PageRecord[];
5
+ currentPage: PageRecord | null;
6
+ currentPageId: PageId;
7
+ canDeleteCurrentPage: boolean;
8
+ createPage(): void;
9
+ deleteCurrentPage(): void;
10
+ renameCurrentPage(nextName: string): void;
11
+ selectPage(pageId: PageId): void;
12
+ }
13
+ export declare function usePageControls({ editor, hostFeatures, }: {
14
+ editor: Editor;
15
+ hostFeatures: readonly CanvasKitHostFeature[];
16
+ }): PageControls;
@@ -1,6 +1,6 @@
1
1
  import { type RefObject } from "react";
2
- import type { Editor, ShapeId } from "../../_vendor/canvas-core/index";
3
- import { type ExportStatus as ProductExportStatus, type SvgAssetInliner as ProductSvgAssetInliner, type SvgExportResult as ProductSvgExportResult } from "../../core";
2
+ import type { Editor, ShapeId } from "../_vendor/canvas-core/index";
3
+ import { type ExportStatus as ProductExportStatus, type SvgAssetInliner as ProductSvgAssetInliner, type SvgExportResult as ProductSvgExportResult } from "../features/export/svgExport";
4
4
  export type ExportStatus = ProductExportStatus;
5
5
  export type SvgAssetInliner = ProductSvgAssetInliner;
6
6
  export type SvgExportResult = ProductSvgExportResult;
@@ -0,0 +1,9 @@
1
+ import type { Editor } from "../_vendor/canvas-core/index";
2
+ export interface ZoomControlsState {
3
+ zoom: number;
4
+ label: string;
5
+ zoomIn(): void;
6
+ zoomOut(): void;
7
+ resetZoom(): void;
8
+ }
9
+ export declare function useZoomControls(editor: Editor): ZoomControlsState;
@@ -1,24 +1,27 @@
1
- import { type CanvasProductController, type CanvasProductControllerContext, type CanvasProductSessionSnapshot } from "../core/controller";
2
- import type { CanvasPluginHostRuntime } from "../_vendor/canvas-react/host/index";
3
- import { type BuiltInCanvasController, type BuiltInCanvasControllerSnapshot, type BuiltInCanvasFrameInput, type BuiltInCanvasShapeInput, type BuiltInCanvasTextInput } from "../builtins";
4
- import { type ImageProductController } from "../features/image";
1
+ import { type CanvasProductController, type CanvasProductControllerContext, type CanvasProductSessionSnapshot } from "../core/product-controller";
2
+ import type { CanvasRenderPluginHostRuntime } from "../_vendor/canvas-react/host/index";
3
+ import { type BuiltInCanvasController, type BuiltInCanvasControllerSnapshot, type BuiltInCanvasFrameInput, type BuiltInCanvasRectangleInput, type BuiltInCanvasShapeInput, type BuiltInCanvasTextInput } from "../builtins";
4
+ import type { CanvasKitControllerSlot } from "../runtime/canvasKitHostContracts";
5
5
  export type CanvasKitShapeInput = BuiltInCanvasShapeInput;
6
+ export type CanvasKitRectangleInput = BuiltInCanvasRectangleInput;
6
7
  export type CanvasKitTextInput = BuiltInCanvasTextInput;
7
8
  export type CanvasKitFrameInput = BuiltInCanvasFrameInput;
8
9
  export interface CanvasKitBaseController<TToolId extends string = string> extends CanvasProductController<TToolId> {
9
10
  }
11
+ export interface CanvasKitControllerSlots {
12
+ }
10
13
  export declare const CANVAS_KIT_TOOL_IDS: readonly ["select", "hand", "rectangle", "ellipse", "diamond", "triangle", "hexagon", "star", "arrow", "draw", "path", "text", "frame", "eraser", "laser"];
11
14
  export type CanvasKitToolId = (typeof CANVAS_KIT_TOOL_IDS)[number];
12
15
  export interface CanvasKitControllerSnapshot<TToolId extends string = CanvasKitToolId> extends BuiltInCanvasControllerSnapshot<TToolId> {
13
16
  productId: string;
14
17
  session: CanvasProductSessionSnapshot<TToolId>;
15
18
  }
16
- export interface CanvasKitController<TToolId extends string = CanvasKitToolId> extends BuiltInCanvasController<TToolId> {
17
- image: ImageProductController | null;
19
+ export interface CanvasKitController<TToolId extends string = CanvasKitToolId> extends BuiltInCanvasController<TToolId>, CanvasKitControllerSlots {
18
20
  snapshot(): CanvasKitControllerSnapshot<TToolId>;
19
21
  }
20
22
  export interface CanvasKitControllerRuntimeContext extends Omit<CanvasProductControllerContext, "pluginHostRuntime"> {
21
- pluginHostRuntime: CanvasPluginHostRuntime;
23
+ controllerSlots: readonly CanvasKitControllerSlot<string, unknown>[];
24
+ pluginHostRuntime: CanvasRenderPluginHostRuntime;
22
25
  }
23
26
  export interface CanvasKitControllerOptions<TToolId extends string = CanvasKitToolId> extends CanvasKitControllerRuntimeContext {
24
27
  assertToolId?: (toolId: string) => asserts toolId is TToolId;
@@ -0,0 +1,12 @@
1
+ export interface ProductApiToken<TApi> {
2
+ readonly id: string;
3
+ readonly __api?: TApi;
4
+ }
5
+ export interface ProductApiRegistry {
6
+ get<TApi>(token: ProductApiToken<TApi>): TApi | null;
7
+ }
8
+ export interface ProductApiRegistryRuntime extends ProductApiRegistry {
9
+ register<TApi>(token: ProductApiToken<TApi>, api: TApi): void;
10
+ }
11
+ export declare function createProductApiToken<TApi>(id: string): ProductApiToken<TApi>;
12
+ export declare function createProductApiRegistry(): ProductApiRegistryRuntime;
package/core/index.d.ts CHANGED
@@ -1,24 +1,9 @@
1
1
  export { createDefaultCanvasProductEditor } from "./runtime/productEditor";
2
2
  export { cleanupProductAssetsAfterRestore, preloadProductAssets, resolveProductAssetUrl, } from "./runtime/productAssets";
3
- export { createProductFeatureControllerRegistry, createProductFeatureControllerToken, } from "./controller/featureControllerRegistry";
3
+ export { createProductApiRegistry, createProductApiToken, } from "./api/apiRegistry";
4
4
  export { createProductServiceRegistry, createProductServiceToken, requireProductService, } from "./runtime/productServices";
5
- export { CANVAS_KIT_HOST_ACTION_IDS } from "./features/hostActionIds";
6
5
  export type { CanvasProductRuntimeInitializer, CanvasProductRuntimeInitializerContext, CreateCanvasProductEditorOptions, ProductPersistenceAdapter, ProductPersistenceRestoreResult, ProductPersistenceStatus, } from "./runtime/productDefinition";
7
- export type { CanvasProductRuntimeContribution, } from "./runtime/productContributions";
8
- export type { ProductContextMenuRegistry, ProductPluginHostRuntime, ProductToolbarRegistry, } from "./runtime/productHost";
6
+ export type { ProductActionRegistry, ProductContextMenuRegistry, ProductPluginHostRuntime, ProductToolbarRegistry, } from "./runtime/productHost";
9
7
  export type { ProductAssetResolverService, ProductServiceFactory, ProductServiceFactoryContext, ProductServiceRegistry, ProductServiceRegistryRuntime, ProductServiceToken, } from "./runtime/productServices";
10
- export type { ProductFeatureControllerRegistry, ProductFeatureControllerRegistryRuntime, ProductFeatureControllerToken, } from "./controller/featureControllerRegistry";
11
- export type { CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductShapeData, CanvasProductShapeUpdate, } from "./controller";
12
- export { SYSTEM_SELECTION_BRING_FORWARD_ACTION_ID, SYSTEM_SELECTION_BRING_TO_FRONT_ACTION_ID, SYSTEM_SELECTION_DELETE_ACTION_ID, SYSTEM_SELECTION_DUPLICATE_ACTION_ID, SYSTEM_SELECTION_FLIP_HORIZONTAL_ACTION_ID, SYSTEM_SELECTION_FLIP_VERTICAL_ACTION_ID, SYSTEM_SELECTION_GROUP_ACTION_ID, SYSTEM_SELECTION_RESET_ROTATION_ACTION_ID, SYSTEM_SELECTION_SELECT_ALL_ACTION_ID, SYSTEM_SELECTION_SEND_BACKWARD_ACTION_ID, SYSTEM_SELECTION_SEND_TO_BACK_ACTION_ID, SYSTEM_SELECTION_UNGROUP_ACTION_ID, runCanvasAction, } from "./features/actions/canvasActions";
13
- export { createToolbarProductContribution } from "./features/toolbar/toolbarContribution";
14
- export { createCanvasActionContext } from "./features/actions/canvasActionContext";
15
- export { getActiveToolLabel, getSelectionToolbarTitle, } from "./features/toolbar/toolbarLabels";
16
- export { SYSTEM_VIEW_RESET_ZOOM_ACTION_ID, SYSTEM_VIEW_ZOOM_IN_ACTION_ID, SYSTEM_VIEW_ZOOM_OUT_ACTION_ID, runContextMenuAction, } from "./features/context-menu/contextMenuActions";
17
- export { createContextMenuProductContribution } from "./features/context-menu/contextMenuContribution";
18
- export { createContextMenuContext, getContextMenuContributionTarget, } from "./features/context-menu/contextMenuContext";
19
- export { canvasClipboardServiceToken, memoryCanvasClipboardService, } from "./features/clipboard/clipboardService";
20
- export type { CanvasClipboardService } from "./features/clipboard/clipboardService";
21
- export { SYSTEM_CLIPBOARD_COPY_ACTION_ID, SYSTEM_CLIPBOARD_CUT_ACTION_ID, SYSTEM_CLIPBOARD_PASTE_ACTION_ID, SYSTEM_CLIPBOARD_PASTE_AT_POINT_ACTION_ID, createClipboardProductContribution, registerClipboardActions, } from "./features/clipboard/clipboardContribution";
22
- export { getCanvasClipboardService, } from "./features/clipboard/clipboardService";
23
- export { exportEditorSvg, getSvgExportStatus, } from "./features/export/svgExport";
24
- export type { ExportStatus, SvgAssetInliner, SvgExportOptions, SvgExportResult, } from "./features/export/svgExport";
8
+ export type { ProductApiRegistry, ProductApiRegistryRuntime, ProductApiToken, } from "./api/apiRegistry";
9
+ export type { CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductCreatePageInput, CanvasProductDocumentRef, CanvasProductShapeData, CanvasProductShapeUpdate, } from "./product-controller";
@@ -1,6 +1,6 @@
1
1
  import type { Camera, ChangeSource, Editor, LayerOrderDirection, LayerOrderEdge, ReparentShapePlacementFailureReason, ShapeId } from "../../_vendor/canvas-core/index";
2
2
  import type { ProductServiceRegistry } from "../runtime/productServices";
3
- import type { ProductFeatureControllerRegistry } from "./featureControllerRegistry";
3
+ import type { ProductApiRegistry } from "../api/apiRegistry";
4
4
  export interface CanvasProductShapeRef {
5
5
  id: ShapeId;
6
6
  type: string;
@@ -52,8 +52,13 @@ export interface CanvasProductSessionSnapshot<TToolId extends string = string> {
52
52
  isToolLocked: boolean;
53
53
  pages: CanvasProductSessionPageState[];
54
54
  }
55
+ export interface CanvasProductDocumentRef {
56
+ id: string;
57
+ meta: Record<string, unknown>;
58
+ }
55
59
  export interface CanvasProductControllerSnapshot<TToolId extends string = string> {
56
60
  productId: string;
61
+ document: CanvasProductDocumentRef;
57
62
  pageId: string;
58
63
  activeToolId: TToolId;
59
64
  selectedShapeIds: ShapeId[];
@@ -105,9 +110,14 @@ export interface CanvasProductPageRef {
105
110
  id: string;
106
111
  name: string;
107
112
  index: string;
113
+ meta: Record<string, unknown>;
114
+ }
115
+ export interface CanvasProductCreatePageInput {
116
+ name?: string;
117
+ meta?: Record<string, unknown>;
108
118
  }
109
119
  export interface CanvasProductController<TToolId extends string = string> {
110
- features: ProductFeatureControllerRegistry;
120
+ apis: ProductApiRegistry;
111
121
  snapshot(): CanvasProductControllerSnapshot<TToolId>;
112
122
  subscribe(listener: CanvasProductControllerChangeListener<TToolId>): () => void;
113
123
  clearHistory(): void;
@@ -115,6 +125,8 @@ export interface CanvasProductController<TToolId extends string = string> {
115
125
  canRedo(): boolean;
116
126
  undo(): boolean;
117
127
  redo(): boolean;
128
+ getDocument(): CanvasProductDocumentRef;
129
+ updateDocumentMeta(patch: Record<string, unknown>): CanvasProductDocumentRef;
118
130
  select(ids: ShapeId[]): void;
119
131
  selectAll(): void;
120
132
  deleteSelection(): void;
@@ -139,8 +151,9 @@ export interface CanvasProductController<TToolId extends string = string> {
139
151
  setCamera(camera: Partial<Camera>, pageId?: string): void;
140
152
  resetView(): void;
141
153
  getPages(): CanvasProductPageRef[];
142
- createPage(name?: string): CanvasProductPageRef;
154
+ createPage(input?: CanvasProductCreatePageInput): CanvasProductPageRef;
143
155
  renamePage(pageId: string, name: string): void;
156
+ updatePageMeta(pageId: string, patch: Record<string, unknown>): string | null;
144
157
  deletePage(pageId: string): boolean;
145
158
  selectPage(pageId: string): void;
146
159
  exportSelectionSvg(): string | null;
@@ -150,7 +163,7 @@ export interface CanvasProductControllerContext {
150
163
  editor: Editor;
151
164
  services: ProductServiceRegistry;
152
165
  pluginHostRuntime: unknown;
153
- featureControllers: ProductFeatureControllerRegistry;
166
+ apis: ProductApiRegistry;
154
167
  productId: string;
155
168
  }
156
169
  export interface CanvasProductControllerOptions<TToolId extends string = string> extends CanvasProductControllerContext {
@@ -0,0 +1,2 @@
1
+ export { createCanvasProductController } from "./canvasProductController";
2
+ export type { CanvasProductController, CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductControllerContext, CanvasProductControllerOptions, CanvasProductControllerSnapshot, CanvasProductCreatePageInput, CanvasProductDocumentRef, CanvasProductLayerActionState, CanvasProductLayerNode, CanvasProductLayerPlacement, CanvasProductLayerPlacementFailureReason, CanvasProductLayerPlacementResult, CanvasProductPageRef, CanvasProductShapeData, CanvasProductSessionPageState, CanvasProductSessionSnapshot, CanvasProductShapeRef, CanvasProductShapeUpdate, } from "./canvasProductController";