canvu-react 0.4.64 → 0.4.66

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/react.d.cts CHANGED
@@ -4,8 +4,8 @@ import { I as IndexedDbImageStore } from './asset-hydration-F6aM5C7x.cjs';
4
4
  export { H as HydratedSceneItemsWithAssetsResult, h as hydrateSceneItemsWithAssets } from './asset-hydration-F6aM5C7x.cjs';
5
5
  import { V as VectorViewportAssetKind, a as VectorViewportAssetStore } from './asset-store-35ysK28r.cjs';
6
6
  export { b as VectorViewportAssetHydrationRequest, c as VectorViewportAssetResolveRequest, d as VectorViewportAssetResolveResult, e as VectorViewportAssetUploadRequest, f as VectorViewportAssetUploadResult } from './asset-store-35ysK28r.cjs';
7
- import { B as BoardComponentPosition, V as VectorToolDefinition, C as CustomShapePlacementOptions, a as CanvuBeforeInteractionHook, b as CanvuAfterInteractionHook, c as CanvasPlugin, d as VectorSelectionInspector } from './types-Ce4-OZbd.cjs';
8
- export { e as CanvasPluginComponentProps, f as CanvasPluginContribution, g as CanvasPluginItemsChangeMiddlewareContext, h as CanvasPluginRenderContext, i as CanvuAfterInteractionDetail, j as CanvuBeforeInteractionResult, k as CanvuChromeActiveToolStyle, l as CanvuChromeContext, m as CanvuChromeContextValue, n as CanvuChromeSelectionStyleChange, o as CanvuInteractionDetail, p as CanvuInteractionKind, q as CanvuInteractionOutcome, r as CanvuInteractionPoint, s as CanvuPluginContext, t as CanvuPluginContextValue, u as CanvuPluginViewportSnapshot, P as PlacementPreview, S as SelectModeItemClickDetail, v as SelectModeItemClickResult, w as VectorCanvasSpacePosition, x as VectorItemsChangeInfo, y as VectorItemsChangeMotive, z as VectorSelectionInspectorProps, A as VectorViewport, D as VectorViewportHandle, E as VectorViewportProps, W as WorldPointerDownDetail, F as createCanvuPlugin, G as getBoardPositionStyle, H as useCanvuChromeContext, I as useCanvuDocumentContext, J as useCanvuPluginContext, K as useCanvuPluginContribution, L as useCanvuResolvedTools, M as useCanvuViewportContext } from './types-Ce4-OZbd.cjs';
7
+ import { B as BoardComponentPosition, V as VectorToolDefinition, C as CustomShapePlacementOptions, a as CanvuBeforeInteractionHook, b as CanvuAfterInteractionHook, c as CanvasPlugin, d as VectorSelectionInspector } from './types-D5d-3dvz.cjs';
8
+ export { e as CanvasPluginComponentProps, f as CanvasPluginContribution, g as CanvasPluginItemsChangeMiddlewareContext, h as CanvasPluginRenderContext, i as CanvuAfterInteractionDetail, j as CanvuBeforeInteractionResult, k as CanvuChromeActiveToolStyle, l as CanvuChromeContext, m as CanvuChromeContextValue, n as CanvuChromeSelectionStyleChange, o as CanvuInteractionDetail, p as CanvuInteractionKind, q as CanvuInteractionOutcome, r as CanvuInteractionPoint, s as CanvuPluginContext, t as CanvuPluginContextValue, u as CanvuPluginViewportSnapshot, P as PlacementPreview, R as ReadOnlyInteractionOptions, v as ReadOnlyItemClickCandidateDetail, w as ReadOnlyItemClickScope, S as SHAPE_CONTEXT_MENU_ITEM_IDS, x as SelectModeItemClickDetail, y as SelectModeItemClickResult, z as ShapeContextMenu, A as ShapeContextMenuItem, D as ShapeContextMenuProps, E as ShapeContextMenuRenderContext, F as VectorCanvasSpacePosition, G as VectorItemsChangeInfo, H as VectorItemsChangeMotive, I as VectorSelectionInspectorProps, J as VectorViewport, K as VectorViewportHandle, L as VectorViewportProps, W as WorldPointerDownDetail, M as createCanvuPlugin, N as getBoardPositionStyle, O as useCanvuChromeContext, Q as useCanvuDocumentContext, T as useCanvuPluginContext, U as useCanvuPluginContribution, X as useCanvuResolvedTools, Y as useCanvuViewportContext } from './types-D5d-3dvz.cjs';
9
9
  import * as react_jsx_runtime from 'react/jsx-runtime';
