bug(typography): migration to v15 error with `mat.define-legacy-typography-config` conversion
Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
When upgrading from v14 to v15, conversion of mat.define-typography-config() to mat.define-legacy-typography-config() is broken.
Reproduction
Steps to reproduce:
- Checkout tchandelle/angular-components@08589da
- Upgrade to v15 with
npx ng update -C @angular/material@15 - See the issue here: https://github.com/tchandelle/angular-components-26278/blob/4d52c4d6673827731ce52eea5e88b44fedd99fd7/src/app/app.component.scss#L3
- Have a component scss in v14 like:
@use '@angular/material' as mat;
.foo {
$typo: mat.define-typography-config();
> h3 {
@include mat.typography-level($typo, subheading-2);
}
}
The component is declared as:
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'foo',
templateUrl: './foo.component.html',
styleUrls: ['./foo.component.scss'],
encapsulation: ViewEncapsulation.None,
}
- Upgrade to v15 with
npx ng update -C @angular/material@15
Expected Behavior
Should be converted to $typo: mat.define-legacy-typography-config();
Actual Behavior
Converted instead to $typo: mat.define-legacy-typography-configmat.define-legacy-typography-config();
Some are even converted to $typo: mat.define-legacy-typography-configmat.define-legacy-typography-configmat.define-legacy-typography-configmat.define-legacy-typography-configmat.define-legacy-typography-config();.
It seems the number of repetition correlate with the number of level in the scss:
.foo {
// 1st level > repeated 2 times
$typo: mat.define-legacy-typography-configmat.define-legacy-typography-config();
.bar {
// 2nd levels > repeated 3 times
$typo: mat.define-legacy-typography-configmat.define-legacy-typography-configmat.define-legacy-typography-config();
}
}
Environment
- Angular: 15.0.4 (migrated from 14.2.10)
- CDK/Material: 15.0.3 (migrated from (14.2.7)
- Operating System (e.g. Windows, macOS, Ubuntu): darwin x64
- Node: 18.12.1
- Package Manager: yarn 3.1.1
I had the same problem. The update broke the config. It should be:
$typo: mat.define-legacy-typography-config();
We are closing this issue, because we've determined, using a semi-automated process, that it is no longer relevant, has low engagement, or it does not have enough information to proceed. Feel free to comment if you think the issue should be reopened, or open a new issue with the latest version of our code instead.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.