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

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 (101) hide show
  1. package/button/_button-theme-private.scss +5 -2
  2. package/button/index.d.ts +5 -1
  3. package/button/testing/index.d.ts +8 -0
  4. package/chips/index.d.ts +13 -1
  5. package/core/_core.scss +1 -2
  6. package/core/mdc-helpers/_mdc-helpers.scss +8 -6
  7. package/core/typography/_all-typography.scss +73 -81
  8. package/datepicker/index.d.ts +10 -2
  9. package/esm2020/button/button-base.mjs +17 -3
  10. package/esm2020/button/button.mjs +4 -4
  11. package/esm2020/button/testing/button-harness-filters.mjs +1 -1
  12. package/esm2020/button/testing/button-harness.mjs +28 -2
  13. package/esm2020/checkbox/checkbox.mjs +2 -2
  14. package/esm2020/chips/chip-option.mjs +17 -7
  15. package/esm2020/core/version.mjs +1 -1
  16. package/esm2020/datepicker/datepicker-intl.mjs +11 -3
  17. package/esm2020/icon/icon.mjs +3 -2
  18. package/esm2020/legacy-button/testing/button-harness.mjs +27 -2
  19. package/esm2020/legacy-button/testing/public-api.mjs +1 -1
  20. package/esm2020/list/action-list.mjs +2 -2
  21. package/esm2020/list/list-base.mjs +5 -2
  22. package/esm2020/list/list-option.mjs +2 -2
  23. package/esm2020/list/list.mjs +12 -4
  24. package/esm2020/list/nav-list.mjs +2 -2
  25. package/esm2020/list/selection-list.mjs +36 -6
  26. package/esm2020/slider/slider.mjs +3 -3
  27. package/esm2020/table/table.mjs +2 -2
  28. package/esm2020/tooltip/tooltip.mjs +25 -14
  29. package/fesm2015/button/testing.mjs +29 -1
  30. package/fesm2015/button/testing.mjs.map +1 -1
  31. package/fesm2015/button.mjs +27 -6
  32. package/fesm2015/button.mjs.map +1 -1
  33. package/fesm2015/checkbox.mjs +2 -2
  34. package/fesm2015/checkbox.mjs.map +1 -1
  35. package/fesm2015/chips.mjs +16 -6
  36. package/fesm2015/chips.mjs.map +1 -1
  37. package/fesm2015/core.mjs +1 -1
  38. package/fesm2015/core.mjs.map +1 -1
  39. package/fesm2015/datepicker.mjs +10 -2
  40. package/fesm2015/datepicker.mjs.map +1 -1
  41. package/fesm2015/icon.mjs +2 -1
  42. package/fesm2015/icon.mjs.map +1 -1
  43. package/fesm2015/legacy-button/testing.mjs +28 -1
  44. package/fesm2015/legacy-button/testing.mjs.map +1 -1
  45. package/fesm2015/list.mjs +57 -15
  46. package/fesm2015/list.mjs.map +1 -1
  47. package/fesm2015/slider.mjs +2 -2
  48. package/fesm2015/slider.mjs.map +1 -1
  49. package/fesm2015/table.mjs +2 -2
  50. package/fesm2015/table.mjs.map +1 -1
  51. package/fesm2015/tooltip.mjs +24 -13
  52. package/fesm2015/tooltip.mjs.map +1 -1
  53. package/fesm2020/button/testing.mjs +27 -1
  54. package/fesm2020/button/testing.mjs.map +1 -1
  55. package/fesm2020/button.mjs +20 -6
  56. package/fesm2020/button.mjs.map +1 -1
  57. package/fesm2020/checkbox.mjs +2 -2
  58. package/fesm2020/checkbox.mjs.map +1 -1
  59. package/fesm2020/chips.mjs +16 -6
  60. package/fesm2020/chips.mjs.map +1 -1
  61. package/fesm2020/core.mjs +1 -1
  62. package/fesm2020/core.mjs.map +1 -1
  63. package/fesm2020/datepicker.mjs +10 -2
  64. package/fesm2020/datepicker.mjs.map +1 -1
  65. package/fesm2020/icon.mjs +2 -1
  66. package/fesm2020/icon.mjs.map +1 -1
  67. package/fesm2020/legacy-button/testing.mjs +26 -1
  68. package/fesm2020/legacy-button/testing.mjs.map +1 -1
  69. package/fesm2020/list.mjs +56 -15
  70. package/fesm2020/list.mjs.map +1 -1
  71. package/fesm2020/slider.mjs +2 -2
  72. package/fesm2020/slider.mjs.map +1 -1
  73. package/fesm2020/table.mjs +2 -2
  74. package/fesm2020/table.mjs.map +1 -1
  75. package/fesm2020/tooltip.mjs +24 -13
  76. package/fesm2020/tooltip.mjs.map +1 -1
  77. package/legacy-button/testing/index.d.ts +5 -0
  78. package/legacy-core/_core.scss +1 -2
  79. package/legacy-prebuilt-themes/legacy-deeppurple-amber.css +1 -1
  80. package/legacy-prebuilt-themes/legacy-indigo-pink.css +1 -1
  81. package/legacy-prebuilt-themes/legacy-pink-bluegrey.css +1 -1
  82. package/legacy-prebuilt-themes/legacy-purple-green.css +1 -1
  83. package/list/_list-item-hcm-indicator.scss +30 -0
  84. package/list/index.d.ts +30 -3
  85. package/package.json +49 -49
  86. package/prebuilt-themes/deeppurple-amber.css +1 -1
  87. package/prebuilt-themes/indigo-pink.css +1 -1
  88. package/prebuilt-themes/pink-bluegrey.css +1 -1
  89. package/prebuilt-themes/purple-green.css +1 -1
  90. package/schematics/ng-add/index.js +1 -1
  91. package/schematics/ng-add/index.mjs +1 -1
  92. package/schematics/ng-generate/mdc-migration/index_bundled.js +706 -410
  93. package/schematics/ng-generate/mdc-migration/index_bundled.js.map +3 -3
  94. package/schematics/ng-generate/mdc-migration/mdc_migration_bundle_metadata.json +1 -1
  95. package/schematics/ng-generate/mdc-migration/schema.json +2 -5
  96. package/schematics/ng-update/index_bundled.js +6 -1
  97. package/schematics/ng-update/index_bundled.js.map +2 -2
  98. package/schematics/ng-update/ng_update_index_metadata.json +1 -1
  99. package/slide-toggle/_slide-toggle-theme.scss +19 -19
  100. package/slider/_slider-theme.scss +50 -73
  101. 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) {
6289
- var _a;
6261
+ getMixinChange(namespace, atRule2) {
6262
+ var _a, _b;
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
- const replacements = [...change.new];
6269
+ const replacements = [...(_a = change.new) != null ? _a : []];
6297
6270
  if (change.checkForDuplicates) {
6298
- const mixinArgumentMatches = atRule2.params.match(MIXIN_ARGUMENTS_REGEX);
6271
+ const mixinArgumentMatches = (_b = atRule2.params) == null ? void 0 : _b.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] : "");
@@ -6305,34 +6278,19 @@ var StyleMigrator = class {
6305
6278
  }
6306
6279
  });
6307
6280
  }
6308
- 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
- });
6320
- }
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();
6281
+ return { old: change.old, new: replacements.length ? replacements : null };
6328
6282
  }
6329
6283
  isLegacySelector(rule2) {
6330
- return this.classChanges.some((change) => rule2.selector.match(change.old + END_OF_SELECTOR_REGEX) !== null);
6284
+ return this.classChanges.some((change) => {
6285
+ var _a;
6286
+ return ((_a = rule2.selector) == null ? void 0 : _a.match(change.old + END_OF_SELECTOR_REGEX)) !== null;
6287
+ });
6331
6288
  }
