@uni-design-system/uni-core 8.3.1 → 9.0.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.
@@ -60,183 +60,6 @@ var collapseFadeOut = {
60
60
  }
61
61
  };
62
62
  //#endregion
63
- //#region src/concepts/color/color.records.ts
64
- /**
65
- * @deprecated HSL saturation ranges are superseded by the perceptual OKLCH
66
- * chroma model inside `concepts/generation` (see `generateThemes`). Kept for
67
- * legacy callers of `uniColor`; removal follows the changeset major process.
68
- */
69
- var CategorySaturation = {
70
- jewel: {
71
- low: 73,
72
- high: 83
73
- },
74
- pastel: {
75
- low: 14,
76
- high: 21
77
- },
78
- earth: {
79
- low: 36,
80
- high: 41
81
- },
82
- neutral: {
83
- low: 1,
84
- high: 10
85
- },
86
- florescent: {
87
- low: 63,
88
- high: 100
89
- },
90
- shades: {
91
- low: 0,
92
- high: 0
93
- }
94
- };
95
- /**
96
- * @deprecated HSL lightness ranges are superseded by the perceptual OKLCH
97
- * tone slots inside `concepts/generation` (see `generateThemes`).
98
- */
99
- var CategoryLightness = {
100
- jewel: {
101
- low: 56,
102
- high: 76
103
- },
104
- pastel: {
105
- low: 89,
106
- high: 96
107
- },
108
- earth: {
109
- low: 36,
110
- high: 77
111
- },
112
- neutral: {
113
- low: 70,
114
- high: 99
115
- },
116
- florescent: {
117
- low: 82,
118
- high: 100
119
- },
120
- shades: {
121
- low: 0,
122
- high: 100
123
- }
124
- };
125
- var RoleHues = {
126
- primary: {
127
- low: 73,
128
- high: 83,
129
- default: 0
130
- },
131
- secondary: {
132
- low: 14,
133
- high: 21,
134
- default: 0
135
- },
136
- tertiary: {
137
- low: 36,
138
- high: 41,
139
- default: 0
140
- },
141
- inverse: {
142
- low: 63,
143
- high: 100,
144
- default: 0
145
- },
146
- ghost: {
147
- low: 0,
148
- high: 0,
149
- default: 0
150
- },
151
- warn: {
152
- low: 320,
153
- high: 20,
154
- default: 0
155
- },
156
- alert: {
157
- low: 40,
158
- high: 70,
159
- default: 60
160
- },
161
- success: {
162
- low: 90,
163
- high: 150,
164
- default: 120
165
- },
166
- info: {
167
- low: 200,
168
- high: 260,
169
- default: 240
170
- }
171
- };
172
- //#endregion
173
- //#region src/concepts/color/color.utils.ts
174
- /**
175
- * @deprecated Randomized generation is superseded by the deterministic OKLCH
176
- * engine in `concepts/generation` — same input, same theme. Seeded "surprise
177
- * me" behavior belongs in the consumer (playground), not the engine.
178
- */
179
- var randomRangeValue = ({ low, high }) => {
180
- low = Math.ceil(low);
181
- high = Math.floor(high);
182
- return Math.floor(Math.random() * (high - low + 1)) + low;
183
- };
184
- var cycle = (angle) => {
185
- if (angle > 360) return angle - 360;
186
- if (angle < 0) return angle + 360;
187
- return angle;
188
- };
189
- var getAnalogousHues = (hue) => [cycle(hue + 30), cycle(hue + 60)];
190
- var getComplimentaryHue = (hue) => cycle(hue + 180);
191
- var getTriadicHues = (hue) => [cycle(hue + 120), cycle(hue - 120)];
192
- var getSplitComplimentaryHues = (hue) => [cycle(hue + 150), cycle(hue - 150)];
193
- /**
194
- * Derive the primary/secondary/tertiary hues from a seed hue using the color
195
- * wheel relationships in {@link ColorScheme}. Pure angle math — works in any
196
- * hue space (HSL historically, OKLCH in the generation engine).
197
- */
198
- var schemeHues = (hue, scheme) => {
199
- switch (scheme) {
200
- case "monochromatic": return {
201
- primary: hue,
202
- secondary: hue,
203
- tertiary: hue
204
- };
205
- case "analogous": {
206
- const [a, b] = getAnalogousHues(hue);
207
- return {
208
- primary: hue,
209
- secondary: a,
210
- tertiary: b
211
- };
212
- }
213
- case "complimentary": {
214
- const [a] = getAnalogousHues(hue);
215
- return {
216
- primary: hue,
217
- secondary: getComplimentaryHue(hue),
218
- tertiary: a
219
- };
220
- }
221
- case "splitComplimentary": {
222
- const [a, b] = getSplitComplimentaryHues(hue);
223
- return {
224
- primary: hue,
225
- secondary: a,
226
- tertiary: b
227
- };
228
- }
229
- case "triadic": {
230
- const [a, b] = getTriadicHues(hue);
231
- return {
232
- primary: hue,
233
- secondary: a,
234
- tertiary: b
235
- };
236
- }
237
- }
238
- };
239
- //#endregion
240
63
  //#region src/concepts/color/color.helper.ts
