@ds-mo/ui 2.10.0 → 2.10.1
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/dist/.build-stamp +1 -1
- package/dist/components/ds-app-shell.js +1 -1
- package/dist/components/ds-bar-nav.js +1 -1
- package/dist/components/ds-menu.js +1 -1
- package/dist/components/ds-select.js +1 -1
- package/dist/components/ds-shell-gradient-picker.js +1 -1
- package/dist/components/ds-shell-gradient-swatch.js +1 -1
- package/dist/components/{p-CDNVPM2x.js → p-BqOChY2z.js} +2 -2
- package/dist/components/p-Bz3jyrDV.js +2 -0
- package/dist/components/p-Bz3jyrDV.js.map +1 -0
- package/dist/components/{p-CKCBqwIw.js → p-DSTK6-QR.js} +2 -2
- package/dist/components/{p-DnGr8qtq.js → p-j_GdU4Aa.js} +2 -2
- package/dist/lib/components/Icon/icon-cache.d.ts +24 -0
- package/dist/lib/components/Menu/menu-placement.d.ts +23 -0
- package/dist/lib/components/Menu/menu-position.d.ts +19 -0
- package/dist/lib/nav/badge-gradient-ring.d.ts +27 -0
- package/dist/lib/nav/chrome-transition.d.ts +24 -0
- package/dist/lib/nav/index.d.ts +16 -0
- package/dist/lib/nav/index.js +419 -0
- package/dist/lib/nav/index.js.map +7 -0
- package/dist/lib/nav/nav-chrome.d.ts +9 -0
- package/dist/lib/nav/shell-chrome-metrics.d.ts +11 -0
- package/dist/lib/nav/shell-gradient-presets.d.ts +20 -0
- package/dist/lib/nav/shell-gradient.d.ts +43 -0
- package/dist/lib/nav/shell-view-transition.d.ts +23 -0
- package/dist/lib/utils/index.d.ts +7 -0
- package/dist/lib/utils/index.js +188 -0
- package/dist/lib/utils/index.js.map +7 -0
- package/dist/lib/utils/resolve-css-length-px.d.ts +7 -0
- package/dist/lib/utils/resolve-css-time-ms.d.ts +7 -0
- package/dist/lib/utils/scroll-edge-fade.d.ts +12 -0
- package/dist/lib/utils/token-defaults.d.ts +33 -0
- package/dist/types/nav/index.d.ts +1 -1
- package/dist/types/nav/shell-gradient-presets.d.ts +8 -0
- package/package.json +8 -7
- package/src/wc/nav/index.ts +1 -0
- package/src/wc/nav/shell-gradient-presets.ts +16 -2
- package/dist/components/p-0y48zKIF.js +0 -2
- package/dist/components/p-0y48zKIF.js.map +0 -1
- /package/dist/components/{p-CDNVPM2x.js.map → p-BqOChY2z.js.map} +0 -0
- /package/dist/components/{p-CKCBqwIw.js.map → p-DSTK6-QR.js.map} +0 -0
- /package/dist/components/{p-DnGr8qtq.js.map → p-j_GdU4Aa.js.map} +0 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
// src/wc/components/Icon/icon-cache.ts
|
|
2
|
+
var CACHE_KEY = /* @__PURE__ */ Symbol.for("ds-mo.icon-svg-cache");
|
|
3
|
+
function iconCacheKey(name, flag) {
|
|
4
|
+
return flag ? `flag:${name}` : `system:${name}`;
|
|
5
|
+
}
|
|
6
|
+
function iconCache() {
|
|
7
|
+
const g = globalThis;
|
|
8
|
+
return g[CACHE_KEY] ?? (g[CACHE_KEY] = /* @__PURE__ */ new Map());
|
|
9
|
+
}
|
|
10
|
+
function registerIcons(icons, options) {
|
|
11
|
+
const cache = iconCache();
|
|
12
|
+
const flag = options?.flag === true;
|
|
13
|
+
for (const [name, svg] of Object.entries(icons)) {
|
|
14
|
+
cache.set(iconCacheKey(name, flag), svg);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/wc/utils/resolve-css-length-px.ts
|
|
19
|
+
var lengthPxCache = /* @__PURE__ */ new Map();
|
|
20
|
+
var probeEl = null;
|
|
21
|
+
function getProbeElement() {
|
|
22
|
+
if (typeof document === "undefined") return null;
|
|
23
|
+
if (!probeEl) {
|
|
24
|
+
probeEl = document.createElement("div");
|
|
25
|
+
probeEl.setAttribute("aria-hidden", "true");
|
|
26
|
+
probeEl.style.cssText = "position:absolute;visibility:hidden;pointer-events:none;top:0;left:0;width:0;height:0;overflow:hidden;";
|
|
27
|
+
document.documentElement.appendChild(probeEl);
|
|
28
|
+
}
|
|
29
|
+
return probeEl;
|
|
30
|
+
}
|
|
31
|
+
function clearCssLengthPxCache() {
|
|
32
|
+
lengthPxCache.clear();
|
|
33
|
+
}
|
|
34
|
+
function resolveCssLengthPx(value, fallback) {
|
|
35
|
+
const resolved = value === void 0 || value === null || value === "" ? fallback : value;
|
|
36
|
+
if (typeof resolved === "number") return resolved;
|
|
37
|
+
const trimmed = resolved.trim();
|
|
38
|
+
if (!trimmed) return resolveCssLengthPx(fallback, 0);
|
|
39
|
+
const cached = lengthPxCache.get(trimmed);
|
|
40
|
+
if (cached !== void 0) return cached;
|
|
41
|
+
if (/^-?\d+(\.\d+)?$/.test(trimmed)) {
|
|
42
|
+
const n = Number(trimmed);
|
|
43
|
+
lengthPxCache.set(trimmed, n);
|
|
44
|
+
return n;
|
|
45
|
+
}
|
|
46
|
+
const pxMatch = trimmed.match(/^(-?\d+(\.\d+)?)px$/);
|
|
47
|
+
if (pxMatch) {
|
|
48
|
+
const px2 = parseFloat(pxMatch[1]);
|
|
49
|
+
lengthPxCache.set(trimmed, px2);
|
|
50
|
+
return px2;
|
|
51
|
+
}
|
|
52
|
+
const cssLength = /^--[\w-]+$/.test(trimmed) ? `var(${trimmed})` : trimmed;
|
|
53
|
+
const probe = getProbeElement();
|
|
54
|
+
if (!probe) {
|
|
55
|
+
return typeof fallback === "number" ? fallback : 0;
|
|
56
|
+
}
|
|
57
|
+
probe.style.width = cssLength;
|
|
58
|
+
const px = probe.getBoundingClientRect().width;
|
|
59
|
+
probe.style.width = "";
|
|
60
|
+
lengthPxCache.set(trimmed, px);
|
|
61
|
+
return px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/wc/utils/resolve-css-time-ms.ts
|
|
65
|
+
function parseCssTimeMs(value, fallback) {
|
|
66
|
+
const firstToken = value.trim().split(/\s+/)[0] ?? "";
|
|
67
|
+
const num = parseFloat(firstToken);
|
|
68
|
+
if (Number.isNaN(num)) return fallback;
|
|
69
|
+
if (/ms\s*$/.test(firstToken)) return num;
|
|
70
|
+
if (/s\s*$/.test(firstToken)) return num * 1e3;
|
|
71
|
+
return num;
|
|
72
|
+
}
|
|
73
|
+
function extractCssCustomProp(ref) {
|
|
74
|
+
const varMatch = ref.match(/^var\(\s*(--[^),]+)/);
|
|
75
|
+
if (varMatch) return varMatch[1].trim();
|
|
76
|
+
if (ref.startsWith("--")) return ref.trim();
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
function readTokenTimeMs(token, fallback) {
|
|
80
|
+
if (typeof document === "undefined") return fallback;
|
|
81
|
+
const prop = extractCssCustomProp(token);
|
|
82
|
+
if (!prop) return parseCssTimeMs(token, fallback);
|
|
83
|
+
const raw = getComputedStyle(document.documentElement).getPropertyValue(prop).trim();
|
|
84
|
+
return parseCssTimeMs(raw, fallback);
|
|
85
|
+
}
|
|
86
|
+
function resolveCssTimeMs(value, fallbackToken) {
|
|
87
|
+
if (typeof value === "number") return value;
|
|
88
|
+
const token = typeof value === "string" && value.trim() ? value.trim() : fallbackToken;
|
|
89
|
+
const prop = extractCssCustomProp(token);
|
|
90
|
+
if (prop) {
|
|
91
|
+
return readTokenTimeMs(token, readTokenTimeMs(fallbackToken, 200));
|
|
92
|
+
}
|
|
93
|
+
return parseCssTimeMs(token, readTokenTimeMs(fallbackToken, 200));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// src/wc/utils/scroll-edge-fade.ts
|
|
97
|
+
var SCROLL_EDGE_FADE_SIZE_VAR = "--ds-scroll-edge-fade-size";
|
|
98
|
+
var SCROLL_EDGE_FADE_DEFAULT_SIZE = "var(--dimension-size-600)";
|
|
99
|
+
var SIZE_REF = `var(${SCROLL_EDGE_FADE_SIZE_VAR}, ${SCROLL_EDGE_FADE_DEFAULT_SIZE})`;
|
|
100
|
+
function scrollEdgeFadeMaskImage(edge) {
|
|
101
|
+
switch (edge) {
|
|
102
|
+
case "top":
|
|
103
|
+
return `linear-gradient(to bottom, #000 0, #000 50%, transparent 100%)`;
|
|
104
|
+
case "bottom":
|
|
105
|
+
return `linear-gradient(to bottom, #000 0, #000 calc(100% - ${SIZE_REF}), transparent 100%)`;
|
|
106
|
+
case "left":
|
|
107
|
+
return `linear-gradient(to right, #000 0, #000 calc(100% - ${SIZE_REF}), transparent 100%)`;
|
|
108
|
+
case "right":
|
|
109
|
+
return `linear-gradient(to left, #000 0, #000 calc(100% - ${SIZE_REF}), transparent 100%)`;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function scrollEdgeFadeMaskStyle(edge) {
|
|
113
|
+
const mask = scrollEdgeFadeMaskImage(edge);
|
|
114
|
+
return {
|
|
115
|
+
[SCROLL_EDGE_FADE_SIZE_VAR]: SCROLL_EDGE_FADE_DEFAULT_SIZE,
|
|
116
|
+
WebkitMaskImage: mask,
|
|
117
|
+
maskImage: mask,
|
|
118
|
+
WebkitMaskSize: "100% 100%",
|
|
119
|
+
maskSize: "100% 100%"
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// src/wc/utils/token-defaults.ts
|
|
124
|
+
import {
|
|
125
|
+
dimensionIconographyMd,
|
|
126
|
+
dimensionIconographySm,
|
|
127
|
+
dimensionIconographyXs,
|
|
128
|
+
dimensionMenuWidthXs,
|
|
129
|
+
dimensionPanelWidth2xs,
|
|
130
|
+
dimensionPanelWidthLg,
|
|
131
|
+
dimensionPanelWidthMd,
|
|
132
|
+
dimensionSize300,
|
|
133
|
+
dimensionSize600,
|
|
134
|
+
dimensionSize800,
|
|
135
|
+
dimensionSpace050,
|
|
136
|
+
dimensionSpace200,
|
|
137
|
+
effectAnimationDelayLong2,
|
|
138
|
+
effectAnimationDelayMedium1,
|
|
139
|
+
effectAnimationDelayShort2,
|
|
140
|
+
effectAnimationDurationMedium1,
|
|
141
|
+
effectAnimationDurationShort3,
|
|
142
|
+
effectMotionShort2,
|
|
143
|
+
effectMotionShort3
|
|
144
|
+
} from "@ds-mo/tokens/ts";
|
|
145
|
+
var TOKEN_DEFAULTS = {
|
|
146
|
+
space050: dimensionSpace050,
|
|
147
|
+
space200: dimensionSpace200,
|
|
148
|
+
size300: dimensionSize300,
|
|
149
|
+
size600: dimensionSize600,
|
|
150
|
+
size800: dimensionSize800,
|
|
151
|
+
iconographyMd: dimensionIconographyMd,
|
|
152
|
+
iconographySm: dimensionIconographySm,
|
|
153
|
+
iconographyXs: dimensionIconographyXs,
|
|
154
|
+
panelWidth2xs: dimensionPanelWidth2xs,
|
|
155
|
+
panelWidthMd: dimensionPanelWidthMd,
|
|
156
|
+
panelWidthLg: dimensionPanelWidthLg,
|
|
157
|
+
menuWidthXs: dimensionMenuWidthXs,
|
|
158
|
+
motionShort2: effectMotionShort2,
|
|
159
|
+
motionShort3: effectMotionShort3,
|
|
160
|
+
animationDurationShort3: effectAnimationDurationShort3,
|
|
161
|
+
animationDurationMedium1: effectAnimationDurationMedium1,
|
|
162
|
+
animationDelayMedium1: effectAnimationDelayMedium1,
|
|
163
|
+
animationDelayShort2: effectAnimationDelayShort2,
|
|
164
|
+
animationDelayLong2: effectAnimationDelayLong2,
|
|
165
|
+
/** Unmeasured menu height fallback: 20× base (160px at default scale). */
|
|
166
|
+
menuFallbackHeight: "calc(var(--dimension-size-base) * 20)",
|
|
167
|
+
/** Unmeasured tooltip width fallback: size-800 + size-200 (80px). */
|
|
168
|
+
tooltipFallbackWidth: "calc(var(--dimension-size-800) + var(--dimension-size-200))"
|
|
169
|
+
};
|
|
170
|
+
var TOKEN_CSS_LENGTHS = {
|
|
171
|
+
space050: `var(${dimensionSpace050})`,
|
|
172
|
+
space200: `var(${dimensionSpace200})`,
|
|
173
|
+
menuWidthXs: `var(${dimensionMenuWidthXs})`
|
|
174
|
+
};
|
|
175
|
+
export {
|
|
176
|
+
SCROLL_EDGE_FADE_DEFAULT_SIZE,
|
|
177
|
+
SCROLL_EDGE_FADE_SIZE_VAR,
|
|
178
|
+
TOKEN_CSS_LENGTHS,
|
|
179
|
+
TOKEN_DEFAULTS,
|
|
180
|
+
clearCssLengthPxCache,
|
|
181
|
+
parseCssTimeMs,
|
|
182
|
+
registerIcons,
|
|
183
|
+
resolveCssLengthPx,
|
|
184
|
+
resolveCssTimeMs,
|
|
185
|
+
scrollEdgeFadeMaskImage,
|
|
186
|
+
scrollEdgeFadeMaskStyle
|
|
187
|
+
};
|
|
188
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/wc/components/Icon/icon-cache.ts", "../../../src/wc/utils/resolve-css-length-px.ts", "../../../src/wc/utils/resolve-css-time-ms.ts", "../../../src/wc/utils/scroll-edge-fade.ts", "../../../src/wc/utils/token-defaults.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Shared SVG glyph cache for ds-icon.\n *\n * Keyed on a global symbol so every module instance (the compiled Stencil chunk\n * inside dist/components and any direct source import, e.g. via `@ds-mo/ui/utils`)\n * reads and writes the same cache. Without this, `registerIcons` called from an\n * app would fill a different Map than the one ds-icon resolves from.\n */\nconst CACHE_KEY = Symbol.for('ds-mo.icon-svg-cache');\n\ntype IconCacheMap = Map<string, string>;\n\ntype GlobalWithIconCache = { [CACHE_KEY]?: IconCacheMap };\n\nexport function iconCacheKey(name: string, flag: boolean): string {\n return flag ? `flag:${name}` : `system:${name}`;\n}\n\nexport function iconCache(): IconCacheMap {\n const g = globalThis as GlobalWithIconCache;\n return (g[CACHE_KEY] ??= new Map());\n}\n\n/**\n * Pre-register glyphs so ds-icon renders them synchronously \u2014 no lazy-chunk\n * fetch, no first-paint pop-in. Import the SVG strings from `@ds-mo/icons`\n * in the app (statically, so they ship in the app's own bundle):\n *\n * ```ts\n * import { Bell } from '@ds-mo/icons/svg/Bell';\n * import { US } from '@ds-mo/icons/svg/flags/US';\n * import { registerIcons } from '@ds-mo/ui/utils';\n *\n * registerIcons({ Bell });\n * registerIcons({ US }, { flag: true });\n * ```\n *\n * Icons that are not registered still work \u2014 they lazy-load on first render\n * and stay cached afterwards.\n */\nexport function registerIcons(icons: Record<string, string>, options?: { flag?: boolean }): void {\n const cache = iconCache();\n const flag = options?.flag === true;\n for (const [name, svg] of Object.entries(icons)) {\n cache.set(iconCacheKey(name, flag), svg);\n }\n}\n", "const lengthPxCache = new Map<string, number>();\n\nlet probeEl: HTMLElement | null = null;\n\nfunction getProbeElement(): HTMLElement | null {\n if (typeof document === 'undefined') return null;\n\n if (!probeEl) {\n probeEl = document.createElement('div');\n probeEl.setAttribute('aria-hidden', 'true');\n probeEl.style.cssText =\n 'position:absolute;visibility:hidden;pointer-events:none;top:0;left:0;width:0;height:0;overflow:hidden;';\n document.documentElement.appendChild(probeEl);\n }\n\n return probeEl;\n}\n\n/** Clear session cache (tests only). */\nexport function clearCssLengthPxCache(): void {\n lengthPxCache.clear();\n}\n\n/**\n * Resolve a CSS length to pixels for layout math.\n * Numbers pass through; `var(--dimension-*)`, `calc(...)`, and `16px` resolve via a hidden probe.\n */\nexport function resolveCssLengthPx(\n value: number | string | undefined,\n fallback: number | string,\n): number {\n const resolved = value === undefined || value === null || value === '' ? fallback : value;\n if (typeof resolved === 'number') return resolved;\n\n const trimmed = resolved.trim();\n if (!trimmed) return resolveCssLengthPx(fallback, 0);\n\n const cached = lengthPxCache.get(trimmed);\n if (cached !== undefined) return cached;\n\n if (/^-?\\d+(\\.\\d+)?$/.test(trimmed)) {\n const n = Number(trimmed);\n lengthPxCache.set(trimmed, n);\n return n;\n }\n\n const pxMatch = trimmed.match(/^(-?\\d+(\\.\\d+)?)px$/);\n if (pxMatch) {\n const px = parseFloat(pxMatch[1]);\n lengthPxCache.set(trimmed, px);\n return px;\n }\n\n const cssLength = /^--[\\w-]+$/.test(trimmed) ? `var(${trimmed})` : trimmed;\n\n const probe = getProbeElement();\n if (!probe) {\n return typeof fallback === 'number' ? fallback : 0;\n }\n\n probe.style.width = cssLength;\n const px = probe.getBoundingClientRect().width;\n probe.style.width = '';\n lengthPxCache.set(trimmed, px);\n return px;\n}\n", "/** Parse a CSS <time> value (or motion shorthand's first token) to milliseconds. */\nexport function parseCssTimeMs(value: string, fallback: number): number {\n const firstToken = value.trim().split(/\\s+/)[0] ?? '';\n const num = parseFloat(firstToken);\n if (Number.isNaN(num)) return fallback;\n if (/ms\\s*$/.test(firstToken)) return num;\n if (/s\\s*$/.test(firstToken)) return num * 1000;\n return num;\n}\n\nfunction extractCssCustomProp(ref: string): string | null {\n const varMatch = ref.match(/^var\\(\\s*(--[^),]+)/);\n if (varMatch) return varMatch[1].trim();\n if (ref.startsWith('--')) return ref.trim();\n return null;\n}\n\nfunction readTokenTimeMs(token: string, fallback: number): number {\n if (typeof document === 'undefined') return fallback;\n\n const prop = extractCssCustomProp(token);\n if (!prop) return parseCssTimeMs(token, fallback);\n\n const raw = getComputedStyle(document.documentElement).getPropertyValue(prop).trim();\n return parseCssTimeMs(raw, fallback);\n}\n\n/**\n * Resolve a duration to milliseconds for JS timers aligned with CSS motion tokens.\n * Accepts numbers (ms), raw times (`200ms`, `0.75s`), or `var(--effect-*)` references.\n */\nexport function resolveCssTimeMs(\n value: number | string | undefined,\n fallbackToken: string,\n): number {\n if (typeof value === 'number') return value;\n\n const token = typeof value === 'string' && value.trim() ? value.trim() : fallbackToken;\n const prop = extractCssCustomProp(token);\n\n if (prop) {\n return readTokenTimeMs(token, readTokenTimeMs(fallbackToken, 200));\n }\n\n return parseCssTimeMs(token, readTokenTimeMs(fallbackToken, 200));\n}\n", "/** CSS custom property for scroll-edge fade depth (dimension token or length). */\nexport const SCROLL_EDGE_FADE_SIZE_VAR = '--ds-scroll-edge-fade-size';\n\nexport const SCROLL_EDGE_FADE_DEFAULT_SIZE = 'var(--dimension-size-600)';\n\nexport type ScrollEdgeFadeEdge = 'top' | 'bottom' | 'left' | 'right';\n\nconst SIZE_REF = `var(${SCROLL_EDGE_FADE_SIZE_VAR}, ${SCROLL_EDGE_FADE_DEFAULT_SIZE})`;\n\n/**\n * Alpha mask for a scroll container edge \u2014 content fades to transparent so\n * textured backgrounds (gradients, images) show through. Prefer over painted\n * `ds-fade` overlays on non-flat surfaces.\n */\nexport function scrollEdgeFadeMaskImage(edge: ScrollEdgeFadeEdge): string {\n switch (edge) {\n case 'top':\n return `linear-gradient(to bottom, #000 0, #000 50%, transparent 100%)`;\n case 'bottom':\n return `linear-gradient(to bottom, #000 0, #000 calc(100% - ${SIZE_REF}), transparent 100%)`;\n case 'left':\n return `linear-gradient(to right, #000 0, #000 calc(100% - ${SIZE_REF}), transparent 100%)`;\n case 'right':\n return `linear-gradient(to left, #000 0, #000 calc(100% - ${SIZE_REF}), transparent 100%)`;\n }\n}\n\n/** Inline style map for a masked scroll region. */\nexport function scrollEdgeFadeMaskStyle(edge: ScrollEdgeFadeEdge): Record<string, string> {\n const mask = scrollEdgeFadeMaskImage(edge);\n return {\n [SCROLL_EDGE_FADE_SIZE_VAR]: SCROLL_EDGE_FADE_DEFAULT_SIZE,\n WebkitMaskImage: mask,\n maskImage: mask,\n WebkitMaskSize: '100% 100%',\n maskSize: '100% 100%',\n };\n}\n", "import {\n dimensionIconographyMd,\n dimensionIconographySm,\n dimensionIconographyXs,\n dimensionMenuWidthXs,\n dimensionPanelWidth2xs,\n dimensionPanelWidthLg,\n dimensionPanelWidthMd,\n dimensionSize300,\n dimensionSize600,\n dimensionSize800,\n dimensionSpace050,\n dimensionSpace200,\n effectAnimationDelayLong2,\n effectAnimationDelayMedium1,\n effectAnimationDelayShort2,\n effectAnimationDurationMedium1,\n effectAnimationDurationShort3,\n effectMotionShort2,\n effectMotionShort3,\n} from '@ds-mo/tokens/ts';\n\n/** TokoMo CSS custom-property names for shared component defaults (runtime resolution). */\nexport const TOKEN_DEFAULTS = {\n space050: dimensionSpace050,\n space200: dimensionSpace200,\n size300: dimensionSize300,\n size600: dimensionSize600,\n size800: dimensionSize800,\n iconographyMd: dimensionIconographyMd,\n iconographySm: dimensionIconographySm,\n iconographyXs: dimensionIconographyXs,\n panelWidth2xs: dimensionPanelWidth2xs,\n panelWidthMd: dimensionPanelWidthMd,\n panelWidthLg: dimensionPanelWidthLg,\n menuWidthXs: dimensionMenuWidthXs,\n motionShort2: effectMotionShort2,\n motionShort3: effectMotionShort3,\n animationDurationShort3: effectAnimationDurationShort3,\n animationDurationMedium1: effectAnimationDurationMedium1,\n animationDelayMedium1: effectAnimationDelayMedium1,\n animationDelayShort2: effectAnimationDelayShort2,\n animationDelayLong2: effectAnimationDelayLong2,\n /** Unmeasured menu height fallback: 20\u00D7 base (160px at default scale). */\n menuFallbackHeight: 'calc(var(--dimension-size-base) * 20)',\n /** Unmeasured tooltip width fallback: size-800 + size-200 (80px). */\n tooltipFallbackWidth: 'calc(var(--dimension-size-800) + var(--dimension-size-200))',\n} as const;\n\nexport type TokenDefaultKey = keyof typeof TOKEN_DEFAULTS;\n\n/** Valid CSS length strings for overlay offset props \u2014 bind on `sideOffset` / `alignOffset` in hosts. */\nexport const TOKEN_CSS_LENGTHS = {\n space050: `var(${dimensionSpace050})`,\n space200: `var(${dimensionSpace200})`,\n menuWidthXs: `var(${dimensionMenuWidthXs})`,\n} as const;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["px"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Clear session cache (tests only). */
|
|
2
|
+
export declare function clearCssLengthPxCache(): void;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a CSS length to pixels for layout math.
|
|
5
|
+
* Numbers pass through; `var(--dimension-*)`, `calc(...)`, and `16px` resolve via a hidden probe.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveCssLengthPx(value: number | string | undefined, fallback: number | string): number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Parse a CSS <time> value (or motion shorthand's first token) to milliseconds. */
|
|
2
|
+
export declare function parseCssTimeMs(value: string, fallback: number): number;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a duration to milliseconds for JS timers aligned with CSS motion tokens.
|
|
5
|
+
* Accepts numbers (ms), raw times (`200ms`, `0.75s`), or `var(--effect-*)` references.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveCssTimeMs(value: number | string | undefined, fallbackToken: string): number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** CSS custom property for scroll-edge fade depth (dimension token or length). */
|
|
2
|
+
export declare const SCROLL_EDGE_FADE_SIZE_VAR = "--ds-scroll-edge-fade-size";
|
|
3
|
+
export declare const SCROLL_EDGE_FADE_DEFAULT_SIZE = "var(--dimension-size-600)";
|
|
4
|
+
export type ScrollEdgeFadeEdge = 'top' | 'bottom' | 'left' | 'right';
|
|
5
|
+
/**
|
|
6
|
+
* Alpha mask for a scroll container edge — content fades to transparent so
|
|
7
|
+
* textured backgrounds (gradients, images) show through. Prefer over painted
|
|
8
|
+
* `ds-fade` overlays on non-flat surfaces.
|
|
9
|
+
*/
|
|
10
|
+
export declare function scrollEdgeFadeMaskImage(edge: ScrollEdgeFadeEdge): string;
|
|
11
|
+
/** Inline style map for a masked scroll region. */
|
|
12
|
+
export declare function scrollEdgeFadeMaskStyle(edge: ScrollEdgeFadeEdge): Record<string, string>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** TokoMo CSS custom-property names for shared component defaults (runtime resolution). */
|
|
2
|
+
export declare const TOKEN_DEFAULTS: {
|
|
3
|
+
readonly space050: "--dimension-space-050";
|
|
4
|
+
readonly space200: "--dimension-space-200";
|
|
5
|
+
readonly size300: "--dimension-size-300";
|
|
6
|
+
readonly size600: "--dimension-size-600";
|
|
7
|
+
readonly size800: "--dimension-size-800";
|
|
8
|
+
readonly iconographyMd: "--dimension-iconography-md";
|
|
9
|
+
readonly iconographySm: "--dimension-iconography-sm";
|
|
10
|
+
readonly iconographyXs: "--dimension-iconography-xs";
|
|
11
|
+
readonly panelWidth2xs: "--dimension-panel-width-2xs";
|
|
12
|
+
readonly panelWidthMd: "--dimension-panel-width-md";
|
|
13
|
+
readonly panelWidthLg: "--dimension-panel-width-lg";
|
|
14
|
+
readonly menuWidthXs: "--dimension-menu-width-xs";
|
|
15
|
+
readonly motionShort2: "--effect-motion-short-2";
|
|
16
|
+
readonly motionShort3: "--effect-motion-short-3";
|
|
17
|
+
readonly animationDurationShort3: "--effect-animation-duration-short-3";
|
|
18
|
+
readonly animationDurationMedium1: "--effect-animation-duration-medium-1";
|
|
19
|
+
readonly animationDelayMedium1: "--effect-animation-delay-medium-1";
|
|
20
|
+
readonly animationDelayShort2: "--effect-animation-delay-short-2";
|
|
21
|
+
readonly animationDelayLong2: "--effect-animation-delay-long-2";
|
|
22
|
+
/** Unmeasured menu height fallback: 20× base (160px at default scale). */
|
|
23
|
+
readonly menuFallbackHeight: "calc(var(--dimension-size-base) * 20)";
|
|
24
|
+
/** Unmeasured tooltip width fallback: size-800 + size-200 (80px). */
|
|
25
|
+
readonly tooltipFallbackWidth: "calc(var(--dimension-size-800) + var(--dimension-size-200))";
|
|
26
|
+
};
|
|
27
|
+
export type TokenDefaultKey = keyof typeof TOKEN_DEFAULTS;
|
|
28
|
+
/** Valid CSS length strings for overlay offset props — bind on `sideOffset` / `alignOffset` in hosts. */
|
|
29
|
+
export declare const TOKEN_CSS_LENGTHS: {
|
|
30
|
+
readonly space050: "var(--dimension-space-050)";
|
|
31
|
+
readonly space200: "var(--dimension-space-200)";
|
|
32
|
+
readonly menuWidthXs: "var(--dimension-menu-width-xs)";
|
|
33
|
+
};
|
|
@@ -7,7 +7,7 @@ export type { ShellGradientLayout, ShellViewportDimensions } from './shell-gradi
|
|
|
7
7
|
export type { MenuPlacement } from '../components/Menu/menu-placement';
|
|
8
8
|
export { PANEL_NAV_USER_MENU_PLACEMENT, } from '../components/Menu/menu-placement';
|
|
9
9
|
export type { ShellGradientPreset } from './shell-gradient-presets';
|
|
10
|
-
export { DEFAULT_SHELL_GRADIENT_PRESET, SHELL_GRADIENT_PRESETS, SHELL_GRADIENT_PRESET_LABELS, buildShellRadialGradientForPreset, isShellGradientPreset, shellGradientPresetStopToken, } from './shell-gradient-presets';
|
|
10
|
+
export { DEFAULT_SHELL_GRADIENT_PRESET, SHELL_GRADIENT_PRESETS, SHELL_GRADIENT_PRESET_LABELS, buildShellRadialGradientForPreset, isShellGradientPreset, normalizeShellGradientPreset, shellGradientPresetStopToken, } from './shell-gradient-presets';
|
|
11
11
|
export type { ChromeTransitionDetail, ChromeTransitionSource } from './chrome-transition';
|
|
12
12
|
export { CHROME_TRANSITION_END, CHROME_TRANSITION_START, ChromeTransitionDepth, createRafCoalescer, readChromeTransitionSource, readChromeTransitionPhase, } from './chrome-transition';
|
|
13
13
|
export { barGradientPositionFromPanelWidth, isPanelNavCollapsed, panelWidthPxFromTokens, readCssVarWidthPx, readPanelNavWidthTokens, } from './shell-chrome-metrics';
|
|
@@ -8,6 +8,14 @@ export declare const DEFAULT_SHELL_GRADIENT_PRESET: ShellGradientPreset;
|
|
|
8
8
|
export declare const SHELL_GRADIENT_PRESET_LABELS: Record<ShellGradientPreset, string>;
|
|
9
9
|
export declare function shellGradientPresetStopToken(preset: ShellGradientPreset): string | null;
|
|
10
10
|
export declare function isShellGradientPreset(value: string): value is ShellGradientPreset;
|
|
11
|
+
/**
|
|
12
|
+
* Coerce unknown/absent presets to the default. Runtime values escape the
|
|
13
|
+
* type: removing the reflected `gradient-preset` attribute (e.g. an Angular
|
|
14
|
+
* `[attr.gradient-preset]="null"` binding) drives the prop to null past its
|
|
15
|
+
* field default — without normalization the stop lookup interpolates the
|
|
16
|
+
* literal string "undefined" into CSS and the wash silently disappears.
|
|
17
|
+
*/
|
|
18
|
+
export declare function normalizeShellGradientPreset(value: string | null | undefined): ShellGradientPreset;
|
|
11
19
|
/** Radial wash for a preset — transparent at top-left into the intent stop. `none` returns no image. */
|
|
12
20
|
export declare function buildShellRadialGradientForPreset(preset: ShellGradientPreset): string;
|
|
13
21
|
//# sourceMappingURL=shell-gradient-presets.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ds-mo/ui",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.1",
|
|
4
4
|
"description": "CompoMo — composable web components styled with TokoMo design tokens",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"import": "./dist/components/index.js"
|
|
43
43
|
},
|
|
44
44
|
"./nav": {
|
|
45
|
-
"types": "./
|
|
46
|
-
"import": "./
|
|
45
|
+
"types": "./dist/lib/nav/index.d.ts",
|
|
46
|
+
"import": "./dist/lib/nav/index.js"
|
|
47
47
|
},
|
|
48
48
|
"./utils": {
|
|
49
|
-
"types": "./
|
|
50
|
-
"import": "./
|
|
49
|
+
"types": "./dist/lib/utils/index.d.ts",
|
|
50
|
+
"import": "./dist/lib/utils/index.js"
|
|
51
51
|
},
|
|
52
52
|
"./dist/components/*": "./dist/components/*"
|
|
53
53
|
},
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"prebuild": "node scripts/generate-icon-catalog.mjs",
|
|
68
68
|
"pretypecheck": "node scripts/generate-icon-catalog.mjs",
|
|
69
69
|
"pretest": "node scripts/generate-icon-catalog.mjs",
|
|
70
|
-
"build": "stencil build && node scripts/patch-index-types.mjs && node scripts/patch-components-d-exports.mjs && node scripts/verify-icons-externalized.mjs && node scripts/write-build-stamp.mjs",
|
|
70
|
+
"build": "stencil build && node scripts/patch-index-types.mjs && node scripts/patch-components-d-exports.mjs && node scripts/verify-icons-externalized.mjs && node scripts/write-build-stamp.mjs && node scripts/build-lib-exports.mjs",
|
|
71
71
|
"verify:pack": "node scripts/verify-npm-pack.mjs && node scripts/verify-nav-import.mjs",
|
|
72
72
|
"test": "node --import tsx/esm --test tests/panel-nav-utils.test.ts tests/panel-tools.test.ts tests/shell-shortcuts.test.ts tests/shell-gradient-presets.test.ts tests/shell-view-transition.test.ts tests/shell-gradient.test.ts tests/shell-chrome-metrics.test.ts tests/shell-chrome-layer.test.ts tests/chrome-transition.test.ts tests/bar-nav-overflow-hysteresis.test.ts tests/badge-gradient-ring.test.ts tests/scroll-edge-fade.test.ts tests/resolve-css-length-px.test.ts tests/resolve-css-time-ms.test.ts tests/overlay-positioning.test.ts tests/menu-position.test.ts tests/menu-placement.test.ts tests/bar-nav-utils.test.ts tests/bar-nav-tabs-menu-utils.test.ts tests/bar-nav-dom-utils.test.ts tests/icon-catalog.test.ts tests/icon-cache.test.ts tests/icon-svg.test.ts",
|
|
73
73
|
"test:e2e": "npm run build && playwright test",
|
|
@@ -130,7 +130,8 @@
|
|
|
130
130
|
"typescript": "~6.0.3",
|
|
131
131
|
"typescript-eslint": "^8.59.1",
|
|
132
132
|
"vite": "^8.0.16",
|
|
133
|
-
"zod": "^4.4.3"
|
|
133
|
+
"zod": "^4.4.3",
|
|
134
|
+
"esbuild": "^0.28.0"
|
|
134
135
|
},
|
|
135
136
|
"engines": {
|
|
136
137
|
"node": "^20.19.0 || >=22.12.0"
|
package/src/wc/nav/index.ts
CHANGED
|
@@ -48,6 +48,7 @@ export {
|
|
|
48
48
|
SHELL_GRADIENT_PRESET_LABELS,
|
|
49
49
|
buildShellRadialGradientForPreset,
|
|
50
50
|
isShellGradientPreset,
|
|
51
|
+
normalizeShellGradientPreset,
|
|
51
52
|
shellGradientPresetStopToken,
|
|
52
53
|
} from './shell-gradient-presets';
|
|
53
54
|
export type { ChromeTransitionDetail, ChromeTransitionSource } from './chrome-transition';
|
|
@@ -37,10 +37,24 @@ export function isShellGradientPreset(value: string): value is ShellGradientPres
|
|
|
37
37
|
return (SHELL_GRADIENT_PRESETS as string[]).includes(value);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Coerce unknown/absent presets to the default. Runtime values escape the
|
|
42
|
+
* type: removing the reflected `gradient-preset` attribute (e.g. an Angular
|
|
43
|
+
* `[attr.gradient-preset]="null"` binding) drives the prop to null past its
|
|
44
|
+
* field default — without normalization the stop lookup interpolates the
|
|
45
|
+
* literal string "undefined" into CSS and the wash silently disappears.
|
|
46
|
+
*/
|
|
47
|
+
export function normalizeShellGradientPreset(
|
|
48
|
+
value: string | null | undefined,
|
|
49
|
+
): ShellGradientPreset {
|
|
50
|
+
return value != null && isShellGradientPreset(value) ? value : DEFAULT_SHELL_GRADIENT_PRESET;
|
|
51
|
+
}
|
|
52
|
+
|
|
40
53
|
/** Radial wash for a preset — transparent at top-left into the intent stop. `none` returns no image. */
|
|
41
54
|
export function buildShellRadialGradientForPreset(preset: ShellGradientPreset): string {
|
|
42
|
-
|
|
55
|
+
const normalized = normalizeShellGradientPreset(preset);
|
|
56
|
+
if (normalized === 'none') return 'none';
|
|
43
57
|
|
|
44
|
-
const stop = shellGradientPresetStopToken(
|
|
58
|
+
const stop = shellGradientPresetStopToken(normalized);
|
|
45
59
|
return `radial-gradient(${GRADIENT_GEOMETRY}, var(--color-background-transparent) 0%, ${stop} 100%)`;
|
|
46
60
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const n=["cool","neutral","warm"];const t="neutral";const o={none:"None",cool:"Cool",neutral:"Neutral",warm:"Warm"};const r={cool:"var(--color-color-intent-blue-strong-background)",neutral:"var(--color-color-intent-grey-strong-background)",warm:"var(--color-color-intent-yellow-strong-background)"};const a="100% 100% at 0% 0%";function e(n){if(n==="none")return null;return r[n]}function s(n){if(n==="none")return"none";const t=e(n);return`radial-gradient(${a}, var(--color-background-transparent) 0%, ${t} 100%)`}const c="--ds-shell-gradient-image";const l="--ds-shell-gradient-size";const i="--ds-shell-gradient-position-panel";const u="--ds-shell-gradient-position-bar";const d="--ds-shell-gradient-opacity";const g="0.1";function h(n=t){return s(n)}function f(n){const t=typeof globalThis.window!=="undefined"?globalThis.window:undefined;if(!t)return{width:0,height:0};const o=t.visualViewport;return{width:Math.round(o?.width??t.innerWidth),height:Math.round(o?.height??t.innerHeight)}}function p(n){return`${Math.round(n.width)}px ${Math.round(n.height)}px`}function b(){return"0 0"}function w(n){return`${-Math.round(n)}px 0`}export{t as D,n as S,o as a,g as b,s as c,c as d,l as e,d as f,i as g,u as h,w as i,h as j,p as k,f as r,b as s};
|
|
2
|
-
//# sourceMappingURL=p-0y48zKIF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["SHELL_GRADIENT_WASH_PRESETS","DEFAULT_SHELL_GRADIENT_PRESET","SHELL_GRADIENT_PRESET_LABELS","none","cool","neutral","warm","SHELL_GRADIENT_PRESET_STOP","GRADIENT_GEOMETRY","shellGradientPresetStopToken","preset","buildShellRadialGradientForPreset","stop","SHELL_GRADIENT_IMAGE_VAR","SHELL_GRADIENT_SIZE_VAR","SHELL_GRADIENT_POSITION_PANEL_VAR","SHELL_GRADIENT_POSITION_BAR_VAR","SHELL_GRADIENT_OPACITY_VAR","SHELL_GRADIENT_OPACITY","buildShellRadialGradient","readShellViewportDimensions","win","w","globalThis","window","undefined","width","height","visual","visualViewport","Math","round","innerWidth","innerHeight","shellGradientSize","layout","shellGradientPositionPanel","shellGradientPositionBar","panelWidth"],"sources":["src/wc/nav/shell-gradient-presets.ts","src/wc/nav/shell-gradient.ts"],"sourcesContent":["/** Built-in shell chrome wash presets — none (solid secondary), cool, neutral, warm. */\nexport type ShellGradientPreset = 'none' | 'cool' | 'neutral' | 'warm';\n\nexport const SHELL_GRADIENT_PRESETS: ShellGradientPreset[] = ['none', 'cool', 'neutral', 'warm'];\n\n/** Wash presets shown after the `none` option in pickers. */\nexport const SHELL_GRADIENT_WASH_PRESETS: Exclude<ShellGradientPreset, 'none'>[] = [\n 'cool',\n 'neutral',\n 'warm',\n];\n\n/** Default wash when `gradient-preset` is omitted. */\nexport const DEFAULT_SHELL_GRADIENT_PRESET: ShellGradientPreset = 'neutral';\n\nexport const SHELL_GRADIENT_PRESET_LABELS: Record<ShellGradientPreset, string> = {\n none: 'None',\n cool: 'Cool',\n neutral: 'Neutral',\n warm: 'Warm',\n};\n\nconst SHELL_GRADIENT_PRESET_STOP: Record<Exclude<ShellGradientPreset, 'none'>, string> = {\n cool: 'var(--color-color-intent-blue-strong-background)',\n neutral: 'var(--color-color-intent-grey-strong-background)',\n warm: 'var(--color-color-intent-yellow-strong-background)',\n};\n\nconst GRADIENT_GEOMETRY = '100% 100% at 0% 0%';\n\nexport function shellGradientPresetStopToken(preset: ShellGradientPreset): string | null {\n if (preset === 'none') return null;\n return SHELL_GRADIENT_PRESET_STOP[preset];\n}\n\nexport function isShellGradientPreset(value: string): value is ShellGradientPreset {\n return (SHELL_GRADIENT_PRESETS as string[]).includes(value);\n}\n\n/** Radial wash for a preset — transparent at top-left into the intent stop. `none` returns no image. */\nexport function buildShellRadialGradientForPreset(preset: ShellGradientPreset): string {\n if (preset === 'none') return 'none';\n\n const stop = shellGradientPresetStopToken(preset);\n return `radial-gradient(${GRADIENT_GEOMETRY}, var(--color-background-transparent) 0%, ${stop} 100%)`;\n}\n","/** CSS var names consumed by `ds-panel-nav` / `ds-bar-nav` inside `ds-app-shell`. */\nimport type { ShellGradientPreset } from './shell-gradient-presets';\nimport {\n DEFAULT_SHELL_GRADIENT_PRESET,\n buildShellRadialGradientForPreset,\n} from './shell-gradient-presets';\n\nexport type { ShellGradientPreset } from './shell-gradient-presets';\nexport {\n DEFAULT_SHELL_GRADIENT_PRESET,\n SHELL_GRADIENT_PRESETS,\n SHELL_GRADIENT_PRESET_LABELS,\n buildShellRadialGradientForPreset,\n isShellGradientPreset,\n shellGradientPresetStopToken,\n} from './shell-gradient-presets';\n\nexport const SHELL_GRADIENT_IMAGE_VAR = '--ds-shell-gradient-image';\nexport const SHELL_GRADIENT_SIZE_VAR = '--ds-shell-gradient-size';\nexport const SHELL_GRADIENT_POSITION_PANEL_VAR = '--ds-shell-gradient-position-panel';\nexport const SHELL_GRADIENT_POSITION_BAR_VAR = '--ds-shell-gradient-position-bar';\nexport const SHELL_GRADIENT_OPACITY_VAR = '--ds-shell-gradient-opacity';\n/** Per chrome-surface background-position — offsets wash + grid to shell row origin. */\nexport const SHELL_CHROME_SURFACE_POSITION_VAR = '--ds-shell-chrome-surface-position';\n\n/** Layer opacity for the nav gradient wash. */\nexport const SHELL_GRADIENT_OPACITY = '0.1';\n\n/** Whether the shared chrome layer (secondary bg + optional wash) should mount. */\nexport function shellChromeLayerActive(gradient: boolean): boolean {\n return gradient;\n}\n\n/**\n * Shell radial wash — same for panel and bar nav.\n * Tokens follow `data-theme` (light/dark intent stops).\n */\nexport function buildShellRadialGradient(\n preset: ShellGradientPreset = DEFAULT_SHELL_GRADIENT_PRESET,\n): string {\n return buildShellRadialGradientForPreset(preset);\n}\n\n/** Built-in radial image (`gradientSrc` on shell overrides). */\nexport function shellGradientImage(\n preset: ShellGradientPreset = DEFAULT_SHELL_GRADIENT_PRESET,\n): string {\n return buildShellRadialGradient(preset);\n}\n\nexport interface ShellViewportDimensions {\n width: number;\n height: number;\n}\n\n/**\n * Viewport size for shell chrome with `background-attachment: fixed`.\n * Must not use the `ds-app-shell` element box — the shell can be shorter or\n * taller than the viewport when host height chains break or content overflows.\n */\nexport function readShellViewportDimensions(win?: Window): ShellViewportDimensions {\n const w = win ?? (typeof globalThis.window !== 'undefined' ? globalThis.window : undefined);\n if (!w) return { width: 0, height: 0 };\n\n const visual = w.visualViewport;\n return {\n width: Math.round(visual?.width ?? w.innerWidth),\n height: Math.round(visual?.height ?? w.innerHeight),\n };\n}\n\nexport interface ShellGradientLayout {\n width: number;\n height: number;\n panelWidth: number;\n}\n\n/** Pixel `background-size` for the fixed-attachment radial wash. */\nexport function shellGradientSize(layout: Pick<ShellGradientLayout, 'width' | 'height'>): string {\n return `${Math.round(layout.width)}px ${Math.round(layout.height)}px`;\n}\n\nexport function shellGradientPositionPanel(): string {\n return '0 0';\n}\n\nexport function shellGradientPositionBar(panelWidth: number): string {\n return `${-Math.round(panelWidth)}px 0`;\n}\n\n/** Phase-lock a chrome rect to the shell row coordinate system (wash + grid). */\nexport function shellChromeSurfacePosition(leftPx: number, topPx: number): string {\n return `${-Math.round(leftPx)}px ${-Math.round(topPx)}px`;\n}\n"],"mappings":"AAMO,MAAMA,EAAsE,CACjF,OACA,UACA,QAIK,MAAMC,EAAqD,UAE3D,MAAMC,EAAoE,CAC/EC,KAAM,OACNC,KAAM,OACNC,QAAS,UACTC,KAAM,QAGR,MAAMC,EAAmF,CACvFH,KAAM,mDACNC,QAAS,mDACTC,KAAM,sDAGR,MAAME,EAAoB,qBAEpB,SAAUC,EAA6BC,GAC3C,GAAIA,IAAW,OAAQ,OAAO,KAC9B,OAAOH,EAA2BG,EACpC,CAOM,SAAUC,EAAkCD,GAChD,GAAIA,IAAW,OAAQ,MAAO,OAE9B,MAAME,EAAOH,EAA6BC,GAC1C,MAAO,mBAAmBF,8CAA8DI,SAC1F,CC5BO,MAAMC,EAA2B,4BACjC,MAAMC,EAA0B,2BAChC,MAAMC,EAAoC,qCAC1C,MAAMC,EAAkC,mCACxC,MAAMC,EAA6B,8BAKnC,MAAMC,EAAyB,MAWhC,SAAUC,EACdT,EAA8BT,GAE9B,OAAOU,EAAkCD,EAC3C,CAmBM,SAAUU,EAA4BC,GAC1C,MAAMC,SAAmBC,WAAWC,SAAW,YAAcD,WAAWC,OAASC,UACjF,IAAKH,EAAG,MAAO,CAAEI,MAAO,EAAGC,OAAQ,GAEnC,MAAMC,EAASN,EAAEO,eACjB,MAAO,CACLH,MAAOI,KAAKC,MAAMH,GAAQF,OAASJ,EAAEU,YACrCL,OAAQG,KAAKC,MAAMH,GAAQD,QAAUL,EAAEW,aAE3C,CASM,SAAUC,EAAkBC,GAChC,MAAO,GAAGL,KAAKC,MAAMI,EAAOT,YAAYI,KAAKC,MAAMI,EAAOR,WAC5D,C,SAEgBS,IACd,MAAO,KACT,CAEM,SAAUC,EAAyBC,GACvC,MAAO,IAAIR,KAAKC,MAAMO,QACxB,Q","ignoreList":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|