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

Packages: Extract @wordpress/nux package #8016

Merged
merged 4 commits into from
Jul 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ module.exports = {
selector: 'ImportDeclaration[source.value=/^keycodes(\\u002F|$)/]',
message: 'Use @wordpress/keycodes as import path instead.',
},
{
selector: 'ImportDeclaration[source.value=/^nux(\\u002F|$)/]',
message: 'Use @wordpress/nux as import path instead.',
},
{
selector: 'ImportDeclaration[source.value=/^utils(\\u002F|$)/]',
message: 'Use @wordpress/utils as import path instead.',
Expand All @@ -112,10 +116,6 @@ module.exports = {
"selector": "ImportDeclaration[source.value=/^core-blocks$/]",
"message": "Use @wordpress/core-blocks as import path instead."
},
{
"selector": "ImportDeclaration[source.value=/^nux$/]",
"message": "Use @wordpress/nux as import path instead."
},
{
selector: 'CallExpression[callee.name="deprecated"] Property[key.name="version"][value.value=/' + majorMinorRegExp + '/]',
message: 'Deprecated functions must be removed before releasing this version.',
Expand Down
18 changes: 9 additions & 9 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@
"parent": "packages"
},
{
"title": "@wordpress/api-request",
"slug": "packages-api-request",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/api-request/README.md",
"title": "@wordpress/api-fetch",
"slug": "packages-api-fetch",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/api-fetch/README.md",
"parent": "packages"
},
{
Expand Down Expand Up @@ -377,6 +377,12 @@
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/npm-package-json-lint-config/README.md",
"parent": "packages"
},
{
"title": "@wordpress/nux",
"slug": "packages-nux",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/nux/README.md",
"parent": "packages"
},
{
"title": "@wordpress/plugins",
"slug": "packages-plugins",
Expand Down Expand Up @@ -443,12 +449,6 @@
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/editor/README.md",
"parent": "packages"
},
{
"title": "@wordpress/nux",
"slug": "packages-nux",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/nux/README.md",
"parent": "packages"
},
{
"title": "Data Package Reference",
"slug": "data",
Expand Down
5 changes: 2 additions & 3 deletions docs/tool/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const gutenbergPackages = [
'core-blocks',
'edit-post',
'editor',
'nux',
];

module.exports = {
Expand Down Expand Up @@ -45,8 +44,8 @@ module.exports = {
},
'core/nux': {
title: 'The NUX (New User Experience) Data',
selectors: [ path.resolve( root, 'nux/store/selectors.js' ) ],
actions: [ path.resolve( root, 'nux/store/actions.js' ) ],
selectors: [ path.resolve( root, 'packages/nux/src/store/selectors.js' ) ],
actions: [ path.resolve( root, 'packages/nux/src/store/actions.js' ) ],
},
'core/viewport': {
title: 'The Viewport Data',
Expand Down
7 changes: 2 additions & 5 deletions nux/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* Internal dependencies
*/
import './store';
export * from '../packages/nux/src';

export { default as DotTip } from './components/dot-tip';
import '../packages/nux/src/style.scss';
12 changes: 12 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 @@ -34,6 +34,7 @@
"@wordpress/i18n": "file:packages/i18n",
"@wordpress/is-shallow-equal": "file:packages/is-shallow-equal",
"@wordpress/keycodes": "file:packages/keycodes",
"@wordpress/nux": "file:packages/nux",
"@wordpress/plugins": "file:packages/plugins",
"@wordpress/shortcode": "file:packages/shortcode",
"@wordpress/url": "file:packages/url",
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
13 changes: 10 additions & 3 deletions nux/README.md → packages/nux/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
NUX (New User eXperience)
=========================
# @wordpress/nux

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_.
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_.
Copy link
Member

Choose a reason for hiding this comment

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

❤️


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`.

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.

## Installation

Install the module

```bash
npm install @wordpress/nux --save
```

## DotTip

`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`.
Expand Down
36 changes: 36 additions & 0 deletions packages/nux/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "@wordpress/nux",
"version": "1.0.0-alpha.0",
"description": "NUX (New User eXperience) module for WordPress",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
"keywords": [
"wordpress",
"nux"
],
"homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/nux/README.md",
"repository": {
"type": "git",
"url": "https://github.com/WordPress/gutenberg.git"
},
"bugs": {
"url": "https://github.com/WordPress/gutenberg/issues"
},
"main": "build/index.js",
"module": "build-module/index.js",
"dependencies": {
"@wordpress/components": "file:../components",
"@wordpress/compose": "file:../compose",
"@wordpress/data": "file:../data",
"@wordpress/element": "file:../element",
"@wordpress/i18n": "file:../i18n",
"lodash": "^4.17.10",
"rememo": "^3.0.0"
},
"devDependencies": {
"enzyme": "^3.3.0"
},
"publishConfig": {
"access": "public"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import { Popover, Button, IconButton } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { withSelect, withDispatch } from '@wordpress/data';

/**
* Internal dependencies
*/
import './style.scss';

export function DotTip( {
children,
isVisible,
Expand Down
6 changes: 6 additions & 0 deletions packages/nux/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* Internal dependencies
*/
import './store';

export { default as DotTip } from './components/dot-tip';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/nux/src/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './components/dot-tip/style.scss';
4 changes: 2 additions & 2 deletions test/unit/jest.config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"rootDir": "../../",
"collectCoverageFrom": [
"(blocks|components|editor|utils|edit-post|core-blocks|nux)/**/*.js",
"(blocks|components|editor|utils|edit-post|core-blocks)/**/*.js",
"packages/**/*.js"
],
"coveragePathIgnorePatterns": [
Expand All @@ -11,7 +11,7 @@
"<rootDir>/packages/.*/benchmark/"
],
"moduleNameMapper": {
"@wordpress\\/(blocks|components|editor|utils|edit-post|core-blocks|nux)$": "$1",
"@wordpress\\/(blocks|components|editor|utils|edit-post|core-blocks)$": "$1",
"@wordpress\\/(a-z0-9-)$": "packages/$1/src"
},
"preset": "@wordpress/jest-preset-default",
Expand Down