@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/esm/index.js CHANGED
@@ -1,3 +1,34 @@
1
+ //#region src/concepts/animation/duration.helpers.ts
2
+ /** Duration (seconds) the default theme assigns `expand`'s `transitionSpeed`. */
3
+ var EXPAND_DEFAULT_SPEED = .35;
4
+ /**
5
+ * Content height (px) at which a reveal runs at exactly its `transitionSpeed`.
6
+ * Roughly a few lines of card content — the size the default 0.35s was tuned on.
7
+ */
8
+ var EXPAND_REFERENCE_HEIGHT = 240;
9
+ /**
10
+ * Duration envelope at the default speed. A tiny region never blinks past
11
+ * faster than the min; a full-page region never drags longer than the max.
12
+ * Expressed at `EXPAND_DEFAULT_SPEED` and applied as scale-factor clamps, so a
13
+ * theme that slows `transitionSpeed` down widens its envelope proportionally
14
+ * instead of being capped back to the stock feel.
15
+ */
16
+ var EXPAND_MIN_DURATION = .15;
17
+ var EXPAND_MAX_DURATION = .6;
18
+ var MIN_SCALE = EXPAND_MIN_DURATION / EXPAND_DEFAULT_SPEED;
19
+ var MAX_SCALE = EXPAND_MAX_DURATION / EXPAND_DEFAULT_SPEED;
20
+ /**
21
+ * Size-aware reveal duration: `speed × √(height ÷ reference)`, clamped.
22
+ *
23
+ * A fixed duration reads as sluggish on a short region and rushed on a tall
24
+ * one; scaling by the square root of height keeps perceived speed steady —
25
+ * bigger reveals get more time, but sublinearly.
26
+ */
27
+ var expandDuration = (contentHeight, speed = EXPAND_DEFAULT_SPEED) => {
28
+ const scale = Math.sqrt((Number.isFinite(contentHeight) ? Math.max(contentHeight, 0) : 0) / 240);
29
+ return speed * Math.min(Math.max(scale, MIN_SCALE), MAX_SCALE);
30
+ };
31
+ //#endregion
1
32
  //#region src/concepts/animation/keyframes.constants.ts
