@wordpress/interface 4.1.0 → 4.1.4

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.
Files changed (63) hide show
  1. package/README.md +18 -10
  2. package/build/components/action-item/index.js +30 -25
  3. package/build/components/action-item/index.js.map +1 -1
  4. package/build/components/complementary-area/index.js +30 -27
  5. package/build/components/complementary-area/index.js.map +1 -1
  6. package/build/components/complementary-area-header/index.js +7 -6
  7. package/build/components/complementary-area-header/index.js.map +1 -1
  8. package/build/components/complementary-area-more-menu-item/index.js +7 -6
  9. package/build/components/complementary-area-more-menu-item/index.js.map +1 -1
  10. package/build/components/complementary-area-toggle/index.js +9 -8
  11. package/build/components/complementary-area-toggle/index.js.map +1 -1
  12. package/build/components/fullscreen-mode/index.js +4 -3
  13. package/build/components/fullscreen-mode/index.js.map +1 -1
  14. package/build/components/index.js +8 -8
  15. package/build/components/interface-skeleton/index.js +14 -13
  16. package/build/components/interface-skeleton/index.js.map +1 -1
  17. package/build/components/more-menu-dropdown/index.js +11 -10
  18. package/build/components/more-menu-dropdown/index.js.map +1 -1
  19. package/build/components/more-menu-feature-toggle/index.js +10 -9
  20. package/build/components/more-menu-feature-toggle/index.js.map +1 -1
  21. package/build/components/pinned-items/index.js +11 -9
  22. package/build/components/pinned-items/index.js.map +1 -1
  23. package/build/store/actions.js +13 -19
  24. package/build/store/actions.js.map +1 -1
  25. package/build/store/index.js +8 -4
  26. package/build/store/index.js.map +1 -1
  27. package/build/store/reducer.js +32 -19
  28. package/build/store/reducer.js.map +1 -1
  29. package/build/store/selectors.js +1 -1
  30. package/build-module/components/action-item/index.js +30 -25
  31. package/build-module/components/action-item/index.js.map +1 -1
  32. package/build-module/components/complementary-area/index.js +30 -27
  33. package/build-module/components/complementary-area/index.js.map +1 -1
  34. package/build-module/components/complementary-area-header/index.js +7 -6
  35. package/build-module/components/complementary-area-header/index.js.map +1 -1
  36. package/build-module/components/complementary-area-more-menu-item/index.js +7 -6
  37. package/build-module/components/complementary-area-more-menu-item/index.js.map +1 -1
  38. package/build-module/components/complementary-area-toggle/index.js +9 -8
  39. package/build-module/components/complementary-area-toggle/index.js.map +1 -1
  40. package/build-module/components/fullscreen-mode/index.js +4 -3
  41. package/build-module/components/fullscreen-mode/index.js.map +1 -1
  42. package/build-module/components/interface-skeleton/index.js +14 -13
  43. package/build-module/components/interface-skeleton/index.js.map +1 -1
  44. package/build-module/components/more-menu-dropdown/index.js +10 -9
  45. package/build-module/components/more-menu-dropdown/index.js.map +1 -1
  46. package/build-module/components/more-menu-feature-toggle/index.js +10 -9
  47. package/build-module/components/more-menu-feature-toggle/index.js.map +1 -1
  48. package/build-module/components/pinned-items/index.js +11 -9
  49. package/build-module/components/pinned-items/index.js.map +1 -1
  50. package/build-module/store/actions.js +9 -13
  51. package/build-module/store/actions.js.map +1 -1
  52. package/build-module/store/index.js +4 -2
  53. package/build-module/store/index.js.map +1 -1
  54. package/build-module/store/reducer.js +30 -18
  55. package/build-module/store/reducer.js.map +1 -1
  56. package/build-style/style-rtl.css +14 -2
  57. package/build-style/style.css +14 -2
  58. package/package.json +13 -13
  59. package/src/components/complementary-area/style.scss +10 -2
  60. package/src/components/complementary-area-header/style.scss +8 -0
  61. package/src/store/actions.js +5 -25
  62. package/src/store/index.js +2 -0
  63. package/src/store/reducer.js +3 -3
@@ -26,15 +26,16 @@ var _store = require("../../store");
26
26
  /**
27
27
  * Internal dependencies
28
28
  */
