pdfjs-vue3 0.1.6 → 0.1.7
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 +3 -3
- package/dist/pdfjs-vue3.es.js +69 -64
- package/dist/pdfjs-vue3.umd.js +1 -1
- package/package.json +53 -53
- package/types/PdfHost.vue.d.ts +16 -0
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# Pdfjs in Vue 3
|
|
2
|
-
|
|
3
|
-
This is an experiment in displaying PDFs using pdfjs as a vue 3 component.
|
|
1
|
+
# Pdfjs in Vue 3
|
|
2
|
+
|
|
3
|
+
This is an experiment in displaying PDFs using pdfjs as a vue 3 component.
|
package/dist/pdfjs-vue3.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as N, ref as
|
|
1
|
+
import { defineComponent as N, ref as P, watch as j, onMounted as L, openBlock as x, createElementBlock as $, computed as M, onBeforeUnmount as G, createElementVNode as W, createBlock as R, unref as k, createCommentVNode as D, renderSlot as E, toDisplayString as Q, shallowRef as B, Fragment as Z, renderList as ee, withCtx as F, nextTick as ie } from "vue";
|
|
2
2
|
import { renderTextLayer as ae, getDocument as le, GlobalWorkerOptions as se } from "pdfjs-dist";
|
|
3
3
|
var S = /* @__PURE__ */ ((e) => (e[e.Auto = 0] = "Auto", e[e.WidthFit = 1] = "WidthFit", e[e.PageFit = 2] = "PageFit", e[e.Custom = 3] = "Custom", e))(S || {}), I = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
4
4
|
function ue(e) {
|
|
5
5
|
var i = typeof e;
|
|
6
6
|
return e != null && (i == "object" || i == "function");
|
|
7
7
|
}
|
|
8
|
-
var te = ue, ce = typeof I == "object" && I && I.Object === Object && I, de = ce, fe = de, pe = typeof self == "object" && self && self.Object === Object && self,
|
|
9
|
-
return
|
|
8
|
+
var te = ue, ce = typeof I == "object" && I && I.Object === Object && I, de = ce, fe = de, pe = typeof self == "object" && self && self.Object === Object && self, me = fe || pe || Function("return this")(), oe = me, ve = oe, ge = function() {
|
|
9
|
+
return ve.Date.now();
|
|
10
10
|
}, he = ge, be = /\s/;
|
|
11
11
|
function ye(e) {
|
|
12
12
|
for (var i = e.length; i-- && be.test(e.charAt(i)); )
|
|
@@ -14,10 +14,10 @@ function ye(e) {
|
|
|
14
14
|
return i;
|
|
15
15
|
}
|
|
16
16
|
var we = ye, Te = we, xe = /^\s+/;
|
|
17
|
-
function
|
|
17
|
+
function Pe(e) {
|
|
18
18
|
return e && e.slice(0, Te(e) + 1).replace(xe, "");
|
|
19
19
|
}
|
|
20
|
-
var
|
|
20
|
+
var ze = Pe, _e = oe, Se = _e.Symbol, ne = Se, U = ne, re = Object.prototype, $e = re.hasOwnProperty, ke = re.toString, C = U ? U.toStringTag : void 0;
|
|
21
21
|
function je(e) {
|
|
22
22
|
var i = $e.call(e, C), l = e[C];
|
|
23
23
|
try {
|
|
@@ -44,7 +44,7 @@ var Ae = Fe, Ge = De, Re = Ae, He = "[object Symbol]";
|
|
|
44
44
|
function Ue(e) {
|
|
45
45
|
return typeof e == "symbol" || Re(e) && Ge(e) == He;
|
|
46
46
|
}
|
|
47
|
-
var Ke = Ue, Xe =
|
|
47
|
+
var Ke = Ue, Xe = ze, Y = te, Ye = Ke, q = 0 / 0, qe = /^[-+]0x[0-9a-f]+$/i, Je = /^0b[01]+$/i, Qe = /^0o[0-7]+$/i, Ze = parseInt;
|
|
48
48
|
function et(e) {
|
|
49
49
|
if (typeof e == "number")
|
|
50
50
|
return e;
|
|
@@ -66,39 +66,39 @@ function at(e, i, l) {
|
|
|
66
66
|
if (typeof e != "function")
|
|
67
67
|
throw new TypeError(nt);
|
|
68
68
|
i = J(i) || 0, ot(l) && (T = !!l.leading, w = "maxWait" in l, b = w ? rt(J(l.maxWait) || 0, i) : b, o = "trailing" in l ? !!l.trailing : o);
|
|
69
|
-
function c(
|
|
70
|
-
var
|
|
71
|
-
return n = s = void 0, y =
|
|
69
|
+
function c(v) {
|
|
70
|
+
var _ = n, O = s;
|
|
71
|
+
return n = s = void 0, y = v, g = e.apply(O, _), g;
|
|
72
72
|
}
|
|
73
|
-
function f(
|
|
74
|
-
return y =
|
|
73
|
+
function f(v) {
|
|
74
|
+
return y = v, d = setTimeout(t, i), T ? c(v) : g;
|
|
75
75
|
}
|
|
76
|
-
function a(
|
|
77
|
-
var
|
|
76
|
+
function a(v) {
|
|
77
|
+
var _ = v - u, O = v - y, H = i - _;
|
|
78
78
|
return w ? it(H, b - O) : H;
|
|
79
79
|
}
|
|
80
|
-
function h(
|
|
81
|
-
var
|
|
82
|
-
return u === void 0 ||
|
|
80
|
+
function h(v) {
|
|
81
|
+
var _ = v - u, O = v - y;
|
|
82
|
+
return u === void 0 || _ >= i || _ < 0 || w && O >= b;
|
|
83
83
|
}
|
|
84
84
|
function t() {
|
|
85
|
-
var
|
|
86
|
-
if (h(
|
|
87
|
-
return r(
|
|
88
|
-
d = setTimeout(t, a(
|
|
85
|
+
var v = V();
|
|
86
|
+
if (h(v))
|
|
87
|
+
return r(v);
|
|
88
|
+
d = setTimeout(t, a(v));
|
|
89
89
|
}
|
|
90
|
-
function r(
|
|
91
|
-
return d = void 0, o && n ? c(
|
|
90
|
+
function r(v) {
|
|
91
|
+
return d = void 0, o && n ? c(v) : (n = s = void 0, g);
|
|
92
92
|
}
|
|
93
93
|
function p() {
|
|
94
94
|
d !== void 0 && clearTimeout(d), y = 0, n = u = s = d = void 0;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function m() {
|
|
97
97
|
return d === void 0 ? g : r(V());
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
var
|
|
101
|
-
if (n = arguments, s = this, u =
|
|
99
|
+
function z() {
|
|
100
|
+
var v = V(), _ = h(v);
|
|
101
|
+
if (n = arguments, s = this, u = v, _) {
|
|
102
102
|
if (d === void 0)
|
|
103
103
|
return f(u);
|
|
104
104
|
if (w)
|
|
@@ -106,7 +106,7 @@ function at(e, i, l) {
|
|
|
106
106
|
}
|
|
107
107
|
return d === void 0 && (d = setTimeout(t, i)), g;
|
|
108
108
|
}
|
|
109
|
-
return
|
|
109
|
+
return z.cancel = p, z.flush = m, z;
|
|
110
110
|
}
|
|
111
111
|
var A = at;
|
|
112
112
|
const lt = /* @__PURE__ */ N({
|
|
@@ -116,7 +116,7 @@ const lt = /* @__PURE__ */ N({
|
|
|
116
116
|
page: null
|
|
117
117
|
},
|
|
118
118
|
setup(e) {
|
|
119
|
-
const i = e, l =
|
|
119
|
+
const i = e, l = P(), n = P();
|
|
120
120
|
j(() => i.page, async (g) => {
|
|
121
121
|
l.value = await g.getTextContent();
|
|
122
122
|
}, { immediate: !0 }), j(() => [l.value, n.value, i.viewport], () => {
|
|
@@ -169,18 +169,18 @@ const st = { class: "pdf-page-layout" }, ut = { class: "pdf-page-overlay" }, ct
|
|
|
169
169
|
},
|
|
170
170
|
emits: ["update:zoom"],
|
|
171
171
|
setup(e, { expose: i, emit: l }) {
|
|
172
|
-
const n = e, s =
|
|
172
|
+
const n = e, s = P(), b = P(), g = P(!1), d = 1100;
|
|
173
173
|
i({ rootEl: b, inViewport: g });
|
|
174
174
|
const u = 96 / 72, y = M(() => {
|
|
175
175
|
const { width: a, height: h } = n.page.getViewport({ scale: u }), { width: t, height: r } = n.viewport;
|
|
176
|
-
let p = 0,
|
|
176
|
+
let p = 0, m = 1;
|
|
177
177
|
switch (n.zoomType) {
|
|
178
178
|
case S.Auto:
|
|
179
|
-
return p = Math.min(t, d) - 40,
|
|
179
|
+
return p = Math.min(t, d) - 40, m = p / a, u * m;
|
|
180
180
|
case S.WidthFit:
|
|
181
|
-
return p = t - 40,
|
|
181
|
+
return p = t - 40, m = p / a, u * m;
|
|
182
182
|
case S.PageFit:
|
|
183
|
-
return t > r ? (
|
|
183
|
+
return t > r ? (m = r / h, u * m) : (p = t - 40, m = p / a, u * m);
|
|
184
184
|
}
|
|
185
185
|
return u * n.zoom;
|
|
186
186
|
}), T = M(() => y.value * ((window == null ? void 0 : window.devicePixelRatio) || 1)), w = M(() => n.page.getViewport({ scale: y.value })), o = M(() => n.page.getViewport({ scale: T.value }));
|
|
@@ -202,11 +202,11 @@ const st = { class: "pdf-page-layout" }, ut = { class: "pdf-page-overlay" }, ct
|
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
console.debug(`rendering page ${a.pageNumber}`);
|
|
205
|
-
const
|
|
205
|
+
const m = {
|
|
206
206
|
canvasContext: p,
|
|
207
207
|
viewport: o.value
|
|
208
208
|
};
|
|
209
|
-
c = a.render(
|
|
209
|
+
c = a.render(m), c.promise.then(() => c = void 0).catch(() => {
|
|
210
210
|
c = void 0, f();
|
|
211
211
|
});
|
|
212
212
|
}
|
|
@@ -256,9 +256,9 @@ const ft = {
|
|
|
256
256
|
},
|
|
257
257
|
emits: ["error", "update:zoom"],
|
|
258
258
|
setup(e, { emit: i }) {
|
|
259
|
-
const l = e, n = B(), s = B([]), b = B(), g =
|
|
259
|
+
const l = e, n = B(), s = B([]), b = B(), g = P();
|
|
260
260
|
let d = [];
|
|
261
|
-
const u =
|
|
261
|
+
const u = P(!1), y = P(0);
|
|
262
262
|
function T(o) {
|
|
263
263
|
o && (d.push(o), d.length == 1 && (o.inViewport = !0));
|
|
264
264
|
}
|
|
@@ -342,11 +342,12 @@ const gt = /* @__PURE__ */ N({
|
|
|
342
342
|
zoomType: null,
|
|
343
343
|
zoom: null,
|
|
344
344
|
hideText: { type: Boolean },
|
|
345
|
-
hideNumber: { type: Boolean }
|
|
345
|
+
hideNumber: { type: Boolean },
|
|
346
|
+
enablePinchZoom: { type: Boolean }
|
|
346
347
|
},
|
|
347
348
|
emits: ["update:zoom", "update:zoomType"],
|
|
348
349
|
setup(e, { expose: i, emit: l }) {
|
|
349
|
-
const n = e, s =
|
|
350
|
+
const n = e, s = P();
|
|
350
351
|
i({
|
|
351
352
|
zoomIn: T,
|
|
352
353
|
zoomOut: w
|
|
@@ -359,7 +360,7 @@ const gt = /* @__PURE__ */ N({
|
|
|
359
360
|
function g(t) {
|
|
360
361
|
t.ctrlKey && (t.key === "0" || t.which == 48) && l("update:zoomType", S.Auto);
|
|
361
362
|
}
|
|
362
|
-
const d =
|
|
363
|
+
const d = P({ width: 0, height: 0 }), u = A(() => {
|
|
363
364
|
const t = s.value;
|
|
364
365
|
t && (d.value = {
|
|
365
366
|
width: t.offsetWidth,
|
|
@@ -381,9 +382,9 @@ const gt = /* @__PURE__ */ N({
|
|
|
381
382
|
j(() => n.zoom, (t, r) => {
|
|
382
383
|
const p = s.value;
|
|
383
384
|
if (p && t && r) {
|
|
384
|
-
const
|
|
385
|
+
const m = p.scrollTop, z = p.scrollLeft, v = t / r;
|
|
385
386
|
ie(() => {
|
|
386
|
-
p.scrollTop =
|
|
387
|
+
p.scrollTop = m * v, p.scrollLeft = z * v;
|
|
387
388
|
});
|
|
388
389
|
}
|
|
389
390
|
}), L(() => {
|
|
@@ -394,26 +395,30 @@ const gt = /* @__PURE__ */ N({
|
|
|
394
395
|
const o = [];
|
|
395
396
|
let c = -1;
|
|
396
397
|
function f(t) {
|
|
397
|
-
o.push(t);
|
|
398
|
+
!n.enablePinchZoom || o.push(t);
|
|
398
399
|
}
|
|
399
400
|
const a = A((t) => {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
o[r]
|
|
403
|
-
|
|
401
|
+
if (!!n.enablePinchZoom) {
|
|
402
|
+
for (let r = 0; r < o.length; r++)
|
|
403
|
+
if (t.pointerId === o[r].pointerId) {
|
|
404
|
+
o[r] = t;
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
if (o.length === 2) {
|
|
408
|
+
const r = Math.abs(o[0].clientX - o[1].clientX), p = Math.abs(o[0].clientY - o[1].clientY), m = Math.sqrt(Math.pow(r, 2) + Math.pow(p, 2));
|
|
409
|
+
c > 0 && (m > c && T(), m < c && w()), c = m;
|
|
404
410
|
}
|
|
405
|
-
if (o.length === 2) {
|
|
406
|
-
const r = Math.abs(o[0].clientX - o[1].clientX), p = Math.abs(o[0].clientY - o[1].clientY), v = Math.sqrt(Math.pow(r, 2) + Math.pow(p, 2));
|
|
407
|
-
c > 0 && (v > c && T(), v < c && w()), c = v;
|
|
408
411
|
}
|
|
409
412
|
}, 10);
|
|
410
413
|
function h(t) {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
o.
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
414
|
+
if (!!n.enablePinchZoom) {
|
|
415
|
+
for (let r = 0; r < o.length; r++)
|
|
416
|
+
if (o[r].pointerId === t.pointerId) {
|
|
417
|
+
o.splice(r, 1);
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
o.length < 2 && (c = -1);
|
|
421
|
+
}
|
|
417
422
|
}
|
|
418
423
|
return (t, r) => (x(), $("div", {
|
|
419
424
|
ref_key: "rootEl",
|
|
@@ -436,21 +441,21 @@ const gt = /* @__PURE__ */ N({
|
|
|
436
441
|
"hide-text": !!e.hideText,
|
|
437
442
|
"zoom-type": e.zoomType || k(S).Auto,
|
|
438
443
|
zoom: e.zoom || 1,
|
|
439
|
-
"onUpdate:zoom": r[0] || (r[0] = (
|
|
444
|
+
"onUpdate:zoom": r[0] || (r[0] = (m) => l("update:zoom", m))
|
|
440
445
|
}, {
|
|
441
|
-
loading: F(({ loading:
|
|
446
|
+
loading: F(({ loading: m, progress: z }) => [
|
|
442
447
|
E(t.$slots, "loading", {
|
|
443
448
|
source: p,
|
|
444
|
-
loading:
|
|
445
|
-
progress:
|
|
449
|
+
loading: m,
|
|
450
|
+
progress: z
|
|
446
451
|
})
|
|
447
452
|
]),
|
|
448
|
-
default: F(({ doc:
|
|
453
|
+
default: F(({ doc: m, page: z, displaySize: v }) => [
|
|
449
454
|
E(t.$slots, "page", {
|
|
450
455
|
source: p,
|
|
451
|
-
doc:
|
|
452
|
-
page:
|
|
453
|
-
displaySize:
|
|
456
|
+
doc: m,
|
|
457
|
+
page: z,
|
|
458
|
+
displaySize: v
|
|
454
459
|
})
|
|
455
460
|
]),
|
|
456
461
|
_: 2
|
package/dist/pdfjs-vue3.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(k,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pdfjs-dist")):typeof define=="function"&&define.amd?define(["exports","vue","pdfjs-dist"],e):(k=typeof globalThis<"u"?globalThis:k||self,e(k.pdfjsVue3={},k.Vue,k.pdfjsLib))})(this,function(k,e,$){"use strict";var _=(t=>(t[t.Auto=0]="Auto",t[t.WidthFit=1]="WidthFit",t[t.PageFit=2]="PageFit",t[t.Custom=3]="Custom",t))(_||{}),B=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function G(t){var a=typeof t;return t!=null&&(a=="object"||a=="function")}var M=G,U=typeof B=="object"&&B&&B.Object===Object&&B,H=U,q=H,K=typeof self=="object"&&self&&self.Object===Object&&self,X=q||K||Function("return this")(),O=X,Y=O,J=function(){return Y.Date.now()},Q=J,Z=/\s/;function ee(t){for(var a=t.length;a--&&Z.test(t.charAt(a)););return a}var te=ee,oe=te,ne=/^\s+/;function re(t){return t&&t.slice(0,oe(t)+1).replace(ne,"")}var ie=re,ae=O,le=ae.Symbol,N=le,I=N,V=Object.prototype,ce=V.hasOwnProperty,se=V.toString,S=I?I.toStringTag:void 0;function de(t){var a=ce.call(t,S),c=t[S];try{t[S]=void 0;var r=!0}catch{}var s=se.call(t);return r&&(a?t[S]=c:delete t[S]),s}var fe=de,ue=Object.prototype,pe=ue.toString;function me(t){return pe.call(t)}var he=me,L=N,ge=fe,be=he,ye="[object Null]",we="[object Undefined]",W=L?L.toStringTag:void 0;function ve(t){return t==null?t===void 0?we:ye:W&&W in Object(t)?ge(t):be(t)}var Te=ve;function xe(t){return t!=null&&typeof t=="object"}var ke=xe,_e=Te,ze=ke,Pe="[object Symbol]";function Se(t){return typeof t=="symbol"||ze(t)&&_e(t)==Pe}var Ee=Se,Be=ie,F=M,$e=Ee,A=0/0,je=/^[-+]0x[0-9a-f]+$/i,Ce=/^0b[01]+$/i,Me=/^0o[0-7]+$/i,Oe=parseInt;function Ne(t){if(typeof t=="number")return t;if($e(t))return A;if(F(t)){var a=typeof t.valueOf=="function"?t.valueOf():t;t=F(a)?a+"":a}if(typeof t!="string")return t===0?t:+t;t=Be(t);var c=Ce.test(t);return c||Me.test(t)?Oe(t.slice(2),c?2:8):je.test(t)?A:+t}var Ie=Ne,Ve=M,j=Q,D=Ie,Le="Expected a function",We=Math.max,Fe=Math.min;function Ae(t,a,c){var r,s,w,b,u,d,v=0,x=!1,T=!1,n=!0;if(typeof t!="function")throw new TypeError(Le);a=D(a)||0,Ve(c)&&(x=!!c.leading,T="maxWait"in c,w=T?We(D(c.maxWait)||0,a):w,n="trailing"in c?!!c.trailing:n);function f(g){var P=r,E=s;return r=s=void 0,v=g,b=t.apply(E,P),b}function p(g){return v=g,u=setTimeout(o,a),x?f(g):b}function l(g){var P=g-d,E=g-v,R=a-P;return T?Fe(R,w-E):R}function y(g){var P=g-d,E=g-v;return d===void 0||P>=a||P<0||T&&E>=w}function o(){var g=j();if(y(g))return i(g);u=setTimeout(o,l(g))}function i(g){return u=void 0,n&&r?f(g):(r=s=void 0,b)}function m(){u!==void 0&&clearTimeout(u),v=0,r=d=s=u=void 0}function h(){return u===void 0?b:i(j())}function z(){var g=j(),P=y(g);if(r=arguments,s=this,d=g,P){if(u===void 0)return p(d);if(T)return clearTimeout(u),u=setTimeout(o,a),f(d)}return u===void 0&&(u=setTimeout(o,a)),b}return z.cancel=m,z.flush=h,z}var C=Ae;const De=e.defineComponent({__name:"PdfPageText",props:{viewport:null,page:null},setup(t){const a=t,c=e.ref(),r=e.ref();e.watch(()=>a.page,async b=>{c.value=await b.getTextContent()},{immediate:!0}),e.watch(()=>[c.value,r.value,a.viewport],()=>{w()});let s;function w(){const b=r.value,u=c.value,d=a.viewport;if(!(!b||!u||!d)){if(s){s.cancel();return}for(;b.firstChild;)b.removeChild(b.firstChild);s=$.renderTextLayer({textContent:c.value,container:b,viewport:d}),s.promise.then(()=>{s=void 0}).catch(()=>{s=void 0}).finally(()=>{})}}return e.onMounted(()=>{w()}),(b,u)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:r,class:"pdf-text-layer"},null,512))}}),Ye="",Re={class:"pdf-page-layout"},Ge={class:"pdf-page-overlay"},Ue={key:0,class:"pdf-page-number"},He=e.defineComponent({__name:"PdfPage",props:{zoom:null,zoomType:null,hideText:{type:Boolean},hideNumber:{type:Boolean},viewport:null,page:null,observer:null},emits:["update:zoom"],setup(t,{expose:a,emit:c}){const r=t,s=e.ref(),w=e.ref(),b=e.ref(!1),u=1100;a({rootEl:w,inViewport:b});const d=96/72,v=e.computed(()=>{const{width:l,height:y}=r.page.getViewport({scale:d}),{width:o,height:i}=r.viewport;let m=0,h=1;switch(r.zoomType){case _.Auto:return m=Math.min(o,u)-40,h=m/l,d*h;case _.WidthFit:return m=o-40,h=m/l,d*h;case _.PageFit:return o>i?(h=i/y,d*h):(m=o-40,h=m/l,d*h)}return d*r.zoom}),x=e.computed(()=>v.value*((window==null?void 0:window.devicePixelRatio)||1)),T=e.computed(()=>r.page.getViewport({scale:v.value})),n=e.computed(()=>r.page.getViewport({scale:x.value}));e.watch(v,l=>{const y=l/d;Math.abs(y-r.zoom)>.05&&c("update:zoom",y)},{immediate:!0});let f;function p(){if(!r.page||!s.value)return;const l=r.page,y=T.value,o=n.value,i=s.value;i.width=Math.ceil(o.width),i.height=Math.ceil(o.height),i.style.width=Math.floor(y.width)+"px",i.style.height=Math.floor(y.height)+"px";const m=i.getContext("2d");if(!m||!b.value)return;if(f){f.cancel();return}console.debug(`rendering page ${l.pageNumber}`);const h={canvasContext:m,viewport:n.value};f=l.render(h),f.promise.then(()=>f=void 0).catch(()=>{f=void 0,p()})}return e.watch(()=>[r.page,x.value,b.value],()=>{p()},{immediate:!0}),e.onMounted(()=>{var l;p(),w.value&&((l=r.observer)==null||l.observe(w.value))}),e.onBeforeUnmount(()=>{var l;w.value&&((l=r.observer)==null||l.unobserve(w.value))}),(l,y)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:w,class:"pdf-page"},[e.createElementVNode("div",Re,[e.createElementVNode("canvas",{ref_key:"canvas",ref:s},null,512),e.createElementVNode("div",Ge,[t.hideText?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(De,{key:0,viewport:e.unref(n),page:t.page},null,8,["viewport","page"])),e.renderSlot(l.$slots,"default",{displaySize:e.unref(n)})])]),t.hideNumber?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ue,e.toDisplayString(t.page.pageNumber),1))],512))}}),Je="",qe={key:0,class:"pdf-progress"},Ke=e.defineComponent({__name:"PdfDocument",props:{hideText:{type:Boolean},hideNumber:{type:Boolean},zoomType:null,zoom:null,viewport:null,src:null},emits:["error","update:zoom"],setup(t,{emit:a}){const c=t,r=e.shallowRef(),s=e.shallowRef([]),w=e.shallowRef(),b=e.ref();let u=[];const d=e.ref(!1),v=e.ref(0);function x(n){n&&(u.push(n),u.length==1&&(n.inViewport=!0))}function T(){s.value.forEach(f=>f.cleanup()),s.value=[];const n=r.value;n&&(n.destroy(),r.value=void 0),u=[]}return e.watch(()=>c.src,n=>{if(T(),!n)return;const f=$.getDocument(n);d.value=!0,f.onProgress=p=>{p.total&&(v.value=p.loaded/p.total)},f.promise.then(p=>{r.value=p;const l=[];for(let y=1;y<=p.numPages;y++)l.push(p.getPage(y));Promise.all(l).then(y=>{p===r.value&&(s.value=y)})}).catch(p=>{a("error",p)}).finally(()=>{d.value=!1})},{immediate:!0}),e.onMounted(()=>{w.value=new IntersectionObserver(C(n=>{n.forEach(f=>{const p=u.find(l=>(l==null?void 0:l.rootEl)===f.target);p&&(p.inViewport=f.isIntersecting)})},50),{rootMargin:"0px"})}),e.onBeforeUnmount(()=>{var n;T(),(n=w.value)==null||n.disconnect()}),(n,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:b},[e.renderSlot(n.$slots,"loading",{src:c.src,loading:d.value,progress:v.value},()=>[d.value?(e.openBlock(),e.createElementBlock("p",qe,"loading "+e.toDisplayString(Math.ceil(100*v.value))+"%",1)):e.createCommentVNode("",!0)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),p=>(e.openBlock(),e.createBlock(He,{ref_for:!0,ref:x,key:p.pageNumber,page:p,"hide-number":t.hideNumber,"hide-text":t.hideText,"zoom-type":t.zoomType,zoom:t.zoom,"onUpdate:zoom":f[0]||(f[0]=l=>a("update:zoom",l)),observer:e.unref(w),viewport:t.viewport},{default:e.withCtx(({displaySize:l})=>[e.renderSlot(n.$slots,"default",{doc:e.unref(r),page:p,displaySize:l})]),_:2},1032,["page","hide-number","hide-text","zoom-type","zoom","observer","viewport"]))),128))],512))}}),Qe="",Xe=e.defineComponent({__name:"PdfHost",props:{workerSrc:null,sources:null,zoomType:null,zoom:null,hideText:{type:Boolean},hideNumber:{type:Boolean}},emits:["update:zoom","update:zoomType"],setup(t,{expose:a,emit:c}){const r=t,s=e.ref();a({zoomIn:x,zoomOut:T}),e.watch(()=>r.workerSrc,o=>{o&&($.GlobalWorkerOptions.workerSrc=o)},{immediate:!0});function w(o){o.ctrlKey&&(o.preventDefault(),o.deltaY<0?x():T())}function b(o){o.ctrlKey&&(o.key==="0"||o.which==48)&&c("update:zoomType",_.Auto)}const u=e.ref({width:0,height:0}),d=C(()=>{const o=s.value;o&&(u.value={width:o.offsetWidth,height:o.offsetHeight})},100);function v(o){const i=o%.25;return Number((o-i).toFixed(2))}function x(){const o=v((r.zoom||1)+.25);c("update:zoom",Math.min(o,2)),c("update:zoomType",_.Custom)}function T(){const o=v((r.zoom||1)-.25);c("update:zoom",Math.max(o,.25)),c("update:zoomType",_.Custom)}e.watch(()=>r.zoom,(o,i)=>{const m=s.value;if(m&&o&&i){const h=m.scrollTop,z=m.scrollLeft,g=o/i;e.nextTick(()=>{m.scrollTop=h*g,m.scrollLeft=z*g})}}),e.onMounted(()=>{window.addEventListener("resize",d),d()}),e.onBeforeUnmount(()=>{window.removeEventListener("resize",d)});const n=[];let f=-1;function p(o){n.push(o)}const l=C(o=>{for(let i=0;i<n.length;i++)if(o.pointerId===n[i].pointerId){n[i]=o;break}if(n.length===2){const i=Math.abs(n[0].clientX-n[1].clientX),m=Math.abs(n[0].clientY-n[1].clientY),h=Math.sqrt(Math.pow(i,2)+Math.pow(m,2));f>0&&(h>f&&x(),h<f&&T()),f=h}},10);function y(o){for(let i=0;i<n.length;i++)if(n[i].pointerId===o.pointerId){n.splice(i,1);break}n.length<2&&(f=-1)}return(o,i)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:s,onWheel:w,onKeydown:b,onPointerdown:p,onPointermove:i[1]||(i[1]=(...m)=>e.unref(l)&&e.unref(l)(...m)),onPointerup:y,onPointercancel:y,onPointerleave:y,onPointerout:y,tabindex:"0",class:"pdf-host"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.sources,m=>(e.openBlock(),e.createBlock(Ke,{viewport:u.value,src:m,"hide-number":!!t.hideNumber,"hide-text":!!t.hideText,"zoom-type":t.zoomType||e.unref(_).Auto,zoom:t.zoom||1,"onUpdate:zoom":i[0]||(i[0]=h=>c("update:zoom",h))},{loading:e.withCtx(({loading:h,progress:z})=>[e.renderSlot(o.$slots,"loading",{source:m,loading:h,progress:z})]),default:e.withCtx(({doc:h,page:z,displaySize:g})=>[e.renderSlot(o.$slots,"page",{source:m,doc:h,page:z,displaySize:g})]),_:2},1032,["viewport","src","hide-number","hide-text","zoom-type","zoom"]))),256)),e.renderSlot(o.$slots,"default")],544))}}),Ze="";k.PdfHost=Xe,k.ZoomType=_,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(k,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pdfjs-dist")):typeof define=="function"&&define.amd?define(["exports","vue","pdfjs-dist"],e):(k=typeof globalThis<"u"?globalThis:k||self,e(k.pdfjsVue3={},k.Vue,k.pdfjsLib))})(this,function(k,e,$){"use strict";var P=(t=>(t[t.Auto=0]="Auto",t[t.WidthFit=1]="WidthFit",t[t.PageFit=2]="PageFit",t[t.Custom=3]="Custom",t))(P||{}),B=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function G(t){var a=typeof t;return t!=null&&(a=="object"||a=="function")}var M=G,U=typeof B=="object"&&B&&B.Object===Object&&B,H=U,q=H,K=typeof self=="object"&&self&&self.Object===Object&&self,X=q||K||Function("return this")(),O=X,Y=O,J=function(){return Y.Date.now()},Q=J,Z=/\s/;function ee(t){for(var a=t.length;a--&&Z.test(t.charAt(a)););return a}var te=ee,oe=te,ne=/^\s+/;function re(t){return t&&t.slice(0,oe(t)+1).replace(ne,"")}var ie=re,ae=O,le=ae.Symbol,N=le,I=N,V=Object.prototype,ce=V.hasOwnProperty,se=V.toString,S=I?I.toStringTag:void 0;function de(t){var a=ce.call(t,S),c=t[S];try{t[S]=void 0;var r=!0}catch{}var s=se.call(t);return r&&(a?t[S]=c:delete t[S]),s}var fe=de,ue=Object.prototype,pe=ue.toString;function me(t){return pe.call(t)}var he=me,L=N,ge=fe,be=he,ye="[object Null]",we="[object Undefined]",W=L?L.toStringTag:void 0;function ve(t){return t==null?t===void 0?we:ye:W&&W in Object(t)?ge(t):be(t)}var Te=ve;function xe(t){return t!=null&&typeof t=="object"}var ke=xe,Pe=Te,_e=ke,ze="[object Symbol]";function Se(t){return typeof t=="symbol"||_e(t)&&Pe(t)==ze}var Ee=Se,Be=ie,F=M,$e=Ee,A=0/0,je=/^[-+]0x[0-9a-f]+$/i,Ce=/^0b[01]+$/i,Me=/^0o[0-7]+$/i,Oe=parseInt;function Ne(t){if(typeof t=="number")return t;if($e(t))return A;if(F(t)){var a=typeof t.valueOf=="function"?t.valueOf():t;t=F(a)?a+"":a}if(typeof t!="string")return t===0?t:+t;t=Be(t);var c=Ce.test(t);return c||Me.test(t)?Oe(t.slice(2),c?2:8):je.test(t)?A:+t}var Ie=Ne,Ve=M,j=Q,D=Ie,Le="Expected a function",We=Math.max,Fe=Math.min;function Ae(t,a,c){var r,s,w,b,u,d,v=0,x=!1,T=!1,n=!0;if(typeof t!="function")throw new TypeError(Le);a=D(a)||0,Ve(c)&&(x=!!c.leading,T="maxWait"in c,w=T?We(D(c.maxWait)||0,a):w,n="trailing"in c?!!c.trailing:n);function f(g){var z=r,E=s;return r=s=void 0,v=g,b=t.apply(E,z),b}function p(g){return v=g,u=setTimeout(o,a),x?f(g):b}function l(g){var z=g-d,E=g-v,R=a-z;return T?Fe(R,w-E):R}function y(g){var z=g-d,E=g-v;return d===void 0||z>=a||z<0||T&&E>=w}function o(){var g=j();if(y(g))return i(g);u=setTimeout(o,l(g))}function i(g){return u=void 0,n&&r?f(g):(r=s=void 0,b)}function m(){u!==void 0&&clearTimeout(u),v=0,r=d=s=u=void 0}function h(){return u===void 0?b:i(j())}function _(){var g=j(),z=y(g);if(r=arguments,s=this,d=g,z){if(u===void 0)return p(d);if(T)return clearTimeout(u),u=setTimeout(o,a),f(d)}return u===void 0&&(u=setTimeout(o,a)),b}return _.cancel=m,_.flush=h,_}var C=Ae;const De=e.defineComponent({__name:"PdfPageText",props:{viewport:null,page:null},setup(t){const a=t,c=e.ref(),r=e.ref();e.watch(()=>a.page,async b=>{c.value=await b.getTextContent()},{immediate:!0}),e.watch(()=>[c.value,r.value,a.viewport],()=>{w()});let s;function w(){const b=r.value,u=c.value,d=a.viewport;if(!(!b||!u||!d)){if(s){s.cancel();return}for(;b.firstChild;)b.removeChild(b.firstChild);s=$.renderTextLayer({textContent:c.value,container:b,viewport:d}),s.promise.then(()=>{s=void 0}).catch(()=>{s=void 0}).finally(()=>{})}}return e.onMounted(()=>{w()}),(b,u)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:r,class:"pdf-text-layer"},null,512))}}),Ye="",Re={class:"pdf-page-layout"},Ge={class:"pdf-page-overlay"},Ue={key:0,class:"pdf-page-number"},He=e.defineComponent({__name:"PdfPage",props:{zoom:null,zoomType:null,hideText:{type:Boolean},hideNumber:{type:Boolean},viewport:null,page:null,observer:null},emits:["update:zoom"],setup(t,{expose:a,emit:c}){const r=t,s=e.ref(),w=e.ref(),b=e.ref(!1),u=1100;a({rootEl:w,inViewport:b});const d=96/72,v=e.computed(()=>{const{width:l,height:y}=r.page.getViewport({scale:d}),{width:o,height:i}=r.viewport;let m=0,h=1;switch(r.zoomType){case P.Auto:return m=Math.min(o,u)-40,h=m/l,d*h;case P.WidthFit:return m=o-40,h=m/l,d*h;case P.PageFit:return o>i?(h=i/y,d*h):(m=o-40,h=m/l,d*h)}return d*r.zoom}),x=e.computed(()=>v.value*((window==null?void 0:window.devicePixelRatio)||1)),T=e.computed(()=>r.page.getViewport({scale:v.value})),n=e.computed(()=>r.page.getViewport({scale:x.value}));e.watch(v,l=>{const y=l/d;Math.abs(y-r.zoom)>.05&&c("update:zoom",y)},{immediate:!0});let f;function p(){if(!r.page||!s.value)return;const l=r.page,y=T.value,o=n.value,i=s.value;i.width=Math.ceil(o.width),i.height=Math.ceil(o.height),i.style.width=Math.floor(y.width)+"px",i.style.height=Math.floor(y.height)+"px";const m=i.getContext("2d");if(!m||!b.value)return;if(f){f.cancel();return}console.debug(`rendering page ${l.pageNumber}`);const h={canvasContext:m,viewport:n.value};f=l.render(h),f.promise.then(()=>f=void 0).catch(()=>{f=void 0,p()})}return e.watch(()=>[r.page,x.value,b.value],()=>{p()},{immediate:!0}),e.onMounted(()=>{var l;p(),w.value&&((l=r.observer)==null||l.observe(w.value))}),e.onBeforeUnmount(()=>{var l;w.value&&((l=r.observer)==null||l.unobserve(w.value))}),(l,y)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:w,class:"pdf-page"},[e.createElementVNode("div",Re,[e.createElementVNode("canvas",{ref_key:"canvas",ref:s},null,512),e.createElementVNode("div",Ge,[t.hideText?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(De,{key:0,viewport:e.unref(n),page:t.page},null,8,["viewport","page"])),e.renderSlot(l.$slots,"default",{displaySize:e.unref(n)})])]),t.hideNumber?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ue,e.toDisplayString(t.page.pageNumber),1))],512))}}),Je="",qe={key:0,class:"pdf-progress"},Ke=e.defineComponent({__name:"PdfDocument",props:{hideText:{type:Boolean},hideNumber:{type:Boolean},zoomType:null,zoom:null,viewport:null,src:null},emits:["error","update:zoom"],setup(t,{emit:a}){const c=t,r=e.shallowRef(),s=e.shallowRef([]),w=e.shallowRef(),b=e.ref();let u=[];const d=e.ref(!1),v=e.ref(0);function x(n){n&&(u.push(n),u.length==1&&(n.inViewport=!0))}function T(){s.value.forEach(f=>f.cleanup()),s.value=[];const n=r.value;n&&(n.destroy(),r.value=void 0),u=[]}return e.watch(()=>c.src,n=>{if(T(),!n)return;const f=$.getDocument(n);d.value=!0,f.onProgress=p=>{p.total&&(v.value=p.loaded/p.total)},f.promise.then(p=>{r.value=p;const l=[];for(let y=1;y<=p.numPages;y++)l.push(p.getPage(y));Promise.all(l).then(y=>{p===r.value&&(s.value=y)})}).catch(p=>{a("error",p)}).finally(()=>{d.value=!1})},{immediate:!0}),e.onMounted(()=>{w.value=new IntersectionObserver(C(n=>{n.forEach(f=>{const p=u.find(l=>(l==null?void 0:l.rootEl)===f.target);p&&(p.inViewport=f.isIntersecting)})},50),{rootMargin:"0px"})}),e.onBeforeUnmount(()=>{var n;T(),(n=w.value)==null||n.disconnect()}),(n,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:b},[e.renderSlot(n.$slots,"loading",{src:c.src,loading:d.value,progress:v.value},()=>[d.value?(e.openBlock(),e.createElementBlock("p",qe,"loading "+e.toDisplayString(Math.ceil(100*v.value))+"%",1)):e.createCommentVNode("",!0)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),p=>(e.openBlock(),e.createBlock(He,{ref_for:!0,ref:x,key:p.pageNumber,page:p,"hide-number":t.hideNumber,"hide-text":t.hideText,"zoom-type":t.zoomType,zoom:t.zoom,"onUpdate:zoom":f[0]||(f[0]=l=>a("update:zoom",l)),observer:e.unref(w),viewport:t.viewport},{default:e.withCtx(({displaySize:l})=>[e.renderSlot(n.$slots,"default",{doc:e.unref(r),page:p,displaySize:l})]),_:2},1032,["page","hide-number","hide-text","zoom-type","zoom","observer","viewport"]))),128))],512))}}),Qe="",Xe=e.defineComponent({__name:"PdfHost",props:{workerSrc:null,sources:null,zoomType:null,zoom:null,hideText:{type:Boolean},hideNumber:{type:Boolean},enablePinchZoom:{type:Boolean}},emits:["update:zoom","update:zoomType"],setup(t,{expose:a,emit:c}){const r=t,s=e.ref();a({zoomIn:x,zoomOut:T}),e.watch(()=>r.workerSrc,o=>{o&&($.GlobalWorkerOptions.workerSrc=o)},{immediate:!0});function w(o){o.ctrlKey&&(o.preventDefault(),o.deltaY<0?x():T())}function b(o){o.ctrlKey&&(o.key==="0"||o.which==48)&&c("update:zoomType",P.Auto)}const u=e.ref({width:0,height:0}),d=C(()=>{const o=s.value;o&&(u.value={width:o.offsetWidth,height:o.offsetHeight})},100);function v(o){const i=o%.25;return Number((o-i).toFixed(2))}function x(){const o=v((r.zoom||1)+.25);c("update:zoom",Math.min(o,2)),c("update:zoomType",P.Custom)}function T(){const o=v((r.zoom||1)-.25);c("update:zoom",Math.max(o,.25)),c("update:zoomType",P.Custom)}e.watch(()=>r.zoom,(o,i)=>{const m=s.value;if(m&&o&&i){const h=m.scrollTop,_=m.scrollLeft,g=o/i;e.nextTick(()=>{m.scrollTop=h*g,m.scrollLeft=_*g})}}),e.onMounted(()=>{window.addEventListener("resize",d),d()}),e.onBeforeUnmount(()=>{window.removeEventListener("resize",d)});const n=[];let f=-1;function p(o){!r.enablePinchZoom||n.push(o)}const l=C(o=>{if(!!r.enablePinchZoom){for(let i=0;i<n.length;i++)if(o.pointerId===n[i].pointerId){n[i]=o;break}if(n.length===2){const i=Math.abs(n[0].clientX-n[1].clientX),m=Math.abs(n[0].clientY-n[1].clientY),h=Math.sqrt(Math.pow(i,2)+Math.pow(m,2));f>0&&(h>f&&x(),h<f&&T()),f=h}}},10);function y(o){if(!!r.enablePinchZoom){for(let i=0;i<n.length;i++)if(n[i].pointerId===o.pointerId){n.splice(i,1);break}n.length<2&&(f=-1)}}return(o,i)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:s,onWheel:w,onKeydown:b,onPointerdown:p,onPointermove:i[1]||(i[1]=(...m)=>e.unref(l)&&e.unref(l)(...m)),onPointerup:y,onPointercancel:y,onPointerleave:y,onPointerout:y,tabindex:"0",class:"pdf-host"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.sources,m=>(e.openBlock(),e.createBlock(Ke,{viewport:u.value,src:m,"hide-number":!!t.hideNumber,"hide-text":!!t.hideText,"zoom-type":t.zoomType||e.unref(P).Auto,zoom:t.zoom||1,"onUpdate:zoom":i[0]||(i[0]=h=>c("update:zoom",h))},{loading:e.withCtx(({loading:h,progress:_})=>[e.renderSlot(o.$slots,"loading",{source:m,loading:h,progress:_})]),default:e.withCtx(({doc:h,page:_,displaySize:g})=>[e.renderSlot(o.$slots,"page",{source:m,doc:h,page:_,displaySize:g})]),_:2},1032,["viewport","src","hide-number","hide-text","zoom-type","zoom"]))),256)),e.renderSlot(o.$slots,"default")],544))}}),Ze="";k.PdfHost=Xe,k.ZoomType=P,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pdfjs-vue3",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Using pdfjs to display PDFs as a vue 3 component.",
|
|
5
|
-
"author": "Eugene Wang",
|
|
6
|
-
"license": "Apache-2.0",
|
|
7
|
-
"homepage": "https://github.com/soukoku/pdfjs-vue",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "https://github.com/soukoku/pdfjs-vue.git"
|
|
11
|
-
},
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/soukoku/pdfjs-vue/issues"
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist/pdfjs*",
|
|
17
|
-
"dist/style*",
|
|
18
|
-
"types/index*",
|
|
19
|
-
"types/types*",
|
|
20
|
-
"types/PdfHost*"
|
|
21
|
-
],
|
|
22
|
-
"types": "./types/index.d.ts",
|
|
23
|
-
"main": "./dist/pdfjs-vue3.umd.js",
|
|
24
|
-
"style": "./dist/style.css",
|
|
25
|
-
"module": "./dist/pdfjs-vue3.es.js",
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"import": "./dist/pdfjs-vue3.es.js",
|
|
29
|
-
"require": "./dist/pdfjs-vue3.umd.js"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"scripts": {
|
|
33
|
-
"dev": "vite",
|
|
34
|
-
"build": "vite build && vue-tsc",
|
|
35
|
-
"build-lib": "vite build -c vite.config.lib.ts && vue-tsc",
|
|
36
|
-
"preview": "vite preview"
|
|
37
|
-
},
|
|
38
|
-
"peerDependencies": {
|
|
39
|
-
"pdfjs-dist": "^2.15.349",
|
|
40
|
-
"vue": "^3.2.37"
|
|
41
|
-
},
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"@babel/types": "^7.18.10",
|
|
44
|
-
"@types/lodash": "^4.14.183",
|
|
45
|
-
"@types/node": "^18.7.6",
|
|
46
|
-
"@vitejs/plugin-vue": "^3.0.3",
|
|
47
|
-
"lodash": "^4.17.21",
|
|
48
|
-
"modern-normalize": "^1.1.0",
|
|
49
|
-
"typescript": "^4.7.4",
|
|
50
|
-
"vite": "^3.0.8",
|
|
51
|
-
"vue-tsc": "^0.40.1"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "pdfjs-vue3",
|
|
3
|
+
"version": "0.1.7",
|
|
4
|
+
"description": "Using pdfjs to display PDFs as a vue 3 component.",
|
|
5
|
+
"author": "Eugene Wang",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"homepage": "https://github.com/soukoku/pdfjs-vue",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/soukoku/pdfjs-vue.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/soukoku/pdfjs-vue/issues"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist/pdfjs*",
|
|
17
|
+
"dist/style*",
|
|
18
|
+
"types/index*",
|
|
19
|
+
"types/types*",
|
|
20
|
+
"types/PdfHost*"
|
|
21
|
+
],
|
|
22
|
+
"types": "./types/index.d.ts",
|
|
23
|
+
"main": "./dist/pdfjs-vue3.umd.js",
|
|
24
|
+
"style": "./dist/style.css",
|
|
25
|
+
"module": "./dist/pdfjs-vue3.es.js",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"import": "./dist/pdfjs-vue3.es.js",
|
|
29
|
+
"require": "./dist/pdfjs-vue3.umd.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"dev": "vite",
|
|
34
|
+
"build": "vite build && vue-tsc",
|
|
35
|
+
"build-lib": "vite build -c vite.config.lib.ts && vue-tsc",
|
|
36
|
+
"preview": "vite preview"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"pdfjs-dist": "^2.15.349",
|
|
40
|
+
"vue": "^3.2.37"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@babel/types": "^7.18.10",
|
|
44
|
+
"@types/lodash": "^4.14.183",
|
|
45
|
+
"@types/node": "^18.7.6",
|
|
46
|
+
"@vitejs/plugin-vue": "^3.0.3",
|
|
47
|
+
"lodash": "^4.17.21",
|
|
48
|
+
"modern-normalize": "^1.1.0",
|
|
49
|
+
"typescript": "^4.7.4",
|
|
50
|
+
"vite": "^3.0.8",
|
|
51
|
+
"vue-tsc": "^0.40.1"
|
|
52
|
+
}
|
|
53
|
+
}
|
package/types/PdfHost.vue.d.ts
CHANGED
|
@@ -29,6 +29,10 @@ declare const _default: {
|
|
|
29
29
|
* Hides page number display.
|
|
30
30
|
*/
|
|
31
31
|
hideNumber?: boolean | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Experimental flag to enable pinch zoom gesture.
|
|
34
|
+
*/
|
|
35
|
+
enablePinchZoom?: boolean | undefined;
|
|
32
36
|
}>>> & {
|
|
33
37
|
"onUpdate:zoom"?: ((zoom: number) => any) | undefined;
|
|
34
38
|
"onUpdate:zoomType"?: ((zoomType: ZoomType) => any) | undefined;
|
|
@@ -71,6 +75,10 @@ declare const _default: {
|
|
|
71
75
|
* Hides page number display.
|
|
72
76
|
*/
|
|
73
77
|
hideNumber?: boolean | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Experimental flag to enable pinch zoom gesture.
|
|
80
|
+
*/
|
|
81
|
+
enablePinchZoom?: boolean | undefined;
|
|
74
82
|
}>>> & {
|
|
75
83
|
"onUpdate:zoom"?: ((zoom: number) => any) | undefined;
|
|
76
84
|
"onUpdate:zoomType"?: ((zoomType: ZoomType) => any) | undefined;
|
|
@@ -132,6 +140,10 @@ declare const _default: {
|
|
|
132
140
|
* Hides page number display.
|
|
133
141
|
*/
|
|
134
142
|
hideNumber?: boolean | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* Experimental flag to enable pinch zoom gesture.
|
|
145
|
+
*/
|
|
146
|
+
enablePinchZoom?: boolean | undefined;
|
|
135
147
|
}>>> & {
|
|
136
148
|
"onUpdate:zoom"?: ((zoom: number) => any) | undefined;
|
|
137
149
|
"onUpdate:zoomType"?: ((zoomType: ZoomType) => any) | undefined;
|
|
@@ -173,6 +185,10 @@ declare const _default: {
|
|
|
173
185
|
* Hides page number display.
|
|
174
186
|
*/
|
|
175
187
|
hideNumber?: boolean | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* Experimental flag to enable pinch zoom gesture.
|
|
190
|
+
*/
|
|
191
|
+
enablePinchZoom?: boolean | undefined;
|
|
176
192
|
}>>> & {
|
|
177
193
|
"onUpdate:zoom"?: ((zoom: number) => any) | undefined;
|
|
178
194
|
"onUpdate:zoomType"?: ((zoomType: ZoomType) => any) | undefined;
|