canvu-react 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.d.cts CHANGED
@@ -1,224 +1,13 @@
1
- import * as react from 'react';
2
- import { CSSProperties, ReactNode, SVGProps } from 'react';
3
- import { C as Camera2D } from './camera-BwQjm5oh.cjs';
4
- import { S as StrokeStyle } from './shape-builders-DxPoOecg.cjs';
5
- import { V as VectorSceneItem } from './types-CB0TZZuk.cjs';
6
- import { V as VectorToolDefinition, C as CanvasPlugin } from './types-D1ftVsOQ.cjs';
7
- export { a as CanvasPluginComponentProps, b as CanvasPluginContribution, c as CanvasPluginItemsChangeMiddlewareContext, d as CanvasPluginRenderContext, e as CanvuPluginContext, f as CanvuPluginContextValue, g as CanvuPluginViewportSnapshot, h as CustomShapePlacementOptions, P as PlacementPreview, i as VectorViewport, j as VectorViewportHandle, k as VectorViewportProps, W as WorldPointerDownDetail, l as createCanvuPlugin, u as useCanvuDocumentContext, m as useCanvuPluginContext, n as useCanvuPluginContribution, o as useCanvuResolvedTools, p as useCanvuViewportContext } from './types-D1ftVsOQ.cjs';
8
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import { V as VectorToolDefinition, C as CanvasPlugin, B as BoardComponentPosition } from './types-B_rv7p8b.cjs';
2
+ export { a as CanvasPluginComponentProps, b as CanvasPluginContribution, c as CanvasPluginItemsChangeMiddlewareContext, d as CanvasPluginRenderContext, e as CanvuChromeActiveToolStyle, f as CanvuChromeContext, g as CanvuChromeContextValue, h as CanvuChromeSelectionStyleChange, i as CanvuPluginContext, j as CanvuPluginContextValue, k as CanvuPluginViewportSnapshot, l as CustomShapePlacementOptions, N as NavMenu, m as NavMenuProps, P as PlacementPreview, n as VectorCanvas, o as VectorCanvasBody, p as VectorCanvasHeader, q as VectorCanvasMain, r as VectorCanvasRoot, s as VectorCanvasSlotProps, t as VectorCanvasSpacePosition, u as VectorCanvasSpaceProps, v as VectorCanvasToolbar, w as VectorCanvasToolbarProps, x as VectorCanvasViewportSurface, y as VectorSelectionInspector, z as VectorSelectionInspectorProps, A as VectorViewport, D as VectorViewportHandle, E as VectorViewportProps, W as WorldPointerDownDetail, F as createCanvuPlugin, G as getBoardPositionStyle, H as useCanvuChromeContext, I as useCanvuDocumentContext, J as useCanvuPluginContext, K as useCanvuPluginContribution, L as useCanvuResolvedTools, M as useCanvuViewportContext } from './types-B_rv7p8b.cjs';
9
3
  import { V as VectorCanvasPersistenceAdapter, a as VectorCanvasRemoteAdapter } from './types-B58i5k-u.cjs';
10
4
  export { b as VectorCanvasSnapshot } from './types-B58i5k-u.cjs';
