@angular/material 15.0.0-next.4 → 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 (64) hide show
  1. package/button/testing/index.d.ts +8 -0
  2. package/chips/index.d.ts +13 -1
  3. package/core/mdc-helpers/_mdc-helpers.scss +8 -6
  4. package/core/typography/_all-typography.scss +73 -81
  5. package/datepicker/index.d.ts +10 -2
  6. package/esm2020/button/testing/button-harness-filters.mjs +1 -1
  7. package/esm2020/button/testing/button-harness.mjs +28 -2
  8. package/esm2020/checkbox/checkbox.mjs +2 -2
  9. package/esm2020/chips/chip-option.mjs +15 -7
  10. package/esm2020/core/version.mjs +1 -1
  11. package/esm2020/datepicker/datepicker-intl.mjs +11 -3
  12. package/esm2020/icon/icon.mjs +3 -2
  13. package/esm2020/legacy-button/testing/button-harness.mjs +27 -2
  14. package/esm2020/legacy-button/testing/public-api.mjs +1 -1
  15. package/esm2020/list/list-base.mjs +5 -2
  16. package/esm2020/list/selection-list.mjs +34 -4
  17. package/fesm2015/button/testing.mjs +29 -1
  18. package/fesm2015/button/testing.mjs.map +1 -1
  19. package/fesm2015/checkbox.mjs +2 -2
  20. package/fesm2015/checkbox.mjs.map +1 -1
  21. package/fesm2015/chips.mjs +14 -6
  22. package/fesm2015/chips.mjs.map +1 -1
  23. package/fesm2015/core.mjs +1 -1
  24. package/fesm2015/core.mjs.map +1 -1
  25. package/fesm2015/datepicker.mjs +10 -2
  26. package/fesm2015/datepicker.mjs.map +1 -1
  27. package/fesm2015/icon.mjs +2 -1
  28. package/fesm2015/icon.mjs.map +1 -1
  29. package/fesm2015/legacy-button/testing.mjs +28 -1
  30. package/fesm2015/legacy-button/testing.mjs.map +1 -1
  31. package/fesm2015/list.mjs +38 -4
  32. package/fesm2015/list.mjs.map +1 -1
  33. package/fesm2020/button/testing.mjs +27 -1
  34. package/fesm2020/button/testing.mjs.map +1 -1
  35. package/fesm2020/checkbox.mjs +2 -2
  36. package/fesm2020/checkbox.mjs.map +1 -1
  37. package/fesm2020/chips.mjs +14 -6
  38. package/fesm2020/chips.mjs.map +1 -1
  39. package/fesm2020/core.mjs +1 -1
  40. package/fesm2020/core.mjs.map +1 -1
  41. package/fesm2020/datepicker.mjs +10 -2
  42. package/fesm2020/datepicker.mjs.map +1 -1
  43. package/fesm2020/icon.mjs +2 -1
  44. package/fesm2020/icon.mjs.map +1 -1
  45. package/fesm2020/legacy-button/testing.mjs +26 -1
  46. package/fesm2020/legacy-button/testing.mjs.map +1 -1
  47. package/fesm2020/list.mjs +37 -4
  48. package/fesm2020/list.mjs.map +1 -1
  49. package/legacy-button/testing/index.d.ts +5 -0
  50. package/list/index.d.ts +25 -3
  51. package/package.json +2 -2
  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 +262 -316
  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-update/index_bundled.js +6 -1
  62. package/schematics/ng-update/index_bundled.js.map +2 -2
  63. package/schematics/ng-update/ng_update_index_metadata.json +1 -1
  64. package/slide-toggle/_slide-toggle-theme.scss +19 -19
@@ -6259,16 +6259,16 @@ var StyleMigrator = class {
6259
6259
  return this.mixinChanges.some((change) => atRule2.params.includes(`${namespace}.${change.old}`));
6260
6260
  }