29
- function MoreMenuFeatureToggle({
30
- scope,
31
- label,
32
- info,
33
- messageActivated,
34
- messageDeactivated,
35
- shortcut,
36
- feature
37
- }) {
29
+ function MoreMenuFeatureToggle(_ref) {
30
+ let {
31
+ scope,
32
+ label,
33
+ info,
34
+ messageActivated,
35
+ messageDeactivated,
36
+ shortcut,
37
+ feature
38
+ } = _ref;
38
39
  const isActive = (0, _data.useSelect)(select => select(_store.store).isFeatureActive(scope, feature), [feature]);
39
40
  const {
40
41
  toggleFeature
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/components/more-menu-feature-toggle/index.js"],"names":["MoreMenuFeatureToggle","scope","label","info","messageActivated","messageDeactivated","shortcut","feature","isActive","select","interfaceStore","isFeatureActive","toggleFeature","speakMessage","check"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,qBAAT,CAAgC;AAC9CC,EAAAA,KAD8C;AAE9CC,EAAAA,KAF8C;AAG9CC,EAAAA,IAH8C;AAI9CC,EAAAA,gBAJ8C;AAK9CC,EAAAA,kBAL8C;AAM9CC,EAAAA,QAN8C;AAO9CC,EAAAA;AAP8C,CAAhC,EAQX;AACH,QAAMC,QAAQ,GAAG,qBACdC,MAAF,IACCA,MAAM,CAAEC,YAAF,CAAN,CAAyBC,eAAzB,CAA0CV,KAA1C,EAAiDM,OAAjD,CAFe,EAGhB,CAAEA,OAAF,CAHgB,CAAjB;AAKA,QAAM;AAAEK,IAAAA;AAAF,MAAoB,uBAAaF,YAAb,CAA1B;;AACA,QAAMG,YAAY,GAAG,MAAM;AAC1B,QAAKL,QAAL,EAAgB;AACf,uBAAOH,kBAAkB,IAAI,cAAI,qBAAJ,CAA7B;AACA,KAFD,MAEO;AACN,uBAAOD,gBAAgB,IAAI,cAAI,mBAAJ,CAA3B;AACA;AACD,GAND;;AAQA,SACC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAGI,QAAQ,IAAIM,YADpB;AAEC,IAAA,UAAU,EAAGN,QAFd;AAGC,IAAA,OAAO,EAAG,MAAM;AACfI,MAAAA,aAAa,CAAEX,KAAF,EAASM,OAAT,CAAb;AACAM,MAAAA,YAAY;AACZ,KANF;AAOC,IAAA,IAAI,EAAC,kBAPN;AAQC,IAAA,IAAI,EAAGV,IARR;AASC,IAAA,QAAQ,EAAGG;AATZ,KAWGJ,KAXH,CADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { store as interfaceStore } from '../../store';\n\nexport default function MoreMenuFeatureToggle( {\n\tscope,\n\tlabel,\n\tinfo,\n\tmessageActivated,\n\tmessageDeactivated,\n\tshortcut,\n\tfeature,\n} ) {\n\tconst isActive = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).isFeatureActive( scope, feature ),\n\t\t[ feature ]\n\t);\n\tconst { toggleFeature } = useDispatch( interfaceStore );\n\tconst speakMessage = () => {\n\t\tif ( isActive ) {\n\t\t\tspeak( messageDeactivated || __( 'Feature deactivated' ) );\n\t\t} else {\n\t\t\tspeak( messageActivated || __( 'Feature activated' ) );\n\t\t}\n\t};\n\n\treturn (\n\t\t<MenuItem\n\t\t\ticon={ isActive && check }\n\t\t\tisSelected={ isActive }\n\t\t\tonClick={ () => {\n\t\t\t\ttoggleFeature( scope, feature );\n\t\t\t\tspeakMessage();\n\t\t\t} }\n\t\t\trole=\"menuitemcheckbox\"\n\t\t\tinfo={ info }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/components/more-menu-feature-toggle/index.js"],"names":["MoreMenuFeatureToggle","scope","label","info","messageActivated","messageDeactivated","shortcut","feature","isActive","select","interfaceStore","isFeatureActive","toggleFeature","speakMessage","check"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,qBAAT,OAQX;AAAA,MAR2C;AAC9CC,IAAAA,KAD8C;AAE9CC,IAAAA,KAF8C;AAG9CC,IAAAA,IAH8C;AAI9CC,IAAAA,gBAJ8C;AAK9CC,IAAAA,kBAL8C;AAM9CC,IAAAA,QAN8C;AAO9CC,IAAAA;AAP8C,GAQ3C;AACH,QAAMC,QAAQ,GAAG,qBACdC,MAAF,IACCA,MAAM,CAAEC,YAAF,CAAN,CAAyBC,eAAzB,CAA0CV,KAA1C,EAAiDM,OAAjD,CAFe,EAGhB,CAAEA,OAAF,CAHgB,CAAjB;AAKA,QAAM;AAAEK,IAAAA;AAAF,MAAoB,uBAAaF,YAAb,CAA1B;;AACA,QAAMG,YAAY,GAAG,MAAM;AAC1B,QAAKL,QAAL,EAAgB;AACf,uBAAOH,kBAAkB,IAAI,cAAI,qBAAJ,CAA7B;AACA,KAFD,MAEO;AACN,uBAAOD,gBAAgB,IAAI,cAAI,mBAAJ,CAA3B;AACA;AACD,GAND;;AAQA,SACC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAGI,QAAQ,IAAIM,YADpB;AAEC,IAAA,UAAU,EAAGN,QAFd;AAGC,IAAA,OAAO,EAAG,MAAM;AACfI,MAAAA,aAAa,CAAEX,KAAF,EAASM,OAAT,CAAb;AACAM,MAAAA,YAAY;AACZ,KANF;AAOC,IAAA,IAAI,EAAC,kBAPN;AAQC,IAAA,IAAI,EAAGV,IARR;AASC,IAAA,QAAQ,EAAGG;AATZ,KAWGJ,KAXH,CADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { store as interfaceStore } from '../../store';\n\nexport default function MoreMenuFeatureToggle( {\n\tscope,\n\tlabel,\n\tinfo,\n\tmessageActivated,\n\tmessageDeactivated,\n\tshortcut,\n\tfeature,\n} ) {\n\tconst isActive = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).isFeatureActive( scope, feature ),\n\t\t[ feature ]\n\t);\n\tconst { toggleFeature } = useDispatch( interfaceStore );\n\tconst speakMessage = () => {\n\t\tif ( isActive ) {\n\t\t\tspeak( messageDeactivated || __( 'Feature deactivated' ) );\n\t\t} else {\n\t\t\tspeak( messageActivated || __( 'Feature activated' ) );\n\t\t}\n\t};\n\n\treturn (\n\t\t<MenuItem\n\t\t\ticon={ isActive && check }\n\t\t\tisSelected={ isActive }\n\t\t\tonClick={ () => {\n\t\t\t\ttoggleFeature( scope, feature );\n\t\t\t\tspeakMessage();\n\t\t\t} }\n\t\t\trole=\"menuitemcheckbox\"\n\t\t\tinfo={ info }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n"]}
@@ -24,20 +24,22 @@ var _components = require("@wordpress/components");
24
24
  /**
25
25
  * WordPress dependencies
26
26
  */
27
- function PinnedItems({
28
- scope,
29
- ...props
30
- }) {
27
+ function PinnedItems(_ref) {
28
+ let {
29
+ scope,
30
+ ...props
31
+ } = _ref;
31
32
  return (0, _element.createElement)(_components.Fill, (0, _extends2.default)({
32
33
  name: `PinnedItems/${scope}`
33
34
  }, props));
34
35
  }
35
36
 
36
- function PinnedItemsSlot({
37
- scope,
38
- className,
39
- ...props
40
- }) {
37
+ function PinnedItemsSlot(_ref2) {
38
+ let {
39
+ scope,
40
+ className,
41
+ ...props
42
+ } = _ref2;
41
43
  return (0, _element.createElement)(_components.Slot, (0, _extends2.default)({
42
44
  name: `PinnedItems/${scope}`
43
45
  }, props), fills => !(0, _lodash.isEmpty)(fills) && (0, _element.createElement)("div", {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/components/pinned-items/index.js"],"names":["PinnedItems","scope","props","PinnedItemsSlot","className","fills","Slot"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,WAAT,CAAsB;AAAEC,EAAAA,KAAF;AAAS,KAAGC;AAAZ,CAAtB,EAA4C;AAC3C,SAAO,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAI,eAAeD,KAAO;AAApC,KAA6CC,KAA7C,EAAP;AACA;;AAED,SAASC,eAAT,CAA0B;AAAEF,EAAAA,KAAF;AAASG,EAAAA,SAAT;AAAoB,KAAGF;AAAvB,CAA1B,EAA2D;AAC1D,SACC,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAI,eAAeD,KAAO;AAApC,KAA6CC,KAA7C,GACKG,KAAF,IACD,CAAE,qBAASA,KAAT,CAAF,IACC;AACC,IAAA,SAAS,EAAG,yBACXD,SADW,EAEX,wBAFW;AADb,KAMGC,KANH,CAHH,CADD;AAgBA;;AAEDL,WAAW,CAACM,IAAZ,GAAmBH,eAAnB;eAEeH,W","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Slot, Fill } from '@wordpress/components';\n\nfunction PinnedItems( { scope, ...props } ) {\n\treturn <Fill name={ `PinnedItems/${ scope }` } { ...props } />;\n}\n\nfunction PinnedItemsSlot( { scope, className, ...props } ) {\n\treturn (\n\t\t<Slot name={ `PinnedItems/${ scope }` } { ...props }>\n\t\t\t{ ( fills ) =>\n\t\t\t\t! isEmpty( fills ) && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t'interface-pinned-items'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t</Slot>\n\t);\n}\n\nPinnedItems.Slot = PinnedItemsSlot;\n\nexport default PinnedItems;\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/components/pinned-items/index.js"],"names":["PinnedItems","scope","props","PinnedItemsSlot","className","fills","Slot"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,WAAT,OAA4C;AAAA,MAAtB;AAAEC,IAAAA,KAAF;AAAS,OAAGC;AAAZ,GAAsB;AAC3C,SAAO,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAI,eAAeD,KAAO;AAApC,KAA6CC,KAA7C,EAAP;AACA;;AAED,SAASC,eAAT,QAA2D;AAAA,MAAjC;AAAEF,IAAAA,KAAF;AAASG,IAAAA,SAAT;AAAoB,OAAGF;AAAvB,GAAiC;AAC1D,SACC,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAI,eAAeD,KAAO;AAApC,KAA6CC,KAA7C,GACKG,KAAF,IACD,CAAE,qBAASA,KAAT,CAAF,IACC;AACC,IAAA,SAAS,EAAG,yBACXD,SADW,EAEX,wBAFW;AADb,KAMGC,KANH,CAHH,CADD;AAgBA;;AAEDL,WAAW,CAACM,IAAZ,GAAmBH,eAAnB;eAEeH,W","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Slot, Fill } from '@wordpress/components';\n\nfunction PinnedItems( { scope, ...props } ) {\n\treturn <Fill name={ `PinnedItems/${ scope }` } { ...props } />;\n}\n\nfunction PinnedItemsSlot( { scope, className, ...props } ) {\n\treturn (\n\t\t<Slot name={ `PinnedItems/${ scope }` } { ...props }>\n\t\t\t{ ( fills ) =>\n\t\t\t\t! isEmpty( fills ) && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t'interface-pinned-items'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t</Slot>\n\t);\n}\n\nPinnedItems.Slot = PinnedItemsSlot;\n\nexport default PinnedItems;\n"]}
@@ -3,25 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.enableComplementaryArea = enableComplementaryArea;
7
6
  exports.disableComplementaryArea = disableComplementaryArea;
7
+ exports.enableComplementaryArea = enableComplementaryArea;
8
8
  exports.pinItem = pinItem;
9
- exports.unpinItem = unpinItem;
10
- exports.toggleFeature = toggleFeature;
11
- exports.setFeatureValue = setFeatureValue;
12
9
  exports.setFeatureDefaults = setFeatureDefaults;
13
-
14
- var _data = require("@wordpress/data");
15
-
16
- var _constants = require("./constants");
17
-
18
- /**
19
- * WordPress dependencies
20
- */
21
-
22
- /**
23
- * Internal dependencies
24
- */
10
+ exports.setFeatureValue = setFeatureValue;
11
+ exports.toggleFeature = toggleFeature;
12
+ exports.unpinItem = unpinItem;
25
13
 
26
14
  /**
27
15
  * Returns an action object used in signalling that an active area should be changed.
@@ -120,9 +108,15 @@ function unpinItem(scope, itemId) {
120
108
  */
121
109
 
122
110
 
123
- function* toggleFeature(scope, featureName) {
124
- const currentValue = yield _data.controls.select(_constants.STORE_NAME, 'isFeatureActive', scope, featureName);
125
- yield _data.controls.dispatch(_constants.STORE_NAME, 'setFeatureValue', scope, featureName, !currentValue);
111
+ function toggleFeature(scope, featureName) {
112
+ return function (_ref) {
113
+ let {
114
+ select,
115
+ dispatch
116
+ } = _ref;
117
+ const currentValue = select.isFeatureActive(scope, featureName);
118
+ dispatch.setFeatureValue(scope, featureName, !currentValue);
119
+ };
126
120
  }
127
121
  /**
128
122
  * Returns an action object used in signalling that a feature should be set to
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/actions.js"],"names":["setSingleEnableItem","itemType","scope","item","type","enableComplementaryArea","area","disableComplementaryArea","undefined","setMultipleEnableItem","isEnable","pinItem","itemId","unpinItem","toggleFeature","featureName","currentValue","controls","select","interfaceStoreName","dispatch","setFeatureValue","value","setFeatureDefaults","defaults"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAT,CAA8BC,QAA9B,EAAwCC,KAAxC,EAA+C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ASC,MAAT,CAC1BC,qBAD0B,EAE1B,iBAF0B,EAG1BjB,KAH0B,EAI1Ba,WAJ0B,CAA3B;AAOA,QAAME,eAASG,QAAT,CACLD,qBADK,EAEL,iBAFK,EAGLjB,KAHK,EAILa,WAJK,EAKL,CAAEC,YALG,CAAN;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,eAAT,CAA0BnB,KAA1B,EAAiCa,WAAjC,EAA8CO,KAA9C,EAAsD;AAC5D,SAAO;AACNlB,IAAAA,IAAI,EAAE,mBADA;AAENF,IAAAA,KAFM;AAGNa,IAAAA,WAHM;AAINO,IAAAA,KAAK,EAAE,CAAC,CAAEA;AAJJ,GAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,kBAAT,CAA6BrB,KAA7B,EAAoCsB,QAApC,EAA+C;AACrD,SAAO;AACNpB,IAAAA,IAAI,EAAE,sBADA;AAENF,IAAAA,KAFM;AAGNsB,IAAAA;AAHM,GAAP;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { controls } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as interfaceStoreName } from './constants';\n\n/**\n * Returns an action object used in signalling that an active area should be changed.\n *\n * @param {string} itemType Type of item.\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n *\n * @return {Object} Action object.\n */\nfunction setSingleEnableItem( itemType, scope, item ) {\n\treturn {\n\t\ttype: 'SET_SINGLE_ENABLE_ITEM',\n\t\titemType,\n\t\tscope,\n\t\titem,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a complementary item should be enabled.\n *\n * @param {string} scope Complementary area scope.\n * @param {string} area Area identifier.\n *\n * @return {Object} Action object.\n */\nexport function enableComplementaryArea( scope, area ) {\n\treturn setSingleEnableItem( 'complementaryArea', scope, area );\n}\n\n/**\n * Returns an action object used in signalling that the complementary area of a given scope should be disabled.\n *\n * @param {string} scope Complementary area scope.\n *\n * @return {Object} Action object.\n */\nexport function disableComplementaryArea( scope ) {\n\treturn setSingleEnableItem( 'complementaryArea', scope, undefined );\n}\n\n/**\n * Returns an action object to make an area enabled/disabled.\n *\n * @param {string} itemType Type of item.\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n * @param {boolean} isEnable Boolean indicating if an area should be pinned or not.\n *\n * @return {Object} Action object.\n */\nfunction setMultipleEnableItem( itemType, scope, item, isEnable ) {\n\treturn {\n\t\ttype: 'SET_MULTIPLE_ENABLE_ITEM',\n\t\titemType,\n\t\tscope,\n\t\titem,\n\t\tisEnable,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that an item should be pinned.\n *\n * @param {string} scope Item scope.\n * @param {string} itemId Item identifier.\n *\n * @return {Object} Action object.\n */\nexport function pinItem( scope, itemId ) {\n\treturn setMultipleEnableItem( 'pinnedItems', scope, itemId, true );\n}\n\n/**\n * Returns an action object used in signalling that an item should be unpinned.\n *\n * @param {string} scope Item scope.\n * @param {string} itemId Item identifier.\n *\n * @return {Object} Action object.\n */\nexport function unpinItem( scope, itemId ) {\n\treturn setMultipleEnableItem( 'pinnedItems', scope, itemId, false );\n}\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\tconst currentValue = yield controls.select(\n\t\tinterfaceStoreName,\n\t\t'isFeatureActive',\n\t\tscope,\n\t\tfeatureName\n\t);\n\n\tyield controls.dispatch(\n\t\tinterfaceStoreName,\n\t\t'setFeatureValue',\n\t\tscope,\n\t\tfeatureName,\n\t\t! currentValue\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 {\n\t\ttype: 'SET_FEATURE_VALUE',\n\t\tscope,\n\t\tfeatureName,\n\t\tvalue: !! 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 {\n\t\ttype: 'SET_FEATURE_DEFAULTS',\n\t\tscope,\n\t\tdefaults,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/store/actions.js"],"names":["setSingleEnableItem","itemType","scope","item","type","enableComplementaryArea","area","disableComplementaryArea","undefined","setMultipleEnableItem","isEnable","pinItem","itemId","unpinItem","toggleFeature","featureName","select","dispatch","currentValue","isFeatureActive","setFeatureValue","value","setFeatureDefaults","defaults"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAT,CAA8BC,QAA9B,EAAwCC,KAAxC,EAA+CC,IAA/C,EAAsD;AACrD,SAAO;AACNC,IAAAA,IAAI,EAAE,wBADA;AAENH,IAAAA,QAFM;AAGNC,IAAAA,KAHM;AAINC,IAAAA;AAJM,GAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,uBAAT,CAAkCH,KAAlC,EAAyCI,IAAzC,EAAgD;AACtD,SAAON,mBAAmB,CAAE,mBAAF,EAAuBE,KAAvB,EAA8BI,IAA9B,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,wBAAT,CAAmCL,KAAnC,EAA2C;AACjD,SAAOF,mBAAmB,CAAE,mBAAF,EAAuBE,KAAvB,EAA8BM,SAA9B,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,qBAAT,CAAgCR,QAAhC,EAA0CC,KAA1C,EAAiDC,IAAjD,EAAuDO,QAAvD,E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AA+C;AACrD,SAAO;AACNnB,IAAAA,IAAI,EAAE,sBADA;AAENF,IAAAA,KAFM;AAGNqB,IAAAA;AAHM,GAAP;AAKA","sourcesContent":["/**\n * Returns an action object used in signalling that an active area should be changed.\n *\n * @param {string} itemType Type of item.\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n *\n * @return {Object} Action object.\n */\nfunction setSingleEnableItem( itemType, scope, item ) {\n\treturn {\n\t\ttype: 'SET_SINGLE_ENABLE_ITEM',\n\t\titemType,\n\t\tscope,\n\t\titem,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a complementary item should be enabled.\n *\n * @param {string} scope Complementary area scope.\n * @param {string} area Area identifier.\n *\n * @return {Object} Action object.\n */\nexport function enableComplementaryArea( scope, area ) {\n\treturn setSingleEnableItem( 'complementaryArea', scope, area );\n}\n\n/**\n * Returns an action object used in signalling that the complementary area of a given scope should be disabled.\n *\n * @param {string} scope Complementary area scope.\n *\n * @return {Object} Action object.\n */\nexport function disableComplementaryArea( scope ) {\n\treturn setSingleEnableItem( 'complementaryArea', scope, undefined );\n}\n\n/**\n * Returns an action object to make an area enabled/disabled.\n *\n * @param {string} itemType Type of item.\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n * @param {boolean} isEnable Boolean indicating if an area should be pinned or not.\n *\n * @return {Object} Action object.\n */\nfunction setMultipleEnableItem( itemType, scope, item, isEnable ) {\n\treturn {\n\t\ttype: 'SET_MULTIPLE_ENABLE_ITEM',\n\t\titemType,\n\t\tscope,\n\t\titem,\n\t\tisEnable,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that an item should be pinned.\n *\n * @param {string} scope Item scope.\n * @param {string} itemId Item identifier.\n *\n * @return {Object} Action object.\n */\nexport function pinItem( scope, itemId ) {\n\treturn setMultipleEnableItem( 'pinnedItems', scope, itemId, true );\n}\n\n/**\n * Returns an action object used in signalling that an item should be unpinned.\n *\n * @param {string} scope Item scope.\n * @param {string} itemId Item identifier.\n *\n * @return {Object} Action object.\n */\nexport function unpinItem( scope, itemId ) {\n\treturn setMultipleEnableItem( 'pinnedItems', scope, itemId, false );\n}\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 ( { select, dispatch } ) {\n\t\tconst currentValue = select.isFeatureActive( scope, featureName );\n\t\tdispatch.setFeatureValue( scope, featureName, ! currentValue );\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 {\n\t\ttype: 'SET_FEATURE_VALUE',\n\t\tscope,\n\t\tfeatureName,\n\t\tvalue: !! 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 {\n\t\ttype: 'SET_FEATURE_DEFAULTS',\n\t\tscope,\n\t\tdefaults,\n\t};\n}\n"]}
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
4
 
7
5
  Object.defineProperty(exports, "__esModule", {
@@ -19,6 +17,10 @@ var selectors = _interopRequireWildcard(require("./selectors"));
19
17
 
20
18
  var _constants = require("./constants");
21
19
 
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
22
24
  /**
23
25
  * WordPress dependencies
24
26
  */
@@ -38,7 +40,8 @@ const store = (0, _data.createReduxStore)(_constants.STORE_NAME, {
38
40
  reducer: _reducer.default,
39
41
  actions,
40
42
  selectors,
41
- persist: ['enableItems', 'preferences']
43
+ persist: ['enableItems', 'preferences'],
44
+ __experimentalUseThunks: true
42
45
  }); // Once we build a more generic persistence plugin that works across types of stores
43
46
  // we'd be able to replace this with a register call.
44
47
 
@@ -47,6 +50,7 @@ exports.store = store;
47
50
  reducer: _reducer.default,
48
51
  actions,
49
52
  selectors,
50
- persist: ['enableItems', 'preferences']
53
+ persist: ['enableItems', 'preferences'],
54
+ __experimentalUseThunks: true
51
55
  });
52
56
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/index.js"],"names":["store","STORE_NAME","reducer","actions","selectors","persist"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8B;AAClDC,EAAAA,OAAO,EAAPA,gBADkD;AAElDC,EAAAA,OAFkD;AAGlDC,EAAAA,SAHkD;AAIlDC,EAAAA,OAAO,EAAE,CAAE,aAAF,EAAiB,aAAjB;AAJyC,CAA9B,CAAd,C,CAOP;AACA;;;AACA,yBAAeJ,qBAAf,EAA2B;AAC1BC,EAAAA,OAAO,EAAPA,gBAD0B;AAE1BC,EAAAA,OAF0B;AAG1BC,EAAAA,SAH0B;AAI1BC,EAAAA,OAAO,EAAE,CAAE,aAAF,EAAiB,aAAjB;AAJiB,CAA3B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, registerStore } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the interface namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n\tpersist: [ 'enableItems', 'preferences' ],\n} );\n\n// Once we build a more generic persistence plugin that works across types of stores\n// we'd be able to replace this with a register call.\nregisterStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n\tpersist: [ 'enableItems', 'preferences' ],\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/store/index.js"],"names":["store","STORE_NAME","reducer","actions","selectors","persist","__experimentalUseThunks"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8B;AAClDC,EAAAA,OAAO,EAAPA,gBADkD;AAElDC,EAAAA,OAFkD;AAGlDC,EAAAA,SAHkD;AAIlDC,EAAAA,OAAO,EAAE,CAAE,aAAF,EAAiB,aAAjB,CAJyC;AAKlDC,EAAAA,uBAAuB,EAAE;AALyB,CAA9B,CAAd,C,CAQP;AACA;;;AACA,yBAAeL,qBAAf,EAA2B;AAC1BC,EAAAA,OAAO,EAAPA,gBAD0B;AAE1BC,EAAAA,OAF0B;AAG1BC,EAAAA,SAH0B;AAI1BC,EAAAA,OAAO,EAAE,CAAE,aAAF,EAAiB,aAAjB,CAJiB;AAK1BC,EAAAA,uBAAuB,EAAE;AALC,CAA3B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, registerStore } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the interface namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n\tpersist: [ 'enableItems', 'preferences' ],\n\t__experimentalUseThunks: true,\n} );\n\n// Once we build a more generic persistence plugin that works across types of stores\n// we'd be able to replace this with a register call.\nregisterStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n\tpersist: [ 'enableItems', 'preferences' ],\n\t__experimentalUseThunks: true,\n} );\n"]}
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.singleEnableItems = singleEnableItems;
6
+ exports.default = void 0;
7
7
  exports.multipleEnableItems = multipleEnableItems;
8
- exports.default = exports.preferences = exports.preferenceDefaults = void 0;
8
+ exports.preferences = exports.preferenceDefaults = void 0;
9
+ exports.singleEnableItems = singleEnableItems;
9
10
 
10
11
  var _lodash = require("lodash");
11
12
 
@@ -31,12 +32,15 @@ var _data = require("@wordpress/data");
31
32
  *
32
33
  * @return {Object} Updated state.
33
34
  */
34
- function singleEnableItems(state = {}, {
35
- type,
36
- itemType,
37
- scope,
38
- item
39
- }) {
35
+ function singleEnableItems() {
36
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
37
+ let {
38
+ type,
39
+ itemType,
40
+ scope,
41
+ item
42
+ } = arguments.length > 1 ? arguments[1] : undefined;
43
+
40
44
  if (type !== 'SET_SINGLE_ENABLE_ITEM' || !itemType || !scope) {
41
45
  return state;
42
46
  }
@@ -62,13 +66,16 @@ function singleEnableItems(state = {}, {
62
66
  */
63
67
 
64
68
 
65
- function multipleEnableItems(state = {}, {
66
- type,
67
- itemType,
68
- scope,
69
- item,
70
- isEnable
71
- }) {
69
+ function multipleEnableItems() {
70
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
71
+ let {
72
+ type,
73
+ itemType,
74
+ scope,
75
+ item,
76
+ isEnable
77
+ } = arguments.length > 1 ? arguments[1] : undefined;
78
+
72
79
  if (type !== 'SET_MULTIPLE_ENABLE_ITEM' || !itemType || !scope || !item || (0, _lodash.get)(state, [itemType, scope, item]) === isEnable) {
73
80
  return state;
74
81
  }
@@ -96,8 +103,11 @@ function multipleEnableItems(state = {}, {
96
103
  */
97
104
 
98
105
 
99
- const preferenceDefaults = (0, _lodash.flow)([_data.combineReducers])({
100
- features(state = {}, action) {
106
+ const preferenceDefaults = (0, _data.combineReducers)({
107
+ features() {
108
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
109
+ let action = arguments.length > 1 ? arguments[1] : undefined;
110
+
101
111
  if (action.type === 'SET_FEATURE_DEFAULTS') {
102
112
  const {
103
113
  scope,
@@ -124,8 +134,11 @@ const preferenceDefaults = (0, _lodash.flow)([_data.combineReducers])({
124
134
  */
125
135
 
126
136
  exports.preferenceDefaults = preferenceDefaults;
127
- const preferences = (0, _lodash.flow)([_data.combineReducers])({
128
- features(state = {}, action) {
137
+ const preferences = (0, _data.combineReducers)({
138
+ features() {
139
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
140
+ let action = arguments.length > 1 ? arguments[1] : undefined;
141
+
129
142
  if (action.type === 'SET_FEATURE_VALUE') {
130
143
  const {
131
144
  scope,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/reducer.js"],"names":["singleEnableItems","state","type","itemType","scope","item","multipleEnableItems","isEnable","currentTypeState","currentScopeState","preferenceDefaults","combineReducers","features","action","defaults","preferences","featureName","value","enableItems"],"mappings":";;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,iBAAT,CACNC,KAAK,GAAG,EADF,EAEN;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA,KAAlB;AAAyBC,EAAAA;AAAzB,CAFM,EAGL;AACD,MAAKH,IAAI,KAAK,wBAAT,IAAqC,CAAEC,QAAvC,IAAmD,CAAEC,KAA1D,EAAkE;AACjE,WAAOH,KAAP;AACA;;AAED,SAAO,EACN,GAAGA,KADG;AAEN,KAAEE,QAAF,GAAc,EACb,GAAGF,KAAK,CAAEE,QAAF,CADK;AAEb,OAAEC,KAAF,GAAWC,IAAI,IAAI;AAFN;AAFR,GAAP;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,mBAAT,CACNL,KAAK,GAAG,EADF,EAEN;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA,KAAlB;AAAyBC,EAAAA,IAAzB;AAA+BE,EAAAA;AAA/B,CAFM,EAGL;AACD,MACCL,IAAI,KAAK,0BAAT,IACA,CAAEC,QADF,IAEA,CAAEC,KAFF,IAGA,CAAEC,IAHF,IAIA,iBAAKJ,KAAL,EAAY,CAAEE,QAAF,EAAYC,KAAZ,EAAmBC,IAAnB,CAAZ,MAA4CE,QAL7C,EAME;AACD,WAAON,KAAP;AACA;;AACD,QAAMO,gBAAgB,GAAGP,KAAK,CAAEE,QAAF,CAAL,IAAqB,EAA9C;AACA,QAAMM,iBAAiB,GAAGD,gBAAg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,WAAW,GAAG,2BAAiB;AACpClB,EAAAA,iBADoC;AAEpCM,EAAAA;AAFoC,CAAjB,CAApB;;eAKe,2BAAiB;AAC/BY,EAAAA,WAD+B;AAE/BR,EAAAA,kBAF+B;AAG/BK,EAAAA;AAH+B,CAAjB,C","sourcesContent":["/**\n * External dependencies\n */\nimport { flow, get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer to keep tract of the active area per scope.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action object.\n * @param {string} action.type Action type.\n * @param {string} action.itemType Type of item.\n * @param {string} action.scope Item scope.\n * @param {string} action.item Item name.\n *\n * @return {Object} Updated state.\n */\nexport function singleEnableItems(\n\tstate = {},\n\t{ type, itemType, scope, item }\n) {\n\tif ( type !== 'SET_SINGLE_ENABLE_ITEM' || ! itemType || ! scope ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\t...state,\n\t\t[ itemType ]: {\n\t\t\t...state[ itemType ],\n\t\t\t[ scope ]: item || null,\n\t\t},\n\t};\n}\n\n/**\n * Reducer keeping track of the \"pinned\" items per scope.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action object.\n * @param {string} action.type Action type.\n * @param {string} action.itemType Type of item.\n * @param {string} action.scope Item scope.\n * @param {string} action.item Item name.\n * @param {boolean} action.isEnable Whether the item is pinned.\n *\n * @return {Object} Updated state.\n */\nexport function multipleEnableItems(\n\tstate = {},\n\t{ type, itemType, scope, item, isEnable }\n) {\n\tif (\n\t\ttype !== 'SET_MULTIPLE_ENABLE_ITEM' ||\n\t\t! itemType ||\n\t\t! scope ||\n\t\t! item ||\n\t\tget( state, [ itemType, scope, item ] ) === isEnable\n\t) {\n\t\treturn state;\n\t}\n\tconst currentTypeState = state[ itemType ] || {};\n\tconst currentScopeState = currentTypeState[ scope ] || {};\n\n\treturn {\n\t\t...state,\n\t\t[ itemType ]: {\n\t\t\t...currentTypeState,\n\t\t\t[ scope ]: {\n\t\t\t\t...currentScopeState,\n\t\t\t\t[ item ]: isEnable || false,\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * Reducer returning the defaults for user preferences.\n *\n * This is kept intentionally separate from the preferences\n * themselves so that defaults are not persisted.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const preferenceDefaults = flow( [ combineReducers ] )( {\n\tfeatures( state = {}, action ) {\n\t\tif ( action.type === 'SET_FEATURE_DEFAULTS' ) {\n\t\t\tconst { scope, defaults } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: {\n\t\t\t\t\t...state[ scope ],\n\t\t\t\t\t...defaults,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const preferences = flow( [ combineReducers ] )( {\n\tfeatures( state = {}, action ) {\n\t\tif ( action.type === 'SET_FEATURE_VALUE' ) {\n\t\t\tconst { scope, featureName, value } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: {\n\t\t\t\t\t...state[ scope ],\n\t\t\t\t\t[ featureName ]: value,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\nconst enableItems = combineReducers( {\n\tsingleEnableItems,\n\tmultipleEnableItems,\n} );\n\nexport default combineReducers( {\n\tenableItems,\n\tpreferenceDefaults,\n\tpreferences,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/store/reducer.js"],"names":["singleEnableItems","state","type","itemType","scope","item","multipleEnableItems","isEnable","currentTypeState","currentScopeState","preferenceDefaults","features","action","defaults","preferences","featureName","value","enableItems"],"mappings":";;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;A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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMG,kBAAkB,GAAG,2BAAiB;AAClDC,EAAAA,QAAQ,GAAuB;AAAA,QAArBV,KAAqB,uEAAb,EAAa;AAAA,QAATW,MAAS;;AAC9B,QAAKA,MAAM,CAACV,IAAP,KAAgB,sBAArB,EAA8C;AAC7C,YAAM;AAAEE,QAAAA,KAAF;AAASS,QAAAA;AAAT,UAAsBD,MAA5B;AACA,aAAO,EACN,GAAGX,KADG;AAEN,SAAEG,KAAF,GAAW,EACV,GAAGH,KAAK,CAAEG,KAAF,CADE;AAEV,aAAGS;AAFO;AAFL,OAAP;AAOA;;AAED,WAAOZ,KAAP;AACA;;AAdiD,CAAjB,CAA3B;AAiBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMa,WAAW,GAAG,2BAAiB;AAC3CH,EAAAA,QAAQ,GAAuB;AAAA,QAArBV,KAAqB,uEAAb,EAAa;AAAA,QAATW,MAAS;;AAC9B,QAAKA,MAAM,CAACV,IAAP,KAAgB,mBAArB,EAA2C;AAC1C,YAAM;AAAEE,QAAAA,KAAF;AAASW,QAAAA,WAAT;AAAsBC,QAAAA;AAAtB,UAAgCJ,MAAtC;AACA,aAAO,EACN,GAAGX,KADG;AAEN,SAAEG,KAAF,GAAW,EACV,GAAGH,KAAK,CAAEG,KAAF,CADE;AAEV,WAAEW,WAAF,GAAiBC;AAFP;AAFL,OAAP;AAOA;;AAED,WAAOf,KAAP;AACA;;AAd0C,CAAjB,CAApB;;AAiBP,MAAMgB,WAAW,GAAG,2BAAiB;AACpCjB,EAAAA,iBADoC;AAEpCM,EAAAA;AAFoC,CAAjB,CAApB;;eAKe,2BAAiB;AAC/BW,EAAAA,WAD+B;AAE/BP,EAAAA,kBAF+B;AAG/BI,EAAAA;AAH+B,CAAjB,C","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer to keep tract of the active area per scope.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action object.\n * @param {string} action.type Action type.\n * @param {string} action.itemType Type of item.\n * @param {string} action.scope Item scope.\n * @param {string} action.item Item name.\n *\n * @return {Object} Updated state.\n */\nexport function singleEnableItems(\n\tstate = {},\n\t{ type, itemType, scope, item }\n) {\n\tif ( type !== 'SET_SINGLE_ENABLE_ITEM' || ! itemType || ! scope ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\t...state,\n\t\t[ itemType ]: {\n\t\t\t...state[ itemType ],\n\t\t\t[ scope ]: item || null,\n\t\t},\n\t};\n}\n\n/**\n * Reducer keeping track of the \"pinned\" items per scope.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action object.\n * @param {string} action.type Action type.\n * @param {string} action.itemType Type of item.\n * @param {string} action.scope Item scope.\n * @param {string} action.item Item name.\n * @param {boolean} action.isEnable Whether the item is pinned.\n *\n * @return {Object} Updated state.\n */\nexport function multipleEnableItems(\n\tstate = {},\n\t{ type, itemType, scope, item, isEnable }\n) {\n\tif (\n\t\ttype !== 'SET_MULTIPLE_ENABLE_ITEM' ||\n\t\t! itemType ||\n\t\t! scope ||\n\t\t! item ||\n\t\tget( state, [ itemType, scope, item ] ) === isEnable\n\t) {\n\t\treturn state;\n\t}\n\tconst currentTypeState = state[ itemType ] || {};\n\tconst currentScopeState = currentTypeState[ scope ] || {};\n\n\treturn {\n\t\t...state,\n\t\t[ itemType ]: {\n\t\t\t...currentTypeState,\n\t\t\t[ scope ]: {\n\t\t\t\t...currentScopeState,\n\t\t\t\t[ item ]: isEnable || false,\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * Reducer returning the defaults for user preferences.\n *\n * This is kept intentionally separate from the preferences\n * themselves so that defaults are not persisted.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const preferenceDefaults = combineReducers( {\n\tfeatures( state = {}, action ) {\n\t\tif ( action.type === 'SET_FEATURE_DEFAULTS' ) {\n\t\t\tconst { scope, defaults } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: {\n\t\t\t\t\t...state[ scope ],\n\t\t\t\t\t...defaults,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const preferences = combineReducers( {\n\tfeatures( state = {}, action ) {\n\t\tif ( action.type === 'SET_FEATURE_VALUE' ) {\n\t\t\tconst { scope, featureName, value } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: {\n\t\t\t\t\t...state[ scope ],\n\t\t\t\t\t[ featureName ]: value,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\nconst enableItems = combineReducers( {\n\tsingleEnableItems,\n\tmultipleEnableItems,\n} );\n\nexport default combineReducers( {\n\tenableItems,\n\tpreferenceDefaults,\n\tpreferences,\n} );\n"]}
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getActiveComplementaryArea = getActiveComplementaryArea;
7
- exports.isItemPinned = isItemPinned;
8
7
  exports.isFeatureActive = isFeatureActive;
8
+ exports.isItemPinned = isItemPinned;
9
9
 
10
10
  var _lodash = require("lodash");
11
11
 
@@ -12,13 +12,14 @@ import { isEmpty, noop } from 'lodash';
12
12
  import { ButtonGroup, Button, Slot, Fill } from '@wordpress/components';
13
13
  import { Children } from '@wordpress/element';
14
14
 
15
- function ActionItemSlot({
16
- name,
17
- as: Component = ButtonGroup,
18
- fillProps = {},
19
- bubblesVirtually,
20
- ...props
21
- }) {
15
+ function ActionItemSlot(_ref) {
16
+ let {
17
+ name,
18
+ as: Component = ButtonGroup,
19
+ fillProps = {},
20
+ bubblesVirtually,
21
+ ...props
22
+ } = _ref;
22
23
  return createElement(Slot, {
23
24
  name: name,
24
25
  bubblesVirtually: bubblesVirtually,
@@ -34,12 +35,14 @@ function ActionItemSlot({
34
35
 
35
36
 
36
37
  const initializedByPlugins = [];
37
- Children.forEach(fills, ({
38
- props: {
39
- __unstableExplicitMenuItem,
40
- __unstableTarget
41
- }
42
- }) => {
38
+ Children.forEach(fills, _ref2 => {
39
+ let {
40
+ props: {
41
+ __unstableExplicitMenuItem,
42
+ __unstableTarget
43
+ }
44
+ } = _ref2;
45
+
43
46
  if (__unstableTarget && __unstableExplicitMenuItem) {
44
47
  initializedByPlugins.push(__unstableTarget);
45
48
  }
@@ -55,21 +58,23 @@ function ActionItemSlot({
55
58
  });
56
59
  }
57
60
 
58
- function ActionItem({
59
- name,
60
- as: Component = Button,
61
- onClick,
62
- ...props
63
- }) {
61
+ function ActionItem(_ref3) {
62
+ let {
63
+ name,
64
+ as: Component = Button,
65
+ onClick,
66
+ ...props
67
+ } = _ref3;
64
68
  return createElement(Fill, {
65
69
  name: name
66
- }, ({
67
- onClick: fpOnClick
68
- }) => {
70
+ }, _ref4 => {
71
+ let {
72
+ onClick: fpOnClick
73
+ } = _ref4;
69
74
  return createElement(Component, _extends({
70
- onClick: onClick || fpOnClick ? (...args) => {
71
- (onClick || noop)(...args);
72
- (fpOnClick || noop)(...args);
75
+ onClick: onClick || fpOnClick ? function () {
76
+ (onClick || noop)(...arguments);
77
+ (fpOnClick || noop)(...arguments);
73
78
  } : undefined
74
79
  }, props));
75
80
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/components/action-item/index.js"],"names":["isEmpty","noop","ButtonGroup","Button","Slot","Fill","Children","ActionItemSlot","name","as","Component","fillProps","bubblesVirtually","props","fills","toArray","initializedByPlugins","forEach","__unstableExplicitMenuItem","__unstableTarget","push","children","map","child","includes","ActionItem","onClick","fpOnClick","args","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,IAAlB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ADD;AA2CA;;AAED,SAASI,UAAT,CAAqB;AAAEjB,EAAAA,IAAF;AAAQC,EAAAA,EAAE,EAAEC,SAAS,GAAGP,MAAxB;AAAgCuB,EAAAA,OAAhC;AAAyC,KAAGb;AAA5C,CAArB,EAA2E;AAC1E,SACC,cAAC,IAAD;AAAM,IAAA,IAAI,EAAGL;AAAb,KACG,CAAE;AAAEkB,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,IAAIzB,IAAb,EAAqB,GAAG2B,IAAxB;AACA,SAAED,SAAS,IAAI1B,IAAf,EAAuB,GAAG2B,IAA1B;AACC,OAJJ,GAKGC;AAPL,OASMhB,KATN,EADD;AAaA,GAfF,CADD;AAmBA;;AAEDY,UAAU,CAACrB,IAAX,GAAkBG,cAAlB;AAEA,eAAekB,UAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, noop } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { ButtonGroup, Button, Slot, Fill } from '@wordpress/components';\nimport { Children } from '@wordpress/element';\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 ( isEmpty( Children.toArray( fills ) ) ) {\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
+ {"version":3,"sources":["@wordpress/interface/src/components/action-item/index.js"],"names":["isEmpty","noop","ButtonGroup","Button","Slot","Fill","Children","ActionItemSlot","name","as","Component","fillProps","bubblesVirtually","props","fills","toArray","initializedByPlugins","forEach","__unstableExplicitMenuItem","__unstableTarget","push","children","map","child","includes","ActionItem","onClick","fpOnClick","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,IAAlB,QAA8B,QAA9B;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,MAAtB,EAA8BC,IAA9B,EAAoCC,IAApC,QAAgD,uBAAhD;AACA,SAASC,QAAT,QAAyB,oBAAzB;;AAEA,SAASC,cAAT,OAMI;AAAA,MANqB;AACxBC,IAAAA,IADwB;AAExBC,IAAAA,EAAE,EAAEC,SAAS,GAAGR,WAFQ;AAGxBS,IAAAA,SAAS,GAAG,EAHY;AAIxBC,IAAAA,gBAJwB;AAKxB,OAAGC;AALqB,GAMrB;AACH,SACC,cAAC,IAAD;AACC,IAAA,IAAI,EAAGL,IADR;AAEC,IAAA,gBAAgB,EAAGI,gBAFpB;AAGC,IAAA,SAAS,EAAGD;AAHb,KAKKG,KAAF,IAAa;AACd,QAAKd,OAAO,CAAEM,QAAQ,CAACS,OAAT,CAAkBD,KAAlB,CAAF,CAAZ,EAA4C;AAC3C,aAAO,IAAP;AACA,KAHa,CAKd;AACA;AACA;AACA;AACA;;;AACA,UAAME,oBAAoB,GAAG,EAA7B;AACAV,IAAAA,QAAQ,CAACW,OAAT,CACCH,KADD,EAEC,SAEO;AAAA,UAFL;AACDD,QAAAA,KAAK,EAAE;AAAEK,UAAAA,0BAAF;AAA8BC,UAAAA;AAA9B;AADN,OAEK;;AACN,UAAKA,gBAAgB,IAAID,0BAAzB,EAAsD;AACrDF,QAAAA,oBAAoB,CAACI,IAArB,CAA2BD,gBAA3B;AACA;AACD,KARF;AAUA,UAAME,QAAQ,GAAGf,QAAQ,CAACgB,GAAT,CAAcR,KAAd,EAAuBS,KAAF,IAAa;AAClD,UACC,CAAEA,KAAK,CAACV,KAAN,CAAYK,0BAAd,IACAF,oBAAoB,CAACQ,QAArB,CACCD,KAAK,CAACV,KAAN,CAAYM,gBADb,CAFD,EAKE;AACD,eAAO,IAAP;AACA;;AACD,aAAOI,KAAP;AACA,KAVgB,CAAjB;AAYA,WAAO,cAAC,SAAD,EAAgBV,KAAhB,EAA0BQ,QAA1B,CAAP;AACA,GAvCF,CADD;AA2CA;;AAED,SAASI,UAAT,QAA2E;AAAA,MAAtD;AAAEjB,IAAAA,IAAF;AAAQC,IAAAA,EAAE,EAAEC,SAAS,GAAGP,MAAxB;AAAgCuB,IAAAA,OAAhC;AAAyC,OAAGb;AAA5C,GAAsD;AAC1E,SACC,cAAC,IAAD;AAAM,IAAA,IAAI,EAAGL;AAAb,KACG,SAA8B;AAAA,QAA5B;AAAEkB,MAAAA,OAAO,EAAEC;AAAX,KAA4B;AAC/B,WACC,cAAC,SAAD;AACC,MAAA,OAAO,EACND,OAAO,IAAIC,SAAX,GACG,YAAe;AACf,SAAED,OAAO,IAAIzB,IAAb,EAAqB,YAArB;AACA,SAAE0B,SAAS,IAAI1B,IAAf,EAAuB,YAAvB;AACC,OAJJ,GAKG2B;AAPL,OASMf,KATN,EADD;AAaA,GAfF,CADD;AAmBA;;AAEDY,UAAU,CAACrB,IAAX,GAAkBG,cAAlB;AAEA,eAAekB,UAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, noop } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { ButtonGroup, Button, Slot, Fill } from '@wordpress/components';\nimport { Children } from '@wordpress/element';\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 ( isEmpty( Children.toArray( fills ) ) ) {\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"]}
@@ -26,20 +26,22 @@ import withComplementaryAreaContext from '../complementary-area-context';
26
26
  import PinnedItems from '../pinned-items';
27
27
  import { store as interfaceStore } from '../../store';
28
28
 
29
- function ComplementaryAreaSlot({
30
- scope,
31
- ...props
32
- }) {
29
+ function ComplementaryAreaSlot(_ref) {
30
+ let {
31
+ scope,
32
+ ...props
33
+ } = _ref;
33
34
  return createElement(Slot, _extends({
34
35
  name: `ComplementaryArea/${scope}`
35
36
  }, props));
36
37
  }
37
38
 
38
- function ComplementaryAreaFill({
39
- scope,
40
- children,
41
- className
42
- }) {
39
+ function ComplementaryAreaFill(_ref2) {
40
+ let {
41
+ scope,
42
+ children,
43
+ className
44
+ } = _ref2;
43
45
  return createElement(Fill, {
44
46
  name: `ComplementaryArea/${scope}`
45
47
  }, createElement("div", {
@@ -80,24 +82,25 @@ function useAdjustComplementaryListener(scope, identifier, activeArea, isActive,
80
82
  }, [isActive, isSmall, scope, identifier, activeArea]);
81
83
  }
82
84
 
83
- function ComplementaryArea({
84
- children,
85
- className,
86
- closeLabel = __('Close plugin'),
87
- identifier,
88
- header,
89
- headerClassName,
90
- icon,
91
- isPinnable = true,
92
- panelClassName,
93
- scope,
94
- name,
95
- smallScreenTitle,
96
- title,
97
- toggleShortcut,
98
- isActiveByDefault,
99
- showIconLabels = false
100
- }) {
85
+ function ComplementaryArea(_ref3) {
86
+ let {
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
+ } = _ref3;
101
104
  const {
102
105
  isActive,
103
106
  isPinned,
@@ -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","isPinned","isLarge","select","getActiveComplementaryArea","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;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ependencies\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 } = useDispatch(\n\t\tinterfaceStore\n\t);\n\tuseEffect( () => {\n\t\t// If the complementary area is active and the editor is switching from a big to a small window size.\n\t\tif ( isActive && isSmall && ! previousIsSmall.current ) {\n\t\t\t// Disable the complementary area.\n\t\t\tdisableComplementaryArea( scope );\n\t\t\t// Flag the complementary area to be reopened when the window size 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 enabled when we go from small to big window size\n\t\t\t// and we are going 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 enabled.\n\t\t\tshouldOpenWhenNotSmall.current = false;\n\t\t\t// Enable the complementary area.\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 reopened but another complementary area becomes active,\n\t\t\t// remove 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 { isActive, isPinned, activeArea, isSmall, isLarge } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveComplementaryArea, isItemPinned } = select(\n\t\t\t\tinterfaceStore\n\t\t\t);\n\t\t\tconst _activeArea = getActiveComplementaryArea( scope );\n\t\t\treturn {\n\t\t\t\tisActive: _activeArea === identifier,\n\t\t\t\tisPinned: isItemPinned( scope, identifier ),\n\t\t\t\tactiveArea: _activeArea,\n\t\t\t\tisSmall: select( viewportStore ).isViewportMatch( '< medium' ),\n\t\t\t\tisLarge: select( viewportStore ).isViewportMatch( 'large' ),\n\t\t\t};\n\t\t},\n\t\t[ identifier, scope ]\n\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\tif ( isActiveByDefault && activeArea === undefined && ! isSmall ) {\n\t\t\tenableComplementaryArea( 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\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 = withComplementaryAreaContext(\n\tComplementaryArea\n);\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","isPinned","isLarge","select","getActiveComplementaryArea","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,QA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AAwB,GAAG5C,4BAA4B,CAC5DmB,iBAD4D,CAA7D;AAIAyB,wBAAwB,CAAC3D,IAAzB,GAAgCkB,qBAAhC;AAEA,eAAeyC,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 } = useDispatch(\n\t\tinterfaceStore\n\t);\n\tuseEffect( () => {\n\t\t// If the complementary area is active and the editor is switching from a big to a small window size.\n\t\tif ( isActive && isSmall && ! previousIsSmall.current ) {\n\t\t\t// Disable the complementary area.\n\t\t\tdisableComplementaryArea( scope );\n\t\t\t// Flag the complementary area to be reopened when the window size 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 enabled when we go from small to big window size\n\t\t\t// and we are going 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 enabled.\n\t\t\tshouldOpenWhenNotSmall.current = false;\n\t\t\t// Enable the complementary area.\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 reopened but another complementary area becomes active,\n\t\t\t// remove 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 { isActive, isPinned, activeArea, isSmall, isLarge } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveComplementaryArea, isItemPinned } = select(\n\t\t\t\tinterfaceStore\n\t\t\t);\n\t\t\tconst _activeArea = getActiveComplementaryArea( scope );\n\t\t\treturn {\n\t\t\t\tisActive: _activeArea === identifier,\n\t\t\t\tisPinned: isItemPinned( scope, identifier ),\n\t\t\t\tactiveArea: _activeArea,\n\t\t\t\tisSmall: select( viewportStore ).isViewportMatch( '< medium' ),\n\t\t\t\tisLarge: select( viewportStore ).isViewportMatch( 'large' ),\n\t\t\t};\n\t\t},\n\t\t[ identifier, scope ]\n\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\tif ( isActiveByDefault && activeArea === undefined && ! isSmall ) {\n\t\t\tenableComplementaryArea( 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\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 = withComplementaryAreaContext(\n\tComplementaryArea\n);\n\nComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;\n\nexport default ComplementaryAreaWrapped;\n"]}
@@ -16,12 +16,13 @@ import { closeSmall } from '@wordpress/icons';
16
16
 
17
17
  import ComplementaryAreaToggle from '../complementary-area-toggle';
18
18
 
19
- const ComplementaryAreaHeader = ({
20
- smallScreenTitle,
21
- children,
22
- className,
23
- toggleButtonProps
24
- }) => {
19
+ const ComplementaryAreaHeader = _ref => {
20
+ let {
21
+ smallScreenTitle,
22
+ children,
23
+ className,
24
+ toggleButtonProps
25
+ } = _ref;
25
26
  const toggleButton = createElement(ComplementaryAreaToggle, _extends({
26
27
  icon: closeSmall
27
28
  }, toggleButtonProps));