@wordpress/interface 4.7.0 → 4.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/action-item/index.js +4 -3
  3. package/build/components/action-item/index.js.map +1 -1
  4. package/build/components/complementary-area/index.js.map +1 -1
  5. package/build/components/complementary-area-toggle/index.js.map +1 -1
  6. package/build/store/actions.js +42 -10
  7. package/build/store/actions.js.map +1 -1
  8. package/build/store/index.js +5 -1
  9. package/build/store/index.js.map +1 -1
  10. package/build/store/reducer.js +55 -0
  11. package/build/store/reducer.js.map +1 -0
  12. package/build/store/selectors.js +19 -4
  13. package/build/store/selectors.js.map +1 -1
  14. package/build-module/components/action-item/index.js +3 -1
  15. package/build-module/components/action-item/index.js.map +1 -1
  16. package/build-module/components/complementary-area/index.js.map +1 -1
  17. package/build-module/components/complementary-area-toggle/index.js.map +1 -1
  18. package/build-module/store/actions.js +38 -9
  19. package/build-module/store/actions.js.map +1 -1
  20. package/build-module/store/index.js +2 -1
  21. package/build-module/store/index.js.map +1 -1
  22. package/build-module/store/reducer.js +43 -0
  23. package/build-module/store/reducer.js.map +1 -0
  24. package/build-module/store/selectors.js +19 -4
  25. package/build-module/store/selectors.js.map +1 -1
  26. package/build-style/style-rtl.css +0 -1
  27. package/build-style/style.css +0 -1
  28. package/package.json +13 -13
  29. package/src/components/action-item/index.js +3 -1
  30. package/src/components/complementary-area/index.js +6 -9
  31. package/src/components/complementary-area-toggle/index.js +2 -3
  32. package/src/components/more-menu-dropdown/style.scss +0 -1
  33. package/src/store/actions.js +96 -56
  34. package/src/store/index.js +2 -1
  35. package/src/store/reducer.js +35 -0
  36. package/src/store/selectors.js +21 -4
  37. package/src/store/test/actions.js +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.10.0 (2022-06-15)
6
+
7
+ ## 4.9.0 (2022-06-01)
8
+
9
+ ## 4.8.0 (2022-05-18)
10
+
5
11
  ## 4.7.0 (2022-05-04)
6
12
 
7
13
  ## 4.6.0 (2022-04-21)
@@ -22,6 +22,8 @@ var _components = require("@wordpress/components");
22
22
  /**
23
23
  * WordPress dependencies
24
24
  */
