@wordpress/preferences 4.32.0 → 4.32.1-next.b8c8708f3.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.
Files changed (68) hide show
  1. package/build/components/index.js +36 -12
  2. package/build/components/index.js.map +7 -1
  3. package/build/components/preference-base-option/index.js +39 -30
  4. package/build/components/preference-base-option/index.js.map +7 -1
  5. package/build/components/preference-toggle-control/index.js +52 -30
  6. package/build/components/preference-toggle-control/index.js.map +7 -1
  7. package/build/components/preference-toggle-menu-item/index.js +65 -47
  8. package/build/components/preference-toggle-menu-item/index.js.map +7 -1
  9. package/build/components/preferences-modal/index.js +35 -23
  10. package/build/components/preferences-modal/index.js.map +7 -1
  11. package/build/components/preferences-modal-section/index.js +31 -28
  12. package/build/components/preferences-modal-section/index.js.map +7 -1
  13. package/build/components/preferences-modal-tabs/index.js +123 -134
  14. package/build/components/preferences-modal-tabs/index.js.map +7 -1
  15. package/build/index.js +29 -36
  16. package/build/index.js.map +7 -1
  17. package/build/lock-unlock.js +31 -15
  18. package/build/lock-unlock.js.map +7 -1
  19. package/build/private-apis.js +49 -24
  20. package/build/private-apis.js.map +7 -1
  21. package/build/store/actions.js +36 -69
  22. package/build/store/actions.js.map +7 -1
  23. package/build/store/constants.js +27 -12
  24. package/build/store/constants.js.map +7 -1
  25. package/build/store/index.js +44 -32
  26. package/build/store/index.js.map +7 -1
  27. package/build/store/reducer.js +39 -65
  28. package/build/store/reducer.js.map +7 -1
  29. package/build/store/selectors.js +67 -33
  30. package/build/store/selectors.js.map +7 -1
  31. package/build-module/components/index.js +5 -2
  32. package/build-module/components/index.js.map +7 -1
  33. package/build-module/components/preference-base-option/index.js +21 -24
  34. package/build-module/components/preference-base-option/index.js.map +7 -1
  35. package/build-module/components/preference-toggle-control/index.js +24 -23
  36. package/build-module/components/preference-toggle-control/index.js.map +7 -1
  37. package/build-module/components/preference-toggle-menu-item/index.js +46 -40
  38. package/build-module/components/preference-toggle-menu-item/index.js.map +7 -1
  39. package/build-module/components/preferences-modal/index.js +17 -17
  40. package/build-module/components/preferences-modal/index.js.map +7 -1
  41. package/build-module/components/preferences-modal-section/index.js +13 -23
  42. package/build-module/components/preferences-modal-section/index.js.map +7 -1
  43. package/build-module/components/preferences-modal-tabs/index.js +116 -127
  44. package/build-module/components/preferences-modal-tabs/index.js.map +7 -1
  45. package/build-module/index.js +7 -4
  46. package/build-module/index.js.map +7 -1
  47. package/build-module/lock-unlock.js +8 -7
  48. package/build-module/lock-unlock.js.map +7 -1
  49. package/build-module/private-apis.js +11 -11
  50. package/build-module/private-apis.js.map +7 -1
  51. package/build-module/store/actions.js +15 -65
  52. package/build-module/store/actions.js.map +7 -1
  53. package/build-module/store/constants.js +5 -7
  54. package/build-module/store/constants.js.map +7 -1
  55. package/build-module/store/index.js +10 -22
  56. package/build-module/store/index.js.map +7 -1
  57. package/build-module/store/reducer.js +17 -59
  58. package/build-module/store/reducer.js.map +7 -1
  59. package/build-module/store/selectors.js +35 -26
  60. package/build-module/store/selectors.js.map +7 -1
  61. package/build-style/style-rtl.css +4 -158
  62. package/build-style/style.css +4 -158
  63. package/package.json +20 -12
  64. package/src/components/preference-base-option/style.scss +2 -0
  65. package/src/components/preferences-modal/style.scss +6 -2
  66. package/src/components/preferences-modal-section/style.scss +3 -0
  67. package/src/components/preferences-modal-tabs/style.scss +4 -1
  68. package/src/style.scss +4 -4
@@ -1,95 +1,62 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var actions_exports = {};
19
+ __export(actions_exports, {
20
+ set: () => set,
21
+ setDefaults: () => setDefaults,
22
+ setPersistenceLayer: () => setPersistenceLayer,
23
+ toggle: () => toggle
5
24
  });
