@angular/material 15.0.0-rc.2 → 15.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/material",
3
- "version": "15.0.0-rc.2",
3
+ "version": "15.0.0-rc.3",
4
4
  "description": "Angular Material",
5
5
  "repository": {
6
6
  "type": "git",
@@ -989,7 +989,7 @@
989
989
  },
990
990
  "peerDependencies": {
991
991
  "@angular/animations": "^15.0.0-0 || ^16.0.0",
992
- "@angular/cdk": "15.0.0-rc.2",
992
+ "@angular/cdk": "15.0.0-rc.3",
993
993
  "@angular/core": "^15.0.0-0 || ^16.0.0",
994
994
  "@angular/common": "^15.0.0-0 || ^16.0.0",
995
995
  "@angular/forms": "^15.0.0-0 || ^16.0.0",
@@ -18,7 +18,7 @@ const package_config_1 = require("./package-config");
18
18
  * Note that the fallback version range does not use caret, but tilde because that is
19
19
  * the default for Angular framework dependencies in CLI projects.
20
20
  */
21
- const fallbackMaterialVersionRange = `~15.0.0-rc.2`;
21
+ const fallbackMaterialVersionRange = `~15.0.0-rc.3`;
22
22
  /**
23
23
  * Schematic factory entry-point for the `ng-add` schematic. The ng-add schematic will be
24
24
  * automatically executed if developers run `ng add @angular/material`.
@@ -18,7 +18,7 @@ const package_config_1 = require("./package-config");
18
18
  * Note that the fallback version range does not use caret, but tilde because that is
19
19
  * the default for Angular framework dependencies in CLI projects.
20
20
  */
21
- const fallbackMaterialVersionRange = `~15.0.0-rc.2`;
21
+ const fallbackMaterialVersionRange = `~15.0.0-rc.3`;
22
22
  /**
23
23
  * Schematic factory entry-point for the `ng-add` schematic. The ng-add schematic will be
24
24
  * automatically executed if developers run `ng add @angular/material`.
@@ -21388,12 +21388,16 @@ publishFacade(_global);
21388
21388
  function visitElements(nodes, preorderCallback = () => {
21389
21389
  }, postorderCallback = () => {
21390
21390
  }) {
21391
- nodes.reverse();
21392
- for (let i = 0; i < nodes.length; i++) {
21391
+ for (let i = nodes.length - 1; i > -1; i--) {
21393
21392
  const node = nodes[i];
21394
- if (node instanceof Element$1) {
21393
+ const isElement = node instanceof Element$1;
21394
+ if (isElement) {
21395
21395
  preorderCallback(node);
21396
+ }
21397
+ if (isElement || node instanceof Template) {
21396
21398
  visitElements(node.children, preorderCallback, postorderCallback);
21399
+ }
21400
+ if (isElement) {
21397
21401
  postorderCallback(node);
21398
21402
  }
21399
21403
  }
@@ -22234,6 +22238,7 @@ var SliderTemplateMigrator = class extends TemplateMigrator {
22234
22238
  const bindings = this._getBindings(node);
22235
22239
  const inputBindings = [];
22236
22240
  const comments = [];
22241
+ let alreadyAppendedTemplateVars = false;
22237
22242
  for (let i = 0; i < bindings.length; i++) {
22238
22243
  const binding = bindings[i];
22239
22244
  if (binding.name === "value") {
@@ -22241,10 +22246,26 @@ var SliderTemplateMigrator = class extends TemplateMigrator {
22241
22246
  inputBindings.push(originalHtml.slice(sourceSpan.start.offset, sourceSpan.end.offset));
22242
22247
  updates.push(this._removeBinding(originalHtml, binding.node));
22243
22248
  }
22244
- if (binding.name === "invert" || binding.name === "vertical") {
22249
+ if (binding.name === "invert" || binding.name === "vertical" || binding.name === "tickInterval" || binding.name === "valueText") {
22245
22250
  comments.push(`<!-- TODO: The '${binding.name}' property no longer exists -->`);
22246
22251
  updates.push(this._removeBinding(originalHtml, binding.node));
22247
22252
  }
22253
+ if (binding.name === "displayValue") {
22254
+ comments.push(`<!-- TODO: The '${binding.name}' property no longer exists. Use 'displayWith' instead. -->`);
22255
+ updates.push(this._removeBinding(originalHtml, binding.node));
22256
+ }
22257
+ if (binding.name === "input" || binding.name === "change") {
22258
+ const sourceSpan = binding.node.sourceSpan;
22259
+ const oldBindingStr = originalHtml.slice(sourceSpan.start.offset, sourceSpan.end.offset);
22260
+ const newBindingStr = oldBindingStr.replace("$event", "{source: ngSliderThumb, parent: ngSlider, value: ngSliderThumb.value}");
22261
+ inputBindings.push(newBindingStr);
22262
+ updates.push(this._removeBinding(originalHtml, binding.node));
22263
+ if (!alreadyAppendedTemplateVars) {
22264
+ inputBindings.push('#ngSliderThumb="matSliderThumb"');
22265
+ updates.push(this._insertTemplateVar(node, "ngSlider"));
22266
+ alreadyAppendedTemplateVars = true;
22267
+ }
22268
+ }
22248
22269
  }
22249
22270
  if (comments.length) {
22250
22271
  updates.push(this._addComments(node, comments));
@@ -22258,6 +22279,12 @@ var SliderTemplateMigrator = class extends TemplateMigrator {
22258
22279
  });
22259
22280
  return updates;
22260
22281
  }
22282
+ _insertTemplateVar(node, varName) {
22283
+ return {
22284
+ offset: node.startSourceSpan.end.offset - 1,
22285
+ updateFn: (html) => html.slice(0, node.startSourceSpan.end.offset - 1) + ` #${varName}` + html.slice(node.startSourceSpan.end.offset - 1)
22286
+ };
22287
+ }
22261
22288
  _addComments(node, comments) {
22262
22289
  const whitespace = this._parseIndentation(node);
22263
22290
  const indentation = "\n" + this._parseIndentation(node);
@@ -22335,6 +22362,7 @@ var mappings = [
22335
22362
  ];
22336
22363
  var RENAMED_TYPOGRAPHY_LEVELS = new Map(mappings);
22337
22364
  var RENAMED_TYPOGRAPHY_CLASSES = new Map(mappings.map((m) => ["mat-" + m[0], "mat-" + m[1]]));
22365
+ var COMBINED_TYPOGRAPHY_LEVELS = /* @__PURE__ */ new Map([["input", "body-1"]]);
22338
22366
 
22339
22367
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/typography-hierarchy/typography-hierarchy-template.js
22340
22368
  var TypographyHierarchyTemplateMigrator = class extends TemplateMigrator {
@@ -22749,20 +22777,40 @@ function migrateTypographyConfigs(content, namespace) {
22749
22777
  const newFunctionName = `${namespace}.define-typography-config`;
22750
22778
  const replacements = [];
22751
22779
  calls.forEach(({ name, args }) => {
22752
- const argContent = content.slice(args.start, args.end);
22753
- replacements.push({ start: name.start, end: name.end, text: newFunctionName });
22780
+ const parameters = extractNamedParameters(content, args);
22781
+ const addedParameters = /* @__PURE__ */ new Set();
22754
22782
  RENAMED_TYPOGRAPHY_LEVELS.forEach((newName, oldName) => {
22755
- const pattern = new RegExp(`\\$(${oldName}) *:`, "g");
22756
- let match;
22757
- while (match = pattern.exec(argContent)) {
22758
- const start = args.start + match.index + 1;
22783
+ const correspondingParam = parameters.get(oldName);
22784
+ if (correspondingParam) {
22785
+ addedParameters.add(newName);
22759
22786
  replacements.push({
22760
- start,
22761
- end: start + match[1].length,
22787
+ start: correspondingParam.key.start + 1,
22788
+ end: correspondingParam.key.end,
22762
22789
  text: newName
22763
22790
  });
22764
22791
  }
22765
22792
  });
22793
+ COMBINED_TYPOGRAPHY_LEVELS.forEach((newName, oldName) => {
22794
+ const correspondingParam = parameters.get(oldName);
22795
+ if (correspondingParam) {
22796
+ if (addedParameters.has(newName)) {
22797
+ const fullContent = content.slice(correspondingParam.key.start, correspondingParam.value.fullEnd);
22798
+ replacements.push({
22799
+ start: correspondingParam.key.start,
22800
+ end: correspondingParam.value.fullEnd,
22801
+ text: `/* TODO(mdc-migration): No longer supported. Use \`${newName}\` instead. ${fullContent} */`
22802
+ });
22803
+ } else {
22804
+ addedParameters.add(newName);
22805
+ replacements.push({
22806
+ start: correspondingParam.key.start + 1,
22807
+ end: correspondingParam.key.end,
22808
+ text: newName
22809
+ });
22810
+ }
22811
+ }
22812
+ });
22813
+ replacements.push({ start: name.start, end: name.end, text: newFunctionName });
22766
22814
  });
22767
22815
  replacements.sort((a, b) => b.start - a.start).forEach(({ start, end, text }) => content = content.slice(0, start) + text + content.slice(end));
22768
22816
  return content;
@@ -22796,6 +22844,69 @@ function extractFunctionCalls(name, content) {
22796
22844
  }
22797
22845
  return results;
22798
22846
  }
22847
+ function extractNamedParameters(content, argsRange) {
22848
+ let escapeCount = 0;
22849
+ const args = content.slice(argsRange.start, argsRange.end).replace(/\(.*\)/g, (current) => ++escapeCount + "\u25EC".repeat(current.length - 1));
22850
+ let colonIndex = args.indexOf(":");
22851
+ const params = /* @__PURE__ */ new Map();
22852
+ while (colonIndex > -1) {
22853
+ const keyRange = extractKeyRange(args, colonIndex);
22854
+ const valueRange = extractValueRange(args, colonIndex);
22855
+ if (keyRange && valueRange) {
22856
+ params.set(args.slice(keyRange.start + 1, keyRange.end), {
22857
+ key: { start: keyRange.start + argsRange.start, end: keyRange.end + argsRange.start },
22858
+ value: {
22859
+ start: valueRange.start + argsRange.start,
22860
+ end: valueRange.end + argsRange.start,
22861
+ fullEnd: valueRange.fullEnd + argsRange.start
22862
+ }
22863
+ });
22864
+ }
22865
+ colonIndex = args.indexOf(":", colonIndex + 1);
22866
+ }
22867
+ return params;
22868
+ }
22869
+ function extractKeyRange(content, colonIndex) {
22870
+ let index2 = colonIndex - 1;
22871
+ let start = -1;
22872
+ let end = -1;
22873
+ while (index2 > -1) {
22874
+ const char = content[index2];
22875
+ if (char !== " " && char !== "\n") {
22876
+ if (end === -1) {
22877
+ end = index2 + 1;
22878
+ } else if (char === "$") {
22879
+ start = index2;
22880
+ break;
22881
+ }
22882
+ }
22883
+ index2--;
22884
+ }
22885
+ return start > -1 && end > -1 ? { start, end } : null;
22886
+ }
22887
+ function extractValueRange(content, colonIndex) {
22888
+ let index2 = colonIndex + 1;
22889
+ let start = -1;
22890
+ let end = -1;
22891
+ let fullEnd = -1;
22892
+ while (index2 < content.length) {
22893
+ const char = content[index2];
22894
+ const isWhitespace2 = char === " " || char === "\n";
22895
+ if (!isWhitespace2 && start === -1) {
22896
+ start = index2;
22897
+ } else if (start > -1 && (isWhitespace2 || char === ",")) {
22898
+ end = index2;
22899
+ fullEnd = index2 + 1;
22900
+ break;
22901
+ }
22902
+ if (start > -1 && index2 === content.length - 1) {
22903
+ fullEnd = end = content.length;
22904
+ break;
22905
+ }
22906
+ index2++;
22907
+ }
22908
+ return start > -1 && end > -1 ? { start, end, fullEnd } : null;
22909
+ }
22799
22910
 
22800
22911
  // bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/template-migration.js
22801
22912
  var import_schematics2 = require("@angular/cdk/schematics");