@uni-design-system/uni-angular 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uni-design-system/uni-angular",
3
- "version": "8.3.1",
3
+ "version": "9.0.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,7 +22,7 @@
22
22
  "@angular/core": "^21.2.0",
23
23
  "@angular/forms": "^21.2.0",
24
24
  "@emotion/css": "^11.0.0",
25
- "@uni-design-system/uni-core": "^8.3.1"
25
+ "@uni-design-system/uni-core": "^9.0.0"
26
26
  },
27
27
  "module": "fesm2022/uni-design-system-uni-angular.mjs",
28
28
  "typings": "types/uni-design-system-uni-angular.d.ts",
@@ -15,6 +15,34 @@ var EXPAND_MIN_DURATION = .15;
15
15
  var EXPAND_MAX_DURATION = .6;
16
16
  EXPAND_MIN_DURATION / EXPAND_DEFAULT_SPEED;
17
17
  EXPAND_MAX_DURATION / EXPAND_DEFAULT_SPEED;
18
+ var clamp$2 = (value, min, max) => Math.min(max, Math.max(min, value));
19
+ var toHex2 = (value) => clamp$2(Math.round(value), 0, 255).toString(16).padStart(2, "0");
20
+ var rgbToHex = ({ red, green, blue }) => `#${toHex2(red)}${toHex2(green)}${toHex2(blue)}`.toUpperCase();
21
+ var hexToRgb = (hex) => {
22
+ let h = hex.replace("#", "").trim();
23
+ if (h.length === 3) h = h.split("").map((c) => c + c).join("");
24
+ const int = parseInt(h, 16);
25
+ return {
26
+ red: int >> 16 & 255,
27
+ green: int >> 8 & 255,
28
+ blue: int & 255
29
+ };
30
+ };
31
+ /** WCAG relative luminance of an sRGB color (0 = black, 1 = white). */
32
+ var relativeLuminance = ({ red, green, blue }) => {
33
+ const channel = (value) => {
34
+ const v = value / 255;
35
+ return v <= .03928 ? v / 12.92 : Math.pow((v + .055) / 1.055, 2.4);
36
+ };
37
+ return .2126 * channel(red) + .7152 * channel(green) + .0722 * channel(blue);
38
+ };
39
+ /** WCAG contrast ratio between two colors (1:1 – 21:1). Accepts RGB or hex. */
40
+ var contrastRatio = (a, b) => {
41
+ const la = relativeLuminance(typeof a === "string" ? hexToRgb(a) : a);
42
+ const lb = relativeLuminance(typeof b === "string" ? hexToRgb(b) : b);
43
+ const [hi, lo] = la > lb ? [la, lb] : [lb, la];
44
+ return (hi + .05) / (lo + .05);
45
+ };
18
46
  var cycle = (angle) => {
19
47
  if (angle > 360) return angle - 360;
20
48
  if (angle < 0) return angle + 360;
@@ -70,34 +98,6 @@ var schemeHues = (hue, scheme) => {
70
98
  }
71
99
  }
72
100
  };
73
- var clamp$2 = (value, min, max) => Math.min(max, Math.max(min, value));
74
- var toHex2 = (value) => clamp$2(Math.round(value), 0, 255).toString(16).padStart(2, "0");
75
- var rgbToHex = ({ red, green, blue }) => `#${toHex2(red)}${toHex2(green)}${toHex2(blue)}`.toUpperCase();
76
- var hexToRgb = (hex) => {
77
- let h = hex.replace("#", "").trim();
78
- if (h.length === 3) h = h.split("").map((c) => c + c).join("");
79
- const int = parseInt(h, 16);
80
- return {
81
- red: int >> 16 & 255,
82
- green: int >> 8 & 255,
83
- blue: int & 255
84
- };
85
- };
86
- /** WCAG relative luminance of an sRGB color (0 = black, 1 = white). */
87
- var relativeLuminance = ({ red, green, blue }) => {
88
- const channel = (value) => {
89
- const v = value / 255;
90
- return v <= .03928 ? v / 12.92 : Math.pow((v + .055) / 1.055, 2.4);
91
- };
92
- return .2126 * channel(red) + .7152 * channel(green) + .0722 * channel(blue);
93
- };
94
- /** WCAG contrast ratio between two colors (1:1 – 21:1). Accepts RGB or hex. */
95
- var contrastRatio = (a, b) => {
96
- const la = relativeLuminance(typeof a === "string" ? hexToRgb(a) : a);
97
- const lb = relativeLuminance(typeof b === "string" ? hexToRgb(b) : b);
98
- const [hi, lo] = la > lb ? [la, lb] : [lb, la];
99
- return (hi + .05) / (lo + .05);
100
- };
101
101
  var clamp$1 = (value, min, max) => Math.min(max, Math.max(min, value));
