@angular/material 18.0.2 → 18.0.3

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.
Files changed (45) hide show
  1. package/_index.scss +1 -1
  2. package/badge/index.d.ts +4 -1
  3. package/checkbox/index.d.ts +10 -2
  4. package/chips/index.d.ts +5 -1
  5. package/core/m2/_typography.scss +1 -1
  6. package/core/theming/_palettes.scss +2 -0
  7. package/datepicker/index.d.ts +10 -2
  8. package/dialog/index.d.ts +0 -1
  9. package/dialog/testing/index.d.ts +1 -0
  10. package/esm2022/autocomplete/autocomplete-trigger.mjs +8 -7
  11. package/esm2022/badge/badge.mjs +5 -2
  12. package/esm2022/checkbox/checkbox-config.mjs +1 -1
  13. package/esm2022/checkbox/checkbox.mjs +3 -10
  14. package/esm2022/chips/chip.mjs +6 -6
  15. package/esm2022/core/version.mjs +1 -1
  16. package/esm2022/datepicker/datepicker-base.mjs +14 -17
  17. package/esm2022/dialog/dialog-container.mjs +1 -6
  18. package/esm2022/dialog/testing/dialog-opener.mjs +4 -3
  19. package/esm2022/radio/radio.mjs +2 -1
  20. package/esm2022/slider/slider-interface.mjs +2 -2
  21. package/fesm2022/autocomplete.mjs +1 -0
  22. package/fesm2022/autocomplete.mjs.map +1 -1
  23. package/fesm2022/badge.mjs +4 -1
  24. package/fesm2022/badge.mjs.map +1 -1
  25. package/fesm2022/checkbox.mjs.map +1 -1
  26. package/fesm2022/chips.mjs +4 -4
  27. package/fesm2022/chips.mjs.map +1 -1
  28. package/fesm2022/core.mjs +1 -1
  29. package/fesm2022/core.mjs.map +1 -1
  30. package/fesm2022/datepicker.mjs +5 -1
  31. package/fesm2022/datepicker.mjs.map +1 -1
  32. package/fesm2022/dialog/testing.mjs +3 -2
  33. package/fesm2022/dialog/testing.mjs.map +1 -1
  34. package/fesm2022/dialog.mjs +0 -5
  35. package/fesm2022/dialog.mjs.map +1 -1
  36. package/fesm2022/radio.mjs +1 -0
  37. package/fesm2022/radio.mjs.map +1 -1
  38. package/fesm2022/slider.mjs +1 -1
  39. package/fesm2022/slider.mjs.map +1 -1
  40. package/package.json +2 -2
  41. package/schematics/ng-add/index.js +1 -1
  42. package/schematics/ng-add/index.mjs +1 -1
  43. package/schematics/ng-generate/m3-theme/index_bundled.js +81 -2
  44. package/schematics/ng-generate/m3-theme/index_bundled.js.map +3 -3
  45. package/slider/index.d.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/material",
3
- "version": "18.0.2",
3
+ "version": "18.0.3",
4
4
  "description": "Angular Material",
5
5
  "repository": {
6
6
  "type": "git",
@@ -490,7 +490,7 @@
490
490
  },
