@yuzhouu/canvas-kit 0.1.6 → 0.1.8

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 (186) hide show
  1. package/README.md +5 -1
  2. package/_vendor/canvas-core/editor/commands.d.ts +11 -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 +6 -6
  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 +14 -5
  16. package/_vendor/canvas-core/shapes/types.d.ts +2 -2
  17. package/_vendor/canvas-react/components/CanvasView.d.ts +3 -3
  18. package/_vendor/canvas-react/components/useCanvasDomEvents.d.ts +2 -0
  19. package/_vendor/canvas-react/host/actionRegistry.d.ts +15 -0
  20. package/_vendor/canvas-react/host/{canvasPlugin.d.ts → canvasRenderPlugin.d.ts} +5 -5
  21. package/_vendor/canvas-react/host/canvasRenderPluginHost.d.ts +2 -0
  22. package/_vendor/canvas-react/host/canvasRenderPluginHostManifest.d.ts +2 -0
  23. package/_vendor/canvas-react/host/canvasRenderPluginHostRuntime.d.ts +3 -0
  24. package/_vendor/canvas-react/host/canvasRenderPluginHostTypes.d.ts +104 -0
  25. package/_vendor/canvas-react/host/canvasRenderPluginHostValidation.d.ts +11 -0
  26. package/_vendor/canvas-react/host/contextMenuRegistry.d.ts +8 -3
  27. package/_vendor/canvas-react/host/domEventGuards.d.ts +3 -3
  28. package/_vendor/canvas-react/host/extension.d.ts +4 -4
  29. package/_vendor/canvas-react/host/index.d.ts +5 -4
  30. package/_vendor/canvas-react/host/overlayRegistry.d.ts +3 -3
  31. package/_vendor/canvas-react/host/rendererRegistry.d.ts +3 -3
  32. package/_vendor/canvas-react/host/toolbarRegistry.d.ts +9 -13
  33. package/_vendor/plugin-arrow/arrowShapeUtil.d.ts +4 -3
  34. package/_vendor/plugin-arrow/arrowTerminalCommands.d.ts +1 -0
  35. package/_vendor/plugin-arrow/canvasRender.d.ts +2 -0
  36. package/_vendor/plugin-arrow/{editor.d.ts → editorRuntime.d.ts} +2 -2
  37. package/_vendor/plugin-arrow/index.d.ts +2 -2
  38. package/_vendor/plugin-draw/canvasRender.d.ts +2 -0
  39. package/_vendor/plugin-draw/{editor.d.ts → editorRuntime.d.ts} +2 -2
  40. package/_vendor/plugin-draw/index.d.ts +2 -2
  41. package/_vendor/plugin-eraser/canvasRender.d.ts +2 -0
  42. package/_vendor/plugin-eraser/editorRuntime.d.ts +2 -0
  43. package/_vendor/plugin-eraser/index.d.ts +2 -2
  44. package/_vendor/plugin-frame/{canvas.d.ts → canvasRender.d.ts} +2 -2
  45. package/_vendor/plugin-frame/{editor.d.ts → editorRuntime.d.ts} +2 -2
  46. package/_vendor/plugin-frame/index.d.ts +2 -2
  47. package/_vendor/plugin-geo/{canvas.d.ts → canvasRender.d.ts} +2 -2
  48. package/_vendor/plugin-geo/{editor.d.ts → editorRuntime.d.ts} +2 -2
  49. package/_vendor/plugin-geo/geoGeometry.d.ts +19 -3
  50. package/_vendor/plugin-geo/index.d.ts +2 -2
  51. package/_vendor/plugin-geo/types.d.ts +1 -0
  52. package/_vendor/plugin-group/{canvas.d.ts → canvasRender.d.ts} +2 -2
  53. package/_vendor/plugin-group/{editor.d.ts → editorRuntime.d.ts} +2 -2
  54. package/_vendor/plugin-group/index.d.ts +2 -2
  55. package/_vendor/plugin-image/{editor.d.ts → actionIds.d.ts} +1 -8
  56. package/_vendor/plugin-image/canvasRender.d.ts +2 -0
  57. package/_vendor/plugin-image/cornerRadius.d.ts +6 -0
  58. package/_vendor/plugin-image/cropRuntime.d.ts +2 -0
  59. package/_vendor/plugin-image/editorRuntime.d.ts +5 -0
  60. package/_vendor/plugin-image/imageHostActionContract.d.ts +2 -0
  61. package/_vendor/plugin-image/imageShapeUtil.d.ts +2 -1
  62. package/_vendor/plugin-image/imageSvgExporter.d.ts +6 -0
  63. package/_vendor/plugin-image/index.d.ts +8 -4
  64. package/_vendor/plugin-image/runtimeShared.d.ts +5 -0
  65. package/_vendor/plugin-image/smudge.d.ts +56 -0
  66. package/_vendor/plugin-image/smudgeInteractions.d.ts +2 -0
  67. package/_vendor/plugin-image/smudgeRuntime.d.ts +2 -0
  68. package/_vendor/plugin-image/styleRuntime.d.ts +17 -0
  69. package/_vendor/plugin-image/toolbarRuntime.d.ts +3 -0
  70. package/_vendor/plugin-image/types.d.ts +17 -1
  71. package/_vendor/plugin-laser/canvasRender.d.ts +2 -0
  72. package/_vendor/plugin-laser/editorRuntime.d.ts +2 -0
  73. package/_vendor/plugin-laser/index.d.ts +2 -2
  74. package/_vendor/plugin-text/canvasRender.d.ts +5 -0
  75. package/_vendor/plugin-text/editorRuntime.d.ts +5 -0
  76. package/_vendor/plugin-text/host/RichTextLinkPopover.d.ts +14 -0
  77. package/_vendor/plugin-text/host/richTextRendering.d.ts +9 -1
  78. package/_vendor/plugin-text/index.d.ts +2 -0
  79. package/_vendor/plugin-text/richTextLinks.d.ts +3 -0
  80. package/_vendor/plugin-text/richTextUtils.d.ts +2 -1
  81. package/browser/indexedDb.d.ts +10 -0
  82. package/browser/persistence.d.ts +2 -4
  83. package/builtins/controller/createBuiltInCanvasController.d.ts +1 -1
  84. package/builtins/controller/layerController.d.ts +1 -1
  85. package/builtins/controller/shapeCreationController.d.ts +9 -2
  86. package/builtins/index.d.ts +1 -1
  87. package/chrome/toolbar/CanvasKitWheelCapture.d.ts +2 -0
  88. package/chrome/{FloatingSelectionToolbarPageSpace.d.ts → toolbar/FloatingSelectionToolbarPageSpace.d.ts} +1 -1
  89. package/{core/features → chrome}/toolbar/toolbarLabels.d.ts +1 -1
  90. package/chrome/{bindings → toolbar}/useToolbarSurfaces.d.ts +2 -2
  91. package/chrome/types.d.ts +12 -8
  92. package/chrome/useCanvasKitChromeContext.d.ts +6 -4
  93. package/chrome/{bindings/useCanvasKitLayerTree.d.ts → useCanvasKitLayerTree.d.ts} +1 -1
  94. package/chrome/{bindings/useContextMenuSurface.d.ts → useContextMenuSurface.d.ts} +3 -3
  95. package/chrome/useHistoryControls.d.ts +12 -0
  96. package/chrome/usePageControls.d.ts +16 -0
  97. package/chrome/{bindings/useSvgExport.d.ts → useSvgExport.d.ts} +2 -2
  98. package/chrome/useZoomControls.d.ts +9 -0
  99. package/controller/canvasKitController.d.ts +10 -7
  100. package/core/api/apiRegistry.d.ts +12 -0
  101. package/core/index.d.ts +4 -19
  102. package/core/{controller → product-controller}/canvasProductController.d.ts +53 -4
  103. package/core/product-controller/index.d.ts +2 -0
  104. package/core/runtime/productDefinition.d.ts +5 -4
  105. package/core/runtime/productHost.d.ts +5 -2
  106. package/{core/features/actions/canvasActionContext.d.ts → features/actions/actionRuntime.d.ts} +7 -1
  107. package/{core/features → features}/clipboard/clipboardContextMenuContributions.d.ts +1 -1
  108. package/features/clipboard/clipboardContribution.d.ts +11 -0
  109. package/features/clipboard/clipboardHostExtension.d.ts +2 -0
  110. package/{core/features → features}/clipboard/clipboardService.d.ts +3 -3
  111. package/features/context-menu/contextMenuRuntime.d.ts +13 -0
  112. package/{core/features → features}/export/svgExport.d.ts +1 -1
  113. package/features/image/asset/imageAssetService.d.ts +11 -0
  114. package/features/image/{imageBlobStore.d.ts → asset/imageBlobStore.d.ts} +3 -2
  115. package/features/image/asset/imageFileHelpers.d.ts +49 -0
  116. package/features/image/{svgImageAssetInliner.d.ts → asset/svgImageAssetInliner.d.ts} +1 -1
  117. package/features/image/controller/imageProductController.d.ts +27 -0
  118. package/features/image/imageHostExtension.d.ts +10 -5
  119. package/features/image/{ImageImportController.d.ts → import/ImageImportController.d.ts} +3 -3
  120. package/features/image/{useImageImport.d.ts → import/useImageImport.d.ts} +3 -4
  121. package/features/image/index.d.ts +17 -15
  122. package/features/image/smudge/imageSmudgeHostActions.d.ts +10 -0
  123. package/features/image/smudge/imageSmudgeTypes.d.ts +24 -0
  124. package/features/image/toolbar/imageHostActions.d.ts +69 -0
  125. package/features/image/{imageToolbarHostBridge.d.ts → toolbar/imageToolbarHostBridge.d.ts} +2 -2
  126. package/features/keyboard/keyboardShortcutHostExtension.d.ts +2 -0
  127. package/features/keyboard/useCanvasKitKeyboardShortcuts.d.ts +6 -0
  128. package/{react → features/persistence}/CanvasKitPersistenceNotice.d.ts +1 -1
  129. package/features/persistence/persistenceHostExtension.d.ts +2 -0
  130. package/{core/features/actions/canvasActions.d.ts → features/selection/selectionActions.d.ts} +3 -9
  131. package/{core/features/toolbar → features/selection}/selectionContextMenuContributions.d.ts +1 -1
  132. package/features/selection/selectionHostExtension.d.ts +2 -0
  133. package/features/selection/selectionToolbarContributions.d.ts +2 -0
  134. package/features/tool/toolActions.d.ts +2 -0
  135. package/{core/features/toolbar → features/tool}/toolContextMenuContributions.d.ts +1 -1
  136. package/features/tool/toolHostExtension.d.ts +2 -0
  137. package/features/tool/toolToolbarContributions.d.ts +2 -0
  138. package/features/view/viewActions.d.ts +5 -0
  139. package/{core/features/context-menu → features/view}/viewContextMenuContributions.d.ts +1 -1
  140. package/features/view/viewHostExtension.d.ts +2 -0
  141. package/host/defaultHostExtensions.d.ts +2 -0
  142. package/index.d.ts +13 -7
  143. package/index.mjs +96 -74
  144. package/package.json +1 -1
  145. package/product/canvasKitProduct.d.ts +8 -7
  146. package/react/useCanvasKitController.d.ts +1 -1
  147. package/react/useCanvasKitRuntime.d.ts +1 -1
  148. package/runtime/canvasKitHostContracts.d.ts +135 -0
  149. package/runtime/canvasKitHostFeatureHooks.d.ts +12 -0
  150. package/runtime/canvasKitRuntime.d.ts +8 -6
  151. package/runtime/canvasKitRuntimePlan.d.ts +50 -0
  152. package/_vendor/canvas-core/editor/createEditorWithPlugins.d.ts +0 -6
  153. package/_vendor/canvas-react/host/pluginHost.d.ts +0 -2
  154. package/_vendor/canvas-react/host/pluginHostManifest.d.ts +0 -2
  155. package/_vendor/canvas-react/host/pluginHostRuntime.d.ts +0 -3
  156. package/_vendor/canvas-react/host/pluginHostTypes.d.ts +0 -102
  157. package/_vendor/canvas-react/host/pluginHostValidation.d.ts +0 -11
  158. package/_vendor/plugin-arrow/canvas.d.ts +0 -2
  159. package/_vendor/plugin-draw/canvas.d.ts +0 -2
  160. package/_vendor/plugin-eraser/canvas.d.ts +0 -2
  161. package/_vendor/plugin-eraser/editor.d.ts +0 -2
  162. package/_vendor/plugin-image/canvas.d.ts +0 -2
  163. package/_vendor/plugin-laser/canvas.d.ts +0 -2
  164. package/_vendor/plugin-laser/editor.d.ts +0 -2
  165. package/_vendor/plugin-text/canvas.d.ts +0 -5
  166. package/_vendor/plugin-text/editor.d.ts +0 -5
  167. package/chrome/bindings/useCanvasKitChromeControls.d.ts +0 -27
  168. package/core/controller/featureControllerRegistry.d.ts +0 -12
  169. package/core/controller/index.d.ts +0 -4
  170. package/core/features/clipboard/clipboardContribution.d.ts +0 -19
  171. package/core/features/context-menu/contextMenuActions.d.ts +0 -12
  172. package/core/features/context-menu/contextMenuContext.d.ts +0 -6
  173. package/core/features/context-menu/contextMenuContribution.d.ts +0 -4
  174. package/core/features/hostActionIds.d.ts +0 -1
  175. package/core/features/toolbar/toolbarContribution.d.ts +0 -4
  176. package/core/runtime/productContributions.d.ts +0 -9
  177. package/features/image/imageAssetService.d.ts +0 -7
  178. package/features/image/imageFileHelpers.d.ts +0 -35
  179. package/features/image/imageHostActions.d.ts +0 -36
  180. package/features/image/imageProductController.d.ts +0 -22
  181. package/features/image/imageProductToolbarActions.d.ts +0 -2
  182. package/react/useCanvasKitKeyboardShortcuts.d.ts +0 -6
  183. package/runtime/canvasKitHostExtensions.d.ts +0 -19
  184. package/runtime/canvasKitRuntimeInitializer.d.ts +0 -11
  185. /package/chrome/{CanvasKitFloatingToolbarLayer.d.ts → toolbar/CanvasKitFloatingToolbarLayer.d.ts} +0 -0
  186. /package/core/{controller → product-controller}/productLayerTree.d.ts +0 -0
