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

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 +1,37 @@
1
- "use strict";var J=(o,x,e)=>new Promise((a,l)=>{var u=c=>{try{v(e.next(c))}catch(d){l(d)}},f=c=>{try{v(e.throw(c))}catch(d){l(d)}},v=c=>c.done?a(c.value):Promise.resolve(c.value).then(u,f);v((e=e.apply(o,x)).next())});const q=require("html-to-image");function H(o){if(o&&o.__esModule)return o;const x=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(x,e,a.get?a:{enumerable:!0,get:()=>o[e]})}}return x.default=o,Object.freeze(x)}const N=H(q);(function(o,x){const e=P,a=o();for(;[];)try{if(parseInt(e(121))/1+parseInt(e(129))/2*(parseInt(e(194))/3)+-parseInt(e(170))/4+parseInt(e(189))/5+parseInt(e(180))/6*(parseInt(e(183))/7)+parseInt(e(155))/8*(parseInt(e(181))/9)+parseInt(e(149))/10===x)break;a.push(a.shift())}catch(l){a.push(a.shift())}})(D,991174);function P(o,x){const e=D();return P=function(a,l){return a=a-121,e[a]},P(o,x)}function D(){const o=["width","length","onProgress","786774QlvfCR","2529vzCFjv","jpeg","7QPlNUb","href","createTempContainer","tagName","IMG","start","2539020czDXaj","type","setAttribute","canvas","image/jpeg","49341YZEtsF","log","none","onload","png","display","name","clearRect","toCanvas","853269zbdRQK","removeTempContainer","svg2canvas","toDataURL","position:fixed","src","style","queue","16iZCsdz","webp","then","resolve","add","indexOf","url","gif","toType","getHtml","download","appendChild","replace","baseURI","#fff","run","getContext","height","remove","end","959830dWTsDh","base64","css","bmp","quality","devicePixelRatio","31816vZVFMp","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","http","limit","loadAllImages","hinnn","body","split","createElement",".hiprint-printPanel .hiprint-printPaper","clear","forEach","jpg","includes","isDownload","7384496gCQMez","cur","printPanels","push","svg","imageSmoothingEnabled","drawImage"];return D=function(){return o},D()}const S=function(o,x){return J(this,null,function*(){const e=P;let a=this,l=globalThis.$.Deferred(),u=!![],f=10,v=(c,d)=>{const h=P,w=Math.floor(c/d*100);console[h(195)](h(171),c,"total",d),console[h(195)]("toImage percent: ",w+"%")};if(this[e(172)][e(178)]){let c=globalThis.$.extend({filter:t=>{const n=e;return t[n(186)]!=n(187)||t[n(186)]==n(187)&&([n(167),n(182),n(198),n(136),n(152),n(130),n(174)][n(168)](t.src[n(162)](".").pop().toLowerCase())||t[n(126)]!=t[n(142)]||t[n(126)][n(134)](n(157))>-1&&t[n(126)]!=t.baseURI||t.src[n(134)](n(150))>-1)},backgroundColor:e(143)},x||{}),d=yield this[e(138)](o,x);x&&x[e(169)]!=null&&(u=x.isDownload),x&&x[e(179)]!=null&&(v=x[e(179)]),x&&x[e(158)]!=null&&(f=x[e(158)]),globalThis.$(d)[e(151)](e(177),"")[e(151)](e(146),""),this[e(185)]();let h=this.getTempContainer();this[e(123)](d,c),h.html(d[0]);let w=h.find(e(164)).length;globalThis.$(d)[e(151)](e(125)),this[e(159)](d,function(){const t=e;try{let n=[],L=Math.ceil(w/f),Q=w%f||1;const p=document[t(163)](t(192)),z=p[t(145)]("2d"),U=h[t(177)]()*(c.pixelRatio||globalThis[t(154)]);for(let T=0;T<L;T++){z[t(201)](0,0,p[t(177)],p[t(146)]);const j=T==L-1;let E=0,A=j?Q:f;for(let g=0;g<A;g++){z[t(201)](0,0,p[t(177)],p[t(146)]);const i=T*f+g,y=h.find(t(164))[i];globalThis.hinnn[t(128)].add(function(R){const _=t;N[_(202)](y,c)[_(131)](function(m){const s=_;let I=m[s(145)]("2d");I[s(175)]=![];let C=m.toDataURL(s(193),c[s(153)]||.92),r=new Image;r[s(126)]=C,r.onload=function(){const b=s;g===0&&(p.width=U,p[b(146)]=r[b(146)]*A),E+=r[b(146)],z[b(176)](r,0,E-r.height,U,r[b(146)]),v(i+1,w),R()}})})}globalThis[t(160)][t(128)][t(133)](function(g){const i=t;let y=c[i(190)]||i(193),R=c[i(137)]||i(135),_=c[i(153)]||.8;if(u){let m=p[i(124)](y,_),s=new Image;s[i(126)]=m,s[i(197)]=function(){const I=i;n[I(173)]({url:m,start:T*f+1,end:T*f+A}),j&&(globalThis.hinnn[I(128)][I(165)](),a.removeTempContainer(),n[I(166)](C=>{const r=I;let b=document[r(163)]("a"),k=x[r(200)]||"download.jpg";k.indexOf(".")==-1&&(k+=".jpg");let F=k.split(".").pop(),Z=k[r(141)]("."+F,"")+"_"+C[r(188)]+"-"+C[r(148)]+"."+F;b[r(127)][r(199)]=r(196),b[r(191)](r(139),Z),b.setAttribute(r(184),C[r(135)]),document[r(161)][r(140)](b),b.click(),b[r(147)]()})),g()};return}if(R==i(135)){n[i(173)](p[i(124)](y,_)),j&&(globalThis[i(160)].queue[i(165)](),a[i(122)](),l.resolve(n)),g();return}R=="blob"&&p.toBlob(function(m){const s=i;n[s(173)](m),j&&(globalThis[s(160)][s(128)][s(165)](),a[s(122)](),l[s(132)](n)),g()},y,_)})}globalThis.hinnn[t(128)][t(144)]()}catch(n){console.error(t(156)),console[t(195)](n)}})}return l.promise()})};function M(){var o=["110hNAxTx","defineProperty","add toImage Api","27iJLQtX","907488zaJTgt","203481uJSZxH","10544072CIsEkd","350644RiFwCg","35804LGMroR","0.3.0","42LTpdBP","1195168UxwgXP","newPrintTemplate","30dLHoRe","toImage","59352JFwoZJ","add toImage Api to PrintTemplate"];return M=function(){return o},M()}function O(o,x){var e=M();return O=function(a,l){a=a-159;var u=e[a];return u},O(o,x)}(function(o,x){for(var e=O,a=o();[];)try{var l=-parseInt(e(167))/1*(-parseInt(e(172))/2)+-parseInt(e(169))/3+parseInt(e(162))/4*(parseInt(e(164))/5)+parseInt(e(174))/6*(parseInt(e(171))/7)+-parseInt(e(175))/8+parseInt(e(168))/9*(parseInt(e(160))/10)+-parseInt(e(170))/11;if(l===x)break;a.push(a.shift())}catch(u){a.push(a.shift())}})(M,287155);function $(o){var x=O;return{name:"add toImage Api",description:x(166),hooks:[{hook:x(159),name:x(163),description:x(163),priority:1,run:({template:e,options:a})=>{var l=x;Object[l(165)](e,l(161),{value:S,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:x(173)}}module.exports=$;
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;
package/dist/index.mjs CHANGED
@@ -1,153 +1,204 @@
1
- var Q = (s, n, x) => new Promise((a, l) => {
2
- var u = (i) => {
1
+ var V = (o, e, x) => new Promise((a, s) => {
2
+ var g = (i) => {
3
3
  try {
4
- v(x.next(i));
5
- } catch (d) {
6
- l(d);
4
+ k(x.next(i));
5
+ } catch (c) {
6
+ s(c);
7
7
  }
8
- }, f = (i) => {
8
+ }, u = (i) => {
9
9
  try {
10
- v(x.throw(i));
11
- } catch (d) {
12
- l(d);
10
+ k(x.throw(i));
11
+ } catch (c) {
12
+ s(c);
13
13
  }
14
- }, v = (i) => i.done ? a(i.value) : Promise.resolve(i.value).then(u, f);
15
- v((x = x.apply(s, n)).next());
14
+ }, k = (i) => i.done ? a(i.value) : Promise.resolve(i.value).then(g, u);
15
+ k((x = x.apply(o, e)).next());
16
16
  });
17
- import * as $ from "html-to-image";
18
- (function(s, n) {
19
- const x = R, a = s();
17
+ import { snapdom as J } from "@zumer/snapdom";
18
+ (function(o, e) {
19
+ const x = j, a = o();
20
20
  for (; []; )
21
21
  try {
22
- if (parseInt(x(121)) / 1 + parseInt(x(129)) / 2 * (parseInt(x(194)) / 3) + -parseInt(x(170)) / 4 + parseInt(x(189)) / 5 + parseInt(x(180)) / 6 * (parseInt(x(183)) / 7) + parseInt(x(155)) / 8 * (parseInt(x(181)) / 9) + parseInt(x(149)) / 10 === n)
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
23
  break;
24
24
  a.push(a.shift());
25
- } catch (l) {
25
+ } catch (s) {
26
26
  a.push(a.shift());
27
27
  }
28
- })(A, 991174);
29
- function R(s, n) {
30
- const x = A();
31
- return R = function(a, l) {
32
- return a = a - 121, x[a];
33
- }, R(s, n);
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();
34
52
  }
35
- function A() {
36
- const s = ["width", "length", "onProgress", "786774QlvfCR", "2529vzCFjv", "jpeg", "7QPlNUb", "href", "createTempContainer", "tagName", "IMG", "start", "2539020czDXaj", "type", "setAttribute", "canvas", "image/jpeg", "49341YZEtsF", "log", "none", "onload", "png", "display", "name", "clearRect", "toCanvas", "853269zbdRQK", "removeTempContainer", "svg2canvas", "toDataURL", "position:fixed", "src", "style", "queue", "16iZCsdz", "webp", "then", "resolve", "add", "indexOf", "url", "gif", "toType", "getHtml", "download", "appendChild", "replace", "baseURI", "#fff", "run", "getContext", "height", "remove", "end", "959830dWTsDh", "base64", "css", "bmp", "quality", "devicePixelRatio", "31816vZVFMp", "toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "http", "limit", "loadAllImages", "hinnn", "body", "split", "createElement", ".hiprint-printPanel .hiprint-printPaper", "clear", "forEach", "jpg", "includes", "isDownload", "7384496gCQMez", "cur", "printPanels", "push", "svg", "imageSmoothingEnabled", "drawImage"];
37
- return A = function() {
38
- return s;
39
- }, A();
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);
40
58
  }
41
- const q = function(s, n) {
42
- return Q(this, null, function* () {
43
- const x = R;
44
- let a = this, l = globalThis.$.Deferred(), u = !![], f = 10, v = (i, d) => {
45
- const h = R, w = Math.floor(i / d * 100);
46
- console[h(195)](h(171), i, "total", d), console[h(195)]("toImage percent: ", w + "%");
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 + "%");
47
65
  };
48
- if (this[x(172)][x(178)]) {
49
- let i = globalThis.$.extend({ filter: (e) => {
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() {
50
109
  const t = x;
51
- return e[t(186)] != t(187) || e[t(186)] == t(187) && ([t(167), t(182), t(198), t(136), t(152), t(130), t(174)][t(168)](e.src[t(162)](".").pop().toLowerCase()) || e[t(126)] != e[t(142)] || e[t(126)][t(134)](t(157)) > -1 && e[t(126)] != e.baseURI || e.src[t(134)](t(150)) > -1);
52
- }, backgroundColor: x(143) }, n || {}), d = yield this[x(138)](s, n);
53
- n && n[x(169)] != null && (u = n.isDownload), n && n[x(179)] != null && (v = n[x(179)]), n && n[x(158)] != null && (f = n[x(158)]), globalThis.$(d)[x(151)](x(177), "")[x(151)](x(146), ""), this[x(185)]();
54
- let h = this.getTempContainer();
55
- this[x(123)](d, i), h.html(d[0]);
56
- let w = h.find(x(164)).length;
57
- globalThis.$(d)[x(151)](x(125)), this[x(159)](d, function() {
58
- const e = x;
59
110
  try {
60
- let t = [], U = Math.ceil(w / f), Z = w % f || 1;
61
- const p = document[e(163)](e(192)), z = p[e(145)]("2d"), E = h[e(177)]() * (i.pixelRatio || globalThis[e(154)]);
62
- for (let T = 0; T < U; T++) {
63
- z[e(201)](0, 0, p[e(177)], p[e(146)]);
64
- const P = T == U - 1;
65
- let F = 0, M = P ? Z : f;
66
- for (let g = 0; g < M; g++) {
67
- z[e(201)](0, 0, p[e(177)], p[e(146)]);
68
- const r = T * f + g, C = h.find(e(164))[r];
69
- globalThis.hinnn[e(128)].add(function(j) {
70
- const _ = e;
71
- $[_(202)](C, i)[_(131)](function(m) {
72
- const c = _;
73
- let I = m[c(145)]("2d");
74
- I[c(175)] = ![];
75
- let y = m.toDataURL(c(193), i[c(153)] || 0.92), o = new Image();
76
- o[c(126)] = y, o.onload = function() {
77
- const b = c;
78
- g === 0 && (p.width = E, p[b(146)] = o[b(146)] * M), F += o[b(146)], z[b(176)](o, 0, F - o.height, E, o[b(146)]), v(r + 1, w), j();
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), $();
79
130
  };
80
131
  });
81
132
  });
82
133
  }
83
- globalThis[e(160)][e(128)][e(133)](function(g) {
84
- const r = e;
85
- let C = i[r(190)] || r(193), j = i[r(137)] || r(135), _ = i[r(153)] || 0.8;
86
- if (u) {
87
- let m = p[r(124)](C, _), c = new Image();
88
- c[r(126)] = m, c[r(197)] = function() {
89
- const I = r;
90
- t[I(173)]({ url: m, start: T * f + 1, end: T * f + M }), P && (globalThis.hinnn[I(128)][I(165)](), a.removeTempContainer(), t[I(166)]((y) => {
91
- const o = I;
92
- let b = document[o(163)]("a"), k = n[o(200)] || "download.jpg";
93
- k.indexOf(".") == -1 && (k += ".jpg");
94
- let J = k.split(".").pop(), H = k[o(141)]("." + J, "") + "_" + y[o(188)] + "-" + y[o(148)] + "." + J;
95
- b[o(127)][o(199)] = o(196), b[o(191)](o(139), H), b.setAttribute(o(184), y[o(135)]), document[o(161)][o(140)](b), b.click(), b[o(147)]();
96
- })), g();
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();
97
148
  };
98
149
  return;
99
150
  }
100
- if (j == r(135)) {
101
- t[r(173)](p[r(124)](C, _)), P && (globalThis[r(160)].queue[r(165)](), a[r(122)](), l.resolve(t)), g();
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();
102
153
  return;
103
154
  }
104
- j == "blob" && p.toBlob(function(m) {
105
- const c = r;
106
- t[c(173)](m), P && (globalThis[c(160)][c(128)][c(165)](), a[c(122)](), l[c(132)](t)), g();
107
- }, C, _);
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);
108
159
  });
109
160
  }
110
- globalThis.hinnn[e(128)][e(144)]();
111
- } catch (t) {
112
- console.error(e(156)), console[e(195)](t);
161
+ globalThis[t(195)].queue.run();
162
+ } catch (m) {
163
+ console.error(t(201)), console.log(m);
113
164
  }
114
165
  });
115
166
  }
116
- return l.promise();
167
+ return s[x(186)]();
117
168
  });
118
169
  };
119
- function D() {
120
- var s = ["110hNAxTx", "defineProperty", "add toImage Api", "27iJLQtX", "907488zaJTgt", "203481uJSZxH", "10544072CIsEkd", "350644RiFwCg", "35804LGMroR", "0.3.0", "42LTpdBP", "1195168UxwgXP", "newPrintTemplate", "30dLHoRe", "toImage", "59352JFwoZJ", "add toImage Api to PrintTemplate"];
121
- return D = function() {
122
- return s;
123
- }, D();
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);
124
177
  }
125
- function L(s, n) {
126
- var x = D();
127
- return L = function(a, l) {
128
- a = a - 159;
129
- var u = x[a];
130
- return u;
131
- }, L(s, n);
132
- }
133
- (function(s, n) {
134
- for (var x = L, a = s(); []; )
178
+ (function(o, e) {
179
+ for (var x = L, a = o(); []; )
135
180
  try {
136
- var l = -parseInt(x(167)) / 1 * (-parseInt(x(172)) / 2) + -parseInt(x(169)) / 3 + parseInt(x(162)) / 4 * (parseInt(x(164)) / 5) + parseInt(x(174)) / 6 * (parseInt(x(171)) / 7) + -parseInt(x(175)) / 8 + parseInt(x(168)) / 9 * (parseInt(x(160)) / 10) + -parseInt(x(170)) / 11;
137
- if (l === n)
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)
138
183
  break;
139
184
  a.push(a.shift());
140
- } catch (u) {
185
+ } catch (g) {
141
186
  a.push(a.shift());
142
187
  }
143
- })(D, 287155);
144
- function O(s) {
145
- var n = L;
146
- return { name: "add toImage Api", description: n(166), hooks: [{ hook: n(159), name: n(163), description: n(163), priority: 1, run: ({ template: x, options: a }) => {
147
- var l = n;
148
- Object[l(165)](x, l(161), { value: q, enumerable: ![], writable: !![], configurable: !![] });
149
- } }], leastHiprintVersion: n(173) };
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();
194
+ }
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) };
150
201
  }
151
202
  export {
152
- O as default
203
+ Z as default
153
204
  };
package/dist/index.umd.js CHANGED
@@ -1 +1,37 @@
1
- (function(p,_){typeof exports=="object"&&typeof module!="undefined"?module.exports=_(require("html-to-image")):typeof define=="function"&&define.amd?define(["html-to-image"],_):(p=typeof globalThis!="undefined"?globalThis:p||self,p.pluginApiImage=_(p.htmlToImage))})(this,function(p){"use strict";var N=(p,_,j)=>new Promise((I,v)=>{var U=b=>{try{u(j.next(b))}catch(a){v(a)}},P=b=>{try{u(j.throw(b))}catch(a){v(a)}},u=b=>b.done?I(b.value):Promise.resolve(b.value).then(U,P);u((j=j.apply(p,_)).next())});function _(a){if(a&&a.__esModule)return a;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const j=_(p);(function(a,t){const e=I,o=a();for(;[];)try{if(parseInt(e(121))/1+parseInt(e(129))/2*(parseInt(e(194))/3)+-parseInt(e(170))/4+parseInt(e(189))/5+parseInt(e(180))/6*(parseInt(e(183))/7)+parseInt(e(155))/8*(parseInt(e(181))/9)+parseInt(e(149))/10===t)break;o.push(o.shift())}catch(s){o.push(o.shift())}})(v,991174);function I(a,t){const e=v();return I=function(o,s){return o=o-121,e[o]},I(a,t)}function v(){const a=["width","length","onProgress","786774QlvfCR","2529vzCFjv","jpeg","7QPlNUb","href","createTempContainer","tagName","IMG","start","2539020czDXaj","type","setAttribute","canvas","image/jpeg","49341YZEtsF","log","none","onload","png","display","name","clearRect","toCanvas","853269zbdRQK","removeTempContainer","svg2canvas","toDataURL","position:fixed","src","style","queue","16iZCsdz","webp","then","resolve","add","indexOf","url","gif","toType","getHtml","download","appendChild","replace","baseURI","#fff","run","getContext","height","remove","end","959830dWTsDh","base64","css","bmp","quality","devicePixelRatio","31816vZVFMp","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","http","limit","loadAllImages","hinnn","body","split","createElement",".hiprint-printPanel .hiprint-printPaper","clear","forEach","jpg","includes","isDownload","7384496gCQMez","cur","printPanels","push","svg","imageSmoothingEnabled","drawImage"];return v=function(){return a},v()}const U=function(a,t){return N(this,null,function*(){const e=I;let o=this,s=globalThis.$.Deferred(),R=!![],T=10,J=(d,h)=>{const g=I,A=Math.floor(d/h*100);console[g(195)](g(171),d,"total",h),console[g(195)]("toImage percent: ",A+"%")};if(this[e(172)][e(178)]){let d=globalThis.$.extend({filter:x=>{const n=e;return x[n(186)]!=n(187)||x[n(186)]==n(187)&&([n(167),n(182),n(198),n(136),n(152),n(130),n(174)][n(168)](x.src[n(162)](".").pop().toLowerCase())||x[n(126)]!=x[n(142)]||x[n(126)][n(134)](n(157))>-1&&x[n(126)]!=x.baseURI||x.src[n(134)](n(150))>-1)},backgroundColor:e(143)},t||{}),h=yield this[e(138)](a,t);t&&t[e(169)]!=null&&(R=t.isDownload),t&&t[e(179)]!=null&&(J=t[e(179)]),t&&t[e(158)]!=null&&(T=t[e(158)]),globalThis.$(h)[e(151)](e(177),"")[e(151)](e(146),""),this[e(185)]();let g=this.getTempContainer();this[e(123)](h,d),g.html(h[0]);let A=g.find(e(164)).length;globalThis.$(h)[e(151)](e(125)),this[e(159)](h,function(){const x=e;try{let n=[],Q=Math.ceil(A/T),S=A%T||1;const f=document[x(163)](x(192)),E=f[x(145)]("2d"),Z=g[x(177)]()*(d.pixelRatio||globalThis[x(154)]);for(let k=0;k<Q;k++){E[x(201)](0,0,f[x(177)],f[x(146)]);const O=k==Q-1;let q=0,F=O?S:T;for(let m=0;m<F;m++){E[x(201)](0,0,f[x(177)],f[x(146)]);const r=k*T+m,D=g.find(x(164))[r];globalThis.hinnn[x(128)].add(function(z){const w=x;j[w(202)](D,d)[w(131)](function(y){const c=w;let C=y[c(145)]("2d");C[c(175)]=![];let M=y.toDataURL(c(193),d[c(153)]||.92),i=new Image;i[c(126)]=M,i.onload=function(){const l=c;m===0&&(f.width=Z,f[l(146)]=i[l(146)]*F),q+=i[l(146)],E[l(176)](i,0,q-i.height,Z,i[l(146)]),J(r+1,A),z()}})})}globalThis[x(160)][x(128)][x(133)](function(m){const r=x;let D=d[r(190)]||r(193),z=d[r(137)]||r(135),w=d[r(153)]||.8;if(R){let y=f[r(124)](D,w),c=new Image;c[r(126)]=y,c[r(197)]=function(){const C=r;n[C(173)]({url:y,start:k*T+1,end:k*T+F}),O&&(globalThis.hinnn[C(128)][C(165)](),o.removeTempContainer(),n[C(166)](M=>{const i=C;let l=document[i(163)]("a"),L=t[i(200)]||"download.jpg";L.indexOf(".")==-1&&(L+=".jpg");let H=L.split(".").pop(),$=L[i(141)]("."+H,"")+"_"+M[i(188)]+"-"+M[i(148)]+"."+H;l[i(127)][i(199)]=i(196),l[i(191)](i(139),$),l.setAttribute(i(184),M[i(135)]),document[i(161)][i(140)](l),l.click(),l[i(147)]()})),m()};return}if(z==r(135)){n[r(173)](f[r(124)](D,w)),O&&(globalThis[r(160)].queue[r(165)](),o[r(122)](),s.resolve(n)),m();return}z=="blob"&&f.toBlob(function(y){const c=r;n[c(173)](y),O&&(globalThis[c(160)][c(128)][c(165)](),o[c(122)](),s[c(132)](n)),m()},D,w)})}globalThis.hinnn[x(128)][x(144)]()}catch(n){console.error(x(156)),console[x(195)](n)}})}return s.promise()})};function P(){var a=["110hNAxTx","defineProperty","add toImage Api","27iJLQtX","907488zaJTgt","203481uJSZxH","10544072CIsEkd","350644RiFwCg","35804LGMroR","0.3.0","42LTpdBP","1195168UxwgXP","newPrintTemplate","30dLHoRe","toImage","59352JFwoZJ","add toImage Api to PrintTemplate"];return P=function(){return a},P()}function u(a,t){var e=P();return u=function(o,s){o=o-159;var R=e[o];return R},u(a,t)}(function(a,t){for(var e=u,o=a();[];)try{var s=-parseInt(e(167))/1*(-parseInt(e(172))/2)+-parseInt(e(169))/3+parseInt(e(162))/4*(parseInt(e(164))/5)+parseInt(e(174))/6*(parseInt(e(171))/7)+-parseInt(e(175))/8+parseInt(e(168))/9*(parseInt(e(160))/10)+-parseInt(e(170))/11;if(s===t)break;o.push(o.shift())}catch(R){o.push(o.shift())}})(P,287155);function b(a){var t=u;return{name:"add toImage Api",description:t(166),hooks:[{hook:t(159),name:t(163),description:t(163),priority:1,run:({template:e,options:o})=>{var s=t;Object[s(165)](e,s(161),{value:U,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:t(173)}}return b});
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});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sv-print/plugin-api-image",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "add image api to print template",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -32,15 +32,14 @@
32
32
  "author": "",
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
- "sv-print": "^0.2.0",
36
- "jspdf": "^2.5.2",
37
- "html-to-image": "^1.11.13"
35
+ "@zumer/snapdom": "^2.0.1",
36
+ "sv-print": "^0.2.0"
38
37
  },
39
38
  "devDependencies": {
40
39
  "vite-plugin-javascript-obfuscator": "^3.1.0"
41
40
  },
42
41
  "peerDependencies": {
43
- "sv-print": "^0.2.0",
44
- "html-to-image": "^1.11.13"
42
+ "@zumer/snapdom": "^2.0.1",
43
+ "sv-print": "^0.2.0"
45
44
  }
46
45
  }