@wordpress/interface 5.11.0 → 5.12.1
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 +2 -0
- package/build/components/action-item/index.js +31 -38
- package/build/components/action-item/index.js.map +1 -1
- package/build/components/complementary-area/index.js +30 -34
- package/build/components/complementary-area/index.js.map +1 -1
- package/build/components/complementary-area-header/index.js +10 -12
- package/build/components/complementary-area-header/index.js.map +1 -1
- package/build/components/complementary-area-more-menu-item/index.js +24 -27
- package/build/components/complementary-area-more-menu-item/index.js.map +1 -1
- package/build/components/complementary-area-toggle/index.js +13 -15
- 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 +32 -33
- 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 +11 -13
- package/build/components/navigable-region/index.js.map +1 -1
- package/build/components/pinned-items/index.js +15 -17
- 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 +31 -35
- package/build-module/components/action-item/index.js.map +1 -1
- package/build-module/components/complementary-area/index.js +30 -33
- package/build-module/components/complementary-area/index.js.map +1 -1
- package/build-module/components/complementary-area-header/index.js +10 -11
- package/build-module/components/complementary-area-header/index.js.map +1 -1
- package/build-module/components/complementary-area-more-menu-item/index.js +23 -25
- package/build-module/components/complementary-area-more-menu-item/index.js.map +1 -1
- package/build-module/components/complementary-area-toggle/index.js +13 -14
- 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 +32 -32
- 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 +11 -12
- package/build-module/components/navigable-region/index.js.map +1 -1
- package/build-module/components/pinned-items/index.js +15 -16
- 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/package.json +13 -13
- package/src/components/interface-skeleton/index.js +23 -13
|
@@ -24,12 +24,10 @@ export const setDefaultComplementaryArea = (scope, area) => ({
|
|
|
24
24
|
* @param {string} area Area identifier.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
export const enableComplementaryArea = (scope, area) =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = _ref;
|
|
32
|
-
|
|
27
|
+
export const enableComplementaryArea = (scope, area) => ({
|
|
28
|
+
registry,
|
|
29
|
+
dispatch
|
|
30
|
+
}) => {
|
|
33
31
|
// Return early if there's no area.
|
|
34
32
|
if (!area) {
|
|
35
33
|
return;
|
|
@@ -53,10 +51,9 @@ export const enableComplementaryArea = (scope, area) => _ref => {
|
|
|
53
51
|
* @param {string} scope Complementary area scope.
|
|
54
52
|
*/
|
|
55
53
|
|
|
56
|
-
export const disableComplementaryArea = scope =>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
} = _ref2;
|
|
54
|
+
export const disableComplementaryArea = scope => ({
|
|
55
|
+
registry
|
|
56
|
+
}) => {
|
|
60
57
|
const isComplementaryAreaVisible = registry.select(preferencesStore).get(scope, 'isComplementaryAreaVisible');
|
|
61
58
|
|
|
62
59
|
if (isComplementaryAreaVisible) {
|
|
@@ -72,11 +69,9 @@ export const disableComplementaryArea = scope => _ref2 => {
|
|
|
72
69
|
* @return {Object} Action object.
|
|
73
70
|
*/
|
|
74
71
|
|
|
75
|
-
export const pinItem = (scope, item) =>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
} = _ref3;
|
|
79
|
-
|
|
72
|
+
export const pinItem = (scope, item) => ({
|
|
73
|
+
registry
|
|
74
|
+
}) => {
|
|
80
75
|
// Return early if there's no item.
|
|
81
76
|
if (!item) {
|
|
82
77
|
return;
|
|
@@ -84,7 +79,7 @@ export const pinItem = (scope, item) => _ref3 => {
|
|
|
84
79
|
|
|
85
80
|
const pinnedItems = registry.select(preferencesStore).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do.
|
|
86
81
|
|
|
87
|
-
if (
|
|
82
|
+
if (pinnedItems?.[item] === true) {
|
|
88
83
|
return;
|
|
89
84
|
}
|
|
90
85
|
|
|
@@ -99,11 +94,9 @@ export const pinItem = (scope, item) => _ref3 => {
|
|
|
99
94
|
* @param {string} item Item identifier.
|
|
100
95
|
*/
|
|
101
96
|
|
|
102
|
-
export const unpinItem = (scope, item) =>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
} = _ref4;
|
|
106
|
-
|
|
97
|
+
export const unpinItem = (scope, item) => ({
|
|
98
|
+
registry
|
|
99
|
+
}) => {
|
|
107
100
|
// Return early if there's no item.
|
|
108
101
|
if (!item) {
|
|
109
102
|
return;
|
|
@@ -122,10 +115,9 @@ export const unpinItem = (scope, item) => _ref4 => {
|
|
|
122
115
|
*/
|
|
123
116
|
|
|
124
117
|
export function toggleFeature(scope, featureName) {
|
|
125
|
-
return function (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
} = _ref5;
|
|
118
|
+
return function ({
|
|
119
|
+
registry
|
|
120
|
+
}) {
|
|
129
121
|
deprecated(`dispatch( 'core/interface' ).toggleFeature`, {
|
|
130
122
|
since: '6.0',
|
|
131
123
|
alternative: `dispatch( 'core/preferences' ).toggle`
|
|
@@ -145,10 +137,9 @@ export function toggleFeature(scope, featureName) {
|
|
|
145
137
|
*/
|
|
146
138
|
|
|
147
139
|
export function setFeatureValue(scope, featureName, value) {
|
|
148
|
-
return function (
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
} = _ref6;
|
|
140
|
+
return function ({
|
|
141
|
+
registry
|
|
142
|
+
}) {
|
|
152
143
|
deprecated(`dispatch( 'core/interface' ).setFeatureValue`, {
|
|
153
144
|
since: '6.0',
|
|
154
145
|
alternative: `dispatch( 'core/preferences' ).set`
|
|
@@ -166,10 +157,9 @@ export function setFeatureValue(scope, featureName, value) {
|
|
|
166
157
|
*/
|
|
167
158
|
|
|
168
159
|
export function setFeatureDefaults(scope, defaults) {
|
|
169
|
-
return function (
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
} = _ref7;
|
|
160
|
+
return function ({
|
|
161
|
+
registry
|
|
162
|
+
}) {
|
|
173
163
|
deprecated(`dispatch( 'core/interface' ).setFeatureDefaults`, {
|
|
174
164
|
since: '6.0',
|
|
175
165
|
alternative: `dispatch( 'core/preferences' ).setDefaults`
|
|
@@ -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,
|
|
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/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;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,eAAT,CAA0BpB,KAA1B,EAAiCgB,WAAjC,EAA8CK,KAA9C,EAAsD;AAC5D,SAAO,UAAW;AAAEjB,IAAAA;AAAF,GAAX,EAA0B;AAChCR,IAAAA,UAAU,CAAG,8CAAH,EAAkD;AAC3DqB,MAAAA,KAAK,EAAE,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","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"]}
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { combineReducers } from '@wordpress/data';
|
|
5
|
-
export function complementaryAreas() {
|
|
6
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
8
|
-
|
|
5
|
+
export function complementaryAreas(state = {}, action) {
|
|
9
6
|
switch (action.type) {
|
|
10
7
|
case 'SET_DEFAULT_COMPLEMENTARY_AREA':
|
|
11
8
|
{
|
|
@@ -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,
|
|
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;AAD+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\nexport default combineReducers( {\n\tcomplementaryAreas,\n} );\n"]}
|
|
@@ -14,8 +14,6 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
export const getActiveComplementaryArea = createRegistrySelector(select => (state, scope) => {
|
|
17
|
-
var _state$complementaryA;
|
|
18
|
-
|
|
19
17
|
const isComplementaryAreaVisible = select(preferencesStore).get(scope, 'isComplementaryAreaVisible'); // Return `undefined` to indicate that the user has never toggled
|
|
20
18
|
// visibility, this is the vanilla default. Other code relies on this
|
|
21
19
|
// nuance in the return value.
|
|
@@ -29,13 +27,11 @@ export const getActiveComplementaryArea = createRegistrySelector(select => (stat
|
|
|
29
27
|
return null;
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
return state
|
|
30
|
+
return state?.complementaryAreas?.[scope];
|
|
33
31
|
});
|
|
34
32
|
export const isComplementaryAreaLoading = createRegistrySelector(select => (state, scope) => {
|
|
35
|
-
var _state$complementaryA2;
|
|
36
|
-
|
|
37
33
|
const isVisible = select(preferencesStore).get(scope, 'isComplementaryAreaVisible');
|
|
38
|
-
const identifier = state
|
|
34
|
+
const identifier = state?.complementaryAreas?.[scope];
|
|
39
35
|
return isVisible && identifier === undefined;
|
|
40
36
|
});
|
|
41
37
|
/**
|
|
@@ -52,7 +48,7 @@ export const isItemPinned = createRegistrySelector(select => (state, scope, item
|
|
|
52
48
|
var _pinnedItems$item;
|
|
53
49
|
|
|
54
50
|
const pinnedItems = select(preferencesStore).get(scope, 'pinnedItems');
|
|
55
|
-
return (_pinnedItems$item = pinnedItems
|
|
51
|
+
return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
|
|
56
52
|
});
|
|
57
53
|
/**
|
|
58
54
|
* 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":["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;
|
|
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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gC,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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/interface",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.1",
|
|
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.35.1",
|
|
36
|
+
"@wordpress/components": "^25.1.1",
|
|
37
|
+
"@wordpress/compose": "^6.12.1",
|
|
38
|
+
"@wordpress/data": "^9.5.1",
|
|
39
|
+
"@wordpress/deprecated": "^3.35.1",
|
|
40
|
+
"@wordpress/element": "^5.12.1",
|
|
41
|
+
"@wordpress/i18n": "^4.35.1",
|
|
42
|
+
"@wordpress/icons": "^9.26.1",
|
|
43
|
+
"@wordpress/plugins": "^6.3.1",
|
|
44
|
+
"@wordpress/preferences": "^3.12.1",
|
|
45
|
+
"@wordpress/viewport": "^5.12.1",
|
|
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": "ce5639111c30763dbdf07f40eeb136ea6030ecf1"
|
|
56
56
|
}
|
|
@@ -75,11 +75,12 @@ function InterfaceSkeleton(
|
|
|
75
75
|
const mergedLabels = { ...defaultLabels, ...labels };
|
|
76
76
|
|
|
77
77
|
const headerVariants = {
|
|
78
|
-
hidden:
|
|
78
|
+
hidden: { opacity: 0 },
|
|
79
79
|
hover: {
|
|
80
80
|
opacity: 1,
|
|
81
81
|
transition: { type: 'tween', delay: 0.2, delayChildren: 0.2 },
|
|
82
82
|
},
|
|
83
|
+
distractionFreeInactive: { opacity: 1, transition: { delay: 0 } },
|
|
83
84
|
};
|
|
84
85
|
|
|
85
86
|
return (
|
|
@@ -97,23 +98,32 @@ function InterfaceSkeleton(
|
|
|
97
98
|
) }
|
|
98
99
|
>
|
|
99
100
|
<div className="interface-interface-skeleton__editor">
|
|
100
|
-
{ !! header &&
|
|
101
|
+
{ !! header && (
|
|
101
102
|
<NavigableRegion
|
|
102
103
|
as={ motion.div }
|
|
103
104
|
className="interface-interface-skeleton__header"
|
|
104
105
|
aria-label={ mergedLabels.header }
|
|
105
|
-
initial={
|
|
106
|
-
|
|
106
|
+
initial={
|
|
107
|
+
isDistractionFree
|
|
108
|
+
? 'hidden'
|
|
109
|
+
: 'distractionFreeInactive'
|
|
110
|
+
}
|
|
111
|
+
whileHover={
|
|
112
|
+
isDistractionFree
|
|
113
|
+
? 'hover'
|
|
114
|
+
: 'distractionFreeInactive'
|
|
115
|
+
}
|
|
116
|
+
animate={
|
|
117
|
+
isDistractionFree
|
|
118
|
+
? 'hidden'
|
|
119
|
+
: 'distractionFreeInactive'
|
|
120
|
+
}
|
|
107
121
|
variants={ headerVariants }
|
|
108
|
-
transition={
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
{ !! header && ! isDistractionFree && (
|
|
114
|
-
<NavigableRegion
|
|
115
|
-
className="interface-interface-skeleton__header"
|
|
116
|
-
ariaLabel={ mergedLabels.header }
|
|
122
|
+
transition={
|
|
123
|
+
isDistractionFree
|
|
124
|
+
? { type: 'tween', delay: 0.8 }
|
|
125
|
+
: undefined
|
|
126
|
+
}
|
|
117
127
|
>
|
|
118
128
|
{ header }
|
|
119
129
|
</NavigableRegion>
|