6261
6261
  getMixinChange(namespace, atRule2) {
6262
- var _a;
6262
+ var _a, _b;
6263
6263
  const change = this.mixinChanges.find((c) => {
6264
6264
  return atRule2.params.includes(`${namespace}.${c.old}`);
6265
6265
  });
6266
6266
  if (!change) {
6267
6267
  return null;
6268
6268
  }
6269
- const replacements = [...change.new];
6269
+ const replacements = [...(_a = change.new) != null ? _a : []];
6270
6270
  if (change.checkForDuplicates) {
6271
- const mixinArgumentMatches = (_a = atRule2.params) == null ? void 0 : _a.match(MIXIN_ARGUMENTS_REGEX);
6271
+ const mixinArgumentMatches = (_b = atRule2.params) == null ? void 0 : _b.match(MIXIN_ARGUMENTS_REGEX);
6272
6272
  atRule2.root().walkAtRules((rule2) => {
6273
6273
  for (const index2 in replacements) {
6274
6274
  const mixinName = replacements[index2] + (mixinArgumentMatches ? mixinArgumentMatches[0] : "");
@@ -6278,10 +6278,7 @@ var StyleMigrator = class {
6278
6278
  }
6279
6279
  });
6280
6280
  }
6281
- if (replacements.length < 1) {
6282
- return null;
6283
- }
6284
- return { old: change.old, new: replacements };
6281
+ return { old: change.old, new: replacements.length ? replacements : null };
6285
6282
  }
6286
6283
  isLegacySelector(rule2) {
6287
6284
  return this.classChanges.some((change) => {
@@ -21274,25 +21271,38 @@ function replaceEndTag(html, node, tag) {
21274
21271
  }
21275
21272
  return replaceAt(html, node.endSourceSpan.start.offset + 2, node.name, tag);
21276
21273
  }
21277
- function addAttribute(html, node, name, value) {
21274
+ function updateAttribute(html, node, name, update) {
21275
+ var _a;
21278
21276
  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);
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
+ }
21284
21289
  }
21285
21290
  }
21291
+ const newValue = update(null);
21292
+ if (newValue == null) {
21293
+ return html;
21294
+ }
21286
21295
  const index2 = node.startSourceSpan.start.offset + node.name.length + 1;
21287
21296
  const prefix = html.slice(0, index2);
21288
21297
  const suffix = html.slice(index2);
21298
+ const attrText = newValue ? `${name}="${newValue}"` : `${name}`;
21289
21299
  if (node.startSourceSpan.start.line === node.startSourceSpan.end.line) {
21290
- return prefix + ` ${name}="${value}"` + suffix;
21300
+ return `${prefix} ${attrText}${suffix}`;
21291
21301
  }
21292
21302
  const attr = node.attributes[0];
21293
21303
  const ctx = attr.sourceSpan.start.getContext(attr.sourceSpan.start.col + 1, 1);
21294
21304
  const indentation = ctx.before;
21295
- return prefix + indentation + `${name}="${value}"` + suffix;
21305
+ return prefix + indentation + attrText + suffix;
21296
21306
  }
21297
21307
  function replaceAt(str, offset, oldSubstr, newSubstr) {
21298
21308
  const index2 = offset;
@@ -21311,7 +21321,7 @@ var CardTemplateMigrator = class extends TemplateMigrator {
21311
21321
  }
21312
21322
  updates.push({
21313
21323
  offset: node.startSourceSpan.start.offset,
21314
- updateFn: (html) => addAttribute(html, node, "appearance", "outlined")
21324
+ updateFn: (html) => updateAttribute(html, node, "appearance", () => "outlined")
21315
21325
  });
21316
21326
  });
21317
21327
  return updates;
@@ -21752,193 +21762,6 @@ var RadioStylesMigrator = class extends StyleMigrator {
21752
21762
  }
21753
21763
  };
21754
21764
 
