canvu-react 0.3.9 → 0.3.11

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.
@@ -1,5 +1,115 @@
1
1
  import { V as VectorSceneItem, L as LineEndpointsLocal, b as VectorPathPoint, R as Rect, a as ArrowBindings } from './types-CB0TZZuk.cjs';
2
2
 
3
+ /**
4
+ * Kind of binary selected through the built-in canvu asset ingestion flow.
5
+ *
6
+ * Use this to branch your backend upload logic when images and PDFs should be
7
+ * stored differently.
8
+ */
9
+ type VectorViewportAssetKind = "image" | "pdf";
10
+ /**
11
+ * Original browser `File` intercepted from the built-in asset flow.
12
+ *
13
+ * This is the high-level hook for apps that want canvu to keep its native file
14
+ * UX while still uploading the raw binary to their backend or object storage.
15
+ *
16
+ * The same request shape is also reused by
17
+ * {@link ingestAssetFilesToSceneItems}, so custom import flows and the native
18
+ * viewport UX can share one backend contract.
19
+ */
20
+ type VectorViewportAssetUploadRequest = {
21
+ /** Original browser file before canvu converts it into scene items. */
22
+ file: File;
23
+ /** High-level bucket for routing image vs PDF upload behavior. */
24
+ kind: VectorViewportAssetKind;
25
+ };
26
+ /**
27
+ * Persisted metadata returned by a custom asset upload.
28
+ *
29
+ * The returned `pluginData` is shallow-merged into every `VectorSceneItem`
30
+ * created from the uploaded file, making it available to custom persistence
31
+ * adapters and later hydration flows.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const assetStore: VectorViewportAssetStore = {
36
+ * async upload({ file, kind }) {
37
+ * const form = new FormData();
38
+ * form.append("file", file);
39
+ * form.append("kind", kind);
40
+ *
41
+ * const response = await fetch("/api/canvu/assets", {
42
+ * method: "POST",
43
+ * body: form,
44
+ * });
45
+ *
46
+ * const asset = await response.json();
47
+ * return {
48
+ * pluginData: {
49
+ * assetId: asset.id,
50
+ * assetKey: asset.key,
51
+ * mimeType: file.type,
52
+ * },
53
+ * };
54
+ * },
55
+ * async resolve({ assetIds }) {
56
+ * const response = await fetch("/api/canvu/assets/resolve", {
57
+ * method: "POST",
58
+ * headers: { "content-type": "application/json" },
59
+ * body: JSON.stringify({ assetIds }),
60
+ * });
61
+ *
62
+ * return response.json();
63
+ * },
64
+ * };
65
+ * ```
66
+ */
67
+ type VectorViewportAssetUploadResult = {
68
+ /**
69
+ * Opaque persisted metadata attached to created items.
70
+ *
71
+ * Use this for asset ids, bucket keys, original file names, or any backend
72
+ * reference needed to rehydrate the binary later from your own persistence
73
+ * adapter.
74
+ */
75
+ pluginData?: VectorSceneItem["pluginData"];
76
+ };
77
+ /**
78
+ * Request to resolve persisted asset ids back into runtime URLs.
79
+ *
80
+ * This is useful inside custom persistence adapters when you want to rehydrate
81
+ * signed URLs or CDN URLs after loading a snapshot.
82
+ */
83
+ type VectorViewportAssetResolveRequest = {
84
+ assetIds: string[];
85
+ };
86
+ /**
87
+ * Runtime URL payload returned by a custom asset resolver.
88
+ */
89
+ type VectorViewportAssetResolveResult = Record<string, {
90
+ url: string;
91
+ thumbnailUrl?: string;
92
+ }>;
93
+ type VectorViewportAssetHydrationRequest = {
94
+ assetId: string;
95
+ kind: VectorViewportAssetKind;
96
+ pageNumber?: number;
97
+ scale?: number;
98
+ };
99
+ /**
100
+ * High-level hook for apps that want to persist raw binaries out-of-band while
101
+ * keeping canvu's built-in file UX.
102
+ *
103
+ * `upload` is used by the built-in file picker / drag-and-drop flow and by
104
+ * {@link ingestAssetFilesToSceneItems}. `resolve` is optional for custom
105
+ * persistence adapters and future hydration flows.
106
+ */
107
+ type VectorViewportAssetStore = {
108
+ upload: (request: VectorViewportAssetUploadRequest) => Promise<VectorViewportAssetUploadResult | undefined>;
109
+ resolve?: (request: VectorViewportAssetResolveRequest) => Promise<VectorViewportAssetResolveResult>;
110
+ getHydrationRequest?: (item: VectorSceneItem) => VectorViewportAssetHydrationRequest | null;
111
+ };
112
+
3
113
  /** Resolved stroke for SVG generation. */