package/README.md CHANGED
@@ -116,11 +116,15 @@ confirmation.
116
116
 
117
117
  The public product remains opaque. Internally, `defineCanvasKit()` resolves options into explicit product fields:
118
118
 
119
- - `LandExtension[]` installs editor/canvas plugins through `@land/canvas-react/host`.
119
+ - `LandExtension[]` installs editor/canvas render plugins through `@land/canvas-react/host`.
120
120
  - `CanvasKitHostExtension[]` installs product-host behavior such as clipboard, toolbar, context menu, image import, asset URL resolution, SVG asset inlining, and controller components.
121
121
  - Service factories and asset resolver tokens wire product-level services into runtime.
122
122
  - `CanvasKitRuntime` creates services, the plugin host runtime, the editor, controller registry, and then runs product runtime setup.
123
123
 
124
+ Advanced products can pass additional `hostExtensions` to `defineCanvasKit()`
125
+ for product-host behavior that should compose with the built-in runtime instead
126
+ of being hard-coded in chrome or canvas runtime modules.
127
+
124
128
  This keeps app chrome on the root package controller while keeping browser-specific host behavior out of concrete shape plugins and out of `canvas-core`.
125
129
 
126
130
  ## Public Exports
@@ -1,6 +1,6 @@
1
1
  import type { Editor } from "./editor";