21755
- // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/ts-migration/runtime-migrator.js
21756
- var ts = __toESM(require("typescript"));
21757
-
21758
- // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/ts-migration/import-replacements.js
21759
- var REPLACEMENTS = {
21760
- "button": {
21761
- old: "@angular/material/legacy-button",
21762
- new: "@angular/material/button"
21763
- },
21764
- "card": {
21765
- old: "@angular/material/legacy-card",
21766
- new: "@angular/material/card"
21767
- },
21768
- "checkbox": {
21769
- old: "@angular/material/legacy-checkbox",
21770
- new: "@angular/material/checkbox"
21771
- },
21772
- "chips": {
21773
- old: "@angular/material/legacy-chips",
21774
- new: "@angular/material/chips",
21775
- additionalMatModuleNamePrefixes: ["chip"]
21776
- },
21777
- "dialog": {
21778
- old: "@angular/material/legacy-dialog",
21779
- new: "@angular/material/dialog",
21780
- customReplacements: [{ old: "LegacyDialogRole", new: "DialogRole" }]
21781
- },
21782
- "autocomplete": {
21783
- old: "@angular/material/legacy-autocomplete",
21784
- new: "@angular/material/autocomplete"
21785
- },
21786
- "form-field": {
21787
- old: "@angular/material/legacy-form-field",
21788
- new: "@angular/material/form-field"
21789
- },
21790
- "input": {
21791
- old: "@angular/material/legacy-input",
21792
- new: "@angular/material/input"
21793
- },
21794
- "optgroup": {
21795
- old: "@angular/material/legacy-core",
21796
- new: "@angular/material/core"
21797
- },
21798
- "option": {
21799
- old: "@angular/material/legacy-core",
21800
- new: "@angular/material/core"
21801
- },
21802
- "select": {
21803
- old: "@angular/material/legacy-select",
21804
- new: "@angular/material/select"
21805
- },
21806
- "list": {
21807
- old: "@angular/material/legacy-list",
21808
- new: "@angular/material/list"
21809
- },
21810
- "menu": {
21811
- old: "@angular/material/legacy-menu",
21812
- new: "@angular/material/menu"
21813
- },
21814
- "progress-bar": {
21815
- old: "@angular/material/legacy-progress-bar",
21816
- new: "@angular/material/progress-bar"
21817
- },
21818
- "progress-spinner": {
21819
- old: "@angular/material/legacy-progress-spinner",
21820
- new: "@angular/material/progress-spinner"
21821
- },
21822
- "radio": {
21823
- old: "@angular/material/legacy-radio",
21824
- new: "@angular/material/radio"
21825
- },
21826
- "sidenav": {
21827
- old: "@angular/material/legacy-sidenav",
21828
- new: "@angular/material-experimental/legacy-sidenav"
21829
- },
21830
- "slide-toggle": {
21831
- old: "@angular/material/legacy-slide-toggle",
21832
- new: "@angular/material/slide-toggle"
21833
- },
21834
- "slider": {
21835
- old: "@angular/material/legacy-slider",
21836
- new: "@angular/material/slider"
21837
- },
21838
- "snack-bar": {
21839
- old: "@angular/material/legacy-snack-bar",
21840
- new: "@angular/material/snack-bar"
21841
- },
21842
- "table": {
21843
- old: "@angular/material/legacy-table",
21844
- new: "@angular/material/table"
21845
- },
21846
- "tabs": {
21847
- old: "@angular/material/legacy-tabs",
21848
- new: "@angular/material/tabs"
21849
- },
21850
- "paginator": {
21851
- old: "@angular/material/legacy-paginator",
21852
- new: "@angular/material/paginator"
21853
- },
21854
- "tooltip": {
21855
- old: "@angular/material/legacy-tooltip",
21856
- new: "@angular/material/tooltip"
21857
- }
21858
- };
21859
-
21860
- // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/ts-migration/runtime-migrator.js
21861
- var RuntimeMigrator = class {
21862
- constructor(component) {
21863
- var _a, _b;
21864
- const replacements = REPLACEMENTS[component];
21865
- this.oldImportModule = replacements.old;
21866
- this.newImportModule = replacements.new;
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 = [
21886
- {
21887
- old: "MatLegacy" + firstLetterCapitalizedComponent,
21888
- new: "Mat" + firstLetterCapitalizedComponent
21889
- },
21890
- {
21891
- old: "MAT_LEGACY_" + capitalizedComponent,
21892
- new: "MAT_" + capitalizedComponent
21893
- }
21894
- ];
21895
- return specifierReplacements;
21896
- }
21897
- updateImportOrExportSpecifier(specifier) {
21898
- const newSpecifier = this._getNewSpecifier(specifier);
21899
- if (!newSpecifier) {
21900
- return null;
21901
- }
21902
- return ts.factory.createIdentifier(newSpecifier);
21903
- }
21904
- updateImportSpecifierWithPossibleAlias(importSpecifier) {
21905
- var _a;
21906
- const newImport = this._getNewSpecifier((_a = importSpecifier.propertyName) != null ? _a : importSpecifier.name);
21907
- if (!newImport) {
21908
- return null;
21909
- }
21910
- let newPropertyName;
21911
- let newName;
21912
- if (importSpecifier.propertyName && importSpecifier.name.text !== newImport) {
21913
- newPropertyName = ts.factory.createIdentifier(newImport);
21914
- newName = importSpecifier.name;
21915
- } else {
21916
- newPropertyName = void 0;
21917
- newName = ts.factory.createIdentifier(newImport);
21918
- }
21919
- return ts.factory.createImportSpecifier(false, newPropertyName, newName);
21920
- }
21921
- updateModuleSpecifier(specifier) {
21922
- if (specifier.text !== this.oldImportModule) {
21923
- return null;
21924
- }
21925
- return ts.factory.createStringLiteral(this.newImportModule, this._isSingleQuoteLiteral(specifier));
21926
- }
21927
- _getNewSpecifier(node) {
21928
- let newImport = null;
21929
- this.importSpecifierReplacements.forEach((replacement) => {
21930
- var _a;
21931
- if ((_a = node.text) == null ? void 0 : _a.match(replacement.old)) {
21932
- newImport = node.text.replace(replacement.old, replacement.new);
21933
- }
21934
- });
21935
- return newImport;
21936
- }
21937
- _isSingleQuoteLiteral(literal2) {
21938
- return literal2.getText()[0] !== `"`;
21939
- }
21940
- };
21941
-
21942
21765
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/select/select-styles.js
21943
21766
  var SelectStylesMigrator = class extends StyleMigrator {
21944
21767
  constructor() {
@@ -22206,6 +22029,18 @@ var OptionStylesMigrator = class extends StyleMigrator {
22206
22029
  {
22207
22030
  old: "legacy-option-typography",
22208
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"]
22209
22044
  }
22210
22045
  ];
22211
22046
  this.classChanges = [
@@ -22229,104 +22064,149 @@ var OptionStylesMigrator = class extends StyleMigrator {
22229
22064
  }
22230
22065
  };
22231
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
+
22232
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}`));
22233
22131
  var MIGRATORS = [
22234
22132
  {
22235
22133
  component: "autocomplete",
22236
- styles: new AutocompleteStylesMigrator(),
22237
- runtime: new RuntimeMigrator("autocomplete")
22134
+ styles: new AutocompleteStylesMigrator()
22238
22135
  },
22239
22136
  {
22240
22137
  component: "button",
22241
- styles: new ButtonStylesMigrator(),
22242
- runtime: new RuntimeMigrator("button")
22138
+ styles: new ButtonStylesMigrator()
22243
22139
  },
22244
22140
  {
22245
22141
  component: "card",
22246
22142
  styles: new CardStylesMigrator(),
22247
- runtime: new RuntimeMigrator("card"),
22248
22143
  template: new CardTemplateMigrator()
22249
22144
  },
22250
22145
  {
22251
22146
  component: "checkbox",
22252
- styles: new CheckboxStylesMigrator(),
22253
- runtime: new RuntimeMigrator("checkbox")
22147
+ styles: new CheckboxStylesMigrator()
22254
22148
  },
22255
22149
  {
22256
22150
  component: "chips",
22257
22151
  styles: new ChipsStylesMigrator(),
22258
- runtime: new RuntimeMigrator("chips"),
22259
22152
  template: new ChipsTemplateMigrator()
22260
22153
  },
22261
22154
  {
22262
22155
  component: "dialog",
22263
- styles: new DialogStylesMigrator(),
22264
- runtime: new RuntimeMigrator("dialog")
22156
+ styles: new DialogStylesMigrator()
22265
22157
  },
22266
22158
  {
22267
22159
  component: "form-field",
22268
22160
  styles: new FormFieldStylesMigrator(),
22269
- runtime: new RuntimeMigrator("form-field")
22161
+ template: new FormFieldTemplateMigrator()
22270
22162
  },
22271
22163
  {
22272
22164
  component: "input",
22273
- styles: new InputStylesMigrator(),
22274
- runtime: new RuntimeMigrator("input")
22165
+ styles: new InputStylesMigrator()
22275
22166
  },
22276
22167
  {
22277
22168
  component: "list",
22278
- styles: new ListStylesMigrator(),
22279
- runtime: new RuntimeMigrator("list")
22169
+ styles: new ListStylesMigrator()
22280
22170
  },
22281
22171
  {
22282
22172
  component: "menu",
22283
- styles: new MenuStylesMigrator(),
22284
- runtime: new RuntimeMigrator("menu")
22173
+ styles: new MenuStylesMigrator()
22285
22174
  },
22286
22175
  {
22287
22176
  component: "optgroup",
22288
- styles: new OptgroupStylesMigrator(),
22289
- runtime: new RuntimeMigrator("optgroup")
22177
+ styles: new OptgroupStylesMigrator()
22290
22178
  },
22291
22179
  {
22292
22180
  component: "option",
22293
- styles: new OptionStylesMigrator(),
22294
- runtime: new RuntimeMigrator("option")
22181
+ styles: new OptionStylesMigrator()
22295
22182
  },
22296
22183
  {
22297
22184
  component: "paginator",
22298
- styles: new PaginatorStylesMigrator(),
22299
- runtime: new RuntimeMigrator("paginator")
22185
+ styles: new PaginatorStylesMigrator()
22300
22186
  },
22301
22187
  {
22302
22188
  component: "progress-bar",
22303
- styles: new ProgressBarStylesMigrator(),
22304
- runtime: new RuntimeMigrator("progress-bar")
22189
+ styles: new ProgressBarStylesMigrator()
22305
22190
  },
22306
22191
  {
22307
22192
  component: "progress-spinner",
22308
- styles: new ProgressSpinnerStylesMigrator(),
22309
- runtime: new RuntimeMigrator("progress-spinner")
22193
+ styles: new ProgressSpinnerStylesMigrator()
22310
22194
  },
22311
22195
  {
22312
22196
  component: "radio",
22313
- styles: new RadioStylesMigrator(),
22314
- runtime: new RuntimeMigrator("radio")
22197
+ styles: new RadioStylesMigrator()
22315
22198
  },
22316
22199
  {
22317
22200
  component: "select",
22318
- styles: new SelectStylesMigrator(),
22319
- runtime: new RuntimeMigrator("select")
22201
+ styles: new SelectStylesMigrator()
22320
22202
  },
22321
22203
  {
22322
22204
  component: "slide-toggle",
22323
- styles: new SlideToggleStylesMigrator(),
22324
- runtime: new RuntimeMigrator("slide-toggle")
22205
+ styles: new SlideToggleStylesMigrator()
22325
22206
  },
22326
22207
  {
22327
22208
  component: "slider",
22328
- styles: new SliderStylesMigrator(),
22329
- runtime: new RuntimeMigrator("slider")
22209
+ styles: new SliderStylesMigrator()
22330
22210
  },
22331
22211
  {
22332
22212
  component: "snack-bar",
@@ -22334,18 +22214,15 @@ var MIGRATORS = [
22334
22214
  },
22335
22215
  {
22336
22216
  component: "table",
22337
- styles: new TableStylesMigrator(),
22338
- runtime: new RuntimeMigrator("table")
22217
+ styles: new TableStylesMigrator()
22339
22218
  },
22340
22219
  {
22341
22220
  component: "tabs",
22342
- styles: new TabsStylesMigrator(),
22343
- runtime: new RuntimeMigrator("tabs")
22221
+ styles: new TabsStylesMigrator()
22344
22222
  },
22345
22223
  {
22346
22224
  component: "tooltip",
22347
- styles: new TooltipStylesMigrator(),
22348
- runtime: new RuntimeMigrator("tooltip")
22225
+ styles: new TooltipStylesMigrator()
22349
22226
  }
22350
22227
  ];
22351
22228
 
@@ -22354,7 +22231,7 @@ var import_schematics4 = require("@angular/cdk/schematics");
22354
22231
 
22355
22232
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/ts-migration/runtime-migration.js
22356
22233
  var import_schematics3 = require("@angular/cdk/schematics");
22357
- var ts2 = __toESM(require("typescript"));
22234
+ var ts = __toESM(require("typescript"));
22358
22235
 
22359
22236
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/theming-styles.js
22360
22237
  var import_schematics = require("@angular/cdk/schematics");
@@ -22399,16 +22276,17 @@ var stringify3 = import_scss_syntax.default.stringify;
22399
22276
  var parse3 = import_scss_syntax.default.parse;
22400
22277
 
22401
22278
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/theming-styles.js
22402
- var ALL_LEGACY_COMPONENTS_MIXIN_NAME = "(?:\\.)(.*)(?:\\()";
22279
+ var COMPONENTS_MIXIN_NAME = /\.([^(;]*)/;
22403
22280
  var ThemingStylesMigration = class extends import_schematics.Migration {
22404
22281
  constructor() {
22405
22282
  super(...arguments);
22406
22283
  this.enabled = true;
22407
22284
  }
22408
22285
  visitStylesheet(stylesheet) {
22409
- this.fileSystem.edit(stylesheet.filePath).remove(stylesheet.start, stylesheet.content.length).insertRight(stylesheet.start, 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);
22410
22288
  }
22411
- migrate(styles) {
22289
+ migrate(styles, filename) {
22412
22290
  const processor = new Processor([
22413
22291
  {
22414
22292
  postcssPlugin: "theming-styles-migration-plugin",
@@ -22419,7 +22297,13 @@ var ThemingStylesMigration = class extends import_schematics.Migration {
22419
22297
  Rule: this.ruleHandler.bind(this)
22420
22298
  }
22421
22299
  ]);
22422
- 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
+ }
22423
22307
  }
22424
22308
  atUseHandler(atRule2) {
22425
22309
  if (isAngularMaterialImport(atRule2)) {
@@ -22433,19 +22317,29 @@ var ThemingStylesMigration = class extends import_schematics.Migration {
22433
22317
  if (migrator) {
22434
22318
  const mixinChange = migrator.styles.getMixinChange(this.namespace, atRule2);
22435
22319
  if (mixinChange) {
22436
- replaceAtRuleWithMultiple(atRule2, mixinChange.old, mixinChange.new);
22320
+ if (mixinChange.new) {
22321
+ replaceAtRuleWithMultiple(atRule2, mixinChange.old, mixinChange.new);
22322
+ } else {
22323
+ atRule2.remove();
22324
+ }
22437
22325
  }
22438
- } else if (atRule2.params.includes("all-legacy-component") && atRule2.parent) {
22326
+ } else if (atRule2.parent && this.isCrossCuttingMixin(atRule2.params)) {
22439
22327
  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";
22328
+ const mixinName = atRule2.params.match(COMPONENTS_MIXIN_NAME)[1];
22329
+ const comment2 = `TODO(mdc-migration): Remove ${mixinName} once all legacy components are migrated`;
22442
22330
  if (!addLegacyCommentForPartialMigrations(atRule2, comment2)) {
22443
22331
  return;
22444
22332
  }
22445
22333
  }
22446
- replaceAllComponentsMixin(atRule2);
22334
+ replaceCrossCuttingMixin(atRule2, this.namespace);
22447
22335
  }
22448
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
+ }
22449
22343
  isPartialMigration() {
22450
22344
  return this.upgradeData.length !== MIGRATORS.length;
22451
22345
  }
@@ -22496,11 +22390,11 @@ function addCommentBeforeNode(node, comment2) {
22496
22390
  node.parent.insertBefore(node, commentNode);
22497
22391
  node.raws.before = "\n" + indentation;
22498
22392
  }
22499
- function replaceAllComponentsMixin(allComponentNode) {
22500
- allComponentNode.cloneBefore({
22501
- params: allComponentNode.params.replace("all-legacy-component", "all-component")
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`)
22502
22396
  });