11
-
12
- type CanvuChromeActiveToolStyle = StrokeStyle & {
13
- toolKind: "draw" | "marker";
14
- label?: string;
15
- };
16
- type CanvuChromeSelectionStyleChange = (patch: {
17
- stroke: string;
18
- strokeWidth: number;
19
- strokeOpacity?: number;
20
- }) => void;
21
- /**
22
- * Runtime data and handlers shared with floating board chrome (e.g. {@link NavMenu},
23
- * {@link VectorSelectionInspector}). Populated by `VectorViewport` and consumed via
24
- * {@link useCanvuChromeContext}.
25
- */
26
- type CanvuChromeContextValue = {
27
- camera: Camera2D | null;
28
- viewportWidth: number;
29
- viewportHeight: number;
30
- items: readonly VectorSceneItem[];
31
- selectedItems: readonly VectorSceneItem[];
32
- interactive: boolean;
33
- canEditSelection: boolean;
34
- activeToolStyle: CanvuChromeActiveToolStyle | null;
35
- onSelectionStyleChange: CanvuChromeSelectionStyleChange | null;
36
- zoomPercent: number;
37
- onZoomIn: () => void;
38
- onZoomOut: () => void;
39
- onUndo: () => void;
40
- onRedo: () => void;
41
- canUndo: boolean;
42
- canRedo: boolean;
43
- onRequestRender: () => void;
44
- };
45
- declare const CanvuChromeContext: react.Context<CanvuChromeContextValue | null>;
46
- /** Returns the current chrome context or `null` when used outside `VectorViewport`. */
47
- declare function useCanvuChromeContext(): CanvuChromeContextValue | null;
48
-
49
- type ActiveToolStyle = StrokeStyle & {
50
- toolKind: "draw" | "marker";
51
- label?: string;
52
- };
53
- /**
54
- * Color + stroke-width inspector for the current selection (or active drawing tool style).
55
- * When rendered inside `VectorViewport` (e.g. via the `selectionInspector` slot), `items`,
56
- * `activeToolStyle`, and `onChange` default to values from {@link CanvuChromeContext};
57
- * pass any prop to override.
58
- */
59
- type VectorSelectionInspectorProps = {
60
- /** Selected items that support stroke/fill styling (caller may filter). */
61
- items?: readonly VectorSceneItem[];
62
- /** Optional active tool style shown even without a selection. */
63
- activeToolStyle?: ActiveToolStyle | null;
64
- /** Apply stroke / width / opacity to every item in `items`. */
65
- onChange?: CanvuChromeSelectionStyleChange;
66
- /** Anchor preset. Defaults to top-left. */
67
- position?: BoardComponentPosition;
68
- /** Distance (px) from anchored edges. @default 12 */
69
- inset?: number;
70
- /** @default 24 */
71
- zIndex?: number;
72
- className?: string;
73
- /** Merged on top of position-derived styles for custom tweaks. */
74
- style?: CSSProperties;
75
- };
76
- /**
77
- * Color + stroke width for the current selection. Supports multiple selected shapes: one change applies to all.
78
- */
79
- declare function VectorSelectionInspector({ items: itemsProp, activeToolStyle: activeToolStyleProp, onChange: onChangeProp, position, inset, zIndex, className, style, }: VectorSelectionInspectorProps): react_jsx_runtime.JSX.Element | null;
80
-
81
- type VectorCanvasSlotProps = {
82
- children?: ReactNode;
83
- className?: string;
84
- style?: CSSProperties;
85
- };
86
- /**
87
- * Anchor presets for floating board components.
88
- *
89
- * Names are `<edge>-<position-along-edge>`:
90
- * - `top-*` / `bottom-*` anchor to the top or bottom edge.
91
- * - `left-*` / `right-*` anchor to the left or right edge.
92
- *
93
- * Corner aliases are equivalent (e.g. `top-left` and `left-top` resolve to the same anchor),
94
- * but kept distinct so callers can pick whichever reads best in their layout (a vertical
95
- * strip might prefer `left-top`; a horizontal strip prefers `top-left`).
96
- */
97
- type BoardComponentPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | "left-top" | "left-center" | "left-bottom" | "right-top" | "right-center" | "right-bottom" | "center" | "fill";
98
- /** @deprecated Use {@link BoardComponentPosition}. */
99
- type VectorCanvasSpacePosition = BoardComponentPosition;
100
- /**
101
- * Compute absolute-position CSS for a board component anchor preset.
102
- * Returns `position`, `zIndex`, and the relevant edge offsets / transforms.
103
- * Callers merge the result with their own style/className overrides.
104
- */
105
- declare function getBoardPositionStyle(position: BoardComponentPosition, inset?: number, zIndex?: number): CSSProperties;
106
- type VectorCanvasSpaceProps = VectorCanvasSlotProps & {
107
- position?: BoardComponentPosition;
108
- /** @default 12 */
109
- inset?: number;
110
- /** @default 40 */
111
- zIndex?: number;
112
- /** Pointer events value on the content wrapper. @default "auto" */
113
- contentPointerEvents?: CSSProperties["pointerEvents"];
114
- };
115
- /**
116
- * Full-viewport column shell for a vector canvas (header + body with stage).
117
- * Use with {@link VectorCanvasBody}, {@link VectorCanvasMain}. Pass `toolbar` on {@link VectorViewport};
118
- * Compose the floating tool strip with {@link VectorCanvasToolbar} around {@link VectorToolbar} (see example below).
119
- */
120
- declare function VectorCanvasRoot({ children, className, style, }: VectorCanvasSlotProps): react_jsx_runtime.JSX.Element;
121
- /** Optional top chrome (title, hints, toggles). */
122
- declare function VectorCanvasHeader({ children, className, style, }: VectorCanvasSlotProps): react_jsx_runtime.JSX.Element;
123
- /** Fills remaining space below the header (typically one {@link VectorCanvasMain}). */
124
- declare function VectorCanvasBody({ children, className, style, }: VectorCanvasSlotProps): react_jsx_runtime.JSX.Element;
125
- /**
126
- * Stretch area for {@link VectorViewport} (or any child that should fill the stage).
127
- */
128
- declare function VectorCanvasMain({ children, className, style, }: VectorCanvasSlotProps): react_jsx_runtime.JSX.Element;
129
- /**
130
- * Flex child that fills {@link VectorCanvasMain} and gives {@link VectorViewport} a bounded height
131
- * (white surface by default). Omit if you set the background on `Main` or the viewport yourself.
132
- */
133
- declare function VectorCanvasViewportSurface({ children, className, style, }: VectorCanvasSlotProps): react_jsx_runtime.JSX.Element;
134
- type VectorCanvasToolbarProps = {
135
- children?: ReactNode;
136
- className?: string;
137
- style?: CSSProperties;
138
- /** Anchor preset. @default "bottom-center" */
139
- position?: BoardComponentPosition;
140
- /** Distance (px) from the anchored edge(s). @default 12 */
141
- inset?: number;
142
- /** @default 30 */
143
- zIndex?: number;
144
- };
145
- /**
146
- * Floating strip anchor for {@link VectorToolbar} or custom controls. Defaults to bottom-center.
147
- * Renders `pointer-events: none` on the shell and `auto` on children so the canvas keeps receiving hits outside the bar.
148
- * Pass as the `toolbar` prop of `VectorViewport`; pick a different `position` for top / side anchoring.
149
- * Z-index defaults to 30 so the strip stays above zoom controls.
150
- */
151
- declare function VectorCanvasToolbar({ children, className, style, position, inset, zIndex, }: VectorCanvasToolbarProps): react_jsx_runtime.JSX.Element;
152
- /**
153
- * Absolute canvas-aligned space for floating UI such as chats, rosters, inspectors, and overlays.
154
- * Use this instead of ad-hoc wrapper divs or plugin hosts when a feature can be expressed as React nodes.
155
- */
156
- declare function VectorCanvasSpace({ children, className, style, position, inset, zIndex, contentPointerEvents, }: VectorCanvasSpaceProps): react_jsx_runtime.JSX.Element;
157
- /**
158
- * Namespaced layout primitives for composing a vector canvas shell without ad-hoc wrapper divs.
159
- *
160
- * @example
161
- * ```tsx
162
- * <VectorCanvas.Root>
163
- * <VectorCanvas.Header>…</VectorCanvas.Header>
164
- * <VectorCanvas.Body>
165
- * <VectorCanvas.Main>
166
- * <VectorCanvas.ViewportSurface>
167
- * <VectorViewport
168
- * toolbar={
169
- * <VectorCanvas.Toolbar>
170
- * <VectorToolbar … />
171
- * </VectorCanvas.Toolbar>
172
- * }
173
- * …
174
- * />
175
- * </VectorCanvas.ViewportSurface>
176
- * </VectorCanvas.Main>
177
- * </VectorCanvas.Body>
178
- * </VectorCanvas.Root>
179
- * ```
180
- */
181
- declare const VectorCanvas: {
182
- readonly Root: typeof VectorCanvasRoot;
183
- readonly Header: typeof VectorCanvasHeader;
184
- readonly Body: typeof VectorCanvasBody;
185
- readonly Main: typeof VectorCanvasMain;
186
- readonly ViewportSurface: typeof VectorCanvasViewportSurface;
187
- readonly Toolbar: typeof VectorCanvasToolbar;
188
- readonly Space: typeof VectorCanvasSpace;
189
- readonly NavMenu: typeof NavMenu;
190
- readonly SelectionInspector: typeof VectorSelectionInspector;
191
- };
192
-
193
- /**
194
- * Floating bottom-bar combining zoom controls, undo/redo, and an expandable minimap.
195
- * When rendered inside `VectorViewport` (e.g. via the `navMenu` slot), data props default
196
- * to values from {@link CanvuChromeContext}; pass any prop to override.
197
- */
198
- type NavMenuProps = {
199
- camera?: Camera2D;
200
- viewportWidth?: number;
201
- viewportHeight?: number;
202
- items?: readonly VectorSceneItem[];
203
- zoomPercent?: number;
204
- onZoomIn?: () => void;
205
- onZoomOut?: () => void;
206
- onUndo?: () => void;
207
- onRedo?: () => void;
208
- canUndo?: boolean;
209
- canRedo?: boolean;
210
- onRequestRender?: () => void;
211
- /** Anchor preset. Defaults to bottom-left. */
212
- position?: BoardComponentPosition;
213
- /** Distance (px) from anchored edges. @default 12 */
214
- inset?: number;
215
- /** @default 23 */
216
- zIndex?: number;
217
- className?: string;
218
- /** Merged on top of position-derived styles for custom tweaks. */
219
- style?: CSSProperties;
220
- };
221
- declare function NavMenu({ camera: cameraProp, viewportWidth: viewportWidthProp, viewportHeight: viewportHeightProp, items: itemsProp, zoomPercent: zoomPercentProp, onZoomIn: onZoomInProp, onZoomOut: onZoomOutProp, onUndo: onUndoProp, onRedo: onRedoProp, canUndo: canUndoProp, canRedo: canRedoProp, onRequestRender: onRequestRenderProp, position, inset, zIndex, className, style, }: NavMenuProps): react_jsx_runtime.JSX.Element;
5
+ import { V as VectorSceneItem } from './types-CB0TZZuk.cjs';
6
+ import * as react from 'react';
7
+ import { SVGProps, CSSProperties, ReactNode } from 'react';
8
+ import * as react_jsx_runtime from 'react/jsx-runtime';
9
+ import './camera-BwQjm5oh.cjs';
10
+ import './shape-builders-DxPoOecg.cjs';
222
11
 
