@uni-design-system/uni-angular 7.2.0 → 8.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": "7.2.0",
3
+ "version": "8.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": "^7.2.0"
25
+ "@uni-design-system/uni-core": "^8.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",
@@ -2,6 +2,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let _angular_devkit_schematics = require("@angular-devkit/schematics");
3
3
  let _angular_devkit_schematics_tasks = require("@angular-devkit/schematics/tasks");
4
4
  //#region ../core/dist/esm/index.js
5
+ /** Duration (seconds) the default theme assigns `expand`'s `transitionSpeed`. */
6
+ var EXPAND_DEFAULT_SPEED = .35;
7
+ /**
8
+ * Duration envelope at the default speed. A tiny region never blinks past
9
+ * faster than the min; a full-page region never drags longer than the max.
10
+ * Expressed at `EXPAND_DEFAULT_SPEED` and applied as scale-factor clamps, so a
11
+ * theme that slows `transitionSpeed` down widens its envelope proportionally
12
+ * instead of being capped back to the stock feel.
13
+ */
14
+ var EXPAND_MIN_DURATION = .15;
15
+ var EXPAND_MAX_DURATION = .6;
16
+ EXPAND_MIN_DURATION / EXPAND_DEFAULT_SPEED;
17
+ EXPAND_MAX_DURATION / EXPAND_DEFAULT_SPEED;
5
18
  var cycle = (angle) => {
6
19
  if (angle > 360) return angle - 360;
7
20
  if (angle < 0) return angle + 360;
@@ -631,6 +644,23 @@ var BaseIcons = {
631
644
  logout: "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-21h268.07v60H212.31q-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.85h268.07v60H212.31Zm436.92-169.23-41.54-43.39L705.08-450H363.85v-60h341.23l-97.39-97.38 41.54-43.39L820-480 649.23-309.23Z'/%3e%3c/svg%3e",
632
645
  spinner: "data:image/svg+xml;charset=UTF-8,%3csvg stroke='%23000' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' %3e%3cstyle%3e .oui_spinner %7b transform-origin: center; animation: rotate_360 2s linear infinite;%7d .oui_spinner circle %7b stroke-linecap: round; animation: dash 1.5s ease-in-out infinite;%7d %40keyframes rotate_360 %7b 100%25 %7b transform: rotate(360deg);%7d %7d %40keyframes dash %7b 0%25 %7b stroke-dasharray: 0 150; stroke-dashoffset: 0;%7d 47.5%25 %7b stroke-dasharray: 42 150; stroke-dashoffset: -16;%7d 95%25, 100%25 %7b stroke-dasharray: 42 150; stroke-dashoffset: -59;%7d %7d %3c/style%3e%3cg class='oui_spinner'%3e%3ccircle cx='12' cy='12' r='9.5' fill='none' stroke-width='3'%3e%3c/circle%3e%3c/g%3e%3c/svg%3e "
633
646
  };
647
+ /**
648
+ * The highlight state for roving-focus composites (menus, and any other widget
649
+ * that moves focus programmatically): pointer hover, or focus the user drove
650
+ * from the keyboard.
651
+ *
652
+ * Why not plain `:focus` — a roving-focus composite calls `.focus()` on an item
653
+ * every time it opens, including pointer opens, and `:focus` would paint that
654
+ * as a highlight the mouse user never asked for, reading as a preselected
655
+ * item. `:focus-visible` excludes programmatic focus that follows a click while
656
+ * still matching keyboard navigation.
657
+ *
658
+ * Shared as a constant because Emotion merges styles by **exact selector
659
+ * text**: a component's base rule and any theme variant restyling that rule
660
+ * must key both with this value, or the variant silently fails to override and
661
+ * reintroduces the phantom highlight.
662
+ */
663
+ var HOVER_OR_KEYBOARD_FOCUS = "&:hover, &:focus-visible";
634
664
  var BaseTypography = {
635
665
  "display-large": {
636
666
  fontFamily: "Red Hat Display",
@@ -827,6 +857,25 @@ var buildBorders = (c) => ({
827
857
  dark: `1px solid ${c["on-background"]}`,
828
858
  dotted: `1px dotted ${c["on-background"]}`
829
859
  });
860
+ /**
861
+ * One tag colour role across all three tones. `soft` is the resting look (the
862
+ * container pair), `solid` fills with the role itself, `outline` keeps the
863
+ * surface and draws the edge — so every role stays consistent and a theme can
864
+ * still override any single cell.
865
+ */
866
+ var tagVariant = (c, role) => ({ [role]: {
867
+ backgroundColor: c[`${role}-container`],
868
+ color: c[`on-${role}-container`],
869
+ "&.tone-solid": {
870
+ backgroundColor: c[role],
871
+ color: c[`on-${role}`]
872
+ },
873
+ "&.tone-outline": {
874
+ backgroundColor: "transparent",
875
+ color: c[role],
876
+ borderColor: c[`on-${role}-container-border`] ?? c[role]
877
+ }
878
+ } });
830
879
  var buildComponents = (c) => ({
831
880
  alert: { options: {
832
881
  topPosition: 40,
@@ -972,6 +1021,38 @@ var buildComponents = (c) => ({
972
1021
  color: "primary-surface",
973
1022
  shadow: "menu"
974
1023
  } },
1024
+ menu: { options: {
1025
+ minWidth: 184,
1026
+ color: void 0,
1027
+ border: void 0,
1028
+ borderRadius: void 0,
1029
+ shadow: void 0,
1030
+ paddingVertical: "xs",
1031
+ paddingHorizontal: "none",
1032
+ dividerBorder: "light",
1033
+ dividerSpacing: "xs"
1034
+ } },
1035
+ menuItem: {
1036
+ options: {
1037
+ height: 38,
1038
+ paddingHorizontal: "md",
1039
+ gap: "md",
1040
+ borderRadius: "none",
1041
+ typeface: "label",
1042
+ textColor: void 0,
1043
+ hoverColor: "primary-container",
1044
+ activeSymbol: "check",
1045
+ transitionSpeed: .35
1046
+ },
1047
+ variants: { warn: {
1048
+ color: c.warn,
1049
+ [HOVER_OR_KEYBOARD_FOCUS]: {
1050
+ backgroundColor: c["warn-container"],
1051
+ color: c["on-warn-container"]
1052
+ }
1053
+ } }
1054
+ },
1055
+ expand: { options: { transitionSpeed: .35 } },
975
1056
  footer: { options: {
976
1057
  height: 52,
977
1058
  color: "primary",
@@ -1019,6 +1100,79 @@ var buildComponents = (c) => ({
1019
1100
  focusOutlineOffset: 2
1020
1101
  } },
1021
1102
  badge: { options: { borderRadius: "xxs" } },
1103
+ tag: {
1104
+ options: {
1105
+ borderRadius: "max",
1106
+ typeface: "tag",
1107
+ gap: "xs",
1108
+ removeIcon: "close",
1109
+ selectedIcon: "check"
1110
+ },
1111
+ fixed: {
1112
+ display: "inline-flex",
1113
+ alignItems: "center",
1114
+ maxWidth: "100%",
1115
+ border: "1px solid transparent",
1116
+ transition: "background-color .2s ease, color .2s ease"
1117
+ },
1118
+ variants: {
1119
+ ...tagVariant(c, "primary"),
1120
+ ...tagVariant(c, "secondary"),
1121
+ ...tagVariant(c, "tertiary"),
1122
+ ...tagVariant(c, "warn"),
1123
+ ...tagVariant(c, "success"),
1124
+ ghost: {
1125
+ backgroundColor: "transparent",
1126
+ color: c["on-background"],
1127
+ "&.tone-solid": {
1128
+ backgroundColor: c["surface-variant"],
1129
+ color: c["on-surface-variant"]
1130
+ },
1131
+ "&.tone-outline": {
1132
+ backgroundColor: "transparent",
1133
+ borderColor: c.outline
1134
+ }
1135
+ },
1136
+ disabled: {
1137
+ backgroundColor: c["disabled-container"],
1138
+ color: c["on-disabled"],
1139
+ "&.tone-solid": {
1140
+ backgroundColor: c.disabled,
1141
+ color: c["on-disabled"]
1142
+ },
1143
+ "&.tone-outline": {
1144
+ backgroundColor: "transparent",
1145
+ borderColor: c.disabled
1146
+ }
1147
+ }
1148
+ },
1149
+ sizes: {
1150
+ sm: {
1151
+ height: 20,
1152
+ fontSize: 12,
1153
+ padding: "0 8px"
1154
+ },
1155
+ md: {
1156
+ height: 24,
1157
+ fontSize: 13,
1158
+ padding: "0 10px"
1159
+ },
1160
+ lg: {
1161
+ height: 32,
1162
+ fontSize: 15,
1163
+ padding: "0 12px"
1164
+ }
1165
+ }
1166
+ },
1167
+ tagInput: { options: {
1168
+ chipGap: "xs",
1169
+ chipSize: "md",
1170
+ minInputWidth: "12ch",
1171
+ listColor: "primary-surface",
1172
+ listShadow: "menu",
1173
+ listBorderRadius: "xs",
1174
+ maxSuggestions: 8
1175
+ } },
1022
1176
  button: {
1023
1177
  options: {
1024
1178
  borderRadius: "max",
@@ -1322,11 +1476,11 @@ var buildComponents = (c) => ({
1322
1476
  typeface: "label"
1323
1477
  } }
1324
1478
  });
1325
- var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1479
+ var isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1326
1480
  var deepMerge = (base, override) => {
1327
1481
  if (!override) return base;
1328
1482
  const out = { ...base };
1329
- for (const [key, value] of Object.entries(override)) out[key] = isRecord(value) && isRecord(out[key]) ? deepMerge(out[key], value) : value;
1483
+ for (const [key, value] of Object.entries(override)) out[key] = isRecord$1(value) && isRecord$1(out[key]) ? deepMerge(out[key], value) : value;
1330
1484
  return out;
1331
1485
  };
1332
1486
  var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows = BaseShadows, borders, components }) => ({
@@ -1474,6 +1628,11 @@ var generateThemes = (input) => {
1474
1628
  }
1475
1629
  };
1476
1630
  };
1631
+ /**
1632
+ * One-line human summary of a {@link ContrastReport}. Shared so the generated
1633
+ * theme file's header and the MCP's theme tools report identical wording.
1634
+ */
1635
+ var summarizeContrast = (report) => `${report.checks.length} contrast pairs checked · worst ${report.worstRatio}:1 · ${report.pass ? "all AA" : `${report.checks.filter((check) => !check.pass).length} failing`}`;
1477
1636
  var IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
1478
1637
  var asKey = (k) => IDENT.test(k) ? k : `'${k}'`;
1479
1638
  var recordLiteral = (record, indent) => Object.entries(record).map(([k, v]) => `${indent}${asKey(k)}: '${v}',`).join("\n");
@@ -1528,7 +1687,7 @@ var emitThemeFile = (input) => {
1528
1687
  input.shape && `--shape=${input.shape}`,
1529
1688
  !darkMode && "--dark-mode=false"
1530
1689
  ].filter(Boolean).join(" ");
1531
- const reportSummary = `${report.checks.length} contrast pairs checked · worst ${report.worstRatio}:1 · ${report.pass ? "all AA" : `${report.checks.filter((c) => !c.pass).length} failing`}`;
1690
+ const reportSummary = summarizeContrast(report);
1532
1691
  const modes = [{
1533
1692
  exportName: `${id}Light`,
1534
1693
  displayName: `${name} Light`,
@@ -1709,7 +1868,7 @@ var UniThemes = {
1709
1868
  Object.keys(UniThemes)[0];
1710
1869
  //#endregion
1711
1870
  //#region package.json
1712
- var version = "7.2.0";
1871
+ var version = "8.0.0";
1713
1872
  //#endregion
1714
1873
  //#region schematics-src/ng-add/transforms.ts
1715
1874
  var addDependencies = (packageJsonText, deps) => {