@unicom-cloud/utils 0.1.31 → 0.1.32
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/case-name/index.js +1 -1
- package/caseName.js +1 -1
- package/class-name/index.js +6 -5
- package/className.js +1 -1
- package/clipboard-copy/index.js +1 -1
- package/clipboardCopy.js +1 -1
- package/constant/address.js +1 -1
- package/constant/chineseCharacters.js +1 -1
- package/constant/constellations.js +1 -1
- package/constant/domain.js +1 -1
- package/constant/emoji.js +1 -1
- package/constant/identity.js +1 -1
- package/constant/index.js +1 -1
- package/constant/isMobile.js +7 -0
- package/constant/keyboardCode.js +1 -1
- package/constant/licensePlate.js +1 -1
- package/constant/name.js +1 -1
- package/constant/platform.js +18 -17
- package/constant/protocol.js +1 -1
- package/constant/string.js +1 -1
- package/constant/ui.js +1 -1
- package/constant.js +1 -1
- package/content-disposition/index.js +1 -1
- package/contentDisposition.js +1 -1
- package/cookie/index.js +1 -1
- package/cookie/src/api.js +1 -1
- package/cookie/src/assign.js +1 -1
- package/cookie/src/converter.js +1 -1
- package/cookie.js +1 -1
- package/date/convertTime.js +1 -1
- package/date/convertToDuration.js +1 -1
- package/date/index.js +1 -1
- package/date.js +1 -1
- package/decimal/decimal.js +1 -1
- package/decimal/index.js +1 -1
- package/decimal.js +1 -1
- package/dom-helpers/activeElement.js +1 -1
- package/dom-helpers/addClass.js +1 -1
- package/dom-helpers/addEventListener.js +1 -1
- package/dom-helpers/animate.js +1 -1
- package/dom-helpers/animationFrame.js +1 -1
- package/dom-helpers/attribute.js +1 -1
- package/dom-helpers/camelize.js +1 -1
- package/dom-helpers/camelizeStyle.js +1 -1
- package/dom-helpers/canUseDOM.js +1 -1
- package/dom-helpers/childElements.js +1 -1
- package/dom-helpers/childNodes.js +1 -1
- package/dom-helpers/clear.js +1 -1
- package/dom-helpers/closest.js +1 -1
- package/dom-helpers/collectElements.js +1 -1
- package/dom-helpers/collectSiblings.js +1 -1
- package/dom-helpers/contains.js +1 -1
- package/dom-helpers/css.js +1 -1
- package/dom-helpers/filterEventHandler.js +1 -1
- package/dom-helpers/getComputedStyle.js +1 -1
- package/dom-helpers/getScrollAccessor.js +1 -1
- package/dom-helpers/hasClass.js +1 -1
- package/dom-helpers/height.js +1 -1
- package/dom-helpers/hyphenate.js +1 -1
- package/dom-helpers/hyphenateStyle.js +1 -1
- package/dom-helpers/index.js +1 -1
- package/dom-helpers/insertAfter.js +1 -1
- package/dom-helpers/isDocument.js +1 -1
- package/dom-helpers/isInput.js +1 -1
- package/dom-helpers/isTransform.js +1 -1
- package/dom-helpers/isVisible.js +1 -1
- package/dom-helpers/isWindow.js +1 -1
- package/dom-helpers/listen.js +1 -1
- package/dom-helpers/matches.js +1 -1
- package/dom-helpers/nextUntil.js +1 -1
- package/dom-helpers/offset.js +1 -1
- package/dom-helpers/offsetParent.js +1 -1
- package/dom-helpers/ownerDocument.js +1 -1
- package/dom-helpers/ownerWindow.js +1 -1
- package/dom-helpers/parents.js +1 -1
- package/dom-helpers/position.js +1 -1
- package/dom-helpers/prepend.js +1 -1
- package/dom-helpers/querySelectorAll.js +1 -1
- package/dom-helpers/reflow.js +1 -1
- package/dom-helpers/remove.js +1 -1
- package/dom-helpers/removeClass.js +1 -1
- package/dom-helpers/removeEventListener.js +1 -1
- package/dom-helpers/scrollLeft.js +1 -1
- package/dom-helpers/scrollParent.js +1 -1
- package/dom-helpers/scrollTo.js +1 -1
- package/dom-helpers/scrollTop.js +1 -1
- package/dom-helpers/scrollbarSize.js +1 -1
- package/dom-helpers/siblings.js +1 -1
- package/dom-helpers/text.js +1 -1
- package/dom-helpers/toggleClass.js +1 -1
- package/dom-helpers/transitionEnd.js +1 -1
- package/dom-helpers/triggerEvent.js +1 -1
- package/dom-helpers/types.js +1 -1
- package/dom-helpers/width.js +1 -1
- package/domHelpers.js +1 -1
- package/emitter/index.js +1 -1
- package/emitter/src/index.js +1 -1
- package/emitter.js +1 -1
- package/file/fileToURL.js +1 -1
- package/file/index.js +1 -1
- package/file/saveAs.js +1 -1
- package/file.js +1 -1
- package/idb/index.js +1 -1
- package/idb.js +1 -1
- package/index.js +1 -1
- package/invariant/index.js +1 -1
- package/invariant.js +1 -1
- package/is/index.js +1 -1
- package/is.js +1 -1
- package/lunar/index.js +1 -1
- package/lunar/lib/Holiday.js +1 -1
- package/lunar/lib/HolidayUtil.js +1 -1
- package/lunar/lib/I18n.js +1 -1
- package/lunar/lib/JieQi.js +1 -1
- package/lunar/lib/Lunar.js +1 -1
- package/lunar/lib/LunarMonth.js +1 -1
- package/lunar/lib/LunarTime.js +1 -1
- package/lunar/lib/LunarUtil.js +1 -1
- package/lunar/lib/LunarYear.js +1 -1
- package/lunar/lib/ShouXingUtil.js +1 -1
- package/lunar/lib/Solar.js +1 -1
- package/lunar/lib/SolarHalfYear.js +1 -1
- package/lunar/lib/SolarMonth.js +1 -1
- package/lunar/lib/SolarSeason.js +1 -1
- package/lunar/lib/SolarUtil.js +1 -1
- package/lunar/lib/SolarWeek.js +1 -1
- package/lunar/lib/SolarYear.js +1 -1
- package/lunar/lib/index.js +1 -1
- package/lunar.js +1 -1
- package/math/index.js +1 -1
- package/math.js +1 -1
- package/md5/index.js +1 -1
- package/md5.js +1 -1
- package/mock/MockWebSocket.js +1 -1
- package/mock/MockXMLHttpRequest.js +1 -1
- package/mock/index.js +1 -1
- package/mock.js +1 -1
- package/normalize-wheel/ExecutionEnvironment.js +1 -1
- package/normalize-wheel/UserAgent_DEPRECATED.js +1 -1
- package/normalize-wheel/index.js +1 -1
- package/normalize-wheel/isEventSupported.js +1 -1
- package/normalizeWheel.js +1 -1
- package/number-to-chinese/index.js +1 -1
- package/numberToChinese.js +1 -1
- package/nzh/cn.js +1 -1
- package/nzh/hk.js +1 -1
- package/nzh/index.js +1 -1
- package/nzh/nzh.js +1 -1
- package/nzh/src/autoGet.js +1 -1
- package/nzh/src/index.js +1 -1
- package/nzh/src/langs/cn_b.js +1 -1
- package/nzh/src/langs/cn_s.js +1 -1
- package/nzh/src/langs/hk_b.js +1 -1
- package/nzh/src/langs/hk_s.js +1 -1
- package/nzh/src/utils.js +1 -1
- package/nzh.js +1 -1
- package/object-keys-sort/index.js +1 -1
- package/object-prototype-to-string-call/index.js +1 -1
- package/objectKeysSort.js +1 -1
- package/objectPrototypeToStringCall.js +1 -1
- package/package.json +1 -1
- package/pinyin/index.js +1 -1
- package/pinyin/simplified.js +1 -1
- package/pinyin/src/core.js +1 -1
- package/pinyin/src/simplified.js +1 -1
- package/pinyin/src/simplified_dict.js +1 -1
- package/pinyin/src/traditional.js +1 -1
- package/pinyin/src/traditional_dict.js +1 -1
- package/pinyin/traditional.js +1 -1
- package/pinyin.js +1 -1
- package/query-string/base.js +1 -1
- package/query-string/index.js +1 -1
- package/query-string/splitOnFirst.js +1 -1
- package/queryString.js +1 -1
- package/random/address.js +1 -1
- package/random/constellation.js +1 -1
- package/random/image.js +1 -1
- package/random/index.js +1 -1
- package/random/licensePlate.js +1 -1
- package/random/name.js +1 -1
- package/random/number.js +1 -1
- package/random/text.js +1 -1
- package/random/time.js +1 -1
- package/random/web.js +1 -1
- package/random.js +1 -1
- package/screenfull/index.js +1 -1
- package/screenfull.js +1 -1
- package/sleep/index.js +1 -1
- package/sleep.js +1 -1
- package/snapdom/index.js +1 -1
- package/snapdom/src/api/preCache.js +1 -1
- package/snapdom/src/api/snapdom.js +198 -153
- package/snapdom/src/core/cache.js +1 -1
- package/snapdom/src/core/capture.js +121 -326
- package/snapdom/src/core/clone.js +117 -266
- package/snapdom/src/core/context.js +1 -1
- package/snapdom/src/core/plugins.js +1 -1
- package/snapdom/src/core/prepare.js +48 -157
- package/snapdom/src/exporters/download.js +9 -10
- package/snapdom/src/exporters/toBlob.js +10 -15
- package/snapdom/src/exporters/toCanvas.js +72 -65
- package/snapdom/src/exporters/toImg.js +1 -1
- package/snapdom/src/modules/CSSVar.js +1 -1
- package/snapdom/src/modules/background.js +1 -1
- package/snapdom/src/modules/changeCSS.js +1 -1
- package/snapdom/src/modules/counter.js +1 -1
- package/snapdom/src/modules/fonts.js +118 -112
- package/snapdom/src/modules/iconFonts.js +133 -69
- package/snapdom/src/modules/images.js +36 -33
- package/snapdom/src/modules/lineClamp.js +1 -1
- package/snapdom/src/modules/pseudo.js +275 -161
- package/snapdom/src/modules/rasterize.js +6 -7
- package/snapdom/src/modules/snapFetch.js +1 -1
- package/snapdom/src/modules/styles.js +89 -67
- package/snapdom/src/modules/svgDefs.js +73 -60
- package/snapdom/src/utils/browser.js +13 -8
- package/snapdom/src/utils/capture.helpers.js +131 -0
- package/snapdom/src/utils/clone.helpers.js +283 -0
- package/snapdom/src/utils/css.js +1 -1
- package/snapdom/src/utils/helpers.js +1 -1
- package/snapdom/src/utils/image.js +15 -24
- package/snapdom/src/utils/prepare.helpers.js +8 -0
- package/snapdom/src/utils/transforms.helpers.js +211 -0
- package/snapdom.js +1 -1
- package/string/index.js +1 -1
- package/string.js +1 -1
- package/tinycolor/index.js +1 -1
- package/tinycolor/src/conversion.js +1 -1
- package/tinycolor/src/css-color-names.js +1 -1
- package/tinycolor/src/format-input.js +1 -1
- package/tinycolor/src/from-ratio.js +1 -1
- package/tinycolor/src/index.js +1 -1
- package/tinycolor/src/random.js +1 -1
- package/tinycolor/src/readability.js +1 -1
- package/tinycolor/src/to-ms-filter.js +1 -1
- package/tinycolor/src/utils.js +1 -1
- package/tinycolor.js +1 -1
- package/tree/index.js +1 -1
- package/tree/search/index.js +1 -1
- package/tree.js +1 -1
- package/tween/index.js +1 -1
- package/tween/src/easing.js +1 -1
- package/tween/src/tween.js +1 -1
- package/tween.js +1 -1
- package/types/constant/isMobile.d.ts +3 -0
- package/types/snapdom/src/api/snapdom.d.ts +10 -79
- package/types/snapdom/src/exporters/toCanvas.d.ts +11 -3
- package/types/snapdom/src/exporters/toJpg.d.ts +1 -0
- package/types/snapdom/src/exporters/toPng.d.ts +6 -0
- package/types/snapdom/src/exporters/toSvg.d.ts +1 -0
- package/types/snapdom/src/exporters/toWebp.d.ts +1 -0
- package/types/snapdom/src/modules/iconFonts.d.ts +7 -20
- package/types/snapdom/src/modules/pseudo.d.ts +18 -0
- package/types/snapdom/src/modules/rasterize.d.ts +6 -10
- package/types/snapdom/src/utils/browser.d.ts +0 -3
- package/types/snapdom/src/utils/capture.helpers.d.ts +45 -0
- package/types/snapdom/src/utils/clone.helpers.d.ts +97 -0
- package/types/snapdom/src/utils/image.d.ts +0 -8
- package/types/snapdom/src/utils/index.d.ts +1 -1
- package/types/snapdom/src/utils/prepare.helpers.d.ts +9 -0
- package/types/snapdom/src/utils/transforms.helpers.d.ts +118 -0
- package/ui-color/compareColorByRange.js +1 -1
- package/ui-color/index.js +1 -1
- package/uiColor.js +1 -1
- package/url-toolkit/index.js +1 -1
- package/url-toolkit/src/url-toolkit.js +1 -1
- package/urlToolkit.js +1 -1
- package/validate/index.js +1 -1
- package/validate/src/index.js +1 -1
- package/validate/src/locale/en-US.js +1 -1
- package/validate/src/locale/zh-CN.js +1 -1
- package/validate/src/message.js +1 -1
- package/validate/src/rules/array.js +1 -1
- package/validate/src/rules/base.js +1 -1
- package/validate/src/rules/boolean.js +1 -1
- package/validate/src/rules/custom.js +1 -1
- package/validate/src/rules/number.js +1 -1
- package/validate/src/rules/object.js +1 -1
- package/validate/src/rules/string.js +1 -1
- package/validate/src/rules/type.js +1 -1
- package/validate/src/utils.js +1 -1
- package/validate.js +1 -1
- package/version/index.js +1 -1
- package/version.js +1 -1
- package/xlsx/index.js +1 -1
- package/xlsx/xlsx.js +1 -1
- package/xlsx.js +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* 2025-11-
|
|
2
|
-
|
|
1
|
+
/* 2025-11-27 12:11:03 */
|
|
2
|
+
const v = [
|
|
3
3
|
// /uicons/i,
|
|
4
4
|
/font\s*awesome/i,
|
|
5
5
|
/material\s*icons/i,
|
|
@@ -11,103 +11,167 @@ var S = [
|
|
|
11
11
|
/heroicons/i,
|
|
12
12
|
/layui/i,
|
|
13
13
|
/lucide/i
|
|
14
|
-
],
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
], h = Object.assign(
|
|
15
|
+
{
|
|
16
|
+
materialIconsFilled: "https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2",
|
|
17
|
+
materialIconsOutlined: "https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2",
|
|
18
|
+
materialIconsRound: "https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2",
|
|
19
|
+
materialIconsSharp: "https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2"
|
|
20
|
+
},
|
|
21
|
+
typeof window < "u" && window.__SNAPDOM_ICON_FONTS__ || {}
|
|
22
|
+
);
|
|
23
|
+
let F = [];
|
|
24
|
+
function R(o) {
|
|
25
|
+
const t = Array.isArray(o) ? o : [o];
|
|
26
|
+
for (const s of t)
|
|
27
|
+
s instanceof RegExp ? F.push(s) : typeof s == "string" ? F.push(new RegExp(s, "i")) : console.warn("[snapdom] Ignored invalid iconFont value:", s);
|
|
19
28
|
}
|
|
20
|
-
function
|
|
21
|
-
const t = typeof
|
|
22
|
-
for (const
|
|
23
|
-
if (
|
|
29
|
+
function _(o) {
|
|
30
|
+
const t = typeof o == "string" ? o : "", s = [...v, ...F];
|
|
31
|
+
for (const e of s)
|
|
32
|
+
if (e instanceof RegExp && e.test(t)) return !0;
|
|
24
33
|
return !!(/icon/i.test(t) || /glyph/i.test(t) || /symbols/i.test(t) || /feather/i.test(t) || /fontawesome/i.test(t));
|
|
25
34
|
}
|
|
26
|
-
function
|
|
27
|
-
const t = String(
|
|
35
|
+
function S(o = "") {
|
|
36
|
+
const t = String(o).toLowerCase();
|
|
28
37
|
return /\bmaterial\s*icons\b/.test(t) || /\bmaterial\s*symbols\b/.test(t);
|
|
29
38
|
}
|
|
30
|
-
|
|
39
|
+
const x = /* @__PURE__ */ new Map();
|
|
40
|
+
function M(o = "") {
|
|
41
|
+
const t = /* @__PURE__ */ Object.create(null), s = String(o || ""), e = /['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g;
|
|
42
|
+
let c;
|
|
43
|
+
for (; c = e.exec(s); ) t[c[1].toUpperCase()] = Number(c[2]);
|
|
44
|
+
return t;
|
|
45
|
+
}
|
|
46
|
+
async function L(o, t, s) {
|
|
47
|
+
const e = String(o || ""), c = e.toLowerCase(), f = String(t || "").toLowerCase();
|
|
48
|
+
if (/\bmaterial\s*icons\b/.test(c) && !/\bsymbols\b/.test(c))
|
|
49
|
+
return { familyForMeasure: e, familyForCanvas: e };
|
|
50
|
+
if (!/\bmaterial\s*symbols\b/.test(c))
|
|
51
|
+
return { familyForMeasure: e, familyForCanvas: e };
|
|
52
|
+
const m = s && (s.FILL ?? s.fill);
|
|
53
|
+
let a = "outlined";
|
|
54
|
+
/\brounded\b/.test(f) || /\bround\b/.test(f) ? a = "rounded" : /\bsharp\b/.test(f) ? a = "sharp" : /\boutlined\b/.test(f) && (a = "outlined");
|
|
55
|
+
const r = m === 1;
|
|
56
|
+
let l = null;
|
|
57
|
+
if (r && (a === "outlined" && h.materialIconsFilled ? l = {
|
|
58
|
+
url: h.materialIconsFilled,
|
|
59
|
+
alias: "snapdom-mi-filled"
|
|
60
|
+
} : a === "rounded" && h.materialIconsRound ? l = {
|
|
61
|
+
url: h.materialIconsRound,
|
|
62
|
+
alias: "snapdom-mi-round"
|
|
63
|
+
} : a === "sharp" && h.materialIconsSharp && (l = {
|
|
64
|
+
url: h.materialIconsSharp,
|
|
65
|
+
alias: "snapdom-mi-sharp"
|
|
66
|
+
})), !l)
|
|
67
|
+
return { familyForMeasure: e, familyForCanvas: e };
|
|
68
|
+
if (!x.has(l.alias))
|
|
69
|
+
try {
|
|
70
|
+
const n = new FontFace(l.alias, `url(${l.url})`, {
|
|
71
|
+
style: "normal",
|
|
72
|
+
weight: "400"
|
|
73
|
+
});
|
|
74
|
+
document.fonts.add(n), await n.load(), x.set(l.alias, !0);
|
|
75
|
+
} catch {
|
|
76
|
+
return { familyForMeasure: e, familyForCanvas: e };
|
|
77
|
+
}
|
|
78
|
+
const u = `"${l.alias}"`;
|
|
79
|
+
return { familyForMeasure: u, familyForCanvas: u };
|
|
80
|
+
}
|
|
81
|
+
async function A(o = "Material Icons", t = 24) {
|
|
31
82
|
try {
|
|
32
83
|
await Promise.all([
|
|
33
|
-
document.fonts.load(
|
|
84
|
+
document.fonts.load(
|
|
85
|
+
`400 ${t}px "${String(o).replace(/["']/g, "")}"`
|
|
86
|
+
),
|
|
34
87
|
document.fonts.ready
|
|
35
88
|
]);
|
|
36
89
|
} catch {
|
|
37
90
|
}
|
|
38
91
|
}
|
|
39
|
-
function
|
|
40
|
-
let t =
|
|
41
|
-
const
|
|
42
|
-
if (t && !
|
|
92
|
+
function $(o) {
|
|
93
|
+
let t = o.getPropertyValue("-webkit-text-fill-color")?.trim() || "";
|
|
94
|
+
const s = /^transparent$/i.test(t) || /rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(t);
|
|
95
|
+
if (t && !s && t.toLowerCase() !== "currentcolor")
|
|
43
96
|
return t;
|
|
44
|
-
const
|
|
45
|
-
return
|
|
97
|
+
const e = o.color?.trim();
|
|
98
|
+
return e && e !== "inherit" ? e : "#000";
|
|
46
99
|
}
|
|
47
|
-
async function
|
|
100
|
+
async function N(o, {
|
|
48
101
|
family: t = "Material Icons",
|
|
49
|
-
weight:
|
|
50
|
-
fontSize:
|
|
51
|
-
color:
|
|
52
|
-
variation:
|
|
102
|
+
weight: s = "normal",
|
|
103
|
+
fontSize: e = 32,
|
|
104
|
+
color: c = "#000",
|
|
105
|
+
variation: f = "",
|
|
106
|
+
className: i = ""
|
|
53
107
|
} = {}) {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
108
|
+
const m = String(t || "").replace(/^['"]+|['"]+$/g, ""), a = window.devicePixelRatio || 1, r = M(f), { familyForMeasure: l, familyForCanvas: u } = await L(
|
|
109
|
+
m,
|
|
110
|
+
i,
|
|
111
|
+
r
|
|
112
|
+
);
|
|
113
|
+
await A(
|
|
114
|
+
u.replace(/^["']+|["']+$/g, ""),
|
|
115
|
+
e
|
|
116
|
+
);
|
|
117
|
+
const n = document.createElement("span");
|
|
118
|
+
n.textContent = o, n.style.position = "absolute", n.style.visibility = "hidden", n.style.left = "-99999px", n.style.whiteSpace = "nowrap", n.style.fontFamily = l, n.style.fontWeight = String(s || "normal"), n.style.fontSize = `${e}px`, n.style.lineHeight = "1", n.style.margin = "0", n.style.padding = "0", n.style.fontFeatureSettings = "'liga' 1", n.style.fontVariantLigatures = "normal", n.style.color = c, document.body.appendChild(n);
|
|
119
|
+
const p = n.getBoundingClientRect(), w = Math.max(1, Math.ceil(p.width)), b = Math.max(1, Math.ceil(p.height));
|
|
120
|
+
document.body.removeChild(n);
|
|
121
|
+
const g = document.createElement("canvas");
|
|
122
|
+
g.width = w * a, g.height = b * a;
|
|
123
|
+
const d = g.getContext("2d");
|
|
124
|
+
d.scale(a, a), d.font = `${s ? `${s} ` : ""}${e}px ${u}`, d.textAlign = "left", d.textBaseline = "top", d.fillStyle = c;
|
|
64
125
|
try {
|
|
65
|
-
|
|
126
|
+
d.fontKerning = "normal";
|
|
66
127
|
} catch {
|
|
67
128
|
}
|
|
68
|
-
return
|
|
69
|
-
dataUrl:
|
|
70
|
-
width:
|
|
71
|
-
height:
|
|
129
|
+
return d.fillText(o, 0, 0), {
|
|
130
|
+
dataUrl: g.toDataURL(),
|
|
131
|
+
width: w,
|
|
132
|
+
height: b
|
|
72
133
|
};
|
|
73
134
|
}
|
|
74
|
-
async function
|
|
75
|
-
if (!(
|
|
76
|
-
const
|
|
135
|
+
async function E(o, t) {
|
|
136
|
+
if (!(o instanceof Element)) return 0;
|
|
137
|
+
const s = '.material-icons, [class*="material-symbols"]', e = Array.from(o.querySelectorAll(s)).filter(
|
|
77
138
|
(i) => i && i.textContent && i.textContent.trim()
|
|
78
139
|
);
|
|
79
|
-
if (
|
|
80
|
-
const
|
|
140
|
+
if (e.length === 0) return 0;
|
|
141
|
+
const c = t instanceof Element ? Array.from(t.querySelectorAll(s)).filter(
|
|
81
142
|
(i) => i && i.textContent && i.textContent.trim()
|
|
82
143
|
) : [];
|
|
83
|
-
let
|
|
84
|
-
for (let i = 0; i <
|
|
85
|
-
const
|
|
144
|
+
let f = 0;
|
|
145
|
+
for (let i = 0; i < e.length; i++) {
|
|
146
|
+
const m = e[i], a = c[i] || null;
|
|
86
147
|
try {
|
|
87
|
-
const
|
|
88
|
-
if (!
|
|
89
|
-
const
|
|
90
|
-
if (!
|
|
91
|
-
const
|
|
92
|
-
family:
|
|
93
|
-
weight:
|
|
94
|
-
fontSize:
|
|
95
|
-
color:
|
|
96
|
-
variation:
|
|
148
|
+
const r = getComputedStyle(a || m), l = r.fontFamily || "Material Icons";
|
|
149
|
+
if (!S(l)) continue;
|
|
150
|
+
const u = (a || m).textContent.trim();
|
|
151
|
+
if (!u) continue;
|
|
152
|
+
const n = parseInt(r.fontSize, 10) || 24, p = r.fontWeight && r.fontWeight !== "normal" ? r.fontWeight : "normal", w = $(r), b = r.fontVariationSettings && r.fontVariationSettings !== "normal" ? r.fontVariationSettings : "", g = (a || m).className || "", { dataUrl: d, width: I, height: C } = await N(u, {
|
|
153
|
+
family: l,
|
|
154
|
+
weight: p,
|
|
155
|
+
fontSize: n,
|
|
156
|
+
color: w,
|
|
157
|
+
variation: b,
|
|
158
|
+
className: g
|
|
97
159
|
});
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
160
|
+
m.textContent = "";
|
|
161
|
+
const y = m.ownerDocument.createElement("img");
|
|
162
|
+
y.src = d, y.alt = u, y.style.height = `${n}px`, y.style.width = `${Math.max(1, Math.round(I / C * n))}px`, y.style.objectFit = "contain", y.style.verticalAlign = getComputedStyle(m).verticalAlign || "baseline", m.appendChild(y), f++;
|
|
101
163
|
} catch {
|
|
102
164
|
}
|
|
103
165
|
}
|
|
104
|
-
return
|
|
166
|
+
return f;
|
|
105
167
|
}
|
|
106
168
|
export {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
169
|
+
h as ICON_FONT_URLS,
|
|
170
|
+
v as defaultIconFonts,
|
|
171
|
+
A as ensureMaterialFontsReady,
|
|
172
|
+
R as extendIconFonts,
|
|
173
|
+
_ as isIconFont,
|
|
174
|
+
S as isMaterialFamily,
|
|
175
|
+
E as ligatureIconToImage,
|
|
176
|
+
N as materialIconToImage
|
|
113
177
|
};
|
|
@@ -1,60 +1,63 @@
|
|
|
1
|
-
/* 2025-11-
|
|
2
|
-
import { snapFetch as
|
|
3
|
-
|
|
4
|
-
const
|
|
1
|
+
/* 2025-11-27 12:11:03 */
|
|
2
|
+
import { snapFetch as d } from "./snapFetch.js";
|
|
3
|
+
function u(e) {
|
|
4
|
+
const n = parseInt(e.dataset?.snapdomWidth || "", 10) || 0, h = parseInt(e.dataset?.snapdomHeight || "", 10) || 0, l = parseInt(e.getAttribute("width") || "", 10) || 0, t = parseInt(e.getAttribute("height") || "", 10) || 0, s = parseFloat(e.style?.width || "") || 0, c = parseFloat(e.style?.height || "") || 0, i = n || s || l || e.width || e.naturalWidth || 100, r = h || c || t || e.height || e.naturalHeight || 100;
|
|
5
|
+
return { width: i, height: r };
|
|
6
|
+
}
|
|
7
|
+
async function y(e, n = {}) {
|
|
8
|
+
const h = Array.from(e.querySelectorAll("img")), l = async (t) => {
|
|
5
9
|
if (!t.getAttribute("src")) {
|
|
6
|
-
const
|
|
7
|
-
|
|
10
|
+
const a = t.currentSrc || t.src || "";
|
|
11
|
+
a && t.setAttribute("src", a);
|
|
8
12
|
}
|
|
9
13
|
t.removeAttribute("srcset"), t.removeAttribute("sizes");
|
|
10
|
-
const
|
|
11
|
-
if (!
|
|
12
|
-
const
|
|
14
|
+
const s = t.src || "";
|
|
15
|
+
if (!s) return;
|
|
16
|
+
const c = await d(s, {
|
|
13
17
|
as: "dataURL",
|
|
14
|
-
useProxy:
|
|
18
|
+
useProxy: n.useProxy
|
|
15
19
|
});
|
|
16
|
-
if (
|
|
17
|
-
t.src =
|
|
20
|
+
if (c.ok && typeof c.data == "string" && c.data.startsWith("data:")) {
|
|
21
|
+
t.src = c.data, t.width || (t.width = t.naturalWidth || 100), t.height || (t.height = t.naturalHeight || 100);
|
|
18
22
|
return;
|
|
19
23
|
}
|
|
20
|
-
const { fallbackURL:
|
|
21
|
-
if (
|
|
24
|
+
const { width: i, height: r } = u(t), { fallbackURL: o } = n || {};
|
|
25
|
+
if (o)
|
|
22
26
|
try {
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
const
|
|
27
|
+
const a = typeof o == "function" ? await o({ width: i, height: r, src: s, element: t }) : o;
|
|
28
|
+
if (a) {
|
|
29
|
+
const f = await d(a, {
|
|
26
30
|
as: "dataURL",
|
|
27
|
-
useProxy:
|
|
31
|
+
useProxy: n.useProxy
|
|
28
32
|
});
|
|
29
|
-
t.src =
|
|
33
|
+
t.src = f.data, t.width || (t.width = i), t.height || (t.height = r);
|
|
30
34
|
return;
|
|
31
35
|
}
|
|
32
36
|
} catch {
|
|
33
37
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
`
|
|
39
|
-
`height:${c}px`,
|
|
38
|
+
if (n.placeholders !== !1) {
|
|
39
|
+
const a = document.createElement("div");
|
|
40
|
+
a.style.cssText = [
|
|
41
|
+
`width:${i}px`,
|
|
42
|
+
`height:${r}px`,
|
|
40
43
|
"background:#ccc",
|
|
41
44
|
"display:inline-block",
|
|
42
45
|
"text-align:center",
|
|
43
|
-
`line-height:${
|
|
46
|
+
`line-height:${r}px`,
|
|
44
47
|
"color:#666",
|
|
45
48
|
"font-size:12px",
|
|
46
49
|
"overflow:hidden"
|
|
47
|
-
].join(";"),
|
|
50
|
+
].join(";"), a.textContent = "img", t.replaceWith(a);
|
|
48
51
|
} else {
|
|
49
|
-
const
|
|
50
|
-
|
|
52
|
+
const a = document.createElement("div");
|
|
53
|
+
a.style.cssText = `display:inline-block;width:${i}px;height:${r}px;visibility:hidden;`, t.replaceWith(a);
|
|
51
54
|
}
|
|
52
55
|
};
|
|
53
|
-
for (let t = 0; t <
|
|
54
|
-
const
|
|
55
|
-
await Promise.allSettled(
|
|
56
|
+
for (let t = 0; t < h.length; t += 4) {
|
|
57
|
+
const s = h.slice(t, t + 4).map(l);
|
|
58
|
+
await Promise.allSettled(s);
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
61
|
export {
|
|
59
|
-
|
|
62
|
+
y as inlineImages
|
|
60
63
|
};
|