@unicom-cloud/utils 0.1.24 → 0.1.25
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 +1 -1
- 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/keyboardCode.js +1 -1
- package/constant/licensePlate.js +1 -1
- package/constant/name.js +1 -1
- package/constant/platform.js +1 -1
- package/constant/protocol.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/index.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 +22 -22
- 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 +5 -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/js-cookie/index.js +1 -1
- package/js-cookie/src/api.js +1 -1
- package/js-cookie/src/assign.js +1 -1
- package/js-cookie/src/converter.js +1 -1
- package/jsCookie.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 +10 -14
- 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/objectKeysSort.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 +51 -49
- package/snapdom/src/api/snapdom.js +171 -67
- package/snapdom/src/core/cache.js +2 -2
- package/snapdom/src/core/capture.js +249 -234
- package/snapdom/src/core/clone.js +151 -120
- package/snapdom/src/core/context.js +10 -8
- package/snapdom/src/core/plugins.js +69 -0
- package/snapdom/src/core/prepare.js +2 -2
- package/snapdom/src/exporters/download.js +1 -1
- package/snapdom/src/exporters/toBlob.js +1 -1
- package/snapdom/src/exporters/toCanvas.js +40 -40
- package/snapdom/src/exporters/toImg.js +1 -1
- package/snapdom/src/modules/CSSVar.js +66 -40
- package/snapdom/src/modules/background.js +39 -23
- package/snapdom/src/modules/changeCSS.js +1 -1
- package/snapdom/src/modules/counter.js +100 -86
- package/snapdom/src/modules/fonts.js +4 -4
- package/snapdom/src/modules/iconFonts.js +98 -14
- package/snapdom/src/modules/images.js +1 -1
- package/snapdom/src/modules/lineClamp.js +1 -1
- package/snapdom/src/modules/pseudo.js +147 -138
- package/snapdom/src/modules/rasterize.js +1 -1
- package/snapdom/src/modules/snapFetch.js +1 -1
- package/snapdom/src/modules/styles.js +1 -1
- package/snapdom/src/modules/svgDefs.js +86 -39
- package/snapdom/src/utils/browser.js +1 -1
- package/snapdom/src/utils/css.js +1 -1
- package/snapdom/src/utils/helpers.js +1 -1
- package/snapdom/src/utils/image.js +1 -1
- package/snapdom/types/snapdom.d.ts +253 -184
- package/snapdom.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 +8 -0
- package/tween/src/easing.js +62 -0
- package/tween/src/tween.js +46 -0
- package/tween.js +8 -0
- package/types/dom-helpers/types.d.ts +2 -0
- package/types/normalize-wheel/index.d.ts +1 -1
- package/types/snapdom/src/api/snapdom.d.ts +4 -0
- package/types/snapdom/src/core/capture.d.ts +4 -18
- package/types/snapdom/src/core/context.d.ts +4 -4
- package/types/snapdom/src/core/exporters.d.ts +33 -0
- package/types/snapdom/src/core/plugins.d.ts +59 -0
- package/types/snapdom/src/modules/CSSVar.d.ts +3 -7
- package/types/snapdom/src/modules/iconFonts.d.ts +34 -0
- package/types/snapdom/src/modules/svgDefs.d.ts +9 -15
- package/types/tween/index.d.ts +1 -0
- package/types/tween/src/easing.d.ts +22 -0
- package/types/tween/src/index.d.ts +3 -0
- package/types/tween/src/tween.d.ts +22 -0
- package/types/validate/index.d.ts +3 -0
- package/types/validate/src/index.d.ts +39 -0
- package/types/validate/src/interface.d.ts +53 -0
- package/types/validate/src/locale/en-US.d.ts +47 -0
- package/types/validate/src/locale/zh-CN.d.ts +47 -0
- package/types/validate/src/message.d.ts +2 -0
- package/types/validate/src/rules/array.d.ts +12 -0
- package/types/validate/src/rules/base.d.ts +25 -0
- package/types/validate/src/rules/boolean.d.ts +8 -0
- package/types/validate/src/rules/custom.d.ts +7 -0
- package/types/validate/src/rules/number.d.ts +12 -0
- package/types/validate/src/rules/object.d.ts +9 -0
- package/types/validate/src/rules/string.d.ts +12 -0
- package/types/validate/src/rules/type.d.ts +9 -0
- package/types/validate/src/utils.d.ts +3 -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 +28 -0
- package/validate/src/index.js +106 -0
- package/validate/src/locale/en-US.js +50 -0
- package/validate/src/locale/zh-CN.js +50 -0
- package/validate/src/message.js +5 -0
- package/validate/src/rules/array.js +73 -0
- package/validate/src/rules/base.js +69 -0
- package/validate/src/rules/boolean.js +29 -0
- package/validate/src/rules/custom.js +26 -0
- package/validate/src/rules/number.js +54 -0
- package/validate/src/rules/object.js +39 -0
- package/validate/src/rules/string.js +54 -0
- package/validate/src/rules/type.js +35 -0
- package/validate/src/utils.js +8 -0
- package/validate.js +28 -0
- package/version/index.js +1 -1
- package/version.js +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* 2025-
|
|
1
|
+
/* 2025-11-03 10:27:31 */
|
|
2
2
|
import { cache as g } from "../core/cache.js";
|
|
3
|
-
import { extractURL as X } from "../utils/helpers.js";
|
|
4
3
|
import { isIconFont as x } from "./iconFonts.js";
|
|
4
|
+
import { extractURL as X } from "../utils/helpers.js";
|
|
5
5
|
import { snapFetch as A } from "./snapFetch.js";
|
|
6
6
|
async function lt(o, e, r, a = 32, n = "#000") {
|
|
7
7
|
e = e.replace(/^['"]+|['"]+$/g, "");
|
|
@@ -280,7 +280,7 @@ function rt(o) {
|
|
|
280
280
|
if (!o) return o;
|
|
281
281
|
const e = /@font-face[^{}]*\{[^}]*\}/gi, r = /* @__PURE__ */ new Set(), a = [];
|
|
282
282
|
for (const c of o.match(e) || []) {
|
|
283
|
-
const t = c.match(/font-family:\s*([^;]+);/i)?.[1] || "", f = T(t), s = (c.match(/font-weight:\s*([^;]+);/i)?.[1] || "400").trim(), u = (c.match(/font-style:\s*([^;]+);/i)?.[1] || "normal").trim(), m = (c.match(/font-stretch:\s*([^;]+);/i)?.[1] || "100%").trim(), d = (c.match(/unicode-range:\s*([^;]+);/i)?.[1] || "").trim(), p = (c.match(/src\s*:\s*([^;]+)
|
|
283
|
+
const t = c.match(/font-family:\s*([^;]+);/i)?.[1] || "", f = T(t), s = (c.match(/font-weight:\s*([^;]+);/i)?.[1] || "400").trim(), u = (c.match(/font-style:\s*([^;]+);/i)?.[1] || "normal").trim(), m = (c.match(/font-stretch:\s*([^;]+);/i)?.[1] || "100%").trim(), d = (c.match(/unicode-range:\s*([^;]+);/i)?.[1] || "").trim(), p = (c.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1] || "").trim(), L = P(p, location.href), C = L.length ? L.map((l) => String(l).toLowerCase()).sort().join("|") : p.toLowerCase(), i = [
|
|
284
284
|
String(f || "").toLowerCase(),
|
|
285
285
|
s,
|
|
286
286
|
u,
|
|
@@ -466,7 +466,7 @@ async function ut({
|
|
|
466
466
|
for (const S of l.match(nt) || []) {
|
|
467
467
|
const y = (S.match(/font-family:\s*([^;]+);/i)?.[1] || "").trim(), R = T(y);
|
|
468
468
|
if (!R || x(R)) continue;
|
|
469
|
-
const b = (S.match(/font-weight:\s*([^;]+);/i)?.[1] || "400").trim(), F = (S.match(/font-style:\s*([^;]+);/i)?.[1] || "normal").trim(), M = (S.match(/font-stretch:\s*([^;]+);/i)?.[1] || "100%").trim(), E = (S.match(/unicode-range:\s*([^;]+);/i)?.[1] || "").trim(), k = (S.match(/src\s*:\s*([^;]+)
|
|
469
|
+
const b = (S.match(/font-weight:\s*([^;]+);/i)?.[1] || "400").trim(), F = (S.match(/font-style:\s*([^;]+);/i)?.[1] || "normal").trim(), M = (S.match(/font-stretch:\s*([^;]+);/i)?.[1] || "100%").trim(), E = (S.match(/unicode-range:\s*([^;]+);/i)?.[1] || "").trim(), k = (S.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1] || "").trim(), $ = P(k, i.href);
|
|
470
470
|
if (!t(R, F, b, M))
|
|
471
471
|
continue;
|
|
472
472
|
const _ = B(E);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* 2025-
|
|
2
|
-
var
|
|
1
|
+
/* 2025-11-03 10:27:31 */
|
|
2
|
+
var S = [
|
|
3
3
|
// /uicons/i,
|
|
4
4
|
/font\s*awesome/i,
|
|
5
5
|
/material\s*icons/i,
|
|
@@ -11,19 +11,103 @@ var s = [
|
|
|
11
11
|
/heroicons/i,
|
|
12
12
|
/layui/i,
|
|
13
13
|
/lucide/i
|
|
14
|
-
],
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
for (const
|
|
18
|
-
|
|
14
|
+
], d = [];
|
|
15
|
+
function M(n) {
|
|
16
|
+
const t = Array.isArray(n) ? n : [n];
|
|
17
|
+
for (const o of t)
|
|
18
|
+
o instanceof RegExp ? d.push(o) : typeof o == "string" ? d.push(new RegExp(o, "i")) : console.warn("[snapdom] Ignored invalid iconFont value:", o);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
for (const
|
|
23
|
-
if (
|
|
24
|
-
return !!(/icon/i.test(
|
|
20
|
+
function $(n) {
|
|
21
|
+
const t = typeof n == "string" ? n : "", o = [...S, ...d];
|
|
22
|
+
for (const s of o)
|
|
23
|
+
if (s instanceof RegExp && s.test(t)) return !0;
|
|
24
|
+
return !!(/icon/i.test(t) || /glyph/i.test(t) || /symbols/i.test(t) || /feather/i.test(t) || /fontawesome/i.test(t));
|
|
25
|
+
}
|
|
26
|
+
function b(n = "") {
|
|
27
|
+
const t = String(n).toLowerCase();
|
|
28
|
+
return /\bmaterial\s*icons\b/.test(t) || /\bmaterial\s*symbols\b/.test(t);
|
|
29
|
+
}
|
|
30
|
+
async function I(n = "Material Icons", t = 24) {
|
|
31
|
+
try {
|
|
32
|
+
await Promise.all([
|
|
33
|
+
document.fonts.load(`400 ${t}px "${n.replace(/["']/g, "")}"`),
|
|
34
|
+
document.fonts.ready
|
|
35
|
+
]);
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function v(n) {
|
|
40
|
+
let t = n.getPropertyValue("-webkit-text-fill-color")?.trim() || "";
|
|
41
|
+
const o = /rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(t);
|
|
42
|
+
if (t && !o && t.toLowerCase() !== "currentcolor")
|
|
43
|
+
return t;
|
|
44
|
+
const s = n.color?.trim();
|
|
45
|
+
return s && s !== "inherit" ? s : "#000";
|
|
46
|
+
}
|
|
47
|
+
async function F(n, {
|
|
48
|
+
family: t = "Material Icons",
|
|
49
|
+
weight: o = "normal",
|
|
50
|
+
fontSize: s = 32,
|
|
51
|
+
color: u = "#000",
|
|
52
|
+
variation: y = ""
|
|
53
|
+
} = {}) {
|
|
54
|
+
const i = String(t || "").replace(/^['"]+|['"]+$/g, ""), r = window.devicePixelRatio || 1;
|
|
55
|
+
await I(i, s);
|
|
56
|
+
const e = document.createElement("span");
|
|
57
|
+
e.textContent = n, e.style.position = "absolute", e.style.visibility = "hidden", e.style.left = "-99999px", e.style.whiteSpace = "nowrap", e.style.fontFamily = `"${i}"`, e.style.fontWeight = String(o || "normal"), e.style.fontSize = `${s}px`, e.style.lineHeight = "1", e.style.margin = "0", e.style.padding = "0", e.style.fontFeatureSettings = "'liga' 1", e.style.fontVariantLigatures = "normal", y && (e.style.fontVariationSettings = y), e.style.color = u, document.body.appendChild(e);
|
|
58
|
+
const a = e.getBoundingClientRect(), g = Math.max(1, Math.ceil(a.width)), m = Math.max(1, Math.ceil(a.height));
|
|
59
|
+
document.body.removeChild(e);
|
|
60
|
+
const c = document.createElement("canvas");
|
|
61
|
+
c.width = g * r, c.height = m * r;
|
|
62
|
+
const l = c.getContext("2d");
|
|
63
|
+
l.scale(r, r), l.font = `${o ? `${o} ` : ""}${s}px "${i}"`, l.textAlign = "left", l.textBaseline = "top", l.fillStyle = u;
|
|
64
|
+
try {
|
|
65
|
+
l.fontKerning = "normal";
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
return l.fillText(n, 0, 0), {
|
|
69
|
+
dataUrl: c.toDataURL(),
|
|
70
|
+
width: g,
|
|
71
|
+
height: m
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
async function A(n, t) {
|
|
75
|
+
if (!(n instanceof Element)) return 0;
|
|
76
|
+
const o = '.material-icons, [class*="material-symbols"]', s = Array.from(n.querySelectorAll(o)).filter(
|
|
77
|
+
(i) => i && i.textContent && i.textContent.trim()
|
|
78
|
+
);
|
|
79
|
+
if (s.length === 0) return 0;
|
|
80
|
+
const u = t instanceof Element ? Array.from(t.querySelectorAll(o)).filter(
|
|
81
|
+
(i) => i && i.textContent && i.textContent.trim()
|
|
82
|
+
) : [];
|
|
83
|
+
let y = 0;
|
|
84
|
+
for (let i = 0; i < s.length; i++) {
|
|
85
|
+
const r = s[i], e = u[i] || null;
|
|
86
|
+
try {
|
|
87
|
+
const a = getComputedStyle(e || r), g = a.fontFamily || "Material Icons";
|
|
88
|
+
if (!b(g)) continue;
|
|
89
|
+
const m = (e || r).textContent.trim();
|
|
90
|
+
if (!m) continue;
|
|
91
|
+
const c = parseInt(a.fontSize, 10) || 24, l = a.fontWeight && a.fontWeight !== "normal" ? a.fontWeight : "normal", h = v(a), p = a.fontVariationSettings && a.fontVariationSettings !== "normal" ? a.fontVariationSettings : "", { dataUrl: x, width: w, height: C } = await F(m, {
|
|
92
|
+
family: g,
|
|
93
|
+
weight: l,
|
|
94
|
+
fontSize: c,
|
|
95
|
+
color: h,
|
|
96
|
+
variation: p
|
|
97
|
+
});
|
|
98
|
+
r.textContent = "";
|
|
99
|
+
const f = r.ownerDocument.createElement("img");
|
|
100
|
+
f.src = x, f.alt = m, f.style.height = `${c}px`, f.style.width = `${Math.max(1, Math.round(w / C * c))}px`, f.style.objectFit = "contain", f.style.verticalAlign = getComputedStyle(r).verticalAlign || "baseline", r.appendChild(f), y++;
|
|
101
|
+
} catch {
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return y;
|
|
25
105
|
}
|
|
26
106
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
107
|
+
I as ensureMaterialFontsReady,
|
|
108
|
+
M as extendIconFonts,
|
|
109
|
+
$ as isIconFont,
|
|
110
|
+
b as isMaterialFamily,
|
|
111
|
+
A as ligatureIconToImage,
|
|
112
|
+
F as materialIconToImage
|
|
29
113
|
};
|
|
@@ -1,215 +1,224 @@
|
|
|
1
|
-
/* 2025-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function
|
|
1
|
+
/* 2025-11-03 10:27:31 */
|
|
2
|
+
import { cache as J } from "../core/cache.js";
|
|
3
|
+
import { buildCounterContext as Q, hasCounters as Z, resolveCountersInContent as tt } from "./counter.js";
|
|
4
|
+
import { iconToImage as nt } from "./fonts.js";
|
|
5
|
+
import { isIconFont as et } from "./iconFonts.js";
|
|
6
|
+
import { getStyle as ot, snapshotComputedStyle as T, getStyleKey as U, splitBackgroundImage as rt } from "../utils/css.js";
|
|
7
|
+
import { extractURL as st, safeEncodeURI as it } from "../utils/helpers.js";
|
|
8
|
+
import { inlineSingleBackgroundEntry as at } from "../utils/image.js";
|
|
9
|
+
import { snapFetch as ct } from "./snapFetch.js";
|
|
10
|
+
var k = /* @__PURE__ */ new WeakMap(), L = -1;
|
|
11
|
+
function lt(n) {
|
|
12
12
|
return (n || "").replace(/"([^"]*)"/g, "$1");
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function dt(n) {
|
|
15
15
|
if (!n) return "";
|
|
16
|
-
const
|
|
16
|
+
const r = [], a = /"([^"]*)"/g;
|
|
17
17
|
let c;
|
|
18
|
-
for (; c =
|
|
19
|
-
return
|
|
18
|
+
for (; c = a.exec(n); ) r.push(c[1]);
|
|
19
|
+
return r.length ? r.join("") : lt(n);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
21
|
+
function v(n, r) {
|
|
22
|
+
const a = n.parentElement, c = a ? k.get(a) : null;
|
|
23
23
|
return c ? {
|
|
24
|
-
get(l,
|
|
25
|
-
const
|
|
26
|
-
return typeof
|
|
24
|
+
get(l, f) {
|
|
25
|
+
const d = r.get(l, f), g = c.get(f);
|
|
26
|
+
return typeof g == "number" ? Math.max(d, g) : d;
|
|
27
27
|
},
|
|
28
|
-
getStack(l,
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
31
|
-
const
|
|
32
|
-
if (typeof
|
|
33
|
-
const
|
|
34
|
-
return
|
|
28
|
+
getStack(l, f) {
|
|
29
|
+
const d = r.getStack(l, f);
|
|
30
|
+
if (!d.length) return d;
|
|
31
|
+
const g = c.get(f);
|
|
32
|
+
if (typeof g == "number") {
|
|
33
|
+
const e = d.slice();
|
|
34
|
+
return e[e.length - 1] = Math.max(e[e.length - 1], g), e;
|
|
35
35
|
}
|
|
36
|
-
return
|
|
36
|
+
return d;
|
|
37
37
|
}
|
|
38
|
-
} :
|
|
38
|
+
} : r;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function F(n, r, a) {
|
|
41
41
|
const c = /* @__PURE__ */ new Map();
|
|
42
|
-
function l(
|
|
43
|
-
const
|
|
44
|
-
if (!
|
|
45
|
-
for (const
|
|
46
|
-
const
|
|
47
|
-
|
|
42
|
+
function l(e) {
|
|
43
|
+
const t = [];
|
|
44
|
+
if (!e || e === "none") return t;
|
|
45
|
+
for (const h of String(e).split(",")) {
|
|
46
|
+
const b = h.trim().split(/\s+/), s = b[0], y = Number.isFinite(Number(b[1])) ? Number(b[1]) : void 0;
|
|
47
|
+
s && t.push({ name: s, num: y });
|
|
48
48
|
}
|
|
49
|
-
return
|
|
49
|
+
return t;
|
|
50
50
|
}
|
|
51
|
-
const
|
|
52
|
-
function
|
|
53
|
-
if (c.has(
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
const
|
|
59
|
-
|
|
51
|
+
const f = l(r?.counterReset), d = l(r?.counterIncrement);
|
|
52
|
+
function g(e) {
|
|
53
|
+
if (c.has(e)) return c.get(e).slice();
|
|
54
|
+
let t = a.getStack(n, e);
|
|
55
|
+
t = t.length ? t.slice() : [];
|
|
56
|
+
const h = f.find((s) => s.name === e);
|
|
57
|
+
if (h) {
|
|
58
|
+
const s = Number.isFinite(h.num) ? h.num : 0;
|
|
59
|
+
t = t.length ? [...t, s] : [s];
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
const
|
|
64
|
-
|
|
61
|
+
const b = d.find((s) => s.name === e);
|
|
62
|
+
if (b) {
|
|
63
|
+
const s = Number.isFinite(b.num) ? b.num : 1;
|
|
64
|
+
t.length === 0 && (t = [0]), t[t.length - 1] += s;
|
|
65
65
|
}
|
|
66
|
-
return c.set(
|
|
66
|
+
return c.set(e, t.slice()), t;
|
|
67
67
|
}
|
|
68
68
|
return {
|
|
69
|
-
get(
|
|
70
|
-
const
|
|
71
|
-
return
|
|
69
|
+
get(e, t) {
|
|
70
|
+
const h = g(t);
|
|
71
|
+
return h.length ? h[h.length - 1] : 0;
|
|
72
72
|
},
|
|
73
|
-
getStack(
|
|
74
|
-
return t
|
|
73
|
+
getStack(e, t) {
|
|
74
|
+
return g(t);
|
|
75
75
|
},
|
|
76
76
|
/** expone increments del pseudo para que el caller pueda propagar a hermanos */
|
|
77
|
-
__incs:
|
|
77
|
+
__incs: d
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function ut(n, r, a) {
|
|
81
81
|
let c;
|
|
82
82
|
try {
|
|
83
|
-
c = getComputedStyle(n,
|
|
83
|
+
c = getComputedStyle(n, r);
|
|
84
84
|
} catch {
|
|
85
85
|
}
|
|
86
86
|
const l = c?.content;
|
|
87
87
|
if (!l || l === "none" || l === "normal") return { text: "", incs: [] };
|
|
88
|
-
const
|
|
89
|
-
let
|
|
90
|
-
return { text:
|
|
88
|
+
const f = v(n, a), d = F(n, c, f);
|
|
89
|
+
let g = Z(l) ? tt(l, n, d) : l;
|
|
90
|
+
return { text: dt(g), incs: d.__incs || [] };
|
|
91
91
|
}
|
|
92
|
-
async function
|
|
93
|
-
if (!(n instanceof Element) || !(
|
|
94
|
-
|
|
92
|
+
async function ft(n, r, a, c) {
|
|
93
|
+
if (!(n instanceof Element) || !(r instanceof Element)) return;
|
|
94
|
+
const l = J?.session?.__counterEpoch ?? 0;
|
|
95
|
+
if (L !== l && (k = /* @__PURE__ */ new WeakMap(), a && (a.__counterCtx = null), L = l), !a.__counterCtx)
|
|
95
96
|
try {
|
|
96
|
-
|
|
97
|
+
a.__counterCtx = Q(
|
|
98
|
+
n.ownerDocument || document
|
|
99
|
+
);
|
|
97
100
|
} catch {
|
|
98
101
|
}
|
|
102
|
+
const f = a.__counterCtx;
|
|
99
103
|
for (const e of ["::before", "::after", "::first-letter"])
|
|
100
104
|
try {
|
|
101
|
-
const t =
|
|
105
|
+
const t = ot(n, e);
|
|
102
106
|
if (!t || typeof t[Symbol.iterator] != "function" || t.content === "none" && t.backgroundImage === "none" && t.backgroundColor === "transparent" && (t.borderStyle === "none" || parseFloat(t.borderWidth) === 0) && (!t.transform || t.transform === "none") && t.display === "inline") continue;
|
|
103
107
|
if (e === "::first-letter") {
|
|
104
|
-
const
|
|
105
|
-
if (!(t.color !==
|
|
106
|
-
const
|
|
107
|
-
(
|
|
108
|
+
const i = getComputedStyle(n);
|
|
109
|
+
if (!(t.color !== i.color || t.fontSize !== i.fontSize || t.fontWeight !== i.fontWeight)) continue;
|
|
110
|
+
const m = Array.from(r.childNodes).find(
|
|
111
|
+
(z) => z.nodeType === Node.TEXT_NODE && z.textContent?.trim().length > 0
|
|
108
112
|
);
|
|
109
|
-
if (!
|
|
110
|
-
const
|
|
111
|
-
if (!
|
|
113
|
+
if (!m) continue;
|
|
114
|
+
const p = m.textContent, E = p.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0], H = p.slice(E?.length || 0);
|
|
115
|
+
if (!E || /[\uD800-\uDFFF]/.test(E)) continue;
|
|
112
116
|
const w = document.createElement("span");
|
|
113
|
-
w.textContent =
|
|
114
|
-
const K =
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
117
|
+
w.textContent = E, w.dataset.snapdomPseudo = "::first-letter";
|
|
118
|
+
const K = T(t), G = U(K, "span");
|
|
119
|
+
a.styleMap.set(w, G);
|
|
120
|
+
const $ = document.createTextNode(H);
|
|
121
|
+
r.replaceChild($, m), r.insertBefore(w, $);
|
|
118
122
|
continue;
|
|
119
123
|
}
|
|
120
|
-
const
|
|
124
|
+
const b = t.content, { text: s, incs: y } = ut(
|
|
121
125
|
n,
|
|
122
126
|
e,
|
|
123
|
-
|
|
124
|
-
),
|
|
125
|
-
if (!(
|
|
126
|
-
if (
|
|
127
|
-
const
|
|
128
|
-
for (const { name:
|
|
129
|
-
if (!
|
|
130
|
-
const
|
|
127
|
+
f
|
|
128
|
+
), _ = t.backgroundImage, C = t.backgroundColor, M = t.fontFamily, x = parseInt(t.fontSize) || 32, j = parseInt(t.fontWeight) || !1, O = t.color || "#000", N = t.borderStyle, X = parseFloat(t.borderWidth), W = t.transform, B = et(M), R = b !== "none" && s !== "", P = _ && _ !== "none", I = C && C !== "transparent" && C !== "rgba(0, 0, 0, 0)", A = N && N !== "none" && X > 0, D = W && W !== "none";
|
|
129
|
+
if (!(R || P || I || A || D)) {
|
|
130
|
+
if (y && y.length && n.parentElement) {
|
|
131
|
+
const i = k.get(n.parentElement) || /* @__PURE__ */ new Map();
|
|
132
|
+
for (const { name: u } of y) {
|
|
133
|
+
if (!u) continue;
|
|
134
|
+
const m = v(n, f), S = F(
|
|
131
135
|
n,
|
|
132
136
|
getComputedStyle(n, e),
|
|
133
|
-
|
|
134
|
-
).get(n,
|
|
135
|
-
|
|
137
|
+
m
|
|
138
|
+
).get(n, u);
|
|
139
|
+
i.set(u, S);
|
|
136
140
|
}
|
|
137
|
-
|
|
141
|
+
k.set(n.parentElement, i);
|
|
138
142
|
}
|
|
139
143
|
continue;
|
|
140
144
|
}
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
const V =
|
|
144
|
-
if (
|
|
145
|
+
const o = document.createElement("span");
|
|
146
|
+
o.dataset.snapdomPseudo = e, o.style.display = "inline", o.style.verticalAlign = "baseline", o.style.pointerEvents = "none";
|
|
147
|
+
const V = T(t), Y = U(V, "span");
|
|
148
|
+
if (a.styleMap.set(o, Y), B && s && s.length === 1) {
|
|
145
149
|
const {
|
|
146
|
-
dataUrl:
|
|
147
|
-
width:
|
|
148
|
-
height:
|
|
149
|
-
} = await
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
),
|
|
156
|
-
|
|
157
|
-
} else if (
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
150
|
+
dataUrl: i,
|
|
151
|
+
width: u,
|
|
152
|
+
height: m
|
|
153
|
+
} = await nt(
|
|
154
|
+
s,
|
|
155
|
+
M,
|
|
156
|
+
j,
|
|
157
|
+
x,
|
|
158
|
+
O
|
|
159
|
+
), p = document.createElement("img");
|
|
160
|
+
p.src = i, p.style = `height:${x}px;width:${u / m * x}px;object-fit:contain;`, o.appendChild(p), r.dataset.snapdomHasIcon = "true";
|
|
161
|
+
} else if (s && s.startsWith("url(")) {
|
|
162
|
+
const i = st(s);
|
|
163
|
+
if (i?.trim())
|
|
160
164
|
try {
|
|
161
|
-
const
|
|
165
|
+
const u = document.createElement("img"), m = await ct(it(i), {
|
|
162
166
|
as: "dataURL",
|
|
163
167
|
useProxy: c.useProxy
|
|
164
168
|
});
|
|
165
|
-
|
|
166
|
-
} catch (
|
|
167
|
-
console.error(`[snapdom] Error in pseudo ${e} for`, n,
|
|
169
|
+
u.src = m.data, u.style = `width:${x}px;height:auto;object-fit:contain;`, o.appendChild(u);
|
|
170
|
+
} catch (u) {
|
|
171
|
+
console.error(`[snapdom] Error in pseudo ${e} for`, n, u);
|
|
168
172
|
}
|
|
169
|
-
} else !B &&
|
|
170
|
-
|
|
173
|
+
} else !B && R && (o.textContent = s);
|
|
174
|
+
o.style.backgroundImage = "none", "maskImage" in o.style && (o.style.maskImage = "none"), "webkitMaskImage" in o.style && (o.style.webkitMaskImage = "none");
|
|
175
|
+
try {
|
|
176
|
+
o.style.backgroundRepeat = t.backgroundRepeat, o.style.backgroundSize = t.backgroundSize, t.backgroundPositionX && t.backgroundPositionY ? (o.style.backgroundPositionX = t.backgroundPositionX, o.style.backgroundPositionY = t.backgroundPositionY) : o.style.backgroundPosition = t.backgroundPosition, o.style.backgroundOrigin = t.backgroundOrigin, o.style.backgroundClip = t.backgroundClip, o.style.backgroundAttachment = t.backgroundAttachment, o.style.backgroundBlendMode = t.backgroundBlendMode;
|
|
177
|
+
} catch {
|
|
178
|
+
}
|
|
179
|
+
if (P)
|
|
171
180
|
try {
|
|
172
|
-
const
|
|
173
|
-
|
|
181
|
+
const i = rt(_), u = await Promise.all(
|
|
182
|
+
i.map(at)
|
|
174
183
|
);
|
|
175
|
-
|
|
176
|
-
} catch (
|
|
184
|
+
o.style.backgroundImage = u.join(", ");
|
|
185
|
+
} catch (i) {
|
|
177
186
|
console.warn(
|
|
178
187
|
`[snapdom] Failed to inline background-image for ${e}`,
|
|
179
|
-
|
|
188
|
+
i
|
|
180
189
|
);
|
|
181
190
|
}
|
|
182
|
-
|
|
183
|
-
const q =
|
|
184
|
-
if (
|
|
185
|
-
const
|
|
191
|
+
I && (o.style.backgroundColor = C);
|
|
192
|
+
const q = o.childNodes.length > 0 || o.textContent?.trim() !== "" || P || I || A || D;
|
|
193
|
+
if (y && y.length && n.parentElement) {
|
|
194
|
+
const i = k.get(n.parentElement) || /* @__PURE__ */ new Map(), u = v(n, f), m = F(
|
|
186
195
|
n,
|
|
187
196
|
getComputedStyle(n, e),
|
|
188
|
-
|
|
197
|
+
u
|
|
189
198
|
);
|
|
190
|
-
for (const { name:
|
|
191
|
-
if (!
|
|
192
|
-
const
|
|
193
|
-
|
|
199
|
+
for (const { name: p } of y) {
|
|
200
|
+
if (!p) continue;
|
|
201
|
+
const S = m.get(n, p);
|
|
202
|
+
i.set(p, S);
|
|
194
203
|
}
|
|
195
|
-
|
|
204
|
+
k.set(n.parentElement, i);
|
|
196
205
|
}
|
|
197
206
|
if (!q) continue;
|
|
198
|
-
e === "::before" ?
|
|
207
|
+
e === "::before" ? r.insertBefore(o, r.firstChild) : r.appendChild(o);
|
|
199
208
|
} catch (t) {
|
|
200
209
|
console.warn(`[snapdom] Failed to capture ${e} for`, n, t);
|
|
201
210
|
}
|
|
202
|
-
const
|
|
211
|
+
const d = Array.from(n.children), g = Array.from(r.children).filter(
|
|
203
212
|
(e) => !e.dataset.snapdomPseudo
|
|
204
213
|
);
|
|
205
|
-
for (let e = 0; e < Math.min(
|
|
206
|
-
await
|
|
207
|
-
|
|
214
|
+
for (let e = 0; e < Math.min(d.length, g.length); e++)
|
|
215
|
+
await ft(
|
|
216
|
+
d[e],
|
|
208
217
|
g[e],
|
|
209
|
-
|
|
218
|
+
a,
|
|
210
219
|
c
|
|
211
220
|
);
|
|
212
221
|
}
|
|
213
222
|
export {
|
|
214
|
-
|
|
223
|
+
ft as inlinePseudoElements
|
|
215
224
|
};
|