canvu-react 0.4.59 → 0.4.61
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/chatbot.d.cts +1 -1
- package/dist/chatbot.d.ts +1 -1
- package/dist/native.cjs +37 -17
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +11 -1
- package/dist/native.d.ts +11 -1
- package/dist/native.js +37 -17
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +143 -55
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +143 -55
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs +31 -18
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +6 -6
- package/dist/realtime.d.ts +6 -6
- package/dist/realtime.js +31 -18
- package/dist/realtime.js.map +1 -1
- package/dist/{types-BFZpRGyr.d.cts → types--jCoyZIF.d.cts} +35 -4
- package/dist/{types-D2zesNI8.d.ts → types-C_PMen-D.d.ts} +35 -4
- package/package.json +1 -1
|
@@ -179,6 +179,29 @@ type SelectModeItemClickDetail = {
|
|
|
179
179
|
/** Set the viewport selection when activation should also select or clear. */
|
|
180
180
|
setSelectedIds: (ids: readonly string[]) => void;
|
|
181
181
|
};
|
|
182
|
+
/**
|
|
183
|
+
* Best-effort reason attached to a React viewport item change.
|
|
184
|
+
*
|
|
185
|
+
* Middleware and `onItemsChange` consumers can use this to distinguish user
|
|
186
|
+
* actions such as deletion, erasing, placement, or text editing without
|
|
187
|
+
* diffing item snapshots themselves. Metadata may be omitted by legacy callers
|
|
188
|
+
* or by integrations that update items outside canvu's built-in interactions.
|
|
189
|
+
*/
|
|
190
|
+
type VectorItemsChangeMotive = "draw" | "place" | "text-create" | "text-edit" | "asset-add" | "asset-hydrate" | "move" | "resize" | "rotate" | "style" | "delete" | "erase" | "cut" | "paste" | "duplicate" | "lock" | "unlock" | "reorder" | "undo" | "redo" | "custom" | "remote-sync" | "plugin" | "unknown";
|
|
191
|
+
/**
|
|
192
|
+
* Optional metadata passed alongside a React viewport item change.
|
|
193
|
+
*
|
|
194
|
+
* The payload is intentionally small and stable: `motive` describes the action
|
|
195
|
+
* class, `itemIds` identifies the primary affected items when known, and
|
|
196
|
+
* `toolId` records the active tool for placement or drawing flows. Treat this
|
|
197
|
+
* as advisory metadata; absence means the change came from legacy code or an
|
|
198
|
+
* external source that did not provide a motive.
|
|
199
|
+
*/
|
|
200
|
+
type VectorItemsChangeInfo = {
|
|
201
|
+
motive: VectorItemsChangeMotive;
|
|
202
|
+
itemIds?: readonly string[];
|
|
203
|
+
toolId?: string;
|
|
204
|
+
};
|
|
182
205
|
/**
|
|
183
206
|
* Imperative API for pan/zoom and integrations (e.g. AI agents following a region).
|
|
184
207
|
* Call {@link requestRender} after mutating the {@link Camera2D} from {@link getCamera}.
|
|
@@ -246,7 +269,15 @@ type VectorViewportProps = {
|
|
|
246
269
|
/** Selected item ids (order preserved). Empty = none. */
|
|
247
270
|
selectedIds?: readonly string[];
|
|
248
271
|
onSelectionChange?: (ids: string[]) => void;
|
|
249
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Called when the React viewport requests a replacement item list.
|
|
274
|
+
*
|
|
275
|
+
* `info` is best-effort action metadata for middleware and app code that
|
|
276
|
+
* needs to know whether the change was a deletion, placement, move, etc.
|
|
277
|
+
* Existing one-argument handlers remain valid, and callers outside canvu may
|
|
278
|
+
* omit `info`.
|
|
279
|
+
*/
|
|
280
|
+
onItemsChange?: (items: VectorSceneItem[], info?: VectorItemsChangeInfo) => void;
|
|
250
281
|
/**
|
|
251
282
|
* Fires when a link/bookmark item is activated (double-click / double-tap).
|
|
252
283
|
* When omitted, the link opens in a new browser tab by default (web only).
|
|
@@ -368,7 +399,7 @@ type CanvasPluginRenderContext = {
|
|
|
368
399
|
type CanvasPluginItemsChangeMiddlewareContext = {
|
|
369
400
|
/** Current board items before the pending change is applied. */
|
|
370
401
|
currentItems: readonly VectorSceneItem[];
|
|
371
|
-
/** Continue the item change pipeline. */
|
|
402
|
+
/** Continue the item change pipeline. Forward `info` when preserving motive metadata. */
|
|
372
403
|
next: NonNullable<VectorViewportProps["onItemsChange"]>;
|
|
373
404
|
/** Original consumer callback passed to `VectorViewport`. */
|
|
374
405
|
consumerOnItemsChange?: VectorViewportProps["onItemsChange"];
|
|
@@ -387,7 +418,7 @@ type CanvasPluginContribution = {
|
|
|
387
418
|
/** Event callbacks chained into the viewport without manual wiring in app code. */
|
|
388
419
|
callbacks?: Partial<Pick<VectorViewportProps, "onWorldPointerDown" | "onWorldPointerMove" | "onWorldPointerLeave" | "onPlacementPreviewChange" | "onCameraChange">>;
|
|
389
420
|
/** Middleware around `onItemsChange` for collaboration, comments, persistence, etc. */
|
|
390
|
-
wrapOnItemsChange?: (nextItems: VectorSceneItem[], ctx: CanvasPluginItemsChangeMiddlewareContext) => void;
|
|
421
|
+
wrapOnItemsChange?: (nextItems: VectorSceneItem[], ctx: CanvasPluginItemsChangeMiddlewareContext, info?: VectorItemsChangeInfo) => void;
|
|
391
422
|
};
|
|
392
423
|
type CanvasPluginComponentProps = {
|
|
393
424
|
/** Stable plugin id so the component can register contributions. */
|
|
@@ -467,4 +498,4 @@ declare function useCanvuResolvedTools(): VectorToolDefinition[];
|
|
|
467
498
|
*/
|
|
468
499
|
declare function useCanvuPluginContribution(pluginId: string, contribution: CanvasPluginContribution): void;
|
|
469
500
|
|
|
470
|
-
export {
|
|
501
|
+
export { useCanvuPluginContribution as A, type BoardComponentPosition as B, type CustomShapePlacementOptions as C, useCanvuResolvedTools as D, useCanvuViewportContext as E, type PlacementPreview as P, type SelectModeItemClickDetail as S, type VectorToolDefinition as V, type WorldPointerDownDetail as W, type CanvasPlugin as a, VectorSelectionInspector as b, type CanvasPluginComponentProps as c, type CanvasPluginContribution as d, type CanvasPluginItemsChangeMiddlewareContext as e, type CanvasPluginRenderContext as f, type CanvuChromeActiveToolStyle as g, CanvuChromeContext as h, type CanvuChromeContextValue as i, type CanvuChromeSelectionStyleChange as j, CanvuPluginContext as k, type CanvuPluginContextValue as l, type CanvuPluginViewportSnapshot as m, type SelectModeItemClickResult as n, type VectorCanvasSpacePosition as o, type VectorItemsChangeInfo as p, type VectorItemsChangeMotive as q, type VectorSelectionInspectorProps as r, VectorViewport as s, type VectorViewportHandle as t, type VectorViewportProps as u, createCanvuPlugin as v, getBoardPositionStyle as w, useCanvuChromeContext as x, useCanvuDocumentContext as y, useCanvuPluginContext as z };
|
|
@@ -179,6 +179,29 @@ type SelectModeItemClickDetail = {
|
|
|
179
179
|
/** Set the viewport selection when activation should also select or clear. */
|
|
180
180
|
setSelectedIds: (ids: readonly string[]) => void;
|
|
181
181
|
};
|
|
182
|
+
/**
|
|
183
|
+
* Best-effort reason attached to a React viewport item change.
|
|
184
|
+
*
|
|
185
|
+
* Middleware and `onItemsChange` consumers can use this to distinguish user
|
|
186
|
+
* actions such as deletion, erasing, placement, or text editing without
|
|
187
|
+
* diffing item snapshots themselves. Metadata may be omitted by legacy callers
|
|
188
|
+
* or by integrations that update items outside canvu's built-in interactions.
|
|
189
|
+
*/
|
|
190
|
+
type VectorItemsChangeMotive = "draw" | "place" | "text-create" | "text-edit" | "asset-add" | "asset-hydrate" | "move" | "resize" | "rotate" | "style" | "delete" | "erase" | "cut" | "paste" | "duplicate" | "lock" | "unlock" | "reorder" | "undo" | "redo" | "custom" | "remote-sync" | "plugin" | "unknown";
|
|
191
|
+
/**
|
|
192
|
+
* Optional metadata passed alongside a React viewport item change.
|
|
193
|
+
*
|
|
194
|
+
* The payload is intentionally small and stable: `motive` describes the action
|
|
195
|
+
* class, `itemIds` identifies the primary affected items when known, and
|
|
196
|
+
* `toolId` records the active tool for placement or drawing flows. Treat this
|
|
197
|
+
* as advisory metadata; absence means the change came from legacy code or an
|
|
198
|
+
* external source that did not provide a motive.
|
|
199
|
+
*/
|
|
200
|
+
type VectorItemsChangeInfo = {
|
|
201
|
+
motive: VectorItemsChangeMotive;
|
|
202
|
+
itemIds?: readonly string[];
|
|
203
|
+
toolId?: string;
|
|
204
|
+
};
|
|
182
205
|
/**
|
|
183
206
|
* Imperative API for pan/zoom and integrations (e.g. AI agents following a region).
|
|
184
207
|
* Call {@link requestRender} after mutating the {@link Camera2D} from {@link getCamera}.
|
|
@@ -246,7 +269,15 @@ type VectorViewportProps = {
|
|
|
246
269
|
/** Selected item ids (order preserved). Empty = none. */
|
|
247
270
|
selectedIds?: readonly string[];
|
|
248
271
|
onSelectionChange?: (ids: string[]) => void;
|
|
249
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Called when the React viewport requests a replacement item list.
|
|
274
|
+
*
|
|
275
|
+
* `info` is best-effort action metadata for middleware and app code that
|
|
276
|
+
* needs to know whether the change was a deletion, placement, move, etc.
|
|
277
|
+
* Existing one-argument handlers remain valid, and callers outside canvu may
|
|
278
|
+
* omit `info`.
|
|
279
|
+
*/
|
|
280
|
+
onItemsChange?: (items: VectorSceneItem[], info?: VectorItemsChangeInfo) => void;
|
|
250
281
|
/**
|
|
251
282
|
* Fires when a link/bookmark item is activated (double-click / double-tap).
|
|
252
283
|
* When omitted, the link opens in a new browser tab by default (web only).
|
|
@@ -368,7 +399,7 @@ type CanvasPluginRenderContext = {
|
|
|
368
399
|
type CanvasPluginItemsChangeMiddlewareContext = {
|
|
369
400
|
/** Current board items before the pending change is applied. */
|
|
370
401
|
currentItems: readonly VectorSceneItem[];
|
|
371
|
-
/** Continue the item change pipeline. */
|
|
402
|
+
/** Continue the item change pipeline. Forward `info` when preserving motive metadata. */
|
|
372
403
|
next: NonNullable<VectorViewportProps["onItemsChange"]>;
|
|
373
404
|
/** Original consumer callback passed to `VectorViewport`. */
|
|
374
405
|
consumerOnItemsChange?: VectorViewportProps["onItemsChange"];
|
|
@@ -387,7 +418,7 @@ type CanvasPluginContribution = {
|
|
|
387
418
|
/** Event callbacks chained into the viewport without manual wiring in app code. */
|
|
388
419
|
callbacks?: Partial<Pick<VectorViewportProps, "onWorldPointerDown" | "onWorldPointerMove" | "onWorldPointerLeave" | "onPlacementPreviewChange" | "onCameraChange">>;
|
|
389
420
|
/** Middleware around `onItemsChange` for collaboration, comments, persistence, etc. */
|
|
390
|
-
wrapOnItemsChange?: (nextItems: VectorSceneItem[], ctx: CanvasPluginItemsChangeMiddlewareContext) => void;
|
|
421
|
+
wrapOnItemsChange?: (nextItems: VectorSceneItem[], ctx: CanvasPluginItemsChangeMiddlewareContext, info?: VectorItemsChangeInfo) => void;
|
|
391
422
|
};
|
|
392
423
|
type CanvasPluginComponentProps = {
|
|
393
424
|
/** Stable plugin id so the component can register contributions. */
|
|
@@ -467,4 +498,4 @@ declare function useCanvuResolvedTools(): VectorToolDefinition[];
|
|
|
467
498
|
*/
|
|
468
499
|
declare function useCanvuPluginContribution(pluginId: string, contribution: CanvasPluginContribution): void;
|
|
469
500
|
|
|
470
|
-
export {
|
|
501
|
+
export { useCanvuPluginContribution as A, type BoardComponentPosition as B, type CustomShapePlacementOptions as C, useCanvuResolvedTools as D, useCanvuViewportContext as E, type PlacementPreview as P, type SelectModeItemClickDetail as S, type VectorToolDefinition as V, type WorldPointerDownDetail as W, type CanvasPlugin as a, VectorSelectionInspector as b, type CanvasPluginComponentProps as c, type CanvasPluginContribution as d, type CanvasPluginItemsChangeMiddlewareContext as e, type CanvasPluginRenderContext as f, type CanvuChromeActiveToolStyle as g, CanvuChromeContext as h, type CanvuChromeContextValue as i, type CanvuChromeSelectionStyleChange as j, CanvuPluginContext as k, type CanvuPluginContextValue as l, type CanvuPluginViewportSnapshot as m, type SelectModeItemClickResult as n, type VectorCanvasSpacePosition as o, type VectorItemsChangeInfo as p, type VectorItemsChangeMotive as q, type VectorSelectionInspectorProps as r, VectorViewport as s, type VectorViewportHandle as t, type VectorViewportProps as u, createCanvuPlugin as v, getBoardPositionStyle as w, useCanvuChromeContext as x, useCanvuDocumentContext as y, useCanvuPluginContext as z };
|