@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
package/build/store/selectors.js
CHANGED
|
@@ -26,8 +26,6 @@ var _preferences = require("@wordpress/preferences");
|
|
|
26
26
|
* @return {string | null | undefined} The complementary area that is active in the given scope.
|
|
27
27
|
*/
|
|
28
28
|
const getActiveComplementaryArea = (0, _data.createRegistrySelector)(select => (state, scope) => {
|
|
29
|
-
var _state$complementaryA;
|
|
30
|
-
|
|
31
29
|
const isComplementaryAreaVisible = select(_preferences.store).get(scope, 'isComplementaryAreaVisible'); // Return `undefined` to indicate that the user has never toggled
|
|
32
30
|
// visibility, this is the vanilla default. Other code relies on this
|
|
33
31
|
// nuance in the return value.
|
|
@@ -41,14 +39,12 @@ const getActiveComplementaryArea = (0, _data.createRegistrySelector)(select => (
|
|
|
41
39
|
return null;
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
return state
|
|
42
|
+
return state?.complementaryAreas?.[scope];
|
|
45
43
|
});
|
|
46
44
|
exports.getActiveComplementaryArea = getActiveComplementaryArea;
|
|
47
45
|
const isComplementaryAreaLoading = (0, _data.createRegistrySelector)(select => (state, scope) => {
|
|
48
|
-
var _state$complementaryA2;
|
|
49
|
-
|
|
50
46
|
const isVisible = select(_preferences.store).get(scope, 'isComplementaryAreaVisible');
|
|
51
|
-
const identifier = state
|
|
47
|
+
const identifier = state?.complementaryAreas?.[scope];
|
|
52
48
|
return isVisible && identifier === undefined;
|
|
53
49
|
});
|
|
54
50
|
/**
|
|
@@ -66,7 +62,7 @@ const isItemPinned = (0, _data.createRegistrySelector)(select => (state, scope,
|
|
|
66
62
|
var _pinnedItems$item;
|
|
67
63
|
|
|
68
64
|
const pinnedItems = select(_preferences.store).get(scope, 'pinnedItems');
|
|
69
|
-
return (_pinnedItems$item = pinnedItems
|
|
65
|
+
return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
|
|
70
66
|
});
|
|
71
67
|
/**
|
|
72
68
|
* Returns a boolean indicating whether a feature is active for a particular
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/store/selectors.js"],"names":["getActiveComplementaryArea","select","state","scope","isComplementaryAreaVisible","preferencesStore","get","undefined","complementaryAreas","isComplementaryAreaLoading","isVisible","identifier","isItemPinned","item","pinnedItems","isFeatureActive","featureName","since","alternative"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,0BAA0B,GAAG,kCACvCC,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,KAAoB;
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/store/selectors.js"],"names":["getActiveComplementaryArea","select","state","scope","isComplementaryAreaVisible","preferencesStore","get","undefined","complementaryAreas","isComplementaryAreaLoading","isVisible","identifier","isItemPinned","item","pinnedItems","isFeatureActive","featureName","since","alternative"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,0BAA0B,GAAG,kCACvCC,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,KAAoB;AACjC,QAAMC,0BAA0B,GAAGH,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CAClCH,KADkC,EAElC,4BAFkC,CAAnC,CADiC,CAMjC;AACA;AACA;;AACA,MAAKC,0BAA0B,KAAKG,SAApC,EAAgD;AAC/C,WAAOA,SAAP;AACA,GAXgC,CAajC;;;AACA,MAAKH,0BAA0B,KAAK,KAApC,EAA4C;AAC3C,WAAO,IAAP;AACA;;AAED,SAAOF,KAAK,EAAEM,kBAAP,GAA6BL,KAA7B,CAAP;AACA,CApBwC,CAAnC;;AAuBA,MAAMM,0BAA0B,GAAG,kCACvCR,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,KAAoB;AACjC,QAAMO,SAAS,GAAGT,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CACjBH,KADiB,EAEjB,4BAFiB,CAAlB;AAIA,QAAMQ,UAAU,GAAGT,KAAK,EAAEM,kBAAP,GAA6BL,KAA7B,CAAnB;AAEA,SAAOO,SAAS,IAAIC,UAAU,KAAKJ,SAAnC;AACA,CATwC,CAAnC;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMK,YAAY,GAAG,kCACzBX,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBU,IAAhB,KAA0B;AAAA;;AACvC,QAAMC,WAAW,GAAGb,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CACnBH,KADmB,EAEnB,aAFmB,CAApB;AAIA,8BAAOW,WAAW,GAAID,IAAJ,CAAlB,iEAAgC,IAAhC;AACA,CAP0B,CAArB;AAUP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,eAAe,GAAG,kCAC5Bd,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBa,WAAhB,KAAiC;AAC9C,2BACE,kEADF,EAEC;AACCC,IAAAA,KAAK,EAAE,KADR;AAECC,IAAAA,WAAW,EAAG;AAFf,GAFD;AAQA,SAAO,CAAC,CAAEjB,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CAAgCH,KAAhC,EAAuCa,WAAvC,CAAV;AACA,CAX6B,CAAxB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Returns the complementary area that is active in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Item scope.\n *\n * @return {string | null | undefined} The complementary area that is active in the given scope.\n */\nexport const getActiveComplementaryArea = createRegistrySelector(\n\t( select ) => ( state, scope ) => {\n\t\tconst isComplementaryAreaVisible = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'isComplementaryAreaVisible'\n\t\t);\n\n\t\t// Return `undefined` to indicate that the user has never toggled\n\t\t// visibility, this is the vanilla default. Other code relies on this\n\t\t// nuance in the return value.\n\t\tif ( isComplementaryAreaVisible === undefined ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Return `null` to indicate the user hid the complementary area.\n\t\tif ( isComplementaryAreaVisible === false ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn state?.complementaryAreas?.[ scope ];\n\t}\n);\n\nexport const isComplementaryAreaLoading = createRegistrySelector(\n\t( select ) => ( state, scope ) => {\n\t\tconst isVisible = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'isComplementaryAreaVisible'\n\t\t);\n\t\tconst identifier = state?.complementaryAreas?.[ scope ];\n\n\t\treturn isVisible && identifier === undefined;\n\t}\n);\n\n/**\n * Returns a boolean indicating if an item is pinned or not.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Scope.\n * @param {string} item Item to check.\n *\n * @return {boolean} True if the item is pinned and false otherwise.\n */\nexport const isItemPinned = createRegistrySelector(\n\t( select ) => ( state, scope, item ) => {\n\t\tconst pinnedItems = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'pinnedItems'\n\t\t);\n\t\treturn pinnedItems?.[ item ] ?? true;\n\t}\n);\n\n/**\n * Returns a boolean indicating whether a feature is active for a particular\n * scope.\n *\n * @param {Object} state The store state.\n * @param {string} scope The scope of the feature (e.g. core/edit-post).\n * @param {string} featureName The name of the feature.\n *\n * @return {boolean} Is the feature enabled?\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, scope, featureName ) => {\n\t\tdeprecated(\n\t\t\t`select( 'core/interface' ).isFeatureActive( scope, featureName )`,\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative: `select( 'core/preferences' ).get( scope, featureName )`,\n\t\t\t}\n\t\t);\n\n\t\treturn !! select( preferencesStore ).get( scope, featureName );\n\t}\n);\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -9,14 +8,13 @@ import { Children } from '@wordpress/element';
|
|
|
9
8
|
|
|
10
9
|
const noop = () => {};
|
|
11
10
|
|
|
12
|
-
function ActionItemSlot(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
11
|
+
function ActionItemSlot({
|
|
12
|
+
name,
|
|
13
|
+
as: Component = ButtonGroup,
|
|
14
|
+
fillProps = {},
|
|
15
|
+
bubblesVirtually,
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
20
18
|
return createElement(Slot, {
|
|
21
19
|
name: name,
|
|
22
20
|
bubblesVirtually: bubblesVirtually,
|
|
@@ -32,14 +30,12 @@ function ActionItemSlot(_ref) {
|
|
|
32
30
|
|
|
33
31
|
|
|
34
32
|
const initializedByPlugins = [];
|
|
35
|
-
Children.forEach(fills,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} = _ref2;
|
|
42
|
-
|
|
33
|
+
Children.forEach(fills, ({
|
|
34
|
+
props: {
|
|
35
|
+
__unstableExplicitMenuItem,
|
|
36
|
+
__unstableTarget
|
|
37
|
+
}
|
|
38
|
+
}) => {
|
|
43
39
|
if (__unstableTarget && __unstableExplicitMenuItem) {
|
|
44
40
|
initializedByPlugins.push(__unstableTarget);
|
|
45
41
|
}
|
|
@@ -51,29 +47,29 @@ function ActionItemSlot(_ref) {
|
|
|
51
47
|
|
|
52
48
|
return child;
|
|
53
49
|
});
|
|
54
|
-
return createElement(Component, props
|
|
50
|
+
return createElement(Component, { ...props
|
|
51
|
+
}, children);
|
|
55
52
|
});
|
|
56
53
|
}
|
|
57
54
|
|
|
58
|
-
function ActionItem(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} = _ref3;
|
|
55
|
+
function ActionItem({
|
|
56
|
+
name,
|
|
57
|
+
as: Component = Button,
|
|
58
|
+
onClick,
|
|
59
|
+
...props
|
|
60
|
+
}) {
|
|
65
61
|
return createElement(Fill, {
|
|
66
62
|
name: name
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
63
|
+
}, ({
|
|
64
|
+
onClick: fpOnClick
|
|
65
|
+
}) => {
|
|
66
|
+
return createElement(Component, {
|
|
67
|
+
onClick: onClick || fpOnClick ? (...args) => {
|
|
68
|
+
(onClick || noop)(...args);
|
|
69
|
+
(fpOnClick || noop)(...args);
|
|
70
|
+
} : undefined,
|
|
71
|
+
...props
|
|
72
|
+
});
|
|
77
73
|
});
|
|
78
74
|
}
|
|
79
75
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/action-item/index.js"],"names":["ButtonGroup","Button","Slot","Fill","Children","noop","ActionItemSlot","name","as","Component","fillProps","bubblesVirtually","props","fills","toArray","length","initializedByPlugins","forEach","__unstableExplicitMenuItem","__unstableTarget","push","children","map","child","includes","ActionItem","onClick","fpOnClick","undefined"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/action-item/index.js"],"names":["ButtonGroup","Button","Slot","Fill","Children","noop","ActionItemSlot","name","as","Component","fillProps","bubblesVirtually","props","fills","toArray","length","initializedByPlugins","forEach","__unstableExplicitMenuItem","__unstableTarget","push","children","map","child","includes","ActionItem","onClick","fpOnClick","args","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,MAAtB,EAA8BC,IAA9B,EAAoCC,IAApC,QAAgD,uBAAhD;AACA,SAASC,QAAT,QAAyB,oBAAzB;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,cAAT,CAAyB;AACxBC,EAAAA,IADwB;AAExBC,EAAAA,EAAE,EAAEC,SAAS,GAAGT,W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B,IAAAA,OAAO,EAAEC;AAAX,GAAF,KAA8B;AAC/B,WACC,cAAC,SAAD;AACC,MAAA,OAAO,EACND,OAAO,IAAIC,SAAX,GACG,CAAE,GAAGC,IAAL,KAAe;AACf,SAAEF,OAAO,IAAIrB,IAAb,EAAqB,GAAGuB,IAAxB;AACA,SAAED,SAAS,IAAItB,IAAf,EAAuB,GAAGuB,IAA1B;AACC,OAJJ,GAKGC,SAPL;AAAA,SASMjB;AATN,MADD;AAaA,GAfF,CADD;AAmBA;;AAEDa,UAAU,CAACvB,IAAX,GAAkBI,cAAlB;AAEA,eAAemB,UAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ButtonGroup, Button, Slot, Fill } from '@wordpress/components';\nimport { Children } from '@wordpress/element';\n\nconst noop = () => {};\n\nfunction ActionItemSlot( {\n\tname,\n\tas: Component = ButtonGroup,\n\tfillProps = {},\n\tbubblesVirtually,\n\t...props\n} ) {\n\treturn (\n\t\t<Slot\n\t\t\tname={ name }\n\t\t\tbubblesVirtually={ bubblesVirtually }\n\t\t\tfillProps={ fillProps }\n\t\t>\n\t\t\t{ ( fills ) => {\n\t\t\t\tif ( ! Children.toArray( fills ).length ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\t// Special handling exists for backward compatibility.\n\t\t\t\t// It ensures that menu items created by plugin authors aren't\n\t\t\t\t// duplicated with automatically injected menu items coming\n\t\t\t\t// from pinnable plugin sidebars.\n\t\t\t\t// @see https://github.com/WordPress/gutenberg/issues/14457\n\t\t\t\tconst initializedByPlugins = [];\n\t\t\t\tChildren.forEach(\n\t\t\t\t\tfills,\n\t\t\t\t\t( {\n\t\t\t\t\t\tprops: { __unstableExplicitMenuItem, __unstableTarget },\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tif ( __unstableTarget && __unstableExplicitMenuItem ) {\n\t\t\t\t\t\t\tinitializedByPlugins.push( __unstableTarget );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tconst children = Children.map( fills, ( child ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\t! child.props.__unstableExplicitMenuItem &&\n\t\t\t\t\t\tinitializedByPlugins.includes(\n\t\t\t\t\t\t\tchild.props.__unstableTarget\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t} );\n\n\t\t\t\treturn <Component { ...props }>{ children }</Component>;\n\t\t\t} }\n\t\t</Slot>\n\t);\n}\n\nfunction ActionItem( { name, as: Component = Button, onClick, ...props } ) {\n\treturn (\n\t\t<Fill name={ name }>\n\t\t\t{ ( { onClick: fpOnClick } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Component\n\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\tonClick || fpOnClick\n\t\t\t\t\t\t\t\t? ( ...args ) => {\n\t\t\t\t\t\t\t\t\t\t( onClick || noop )( ...args );\n\t\t\t\t\t\t\t\t\t\t( fpOnClick || noop )( ...args );\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t</Fill>\n\t);\n}\n\nActionItem.Slot = ActionItemSlot;\n\nexport default ActionItem;\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -26,22 +25,21 @@ import withComplementaryAreaContext from '../complementary-area-context';
|
|
|
26
25
|
import PinnedItems from '../pinned-items';
|
|
27
26
|
import { store as interfaceStore } from '../../store';
|
|
28
27
|
|
|
29
|
-
function ComplementaryAreaSlot(
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
function ComplementaryAreaSlot({
|
|
29
|
+
scope,
|
|
30
|
+
...props
|
|
31
|
+
}) {
|
|
32
|
+
return createElement(Slot, {
|
|
33
|
+
name: `ComplementaryArea/${scope}`,
|
|
32
34
|
...props
|
|
33
|
-
}
|
|
34
|
-
return createElement(Slot, _extends({
|
|
35
|
-
name: `ComplementaryArea/${scope}`
|
|
36
|
-
}, props));
|
|
35
|
+
});
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
function ComplementaryAreaFill(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} = _ref2;
|
|
38
|
+
function ComplementaryAreaFill({
|
|
39
|
+
scope,
|
|
40
|
+
children,
|
|
41
|
+
className
|
|
42
|
+
}) {
|
|
45
43
|
return createElement(Fill, {
|
|
46
44
|
name: `ComplementaryArea/${scope}`
|
|
47
45
|
}, createElement("div", {
|
|
@@ -85,25 +83,24 @@ function useAdjustComplementaryListener(scope, identifier, activeArea, isActive,
|
|
|
85
83
|
}, [isActive, isSmall, scope, identifier, activeArea]);
|
|
86
84
|
}
|
|
87
85
|
|
|
88
|
-
function ComplementaryArea(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
} = _ref3;
|
|
86
|
+
function ComplementaryArea({
|
|
87
|
+
children,
|
|
88
|
+
className,
|
|
89
|
+
closeLabel = __('Close plugin'),
|
|
90
|
+
identifier,
|
|
91
|
+
header,
|
|
92
|
+
headerClassName,
|
|
93
|
+
icon,
|
|
94
|
+
isPinnable = true,
|
|
95
|
+
panelClassName,
|
|
96
|
+
scope,
|
|
97
|
+
name,
|
|
98
|
+
smallScreenTitle,
|
|
99
|
+
title,
|
|
100
|
+
toggleShortcut,
|
|
101
|
+
isActiveByDefault,
|
|
102
|
+
showIconLabels = false
|
|
103
|
+
}) {
|
|
107
104
|
const {
|
|
108
105
|
isLoading,
|
|
109
106
|
isActive,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area/index.js"],"names":["classnames","Button","Panel","Slot","Fill","useDispatch","useSelect","__","check","starEmpty","starFilled","useEffect","useRef","store","viewportStore","ComplementaryAreaHeader","ComplementaryAreaMoreMenuItem","ComplementaryAreaToggle","withComplementaryAreaContext","PinnedItems","interfaceStore","ComplementaryAreaSlot","scope","props","ComplementaryAreaFill","children","className","useAdjustComplementaryListener","identifier","activeArea","isActive","isSmall","previousIsSmall","shouldOpenWhenNotSmall","enableComplementaryArea","disableComplementaryArea","current","ComplementaryArea","closeLabel","header","headerClassName","icon","isPinnable","panelClassName","name","smallScreenTitle","title","toggleShortcut","isActiveByDefault","showIconLabels","isLoading","isPinned","isLarge","select","getActiveComplementaryArea","isComplementaryAreaLoading","isItemPinned","_activeArea","isViewportMatch","pinItem","unpinItem","undefined","label","shortcut","ComplementaryAreaWrapped"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,KAAjB,EAAwBC,IAAxB,EAA8BC,IAA9B,QAA0C,uBAA1C;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,EAAgBC,SAAhB,EAA2BC,UAA3B,QAA6C,kBAA7C;AACA,SAASC,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,qBAAvC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,6BAAP,MAA0C,sCAA1C;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,4BAAP,MAAyC,+BAAzC;AACA,OAAOC,WAAP,MAAwB,i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A,OAAO,EAAG,MACT,CAAE4C,QAAQ,GAAGS,SAAH,GAAeD,OAAzB,EACCrC,KADD,EAECM,UAFD,CAXF;AAgBC,IAAA,SAAS,EAAGuB,QAhBb;AAiBC,qBAAgBA;AAjBjB,IAHF,CAbF,CAPD,EA8CC,cAAC,KAAD;AAAO,IAAA,SAAS,EAAGR;AAAnB,KAAsClB,QAAtC,CA9CD,CA9BF,CADD;AAkFA;;AAED,MAAMuC,wBAAwB,GAC7B9C,4BAA4B,CAAEmB,iBAAF,CAD7B;AAGA2B,wBAAwB,CAAC7D,IAAzB,GAAgCkB,qBAAhC;AAEA,eAAe2C,wBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Panel, Slot, Fill } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { check, starEmpty, starFilled } from '@wordpress/icons';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as viewportStore } from '@wordpress/viewport';\n\n/**\n * Internal dependencies\n */\nimport ComplementaryAreaHeader from '../complementary-area-header';\nimport ComplementaryAreaMoreMenuItem from '../complementary-area-more-menu-item';\nimport ComplementaryAreaToggle from '../complementary-area-toggle';\nimport withComplementaryAreaContext from '../complementary-area-context';\nimport PinnedItems from '../pinned-items';\nimport { store as interfaceStore } from '../../store';\n\nfunction ComplementaryAreaSlot( { scope, ...props } ) {\n\treturn <Slot name={ `ComplementaryArea/${ scope }` } { ...props } />;\n}\n\nfunction ComplementaryAreaFill( { scope, children, className } ) {\n\treturn (\n\t\t<Fill name={ `ComplementaryArea/${ scope }` }>\n\t\t\t<div className={ className }>{ children }</div>\n\t\t</Fill>\n\t);\n}\n\nfunction useAdjustComplementaryListener(\n\tscope,\n\tidentifier,\n\tactiveArea,\n\tisActive,\n\tisSmall\n) {\n\tconst previousIsSmall = useRef( false );\n\tconst shouldOpenWhenNotSmall = useRef( false );\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\tuseEffect( () => {\n\t\t// If the complementary area is active and the editor is switching from\n\t\t// a big to a small window size.\n\t\tif ( isActive && isSmall && ! previousIsSmall.current ) {\n\t\t\tdisableComplementaryArea( scope );\n\t\t\t// Flag the complementary area to be reopened when the window size\n\t\t\t// goes from small to big.\n\t\t\tshouldOpenWhenNotSmall.current = true;\n\t\t} else if (\n\t\t\t// If there is a flag indicating the complementary area should be\n\t\t\t// enabled when we go from small to big window size and we are going\n\t\t\t// from a small to big window size.\n\t\t\tshouldOpenWhenNotSmall.current &&\n\t\t\t! isSmall &&\n\t\t\tpreviousIsSmall.current\n\t\t) {\n\t\t\t// Remove the flag indicating the complementary area should be\n\t\t\t// enabled.\n\t\t\tshouldOpenWhenNotSmall.current = false;\n\t\t\tenableComplementaryArea( scope, identifier );\n\t\t} else if (\n\t\t\t// If the flag is indicating the current complementary should be\n\t\t\t// reopened but another complementary area becomes active, remove\n\t\t\t// the flag.\n\t\t\tshouldOpenWhenNotSmall.current &&\n\t\t\tactiveArea &&\n\t\t\tactiveArea !== identifier\n\t\t) {\n\t\t\tshouldOpenWhenNotSmall.current = false;\n\t\t}\n\t\tif ( isSmall !== previousIsSmall.current ) {\n\t\t\tpreviousIsSmall.current = isSmall;\n\t\t}\n\t}, [ isActive, isSmall, scope, identifier, activeArea ] );\n}\n\nfunction ComplementaryArea( {\n\tchildren,\n\tclassName,\n\tcloseLabel = __( 'Close plugin' ),\n\tidentifier,\n\theader,\n\theaderClassName,\n\ticon,\n\tisPinnable = true,\n\tpanelClassName,\n\tscope,\n\tname,\n\tsmallScreenTitle,\n\ttitle,\n\ttoggleShortcut,\n\tisActiveByDefault,\n\tshowIconLabels = false,\n} ) {\n\tconst { isLoading, isActive, isPinned, activeArea, isSmall, isLarge } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetActiveComplementaryArea,\n\t\t\t\t\tisComplementaryAreaLoading,\n\t\t\t\t\tisItemPinned,\n\t\t\t\t} = select( interfaceStore );\n\n\t\t\t\tconst _activeArea = getActiveComplementaryArea( scope );\n\n\t\t\t\treturn {\n\t\t\t\t\tisLoading: isComplementaryAreaLoading( scope ),\n\t\t\t\t\tisActive: _activeArea === identifier,\n\t\t\t\t\tisPinned: isItemPinned( scope, identifier ),\n\t\t\t\t\tactiveArea: _activeArea,\n\t\t\t\t\tisSmall:\n\t\t\t\t\t\tselect( viewportStore ).isViewportMatch( '< medium' ),\n\t\t\t\t\tisLarge: select( viewportStore ).isViewportMatch( 'large' ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ identifier, scope ]\n\t\t);\n\tuseAdjustComplementaryListener(\n\t\tscope,\n\t\tidentifier,\n\t\tactiveArea,\n\t\tisActive,\n\t\tisSmall\n\t);\n\tconst {\n\t\tenableComplementaryArea,\n\t\tdisableComplementaryArea,\n\t\tpinItem,\n\t\tunpinItem,\n\t} = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\t// Set initial visibility: For large screens, enable if it's active by\n\t\t// default. For small screens, always initially disable.\n\t\tif ( isActiveByDefault && activeArea === undefined && ! isSmall ) {\n\t\t\tenableComplementaryArea( scope, identifier );\n\t\t} else if ( activeArea === undefined && isSmall ) {\n\t\t\tdisableComplementaryArea( scope, identifier );\n\t\t}\n\t}, [ activeArea, isActiveByDefault, scope, identifier, isSmall ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ isPinnable && (\n\t\t\t\t<PinnedItems scope={ scope }>\n\t\t\t\t\t{ isPinned && (\n\t\t\t\t\t\t<ComplementaryAreaToggle\n\t\t\t\t\t\t\tscope={ scope }\n\t\t\t\t\t\t\tidentifier={ identifier }\n\t\t\t\t\t\t\tisPressed={\n\t\t\t\t\t\t\t\tisActive && ( ! showIconLabels || isLarge )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taria-expanded={ isActive }\n\t\t\t\t\t\t\taria-disabled={ isLoading }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\ticon={ showIconLabels ? check : icon }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PinnedItems>\n\t\t\t) }\n\t\t\t{ name && isPinnable && (\n\t\t\t\t<ComplementaryAreaMoreMenuItem\n\t\t\t\t\ttarget={ name }\n\t\t\t\t\tscope={ scope }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t>\n\t\t\t\t\t{ title }\n\t\t\t\t</ComplementaryAreaMoreMenuItem>\n\t\t\t) }\n\t\t\t{ isActive && (\n\t\t\t\t<ComplementaryAreaFill\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'interface-complementary-area',\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tscope={ scope }\n\t\t\t\t>\n\t\t\t\t\t<ComplementaryAreaHeader\n\t\t\t\t\t\tclassName={ headerClassName }\n\t\t\t\t\t\tcloseLabel={ closeLabel }\n\t\t\t\t\t\tonClose={ () => disableComplementaryArea( scope ) }\n\t\t\t\t\t\tsmallScreenTitle={ smallScreenTitle }\n\t\t\t\t\t\ttoggleButtonProps={ {\n\t\t\t\t\t\t\tlabel: closeLabel,\n\t\t\t\t\t\t\tshortcut: toggleShortcut,\n\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\tidentifier,\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\t\t<>\n\t\t\t\t\t\t\t\t<strong>{ title }</strong>\n\t\t\t\t\t\t\t\t{ isPinnable && (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tclassName=\"interface-complementary-area__pin-unpin-item\"\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisPinned ? starFilled : starEmpty\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\tisPinned\n\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Unpin from toolbar' )\n\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Pin to toolbar' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\t( isPinned ? unpinItem : pinItem )(\n\t\t\t\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\t\t\t\tidentifier\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisPressed={ isPinned }\n\t\t\t\t\t\t\t\t\t\taria-expanded={ isPinned }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ComplementaryAreaHeader>\n\t\t\t\t\t<Panel className={ panelClassName }>{ children }</Panel>\n\t\t\t\t</ComplementaryAreaFill>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nconst ComplementaryAreaWrapped =\n\twithComplementaryAreaContext( ComplementaryArea );\n\nComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;\n\nexport default ComplementaryAreaWrapped;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area/index.js"],"names":["classnames","Button","Panel","Slot","Fill","useDispatch","useSelect","__","check","starEmpty","starFilled","useEffect","useRef","store","viewportStore","ComplementaryAreaHeader","ComplementaryAreaMoreMenuItem","ComplementaryAreaToggle","withComplementaryAreaContext","PinnedItems","interfaceStore","ComplementaryAreaSlot","scope","props","ComplementaryAreaFill","children","className","useAdjustComplementaryListener","identifier","activeArea","isActive","isSmall","previousIsSmall","shouldOpenWhenNotSmall","enableComplementaryArea","disableComplementaryArea","current","ComplementaryArea","closeLabel","header","headerClassName","icon","isPinnable","panelClassName","name","smallScreenTitle","title","toggleShortcut","isActiveByDefault","showIconLabels","isLoading","isPinned","isLarge","select","getActiveComplementaryArea","isComplementaryAreaLoading","isItemPinned","_activeArea","isViewportMatch","pinItem","unpinItem","undefined","label","shortcut","ComplementaryAreaWrapped"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,KAAjB,EAAwBC,IAAxB,EAA8BC,IAA9B,QAA0C,uBAA1C;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,EAAgBC,SAAhB,EAA2BC,UAA3B,QAA6C,kBAA7C;AACA,SAASC,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,qBAAvC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,6BAAP,MAA0C,sCAA1C;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,4BAAP,MAAyC,+BAAzC;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,SAASN,KAAK,IAAIO,cAAlB,QAAwC,aAAxC;;AAEA,SAASC,qBAAT,CAAgC;AAAEC,EAAAA,KAAF;AAAS,KAAGC;AAAZ,CAAhC,EAAsD;AACrD,SAAO,cAAC,IAAD;AAAM,IAAA,IAAI,EAAI,qBAAqBD,KAAO,EAA1C;AAAA,OAAmDC;AAAnD,IAAP;AACA;;AAED,SAASC,qBAAT,CAAgC;AAAEF,EAAAA,KAAF;AAASG,EAAAA,QAAT;AAAmBC,EAAAA;AAAnB,CAAhC,EAAiE;AAChE,SACC,cAAC,IAAD;AAAM,IAAA,IAAI,EAAI,qBAAqBJ,KAAO;AAA1C,KACC;AAAK,IAAA,SAAS,EAAGI;AAAjB,KAA+BD,QAA/B,CAD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,KAKGK,KALH,CArBF,EA6BGhB,QAAQ,IACT,cAAC,qBAAD;AACC,IAAA,SAAS,EAAG9B,UAAU,CACrB,8BADqB,EAErB0B,SAFqB,CADvB;AAKC,IAAA,KAAK,EAAGJ;AALT,KAOC,cAAC,uBAAD;AACC,IAAA,SAAS,EAAGkB,eADb;AAEC,IAAA,UAAU,EAAGF,UAFd;AAGC,IAAA,OAAO,EAAG,MAAMH,wBAAwB,CAAEb,KAAF,CAHzC;AAIC,IAAA,gBAAgB,EAAGuB,gBAJpB;AAKC,IAAA,iBAAiB,EAAG;AACnBiB,MAAAA,KAAK,EAAExB,UADY;AAEnByB,MAAAA,QAAQ,EAAEhB,cAFS;AAGnBzB,MAAAA,KAHmB;AAInBM,MAAAA;AAJmB;AALrB,KAYGW,MAAM,IACP,8BACC,8BAAUO,KAAV,CADD,EAEGJ,UAAU,IACX,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,8CADX;AAEC,IAAA,IAAI,EACHS,QAAQ,GAAGzC,UAAH,GAAgBD,SAH1B;AAKC,IAAA,KAAK,EACJ0C,QAAQ,GACL5C,EAAE,CAAE,oBAAF,CADG,GAELA,EAAE,CAAE,gBAAF,CARP;AAUC,IAAA,OAAO,EAAG,MACT,CAAE4C,QAAQ,GAAGS,SAAH,GAAeD,OAAzB,EACCrC,KADD,EAECM,UAFD,CAXF;AAgBC,IAAA,SAAS,EAAGuB,QAhBb;AAiBC,qBAAgBA;AAjBjB,IAHF,CAbF,CAPD,EA8CC,cAAC,KAAD;AAAO,IAAA,SAAS,EAAGR;AAAnB,KAAsClB,QAAtC,CA9CD,CA9BF,CADD;AAkFA;;AAED,MAAMuC,wBAAwB,GAC7B9C,4BAA4B,CAAEmB,iBAAF,CAD7B;AAGA2B,wBAAwB,CAAC7D,IAAzB,GAAgCkB,qBAAhC;AAEA,eAAe2C,wBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Panel, Slot, Fill } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { check, starEmpty, starFilled } from '@wordpress/icons';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as viewportStore } from '@wordpress/viewport';\n\n/**\n * Internal dependencies\n */\nimport ComplementaryAreaHeader from '../complementary-area-header';\nimport ComplementaryAreaMoreMenuItem from '../complementary-area-more-menu-item';\nimport ComplementaryAreaToggle from '../complementary-area-toggle';\nimport withComplementaryAreaContext from '../complementary-area-context';\nimport PinnedItems from '../pinned-items';\nimport { store as interfaceStore } from '../../store';\n\nfunction ComplementaryAreaSlot( { scope, ...props } ) {\n\treturn <Slot name={ `ComplementaryArea/${ scope }` } { ...props } />;\n}\n\nfunction ComplementaryAreaFill( { scope, children, className } ) {\n\treturn (\n\t\t<Fill name={ `ComplementaryArea/${ scope }` }>\n\t\t\t<div className={ className }>{ children }</div>\n\t\t</Fill>\n\t);\n}\n\nfunction useAdjustComplementaryListener(\n\tscope,\n\tidentifier,\n\tactiveArea,\n\tisActive,\n\tisSmall\n) {\n\tconst previousIsSmall = useRef( false );\n\tconst shouldOpenWhenNotSmall = useRef( false );\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\tuseEffect( () => {\n\t\t// If the complementary area is active and the editor is switching from\n\t\t// a big to a small window size.\n\t\tif ( isActive && isSmall && ! previousIsSmall.current ) {\n\t\t\tdisableComplementaryArea( scope );\n\t\t\t// Flag the complementary area to be reopened when the window size\n\t\t\t// goes from small to big.\n\t\t\tshouldOpenWhenNotSmall.current = true;\n\t\t} else if (\n\t\t\t// If there is a flag indicating the complementary area should be\n\t\t\t// enabled when we go from small to big window size and we are going\n\t\t\t// from a small to big window size.\n\t\t\tshouldOpenWhenNotSmall.current &&\n\t\t\t! isSmall &&\n\t\t\tpreviousIsSmall.current\n\t\t) {\n\t\t\t// Remove the flag indicating the complementary area should be\n\t\t\t// enabled.\n\t\t\tshouldOpenWhenNotSmall.current = false;\n\t\t\tenableComplementaryArea( scope, identifier );\n\t\t} else if (\n\t\t\t// If the flag is indicating the current complementary should be\n\t\t\t// reopened but another complementary area becomes active, remove\n\t\t\t// the flag.\n\t\t\tshouldOpenWhenNotSmall.current &&\n\t\t\tactiveArea &&\n\t\t\tactiveArea !== identifier\n\t\t) {\n\t\t\tshouldOpenWhenNotSmall.current = false;\n\t\t}\n\t\tif ( isSmall !== previousIsSmall.current ) {\n\t\t\tpreviousIsSmall.current = isSmall;\n\t\t}\n\t}, [ isActive, isSmall, scope, identifier, activeArea ] );\n}\n\nfunction ComplementaryArea( {\n\tchildren,\n\tclassName,\n\tcloseLabel = __( 'Close plugin' ),\n\tidentifier,\n\theader,\n\theaderClassName,\n\ticon,\n\tisPinnable = true,\n\tpanelClassName,\n\tscope,\n\tname,\n\tsmallScreenTitle,\n\ttitle,\n\ttoggleShortcut,\n\tisActiveByDefault,\n\tshowIconLabels = false,\n} ) {\n\tconst { isLoading, isActive, isPinned, activeArea, isSmall, isLarge } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetActiveComplementaryArea,\n\t\t\t\t\tisComplementaryAreaLoading,\n\t\t\t\t\tisItemPinned,\n\t\t\t\t} = select( interfaceStore );\n\n\t\t\t\tconst _activeArea = getActiveComplementaryArea( scope );\n\n\t\t\t\treturn {\n\t\t\t\t\tisLoading: isComplementaryAreaLoading( scope ),\n\t\t\t\t\tisActive: _activeArea === identifier,\n\t\t\t\t\tisPinned: isItemPinned( scope, identifier ),\n\t\t\t\t\tactiveArea: _activeArea,\n\t\t\t\t\tisSmall:\n\t\t\t\t\t\tselect( viewportStore ).isViewportMatch( '< medium' ),\n\t\t\t\t\tisLarge: select( viewportStore ).isViewportMatch( 'large' ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ identifier, scope ]\n\t\t);\n\tuseAdjustComplementaryListener(\n\t\tscope,\n\t\tidentifier,\n\t\tactiveArea,\n\t\tisActive,\n\t\tisSmall\n\t);\n\tconst {\n\t\tenableComplementaryArea,\n\t\tdisableComplementaryArea,\n\t\tpinItem,\n\t\tunpinItem,\n\t} = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\t// Set initial visibility: For large screens, enable if it's active by\n\t\t// default. For small screens, always initially disable.\n\t\tif ( isActiveByDefault && activeArea === undefined && ! isSmall ) {\n\t\t\tenableComplementaryArea( scope, identifier );\n\t\t} else if ( activeArea === undefined && isSmall ) {\n\t\t\tdisableComplementaryArea( scope, identifier );\n\t\t}\n\t}, [ activeArea, isActiveByDefault, scope, identifier, isSmall ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ isPinnable && (\n\t\t\t\t<PinnedItems scope={ scope }>\n\t\t\t\t\t{ isPinned && (\n\t\t\t\t\t\t<ComplementaryAreaToggle\n\t\t\t\t\t\t\tscope={ scope }\n\t\t\t\t\t\t\tidentifier={ identifier }\n\t\t\t\t\t\t\tisPressed={\n\t\t\t\t\t\t\t\tisActive && ( ! showIconLabels || isLarge )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taria-expanded={ isActive }\n\t\t\t\t\t\t\taria-disabled={ isLoading }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\ticon={ showIconLabels ? check : icon }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PinnedItems>\n\t\t\t) }\n\t\t\t{ name && isPinnable && (\n\t\t\t\t<ComplementaryAreaMoreMenuItem\n\t\t\t\t\ttarget={ name }\n\t\t\t\t\tscope={ scope }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t>\n\t\t\t\t\t{ title }\n\t\t\t\t</ComplementaryAreaMoreMenuItem>\n\t\t\t) }\n\t\t\t{ isActive && (\n\t\t\t\t<ComplementaryAreaFill\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'interface-complementary-area',\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tscope={ scope }\n\t\t\t\t>\n\t\t\t\t\t<ComplementaryAreaHeader\n\t\t\t\t\t\tclassName={ headerClassName }\n\t\t\t\t\t\tcloseLabel={ closeLabel }\n\t\t\t\t\t\tonClose={ () => disableComplementaryArea( scope ) }\n\t\t\t\t\t\tsmallScreenTitle={ smallScreenTitle }\n\t\t\t\t\t\ttoggleButtonProps={ {\n\t\t\t\t\t\t\tlabel: closeLabel,\n\t\t\t\t\t\t\tshortcut: toggleShortcut,\n\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\tidentifier,\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\t\t<>\n\t\t\t\t\t\t\t\t<strong>{ title }</strong>\n\t\t\t\t\t\t\t\t{ isPinnable && (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tclassName=\"interface-complementary-area__pin-unpin-item\"\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisPinned ? starFilled : starEmpty\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\tisPinned\n\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Unpin from toolbar' )\n\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Pin to toolbar' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\t( isPinned ? unpinItem : pinItem )(\n\t\t\t\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\t\t\t\tidentifier\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisPressed={ isPinned }\n\t\t\t\t\t\t\t\t\t\taria-expanded={ isPinned }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ComplementaryAreaHeader>\n\t\t\t\t\t<Panel className={ panelClassName }>{ children }</Panel>\n\t\t\t\t</ComplementaryAreaFill>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nconst ComplementaryAreaWrapped =\n\twithComplementaryAreaContext( ComplementaryArea );\n\nComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;\n\nexport default ComplementaryAreaWrapped;\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -16,16 +15,16 @@ import { closeSmall } from '@wordpress/icons';
|
|
|
16
15
|
|
|
17
16
|
import ComplementaryAreaToggle from '../complementary-area-toggle';
|
|
18
17
|
|
|
19
|
-
const ComplementaryAreaHeader =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
18
|
+
const ComplementaryAreaHeader = ({
|
|
19
|
+
smallScreenTitle,
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
toggleButtonProps
|
|
23
|
+
}) => {
|
|
24
|
+
const toggleButton = createElement(ComplementaryAreaToggle, {
|
|
25
|
+
icon: closeSmall,
|
|
26
|
+
...toggleButtonProps
|
|
27
|
+
});
|
|
29
28
|
return createElement(Fragment, null, createElement("div", {
|
|
30
29
|
className: "components-panel__header interface-complementary-area-header__small"
|
|
31
30
|
}, smallScreenTitle && createElement("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area-header/index.js"],"names":["classnames","closeSmall","ComplementaryAreaToggle","ComplementaryAreaHeader","smallScreenTitle","children","className","toggleButtonProps","toggleButton"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area-header/index.js"],"names":["classnames","closeSmall","ComplementaryAreaToggle","ComplementaryAreaHeader","smallScreenTitle","children","className","toggleButtonProps","toggleButton"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;;AAEA,MAAMC,uBAAuB,GAAG,CAAE;AACjCC,EAAAA,gBADiC;AAEjCC,EAAAA,QAFiC;AAGjCC,EAAAA,SAHiC;AAIjCC,EAAAA;AAJiC,CAAF,KAKzB;AACN,QAAMC,YAAY,GACjB,cAAC,uBAAD;AAAyB,IAAA,IAAI,EAAGP,UAAhC;AAAA,OAAkDM;AAAlD,IADD;AAGA,SACC,8BACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGH,gBAAgB,IACjB;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGA,gBADH,CAFF,EAMGI,YANH,CADD,EASC;AACC,IAAA,SAAS,EAAGR,UAAU,CACrB,0BADqB,EAErB,qCAFqB,EAGrBM,SAHqB,CADvB;AAMC,IAAA,QAAQ,EAAG,CAAC;AANb,KAQGD,QARH,EASGG,YATH,CATD,CADD;AAuBA,CAhCD;;AAkCA,eAAeL,uBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ComplementaryAreaToggle from '../complementary-area-toggle';\n\nconst ComplementaryAreaHeader = ( {\n\tsmallScreenTitle,\n\tchildren,\n\tclassName,\n\ttoggleButtonProps,\n} ) => {\n\tconst toggleButton = (\n\t\t<ComplementaryAreaToggle icon={ closeSmall } { ...toggleButtonProps } />\n\t);\n\treturn (\n\t\t<>\n\t\t\t<div className=\"components-panel__header interface-complementary-area-header__small\">\n\t\t\t\t{ smallScreenTitle && (\n\t\t\t\t\t<span className=\"interface-complementary-area-header__small-title\">\n\t\t\t\t\t\t{ smallScreenTitle }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t{ toggleButton }\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'components-panel__header',\n\t\t\t\t\t'interface-complementary-area-header',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t\t{ toggleButton }\n\t\t\t</div>\n\t\t</>\n\t);\n};\n\nexport default ComplementaryAreaHeader;\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -13,38 +12,37 @@ import { MenuItem } from '@wordpress/components';
|
|
|
13
12
|
import ComplementaryAreaToggle from '../complementary-area-toggle';
|
|
14
13
|
import ActionItem from '../action-item';
|
|
15
14
|
|
|
16
|
-
const PluginsMenuItem =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return createElement(MenuItem, restProps);
|
|
26
|
-
};
|
|
15
|
+
const PluginsMenuItem = ({
|
|
16
|
+
// Menu item is marked with unstable prop for backward compatibility.
|
|
17
|
+
// They are removed so they don't leak to DOM elements.
|
|
18
|
+
// @see https://github.com/WordPress/gutenberg/issues/14457
|
|
19
|
+
__unstableExplicitMenuItem,
|
|
20
|
+
__unstableTarget,
|
|
21
|
+
...restProps
|
|
22
|
+
}) => createElement(MenuItem, { ...restProps
|
|
23
|
+
});
|
|
27
24
|
|
|
28
|
-
export default function ComplementaryAreaMoreMenuItem(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return createElement(ComplementaryAreaToggle, _extends({
|
|
25
|
+
export default function ComplementaryAreaMoreMenuItem({
|
|
26
|
+
scope,
|
|
27
|
+
target,
|
|
28
|
+
__unstableExplicitMenuItem,
|
|
29
|
+
...props
|
|
30
|
+
}) {
|
|
31
|
+
return createElement(ComplementaryAreaToggle, {
|
|
36
32
|
as: toggleProps => {
|
|
37
|
-
return createElement(ActionItem,
|
|
33
|
+
return createElement(ActionItem, {
|
|
38
34
|
__unstableExplicitMenuItem: __unstableExplicitMenuItem,
|
|
39
35
|
__unstableTarget: `${scope}/${target}`,
|
|
40
36
|
as: PluginsMenuItem,
|
|
41
|
-
name: `${scope}/plugin-more-menu
|
|
42
|
-
|
|
37
|
+
name: `${scope}/plugin-more-menu`,
|
|
38
|
+
...toggleProps
|
|
39
|
+
});
|
|
43
40
|
},
|
|
44
41
|
role: "menuitemcheckbox",
|
|
45
42
|
selectedIcon: check,
|
|
46
43
|
name: target,
|
|
47
|
-
scope: scope
|
|
48
|
-
|
|
44
|
+
scope: scope,
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
49
47
|
}
|
|
50
48
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area-more-menu-item/index.js"],"names":["check","MenuItem","ComplementaryAreaToggle","ActionItem","PluginsMenuItem","__unstableExplicitMenuItem","__unstableTarget","restProps","ComplementaryAreaMoreMenuItem","scope","target","props","toggleProps"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area-more-menu-item/index.js"],"names":["check","MenuItem","ComplementaryAreaToggle","ActionItem","PluginsMenuItem","__unstableExplicitMenuItem","__unstableTarget","restProps","ComplementaryAreaMoreMenuItem","scope","target","props","toggleProps"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,kBAAtB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,UAAP,MAAuB,gBAAvB;;AAEA,MAAMC,eAAe,GAAG,CAAE;AACzB;AACA;AACA;AACAC,EAAAA,0BAJyB;AAKzBC,EAAAA,gBALyB;AAMzB,KAAGC;AANsB,CAAF,KAOjB,cAAC,QAAD,OAAeA;AAAf,EAPP;;AASA,eAAe,SAASC,6BAAT,CAAwC;AACtDC,EAAAA,KADsD;AAEtDC,EAAAA,MAFsD;AAGtDL,EAAAA,0BAHsD;AAItD,KAAGM;AAJmD,CAAxC,EAKX;AACH,SACC,cAAC,uBAAD;AACC,IAAA,EAAE,EAAKC,WAAF,IAAmB;AACvB,aACC,cAAC,UAAD;AACC,QAAA,0BAA0B,EACzBP,0BAFF;AAIC,QAAA,gBAAgB,EAAI,GAAGI,KAAO,IAAIC,MAAQ,EAJ3C;AAKC,QAAA,EAAE,EAAGN,eALN;AAMC,QAAA,IAAI,EAAI,GAAGK,KAAO,mBANnB;AAAA,WAOMG;AAPN,QADD;AAWA,KAbF;AAcC,IAAA,IAAI,EAAC,kBAdN;AAeC,IAAA,YAAY,EAAGZ,KAfhB;AAgBC,IAAA,IAAI,EAAGU,MAhBR;AAiBC,IAAA,KAAK,EAAGD,KAjBT;AAAA,OAkBME;AAlBN,IADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { check } from '@wordpress/icons';\nimport { MenuItem } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ComplementaryAreaToggle from '../complementary-area-toggle';\nimport ActionItem from '../action-item';\n\nconst PluginsMenuItem = ( {\n\t// Menu item is marked with unstable prop for backward compatibility.\n\t// They are removed so they don't leak to DOM elements.\n\t// @see https://github.com/WordPress/gutenberg/issues/14457\n\t__unstableExplicitMenuItem,\n\t__unstableTarget,\n\t...restProps\n} ) => <MenuItem { ...restProps } />;\n\nexport default function ComplementaryAreaMoreMenuItem( {\n\tscope,\n\ttarget,\n\t__unstableExplicitMenuItem,\n\t...props\n} ) {\n\treturn (\n\t\t<ComplementaryAreaToggle\n\t\t\tas={ ( toggleProps ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<ActionItem\n\t\t\t\t\t\t__unstableExplicitMenuItem={\n\t\t\t\t\t\t\t__unstableExplicitMenuItem\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__unstableTarget={ `${ scope }/${ target }` }\n\t\t\t\t\t\tas={ PluginsMenuItem }\n\t\t\t\t\t\tname={ `${ scope }/plugin-more-menu` }\n\t\t\t\t\t\t{ ...toggleProps }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t\trole=\"menuitemcheckbox\"\n\t\t\tselectedIcon={ check }\n\t\t\tname={ target }\n\t\t\tscope={ scope }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -13,23 +12,22 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
13
12
|
import { store as interfaceStore } from '../../store';
|
|
14
13
|
import complementaryAreaContext from '../complementary-area-context';
|
|
15
14
|
|
|
16
|
-
function ComplementaryAreaToggle(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} = _ref;
|
|
15
|
+
function ComplementaryAreaToggle({
|
|
16
|
+
as = Button,
|
|
17
|
+
scope,
|
|
18
|
+
identifier,
|
|
19
|
+
icon,
|
|
20
|
+
selectedIcon,
|
|
21
|
+
name,
|
|
22
|
+
...props
|
|
23
|
+
}) {
|
|
26
24
|
const ComponentToUse = as;
|
|
27
25
|
const isSelected = useSelect(select => select(interfaceStore).getActiveComplementaryArea(scope) === identifier, [identifier]);
|
|
28
26
|
const {
|
|
29
27
|
enableComplementaryArea,
|
|
30
28
|
disableComplementaryArea
|
|
31
29
|
} = useDispatch(interfaceStore);
|
|
32
|
-
return createElement(ComponentToUse,
|
|
30
|
+
return createElement(ComponentToUse, {
|
|
33
31
|
icon: selectedIcon && isSelected ? selectedIcon : icon,
|
|
34
32
|
onClick: () => {
|
|
35
33
|
if (isSelected) {
|
|
@@ -37,8 +35,9 @@ function ComplementaryAreaToggle(_ref) {
|
|
|
37
35
|
} else {
|
|
38
36
|
enableComplementaryArea(scope, identifier);
|
|
39
37
|
}
|
|
40
|
-
}
|
|
41
|
-
|
|
38
|
+
},
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
export default complementaryAreaContext(ComplementaryAreaToggle);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"names":["Button","useDispatch","useSelect","store","interfaceStore","complementaryAreaContext","ComplementaryAreaToggle","as","scope","identifier","icon","selectedIcon","name","props","ComponentToUse","isSelected","select","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"names":["Button","useDispatch","useSelect","store","interfaceStore","complementaryAreaContext","ComplementaryAreaToggle","as","scope","identifier","icon","selectedIcon","name","props","ComponentToUse","isSelected","select","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,aAAxC;AACA,OAAOC,wBAAP,MAAqC,+BAArC;;AAEA,SAASC,uBAAT,CAAkC;AACjCC,EAAAA,EAAE,GAAGP,MAD4B;AAEjCQ,EAAAA,KAFiC;AAGjCC,EAAAA,UAHiC;AAIjCC,EAAAA,IAJiC;AAKjCC,EAAAA,YALiC;AAMjCC,EAAAA,IANiC;AAOjC,KAAGC;AAP8B,CAAlC,EAQI;AACH,QAAMC,cAAc,GAAGP,EAAvB;AACA,QAAMQ,UAAU,GAAGb,SAAS,CACzBc,MAAF,IACCA,MAAM,CAAEZ,cAAF,CAAN,CAAyBa,0BAAzB,CAAqDT,KAArD,MACAC,UAH0B,EAI3B,CAAEA,UAAF,CAJ2B,CAA5B;AAMA,QAAM;AAAES,IAAAA,uBAAF;AAA2BC,IAAAA;AAA3B,MACLlB,WAAW,CAAEG,cAAF,CADZ;AAEA,SACC,cAAC,cAAD;AACC,IAAA,IAAI,EAAGO,YAAY,IAAII,UAAhB,GAA6BJ,YAA7B,GAA4CD,IADpD;AAEC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKK,UAAL,EAAkB;AACjBI,QAAAA,wBAAwB,CAAEX,KAAF,CAAxB;AACA,OAFD,MAEO;AACNU,QAAAA,uBAAuB,CAAEV,KAAF,EAASC,UAAT,CAAvB;AACA;AACD,KARF;AAAA,OASMI;AATN,IADD;AAaA;;AAED,eAAeR,wBAAwB,CAAEC,uBAAF,CAAvC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as interfaceStore } from '../../store';\nimport complementaryAreaContext from '../complementary-area-context';\n\nfunction ComplementaryAreaToggle( {\n\tas = Button,\n\tscope,\n\tidentifier,\n\ticon,\n\tselectedIcon,\n\tname,\n\t...props\n} ) {\n\tconst ComponentToUse = as;\n\tconst isSelected = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( scope ) ===\n\t\t\tidentifier,\n\t\t[ identifier ]\n\t);\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\treturn (\n\t\t<ComponentToUse\n\t\t\ticon={ selectedIcon && isSelected ? selectedIcon : icon }\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isSelected ) {\n\t\t\t\t\tdisableComplementaryArea( scope );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( scope, identifier );\n\t\t\t\t}\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default complementaryAreaContext( ComplementaryAreaToggle );\n"]}
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useEffect } from '@wordpress/element';
|
|
5
5
|
|
|
6
|
-
const FullscreenMode =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} = _ref;
|
|
6
|
+
const FullscreenMode = ({
|
|
7
|
+
isActive
|
|
8
|
+
}) => {
|
|
10
9
|
useEffect(() => {
|
|
11
10
|
let isSticky = false; // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes
|
|
12
11
|
// `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/fullscreen-mode/index.js"],"names":["useEffect","FullscreenMode","isActive","isSticky","document","body","classList","contains","remove","add"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;;AAEA,MAAMC,cAAc,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/fullscreen-mode/index.js"],"names":["useEffect","FullscreenMode","isActive","isSticky","document","body","classList","contains","remove","add"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;;AAEA,MAAMC,cAAc,GAAG,CAAE;AAAEC,EAAAA;AAAF,CAAF,KAAoB;AAC1CF,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAIG,QAAQ,GAAG,KAAf,CADgB,CAEhB;AACA;AACA;AACA;;AACA,QAAKC,QAAQ,CAACC,IAAT,CAAcC,SAAd,CAAwBC,QAAxB,CAAkC,aAAlC,CAAL,EAAyD;AACxDJ,MAAAA,QAAQ,GAAG,IAAX;AACAC,MAAAA,QAAQ,CAACC,IAAT,CAAcC,SAAd,CAAwBE,MAAxB,CAAgC,aAAhC;AACA;;AAED,WAAO,MAAM;AACZ,UAAKL,QAAL,EAAgB;AACfC,QAAAA,QAAQ,CAACC,IAAT,CAAcC,SAAd,CAAwBG,GAAxB,CAA6B,aAA7B;AACA;AACD,KAJD;AAKA,GAhBQ,EAgBN,EAhBM,CAAT;AAkBAT,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKE,QAAL,EAAgB;AACfE,MAAAA,QAAQ,CAACC,IAAT,CAAcC,SAAd,CAAwBG,GAAxB,CAA6B,oBAA7B;AACA,KAFD,MAEO;AACNL,MAAAA,QAAQ,CAACC,IAAT,CAAcC,SAAd,CAAwBE,MAAxB,CAAgC,oBAAhC;AACA;;AAED,WAAO,MAAM;AACZ,UAAKN,QAAL,EAAgB;AACfE,QAAAA,QAAQ,CAACC,IAAT,CAAcC,SAAd,CAAwBE,MAAxB,CAAgC,oBAAhC;AACA;AACD,KAJD;AAKA,GAZQ,EAYN,CAAEN,QAAF,CAZM,CAAT;AAcA,SAAO,IAAP;AACA,CAlCD;;AAmCA,eAAeD,cAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\n\nconst FullscreenMode = ( { isActive } ) => {\n\tuseEffect( () => {\n\t\tlet isSticky = false;\n\t\t// `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes\n\t\t// `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled\n\t\t// even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as\n\t\t// a consequence of the FullscreenMode setup.\n\t\tif ( document.body.classList.contains( 'sticky-menu' ) ) {\n\t\t\tisSticky = true;\n\t\t\tdocument.body.classList.remove( 'sticky-menu' );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif ( isSticky ) {\n\t\t\t\tdocument.body.classList.add( 'sticky-menu' );\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isActive ) {\n\t\t\tdocument.body.classList.add( 'is-fullscreen-mode' );\n\t\t} else {\n\t\t\tdocument.body.classList.remove( 'is-fullscreen-mode' );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif ( isActive ) {\n\t\t\t\tdocument.body.classList.remove( 'is-fullscreen-mode' );\n\t\t\t}\n\t\t};\n\t}, [ isActive ] );\n\n\treturn null;\n};\nexport default FullscreenMode;\n"]}
|