@dazhicheng/ui 1.5.202 → 1.5.204

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.
Files changed (149) hide show
  1. package/dist/_virtual/___vite-browser-external.js +6 -0
  2. package/dist/_virtual/__vite-browser-external.js +4 -0
  3. package/dist/_virtual/_commonjs-dynamic-modules.js +6 -0
  4. package/dist/_virtual/_commonjsHelpers.js +24 -0
  5. package/dist/_virtual/aes.js +4 -0
  6. package/dist/_virtual/cipher-core.js +4 -0
  7. package/dist/_virtual/core.js +4 -0
  8. package/dist/_virtual/enc-base64.js +4 -0
  9. package/dist/_virtual/enc-utf8.js +4 -0
  10. package/dist/_virtual/evpkdf.js +4 -0
  11. package/dist/_virtual/hmac.js +4 -0
  12. package/dist/_virtual/md5.js +4 -0
  13. package/dist/_virtual/mode-ecb.js +4 -0
  14. package/dist/_virtual/pad-pkcs7.js +4 -0
  15. package/dist/_virtual/sha1.js +4 -0
  16. package/dist/components/tt-api-component/index.js +17 -4
  17. package/dist/components/tt-api-component/index.vue2.js +24 -13
  18. package/dist/components/tt-area/TtArea.vue3.js +24 -13
  19. package/dist/components/tt-button/index.js +18 -5
  20. package/dist/components/tt-button/index.vue2.js +27 -16
  21. package/dist/components/tt-checkbox/index.js +17 -4
  22. package/dist/components/tt-checkbox/index.vue.js +38 -28
  23. package/dist/components/tt-drawer/index.js +17 -7
  24. package/dist/components/tt-drawer/src/RenderDrawer.vue.js +48 -36
  25. package/dist/components/tt-drawer/src/components/DrawerFooter.vue.js +39 -26
  26. package/dist/components/tt-drawer/src/components/DrawerHeader.vue2.js +23 -10
  27. package/dist/components/tt-drawer/src/props.js +22 -9
  28. package/dist/components/tt-drawer/src/utils/drawer-api.js +42 -33
  29. package/dist/components/tt-empty/index.js +28 -18
  30. package/dist/components/tt-form/index.js +22 -14
  31. package/dist/components/tt-form/src/components/ExpandableArrow.vue2.js +23 -14
  32. package/dist/components/tt-form/src/components/FormActions.vue2.js +42 -32
  33. package/dist/components/tt-form/src/form/FormDescription.vue.js +19 -10
  34. package/dist/components/tt-form/src/form/FormItem.vue.js +18 -9
  35. package/dist/components/tt-form/src/form/FormLabel.vue.js +18 -9
  36. package/dist/components/tt-form/src/form/RenderContent.vue.js +25 -13
  37. package/dist/components/tt-form/src/form-render/FormField.vue2.js +62 -55
  38. package/dist/components/tt-form/src/form-render/FormLabel.vue2.js +36 -28
  39. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +64 -56
  40. package/dist/components/tt-form/src/form-render/array-register/utils.js +18 -8
  41. package/dist/components/tt-form/src/form-render/dependencies.js +36 -24
  42. package/dist/components/tt-form/src/form-render/form.vue2.js +17 -7
  43. package/dist/components/tt-form/src/form-render/helper.js +29 -16
  44. package/dist/components/tt-form/src/form-render/rootWrapperClass.js +17 -7
  45. package/dist/components/tt-form/src/formApi.js +59 -48
  46. package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +17 -4
  47. package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +67 -57
  48. package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +55 -46
  49. package/dist/components/tt-form/src/group-form/groupFormApi.js +21 -10
  50. package/dist/components/tt-form/src/hooks/useForwardPriorityValues.js +27 -17
  51. package/dist/components/tt-form/src/hooks/useSelectCollapse.js +32 -23
  52. package/dist/components/tt-form/src/index.vue2.js +53 -45
  53. package/dist/components/tt-form/src/useFormContext.js +74 -62
  54. package/dist/components/tt-form-item-error-tooltip/index.js +18 -5
  55. package/dist/components/tt-form-item-error-tooltip/index.vue.js +32 -21
  56. package/dist/components/tt-icon/index.js +20 -7
  57. package/dist/components/tt-image/index.js +19 -6
  58. package/dist/components/tt-image/src/components/ImageViewer.js +27 -17
  59. package/dist/components/tt-loading/index.js +16 -4
  60. package/dist/components/tt-loading/src/directive.js +34 -22
  61. package/dist/components/tt-log/index.js +17 -4
  62. package/dist/components/tt-log/index.vue.js +21 -8
  63. package/dist/components/tt-modal/index.js +16 -5
  64. package/dist/components/tt-modal/src/RenderModal.vue.js +163 -151
  65. package/dist/components/tt-modal/src/components/ModalFooter.vue2.js +38 -28
  66. package/dist/components/tt-modal/src/components/ModalHeader.vue2.js +24 -11
  67. package/dist/components/tt-modal/src/components/ModalWrapper.vue.js +36 -23
  68. package/dist/components/tt-modal/src/props.js +22 -9
  69. package/dist/components/tt-modal/src/utils/modal-api.js +39 -29
  70. package/dist/components/tt-modal-form/index.vue.js +44 -36
  71. package/dist/components/tt-nav-anchor/index.js +17 -4
  72. package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +69 -57
  73. package/dist/components/tt-panel-select/index.js +17 -4
  74. package/dist/components/tt-panel-select/src/hooks/usePanelData.js +51 -40
  75. package/dist/components/tt-panel-select/src/index.vue.js +35 -24
  76. package/dist/components/tt-select/index.js +17 -4
  77. package/dist/components/tt-select/src/Select.vue.js +79 -68
  78. package/dist/components/tt-select/src/components/SelectTable.vue.js +41 -30
  79. package/dist/components/tt-select/src/components/Table.vue.js +86 -76
  80. package/dist/components/tt-select/src/hooks/useDataSource.js +59 -49
  81. package/dist/components/tt-select/src/hooks/useSelect.js +46 -38
  82. package/dist/components/tt-select/src/hooks/useSelectTableEvent.js +123 -112
  83. package/dist/components/tt-table/index.js +19 -12
  84. package/dist/components/tt-table/src/Table.vue.js +82 -71
  85. package/dist/components/tt-table/src/TableForm.vue.js +77 -65
  86. package/dist/components/tt-table/src/components/TableAction.vue.js +49 -39
  87. package/dist/components/tt-table/src/components/TableButtons.js +73 -60
  88. package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +14 -3
  89. package/dist/components/tt-table/src/components/TableToobalTools.vue.js +36 -25
  90. package/dist/components/tt-table/src/hooks/useColumns.js +72 -65
  91. package/dist/components/tt-table/src/hooks/useCustomColumns.js +43 -31
  92. package/dist/components/tt-table/src/hooks/useDataSource.js +50 -42
  93. package/dist/components/tt-table/src/hooks/usePagination.js +36 -25
  94. package/dist/components/tt-table/src/props.js +55 -42
  95. package/dist/components/tt-table/src/utils/table-api.js +33 -22
  96. package/dist/components/tt-table/src/utils/table-form-api.js +35 -24
  97. package/dist/components/tt-text/index.js +17 -4
  98. package/dist/components/tt-upload/index.js +19 -6
  99. package/dist/components/tt-upload/src/TtUpload.vue.js +77 -66
  100. package/dist/directives/disabled-tip/index.js +37 -26
  101. package/dist/hooks/useFormSchemasLink.js +90 -79
  102. package/dist/hooks/useScreenshotOss.js +49 -35
  103. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js +17 -0
  104. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js +64 -0
  105. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.js +545 -0
  106. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.js +508 -0
  107. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.js +81 -0
  108. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js +10 -0
  109. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.js +71 -0
  110. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.js +84 -0
  111. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.js +72 -0
  112. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js +22 -0
  113. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js +11 -0
  114. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.js +50 -0
  115. package/dist/node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js +1024 -0
  116. package/dist/node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.js +32 -0
  117. package/dist/node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/apply-style.js +11 -0
  118. package/dist/node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/clone-node.js +92 -0
  119. package/dist/node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/clone-pseudos.js +34 -0
  120. package/dist/node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/dataurl.js +52 -0
  121. package/dist/node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-images.js +43 -0
  122. package/dist/node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-resources.js +47 -0
  123. package/dist/node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-webfonts.js +122 -0
  124. package/dist/node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/index.js +30 -0
  125. package/dist/node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/mimes.js +24 -0
  126. package/dist/node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/util.js +106 -0
  127. package/dist/node_modules/.pnpm/is-plain-object@5.0.0/node_modules/is-plain-object/dist/is-plain-object.js +16 -0
  128. package/dist/node_modules/.pnpm/klona@2.0.6/node_modules/klona/full/index.js +21 -0
  129. package/dist/node_modules/.pnpm/tailwind-merge@3.5.0/node_modules/tailwind-merge/dist/bundle-mjs.js +2922 -0
  130. package/dist/node_modules/.pnpm/vue-types@5.1.3_vue@3.5.21_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js +93 -0
  131. package/dist/packages/hooks/src/propTypes.js +17 -0
  132. package/dist/packages/hooks/src/tools.js +6 -0
  133. package/dist/packages/hooks/src/useDebounce.js +32 -0
  134. package/dist/packages/hooks/src/useDesign.js +12 -0
  135. package/dist/packages/hooks/src/useElementScreenshot.js +136 -0
  136. package/dist/packages/hooks/src/useIsScroll.js +12 -0
  137. package/dist/packages/hooks/src/usePriorityValue.js +45 -0
  138. package/dist/packages/utils/src/calc.js +14 -0
  139. package/dist/packages/utils/src/check.js +10 -0
  140. package/dist/packages/utils/src/install.js +11 -0
  141. package/dist/packages/utils/src/is.js +64 -0
  142. package/dist/packages/utils/src/merge.js +13 -0
  143. package/dist/packages/utils/src/stateHandler.js +33 -0
  144. package/dist/packages/utils/src/string.js +6 -0
  145. package/dist/packages/utils/src/testid-helper.js +14 -0
  146. package/dist/packages/utils/src/tool.js +181 -0
  147. package/dist/plugins/default/renderCellContent.js +39 -28
  148. package/dist/plugins/vxeTable/switchStatus.js +37 -26
  149. package/package.json +3 -3
