@sv-print/plugin-api-image 0.2.0 → 0.2.2

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 CHANGED
@@ -1,37 +1 @@
1
- "use strict";var V=(o,e,x)=>new Promise((a,s)=>{var g=i=>{try{k(x.next(i))}catch(c){s(c)}},u=i=>{try{k(x.throw(i))}catch(c){s(c)}},k=i=>i.done?a(i.value):Promise.resolve(i.value).then(g,u);k((x=x.apply(o,e)).next())});const J=require("@zumer/snapdom");(function(o,e){const x=j,a=o();for(;[];)try{if(parseInt(x(211))/1*(-parseInt(x(251))/2)+parseInt(x(245))/3*(-parseInt(x(242))/4)+parseInt(x(256))/5+-parseInt(x(265))/6*(parseInt(x(179))/7)+parseInt(x(194))/8+parseInt(x(192))/9+-parseInt(x(234))/10*(-parseInt(x(178))/11)===e)break;a.push(a.shift())}catch(s){a.push(a.shift())}})(E,991907);function E(){const o=["limit","indexOf",'<div class="hiprint-printTemplate"></div>',"toBlob","devicePixelRatio","floor","getContext","extend","replace","cur",`<div class="hiprint-printPanel">
2
- <div class="hiprint-printPaper" style="width:`,"push","10YnsMhd","mm ","printPanels","total","src","paperHeight","mm;height:","getTempContainer","8eDbbnX","css","setAttribute","594483XRowmQ","min","layoutRowGap","clearRect","name","removeTempContainer","932ygrPYT",`mm;
3
- }
4
- </style>`,"none","createElement","removeClass","408110KjYHgg","toDataURL","isDownload","start","loadAllImages","layoutColumnGap","panelLayoutOptions","clone","append","120CMfTqq","log","resolve","then","quality",".hiprint-printPanel .hiprint-printPaper","svg2canvas","height","find","20157643HusFlM","323043sVZSoM","pixelRatio","onProgress","html","createTempContainer","end","width","promise","add","download","image/jpeg","clear","pop","7153794EyDTgg",".hiprint-printPanel","6171216rQnmMY","hinnn","onload","url","paperWidth","getHtml","row","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","canvas","length","imageSmoothingEnabled","forEach","toImage percent: ",`mm;"></div>
5
- </div>`,"toCanvas","style",`<style>
6
- .hiprint-printPanel-small{
7
- box-sizing: border-box;
8
- border: 0px;
9
- }
10
- .hiprint-printPaper-small{
11
- position: relative;
12
- padding: 0;
13
- }
14
- .hiprint-printTemplate .hiprint-printPaper{
15
- display: flex;
16
- flex-wrap: wrap;
17
- flex-direction: column;
18
- align-content: flex-start;
19
- margin: -`,"2509IkPvtf","drawImage",".hiprint-printPaper","download.jpg","toType","href","queue","display","mm -",'<div class="hiprint-printPanel-small"></div>',"addClass"];return E=function(){return o},E()}function j(o,e){const x=E();return j=function(a,s){return a=a-171,x[a]},j(o,e)}const K=function(o,e){return V(this,null,function*(){const x=j;let a=this,s=globalThis.$.Deferred(),g=!![],u=10,k=(i,c)=>{const h=j,z=Math.floor(i/c*100);console[h(266)](h(231),i,h(237),c),console.log(h(206),z+"%")};if(this[x(236)][x(203)]){let i=globalThis.$[x(229)]({},e||{}),c=yield this[x(199)](o,e);e&&(e.pixelRatio&&(i.dpr=e.pixelRatio,i.scale=e[x(180)]),e[x(258)]!=null&&(g=e[x(258)]),e[x(181)]!=null&&(k=e[x(181)]),e.limit!=null&&(u=e[x(222)])),globalThis.$(c)[x(243)](x(185),"").css("height",""),this[x(183)]();let h=this[x(241)](),z=this[x(236)][0][x(185)],X=this[x(236)][0][x(176)];const p=this[x(236)][0][x(262)];if(p&&(p[x(247)]>0||p[x(261)]>0)&&e.paperWidth&&e[x(239)]){let t=Math.floor(e[x(198)]/(z+p[x(247)]/2)),m=Math[x(227)](e[x(239)]/(X+p[x(261)]/2));const q=t*m,A=c[x(177)](x(174)),d=A[x(203)],M=Math.ceil(d/q);let v=globalThis.$(x(224));p.layoutType==x(200)?v[x(264)](`<style>
20
- .hiprint-printPanel-small{
21
- box-sizing: border-box;
22
- border: 0px;
23
- }
24
- .hiprint-printPaper-small{
25
- position: relative;
26
- padding: 0;
27
- }
28
- .hiprint-printTemplate .hiprint-printPaper{
29
- margin: -`+(Number(p[x(247)])||0)/2+x(219)+(Number(p[x(261)])||0)/2+`mm;
30
- }
31
- .hiprint-printTemplate .hiprint-printPanel-small {
32
- display:inline-block;
33
- padding: `+(Number(p[x(247)])||0)/2+x(235)+(Number(p[x(261)])||0)/2+x(252)):v.append(x(210)+(Number(p[x(247)])||0)/2+x(219)+(Number(p[x(261)])||0)/2+`mm;
34
- }
35
- .hiprint-printTemplate .hiprint-printPanel-small {
36
- display:inline-block;
37
- padding: `+(Number(p[x(247)])||0)/2+x(235)+(Number(p[x(261)])||0)/2+x(252));for(let T=0;T<M;T++){const _=globalThis.$(x(232)+e[x(198)]+x(240)+e[x(239)]+x(207)),C=T*q,H=Math[x(246)]((T+1)*q,d);for(let I=C;I<H;I++){const f=A.eq(I)[x(263)]();f[x(255)]("hiprint-printPaper"),f[x(221)]("hiprint-printPaper-small start-"+I);const r=globalThis.$(x(220));r[x(264)](f),_[x(177)](x(213))[x(264)](r)}v[x(264)](_)}this[x(175)](v,i),h[x(182)](v[0])}else this[x(175)](c,i),h[x(182)](c[0]);let O=h[x(177)](".hiprint-printPanel .hiprint-printPaper")[x(203)];globalThis.$(c)[x(243)]("position:fixed"),this[x(260)](c,function(){const t=x;try{let m=[],q=Math.ceil(O/u),A=O%u||1;const d=document.createElement(t(202)),M=d[t(228)]("2d"),v=h.find(t(193)).eq(0)[t(185)](),T=v*(i[t(180)]||globalThis[t(226)]);for(let _=0;_<q;_++){M[t(248)](0,0,d[t(185)],d[t(176)]);const C=_==q-1;let H=0,I=C?A:u;for(let f=0;f<I;f++){M[t(248)](0,0,d[t(185)],d[t(176)]);const r=_*u+f,N=h[t(177)](t(174))[r];globalThis[t(195)][t(217)].add(function($){const y=t;J.snapdom[y(208)](N,i)[y(172)](function(P){const l=y;let w=P[l(228)]("2d");w[l(204)]=![];let R=P[l(257)](l(189),i[l(173)]||.92),n=new Image;n.src=R,n[l(196)]=function(){const b=l;f===0&&(d[b(185)]=T,d[b(176)]=n[b(176)]*I),H+=n.height,M[b(212)](n,0,H-n[b(176)],T,n[b(176)]),k(r+1,O),$()}})})}globalThis[t(195)][t(217)][t(187)](function(f){const r=t;let N=i.type||r(189),$=i[r(215)]||r(197),y=i.quality||.8;if(g){let P=d.toDataURL(N,y),l=new Image;l[r(238)]=P,l[r(196)]=function(){const w=r;m.push({url:P,start:_*u+1,end:_*u+I}),C&&(globalThis.hinnn[w(217)][w(190)](),a[w(250)](),m[w(205)](R=>{const n=w;let b=document[n(254)]("a"),D=e[n(249)]||n(214);D[n(223)](".")==-1&&(D+=".jpg");let S=D.split(".")[n(191)](),G=D[n(230)]("."+S,"")+"_"+R[n(259)]+"-"+R[n(184)]+"."+S;b[n(209)][n(218)]=n(253),b[n(244)](n(188),G),b[n(244)](n(216),R[n(197)]),document.body.appendChild(b),b.click(),b.remove()})),f()};return}if($==r(197)){m[r(233)](d[r(257)](N,y)),C&&(globalThis[r(195)].queue[r(190)](),a[r(250)](),s[r(171)](m)),f();return}$=="blob"&&d[r(225)](function(P){const l=r;m[l(233)](P),C&&(globalThis[l(195)].queue[l(190)](),a[l(250)](),s[l(171)](m)),f()},N,y)})}globalThis[t(195)].queue.run()}catch(m){console.error(t(201)),console.log(m)}})}return s[x(186)]()})};function L(o,e){var x=Y();return L=function(a,s){a=a-189;var g=x[a];return g},L(o,e)}(function(o,e){for(var x=L,a=o();[];)try{var s=-parseInt(x(192))/1*(-parseInt(x(201))/2)+parseInt(x(205))/3*(parseInt(x(202))/4)+parseInt(x(193))/5*(parseInt(x(200))/6)+-parseInt(x(194))/7+-parseInt(x(191))/8+-parseInt(x(197))/9+-parseInt(x(204))/10*(-parseInt(x(199))/11);if(s===e)break;a.push(a.shift())}catch(g){a.push(a.shift())}})(Y,366221);function Y(){var o=["1AAkkjv","5iZCkmS","1428861dHMliN","add toImage Api to PrintTemplate","newPrintTemplate","3767040CnkuaJ","defineProperty","161579nyztyv","3916518ELckIf","556158oTrJKg","49976snTHLq","toImage","20SifjYv","162dOYxiV","add toImage Api","0.3.0","5167856XwNzPL"];return Y=function(){return o},Y()}function Q(o){var e=L;return{name:e(189),description:"add toImage Api",hooks:[{hook:e(196),name:e(195),description:e(195),priority:1,run:({template:x,options:a})=>{var s=e;Object[s(198)](x,s(203),{value:K,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(190)}}module.exports=Q;
1
+ "use strict";var B=(r,e,x)=>new Promise((n,i)=>{var h=o=>{try{v(x.next(o))}catch(b){i(b)}},u=o=>{try{v(x.throw(o))}catch(b){i(b)}},v=o=>o.done?n(o.value):Promise.resolve(o.value).then(h,u);v((x=x.apply(r,e)).next())});const S=require("@zumer/snapdom");function j(){const r=["clearRect","log","queue","createElement","141776MXtEoF","download","5AWMeBv","quality","dpr","devicePixelRatio","pop","154JvCxXU","run","find","clear","1119465HjFNXu","#fff","push","promise","name","getTempContainer","printPanels","Deferred","ceil","style","cur","toCanvas","2GAOFeX","split",".hiprint-printPanel","loadAllImages","575400DBEefY","5477481wrLhXo","onProgress","click","createTempContainer","image/jpeg","html","pixelRatio","height","toType","toBlob","isDownload","51654DgYjVv","toDataURL","css","href","remove",".jpg","removeTempContainer","download.jpg","toImage 失败(可能您的图片资源无法正常加载): ","setAttribute","replace","svg2canvas","url","indexOf","end","forEach","type","src","resolve","add","none","canvas","start",".hiprint-printPanel .hiprint-printPaper","onload","limit","floor","2010900RmMcnx","getHtml","then","toImage percent: ","hinnn","getContext","drawImage","length","19752890QOzFkk","width"];return j=function(){return r},j()}function R(r,e){const x=j();return R=function(n,i){return n=n-381,x[n]},R(r,e)}(function(r,e){const x=R,n=r();for(;;)try{if(-parseInt(x(393))/1+parseInt(x(389))/2*(-parseInt(x(457))/3)+-parseInt(x(432))/4+-parseInt(x(448))/5*(-parseInt(x(405))/6)+parseInt(x(453))/7*(parseInt(x(446))/8)+-parseInt(x(394))/9+parseInt(x(440))/10===e)break;n.push(n.shift())}catch(i){n.push(n.shift())}})(j,313893);const $=function(r,e){return B(this,null,function*(){const x=R;let n=this,i=globalThis.$[x(384)](),h=!0,u=10,v=(o,b)=>{const p=x,w=Math[p(431)](o/b*100);console[p(443)](p(387),o,"total",b),console[p(443)](p(435),w+"%")};if(this[x(383)][x(439)]){let o=globalThis.$.extend({backgroundColor:x(458)},e||{}),b=yield this[x(433)](r,e);e&&(e[x(400)]&&(o[x(450)]=e.pixelRatio),e[x(404)]!=null&&(h=e[x(404)]),e[x(395)]!=null&&(v=e[x(395)]),e[x(430)]!=null&&(u=e[x(430)])),globalThis.$(b).css(x(441),"")[x(407)](x(401),""),this[x(397)]();let p=this[x(382)]();this[x(416)](b,o),p[x(399)](b[0]);let w=p.find(x(428))[x(439)];globalThis.$(b).css("position:fixed"),this[x(392)](p,function(){const t=x;try{let f=[],U=Math[t(385)](w/u),G=w%u||1;const d=document[t(445)](t(426)),F=d[t(437)]("2d"),O=p[t(455)](t(391)).eq(0)[t(441)](),H=O*(o[t(450)]||globalThis[t(451)]);for(let T=0;T<U;T++){F[t(442)](0,0,d[t(441)],d.height);const C=T==U-1;let M=0,D=C?G:u;for(let _=0;_<D;_++){F[t(442)](0,0,d[t(441)],d[t(401)]);const c=T*u+_,y=p.find(t(428))[c];globalThis[t(436)].queue[t(424)](function(k){const g=t;S.snapdom[g(388)](y,o)[g(434)](function(m){const s=g;let I=m[s(437)]("2d");I.imageSmoothingEnabled=!1;let A=m[s(406)](s(398),o[s(449)]||.92),a=new Image;a[s(422)]=A,a[s(429)]=function(){const l=s;_===0&&(d[l(441)]=H,d[l(401)]=a.height*D),M+=a[l(401)],F[l(438)](a,0,M-a[l(401)],H,a.height),v(c+1,w),k()}})})}globalThis[t(436)][t(444)][t(424)](function(_){const c=t;let y=o[c(421)]||c(398),k=o[c(402)]||c(417),g=o[c(449)]||.8;if(h){let m=d.toDataURL(y,g),s=new Image;s.src=m,s[c(429)]=function(){const I=c;f[I(459)]({url:m,start:T*u+1,end:T*u+D}),C&&(globalThis[I(436)].queue[I(456)](),n.removeTempContainer(),f[I(420)](A=>{const a=I;let l=document[a(445)]("a"),P=e[a(381)]||a(412);P[a(418)](".")==-1&&(P+=a(410));let X=P[a(390)](".")[a(452)](),Q=P[a(415)]("."+X,"")+"_"+A[a(427)]+"-"+A[a(419)]+"."+X;l[a(386)].display=a(425),l[a(414)](a(447),Q),l[a(414)](a(408),A.url),document.body.appendChild(l),l[a(396)](),l[a(409)]()})),_()};return}if(k==c(417)){f[c(459)](d[c(406)](y,g)),C&&(globalThis[c(436)][c(444)].clear(),n[c(411)](),i[c(423)](f)),_();return}k=="blob"&&d[c(403)](function(m){const s=c;f.push(m),C&&(globalThis.hinnn[s(444)][s(456)](),n.removeTempContainer(),i[s(423)](f)),_()},y,g)})}globalThis[t(436)][t(444)][t(454)]()}catch(f){console.error(t(413)),console[t(443)](f)}})}return i[x(460)]()})};function q(){var r=["add toImage Api to PrintTemplate","1427AkFKHQ","4119890haQGfT","6583968UtqRGZ","280941AxjpFQ","44AEhNAs","defineProperty","45677710GiUZyJ","7743750AsFHSd","7890054ESuxUt","newPrintTemplate","0.3.0","toImage","add toImage Api","9zvBpja","1958AdiniS"];return q=function(){return r},q()}(function(r,e){for(var x=E,n=r();;)try{var i=parseInt(x(490))/1*(-parseInt(x(488))/2)+-parseInt(x(493))/3*(parseInt(x(494))/4)+-parseInt(x(491))/5+parseInt(x(482))/6+-parseInt(x(481))/7+-parseInt(x(492))/8+parseInt(x(487))/9*(parseInt(x(480))/10);if(i===e)break;n.push(n.shift())}catch(h){n.push(n.shift())}})(q,702406);function E(r,e){var x=q();return E=function(n,i){n=n-479;var h=x[n];return h},E(r,e)}function L(r){var e=E;return{name:e(486),description:e(486),hooks:[{hook:e(483),name:e(489),description:e(489),priority:1,run:({template:x,options:n})=>{var i=e;Object[i(479)](x,i(485),{value:$,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:e(484)}}module.exports=L;
package/dist/index.mjs CHANGED
@@ -1,204 +1,148 @@
1
- var V = (o, e, x) => new Promise((a, s) => {
2
- var g = (i) => {
1
+ var B = (r, e, x) => new Promise((n, i) => {
2
+ var h = (o) => {
3
3
  try {
4
- k(x.next(i));
5
- } catch (c) {
6
- s(c);
4
+ v(x.next(o));
5
+ } catch (b) {
6
+ i(b);
7
7
  }
8
- }, u = (i) => {
8
+ }, u = (o) => {
9
9
  try {
10
- k(x.throw(i));
11
- } catch (c) {
12
- s(c);
10
+ v(x.throw(o));
11
+ } catch (b) {
12
+ i(b);
13
13
  }
14
- }, k = (i) => i.done ? a(i.value) : Promise.resolve(i.value).then(g, u);
15
- k((x = x.apply(o, e)).next());
14
+ }, v = (o) => o.done ? n(o.value) : Promise.resolve(o.value).then(h, u);
15
+ v((x = x.apply(r, e)).next());
16
16
  });
17
- import { snapdom as J } from "@zumer/snapdom";
18
- (function(o, e) {
19
- const x = j, a = o();
20
- for (; []; )
21
- try {
22
- if (parseInt(x(211)) / 1 * (-parseInt(x(251)) / 2) + parseInt(x(245)) / 3 * (-parseInt(x(242)) / 4) + parseInt(x(256)) / 5 + -parseInt(x(265)) / 6 * (parseInt(x(179)) / 7) + parseInt(x(194)) / 8 + parseInt(x(192)) / 9 + -parseInt(x(234)) / 10 * (-parseInt(x(178)) / 11) === e)
23
- break;
24
- a.push(a.shift());
25
- } catch (s) {
26
- a.push(a.shift());
27
- }
28
- })(E, 991907);
29
- function E() {
30
- const o = ["limit", "indexOf", '<div class="hiprint-printTemplate"></div>', "toBlob", "devicePixelRatio", "floor", "getContext", "extend", "replace", "cur", `<div class="hiprint-printPanel">
31
- <div class="hiprint-printPaper" style="width:`, "push", "10YnsMhd", "mm ", "printPanels", "total", "src", "paperHeight", "mm;height:", "getTempContainer", "8eDbbnX", "css", "setAttribute", "594483XRowmQ", "min", "layoutRowGap", "clearRect", "name", "removeTempContainer", "932ygrPYT", `mm;
32
- }
33
- </style>`, "none", "createElement", "removeClass", "408110KjYHgg", "toDataURL", "isDownload", "start", "loadAllImages", "layoutColumnGap", "panelLayoutOptions", "clone", "append", "120CMfTqq", "log", "resolve", "then", "quality", ".hiprint-printPanel .hiprint-printPaper", "svg2canvas", "height", "find", "20157643HusFlM", "323043sVZSoM", "pixelRatio", "onProgress", "html", "createTempContainer", "end", "width", "promise", "add", "download", "image/jpeg", "clear", "pop", "7153794EyDTgg", ".hiprint-printPanel", "6171216rQnmMY", "hinnn", "onload", "url", "paperWidth", "getHtml", "row", "toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "canvas", "length", "imageSmoothingEnabled", "forEach", "toImage percent: ", `mm;"></div>
34
- </div>`, "toCanvas", "style", `<style>
35
- .hiprint-printPanel-small{
36
- box-sizing: border-box;
37
- border: 0px;
38
- }
39
- .hiprint-printPaper-small{
40
- position: relative;
41
- padding: 0;
42
- }
43
- .hiprint-printTemplate .hiprint-printPaper{
44
- display: flex;
45
- flex-wrap: wrap;
46
- flex-direction: column;
47
- align-content: flex-start;
48
- margin: -`, "2509IkPvtf", "drawImage", ".hiprint-printPaper", "download.jpg", "toType", "href", "queue", "display", "mm -", '<div class="hiprint-printPanel-small"></div>', "addClass"];
49
- return E = function() {
50
- return o;
51
- }, E();
17
+ import { snapdom as S } from "@zumer/snapdom";
18
+ function j() {
19
+ const r = ["clearRect", "log", "queue", "createElement", "141776MXtEoF", "download", "5AWMeBv", "quality", "dpr", "devicePixelRatio", "pop", "154JvCxXU", "run", "find", "clear", "1119465HjFNXu", "#fff", "push", "promise", "name", "getTempContainer", "printPanels", "Deferred", "ceil", "style", "cur", "toCanvas", "2GAOFeX", "split", ".hiprint-printPanel", "loadAllImages", "575400DBEefY", "5477481wrLhXo", "onProgress", "click", "createTempContainer", "image/jpeg", "html", "pixelRatio", "height", "toType", "toBlob", "isDownload", "51654DgYjVv", "toDataURL", "css", "href", "remove", ".jpg", "removeTempContainer", "download.jpg", "toImage 失败(可能您的图片资源无法正常加载): ", "setAttribute", "replace", "svg2canvas", "url", "indexOf", "end", "forEach", "type", "src", "resolve", "add", "none", "canvas", "start", ".hiprint-printPanel .hiprint-printPaper", "onload", "limit", "floor", "2010900RmMcnx", "getHtml", "then", "toImage percent: ", "hinnn", "getContext", "drawImage", "length", "19752890QOzFkk", "width"];
20
+ return j = function() {
21
+ return r;
22
+ }, j();
52
23
  }
53
- function j(o, e) {
54
- const x = E();
55
- return j = function(a, s) {
56
- return a = a - 171, x[a];
57
- }, j(o, e);
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);
58
29
  }
59
- const K = function(o, e) {
60
- return V(this, null, function* () {
61
- const x = j;
62
- let a = this, s = globalThis.$.Deferred(), g = !![], u = 10, k = (i, c) => {
63
- const h = j, z = Math.floor(i / c * 100);
64
- console[h(266)](h(231), i, h(237), c), console.log(h(206), z + "%");
30
+ (function(r, e) {
31
+ const x = R, n = r();
32
+ for (; ; )
33
+ try {
34
+ if (-parseInt(x(393)) / 1 + parseInt(x(389)) / 2 * (-parseInt(x(457)) / 3) + -parseInt(x(432)) / 4 + -parseInt(x(448)) / 5 * (-parseInt(x(405)) / 6) + parseInt(x(453)) / 7 * (parseInt(x(446)) / 8) + -parseInt(x(394)) / 9 + parseInt(x(440)) / 10 === e) break;
35
+ n.push(n.shift());
36
+ } catch (i) {
37
+ n.push(n.shift());
38
+ }
39
+ })(j, 313893);
40
+ const $ = function(r, e) {
41
+ return B(this, null, function* () {
42
+ const x = R;
43
+ let n = this, i = globalThis.$[x(384)](), h = !0, u = 10, v = (o, b) => {
44
+ const p = x, w = Math[p(431)](o / b * 100);
45
+ console[p(443)](p(387), o, "total", b), console[p(443)](p(435), w + "%");
65
46
  };
66
- if (this[x(236)][x(203)]) {
67
- let i = globalThis.$[x(229)]({}, e || {}), c = yield this[x(199)](o, e);
68
- e && (e.pixelRatio && (i.dpr = e.pixelRatio, i.scale = e[x(180)]), e[x(258)] != null && (g = e[x(258)]), e[x(181)] != null && (k = e[x(181)]), e.limit != null && (u = e[x(222)])), globalThis.$(c)[x(243)](x(185), "").css("height", ""), this[x(183)]();
69
- let h = this[x(241)](), z = this[x(236)][0][x(185)], X = this[x(236)][0][x(176)];
70
- const p = this[x(236)][0][x(262)];
71
- if (p && (p[x(247)] > 0 || p[x(261)] > 0) && e.paperWidth && e[x(239)]) {
72
- let t = Math.floor(e[x(198)] / (z + p[x(247)] / 2)), m = Math[x(227)](e[x(239)] / (X + p[x(261)] / 2));
73
- const C = t * m, A = c[x(177)](x(174)), d = A[x(203)], q = Math.ceil(d / C);
74
- let v = globalThis.$(x(224));
75
- p.layoutType == x(200) ? v[x(264)](`<style>
76
- .hiprint-printPanel-small{
77
- box-sizing: border-box;
78
- border: 0px;
79
- }
80
- .hiprint-printPaper-small{
81
- position: relative;
82
- padding: 0;
83
- }
84
- .hiprint-printTemplate .hiprint-printPaper{
85
- margin: -` + (Number(p[x(247)]) || 0) / 2 + x(219) + (Number(p[x(261)]) || 0) / 2 + `mm;
86
- }
87
- .hiprint-printTemplate .hiprint-printPanel-small {
88
- display:inline-block;
89
- padding: ` + (Number(p[x(247)]) || 0) / 2 + x(235) + (Number(p[x(261)]) || 0) / 2 + x(252)) : v.append(x(210) + (Number(p[x(247)]) || 0) / 2 + x(219) + (Number(p[x(261)]) || 0) / 2 + `mm;
90
- }
91
- .hiprint-printTemplate .hiprint-printPanel-small {
92
- display:inline-block;
93
- padding: ` + (Number(p[x(247)]) || 0) / 2 + x(235) + (Number(p[x(261)]) || 0) / 2 + x(252));
94
- for (let T = 0; T < q; T++) {
95
- const _ = globalThis.$(x(232) + e[x(198)] + x(240) + e[x(239)] + x(207)), M = T * C, H = Math[x(246)]((T + 1) * C, d);
96
- for (let I = M; I < H; I++) {
97
- const f = A.eq(I)[x(263)]();
98
- f[x(255)]("hiprint-printPaper"), f[x(221)]("hiprint-printPaper-small start-" + I);
99
- const r = globalThis.$(x(220));
100
- r[x(264)](f), _[x(177)](x(213))[x(264)](r);
101
- }
102
- v[x(264)](_);
103
- }
104
- this[x(175)](v, i), h[x(182)](v[0]);
105
- } else
106
- this[x(175)](c, i), h[x(182)](c[0]);
107
- let O = h[x(177)](".hiprint-printPanel .hiprint-printPaper")[x(203)];
108
- globalThis.$(c)[x(243)]("position:fixed"), this[x(260)](c, function() {
47
+ if (this[x(383)][x(439)]) {
48
+ let o = globalThis.$.extend({ backgroundColor: x(458) }, e || {}), b = yield this[x(433)](r, e);
49
+ e && (e[x(400)] && (o[x(450)] = e.pixelRatio), e[x(404)] != null && (h = e[x(404)]), e[x(395)] != null && (v = e[x(395)]), e[x(430)] != null && (u = e[x(430)])), globalThis.$(b).css(x(441), "")[x(407)](x(401), ""), this[x(397)]();
50
+ let p = this[x(382)]();
51
+ this[x(416)](b, o), p[x(399)](b[0]);
52
+ let w = p.find(x(428))[x(439)];
53
+ globalThis.$(b).css("position:fixed"), this[x(392)](p, function() {
109
54
  const t = x;
110
55
  try {
111
- let m = [], C = Math.ceil(O / u), A = O % u || 1;
112
- const d = document.createElement(t(202)), q = d[t(228)]("2d"), v = h.find(t(193)).eq(0)[t(185)](), T = v * (i[t(180)] || globalThis[t(226)]);
113
- for (let _ = 0; _ < C; _++) {
114
- q[t(248)](0, 0, d[t(185)], d[t(176)]);
115
- const M = _ == C - 1;
116
- let H = 0, I = M ? A : u;
117
- for (let f = 0; f < I; f++) {
118
- q[t(248)](0, 0, d[t(185)], d[t(176)]);
119
- const r = _ * u + f, N = h[t(177)](t(174))[r];
120
- globalThis[t(195)][t(217)].add(function($) {
121
- const y = t;
122
- J[y(208)](N, i)[y(172)](function(P) {
123
- const l = y;
124
- let w = P[l(228)]("2d");
125
- w[l(204)] = ![];
126
- let R = P[l(257)](l(189), i[l(173)] || 0.92), n = new Image();
127
- n.src = R, n[l(196)] = function() {
128
- const b = l;
129
- f === 0 && (d[b(185)] = T, d[b(176)] = n[b(176)] * I), H += n.height, q[b(212)](n, 0, H - n[b(176)], T, n[b(176)]), k(r + 1, O), $();
56
+ let f = [], U = Math[t(385)](w / u), G = w % u || 1;
57
+ const d = document[t(445)](t(426)), q = d[t(437)]("2d"), O = p[t(455)](t(391)).eq(0)[t(441)](), H = O * (o[t(450)] || globalThis[t(451)]);
58
+ for (let T = 0; T < U; T++) {
59
+ q[t(442)](0, 0, d[t(441)], d.height);
60
+ const C = T == U - 1;
61
+ let M = 0, D = C ? G : u;
62
+ for (let _ = 0; _ < D; _++) {
63
+ q[t(442)](0, 0, d[t(441)], d[t(401)]);
64
+ const c = T * u + _, y = p.find(t(428))[c];
65
+ globalThis[t(436)].queue[t(424)](function(k) {
66
+ const g = t;
67
+ S[g(388)](y, o)[g(434)](function(m) {
68
+ const s = g;
69
+ let I = m[s(437)]("2d");
70
+ I.imageSmoothingEnabled = !1;
71
+ let A = m[s(406)](s(398), o[s(449)] || 0.92), a = new Image();
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();
130
75
  };
131
76
  });
132
77
  });
133
78
  }
134
- globalThis[t(195)][t(217)][t(187)](function(f) {
135
- const r = t;
136
- let N = i.type || r(189), $ = i[r(215)] || r(197), y = i.quality || 0.8;
137
- if (g) {
138
- let P = d.toDataURL(N, y), l = new Image();
139
- l[r(238)] = P, l[r(196)] = function() {
140
- const w = r;
141
- m.push({ url: P, start: _ * u + 1, end: _ * u + I }), M && (globalThis.hinnn[w(217)][w(190)](), a[w(250)](), m[w(205)]((R) => {
142
- const n = w;
143
- let b = document[n(254)]("a"), D = e[n(249)] || n(214);
144
- D[n(223)](".") == -1 && (D += ".jpg");
145
- let S = D.split(".")[n(191)](), G = D[n(230)]("." + S, "") + "_" + R[n(259)] + "-" + R[n(184)] + "." + S;
146
- b[n(209)][n(218)] = n(253), b[n(244)](n(188), G), b[n(244)](n(216), R[n(197)]), document.body.appendChild(b), b.click(), b.remove();
147
- })), f();
79
+ globalThis[t(436)][t(444)][t(424)](function(_) {
80
+ const c = t;
81
+ let y = o[c(421)] || c(398), k = o[c(402)] || c(417), g = o[c(449)] || 0.8;
82
+ if (h) {
83
+ let m = d.toDataURL(y, g), s = new Image();
84
+ s.src = m, s[c(429)] = function() {
85
+ const I = c;
86
+ f[I(459)]({ url: m, start: T * u + 1, end: T * u + D }), C && (globalThis[I(436)].queue[I(456)](), n.removeTempContainer(), f[I(420)]((A) => {
87
+ const a = I;
88
+ let l = document[a(445)]("a"), P = e[a(381)] || a(412);
89
+ P[a(418)](".") == -1 && (P += a(410));
90
+ let X = P[a(390)](".")[a(452)](), Q = P[a(415)]("." + X, "") + "_" + A[a(427)] + "-" + A[a(419)] + "." + X;
91
+ l[a(386)].display = a(425), l[a(414)](a(447), Q), l[a(414)](a(408), A.url), document.body.appendChild(l), l[a(396)](), l[a(409)]();
92
+ })), _();
148
93
  };
149
94
  return;
150
95
  }
151
- if ($ == r(197)) {
152
- m[r(233)](d[r(257)](N, y)), M && (globalThis[r(195)].queue[r(190)](), a[r(250)](), s[r(171)](m)), f();
96
+ if (k == c(417)) {
97
+ f[c(459)](d[c(406)](y, g)), C && (globalThis[c(436)][c(444)].clear(), n[c(411)](), i[c(423)](f)), _();
153
98
  return;
154
99
  }
155
- $ == "blob" && d[r(225)](function(P) {
156
- const l = r;
157
- m[l(233)](P), M && (globalThis[l(195)].queue[l(190)](), a[l(250)](), s[l(171)](m)), f();
158
- }, N, y);
100
+ k == "blob" && d[c(403)](function(m) {
101
+ const s = c;
102
+ f.push(m), C && (globalThis.hinnn[s(444)][s(456)](), n.removeTempContainer(), i[s(423)](f)), _();
103
+ }, y, g);
159
104
  });
160
105
  }
161
- globalThis[t(195)].queue.run();
162
- } catch (m) {
163
- console.error(t(201)), console.log(m);
106
+ globalThis[t(436)][t(444)][t(454)]();
107
+ } catch (f) {
108
+ console.error(t(413)), console[t(443)](f);
164
109
  }
165
110
  });
166
111
  }
167
- return s[x(186)]();
112
+ return i[x(460)]();
168
113
  });
169
114
  };
170
- function L(o, e) {
171
- var x = Y();
172
- return L = function(a, s) {
173
- a = a - 189;
174
- var g = x[a];
175
- return g;
176
- }, L(o, e);
115
+ function E() {
116
+ var r = ["add toImage Api to PrintTemplate", "1427AkFKHQ", "4119890haQGfT", "6583968UtqRGZ", "280941AxjpFQ", "44AEhNAs", "defineProperty", "45677710GiUZyJ", "7743750AsFHSd", "7890054ESuxUt", "newPrintTemplate", "0.3.0", "toImage", "add toImage Api", "9zvBpja", "1958AdiniS"];
117
+ return E = function() {
118
+ return r;
119
+ }, E();
177
120
  }
178
- (function(o, e) {
179
- for (var x = L, a = o(); []; )
121
+ (function(r, e) {
122
+ for (var x = F, n = r(); ; )
180
123
  try {
181
- var s = -parseInt(x(192)) / 1 * (-parseInt(x(201)) / 2) + parseInt(x(205)) / 3 * (parseInt(x(202)) / 4) + parseInt(x(193)) / 5 * (parseInt(x(200)) / 6) + -parseInt(x(194)) / 7 + -parseInt(x(191)) / 8 + -parseInt(x(197)) / 9 + -parseInt(x(204)) / 10 * (-parseInt(x(199)) / 11);
182
- if (s === e)
183
- break;
184
- a.push(a.shift());
185
- } catch (g) {
186
- a.push(a.shift());
124
+ var i = parseInt(x(490)) / 1 * (-parseInt(x(488)) / 2) + -parseInt(x(493)) / 3 * (parseInt(x(494)) / 4) + -parseInt(x(491)) / 5 + parseInt(x(482)) / 6 + -parseInt(x(481)) / 7 + -parseInt(x(492)) / 8 + parseInt(x(487)) / 9 * (parseInt(x(480)) / 10);
125
+ if (i === e) break;
126
+ n.push(n.shift());
127
+ } catch (h) {
128
+ n.push(n.shift());
187
129
  }
188
- })(Y, 366221);
189
- function Y() {
190
- var o = ["1AAkkjv", "5iZCkmS", "1428861dHMliN", "add toImage Api to PrintTemplate", "newPrintTemplate", "3767040CnkuaJ", "defineProperty", "161579nyztyv", "3916518ELckIf", "556158oTrJKg", "49976snTHLq", "toImage", "20SifjYv", "162dOYxiV", "add toImage Api", "0.3.0", "5167856XwNzPL"];
191
- return Y = function() {
192
- return o;
193
- }, Y();
130
+ })(E, 702406);
131
+ function F(r, e) {
132
+ var x = E();
133
+ return F = function(n, i) {
134
+ n = n - 479;
135
+ var h = x[n];
136
+ return h;
137
+ }, F(r, e);
194
138
  }
195
- function Z(o) {
196
- var e = L;
197
- return { name: e(189), description: "add toImage Api", hooks: [{ hook: e(196), name: e(195), description: e(195), priority: 1, run: ({ template: x, options: a }) => {
198
- var s = e;
199
- Object[s(198)](x, s(203), { value: K, enumerable: ![], writable: !![], configurable: !![] });
200
- } }], leastHiprintVersion: e(190) };
139
+ function J(r) {
140
+ var e = F;
141
+ return { name: e(486), description: e(486), hooks: [{ hook: e(483), name: e(489), description: e(489), priority: 1, run: ({ template: x, options: n }) => {
142
+ var i = e;
143
+ Object[i(479)](x, i(485), { value: $, enumerable: !1, writable: !0, configurable: !0 });
144
+ } }], leastHiprintVersion: e(484) };
201
145
  }
202
146
  export {
203
- Z as default
147
+ J as default
204
148
  };
package/dist/index.umd.js CHANGED
@@ -1,37 +1 @@
1
- (function(I,b){typeof exports=="object"&&typeof module!="undefined"?module.exports=b(require("@zumer/snapdom")):typeof define=="function"&&define.amd?define(["@zumer/snapdom"],b):(I=typeof globalThis!="undefined"?globalThis:I||self,I.pluginApiImage=b(I.snapdom))})(this,function(I){"use strict";var J=(I,b,h)=>new Promise((Y,T)=>{var M=e=>{try{r(h.next(e))}catch(x){T(x)}},O=e=>{try{r(h.throw(e))}catch(x){T(x)}},r=e=>e.done?Y(e.value):Promise.resolve(e.value).then(M,O);r((h=h.apply(I,b)).next())});(function(r,e){const x=h,n=r();for(;[];)try{if(parseInt(x(211))/1*(-parseInt(x(251))/2)+parseInt(x(245))/3*(-parseInt(x(242))/4)+parseInt(x(256))/5+-parseInt(x(265))/6*(parseInt(x(179))/7)+parseInt(x(194))/8+parseInt(x(192))/9+-parseInt(x(234))/10*(-parseInt(x(178))/11)===e)break;n.push(n.shift())}catch(d){n.push(n.shift())}})(b,991907);function b(){const r=["limit","indexOf",'<div class="hiprint-printTemplate"></div>',"toBlob","devicePixelRatio","floor","getContext","extend","replace","cur",`<div class="hiprint-printPanel">
2
- <div class="hiprint-printPaper" style="width:`,"push","10YnsMhd","mm ","printPanels","total","src","paperHeight","mm;height:","getTempContainer","8eDbbnX","css","setAttribute","594483XRowmQ","min","layoutRowGap","clearRect","name","removeTempContainer","932ygrPYT",`mm;
3
- }
4
- </style>`,"none","createElement","removeClass","408110KjYHgg","toDataURL","isDownload","start","loadAllImages","layoutColumnGap","panelLayoutOptions","clone","append","120CMfTqq","log","resolve","then","quality",".hiprint-printPanel .hiprint-printPaper","svg2canvas","height","find","20157643HusFlM","323043sVZSoM","pixelRatio","onProgress","html","createTempContainer","end","width","promise","add","download","image/jpeg","clear","pop","7153794EyDTgg",".hiprint-printPanel","6171216rQnmMY","hinnn","onload","url","paperWidth","getHtml","row","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","canvas","length","imageSmoothingEnabled","forEach","toImage percent: ",`mm;"></div>
5
- </div>`,"toCanvas","style",`<style>
6
- .hiprint-printPanel-small{
7
- box-sizing: border-box;
8
- border: 0px;
9
- }
10
- .hiprint-printPaper-small{
11
- position: relative;
12
- padding: 0;
13
- }
14
- .hiprint-printTemplate .hiprint-printPaper{
15
- display: flex;
16
- flex-wrap: wrap;
17
- flex-direction: column;
18
- align-content: flex-start;
19
- margin: -`,"2509IkPvtf","drawImage",".hiprint-printPaper","download.jpg","toType","href","queue","display","mm -",'<div class="hiprint-printPanel-small"></div>',"addClass"];return b=function(){return r},b()}function h(r,e){const x=b();return h=function(n,d){return n=n-171,x[n]},h(r,e)}const Y=function(r,e){return J(this,null,function*(){const x=h;let n=this,d=globalThis.$.Deferred(),N=!![],y=10,X=(s,g)=>{const m=h,S=Math.floor(s/g*100);console[m(266)](m(231),s,m(237),g),console.log(m(206),S+"%")};if(this[x(236)][x(203)]){let s=globalThis.$[x(229)]({},e||{}),g=yield this[x(199)](r,e);e&&(e.pixelRatio&&(s.dpr=e.pixelRatio,s.scale=e[x(180)]),e[x(258)]!=null&&(N=e[x(258)]),e[x(181)]!=null&&(X=e[x(181)]),e.limit!=null&&(y=e[x(222)])),globalThis.$(g)[x(243)](x(185),"").css("height",""),this[x(183)]();let m=this[x(241)](),S=this[x(236)][0][x(185)],K=this[x(236)][0][x(176)];const l=this[x(236)][0][x(262)];if(l&&(l[x(247)]>0||l[x(261)]>0)&&e.paperWidth&&e[x(239)]){let t=Math.floor(e[x(198)]/(S+l[x(247)]/2)),u=Math[x(227)](e[x(239)]/(K+l[x(261)]/2));const R=t*u,z=g[x(177)](x(174)),p=z[x(203)],A=Math.ceil(p/R);let P=globalThis.$(x(224));l.layoutType==x(200)?P[x(264)](`<style>
20
- .hiprint-printPanel-small{
21
- box-sizing: border-box;
22
- border: 0px;
23
- }
24
- .hiprint-printPaper-small{
25
- position: relative;
26
- padding: 0;
27
- }
28
- .hiprint-printTemplate .hiprint-printPaper{
29
- margin: -`+(Number(l[x(247)])||0)/2+x(219)+(Number(l[x(261)])||0)/2+`mm;
30
- }
31
- .hiprint-printTemplate .hiprint-printPanel-small {
32
- display:inline-block;
33
- padding: `+(Number(l[x(247)])||0)/2+x(235)+(Number(l[x(261)])||0)/2+x(252)):P.append(x(210)+(Number(l[x(247)])||0)/2+x(219)+(Number(l[x(261)])||0)/2+`mm;
34
- }
35
- .hiprint-printTemplate .hiprint-printPanel-small {
36
- display:inline-block;
37
- padding: `+(Number(l[x(247)])||0)/2+x(235)+(Number(l[x(261)])||0)/2+x(252));for(let w=0;w<A;w++){const _=globalThis.$(x(232)+e[x(198)]+x(240)+e[x(239)]+x(207)),j=w*R,D=Math[x(246)]((w+1)*R,p);for(let v=j;v<D;v++){const f=z.eq(v)[x(263)]();f[x(255)]("hiprint-printPaper"),f[x(221)]("hiprint-printPaper-small start-"+v);const i=globalThis.$(x(220));i[x(264)](f),_[x(177)](x(213))[x(264)](i)}P[x(264)](_)}this[x(175)](P,s),m[x(182)](P[0])}else this[x(175)](g,s),m[x(182)](g[0]);let V=m[x(177)](".hiprint-printPanel .hiprint-printPaper")[x(203)];globalThis.$(g)[x(243)]("position:fixed"),this[x(260)](g,function(){const t=x;try{let u=[],R=Math.ceil(V/y),z=V%y||1;const p=document.createElement(t(202)),A=p[t(228)]("2d"),P=m.find(t(193)).eq(0)[t(185)](),w=P*(s[t(180)]||globalThis[t(226)]);for(let _=0;_<R;_++){A[t(248)](0,0,p[t(185)],p[t(176)]);const j=_==R-1;let D=0,v=j?z:y;for(let f=0;f<v;f++){A[t(248)](0,0,p[t(185)],p[t(176)]);const i=_*y+f,H=m[t(177)](t(174))[i];globalThis[t(195)][t(217)].add(function(E){const k=t;I.snapdom[k(208)](H,s)[k(172)](function(q){const o=k;let C=q[o(228)]("2d");C[o(204)]=![];let $=q[o(257)](o(189),s[o(173)]||.92),a=new Image;a.src=$,a[o(196)]=function(){const c=o;f===0&&(p[c(185)]=w,p[c(176)]=a[c(176)]*v),D+=a.height,A[c(212)](a,0,D-a[c(176)],w,a[c(176)]),X(i+1,V),E()}})})}globalThis[t(195)][t(217)][t(187)](function(f){const i=t;let H=s.type||i(189),E=s[i(215)]||i(197),k=s.quality||.8;if(N){let q=p.toDataURL(H,k),o=new Image;o[i(238)]=q,o[i(196)]=function(){const C=i;u.push({url:q,start:_*y+1,end:_*y+v}),j&&(globalThis.hinnn[C(217)][C(190)](),n[C(250)](),u[C(205)]($=>{const a=C;let c=document[a(254)]("a"),L=e[a(249)]||a(214);L[a(223)](".")==-1&&(L+=".jpg");let G=L.split(".")[a(191)](),Q=L[a(230)]("."+G,"")+"_"+$[a(259)]+"-"+$[a(184)]+"."+G;c[a(209)][a(218)]=a(253),c[a(244)](a(188),Q),c[a(244)](a(216),$[a(197)]),document.body.appendChild(c),c.click(),c.remove()})),f()};return}if(E==i(197)){u[i(233)](p[i(257)](H,k)),j&&(globalThis[i(195)].queue[i(190)](),n[i(250)](),d[i(171)](u)),f();return}E=="blob"&&p[i(225)](function(q){const o=i;u[o(233)](q),j&&(globalThis[o(195)].queue[o(190)](),n[o(250)](),d[o(171)](u)),f()},H,k)})}globalThis[t(195)].queue.run()}catch(u){console.error(t(201)),console.log(u)}})}return d[x(186)]()})};function T(r,e){var x=M();return T=function(n,d){n=n-189;var N=x[n];return N},T(r,e)}(function(r,e){for(var x=T,n=r();[];)try{var d=-parseInt(x(192))/1*(-parseInt(x(201))/2)+parseInt(x(205))/3*(parseInt(x(202))/4)+parseInt(x(193))/5*(parseInt(x(200))/6)+-parseInt(x(194))/7+-parseInt(x(191))/8+-parseInt(x(197))/9+-parseInt(x(204))/10*(-parseInt(x(199))/11);if(d===e)break;n.push(n.shift())}catch(N){n.push(n.shift())}})(M,366221);function M(){var r=["1AAkkjv","5iZCkmS","1428861dHMliN","add toImage Api to PrintTemplate","newPrintTemplate","3767040CnkuaJ","defineProperty","161579nyztyv","3916518ELckIf","556158oTrJKg","49976snTHLq","toImage","20SifjYv","162dOYxiV","add toImage Api","0.3.0","5167856XwNzPL"];return M=function(){return r},M()}function O(r){var e=T;return{name:e(189),description:"add toImage Api",hooks:[{hook:e(196),name:e(195),description:e(195),priority:1,run:({template:x,options:n})=>{var d=e;Object[d(198)](x,d(203),{value:Y,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(190)}}return O});
1
+ (function(f,p){typeof exports=="object"&&typeof module!="undefined"?module.exports=p(require("@zumer/snapdom")):typeof define=="function"&&define.amd?define(["@zumer/snapdom"],p):(f=typeof globalThis!="undefined"?globalThis:f||self,f.pluginApiImage=p(f.window))})(this,function(f){"use strict";var O=(f,p,u)=>new Promise((F,m)=>{var y=x=>{try{i(u.next(x))}catch(e){m(e)}},D=x=>{try{i(u.throw(x))}catch(e){m(e)}},i=x=>x.done?F(x.value):Promise.resolve(x.value).then(y,D);i((u=u.apply(f,p)).next())});function p(){const i=["clearRect","log","queue","createElement","141776MXtEoF","download","5AWMeBv","quality","dpr","devicePixelRatio","pop","154JvCxXU","run","find","clear","1119465HjFNXu","#fff","push","promise","name","getTempContainer","printPanels","Deferred","ceil","style","cur","toCanvas","2GAOFeX","split",".hiprint-printPanel","loadAllImages","575400DBEefY","5477481wrLhXo","onProgress","click","createTempContainer","image/jpeg","html","pixelRatio","height","toType","toBlob","isDownload","51654DgYjVv","toDataURL","css","href","remove",".jpg","removeTempContainer","download.jpg","toImage 失败(可能您的图片资源无法正常加载): ","setAttribute","replace","svg2canvas","url","indexOf","end","forEach","type","src","resolve","add","none","canvas","start",".hiprint-printPanel .hiprint-printPaper","onload","limit","floor","2010900RmMcnx","getHtml","then","toImage percent: ","hinnn","getContext","drawImage","length","19752890QOzFkk","width"];return p=function(){return i},p()}function u(i,x){const e=p();return u=function(a,r){return a=a-381,e[a]},u(i,x)}(function(i,x){const e=u,a=i();for(;;)try{if(-parseInt(e(393))/1+parseInt(e(389))/2*(-parseInt(e(457))/3)+-parseInt(e(432))/4+-parseInt(e(448))/5*(-parseInt(e(405))/6)+parseInt(e(453))/7*(parseInt(e(446))/8)+-parseInt(e(394))/9+parseInt(e(440))/10===x)break;a.push(a.shift())}catch(r){a.push(a.shift())}})(p,313893);const F=function(i,x){return O(this,null,function*(){const e=u;let a=this,r=globalThis.$[e(384)](),A=!0,g=10,M=(l,I)=>{const d=e,j=Math[d(431)](l/I*100);console[d(443)](d(387),l,"total",I),console[d(443)](d(435),j+"%")};if(this[e(383)][e(439)]){let l=globalThis.$.extend({backgroundColor:e(458)},x||{}),I=yield this[e(433)](i,x);x&&(x[e(400)]&&(l[e(450)]=x.pixelRatio),x[e(404)]!=null&&(A=x[e(404)]),x[e(395)]!=null&&(M=x[e(395)]),x[e(430)]!=null&&(g=x[e(430)])),globalThis.$(I).css(e(441),"")[e(407)](e(401),""),this[e(397)]();let d=this[e(382)]();this[e(416)](I,l),d[e(399)](I[0]);let j=d.find(e(428))[e(439)];globalThis.$(I).css("position:fixed"),this[e(392)](d,function(){const t=e;try{let h=[],X=Math[t(385)](j/g),Q=j%g||1;const b=document[t(445)](t(426)),U=b[t(437)]("2d"),S=d[t(455)](t(391)).eq(0)[t(441)](),z=S*(l[t(450)]||globalThis[t(451)]);for(let C=0;C<X;C++){U[t(442)](0,0,b[t(441)],b.height);const R=C==X-1;let B=0,H=R?Q:g;for(let _=0;_<H;_++){U[t(442)](0,0,b[t(441)],b[t(401)]);const o=C*g+_,k=d.find(t(428))[o];globalThis[t(436)].queue[t(424)](function(q){const v=t;f.snapdom[v(388)](k,l)[v(434)](function(T){const c=v;let w=T[c(437)]("2d");w.imageSmoothingEnabled=!1;let P=T[c(406)](c(398),l[c(449)]||.92),n=new Image;n[c(422)]=P,n[c(429)]=function(){const s=c;_===0&&(b[s(441)]=z,b[s(401)]=n.height*H),B+=n[s(401)],U[s(438)](n,0,B-n[s(401)],z,n.height),M(o+1,j),q()}})})}globalThis[t(436)][t(444)][t(424)](function(_){const o=t;let k=l[o(421)]||o(398),q=l[o(402)]||o(417),v=l[o(449)]||.8;if(A){let T=b.toDataURL(k,v),c=new Image;c.src=T,c[o(429)]=function(){const w=o;h[w(459)]({url:T,start:C*g+1,end:C*g+H}),R&&(globalThis[w(436)].queue[w(456)](),a.removeTempContainer(),h[w(420)](P=>{const n=w;let s=document[n(445)]("a"),E=x[n(381)]||n(412);E[n(418)](".")==-1&&(E+=n(410));let G=E[n(390)](".")[n(452)](),$=E[n(415)]("."+G,"")+"_"+P[n(427)]+"-"+P[n(419)]+"."+G;s[n(386)].display=n(425),s[n(414)](n(447),$),s[n(414)](n(408),P.url),document.body.appendChild(s),s[n(396)](),s[n(409)]()})),_()};return}if(q==o(417)){h[o(459)](b[o(406)](k,v)),R&&(globalThis[o(436)][o(444)].clear(),a[o(411)](),r[o(423)](h)),_();return}q=="blob"&&b[o(403)](function(T){const c=o;h.push(T),R&&(globalThis.hinnn[c(444)][c(456)](),a.removeTempContainer(),r[c(423)](h)),_()},k,v)})}globalThis[t(436)][t(444)][t(454)]()}catch(h){console.error(t(413)),console[t(443)](h)}})}return r[e(460)]()})};function m(){var i=["add toImage Api to PrintTemplate","1427AkFKHQ","4119890haQGfT","6583968UtqRGZ","280941AxjpFQ","44AEhNAs","defineProperty","45677710GiUZyJ","7743750AsFHSd","7890054ESuxUt","newPrintTemplate","0.3.0","toImage","add toImage Api","9zvBpja","1958AdiniS"];return m=function(){return i},m()}(function(i,x){for(var e=y,a=i();;)try{var r=parseInt(e(490))/1*(-parseInt(e(488))/2)+-parseInt(e(493))/3*(parseInt(e(494))/4)+-parseInt(e(491))/5+parseInt(e(482))/6+-parseInt(e(481))/7+-parseInt(e(492))/8+parseInt(e(487))/9*(parseInt(e(480))/10);if(r===x)break;a.push(a.shift())}catch(A){a.push(a.shift())}})(m,702406);function y(i,x){var e=m();return y=function(a,r){a=a-479;var A=e[a];return A},y(i,x)}function D(i){var x=y;return{name:x(486),description:x(486),hooks:[{hook:x(483),name:x(489),description:x(489),priority:1,run:({template:e,options:a})=>{var r=x;Object[r(479)](e,r(485),{value:F,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:x(484)}}return D});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sv-print/plugin-api-image",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "add image api to print template",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",