@wordpress/preferences 4.32.0 → 4.32.1-next.47f435fc9.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
|
@@ -1,14 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 });
|
|
11
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 components_exports = {};
|
|
29
|
+
__export(components_exports, {
|
|
30
|
+
PreferenceToggleMenuItem: () => import_preference_toggle_menu_item.default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(components_exports);
|
|
33
|
+
var import_preference_toggle_menu_item = __toESM(require("./preference-toggle-menu-item"));
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
PreferenceToggleMenuItem
|
|
12
37
|
});
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
38
|
+
//# 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;AAAA;AAAA;AAAA;AAAA;AAAA,yCAAoD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,32 +1,41 @@
|
|
|
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 preference_base_option_exports = {};
|
|
19
|
+
__export(preference_base_option_exports, {
|
|
20
|
+
default: () => preference_base_option_default
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
__nextHasNoMarginBottom: true,
|
|
24
|
-
help: help,
|
|
25
|
-
label: label,
|
|
26
|
-
checked: isChecked,
|
|
27
|
-
onChange: onChange
|
|
28
|
-
}), children]
|
|
29
|
-
});
|
|
22
|
+
module.exports = __toCommonJS(preference_base_option_exports);
|
|
23
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
|
+
var import_components = require("@wordpress/components");
|
|
25
|
+
function BaseOption({ help, label, isChecked, onChange, children }) {
|
|
26
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "preference-base-option", children: [
|
|
27
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
28
|
+
import_components.ToggleControl,
|
|
29
|
+
{
|
|
30
|
+
__nextHasNoMarginBottom: true,
|
|
31
|
+
help,
|
|
32
|
+
label,
|
|
33
|
+
checked: isChecked,
|
|
34
|
+
onChange
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
children
|
|
38
|
+
] });
|
|
30
39
|
}
|
|
31
|
-
var
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
|
40
|
+
var preference_base_option_default = BaseOption;
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/preference-base-option/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToggleControl } from '@wordpress/components';\n\nfunction BaseOption( { help, label, isChecked, onChange, children } ) {\n\treturn (\n\t\t<div className=\"preference-base-option\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\thelp={ help }\n\t\t\t\tlabel={ label }\n\t\t\t\tchecked={ isChecked }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default BaseOption;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOE;AAJF,wBAA8B;AAE9B,SAAS,WAAY,EAAE,MAAM,OAAO,WAAW,UAAU,SAAS,GAAI;AACrE,SACC,6CAAC,SAAI,WAAU,0BACd;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,yBAAuB;AAAA,QACvB;AAAA,QACA;AAAA,QACA,SAAU;AAAA,QACV;AAAA;AAAA,IACD;AAAA,IACE;AAAA,KACH;AAEF;AAEA,IAAO,iCAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,42 +1,64 @@
|
|
|
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 preference_toggle_control_exports = {};
|
|
29
|
+
__export(preference_toggle_control_exports, {
|
|
30
|
+
default: () => preference_toggle_control_default
|
|
6
31
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
32
|
+
module.exports = __toCommonJS(preference_toggle_control_exports);
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_data = require("@wordpress/data");
|
|
35
|
+
var import_store = require("../../store");
|
|
36
|
+
var import_preference_base_option = __toESM(require("../preference-base-option"));
|
|
20
37
|
function PreferenceToggleControl(props) {
|
|
21
38
|
const {
|
|
22
39
|
scope,
|
|
23
40
|
featureName,
|
|
24
|
-
onToggle = () => {
|
|
41
|
+
onToggle = () => {
|
|
42
|
+
},
|
|
25
43
|
...remainingProps
|
|
26
44
|
} = props;
|
|
27
|
-
const isChecked = (0,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
45
|
+
const isChecked = (0, import_data.useSelect)(
|
|
46
|
+
(select) => !!select(import_store.store).get(scope, featureName),
|
|
47
|
+
[scope, featureName]
|
|
48
|
+
);
|
|
49
|
+
const { toggle } = (0, import_data.useDispatch)(import_store.store);
|
|
31
50
|
const onChange = () => {
|
|
32
51
|
onToggle();
|
|
33
52
|
toggle(scope, featureName);
|
|
34
53
|
};
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
+
import_preference_base_option.default,
|
|
56
|
+
{
|
|
57
|
+
onChange,
|
|
58
|
+
isChecked,
|
|
59
|
+
...remainingProps
|
|
60
|
+
}
|
|
61
|
+
);
|
|
40
62
|
}
|
|
41
|
-
var
|
|
42
|
-
//# sourceMappingURL=index.js.map
|
|
63
|
+
var preference_toggle_control_default = PreferenceToggleControl;
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/preference-toggle-control/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as preferencesStore } from '../../store';\nimport PreferenceBaseOption from '../preference-base-option';\n\nfunction PreferenceToggleControl( props ) {\n\tconst {\n\t\tscope,\n\t\tfeatureName,\n\t\tonToggle = () => {},\n\t\t...remainingProps\n\t} = props;\n\tconst isChecked = useSelect(\n\t\t( select ) => !! select( preferencesStore ).get( scope, featureName ),\n\t\t[ scope, featureName ]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst onChange = () => {\n\t\tonToggle();\n\t\ttoggle( scope, featureName );\n\t};\n\n\treturn (\n\t\t<PreferenceBaseOption\n\t\t\tonChange={ onChange }\n\t\t\tisChecked={ isChecked }\n\t\t\t{ ...remainingProps }\n\t\t/>\n\t);\n}\n\nexport default PreferenceToggleControl;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BE;AA1BF,kBAAuC;AAKvC,mBAA0C;AAC1C,oCAAiC;AAEjC,SAAS,wBAAyB,OAAQ;AACzC,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA,WAAW,MAAM;AAAA,IAAC;AAAA,IAClB,GAAG;AAAA,EACJ,IAAI;AACJ,QAAM,gBAAY;AAAA,IACjB,CAAE,WAAY,CAAC,CAAE,OAAQ,aAAAA,KAAiB,EAAE,IAAK,OAAO,WAAY;AAAA,IACpE,CAAE,OAAO,WAAY;AAAA,EACtB;AACA,QAAM,EAAE,OAAO,QAAI,yBAAa,aAAAA,KAAiB;AACjD,QAAM,WAAW,MAAM;AACtB,aAAS;AACT,WAAQ,OAAO,WAAY;AAAA,EAC5B;AAEA,SACC;AAAA,IAAC,8BAAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA;AAAA,MACE,GAAG;AAAA;AAAA,EACN;AAEF;AAEA,IAAO,oCAAQ;",
|
|
6
|
+
"names": ["preferencesStore", "PreferenceBaseOption"]
|
|
7
|
+
}
|
|
@@ -1,24 +1,32 @@
|
|
|
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 preference_toggle_menu_item_exports = {};
|
|
19
|
+
__export(preference_toggle_menu_item_exports, {
|
|
20
|
+
default: () => PreferenceToggleMenuItem
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
/**
|
|
15
|
-
* WordPress dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
+
module.exports = __toCommonJS(preference_toggle_menu_item_exports);
|
|
23
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
|
+
var import_data = require("@wordpress/data");
|
|
25
|
+
var import_components = require("@wordpress/components");
|
|
26
|
+
var import_i18n = require("@wordpress/i18n");
|
|
27
|
+
var import_icons = require("@wordpress/icons");
|
|
28
|
+
var import_a11y = require("@wordpress/a11y");
|
|
29
|
+
var import_store = require("../../store");
|
|
22
30
|
function PreferenceToggleMenuItem({
|
|
23
31
|
scope,
|
|
24
32
|
name,
|
|
@@ -31,36 +39,46 @@ function PreferenceToggleMenuItem({
|
|
|
31
39
|
onToggle = () => null,
|
|
32
40
|
disabled = false
|
|
33
41
|
}) {
|
|
34
|
-
const isActive = (0,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
const isActive = (0, import_data.useSelect)(
|
|
43
|
+
(select) => !!select(import_store.store).get(scope, name),
|
|
44
|
+
[scope, name]
|
|
45
|
+
);
|
|
46
|
+
const { toggle } = (0, import_data.useDispatch)(import_store.store);
|
|
38
47
|
const speakMessage = () => {
|
|
39
48
|
if (isActive) {
|
|
40
|
-
const message = messageDeactivated || (0,
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
const message = messageDeactivated || (0, import_i18n.sprintf)(
|
|
50
|
+
/* translators: %s: preference name, e.g. 'Fullscreen mode' */
|
|
51
|
+
(0, import_i18n.__)("Preference deactivated - %s"),
|
|
52
|
+
label
|
|
53
|
+
);
|
|
54
|
+
(0, import_a11y.speak)(message);
|
|
43
55
|
} else {
|
|
44
|
-
const message = messageActivated || (0,
|
|
45
|
-
|
|
46
|
-
|
|
56
|
+
const message = messageActivated || (0, import_i18n.sprintf)(
|
|
57
|
+
/* translators: %s: preference name, e.g. 'Fullscreen mode' */
|
|
58
|
+
(0, import_i18n.__)("Preference activated - %s"),
|
|
59
|
+
label
|
|
60
|
+
);
|
|
61
|
+
(0, import_a11y.speak)(message);
|
|
47
62
|
}
|
|
48
63
|
};
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
65
|
+
import_components.MenuItem,
|
|
66
|
+
{
|
|
67
|
+
icon: isActive && import_icons.check,
|
|
68
|
+
isSelected: isActive,
|
|
69
|
+
onClick: () => {
|
|
70
|
+
onToggle();
|
|
71
|
+
if (handleToggling) {
|
|
72
|
+
toggle(scope, name);
|
|
73
|
+
}
|
|
74
|
+
speakMessage();
|
|
75
|
+
},
|
|
76
|
+
role: "menuitemcheckbox",
|
|
77
|
+
info,
|
|
78
|
+
shortcut,
|
|
79
|
+
disabled,
|
|
80
|
+
children: label
|
|
81
|
+
}
|
|
82
|
+
);
|
|
65
83
|
}
|
|
66
|
-
//# sourceMappingURL=index.js.map
|
|
84
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/preference-toggle-menu-item/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { MenuItem } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { store as preferencesStore } from '../../store';\n\nexport default function PreferenceToggleMenuItem( {\n\tscope,\n\tname,\n\tlabel,\n\tinfo,\n\tmessageActivated,\n\tmessageDeactivated,\n\tshortcut,\n\thandleToggling = true,\n\tonToggle = () => null,\n\tdisabled = false,\n} ) {\n\tconst isActive = useSelect(\n\t\t( select ) => !! select( preferencesStore ).get( scope, name ),\n\t\t[ scope, name ]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst speakMessage = () => {\n\t\tif ( isActive ) {\n\t\t\tconst message =\n\t\t\t\tmessageDeactivated ||\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: preference name, e.g. 'Fullscreen mode' */\n\t\t\t\t\t__( 'Preference deactivated - %s' ),\n\t\t\t\t\tlabel\n\t\t\t\t);\n\t\t\tspeak( message );\n\t\t} else {\n\t\t\tconst message =\n\t\t\t\tmessageActivated ||\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: preference name, e.g. 'Fullscreen mode' */\n\t\t\t\t\t__( 'Preference activated - %s' ),\n\t\t\t\t\tlabel\n\t\t\t\t);\n\t\t\tspeak( message );\n\t\t}\n\t};\n\n\treturn (\n\t\t<MenuItem\n\t\t\ticon={ isActive && check }\n\t\t\tisSelected={ isActive }\n\t\t\tonClick={ () => {\n\t\t\t\tonToggle();\n\t\t\t\tif ( handleToggling ) {\n\t\t\t\t\ttoggle( scope, name );\n\t\t\t\t}\n\t\t\t\tspeakMessage();\n\t\t\t} }\n\t\t\trole=\"menuitemcheckbox\"\n\t\t\tinfo={ info }\n\t\t\tshortcut={ shortcut }\n\t\t\tdisabled={ disabled }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsDE;AAnDF,kBAAuC;AACvC,wBAAyB;AACzB,kBAA4B;AAC5B,mBAAsB;AACtB,kBAAsB;AAKtB,mBAA0C;AAE3B,SAAR,yBAA2C;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,WAAW,MAAM;AAAA,EACjB,WAAW;AACZ,GAAI;AACH,QAAM,eAAW;AAAA,IAChB,CAAE,WAAY,CAAC,CAAE,OAAQ,aAAAA,KAAiB,EAAE,IAAK,OAAO,IAAK;AAAA,IAC7D,CAAE,OAAO,IAAK;AAAA,EACf;AACA,QAAM,EAAE,OAAO,QAAI,yBAAa,aAAAA,KAAiB;AACjD,QAAM,eAAe,MAAM;AAC1B,QAAK,UAAW;AACf,YAAM,UACL,0BACA;AAAA;AAAA,YAEC,gBAAI,6BAA8B;AAAA,QAClC;AAAA,MACD;AACD,6BAAO,OAAQ;AAAA,IAChB,OAAO;AACN,YAAM,UACL,wBACA;AAAA;AAAA,YAEC,gBAAI,2BAA4B;AAAA,QAChC;AAAA,MACD;AACD,6BAAO,OAAQ;AAAA,IAChB;AAAA,EACD;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO,YAAY;AAAA,MACnB,YAAa;AAAA,MACb,SAAU,MAAM;AACf,iBAAS;AACT,YAAK,gBAAiB;AACrB,iBAAQ,OAAO,IAAK;AAAA,QACrB;AACA,qBAAa;AAAA,MACd;AAAA,MACA,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MAEE;AAAA;AAAA,EACH;AAEF;",
|
|
6
|
+
"names": ["preferencesStore"]
|
|
7
|
+
}
|
|
@@ -1,25 +1,37 @@
|
|
|
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 preferences_modal_exports = {};
|
|
19
|
+
__export(preferences_modal_exports, {
|
|
20
|
+
default: () => PreferencesModal
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
title: (0, _i18n.__)('Preferences'),
|
|
21
|
-
onRequestClose: closeModal,
|
|
22
|
-
children: children
|
|
23
|
-
});
|
|
22
|
+
module.exports = __toCommonJS(preferences_modal_exports);
|
|
23
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
|
+
var import_components = require("@wordpress/components");
|
|
25
|
+
var import_i18n = require("@wordpress/i18n");
|
|
26
|
+
function PreferencesModal({ closeModal, children }) {
|
|
27
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
28
|
+
import_components.Modal,
|
|
29
|
+
{
|
|
30
|
+
className: "preferences-modal",
|
|
31
|
+
title: (0, import_i18n.__)("Preferences"),
|
|
32
|
+
onRequestClose: closeModal,
|
|
33
|
+
children
|
|
34
|
+
}
|
|
35
|
+
);
|
|
24
36
|
}
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/preferences-modal/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function PreferencesModal( { closeModal, children } ) {\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"preferences-modal\"\n\t\t\ttitle={ __( 'Preferences' ) }\n\t\t\tonRequestClose={ closeModal }\n\t\t>\n\t\t\t{ children }\n\t\t</Modal>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQE;AALF,wBAAsB;AACtB,kBAAmB;AAEJ,SAAR,iBAAmC,EAAE,YAAY,SAAS,GAAI;AACpE,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,WAAQ,gBAAI,aAAc;AAAA,MAC1B,gBAAiB;AAAA,MAEf;AAAA;AAAA,EACH;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,29 +1,32 @@
|
|
|
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 preferences_modal_section_exports = {};
|
|
19
|
+
__export(preferences_modal_section_exports, {
|
|
20
|
+
default: () => preferences_modal_section_default
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
const Section = ({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})
|
|
13
|
-
className: "preferences-modal__section",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
className: "preferences-modal__section-title",
|
|
18
|
-
children: title
|
|
19
|
-
}), description && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
20
|
-
className: "preferences-modal__section-description",
|
|
21
|
-
children: description
|
|
22
|
-
})]
|
|
23
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
24
|
-
className: "preferences-modal__section-content",
|
|
25
|
-
children: children
|
|
26
|
-
})]
|
|
27
|
-
});
|
|
28
|
-
var _default = exports.default = Section;
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
|
22
|
+
module.exports = __toCommonJS(preferences_modal_section_exports);
|
|
23
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
|
+
const Section = ({ description, title, children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", { className: "preferences-modal__section", children: [
|
|
25
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("legend", { className: "preferences-modal__section-legend", children: [
|
|
26
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "preferences-modal__section-title", children: title }),
|
|
27
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "preferences-modal__section-description", children: description })
|
|
28
|
+
] }),
|
|
29
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "preferences-modal__section-content", children })
|
|
30
|
+
] });
|
|
31
|
+
var preferences_modal_section_default = Section;
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/preferences-modal-section/index.js"],
|
|
4
|
+
"sourcesContent": ["const Section = ( { description, title, children } ) => (\n\t<fieldset className=\"preferences-modal__section\">\n\t\t<legend className=\"preferences-modal__section-legend\">\n\t\t\t<h2 className=\"preferences-modal__section-title\">{ title }</h2>\n\t\t\t{ description && (\n\t\t\t\t<p className=\"preferences-modal__section-description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t</legend>\n\t\t<div className=\"preferences-modal__section-content\">{ children }</div>\n\t</fieldset>\n);\n\nexport default Section;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEE;AAFF,MAAM,UAAU,CAAE,EAAE,aAAa,OAAO,SAAS,MAChD,6CAAC,cAAS,WAAU,8BACnB;AAAA,+CAAC,YAAO,WAAU,qCACjB;AAAA,gDAAC,QAAG,WAAU,oCAAqC,iBAAO;AAAA,IACxD,eACD,4CAAC,OAAE,WAAU,0CACV,uBACH;AAAA,KAEF;AAAA,EACA,4CAAC,SAAI,WAAU,sCAAuC,UAAU;AAAA,GACjE;AAGD,IAAO,oCAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|