6
- exports.set = set;
7
- exports.setDefaults = setDefaults;
8
- exports.setPersistenceLayer = setPersistenceLayer;
9
- exports.toggle = toggle;
10
- /**
11
- * Returns an action object used in signalling that a preference should be
12
- * toggled.
13
- *
14
- * @param {string} scope The preference scope (e.g. core/edit-post).
15
- * @param {string} name The preference name.
16
- */
25
+ module.exports = __toCommonJS(actions_exports);
17
26
  function toggle(scope, name) {
18
- return function ({
19
- select,
20
- dispatch
21
- }) {
27
+ return function({ select, dispatch }) {
22
28
  const currentValue = select.get(scope, name);
23
29
  dispatch.set(scope, name, !currentValue);
24
30
  };
25
31
  }
26
-
27
- /**
28
- * Returns an action object used in signalling that a preference should be set
29
- * to a value
30
- *
31
- * @param {string} scope The preference scope (e.g. core/edit-post).
32
- * @param {string} name The preference name.
33
- * @param {*} value The value to set.
34
- *
35
- * @return {Object} Action object.
36
- */
37
32
  function set(scope, name, value) {
38
33
  return {
39
- type: 'SET_PREFERENCE_VALUE',
34
+ type: "SET_PREFERENCE_VALUE",
40
35
  scope,
41
36
  name,
42
37
  value
43
38
  };
44
39
  }
45
-
46
- /**
47
- * Returns an action object used in signalling that preference defaults should
48
- * be set.
49
- *
50
- * @param {string} scope The preference scope (e.g. core/edit-post).
51
- * @param {Object<string, *>} defaults A key/value map of preference names to values.
52
- *
53
- * @return {Object} Action object.
54
- */
55
40
  function setDefaults(scope, defaults) {
56
41
  return {
57
- type: 'SET_PREFERENCE_DEFAULTS',
42
+ type: "SET_PREFERENCE_DEFAULTS",
58
43
  scope,
59
44
  defaults
60
45
  };
61
46
  }
62
-
63
- /** @typedef {() => Promise<Object>} WPPreferencesPersistenceLayerGet */
64
- /** @typedef {(Object) => void} WPPreferencesPersistenceLayerSet */
65
- /**
66
- * @typedef WPPreferencesPersistenceLayer
67
- *
68
- * @property {WPPreferencesPersistenceLayerGet} get An async function that gets data from the persistence layer.
69
- * @property {WPPreferencesPersistenceLayerSet} set A function that sets data in the persistence layer.
70
- */
71
-
72
- /**
73
- * Sets the persistence layer.
74
- *
75
- * When a persistence layer is set, the preferences store will:
76
- * - call `get` immediately and update the store state to the value returned.
77
- * - call `set` with all preferences whenever a preference changes value.
78
- *
79
- * `setPersistenceLayer` should ideally be dispatched at the start of an
80
- * application's lifecycle, before any other actions have been dispatched to
81
- * the preferences store.
82
- *
83
- * @param {WPPreferencesPersistenceLayer} persistenceLayer The persistence layer.
84
- *
85
- * @return {Object} Action object.
86
- */
87
47
  async function setPersistenceLayer(persistenceLayer) {
88
48
  const persistedData = await persistenceLayer.get();
89
49
  return {
90
- type: 'SET_PERSISTENCE_LAYER',
50
+ type: "SET_PERSISTENCE_LAYER",
91
51
  persistenceLayer,
92
52
  persistedData
93
53
  };
94
54
  }
95
- //# sourceMappingURL=actions.js.map
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ set,
58
+ setDefaults,
59
+ setPersistenceLayer,
60
+ toggle
61
+ });
62
+ //# sourceMappingURL=actions.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["toggle","scope","name","select","dispatch","currentValue","get","set","value","type","setDefaults","defaults","setPersistenceLayer","persistenceLayer","persistedData"],"sources":["@wordpress/preferences/src/store/actions.js"],"sourcesContent":["/**\n * Returns an action object used in signalling that a preference should be\n * toggled.\n *\n * @param {string} scope The preference scope (e.g. core/edit-post).\n * @param {string} name The preference name.\n */\nexport function toggle( scope, name ) {\n\treturn function ( { select, dispatch } ) {\n\t\tconst currentValue = select.get( scope, name );\n\t\tdispatch.set( scope, name, ! currentValue );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a preference should be set\n * to a value\n *\n * @param {string} scope The preference scope (e.g. core/edit-post).\n * @param {string} name The preference name.\n * @param {*} value The value to set.\n *\n * @return {Object} Action object.\n */\nexport function set( scope, name, value ) {\n\treturn {\n\t\ttype: 'SET_PREFERENCE_VALUE',\n\t\tscope,\n\t\tname,\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that preference defaults should\n * be set.\n *\n * @param {string} scope The preference scope (e.g. core/edit-post).\n * @param {Object<string, *>} defaults A key/value map of preference names to values.\n *\n * @return {Object} Action object.\n */\nexport function setDefaults( scope, defaults ) {\n\treturn {\n\t\ttype: 'SET_PREFERENCE_DEFAULTS',\n\t\tscope,\n\t\tdefaults,\n\t};\n}\n\n/** @typedef {() => Promise<Object>} WPPreferencesPersistenceLayerGet */\n/** @typedef {(Object) => void} WPPreferencesPersistenceLayerSet */\n/**\n * @typedef WPPreferencesPersistenceLayer\n *\n * @property {WPPreferencesPersistenceLayerGet} get An async function that gets data from the persistence layer.\n * @property {WPPreferencesPersistenceLayerSet} set A function that sets data in the persistence layer.\n */\n\n/**\n * Sets the persistence layer.\n *\n * When a persistence layer is set, the preferences store will:\n * - call `get` immediately and update the store state to the value returned.\n * - call `set` with all preferences whenever a preference changes value.\n *\n * `setPersistenceLayer` should ideally be dispatched at the start of an\n * application's lifecycle, before any other actions have been dispatched to\n * the preferences store.\n *\n * @param {WPPreferencesPersistenceLayer} persistenceLayer The persistence layer.\n *\n * @return {Object} Action object.\n */\nexport async function setPersistenceLayer( persistenceLayer ) {\n\tconst persistedData = await persistenceLayer.get();\n\treturn {\n\t\ttype: 'SET_PERSISTENCE_LAYER',\n\t\tpersistenceLayer,\n\t\tpersistedData,\n\t};\n}\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,MAAMA,CAAEC,KAAK,EAAEC,IAAI,EAAG;EACrC,OAAO,UAAW;IAAEC,MAAM;IAAEC;EAAS,CAAC,EAAG;IACxC,MAAMC,YAAY,GAAGF,MAAM,CAACG,GAAG,CAAEL,KAAK,EAAEC,IAAK,CAAC;IAC9CE,QAAQ,CAACG,GAAG,CAAEN,KAAK,EAAEC,IAAI,EAAE,CAAEG,YAAa,CAAC;EAC5C,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,GAAGA,CAAEN,KAAK,EAAEC,IAAI,EAAEM,KAAK,EAAG;EACzC,OAAO;IACNC,IAAI,EAAE,sBAAsB;IAC5BR,KAAK;IACLC,IAAI;IACJM;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,WAAWA,CAAET,KAAK,EAAEU,QAAQ,EAAG;EAC9C,OAAO;IACNF,IAAI,EAAE,yBAAyB;IAC/BR,KAAK;IACLU;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,mBAAmBA,CAAEC,gBAAgB,EAAG;EAC7D,MAAMC,aAAa,GAAG,MAAMD,gBAAgB,CAACP,GAAG,CAAC,CAAC;EAClD,OAAO;IACNG,IAAI,EAAE,uBAAuB;IAC7BI,gBAAgB;IAChBC;EACD,CAAC;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/actions.js"],
4
+ "sourcesContent": ["/**\n * Returns an action object used in signalling that a preference should be\n * toggled.\n *\n * @param {string} scope The preference scope (e.g. core/edit-post).\n * @param {string} name The preference name.\n */\nexport function toggle( scope, name ) {\n\treturn function ( { select, dispatch } ) {\n\t\tconst currentValue = select.get( scope, name );\n\t\tdispatch.set( scope, name, ! currentValue );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a preference should be set\n * to a value\n *\n * @param {string} scope The preference scope (e.g. core/edit-post).\n * @param {string} name The preference name.\n * @param {*} value The value to set.\n *\n * @return {Object} Action object.\n */\nexport function set( scope, name, value ) {\n\treturn {\n\t\ttype: 'SET_PREFERENCE_VALUE',\n\t\tscope,\n\t\tname,\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that preference defaults should\n * be set.\n *\n * @param {string} scope The preference scope (e.g. core/edit-post).\n * @param {Object<string, *>} defaults A key/value map of preference names to values.\n *\n * @return {Object} Action object.\n */\nexport function setDefaults( scope, defaults ) {\n\treturn {\n\t\ttype: 'SET_PREFERENCE_DEFAULTS',\n\t\tscope,\n\t\tdefaults,\n\t};\n}\n\n/** @typedef {() => Promise<Object>} WPPreferencesPersistenceLayerGet */\n/** @typedef {(Object) => void} WPPreferencesPersistenceLayerSet */\n/**\n * @typedef WPPreferencesPersistenceLayer\n *\n * @property {WPPreferencesPersistenceLayerGet} get An async function that gets data from the persistence layer.\n * @property {WPPreferencesPersistenceLayerSet} set A function that sets data in the persistence layer.\n */\n\n/**\n * Sets the persistence layer.\n *\n * When a persistence layer is set, the preferences store will:\n * - call `get` immediately and update the store state to the value returned.\n * - call `set` with all preferences whenever a preference changes value.\n *\n * `setPersistenceLayer` should ideally be dispatched at the start of an\n * application's lifecycle, before any other actions have been dispatched to\n * the preferences store.\n *\n * @param {WPPreferencesPersistenceLayer} persistenceLayer The persistence layer.\n *\n * @return {Object} Action object.\n */\nexport async function setPersistenceLayer( persistenceLayer ) {\n\tconst persistedData = await persistenceLayer.get();\n\treturn {\n\t\ttype: 'SET_PERSISTENCE_LAYER',\n\t\tpersistenceLayer,\n\t\tpersistedData,\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,SAAS,OAAQ,OAAO,MAAO;AACrC,SAAO,SAAW,EAAE,QAAQ,SAAS,GAAI;AACxC,UAAM,eAAe,OAAO,IAAK,OAAO,IAAK;AAC7C,aAAS,IAAK,OAAO,MAAM,CAAE,YAAa;AAAA,EAC3C;AACD;AAYO,SAAS,IAAK,OAAO,MAAM,OAAQ;AACzC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAWO,SAAS,YAAa,OAAO,UAAW;AAC9C,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AA0BA,eAAsB,oBAAqB,kBAAmB;AAC7D,QAAM,gBAAgB,MAAM,iBAAiB,IAAI;AACjD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
6
+ "names": []
7
+ }
@@ -1,13 +1,28 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var constants_exports = {};
19
+ __export(constants_exports, {
20
+ STORE_NAME: () => STORE_NAME
5
21
  });
