@wordpress/interface 5.13.0 → 5.15.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/interface-skeleton/index.js +20 -19
- package/build/components/interface-skeleton/index.js.map +1 -1
- package/build/store/actions.js +31 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +24 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +14 -0
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/interface-skeleton/index.js +20 -19
- package/build-module/components/interface-skeleton/index.js.map +1 -1
- package/build-module/store/actions.js +25 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +22 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +12 -0
- package/build-module/store/selectors.js.map +1 -1
- package/package.json +13 -13
- package/src/components/interface-skeleton/index.js +9 -9
- package/src/store/actions.js +25 -0
- package/src/store/reducer.js +20 -0
- package/src/store/selectors.js +12 -0
- package/src/store/test/reducer.js +30 -0
- package/src/store/test/selectors.js +32 -0
package/CHANGELOG.md
CHANGED
|
@@ -45,6 +45,26 @@ function useHTMLClass(className) {
|
|
|
45
45
|
}, [className]);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
const headerVariants = {
|
|
49
|
+
hidden: {
|
|
50
|
+
opacity: 0
|
|
51
|
+
},
|
|
52
|
+
hover: {
|
|
53
|
+
opacity: 1,
|
|
54
|
+
transition: {
|
|
55
|
+
type: 'tween',
|
|
56
|
+
delay: 0.2,
|
|
57
|
+
delayChildren: 0.2
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
distractionFreeInactive: {
|
|
61
|
+
opacity: 1,
|
|
62
|
+
transition: {
|
|
63
|
+
delay: 0
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
48
68
|
function InterfaceSkeleton({
|
|
49
69
|
isDistractionFree,
|
|
50
70
|
footer,
|
|
@@ -86,25 +106,6 @@ function InterfaceSkeleton({
|
|
|
86
106
|
const mergedLabels = { ...defaultLabels,
|
|
87
107
|
...labels
|
|
88
108
|
};
|
|
89
|
-
const headerVariants = {
|
|
90
|
-
hidden: {
|
|
91
|
-
opacity: 0
|
|
92
|
-
},
|
|
93
|
-
hover: {
|
|
94
|
-
opacity: 1,
|
|
95
|
-
transition: {
|
|
96
|
-
type: 'tween',
|
|
97
|
-
delay: 0.2,
|
|
98
|
-
delayChildren: 0.2
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
distractionFreeInactive: {
|
|
102
|
-
opacity: 1,
|
|
103
|
-
transition: {
|
|
104
|
-
delay: 0
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
109
|
return (0, _element.createElement)("div", { ...(enableRegionNavigation ? navigateRegionsProps : {}),
|
|
109
110
|
ref: (0, _compose.useMergeRefs)([ref, enableRegionNavigation ? navigateRegionsProps.ref : undefined]),
|
|
110
111
|
className: (0, _classnames.default)(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"names":["useHTMLClass","className","element","document","querySelector","classList","toggle","
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"names":["useHTMLClass","className","element","document","querySelector","classList","toggle","headerVariants","hidden","opacity","hover","transition","type","delay","delayChildren","distractionFreeInactive","InterfaceSkeleton","isDistractionFree","footer","header","editorNotices","sidebar","secondarySidebar","notices","content","actions","labels","enableRegionNavigation","shortcuts","ref","navigateRegionsProps","defaultLabels","body","mergedLabels","undefined","motion","div"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAIA;;AACA;;AAKA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAGA,SAASA,YAAT,CAAuBC,SAAvB,EAA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A+BGF,iBAAiB,IAClB;AAAK,IAAA,SAAS,EAAC;AAAf,KACGG,aADH,CAhCF,EAoCC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,CAAC,CAAEE,gBAAH,IACD,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAC,iDADX;AAEC,IAAA,SAAS,EAAGW,YAAY,CAACX;AAF1B,KAIGA,gBAJH,CAFF,EASG,CAAC,CAAEC,OAAH,IACD;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,OADH,CAVF,EAcC,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,SAAS,EAAGU,YAAY,CAACD;AAF1B,KAIGR,OAJH,CAdD,EAoBG,CAAC,CAAEH,OAAH,IACD,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,SAAS,EAAGY,YAAY,CAACZ;AAF1B,KAIGA,OAJH,CArBF,EA4BG,CAAC,CAAEI,OAAH,IACD,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,SAAS,EAAGQ,YAAY,CAACR;AAF1B,KAIGA,OAJH,CA7BF,CApCD,CAbD,EAuFG,CAAC,CAAEP,MAAH,IACD,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,SAAS,EAAGe,YAAY,CAACf;AAF1B,KAIGA,MAJH,CAxFF,CADD;AAkGA;;eAEc,yBAAYF,iBAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport {\n\t__unstableUseNavigateRegions as useNavigateRegions,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NavigableRegion from '../navigable-region';\n\nfunction useHTMLClass( className ) {\n\tuseEffect( () => {\n\t\tconst element =\n\t\t\tdocument && document.querySelector( `html:not(.${ className })` );\n\t\tif ( ! element ) {\n\t\t\treturn;\n\t\t}\n\t\telement.classList.toggle( className );\n\t\treturn () => {\n\t\t\telement.classList.toggle( className );\n\t\t};\n\t}, [ className ] );\n}\n\nconst headerVariants = {\n\thidden: { opacity: 0 },\n\thover: {\n\t\topacity: 1,\n\t\ttransition: { type: 'tween', delay: 0.2, delayChildren: 0.2 },\n\t},\n\tdistractionFreeInactive: { opacity: 1, transition: { delay: 0 } },\n};\n\nfunction InterfaceSkeleton(\n\t{\n\t\tisDistractionFree,\n\t\tfooter,\n\t\theader,\n\t\teditorNotices,\n\t\tsidebar,\n\t\tsecondarySidebar,\n\t\tnotices,\n\t\tcontent,\n\t\tactions,\n\t\tlabels,\n\t\tclassName,\n\t\tenableRegionNavigation = true,\n\t\t// Todo: does this need to be a prop.\n\t\t// Can we use a dependency to keyboard-shortcuts directly?\n\t\tshortcuts,\n\t},\n\tref\n) {\n\tconst navigateRegionsProps = useNavigateRegions( shortcuts );\n\n\tuseHTMLClass( 'interface-interface-skeleton__html-container' );\n\n\tconst defaultLabels = {\n\t\t/* translators: accessibility text for the top bar landmark region. */\n\t\theader: __( 'Header' ),\n\t\t/* translators: accessibility text for the content landmark region. */\n\t\tbody: __( 'Content' ),\n\t\t/* translators: accessibility text for the secondary sidebar landmark region. */\n\t\tsecondarySidebar: __( 'Block Library' ),\n\t\t/* translators: accessibility text for the settings landmark region. */\n\t\tsidebar: __( 'Settings' ),\n\t\t/* translators: accessibility text for the publish landmark region. */\n\t\tactions: __( 'Publish' ),\n\t\t/* translators: accessibility text for the footer landmark region. */\n\t\tfooter: __( 'Footer' ),\n\t};\n\n\tconst mergedLabels = { ...defaultLabels, ...labels };\n\n\treturn (\n\t\t<div\n\t\t\t{ ...( enableRegionNavigation ? navigateRegionsProps : {} ) }\n\t\t\tref={ useMergeRefs( [\n\t\t\t\tref,\n\t\t\t\tenableRegionNavigation ? navigateRegionsProps.ref : undefined,\n\t\t\t] ) }\n\t\t\tclassName={ classnames(\n\t\t\t\tclassName,\n\t\t\t\t'interface-interface-skeleton',\n\t\t\t\tnavigateRegionsProps.className,\n\t\t\t\t!! footer && 'has-footer'\n\t\t\t) }\n\t\t>\n\t\t\t<div className=\"interface-interface-skeleton__editor\">\n\t\t\t\t{ !! header && (\n\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__header\"\n\t\t\t\t\t\taria-label={ mergedLabels.header }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t\t\t? 'hidden'\n\t\t\t\t\t\t\t\t: 'distractionFreeInactive'\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhileHover={\n\t\t\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t\t\t? 'hover'\n\t\t\t\t\t\t\t\t: 'distractionFreeInactive'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={\n\t\t\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t\t\t? 'hidden'\n\t\t\t\t\t\t\t\t: 'distractionFreeInactive'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvariants={ headerVariants }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t\t\t? { type: 'tween', delay: 0.8 }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ header }\n\t\t\t\t\t</NavigableRegion>\n\t\t\t\t) }\n\t\t\t\t{ isDistractionFree && (\n\t\t\t\t\t<div className=\"interface-interface-skeleton__header\">\n\t\t\t\t\t\t{ editorNotices }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div className=\"interface-interface-skeleton__body\">\n\t\t\t\t\t{ !! secondarySidebar && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__secondary-sidebar\"\n\t\t\t\t\t\t\tariaLabel={ mergedLabels.secondarySidebar }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ secondarySidebar }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! notices && (\n\t\t\t\t\t\t<div className=\"interface-interface-skeleton__notices\">\n\t\t\t\t\t\t\t{ notices }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__content\"\n\t\t\t\t\t\tariaLabel={ mergedLabels.body }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ content }\n\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t{ !! sidebar && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__sidebar\"\n\t\t\t\t\t\t\tariaLabel={ mergedLabels.sidebar }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sidebar }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! actions && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__actions\"\n\t\t\t\t\t\t\tariaLabel={ mergedLabels.actions }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ actions }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{ !! footer && (\n\t\t\t\t<NavigableRegion\n\t\t\t\t\tclassName=\"interface-interface-skeleton__footer\"\n\t\t\t\t\tariaLabel={ mergedLabels.footer }\n\t\t\t\t>\n\t\t\t\t\t{ footer }\n\t\t\t\t</NavigableRegion>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( InterfaceSkeleton );\n"]}
|
package/build/store/actions.js
CHANGED
|
@@ -5,7 +5,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.closeModal = closeModal;
|
|
9
|
+
exports.enableComplementaryArea = exports.disableComplementaryArea = void 0;
|
|
10
|
+
exports.openModal = openModal;
|
|
11
|
+
exports.setDefaultComplementaryArea = exports.pinItem = void 0;
|
|
9
12
|
exports.setFeatureDefaults = setFeatureDefaults;
|
|
10
13
|
exports.setFeatureValue = setFeatureValue;
|
|
11
14
|
exports.toggleFeature = toggleFeature;
|
|
@@ -199,4 +202,31 @@ function setFeatureDefaults(scope, defaults) {
|
|
|
199
202
|
registry.dispatch(_preferences.store).setDefaults(scope, defaults);
|
|
200
203
|
};
|
|
201
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Returns an action object used in signalling that the user opened a modal.
|
|
207
|
+
*
|
|
208
|
+
* @param {string} name A string that uniquely identifies the modal.
|
|
209
|
+
*
|
|
210
|
+
* @return {Object} Action object.
|
|
211
|
+
*/
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
function openModal(name) {
|
|
215
|
+
return {
|
|
216
|
+
type: 'OPEN_MODAL',
|
|
217
|
+
name
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Returns an action object signalling that the user closed a modal.
|
|
222
|
+
*
|
|
223
|
+
* @return {Object} Action object.
|
|
224
|
+
*/
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
function closeModal() {
|
|
228
|
+
return {
|
|
229
|
+
type: 'CLOSE_MODAL'
|
|
230
|
+
};
|
|
231
|
+
}
|
|
202
232
|
//# sourceMappingURL=actions.js.map
|
|
@@ -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":"
|
|
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","openModal","name","closeModal"],"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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A;AACA;AACA;;;AACO,SAASE,SAAT,CAAoBC,IAApB,EAA2B;AACjC,SAAO;AACNzB,IAAAA,IAAI,EAAE,YADA;AAENyB,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASC,UAAT,GAAsB;AAC5B,SAAO;AACN1B,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA","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\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport function openModal( name ) {\n\treturn {\n\t\ttype: 'OPEN_MODAL',\n\t\tname,\n\t};\n}\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @return {Object} Action object.\n */\nexport function closeModal() {\n\treturn {\n\t\ttype: 'CLOSE_MODAL',\n\t};\n}\n"]}
|
package/build/store/reducer.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.activeModal = activeModal;
|
|
6
7
|
exports.complementaryAreas = complementaryAreas;
|
|
7
8
|
exports.default = void 0;
|
|
8
9
|
|
|
@@ -43,9 +44,31 @@ function complementaryAreas(state = {}, action) {
|
|
|
43
44
|
|
|
44
45
|
return state;
|
|
45
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Reducer for storing the name of the open modal, or null if no modal is open.
|
|
49
|
+
*
|
|
50
|
+
* @param {Object} state Previous state.
|
|
51
|
+
* @param {Object} action Action object containing the `name` of the modal
|
|
52
|
+
*
|
|
53
|
+
* @return {Object} Updated state
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
function activeModal(state = null, action) {
|
|
58
|
+
switch (action.type) {
|
|
59
|
+
case 'OPEN_MODAL':
|
|
60
|
+
return action.name;
|
|
61
|
+
|
|
62
|
+
case 'CLOSE_MODAL':
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return state;
|
|
67
|
+
}
|
|
46
68
|
|
|
47
69
|
var _default = (0, _data.combineReducers)({
|
|
48
|
-
complementaryAreas
|
|
70
|
+
complementaryAreas,
|
|
71
|
+
activeModal
|
|
49
72
|
});
|
|
50
73
|
|
|
51
74
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/store/reducer.js"],"names":["complementaryAreas","state","action","type","scope","area"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/store/reducer.js"],"names":["complementaryAreas","state","action","type","scope","area","activeModal","name"],"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;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,WAAT,CAAsBL,KAAK,GAAG,IAA9B,EAAoCC,MAApC,EAA6C;AACnD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,YAAL;AACC,aAAOD,MAAM,CAACK,IAAd;;AACD,SAAK,aAAL;AACC,aAAO,IAAP;AAJF;;AAOA,SAAON,KAAP;AACA;;eAEc,2BAAiB;AAC/BD,EAAAA,kBAD+B;AAE/BM,EAAAA;AAF+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\n/**\n * Reducer for storing the name of the open modal, or null if no modal is open.\n *\n * @param {Object} state Previous state.\n * @param {Object} action Action object containing the `name` of the modal\n *\n * @return {Object} Updated state\n */\nexport function activeModal( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MODAL':\n\t\t\treturn action.name;\n\t\tcase 'CLOSE_MODAL':\n\t\t\treturn null;\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tcomplementaryAreas,\n\tactiveModal,\n} );\n"]}
|
package/build/store/selectors.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.isItemPinned = exports.isFeatureActive = exports.isComplementaryAreaLoading = exports.getActiveComplementaryArea = void 0;
|
|
9
|
+
exports.isModalActive = isModalActive;
|
|
9
10
|
|
|
10
11
|
var _data = require("@wordpress/data");
|
|
11
12
|
|
|
@@ -83,5 +84,18 @@ const isFeatureActive = (0, _data.createRegistrySelector)(select => (state, scop
|
|
|
83
84
|
});
|
|
84
85
|
return !!select(_preferences.store).get(scope, featureName);
|
|
85
86
|
});
|
|
87
|
+
/**
|
|
88
|
+
* Returns true if a modal is active, or false otherwise.
|
|
89
|
+
*
|
|
90
|
+
* @param {Object} state Global application state.
|
|
91
|
+
* @param {string} modalName A string that uniquely identifies the modal.
|
|
92
|
+
*
|
|
93
|
+
* @return {boolean} Whether the modal is active.
|
|
94
|
+
*/
|
|
95
|
+
|
|
86
96
|
exports.isFeatureActive = isFeatureActive;
|
|
97
|
+
|
|
98
|
+
function isModalActive(state, modalName) {
|
|
99
|
+
return state.activeModal === modalName;
|
|
100
|
+
}
|
|
87
101
|
//# sourceMappingURL=selectors.js.map
|
|
@@ -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":"
|
|
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","isModalActive","modalName","activeModal"],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,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;AAcP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASG,aAAT,CAAwBjB,KAAxB,EAA+BkB,SAA/B,EAA2C;AACjD,SAAOlB,KAAK,CAACmB,WAAN,KAAsBD,SAA7B;AACA","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\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n"]}
|
|
@@ -33,6 +33,26 @@ function useHTMLClass(className) {
|
|
|
33
33
|
}, [className]);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
const headerVariants = {
|
|
37
|
+
hidden: {
|
|
38
|
+
opacity: 0
|
|
39
|
+
},
|
|
40
|
+
hover: {
|
|
41
|
+
opacity: 1,
|
|
42
|
+
transition: {
|
|
43
|
+
type: 'tween',
|
|
44
|
+
delay: 0.2,
|
|
45
|
+
delayChildren: 0.2
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
distractionFreeInactive: {
|
|
49
|
+
opacity: 1,
|
|
50
|
+
transition: {
|
|
51
|
+
delay: 0
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
36
56
|
function InterfaceSkeleton({
|
|
37
57
|
isDistractionFree,
|
|
38
58
|
footer,
|
|
@@ -74,25 +94,6 @@ function InterfaceSkeleton({
|
|
|
74
94
|
const mergedLabels = { ...defaultLabels,
|
|
75
95
|
...labels
|
|
76
96
|
};
|
|
77
|
-
const headerVariants = {
|
|
78
|
-
hidden: {
|
|
79
|
-
opacity: 0
|
|
80
|
-
},
|
|
81
|
-
hover: {
|
|
82
|
-
opacity: 1,
|
|
83
|
-
transition: {
|
|
84
|
-
type: 'tween',
|
|
85
|
-
delay: 0.2,
|
|
86
|
-
delayChildren: 0.2
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
distractionFreeInactive: {
|
|
90
|
-
opacity: 1,
|
|
91
|
-
transition: {
|
|
92
|
-
delay: 0
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
97
|
return createElement("div", { ...(enableRegionNavigation ? navigateRegionsProps : {}),
|
|
97
98
|
ref: useMergeRefs([ref, enableRegionNavigation ? navigateRegionsProps.ref : undefined]),
|
|
98
99
|
className: classnames(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"names":["classnames","forwardRef","useEffect","__unstableUseNavigateRegions","useNavigateRegions","__unstableMotion","motion","__","useMergeRefs","NavigableRegion","useHTMLClass","className","element","document","querySelector","classList","toggle","
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"names":["classnames","forwardRef","useEffect","__unstableUseNavigateRegions","useNavigateRegions","__unstableMotion","motion","__","useMergeRefs","NavigableRegion","useHTMLClass","className","element","document","querySelector","classList","toggle","headerVariants","hidden","opacity","hover","transition","type","delay","delayChildren","distractionFreeInactive","InterfaceSkeleton","isDistractionFree","footer","header","editorNotices","sidebar","secondarySidebar","notices","content","actions","labels","enableRegionNavigation","shortcuts","ref","navigateRegionsProps","defaultLabels","body","mergedLabels","undefined","div"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,SAArB,QAAsC,oBAAtC;AACA,SACCC,4BAA4B,IAAIC,kBADjC,EAECC,gBAAgB,IAAIC,MAFrB,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,qBAA5B;;AAEA,SAASC,YAAT,CAAuBC,SAAvB,EAAmC;AAClCT,EAAAA,SAAS,CAAE,MAAM;AAChB,UAAMU,OAAO,GACZC,QAAQ,IAAIA,QAAQ,CAACC,aAAT,CAAyB,aAAaH,SAAW,GAAjD,CADb;;AAEA,QAAK,CAAEC,OAAP,EAAiB;AAChB;AACA;;AACDA,IAAAA,OAAO,CAACG,SAAR,CAAkBC,MAAlB,CAA0BL,SAA1B;AACA,WAAO,MAAM;AACZC,MAAAA,OAAO,CAACG,SAAR,CAAkBC,MAAlB,CAA0BL,SAA1B;AACA,KAFD;AAGA,GAVQ,EAUN,CAAEA,SAAF,CAVM,CAAT;AAWA;;AAED,MAAMM,cAAc,GAAG;AACtBC,EAAAA,MAAM,EAAE;AAAEC,IAAAA,OAAO,EAAE;AAAX,GADc;AAEtBC,EAAAA,KAAK,EAAE;AACND,IAAAA,OAAO,EAAE,CADH;AAENE,IAAAA,UAAU,EAAE;AAAEC,MAAAA,IAAI,EAAE,OAAR;AAAiBC,MAAAA,KAAK,EAAE,GAAxB;AAA6BC,MAAAA,aAAa,EAAE;AAA5C;AAFN,GAFe;AAM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CArBF,EA4BG,CAAC,CAAEI,OAAH,IACD,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,SAAS,EAAGQ,YAAY,CAACR;AAF1B,KAIGA,OAJH,CA7BF,CApCD,CAbD,EAuFG,CAAC,CAAEP,MAAH,IACD,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,SAAS,EAAGe,YAAY,CAACf;AAF1B,KAIGA,MAJH,CAxFF,CADD;AAkGA;;AAED,eAAe3B,UAAU,CAAEyB,iBAAF,CAAzB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport {\n\t__unstableUseNavigateRegions as useNavigateRegions,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NavigableRegion from '../navigable-region';\n\nfunction useHTMLClass( className ) {\n\tuseEffect( () => {\n\t\tconst element =\n\t\t\tdocument && document.querySelector( `html:not(.${ className })` );\n\t\tif ( ! element ) {\n\t\t\treturn;\n\t\t}\n\t\telement.classList.toggle( className );\n\t\treturn () => {\n\t\t\telement.classList.toggle( className );\n\t\t};\n\t}, [ className ] );\n}\n\nconst headerVariants = {\n\thidden: { opacity: 0 },\n\thover: {\n\t\topacity: 1,\n\t\ttransition: { type: 'tween', delay: 0.2, delayChildren: 0.2 },\n\t},\n\tdistractionFreeInactive: { opacity: 1, transition: { delay: 0 } },\n};\n\nfunction InterfaceSkeleton(\n\t{\n\t\tisDistractionFree,\n\t\tfooter,\n\t\theader,\n\t\teditorNotices,\n\t\tsidebar,\n\t\tsecondarySidebar,\n\t\tnotices,\n\t\tcontent,\n\t\tactions,\n\t\tlabels,\n\t\tclassName,\n\t\tenableRegionNavigation = true,\n\t\t// Todo: does this need to be a prop.\n\t\t// Can we use a dependency to keyboard-shortcuts directly?\n\t\tshortcuts,\n\t},\n\tref\n) {\n\tconst navigateRegionsProps = useNavigateRegions( shortcuts );\n\n\tuseHTMLClass( 'interface-interface-skeleton__html-container' );\n\n\tconst defaultLabels = {\n\t\t/* translators: accessibility text for the top bar landmark region. */\n\t\theader: __( 'Header' ),\n\t\t/* translators: accessibility text for the content landmark region. */\n\t\tbody: __( 'Content' ),\n\t\t/* translators: accessibility text for the secondary sidebar landmark region. */\n\t\tsecondarySidebar: __( 'Block Library' ),\n\t\t/* translators: accessibility text for the settings landmark region. */\n\t\tsidebar: __( 'Settings' ),\n\t\t/* translators: accessibility text for the publish landmark region. */\n\t\tactions: __( 'Publish' ),\n\t\t/* translators: accessibility text for the footer landmark region. */\n\t\tfooter: __( 'Footer' ),\n\t};\n\n\tconst mergedLabels = { ...defaultLabels, ...labels };\n\n\treturn (\n\t\t<div\n\t\t\t{ ...( enableRegionNavigation ? navigateRegionsProps : {} ) }\n\t\t\tref={ useMergeRefs( [\n\t\t\t\tref,\n\t\t\t\tenableRegionNavigation ? navigateRegionsProps.ref : undefined,\n\t\t\t] ) }\n\t\t\tclassName={ classnames(\n\t\t\t\tclassName,\n\t\t\t\t'interface-interface-skeleton',\n\t\t\t\tnavigateRegionsProps.className,\n\t\t\t\t!! footer && 'has-footer'\n\t\t\t) }\n\t\t>\n\t\t\t<div className=\"interface-interface-skeleton__editor\">\n\t\t\t\t{ !! header && (\n\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__header\"\n\t\t\t\t\t\taria-label={ mergedLabels.header }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t\t\t? 'hidden'\n\t\t\t\t\t\t\t\t: 'distractionFreeInactive'\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhileHover={\n\t\t\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t\t\t? 'hover'\n\t\t\t\t\t\t\t\t: 'distractionFreeInactive'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={\n\t\t\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t\t\t? 'hidden'\n\t\t\t\t\t\t\t\t: 'distractionFreeInactive'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvariants={ headerVariants }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t\t\t? { type: 'tween', delay: 0.8 }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ header }\n\t\t\t\t\t</NavigableRegion>\n\t\t\t\t) }\n\t\t\t\t{ isDistractionFree && (\n\t\t\t\t\t<div className=\"interface-interface-skeleton__header\">\n\t\t\t\t\t\t{ editorNotices }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div className=\"interface-interface-skeleton__body\">\n\t\t\t\t\t{ !! secondarySidebar && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__secondary-sidebar\"\n\t\t\t\t\t\t\tariaLabel={ mergedLabels.secondarySidebar }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ secondarySidebar }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! notices && (\n\t\t\t\t\t\t<div className=\"interface-interface-skeleton__notices\">\n\t\t\t\t\t\t\t{ notices }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__content\"\n\t\t\t\t\t\tariaLabel={ mergedLabels.body }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ content }\n\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t{ !! sidebar && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__sidebar\"\n\t\t\t\t\t\t\tariaLabel={ mergedLabels.sidebar }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sidebar }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! actions && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__actions\"\n\t\t\t\t\t\t\tariaLabel={ mergedLabels.actions }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ actions }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{ !! footer && (\n\t\t\t\t<NavigableRegion\n\t\t\t\t\tclassName=\"interface-interface-skeleton__footer\"\n\t\t\t\t\tariaLabel={ mergedLabels.footer }\n\t\t\t\t>\n\t\t\t\t\t{ footer }\n\t\t\t\t</NavigableRegion>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( InterfaceSkeleton );\n"]}
|
|
@@ -167,4 +167,29 @@ export function setFeatureDefaults(scope, defaults) {
|
|
|
167
167
|
registry.dispatch(preferencesStore).setDefaults(scope, defaults);
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Returns an action object used in signalling that the user opened a modal.
|
|
172
|
+
*
|
|
173
|
+
* @param {string} name A string that uniquely identifies the modal.
|
|
174
|
+
*
|
|
175
|
+
* @return {Object} Action object.
|
|
176
|
+
*/
|
|
177
|
+
|
|
178
|
+
export function openModal(name) {
|
|
179
|
+
return {
|
|
180
|
+
type: 'OPEN_MODAL',
|
|
181
|
+
name
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Returns an action object signalling that the user closed a modal.
|
|
186
|
+
*
|
|
187
|
+
* @return {Object} Action object.
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
export function closeModal() {
|
|
191
|
+
return {
|
|
192
|
+
type: 'CLOSE_MODAL'
|
|
193
|
+
};
|
|
194
|
+
}
|
|
170
195
|
//# sourceMappingURL=actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/store/actions.js"],"names":["deprecated","store","preferencesStore","setDefaultComplementaryArea","scope","area","type","enableComplementaryArea","registry","dispatch","isComplementaryAreaVisible","select","get","set","disableComplementaryArea","pinItem","item","pinnedItems","unpinItem","toggleFeature","featureName","since","alternative","toggle","setFeatureValue","value","setFeatureDefaults","defaults","setDefaults"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,uBAAvB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,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;;AACA,OAAO,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,CACzBT,gBADyB,EAEjCU,GAFiC,CAE5BR,KAF4B,EAErB,4BAFqB,CAAnC;;AAIA,MAAK,CAAEM,0BAAP,EAAoC;AACnCF,IAAAA,QAAQ,CACNC,QADF,CACYP,gBADZ,EAEEW,GAFF,CAEOT,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;;AACA,OAAO,MAAM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AQ,CAACC,QAAT,CAAmBP,gBAAnB,EAAsC0B,WAAtC,CAAmDxB,KAAnD,EAA0DuB,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"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/store/actions.js"],"names":["deprecated","store","preferencesStore","setDefaultComplementaryArea","scope","area","type","enableComplementaryArea","registry","dispatch","isComplementaryAreaVisible","select","get","set","disableComplementaryArea","pinItem","item","pinnedItems","unpinItem","toggleFeature","featureName","since","alternative","toggle","setFeatureValue","value","setFeatureDefaults","defaults","setDefaults","openModal","name","closeModal"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,uBAAvB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,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;;AACA,OAAO,MAAME,uBAAuB,GACnC,CAAEH,KAAF,EAASC,IAAT,KACA,CAAE;AAAEG,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAAF,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KADoD;AAE3DC,MAAAA,WAAW,EAAG;AAF6C,KAAlD,CAAV;AAKAd,IAAAA,QAAQ,CACNC,QADF,CACYP,gBADZ,EAEEW,GAFF,CAEOT,KAFP,EAEcgB,WAFd,EAE2B,CAAC,CAAEK,KAF9B;AAGA,GATD;AAUA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA6BtB,KAA7B,EAAoCuB,QAApC,EAA+C;AACrD,SAAO,UAAW;AAAEnB,IAAAA;AAAF,GAAX,EAA0B;AAChCR,IAAAA,UAAU,CAAG,iDAAH,EAAqD;AAC9DqB,MAAAA,KAAK,EAAE,KADuD;AAE9DC,MAAAA,WAAW,EAAG;AAFgD,KAArD,CAAV;AAKAd,IAAAA,QAAQ,CAACC,QAAT,CAAmBP,gBAAnB,EAAsC0B,WAAtC,CAAmDxB,KAAnD,EAA0DuB,QAA1D;AACA,GAPD;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,SAAT,CAAoBC,IAApB,EAA2B;AACjC,SAAO;AACNxB,IAAAA,IAAI,EAAE,YADA;AAENwB,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,UAAT,GAAsB;AAC5B,SAAO;AACNzB,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA","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\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport function openModal( name ) {\n\treturn {\n\t\ttype: 'OPEN_MODAL',\n\t\tname,\n\t};\n}\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @return {Object} Action object.\n */\nexport function closeModal() {\n\treturn {\n\t\ttype: 'CLOSE_MODAL',\n\t};\n}\n"]}
|
|
@@ -34,7 +34,28 @@ export function complementaryAreas(state = {}, action) {
|
|
|
34
34
|
|
|
35
35
|
return state;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Reducer for storing the name of the open modal, or null if no modal is open.
|
|
39
|
+
*
|
|
40
|
+
* @param {Object} state Previous state.
|
|
41
|
+
* @param {Object} action Action object containing the `name` of the modal
|
|
42
|
+
*
|
|
43
|
+
* @return {Object} Updated state
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
export function activeModal(state = null, action) {
|
|
47
|
+
switch (action.type) {
|
|
48
|
+
case 'OPEN_MODAL':
|
|
49
|
+
return action.name;
|
|
50
|
+
|
|
51
|
+
case 'CLOSE_MODAL':
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return state;
|
|
56
|
+
}
|
|
37
57
|
export default combineReducers({
|
|
38
|
-
complementaryAreas
|
|
58
|
+
complementaryAreas,
|
|
59
|
+
activeModal
|
|
39
60
|
});
|
|
40
61
|
//# sourceMappingURL=reducer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/store/reducer.js"],"names":["combineReducers","complementaryAreas","state","action","type","scope","area"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA,OAAO,SAASC,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;AAED,eAAeF,eAAe,CAAE;AAC/BC,EAAAA;
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/store/reducer.js"],"names":["combineReducers","complementaryAreas","state","action","type","scope","area","activeModal","name"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA,OAAO,SAASC,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;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,WAAT,CAAsBL,KAAK,GAAG,IAA9B,EAAoCC,MAApC,EAA6C;AACnD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,YAAL;AACC,aAAOD,MAAM,CAACK,IAAd;;AACD,SAAK,aAAL;AACC,aAAO,IAAP;AAJF;;AAOA,SAAON,KAAP;AACA;AAED,eAAeF,eAAe,CAAE;AAC/BC,EAAAA,kBAD+B;AAE/BM,EAAAA;AAF+B,CAAF,CAA9B","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\n/**\n * Reducer for storing the name of the open modal, or null if no modal is open.\n *\n * @param {Object} state Previous state.\n * @param {Object} action Action object containing the `name` of the modal\n *\n * @return {Object} Updated state\n */\nexport function activeModal( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MODAL':\n\t\t\treturn action.name;\n\t\tcase 'CLOSE_MODAL':\n\t\t\treturn null;\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tcomplementaryAreas,\n\tactiveModal,\n} );\n"]}
|
|
@@ -68,4 +68,16 @@ export const isFeatureActive = createRegistrySelector(select => (state, scope, f
|
|
|
68
68
|
});
|
|
69
69
|
return !!select(preferencesStore).get(scope, featureName);
|
|
70
70
|
});
|
|
71
|
+
/**
|
|
72
|
+
* Returns true if a modal is active, or false otherwise.
|
|
73
|
+
*
|
|
74
|
+
* @param {Object} state Global application state.
|
|
75
|
+
* @param {string} modalName A string that uniquely identifies the modal.
|
|
76
|
+
*
|
|
77
|
+
* @return {boolean} Whether the modal is active.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
export function isModalActive(state, modalName) {
|
|
81
|
+
return state.activeModal === modalName;
|
|
82
|
+
}
|
|
71
83
|
//# sourceMappingURL=selectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/store/selectors.js"],"names":["createRegistrySelector","deprecated","store","preferencesStore","getActiveComplementaryArea","select","state","scope","isComplementaryAreaVisible","get","undefined","complementaryAreas","isComplementaryAreaLoading","isVisible","identifier","isItemPinned","item","pinnedItems","isFeatureActive","featureName","since","alternative"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAT,QAAuC,iBAAvC;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,0BAA0B,GAAGJ,sBAAsB,CAC7DK,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,KAAoB;AACjC,QAAMC,0BAA0B,GAAGH,MAAM,CAAEF,gBAAF,CAAN,CAA2BM,GAA3B,CAClCF,KADkC,EAElC,4BAFkC,CAAnC,CADiC,CAMjC;AACA;AACA;;AACA,MAAKC,0BAA0B,KAAKE,SAApC,EAAgD;AAC/C,WAAOA,SAAP;AACA,GAXgC,CAajC;;;AACA,MAAKF,0BAA0B,KAAK,KAApC,EAA4C;AAC3C,WAAO,IAAP;AACA;;AAED,SAAOF,KAAK,EAAEK,kBAAP,GAA6BJ,KAA7B,CAAP;AACA,CApB8D,CAAzD;AAuBP,OAAO,MAAMK,0BAA0B,GAAGZ,sBAAsB,CAC7DK,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,KAAoB;AACjC,QAAMM,SAAS,GAAGR,MAAM,CAAEF,gBAAF,CAAN,CAA2BM,GAA3B,CACjBF,KADiB,EAEjB,4BAFiB,CAAlB;AAIA,QAAMO,UAAU,GAAGR,KAAK,EAAEK,kBAAP,GAA6BJ,KAA7B,CAAnB;AAEA,SAAOM,SAAS,IAAIC,UAAU,KAAKJ,SAAnC;AACA,CAT8D,CAAzD;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMK,YAAY,GAAGf,sBAAsB,CAC/CK,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBS,IAAhB,KAA0B;AAAA;;AACvC,QAAMC,WAAW,GAAGZ,MAAM,CAAEF,gBAAF,CAAN,CAA2BM,GAA3B,CACnBF,KADmB,EAEnB,aAFmB,CAApB;AAIA,8BAAOU,WAAW,GAAID,IAAJ,CAAlB,iEAAgC,IAAhC;AACA,CAPgD,CAA3C;AAUP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,eAAe,GAAGlB,sBAAsB,CAClDK,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBY,WAAhB,KAAiC;AAC9ClB,EAAAA,UAAU,CACR,kEADQ,EAET;AACCmB,IAAAA,KAAK,EAAE,KADR;AAECC,IAAAA,WAAW,EAAG;AAFf,GAFS,CAAV;AAQA,SAAO,CAAC,CAAEhB,MAAM,CAAEF,gBAAF,CAAN,CAA2BM,GAA3B,CAAgCF,KAAhC,EAAuCY,WAAvC,CAAV;AACA,CAXmD,CAA9C","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"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/store/selectors.js"],"names":["createRegistrySelector","deprecated","store","preferencesStore","getActiveComplementaryArea","select","state","scope","isComplementaryAreaVisible","get","undefined","complementaryAreas","isComplementaryAreaLoading","isVisible","identifier","isItemPinned","item","pinnedItems","isFeatureActive","featureName","since","alternative","isModalActive","modalName","activeModal"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAT,QAAuC,iBAAvC;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,0BAA0B,GAAGJ,sBAAsB,CAC7DK,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,KAAoB;AACjC,QAAMC,0BAA0B,GAAGH,MAAM,CAAEF,gBAAF,CAAN,CAA2BM,GAA3B,CAClCF,KADkC,EAElC,4BAFkC,CAAnC,CADiC,CAMjC;AACA;AACA;;AACA,MAAKC,0BAA0B,KAAKE,SAApC,EAAgD;AAC/C,WAAOA,SAAP;AACA,GAXgC,CAajC;;;AACA,MAAKF,0BAA0B,KAAK,KAApC,EAA4C;AAC3C,WAAO,IAAP;AACA;;AAED,SAAOF,KAAK,EAAEK,kBAAP,GAA6BJ,KAA7B,CAAP;AACA,CApB8D,CAAzD;AAuBP,OAAO,MAAMK,0BAA0B,GAAGZ,sBAAsB,CAC7DK,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,KAAoB;AACjC,QAAMM,SAAS,GAAGR,MAAM,CAAEF,gBAAF,CAAN,CAA2BM,GAA3B,CACjBF,KADiB,EAEjB,4BAFiB,CAAlB;AAIA,QAAMO,UAAU,GAAGR,KAAK,EAAEK,kBAAP,GAA6BJ,KAA7B,CAAnB;AAEA,SAAOM,SAAS,IAAIC,UAAU,KAAKJ,SAAnC;AACA,CAT8D,CAAzD;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMK,YAAY,GAAGf,sBAAsB,CAC/CK,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBS,IAAhB,KAA0B;AAAA;;AACvC,QAAMC,WAAW,GAAGZ,MAAM,CAAEF,gBAAF,CAAN,CAA2BM,GAA3B,CACnBF,KADmB,EAEnB,aAFmB,CAApB;AAIA,8BAAOU,WAAW,GAAID,IAAJ,CAAlB,iEAAgC,IAAhC;AACA,CAPgD,CAA3C;AAUP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,eAAe,GAAGlB,sBAAsB,CAClDK,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBY,WAAhB,KAAiC;AAC9ClB,EAAAA,UAAU,CACR,kEADQ,EAET;AACCmB,IAAAA,KAAK,EAAE,KADR;AAECC,IAAAA,WAAW,EAAG;AAFf,GAFS,CAAV;AAQA,SAAO,CAAC,CAAEhB,MAAM,CAAEF,gBAAF,CAAN,CAA2BM,GAA3B,CAAgCF,KAAhC,EAAuCY,WAAvC,CAAV;AACA,CAXmD,CAA9C;AAcP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,aAAT,CAAwBhB,KAAxB,EAA+BiB,SAA/B,EAA2C;AACjD,SAAOjB,KAAK,CAACkB,WAAN,KAAsBD,SAA7B;AACA","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\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/interface",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.15.0",
|
|
4
4
|
"description": "Interface module for WordPress. The package contains shared functionality across the modern JavaScript-based WordPress screens.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.16.0",
|
|
35
|
-
"@wordpress/a11y": "^3.
|
|
36
|
-
"@wordpress/components": "^25.
|
|
37
|
-
"@wordpress/compose": "^6.
|
|
38
|
-
"@wordpress/data": "^9.
|
|
39
|
-
"@wordpress/deprecated": "^3.
|
|
40
|
-
"@wordpress/element": "^5.
|
|
41
|
-
"@wordpress/i18n": "^4.
|
|
42
|
-
"@wordpress/icons": "^9.
|
|
43
|
-
"@wordpress/plugins": "^6.
|
|
44
|
-
"@wordpress/preferences": "^3.
|
|
45
|
-
"@wordpress/viewport": "^5.
|
|
35
|
+
"@wordpress/a11y": "^3.38.0",
|
|
36
|
+
"@wordpress/components": "^25.4.0",
|
|
37
|
+
"@wordpress/compose": "^6.15.0",
|
|
38
|
+
"@wordpress/data": "^9.8.0",
|
|
39
|
+
"@wordpress/deprecated": "^3.38.0",
|
|
40
|
+
"@wordpress/element": "^5.15.0",
|
|
41
|
+
"@wordpress/i18n": "^4.38.0",
|
|
42
|
+
"@wordpress/icons": "^9.29.0",
|
|
43
|
+
"@wordpress/plugins": "^6.6.0",
|
|
44
|
+
"@wordpress/preferences": "^3.15.0",
|
|
45
|
+
"@wordpress/viewport": "^5.15.0",
|
|
46
46
|
"classnames": "^2.3.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "6f14d11ed4cb59df110a28ebaa23ecba95eb673a"
|
|
56
56
|
}
|
|
@@ -33,6 +33,15 @@ function useHTMLClass( className ) {
|
|
|
33
33
|
}, [ className ] );
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
const headerVariants = {
|
|
37
|
+
hidden: { opacity: 0 },
|
|
38
|
+
hover: {
|
|
39
|
+
opacity: 1,
|
|
40
|
+
transition: { type: 'tween', delay: 0.2, delayChildren: 0.2 },
|
|
41
|
+
},
|
|
42
|
+
distractionFreeInactive: { opacity: 1, transition: { delay: 0 } },
|
|
43
|
+
};
|
|
44
|
+
|
|
36
45
|
function InterfaceSkeleton(
|
|
37
46
|
{
|
|
38
47
|
isDistractionFree,
|
|
@@ -74,15 +83,6 @@ function InterfaceSkeleton(
|
|
|
74
83
|
|
|
75
84
|
const mergedLabels = { ...defaultLabels, ...labels };
|
|
76
85
|
|
|
77
|
-
const headerVariants = {
|
|
78
|
-
hidden: { opacity: 0 },
|
|
79
|
-
hover: {
|
|
80
|
-
opacity: 1,
|
|
81
|
-
transition: { type: 'tween', delay: 0.2, delayChildren: 0.2 },
|
|
82
|
-
},
|
|
83
|
-
distractionFreeInactive: { opacity: 1, transition: { delay: 0 } },
|
|
84
|
-
};
|
|
85
|
-
|
|
86
86
|
return (
|
|
87
87
|
<div
|
|
88
88
|
{ ...( enableRegionNavigation ? navigateRegionsProps : {} ) }
|
package/src/store/actions.js
CHANGED
|
@@ -181,3 +181,28 @@ export function setFeatureDefaults( scope, defaults ) {
|
|
|
181
181
|
registry.dispatch( preferencesStore ).setDefaults( scope, defaults );
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Returns an action object used in signalling that the user opened a modal.
|
|
187
|
+
*
|
|
188
|
+
* @param {string} name A string that uniquely identifies the modal.
|
|
189
|
+
*
|
|
190
|
+
* @return {Object} Action object.
|
|
191
|
+
*/
|
|
192
|
+
export function openModal( name ) {
|
|
193
|
+
return {
|
|
194
|
+
type: 'OPEN_MODAL',
|
|
195
|
+
name,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Returns an action object signalling that the user closed a modal.
|
|
201
|
+
*
|
|
202
|
+
* @return {Object} Action object.
|
|
203
|
+
*/
|
|
204
|
+
export function closeModal() {
|
|
205
|
+
return {
|
|
206
|
+
type: 'CLOSE_MODAL',
|
|
207
|
+
};
|
|
208
|
+
}
|
package/src/store/reducer.js
CHANGED
|
@@ -30,6 +30,26 @@ export function complementaryAreas( state = {}, action ) {
|
|
|
30
30
|
return state;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Reducer for storing the name of the open modal, or null if no modal is open.
|
|
35
|
+
*
|
|
36
|
+
* @param {Object} state Previous state.
|
|
37
|
+
* @param {Object} action Action object containing the `name` of the modal
|
|
38
|
+
*
|
|
39
|
+
* @return {Object} Updated state
|
|
40
|
+
*/
|
|
41
|
+
export function activeModal( state = null, action ) {
|
|
42
|
+
switch ( action.type ) {
|
|
43
|
+
case 'OPEN_MODAL':
|
|
44
|
+
return action.name;
|
|
45
|
+
case 'CLOSE_MODAL':
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return state;
|
|
50
|
+
}
|
|
51
|
+
|
|
33
52
|
export default combineReducers( {
|
|
34
53
|
complementaryAreas,
|
|
54
|
+
activeModal,
|
|
35
55
|
} );
|
package/src/store/selectors.js
CHANGED
|
@@ -90,3 +90,15 @@ export const isFeatureActive = createRegistrySelector(
|
|
|
90
90
|
return !! select( preferencesStore ).get( scope, featureName );
|
|
91
91
|
}
|
|
92
92
|
);
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Returns true if a modal is active, or false otherwise.
|
|
96
|
+
*
|
|
97
|
+
* @param {Object} state Global application state.
|
|
98
|
+
* @param {string} modalName A string that uniquely identifies the modal.
|
|
99
|
+
*
|
|
100
|
+
* @return {boolean} Whether the modal is active.
|
|
101
|
+
*/
|
|
102
|
+
export function isModalActive( state, modalName ) {
|
|
103
|
+
return state.activeModal === modalName;
|
|
104
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { activeModal } from '../reducer';
|
|
5
|
+
|
|
6
|
+
describe( 'state', () => {
|
|
7
|
+
describe( 'activeModal', () => {
|
|
8
|
+
it( 'should default to null', () => {
|
|
9
|
+
const state = activeModal( undefined, {} );
|
|
10
|
+
expect( state ).toBeNull();
|
|
11
|
+
} );
|
|
12
|
+
|
|
13
|
+
it( 'should set the activeModal to the provided name', () => {
|
|
14
|
+
const state = activeModal( null, {
|
|
15
|
+
type: 'OPEN_MODAL',
|
|
16
|
+
name: 'test-modal',
|
|
17
|
+
} );
|
|
18
|
+
|
|
19
|
+
expect( state ).toEqual( 'test-modal' );
|
|
20
|
+
} );
|
|
21
|
+
|
|
22
|
+
it( 'should set the activeModal to null', () => {
|
|
23
|
+
const state = activeModal( 'test-modal', {
|
|
24
|
+
type: 'CLOSE_MODAL',
|
|
25
|
+
} );
|
|
26
|
+
|
|
27
|
+
expect( state ).toBeNull();
|
|
28
|
+
} );
|
|
29
|
+
} );
|
|
30
|
+
} );
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { isModalActive } from '../selectors';
|
|
5
|
+
|
|
6
|
+
describe( 'selectors', () => {
|
|
7
|
+
describe( 'isModalActive', () => {
|
|
8
|
+
it( 'returns true if the provided name matches the value in the preferences activeModal property', () => {
|
|
9
|
+
const state = {
|
|
10
|
+
activeModal: 'test-modal',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
expect( isModalActive( state, 'test-modal' ) ).toBe( true );
|
|
14
|
+
} );
|
|
15
|
+
|
|
16
|
+
it( 'returns false if the provided name does not match the preferences activeModal property', () => {
|
|
17
|
+
const state = {
|
|
18
|
+
activeModal: 'something-else',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
expect( isModalActive( state, 'test-modal' ) ).toBe( false );
|
|
22
|
+
} );
|
|
23
|
+
|
|
24
|
+
it( 'returns false if the preferences activeModal property is null', () => {
|
|
25
|
+
const state = {
|
|
26
|
+
activeModal: null,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
expect( isModalActive( state, 'test-modal' ) ).toBe( false );
|
|
30
|
+
} );
|
|
31
|
+
} );
|
|
32
|
+
} );
|