25
+ const noop = () => {};
26
+
25
27
  function ActionItemSlot(_ref) {
26
28
  let {
27
29
  name,
@@ -86,9 +88,8 @@ function ActionItem(_ref3) {
86
88
  } = _ref4;
87
89
  return (0, _element.createElement)(Component, (0, _extends2.default)({
88
90
  onClick: onClick || fpOnClick ? function () {
89
- (onClick || _lodash.noop)(...arguments);
90
-
91
- (fpOnClick || _lodash.noop)(...arguments);
91
+ (onClick || noop)(...arguments);
92
+ (fpOnClick || noop)(...arguments);
92
93
  } : undefined
93
94
  }, props));
94
95
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/components/action-item/index.js"],"names":["ActionItemSlot","name","as","Component","ButtonGroup","fillProps","bubblesVirtually","props","fills","Children","toArray","initializedByPlugins","forEach","__unstableExplicitMenuItem","__unstableTarget","push","children","map","child","includes","ActionItem","Button","onClick","fpOnClick","noop","undefined","Slot"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,cAAT,OAMI;AAAA,MANqB;AACxBC,IAAAA,IADwB;AAExBC,IAAAA,EAAE,EAAEC,SAAS,GAAGC,uBAFQ;AAGxBC,IAAAA,SAAS,GAAG,EAHY;AAIxBC,IAAAA,gBAJwB;AAKxB,OAAGC;AALqB,GAMrB;AACH,SACC,4BAAC,gBAAD;AACC,IAAA,IAAI,EAAGN,IADR;AAEC,IAAA,gBAAgB,EAAGK,gBAFpB;AAGC,IAAA,SAAS,EAAGD;AAHb,KAKKG,KAAF,IAAa;AACd,QAAK,qBAASC,kBAASC,OAAT,CAAkBF,KAAlB,CAAT,CAAL,EAA4C;AAC3C,aAAO,IAAP;AACA,KAHa,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","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":["noop","ActionItemSlot","name","as","Component","ButtonGroup","fillProps","bubblesVirtually","props","fills","Children","toArray","initializedByPlugins","forEach","__unstableExplicitMenuItem","__unstableTarget","push","children","map","child","includes","ActionItem","Button","onClick","fpOnClick","undefined","Slot"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAIA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,cAAT,OAMI;AAAA,MANqB;AACxBC,IAAAA,IADwB;AAExBC,IAAAA,EAAE,EAAEC,SAAS,GAAGC,uBAFQ;AAGxBC,IAAAA,SAAS,GAAG,EAHY;AAIxBC,IAAAA,gBAJwB;AAKxB,OAAGC;AALqB,GAMrB;AACH,SACC,4BAAC,gBAAD;AACC,IAAA,IAAI,EAAGN,IADR;AAEC,IAAA,gBAAgB,EAAGK,gBAFpB;AAGC,IAAA,SAAS,EAAGD;AAHb,KAKKG,KAAF,IAAa;AACd,QAAK,qBAASC,kBAASC,OAAT,CAAkBF,KAAlB,CAAT,CAAL,EAA4C;AAC3C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X,GAAkBzB,cAAlB;eAEeoB,U","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n\n/**\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 ( 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 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/components/complementary-area/index.js"],"names":["ComplementaryAreaSlot","scope","props","ComplementaryAreaFill","children","className","useAdjustComplementaryListener","identifier","activeArea","isActive","isSmall","previousIsSmall","shouldOpenWhenNotSmall","enableComplementaryArea","disableComplementaryArea","interfaceStore","current","ComplementaryArea","closeLabel","header","headerClassName","icon","isPinnable","panelClassName","name","smallScreenTitle","title","toggleShortcut","isActiveByDefault","showIconLabels","isPinned","isLarge","select","getActiveComplementaryArea","isItemPinned","_activeArea","viewportStore","isViewportMatch","pinItem","unpinItem","undefined","check","label","shortcut","starFilled","starEmpty","ComplementaryAreaWrapped","Slot"],"mappings":";;;;;;;;;AAYA;;;;AATA;;AAKA;;AACA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAQA,SAASA,qBAAT,OAAsD;AAAA,MAAtB;AAAEC,IAAAA,KAAF;AAAS,OAAGC;AAAZ,GAAsB;AACrD,SAAO,4BAA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GoB;AAHR,KAKGK,KALH,CApBF,EA4BGjB,QAAQ,IACT,4BAAC,qBAAD;AACC,IAAA,SAAS,EAAG,yBACX,8BADW,EAEXJ,SAFW,CADb;AAKC,IAAA,KAAK,EAAGJ;AALT,KAOC,4BAAC,gCAAD;AACC,IAAA,SAAS,EAAGmB,eADb;AAEC,IAAA,UAAU,EAAGF,UAFd;AAGC,IAAA,OAAO,EAAG,MAAMJ,wBAAwB,CAAEb,KAAF,CAHzC;AAIC,IAAA,gBAAgB,EAAGwB,gBAJpB;AAKC,IAAA,iBAAiB,EAAG;AACnBiB,MAAAA,KAAK,EAAExB,UADY;AAEnByB,MAAAA,QAAQ,EAAEhB,cAFS;AAGnB1B,MAAAA,KAHmB;AAInBM,MAAAA;AAJmB;AALrB,KAYGY,MAAM,IACP,qDACC,4CAAUO,KAAV,CADD,EAEGJ,UAAU,IACX,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,8CADX;AAEC,IAAA,IAAI,EACHQ,QAAQ,GAAGc,iBAAH,GAAgBC,gBAH1B;AAKC,IAAA,KAAK,EACJf,QAAQ,GACL,cAAI,oBAAJ,CADK,GAEL,cAAI,gBAAJ,CARL;AAUC,IAAA,OAAO,EAAG,MACT,CAAEA,QAAQ,GAAGS,SAAH,GAAeD,OAAzB,EACCrC,KADD,EAECM,UAFD,CAXF;AAgBC,IAAA,SAAS,EAAGuB,QAhBb;AAiBC,qBAAgBA;AAjBjB,IAHF,CAbF,CAPD,EA8CC,4BAAC,iBAAD;AAAO,IAAA,SAAS,EAAGP;AAAnB,KAAsCnB,QAAtC,CA9CD,CA7BF,CADD;AAiFA;;AAED,MAAM0C,wBAAwB,GAAG,uCAChC7B,iBADgC,CAAjC;AAIA6B,wBAAwB,CAACC,IAAzB,GAAgC/C,qBAAhC;eAEe8C,wB","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"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/components/complementary-area/index.js"],"names":["ComplementaryAreaSlot","scope","props","ComplementaryAreaFill","children","className","useAdjustComplementaryListener","identifier","activeArea","isActive","isSmall","previousIsSmall","shouldOpenWhenNotSmall","enableComplementaryArea","disableComplementaryArea","interfaceStore","current","ComplementaryArea","closeLabel","header","headerClassName","icon","isPinnable","panelClassName","name","smallScreenTitle","title","toggleShortcut","isActiveByDefault","showIconLabels","isPinned","isLarge","select","getActiveComplementaryArea","isItemPinned","_activeArea","viewportStore","isViewportMatch","pinItem","unpinItem","undefined","check","label","shortcut","starFilled","starEmpty","ComplementaryAreaWrapped","Slot"],"mappings":";;;;;;;;;AAYA;;;;AATA;;AAKA;;AACA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAQA,SAASA,qBAAT,OAAsD;AAAA,MAAtB;AAAEC,IAAAA,KAAF;AAAS,OAAGC;AAAZ,GAAsB;AACrD,SAAO,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAI,qBAAqBD,KAAO;AAA1C,KAAmDC,KAAnD,EAAP;AACA;;AAED,SAASC,qBAAT,QAAiE;AAAA,MAAjC;AAAEF,IAAAA,KAAF;AAASG,IAAAA,QAAT;AAAmBC,IAAAA;AAAnB,GAAiC;AAChE,SACC,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAI,qBAAqBJ,KAAO;AAA1C,KACC;AAAK,IAAA,SAAS,EAAGI;AAAjB,KAA+BD,QAA/B,CADD,CADD;AAKA;;AAED,SAASE,8BAAT,CACCL,KADD,EAECM,UAFD,EAGCC,UAHD,EAICC,QAJD,EAKCC,OALD,EAME;AACD,QAAMC,eAAe,GAAG,qBAAQ,KAAR,CAAxB;AACA,QAAMC,sBAAsB,GAAG,qBAAQ,KAAR,CAA/B;AACA,QAAM;AAAEC,I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AC,kBAAD;AACC,IAAA,SAAS,EAAC,8CADX;AAEC,IAAA,IAAI,EACHQ,QAAQ,GAAGc,iBAAH,GAAgBC,gBAH1B;AAKC,IAAA,KAAK,EACJf,QAAQ,GACL,cAAI,oBAAJ,CADK,GAEL,cAAI,gBAAJ,CARL;AAUC,IAAA,OAAO,EAAG,MACT,CAAEA,QAAQ,GAAGS,SAAH,GAAeD,OAAzB,EACCrC,KADD,EAECM,UAFD,CAXF;AAgBC,IAAA,SAAS,EAAGuB,QAhBb;AAiBC,qBAAgBA;AAjBjB,IAHF,CAbF,CAPD,EA8CC,4BAAC,iBAAD;AAAO,IAAA,SAAS,EAAGP;AAAnB,KAAsCnB,QAAtC,CA9CD,CA7BF,CADD;AAiFA;;AAED,MAAM0C,wBAAwB,GAC7B,uCAA8B7B,iBAA9B,CADD;AAGA6B,wBAAwB,CAACC,IAAzB,GAAgC/C,qBAAhC;eAEe8C,wB","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 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 } =\n\t\t\t\tselect( interfaceStore );\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 =\n\twithComplementaryAreaContext( ComplementaryArea );\n\nComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;\n\nexport default ComplementaryAreaWrapped;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"names":["ComplementaryAreaToggle","as","Button","scope","identifier","icon","selectedIcon","props","ComponentToUse","isSelected","select","interfaceStore","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAIA,SAASA,uBAAT,OAOI;AAAA,MAP8B;AACjCC,IAAAA,EAAE,GAAGC,kBAD4B;AAEjCC,IAAAA,KAFiC;AAGjCC,IAAAA,UAHiC;AAIjCC,IAAAA,IAJiC;AAKjCC,IAAAA,YALiC;AAMjC,OAAGC;AAN8B,GAO9B;AACH,QAAMC,cAAc,GAAGP,EAAvB;AACA,QAAMQ,UAAU,GAAG,qBAChBC,MAAF,IACCA,MAAM,CAAEC,YAAF,CAAN,CAAyBC,0BAAzB,CAAqDT,KAArD,MACAC,UAHiB,EAIlB,CAAEA,UAAF,CAJkB,CAAnB;AAMA,QAAM;AAAES,IAAAA,uBAAF;AAA2BC,IAAAA;AAA3B,MAAwD,uBAC7DH,YAD6D,CAA9D;AAGA,SACC,4BAAC,cAAD;AACC,IAAA,IAAI,EAAGL,YAAY,IAAIG,UAAhB,GAA6BH,YAA7B,GAA4CD,IADpD;AAEC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKI,UAAL,EAAkB;AACjBK,QAAAA,wBAAwB,CAAEX,KAAF,CAAxB;AACA,OAFD,MAEO;AACNU,QAAAA,uBAAuB,CAAEV,KAAF,EAASC,UAAT,CAAvB;AACA;AACD;AARF,KASM,kBAAMG,KAAN,EAAa,CAAE,MAAF,CAAb,CATN,EADD;AAaA;;eAEc,uCAA0BP,uBAA1B,C","sourcesContent":["/**\n * External dependencies\n */\nimport { omit } from 'lodash';\n\n/**\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\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 } = useDispatch(\n\t\tinterfaceStore\n\t);\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{ ...omit( props, [ 'name' ] ) }\n\t\t/>\n\t);\n}\n\nexport default complementaryAreaContext( ComplementaryAreaToggle );\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"names":["ComplementaryAreaToggle","as","Button","scope","identifier","icon","selectedIcon","props","ComponentToUse","isSelected","select","interfaceStore","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAIA,SAASA,uBAAT,OAOI;AAAA,MAP8B;AACjCC,IAAAA,EAAE,GAAGC,kBAD4B;AAEjCC,IAAAA,KAFiC;AAGjCC,IAAAA,UAHiC;AAIjCC,IAAAA,IAJiC;AAKjCC,IAAAA,YALiC;AAMjC,OAAGC;AAN8B,GAO9B;AACH,QAAMC,cAAc,GAAGP,EAAvB;AACA,QAAMQ,UAAU,GAAG,qBAChBC,MAAF,IACCA,MAAM,CAAEC,YAAF,CAAN,CAAyBC,0BAAzB,CAAqDT,KAArD,MACAC,UAHiB,EAIlB,CAAEA,UAAF,CAJkB,CAAnB;AAMA,QAAM;AAAES,IAAAA,uBAAF;AAA2BC,IAAAA;AAA3B,MACL,uBAAaH,YAAb,CADD;AAEA,SACC,4BAAC,cAAD;AACC,IAAA,IAAI,EAAGL,YAAY,IAAIG,UAAhB,GAA6BH,YAA7B,GAA4CD,IADpD;AAEC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKI,UAAL,EAAkB;AACjBK,QAAAA,wBAAwB,CAAEX,KAAF,CAAxB;AACA,OAFD,MAEO;AACNU,QAAAA,uBAAuB,CAAEV,KAAF,EAASC,UAAT,CAAvB;AACA;AACD;AARF,KASM,kBAAMG,KAAN,EAAa,CAAE,MAAF,CAAb,CATN,EADD;AAaA;;eAEc,uCAA0BP,uBAA1B,C","sourcesContent":["/**\n * External dependencies\n */\nimport { omit } from 'lodash';\n\n/**\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\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{ ...omit( props, [ 'name' ] ) }\n\t\t/>\n\t);\n}\n\nexport default complementaryAreaContext( ComplementaryAreaToggle );\n"]}
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.pinItem = exports.enableComplementaryArea = exports.disableComplementaryArea = void 0;
8
+ exports.setDefaultComplementaryArea = exports.pinItem = exports.enableComplementaryArea = exports.disableComplementaryArea = void 0;
9
9
  exports.setFeatureDefaults = setFeatureDefaults;
10
10
  exports.setFeatureValue = setFeatureValue;
11
11
  exports.toggleFeature = toggleFeature;
@@ -19,15 +19,33 @@ var _preferences = require("@wordpress/preferences");
19
19
  * WordPress dependencies
20
20
  */
21
21
 
22
+ /**
23
+ * Set a default complementary area.
24
+ *
25
+ * @param {string} scope Complementary area scope.
26
+ * @param {string} area Area identifier.
27
+ *
28
+ * @return {Object} Action object.
29
+ */
30
+ const setDefaultComplementaryArea = (scope, area) => ({
31
+ type: 'SET_DEFAULT_COMPLEMENTARY_AREA',
32
+ scope,
33
+ area
34
+ });
22
35
  /**
23
36
  * Enable the complementary area.
24
37
  *
25
38
  * @param {string} scope Complementary area scope.
26
39
  * @param {string} area Area identifier.
27
40
  */
41
+
42
+
43
+ exports.setDefaultComplementaryArea = setDefaultComplementaryArea;
44
+
28
45
  const enableComplementaryArea = (scope, area) => _ref => {
29
46
  let {
30
- registry
47
+ registry,
48
+ dispatch
31
49
  } = _ref;
32
50
 
33
51
  // Return early if there's no area.
@@ -35,7 +53,17 @@ const enableComplementaryArea = (scope, area) => _ref => {
35
53
  return;
36
54
  }
37
55
 
38
- registry.dispatch(_preferences.store).set(scope, 'complementaryArea', area);
56
+ const isComplementaryAreaVisible = registry.select(_preferences.store).get(scope, 'isComplementaryAreaVisible');
57
+
58
+ if (!isComplementaryAreaVisible) {
59
+ registry.dispatch(_preferences.store).set(scope, 'isComplementaryAreaVisible', true);
60
+ }
61
+
62
+ dispatch({
63
+ type: 'ENABLE_COMPLEMENTARY_AREA',
64
+ scope,
65
+ area
66
+ });
39
67
  };
40
68
  /**
41
69
  * Disable the complementary area.
@@ -50,7 +78,11 @@ const disableComplementaryArea = scope => _ref2 => {
50
78
  let {
51
79
  registry
52
80
  } = _ref2;
53
- registry.dispatch(_preferences.store).set(scope, 'complementaryArea', null);
81
+ const isComplementaryAreaVisible = registry.select(_preferences.store).get(scope, 'isComplementaryAreaVisible');
82
+
83
+ if (isComplementaryAreaVisible) {
84
+ registry.dispatch(_preferences.store).set(scope, 'isComplementaryAreaVisible', false);
85
+ }
54
86
  };
55
87
  /**
56
88
  * Pins an item.
@@ -124,9 +156,9 @@ function toggleFeature(scope, featureName) {
124
156
  let {
125
157
  registry
126
158
  } = _ref5;
127
- (0, _deprecated.default)(`wp.dispatch( 'core/interface' ).toggleFeature`, {
159
+ (0, _deprecated.default)(`dispatch( 'core/interface' ).toggleFeature`, {
128
160
  since: '6.0',
129
- alternative: `wp.dispatch( 'core/preferences' ).toggle`
161
+ alternative: `dispatch( 'core/preferences' ).toggle`
130
162
  });
131
163
  registry.dispatch(_preferences.store).toggle(scope, featureName);
132
164
  };
@@ -148,9 +180,9 @@ function setFeatureValue(scope, featureName, value) {
148
180
  let {
149
181
  registry
150
182
  } = _ref6;
151
- (0, _deprecated.default)(`wp.dispatch( 'core/interface' ).setFeatureValue`, {
183
+ (0, _deprecated.default)(`dispatch( 'core/interface' ).setFeatureValue`, {
152
184
  since: '6.0',
153
- alternative: `wp.dispatch( 'core/preferences' ).set`
185
+ alternative: `dispatch( 'core/preferences' ).set`
154
186
  });
155
187
  registry.dispatch(_preferences.store).set(scope, featureName, !!value);
156
188
  };
@@ -170,9 +202,9 @@ function setFeatureDefaults(scope, defaults) {
170
202
  let {
171
203
  registry
172
204
  } = _ref7;
173
- (0, _deprecated.default)(`wp.dispatch( 'core/interface' ).setFeatureDefaults`, {
205
+ (0, _deprecated.default)(`dispatch( 'core/interface' ).setFeatureDefaults`, {
174
206
  since: '6.0',
175
- alternative: `wp.dispatch( 'core/preferences' ).setDefaults`
207
+ alternative: `dispatch( 'core/preferences' ).setDefaults`
176
208
  });
177
209
  registry.dispatch(_preferences.store).setDefaults(scope, defaults);
178
210
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/actions.js"],"names":["enableComplementaryArea","scope","area","registry","dispatch","preferencesStore","set","disableComplementaryArea","pinItem","item","pinnedItems","select","get","unpinItem","toggleFeature","featureName","since","alternative","toggle","setFeatureValue","value","setFeatureDefaults","defaults","setDefaults"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,uBAAuB,GAAG,CAAEC,KAAF,EAASC,IAAT,KAAm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AAF,KAAe;AAChC,6BAAa,oDAAb,EAAkE;AACjEa,MAAAA,KAAK,EAAE,KAD0D;AAEjEC,MAAAA,WAAW,EAAG;AAFmD,KAAlE;AAKAd,IAAAA,QAAQ,CAACC,QAAT,CAAmBC,kBAAnB,EAAsCkB,WAAtC,CAAmDtB,KAAnD,EAA0DqB,QAA1D;AACA,GAPD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Enable the complementary area.\n *\n * @param {string} scope Complementary area scope.\n * @param {string} area Area identifier.\n */\nexport const enableComplementaryArea = ( scope, area ) => ( { registry } ) => {\n\t// Return early if there's no area.\n\tif ( ! area ) {\n\t\treturn;\n\t}\n\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( scope, 'complementaryArea', area );\n};\n\n/**\n * Disable the complementary area.\n *\n * @param {string} scope Complementary area scope.\n */\nexport const disableComplementaryArea = ( scope ) => ( { registry } ) => {\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( scope, 'complementaryArea', null );\n};\n\n/**\n * Pins an item.\n *\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n *\n * @return {Object} Action object.\n */\nexport const pinItem = ( scope, item ) => ( { registry } ) => {\n\t// Return early if there's no item.\n\tif ( ! item ) {\n\t\treturn;\n\t}\n\n\tconst pinnedItems = registry\n\t\t.select( preferencesStore )\n\t\t.get( scope, 'pinnedItems' );\n\n\t// The item is already pinned, there's nothing to do.\n\tif ( pinnedItems?.[ item ] === true ) {\n\t\treturn;\n\t}\n\n\tregistry.dispatch( preferencesStore ).set( scope, 'pinnedItems', {\n\t\t...pinnedItems,\n\t\t[ item ]: true,\n\t} );\n};\n\n/**\n * Unpins an item.\n *\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n */\nexport const unpinItem = ( scope, item ) => ( { registry } ) => {\n\t// Return early if there's no item.\n\tif ( ! item ) {\n\t\treturn;\n\t}\n\n\tconst pinnedItems = registry\n\t\t.select( preferencesStore )\n\t\t.get( scope, 'pinnedItems' );\n\n\tregistry.dispatch( preferencesStore ).set( scope, 'pinnedItems', {\n\t\t...pinnedItems,\n\t\t[ item ]: false,\n\t} );\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 ( { registry } ) {\n\t\tdeprecated( `wp.dispatch( 'core/interface' ).toggleFeature`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `wp.dispatch( 'core/preferences' ).toggle`,\n\t\t} );\n\n\t\tregistry.dispatch( preferencesStore ).toggle( scope, featureName );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a feature should be set to\n * a true or false value\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {string} featureName The feature name.\n * @param {boolean} value The value to set.\n *\n * @return {Object} Action object.\n */\nexport function setFeatureValue( scope, featureName, value ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `wp.dispatch( 'core/interface' ).setFeatureValue`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `wp.dispatch( 'core/preferences' ).set`,\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( scope, featureName, !! value );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that defaults should be set for features.\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {Object<string, boolean>} defaults A key/value map of feature names to values.\n *\n * @return {Object} Action object.\n */\nexport function setFeatureDefaults( scope, defaults ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `wp.dispatch( 'core/interface' ).setFeatureDefaults`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `wp.dispatch( 'core/preferences' ).setDefaults`,\n\t\t} );\n\n\t\tregistry.dispatch( preferencesStore ).setDefaults( scope, defaults );\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/store/actions.js"],"names":["setDefaultComplementaryArea","scope","area","type","enableComplementaryArea","registry","dispatch","isComplementaryAreaVisible","select","preferencesStore","get","set","disableComplementaryArea","pinItem","item","pinnedItems","unpinItem","toggleFeature","featureName","since","alternative","toggle","setFeatureValue","value","setFeatureDefaults","defaults","setDefaults"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,2BAA2B,GAAG,CAAEC,KAAF,EAASC,IAAT,MAAqB;AAC/DC,EAAAA,IAAI,EAAE,gCADyD;AAE/DF,EAAAA,KAF+D;AAG/DC,EAAAA;AAH+D,CAArB,CAApC;AAMP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAME,uBAAuB,GACnC,CAAEH,KAAF,EAASC,IAAT,KACA,QAA8B;AAAA,MAA5B;AAAEG,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAA4B;;AAC7B;AACA,MAAK,CAAEJ,IAAP,EAAc;AACb;AACA;;AAED,QAAMK,0BAA0B,GAAGF,QAAQ,CACzCG,MADiC,CACzBC,kBADyB,EAEjCC,GAFiC,CAE5BT,KAF4B,EAErB,4BAFqB,CAAnC;;AAIA,MAAK,CAAEM,0BAAP,EAAoC;AACnCF,IAAAA,QAAQ,CACNC,QADF,CACYG,kBADZ,EAEEE,GAFF,CAEOV,KAFP,EAEc,4BAFd,EAE4C,IAF5C;AAGA;;AAEDK,EAAAA,QAAQ,CAAE;AACTH,IAAAA,IAAI,EAAE,2BADG;AAETF,IAAAA,KAFS;AAGTC,IAAAA;AAHS,GAAF,CAAR;AAKA,CAvBK;AAyBP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMU,wBAAwB,GAClCX,KAAF,IACA,SAAoB;AAAA,MAAlB;AAAEI,IAAAA;AAAF,GAAkB;AACnB,QAAME,0BAA0B,GAAGF,QAAQ,CACzCG,MADiC,CACzBC,kBADyB,EAEjCC,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precated from '@wordpress/deprecated';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Set a default complementary area.\n *\n * @param {string} scope Complementary area scope.\n * @param {string} area Area identifier.\n *\n * @return {Object} Action object.\n */\nexport const setDefaultComplementaryArea = ( scope, area ) => ( {\n\ttype: 'SET_DEFAULT_COMPLEMENTARY_AREA',\n\tscope,\n\tarea,\n} );\n\n/**\n * Enable the complementary area.\n *\n * @param {string} scope Complementary area scope.\n * @param {string} area Area identifier.\n */\nexport const enableComplementaryArea =\n\t( scope, area ) =>\n\t( { registry, dispatch } ) => {\n\t\t// Return early if there's no area.\n\t\tif ( ! area ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isComplementaryAreaVisible = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'isComplementaryAreaVisible' );\n\n\t\tif ( ! isComplementaryAreaVisible ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( scope, 'isComplementaryAreaVisible', true );\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'ENABLE_COMPLEMENTARY_AREA',\n\t\t\tscope,\n\t\t\tarea,\n\t\t} );\n\t};\n\n/**\n * Disable the complementary area.\n *\n * @param {string} scope Complementary area scope.\n */\nexport const disableComplementaryArea =\n\t( scope ) =>\n\t( { registry } ) => {\n\t\tconst isComplementaryAreaVisible = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'isComplementaryAreaVisible' );\n\n\t\tif ( isComplementaryAreaVisible ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( scope, 'isComplementaryAreaVisible', false );\n\t\t}\n\t};\n\n/**\n * Pins an item.\n *\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n *\n * @return {Object} Action object.\n */\nexport const pinItem =\n\t( scope, item ) =>\n\t( { registry } ) => {\n\t\t// Return early if there's no item.\n\t\tif ( ! item ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst pinnedItems = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'pinnedItems' );\n\n\t\t// The item is already pinned, there's nothing to do.\n\t\tif ( pinnedItems?.[ item ] === true ) {\n\t\t\treturn;\n\t\t}\n\n\t\tregistry.dispatch( preferencesStore ).set( scope, 'pinnedItems', {\n\t\t\t...pinnedItems,\n\t\t\t[ item ]: true,\n\t\t} );\n\t};\n\n/**\n * Unpins an item.\n *\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n */\nexport const unpinItem =\n\t( scope, item ) =>\n\t( { registry } ) => {\n\t\t// Return early if there's no item.\n\t\tif ( ! item ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst pinnedItems = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'pinnedItems' );\n\n\t\tregistry.dispatch( preferencesStore ).set( scope, 'pinnedItems', {\n\t\t\t...pinnedItems,\n\t\t\t[ item ]: false,\n\t\t} );\n\t};\n\n/**\n * Returns an action object used in signalling that a feature should be toggled.\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {string} featureName The feature name.\n */\nexport function toggleFeature( scope, featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `dispatch( 'core/interface' ).toggleFeature`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `dispatch( 'core/preferences' ).toggle`,\n\t\t} );\n\n\t\tregistry.dispatch( preferencesStore ).toggle( scope, featureName );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a feature should be set to\n * a true or false value\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {string} featureName The feature name.\n * @param {boolean} value The value to set.\n *\n * @return {Object} Action object.\n */\nexport function setFeatureValue( scope, featureName, value ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `dispatch( 'core/interface' ).setFeatureValue`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `dispatch( 'core/preferences' ).set`,\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( scope, featureName, !! value );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that defaults should be set for features.\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {Object<string, boolean>} defaults A key/value map of feature names to values.\n *\n * @return {Object} Action object.\n */\nexport function setFeatureDefaults( scope, defaults ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `dispatch( 'core/interface' ).setFeatureDefaults`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `dispatch( 'core/preferences' ).setDefaults`,\n\t\t} );\n\n\t\tregistry.dispatch( preferencesStore ).setDefaults( scope, defaults );\n\t};\n}\n"]}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -11,6 +13,8 @@ var actions = _interopRequireWildcard(require("./actions"));
11
13
 
12
14
  var selectors = _interopRequireWildcard(require("./selectors"));
13
15
 
16
+ var _reducer = _interopRequireDefault(require("./reducer"));
17
+
14
18
  var _constants = require("./constants");
15
19
 
16
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); }
@@ -33,7 +37,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
33
37
  * @type {Object}
34
38
  */
35
39
  const store = (0, _data.createReduxStore)(_constants.STORE_NAME, {
36
- reducer: () => {},
40
+ reducer: _reducer.default,
37
41
  actions,
38
42
  selectors
39
43
  }); // Once we build a more generic persistence plugin that works across types of stores
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/index.js"],"names":["store","STORE_NAME","reducer","actions","selectors"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;;;;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8B;AAClDC,EAAAA,OAAO,EAAE,MAAM,CAAE,CADiC;AAElDC,EAAAA,OAFkD;AAGlDC,EAAAA;AAHkD,CAA9B,CAAd,C,CAMP;AACA;;;AACA,oBAAUJ,KAAV","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\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} );\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.\nregister( store );\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/store/index.js"],"names":["store","STORE_NAME","reducer","actions","selectors"],"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;AAHkD,CAA9B,CAAd,C,CAMP;AACA;;;AACA,oBAAUJ,KAAV","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport reducer from './reducer';\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} );\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.\nregister( store );\n"]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.complementaryAreas = complementaryAreas;
7
+ exports.default = void 0;
8
+
9
+ var _data = require("@wordpress/data");
10
+
11
+ /**
12
+ * WordPress dependencies
13
+ */
14
+ function complementaryAreas() {
15
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16
+ let action = arguments.length > 1 ? arguments[1] : undefined;
17
+
18
+ switch (action.type) {
19
+ case 'SET_DEFAULT_COMPLEMENTARY_AREA':
20
+ {
21
+ const {
22
+ scope,
23
+ area
24
+ } = action; // If there's already an area, don't overwrite it.
25
+
26
+ if (state[scope]) {
27
+ return state;
28
+ }
29
+
30
+ return { ...state,
31
+ [scope]: area
32
+ };
33
+ }
34
+
35
+ case 'ENABLE_COMPLEMENTARY_AREA':
36
+ {
37
+ const {
38
+ scope,
39
+ area
40
+ } = action;
41
+ return { ...state,
42
+ [scope]: area
43
+ };
44
+ }
45
+ }
46
+
47
+ return state;
48
+ }
49
+
50
+ var _default = (0, _data.combineReducers)({
51
+ complementaryAreas
52
+ });
53
+
54
+ exports.default = _default;
55
+ //# sourceMappingURL=reducer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/interface/src/store/reducer.js"],"names":["complementaryAreas","state","action","type","scope","area"],"mappings":";;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,SAASA,kBAAT,GAAkD;AAAA,MAArBC,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AACxD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,gCAAL;AAAuC;AACtC,cAAM;AAAEC,UAAAA,KAAF;AAASC,UAAAA;AAAT,YAAkBH,MAAxB,CADsC,CAGtC;;AACA,YAAKD,KAAK,CAAEG,KAAF,CAAV,EAAsB;AACrB,iBAAOH,KAAP;AACA;;AAED,eAAO,EACN,GAAGA,KADG;AAEN,WAAEG,KAAF,GAAWC;AAFL,SAAP;AAIA;;AACD,SAAK,2BAAL;AAAkC;AACjC,cAAM;AAAED,UAAAA,KAAF;AAASC,UAAAA;AAAT,YAAkBH,MAAxB;AACA,eAAO,EACN,GAAGD,KADG;AAEN,WAAEG,KAAF,GAAWC;AAFL,SAAP;AAIA;AApBF;;AAuBA,SAAOJ,KAAP;AACA;;eAEc,2BAAiB;AAC/BD,EAAAA;AAD+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\nexport function complementaryAreas( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_DEFAULT_COMPLEMENTARY_AREA': {\n\t\t\tconst { scope, area } = action;\n\n\t\t\t// If there's already an area, don't overwrite it.\n\t\t\tif ( state[ scope ] ) {\n\t\t\t\treturn state;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: area,\n\t\t\t};\n\t\t}\n\t\tcase 'ENABLE_COMPLEMENTARY_AREA': {\n\t\t\tconst { scope, area } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: area,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tcomplementaryAreas,\n} );\n"]}
@@ -23,10 +23,25 @@ var _preferences = require("@wordpress/preferences");
23
23
  * @param {Object} state Global application state.
