@wordpress/nux 9.47.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +2 -103
- package/build/components/dot-tip/index.cjs +3 -90
- package/build/components/dot-tip/index.cjs.map +3 -3
- package/build/store/actions.cjs.map +2 -2
- package/build/store/reducer.cjs +8 -38
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +7 -32
- package/build/store/selectors.cjs.map +2 -2
- package/build-module/components/dot-tip/index.mjs +3 -90
- package/build-module/components/dot-tip/index.mjs.map +2 -2
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/reducer.mjs +8 -32
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +7 -32
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-style/style-rtl.css +3 -185
- package/build-style/style.css +3 -189
- package/package.json +12 -14
- package/src/components/dot-tip/README.md +2 -34
- package/src/components/dot-tip/index.js +6 -94
- package/src/components/dot-tip/test/index.js +10 -67
- package/src/store/actions.js +10 -9
- package/src/store/reducer.js +13 -61
- package/src/store/selectors.js +11 -57
- package/src/store/test/reducer.js +20 -60
- package/src/store/test/selectors.js +6 -131
- package/src/style.scss +4 -1
- package/src/components/dot-tip/style.scss +0 -131
- package/src/components/dot-tip/test/__snapshots__/index.js.snap +0 -48
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 10.0.0 (2026-06-10)
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
- Turn `@wordpress/nux` into a deprecated no-op compatibility package. `DotTip` renders nothing, selectors return empty disabled values, and actions no longer have runtime effects ([#77773](https://github.com/WordPress/gutenberg/pull/77773)).
|
|
10
|
+
|
|
5
11
|
## 9.47.0 (2026-05-27)
|
|
6
12
|
|
|
7
13
|
## 9.46.0 (2026-05-14)
|
package/README.md
CHANGED
|
@@ -1,109 +1,8 @@
|
|
|
1
1
|
# New User eXperience (NUX)
|
|
2
2
|
|
|
3
|
-
The NUX module
|
|
3
|
+
The NUX module is deprecated. It remains available as a no-op compatibility package so existing imports, script handles, and `core/nux` data-store access do not crash.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
A _guide_ allows a series 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.
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
Install the module
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install @wordpress/nux --save
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
_This package assumes that your code will run in an **ES2015+** environment. If you're using an environment that has limited or no support for such language features and APIs, you should include [the polyfill shipped in `@wordpress/babel-preset-default`](https://github.com/WordPress/gutenberg/tree/HEAD/packages/babel-preset-default#polyfill) in your code._
|
|
18
|
-
|
|
19
|
-
## DotTip
|
|
20
|
-
|
|
21
|
-
`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 `tipId`.
|
|
22
|
-
|
|
23
|
-
See [the component's README][dot-tip-readme] for more information.
|
|
24
|
-
|
|
25
|
-
[dot-tip-readme]: https://github.com/WordPress/gutenberg/tree/HEAD/packages/nux/src/components/dot-tip/README.md
|
|
26
|
-
|
|
27
|
-
```jsx
|
|
28
|
-
<button onClick={ ... }>
|
|
29
|
-
Add to Cart
|
|
30
|
-
<DotTip tipId="acme/add-to-cart">
|
|
31
|
-
Click here to add the product to your shopping cart.
|
|
32
|
-
</DotTip>
|
|
33
|
-
</button>
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Determining if a tip is visible
|
|
38
|
-
|
|
39
|
-
You can programmatically determine if a tip is visible using the `isTipVisible` select method.
|
|
40
|
-
|
|
41
|
-
```jsx
|
|
42
|
-
const isVisible = select( 'core/nux' ).isTipVisible( 'acme/add-to-cart' );
|
|
43
|
-
console.log( isVisible ); // true or false
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Manually dismissing a tip
|
|
47
|
-
|
|
48
|
-
`dismissTip` is a dispatch method that allows you to programmatically dismiss a tip.
|
|
49
|
-
|
|
50
|
-
```jsx
|
|
51
|
-
<button
|
|
52
|
-
onClick={ () => {
|
|
53
|
-
dispatch( 'core/nux' ).dismissTip( 'acme/add-to-cart' );
|
|
54
|
-
} }
|
|
55
|
-
>
|
|
56
|
-
Dismiss tip
|
|
57
|
-
</button>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Disabling and enabling tips
|
|
61
|
-
|
|
62
|
-
Tips can be programmatically disabled or enabled using the `disableTips` and `enableTips` dispatch methods. You can query the current setting by using the `areTipsEnabled` select method.
|
|
63
|
-
|
|
64
|
-
Calling `enableTips` will also un-dismiss all previously dismissed tips.
|
|
65
|
-
|
|
66
|
-
```jsx
|
|
67
|
-
const areTipsEnabled = select( 'core/nux' ).areTipsEnabled();
|
|
68
|
-
return (
|
|
69
|
-
<button
|
|
70
|
-
onClick={ () => {
|
|
71
|
-
if ( areTipsEnabled ) {
|
|
72
|
-
dispatch( 'core/nux' ).disableTips();
|
|
73
|
-
} else {
|
|
74
|
-
dispatch( 'core/nux' ).enableTips();
|
|
75
|
-
}
|
|
76
|
-
} }
|
|
77
|
-
>
|
|
78
|
-
{ areTipsEnabled ? 'Disable tips' : 'Enable tips' }
|
|
79
|
-
</button>
|
|
80
|
-
);
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Triggering a guide
|
|
84
|
-
|
|
85
|
-
You can group a series of tips into a guide by calling the `triggerGuide` dispatch method. The given tips will then appear one by one.
|
|
86
|
-
|
|
87
|
-
A tip cannot be added to more than one guide.
|
|
88
|
-
|
|
89
|
-
```jsx
|
|
90
|
-
dispatch( 'core/nux' ).triggerGuide( [
|
|
91
|
-
'acme/product-info',
|
|
92
|
-
'acme/add-to-cart',
|
|
93
|
-
'acme/checkout',
|
|
94
|
-
] );
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Getting information about a guide
|
|
98
|
-
|
|
99
|
-
`getAssociatedGuide` is a select method that returns useful information about the state of the guide that a tip is associated with.
|
|
100
|
-
|
|
101
|
-
```jsx
|
|
102
|
-
const guide = select( 'core/nux' ).getAssociatedGuide( 'acme/add-to-cart' );
|
|
103
|
-
console.log( 'Tips in this guide:', guide.tipIds );
|
|
104
|
-
console.log( 'Currently showing:', guide.currentTipId );
|
|
105
|
-
console.log( 'Next to show:', guide.nextTipId );
|
|
106
|
-
```
|
|
5
|
+
New code should use `Guide` from `@wordpress/components` to show user guides.
|
|
107
6
|
|
|
108
7
|
## Contributing to this package
|
|
109
8
|
|
|
@@ -23,97 +23,10 @@ __export(dot_tip_exports, {
|
|
|
23
23
|
default: () => dot_tip_default
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(dot_tip_exports);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var import_i18n = require("@wordpress/i18n");
|
|
29
|
-
var import_data = require("@wordpress/data");
|
|
30
|
-
var import_element = require("@wordpress/element");
|
|
31
|
-
var import_icons = require("@wordpress/icons");
|
|
32
|
-
var import_store = require("../../store/index.cjs");
|
|
33
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
-
function onClick(event) {
|
|
35
|
-
event.stopPropagation();
|
|
26
|
+
function DotTip() {
|
|
27
|
+
return null;
|
|
36
28
|
}
|
|
37
|
-
|
|
38
|
-
position = "middle right",
|
|
39
|
-
children,
|
|
40
|
-
isVisible,
|
|
41
|
-
hasNextTip,
|
|
42
|
-
onDismiss,
|
|
43
|
-
onDisable
|
|
44
|
-
}) {
|
|
45
|
-
const anchorParent = (0, import_element.useRef)(null);
|
|
46
|
-
const onFocusOutsideCallback = (0, import_element.useCallback)(
|
|
47
|
-
(event) => {
|
|
48
|
-
if (!anchorParent.current) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (anchorParent.current.contains(event.relatedTarget)) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
onDisable();
|
|
55
|
-
},
|
|
56
|
-
[onDisable, anchorParent]
|
|
57
|
-
);
|
|
58
|
-
if (!isVisible) {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
62
|
-
import_components.Popover,
|
|
63
|
-
{
|
|
64
|
-
className: "nux-dot-tip",
|
|
65
|
-
position,
|
|
66
|
-
focusOnMount: true,
|
|
67
|
-
role: "dialog",
|
|
68
|
-
"aria-label": (0, import_i18n.__)("Editor tips"),
|
|
69
|
-
onClick,
|
|
70
|
-
onFocusOutside: onFocusOutsideCallback,
|
|
71
|
-
children: [
|
|
72
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children }),
|
|
73
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
|
-
import_components.Button,
|
|
75
|
-
{
|
|
76
|
-
__next40pxDefaultSize: true,
|
|
77
|
-
variant: "link",
|
|
78
|
-
onClick: onDismiss,
|
|
79
|
-
children: hasNextTip ? (0, import_i18n.__)("See next tip") : (0, import_i18n.__)("Got it")
|
|
80
|
-
}
|
|
81
|
-
) }),
|
|
82
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
83
|
-
import_components.Button,
|
|
84
|
-
{
|
|
85
|
-
size: "small",
|
|
86
|
-
className: "nux-dot-tip__disable",
|
|
87
|
-
icon: import_icons.close,
|
|
88
|
-
label: (0, import_i18n.__)("Disable tips"),
|
|
89
|
-
onClick: onDisable
|
|
90
|
-
}
|
|
91
|
-
)
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
var dot_tip_default = (0, import_compose.compose)(
|
|
97
|
-
(0, import_data.withSelect)((select, { tipId }) => {
|
|
98
|
-
const { isTipVisible, getAssociatedGuide } = select(import_store.store);
|
|
99
|
-
const associatedGuide = getAssociatedGuide(tipId);
|
|
100
|
-
return {
|
|
101
|
-
isVisible: isTipVisible(tipId),
|
|
102
|
-
hasNextTip: !!(associatedGuide && associatedGuide.nextTipId)
|
|
103
|
-
};
|
|
104
|
-
}),
|
|
105
|
-
(0, import_data.withDispatch)((dispatch, { tipId }) => {
|
|
106
|
-
const { dismissTip, disableTips } = dispatch(import_store.store);
|
|
107
|
-
return {
|
|
108
|
-
onDismiss() {
|
|
109
|
-
dismissTip(tipId);
|
|
110
|
-
},
|
|
111
|
-
onDisable() {
|
|
112
|
-
disableTips();
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
})
|
|
116
|
-
)(DotTip);
|
|
29
|
+
var dot_tip_default = DotTip;
|
|
117
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
118
31
|
0 && (module.exports = {
|
|
119
32
|
DotTip
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dot-tip/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["/**\n * Deprecated no-op DotTip component.\n *\n * @return {null} Nothing.\n */\nexport function DotTip() {\n\treturn null;\n}\n\nexport default DotTip;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,SAAS,SAAS;AACxB,SAAO;AACR;AAEA,IAAO,kBAAQ;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/actions.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Returns
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,SAAS,aAAc,QAAS;AACtC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAUO,SAAS,WAAY,IAAK;AAChC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAQO,SAAS,cAAc;AAC7B,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;
|
|
4
|
+
"sourcesContent": ["/**\n * Returns a no-op action object. This package is deprecated and no longer\n * displays tips, but the action remains for backward compatibility.\n *\n * @param {string[]} tipIds Which tips would have been shown in the guide.\n *\n * @return {Object} Action object.\n */\nexport function triggerGuide( tipIds ) {\n\treturn {\n\t\ttype: 'TRIGGER_GUIDE',\n\t\ttipIds,\n\t};\n}\n\n/**\n * Returns a no-op action object. This package is deprecated and no longer\n * displays tips, but the action remains for backward compatibility.\n *\n * @param {string} id The tip that would have been dismissed.\n *\n * @return {Object} Action object.\n */\nexport function dismissTip( id ) {\n\treturn {\n\t\ttype: 'DISMISS_TIP',\n\t\tid,\n\t};\n}\n\n/**\n * Returns a no-op action object. This package is deprecated and no longer\n * displays tips, but the action remains for backward compatibility.\n *\n * @return {Object} Action object.\n */\nexport function disableTips() {\n\treturn {\n\t\ttype: 'DISABLE_TIPS',\n\t};\n}\n\n/**\n * Returns a no-op action object. This package is deprecated and no longer\n * displays tips, but the action remains for backward compatibility.\n *\n * @return {Object} Action object.\n */\nexport function enableTips() {\n\treturn {\n\t\ttype: 'ENABLE_TIPS',\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,SAAS,aAAc,QAAS;AACtC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAUO,SAAS,WAAY,IAAK;AAChC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAQO,SAAS,cAAc;AAC7B,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;AAQO,SAAS,aAAa;AAC5B,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/store/reducer.cjs
CHANGED
|
@@ -19,47 +19,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// packages/nux/src/store/reducer.js
|
|
20
20
|
var reducer_exports = {};
|
|
21
21
|
__export(reducer_exports, {
|
|
22
|
-
|
|
23
|
-
default: () => reducer_default,
|
|
24
|
-
dismissedTips: () => dismissedTips,
|
|
25
|
-
guides: () => guides
|
|
22
|
+
default: () => reducer
|
|
26
23
|
});
|
|
27
24
|
module.exports = __toCommonJS(reducer_exports);
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
return state;
|
|
35
|
-
}
|
|
36
|
-
function areTipsEnabled(state = true, action) {
|
|
37
|
-
switch (action.type) {
|
|
38
|
-
case "DISABLE_TIPS":
|
|
39
|
-
return false;
|
|
40
|
-
case "ENABLE_TIPS":
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
return state;
|
|
44
|
-
}
|
|
45
|
-
function dismissedTips(state = {}, action) {
|
|
46
|
-
switch (action.type) {
|
|
47
|
-
case "DISMISS_TIP":
|
|
48
|
-
return {
|
|
49
|
-
...state,
|
|
50
|
-
[action.id]: true
|
|
51
|
-
};
|
|
52
|
-
case "ENABLE_TIPS":
|
|
53
|
-
return {};
|
|
25
|
+
var DEFAULT_STATE = {
|
|
26
|
+
guides: [],
|
|
27
|
+
preferences: {
|
|
28
|
+
areTipsEnabled: false,
|
|
29
|
+
dismissedTips: {}
|
|
54
30
|
}
|
|
31
|
+
};
|
|
32
|
+
function reducer(state = DEFAULT_STATE) {
|
|
55
33
|
return state;
|
|
56
34
|
}
|
|
57
|
-
var preferences = (0, import_data.combineReducers)({ areTipsEnabled, dismissedTips });
|
|
58
|
-
var reducer_default = (0, import_data.combineReducers)({ guides, preferences });
|
|
59
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
-
0 && (module.exports = {
|
|
61
|
-
areTipsEnabled,
|
|
62
|
-
dismissedTips,
|
|
63
|
-
guides
|
|
64
|
-
});
|
|
65
35
|
//# sourceMappingURL=reducer.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/reducer.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * Deprecated NUX store state kept only so the core/nux store can still be\n * registered for backward compatibility.\n */\nconst DEFAULT_STATE = {\n\tguides: [],\n\tpreferences: {\n\t\tareTipsEnabled: false,\n\t\tdismissedTips: {},\n\t},\n};\n\n/**\n * Reducer that preserves state without responding to actions.\n *\n * @param {Object} state Current state.\n *\n * @return {Object} Current state.\n */\nexport default function reducer( state = DEFAULT_STATE ) {\n\treturn state;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,IAAM,gBAAgB;AAAA,EACrB,QAAQ,CAAC;AAAA,EACT,aAAa;AAAA,IACZ,gBAAgB;AAAA,IAChB,eAAe,CAAC;AAAA,EACjB;AACD;AASe,SAAR,QAA0B,QAAQ,eAAgB;AACxD,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -24,39 +24,14 @@ __export(selectors_exports, {
|
|
|
24
24
|
isTipVisible: () => isTipVisible
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(selectors_exports);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const nonDismissedTips = tipIds.filter(
|
|
33
|
-
(tId) => !Object.keys(
|
|
34
|
-
state.preferences.dismissedTips
|
|
35
|
-
).includes(tId)
|
|
36
|
-
);
|
|
37
|
-
const [currentTipId = null, nextTipId = null] = nonDismissedTips;
|
|
38
|
-
return { tipIds, currentTipId, nextTipId };
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return null;
|
|
42
|
-
},
|
|
43
|
-
(state) => [state.guides, state.preferences.dismissedTips]
|
|
44
|
-
);
|
|
45
|
-
function isTipVisible(state, tipId) {
|
|
46
|
-
if (!state.preferences.areTipsEnabled) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
if (state.preferences.dismissedTips?.hasOwnProperty(tipId)) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
const associatedGuide = getAssociatedGuide(state, tipId);
|
|
53
|
-
if (associatedGuide && associatedGuide.currentTipId !== tipId) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
return true;
|
|
27
|
+
function getAssociatedGuide() {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
function isTipVisible() {
|
|
31
|
+
return false;
|
|
57
32
|
}
|
|
58
|
-
function areTipsEnabled(
|
|
59
|
-
return
|
|
33
|
+
function areTipsEnabled() {
|
|
34
|
+
return false;
|
|
60
35
|
}
|
|
61
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
37
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/selectors.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * An object containing information about a guide.\n *\n * @typedef {Object} NUXGuideInfo\n * @property {string[]} tipIds Which tips the guide contains.\n * @property {?string} currentTipId The guide's currently showing tip.\n * @property {?string} nextTipId The guide's next tip to show.\n */\n\n/**\n * Returns null because the deprecated NUX package no longer displays guides.\n *\n * @return {null} No associated guide.\n */\nexport function getAssociatedGuide() {\n\treturn null;\n}\n\n/**\n * Returns false because the deprecated NUX package no longer displays tips.\n *\n * @return {boolean} Whether or not the given tip is showing.\n */\nexport function isTipVisible() {\n\treturn false;\n}\n\n/**\n * Returns false because the deprecated NUX package no longer displays tips.\n *\n * @return {boolean} Whether tips are globally enabled.\n */\nexport function areTipsEnabled() {\n\treturn false;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,SAAS,qBAAqB;AACpC,SAAO;AACR;AAOO,SAAS,eAAe;AAC9B,SAAO;AACR;AAOO,SAAS,iBAAiB;AAChC,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,95 +1,8 @@
|
|
|
1
1
|
// packages/nux/src/components/dot-tip/index.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { __ } from "@wordpress/i18n";
|
|
5
|
-
import { withSelect, withDispatch } from "@wordpress/data";
|
|
6
|
-
import { useCallback, useRef } from "@wordpress/element";
|
|
7
|
-
import { close } from "@wordpress/icons";
|
|
8
|
-
import { store as nuxStore } from "../../store/index.mjs";
|
|
9
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
function onClick(event) {
|
|
11
|
-
event.stopPropagation();
|
|
2
|
+
function DotTip() {
|
|
3
|
+
return null;
|
|
12
4
|
}
|
|
13
|
-
|
|
14
|
-
position = "middle right",
|
|
15
|
-
children,
|
|
16
|
-
isVisible,
|
|
17
|
-
hasNextTip,
|
|
18
|
-
onDismiss,
|
|
19
|
-
onDisable
|
|
20
|
-
}) {
|
|
21
|
-
const anchorParent = useRef(null);
|
|
22
|
-
const onFocusOutsideCallback = useCallback(
|
|
23
|
-
(event) => {
|
|
24
|
-
if (!anchorParent.current) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (anchorParent.current.contains(event.relatedTarget)) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
onDisable();
|
|
31
|
-
},
|
|
32
|
-
[onDisable, anchorParent]
|
|
33
|
-
);
|
|
34
|
-
if (!isVisible) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
return /* @__PURE__ */ jsxs(
|
|
38
|
-
Popover,
|
|
39
|
-
{
|
|
40
|
-
className: "nux-dot-tip",
|
|
41
|
-
position,
|
|
42
|
-
focusOnMount: true,
|
|
43
|
-
role: "dialog",
|
|
44
|
-
"aria-label": __("Editor tips"),
|
|
45
|
-
onClick,
|
|
46
|
-
onFocusOutside: onFocusOutsideCallback,
|
|
47
|
-
children: [
|
|
48
|
-
/* @__PURE__ */ jsx("p", { children }),
|
|
49
|
-
/* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx(
|
|
50
|
-
Button,
|
|
51
|
-
{
|
|
52
|
-
__next40pxDefaultSize: true,
|
|
53
|
-
variant: "link",
|
|
54
|
-
onClick: onDismiss,
|
|
55
|
-
children: hasNextTip ? __("See next tip") : __("Got it")
|
|
56
|
-
}
|
|
57
|
-
) }),
|
|
58
|
-
/* @__PURE__ */ jsx(
|
|
59
|
-
Button,
|
|
60
|
-
{
|
|
61
|
-
size: "small",
|
|
62
|
-
className: "nux-dot-tip__disable",
|
|
63
|
-
icon: close,
|
|
64
|
-
label: __("Disable tips"),
|
|
65
|
-
onClick: onDisable
|
|
66
|
-
}
|
|
67
|
-
)
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
var dot_tip_default = compose(
|
|
73
|
-
withSelect((select, { tipId }) => {
|
|
74
|
-
const { isTipVisible, getAssociatedGuide } = select(nuxStore);
|
|
75
|
-
const associatedGuide = getAssociatedGuide(tipId);
|
|
76
|
-
return {
|
|
77
|
-
isVisible: isTipVisible(tipId),
|
|
78
|
-
hasNextTip: !!(associatedGuide && associatedGuide.nextTipId)
|
|
79
|
-
};
|
|
80
|
-
}),
|
|
81
|
-
withDispatch((dispatch, { tipId }) => {
|
|
82
|
-
const { dismissTip, disableTips } = dispatch(nuxStore);
|
|
83
|
-
return {
|
|
84
|
-
onDismiss() {
|
|
85
|
-
dismissTip(tipId);
|
|
86
|
-
},
|
|
87
|
-
onDisable() {
|
|
88
|
-
disableTips();
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
})
|
|
92
|
-
)(DotTip);
|
|
5
|
+
var dot_tip_default = DotTip;
|
|
93
6
|
export {
|
|
94
7
|
DotTip,
|
|
95
8
|
dot_tip_default as default
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dot-tip/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * Deprecated no-op DotTip component.\n *\n * @return {null} Nothing.\n */\nexport function DotTip() {\n\treturn null;\n}\n\nexport default DotTip;\n"],
|
|
5
|
+
"mappings": ";AAKO,SAAS,SAAS;AACxB,SAAO;AACR;AAEA,IAAO,kBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/actions.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Returns
|
|
5
|
-
"mappings": ";AAQO,SAAS,aAAc,QAAS;AACtC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAUO,SAAS,WAAY,IAAK;AAChC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAQO,SAAS,cAAc;AAC7B,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;
|
|
4
|
+
"sourcesContent": ["/**\n * Returns a no-op action object. This package is deprecated and no longer\n * displays tips, but the action remains for backward compatibility.\n *\n * @param {string[]} tipIds Which tips would have been shown in the guide.\n *\n * @return {Object} Action object.\n */\nexport function triggerGuide( tipIds ) {\n\treturn {\n\t\ttype: 'TRIGGER_GUIDE',\n\t\ttipIds,\n\t};\n}\n\n/**\n * Returns a no-op action object. This package is deprecated and no longer\n * displays tips, but the action remains for backward compatibility.\n *\n * @param {string} id The tip that would have been dismissed.\n *\n * @return {Object} Action object.\n */\nexport function dismissTip( id ) {\n\treturn {\n\t\ttype: 'DISMISS_TIP',\n\t\tid,\n\t};\n}\n\n/**\n * Returns a no-op action object. This package is deprecated and no longer\n * displays tips, but the action remains for backward compatibility.\n *\n * @return {Object} Action object.\n */\nexport function disableTips() {\n\treturn {\n\t\ttype: 'DISABLE_TIPS',\n\t};\n}\n\n/**\n * Returns a no-op action object. This package is deprecated and no longer\n * displays tips, but the action remains for backward compatibility.\n *\n * @return {Object} Action object.\n */\nexport function enableTips() {\n\treturn {\n\t\ttype: 'ENABLE_TIPS',\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";AAQO,SAAS,aAAc,QAAS;AACtC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAUO,SAAS,WAAY,IAAK;AAChC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAQO,SAAS,cAAc;AAC7B,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;AAQO,SAAS,aAAa;AAC5B,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,39 +1,15 @@
|
|
|
1
1
|
// packages/nux/src/store/reducer.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
return state;
|
|
9
|
-
}
|
|
10
|
-
function areTipsEnabled(state = true, action) {
|
|
11
|
-
switch (action.type) {
|
|
12
|
-
case "DISABLE_TIPS":
|
|
13
|
-
return false;
|
|
14
|
-
case "ENABLE_TIPS":
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
return state;
|
|
18
|
-
}
|
|
19
|
-
function dismissedTips(state = {}, action) {
|
|
20
|
-
switch (action.type) {
|
|
21
|
-
case "DISMISS_TIP":
|
|
22
|
-
return {
|
|
23
|
-
...state,
|
|
24
|
-
[action.id]: true
|
|
25
|
-
};
|
|
26
|
-
case "ENABLE_TIPS":
|
|
27
|
-
return {};
|
|
2
|
+
var DEFAULT_STATE = {
|
|
3
|
+
guides: [],
|
|
4
|
+
preferences: {
|
|
5
|
+
areTipsEnabled: false,
|
|
6
|
+
dismissedTips: {}
|
|
28
7
|
}
|
|
8
|
+
};
|
|
9
|
+
function reducer(state = DEFAULT_STATE) {
|
|
29
10
|
return state;
|
|
30
11
|
}
|
|
31
|
-
var preferences = combineReducers({ areTipsEnabled, dismissedTips });
|
|
32
|
-
var reducer_default = combineReducers({ guides, preferences });
|
|
33
12
|
export {
|
|
34
|
-
|
|
35
|
-
reducer_default as default,
|
|
36
|
-
dismissedTips,
|
|
37
|
-
guides
|
|
13
|
+
reducer as default
|
|
38
14
|
};
|
|
39
15
|
//# sourceMappingURL=reducer.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/reducer.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * Deprecated NUX store state kept only so the core/nux store can still be\n * registered for backward compatibility.\n */\nconst DEFAULT_STATE = {\n\tguides: [],\n\tpreferences: {\n\t\tareTipsEnabled: false,\n\t\tdismissedTips: {},\n\t},\n};\n\n/**\n * Reducer that preserves state without responding to actions.\n *\n * @param {Object} state Current state.\n *\n * @return {Object} Current state.\n */\nexport default function reducer( state = DEFAULT_STATE ) {\n\treturn state;\n}\n"],
|
|
5
|
+
"mappings": ";AAIA,IAAM,gBAAgB;AAAA,EACrB,QAAQ,CAAC;AAAA,EACT,aAAa;AAAA,IACZ,gBAAgB;AAAA,IAChB,eAAe,CAAC;AAAA,EACjB;AACD;AASe,SAAR,QAA0B,QAAQ,eAAgB;AACxD,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|