@angular/material 15.0.0-next.3 → 15.0.0-next.4

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 (63) hide show
  1. package/button/_button-theme-private.scss +5 -2
  2. package/button/index.d.ts +5 -1
  3. package/core/_core.scss +1 -2
  4. package/esm2020/button/button-base.mjs +17 -3
  5. package/esm2020/button/button.mjs +4 -4
  6. package/esm2020/chips/chip-option.mjs +3 -1
  7. package/esm2020/core/version.mjs +1 -1
  8. package/esm2020/list/action-list.mjs +2 -2
  9. package/esm2020/list/list-option.mjs +2 -2
  10. package/esm2020/list/list.mjs +12 -4
  11. package/esm2020/list/nav-list.mjs +2 -2
  12. package/esm2020/list/selection-list.mjs +2 -2
  13. package/esm2020/slider/slider.mjs +3 -3
  14. package/esm2020/table/table.mjs +2 -2
  15. package/esm2020/tooltip/tooltip.mjs +25 -14
  16. package/fesm2015/button.mjs +27 -6
  17. package/fesm2015/button.mjs.map +1 -1
  18. package/fesm2015/chips.mjs +2 -0
  19. package/fesm2015/chips.mjs.map +1 -1
  20. package/fesm2015/core.mjs +1 -1
  21. package/fesm2015/core.mjs.map +1 -1
  22. package/fesm2015/list.mjs +19 -11
  23. package/fesm2015/list.mjs.map +1 -1
  24. package/fesm2015/slider.mjs +2 -2
  25. package/fesm2015/slider.mjs.map +1 -1
  26. package/fesm2015/table.mjs +2 -2
  27. package/fesm2015/table.mjs.map +1 -1
  28. package/fesm2015/tooltip.mjs +24 -13
  29. package/fesm2015/tooltip.mjs.map +1 -1
  30. package/fesm2020/button.mjs +20 -6
  31. package/fesm2020/button.mjs.map +1 -1
  32. package/fesm2020/chips.mjs +2 -0
  33. package/fesm2020/chips.mjs.map +1 -1
  34. package/fesm2020/core.mjs +1 -1
  35. package/fesm2020/core.mjs.map +1 -1
  36. package/fesm2020/list.mjs +19 -11
  37. package/fesm2020/list.mjs.map +1 -1
  38. package/fesm2020/slider.mjs +2 -2
  39. package/fesm2020/slider.mjs.map +1 -1
  40. package/fesm2020/table.mjs +2 -2
  41. package/fesm2020/table.mjs.map +1 -1
  42. package/fesm2020/tooltip.mjs +24 -13
  43. package/fesm2020/tooltip.mjs.map +1 -1
  44. package/legacy-core/_core.scss +1 -2
  45. package/legacy-prebuilt-themes/legacy-deeppurple-amber.css +1 -1
  46. package/legacy-prebuilt-themes/legacy-indigo-pink.css +1 -1
  47. package/legacy-prebuilt-themes/legacy-pink-bluegrey.css +1 -1
  48. package/legacy-prebuilt-themes/legacy-purple-green.css +1 -1
  49. package/list/_list-item-hcm-indicator.scss +30 -0
  50. package/list/index.d.ts +5 -0
  51. package/package.json +49 -49
  52. package/prebuilt-themes/deeppurple-amber.css +1 -1
  53. package/prebuilt-themes/indigo-pink.css +1 -1
  54. package/prebuilt-themes/pink-bluegrey.css +1 -1
  55. package/prebuilt-themes/purple-green.css +1 -1
  56. package/schematics/ng-add/index.js +1 -1
  57. package/schematics/ng-add/index.mjs +1 -1
  58. package/schematics/ng-generate/mdc-migration/index_bundled.js +504 -154
  59. package/schematics/ng-generate/mdc-migration/index_bundled.js.map +3 -3
  60. package/schematics/ng-generate/mdc-migration/mdc_migration_bundle_metadata.json +1 -1
  61. package/schematics/ng-generate/mdc-migration/schema.json +2 -5
  62. package/slider/_slider-theme.scss +50 -73
  63. package/tooltip/index.d.ts +2 -2
