genus-pdf-viewer 0.2.10 → 0.2.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.
package/README.md CHANGED
@@ -108,13 +108,31 @@ The viewer emits bubbling custom events:
108
108
  ## Package Exports
109
109
 
110
110
  - `genus-pdf-viewer`: main TypeScript and custom-element API
111
- - `genus-pdf-viewer/pdf.worker.bootstrap.mjs`: bootstrap worker asset for host app copying
112
- - `genus-pdf-viewer/pdf.worker.min.mjs`: worker asset if you need to host it yourself
111
+ - `genus-pdf-viewer/pdf.worker.bootstrap.mjs`: optional bootstrap worker asset for strict CSP deployments
112
+ - `genus-pdf-viewer/pdf.worker.min.mjs`: optional worker asset if you need to host it yourself
113
113
  - `genus-pdf-viewer/styles.css`: packaged stylesheet export
114
114
 
115
115
  ## Angular / Vite Setup
116
116
 
117
- If your Angular app bundles dependencies, copy the package worker assets into the app assets folder so the default worker URL can be served from `assets/pdf.worker.bootstrap.mjs`.
117
+ The default setup is npm-install-only. The viewer creates a self-contained Blob worker URL for pdf.js, so Angular, Vite, Amplify, and other static hosts do not need to copy `pdf.worker*.mjs` into `/assets`.
118
+
119
+ ```ts
120
+ import { createGenusPdfViewer } from "genus-pdf-viewer";
121
+
122
+ const host = document.getElementById("pdf-root");
123
+
124
+ if (host) {
125
+ createGenusPdfViewer(host, {
126
+ src: pdfUrl,
127
+ fit: "width",
128
+ continuous: true,
129
+ showToolbar: true,
130
+ zoomStep: 0.15,
131
+ });
132
+ }
133
+ ```
134
+
135
+ If your app has a strict Content Security Policy that blocks `blob:` workers, copy the package worker assets into your app assets folder and pass `workerSrc` explicitly.
118
136
 
119
137
  ```json
120
138
  {
@@ -124,10 +142,8 @@ If your Angular app bundles dependencies, copy the package worker assets into th
124
142
  }
125
143
  ```
126
144
 
127
- Override `workerSrc` only when your app needs a different asset location.
128
-
129
145
  ```ts
130
- import { createGenusPdfViewer, resolveDefaultPdfWorkerSrc } from "genus-pdf-viewer";
146
+ import { createGenusPdfViewer } from "genus-pdf-viewer";
131
147
 
132
148
  const host = document.getElementById("pdf-root");
133
149
 
@@ -138,7 +154,7 @@ if (host) {
138
154
  continuous: true,
139
155
  showToolbar: true,
140
156
  zoomStep: 0.15,
141
- workerSrc: resolveDefaultPdfWorkerSrc(),
157
+ workerSrc: "/assets/pdf.worker.bootstrap.mjs",
142
158
  });
143
159
  }
144
160
  ```
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { createGenusPdfViewer, defineGenusPdfViewerElement, GenusPdfViewerElement, PDF_WORKER_BOOTSTRAP_ASSET_PATH, resolveDefaultPdfWorkerSrc, } from "./viewer.js";
1
+ export { createGenusPdfViewer, defineGenusPdfViewerElement, GenusPdfViewerElement, PDF_WORKER_BOOTSTRAP_ASSET_PATH, releaseDefaultPdfWorkerSrc, resolveDefaultPdfWorkerSrc, } from "./viewer.js";
2
2
  export type { ResolveDefaultPdfWorkerSrcOptions } from "./viewer.js";
3
3
  export type { GenusPdfViewerConfig, GenusPdfViewerErrorEventDetail, GenusPdfViewerEventMap, GenusPdfViewerFit, GenusPdfViewerPageChangeEventDetail, GenusPdfViewerReadyEventDetail, GenusPdfViewerSource, GenusPdfViewerZoomChangeEventDetail, } from "./types.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EACrB,+BAA+B,EAC/B,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAErE,YAAY,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,sBAAsB,EACtB,iBAAiB,EACjB,mCAAmC,EACnC,8BAA8B,EAC9B,oBAAoB,EACpB,mCAAmC,GACpC,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EACrB,+BAA+B,EAC/B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAErE,YAAY,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,sBAAsB,EACtB,iBAAiB,EACjB,mCAAmC,EACnC,8BAA8B,EAC9B,oBAAoB,EACpB,mCAAmC,GACpC,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { createGenusPdfViewer, defineGenusPdfViewerElement, GenusPdfViewerElement, PDF_WORKER_BOOTSTRAP_ASSET_PATH, resolveDefaultPdfWorkerSrc, } from "./viewer.js";
1
+ export { createGenusPdfViewer, defineGenusPdfViewerElement, GenusPdfViewerElement, PDF_WORKER_BOOTSTRAP_ASSET_PATH, releaseDefaultPdfWorkerSrc, resolveDefaultPdfWorkerSrc, } from "./viewer.js";
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EACrB,+BAA+B,EAC/B,0BAA0B,GAC3B,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EACrB,+BAA+B,EAC/B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const PDF_WORKER_SOURCE: string;
2
+ //# sourceMappingURL=pdf-worker-source.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-worker-source.generated.d.ts","sourceRoot":"","sources":["../src/pdf-worker-source.generated.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,EAAE,MAAko8wC,CAAC"}