@sv-print/plugin-api-image 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +103 -102
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @sv-print/plugin-api-image
|
|
2
|
+
|
|
3
|
+
给 sv-print 提供导出图片的 API 插件。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @sv-print/plugin-api-image
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用
|
|
12
|
+
|
|
13
|
+
sv-print 插件引入的两种方式见:[sv-print 插件引入的两种方式:https://www.ibujian.cn/svp/plugin/a02.html](https://www.ibujian.cn/svp/plugin/a02.html)
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import pluginEleBwip from "@sv-print/plugin-ele-bwip-js";
|
|
17
|
+
const plugins = [pluginEleBwip({})];
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## License
|
|
21
|
+
|
|
22
|
+
LGPL
|
|
23
|
+
|
|
24
|
+
### 开源使用须知
|
|
25
|
+
|
|
26
|
+
1.请自觉遵守 LGPL 协议,其他用途可联系作者;
|
|
27
|
+
|
|
28
|
+
2.允许用于个人学习、毕业设计、教学案例、公益事业、商业使用;
|
|
29
|
+
|
|
30
|
+
3.如果商用必须保留版权信息,请自觉遵守;
|
|
31
|
+
|
|
32
|
+
4.禁止将本开源的代码和资源进行任何形式任何名义的出售,否则产生的一切任何后果责任由侵权者自负;
|
|
33
|
+
|
|
34
|
+
5.商用请仔细审查代码和漏洞,不得用于任一国家许可范围之外的商业应用,产生的一切任何后果责任自负;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var W=(r,t,e)=>new Promise((a,l)=>{var h=c=>{try{I(e.next(c))}catch(b){l(b)}},u=c=>{try{I(e.throw(c))}catch(b){l(b)}},I=c=>c.done?a(c.value):Promise.resolve(c.value).then(h,u);I((e=e.apply(r,t)).next())});const E=require("html-to-image");function F(r){if(r&&r.__esModule)return r;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,a.get?a:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const L=F(E);(function(r,t){const e=j,a=r();for(;[];)try{if(parseInt(e(289))/1+-parseInt(e(367))/2+parseInt(e(324))/3*(parseInt(e(316))/4)+-parseInt(e(306))/5+parseInt(e(325))/6*(parseInt(e(336))/7)+parseInt(e(344))/8*(parseInt(e(334))/9)+-parseInt(e(308))/10*(-parseInt(e(286))/11)===t)break;a.push(a.shift())}catch(l){a.push(a.shift())}})(M,710956);function M(){const r=["toDataURL","height","baseURI","find","position:fixed","display","download.jpg","loadAllImages","indexOf","length","jpg","remove",".jpg","start","removeTempContainer","log","pixelRatio","add","698464IYwzVZ","resolve","devicePixelRatio","queue","quality","push","imageSmoothingEnabled","run","tagName","image/jpeg","onProgress","toImage percent: ","getHtml","1738qOahFf","toType","floor","451297HqroPf","forEach","includes","svg","getContext","clear","png","getTempContainer","name","jpeg","css","src","IMG","end",".hiprint-printPanel .hiprint-printPaper","style","width","5644560azgNiN","createElement","5920pDYpGT","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","body","appendChild","then","drawImage","onload","hinnn","1052056OdLMHP","url","replace","cur","limit","#fff","isDownload","download","6hwSYbH","6XXeNZP","clearRect","gif","canvas","printPanels","base64","split","promise","none","9xKBDjH","extend","3945767IekuVg","ceil","click","http","toLowerCase","pop","toCanvas","blob","4436464MMWMcf","href","setAttribute","total","bmp"];return M=function(){return r},M()}function j(r,t){const e=M();return j=function(a,l){return a=a-277,e[a]},j(r,t)}const U=function(r,t){return W(this,null,function*(){const e=j;let a=this,l=globalThis.$.Deferred(),h=!![],u=10,I=(c,b)=>{const p=j,T=Math[p(288)](c/b*100);console[p(364)](p(319),c,p(347),b),console[p(364)](p(284),T+"%")};if(this[e(329)].length){let c=globalThis.$[e(335)]({filter:x=>{const n=e;return x.tagName!=n(301)||x[n(281)]==n(301)&&([n(359),n(298),n(295),n(327),n(348),"webp",n(292)][n(291)](x[n(300)].split(".")[n(341)]()[n(340)]())||x[n(300)]!=x.baseURI||x.src[n(357)](n(339))>-1&&x[n(300)]!=x[n(351)]||x[n(300)][n(357)](n(330))>-1)},backgroundColor:e(321)},t||{}),b=yield this[e(285)](r,t);t&&t[e(322)]!=null&&(h=t.isDownload),t&&t[e(283)]!=null&&(I=t.onProgress),t&&t[e(320)]!=null&&(u=t.limit),globalThis.$(b)[e(299)]("width","")[e(299)](e(350),""),this.createTempContainer();let p=this[e(296)]();this.svg2canvas(b,c),p.html(b[0]);let T=p[e(352)](e(303))[e(358)];globalThis.$(b)[e(299)](e(353)),this[e(356)](b,function(){const x=e;try{let n=[],R=Math[x(337)](T/u),X=T%u||1;const f=document[x(307)](x(328)),C=f[x(293)]("2d"),H=p.width()*(c[x(365)]||globalThis[x(369)]);for(let v=0;v<R;v++){C[x(326)](0,0,f[x(305)],f[x(350)]);const O=v==R-1;let G=0,D=O?X:u;for(let g=0;g<D;g++){C[x(326)](0,0,f[x(305)],f.height);const i=v*u+g,y=p[x(352)](x(303))[i];globalThis[x(315)][x(370)].add(function(k){const _=x;L[_(342)](y,c)[_(312)](function(m){const s=_;let w=m[s(293)]("2d");w[s(279)]=![];let P=m.toDataURL(s(282),c[s(277)]||.92),o=new Image;o[s(300)]=P,o[s(314)]=function(){const d=s;g===0&&(f[d(305)]=H,f.height=o[d(350)]*D),G+=o[d(350)],C[d(313)](o,0,G-o[d(350)],H,o[d(350)]),I(i+1,T),k()}})})}globalThis[x(315)].queue[x(366)](function(g){const i=x;let y=c.type||i(282),k=c[i(287)]||"url",_=c.quality||.8;if(h){let m=f[i(349)](y,_),s=new Image;s[i(300)]=m,s[i(314)]=function(){const w=i;n.push({url:m,start:v*u+1,end:v*u+D}),O&&(globalThis.hinnn[w(370)].clear(),a[w(363)](),n[w(290)](P=>{const o=w;let d=document.createElement("a"),q=t[o(297)]||o(355);q.indexOf(".")==-1&&(q+=o(361));let S=q[o(331)](".")[o(341)](),Y=q[o(318)]("."+S,"")+"_"+P[o(362)]+"-"+P[o(302)]+"."+S;d[o(304)][o(354)]=o(333),d.setAttribute(o(323),Y),d[o(346)](o(345),P[o(317)]),document[o(310)][o(311)](d),d[o(338)](),d[o(360)]()})),g()};return}if(k==i(317)){n.push(f[i(349)](y,_)),O&&(globalThis[i(315)][i(370)][i(294)](),a[i(363)](),l[i(368)](n)),g();return}k==i(343)&&f.toBlob(function(m){const s=i;n[s(278)](m),O&&(globalThis[s(315)][s(370)].clear(),a[s(363)](),l[s(368)](n)),g()},y,_)})}globalThis[x(315)].queue[x(280)]()}catch(n){console.error(x(309)),console[x(364)](n)}})}return l[e(332)]()})};function N(r,t){var e=A();return N=function(a,l){a=a-132;var h=e[a];return h},N(r,t)}(function(r,t){for(var e=N,a=r();[];)try{var l=parseInt(e(141))/1+-parseInt(e(142))/2*(parseInt(e(144))/3)+-parseInt(e(143))/4*(-parseInt(e(139))/5)+-parseInt(e(138))/6+-parseInt(e(136))/7+-parseInt(e(134))/8*(-parseInt(e(132))/9)+parseInt(e(137))/10;if(l===t)break;a.push(a.shift())}catch(h){a.push(a.shift())}})(A,429921);function Z(r){var t=N;return{name:"add toImage Api",description:"add toImage Api",hooks:[{hook:t(140),name:t(135),description:t(135),priority:1,run:({template:e,options:a})=>{var l=t;Object.defineProperty(e,l(133),{value:U,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:"0.3.0"}}function A(){var r=["add toImage Api to PrintTemplate","53613RFXdgt","2654180GiWpZa","899760buZBGF","42740jYPwWY","newPrintTemplate","243290IFIGAk","765172hmfXSH","196NPJNIG","6qNKtTX","72dAWOWk","toImage","425152nOqmtJ"];return A=function(){return r},A()}module.exports=Z;
|
package/dist/index.mjs
CHANGED
|
@@ -1,152 +1,153 @@
|
|
|
1
|
-
var
|
|
1
|
+
var X = (c, n, x) => new Promise((o, l) => {
|
|
2
2
|
var h = (r) => {
|
|
3
3
|
try {
|
|
4
4
|
I(x.next(r));
|
|
5
|
-
} catch (
|
|
6
|
-
|
|
5
|
+
} catch (p) {
|
|
6
|
+
l(p);
|
|
7
7
|
}
|
|
8
8
|
}, u = (r) => {
|
|
9
9
|
try {
|
|
10
10
|
I(x.throw(r));
|
|
11
|
-
} catch (
|
|
12
|
-
|
|
11
|
+
} catch (p) {
|
|
12
|
+
l(p);
|
|
13
13
|
}
|
|
14
14
|
}, I = (r) => r.done ? o(r.value) : Promise.resolve(r.value).then(h, u);
|
|
15
|
-
I((x = x.apply(
|
|
15
|
+
I((x = x.apply(c, n)).next());
|
|
16
16
|
});
|
|
17
|
-
import * as
|
|
18
|
-
function
|
|
19
|
-
const x =
|
|
20
|
-
return D = function(o, f) {
|
|
21
|
-
return o = o - 474, x[o];
|
|
22
|
-
}, D(s, n);
|
|
23
|
-
}
|
|
24
|
-
(function(s, n) {
|
|
25
|
-
const x = D, o = s();
|
|
17
|
+
import * as F from "html-to-image";
|
|
18
|
+
(function(c, n) {
|
|
19
|
+
const x = k, o = c();
|
|
26
20
|
for (; []; )
|
|
27
21
|
try {
|
|
28
|
-
if (parseInt(x(
|
|
22
|
+
if (parseInt(x(289)) / 1 + -parseInt(x(367)) / 2 + parseInt(x(324)) / 3 * (parseInt(x(316)) / 4) + -parseInt(x(306)) / 5 + parseInt(x(325)) / 6 * (parseInt(x(336)) / 7) + parseInt(x(344)) / 8 * (parseInt(x(334)) / 9) + -parseInt(x(308)) / 10 * (-parseInt(x(286)) / 11) === n)
|
|
29
23
|
break;
|
|
30
24
|
o.push(o.shift());
|
|
31
|
-
} catch (
|
|
25
|
+
} catch (l) {
|
|
32
26
|
o.push(o.shift());
|
|
33
27
|
}
|
|
34
|
-
})(
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
return
|
|
38
|
-
return
|
|
39
|
-
},
|
|
28
|
+
})(C, 710956);
|
|
29
|
+
function C() {
|
|
30
|
+
const c = ["toDataURL", "height", "baseURI", "find", "position:fixed", "display", "download.jpg", "loadAllImages", "indexOf", "length", "jpg", "remove", ".jpg", "start", "removeTempContainer", "log", "pixelRatio", "add", "698464IYwzVZ", "resolve", "devicePixelRatio", "queue", "quality", "push", "imageSmoothingEnabled", "run", "tagName", "image/jpeg", "onProgress", "toImage percent: ", "getHtml", "1738qOahFf", "toType", "floor", "451297HqroPf", "forEach", "includes", "svg", "getContext", "clear", "png", "getTempContainer", "name", "jpeg", "css", "src", "IMG", "end", ".hiprint-printPanel .hiprint-printPaper", "style", "width", "5644560azgNiN", "createElement", "5920pDYpGT", "toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "body", "appendChild", "then", "drawImage", "onload", "hinnn", "1052056OdLMHP", "url", "replace", "cur", "limit", "#fff", "isDownload", "download", "6hwSYbH", "6XXeNZP", "clearRect", "gif", "canvas", "printPanels", "base64", "split", "promise", "none", "9xKBDjH", "extend", "3945767IekuVg", "ceil", "click", "http", "toLowerCase", "pop", "toCanvas", "blob", "4436464MMWMcf", "href", "setAttribute", "total", "bmp"];
|
|
31
|
+
return C = function() {
|
|
32
|
+
return c;
|
|
33
|
+
}, C();
|
|
34
|
+
}
|
|
35
|
+
function k(c, n) {
|
|
36
|
+
const x = C();
|
|
37
|
+
return k = function(o, l) {
|
|
38
|
+
return o = o - 277, x[o];
|
|
39
|
+
}, k(c, n);
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
return
|
|
43
|
-
const x =
|
|
44
|
-
let o = this,
|
|
45
|
-
const b =
|
|
46
|
-
console
|
|
41
|
+
const L = function(c, n) {
|
|
42
|
+
return X(this, null, function* () {
|
|
43
|
+
const x = k;
|
|
44
|
+
let o = this, l = globalThis.$.Deferred(), h = !![], u = 10, I = (r, p) => {
|
|
45
|
+
const b = k, T = Math[b(288)](r / p * 100);
|
|
46
|
+
console[b(364)](b(319), r, b(347), p), console[b(364)](b(284), T + "%");
|
|
47
47
|
};
|
|
48
|
-
if (this[x(
|
|
49
|
-
let r = globalThis.$[x(
|
|
48
|
+
if (this[x(329)].length) {
|
|
49
|
+
let r = globalThis.$[x(335)]({ filter: (e) => {
|
|
50
50
|
const t = x;
|
|
51
|
-
return e
|
|
52
|
-
}, backgroundColor:
|
|
53
|
-
n && n[x(
|
|
54
|
-
let b = this[x(
|
|
55
|
-
this
|
|
56
|
-
let
|
|
57
|
-
globalThis.$(
|
|
51
|
+
return e.tagName != t(301) || e[t(281)] == t(301) && ([t(359), t(298), t(295), t(327), t(348), "webp", t(292)][t(291)](e[t(300)].split(".")[t(341)]()[t(340)]()) || e[t(300)] != e.baseURI || e.src[t(357)](t(339)) > -1 && e[t(300)] != e[t(351)] || e[t(300)][t(357)](t(330)) > -1);
|
|
52
|
+
}, backgroundColor: x(321) }, n || {}), p = yield this[x(285)](c, n);
|
|
53
|
+
n && n[x(322)] != null && (h = n.isDownload), n && n[x(283)] != null && (I = n.onProgress), n && n[x(320)] != null && (u = n.limit), globalThis.$(p)[x(299)]("width", "")[x(299)](x(350), ""), this.createTempContainer();
|
|
54
|
+
let b = this[x(296)]();
|
|
55
|
+
this.svg2canvas(p, r), b.html(p[0]);
|
|
56
|
+
let T = b[x(352)](x(303))[x(358)];
|
|
57
|
+
globalThis.$(p)[x(299)](x(353)), this[x(356)](p, function() {
|
|
58
58
|
const e = x;
|
|
59
59
|
try {
|
|
60
|
-
let t = [],
|
|
61
|
-
const
|
|
62
|
-
for (let v = 0; v <
|
|
63
|
-
|
|
64
|
-
const q = v ==
|
|
65
|
-
let
|
|
66
|
-
for (let g = 0; g <
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
globalThis
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
-
let
|
|
76
|
-
a[
|
|
77
|
-
const
|
|
78
|
-
g === 0 && (
|
|
60
|
+
let t = [], M = Math[e(337)](T / u), Y = T % u || 1;
|
|
61
|
+
const f = document[e(307)](e(328)), D = f[e(293)]("2d"), O = b.width() * (r[e(365)] || globalThis[e(369)]);
|
|
62
|
+
for (let v = 0; v < M; v++) {
|
|
63
|
+
D[e(326)](0, 0, f[e(305)], f[e(350)]);
|
|
64
|
+
const q = v == M - 1;
|
|
65
|
+
let G = 0, H = q ? Y : u;
|
|
66
|
+
for (let g = 0; g < H; g++) {
|
|
67
|
+
D[e(326)](0, 0, f[e(305)], f.height);
|
|
68
|
+
const i = v * u + g, P = b[e(352)](e(303))[i];
|
|
69
|
+
globalThis[e(315)][e(370)].add(function(j) {
|
|
70
|
+
const _ = e;
|
|
71
|
+
F[_(342)](P, r)[_(312)](function(m) {
|
|
72
|
+
const s = _;
|
|
73
|
+
let w = m[s(293)]("2d");
|
|
74
|
+
w[s(279)] = ![];
|
|
75
|
+
let y = m.toDataURL(s(282), r[s(277)] || 0.92), a = new Image();
|
|
76
|
+
a[s(300)] = y, a[s(314)] = function() {
|
|
77
|
+
const d = s;
|
|
78
|
+
g === 0 && (f[d(305)] = O, f.height = a[d(350)] * H), G += a[d(350)], D[d(313)](a, 0, G - a[d(350)], O, a[d(350)]), I(i + 1, T), j();
|
|
79
79
|
};
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
globalThis[e(
|
|
84
|
-
const
|
|
85
|
-
let
|
|
83
|
+
globalThis[e(315)].queue[e(366)](function(g) {
|
|
84
|
+
const i = e;
|
|
85
|
+
let P = r.type || i(282), j = r[i(287)] || "url", _ = r.quality || 0.8;
|
|
86
86
|
if (h) {
|
|
87
|
-
let
|
|
88
|
-
i
|
|
89
|
-
const
|
|
90
|
-
t
|
|
91
|
-
const a =
|
|
92
|
-
let
|
|
93
|
-
|
|
94
|
-
let
|
|
95
|
-
|
|
87
|
+
let m = f[i(349)](P, _), s = new Image();
|
|
88
|
+
s[i(300)] = m, s[i(314)] = function() {
|
|
89
|
+
const w = i;
|
|
90
|
+
t.push({ url: m, start: v * u + 1, end: v * u + H }), q && (globalThis.hinnn[w(370)].clear(), o[w(363)](), t[w(290)]((y) => {
|
|
91
|
+
const a = w;
|
|
92
|
+
let d = document.createElement("a"), A = n[a(297)] || a(355);
|
|
93
|
+
A.indexOf(".") == -1 && (A += a(361));
|
|
94
|
+
let W = A[a(331)](".")[a(341)](), E = A[a(318)]("." + W, "") + "_" + y[a(362)] + "-" + y[a(302)] + "." + W;
|
|
95
|
+
d[a(304)][a(354)] = a(333), d.setAttribute(a(323), E), d[a(346)](a(345), y[a(317)]), document[a(310)][a(311)](d), d[a(338)](), d[a(360)]();
|
|
96
96
|
})), g();
|
|
97
97
|
};
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
if (
|
|
101
|
-
t.push(
|
|
100
|
+
if (j == i(317)) {
|
|
101
|
+
t.push(f[i(349)](P, _)), q && (globalThis[i(315)][i(370)][i(294)](), o[i(363)](), l[i(368)](t)), g();
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
t[
|
|
107
|
-
},
|
|
104
|
+
j == i(343) && f.toBlob(function(m) {
|
|
105
|
+
const s = i;
|
|
106
|
+
t[s(278)](m), q && (globalThis[s(315)][s(370)].clear(), o[s(363)](), l[s(368)](t)), g();
|
|
107
|
+
}, P, _);
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
globalThis
|
|
110
|
+
globalThis[e(315)].queue[e(280)]();
|
|
111
111
|
} catch (t) {
|
|
112
|
-
console
|
|
112
|
+
console.error(e(309)), console[e(364)](t);
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
-
return
|
|
116
|
+
return l[x(332)]();
|
|
117
117
|
});
|
|
118
118
|
};
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
function N(c, n) {
|
|
120
|
+
var x = R();
|
|
121
|
+
return N = function(o, l) {
|
|
122
|
+
o = o - 132;
|
|
123
|
+
var h = x[o];
|
|
124
|
+
return h;
|
|
125
|
+
}, N(c, n);
|
|
126
|
+
}
|
|
127
|
+
(function(c, n) {
|
|
128
|
+
for (var x = N, o = c(); []; )
|
|
121
129
|
try {
|
|
122
|
-
var
|
|
123
|
-
if (
|
|
130
|
+
var l = parseInt(x(141)) / 1 + -parseInt(x(142)) / 2 * (parseInt(x(144)) / 3) + -parseInt(x(143)) / 4 * (-parseInt(x(139)) / 5) + -parseInt(x(138)) / 6 + -parseInt(x(136)) / 7 + -parseInt(x(134)) / 8 * (-parseInt(x(132)) / 9) + parseInt(x(137)) / 10;
|
|
131
|
+
if (l === n)
|
|
124
132
|
break;
|
|
125
133
|
o.push(o.shift());
|
|
126
134
|
} catch (h) {
|
|
127
135
|
o.push(o.shift());
|
|
128
136
|
}
|
|
129
|
-
})(
|
|
130
|
-
function
|
|
131
|
-
var
|
|
132
|
-
return
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
function k(s, n) {
|
|
137
|
-
var x = M();
|
|
138
|
-
return k = function(o, f) {
|
|
139
|
-
o = o - 330;
|
|
140
|
-
var h = x[o];
|
|
141
|
-
return h;
|
|
142
|
-
}, k(s, n);
|
|
137
|
+
})(R, 429921);
|
|
138
|
+
function Z(c) {
|
|
139
|
+
var n = N;
|
|
140
|
+
return { name: "add toImage Api", description: "add toImage Api", hooks: [{ hook: n(140), name: n(135), description: n(135), priority: 1, run: ({ template: x, options: o }) => {
|
|
141
|
+
var l = n;
|
|
142
|
+
Object.defineProperty(x, l(133), { value: L, enumerable: ![], writable: !![], configurable: !![] });
|
|
143
|
+
} }], leastHiprintVersion: "0.3.0" };
|
|
143
144
|
}
|
|
144
|
-
function
|
|
145
|
-
var
|
|
146
|
-
return
|
|
147
|
-
|
|
148
|
-
}
|
|
145
|
+
function R() {
|
|
146
|
+
var c = ["add toImage Api to PrintTemplate", "53613RFXdgt", "2654180GiWpZa", "899760buZBGF", "42740jYPwWY", "newPrintTemplate", "243290IFIGAk", "765172hmfXSH", "196NPJNIG", "6qNKtTX", "72dAWOWk", "toImage", "425152nOqmtJ"];
|
|
147
|
+
return R = function() {
|
|
148
|
+
return c;
|
|
149
|
+
}, R();
|
|
149
150
|
}
|
|
150
151
|
export {
|
|
151
|
-
|
|
152
|
+
Z as default
|
|
152
153
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(b,_){typeof exports=="object"&&typeof module!="undefined"?module.exports=_(require("html-to-image")):typeof define=="function"&&define.amd?define(["html-to-image"],_):(b=typeof globalThis!="undefined"?globalThis:b||self,b.pluginApiImage=_(b.htmlToImage))})(this,function(b){"use strict";var
|
|
1
|
+
(function(b,_){typeof exports=="object"&&typeof module!="undefined"?module.exports=_(require("html-to-image")):typeof define=="function"&&define.amd?define(["html-to-image"],_):(b=typeof globalThis!="undefined"?globalThis:b||self,b.pluginApiImage=_(b.htmlToImage))})(this,function(b){"use strict";var L=(b,_,w)=>new Promise((y,h)=>{var H=l=>{try{q(w.next(l))}catch(a){h(a)}},P=l=>{try{q(w.throw(l))}catch(a){h(a)}},q=l=>l.done?y(l.value):Promise.resolve(l.value).then(H,P);q((w=w.apply(b,_)).next())});function _(a){if(a&&a.__esModule)return a;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(n,e,i.get?i:{enumerable:!0,get:()=>a[e]})}}return n.default=a,Object.freeze(n)}const w=_(b);(function(a,n){const e=h,i=a();for(;[];)try{if(parseInt(e(289))/1+-parseInt(e(367))/2+parseInt(e(324))/3*(parseInt(e(316))/4)+-parseInt(e(306))/5+parseInt(e(325))/6*(parseInt(e(336))/7)+parseInt(e(344))/8*(parseInt(e(334))/9)+-parseInt(e(308))/10*(-parseInt(e(286))/11)===n)break;i.push(i.shift())}catch(d){i.push(i.shift())}})(y,710956);function y(){const a=["toDataURL","height","baseURI","find","position:fixed","display","download.jpg","loadAllImages","indexOf","length","jpg","remove",".jpg","start","removeTempContainer","log","pixelRatio","add","698464IYwzVZ","resolve","devicePixelRatio","queue","quality","push","imageSmoothingEnabled","run","tagName","image/jpeg","onProgress","toImage percent: ","getHtml","1738qOahFf","toType","floor","451297HqroPf","forEach","includes","svg","getContext","clear","png","getTempContainer","name","jpeg","css","src","IMG","end",".hiprint-printPanel .hiprint-printPaper","style","width","5644560azgNiN","createElement","5920pDYpGT","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","body","appendChild","then","drawImage","onload","hinnn","1052056OdLMHP","url","replace","cur","limit","#fff","isDownload","download","6hwSYbH","6XXeNZP","clearRect","gif","canvas","printPanels","base64","split","promise","none","9xKBDjH","extend","3945767IekuVg","ceil","click","http","toLowerCase","pop","toCanvas","blob","4436464MMWMcf","href","setAttribute","total","bmp"];return y=function(){return a},y()}function h(a,n){const e=y();return h=function(i,d){return i=i-277,e[i]},h(a,n)}const H=function(a,n){return L(this,null,function*(){const e=h;let i=this,d=globalThis.$.Deferred(),j=!![],I=10,W=(p,g)=>{const f=h,A=Math[f(288)](p/g*100);console[f(364)](f(319),p,f(347),g),console[f(364)](f(284),A+"%")};if(this[e(329)].length){let p=globalThis.$[e(335)]({filter:x=>{const t=e;return x.tagName!=t(301)||x[t(281)]==t(301)&&([t(359),t(298),t(295),t(327),t(348),"webp",t(292)][t(291)](x[t(300)].split(".")[t(341)]()[t(340)]())||x[t(300)]!=x.baseURI||x.src[t(357)](t(339))>-1&&x[t(300)]!=x[t(351)]||x[t(300)][t(357)](t(330))>-1)},backgroundColor:e(321)},n||{}),g=yield this[e(285)](a,n);n&&n[e(322)]!=null&&(j=n.isDownload),n&&n[e(283)]!=null&&(W=n.onProgress),n&&n[e(320)]!=null&&(I=n.limit),globalThis.$(g)[e(299)]("width","")[e(299)](e(350),""),this.createTempContainer();let f=this[e(296)]();this.svg2canvas(g,p),f.html(g[0]);let A=f[e(352)](e(303))[e(358)];globalThis.$(g)[e(299)](e(353)),this[e(356)](g,function(){const x=e;try{let t=[],X=Math[x(337)](A/I),U=A%I||1;const u=document[x(307)](x(328)),G=u[x(293)]("2d"),Y=f.width()*(p[x(365)]||globalThis[x(369)]);for(let O=0;O<X;O++){G[x(326)](0,0,u[x(305)],u[x(350)]);const C=O==X-1;let E=0,S=C?U:I;for(let m=0;m<S;m++){G[x(326)](0,0,u[x(305)],u.height);const r=O*I+m,M=f[x(352)](x(303))[r];globalThis[x(315)][x(370)].add(function(D){const T=x;w[T(342)](M,p)[T(312)](function(v){const c=T;let k=v[c(293)]("2d");k[c(279)]=![];let N=v.toDataURL(c(282),p[c(277)]||.92),o=new Image;o[c(300)]=N,o[c(314)]=function(){const s=c;m===0&&(u[s(305)]=Y,u.height=o[s(350)]*S),E+=o[s(350)],G[s(313)](o,0,E-o[s(350)],Y,o[s(350)]),W(r+1,A),D()}})})}globalThis[x(315)].queue[x(366)](function(m){const r=x;let M=p.type||r(282),D=p[r(287)]||"url",T=p.quality||.8;if(j){let v=u[r(349)](M,T),c=new Image;c[r(300)]=v,c[r(314)]=function(){const k=r;t.push({url:v,start:O*I+1,end:O*I+S}),C&&(globalThis.hinnn[k(370)].clear(),i[k(363)](),t[k(290)](N=>{const o=k;let s=document.createElement("a"),R=n[o(297)]||o(355);R.indexOf(".")==-1&&(R+=o(361));let F=R[o(331)](".")[o(341)](),Z=R[o(318)]("."+F,"")+"_"+N[o(362)]+"-"+N[o(302)]+"."+F;s[o(304)][o(354)]=o(333),s.setAttribute(o(323),Z),s[o(346)](o(345),N[o(317)]),document[o(310)][o(311)](s),s[o(338)](),s[o(360)]()})),m()};return}if(D==r(317)){t.push(u[r(349)](M,T)),C&&(globalThis[r(315)][r(370)][r(294)](),i[r(363)](),d[r(368)](t)),m();return}D==r(343)&&u.toBlob(function(v){const c=r;t[c(278)](v),C&&(globalThis[c(315)][c(370)].clear(),i[c(363)](),d[c(368)](t)),m()},M,T)})}globalThis[x(315)].queue[x(280)]()}catch(t){console.error(x(309)),console[x(364)](t)}})}return d[e(332)]()})};function P(a,n){var e=l();return P=function(i,d){i=i-132;var j=e[i];return j},P(a,n)}(function(a,n){for(var e=P,i=a();[];)try{var d=parseInt(e(141))/1+-parseInt(e(142))/2*(parseInt(e(144))/3)+-parseInt(e(143))/4*(-parseInt(e(139))/5)+-parseInt(e(138))/6+-parseInt(e(136))/7+-parseInt(e(134))/8*(-parseInt(e(132))/9)+parseInt(e(137))/10;if(d===n)break;i.push(i.shift())}catch(j){i.push(i.shift())}})(l,429921);function q(a){var n=P;return{name:"add toImage Api",description:"add toImage Api",hooks:[{hook:n(140),name:n(135),description:n(135),priority:1,run:({template:e,options:i})=>{var d=n;Object.defineProperty(e,d(133),{value:H,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:"0.3.0"}}function l(){var a=["add toImage Api to PrintTemplate","53613RFXdgt","2654180GiWpZa","899760buZBGF","42740jYPwWY","newPrintTemplate","243290IFIGAk","765172hmfXSH","196NPJNIG","6qNKtTX","72dAWOWk","toImage","425152nOqmtJ"];return l=function(){return a},l()}return q});
|