@bluepic/embed 0.4.0-next.103 → 0.4.0-next.104
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/bluepic-embed.iife.js +62 -62
- package/dist/bluepic-embed.umd.js +62 -62
- package/dist/components/AssetViewer/AssetViewer.vue.d.ts +57 -0
- package/dist/main.cjs +51 -51
- package/dist/main.d.ts +2 -0
- package/dist/main.mjs +5278 -5053
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import '@zoompinch/vue/style.css';
|
|
2
|
+
/**
|
|
3
|
+
* Brand Portal — the asset viewer.
|
|
4
|
+
*
|
|
5
|
+
* Renders inside the existing overlay API (usePopup / injectPortal), the same
|
|
6
|
+
* surface as the image cropper, rather than sending the visitor to a browser
|
|
7
|
+
* tab.
|
|
8
|
+
*
|
|
9
|
+
* Efficiency rules that are load-bearing, not polish:
|
|
10
|
+
* - page rendering is INJECTED by the host (`renderPage`) rather than importing
|
|
11
|
+
* @bluepic/raster here. Embed ships a UMD build, and raster's root entry
|
|
12
|
+
* carries CommonJS interop that Rollup cannot express in UMD (it emits an
|
|
13
|
+
* invalid `var main.commonjsGlobal`). Injection also keeps the heavy engines
|
|
14
|
+
* out of embed entirely — the host loads them only if it has documents.
|
|
15
|
+
* Without a `renderPage`, paged types degrade to the download-only panel;
|
|
16
|
+
* - one page is rendered at a time, at a DPR clamped to 2;
|
|
17
|
+
* - at most PAGE_CACHE_LIMIT rendered pages are retained, so a 400-page PDF
|
|
18
|
+
* cannot hold 400 canvases;
|
|
19
|
+
* - in-flight work is abandoned on close/page-change — an orphaned
|
|
20
|
+
* Ghostscript-WASM job otherwise keeps a phone warm long after the user left.
|
|
21
|
+
*/
|
|
22
|
+
export type ViewerAsset = {
|
|
23
|
+
id: string;
|
|
24
|
+
title: string;
|
|
25
|
+
filename: string;
|
|
26
|
+
mime: string;
|
|
27
|
+
size: number;
|
|
28
|
+
kind: 'image' | 'file';
|
|
29
|
+
previewUrl: string | null;
|
|
30
|
+
description?: string | null;
|
|
31
|
+
width?: number;
|
|
32
|
+
height?: number;
|
|
33
|
+
pageCount?: number;
|
|
34
|
+
/** Gated URL. Used both to fetch bytes for rasterization and to display media. */
|
|
35
|
+
downloadUrl: string;
|
|
36
|
+
};
|
|
37
|
+
type __VLS_Props = {
|
|
38
|
+
asset: ViewerAsset;
|
|
39
|
+
/**
|
|
40
|
+
* Render one page of a document into the supplied canvas. Supplied by the
|
|
41
|
+
* host (bx-template passes @bluepic/raster). Absent → no paged preview.
|
|
42
|
+
*/
|
|
43
|
+
renderPage?: (bytes: ArrayBuffer, canvas: HTMLCanvasElement, opts: {
|
|
44
|
+
page: number;
|
|
45
|
+
dpi: number;
|
|
46
|
+
}) => Promise<void>;
|
|
47
|
+
/** Page count for a paged document, when the host can determine it. */
|
|
48
|
+
getPageCount?: (bytes: ArrayBuffer) => Promise<number>;
|
|
49
|
+
};
|
|
50
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
51
|
+
close: () => any;
|
|
52
|
+
download: (asset: ViewerAsset) => any;
|
|
53
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
54
|
+
onClose?: (() => any) | undefined;
|
|
55
|
+
onDownload?: ((asset: ViewerAsset) => any) | undefined;
|
|
56
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
57
|
+
export default _default;
|