102
102
  var srgbToLinear = (channel) => channel <= .04045 ? channel / 12.92 : Math.pow((channel + .055) / 1.055, 2.4);
103
103
  var linearToSrgb = (channel) => channel <= .0031308 ? 12.92 * channel : 1.055 * Math.pow(channel, 1 / 2.4) - .055;
@@ -830,13 +830,51 @@ var BaseSpacing = {
830
830
  sm: "8px",
831
831
  md: "16px",
832
832
  lg: "32px",
833
- xl: "64px"
833
+ xl: "64px",
834
+ xxl: "128px"
834
835
  };
835
836
  var BaseThicknesses = {
836
837
  thin: 1,
837
838
  standard: 2,
838
839
  thick: 4
839
840
  };
841
+ /**
842
+ * Shared motion timing, named by what moves rather than by how fast:
843
+ * a small panel attached to a control snaps (`popup`), a larger free-floating
844
+ * surface settles (`panel`), content growing in place eases at both ends
845
+ * (`reveal`), a transient message arrives and leaves under its own steam
846
+ * (`notification`), and a control answering a pointer should feel immediate
847
+ * (`control`).
848
+ *
849
+ * Fast and linear is deliberate for `popup`. It is the timing every
850
+ * trigger-anchored panel in the library uses — dropdown, menu, multi-select
851
+ * and the combobox-style listboxes — so a form full of them opens uniformly;
852
+ * at 100ms an easing curve is imperceptible anyway, and linear avoids the
853
+ * lag a slow-in curve adds to something the user is waiting on.
854
+ */
855
+ var BaseMotion = {
856
+ popup: {
857
+ duration: 100,
858
+ easing: "linear",
859
+ scale: .8
860
+ },
861
+ panel: {
862
+ duration: 250,
863
+ easing: "ease"
864
+ },
865
+ reveal: {
866
+ duration: 350,
867
+ easing: "ease-in-out"
868
+ },
869
+ notification: {
870
+ duration: 350,
871
+ easing: "ease-in-out"
872
+ },
873
+ control: {
874
+ duration: 300,
875
+ easing: "ease"
876
+ }
877
+ };
840
878
  var BaseRadii = {
841
879
  none: "none",
842
880
  xxs: "4px",
@@ -880,7 +918,7 @@ var buildComponents = (c) => ({
880
918
  alert: { options: {
881
919
  topPosition: 40,
882
920
  borderRadius: "sm",
883
- transitionSpeed: .35,
921
+ motion: "notification",
884
922
  elevation: "md"
885
923
  } },
886
924
  breadcrumb: { options: {
@@ -986,7 +1024,7 @@ var buildComponents = (c) => ({
986
1024
  size: 20,
987
1025
  ringColor: "outline",
988
1026
  fillColor: "surface",
989
- transitionSpeed: .3
1027
+ motion: "control"
990
1028
  } },
991
1029
  dialog: { options: {
992
1030
  borderRadius: "lg",
@@ -1023,7 +1061,8 @@ var buildComponents = (c) => ({
1023
1061
  border: "none",
1024
1062
  borderRadius: "xxs",
1025
1063
  color: "primary-surface",
1026
- shadow: "menu"
1064
+ shadow: "menu",
1065
+ motion: "popup"
1027
1066
  } },
1028
1067
  menu: { options: {
1029
1068
  minWidth: 184,
@@ -1046,7 +1085,7 @@ var buildComponents = (c) => ({
1046
1085
  textColor: void 0,
1047
1086
  hoverColor: "primary-container",
1048
1087
  activeSymbol: "check",
1049
- transitionSpeed: .35
1088
+ motion: "control"
1050
1089
  },
1051
1090
  variants: { warn: {
1052
1091
  color: c.warn,
@@ -1070,9 +1109,10 @@ var buildComponents = (c) => ({
1070
1109
  headerTypeface: "title-small",
1071
1110
  tooltipPadding: "4px 8px",
1072
1111
  tooltipOpenDelay: 500,
1073
- tooltipCloseDelay: 150
1112
+ tooltipCloseDelay: 150,
1113
+ motion: "panel"
1074
1114
  } },
1075
- expand: { options: { transitionSpeed: .35 } },
1115
+ expand: { options: { motion: "reveal" } },
1076
1116
  footer: { options: {
1077
1117
  height: 52,
1078
1118
  color: "primary",
@@ -1533,11 +1573,13 @@ var buildComponents = (c) => ({
1533
1573
  borderRadius: "xs",
1534
1574
  animation: "shimmer",
1535
1575
  duration: 1.4,
1576
+ direction: "ltr",
1577
+ highlightWidth: 40,
1536
1578
  gap: "sm"
1537
1579
  } },
1538
1580
  snackbar: { options: {
1539
1581
  bottomPosition: 40,
1540
- transitionDelay: "0.35s",
1582
+ motion: "notification",
1541
1583
  autoCloseDelay: 35e3
1542
1584
  } },
1543
1585
  symbol: { options: {
@@ -1573,7 +1615,7 @@ var buildComponents = (c) => ({
1573
1615
  spotlightPadding: 6,
1574
1616
  spotlightRadius: "xs",
1575
1617
  ringWidth: 2,
1576
- transitionMs: 250
1618
+ motion: "panel"
1577
1619
  } },
1578
1620
  tour: { options: {
1579
1621
  progressStyle: "dots",
@@ -1587,7 +1629,7 @@ var deepMerge = (base, override) => {
1587
1629
  for (const [key, value] of Object.entries(override)) out[key] = isRecord$1(value) && isRecord$1(out[key]) ? deepMerge(out[key], value) : value;
1588
1630
  return out;
1589
1631
  };
1590
- var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows = BaseShadows, typography, borders, thicknesses, components }) => ({
1632
+ var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows = BaseShadows, motion, typography, borders, thicknesses, spacing, components }) => ({
1591
1633
  id,
1592
1634
  name,
1593
1635
  colors,
@@ -1595,7 +1637,14 @@ var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows =
1595
1637
  borders: deepMerge(buildBorders(colors), borders),
1596
1638
  radii,
1597
1639
  shadows,
1598
- spacing: BaseSpacing,
1640
+ spacing: {
1641
+ ...BaseSpacing,
1642
+ ...spacing
1643
+ },
1644
+ motion: {
1645
+ ...BaseMotion,
1646
+ ...motion
1647
+ },
1599
1648
  thicknesses: {
1600
1649
  ...BaseThicknesses,
1601
1650
  ...thicknesses
@@ -1772,6 +1821,7 @@ var themeExport = (exportName, displayName, colorsConst, shadowsConst, radii) =>
1772
1821
  ` shadows: ${shadowsConst},`,
1773
1822
  " icons,",
1774
1823
  ...radii ? [" radii,"] : [],
1824
+ " spacing,",
1775
1825
  "});"
1776
1826
  ].join("\n");
1777
1827
  /**
@@ -1827,6 +1877,7 @@ var emitThemeFile = (input) => {
1827
1877
  " type ComponentThemes,",
1828
1878
  " type Icons,",
1829
1879
  " type Shadows,",
1880
+ " type Spacing,",
1830
1881
  " type UniTheme,",
1831
1882
  "} from '@uni-design-system/uni-core';",
1832
1883
  "",
@@ -1863,6 +1914,15 @@ var emitThemeFile = (input) => {
1863
1914
  " */",
1864
1915
  "const icons: Icons = {};",
1865
1916
  "",
1917
+ "/**",
1918
+ " * Spacing steps, merged over the base scale",
1919
+ " * (none: 0, xxs: 2px, xs: 4px, sm: 8px, md: 16px, lg: 32px, xl: 64px, xxl: 128px).",
1920
+ " * Restate a named step to retune the rhythm, and add your own names for the",
1921
+ " * gaps your design actually uses — every extra key is then a valid `padding`,",
1922
+ " * `gap` or `marginInline` value: `<div stack-layout gap='tight'>`.",
1923
+ " */",
1924
+ "const spacing: Spacing = {};",
1925
+ "",
1866
1926
  ...radii ? [
1867
1927
  `/** Shape language: '${input.shape}'. */`,
1868
1928
  `const radii = {\n${recordLiteral(radii, " ")}\n};`,
@@ -1975,7 +2035,7 @@ var UniThemes = {
1975
2035
  Object.keys(UniThemes)[0];
1976
2036
  //#endregion
1977
2037
  //#region package.json
1978
- var version = "8.3.1";
2038
+ var version = "9.0.0";
1979
2039
  //#endregion
1980
2040
  //#region schematics-src/ng-add/transforms.ts
1981
2041
  var addDependencies = (packageJsonText, deps) => {