491
491
  "peerDependencies": {
492
492
  "@angular/animations": "^18.0.0 || ^19.0.0",
493
- "@angular/cdk": "18.0.2",
493
+ "@angular/cdk": "18.0.3",
494
494
  "@angular/core": "^18.0.0 || ^19.0.0",
495
495
  "@angular/common": "^18.0.0 || ^19.0.0",
496
496
  "@angular/forms": "^18.0.0 || ^19.0.0",
@@ -18,7 +18,7 @@ const package_config_1 = require("./package-config");
18
18
  * Note that the fallback version range does not use caret, but tilde because that is
19
19
  * the default for Angular framework dependencies in CLI projects.
20
20
  */
21
- const fallbackMaterialVersionRange = `~18.0.2`;
21
+ const fallbackMaterialVersionRange = `~18.0.3`;
22
22
  /**
23
23
  * Schematic factory entry-point for the `ng-add` schematic. The ng-add schematic will be
24
24
  * automatically executed if developers run `ng add @angular/material`.
@@ -18,7 +18,7 @@ const package_config_1 = require("./package-config");
18
18
  * Note that the fallback version range does not use caret, but tilde because that is
19
19
  * the default for Angular framework dependencies in CLI projects.
20
20
  */
21
- const fallbackMaterialVersionRange = `~18.0.2`;
21
+ const fallbackMaterialVersionRange = `~18.0.3`;
22
22
  /**
23
23
  * Schematic factory entry-point for the `ng-add` schematic. The ng-add schematic will be
24
24
  * automatically executed if developers run `ng add @angular/material`.
@@ -2515,7 +2515,19 @@ function customColor(source, color) {
2515
2515
 
2516
2516
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/m3-theme/index.mjs
2517
2517
  var HUE_TONES = [0, 10, 20, 25, 30, 35, 40, 50, 60, 70, 80, 90, 95, 98, 99, 100];
2518
- var NEUTRAL_HUE_TONES = HUE_TONES.concat([4, 6, 12, 17, 22, 24, 87, 92, 94, 96]);
2518
+ var NEUTRAL_HUES = /* @__PURE__ */ new Map([
2519
+ [4, { prev: 0, next: 10 }],
2520
+ [6, { prev: 0, next: 10 }],
2521
+ [12, { prev: 10, next: 20 }],
2522
+ [17, { prev: 10, next: 20 }],
2523
+ [22, { prev: 20, next: 25 }],
2524
+ [24, { prev: 20, next: 25 }],
2525
+ [87, { prev: 80, next: 90 }],
2526
+ [92, { prev: 90, next: 95 }],
2527
+ [94, { prev: 90, next: 95 }],
2528
+ [96, { prev: 95, next: 98 }]
2529
+ ]);
2530
+ var NEUTRAL_HUE_TONES = [...HUE_TONES, ...NEUTRAL_HUES.keys()];
2519
2531
  function getMaterialTonalPalettes(color) {
2520
2532
  try {
2521
2533
  let argbColor = argbFromHex(color);
@@ -2567,7 +2579,7 @@ function generateSCSSTheme(colorPalettes, themeTypes, colorComment, useSystemVar
2567
2579
  "@use '@angular/material' as mat;",
2568
2580
  "",
2569
2581
  "// Note: " + colorComment,
2570
- "$_palettes: " + getColorPalettesSCSS(colorPalettes),
2582
+ "$_palettes: " + getColorPalettesSCSS(patchMissingHues(colorPalettes)),
2571
2583
  "",
2572
2584
  "$_rest: (",
2573
2585
  " secondary: map.get($_palettes, secondary),",
@@ -2623,6 +2635,73 @@ function m3_theme_default(options) {
2623
2635
  createThemeFile(themeScss, tree, options.directory);
2624
2636
  });
2625
2637
  }
2638
+ function patchMissingHues(palettes) {
2639
+ const neutral = palettes.get("neutral");
2640
+ if (!neutral) {
2641
+ return palettes;
2642
+ }
2643
+ let newNeutral = null;
2644
+ for (const [hue, { prev, next }] of NEUTRAL_HUES) {
2645
+ if (!neutral.has(hue) && neutral.has(prev) && neutral.has(next)) {
2646
+ const weight = (next - hue) / (next - prev);
2647
+ const result = mixColors(neutral.get(prev), neutral.get(next), weight);
2648
+ if (result !== null) {
2649
+ newNeutral != null ? newNeutral : newNeutral = new Map(neutral.entries());
2650
+ newNeutral.set(hue, result);
2651
+ }
2652
+ }
2653
+ }
2654
+ if (!newNeutral) {
2655
+ return palettes;
2656
+ }
2657
+ const newPalettes = /* @__PURE__ */ new Map();
2658
+ for (const [key, value] of palettes) {
2659
+ if (key === "neutral") {
2660
+ const sortedNeutral = Array.from(newNeutral.keys()).sort((a, b) => a - b).reduce((newHues, key2) => {
2661
+ newHues.set(key2, newNeutral.get(key2));
2662
+ return newHues;
2663
+ }, /* @__PURE__ */ new Map());
2664
+ newPalettes.set(key, sortedNeutral);
2665
+ } else {
2666
+ newPalettes.set(key, value);
2667
+ }
2668
+ }
2669
+ return newPalettes;
2670
+ }
2671
+ function mixColors(c1, c2, weight) {
2672
+ const normalizedWeight = weight * 2 - 1;
2673
+ const weight1 = (normalizedWeight + 1) / 2;
2674
+ const weight2 = 1 - weight1;
2675
+ const color1 = parseHexColor(c1);
2676
+ const color2 = parseHexColor(c2);
2677
+ if (color1 === null || color2 === null) {
2678
+ return null;
2679
+ }
2680
+ const red = Math.round(color1.red * weight1 + color2.red * weight2);
2681
+ const green = Math.round(color1.green * weight1 + color2.green * weight2);
2682
+ const blue = Math.round(color1.blue * weight1 + color2.blue * weight2);
2683
+ const intToHex = (value) => value.toString(16).padStart(2, "0");
2684
+ return `#${intToHex(red)}${intToHex(green)}${intToHex(blue)}`;
2685
+ }
2686
+ function parseHexColor(value) {
2687
+ if (!/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value)) {
2688
+ return null;
2689
+ }
2690
+ const hexToInt = (value2) => parseInt(value2, 16);
2691
+ let red;
2692
+ let green;
2693
+ let blue;
2694
+ if (value.length === 4) {
2695
+ red = hexToInt(value[1] + value[1]);
2696
+ green = hexToInt(value[2] + value[2]);
2697
+ blue = hexToInt(value[3] + value[3]);
2698
+ } else {
2699
+ red = hexToInt(value.slice(1, 3));
2700
+ green = hexToInt(value.slice(3, 5));
2701
+ blue = hexToInt(value.slice(5, 7));
2702
+ }
2703
+ return { red, green, blue };
2704
+ }
2626
2705
  // Annotate the CommonJS export names for ESM import in node:
2627
2706
  0 && (module.exports = {
2628
2707
  generateSCSSTheme