223
12
  /**
224
13
  * Persistence adapter that stores the document JSON in IndexedDB and manages
@@ -478,4 +267,4 @@ type ViewportZoomControlsProps = {
478
267
  */
479
268
  declare function ViewportZoomControls({ zoomPercent, onZoomIn, onZoomOut, className, position, inset, zIndex, style, }: ViewportZoomControlsProps): react_jsx_runtime.JSX.Element;
480
269
 
481
- export { type BoardComponentPosition, CanvasPlugin, type CanvuChromeActiveToolStyle, CanvuChromeContext, type CanvuChromeContextValue, type CanvuChromeSelectionStyleChange, type CreateLocalStoragePersistenceAdapterOptions, type CreateToolPluginOptions, DEFAULT_OVERFLOW_TOOL_IDS, DEFAULT_VECTOR_CANVAS_STORAGE_KEY, DEFAULT_VECTOR_TOOLS, IconArrow, IconDraw, IconEllipse, IconHand, IconImage, IconLaser, IconLine, IconRect, IconSelect, IconText, NavMenu, type NavMenuProps, ShapeContextMenu, type ShapeContextMenuProps, type UseVectorCanvasDocumentOptions, type UseVectorCanvasDocumentResult, VectorCanvas, VectorCanvasBody, VectorCanvasHeader, VectorCanvasMain, VectorCanvasPersistenceAdapter, VectorCanvasRemoteAdapter, VectorCanvasRoot, type VectorCanvasSlotProps, type VectorCanvasSpacePosition, type VectorCanvasSpaceProps, VectorCanvasToolbar, type VectorCanvasToolbarProps, VectorCanvasViewportSurface, VectorSelectionInspector, type VectorSelectionInspectorProps, VectorToolDefinition, VectorToolbar, type VectorToolbarProps, type VectorToolbarRenderContext, ViewportZoomControls, type ViewportZoomControlsProps, createIndexedDbPersistenceAdapter, createLocalStoragePersistenceAdapter, createNoopPersistenceAdapter, createToolPlugin, cursorForVectorToolId, getBoardPositionStyle, useCanvuChromeContext, useVectorCanvasDocument };
270
+ export { BoardComponentPosition, CanvasPlugin, type CreateLocalStoragePersistenceAdapterOptions, type CreateToolPluginOptions, DEFAULT_OVERFLOW_TOOL_IDS, DEFAULT_VECTOR_CANVAS_STORAGE_KEY, DEFAULT_VECTOR_TOOLS, IconArrow, IconDraw, IconEllipse, IconHand, IconImage, IconLaser, IconLine, IconRect, IconSelect, IconText, ShapeContextMenu, type ShapeContextMenuProps, type UseVectorCanvasDocumentOptions, type UseVectorCanvasDocumentResult, VectorCanvasPersistenceAdapter, VectorCanvasRemoteAdapter, VectorToolDefinition, VectorToolbar, type VectorToolbarProps, type VectorToolbarRenderContext, ViewportZoomControls, type ViewportZoomControlsProps, createIndexedDbPersistenceAdapter, createLocalStoragePersistenceAdapter, createNoopPersistenceAdapter, createToolPlugin, cursorForVectorToolId, useVectorCanvasDocument };
package/dist/react.d.ts CHANGED
@@ -1,224 +1,13 @@
1
- import * as react from 'react';
2
- import { CSSProperties, ReactNode, SVGProps } from 'react';
3
- import { C as Camera2D } from './camera-KwCYYPhm.js';
4
- import { S as StrokeStyle } from './shape-builders-DTYvub8W.js';
5
- import { V as VectorSceneItem } from './types-CB0TZZuk.js';
6
- import { V as VectorToolDefinition, C as CanvasPlugin } from './types--ALu1mF-.js';
7
- export { a as CanvasPluginComponentProps, b as CanvasPluginContribution, c as CanvasPluginItemsChangeMiddlewareContext, d as CanvasPluginRenderContext, e as CanvuPluginContext, f as CanvuPluginContextValue, g as CanvuPluginViewportSnapshot, h as CustomShapePlacementOptions, P as PlacementPreview, i as VectorViewport, j as VectorViewportHandle, k as VectorViewportProps, W as WorldPointerDownDetail, l as createCanvuPlugin, u as useCanvuDocumentContext, m as useCanvuPluginContext, n as useCanvuPluginContribution, o as useCanvuResolvedTools, p as useCanvuViewportContext } from './types--ALu1mF-.js';
8
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import { V as VectorToolDefinition, C as CanvasPlugin, B as BoardComponentPosition } from './types-BCtWx3zP.js';
2
+ export { a as CanvasPluginComponentProps, b as CanvasPluginContribution, c as CanvasPluginItemsChangeMiddlewareContext, d as CanvasPluginRenderContext, e as CanvuChromeActiveToolStyle, f as CanvuChromeContext, g as CanvuChromeContextValue, h as CanvuChromeSelectionStyleChange, i as CanvuPluginContext, j as CanvuPluginContextValue, k as CanvuPluginViewportSnapshot, l as CustomShapePlacementOptions, N as NavMenu, m as NavMenuProps, P as PlacementPreview, n as VectorCanvas, o as VectorCanvasBody, p as VectorCanvasHeader, q as VectorCanvasMain, r as VectorCanvasRoot, s as VectorCanvasSlotProps, t as VectorCanvasSpacePosition, u as VectorCanvasSpaceProps, v as VectorCanvasToolbar, w as VectorCanvasToolbarProps, x as VectorCanvasViewportSurface, y as VectorSelectionInspector, z as VectorSelectionInspectorProps, A as VectorViewport, D as VectorViewportHandle, E as VectorViewportProps, W as WorldPointerDownDetail, F as createCanvuPlugin, G as getBoardPositionStyle, H as useCanvuChromeContext, I as useCanvuDocumentContext, J as useCanvuPluginContext, K as useCanvuPluginContribution, L as useCanvuResolvedTools, M as useCanvuViewportContext } from './types-BCtWx3zP.js';
9
3
  import { V as VectorCanvasPersistenceAdapter, a as VectorCanvasRemoteAdapter } from './types-DgEArHkA.js';
