-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Navigator: stabilize and export APIs #64613
Navigator: stabilize and export APIs #64613
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Legacy exports have been moved to a separate legacy.ts
file (including the legacy JSDocs mentioning the components with their experimental export name).
This makes it easy to have separate names from the stable version, different JSDocs, and deprecation warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New exports (and their up-to-date JSDocs) have been moved to the folder's main index.ts
file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All READMEs have also been updated:
- removed experimental snippet
- updated the naming of all
Navigator
sub-components, including internal links to other READMEs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was actually renamed to packages/components/src/navigator/navigator/index.tsx
, but GitHub is not picking that up
* The `NavigatorProvider` component allows rendering nested views/panels/menus | ||
* (via the `NavigatorScreen` component and navigate between these different | ||
* view (via the `NavigatorButton` and `NavigatorBackButton` components or the | ||
* The `Navigator` component allows rendering nested views/panels/menus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The top level Navigator
component (previously named NavigatorProvider
) is the only component for which I've kept a JSDoc for the internal implementation, because apparently Storybook uses it when displaying docs 🤷 Not sure why it doesn't use the one defined in packages/components/src/navigator/index.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170 | ||
BackButton: Navigator.BackButton, | ||
}, | ||
title: 'Components/Navigator', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the PREVIOUSLY_EXPERIMENTAL_COMPONENTS
in storybook/manager-head.html
to make sure old links still work
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
965220a
to
85471a9
Compare
{ | ||
"title": "NavigatorProvider", | ||
"slug": "navigator-provider", | ||
"markdown_source": "../packages/components/src/navigator/navigator-provider/README.md", | ||
"parent": "components" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, removing things from the manifest is not going to remove it from the Block Editor Handbook 😱 There are some extra steps, see #60003 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I'll follow-up accordingly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a reminder we'll need to take care of this one after merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @WordPress/wordpress-org-meta-team , could you help with this? We need to update the Block Editor Handbook, removing the following components:
If possible, we'd also like to set a redirect for those pages being removed. The redirect should point to the Navigator
component.
Could you please help with that? Thank you 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I noticed the formatting on the new doc loses consistency around the
Navigator.Button
point (heading is not bold):
Good catch! Opened #65763 to fix it
I'm going to resume work on this PR after #64675 is merged. |
Sounds good. I was starting to review it, but I will halt it for now. I wonder if it's a good idea to approach this modularly and split whatever we can to separate PRs to keep this one smaller. |
85471a9
to
0f2d077
Compare
I rebased and addressed simple feedback. I would still wait before reviewing this PR. The current plan of action is:
I've also updated the tracking issue adding all of the planned follow-up step to this PR.
@tyxla , Even if the size of the PR is medium-large, I believe 99% of the changes left in this PR are simple renames — and in that sense I feel ok with the current size. Having said that, I'll re-assess once all dependency PRs are merged, before asking for a final round of review. |
That makes sense, @ciampo, will help with the review once all the dependencies are merged 👍 |
cea2b8e
to
999795a
Compare
* Remove experimental status from Storybook * NavigatorProvider => Navigator (internally) * Move legacy exports to separate file * Export overloaded notation * Use overloaded notation in Storybook * Use overloaded notation in unit tests (skipping deprecated component for now) * Update docs manifest.json * Navigator: update docs * Navigator.BackButton: update docs * NavigatorToParentButton: delete README * Navigator.Button: update docs * NavigatorScreen: update docs * Restore `NavigatorToParentButton` test * Use dot notation in context namespaces too * Use named export for `NavigatorToParentButton` too * Fixup docs manifest * Export stable version from components package * CHANGELOG * Change index.ts extension to tsx to allow Storybook to extract JSDocs better, remove duplicate JSDocs * Remove unnecessary and mispelled display name for top-level `Navigator` * Remove @example tag from top-level export * Clean up unused imports * Fix storybook styles * Update new section of the docs * Update more docs * Update deprecation warning * Update and align docs * Fix tests warning checks * Typo * Fix useContextSystem names * Remove mentions of the `useNavigator` hook * useNavigator JSDocs * Move all READMEs under the main README * Move README to component's root folder * Update types JSDocs to match README * Update docs manifest * Fix JSDocs typos, grammar, and broken links. * Update storybook selector --- Co-authored-by: ciampo <[email protected]> Co-authored-by: mirka <[email protected]> Co-authored-by: tyxla <[email protected]>
This reverts commit cedb4d4.
What?
Part of #59418
Supersedes #60927
Follow-up to #63317
Export the
Navigator
component, its subcomponents, and theuseNavigator
hook as stable APIs from the@wordpress/components
packageWhy?
This is part of a larger effort to remove
__experimental
prefix from all "experimental" components, effectively promoting them to regular stable components. See the related issue for more context.How?
__experimental
prefix, add new, unprefixed exports:NavigatorProvider
=>Navigator
NavigatorScreen
=>Navigator.Screen
NavigatorButton
=>Navigator.Button
NavigatorBackButton
=>Navigator.BackButton
NavigatorToParentButton
won't be exported since it's already deprecated in the experimental version of the component@wordpress/components
package)Next steps?
Testing Instructions
Navigator
;Navigator
usages across the editor;✍️ Dev note
The legacy set of
__experimentalNavigator*
APIs is deprecated and should instead be imported asNavigator
. All of the sub-components are also available via theNavigator
namespace.Moreover, the
__experimentalNavigatorToParentButton
component and thegoToParent
method available via the__experimentalUseNavigator
hook are now deprecated, and they now behave identically to the__experimentalNavigatorBackButton
and thegoBack
method.To recap:
__experimentalNavigatorProvider
=>Navigator
__experimentalNavigatorScreen
=>Navigator.Screen
__experimentalNavigatorButton
=>Navigator.Button
__experimentalNavigatorBackButton
=>Navigator.BackButton
__experimentalNavigatorToParentButton
=>Navigator.BackButton
__experimentalUseNavigator
=>useNavigator