4
114
  type StrokeStyle = {
5
115
  stroke: string;
@@ -90,4 +200,4 @@ declare function createImageFromVectorTrace(id: string, bounds: Rect, imageVecto
90
200
  height: number;
91
201
  }): VectorSceneItem;
92
202
 
93
- export { DEFAULT_STROKE_STYLE as D, type FreehandSvgPayload as F, type StrokeStyle as S, applyStrokeToItem as a, buildArrowSvg as b, buildDrawDotSvg as c, buildEllipseSvg as d, buildFreehandPathSvg as e, buildLineSvg as f, buildRectSvg as g, computeFreehandSvgPayload as h, createDrawDotItem as i, createEllipseItem as j, createFreehandStrokeItem as k, createImageFromVectorTrace as l, createImageItem as m, createLineItem as n, createRectangleItem as o, createShapeId as p, createTextItem as q, lineEndpointsToLocal as r, rebuildItemSvg as s, resolveStrokeStyle as t };
203
+ export { DEFAULT_STROKE_STYLE as D, type FreehandSvgPayload as F, type StrokeStyle as S, type VectorViewportAssetKind as V, applyStrokeToItem as a, buildArrowSvg as b, buildDrawDotSvg as c, buildEllipseSvg as d, buildFreehandPathSvg as e, buildLineSvg as f, buildRectSvg as g, computeFreehandSvgPayload as h, createDrawDotItem as i, createEllipseItem as j, createFreehandStrokeItem as k, createImageFromVectorTrace as l, createImageItem as m, createLineItem as n, createRectangleItem as o, createShapeId as p, createTextItem as q, lineEndpointsToLocal as r, rebuildItemSvg as s, resolveStrokeStyle as t, type VectorViewportAssetStore as u, type VectorViewportAssetHydrationRequest as v, type VectorViewportAssetResolveRequest as w, type VectorViewportAssetResolveResult as x, type VectorViewportAssetUploadRequest as y, type VectorViewportAssetUploadResult as z };
@@ -1,5 +1,115 @@
1
1
  import { V as VectorSceneItem, L as LineEndpointsLocal, b as VectorPathPoint, R as Rect, a as ArrowBindings } from './types-CB0TZZuk.js';
2
2
 
