@uni-design-system/uni-core 7.2.0 → 7.3.0
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/cjs/index.cjs +70 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +66 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/types/concepts/animation/duration.helpers.d.ts +25 -0
- package/dist/types/concepts/animation/duration.helpers.d.ts.map +1 -0
- package/dist/types/concepts/animation/duration.helpers.spec.d.ts +2 -0
- package/dist/types/concepts/animation/duration.helpers.spec.d.ts.map +1 -0
- package/dist/types/concepts/animation/index.d.ts +1 -0
- package/dist/types/concepts/animation/index.d.ts.map +1 -1
- package/dist/types/concepts/component/component.types.d.ts +1 -1
- package/dist/types/concepts/component/component.types.d.ts.map +1 -1
- package/dist/types/concepts/theme/themes/base.theme.d.ts.map +1 -1
- package/dist/types/concepts/typography/typeface.helpers.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,4 +1,35 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/concepts/animation/duration.helpers.ts
|
|
3
|
+
/** Duration (seconds) the default theme assigns `expand`'s `transitionSpeed`. */
|
|
4
|
+
var EXPAND_DEFAULT_SPEED = .35;
|
|
5
|
+
/**
|
|
6
|
+
* Content height (px) at which a reveal runs at exactly its `transitionSpeed`.
|
|
7
|
+
* Roughly a few lines of card content — the size the default 0.35s was tuned on.
|
|
8
|
+
*/
|
|
9
|
+
var EXPAND_REFERENCE_HEIGHT = 240;
|
|
10
|
+
/**
|
|
11
|
+
* Duration envelope at the default speed. A tiny region never blinks past
|
|
12
|
+
* faster than the min; a full-page region never drags longer than the max.
|
|
13
|
+
* Expressed at `EXPAND_DEFAULT_SPEED` and applied as scale-factor clamps, so a
|
|
14
|
+
* theme that slows `transitionSpeed` down widens its envelope proportionally
|
|
15
|
+
* instead of being capped back to the stock feel.
|
|
16
|
+
*/
|
|
17
|
+
var EXPAND_MIN_DURATION = .15;
|
|
18
|
+
var EXPAND_MAX_DURATION = .6;
|
|
19
|
+
var MIN_SCALE = EXPAND_MIN_DURATION / EXPAND_DEFAULT_SPEED;
|
|
20
|
+
var MAX_SCALE = EXPAND_MAX_DURATION / EXPAND_DEFAULT_SPEED;
|
|
21
|
+
/**
|
|
22
|
+
* Size-aware reveal duration: `speed × √(height ÷ reference)`, clamped.
|
|
23
|
+
*
|
|
24
|
+
* A fixed duration reads as sluggish on a short region and rushed on a tall
|
|
25
|
+
* one; scaling by the square root of height keeps perceived speed steady —
|
|
26
|
+
* bigger reveals get more time, but sublinearly.
|
|
27
|
+
*/
|
|
28
|
+
var expandDuration = (contentHeight, speed = EXPAND_DEFAULT_SPEED) => {
|
|
29
|
+
const scale = Math.sqrt((Number.isFinite(contentHeight) ? Math.max(contentHeight, 0) : 0) / 240);
|
|
30
|
+
return speed * Math.min(Math.max(scale, MIN_SCALE), MAX_SCALE);
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
2
33
|
//#region src/concepts/animation/keyframes.constants.ts
|
|
3
34
|
var fadeIn = {
|
|
4
35
|
"0%": { opacity: 0 },
|
|
@@ -1241,6 +1272,38 @@ var buildComponents = (c) => ({
|
|
|
1241
1272
|
color: "primary-surface",
|
|
1242
1273
|
shadow: "menu"
|
|
1243
1274
|
} },
|
|
1275
|
+
menu: { options: {
|
|
1276
|
+
minWidth: 184,
|
|
1277
|
+
color: void 0,
|
|
1278
|
+
border: void 0,
|
|
1279
|
+
borderRadius: void 0,
|
|
1280
|
+
shadow: void 0,
|
|
1281
|
+
paddingVertical: "xs",
|
|
1282
|
+
paddingHorizontal: "none",
|
|
1283
|
+
dividerBorder: "light",
|
|
1284
|
+
dividerSpacing: "xs"
|
|
1285
|
+
} },
|
|
1286
|
+
menuItem: {
|
|
1287
|
+
options: {
|
|
1288
|
+
height: 38,
|
|
1289
|
+
paddingHorizontal: "md",
|
|
1290
|
+
gap: "md",
|
|
1291
|
+
borderRadius: "none",
|
|
1292
|
+
typeface: "label",
|
|
1293
|
+
textColor: void 0,
|
|
1294
|
+
hoverColor: "primary-container",
|
|
1295
|
+
activeSymbol: "check",
|
|
1296
|
+
transitionSpeed: .35
|
|
1297
|
+
},
|
|
1298
|
+
variants: { warn: {
|
|
1299
|
+
color: c.warn,
|
|
1300
|
+
"&:hover, &:focus": {
|
|
1301
|
+
backgroundColor: c["warn-container"],
|
|
1302
|
+
color: c["on-warn-container"]
|
|
1303
|
+
}
|
|
1304
|
+
} }
|
|
1305
|
+
},
|
|
1306
|
+
expand: { options: { transitionSpeed: .35 } },
|
|
1244
1307
|
footer: { options: {
|
|
1245
1308
|
height: 52,
|
|
1246
1309
|
color: "primary",
|
|
@@ -2151,6 +2214,7 @@ var FontWeightMap = {
|
|
|
2151
2214
|
//#endregion
|
|
2152
2215
|
//#region src/concepts/typography/typeface.helpers.ts
|
|
2153
2216
|
var px = (value) => typeof value === "number" ? `${value}px` : value;
|
|
2217
|
+
var weight = (value) => typeof value === "number" ? value : FontWeightMap[value];
|
|
2154
2218
|
/**
|
|
2155
2219
|
* Converts a TextStyle (numeric, design-token oriented) into a
|
|
2156
2220
|
* TypeFaceDefinition (CSS-ready) so a theme's `typefaces` map can be
|
|
@@ -2162,7 +2226,7 @@ var toTypeface = (style) => ({
|
|
|
2162
2226
|
lineHeight: px(style.lineHeight),
|
|
2163
2227
|
...style.letterSpacing !== void 0 && { letterSpacing: px(style.letterSpacing) },
|
|
2164
2228
|
...style.textTransform === "uppercase" && { textTransform: "uppercase" },
|
|
2165
|
-
...style.fontWeight !== void 0 && { fontWeight: style.fontWeight },
|
|
2229
|
+
...style.fontWeight !== void 0 && { fontWeight: weight(style.fontWeight) },
|
|
2166
2230
|
...style.fontStyle && { fontStyle: style.fontStyle }
|
|
2167
2231
|
});
|
|
2168
2232
|
var toTypefaces = (typography) => Object.fromEntries(Object.entries(typography).map(([role, style]) => [role, toTypeface(style)]));
|
|
@@ -2192,6 +2256,10 @@ exports.CategoryLightness = CategoryLightness;
|
|
|
2192
2256
|
exports.CategorySaturation = CategorySaturation;
|
|
2193
2257
|
exports.DarkTheme = DarkTheme;
|
|
2194
2258
|
exports.DefaultThemeId = DefaultThemeId;
|
|
2259
|
+
exports.EXPAND_DEFAULT_SPEED = EXPAND_DEFAULT_SPEED;
|
|
2260
|
+
exports.EXPAND_MAX_DURATION = EXPAND_MAX_DURATION;
|
|
2261
|
+
exports.EXPAND_MIN_DURATION = EXPAND_MIN_DURATION;
|
|
2262
|
+
exports.EXPAND_REFERENCE_HEIGHT = EXPAND_REFERENCE_HEIGHT;
|
|
2195
2263
|
exports.FontWeightMap = FontWeightMap;
|
|
2196
2264
|
exports.HSLAToString = HSLAToString;
|
|
2197
2265
|
exports.HSLToHex = HSLToHex;
|
|
@@ -2215,6 +2283,7 @@ exports.darkColors = darkColors;
|
|
|
2215
2283
|
exports.debounce = debounce;
|
|
2216
2284
|
exports.emitDtcgTokens = emitDtcgTokens;
|
|
2217
2285
|
exports.emitThemeFile = emitThemeFile;
|
|
2286
|
+
exports.expandDuration = expandDuration;
|
|
2218
2287
|
exports.expandFadeIn = expandFadeIn;
|
|
2219
2288
|
exports.fadeIn = fadeIn;
|
|
2220
2289
|
exports.fadeOut = fadeOut;
|