canvu-react 0.4.77 → 0.4.79
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.
- package/dist/{types-DOUBapS4.d.cts → VectorViewport-MlKilYoG.d.cts} +180 -180
- package/dist/{types-C5wxwquF.d.ts → VectorViewport-bSpT1CrU.d.ts} +180 -180
- package/dist/chatbot.d.cts +2 -2
- package/dist/chatbot.d.ts +2 -2
- package/dist/native.cjs +26 -2
- package/dist/native.cjs.map +1 -1
- package/dist/native.js +26 -2
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +56 -8
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +92 -72
- package/dist/react.d.ts +92 -72
- package/dist/react.js +56 -8
- package/dist/react.js.map +1 -1
- package/dist/realtime.d.cts +1 -1
- package/dist/realtime.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { V as VectorSceneItem, R as Rect } from './types-fJNwEnHf.cjs';
|
|
2
|
+
import { ReactNode, RefObject, CSSProperties } from 'react';
|
|
4
3
|
import { S as StrokeStyle, C as Camera2D } from './shape-builders-DzhCOuzo.cjs';
|
|
4
|
+
import { V as VectorSceneItem, R as Rect } from './types-fJNwEnHf.cjs';
|
|
5
5
|
import { a as VectorViewportAssetStore, R as RasterImageCanvasRenderingOptions } from './raster-image-canvas-ByaCKEVw.cjs';
|
|
6
6
|
import { C as CanvuLinkData } from './link-item-BMV3VUCr.cjs';
|
|
7
7
|
import { R as RemotePresencePeer, P as PresenceOverlayRenderContext } from './types-DqsqQQVf.cjs';
|
|
@@ -77,27 +77,6 @@ type PlacementPreview = {
|
|
|
77
77
|
style?: StrokeStyle;
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
/**
|
|
81
|
-
* Anchor presets for floating board components.
|
|
82
|
-
*
|
|
83
|
-
* Names are `<edge>-<position-along-edge>`:
|
|
84
|
-
* - `top-*` / `bottom-*` anchor to the top or bottom edge.
|
|
85
|
-
* - `left-*` / `right-*` anchor to the left or right edge.
|
|
86
|
-
*
|
|
87
|
-
* Corner aliases are equivalent (e.g. `top-left` and `left-top` resolve to the same anchor),
|
|
88
|
-
* but kept distinct so callers can pick whichever reads best in their layout (a vertical
|
|
89
|
-
* strip might prefer `left-top`; a horizontal strip prefers `top-left`).
|
|
90
|
-
*/
|
|
91
|
-
type BoardComponentPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | "left-top" | "left-center" | "left-bottom" | "right-top" | "right-center" | "right-bottom" | "center" | "fill";
|
|
92
|
-
/** @deprecated Use {@link BoardComponentPosition}. */
|
|
93
|
-
type VectorCanvasSpacePosition = BoardComponentPosition;
|
|
94
|
-
/**
|
|
95
|
-
* Compute absolute-position CSS for a board component anchor preset.
|
|
96
|
-
* Returns `position`, `zIndex`, and the relevant edge offsets / transforms.
|
|
97
|
-
* Callers merge the result with their own style/className overrides.
|
|
98
|
-
*/
|
|
99
|
-
declare function getBoardPositionStyle(position: BoardComponentPosition, inset?: number, zIndex?: number): CSSProperties;
|
|
100
|
-
|
|
101
80
|
/**
|
|
102
81
|
* Describes one entry in {@link VectorToolbar}.
|
|
103
82
|
*/
|
|
@@ -118,36 +97,6 @@ type VectorToolDefinition = {
|
|
|
118
97
|
ariaLabel?: string;
|
|
119
98
|
};
|
|
120
99
|
|
|
121
|
-
type ReadOnlyItemClickCandidateDetail = {
|
|
122
|
-
/** The item Canvu hit-tested under the read-only click. */
|
|
123
|
-
item: VectorSceneItem;
|
|
124
|
-
/** World-space pointer location at press time. */
|
|
125
|
-
worldX: number;
|
|
126
|
-
worldY: number;
|
|
127
|
-
/** Viewport/client pointer location at press time. */
|
|
128
|
-
clientX: number;
|
|
129
|
-
clientY: number;
|
|
130
|
-
pointerType: string;
|
|
131
|
-
shiftKey: boolean;
|
|
132
|
-
altKey: boolean;
|
|
133
|
-
metaKey: boolean;
|
|
134
|
-
ctrlKey: boolean;
|
|
135
|
-
/** Current viewport items. */
|
|
136
|
-
items: readonly VectorSceneItem[];
|
|
137
|
-
/** Selection snapshot before read-only activation handles the click. */
|
|
138
|
-
selectedIds: readonly string[];
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Controls which items may receive select-mode click activation while
|
|
142
|
-
* `VectorViewport` is read-only (`interactive={false}`).
|
|
143
|
-
*
|
|
144
|
-
* `"custom"` keeps the default high-level behavior: custom placement/tool
|
|
145
|
-
* items with `onSelectModeItemClick` remain clickable, while regular items do
|
|
146
|
-
* not become selectable unless the app opts in. Use `"all"` or a predicate for
|
|
147
|
-
* read-only viewers that still need item selection or item-specific side effects.
|
|
148
|
-
*/
|
|
149
|
-
type ReadOnlyItemClickScope = "custom" | "all" | ((detail: ReadOnlyItemClickCandidateDetail) => boolean);
|
|
150
|
-
|
|
151
100
|
/**
|
|
152
101
|
* Stable ids for Canvu's built-in shape context-menu items.
|
|
153
102
|
*
|
|
@@ -287,6 +236,183 @@ type ShapeContextMenuProps = {
|
|
|
287
236
|
*/
|
|
288
237
|
declare function ShapeContextMenu({ x, y, selectedIds, selectedItems, allSelectedLocked, onClose, onToggleLock, onCut, onCopy, onBringToFront, onBringForward, onSendBackward, onSendToBack, onDuplicate, onDelete, items, itemContributions, children, }: ShapeContextMenuProps): react.ReactPortal | null;
|
|
289
238
|
|
|
239
|
+
type CanvasPluginRenderContext = {
|
|
240
|
+
/** Live viewport handle when the plugin needs camera or viewport size. */
|
|
241
|
+
viewportRef?: RefObject<VectorViewportHandle | null>;
|
|
242
|
+
};
|
|
243
|
+
type CanvasPluginItemsChangeMiddlewareContext = {
|
|
244
|
+
/** Current board items before the pending change is applied. */
|
|
245
|
+
currentItems: readonly VectorSceneItem[];
|
|
246
|
+
/** Continue the item change pipeline. Forward `info` when preserving motive metadata. */
|
|
247
|
+
next: NonNullable<VectorViewportProps["onItemsChange"]>;
|
|
248
|
+
/** Original consumer callback passed to `VectorViewport`. */
|
|
249
|
+
consumerOnItemsChange?: VectorViewportProps["onItemsChange"];
|
|
250
|
+
/** Live viewport handle for advanced integrations. */
|
|
251
|
+
viewportRef?: RefObject<VectorViewportHandle | null>;
|
|
252
|
+
};
|
|
253
|
+
type CanvasPluginContribution = {
|
|
254
|
+
/** Additional tools injected into the board toolbar/runtime. */
|
|
255
|
+
tools?: readonly VectorToolDefinition[];
|
|
256
|
+
/** Transform the resolved tool list (reorder, replace, or filter existing tools). */
|
|
257
|
+
toolTransform?: (tools: VectorToolDefinition[]) => VectorToolDefinition[];
|
|
258
|
+
/**
|
|
259
|
+
* Additional shape context-menu items merged by id after Canvu's built-ins.
|
|
260
|
+
*
|
|
261
|
+
* Matching ids replace existing items in place, new ids append, and plugin order
|
|
262
|
+
* determines tie-breaking before app-level `VectorViewport.contextMenuItems`.
|
|
263
|
+
*/
|
|
264
|
+
contextMenuItems?: readonly ShapeContextMenuItem[];
|
|
265
|
+
/** Multiple custom placements contributed by plugins; the active one is resolved by `toolId`. */
|
|
266
|
+
customPlacements?: readonly CustomShapePlacementOptions[];
|
|
267
|
+
/** Simple viewport prop overrides owned by the plugin runtime. */
|
|
268
|
+
viewportProps?: Partial<Pick<VectorViewportProps, "remotePresence" | "presenceOverlay">>;
|
|
269
|
+
/** Event callbacks chained into the viewport without manual wiring in app code. */
|
|
270
|
+
callbacks?: Partial<Pick<VectorViewportProps, "onWorldPointerDown" | "onWorldPointerMove" | "onWorldPointerLeave" | "onPlacementPreviewChange" | "onCameraChange">>;
|
|
271
|
+
/**
|
|
272
|
+
* Hooks around Canvu-owned pointer interactions.
|
|
273
|
+
*
|
|
274
|
+
* Use these for custom tool behavior that needs to observe or claim a gesture
|
|
275
|
+
* before the viewport mutates state. Use `wrapOnItemsChange` for exact item
|
|
276
|
+
* mutation middleware.
|
|
277
|
+
*/
|
|
278
|
+
interactionHooks?: {
|
|
279
|
+
/** Return `"handled"` to claim the gesture and skip Canvu's built-in behavior. */
|
|
280
|
+
onBeforeInteraction?: CanvuBeforeInteractionHook;
|
|
281
|
+
/** Runs once when an accepted gesture completes or is cancelled. */
|
|
282
|
+
onAfterInteraction?: CanvuAfterInteractionHook;
|
|
283
|
+
};
|
|
284
|
+
/** Middleware around `onItemsChange` for collaboration, comments, persistence, etc. */
|
|
285
|
+
wrapOnItemsChange?: (nextItems: VectorSceneItem[], ctx: CanvasPluginItemsChangeMiddlewareContext, info?: VectorItemsChangeInfo) => void;
|
|
286
|
+
};
|
|
287
|
+
type CanvasPluginComponentProps = {
|
|
288
|
+
/** Stable plugin id so the component can register contributions. */
|
|
289
|
+
pluginId: string;
|
|
290
|
+
};
|
|
291
|
+
type CanvasPlugin = {
|
|
292
|
+
/** Stable id, e.g. `canvu.plugin.chatbot`. */
|
|
293
|
+
id: string;
|
|
294
|
+
/**
|
|
295
|
+
* Legacy/simple rendering path for purely visual plugins.
|
|
296
|
+
*
|
|
297
|
+
* Prefer `Component` for plugins that need hooks, document integration, tools, or runtime contributions.
|
|
298
|
+
*/
|
|
299
|
+
render?: (ctx: CanvasPluginRenderContext) => ReactNode;
|
|
300
|
+
/**
|
|
301
|
+
* Preferred plugin entrypoint for first-party and advanced plugins.
|
|
302
|
+
*
|
|
303
|
+
* The component can use hooks and register contributions through `useCanvuPluginContribution`.
|
|
304
|
+
*/
|
|
305
|
+
Component?: (props: CanvasPluginComponentProps) => ReactNode;
|
|
306
|
+
};
|
|
307
|
+
type CanvuPluginViewportSnapshot = Pick<VectorViewportProps, "items" | "onItemsChange" | "toolId" | "interactive" | "toolLocked" | "onToolChangeRequest">;
|
|
308
|
+
type CanvuPluginContextValue = {
|
|
309
|
+
viewportRef?: RefObject<VectorViewportHandle | null>;
|
|
310
|
+
viewport: CanvuPluginViewportSnapshot;
|
|
311
|
+
resolvedTools: VectorToolDefinition[];
|
|
312
|
+
registerContribution: (pluginId: string, contribution: CanvasPluginContribution) => void;
|
|
313
|
+
unregisterContribution: (pluginId: string) => void;
|
|
314
|
+
};
|
|
315
|
+
declare const CanvuPluginContext: react.Context<CanvuPluginContextValue | null>;
|
|
316
|
+
/**
|
|
317
|
+
* Creates a typed canvu plugin descriptor.
|
|
318
|
+
*
|
|
319
|
+
* Use this helper when authoring custom plugins so your editor can infer the plugin shape
|
|
320
|
+
* and surface better hover documentation for the returned object.
|
|
321
|
+
*/
|
|
322
|
+
declare function createCanvuPlugin(plugin: CanvasPlugin): CanvasPlugin;
|
|
323
|
+
/**
|
|
324
|
+
* Returns the low-level canvu plugin runtime context.
|
|
325
|
+
*
|
|
326
|
+
* This is an advanced API for custom plugin authors. Prefer first-party plugin factories such as
|
|
327
|
+
* `chatbotPlugin(...)` and `realtimeCollaborationPlugin(...)` for the common path.
|
|
328
|
+
*/
|
|
329
|
+
declare function useCanvuPluginContext(): CanvuPluginContextValue;
|
|
330
|
+
/**
|
|
331
|
+
* Returns the current viewport-facing board state exposed to plugins.
|
|
332
|
+
*
|
|
333
|
+
* Use this when a custom plugin needs access to items, the active tool, or the consumer's
|
|
334
|
+
* `onToolChangeRequest` callback.
|
|
335
|
+
*/
|
|
336
|
+
declare function useCanvuViewportContext(): {
|
|
337
|
+
viewportRef?: RefObject<VectorViewportHandle | null>;
|
|
338
|
+
viewport: CanvuPluginViewportSnapshot;
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* Returns the board document context exposed to plugins.
|
|
342
|
+
*
|
|
343
|
+
* This hook is intended for advanced plugins that need to read items or integrate with the board's
|
|
344
|
+
* `onItemsChange` lifecycle.
|
|
345
|
+
*/
|
|
346
|
+
declare function useCanvuDocumentContext(): {
|
|
347
|
+
items: readonly VectorSceneItem[];
|
|
348
|
+
onItemsChange?: VectorViewportProps["onItemsChange"];
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* Returns the tool list already resolved by the plugin runtime.
|
|
352
|
+
*
|
|
353
|
+
* `VectorToolbar` consumes this automatically when you omit its `tools` prop, so most apps do not
|
|
354
|
+
* need this hook directly.
|
|
355
|
+
*/
|
|
356
|
+
declare function useCanvuResolvedTools(): VectorToolDefinition[];
|
|
357
|
+
/**
|
|
358
|
+
* Registers non-visual plugin contributions with the current `VectorViewport` runtime.
|
|
359
|
+
*
|
|
360
|
+
* Use this inside `plugin.Component` when you want to inject tools, pointer/camera behavior, or
|
|
361
|
+
* document middleware without requiring the consumer to wire hooks manually.
|
|
362
|
+
*/
|
|
363
|
+
declare function useCanvuPluginContribution(pluginId: string, contribution: CanvasPluginContribution): void;
|
|
364
|
+
|
|
365
|
+
type ReadOnlyItemClickCandidateDetail = {
|
|
366
|
+
/** The item Canvu hit-tested under the read-only click. */
|
|
367
|
+
item: VectorSceneItem;
|
|
368
|
+
/** World-space pointer location at press time. */
|
|
369
|
+
worldX: number;
|
|
370
|
+
worldY: number;
|
|
371
|
+
/** Viewport/client pointer location at press time. */
|
|
372
|
+
clientX: number;
|
|
373
|
+
clientY: number;
|
|
374
|
+
pointerType: string;
|
|
375
|
+
shiftKey: boolean;
|
|
376
|
+
altKey: boolean;
|
|
377
|
+
metaKey: boolean;
|
|
378
|
+
ctrlKey: boolean;
|
|
379
|
+
/** Current viewport items. */
|
|
380
|
+
items: readonly VectorSceneItem[];
|
|
381
|
+
/** Selection snapshot before read-only activation handles the click. */
|
|
382
|
+
selectedIds: readonly string[];
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* Controls which items may receive select-mode click activation while
|
|
386
|
+
* `VectorViewport` is read-only (`interactive={false}`).
|
|
387
|
+
*
|
|
388
|
+
* `"custom"` keeps the default high-level behavior: custom placement/tool
|
|
389
|
+
* items with `onSelectModeItemClick` remain clickable, while regular items do
|
|
390
|
+
* not become selectable unless the app opts in. Use `"all"` or a predicate for
|
|
391
|
+
* read-only viewers that still need item selection or item-specific side effects.
|
|
392
|
+
*/
|
|
393
|
+
type ReadOnlyItemClickScope = "custom" | "all" | ((detail: ReadOnlyItemClickCandidateDetail) => boolean);
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Anchor presets for floating board components.
|
|
397
|
+
*
|
|
398
|
+
* Names are `<edge>-<position-along-edge>`:
|
|
399
|
+
* - `top-*` / `bottom-*` anchor to the top or bottom edge.
|
|
400
|
+
* - `left-*` / `right-*` anchor to the left or right edge.
|
|
401
|
+
*
|
|
402
|
+
* Corner aliases are equivalent (e.g. `top-left` and `left-top` resolve to the same anchor),
|
|
403
|
+
* but kept distinct so callers can pick whichever reads best in their layout (a vertical
|
|
404
|
+
* strip might prefer `left-top`; a horizontal strip prefers `top-left`).
|
|
405
|
+
*/
|
|
406
|
+
type BoardComponentPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | "left-top" | "left-center" | "left-bottom" | "right-top" | "right-center" | "right-bottom" | "center" | "fill";
|
|
407
|
+
/** @deprecated Use {@link BoardComponentPosition}. */
|
|
408
|
+
type VectorCanvasSpacePosition = BoardComponentPosition;
|
|
409
|
+
/**
|
|
410
|
+
* Compute absolute-position CSS for a board component anchor preset.
|
|
411
|
+
* Returns `position`, `zIndex`, and the relevant edge offsets / transforms.
|
|
412
|
+
* Callers merge the result with their own style/className overrides.
|
|
413
|
+
*/
|
|
414
|
+
declare function getBoardPositionStyle(position: BoardComponentPosition, inset?: number, zIndex?: number): CSSProperties;
|
|
415
|
+
|
|
290
416
|
type ActiveToolStyle = StrokeStyle & {
|
|
291
417
|
toolKind: "draw" | "marker" | "text" | "rect" | "ellipse" | "architectural-cloud" | "line" | "arrow";
|
|
292
418
|
label?: string;
|
|
@@ -756,130 +882,4 @@ type VectorViewportProps = {
|
|
|
756
882
|
*/
|
|
757
883
|
declare const VectorViewport: react.ForwardRefExoticComponent<VectorViewportProps & react.RefAttributes<VectorViewportHandle>>;
|
|
758
884
|
|
|
759
|
-
type CanvasPluginRenderContext
|
|
760
|
-
/** Live viewport handle when the plugin needs camera or viewport size. */
|
|
761
|
-
viewportRef?: RefObject<VectorViewportHandle | null>;
|
|
762
|
-
};
|
|
763
|
-
type CanvasPluginItemsChangeMiddlewareContext = {
|
|
764
|
-
/** Current board items before the pending change is applied. */
|
|
765
|
-
currentItems: readonly VectorSceneItem[];
|
|
766
|
-
/** Continue the item change pipeline. Forward `info` when preserving motive metadata. */
|
|
767
|
-
next: NonNullable<VectorViewportProps["onItemsChange"]>;
|
|
768
|
-
/** Original consumer callback passed to `VectorViewport`. */
|
|
769
|
-
consumerOnItemsChange?: VectorViewportProps["onItemsChange"];
|
|
770
|
-
/** Live viewport handle for advanced integrations. */
|
|
771
|
-
viewportRef?: RefObject<VectorViewportHandle | null>;
|
|
772
|
-
};
|
|
773
|
-
type CanvasPluginContribution = {
|
|
774
|
-
/** Additional tools injected into the board toolbar/runtime. */
|
|
775
|
-
tools?: readonly VectorToolDefinition[];
|
|
776
|
-
/** Transform the resolved tool list (reorder, replace, or filter existing tools). */
|
|
777
|
-
toolTransform?: (tools: VectorToolDefinition[]) => VectorToolDefinition[];
|
|
778
|
-
/**
|
|
779
|
-
* Additional shape context-menu items merged by id after Canvu's built-ins.
|
|
780
|
-
*
|
|
781
|
-
* Matching ids replace existing items in place, new ids append, and plugin order
|
|
782
|
-
* determines tie-breaking before app-level `VectorViewport.contextMenuItems`.
|
|
783
|
-
*/
|
|
784
|
-
contextMenuItems?: readonly ShapeContextMenuItem[];
|
|
785
|
-
/** Multiple custom placements contributed by plugins; the active one is resolved by `toolId`. */
|
|
786
|
-
customPlacements?: readonly CustomShapePlacementOptions[];
|
|
787
|
-
/** Simple viewport prop overrides owned by the plugin runtime. */
|
|
788
|
-
viewportProps?: Partial<Pick<VectorViewportProps, "remotePresence" | "presenceOverlay">>;
|
|
789
|
-
/** Event callbacks chained into the viewport without manual wiring in app code. */
|
|
790
|
-
callbacks?: Partial<Pick<VectorViewportProps, "onWorldPointerDown" | "onWorldPointerMove" | "onWorldPointerLeave" | "onPlacementPreviewChange" | "onCameraChange">>;
|
|
791
|
-
/**
|
|
792
|
-
* Hooks around Canvu-owned pointer interactions.
|
|
793
|
-
*
|
|
794
|
-
* Use these for custom tool behavior that needs to observe or claim a gesture
|
|
795
|
-
* before the viewport mutates state. Use `wrapOnItemsChange` for exact item
|
|
796
|
-
* mutation middleware.
|
|
797
|
-
*/
|
|
798
|
-
interactionHooks?: {
|
|
799
|
-
/** Return `"handled"` to claim the gesture and skip Canvu's built-in behavior. */
|
|
800
|
-
onBeforeInteraction?: CanvuBeforeInteractionHook;
|
|
801
|
-
/** Runs once when an accepted gesture completes or is cancelled. */
|
|
802
|
-
onAfterInteraction?: CanvuAfterInteractionHook;
|
|
803
|
-
};
|
|
804
|
-
/** Middleware around `onItemsChange` for collaboration, comments, persistence, etc. */
|
|
805
|
-
wrapOnItemsChange?: (nextItems: VectorSceneItem[], ctx: CanvasPluginItemsChangeMiddlewareContext, info?: VectorItemsChangeInfo) => void;
|
|
806
|
-
};
|
|
807
|
-
type CanvasPluginComponentProps = {
|
|
808
|
-
/** Stable plugin id so the component can register contributions. */
|
|
809
|
-
pluginId: string;
|
|
810
|
-
};
|
|
811
|
-
type CanvasPlugin = {
|
|
812
|
-
/** Stable id, e.g. `canvu.plugin.chatbot`. */
|
|
813
|
-
id: string;
|
|
814
|
-
/**
|
|
815
|
-
* Legacy/simple rendering path for purely visual plugins.
|
|
816
|
-
*
|
|
817
|
-
* Prefer `Component` for plugins that need hooks, document integration, tools, or runtime contributions.
|
|
818
|
-
*/
|
|
819
|
-
render?: (ctx: CanvasPluginRenderContext) => ReactNode;
|
|
820
|
-
/**
|
|
821
|
-
* Preferred plugin entrypoint for first-party and advanced plugins.
|
|
822
|
-
*
|
|
823
|
-
* The component can use hooks and register contributions through `useCanvuPluginContribution`.
|
|
824
|
-
*/
|
|
825
|
-
Component?: (props: CanvasPluginComponentProps) => ReactNode;
|
|
826
|
-
};
|
|
827
|
-
type CanvuPluginViewportSnapshot = Pick<VectorViewportProps, "items" | "onItemsChange" | "toolId" | "interactive" | "toolLocked" | "onToolChangeRequest">;
|
|
828
|
-
type CanvuPluginContextValue = {
|
|
829
|
-
viewportRef?: RefObject<VectorViewportHandle | null>;
|
|
830
|
-
viewport: CanvuPluginViewportSnapshot;
|
|
831
|
-
resolvedTools: VectorToolDefinition[];
|
|
832
|
-
registerContribution: (pluginId: string, contribution: CanvasPluginContribution) => void;
|
|
833
|
-
unregisterContribution: (pluginId: string) => void;
|
|
834
|
-
};
|
|
835
|
-
declare const CanvuPluginContext: react.Context<CanvuPluginContextValue | null>;
|
|
836
|
-
/**
|
|
837
|
-
* Creates a typed canvu plugin descriptor.
|
|
838
|
-
*
|
|
839
|
-
* Use this helper when authoring custom plugins so your editor can infer the plugin shape
|
|
840
|
-
* and surface better hover documentation for the returned object.
|
|
841
|
-
*/
|
|
842
|
-
declare function createCanvuPlugin(plugin: CanvasPlugin): CanvasPlugin;
|
|
843
|
-
/**
|
|
844
|
-
* Returns the low-level canvu plugin runtime context.
|
|
845
|
-
*
|
|
846
|
-
* This is an advanced API for custom plugin authors. Prefer first-party plugin factories such as
|
|
847
|
-
* `chatbotPlugin(...)` and `realtimeCollaborationPlugin(...)` for the common path.
|
|
848
|
-
*/
|
|
849
|
-
declare function useCanvuPluginContext(): CanvuPluginContextValue;
|
|
850
|
-
/**
|
|
851
|
-
* Returns the current viewport-facing board state exposed to plugins.
|
|
852
|
-
*
|
|
853
|
-
* Use this when a custom plugin needs access to items, the active tool, or the consumer's
|
|
854
|
-
* `onToolChangeRequest` callback.
|
|
855
|
-
*/
|
|
856
|
-
declare function useCanvuViewportContext(): {
|
|
857
|
-
viewportRef?: RefObject<VectorViewportHandle | null>;
|
|
858
|
-
viewport: CanvuPluginViewportSnapshot;
|
|
859
|
-
};
|
|
860
|
-
/**
|
|
861
|
-
* Returns the board document context exposed to plugins.
|
|
862
|
-
*
|
|
863
|
-
* This hook is intended for advanced plugins that need to read items or integrate with the board's
|
|
864
|
-
* `onItemsChange` lifecycle.
|
|
865
|
-
*/
|
|
866
|
-
declare function useCanvuDocumentContext(): {
|
|
867
|
-
items: readonly VectorSceneItem[];
|
|
868
|
-
onItemsChange?: VectorViewportProps["onItemsChange"];
|
|
869
|
-
};
|
|
870
|
-
/**
|
|
871
|
-
* Returns the tool list already resolved by the plugin runtime.
|
|
872
|
-
*
|
|
873
|
-
* `VectorToolbar` consumes this automatically when you omit its `tools` prop, so most apps do not
|
|
874
|
-
* need this hook directly.
|
|
875
|
-
*/
|
|
876
|
-
declare function useCanvuResolvedTools(): VectorToolDefinition[];
|
|
877
|
-
/**
|
|
878
|
-
* Registers non-visual plugin contributions with the current `VectorViewport` runtime.
|
|
879
|
-
*
|
|
880
|
-
* Use this inside `plugin.Component` when you want to inject tools, pointer/camera behavior, or
|
|
881
|
-
* document middleware without requiring the consumer to wire hooks manually.
|
|
882
|
-
*/
|
|
883
|
-
declare function useCanvuPluginContribution(pluginId: string, contribution: CanvasPluginContribution): void;
|
|
884
|
-
|
|
885
|
-
export { type ShapeContextMenuItem as A, type BoardComponentPosition as B, type CustomShapePlacementOptions as C, type ShapeContextMenuProps as D, type ShapeContextMenuRenderContext as E, type VectorCanvasSpacePosition as F, type VectorItemsChangeInfo as G, type VectorItemsChangeMotive as H, type VectorSelectionInspectorProps as I, VectorViewport as J, type VectorViewportHandle as K, type VectorViewportProps as L, createCanvuPlugin as M, getBoardPositionStyle as N, useCanvuChromeContext as O, type PlacementPreview as P, useCanvuDocumentContext as Q, type ReadOnlyInteractionOptions as R, SHAPE_CONTEXT_MENU_ITEM_IDS as S, useCanvuPluginContext as T, useCanvuPluginContribution as U, type VectorToolDefinition as V, type WorldPointerDownDetail as W, useCanvuResolvedTools as X, useCanvuViewportContext as Y, type CanvuBeforeInteractionHook as a, type CanvuAfterInteractionHook as b, type CanvasPlugin as c, VectorSelectionInspector as d, type CanvasPluginComponentProps as e, type CanvasPluginContribution as f, type CanvasPluginItemsChangeMiddlewareContext as g, type CanvasPluginRenderContext as h, type CanvuAfterInteractionDetail as i, type CanvuBeforeInteractionResult as j, type CanvuChromeActiveToolStyle as k, CanvuChromeContext as l, type CanvuChromeContextValue as m, type CanvuChromeSelectionStyleChange as n, type CanvuInteractionDetail as o, type CanvuInteractionKind as p, type CanvuInteractionOutcome as q, type CanvuInteractionPoint as r, CanvuPluginContext as s, type CanvuPluginContextValue as t, type CanvuPluginViewportSnapshot as u, type ReadOnlyItemClickCandidateDetail as v, type ReadOnlyItemClickScope as w, type SelectModeItemClickDetail as x, type SelectModeItemClickResult as y, ShapeContextMenu as z };
|
|
885
|
+
export { ShapeContextMenu as A, type BoardComponentPosition as B, type CustomShapePlacementOptions as C, type ShapeContextMenuItem as D, type ShapeContextMenuProps as E, type ShapeContextMenuRenderContext as F, type VectorCanvasSpacePosition as G, type VectorItemsChangeMotive as H, type VectorSelectionInspectorProps as I, VectorViewport as J, type VectorViewportHandle as K, type VectorViewportProps as L, createCanvuPlugin as M, getBoardPositionStyle as N, useCanvuChromeContext as O, type PlacementPreview as P, useCanvuDocumentContext as Q, type ReadOnlyInteractionOptions as R, SHAPE_CONTEXT_MENU_ITEM_IDS as S, useCanvuPluginContext as T, useCanvuPluginContribution as U, type VectorToolDefinition as V, type WorldPointerDownDetail as W, useCanvuResolvedTools as X, useCanvuViewportContext as Y, type CanvuBeforeInteractionHook as a, type CanvuAfterInteractionHook as b, type CanvasPlugin as c, type VectorItemsChangeInfo as d, VectorSelectionInspector as e, type CanvasPluginComponentProps as f, type CanvasPluginContribution as g, type CanvasPluginItemsChangeMiddlewareContext as h, type CanvasPluginRenderContext as i, type CanvuAfterInteractionDetail as j, type CanvuBeforeInteractionResult as k, type CanvuChromeActiveToolStyle as l, CanvuChromeContext as m, type CanvuChromeContextValue as n, type CanvuChromeSelectionStyleChange as o, type CanvuInteractionDetail as p, type CanvuInteractionKind as q, type CanvuInteractionOutcome as r, type CanvuInteractionPoint as s, CanvuPluginContext as t, type CanvuPluginContextValue as u, type CanvuPluginViewportSnapshot as v, type ReadOnlyItemClickCandidateDetail as w, type ReadOnlyItemClickScope as x, type SelectModeItemClickDetail as y, type SelectModeItemClickResult as z };
|