3
+ /**
4
+ * Kind of binary selected through the built-in canvu asset ingestion flow.
5
+ *
6
+ * Use this to branch your backend upload logic when images and PDFs should be
7
+ * stored differently.
8
+ */
9
+ type VectorViewportAssetKind = "image" | "pdf";
10
+ /**
11
+ * Original browser `File` intercepted from the built-in asset flow.
12
+ *
13
+ * This is the high-level hook for apps that want canvu to keep its native file
14
+ * UX while still uploading the raw binary to their backend or object storage.
15
+ *
16
+ * The same request shape is also reused by
17
+ * {@link ingestAssetFilesToSceneItems}, so custom import flows and the native
18
+ * viewport UX can share one backend contract.
19
+ */
20
+ type VectorViewportAssetUploadRequest = {
21
+ /** Original browser file before canvu converts it into scene items. */
22
+ file: File;
23
+ /** High-level bucket for routing image vs PDF upload behavior. */
24
+ kind: VectorViewportAssetKind;
25
+ };
26
+ /**
27
+ * Persisted metadata returned by a custom asset upload.
28
+ *
29
+ * The returned `pluginData` is shallow-merged into every `VectorSceneItem`
30
+ * created from the uploaded file, making it available to custom persistence
31
+ * adapters and later hydration flows.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const assetStore: VectorViewportAssetStore = {
36
+ * async upload({ file, kind }) {
37
+ * const form = new FormData();
38
+ * form.append("file", file);
39
+ * form.append("kind", kind);
40
+ *
41
+ * const response = await fetch("/api/canvu/assets", {
42
+ * method: "POST",
43
+ * body: form,
44
+ * });
45
+ *
46
+ * const asset = await response.json();
47
+ * return {
48
+ * pluginData: {
49
+ * assetId: asset.id,
50
+ * assetKey: asset.key,
51
+ * mimeType: file.type,
52
+ * },
53
+ * };
54
+ * },
55
+ * async resolve({ assetIds }) {
56
+ * const response = await fetch("/api/canvu/assets/resolve", {
57
+ * method: "POST",
58
+ * headers: { "content-type": "application/json" },
59
+ * body: JSON.stringify({ assetIds }),
60
+ * });
61
+ *
62
+ * return response.json();
63
+ * },
64
+ * };
65
+ * ```
66
+ */
67
+ type VectorViewportAssetUploadResult = {
68
+ /**
69
+ * Opaque persisted metadata attached to created items.
70
+ *
71
+ * Use this for asset ids, bucket keys, original file names, or any backend
72
+ * reference needed to rehydrate the binary later from your own persistence
73
+ * adapter.
74
+ */
75
+ pluginData?: VectorSceneItem["pluginData"];
76
+ };
77
+ /**
78
+ * Request to resolve persisted asset ids back into runtime URLs.
79
+ *
80
+ * This is useful inside custom persistence adapters when you want to rehydrate
81
+ * signed URLs or CDN URLs after loading a snapshot.
82
+ */
83
+ type VectorViewportAssetResolveRequest = {
84
+ assetIds: string[];
85
+ };
86
+ /**
87
+ * Runtime URL payload returned by a custom asset resolver.
88
+ */
89
+ type VectorViewportAssetResolveResult = Record<string, {
90
+ url: string;
91
+ thumbnailUrl?: string;
92
+ }>;
93
+ type VectorViewportAssetHydrationRequest = {
94
+ assetId: string;
95
+ kind: VectorViewportAssetKind;
96
+ pageNumber?: number;
97
+ scale?: number;
98
+ };
99
+ /**
100
+ * High-level hook for apps that want to persist raw binaries out-of-band while
101
+ * keeping canvu's built-in file UX.
102
+ *
103
+ * `upload` is used by the built-in file picker / drag-and-drop flow and by
104
+ * {@link ingestAssetFilesToSceneItems}. `resolve` is optional for custom
105
+ * persistence adapters and future hydration flows.
106
+ */
107
+ type VectorViewportAssetStore = {
108
+ upload: (request: VectorViewportAssetUploadRequest) => Promise<VectorViewportAssetUploadResult | undefined>;
109
+ resolve?: (request: VectorViewportAssetResolveRequest) => Promise<VectorViewportAssetResolveResult>;
110
+ getHydrationRequest?: (item: VectorSceneItem) => VectorViewportAssetHydrationRequest | null;
111
+ };
112
+
3
113
  /** Resolved stroke for SVG generation. */
4
114
  type StrokeStyle = {
5
115
  stroke: string;
@@ -90,4 +200,4 @@ declare function createImageFromVectorTrace(id: string, bounds: Rect, imageVecto
90
200
  height: number;
91
201
  }): VectorSceneItem;
92
202
 
93
- export { DEFAULT_STROKE_STYLE as D, type FreehandSvgPayload as F, type StrokeStyle as S, applyStrokeToItem as a, buildArrowSvg as b, buildDrawDotSvg as c, buildEllipseSvg as d, buildFreehandPathSvg as e, buildLineSvg as f, buildRectSvg as g, computeFreehandSvgPayload as h, createDrawDotItem as i, createEllipseItem as j, createFreehandStrokeItem as k, createImageFromVectorTrace as l, createImageItem as m, createLineItem as n, createRectangleItem as o, createShapeId as p, createTextItem as q, lineEndpointsToLocal as r, rebuildItemSvg as s, resolveStrokeStyle as t };
203
+ export { DEFAULT_STROKE_STYLE as D, type FreehandSvgPayload as F, type StrokeStyle as S, type VectorViewportAssetKind as V, applyStrokeToItem as a, buildArrowSvg as b, buildDrawDotSvg as c, buildEllipseSvg as d, buildFreehandPathSvg as e, buildLineSvg as f, buildRectSvg as g, computeFreehandSvgPayload as h, createDrawDotItem as i, createEllipseItem as j, createFreehandStrokeItem as k, createImageFromVectorTrace as l, createImageItem as m, createLineItem as n, createRectangleItem as o, createShapeId as p, createTextItem as q, lineEndpointsToLocal as r, rebuildItemSvg as s, resolveStrokeStyle as t, type VectorViewportAssetStore as u, type VectorViewportAssetHydrationRequest as v, type VectorViewportAssetResolveRequest as w, type VectorViewportAssetResolveResult as x, type VectorViewportAssetUploadRequest as y, type VectorViewportAssetUploadResult as z };
@@ -30,6 +30,7 @@ type VectorCanvasRemoteAdapter = {
30
30
  * Optional: called after local edits (debounced) so you can `ws.send(JSON.stringify(items))`.
31
31
  */
32
32
  send?: (items: VectorSceneItem[]) => void;
33
+ flush?: () => Promise<void>;
33
34
  };