22503
- allComponentNode.remove();
22397
+ atRule2.remove();
22504
22398
  }
22505
22399
  function replaceAtRuleWithMultiple(atRule2, textToReplace, replacements) {
22506
22400
  var _a;
@@ -22550,37 +22444,103 @@ var RuntimeCodeMigration = class extends import_schematics3.Migration {
22550
22444
  constructor() {
22551
22445
  super(...arguments);
22552
22446
  this.enabled = true;
22553
- this._printer = ts2.createPrinter({ newLine: ts2.NewLineKind.LineFeed });
22447
+ this._printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
22554
22448
  this._hasPossibleTemplateMigrations = true;
22555
22449
  }
22556
22450
  visitNode(node) {
22557
- 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)) {
22558
22456
  this._migrateModuleSpecifier(node.arguments[0]);
22559
22457
  } else if (this._isTypeImportExpression(node)) {
22560
22458
  this._migrateModuleSpecifier(node.argument.literal);
22561
- } else if (ts2.isImportDeclaration(node)) {
22562
- this._migrateModuleSpecifier(node.moduleSpecifier, node.importClause);
22563
- } else if (ts2.isDecorator(node) && (this._isNgModuleDecorator(node) || this._isComponentDecorator(node))) {
22564
- this._migrateDecoratorProperties(node);
22565
22459
  }
22566
22460
  }
