@wordpress/interface 5.10.0 → 5.12.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/action-item/index.js +25 -30
- package/build/components/action-item/index.js.map +1 -1
- package/build/components/complementary-area/index.js +27 -30
- package/build/components/complementary-area/index.js.map +1 -1
- package/build/components/complementary-area-header/index.js +6 -7
- package/build/components/complementary-area-header/index.js.map +1 -1
- package/build/components/complementary-area-more-menu-item/index.js +15 -19
- package/build/components/complementary-area-more-menu-item/index.js.map +1 -1
- package/build/components/complementary-area-toggle/index.js +9 -10
- package/build/components/complementary-area-toggle/index.js.map +1 -1
- package/build/components/fullscreen-mode/index.js +3 -4
- package/build/components/fullscreen-mode/index.js.map +1 -1
- package/build/components/interface-skeleton/index.js +17 -18
- package/build/components/interface-skeleton/index.js.map +1 -1
- package/build/components/more-menu-dropdown/index.js +11 -12
- package/build/components/more-menu-dropdown/index.js.map +1 -1
- package/build/components/more-menu-feature-toggle/index.js +9 -10
- package/build/components/more-menu-feature-toggle/index.js.map +1 -1
- package/build/components/navigable-region/index.js +7 -8
- package/build/components/navigable-region/index.js.map +1 -1
- package/build/components/pinned-items/index.js +10 -12
- package/build/components/pinned-items/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +4 -5
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal-base-option/index.js +7 -8
- package/build/components/preferences-modal-base-option/index.js.map +1 -1
- package/build/components/preferences-modal-section/index.js +13 -16
- package/build/components/preferences-modal-section/index.js.map +1 -1
- package/build/components/preferences-modal-tabs/index.js +8 -10
- package/build/components/preferences-modal-tabs/index.js.map +1 -1
- package/build/store/actions.js +23 -33
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +1 -4
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +3 -7
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/action-item/index.js +25 -30
- package/build-module/components/action-item/index.js.map +1 -1
- package/build-module/components/complementary-area/index.js +27 -30
- package/build-module/components/complementary-area/index.js.map +1 -1
- package/build-module/components/complementary-area-header/index.js +6 -7
- package/build-module/components/complementary-area-header/index.js.map +1 -1
- package/build-module/components/complementary-area-more-menu-item/index.js +14 -18
- package/build-module/components/complementary-area-more-menu-item/index.js.map +1 -1
- package/build-module/components/complementary-area-toggle/index.js +9 -10
- package/build-module/components/complementary-area-toggle/index.js.map +1 -1
- package/build-module/components/fullscreen-mode/index.js +3 -4
- package/build-module/components/fullscreen-mode/index.js.map +1 -1
- package/build-module/components/interface-skeleton/index.js +17 -18
- package/build-module/components/interface-skeleton/index.js.map +1 -1
- package/build-module/components/more-menu-dropdown/index.js +10 -11
- package/build-module/components/more-menu-dropdown/index.js.map +1 -1
- package/build-module/components/more-menu-feature-toggle/index.js +9 -10
- package/build-module/components/more-menu-feature-toggle/index.js.map +1 -1
- package/build-module/components/navigable-region/index.js +7 -8
- package/build-module/components/navigable-region/index.js.map +1 -1
- package/build-module/components/pinned-items/index.js +10 -12
- package/build-module/components/pinned-items/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +4 -5
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal-base-option/index.js +7 -8
- package/build-module/components/preferences-modal-base-option/index.js.map +1 -1
- package/build-module/components/preferences-modal-section/index.js +13 -16
- package/build-module/components/preferences-modal-section/index.js.map +1 -1
- package/build-module/components/preferences-modal-tabs/index.js +8 -10
- package/build-module/components/preferences-modal-tabs/index.js.map +1 -1
- package/build-module/store/actions.js +23 -33
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +1 -4
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +3 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/package.json +13 -13
|
@@ -16,14 +16,13 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
16
16
|
/**
|
|
17
17
|
* External dependencies
|
|
18
18
|
*/
|
|
19
|
-
function NavigableRegion(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} = _ref;
|
|
19
|
+
function NavigableRegion({
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
ariaLabel,
|
|
23
|
+
as: Tag = 'div',
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
27
26
|
return (0, _element.createElement)(Tag, (0, _extends2.default)({
|
|
28
27
|
className: (0, _classnames.default)('interface-navigable-region', className),
|
|
29
28
|
"aria-label": ariaLabel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/navigable-region/index.js"],"names":["NavigableRegion","children","className","ariaLabel","as","Tag","props"],"mappings":";;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,eAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/navigable-region/index.js"],"names":["NavigableRegion","children","className","ariaLabel","as","Tag","props"],"mappings":";;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,eAAT,CAA0B;AACxCC,EAAAA,QADwC;AAExCC,EAAAA,SAFwC;AAGxCC,EAAAA,SAHwC;AAIxCC,EAAAA,EAAE,EAAEC,GAAG,GAAG,KAJ8B;AAKxC,KAAGC;AALqC,CAA1B,EAMX;AACH,SACC,4BAAC,GAAD;AACC,IAAA,SAAS,EAAG,yBAAY,4BAAZ,EAA0CJ,SAA1C,CADb;AAEC,kBAAaC,SAFd;AAGC,IAAA,IAAI,EAAC,QAHN;AAIC,IAAA,QAAQ,EAAC;AAJV,KAKMG,KALN,GAOGL,QAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\nexport default function NavigableRegion( {\n\tchildren,\n\tclassName,\n\tariaLabel,\n\tas: Tag = 'div',\n\t...props\n} ) {\n\treturn (\n\t\t<Tag\n\t\t\tclassName={ classnames( 'interface-navigable-region', className ) }\n\t\t\taria-label={ ariaLabel }\n\t\t\trole=\"region\"\n\t\t\ttabIndex=\"-1\"\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</Tag>\n\t);\n}\n"]}
|
|
@@ -22,25 +22,23 @@ var _components = require("@wordpress/components");
|
|
|
22
22
|
/**
|
|
23
23
|
* WordPress dependencies
|
|
24
24
|
*/
|
|
25
|
-
function PinnedItems(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = _ref;
|
|
25
|
+
function PinnedItems({
|
|
26
|
+
scope,
|
|
27
|
+
...props
|
|
28
|
+
}) {
|
|
30
29
|
return (0, _element.createElement)(_components.Fill, (0, _extends2.default)({
|
|
31
30
|
name: `PinnedItems/${scope}`
|
|
32
31
|
}, props));
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
function PinnedItemsSlot(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} = _ref2;
|
|
34
|
+
function PinnedItemsSlot({
|
|
35
|
+
scope,
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}) {
|
|
41
39
|
return (0, _element.createElement)(_components.Slot, (0, _extends2.default)({
|
|
42
40
|
name: `PinnedItems/${scope}`
|
|
43
|
-
}, props), fills =>
|
|
41
|
+
}, props), fills => fills?.length > 0 && (0, _element.createElement)("div", {
|
|
44
42
|
className: (0, _classnames.default)(className, 'interface-pinned-items')
|
|
45
43
|
}, fills));
|
|
46
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/pinned-items/index.js"],"names":["PinnedItems","scope","props","PinnedItemsSlot","className","fills","length","Slot"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,SAASA,WAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/pinned-items/index.js"],"names":["PinnedItems","scope","props","PinnedItemsSlot","className","fills","length","Slot"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,SAASA,WAAT,CAAsB;AAAEC,EAAAA,KAAF;AAAS,KAAGC;AAAZ,CAAtB,EAA4C;AAC3C,SAAO,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAI,eAAeD,KAAO;AAApC,KAA6CC,KAA7C,EAAP;AACA;;AAED,SAASC,eAAT,CAA0B;AAAEF,EAAAA,KAAF;AAASG,EAAAA,SAAT;AAAoB,KAAGF;AAAvB,CAA1B,EAA2D;AAC1D,SACC,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAI,eAAeD,KAAO;AAApC,KAA6CC,KAA7C,GACKG,KAAF,IACDA,KAAK,EAAEC,MAAP,GAAgB,CAAhB,IACC;AACC,IAAA,SAAS,EAAG,yBACXF,SADW,EAEX,wBAFW;AADb,KAMGC,KANH,CAHH,CADD;AAgBA;;AAEDL,WAAW,CAACO,IAAZ,GAAmBJ,eAAnB;eAEeH,W","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Slot, Fill } from '@wordpress/components';\n\nfunction PinnedItems( { scope, ...props } ) {\n\treturn <Fill name={ `PinnedItems/${ scope }` } { ...props } />;\n}\n\nfunction PinnedItemsSlot( { scope, className, ...props } ) {\n\treturn (\n\t\t<Slot name={ `PinnedItems/${ scope }` } { ...props }>\n\t\t\t{ ( fills ) =>\n\t\t\t\tfills?.length > 0 && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t'interface-pinned-items'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t</Slot>\n\t);\n}\n\nPinnedItems.Slot = PinnedItemsSlot;\n\nexport default PinnedItems;\n"]}
|
|
@@ -14,11 +14,10 @@ var _i18n = require("@wordpress/i18n");
|
|
|
14
14
|
/**
|
|
15
15
|
* WordPress dependencies
|
|
16
16
|
*/
|
|
17
|
-
function PreferencesModal(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _ref;
|
|
17
|
+
function PreferencesModal({
|
|
18
|
+
closeModal,
|
|
19
|
+
children
|
|
20
|
+
}) {
|
|
22
21
|
return (0, _element.createElement)(_components.Modal, {
|
|
23
22
|
className: "interface-preferences-modal",
|
|
24
23
|
title: (0, _i18n.__)('Preferences'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/preferences-modal/index.js"],"names":["PreferencesModal","closeModal","children"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIe,SAASA,gBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/preferences-modal/index.js"],"names":["PreferencesModal","closeModal","children"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIe,SAASA,gBAAT,CAA2B;AAAEC,EAAAA,UAAF;AAAcC,EAAAA;AAAd,CAA3B,EAAsD;AACpE,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,6BADX;AAEC,IAAA,KAAK,EAAG,cAAI,aAAJ,CAFT;AAGC,IAAA,cAAc,EAAGD;AAHlB,KAKGC,QALH,CADD;AASA","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=\"interface-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"]}
|
|
@@ -12,14 +12,13 @@ var _components = require("@wordpress/components");
|
|
|
12
12
|
/**
|
|
13
13
|
* WordPress dependencies
|
|
14
14
|
*/
|
|
15
|
-
function BaseOption(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = _ref;
|
|
15
|
+
function BaseOption({
|
|
16
|
+
help,
|
|
17
|
+
label,
|
|
18
|
+
isChecked,
|
|
19
|
+
onChange,
|
|
20
|
+
children
|
|
21
|
+
}) {
|
|
23
22
|
return (0, _element.createElement)("div", {
|
|
24
23
|
className: "interface-preferences-modal__option"
|
|
25
24
|
}, (0, _element.createElement)(_components.ToggleControl, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/preferences-modal-base-option/index.js"],"names":["BaseOption","help","label","isChecked","onChange","children"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,SAASA,UAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/preferences-modal-base-option/index.js"],"names":["BaseOption","help","label","isChecked","onChange","children"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,SAASA,UAAT,CAAqB;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,KAAR;AAAeC,EAAAA,SAAf;AAA0BC,EAAAA,QAA1B;AAAoCC,EAAAA;AAApC,CAArB,EAAsE;AACrE,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,yBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,IAAI,EAAGJ,IAFR;AAGC,IAAA,KAAK,EAAGC,KAHT;AAIC,IAAA,OAAO,EAAGC,SAJX;AAKC,IAAA,QAAQ,EAAGC;AALZ,IADD,EAQGC,QARH,CADD;AAYA;;eAEcL,U","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=\"interface-preferences-modal__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"]}
|
|
@@ -7,22 +7,19 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _element = require("@wordpress/element");
|
|
9
9
|
|
|
10
|
-
const Section =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
className: "interface-preferences-modal__section-description"
|
|
24
|
-
}, description)), children);
|
|
25
|
-
};
|
|
10
|
+
const Section = ({
|
|
11
|
+
description,
|
|
12
|
+
title,
|
|
13
|
+
children
|
|
14
|
+
}) => (0, _element.createElement)("fieldset", {
|
|
15
|
+
className: "interface-preferences-modal__section"
|
|
16
|
+
}, (0, _element.createElement)("legend", {
|
|
17
|
+
className: "interface-preferences-modal__section-legend"
|
|
18
|
+
}, (0, _element.createElement)("h2", {
|
|
19
|
+
className: "interface-preferences-modal__section-title"
|
|
20
|
+
}, title), description && (0, _element.createElement)("p", {
|
|
21
|
+
className: "interface-preferences-modal__section-description"
|
|
22
|
+
}, description)), children);
|
|
26
23
|
|
|
27
24
|
var _default = Section;
|
|
28
25
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/preferences-modal-section/index.js"],"names":["Section","description","title","children"],"mappings":";;;;;;;;;AAAA,MAAMA,OAAO,GAAG
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/preferences-modal-section/index.js"],"names":["Section","description","title","children"],"mappings":";;;;;;;;;AAAA,MAAMA,OAAO,GAAG,CAAE;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,KAAf;AAAsBC,EAAAA;AAAtB,CAAF,KACf;AAAU,EAAA,SAAS,EAAC;AAApB,GACC;AAAQ,EAAA,SAAS,EAAC;AAAlB,GACC;AAAI,EAAA,SAAS,EAAC;AAAd,GACGD,KADH,CADD,EAIGD,WAAW,IACZ;AAAG,EAAA,SAAS,EAAC;AAAb,GACGA,WADH,CALF,CADD,EAWGE,QAXH,CADD;;eAgBeH,O","sourcesContent":["const Section = ( { description, title, children } ) => (\n\t<fieldset className=\"interface-preferences-modal__section\">\n\t\t<legend className=\"interface-preferences-modal__section-legend\">\n\t\t\t<h2 className=\"interface-preferences-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t\t{ description && (\n\t\t\t\t<p className=\"interface-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{ children }\n\t</fieldset>\n);\n\nexport default Section;\n"]}
|
|
@@ -20,10 +20,9 @@ var _i18n = require("@wordpress/i18n");
|
|
|
20
20
|
*/
|
|
21
21
|
const PREFERENCES_MENU = 'preferences-menu';
|
|
22
22
|
|
|
23
|
-
function PreferencesModalTabs(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} = _ref;
|
|
23
|
+
function PreferencesModalTabs({
|
|
24
|
+
sections
|
|
25
|
+
}) {
|
|
27
26
|
const isLargeViewport = (0, _compose.useViewportMatch)('medium'); // This is also used to sync the two different rendered components
|
|
28
27
|
// between small and large viewports.
|
|
29
28
|
|
|
@@ -44,12 +43,11 @@ function PreferencesModalTabs(_ref) {
|
|
|
44
43
|
};
|
|
45
44
|
|
|
46
45
|
if (sections.length) {
|
|
47
|
-
mappedTabs = sections.reduce((accumulator,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
} = _ref2;
|
|
46
|
+
mappedTabs = sections.reduce((accumulator, {
|
|
47
|
+
name,
|
|
48
|
+
tabLabel: title,
|
|
49
|
+
content
|
|
50
|
+
}) => {
|
|
53
51
|
accumulator.tabs.push({
|
|
54
52
|
name,
|
|
55
53
|
title
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/preferences-modal-tabs/index.js"],"names":["PREFERENCES_MENU","PreferencesModalTabs","sections","isLargeViewport","activeMenu","setActiveMenu","tabs","sectionsContentMap","mappedTabs","length","reduce","accumulator","name","tabLabel","title","content","push","getCurrentTab","tab","modalContent","undefined","map","Item","chevronLeft","chevronRight","section"],"mappings":";;;;;;;AAoBA;;AAjBA;;AACA;;AAiBA;;AACA;;AAtBA;AACA;AACA;AAsBA,MAAMA,gBAAgB,GAAG,kBAAzB;;AAEe,SAASC,oBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/preferences-modal-tabs/index.js"],"names":["PREFERENCES_MENU","PreferencesModalTabs","sections","isLargeViewport","activeMenu","setActiveMenu","tabs","sectionsContentMap","mappedTabs","length","reduce","accumulator","name","tabLabel","title","content","push","getCurrentTab","tab","modalContent","undefined","map","Item","chevronLeft","chevronRight","section"],"mappings":";;;;;;;AAoBA;;AAjBA;;AACA;;AAiBA;;AACA;;AAtBA;AACA;AACA;AAsBA,MAAMA,gBAAgB,GAAG,kBAAzB;;AAEe,SAASC,oBAAT,CAA+B;AAAEC,EAAAA;AAAF,CAA/B,EAA8C;AAC5D,QAAMC,eAAe,GAAG,+BAAkB,QAAlB,CAAxB,CAD4D,CAG5D;AACA;;AACA,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,uBAAUL,gBAAV,CAAtC;AACA;AACD;AACA;AACA;AACA;;AACC,QAAM;AAAEM,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAA+B,sBAAS,MAAM;AACnD,QAAIC,UAAU,GAAG;AAChBF,MAAAA,IAAI,EAAE,EADU;AAEhBC,MAAAA,kBAAkB,EAAE;AAFJ,KAAjB;;AAIA,QAAKL,QAAQ,CAACO,MAAd,EAAuB;AACtBD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AAOI,YAAP;AACA","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\tTabPanel,\n\tCard,\n\tCardHeader,\n\tCardBody,\n} from '@wordpress/components';\nimport { useMemo, useCallback, useState } from '@wordpress/element';\nimport { chevronLeft, chevronRight, Icon } from '@wordpress/icons';\nimport { isRTL, __ } from '@wordpress/i18n';\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 `TabPanel` 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\tconst getCurrentTab = useCallback(\n\t\t( tab ) => sectionsContentMap[ tab.name ] || null,\n\t\t[ sectionsContentMap ]\n\t);\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<TabPanel\n\t\t\t\tclassName=\"interface-preferences__tabs\"\n\t\t\t\ttabs={ tabs }\n\t\t\t\tinitialTabName={\n\t\t\t\t\tactiveMenu !== PREFERENCES_MENU ? activeMenu : undefined\n\t\t\t\t}\n\t\t\t\tonSelect={ setActiveMenu }\n\t\t\t\torientation=\"vertical\"\n\t\t\t>\n\t\t\t\t{ getCurrentTab }\n\t\t\t</TabPanel>\n\t\t);\n\t} else {\n\t\tmodalContent = (\n\t\t\t<NavigatorProvider\n\t\t\t\tinitialPath=\"/\"\n\t\t\t\tclassName=\"interface-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"]}
|
package/build/store/actions.js
CHANGED
|
@@ -42,12 +42,10 @@ const setDefaultComplementaryArea = (scope, area) => ({
|
|
|
42
42
|
|
|
43
43
|
exports.setDefaultComplementaryArea = setDefaultComplementaryArea;
|
|
44
44
|
|
|
45
|
-
const enableComplementaryArea = (scope, area) =>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} = _ref;
|
|
50
|
-
|
|
45
|
+
const enableComplementaryArea = (scope, area) => ({
|
|
46
|
+
registry,
|
|
47
|
+
dispatch
|
|
48
|
+
}) => {
|
|
51
49
|
// Return early if there's no area.
|
|
52
50
|
if (!area) {
|
|
53
51
|
return;
|
|
@@ -74,10 +72,9 @@ const enableComplementaryArea = (scope, area) => _ref => {
|
|
|
74
72
|
|
|
75
73
|
exports.enableComplementaryArea = enableComplementaryArea;
|
|
76
74
|
|
|
77
|
-
const disableComplementaryArea = scope =>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
} = _ref2;
|
|
75
|
+
const disableComplementaryArea = scope => ({
|
|
76
|
+
registry
|
|
77
|
+
}) => {
|
|
81
78
|
const isComplementaryAreaVisible = registry.select(_preferences.store).get(scope, 'isComplementaryAreaVisible');
|
|
82
79
|
|
|
83
80
|
if (isComplementaryAreaVisible) {
|
|
@@ -96,11 +93,9 @@ const disableComplementaryArea = scope => _ref2 => {
|
|
|
96
93
|
|
|
97
94
|
exports.disableComplementaryArea = disableComplementaryArea;
|
|
98
95
|
|
|
99
|
-
const pinItem = (scope, item) =>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
} = _ref3;
|
|
103
|
-
|
|
96
|
+
const pinItem = (scope, item) => ({
|
|
97
|
+
registry
|
|
98
|
+
}) => {
|
|
104
99
|
// Return early if there's no item.
|
|
105
100
|
if (!item) {
|
|
106
101
|
return;
|
|
@@ -108,7 +103,7 @@ const pinItem = (scope, item) => _ref3 => {
|
|
|
108
103
|
|
|
109
104
|
const pinnedItems = registry.select(_preferences.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do.
|
|
110
105
|
|
|
111
|
-
if (
|
|
106
|
+
if (pinnedItems?.[item] === true) {
|
|
112
107
|
return;
|
|
113
108
|
}
|
|
114
109
|
|
|
@@ -126,11 +121,9 @@ const pinItem = (scope, item) => _ref3 => {
|
|
|
126
121
|
|
|
127
122
|
exports.pinItem = pinItem;
|
|
128
123
|
|
|
129
|
-
const unpinItem = (scope, item) =>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
} = _ref4;
|
|
133
|
-
|
|
124
|
+
const unpinItem = (scope, item) => ({
|
|
125
|
+
registry
|
|
126
|
+
}) => {
|
|
134
127
|
// Return early if there's no item.
|
|
135
128
|
if (!item) {
|
|
136
129
|
return;
|
|
@@ -152,10 +145,9 @@ const unpinItem = (scope, item) => _ref4 => {
|
|
|
152
145
|
exports.unpinItem = unpinItem;
|
|
153
146
|
|
|
154
147
|
function toggleFeature(scope, featureName) {
|
|
155
|
-
return function (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
} = _ref5;
|
|
148
|
+
return function ({
|
|
149
|
+
registry
|
|
150
|
+
}) {
|
|
159
151
|
(0, _deprecated.default)(`dispatch( 'core/interface' ).toggleFeature`, {
|
|
160
152
|
since: '6.0',
|
|
161
153
|
alternative: `dispatch( 'core/preferences' ).toggle`
|
|
@@ -176,10 +168,9 @@ function toggleFeature(scope, featureName) {
|
|
|
176
168
|
|
|
177
169
|
|
|
178
170
|
function setFeatureValue(scope, featureName, value) {
|
|
179
|
-
return function (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
} = _ref6;
|
|
171
|
+
return function ({
|
|
172
|
+
registry
|
|
173
|
+
}) {
|
|
183
174
|
(0, _deprecated.default)(`dispatch( 'core/interface' ).setFeatureValue`, {
|
|
184
175
|
since: '6.0',
|
|
185
176
|
alternative: `dispatch( 'core/preferences' ).set`
|
|
@@ -198,10 +189,9 @@ function setFeatureValue(scope, featureName, value) {
|
|
|
198
189
|
|
|
199
190
|
|
|
200
191
|
function setFeatureDefaults(scope, defaults) {
|
|
201
|
-
return function (
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
} = _ref7;
|
|
192
|
+
return function ({
|
|
193
|
+
registry
|
|
194
|
+
}) {
|
|
205
195
|
(0, _deprecated.default)(`dispatch( 'core/interface' ).setFeatureDefaults`, {
|
|
206
196
|
since: '6.0',
|
|
207
197
|
alternative: `dispatch( 'core/preferences' ).setDefaults`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/store/actions.js"],"names":["setDefaultComplementaryArea","scope","area","type","enableComplementaryArea","registry","dispatch","isComplementaryAreaVisible","select","preferencesStore","get","set","disableComplementaryArea","pinItem","item","pinnedItems","unpinItem","toggleFeature","featureName","since","alternative","toggle","setFeatureValue","value","setFeatureDefaults","defaults","setDefaults"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,2BAA2B,GAAG,CAAEC,KAAF,EAASC,IAAT,MAAqB;AAC/DC,EAAAA,IAAI,EAAE,gCADyD;AAE/DF,EAAAA,KAF+D;AAG/DC,EAAAA;AAH+D,CAArB,CAApC;AAMP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAME,uBAAuB,GACnC,CAAEH,KAAF,EAASC,IAAT,KACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/store/actions.js"],"names":["setDefaultComplementaryArea","scope","area","type","enableComplementaryArea","registry","dispatch","isComplementaryAreaVisible","select","preferencesStore","get","set","disableComplementaryArea","pinItem","item","pinnedItems","unpinItem","toggleFeature","featureName","since","alternative","toggle","setFeatureValue","value","setFeatureDefaults","defaults","setDefaults"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,2BAA2B,GAAG,CAAEC,KAAF,EAASC,IAAT,MAAqB;AAC/DC,EAAAA,IAAI,EAAE,gCADyD;AAE/DF,EAAAA,KAF+D;AAG/DC,EAAAA;AAH+D,CAArB,CAApC;AAMP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAME,uBAAuB,GACnC,CAAEH,KAAF,EAASC,IAAT,KACA,CAAE;AAAEG,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAAF,KAA8B;AAC7B;AACA,MAAK,CAAEJ,IAAP,EAAc;AACb;AACA;;AAED,QAAMK,0BAA0B,GAAGF,QAAQ,CACzCG,MADiC,CACzBC,kBADyB,EAEjCC,GAFiC,CAE5BT,KAF4B,EAErB,4BAFqB,CAAnC;;AAIA,MAAK,CAAEM,0BAAP,EAAoC;AACnCF,IAAAA,QAAQ,CACNC,QADF,CACYG,kBADZ,EAEEE,GAFF,CAEOV,KAFP,EAEc,4BAFd,EAE4C,IAF5C;AAGA;;AAEDK,EAAAA,QAAQ,CAAE;AACTH,IAAAA,IAAI,EAAE,2BADG;AAETF,IAAAA,KAFS;AAGTC,IAAAA;AAHS,GAAF,CAAR;AAKA,CAvBK;AAyBP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMU,wBAAwB,GAClCX,KAAF,IACA,CAAE;AAAEI,EAAAA;AAAF,CAAF,KAAoB;AACnB,QAAME,0BAA0B,GAAGF,QAAQ,CACzCG,MADi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AACA;AACA;AACA;AACA;;;;;AACO,SAASG,aAAT,CAAwBhB,KAAxB,EAA+BiB,WAA/B,EAA6C;AACnD,SAAO,UAAW;AAAEb,IAAAA;AAAF,GAAX,EAA0B;AAChC,6BAAa,4CAAb,EAA0D;AACzDc,MAAAA,KAAK,EAAE,KADkD;AAEzDC,MAAAA,WAAW,EAAG;AAF2C,KAA1D;AAKAf,IAAAA,QAAQ,CAACC,QAAT,CAAmBG,kBAAnB,EAAsCY,MAAtC,CAA8CpB,KAA9C,EAAqDiB,WAArD;AACA,GAPD;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,eAAT,CAA0BrB,KAA1B,EAAiCiB,WAAjC,EAA8CK,KAA9C,EAAsD;AAC5D,SAAO,UAAW;AAAElB,IAAAA;AAAF,GAAX,EAA0B;AAChC,6BAAa,8CAAb,EAA4D;AAC3Dc,MAAAA,KAAK,EAAE,KADoD;AAE3DC,MAAAA,WAAW,EAAG;AAF6C,KAA5D;AAKAf,IAAAA,QAAQ,CACNC,QADF,CACYG,kBADZ,EAEEE,GAFF,CAEOV,KAFP,EAEciB,WAFd,EAE2B,CAAC,CAAEK,KAF9B;AAGA,GATD;AAUA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,kBAAT,CAA6BvB,KAA7B,EAAoCwB,QAApC,EAA+C;AACrD,SAAO,UAAW;AAAEpB,IAAAA;AAAF,GAAX,EAA0B;AAChC,6BAAa,iDAAb,EAA+D;AAC9Dc,MAAAA,KAAK,EAAE,KADuD;AAE9DC,MAAAA,WAAW,EAAG;AAFgD,KAA/D;AAKAf,IAAAA,QAAQ,CAACC,QAAT,CAAmBG,kBAAnB,EAAsCiB,WAAtC,CAAmDzB,KAAnD,EAA0DwB,QAA1D;AACA,GAPD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Set a default complementary area.\n *\n * @param {string} scope Complementary area scope.\n * @param {string} area Area identifier.\n *\n * @return {Object} Action object.\n */\nexport const setDefaultComplementaryArea = ( scope, area ) => ( {\n\ttype: 'SET_DEFAULT_COMPLEMENTARY_AREA',\n\tscope,\n\tarea,\n} );\n\n/**\n * Enable the complementary area.\n *\n * @param {string} scope Complementary area scope.\n * @param {string} area Area identifier.\n */\nexport const enableComplementaryArea =\n\t( scope, area ) =>\n\t( { registry, dispatch } ) => {\n\t\t// Return early if there's no area.\n\t\tif ( ! area ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isComplementaryAreaVisible = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'isComplementaryAreaVisible' );\n\n\t\tif ( ! isComplementaryAreaVisible ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( scope, 'isComplementaryAreaVisible', true );\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'ENABLE_COMPLEMENTARY_AREA',\n\t\t\tscope,\n\t\t\tarea,\n\t\t} );\n\t};\n\n/**\n * Disable the complementary area.\n *\n * @param {string} scope Complementary area scope.\n */\nexport const disableComplementaryArea =\n\t( scope ) =>\n\t( { registry } ) => {\n\t\tconst isComplementaryAreaVisible = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'isComplementaryAreaVisible' );\n\n\t\tif ( isComplementaryAreaVisible ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( scope, 'isComplementaryAreaVisible', false );\n\t\t}\n\t};\n\n/**\n * Pins an item.\n *\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n *\n * @return {Object} Action object.\n */\nexport const pinItem =\n\t( scope, item ) =>\n\t( { registry } ) => {\n\t\t// Return early if there's no item.\n\t\tif ( ! item ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst pinnedItems = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'pinnedItems' );\n\n\t\t// The item is already pinned, there's nothing to do.\n\t\tif ( pinnedItems?.[ item ] === true ) {\n\t\t\treturn;\n\t\t}\n\n\t\tregistry.dispatch( preferencesStore ).set( scope, 'pinnedItems', {\n\t\t\t...pinnedItems,\n\t\t\t[ item ]: true,\n\t\t} );\n\t};\n\n/**\n * Unpins an item.\n *\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n */\nexport const unpinItem =\n\t( scope, item ) =>\n\t( { registry } ) => {\n\t\t// Return early if there's no item.\n\t\tif ( ! item ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst pinnedItems = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'pinnedItems' );\n\n\t\tregistry.dispatch( preferencesStore ).set( scope, 'pinnedItems', {\n\t\t\t...pinnedItems,\n\t\t\t[ item ]: false,\n\t\t} );\n\t};\n\n/**\n * Returns an action object used in signalling that a feature should be toggled.\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {string} featureName The feature name.\n */\nexport function toggleFeature( scope, featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `dispatch( 'core/interface' ).toggleFeature`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `dispatch( 'core/preferences' ).toggle`,\n\t\t} );\n\n\t\tregistry.dispatch( preferencesStore ).toggle( scope, featureName );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a feature should be set to\n * a true or false value\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {string} featureName The feature name.\n * @param {boolean} value The value to set.\n *\n * @return {Object} Action object.\n */\nexport function setFeatureValue( scope, featureName, value ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `dispatch( 'core/interface' ).setFeatureValue`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `dispatch( 'core/preferences' ).set`,\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( scope, featureName, !! value );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that defaults should be set for features.\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {Object<string, boolean>} defaults A key/value map of feature names to values.\n *\n * @return {Object} Action object.\n */\nexport function setFeatureDefaults( scope, defaults ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `dispatch( 'core/interface' ).setFeatureDefaults`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `dispatch( 'core/preferences' ).setDefaults`,\n\t\t} );\n\n\t\tregistry.dispatch( preferencesStore ).setDefaults( scope, defaults );\n\t};\n}\n"]}
|
package/build/store/reducer.js
CHANGED
|
@@ -11,10 +11,7 @@ var _data = require("@wordpress/data");
|
|
|
11
11
|
/**
|
|
12
12
|
* WordPress dependencies
|
|
13
13
|
*/
|
|
14
|
-
function complementaryAreas() {
|
|
15
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
17
|
-
|
|
14
|
+
function complementaryAreas(state = {}, action) {
|
|
18
15
|
switch (action.type) {
|
|
19
16
|
case 'SET_DEFAULT_COMPLEMENTARY_AREA':
|
|
20
17
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/store/reducer.js"],"names":["complementaryAreas","state","action","type","scope","area"],"mappings":";;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,SAASA,kBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/store/reducer.js"],"names":["complementaryAreas","state","action","type","scope","area"],"mappings":";;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,SAASA,kBAAT,CAA6BC,KAAK,GAAG,EAArC,EAAyCC,MAAzC,EAAkD;AACxD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,gCAAL;AAAuC;AACtC,cAAM;AAAEC,UAAAA,KAAF;AAASC,UAAAA;AAAT,YAAkBH,MAAxB,CADsC,CAGtC;;AACA,YAAKD,KAAK,CAAEG,KAAF,CAAV,EAAsB;AACrB,iBAAOH,KAAP;AACA;;AAED,eAAO,EACN,GAAGA,KADG;AAEN,WAAEG,KAAF,GAAWC;AAFL,SAAP;AAIA;;AACD,SAAK,2BAAL;AAAkC;AACjC,cAAM;AAAED,UAAAA,KAAF;AAASC,UAAAA;AAAT,YAAkBH,MAAxB;AACA,eAAO,EACN,GAAGD,KADG;AAEN,WAAEG,KAAF,GAAWC;AAFL,SAAP;AAIA;AApBF;;AAuBA,SAAOJ,KAAP;AACA;;eAEc,2BAAiB;AAC/BD,EAAAA;AAD+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\nexport function complementaryAreas( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_DEFAULT_COMPLEMENTARY_AREA': {\n\t\t\tconst { scope, area } = action;\n\n\t\t\t// If there's already an area, don't overwrite it.\n\t\t\tif ( state[ scope ] ) {\n\t\t\t\treturn state;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: area,\n\t\t\t};\n\t\t}\n\t\tcase 'ENABLE_COMPLEMENTARY_AREA': {\n\t\t\tconst { scope, area } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: area,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tcomplementaryAreas,\n} );\n"]}
|
package/build/store/selectors.js
CHANGED
|
@@ -26,8 +26,6 @@ var _preferences = require("@wordpress/preferences");
|
|
|
26
26
|
* @return {string | null | undefined} The complementary area that is active in the given scope.
|
|
27
27
|
*/
|
|
28
28
|
const getActiveComplementaryArea = (0, _data.createRegistrySelector)(select => (state, scope) => {
|
|
29
|
-
var _state$complementaryA;
|
|
30
|
-
|
|
31
29
|
const isComplementaryAreaVisible = select(_preferences.store).get(scope, 'isComplementaryAreaVisible'); // Return `undefined` to indicate that the user has never toggled
|
|
32
30
|
// visibility, this is the vanilla default. Other code relies on this
|
|
33
31
|
// nuance in the return value.
|
|
@@ -41,14 +39,12 @@ const getActiveComplementaryArea = (0, _data.createRegistrySelector)(select => (
|
|
|
41
39
|
return null;
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
return state
|
|
42
|
+
return state?.complementaryAreas?.[scope];
|
|
45
43
|
});
|
|
46
44
|
exports.getActiveComplementaryArea = getActiveComplementaryArea;
|
|
47
45
|
const isComplementaryAreaLoading = (0, _data.createRegistrySelector)(select => (state, scope) => {
|
|
48
|
-
var _state$complementaryA2;
|
|
49
|
-
|
|
50
46
|
const isVisible = select(_preferences.store).get(scope, 'isComplementaryAreaVisible');
|
|
51
|
-
const identifier = state
|
|
47
|
+
const identifier = state?.complementaryAreas?.[scope];
|
|
52
48
|
return isVisible && identifier === undefined;
|
|
53
49
|
});
|
|
54
50
|
/**
|
|
@@ -66,7 +62,7 @@ const isItemPinned = (0, _data.createRegistrySelector)(select => (state, scope,
|
|
|
66
62
|
var _pinnedItems$item;
|
|
67
63
|
|
|
68
64
|
const pinnedItems = select(_preferences.store).get(scope, 'pinnedItems');
|
|
69
|
-
return (_pinnedItems$item = pinnedItems
|
|
65
|
+
return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
|
|
70
66
|
});
|
|
71
67
|
/**
|
|
72
68
|
* Returns a boolean indicating whether a feature is active for a particular
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/store/selectors.js"],"names":["getActiveComplementaryArea","select","state","scope","isComplementaryAreaVisible","preferencesStore","get","undefined","complementaryAreas","isComplementaryAreaLoading","isVisible","identifier","isItemPinned","item","pinnedItems","isFeatureActive","featureName","since","alternative"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,0BAA0B,GAAG,kCACvCC,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,KAAoB;
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/store/selectors.js"],"names":["getActiveComplementaryArea","select","state","scope","isComplementaryAreaVisible","preferencesStore","get","undefined","complementaryAreas","isComplementaryAreaLoading","isVisible","identifier","isItemPinned","item","pinnedItems","isFeatureActive","featureName","since","alternative"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,0BAA0B,GAAG,kCACvCC,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,KAAoB;AACjC,QAAMC,0BAA0B,GAAGH,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CAClCH,KADkC,EAElC,4BAFkC,CAAnC,CADiC,CAMjC;AACA;AACA;;AACA,MAAKC,0BAA0B,KAAKG,SAApC,EAAgD;AAC/C,WAAOA,SAAP;AACA,GAXgC,CAajC;;;AACA,MAAKH,0BAA0B,KAAK,KAApC,EAA4C;AAC3C,WAAO,IAAP;AACA;;AAED,SAAOF,KAAK,EAAEM,kBAAP,GAA6BL,KAA7B,CAAP;AACA,CApBwC,CAAnC;;AAuBA,MAAMM,0BAA0B,GAAG,kCACvCR,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,KAAoB;AACjC,QAAMO,SAAS,GAAGT,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CACjBH,KADiB,EAEjB,4BAFiB,CAAlB;AAIA,QAAMQ,UAAU,GAAGT,KAAK,EAAEM,kBAAP,GAA6BL,KAA7B,CAAnB;AAEA,SAAOO,SAAS,IAAIC,UAAU,KAAKJ,SAAnC;AACA,CATwC,CAAnC;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMK,YAAY,GAAG,kCACzBX,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBU,IAAhB,KAA0B;AAAA;;AACvC,QAAMC,WAAW,GAAGb,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CACnBH,KADmB,EAEnB,aAFmB,CAApB;AAIA,8BAAOW,WAAW,GAAID,IAAJ,CAAlB,iEAAgC,IAAhC;AACA,CAP0B,CAArB;AAUP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,eAAe,GAAG,kCAC5Bd,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBa,WAAhB,KAAiC;AAC9C,2BACE,kEADF,EAEC;AACCC,IAAAA,KAAK,EAAE,KADR;AAECC,IAAAA,WAAW,EAAG;AAFf,GAFD;AAQA,SAAO,CAAC,CAAEjB,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CAAgCH,KAAhC,EAAuCa,WAAvC,CAAV;AACA,CAX6B,CAAxB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Returns the complementary area that is active in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Item scope.\n *\n * @return {string | null | undefined} The complementary area that is active in the given scope.\n */\nexport const getActiveComplementaryArea = createRegistrySelector(\n\t( select ) => ( state, scope ) => {\n\t\tconst isComplementaryAreaVisible = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'isComplementaryAreaVisible'\n\t\t);\n\n\t\t// Return `undefined` to indicate that the user has never toggled\n\t\t// visibility, this is the vanilla default. Other code relies on this\n\t\t// nuance in the return value.\n\t\tif ( isComplementaryAreaVisible === undefined ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Return `null` to indicate the user hid the complementary area.\n\t\tif ( isComplementaryAreaVisible === false ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn state?.complementaryAreas?.[ scope ];\n\t}\n);\n\nexport const isComplementaryAreaLoading = createRegistrySelector(\n\t( select ) => ( state, scope ) => {\n\t\tconst isVisible = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'isComplementaryAreaVisible'\n\t\t);\n\t\tconst identifier = state?.complementaryAreas?.[ scope ];\n\n\t\treturn isVisible && identifier === undefined;\n\t}\n);\n\n/**\n * Returns a boolean indicating if an item is pinned or not.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Scope.\n * @param {string} item Item to check.\n *\n * @return {boolean} True if the item is pinned and false otherwise.\n */\nexport const isItemPinned = createRegistrySelector(\n\t( select ) => ( state, scope, item ) => {\n\t\tconst pinnedItems = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'pinnedItems'\n\t\t);\n\t\treturn pinnedItems?.[ item ] ?? true;\n\t}\n);\n\n/**\n * Returns a boolean indicating whether a feature 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} featureName The name of the feature.\n *\n * @return {boolean} Is the feature enabled?\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, scope, featureName ) => {\n\t\tdeprecated(\n\t\t\t`select( 'core/interface' ).isFeatureActive( scope, featureName )`,\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative: `select( 'core/preferences' ).get( scope, featureName )`,\n\t\t\t}\n\t\t);\n\n\t\treturn !! select( preferencesStore ).get( scope, featureName );\n\t}\n);\n"]}
|
|
@@ -9,14 +9,13 @@ import { Children } from '@wordpress/element';
|
|
|
9
9
|
|
|
10
10
|
const noop = () => {};
|
|
11
11
|
|
|
12
|
-
function ActionItemSlot(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
12
|
+
function ActionItemSlot({
|
|
13
|
+
name,
|
|
14
|
+
as: Component = ButtonGroup,
|
|
15
|
+
fillProps = {},
|
|
16
|
+
bubblesVirtually,
|
|
17
|
+
...props
|
|
18
|
+
}) {
|
|
20
19
|
return createElement(Slot, {
|
|
21
20
|
name: name,
|
|
22
21
|
bubblesVirtually: bubblesVirtually,
|
|
@@ -32,14 +31,12 @@ function ActionItemSlot(_ref) {
|
|
|
32
31
|
|
|
33
32
|
|
|
34
33
|
const initializedByPlugins = [];
|
|
35
|
-
Children.forEach(fills,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} = _ref2;
|
|
42
|
-
|
|
34
|
+
Children.forEach(fills, ({
|
|
35
|
+
props: {
|
|
36
|
+
__unstableExplicitMenuItem,
|
|
37
|
+
__unstableTarget
|
|
38
|
+
}
|
|
39
|
+
}) => {
|
|
43
40
|
if (__unstableTarget && __unstableExplicitMenuItem) {
|
|
44
41
|
initializedByPlugins.push(__unstableTarget);
|
|
45
42
|
}
|
|
@@ -55,23 +52,21 @@ function ActionItemSlot(_ref) {
|
|
|
55
52
|
});
|
|
56
53
|
}
|
|
57
54
|
|
|
58
|
-
function ActionItem(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} = _ref3;
|
|
55
|
+
function ActionItem({
|
|
56
|
+
name,
|
|
57
|
+
as: Component = Button,
|
|
58
|
+
onClick,
|
|
59
|
+
...props
|
|
60
|
+
}) {
|
|
65
61
|
return createElement(Fill, {
|
|
66
62
|
name: name
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
} = _ref4;
|
|
63
|
+
}, ({
|
|
64
|
+
onClick: fpOnClick
|
|
65
|
+
}) => {
|
|
71
66
|
return createElement(Component, _extends({
|
|
72
|
-
onClick: onClick || fpOnClick ?
|
|
73
|
-
(onClick || noop)(...
|
|
74
|
-
(fpOnClick || noop)(...
|
|
67
|
+
onClick: onClick || fpOnClick ? (...args) => {
|
|
68
|
+
(onClick || noop)(...args);
|
|
69
|
+
(fpOnClick || noop)(...args);
|
|
75
70
|
} : undefined
|
|
76
71
|
}, props));
|
|
77
72
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/action-item/index.js"],"names":["ButtonGroup","Button","Slot","Fill","Children","noop","ActionItemSlot","name","as","Component","fillProps","bubblesVirtually","props","fills","toArray","length","initializedByPlugins","forEach","__unstableExplicitMenuItem","__unstableTarget","push","children","map","child","includes","ActionItem","onClick","fpOnClick","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,MAAtB,EAA8BC,IAA9B,EAAoCC,IAApC,QAAgD,uBAAhD;AACA,SAASC,QAAT,QAAyB,oBAAzB;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,cAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/action-item/index.js"],"names":["ButtonGroup","Button","Slot","Fill","Children","noop","ActionItemSlot","name","as","Component","fillProps","bubblesVirtually","props","fills","toArray","length","initializedByPlugins","forEach","__unstableExplicitMenuItem","__unstableTarget","push","children","map","child","includes","ActionItem","onClick","fpOnClick","args","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,MAAtB,EAA8BC,IAA9B,EAAoCC,IAApC,QAAgD,uBAAhD;AACA,SAASC,QAAT,QAAyB,oBAAzB;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,cAAT,CAAyB;AACxBC,EAAAA,IADwB;AAExBC,EAAAA,EAAE,EAAEC,SAAS,GAAGT,WAFQ;AAGxBU,EAAAA,SAAS,GAAG,EAHY;AAIxBC,EAAAA,gBAJwB;AAKxB,KAAGC;AALqB,CAAzB,EAMI;AACH,SACC,cAAC,IAAD;AACC,IAAA,IAAI,EAAGL,IADR;AAEC,IAAA,gBAAgB,EAAGI,gBAFpB;AAGC,IAAA,SAAS,EAAGD;AAHb,KAKKG,KAAF,IAAa;AACd,QAAK,CAAET,QAAQ,CAACU,OAAT,CAAkBD,KAAlB,EAA0BE,MAAjC,EAA0C;AACzC,aAAO,IAAP;AACA,KAHa,C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GAAkBI,cAAlB;AAEA,eAAemB,UAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ButtonGroup, Button, Slot, Fill } from '@wordpress/components';\nimport { Children } from '@wordpress/element';\n\nconst noop = () => {};\n\nfunction ActionItemSlot( {\n\tname,\n\tas: Component = ButtonGroup,\n\tfillProps = {},\n\tbubblesVirtually,\n\t...props\n} ) {\n\treturn (\n\t\t<Slot\n\t\t\tname={ name }\n\t\t\tbubblesVirtually={ bubblesVirtually }\n\t\t\tfillProps={ fillProps }\n\t\t>\n\t\t\t{ ( fills ) => {\n\t\t\t\tif ( ! Children.toArray( fills ).length ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\t// Special handling exists for backward compatibility.\n\t\t\t\t// It ensures that menu items created by plugin authors aren't\n\t\t\t\t// duplicated with automatically injected menu items coming\n\t\t\t\t// from pinnable plugin sidebars.\n\t\t\t\t// @see https://github.com/WordPress/gutenberg/issues/14457\n\t\t\t\tconst initializedByPlugins = [];\n\t\t\t\tChildren.forEach(\n\t\t\t\t\tfills,\n\t\t\t\t\t( {\n\t\t\t\t\t\tprops: { __unstableExplicitMenuItem, __unstableTarget },\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tif ( __unstableTarget && __unstableExplicitMenuItem ) {\n\t\t\t\t\t\t\tinitializedByPlugins.push( __unstableTarget );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tconst children = Children.map( fills, ( child ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\t! child.props.__unstableExplicitMenuItem &&\n\t\t\t\t\t\tinitializedByPlugins.includes(\n\t\t\t\t\t\t\tchild.props.__unstableTarget\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t} );\n\n\t\t\t\treturn <Component { ...props }>{ children }</Component>;\n\t\t\t} }\n\t\t</Slot>\n\t);\n}\n\nfunction ActionItem( { name, as: Component = Button, onClick, ...props } ) {\n\treturn (\n\t\t<Fill name={ name }>\n\t\t\t{ ( { onClick: fpOnClick } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Component\n\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\tonClick || fpOnClick\n\t\t\t\t\t\t\t\t? ( ...args ) => {\n\t\t\t\t\t\t\t\t\t\t( onClick || noop )( ...args );\n\t\t\t\t\t\t\t\t\t\t( fpOnClick || noop )( ...args );\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t</Fill>\n\t);\n}\n\nActionItem.Slot = ActionItemSlot;\n\nexport default ActionItem;\n"]}
|