canvu-react 0.4.71 → 0.4.73
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/{asset-hydration-BeWWxiBq.d.cts → asset-hydration-6swZ6ciN.d.cts} +1 -1
- package/dist/{asset-hydration-CLoDkZDh.d.ts → asset-hydration-P0M5hn-p.d.ts} +1 -1
- package/dist/chatbot.d.cts +2 -2
- package/dist/chatbot.d.ts +2 -2
- package/dist/index.cjs +87 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +87 -6
- package/dist/index.js.map +1 -1
- package/dist/{raster-image-canvas-Byq087t9.d.cts → raster-image-canvas-ByaCKEVw.d.cts} +2 -0
- package/dist/{raster-image-canvas-BqBgE8C-.d.ts → raster-image-canvas-D3ZrySjr.d.ts} +2 -0
- package/dist/react.cjs +182 -33
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +35 -8
- package/dist/react.d.ts +35 -8
- package/dist/react.js +182 -33
- package/dist/react.js.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/{types-D_cQxUug.d.ts → types-C5wxwquF.d.ts} +1 -1
- package/dist/{types-f8d-2-6N.d.cts → types-DOUBapS4.d.cts} +1 -1
- package/package.json +1 -1
package/dist/react.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { V as VectorSceneItem } from './types-fJNwEnHf.cjs';
|
|
2
2
|
export { C as CustomShapeResizeHandles, b as ResizeHandleId } from './types-fJNwEnHf.cjs';
|
|
3
|
-
import { V as VectorViewportAssetKind, a as VectorViewportAssetStore } from './raster-image-canvas-
|
|
4
|
-
export { b as RasterImageCanvasRenderRequest, c as RasterImageCanvasRenderTarget, d as RasterImageCanvasRenderTargetResolver, R as RasterImageCanvasRenderingOptions, e as RasterImageCanvasSource, f as RasterImageCanvasSourceRequest, g as RasterImageCanvasSourceResolver, h as RasterImageCanvasSourceSizeRequest, i as RasterImageCanvasSourceSizeResolver, j as VectorViewportAssetHydrationRequest, k as VectorViewportAssetResolveRequest, l as VectorViewportAssetResolveResult, m as VectorViewportAssetUploadRequest, n as VectorViewportAssetUploadResult } from './raster-image-canvas-
|
|
5
|
-
import { I as IndexedDbImageStore } from './asset-hydration-
|
|
6
|
-
export { H as HydratedSceneItemsWithAssetsResult, h as hydrateSceneItemsWithAssets } from './asset-hydration-
|
|
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 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-
|
|
3
|
+
import { V as VectorViewportAssetKind, a as VectorViewportAssetStore } from './raster-image-canvas-ByaCKEVw.cjs';
|
|
4
|
+
export { b as RasterImageCanvasRenderRequest, c as RasterImageCanvasRenderTarget, d as RasterImageCanvasRenderTargetResolver, R as RasterImageCanvasRenderingOptions, e as RasterImageCanvasSource, f as RasterImageCanvasSourceRequest, g as RasterImageCanvasSourceResolver, h as RasterImageCanvasSourceSizeRequest, i as RasterImageCanvasSourceSizeResolver, j as VectorViewportAssetHydrationRequest, k as VectorViewportAssetResolveRequest, l as VectorViewportAssetResolveResult, m as VectorViewportAssetUploadRequest, n as VectorViewportAssetUploadResult } from './raster-image-canvas-ByaCKEVw.cjs';
|
|
5
|
+
import { I as IndexedDbImageStore } from './asset-hydration-6swZ6ciN.cjs';
|
|
6
|
+
export { H as HydratedSceneItemsWithAssetsResult, h as hydrateSceneItemsWithAssets } from './asset-hydration-6swZ6ciN.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-DOUBapS4.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-DOUBapS4.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';
|
|
@@ -115,6 +115,13 @@ type IngestAssetFilesToSceneItemsOptions = {
|
|
|
115
115
|
*/
|
|
116
116
|
pdfScale?: number;
|
|
117
117
|
pdfPageConcurrency?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Cancels in-flight PDF rendering, asset uploads, and item emission.
|
|
120
|
+
*
|
|
121
|
+
* Pass this when ingestion is tied to a component lifecycle or route so stale
|
|
122
|
+
* imports stop work instead of continuing in the background.
|
|
123
|
+
*/
|
|
124
|
+
signal?: AbortSignal;
|
|
118
125
|
/**
|
|
119
126
|
* Called as soon as canvu finishes converting one or more items from the
|
|
120
127
|
* source files.
|
|
@@ -198,6 +205,10 @@ type ImagesMenuCollapsedButtonRenderProps = {
|
|
|
198
205
|
*/
|
|
199
206
|
buttonProps: ImagesMenuCollapsedButtonProps;
|
|
200
207
|
};
|
|
208
|
+
/**
|
|
209
|
+
* Built-in action ids available in each row of {@link ImagesMenu}.
|
|
210
|
+
*/
|
|
211
|
+
type ImagesMenuActionId = "duplicate" | "rotate" | "delete";
|
|
201
212
|
type ImagesMenuProps = {
|
|
202
213
|
items: readonly VectorSceneItem[];
|
|
203
214
|
onItemsChange: (items: VectorSceneItem[]) => void;
|
|
@@ -207,6 +218,22 @@ type ImagesMenuProps = {
|
|
|
207
218
|
*/
|
|
208
219
|
onFocusItem?: (item: VectorSceneItem) => void;
|
|
209
220
|
labels?: ImagesMenuLabels;
|
|
221
|
+
/**
|
|
222
|
+
* Built-in row actions to omit from the managed images menu UI.
|
|
223
|
+
*
|
|
224
|
+
* Use this when an app needs to keep the managed image behavior available in
|
|
225
|
+
* code while preventing specific actions from being shown to users.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```tsx
|
|
229
|
+
* <ImagesMenu
|
|
230
|
+
* items={items}
|
|
231
|
+
* onItemsChange={setItems}
|
|
232
|
+
* hiddenActions={["duplicate"]}
|
|
233
|
+
* />
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
hiddenActions?: readonly ImagesMenuActionId[];
|
|
210
237
|
/**
|
|
211
238
|
* Whether the menu starts expanded. Defaults to `false` (collapsed), showing
|
|
212
239
|
* only the floating toggle button until the user opens it.
|
|
@@ -262,7 +289,7 @@ type ImagesMenuProps = {
|
|
|
262
289
|
* drag-to-reorder actions. Managed images are also `locked`, so they do not
|
|
263
290
|
* respond to direct canvas interaction.
|
|
264
291
|
*/
|
|
265
|
-
declare function ImagesMenu({ items, onItemsChange, onFocusItem, labels, defaultOpen, collapsedButtonClassName, collapsedButtonStyle, renderCollapsedButton, }: ImagesMenuProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
292
|
+
declare function ImagesMenu({ items, onItemsChange, onFocusItem, labels, hiddenActions, defaultOpen, collapsedButtonClassName, collapsedButtonStyle, renderCollapsedButton, }: ImagesMenuProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
266
293
|
|
|
267
294
|
type NavMenuMinimapProps = {
|
|
268
295
|
className?: string;
|
|
@@ -818,4 +845,4 @@ type VectorToolbarWithStatics = ((props: VectorToolbarProps) => ReactElement) &
|
|
|
818
845
|
*/
|
|
819
846
|
declare const VectorToolbar: VectorToolbarWithStatics;
|
|
820
847
|
|
|
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 };
|
|
848
|
+
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 ImagesMenuActionId, 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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { V as VectorSceneItem } from './types-fJNwEnHf.js';
|
|
2
2
|
export { C as CustomShapeResizeHandles, b as ResizeHandleId } from './types-fJNwEnHf.js';
|
|
3
|
-
import { V as VectorViewportAssetKind, a as VectorViewportAssetStore } from './raster-image-canvas-
|
|
4
|
-
export { b as RasterImageCanvasRenderRequest, c as RasterImageCanvasRenderTarget, d as RasterImageCanvasRenderTargetResolver, R as RasterImageCanvasRenderingOptions, e as RasterImageCanvasSource, f as RasterImageCanvasSourceRequest, g as RasterImageCanvasSourceResolver, h as RasterImageCanvasSourceSizeRequest, i as RasterImageCanvasSourceSizeResolver, j as VectorViewportAssetHydrationRequest, k as VectorViewportAssetResolveRequest, l as VectorViewportAssetResolveResult, m as VectorViewportAssetUploadRequest, n as VectorViewportAssetUploadResult } from './raster-image-canvas-
|
|
5
|
-
import { I as IndexedDbImageStore } from './asset-hydration-
|
|
6
|
-
export { H as HydratedSceneItemsWithAssetsResult, h as hydrateSceneItemsWithAssets } from './asset-hydration-
|
|
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 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-
|
|
3
|
+
import { V as VectorViewportAssetKind, a as VectorViewportAssetStore } from './raster-image-canvas-D3ZrySjr.js';
|
|
4
|
+
export { b as RasterImageCanvasRenderRequest, c as RasterImageCanvasRenderTarget, d as RasterImageCanvasRenderTargetResolver, R as RasterImageCanvasRenderingOptions, e as RasterImageCanvasSource, f as RasterImageCanvasSourceRequest, g as RasterImageCanvasSourceResolver, h as RasterImageCanvasSourceSizeRequest, i as RasterImageCanvasSourceSizeResolver, j as VectorViewportAssetHydrationRequest, k as VectorViewportAssetResolveRequest, l as VectorViewportAssetResolveResult, m as VectorViewportAssetUploadRequest, n as VectorViewportAssetUploadResult } from './raster-image-canvas-D3ZrySjr.js';
|
|
5
|
+
import { I as IndexedDbImageStore } from './asset-hydration-P0M5hn-p.js';
|
|
6
|
+
export { H as HydratedSceneItemsWithAssetsResult, h as hydrateSceneItemsWithAssets } from './asset-hydration-P0M5hn-p.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-C5wxwquF.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-C5wxwquF.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';
|
|
@@ -115,6 +115,13 @@ type IngestAssetFilesToSceneItemsOptions = {
|
|
|
115
115
|
*/
|
|
116
116
|
pdfScale?: number;
|
|
117
117
|
pdfPageConcurrency?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Cancels in-flight PDF rendering, asset uploads, and item emission.
|
|
120
|
+
*
|
|
121
|
+
* Pass this when ingestion is tied to a component lifecycle or route so stale
|
|
122
|
+
* imports stop work instead of continuing in the background.
|
|
123
|
+
*/
|
|
124
|
+
signal?: AbortSignal;
|
|
118
125
|
/**
|
|
119
126
|
* Called as soon as canvu finishes converting one or more items from the
|
|
120
127
|
* source files.
|
|
@@ -198,6 +205,10 @@ type ImagesMenuCollapsedButtonRenderProps = {
|
|
|
198
205
|
*/
|
|
199
206
|
buttonProps: ImagesMenuCollapsedButtonProps;
|
|
200
207
|
};
|
|
208
|
+
/**
|
|
209
|
+
* Built-in action ids available in each row of {@link ImagesMenu}.
|
|
210
|
+
*/
|
|
211
|
+
type ImagesMenuActionId = "duplicate" | "rotate" | "delete";
|
|
201
212
|
type ImagesMenuProps = {
|
|
202
213
|
items: readonly VectorSceneItem[];
|
|
203
214
|
onItemsChange: (items: VectorSceneItem[]) => void;
|
|
@@ -207,6 +218,22 @@ type ImagesMenuProps = {
|
|
|
207
218
|
*/
|
|
208
219
|
onFocusItem?: (item: VectorSceneItem) => void;
|
|
209
220
|
labels?: ImagesMenuLabels;
|
|
221
|
+
/**
|
|
222
|
+
* Built-in row actions to omit from the managed images menu UI.
|
|
223
|
+
*
|
|
224
|
+
* Use this when an app needs to keep the managed image behavior available in
|
|
225
|
+
* code while preventing specific actions from being shown to users.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```tsx
|
|
229
|
+
* <ImagesMenu
|
|
230
|
+
* items={items}
|
|
231
|
+
* onItemsChange={setItems}
|
|
232
|
+
* hiddenActions={["duplicate"]}
|
|
233
|
+
* />
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
hiddenActions?: readonly ImagesMenuActionId[];
|
|
210
237
|
/**
|
|
211
238
|
* Whether the menu starts expanded. Defaults to `false` (collapsed), showing
|
|
212
239
|
* only the floating toggle button until the user opens it.
|
|
@@ -262,7 +289,7 @@ type ImagesMenuProps = {
|
|
|
262
289
|
* drag-to-reorder actions. Managed images are also `locked`, so they do not
|
|
263
290
|
* respond to direct canvas interaction.
|
|
264
291
|
*/
|
|
265
|
-
declare function ImagesMenu({ items, onItemsChange, onFocusItem, labels, defaultOpen, collapsedButtonClassName, collapsedButtonStyle, renderCollapsedButton, }: ImagesMenuProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
292
|
+
declare function ImagesMenu({ items, onItemsChange, onFocusItem, labels, hiddenActions, defaultOpen, collapsedButtonClassName, collapsedButtonStyle, renderCollapsedButton, }: ImagesMenuProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
266
293
|
|
|
267
294
|
type NavMenuMinimapProps = {
|
|
268
295
|
className?: string;
|
|
@@ -818,4 +845,4 @@ type VectorToolbarWithStatics = ((props: VectorToolbarProps) => ReactElement) &
|
|
|
818
845
|
*/
|
|
819
846
|
declare const VectorToolbar: VectorToolbarWithStatics;
|
|
820
847
|
|
|
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 };
|
|
848
|
+
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 ImagesMenuActionId, 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
|
@@ -1201,7 +1201,8 @@ function getPdfJs() {
|
|
|
1201
1201
|
}
|
|
1202
1202
|
return pdfjsPromise;
|
|
1203
1203
|
}
|
|
1204
|
-
async function renderPageToCanvas(page, scale) {
|
|
1204
|
+
async function renderPageToCanvas(page, scale, signal) {
|
|
1205
|
+
throwIfAborted(signal);
|
|
1205
1206
|
const raw = page.getViewport({ scale: 1 });
|
|
1206
1207
|
const adjustedScale = Math.round(raw.width * scale) / raw.width;
|
|
1207
1208
|
const viewport = page.getViewport({ scale: adjustedScale });
|
|
@@ -1214,22 +1215,48 @@ async function renderPageToCanvas(page, scale) {
|
|
|
1214
1215
|
if (!ctx) throw new Error("Canvas 2D context unavailable");
|
|
1215
1216
|
ctx.imageSmoothingEnabled = true;
|
|
1216
1217
|
ctx.imageSmoothingQuality = "high";
|
|
1217
|
-
|
|
1218
|
+
const renderTask = page.render({ canvas, viewport });
|
|
1219
|
+
if (signal) {
|
|
1220
|
+
const abortRender = () => {
|
|
1221
|
+
renderTask.cancel();
|
|
1222
|
+
};
|
|
1223
|
+
signal.addEventListener("abort", abortRender, { once: true });
|
|
1224
|
+
try {
|
|
1225
|
+
await renderTask.promise;
|
|
1226
|
+
} catch (error) {
|
|
1227
|
+
if (signal.aborted) throw createAbortError();
|
|
1228
|
+
throw error;
|
|
1229
|
+
} finally {
|
|
1230
|
+
signal.removeEventListener("abort", abortRender);
|
|
1231
|
+
}
|
|
1232
|
+
} else {
|
|
1233
|
+
await renderTask.promise;
|
|
1234
|
+
}
|
|
1235
|
+
throwIfAborted(signal);
|
|
1218
1236
|
return { canvas, width: w, height: h };
|
|
1219
1237
|
}
|
|
1238
|
+
function createAbortError() {
|
|
1239
|
+
return new DOMException("Aborted", "AbortError");
|
|
1240
|
+
}
|
|
1241
|
+
function throwIfAborted(signal) {
|
|
1242
|
+
if (signal?.aborted) {
|
|
1243
|
+
throw createAbortError();
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1220
1246
|
function normalizePdfPageNumbers(pageNumbers, pageCount) {
|
|
1221
1247
|
if (!pageNumbers || pageNumbers.length === 0) {
|
|
1222
1248
|
return Array.from({ length: pageCount }, (_, index) => index + 1);
|
|
1223
1249
|
}
|
|
1224
1250
|
return [...new Set(pageNumbers)].filter((pageNumber) => pageNumber >= 1 && pageNumber <= pageCount).sort((left, right) => left - right);
|
|
1225
1251
|
}
|
|
1226
|
-
async function runWithConcurrency(items, concurrency, execute) {
|
|
1252
|
+
async function runWithConcurrency(items, concurrency, execute, signal) {
|
|
1227
1253
|
const results = new Array(items.length);
|
|
1228
1254
|
let nextIndex = 0;
|
|
1229
1255
|
const workerCount = Math.max(1, Math.min(concurrency, items.length));
|
|
1230
1256
|
await Promise.all(
|
|
1231
1257
|
Array.from({ length: workerCount }, async () => {
|
|
1232
1258
|
while (nextIndex < items.length) {
|
|
1259
|
+
throwIfAborted(signal);
|
|
1233
1260
|
const currentIndex = nextIndex;
|
|
1234
1261
|
nextIndex += 1;
|
|
1235
1262
|
const item = items[currentIndex];
|
|
@@ -1237,6 +1264,7 @@ async function runWithConcurrency(items, concurrency, execute) {
|
|
|
1237
1264
|
continue;
|
|
1238
1265
|
}
|
|
1239
1266
|
results[currentIndex] = await execute(item);
|
|
1267
|
+
throwIfAborted(signal);
|
|
1240
1268
|
}
|
|
1241
1269
|
})
|
|
1242
1270
|
);
|
|
@@ -1246,9 +1274,49 @@ async function loadPdfToStore(file, store, options) {
|
|
|
1246
1274
|
const scale = options?.scale ?? 1.5;
|
|
1247
1275
|
const pageConcurrency = options?.pageConcurrency ?? 2;
|
|
1248
1276
|
const storeThumbnails = options?.storeThumbnails ?? false;
|
|
1277
|
+
const signal = options?.signal;
|
|
1278
|
+
throwIfAborted(signal);
|
|
1249
1279
|
const pdfjs = await getPdfJs();
|
|
1280
|
+
throwIfAborted(signal);
|
|
1250
1281
|
const arrayBuffer = await file.arrayBuffer();
|
|
1251
|
-
|
|
1282
|
+
throwIfAborted(signal);
|
|
1283
|
+
const loadingTask = pdfjs.getDocument({ data: arrayBuffer });
|
|
1284
|
+
if (signal) {
|
|
1285
|
+
const abortLoading = () => {
|
|
1286
|
+
void loadingTask.destroy();
|
|
1287
|
+
};
|
|
1288
|
+
signal.addEventListener("abort", abortLoading, { once: true });
|
|
1289
|
+
try {
|
|
1290
|
+
const pdf2 = await loadingTask.promise;
|
|
1291
|
+
signal.removeEventListener("abort", abortLoading);
|
|
1292
|
+
return await loadPdfDocumentToStore(pdf2, store, {
|
|
1293
|
+
scale,
|
|
1294
|
+
pageNumbers: options?.pageNumbers,
|
|
1295
|
+
pageConcurrency,
|
|
1296
|
+
storeThumbnails,
|
|
1297
|
+
signal,
|
|
1298
|
+
onPageStored: options?.onPageStored
|
|
1299
|
+
});
|
|
1300
|
+
} catch (error) {
|
|
1301
|
+
if (signal.aborted) throw createAbortError();
|
|
1302
|
+
throw error;
|
|
1303
|
+
} finally {
|
|
1304
|
+
signal.removeEventListener("abort", abortLoading);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
const pdf = await loadingTask.promise;
|
|
1308
|
+
return await loadPdfDocumentToStore(pdf, store, {
|
|
1309
|
+
scale,
|
|
1310
|
+
pageNumbers: options?.pageNumbers,
|
|
1311
|
+
pageConcurrency,
|
|
1312
|
+
storeThumbnails,
|
|
1313
|
+
onPageStored: options?.onPageStored
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
async function loadPdfDocumentToStore(pdf, store, options) {
|
|
1317
|
+
const { pageConcurrency, scale, signal } = options;
|
|
1318
|
+
const storeThumbnails = options.storeThumbnails ?? false;
|
|
1319
|
+
throwIfAborted(signal);
|
|
1252
1320
|
const pageNumbers = normalizePdfPageNumbers(options?.pageNumbers, pdf.numPages);
|
|
1253
1321
|
const bufferedResults = /* @__PURE__ */ new Map();
|
|
1254
1322
|
let nextEmitIndex = 0;
|
|
@@ -1263,7 +1331,9 @@ async function loadPdfToStore(file, store, options) {
|
|
|
1263
1331
|
if (!bufferedResult) break;
|
|
1264
1332
|
bufferedResults.delete(nextPageNumber);
|
|
1265
1333
|
nextEmitIndex += 1;
|
|
1334
|
+
throwIfAborted(signal);
|
|
1266
1335
|
await options?.onPageStored?.(bufferedResult);
|
|
1336
|
+
throwIfAborted(signal);
|
|
1267
1337
|
}
|
|
1268
1338
|
};
|
|
1269
1339
|
const nextChain = emitChain.then(run, run);
|
|
@@ -1275,11 +1345,20 @@ async function loadPdfToStore(file, store, options) {
|
|
|
1275
1345
|
pageNumbers,
|
|
1276
1346
|
pageConcurrency,
|
|
1277
1347
|
async (pageNumber) => {
|
|
1348
|
+
throwIfAborted(signal);
|
|
1278
1349
|
const page = await pdf.getPage(pageNumber);
|
|
1279
|
-
|
|
1350
|
+
throwIfAborted(signal);
|
|
1351
|
+
const { canvas, width, height } = await renderPageToCanvas(
|
|
1352
|
+
page,
|
|
1353
|
+
scale,
|
|
1354
|
+
signal
|
|
1355
|
+
);
|
|
1356
|
+
throwIfAborted(signal);
|
|
1280
1357
|
const mime = "image/png";
|
|
1281
1358
|
const pageBlob = await encodeCanvasToBlob(canvas, { mimeType: mime });
|
|
1359
|
+
throwIfAborted(signal);
|
|
1282
1360
|
const blobId = await store.storeOriginal(pageBlob);
|
|
1361
|
+
throwIfAborted(signal);
|
|
1283
1362
|
const thumbnailBlobId = storeThumbnails ? await (async () => {
|
|
1284
1363
|
const thumbScale = Math.min(1, 256 / Math.max(width, height));
|
|
1285
1364
|
const tw = Math.max(1, Math.round(width * thumbScale));
|
|
@@ -1296,6 +1375,7 @@ async function loadPdfToStore(file, store, options) {
|
|
|
1296
1375
|
const thumbBlob = await encodeCanvasToBlob(thumbCanvas, {
|
|
1297
1376
|
mimeType: mime
|
|
1298
1377
|
});
|
|
1378
|
+
throwIfAborted(signal);
|
|
1299
1379
|
return await store.storeThumbnail(thumbBlob);
|
|
1300
1380
|
})() : "";
|
|
1301
1381
|
const pageResult = {
|
|
@@ -1307,7 +1387,8 @@ async function loadPdfToStore(file, store, options) {
|
|
|
1307
1387
|
};
|
|
1308
1388
|
await queuePageEmission(pageResult);
|
|
1309
1389
|
return pageResult;
|
|
1310
|
-
}
|
|
1390
|
+
},
|
|
1391
|
+
signal
|
|
1311
1392
|
);
|
|
1312
1393
|
}
|
|
1313
1394
|
|
|
@@ -1648,9 +1729,22 @@ function finalizeIngestedItem(item, context, uploadResult, decorateItem) {
|
|
|
1648
1729
|
const itemWithAssetData = applyAssetUploadResultToItem(item, uploadResult);
|
|
1649
1730
|
return decorateItem ? decorateItem(itemWithAssetData, context) : itemWithAssetData;
|
|
1650
1731
|
}
|
|
1651
|
-
|
|
1732
|
+
function createAbortError2() {
|
|
1733
|
+
return new DOMException("Aborted", "AbortError");
|
|
1734
|
+
}
|
|
1735
|
+
function throwIfAborted2(signal) {
|
|
1736
|
+
if (signal?.aborted) {
|
|
1737
|
+
throw createAbortError2();
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
function isAbortError(error) {
|
|
1741
|
+
return (error instanceof DOMException || error instanceof Error) && error.name === "AbortError";
|
|
1742
|
+
}
|
|
1743
|
+
async function uploadAssetIfNeeded(assetStore, file, kind, signal) {
|
|
1744
|
+
throwIfAborted2(signal);
|
|
1652
1745
|
if (!assetStore) return null;
|
|
1653
|
-
const result = await assetStore.upload({ file, kind });
|
|
1746
|
+
const result = await assetStore.upload({ file, kind, signal });
|
|
1747
|
+
throwIfAborted2(signal);
|
|
1654
1748
|
return result ?? null;
|
|
1655
1749
|
}
|
|
1656
1750
|
async function ingestAssetFilesToSceneItems(options) {
|
|
@@ -1664,6 +1758,7 @@ async function ingestAssetFilesToSceneItems(options) {
|
|
|
1664
1758
|
gapWorld = 16,
|
|
1665
1759
|
pdfScale = 1.15,
|
|
1666
1760
|
pdfPageConcurrency = 2,
|
|
1761
|
+
signal,
|
|
1667
1762
|
decorateItem,
|
|
1668
1763
|
onItemsReady,
|
|
1669
1764
|
onError
|
|
@@ -1672,6 +1767,7 @@ async function ingestAssetFilesToSceneItems(options) {
|
|
|
1672
1767
|
const errors = [];
|
|
1673
1768
|
let occupiedBottomY = existingItems.length > 0 ? Math.max(...existingItems.map((item) => item.bounds.y + item.bounds.height)) : null;
|
|
1674
1769
|
for (const file of files) {
|
|
1770
|
+
throwIfAborted2(signal);
|
|
1675
1771
|
const kind = getAssetKindForFile(file);
|
|
1676
1772
|
if (!kind) {
|
|
1677
1773
|
const error = {
|
|
@@ -1684,14 +1780,23 @@ async function ingestAssetFilesToSceneItems(options) {
|
|
|
1684
1780
|
}
|
|
1685
1781
|
try {
|
|
1686
1782
|
if (kind === "pdf") {
|
|
1687
|
-
const uploadResultPromise = uploadAssetIfNeeded(
|
|
1783
|
+
const uploadResultPromise = uploadAssetIfNeeded(
|
|
1784
|
+
assetStore,
|
|
1785
|
+
file,
|
|
1786
|
+
kind,
|
|
1787
|
+
signal
|
|
1788
|
+
);
|
|
1789
|
+
void uploadResultPromise.catch(() => void 0);
|
|
1688
1790
|
await loadPdfToStore(file, imageStore, {
|
|
1689
1791
|
scale: pdfScale,
|
|
1690
1792
|
pageConcurrency: pdfPageConcurrency,
|
|
1691
1793
|
storeThumbnails: false,
|
|
1794
|
+
signal,
|
|
1692
1795
|
onPageStored: async (page) => {
|
|
1796
|
+
throwIfAborted2(signal);
|
|
1693
1797
|
const uploadResult2 = await uploadResultPromise;
|
|
1694
1798
|
const fullUrl2 = await createBlobUrlFromStore(imageStore, page.blobId);
|
|
1799
|
+
throwIfAborted2(signal);
|
|
1695
1800
|
const naturalTopY2 = worldCenter.y - page.height / 2;
|
|
1696
1801
|
const stackedTopY2 = occupiedBottomY == null ? naturalTopY2 : occupiedBottomY + gapWorld;
|
|
1697
1802
|
const bounds2 = {
|
|
@@ -1731,15 +1836,18 @@ async function ingestAssetFilesToSceneItems(options) {
|
|
|
1731
1836
|
);
|
|
1732
1837
|
items.push(item2);
|
|
1733
1838
|
occupiedBottomY = bounds2.y + page.height;
|
|
1839
|
+
throwIfAborted2(signal);
|
|
1734
1840
|
onItemsReady?.([item2], { file, kind });
|
|
1735
1841
|
}
|
|
1736
1842
|
});
|
|
1737
1843
|
continue;
|
|
1738
1844
|
}
|
|
1845
|
+
throwIfAborted2(signal);
|
|
1739
1846
|
const [uploadResult, storedImage] = await Promise.all([
|
|
1740
|
-
uploadAssetIfNeeded(assetStore, file, kind),
|
|
1847
|
+
uploadAssetIfNeeded(assetStore, file, kind, signal),
|
|
1741
1848
|
loadImageToStore(file, imageStore)
|
|
1742
1849
|
]);
|
|
1850
|
+
throwIfAborted2(signal);
|
|
1743
1851
|
const { blobId, thumbnailBlobId, width, height } = storedImage;
|
|
1744
1852
|
const fullUrl = await createBlobUrlFromStore(imageStore, blobId);
|
|
1745
1853
|
const thumbBlob = await imageStore.getThumbnail(thumbnailBlobId);
|
|
@@ -1777,9 +1885,13 @@ async function ingestAssetFilesToSceneItems(options) {
|
|
|
1777
1885
|
decorateItem
|
|
1778
1886
|
);
|
|
1779
1887
|
items.push(item);
|
|
1888
|
+
throwIfAborted2(signal);
|
|
1780
1889
|
onItemsReady?.([item], { file, kind });
|
|
1781
1890
|
occupiedBottomY = occupiedBottomY == null ? bounds.y + height : Math.max(occupiedBottomY, bounds.y + height);
|
|
1782
1891
|
} catch (error) {
|
|
1892
|
+
if (isAbortError(error)) {
|
|
1893
|
+
throw error;
|
|
1894
|
+
}
|
|
1783
1895
|
const fileError = {
|
|
1784
1896
|
file,
|
|
1785
1897
|
kind,
|
|
@@ -2141,6 +2253,7 @@ function ImagesMenu({
|
|
|
2141
2253
|
onItemsChange,
|
|
2142
2254
|
onFocusItem,
|
|
2143
2255
|
labels,
|
|
2256
|
+
hiddenActions,
|
|
2144
2257
|
defaultOpen = false,
|
|
2145
2258
|
collapsedButtonClassName,
|
|
2146
2259
|
collapsedButtonStyle,
|
|
@@ -2156,6 +2269,10 @@ function ImagesMenu({
|
|
|
2156
2269
|
useEffect(() => {
|
|
2157
2270
|
ensureOpenKeyframe();
|
|
2158
2271
|
}, []);
|
|
2272
|
+
const hiddenActionSet = useMemo(
|
|
2273
|
+
() => new Set(hiddenActions ?? []),
|
|
2274
|
+
[hiddenActions]
|
|
2275
|
+
);
|
|
2159
2276
|
if (managed.length === 0) {
|
|
2160
2277
|
return null;
|
|
2161
2278
|
}
|
|
@@ -2230,6 +2347,7 @@ function ImagesMenu({
|
|
|
2230
2347
|
{
|
|
2231
2348
|
item,
|
|
2232
2349
|
labels: resolvedLabels,
|
|
2350
|
+
hiddenActionSet,
|
|
2233
2351
|
onFocus: onFocusItem ? () => onFocusItem(item) : void 0,
|
|
2234
2352
|
onCopy: () => onItemsChange(copyManagedImage(items, item.id)),
|
|
2235
2353
|
onRotate: () => onItemsChange(rotateManagedImage(items, item.id)),
|
|
@@ -2246,6 +2364,7 @@ function ImagesMenu({
|
|
|
2246
2364
|
function ImagesMenuRow({
|
|
2247
2365
|
item,
|
|
2248
2366
|
labels,
|
|
2367
|
+
hiddenActionSet,
|
|
2249
2368
|
onFocus,
|
|
2250
2369
|
onCopy,
|
|
2251
2370
|
onRotate,
|
|
@@ -2285,9 +2404,9 @@ function ImagesMenuRow({
|
|
|
2285
2404
|
),
|
|
2286
2405
|
/* @__PURE__ */ jsx(FocusTarget, { label: labels.focus, onFocus, children: /* @__PURE__ */ jsx("div", { style: thumbBoxStyle, children: src ? /* @__PURE__ */ jsx("img", { src, alt: "", style: thumbImgStyle, draggable: false }) : null }) }),
|
|
2287
2406
|
/* @__PURE__ */ jsxs("div", { style: actionsColumnStyle, children: [
|
|
2288
|
-
/* @__PURE__ */ jsx(ImagesMenuAction, { label: labels.duplicate, onClick: onCopy, children: /* @__PURE__ */ jsx(CopyPlus, { size: 18 }) }),
|
|
2289
|
-
/* @__PURE__ */ jsx(ImagesMenuAction, { label: labels.rotate, onClick: onRotate, children: /* @__PURE__ */ jsx(RotateCw, { size: 18 }) }),
|
|
2290
|
-
/* @__PURE__ */ jsx(ImagesMenuAction, { label: labels.delete, onClick: onDelete, danger: true, children: /* @__PURE__ */ jsx(Trash2, { size: 18 }) })
|
|
2407
|
+
!hiddenActionSet.has("duplicate") ? /* @__PURE__ */ jsx(ImagesMenuAction, { label: labels.duplicate, onClick: onCopy, children: /* @__PURE__ */ jsx(CopyPlus, { size: 18 }) }) : null,
|
|
2408
|
+
!hiddenActionSet.has("rotate") ? /* @__PURE__ */ jsx(ImagesMenuAction, { label: labels.rotate, onClick: onRotate, children: /* @__PURE__ */ jsx(RotateCw, { size: 18 }) }) : null,
|
|
2409
|
+
!hiddenActionSet.has("delete") ? /* @__PURE__ */ jsx(ImagesMenuAction, { label: labels.delete, onClick: onDelete, danger: true, children: /* @__PURE__ */ jsx(Trash2, { size: 18 }) }) : null
|
|
2291
2410
|
] })
|
|
2292
2411
|
] });
|
|
2293
2412
|
}
|
|
@@ -8433,6 +8552,48 @@ function shallowEqualStringArray(a, b) {
|
|
|
8433
8552
|
return true;
|
|
8434
8553
|
}
|
|
8435
8554
|
|
|
8555
|
+
// src/react/stroke-input.ts
|
|
8556
|
+
var MAX_INTERPOLATED_POINTS_PER_SAMPLE = 192;
|
|
8557
|
+
function getPointerEventSamples(event) {
|
|
8558
|
+
if (typeof event.getCoalescedEvents !== "function") {
|
|
8559
|
+
return [event];
|
|
8560
|
+
}
|
|
8561
|
+
const samples = event.getCoalescedEvents();
|
|
8562
|
+
return samples.length > 0 ? samples : [event];
|
|
8563
|
+
}
|
|
8564
|
+
var resolveInterpolatedPressure = (lastPoint, nextPoint, ratio) => {
|
|
8565
|
+
if (lastPoint.pressure != null && nextPoint.pressure != null) {
|
|
8566
|
+
return lastPoint.pressure + (nextPoint.pressure - lastPoint.pressure) * ratio;
|
|
8567
|
+
}
|
|
8568
|
+
return ratio === 1 ? nextPoint.pressure : void 0;
|
|
8569
|
+
};
|
|
8570
|
+
var resolveMaxStepWorld = (maxStepWorld) => Number.isFinite(maxStepWorld) && maxStepWorld > 0 ? maxStepWorld : Number.POSITIVE_INFINITY;
|
|
8571
|
+
function appendInterpolatedStrokePoint(points, nextPoint, maxStepWorld) {
|
|
8572
|
+
if (points.length === 0) return [nextPoint];
|
|
8573
|
+
const lastPoint = points[points.length - 1];
|
|
8574
|
+
if (!lastPoint) return [...points, nextPoint];
|
|
8575
|
+
const deltaX = nextPoint.x - lastPoint.x;
|
|
8576
|
+
const deltaY = nextPoint.y - lastPoint.y;
|
|
8577
|
+
const distanceSquared = deltaX * deltaX + deltaY * deltaY;
|
|
8578
|
+
if (distanceSquared < 1e-12) return points;
|
|
8579
|
+
const distance = Math.sqrt(distanceSquared);
|
|
8580
|
+
const stepCount = Math.min(
|
|
8581
|
+
MAX_INTERPOLATED_POINTS_PER_SAMPLE,
|
|
8582
|
+
Math.max(1, Math.ceil(distance / resolveMaxStepWorld(maxStepWorld)))
|
|
8583
|
+
);
|
|
8584
|
+
if (stepCount === 1) return [...points, nextPoint];
|
|
8585
|
+
const interpolatedPoints = Array.from({ length: stepCount }, (_, index) => {
|
|
8586
|
+
const ratio = (index + 1) / stepCount;
|
|
8587
|
+
const pressure = resolveInterpolatedPressure(lastPoint, nextPoint, ratio);
|
|
8588
|
+
return {
|
|
8589
|
+
x: lastPoint.x + deltaX * ratio,
|
|
8590
|
+
y: lastPoint.y + deltaY * ratio,
|
|
8591
|
+
...pressure != null ? { pressure } : {}
|
|
8592
|
+
};
|
|
8593
|
+
});
|
|
8594
|
+
return [...points, ...interpolatedPoints];
|
|
8595
|
+
}
|
|
8596
|
+
|
|
8436
8597
|
// src/react/TextEditOverlay.tsx
|
|
8437
8598
|
init_rect();
|
|
8438
8599
|
init_text_svg();
|
|
@@ -8692,13 +8853,6 @@ function pointInSelectedItemBounds(item, worldX, worldY) {
|
|
|
8692
8853
|
);
|
|
8693
8854
|
return local.x >= 0 && local.x <= bounds.width && local.y >= 0 && local.y <= bounds.height;
|
|
8694
8855
|
}
|
|
8695
|
-
function pointerEventSamples(ev) {
|
|
8696
|
-
if (ev.pointerType !== "pen" || typeof ev.getCoalescedEvents !== "function") {
|
|
8697
|
-
return [ev];
|
|
8698
|
-
}
|
|
8699
|
-
const samples = ev.getCoalescedEvents();
|
|
8700
|
-
return samples.length > 0 ? samples : [ev];
|
|
8701
|
-
}
|
|
8702
8856
|
var CANVU_PEN_ACTIVE_UI_BLOCK_CSS = `
|
|
8703
8857
|
[data-canvu-pen-active="true"] [data-slot="vector-canvas-toolbar"],
|
|
8704
8858
|
[data-canvu-pen-active="true"] [data-slot="vector-canvas-toolbar"] *,
|
|
@@ -8800,15 +8954,6 @@ function VectorViewportPluginInstances({
|
|
|
8800
8954
|
] }, plugin.id);
|
|
8801
8955
|
}) });
|
|
8802
8956
|
}
|
|
8803
|
-
function appendInterpolatedPoints(points, next, maxStepWorld) {
|
|
8804
|
-
if (points.length === 0) return [next];
|
|
8805
|
-
const last = points[points.length - 1];
|
|
8806
|
-
if (!last) return [...points, next];
|
|
8807
|
-
const dx = next.x - last.x;
|
|
8808
|
-
const dy = next.y - last.y;
|
|
8809
|
-
if (dx * dx + dy * dy < 1e-12) return points;
|
|
8810
|
-
return [...points, next];
|
|
8811
|
-
}
|
|
8812
8957
|
function pointerSampleToWorldPoint(screenToWorldFn, clientX, clientY, pressure) {
|
|
8813
8958
|
const { worldX, worldY } = screenToWorldFn(clientX, clientY);
|
|
8814
8959
|
const safePressure = pressure != null && Number.isFinite(pressure) ? Math.min(1, Math.max(0, pressure)) : void 0;
|
|
@@ -8839,15 +8984,19 @@ function isLikelyStylusTouch(touch) {
|
|
|
8839
8984
|
}
|
|
8840
8985
|
function appendPointerEventSamplesToStrokePoints(points, ev, zoom, screenToWorldFn) {
|
|
8841
8986
|
let interpolated = points;
|
|
8842
|
-
ev.pointerType === "pen" ? 0.35 / zoom : 1 / zoom;
|
|
8843
|
-
for (const sample of
|
|
8987
|
+
const maxStepWorld = ev.pointerType === "pen" ? 0.35 / zoom : 1 / zoom;
|
|
8988
|
+
for (const sample of getPointerEventSamples(ev)) {
|
|
8844
8989
|
const nextPoint = pointerSampleToWorldPoint(
|
|
8845
8990
|
screenToWorldFn,
|
|
8846
8991
|
sample.clientX,
|
|
8847
8992
|
sample.clientY,
|
|
8848
8993
|
sample.pointerType === "pen" ? sample.pressure : void 0
|
|
8849
8994
|
);
|
|
8850
|
-
interpolated =
|
|
8995
|
+
interpolated = appendInterpolatedStrokePoint(
|
|
8996
|
+
interpolated,
|
|
8997
|
+
nextPoint,
|
|
8998
|
+
maxStepWorld
|
|
8999
|
+
);
|
|
8851
9000
|
}
|
|
8852
9001
|
return interpolated;
|
|
8853
9002
|
}
|
|
@@ -8858,7 +9007,7 @@ function appendTouchToStrokePoints(points, touch, zoom, screenToWorldFn) {
|
|
|
8858
9007
|
touch.clientY,
|
|
8859
9008
|
touchPressure(touch)
|
|
8860
9009
|
);
|
|
8861
|
-
return
|
|
9010
|
+
return appendInterpolatedStrokePoint(points, nextPoint, 0.35 / zoom);
|
|
8862
9011
|
}
|
|
8863
9012
|
function createStraightStrokeState(anchorPoint, clientX, clientY) {
|
|
8864
9013
|
return {
|