6332
6289
  replaceLegacySelector(rule2) {
6290
+ var _a;
6333
6291
  for (let i = 0; i < this.classChanges.length; i++) {
6334
6292
  const change = this.classChanges[i];
6335
- if (rule2.selector.match(change.old + END_OF_SELECTOR_REGEX)) {
6293
+ if ((_a = rule2.selector) == null ? void 0 : _a.match(change.old + END_OF_SELECTOR_REGEX)) {
6336
6294
  rule2.selector = rule2.selector.replace(change.old, change.new);
6337
6295
  }
6338
6296
  }
@@ -6340,16 +6298,6 @@ var StyleMigrator = class {
6340
6298
  isDeprecatedSelector(rule2) {
6341
6299
  return this.deprecatedPrefixes.some((deprecatedPrefix) => rule2.selector.includes(deprecatedPrefix));
6342
6300
  }
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
6301
  };
6354
6302
 
6355
6303
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/autocomplete/autocomplete-styles.js
@@ -6361,7 +6309,15 @@ var AutocompleteStylesMigrator = class extends StyleMigrator {
6361
6309
  this.mixinChanges = [
6362
6310
  {
6363
6311
  old: "legacy-autocomplete-theme",
6364
- new: ["autocomplete-theme", "autocomplete-typography"]
6312
+ new: ["autocomplete-theme"]
6313
+ },
6314
+ {
6315
+ old: "legacy-autocomplete-color",
6316
+ new: ["autocomplete-color"]
6317
+ },
6318
+ {
6319
+ old: "legacy-autocomplete-typography",
6320
+ new: ["autocomplete-typography"]
6365
6321
  }
6366
6322
  ];
6367
6323
  this.classChanges = [{ old: ".mat-autocomplete", new: ".mat-mdc-autocomplete" }];
@@ -6377,14 +6333,17 @@ var ButtonStylesMigrator = class extends StyleMigrator {
6377
6333
  this.mixinChanges = [
6378
6334
  {
6379
6335
  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
- ],
6336
+ new: ["button-theme", "fab-theme", "icon-button-theme"],
6337
+ checkForDuplicates: true
6338
+ },
6339
+ {
6340
+ old: "legacy-button-color",
6341
+ new: ["button-color", "fab-color", "icon-button-color"],
6342
+ checkForDuplicates: true
6343
+ },
6344
+ {
6345
+ old: "legacy-button-typography",
6346
+ new: ["button-typography", "fab-typography", "icon-button-typography"],
6388
6347
  checkForDuplicates: true
6389
6348
  }
6390
6349
  ];
@@ -6410,7 +6369,15 @@ var CardStylesMigrator = class extends StyleMigrator {
6410
6369
  this.mixinChanges = [
6411
6370
  {
6412
6371
  old: "legacy-card-theme",
6413
- new: ["card-theme", "card-typography"]
6372
+ new: ["card-theme"]
6373
+ },
6374
+ {
6375
+ old: "legacy-card-color",
6376
+ new: ["card-color"]
6377
+ },
6378
+ {
6379
+ old: "legacy-card-typography",
6380
+ new: ["card-typography"]
6414
6381
  }
6415
6382
  ];
6416
6383
  this.classChanges = [
@@ -6810,12 +6777,12 @@ function utf8Encode(str) {
6810
6777
  }
6811
6778
  return encoded;
6812
6779
  }
6813
- function stringify2(token) {
6780
+ function stringify(token) {
6814
6781
  if (typeof token === "string") {
6815
6782
  return token;
6816
6783
  }
6817
6784
  if (Array.isArray(token)) {
6818
- return "[" + token.map(stringify2).join(", ") + "]";
6785
+ return "[" + token.map(stringify).join(", ") + "]";
6819
6786
  }
6820
6787
  if (token == null) {
6821
6788
  return "" + token;
@@ -9389,7 +9356,7 @@ var Text$2 = class {
9389
9356
  return visitor.visitText(this, context);
9390
9357
  }
9391
9358
  };
9392
- var Container2 = class {
9359
+ var Container = class {
9393
9360
  constructor(children, sourceSpan) {
9394
9361
  this.children = children;
9395
9362
  this.sourceSpan = sourceSpan;
@@ -9560,7 +9527,7 @@ function updatePlaceholderMap(map, name, ...values) {
9560
9527
  function assembleBoundTextPlaceholders(meta, bindingStartIndex = 0, contextId = 0) {
9561
9528
  const startIdx = bindingStartIndex;
9562
9529
  const placeholders = /* @__PURE__ */ new Map();
9563
- const node = meta instanceof Message ? meta.nodes.find((node2) => node2 instanceof Container2) : meta;
9530
+ const node = meta instanceof Message ? meta.nodes.find((node2) => node2 instanceof Container) : meta;
9564
9531
  if (node) {
9565
9532
  node.children.filter((child) => child instanceof Placeholder).forEach((child, idx) => {
9566
9533
  const content = wrapI18nPlaceholder(startIdx + idx, contextId);
@@ -10107,7 +10074,7 @@ function identifierName(compileIdentifier) {
10107
10074
  if (ref["__forward_ref__"]) {
10108
10075
  return "__forward_ref__";
10109
10076
  }
10110
- let identifier = stringify2(ref);
10077
+ let identifier = stringify(ref);
10111
10078
  if (identifier.indexOf("(") >= 0) {
10112
10079
  identifier = `anonymous_${_anonymousTypeIndex++}`;
10113
10080
  ref["__anonymousType"] = identifier;
@@ -12102,7 +12069,7 @@ function repeatGroups(groups, multiples) {
12102
12069
  }
12103
12070
  }
12104
12071
  }
12105
- function parse2(value) {
12072
+ function parse(value) {
12106
12073
  const styles = [];
12107
12074
  let i = 0;
12108
12075
  let parenDepth = 0;
@@ -12273,7 +12240,7 @@ var StylingBuilder = class {
12273
12240
  }
12274
12241
  }
12275
12242
  registerStyleAttr(value) {
12276
- this._initialStyleValues = parse2(value);
12243
+ this._initialStyleValues = parse(value);
12277
12244
  this._hasInitialValues = true;
12278
12245
  }
12279
12246
  registerClassAttr(value) {
@@ -13825,7 +13792,7 @@ var Element = class extends NodeWithI18n {
13825
13792
  return visitor.visitElement(this, context);
13826
13793
  }
13827
13794
  };
13828
- var Comment2 = class {
13795
+ var Comment = class {
13829
13796
  constructor(value, sourceSpan) {
13830
13797
  this.value = value;
13831
13798
  this.sourceSpan = sourceSpan;
@@ -16887,7 +16854,7 @@ var _TreeBuilder = class {
16887
16854
  const text = this._advanceIf(7);
16888
16855
  this._advanceIf(11);
16889
16856
  const value = text != null ? text.parts[0].trim() : null;
16890
- this._addToParent(new Comment2(value, token.sourceSpan));
16857
+ this._addToParent(new Comment(value, token.sourceSpan));
16891
16858
  }
16892
16859
  _consumeExpansion(token) {
16893
16860
  const switchValue = this._advance();
@@ -18334,7 +18301,7 @@ function isEmptyTextNode(node) {
18334
18301
  return node instanceof Text && node.value.trim().length == 0;
18335
18302
  }
18336
18303
  function isCommentNode(node) {
18337
- return node instanceof Comment2;
18304
+ return node instanceof Comment;
18338
18305
  }
18339
18306
  function textContents(node) {
18340
18307
  if (node.children.length !== 1 || !(node.children[0] instanceof Text)) {
@@ -18663,7 +18630,7 @@ var _I18nVisitor = class {
18663
18630
  const i18nIcuCases = {};
18664
18631
  const i18nIcu = new Icu(icu.switchValue, icu.type, i18nIcuCases, icu.sourceSpan);
18665
18632
  icu.cases.forEach((caze) => {
18666
- i18nIcuCases[caze.value] = new Container2(caze.expression.map((node2) => node2.visit(this, context)), caze.expSourceSpan);
18633
+ i18nIcuCases[caze.value] = new Container(caze.expression.map((node2) => node2.visit(this, context)), caze.expSourceSpan);
18667
18634
  });
18668
18635
  context.icuDepth--;
18669
18636
  if (context.isIcu || context.icuDepth > 0) {
@@ -18715,7 +18682,7 @@ var _I18nVisitor = class {
18715
18682
  }
18716
18683
  if (hasInterpolation) {
18717
18684
  reusePreviousSourceSpans(nodes, previousI18n);
18718
- return new Container2(nodes, sourceSpan);
18685
+ return new Container(nodes, sourceSpan);
18719
18686
  } else {
18720
18687
  return nodes[0];
18721
18688
  }
@@ -18726,7 +18693,7 @@ function reusePreviousSourceSpans(nodes, previousI18n) {
18726
18693
  assertSingleContainerMessage(previousI18n);
18727
18694
  previousI18n = previousI18n.nodes[0];
18728
18695
  }
18729
- if (previousI18n instanceof Container2) {
18696
+ if (previousI18n instanceof Container) {
18730
18697
  assertEquivalentNodes(previousI18n.children, nodes);
18731
18698
  for (let i = 0; i < nodes.length; i++) {
18732
18699
  nodes[i].sourceSpan = previousI18n.children[i].sourceSpan;
@@ -18735,7 +18702,7 @@ function reusePreviousSourceSpans(nodes, previousI18n) {
18735
18702
  }
18736
18703
  function assertSingleContainerMessage(message) {
18737
18704
  const nodes = message.nodes;
18738
- if (nodes.length !== 1 || !(nodes[0] instanceof Container2)) {
18705
+ if (nodes.length !== 1 || !(nodes[0] instanceof Container)) {
18739
18706
  throw new Error("Unexpected previous i18n message - expected it to consist of only a single `Container` node.");
18740
18707
  }
18741
18708
  }
@@ -21304,17 +21271,38 @@ function replaceEndTag(html, node, tag) {
21304
21271
  }
21305
21272
  return replaceAt(html, node.endSourceSpan.start.offset + 2, node.name, tag);
21306
21273
  }
21307
- function addAttribute(html, node, name, value) {
21274
+ function updateAttribute(html, node, name, update) {
21275
+ var _a;
21276
+ const existingAttr = node.attributes.find((currentAttr) => currentAttr.name === name);
21277
+ if (existingAttr && existingAttr.keySpan) {
21278
+ const updatedValue = update(((_a = existingAttr.valueSpan) == null ? void 0 : _a.toString()) || "");
21279
+ if (updatedValue == null) {
21280
+ return html.slice(0, existingAttr.sourceSpan.start.offset).trimEnd() + html.slice(existingAttr.sourceSpan.end.offset);
21281
+ } else if (updatedValue == "") {
21282
+ return html.slice(0, existingAttr.keySpan.end.offset) + html.slice(existingAttr.sourceSpan.end.offset);
21283
+ } else {
21284
+ if (existingAttr.valueSpan) {
21285
+ return html.slice(0, existingAttr.valueSpan.start.offset) + updatedValue + html.slice(existingAttr.valueSpan.end.offset);
21286
+ } else {
21287
+ return html.slice(0, existingAttr.keySpan.end.offset) + `="${updatedValue}"` + html.slice(existingAttr.keySpan.end.offset);
21288
+ }
21289
+ }
21290
+ }
21291
+ const newValue = update(null);
21292
+ if (newValue == null) {
21293
+ return html;
21294
+ }
21308
21295
  const index2 = node.startSourceSpan.start.offset + node.name.length + 1;
21309
21296
  const prefix = html.slice(0, index2);
21310
21297
  const suffix = html.slice(index2);
21298
+ const attrText = newValue ? `${name}="${newValue}"` : `${name}`;
21311
21299
  if (node.startSourceSpan.start.line === node.startSourceSpan.end.line) {
21312
- return prefix + ` ${name}="${value}"` + suffix;
21300
+ return `${prefix} ${attrText}${suffix}`;
21313
21301
  }
21314
21302
  const attr = node.attributes[0];
21315
21303
  const ctx = attr.sourceSpan.start.getContext(attr.sourceSpan.start.col + 1, 1);
21316
21304
  const indentation = ctx.before;
21317
- return prefix + indentation + `${name}="${value}"` + suffix;
21305
+ return prefix + indentation + attrText + suffix;
21318
21306
  }
21319
21307
  function replaceAt(str, offset, oldSubstr, newSubstr) {
21320
21308
  const index2 = offset;
@@ -21333,7 +21321,7 @@ var CardTemplateMigrator = class extends TemplateMigrator {
21333
21321
  }
21334
21322
  updates.push({
21335
21323
  offset: node.startSourceSpan.start.offset,
21336
- updateFn: (html) => addAttribute(html, node, "appearance", "outlined")
21324
+ updateFn: (html) => updateAttribute(html, node, "appearance", () => "outlined")
21337
21325
  });
21338
21326
  });
21339
21327
  return updates;
@@ -21349,7 +21337,15 @@ var CheckboxStylesMigrator = class extends StyleMigrator {
21349
21337
  this.mixinChanges = [
21350
21338
  {
21351
21339
  old: "legacy-checkbox-theme",
21352
- new: ["checkbox-theme", "checkbox-typography"]
21340
+ new: ["checkbox-theme"]
21341
+ },
21342
+ {
21343
+ old: "legacy-checkbox-color",
21344
+ new: ["checkbox-color"]
21345
+ },
21346
+ {
21347
+ old: "legacy-checkbox-typography",
21348
+ new: ["checkbox-typography"]
21353
21349
  }
21354
21350
  ];
21355
21351
  this.classChanges = [{ old: ".mat-checkbox", new: ".mat-mdc-checkbox" }];
@@ -21365,7 +21361,15 @@ var ChipsStylesMigrator = class extends StyleMigrator {
21365
21361
  this.mixinChanges = [
21366
21362
  {
21367
21363
  old: "legacy-chips-theme",
21368
- new: ["chips-theme", "chips-typography"]
21364
+ new: ["chips-theme"]
21365
+ },
21366
+ {
21367
+ old: "legacy-chips-color",
21368
+ new: ["chips-color"]
21369
+ },
21370
+ {
21371
+ old: "legacy-chips-typography",
21372
+ new: ["chips-typography"]
21369
21373
  }
21370
21374
  ];
21371
21375
  this.classChanges = [
@@ -21468,7 +21472,15 @@ var DialogStylesMigrator = class extends StyleMigrator {
21468
21472
  this.mixinChanges = [
21469
21473
  {
21470
21474
  old: "legacy-dialog-theme",
21471
- new: ["dialog-theme", "dialog-typography"]
21475
+ new: ["dialog-theme"]
21476
+ },
21477
+ {
21478
+ old: "legacy-dialog-color",
21479
+ new: ["dialog-color"]
21480
+ },
21481
+ {
21482
+ old: "legacy-dialog-typography",
21483
+ new: ["dialog-typography"]
21472
21484
  }
21473
21485
  ];
21474
21486
  this.classChanges = [
@@ -21507,7 +21519,18 @@ var FormFieldStylesMigrator = class extends StyleMigrator {
21507
21519
  this.mixinChanges = [
21508
21520
  {
21509
21521
  old: "legacy-form-field-theme",
21510
- new: ["form-field-theme", "form-field-typography"]
21522
+ new: ["form-field-theme"],
21523
+ checkForDuplicates: true
21524
+ },
21525
+ {
21526
+ old: "legacy-form-field-color",
21527
+ new: ["form-field-color"],
21528
+ checkForDuplicates: true
21529
+ },
21530
+ {
21531
+ old: "legacy-form-field-typography",
21532
+ new: ["form-field-typography"],
21533
+ checkForDuplicates: true
21511
21534
  }
21512
21535
  ];
21513
21536
  this.classChanges = [
@@ -21536,7 +21559,15 @@ var InputStylesMigrator = class extends StyleMigrator {
21536
21559
  this.mixinChanges = [
21537
21560
  {
21538
21561
  old: "legacy-input-theme",
21539
- new: ["input-theme", "input-typography"]
21562
+ new: ["input-theme"]
21563
+ },
21564
+ {
21565
+ old: "legacy-input-color",
21566
+ new: ["input-color"]
21567
+ },
21568
+ {
21569
+ old: "legacy-input-typography",
21570
+ new: ["input-typography"]
21540
21571
  }
21541
21572
  ];
21542
21573
  this.classChanges = [{ old: ".mat-input-element", new: ".mat-mdc-input-element" }];
@@ -21552,7 +21583,15 @@ var ListStylesMigrator = class extends StyleMigrator {
21552
21583
  this.mixinChanges = [
21553
21584
  {
21554
21585
  old: "legacy-list-theme",
21555
- new: ["list-theme", "list-typography"]
21586
+ new: ["list-theme"]
21587
+ },
21588
+ {
21589
+ old: "legacy-list-color",
21590
+ new: ["list-color"]
21591
+ },
21592
+ {
21593
+ old: "legacy-list-typography",
21594
+ new: ["list-typography"]
21556
21595
  }
21557
21596
  ];
21558
21597
  this.classChanges = [
@@ -21575,7 +21614,15 @@ var MenuStylesMigrator = class extends StyleMigrator {
21575
21614
  this.mixinChanges = [
21576
21615
  {
21577
21616
  old: "legacy-menu-theme",
21578
- new: ["menu-theme", "menu-typography"]
21617
+ new: ["menu-theme"]
21618
+ },
21619
+ {
21620
+ old: "legacy-menu-color",
21621
+ new: ["menu-color"]
21622
+ },
21623
+ {
21624
+ old: "legacy-menu-typography",
21625
+ new: ["menu-typography"]
21579
21626
  }
21580
21627
  ];
21581
21628
  this.classChanges = [
@@ -21600,7 +21647,23 @@ var PaginatorStylesMigrator = class extends StyleMigrator {
21600
21647
  this.mixinChanges = [
21601
21648
  {
21602
21649
  old: "legacy-paginator-theme",
21603
- new: ["paginator-theme", "paginator-typography"]
21650
+ new: ["paginator-theme", "icon-button-theme", "form-field-theme", "select-theme"],
21651
+ checkForDuplicates: true
21652
+ },
21653
+ {
21654
+ old: "legacy-paginator-color",
21655
+ new: ["paginator-color", "icon-button-color", "form-field-color", "select-color"],
21656
+ checkForDuplicates: true
21657
+ },
21658
+ {
21659
+ old: "legacy-paginator-typography",
21660
+ new: [
21661
+ "paginator-typography",
21662
+ "icon-button-typography",
21663
+ "form-field-typography",
21664
+ "select-typography"
21665
+ ],
21666
+ checkForDuplicates: true
21604
21667
  }
21605
21668
  ];
21606
21669
  this.classChanges = [
@@ -21630,7 +21693,15 @@ var ProgressBarStylesMigrator = class extends StyleMigrator {
21630
21693
  this.mixinChanges = [
21631
21694
  {
21632
21695
  old: "legacy-progress-bar-theme",
21633
- new: ["progress-bar-theme", "progress-bar-typography"]
21696
+ new: ["progress-bar-theme"]
21697
+ },
21698
+ {
21699
+ old: "legacy-progress-bar-color",
21700
+ new: ["progress-bar-color"]
21701
+ },
21702
+ {
21703
+ old: "legacy-progress-bar-typography",
21704
+ new: ["progress-bar-typography"]
21634
21705
  }
21635
21706
  ];
21636
21707
  this.classChanges = [{ old: ".mat-progress-bar", new: ".mat-mdc-progress-bar" }];
@@ -21646,7 +21717,15 @@ var ProgressSpinnerStylesMigrator = class extends StyleMigrator {
21646
21717
  this.mixinChanges = [
21647
21718
  {
21648
21719
  old: "legacy-progress-spinner-theme",
21649
- new: ["progress-spinner-theme", "progress-spinner-typography"]
21720
+ new: ["progress-spinner-theme"]
21721
+ },
21722
+ {
21723
+ old: "legacy-progress-spinner-color",
21724
+ new: ["progress-spinner-color"]
21725
+ },
21726
+ {
21727
+ old: "legacy-progress-spinner-typography",
21728
+ new: ["progress-spinner-typography"]
21650
21729
  }
21651
21730
  ];
21652
21731
  this.classChanges = [
@@ -21665,7 +21744,15 @@ var RadioStylesMigrator = class extends StyleMigrator {
21665
21744
  this.mixinChanges = [
21666
21745
  {
21667
21746
  old: "legacy-radio-theme",
21668
- new: ["radio-theme", "radio-typography"]
21747
+ new: ["radio-theme"]
21748
+ },
21749
+ {
21750
+ old: "legacy-radio-color",
21751
+ new: ["radio-color"]
21752
+ },
21753
+ {
21754
+ old: "legacy-radio-typography",
21755
+ new: ["radio-typography"]
21669
21756
  }
21670
21757
  ];
21671
21758
  this.classChanges = [
@@ -21675,168 +21762,6 @@ var RadioStylesMigrator = class extends StyleMigrator {
21675
21762
  }
21676
21763
  };
21677
21764
 
21678
- // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/ts-migration/runtime-migrator.js
21679
- var ts = __toESM(require("typescript"));
21680
-
21681
- // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/ts-migration/import-replacements.js
21682
- var IMPORT_REPLACEMENTS = {
21683
- "button": {
21684
- old: "@angular/material/legacy-button",
21685
- new: "@angular/material/button"
21686
- },
21687
- "card": {
21688
- old: "@angular/material/legacy-card",
21689
- new: "@angular/material/card"
21690
- },
21691
- "checkbox": {
21692
- old: "@angular/material/legacy-checkbox",
21693
- new: "@angular/material/checkbox"
21694
- },
21695
- "chips": {
21696
- old: "@angular/material/legacy-chips",
21697
- new: "@angular/material/chips"
21698
- },
21699
- "dialog": {
21700
- old: "@angular/material/legacy-dialog",
21701
- new: "@angular/material/dialog"
21702
- },
21703
- "autocomplete": {
21704
- old: "@angular/material/legacy-autocomplete",
21705
- new: "@angular/material/autocomplete"
21706
- },
21707
- "form-field": {
21708
- old: "@angular/material/legacy-form-field",
21709
- new: "@angular/material/form-field"
21710
- },
21711
- "input": {
21712
- old: "@angular/material/legacy-input",
21713
- new: "@angular/material/input"
21714
- },
21715
- "select": {
21716
- old: "@angular/material/legacy-select",
21717
- new: "@angular/material/select"
21718
- },
21719
- "core": {
21720
- old: "@angular/material/legacy-core",
21721
- new: "@angular/material/core"
21722
- },
21723
- "list": {
21724
- old: "@angular/material/legacy-list",
21725
- new: "@angular/material/list"
21726
- },
21727
- "menu": {
21728
- old: "@angular/material/legacy-menu",
21729
- new: "@angular/material/menu"
21730
- },
21731
- "progress-bar": {
21732
- old: "@angular/material/legacy-progress-bar",
21733
- new: "@angular/material/progress-bar"
21734
- },
21735
- "progress-spinner": {
21736
- old: "@angular/material/legacy-progress-spinner",
21737
- new: "@angular/material/progress-spinner"
21738
- },
21739
- "radio": {
21740
- old: "@angular/material/legacy-radio",
21741
- new: "@angular/material/radio"
21742
- },
21743
- "sidenav": {
21744
- old: "@angular/material/legacy-sidenav",
21745
- new: "@angular/material-experimental/legacy-sidenav"
21746
- },
21747
- "slide-toggle": {
21748
- old: "@angular/material/legacy-slide-toggle",
21749
- new: "@angular/material/slide-toggle"
21750
- },
21751
- "slider": {
21752
- old: "@angular/material/legacy-slider",
21753
- new: "@angular/material/slider"
21754
- },
21755
- "snack-bar": {
21756
- old: "@angular/material/legacy-snack-bar",
21757
- new: "@angular/material/snack-bar"
21758
- },
21759
- "table": {
21760
- old: "@angular/material/legacy-table",
21761
- new: "@angular/material/table"
21762
- },
21763
- "tabs": {
21764
- old: "@angular/material/legacy-tabs",
21765
- new: "@angular/material/tabs"
21766
- },
21767
- "paginator": {
21768
- old: "@angular/material/legacy-paginator",
21769
- new: "@angular/material/paginator"
21770
- },
21771
- "tooltip": {
21772
- old: "@angular/material/legacy-tooltip",
21773
- new: "@angular/material/tooltip"
21774
- }
21775
- };
21776
-
21777
- // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/ts-migration/runtime-migrator.js
21778
- var RuntimeMigrator = class {
21779
- constructor(component) {
21780
- const replacements = IMPORT_REPLACEMENTS[component];
21781
- this.oldImportModule = replacements.old;
21782
- this.newImportModule = replacements.new;
21783
- const firstLetterCapitalizedComponent = component[0].toUpperCase() + component.slice(1);
21784
- const capitalizedComponent = component.toUpperCase();
21785
- this.importSpecifierReplacements = [
21786
- {
21787
- old: "MatLegacy" + firstLetterCapitalizedComponent,
21788
- new: "Mat" + firstLetterCapitalizedComponent
21789
- },
21790
- {
21791
- old: "MAT_LEGACY_" + capitalizedComponent,
21792
- new: "MAT_" + capitalizedComponent
21793
- }
21794
- ];
21795
- }
21796
- updateImportOrExportSpecifier(specifier) {
21797
- const newSpecifier = this._getNewSpecifier(specifier);
21798
- if (!newSpecifier) {
21799
- return null;
21800
- }
21801
- return ts.factory.createIdentifier(newSpecifier);
21802
- }
21803
- updateImportSpecifierWithPossibleAlias(importSpecifier) {
21804
- var _a;
21805
- const newImport = this._getNewSpecifier((_a = importSpecifier.propertyName) != null ? _a : importSpecifier.name);
21806
- if (!newImport) {
21807
- return null;
21808
- }
21809
- let newPropertyName;
21810
- let newName;
21811
- if (importSpecifier.propertyName && importSpecifier.name.text !== newImport) {
21812
- newPropertyName = ts.factory.createIdentifier(newImport);
21813
- newName = importSpecifier.name;
21814
- } else {
21815
- newPropertyName = void 0;
21816
- newName = ts.factory.createIdentifier(newImport);
21817
- }
21818
- return ts.factory.createImportSpecifier(false, newPropertyName, newName);
21819
- }
21820
- updateModuleSpecifier(specifier) {
21821
- if (specifier.text !== this.oldImportModule) {
21822
- return null;
21823
- }
21824
- return ts.factory.createStringLiteral(this.newImportModule, this._isSingleQuoteLiteral(specifier));
21825
- }
21826
- _getNewSpecifier(node) {
21827
- let newImport = null;
21828
- this.importSpecifierReplacements.forEach((replacement) => {
21829
- if (node.text.match(replacement.old)) {
21830
- newImport = node.text.replace(replacement.old, replacement.new);
21831
- }
21832
- });
21833
- return newImport;
21834
- }
21835
- _isSingleQuoteLiteral(literal2) {
21836
- return literal2.getText()[0] !== `"`;
21837
- }
21838
- };
21839
-
21840
21765
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/select/select-styles.js
21841
21766
  var SelectStylesMigrator = class extends StyleMigrator {
21842
21767
  constructor() {
@@ -21846,7 +21771,18 @@ var SelectStylesMigrator = class extends StyleMigrator {
21846
21771
  this.mixinChanges = [
21847
21772
  {
21848
21773
  old: "legacy-select-theme",
21849
- new: ["select-theme", "select-typography", "core-theme", "core-typography"]
21774
+ new: ["select-theme"],
21775
+ checkForDuplicates: true
21776
+ },
21777
+ {
21778
+ old: "legacy-select-color",
21779
+ new: ["select-color"],
21780
+ checkForDuplicates: true
21781
+ },
21782
+ {
21783
+ old: "legacy-select-typography",
21784
+ new: ["select-typography"],
21785
+ checkForDuplicates: true
21850
21786
  }
21851
21787
  ];
21852
21788
  this.classChanges = [
@@ -21866,7 +21802,15 @@ var SlideToggleStylesMigrator = class extends StyleMigrator {
21866
21802
  this.mixinChanges = [
21867
21803
  {
21868
21804
  old: "legacy-slide-toggle-theme",
21869
- new: ["slide-toggle-theme", "slide-toggle-typography"]
21805
+ new: ["slide-toggle-theme"]
21806
+ },
21807
+ {
21808
+ old: "legacy-slide-toggle-color",
21809
+ new: ["slide-toggle-color"]
21810
+ },
21811
+ {
21812
+ old: "legacy-slide-toggle-typography",
21813
+ new: ["slide-toggle-typography"]
21870
21814
  }
21871
21815
  ];
21872
21816
  this.classChanges = [{ old: ".mat-slide-toggle", new: ".mat-mdc-slide-toggle" }];
@@ -21882,7 +21826,15 @@ var SliderStylesMigrator = class extends StyleMigrator {
21882
21826
  this.mixinChanges = [
21883
21827
  {
21884
21828
  old: "legacy-slider-theme",
21885
- new: ["slider-theme", "slider-typography"]
21829
+ new: ["slider-theme"]
21830
+ },
21831
+ {
21832
+ old: "legacy-slider-color",
21833
+ new: ["slider-color"]
21834
+ },
21835
+ {
21836
+ old: "legacy-slider-typography",
21837
+ new: ["slider-typography"]
21886
21838
  }
21887
21839
  ];
21888
21840
  this.classChanges = [{ old: ".mat-slider", new: ".mat-mdc-slider" }];
@@ -21898,7 +21850,17 @@ var SnackBarMigrator = class extends StyleMigrator {
21898
21850
  this.mixinChanges = [
21899
21851
  {
21900
21852
  old: "legacy-snack-bar-theme",
21901
- new: ["snack-bar-theme", "snack-bar-typography", "button-theme", "button-typography"],
21853
+ new: ["snack-bar-theme", "button-theme"],
21854
+ checkForDuplicates: true
21855
+ },
21856
+ {
21857
+ old: "legacy-snack-bar-color",
21858
+ new: ["snack-bar-color", "button-color"],
21859
+ checkForDuplicates: true
21860
+ },
21861
+ {
21862
+ old: "legacy-snack-bar-typography",
21863
+ new: ["snack-bar-typography", "button-typography"],
21902
21864
  checkForDuplicates: true
21903
21865
  }
21904
21866
  ];
@@ -21919,7 +21881,15 @@ var TableStylesMigrator = class extends StyleMigrator {
21919
21881
  this.mixinChanges = [
21920
21882
  {
21921
21883
  old: "legacy-table-theme",
21922
- new: ["table-theme", "table-typography"]
21884
+ new: ["table-theme"]
21885
+ },
21886
+ {
21887
+ old: "legacy-table-color",
21888
+ new: ["table-color"]
21889
+ },
21890
+ {
21891
+ old: "legacy-table-typography",
21892
+ new: ["table-typography"]
21923
21893
  }
21924
21894
  ];
21925
21895
  this.classChanges = [
@@ -21952,7 +21922,15 @@ var TabsStylesMigrator = class extends StyleMigrator {
21952
21922
  this.mixinChanges = [
21953
21923
  {
21954
21924
  old: "legacy-tabs-theme",
21955
- new: ["tabs-theme", "tabs-typography"]
21925
+ new: ["tabs-theme"]
21926
+ },
21927
+ {
21928
+ old: "legacy-tabs-color",
21929
+ new: ["tabs-color"]
21930
+ },
21931
+ {
21932
+ old: "legacy-tabs-typography",
21933
+ new: ["tabs-typography"]
21956
21934
  }
21957
21935
  ];
21958
21936
  this.classChanges = [
@@ -21975,7 +21953,15 @@ var TooltipStylesMigrator = class extends StyleMigrator {
21975
21953
  this.mixinChanges = [
21976
21954
  {
21977
21955
  old: "legacy-tooltip-theme",
21978
- new: ["tooltip-theme", "tooltip-typography"]
21956
+ new: ["tooltip-theme"]
21957
+ },
21958
+ {
21959
+ old: "legacy-tooltip-color",
21960
+ new: ["tooltip-color"]
21961
+ },
21962
+ {
21963
+ old: "legacy-tooltip-typography",
21964
+ new: ["tooltip-typography"]
21979
21965
  }
21980
21966
  ];
21981
21967
  this.classChanges = [
@@ -21992,94 +21978,235 @@ var TooltipStylesMigrator = class extends StyleMigrator {
21992
21978
  }
21993
21979
  };
21994
21980
 
21981
+ // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/optgroup/optgroup-styles.js
21982
+ var OptgroupStylesMigrator = class extends StyleMigrator {
21983
+ constructor() {
21984
+ super(...arguments);
21985
+ this.component = "optgroup";
21986
+ this.deprecatedPrefixes = ["mat-optgroup"];
21987
+ this.mixinChanges = [
21988
+ {
21989
+ old: "legacy-optgroup-theme",
21990
+ new: ["optgroup-theme"]
21991
+ },
21992
+ {
21993
+ old: "legacy-optgroup-color",
21994
+ new: ["optgroup-color"]
21995
+ },
21996
+ {
21997
+ old: "legacy-optgroup-typography",
21998
+ new: ["optgroup-typography"]
21999
+ }
22000
+ ];
22001
+ this.classChanges = [
22002
+ {
22003
+ old: ".mat-optgroup",
22004
+ new: ".mat-mdc-optgroup"
22005
+ },
22006
+ {
22007
+ old: ".mat-optgroup-label",
22008
+ new: ".mat-mdc-optgroup-label"
22009
+ }
22010
+ ];
22011
+ }
22012
+ };
22013
+
22014
+ // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/option/option-styles.js
22015
+ var OptionStylesMigrator = class extends StyleMigrator {
22016
+ constructor() {
22017
+ super(...arguments);
22018
+ this.component = "option";
22019
+ this.deprecatedPrefixes = ["mat-option"];
22020
+ this.mixinChanges = [
22021
+ {
22022
+ old: "legacy-option-theme",
22023
+ new: ["option-theme"]
22024
+ },
22025
+ {
22026
+ old: "legacy-option-color",
22027
+ new: ["option-color"]
22028
+ },
22029
+ {
22030
+ old: "legacy-option-typography",
22031
+ new: ["option-typography"]
22032
+ },
22033
+ {
22034
+ old: "legacy-core-theme",
22035
+ new: ["core-theme"]
22036
+ },
22037
+ {
22038
+ old: "legacy-core-color",
22039
+ new: ["core-color"]
22040
+ },
22041
+ {
22042
+ old: "legacy-core-typography",
22043
+ new: ["core-typography"]
22044
+ }
22045
+ ];
22046
+ this.classChanges = [
22047
+ {
22048
+ old: ".mat-option",
22049
+ new: ".mat-mdc-option"
22050
+ },
22051
+ {
22052
+ old: ".mat-option-multiple",
22053
+ new: ".mat-mdc-option-multiple"
22054
+ },
22055
+ {
22056
+ old: ".mat-option-pseudo-checkbox",
22057
+ new: ".mat-mdc-option-pseudo-checkbox"
22058
+ },
22059
+ {
22060
+ old: ".mat-option-ripple",
22061
+ new: ".mat-mdc-option-ripple"
22062
+ }
22063
+ ];
22064
+ }
22065
+ };
22066
+
22067
+ // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/form-field/form-field-template.js
22068
+ var FormFieldTemplateMigrator = class extends TemplateMigrator {
22069
+ getUpdates(ast) {
22070
+ const updates = [];
22071
+ visitElements(ast.nodes, (node) => {
22072
+ if (node.name !== "mat-form-field") {
22073
+ return;
22074
+ }
22075
+ updates.push({
22076
+ offset: node.startSourceSpan.start.offset,
22077
+ updateFn: (html) => updateAttribute(html, node, "appearance", (old) => ["legacy", "standard"].includes(old || "") ? null : old)
22078
+ });
22079
+ });
22080
+ return updates;
22081
+ }
22082
+ };
22083
+
21995
22084
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/index.js
22085
+ var LEGACY_MODULES = new Set([
22086
+ "legacy-autocomplete",
22087
+ "legacy-autocomplete/testing",
22088
+ "legacy-button",
22089
+ "legacy-button/testing",
22090
+ "legacy-card",
22091
+ "legacy-card/testing",
22092
+ "legacy-checkbox",
22093
+ "legacy-checkbox/testing",
22094
+ "legacy-chips",
22095
+ "legacy-chips/testing",
22096
+ "legacy-core",
22097
+ "legacy-core/testing",
22098
+ "legacy-dialog",
22099
+ "legacy-dialog/testing",
22100
+ "legacy-form-field",
22101
+ "legacy-form-field/testing",
22102
+ "legacy-input",
22103
+ "legacy-input/testing",
22104
+ "legacy-list",
22105
+ "legacy-list/testing",
22106
+ "legacy-menu",
22107
+ "legacy-menu/testing",
22108
+ "legacy-paginator",
22109
+ "legacy-paginator/testing",
22110
+ "legacy-progress-bar",
22111
+ "legacy-progress-bar/testing",
22112
+ "legacy-progress-spinner",
22113
+ "legacy-progress-spinner/testing",
22114
+ "legacy-radio",
22115
+ "legacy-radio/testing",
22116
+ "legacy-select",
22117
+ "legacy-select/testing",
22118
+ "legacy-slide-toggle",
22119
+ "legacy-slide-toggle/testing",
22120
+ "legacy-slider",
22121
+ "legacy-slider/testing",
22122
+ "legacy-snack-bar",
22123
+ "legacy-snack-bar/testing",
22124
+ "legacy-table",
22125
+ "legacy-table/testing",
22126
+ "legacy-tabs",
22127
+ "legacy-tabs/testing",
22128
+ "legacy-tooltip",
22129
+ "legacy-tooltip/testing"
22130
+ ].map((name) => `@angular/material/${name}`));
21996
22131
  var MIGRATORS = [
21997
22132
  {
21998
22133
  component: "autocomplete",
21999
- styles: new AutocompleteStylesMigrator(),
22000
- runtime: new RuntimeMigrator("autocomplete")
22134
+ styles: new AutocompleteStylesMigrator()
22001
22135
  },
22002
22136
  {
22003
22137
  component: "button",
22004
- styles: new ButtonStylesMigrator(),
22005
- runtime: new RuntimeMigrator("button")
22138
+ styles: new ButtonStylesMigrator()
22006
22139
  },
22007
22140
  {
22008
22141
  component: "card",
22009
22142
  styles: new CardStylesMigrator(),
22010
- runtime: new RuntimeMigrator("card"),
22011
22143
  template: new CardTemplateMigrator()
22012
22144
  },
22013
22145
  {
22014
22146
  component: "checkbox",
22015
- styles: new CheckboxStylesMigrator(),
22016
- runtime: new RuntimeMigrator("checkbox")
22147
+ styles: new CheckboxStylesMigrator()
22017
22148
  },
22018
22149
  {
22019
22150
  component: "chips",
22020
22151
  styles: new ChipsStylesMigrator(),
22021
- runtime: new RuntimeMigrator("chips"),
22022
22152
  template: new ChipsTemplateMigrator()
22023
22153
  },
22024
22154
  {
22025
22155
  component: "dialog",
22026
- styles: new DialogStylesMigrator(),
22027
- runtime: new RuntimeMigrator("dialog")
22156
+ styles: new DialogStylesMigrator()
22028
22157
  },
22029
22158
  {
22030
22159
  component: "form-field",
22031
22160
  styles: new FormFieldStylesMigrator(),
22032
- runtime: new RuntimeMigrator("form-field")
22161
+ template: new FormFieldTemplateMigrator()
22033
22162
  },
22034
22163
  {
22035
22164
  component: "input",
22036
- styles: new InputStylesMigrator(),
22037
- runtime: new RuntimeMigrator("input")
22165
+ styles: new InputStylesMigrator()
22038
22166
  },
22039
22167
  {
22040
22168
  component: "list",
22041
- styles: new ListStylesMigrator(),
22042
- runtime: new RuntimeMigrator("list")
22169
+ styles: new ListStylesMigrator()
22043
22170
  },
22044
22171
  {
22045
22172
  component: "menu",
22046
- styles: new MenuStylesMigrator(),
22047
- runtime: new RuntimeMigrator("menu")
22173
+ styles: new MenuStylesMigrator()
22174
+ },
22175
+ {
22176
+ component: "optgroup",
22177
+ styles: new OptgroupStylesMigrator()
22178
+ },
22179
+ {
22180
+ component: "option",
22181
+ styles: new OptionStylesMigrator()
22048
22182
  },
22049
22183
  {
22050
22184
  component: "paginator",
22051
- styles: new PaginatorStylesMigrator(),
22052
- runtime: new RuntimeMigrator("paginator")
22185
+ styles: new PaginatorStylesMigrator()
22053
22186
  },
22054
22187
  {
22055
22188
  component: "progress-bar",
22056
- styles: new ProgressBarStylesMigrator(),
22057
- runtime: new RuntimeMigrator("progress-bar")
22189
+ styles: new ProgressBarStylesMigrator()
22058
22190
  },
22059
22191
  {
22060
22192
  component: "progress-spinner",
22061
- styles: new ProgressSpinnerStylesMigrator(),
22062
- runtime: new RuntimeMigrator("progress-spinner")
22193
+ styles: new ProgressSpinnerStylesMigrator()
22063
22194
  },
22064
22195
  {
22065
22196
  component: "radio",
22066
- styles: new RadioStylesMigrator(),
22067
- runtime: new RuntimeMigrator("radio")
22197
+ styles: new RadioStylesMigrator()
22068
22198
  },
22069
22199
  {
22070
22200
  component: "select",
22071
- styles: new SelectStylesMigrator(),
22072
- runtime: new RuntimeMigrator("select")
22201
+ styles: new SelectStylesMigrator()
22073
22202
  },
22074
22203
  {
22075
22204
  component: "slide-toggle",
22076
- styles: new SlideToggleStylesMigrator(),
22077
- runtime: new RuntimeMigrator("slide-toggle")
22205
+ styles: new SlideToggleStylesMigrator()
22078
22206
  },
22079
22207
  {
22080
22208
  component: "slider",
22081
- styles: new SliderStylesMigrator(),
22082
- runtime: new RuntimeMigrator("slider")
22209
+ styles: new SliderStylesMigrator()
22083
22210
  },
22084
22211
  {
22085
22212
  component: "snack-bar",
@@ -22087,18 +22214,15 @@ var MIGRATORS = [
22087
22214
  },
22088
22215
  {
22089
22216
  component: "table",
22090
- styles: new TableStylesMigrator(),
22091
- runtime: new RuntimeMigrator("table")
22217
+ styles: new TableStylesMigrator()
22092
22218
  },
22093
22219
  {
22094
22220
  component: "tabs",
22095
- styles: new TabsStylesMigrator(),
22096
- runtime: new RuntimeMigrator("tabs")
22221
+ styles: new TabsStylesMigrator()
22097
22222
  },
22098
22223
  {
22099
22224
  component: "tooltip",
22100
- styles: new TooltipStylesMigrator(),
22101
- runtime: new RuntimeMigrator("tooltip")
22225
+ styles: new TooltipStylesMigrator()
22102
22226
  }
22103
22227
  ];
22104
22228
 
@@ -22107,11 +22231,38 @@ var import_schematics4 = require("@angular/cdk/schematics");
22107
22231
 
22108
22232
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/ts-migration/runtime-migration.js
22109
22233
  var import_schematics3 = require("@angular/cdk/schematics");
22110
- var ts2 = __toESM(require("typescript"));
22234
+ var ts = __toESM(require("typescript"));
22111
22235
 
22112
22236
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/theming-styles.js
22113
22237
  var import_schematics = require("@angular/cdk/schematics");
22114
22238
 
22239
+ // node_modules/postcss/lib/postcss.mjs
22240
+ var import_postcss = __toESM(require_postcss(), 1);
22241
+ var stringify2 = import_postcss.default.stringify;
22242
+ var fromJSON = import_postcss.default.fromJSON;
22243
+ var plugin = import_postcss.default.plugin;
22244
+ var parse2 = import_postcss.default.parse;
22245
+ var list = import_postcss.default.list;
22246
+ var document = import_postcss.default.document;
22247
+ var comment = import_postcss.default.comment;
22248
+ var atRule = import_postcss.default.atRule;
22249
+ var rule = import_postcss.default.rule;
22250
+ var decl = import_postcss.default.decl;
22251
+ var root = import_postcss.default.root;
22252
+ var CssSyntaxError = import_postcss.default.CssSyntaxError;
22253
+ var Declaration = import_postcss.default.Declaration;
22254
+ var Container2 = import_postcss.default.Container;
22255
+ var Processor = import_postcss.default.Processor;
22256
+ var Document = import_postcss.default.Document;
22257
+ var Comment2 = import_postcss.default.Comment;
22258
+ var Warning = import_postcss.default.Warning;
22259
+ var AtRule = import_postcss.default.AtRule;
22260
+ var Result = import_postcss.default.Result;
22261
+ var Input = import_postcss.default.Input;
22262
+ var Rule = import_postcss.default.Rule;
22263
+ var Root = import_postcss.default.Root;
22264
+ var Node = import_postcss.default.Node;
22265
+
22115
22266
  // node_modules/postcss-scss/lib/scss-syntax.mjs
22116
22267
  var scss_syntax_exports = {};
22117
22268
  __export(scss_syntax_exports, {
@@ -22125,15 +22276,17 @@ var stringify3 = import_scss_syntax.default.stringify;
22125
22276
  var parse3 = import_scss_syntax.default.parse;
22126
22277
 
22127
22278
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/theming-styles.js
22279
+ var COMPONENTS_MIXIN_NAME = /\.([^(;]*)/;
22128
22280
  var ThemingStylesMigration = class extends import_schematics.Migration {
22129
22281
  constructor() {
22130
22282
  super(...arguments);
22131
22283
  this.enabled = true;
22132
22284
  }
22133
22285
  visitStylesheet(stylesheet) {
22134
- this.fileSystem.overwrite(stylesheet.filePath, this.migrate(stylesheet.content));
22286
+ const migratedContent = this.migrate(stylesheet.content, stylesheet.filePath).replace(new RegExp(`${this.namespace}.define-legacy-typography-config\\(`, "g"), `${this.namespace}.define-typography-config(`);
22287
+ this.fileSystem.edit(stylesheet.filePath).remove(stylesheet.start, stylesheet.content.length).insertRight(stylesheet.start, migratedContent);
22135
22288
  }
22136
- migrate(styles) {
22289
+ migrate(styles, filename) {
22137
22290
  const processor = new Processor([
22138
22291
  {
22139
22292
  postcssPlugin: "theming-styles-migration-plugin",
@@ -22144,7 +22297,13 @@ var ThemingStylesMigration = class extends import_schematics.Migration {
22144
22297
  Rule: this.ruleHandler.bind(this)
22145
22298
  }
22146
22299
  ]);
22147
- return processor.process(styles, { syntax: scss_syntax_exports }).toString();
22300
+ try {
22301
+ return processor.process(styles, { syntax: scss_syntax_exports }).toString();
22302
+ } catch (e) {
22303
+ this.context.logger.error(`${e}`);
22304
+ this.context.logger.warn(`Failed to process stylesheet: ${filename} (see error above).`);
22305
+ return styles;
22306
+ }
22148
22307
  }
22149
22308
  atUseHandler(atRule2) {
22150
22309
  if (isAngularMaterialImport(atRule2)) {
@@ -22152,16 +22311,38 @@ var ThemingStylesMigration = class extends import_schematics.Migration {
22152
22311
  }
22153
22312
  }
22154
22313
  atIncludeHandler(atRule2) {
22155
- var _a;
22156
22314
  const migrator = this.upgradeData.find((m) => {
22157
22315
  return m.styles.isLegacyMixin(this.namespace, atRule2);
22158
22316
  });
22159
22317
  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);
22318
+ const mixinChange = migrator.styles.getMixinChange(this.namespace, atRule2);
22319
+ if (mixinChange) {
22320
+ if (mixinChange.new) {
22321
+ replaceAtRuleWithMultiple(atRule2, mixinChange.old, mixinChange.new);
22322
+ } else {
22323
+ atRule2.remove();
22324
+ }
22325
+ }
22326
+ } else if (atRule2.parent && this.isCrossCuttingMixin(atRule2.params)) {
22327
+ if (this.isPartialMigration()) {
22328
+ const mixinName = atRule2.params.match(COMPONENTS_MIXIN_NAME)[1];
22329
+ const comment2 = `TODO(mdc-migration): Remove ${mixinName} once all legacy components are migrated`;
22330
+ if (!addLegacyCommentForPartialMigrations(atRule2, comment2)) {
22331
+ return;
22332
+ }
22333
+ }
22334
+ replaceCrossCuttingMixin(atRule2, this.namespace);
22163
22335
  }
22164
22336
  }
22337
+ isCrossCuttingMixin(mixinText) {
22338
+ return [
22339
+ `${this.namespace}\\.all-legacy-component-`,
22340
+ `${this.namespace}\\.legacy-core([^-]|$)`
22341
+ ].some((r) => new RegExp(r).test(mixinText));
22342
+ }
22343
+ isPartialMigration() {
22344
+ return this.upgradeData.length !== MIGRATORS.length;
22345
+ }
22165
22346
  ruleHandler(rule2) {
22166
22347
  let isLegacySelector;
22167
22348
  let isDeprecatedSelector;
@@ -22173,7 +22354,7 @@ var ThemingStylesMigration = class extends import_schematics.Migration {
22173
22354
  if (isLegacySelector) {
22174
22355
  migrator == null ? void 0 : migrator.styles.replaceLegacySelector(rule2);
22175
22356
  } else if (isDeprecatedSelector) {
22176
- migrator == null ? void 0 : migrator.styles.addDeprecatedSelectorComment(rule2);
22357
+ 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
22358
  }
22178
22359
  }
22179
22360
  };
@@ -22185,6 +22366,50 @@ function parseNamespace(atRule2) {
22185
22366
  const params = list.space(atRule2.params);
22186
22367
  return params[params.length - 1];
22187
22368
  }
22369
+ function addLegacyCommentForPartialMigrations(atRule2, legacyComment) {
22370
+ var _a;
22371
+ let hasAddedComment = false;
22372
+ (_a = atRule2.parent) == null ? void 0 : _a.walkComments((comment2) => {
22373
+ if (comment2.text.includes(legacyComment)) {
22374
+ hasAddedComment = true;
22375
+ }
22376
+ });
22377
+ if (hasAddedComment) {
22378
+ return false;
22379
+ }
22380
+ addCommentBeforeNode(atRule2.cloneBefore(), legacyComment);
22381
+ return true;
22382
+ }
22383
+ function addCommentBeforeNode(node, comment2) {
22384
+ var _a;
22385
+ let commentNode = comment({
22386
+ text: comment2
22387
+ });
22388
+ const indentation = (_a = node.raws.before) == null ? void 0 : _a.split("\n").pop();
22389
+ commentNode.raws.before = "\n" + indentation;
22390
+ node.parent.insertBefore(node, commentNode);
22391
+ node.raws.before = "\n" + indentation;
22392
+ }
22393
+ function replaceCrossCuttingMixin(atRule2, namespace) {
22394
+ atRule2.cloneBefore({
22395
+ params: atRule2.params.replace(`${namespace}.all-legacy-component`, `${namespace}.all-component`).replace(`${namespace}.legacy-core`, `${namespace}.core`)
22396
+ });
22397
+ atRule2.remove();
22398
+ }
22399
+ function replaceAtRuleWithMultiple(atRule2, textToReplace, replacements) {
22400
+ var _a;
22401
+ atRule2.cloneBefore({
22402
+ params: atRule2.params.replace(textToReplace, replacements[0])
22403
+ });
22404
+ const indentation = (_a = atRule2.raws.before) == null ? void 0 : _a.split("\n").pop();
22405
+ atRule2.raws.before = "\n" + indentation;
22406
+ for (let i = 1; i < replacements.length; i++) {
22407
+ atRule2.cloneBefore({
22408
+ params: atRule2.params.replace(textToReplace, replacements[i])
22409
+ });
22410
+ }
22411
+ atRule2.remove();
22412
+ }
22188
22413
 
22189
22414
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/template-migration.js
22190
22415
  var import_schematics2 = require("@angular/cdk/schematics");
@@ -22203,7 +22428,7 @@ var TemplateMigration = class extends import_schematics2.Migration {
22203
22428
  this.enabled = true;
22204
22429
  }
22205
22430
  visitTemplate(template) {
22206
- this.fileSystem.overwrite(template.filePath, this.migrate(template.content, template.filePath));
22431
+ this.fileSystem.edit(template.filePath).remove(template.start, template.content.length).insertRight(template.start, this.migrate(template.content, template.filePath));
22207
22432
  }
22208
22433
  migrate(template, templateUrl) {
22209
22434
  const ast = parseTemplate2(template, templateUrl);
@@ -22219,37 +22444,103 @@ var RuntimeCodeMigration = class extends import_schematics3.Migration {
22219
22444
  constructor() {
22220
22445
  super(...arguments);
22221
22446
  this.enabled = true;
22222
- this._printer = ts2.createPrinter({ newLine: ts2.NewLineKind.LineFeed });
22447
+ this._printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
22223
22448
  this._hasPossibleTemplateMigrations = true;
22224
22449
  }
22225
22450
  visitNode(node) {
22226
- if (this._isImportExpression(node)) {
22451
+ if (ts.isSourceFile(node)) {
22452
+ this._migrateSourceFileReferences(node);
22453
+ } else if (this._isComponentDecorator(node)) {
22454
+ this._migrateComponentDecorator(node);
22455
+ } else if (this._isImportExpression(node)) {
22227
22456
  this._migrateModuleSpecifier(node.arguments[0]);
22228
22457
  } else if (this._isTypeImportExpression(node)) {
22229
22458
  this._migrateModuleSpecifier(node.argument.literal);
22230
- } else if (ts2.isImportDeclaration(node)) {
22231
- this._migrateModuleSpecifier(node.moduleSpecifier, node.importClause);
22232
- } else if (ts2.isDecorator(node) && (this._isNgModuleDecorator(node) || this._isComponentDecorator(node))) {
22233
- this._migrateDecoratorProperties(node);
22234
22459
  }
22235
22460
  }
22236
- _migrateDecoratorProperties(node) {
22237
- if (!ts2.isCallExpression(node.expression)) {
22461
+ _migrateSourceFileReferences(sourceFile) {
22462
+ const { importSpecifiersToNewNames, identifiersToImportSpecifiers, moduleSpecifiers } = this._findImportsToMigrate(sourceFile);
22463
+ [
22464
+ ...this._renameModuleSpecifiers(moduleSpecifiers),
22465
+ ...this._renameReferences(sourceFile, identifiersToImportSpecifiers, importSpecifiersToNewNames)
22466
+ ].sort(([a], [b]) => b.getStart() - a.getStart()).forEach(([currentNode, newName]) => {
22467
+ this._printAndUpdateNode(sourceFile, currentNode, newName);
22468
+ });
22469
+ }
22470
+ _findImportsToMigrate(sourceFile) {
22471
+ var _a;
22472
+ const importSpecifiersToNewNames = /* @__PURE__ */ new Map();
22473
+ const moduleSpecifiers = /* @__PURE__ */ new Map();
22474
+ const identifiersToImportSpecifiers = /* @__PURE__ */ new Map();
22475
+ for (const statement of sourceFile.statements) {
22476
+ if (ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier) && ((_a = statement.importClause) == null ? void 0 : _a.namedBindings) && ts.isNamedImports(statement.importClause.namedBindings) && LEGACY_MODULES.has(statement.moduleSpecifier.text)) {
22477
+ statement.importClause.namedBindings.elements.forEach((element) => {
22478
+ const oldName = (element.propertyName || element.name).text;
22479
+ const newName = this._removeLegacy(oldName);
22480
+ if (newName) {
22481
+ importSpecifiersToNewNames.set(element, newName);
22482
+ if (!element.propertyName) {
22483
+ identifiersToImportSpecifiers.set(oldName, element);
22484
+ }
22485
+ }
22486
+ });
22487
+ const newModuleSpecifier = this._removeLegacy(statement.moduleSpecifier.text);
22488
+ if (newModuleSpecifier) {
22489
+ moduleSpecifiers.set(statement.moduleSpecifier, newModuleSpecifier);
22490
+ }
22491
+ }
22492
+ }
22493
+ return { importSpecifiersToNewNames, identifiersToImportSpecifiers, moduleSpecifiers };
22494
+ }
22495
+ _renameReferences(sourceFile, identifiersToImportSpecifiers, importSpecifiersToNewNames) {
22496
+ if (importSpecifiersToNewNames.size === 0) {
22497
+ return [];
22498
+ }
22499
+ const replacements = [];
22500
+ const walk = (node) => {
22501
+ if (ts.isImportDeclaration(node)) {
22502
+ return;
22503
+ }
22504
+ if (ts.isIdentifier(node)) {
22505
+ const specifier = identifiersToImportSpecifiers.get(node.text);
22506
+ if (specifier && this._isReferenceToImport(node, specifier)) {
22507
+ replacements.push([node, importSpecifiersToNewNames.get(specifier)]);
22508
+ }
22509
+ }
22510
+ node.forEachChild(walk);
22511
+ };
22512
+ sourceFile.forEachChild(walk);
22513
+ importSpecifiersToNewNames.forEach((newName, specifier) => {
22514
+ if (specifier.propertyName) {
22515
+ replacements.push([
22516
+ specifier.name.text === newName ? specifier : specifier.propertyName,
22517
+ newName
22518
+ ]);
22519
+ } else {
22520
+ replacements.push([specifier.name, newName]);
22521
+ }
22522
+ });
22523
+ return replacements;
22524
+ }
22525
+ _renameModuleSpecifiers(moduleSpecifiers) {
22526
+ const replacements = [];
22527
+ for (const [specifier, newName] of moduleSpecifiers.entries()) {
22528
+ const quoteStyle = specifier.getText()[0];
22529
+ replacements.push([specifier, quoteStyle + newName + quoteStyle]);
22530
+ }
22531
+ return replacements;
22532
+ }
22533
+ _migrateComponentDecorator(node) {
22534
+ if (!ts.isCallExpression(node.expression)) {
22238
22535
  return;
22239
22536
  }
22240
22537
  const metadata = node.expression.arguments[0];
22241
- if (!ts2.isObjectLiteralExpression(metadata)) {
22538
+ if (!ts.isObjectLiteralExpression(metadata)) {
22242
22539
  return;
22243
22540
  }
22244
22541
  for (const prop of metadata.properties) {
22245
22542
  if (prop.name) {
22246
22543
  switch ((0, import_schematics3.getPropertyNameText)(prop.name)) {
22247
- case "imports":
22248
- this._migrateImportsAndExports(prop);
22249
- break;
22250
- case "exports":
22251
- this._migrateImportsAndExports(prop);
22252
- break;
22253
22544
  case "styles":
22254
22545
  this._migrateStyles(prop);
22255
22546
  break;
@@ -22262,18 +22553,6 @@ var RuntimeCodeMigration = class extends import_schematics3.Migration {
22262
22553
  }
22263
22554
  }
22264
22555
  }
22265
- _migrateImportsAndExports(node) {
22266
- node.initializer.forEachChild((specifier) => {
22267
- var _a;
22268
- for (const migrator of this.upgradeData) {
22269
- const newSpecifier = (_a = migrator.runtime) == null ? void 0 : _a.updateImportOrExportSpecifier(specifier);
22270
- if (newSpecifier) {
22271
- this._printAndUpdateNode(specifier.getSourceFile(), specifier, newSpecifier);
22272
- break;
22273
- }
22274
- }
22275
- });
22276
- }
22277
22556
  _migrateStyles(node) {
22278
22557
  if (!this._stylesMigration) {
22279
22558
  this._stylesMigration = new ThemingStylesMigration(this.program, this.typeChecker, this.targetVersion, this.context, this.upgradeData, this.fileSystem, this.logger);
@@ -22295,7 +22574,7 @@ var RuntimeCodeMigration = class extends import_schematics3.Migration {
22295
22574
  this._migratePropertyAssignment(node.initializer, this._templateMigration);
22296
22575
  }
22297
22576
  _migratePropertyAssignment(node, migration) {
22298
- let migratedText = migration.migrate(node.text);
22577
+ let migratedText = migration.migrate(node.text, node.getSourceFile().fileName);
22299
22578
  let migratedTextLines = migratedText.split("\n");
22300
22579
  if (migratedTextLines.length > 1) {
22301
22580
  migratedText = migratedTextLines.map((line, index2) => {
@@ -22312,62 +22591,59 @@ var RuntimeCodeMigration = class extends import_schematics3.Migration {
22312
22591
  const quotation = node.getText().trimStart()[0];
22313
22592
  migratedText = quotation + migratedText + quotation;
22314
22593
  }
22315
- this._printAndUpdateNode(node.getSourceFile(), node, ts2.factory.createRegularExpressionLiteral(migratedText));
22594
+ this._printAndUpdateNode(node.getSourceFile(), node, ts.factory.createRegularExpressionLiteral(migratedText));
22316
22595
  }
22317
- _migrateModuleSpecifier(specifierLiteral, importClause) {
22318
- var _a, _b;
22319
- const sourceFile = specifierLiteral.getSourceFile();
22320
- for (const migrator of this.upgradeData) {
22321
- if (importClause && importClause.namedBindings) {
22322
- const importSpecifiers = importClause.namedBindings.elements;
22323
- importSpecifiers.forEach((importSpecifer) => {
22324
- var _a2;
22325
- const newImportSpecifier = (_a2 = migrator.runtime) == null ? void 0 : _a2.updateImportSpecifierWithPossibleAlias(importSpecifer);
22326
- if (newImportSpecifier) {
22327
- this._printAndUpdateNode(sourceFile, importSpecifer, newImportSpecifier);
22328
- }
22329
- });
22330
- }
22331
- const newModuleSpecifier = (_b = (_a = migrator.runtime) == null ? void 0 : _a.updateModuleSpecifier(specifierLiteral)) != null ? _b : null;
22332
- if (newModuleSpecifier !== null) {
22333
- this._printAndUpdateNode(sourceFile, specifierLiteral, newModuleSpecifier);
22334
- break;
22335
- }
22596
+ _migrateModuleSpecifier(specifier) {
22597
+ const newName = this._removeLegacy(specifier.text);
22598
+ if (newName) {
22599
+ const quoteStyle = specifier.getText()[0];
22600
+ this._printAndUpdateNode(specifier.getSourceFile(), specifier, quoteStyle + newName + quoteStyle);
22336
22601
  }
22337
22602
  }
22338
- _isNgModuleDecorator(node) {
22339
- const call = node.expression;
22340
- if (!ts2.isCallExpression(call) || !ts2.isIdentifier(call.expression)) {
22603
+ _isComponentDecorator(node) {
22604
+ if (!ts.isDecorator(node)) {
22341
22605
  return false;
22342
22606
  }
22343
- return call.expression.text === "NgModule";
22344
- }
22345
- _isComponentDecorator(node) {
22346
22607
  const call = node.expression;
22347
- if (!ts2.isCallExpression(call) || !ts2.isIdentifier(call.expression)) {
22608
+ if (!ts.isCallExpression(call) || !ts.isIdentifier(call.expression)) {
22348
22609
  return false;
22349
22610
  }
22350
22611
  return call.expression.text === "Component";
22351
22612
  }
22352
22613
  _isImportExpression(node) {
22353
- return ts2.isCallExpression(node) && node.expression.kind === ts2.SyntaxKind.ImportKeyword && node.arguments.length === 1 && ts2.isStringLiteralLike(node.arguments[0]);
22614
+ return ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword && node.arguments.length === 1 && ts.isStringLiteralLike(node.arguments[0]);
22354
22615
  }
22355
22616
  _isTypeImportExpression(node) {
22356
- return ts2.isImportTypeNode(node) && ts2.isLiteralTypeNode(node.argument) && ts2.isStringLiteralLike(node.argument.literal);
22617
+ return ts.isImportTypeNode(node) && ts.isLiteralTypeNode(node.argument) && ts.isStringLiteralLike(node.argument.literal);
22357
22618
  }
22358
22619
  _printAndUpdateNode(sourceFile, oldNode, newNode) {
22359
22620
  const filePath = this.fileSystem.resolve(sourceFile.fileName);
22360
- const newNodeText = this._printer.printNode(ts2.EmitHint.Unspecified, newNode, sourceFile);
22621
+ const newNodeText = typeof newNode === "string" ? newNode : this._printer.printNode(ts.EmitHint.Unspecified, newNode, sourceFile);
22361
22622
  const start = oldNode.getStart();
22362
22623
  const width = oldNode.getWidth();
22363
22624
  this.fileSystem.edit(filePath).remove(start, width).insertRight(start, newNodeText);
22364
22625
  }
22626
+ _isReferenceToImport(node, importSpecifier) {
22627
+ var _a, _b, _c, _d;
22628
+ if ((importSpecifier.propertyName || importSpecifier.name).text !== node.text) {
22629
+ return false;
22630
+ }
22631
+ const nodeSymbol = this.typeChecker.getTypeAtLocation(node).getSymbol();
22632
+ const importSymbol = this.typeChecker.getTypeAtLocation(importSpecifier).getSymbol();
22633
+ if (!nodeSymbol && !importSymbol) {
22634
+ return ((_b = (_a = this.typeChecker.getSymbolAtLocation(node)) == null ? void 0 : _a.declarations) == null ? void 0 : _b[0]) === importSpecifier;
22635
+ }
22636
+ return !!(((_c = nodeSymbol == null ? void 0 : nodeSymbol.declarations) == null ? void 0 : _c[0]) && ((_d = importSymbol == null ? void 0 : importSymbol.declarations) == null ? void 0 : _d[0])) && nodeSymbol.declarations[0] === importSymbol.declarations[0];
22637
+ }
22638
+ _removeLegacy(name) {
22639
+ const legacyRegex = /legacy[_-]?/i;
22640
+ return legacyRegex.test(name) ? name.replace(legacyRegex, "") : null;
22641
+ }
22365
22642
  };
22366
22643
 
22367
22644
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/index.mjs
22368
- var import_path = require("path");
22369
22645
  var migrationGroups = [
22370
- ["autocomplete", "form-field", "input", "select"],
22646
+ ["autocomplete", "form-field", "input", "option", "optgroup", "select"],
22371
22647
  ["button"],
22372
22648
  ["card"],
22373
22649
  ["checkbox"],
@@ -22400,33 +22676,53 @@ function getComponentsToMigrate(requested) {
22400
22676
  }
22401
22677
  return componentsToMigrate;
22402
22678
  }
22679
+ function runMigrations(context, fileSystem, tsconfigPath, migrators, analyzedFiles, additionalStylesheetPaths) {
22680
+ const program = import_schematics4.UpdateProject.createProgramFromTsconfig(tsconfigPath, fileSystem);
22681
+ const project = new import_schematics4.UpdateProject(context, program, fileSystem, analyzedFiles, context.logger);
22682
+ return !project.migrate([ThemingStylesMigration, TemplateMigration, RuntimeCodeMigration], null, migrators, additionalStylesheetPaths).hasFailures;
22683
+ }
22403
22684
  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) => {
22685
+ return (tree, context) => __async(this, null, function* () {
22686
+ const logger = context.logger;
22687
+ const workspace = yield (0, import_schematics4.getWorkspaceConfigGracefully)(tree);
22688
+ if (workspace === null) {
22689
+ logger.error("Could not find workspace configuration file.");
22690
+ return;
22691
+ }
22692
+ const projectNames = workspace.projects.keys();
22417
22693
  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);
22694
+ const analyzedFiles = /* @__PURE__ */ new Set();
22695
+ const componentsToMigrate = getComponentsToMigrate(options.components);
22696
+ const migrators = MIGRATORS.filter((m) => componentsToMigrate.has(m.component));
22697
+ let additionalStylesheetPaths = options.directory ? (0, import_schematics4.findStylesheetFiles)(tree, options.directory) : [];
22698
+ let success = true;
22699
+ logger.info(`Migrating components:
22700
+ ${[...componentsToMigrate].join("\n")}`);
22701
+ for (const projectName of projectNames) {
22702
+ const project = workspace.projects.get(projectName);
22703
+ const tsconfigPaths = [
22704
+ (0, import_schematics4.getTargetTsconfigPath)(project, "build"),
22705
+ (0, import_schematics4.getTargetTsconfigPath)(project, "test")
22706
+ ].filter((p) => !!p);
22707
+ if (!tsconfigPaths.length) {
22708
+ logger.warn(`Skipping migration for project ${projectName}. Unable to determine 'tsconfig.json' file in workspace config.`);
22709
+ continue;
22710
+ }
22711
+ if (!options.directory) {
22712
+ additionalStylesheetPaths = (0, import_schematics4.findStylesheetFiles)(tree, project.root);
22713
+ }
22714
+ logger.info(`Migrating project: ${projectName}`);
22715
+ for (const tsconfigPath of tsconfigPaths) {
22716
+ success && (success = runMigrations(context, fileSystem, tsconfigPath, migrators, analyzedFiles, additionalStylesheetPaths));
22717
+ }
22718
+ }
22422
22719
  fileSystem.commitEdits();
22423
- if (hasFailures) {
22424
- context.logger.error("Unable to migrate project. See errors above.");
22720
+ if (!success) {
22721
+ logger.error("Unable to migrate project. See errors above.");
22425
22722
  } else {
22426
- context.logger.info("Successfully migrated the project.");
22723
+ logger.info("Successfully migrated the project.");
22427
22724
  }
22428
- return tree;
22429
- };
22725
+ });
22430
22726
  }
22431
22727
  // Annotate the CommonJS export names for ESM import in node:
22432
22728
  0 && (module.exports = {});