6
- exports.STORE_NAME = void 0;
7
- /**
8
- * The identifier for the data store.
9
- *
10
- * @type {string}
11
- */
12
- const STORE_NAME = exports.STORE_NAME = 'core/preferences';
13
- //# sourceMappingURL=constants.js.map
22
+ module.exports = __toCommonJS(constants_exports);
23
+ const STORE_NAME = "core/preferences";
24
+ // Annotate the CommonJS export names for ESM import in node:
25
+ 0 && (module.exports = {
26
+ STORE_NAME
27
+ });
28
+ //# sourceMappingURL=constants.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["STORE_NAME","exports"],"sources":["@wordpress/preferences/src/store/constants.js"],"sourcesContent":["/**\n * The identifier for the data store.\n *\n * @type {string}\n */\nexport const STORE_NAME = 'core/preferences';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACO,MAAMA,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,kBAAkB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/constants.js"],
4
+ "sourcesContent": ["/**\n * The identifier for the data store.\n *\n * @type {string}\n */\nexport const STORE_NAME = 'core/preferences';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,MAAM,aAAa;",
6
+ "names": []
7
+ }
@@ -1,36 +1,48 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var store_exports = {};
29
+ __export(store_exports, {
30
+ store: () => store
6
31
  });
7
- exports.store = void 0;
8
- var _data = require("@wordpress/data");
9
- var _reducer = _interopRequireDefault(require("./reducer"));
10
- var actions = _interopRequireWildcard(require("./actions"));
11
- var selectors = _interopRequireWildcard(require("./selectors"));
12
- var _constants = require("./constants");
13
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
- /**
16
- * WordPress dependencies
17
- */
18
-
19
- /**
20
- * Internal dependencies
21
- */
22
-
23
- /**
24
- * Store definition for the preferences namespace.
25
- *
26
- * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
27
- *
28
- * @type {Object}
29
- */
30
- const store = exports.store = (0, _data.createReduxStore)(_constants.STORE_NAME, {
31
- reducer: _reducer.default,
32
+ module.exports = __toCommonJS(store_exports);
33
+ var import_data = require("@wordpress/data");
34
+ var import_reducer = __toESM(require("./reducer"));
35
+ var actions = __toESM(require("./actions"));
36
+ var selectors = __toESM(require("./selectors"));
37
+ var import_constants = require("./constants");
38
+ const store = (0, import_data.createReduxStore)(import_constants.STORE_NAME, {
39
+ reducer: import_reducer.default,
32
40
  actions,
33
41
  selectors
34
42
  });
35
- (0, _data.register)(store);
36
- //# sourceMappingURL=index.js.map
43
+ (0, import_data.register)(store);
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ store
47
+ });
48
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_data","require","_reducer","_interopRequireDefault","actions","_interopRequireWildcard","selectors","_constants","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","store","exports","createReduxStore","STORE_NAME","reducer","register"],"sources":["@wordpress/preferences/src/store/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the preferences namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAAyC,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAXzC;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMW,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG,IAAAE,sBAAgB,EAAEC,qBAAU,EAAE;EAClDC,OAAO,EAAPA,gBAAO;EACP5B,OAAO;EACPE;AACD,CAAE,CAAC;AAEH,IAAA2B,cAAQ,EAAEL,KAAM,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the preferences namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2C;AAK3C,qBAAoB;AACpB,cAAyB;AACzB,gBAA2B;AAC3B,uBAA2B;AASpB,MAAM,YAAQ,8BAAkB,6BAAY;AAAA,EAClD,wBAAAA;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAAA,IAEF,sBAAU,KAAM;",
6
+ "names": ["reducer"]
7
+ }
@@ -1,33 +1,31 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var reducer_exports = {};
19
+ __export(reducer_exports, {
20
+ default: () => reducer_default,
21
+ defaults: () => defaults,
22
+ preferences: () => preferences
5
23
  });
