@vue-pdf-viewer/viewer 0.0.0-experimental.91 → 0.0.0-experimental.92
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/README.md +6 -2
- package/dist/{VPdfViewer.vue_vue_type_style_index_1_scoped_fca1b787_lang-B3V3Kgnk.cjs → VPdfViewer.vue_vue_type_style_index_1_scoped_fca1b787_lang-BScYhDOi.cjs} +3 -3
- package/dist/{VPdfViewer.vue_vue_type_style_index_1_scoped_fca1b787_lang-PS4FexSD.js → VPdfViewer.vue_vue_type_style_index_1_scoped_fca1b787_lang-wcaN6GfP.js} +3 -3
- package/dist/{index-EKyHEWmQ.cjs → index-CzHTo4cp.cjs} +1 -1
- package/dist/{index-DFHruE2P.js → index-rgeR2HXX.js} +1 -1
- package/dist/index.cjs +19 -19
- package/dist/index.js +14204 -14148
- package/dist/license.cjs +1 -1
- package/dist/license.js +1 -1
- package/dist/types/composables/usePdf.d.ts +1 -0
- package/dist/types/utils/boundedConcurrency.d.ts +15 -0
- package/dist/types/utils/types.d.ts +5 -2
- package/dist/types/utils/workerUrl.d.ts +21 -0
- package/package.json +7 -5
- /package/dist/{lib/assets → assets}/pdf-legacy/pdf.worker.min.mjs +0 -0
- /package/dist/{lib/assets → assets}/pdf.worker.min.mjs +0 -0
package/dist/license.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./VPdfViewer.vue_vue_type_style_index_1_scoped_fca1b787_lang-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./VPdfViewer.vue_vue_type_style_index_1_scoped_fca1b787_lang-BScYhDOi.cjs");exports.LicenseProduct=e.P;exports.LicenseType=e.Q;exports.useLicense=e.b3;
|
package/dist/license.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as c, Q as a, b3 as i } from "./VPdfViewer.vue_vue_type_style_index_1_scoped_fca1b787_lang-
|
|
1
|
+
import { P as c, Q as a, b3 as i } from "./VPdfViewer.vue_vue_type_style_index_1_scoped_fca1b787_lang-wcaN6GfP.js";
|
|
2
2
|
export {
|
|
3
3
|
c as LicenseProduct,
|
|
4
4
|
a as LicenseType,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MaybeRef } from 'vue';
|
|
2
2
|
import { type PDFOptions, type PDFSrc, type PDFDocumentOptions } from '../utils/types';
|
|
3
3
|
import { type PDFDocumentProxy, type PDFPageProxy } from 'pdfjs-dist/types/src/display/api';
|
|
4
|
+
export declare function configWorker(workerSrc?: string, legacy?: boolean): void;
|
|
4
5
|
declare function usePdf(src: MaybeRef<PDFSrc>, options?: PDFOptions, workerUrl?: string, documentOptions?: PDFDocumentOptions, wasmUrl?: string): {
|
|
5
6
|
pdfDocLoadingTask: import("vue").ShallowRef<import("pdfjs-dist/types/src/display/api").PDFDocumentLoadingTask | undefined, import("pdfjs-dist/types/src/display/api").PDFDocumentLoadingTask | undefined>;
|
|
6
7
|
getPage: (doc: PDFDocumentProxy, pageIndex: number) => Promise<PDFPageProxy>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `task` over `items` with at most `limit` tasks in flight, starting them in item order.
|
|
3
|
+
*
|
|
4
|
+
* Exists for background work against the pdf.js worker. pdf.js answers requests in the order
|
|
5
|
+
* they arrive and caches page promises, so a request issued early cannot be overtaken later.
|
|
6
|
+
* Issuing a whole document's worth at once therefore puts anything the reader asks for next —
|
|
7
|
+
* the page they navigated to, the page being rendered — behind all of it. Keeping only a few
|
|
8
|
+
* in flight bounds that wait to `limit` requests.
|
|
9
|
+
*
|
|
10
|
+
* Results come back in item order. A task that rejects rejects the whole run, like
|
|
11
|
+
* `Promise.all`, and no further tasks start — otherwise the remaining lanes would keep the
|
|
12
|
+
* worker busy with results nobody reads. Once `shouldStop` returns true no further tasks
|
|
13
|
+
* start either; the ones already running finish, and the skipped slots are left `undefined`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function mapWithConcurrency<T, R>(items: readonly T[], limit: number, task: (item: T, index: number) => Promise<R>, shouldStop?: () => boolean): Promise<Array<R | undefined>>;
|
|
@@ -389,8 +389,11 @@ export interface TextHighlight {
|
|
|
389
389
|
export interface VPdfViewerProps {
|
|
390
390
|
src: MaybeRef<VPVSrc>;
|
|
391
391
|
/**
|
|
392
|
-
* The
|
|
393
|
-
* If unspecified, the viewer
|
|
392
|
+
* The URL of the PDF.js worker.
|
|
393
|
+
* If unspecified, the viewer uses the worker shipped in `@vue-pdf-viewer/viewer/assets/`
|
|
394
|
+
* (same version as the bundled `pdfjs-dist`), loaded as a real file so a CSP of
|
|
395
|
+
* `script-src 'self'` is sufficient. Setting this disables the automatic legacy-worker
|
|
396
|
+
* fallback for browsers without `Promise.withResolvers`.
|
|
394
397
|
*/
|
|
395
398
|
workerUrl?: string;
|
|
396
399
|
/**
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure resolution of the PDF.js worker URL. No DOM, no PDF.js, no Vue — see
|
|
3
|
+
* specs/004-csp-safe-pdf-worker/contracts/worker-url-resolution.md.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkerUrlInputs {
|
|
6
|
+
/** `workerUrl` prop. An empty string counts as absent. */
|
|
7
|
+
explicitUrl?: string;
|
|
8
|
+
/** `VPV:pdfLegacyWorker` session flag. */
|
|
9
|
+
legacy: boolean;
|
|
10
|
+
/** Default export of `virtual:vpv-pdf-worker-url`. */
|
|
11
|
+
bundledUrl: string;
|
|
12
|
+
/** Default export of `virtual:vpv-pdf-worker-legacy-url`. */
|
|
13
|
+
bundledLegacyUrl: string;
|
|
14
|
+
}
|
|
15
|
+
export interface WorkerUrlResult {
|
|
16
|
+
url: string;
|
|
17
|
+
/** True when the Vite/Nuxt dependency pre-bundle rewrite was applied. */
|
|
18
|
+
rewritten: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function rewritePrebundledUrl(url: string): string;
|
|
21
|
+
export declare function resolveWorkerUrl(inputs: WorkerUrlInputs): WorkerUrlResult;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-pdf-viewer/viewer",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.0-experimental.
|
|
4
|
+
"version": "0.0.0-experimental.92",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"require": "./dist/license.cjs",
|
|
44
44
|
"types": "./dist/types/license.d.ts"
|
|
45
45
|
},
|
|
46
|
-
"./assets": "./dist/assets"
|
|
46
|
+
"./assets": "./dist/assets",
|
|
47
|
+
"./assets/*": "./dist/assets/*"
|
|
47
48
|
},
|
|
48
49
|
"style": "./dist/style/index.css",
|
|
49
50
|
"types": "./dist/types/index.d.ts",
|
|
@@ -57,10 +58,12 @@
|
|
|
57
58
|
"format": "prettier --write .",
|
|
58
59
|
"prebuild": "vitest run",
|
|
59
60
|
"postbuild": "vue-tsc --declaration --emitDeclarationOnly -p tsconfig.build.json",
|
|
60
|
-
"build": "vite build",
|
|
61
|
+
"build": "vite build && bun run verify:dist",
|
|
62
|
+
"verify:dist": "node scripts/verify-dist.mjs",
|
|
63
|
+
"typecheck:build": "tsc --noEmit -p tsconfig.node.json",
|
|
61
64
|
"preview": "vite preview",
|
|
62
65
|
"test": "vitest",
|
|
63
|
-
"prepublishOnly": "bun run vite build && bun run postbuild",
|
|
66
|
+
"prepublishOnly": "bun run vite build && bun run verify:dist && bun run postbuild",
|
|
64
67
|
"shadcn:add": "bunx shadcn-vue@latest add",
|
|
65
68
|
"prepare": "husky"
|
|
66
69
|
},
|
|
@@ -115,7 +118,6 @@
|
|
|
115
118
|
"unocss-preset-shadcn": "^0.3.1",
|
|
116
119
|
"vite": "^5.2.8",
|
|
117
120
|
"vite-plugin-node-polyfills": "^0.21.0",
|
|
118
|
-
"vite-plugin-static-copy": "^3.1.2",
|
|
119
121
|
"vite-svg-loader": "^5.1.0",
|
|
120
122
|
"vitest": "^3.2.4",
|
|
121
123
|
"vitest-browser-vue": "^1.1.0",
|
|
File without changes
|
|
File without changes
|