24
24
  * @param {string} scope Item scope.
25
25
  *
26
- * @return {string} The complementary area that is active in the given scope.
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
- return select(_preferences.store).get(scope, 'complementaryArea');
29
+ var _state$complementaryA;
30
+
31
+ const isComplementaryAreaVisible = select(_preferences.store).get(scope, 'isComplementaryAreaVisible'); // Return `undefined` to indicate that the user has never toggled
32
+ // visibility, this is the vanilla default. Other code relies on this
33
+ // nuance in the return value.
34
+
35
+ if (isComplementaryAreaVisible === undefined) {
36
+ return undefined;
37
+ } // Return `null` to indicate the user hid the complementary area.
38
+
39
+
40
+ if (!isComplementaryAreaVisible) {
41
+ return null;
42
+ }
43
+
44
+ return state === null || state === void 0 ? void 0 : (_state$complementaryA = state.complementaryAreas) === null || _state$complementaryA === void 0 ? void 0 : _state$complementaryA[scope];
30
45
  });
31
46
  /**
32
47
  * Returns a boolean indicating if an item is pinned or not.
@@ -58,9 +73,9 @@ const isItemPinned = (0, _data.createRegistrySelector)(select => (state, scope,
58
73
 
59
74
  exports.isItemPinned = isItemPinned;
60
75
  const isFeatureActive = (0, _data.createRegistrySelector)(select => (state, scope, featureName) => {
61
- (0, _deprecated.default)(`wp.select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
76
+ (0, _deprecated.default)(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
62
77
  since: '6.0',
63
- alternative: `!! wp.select( 'core/preferences' ).isFeatureActive( scope, featureName )`
78
+ alternative: `select( 'core/preferences' ).get( scope, featureName )`
64
79
  });
65
80
  return !!select(_preferences.store).get(scope, featureName);
66
81
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/selectors.js"],"names":["getActiveComplementaryArea","select","state","scope","preferencesStore","get","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,SAAOF,MAAM,CAAEG,kBAAF,CAAN,CAA2BC,GAA3B,CAAgCF,KAAhC,EAAuC,mBAAvC,CAAP;AACA,CAHwC,CAAnC;AAMP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMG,YAAY,GAAG,kCACzBL,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBI,IAAhB,KAA0B;AAAA;;AACvC,QAAMC,WAAW,GAAGP,MAAM,CAAEG,kBAAF,CAAN,CAA2BC,GAA3B,CACnBF,KADmB,EAEnB,aAFmB,CAApB;AAIA,8BAAOK,WAAP,aAAOA,WAAP,uBAAOA,WAAW,CAAID,IAAJ,CAAlB,iEAAgC,IAAhC;AACA,CAP0B,CAArB;AAUP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,eAAe,GAAG,kCAC5BR,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBO,WAAhB,KAAiC;AAC9C,2BACE,qEADF,EAEC;AACCC,IAAAA,KAAK,EAAE,KADR;AAECC,IAAAA,WAAW,EAAG;AAFf,GAFD;AAQA,SAAO,CAAC,CAAEX,MAAM,CAAEG,kBAAF,CAAN,CAA2BC,GAA3B,CAAgCF,KAAhC,EAAuCO,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} The complementary area that is active in the given scope.\n */\nexport const getActiveComplementaryArea = createRegistrySelector(\n\t( select ) => ( state, scope ) => {\n\t\treturn select( preferencesStore ).get( scope, 'complementaryArea' );\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`wp.select( 'core/interface' ).isFeatureActive( scope, featureName )`,\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative: `!! wp.select( 'core/preferences' ).isFeatureActive( scope, featureName )`,\n\t\t\t}\n\t\t);\n\n\t\treturn !! select( preferencesStore ).get( scope, featureName );\n\t}\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/store/selectors.js"],"names":["getActiveComplementaryArea","select","state","scope","isComplementaryAreaVisible","preferencesStore","get","undefined","complementaryAreas","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;AAAA;;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,MAAK,CAAEH,0BAAP,EAAoC;AACnC,WAAO,IAAP;AACA;;AAED,SAAOF,KAAP,aAAOA,KAAP,gDAAOA,KAAK,CAAEM,kBAAd,0DAAO,sBAA6BL,KAA7B,CAAP;AACA,CApBwC,CAAnC;AAuBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMM,YAAY,GAAG,kCACzBR,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBO,IAAhB,KAA0B;AAAA;;AACvC,QAAMC,WAAW,GAAGV,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CACnBH,KADmB,EAEnB,aAFmB,CAApB;AAIA,8BAAOQ,WAAP,aAAOA,WAAP,uBAAOA,WAAW,CAAID,IAAJ,CAAlB,iEAAgC,IAAhC;AACA,CAP0B,CAArB;AAUP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,eAAe,GAAG,kCAC5BX,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBU,WAAhB,KAAiC;AAC9C,2BACE,kEADF,EAEC;AACCC,IAAAA,KAAK,EAAE,KADR;AAECC,IAAAA,WAAW,EAAG;AAFf,GAFD;AAQA,SAAO,CAAC,CAAEd,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CAAgCH,KAAhC,EAAuCU,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 ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn state?.complementaryAreas?.[ scope ];\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"]}
@@ -4,7 +4,7 @@ import { createElement } from "@wordpress/element";
4
4
  /**
5
5
  * External dependencies
6
6
  */