2
33
  var fadeIn = {
3
34
  "0%": { opacity: 0 },
@@ -1240,6 +1271,38 @@ var buildComponents = (c) => ({
1240
1271
  color: "primary-surface",
1241
1272
  shadow: "menu"
1242
1273
  } },
1274
+ menu: { options: {
1275
+ minWidth: 184,
1276
+ color: void 0,
1277
+ border: void 0,
1278
+ borderRadius: void 0,
1279
+ shadow: void 0,
1280
+ paddingVertical: "xs",
1281
+ paddingHorizontal: "none",
1282
+ dividerBorder: "light",
1283
+ dividerSpacing: "xs"
1284
+ } },
1285
+ menuItem: {
1286
+ options: {
1287
+ height: 38,
1288
+ paddingHorizontal: "md",
1289
+ gap: "md",
1290
+ borderRadius: "none",
1291
+ typeface: "label",
1292
+ textColor: void 0,
1293
+ hoverColor: "primary-container",
1294
+ activeSymbol: "check",
1295
+ transitionSpeed: .35
1296
+ },
1297
+ variants: { warn: {
1298
+ color: c.warn,
1299
+ "&:hover, &:focus": {
1300
+ backgroundColor: c["warn-container"],
1301
+ color: c["on-warn-container"]
1302
+ }
1303
+ } }
1304
+ },
1305
+ expand: { options: { transitionSpeed: .35 } },
1243
1306
  footer: { options: {
1244
1307
  height: 52,
1245
1308
  color: "primary",
@@ -2150,6 +2213,7 @@ var FontWeightMap = {
2150
2213
  //#endregion
2151
2214
  //#region src/concepts/typography/typeface.helpers.ts
2152
2215
  var px = (value) => typeof value === "number" ? `${value}px` : value;
2216
+ var weight = (value) => typeof value === "number" ? value : FontWeightMap[value];
2153
2217
  /**
2154
2218
  * Converts a TextStyle (numeric, design-token oriented) into a
2155
2219
  * TypeFaceDefinition (CSS-ready) so a theme's `typefaces` map can be
@@ -2161,7 +2225,7 @@ var toTypeface = (style) => ({
2161
2225
  lineHeight: px(style.lineHeight),
2162
2226
  ...style.letterSpacing !== void 0 && { letterSpacing: px(style.letterSpacing) },
2163
2227
  ...style.textTransform === "uppercase" && { textTransform: "uppercase" },
2164
- ...style.fontWeight !== void 0 && { fontWeight: style.fontWeight },
2228
+ ...style.fontWeight !== void 0 && { fontWeight: weight(style.fontWeight) },
2165
2229
  ...style.fontStyle && { fontStyle: style.fontStyle }
2166
2230
  });
2167
2231
  var toTypefaces = (typography) => Object.fromEntries(Object.entries(typography).map(([role, style]) => [role, toTypeface(style)]));
@@ -2183,6 +2247,6 @@ var debounce = (callback, timeout) => {
2183
2247
  };
2184
2248
  };
2185
2249
  //#endregion
2186
- export { BASE_PALETTE_CONFIG, BaseIcons, BaseTheme, CategoryChroma, CategoryLightness, CategorySaturation, DarkTheme, DefaultThemeId, FontWeightMap, HSLAToString, HSLToHex, HSLToRGB, LightTheme, RGBToHSL, RGBToString, RoleHues, ShadowCssMap, ShadowMap, ShapeRadii, UniThemes, Z_INDEX, classifyScheme, collapseFadeOut, contrastRatio, createTheme, createThemeFromPalette, cycle, darkColors, debounce, emitDtcgTokens, emitThemeFile, expandFadeIn, fadeIn, fadeOut, generateColors, generatePalette, generateShadows, generateThemes, generateUniThemes, getAnalogousHues, getComplimentaryHue, getDeviceOrientation, getDeviceSize, getSplitComplimentaryHues, getTriadicHues, getValue, gradient, hexToHSL, hexToOklch, hexToRgb, inferCategory, lightColors, oklchToHex, randomRangeValue, relativeLuminance, removeInputPlatformStyling, rgbToHex, schemeHues, svgToIconUri, toTypeface, toTypefaces, uniColor };
2250
+ export { BASE_PALETTE_CONFIG, BaseIcons, BaseTheme, CategoryChroma, CategoryLightness, CategorySaturation, DarkTheme, DefaultThemeId, EXPAND_DEFAULT_SPEED, EXPAND_MAX_DURATION, EXPAND_MIN_DURATION, EXPAND_REFERENCE_HEIGHT, FontWeightMap, HSLAToString, HSLToHex, HSLToRGB, LightTheme, RGBToHSL, RGBToString, RoleHues, ShadowCssMap, ShadowMap, ShapeRadii, UniThemes, Z_INDEX, classifyScheme, collapseFadeOut, contrastRatio, createTheme, createThemeFromPalette, cycle, darkColors, debounce, emitDtcgTokens, emitThemeFile, expandDuration, expandFadeIn, fadeIn, fadeOut, generateColors, generatePalette, generateShadows, generateThemes, generateUniThemes, getAnalogousHues, getComplimentaryHue, getDeviceOrientation, getDeviceSize, getSplitComplimentaryHues, getTriadicHues, getValue, gradient, hexToHSL, hexToOklch, hexToRgb, inferCategory, lightColors, oklchToHex, randomRangeValue, relativeLuminance, removeInputPlatformStyling, rgbToHex, schemeHues, svgToIconUri, toTypeface, toTypefaces, uniColor };
2187
2251
 
2188
2252
  //# sourceMappingURL=index.js.map