@sv-print/plugin-api-image 0.2.2 → 0.2.4
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/index.js +1 -1
- package/dist/index.mjs +123 -114
- package/dist/index.umd.js +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var F=(s,t,x)=>new Promise((a,l)=>{var m=n=>{try{w(x.next(n))}catch(c){l(c)}},u=n=>{try{w(x.throw(n))}catch(c){l(c)}},w=n=>n.done?a(n.value):Promise.resolve(n.value).then(m,u);w((x=x.apply(s,t)).next())});const O=require("@zumer/snapdom");(function(s,t){const x=D,a=s();for(;;)try{if(parseInt(x(367))/1*(parseInt(x(434))/2)+-parseInt(x(406))/3*(parseInt(x(366))/4)+parseInt(x(371))/5+parseInt(x(398))/6+-parseInt(x(412))/7*(-parseInt(x(403))/8)+-parseInt(x(407))/9*(-parseInt(x(363))/10)+-parseInt(x(372))/11===t)break;a.push(a.shift())}catch(l){a.push(a.shift())}})(j,498061);const S=function(s,t){return F(this,null,function*(){const x=D;let a=this,l=globalThis.$[x(416)](),m=!0,u=10,w=(n,c)=>{const h=x,A=Math[h(432)](n/c*100);console.log(h(384),n,"total",c),console[h(399)](h(379),A+"%")};if(this[x(417)][x(422)]){let n=globalThis.$.extend({backgroundColor:x(364)},t||{}),c=yield this[x(401)](s,t);t&&(t[x(394)]&&(n[x(369)]=t[x(394)]),t[x(378)]!=null&&(m=t[x(378)]),t[x(409)]!=null&&(w=t[x(409)]),t[x(420)]!=null&&(u=t.limit)),globalThis.$(c).css("width","")[x(433)]("height",""),this[x(365)]();let h=this.getTempContainer();this[x(418)](c,n),h[x(389)](c[0]);const A=x(380);let G=h[x(419)](A)[x(422)];globalThis.$(c)[x(433)](x(396)),this[x(388)](h,function(){const i=x;try{let I=[],C=Math[i(377)](G/u),K=G%u||1;const y=document[i(413)]("canvas"),M=y[i(395)]("2d");for(let P=0;P<C;P++){const R=P==C-1&&C>1;let $=R?K:u,k=[];for(let _=0;_<$;_++){const e=P*u+_,f=h[i(419)](A)[e];globalThis[i(391)][i(421)].add(function(v){const b=i;O.snapdom[b(376)](f,n).then(function(r){const d=b;let p=r[d(395)]("2d");p.imageSmoothingEnabled=!1;let g=r[d(386)](d(404),n[d(387)]||.92),T=new Image;T.src=g,T[d(400)]=function(){k[d(431)]({image:T,idx:e}),w(e+1,G),v()}})})}globalThis[i(391)][i(421)][i(411)](function(_){const e=i;k.sort((r,d)=>r[e(385)]-d[e(385)]);let f=0,v=0;for(const r of k)r[e(405)][e(437)]>f&&(f=r.image.width),v+=r.image[e(390)];y[e(437)]=f,y[e(390)]=v,M.fillStyle=e(364),M[e(374)](0,0,f,v);let b=0;for(const r of k)M.drawImage(r[e(405)],0,b,r[e(405)][e(437)],r[e(405)][e(390)]),b+=r[e(405)].height;_()}),globalThis[i(391)].queue[i(411)](function(_){const e=i;let f=n[e(393)]||e(404),v=n[e(383)]||e(408),b=n[e(387)]||.8,r=R||C==1;if(m){let d=y[e(386)](f,b),p=new Image;p.src=d,p[e(400)]=function(){const g=e;I[g(431)]({url:d,start:P*u+1,end:P*u+$}),r&&(globalThis[g(391)][g(421)][g(423)](),a[g(427)](),I[g(370)](T=>{const o=g;let q=document[o(413)]("a"),H=n.name||o(424);H[o(435)](".")==-1&&(H+=o(425));let B=H.split(".")[o(381)](),L=H[o(373)]("."+B,"")+"_"+T.start+"-"+T[o(426)]+"."+B;q[o(436)].display=o(375),q[o(430)](o(414),L),q.setAttribute(o(382),T[o(408)]),document[o(415)][o(397)](q),q[o(368)](),q[o(362)]()})),_()};return}if(v==e(408)){I[e(431)](y[e(386)](f,b)),r&&(globalThis.hinnn.queue[e(423)](),a[e(427)](),l[e(410)](I)),_();return}v==e(428)&&y[e(392)](function(d){const p=e;I.push(d),r&&(globalThis[p(391)][p(421)][p(423)](),a[p(427)](),l[p(410)](I)),_()},f,b)})}globalThis[i(391)].queue.run()}catch(I){console[i(429)]("toImage 失败(可能您的图片资源无法正常加载): "),console[i(399)](I)}})}return l[x(402)]()})};function j(){const s=["setAttribute","push","floor","css","12108eqZdzd","indexOf","style","width","remove","33470IfnIFc","#fff","createTempContainer","2012PoesHP","18GecEqg","click","dpr","forEach","2791600fyxSiZ","2021492HzigUA","replace","fillRect","none","toCanvas","ceil","isDownload","toImage percent: ","> .hiprint-printTemplate > .hiprint-printPanel > .hiprint-printPaper","pop","href","toType","cur","idx","toDataURL","quality","loadAllImages","html","height","hinnn","toBlob","type","pixelRatio","getContext","position:fixed","appendChild","2145948FTFzGK","log","onload","getHtml","promise","104rTqpmR","image/jpeg","image","2967LPUwJn","99GwaYvs","url","onProgress","resolve","add","63287CAjxoM","createElement","download","body","Deferred","printPanels","svg2canvas","find","limit","queue","length","clear","download.jpg",".jpg","end","removeTempContainer","blob","error"];return j=function(){return s},j()}function D(s,t){const x=j();return D=function(a,l){return a=a-362,x[a]},D(s,t)}function E(s,t){var x=z();return E=function(a,l){a=a-220;var m=x[a];return m},E(s,t)}(function(s,t){for(var x=E,a=s();;)try{var l=parseInt(x(230))/1*(-parseInt(x(232))/2)+parseInt(x(227))/3*(-parseInt(x(220))/4)+-parseInt(x(221))/5*(parseInt(x(223))/6)+parseInt(x(224))/7+parseInt(x(225))/8+-parseInt(x(233))/9+parseInt(x(234))/10;if(l===t)break;a.push(a.shift())}catch(m){a.push(a.shift())}})(z,858286);function U(s){var t=E;return{name:t(222),description:t(222),hooks:[{hook:t(235),name:t(229),description:t(229),priority:1,run:({template:x,options:a})=>{var l=t;Object[l(228)](x,l(226),{value:S,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:t(231)}}function z(){var s=["60744dpuzyh","defineProperty","add toImage Api to PrintTemplate","257429jceYHb","0.3.0","6qeBAkD","7497612hcOKrf","8769310KdGVTm","newPrintTemplate","8PHLvmH","2948190WPWEBo","add toImage Api","6VodhiM","11559555dgpZDx","4523832PvdXct","toImage"];return z=function(){return s},z()}module.exports=U;
|
package/dist/index.mjs
CHANGED
|
@@ -1,148 +1,157 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var F = (s, t, x) => new Promise((a, l) => {
|
|
2
|
+
var m = (n) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
5
|
-
} catch (
|
|
6
|
-
|
|
4
|
+
w(x.next(n));
|
|
5
|
+
} catch (c) {
|
|
6
|
+
l(c);
|
|
7
7
|
}
|
|
8
|
-
}, u = (
|
|
8
|
+
}, u = (n) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
|
|
10
|
+
w(x.throw(n));
|
|
11
|
+
} catch (c) {
|
|
12
|
+
l(c);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, w = (n) => n.done ? a(n.value) : Promise.resolve(n.value).then(m, u);
|
|
15
|
+
w((x = x.apply(s, t)).next());
|
|
16
16
|
});
|
|
17
|
-
import { snapdom as
|
|
18
|
-
function
|
|
19
|
-
const
|
|
20
|
-
return j = function() {
|
|
21
|
-
return r;
|
|
22
|
-
}, j();
|
|
23
|
-
}
|
|
24
|
-
function R(r, e) {
|
|
25
|
-
const x = j();
|
|
26
|
-
return R = function(n, i) {
|
|
27
|
-
return n = n - 381, x[n];
|
|
28
|
-
}, R(r, e);
|
|
29
|
-
}
|
|
30
|
-
(function(r, e) {
|
|
31
|
-
const x = R, n = r();
|
|
17
|
+
import { snapdom as O } from "@zumer/snapdom";
|
|
18
|
+
(function(s, t) {
|
|
19
|
+
const x = D, a = s();
|
|
32
20
|
for (; ; )
|
|
33
21
|
try {
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
} catch (
|
|
37
|
-
|
|
22
|
+
if (parseInt(x(367)) / 1 * (parseInt(x(434)) / 2) + -parseInt(x(406)) / 3 * (parseInt(x(366)) / 4) + parseInt(x(371)) / 5 + parseInt(x(398)) / 6 + -parseInt(x(412)) / 7 * (-parseInt(x(403)) / 8) + -parseInt(x(407)) / 9 * (-parseInt(x(363)) / 10) + -parseInt(x(372)) / 11 === t) break;
|
|
23
|
+
a.push(a.shift());
|
|
24
|
+
} catch (l) {
|
|
25
|
+
a.push(a.shift());
|
|
38
26
|
}
|
|
39
|
-
})(j,
|
|
40
|
-
const
|
|
41
|
-
return
|
|
42
|
-
const x =
|
|
43
|
-
let
|
|
44
|
-
const
|
|
45
|
-
console
|
|
27
|
+
})(j, 498061);
|
|
28
|
+
const S = function(s, t) {
|
|
29
|
+
return F(this, null, function* () {
|
|
30
|
+
const x = D;
|
|
31
|
+
let a = this, l = globalThis.$[x(416)](), m = !0, u = 10, w = (n, c) => {
|
|
32
|
+
const h = x, A = Math[h(432)](n / c * 100);
|
|
33
|
+
console.log(h(384), n, "total", c), console[h(399)](h(379), A + "%");
|
|
46
34
|
};
|
|
47
|
-
if (this[x(
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
let
|
|
51
|
-
this[x(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
35
|
+
if (this[x(417)][x(422)]) {
|
|
36
|
+
let n = globalThis.$.extend({ backgroundColor: x(364) }, t || {}), c = yield this[x(401)](s, t);
|
|
37
|
+
t && (t[x(394)] && (n[x(369)] = t[x(394)]), t[x(378)] != null && (m = t[x(378)]), t[x(409)] != null && (w = t[x(409)]), t[x(420)] != null && (u = t.limit)), globalThis.$(c).css("width", "")[x(433)]("height", ""), this[x(365)]();
|
|
38
|
+
let h = this.getTempContainer();
|
|
39
|
+
this[x(418)](c, n), h[x(389)](c[0]);
|
|
40
|
+
const A = x(380);
|
|
41
|
+
let G = h[x(419)](A)[x(422)];
|
|
42
|
+
globalThis.$(c)[x(433)](x(396)), this[x(388)](h, function() {
|
|
43
|
+
const i = x;
|
|
55
44
|
try {
|
|
56
|
-
let
|
|
57
|
-
const
|
|
58
|
-
for (let
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
let
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
a[s(422)] = A, a[s(429)] = function() {
|
|
73
|
-
const l = s;
|
|
74
|
-
_ === 0 && (d[l(441)] = H, d[l(401)] = a.height * D), M += a[l(401)], q[l(438)](a, 0, M - a[l(401)], H, a.height), v(c + 1, w), k();
|
|
45
|
+
let I = [], C = Math[i(377)](G / u), K = G % u || 1;
|
|
46
|
+
const y = document[i(413)]("canvas"), M = y[i(395)]("2d");
|
|
47
|
+
for (let P = 0; P < C; P++) {
|
|
48
|
+
const R = P == C - 1 && C > 1;
|
|
49
|
+
let $ = R ? K : u, k = [];
|
|
50
|
+
for (let _ = 0; _ < $; _++) {
|
|
51
|
+
const e = P * u + _, f = h[i(419)](A)[e];
|
|
52
|
+
globalThis[i(391)][i(421)].add(function(v) {
|
|
53
|
+
const b = i;
|
|
54
|
+
O[b(376)](f, n).then(function(r) {
|
|
55
|
+
const d = b;
|
|
56
|
+
let p = r[d(395)]("2d");
|
|
57
|
+
p.imageSmoothingEnabled = !1;
|
|
58
|
+
let g = r[d(386)](d(404), n[d(387)] || 0.92), T = new Image();
|
|
59
|
+
T.src = g, T[d(400)] = function() {
|
|
60
|
+
k[d(431)]({ image: T, idx: e }), w(e + 1, G), v();
|
|
75
61
|
};
|
|
76
62
|
});
|
|
77
63
|
});
|
|
78
64
|
}
|
|
79
|
-
globalThis[
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
65
|
+
globalThis[i(391)][i(421)][i(411)](function(_) {
|
|
66
|
+
const e = i;
|
|
67
|
+
k.sort((r, d) => r[e(385)] - d[e(385)]);
|
|
68
|
+
let f = 0, v = 0;
|
|
69
|
+
for (const r of k)
|
|
70
|
+
r[e(405)][e(437)] > f && (f = r.image.width), v += r.image[e(390)];
|
|
71
|
+
y[e(437)] = f, y[e(390)] = v, M.fillStyle = e(364), M[e(374)](0, 0, f, v);
|
|
72
|
+
let b = 0;
|
|
73
|
+
for (const r of k)
|
|
74
|
+
M.drawImage(r[e(405)], 0, b, r[e(405)][e(437)], r[e(405)][e(390)]), b += r[e(405)].height;
|
|
75
|
+
_();
|
|
76
|
+
}), globalThis[i(391)].queue[i(411)](function(_) {
|
|
77
|
+
const e = i;
|
|
78
|
+
let f = n[e(393)] || e(404), v = n[e(383)] || e(408), b = n[e(387)] || 0.8, r = R || C == 1;
|
|
79
|
+
if (m) {
|
|
80
|
+
let d = y[e(386)](f, b), p = new Image();
|
|
81
|
+
p.src = d, p[e(400)] = function() {
|
|
82
|
+
const g = e;
|
|
83
|
+
I[g(431)]({ url: d, start: P * u + 1, end: P * u + $ }), r && (globalThis[g(391)][g(421)][g(423)](), a[g(427)](), I[g(370)]((T) => {
|
|
84
|
+
const o = g;
|
|
85
|
+
let q = document[o(413)]("a"), H = n.name || o(424);
|
|
86
|
+
H[o(435)](".") == -1 && (H += o(425));
|
|
87
|
+
let B = H.split(".")[o(381)](), L = H[o(373)]("." + B, "") + "_" + T.start + "-" + T[o(426)] + "." + B;
|
|
88
|
+
q[o(436)].display = o(375), q[o(430)](o(414), L), q.setAttribute(o(382), T[o(408)]), document[o(415)][o(397)](q), q[o(368)](), q[o(362)]();
|
|
92
89
|
})), _();
|
|
93
90
|
};
|
|
94
91
|
return;
|
|
95
92
|
}
|
|
96
|
-
if (
|
|
97
|
-
|
|
93
|
+
if (v == e(408)) {
|
|
94
|
+
I[e(431)](y[e(386)](f, b)), r && (globalThis.hinnn.queue[e(423)](), a[e(427)](), l[e(410)](I)), _();
|
|
98
95
|
return;
|
|
99
96
|
}
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
},
|
|
97
|
+
v == e(428) && y[e(392)](function(d) {
|
|
98
|
+
const p = e;
|
|
99
|
+
I.push(d), r && (globalThis[p(391)][p(421)][p(423)](), a[p(427)](), l[p(410)](I)), _();
|
|
100
|
+
}, f, b);
|
|
104
101
|
});
|
|
105
102
|
}
|
|
106
|
-
globalThis[
|
|
107
|
-
} catch (
|
|
108
|
-
console
|
|
103
|
+
globalThis[i(391)].queue.run();
|
|
104
|
+
} catch (I) {
|
|
105
|
+
console[i(429)]("toImage 失败(可能您的图片资源无法正常加载): "), console[i(399)](I);
|
|
109
106
|
}
|
|
110
107
|
});
|
|
111
108
|
}
|
|
112
|
-
return
|
|
109
|
+
return l[x(402)]();
|
|
113
110
|
});
|
|
114
111
|
};
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
return
|
|
118
|
-
return
|
|
119
|
-
},
|
|
112
|
+
function j() {
|
|
113
|
+
const s = ["setAttribute", "push", "floor", "css", "12108eqZdzd", "indexOf", "style", "width", "remove", "33470IfnIFc", "#fff", "createTempContainer", "2012PoesHP", "18GecEqg", "click", "dpr", "forEach", "2791600fyxSiZ", "2021492HzigUA", "replace", "fillRect", "none", "toCanvas", "ceil", "isDownload", "toImage percent: ", "> .hiprint-printTemplate > .hiprint-printPanel > .hiprint-printPaper", "pop", "href", "toType", "cur", "idx", "toDataURL", "quality", "loadAllImages", "html", "height", "hinnn", "toBlob", "type", "pixelRatio", "getContext", "position:fixed", "appendChild", "2145948FTFzGK", "log", "onload", "getHtml", "promise", "104rTqpmR", "image/jpeg", "image", "2967LPUwJn", "99GwaYvs", "url", "onProgress", "resolve", "add", "63287CAjxoM", "createElement", "download", "body", "Deferred", "printPanels", "svg2canvas", "find", "limit", "queue", "length", "clear", "download.jpg", ".jpg", "end", "removeTempContainer", "blob", "error"];
|
|
114
|
+
return j = function() {
|
|
115
|
+
return s;
|
|
116
|
+
}, j();
|
|
117
|
+
}
|
|
118
|
+
function D(s, t) {
|
|
119
|
+
const x = j();
|
|
120
|
+
return D = function(a, l) {
|
|
121
|
+
return a = a - 362, x[a];
|
|
122
|
+
}, D(s, t);
|
|
123
|
+
}
|
|
124
|
+
function E(s, t) {
|
|
125
|
+
var x = z();
|
|
126
|
+
return E = function(a, l) {
|
|
127
|
+
a = a - 220;
|
|
128
|
+
var m = x[a];
|
|
129
|
+
return m;
|
|
130
|
+
}, E(s, t);
|
|
120
131
|
}
|
|
121
|
-
(function(
|
|
122
|
-
for (var x =
|
|
132
|
+
(function(s, t) {
|
|
133
|
+
for (var x = E, a = s(); ; )
|
|
123
134
|
try {
|
|
124
|
-
var
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
} catch (
|
|
128
|
-
|
|
135
|
+
var l = parseInt(x(230)) / 1 * (-parseInt(x(232)) / 2) + parseInt(x(227)) / 3 * (-parseInt(x(220)) / 4) + -parseInt(x(221)) / 5 * (parseInt(x(223)) / 6) + parseInt(x(224)) / 7 + parseInt(x(225)) / 8 + -parseInt(x(233)) / 9 + parseInt(x(234)) / 10;
|
|
136
|
+
if (l === t) break;
|
|
137
|
+
a.push(a.shift());
|
|
138
|
+
} catch (m) {
|
|
139
|
+
a.push(a.shift());
|
|
129
140
|
}
|
|
130
|
-
})(
|
|
131
|
-
function
|
|
132
|
-
var
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}, F(r, e);
|
|
141
|
+
})(z, 858286);
|
|
142
|
+
function Z(s) {
|
|
143
|
+
var t = E;
|
|
144
|
+
return { name: t(222), description: t(222), hooks: [{ hook: t(235), name: t(229), description: t(229), priority: 1, run: ({ template: x, options: a }) => {
|
|
145
|
+
var l = t;
|
|
146
|
+
Object[l(228)](x, l(226), { value: S, enumerable: !1, writable: !0, configurable: !0 });
|
|
147
|
+
} }], leastHiprintVersion: t(231) };
|
|
138
148
|
}
|
|
139
|
-
function
|
|
140
|
-
var
|
|
141
|
-
return
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
} }], leastHiprintVersion: e(484) };
|
|
149
|
+
function z() {
|
|
150
|
+
var s = ["60744dpuzyh", "defineProperty", "add toImage Api to PrintTemplate", "257429jceYHb", "0.3.0", "6qeBAkD", "7497612hcOKrf", "8769310KdGVTm", "newPrintTemplate", "8PHLvmH", "2948190WPWEBo", "add toImage Api", "6VodhiM", "11559555dgpZDx", "4523832PvdXct", "toImage"];
|
|
151
|
+
return z = function() {
|
|
152
|
+
return s;
|
|
153
|
+
}, z();
|
|
145
154
|
}
|
|
146
155
|
export {
|
|
147
|
-
|
|
156
|
+
Z as default
|
|
148
157
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(g,T){typeof exports=="object"&&typeof module!="undefined"?module.exports=T(require("@zumer/snapdom")):typeof define=="function"&&define.amd?define(["@zumer/snapdom"],T):(g=typeof globalThis!="undefined"?globalThis:g||self,g.pluginApiImage=T(g.window))})(this,function(g){"use strict";var O=(g,T,p)=>new Promise((q,v)=>{var M=t=>{try{a(p.next(t))}catch(x){v(x)}},A=t=>{try{a(p.throw(t))}catch(x){v(x)}},a=t=>t.done?q(t.value):Promise.resolve(t.value).then(M,A);a((p=p.apply(g,T)).next())});(function(a,t){const x=q,n=a();for(;;)try{if(parseInt(x(367))/1*(parseInt(x(434))/2)+-parseInt(x(406))/3*(parseInt(x(366))/4)+parseInt(x(371))/5+parseInt(x(398))/6+-parseInt(x(412))/7*(-parseInt(x(403))/8)+-parseInt(x(407))/9*(-parseInt(x(363))/10)+-parseInt(x(372))/11===t)break;n.push(n.shift())}catch(d){n.push(n.shift())}})(p,498061);const T=function(a,t){return O(this,null,function*(){const x=q;let n=this,d=globalThis.$[x(416)](),C=!0,w=10,B=(l,y)=>{const u=x,z=Math[u(432)](l/y*100);console.log(u(384),l,"total",y),console[u(399)](u(379),z+"%")};if(this[x(417)][x(422)]){let l=globalThis.$.extend({backgroundColor:x(364)},t||{}),y=yield this[x(401)](a,t);t&&(t[x(394)]&&(l[x(369)]=t[x(394)]),t[x(378)]!=null&&(C=t[x(378)]),t[x(409)]!=null&&(B=t[x(409)]),t[x(420)]!=null&&(w=t.limit)),globalThis.$(y).css("width","")[x(433)]("height",""),this[x(365)]();let u=this.getTempContainer();this[x(418)](y,l),u[x(389)](y[0]);const z=x(380);let R=u[x(419)](z)[x(422)];globalThis.$(y)[x(433)](x(396)),this[x(388)](u,function(){const i=x;try{let b=[],D=Math[i(377)](R/w),S=R%w||1;const j=document[i(413)]("canvas"),$=j[i(395)]("2d");for(let k=0;k<D;k++){const F=k==D-1&&D>1;let K=F?S:w,E=[];for(let h=0;h<K;h++){const e=k*w+h,c=u[i(419)](z)[e];globalThis[i(391)][i(421)].add(function(I){const _=i;g.snapdom[_(376)](c,l).then(function(r){const s=_;let f=r[s(395)]("2d");f.imageSmoothingEnabled=!1;let m=r[s(386)](s(404),l[s(387)]||.92),P=new Image;P.src=m,P[s(400)]=function(){E[s(431)]({image:P,idx:e}),B(e+1,R),I()}})})}globalThis[i(391)][i(421)][i(411)](function(h){const e=i;E.sort((r,s)=>r[e(385)]-s[e(385)]);let c=0,I=0;for(const r of E)r[e(405)][e(437)]>c&&(c=r.image.width),I+=r.image[e(390)];j[e(437)]=c,j[e(390)]=I,$.fillStyle=e(364),$[e(374)](0,0,c,I);let _=0;for(const r of E)$.drawImage(r[e(405)],0,_,r[e(405)][e(437)],r[e(405)][e(390)]),_+=r[e(405)].height;h()}),globalThis[i(391)].queue[i(411)](function(h){const e=i;let c=l[e(393)]||e(404),I=l[e(383)]||e(408),_=l[e(387)]||.8,r=F||D==1;if(C){let s=j[e(386)](c,_),f=new Image;f.src=s,f[e(400)]=function(){const m=e;b[m(431)]({url:s,start:k*w+1,end:k*w+K}),r&&(globalThis[m(391)][m(421)][m(423)](),n[m(427)](),b[m(370)](P=>{const o=m;let H=document[o(413)]("a"),G=l.name||o(424);G[o(435)](".")==-1&&(G+=o(425));let L=G.split(".")[o(381)](),U=G[o(373)]("."+L,"")+"_"+P.start+"-"+P[o(426)]+"."+L;H[o(436)].display=o(375),H[o(430)](o(414),U),H.setAttribute(o(382),P[o(408)]),document[o(415)][o(397)](H),H[o(368)](),H[o(362)]()})),h()};return}if(I==e(408)){b[e(431)](j[e(386)](c,_)),r&&(globalThis.hinnn.queue[e(423)](),n[e(427)](),d[e(410)](b)),h();return}I==e(428)&&j[e(392)](function(s){const f=e;b.push(s),r&&(globalThis[f(391)][f(421)][f(423)](),n[f(427)](),d[f(410)](b)),h()},c,_)})}globalThis[i(391)].queue.run()}catch(b){console[i(429)]("toImage 失败(可能您的图片资源无法正常加载): "),console[i(399)](b)}})}return d[x(402)]()})};function p(){const a=["setAttribute","push","floor","css","12108eqZdzd","indexOf","style","width","remove","33470IfnIFc","#fff","createTempContainer","2012PoesHP","18GecEqg","click","dpr","forEach","2791600fyxSiZ","2021492HzigUA","replace","fillRect","none","toCanvas","ceil","isDownload","toImage percent: ","> .hiprint-printTemplate > .hiprint-printPanel > .hiprint-printPaper","pop","href","toType","cur","idx","toDataURL","quality","loadAllImages","html","height","hinnn","toBlob","type","pixelRatio","getContext","position:fixed","appendChild","2145948FTFzGK","log","onload","getHtml","promise","104rTqpmR","image/jpeg","image","2967LPUwJn","99GwaYvs","url","onProgress","resolve","add","63287CAjxoM","createElement","download","body","Deferred","printPanels","svg2canvas","find","limit","queue","length","clear","download.jpg",".jpg","end","removeTempContainer","blob","error"];return p=function(){return a},p()}function q(a,t){const x=p();return q=function(n,d){return n=n-362,x[n]},q(a,t)}function v(a,t){var x=A();return v=function(n,d){n=n-220;var C=x[n];return C},v(a,t)}(function(a,t){for(var x=v,n=a();;)try{var d=parseInt(x(230))/1*(-parseInt(x(232))/2)+parseInt(x(227))/3*(-parseInt(x(220))/4)+-parseInt(x(221))/5*(parseInt(x(223))/6)+parseInt(x(224))/7+parseInt(x(225))/8+-parseInt(x(233))/9+parseInt(x(234))/10;if(d===t)break;n.push(n.shift())}catch(C){n.push(n.shift())}})(A,858286);function M(a){var t=v;return{name:t(222),description:t(222),hooks:[{hook:t(235),name:t(229),description:t(229),priority:1,run:({template:x,options:n})=>{var d=t;Object[d(228)](x,d(226),{value:T,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:t(231)}}function A(){var a=["60744dpuzyh","defineProperty","add toImage Api to PrintTemplate","257429jceYHb","0.3.0","6qeBAkD","7497612hcOKrf","8769310KdGVTm","newPrintTemplate","8PHLvmH","2948190WPWEBo","add toImage Api","6VodhiM","11559555dgpZDx","4523832PvdXct","toImage"];return A=function(){return a},A()}return M});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sv-print/plugin-api-image",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "add image api to print template",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"author": "",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@zumer/snapdom": "^2.0.1"
|
|
36
|
-
"sv-print": "^0.2.0"
|
|
35
|
+
"@zumer/snapdom": "^2.0.1"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
38
|
+
"sv-print": "^0.2.0",
|
|
39
39
|
"vite-plugin-javascript-obfuscator": "^3.1.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|