34
35
 
35
36
  export type { VectorCanvasPersistenceAdapter as V, VectorCanvasRemoteAdapter as a, VectorCanvasSnapshot as b };
@@ -2,111 +2,8 @@ import * as react from 'react';
2
2
  import { CSSProperties, ReactNode, RefObject } from 'react';
3
3
  import { V as VectorSceneItem, R as Rect } from './types-CB0TZZuk.cjs';
4
4
  import { C as Camera2D } from './camera-BwQjm5oh.cjs';
5
+ import { S as StrokeStyle, u as VectorViewportAssetStore } from './shape-builders-DFudWDFI.cjs';
5
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
- import { S as StrokeStyle } from './shape-builders-DxPoOecg.cjs';
7
-
8
- /**
9
- * Kind of binary selected through the built-in canvu asset ingestion flow.
10
- *
11
- * Use this to branch your backend upload logic when images and PDFs should be
12
- * stored differently.
13
- */
14
- type VectorViewportAssetKind = "image" | "pdf";
15
- /**
16
- * Original browser `File` intercepted from the built-in asset flow.
17
- *
18
- * This is the high-level hook for apps that want canvu to keep its native file
19
- * UX while still uploading the raw binary to their backend or object storage.
20
- *
21
- * The same request shape is also reused by
22
- * {@link ingestAssetFilesToSceneItems}, so custom import flows and the native
23
- * viewport UX can share one backend contract.
24
- */
25
- type VectorViewportAssetUploadRequest = {
26
- /** Original browser file before canvu converts it into scene items. */
27
- file: File;
28
- /** High-level bucket for routing image vs PDF upload behavior. */
29
- kind: VectorViewportAssetKind;
30
- };
31
- /**
32
- * Persisted metadata returned by a custom asset upload.
33
- *
34
- * The returned `pluginData` is shallow-merged into every `VectorSceneItem`
35
- * created from the uploaded file, making it available to custom persistence
36
- * adapters and later hydration flows.
37
- *
38
- * @example
39
- * ```ts
40
- * const assetStore: VectorViewportAssetStore = {
41
- * async upload({ file, kind }) {
42
- * const form = new FormData();
43
- * form.append("file", file);
44
- * form.append("kind", kind);
45
- *
46
- * const response = await fetch("/api/canvu/assets", {
47
- * method: "POST",
48
- * body: form,
49
- * });
50
- *
51
- * const asset = await response.json();
52
- * return {
53
- * pluginData: {
54
- * assetId: asset.id,
55
- * assetKey: asset.key,
56
- * mimeType: file.type,
57
- * },
58
- * };
59
- * },
60
- * async resolve({ assetIds }) {
61
- * const response = await fetch("/api/canvu/assets/resolve", {
62
- * method: "POST",
63
- * headers: { "content-type": "application/json" },
64
- * body: JSON.stringify({ assetIds }),
65
- * });
66
- *
67
- * return response.json();
68
- * },
69
- * };
70
- * ```
71
- */
72
- type VectorViewportAssetUploadResult = {
73
- /**
74
- * Opaque persisted metadata attached to created items.
75
- *
76
- * Use this for asset ids, bucket keys, original file names, or any backend
77
- * reference needed to rehydrate the binary later from your own persistence
78
- * adapter.
79
- */
80
- pluginData?: VectorSceneItem["pluginData"];
81
- };
82
- /**
83
- * Request to resolve persisted asset ids back into runtime URLs.
84
- *
85
- * This is useful inside custom persistence adapters when you want to rehydrate
86
- * signed URLs or CDN URLs after loading a snapshot.
87
- */
88
- type VectorViewportAssetResolveRequest = {
89
- assetIds: string[];
90
- };
91
- /**
92
- * Runtime URL payload returned by a custom asset resolver.
93
- */
94
- type VectorViewportAssetResolveResult = Record<string, {
95
- url: string;
96
- thumbnailUrl?: string;
97
- }>;
98
- /**
99
- * High-level hook for apps that want to persist raw binaries out-of-band while
100
- * keeping canvu's built-in file UX.
101
- *
102
- * `upload` is used by the built-in file picker / drag-and-drop flow and by
103
- * {@link ingestAssetFilesToSceneItems}. `resolve` is optional for custom
104
- * persistence adapters and future hydration flows.
105
- */
106
- type VectorViewportAssetStore = {
107
- upload: (request: VectorViewportAssetUploadRequest) => Promise<VectorViewportAssetUploadResult | undefined>;
108
- resolve?: (request: VectorViewportAssetResolveRequest) => Promise<VectorViewportAssetResolveResult>;
109
- };
110
7
 