22567
- _migrateDecoratorProperties(node) {
22568
- 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)) {
22569
22535
  return;
22570
22536
  }
22571
22537
  const metadata = node.expression.arguments[0];
22572
- if (!ts2.isObjectLiteralExpression(metadata)) {
22538
+ if (!ts.isObjectLiteralExpression(metadata)) {
22573
22539
  return;
22574
22540
  }
22575
22541
  for (const prop of metadata.properties) {
22576
22542
  if (prop.name) {
22577
22543
  switch ((0, import_schematics3.getPropertyNameText)(prop.name)) {
22578
- case "imports":
22579
- this._migrateImportsAndExports(prop);
22580
- break;
22581
- case "exports":
22582
- this._migrateImportsAndExports(prop);
22583
- break;
22584
22544
  case "styles":
22585
22545
  this._migrateStyles(prop);
22586
22546
  break;
@@ -22593,18 +22553,6 @@ var RuntimeCodeMigration = class extends import_schematics3.Migration {
22593
22553
  }
22594
22554
  }
22595
22555
  }
22596
- _migrateImportsAndExports(node) {
22597
- node.initializer.forEachChild((specifier) => {
22598
- var _a;
22599
- for (const migrator of this.upgradeData) {
22600
- const newSpecifier = (_a = migrator.runtime) == null ? void 0 : _a.updateImportOrExportSpecifier(specifier);
22601
- if (newSpecifier) {
22602
- this._printAndUpdateNode(specifier.getSourceFile(), specifier, newSpecifier);
22603
- break;
22604
- }
22605
- }
22606
- });
22607
- }
22608
22556
  _migrateStyles(node) {
22609
22557
  if (!this._stylesMigration) {
22610
22558
  this._stylesMigration = new ThemingStylesMigration(this.program, this.typeChecker, this.targetVersion, this.context, this.upgradeData, this.fileSystem, this.logger);
@@ -22626,7 +22574,7 @@ var RuntimeCodeMigration = class extends import_schematics3.Migration {
22626
22574
  this._migratePropertyAssignment(node.initializer, this._templateMigration);
22627
22575
  }
22628
22576
  _migratePropertyAssignment(node, migration) {
22629
- let migratedText = migration.migrate(node.text);
22577
+ let migratedText = migration.migrate(node.text, node.getSourceFile().fileName);
22630
22578
  let migratedTextLines = migratedText.split("\n");
22631
22579
  if (migratedTextLines.length > 1) {
22632
22580
  migratedText = migratedTextLines.map((line, index2) => {
@@ -22643,56 +22591,54 @@ var RuntimeCodeMigration = class extends import_schematics3.Migration {
22643
22591
  const quotation = node.getText().trimStart()[0];
22644
22592
  migratedText = quotation + migratedText + quotation;
22645
22593
  }
22646
- this._printAndUpdateNode(node.getSourceFile(), node, ts2.factory.createRegularExpressionLiteral(migratedText));
22594
+ this._printAndUpdateNode(node.getSourceFile(), node, ts.factory.createRegularExpressionLiteral(migratedText));
22647
22595
  }
22648
- _migrateModuleSpecifier(specifierLiteral, importClause) {
22649
- var _a, _b;
22650
- const sourceFile = specifierLiteral.getSourceFile();
22651
- for (const migrator of this.upgradeData) {
22652
- if (importClause && importClause.namedBindings) {
22653
- const importSpecifiers = importClause.namedBindings.elements;
22654
- importSpecifiers.forEach((importSpecifer) => {
22655
- var _a2;
22656
- const newImportSpecifier = (_a2 = migrator.runtime) == null ? void 0 : _a2.updateImportSpecifierWithPossibleAlias(importSpecifer);
22657
- if (newImportSpecifier) {
22658
- this._printAndUpdateNode(sourceFile, importSpecifer, newImportSpecifier);
22659
- }
22660
- });
22661
- }
22662
- const newModuleSpecifier = (_b = (_a = migrator.runtime) == null ? void 0 : _a.updateModuleSpecifier(specifierLiteral)) != null ? _b : null;
22663
- if (newModuleSpecifier !== null) {
22664
- this._printAndUpdateNode(sourceFile, specifierLiteral, newModuleSpecifier);
22665
- break;
22666
- }
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);
22667
22601
  }
22668
22602
  }
22669
- _isNgModuleDecorator(node) {
22670
- const call = node.expression;
22671
- if (!ts2.isCallExpression(call) || !ts2.isIdentifier(call.expression)) {
22603
+ _isComponentDecorator(node) {
22604
+ if (!ts.isDecorator(node)) {
22672
22605
  return false;
22673
22606
  }
22674
- return call.expression.text === "NgModule";
22675
- }
22676
- _isComponentDecorator(node) {
22677
22607
  const call = node.expression;
22678
- if (!ts2.isCallExpression(call) || !ts2.isIdentifier(call.expression)) {
22608
+ if (!ts.isCallExpression(call) || !ts.isIdentifier(call.expression)) {
22679
22609
  return false;
22680
22610
  }
22681
22611
  return call.expression.text === "Component";
22682
22612
  }
22683
22613
  _isImportExpression(node) {
22684
- 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]);
22685
22615
  }
22686
22616
  _isTypeImportExpression(node) {
22687
- 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);
22688
22618
  }
22689
22619
  _printAndUpdateNode(sourceFile, oldNode, newNode) {
22690
22620
  const filePath = this.fileSystem.resolve(sourceFile.fileName);
22691
- 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);
22692
22622
  const start = oldNode.getStart();
22693
22623
  const width = oldNode.getWidth();
22694
22624
  this.fileSystem.edit(filePath).remove(start, width).insertRight(start, newNodeText);
22695
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
+ }
22696
22642
  };
22697
22643
 
22698
22644
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/index.mjs