canvu-react 0.4.65 → 0.4.67
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 +241 -79
- 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 +242 -81
- 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 ?? []);
|
|
@@ -9661,15 +9774,26 @@ var VectorViewport = forwardRef(
|
|
|
9661
9774
|
if (!cam) return;
|
|
9662
9775
|
const { worldX, worldY } = screenToWorld(e.clientX, e.clientY);
|
|
9663
9776
|
const lineHitWorld = 10 / cam.zoom;
|
|
9777
|
+
const cur = effectiveSelectedIdsRef.current;
|
|
9664
9778
|
const hit = hitTestWorldPoint(resolvedItemsRef.current, worldX, worldY, {
|
|
9665
9779
|
lineHitWorld,
|
|
9666
9780
|
ignoreLocked: true
|
|
9667
9781
|
});
|
|
9668
9782
|
if (!hit) {
|
|
9669
|
-
|
|
9783
|
+
const selectedUnlockedItems = cur.map((id) => resolvedItemsRef.current.find((item) => item.id === id)).filter((item) => item != null && !item.locked);
|
|
9784
|
+
if (selectedUnlockedItems.some(
|
|
9785
|
+
(item) => pointInSelectedItemBounds(item, worldX, worldY)
|
|
9786
|
+
)) {
|
|
9787
|
+
setContextMenuState({
|
|
9788
|
+
x: e.clientX,
|
|
9789
|
+
y: e.clientY,
|
|
9790
|
+
itemIds: [...cur]
|
|
9791
|
+
});
|
|
9792
|
+
return;
|
|
9793
|
+
}
|
|
9794
|
+
setContextMenuState(null);
|
|
9670
9795
|
return;
|
|
9671
9796
|
}
|
|
9672
|
-
const cur = effectiveSelectedIdsRef.current;
|
|
9673
9797
|
let nextIds;
|
|
9674
9798
|
if (!cur.includes(hit.id)) {
|
|
9675
9799
|
nextIds = e.shiftKey ? [...cur, hit.id] : [hit.id];
|
|
@@ -9677,7 +9801,7 @@ var VectorViewport = forwardRef(
|
|
|
9677
9801
|
} else {
|
|
9678
9802
|
nextIds = cur;
|
|
9679
9803
|
}
|
|
9680
|
-
|
|
9804
|
+
setContextMenuState({
|
|
9681
9805
|
x: e.clientX,
|
|
9682
9806
|
y: e.clientY,
|
|
9683
9807
|
itemIds: nextIds
|
|
@@ -10227,7 +10351,7 @@ var VectorViewport = forwardRef(
|
|
|
10227
10351
|
if (e.button !== 0) return;
|
|
10228
10352
|
if (editingTextIdRef.current) return;
|
|
10229
10353
|
wrapperRef.current?.focus({ preventScroll: true });
|
|
10230
|
-
|
|
10354
|
+
setContextMenuState(null);
|
|
10231
10355
|
const tool = toolIdRef.current;
|
|
10232
10356
|
if (tool === "hand") return;
|
|
10233
10357
|
if (applePencilNav && e.pointerType === "pen" && navigator.maxTouchPoints > 0 && (tool === "draw" || tool === "marker")) {
|
|
@@ -10647,7 +10771,7 @@ var VectorViewport = forwardRef(
|
|
|
10647
10771
|
return;
|
|
10648
10772
|
}
|
|
10649
10773
|
wrapperRef.current?.focus({ preventScroll: true });
|
|
10650
|
-
|
|
10774
|
+
setContextMenuState(null);
|
|
10651
10775
|
const straightLine = tool === "draw" ? createStraightStrokeState(startPoint, e.clientX, e.clientY) : void 0;
|
|
10652
10776
|
const itemId = createShapeId();
|
|
10653
10777
|
const item = createFreehandStrokeItem(
|
|
@@ -10770,7 +10894,7 @@ var VectorViewport = forwardRef(
|
|
|
10770
10894
|
return;
|
|
10771
10895
|
}
|
|
10772
10896
|
wrapperRef.current?.focus({ preventScroll: true });
|
|
10773
|
-
|
|
10897
|
+
setContextMenuState(null);
|
|
10774
10898
|
penDetectedRef.current = true;
|
|
10775
10899
|
const straightLine = tool === "draw" ? createStraightStrokeState(startPoint, touch.clientX, touch.clientY) : void 0;
|
|
10776
10900
|
const itemId = createShapeId();
|
|
@@ -11810,6 +11934,66 @@ var VectorViewport = forwardRef(
|
|
|
11810
11934
|
const defaultNavMenu = cameraForOverlay ? /* @__PURE__ */ jsx(NavMenu, {}) : null;
|
|
11811
11935
|
const resolvedSelectionInspector = selectionInspector === void 0 ? defaultSelectionInspector : selectionInspector;
|
|
11812
11936
|
const resolvedNavMenu = navMenu === void 0 ? defaultNavMenu : navMenu;
|
|
11937
|
+
const contextMenuItemIds = contextMenuState?.itemIds ?? [];
|
|
11938
|
+
const contextMenuSelectedItems = contextMenuState ? contextMenuItemIds.map((id) => items.find((item) => item.id === id)).filter((item) => item != null) : [];
|
|
11939
|
+
const allContextMenuSelectedLocked = contextMenuItemIds.length > 0 && contextMenuItemIds.every((id) => items.find((item) => item.id === id)?.locked);
|
|
11940
|
+
const closeContextMenu = () => setContextMenuState(null);
|
|
11941
|
+
const runContextMenuAction = (fn) => () => {
|
|
11942
|
+
fn();
|
|
11943
|
+
closeContextMenu();
|
|
11944
|
+
};
|
|
11945
|
+
const contextMenuRenderContext = contextMenuState ? {
|
|
11946
|
+
position: { x: contextMenuState.x, y: contextMenuState.y },
|
|
11947
|
+
selectedIds: contextMenuItemIds,
|
|
11948
|
+
selectedItems: contextMenuSelectedItems,
|
|
11949
|
+
allSelectedLocked: allContextMenuSelectedLocked,
|
|
11950
|
+
anySelectedLocked: contextMenuSelectedItems.some((item) => item.locked),
|
|
11951
|
+
close: closeContextMenu,
|
|
11952
|
+
cut: runContextMenuAction(() => cutIds(contextMenuItemIds)),
|
|
11953
|
+
copy: runContextMenuAction(
|
|
11954
|
+
() => copyIdsToInternalClipboard(contextMenuItemIds)
|
|
11955
|
+
),
|
|
11956
|
+
duplicate: runContextMenuAction(() => duplicateIds(contextMenuItemIds)),
|
|
11957
|
+
toggleLock: runContextMenuAction(
|
|
11958
|
+
() => setLockedOnIds(contextMenuItemIds, !allContextMenuSelectedLocked)
|
|
11959
|
+
),
|
|
11960
|
+
bringToFront: runContextMenuAction(
|
|
11961
|
+
() => reorderIds(contextMenuItemIds, "front")
|
|
11962
|
+
),
|
|
11963
|
+
bringForward: runContextMenuAction(
|
|
11964
|
+
() => reorderIds(contextMenuItemIds, "forward")
|
|
11965
|
+
),
|
|
11966
|
+
sendBackward: runContextMenuAction(
|
|
11967
|
+
() => reorderIds(contextMenuItemIds, "backward")
|
|
11968
|
+
),
|
|
11969
|
+
sendToBack: runContextMenuAction(
|
|
11970
|
+
() => reorderIds(contextMenuItemIds, "back")
|
|
11971
|
+
),
|
|
11972
|
+
delete: runContextMenuAction(() => deleteIds(contextMenuItemIds)),
|
|
11973
|
+
deleteSelection: runContextMenuAction(() => deleteIds(contextMenuItemIds)),
|
|
11974
|
+
items: resolvedContextMenuItems
|
|
11975
|
+
} : null;
|
|
11976
|
+
const resolvedContextMenu = interactive && onItemsChange && contextMenuState && contextMenuRenderContext && renderContextMenu !== null ? renderContextMenu ? renderContextMenu(contextMenuRenderContext) : /* @__PURE__ */ jsx(
|
|
11977
|
+
ShapeContextMenu,
|
|
11978
|
+
{
|
|
11979
|
+
x: contextMenuState.x,
|
|
11980
|
+
y: contextMenuState.y,
|
|
11981
|
+
selectedIds: contextMenuItemIds,
|
|
11982
|
+
selectedItems: contextMenuSelectedItems,
|
|
11983
|
+
allSelectedLocked: allContextMenuSelectedLocked,
|
|
11984
|
+
items: resolvedContextMenuItems,
|
|
11985
|
+
onClose: closeContextMenu,
|
|
11986
|
+
onToggleLock: () => setLockedOnIds(contextMenuItemIds, !allContextMenuSelectedLocked),
|
|
11987
|
+
onCut: () => cutIds(contextMenuItemIds),
|
|
11988
|
+
onCopy: () => copyIdsToInternalClipboard(contextMenuItemIds),
|
|
11989
|
+
onBringToFront: () => reorderIds(contextMenuItemIds, "front"),
|
|
11990
|
+
onBringForward: () => reorderIds(contextMenuItemIds, "forward"),
|
|
11991
|
+
onSendBackward: () => reorderIds(contextMenuItemIds, "backward"),
|
|
11992
|
+
onSendToBack: () => reorderIds(contextMenuItemIds, "back"),
|
|
11993
|
+
onDuplicate: () => duplicateIds(contextMenuItemIds),
|
|
11994
|
+
onDelete: () => deleteIds(contextMenuItemIds)
|
|
11995
|
+
}
|
|
11996
|
+
) : null;
|
|
11813
11997
|
return /* @__PURE__ */ jsx(CanvuPluginContext.Provider, { value: pluginContextValue, children: /* @__PURE__ */ jsx(CanvuChromeContext.Provider, { value: chromeContextValue, children: /* @__PURE__ */ jsxs(
|
|
11814
11998
|
"div",
|
|
11815
11999
|
{
|
|
@@ -11963,30 +12147,7 @@ var VectorViewport = forwardRef(
|
|
|
11963
12147
|
}
|
|
11964
12148
|
),
|
|
11965
12149
|
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
|
-
),
|
|
12150
|
+
resolvedContextMenu,
|
|
11990
12151
|
resolvedNavMenu,
|
|
11991
12152
|
/* @__PURE__ */ jsx(
|
|
11992
12153
|
"div",
|
|
@@ -12005,6 +12166,6 @@ var VectorViewport = forwardRef(
|
|
|
12005
12166
|
);
|
|
12006
12167
|
VectorViewport.displayName = "VectorViewport";
|
|
12007
12168
|
|
|
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 };
|
|
12169
|
+
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
12170
|
//# sourceMappingURL=react.js.map
|
|
12010
12171
|
//# sourceMappingURL=react.js.map
|