111
8
  type CanvuChromeActiveToolStyle = StrokeStyle & {
112
9
  toolKind: "draw" | "marker";
@@ -697,4 +594,4 @@ declare function useCanvuResolvedTools(): VectorToolDefinition[];
697
594
  */
698
595
  declare function useCanvuPluginContribution(pluginId: string, contribution: CanvasPluginContribution): void;
699
596
 
700
- export { type PresenceOverlayRenderContext as $, VectorSelectionInspector as A, type BoardComponentPosition as B, type CanvasPlugin as C, type VectorSelectionInspectorProps as D, VectorViewport as E, type VectorViewportAssetResolveRequest as F, type VectorViewportAssetResolveResult as G, type VectorViewportAssetUploadRequest as H, type VectorViewportAssetUploadResult as I, type VectorViewportHandle as J, type VectorViewportProps as K, createCanvuPlugin as L, getBoardPositionStyle as M, NavMenu as N, useCanvuChromeContext as O, type PlacementPreview as P, useCanvuDocumentContext as Q, useCanvuPluginContext as R, useCanvuPluginContribution as S, useCanvuResolvedTools as T, useCanvuViewportContext as U, type VectorViewportAssetKind as V, type WorldPointerDownDetail as W, type RemotePresenceMarkupStroke as X, type RemotePresencePeer as Y, type RemotePresenceCamera as Z, type RealtimeConnectionState as _, type VectorViewportAssetStore as a, type VectorToolDefinition 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 CustomShapePlacementOptions as n, type NavMenuProps as o, VectorCanvas as p, VectorCanvasBody as q, VectorCanvasHeader as r, VectorCanvasMain as s, VectorCanvasRoot as t, type VectorCanvasSlotProps as u, type VectorCanvasSpacePosition as v, type VectorCanvasSpaceProps as w, VectorCanvasToolbar as x, type VectorCanvasToolbarProps as y, VectorCanvasViewportSurface as z };
597
+ export { VectorViewport as A, type BoardComponentPosition as B, type CanvasPlugin as C, type VectorViewportHandle as D, type VectorViewportProps as E, createCanvuPlugin as F, getBoardPositionStyle as G, useCanvuChromeContext as H, useCanvuDocumentContext as I, useCanvuPluginContext as J, useCanvuPluginContribution as K, useCanvuResolvedTools as L, useCanvuViewportContext as M, NavMenu as N, type RemotePresencePeer as O, type PlacementPreview as P, type RemotePresenceCamera as Q, type RemotePresenceMarkupStroke as R, type RealtimeConnectionState as S, type PresenceOverlayRenderContext as T, type VectorToolDefinition as V, type WorldPointerDownDetail as W, type CanvasPluginComponentProps as a, type CanvasPluginContribution as b, type CanvasPluginItemsChangeMiddlewareContext as c, type CanvasPluginRenderContext as d, type CanvuChromeActiveToolStyle as e, CanvuChromeContext as f, type CanvuChromeContextValue as g, type CanvuChromeSelectionStyleChange as h, CanvuPluginContext as i, type CanvuPluginContextValue as j, type CanvuPluginViewportSnapshot as k, type CustomShapePlacementOptions as l, type NavMenuProps as m, VectorCanvas as n, VectorCanvasBody as o, VectorCanvasHeader as p, VectorCanvasMain as q, VectorCanvasRoot as r, type VectorCanvasSlotProps as s, type VectorCanvasSpacePosition as t, type VectorCanvasSpaceProps as u, VectorCanvasToolbar as v, type VectorCanvasToolbarProps as w, VectorCanvasViewportSurface as x, VectorSelectionInspector as y, type VectorSelectionInspectorProps as z };
@@ -30,6 +30,7 @@ type VectorCanvasRemoteAdapter = {
30
30
  * Optional: called after local edits (debounced) so you can `ws.send(JSON.stringify(items))`.
31
31
  */
32
32
  send?: (items: VectorSceneItem[]) => void;
33
+ flush?: () => Promise<void>;
33
34
  };
34
35
 
35
36
  export type { VectorCanvasPersistenceAdapter as V, VectorCanvasRemoteAdapter as a, VectorCanvasSnapshot as b };
@@ -2,111 +2,8 @@ import * as react from 'react';
2
2
  import { CSSProperties, ReactNode, RefObject } from 'react';
3
3
  import { V as VectorSceneItem, R as Rect } from './types-CB0TZZuk.js';
4
4
  import { C as Camera2D } from './camera-KwCYYPhm.js';
5
+ import { S as StrokeStyle, u as VectorViewportAssetStore } from './shape-builders-ENwnK-zT.js';
5
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
- import { S as StrokeStyle } from './shape-builders-DTYvub8W.js';
7
-
8
- /**
9
- * Kind of binary selected through the built-in canvu asset ingestion flow.
10
- *
11
- * Use this to branch your backend upload logic when images and PDFs should be
12
- * stored differently.
13
- */
14
- type VectorViewportAssetKind = "image" | "pdf";
15
- /**
16
- * Original browser `File` intercepted from the built-in asset flow.
17
- *
18
- * This is the high-level hook for apps that want canvu to keep its native file
19
- * UX while still uploading the raw binary to their backend or object storage.
20
- *
21
- * The same request shape is also reused by
22
- * {@link ingestAssetFilesToSceneItems}, so custom import flows and the native
23
- * viewport UX can share one backend contract.
24
- */
25
- type VectorViewportAssetUploadRequest = {
26
- /** Original browser file before canvu converts it into scene items. */
27
- file: File;
28
- /** High-level bucket for routing image vs PDF upload behavior. */
29
- kind: VectorViewportAssetKind;
30
- };
31
- /**
32
- * Persisted metadata returned by a custom asset upload.
33
- *
34
- * The returned `pluginData` is shallow-merged into every `VectorSceneItem`
35
- * created from the uploaded file, making it available to custom persistence
36
- * adapters and later hydration flows.
37
- *
38
- * @example
39
- * ```ts
40
- * const assetStore: VectorViewportAssetStore = {
41
- * async upload({ file, kind }) {
42
- * const form = new FormData();
43
- * form.append("file", file);
44
- * form.append("kind", kind);
45
- *
46
- * const response = await fetch("/api/canvu/assets", {
47
- * method: "POST",
48
- * body: form,
49
- * });
50
- *
51
- * const asset = await response.json();
52
- * return {
53
- * pluginData: {
54
- * assetId: asset.id,
55
- * assetKey: asset.key,
56
- * mimeType: file.type,
57
- * },
58
- * };
59
- * },
60
- * async resolve({ assetIds }) {
61
- * const response = await fetch("/api/canvu/assets/resolve", {
62
- * method: "POST",
63
- * headers: { "content-type": "application/json" },
64
- * body: JSON.stringify({ assetIds }),
65
- * });
66
- *
67
- * return response.json();
68
- * },
69
- * };
70
- * ```
71
- */
72
- type VectorViewportAssetUploadResult = {
73
- /**
74
- * Opaque persisted metadata attached to created items.
75
- *
76
- * Use this for asset ids, bucket keys, original file names, or any backend
77
- * reference needed to rehydrate the binary later from your own persistence
78
- * adapter.
79
- */
80
- pluginData?: VectorSceneItem["pluginData"];
81
- };
82
- /**
83
- * Request to resolve persisted asset ids back into runtime URLs.
84
- *
85
- * This is useful inside custom persistence adapters when you want to rehydrate
86
- * signed URLs or CDN URLs after loading a snapshot.
87
- */
88
- type VectorViewportAssetResolveRequest = {
89
- assetIds: string[];
90
- };
91
- /**
92
- * Runtime URL payload returned by a custom asset resolver.
93
- */
94
- type VectorViewportAssetResolveResult = Record<string, {
95
- url: string;
96
- thumbnailUrl?: string;
97
- }>;
98
- /**
99
- * High-level hook for apps that want to persist raw binaries out-of-band while
100
- * keeping canvu's built-in file UX.
101
- *
102
- * `upload` is used by the built-in file picker / drag-and-drop flow and by
103
- * {@link ingestAssetFilesToSceneItems}. `resolve` is optional for custom
104
- * persistence adapters and future hydration flows.
105
- */
106
- type VectorViewportAssetStore = {
107
- upload: (request: VectorViewportAssetUploadRequest) => Promise<VectorViewportAssetUploadResult | undefined>;
108
- resolve?: (request: VectorViewportAssetResolveRequest) => Promise<VectorViewportAssetResolveResult>;
109
- };
110
7
 
111
8
  type CanvuChromeActiveToolStyle = StrokeStyle & {
112
9
  toolKind: "draw" | "marker";
@@ -697,4 +594,4 @@ declare function useCanvuResolvedTools(): VectorToolDefinition[];
697
594
  */
698
595
  declare function useCanvuPluginContribution(pluginId: string, contribution: CanvasPluginContribution): void;
699
596
 
700
- export { type PresenceOverlayRenderContext as $, VectorSelectionInspector as A, type BoardComponentPosition as B, type CanvasPlugin as C, type VectorSelectionInspectorProps as D, VectorViewport as E, type VectorViewportAssetResolveRequest as F, type VectorViewportAssetResolveResult as G, type VectorViewportAssetUploadRequest as H, type VectorViewportAssetUploadResult as I, type VectorViewportHandle as J, type VectorViewportProps as K, createCanvuPlugin as L, getBoardPositionStyle as M, NavMenu as N, useCanvuChromeContext as O, type PlacementPreview as P, useCanvuDocumentContext as Q, useCanvuPluginContext as R, useCanvuPluginContribution as S, useCanvuResolvedTools as T, useCanvuViewportContext as U, type VectorViewportAssetKind as V, type WorldPointerDownDetail as W, type RemotePresenceMarkupStroke as X, type RemotePresencePeer as Y, type RemotePresenceCamera as Z, type RealtimeConnectionState as _, type VectorViewportAssetStore as a, type VectorToolDefinition 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 CustomShapePlacementOptions as n, type NavMenuProps as o, VectorCanvas as p, VectorCanvasBody as q, VectorCanvasHeader as r, VectorCanvasMain as s, VectorCanvasRoot as t, type VectorCanvasSlotProps as u, type VectorCanvasSpacePosition as v, type VectorCanvasSpaceProps as w, VectorCanvasToolbar as x, type VectorCanvasToolbarProps as y, VectorCanvasViewportSurface as z };
597
+ export { VectorViewport as A, type BoardComponentPosition as B, type CanvasPlugin as C, type VectorViewportHandle as D, type VectorViewportProps as E, createCanvuPlugin as F, getBoardPositionStyle as G, useCanvuChromeContext as H, useCanvuDocumentContext as I, useCanvuPluginContext as J, useCanvuPluginContribution as K, useCanvuResolvedTools as L, useCanvuViewportContext as M, NavMenu as N, type RemotePresencePeer as O, type PlacementPreview as P, type RemotePresenceCamera as Q, type RemotePresenceMarkupStroke as R, type RealtimeConnectionState as S, type PresenceOverlayRenderContext as T, type VectorToolDefinition as V, type WorldPointerDownDetail as W, type CanvasPluginComponentProps as a, type CanvasPluginContribution as b, type CanvasPluginItemsChangeMiddlewareContext as c, type CanvasPluginRenderContext as d, type CanvuChromeActiveToolStyle as e, CanvuChromeContext as f, type CanvuChromeContextValue as g, type CanvuChromeSelectionStyleChange as h, CanvuPluginContext as i, type CanvuPluginContextValue as j, type CanvuPluginViewportSnapshot as k, type CustomShapePlacementOptions as l, type NavMenuProps as m, VectorCanvas as n, VectorCanvasBody as o, VectorCanvasHeader as p, VectorCanvasMain as q, VectorCanvasRoot as r, type VectorCanvasSlotProps as s, type VectorCanvasSpacePosition as t, type VectorCanvasSpaceProps as u, VectorCanvasToolbar as v, type VectorCanvasToolbarProps as w, VectorCanvasViewportSurface as x, VectorSelectionInspector as y, type VectorSelectionInspectorProps as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvu-react",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "description": "Vector-first infinite canvas (SVG) with pan, zoom, React bindings, and optional plugins",
5
5
  "license": "MIT",
6
6
  "type": "module",