@wordpress/preferences 3.26.0 → 3.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/preference-base-option/index.js +31 -0
- package/build/components/preference-base-option/index.js.map +1 -0
- package/build/components/preference-toggle-control/index.js +42 -0
- package/build/components/preference-toggle-control/index.js.map +1 -0
- package/build/components/preference-toggle-menu-item/index.js +4 -1
- package/build/components/preference-toggle-menu-item/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +24 -0
- package/build/components/preferences-modal/index.js.map +1 -0
- package/build/components/preferences-modal-section/index.js +24 -0
- package/build/components/preferences-modal-section/index.js.map +1 -0
- package/build/components/preferences-modal-tabs/index.js +129 -0
- package/build/components/preferences-modal-tabs/index.js.map +1 -0
- package/build/index.js +12 -0
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +18 -0
- package/build/lock-unlock.js.map +1 -0
- package/build/private-apis.js +26 -0
- package/build/private-apis.js.map +1 -0
- package/build/store/constants.js +1 -2
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +4 -5
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +2 -4
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +21 -3
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/preference-base-option/index.js +24 -0
- package/build-module/components/preference-base-option/index.js.map +1 -0
- package/build-module/components/preference-toggle-control/index.js +34 -0
- package/build-module/components/preference-toggle-control/index.js.map +1 -0
- package/build-module/components/preference-toggle-menu-item/index.js +4 -1
- package/build-module/components/preference-toggle-menu-item/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +17 -0
- package/build-module/components/preferences-modal/index.js.map +1 -0
- package/build-module/components/preferences-modal-section/index.js +18 -0
- package/build-module/components/preferences-modal-section/index.js.map +1 -0
- package/build-module/components/preferences-modal-tabs/index.js +122 -0
- package/build-module/components/preferences-modal-tabs/index.js.map +1 -0
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js +9 -0
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/private-apis.js +18 -0
- package/build-module/private-apis.js.map +1 -0
- package/build-module/store/index.js +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/selectors.js +18 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +199 -0
- package/build-style/style.css +199 -0
- package/package.json +11 -8
- package/src/components/preference-base-option/README.md +40 -0
- package/src/components/preference-base-option/index.js +21 -0
- package/src/components/preference-base-option/style.scss +10 -0
- package/src/components/preference-toggle-control/index.js +38 -0
- package/src/components/preference-toggle-menu-item/index.js +4 -1
- package/src/components/preferences-modal/README.md +69 -0
- package/src/components/preferences-modal/index.js +17 -0
- package/src/components/preferences-modal/style.scss +21 -0
- package/src/components/preferences-modal-section/README.md +31 -0
- package/src/components/preferences-modal-section/index.js +15 -0
- package/src/components/preferences-modal-section/style.scss +28 -0
- package/src/components/preferences-modal-tabs/README.md +14 -0
- package/src/components/preferences-modal-tabs/index.js +178 -0
- package/src/components/preferences-modal-tabs/style.scss +48 -0
- package/src/index.js +1 -0
- package/src/lock-unlock.js +9 -0
- package/src/private-apis.js +18 -0
- package/src/store/index.js +1 -1
- package/src/store/selectors.js +42 -2
- package/src/style.scss +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _components = require("@wordpress/components");
|
|
9
|
+
/**
|
|
10
|
+
* WordPress dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
function BaseOption({
|
|
14
|
+
help,
|
|
15
|
+
label,
|
|
16
|
+
isChecked,
|
|
17
|
+
onChange,
|
|
18
|
+
children
|
|
19
|
+
}) {
|
|
20
|
+
return (0, _react.createElement)("div", {
|
|
21
|
+
className: "preference-base-option"
|
|
22
|
+
}, (0, _react.createElement)(_components.ToggleControl, {
|
|
23
|
+
__nextHasNoMarginBottom: true,
|
|
24
|
+
help: help,
|
|
25
|
+
label: label,
|
|
26
|
+
checked: isChecked,
|
|
27
|
+
onChange: onChange
|
|
28
|
+
}), children);
|
|
29
|
+
}
|
|
30
|
+
var _default = exports.default = BaseOption;
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_components","require","BaseOption","help","label","isChecked","onChange","children","_react","createElement","className","ToggleControl","__nextHasNoMarginBottom","checked","_default","exports","default"],"sources":["@wordpress/preferences/src/components/preference-base-option/index.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,SAASC,UAAUA,CAAE;EAAEC,IAAI;EAAEC,KAAK;EAAEC,SAAS;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EACrE,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAwB,GACtC,IAAAF,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAW,aAAa;IACbC,uBAAuB;IACvBT,IAAI,EAAGA,IAAM;IACbC,KAAK,EAAGA,KAAO;IACfS,OAAO,EAAGR,SAAW;IACrBC,QAAQ,EAAGA;EAAU,CACrB,CAAC,EACAC,QACE,CAAC;AAER;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcd,UAAU"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _data = require("@wordpress/data");
|
|
10
|
+
var _store = require("../../store");
|
|
11
|
+
var _preferenceBaseOption = _interopRequireDefault(require("../preference-base-option"));
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function PreferenceToggleControl(props) {
|
|
21
|
+
const {
|
|
22
|
+
scope,
|
|
23
|
+
featureName,
|
|
24
|
+
onToggle = () => {},
|
|
25
|
+
...remainingProps
|
|
26
|
+
} = props;
|
|
27
|
+
const isChecked = (0, _data.useSelect)(select => !!select(_store.store).get(scope, featureName), [scope, featureName]);
|
|
28
|
+
const {
|
|
29
|
+
toggle
|
|
30
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
31
|
+
const onChange = () => {
|
|
32
|
+
onToggle();
|
|
33
|
+
toggle(scope, featureName);
|
|
34
|
+
};
|
|
35
|
+
return (0, _react.createElement)(_preferenceBaseOption.default, {
|
|
36
|
+
onChange: onChange,
|
|
37
|
+
isChecked: isChecked,
|
|
38
|
+
...remainingProps
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
var _default = exports.default = PreferenceToggleControl;
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_store","_preferenceBaseOption","_interopRequireDefault","PreferenceToggleControl","props","scope","featureName","onToggle","remainingProps","isChecked","useSelect","select","preferencesStore","get","toggle","useDispatch","onChange","_react","createElement","default","_default","exports"],"sources":["@wordpress/preferences/src/components/preference-toggle-control/index.js"],"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"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA,SAASI,uBAAuBA,CAAEC,KAAK,EAAG;EACzC,MAAM;IACLC,KAAK;IACLC,WAAW;IACXC,QAAQ,GAAGA,CAAA,KAAM,CAAC,CAAC;IACnB,GAAGC;EACJ,CAAC,GAAGJ,KAAK;EACT,MAAMK,SAAS,GAAG,IAAAC,eAAS,EACxBC,MAAM,IAAM,CAAC,CAAEA,MAAM,CAAEC,YAAiB,CAAC,CAACC,GAAG,CAAER,KAAK,EAAEC,WAAY,CAAC,EACrE,CAAED,KAAK,EAAEC,WAAW,CACrB,CAAC;EACD,MAAM;IAAEQ;EAAO,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAiB,CAAC;EAClD,MAAMI,QAAQ,GAAGA,CAAA,KAAM;IACtBT,QAAQ,CAAC,CAAC;IACVO,MAAM,CAAET,KAAK,EAAEC,WAAY,CAAC;EAC7B,CAAC;EAED,OACC,IAAAW,MAAA,CAAAC,aAAA,EAACjB,qBAAA,CAAAkB,OAAoB;IACpBH,QAAQ,EAAGA,QAAU;IACrBP,SAAS,EAAGA,SAAW;IAAA,GAClBD;EAAc,CACnB,CAAC;AAEJ;AAAC,IAAAY,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEchB,uBAAuB"}
|
|
@@ -27,6 +27,7 @@ function PreferenceToggleMenuItem({
|
|
|
27
27
|
messageActivated,
|
|
28
28
|
messageDeactivated,
|
|
29
29
|
shortcut,
|
|
30
|
+
handleToggling = true,
|
|
30
31
|
onToggle = () => null,
|
|
31
32
|
disabled = false
|
|
32
33
|
}) {
|
|
@@ -50,7 +51,9 @@ function PreferenceToggleMenuItem({
|
|
|
50
51
|
isSelected: isActive,
|
|
51
52
|
onClick: () => {
|
|
52
53
|
onToggle();
|
|
53
|
-
|
|
54
|
+
if (handleToggling) {
|
|
55
|
+
toggle(scope, name);
|
|
56
|
+
}
|
|
54
57
|
speakMessage();
|
|
55
58
|
},
|
|
56
59
|
role: "menuitemcheckbox",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_components","_i18n","_icons","_a11y","_store","PreferenceToggleMenuItem","scope","name","label","info","messageActivated","messageDeactivated","shortcut","onToggle","disabled","isActive","useSelect","select","preferencesStore","get","toggle","useDispatch","speakMessage","message","sprintf","__","speak","_react","createElement","MenuItem","icon","check","isSelected","onClick","role"],"sources":["@wordpress/preferences/src/components/preference-toggle-menu-item/index.js"],"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\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\ttoggle( scope, name );\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"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGe,SAASM,wBAAwBA,CAAE;EACjDC,KAAK;EACLC,IAAI;EACJC,KAAK;EACLC,IAAI;EACJC,gBAAgB;EAChBC,kBAAkB;EAClBC,QAAQ;EACRC,QAAQ,GAAGA,CAAA,KAAM,IAAI;EACrBC,QAAQ,GAAG;AACZ,CAAC,EAAG;EACH,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EACvBC,MAAM,IAAM,CAAC,CAAEA,MAAM,CAAEC,YAAiB,CAAC,CAACC,GAAG,
|
|
1
|
+
{"version":3,"names":["_data","require","_components","_i18n","_icons","_a11y","_store","PreferenceToggleMenuItem","scope","name","label","info","messageActivated","messageDeactivated","shortcut","handleToggling","onToggle","disabled","isActive","useSelect","select","preferencesStore","get","toggle","useDispatch","speakMessage","message","sprintf","__","speak","_react","createElement","MenuItem","icon","check","isSelected","onClick","role"],"sources":["@wordpress/preferences/src/components/preference-toggle-menu-item/index.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGe,SAASM,wBAAwBA,CAAE;EACjDC,KAAK;EACLC,IAAI;EACJC,KAAK;EACLC,IAAI;EACJC,gBAAgB;EAChBC,kBAAkB;EAClBC,QAAQ;EACRC,cAAc,GAAG,IAAI;EACrBC,QAAQ,GAAGA,CAAA,KAAM,IAAI;EACrBC,QAAQ,GAAG;AACZ,CAAC,EAAG;EACH,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EACvBC,MAAM,IAAM,CAAC,CAAEA,MAAM,CAAEC,YAAiB,CAAC,CAACC,GAAG,CAAEd,KAAK,EAAEC,IAAK,CAAC,EAC9D,CAAED,KAAK,EAAEC,IAAI,CACd,CAAC;EACD,MAAM;IAAEc;EAAO,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAiB,CAAC;EAClD,MAAMI,YAAY,GAAGA,CAAA,KAAM;IAC1B,IAAKP,QAAQ,EAAG;MACf,MAAMQ,OAAO,GACZb,kBAAkB,IAClB,IAAAc,aAAO,GACN;MACA,IAAAC,QAAE,EAAE,6BAA8B,CAAC,EACnClB,KACD,CAAC;MACF,IAAAmB,WAAK,EAAEH,OAAQ,CAAC;IACjB,CAAC,MAAM;MACN,MAAMA,OAAO,GACZd,gBAAgB,IAChB,IAAAe,aAAO,GACN;MACA,IAAAC,QAAE,EAAE,2BAA4B,CAAC,EACjClB,KACD,CAAC;MACF,IAAAmB,WAAK,EAAEH,OAAQ,CAAC;IACjB;EACD,CAAC;EAED,OACC,IAAAI,MAAA,CAAAC,aAAA,EAAC7B,WAAA,CAAA8B,QAAQ;IACRC,IAAI,EAAGf,QAAQ,IAAIgB,YAAO;IAC1BC,UAAU,EAAGjB,QAAU;IACvBkB,OAAO,EAAGA,CAAA,KAAM;MACfpB,QAAQ,CAAC,CAAC;MACV,IAAKD,cAAc,EAAG;QACrBQ,MAAM,CAAEf,KAAK,EAAEC,IAAK,CAAC;MACtB;MACAgB,YAAY,CAAC,CAAC;IACf,CAAG;IACHY,IAAI,EAAC,kBAAkB;IACvB1B,IAAI,EAAGA,IAAM;IACbG,QAAQ,EAAGA,QAAU;IACrBG,QAAQ,EAAGA;EAAU,GAEnBP,KACO,CAAC;AAEb"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = PreferencesModal;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _components = require("@wordpress/components");
|
|
9
|
+
var _i18n = require("@wordpress/i18n");
|
|
10
|
+
/**
|
|
11
|
+
* WordPress dependencies
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
function PreferencesModal({
|
|
15
|
+
closeModal,
|
|
16
|
+
children
|
|
17
|
+
}) {
|
|
18
|
+
return (0, _react.createElement)(_components.Modal, {
|
|
19
|
+
className: "preferences-modal",
|
|
20
|
+
title: (0, _i18n.__)('Preferences'),
|
|
21
|
+
onRequestClose: closeModal
|
|
22
|
+
}, children);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","PreferencesModal","closeModal","children","_react","createElement","Modal","className","title","__","onRequestClose"],"sources":["@wordpress/preferences/src/components/preferences-modal/index.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIe,SAASE,gBAAgBA,CAAE;EAAEC,UAAU;EAAEC;AAAS,CAAC,EAAG;EACpE,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACP,WAAA,CAAAQ,KAAK;IACLC,SAAS,EAAC,mBAAmB;IAC7BC,KAAK,EAAG,IAAAC,QAAE,EAAE,aAAc,CAAG;IAC7BC,cAAc,EAAGR;EAAY,GAE3BC,QACI,CAAC;AAEV"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
const Section = ({
|
|
9
|
+
description,
|
|
10
|
+
title,
|
|
11
|
+
children
|
|
12
|
+
}) => (0, _react.createElement)("fieldset", {
|
|
13
|
+
className: "preferences-modal__section"
|
|
14
|
+
}, (0, _react.createElement)("legend", {
|
|
15
|
+
className: "preferences-modal__section-legend"
|
|
16
|
+
}, (0, _react.createElement)("h2", {
|
|
17
|
+
className: "preferences-modal__section-title"
|
|
18
|
+
}, title), description && (0, _react.createElement)("p", {
|
|
19
|
+
className: "preferences-modal__section-description"
|
|
20
|
+
}, description)), (0, _react.createElement)("div", {
|
|
21
|
+
className: "preferences-modal__section-content"
|
|
22
|
+
}, children));
|
|
23
|
+
var _default = exports.default = Section;
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Section","description","title","children","_react","createElement","className","_default","exports","default"],"sources":["@wordpress/preferences/src/components/preferences-modal-section/index.js"],"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"],"mappings":";;;;;;;AAAA,MAAMA,OAAO,GAAGA,CAAE;EAAEC,WAAW;EAAEC,KAAK;EAAEC;AAAS,CAAC,KACjD,IAAAC,MAAA,CAAAC,aAAA;EAAUC,SAAS,EAAC;AAA4B,GAC/C,IAAAF,MAAA,CAAAC,aAAA;EAAQC,SAAS,EAAC;AAAmC,GACpD,IAAAF,MAAA,CAAAC,aAAA;EAAIC,SAAS,EAAC;AAAkC,GAAGJ,KAAW,CAAC,EAC7DD,WAAW,IACZ,IAAAG,MAAA,CAAAC,aAAA;EAAGC,SAAS,EAAC;AAAwC,GAClDL,WACA,CAEG,CAAC,EACT,IAAAG,MAAA,CAAAC,aAAA;EAAKC,SAAS,EAAC;AAAoC,GAAGH,QAAe,CAC5D,CACV;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaT,OAAO"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = PreferencesModalTabs;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _compose = require("@wordpress/compose");
|
|
9
|
+
var _components = require("@wordpress/components");
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
var _icons = require("@wordpress/icons");
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
Tabs
|
|
24
|
+
} = (0, _lockUnlock.unlock)(_components.privateApis);
|
|
25
|
+
const PREFERENCES_MENU = 'preferences-menu';
|
|
26
|
+
function PreferencesModalTabs({
|
|
27
|
+
sections
|
|
28
|
+
}) {
|
|
29
|
+
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
30
|
+
|
|
31
|
+
// This is also used to sync the two different rendered components
|
|
32
|
+
// between small and large viewports.
|
|
33
|
+
const [activeMenu, setActiveMenu] = (0, _element.useState)(PREFERENCES_MENU);
|
|
34
|
+
/**
|
|
35
|
+
* Create helper objects from `sections` for easier data handling.
|
|
36
|
+
* `tabs` is used for creating the `Tabs` and `sectionsContentMap`
|
|
37
|
+
* is used for easier access to active tab's content.
|
|
38
|
+
*/
|
|
39
|
+
const {
|
|
40
|
+
tabs,
|
|
41
|
+
sectionsContentMap
|
|
42
|
+
} = (0, _element.useMemo)(() => {
|
|
43
|
+
let mappedTabs = {
|
|
44
|
+
tabs: [],
|
|
45
|
+
sectionsContentMap: {}
|
|
46
|
+
};
|
|
47
|
+
if (sections.length) {
|
|
48
|
+
mappedTabs = sections.reduce((accumulator, {
|
|
49
|
+
name,
|
|
50
|
+
tabLabel: title,
|
|
51
|
+
content
|
|
52
|
+
}) => {
|
|
53
|
+
accumulator.tabs.push({
|
|
54
|
+
name,
|
|
55
|
+
title
|
|
56
|
+
});
|
|
57
|
+
accumulator.sectionsContentMap[name] = content;
|
|
58
|
+
return accumulator;
|
|
59
|
+
}, {
|
|
60
|
+
tabs: [],
|
|
61
|
+
sectionsContentMap: {}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return mappedTabs;
|
|
65
|
+
}, [sections]);
|
|
66
|
+
let modalContent;
|
|
67
|
+
// We render different components based on the viewport size.
|
|
68
|
+
if (isLargeViewport) {
|
|
69
|
+
modalContent = (0, _react.createElement)("div", {
|
|
70
|
+
className: "preferences__tabs"
|
|
71
|
+
}, (0, _react.createElement)(Tabs, {
|
|
72
|
+
initialTabId: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined,
|
|
73
|
+
onSelect: setActiveMenu,
|
|
74
|
+
orientation: "vertical"
|
|
75
|
+
}, (0, _react.createElement)(Tabs.TabList, {
|
|
76
|
+
className: "preferences__tabs-tablist"
|
|
77
|
+
}, tabs.map(tab => (0, _react.createElement)(Tabs.Tab, {
|
|
78
|
+
tabId: tab.name,
|
|
79
|
+
key: tab.name,
|
|
80
|
+
className: "preferences__tabs-tab"
|
|
81
|
+
}, tab.title))), tabs.map(tab => (0, _react.createElement)(Tabs.TabPanel, {
|
|
82
|
+
tabId: tab.name,
|
|
83
|
+
key: tab.name,
|
|
84
|
+
className: "preferences__tabs-tabpanel",
|
|
85
|
+
focusable: false
|
|
86
|
+
}, sectionsContentMap[tab.name] || null))));
|
|
87
|
+
} else {
|
|
88
|
+
modalContent = (0, _react.createElement)(_components.__experimentalNavigatorProvider, {
|
|
89
|
+
initialPath: "/",
|
|
90
|
+
className: "preferences__provider"
|
|
91
|
+
}, (0, _react.createElement)(_components.__experimentalNavigatorScreen, {
|
|
92
|
+
path: "/"
|
|
93
|
+
}, (0, _react.createElement)(_components.Card, {
|
|
94
|
+
isBorderless: true,
|
|
95
|
+
size: "small"
|
|
96
|
+
}, (0, _react.createElement)(_components.CardBody, null, (0, _react.createElement)(_components.__experimentalItemGroup, null, tabs.map(tab => {
|
|
97
|
+
return (0, _react.createElement)(_components.__experimentalNavigatorButton, {
|
|
98
|
+
key: tab.name,
|
|
99
|
+
path: tab.name,
|
|
100
|
+
as: _components.__experimentalItem,
|
|
101
|
+
isAction: true
|
|
102
|
+
}, (0, _react.createElement)(_components.__experimentalHStack, {
|
|
103
|
+
justify: "space-between"
|
|
104
|
+
}, (0, _react.createElement)(_components.FlexItem, null, (0, _react.createElement)(_components.__experimentalTruncate, null, tab.title)), (0, _react.createElement)(_components.FlexItem, null, (0, _react.createElement)(_icons.Icon, {
|
|
105
|
+
icon: (0, _i18n.isRTL)() ? _icons.chevronLeft : _icons.chevronRight
|
|
106
|
+
}))));
|
|
107
|
+
}))))), sections.length && sections.map(section => {
|
|
108
|
+
return (0, _react.createElement)(_components.__experimentalNavigatorScreen, {
|
|
109
|
+
key: `${section.name}-menu`,
|
|
110
|
+
path: section.name
|
|
111
|
+
}, (0, _react.createElement)(_components.Card, {
|
|
112
|
+
isBorderless: true,
|
|
113
|
+
size: "large"
|
|
114
|
+
}, (0, _react.createElement)(_components.CardHeader, {
|
|
115
|
+
isBorderless: false,
|
|
116
|
+
justify: "left",
|
|
117
|
+
size: "small",
|
|
118
|
+
gap: "6"
|
|
119
|
+
}, (0, _react.createElement)(_components.__experimentalNavigatorBackButton, {
|
|
120
|
+
icon: (0, _i18n.isRTL)() ? _icons.chevronRight : _icons.chevronLeft,
|
|
121
|
+
"aria-label": (0, _i18n.__)('Navigate to the previous view')
|
|
122
|
+
}), (0, _react.createElement)(_components.__experimentalText, {
|
|
123
|
+
size: "16"
|
|
124
|
+
}, section.tabLabel)), (0, _react.createElement)(_components.CardBody, null, section.content)));
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
return modalContent;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_compose","require","_components","_element","_icons","_i18n","_lockUnlock","Tabs","unlock","componentsPrivateApis","PREFERENCES_MENU","PreferencesModalTabs","sections","isLargeViewport","useViewportMatch","activeMenu","setActiveMenu","useState","tabs","sectionsContentMap","useMemo","mappedTabs","length","reduce","accumulator","name","tabLabel","title","content","push","modalContent","_react","createElement","className","initialTabId","undefined","onSelect","orientation","TabList","map","tab","Tab","tabId","key","TabPanel","focusable","__experimentalNavigatorProvider","initialPath","__experimentalNavigatorScreen","path","Card","isBorderless","size","CardBody","__experimentalItemGroup","__experimentalNavigatorButton","as","Item","isAction","__experimentalHStack","justify","FlexItem","__experimentalTruncate","Icon","icon","isRTL","chevronLeft","chevronRight","section","CardHeader","gap","__experimentalNavigatorBackButton","__","__experimentalText"],"sources":["@wordpress/preferences/src/components/preferences-modal-tabs/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalNavigatorBackButton as NavigatorBackButton,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\t__experimentalTruncate as Truncate,\n\tFlexItem,\n\tCard,\n\tCardHeader,\n\tCardBody,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useMemo, useState } from '@wordpress/element';\nimport { chevronLeft, chevronRight, Icon } from '@wordpress/icons';\nimport { isRTL, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst PREFERENCES_MENU = 'preferences-menu';\n\nexport default function PreferencesModalTabs( { sections } ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\t// This is also used to sync the two different rendered components\n\t// between small and large viewports.\n\tconst [ activeMenu, setActiveMenu ] = useState( PREFERENCES_MENU );\n\t/**\n\t * Create helper objects from `sections` for easier data handling.\n\t * `tabs` is used for creating the `Tabs` and `sectionsContentMap`\n\t * is used for easier access to active tab's content.\n\t */\n\tconst { tabs, sectionsContentMap } = useMemo( () => {\n\t\tlet mappedTabs = {\n\t\t\ttabs: [],\n\t\t\tsectionsContentMap: {},\n\t\t};\n\t\tif ( sections.length ) {\n\t\t\tmappedTabs = sections.reduce(\n\t\t\t\t( accumulator, { name, tabLabel: title, content } ) => {\n\t\t\t\t\taccumulator.tabs.push( { name, title } );\n\t\t\t\t\taccumulator.sectionsContentMap[ name ] = content;\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ tabs: [], sectionsContentMap: {} }\n\t\t\t);\n\t\t}\n\t\treturn mappedTabs;\n\t}, [ sections ] );\n\n\tlet modalContent;\n\t// We render different components based on the viewport size.\n\tif ( isLargeViewport ) {\n\t\tmodalContent = (\n\t\t\t<div className=\"preferences__tabs\">\n\t\t\t\t<Tabs\n\t\t\t\t\tinitialTabId={\n\t\t\t\t\t\tactiveMenu !== PREFERENCES_MENU ? activeMenu : undefined\n\t\t\t\t\t}\n\t\t\t\t\tonSelect={ setActiveMenu }\n\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t>\n\t\t\t\t\t<Tabs.TabList className=\"preferences__tabs-tablist\">\n\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\tclassName=\"preferences__tabs-tab\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\tclassName=\"preferences__tabs-tabpanel\"\n\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sectionsContentMap[ tab.name ] || null }\n\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t) ) }\n\t\t\t\t</Tabs>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tmodalContent = (\n\t\t\t<NavigatorProvider\n\t\t\t\tinitialPath=\"/\"\n\t\t\t\tclassName=\"preferences__provider\"\n\t\t\t>\n\t\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t\t<Card isBorderless size=\"small\">\n\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tpath={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tas={ Item }\n\t\t\t\t\t\t\t\t\t\t\tisAction\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t</Card>\n\t\t\t\t</NavigatorScreen>\n\t\t\t\t{ sections.length &&\n\t\t\t\t\tsections.map( ( section ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<NavigatorScreen\n\t\t\t\t\t\t\t\tkey={ `${ section.name }-menu` }\n\t\t\t\t\t\t\t\tpath={ section.name }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Card isBorderless size=\"large\">\n\t\t\t\t\t\t\t\t\t<CardHeader\n\t\t\t\t\t\t\t\t\t\tisBorderless={ false }\n\t\t\t\t\t\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tgap=\"6\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<NavigatorBackButton\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Navigate to the previous view'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<Text size=\"16\">\n\t\t\t\t\t\t\t\t\t\t\t{ section.tabLabel }\n\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t</CardHeader>\n\t\t\t\t\t\t\t\t\t<CardBody>{ section.content }</CardBody>\n\t\t\t\t\t\t\t\t</Card>\n\t\t\t\t\t\t\t</NavigatorScreen>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t</NavigatorProvider>\n\t\t);\n\t}\n\n\treturn modalContent;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAgBA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AA3BA;AACA;AACA;;AAsBA;AACA;AACA;;AAGA,MAAM;EAAEM;AAAK,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAEhD,MAAMC,gBAAgB,GAAG,kBAAkB;AAE5B,SAASC,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC5D,MAAMC,eAAe,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;;EAEpD;EACA;EACA,MAAM,CAAEC,UAAU,EAAEC,aAAa,CAAE,GAAG,IAAAC,iBAAQ,EAAEP,gBAAiB,CAAC;EAClE;AACD;AACA;AACA;AACA;EACC,MAAM;IAAEQ,IAAI;IA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,CAAE,CACe,CACnB;EACF;EAEA,OAAOE,YAAY;AACpB"}
|
package/build/index.js
CHANGED
|
@@ -25,4 +25,16 @@ Object.keys(_components).forEach(function (key) {
|
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
27
|
var _store = require("./store");
|
|
28
|
+
var _privateApis = require("./private-apis");
|
|
29
|
+
Object.keys(_privateApis).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
32
|
+
if (key in exports && exports[key] === _privateApis[key]) return;
|
|
33
|
+
Object.defineProperty(exports, key, {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return _privateApis[key];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
28
40
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_store"],"sources":["@wordpress/preferences/src/index.js"],"sourcesContent":["export * from './components';\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,MAAA,GAAAb,OAAA"}
|
|
1
|
+
{"version":3,"names":["_components","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_store","_privateApis"],"sources":["@wordpress/preferences/src/index.js"],"sourcesContent":["export * from './components';\nexport { store } from './store';\nexport * from './private-apis';\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,MAAA,GAAAb,OAAA;AACA,IAAAc,YAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,YAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,YAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,YAAA,CAAAV,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.unlock = exports.lock = void 0;
|
|
7
|
+
var _privateApis = require("@wordpress/private-apis");
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
lock,
|
|
14
|
+
unlock
|
|
15
|
+
} = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/preferences');
|
|
16
|
+
exports.unlock = unlock;
|
|
17
|
+
exports.lock = lock;
|
|
18
|
+
//# sourceMappingURL=lock-unlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/preferences/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/preferences'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAEO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,iHAAiH,EACjH,wBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.privateApis = void 0;
|
|
8
|
+
var _preferenceBaseOption = _interopRequireDefault(require("./components/preference-base-option"));
|
|
9
|
+
var _preferenceToggleControl = _interopRequireDefault(require("./components/preference-toggle-control"));
|
|
10
|
+
var _preferencesModal = _interopRequireDefault(require("./components/preferences-modal"));
|
|
11
|
+
var _preferencesModalSection = _interopRequireDefault(require("./components/preferences-modal-section"));
|
|
12
|
+
var _preferencesModalTabs = _interopRequireDefault(require("./components/preferences-modal-tabs"));
|
|
13
|
+
var _lockUnlock = require("./lock-unlock");
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const privateApis = exports.privateApis = {};
|
|
19
|
+
(0, _lockUnlock.lock)(privateApis, {
|
|
20
|
+
PreferenceBaseOption: _preferenceBaseOption.default,
|
|
21
|
+
PreferenceToggleControl: _preferenceToggleControl.default,
|
|
22
|
+
PreferencesModal: _preferencesModal.default,
|
|
23
|
+
PreferencesModalSection: _preferencesModalSection.default,
|
|
24
|
+
PreferencesModalTabs: _preferencesModalTabs.default
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=private-apis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_preferenceBaseOption","_interopRequireDefault","require","_preferenceToggleControl","_preferencesModal","_preferencesModalSection","_preferencesModalTabs","_lockUnlock","privateApis","exports","lock","PreferenceBaseOption","PreferenceToggleControl","PreferencesModal","PreferencesModalSection","PreferencesModalTabs"],"sources":["@wordpress/preferences/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PreferenceBaseOption from './components/preference-base-option';\nimport PreferenceToggleControl from './components/preference-toggle-control';\nimport PreferencesModal from './components/preferences-modal';\nimport PreferencesModalSection from './components/preferences-modal-section';\nimport PreferencesModalTabs from './components/preferences-modal-tabs';\nimport { lock } from './lock-unlock';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tPreferenceBaseOption,\n\tPreferenceToggleControl,\n\tPreferencesModal,\n\tPreferencesModalSection,\n\tPreferencesModalTabs,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,wBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,qBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AARA;AACA;AACA;;AAQO,MAAMM,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,CAAC,CAAC;AAC7B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,oBAAoB,EAApBA,6BAAoB;EACpBC,uBAAuB,EAAvBA,gCAAuB;EACvBC,gBAAgB,EAAhBA,yBAAgB;EAChBC,uBAAuB,EAAvBA,gCAAuB;EACvBC,oBAAoB,EAApBA;AACD,CAAE,CAAC"}
|
package/build/store/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
package/build/store/index.js
CHANGED
|
@@ -10,8 +10,8 @@ var _reducer = _interopRequireDefault(require("./reducer"));
|
|
|
10
10
|
var actions = _interopRequireWildcard(require("./actions"));
|
|
11
11
|
var selectors = _interopRequireWildcard(require("./selectors"));
|
|
12
12
|
var _constants = require("./constants");
|
|
13
|
-
function _getRequireWildcardCache(
|
|
14
|
-
function _interopRequireWildcard(
|
|
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 && Object.prototype.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
15
|
/**
|
|
16
16
|
* WordPress dependencies
|
|
17
17
|
*/
|
|
@@ -21,17 +21,16 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* Store definition for the
|
|
24
|
+
* Store definition for the preferences namespace.
|
|
25
25
|
*
|
|
26
26
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
|
|
27
27
|
*
|
|
28
28
|
* @type {Object}
|
|
29
29
|
*/
|
|
30
|
-
const store = (0, _data.createReduxStore)(_constants.STORE_NAME, {
|
|
30
|
+
const store = exports.store = (0, _data.createReduxStore)(_constants.STORE_NAME, {
|
|
31
31
|
reducer: _reducer.default,
|
|
32
32
|
actions,
|
|
33
33
|
selectors
|
|
34
34
|
});
|
|
35
|
-
exports.store = store;
|
|
36
35
|
(0, _data.register)(store);
|
|
37
36
|
//# sourceMappingURL=index.js.map
|
package/build/store/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_reducer","_interopRequireDefault","actions","_interopRequireWildcard","selectors","_constants","_getRequireWildcardCache","
|
|
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","prototype","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,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAXzC;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMY,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG,IAAAE,sBAAgB,EAAEC,qBAAU,EAAE;EAClDC,OAAO,EAAPA,gBAAO;EACP7B,OAAO;EACPE;AACD,CAAE,CAAC;AAEH,IAAA4B,cAAQ,EAAEL,KAAM,CAAC"}
|
package/build/store/reducer.js
CHANGED
|
@@ -78,7 +78,7 @@ function withPersistenceLayer(reducer) {
|
|
|
78
78
|
*
|
|
79
79
|
* @return {Object} Updated state.
|
|
80
80
|
*/
|
|
81
|
-
const preferences = withPersistenceLayer((state = {}, action) => {
|
|
81
|
+
const preferences = exports.preferences = withPersistenceLayer((state = {}, action) => {
|
|
82
82
|
if (action.type === 'SET_PREFERENCE_VALUE') {
|
|
83
83
|
const {
|
|
84
84
|
scope,
|
|
@@ -95,10 +95,8 @@ const preferences = withPersistenceLayer((state = {}, action) => {
|
|
|
95
95
|
}
|
|
96
96
|
return state;
|
|
97
97
|
});
|
|
98
|
-
exports.
|
|
99
|
-
var _default = (0, _data.combineReducers)({
|
|
98
|
+
var _default = exports.default = (0, _data.combineReducers)({
|
|
100
99
|
defaults,
|
|
101
100
|
preferences
|
|
102
101
|
});
|
|
103
|
-
exports.default = _default;
|
|
104
102
|
//# sourceMappingURL=reducer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","defaults","state","action","type","scope","values","withPersistenceLayer","reducer","persistenceLayer","persistence","persistedData","nextState","set","preferences","
|
|
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"}
|
package/build/store/selectors.js
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.get =
|
|
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'];
|
|
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);
|
|
21
|
+
}
|
|
22
|
+
return originalGet(state, scope, name);
|
|
23
|
+
};
|
|
24
|
+
|
|
7
25
|
/**
|
|
8
26
|
* Returns a boolean indicating whether a prefer is active for a particular
|
|
9
27
|
* scope.
|
|
@@ -14,8 +32,8 @@ exports.get = get;
|
|
|
14
32
|
*
|
|
15
33
|
* @return {*} Is the feature enabled?
|
|
16
34
|
*/
|
|
17
|
-
|
|
35
|
+
const get = exports.get = withDeprecatedKeys((state, scope, name) => {
|
|
18
36
|
const value = state.preferences[scope]?.[name];
|
|
19
37
|
return value !== undefined ? value : state.defaults[scope]?.[name];
|
|
20
|
-
}
|
|
38
|
+
});
|
|
21
39
|
//# sourceMappingURL=selectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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];\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,IAA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