@wordpress/nux 9.48.0 → 10.0.1

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 CHANGED
@@ -2,7 +2,13 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- ## 9.48.0 (2026-06-04)
5
+ ## 10.0.1 (2026-06-16)
6
+
7
+ ## 10.0.0 (2026-06-10)
8
+
9
+ ### Breaking Changes
10
+
11
+ - 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)).
6
12
 
7
13
  ## 9.47.0 (2026-05-27)
8
14
 
package/README.md CHANGED
@@ -1,109 +1,8 @@
1
1
  # New User eXperience (NUX)
2
2
 
3
- 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 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
- 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`.
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
- var import_compose = require("@wordpress/compose");
27
- var import_components = require("@wordpress/components");
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
- function DotTip({
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 * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { Popover, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as nuxStore } from '../../store';\n\nfunction onClick( event ) {\n\t// Tips are often nested within buttons. We stop propagation so that clicking\n\t// on a tip doesn't result in the button being clicked.\n\tevent.stopPropagation();\n}\n\nexport function DotTip( {\n\tposition = 'middle right',\n\tchildren,\n\tisVisible,\n\thasNextTip,\n\tonDismiss,\n\tonDisable,\n} ) {\n\tconst anchorParent = useRef( null );\n\tconst onFocusOutsideCallback = useCallback(\n\t\t( event ) => {\n\t\t\tif ( ! anchorParent.current ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( anchorParent.current.contains( event.relatedTarget ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonDisable();\n\t\t},\n\t\t[ onDisable, anchorParent ]\n\t);\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tclassName=\"nux-dot-tip\"\n\t\t\tposition={ position }\n\t\t\tfocusOnMount\n\t\t\trole=\"dialog\"\n\t\t\taria-label={ __( 'Editor tips' ) }\n\t\t\tonClick={ onClick }\n\t\t\tonFocusOutside={ onFocusOutsideCallback }\n\t\t>\n\t\t\t<p>{ children }</p>\n\t\t\t<p>\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\tonClick={ onDismiss }\n\t\t\t\t>\n\t\t\t\t\t{ hasNextTip ? __( 'See next tip' ) : __( 'Got it' ) }\n\t\t\t\t</Button>\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tsize=\"small\"\n\t\t\t\tclassName=\"nux-dot-tip__disable\"\n\t\t\t\ticon={ close }\n\t\t\t\tlabel={ __( 'Disable tips' ) }\n\t\t\t\tonClick={ onDisable }\n\t\t\t/>\n\t\t</Popover>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select, { tipId } ) => {\n\t\tconst { isTipVisible, getAssociatedGuide } = select( nuxStore );\n\t\tconst associatedGuide = getAssociatedGuide( tipId );\n\t\treturn {\n\t\t\tisVisible: isTipVisible( tipId ),\n\t\t\thasNextTip: !! ( associatedGuide && associatedGuide.nextTipId ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { tipId } ) => {\n\t\tconst { dismissTip, disableTips } = dispatch( nuxStore );\n\t\treturn {\n\t\t\tonDismiss() {\n\t\t\t\tdismissTip( tipId );\n\t\t\t},\n\t\t\tonDisable() {\n\t\t\t\tdisableTips();\n\t\t\t},\n\t\t};\n\t} )\n)( DotTip );\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAwB;AACxB,wBAAgC;AAChC,kBAAmB;AACnB,kBAAyC;AACzC,qBAAoC;AACpC,mBAAsB;AAKtB,mBAAkC;AAkChC;AAhCF,SAAS,QAAS,OAAQ;AAGzB,QAAM,gBAAgB;AACvB;AAEO,SAAS,OAAQ;AAAA,EACvB,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,mBAAe,uBAAQ,IAAK;AAClC,QAAM,6BAAyB;AAAA,IAC9B,CAAE,UAAW;AACZ,UAAK,CAAE,aAAa,SAAU;AAC7B;AAAA,MACD;AACA,UAAK,aAAa,QAAQ,SAAU,MAAM,aAAc,GAAI;AAC3D;AAAA,MACD;AACA,gBAAU;AAAA,IACX;AAAA,IACA,CAAE,WAAW,YAAa;AAAA,EAC3B;AACA,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV;AAAA,MACA,cAAY;AAAA,MACZ,MAAK;AAAA,MACL,kBAAa,gBAAI,aAAc;AAAA,MAC/B;AAAA,MACA,gBAAiB;AAAA,MAEjB;AAAA,oDAAC,OAAI,UAAU;AAAA,QACf,4CAAC,OACA;AAAA,UAAC;AAAA;AAAA,YACA,uBAAqB;AAAA,YACrB,SAAQ;AAAA,YACR,SAAU;AAAA,YAER,2BAAa,gBAAI,cAAe,QAAI,gBAAI,QAAS;AAAA;AAAA,QACpD,GACD;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,MAAK;AAAA,YACL,WAAU;AAAA,YACV,MAAO;AAAA,YACP,WAAQ,gBAAI,cAAe;AAAA,YAC3B,SAAU;AAAA;AAAA,QACX;AAAA;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,sBAAQ;AAAA,MACd,wBAAY,CAAE,QAAQ,EAAE,MAAM,MAAO;AACpC,UAAM,EAAE,cAAc,mBAAmB,IAAI,OAAQ,aAAAA,KAAS;AAC9D,UAAM,kBAAkB,mBAAoB,KAAM;AAClD,WAAO;AAAA,MACN,WAAW,aAAc,KAAM;AAAA,MAC/B,YAAY,CAAC,EAAI,mBAAmB,gBAAgB;AAAA,IACrD;AAAA,EACD,CAAE;AAAA,MACF,0BAAc,CAAE,UAAU,EAAE,MAAM,MAAO;AACxC,UAAM,EAAE,YAAY,YAAY,IAAI,SAAU,aAAAA,KAAS;AACvD,WAAO;AAAA,MACN,YAAY;AACX,mBAAY,KAAM;AAAA,MACnB;AAAA,MACA,YAAY;AACX,oBAAY;AAAA,MACb;AAAA,IACD;AAAA,EACD,CAAE;AACH,EAAG,MAAO;",
6
- "names": ["nuxStore"]
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 an action object that, when dispatched, presents a guide that takes\n * the user through a series of tips step by step.\n *\n * @param {string[]} tipIds Which tips to show 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 an action object that, when dispatched, dismisses the given tip. A\n * dismissed tip will not show again.\n *\n * @param {string} id The tip to dismiss.\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 an action object that, when dispatched, prevents all tips from\n * showing again.\n *\n * @return {Object} Action object.\n */\nexport function disableTips() {\n\treturn {\n\t\ttype: 'DISABLE_TIPS',\n\t};\n}\n\n/**\n * Returns an action object that, when dispatched, makes all tips show again.\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;AAOO,SAAS,aAAa;AAC5B,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
  }
@@ -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
- areTipsEnabled: () => areTipsEnabled,
23
- default: () => reducer_default,
24
- dismissedTips: () => dismissedTips,
25
- guides: () => guides
22
+ default: () => reducer
26
23
  });
27
24
  module.exports = __toCommonJS(reducer_exports);
28
- var import_data = require("@wordpress/data");
29
- function guides(state = [], action) {
30
- switch (action.type) {
31
- case "TRIGGER_GUIDE":
32
- return [...state, action.tipIds];
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 * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer that tracks which tips are in a guide. Each guide is represented by\n * an array which contains the tip identifiers contained within that guide.\n *\n * @param {Array} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Array} Updated state.\n */\nexport function guides( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'TRIGGER_GUIDE':\n\t\t\treturn [ ...state, action.tipIds ];\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer that tracks whether or not tips are globally enabled.\n *\n * @param {boolean} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nexport function areTipsEnabled( state = true, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'DISABLE_TIPS':\n\t\t\treturn false;\n\n\t\tcase 'ENABLE_TIPS':\n\t\t\treturn true;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer that tracks which tips have been dismissed. If the state object\n * contains a tip identifier, then that tip is dismissed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function dismissedTips( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'DISMISS_TIP':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.id ]: true,\n\t\t\t};\n\n\t\tcase 'ENABLE_TIPS':\n\t\t\treturn {};\n\t}\n\n\treturn state;\n}\n\nconst preferences = combineReducers( { areTipsEnabled, dismissedTips } );\n\nexport default combineReducers( { guides, preferences } );\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAgC;AAWzB,SAAS,OAAQ,QAAQ,CAAC,GAAG,QAAS;AAC5C,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO,CAAE,GAAG,OAAO,OAAO,MAAO;AAAA,EACnC;AAEA,SAAO;AACR;AAUO,SAAS,eAAgB,QAAQ,MAAM,QAAS;AACtD,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,IAER,KAAK;AACJ,aAAO;AAAA,EACT;AAEA,SAAO;AACR;AAWO,SAAS,cAAe,QAAQ,CAAC,GAAG,QAAS;AACnD,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,EAAG,GAAG;AAAA,MAChB;AAAA,IAED,KAAK;AACJ,aAAO,CAAC;AAAA,EACV;AAEA,SAAO;AACR;AAEA,IAAM,kBAAc,6BAAiB,EAAE,gBAAgB,cAAc,CAAE;AAEvE,IAAO,sBAAQ,6BAAiB,EAAE,QAAQ,YAAY,CAAE;",
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
- var import_data = require("@wordpress/data");
28
- var getAssociatedGuide = (0, import_data.createSelector)(
29
- (state, tipId) => {
30
- for (const tipIds of state.guides) {
31
- if (tipIds.includes(tipId)) {
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(state) {
59
- return state.preferences.areTipsEnabled;
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 * WordPress dependencies\n */\nimport { createSelector } from '@wordpress/data';\n\n/**\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 an object describing the guide, if any, that the given tip is a part\n * of.\n *\n * @param {Object} state Global application state.\n * @param {string} tipId The tip to query.\n *\n * @return {?NUXGuideInfo} Information about the associated guide.\n */\nexport const getAssociatedGuide = createSelector(\n\t( state, tipId ) => {\n\t\tfor ( const tipIds of state.guides ) {\n\t\t\tif ( tipIds.includes( tipId ) ) {\n\t\t\t\tconst nonDismissedTips = tipIds.filter(\n\t\t\t\t\t( tId ) =>\n\t\t\t\t\t\t! Object.keys(\n\t\t\t\t\t\t\tstate.preferences.dismissedTips\n\t\t\t\t\t\t).includes( tId )\n\t\t\t\t);\n\t\t\t\tconst [ currentTipId = null, nextTipId = null ] =\n\t\t\t\t\tnonDismissedTips;\n\t\t\t\treturn { tipIds, currentTipId, nextTipId };\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t},\n\t( state ) => [ state.guides, state.preferences.dismissedTips ]\n);\n\n/**\n * Determines whether or not the given tip is showing. Tips are hidden if they\n * are disabled, have been dismissed, or are not the current tip in any\n * guide that they have been added to.\n *\n * @param {Object} state Global application state.\n * @param {string} tipId The tip to query.\n *\n * @return {boolean} Whether or not the given tip is showing.\n */\nexport function isTipVisible( state, tipId ) {\n\tif ( ! state.preferences.areTipsEnabled ) {\n\t\treturn false;\n\t}\n\n\tif ( state.preferences.dismissedTips?.hasOwnProperty( tipId ) ) {\n\t\treturn false;\n\t}\n\n\tconst associatedGuide = getAssociatedGuide( state, tipId );\n\tif ( associatedGuide && associatedGuide.currentTipId !== tipId ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Returns whether or not tips are globally enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether tips are globally enabled.\n */\nexport function areTipsEnabled( state ) {\n\treturn state.preferences.areTipsEnabled;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA+B;AAoBxB,IAAM,yBAAqB;AAAA,EACjC,CAAE,OAAO,UAAW;AACnB,eAAY,UAAU,MAAM,QAAS;AACpC,UAAK,OAAO,SAAU,KAAM,GAAI;AAC/B,cAAM,mBAAmB,OAAO;AAAA,UAC/B,CAAE,QACD,CAAE,OAAO;AAAA,YACR,MAAM,YAAY;AAAA,UACnB,EAAE,SAAU,GAAI;AAAA,QAClB;AACA,cAAM,CAAE,eAAe,MAAM,YAAY,IAAK,IAC7C;AACD,eAAO,EAAE,QAAQ,cAAc,UAAU;AAAA,MAC1C;AAAA,IACD;AAEA,WAAO;AAAA,EACR;AAAA,EACA,CAAE,UAAW,CAAE,MAAM,QAAQ,MAAM,YAAY,aAAc;AAC9D;AAYO,SAAS,aAAc,OAAO,OAAQ;AAC5C,MAAK,CAAE,MAAM,YAAY,gBAAiB;AACzC,WAAO;AAAA,EACR;AAEA,MAAK,MAAM,YAAY,eAAe,eAAgB,KAAM,GAAI;AAC/D,WAAO;AAAA,EACR;AAEA,QAAM,kBAAkB,mBAAoB,OAAO,KAAM;AACzD,MAAK,mBAAmB,gBAAgB,iBAAiB,OAAQ;AAChE,WAAO;AAAA,EACR;AAEA,SAAO;AACR;AASO,SAAS,eAAgB,OAAQ;AACvC,SAAO,MAAM,YAAY;AAC1B;",
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
- import { compose } from "@wordpress/compose";
3
- import { Popover, Button } from "@wordpress/components";
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
- function DotTip({
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 * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { Popover, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as nuxStore } from '../../store';\n\nfunction onClick( event ) {\n\t// Tips are often nested within buttons. We stop propagation so that clicking\n\t// on a tip doesn't result in the button being clicked.\n\tevent.stopPropagation();\n}\n\nexport function DotTip( {\n\tposition = 'middle right',\n\tchildren,\n\tisVisible,\n\thasNextTip,\n\tonDismiss,\n\tonDisable,\n} ) {\n\tconst anchorParent = useRef( null );\n\tconst onFocusOutsideCallback = useCallback(\n\t\t( event ) => {\n\t\t\tif ( ! anchorParent.current ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( anchorParent.current.contains( event.relatedTarget ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonDisable();\n\t\t},\n\t\t[ onDisable, anchorParent ]\n\t);\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tclassName=\"nux-dot-tip\"\n\t\t\tposition={ position }\n\t\t\tfocusOnMount\n\t\t\trole=\"dialog\"\n\t\t\taria-label={ __( 'Editor tips' ) }\n\t\t\tonClick={ onClick }\n\t\t\tonFocusOutside={ onFocusOutsideCallback }\n\t\t>\n\t\t\t<p>{ children }</p>\n\t\t\t<p>\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\tonClick={ onDismiss }\n\t\t\t\t>\n\t\t\t\t\t{ hasNextTip ? __( 'See next tip' ) : __( 'Got it' ) }\n\t\t\t\t</Button>\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tsize=\"small\"\n\t\t\t\tclassName=\"nux-dot-tip__disable\"\n\t\t\t\ticon={ close }\n\t\t\t\tlabel={ __( 'Disable tips' ) }\n\t\t\t\tonClick={ onDisable }\n\t\t\t/>\n\t\t</Popover>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select, { tipId } ) => {\n\t\tconst { isTipVisible, getAssociatedGuide } = select( nuxStore );\n\t\tconst associatedGuide = getAssociatedGuide( tipId );\n\t\treturn {\n\t\t\tisVisible: isTipVisible( tipId ),\n\t\t\thasNextTip: !! ( associatedGuide && associatedGuide.nextTipId ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { tipId } ) => {\n\t\tconst { dismissTip, disableTips } = dispatch( nuxStore );\n\t\treturn {\n\t\t\tonDismiss() {\n\t\t\t\tdismissTip( tipId );\n\t\t\t},\n\t\t\tonDisable() {\n\t\t\t\tdisableTips();\n\t\t\t},\n\t\t};\n\t} )\n)( DotTip );\n"],
5
- "mappings": ";AAGA,SAAS,eAAe;AACxB,SAAS,SAAS,cAAc;AAChC,SAAS,UAAU;AACnB,SAAS,YAAY,oBAAoB;AACzC,SAAS,aAAa,cAAc;AACpC,SAAS,aAAa;AAKtB,SAAS,SAAS,gBAAgB;AAkChC,SASC,KATD;AAhCF,SAAS,QAAS,OAAQ;AAGzB,QAAM,gBAAgB;AACvB;AAEO,SAAS,OAAQ;AAAA,EACvB,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,eAAe,OAAQ,IAAK;AAClC,QAAM,yBAAyB;AAAA,IAC9B,CAAE,UAAW;AACZ,UAAK,CAAE,aAAa,SAAU;AAC7B;AAAA,MACD;AACA,UAAK,aAAa,QAAQ,SAAU,MAAM,aAAc,GAAI;AAC3D;AAAA,MACD;AACA,gBAAU;AAAA,IACX;AAAA,IACA,CAAE,WAAW,YAAa;AAAA,EAC3B;AACA,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV;AAAA,MACA,cAAY;AAAA,MACZ,MAAK;AAAA,MACL,cAAa,GAAI,aAAc;AAAA,MAC/B;AAAA,MACA,gBAAiB;AAAA,MAEjB;AAAA,4BAAC,OAAI,UAAU;AAAA,QACf,oBAAC,OACA;AAAA,UAAC;AAAA;AAAA,YACA,uBAAqB;AAAA,YACrB,SAAQ;AAAA,YACR,SAAU;AAAA,YAER,uBAAa,GAAI,cAAe,IAAI,GAAI,QAAS;AAAA;AAAA,QACpD,GACD;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,MAAK;AAAA,YACL,WAAU;AAAA,YACV,MAAO;AAAA,YACP,OAAQ,GAAI,cAAe;AAAA,YAC3B,SAAU;AAAA;AAAA,QACX;AAAA;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,kBAAQ;AAAA,EACd,WAAY,CAAE,QAAQ,EAAE,MAAM,MAAO;AACpC,UAAM,EAAE,cAAc,mBAAmB,IAAI,OAAQ,QAAS;AAC9D,UAAM,kBAAkB,mBAAoB,KAAM;AAClD,WAAO;AAAA,MACN,WAAW,aAAc,KAAM;AAAA,MAC/B,YAAY,CAAC,EAAI,mBAAmB,gBAAgB;AAAA,IACrD;AAAA,EACD,CAAE;AAAA,EACF,aAAc,CAAE,UAAU,EAAE,MAAM,MAAO;AACxC,UAAM,EAAE,YAAY,YAAY,IAAI,SAAU,QAAS;AACvD,WAAO;AAAA,MACN,YAAY;AACX,mBAAY,KAAM;AAAA,MACnB;AAAA,MACA,YAAY;AACX,oBAAY;AAAA,MACb;AAAA,IACD;AAAA,EACD,CAAE;AACH,EAAG,MAAO;",
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 an action object that, when dispatched, presents a guide that takes\n * the user through a series of tips step by step.\n *\n * @param {string[]} tipIds Which tips to show 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 an action object that, when dispatched, dismisses the given tip. A\n * dismissed tip will not show again.\n *\n * @param {string} id The tip to dismiss.\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 an action object that, when dispatched, prevents all tips from\n * showing again.\n *\n * @return {Object} Action object.\n */\nexport function disableTips() {\n\treturn {\n\t\ttype: 'DISABLE_TIPS',\n\t};\n}\n\n/**\n * Returns an action object that, when dispatched, makes all tips show again.\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;AAOO,SAAS,aAAa;AAC5B,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
- import { combineReducers } from "@wordpress/data";
3
- function guides(state = [], action) {
4
- switch (action.type) {
5
- case "TRIGGER_GUIDE":
6
- return [...state, action.tipIds];
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
- areTipsEnabled,
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 * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer that tracks which tips are in a guide. Each guide is represented by\n * an array which contains the tip identifiers contained within that guide.\n *\n * @param {Array} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Array} Updated state.\n */\nexport function guides( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'TRIGGER_GUIDE':\n\t\t\treturn [ ...state, action.tipIds ];\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer that tracks whether or not tips are globally enabled.\n *\n * @param {boolean} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nexport function areTipsEnabled( state = true, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'DISABLE_TIPS':\n\t\t\treturn false;\n\n\t\tcase 'ENABLE_TIPS':\n\t\t\treturn true;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer that tracks which tips have been dismissed. If the state object\n * contains a tip identifier, then that tip is dismissed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function dismissedTips( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'DISMISS_TIP':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.id ]: true,\n\t\t\t};\n\n\t\tcase 'ENABLE_TIPS':\n\t\t\treturn {};\n\t}\n\n\treturn state;\n}\n\nconst preferences = combineReducers( { areTipsEnabled, dismissedTips } );\n\nexport default combineReducers( { guides, preferences } );\n"],
5
- "mappings": ";AAGA,SAAS,uBAAuB;AAWzB,SAAS,OAAQ,QAAQ,CAAC,GAAG,QAAS;AAC5C,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO,CAAE,GAAG,OAAO,OAAO,MAAO;AAAA,EACnC;AAEA,SAAO;AACR;AAUO,SAAS,eAAgB,QAAQ,MAAM,QAAS;AACtD,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,IAER,KAAK;AACJ,aAAO;AAAA,EACT;AAEA,SAAO;AACR;AAWO,SAAS,cAAe,QAAQ,CAAC,GAAG,QAAS;AACnD,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,EAAG,GAAG;AAAA,MAChB;AAAA,IAED,KAAK;AACJ,aAAO,CAAC;AAAA,EACV;AAEA,SAAO;AACR;AAEA,IAAM,cAAc,gBAAiB,EAAE,gBAAgB,cAAc,CAAE;AAEvE,IAAO,kBAAQ,gBAAiB,EAAE,QAAQ,YAAY,CAAE;",
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
  }