Skip to content

Commit f7a7e6b

Browse files
authored
Packages: Extract @wordpress/nux package (#8016)
* Packages: Extract `@wordpress/nux` package * Docs: Regenerate docs after moving nux to packages * Build: Add Eslint rule for NUX package * NUX: Fix build handling for CSS files
1 parent a0724b7 commit f7a7e6b

File tree

24 files changed

+86
-31
lines changed

24 files changed

+86
-31
lines changed

.eslintrc.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ module.exports = {
8888
selector: 'ImportDeclaration[source.value=/^keycodes(\\u002F|$)/]',
8989
message: 'Use @wordpress/keycodes as import path instead.',
9090
},
91+
{
92+
selector: 'ImportDeclaration[source.value=/^nux(\\u002F|$)/]',
93+
message: 'Use @wordpress/nux as import path instead.',
94+
},
9195
{
9296
selector: 'ImportDeclaration[source.value=/^utils(\\u002F|$)/]',
9397
message: 'Use @wordpress/utils as import path instead.',
@@ -112,10 +116,6 @@ module.exports = {
112116
"selector": "ImportDeclaration[source.value=/^core-blocks$/]",
113117
"message": "Use @wordpress/core-blocks as import path instead."
114118
},
115-
{
116-
"selector": "ImportDeclaration[source.value=/^nux$/]",
117-
"message": "Use @wordpress/nux as import path instead."
118-
},
119119
{
120120
selector: 'CallExpression[callee.name="deprecated"] Property[key.name="version"][value.value=/' + majorMinorRegExp + '/]',
121121
message: 'Deprecated functions must be removed before releasing this version.',

docs/manifest.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@
222222
"parent": "packages"
223223
},
224224
{
225-
"title": "@wordpress/api-request",
226-
"slug": "packages-api-request",
227-
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/api-request/README.md",
225+
"title": "@wordpress/api-fetch",
226+
"slug": "packages-api-fetch",
227+
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/api-fetch/README.md",
228228
"parent": "packages"
229229
},
230230
{
@@ -377,6 +377,12 @@
377377
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/npm-package-json-lint-config/README.md",
378378
"parent": "packages"
379379
},
380+
{
381+
"title": "@wordpress/nux",
382+
"slug": "packages-nux",
383+
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/nux/README.md",
384+
"parent": "packages"
385+
},
380386
{
381387
"title": "@wordpress/plugins",
382388
"slug": "packages-plugins",
@@ -443,12 +449,6 @@
443449
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/editor/README.md",
444450
"parent": "packages"
445451
},
446-
{
447-
"title": "@wordpress/nux",
448-
"slug": "packages-nux",
449-
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/nux/README.md",
450-
"parent": "packages"
451-
},
452452
{
453453
"title": "Data Package Reference",
454454
"slug": "data",

docs/tool/config.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const gutenbergPackages = [
1717
'core-blocks',
1818
'edit-post',
1919
'editor',
20-
'nux',
2120
];
2221

2322
module.exports = {
@@ -45,8 +44,8 @@ module.exports = {
4544
},
4645
'core/nux': {
4746
title: 'The NUX (New User Experience) Data',
48-
selectors: [ path.resolve( root, 'nux/store/selectors.js' ) ],
49-
actions: [ path.resolve( root, 'nux/store/actions.js' ) ],
47+
selectors: [ path.resolve( root, 'packages/nux/src/store/selectors.js' ) ],
48+
actions: [ path.resolve( root, 'packages/nux/src/store/actions.js' ) ],
5049
},
5150
'core/viewport': {
5251
title: 'The Viewport Data',

nux/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/**
2-
* Internal dependencies
3-
*/
4-
import './store';
1+
export * from '../packages/nux/src';
52

6-
export { default as DotTip } from './components/dot-tip';
3+
import '../packages/nux/src/style.scss';

package-lock.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@wordpress/i18n": "file:packages/i18n",
3535
"@wordpress/is-shallow-equal": "file:packages/is-shallow-equal",
3636
"@wordpress/keycodes": "file:packages/keycodes",
37+
"@wordpress/nux": "file:packages/nux",
3738
"@wordpress/plugins": "file:packages/plugins",
3839
"@wordpress/shortcode": "file:packages/shortcode",
3940
"@wordpress/url": "file:packages/url",

packages/nux/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

nux/README.md renamed to packages/nux/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
NUX (New User eXperience)
2-
=========================
1+
# @wordpress/nux
32

4-
The NUX module exposes components, and `wp.data` methods useful for onboarding a new user to the WordPress admin interface. Specifically, it exposes _tips_ and _guides_.
3+
The NUX (New User eXperience) module exposes components, and `wp.data` methods useful for onboarding a new user to the WordPress admin interface. Specifically, it exposes _tips_ and _guides_.
54

65
A _tip_ is a component that points to an element in the UI and contains text that explains the element's functionality. The user can dismiss a tip, in which case it never shows again. The user can also disable tips entirely. Information about tips is persisted between sessions using `localStorage`.
76

87
A _guide_ allows a series of of tips to be presented to the user one by one. When a user dismisses a tip that is in a guide, the next tip in the guide is shown.
98

9+
## Installation
10+
11+
Install the module
12+
13+
```bash
14+
npm install @wordpress/nux --save
15+
```
16+
1017
## DotTip
1118

1219
`DotTip` is a React component that renders a single _tip_ on the screen. The tip will point to the React element that `DotTip` is nested within. Each tip is uniquely identified by a string passed to `id`.

packages/nux/package.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "@wordpress/nux",
3+
"version": "1.0.0-alpha.0",
4+
"description": "NUX (New User eXperience) module for WordPress",
5+
"author": "The WordPress Contributors",
6+
"license": "GPL-2.0-or-later",
7+
"keywords": [
8+
"wordpress",
9+
"nux"
10+
],
11+
"homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/nux/README.md",
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/WordPress/gutenberg.git"
15+
},
16+
"bugs": {
17+
"url": "https://github.com/WordPress/gutenberg/issues"
18+
},
19+
"main": "build/index.js",
20+
"module": "build-module/index.js",
21+
"dependencies": {
22+
"@wordpress/components": "file:../components",
23+
"@wordpress/compose": "file:../compose",
24+
"@wordpress/data": "file:../data",
25+
"@wordpress/element": "file:../element",
26+
"@wordpress/i18n": "file:../i18n",
27+
"lodash": "^4.17.10",
28+
"rememo": "^3.0.0"
29+
},
30+
"devDependencies": {
31+
"enzyme": "^3.3.0"
32+
},
33+
"publishConfig": {
34+
"access": "public"
35+
}
36+
}
File renamed without changes.

0 commit comments

Comments
 (0)