6
- exports.default = void 0;
7
- exports.defaults = defaults;
8
- exports.preferences = void 0;
9
- var _data = require("@wordpress/data");
10
- /**
11
- * WordPress dependencies
12
- */
13
-
14
- /**
15
- * Reducer returning the defaults for user preferences.
16
- *
17
- * This is kept intentionally separate from the preferences
18
- * themselves so that defaults are not persisted.
19
- *
20
- * @param {Object} state Current state.
21
- * @param {Object} action Dispatched action.
22
- *
23
- * @return {Object} Updated state.
24
- */
24
+ module.exports = __toCommonJS(reducer_exports);
25
+ var import_data = require("@wordpress/data");
25
26
  function defaults(state = {}, action) {
26
- if (action.type === 'SET_PREFERENCE_DEFAULTS') {
27
- const {
28
- scope,
29
- defaults: values
30
- } = action;
27
+ if (action.type === "SET_PREFERENCE_DEFAULTS") {
28
+ const { scope, defaults: values } = action;
31
29
  return {
32
30
  ...state,
33
31
  [scope]: {
@@ -38,53 +36,24 @@ function defaults(state = {}, action) {
38
36
  }
39
37
  return state;
40
38
  }
41
-
42
- /**
43
- * Higher order reducer that does the following:
44
- * - Merges any data from the persistence layer into the state when the
45
- * `SET_PERSISTENCE_LAYER` action is received.
46
- * - Passes any preferences changes to the persistence layer.
47
- *
48
- * @param {Function} reducer The preferences reducer.
49
- *
50
- * @return {Function} The enhanced reducer.
51
- */
52
39
  function withPersistenceLayer(reducer) {
53
40
  let persistenceLayer;
54
41
  return (state, action) => {
55
- // Setup the persistence layer, and return the persisted data
56
- // as the state.
57
- if (action.type === 'SET_PERSISTENCE_LAYER') {
58
- const {
59
- persistenceLayer: persistence,
60
- persistedData
61
- } = action;
42
+ if (action.type === "SET_PERSISTENCE_LAYER") {
43
+ const { persistenceLayer: persistence, persistedData } = action;
62
44
  persistenceLayer = persistence;
63
45
  return persistedData;
64
46
  }
65
47
  const nextState = reducer(state, action);
66
- if (action.type === 'SET_PREFERENCE_VALUE') {
48
+ if (action.type === "SET_PREFERENCE_VALUE") {
67
49
  persistenceLayer?.set(nextState);
68
50
  }
69
51
  return nextState;
70
52
  };
71
53
  }
72
-
73
- /**
74
- * Reducer returning the user preferences.
75
- *
76
- * @param {Object} state Current state.
77
- * @param {Object} action Dispatched action.
78
- *
79
- * @return {Object} Updated state.
80
- */
81
- const preferences = exports.preferences = withPersistenceLayer((state = {}, action) => {
82
- if (action.type === 'SET_PREFERENCE_VALUE') {
83
- const {
84
- scope,
85
- name,
86
- value
87
- } = action;
54
+ const preferences = withPersistenceLayer((state = {}, action) => {
55
+ if (action.type === "SET_PREFERENCE_VALUE") {
56
+ const { scope, name, value } = action;
88
57
  return {
89
58
  ...state,
90
59
  [scope]: {
@@ -95,8 +64,13 @@ const preferences = exports.preferences = withPersistenceLayer((state = {}, acti
95
64
  }
96
65
  return state;
97
66
  });
98
- var _default = exports.default = (0, _data.combineReducers)({
67
+ var reducer_default = (0, import_data.combineReducers)({
68
+ defaults,
69
+ preferences
70
+ });
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
99
73
  defaults,
100
74
  preferences
101
75
  });
102
- //# sourceMappingURL=reducer.js.map
76
+ //# sourceMappingURL=reducer.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_data","require","defaults","state","action","type","scope","values","withPersistenceLayer","reducer","persistenceLayer","persistence","persistedData","nextState","set","preferences","exports","name","value","_default","default","combineReducers"],"sources":["@wordpress/preferences/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the defaults for user preferences.\n *\n * This is kept intentionally separate from the preferences\n * themselves so that defaults are not persisted.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function defaults( state = {}, action ) {\n\tif ( action.type === 'SET_PREFERENCE_DEFAULTS' ) {\n\t\tconst { scope, defaults: values } = action;\n\t\treturn {\n\t\t\t...state,\n\t\t\t[ scope ]: {\n\t\t\t\t...state[ scope ],\n\t\t\t\t...values,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Higher order reducer that does the following:\n * - Merges any data from the persistence layer into the state when the\n * `SET_PERSISTENCE_LAYER` action is received.\n * - Passes any preferences changes to the persistence layer.\n *\n * @param {Function} reducer The preferences reducer.\n *\n * @return {Function} The enhanced reducer.\n */\nfunction withPersistenceLayer( reducer ) {\n\tlet persistenceLayer;\n\n\treturn ( state, action ) => {\n\t\t// Setup the persistence layer, and return the persisted data\n\t\t// as the state.\n\t\tif ( action.type === 'SET_PERSISTENCE_LAYER' ) {\n\t\t\tconst { persistenceLayer: persistence, persistedData } = action;\n\t\t\tpersistenceLayer = persistence;\n\t\t\treturn persistedData;\n\t\t}\n\n\t\tconst nextState = reducer( state, action );\n\t\tif ( action.type === 'SET_PREFERENCE_VALUE' ) {\n\t\t\tpersistenceLayer?.set( nextState );\n\t\t}\n\n\t\treturn nextState;\n\t};\n}\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const preferences = withPersistenceLayer( ( state = {}, action ) => {\n\tif ( action.type === 'SET_PREFERENCE_VALUE' ) {\n\t\tconst { scope, name, value } = action;\n\t\treturn {\n\t\t\t...state,\n\t\t\t[ scope ]: {\n\t\t\t\t...state[ scope ],\n\t\t\t\t[ name ]: value,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn state;\n} );\n\nexport default combineReducers( {\n\tdefaults,\n\tpreferences,\n} );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC9C,IAAKA,MAAM,CAACC,IAAI,KAAK,yBAAyB,EAAG;IAChD,MAAM;MAAEC,KAAK;MAAEJ,QAAQ,EAAEK;IAAO,CAAC,GAAGH,MAAM;IAC1C,OAAO;MACN,GAAGD,KAAK;MACR,CAAEG,KAAK,GAAI;QACV,GAAGH,KAAK,CAAEG,KAAK,CAAE;QACjB,GAAGC;MACJ;IACD,CAAC;EACF;EAEA,OAAOJ,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,oBAAoBA,CAAEC,OAAO,EAAG;EACxC,IAAIC,gBAAgB;EAEpB,OAAO,CAAEP,KAAK,EAAEC,MAAM,KAAM;IAC3B;IACA;IACA,IAAKA,MAAM,CAACC,IAAI,KAAK,uBAAuB,EAAG;MAC9C,MAAM;QAAEK,gBAAgB,EAAEC,WAAW;QAAEC;MAAc,CAAC,GAAGR,MAAM;MAC/DM,gBAAgB,GAAGC,WAAW;MAC9B,OAAOC,aAAa;IACrB;IAEA,MAAMC,SAAS,GAAGJ,OAAO,CAAEN,KAAK,EAAEC,MAAO,CAAC;IAC1C,IAAKA,MAAM,CAACC,IAAI,KAAK,sBAAsB,EAAG;MAC7CK,gBAAgB,EAAEI,GAAG,CAAED,SAAU,CAAC;IACnC;IAEA,OAAOA,SAAS;EACjB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAGP,oBAAoB,CAAE,CAAEL,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,KAAM;EAC1E,IAAKA,MAAM,CAACC,IAAI,KAAK,sBAAsB,EAAG;IAC7C,MAAM;MAAEC,KAAK;MAAEW,IAAI;MAAEC;IAAM,CAAC,GAAGd,MAAM;IACrC,OAAO;MACN,GAAGD,KAAK;MACR,CAAEG,KAAK,GAAI;QACV,GAAGH,KAAK,CAAEG,KAAK,CAAE;QACjB,CAAEW,IAAI,GAAIC;MACX;IACD,CAAC;EACF;EAEA,OAAOf,KAAK;AACb,CAAE,CAAC;AAAC,IAAAgB,QAAA,GAAAH,OAAA,CAAAI,OAAA,GAEW,IAAAC,qBAAe,EAAE;EAC/BnB,QAAQ;EACRa;AACD,CAAE,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/reducer.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the defaults for user preferences.\n *\n * This is kept intentionally separate from the preferences\n * themselves so that defaults are not persisted.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function defaults( state = {}, action ) {\n\tif ( action.type === 'SET_PREFERENCE_DEFAULTS' ) {\n\t\tconst { scope, defaults: values } = action;\n\t\treturn {\n\t\t\t...state,\n\t\t\t[ scope ]: {\n\t\t\t\t...state[ scope ],\n\t\t\t\t...values,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Higher order reducer that does the following:\n * - Merges any data from the persistence layer into the state when the\n * `SET_PERSISTENCE_LAYER` action is received.\n * - Passes any preferences changes to the persistence layer.\n *\n * @param {Function} reducer The preferences reducer.\n *\n * @return {Function} The enhanced reducer.\n */\nfunction withPersistenceLayer( reducer ) {\n\tlet persistenceLayer;\n\n\treturn ( state, action ) => {\n\t\t// Setup the persistence layer, and return the persisted data\n\t\t// as the state.\n\t\tif ( action.type === 'SET_PERSISTENCE_LAYER' ) {\n\t\t\tconst { persistenceLayer: persistence, persistedData } = action;\n\t\t\tpersistenceLayer = persistence;\n\t\t\treturn persistedData;\n\t\t}\n\n\t\tconst nextState = reducer( state, action );\n\t\tif ( action.type === 'SET_PREFERENCE_VALUE' ) {\n\t\t\tpersistenceLayer?.set( nextState );\n\t\t}\n\n\t\treturn nextState;\n\t};\n}\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const preferences = withPersistenceLayer( ( state = {}, action ) => {\n\tif ( action.type === 'SET_PREFERENCE_VALUE' ) {\n\t\tconst { scope, name, value } = action;\n\t\treturn {\n\t\t\t...state,\n\t\t\t[ scope ]: {\n\t\t\t\t...state[ scope ],\n\t\t\t\t[ name ]: value,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn state;\n} );\n\nexport default combineReducers( {\n\tdefaults,\n\tpreferences,\n} );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAgC;AAazB,SAAS,SAAU,QAAQ,CAAC,GAAG,QAAS;AAC9C,MAAK,OAAO,SAAS,2BAA4B;AAChD,UAAM,EAAE,OAAO,UAAU,OAAO,IAAI;AACpC,WAAO;AAAA,MACN,GAAG;AAAA,MACH,CAAE,KAAM,GAAG;AAAA,QACV,GAAG,MAAO,KAAM;AAAA,QAChB,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;AAYA,SAAS,qBAAsB,SAAU;AACxC,MAAI;AAEJ,SAAO,CAAE,OAAO,WAAY;AAG3B,QAAK,OAAO,SAAS,yBAA0B;AAC9C,YAAM,EAAE,kBAAkB,aAAa,cAAc,IAAI;AACzD,yBAAmB;AACnB,aAAO;AAAA,IACR;AAEA,UAAM,YAAY,QAAS,OAAO,MAAO;AACzC,QAAK,OAAO,SAAS,wBAAyB;AAC7C,wBAAkB,IAAK,SAAU;AAAA,IAClC;AAEA,WAAO;AAAA,EACR;AACD;AAUO,MAAM,cAAc,qBAAsB,CAAE,QAAQ,CAAC,GAAG,WAAY;AAC1E,MAAK,OAAO,SAAS,wBAAyB;AAC7C,UAAM,EAAE,OAAO,MAAM,MAAM,IAAI;AAC/B,WAAO;AAAA,MACN,GAAG;AAAA,MACH,CAAE,KAAM,GAAG;AAAA,QACV,GAAG,MAAO,KAAM;AAAA,QAChB,CAAE,IAAK,GAAG;AAAA,MACX;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR,CAAE;AAEF,IAAO,sBAAQ,6BAAiB;AAAA,EAC/B;AAAA,EACA;AACD,CAAE;",
6
+ "names": []
7
+ }
@@ -1,39 +1,73 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var selectors_exports = {};
29
+ __export(selectors_exports, {
30
+ get: () => get
6
31
  });
7
- exports.get = void 0;
8
- var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
9
- /**
10
- * WordPress dependencies
11
- */
12
-
13
- const withDeprecatedKeys = originalGet => (state, scope, name) => {
14
- const settingsToMoveToCore = ['allowRightClickOverrides', 'distractionFree', 'editorMode', 'fixedToolbar', 'focusMode', 'hiddenBlockTypes', 'inactivePanels', 'keepCaretInsideBlock', 'mostUsedBlocks', 'openPanels', 'showBlockBreadcrumbs', 'showIconLabels', 'showListViewByDefault', 'isPublishSidebarEnabled', 'isComplementaryAreaVisible', 'pinnedItems'];
15
- if (settingsToMoveToCore.includes(name) && ['core/edit-post', 'core/edit-site'].includes(scope)) {
16
- (0, _deprecated.default)(`wp.data.select( 'core/preferences' ).get( '${scope}', '${name}' )`, {
17
- since: '6.5',
18
- alternative: `wp.data.select( 'core/preferences' ).get( 'core', '${name}' )`
19
- });
20
- return originalGet(state, 'core', name);
32
+ module.exports = __toCommonJS(selectors_exports);
33
+ var import_deprecated = __toESM(require("@wordpress/deprecated"));
34
+ const withDeprecatedKeys = (originalGet) => (state, scope, name) => {
35
+ const settingsToMoveToCore = [
36
+ "allowRightClickOverrides",
37
+ "distractionFree",
38
+ "editorMode",
39
+ "fixedToolbar",
40
+ "focusMode",
41
+ "hiddenBlockTypes",
42
+ "inactivePanels",
43
+ "keepCaretInsideBlock",
44
+ "mostUsedBlocks",
45
+ "openPanels",
46
+ "showBlockBreadcrumbs",
47
+ "showIconLabels",
48
+ "showListViewByDefault",
49
+ "isPublishSidebarEnabled",
50
+ "isComplementaryAreaVisible",
51
+ "pinnedItems"
52
+ ];
53
+ if (settingsToMoveToCore.includes(name) && ["core/edit-post", "core/edit-site"].includes(scope)) {
54
+ (0, import_deprecated.default)(
55
+ `wp.data.select( 'core/preferences' ).get( '${scope}', '${name}' )`,
56
+ {
57
+ since: "6.5",
58
+ alternative: `wp.data.select( 'core/preferences' ).get( 'core', '${name}' )`
59
+ }
60
+ );
61
+ return originalGet(state, "core", name);
21
62
  }
22
63
  return originalGet(state, scope, name);
23
64
  };
24
-
25
- /**
26
- * Returns a boolean indicating whether a prefer is active for a particular
27
- * scope.
28
- *
29
- * @param {Object} state The store state.
30
- * @param {string} scope The scope of the feature (e.g. core/edit-post).
31
- * @param {string} name The name of the feature.
32
- *
33
- * @return {*} Is the feature enabled?
34
- */
35
- const get = exports.get = withDeprecatedKeys((state, scope, name) => {
65
+ const get = withDeprecatedKeys((state, scope, name) => {
36
66
  const value = state.preferences[scope]?.[name];
37
- return value !== undefined ? value : state.defaults[scope]?.[name];
67
+ return value !== void 0 ? value : state.defaults[scope]?.[name];
68
+ });
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {
71
+ get
38
72
  });
39
- //# sourceMappingURL=selectors.js.map
73
+ //# sourceMappingURL=selectors.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_deprecated","_interopRequireDefault","require","withDeprecatedKeys","originalGet","state","scope","name","settingsToMoveToCore","includes","deprecated","since","alternative","get","exports","value","preferences","undefined","defaults"],"sources":["@wordpress/preferences/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\nconst withDeprecatedKeys = ( originalGet ) => ( state, scope, name ) => {\n\tconst settingsToMoveToCore = [\n\t\t'allowRightClickOverrides',\n\t\t'distractionFree',\n\t\t'editorMode',\n\t\t'fixedToolbar',\n\t\t'focusMode',\n\t\t'hiddenBlockTypes',\n\t\t'inactivePanels',\n\t\t'keepCaretInsideBlock',\n\t\t'mostUsedBlocks',\n\t\t'openPanels',\n\t\t'showBlockBreadcrumbs',\n\t\t'showIconLabels',\n\t\t'showListViewByDefault',\n\t\t'isPublishSidebarEnabled',\n\t\t'isComplementaryAreaVisible',\n\t\t'pinnedItems',\n\t];\n\n\tif (\n\t\tsettingsToMoveToCore.includes( name ) &&\n\t\t[ 'core/edit-post', 'core/edit-site' ].includes( scope )\n\t) {\n\t\tdeprecated(\n\t\t\t`wp.data.select( 'core/preferences' ).get( '${ scope }', '${ name }' )`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\talternative: `wp.data.select( 'core/preferences' ).get( 'core', '${ name }' )`,\n\t\t\t}\n\t\t);\n\n\t\treturn originalGet( state, 'core', name );\n\t}\n\n\treturn originalGet( state, scope, name );\n};\n\n/**\n * Returns a boolean indicating whether a prefer is active for a particular\n * scope.\n *\n * @param {Object} state The store state.\n * @param {string} scope The scope of the feature (e.g. core/edit-post).\n * @param {string} name The name of the feature.\n *\n * @return {*} Is the feature enabled?\n */\nexport const get = withDeprecatedKeys( ( state, scope, name ) => {\n\tconst value = state.preferences[ scope ]?.[ name ];\n\treturn value !== undefined ? value : state.defaults[ scope ]?.[ name ];\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,kBAAkB,GAAKC,WAAW,IAAM,CAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,KAAM;EACvE,MAAMC,oBAAoB,GAAG,CAC5B,0BAA0B,EAC1B,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,EACzB,4BAA4B,EAC5B,aAAa,CACb;EAED,IACCA,oBAAoB,CAACC,QAAQ,CAAEF,IAAK,CAAC,IACrC,CAAE,gBAAgB,EAAE,gBAAgB,CAAE,CAACE,QAAQ,CAAEH,KAAM,CAAC,EACvD;IACD,IAAAI,mBAAU,EACT,8CAA+CJ,KAAK,OAASC,IAAI,KAAM,EACvE;MACCI,KAAK,EAAE,KAAK;MACZC,WAAW,EAAE,sDAAuDL,IAAI;IACzE,CACD,CAAC;IAED,OAAOH,WAAW,CAAEC,KAAK,EAAE,MAAM,EAAEE,IAAK,CAAC;EAC1C;EAEA,OAAOH,WAAW,CAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAK,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMM,GAAG,GAAAC,OAAA,CAAAD,GAAA,GAAGV,kBAAkB,CAAE,CAAEE,KAAK,EAAEC,KAAK,EAAEC,IAAI,KAAM;EAChE,MAAMQ,KAAK,GAAGV,KAAK,CAACW,WAAW,CAAEV,KAAK,CAAE,GAAIC,IAAI,CAAE;EAClD,OAAOQ,KAAK,KAAKE,SAAS,GAAGF,KAAK,GAAGV,KAAK,CAACa,QAAQ,CAAEZ,KAAK,CAAE,GAAIC,IAAI,CAAE;AACvE,CAAE,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/selectors.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\nconst withDeprecatedKeys = ( originalGet ) => ( state, scope, name ) => {\n\tconst settingsToMoveToCore = [\n\t\t'allowRightClickOverrides',\n\t\t'distractionFree',\n\t\t'editorMode',\n\t\t'fixedToolbar',\n\t\t'focusMode',\n\t\t'hiddenBlockTypes',\n\t\t'inactivePanels',\n\t\t'keepCaretInsideBlock',\n\t\t'mostUsedBlocks',\n\t\t'openPanels',\n\t\t'showBlockBreadcrumbs',\n\t\t'showIconLabels',\n\t\t'showListViewByDefault',\n\t\t'isPublishSidebarEnabled',\n\t\t'isComplementaryAreaVisible',\n\t\t'pinnedItems',\n\t];\n\n\tif (\n\t\tsettingsToMoveToCore.includes( name ) &&\n\t\t[ 'core/edit-post', 'core/edit-site' ].includes( scope )\n\t) {\n\t\tdeprecated(\n\t\t\t`wp.data.select( 'core/preferences' ).get( '${ scope }', '${ name }' )`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\talternative: `wp.data.select( 'core/preferences' ).get( 'core', '${ name }' )`,\n\t\t\t}\n\t\t);\n\n\t\treturn originalGet( state, 'core', name );\n\t}\n\n\treturn originalGet( state, scope, name );\n};\n\n/**\n * Returns a boolean indicating whether a prefer is active for a particular\n * scope.\n *\n * @param {Object} state The store state.\n * @param {string} scope The scope of the feature (e.g. core/edit-post).\n * @param {string} name The name of the feature.\n *\n * @return {*} Is the feature enabled?\n */\nexport const get = withDeprecatedKeys( ( state, scope, name ) => {\n\tconst value = state.preferences[ scope ]?.[ name ];\n\treturn value !== undefined ? value : state.defaults[ scope ]?.[ name ];\n} );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAuB;AAEvB,MAAM,qBAAqB,CAAE,gBAAiB,CAAE,OAAO,OAAO,SAAU;AACvE,QAAM,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,MACC,qBAAqB,SAAU,IAAK,KACpC,CAAE,kBAAkB,gBAAiB,EAAE,SAAU,KAAM,GACtD;AACD,0BAAAA;AAAA,MACC,8CAA+C,KAAM,OAAQ,IAAK;AAAA,MAClE;AAAA,QACC,OAAO;AAAA,QACP,aAAa,sDAAuD,IAAK;AAAA,MAC1E;AAAA,IACD;AAEA,WAAO,YAAa,OAAO,QAAQ,IAAK;AAAA,EACzC;AAEA,SAAO,YAAa,OAAO,OAAO,IAAK;AACxC;AAYO,MAAM,MAAM,mBAAoB,CAAE,OAAO,OAAO,SAAU;AAChE,QAAM,QAAQ,MAAM,YAAa,KAAM,IAAK,IAAK;AACjD,SAAO,UAAU,SAAY,QAAQ,MAAM,SAAU,KAAM,IAAK,IAAK;AACtE,CAAE;",
6
+ "names": ["deprecated"]
7
+ }
@@ -1,2 +1,5 @@
1
- export { default as PreferenceToggleMenuItem } from './preference-toggle-menu-item';
2
- //# sourceMappingURL=index.js.map
1
+ import { default as default2 } from "./preference-toggle-menu-item";
2
+ export {
3
+ default2 as PreferenceToggleMenuItem
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["default","PreferenceToggleMenuItem"],"sources":["@wordpress/preferences/src/components/index.js"],"sourcesContent":["export { default as PreferenceToggleMenuItem } from './preference-toggle-menu-item';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,wBAAwB,QAAQ,+BAA+B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/index.js"],
4
+ "sourcesContent": ["export { default as PreferenceToggleMenuItem } from './preference-toggle-menu-item';\n"],
5
+ "mappings": "AAAA,SAAoB,WAAXA,gBAA2C;",
6
+ "names": ["default"]
7
+ }