pdfjs-viewer-element 0.0.2 → 0.0.3

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/.DS_Store ADDED
Binary file
@@ -0,0 +1,7 @@
1
+ {
2
+ "src/pdfjs-viewer-element.ts": {
3
+ "file": "pdfjs-viewer-element.mjs",
4
+ "src": "src/pdfjs-viewer-element.ts",
5
+ "isEntry": true
6
+ }
7
+ }
@@ -0,0 +1,630 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ const N = window, V = N.ShadowRoot && (N.ShadyCSS === void 0 || N.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, W = Symbol(), K = /* @__PURE__ */ new WeakMap();
7
+ class nt {
8
+ constructor(t, e, i) {
9
+ if (this._$cssResult$ = !0, i !== W)
10
+ throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
11
+ this.cssText = t, this.t = e;
12
+ }
13
+ get styleSheet() {
14
+ let t = this.o;
15
+ const e = this.t;
16
+ if (V && t === void 0) {
17
+ const i = e !== void 0 && e.length === 1;
18
+ i && (t = K.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && K.set(e, t));
19
+ }
20
+ return t;
21
+ }
22
+ toString() {
23
+ return this.cssText;
24
+ }
25
+ }
26
+ const dt = (n) => new nt(typeof n == "string" ? n : n + "", void 0, W), ct = (n, ...t) => {
27
+ const e = n.length === 1 ? n[0] : t.reduce((i, s, o) => i + ((r) => {
28
+ if (r._$cssResult$ === !0)
29
+ return r.cssText;
30
+ if (typeof r == "number")
31
+ return r;
32
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + r + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
33
+ })(s) + n[o + 1], n[0]);
34
+ return new nt(e, n, W);
35
+ }, ut = (n, t) => {
36
+ V ? n.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => {
37
+ const i = document.createElement("style"), s = N.litNonce;
38
+ s !== void 0 && i.setAttribute("nonce", s), i.textContent = e.cssText, n.appendChild(i);
39
+ });
40
+ }, Z = V ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((t) => {
41
+ let e = "";
42
+ for (const i of t.cssRules)
43
+ e += i.cssText;
44
+ return dt(e);
45
+ })(n) : n;
46
+ /**
47
+ * @license
48
+ * Copyright 2017 Google LLC
49
+ * SPDX-License-Identifier: BSD-3-Clause
50
+ */
51
+ var k;
52
+ const T = window, J = T.trustedTypes, pt = J ? J.emptyScript : "", F = T.reactiveElementPolyfillSupport, I = { toAttribute(n, t) {
53
+ switch (t) {
54
+ case Boolean:
55
+ n = n ? pt : null;
56
+ break;
57
+ case Object:
58
+ case Array:
59
+ n = n == null ? n : JSON.stringify(n);
60
+ }
61
+ return n;
62
+ }, fromAttribute(n, t) {
63
+ let e = n;
64
+ switch (t) {
65
+ case Boolean:
66
+ e = n !== null;
67
+ break;
68
+ case Number:
69
+ e = n === null ? null : Number(n);
70
+ break;
71
+ case Object:
72
+ case Array:
73
+ try {
74
+ e = JSON.parse(n);
75
+ } catch {
76
+ e = null;
77
+ }
78
+ }
79
+ return e;
80
+ } }, rt = (n, t) => t !== n && (t == t || n == n), L = { attribute: !0, type: String, converter: I, reflect: !1, hasChanged: rt };
81
+ class f extends HTMLElement {
82
+ constructor() {
83
+ super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this._$El = null, this.u();
84
+ }
85
+ static addInitializer(t) {
86
+ var e;
87
+ (e = this.h) !== null && e !== void 0 || (this.h = []), this.h.push(t);
88
+ }
89
+ static get observedAttributes() {
90
+ this.finalize();
91
+ const t = [];
92
+ return this.elementProperties.forEach((e, i) => {
93
+ const s = this._$Ep(i, e);
94
+ s !== void 0 && (this._$Ev.set(s, i), t.push(s));
95
+ }), t;
96
+ }
97
+ static createProperty(t, e = L) {
98
+ if (e.state && (e.attribute = !1), this.finalize(), this.elementProperties.set(t, e), !e.noAccessor && !this.prototype.hasOwnProperty(t)) {
99
+ const i = typeof t == "symbol" ? Symbol() : "__" + t, s = this.getPropertyDescriptor(t, i, e);
100
+ s !== void 0 && Object.defineProperty(this.prototype, t, s);
101
+ }
102
+ }
103
+ static getPropertyDescriptor(t, e, i) {
104
+ return { get() {
105
+ return this[e];
106
+ }, set(s) {
107
+ const o = this[t];
108
+ this[e] = s, this.requestUpdate(t, o, i);
109
+ }, configurable: !0, enumerable: !0 };
110
+ }
111
+ static getPropertyOptions(t) {
112
+ return this.elementProperties.get(t) || L;
113
+ }
114
+ static finalize() {
115
+ if (this.hasOwnProperty("finalized"))
116
+ return !1;
117
+ this.finalized = !0;
118
+ const t = Object.getPrototypeOf(this);
119
+ if (t.finalize(), this.elementProperties = new Map(t.elementProperties), this._$Ev = /* @__PURE__ */ new Map(), this.hasOwnProperty("properties")) {
120
+ const e = this.properties, i = [...Object.getOwnPropertyNames(e), ...Object.getOwnPropertySymbols(e)];
121
+ for (const s of i)
122
+ this.createProperty(s, e[s]);
123
+ }
124
+ return this.elementStyles = this.finalizeStyles(this.styles), !0;
125
+ }
126
+ static finalizeStyles(t) {
127
+ const e = [];
128
+ if (Array.isArray(t)) {
129
+ const i = new Set(t.flat(1 / 0).reverse());
130
+ for (const s of i)
131
+ e.unshift(Z(s));
132
+ } else
133
+ t !== void 0 && e.push(Z(t));
134
+ return e;
135
+ }
136
+ static _$Ep(t, e) {
137
+ const i = e.attribute;
138
+ return i === !1 ? void 0 : typeof i == "string" ? i : typeof t == "string" ? t.toLowerCase() : void 0;
139
+ }
140
+ u() {
141
+ var t;
142
+ this._$E_ = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$Eg(), this.requestUpdate(), (t = this.constructor.h) === null || t === void 0 || t.forEach((e) => e(this));
143
+ }
144
+ addController(t) {
145
+ var e, i;
146
+ ((e = this._$ES) !== null && e !== void 0 ? e : this._$ES = []).push(t), this.renderRoot !== void 0 && this.isConnected && ((i = t.hostConnected) === null || i === void 0 || i.call(t));
147
+ }
148
+ removeController(t) {
149
+ var e;
150
+ (e = this._$ES) === null || e === void 0 || e.splice(this._$ES.indexOf(t) >>> 0, 1);
151
+ }
152
+ _$Eg() {
153
+ this.constructor.elementProperties.forEach((t, e) => {
154
+ this.hasOwnProperty(e) && (this._$Ei.set(e, this[e]), delete this[e]);
155
+ });
156
+ }
157
+ createRenderRoot() {
158
+ var t;
159
+ const e = (t = this.shadowRoot) !== null && t !== void 0 ? t : this.attachShadow(this.constructor.shadowRootOptions);
160
+ return ut(e, this.constructor.elementStyles), e;
161
+ }
162
+ connectedCallback() {
163
+ var t;
164
+ this.renderRoot === void 0 && (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$ES) === null || t === void 0 || t.forEach((e) => {
165
+ var i;
166
+ return (i = e.hostConnected) === null || i === void 0 ? void 0 : i.call(e);
167
+ });
168
+ }
169
+ enableUpdating(t) {
170
+ }
171
+ disconnectedCallback() {
172
+ var t;
173
+ (t = this._$ES) === null || t === void 0 || t.forEach((e) => {
174
+ var i;
175
+ return (i = e.hostDisconnected) === null || i === void 0 ? void 0 : i.call(e);
176
+ });
177
+ }
178
+ attributeChangedCallback(t, e, i) {
179
+ this._$AK(t, i);
180
+ }
181
+ _$EO(t, e, i = L) {
182
+ var s;
183
+ const o = this.constructor._$Ep(t, i);
184
+ if (o !== void 0 && i.reflect === !0) {
185
+ const r = (((s = i.converter) === null || s === void 0 ? void 0 : s.toAttribute) !== void 0 ? i.converter : I).toAttribute(e, i.type);
186
+ this._$El = t, r == null ? this.removeAttribute(o) : this.setAttribute(o, r), this._$El = null;
187
+ }
188
+ }
189
+ _$AK(t, e) {
190
+ var i;
191
+ const s = this.constructor, o = s._$Ev.get(t);
192
+ if (o !== void 0 && this._$El !== o) {
193
+ const r = s.getPropertyOptions(o), d = typeof r.converter == "function" ? { fromAttribute: r.converter } : ((i = r.converter) === null || i === void 0 ? void 0 : i.fromAttribute) !== void 0 ? r.converter : I;
194
+ this._$El = o, this[o] = d.fromAttribute(e, r.type), this._$El = null;
195
+ }
196
+ }
197
+ requestUpdate(t, e, i) {
198
+ let s = !0;
199
+ t !== void 0 && (((i = i || this.constructor.getPropertyOptions(t)).hasChanged || rt)(this[t], e) ? (this._$AL.has(t) || this._$AL.set(t, e), i.reflect === !0 && this._$El !== t && (this._$EC === void 0 && (this._$EC = /* @__PURE__ */ new Map()), this._$EC.set(t, i))) : s = !1), !this.isUpdatePending && s && (this._$E_ = this._$Ej());
200
+ }
201
+ async _$Ej() {
202
+ this.isUpdatePending = !0;
203
+ try {
204
+ await this._$E_;
205
+ } catch (e) {
206
+ Promise.reject(e);
207
+ }
208
+ const t = this.scheduleUpdate();
209
+ return t != null && await t, !this.isUpdatePending;
210
+ }
211
+ scheduleUpdate() {
212
+ return this.performUpdate();
213
+ }
214
+ performUpdate() {
215
+ var t;
216
+ if (!this.isUpdatePending)
217
+ return;
218
+ this.hasUpdated, this._$Ei && (this._$Ei.forEach((s, o) => this[o] = s), this._$Ei = void 0);
219
+ let e = !1;
220
+ const i = this._$AL;
221
+ try {
222
+ e = this.shouldUpdate(i), e ? (this.willUpdate(i), (t = this._$ES) === null || t === void 0 || t.forEach((s) => {
223
+ var o;
224
+ return (o = s.hostUpdate) === null || o === void 0 ? void 0 : o.call(s);
225
+ }), this.update(i)) : this._$Ek();
226
+ } catch (s) {
227
+ throw e = !1, this._$Ek(), s;
228
+ }
229
+ e && this._$AE(i);
230
+ }
231
+ willUpdate(t) {
232
+ }
233
+ _$AE(t) {
234
+ var e;
235
+ (e = this._$ES) === null || e === void 0 || e.forEach((i) => {
236
+ var s;
237
+ return (s = i.hostUpdated) === null || s === void 0 ? void 0 : s.call(i);
238
+ }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
239
+ }
240
+ _$Ek() {
241
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
242
+ }
243
+ get updateComplete() {
244
+ return this.getUpdateComplete();
245
+ }
246
+ getUpdateComplete() {
247
+ return this._$E_;
248
+ }
249
+ shouldUpdate(t) {
250
+ return !0;
251
+ }
252
+ update(t) {
253
+ this._$EC !== void 0 && (this._$EC.forEach((e, i) => this._$EO(i, this[i], e)), this._$EC = void 0), this._$Ek();
254
+ }
255
+ updated(t) {
256
+ }
257
+ firstUpdated(t) {
258
+ }
259
+ }
260
+ f.finalized = !0, f.elementProperties = /* @__PURE__ */ new Map(), f.elementStyles = [], f.shadowRootOptions = { mode: "open" }, F == null || F({ ReactiveElement: f }), ((k = T.reactiveElementVersions) !== null && k !== void 0 ? k : T.reactiveElementVersions = []).push("1.4.0");
261
+ /**
262
+ * @license
263
+ * Copyright 2017 Google LLC
264
+ * SPDX-License-Identifier: BSD-3-Clause
265
+ */
266
+ var z;
267
+ const R = window, m = R.trustedTypes, G = m ? m.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, v = `lit$${(Math.random() + "").slice(9)}$`, ot = "?" + v, $t = `<${ot}>`, y = document, w = (n = "") => y.createComment(n), C = (n) => n === null || typeof n != "object" && typeof n != "function", lt = Array.isArray, vt = (n) => lt(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", S = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Q = /-->/g, X = />/g, _ = RegExp(`>|[
268
+ \f\r](?:([^\\s"'>=/]+)([
269
+ \f\r]*=[
270
+ \f\r]*(?:[^
271
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), Y = /'/g, tt = /"/g, ht = /^(?:script|style|textarea|title)$/i, _t = (n) => (t, ...e) => ({ _$litType$: n, strings: t, values: e }), ft = _t(1), g = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), et = /* @__PURE__ */ new WeakMap(), At = (n, t, e) => {
272
+ var i, s;
273
+ const o = (i = e == null ? void 0 : e.renderBefore) !== null && i !== void 0 ? i : t;
274
+ let r = o._$litPart$;
275
+ if (r === void 0) {
276
+ const d = (s = e == null ? void 0 : e.renderBefore) !== null && s !== void 0 ? s : null;
277
+ o._$litPart$ = r = new U(t.insertBefore(w(), d), d, void 0, e != null ? e : {});
278
+ }
279
+ return r._$AI(n), r;
280
+ }, A = y.createTreeWalker(y, 129, null, !1), mt = (n, t) => {
281
+ const e = n.length - 1, i = [];
282
+ let s, o = t === 2 ? "<svg>" : "", r = S;
283
+ for (let l = 0; l < e; l++) {
284
+ const h = n[l];
285
+ let $, a, c = -1, p = 0;
286
+ for (; p < h.length && (r.lastIndex = p, a = r.exec(h), a !== null); )
287
+ p = r.lastIndex, r === S ? a[1] === "!--" ? r = Q : a[1] !== void 0 ? r = X : a[2] !== void 0 ? (ht.test(a[2]) && (s = RegExp("</" + a[2], "g")), r = _) : a[3] !== void 0 && (r = _) : r === _ ? a[0] === ">" ? (r = s != null ? s : S, c = -1) : a[1] === void 0 ? c = -2 : (c = r.lastIndex - a[2].length, $ = a[1], r = a[3] === void 0 ? _ : a[3] === '"' ? tt : Y) : r === tt || r === Y ? r = _ : r === Q || r === X ? r = S : (r = _, s = void 0);
288
+ const H = r === _ && n[l + 1].startsWith("/>") ? " " : "";
289
+ o += r === S ? h + $t : c >= 0 ? (i.push($), h.slice(0, c) + "$lit$" + h.slice(c) + v + H) : h + v + (c === -2 ? (i.push(void 0), l) : H);
290
+ }
291
+ const d = o + (n[e] || "<?>") + (t === 2 ? "</svg>" : "");
292
+ if (!Array.isArray(n) || !n.hasOwnProperty("raw"))
293
+ throw Error("invalid template strings array");
294
+ return [G !== void 0 ? G.createHTML(d) : d, i];
295
+ };
296
+ class P {
297
+ constructor({ strings: t, _$litType$: e }, i) {
298
+ let s;
299
+ this.parts = [];
300
+ let o = 0, r = 0;
301
+ const d = t.length - 1, l = this.parts, [h, $] = mt(t, e);
302
+ if (this.el = P.createElement(h, i), A.currentNode = this.el.content, e === 2) {
303
+ const a = this.el.content, c = a.firstChild;
304
+ c.remove(), a.append(...c.childNodes);
305
+ }
306
+ for (; (s = A.nextNode()) !== null && l.length < d; ) {
307
+ if (s.nodeType === 1) {
308
+ if (s.hasAttributes()) {
309
+ const a = [];
310
+ for (const c of s.getAttributeNames())
311
+ if (c.endsWith("$lit$") || c.startsWith(v)) {
312
+ const p = $[r++];
313
+ if (a.push(c), p !== void 0) {
314
+ const H = s.getAttribute(p.toLowerCase() + "$lit$").split(v), O = /([.?@])?(.*)/.exec(p);
315
+ l.push({ type: 1, index: o, name: O[2], strings: H, ctor: O[1] === "." ? gt : O[1] === "?" ? St : O[1] === "@" ? bt : M });
316
+ } else
317
+ l.push({ type: 6, index: o });
318
+ }
319
+ for (const c of a)
320
+ s.removeAttribute(c);
321
+ }
322
+ if (ht.test(s.tagName)) {
323
+ const a = s.textContent.split(v), c = a.length - 1;
324
+ if (c > 0) {
325
+ s.textContent = m ? m.emptyScript : "";
326
+ for (let p = 0; p < c; p++)
327
+ s.append(a[p], w()), A.nextNode(), l.push({ type: 2, index: ++o });
328
+ s.append(a[c], w());
329
+ }
330
+ }
331
+ } else if (s.nodeType === 8)
332
+ if (s.data === ot)
333
+ l.push({ type: 2, index: o });
334
+ else {
335
+ let a = -1;
336
+ for (; (a = s.data.indexOf(v, a + 1)) !== -1; )
337
+ l.push({ type: 7, index: o }), a += v.length - 1;
338
+ }
339
+ o++;
340
+ }
341
+ }
342
+ static createElement(t, e) {
343
+ const i = y.createElement("template");
344
+ return i.innerHTML = t, i;
345
+ }
346
+ }
347
+ function E(n, t, e = n, i) {
348
+ var s, o, r, d;
349
+ if (t === g)
350
+ return t;
351
+ let l = i !== void 0 ? (s = e._$Cl) === null || s === void 0 ? void 0 : s[i] : e._$Cu;
352
+ const h = C(t) ? void 0 : t._$litDirective$;
353
+ return (l == null ? void 0 : l.constructor) !== h && ((o = l == null ? void 0 : l._$AO) === null || o === void 0 || o.call(l, !1), h === void 0 ? l = void 0 : (l = new h(n), l._$AT(n, e, i)), i !== void 0 ? ((r = (d = e)._$Cl) !== null && r !== void 0 ? r : d._$Cl = [])[i] = l : e._$Cu = l), l !== void 0 && (t = E(n, l._$AS(n, t.values), l, i)), t;
354
+ }
355
+ class yt {
356
+ constructor(t, e) {
357
+ this.v = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
358
+ }
359
+ get parentNode() {
360
+ return this._$AM.parentNode;
361
+ }
362
+ get _$AU() {
363
+ return this._$AM._$AU;
364
+ }
365
+ p(t) {
366
+ var e;
367
+ const { el: { content: i }, parts: s } = this._$AD, o = ((e = t == null ? void 0 : t.creationScope) !== null && e !== void 0 ? e : y).importNode(i, !0);
368
+ A.currentNode = o;
369
+ let r = A.nextNode(), d = 0, l = 0, h = s[0];
370
+ for (; h !== void 0; ) {
371
+ if (d === h.index) {
372
+ let $;
373
+ h.type === 2 ? $ = new U(r, r.nextSibling, this, t) : h.type === 1 ? $ = new h.ctor(r, h.name, h.strings, this, t) : h.type === 6 && ($ = new wt(r, this, t)), this.v.push($), h = s[++l];
374
+ }
375
+ d !== (h == null ? void 0 : h.index) && (r = A.nextNode(), d++);
376
+ }
377
+ return o;
378
+ }
379
+ m(t) {
380
+ let e = 0;
381
+ for (const i of this.v)
382
+ i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, e), e += i.strings.length - 2) : i._$AI(t[e])), e++;
383
+ }
384
+ }
385
+ class U {
386
+ constructor(t, e, i, s) {
387
+ var o;
388
+ this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = i, this.options = s, this._$C_ = (o = s == null ? void 0 : s.isConnected) === null || o === void 0 || o;
389
+ }
390
+ get _$AU() {
391
+ var t, e;
392
+ return (e = (t = this._$AM) === null || t === void 0 ? void 0 : t._$AU) !== null && e !== void 0 ? e : this._$C_;
393
+ }
394
+ get parentNode() {
395
+ let t = this._$AA.parentNode;
396
+ const e = this._$AM;
397
+ return e !== void 0 && t.nodeType === 11 && (t = e.parentNode), t;
398
+ }
399
+ get startNode() {
400
+ return this._$AA;
401
+ }
402
+ get endNode() {
403
+ return this._$AB;
404
+ }
405
+ _$AI(t, e = this) {
406
+ t = E(this, t, e), C(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== g && this.$(t) : t._$litType$ !== void 0 ? this.T(t) : t.nodeType !== void 0 ? this.k(t) : vt(t) ? this.O(t) : this.$(t);
407
+ }
408
+ S(t, e = this._$AB) {
409
+ return this._$AA.parentNode.insertBefore(t, e);
410
+ }
411
+ k(t) {
412
+ this._$AH !== t && (this._$AR(), this._$AH = this.S(t));
413
+ }
414
+ $(t) {
415
+ this._$AH !== u && C(this._$AH) ? this._$AA.nextSibling.data = t : this.k(y.createTextNode(t)), this._$AH = t;
416
+ }
417
+ T(t) {
418
+ var e;
419
+ const { values: i, _$litType$: s } = t, o = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = P.createElement(s.h, this.options)), s);
420
+ if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === o)
421
+ this._$AH.m(i);
422
+ else {
423
+ const r = new yt(o, this), d = r.p(this.options);
424
+ r.m(i), this.k(d), this._$AH = r;
425
+ }
426
+ }
427
+ _$AC(t) {
428
+ let e = et.get(t.strings);
429
+ return e === void 0 && et.set(t.strings, e = new P(t)), e;
430
+ }
431
+ O(t) {
432
+ lt(this._$AH) || (this._$AH = [], this._$AR());
433
+ const e = this._$AH;
434
+ let i, s = 0;
435
+ for (const o of t)
436
+ s === e.length ? e.push(i = new U(this.S(w()), this.S(w()), this, this.options)) : i = e[s], i._$AI(o), s++;
437
+ s < e.length && (this._$AR(i && i._$AB.nextSibling, s), e.length = s);
438
+ }
439
+ _$AR(t = this._$AA.nextSibling, e) {
440
+ var i;
441
+ for ((i = this._$AP) === null || i === void 0 || i.call(this, !1, !0, e); t && t !== this._$AB; ) {
442
+ const s = t.nextSibling;
443
+ t.remove(), t = s;
444
+ }
445
+ }
446
+ setConnected(t) {
447
+ var e;
448
+ this._$AM === void 0 && (this._$C_ = t, (e = this._$AP) === null || e === void 0 || e.call(this, t));
449
+ }
450
+ }
451
+ class M {
452
+ constructor(t, e, i, s, o) {
453
+ this.type = 1, this._$AH = u, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = o, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = u;
454
+ }
455
+ get tagName() {
456
+ return this.element.tagName;
457
+ }
458
+ get _$AU() {
459
+ return this._$AM._$AU;
460
+ }
461
+ _$AI(t, e = this, i, s) {
462
+ const o = this.strings;
463
+ let r = !1;
464
+ if (o === void 0)
465
+ t = E(this, t, e, 0), r = !C(t) || t !== this._$AH && t !== g, r && (this._$AH = t);
466
+ else {
467
+ const d = t;
468
+ let l, h;
469
+ for (t = o[0], l = 0; l < o.length - 1; l++)
470
+ h = E(this, d[i + l], e, l), h === g && (h = this._$AH[l]), r || (r = !C(h) || h !== this._$AH[l]), h === u ? t = u : t !== u && (t += (h != null ? h : "") + o[l + 1]), this._$AH[l] = h;
471
+ }
472
+ r && !s && this.P(t);
473
+ }
474
+ P(t) {
475
+ t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t != null ? t : "");
476
+ }
477
+ }
478
+ class gt extends M {
479
+ constructor() {
480
+ super(...arguments), this.type = 3;
481
+ }
482
+ P(t) {
483
+ this.element[this.name] = t === u ? void 0 : t;
484
+ }
485
+ }
486
+ const Et = m ? m.emptyScript : "";
487
+ class St extends M {
488
+ constructor() {
489
+ super(...arguments), this.type = 4;
490
+ }
491
+ P(t) {
492
+ t && t !== u ? this.element.setAttribute(this.name, Et) : this.element.removeAttribute(this.name);
493
+ }
494
+ }
495
+ class bt extends M {
496
+ constructor(t, e, i, s, o) {
497
+ super(t, e, i, s, o), this.type = 5;
498
+ }
499
+ _$AI(t, e = this) {
500
+ var i;
501
+ if ((t = (i = E(this, t, e, 0)) !== null && i !== void 0 ? i : u) === g)
502
+ return;
503
+ const s = this._$AH, o = t === u && s !== u || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, r = t !== u && (s === u || o);
504
+ o && this.element.removeEventListener(this.name, this, s), r && this.element.addEventListener(this.name, this, t), this._$AH = t;
505
+ }
506
+ handleEvent(t) {
507
+ var e, i;
508
+ typeof this._$AH == "function" ? this._$AH.call((i = (e = this.options) === null || e === void 0 ? void 0 : e.host) !== null && i !== void 0 ? i : this.element, t) : this._$AH.handleEvent(t);
509
+ }
510
+ }
511
+ class wt {
512
+ constructor(t, e, i) {
513
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = i;
514
+ }
515
+ get _$AU() {
516
+ return this._$AM._$AU;
517
+ }
518
+ _$AI(t) {
519
+ E(this, t);
520
+ }
521
+ }
522
+ const it = R.litHtmlPolyfillSupport;
523
+ it == null || it(P, U), ((z = R.litHtmlVersions) !== null && z !== void 0 ? z : R.litHtmlVersions = []).push("2.3.0");
524
+ /**
525
+ * @license
526
+ * Copyright 2017 Google LLC
527
+ * SPDX-License-Identifier: BSD-3-Clause
528
+ */
529
+ var j, D;
530
+ class b extends f {
531
+ constructor() {
532
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
533
+ }
534
+ createRenderRoot() {
535
+ var t, e;
536
+ const i = super.createRenderRoot();
537
+ return (t = (e = this.renderOptions).renderBefore) !== null && t !== void 0 || (e.renderBefore = i.firstChild), i;
538
+ }
539
+ update(t) {
540
+ const e = this.render();
541
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = At(e, this.renderRoot, this.renderOptions);
542
+ }
543
+ connectedCallback() {
544
+ var t;
545
+ super.connectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!0);
546
+ }
547
+ disconnectedCallback() {
548
+ var t;
549
+ super.disconnectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!1);
550
+ }
551
+ render() {
552
+ return g;
553
+ }
554
+ }
555
+ b.finalized = !0, b._$litElement$ = !0, (j = globalThis.litElementHydrateSupport) === null || j === void 0 || j.call(globalThis, { LitElement: b });
556
+ const st = globalThis.litElementPolyfillSupport;
557
+ st == null || st({ LitElement: b });
558
+ ((D = globalThis.litElementVersions) !== null && D !== void 0 ? D : globalThis.litElementVersions = []).push("3.2.2");
559
+ /**
560
+ * @license
561
+ * Copyright 2017 Google LLC
562
+ * SPDX-License-Identifier: BSD-3-Clause
563
+ */
564
+ const Ct = (n) => (t) => typeof t == "function" ? ((e, i) => (customElements.define(e, i), i))(n, t) : ((e, i) => {
565
+ const { kind: s, elements: o } = i;
566
+ return { kind: s, elements: o, finisher(r) {
567
+ customElements.define(e, r);
568
+ } };
569
+ })(n, t);
570
+ /**
571
+ * @license
572
+ * Copyright 2017 Google LLC
573
+ * SPDX-License-Identifier: BSD-3-Clause
574
+ */
575
+ const Pt = (n, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? { ...t, finisher(e) {
576
+ e.createProperty(t.key, n);
577
+ } } : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: t.key, initializer() {
578
+ typeof t.initializer == "function" && (this[t.key] = t.initializer.call(this));
579
+ }, finisher(e) {
580
+ e.createProperty(t.key, n);
581
+ } };
582
+ function at(n) {
583
+ return (t, e) => e !== void 0 ? ((i, s, o) => {
584
+ s.constructor.createProperty(o, i);
585
+ })(n, t, e) : Pt(n, t);
586
+ }
587
+ /**
588
+ * @license
589
+ * Copyright 2021 Google LLC
590
+ * SPDX-License-Identifier: BSD-3-Clause
591
+ */
592
+ var B;
593
+ ((B = window.HTMLSlotElement) === null || B === void 0 ? void 0 : B.prototype.assignedElements) != null;
594
+ var xt = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, q = (n, t, e, i) => {
595
+ for (var s = i > 1 ? void 0 : i ? Ut(t, e) : t, o = n.length - 1, r; o >= 0; o--)
596
+ (r = n[o]) && (s = (i ? r(t, e, s) : r(s)) || s);
597
+ return i && s && xt(t, e, s), s;
598
+ };
599
+ let x = class extends b {
600
+ constructor() {
601
+ super(...arguments), this.src = "", this.height = "600px";
602
+ }
603
+ render() {
604
+ return ft`
605
+ <iframe
606
+ frameborder="0"
607
+ width="100%"
608
+ style="height: ${this.height}"
609
+ src="/pdfjs-2.15.349-dist/web/viewer.html?file=${this.src}"
610
+ >
611
+ `;
612
+ }
613
+ };
614
+ x.styles = ct`
615
+ :host {
616
+ width: 100%
617
+ }
618
+ `;
619
+ q([
620
+ at()
621
+ ], x.prototype, "src", 2);
622
+ q([
623
+ at()
624
+ ], x.prototype, "height", 2);
625
+ x = q([
626
+ Ct("pdfjs-viewer-element")
627
+ ], x);
628
+ export {
629
+ x as PdfjsViewerElement
630
+ };
package/package.json CHANGED
@@ -1,21 +1,24 @@
1
1
  {
2
2
  "name": "pdfjs-viewer-element",
3
- "version": "0.0.2",
4
- "type": "module",
3
+ "version": "0.0.3",
5
4
  "main": "dist/pdfjs-viewer-element.es.js",
6
5
  "exports": {
7
6
  ".": "./dist/pdfjs-viewer-element.es.js"
8
7
  },
8
+ "types": "types/pdfjs-viewer-element.d.ts",
9
9
  "files": [
10
- "dist"
10
+ "dist",
11
+ "types"
11
12
  ],
12
13
  "scripts": {
13
14
  "dev": "vite",
14
15
  "build": "tsc && vite build"
15
16
  },
16
- "dependencies": {},
17
+ "dependencies": {
18
+ "lit": "^2.3.0"
19
+ },
17
20
  "devDependencies": {
18
- "lit": "^2.3.0",
21
+ "@types/node": "^18.7.1",
19
22
  "typescript": "^4.6.4",
20
23
  "vite": "^3.0.6"
21
24
  }
@@ -0,0 +1,24 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * An example element.
4
+ *
5
+ * @slot - This element has a slot
6
+ * @csspart button - The button
7
+ */
8
+ export declare class PdfjsViewerElement extends LitElement {
9
+ static styles: import("lit").CSSResult;
10
+ /**
11
+ * PDF file url
12
+ */
13
+ src: string;
14
+ /**
15
+ * Viewer height
16
+ */
17
+ height: string;
18
+ render(): import("lit-html").TemplateResult<1>;
19
+ }
20
+ declare global {
21
+ interface HTMLElementTagNameMap {
22
+ 'pdfjs-viewer-element': PdfjsViewerElement;
23
+ }
24
+ }
@@ -1,39 +0,0 @@
1
- import { css as f, LitElement as c, html as n } from "lit";
2
- import { property as m, customElement as v } from "lit/decorators.js";
3
- var w = Object.defineProperty, d = Object.getOwnPropertyDescriptor, o = (l, r, i, s) => {
4
- for (var e = s > 1 ? void 0 : s ? d(r, i) : r, h = l.length - 1, p; h >= 0; h--)
5
- (p = l[h]) && (e = (s ? p(r, i, e) : p(e)) || e);
6
- return s && e && w(r, i, e), e;
7
- };
8
- let t = class extends c {
9
- constructor() {
10
- super(...arguments), this.src = "", this.height = "600px";
11
- }
12
- render() {
13
- return n`
14
- <iframe
15
- frameborder="0"
16
- width="100%"
17
- style="height: ${this.height}"
18
- src="/pdfjs-2.15.349-dist/web/viewer.html?file=${this.src}"
19
- >
20
- `;
21
- }
22
- };
23
- t.styles = f`
24
- :host {
25
- width: 100%
26
- }
27
- `;
28
- o([
29
- m()
30
- ], t.prototype, "src", 2);
31
- o([
32
- m()
33
- ], t.prototype, "height", 2);
34
- t = o([
35
- v("pdfjs-viewer-element")
36
- ], t);
37
- export {
38
- t as PdfjsViewerElement
39
- };