10
10
  import * as react from 'react';
11
11
  import { CSSProperties, ReactNode, ReactElement, SVGProps } from 'react';
@@ -510,29 +510,6 @@ type CreateToolPluginOptions = VectorToolDefinition & {
510
510
  */
511
511
  declare function createToolPlugin(options: CreateToolPluginOptions): CanvasPlugin;
512
512
 
513
- type ShapeContextMenuProps = {
514
- /** Viewport client coordinates (from `clientX` / `clientY`). */
515
- x: number;
516
- y: number;
517
- /** When true, all selected items are locked — action is “unlock”. */
518
- allSelectedLocked: boolean;
519
- onClose: () => void;
520
- onToggleLock: () => void;
521
- onCut: () => void;
522
- onCopy: () => void;
523
- onBringToFront: () => void;
524
- onBringForward: () => void;
525
- onSendBackward: () => void;
526
- onSendToBack: () => void;
527
- onDuplicate: () => void;
528
- onDelete: () => void;
529
- };
530
- /**
531
- * Floating menu for shape actions (reorder, clipboard, lock, delete).
532
- * Renders in a portal and closes on Escape or outside click.
533
- */
534
- declare function ShapeContextMenu({ x, y, allSelectedLocked, onClose, onToggleLock, onCut, onCopy, onBringToFront, onBringForward, onSendBackward, onSendToBack, onDuplicate, onDelete, }: ShapeContextMenuProps): react.ReactPortal | null;
535
-
536
513
  /**
537
514
  * Tool ids shown in the overflow menu at the end of the default toolbar (horizontal layout).
538
515
  * Order: shapes, marker, laser, image.
@@ -664,8 +641,31 @@ type VectorToolbarProps = {
664
641
  /** Controlled selection. */
665
642
  value: string;
666
643
  onChange: (toolId: string) => void;
667
- /** Defaults to {@link DEFAULT_VECTOR_TOOLS}. Ignored when JSX `children` are provided. */
668
- tools?: VectorToolDefinition[];
644
+ /**
645
+ * Exact base tool list for default and render-prop modes.
646
+ *
647
+ * Omit this to use plugin-resolved tools from {@link VectorViewport}, falling back to
648
+ * {@link DEFAULT_VECTOR_TOOLS}. JSX `children` mode ignores this and renders exactly
649
+ * the children you provide.
650
+ */
651
+ tools?: readonly VectorToolDefinition[];
652
+ /**
653
+ * Tool additions or replacements merged by `id` into the base list.
654
+ *
655
+ * Use this for small customizations: a matching `id` replaces the built-in or plugin tool
656
+ * in place, while new ids append at the end. Later contributions win. Prefer `tools`
657
+ * when you want to own the entire base list, and JSX `children` when you want exact markup.
658
+ *
659
+ * @example
660
+ * ```tsx
661
+ * <VectorToolbar
662
+ * value={tool}
663
+ * onChange={setTool}
664
+ * toolContributions={[{ id: "rect", label: "Box", icon: <BoxIcon /> }]}
665
+ * />
666
+ * ```
667
+ */
668
+ toolContributions?: readonly VectorToolDefinition[];
669
669
  /**
670
670
  * Tool ids placed in the overflow menu at the end of the toolbar (horizontal) or bottom (vertical).
671
671
  * Defaults to {@link DEFAULT_OVERFLOW_TOOL_IDS}. Pass an empty array to show every tool in the main strip.
@@ -818,4 +818,4 @@ type VectorToolbarWithStatics = ((props: VectorToolbarProps) => ReactElement) &
818
818
  */
819
819
  declare const VectorToolbar: VectorToolbarWithStatics;
820
820
 
821
- export { BoardComponentPosition, CanvasPlugin, CanvuAfterInteractionHook, CanvuBeforeInteractionHook, type CreateLocalStoragePersistenceAdapterOptions, type CreateToolPluginOptions, CustomShapePlacementOptions, DEFAULT_OVERFLOW_TOOL_IDS, DEFAULT_VECTOR_CANVAS_STORAGE_KEY, DEFAULT_VECTOR_TOOLS, IconArchitecturalCloud, IconArrow, IconDraw, IconEllipse, IconHand, IconImage, IconLaser, IconLine, IconRect, IconSelect, IconText, ImagesMenu, type ImagesMenuCollapsedButtonProps, type ImagesMenuCollapsedButtonRenderProps, type ImagesMenuLabels, type ImagesMenuProps, type IngestAssetFileError, type IngestAssetFilesToSceneItemsOptions, type IngestAssetFilesToSceneItemsResult, type IngestedAssetItemContext, NavMenu, type NavMenuMinimapProps, type NavMenuProps, type NavMenuUndoRedoProps, type NavMenuZoomControlsProps, ShapeContextMenu, type ShapeContextMenuProps, type UseVectorCanvasDocumentOptions, type UseVectorCanvasDocumentResult, VectorCanvas, VectorCanvasBody, VectorCanvasHeader, VectorCanvasMain, VectorCanvasPersistenceAdapter, VectorCanvasRemoteAdapter, VectorCanvasRoot, type VectorCanvasSlotProps, type VectorCanvasSpaceProps, VectorCanvasToolbar, type VectorCanvasToolbarProps, VectorCanvasViewportSurface, VectorSelectionInspector, VectorToolDefinition, VectorToolbar, type VectorToolbarOverflowProps, type VectorToolbarProps, type VectorToolbarRenderContext, type VectorToolbarToolLockProps, type VectorToolbarToolProps, VectorViewportAssetKind, VectorViewportAssetStore, createIndexedDbPersistenceAdapter, createLocalStoragePersistenceAdapter, createNoopPersistenceAdapter, createToolPlugin, cursorForVectorToolId, ingestAssetFilesToSceneItems, useVectorCanvasDocument };
821
+ export { BoardComponentPosition, CanvasPlugin, CanvuAfterInteractionHook, CanvuBeforeInteractionHook, type CreateLocalStoragePersistenceAdapterOptions, type CreateToolPluginOptions, CustomShapePlacementOptions, DEFAULT_OVERFLOW_TOOL_IDS, DEFAULT_VECTOR_CANVAS_STORAGE_KEY, DEFAULT_VECTOR_TOOLS, IconArchitecturalCloud, IconArrow, IconDraw, IconEllipse, IconHand, IconImage, IconLaser, IconLine, IconRect, IconSelect, IconText, ImagesMenu, type ImagesMenuCollapsedButtonProps, type ImagesMenuCollapsedButtonRenderProps, type ImagesMenuLabels, type ImagesMenuProps, type IngestAssetFileError, type IngestAssetFilesToSceneItemsOptions, type IngestAssetFilesToSceneItemsResult, type IngestedAssetItemContext, NavMenu, type NavMenuMinimapProps, type NavMenuProps, type NavMenuUndoRedoProps, type NavMenuZoomControlsProps, type UseVectorCanvasDocumentOptions, type UseVectorCanvasDocumentResult, VectorCanvas, VectorCanvasBody, VectorCanvasHeader, VectorCanvasMain, VectorCanvasPersistenceAdapter, VectorCanvasRemoteAdapter, VectorCanvasRoot, type VectorCanvasSlotProps, type VectorCanvasSpaceProps, VectorCanvasToolbar, type VectorCanvasToolbarProps, VectorCanvasViewportSurface, VectorSelectionInspector, VectorToolDefinition, VectorToolbar, type VectorToolbarOverflowProps, type VectorToolbarProps, type VectorToolbarRenderContext, type VectorToolbarToolLockProps, type VectorToolbarToolProps, VectorViewportAssetKind, VectorViewportAssetStore, createIndexedDbPersistenceAdapter, createLocalStoragePersistenceAdapter, createNoopPersistenceAdapter, createToolPlugin, cursorForVectorToolId, ingestAssetFilesToSceneItems, useVectorCanvasDocument };
package/dist/react.d.ts CHANGED
@@ -4,8 +4,8 @@ import { I as IndexedDbImageStore } from './asset-hydration-BSjiek7Q.js';
4
4
  export { H as HydratedSceneItemsWithAssetsResult, h as hydrateSceneItemsWithAssets } from './asset-hydration-BSjiek7Q.js';
5
5
  import { V as VectorViewportAssetKind, a as VectorViewportAssetStore } from './asset-store-D_FjW_CN.js';
6
6
  export { b as VectorViewportAssetHydrationRequest, c as VectorViewportAssetResolveRequest, d as VectorViewportAssetResolveResult, e as VectorViewportAssetUploadRequest, f as VectorViewportAssetUploadResult } from './asset-store-D_FjW_CN.js';
7
- import { B as BoardComponentPosition, V as VectorToolDefinition, C as CustomShapePlacementOptions, a as CanvuBeforeInteractionHook, b as CanvuAfterInteractionHook, c as CanvasPlugin, d as VectorSelectionInspector } from './types-PsLgDGZT.js';
8
- export { e as CanvasPluginComponentProps, f as CanvasPluginContribution, g as CanvasPluginItemsChangeMiddlewareContext, h as CanvasPluginRenderContext, i as CanvuAfterInteractionDetail, j as CanvuBeforeInteractionResult, k as CanvuChromeActiveToolStyle, l as CanvuChromeContext, m as CanvuChromeContextValue, n as CanvuChromeSelectionStyleChange, o as CanvuInteractionDetail, p as CanvuInteractionKind, q as CanvuInteractionOutcome, r as CanvuInteractionPoint, s as CanvuPluginContext, t as CanvuPluginContextValue, u as CanvuPluginViewportSnapshot, P as PlacementPreview, S as SelectModeItemClickDetail, v as SelectModeItemClickResult, w as VectorCanvasSpacePosition, x as VectorItemsChangeInfo, y as VectorItemsChangeMotive, z as VectorSelectionInspectorProps, A as VectorViewport, D as VectorViewportHandle, E as VectorViewportProps, W as WorldPointerDownDetail, F as createCanvuPlugin, G as getBoardPositionStyle, H as useCanvuChromeContext, I as useCanvuDocumentContext, J as useCanvuPluginContext, K as useCanvuPluginContribution, L as useCanvuResolvedTools, M as useCanvuViewportContext } from './types-PsLgDGZT.js';
7
+ import { B as BoardComponentPosition, V as VectorToolDefinition, C as CustomShapePlacementOptions, a as CanvuBeforeInteractionHook, b as CanvuAfterInteractionHook, c as CanvasPlugin, d as VectorSelectionInspector } from './types-B-Jdh-n6.js';
8
+ export { e as CanvasPluginComponentProps, f as CanvasPluginContribution, g as CanvasPluginItemsChangeMiddlewareContext, h as CanvasPluginRenderContext, i as CanvuAfterInteractionDetail, j as CanvuBeforeInteractionResult, k as CanvuChromeActiveToolStyle, l as CanvuChromeContext, m as CanvuChromeContextValue, n as CanvuChromeSelectionStyleChange, o as CanvuInteractionDetail, p as CanvuInteractionKind, q as CanvuInteractionOutcome, r as CanvuInteractionPoint, s as CanvuPluginContext, t as CanvuPluginContextValue, u as CanvuPluginViewportSnapshot, P as PlacementPreview, R as ReadOnlyInteractionOptions, v as ReadOnlyItemClickCandidateDetail, w as ReadOnlyItemClickScope, S as SHAPE_CONTEXT_MENU_ITEM_IDS, x as SelectModeItemClickDetail, y as SelectModeItemClickResult, z as ShapeContextMenu, A as ShapeContextMenuItem, D as ShapeContextMenuProps, E as ShapeContextMenuRenderContext, F as VectorCanvasSpacePosition, G as VectorItemsChangeInfo, H as VectorItemsChangeMotive, I as VectorSelectionInspectorProps, J as VectorViewport, K as VectorViewportHandle, L as VectorViewportProps, W as WorldPointerDownDetail, M as createCanvuPlugin, N as getBoardPositionStyle, O as useCanvuChromeContext, Q as useCanvuDocumentContext, T as useCanvuPluginContext, U as useCanvuPluginContribution, X as useCanvuResolvedTools, Y as useCanvuViewportContext } from './types-B-Jdh-n6.js';
9
9
  import * as react_jsx_runtime from 'react/jsx-runtime';
10
10
  import * as react from 'react';
11
11
  import { CSSProperties, ReactNode, ReactElement, SVGProps } from 'react';
@@ -510,29 +510,6 @@ type CreateToolPluginOptions = VectorToolDefinition & {
510
510
  */
511
511
  declare function createToolPlugin(options: CreateToolPluginOptions): CanvasPlugin;
512
512
 
513
- type ShapeContextMenuProps = {
514
- /** Viewport client coordinates (from `clientX` / `clientY`). */
515
- x: number;
516
- y: number;
517
- /** When true, all selected items are locked — action is “unlock”. */
518
- allSelectedLocked: boolean;
519
- onClose: () => void;
520
- onToggleLock: () => void;
521
- onCut: () => void;
522
- onCopy: () => void;
523
- onBringToFront: () => void;
524
- onBringForward: () => void;
525
- onSendBackward: () => void;
526
- onSendToBack: () => void;
527
- onDuplicate: () => void;
528
- onDelete: () => void;
529
- };
530
- /**
531
- * Floating menu for shape actions (reorder, clipboard, lock, delete).
532
- * Renders in a portal and closes on Escape or outside click.
533
- */
534
- declare function ShapeContextMenu({ x, y, allSelectedLocked, onClose, onToggleLock, onCut, onCopy, onBringToFront, onBringForward, onSendBackward, onSendToBack, onDuplicate, onDelete, }: ShapeContextMenuProps): react.ReactPortal | null;
535
-
536
513
  /**
537
514
  * Tool ids shown in the overflow menu at the end of the default toolbar (horizontal layout).
538
515
  * Order: shapes, marker, laser, image.
@@ -664,8 +641,31 @@ type VectorToolbarProps = {
664
641
  /** Controlled selection. */
665
642
  value: string;
666
643
  onChange: (toolId: string) => void;
667
- /** Defaults to {@link DEFAULT_VECTOR_TOOLS}. Ignored when JSX `children` are provided. */
668
- tools?: VectorToolDefinition[];
644
+ /**
645
+ * Exact base tool list for default and render-prop modes.
646
+ *
647
+ * Omit this to use plugin-resolved tools from {@link VectorViewport}, falling back to
648
+ * {@link DEFAULT_VECTOR_TOOLS}. JSX `children` mode ignores this and renders exactly
649
+ * the children you provide.
650
+ */
651
+ tools?: readonly VectorToolDefinition[];
652
+ /**
653
+ * Tool additions or replacements merged by `id` into the base list.
654
+ *
655
+ * Use this for small customizations: a matching `id` replaces the built-in or plugin tool
656
+ * in place, while new ids append at the end. Later contributions win. Prefer `tools`
657
+ * when you want to own the entire base list, and JSX `children` when you want exact markup.
658
+ *
659
+ * @example
660
+ * ```tsx
661
+ * <VectorToolbar
662
+ * value={tool}
663
+ * onChange={setTool}
664
+ * toolContributions={[{ id: "rect", label: "Box", icon: <BoxIcon /> }]}
665
+ * />
666
+ * ```
667
+ */
668
+ toolContributions?: readonly VectorToolDefinition[];
669
669
  /**
670
670
  * Tool ids placed in the overflow menu at the end of the toolbar (horizontal) or bottom (vertical).
671
671
  * Defaults to {@link DEFAULT_OVERFLOW_TOOL_IDS}. Pass an empty array to show every tool in the main strip.
@@ -818,4 +818,4 @@ type VectorToolbarWithStatics = ((props: VectorToolbarProps) => ReactElement) &
818
818
  */
819
819
  declare const VectorToolbar: VectorToolbarWithStatics;
820
820
 
821
- export { BoardComponentPosition, CanvasPlugin, CanvuAfterInteractionHook, CanvuBeforeInteractionHook, type CreateLocalStoragePersistenceAdapterOptions, type CreateToolPluginOptions, CustomShapePlacementOptions, DEFAULT_OVERFLOW_TOOL_IDS, DEFAULT_VECTOR_CANVAS_STORAGE_KEY, DEFAULT_VECTOR_TOOLS, IconArchitecturalCloud, IconArrow, IconDraw, IconEllipse, IconHand, IconImage, IconLaser, IconLine, IconRect, IconSelect, IconText, ImagesMenu, type ImagesMenuCollapsedButtonProps, type ImagesMenuCollapsedButtonRenderProps, type ImagesMenuLabels, type ImagesMenuProps, type IngestAssetFileError, type IngestAssetFilesToSceneItemsOptions, type IngestAssetFilesToSceneItemsResult, type IngestedAssetItemContext, NavMenu, type NavMenuMinimapProps, type NavMenuProps, type NavMenuUndoRedoProps, type NavMenuZoomControlsProps, ShapeContextMenu, type ShapeContextMenuProps, type UseVectorCanvasDocumentOptions, type UseVectorCanvasDocumentResult, VectorCanvas, VectorCanvasBody, VectorCanvasHeader, VectorCanvasMain, VectorCanvasPersistenceAdapter, VectorCanvasRemoteAdapter, VectorCanvasRoot, type VectorCanvasSlotProps, type VectorCanvasSpaceProps, VectorCanvasToolbar, type VectorCanvasToolbarProps, VectorCanvasViewportSurface, VectorSelectionInspector, VectorToolDefinition, VectorToolbar, type VectorToolbarOverflowProps, type VectorToolbarProps, type VectorToolbarRenderContext, type VectorToolbarToolLockProps, type VectorToolbarToolProps, VectorViewportAssetKind, VectorViewportAssetStore, createIndexedDbPersistenceAdapter, createLocalStoragePersistenceAdapter, createNoopPersistenceAdapter, createToolPlugin, cursorForVectorToolId, ingestAssetFilesToSceneItems, useVectorCanvasDocument };
821
+ export { BoardComponentPosition, CanvasPlugin, CanvuAfterInteractionHook, CanvuBeforeInteractionHook, type CreateLocalStoragePersistenceAdapterOptions, type CreateToolPluginOptions, CustomShapePlacementOptions, DEFAULT_OVERFLOW_TOOL_IDS, DEFAULT_VECTOR_CANVAS_STORAGE_KEY, DEFAULT_VECTOR_TOOLS, IconArchitecturalCloud, IconArrow, IconDraw, IconEllipse, IconHand, IconImage, IconLaser, IconLine, IconRect, IconSelect, IconText, ImagesMenu, type ImagesMenuCollapsedButtonProps, type ImagesMenuCollapsedButtonRenderProps, type ImagesMenuLabels, type ImagesMenuProps, type IngestAssetFileError, type IngestAssetFilesToSceneItemsOptions, type IngestAssetFilesToSceneItemsResult, type IngestedAssetItemContext, NavMenu, type NavMenuMinimapProps, type NavMenuProps, type NavMenuUndoRedoProps, type NavMenuZoomControlsProps, type UseVectorCanvasDocumentOptions, type UseVectorCanvasDocumentResult, VectorCanvas, VectorCanvasBody, VectorCanvasHeader, VectorCanvasMain, VectorCanvasPersistenceAdapter, VectorCanvasRemoteAdapter, VectorCanvasRoot, type VectorCanvasSlotProps, type VectorCanvasSpaceProps, VectorCanvasToolbar, type VectorCanvasToolbarProps, VectorCanvasViewportSurface, VectorSelectionInspector, VectorToolDefinition, VectorToolbar, type VectorToolbarOverflowProps, type VectorToolbarProps, type VectorToolbarRenderContext, type VectorToolbarToolLockProps, type VectorToolbarToolProps, VectorViewportAssetKind, VectorViewportAssetStore, createIndexedDbPersistenceAdapter, createLocalStoragePersistenceAdapter, createNoopPersistenceAdapter, createToolPlugin, cursorForVectorToolId, ingestAssetFilesToSceneItems, useVectorCanvasDocument };