pdfjs-viewer-element 2.6.5 → 2.7.1
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 +47 -19
- package/dist/pdfjs-viewer-element.js +93 -126
- package/package.json +15 -10
- package/types/pdfjs-viewer-element.d.ts +1 -1
package/README.md
CHANGED
|
@@ -10,15 +10,22 @@ Supported in all [major browsers](https://caniuse.com/custom-elementsv1), and wo
|
|
|
10
10
|
See [demo pages](https://github.com/alekswebnet/pdfjs-viewer-element/tree/master/demo) for various usecases.
|
|
11
11
|
See [live examples](https://alekswebnet.github.io/pdfjs-viewer-element/#demo) of usage with frameworks.
|
|
12
12
|
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- Simple PDF.js viewer integration to any web application
|
|
16
|
+
- PDF.js viewer options and parameters support, access to the viewer application instance
|
|
17
|
+
- Ability to customize viewer styles and themes
|
|
18
|
+
|
|
13
19
|
## How it works
|
|
14
20
|
|
|
15
|
-
**⚠️ This is an important part !!!**
|
|
21
|
+
**⚠️ This is an important part, please read this FIRST !!!**
|
|
16
22
|
|
|
17
23
|
**You should download and place the PDF.js prebuilt files in the project.**
|
|
18
24
|
|
|
19
25
|
`pdfjs-viewer-element` requires PDF.js [prebuilt](http://mozilla.github.io/pdf.js/getting_started/), that includes the generic build of PDF.js and the viewer.
|
|
20
26
|
|
|
21
|
-
The prebuilt comes with each PDF.js release.
|
|
27
|
+
The prebuilt comes with each PDF.js release.
|
|
28
|
+
All v4 and v3 [releases](https://github.com/mozilla/pdf.js/releases) are supported.
|
|
22
29
|
|
|
23
30
|
Then specify the path to the directory with the `viewer-path` property (`/pdfjs` by default) and PDF file URL with `src` property (should refer to the [same origin](https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#can-i-load-a-pdf-from-another-server-cross-domain-request)).
|
|
24
31
|
|
|
@@ -64,7 +71,7 @@ Using browser:
|
|
|
64
71
|
## Usage
|
|
65
72
|
|
|
66
73
|
```html
|
|
67
|
-
<pdfjs-viewer-element src="/file.pdf" viewer-path="/pdfjs-4.
|
|
74
|
+
<pdfjs-viewer-element src="/file.pdf" viewer-path="/pdfjs-4.10.38-dist"></pdfjs-viewer-element>
|
|
68
75
|
```
|
|
69
76
|
|
|
70
77
|
## Attributes
|
|
@@ -73,27 +80,39 @@ Using browser:
|
|
|
73
80
|
|
|
74
81
|
`viewer-path` - Path to PDF.js [prebuilt](http://mozilla.github.io/pdf.js/getting_started/)
|
|
75
82
|
|
|
76
|
-
`
|
|
83
|
+
`page` - Page number.
|
|
84
|
+
|
|
85
|
+
`nameddest` - Go to a named destination.
|
|
86
|
+
|
|
87
|
+
`search` - Search text.
|
|
88
|
+
|
|
89
|
+
`phrase` - Search by phrase, `true` to enable.
|
|
90
|
+
|
|
91
|
+
`zoom` - Zoom level.
|
|
77
92
|
|
|
78
|
-
`
|
|
93
|
+
`pagemode` - Page mode, `thumbs | bookmarks | attachments | layers | none`.
|
|
79
94
|
|
|
80
|
-
`
|
|
95
|
+
`disable-worker` - Disables the worker, `true` to enable.
|
|
81
96
|
|
|
82
|
-
`
|
|
97
|
+
`text-layer` - Disables or reveals the text layer that is used for text selection, `off | visible | shadow | hover`.
|
|
83
98
|
|
|
84
|
-
`
|
|
99
|
+
`disable-font-face` - Disables standard `@font-face` font loading and uses the internal font renderer instead, `true` to enable.
|
|
85
100
|
|
|
86
|
-
`
|
|
101
|
+
`disable-range` - Disables HTTP range requests when fetching the document, `true` to enable.
|
|
87
102
|
|
|
88
|
-
`
|
|
103
|
+
`disable-stream` - Disables streaming when fetching the document, `true` to enable.
|
|
89
104
|
|
|
90
|
-
`
|
|
105
|
+
`disable-auto-fetch`- Disables auto fetching of the document; only gets necessary data to display the current view. Note: streaming also needs to be disabled for this to have any effect, `true` to enable.
|
|
91
106
|
|
|
92
|
-
`
|
|
107
|
+
`verbosity`- Specifies the verbosity level of console messages. `0` - only errors, `1` - warnings and errors, `5` - warnings, errors and information messages.
|
|
93
108
|
|
|
94
|
-
`
|
|
109
|
+
`locale` - Specifies which language to use in the viewer UI, `en-US | ...`. [Available locales](https://github.com/mozilla/pdf.js/tree/master/l10n)
|
|
95
110
|
|
|
96
|
-
`viewer-
|
|
111
|
+
`viewer-css-theme` - Apply automatic, light, or dark theme, `AUTOMATIC | LIGHT | DARK`
|
|
112
|
+
|
|
113
|
+
`viewer-extra-styles` - Add your CSS rules to the viewer application, pass a string with styles.
|
|
114
|
+
|
|
115
|
+
`viewer-extra-styles-urls` - Add external CSS files to the viewer application, pass an array with URLs.
|
|
97
116
|
|
|
98
117
|
Play with attributes on [Api docs page](https://alekswebnet.github.io/pdfjs-viewer-element/#api).
|
|
99
118
|
|
|
@@ -104,19 +123,19 @@ Use `viewer-css-theme` attribute to set light or dark theme manually:
|
|
|
104
123
|
```html
|
|
105
124
|
<pdfjs-viewer-element
|
|
106
125
|
src="/file.pdf"
|
|
107
|
-
viewer-path="/pdfjs-4.
|
|
126
|
+
viewer-path="/pdfjs-4.10.38-dist"
|
|
108
127
|
viewer-css-theme="DARK">
|
|
109
128
|
</pdfjs-viewer-element>
|
|
110
129
|
```
|
|
111
130
|
|
|
112
|
-
## Viewer
|
|
131
|
+
## Viewer custom styles
|
|
113
132
|
|
|
114
133
|
You can add your own CSS rules to the viewer application using `viewer-extra-styles` or `viewer-extra-styles-urls` attribute:
|
|
115
134
|
|
|
116
135
|
```html
|
|
117
136
|
<pdfjs-viewer-element
|
|
118
137
|
src="/file.pdf"
|
|
119
|
-
viewer-path="/pdfjs-4.
|
|
138
|
+
viewer-path="/pdfjs-4.10.38-dist"
|
|
120
139
|
viewer-extra-styles="#toolbarViewerMiddle { display: none; }"
|
|
121
140
|
viewer-extra-styles-urls="['/demo/viewer-custom-theme.css']">
|
|
122
141
|
</pdfjs-viewer-element>
|
|
@@ -149,7 +168,7 @@ Build your own theme with viewer's custom variables and `viewer-extra-styles-url
|
|
|
149
168
|
`initialize` - using this method you can access PDFViewerApplication and use methods and events of PDF.js default viewer
|
|
150
169
|
|
|
151
170
|
```html
|
|
152
|
-
<pdfjs-viewer-element viewer-path="/pdfjs-4.
|
|
171
|
+
<pdfjs-viewer-element viewer-path="/pdfjs-4.10.38-dist"></pdfjs-viewer-element>
|
|
153
172
|
```
|
|
154
173
|
|
|
155
174
|
```javascript
|
|
@@ -160,7 +179,9 @@ const viewerApp = await viewer.initialize()
|
|
|
160
179
|
viewerApp.open({ data: pdfData })
|
|
161
180
|
```
|
|
162
181
|
|
|
163
|
-
##
|
|
182
|
+
## Known issues
|
|
183
|
+
|
|
184
|
+
### The `.mjs` files support
|
|
164
185
|
|
|
165
186
|
Since v4 PDF.js requires `.mjs` files support, make sure your server has it.
|
|
166
187
|
|
|
@@ -185,6 +206,13 @@ server {
|
|
|
185
206
|
}
|
|
186
207
|
```
|
|
187
208
|
|
|
209
|
+
### Problem with range requests / streaming
|
|
210
|
+
|
|
211
|
+
Sometimes a PDF file fails to load when working with range requests / streaming.
|
|
212
|
+
If you encounter this issue, you can try disabling the broken functionality of PDF.js:
|
|
213
|
+
|
|
214
|
+
`disable-range="true"`
|
|
215
|
+
|
|
188
216
|
|
|
189
217
|
## License
|
|
190
218
|
[MIT](http://opensource.org/licenses/MIT)
|
|
@@ -1,154 +1,121 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
new MutationObserver((n, t) => {
|
|
8
|
-
Array.from(e.querySelectorAll(m)).forEach((i) => {
|
|
9
|
-
s(i), t.disconnect();
|
|
10
|
-
});
|
|
11
|
-
}).observe(e, {
|
|
12
|
-
childList: !0,
|
|
13
|
-
subtree: !0
|
|
14
|
-
});
|
|
15
|
-
}), g = {
|
|
16
|
-
trailing: !0
|
|
17
|
-
};
|
|
18
|
-
function v(m, e = 25, s = {}) {
|
|
19
|
-
if (s = { ...g, ...s }, !Number.isFinite(e))
|
|
20
|
-
throw new TypeError("Expected `wait` to be a finite number");
|
|
21
|
-
let r, n, t = [], i, a;
|
|
22
|
-
const o = (l, h) => (i = b(m, l, h), i.finally(() => {
|
|
23
|
-
if (i = null, s.trailing && a && !n) {
|
|
24
|
-
const u = o(l, a);
|
|
25
|
-
return a = null, u;
|
|
26
|
-
}
|
|
27
|
-
}), i);
|
|
28
|
-
return function(...l) {
|
|
29
|
-
return i ? (s.trailing && (a = l), i) : new Promise((h) => {
|
|
30
|
-
const u = !n && s.leading;
|
|
31
|
-
clearTimeout(n), n = setTimeout(() => {
|
|
32
|
-
n = null;
|
|
33
|
-
const d = s.leading ? r : o(this, l);
|
|
34
|
-
for (const y of t)
|
|
35
|
-
y(d);
|
|
36
|
-
t = [];
|
|
37
|
-
}, e), u ? (r = o(this, l), h(r)) : t.push(h);
|
|
1
|
+
const y = (p, t) => new Promise((o) => {
|
|
2
|
+
let s = t.querySelector(p);
|
|
3
|
+
s ? o(s) : new MutationObserver((r, e) => {
|
|
4
|
+
Array.from(t.querySelectorAll(p)).forEach((i) => {
|
|
5
|
+
o(i), e.disconnect();
|
|
38
6
|
});
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return await m.apply(e, s);
|
|
43
|
-
}
|
|
44
|
-
const c = {
|
|
45
|
-
viewerPath: "/pdfjs",
|
|
46
|
-
viewerEntry: "/web/viewer.html",
|
|
47
|
-
src: "",
|
|
48
|
-
page: "",
|
|
49
|
-
search: "",
|
|
50
|
-
phrase: "",
|
|
51
|
-
zoom: "",
|
|
52
|
-
pagemode: "none",
|
|
53
|
-
locale: "",
|
|
54
|
-
textLayer: "",
|
|
55
|
-
viewerCssTheme: "AUTOMATIC",
|
|
56
|
-
viewerExtraStyles: "",
|
|
57
|
-
viewerExtraStylesUrls: "",
|
|
58
|
-
nameddest: ""
|
|
59
|
-
}, w = {
|
|
60
|
-
AUTOMATIC: 0,
|
|
61
|
-
// Default value.
|
|
62
|
-
LIGHT: 1,
|
|
63
|
-
DARK: 2
|
|
64
|
-
}, A = ["src", "viewer-path", "locale", "text-layer", "viewer-css-theme", "viewer-extra-styles", "viewer-extra-styles-urls"];
|
|
65
|
-
class p extends HTMLElement {
|
|
7
|
+
}).observe(t, { childList: !0, subtree: !0 });
|
|
8
|
+
}), T = { trailing: !0 }, S = "/pdfjs", D = "/web/viewer.html", A = "", C = "", P = "", k = "", R = "", V = "none", F = "", O = "", L = "", I = "", j = "", q = "", M = "", W = "", v = "AUTOMATIC", $ = "", z = "", H = "", b = { AUTOMATIC: 0, LIGHT: 1, DARK: 2 }, N = ["src", "viewer-path", "disable-worker", "text-layer", "disable-font-face", "disable-range", "disable-stream", "disable-auto-fetch", "verbosity", "locale", "viewer-css-theme", "viewer-extra-styles", "viewer-extra-styles-urls"];
|
|
9
|
+
class x extends HTMLElement {
|
|
66
10
|
constructor() {
|
|
67
|
-
super(), this.onIframeReady =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
11
|
+
super(), this.onIframeReady = function(s, r = 25, e = {}) {
|
|
12
|
+
if (e = { ...T, ...e }, !Number.isFinite(r)) throw new TypeError("Expected `wait` to be a finite number");
|
|
13
|
+
let i, n, a, l, h = [];
|
|
14
|
+
const f = (c, m) => (a = async function(d, u, w) {
|
|
15
|
+
return await d.apply(u, w);
|
|
16
|
+
}(s, c, m), a.finally(() => {
|
|
17
|
+
if (a = null, e.trailing && l && !n) {
|
|
18
|
+
const d = f(c, l);
|
|
19
|
+
return l = null, d;
|
|
20
|
+
}
|
|
21
|
+
}), a);
|
|
22
|
+
return function(...c) {
|
|
23
|
+
return a ? (e.trailing && (l = c), a) : new Promise((m) => {
|
|
24
|
+
const d = !n && e.leading;
|
|
25
|
+
clearTimeout(n), n = setTimeout(() => {
|
|
26
|
+
n = null;
|
|
27
|
+
const u = e.leading ? i : f(this, c);
|
|
28
|
+
for (const w of h) w(u);
|
|
29
|
+
h = [];
|
|
30
|
+
}, r), d ? (i = f(this, c), m(i)) : h.push(m);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
}(async (s) => {
|
|
34
|
+
await y("iframe", this.shadowRoot), s();
|
|
35
|
+
}, 0, { leading: !0 }), this.setViewerExtraStyles = (s, r = "extra") => {
|
|
36
|
+
var i, n, a, l, h;
|
|
37
|
+
if (!s) return void ((n = (i = this.iframe.contentDocument) == null ? void 0 : i.head.querySelector(`style[${r}]`)) == null ? void 0 : n.remove());
|
|
38
|
+
if (((l = (a = this.iframe.contentDocument) == null ? void 0 : a.head.querySelector(`style[${r}]`)) == null ? void 0 : l.innerHTML) === s) return;
|
|
39
|
+
const e = document.createElement("style");
|
|
40
|
+
e.innerHTML = s, e.setAttribute(r, ""), (h = this.iframe.contentDocument) == null || h.head.appendChild(e);
|
|
41
|
+
}, this.injectExtraStylesLinks = (s) => {
|
|
42
|
+
s && s.replace(/'|]|\[/g, "").split(",").map((r) => r.trim()).forEach((r) => {
|
|
43
|
+
var n, a;
|
|
44
|
+
if ((n = this.iframe.contentDocument) == null ? void 0 : n.head.querySelector(`link[href="${r}"]`)) return;
|
|
45
|
+
const i = document.createElement("link");
|
|
46
|
+
i.rel = "stylesheet", i.href = r, (a = this.iframe.contentDocument) == null || a.head.appendChild(i);
|
|
88
47
|
});
|
|
89
|
-
}, this.initialize = () => new Promise(async (
|
|
90
|
-
var
|
|
91
|
-
await
|
|
92
|
-
var
|
|
93
|
-
await ((i = (
|
|
48
|
+
}, this.initialize = () => new Promise(async (s) => {
|
|
49
|
+
var r;
|
|
50
|
+
await y("iframe", this.shadowRoot), (r = this.iframe) == null || r.addEventListener("load", async () => {
|
|
51
|
+
var e, i, n;
|
|
52
|
+
await ((i = (e = this.iframe.contentWindow) == null ? void 0 : e.PDFViewerApplication) == null ? void 0 : i.initializedPromise), s((n = this.iframe.contentWindow) == null ? void 0 : n.PDFViewerApplication);
|
|
94
53
|
}, { once: !0 });
|
|
95
54
|
});
|
|
96
|
-
const
|
|
97
|
-
|
|
55
|
+
const t = this.attachShadow({ mode: "open" }), o = document.createElement("template");
|
|
56
|
+
o.innerHTML = `
|
|
98
57
|
<style>:host{width:100%;display:block;overflow:hidden}:host iframe{height:100%}</style>
|
|
99
58
|
<iframe frameborder="0" width="100%" loading="lazy"></iframe>
|
|
100
|
-
`,
|
|
59
|
+
`, t.appendChild(o.content.cloneNode(!0));
|
|
101
60
|
}
|
|
102
61
|
static get observedAttributes() {
|
|
103
|
-
return ["src", "viewer-path", "
|
|
62
|
+
return ["src", "viewer-path", "page", "search", "phrase", "zoom", "pagemode", "disable-worker", "text-layer", "disable-font-face", "disable-range", "disable-stream", "disable-auto-fetch", "verbosity", "locale", "viewer-css-theme", "viewer-extra-styles", "viewer-extra-styles-urls", "nameddest"];
|
|
104
63
|
}
|
|
105
64
|
connectedCallback() {
|
|
106
65
|
this.iframe = this.shadowRoot.querySelector("iframe"), document.addEventListener("webviewerloaded", async () => {
|
|
107
|
-
var
|
|
108
|
-
this.setCssTheme(this.getCssThemeOption()), this.injectExtraStylesLinks(this.getAttribute("viewer-extra-styles-urls") ??
|
|
66
|
+
var t, o, s, r, e, i, n, a;
|
|
67
|
+
this.setCssTheme(this.getCssThemeOption()), this.injectExtraStylesLinks(this.getAttribute("viewer-extra-styles-urls") ?? z), this.setViewerExtraStyles(this.getAttribute("viewer-extra-styles") ?? $), this.getAttribute("src") !== A && ((o = (t = this.iframe.contentWindow) == null ? void 0 : t.PDFViewerApplicationOptions) == null || o.set("defaultUrl", "")), (r = (s = this.iframe.contentWindow) == null ? void 0 : s.PDFViewerApplicationOptions) == null || r.set("disablePreferences", !0), (i = (e = this.iframe.contentWindow) == null ? void 0 : e.PDFViewerApplicationOptions) == null || i.set("pdfBugEnabled", !0), (a = (n = this.iframe.contentWindow) == null ? void 0 : n.PDFViewerApplicationOptions) == null || a.set("eventBusDispatchToDOM", !0);
|
|
109
68
|
});
|
|
110
69
|
}
|
|
111
|
-
attributeChangedCallback(
|
|
112
|
-
|
|
113
|
-
this.
|
|
114
|
-
|
|
115
|
-
});
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
this.onIframeReady(() => this.mountViewer(this.getIframeSrc()));
|
|
70
|
+
attributeChangedCallback(t) {
|
|
71
|
+
N.includes(t) ? this.onIframeReady(() => this.mountViewer(this.getIframeSrc())) : this.onIframeReady(() => {
|
|
72
|
+
this.iframe.src = this.getIframeSrc();
|
|
73
|
+
});
|
|
119
74
|
}
|
|
120
75
|
getIframeSrc() {
|
|
121
|
-
const
|
|
122
|
-
return
|
|
76
|
+
const t = this.getFullPath(this.getAttribute("src") || A), o = this.getFullPath(this.getAttribute("viewer-path") || S), s = this.getAttribute("page") || C, r = this.getAttribute("search") || P, e = this.getAttribute("phrase") || k, i = this.getAttribute("zoom") || R, n = this.getAttribute("pagemode") || V, a = this.getAttribute("disable-worker") || O, l = this.getAttribute("text-layer") || L, h = this.getAttribute("disable-font-face") || I, f = this.getAttribute("disable-range") || j, c = this.getAttribute("disable-stream") || q, m = this.getAttribute("disable-auto-fetch") || M, d = this.getAttribute("verbosity") || W, u = this.getAttribute("locale") || F, w = this.getAttribute("viewer-css-theme") || v, E = !!(this.getAttribute("viewer-extra-styles") || $), g = this.getAttribute("nameddest") || H;
|
|
77
|
+
return `
|
|
78
|
+
${o}${D}?file=
|
|
79
|
+
${encodeURIComponent(t)}#page=${s}&zoom=${i}&pagemode=${n}&search=${r}&phrase=${e}&textLayer=
|
|
80
|
+
${l}&disableWorker=
|
|
81
|
+
${a}&disableFontFace=
|
|
82
|
+
${h}&disableRange=
|
|
83
|
+
${f}&disableStream=
|
|
84
|
+
${c}&disableAutoFetch=
|
|
85
|
+
${m}&verbosity=
|
|
86
|
+
${d}
|
|
87
|
+
${u ? "&locale=" + u : ""}&viewerCssTheme=
|
|
88
|
+
${w}&viewerExtraStyles=
|
|
89
|
+
${E}
|
|
90
|
+
${g ? "&nameddest=" + g : ""}`;
|
|
123
91
|
}
|
|
124
|
-
mountViewer(
|
|
125
|
-
|
|
92
|
+
mountViewer(t) {
|
|
93
|
+
t && this.iframe && (this.shadowRoot.replaceChild(this.iframe.cloneNode(), this.iframe), this.iframe = this.shadowRoot.querySelector("iframe"), this.iframe.src = t);
|
|
126
94
|
}
|
|
127
|
-
getFullPath(
|
|
128
|
-
return
|
|
95
|
+
getFullPath(t) {
|
|
96
|
+
return t.startsWith("/") ? `${window.location.origin}${t}` : t;
|
|
129
97
|
}
|
|
130
98
|
getCssThemeOption() {
|
|
131
|
-
const
|
|
132
|
-
return Object.keys(
|
|
99
|
+
const t = this.getAttribute("viewer-css-theme");
|
|
100
|
+
return Object.keys(b).includes(t) ? b[t] : b[v];
|
|
133
101
|
}
|
|
134
|
-
setCssTheme(
|
|
135
|
-
var s, r
|
|
136
|
-
if (
|
|
137
|
-
const
|
|
102
|
+
setCssTheme(t) {
|
|
103
|
+
var o, s, r;
|
|
104
|
+
if (t === b.DARK) {
|
|
105
|
+
const e = (o = this.iframe.contentDocument) == null ? void 0 : o.styleSheets[0], i = (e == null ? void 0 : e.cssRules) || [], n = Object.keys(i).filter((a) => {
|
|
138
106
|
var l;
|
|
139
|
-
return ((l = i[Number(
|
|
140
|
-
}).map((
|
|
107
|
+
return ((l = i[Number(a)]) == null ? void 0 : l.conditionText) === "(prefers-color-scheme: dark)";
|
|
108
|
+
}).map((a) => i[Number(a)].cssText.split(`@media (prefers-color-scheme: dark) {
|
|
141
109
|
`)[1].split(`
|
|
142
110
|
}`)[0]);
|
|
143
|
-
this.setViewerExtraStyles(
|
|
144
|
-
} else
|
|
145
|
-
(n = (r = this.iframe.contentDocument) == null ? void 0 : r.head.querySelector("style[theme]")) == null || n.remove();
|
|
111
|
+
this.setViewerExtraStyles(n.join(""), "theme");
|
|
112
|
+
} else (r = (s = this.iframe.contentDocument) == null ? void 0 : s.head.querySelector("style[theme]")) == null || r.remove();
|
|
146
113
|
}
|
|
147
114
|
}
|
|
148
|
-
window.customElements.get("pdfjs-viewer-element") || (window.PdfjsViewerElement =
|
|
115
|
+
window.customElements.get("pdfjs-viewer-element") || (window.PdfjsViewerElement = x, window.customElements.define("pdfjs-viewer-element", x));
|
|
149
116
|
export {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
117
|
+
x as PdfjsViewerElement,
|
|
118
|
+
b as ViewerCssTheme,
|
|
119
|
+
x as default,
|
|
120
|
+
N as hardRefreshAttributes
|
|
154
121
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdfjs-viewer-element",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Oleksandr Shevchuk",
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
"pdfjs",
|
|
12
12
|
"pdf viewer",
|
|
13
13
|
"pdfjs viewer",
|
|
14
|
-
"web component"
|
|
14
|
+
"web component",
|
|
15
|
+
"pdfjs viewer element",
|
|
16
|
+
"pdf"
|
|
15
17
|
],
|
|
16
18
|
"main": "./dist/pdfjs-viewer-element.js",
|
|
17
19
|
"module": "./dist/pdfjs-viewer-element.js",
|
|
@@ -31,14 +33,17 @@
|
|
|
31
33
|
],
|
|
32
34
|
"devDependencies": {
|
|
33
35
|
"@awlsn/pdfjs-full": "^4.2.392",
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"typescript": "^
|
|
39
|
-
"vite": "^
|
|
40
|
-
"vitest": "^
|
|
41
|
-
"webdriverio": "^
|
|
36
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
37
|
+
"@types/node": "^22.13.5",
|
|
38
|
+
"@vitest/browser": "^3.0.7",
|
|
39
|
+
"jsdom": "^26.0.0",
|
|
40
|
+
"typescript": "^5.7.3",
|
|
41
|
+
"vite": "^6.2.0",
|
|
42
|
+
"vitest": "^3.0.7",
|
|
43
|
+
"webdriverio": "^9.10.1"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"perfect-debounce": "^1.0.0"
|
|
42
47
|
},
|
|
43
48
|
"scripts": {
|
|
44
49
|
"dev": "vite",
|
|
@@ -18,7 +18,7 @@ export declare class PdfjsViewerElement extends HTMLElement {
|
|
|
18
18
|
private setCssTheme;
|
|
19
19
|
private setViewerExtraStyles;
|
|
20
20
|
private injectExtraStylesLinks;
|
|
21
|
-
initialize: () => Promise<PdfjsViewerElementIframeWindow[
|
|
21
|
+
initialize: () => Promise<PdfjsViewerElementIframeWindow["PDFViewerApplication"]>;
|
|
22
22
|
}
|
|
23
23
|
declare global {
|
|
24
24
|
interface Window {
|