@uni-design-system/uni-core 7.1.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 },
@@ -843,6 +874,7 @@ var BaseIcons = {
843
874
  arrowLeft: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='m294.92-450 227.85 227.85L480-180 180-480l300-300 42.77 42.15L294.92-510H780v60H294.92Z'/%3e%3c/svg%3e",
844
875
  arrowRight: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='M665.08-450H180v-60h485.08L437.23-737.85 480-780l300 300-300 300-42.77-42.15L665.08-450Z'/%3e%3c/svg%3e",
845
876
  home: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='M240-200h133.85v-237.69h212.3V-200H720v-360L480-740.77 240-560v360Zm-60 60v-450l300-225.77L780-590v450H526.15v-237.69h-92.3V-140H180Zm300-330.38Z'/%3e%3c/svg%3e",
877
+ building: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='M130-136.92v-540h160v-160h380v320h160v380H530v-160H430v160H130Zm60-60h100v-100H190v100Zm0-160h100v-100H190v100Zm0-160h100v-100H190v100Zm160 160h100v-100H350v100Zm0-160h100v-100H350v100Zm0-160h100v-100H350v100Zm160 320h100v-100H510v100Zm0-160h100v-100H510v100Zm0-160h100v-100H510v100Zm160 480h100v-100H670v100Zm0-160h100v-100H670v100Z'/%3e%3c/svg%3e",
846
878
  externalLink: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='M212.31-140Q182-140 161-161q-21-21-21-51.31v-535.38Q140-778 161-799q21-21 51.31-21h252.3v60h-252.3q-4.62 0-8.46 3.85-3.85 3.84-3.85 8.46v535.38q0 4.62 3.85 8.46 3.84 3.85 8.46 3.85h535.38q4.62 0 8.46-3.85 3.85-3.84 3.85-8.46v-252.3h60v252.3Q820-182 799-161q-21 21-51.31 21H212.31Zm176.46-206.62-42.15-42.15L717.85-760H560v-60h260v260h-60v-157.85L388.77-346.62Z'/%3e%3c/svg%3e",
847
879
  link: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='M432.31-298.46H281.54q-75.34 0-128.44-53.1Q100-404.65 100-479.98q0-75.33 53.1-128.44 53.1-53.12 128.44-53.12h150.77v60H281.54q-50.39 0-85.96 35.58Q160-530.38 160-480q0 50.38 35.58 85.96 35.57 35.58 85.96 35.58h150.77v60ZM330-450v-60h300v60H330Zm197.69 151.54v-60h150.77q50.39 0 85.96-35.58Q800-429.62 800-480q0-50.38-35.58-85.96-35.57-35.58-85.96-35.58H527.69v-60h150.77q75.34 0 128.44 53.1Q860-555.35 860-480.02q0 75.33-53.1 128.44-53.1 53.12-128.44 53.12H527.69Z'/%3e%3c/svg%3e",
848
880
  expand: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='M140-140v-300h60v198.23L718.23-760H520v-60h300v300h-60v-198.23L241.77-200H440v60H140Z'/%3e%3c/svg%3e",
@@ -862,6 +894,7 @@ var BaseIcons = {
862
894
  share: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='M672.22-100q-44.91 0-76.26-31.41-31.34-31.41-31.34-76.28 0-6 4.15-29.16L284.31-404.31q-14.46 15-34.36 23.5t-42.64 8.5q-44.71 0-76.01-31.54Q100-435.39 100-480q0-44.61 31.3-76.15 31.3-31.54 76.01-31.54 22.74 0 42.64 8.5 19.9 8.5 34.36 23.5l284.46-167.08q-2.38-7.38-3.27-14.46-.88-7.08-.88-15.08 0-44.87 31.43-76.28Q627.49-860 672.4-860t76.25 31.44Q780-797.13 780-752.22q0 44.91-31.41 76.26-31.41 31.34-76.28 31.34-22.85 0-42.5-8.69Q610.15-662 595.69-677L311.23-509.54q2.38 7.39 3.27 14.46.88 7.08.88 15.08t-.88 15.08q-.89 7.07-3.27 14.46L595.69-283q14.46-15 34.12-23.69 19.65-8.69 42.5-8.69 44.87 0 76.28 31.43Q780-252.51 780-207.6t-31.44 76.25Q717.13-100 672.22-100Zm.09-60q20.27 0 33.98-13.71Q720-187.42 720-207.69q0-20.27-13.71-33.98-13.71-13.72-33.98-13.72-20.27 0-33.98 13.72-13.72 13.71-13.72 33.98 0 20.27 13.72 33.98Q652.04-160 672.31-160Zm-465-272.31q20.43 0 34.25-13.8 13.83-13.81 13.83-33.89t-13.83-33.89q-13.82-13.8-34.25-13.8-20.11 0-33.71 13.8Q160-500.08 160-480t13.6 33.89q13.6 13.8 33.71 13.8Zm498.88-286.02Q720-732.04 720-752.31q0-20.27-13.71-33.98Q692.58-800 672.31-800q-20.27 0-33.98 13.71-13.72 13.71-13.72 33.98 0 20.27 13.81 33.98 13.81 13.72 33.89 13.72 20.07 0 33.88-13.72Zm-33.88 510.64ZM207.69-480Zm464.62-272.31Z'/%3e%3c/svg%3e",
863
895
  send: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='M140-190v-580l688.46 290L140-190Zm60-90 474-200-474-200v147.69L416.92-480 200-427.69V-280Zm0 0v-400 400Z'/%3e%3c/svg%3e",
864
896
  filter: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='M411.15-260v-60h137.31v60H411.15ZM256.16-450v-60h447.3v60h-447.3ZM140-640v-60h680v60H140Z'/%3e%3c/svg%3e",
897
+ funnel: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='M455.39-180q-15.08 0-25.23-10.16Q420-200.31 420-215.39v-231.53L196.08-731.38q-11.54-15.39-3.35-32 8.2-16.62 27.66-16.62h519.22q19.46 0 27.66 16.62 8.19 16.61-3.35 32L540-446.92v231.53q0 15.08-10.16 25.23Q519.69-180 504.61-180h-49.22ZM480-468l198-252H282l198 252Zm0 0Z'/%3e%3c/svg%3e",
865
898
  refresh: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='M481.54-180q-125.63 0-212.81-87.17-87.19-87.17-87.19-212.77 0-125.6 87.19-212.83Q355.91-780 481.54-780q70.15 0 132.77 31.19 62.61 31.2 104.15 88.04V-780h60v244.61H533.85v-59.99h158q-31.62-57.93-87.7-91.27Q548.08-720 481.54-720q-100 0-170 70t-70 170q0 100 70 170t170 70q77 0 139-44t87-116h63.23q-27.23 97.92-107.27 158.96Q583.46-180 481.54-180Z'/%3e%3c/svg%3e",
866
899
  dragHandle: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='M360-175.39q-26.65 0-45.63-18.98-18.98-18.98-18.98-45.63 0-26.65 18.98-45.63 18.98-18.98 45.63-18.98 26.65 0 45.63 18.98 18.98 18.98 18.98 45.63 0 26.65-18.98 45.63-18.98 18.98-45.63 18.98Zm240 0q-26.65 0-45.63-18.98-18.98-18.98-18.98-45.63 0-26.65 18.98-45.63 18.98-18.98 45.63-18.98 26.65 0 45.63 18.98 18.98 18.98 18.98 45.63 0 26.65-18.98 45.63-18.98 18.98-45.63 18.98Zm-240-240q-26.65 0-45.63-18.98-18.98-18.98-18.98-45.63 0-26.65 18.98-45.63 18.98-18.98 45.63-18.98 26.65 0 45.63 18.98 18.98 18.98 18.98 45.63 0 26.65-18.98 45.63-18.98 18.98-45.63 18.98Zm240 0q-26.65 0-45.63-18.98-18.98-18.98-18.98-45.63 0-26.65 18.98-45.63 18.98-18.98 45.63-18.98 26.65 0 45.63 18.98 18.98 18.98 18.98 45.63 0 26.65-18.98 45.63-18.98 18.98-45.63 18.98Zm-240-240q-26.65 0-45.63-18.98-18.98-18.98-18.98-45.63 0-26.65 18.98-45.63 18.98-18.98 45.63-18.98 26.65 0 45.63 18.98 18.98 18.98 18.98 45.63 0 26.65-18.98 45.63-18.98 18.98-45.63 18.98Zm240 0q-26.65 0-45.63-18.98-18.98-18.98-18.98-45.63 0-26.65 18.98-45.63 18.98-18.98 45.63-18.98 26.65 0 45.63 18.98 18.98 18.98 18.98 45.63 0 26.65-18.98 45.63-18.98 18.98-45.63 18.98Z'/%3e%3c/svg%3e",
867
900
  qrCode: "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3e%3cpath d='M140-520v-300h300v300H140Zm60-60h180v-180H200v180Zm-60 440v-300h300v300H140Zm60-60h180v-180H200v180Zm320-320v-300h300v300H520Zm60-60h180v-180H580v180Zm165 440v-75h75v75h-75ZM520-365v-75h75v75h-75Zm75 75v-75h75v75h-75Zm-75 75v-75h75v75h-75Zm75 75v-75h75v75h-75Zm75-75v-75h75v75h-75Zm0-150v-75h75v75h-75Zm75 75v-75h75v75h-75Z'/%3e%3c/svg%3e",
@@ -1238,6 +1271,38 @@ var buildComponents = (c) => ({
1238
1271
  color: "primary-surface",
1239
1272
  shadow: "menu"
1240
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 } },
1241
1306
  footer: { options: {
1242
1307
  height: 52,
1243
1308
  color: "primary",
@@ -1889,7 +1954,7 @@ var emitThemeFile = (input) => {
1889
1954
  "const components = (colors: Colors): ComponentThemes => ({});",
1890
1955
  "",
1891
1956
  "/**",
1892
- " * Icon primitives, merged over the built-in 59-icon set per name: reuse a",
1957
+ " * Icon primitives, merged over the built-in 61-icon set per name: reuse a",
1893
1958
  " * built-in name to reskin it, or add any new name. Define an icon ONCE here",
1894
1959
  " * and render it anywhere via `<uni-icon name='…'/>` — never inline SVG in",
1895
1960
  " * components.",
@@ -2148,6 +2213,7 @@ var FontWeightMap = {
2148
2213
  //#endregion
2149
2214
  //#region src/concepts/typography/typeface.helpers.ts
2150
2215
  var px = (value) => typeof value === "number" ? `${value}px` : value;
2216
+ var weight = (value) => typeof value === "number" ? value : FontWeightMap[value];
2151
2217
  /**
2152
2218
  * Converts a TextStyle (numeric, design-token oriented) into a
2153
2219
  * TypeFaceDefinition (CSS-ready) so a theme's `typefaces` map can be
@@ -2159,7 +2225,7 @@ var toTypeface = (style) => ({
2159
2225
  lineHeight: px(style.lineHeight),
2160
2226
  ...style.letterSpacing !== void 0 && { letterSpacing: px(style.letterSpacing) },
2161
2227
  ...style.textTransform === "uppercase" && { textTransform: "uppercase" },
2162
- ...style.fontWeight !== void 0 && { fontWeight: style.fontWeight },
2228
+ ...style.fontWeight !== void 0 && { fontWeight: weight(style.fontWeight) },
2163
2229
  ...style.fontStyle && { fontStyle: style.fontStyle }
2164
2230
  });
2165
2231
  var toTypefaces = (typography) => Object.fromEntries(Object.entries(typography).map(([role, style]) => [role, toTypeface(style)]));
@@ -2181,6 +2247,6 @@ var debounce = (callback, timeout) => {
2181
2247
  };
2182
2248
  };
2183
2249
  //#endregion
2184
- 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 };
2185
2251
 
2186
2252
  //# sourceMappingURL=index.js.map