@angular/material 15.0.0-rc.1 → 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/_index.scss +1 -1
- package/checkbox/_checkbox-private.scss +1 -1
- package/chips/index.d.ts +0 -2
- package/core/density/private/_all-density.scss +5 -9
- package/core/theming/_all-theme.scss +14 -18
- package/core/typography/_all-typography.scss +15 -19
- package/core/typography/_typography-deprecated.scss +1 -1
- package/core/typography/_typography.scss +130 -0
- package/esm2020/chips/chip-option.mjs +5 -11
- package/esm2020/core/version.mjs +1 -1
- package/esm2020/slider/public-api.mjs +2 -1
- package/esm2020/slider/slider-input.mjs +26 -5
- package/esm2020/slider/slider-interface.mjs +8 -1
- package/esm2020/slider/slider.mjs +62 -17
- package/esm2020/stepper/step-header.mjs +2 -2
- package/esm2020/stepper/stepper.mjs +3 -3
- package/esm2020/tabs/tab-header.mjs +2 -2
- package/esm2020/tabs/tab-nav-bar/tab-nav-bar.mjs +97 -97
- package/fesm2015/chips.mjs +4 -10
- package/fesm2015/chips.mjs.map +1 -1
- package/fesm2015/core.mjs +1 -1
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/slider.mjs +94 -21
- package/fesm2015/slider.mjs.map +1 -1
- package/fesm2015/stepper.mjs +4 -4
- package/fesm2015/stepper.mjs.map +1 -1
- package/fesm2015/tabs.mjs +112 -112
- package/fesm2015/tabs.mjs.map +1 -1
- package/fesm2020/chips.mjs +4 -10
- package/fesm2020/chips.mjs.map +1 -1
- package/fesm2020/core.mjs +1 -1
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/slider.mjs +94 -21
- package/fesm2020/slider.mjs.map +1 -1
- package/fesm2020/stepper.mjs +4 -4
- package/fesm2020/stepper.mjs.map +1 -1
- package/fesm2020/tabs.mjs +110 -110
- package/fesm2020/tabs.mjs.map +1 -1
- package/legacy-core/density/private/_all-density.scss +10 -2
- package/legacy-core/theming/_all-theme.scss +29 -2
- package/legacy-core/typography/_all-typography.scss +31 -2
- package/legacy-prebuilt-themes/legacy-deeppurple-amber.css +1 -1
- package/legacy-prebuilt-themes/legacy-indigo-pink.css +1 -1
- package/legacy-prebuilt-themes/legacy-pink-bluegrey.css +1 -1
- package/legacy-prebuilt-themes/legacy-purple-green.css +1 -1
- package/package.json +2 -2
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/radio/_radio-theme.scss +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-generate/mdc-migration/index_bundled.js +362 -62
- package/schematics/ng-generate/mdc-migration/index_bundled.js.map +3 -3
- package/schematics/ng-generate/mdc-migration/mdc_migration_bundle_metadata.json +1 -1
- package/schematics/ng-generate/mdc-migration/schema.json +1 -1
- package/schematics/ng-update/index_bundled.js +12 -4
- package/schematics/ng-update/index_bundled.js.map +2 -2
- package/schematics/ng-update/ng_update_index_metadata.json +1 -1
- package/slider/index.d.ts +44 -4
- package/tabs/index.d.ts +1 -1
package/radio/_radio-theme.scss
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
@include mdc-helpers.using-mdc-theme($config) {
|
|
30
30
|
$on-surface: rgba(mdc-theme-color.$on-surface, 0.54);
|
|
31
|
-
$is-dark: map
|
|
31
|
+
$is-dark: map.get($config, is-dark);
|
|
32
32
|
$active-border-color: if(
|
|
33
33
|
$is-dark,
|
|
34
34
|
theming.get-color-from-palette(palette.$gray-palette, 200),
|
|
@@ -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.
|
|
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.
|
|
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`.
|
|
@@ -1962,9 +1962,9 @@ var require_source_map_generator = __commonJS({
|
|
|
1962
1962
|
var mapping;
|
|
1963
1963
|
var nameIdx;
|
|
1964
1964
|
var sourceIdx;
|
|
1965
|
-
var
|
|
1966
|
-
for (var i = 0, len =
|
|
1967
|
-
mapping =
|
|
1965
|
+
var mappings2 = this._mappings.toArray();
|
|
1966
|
+
for (var i = 0, len = mappings2.length; i < len; i++) {
|
|
1967
|
+
mapping = mappings2[i];
|
|
1968
1968
|
next = "";
|
|
1969
1969
|
if (mapping.generatedLine !== previousGeneratedLine) {
|
|
1970
1970
|
previousGeneratedColumn = 0;
|
|
@@ -1974,7 +1974,7 @@ var require_source_map_generator = __commonJS({
|
|
|
1974
1974
|
}
|
|
1975
1975
|
} else {
|
|
1976
1976
|
if (i > 0) {
|
|
1977
|
-
if (!util.compareByGeneratedPositionsInflated(mapping,
|
|
1977
|
+
if (!util.compareByGeneratedPositionsInflated(mapping, mappings2[i - 1])) {
|
|
1978
1978
|
continue;
|
|
1979
1979
|
}
|
|
1980
1980
|
next += ",";
|
|
@@ -2190,13 +2190,13 @@ var require_source_map_consumer = __commonJS({
|
|
|
2190
2190
|
SourceMapConsumer.prototype.eachMapping = function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
|
|
2191
2191
|
var context = aContext || null;
|
|
2192
2192
|
var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
|
|
2193
|
-
var
|
|
2193
|
+
var mappings2;
|
|
2194
2194
|
switch (order) {
|
|
2195
2195
|
case SourceMapConsumer.GENERATED_ORDER:
|
|
2196
|
-
|
|
2196
|
+
mappings2 = this._generatedMappings;
|
|
2197
2197
|
break;
|
|
2198
2198
|
case SourceMapConsumer.ORIGINAL_ORDER:
|
|
2199
|
-
|
|
2199
|
+
mappings2 = this._originalMappings;
|
|
2200
2200
|
break;
|
|
2201
2201
|
default:
|
|
2202
2202
|
throw new Error("Unknown order of iteration.");
|
|
@@ -2206,8 +2206,8 @@ var require_source_map_consumer = __commonJS({
|
|
|
2206
2206
|
var names = this._names;
|
|
2207
2207
|
var sources = this._sources;
|
|
2208
2208
|
var sourceMapURL = this._sourceMapURL;
|
|
2209
|
-
for (var i = 0, n =
|
|
2210
|
-
var mapping =
|
|
2209
|
+
for (var i = 0, n = mappings2.length; i < n; i++) {
|
|
2210
|
+
var mapping = mappings2[i];
|
|
2211
2211
|
var source = mapping.source === null ? null : sources.at(mapping.source);
|
|
2212
2212
|
source = util.computeSourceURL(sourceRoot, source, sourceMapURL);
|
|
2213
2213
|
boundCallback({
|
|
@@ -2231,14 +2231,14 @@ var require_source_map_consumer = __commonJS({
|
|
|
2231
2231
|
if (needle.source < 0) {
|
|
2232
2232
|
return [];
|
|
2233
2233
|
}
|
|
2234
|
-
var
|
|
2234
|
+
var mappings2 = [];
|
|
2235
2235
|
var index2 = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, binarySearch.LEAST_UPPER_BOUND);
|
|
2236
2236
|
if (index2 >= 0) {
|
|
2237
2237
|
var mapping = this._originalMappings[index2];
|
|
2238
2238
|
if (aArgs.column === void 0) {
|
|
2239
2239
|
var originalLine = mapping.originalLine;
|
|
2240
2240
|
while (mapping && mapping.originalLine === originalLine) {
|
|
2241
|
-
|
|
2241
|
+
mappings2.push({
|
|
2242
2242
|
line: util.getArg(mapping, "generatedLine", null),
|
|
2243
2243
|
column: util.getArg(mapping, "generatedColumn", null),
|
|
2244
2244
|
lastColumn: util.getArg(mapping, "lastGeneratedColumn", null)
|
|
@@ -2248,7 +2248,7 @@ var require_source_map_consumer = __commonJS({
|
|
|
2248
2248
|
} else {
|
|
2249
2249
|
var originalColumn = mapping.originalColumn;
|
|
2250
2250
|
while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) {
|
|
2251
|
-
|
|
2251
|
+
mappings2.push({
|
|
2252
2252
|
line: util.getArg(mapping, "generatedLine", null),
|
|
2253
2253
|
column: util.getArg(mapping, "generatedColumn", null),
|
|
2254
2254
|
lastColumn: util.getArg(mapping, "lastGeneratedColumn", null)
|
|
@@ -2257,7 +2257,7 @@ var require_source_map_consumer = __commonJS({
|
|
|
2257
2257
|
}
|
|
2258
2258
|
}
|
|
2259
2259
|
}
|
|
2260
|
-
return
|
|
2260
|
+
return mappings2;
|
|
2261
2261
|
};
|
|
2262
2262
|
exports.SourceMapConsumer = SourceMapConsumer;
|
|
2263
2263
|
function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
|
|
@@ -2270,7 +2270,7 @@ var require_source_map_consumer = __commonJS({
|
|
|
2270
2270
|
var names = util.getArg(sourceMap, "names", []);
|
|
2271
2271
|
var sourceRoot = util.getArg(sourceMap, "sourceRoot", null);
|
|
2272
2272
|
var sourcesContent = util.getArg(sourceMap, "sourcesContent", null);
|
|
2273
|
-
var
|
|
2273
|
+
var mappings2 = util.getArg(sourceMap, "mappings");
|
|
2274
2274
|
var file = util.getArg(sourceMap, "file", null);
|
|
2275
2275
|
if (version != this._version) {
|
|
2276
2276
|
throw new Error("Unsupported version: " + version);
|
|
@@ -2288,7 +2288,7 @@ var require_source_map_consumer = __commonJS({
|
|
|
2288
2288
|
});
|
|
2289
2289
|
this.sourceRoot = sourceRoot;
|
|
2290
2290
|
this.sourcesContent = sourcesContent;
|
|
2291
|
-
this._mappings =
|
|
2291
|
+
this._mappings = mappings2;
|
|
2292
2292
|
this._sourceMapURL = aSourceMapURL;
|
|
2293
2293
|
this.file = file;
|
|
2294
2294
|
}
|
|
@@ -6271,11 +6271,25 @@ module.exports = __toCommonJS(mdc_migration_exports);
|
|
|
6271
6271
|
var END_OF_SELECTOR_REGEX = "(?!-)";
|
|
6272
6272
|
var MIXIN_ARGUMENTS_REGEX = "\\(((\\s|.)*)\\)";
|
|
6273
6273
|
var StyleMigrator = class {
|
|
6274
|
+
constructor() {
|
|
6275
|
+
this._processedNodes = /* @__PURE__ */ new WeakMap();
|
|
6276
|
+
}
|
|
6277
|
+
static wrapValue(value) {
|
|
6278
|
+
const escapeString = "__NG_MDC_MIGRATION_PLACEHOLDER__";
|
|
6279
|
+
return `${escapeString}${value}${escapeString}`;
|
|
6280
|
+
}
|
|
6281
|
+
static unwrapAllValues(content) {
|
|
6282
|
+
return content.replace(/__NG_MDC_MIGRATION_PLACEHOLDER__/g, "");
|
|
6283
|
+
}
|
|
6274
6284
|
isLegacyMixin(namespace, atRule2) {
|
|
6275
6285
|
return this.mixinChanges.some((change) => atRule2.params.includes(`${namespace}.${change.old}`));
|
|
6276
6286
|
}
|
|
6277
6287
|
getMixinChange(namespace, atRule2) {
|
|
6278
6288
|
var _a, _b;
|
|
6289
|
+
const processedKey = `mixinChange-${namespace}`;
|
|
6290
|
+
if (this._nodeIsProcessed(atRule2, processedKey)) {
|
|
6291
|
+
return null;
|
|
6292
|
+
}
|
|
6279
6293
|
const change = this.mixinChanges.find((c) => {
|
|
6280
6294
|
return atRule2.params.includes(`${namespace}.${c.old}`);
|
|
6281
6295
|
});
|
|
@@ -6294,6 +6308,7 @@ var StyleMigrator = class {
|
|
|
6294
6308
|
}
|
|
6295
6309
|
});
|
|
6296
6310
|
}
|
|
6311
|
+
this._trackProcessedNode(atRule2, processedKey);
|
|
6297
6312
|
return { old: change.old, new: replacements.length ? replacements : null };
|
|
6298
6313
|
}
|
|
6299
6314
|
isLegacySelector(rule2) {
|
|
@@ -6304,16 +6319,28 @@ var StyleMigrator = class {
|
|
|
6304
6319
|
}
|
|
6305
6320
|
replaceLegacySelector(rule2) {
|
|
6306
6321
|
var _a;
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6322
|
+
if (!this._nodeIsProcessed(rule2, "replaceLegacySelector")) {
|
|
6323
|
+
for (let i = 0; i < this.classChanges.length; i++) {
|
|
6324
|
+
const change = this.classChanges[i];
|
|
6325
|
+
if ((_a = rule2.selector) == null ? void 0 : _a.match(change.old + END_OF_SELECTOR_REGEX)) {
|
|
6326
|
+
rule2.selector = rule2.selector.replace(change.old, change.new);
|
|
6327
|
+
}
|
|
6311
6328
|
}
|
|
6329
|
+
this._trackProcessedNode(rule2, "replaceLegacySelector");
|
|
6312
6330
|
}
|
|
6313
6331
|
}
|
|
6314
6332
|
isDeprecatedSelector(rule2) {
|
|
6315
6333
|
return this.deprecatedPrefixes.some((deprecatedPrefix) => rule2.selector.includes(deprecatedPrefix));
|
|
6316
6334
|
}
|
|
6335
|
+
_trackProcessedNode(node, action) {
|
|
6336
|
+
const appliedActions = this._processedNodes.get(node) || /* @__PURE__ */ new Set();
|
|
6337
|
+
appliedActions.add(action);
|
|
6338
|
+
this._processedNodes.set(node, appliedActions);
|
|
6339
|
+
}
|
|
6340
|
+
_nodeIsProcessed(node, action) {
|
|
6341
|
+
var _a;
|
|
6342
|
+
return !!((_a = this._processedNodes.get(node)) == null ? void 0 : _a.has(action));
|
|
6343
|
+
}
|
|
6317
6344
|
};
|
|
6318
6345
|
|
|
6319
6346
|
// bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/autocomplete/autocomplete-styles.js
|
|
@@ -8412,14 +8439,14 @@ var SourceMapGenerator = class {
|
|
|
8412
8439
|
sources.push(url);
|
|
8413
8440
|
sourcesContent.push(this.sourcesContent.get(url) || null);
|
|
8414
8441
|
});
|
|
8415
|
-
let
|
|
8442
|
+
let mappings2 = "";
|
|
8416
8443
|
let lastCol0 = 0;
|
|
8417
8444
|
let lastSourceIndex = 0;
|
|
8418
8445
|
let lastSourceLine0 = 0;
|
|
8419
8446
|
let lastSourceCol0 = 0;
|
|
8420
8447
|
this.lines.forEach((segments) => {
|
|
8421
8448
|
lastCol0 = 0;
|
|
8422
|
-
|
|
8449
|
+
mappings2 += segments.map((segment) => {
|
|
8423
8450
|
let segAsStr = toBase64VLQ(segment.col0 - lastCol0);
|
|
8424
8451
|
lastCol0 = segment.col0;
|
|
8425
8452
|
if (segment.sourceUrl != null) {
|
|
@@ -8432,16 +8459,16 @@ var SourceMapGenerator = class {
|
|
|
8432
8459
|
}
|
|
8433
8460
|
return segAsStr;
|
|
8434
8461
|
}).join(",");
|
|
8435
|
-
|
|
8462
|
+
mappings2 += ";";
|
|
8436
8463
|
});
|
|
8437
|
-
|
|
8464
|
+
mappings2 = mappings2.slice(0, -1);
|
|
8438
8465
|
return {
|
|
8439
8466
|
"file": this.file || "",
|
|
8440
8467
|
"version": VERSION$1,
|
|
8441
8468
|
"sourceRoot": "",
|
|
8442
8469
|
"sources": sources,
|
|
8443
8470
|
"sourcesContent": sourcesContent,
|
|
8444
|
-
"mappings":
|
|
8471
|
+
"mappings": mappings2
|
|
8445
8472
|
};
|
|
8446
8473
|
}
|
|
8447
8474
|
toJsComment() {
|
|
@@ -21361,12 +21388,16 @@ publishFacade(_global);
|
|
|
21361
21388
|
function visitElements(nodes, preorderCallback = () => {
|
|
21362
21389
|
}, postorderCallback = () => {
|
|
21363
21390
|
}) {
|
|
21364
|
-
nodes.
|
|
21365
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
21391
|
+
for (let i = nodes.length - 1; i > -1; i--) {
|
|
21366
21392
|
const node = nodes[i];
|
|
21367
|
-
|
|
21393
|
+
const isElement = node instanceof Element$1;
|
|
21394
|
+
if (isElement) {
|
|
21368
21395
|
preorderCallback(node);
|
|
21396
|
+
}
|
|
21397
|
+
if (isElement || node instanceof Template) {
|
|
21369
21398
|
visitElements(node.children, preorderCallback, postorderCallback);
|
|
21399
|
+
}
|
|
21400
|
+
if (isElement) {
|
|
21370
21401
|
postorderCallback(node);
|
|
21371
21402
|
}
|
|
21372
21403
|
}
|
|
@@ -22203,14 +22234,198 @@ var SliderTemplateMigrator = class extends TemplateMigrator {
|
|
|
22203
22234
|
const updates = [];
|
|
22204
22235
|
visitElements(ast.nodes, (node) => {
|
|
22205
22236
|
if (node.name === "mat-slider") {
|
|
22237
|
+
const originalHtml = node.sourceSpan.start.file.content;
|
|
22238
|
+
const bindings = this._getBindings(node);
|
|
22239
|
+
const inputBindings = [];
|
|
22240
|
+
const comments = [];
|
|
22241
|
+
let alreadyAppendedTemplateVars = false;
|
|
22242
|
+
for (let i = 0; i < bindings.length; i++) {
|
|
22243
|
+
const binding = bindings[i];
|
|
22244
|
+
if (binding.name === "value") {
|
|
22245
|
+
const sourceSpan = binding.node.sourceSpan;
|
|
22246
|
+
inputBindings.push(originalHtml.slice(sourceSpan.start.offset, sourceSpan.end.offset));
|
|
22247
|
+
updates.push(this._removeBinding(originalHtml, binding.node));
|
|
22248
|
+
}
|
|
22249
|
+
if (binding.name === "invert" || binding.name === "vertical" || binding.name === "tickInterval" || binding.name === "valueText") {
|
|
22250
|
+
comments.push(`<!-- TODO: The '${binding.name}' property no longer exists -->`);
|
|
22251
|
+
updates.push(this._removeBinding(originalHtml, binding.node));
|
|
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
|
+
}
|
|
22269
|
+
}
|
|
22270
|
+
if (comments.length) {
|
|
22271
|
+
updates.push(this._addComments(node, comments));
|
|
22272
|
+
}
|
|
22273
|
+
const matSliderThumb = inputBindings.length ? `<input matSliderThumb ${inputBindings.join(" ")} />` : "<input matSliderThumb />";
|
|
22206
22274
|
updates.push({
|
|
22207
|
-
offset: node.
|
|
22208
|
-
updateFn: (html) => html
|
|
22275
|
+
offset: node.startSourceSpan.end.offset,
|
|
22276
|
+
updateFn: (html) => html.slice(0, node.startSourceSpan.end.offset) + matSliderThumb + html.slice(node.startSourceSpan.end.offset)
|
|
22209
22277
|
});
|
|
22210
22278
|
}
|
|
22211
22279
|
});
|
|
22212
22280
|
return updates;
|
|
22213
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
|
+
}
|
|
22288
|
+
_addComments(node, comments) {
|
|
22289
|
+
const whitespace = this._parseIndentation(node);
|
|
22290
|
+
const indentation = "\n" + this._parseIndentation(node);
|
|
22291
|
+
const commentStr = whitespace.length === node.sourceSpan.start.col ? comments.join(indentation) : indentation + comments.join(indentation);
|
|
22292
|
+
return {
|
|
22293
|
+
offset: node.sourceSpan.start.offset,
|
|
22294
|
+
updateFn: (html) => html.slice(0, node.sourceSpan.start.offset) + commentStr + `${indentation}${html.slice(node.sourceSpan.start.offset)}`
|
|
22295
|
+
};
|
|
22296
|
+
}
|
|
22297
|
+
_parseIndentation(node) {
|
|
22298
|
+
const html = node.sourceSpan.start.file.content;
|
|
22299
|
+
const before = html.slice(node.sourceSpan.start.offset - node.sourceSpan.start.col, node.sourceSpan.start.offset);
|
|
22300
|
+
return before.slice(0, before.length - before.trimStart().length);
|
|
22301
|
+
}
|
|
22302
|
+
_removeBinding(originalHtml, binding) {
|
|
22303
|
+
let charIndex = binding.sourceSpan.start.offset - 1;
|
|
22304
|
+
while (/\s/.test(originalHtml.charAt(charIndex)) && charIndex > -1) {
|
|
22305
|
+
charIndex--;
|
|
22306
|
+
}
|
|
22307
|
+
return {
|
|
22308
|
+
offset: charIndex + 1,
|
|
22309
|
+
updateFn: (html) => html.slice(0, charIndex + 1) + html.slice(binding.sourceSpan.end.offset)
|
|
22310
|
+
};
|
|
22311
|
+
}
|
|
22312
|
+
_getBindings(node) {
|
|
22313
|
+
const allInputs = this._getInputs(node);
|
|
22314
|
+
const allOutputs = this._getOutputs(node);
|
|
22315
|
+
const attributes = this._getAttributes(node);
|
|
22316
|
+
const twoWayBindings = this._getTwoWayBindings(allInputs, allOutputs);
|
|
22317
|
+
const inputs = allInputs.filter((input) => !twoWayBindings.some((binding) => binding.name === input.name));
|
|
22318
|
+
const outputs = allOutputs.filter((output) => !twoWayBindings.some((binding) => binding.name === output.name));
|
|
22319
|
+
return inputs.concat(outputs).concat(attributes).concat(twoWayBindings);
|
|
22320
|
+
}
|
|
22321
|
+
_getTwoWayBindings(inputs, outputs) {
|
|
22322
|
+
return inputs.filter((input) => outputs.some((output) => output.name === input.name)).map((input) => __spreadProps(__spreadValues({}, input), { type: 3 }));
|
|
22323
|
+
}
|
|
22324
|
+
_getOutputs(node) {
|
|
22325
|
+
return node.outputs.map((output) => ({
|
|
22326
|
+
node: output,
|
|
22327
|
+
type: 1,
|
|
22328
|
+
name: node.sourceSpan.start.file.content.slice(output.keySpan.start.offset, output.keySpan.end.offset),
|
|
22329
|
+
value: node.sourceSpan.start.file.content.slice(output.handlerSpan.start.offset, output.handlerSpan.end.offset)
|
|
22330
|
+
}));
|
|
22331
|
+
}
|
|
22332
|
+
_getInputs(node) {
|
|
22333
|
+
return node.inputs.map((input) => ({
|
|
22334
|
+
node: input,
|
|
22335
|
+
type: 0,
|
|
22336
|
+
name: node.sourceSpan.start.file.content.slice(input.keySpan.start.offset, input.keySpan.end.offset),
|
|
22337
|
+
value: node.sourceSpan.start.file.content.slice(input.value.sourceSpan.start, input.value.sourceSpan.end)
|
|
22338
|
+
}));
|
|
22339
|
+
}
|
|
22340
|
+
_getAttributes(node) {
|
|
22341
|
+
return node.attributes.map((attribute) => ({
|
|
22342
|
+
node: attribute,
|
|
22343
|
+
type: 2,
|
|
22344
|
+
name: attribute.name,
|
|
22345
|
+
value: attribute.value
|
|
22346
|
+
}));
|
|
22347
|
+
}
|
|
22348
|
+
};
|
|
22349
|
+
|
|
22350
|
+
// bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/typography-hierarchy/constants.js
|
|
22351
|
+
var mappings = [
|
|
22352
|
+
["display-4", "headline-1"],
|
|
22353
|
+
["display-3", "headline-2"],
|
|
22354
|
+
["display-2", "headline-3"],
|
|
22355
|
+
["display-1", "headline-4"],
|
|
22356
|
+
["headline", "headline-5"],
|
|
22357
|
+
["title", "headline-6"],
|
|
22358
|
+
["subheading-2", "subtitle-1"],
|
|
22359
|
+
["body-2", "subtitle-2"],
|
|
22360
|
+
["subheading-1", "body-1"],
|
|
22361
|
+
["body-1", "body-2"]
|
|
22362
|
+
];
|
|
22363
|
+
var RENAMED_TYPOGRAPHY_LEVELS = new Map(mappings);
|
|
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"]]);
|
|
22366
|
+
|
|
22367
|
+
// bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/typography-hierarchy/typography-hierarchy-template.js
|
|
22368
|
+
var TypographyHierarchyTemplateMigrator = class extends TemplateMigrator {
|
|
22369
|
+
getUpdates(ast) {
|
|
22370
|
+
const updates = [];
|
|
22371
|
+
visitElements(ast.nodes, (node) => {
|
|
22372
|
+
this._addStaticClassUpdates(node, updates);
|
|
22373
|
+
this._addClassBindingUpdates(node, updates);
|
|
22374
|
+
});
|
|
22375
|
+
return updates;
|
|
22376
|
+
}
|
|
22377
|
+
_addStaticClassUpdates(node, updates) {
|
|
22378
|
+
const classAttr = node.attributes.find((attr) => attr.name === "class");
|
|
22379
|
+
if (classAttr && classAttr.keySpan && classAttr.valueSpan && classAttr.value.includes("mat-")) {
|
|
22380
|
+
const classes = classAttr.value.split(" ");
|
|
22381
|
+
let hasChanged = false;
|
|
22382
|
+
classes.forEach((current, index2) => {
|
|
22383
|
+
if (RENAMED_TYPOGRAPHY_CLASSES.has(current)) {
|
|
22384
|
+
hasChanged = true;
|
|
22385
|
+
classes[index2] = RENAMED_TYPOGRAPHY_CLASSES.get(current);
|
|
22386
|
+
}
|
|
22387
|
+
});
|
|
22388
|
+
if (hasChanged) {
|
|
22389
|
+
updates.push({
|
|
22390
|
+
offset: classAttr.keySpan.start.offset,
|
|
22391
|
+
updateFn: (html) => html.slice(0, classAttr.valueSpan.start.offset) + classes.join(" ") + html.slice(classAttr.valueSpan.end.offset)
|
|
22392
|
+
});
|
|
22393
|
+
}
|
|
22394
|
+
}
|
|
22395
|
+
}
|
|
22396
|
+
_addClassBindingUpdates(node, updates) {
|
|
22397
|
+
node.inputs.forEach((input) => {
|
|
22398
|
+
if (input.type === 2 && RENAMED_TYPOGRAPHY_CLASSES.has(input.name)) {
|
|
22399
|
+
updates.push({
|
|
22400
|
+
offset: input.keySpan.start.offset,
|
|
22401
|
+
updateFn: (html) => {
|
|
22402
|
+
return html.slice(0, input.keySpan.start.offset) + "class." + RENAMED_TYPOGRAPHY_CLASSES.get(input.name) + html.slice(input.keySpan.end.offset);
|
|
22403
|
+
}
|
|
22404
|
+
});
|
|
22405
|
+
}
|
|
22406
|
+
});
|
|
22407
|
+
}
|
|
22408
|
+
};
|
|
22409
|
+
|
|
22410
|
+
// bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/components/typography-hierarchy/typography-hierarchy-styles.js
|
|
22411
|
+
var TypographyHierarchyStylesMigrator = class extends StyleMigrator {
|
|
22412
|
+
constructor() {
|
|
22413
|
+
super();
|
|
22414
|
+
this.component = "typography-hierarchy";
|
|
22415
|
+
this.deprecatedPrefixes = [];
|
|
22416
|
+
this.classChanges = [];
|
|
22417
|
+
this.mixinChanges = [
|
|
22418
|
+
{
|
|
22419
|
+
old: "legacy-typography-hierarchy",
|
|
22420
|
+
new: ["typography-hierarchy"],
|
|
22421
|
+
checkForDuplicates: false
|
|
22422
|
+
}
|
|
22423
|
+
];
|
|
22424
|
+
RENAMED_TYPOGRAPHY_CLASSES.forEach((newClass, oldClass) => {
|
|
22425
|
+
const wrappedNewClass = RENAMED_TYPOGRAPHY_CLASSES.has(newClass) ? `.${StyleMigrator.wrapValue(newClass)}` : `.${newClass}`;
|
|
22426
|
+
this.classChanges.push({ new: wrappedNewClass, old: "." + oldClass });
|
|
22427
|
+
});
|
|
22428
|
+
}
|
|
22214
22429
|
};
|
|
22215
22430
|
|
|
22216
22431
|
// bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/index.js
|
|
@@ -22358,6 +22573,13 @@ var MIGRATORS = [
|
|
|
22358
22573
|
styles: new TooltipStylesMigrator()
|
|
22359
22574
|
}
|
|
22360
22575
|
];
|
|
22576
|
+
var PERMANENT_MIGRATORS = [
|
|
22577
|
+
{
|
|
22578
|
+
component: "typography-hierarchy",
|
|
22579
|
+
template: new TypographyHierarchyTemplateMigrator(),
|
|
22580
|
+
styles: new TypographyHierarchyStylesMigrator()
|
|
22581
|
+
}
|
|
22582
|
+
];
|
|
22361
22583
|
|
|
22362
22584
|
// bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/index.mjs
|
|
22363
22585
|
var import_schematics4 = require("@angular/cdk/schematics");
|
|
@@ -22410,18 +22632,6 @@ var parse3 = import_scss_syntax.default.parse;
|
|
|
22410
22632
|
|
|
22411
22633
|
// bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/theming-styles.js
|
|
22412
22634
|
var COMPONENTS_MIXIN_NAME = /\.([^(;]*)/;
|
|
22413
|
-
var RENAMED_TYPOGRAPHY_LEVELS = /* @__PURE__ */ new Map([
|
|
22414
|
-
["display-4", "headline-1"],
|
|
22415
|
-
["display-3", "headline-2"],
|
|
22416
|
-
["display-2", "headline-3"],
|
|
22417
|
-
["display-1", "headline-4"],
|
|
22418
|
-
["headline", "headline-5"],
|
|
22419
|
-
["title", "headline-6"],
|
|
22420
|
-
["subheading-2", "subtitle-1"],
|
|
22421
|
-
["body-2", "subtitle-2"],
|
|
22422
|
-
["subheading-1", "body-1"],
|
|
22423
|
-
["body-1", "body-2"]
|
|
22424
|
-
]);
|
|
22425
22635
|
var ThemingStylesMigration = class extends import_schematics.Migration {
|
|
22426
22636
|
constructor() {
|
|
22427
22637
|
super(...arguments);
|
|
@@ -22439,26 +22649,27 @@ var ThemingStylesMigration = class extends import_schematics.Migration {
|
|
|
22439
22649
|
{
|
|
22440
22650
|
postcssPlugin: "theming-styles-migration-plugin",
|
|
22441
22651
|
AtRule: {
|
|
22442
|
-
use: this.
|
|
22443
|
-
include: this.
|
|
22652
|
+
use: this._atUseHandler.bind(this),
|
|
22653
|
+
include: (atRule2) => this._atIncludeHandler(atRule2)
|
|
22444
22654
|
},
|
|
22445
|
-
Rule: this.
|
|
22655
|
+
Rule: (rule2) => this._ruleHandler(rule2)
|
|
22446
22656
|
}
|
|
22447
22657
|
]);
|
|
22448
22658
|
try {
|
|
22449
|
-
|
|
22659
|
+
const result = processor.process(styles, { syntax: scss_syntax_exports }).toString();
|
|
22660
|
+
return result === styles ? styles : StyleMigrator.unwrapAllValues(result);
|
|
22450
22661
|
} catch (e) {
|
|
22451
22662
|
this.context.logger.error(`${e}`);
|
|
22452
22663
|
this.context.logger.warn(`Failed to process stylesheet: ${filename} (see error above).`);
|
|
22453
22664
|
return styles;
|
|
22454
22665
|
}
|
|
22455
22666
|
}
|
|
22456
|
-
|
|
22667
|
+
_atUseHandler(atRule2) {
|
|
22457
22668
|
if (isAngularMaterialImport(atRule2)) {
|
|
22458
22669
|
this._namespace = parseNamespace(atRule2);
|
|
22459
22670
|
}
|
|
22460
22671
|
}
|
|
22461
|
-
|
|
22672
|
+
_atIncludeHandler(atRule2) {
|
|
22462
22673
|
const migrator = this.upgradeData.find((m) => {
|
|
22463
22674
|
return m.styles.isLegacyMixin(this._namespace, atRule2);
|
|
22464
22675
|
});
|
|
@@ -22489,20 +22700,23 @@ var ThemingStylesMigration = class extends import_schematics.Migration {
|
|
|
22489
22700
|
].some((r) => new RegExp(r).test(mixinText));
|
|
22490
22701
|
}
|
|
22491
22702
|
isPartialMigration() {
|
|
22492
|
-
return this.upgradeData.length !== MIGRATORS.length;
|
|
22703
|
+
return this.upgradeData.length !== MIGRATORS.length + PERMANENT_MIGRATORS.length;
|
|
22493
22704
|
}
|
|
22494
|
-
|
|
22495
|
-
let isLegacySelector;
|
|
22496
|
-
let isDeprecatedSelector;
|
|
22705
|
+
_ruleHandler(rule2) {
|
|
22706
|
+
let isLegacySelector = false;
|
|
22707
|
+
let isDeprecatedSelector = false;
|
|
22497
22708
|
const migrator = this.upgradeData.find((m) => {
|
|
22498
22709
|
isLegacySelector = m.styles.isLegacySelector(rule2);
|
|
22499
22710
|
isDeprecatedSelector = m.styles.isDeprecatedSelector(rule2);
|
|
22500
22711
|
return isLegacySelector || isDeprecatedSelector;
|
|
22501
22712
|
});
|
|
22713
|
+
if (!migrator) {
|
|
22714
|
+
return;
|
|
22715
|
+
}
|
|
22502
22716
|
if (isLegacySelector) {
|
|
22503
|
-
migrator
|
|
22717
|
+
migrator.styles.replaceLegacySelector(rule2);
|
|
22504
22718
|
} else if (isDeprecatedSelector) {
|
|
22505
|
-
addCommentBeforeNode(rule2,
|
|
22719
|
+
addCommentBeforeNode(rule2, `TODO(mdc-migration): The following rule targets internal classes of ${migrator.component} that may no longer apply for the MDC version.`);
|
|
22506
22720
|
}
|
|
22507
22721
|
}
|
|
22508
22722
|
};
|
|
@@ -22563,20 +22777,40 @@ function migrateTypographyConfigs(content, namespace) {
|
|
|
22563
22777
|
const newFunctionName = `${namespace}.define-typography-config`;
|
|
22564
22778
|
const replacements = [];
|
|
22565
22779
|
calls.forEach(({ name, args }) => {
|
|
22566
|
-
const
|
|
22567
|
-
|
|
22780
|
+
const parameters = extractNamedParameters(content, args);
|
|
22781
|
+
const addedParameters = /* @__PURE__ */ new Set();
|
|
22568
22782
|
RENAMED_TYPOGRAPHY_LEVELS.forEach((newName, oldName) => {
|
|
22569
|
-
const
|
|
22570
|
-
|
|
22571
|
-
|
|
22572
|
-
const start = args.start + match.index + 1;
|
|
22783
|
+
const correspondingParam = parameters.get(oldName);
|
|
22784
|
+
if (correspondingParam) {
|
|
22785
|
+
addedParameters.add(newName);
|
|
22573
22786
|
replacements.push({
|
|
22574
|
-
start,
|
|
22575
|
-
end:
|
|
22787
|
+
start: correspondingParam.key.start + 1,
|
|
22788
|
+
end: correspondingParam.key.end,
|
|
22576
22789
|
text: newName
|
|
22577
22790
|
});
|
|
22578
22791
|
}
|
|
22579
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 });
|
|
22580
22814
|
});
|
|
22581
22815
|
replacements.sort((a, b) => b.start - a.start).forEach(({ start, end, text }) => content = content.slice(0, start) + text + content.slice(end));
|
|
22582
22816
|
return content;
|
|
@@ -22610,6 +22844,69 @@ function extractFunctionCalls(name, content) {
|
|
|
22610
22844
|
}
|
|
22611
22845
|
return results;
|
|
22612
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
|
+
}
|
|
22613
22910
|
|
|
22614
22911
|
// bazel-out/k8-fastbuild/bin/src/material/schematics/ng-generate/mdc-migration/rules/template-migration.js
|
|
22615
22912
|
var import_schematics2 = require("@angular/cdk/schematics");
|
|
@@ -22893,7 +23190,10 @@ function mdc_migration_default(options) {
|
|
|
22893
23190
|
const fileSystem = new import_schematics4.DevkitFileSystem(tree);
|
|
22894
23191
|
const analyzedFiles = /* @__PURE__ */ new Set();
|
|
22895
23192
|
const componentsToMigrate = getComponentsToMigrate(options.components);
|
|
22896
|
-
const migrators =
|
|
23193
|
+
const migrators = [
|
|
23194
|
+
...MIGRATORS.filter((m) => componentsToMigrate.has(m.component)),
|
|
23195
|
+
...PERMANENT_MIGRATORS
|
|
23196
|
+
];
|
|
22897
23197
|
let success = true;
|
|
22898
23198
|
if (options.directory) {
|
|
22899
23199
|
logger.info(`Limiting migration to: ${options.directory}`);
|