@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.
- package/build/components/index.js +36 -12
- package/build/components/index.js.map +7 -1
- package/build/components/preference-base-option/index.js +39 -30
- package/build/components/preference-base-option/index.js.map +7 -1
- package/build/components/preference-toggle-control/index.js +52 -30
- package/build/components/preference-toggle-control/index.js.map +7 -1
- package/build/components/preference-toggle-menu-item/index.js +65 -47
- package/build/components/preference-toggle-menu-item/index.js.map +7 -1
- package/build/components/preferences-modal/index.js +35 -23
- package/build/components/preferences-modal/index.js.map +7 -1
- package/build/components/preferences-modal-section/index.js +31 -28
- package/build/components/preferences-modal-section/index.js.map +7 -1
- package/build/components/preferences-modal-tabs/index.js +123 -134
- package/build/components/preferences-modal-tabs/index.js.map +7 -1
- package/build/index.js +29 -36
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -15
- package/build/lock-unlock.js.map +7 -1
- package/build/private-apis.js +49 -24
- package/build/private-apis.js.map +7 -1
- package/build/store/actions.js +36 -69
- package/build/store/actions.js.map +7 -1
- package/build/store/constants.js +27 -12
- package/build/store/constants.js.map +7 -1
- package/build/store/index.js +44 -32
- package/build/store/index.js.map +7 -1
- package/build/store/reducer.js +39 -65
- package/build/store/reducer.js.map +7 -1
- package/build/store/selectors.js +67 -33
- package/build/store/selectors.js.map +7 -1
- package/build-module/components/index.js +5 -2
- package/build-module/components/index.js.map +7 -1
- package/build-module/components/preference-base-option/index.js +21 -24
- package/build-module/components/preference-base-option/index.js.map +7 -1
- package/build-module/components/preference-toggle-control/index.js +24 -23
- package/build-module/components/preference-toggle-control/index.js.map +7 -1
- package/build-module/components/preference-toggle-menu-item/index.js +46 -40
- package/build-module/components/preference-toggle-menu-item/index.js.map +7 -1
- package/build-module/components/preferences-modal/index.js +17 -17
- package/build-module/components/preferences-modal/index.js.map +7 -1
- package/build-module/components/preferences-modal-section/index.js +13 -23
- package/build-module/components/preferences-modal-section/index.js.map +7 -1
- package/build-module/components/preferences-modal-tabs/index.js +116 -127
- package/build-module/components/preferences-modal-tabs/index.js.map +7 -1
- package/build-module/index.js +7 -4
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/private-apis.js +11 -11
- package/build-module/private-apis.js.map +7 -1
- package/build-module/store/actions.js +15 -65
- package/build-module/store/actions.js.map +7 -1
- package/build-module/store/constants.js +5 -7
- package/build-module/store/constants.js.map +7 -1
- package/build-module/store/index.js +10 -22
- package/build-module/store/index.js.map +7 -1
- package/build-module/store/reducer.js +17 -59
- package/build-module/store/reducer.js.map +7 -1
- package/build-module/store/selectors.js +35 -26
- package/build-module/store/selectors.js.map +7 -1
- package/build-style/style-rtl.css +4 -158
- package/build-style/style.css +4 -158
- package/package.json +20 -12
- package/src/components/preference-base-option/style.scss +2 -0
- package/src/components/preferences-modal/style.scss +6 -2
- package/src/components/preferences-modal-section/style.scss +3 -0
- package/src/components/preferences-modal-tabs/style.scss +4 -1
- package/src/style.scss +4 -4
package/build/store/actions.js
CHANGED
|
@@ -1,95 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
50
|
+
type: "SET_PERSISTENCE_LAYER",
|
|
91
51
|
persistenceLayer,
|
|
92
52
|
persistedData
|
|
93
53
|
};
|
|
94
54
|
}
|
|
95
|
-
|
|
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
|
-
{
|
|
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
|
+
}
|
package/build/store/constants.js
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
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
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
{
|
|
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
|
+
}
|
package/build/store/index.js
CHANGED
|
@@ -1,36 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
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
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var actions =
|
|
11
|
-
var selectors =
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
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,
|
|
36
|
-
|
|
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
|
package/build/store/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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
|
+
}
|
package/build/store/reducer.js
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
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
|
|
7
|
-
|
|
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 ===
|
|
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
|
-
|
|
56
|
-
|
|
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 ===
|
|
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
|
-
|
|
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
|
|
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
|
-
{
|
|
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
|
+
}
|
package/build/store/selectors.js
CHANGED
|
@@ -1,39 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
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
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 !==
|
|
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
|
-
{
|
|
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
|
-
|
|
2
|
-
|
|
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
|
-
{
|
|
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
|
+
}
|