Skip to content

Commit

Permalink
Restore @wordpress/nux to WP 6.2 branch (#52452)
Browse files Browse the repository at this point in the history
* Revert "Remove the nux package (#46110)"

This reverts commit 9ea80f6.

* Set peterwilsoncc as owner following revert.

* Use legacy fake timers for tests.

* Supress browserlist warning causing unit tests to fail.
  • Loading branch information
peterwilsoncc authored Jul 13, 2023
1 parent 843a305 commit b860b47
Show file tree
Hide file tree
Showing 33 changed files with 1,344 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
/packages/compose @ajitbohra
/packages/element @ajitbohra
/packages/notices @ajitbohra
/packages/nux @ajitbohra @peterwilsoncc
/packages/viewport @ajitbohra
/packages/base-styles
/packages/icons
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

env:
BROWSERSLIST_IGNORE_OLD_DATA: true

jobs:
e2e-puppeteer:
name: Puppeteer - ${{ matrix.part }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

env:
BROWSERSLIST_IGNORE_OLD_DATA: true

jobs:
performance:
name: Run performance tests
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}

env:
BROWSERSLIST_IGNORE_OLD_DATA: true

strategy:
fail-fast: false
matrix:
Expand Down
1 change: 1 addition & 0 deletions docs/contributors/code/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The editor includes a number of packages to enable various pieces of functionali
| [Is Shallow Equal](/packages/is-shallow-equal/README.md) | wp-is-shallow-equal | A function for performing a shallow comparison between two objects or arrays |
| [Keycodes](/packages/keycodes/README.md) | wp-keycodes | Keycodes utilities for WordPress, used to check the key pressed in events like `onKeyDown` |
| [List Reusable blocks](/packages/list-reusable-blocks/README.md) | wp-list-reusable-blocks | Package used to add import/export links to the listing page of the reusable blocks |
| [NUX](/packages/nux/README.md) | wp-nux | Components, and wp.data methods useful for onboarding a new user to the WordPress admin interface |
| [Plugins](/packages/plugins/README.md) | wp-plugins | Plugins module for WordPress |
| [Redux Routine](/packages/redux-routine/README.md) | wp-redux-routine | Redux middleware for generator coroutines |
| [Rich Text](/packages/rich-text/README.md) | wp-rich-text | Helper functions to convert HTML or a DOM tree into a rich text value and back |
Expand Down
12 changes: 12 additions & 0 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1727,6 +1727,12 @@
"markdown_source": "../packages/npm-package-json-lint-config/README.md",
"parent": "packages"
},
{
"title": "@wordpress/nux",
"slug": "packages-nux",
"markdown_source": "../packages/nux/README.md",
"parent": "packages"
},
{
"title": "@wordpress/plugins",
"slug": "packages-plugins",
Expand Down Expand Up @@ -1967,6 +1973,12 @@
"markdown_source": "../docs/reference-guides/data/data-core-notices.md",
"parent": "data"
},
{
"title": "The NUX (New User Experience) Data",
"slug": "data-core-nux",
"markdown_source": "../docs/reference-guides/data/data-core-nux.md",
"parent": "data"
},
{
"title": "Preferences",
"slug": "data-core-preferences",
Expand Down
1 change: 1 addition & 0 deletions docs/reference-guides/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
- [**core/editor**: The Post Editor’s Data](/docs/reference-guides/data/data-core-editor.md)
- [**core/keyboard-shortcuts**: The Keyboard Shortcuts Data](/docs/reference-guides/data/data-core-keyboard-shortcuts.md)
- [**core/notices**: Notices Data](/docs/reference-guides/data/data-core-notices.md)
- [**core/nux**: The NUX (New User Experience) Data](/docs/reference-guides/data/data-core-nux.md)
- [**core/preferences**: Preferences](/docs/reference-guides/data/data-core-preferences.md)
- [**core/reusable-blocks**: Reusable blocks](/docs/reference-guides/data/data-core-reusable-blocks.md)
- [**core/rich-text**: Rich Text](/docs/reference-guides/data/data-core-rich-text.md)
Expand Down
1 change: 1 addition & 0 deletions docs/reference-guides/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [**core/editor**: The Post Editor’s Data](/docs/reference-guides/data/data-core-editor.md)
- [**core/keyboard-shortcuts**: The Keyboard Shortcuts Data](/docs/reference-guides/data/data-core-keyboard-shortcuts.md)
- [**core/notices**: Notices Data](/docs/reference-guides/data/data-core-notices.md)
- [**core/nux**: The NUX (New User Experience) Data](/docs/reference-guides/data/data-core-nux.md)
- [**core/preferences**: Preferences](/docs/reference-guides/data/data-core-preferences.md)
- [**core/reusable-blocks**: Reusable blocks](/docs/reference-guides/data/data-core-reusable-blocks.md)
- [**core/rich-text**: Rich Text](/docs/reference-guides/data/data-core-rich-text.md)
Expand Down
99 changes: 99 additions & 0 deletions docs/reference-guides/data/data-core-nux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# The NUX (New User Experience) Data

Namespace: `core/nux`.

## Selectors

<!-- START TOKEN(Autogenerated selectors|../../../packages/nux/src/store/selectors.js) -->

### areTipsEnabled

Returns whether or not tips are globally enabled.

_Parameters_

- _state_ `Object`: Global application state.

_Returns_

- `boolean`: Whether tips are globally enabled.

### getAssociatedGuide

Returns an object describing the guide, if any, that the given tip is a part
of.

_Parameters_

- _state_ `Object`: Global application state.
- _tipId_ `string`: The tip to query.

_Returns_

- `?NUXGuideInfo`: Information about the associated guide.

### isTipVisible

Determines whether or not the given tip is showing. Tips are hidden if they
are disabled, have been dismissed, or are not the current tip in any
guide that they have been added to.

_Parameters_

- _state_ `Object`: Global application state.
- _tipId_ `string`: The tip to query.

_Returns_

- `boolean`: Whether or not the given tip is showing.

<!-- END TOKEN(Autogenerated selectors|../../../packages/nux/src/store/selectors.js) -->

## Actions

<!-- START TOKEN(Autogenerated actions|../../../packages/nux/src/store/actions.js) -->

### disableTips

Returns an action object that, when dispatched, prevents all tips from
showing again.

_Returns_

- `Object`: Action object.

### dismissTip

Returns an action object that, when dispatched, dismisses the given tip. A
dismissed tip will not show again.

_Parameters_

- _id_ `string`: The tip to dismiss.

_Returns_

- `Object`: Action object.

### enableTips

Returns an action object that, when dispatched, makes all tips show again.

_Returns_

- `Object`: Action object.

### triggerGuide

Returns an action object that, when dispatched, presents a guide that takes
the user through a series of tips step by step.

_Parameters_

- _tipIds_ `string[]`: Which tips to show in the guide.

_Returns_

- `Object`: Action object.

<!-- END TOKEN(Autogenerated actions|../../../packages/nux/src/store/actions.js) -->
1 change: 1 addition & 0 deletions docs/toc.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
"docs/reference-guides/data/data-core-keyboard-shortcuts.md": []
},
{ "docs/reference-guides/data/data-core-notices.md": [] },
{ "docs/reference-guides/data/data-core-nux.md": [] },
{
"docs/reference-guides/data/data-core-preferences.md": []
},
Expand Down
13 changes: 11 additions & 2 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function gutenberg_register_packages_styles( $styles ) {
$styles,
'wp-editor',
gutenberg_url( 'build/editor/style.css' ),
array( 'wp-components', 'wp-block-editor', 'wp-reusable-blocks' ),
array( 'wp-components', 'wp-block-editor', 'wp-nux', 'wp-reusable-blocks' ),
$version
);
$styles->add_data( 'wp-editor', 'rtl', 'replace' );
Expand All @@ -283,7 +283,7 @@ function gutenberg_register_packages_styles( $styles ) {
$styles,
'wp-edit-post',
gutenberg_url( 'build/edit-post/style.css' ),
array( 'wp-components', 'wp-block-editor', 'wp-editor', 'wp-edit-blocks', 'wp-block-library' ),
array( 'wp-components', 'wp-block-editor', 'wp-editor', 'wp-edit-blocks', 'wp-block-library', 'wp-nux' ),
$version
);
$styles->add_data( 'wp-edit-post', 'rtl', 'replace' );
Expand Down Expand Up @@ -367,6 +367,15 @@ function gutenberg_register_packages_styles( $styles ) {
);
$styles->add_data( 'wp-edit-blocks', 'rtl', 'replace' );