@@ -3045,7 +3045,7 @@ var require_previous_map = __commonJS({
3045
3045
  "use strict";
3046
3046
  var { SourceMapConsumer, SourceMapGenerator: SourceMapGenerator2 } = require_source_map();
3047
3047
  var { existsSync, readFileSync } = require("fs");
3048
- var { dirname: dirname2, join } = require("path");
3048
+ var { dirname, join } = require("path");
3049
3049
  function fromBase64(str) {
3050
3050
  if (Buffer) {
3051
3051
  return Buffer.from(str, "base64").toString();
@@ -3065,7 +3065,7 @@ var require_previous_map = __commonJS({
3065
3065
  this.mapFile = opts.from;
3066
3066
  }
3067
3067
  if (this.mapFile)
3068
- this.root = dirname2(this.mapFile);
3068
+ this.root = dirname(this.mapFile);
3069
3069
  if (text)
3070
3070
  this.text = text;
3071
3071
  }
@@ -3111,7 +3111,7 @@ var require_previous_map = __commonJS({
3111
3111
  throw new Error("Unsupported source map encoding " + encoding);
3112
3112
  }
3113
3113
  loadFile(path) {
3114
- this.root = dirname2(path);
3114
+ this.root = dirname(path);
3115
3115
  if (existsSync(path)) {
3116
3116
  this.mapFile = path;
3117
3117
  return readFileSync(path, "utf-8").toString().trim();
@@ -3146,7 +3146,7 @@ var require_previous_map = __commonJS({
3146
3146
  } else if (this.annotation) {
3147
3147
  let map = this.annotation;
3148
3148
  if (file)
3149
- map = join(dirname2(file), map);
3149
+ map = join(dirname(file), map);
3150
3150
  return this.loadFile(map);
3151
3151
  }
3152
3152
  }
@@ -3362,11 +3362,11 @@ var require_map_generator = __commonJS({
3362
3362
  "node_modules/postcss/lib/map-generator.js"(exports, module2) {
3363
3363
  "use strict";
3364
3364
  var { SourceMapConsumer, SourceMapGenerator: SourceMapGenerator2 } = require_source_map();
3365
- var { dirname: dirname2, resolve, relative, sep } = require("path");
3365
+ var { dirname, resolve, relative, sep } = require("path");
3366
3366
  var { pathToFileURL } = require("url");
3367
3367
  var Input2 = require_input();
3368
3368
  var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator2);
3369
- var pathAvailable = Boolean(dirname2 && resolve && relative && sep);
3369
+ var pathAvailable = Boolean(dirname && resolve && relative && sep);
3370
3370
  var MapGenerator = class {
3371
3371
  constructor(stringify4, root2, opts, cssString) {
3372
3372
  this.stringify = stringify4;
@@ -3460,7 +3460,7 @@ var require_map_generator = __commonJS({
3460
3460
  applyPrevMaps() {
3461
3461
  for (let prev of this.previous()) {
3462
3462
  let from = this.toUrl(this.path(prev.file));
3463
- let root2 = prev.root || dirname2(prev.file);
3463
+ let root2 = prev.root || dirname(prev.file);
3464
3464
  let map;
3465
3465
  if (this.mapOpts.sourcesContent === false) {
3466
3466
  map = new SourceMapConsumer(prev.text);
@@ -3551,9 +3551,9 @@ var require_map_generator = __commonJS({
3551
3551
  return file;
3552
3552
  if (this.mapOpts.absolute)
3553
3553
  return file;
3554
- let from = this.opts.to ? dirname2(this.opts.to) : ".";
3554
+ let from = this.opts.to ? dirname(this.opts.to) : ".";
3555
3555
  if (typeof this.mapOpts.annotation === "string") {
3556
- from = dirname2(resolve(from, this.mapOpts.annotation));
3556
+ from = dirname(resolve(from, this.mapOpts.annotation));
3557
3557
  }
3558
3558
  file = relative(from, file);
3559
3559
  return file;
@@ -6251,33 +6251,6 @@ __export(mdc_migration_exports, {
6251
6251
  });
6252
6252
  module.exports = __toCommonJS(mdc_migration_exports);
6253
6253
 
6254
- // node_modules/postcss/lib/postcss.mjs
6255
- var import_postcss = __toESM(require_postcss(), 1);
6256
- var stringify = import_postcss.default.stringify;
6257
- var fromJSON = import_postcss.default.fromJSON;
6258
- var plugin = import_postcss.default.plugin;
6259
- var parse = import_postcss.default.parse;
6260
- var list = import_postcss.default.list;
6261
- var document = import_postcss.default.document;
6262
- var comment = import_postcss.default.comment;
6263
- var atRule = import_postcss.default.atRule;
6264
- var rule = import_postcss.default.rule;
6265
- var decl = import_postcss.default.decl;
6266
- var root = import_postcss.default.root;
6267
- var CssSyntaxError = import_postcss.default.CssSyntaxError;
6268
- var Declaration = import_postcss.default.Declaration;
6269
- var Container = import_postcss.default.Container;
6270
- var Processor = import_postcss.default.Processor;
6271
- var Document = import_postcss.default.Document;
6272
- var Comment = import_postcss.default.Comment;
6273
- var Warning = import_postcss.default.Warning;
6274
- var AtRule = import_postcss.default.AtRule;
6275
- var Result = import_postcss.default.Result;
6276
- var Input = import_postcss.default.Input;
6277
- var Rule = import_postcss.default.Rule;
6278
- var Root = import_postcss.default.Root;
6279
- var Node = import_postcss.default.Node;
6280
-
6281
6254
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/style-migrator.js
6282
6255
  var END_OF_SELECTOR_REGEX = "(?!-)";
6283
6256
  var MIXIN_ARGUMENTS_REGEX = "\\(((\\s|.)*)\\)";
@@ -6285,17 +6258,17 @@ var StyleMigrator = class {
6285
6258
  isLegacyMixin(namespace, atRule2) {
6286
6259
  return this.mixinChanges.some((change) => atRule2.params.includes(`${namespace}.${change.old}`));
6287
6260
  }
6288
- replaceMixin(namespace, atRule2) {
6261
+ getMixinChange(namespace, atRule2) {
6289
6262
  var _a;
6290
6263
  const change = this.mixinChanges.find((c) => {
6291
6264
  return atRule2.params.includes(`${namespace}.${c.old}`);
6292
6265
  });
6293
6266
  if (!change) {
6294
- return;
6267
+ return null;
6295
6268
  }
6296
6269
  const replacements = [...change.new];
6297
6270
  if (change.checkForDuplicates) {
6298
- const mixinArgumentMatches = atRule2.params.match(MIXIN_ARGUMENTS_REGEX);
6271
+ const mixinArgumentMatches = (_a = atRule2.params) == null ? void 0 : _a.match(MIXIN_ARGUMENTS_REGEX);
6299
6272
  atRule2.root().walkAtRules((rule2) => {
6300
6273
  for (const index2 in replacements) {
6301
6274
  const mixinName = replacements[index2] + (mixinArgumentMatches ? mixinArgumentMatches[0] : "");
@@ -6306,33 +6279,21 @@ var StyleMigrator = class {
6306
6279
  });
6307
6280
  }
6308
6281
  if (replacements.length < 1) {
6309
- return;
6310
- }
6311
- atRule2.cloneBefore({
6312
- params: atRule2.params.replace(change.old, replacements[0])
6313
- });
6314
- const indentation = (_a = atRule2.raws.before) == null ? void 0 : _a.split("\n").pop();
6315
- atRule2.raws.before = "\n" + indentation;
6316
- for (let i = 1; i < replacements.length; i++) {
6317
- atRule2.cloneBefore({
6318
- params: atRule2.params.replace(change.old, replacements[i])
6319
- });
6282
+ return null;
6320
6283
  }
6321
- atRule2.remove();
6322
- }
6323
- replaceAllComponentThemeMixin(allComponentThemesNode) {
6324
- allComponentThemesNode.cloneBefore({
6325
- params: allComponentThemesNode.params.replace("all-legacy-component-themes", "all-component-themes")
6326
- });
6327
- allComponentThemesNode.remove();
6284
+ return { old: change.old, new: replacements };
6328
6285
  }
6329
6286
  isLegacySelector(rule2) {
6330
- return this.classChanges.some((change) => rule2.selector.match(change.old + END_OF_SELECTOR_REGEX) !== null);
6287
+ return this.classChanges.some((change) => {
6288
+ var _a;
6289
+ return ((_a = rule2.selector) == null ? void 0 : _a.match(change.old + END_OF_SELECTOR_REGEX)) !== null;
6290
+ });
6331
6291
  }
6332
6292
  replaceLegacySelector(rule2) {
6293
+ var _a;
6333
6294
  for (let i = 0; i < this.classChanges.length; i++) {
6334
6295
  const change = this.classChanges[i];
6335
- if (rule2.selector.match(change.old + END_OF_SELECTOR_REGEX)) {
6296
+ if ((_a = rule2.selector) == null ? void 0 : _a.match(change.old + END_OF_SELECTOR_REGEX)) {
6336
6297
  rule2.selector = rule2.selector.replace(change.old, change.new);
6337
6298
  }
6338
6299
  }
@@ -6340,16 +6301,6 @@ var StyleMigrator = class {
6340
6301
  isDeprecatedSelector(rule2) {
6341
6302
  return this.deprecatedPrefixes.some((deprecatedPrefix) => rule2.selector.includes(deprecatedPrefix));
6342
6303
  }
6343
- addDeprecatedSelectorComment(rule2) {
6344
- var _a;
6345
- let comment2 = comment({
6346
- text: "TODO: The following rule targets internal classes of " + this.component + " that may no longer apply for the MDC version."
6347
- });
6348
- const indentation = (_a = rule2.raws.before) == null ? void 0 : _a.split("\n").pop();
6349
- comment2.raws.before = "\n" + indentation;
6350
- rule2.parent.insertBefore(rule2, comment2);
6351
- rule2.raws.before = "\n\n" + indentation;
6352
- }
6353
6304
  };
6354
6305
 
6355
6306
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/autocomplete/autocomplete-styles.js
@@ -6361,7 +6312,15 @@ var AutocompleteStylesMigrator = class extends StyleMigrator {
6361
6312
  this.mixinChanges = [
6362
6313
  {
6363
6314
  old: "legacy-autocomplete-theme",
6364
- new: ["autocomplete-theme", "autocomplete-typography"]
6315
+ new: ["autocomplete-theme"]
6316
+ },
6317
+ {
6318
+ old: "legacy-autocomplete-color",
6319
+ new: ["autocomplete-color"]
6320
+ },
6321
+ {
6322
+ old: "legacy-autocomplete-typography",
6323
+ new: ["autocomplete-typography"]
6365
6324
  }
6366
6325
  ];
6367
6326
  this.classChanges = [{ old: ".mat-autocomplete", new: ".mat-mdc-autocomplete" }];
@@ -6377,14 +6336,17 @@ var ButtonStylesMigrator = class extends StyleMigrator {
6377
6336
  this.mixinChanges = [
6378
6337
  {
6379
6338
  old: "legacy-button-theme",
6380
- new: [
6381
- "button-theme",
6382
- "button-typography",
6383
- "fab-theme",
6384
- "fab-typography",
6385
- "icon-button-theme",
6386
- "icon-button-typography"
6387
- ],
6339
+ new: ["button-theme", "fab-theme", "icon-button-theme"],
6340
+ checkForDuplicates: true
6341
+ },
6342
+ {
6343
+ old: "legacy-button-color",
6344
+ new: ["button-color", "fab-color", "icon-button-color"],
6345
+ checkForDuplicates: true
6346
+ },
6347
+ {
6348
+ old: "legacy-button-typography",
6349
+ new: ["button-typography", "fab-typography", "icon-button-typography"],
6388
6350
  checkForDuplicates: true
6389
6351
  }
6390
6352
  ];
@@ -6410,7 +6372,15 @@ var CardStylesMigrator = class extends StyleMigrator {
6410
6372
  this.mixinChanges = [
6411
6373
  {
6412
6374
  old: "legacy-card-theme",
6413
- new: ["card-theme", "card-typography"]
6375
+ new: ["card-theme"]
6376
+ },
6377
+ {
6378
+ old: "legacy-card-color",
6379
+ new: ["card-color"]
6380
+ },
6381
+ {
6382
+ old: "legacy-card-typography",
6383
+ new: ["card-typography"]
6414
6384
  }
6415
6385
  ];
6416
6386
  this.classChanges = [
@@ -6810,12 +6780,12 @@ function utf8Encode(str) {
6810
6780
  }
6811
6781
  return encoded;
6812
6782
  }
6813
- function stringify2(token) {
6783
+ function stringify(token) {
6814
6784
  if (typeof token === "string") {
6815
6785
  return token;
6816
6786
  }
6817
6787
  if (Array.isArray(token)) {
6818
- return "[" + token.map(stringify2).join(", ") + "]";
6788
+ return "[" + token.map(stringify).join(", ") + "]";
6819
6789
  }
6820
6790
  if (token == null) {
6821
6791
  return "" + token;
@@ -9389,7 +9359,7 @@ var Text$2 = class {
9389
9359
  return visitor.visitText(this, context);
9390
9360
  }
9391
9361
  };
9392
- var Container2 = class {
9362
+ var Container = class {
9393
9363
  constructor(children, sourceSpan) {
9394
9364
  this.children = children;
9395
9365
  this.sourceSpan = sourceSpan;
@@ -9560,7 +9530,7 @@ function updatePlaceholderMap(map, name, ...values) {
9560
9530
  function assembleBoundTextPlaceholders(meta, bindingStartIndex = 0, contextId = 0) {
9561
9531
  const startIdx = bindingStartIndex;
9562
9532
  const placeholders = /* @__PURE__ */ new Map();
9563
- const node = meta instanceof Message ? meta.nodes.find((node2) => node2 instanceof Container2) : meta;
9533
+ const node = meta instanceof Message ? meta.nodes.find((node2) => node2 instanceof Container) : meta;
9564
9534
  if (node) {
9565
9535
  node.children.filter((child) => child instanceof Placeholder).forEach((child, idx) => {
9566
9536
  const content = wrapI18nPlaceholder(startIdx + idx, contextId);
@@ -10107,7 +10077,7 @@ function identifierName(compileIdentifier) {
10107
10077
  if (ref["__forward_ref__"]) {
10108
10078
  return "__forward_ref__";
10109
10079
  }
10110
- let identifier = stringify2(ref);
10080
+ let identifier = stringify(ref);
10111
10081
  if (identifier.indexOf("(") >= 0) {
10112
10082
  identifier = `anonymous_${_anonymousTypeIndex++}`;
10113
10083
  ref["__anonymousType"] = identifier;
@@ -12102,7 +12072,7 @@ function repeatGroups(groups, multiples) {
12102
12072
  }
12103
12073
  }
12104
12074
  }
12105
- function parse2(value) {
12075
+ function parse(value) {
12106
12076
  const styles = [];
12107
12077
  let i = 0;
12108
12078
  let parenDepth = 0;
@@ -12273,7 +12243,7 @@ var StylingBuilder = class {
12273
12243
  }
12274
12244
  }
12275
12245
  registerStyleAttr(value) {
12276
- this._initialStyleValues = parse2(value);
12246
+ this._initialStyleValues = parse(value);
12277
12247
  this._hasInitialValues = true;
12278
12248
  }
12279
12249
  registerClassAttr(value) {
@@ -13825,7 +13795,7 @@ var Element = class extends NodeWithI18n {
13825
13795
  return visitor.visitElement(this, context);
13826
13796
  }
13827
13797
  };
13828
- var Comment2 = class {
13798
+ var Comment = class {
13829
13799
  constructor(value, sourceSpan) {
13830
13800
  this.value = value;
13831
13801
  this.sourceSpan = sourceSpan;
@@ -16887,7 +16857,7 @@ var _TreeBuilder = class {
16887
16857
  const text = this._advanceIf(7);
16888
16858
  this._advanceIf(11);
16889
16859
  const value = text != null ? text.parts[0].trim() : null;
16890
- this._addToParent(new Comment2(value, token.sourceSpan));
16860
+ this._addToParent(new Comment(value, token.sourceSpan));
16891
16861
  }
16892
16862
  _consumeExpansion(token) {
16893
16863
  const switchValue = this._advance();
@@ -18334,7 +18304,7 @@ function isEmptyTextNode(node) {
18334
18304
  return node instanceof Text && node.value.trim().length == 0;
18335
18305
  }
18336
18306
  function isCommentNode(node) {
18337
- return node instanceof Comment2;
18307
+ return node instanceof Comment;
18338
18308
  }
18339
18309
  function textContents(node) {
18340
18310
  if (node.children.length !== 1 || !(node.children[0] instanceof Text)) {
@@ -18663,7 +18633,7 @@ var _I18nVisitor = class {
18663
18633
  const i18nIcuCases = {};
18664
18634
  const i18nIcu = new Icu(icu.switchValue, icu.type, i18nIcuCases, icu.sourceSpan);
18665
18635
  icu.cases.forEach((caze) => {
18666
- i18nIcuCases[caze.value] = new Container2(caze.expression.map((node2) => node2.visit(this, context)), caze.expSourceSpan);
18636
+ i18nIcuCases[caze.value] = new Container(caze.expression.map((node2) => node2.visit(this, context)), caze.expSourceSpan);
18667
18637
  });
18668
18638
  context.icuDepth--;
18669
18639
  if (context.isIcu || context.icuDepth > 0) {
@@ -18715,7 +18685,7 @@ var _I18nVisitor = class {
18715
18685
  }
18716
18686
  if (hasInterpolation) {
18717
18687
  reusePreviousSourceSpans(nodes, previousI18n);
18718
- return new Container2(nodes, sourceSpan);
18688
+ return new Container(nodes, sourceSpan);
18719
18689
  } else {
18720
18690
  return nodes[0];
18721
18691
  }
@@ -18726,7 +18696,7 @@ function reusePreviousSourceSpans(nodes, previousI18n) {
18726
18696
  assertSingleContainerMessage(previousI18n);
18727
18697
  previousI18n = previousI18n.nodes[0];
18728
18698
  }
18729
- if (previousI18n instanceof Container2) {
18699
+ if (previousI18n instanceof Container) {
18730
18700
  assertEquivalentNodes(previousI18n.children, nodes);
18731
18701
  for (let i = 0; i < nodes.length; i++) {
18732
18702
  nodes[i].sourceSpan = previousI18n.children[i].sourceSpan;
@@ -18735,7 +18705,7 @@ function reusePreviousSourceSpans(nodes, previousI18n) {
18735
18705
  }
18736
18706
  function assertSingleContainerMessage(message) {
18737
18707
  const nodes = message.nodes;
18738
- if (nodes.length !== 1 || !(nodes[0] instanceof Container2)) {
18708
+ if (nodes.length !== 1 || !(nodes[0] instanceof Container)) {
18739
18709
  throw new Error("Unexpected previous i18n message - expected it to consist of only a single `Container` node.");
18740
18710
  }
18741
18711
  }
@@ -21305,6 +21275,14 @@ function replaceEndTag(html, node, tag) {
21305
21275
  return replaceAt(html, node.endSourceSpan.start.offset + 2, node.name, tag);
21306
21276
  }
21307
21277
  function addAttribute(html, node, name, value) {
21278
+ const existingAttr = node.attributes.find((currentAttr) => currentAttr.name === name);
21279
+ if (existingAttr) {
21280
+ if (existingAttr.valueSpan) {
21281
+ return html.slice(0, existingAttr.valueSpan.start.offset) + value + html.slice(existingAttr.valueSpan.end.offset);
21282
+ } else if (existingAttr.keySpan) {
21283
+ return html.slice(0, existingAttr.keySpan.end.offset) + `="${value}"` + html.slice(existingAttr.keySpan.end.offset);
21284
+ }
21285
+ }
21308
21286
  const index2 = node.startSourceSpan.start.offset + node.name.length + 1;
21309
21287
  const prefix = html.slice(0, index2);
21310
21288
  const suffix = html.slice(index2);
@@ -21349,7 +21327,15 @@ var CheckboxStylesMigrator = class extends StyleMigrator {
21349
21327
  this.mixinChanges = [
21350
21328
  {
21351
21329
  old: "legacy-checkbox-theme",
21352
- new: ["checkbox-theme", "checkbox-typography"]
21330
+ new: ["checkbox-theme"]
21331
+ },
21332
+ {
21333
+ old: "legacy-checkbox-color",
21334
+ new: ["checkbox-color"]
21335
+ },
21336
+ {
21337
+ old: "legacy-checkbox-typography",
21338
+ new: ["checkbox-typography"]
21353
21339
  }
21354
21340
  ];
21355
21341
  this.classChanges = [{ old: ".mat-checkbox", new: ".mat-mdc-checkbox" }];
@@ -21365,7 +21351,15 @@ var ChipsStylesMigrator = class extends StyleMigrator {
21365
21351
  this.mixinChanges = [
21366
21352
  {
21367
21353
  old: "legacy-chips-theme",
21368
- new: ["chips-theme", "chips-typography"]
21354
+ new: ["chips-theme"]
21355
+ },
21356
+ {
21357
+ old: "legacy-chips-color",
21358
+ new: ["chips-color"]
21359
+ },
21360
+ {
21361
+ old: "legacy-chips-typography",
21362
+ new: ["chips-typography"]
21369
21363
  }
21370
21364
  ];
21371
21365
  this.classChanges = [
@@ -21468,7 +21462,15 @@ var DialogStylesMigrator = class extends StyleMigrator {
21468
21462
  this.mixinChanges = [
21469
21463
  {
21470
21464
  old: "legacy-dialog-theme",
21471
- new: ["dialog-theme", "dialog-typography"]
21465
+ new: ["dialog-theme"]
21466
+ },
21467
+ {
21468
+ old: "legacy-dialog-color",
21469
+ new: ["dialog-color"]
21470
+ },
21471
+ {
21472
+ old: "legacy-dialog-typography",
21473
+ new: ["dialog-typography"]
21472
21474
  }
21473
21475
  ];
21474
21476
  this.classChanges = [
@@ -21507,7 +21509,18 @@ var FormFieldStylesMigrator = class extends StyleMigrator {
21507
21509
  this.mixinChanges = [
21508
21510
  {
21509
21511
  old: "legacy-form-field-theme",
21510
- new: ["form-field-theme", "form-field-typography"]
21512
+ new: ["form-field-theme"],
21513
+ checkForDuplicates: true
21514
+ },
21515
+ {
21516
+ old: "legacy-form-field-color",
21517
+ new: ["form-field-color"],
21518
+ checkForDuplicates: true
21519
+ },
21520
+ {
21521
+ old: "legacy-form-field-typography",
21522
+ new: ["form-field-typography"],
21523
+ checkForDuplicates: true
21511
21524
  }
21512
21525
  ];
21513
21526
  this.classChanges = [
@@ -21536,7 +21549,15 @@ var InputStylesMigrator = class extends StyleMigrator {
21536
21549
  this.mixinChanges = [
21537
21550
  {
21538
21551
  old: "legacy-input-theme",
21539
- new: ["input-theme", "input-typography"]
21552
+ new: ["input-theme"]
21553
+ },
21554
+ {
21555
+ old: "legacy-input-color",
21556
+ new: ["input-color"]
21557
+ },
21558
+ {
21559
+ old: "legacy-input-typography",
21560
+ new: ["input-typography"]
21540
21561
  }
21541
21562
  ];
21542
21563
  this.classChanges = [{ old: ".mat-input-element", new: ".mat-mdc-input-element" }];
@@ -21552,7 +21573,15 @@ var ListStylesMigrator = class extends StyleMigrator {
21552
21573
  this.mixinChanges = [
21553
21574
  {
21554
21575
  old: "legacy-list-theme",
21555
- new: ["list-theme", "list-typography"]
21576
+ new: ["list-theme"]
21577
+ },
21578
+ {
21579
+ old: "legacy-list-color",
21580
+ new: ["list-color"]
21581
+ },
21582
+ {
21583
+ old: "legacy-list-typography",
21584
+ new: ["list-typography"]
21556
21585
  }
21557
21586
  ];
21558
21587
  this.classChanges = [
@@ -21575,7 +21604,15 @@ var MenuStylesMigrator = class extends StyleMigrator {
21575
21604
  this.mixinChanges = [
21576
21605
  {
21577
21606
  old: "legacy-menu-theme",
21578
- new: ["menu-theme", "menu-typography"]
21607
+ new: ["menu-theme"]
21608
+ },
21609
+ {
21610
+ old: "legacy-menu-color",
21611
+ new: ["menu-color"]
21612
+ },
21613
+ {
21614
+ old: "legacy-menu-typography",
21615
+ new: ["menu-typography"]
21579
21616
  }
21580
21617
  ];
21581
21618
  this.classChanges = [
@@ -21600,7 +21637,23 @@ var PaginatorStylesMigrator = class extends StyleMigrator {
21600
21637
  this.mixinChanges = [
21601
21638
  {
21602
21639
  old: "legacy-paginator-theme",
21603
- new: ["paginator-theme", "paginator-typography"]
21640
+ new: ["paginator-theme", "icon-button-theme", "form-field-theme", "select-theme"],
21641
+ checkForDuplicates: true
21642
+ },
21643
+ {
21644
+ old: "legacy-paginator-color",
21645
+ new: ["paginator-color", "icon-button-color", "form-field-color", "select-color"],
21646
+ checkForDuplicates: true
21647
+ },
21648
+ {
21649
+ old: "legacy-paginator-typography",
21650
+ new: [
21651
+ "paginator-typography",
21652
+ "icon-button-typography",
21653
+ "form-field-typography",
21654
+ "select-typography"
21655
+ ],
21656
+ checkForDuplicates: true
21604
21657
  }
21605
21658
  ];
21606
21659
  this.classChanges = [
@@ -21630,7 +21683,15 @@ var ProgressBarStylesMigrator = class extends StyleMigrator {
21630
21683
  this.mixinChanges = [
21631
21684
  {
21632
21685
  old: "legacy-progress-bar-theme",
21633
- new: ["progress-bar-theme", "progress-bar-typography"]
21686
+ new: ["progress-bar-theme"]
21687
+ },
21688
+ {
21689
+ old: "legacy-progress-bar-color",
21690
+ new: ["progress-bar-color"]
21691
+ },
21692
+ {
21693
+ old: "legacy-progress-bar-typography",
21694
+ new: ["progress-bar-typography"]
21634
21695
  }
21635
21696
  ];
21636
21697
  this.classChanges = [{ old: ".mat-progress-bar", new: ".mat-mdc-progress-bar" }];
@@ -21646,7 +21707,15 @@ var ProgressSpinnerStylesMigrator = class extends StyleMigrator {
21646
21707
  this.mixinChanges = [
21647
21708
  {
21648
21709
  old: "legacy-progress-spinner-theme",
21649
- new: ["progress-spinner-theme", "progress-spinner-typography"]
21710
+ new: ["progress-spinner-theme"]
21711
+ },
21712
+ {
21713
+ old: "legacy-progress-spinner-color",
21714
+ new: ["progress-spinner-color"]
21715
+ },
21716
+ {
21717
+ old: "legacy-progress-spinner-typography",
21718
+ new: ["progress-spinner-typography"]
21650
21719
  }
21651
21720
  ];
21652
21721
  this.classChanges = [
@@ -21665,7 +21734,15 @@ var RadioStylesMigrator = class extends StyleMigrator {
21665
21734
  this.mixinChanges = [
21666
21735
  {
21667
21736
  old: "legacy-radio-theme",
21668
- new: ["radio-theme", "radio-typography"]
21737
+ new: ["radio-theme"]
21738
+ },
21739
+ {
21740
+ old: "legacy-radio-color",
21741
+ new: ["radio-color"]
21742
+ },
21743
+ {
21744
+ old: "legacy-radio-typography",
21745
+ new: ["radio-typography"]
21669
21746
  }
21670
21747
  ];
21671
21748
  this.classChanges = [
@@ -21679,7 +21756,7 @@ var RadioStylesMigrator = class extends StyleMigrator {
21679
21756
  var ts = __toESM(require("typescript"));
21680
21757
 
21681
21758
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/ts-migration/import-replacements.js
21682
- var IMPORT_REPLACEMENTS = {
21759
+ var REPLACEMENTS = {
21683
21760
  "button": {
21684
21761
  old: "@angular/material/legacy-button",
21685
21762
  new: "@angular/material/button"
@@ -21694,11 +21771,13 @@ var IMPORT_REPLACEMENTS = {
21694
21771
  },
21695
21772
  "chips": {
21696
21773
  old: "@angular/material/legacy-chips",
21697
- new: "@angular/material/chips"
21774
+ new: "@angular/material/chips",
21775
+ additionalMatModuleNamePrefixes: ["chip"]
21698
21776
  },
21699
21777
  "dialog": {
21700
21778
  old: "@angular/material/legacy-dialog",
21701
- new: "@angular/material/dialog"
21779
+ new: "@angular/material/dialog",
21780
+ customReplacements: [{ old: "LegacyDialogRole", new: "DialogRole" }]
21702
21781
  },
21703
21782
  "autocomplete": {
21704
21783
  old: "@angular/material/legacy-autocomplete",
@@ -21712,14 +21791,18 @@ var IMPORT_REPLACEMENTS = {
21712
21791
  old: "@angular/material/legacy-input",
21713
21792
  new: "@angular/material/input"
21714
21793
  },
21715
- "select": {
21716
- old: "@angular/material/legacy-select",
21717
- new: "@angular/material/select"
21794
+ "optgroup": {
21795
+ old: "@angular/material/legacy-core",
21796
+ new: "@angular/material/core"
21718
21797
  },
21719
- "core": {
21798
+ "option": {
21720
21799
  old: "@angular/material/legacy-core",
21721
21800
  new: "@angular/material/core"
21722
21801
  },
21802
+ "select": {
21803
+ old: "@angular/material/legacy-select",
21804
+ new: "@angular/material/select"
21805
+ },
21723
21806
  "list": {
21724
21807
  old: "@angular/material/legacy-list",
21725
21808
  new: "@angular/material/list"
@@ -21777,12 +21860,29 @@ var IMPORT_REPLACEMENTS = {
21777
21860
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/ts-migration/runtime-migrator.js
21778
21861
  var RuntimeMigrator = class {
21779
21862
  constructor(component) {
21780
- const replacements = IMPORT_REPLACEMENTS[component];
21863
+ var _a, _b;
21864
+ const replacements = REPLACEMENTS[component];
21781
21865
  this.oldImportModule = replacements.old;
21782
21866
  this.newImportModule = replacements.new;
21783
- const firstLetterCapitalizedComponent = component[0].toUpperCase() + component.slice(1);
21784
- const capitalizedComponent = component.toUpperCase();
21785
- this.importSpecifierReplacements = [
21867
+ this.importSpecifierReplacements = this.getReplacementsFromComponentName(component);
21868
+ (_a = replacements.additionalMatModuleNamePrefixes) == null ? void 0 : _a.forEach((prefix) => {
21869
+ this.importSpecifierReplacements = this.importSpecifierReplacements.concat(this.getReplacementsFromComponentName(prefix));
21870
+ });
21871
+ (_b = replacements.customReplacements) == null ? void 0 : _b.forEach((replacement) => {
21872
+ this.importSpecifierReplacements = this.importSpecifierReplacements.concat(replacement);
21873
+ });
21874
+ console.log(this.importSpecifierReplacements);
21875
+ }
21876
+ getReplacementsFromComponentName(componentName) {
21877
+ const words = componentName.split("-");
21878
+ let firstLetterCapitalizedComponent = "";
21879
+ let capitalizedComponent = "";
21880
+ words.forEach((word) => {
21881
+ firstLetterCapitalizedComponent += word[0].toUpperCase() + word.slice(1);
21882
+ capitalizedComponent += word.toUpperCase() + "_";
21883
+ });
21884
+ capitalizedComponent = capitalizedComponent.slice(0, -1);
21885
+ const specifierReplacements = [
21786
21886
  {
21787
21887
  old: "MatLegacy" + firstLetterCapitalizedComponent,
21788
21888
  new: "Mat" + firstLetterCapitalizedComponent
@@ -21792,6 +21892,7 @@ var RuntimeMigrator = class {
21792
21892
  new: "MAT_" + capitalizedComponent
21793
21893
  }
21794
21894
  ];
21895
+ return specifierReplacements;
21795
21896
  }
21796
21897
  updateImportOrExportSpecifier(specifier) {
21797
21898
  const newSpecifier = this._getNewSpecifier(specifier);
@@ -21826,7 +21927,8 @@ var RuntimeMigrator = class {
21826
21927
  _getNewSpecifier(node) {
21827
21928
  let newImport = null;
21828
21929
  this.importSpecifierReplacements.forEach((replacement) => {
21829
- if (node.text.match(replacement.old)) {
21930
+ var _a;
21931
+ if ((_a = node.text) == null ? void 0 : _a.match(replacement.old)) {
21830
21932
  newImport = node.text.replace(replacement.old, replacement.new);
21831
21933
  }
21832
21934
  });
@@ -21846,7 +21948,18 @@ var SelectStylesMigrator = class extends StyleMigrator {
21846
21948
  this.mixinChanges = [
21847
21949
  {
21848
21950
  old: "legacy-select-theme",
21849
- new: ["select-theme", "select-typography", "core-theme", "core-typography"]
21951
+ new: ["select-theme"],
21952
+ checkForDuplicates: true
21953
+ },
21954
+ {
21955
+ old: "legacy-select-color",
21956
+ new: ["select-color"],
21957
+ checkForDuplicates: true
21958
+ },
21959
+ {
21960
+ old: "legacy-select-typography",
21961
+ new: ["select-typography"],
21962
+ checkForDuplicates: true
21850
21963
  }
21851
21964
  ];
21852
21965
  this.classChanges = [
@@ -21866,7 +21979,15 @@ var SlideToggleStylesMigrator = class extends StyleMigrator {
21866
21979
  this.mixinChanges = [
21867
21980
  {
21868
21981
  old: "legacy-slide-toggle-theme",
21869
- new: ["slide-toggle-theme", "slide-toggle-typography"]
21982
+ new: ["slide-toggle-theme"]
21983
+ },
21984
+ {
21985
+ old: "legacy-slide-toggle-color",
21986
+ new: ["slide-toggle-color"]
21987
+ },
21988
+ {
21989
+ old: "legacy-slide-toggle-typography",
21990
+ new: ["slide-toggle-typography"]
21870
21991
  }
21871
21992
  ];
21872
21993
  this.classChanges = [{ old: ".mat-slide-toggle", new: ".mat-mdc-slide-toggle" }];
@@ -21882,7 +22003,15 @@ var SliderStylesMigrator = class extends StyleMigrator {
21882
22003
  this.mixinChanges = [
21883
22004
  {
21884
22005
  old: "legacy-slider-theme",
21885
- new: ["slider-theme", "slider-typography"]
22006
+ new: ["slider-theme"]
22007
+ },
22008
+ {
22009
+ old: "legacy-slider-color",
22010
+ new: ["slider-color"]
22011
+ },
22012
+ {
22013
+ old: "legacy-slider-typography",
22014
+ new: ["slider-typography"]
21886
22015
  }
21887
22016
  ];
21888
22017
  this.classChanges = [{ old: ".mat-slider", new: ".mat-mdc-slider" }];
@@ -21898,7 +22027,17 @@ var SnackBarMigrator = class extends StyleMigrator {
21898
22027
  this.mixinChanges = [
21899
22028
  {
21900
22029
  old: "legacy-snack-bar-theme",
21901
- new: ["snack-bar-theme", "snack-bar-typography", "button-theme", "button-typography"],
22030
+ new: ["snack-bar-theme", "button-theme"],
22031
+ checkForDuplicates: true
22032
+ },
22033
+ {
22034
+ old: "legacy-snack-bar-color",
22035
+ new: ["snack-bar-color", "button-color"],
22036
+ checkForDuplicates: true
22037
+ },
22038
+ {
22039
+ old: "legacy-snack-bar-typography",
22040
+ new: ["snack-bar-typography", "button-typography"],
21902
22041
  checkForDuplicates: true
21903
22042
  }
21904
22043
  ];
@@ -21919,7 +22058,15 @@ var TableStylesMigrator = class extends StyleMigrator {
21919
22058
  this.mixinChanges = [
21920
22059
  {
21921
22060
  old: "legacy-table-theme",
21922
- new: ["table-theme", "table-typography"]
22061
+ new: ["table-theme"]
22062
+ },
22063
+ {
22064
+ old: "legacy-table-color",
22065
+ new: ["table-color"]
22066
+ },
22067
+ {
22068
+ old: "legacy-table-typography",
22069
+ new: ["table-typography"]
21923
22070
  }
21924
22071
  ];
21925
22072
  this.classChanges = [
@@ -21952,7 +22099,15 @@ var TabsStylesMigrator = class extends StyleMigrator {
21952
22099
  this.mixinChanges = [
21953
22100
  {
21954
22101
  old: "legacy-tabs-theme",
21955
- new: ["tabs-theme", "tabs-typography"]
22102
+ new: ["tabs-theme"]
22103
+ },
22104
+ {
22105
+ old: "legacy-tabs-color",
22106
+ new: ["tabs-color"]
22107
+ },
22108
+ {
22109
+ old: "legacy-tabs-typography",
22110
+ new: ["tabs-typography"]
21956
22111
  }
21957
22112
  ];
21958
22113
  this.classChanges = [
@@ -21975,7 +22130,15 @@ var TooltipStylesMigrator = class extends StyleMigrator {
21975
22130
  this.mixinChanges = [
21976
22131
  {
21977
22132
  old: "legacy-tooltip-theme",
21978
- new: ["tooltip-theme", "tooltip-typography"]
22133
+ new: ["tooltip-theme"]
22134
+ },
22135
+ {
22136
+ old: "legacy-tooltip-color",
22137
+ new: ["tooltip-color"]
22138
+ },
22139
+ {
22140
+ old: "legacy-tooltip-typography",
22141
+ new: ["tooltip-typography"]
21979
22142
  }
21980
22143
  ];
21981
22144
  this.classChanges = [
@@ -21992,6 +22155,80 @@ var TooltipStylesMigrator = class extends StyleMigrator {
21992
22155
  }
21993
22156
  };
21994
22157
 
22158
+ // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/optgroup/optgroup-styles.js
22159
+ var OptgroupStylesMigrator = class extends StyleMigrator {
22160
+ constructor() {
22161
+ super(...arguments);
22162
+ this.component = "optgroup";
22163
+ this.deprecatedPrefixes = ["mat-optgroup"];
22164
+ this.mixinChanges = [
22165
+ {
22166
+ old: "legacy-optgroup-theme",
22167
+ new: ["optgroup-theme"]
22168
+ },
22169
+ {
22170
+ old: "legacy-optgroup-color",
22171
+ new: ["optgroup-color"]
22172
+ },
22173
+ {
22174
+ old: "legacy-optgroup-typography",
22175
+ new: ["optgroup-typography"]
22176
+ }
22177
+ ];
22178
+ this.classChanges = [
22179
+ {
22180
+ old: ".mat-optgroup",
22181
+ new: ".mat-mdc-optgroup"
22182
+ },
22183
+ {
22184
+ old: ".mat-optgroup-label",
22185
+ new: ".mat-mdc-optgroup-label"
22186
+ }
22187
+ ];
22188
+ }
22189
+ };
22190
+
22191
+ // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/option/option-styles.js
22192
+ var OptionStylesMigrator = class extends StyleMigrator {
22193
+ constructor() {
22194
+ super(...arguments);
22195
+ this.component = "option";
22196
+ this.deprecatedPrefixes = ["mat-option"];
22197
+ this.mixinChanges = [
22198
+ {
22199
+ old: "legacy-option-theme",
22200
+ new: ["option-theme"]
22201
+ },
22202
+ {
22203
+ old: "legacy-option-color",
22204
+ new: ["option-color"]
22205
+ },
22206
+ {
22207
+ old: "legacy-option-typography",
22208
+ new: ["option-typography"]
22209
+ }
22210
+ ];
22211
+ this.classChanges = [
22212
+ {
22213
+ old: ".mat-option",
22214
+ new: ".mat-mdc-option"
22215
+ },
22216
+ {
22217
+ old: ".mat-option-multiple",
22218
+ new: ".mat-mdc-option-multiple"
22219
+ },
22220
+ {
22221
+ old: ".mat-option-pseudo-checkbox",
22222
+ new: ".mat-mdc-option-pseudo-checkbox"
22223
+ },
22224
+ {
22225
+ old: ".mat-option-ripple",
22226
+ new: ".mat-mdc-option-ripple"
22227
+ }
22228
+ ];
22229
+ }
22230
+ };
22231
+
21995
22232
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/index.js
21996
22233
  var MIGRATORS = [
21997
22234
  {
@@ -22046,6 +22283,16 @@ var MIGRATORS = [
22046
22283
  styles: new MenuStylesMigrator(),
22047
22284
  runtime: new RuntimeMigrator("menu")
22048
22285
  },
22286
+ {
22287
+ component: "optgroup",
22288
+ styles: new OptgroupStylesMigrator(),
22289
+ runtime: new RuntimeMigrator("optgroup")
22290
+ },
22291
+ {
22292
+ component: "option",
22293
+ styles: new OptionStylesMigrator(),
22294
+ runtime: new RuntimeMigrator("option")
22295
+ },
22049
22296
  {
22050
22297
  component: "paginator",
22051
22298
  styles: new PaginatorStylesMigrator(),
@@ -22112,6 +22359,33 @@ var ts2 = __toESM(require("typescript"));
22112
22359
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/theming-styles.js
22113
22360
  var import_schematics = require("@angular/cdk/schematics");
22114
22361
 
22362
+ // node_modules/postcss/lib/postcss.mjs
22363
+ var import_postcss = __toESM(require_postcss(), 1);
22364
+ var stringify2 = import_postcss.default.stringify;
22365
+ var fromJSON = import_postcss.default.fromJSON;
22366
+ var plugin = import_postcss.default.plugin;
22367
+ var parse2 = import_postcss.default.parse;
22368
+ var list = import_postcss.default.list;
22369
+ var document = import_postcss.default.document;
22370
+ var comment = import_postcss.default.comment;
22371
+ var atRule = import_postcss.default.atRule;
22372
+ var rule = import_postcss.default.rule;
22373
+ var decl = import_postcss.default.decl;
22374
+ var root = import_postcss.default.root;
22375
+ var CssSyntaxError = import_postcss.default.CssSyntaxError;
22376
+ var Declaration = import_postcss.default.Declaration;
22377
+ var Container2 = import_postcss.default.Container;
22378
+ var Processor = import_postcss.default.Processor;
22379
+ var Document = import_postcss.default.Document;
22380
+ var Comment2 = import_postcss.default.Comment;
22381
+ var Warning = import_postcss.default.Warning;
22382
+ var AtRule = import_postcss.default.AtRule;
22383
+ var Result = import_postcss.default.Result;
22384
+ var Input = import_postcss.default.Input;
22385
+ var Rule = import_postcss.default.Rule;
22386
+ var Root = import_postcss.default.Root;
22387
+ var Node = import_postcss.default.Node;
22388
+
22115
22389
  // node_modules/postcss-scss/lib/scss-syntax.mjs
22116
22390
  var scss_syntax_exports = {};
22117
22391
  __export(scss_syntax_exports, {
@@ -22125,13 +22399,14 @@ var stringify3 = import_scss_syntax.default.stringify;
22125
22399
  var parse3 = import_scss_syntax.default.parse;
22126
22400
 
22127
22401
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/theming-styles.js
22402
+ var ALL_LEGACY_COMPONENTS_MIXIN_NAME = "(?:\\.)(.*)(?:\\()";
22128
22403
  var ThemingStylesMigration = class extends import_schematics.Migration {
22129
22404
  constructor() {
22130
22405
  super(...arguments);
22131
22406
  this.enabled = true;
22132
22407
  }
22133
22408
  visitStylesheet(stylesheet) {
22134
- this.fileSystem.overwrite(stylesheet.filePath, this.migrate(stylesheet.content));
22409
+ this.fileSystem.edit(stylesheet.filePath).remove(stylesheet.start, stylesheet.content.length).insertRight(stylesheet.start, this.migrate(stylesheet.content));
22135
22410
  }
22136
22411
  migrate(styles) {
22137
22412
  const processor = new Processor([
@@ -22152,16 +22427,28 @@ var ThemingStylesMigration = class extends import_schematics.Migration {
22152
22427
  }
22153
22428
  }
22154
22429
  atIncludeHandler(atRule2) {
22155
- var _a;
22156
22430
  const migrator = this.upgradeData.find((m) => {
22157
22431
  return m.styles.isLegacyMixin(this.namespace, atRule2);
22158
22432
  });
22159
22433
  if (migrator) {
22160
- migrator.styles.replaceMixin(this.namespace, atRule2);
22161
- } else if (atRule2.params.includes("all-legacy-component-themes") && atRule2.parent) {
22162
- (_a = this.upgradeData[0]) == null ? void 0 : _a.styles.replaceAllComponentThemeMixin(atRule2);
22434
+ const mixinChange = migrator.styles.getMixinChange(this.namespace, atRule2);
22435
+ if (mixinChange) {
22436
+ replaceAtRuleWithMultiple(atRule2, mixinChange.old, mixinChange.new);
22437
+ }
22438
+ } else if (atRule2.params.includes("all-legacy-component") && atRule2.parent) {
22439
+ if (this.isPartialMigration()) {
22440
+ const mixinName = atRule2.params.match(ALL_LEGACY_COMPONENTS_MIXIN_NAME)[1];
22441
+ const comment2 = "TODO(mdc-migration): Remove " + mixinName + " once all legacy components are migrated";
22442
+ if (!addLegacyCommentForPartialMigrations(atRule2, comment2)) {
22443
+ return;
22444
+ }
22445
+ }
22446
+ replaceAllComponentsMixin(atRule2);
22163
22447
  }
22164
22448
  }
22449
+ isPartialMigration() {
22450
+ return this.upgradeData.length !== MIGRATORS.length;
22451
+ }
22165
22452
  ruleHandler(rule2) {
22166
22453
  let isLegacySelector;
22167
22454
  let isDeprecatedSelector;
@@ -22173,7 +22460,7 @@ var ThemingStylesMigration = class extends import_schematics.Migration {
22173
22460
  if (isLegacySelector) {
22174
22461
  migrator == null ? void 0 : migrator.styles.replaceLegacySelector(rule2);
22175
22462
  } else if (isDeprecatedSelector) {
22176
- migrator == null ? void 0 : migrator.styles.addDeprecatedSelectorComment(rule2);
22463
+ addCommentBeforeNode(rule2, "TODO(mdc-migration): The following rule targets internal classes of " + (migrator == null ? void 0 : migrator.component) + " that may no longer apply for the MDC version.");
22177
22464
  }
22178
22465
  }
22179
22466
  };
@@ -22185,6 +22472,50 @@ function parseNamespace(atRule2) {
22185
22472
  const params = list.space(atRule2.params);
22186
22473
  return params[params.length - 1];
22187
22474
  }
22475
+ function addLegacyCommentForPartialMigrations(atRule2, legacyComment) {
22476
+ var _a;
22477
+ let hasAddedComment = false;
22478
+ (_a = atRule2.parent) == null ? void 0 : _a.walkComments((comment2) => {
22479
+ if (comment2.text.includes(legacyComment)) {
22480
+ hasAddedComment = true;
22481
+ }
22482
+ });
22483
+ if (hasAddedComment) {
22484
+ return false;
22485
+ }
22486
+ addCommentBeforeNode(atRule2.cloneBefore(), legacyComment);
22487
+ return true;
22488
+ }
22489
+ function addCommentBeforeNode(node, comment2) {
22490
+ var _a;
22491
+ let commentNode = comment({
22492
+ text: comment2
22493
+ });
22494
+ const indentation = (_a = node.raws.before) == null ? void 0 : _a.split("\n").pop();
22495
+ commentNode.raws.before = "\n" + indentation;
22496
+ node.parent.insertBefore(node, commentNode);
22497
+ node.raws.before = "\n" + indentation;
22498
+ }
22499
+ function replaceAllComponentsMixin(allComponentNode) {
22500
+ allComponentNode.cloneBefore({
22501
+ params: allComponentNode.params.replace("all-legacy-component", "all-component")
22502
+ });
22503
+ allComponentNode.remove();
22504
+ }
22505
+ function replaceAtRuleWithMultiple(atRule2, textToReplace, replacements) {
22506
+ var _a;
22507
+ atRule2.cloneBefore({
22508
+ params: atRule2.params.replace(textToReplace, replacements[0])
22509
+ });
22510
+ const indentation = (_a = atRule2.raws.before) == null ? void 0 : _a.split("\n").pop();
22511
+ atRule2.raws.before = "\n" + indentation;
22512
+ for (let i = 1; i < replacements.length; i++) {
22513
+ atRule2.cloneBefore({
22514
+ params: atRule2.params.replace(textToReplace, replacements[i])
22515
+ });
22516
+ }
22517
+ atRule2.remove();
22518
+ }
22188
22519
 
22189
22520
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/template-migration.js
22190
22521
  var import_schematics2 = require("@angular/cdk/schematics");
@@ -22203,7 +22534,7 @@ var TemplateMigration = class extends import_schematics2.Migration {
22203
22534
  this.enabled = true;
22204
22535
  }
22205
22536
  visitTemplate(template) {
22206
- this.fileSystem.overwrite(template.filePath, this.migrate(template.content, template.filePath));
22537
+ this.fileSystem.edit(template.filePath).remove(template.start, template.content.length).insertRight(template.start, this.migrate(template.content, template.filePath));
22207
22538
  }
22208
22539
  migrate(template, templateUrl) {
22209
22540
  const ast = parseTemplate2(template, templateUrl);
@@ -22365,9 +22696,8 @@ var RuntimeCodeMigration = class extends import_schematics3.Migration {
22365
22696
  };
22366
22697
 
22367
22698
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/index.mjs
22368
- var import_path = require("path");
22369
22699
  var migrationGroups = [
22370
- ["autocomplete", "form-field", "input", "select"],
22700
+ ["autocomplete", "form-field", "input", "option", "optgroup", "select"],
22371
22701
  ["button"],
22372
22702
  ["card"],
22373
22703
  ["checkbox"],
@@ -22400,33 +22730,53 @@ function getComponentsToMigrate(requested) {
22400
22730
  }
22401
22731
  return componentsToMigrate;
22402
22732
  }
22733
+ function runMigrations(context, fileSystem, tsconfigPath, migrators, analyzedFiles, additionalStylesheetPaths) {
22734
+ const program = import_schematics4.UpdateProject.createProgramFromTsconfig(tsconfigPath, fileSystem);
22735
+ const project = new import_schematics4.UpdateProject(context, program, fileSystem, analyzedFiles, context.logger);
22736
+ return !project.migrate([ThemingStylesMigration, TemplateMigration, RuntimeCodeMigration], null, migrators, additionalStylesheetPaths).hasFailures;
22737
+ }
22403
22738
  function mdc_migration_default(options) {
22404
- var _a;
22405
- const componentsToMigrate = getComponentsToMigrate(options.components);
22406
- const tsconfigPath = options.tsconfig;
22407
- const migrationDir = (_a = options.directory) != null ? _a : (0, import_path.dirname)(tsconfigPath);
22408
- console.log("Migrating:", [...componentsToMigrate]);
22409
- console.log("Directory:", migrationDir);
22410
- const migrators = [];
22411
- for (let i = 0; i < MIGRATORS.length; i++) {
22412
- if (componentsToMigrate.has(MIGRATORS[i].component)) {
22413
- migrators.push(MIGRATORS[i]);
22414
- }
22415
- }
22416
- return (tree, context) => {
22739
+ return (tree, context) => __async(this, null, function* () {
22740
+ const logger = context.logger;
22741
+ const workspace = yield (0, import_schematics4.getWorkspaceConfigGracefully)(tree);
22742
+ if (workspace === null) {
22743
+ logger.error("Could not find workspace configuration file.");
22744
+ return;
22745
+ }
22746
+ const projectNames = workspace.projects.keys();
22417
22747
  const fileSystem = new import_schematics4.DevkitFileSystem(tree);
22418
- const program = import_schematics4.UpdateProject.createProgramFromTsconfig(fileSystem.resolve(tsconfigPath), fileSystem);
22419
- const additionalStylesheetPaths = (0, import_schematics4.findStylesheetFiles)(tree, migrationDir);
22420
- const project = new import_schematics4.UpdateProject(context, program, fileSystem, /* @__PURE__ */ new Set(), context.logger);
22421
- const { hasFailures } = project.migrate([ThemingStylesMigration, TemplateMigration, RuntimeCodeMigration], null, migrators, additionalStylesheetPaths);
22748
+ const analyzedFiles = /* @__PURE__ */ new Set();
22749
+ const componentsToMigrate = getComponentsToMigrate(options.components);
22750
+ const migrators = MIGRATORS.filter((m) => componentsToMigrate.has(m.component));
22751
+ let additionalStylesheetPaths = options.directory ? (0, import_schematics4.findStylesheetFiles)(tree, options.directory) : [];
22752
+ let success = true;
22753
+ logger.info(`Migrating components:
22754
+ ${[...componentsToMigrate].join("\n")}`);
22755
+ for (const projectName of projectNames) {
22756
+ const project = workspace.projects.get(projectName);
22757
+ const tsconfigPaths = [
22758
+ (0, import_schematics4.getTargetTsconfigPath)(project, "build"),
22759
+ (0, import_schematics4.getTargetTsconfigPath)(project, "test")
22760
+ ].filter((p) => !!p);
22761
+ if (!tsconfigPaths.length) {
22762
+ logger.warn(`Skipping migration for project ${projectName}. Unable to determine 'tsconfig.json' file in workspace config.`);
22763
+ continue;
22764
+ }
22765
+ if (!options.directory) {
22766
+ additionalStylesheetPaths = (0, import_schematics4.findStylesheetFiles)(tree, project.root);
22767
+ }
22768
+ logger.info(`Migrating project: ${projectName}`);
22769
+ for (const tsconfigPath of tsconfigPaths) {
22770
+ success && (success = runMigrations(context, fileSystem, tsconfigPath, migrators, analyzedFiles, additionalStylesheetPaths));
22771
+ }
22772
+ }
22422
22773
  fileSystem.commitEdits();
22423
- if (hasFailures) {
22424
- context.logger.error("Unable to migrate project. See errors above.");
22774
+ if (!success) {
22775
+ logger.error("Unable to migrate project. See errors above.");
22425
22776
  } else {
22426
- context.logger.info("Successfully migrated the project.");
22777
+ logger.info("Successfully migrated the project.");
22427
22778
  }
22428
- return tree;
22429
- };
22779
+ });
22430
22780
  }
22431
22781
  // Annotate the CommonJS export names for ESM import in node:
22432
22782
  0 && (module.exports = {});