canvu-react 0.4.67 → 0.4.69
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-F6aM5C7x.d.cts → asset-hydration-D2xaUoAT.d.cts} +1 -1
- package/dist/{asset-hydration-BSjiek7Q.d.ts → asset-hydration-D9eThWse.d.ts} +1 -1
- package/dist/chatbot.d.cts +2 -2
- package/dist/chatbot.d.ts +2 -2
- package/dist/index.cjs +501 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +501 -0
- package/dist/index.js.map +1 -1
- package/dist/raster-image-canvas-CCOmB4NY.d.ts +219 -0
- package/dist/raster-image-canvas-nK9kM9UJ.d.cts +219 -0
- package/dist/react.cjs +510 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +6 -6
- package/dist/react.d.ts +6 -6
- package/dist/react.js +510 -1
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js.map +1 -1
- package/dist/{types-B-Jdh-n6.d.ts → types-CMuEaiM7.d.ts} +12 -1
- package/dist/{types-D5d-3dvz.d.cts → types-D402X18k.d.cts} +12 -1
- package/package.json +1 -1
- package/dist/asset-store-35ysK28r.d.cts +0 -113
- package/dist/asset-store-D_FjW_CN.d.ts +0 -113
|
@@ -2,8 +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-fJNwEnHf.js';
|
|
4
4
|
import { S as StrokeStyle, C as Camera2D } from './shape-builders-xG3A66sv.js';
|
|
5
|
+
import { a as VectorViewportAssetStore, R as RasterImageCanvasRenderingOptions } from './raster-image-canvas-CCOmB4NY.js';
|
|
5
6
|
import { C as CanvuLinkData } from './link-item-COoNNvCu.js';
|
|
6
|
-
import { a as VectorViewportAssetStore } from './asset-store-D_FjW_CN.js';
|
|
7
7
|
import { R as RemotePresencePeer, P as PresenceOverlayRenderContext } from './types-BXa2CIrc.js';
|
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
9
|
|
|
@@ -704,6 +704,17 @@ type VectorViewportProps = {
|
|
|
704
704
|
* canvu's native file tool.
|
|
705
705
|
*/
|
|
706
706
|
assetStore?: VectorViewportAssetStore;
|
|
707
|
+
/**
|
|
708
|
+
* Optional canvas-backed raster rendering for image items.
|
|
709
|
+
*
|
|
710
|
+
* Use this for large PDF/page images where the item SVG should stay stable while
|
|
711
|
+
* the viewport progressively redraws a sharper bitmap as users zoom in. The
|
|
712
|
+
* original SVG `<image>` remains as the fallback while the canvas target loads.
|
|
713
|
+
*
|
|
714
|
+
* Provide `resolveRenderTarget` when your app has a resize/proxy image endpoint;
|
|
715
|
+
* it receives the target pixel size and can return the URL that best matches it.
|
|
716
|
+
*/
|
|
717
|
+
imageCanvasRendering?: RasterImageCanvasRenderingOptions | null;
|
|
707
718
|
/**
|
|
708
719
|
* When false (default), finishing a draw/place/erase gesture requests switching back to `autoResetToolTo`.
|
|
709
720
|
* Use with controlled tool state (`onToolChangeRequest`) to keep "select-after-use" behavior.
|
|
@@ -2,8 +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-fJNwEnHf.cjs';
|
|
4
4
|
import { S as StrokeStyle, C as Camera2D } from './shape-builders-DzhCOuzo.cjs';
|
|
5
|
+
import { a as VectorViewportAssetStore, R as RasterImageCanvasRenderingOptions } from './raster-image-canvas-nK9kM9UJ.cjs';
|
|
5
6
|
import { C as CanvuLinkData } from './link-item-BMV3VUCr.cjs';
|
|
6
|
-
import { a as VectorViewportAssetStore } from './asset-store-35ysK28r.cjs';
|
|
7
7
|
import { R as RemotePresencePeer, P as PresenceOverlayRenderContext } from './types-DqsqQQVf.cjs';
|
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
9
|
|
|
@@ -704,6 +704,17 @@ type VectorViewportProps = {
|
|
|
704
704
|
* canvu's native file tool.
|
|
705
705
|
*/
|
|
706
706
|
assetStore?: VectorViewportAssetStore;
|
|
707
|
+
/**
|
|
708
|
+
* Optional canvas-backed raster rendering for image items.
|
|
709
|
+
*
|
|
710
|
+
* Use this for large PDF/page images where the item SVG should stay stable while
|
|
711
|
+
* the viewport progressively redraws a sharper bitmap as users zoom in. The
|
|
712
|
+
* original SVG `<image>` remains as the fallback while the canvas target loads.
|
|
713
|
+
*
|
|
714
|
+
* Provide `resolveRenderTarget` when your app has a resize/proxy image endpoint;
|
|
715
|
+
* it receives the target pixel size and can return the URL that best matches it.
|
|
716
|
+
*/
|
|
717
|
+
imageCanvasRendering?: RasterImageCanvasRenderingOptions | null;
|
|
707
718
|
/**
|
|
708
719
|
* When false (default), finishing a draw/place/erase gesture requests switching back to `autoResetToolTo`.
|
|
709
720
|
* Use with controlled tool state (`onToolChangeRequest`) to keep "select-after-use" behavior.
|
package/package.json
CHANGED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { V as VectorSceneItem } from './types-fJNwEnHf.cjs';
|
|
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
|
-
|
|
113
|
-
export type { VectorViewportAssetKind as V, VectorViewportAssetStore as a, VectorViewportAssetHydrationRequest as b, VectorViewportAssetResolveRequest as c, VectorViewportAssetResolveResult as d, VectorViewportAssetUploadRequest as e, VectorViewportAssetUploadResult as f };
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { V as VectorSceneItem } from './types-fJNwEnHf.js';
|
|
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
|
-
|
|
113
|
-
export type { VectorViewportAssetKind as V, VectorViewportAssetStore as a, VectorViewportAssetHydrationRequest as b, VectorViewportAssetResolveRequest as c, VectorViewportAssetResolveResult as d, VectorViewportAssetUploadRequest as e, VectorViewportAssetUploadResult as f };
|