241
64
  function HSLAToString({ hue, saturation, lightness, alpha = 1 }) {
242
65
  return `hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha})`;
@@ -244,19 +67,6 @@ function HSLAToString({ hue, saturation, lightness, alpha = 1 }) {
244
67
  function RGBToString({ red, green, blue }) {
245
68
  return `rgb(${red}, ${green}, ${blue})`;
246
69
  }
247
- /**
248
- * @deprecated Random HSL generation produces non-deterministic, perceptually
249
- * uneven colors. Use the OKLCH engine (`generateThemes` in
250
- * `concepts/generation`) or `generatePalette` instead.
251
- */
252
- function uniColor({ role, category, alpha = 1 }) {
253
- return HSLAToString({
254
- hue: randomRangeValue(RoleHues[role]),
255
- saturation: randomRangeValue(CategorySaturation[category]),
256
- lightness: randomRangeValue(CategoryLightness[category]),
257
- alpha
258
- });
259
- }
260
70
  var RGBToHSL = ({ red, green, blue }) => {
261
71
  red /= 255;
262
72
  green /= 255;
@@ -340,6 +150,63 @@ var contrastRatio = (a, b) => {
340
150
  return (hi + .05) / (lo + .05);
341
151
  };
342
152
  //#endregion
153
+ //#region src/concepts/color/color.utils.ts
154
+ var cycle = (angle) => {
155
+ if (angle > 360) return angle - 360;
156
+ if (angle < 0) return angle + 360;
157
+ return angle;
158
+ };
159
+ var getAnalogousHues = (hue) => [cycle(hue + 30), cycle(hue + 60)];
160
+ var getComplimentaryHue = (hue) => cycle(hue + 180);
161
+ var getTriadicHues = (hue) => [cycle(hue + 120), cycle(hue - 120)];
162
+ var getSplitComplimentaryHues = (hue) => [cycle(hue + 150), cycle(hue - 150)];
163
+ /**
164
+ * Derive the primary/secondary/tertiary hues from a seed hue using the color
165
+ * wheel relationships in {@link ColorScheme}. Pure angle math — works in any
166
+ * hue space (HSL historically, OKLCH in the generation engine).
167
+ */
168
+ var schemeHues = (hue, scheme) => {
169
+ switch (scheme) {
170
+ case "monochromatic": return {
171
+ primary: hue,
172
+ secondary: hue,
173
+ tertiary: hue
174
+ };
175
+ case "analogous": {
176
+ const [a, b] = getAnalogousHues(hue);
177
+ return {
178
+ primary: hue,
179
+ secondary: a,
180
+ tertiary: b
181
+ };
182
+ }
183
+ case "complimentary": {
184
+ const [a] = getAnalogousHues(hue);
185
+ return {
186
+ primary: hue,
187
+ secondary: getComplimentaryHue(hue),
188
+ tertiary: a
189
+ };
190
+ }
191
+ case "splitComplimentary": {
192
+ const [a, b] = getSplitComplimentaryHues(hue);
193
+ return {
194
+ primary: hue,
195
+ secondary: a,
196
+ tertiary: b
197
+ };
198
+ }
199
+ case "triadic": {
200
+ const [a, b] = getTriadicHues(hue);
201
+ return {
202
+ primary: hue,
203
+ secondary: a,
204
+ tertiary: b
205
+ };
206
+ }
207
+ }
208
+ };
209
+ //#endregion
343
210
  //#region src/concepts/generation/oklch.helper.ts
344
211
  var clamp$1 = (value, min, max) => Math.min(max, Math.max(min, value));
345
212
  var srgbToLinear = (channel) => channel <= .04045 ? channel / 12.92 : Math.pow((channel + .055) / 1.055, 2.4);
@@ -1119,13 +986,51 @@ var BaseSpacing = {
1119
986
  sm: "8px",
1120
987
  md: "16px",
1121
988
  lg: "32px",
1122
- xl: "64px"
989
+ xl: "64px",
990
+ xxl: "128px"
1123
991
  };
1124
992
  var BaseThicknesses = {
1125
993
  thin: 1,
1126
994
  standard: 2,
1127
995
  thick: 4
1128
996
  };
997
+ /**
998
+ * Shared motion timing, named by what moves rather than by how fast:
999
+ * a small panel attached to a control snaps (`popup`), a larger free-floating
1000
+ * surface settles (`panel`), content growing in place eases at both ends
1001
+ * (`reveal`), a transient message arrives and leaves under its own steam
1002
+ * (`notification`), and a control answering a pointer should feel immediate
1003
+ * (`control`).
1004
+ *
1005
+ * Fast and linear is deliberate for `popup`. It is the timing every
1006
+ * trigger-anchored panel in the library uses — dropdown, menu, multi-select
1007
+ * and the combobox-style listboxes — so a form full of them opens uniformly;
1008
+ * at 100ms an easing curve is imperceptible anyway, and linear avoids the
1009
+ * lag a slow-in curve adds to something the user is waiting on.
1010
+ */
1011
+ var BaseMotion = {
1012
+ popup: {
1013
+ duration: 100,
1014
+ easing: "linear",
1015
+ scale: .8
1016
+ },
1017
+ panel: {
1018
+ duration: 250,
1019
+ easing: "ease"
1020
+ },
1021
+ reveal: {
1022
+ duration: 350,
1023
+ easing: "ease-in-out"
1024
+ },
1025
+ notification: {
1026
+ duration: 350,
1027
+ easing: "ease-in-out"
1028
+ },
1029
+ control: {
1030
+ duration: 300,
1031
+ easing: "ease"
1032
+ }
1033
+ };
1129
1034
  var BaseRadii = {
1130
1035
  none: "none",
1131
1036
  xxs: "4px",
@@ -1169,7 +1074,7 @@ var buildComponents = (c) => ({
1169
1074
  alert: { options: {
1170
1075
  topPosition: 40,
1171
1076
  borderRadius: "sm",
1172
- transitionSpeed: .35,
1077
+ motion: "notification",
1173
1078
  elevation: "md"
1174
1079
  } },
1175
1080
  breadcrumb: { options: {
@@ -1275,7 +1180,7 @@ var buildComponents = (c) => ({
1275
1180
  size: 20,
1276
1181
  ringColor: "outline",
1277
1182
  fillColor: "surface",
1278
- transitionSpeed: .3
1183
+ motion: "control"
1279
1184
  } },
1280
1185
  dialog: { options: {
1281
1186
  borderRadius: "lg",
@@ -1312,7 +1217,8 @@ var buildComponents = (c) => ({
1312
1217
  border: "none",
1313
1218
  borderRadius: "xxs",
1314
1219
  color: "primary-surface",
1315
- shadow: "menu"
1220
+ shadow: "menu",
1221
+ motion: "popup"
1316
1222
  } },
1317
1223
  menu: { options: {
1318
1224
  minWidth: 184,
@@ -1335,7 +1241,7 @@ var buildComponents = (c) => ({
1335
1241
  textColor: void 0,
1336
1242
  hoverColor: "primary-container",
1337
1243
  activeSymbol: "check",
1338
- transitionSpeed: .35
1244
+ motion: "control"
1339
1245
  },
1340
1246
  variants: { warn: {
1341
1247
  color: c.warn,
@@ -1359,9 +1265,10 @@ var buildComponents = (c) => ({
1359
1265
  headerTypeface: "title-small",
1360
1266
  tooltipPadding: "4px 8px",
1361
1267
  tooltipOpenDelay: 500,
1362
- tooltipCloseDelay: 150
1268
+ tooltipCloseDelay: 150,
1269
+ motion: "panel"
1363
1270
  } },
1364
- expand: { options: { transitionSpeed: .35 } },
1271
+ expand: { options: { motion: "reveal" } },
1365
1272
  footer: { options: {
1366
1273
  height: 52,
1367
1274
  color: "primary",
@@ -1822,11 +1729,13 @@ var buildComponents = (c) => ({
1822
1729
  borderRadius: "xs",
1823
1730
  animation: "shimmer",
1824
1731
  duration: 1.4,
1732
+ direction: "ltr",
1733
+ highlightWidth: 40,
1825
1734
  gap: "sm"
1826
1735
  } },
1827
1736
  snackbar: { options: {
1828
1737
  bottomPosition: 40,
1829
- transitionDelay: "0.35s",
1738
+ motion: "notification",
1830
1739
  autoCloseDelay: 35e3
1831
1740
  } },
1832
1741
  symbol: { options: {
@@ -1862,7 +1771,7 @@ var buildComponents = (c) => ({
1862
1771
  spotlightPadding: 6,
1863
1772
  spotlightRadius: "xs",
1864
1773
  ringWidth: 2,
1865
- transitionMs: 250
1774
+ motion: "panel"
1866
1775
  } },
1867
1776
  tour: { options: {
1868
1777
  progressStyle: "dots",
@@ -1876,7 +1785,7 @@ var deepMerge = (base, override) => {
1876
1785
  for (const [key, value] of Object.entries(override)) out[key] = isRecord$1(value) && isRecord$1(out[key]) ? deepMerge(out[key], value) : value;
1877
1786
  return out;
1878
1787
  };
1879
- var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows = BaseShadows, typography, borders, thicknesses, components }) => ({
1788
+ var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows = BaseShadows, motion, typography, borders, thicknesses, spacing, components }) => ({
1880
1789
  id,
1881
1790
  name,
1882
1791
  colors,
@@ -1884,7 +1793,14 @@ var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows =
1884
1793
  borders: deepMerge(buildBorders(colors), borders),
1885
1794
  radii,
1886
1795
  shadows,
1887
- spacing: BaseSpacing,
1796
+ spacing: {
1797
+ ...BaseSpacing,
1798
+ ...spacing
1799
+ },
1800
+ motion: {
1801
+ ...BaseMotion,
1802
+ ...motion
1803
+ },
1888
1804
  thicknesses: {
1889
1805
  ...BaseThicknesses,
1890
1806
  ...thicknesses
@@ -2133,6 +2049,7 @@ var themeExport = (exportName, displayName, colorsConst, shadowsConst, radii) =>
2133
2049
  ` shadows: ${shadowsConst},`,
2134
2050
  " icons,",
2135
2051
  ...radii ? [" radii,"] : [],
2052
+ " spacing,",
2136
2053
  "});"
2137
2054
  ].join("\n");
2138
2055
  /**
@@ -2188,6 +2105,7 @@ var emitThemeFile = (input) => {
2188
2105
  " type ComponentThemes,",
2189
2106
  " type Icons,",
2190
2107
  " type Shadows,",
2108
+ " type Spacing,",
2191
2109
  " type UniTheme,",
2192
2110
  "} from '@uni-design-system/uni-core';",
2193
2111
  "",
@@ -2224,6 +2142,15 @@ var emitThemeFile = (input) => {
2224
2142
  " */",
2225
2143
  "const icons: Icons = {};",
2226
2144
  "",
2145
+ "/**",
2146
+ " * Spacing steps, merged over the base scale",
2147
+ " * (none: 0, xxs: 2px, xs: 4px, sm: 8px, md: 16px, lg: 32px, xl: 64px, xxl: 128px).",
2148
+ " * Restate a named step to retune the rhythm, and add your own names for the",
2149
+ " * gaps your design actually uses — every extra key is then a valid `padding`,",
2150
+ " * `gap` or `marginInline` value: `<div stack-layout gap='tight'>`.",
2151
+ " */",
2152
+ "const spacing: Spacing = {};",
2153
+ "",
2227
2154
  ...radii ? [
2228
2155
  `/** Shape language: '${input.shape}'. */`,
2229
2156
  `const radii = {\n${recordLiteral(radii, " ")}\n};`,
@@ -2731,8 +2658,6 @@ exports.BASE_PALETTE_CONFIG = BASE_PALETTE_CONFIG;
2731
2658
  exports.BaseIcons = BaseIcons;
2732
2659
  exports.BaseTheme = BaseTheme;
2733
2660
  exports.CategoryChroma = CategoryChroma;
2734
- exports.CategoryLightness = CategoryLightness;
2735
- exports.CategorySaturation = CategorySaturation;
2736
2661
  exports.DarkTheme = DarkTheme;
2737
2662
  exports.DefaultThemeId = DefaultThemeId;
2738
2663
  exports.EXPAND_DEFAULT_SPEED = EXPAND_DEFAULT_SPEED;
@@ -2753,7 +2678,6 @@ exports.REQUIRED_TEXT_ROLES = REQUIRED_TEXT_ROLES;
2753
2678
  exports.REQUIRED_THICKNESSES = REQUIRED_THICKNESSES;
2754
2679
  exports.RGBToHSL = RGBToHSL;
2755
2680
  exports.RGBToString = RGBToString;
2756
- exports.RoleHues = RoleHues;
2757
2681
  exports.ShadowCssMap = ShadowCssMap;
2758
2682
  exports.ShadowMap = ShadowMap;
2759
2683
  exports.ShapeRadii = ShapeRadii;
@@ -2798,7 +2722,6 @@ exports.isUniTheme = isUniTheme;
2798
2722
  exports.lightColors = lightColors;
2799
2723
  exports.oklchToHex = oklchToHex;
2800
2724
  exports.parseTheme = parseTheme;
2801
- exports.randomRangeValue = randomRangeValue;
2802
2725
  exports.relativeLuminance = relativeLuminance;
2803
2726
  exports.removeInputPlatformStyling = removeInputPlatformStyling;
2804
2727
  exports.rgbToHex = rgbToHex;
@@ -2807,6 +2730,5 @@ exports.summarizeContrast = summarizeContrast;
2807
2730
  exports.svgToIconUri = svgToIconUri;
2808
2731
  exports.toTypeface = toTypeface;
2809
2732
  exports.toTypefaces = toTypefaces;
2810
- exports.uniColor = uniColor;
2811
2733
 
2812
2734
  //# sourceMappingURL=index.cjs.map