@@ -0,0 +1,32 @@
1
+ function c(t) {
2
+ if (t === null || typeof t != "object")
3
+ return !1;
4
+ const n = Object.getPrototypeOf(t);
5
+ return n !== null && n !== Object.prototype && Object.getPrototypeOf(n) !== null || Symbol.iterator in t ? !1 : Symbol.toStringTag in t ? Object.prototype.toString.call(t) === "[object Module]" : !0;
6
+ }
7
+ function u(t, n, e = ".", f) {
8
+ if (!c(n))
9
+ return u(t, {}, e, f);
10
+ const r = Object.assign({}, n);
11
+ for (const o in t) {
12
+ if (o === "__proto__" || o === "constructor")
13
+ continue;
14
+ const i = t[o];
15
+ i != null && (f && f(r, o, i, e) || (Array.isArray(i) && Array.isArray(r[o]) ? r[o] = [...i, ...r[o]] : c(i) && c(r[o]) ? r[o] = u(
16
+ i,
17
+ r[o],
18
+ (e ? `${e}.` : "") + o.toString(),
19
+ f
20
+ ) : r[o] = i));
21
+ }
22
+ return r;
23
+ }
24
+ function l(t) {
25
+ return (...n) => (
26
+ // eslint-disable-next-line unicorn/no-array-reduce
27
+ n.reduce((e, f) => u(e, f, "", t), {})
28
+ );
29
+ }
30
+ export {
31
+ l as createDefu
32
+ };
@@ -0,0 +1,11 @@
1
+ function e(t, h) {
2
+ const { style: l } = t;
3
+ h.backgroundColor && (l.backgroundColor = h.backgroundColor), h.width && (l.width = `${h.width}px`), h.height && (l.height = `${h.height}px`);
4
+ const r = h.style;
5
+ return r != null && Object.keys(r).forEach((c) => {
6
+ l[c] = r[c];
7
+ }), t;
8
+ }
9
+ export {
10
+ e as applyStyle
11
+ };
@@ -0,0 +1,92 @@
1
+ import { clonePseudoElements as g } from "./clone-pseudos.js";
2
+ import { isInstanceOfElement as u, toArray as a, createImage as f, getStyleProperties as p } from "./util.js";
3
+ import { getMimeType as d } from "./mimes.js";
4
+ import { resourceToDataURL as S } from "./dataurl.js";
5
+ async function E(t) {
6
+ const e = t.toDataURL();
7
+ return e === "data:," ? t.cloneNode(!1) : f(e);
8
+ }
9
+ async function b(t, e) {
10
+ if (t.currentSrc) {
11
+ const n = document.createElement("canvas"), l = n.getContext("2d");
12
+ n.width = t.clientWidth, n.height = t.clientHeight, l == null || l.drawImage(t, 0, 0, n.width, n.height);
13
+ const c = n.toDataURL();
14
+ return f(c);
15
+ }
16
+ const s = t.poster, r = d(s), i = await S(s, r, e);
17
+ return f(i);
18
+ }
19
+ async function T(t, e) {
20
+ var s;
21
+ try {
22
+ if (!((s = t == null ? void 0 : t.contentDocument) === null || s === void 0) && s.body)
23
+ return await m(t.contentDocument.body, e, !0);
24
+ } catch {
25
+ }
26
+ return t.cloneNode(!1);
27
+ }
28
+ async function L(t, e) {
29
+ return u(t, HTMLCanvasElement) ? E(t) : u(t, HTMLVideoElement) ? b(t, e) : u(t, HTMLIFrameElement) ? T(t, e) : t.cloneNode(y(t));
30
+ }
31
+ const w = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", y = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
32
+ async function x(t, e, s) {
33
+ var r, i;
34
+ if (y(e))
35
+ return e;
36
+ let n = [];
37
+ return w(t) && t.assignedNodes ? n = a(t.assignedNodes()) : u(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? n = a(t.contentDocument.body.childNodes) : n = a(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), n.length === 0 || u(t, HTMLVideoElement) || await n.reduce((l, c) => l.then(() => m(c, s)).then((o) => {
38
+ o && e.appendChild(o);
39
+ }), Promise.resolve()), e;
40
+ }
41
+ function A(t, e, s) {
42
+ const r = e.style;
43
+ if (!r)
44
+ return;
45
+ const i = window.getComputedStyle(t);
46
+ i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : p(s).forEach((n) => {
47
+ let l = i.getPropertyValue(n);
48
+ n === "font-size" && l.endsWith("px") && (l = `${Math.floor(parseFloat(l.substring(0, l.length - 2))) - 0.1}px`), u(t, HTMLIFrameElement) && n === "display" && l === "inline" && (l = "block"), n === "d" && e.getAttribute("d") && (l = `path(${e.getAttribute("d")})`), r.setProperty(n, l, i.getPropertyPriority(n));
49
+ });
50
+ }
51
+ function M(t, e) {
52
+ u(t, HTMLTextAreaElement) && (e.innerHTML = t.value), u(t, HTMLInputElement) && e.setAttribute("value", t.value);
53
+ }
54
+ function C(t, e) {
55
+ if (u(t, HTMLSelectElement)) {
56
+ const s = e, r = Array.from(s.children).find((i) => t.value === i.getAttribute("value"));
57
+ r && r.setAttribute("selected", "");
58
+ }
59
+ }
60
+ function H(t, e, s) {
61
+ return u(e, Element) && (A(t, e, s), g(t, e, s), M(t, e), C(t, e)), e;
62
+ }
63
+ async function I(t, e) {
64
+ const s = t.querySelectorAll ? t.querySelectorAll("use") : [];
65
+ if (s.length === 0)
66
+ return t;
67
+ const r = {};
68
+ for (let n = 0; n < s.length; n++) {
69
+ const c = s[n].getAttribute("xlink:href");
70
+ if (c) {
71
+ const o = t.querySelector(c), h = document.querySelector(c);
72
+ !o && h && !r[c] && (r[c] = await m(h, e, !0));
73
+ }
74
+ }
75
+ const i = Object.values(r);
76
+ if (i.length) {
77
+ const n = "http://www.w3.org/1999/xhtml", l = document.createElementNS(n, "svg");
78
+ l.setAttribute("xmlns", n), l.style.position = "absolute", l.style.width = "0", l.style.height = "0", l.style.overflow = "hidden", l.style.display = "none";
79
+ const c = document.createElementNS(n, "defs");
80
+ l.appendChild(c);
81
+ for (let o = 0; o < i.length; o++)
82
+ c.appendChild(i[o]);
83
+ t.appendChild(l);
84
+ }
85
+ return t;
86
+ }
87
+ async function m(t, e, s) {
88
+ return !s && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => L(r, e)).then((r) => x(t, r, e)).then((r) => H(t, r, e)).then((r) => I(r, e));
89
+ }
90
+ export {
91
+ m as cloneNode
92
+ };
@@ -0,0 +1,34 @@
1
+ import { uuid as i, getStyleProperties as l } from "./util.js";
2
+ function m(e) {
3
+ const n = e.getPropertyValue("content");
4
+ return `${e.cssText} content: '${n.replace(/'|"/g, "")}';`;
5
+ }
6
+ function p(e, n) {
7
+ return l(n).map((t) => {
8
+ const o = e.getPropertyValue(t), r = e.getPropertyPriority(t);
9
+ return `${t}: ${o}${r ? " !important" : ""};`;
10
+ }).join(" ");
11
+ }
12
+ function f(e, n, t, o) {
13
+ const r = `.${e}:${n}`, c = t.cssText ? m(t) : p(t, o);
14
+ return document.createTextNode(`${r}{${c}}`);
15
+ }
16
+ function a(e, n, t, o) {
17
+ const r = window.getComputedStyle(e, t), c = r.getPropertyValue("content");
18
+ if (c === "" || c === "none")
19
+ return;
20
+ const s = i();
21
+ try {
22
+ n.className = `${n.className} ${s}`;
23
+ } catch {
24
+ return;
25
+ }
26
+ const u = document.createElement("style");
27
+ u.appendChild(f(s, t, r, o)), n.appendChild(u);
28
+ }
29
+ function y(e, n, t) {
30
+ a(e, n, ":before", t), a(e, n, ":after", t);
31
+ }
32
+ export {
33
+ y as clonePseudoElements
34
+ };
@@ -0,0 +1,52 @@
1
+ function u(t) {
2
+ return t.split(/,/)[1];
3
+ }
4
+ function w(t) {
5
+ return t.search(/^(data:)/) !== -1;
6
+ }
7
+ function l(t, a) {
8
+ return `data:${a};base64,${t}`;
9
+ }
10
+ async function h(t, a, r) {
11
+ const e = await fetch(t, a);
12
+ if (e.status === 404)
13
+ throw new Error(`Resource "${e.url}" not found`);
14
+ const o = await e.blob();
15
+ return new Promise((n, c) => {
16
+ const s = new FileReader();
17
+ s.onerror = c, s.onloadend = () => {
18
+ try {
19
+ n(r({ res: e, result: s.result }));
20
+ } catch (f) {
21
+ c(f);
22
+ }
23
+ }, s.readAsDataURL(o);
24
+ });
25
+ }
26
+ const i = {};
27
+ function d(t, a, r) {
28
+ let e = t.replace(/\?.*/, "");
29
+ return r && (e = t), /ttf|otf|eot|woff2?/i.test(e) && (e = e.replace(/.*\//, "")), a ? `[${a}]${e}` : e;
30
+ }
31
+ async function g(t, a, r) {
32
+ const e = d(t, a, r.includeQueryParams);
33
+ if (i[e] != null)
34
+ return i[e];
35
+ r.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
36
+ let o;
37
+ try {
38
+ const n = await h(t, r.fetchRequestInit, ({ res: c, result: s }) => (a || (a = c.headers.get("Content-Type") || ""), u(s)));
39
+ o = l(n, a);
40
+ } catch (n) {
41
+ o = r.imagePlaceholder || "";
42
+ let c = `Failed to fetch resource: ${t}`;
43
+ n && (c = typeof n == "string" ? n : n.message);
44
+ }
45
+ return i[e] = o, o;
46
+ }
47
+ export {
48
+ h as fetchAsDataURL,
49
+ w as isDataUrl,
50
+ l as makeDataUrl,
51
+ g as resourceToDataURL
52
+ };
@@ -0,0 +1,43 @@
1
+ import { embedResources as c } from "./embed-resources.js";
2
+ import { isInstanceOfElement as g, toArray as b } from "./util.js";
3
+ import { isDataUrl as u, resourceToDataURL as l } from "./dataurl.js";
4
+ import { getMimeType as h } from "./mimes.js";
5
+ async function m(a, r, e) {
6
+ var t;
7
+ const i = (t = r.style) === null || t === void 0 ? void 0 : t.getPropertyValue(a);
8
+ if (i) {
9
+ const s = await c(i, null, e);
10
+ return r.style.setProperty(a, s, r.style.getPropertyPriority(a)), !0;
11
+ }
12
+ return !1;
13
+ }
14
+ async function k(a, r) {
15
+ await m("background", a, r) || await m("background-image", a, r), await m("mask", a, r) || await m("-webkit-mask", a, r) || await m("mask-image", a, r) || await m("-webkit-mask-image", a, r);
16
+ }
17
+ async function I(a, r) {
18
+ const e = g(a, HTMLImageElement);
19
+ if (!(e && !u(a.src)) && !(g(a, SVGImageElement) && !u(a.href.baseVal)))
20
+ return;
21
+ const t = e ? a.src : a.href.baseVal, i = await l(t, h(t), r);
22
+ await new Promise((s, n) => {
23
+ a.onload = s, a.onerror = r.onImageErrorHandler ? (...w) => {
24
+ try {
25
+ s(r.onImageErrorHandler(...w));
26
+ } catch (y) {
27
+ n(y);
28
+ }
29
+ } : n;
30
+ const f = a;
31
+ f.decode && (f.decode = s), f.loading === "lazy" && (f.loading = "eager"), e ? (a.srcset = "", a.src = i) : a.href.baseVal = i;
32
+ });
33
+ }
34
+ async function E(a, r) {
35
+ const t = b(a.childNodes).map((i) => P(i, r));
36
+ await Promise.all(t).then(() => a);
37
+ }
38
+ async function P(a, r) {
39
+ g(a, Element) && (await k(a, r), await I(a, r), await E(a, r));
40
+ }
41
+ export {
42
+ P as embedImages
43
+ };
@@ -0,0 +1,47 @@
1
+ import { resolveUrl as l } from "./util.js";
2
+ import { getMimeType as i } from "./mimes.js";
3
+ import { isDataUrl as f, resourceToDataURL as m } from "./dataurl.js";
4
+ const a = /url\((['"]?)([^'"]+?)\1\)/g, p = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, R = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
5
+ function d(r) {
6
+ const e = r.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
7
+ return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
8
+ }
9
+ function g(r) {
10
+ const e = [];
11
+ return r.replace(a, (t, n, o) => (e.push(o), t)), e.filter((t) => !f(t));
12
+ }
13
+ async function E(r, e, t, n, o) {
14
+ try {
15
+ const c = t ? l(e, t) : e, s = i(e);
16
+ let u;
17
+ return o || (u = await m(c, s, n)), r.replace(d(e), `$1${u}$3`);
18
+ } catch {
19
+ }
20
+ return r;
21
+ }
22
+ function $(r, { preferredFontFormat: e }) {
23
+ return e ? r.replace(R, (t) => {
24
+ for (; ; ) {
25
+ const [n, , o] = p.exec(t) || [];
26
+ if (!o)
27
+ return "";
28
+ if (o === e)
29
+ return `src: ${n};`;
30
+ }
31
+ }) : r;
32
+ }
33
+ function h(r) {
34
+ return r.search(a) !== -1;
35
+ }
36
+ async function v(r, e, t) {
37
+ if (!h(r))
38
+ return r;
39
+ const n = $(r, t);
40
+ return g(n).reduce((c, s) => c.then((u) => E(u, s, e, t)), Promise.resolve(n));
41
+ }
42
+ export {
43
+ E as embed,
44
+ v as embedResources,
45
+ g as parseURLs,
46
+ h as shouldEmbed
47
+ };
@@ -0,0 +1,122 @@
1
+ import { toArray as u } from "./util.js";
2
+ import { fetchAsDataURL as g } from "./dataurl.js";
3
+ import { embedResources as R, shouldEmbed as x } from "./embed-resources.js";
4
+ const h = {};
5
+ async function m(e) {
6
+ let t = h[e];
7
+ if (t != null)
8
+ return t;
9
+ const r = await (await fetch(e)).text();
10
+ return t = { url: e, cssText: r }, h[e] = t, t;
11
+ }
12
+ async function S(e, t) {
13
+ let n = e.cssText;
14
+ const r = /url\(["']?([^"')]+)["']?\)/g, s = (n.match(/url\([^)]+\)/g) || []).map(async (i) => {
15
+ let c = i.replace(r, "$1");
16
+ return c.startsWith("https://") || (c = new URL(c, e.url).href), g(c, t.fetchRequestInit, ({ result: l }) => (n = n.replace(i, `url(${l})`), [i, l]));
17
+ });
18
+ return Promise.all(s).then(() => n);
19
+ }
20
+ function y(e) {
21
+ if (e == null)
22
+ return [];
23
+ const t = [], n = /(\/\*[\s\S]*?\*\/)/gi;
24
+ let r = e.replace(n, "");
25
+ const o = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
26
+ for (; ; ) {
27
+ const l = o.exec(r);
28
+ if (l === null)
29
+ break;
30
+ t.push(l[0]);
31
+ }
32
+ r = r.replace(o, "");
33
+ const s = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, i = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", c = new RegExp(i, "gi");
34
+ for (; ; ) {
35
+ let l = s.exec(r);
36
+ if (l === null) {
37
+ if (l = c.exec(r), l === null)
38
+ break;
39
+ s.lastIndex = c.lastIndex;
40
+ } else
41
+ c.lastIndex = s.lastIndex;
42
+ t.push(l[0]);
43
+ }
44
+ return t;
45
+ }
46
+ async function E(e, t) {
47
+ const n = [], r = [];
48
+ return e.forEach((o) => {
49
+ if ("cssRules" in o)
50
+ try {
51
+ u(o.cssRules || []).forEach((s, i) => {
52
+ if (s.type === CSSRule.IMPORT_RULE) {
53
+ let c = i + 1;
54
+ const l = s.href, d = m(l).then((a) => S(a, t)).then((a) => y(a).forEach((f) => {
55
+ try {
56
+ o.insertRule(f, f.startsWith("@import") ? c += 1 : o.cssRules.length);
57
+ } catch {
58
+ }
59
+ })).catch((a) => {
60
+ });
61
+ r.push(d);
62
+ }
63
+ });
64
+ } catch {
65
+ const i = e.find((c) => c.href == null) || document.styleSheets[0];
66
+ o.href != null && r.push(m(o.href).then((c) => S(c, t)).then((c) => y(c).forEach((l) => {
67
+ i.insertRule(l, i.cssRules.length);
68
+ })).catch((c) => {
69
+ }));
70
+ }
71
+ }), Promise.all(r).then(() => (e.forEach((o) => {
72
+ if ("cssRules" in o)
73
+ try {
74
+ u(o.cssRules || []).forEach((s) => {
75
+ n.push(s);
76
+ });
77
+ } catch {
78
+ }
79
+ }), n));
80
+ }
81
+ function F(e) {
82
+ return e.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) => x(t.style.getPropertyValue("src")));
83
+ }
84
+ async function w(e, t) {
85
+ if (e.ownerDocument == null)
86
+ throw new Error("Provided element is not within a Document");
87
+ const n = u(e.ownerDocument.styleSheets), r = await E(n, t);
88
+ return F(r);
89
+ }
90
+ function p(e) {
91
+ return e.trim().replace(/["']/g, "");
92
+ }
93
+ function C(e) {
94
+ const t = /* @__PURE__ */ new Set();
95
+ function n(r) {
96
+ (r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((s) => {
97
+ t.add(p(s));
98
+ }), Array.from(r.children).forEach((s) => {
99
+ s instanceof HTMLElement && n(s);
100
+ });
101
+ }
102
+ return n(e), t;
103
+ }
104
+ async function b(e, t) {
105
+ const n = await w(e, t), r = C(e);
106
+ return (await Promise.all(n.filter((s) => r.has(p(s.style.fontFamily))).map((s) => {
107
+ const i = s.parentStyleSheet ? s.parentStyleSheet.href : null;
108
+ return R(s.cssText, i, t);
109
+ }))).join(`
110
+ `);
111
+ }
112
+ async function P(e, t) {
113
+ const n = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await b(e, t);
114
+ if (n) {
115
+ const r = document.createElement("style"), o = document.createTextNode(n);
116
+ r.appendChild(o), e.firstChild ? e.insertBefore(r, e.firstChild) : e.appendChild(r);
117
+ }
118
+ }
119
+ export {
120
+ P as embedWebFonts,
121
+ b as getWebFontCSS
122
+ };
@@ -0,0 +1,30 @@
1
+ import { cloneNode as d } from "./clone-node.js";
2
+ import { embedImages as u } from "./embed-images.js";
3
+ import { applyStyle as w } from "./apply-style.js";
4
+ import { embedWebFonts as v } from "./embed-webfonts.js";
5
+ import { canvasToBlob as f, getImageSize as m, createImage as b, getPixelRatio as y, checkCanvasDimensions as R, nodeToDataURL as x } from "./util.js";
6
+ async function C(a, t = {}) {
7
+ const { width: c, height: i } = m(a, t), n = await d(a, t, !0);
8
+ return await v(n, t), await u(n, t), w(n, t), await x(n, c, i);
9
+ }
10
+ async function r(a, t = {}) {
11
+ const { width: c, height: i } = m(a, t), n = await C(a, t), s = await b(n), e = document.createElement("canvas"), o = e.getContext("2d"), g = t.pixelRatio || y(), h = t.canvasWidth || c, l = t.canvasHeight || i;
12
+ return e.width = h * g, e.height = l * g, t.skipAutoScale || R(e), e.style.width = `${h}`, e.style.height = `${l}`, t.backgroundColor && (o.fillStyle = t.backgroundColor, o.fillRect(0, 0, e.width, e.height)), o.drawImage(s, 0, 0, e.width, e.height), e;
13
+ }
14
+ async function U(a, t = {}) {
15
+ return (await r(a, t)).toDataURL();
16
+ }
17
+ async function W(a, t = {}) {
18
+ return (await r(a, t)).toDataURL("image/jpeg", t.quality || 1);
19
+ }
20
+ async function B(a, t = {}) {
21
+ const c = await r(a, t);
22
+ return await f(c);
23
+ }
24
+ export {
25
+ B as toBlob,
26
+ r as toCanvas,
27
+ W as toJpeg,
28
+ U as toPng,
29
+ C as toSvg
30
+ };
@@ -0,0 +1,24 @@
1
+ const n = "application/font-woff", o = "image/jpeg", i = {
2
+ woff: n,
3
+ woff2: n,
4
+ ttf: "application/font-truetype",
5
+ eot: "application/vnd.ms-fontobject",
6
+ png: "image/png",
7
+ jpg: o,
8
+ jpeg: o,
9
+ gif: "image/gif",
10
+ tiff: "image/tiff",
11
+ svg: "image/svg+xml",
12
+ webp: "image/webp"
13
+ };
14
+ function f(e) {
15
+ const t = /\.([^./]*?)$/g.exec(e);
16
+ return t ? t[1] : "";
17
+ }
18
+ function g(e) {
19
+ const t = f(e).toLowerCase();
20
+ return i[t] || "";
21
+ }
22
+ export {
23
+ g as getMimeType
24
+ };
@@ -0,0 +1,106 @@
1
+ function w(t, e) {
2
+ if (t.match(/^[a-z]+:\/\//i))
3
+ return t;
4
+ if (t.match(/^\/\//))
5
+ return window.location.protocol + t;
6
+ if (t.match(/^[a-z]+:/i))
7
+ return t;
8
+ const r = document.implementation.createHTMLDocument(), i = r.createElement("base"), o = r.createElement("a");
9
+ return r.head.appendChild(i), r.body.appendChild(o), e && (i.href = e), o.href = t, o.href;
10
+ }
11
+ const a = /* @__PURE__ */ (() => {
12
+ let t = 0;
13
+ const e = () => (
14
+ // eslint-disable-next-line no-bitwise
15
+ `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
16
+ );
17
+ return () => (t += 1, `u${e()}${t}`);
18
+ })();
19
+ function l(t) {
20
+ const e = [];
21
+ for (let r = 0, i = t.length; r < i; r++)
22
+ e.push(t[r]);
23
+ return e;
24
+ }
25
+ let h = null;
26
+ function y(t = {}) {
27
+ return h || (t.includeStyleProperties ? (h = t.includeStyleProperties, h) : (h = l(window.getComputedStyle(document.documentElement)), h));
28
+ }
29
+ function d(t, e) {
30
+ const i = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e);
31
+ return i ? parseFloat(i.replace("px", "")) : 0;
32
+ }
33
+ function s(t) {
34
+ const e = d(t, "border-left-width"), r = d(t, "border-right-width");
35
+ return t.clientWidth + e + r;
36
+ }
37
+ function g(t) {
38
+ const e = d(t, "border-top-width"), r = d(t, "border-bottom-width");
39
+ return t.clientHeight + e + r;
40
+ }
41
+ function p(t, e = {}) {
42
+ const r = e.width || s(t), i = e.height || g(t);
43
+ return { width: r, height: i };
44
+ }
45
+ function b() {
46
+ let t, e;
47
+ try {
48
+ e = process;
49
+ } catch {
50
+ }
51
+ const r = e && e.env ? e.env.devicePixelRatio : null;
52
+ return r && (t = parseInt(r, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
53
+ }
54
+ const n = 16384;
55
+ function P(t) {
56
+ (t.width > n || t.height > n) && (t.width > n && t.height > n ? t.width > t.height ? (t.height *= n / t.width, t.width = n) : (t.width *= n / t.height, t.height = n) : t.width > n ? (t.height *= n / t.width, t.width = n) : (t.width *= n / t.height, t.height = n));
57
+ }
58
+ function A(t, e = {}) {
59
+ return t.toBlob ? new Promise((r) => {
60
+ t.toBlob(r, e.type ? e.type : "image/png", e.quality ? e.quality : 1);
61
+ }) : new Promise((r) => {
62
+ const i = window.atob(t.toDataURL(e.type ? e.type : void 0, e.quality ? e.quality : void 0).split(",")[1]), o = i.length, u = new Uint8Array(o);
63
+ for (let c = 0; c < o; c += 1)
64
+ u[c] = i.charCodeAt(c);
65
+ r(new Blob([u], {
66
+ type: e.type ? e.type : "image/png"
67
+ }));
68
+ });
69
+ }
70
+ function S(t) {
71
+ return new Promise((e, r) => {
72
+ const i = new Image();
73
+ i.onload = () => {
74
+ i.decode().then(() => {
75
+ requestAnimationFrame(() => e(i));
76
+ });
77
+ }, i.onerror = r, i.crossOrigin = "anonymous", i.decoding = "async", i.src = t;
78
+ });
79
+ }
80
+ async function m(t) {
81
+ return Promise.resolve().then(() => new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
82
+ }
83
+ async function x(t, e, r) {
84
+ const i = "http://www.w3.org/2000/svg", o = document.createElementNS(i, "svg"), u = document.createElementNS(i, "foreignObject");
85
+ return o.setAttribute("width", `${e}`), o.setAttribute("height", `${r}`), o.setAttribute("viewBox", `0 0 ${e} ${r}`), u.setAttribute("width", "100%"), u.setAttribute("height", "100%"), u.setAttribute("x", "0"), u.setAttribute("y", "0"), u.setAttribute("externalResourcesRequired", "true"), o.appendChild(u), u.appendChild(t), m(o);
86
+ }
87
+ const f = (t, e) => {
88
+ if (t instanceof e)
89
+ return !0;
90
+ const r = Object.getPrototypeOf(t);
91
+ return r === null ? !1 : r.constructor.name === e.name || f(r, e);
92
+ };
93
+ export {
94
+ A as canvasToBlob,
95
+ P as checkCanvasDimensions,
96
+ S as createImage,
97
+ p as getImageSize,
98
+ b as getPixelRatio,
99
+ y as getStyleProperties,
100
+ f as isInstanceOfElement,
101
+ x as nodeToDataURL,
102
+ w as resolveUrl,
103
+ m as svgToDataURL,
104
+ l as toArray,
105
+ a as uuid
106
+ };
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
3
+ *
4
+ * Copyright (c) 2014-2017, Jon Schlinkert.
5
+ * Released under the MIT License.
6
+ */
7
+ function n(t) {
8
+ return Object.prototype.toString.call(t) === "[object Object]";
9
+ }
10
+ function o(t) {
11
+ var e, r;
12
+ return n(t) === !1 ? !1 : (e = t.constructor, e === void 0 ? !0 : (r = e.prototype, !(n(r) === !1 || r.hasOwnProperty("isPrototypeOf") === !1)));
13
+ }
14
+ export {
15
+ o as isPlainObject
16
+ };
@@ -0,0 +1,21 @@
1
+ function s(e, o, r) {
2
+ typeof r.value == "object" && (r.value = f(r.value)), !r.enumerable || r.get || r.set || !r.configurable || !r.writable || o === "__proto__" ? Object.defineProperty(e, o, r) : e[o] = r.value;
3
+ }
4
+ function f(e) {
5
+ if (typeof e != "object") return e;
6
+ var o = 0, r, n, t, c = Object.prototype.toString.call(e);
7
+ if (c === "[object Object]" ? t = Object.create(e.__proto__ || null) : c === "[object Array]" ? t = Array(e.length) : c === "[object Set]" ? (t = /* @__PURE__ */ new Set(), e.forEach(function(i) {
8
+ t.add(f(i));
9
+ })) : c === "[object Map]" ? (t = /* @__PURE__ */ new Map(), e.forEach(function(i, b) {
10
+ t.set(f(b), f(i));
11
+ })) : c === "[object Date]" ? t = /* @__PURE__ */ new Date(+e) : c === "[object RegExp]" ? t = new RegExp(e.source, e.flags) : c === "[object DataView]" ? t = new e.constructor(f(e.buffer)) : c === "[object ArrayBuffer]" ? t = e.slice(0) : c.slice(-6) === "Array]" && (t = new e.constructor(e)), t) {
12
+ for (n = Object.getOwnPropertySymbols(e); o < n.length; o++)
13
+ s(t, n[o], Object.getOwnPropertyDescriptor(e, n[o]));
14
+ for (o = 0, n = Object.getOwnPropertyNames(e); o < n.length; o++)
15
+ Object.hasOwnProperty.call(t, r = n[o]) && t[r] === e[r] || s(t, r, Object.getOwnPropertyDescriptor(e, r));
16
+ }
17
+ return t || e;
18
+ }
19
+ export {
20
+ f as klona
21
+ };