@uni-design-system/uni-angular 8.4.0 → 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.4.0",
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.4.0"
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,7 +830,8 @@ 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,
@@ -1628,7 +1629,7 @@ var deepMerge = (base, override) => {
1628
1629
  for (const [key, value] of Object.entries(override)) out[key] = isRecord$1(value) && isRecord$1(out[key]) ? deepMerge(out[key], value) : value;
1629
1630
  return out;
1630
1631
  };
1631
- var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows = BaseShadows, motion, typography, borders, thicknesses, components }) => ({
1632
+ var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows = BaseShadows, motion, typography, borders, thicknesses, spacing, components }) => ({
1632
1633
  id,
1633
1634
  name,
1634
1635
  colors,
@@ -1636,7 +1637,10 @@ var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows =
1636
1637
  borders: deepMerge(buildBorders(colors), borders),
1637
1638
  radii,
1638
1639
  shadows,
1639
- spacing: BaseSpacing,
1640
+ spacing: {
1641
+ ...BaseSpacing,
1642
+ ...spacing
1643
+ },
1640
1644
  motion: {
1641
1645
  ...BaseMotion,
1642
1646
  ...motion
@@ -1817,6 +1821,7 @@ var themeExport = (exportName, displayName, colorsConst, shadowsConst, radii) =>
1817
1821
  ` shadows: ${shadowsConst},`,
1818
1822
  " icons,",
1819
1823
  ...radii ? [" radii,"] : [],
1824
+ " spacing,",
1820
1825
  "});"
1821
1826
  ].join("\n");
1822
1827
  /**
@@ -1872,6 +1877,7 @@ var emitThemeFile = (input) => {
1872
1877
  " type ComponentThemes,",
1873
1878
  " type Icons,",
1874
1879
  " type Shadows,",
1880
+ " type Spacing,",
1875
1881
  " type UniTheme,",
1876
1882
  "} from '@uni-design-system/uni-core';",
1877
1883
  "",
@@ -1908,6 +1914,15 @@ var emitThemeFile = (input) => {
1908
1914
  " */",
1909
1915
  "const icons: Icons = {};",
1910
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
+ "",
1911
1926
  ...radii ? [
1912
1927
  `/** Shape language: '${input.shape}'. */`,
1913
1928
  `const radii = {\n${recordLiteral(radii, " ")}\n};`,
@@ -2020,7 +2035,7 @@ var UniThemes = {
2020
2035
  Object.keys(UniThemes)[0];
2021
2036
  //#endregion
2022
2037
  //#region package.json
2023
- var version = "8.4.0";
2038
+ var version = "9.0.0";
2024
2039
  //#endregion
2025
2040
  //#region schematics-src/ng-add/transforms.ts
2026
2041
  var addDependencies = (packageJsonText, deps) => {