10
4
  export { b as VectorCanvasSnapshot } from './types-DgEArHkA.js';
11
-
12
- type CanvuChromeActiveToolStyle = StrokeStyle & {
13
- toolKind: "draw" | "marker";
14
- label?: string;
15
- };
16
- type CanvuChromeSelectionStyleChange = (patch: {
17
- stroke: string;
18
- strokeWidth: number;
19
- strokeOpacity?: number;
20
- }) => void;
21
- /**
22
- * Runtime data and handlers shared with floating board chrome (e.g. {@link NavMenu},
23
- * {@link VectorSelectionInspector}). Populated by `VectorViewport` and consumed via
24
- * {@link useCanvuChromeContext}.
25
- */
26
- type CanvuChromeContextValue = {
27
- camera: Camera2D | null;
28
- viewportWidth: number;
29
- viewportHeight: number;
30
- items: readonly VectorSceneItem[];
31
- selectedItems: readonly VectorSceneItem[];
32
- interactive: boolean;
33
- canEditSelection: boolean;
34
- activeToolStyle: CanvuChromeActiveToolStyle | null;
35
- onSelectionStyleChange: CanvuChromeSelectionStyleChange | null;
36
- zoomPercent: number;
37
- onZoomIn: () => void;
38
- onZoomOut: () => void;
39
- onUndo: () => void;
40
- onRedo: () => void;
41
- canUndo: boolean;
42
- canRedo: boolean;
43
- onRequestRender: () => void;
44
- };
45
- declare const CanvuChromeContext: react.Context<CanvuChromeContextValue | null>;
46
- /** Returns the current chrome context or `null` when used outside `VectorViewport`. */
47
- declare function useCanvuChromeContext(): CanvuChromeContextValue | null;
48
-
49
- type ActiveToolStyle = StrokeStyle & {
50
- toolKind: "draw" | "marker";
51
- label?: string;
52
- };
53
- /**
54
- * Color + stroke-width inspector for the current selection (or active drawing tool style).
55
- * When rendered inside `VectorViewport` (e.g. via the `selectionInspector` slot), `items`,
56
- * `activeToolStyle`, and `onChange` default to values from {@link CanvuChromeContext};
57
- * pass any prop to override.
58
- */
59
- type VectorSelectionInspectorProps = {
60
- /** Selected items that support stroke/fill styling (caller may filter). */
61
- items?: readonly VectorSceneItem[];
62
- /** Optional active tool style shown even without a selection. */
63
- activeToolStyle?: ActiveToolStyle | null;
64
- /** Apply stroke / width / opacity to every item in `items`. */
65
- onChange?: CanvuChromeSelectionStyleChange;
66
- /** Anchor preset. Defaults to top-left. */
67
- position?: BoardComponentPosition;
68
- /** Distance (px) from anchored edges. @default 12 */
69
- inset?: number;
70
- /** @default 24 */
71
- zIndex?: number;
72
- className?: string;
73
- /** Merged on top of position-derived styles for custom tweaks. */
74
- style?: CSSProperties;
75
- };
76
- /**
77
- * Color + stroke width for the current selection. Supports multiple selected shapes: one change applies to all.
78
- */
79
- declare function VectorSelectionInspector({ items: itemsProp, activeToolStyle: activeToolStyleProp, onChange: onChangeProp, position, inset, zIndex, className, style, }: VectorSelectionInspectorProps): react_jsx_runtime.JSX.Element | null;
80
-
81
- type VectorCanvasSlotProps = {
82
- children?: ReactNode;
83
- className?: string;
84
- style?: CSSProperties;
85
- };
86
- /**
87
- * Anchor presets for floating board components.
88
- *
89
- * Names are `<edge>-<position-along-edge>`:
90
- * - `top-*` / `bottom-*` anchor to the top or bottom edge.
91
- * - `left-*` / `right-*` anchor to the left or right edge.
92
- *
93
- * Corner aliases are equivalent (e.g. `top-left` and `left-top` resolve to the same anchor),
94
- * but kept distinct so callers can pick whichever reads best in their layout (a vertical
95
- * strip might prefer `left-top`; a horizontal strip prefers `top-left`).
96
- */
97
- type BoardComponentPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | "left-top" | "left-center" | "left-bottom" | "right-top" | "right-center" | "right-bottom" | "center" | "fill";
98
- /** @deprecated Use {@link BoardComponentPosition}. */
99
- type VectorCanvasSpacePosition = BoardComponentPosition;
100
- /**
101
- * Compute absolute-position CSS for a board component anchor preset.
102
- * Returns `position`, `zIndex`, and the relevant edge offsets / transforms.
103
- * Callers merge the result with their own style/className overrides.
104
- */
105
- declare function getBoardPositionStyle(position: BoardComponentPosition, inset?: number, zIndex?: number): CSSProperties;
106
- type VectorCanvasSpaceProps = VectorCanvasSlotProps & {
107
- position?: BoardComponentPosition;
108
- /** @default 12 */
109
- inset?: number;
110
- /** @default 40 */
111
- zIndex?: number;
112
- /** Pointer events value on the content wrapper. @default "auto" */
113
- contentPointerEvents?: CSSProperties["pointerEvents"];
114
- };
115
- /**
116
- * Full-viewport column shell for a vector canvas (header + body with stage).
117
- * Use with {@link VectorCanvasBody}, {@link VectorCanvasMain}. Pass `toolbar` on {@link VectorViewport};
118
- * Compose the floating tool strip with {@link VectorCanvasToolbar} around {@link VectorToolbar} (see example below).
119
- */
120
- declare function VectorCanvasRoot({ children, className, style, }: VectorCanvasSlotProps): react_jsx_runtime.JSX.Element;
121
- /** Optional top chrome (title, hints, toggles). */
122
- declare function VectorCanvasHeader({ children, className, style, }: VectorCanvasSlotProps): react_jsx_runtime.JSX.Element;
123
- /** Fills remaining space below the header (typically one {@link VectorCanvasMain}). */
124
- declare function VectorCanvasBody({ children, className, style, }: VectorCanvasSlotProps): react_jsx_runtime.JSX.Element;
125
- /**
126
- * Stretch area for {@link VectorViewport} (or any child that should fill the stage).
127
- */
128
- declare function VectorCanvasMain({ children, className, style, }: VectorCanvasSlotProps): react_jsx_runtime.JSX.Element;
129
- /**
130
- * Flex child that fills {@link VectorCanvasMain} and gives {@link VectorViewport} a bounded height
131
- * (white surface by default). Omit if you set the background on `Main` or the viewport yourself.
132
- */
133
- declare function VectorCanvasViewportSurface({ children, className, style, }: VectorCanvasSlotProps): react_jsx_runtime.JSX.Element;
134
- type VectorCanvasToolbarProps = {
135
- children?: ReactNode;
136
- className?: string;
137
- style?: CSSProperties;
138
- /** Anchor preset. @default "bottom-center" */
139
- position?: BoardComponentPosition;
140
- /** Distance (px) from the anchored edge(s). @default 12 */
141
- inset?: number;
142
- /** @default 30 */
143
- zIndex?: number;
144
- };
145
- /**
146
- * Floating strip anchor for {@link VectorToolbar} or custom controls. Defaults to bottom-center.
147
- * Renders `pointer-events: none` on the shell and `auto` on children so the canvas keeps receiving hits outside the bar.
148
- * Pass as the `toolbar` prop of `VectorViewport`; pick a different `position` for top / side anchoring.
149
- * Z-index defaults to 30 so the strip stays above zoom controls.
150
- */
151
- declare function VectorCanvasToolbar({ children, className, style, position, inset, zIndex, }: VectorCanvasToolbarProps): react_jsx_runtime.JSX.Element;
152
- /**
153
- * Absolute canvas-aligned space for floating UI such as chats, rosters, inspectors, and overlays.
154
- * Use this instead of ad-hoc wrapper divs or plugin hosts when a feature can be expressed as React nodes.
155
- */
156
- declare function VectorCanvasSpace({ children, className, style, position, inset, zIndex, contentPointerEvents, }: VectorCanvasSpaceProps): react_jsx_runtime.JSX.Element;
157
- /**
158
- * Namespaced layout primitives for composing a vector canvas shell without ad-hoc wrapper divs.
159
- *
160
- * @example
161
- * ```tsx
162
- * <VectorCanvas.Root>
163
- * <VectorCanvas.Header>…</VectorCanvas.Header>
164
- * <VectorCanvas.Body>
165
- * <VectorCanvas.Main>
166
- * <VectorCanvas.ViewportSurface>
167
- * <VectorViewport
168
- * toolbar={
169
- * <VectorCanvas.Toolbar>
170
- * <VectorToolbar … />
171
- * </VectorCanvas.Toolbar>
172
- * }
173
- * …
174
- * />
175
- * </VectorCanvas.ViewportSurface>
176
- * </VectorCanvas.Main>
177
- * </VectorCanvas.Body>
178
- * </VectorCanvas.Root>
179
- * ```
180
- */
181
- declare const VectorCanvas: {
182
- readonly Root: typeof VectorCanvasRoot;
183
- readonly Header: typeof VectorCanvasHeader;
184
- readonly Body: typeof VectorCanvasBody;
185
- readonly Main: typeof VectorCanvasMain;
186
- readonly ViewportSurface: typeof VectorCanvasViewportSurface;
187
- readonly Toolbar: typeof VectorCanvasToolbar;
188
- readonly Space: typeof VectorCanvasSpace;
189
- readonly NavMenu: typeof NavMenu;
190
- readonly SelectionInspector: typeof VectorSelectionInspector;
191
- };
192
-
193
- /**
194
- * Floating bottom-bar combining zoom controls, undo/redo, and an expandable minimap.
195
- * When rendered inside `VectorViewport` (e.g. via the `navMenu` slot), data props default
196
- * to values from {@link CanvuChromeContext}; pass any prop to override.
197
- */
198
- type NavMenuProps = {
199
- camera?: Camera2D;
200
- viewportWidth?: number;
201
- viewportHeight?: number;
202
- items?: readonly VectorSceneItem[];
203
- zoomPercent?: number;
204
- onZoomIn?: () => void;
205
- onZoomOut?: () => void;
206
- onUndo?: () => void;
207
- onRedo?: () => void;
208
- canUndo?: boolean;
209
- canRedo?: boolean;
210
- onRequestRender?: () => void;
211
- /** Anchor preset. Defaults to bottom-left. */
212
- position?: BoardComponentPosition;
213
- /** Distance (px) from anchored edges. @default 12 */
214
- inset?: number;
215
- /** @default 23 */
216
- zIndex?: number;
217
- className?: string;
218
- /** Merged on top of position-derived styles for custom tweaks. */
219
- style?: CSSProperties;
220
- };
221
- declare function NavMenu({ camera: cameraProp, viewportWidth: viewportWidthProp, viewportHeight: viewportHeightProp, items: itemsProp, zoomPercent: zoomPercentProp, onZoomIn: onZoomInProp, onZoomOut: onZoomOutProp, onUndo: onUndoProp, onRedo: onRedoProp, canUndo: canUndoProp, canRedo: canRedoProp, onRequestRender: onRequestRenderProp, position, inset, zIndex, className, style, }: NavMenuProps): react_jsx_runtime.JSX.Element;
5
+ import { V as VectorSceneItem } from './types-CB0TZZuk.js';
6
+ import * as react from 'react';
7
+ import { SVGProps, CSSProperties, ReactNode } from 'react';
8
+ import * as react_jsx_runtime from 'react/jsx-runtime';
9
+ import './camera-KwCYYPhm.js';
10
+ import './shape-builders-DTYvub8W.js';
222
11
 
