vg-print 1.0.383 → 1.0.384

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.
@@ -1,4 +1,4 @@
1
- import { l as b } from "./index-BjdyHfMZ.js";
1
+ import { l as b } from "./index-CObxKOd4.js";
2
2
  function M(e) {
3
3
  return typeof e == "string" && /^data:image\/svg\+xml/i.test(e);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { W as a } from "./chunk-3VYIPD3A-BrO6pd5G.js";
1
+ import { W as a } from "./chunk-3VYIPD3A-8-s1FXRt.js";
2
2
  async function o(r, t) {
3
3
  let i = await a(r, t), e = new Image();
4
4
  return e.src = i.toDataURL(`image/${t.format}`, t.quality), await e.decode(), e.style.width = `${i.width / t.dpr}px`, e.style.height = `${i.height / t.dpr}px`, e;
@@ -1,4 +1,4 @@
1
- import { W as m } from "./chunk-3VYIPD3A-BrO6pd5G.js";
1
+ import { W as m } from "./chunk-3VYIPD3A-8-s1FXRt.js";
2
2
  async function a(n, e) {
3
3
  let o = e.type;
4
4
  if (o === "svg") {
@@ -1,5 +1,5 @@
1
- import { m as f } from "./chunk-T4JIPPZO-CAG1GRkT.js";
2
- import { W as t } from "./chunk-3VYIPD3A-BrO6pd5G.js";
1
+ import { m as f } from "./chunk-T4JIPPZO-DQlmVEHv.js";
2
+ import { W as t } from "./chunk-3VYIPD3A-8-s1FXRt.js";
3
3
  async function w(n, e) {
4
4
  let c = ((e == null ? void 0 : e.format) || (e == null ? void 0 : e.type) || "").toLowerCase(), a = c === "jpg" ? "jpeg" : c || "png", i = (e == null ? void 0 : e.filename) || `snapdom.${a}`, o = { ...e || {}, format: a, type: a };
5
5
  if (o.dpr = 1, a === "svg") {
@@ -297,7 +297,8 @@ const cn$1 = {
297
297
  自动: "自动",
298
298
  不自动: "不自动",
299
299
  单独文本: "单独文本",
300
- svg文本: "svg文本"
300
+ svg文本: "svg文本",
301
+ 扩展样式: "扩展样式"
301
302
  }, __vite_glob_0_0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
302
303
  __proto__: null,
303
304
  default: cn$1
@@ -595,7 +596,8 @@ const cn$1 = {
595
596
  自动: "自動",
596
597
  不自动: "不自動",
597
598
  单独文本: "獨立文字",
598
- svg文本: "SVG文字"
599
+ svg文本: "SVG文字",
600
+ 扩展样式: "擴展樣式"
599
601
  }, __vite_glob_0_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
600
602
  __proto__: null,
601
603
  default: cn_tw
@@ -892,7 +894,8 @@ const cn$1 = {
892
894
  自动: "Automatisch",
893
895
  不自动: "Nicht automatisch",
894
896
  单独文本: "Eigenständiger Text",
895
- svg文本: "SVG-Text"
897
+ svg文本: "SVG-Text",
898
+ 扩展样式: "Erweiterter Stil"
896
899
  }, __vite_glob_0_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
897
900
  __proto__: null,
898
901
  default: de$5
@@ -1190,7 +1193,8 @@ const cn$1 = {
1190
1193
  自动: "Auto",
1191
1194
  不自动: "Not Auto",
1192
1195
  单独文本: "Standalone Text",
1193
- svg文本: "SVG Text"
1196
+ svg文本: "SVG Text",
1197
+ 扩展样式: "Extended Style"
1194
1198
  }, __vite_glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1195
1199
  __proto__: null,
1196
1200
  default: en$1
@@ -1487,7 +1491,8 @@ const cn$1 = {
1487
1491
  自动: "Automático",
1488
1492
  不自动: "No automático",
1489
1493
  单独文本: "Texto independiente",
1490
- svg文本: "Texto SVG"
1494
+ svg文本: "Texto SVG",
1495
+ 扩展样式: "Estilo extendido"
1491
1496
  }, __vite_glob_0_4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1492
1497
  __proto__: null,
1493
1498
  default: es$1
@@ -1784,7 +1789,8 @@ const cn$1 = {
1784
1789
  自动: "Automatique",
1785
1790
  不自动: "Non automatique",
1786
1791
  单独文本: "Texte autonome",
1787
- svg文本: "Texte SVG"
1792
+ svg文本: "Texte SVG",
1793
+ 扩展样式: "Style étendu"
1788
1794
  }, __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1789
1795
  __proto__: null,
1790
1796
  default: fr$1
@@ -2081,7 +2087,8 @@ const cn$1 = {
2081
2087
  自动: "Automatico",
2082
2088
  不自动: "Non automatico",
2083
2089
  单独文本: "Testo autonomo",
2084
- svg文本: "Testo SVG"
2090
+ svg文本: "Testo SVG",
2091
+ 扩展样式: "Stile esteso"
2085
2092
  }, __vite_glob_0_6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2086
2093
  __proto__: null,
2087
2094
  default: it$5
@@ -2378,7 +2385,8 @@ const cn$1 = {
2378
2385
  自动: "自動",
2379
2386
  不自动: "非自動",
2380
2387
  单独文本: "単独テキスト",
2381
- svg文本: "SVGテキスト"
2388
+ svg文本: "SVGテキスト",
2389
+ 扩展样式: "拡張スタイル"
2382
2390
  }, __vite_glob_0_7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2383
2391
  __proto__: null,
2384
2392
  default: ja$1
@@ -2675,7 +2683,8 @@ const cn$1 = {
2675
2683
  自动: "Авто",
2676
2684
  不自动: "Не автоматически",
2677
2685
  单独文本: "Отдельный текст",
2678
- svg文本: "Текст SVG"
2686
+ svg文本: "Текст SVG",
2687
+ 扩展样式: "Расширенный стиль"
2679
2688
  }, __vite_glob_0_8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2680
2689
  __proto__: null,
2681
2690
  default: ru$1
@@ -56048,7 +56057,7 @@ var i18n$1 = {
56048
56057
  }
56049
56058
  return null;
56050
56059
  }, Hr.prototype.createTarget = function() {
56051
- return this.target = $$j(`<div class="hiprint-option-item"><div class="hiprint-option-item-label">${i18n$1.__("背景颜色")}</div><div class="hiprint-option-item-field"><input type="text" class="auto-submit"/><span class="hiprint-bg-clear" style="position: absolute;right: 25px;top: 4px;cursor: pointer;color: #ccc;z-index: 10; font-family: sans-serif; font-size: 12px;">X</span></div></div>`), this.target.find(".hiprint-bg-clear").click(function() {
56060
+ return this.target = $$j(`<div class="hiprint-option-item"><div class="hiprint-option-item-label">${i18n$1.__("背景颜色")}</div><div class="hiprint-option-item-field"><input type="text" class="auto-submit"/><span class="hiprint-bg-clear" style="position: absolute;right: 25px;top: 4px;cursor: pointer;color: #ccc;z-index: 10; font-family: sans-serif; font-size: 12px;display: none;">X</span></div></div>`), this.target.find(".hiprint-bg-clear").click(function() {
56052
56061
  $$j(this).parent().find("input").minicolors("value", ""), $$j(this).parent().find("input").val("").trigger("change");
56053
56062
  }), this.target;
56054
56063
  }, Hr.prototype.getValue = function() {
@@ -56072,7 +56081,7 @@ var i18n$1 = {
56072
56081
  ${i18n$1.__("扩展样式")}
56073
56082
  </div>
56074
56083
  <div class="hiprint-option-item-field">
56075
- <textarea style="height:80px;" rows="4" placeholder="${i18n$1.__("例如:.class{font-size:14px;}")}" class="auto-submit"></textarea>
56084
+ <textarea style="height:80px;" rows="4" placeholder=".class{font-size:14px;}" class="auto-submit"></textarea>
56076
56085
  </div>
56077
56086
  </div>`), this.target;
56078
56087
  }, Hr.prototype.getValue = function() {
@@ -63294,65 +63303,93 @@ ${i18n$1.__("转大小写")}
63294
63303
  }, Qe.prototype.xhrLoadImage = function(Ue) {
63295
63304
  }, Qe.prototype.ensureImages = async function(Ue) {
63296
63305
  try {
63297
- const Ge = Ue && Ue.querySelectorAll ? Ue.querySelectorAll("img") : [], Ke = [];
63298
- Ge.forEach((Ze) => {
63299
- let Je = Ze.getAttribute("src") || "";
63300
- !Je || Je.indexOf("base64") !== -1 || Je === window.location.href || Ke.push(async function() {
63306
+ const Ge = this && this._imgMode ? String(this._imgMode) : "base64", Ke = Ue && Ue.querySelectorAll ? Ue.querySelectorAll("img") : [], Ze = [];
63307
+ Ke.forEach((Je) => {
63308
+ let er = Je.getAttribute("src") || "";
63309
+ !er || er.indexOf("base64") !== -1 || er === window.location.href || Ze.push(async function() {
63310
+ if (Ge === "absolute") {
63311
+ try {
63312
+ const rr = document.createElement("a");
63313
+ rr.href = er, Je.setAttribute("src", rr.href);
63314
+ } catch {
63315
+ }
63316
+ return;
63317
+ }
63301
63318
  try {
63302
- const er = document.createElement("a");
63303
- er.href = Je, Je = er.href;
63319
+ const rr = document.createElement("a");
63320
+ rr.href = er, er = rr.href;
63304
63321
  } catch {
63305
63322
  }
63306
63323
  try {
63307
- const tr = await (await fetch(Je)).blob(), rr = new FileReader(), ir = await new Promise((ar, cr) => {
63308
- rr.onload = () => ar(rr.result), rr.onerror = cr, rr.readAsDataURL(tr);
63324
+ const ir = await (await fetch(er)).blob(), ar = new FileReader(), cr = await new Promise((sr, or) => {
63325
+ ar.onload = () => sr(ar.result), ar.onerror = or, ar.readAsDataURL(ir);
63309
63326
  });
63310
- if (ir) {
63311
- Ze.setAttribute("src", String(ir));
63327
+ if (cr) {
63328
+ var tr = String(cr);
63329
+ Je.setAttribute("src", tr);
63330
+ try {
63331
+ await new Promise((sr) => {
63332
+ const or = new Image();
63333
+ or.onload = function() {
63334
+ try {
63335
+ Je.getAttribute("width") || Je.setAttribute("width", or.width), Je.getAttribute("height") || Je.setAttribute("height", or.height);
63336
+ } catch {
63337
+ }
63338
+ sr(0);
63339
+ }, or.onerror = function() {
63340
+ sr(0);
63341
+ }, or.src = tr;
63342
+ });
63343
+ } catch {
63344
+ }
63312
63345
  return;
63313
63346
  }
63314
63347
  } catch {
63315
63348
  }
63316
63349
  try {
63317
- await new Promise((er) => {
63318
- const tr = new Image();
63350
+ await new Promise((rr) => {
63351
+ const ir = new Image();
63319
63352
  try {
63320
- tr.crossOrigin = "anonymous";
63353
+ ir.crossOrigin = "anonymous";
63321
63354
  } catch {
63322
63355
  }
63323
- tr.onload = function() {
63356
+ ir.onload = function() {
63324
63357
  try {
63325
- const rr = document.createElement("canvas");
63326
- rr.width = tr.width, rr.height = tr.height, rr.getContext("2d").drawImage(tr, 0, 0);
63327
- const ar = rr.toDataURL("image/png");
63328
- Ze.setAttribute("src", ar), Ze.getAttribute("width") || Ze.setAttribute("width", tr.width), Ze.getAttribute("height") || Ze.setAttribute("height", tr.height);
63358
+ const ar = document.createElement("canvas");
63359
+ ar.width = ir.width, ar.height = ir.height, ar.getContext("2d").drawImage(ir, 0, 0);
63360
+ const sr = ar.toDataURL("image/png");
63361
+ Je.setAttribute("src", sr), Je.getAttribute("width") || Je.setAttribute("width", ir.width), Je.getAttribute("height") || Je.setAttribute("height", ir.height);
63329
63362
  } catch {
63330
63363
  }
63331
- er(0);
63332
- }, tr.onerror = function() {
63333
- er(0);
63334
- }, tr.src = Je;
63364
+ rr(0);
63365
+ }, ir.onerror = function() {
63366
+ rr(0);
63367
+ }, ir.src = er;
63335
63368
  });
63336
63369
  return;
63337
63370
  } catch {
63338
63371
  }
63339
63372
  try {
63340
- const er = document.createElement("a");
63341
- er.href = Ze.getAttribute("src") || "", Ze.setAttribute("src", er.href);
63373
+ const rr = document.createElement("a");
63374
+ rr.href = Je.getAttribute("src") || "", Je.setAttribute("src", rr.href);
63342
63375
  } catch {
63343
63376
  }
63344
63377
  }());
63345
- }), await Promise.all(Ke);
63378
+ }), await Promise.all(Ze);
63346
63379
  } catch {
63347
63380
  }
63348
63381
  }, Qe.prototype.sentToClient = async function(Ue, Ge, Ke) {
63349
63382
  Ge || (Ge = {});
63350
- var Ze = $$j.extend({}, Ke || {});
63351
- Ze.imgToBase64 = !0;
63352
- var Je = this.getHtml(Ge, Ze)[0];
63353
- await this.ensureImages(Je);
63354
- var er = "<style>" + String(printLockCss) + "</style>", tr = (Ue && Ue.length ? Ue : er) + Je.outerHTML;
63355
- Ze.id = s.a.instance.guid(), Ze.html = tr, Ze.templateId = this.id, hiwebSocket.send(Ze);
63383
+ var Ze = $$j.extend({}, Ke || {}), Je = !(Ze && Ze.imgToBase64 === !1);
63384
+ Ze.imgToBase64 = !1;
63385
+ var er = this.getHtml(Ge, Ze)[0];
63386
+ this._imgMode = Je ? "base64" : "absolute", await this.ensureImages(er);
63387
+ try {
63388
+ delete this._imgMode;
63389
+ } catch {
63390
+ }
63391
+ var tr = "<style>" + String(printLockCss) + "</style>", rr = (Ue && Ue.length ? Ue : tr) + er.outerHTML;
63392
+ Ze.id = s.a.instance.guid(), Ze.html = rr, Ze.templateId = this.id, hiwebSocket.send(Ze);
63356
63393
  }, Qe.prototype.printByHtml = function(Ue) {
63357
63394
  $$j(Ue).hiwprint();
63358
63395
  }, Qe.prototype.printByHtml2 = async function(Ue, Ge) {
@@ -63373,7 +63410,7 @@ ${i18n$1.__("转大小写")}
63373
63410
  try {
63374
63411
  if (hr = $$j(Ue)[0], hr)
63375
63412
  try {
63376
- await Ke.ensureImages(hr);
63413
+ Ke._imgMode = Ge && Ge.imgToBase64 === !1 ? "absolute" : "base64", await Ke.ensureImages(hr);
63377
63414
  } catch {
63378
63415
  }
63379
63416
  } catch {
@@ -63390,7 +63427,7 @@ ${i18n$1.__("转大小写")}
63390
63427
  var rr = $$j(Ue)[0];
63391
63428
  if (rr)
63392
63429
  try {
63393
- await Ke.ensureImages(rr);
63430
+ Ke._imgMode = Ge && Ge.imgToBase64 === !1 ? "absolute" : "base64", await Ke.ensureImages(rr);
63394
63431
  } catch {
63395
63432
  }
63396
63433
  } catch {
@@ -66767,52 +66804,52 @@ async function _$2(Qe, Ue) {
66767
66804
  c$1.capture = async (Qe, Ue, Ge) => {
66768
66805
  if (Ge !== M$2) throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");
66769
66806
  let Ke = await Vr(Qe, Ue), Ze = { img: async (pr, hr) => {
66770
- let { toImg: mr } = await import("./toImg-DpQMoRBQ.js");
66807
+ let { toImg: mr } = await import("./toImg-DGZ4yNCO.js");
66771
66808
  return mr(Ke, { ...pr, ...hr || {} });
66772
66809
  }, svg: async (pr, hr) => {
66773
- let { toSvg: mr } = await import("./toImg-DpQMoRBQ.js");
66810
+ let { toSvg: mr } = await import("./toImg-DGZ4yNCO.js");
66774
66811
  return mr(Ke, { ...pr, ...hr || {} });
66775
66812
  }, canvas: async (pr, hr) => {
66776
- let { toCanvas: mr } = await import("./toCanvas-Cmav2KNK.js");
66813
+ let { toCanvas: mr } = await import("./toCanvas-9JyQjOvH.js");
66777
66814
  return mr(Ke, { ...pr, ...hr || {} });
66778
66815
  }, blob: async (pr, hr) => {
66779
- let { toBlob: mr } = await import("./toBlob-DOPuxD4R.js");
66816
+ let { toBlob: mr } = await import("./toBlob-D8KF6zTG.js");
66780
66817
  return mr(Ke, { ...pr, ...hr || {} });
66781
66818
  }, png: async (pr, hr) => {
66782
- let { rasterize: mr } = await import("./rasterize-JS5G2XHH-BA2heZxW.js");
66819
+ let { rasterize: mr } = await import("./rasterize-JS5G2XHH-CekKlwl4.js");
66783
66820
  return mr(Ke, { ...pr, ...hr || {}, format: "png" });
66784
66821
  }, jpeg: async (pr, hr) => {
66785
- let { rasterize: mr } = await import("./rasterize-JS5G2XHH-BA2heZxW.js");
66822
+ let { rasterize: mr } = await import("./rasterize-JS5G2XHH-CekKlwl4.js");
66786
66823
  return mr(Ke, { ...pr, ...hr || {}, format: "jpeg" });
66787
66824
  }, webp: async (pr, hr) => {
66788
- let { rasterize: mr } = await import("./rasterize-JS5G2XHH-BA2heZxW.js");
66825
+ let { rasterize: mr } = await import("./rasterize-JS5G2XHH-CekKlwl4.js");
66789
66826
  return mr(Ke, { ...pr, ...hr || {}, format: "webp" });
66790
66827
  }, download: async (pr, hr) => {
66791
- let { download: mr } = await import("./download-DTjOpO9V.js");
66828
+ let { download: mr } = await import("./download-C4pNKGEV.js");
66792
66829
  return mr(Ke, { ...pr, ...hr || {} });
66793
66830
  } }, Je = { ...Ue, export: { url: Ke }, exports: { svg: async (pr) => {
66794
- let { toSvg: hr } = await import("./toImg-DpQMoRBQ.js");
66831
+ let { toSvg: hr } = await import("./toImg-DGZ4yNCO.js");
66795
66832
  return hr(Ke, { ...Ue, ...pr || {}, [f$1]: !0 });
66796
66833
  }, canvas: async (pr) => {
66797
- let { toCanvas: hr } = await import("./toCanvas-Cmav2KNK.js");
66834
+ let { toCanvas: hr } = await import("./toCanvas-9JyQjOvH.js");
66798
66835
  return hr(Ke, { ...Ue, ...pr || {}, [f$1]: !0 });
66799
66836
  }, png: async (pr) => {
66800
- let { rasterize: hr } = await import("./rasterize-JS5G2XHH-BA2heZxW.js");
66837
+ let { rasterize: hr } = await import("./rasterize-JS5G2XHH-CekKlwl4.js");
66801
66838
  return hr(Ke, { ...Ue, ...pr || {}, format: "png", [f$1]: !0 });
66802
66839
  }, jpeg: async (pr) => {
66803
- let { rasterize: hr } = await import("./rasterize-JS5G2XHH-BA2heZxW.js");
66840
+ let { rasterize: hr } = await import("./rasterize-JS5G2XHH-CekKlwl4.js");
66804
66841
  return hr(Ke, { ...Ue, ...pr || {}, format: "jpeg", [f$1]: !0 });
66805
66842
  }, jpg: async (pr) => {
66806
- let { rasterize: hr } = await import("./rasterize-JS5G2XHH-BA2heZxW.js");
66843
+ let { rasterize: hr } = await import("./rasterize-JS5G2XHH-CekKlwl4.js");
66807
66844
  return hr(Ke, { ...Ue, ...pr || {}, format: "jpeg", [f$1]: !0 });
66808
66845
  }, webp: async (pr) => {
66809
- let { rasterize: hr } = await import("./rasterize-JS5G2XHH-BA2heZxW.js");
66846
+ let { rasterize: hr } = await import("./rasterize-JS5G2XHH-CekKlwl4.js");
66810
66847
  return hr(Ke, { ...Ue, ...pr || {}, format: "webp", [f$1]: !0 });
66811
66848
  }, blob: async (pr) => {
66812
- let { toBlob: hr } = await import("./toBlob-DOPuxD4R.js");
66849
+ let { toBlob: hr } = await import("./toBlob-D8KF6zTG.js");
66813
66850
  return hr(Ke, { ...Ue, ...pr || {}, [f$1]: !0 });
66814
66851
  }, img: async (pr) => {
66815
- let { toImg: hr } = await import("./toImg-DpQMoRBQ.js");
66852
+ let { toImg: hr } = await import("./toImg-DGZ4yNCO.js");
66816
66853
  return hr(Ke, { ...Ue, ...pr || {}, [f$1]: !0 });
66817
66854
  } } }, er = await y$1("defineExports", Je), tr = Object.assign({}, ...er.filter((pr) => pr && typeof pr == "object")), rr = { ...Ze, ...tr };
66818
66855
  rr.jpeg && !rr.jpg && (rr.jpg = (pr, hr) => rr.jpeg(pr, hr));
@@ -79437,7 +79474,7 @@ function Z(Qe) {
79437
79474
  }
79438
79475
  };
79439
79476
  })();
79440
- const version = "1.0.383";
79477
+ const version = "1.0.384";
79441
79478
  typeof window < "u" && window.hinnn && (window.hinnn.queue || (window.hinnn.queue = {
79442
79479
  list: [],
79443
79480
  running: !1,
@@ -102402,7 +102439,6 @@ const _sfc_main = {
102402
102439
  });
102403
102440
  ir.print2(Ze, {
102404
102441
  printer: this.printerName,
102405
- // 打印机 名称
102406
102442
  title: Ge
102407
102443
  }), ir.on("printSuccess", function() {
102408
102444
  let ar = Qe.tasks.all.length > 1 ? "准备打印下一张" : "已完成打印";
@@ -103037,7 +103073,7 @@ function _sfc_render(Qe, Ue, Ge, Ke, Ze, Je) {
103037
103073
  }, null, 8, ["text"])) : createCommentVNode("", !0)
103038
103074
  ], 64);
103039
103075
  }
103040
- const FullDesigner = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-c3135b1c"]]), index = {
103076
+ const FullDesigner = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-db9acb85"]]), index = {
103041
103077
  install(Qe) {
103042
103078
  Qe.component("FullDesigner", FullDesigner), Qe.component("Header", Header), Qe.component("Preview", Preview);
103043
103079
  try {
@@ -0,0 +1,4 @@
1
+ import { d as a } from "./chunk-ANSXOGKI-CLl4wDr5.js";
2
+ export {
3
+ a as rasterize
4
+ };