Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Material and CDK to standalone #28155

Merged
merged 46 commits into from
Nov 27, 2023
Merged

Conversation

crisbeto
Copy link
Member

Converts all of Material and the remaining non-standalone directives in the CDK to standalone. Note that there's more work to be done like fixing up tests and updating public APIs to be more standalone-friendly.

@crisbeto crisbeto added P2 The issue is important to a large percentage of users, with a workaround target: minor This PR is targeted for the next minor release labels Nov 20, 2023
@crisbeto crisbeto added the merge: preserve commits When the PR is merged, a rebase and merge should be performed label Nov 20, 2023
@crisbeto crisbeto force-pushed the standalone branch 3 times, most recently from 6eb58a8 to bf32b8f Compare November 20, 2023 13:18
@angular-robot angular-robot bot added the area: build & ci Related the build and CI infrastructure of the project label Nov 20, 2023
@angular-robot angular-robot bot removed the area: build & ci Related the build and CI infrastructure of the project label Nov 20, 2023
@crisbeto crisbeto force-pushed the standalone branch 4 times, most recently from 43b379a to 6c4f888 Compare November 20, 2023 18:02
…ormat

Converts test components in the CDK to standalone and fixes some that weren't formatteed according to the Prettier config.
Converts `cdk/a11y` to standalone.
Converts `cdk/accordion` to standalone.
Converts `cdk/bidi` to standalone.
Converts `cdk/clipboard` to standalone.
Converts `cdk/portal` to standalone.
Converts `cdk/stepper` to standalone.
Converts `cdk/table` to standalone.
Converts `cdk/text-field` to standalone.
Converts `cdk/tree` to standalone.
Converts `cdk/observers` to standalone.
Converts `material/autocomplete` to standalone.
Converts `material/badge` to standalone.
Converts `material/bottom-sheet` to standalone.
Converts `material/button` to standalone.
Converts `material/button-toggle` to standalone.
Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

crisbeto added a commit to crisbeto/angular that referenced this pull request Nov 21, 2023
During the presubmit of angular/components#28155 an internal check started flagging the `setAttribute` call inside `relativePath`. This code has been here for many years, but I suspect that the import graph changing caused it to be surfaced. Ideally we would refactor this code not to create a DOM node at all, but for now this is the simplest approach to unblock the change in Material.
@crisbeto
Copy link
Member Author

crisbeto commented Nov 21, 2023

Blocked on angular/angular#53097.

crisbeto added a commit to crisbeto/angular that referenced this pull request Nov 21, 2023
During the presubmit of angular/components#28155 an internal check started flagging the `setAttribute` call inside `relativePath`. This code has been here for many years, but I suspect that the import graph changing caused it to be surfaced. Ideally we would refactor this code not to create a DOM node at all, but for now this is the simplest approach to unblock the change in Material.
@josephperrott josephperrott removed their request for review November 21, 2023 15:39
crisbeto added a commit to crisbeto/angular that referenced this pull request Nov 21, 2023
… path

Currently the way we extract the pathname of a URL is by creating an anchor node, assigning the URL to its `href` and reading the `pathname`. This is inefficient and it triggers an internal security check that doesn't allow the `href` attribute to be set which ends up blocking angular/components#28155.

These changes switch to using the browser's built-in URL parsing instead.
crisbeto added a commit to crisbeto/angular that referenced this pull request Nov 21, 2023
… path

Currently the way we extract the pathname of a URL is by creating an anchor node, assigning the URL to its `href` and reading the `pathname`. This is inefficient and it triggers an internal security check that doesn't allow the `href` attribute to be set which ends up blocking angular/components#28155.

These changes switch to using the browser's built-in URL parsing instead.
crisbeto added a commit to crisbeto/angular that referenced this pull request Nov 21, 2023
… path

Currently the way we extract the pathname of a URL is by creating an anchor node, assigning the URL to its `href` and reading the `pathname`. This is inefficient and it triggers an internal security check that doesn't allow the `href` attribute to be set which ends up blocking angular/components#28155.

These changes switch to using the browser's built-in URL parsing instead.
crisbeto added a commit to crisbeto/angular that referenced this pull request Nov 23, 2023
… path

Currently the way we extract the pathname of a URL is by creating an anchor node, assigning the URL to its `href` and reading the `pathname`. This is inefficient and it triggers an internal security check that doesn't allow the `href` attribute to be set which ends up blocking angular/components#28155.

These changes switch to using the browser's built-in URL parsing instead.
@HyperLife1119
Copy link

HyperLife1119 commented Nov 26, 2023

I have a question: Are all material components suitable for conversion to standalone components?
For example material tabs, I have to import both mat-tab-group and mat-tab to use this feature, but the best practice should be to import only one MatTabsModule, maybe mat-tab-group and mat-tab shouldn't be converted to standalone components?

I want to know what you think :)

@crisbeto
Copy link
Member Author

There's nothing stopping you from continuing to use the MatTabsModule. This refactor allows users to import the components either on their own or through the module.

pkozlowski-opensource pushed a commit to angular/angular that referenced this pull request Nov 27, 2023
… path (#53097)

Currently the way we extract the pathname of a URL is by creating an anchor node, assigning the URL to its `href` and reading the `pathname`. This is inefficient and it triggers an internal security check that doesn't allow the `href` attribute to be set which ends up blocking angular/components#28155.

These changes switch to using the browser's built-in URL parsing instead.

PR Close #53097
pkozlowski-opensource pushed a commit to angular/angular that referenced this pull request Nov 27, 2023
… path (#53097)

Currently the way we extract the pathname of a URL is by creating an anchor node, assigning the URL to its `href` and reading the `pathname`. This is inefficient and it triggers an internal security check that doesn't allow the `href` attribute to be set which ends up blocking angular/components#28155.

These changes switch to using the browser's built-in URL parsing instead.

PR Close #53097
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Nov 27, 2023
@crisbeto crisbeto merged commit 3e092f1 into angular:main Nov 27, 2023
27 checks passed
tbondwilkinson pushed a commit to tbondwilkinson/angular that referenced this pull request Dec 6, 2023
… path (angular#53097)

Currently the way we extract the pathname of a URL is by creating an anchor node, assigning the URL to its `href` and reading the `pathname`. This is inefficient and it triggers an internal security check that doesn't allow the `href` attribute to be set which ends up blocking angular/components#28155.

These changes switch to using the browser's built-in URL parsing instead.

PR Close angular#53097
crisbeto added a commit to crisbeto/material2 that referenced this pull request Dec 11, 2023
Cherry-picks some of the changes from angular#28155 to the patch branch since they're necessary for compatibility with `@defer`.

Fixes angular#28198.
crisbeto added a commit that referenced this pull request Dec 11, 2023
Cherry-picks some of the changes from #28155 to the patch branch since they're necessary for compatibility with `@defer`.

Fixes #28198.
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker merge: preserve commits When the PR is merged, a rebase and merge should be performed P2 The issue is important to a large percentage of users, with a workaround target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants