@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/cjs/index.cjs +73 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +69 -3
- 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/iconography/icon.records.d.ts +2 -0
- package/dist/types/concepts/iconography/icon.records.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 },
|
|
@@ -844,6 +875,7 @@ var BaseIcons = {
|
|
|
844
875
|
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",
|
|
845
876
|
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",
|
|
846
877
|
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",
|
|
878
|
+
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",
|
|
847
879
|
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",
|
|
848
880
|
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",
|
|
849
881
|
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",
|
|
@@ -863,6 +895,7 @@ var BaseIcons = {
|
|
|
863
895
|
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",
|
|
864
896
|
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",
|
|
865
897
|
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",
|
|
898
|
+
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",
|
|
866
899
|
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",
|
|
867
900
|
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",
|
|
868
901
|
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",
|
|
@@ -1239,6 +1272,38 @@ var buildComponents = (c) => ({
|
|
|
1239
1272
|
color: "primary-surface",
|
|
1240
1273
|
shadow: "menu"
|
|
1241
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 } },
|
|
1242
1307
|
footer: { options: {
|
|
1243
1308
|
height: 52,
|
|
1244
1309
|
color: "primary",
|
|
@@ -1890,7 +1955,7 @@ var emitThemeFile = (input) => {
|
|
|
1890
1955
|
"const components = (colors: Colors): ComponentThemes => ({});",
|
|
1891
1956
|
"",
|
|
1892
1957
|
"/**",
|
|
1893
|
-
" * Icon primitives, merged over the built-in
|
|
1958
|
+
" * Icon primitives, merged over the built-in 61-icon set per name: reuse a",
|
|
1894
1959
|
" * built-in name to reskin it, or add any new name. Define an icon ONCE here",
|
|
1895
1960
|
" * and render it anywhere via `<uni-icon name='…'/>` — never inline SVG in",
|
|
1896
1961
|
" * components.",
|
|
@@ -2149,6 +2214,7 @@ var FontWeightMap = {
|
|
|
2149
2214
|
//#endregion
|
|
2150
2215
|
//#region src/concepts/typography/typeface.helpers.ts
|
|
2151
2216
|
var px = (value) => typeof value === "number" ? `${value}px` : value;
|
|
2217
|
+
var weight = (value) => typeof value === "number" ? value : FontWeightMap[value];
|
|
2152
2218
|
/**
|
|
2153
2219
|
* Converts a TextStyle (numeric, design-token oriented) into a
|
|
2154
2220
|
* TypeFaceDefinition (CSS-ready) so a theme's `typefaces` map can be
|
|
@@ -2160,7 +2226,7 @@ var toTypeface = (style) => ({
|
|
|
2160
2226
|
lineHeight: px(style.lineHeight),
|
|
2161
2227
|
...style.letterSpacing !== void 0 && { letterSpacing: px(style.letterSpacing) },
|
|
2162
2228
|
...style.textTransform === "uppercase" && { textTransform: "uppercase" },
|
|
2163
|
-
...style.fontWeight !== void 0 && { fontWeight: style.fontWeight },
|
|
2229
|
+
...style.fontWeight !== void 0 && { fontWeight: weight(style.fontWeight) },
|
|
2164
2230
|
...style.fontStyle && { fontStyle: style.fontStyle }
|
|
2165
2231
|
});
|
|
2166
2232
|
var toTypefaces = (typography) => Object.fromEntries(Object.entries(typography).map(([role, style]) => [role, toTypeface(style)]));
|
|
@@ -2190,6 +2256,10 @@ exports.CategoryLightness = CategoryLightness;
|
|
|
2190
2256
|
exports.CategorySaturation = CategorySaturation;
|
|
2191
2257
|
exports.DarkTheme = DarkTheme;
|
|
2192
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;
|
|
2193
2263
|
exports.FontWeightMap = FontWeightMap;
|
|
2194
2264
|
exports.HSLAToString = HSLAToString;
|
|
2195
2265
|
exports.HSLToHex = HSLToHex;
|
|
@@ -2213,6 +2283,7 @@ exports.darkColors = darkColors;
|
|
|
2213
2283
|
exports.debounce = debounce;
|
|
2214
2284
|
exports.emitDtcgTokens = emitDtcgTokens;
|
|
2215
2285
|
exports.emitThemeFile = emitThemeFile;
|
|
2286
|
+
exports.expandDuration = expandDuration;
|
|
2216
2287
|
exports.expandFadeIn = expandFadeIn;
|
|
2217
2288
|
exports.fadeIn = fadeIn;
|
|
2218
2289
|
exports.fadeOut = fadeOut;
|