canvu-react 0.4.65 → 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/chatbot.d.cts +1 -1
- package/dist/chatbot.d.ts +1 -1
- package/dist/react.cjs +229 -78
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +28 -28
- package/dist/react.d.ts +28 -28
- package/dist/react.js +230 -80
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +1 -1
- package/dist/realtime.d.ts +1 -1
- package/dist/realtime.js.map +1 -1
- package/dist/{types-BZUp3LpC.d.ts → types-B-Jdh-n6.d.ts} +166 -1
- package/dist/{types-Bw3REwrb.d.cts → types-D5d-3dvz.d.cts} +166 -1
- package/package.json +1 -1
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-
|
|
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
|
|
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
|
-
/**
|
|
668
|
-
|
|
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,
|
|
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-
|
|
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
|
|
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
|
-
/**
|
|
668
|
-
|
|
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,
|
|
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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import getStroke from 'perfect-freehand';
|
|
2
|
-
import { createContext, forwardRef, useRef, useState, useCallback, useMemo, useId, useEffect, useImperativeHandle, useContext, useLayoutEffect, Children, isValidElement } from 'react';
|
|
2
|
+
import { createContext, forwardRef, useRef, useState, useCallback, useMemo, useId, useEffect, useImperativeHandle, useContext, useLayoutEffect, Fragment as Fragment$1, Children, isValidElement } from 'react';
|
|
3
3
|
import { useSensors, useSensor, PointerSensor, DndContext } from '@dnd-kit/core';
|
|
4
4
|
import { SortableContext, verticalListSortingStrategy, useSortable, arrayMove } from '@dnd-kit/sortable';
|
|
5
5
|
import { CSS } from '@dnd-kit/utilities';
|
|
@@ -3216,6 +3216,30 @@ function createToolPlugin(options) {
|
|
|
3216
3216
|
}
|
|
3217
3217
|
});
|
|
3218
3218
|
}
|
|
3219
|
+
|
|
3220
|
+
// src/react/merge-by-id.ts
|
|
3221
|
+
function mergeById(baseItems, ...contributions) {
|
|
3222
|
+
const next = [...baseItems];
|
|
3223
|
+
const indexById = /* @__PURE__ */ new Map();
|
|
3224
|
+
for (const [index, item] of next.entries()) {
|
|
3225
|
+
if (!indexById.has(item.id)) {
|
|
3226
|
+
indexById.set(item.id, index);
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
for (const contribution of contributions) {
|
|
3230
|
+
if (!contribution?.length) continue;
|
|
3231
|
+
for (const item of contribution) {
|
|
3232
|
+
const existingIndex = indexById.get(item.id);
|
|
3233
|
+
if (existingIndex !== void 0) {
|
|
3234
|
+
next[existingIndex] = item;
|
|
3235
|
+
continue;
|
|
3236
|
+
}
|
|
3237
|
+
indexById.set(item.id, next.length);
|
|
3238
|
+
next.push(item);
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
return next;
|
|
3242
|
+
}
|
|
3219
3243
|
var menuStyle = {
|
|
3220
3244
|
position: "fixed",
|
|
3221
3245
|
zIndex: 1e4,
|
|
@@ -3245,9 +3269,97 @@ var dividerStyle = {
|
|
|
3245
3269
|
margin: "4px 8px",
|
|
3246
3270
|
background: "#e2e8f0"
|
|
3247
3271
|
};
|
|
3272
|
+
var SHAPE_CONTEXT_MENU_ITEM_IDS = {
|
|
3273
|
+
cut: "cut",
|
|
3274
|
+
copy: "copy",
|
|
3275
|
+
duplicate: "duplicate",
|
|
3276
|
+
reorderDivider: "reorder-divider",
|
|
3277
|
+
bringToFront: "bring-to-front",
|
|
3278
|
+
bringForward: "bring-forward",
|
|
3279
|
+
sendBackward: "send-backward",
|
|
3280
|
+
sendToBack: "send-to-back",
|
|
3281
|
+
lockDivider: "lock-divider",
|
|
3282
|
+
toggleLock: "toggle-lock",
|
|
3283
|
+
delete: "delete"
|
|
3284
|
+
};
|
|
3285
|
+
function renderAction(label, onClick, options) {
|
|
3286
|
+
return /* @__PURE__ */ jsx(
|
|
3287
|
+
"button",
|
|
3288
|
+
{
|
|
3289
|
+
type: "button",
|
|
3290
|
+
role: "menuitem",
|
|
3291
|
+
style: {
|
|
3292
|
+
...itemStyle,
|
|
3293
|
+
...options?.danger ? { color: "#b91c1c" } : {}
|
|
3294
|
+
},
|
|
3295
|
+
onMouseEnter: (e) => {
|
|
3296
|
+
e.currentTarget.style.background = options?.danger ? "#fef2f2" : "#f1f5f9";
|
|
3297
|
+
},
|
|
3298
|
+
onMouseLeave: (e) => {
|
|
3299
|
+
e.currentTarget.style.background = "transparent";
|
|
3300
|
+
},
|
|
3301
|
+
onClick,
|
|
3302
|
+
children: label
|
|
3303
|
+
}
|
|
3304
|
+
);
|
|
3305
|
+
}
|
|
3306
|
+
function renderDivider() {
|
|
3307
|
+
return /* @__PURE__ */ jsx("div", { "aria-hidden": true, style: dividerStyle });
|
|
3308
|
+
}
|
|
3309
|
+
var DEFAULT_SHAPE_CONTEXT_MENU_ITEMS = [
|
|
3310
|
+
{
|
|
3311
|
+
id: SHAPE_CONTEXT_MENU_ITEM_IDS.cut,
|
|
3312
|
+
render: (ctx) => renderAction("Recortar", ctx.cut)
|
|
3313
|
+
},
|
|
3314
|
+
{
|
|
3315
|
+
id: SHAPE_CONTEXT_MENU_ITEM_IDS.copy,
|
|
3316
|
+
render: (ctx) => renderAction("Copiar", ctx.copy)
|
|
3317
|
+
},
|
|
3318
|
+
{
|
|
3319
|
+
id: SHAPE_CONTEXT_MENU_ITEM_IDS.duplicate,
|
|
3320
|
+
render: (ctx) => renderAction("Duplicar", ctx.duplicate)
|
|
3321
|
+
},
|
|
3322
|
+
{
|
|
3323
|
+
id: SHAPE_CONTEXT_MENU_ITEM_IDS.reorderDivider,
|
|
3324
|
+
render: renderDivider
|
|
3325
|
+
},
|
|
3326
|
+
{
|
|
3327
|
+
id: SHAPE_CONTEXT_MENU_ITEM_IDS.bringToFront,
|
|
3328
|
+
render: (ctx) => renderAction("Trazer para frente", ctx.bringToFront)
|
|
3329
|
+
},
|
|
3330
|
+
{
|
|
3331
|
+
id: SHAPE_CONTEXT_MENU_ITEM_IDS.bringForward,
|
|
3332
|
+
render: (ctx) => renderAction("Avancar uma camada", ctx.bringForward)
|
|
3333
|
+
},
|
|
3334
|
+
{
|
|
3335
|
+
id: SHAPE_CONTEXT_MENU_ITEM_IDS.sendBackward,
|
|
3336
|
+
render: (ctx) => renderAction("Recuar uma camada", ctx.sendBackward)
|
|
3337
|
+
},
|
|
3338
|
+
{
|
|
3339
|
+
id: SHAPE_CONTEXT_MENU_ITEM_IDS.sendToBack,
|
|
3340
|
+
render: (ctx) => renderAction("Enviar para tras", ctx.sendToBack)
|
|
3341
|
+
},
|
|
3342
|
+
{
|
|
3343
|
+
id: SHAPE_CONTEXT_MENU_ITEM_IDS.lockDivider,
|
|
3344
|
+
render: renderDivider
|
|
3345
|
+
},
|
|
3346
|
+
{
|
|
3347
|
+
id: SHAPE_CONTEXT_MENU_ITEM_IDS.toggleLock,
|
|
3348
|
+
render: (ctx) => renderAction(
|
|
3349
|
+
ctx.allSelectedLocked ? "Desbloquear" : "Bloquear",
|
|
3350
|
+
ctx.toggleLock
|
|
3351
|
+
)
|
|
3352
|
+
},
|
|
3353
|
+
{
|
|
3354
|
+
id: SHAPE_CONTEXT_MENU_ITEM_IDS.delete,
|
|
3355
|
+
render: (ctx) => renderAction("Apagar", ctx.delete, { danger: true })
|
|
3356
|
+
}
|
|
3357
|
+
];
|
|
3248
3358
|
function ShapeContextMenu({
|
|
3249
3359
|
x,
|
|
3250
3360
|
y,
|
|
3361
|
+
selectedIds,
|
|
3362
|
+
selectedItems = [],
|
|
3251
3363
|
allSelectedLocked,
|
|
3252
3364
|
onClose,
|
|
3253
3365
|
onToggleLock,
|
|
@@ -3258,7 +3370,10 @@ function ShapeContextMenu({
|
|
|
3258
3370
|
onSendBackward,
|
|
3259
3371
|
onSendToBack,
|
|
3260
3372
|
onDuplicate,
|
|
3261
|
-
onDelete
|
|
3373
|
+
onDelete,
|
|
3374
|
+
items,
|
|
3375
|
+
itemContributions,
|
|
3376
|
+
children
|
|
3262
3377
|
}) {
|
|
3263
3378
|
const rootRef = useRef(null);
|
|
3264
3379
|
useLayoutEffect(() => {
|
|
@@ -3298,49 +3413,43 @@ function ShapeContextMenu({
|
|
|
3298
3413
|
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
3299
3414
|
};
|
|
3300
3415
|
}, [onClose]);
|
|
3416
|
+
const menuItems = useMemo(
|
|
3417
|
+
() => mergeById(items ?? DEFAULT_SHAPE_CONTEXT_MENU_ITEMS, itemContributions),
|
|
3418
|
+
[itemContributions, items]
|
|
3419
|
+
);
|
|
3301
3420
|
const run = (fn) => () => {
|
|
3302
3421
|
fn();
|
|
3303
3422
|
onClose();
|
|
3304
3423
|
};
|
|
3305
|
-
const
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3424
|
+
const resolvedSelectedIds = selectedIds ?? selectedItems.map((item) => item.id);
|
|
3425
|
+
const resolvedAllSelectedLocked = allSelectedLocked ?? (selectedItems.length > 0 && selectedItems.every((item) => item.locked));
|
|
3426
|
+
const menuContext = {
|
|
3427
|
+
position: { x, y },
|
|
3428
|
+
selectedIds: resolvedSelectedIds,
|
|
3429
|
+
selectedItems,
|
|
3430
|
+
allSelectedLocked: resolvedAllSelectedLocked,
|
|
3431
|
+
anySelectedLocked: selectedItems.some((item) => item.locked),
|
|
3432
|
+
close: onClose,
|
|
3433
|
+
cut: run(onCut),
|
|
3434
|
+
copy: run(onCopy),
|
|
3435
|
+
duplicate: run(onDuplicate),
|
|
3436
|
+
toggleLock: run(onToggleLock),
|
|
3437
|
+
bringToFront: run(onBringToFront),
|
|
3438
|
+
bringForward: run(onBringForward),
|
|
3439
|
+
sendBackward: run(onSendBackward),
|
|
3440
|
+
sendToBack: run(onSendToBack),
|
|
3441
|
+
delete: run(onDelete),
|
|
3442
|
+
deleteSelection: run(onDelete)
|
|
3443
|
+
};
|
|
3444
|
+
const content = typeof children === "function" ? children(menuContext) : children !== void 0 ? children : menuItems.map((item) => /* @__PURE__ */ jsx(Fragment$1, { children: item.render(menuContext) }, item.id));
|
|
3445
|
+
const menu = /* @__PURE__ */ jsx(
|
|
3325
3446
|
"div",
|
|
3326
3447
|
{
|
|
3327
3448
|
ref: rootRef,
|
|
3328
3449
|
"data-slot": "shape-context-menu",
|
|
3329
3450
|
style: { ...menuStyle, left: x, top: y },
|
|
3330
3451
|
role: "menu",
|
|
3331
|
-
children:
|
|
3332
|
-
renderAction("Recortar", onCut),
|
|
3333
|
-
renderAction("Copiar", onCopy),
|
|
3334
|
-
renderAction("Duplicar", onDuplicate),
|
|
3335
|
-
/* @__PURE__ */ jsx("div", { "aria-hidden": true, style: dividerStyle }),
|
|
3336
|
-
renderAction("Trazer para frente", onBringToFront),
|
|
3337
|
-
renderAction("Avancar uma camada", onBringForward),
|
|
3338
|
-
renderAction("Recuar uma camada", onSendBackward),
|
|
3339
|
-
renderAction("Enviar para tras", onSendToBack),
|
|
3340
|
-
/* @__PURE__ */ jsx("div", { "aria-hidden": true, style: dividerStyle }),
|
|
3341
|
-
renderAction(allSelectedLocked ? "Desbloquear" : "Bloquear", onToggleLock),
|
|
3342
|
-
renderAction("Apagar", onDelete, { danger: true })
|
|
3343
|
-
]
|
|
3452
|
+
children: content
|
|
3344
3453
|
}
|
|
3345
3454
|
);
|
|
3346
3455
|
if (typeof document === "undefined") {
|
|
@@ -5055,6 +5164,7 @@ function VectorToolbarComponent({
|
|
|
5055
5164
|
value,
|
|
5056
5165
|
onChange,
|
|
5057
5166
|
tools,
|
|
5167
|
+
toolContributions,
|
|
5058
5168
|
overflowToolIds = DEFAULT_OVERFLOW_TOOL_IDS,
|
|
5059
5169
|
overflowMenuAriaLabel = "More tools",
|
|
5060
5170
|
"aria-label": ariaLabel = "Canvas tools",
|
|
@@ -5072,7 +5182,10 @@ function VectorToolbarComponent({
|
|
|
5072
5182
|
}) {
|
|
5073
5183
|
const pluginContext = useContext(CanvuPluginContext);
|
|
5074
5184
|
const runtimeTools = pluginContext?.resolvedTools;
|
|
5075
|
-
const resolvedTools =
|
|
5185
|
+
const resolvedTools = useMemo(
|
|
5186
|
+
() => mergeById(tools ?? runtimeTools ?? DEFAULT_VECTOR_TOOLS, toolContributions),
|
|
5187
|
+
[runtimeTools, toolContributions, tools]
|
|
5188
|
+
);
|
|
5076
5189
|
const { primary: primaryTools, overflow: overflowTools } = splitToolbarTools(
|
|
5077
5190
|
resolvedTools,
|
|
5078
5191
|
overflowToolIds
|
|
@@ -8110,18 +8223,6 @@ function isDefaultMarkerToolStyle(style) {
|
|
|
8110
8223
|
function tagCustomPlacementItem(item, toolId) {
|
|
8111
8224
|
return item.customToolId === toolId ? item : { ...item, customToolId: toolId };
|
|
8112
8225
|
}
|
|
8113
|
-
function mergeToolListById(baseTools, pluginTools) {
|
|
8114
|
-
const next = [...baseTools];
|
|
8115
|
-
for (const tool of pluginTools) {
|
|
8116
|
-
const index = next.findIndex((candidate) => candidate.id === tool.id);
|
|
8117
|
-
if (index >= 0) {
|
|
8118
|
-
next[index] = tool;
|
|
8119
|
-
continue;
|
|
8120
|
-
}
|
|
8121
|
-
next.push(tool);
|
|
8122
|
-
}
|
|
8123
|
-
return next;
|
|
8124
|
-
}
|
|
8125
8226
|
function composePluginEvent(consumerHandler, pluginHandlers) {
|
|
8126
8227
|
const activePluginHandlers = pluginHandlers.filter(
|
|
8127
8228
|
(handler) => handler != null
|
|
@@ -8249,6 +8350,8 @@ var VectorViewport = forwardRef(
|
|
|
8249
8350
|
navMenu,
|
|
8250
8351
|
selectionInspector,
|
|
8251
8352
|
selectionInspectorProps,
|
|
8353
|
+
contextMenu: renderContextMenu,
|
|
8354
|
+
contextMenuItems: consumerContextMenuItems,
|
|
8252
8355
|
plugins = [],
|
|
8253
8356
|
onCameraChange: consumerOnCameraChange,
|
|
8254
8357
|
customPlacement: consumerCustomPlacement,
|
|
@@ -8307,7 +8410,7 @@ var VectorViewport = forwardRef(
|
|
|
8307
8410
|
let nextTools = [...DEFAULT_VECTOR_TOOLS];
|
|
8308
8411
|
for (const contribution of orderedPluginContributions) {
|
|
8309
8412
|
if (contribution.tools?.length) {
|
|
8310
|
-
nextTools =
|
|
8413
|
+
nextTools = mergeById(nextTools, contribution.tools);
|
|
8311
8414
|
}
|
|
8312
8415
|
if (contribution.toolTransform) {
|
|
8313
8416
|
nextTools = contribution.toolTransform(nextTools);
|
|
@@ -8315,6 +8418,16 @@ var VectorViewport = forwardRef(
|
|
|
8315
8418
|
}
|
|
8316
8419
|
return nextTools;
|
|
8317
8420
|
}, [orderedPluginContributions]);
|
|
8421
|
+
const resolvedContextMenuItems = useMemo(
|
|
8422
|
+
() => mergeById(
|
|
8423
|
+
DEFAULT_SHAPE_CONTEXT_MENU_ITEMS,
|
|
8424
|
+
...orderedPluginContributions.map(
|
|
8425
|
+
(contribution) => contribution.contextMenuItems
|
|
8426
|
+
),
|
|
8427
|
+
consumerContextMenuItems
|
|
8428
|
+
),
|
|
8429
|
+
[consumerContextMenuItems, orderedPluginContributions]
|
|
8430
|
+
);
|
|
8318
8431
|
const allCustomPlacements = useMemo(() => {
|
|
8319
8432
|
const placements = [];
|
|
8320
8433
|
if (consumerCustomPlacement) placements.push(consumerCustomPlacement);
|
|
@@ -8494,7 +8607,7 @@ var VectorViewport = forwardRef(
|
|
|
8494
8607
|
isUndoingRef.current = true;
|
|
8495
8608
|
onItemsChangeRef.current?.(next, { motive: "redo" });
|
|
8496
8609
|
}, []);
|
|
8497
|
-
const [
|
|
8610
|
+
const [contextMenuState, setContextMenuState] = useState(null);
|
|
8498
8611
|
const [uncontrolledSel, setUncontrolledSel] = useState([]);
|
|
8499
8612
|
const isSelectionControlled = onSelectionChange !== void 0;
|
|
8500
8613
|
const controlledSelectedKey = JSON.stringify(selectedIdsProp ?? []);
|
|
@@ -9666,7 +9779,7 @@ var VectorViewport = forwardRef(
|
|
|
9666
9779
|
ignoreLocked: true
|
|
9667
9780
|
});
|
|
9668
9781
|
if (!hit) {
|
|
9669
|
-
|
|
9782
|
+
setContextMenuState(null);
|
|
9670
9783
|
return;
|
|
9671
9784
|
}
|
|
9672
9785
|
const cur = effectiveSelectedIdsRef.current;
|
|
@@ -9677,7 +9790,7 @@ var VectorViewport = forwardRef(
|
|
|
9677
9790
|
} else {
|
|
9678
9791
|
nextIds = cur;
|
|
9679
9792
|
}
|
|
9680
|
-
|
|
9793
|
+
setContextMenuState({
|
|
9681
9794
|
x: e.clientX,
|
|
9682
9795
|
y: e.clientY,
|
|
9683
9796
|
itemIds: nextIds
|
|
@@ -10227,7 +10340,7 @@ var VectorViewport = forwardRef(
|
|
|
10227
10340
|
if (e.button !== 0) return;
|
|
10228
10341
|
if (editingTextIdRef.current) return;
|
|
10229
10342
|
wrapperRef.current?.focus({ preventScroll: true });
|
|
10230
|
-
|
|
10343
|
+
setContextMenuState(null);
|
|
10231
10344
|
const tool = toolIdRef.current;
|
|
10232
10345
|
if (tool === "hand") return;
|
|
10233
10346
|
if (applePencilNav && e.pointerType === "pen" && navigator.maxTouchPoints > 0 && (tool === "draw" || tool === "marker")) {
|
|
@@ -10647,7 +10760,7 @@ var VectorViewport = forwardRef(
|
|
|
10647
10760
|
return;
|
|
10648
10761
|
}
|
|
10649
10762
|
wrapperRef.current?.focus({ preventScroll: true });
|
|
10650
|
-
|
|
10763
|
+
setContextMenuState(null);
|
|
10651
10764
|
const straightLine = tool === "draw" ? createStraightStrokeState(startPoint, e.clientX, e.clientY) : void 0;
|
|
10652
10765
|
const itemId = createShapeId();
|
|
10653
10766
|
const item = createFreehandStrokeItem(
|
|
@@ -10770,7 +10883,7 @@ var VectorViewport = forwardRef(
|
|
|
10770
10883
|
return;
|
|
10771
10884
|
}
|
|
10772
10885
|
wrapperRef.current?.focus({ preventScroll: true });
|
|
10773
|
-
|
|
10886
|
+
setContextMenuState(null);
|
|
10774
10887
|
penDetectedRef.current = true;
|
|
10775
10888
|
const straightLine = tool === "draw" ? createStraightStrokeState(startPoint, touch.clientX, touch.clientY) : void 0;
|
|
10776
10889
|
const itemId = createShapeId();
|
|
@@ -11810,6 +11923,66 @@ var VectorViewport = forwardRef(
|
|
|
11810
11923
|
const defaultNavMenu = cameraForOverlay ? /* @__PURE__ */ jsx(NavMenu, {}) : null;
|
|
11811
11924
|
const resolvedSelectionInspector = selectionInspector === void 0 ? defaultSelectionInspector : selectionInspector;
|
|
11812
11925
|
const resolvedNavMenu = navMenu === void 0 ? defaultNavMenu : navMenu;
|
|
11926
|
+
const contextMenuItemIds = contextMenuState?.itemIds ?? [];
|
|
11927
|
+
const contextMenuSelectedItems = contextMenuState ? contextMenuItemIds.map((id) => items.find((item) => item.id === id)).filter((item) => item != null) : [];
|
|
11928
|
+
const allContextMenuSelectedLocked = contextMenuItemIds.length > 0 && contextMenuItemIds.every((id) => items.find((item) => item.id === id)?.locked);
|
|
11929
|
+
const closeContextMenu = () => setContextMenuState(null);
|
|
11930
|
+
const runContextMenuAction = (fn) => () => {
|
|
11931
|
+
fn();
|
|
11932
|
+
closeContextMenu();
|
|
11933
|
+
};
|
|
11934
|
+
const contextMenuRenderContext = contextMenuState ? {
|
|
11935
|
+
position: { x: contextMenuState.x, y: contextMenuState.y },
|
|
11936
|
+
selectedIds: contextMenuItemIds,
|
|
11937
|
+
selectedItems: contextMenuSelectedItems,
|
|
11938
|
+
allSelectedLocked: allContextMenuSelectedLocked,
|
|
11939
|
+
anySelectedLocked: contextMenuSelectedItems.some((item) => item.locked),
|
|
11940
|
+
close: closeContextMenu,
|
|
11941
|
+
cut: runContextMenuAction(() => cutIds(contextMenuItemIds)),
|
|
11942
|
+
copy: runContextMenuAction(
|
|
11943
|
+
() => copyIdsToInternalClipboard(contextMenuItemIds)
|
|
11944
|
+
),
|
|
11945
|
+
duplicate: runContextMenuAction(() => duplicateIds(contextMenuItemIds)),
|
|
11946
|
+
toggleLock: runContextMenuAction(
|
|
11947
|
+
() => setLockedOnIds(contextMenuItemIds, !allContextMenuSelectedLocked)
|
|
11948
|
+
),
|
|
11949
|
+
bringToFront: runContextMenuAction(
|
|
11950
|
+
() => reorderIds(contextMenuItemIds, "front")
|
|
11951
|
+
),
|
|
11952
|
+
bringForward: runContextMenuAction(
|
|
11953
|
+
() => reorderIds(contextMenuItemIds, "forward")
|
|
11954
|
+
),
|
|
11955
|
+
sendBackward: runContextMenuAction(
|
|
11956
|
+
() => reorderIds(contextMenuItemIds, "backward")
|
|
11957
|
+
),
|
|
11958
|
+
sendToBack: runContextMenuAction(
|
|
11959
|
+
() => reorderIds(contextMenuItemIds, "back")
|
|
11960
|
+
),
|
|
11961
|
+
delete: runContextMenuAction(() => deleteIds(contextMenuItemIds)),
|
|
11962
|
+
deleteSelection: runContextMenuAction(() => deleteIds(contextMenuItemIds)),
|
|
11963
|
+
items: resolvedContextMenuItems
|
|
11964
|
+
} : null;
|
|
11965
|
+
const resolvedContextMenu = interactive && onItemsChange && contextMenuState && contextMenuRenderContext && renderContextMenu !== null ? renderContextMenu ? renderContextMenu(contextMenuRenderContext) : /* @__PURE__ */ jsx(
|
|
11966
|
+
ShapeContextMenu,
|
|
11967
|
+
{
|
|
11968
|
+
x: contextMenuState.x,
|
|
11969
|
+
y: contextMenuState.y,
|
|
11970
|
+
selectedIds: contextMenuItemIds,
|
|
11971
|
+
selectedItems: contextMenuSelectedItems,
|
|
11972
|
+
allSelectedLocked: allContextMenuSelectedLocked,
|
|
11973
|
+
items: resolvedContextMenuItems,
|
|
11974
|
+
onClose: closeContextMenu,
|
|
11975
|
+
onToggleLock: () => setLockedOnIds(contextMenuItemIds, !allContextMenuSelectedLocked),
|
|
11976
|
+
onCut: () => cutIds(contextMenuItemIds),
|
|
11977
|
+
onCopy: () => copyIdsToInternalClipboard(contextMenuItemIds),
|
|
11978
|
+
onBringToFront: () => reorderIds(contextMenuItemIds, "front"),
|
|
11979
|
+
onBringForward: () => reorderIds(contextMenuItemIds, "forward"),
|
|
11980
|
+
onSendBackward: () => reorderIds(contextMenuItemIds, "backward"),
|
|
11981
|
+
onSendToBack: () => reorderIds(contextMenuItemIds, "back"),
|
|
11982
|
+
onDuplicate: () => duplicateIds(contextMenuItemIds),
|
|
11983
|
+
onDelete: () => deleteIds(contextMenuItemIds)
|
|
11984
|
+
}
|
|
11985
|
+
) : null;
|
|
11813
11986
|
return /* @__PURE__ */ jsx(CanvuPluginContext.Provider, { value: pluginContextValue, children: /* @__PURE__ */ jsx(CanvuChromeContext.Provider, { value: chromeContextValue, children: /* @__PURE__ */ jsxs(
|
|
11814
11987
|
"div",
|
|
11815
11988
|
{
|
|
@@ -11963,30 +12136,7 @@ var VectorViewport = forwardRef(
|
|
|
11963
12136
|
}
|
|
11964
12137
|
),
|
|
11965
12138
|
resolvedSelectionInspector,
|
|
11966
|
-
|
|
11967
|
-
ShapeContextMenu,
|
|
11968
|
-
{
|
|
11969
|
-
x: contextMenu.x,
|
|
11970
|
-
y: contextMenu.y,
|
|
11971
|
-
allSelectedLocked: contextMenu.itemIds.length > 0 && contextMenu.itemIds.every(
|
|
11972
|
-
(id) => items.find((i) => i.id === id)?.locked
|
|
11973
|
-
),
|
|
11974
|
-
onClose: () => setContextMenu(null),
|
|
11975
|
-
onToggleLock: () => {
|
|
11976
|
-
const ids = contextMenu.itemIds;
|
|
11977
|
-
const allLocked = ids.length > 0 && ids.every((id) => items.find((i) => i.id === id)?.locked);
|
|
11978
|
-
setLockedOnIds(ids, !allLocked);
|
|
11979
|
-
},
|
|
11980
|
-
onCut: () => cutIds(contextMenu.itemIds),
|
|
11981
|
-
onCopy: () => copyIdsToInternalClipboard(contextMenu.itemIds),
|
|
11982
|
-
onBringToFront: () => reorderIds(contextMenu.itemIds, "front"),
|
|
11983
|
-
onBringForward: () => reorderIds(contextMenu.itemIds, "forward"),
|
|
11984
|
-
onSendBackward: () => reorderIds(contextMenu.itemIds, "backward"),
|
|
11985
|
-
onSendToBack: () => reorderIds(contextMenu.itemIds, "back"),
|
|
11986
|
-
onDuplicate: () => duplicateIds(contextMenu.itemIds),
|
|
11987
|
-
onDelete: () => deleteIds(contextMenu.itemIds)
|
|
11988
|
-
}
|
|
11989
|
-
),
|
|
12139
|
+
resolvedContextMenu,
|
|
11990
12140
|
resolvedNavMenu,
|
|
11991
12141
|
/* @__PURE__ */ jsx(
|
|
11992
12142
|
"div",
|
|
@@ -12005,6 +12155,6 @@ var VectorViewport = forwardRef(
|
|
|
12005
12155
|
);
|
|
12006
12156
|
VectorViewport.displayName = "VectorViewport";
|
|
12007
12157
|
|
|
12008
|
-
export { CanvuChromeContext, CanvuPluginContext, DEFAULT_OVERFLOW_TOOL_IDS, DEFAULT_VECTOR_CANVAS_STORAGE_KEY, DEFAULT_VECTOR_TOOLS, IconArchitecturalCloud, IconArrow, IconDraw, IconEllipse, IconHand, IconImage, IconLaser, IconLine, IconRect, IconSelect, IconText, ImagesMenu, NavMenu, ShapeContextMenu, VectorCanvas, VectorCanvasBody, VectorCanvasHeader, VectorCanvasMain, VectorCanvasRoot, VectorCanvasToolbar, VectorCanvasViewportSurface, VectorSelectionInspector, VectorToolbar, VectorViewport, createCanvuPlugin, createIndexedDbPersistenceAdapter, createLocalStoragePersistenceAdapter, createNoopPersistenceAdapter, createToolPlugin, cursorForVectorToolId, getBoardPositionStyle, hydrateSceneItemsWithAssets, ingestAssetFilesToSceneItems, useCanvuChromeContext, useCanvuDocumentContext, useCanvuPluginContext, useCanvuPluginContribution, useCanvuResolvedTools, useCanvuViewportContext, useVectorCanvasDocument };
|
|
12158
|
+
export { CanvuChromeContext, CanvuPluginContext, DEFAULT_OVERFLOW_TOOL_IDS, DEFAULT_VECTOR_CANVAS_STORAGE_KEY, DEFAULT_VECTOR_TOOLS, IconArchitecturalCloud, IconArrow, IconDraw, IconEllipse, IconHand, IconImage, IconLaser, IconLine, IconRect, IconSelect, IconText, ImagesMenu, NavMenu, SHAPE_CONTEXT_MENU_ITEM_IDS, ShapeContextMenu, VectorCanvas, VectorCanvasBody, VectorCanvasHeader, VectorCanvasMain, VectorCanvasRoot, VectorCanvasToolbar, VectorCanvasViewportSurface, VectorSelectionInspector, VectorToolbar, VectorViewport, createCanvuPlugin, createIndexedDbPersistenceAdapter, createLocalStoragePersistenceAdapter, createNoopPersistenceAdapter, createToolPlugin, cursorForVectorToolId, getBoardPositionStyle, hydrateSceneItemsWithAssets, ingestAssetFilesToSceneItems, useCanvuChromeContext, useCanvuDocumentContext, useCanvuPluginContext, useCanvuPluginContribution, useCanvuResolvedTools, useCanvuViewportContext, useVectorCanvasDocument };
|
|
12009
12159
|
//# sourceMappingURL=react.js.map
|
|
12010
12160
|
//# sourceMappingURL=react.js.map
|