diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ef65a489121..0ee0d9485a77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ + +# 20.0.2 "amesite-armoire" (2025-06-04) +### material +| Commit | Type | Description | +| -- | -- | -- | +| [45fcf24b6](https://github.com/angular/components/commit/45fcf24b6cb5088e3c6e08c0eff068c7a7a7b548) | fix | **core:** brand family not set for plain value ([#31260](https://github.com/angular/components/pull/31260)) | +| [3a3a9b1c2](https://github.com/angular/components/commit/3a3a9b1c25dcca3953191f37d4f8be9b3eab5ebe) | fix | **schematics:** avoid overwriting files that didn't change ([#31270](https://github.com/angular/components/pull/31270)) | +| [1af07e3b2](https://github.com/angular/components/commit/1af07e3b220ccdc64592bee17e3b353798836699) | fix | **schematics:** token migration not replacing all instances ([#31277](https://github.com/angular/components/pull/31277)) | + + + # 20.0.1 "sulfur-sandpaper" (2025-05-28) ### material diff --git a/package.json b/package.json index 39540f176f29..b351b20d06b4 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "ci-notify-slack-failure": "node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only scripts/circleci/notify-slack-job-failure.mts", "prepare": "husky" }, - "version": "20.0.1", + "version": "20.0.2", "dependencies": { "@angular-devkit/core": "catalog:", "@angular-devkit/schematics": "catalog:", diff --git a/src/material/button/button.md b/src/material/button/button.md index a06348334d9e..6f9baa201c88 100644 --- a/src/material/button/button.md +++ b/src/material/button/button.md @@ -9,6 +9,7 @@ is performed. An `` element should be used whenever the user will _navigate_ There are several button variants, each applied as an attribute: + | Attribute | Description | |----------------------|--------------------------------------------------------------------------| | `matButton` | Rectangular button that can contain text and icons | diff --git a/src/material/core/tokens/_m3-system.scss b/src/material/core/tokens/_m3-system.scss index 3d2df55df9c2..b1d09c9e4f53 100644 --- a/src/material/core/tokens/_m3-system.scss +++ b/src/material/core/tokens/_m3-system.scss @@ -115,6 +115,7 @@ $regular: map.get($typography, regular-weight) or $regular; } @else { $plain: $typography; + $brand: $typography; } $typography-config: ( definition.$internals: ( diff --git a/src/material/schematics/ng-update/index.ts b/src/material/schematics/ng-update/index.ts index 18644fe90a00..1a8b2f6ab431 100644 --- a/src/material/schematics/ng-update/index.ts +++ b/src/material/schematics/ng-update/index.ts @@ -58,8 +58,10 @@ function renameMdcTokens(): Rule { tree.visit(path => { if (shouldRenameTokens(path)) { const content = tree.readText(path); - const updatedContent = content.replace('--mdc-', '--mat-'); - tree.overwrite(path, updatedContent); + const updatedContent = content.replaceAll('--mdc-', '--mat-'); + if (content !== updatedContent) { + tree.overwrite(path, updatedContent); + } } }); }; @@ -98,7 +100,7 @@ function renameComponentTokens(): Rule { const content = tree.readText(path); let updatedContent = content; for (const tokenPrefix of tokenPrefixes) { - updatedContent = updatedContent.replace(tokenPrefix.old, tokenPrefix.replacement); + updatedContent = updatedContent.replaceAll(tokenPrefix.old, tokenPrefix.replacement); } if (content !== updatedContent) { tree.overwrite(path, updatedContent); diff --git a/src/material/schematics/ng-update/test-cases/rename-mdc-tokens.spec.ts b/src/material/schematics/ng-update/test-cases/rename-mdc-tokens.spec.ts index 153accbb0286..28840e5abd19 100644 --- a/src/material/schematics/ng-update/test-cases/rename-mdc-tokens.spec.ts +++ b/src/material/schematics/ng-update/test-cases/rename-mdc-tokens.spec.ts @@ -48,4 +48,58 @@ describe('v20 rename tokens migration', () => { `), ); }); + + it('should rename multiple instances of the --mdc prefix', async () => { + writeFile( + THEME_FILE_PATH, + ` + html { + --mdc-foo: 1px; + --mdc-bar: 2px; + --mdc-baz: 3px; + } + `, + ); + + await runMigration(); + + expect(stripWhitespace(tree.readText(THEME_FILE_PATH))).toBe( + stripWhitespace(` + html { + --mat-foo: 1px; + --mat-bar: 2px; + --mat-baz: 3px; + } + `), + ); + }); + + it('should rename multiple instances of a specific component token', async () => { + writeFile( + THEME_FILE_PATH, + ` + .one { + --mat-circular-progress-foo: 1px; + } + + .two { + --mat-circular-progress-bar: 2px; + } + `, + ); + + await runMigration(); + + expect(stripWhitespace(tree.readText(THEME_FILE_PATH))).toBe( + stripWhitespace(` + .one { + --mat-progress-spinner-foo: 1px; + } + + .two { + --mat-progress-spinner-bar: 2px; + } + `), + ); + }); });