gutenberg_override_style(
$styles,
'wp-nux',
gutenberg_url( 'build/nux/style.css' ),
array( 'wp-components' ),
$version
);
$styles->add_data( 'wp-nux', 'rtl', 'replace' );

gutenberg_override_style(
$styles,
'wp-block-library-theme',
Expand Down
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@wordpress/list-reusable-blocks": "file:packages/list-reusable-blocks",
"@wordpress/media-utils": "file:packages/media-utils",
"@wordpress/notices": "file:packages/notices",
"@wordpress/nux": "file:packages/nux",
"@wordpress/plugins": "file:packages/plugins",
"@wordpress/preferences": "file:packages/preferences",
"@wordpress/preferences-persistence": "file:packages/preferences-persistence",
Expand Down
5 changes: 4 additions & 1 deletion packages/base-styles/_z-index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ $z-layers: (
// The focus styles of the region navigation containers should be above their content.
".is-focusing-regions {region} :focus::after": 1000000,

// Show tooltips above wp-admin menus, submenus, and sidebar:
// Show NUX tips above popovers, wp-admin menus, submenus, and sidebar:
".nux-dot-tip": 1000001,

// Show tooltips above NUX tips, wp-admin menus, submenus, and sidebar:
".components-tooltip": 1000002,

// Keep template popover underneath 'Create custom template' modal overlay.
Expand Down
1 change: 1 addition & 0 deletions packages/nux/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
124 changes: 124 additions & 0 deletions packages/nux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->

## Unreleased

### Breaking Changes

- Updated dependencies to require React 18 ([45235](https://github.com/WordPress/gutenberg/pull/45235))

## 5.20.0 (2022-11-16)

## 5.19.0 (2022-11-02)

## 5.18.0 (2022-10-19)

## 5.17.0 (2022-10-05)

## 5.16.0 (2022-09-21)

## 5.15.0 (2022-09-13)

## 5.14.0 (2022-08-24)

## 5.13.0 (2022-08-10)

## 5.12.0 (2022-07-27)

## 5.11.0 (2022-07-13)

## 5.10.0 (2022-06-29)

## 5.9.0 (2022-06-15)

## 5.8.0 (2022-06-01)

## 5.7.0 (2022-05-18)

## 5.6.0 (2022-05-04)

## 5.5.0 (2022-04-21)

## 5.4.0 (2022-04-08)

## 5.3.0 (2022-03-23)

## 5.2.0 (2022-03-11)

## 5.1.0 (2022-01-27)

## 5.0.0 (2021-07-29)

### Breaking Change

- Upgraded React components to work with v17.0 ([#29118](https://github.com/WordPress/gutenberg/pull/29118)). There are no new features in React v17.0 as explained in the [blog post](https://reactjs.org/blog/2020/10/20/react-v17.html).

## 4.2.0 (2021-07-21)

## 4.1.0 (2021-05-20)

## 4.0.0 (2021-05-14)

### Breaking Changes

- Drop support for Internet Explorer 11 ([#31110](https://github.com/WordPress/gutenberg/pull/31110)). Learn more at https://make.wordpress.org/core/2021/04/22/ie-11-support-phase-out-plan/.
- Increase the minimum Node.js version to v12 matching Long Term Support releases ([#31270](https://github.com/WordPress/gutenberg/pull/31270)). Learn more at https://nodejs.org/en/about/releases/.

## 3.25.0 (2021-03-17)

## 3.24.0 (2020-12-17)

### New Feature

- Added a store definition `store` for the core data namespace to use with `@wordpress/data` API ([#26655](https://github.com/WordPress/gutenberg/pull/26655)).

# 3.1.0 (2019-06-03)

- The `@wordpress/nux` package has been deprecated. Please use the `Guide` component in `@wordpress/components` to show a user guide.

## 3.0.6 (2019-01-03)

## 3.0.5 (2018-12-12)

## 3.0.4 (2018-11-30)

## 3.0.3 (2018-11-22)

## 3.0.2 (2018-11-21)

## 3.0.1 (2018-11-20)

## 3.0.0 (2018-11-15)

### Breaking Changes

- The id prop of DotTip has been removed. Please use the tipId prop instead.

## 2.0.13 (2018-11-12)

## 2.0.12 (2018-11-12)

## 2.0.11 (2018-11-09)

## 2.0.10 (2018-11-09)

## 2.0.9 (2018-11-03)

## 2.0.8 (2018-10-30)

## 2.0.7 (2018-10-29)

### Deprecations

- The id prop of DotTip has been deprecated. Please use the tipId prop instead.

## 2.0.6 (2018-10-22)

## 2.0.5 (2018-10-19)

## 2.0.4 (2018-10-18)

## 2.0.0 (2018-09-05)

### Breaking Change

- Change how required built-ins are polyfilled with Babel 7 ([#9171](https://github.com/WordPress/gutenberg/pull/9171)). If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using [core-js](https://github.com/zloirock/core-js) or [@babel/polyfill](https://babeljs.io/docs/en/next/babel-polyfill) will add support for these methods.
Loading

1 comment on commit b860b47

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in b860b47.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5538764413
📝 Reported issues:

Please sign in to comment.