223
12
  /**
224
13
  * Persistence adapter that stores the document JSON in IndexedDB and manages
@@ -478,4 +267,4 @@ type ViewportZoomControlsProps = {
478
267
  */
479
268
  declare function ViewportZoomControls({ zoomPercent, onZoomIn, onZoomOut, className, position, inset, zIndex, style, }: ViewportZoomControlsProps): react_jsx_runtime.JSX.Element;
480
269
 
481
- export { type BoardComponentPosition, CanvasPlugin, type CanvuChromeActiveToolStyle, CanvuChromeContext, type CanvuChromeContextValue, type CanvuChromeSelectionStyleChange, type CreateLocalStoragePersistenceAdapterOptions, type CreateToolPluginOptions, DEFAULT_OVERFLOW_TOOL_IDS, DEFAULT_VECTOR_CANVAS_STORAGE_KEY, DEFAULT_VECTOR_TOOLS, IconArrow, IconDraw, IconEllipse, IconHand, IconImage, IconLaser, IconLine, IconRect, IconSelect, IconText, NavMenu, type NavMenuProps, ShapeContextMenu, type ShapeContextMenuProps, type UseVectorCanvasDocumentOptions, type UseVectorCanvasDocumentResult, VectorCanvas, VectorCanvasBody, VectorCanvasHeader, VectorCanvasMain, VectorCanvasPersistenceAdapter, VectorCanvasRemoteAdapter, VectorCanvasRoot, type VectorCanvasSlotProps, type VectorCanvasSpacePosition, type VectorCanvasSpaceProps, VectorCanvasToolbar, type VectorCanvasToolbarProps, VectorCanvasViewportSurface, VectorSelectionInspector, type VectorSelectionInspectorProps, VectorToolDefinition, VectorToolbar, type VectorToolbarProps, type VectorToolbarRenderContext, ViewportZoomControls, type ViewportZoomControlsProps, createIndexedDbPersistenceAdapter, createLocalStoragePersistenceAdapter, createNoopPersistenceAdapter, createToolPlugin, cursorForVectorToolId, getBoardPositionStyle, useCanvuChromeContext, useVectorCanvasDocument };
270
+ export { BoardComponentPosition, CanvasPlugin, type CreateLocalStoragePersistenceAdapterOptions, type CreateToolPluginOptions, DEFAULT_OVERFLOW_TOOL_IDS, DEFAULT_VECTOR_CANVAS_STORAGE_KEY, DEFAULT_VECTOR_TOOLS, IconArrow, IconDraw, IconEllipse, IconHand, IconImage, IconLaser, IconLine, IconRect, IconSelect, IconText, ShapeContextMenu, type ShapeContextMenuProps, type UseVectorCanvasDocumentOptions, type UseVectorCanvasDocumentResult, VectorCanvasPersistenceAdapter, VectorCanvasRemoteAdapter, VectorToolDefinition, VectorToolbar, type VectorToolbarProps, type VectorToolbarRenderContext, ViewportZoomControls, type ViewportZoomControlsProps, createIndexedDbPersistenceAdapter, createLocalStoragePersistenceAdapter, createNoopPersistenceAdapter, createToolPlugin, cursorForVectorToolId, useVectorCanvasDocument };
package/dist/react.js CHANGED
@@ -5750,10 +5750,11 @@ var VectorViewport = forwardRef(
5750
5750
  selectedIds: selectedIdsProp,
5751
5751
  onSelectionChange,
5752
5752
  onItemsChange: consumerOnItemsChange,
5753
- onWorldPointerDown,
5753
+ onWorldPointerDown: consumerOnWorldPointerDown,
5754
5754
  toolbar,
5755
5755
  navMenu,
5756
5756
  selectionInspector,
5757
+ selectionInspectorProps,
5757
5758
  plugins = [],
5758
5759
  onCameraChange: consumerOnCameraChange,
5759
5760
  customPlacement: consumerCustomPlacement,
@@ -5840,6 +5841,12 @@ var VectorViewport = forwardRef(
5840
5841
  );
5841
5842
  const remotePresence = [...orderedPluginContributions].reverse().map((contribution) => contribution.viewportProps?.remotePresence).find((value) => value !== void 0) ?? consumerRemotePresence;
5842
5843
  const presenceOverlay = [...orderedPluginContributions].reverse().map((contribution) => contribution.viewportProps?.presenceOverlay).find((value) => value !== void 0) ?? consumerPresenceOverlay;
5844
+ const onWorldPointerDown = composePluginEvent(
5845
+ consumerOnWorldPointerDown,
5846
+ orderedPluginContributions.map(
5847
+ (contribution) => contribution.callbacks?.onWorldPointerDown
5848
+ )
5849
+ );
5843
5850
  const onWorldPointerMove = composePluginEvent(
5844
5851
  consumerOnWorldPointerMove,
5845
5852
  orderedPluginContributions.map(
@@ -8188,7 +8195,13 @@ var VectorViewport = forwardRef(
8188
8195
  canRedo,
8189
8196
  onRequestRender: renderFrame
8190
8197
  };
8191
- const defaultSelectionInspector = cameraForOverlay && canEditSelection ? /* @__PURE__ */ jsx(VectorSelectionInspector, {}) : null;
8198
+ const defaultSelectionInspector = cameraForOverlay && canEditSelection ? /* @__PURE__ */ jsx(
8199
+ VectorSelectionInspector,
8200
+ {
8201
+ className: selectionInspectorProps?.className,
8202
+ style: selectionInspectorProps?.style
8203
+ }
8204
+ ) : null;
8192
8205
  const defaultNavMenu = cameraForOverlay ? /* @__PURE__ */ jsx(NavMenu, {}) : null;
8193
8206
  const resolvedSelectionInspector = selectionInspector === void 0 ? defaultSelectionInspector : selectionInspector;
8194
8207
  const resolvedNavMenu = navMenu === void 0 ? defaultNavMenu : navMenu;