@unicom-cloud/utils 0.1.30 → 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,374 +1,169 @@
|
|
|
1
|
-
/* 2025-11-
|
|
2
|
-
import { applyCachePolicy as
|
|
3
|
-
import { inlineBackgroundImages as
|
|
4
|
-
import { collectUsedFontVariants as
|
|
5
|
-
import { ligatureIconToImage as
|
|
6
|
-
import { inlineImages as
|
|
7
|
-
import { lineClamp as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
/* 2025-11-27 12:11:03 */
|
|
2
|
+
import { applyCachePolicy as Se, cache as j } from "./cache.js";
|
|
3
|
+
import { inlineBackgroundImages as ye } from "../modules/background.js";
|
|
4
|
+
import { collectUsedFontVariants as ve, collectUsedCodepoints as Ce, ensureFontsReady as Me, embedCustomFonts as Fe } from "../modules/fonts.js";
|
|
5
|
+
import { ligatureIconToImage as Te } from "../modules/iconFonts.js";
|
|
6
|
+
import { inlineImages as Be } from "../modules/images.js";
|
|
7
|
+
import { lineClamp as He } from "../modules/lineClamp.js";
|
|
8
|
+
import { stripRootShadows as Pe, sanitizeCloneForXHTML as Ne, shrinkAutoSizeBoxes as Oe, limitDecimals as t, estimateKeptHeight as Ae } from "../utils/capture.helpers.js";
|
|
9
|
+
import { idle as M, isSafari as X } from "../utils/browser.js";
|
|
10
|
+
import { collectUsedTagNames as Ee, generateDedupedBaseCSS as We } from "../utils/css.js";
|
|
11
|
+
import { normalizeRootTransforms as Re, bboxWithOriginFull as ae, readIndividualTransforms as Xe, readTotalTransformMatrix as ze, parseTransformOriginPx as $e, parseBoxShadow as De, parseFilterBlur as Ie, parseOutline as Ye, parseFilterDropShadows as Ue, hasBBoxAffectingTransform as Le } from "../utils/transforms.helpers.js";
|
|
12
|
+
import { runHook as F } from "./plugins.js";
|
|
13
|
+
import { prepareClone as ke } from "./prepare.js";
|
|
14
|
+
async function lt(T, l) {
|
|
15
|
+
if (!T) throw new Error("Element cannot be null or undefined");
|
|
16
|
+
Se(l.cache);
|
|
17
|
+
const x = l.fast, B = l.outerTransforms !== !1, K = !!l.outerShadows;
|
|
18
|
+
let e = { element: T, options: l, plugins: l.plugins }, p, _, q, V = "", H = "", G, z, d = null;
|
|
19
|
+
await F("beforeSnap", e), await F("beforeClone", e);
|
|
20
|
+
const ie = He(e.element);
|
|
15
21
|
try {
|
|
16
|
-
|
|
17
|
-
} catch {
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
t.style.textShadow = "none";
|
|
21
|
-
} catch {
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
t.style.outline = "none";
|
|
25
|
-
} catch {
|
|
26
|
-
}
|
|
27
|
-
const m = (o.filter || "").replace(/\bblur\([^()]*\)\s*/gi, "").replace(/\bdrop-shadow\([^()]*\)\s*/gi, "").trim().replace(/\s+/g, " ");
|
|
28
|
-
try {
|
|
29
|
-
t.style.filter = m.length ? m : "none";
|
|
30
|
-
} catch {
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async function re(n, t) {
|
|
34
|
-
if (!n) throw new Error("Element cannot be null or undefined");
|
|
35
|
-
St(t.cache);
|
|
36
|
-
const o = t.fast, i = t.outerTransforms !== !1, m = !!t.outerShadows;
|
|
37
|
-
let e = { element: n, options: t, plugins: t.plugins }, r, l, s, c = "", f = "", h, b, u = null;
|
|
38
|
-
await E("beforeSnap", e), await E("beforeClone", e);
|
|
39
|
-
const g = Bt(e.element);
|
|
40
|
-
try {
|
|
41
|
-
({ clone: r, classCSS: l, styleCache: s } = await Yt(
|
|
22
|
+
({ clone: p, classCSS: _, styleCache: q } = await ke(
|
|
42
23
|
e.element,
|
|
43
24
|
e.options
|
|
44
|
-
)), !
|
|
25
|
+
)), !B && p && (d = Re(e.element, p)), !K && p && Pe(e.element, p);
|
|
45
26
|
} finally {
|
|
46
|
-
|
|
27
|
+
ie();
|
|
47
28
|
}
|
|
48
|
-
e = { clone:
|
|
29
|
+
if (e = { clone: p, classCSS: _, styleCache: q, ...e }, await F("afterClone", e), Ne(e.clone), e.options?.excludeMode === "remove")
|
|
30
|
+
try {
|
|
31
|
+
Oe(e.element, e.clone, e.styleCache);
|
|
32
|
+
} catch (a) {
|
|
33
|
+
console.warn("[snapdom] shrink pass failed:", a);
|
|
34
|
+
}
|
|
49
35
|
try {
|
|
50
|
-
await
|
|
36
|
+
await Te(e.clone, e.element);
|
|
51
37
|
} catch {
|
|
52
38
|
}
|
|
53
|
-
await new Promise((
|
|
54
|
-
|
|
39
|
+
await new Promise((a) => {
|
|
40
|
+
M(
|
|
55
41
|
async () => {
|
|
56
|
-
await
|
|
42
|
+
await Be(e.clone, e.options), a();
|
|
57
43
|
},
|
|
58
|
-
{ fast:
|
|
44
|
+
{ fast: x }
|
|
59
45
|
);
|
|
60
|
-
}), await new Promise((
|
|
61
|
-
|
|
46
|
+
}), await new Promise((a) => {
|
|
47
|
+
M(
|
|
62
48
|
async () => {
|
|
63
|
-
await
|
|
49
|
+
await ye(
|
|
64
50
|
e.element,
|
|
65
51
|
e.clone,
|
|
66
52
|
e.styleCache,
|
|
67
53
|
e.options
|
|
68
|
-
),
|
|
54
|
+
), a();
|
|
69
55
|
},
|
|
70
|
-
{ fast:
|
|
56
|
+
{ fast: x }
|
|
71
57
|
);
|
|
72
|
-
}),
|
|
73
|
-
|
|
58
|
+
}), l.embedFonts && await new Promise((a) => {
|
|
59
|
+
M(
|
|
74
60
|
async () => {
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
Array.from(
|
|
61
|
+
const n = ve(e.element), P = Ce(e.element);
|
|
62
|
+
if (X()) {
|
|
63
|
+
const s = new Set(
|
|
64
|
+
Array.from(n).map((o) => String(o).split("__")[0]).filter(Boolean)
|
|
79
65
|
);
|
|
80
|
-
await
|
|
66
|
+
await Me(s, 1);
|
|
81
67
|
}
|
|
82
|
-
|
|
83
|
-
required:
|
|
84
|
-
usedCodepoints:
|
|
68
|
+
V = await Fe({
|
|
69
|
+
required: n,
|
|
70
|
+
usedCodepoints: P,
|
|
85
71
|
exclude: e.options.excludeFonts,
|
|
86
72
|
useProxy: e.options.useProxy
|
|
87
|
-
}),
|
|
73
|
+
}), a();
|
|
88
74
|
},
|
|
89
|
-
{ fast:
|
|
75
|
+
{ fast: x }
|
|
90
76
|
);
|
|
91
77
|
});
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
78
|
+
const J = Ee(e.clone).sort(), $ = J.join(",");
|
|
79
|
+
j.baseStyle.has($) ? H = j.baseStyle.get($) : await new Promise((a) => {
|
|
80
|
+
M(
|
|
95
81
|
() => {
|
|
96
|
-
|
|
82
|
+
H = We(J), j.baseStyle.set($, H), a();
|
|
97
83
|
},
|
|
98
|
-
{ fast:
|
|
84
|
+
{ fast: x }
|
|
99
85
|
);
|
|
100
|
-
}), e = { fontsCSS:
|
|
101
|
-
|
|
86
|
+
}), e = { fontsCSS: V, baseCSS: H, ...e }, await F("beforeRender", e), await new Promise((a) => {
|
|
87
|
+
M(
|
|
102
88
|
() => {
|
|
103
|
-
const
|
|
89
|
+
const n = getComputedStyle(e.element), P = e.element.getBoundingClientRect();
|
|
90
|
+
let s = Math.max(
|
|
104
91
|
1,
|
|
105
|
-
|
|
106
|
-
e.element.offsetWidth || parseFloat(
|
|
92
|
+
t(
|
|
93
|
+
e.element.offsetWidth || parseFloat(n.width) || P.width || 1
|
|
107
94
|
)
|
|
108
|
-
),
|
|
95
|
+
), o = Math.max(
|
|
109
96
|
1,
|
|
110
|
-
|
|
111
|
-
e.element.offsetHeight || parseFloat(
|
|
97
|
+
t(
|
|
98
|
+
e.element.offsetHeight || parseFloat(n.height) || P.height || 1
|
|
112
99
|
)
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
100
|
+
);
|
|
101
|
+
if (e.options?.excludeMode === "remove") {
|
|
102
|
+
const i = Ae(e.element, e.options);
|
|
103
|
+
Number.isFinite(i) && i > 0 && (o = Math.max(1, Math.min(o, t(i + 1))));
|
|
104
|
+
}
|
|
105
|
+
const Q = (i, r = NaN) => {
|
|
106
|
+
const w = typeof i == "string" ? parseFloat(i) : i;
|
|
107
|
+
return Number.isFinite(w) ? w : r;
|
|
108
|
+
}, I = Q(e.options.width), Y = Q(e.options.height);
|
|
109
|
+
let f = s, h = o;
|
|
110
|
+
const S = Number.isFinite(I), y = Number.isFinite(Y), Z = o > 0 ? s / o : 1;
|
|
111
|
+
S && y ? (f = Math.max(1, t(I)), h = Math.max(1, t(Y))) : S ? (f = Math.max(1, t(I)), h = Math.max(1, t(f / (Z || 1)))) : y ? (h = Math.max(1, t(Y)), f = Math.max(1, t(h * (Z || 1)))) : (f = s, h = o);
|
|
112
|
+
let g = 0, u = 0, v = s, C = o;
|
|
113
|
+
if (!B && d && Number.isFinite(d.a)) {
|
|
114
|
+
const i = {
|
|
115
|
+
a: d.a,
|
|
116
|
+
b: d.b || 0,
|
|
117
|
+
c: d.c || 0,
|
|
118
|
+
d: d.d || 1,
|
|
127
119
|
e: 0,
|
|
128
120
|
f: 0
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
} else if (
|
|
132
|
-
const
|
|
133
|
-
baseTransform:
|
|
134
|
-
rotate:
|
|
135
|
-
scale:
|
|
136
|
-
translate:
|
|
137
|
-
}), { ox:
|
|
138
|
-
|
|
121
|
+
}, r = ae(s, o, i, 0, 0);
|
|
122
|
+
g = t(r.minX), u = t(r.minY), v = t(r.maxX), C = t(r.maxY);
|
|
123
|
+
} else if (B && je(e.element)) {
|
|
124
|
+
const r = n.transform && n.transform !== "none" ? n.transform : "", w = Xe(e.element), k = ze({
|
|
125
|
+
baseTransform: r,
|
|
126
|
+
rotate: w.rotate || "0deg",
|
|
127
|
+
scale: w.scale,
|
|
128
|
+
translate: w.translate
|
|
129
|
+
}), { ox: be, oy: we } = $e(n, s, o), xe = k.is2D ? k : new DOMMatrix(k.toString()), R = ae(s, o, xe, be, we);
|
|
130
|
+
g = t(R.minX), u = t(R.minY), v = t(R.maxX), C = t(R.maxY);
|
|
139
131
|
}
|
|
140
|
-
const
|
|
141
|
-
top:
|
|
142
|
-
|
|
132
|
+
const N = De(n), O = Ie(n), A = Ye(n), E = Ue(n), W = K ? {
|
|
133
|
+
top: t(
|
|
134
|
+
N.top + O.top + A.top + E.bleed.top
|
|
143
135
|
),
|
|
144
|
-
right:
|
|
145
|
-
|
|
136
|
+
right: t(
|
|
137
|
+
N.right + O.right + A.right + E.bleed.right
|
|
146
138
|
),
|
|
147
|
-
bottom:
|
|
148
|
-
|
|
139
|
+
bottom: t(
|
|
140
|
+
N.bottom + O.bottom + A.bottom + E.bleed.bottom
|
|
149
141
|
),
|
|
150
|
-
left:
|
|
151
|
-
|
|
142
|
+
left: t(
|
|
143
|
+
N.left + O.left + A.left + E.bleed.left
|
|
152
144
|
)
|
|
153
145
|
} : { top: 0, right: 0, bottom: 0, left: 0 };
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
const
|
|
164
|
-
|
|
146
|
+
g = t(g - W.left), u = t(u - W.top), v = t(v + W.right), C = t(C + W.bottom);
|
|
147
|
+
const ee = Math.max(1, t(v - g)), te = Math.max(1, t(C - u)), re = S || y ? t(f / s) : 1, le = y || S ? t(h / o) : 1, me = Math.max(1, t(ee * re)), ce = Math.max(1, t(te * le)), oe = "http://www.w3.org/2000/svg", de = X() ? 1 : 0, m = t(de + (B ? 0 : 1)), c = document.createElementNS(oe, "foreignObject"), fe = t(g), he = t(u);
|
|
148
|
+
c.setAttribute("x", String(t(-(fe - m)))), c.setAttribute("y", String(t(-(he - m)))), c.setAttribute("width", String(t(s + m * 2))), c.setAttribute("height", String(t(o + m * 2))), c.style.overflow = "visible";
|
|
149
|
+
const ne = document.createElement("style");
|
|
150
|
+
ne.textContent = e.baseCSS + e.fontsCSS + "svg{overflow:visible;} foreignObject{overflow:visible;}" + e.classCSS, c.appendChild(ne);
|
|
151
|
+
const b = document.createElement("div");
|
|
152
|
+
b.setAttribute("xmlns", "http://www.w3.org/1999/xhtml"), b.style.width = `${t(s)}px`, b.style.height = `${t(o)}px`, b.style.overflow = "visible", e.clone.setAttribute("xmlns", "http://www.w3.org/1999/xhtml"), b.appendChild(e.clone), c.appendChild(b);
|
|
153
|
+
const pe = new XMLSerializer().serializeToString(c), U = t(ee + m * 2), L = t(te + m * 2), se = S || y;
|
|
154
|
+
l.meta = { w0: s, h0: o, vbW: U, vbH: L, targetW: f, targetH: h };
|
|
155
|
+
const ge = X() && se ? U : t(me + m * 2), ue = X() && se ? L : t(ce + m * 2);
|
|
156
|
+
z = `<svg xmlns="${oe}" width="${ge}" height="${ue}" viewBox="0 0 ${U} ${L}">` + pe + "</svg>", G = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(z)}`, e = { svgString: z, dataURL: G, ...e }, a();
|
|
165
157
|
},
|
|
166
|
-
{ fast:
|
|
158
|
+
{ fast: x }
|
|
167
159
|
);
|
|
168
|
-
}), await
|
|
169
|
-
const
|
|
170
|
-
return
|
|
171
|
-
}
|
|
172
|
-
const a = (n, t = 3) => Number.isFinite(n) ? Math.round(n * 10 ** t) / 10 ** t : n;
|
|
173
|
-
function Wt(n) {
|
|
174
|
-
const t = `${n.filter || ""} ${n.webkitFilter || ""}`.trim();
|
|
175
|
-
if (!t || t === "none")
|
|
176
|
-
return { bleed: { top: 0, right: 0, bottom: 0, left: 0 }, has: !1 };
|
|
177
|
-
const o = t.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi) || [];
|
|
178
|
-
let i = 0, m = 0, e = 0, r = 0, l = !1;
|
|
179
|
-
for (const s of o) {
|
|
180
|
-
l = !0;
|
|
181
|
-
const c = s.match(/-?\d+(?:\.\d+)?px/gi)?.map((w) => parseFloat(w)) || [], [f = 0, h = 0, b = 0] = c, u = Math.abs(f) + b, g = Math.abs(h) + b;
|
|
182
|
-
m = Math.max(m, u + Math.max(f, 0)), r = Math.max(r, u + Math.max(-f, 0)), e = Math.max(e, g + Math.max(h, 0)), i = Math.max(i, g + Math.max(-h, 0));
|
|
183
|
-
}
|
|
184
|
-
return {
|
|
185
|
-
bleed: {
|
|
186
|
-
top: a(i),
|
|
187
|
-
right: a(m),
|
|
188
|
-
bottom: a(e),
|
|
189
|
-
left: a(r)
|
|
190
|
-
},
|
|
191
|
-
has: l
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
function It(n, t) {
|
|
195
|
-
if (!n || !t || !t.style) return null;
|
|
196
|
-
const o = getComputedStyle(n);
|
|
197
|
-
try {
|
|
198
|
-
t.style.transformOrigin = "0 0";
|
|
199
|
-
} catch {
|
|
200
|
-
}
|
|
201
|
-
try {
|
|
202
|
-
"translate" in t.style && (t.style.translate = "none"), "rotate" in t.style && (t.style.rotate = "none");
|
|
203
|
-
} catch {
|
|
204
|
-
}
|
|
205
|
-
const i = o.transform || "none";
|
|
206
|
-
if (i === "none")
|
|
207
|
-
try {
|
|
208
|
-
const e = lt(n);
|
|
209
|
-
if (e.a === 1 && e.b === 0 && e.c === 0 && e.d === 1)
|
|
210
|
-
return t.style.transform = "none", { a: 1, b: 0, c: 0, d: 1 };
|
|
211
|
-
} catch {
|
|
212
|
-
}
|
|
213
|
-
const m = i.match(/^matrix\(\s*([^)]+)\)$/i);
|
|
214
|
-
if (m) {
|
|
215
|
-
const e = m[1].split(",").map((r) => parseFloat(r.trim()));
|
|
216
|
-
if (e.length === 6 && e.every(Number.isFinite)) {
|
|
217
|
-
const [r, l, s, c] = e, f = Math.sqrt(r * r + l * l) || 0;
|
|
218
|
-
let h = 0, b = 0, u = 0, g = 0, w = 0, M = 0;
|
|
219
|
-
f > 0 && (h = r / f, b = l / f, u = h * s + b * c, g = s - h * u, w = c - b * u, M = Math.sqrt(g * g + w * w) || 0, M > 0 ? u = u / M : u = 0);
|
|
220
|
-
const S = f, d = 0, p = u * M, v = M;
|
|
221
|
-
try {
|
|
222
|
-
t.style.transform = `matrix(${S}, ${d}, ${p}, ${v}, 0, 0)`;
|
|
223
|
-
} catch {
|
|
224
|
-
}
|
|
225
|
-
return { a: S, b: d, c: p, d: v };
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
try {
|
|
229
|
-
const e = String(i).trim();
|
|
230
|
-
return t.style.transform = e + " translate(0px, 0px) rotate(0deg)", null;
|
|
231
|
-
} catch {
|
|
232
|
-
return null;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
function Nt(n) {
|
|
236
|
-
const t = n.boxShadow || "";
|
|
237
|
-
if (!t || t === "none") return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
238
|
-
const o = t.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map((l) => l.trim());
|
|
239
|
-
let i = 0, m = 0, e = 0, r = 0;
|
|
240
|
-
for (const l of o) {
|
|
241
|
-
const s = l.match(/-?\d+(\.\d+)?px/g)?.map((w) => parseFloat(w)) || [];
|
|
242
|
-
if (s.length < 2) continue;
|
|
243
|
-
const [c, f, h = 0, b = 0] = s, u = Math.abs(c) + h + b, g = Math.abs(f) + h + b;
|
|
244
|
-
m = Math.max(m, u + Math.max(c, 0)), r = Math.max(r, u + Math.max(-c, 0)), e = Math.max(e, g + Math.max(f, 0)), i = Math.max(i, g + Math.max(-f, 0));
|
|
245
|
-
}
|
|
246
|
-
return {
|
|
247
|
-
top: Math.ceil(i),
|
|
248
|
-
right: Math.ceil(m),
|
|
249
|
-
bottom: Math.ceil(e),
|
|
250
|
-
left: Math.ceil(r)
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
function Dt(n) {
|
|
254
|
-
const t = (n.filter || "").match(/blur\(\s*([0-9.]+)px\s*\)/), o = t ? Math.ceil(parseFloat(t[1]) || 0) : 0;
|
|
255
|
-
return { top: o, right: o, bottom: o, left: o };
|
|
256
|
-
}
|
|
257
|
-
function Et(n) {
|
|
258
|
-
if ((n.outlineStyle || "none") === "none")
|
|
259
|
-
return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
260
|
-
const t = Math.ceil(parseFloat(n.outlineWidth || "0") || 0);
|
|
261
|
-
return { top: t, right: t, bottom: t, left: t };
|
|
262
|
-
}
|
|
263
|
-
function it(n, t, o, i, m) {
|
|
264
|
-
const e = o.a, r = o.b, l = o.c, s = o.d, c = o.e || 0, f = o.f || 0;
|
|
265
|
-
function h(S, d) {
|
|
266
|
-
let p = S - i, v = d - m, y = e * p + l * v, x = r * p + s * v;
|
|
267
|
-
return y += i + c, x += m + f, [y, x];
|
|
268
|
-
}
|
|
269
|
-
const b = [h(0, 0), h(n, 0), h(0, t), h(n, t)];
|
|
270
|
-
let u = 1 / 0, g = 1 / 0, w = -1 / 0, M = -1 / 0;
|
|
271
|
-
for (const [S, d] of b)
|
|
272
|
-
S < u && (u = S), d < g && (g = d), S > w && (w = S), d > M && (M = d);
|
|
273
|
-
return {
|
|
274
|
-
minX: u,
|
|
275
|
-
minY: g,
|
|
276
|
-
maxX: w,
|
|
277
|
-
maxY: M,
|
|
278
|
-
width: w - u,
|
|
279
|
-
height: M - g
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
function Ut(n) {
|
|
283
|
-
return Lt(n);
|
|
284
|
-
}
|
|
285
|
-
function lt(n) {
|
|
286
|
-
const t = getComputedStyle(n).transform;
|
|
287
|
-
if (!t || t === "none") return new DOMMatrix();
|
|
288
|
-
try {
|
|
289
|
-
return new DOMMatrix(t);
|
|
290
|
-
} catch {
|
|
291
|
-
return new WebKitCSSMatrix(t);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
function kt(n) {
|
|
295
|
-
const t = { rotate: "0deg", scale: null, translate: null }, o = typeof n.computedStyleMap == "function" ? n.computedStyleMap() : null;
|
|
296
|
-
if (o) {
|
|
297
|
-
const m = (s) => {
|
|
298
|
-
try {
|
|
299
|
-
return typeof o.has == "function" && !o.has(s) || typeof o.get != "function" ? null : o.get(s);
|
|
300
|
-
} catch {
|
|
301
|
-
return null;
|
|
302
|
-
}
|
|
303
|
-
}, e = m("rotate");
|
|
304
|
-
if (e)
|
|
305
|
-
if (e.angle) {
|
|
306
|
-
const s = e.angle;
|
|
307
|
-
t.rotate = s.unit === "rad" ? s.value * 180 / Math.PI + "deg" : s.value + s.unit;
|
|
308
|
-
} else e.unit ? t.rotate = e.unit === "rad" ? e.value * 180 / Math.PI + "deg" : e.value + e.unit : t.rotate = String(e);
|
|
309
|
-
else {
|
|
310
|
-
const s = getComputedStyle(n);
|
|
311
|
-
t.rotate = s.rotate && s.rotate !== "none" ? s.rotate : "0deg";
|
|
312
|
-
}
|
|
313
|
-
const r = m("scale");
|
|
314
|
-
if (r) {
|
|
315
|
-
const s = "x" in r && r.x?.value != null ? r.x.value : Array.isArray(r) ? r[0]?.value : Number(r) || 1, c = "y" in r && r.y?.value != null ? r.y.value : Array.isArray(r) ? r[1]?.value : s;
|
|
316
|
-
t.scale = `${s} ${c}`;
|
|
317
|
-
} else {
|
|
318
|
-
const s = getComputedStyle(n);
|
|
319
|
-
t.scale = s.scale && s.scale !== "none" ? s.scale : null;
|
|
320
|
-
}
|
|
321
|
-
const l = m("translate");
|
|
322
|
-
if (l) {
|
|
323
|
-
const s = "x" in l && "value" in l.x ? l.x.value : Array.isArray(l) ? l[0]?.value : 0, c = "y" in l && "value" in l.y ? l.y.value : Array.isArray(l) ? l[1]?.value : 0, f = "x" in l && l.x?.unit ? l.x.unit : "px", h = "y" in l && l.y?.unit ? l.y.unit : "px";
|
|
324
|
-
t.translate = `${s}${f} ${c}${h}`;
|
|
325
|
-
} else {
|
|
326
|
-
const s = getComputedStyle(n);
|
|
327
|
-
t.translate = s.translate && s.translate !== "none" ? s.translate : null;
|
|
328
|
-
}
|
|
329
|
-
return t;
|
|
330
|
-
}
|
|
331
|
-
const i = getComputedStyle(n);
|
|
332
|
-
return t.rotate = i.rotate && i.rotate !== "none" ? i.rotate : "0deg", t.scale = i.scale && i.scale !== "none" ? i.scale : null, t.translate = i.translate && i.translate !== "none" ? i.translate : null, t;
|
|
333
|
-
}
|
|
334
|
-
function Lt(n) {
|
|
335
|
-
const t = getComputedStyle(n), o = t.transform || "none";
|
|
336
|
-
if (o !== "none" && !/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(o)) return !0;
|
|
337
|
-
const m = t.rotate && t.rotate !== "none" && t.rotate !== "0deg", e = t.scale && t.scale !== "none" && t.scale !== "1", r = t.translate && t.translate !== "none" && t.translate !== "0px 0px";
|
|
338
|
-
return !!(m || e || r);
|
|
339
|
-
}
|
|
340
|
-
function jt(n, t, o) {
|
|
341
|
-
const i = (n.transformOrigin || "0 0").trim().split(/\s+/), [m, e] = [i[0] || "0", i[1] || "0"], r = (l, s) => {
|
|
342
|
-
const c = l.toLowerCase();
|
|
343
|
-
return c === "left" || c === "top" ? 0 : c === "center" ? s / 2 : c === "right" || c === "bottom" ? s : c.endsWith("px") ? parseFloat(c) || 0 : c.endsWith("%") ? (parseFloat(c) || 0) * s / 100 : /^-?\d+(\.\d+)?$/.test(c) && parseFloat(c) || 0;
|
|
344
|
-
};
|
|
345
|
-
return {
|
|
346
|
-
ox: r(m, t),
|
|
347
|
-
oy: r(e, o)
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
var R = null;
|
|
351
|
-
function zt() {
|
|
352
|
-
if (R) return R;
|
|
353
|
-
const n = document.createElement("div");
|
|
354
|
-
return n.id = "snapdom-measure-slot", n.setAttribute("aria-hidden", "true"), Object.assign(n.style, {
|
|
355
|
-
position: "absolute",
|
|
356
|
-
left: "-99999px",
|
|
357
|
-
top: "0px",
|
|
358
|
-
width: "0px",
|
|
359
|
-
height: "0px",
|
|
360
|
-
overflow: "hidden",
|
|
361
|
-
opacity: "0",
|
|
362
|
-
pointerEvents: "none",
|
|
363
|
-
contain: "size layout style"
|
|
364
|
-
}), document.documentElement.appendChild(n), R = n, n;
|
|
160
|
+
}), await F("afterRender", e);
|
|
161
|
+
const D = document.getElementById("snapdom-sandbox");
|
|
162
|
+
return D && D.style.position === "absolute" && D.remove(), e.dataURL;
|
|
365
163
|
}
|
|
366
|
-
function
|
|
367
|
-
|
|
368
|
-
o.style.transformOrigin = "0 0", n.baseTransform && (o.style.transform = n.baseTransform), n.rotate && (o.style.rotate = n.rotate), n.scale && (o.style.scale = n.scale), n.translate && (o.style.translate = n.translate), t.appendChild(o);
|
|
369
|
-
const i = lt(o);
|
|
370
|
-
return t.removeChild(o), i;
|
|
164
|
+
function je(T) {
|
|
165
|
+
return Le(T);
|
|
371
166
|
}
|
|
372
167
|
export {
|
|
373
|
-
|
|
168
|
+
lt as captureDOM
|
|
374
169
|
};
|