2
2
  import type { ChangeSource } from "../../store/index";
3
- import type { AssetId, AssetRecord, AssetRecordBase, BindingId, BindingRecordBase, BindingRecord, Camera, PageId, PageRecord, ShapeId, ShapeParentId, ShapeRecordBase, ShapeRecord, ShapeEditingEntryMode } from "../schema/records";
3
+ import type { AssetId, AssetRecord, AssetRecordBase, BindingId, BindingRecordBase, BindingRecord, Camera, DocumentMetadataRecord, PageId, PageRecord, ShapeId, ShapeParentId, ShapeRecordBase, ShapeRecord, ShapeEditingEntryMode } from "../schema/records";
4
4
  export interface EditorCommandOptions {
5
5
  source?: ChangeSource;
6
6
  }
@@ -43,6 +43,7 @@ export interface ShapeUpdate {
43
43
  parentId?: ShapeParentId;
44
44
  index?: string;
45
45
  props?: Record<string, unknown>;
46
+ meta?: Record<string, unknown>;
46
47
  }
47
48
  export interface ReparentShapesInput {
48
49
  ids: ShapeId[];
@@ -83,6 +84,13 @@ export interface RenamePageInput {
83
84
  id: PageId;
84
85
  name: string;
85
86
  }
87
+ export interface UpdateDocumentMetaInput {
88
+ patch: Record<string, unknown>;
89
+ }
90
+ export interface UpdatePageMetaInput {
91
+ id: PageId;
92
+ patch: Record<string, unknown>;
93
+ }
86
94
  export interface MovePageInput {
87
95
  id: PageId;
88
96
  toIndex: number;
@@ -95,6 +103,8 @@ export interface EditorCommands {
95
103
  createPage(input?: CreatePageInput, options?: EditorCommandOptions): PageRecord;
96
104
  deletePage(id: PageId, options?: EditorCommandOptions): boolean;
97
105
  renamePage(input: RenamePageInput, options?: EditorCommandOptions): void;
106
+ updateDocumentMeta(input: UpdateDocumentMetaInput, options?: EditorCommandOptions): DocumentMetadataRecord;
107
+ updatePageMeta(input: UpdatePageMetaInput, options?: EditorCommandOptions): PageRecord | null;
98
108
  movePage(input: MovePageInput, options?: EditorCommandOptions): void;
99
109
  createShapes(inputs: CreateShapeInput[], options?: EditorCommandOptions): ShapeRecord[];
100
110
  /**
@@ -0,0 +1,6 @@
1
+ import { type LandEditorRuntimePlugin } from "../plugins";
2
+ import { Editor, type EditorOptions } from "./editor";
3
+ export interface CreateEditorWithRuntimePluginsOptions extends Omit<EditorOptions, "shapeUtils" | "shapeSvgExporters" | "bindingUtils" | "shapeCapabilities"> {
4
+ editorRuntimePlugins?: readonly LandEditorRuntimePlugin[];
5
+ }
6
+ export declare function createEditorWithRuntimePlugins(options?: CreateEditorWithRuntimePluginsOptions): Editor;
@@ -5,7 +5,7 @@ import { BindingUtilRegistry } from "../bindings/bindingUtilRegistry";
5
5
  import { Box } from "../geometry/box";
6
6
  import { Mat } from "../geometry/mat";
7
7
  import { Vec } from "../geometry/vec";
8
- import { type BindingId, type BindingRecord, type AssetId, type AssetRecord, type Camera, type PageId, type PageRecord, type EditorRecord, type RecordScope, type SessionRecord, type ShapeId, type ShapeParentId, type ShapeRecord, type ShapeEditingEntryRequest, type ShapeEditingSession } from "../schema/records";
8
+ import { type BindingId, type BindingRecord, type AssetId, type AssetRecord, type Camera, type DocumentMetadataRecord, type PageId, type PageRecord, type EditorRecord, type RecordScope, type SessionRecord, type ShapeId, type ShapeParentId, type ShapeRecord, type ShapeEditingEntryRequest, type ShapeEditingSession } from "../schema/records";
9
9
  import { type DocumentSnapshot, type SessionSnapshot } from "../schema/snapshots";
10
10
  import type { ShapeSelectionFlipAxis, ShapeUtil } from "../shapes/shapeUtil";
11
11
  import { ShapeUtilRegistry } from "../shapes/shapeUtilRegistry";
@@ -49,6 +49,7 @@ export interface EditorOptions {
49
49
  shapeCapabilities?: readonly ShapeCapabilityDefinition[];
50
50
  resolveAssetUrl?: (assetId: AssetId) => string | null;
51
51
  documentSnapshot?: unknown;
52
+ documentMeta?: Record<string, unknown>;
52
53
  sessionSnapshot?: unknown;
53
54
  }
54
55
  export interface ContainerBoundsQueryOptions {
@@ -293,6 +294,7 @@ export declare class Editor {
293
294
  readonly selectionOverlaySignal: Signal<SelectionOverlayState | null>;
294
295
  readonly overlayDebugStateSignal: Signal<EditorOverlayDebugState>;
295
296
  constructor(options?: EditorOptions);
297
+ private registerBuiltInInteractions;
296
298
  private registerBuiltInShortcuts;
297
299
  private registerBuiltInSideEffects;
298
300
  dispatch(event: EditorEvent): void;
@@ -304,6 +306,7 @@ export declare class Editor {
304
306
  listen(listener: (change: StoreChange<EditorRecord>) => void): () => void;
305
307
  getRenderItems(): RenderItem[];
306
308
  getPages(): PageRecord[];
309
+ getDocumentMetadataRecord(): DocumentMetadataRecord | undefined;
307
310
  getCurrentPageId(): PageId;
308
311
  getActiveToolId(): string;
309
312
  isToolLocked(): boolean;
@@ -320,6 +323,8 @@ export declare class Editor {
320
323
  createPageAndSelect(input?: CreatePageInput, source?: ChangeSource): PageRecord;
321
324
  selectPage(pageId: PageId, source?: ChangeSource): void;
322
325
  renamePage(pageId: PageId, name: string, source?: ChangeSource): void;
326
+ updateDocumentMeta(patch: Record<string, unknown>, source?: ChangeSource): DocumentMetadataRecord;
327
+ updatePageMeta(pageId: PageId, patch: Record<string, unknown>, source?: ChangeSource): PageRecord | null;
323
328
  deletePage(pageId: PageId, source?: ChangeSource): boolean;
324
329
  setActiveTool(toolId: string, source?: ChangeSource): void;
325
330
  setToolLocked(locked: boolean, source?: ChangeSource): void;
@@ -1,5 +1,5 @@
1
1
  export { Editor } from "./editor";
2
- export { createEditorWithPlugins, type CreateEditorWithPluginsOptions, } from "./createEditorWithPlugins";
2
+ export { createEditorWithRuntimePlugins, type CreateEditorWithRuntimePluginsOptions, } from "./createEditorWithRuntimePlugins";
3
3
  export { StateNode } from "./stateNode";
4
4
  export { HistoryManager } from "./historyManager";
5
5
  export { InputsManager } from "./managers/inputsManager";
@@ -9,7 +9,7 @@ import type { Editor } from "../editor";
9
9
  export declare class DocumentSnapshotManager {
10
10
  private readonly editor;
11
11
  constructor(editor: Editor);
12
- buildInitialRecords(documentSnapshot: unknown, sessionSnapshot: unknown): EditorRecord[];
12
+ buildInitialRecords(documentSnapshot: unknown, sessionSnapshot: unknown, documentMeta?: Record<string, unknown>): EditorRecord[];
13
13
  getDocumentSnapshot(): DocumentSnapshot;
14
14
  getSessionSnapshot(): SessionSnapshot;
15
15
  loadDocumentSnapshot(snapshot: unknown, options?: {
@@ -2,15 +2,20 @@ import { Box } from "../../geometry/box";
2
2
  import { Vec } from "../../geometry/vec";
3
3
  import type { ShapeId } from "../../schema/records";
4
4
  import type { SelectionResizeHandleId } from "../selection";
5
- import type { ResizeSnapInput, SnapAxis, SnapNode, SnapPoint } from "./snapTypes";
5
+ import type { ResizeSnapInput, SnapAxis, SnapNode, SnapPointIndex, SnapPoint } from "./snapTypes";
6
6
  export interface PointSnapPair {
7
7
  selectionPoint: Vec;
8
8
  candidatePoint: Vec;
9
+ candidatePointId: string;
9
10
  candidateNodeId: ShapeId;
10
11
  }
11
12
  export interface PointAxisSnap {
12
13
  type: "points";
14
+ id: string;
13
15
  nudge: number;
16
+ distance: number;
17
+ weight: number;
18
+ candidatePointIds: string[];
14
19
  pairs: PointSnapPair[];
15
20
  }
16
21
  export interface Gap {
@@ -22,11 +27,36 @@ export interface Gap {
22
27
  }
23
28
  export interface GapAxisSnap {
24
29
  type: "gaps";
30
+ id: string;
25
31
  nudge: number;
32
+ distance: number;
26
33
  gaps: Gap[];
27
34
  }
28
35
  export type AxisSnap = PointAxisSnap | GapAxisSnap;
29
- export declare function getPointSnap(axis: SnapAxis, selectionPoints: Vec[], candidatePoints: SnapPoint[], threshold: number): PointAxisSnap | null;
36
+ export interface PointSnapOptions {
37
+ previousCandidatePointIds?: ReadonlySet<string>;
38
+ releaseThreshold?: number;
39
+ switchDistance?: number;
40
+ stats?: PointSnapStats;
41
+ }
42
+ export interface GapSnapOptions {
43
+ previousSnapId?: string | null;
44
+ releaseThreshold?: number;
45
+ switchDistance?: number;
46
+ }
47
+ export interface AxisSnapOptions {
48
+ previousSnap?: {
49
+ type: AxisSnap["type"];
50
+ id: string;
51
+ } | null;
52
+ switchDistance?: number;
53
+ }
54
+ export interface PointSnapStats {
55
+ candidatePointCount: number;
56
+ matchedPointCount: number;
57
+ }
58
+ export declare function buildSnapPointIndex(points: readonly SnapPoint[]): SnapPointIndex;
59
+ export declare function getPointSnap(axis: SnapAxis, selectionPoints: Vec[], pointIndex: SnapPointIndex, threshold: number, options?: PointSnapOptions): PointAxisSnap | null;
30
60
  export declare function getResizeSnapPointsForHandle(handleId: SelectionResizeHandleId | "any", bounds: Box): Vec[];
31
61
  export declare function getResizeResultAfterNudge(input: ResizeSnapInput, nudge: Vec): {
32
62
  bounds: Box;
@@ -36,5 +66,5 @@ export declare function getResizeResultAfterNudge(input: ResizeSnapInput, nudge:
36
66
  export declare function getResizeBoundsAfterNudge(input: ResizeSnapInput, nudge: Vec): Box;
37
67
  export declare function collectGaps(nodes: SnapNode[], axis: SnapAxis): Gap[];
38
68
  export declare function createGap(direction: Gap["direction"], startNode: SnapNode, endNode: SnapNode, axis: SnapAxis): Gap | null;
39
- export declare function getGapSnap(axis: SnapAxis, selectionBounds: Box, visibleGaps: Gap[], threshold: number): GapAxisSnap | null;
40
- export declare function chooseAxisSnap(pointSnap: PointAxisSnap | null, gapSnap: GapAxisSnap | null): AxisSnap | null;
69
+ export declare function getGapSnap(axis: SnapAxis, selectionBounds: Box, visibleGaps: Gap[], threshold: number, options?: GapSnapOptions): GapAxisSnap | null;
70
+ export declare function chooseAxisSnap(pointSnap: PointAxisSnap | null, gapSnap: GapAxisSnap | null, options?: AxisSnapOptions): AxisSnap | null;
@@ -9,9 +9,16 @@ export declare class SnapManager {
9
9
  readonly indicatorsSignal: Signal<SnapIndicatorState[]>;
10
10
  readonly activeSignal: import("../../../signals/index").Computed<boolean>;
11
11
  private readonly snapshots;
12
+ private readonly axisSnapMemory;
12
13
  constructor(editor: Editor);
13
14
  setIndicators(indicators: SnapIndicatorState[]): void;
14
15
  clearIndicators(): void;
16
+ private clearAxisSnapMemory;
17
+ private getSwitchDistance;
18
+ private getReleaseThreshold;
19
+ private updateAxisSnapMemory;
20
+ private writeDebugState;
21
+ private getNow;
15
22
  createTranslateSnapshot({ movingShapeIds, coordinateSpace, }: {
16
23
  movingShapeIds: Iterable<ShapeId>;
17
24
  coordinateSpace: SnapCoordinateSpace;
@@ -4,6 +4,7 @@ import type { ShapeId, ShapeParentId } from "../../schema/records";
4
4
  import type { SelectionHandle, SelectionResizeHandleId, SnapIndicatorState } from "../selection";
5
5
  export type SnapAxis = "x" | "y";
6
6
  export type HandleSnapMode = "none" | "point" | "align";
7
+ export type SnapPointKind = "corner" | "edge_midpoint" | "center" | "custom";
7
8
  export interface SnapCoordinateSpace {
8
9
  rotation: number;
9
10
  rotationCenter: Vec;
@@ -12,6 +13,16 @@ export interface SnapPoint {
12
13
  id: string;
13
14
  nodeId: ShapeId;
14
15
  point: Vec;
16
+ kind?: SnapPointKind;
17
+ weight?: number;
18
+ }
19
+ export interface SnapPointIndexEntry {
20
+ value: number;
21
+ point: SnapPoint;
22
+ }
23
+ export interface SnapPointIndex {
24
+ x: SnapPointIndexEntry[];
25
+ y: SnapPointIndexEntry[];
15
26
  }
16
27
  export interface SnapNode {
17
28
  id: string;
@@ -25,6 +36,8 @@ export interface HandleSnapPoint {
25
36
  id: string;
26
37
  nodeId: ShapeId;
27
38
  point: Vec;
39
+ kind?: SnapPointKind;
40
+ weight?: number;
28
41
  }
29
42
  export interface HandleSnapOutline {
30
43
  id: ShapeId;
@@ -38,6 +51,7 @@ export interface HandleSnapSnapshot {
38
51
  }
39
52
  export interface TranslateSnapSnapshot {
40
53
  points: SnapPoint[];
54
+ pointIndex: SnapPointIndex;
41
55
  nodes: SnapNode[];
42
56
  coordinateSpace: SnapCoordinateSpace;
43
57
  scopeParentId?: ShapeParentId | null;
@@ -56,6 +70,7 @@ export interface TranslateSnapResult {
56
70
  }
57
71
  export interface ResizeSnapSnapshot {
58
72
  points: SnapPoint[];
73
+ pointIndex: SnapPointIndex;
59
74
  nodes: SnapNode[];
60
75
  coordinateSpace: SnapCoordinateSpace;
61
76
  scopeParentId?: ShapeParentId | null;
@@ -0,0 +1,2 @@
1
+ import type { LandInteractionHandler } from "./interactions";
2
+ export declare function createMiddleMousePanInteractionHandler(): LandInteractionHandler;
@@ -1,5 +1,5 @@
1
1
  export { Editor } from "./editor/editor";
2
- export { createEditorWithPlugins, type CreateEditorWithPluginsOptions, } from "./editor/createEditorWithPlugins";
2
+ export { createEditorWithRuntimePlugins, type CreateEditorWithRuntimePluginsOptions, } from "./editor/createEditorWithRuntimePlugins";
3
3
  export { distanceBetweenSegments, distanceToSegment, nearestPointOnSegment, segmentsIntersect, } from "./geometry";
4
4
  export { getShapeGeometry, getShapeExportBounds, getShapeExportPageBounds, getShapeExportToPageTransform, getShapeLocalBounds, getShapeLocalToPageTransform, getShapePositionedOutlineVertices, getShapePositionedToPageTransform, getShapePageBounds, getShapePageCenter, getShapePageCorners, getShapePageOutlineVertices, pagePointToShapePositionedPoint, positionedShapePointToPagePoint, getShapeRenderBounds, getShapeRenderToPageTransform, } from "./editor/queries/shapeTransforms";
5
5
  export type { ShapeGeometry } from "./editor/queries/shapeTransforms";
@@ -15,7 +15,7 @@ export type { ContainerBoundsQueryOptions, EditorPageState, EditorOverlayDebugSt
15
15
  export type { ShapeContainment } from "./editor/managers/queryManager";
16
16
  export type { ShapeAtPointOptions, ShapeLineSegmentHitTestOptions, SpatialQueryOptions, } from "./editor/managers/spatialIndexManager";
17
17
  export type { TerminalBindingTargetInput, ConnectionPoint, ConnectionTerminal, TerminalBindingResolver, TerminalBindingResolverInput, ResolvedTerminalBinding, } from "./bindings/terminalBinding";
18
- export type { EditorCommandOptions, EditorCommands, CreateAssetInput, CreateBindingInput, CreatePageInput, MovePageInput, RenamePageInput, ReparentShapesInput, CreateShapeInput, SetCameraInput, ShapeUpdate, StartEditingShapeInput, UpdateAssetInput, UpdateBindingInput, } from "./editor/commands";
18
+ export type { EditorCommandOptions, EditorCommands, CreateAssetInput, CreateBindingInput, CreatePageInput, MovePageInput, RenamePageInput, ReparentShapesInput, CreateShapeInput, SetCameraInput, ShapeUpdate, StartEditingShapeInput, UpdateAssetInput, UpdateBindingInput, UpdateDocumentMetaInput, UpdatePageMetaInput, } from "./editor/commands";
19
19
  export { reparentShapeToContainingParent } from "./editor/commands";
20
20
  export { isEditorClipboardPayload, } from "./editor/clipboard";
21
21
  export type { ClipboardAssetSidecar, DuplicateSelectionInput, EditorClipboardPayload, PasteClipboardPayloadInput, } from "./editor/clipboard";
@@ -26,9 +26,9 @@ export type { DocumentSnapshot, SessionSnapshot, SnapshotMigration, } from "./sc
26
26
  export { createDocumentSnapshotSupport, filterDocumentSnapshotBySupport, getDocumentSnapshotRequirements, getUnsupportedDocumentSnapshotRequirements, } from "./schema/snapshotSupport";
27
27
  export type { DocumentSnapshotRequirements, DocumentSnapshotSupport, FilterDocumentSnapshotBySupportResult, UnsupportedDocumentSnapshotRequirements, } from "./schema/snapshotSupport";
28
28
  export { ShapeUtil } from "./shapes/shapeUtil";
29
- export type { ShapeBoundsSnapGeometry, ShapeBrushSelectInput, ShapeBrushWrapInput, ShapeBindingPointInput, ShapeBindingTargetHitTestInput, ShapeEditEndResult, ShapeGeometryInput, ShapeHandleSnapContext, ShapeHandleSnapGeometry, ShapeLineSegmentHitTestInput, ShapePointHitTestInput, ShapeSelectionHandleAnchorInput, ShapeSelectionHandleAnchors, ShapeSelectionFrameInput, ShapeSelectionFlipAxis, ShapeSelectionFlipInput, ShapeSelectionOverlayInfo, ShapeSelectionOverlayInfoInput, ShapeSelectionPagePoints, ShapeSelectionPagePointsInput, ShapeSelectionResizeAspectRatioLockInput, ShapeSelectionResizeInput, ShapeSelectionTranslateInput, } from "./shapes/shapeUtil";
29
+ export type { ShapeBoundsSnapGeometry, ShapeBrushSelectInput, ShapeBrushWrapInput, ShapeBindingPointInput, ShapeBindingTargetHitTestInput, ShapeEditEndInput, ShapeEditEndResult, ShapeGeometryInput, ShapeHandleSnapContext, ShapeHandleSnapGeometry, ShapeLineSegmentHitTestInput, ShapePointHitTestInput, ShapeSnapPoint, ShapeSnapPointKind, ShapeSelectionHandleAnchorInput, ShapeSelectionHandleAnchors, ShapeSelectionFrameInput, ShapeSelectionFlipAxis, ShapeSelectionFlipInput, ShapeSelectionOverlayInfo, ShapeSelectionOverlayInfoInput, ShapeSelectionPagePoints, ShapeSelectionPagePointsInput, ShapeSelectionResizeAspectRatioLockInput, ShapeSelectionResizeInput, ShapeSelectionTranslateInput, } from "./shapes/shapeUtil";
30
30
  export type { LaserTrailState } from "./editor/managers/interactionTransientManager";
31
- export type { HandleSnapContext, HandleSnapInput, HandleSnapMode, HandleSnapResult, HandleSnapSnapshot, HandleSnapSnapshotInput, ResizeSnapInput, ResizeSnapResult, ResizeSnapSnapshot, SnapAxis, SnapCoordinateSpace, TranslateSnapInput, TranslateSnapResult, TranslateSnapSnapshot, } from "./editor/managers/snapTypes";
31
+ export type { HandleSnapContext, HandleSnapInput, HandleSnapMode, HandleSnapResult, HandleSnapSnapshot, HandleSnapSnapshotInput, ResizeSnapInput, ResizeSnapResult, ResizeSnapSnapshot, SnapAxis, SnapCoordinateSpace, SnapPointIndex, SnapPointIndexEntry, SnapPointKind, TranslateSnapInput, TranslateSnapResult, TranslateSnapSnapshot, } from "./editor/managers/snapTypes";
32
32
  export { ShapeUtilRegistry } from "./shapes/shapeUtilRegistry";
33
33
  export { resolveTerminalBindingAtPoint, } from "./bindings/terminalBinding";
34
34
  export { ShapeSvgExporterRegistry, exportShapesToSvgString, renderSvgNode, } from "./exports/svg";
@@ -48,10 +48,10 @@ export { SET_ACTIVE_TOOL_TOOLBAR_ACTION_ID, TOGGLE_TOOL_LOCKED_TOOLBAR_ACTION_ID
48
48
  export { LAND_DEFAULT_THEME_COLOR_FALLBACKS, LAND_THEME_COLOR_SLOTS, LAND_THEME_COLOR_TOKEN_BY_SLOT, areShapeColorsEqual, createCustomShapeColor, createThemeShapeColor, getThemeColorTokenName, isCustomShapeColorRef, isShapeColor, isThemeShapeColorRef, isTransparentShapeColor, normalizeShapeColor, resolveShapeColor, shapeColorToCssColor, } from "./shapes/colors";
49
49
  export type { CustomShapeColorRef, ShapeColor, ShapeColorRef, ThemeColorSlot, ThemeColorTokenName, ThemeShapeColorRef, } from "./shapes/colors";
50
50
  export type { ContextMenuBadgeItem, ContextMenuCanvasTarget, ContextMenuCommandItem, ContextMenuContext, ContextMenuContribution, ContextMenuContributionTarget, ContextMenuItem, ActiveContextMenu, ContextMenuSection, ContextMenuSelectionTarget, ContextMenuSeparatorItem, ContextMenuShapeTarget, ContextMenuTarget, } from "./surfaces/contextMenu";
51
- export { getEditorOptionsFromEditorPlugins, setupEditorPlugins, type LandEditorPlugin, } from "./plugins";
51
+ export { getEditorOptionsFromEditorRuntimePlugins, setupEditorRuntimePlugins, type LandEditorRuntimePlugin, } from "./plugins";
52
52
  export type { CanvasAction, CanvasActionRunInput, CanvasActionValue, CanvasActionContext, CanvasSelectionSnapshot, CanvasToolSnapshot, } from "./surfaces/actions";
53
53
  export type { ToolbarBadgeItem, ToolbarButtonItem, ToolbarContribution, ToolbarGroup, ToolbarItem, ToolbarSegmentedItem, ToolbarSegmentedOption, ToolbarSeparatorItem, ToolbarStepperItem, ToolbarStepperOption, ToolbarTextInputItem, ToolbarPlacement, ToolbarSurface, ToolbarSwatchesItem, ToolbarSwatchOption, } from "./surfaces/toolbar";
54
- export { DEFAULT_CAMERA, DEFAULT_PAGE_ID, DEFAULT_SESSION_ID, createDefaultPage, createDefaultSession, isAnyAssetRecord, isAnyBindingRecord, isAnyShapeRecord, isAssetRecord, isBindingRecord, isDocumentRecord, isPageRecord, isSessionRecord, isShapeRecord, type AnyBindingRecord, type AnyAssetRecord, type AnyShapeRecord, type AssetId, type AssetRecord, type AssetRecordBase, type BaseRecord, type BindingId, type BindingRecordBase, type BindingRecord, type Camera, type DocumentRecord, type EditorRecord, type PageCameraById, type PageId, type PageSelectionById, type PageRecord, type RecordScope, type SessionRecord, type ShapeId, type ShapeParentId, type ShapeRecordBase, type ShapeRecord, type ShapeEditingEntryRequest, type ShapeEditingEntryMode, type ShapeEditingPoint, type ShapeEditingSession, } from "./schema/records";
54
+ export { DEFAULT_CAMERA, DEFAULT_DOCUMENT_ID, DEFAULT_PAGE_ID, DEFAULT_SESSION_ID, createDefaultDocument, createDefaultPage, createDefaultSession, isAnyAssetRecord, isAnyBindingRecord, isAnyShapeRecord, isAssetRecord, isBindingRecord, isDocumentRecord, isDocumentMetadataRecord, isPageRecord, isSessionRecord, isShapeRecord, type AnyBindingRecord, type AnyAssetRecord, type AnyShapeRecord, type AssetId, type AssetRecord, type AssetRecordBase, type BaseRecord, type BindingId, type BindingRecordBase, type BindingRecord, type Camera, type DocumentId, type DocumentMetadataRecord, type DocumentRecord, type EditorRecord, type PageCameraById, type PageId, type PageSelectionById, type PageRecord, type RecordScope, type SessionRecord, type ShapeId, type ShapeParentId, type ShapeRecordBase, type ShapeRecord, type ShapeEditingEntryRequest, type ShapeEditingEntryMode, type ShapeEditingPoint, type ShapeEditingSession, } from "./schema/records";
55
55
  export { Vec } from "./geometry/vec";
56
56
  export { Box } from "./geometry/box";
57
57
  export { Mat } from "./geometry/mat";
@@ -7,7 +7,7 @@ import type { ShapeUtil } from "../shapes/shapeUtil";
7
7
  import type { CanvasAction } from "../surfaces/actions";
8
8
  import type { ContextMenuContribution } from "../surfaces/contextMenu";
9
9
  import type { ToolbarContribution } from "../surfaces/toolbar";
10
- export interface LandEditorPlugin {
10
+ export interface LandEditorRuntimePlugin {
11
11
  id: string;
12
12
  shapeCapabilities?: ShapeCapabilityDefinition[];
13
13
  shapeUtils?: ShapeUtil[];
@@ -19,10 +19,10 @@ export interface LandEditorPlugin {
19
19
  contextMenuContributions?: ContextMenuContribution[];
20
20
  setup?(editor: Editor): void;
21
21
  }
22
- export declare function getEditorOptionsFromEditorPlugins(plugins: readonly LandEditorPlugin[]): {
22
+ export declare function getEditorOptionsFromEditorRuntimePlugins(plugins: readonly LandEditorRuntimePlugin[]): {
23
23
  shapeUtils: ShapeUtil[];
24
24
  shapeSvgExporters: ShapeSvgExporter[];
25
25
  bindingUtils: BindingUtil[];
26
26
  shapeCapabilities: ShapeCapabilityDefinition[];
27
27
  };
28
- export declare function setupEditorPlugins(editor: Editor, plugins: readonly LandEditorPlugin[]): void;
28
+ export declare function setupEditorRuntimePlugins(editor: Editor, plugins: readonly LandEditorRuntimePlugin[]): void;
@@ -1 +1 @@
1
- export { getEditorOptionsFromEditorPlugins, setupEditorPlugins, type LandEditorPlugin, } from "./editorPlugin";
1
+ export { getEditorOptionsFromEditorRuntimePlugins, setupEditorRuntimePlugins, type LandEditorRuntimePlugin, } from "./editorRuntimePlugin";
@@ -1,5 +1,6 @@
1
1
  export type RecordScope = "document" | "session";
2
2
  export type PageId = `page:${string}`;
3
+ export type DocumentId = "document:main";
3
4
  export type ShapeId = `shape:${string}`;
4
5
  export type BindingId = `binding:${string}`;
5
6
  export type AssetId = `asset:${string}`;
@@ -36,6 +37,11 @@ export interface BaseRecord {
36
37
  scope: RecordScope;
37
38
  meta: Record<string, unknown>;
38
39
  }
40
+ export interface DocumentMetadataRecord extends BaseRecord {
41
+ id: DocumentId;
42
+ typeName: "document";
43
+ scope: "document";
44
+ }
39
45
  export interface PageRecord extends BaseRecord {
40
46
  id: PageId;
41
47
  typeName: "page";
@@ -94,14 +100,17 @@ export interface SessionRecord extends BaseRecord {
94
100
  pageCameraById: PageCameraById;
95
101
  pageSelectedShapeIdsById: PageSelectionById;
96
102
  }
97
- export type DocumentRecord = PageRecord | AnyShapeRecord | AnyBindingRecord | AnyAssetRecord;
103
+ export type DocumentRecord = DocumentMetadataRecord | PageRecord | AnyShapeRecord | AnyBindingRecord | AnyAssetRecord;
98
104
  export type EditorRecord = DocumentRecord | SessionRecord;
105
+ export declare const DEFAULT_DOCUMENT_ID: DocumentId;
99
106
  export declare const DEFAULT_PAGE_ID: PageId;
100
107
  export declare const DEFAULT_SESSION_ID: SessionId;
101
108
  export declare const DEFAULT_CAMERA: Camera;
109
+ export declare function createDefaultDocument(meta?: Record<string, unknown>): DocumentMetadataRecord;
102
110
  export declare function createDefaultPage(): PageRecord;
103
111
  export declare function createDefaultSession(currentPageId?: PageId): SessionRecord;
104
112
  export declare function isPageRecord(record: BaseRecord | null | undefined): record is PageRecord;
113
+ export declare function isDocumentMetadataRecord(record: BaseRecord | null | undefined): record is DocumentMetadataRecord;
105
114
  export declare function isShapeRecord(record: BaseRecord | null | undefined): record is ShapeRecord;
106
115
  export declare function isAnyShapeRecord(record: BaseRecord | null | undefined): record is AnyShapeRecord;
107
116
  export declare function isSessionRecord(record: BaseRecord | null | undefined): record is SessionRecord;
@@ -9,6 +9,9 @@ import type { ShapeId, ShapeRecordBase } from "../schema/records";
9
9
  export interface ShapeEditEndResult {
10
10
  deleteShapeIds?: ShapeId[];
11
11
  }
12
+ export interface ShapeEditEndInput {
13
+ editor: Editor;
14
+ }
12
15
  export interface ShapeBindingPointInput {
13
16
  rawPagePoint: Vec;
14
17
  oppositePagePoint: Vec;
@@ -65,8 +68,14 @@ export interface ShapePointHitTestInput extends ShapeGeometryInput {
65
68
  }
66
69
  export interface ShapeBindingTargetHitTestInput extends ShapePointHitTestInput {
67
70
  }
71
+ export type ShapeSnapPointKind = "corner" | "edge_midpoint" | "center" | "custom";
72
+ export interface ShapeSnapPoint {
73
+ point: Vec;
74
+ kind?: ShapeSnapPointKind;
75
+ weight?: number;
76
+ }
68
77
  export interface ShapeBoundsSnapGeometry {
69
- points?: readonly Vec[];
78
+ points?: readonly ShapeSnapPoint[];
70
79
  }
71
80
  export interface ShapeHandleSnapContext {
72
81
  shapeId: ShapeId;
@@ -74,9 +83,9 @@ export interface ShapeHandleSnapContext {
74
83
  currentPagePoint: Vec;
75
84
  }
76
85
  export interface ShapeHandleSnapGeometry {
77
- points?: readonly Vec[];
86
+ points?: readonly ShapeSnapPoint[];
78
87
  outline?: readonly Vec[] | null;
79
- getSelfSnapPoints?(context: ShapeHandleSnapContext): readonly Vec[];
88
+ getSelfSnapPoints?(context: ShapeHandleSnapContext): readonly ShapeSnapPoint[];
80
89
  getSelfSnapOutline?(context: ShapeHandleSnapContext): readonly Vec[] | null;
81
90
  }
82
91
  export interface ShapeSelectionHandleAnchorInput {
@@ -129,7 +138,7 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
129
138
  isTransformDescendantContainer(_shape: S): boolean;
130
139
  shouldRotateDescendants(shape: S): boolean;
131
140
  canUngroupChildren(_shape: S): boolean;
132
- canStartTranslateFromSelectionBounds(_shape: S): boolean;
141
+ canStartTranslateFromSelectionBounds(_shape: S, _input: ShapeSelectionFrameInput): boolean;
133
142
  canSnap(_shape: S): boolean;
134
143
  getBoundsSnapGeometry(_shape: S): ShapeBoundsSnapGeometry;
135
144
  getHandleSnapGeometry(shape: S): ShapeHandleSnapGeometry;
@@ -143,7 +152,7 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
143
152
  canReceiveChildren(_shape: S): boolean;
144
153
  canReceiveTerminalBinding(_shape: S, _input?: ShapeGeometryInput): boolean;
145
154
  repairLoadedShape(_shape: S): S | null;
146
- onEditEnd(_shape: S): ShapeEditEndResult | void;
155
+ onEditEnd(_shape: S, _input: ShapeEditEndInput): ShapeEditEndResult | void;
147
156
  hitTest(shape: S, positionedPoint: Vec, _input?: ShapePointHitTestInput): boolean;
148
157
  hitTestBindingTarget(shape: S, positionedPoint: Vec, input?: ShapeBindingTargetHitTestInput): boolean;
149
158
  hitTestLineSegment(shape: S, input: ShapeLineSegmentHitTestInput): boolean;
@@ -1,2 +1,2 @@
1
- export type { BindingId, BindingRecord, PageRecord, PageId, EditorRecord, ShapeRecord, ShapeId, SessionRecord, } from "../schema/records";
2
- export { DEFAULT_PAGE_ID, DEFAULT_SESSION_ID, createDefaultPage, createDefaultSession, isBindingRecord, isPageRecord, isShapeRecord, isSessionRecord, } from "../schema/records";
1
+ export type { BindingId, BindingRecord, DocumentId, DocumentMetadataRecord, PageRecord, PageId, EditorRecord, ShapeRecord, ShapeId, SessionRecord, } from "../schema/records";
2
+ export { DEFAULT_DOCUMENT_ID, DEFAULT_PAGE_ID, DEFAULT_SESSION_ID, createDefaultDocument, createDefaultPage, createDefaultSession, isBindingRecord, isDocumentMetadataRecord, isPageRecord, isShapeRecord, isSessionRecord, } from "../schema/records";
@@ -1,11 +1,11 @@
1
1
  import { type ActiveContextMenu } from "../../canvas-core/index";
2
- import type { CanvasPluginComponent, CanvasPluginProvider } from "../host/canvasPlugin";
2
+ import type { CanvasRenderPluginComponent, CanvasRenderPluginProvider } from "../host/canvasRenderPlugin";
3
3
  import { type CanvasRendererRegistry } from "../host/rendererRegistry";
4
4
  import { type CanvasOverlayRegistry } from "../host/overlayRegistry";
5
5
  import { type CanvasDomEventGuardRegistry } from "../host/domEventGuards";
6
6
  export declare function Canvas({ canvasComponents, canvasProviders, domEventGuardRegistry, onContextMenuRequest, overlayRegistry, rendererRegistry, showGrid, }?: {
7
- canvasComponents?: readonly CanvasPluginComponent[];
8
- canvasProviders?: readonly CanvasPluginProvider[];
7
+ canvasComponents?: readonly CanvasRenderPluginComponent[];
8
+ canvasProviders?: readonly CanvasRenderPluginProvider[];
9
9
  domEventGuardRegistry?: CanvasDomEventGuardRegistry;
10
10
  onContextMenuRequest?: (activeContextMenu: ActiveContextMenu) => void;
11
11
  overlayRegistry?: CanvasOverlayRegistry;
@@ -3,12 +3,14 @@ import { type ActiveContextMenu, type Editor, type ShapeEditingSession } from ".
3
3
  import type { CanvasDomEventGuardRegistry } from "../host/domEventGuards";
4
4
  export interface CanvasDomEventHandlers {
5
5
  onPointerDown: (event: ReactPointerEvent<HTMLDivElement>) => void;
6
+ onAuxClick: (event: ReactMouseEvent<HTMLDivElement>) => void;
6
7
  onContextMenu: (event: ReactMouseEvent<HTMLDivElement>) => void;
7
8
  }
8
9
  export interface CanvasDomEventState {
9
10
  containerRef: RefObject<HTMLDivElement | null>;
10
11
  handlers: CanvasDomEventHandlers;
11
12
  isPointerActive: boolean;
13
+ isMiddleButtonPanning: boolean;
12
14
  surfaceCursor: string | undefined;
13
15
  }
14
16
  export declare function useCanvasDomEvents({ activeDomEventGuards, activeToolId, editor, onContextMenuRequest, shapeEditingSession, }: {
@@ -0,0 +1,15 @@
1
+ import type { CanvasAction, LandEditorRuntimePlugin } from "../../canvas-core/index";
2
+ export declare class CanvasActionRegistry {
3
+ private readonly actions;
4
+ private readonly hostActionIds;
5
+ private readonly duplicateActionIds;
6
+ registerAction(action: CanvasAction, options?: {
7
+ replace?: boolean;
8
+ }): void;
9
+ registerHostAction(action: CanvasAction): void;
10
+ registerEditorRuntimePlugins(plugins: readonly LandEditorRuntimePlugin[]): void;
11
+ getAction(actionId: string): CanvasAction | null;
12
+ getHostActionIds(): string[];
13
+ getDuplicateActionIds(): string[];
14
+ }
15
+ export declare function createCanvasActionRegistry(plugins?: readonly LandEditorRuntimePlugin[]): CanvasActionRegistry;
@@ -30,11 +30,11 @@ export interface CanvasOverlayContribution {
30
30
  layer?: CanvasOverlayLayer;
31
31
  order?: number;
32
32
  }
33
- export interface CanvasPluginComponent {
33
+ export interface CanvasRenderPluginComponent {
34
34
  id: string;
35
35
  component: ComponentType;
36
36
  }
37
- export interface CanvasPluginProvider {
37
+ export interface CanvasRenderPluginProvider {
38
38
  id: string;
39
39
  component: ComponentType<{
40
40
  children: ReactNode;
@@ -62,12 +62,12 @@ export interface CanvasDomEventGuard {
62
62
  handle(input: CanvasDomEventGuardInput): CanvasDomEventGuardDecision;
63
63
  getCursor?(input: CanvasDomEventGuardCursorInput): string | undefined;
64
64
  }
65
- export interface LandCanvasPlugin {
65
+ export interface LandCanvasRenderPlugin {
66
66
  id: string;
67
67
  shapeRenderers?: readonly AnyRegisteredShapeRenderer[];
68
68
  canvasOverlays?: readonly CanvasOverlayContribution[];
69
69
  selectionCustomHandleRenderers?: readonly AnyRegisteredSelectionCustomHandleRenderer[];
70
70
  domEventGuards?: readonly CanvasDomEventGuard[];
71
- canvasProviders?: readonly CanvasPluginProvider[];
72
- canvasComponents?: readonly CanvasPluginComponent[];
71
+ canvasProviders?: readonly CanvasRenderPluginProvider[];
72
+ canvasComponents?: readonly CanvasRenderPluginComponent[];
73
73
  }
@@ -0,0 +1,2 @@
1
+ export { createCanvasRenderPluginHostRuntime } from "./canvasRenderPluginHostRuntime";
2
+ export type { CanvasRenderPluginHostManifestContextMenuContributionEntry, CanvasRenderPluginHostManifestEntry, CanvasRenderPluginHostManifestToolbarContributionEntry, CanvasRenderPluginHostRuntime, CanvasRenderPluginHostShapeValidationSummary, CanvasRenderPluginHostSource, CanvasRenderPluginHostValidationIssue, CanvasRenderPluginHostValidationIssueSeverity, CanvasRenderPluginHostValidationSummary, CanvasRenderPluginHostVerdict, CreateCanvasRenderPluginHostRuntimeOptions, } from "./canvasRenderPluginHostTypes";
@@ -0,0 +1,2 @@
1
+ import type { CanvasRenderPluginHostManifestEntry, ResolvedCanvasFeature } from "./canvasRenderPluginHostTypes";
2
+ export declare function getManifestEntryFromFeature(resolvedFeature: ResolvedCanvasFeature): CanvasRenderPluginHostManifestEntry;
@@ -0,0 +1,3 @@
1
+ import { type LandExtension } from "./extension";
2
+ import type { CanvasRenderPluginHostRuntime, CreateCanvasRenderPluginHostRuntimeOptions } from "./canvasRenderPluginHostTypes";
3
+ export declare function createCanvasRenderPluginHostRuntime(extensions: readonly LandExtension[], options?: CreateCanvasRenderPluginHostRuntimeOptions): CanvasRenderPluginHostRuntime;