@sv-print/plugin-api-image 0.1.6 → 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,7 +1,8 @@
1
- "use strict";var H=(r,e,x)=>new Promise((n,s)=>{var _=o=>{try{T(x.next(o))}catch(d){s(d)}},f=o=>{try{T(x.throw(o))}catch(d){s(d)}},T=o=>o.done?n(o.value):Promise.resolve(o.value).then(_,f);T((x=x.apply(r,e)).next())});const z=require("html-to-image");function X(r){if(r&&r.__esModule)return r;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const x in r)if(x!=="default"){const n=Object.getOwnPropertyDescriptor(r,x);Object.defineProperty(e,x,n.get?n:{enumerable:!0,get:()=>r[x]})}}return e.default=r,Object.freeze(e)}const F=X(z);(function(r,e){const x=G,n=r();for(;[];)try{if(-parseInt(x(214))/1+parseInt(x(216))/2*(parseInt(x(156))/3)+-parseInt(x(209))/4+parseInt(x(235))/5*(parseInt(x(141))/6)+parseInt(x(201))/7+parseInt(x(138))/8*(parseInt(x(133))/9)+-parseInt(x(195))/10===e)break;n.push(n.shift())}catch(s){n.push(n.shift())}})(U,530777);function G(r,e){const x=U();return G=function(n,s){return n=n-125,x[n]},G(r,e)}function U(){const r=["panelLayoutOptions","getHtml","log","tagName","split","push","bmp","png","layoutColumnGap",`mm;
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;
2
3
  }
3
- </style>`,"promise","error","svg","pop","isDownload","mm -","clear",'<div class="hiprint-printTemplate"></div>',"remove","gif","5574770ZFkrus","display","start","download.jpg","then","getContext","2980565JyqIBA","paperHeight",".hiprint-printPaper","webp","createElement","devicePixelRatio","printPanels","href","1440824kCvhdt","IMG","body","baseURI","type","256445KocNgi","removeClass","26204gqFAmG","height","url","toImage percent: ","Deferred","http","css","quality","min","paperWidth","jpeg","mm ","clone","position:fixed","add","clearRect","pixelRatio","ceil","end","15PmlZWM",".hiprint-printPanel .hiprint-printPaper","find","getTempContainer","extend","replace",`mm;"></div>
4
- </div>`,"canvas","download","click","hinnn","createTempContainer","includes","setAttribute","6577731vQhOou","layoutRowGap","src","jpg",'<div class="hiprint-printPanel-small"></div>',"8EJUwVc","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","width","677238fBeALd","indexOf","toBlob","style","layoutType","forEach","toLowerCase",`<style>
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>
5
6
  .hiprint-printPanel-small{
6
7
  box-sizing: border-box;
7
8
  border: 0px;
@@ -11,15 +12,11 @@
11
12
  padding: 0;
12
13
  }
13
14
  .hiprint-printTemplate .hiprint-printPaper{
14
- margin: -`,"onload","resolve","total","mm;height:","base64","svg2canvas",".hiprint-printPanel","48LVERkP","image/jpeg","append","length","html","floor","row","onProgress","none","run","removeTempContainer","limit","queue","toDataURL","appendChild","blob","drawImage",`mm;
15
- }
16
- .hiprint-printTemplate .hiprint-printPanel-small {
17
- display:inline-block;
18
- padding: `,"#fff"];return U=function(){return r},U()}const J=function(r,e){return H(this,null,function*(){const x=G;let n=this,s=globalThis.$[x(220)](),_=!![],f=10,T=(o,d)=>{const m=x,$=Math[m(161)](o/d*100);console[m(177)]("cur",o,m(151),d),console.log(m(219),$+"%")};if(this.printPanels.length){let o=globalThis.$[x(239)]({filter:t=>{const a=x;return t[a(178)]!=a(210)||t[a(178)]==a(210)&&([a(136),a(226),a(182),a(194),a(181),a(204),a(187)][a(131)](t[a(135)][a(179)](".")[a(188)]()[a(147)]())||t[a(135)]!=t[a(212)]||t[a(135)][a(142)](a(221))>-1&&t[a(135)]!=t[a(212)]||t[a(135)][a(142)](a(153))>-1)},backgroundColor:x(174)},e||{}),d=yield this[x(176)](r,e);e&&e[x(189)]!=null&&(_=e[x(189)]),e&&e[x(163)]!=null&&(T=e[x(163)]),e&&e[x(167)]!=null&&(f=e[x(167)]),globalThis.$(d)[x(222)]("width","").css("height",""),this[x(130)]();let m=this[x(238)](),$=this[x(207)][0][x(140)],Z=this[x(207)][0].height;const c=this[x(207)][0][x(175)];if(c&&(c[x(134)]>0||c[x(183)]>0)&&e[x(225)]&&e[x(202)]){let t=Math.floor(e[x(225)]/($+c.layoutRowGap/2)),a=Math[x(161)](e[x(202)]/(Z+c[x(183)]/2));const C=t*a,E=d[x(237)](x(236)),b=E.length,q=Math[x(233)](b/C);let I=globalThis.$(x(192));c[x(145)]==x(162)?I[x(158)](x(148)+(Number(c[x(134)])||0)/2+x(190)+(Number(c[x(183)])||0)/2+`mm;
19
- }
20
- .hiprint-printTemplate .hiprint-printPanel-small {
21
- display:inline-block;
22
- padding: `+(Number(c[x(134)])||0)/2+"mm "+(Number(c.layoutColumnGap)||0)/2+x(184)):I[x(158)](`<style>
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>
23
20
  .hiprint-printPanel-small{
24
21
  box-sizing: border-box;
25
22
  border: 0px;
@@ -29,9 +26,12 @@
29
26
  padding: 0;
30
27
  }
31
28
  .hiprint-printTemplate .hiprint-printPaper{
32
- display: flex;
33
- flex-wrap: wrap;
34
- flex-direction: column;
35
- align-content: flex-start;
36
- margin: -`+(Number(c.layoutRowGap)||0)/2+"mm -"+(Number(c[x(183)])||0)/2+x(173)+(Number(c[x(134)])||0)/2+x(227)+(Number(c.layoutColumnGap)||0)/2+x(184));for(let P=0;P<q;P++){const g=globalThis.$(`<div class="hiprint-printPanel">
37
- <div class="hiprint-printPaper" style="width:`+e[x(225)]+x(152)+e.paperHeight+x(125)),k=P*C,M=Math[x(224)]((P+1)*C,b);for(let v=k;v<M;v++){const u=E.eq(v)[x(228)]();u[x(215)]("hiprint-printPaper"),u.addClass("hiprint-printPaper-small start-"+v);const l=globalThis.$(x(137));l.append(u),g[x(237)](x(203))[x(158)](l)}I.append(g)}this[x(154)](I,o),m[x(160)](I[0])}else this.svg2canvas(d,o),m[x(160)](d[0]);let B=m[x(237)](x(236))[x(159)];globalThis.$(d)[x(222)](x(229)),this.loadAllImages(d,function(){const t=x;try{let a=[],C=Math[t(233)](B/f),E=B%f||1;const b=document[t(205)](t(126)),q=b[t(200)]("2d"),I=m[t(237)](t(155)).eq(0).width(),P=I*(o[t(232)]||globalThis[t(206)]);for(let g=0;g<C;g++){q[t(231)](0,0,b[t(140)],b[t(217)]);const k=g==C-1;let M=0,v=k?E:f;for(let u=0;u<v;u++){q[t(231)](0,0,b.width,b[t(217)]);const l=g*f+u,j=m[t(237)](".hiprint-printPanel .hiprint-printPaper")[l];globalThis[t(129)].queue.add(function(R){const N=t;F.toCanvas(j,o)[N(199)](function(w){const p=N;let y=w.getContext("2d");y.imageSmoothingEnabled=![];let A=w.toDataURL(p(157),o[p(223)]||.92),i=new Image;i[p(135)]=A,i[p(149)]=function(){const h=p;u===0&&(b[h(140)]=P,b[h(217)]=i[h(217)]*v),M+=i[h(217)],q[h(172)](i,0,M-i[h(217)],P,i.height),T(l+1,B),R()}})})}globalThis[t(129)][t(168)][t(230)](function(u){const l=t;let j=o[l(213)]||l(157),R=o.toType||"url",N=o.quality||.8;if(_){let w=b[l(169)](j,N),p=new Image;p[l(135)]=w,p[l(149)]=function(){const y=l;a.push({url:w,start:g*f+1,end:g*f+v}),k&&(globalThis[y(129)][y(168)][y(191)](),n[y(166)](),a[y(146)](A=>{const i=y;let h=document.createElement("a"),O=e.name||i(198);O[i(142)](".")==-1&&(O+=".jpg");let L=O[i(179)](".").pop(),S=O[i(240)]("."+L,"")+"_"+A[i(197)]+"-"+A[i(234)]+"."+L;h[i(144)][i(196)]=i(164),h[i(132)](i(127),S),h[i(132)](i(208),A[i(218)]),document[i(211)][i(170)](h),h[i(128)](),h[i(193)]()})),u()};return}if(R==l(218)){a[l(180)](b[l(169)](j,N)),k&&(globalThis.hinnn.queue.clear(),n[l(166)](),s.resolve(a)),u();return}R==l(171)&&b[l(143)](function(w){const p=l;a[p(180)](w),k&&(globalThis[p(129)][p(168)][p(191)](),n[p(166)](),s[p(150)](a)),u()},j,N)})}globalThis[t(129)].queue[t(165)]()}catch(a){console[t(186)](t(139)),console[t(177)](a)}})}return s[x(185)]()})};function V(r,e){var x=D();return V=function(n,s){n=n-439;var _=x[n];return _},V(r,e)}(function(r,e){for(var x=V,n=r();[];)try{var s=-parseInt(x(449))/1+-parseInt(x(450))/2+-parseInt(x(441))/3*(-parseInt(x(451))/4)+-parseInt(x(440))/5+-parseInt(x(448))/6+-parseInt(x(445))/7*(parseInt(x(444))/8)+parseInt(x(452))/9;if(s===e)break;n.push(n.shift())}catch(_){n.push(n.shift())}})(D,672242);function D(){var r=["toImage","newPrintTemplate","5735748wEEXNA","866176wrVrBA","2662854EUUogl","124DeyVZy","40837464ixUXSs","defineProperty","add toImage Api to PrintTemplate","478835hEHDBX","53187kqUhVY","0.3.0","add toImage Api","40AVZCZk","1631735VNBrko"];return D=function(){return r},D()}function W(r){var e=V;return{name:e(443),description:e(443),hooks:[{hook:e(447),name:e(439),description:e(439),priority:1,run:({template:x,options:n})=>{var s=e;Object[s(453)](x,s(446),{value:J,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(442)}}module.exports=W;
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,42 +1,37 @@
1
- var Z = (l, a, x) => new Promise((i, p) => {
2
- var _ = (r) => {
1
+ var V = (o, e, x) => new Promise((a, s) => {
2
+ var g = (i) => {
3
3
  try {
4
- T(x.next(r));
5
- } catch (d) {
6
- p(d);
4
+ k(x.next(i));
5
+ } catch (c) {
6
+ s(c);
7
7
  }
8
- }, f = (r) => {
8
+ }, u = (i) => {
9
9
  try {
10
- T(x.throw(r));
11
- } catch (d) {
12
- p(d);
10
+ k(x.throw(i));
11
+ } catch (c) {
12
+ s(c);
13
13
  }
14
- }, T = (r) => r.done ? i(r.value) : Promise.resolve(r.value).then(_, f);
15
- T((x = x.apply(l, a)).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 z from "html-to-image";
18
- (function(l, a) {
19
- const x = V, i = l();
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(214)) / 1 + parseInt(x(216)) / 2 * (parseInt(x(156)) / 3) + -parseInt(x(209)) / 4 + parseInt(x(235)) / 5 * (parseInt(x(141)) / 6) + parseInt(x(201)) / 7 + parseInt(x(138)) / 8 * (parseInt(x(133)) / 9) + -parseInt(x(195)) / 10 === a)
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
- i.push(i.shift());
25
- } catch (p) {
26
- i.push(i.shift());
24
+ a.push(a.shift());
25
+ } catch (s) {
26
+ a.push(a.shift());
27
27
  }
28
- })($, 530777);
29
- function V(l, a) {
30
- const x = $();
31
- return V = function(i, p) {
32
- return i = i - 125, x[i];
33
- }, V(l, a);
34
- }
35
- function $() {
36
- const l = ["panelLayoutOptions", "getHtml", "log", "tagName", "split", "push", "bmp", "png", "layoutColumnGap", `mm;
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;
37
32
  }
38
- </style>`, "promise", "error", "svg", "pop", "isDownload", "mm -", "clear", '<div class="hiprint-printTemplate"></div>', "remove", "gif", "5574770ZFkrus", "display", "start", "download.jpg", "then", "getContext", "2980565JyqIBA", "paperHeight", ".hiprint-printPaper", "webp", "createElement", "devicePixelRatio", "printPanels", "href", "1440824kCvhdt", "IMG", "body", "baseURI", "type", "256445KocNgi", "removeClass", "26204gqFAmG", "height", "url", "toImage percent: ", "Deferred", "http", "css", "quality", "min", "paperWidth", "jpeg", "mm ", "clone", "position:fixed", "add", "clearRect", "pixelRatio", "ceil", "end", "15PmlZWM", ".hiprint-printPanel .hiprint-printPaper", "find", "getTempContainer", "extend", "replace", `mm;"></div>
39
- </div>`, "canvas", "download", "click", "hinnn", "createTempContainer", "includes", "setAttribute", "6577731vQhOou", "layoutRowGap", "src", "jpg", '<div class="hiprint-printPanel-small"></div>', "8EJUwVc", "toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "width", "677238fBeALd", "indexOf", "toBlob", "style", "layoutType", "forEach", "toLowerCase", `<style>
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>
40
35
  .hiprint-printPanel-small{
41
36
  box-sizing: border-box;
42
37
  border: 0px;
@@ -46,39 +41,38 @@ function $() {
46
41
  padding: 0;
47
42
  }
48
43
  .hiprint-printTemplate .hiprint-printPaper{
49
- margin: -`, "onload", "resolve", "total", "mm;height:", "base64", "svg2canvas", ".hiprint-printPanel", "48LVERkP", "image/jpeg", "append", "length", "html", "floor", "row", "onProgress", "none", "run", "removeTempContainer", "limit", "queue", "toDataURL", "appendChild", "blob", "drawImage", `mm;
50
- }
51
- .hiprint-printTemplate .hiprint-printPanel-small {
52
- display:inline-block;
53
- padding: `, "#fff"];
54
- return $ = function() {
55
- return l;
56
- }, $();
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();
52
+ }
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);
57
58
  }
58
- const F = function(l, a) {
59
- return Z(this, null, function* () {
60
- const x = V;
61
- let i = this, p = globalThis.$[x(220)](), _ = !![], f = 10, T = (r, d) => {
62
- const u = x, D = Math[u(161)](r / d * 100);
63
- console[u(177)]("cur", r, u(151), d), console.log(u(219), D + "%");
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 + "%");
64
65
  };
65
- if (this.printPanels.length) {
66
- let r = globalThis.$[x(239)]({ filter: (e) => {
67
- const t = x;
68
- return e[t(178)] != t(210) || e[t(178)] == t(210) && ([t(136), t(226), t(182), t(194), t(181), t(204), t(187)][t(131)](e[t(135)][t(179)](".")[t(188)]()[t(147)]()) || e[t(135)] != e[t(212)] || e[t(135)][t(142)](t(221)) > -1 && e[t(135)] != e[t(212)] || e[t(135)][t(142)](t(153)) > -1);
69
- }, backgroundColor: x(174) }, a || {}), d = yield this[x(176)](l, a);
70
- a && a[x(189)] != null && (_ = a[x(189)]), a && a[x(163)] != null && (T = a[x(163)]), a && a[x(167)] != null && (f = a[x(167)]), globalThis.$(d)[x(222)]("width", "").css("height", ""), this[x(130)]();
71
- let u = this[x(238)](), D = this[x(207)][0][x(140)], O = this[x(207)][0].height;
72
- const c = this[x(207)][0][x(175)];
73
- if (c && (c[x(134)] > 0 || c[x(183)] > 0) && a[x(225)] && a[x(202)]) {
74
- let e = Math.floor(a[x(225)] / (D + c.layoutRowGap / 2)), t = Math[x(161)](a[x(202)] / (O + c[x(183)] / 2));
75
- const C = e * t, R = d[x(237)](x(236)), b = R.length, q = Math[x(233)](b / C);
76
- let I = globalThis.$(x(192));
77
- c[x(145)] == x(162) ? I[x(158)](x(148) + (Number(c[x(134)]) || 0) / 2 + x(190) + (Number(c[x(183)]) || 0) / 2 + `mm;
78
- }
79
- .hiprint-printTemplate .hiprint-printPanel-small {
80
- display:inline-block;
81
- padding: ` + (Number(c[x(134)]) || 0) / 2 + "mm " + (Number(c.layoutColumnGap) || 0) / 2 + x(184)) : I[x(158)](`<style>
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>
82
76
  .hiprint-printPanel-small{
83
77
  box-sizing: border-box;
84
78
  border: 0px;
@@ -88,120 +82,123 @@ const F = function(l, a) {
88
82
  padding: 0;
89
83
  }
90
84
  .hiprint-printTemplate .hiprint-printPaper{
91
- display: flex;
92
- flex-wrap: wrap;
93
- flex-direction: column;
94
- align-content: flex-start;
95
- margin: -` + (Number(c.layoutRowGap) || 0) / 2 + "mm -" + (Number(c[x(183)]) || 0) / 2 + x(173) + (Number(c[x(134)]) || 0) / 2 + x(227) + (Number(c.layoutColumnGap) || 0) / 2 + x(184));
96
- for (let P = 0; P < q; P++) {
97
- const g = globalThis.$(`<div class="hiprint-printPanel">
98
- <div class="hiprint-printPaper" style="width:` + a[x(225)] + x(152) + a.paperHeight + x(125)), k = P * C, G = Math[x(224)]((P + 1) * C, b);
99
- for (let v = k; v < G; v++) {
100
- const m = R.eq(v)[x(228)]();
101
- m[x(215)]("hiprint-printPaper"), m.addClass("hiprint-printPaper-small start-" + v);
102
- const o = globalThis.$(x(137));
103
- o.append(m), g[x(237)](x(203))[x(158)](o);
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);
104
101
  }
105
- I.append(g);
102
+ v[x(264)](_);
106
103
  }
107
- this[x(154)](I, r), u[x(160)](I[0]);
104
+ this[x(175)](v, i), h[x(182)](v[0]);
108
105
  } else
109
- this.svg2canvas(d, r), u[x(160)](d[0]);
110
- let L = u[x(237)](x(236))[x(159)];
111
- globalThis.$(d)[x(222)](x(229)), this.loadAllImages(d, function() {
112
- const e = x;
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() {
109
+ const t = x;
113
110
  try {
114
- let t = [], C = Math[e(233)](L / f), R = L % f || 1;
115
- const b = document[e(205)](e(126)), q = b[e(200)]("2d"), I = u[e(237)](e(155)).eq(0).width(), P = I * (r[e(232)] || globalThis[e(206)]);
116
- for (let g = 0; g < C; g++) {
117
- q[e(231)](0, 0, b[e(140)], b[e(217)]);
118
- const k = g == C - 1;
119
- let G = 0, v = k ? R : f;
120
- for (let m = 0; m < v; m++) {
121
- q[e(231)](0, 0, b.width, b[e(217)]);
122
- const o = g * f + m, A = u[e(237)](".hiprint-printPanel .hiprint-printPaper")[o];
123
- globalThis[e(129)].queue.add(function(M) {
124
- const N = e;
125
- z.toCanvas(A, r)[N(199)](function(w) {
126
- const s = N;
127
- let y = w.getContext("2d");
128
- y.imageSmoothingEnabled = ![];
129
- let E = w.toDataURL(s(157), r[s(223)] || 0.92), n = new Image();
130
- n[s(135)] = E, n[s(149)] = function() {
131
- const h = s;
132
- m === 0 && (b[h(140)] = P, b[h(217)] = n[h(217)] * v), G += n[h(217)], q[h(172)](n, 0, G - n[h(217)], P, n.height), T(o + 1, L), M();
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), $();
133
130
  };
134
131
  });
135
132
  });
136
133
  }
137
- globalThis[e(129)][e(168)][e(230)](function(m) {
138
- const o = e;
139
- let A = r[o(213)] || o(157), M = r.toType || "url", N = r.quality || 0.8;
140
- if (_) {
141
- let w = b[o(169)](A, N), s = new Image();
142
- s[o(135)] = w, s[o(149)] = function() {
143
- const y = o;
144
- t.push({ url: w, start: g * f + 1, end: g * f + v }), k && (globalThis[y(129)][y(168)][y(191)](), i[y(166)](), t[y(146)]((E) => {
145
- const n = y;
146
- let h = document.createElement("a"), U = a.name || n(198);
147
- U[n(142)](".") == -1 && (U += ".jpg");
148
- let H = U[n(179)](".").pop(), X = U[n(240)]("." + H, "") + "_" + E[n(197)] + "-" + E[n(234)] + "." + H;
149
- h[n(144)][n(196)] = n(164), h[n(132)](n(127), X), h[n(132)](n(208), E[n(218)]), document[n(211)][n(170)](h), h[n(128)](), h[n(193)]();
150
- })), m();
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();
151
148
  };
152
149
  return;
153
150
  }
154
- if (M == o(218)) {
155
- t[o(180)](b[o(169)](A, N)), k && (globalThis.hinnn.queue.clear(), i[o(166)](), p.resolve(t)), m();
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();
156
153
  return;
157
154
  }
158
- M == o(171) && b[o(143)](function(w) {
159
- const s = o;
160
- t[s(180)](w), k && (globalThis[s(129)][s(168)][s(191)](), i[s(166)](), p[s(150)](t)), m();
161
- }, A, N);
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);
162
159
  });
163
160
  }
164
- globalThis[e(129)].queue[e(165)]();
165
- } catch (t) {
166
- console[e(186)](e(139)), console[e(177)](t);
161
+ globalThis[t(195)].queue.run();
162
+ } catch (m) {
163
+ console.error(t(201)), console.log(m);
167
164
  }
168
165
  });
169
166
  }
170
- return p[x(185)]();
167
+ return s[x(186)]();
171
168
  });
172
169
  };
173
- function j(l, a) {
174
- var x = B();
175
- return j = function(i, p) {
176
- i = i - 439;
177
- var _ = x[i];
178
- return _;
179
- }, j(l, a);
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);
180
177
  }
181
- (function(l, a) {
182
- for (var x = j, i = l(); []; )
178
+ (function(o, e) {
179
+ for (var x = L, a = o(); []; )
183
180
  try {
184
- var p = -parseInt(x(449)) / 1 + -parseInt(x(450)) / 2 + -parseInt(x(441)) / 3 * (-parseInt(x(451)) / 4) + -parseInt(x(440)) / 5 + -parseInt(x(448)) / 6 + -parseInt(x(445)) / 7 * (parseInt(x(444)) / 8) + parseInt(x(452)) / 9;
185
- if (p === a)
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)
186
183
  break;
187
- i.push(i.shift());
188
- } catch (_) {
189
- i.push(i.shift());
184
+ a.push(a.shift());
185
+ } catch (g) {
186
+ a.push(a.shift());
190
187
  }
191
- })(B, 672242);
192
- function B() {
193
- var l = ["toImage", "newPrintTemplate", "5735748wEEXNA", "866176wrVrBA", "2662854EUUogl", "124DeyVZy", "40837464ixUXSs", "defineProperty", "add toImage Api to PrintTemplate", "478835hEHDBX", "53187kqUhVY", "0.3.0", "add toImage Api", "40AVZCZk", "1631735VNBrko"];
194
- return B = function() {
195
- return l;
196
- }, B();
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();
197
194
  }
198
- function W(l) {
199
- var a = j;
200
- return { name: a(443), description: a(443), hooks: [{ hook: a(447), name: a(439), description: a(439), priority: 1, run: ({ template: x, options: i }) => {
201
- var p = a;
202
- Object[p(453)](x, p(446), { value: F, enumerable: ![], writable: !![], configurable: !![] });
203
- } }], leastHiprintVersion: a(442) };
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) };
204
201
  }
205
202
  export {
206
- W as default
203
+ Z as default
207
204
  };
package/dist/index.umd.js CHANGED
@@ -1,7 +1,8 @@
1
- (function(_,P){typeof exports=="object"&&typeof module!="undefined"?module.exports=P(require("html-to-image")):typeof define=="function"&&define.amd?define(["html-to-image"],P):(_=typeof globalThis!="undefined"?globalThis:_||self,_.pluginApiImage=P(_.htmlToImage))})(this,function(_){"use strict";var F=(_,P,q)=>new Promise((j,T)=>{var H=m=>{try{v(q.next(m))}catch(a){T(a)}},A=m=>{try{v(q.throw(m))}catch(a){T(a)}},v=m=>m.done?j(m.value):Promise.resolve(m.value).then(H,A);v((q=q.apply(_,P)).next())});function P(a){if(a&&a.__esModule)return a;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const x in a)if(x!=="default"){const r=Object.getOwnPropertyDescriptor(a,x);Object.defineProperty(e,x,r.get?r:{enumerable:!0,get:()=>a[x]})}}return e.default=a,Object.freeze(e)}const q=P(_);(function(a,e){const x=j,r=a();for(;[];)try{if(-parseInt(x(214))/1+parseInt(x(216))/2*(parseInt(x(156))/3)+-parseInt(x(209))/4+parseInt(x(235))/5*(parseInt(x(141))/6)+parseInt(x(201))/7+parseInt(x(138))/8*(parseInt(x(133))/9)+-parseInt(x(195))/10===e)break;r.push(r.shift())}catch(d){r.push(r.shift())}})(T,530777);function j(a,e){const x=T();return j=function(r,d){return r=r-125,x[r]},j(a,e)}function T(){const a=["panelLayoutOptions","getHtml","log","tagName","split","push","bmp","png","layoutColumnGap",`mm;
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;
2
3
  }
3
- </style>`,"promise","error","svg","pop","isDownload","mm -","clear",'<div class="hiprint-printTemplate"></div>',"remove","gif","5574770ZFkrus","display","start","download.jpg","then","getContext","2980565JyqIBA","paperHeight",".hiprint-printPaper","webp","createElement","devicePixelRatio","printPanels","href","1440824kCvhdt","IMG","body","baseURI","type","256445KocNgi","removeClass","26204gqFAmG","height","url","toImage percent: ","Deferred","http","css","quality","min","paperWidth","jpeg","mm ","clone","position:fixed","add","clearRect","pixelRatio","ceil","end","15PmlZWM",".hiprint-printPanel .hiprint-printPaper","find","getTempContainer","extend","replace",`mm;"></div>
4
- </div>`,"canvas","download","click","hinnn","createTempContainer","includes","setAttribute","6577731vQhOou","layoutRowGap","src","jpg",'<div class="hiprint-printPanel-small"></div>',"8EJUwVc","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","width","677238fBeALd","indexOf","toBlob","style","layoutType","forEach","toLowerCase",`<style>
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>
5
6
  .hiprint-printPanel-small{
6
7
  box-sizing: border-box;
7
8
  border: 0px;
@@ -11,15 +12,11 @@
11
12
  padding: 0;
12
13
  }
13
14
  .hiprint-printTemplate .hiprint-printPaper{
14
- margin: -`,"onload","resolve","total","mm;height:","base64","svg2canvas",".hiprint-printPanel","48LVERkP","image/jpeg","append","length","html","floor","row","onProgress","none","run","removeTempContainer","limit","queue","toDataURL","appendChild","blob","drawImage",`mm;
15
- }
16
- .hiprint-printTemplate .hiprint-printPanel-small {
17
- display:inline-block;
18
- padding: `,"#fff"];return T=function(){return a},T()}const H=function(a,e){return F(this,null,function*(){const x=j;let r=this,d=globalThis.$[x(220)](),E=!![],w=10,z=(h,f)=>{const u=x,Z=Math[u(161)](h/f*100);console[u(177)]("cur",h,u(151),f),console.log(u(219),Z+"%")};if(this.printPanels.length){let h=globalThis.$[x(239)]({filter:t=>{const n=x;return t[n(178)]!=n(210)||t[n(178)]==n(210)&&([n(136),n(226),n(182),n(194),n(181),n(204),n(187)][n(131)](t[n(135)][n(179)](".")[n(188)]()[n(147)]())||t[n(135)]!=t[n(212)]||t[n(135)][n(142)](n(221))>-1&&t[n(135)]!=t[n(212)]||t[n(135)][n(142)](n(153))>-1)},backgroundColor:x(174)},e||{}),f=yield this[x(176)](a,e);e&&e[x(189)]!=null&&(E=e[x(189)]),e&&e[x(163)]!=null&&(z=e[x(163)]),e&&e[x(167)]!=null&&(w=e[x(167)]),globalThis.$(f)[x(222)]("width","").css("height",""),this[x(130)]();let u=this[x(238)](),Z=this[x(207)][0][x(140)],J=this[x(207)][0].height;const p=this[x(207)][0][x(175)];if(p&&(p[x(134)]>0||p[x(183)]>0)&&e[x(225)]&&e[x(202)]){let t=Math.floor(e[x(225)]/(Z+p.layoutRowGap/2)),n=Math[x(161)](e[x(202)]/(J+p[x(183)]/2));const M=t*n,D=f[x(237)](x(236)),s=D.length,G=Math[x(233)](s/M);let C=globalThis.$(x(192));p[x(145)]==x(162)?C[x(158)](x(148)+(Number(p[x(134)])||0)/2+x(190)+(Number(p[x(183)])||0)/2+`mm;
19
- }
20
- .hiprint-printTemplate .hiprint-printPanel-small {
21
- display:inline-block;
22
- padding: `+(Number(p[x(134)])||0)/2+"mm "+(Number(p.layoutColumnGap)||0)/2+x(184)):C[x(158)](`<style>
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>
23
20
  .hiprint-printPanel-small{
24
21
  box-sizing: border-box;
25
22
  border: 0px;
@@ -29,9 +26,12 @@
29
26
  padding: 0;
30
27
  }
31
28
  .hiprint-printTemplate .hiprint-printPaper{
32
- display: flex;
33
- flex-wrap: wrap;
34
- flex-direction: column;
35
- align-content: flex-start;
36
- margin: -`+(Number(p.layoutRowGap)||0)/2+"mm -"+(Number(p[x(183)])||0)/2+x(173)+(Number(p[x(134)])||0)/2+x(227)+(Number(p.layoutColumnGap)||0)/2+x(184));for(let k=0;k<G;k++){const g=globalThis.$(`<div class="hiprint-printPanel">
37
- <div class="hiprint-printPaper" style="width:`+e[x(225)]+x(152)+e.paperHeight+x(125)),R=k*M,$=Math[x(224)]((k+1)*M,s);for(let y=R;y<$;y++){const b=D.eq(y)[x(228)]();b[x(215)]("hiprint-printPaper"),b.addClass("hiprint-printPaper-small start-"+y);const o=globalThis.$(x(137));o.append(b),g[x(237)](x(203))[x(158)](o)}C.append(g)}this[x(154)](C,h),u[x(160)](C[0])}else this.svg2canvas(f,h),u[x(160)](f[0]);let S=u[x(237)](x(236))[x(159)];globalThis.$(f)[x(222)](x(229)),this.loadAllImages(f,function(){const t=x;try{let n=[],M=Math[t(233)](S/w),D=S%w||1;const s=document[t(205)](t(126)),G=s[t(200)]("2d"),C=u[t(237)](t(155)).eq(0).width(),k=C*(h[t(232)]||globalThis[t(206)]);for(let g=0;g<M;g++){G[t(231)](0,0,s[t(140)],s[t(217)]);const R=g==M-1;let $=0,y=R?D:w;for(let b=0;b<y;b++){G[t(231)](0,0,s.width,s[t(217)]);const o=g*w+b,U=u[t(237)](".hiprint-printPanel .hiprint-printPaper")[o];globalThis[t(129)].queue.add(function(B){const O=t;q.toCanvas(U,h)[O(199)](function(N){const l=O;let I=N.getContext("2d");I.imageSmoothingEnabled=![];let V=N.toDataURL(l(157),h[l(223)]||.92),i=new Image;i[l(135)]=V,i[l(149)]=function(){const c=l;b===0&&(s[c(140)]=k,s[c(217)]=i[c(217)]*y),$+=i[c(217)],G[c(172)](i,0,$-i[c(217)],k,i.height),z(o+1,S),B()}})})}globalThis[t(129)][t(168)][t(230)](function(b){const o=t;let U=h[o(213)]||o(157),B=h.toType||"url",O=h.quality||.8;if(E){let N=s[o(169)](U,O),l=new Image;l[o(135)]=N,l[o(149)]=function(){const I=o;n.push({url:N,start:g*w+1,end:g*w+y}),R&&(globalThis[I(129)][I(168)][I(191)](),r[I(166)](),n[I(146)](V=>{const i=I;let c=document.createElement("a"),L=e.name||i(198);L[i(142)](".")==-1&&(L+=".jpg");let X=L[i(179)](".").pop(),W=L[i(240)]("."+X,"")+"_"+V[i(197)]+"-"+V[i(234)]+"."+X;c[i(144)][i(196)]=i(164),c[i(132)](i(127),W),c[i(132)](i(208),V[i(218)]),document[i(211)][i(170)](c),c[i(128)](),c[i(193)]()})),b()};return}if(B==o(218)){n[o(180)](s[o(169)](U,O)),R&&(globalThis.hinnn.queue.clear(),r[o(166)](),d.resolve(n)),b();return}B==o(171)&&s[o(143)](function(N){const l=o;n[l(180)](N),R&&(globalThis[l(129)][l(168)][l(191)](),r[l(166)](),d[l(150)](n)),b()},U,O)})}globalThis[t(129)].queue[t(165)]()}catch(n){console[t(186)](t(139)),console[t(177)](n)}})}return d[x(185)]()})};function A(a,e){var x=v();return A=function(r,d){r=r-439;var E=x[r];return E},A(a,e)}(function(a,e){for(var x=A,r=a();[];)try{var d=-parseInt(x(449))/1+-parseInt(x(450))/2+-parseInt(x(441))/3*(-parseInt(x(451))/4)+-parseInt(x(440))/5+-parseInt(x(448))/6+-parseInt(x(445))/7*(parseInt(x(444))/8)+parseInt(x(452))/9;if(d===e)break;r.push(r.shift())}catch(E){r.push(r.shift())}})(v,672242);function v(){var a=["toImage","newPrintTemplate","5735748wEEXNA","866176wrVrBA","2662854EUUogl","124DeyVZy","40837464ixUXSs","defineProperty","add toImage Api to PrintTemplate","478835hEHDBX","53187kqUhVY","0.3.0","add toImage Api","40AVZCZk","1631735VNBrko"];return v=function(){return a},v()}function m(a){var e=A;return{name:e(443),description:e(443),hooks:[{hook:e(447),name:e(439),description:e(439),priority:1,run:({template:x,options:r})=>{var d=e;Object[d(453)](x,d(446),{value:H,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(442)}}return m});
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.6",
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
  }