canvu-react 0.4.47 → 0.4.49
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-Dc7fsnTG.d.ts → asset-hydration-BSjiek7Q.d.ts} +2 -2
- package/dist/{asset-hydration-Cy_2FyV5.d.cts → asset-hydration-F6aM5C7x.d.cts} +2 -2
- package/dist/{asset-store-TzOPvlgn.d.cts → asset-store-35ysK28r.d.cts} +1 -1
- package/dist/{asset-store-DQPRZEcy.d.ts → asset-store-D_FjW_CN.d.ts} +1 -1
- package/dist/chatbot.d.cts +6 -6
- package/dist/chatbot.d.ts +6 -6
- package/dist/index.cjs +49 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +53 -9
- package/dist/index.d.ts +53 -9
- package/dist/index.js +49 -1
- package/dist/index.js.map +1 -1
- package/dist/{link-item-DwzXOwU5.d.cts → link-item-BMV3VUCr.d.cts} +1 -1
- package/dist/{link-item-IW4GTnxl.d.ts → link-item-COoNNvCu.d.ts} +1 -1
- package/dist/native.cjs +59 -10
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +6 -6
- package/dist/native.d.ts +6 -6
- package/dist/native.js +59 -10
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +259 -18
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +29 -13
- package/dist/react.d.ts +29 -13
- package/dist/react.js +259 -18
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs +3 -1
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +8 -8
- package/dist/realtime.d.ts +8 -8
- package/dist/realtime.js +3 -1
- package/dist/realtime.js.map +1 -1
- package/dist/realtimeNative.d.cts +4 -4
- package/dist/realtimeNative.d.ts +4 -4
- package/dist/{shape-builders-Cyh8zvDG.d.ts → shape-builders-BCOAG0pS.d.ts} +1 -1
- package/dist/{shape-builders-CKEMjivV.d.cts → shape-builders-BmLS8CNh.d.cts} +1 -1
- package/dist/tldraw.cjs +3 -1
- package/dist/tldraw.cjs.map +1 -1
- package/dist/tldraw.d.cts +1 -1
- package/dist/tldraw.d.ts +1 -1
- package/dist/tldraw.js +3 -1
- package/dist/tldraw.js.map +1 -1
- package/dist/{types-BUPc2Zgw.d.cts → types-6HszqSa5.d.cts} +1 -1
- package/dist/{types-B7xZAKVJ.d.ts → types-BAEHaIYO.d.ts} +43 -6
- package/dist/{types-B82WiQQh.d.ts → types-BMMPUak7.d.ts} +1 -1
- package/dist/{types-BQUbxMgz.d.cts → types-BOQLWyCw.d.cts} +1 -1
- package/dist/{types-CYtq9Pr9.d.ts → types-BtWbGOqh.d.ts} +1 -1
- package/dist/{types-BCCvY6ie.d.cts → types-fJNwEnHf.d.cts} +35 -1
- package/dist/{types-BCCvY6ie.d.ts → types-fJNwEnHf.d.ts} +35 -1
- package/dist/{types-C4wI3Jyc.d.cts → types-uzeExFkd.d.cts} +43 -6
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { CSSProperties, ReactNode, RefObject } from 'react';
|
|
3
|
-
import { V as VectorSceneItem, R as Rect } from './types-
|
|
4
|
-
import { S as StrokeStyle, C as Camera2D } from './shape-builders-
|
|
5
|
-
import { C as CanvuLinkData } from './link-item-
|
|
6
|
-
import { a as VectorViewportAssetStore } from './asset-store-
|
|
7
|
-
import { R as RemotePresencePeer, P as PresenceOverlayRenderContext } from './types-
|
|
3
|
+
import { V as VectorSceneItem, R as Rect } from './types-fJNwEnHf.js';
|
|
4
|
+
import { S as StrokeStyle, C as Camera2D } from './shape-builders-BCOAG0pS.js';
|
|
5
|
+
import { C as CanvuLinkData } from './link-item-COoNNvCu.js';
|
|
6
|
+
import { a as VectorViewportAssetStore } from './asset-store-D_FjW_CN.js';
|
|
7
|
+
import { R as RemotePresencePeer, P as PresenceOverlayRenderContext } from './types-BMMPUak7.js';
|
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
type CanvuChromeActiveToolStyle = StrokeStyle & {
|
|
@@ -157,6 +157,28 @@ type WorldPointerDownDetail = {
|
|
|
157
157
|
toolId: string;
|
|
158
158
|
pointerType: string;
|
|
159
159
|
};
|
|
160
|
+
type SelectModeItemClickResult = "handled" | undefined;
|
|
161
|
+
type SelectModeItemClickDetail = {
|
|
162
|
+
/** The item hit by the click in select mode. */
|
|
163
|
+
item: VectorSceneItem;
|
|
164
|
+
/** World-space pointer location at release. */
|
|
165
|
+
worldX: number;
|
|
166
|
+
worldY: number;
|
|
167
|
+
/** Viewport/client pointer location at release. */
|
|
168
|
+
clientX: number;
|
|
169
|
+
clientY: number;
|
|
170
|
+
pointerType: string;
|
|
171
|
+
shiftKey: boolean;
|
|
172
|
+
altKey: boolean;
|
|
173
|
+
metaKey: boolean;
|
|
174
|
+
ctrlKey: boolean;
|
|
175
|
+
/** Current viewport items. */
|
|
176
|
+
items: readonly VectorSceneItem[];
|
|
177
|
+
/** Replace the clicked item while preserving item order. */
|
|
178
|
+
updateItem: (next: VectorSceneItem) => void;
|
|
179
|
+
/** Set the viewport selection when activation should also select or clear. */
|
|
180
|
+
setSelectedIds: (ids: readonly string[]) => void;
|
|
181
|
+
};
|
|
160
182
|
/**
|
|
161
183
|
* Imperative API for pan/zoom and integrations (e.g. AI agents following a region).
|
|
162
184
|
* Call {@link requestRender} after mutating the {@link Camera2D} from {@link getCamera}.
|
|
@@ -187,6 +209,21 @@ type CustomShapePlacementOptions = {
|
|
|
187
209
|
id: string;
|
|
188
210
|
bounds: Rect;
|
|
189
211
|
}) => VectorSceneItem;
|
|
212
|
+
/**
|
|
213
|
+
* Whether the item should become selected immediately after placement.
|
|
214
|
+
*
|
|
215
|
+
* Defaults to `true` to preserve existing behavior. Set to `false` for custom
|
|
216
|
+
* tools that behave like clickable pins, buttons, or cards.
|
|
217
|
+
*/
|
|
218
|
+
selectAfterCreate?: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Optional select-mode click handler for items created by this placement.
|
|
221
|
+
*
|
|
222
|
+
* If provided, a plain click on the item in select mode calls this handler instead
|
|
223
|
+
* of selecting or moving the item. Resize and rotate handles still win first, and
|
|
224
|
+
* dragging past the tap threshold falls back to normal move behavior.
|
|
225
|
+
*/
|
|
226
|
+
onSelectModeItemClick?: (detail: SelectModeItemClickDetail) => SelectModeItemClickResult;
|
|
190
227
|
};
|
|
191
228
|
type VectorViewportProps = {
|
|
192
229
|
/** Vector items to draw (SVG fragments). */
|
|
@@ -430,4 +467,4 @@ declare function useCanvuResolvedTools(): VectorToolDefinition[];
|
|
|
430
467
|
*/
|
|
431
468
|
declare function useCanvuPluginContribution(pluginId: string, contribution: CanvasPluginContribution): void;
|
|
432
469
|
|
|
433
|
-
export { type BoardComponentPosition as B, type
|
|
470
|
+
export { useCanvuViewportContext as A, type BoardComponentPosition as B, type CustomShapePlacementOptions as C, type PlacementPreview as P, type SelectModeItemClickDetail as S, type VectorToolDefinition as V, type WorldPointerDownDetail as W, type CanvasPlugin as a, VectorSelectionInspector as b, type CanvasPluginComponentProps as c, type CanvasPluginContribution as d, type CanvasPluginItemsChangeMiddlewareContext as e, type CanvasPluginRenderContext as f, type CanvuChromeActiveToolStyle as g, CanvuChromeContext as h, type CanvuChromeContextValue as i, type CanvuChromeSelectionStyleChange as j, CanvuPluginContext as k, type CanvuPluginContextValue as l, type CanvuPluginViewportSnapshot as m, type SelectModeItemClickResult as n, type VectorCanvasSpacePosition as o, type VectorSelectionInspectorProps as p, VectorViewport as q, type VectorViewportHandle as r, type VectorViewportProps as s, createCanvuPlugin as t, getBoardPositionStyle as u, useCanvuChromeContext as v, useCanvuDocumentContext as w, useCanvuPluginContext as x, useCanvuPluginContribution as y, useCanvuResolvedTools as z };
|
|
@@ -16,6 +16,17 @@ declare function rectsIntersect(a: Rect, b: Rect): boolean;
|
|
|
16
16
|
*/
|
|
17
17
|
declare function normalizeRect(r: Rect): Rect;
|
|
18
18
|
|
|
19
|
+
type ResizeHandleId = "nw" | "n" | "ne" | "e" | "se" | "s" | "sw" | "w";
|
|
20
|
+
/**
|
|
21
|
+
* Resize handles exposed for a custom shape.
|
|
22
|
+
*
|
|
23
|
+
* Use `"all"` for the default 8 handles, `"corners"` for corner-only resize,
|
|
24
|
+
* or pass explicit handle ids for constrained tools such as a single southeast
|
|
25
|
+
* corner handle. An empty array hides resize dots but leaves selection and
|
|
26
|
+
* rotation available.
|
|
27
|
+
*/
|
|
28
|
+
type CustomShapeResizeHandles = "all" | "corners" | readonly ResizeHandleId[];
|
|
29
|
+
|
|
19
30
|
/** Identifies how `childrenSvg` was produced for editing (resize, handles). */
|
|
20
31
|
type VectorToolKind = "rect" | "ellipse" | "architectural-cloud" | "line" | "arrow" | "draw" | "pencil" | "brush" | "marker" | "text" | "image" | "custom";
|
|
21
32
|
/** Local segment for line/arrow (relative to item `x`, `y`). */
|
|
@@ -152,8 +163,31 @@ type VectorSceneItem = {
|
|
|
152
163
|
width: number;
|
|
153
164
|
height: number;
|
|
154
165
|
};
|
|
166
|
+
/**
|
|
167
|
+
* For {@link toolKind} `"custom"`: controls which resize handles are visible and active.
|
|
168
|
+
*
|
|
169
|
+
* Defaults to `"all"` when omitted. Use `"corners"` for corner-only resize, explicit ids
|
|
170
|
+
* such as `["se"]` for constrained custom tools, or an empty array to hide resize dots
|
|
171
|
+
* while keeping selection and rotation available.
|
|
172
|
+
*/
|
|
173
|
+
readonly customResizeHandles?: CustomShapeResizeHandles;
|
|
174
|
+
/**
|
|
175
|
+
* Identifies the custom tool / placement that created this item.
|
|
176
|
+
*
|
|
177
|
+
* Canvu sets this automatically for items created through `customPlacement`,
|
|
178
|
+
* `customPlacements`, or `createToolPlugin(...)`. It is used to route
|
|
179
|
+
* select-mode item activation back to the tool that owns the item.
|
|
180
|
+
*/
|
|
181
|
+
readonly customToolId?: string;
|
|
182
|
+
/**
|
|
183
|
+
* Optional CSS class applied to the outer SVG item `<g>`.
|
|
184
|
+
*
|
|
185
|
+
* Use this for app-level styling and animation hooks. Pair with renderer attributes such
|
|
186
|
+
* as `data-canvu-hovered="true"` for hover animations in interactive canvases.
|
|
187
|
+
*/
|
|
188
|
+
readonly svgClassName?: string;
|
|
155
189
|
/** Optional app/plugin metadata persisted alongside the item. */
|
|
156
190
|
readonly pluginData?: Record<string, unknown>;
|
|
157
191
|
};
|
|
158
192
|
|
|
159
|
-
export { type ArrowEndpointBinding as A, type LineEndpointsLocal as L, type Rect as R, type VectorSceneItem as V, type ArrowBindings as a, type
|
|
193
|
+
export { type ArrowEndpointBinding as A, type CustomShapeResizeHandles as C, type LineEndpointsLocal as L, type Rect as R, type VectorSceneItem as V, type ArrowBindings as a, type ResizeHandleId as b, type VectorPathPoint as c, normalizeRect as n, rectsIntersect as r };
|
|
@@ -16,6 +16,17 @@ declare function rectsIntersect(a: Rect, b: Rect): boolean;
|
|
|
16
16
|
*/
|
|
17
17
|
declare function normalizeRect(r: Rect): Rect;
|
|
18
18
|
|
|
19
|
+
type ResizeHandleId = "nw" | "n" | "ne" | "e" | "se" | "s" | "sw" | "w";
|
|
20
|
+
/**
|
|
21
|
+
* Resize handles exposed for a custom shape.
|
|
22
|
+
*
|
|
23
|
+
* Use `"all"` for the default 8 handles, `"corners"` for corner-only resize,
|
|
24
|
+
* or pass explicit handle ids for constrained tools such as a single southeast
|
|
25
|
+
* corner handle. An empty array hides resize dots but leaves selection and
|
|
26
|
+
* rotation available.
|
|
27
|
+
*/
|
|
28
|
+
type CustomShapeResizeHandles = "all" | "corners" | readonly ResizeHandleId[];
|
|
29
|
+
|
|
19
30
|
/** Identifies how `childrenSvg` was produced for editing (resize, handles). */
|
|
20
31
|
type VectorToolKind = "rect" | "ellipse" | "architectural-cloud" | "line" | "arrow" | "draw" | "pencil" | "brush" | "marker" | "text" | "image" | "custom";
|
|
21
32
|
/** Local segment for line/arrow (relative to item `x`, `y`). */
|
|
@@ -152,8 +163,31 @@ type VectorSceneItem = {
|
|
|
152
163
|
width: number;
|
|
153
164
|
height: number;
|
|
154
165
|
};
|
|
166
|
+
/**
|
|
167
|
+
* For {@link toolKind} `"custom"`: controls which resize handles are visible and active.
|
|
168
|
+
*
|
|
169
|
+
* Defaults to `"all"` when omitted. Use `"corners"` for corner-only resize, explicit ids
|
|
170
|
+
* such as `["se"]` for constrained custom tools, or an empty array to hide resize dots
|
|
171
|
+
* while keeping selection and rotation available.
|
|
172
|
+
*/
|
|
173
|
+
readonly customResizeHandles?: CustomShapeResizeHandles;
|
|
174
|
+
/**
|
|
175
|
+
* Identifies the custom tool / placement that created this item.
|
|
176
|
+
*
|
|
177
|
+
* Canvu sets this automatically for items created through `customPlacement`,
|
|
178
|
+
* `customPlacements`, or `createToolPlugin(...)`. It is used to route
|
|
179
|
+
* select-mode item activation back to the tool that owns the item.
|
|
180
|
+
*/
|
|
181
|
+
readonly customToolId?: string;
|
|
182
|
+
/**
|
|
183
|
+
* Optional CSS class applied to the outer SVG item `<g>`.
|
|
184
|
+
*
|
|
185
|
+
* Use this for app-level styling and animation hooks. Pair with renderer attributes such
|
|
186
|
+
* as `data-canvu-hovered="true"` for hover animations in interactive canvases.
|
|
187
|
+
*/
|
|
188
|
+
readonly svgClassName?: string;
|
|
155
189
|
/** Optional app/plugin metadata persisted alongside the item. */
|
|
156
190
|
readonly pluginData?: Record<string, unknown>;
|
|
157
191
|
};
|
|
158
192
|
|
|
159
|
-
export { type ArrowEndpointBinding as A, type LineEndpointsLocal as L, type Rect as R, type VectorSceneItem as V, type ArrowBindings as a, type
|
|
193
|
+
export { type ArrowEndpointBinding as A, type CustomShapeResizeHandles as C, type LineEndpointsLocal as L, type Rect as R, type VectorSceneItem as V, type ArrowBindings as a, type ResizeHandleId as b, type VectorPathPoint as c, normalizeRect as n, rectsIntersect as r };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { CSSProperties, ReactNode, RefObject } from 'react';
|
|
3
|
-
import { V as VectorSceneItem, R as Rect } from './types-
|
|
4
|
-
import { S as StrokeStyle, C as Camera2D } from './shape-builders-
|
|
5
|
-
import { C as CanvuLinkData } from './link-item-
|
|
6
|
-
import { a as VectorViewportAssetStore } from './asset-store-
|
|
7
|
-
import { R as RemotePresencePeer, P as PresenceOverlayRenderContext } from './types-
|
|
3
|
+
import { V as VectorSceneItem, R as Rect } from './types-fJNwEnHf.cjs';
|
|
4
|
+
import { S as StrokeStyle, C as Camera2D } from './shape-builders-BmLS8CNh.cjs';
|
|
5
|
+
import { C as CanvuLinkData } from './link-item-BMV3VUCr.cjs';
|
|
6
|
+
import { a as VectorViewportAssetStore } from './asset-store-35ysK28r.cjs';
|
|
7
|
+
import { R as RemotePresencePeer, P as PresenceOverlayRenderContext } from './types-BOQLWyCw.cjs';
|
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
type CanvuChromeActiveToolStyle = StrokeStyle & {
|
|
@@ -157,6 +157,28 @@ type WorldPointerDownDetail = {
|
|
|
157
157
|
toolId: string;
|
|
158
158
|
pointerType: string;
|
|
159
159
|
};
|
|
160
|
+
type SelectModeItemClickResult = "handled" | undefined;
|
|
161
|
+
type SelectModeItemClickDetail = {
|
|
162
|
+
/** The item hit by the click in select mode. */
|
|
163
|
+
item: VectorSceneItem;
|
|
164
|
+
/** World-space pointer location at release. */
|
|
165
|
+
worldX: number;
|
|
166
|
+
worldY: number;
|
|
167
|
+
/** Viewport/client pointer location at release. */
|
|
168
|
+
clientX: number;
|
|
169
|
+
clientY: number;
|
|
170
|
+
pointerType: string;
|
|
171
|
+
shiftKey: boolean;
|
|
172
|
+
altKey: boolean;
|
|
173
|
+
metaKey: boolean;
|
|
174
|
+
ctrlKey: boolean;
|
|
175
|
+
/** Current viewport items. */
|
|
176
|
+
items: readonly VectorSceneItem[];
|
|
177
|
+
/** Replace the clicked item while preserving item order. */
|
|
178
|
+
updateItem: (next: VectorSceneItem) => void;
|
|
179
|
+
/** Set the viewport selection when activation should also select or clear. */
|
|
180
|
+
setSelectedIds: (ids: readonly string[]) => void;
|
|
181
|
+
};
|
|
160
182
|
/**
|
|
161
183
|
* Imperative API for pan/zoom and integrations (e.g. AI agents following a region).
|
|
162
184
|
* Call {@link requestRender} after mutating the {@link Camera2D} from {@link getCamera}.
|
|
@@ -187,6 +209,21 @@ type CustomShapePlacementOptions = {
|
|
|
187
209
|
id: string;
|
|
188
210
|
bounds: Rect;
|
|
189
211
|
}) => VectorSceneItem;
|
|
212
|
+
/**
|
|
213
|
+
* Whether the item should become selected immediately after placement.
|
|
214
|
+
*
|
|
215
|
+
* Defaults to `true` to preserve existing behavior. Set to `false` for custom
|
|
216
|
+
* tools that behave like clickable pins, buttons, or cards.
|
|
217
|
+
*/
|
|
218
|
+
selectAfterCreate?: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Optional select-mode click handler for items created by this placement.
|
|
221
|
+
*
|
|
222
|
+
* If provided, a plain click on the item in select mode calls this handler instead
|
|
223
|
+
* of selecting or moving the item. Resize and rotate handles still win first, and
|
|
224
|
+
* dragging past the tap threshold falls back to normal move behavior.
|
|
225
|
+
*/
|
|
226
|
+
onSelectModeItemClick?: (detail: SelectModeItemClickDetail) => SelectModeItemClickResult;
|
|
190
227
|
};
|
|
191
228
|
type VectorViewportProps = {
|
|
192
229
|
/** Vector items to draw (SVG fragments). */
|
|
@@ -430,4 +467,4 @@ declare function useCanvuResolvedTools(): VectorToolDefinition[];
|
|
|
430
467
|
*/
|
|
431
468
|
declare function useCanvuPluginContribution(pluginId: string, contribution: CanvasPluginContribution): void;
|
|
432
469
|
|
|
433
|
-
export { type BoardComponentPosition as B, type
|
|
470
|
+
export { useCanvuViewportContext as A, type BoardComponentPosition as B, type CustomShapePlacementOptions as C, type PlacementPreview as P, type SelectModeItemClickDetail as S, type VectorToolDefinition as V, type WorldPointerDownDetail as W, type CanvasPlugin as a, VectorSelectionInspector as b, type CanvasPluginComponentProps as c, type CanvasPluginContribution as d, type CanvasPluginItemsChangeMiddlewareContext as e, type CanvasPluginRenderContext as f, type CanvuChromeActiveToolStyle as g, CanvuChromeContext as h, type CanvuChromeContextValue as i, type CanvuChromeSelectionStyleChange as j, CanvuPluginContext as k, type CanvuPluginContextValue as l, type CanvuPluginViewportSnapshot as m, type SelectModeItemClickResult as n, type VectorCanvasSpacePosition as o, type VectorSelectionInspectorProps as p, VectorViewport as q, type VectorViewportHandle as r, type VectorViewportProps as s, createCanvuPlugin as t, getBoardPositionStyle as u, useCanvuChromeContext as v, useCanvuDocumentContext as w, useCanvuPluginContext as x, useCanvuPluginContribution as y, useCanvuResolvedTools as z };
|