7
- import { isEmpty, noop } from 'lodash';
7
+ import { isEmpty } from 'lodash';
8
8
  /**
9
9
  * WordPress dependencies
10
10
  */
@@ -12,6 +12,8 @@ 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
+ const noop = () => {};
16
+
15
17
  function ActionItemSlot(_ref) {
16
18
  let {
17
19
  name,
@@ -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","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"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/components/action-item/index.js"],"names":["isEmpty","ButtonGroup","Button","Slot","Fill","Children","noop","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,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,MAAtB,EAA8BC,IAA9B,EAAoCC,IAApC,QAAgD,uBAAhD;AACA,SAASC,QAAT,QAAyB,oBAAzB;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,cAAT,OAMI;AAAA,MANqB;AACxBC,IAAAA,IADwB;AAExBC,IAAAA,EAAE,EAAEC,SAAS,GAAGT,WAFQ;AAGxBU,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,CAAEK,QAAQ,CAACU,OAAT,CAAkBD,KAAlB,CAAF,CAAZ,EAA4C;AAC3C,aAAO,IAAP;AACA,KAHa,CAKd;AACA;AACA;AACA;AACA;;;AACA,UAAME,oBAAoB,GAAG,EAA7B;AACAX,IAAAA,QAAQ,CAACY,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,GAAGhB,QAAQ,CAACiB,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,GAAGR,MAAxB;AAAgCwB,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,IAAIpB,IAAb,EAAqB,YAArB;AACA,SAAEqB,SAAS,IAAIrB,IAAf,EAAuB,YAAvB;AACC,OAJJ,GAKGsB;AAPL,OASMf,KATN,EADD;AAaA,GAfF,CADD;AAmBA;;AAEDY,UAAU,CAACtB,IAAX,GAAkBI,cAAlB;AAEA,eAAekB,UAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n\n/**\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 ( 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 +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,qBAAv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AzB,EACCnC,KADD,EAECM,UAFD,CAXF;AAgBC,IAAA,SAAS,EAAGsB,QAhBb;AAiBC,qBAAgBA;AAjBjB,IAHF,CAbF,CAPD,EA8CC,cAAC,KAAD;AAAO,IAAA,SAAS,EAAGP;AAAnB,KAAsClB,QAAtC,CA9CD,CA7BF,CADD;AAiFA;;AAED,MAAMqC,wBAAwB,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"]}
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,SAAS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H1B;AAKC,IAAA,KAAK,EACJyC,QAAQ,GACL3C,EAAE,CAAE,oBAAF,CADG,GAELA,EAAE,CAAE,gBAAF,CARP;AAUC,IAAA,OAAO,EAAG,MACT,CAAE2C,QAAQ,GAAGQ,SAAH,GAAeD,OAAzB,EACCnC,KADD,EAECM,UAFD,CAXF;AAgBC,IAAA,SAAS,EAAGsB,QAhBb;AAiBC,qBAAgBA;AAjBjB,IAHF,CAbF,CAPD,EA8CC,cAAC,KAAD;AAAO,IAAA,SAAS,EAAGP;AAAnB,KAAsClB,QAAtC,CA9CD,CA7BF,CADD;AAiFA;;AAED,MAAMqC,wBAAwB,GAC7B5C,4BAA4B,CAAEmB,iBAAF,CAD7B;AAGAyB,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 } =\n\t\tuseDispatch( interfaceStore );\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 } =\n\t\t\t\tselect( interfaceStore );\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 =\n\twithComplementaryAreaContext( ComplementaryArea );\n\nComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;\n\nexport default ComplementaryAreaWrapped;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"names":["omit","Button","useDispatch","useSelect","store","interfaceStore","complementaryAreaContext","ComplementaryAreaToggle","as","scope","identifier","icon","selectedIcon","props","ComponentToUse","isSelected","select","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,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,OAOI;AAAA,MAP8B;AACjCC,IAAAA,EAAE,GAAGP,MAD4B;AAEjCQ,IAAAA,KAFiC;AAGjCC,IAAAA,UAHiC;AAIjCC,IAAAA,IAJiC;AAKjCC,IAAAA,YALiC;AAMjC,OAAGC;AAN8B,GAO9B;AACH,QAAMC,cAAc,GAAGN,EAAvB;AACA,QAAMO,UAAU,GAAGZ,SAAS,CACzBa,MAAF,IACCA,MAAM,CAAEX,cAAF,CAAN,CAAyBY,0BAAzB,CAAqDR,KAArD,MACAC,UAH0B,EAI3B,CAAEA,UAAF,CAJ2B,CAA5B;AAMA,QAAM;AAAEQ,IAAAA,uBAAF;AAA2BC,IAAAA;AAA3B,MAAwDjB,WAAW,CACxEG,cADwE,CAAzE;AAGA,SACC,cAAC,cAAD;AACC,IAAA,IAAI,EAAGO,YAAY,IAAIG,UAAhB,GAA6BH,YAA7B,GAA4CD,IADpD;AAEC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKI,UAAL,EAAkB;AACjBI,QAAAA,wBAAwB,CAAEV,KAAF,CAAxB;AACA,OAFD,MAEO;AACNS,QAAAA,uBAAuB,CAAET,KAAF,EAASC,UAAT,CAAvB;AACA;AACD;AARF,KASMV,IAAI,CAAEa,KAAF,EAAS,CAAE,MAAF,CAAT,CATV,EADD;AAaA;;AAED,eAAeP,wBAAwB,CAAEC,uBAAF,CAAvC","sourcesContent":["/**\n * External dependencies\n */\nimport { omit } from 'lodash';\n\n/**\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\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 } = useDispatch(\n\t\tinterfaceStore\n\t);\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{ ...omit( props, [ 'name' ] ) }\n\t\t/>\n\t);\n}\n\nexport default complementaryAreaContext( ComplementaryAreaToggle );\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"names":["omit","Button","useDispatch","useSelect","store","interfaceStore","complementaryAreaContext","ComplementaryAreaToggle","as","scope","identifier","icon","selectedIcon","props","ComponentToUse","isSelected","select","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,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,OAOI;AAAA,MAP8B;AACjCC,IAAAA,EAAE,GAAGP,MAD4B;AAEjCQ,IAAAA,KAFiC;AAGjCC,IAAAA,UAHiC;AAIjCC,IAAAA,IAJiC;AAKjCC,IAAAA,YALiC;AAMjC,OAAGC;AAN8B,GAO9B;AACH,QAAMC,cAAc,GAAGN,EAAvB;AACA,QAAMO,UAAU,GAAGZ,SAAS,CACzBa,MAAF,IACCA,MAAM,CAAEX,cAAF,CAAN,CAAyBY,0BAAzB,CAAqDR,KAArD,MACAC,UAH0B,EAI3B,CAAEA,UAAF,CAJ2B,CAA5B;AAMA,QAAM;AAAEQ,IAAAA,uBAAF;AAA2BC,IAAAA;AAA3B,MACLjB,WAAW,CAAEG,cAAF,CADZ;AAEA,SACC,cAAC,cAAD;AACC,IAAA,IAAI,EAAGO,YAAY,IAAIG,UAAhB,GAA6BH,YAA7B,GAA4CD,IADpD;AAEC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKI,UAAL,EAAkB;AACjBI,QAAAA,wBAAwB,CAAEV,KAAF,CAAxB;AACA,OAFD,MAEO;AACNS,QAAAA,uBAAuB,CAAET,KAAF,EAASC,UAAT,CAAvB;AACA;AACD;AARF,KASMV,IAAI,CAAEa,KAAF,EAAS,CAAE,MAAF,CAAT,CATV,EADD;AAaA;;AAED,eAAeP,wBAAwB,CAAEC,uBAAF,CAAvC","sourcesContent":["/**\n * External dependencies\n */\nimport { omit } from 'lodash';\n\n/**\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\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{ ...omit( props, [ 'name' ] ) }\n\t\t/>\n\t);\n}\n\nexport default complementaryAreaContext( ComplementaryAreaToggle );\n"]}