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
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { V as VectorSceneItem, R as Rect } 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
|
+
/**
|
|
114
|
+
* Input passed to `imageCanvasRendering.resolveSourceSize`.
|
|
115
|
+
*
|
|
116
|
+
* Use it when the item's current `imageIntrinsicSize` is only a preview size,
|
|
117
|
+
* but your backing image service can provide a larger source for zoomed canvas
|
|
118
|
+
* rendering. Return the effective source size Canvu should cap against before
|
|
119
|
+
* computing the next bitmap target.
|
|
120
|
+
*/
|
|
121
|
+
type RasterImageCanvasSourceSizeRequest = {
|
|
122
|
+
item: VectorSceneItem;
|
|
123
|
+
href: string;
|
|
124
|
+
intrinsicSize: {
|
|
125
|
+
width: number;
|
|
126
|
+
height: number;
|
|
127
|
+
};
|
|
128
|
+
contentRect: Rect;
|
|
129
|
+
viewportSize: {
|
|
130
|
+
width: number;
|
|
131
|
+
height: number;
|
|
132
|
+
};
|
|
133
|
+
cameraZoom: number;
|
|
134
|
+
devicePixelRatio: number;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Maps an image item to the effective source size used for zoom-aware bitmap
|
|
138
|
+
* sizing.
|
|
139
|
+
*
|
|
140
|
+
* Return `null`/`undefined` to use the item's `imageIntrinsicSize`.
|
|
141
|
+
*/
|
|
142
|
+
type RasterImageCanvasSourceSizeResolver = (request: RasterImageCanvasSourceSizeRequest) => {
|
|
143
|
+
width: number;
|
|
144
|
+
height: number;
|
|
145
|
+
} | null | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* Input passed to `imageCanvasRendering.resolveRenderTarget`.
|
|
148
|
+
*
|
|
149
|
+
* Use it to map the current image item and zoom-derived bitmap size to the best
|
|
150
|
+
* available resized URL from your image service. Apps that do not provide a
|
|
151
|
+
* resolver still get canvas drawing from the original `imageRasterHref`.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```ts
|
|
155
|
+
* const resolveRenderTarget = ({ href, targetSize }) =>
|
|
156
|
+
* `${href}&w=${targetSize.width}`;
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
type RasterImageCanvasRenderRequest = {
|
|
160
|
+
item: VectorSceneItem;
|
|
161
|
+
href: string;
|
|
162
|
+
intrinsicSize: {
|
|
163
|
+
width: number;
|
|
164
|
+
height: number;
|
|
165
|
+
};
|
|
166
|
+
sourceSize: {
|
|
167
|
+
width: number;
|
|
168
|
+
height: number;
|
|
169
|
+
};
|
|
170
|
+
contentRect: Rect;
|
|
171
|
+
targetSize: {
|
|
172
|
+
width: number;
|
|
173
|
+
height: number;
|
|
174
|
+
};
|
|
175
|
+
viewportSize: {
|
|
176
|
+
width: number;
|
|
177
|
+
height: number;
|
|
178
|
+
};
|
|
179
|
+
cameraZoom: number;
|
|
180
|
+
devicePixelRatio: number;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Resolved raster source for a zoom-aware canvas redraw.
|
|
184
|
+
*
|
|
185
|
+
* Return a stable `sourceKey` when multiple URLs may represent the same bitmap
|
|
186
|
+
* quality tier. Canvu uses it to avoid redundant redraws and to keep the
|
|
187
|
+
* previous canvas visible until a sharper target has decoded.
|
|
188
|
+
*/
|
|
189
|
+
type RasterImageCanvasRenderTarget = {
|
|
190
|
+
href: string;
|
|
191
|
+
sourceKey?: string;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Maps an image item plus requested bitmap size to the URL that should be
|
|
195
|
+
* decoded into the canvas overlay.
|
|
196
|
+
*
|
|
197
|
+
* Return a string for simple URL rewriting, an object when you need a custom
|
|
198
|
+
* `sourceKey`, or `null`/`undefined` to keep using the item's `imageRasterHref`.
|
|
199
|
+
*/
|
|
200
|
+
type RasterImageCanvasRenderTargetResolver = (request: RasterImageCanvasRenderRequest) => string | RasterImageCanvasRenderTarget | null | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* Enables zoom-aware canvas rendering for image items in `VectorViewport`.
|
|
203
|
+
*
|
|
204
|
+
* This is intended for large raster pages such as PDFs. The original SVG image
|
|
205
|
+
* remains mounted as a fallback, while Canvu decodes and draws a canvas bitmap
|
|
206
|
+
* sized for the current zoom. On zoom out, Canvu keeps the sharper bitmap
|
|
207
|
+
* already drawn instead of downgrading immediately.
|
|
208
|
+
*/
|
|
209
|
+
type RasterImageCanvasRenderingOptions = {
|
|
210
|
+
resolveSourceSize?: RasterImageCanvasSourceSizeResolver;
|
|
211
|
+
resolveRenderTarget?: RasterImageCanvasRenderTargetResolver;
|
|
212
|
+
devicePixelRatio?: number;
|
|
213
|
+
pixelHeadroom?: number;
|
|
214
|
+
maxPixelCount?: number;
|
|
215
|
+
maxDimension?: number;
|
|
216
|
+
upscaleRedrawRatio?: number;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export type { RasterImageCanvasRenderingOptions as R, VectorViewportAssetKind as V, VectorViewportAssetStore as a, RasterImageCanvasRenderRequest as b, RasterImageCanvasRenderTarget as c, RasterImageCanvasRenderTargetResolver as d, RasterImageCanvasSourceSizeRequest as e, RasterImageCanvasSourceSizeResolver as f, VectorViewportAssetHydrationRequest as g, VectorViewportAssetResolveRequest as h, VectorViewportAssetResolveResult as i, VectorViewportAssetUploadRequest as j, VectorViewportAssetUploadResult as k };
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { V as VectorSceneItem, R as Rect } 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
|
+
/**
|
|
114
|
+
* Input passed to `imageCanvasRendering.resolveSourceSize`.
|
|
115
|
+
*
|
|
116
|
+
* Use it when the item's current `imageIntrinsicSize` is only a preview size,
|
|
117
|
+
* but your backing image service can provide a larger source for zoomed canvas
|
|
118
|
+
* rendering. Return the effective source size Canvu should cap against before
|
|
119
|
+
* computing the next bitmap target.
|
|
120
|
+
*/
|
|
121
|
+
type RasterImageCanvasSourceSizeRequest = {
|
|
122
|
+
item: VectorSceneItem;
|
|
123
|
+
href: string;
|
|
124
|
+
intrinsicSize: {
|
|
125
|
+
width: number;
|
|
126
|
+
height: number;
|
|
127
|
+
};
|
|
128
|
+
contentRect: Rect;
|
|
129
|
+
viewportSize: {
|
|
130
|
+
width: number;
|
|
131
|
+
height: number;
|
|
132
|
+
};
|
|
133
|
+
cameraZoom: number;
|
|
134
|
+
devicePixelRatio: number;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Maps an image item to the effective source size used for zoom-aware bitmap
|
|
138
|
+
* sizing.
|
|
139
|
+
*
|
|
140
|
+
* Return `null`/`undefined` to use the item's `imageIntrinsicSize`.
|
|
141
|
+
*/
|
|
142
|
+
type RasterImageCanvasSourceSizeResolver = (request: RasterImageCanvasSourceSizeRequest) => {
|
|
143
|
+
width: number;
|
|
144
|
+
height: number;
|
|
145
|
+
} | null | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* Input passed to `imageCanvasRendering.resolveRenderTarget`.
|
|
148
|
+
*
|
|
149
|
+
* Use it to map the current image item and zoom-derived bitmap size to the best
|
|
150
|
+
* available resized URL from your image service. Apps that do not provide a
|
|
151
|
+
* resolver still get canvas drawing from the original `imageRasterHref`.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```ts
|
|
155
|
+
* const resolveRenderTarget = ({ href, targetSize }) =>
|
|
156
|
+
* `${href}&w=${targetSize.width}`;
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
type RasterImageCanvasRenderRequest = {
|
|
160
|
+
item: VectorSceneItem;
|
|
161
|
+
href: string;
|
|
162
|
+
intrinsicSize: {
|
|
163
|
+
width: number;
|
|
164
|
+
height: number;
|
|
165
|
+
};
|
|
166
|
+
sourceSize: {
|
|
167
|
+
width: number;
|
|
168
|
+
height: number;
|
|
169
|
+
};
|
|
170
|
+
contentRect: Rect;
|
|
171
|
+
targetSize: {
|
|
172
|
+
width: number;
|
|
173
|
+
height: number;
|
|
174
|
+
};
|
|
175
|
+
viewportSize: {
|
|
176
|
+
width: number;
|
|
177
|
+
height: number;
|
|
178
|
+
};
|
|
179
|
+
cameraZoom: number;
|
|
180
|
+
devicePixelRatio: number;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Resolved raster source for a zoom-aware canvas redraw.
|
|
184
|
+
*
|
|
185
|
+
* Return a stable `sourceKey` when multiple URLs may represent the same bitmap
|
|
186
|
+
* quality tier. Canvu uses it to avoid redundant redraws and to keep the
|
|
187
|
+
* previous canvas visible until a sharper target has decoded.
|
|
188
|
+
*/
|
|
189
|
+
type RasterImageCanvasRenderTarget = {
|
|
190
|
+
href: string;
|
|
191
|
+
sourceKey?: string;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Maps an image item plus requested bitmap size to the URL that should be
|
|
195
|
+
* decoded into the canvas overlay.
|
|
196
|
+
*
|
|
197
|
+
* Return a string for simple URL rewriting, an object when you need a custom
|
|
198
|
+
* `sourceKey`, or `null`/`undefined` to keep using the item's `imageRasterHref`.
|
|
199
|
+
*/
|
|
200
|
+
type RasterImageCanvasRenderTargetResolver = (request: RasterImageCanvasRenderRequest) => string | RasterImageCanvasRenderTarget | null | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* Enables zoom-aware canvas rendering for image items in `VectorViewport`.
|
|
203
|
+
*
|
|
204
|
+
* This is intended for large raster pages such as PDFs. The original SVG image
|
|
205
|
+
* remains mounted as a fallback, while Canvu decodes and draws a canvas bitmap
|
|
206
|
+
* sized for the current zoom. On zoom out, Canvu keeps the sharper bitmap
|
|
207
|
+
* already drawn instead of downgrading immediately.
|
|
208
|
+
*/
|
|
209
|
+
type RasterImageCanvasRenderingOptions = {
|
|
210
|
+
resolveSourceSize?: RasterImageCanvasSourceSizeResolver;
|
|
211
|
+
resolveRenderTarget?: RasterImageCanvasRenderTargetResolver;
|
|
212
|
+
devicePixelRatio?: number;
|
|
213
|
+
pixelHeadroom?: number;
|
|
214
|
+
maxPixelCount?: number;
|
|
215
|
+
maxDimension?: number;
|
|
216
|
+
upscaleRedrawRatio?: number;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export type { RasterImageCanvasRenderingOptions as R, VectorViewportAssetKind as V, VectorViewportAssetStore as a, RasterImageCanvasRenderRequest as b, RasterImageCanvasRenderTarget as c, RasterImageCanvasRenderTargetResolver as d, RasterImageCanvasSourceSizeRequest as e, RasterImageCanvasSourceSizeResolver as f, VectorViewportAssetHydrationRequest as g, VectorViewportAssetResolveRequest as h, VectorViewportAssetResolveResult as i, VectorViewportAssetUploadRequest as j, VectorViewportAssetUploadResult as k };
|