@wordpress/edit-widgets 5.25.0 → 5.26.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 (50) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/build/blocks/widget-area/index.js +1 -0
  4. package/build/blocks/widget-area/index.js.map +1 -1
  5. package/build/components/header/document-tools/index.js +12 -16
  6. package/build/components/header/document-tools/index.js.map +1 -1
  7. package/build/components/header/index.js +2 -6
  8. package/build/components/header/index.js.map +1 -1
  9. package/build/components/layout/interface.js +2 -7
  10. package/build/components/layout/interface.js.map +1 -1
  11. package/build/components/secondary-sidebar/index.js +2 -6
  12. package/build/components/secondary-sidebar/index.js.map +1 -1
  13. package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
  14. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  15. package/build/store/index.js +3 -0
  16. package/build/store/index.js.map +1 -1
  17. package/build/store/private-selectors.js +10 -0
  18. package/build/store/private-selectors.js.map +1 -0
  19. package/build/store/reducer.js +14 -0
  20. package/build/store/reducer.js.map +1 -1
  21. package/build-module/blocks/widget-area/index.js +1 -0
  22. package/build-module/blocks/widget-area/index.js.map +1 -1
  23. package/build-module/components/header/document-tools/index.js +12 -16
  24. package/build-module/components/header/document-tools/index.js.map +1 -1
  25. package/build-module/components/header/index.js +2 -6
  26. package/build-module/components/header/index.js.map +1 -1
  27. package/build-module/components/layout/interface.js +3 -8
  28. package/build-module/components/layout/interface.js.map +1 -1
  29. package/build-module/components/secondary-sidebar/index.js +2 -6
  30. package/build-module/components/secondary-sidebar/index.js.map +1 -1
  31. package/build-module/components/secondary-sidebar/list-view-sidebar.js +8 -6
  32. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  33. package/build-module/store/index.js +3 -0
  34. package/build-module/store/index.js.map +1 -1
  35. package/build-module/store/private-selectors.js +4 -0
  36. package/build-module/store/private-selectors.js.map +1 -0
  37. package/build-module/store/reducer.js +13 -0
  38. package/build-module/store/reducer.js.map +1 -1
  39. package/build-style/style-rtl.css +4 -0
  40. package/build-style/style.css +4 -0
  41. package/package.json +30 -29
  42. package/src/blocks/widget-area/block.json +1 -0
  43. package/src/components/header/document-tools/index.js +16 -21
  44. package/src/components/header/index.js +2 -4
  45. package/src/components/layout/interface.js +3 -14
  46. package/src/components/secondary-sidebar/index.js +2 -4
  47. package/src/components/secondary-sidebar/list-view-sidebar.js +6 -4
  48. package/src/store/index.js +4 -0
  49. package/src/store/private-selectors.js +3 -0
  50. package/src/store/reducer.js +11 -0
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","__","_x","Button","ToolbarItem","NavigableToolbar","store","blockEditorStore","privateApis","blockEditorPrivateApis","listView","plus","useCallback","useRef","useViewportMatch","UndoButton","RedoButton","useLastSelectedWidgetArea","editWidgetsStore","unlock","useShouldContextualToolbarShow","DocumentTools","setListViewToggleElement","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","handleClick","window","requestAnimationFrame","toggleListView","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","createElement","className","shouldUseKeyboardFocusShortcut","ref","as","variant","isPressed","onMouseDown","event","preventDefault","onClick","icon","label","Fragment"],"sources":["@wordpress/edit-widgets/src/components/header/document-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport UndoButton from '../undo-redo/undo';\nimport RedoButton from '../undo-redo/redo';\nimport useLastSelectedWidgetArea from '../../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nfunction DocumentTools( { setListViewToggleElement } ) {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\tconst inserterButton = useRef();\n\tconst widgetAreaClientId = useLastSelectedWidgetArea();\n\tconst isLastSelectedWidgetAreaOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen(\n\t\t\t\twidgetAreaClientId\n\t\t\t),\n\t\t[ widgetAreaClientId ]\n\t);\n\tconst { isInserterOpen, isListViewOpen } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst handleClick = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tif ( ! isLastSelectedWidgetAreaOpen ) {\n\t\t\t\t// Select the last selected block if hasn't already.\n\t\t\t\tselectBlock( widgetAreaClientId );\n\t\t\t\t// Open the last selected widget area when opening the inserter.\n\t\t\t\tsetIsWidgetAreaOpen( widgetAreaClientId, true );\n\t\t\t}\n\t\t\t// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the\n\t\t\t// same tick and pretty much in a random order. The inserter is closed if any other part of the\n\t\t\t// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then\n\t\t\t// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to\n\t\t\t// the selected block.\n\t\t\twindow.requestAnimationFrame( () => setIsInserterOpened( true ) );\n\t\t}\n\t};\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t>\n\t\t\t<ToolbarItem\n\t\t\t\tref={ inserterButton }\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t} }\n\t\t\t\tonClick={ handleClick }\n\t\t\t\ticon={ plus }\n\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\tlabel={ _x(\n\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t{ isMediumViewport && (\n\t\t\t\t<>\n\t\t\t\t\t<UndoButton />\n\t\t\t\t\t<RedoButton />\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\tref={ setListViewToggleElement }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,MAAM,EAAEC,WAAW,QAAQ,uBAAuB;AAC3D,SACCC,gBAAgB,EAChBC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,QAAQ,EAAEC,IAAI,QAAQ,kBAAkB;AACjD,SAASC,WAAW,EAAEC,MAAM,QAAQ,oBAAoB;AACxD,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,yBAAyB,MAAM,8CAA8C;AACpF,SAASX,KAAK,IAAIY,gBAAgB,QAAQ,gBAAgB;AAC1D,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,MAAM;EAAEC;AAA+B,CAAC,GAAGD,MAAM,CAAEV,sBAAuB,CAAC;AAE3E,SAASY,aAAaA,CAAE;EAAEC;AAAyB,CAAC,EAAG;EACtD,MAAMC,gBAAgB,GAAGT,gBAAgB,CAAE,QAAS,CAAC;EACrD,MAAMU,cAAc,GAAGX,MAAM,CAAC,CAAC;EAC/B,MAAMY,kBAAkB,GAAGR,yBAAyB,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AAwB,GAC7BH,2BAA2B,IAC3BC,qBAAqB,IACrBC,wBAAwB;EAEzB,OACCE,aAAA,CAACxC,gBAAgB;IAChByC,SAAS,EAAC,6BAA6B;IACvC,cAAa7C,EAAE,CAAE,gBAAiB,CAAG;IACrC8C,8BAA8B,EAAG,CAAEH;EAA0B,GAE7DC,aAAA,CAACzC,WAAW;IACX4C,GAAG,EAAGxB,cAAgB;IACtByB,EAAE,EAAG9C,MAAQ;IACb2C,SAAS,EAAC,8CAA8C;IACxDI,OAAO,EAAC,SAAS;IACjBC,SAAS,EAAGtB,cAAgB;IAC5BuB,WAAW,EAAKC,KAAK,IAAM;MAC1BA,KAAK,CAACC,cAAc,CAAC,CAAC;IACvB,CAAG;IACHC,OAAO,EAAGlB,WAAa;IACvBmB,IAAI,EAAG7C;IACP;AACJ,mBADI;IAEA8C,KAAK,EAAGvD,EAAE,CACT,uBAAuB,EACvB,yCACD;EAAG,CACH,CAAC,EACAqB,gBAAgB,IACjBsB,aAAA,CAAAa,QAAA,QACCb,aAAA,CAAC9B,UAAU,MAAE,CAAC,EACd8B,aAAA,CAAC7B,UAAU,MAAE,CAAC,EACd6B,aAAA,CAACzC,WAAW;IACX6C,EAAE,EAAG9C,MAAQ;IACb2C,SAAS,EAAC,+CAA+C;IACzDU,IAAI,EAAG9C,QAAU;IACjByC,SAAS,EAAGrB;IACZ;IACA2B,KAAK,EAAGxD,EAAE,CAAE,WAAY,CAAG;IAC3BsD,OAAO,EAAGf,cAAgB;IAC1BQ,GAAG,EAAG1B;EAA0B,CAChC,CACA,CAEc,CAAC;AAErB;AAEA,eAAeD,aAAa"}
1
+ {"version":3,"names":["useSelect","useDispatch","__","_x","Button","ToolbarItem","NavigableToolbar","store","blockEditorStore","privateApis","blockEditorPrivateApis","listView","plus","useCallback","useRef","useViewportMatch","UndoButton","RedoButton","useLastSelectedWidgetArea","editWidgetsStore","unlock","useCanBlockToolbarBeFocused","DocumentTools","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","listViewToggleRef","isInserterOpened","isListViewOpened","getListViewToggleRef","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","handleClick","window","requestAnimationFrame","toggleListView","blockToolbarCanBeFocused","createElement","className","shouldUseKeyboardFocusShortcut","ref","as","variant","isPressed","onMouseDown","event","preventDefault","onClick","icon","label","Fragment"],"sources":["@wordpress/edit-widgets/src/components/header/document-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport UndoButton from '../undo-redo/undo';\nimport RedoButton from '../undo-redo/redo';\nimport useLastSelectedWidgetArea from '../../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useCanBlockToolbarBeFocused } = unlock( blockEditorPrivateApis );\n\nfunction DocumentTools() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\tconst inserterButton = useRef();\n\tconst widgetAreaClientId = useLastSelectedWidgetArea();\n\tconst isLastSelectedWidgetAreaOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen(\n\t\t\t\twidgetAreaClientId\n\t\t\t),\n\t\t[ widgetAreaClientId ]\n\t);\n\tconst { isInserterOpen, isListViewOpen, listViewToggleRef } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isInserterOpened, isListViewOpened, getListViewToggleRef } =\n\t\t\t\tunlock( select( editWidgetsStore ) );\n\t\t\treturn {\n\t\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst handleClick = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tif ( ! isLastSelectedWidgetAreaOpen ) {\n\t\t\t\t// Select the last selected block if hasn't already.\n\t\t\t\tselectBlock( widgetAreaClientId );\n\t\t\t\t// Open the last selected widget area when opening the inserter.\n\t\t\t\tsetIsWidgetAreaOpen( widgetAreaClientId, true );\n\t\t\t}\n\t\t\t// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the\n\t\t\t// same tick and pretty much in a random order. The inserter is closed if any other part of the\n\t\t\t// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then\n\t\t\t// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to\n\t\t\t// the selected block.\n\t\t\twindow.requestAnimationFrame( () => setIsInserterOpened( true ) );\n\t\t}\n\t};\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\tconst blockToolbarCanBeFocused = useCanBlockToolbarBeFocused();\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t>\n\t\t\t<ToolbarItem\n\t\t\t\tref={ inserterButton }\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t} }\n\t\t\t\tonClick={ handleClick }\n\t\t\t\ticon={ plus }\n\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\tlabel={ _x(\n\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t{ isMediumViewport && (\n\t\t\t\t<>\n\t\t\t\t\t<UndoButton />\n\t\t\t\t\t<RedoButton />\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,MAAM,EAAEC,WAAW,QAAQ,uBAAuB;AAC3D,SACCC,gBAAgB,EAChBC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,QAAQ,EAAEC,IAAI,QAAQ,kBAAkB;AACjD,SAASC,WAAW,EAAEC,MAAM,QAAQ,oBAAoB;AACxD,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA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AAS,EAAGpB;IACZ;IACA0B,KAAK,EAAGtD,EAAE,CAAE,WAAY,CAAG;IAC3BoD,OAAO,EAAGZ,cAAgB;IAC1BK,GAAG,EAAGhB;EAAmB,CACzB,CACA,CAEc,CAAC;AAErB;AAEA,eAAeT,aAAa"}
@@ -17,9 +17,7 @@ import { store as preferencesStore } from '@wordpress/preferences';
17
17
  import DocumentTools from './document-tools';
18
18
  import SaveButton from '../save-button';
19
19
  import MoreMenu from '../more-menu';
20
- function Header({
21
- setListViewToggleElement
22
- }) {
20
+ function Header() {
23
21
  const isLargeViewport = useViewportMatch('medium');
24
22
  const blockToolbarRef = useRef();
25
23
  const {
@@ -36,9 +34,7 @@ function Header({
36
34
  }, __('Widgets')), !isLargeViewport && createElement(VisuallyHidden, {
37
35
  as: "h1",
38
36
  className: "edit-widgets-header__title"
39
- }, __('Widgets')), createElement(DocumentTools, {
40
- setListViewToggleElement: setListViewToggleElement
41
- }), hasFixedToolbar && isLargeViewport && createElement(Fragment, null, createElement("div", {
37
+ }, __('Widgets')), createElement(DocumentTools, null), hasFixedToolbar && isLargeViewport && createElement(Fragment, null, createElement("div", {
42
38
  className: "selected-block-tools-wrapper"
43
39
  }, createElement(BlockToolbar, {
44
40
  hideDragHandle: true
@@ -1 +1 @@
1
- {"version":3,"names":["BlockToolbar","useSelect","useRef","__","Popover","VisuallyHidden","PinnedItems","useViewportMatch","store","preferencesStore","DocumentTools","SaveButton","MoreMenu","Header","setListViewToggleElement","isLargeViewport","blockToolbarRef","hasFixedToolbar","select","get","createElement","Fragment","className","as","hideDragHandle","Slot","ref","name","scope"],"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockToolbar } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Popover, VisuallyHidden } from '@wordpress/components';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport DocumentTools from './document-tools';\nimport SaveButton from '../save-button';\nimport MoreMenu from '../more-menu';\n\nfunction Header( { setListViewToggleElement } ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst blockToolbarRef = useRef();\n\tconst { hasFixedToolbar } = useSelect(\n\t\t( select ) => ( {\n\t\t\thasFixedToolbar: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-header\">\n\t\t\t\t<div className=\"edit-widgets-header__navigable-toolbar-wrapper\">\n\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t<h1 className=\"edit-widgets-header__title\">\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isLargeViewport && (\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) }\n\t\t\t\t\t<DocumentTools\n\t\t\t\t\t\tsetListViewToggleElement={ setListViewToggleElement }\n\t\t\t\t\t/>\n\t\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"selected-block-tools-wrapper\">\n\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-widgets-header__actions\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Header;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,yBAAyB;AACtD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,EAAEC,cAAc,QAAQ,uBAAuB;AAC/D,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,UAAU,MAAM,gBAAgB;AACvC,OAAOC,QAAQ,MAAM,cAAc;AAEnC,SAASC,MAAMA,CAAE;EAAEC;AAAyB,CAAC,EAAG;EAC/C,MAAMC,eAAe,GAAGR,gBAAgB,CAAE,QAAS,CAAC;EACpD,MAAMS,eAAe,GAAGd,MAAM,CAAC,CAAC;EAChC,MAAM;IAAEe;EAAgB,CAAC,GAAGhB,SAAS,CAClCiB,MAAM,KAAQ;IACfD,eAAe,EAAE,CAAC,CAAEC,MAAM,CAAET,gBAAiB,CAAC,CAACU,GAAG,CACjD,mBAAmB,EACnB,cACD;EACD,CAAC,CAAE,EACH,EACD,CAAC;EAED,OACCC,aAAA,CAAAC,QAAA,QACCD,aAAA;IAAKE,SAAS,EAAC;EAAqB,GACnCF,aAAA;IAAKE,SAAS,EAAC;EAAgD,GAC5DP,eAAe,IAChBK,aAAA;IAAIE,SAAS,EAAC;EAA4B,GACvCnB,EAAE,CAAE,SAAU,CACb,CACJ,EACC,CAAEY,eAAe,IAClBK,aAAA,CAACf,cAAc;IACdkB,EAAE,EAAC,IAAI;IACPD,SAAS,EAAC;EAA4B,GAEpCnB,EAAE,CAAE,SAAU,CACD,CAChB,EACDiB,aAAA,CAACV,aAAa;IACbI,wBAAwB,EAAGA;EAA0B,CACrD,CAAC,EACAG,eAAe,IAAIF,eAAe,IACnCK,aAAA,CAAAC,QAAA,QACCD,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC5CF,aAAA,CAACpB,YAAY;IAACwB,cAAc;EAAA,CAAE,CAC1B,CAAC,EACNJ,aAAA,CAAChB,OAAO,CAACqB,IAAI;IACZC,GAAG,EAAGV,eAAiB;IACvBW,IAAI,EAAC;EAAe,CACpB,CACA,CAEC,CAAC,EACNP,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC5CF,aAAA,CAACT,UAAU,MAAE,CAAC,EACdS,aAAA,CAACd,WAAW,CAACmB,IAAI;IAACG,KAAK,EAAC;EAAmB,CAAE,CAAC,EAC9CR,aAAA,CAACR,QAAQ,MAAE,CACP,CACD,CACJ,CAAC;AAEL;AAEA,eAAeC,MAAM"}
1
+ {"version":3,"names":["BlockToolbar","useSelect","useRef","__","Popover","VisuallyHidden","PinnedItems","useViewportMatch","store","preferencesStore","DocumentTools","SaveButton","MoreMenu","Header","isLargeViewport","blockToolbarRef","hasFixedToolbar","select","get","createElement","Fragment","className","as","hideDragHandle","Slot","ref","name","scope"],"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockToolbar } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Popover, VisuallyHidden } from '@wordpress/components';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport DocumentTools from './document-tools';\nimport SaveButton from '../save-button';\nimport MoreMenu from '../more-menu';\n\nfunction Header() {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst blockToolbarRef = useRef();\n\tconst { hasFixedToolbar } = useSelect(\n\t\t( select ) => ( {\n\t\t\thasFixedToolbar: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-header\">\n\t\t\t\t<div className=\"edit-widgets-header__navigable-toolbar-wrapper\">\n\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t<h1 className=\"edit-widgets-header__title\">\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isLargeViewport && (\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) }\n\t\t\t\t\t<DocumentTools />\n\t\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"selected-block-tools-wrapper\">\n\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-widgets-header__actions\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t\t<MoreMenu />\n\t\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,CAAAC,QAAA,QACCD,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC5CF,aAAA,CAACnB,YAAY;IAACuB,cAAc;EAAA,CAAE,CAC1B,CAAC,EACNJ,aAAA,CAACf,OAAO,CAACoB,IAAI;IACZC,GAAG,EAAGV,eAAiB;IACvBW,IAAI,EAAC;EAAe,CACpB,CACA,CAEC,CAAC,EACNP,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC5CF,aAAA,CAACR,UAAU,MAAE,CAAC,EACdQ,aAAA,CAACb,WAAW,CAACkB,IAAI;IAACG,KAAK,EAAC;EAAmB,CAAE,CAAC,EAC9CR,aAAA,CAACP,QAAQ,MAAE,CACP,CACD,CACJ,CAAC;AAEL;AAEA,eAAeC,MAAM"}
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "react";
4
4
  */
5
5
  import { useViewportMatch } from '@wordpress/compose';
6
6
  import { BlockBreadcrumb } from '@wordpress/block-editor';
7
- import { useEffect, useState } from '@wordpress/element';
7
+ import { useEffect } from '@wordpress/element';
8
8
  import { useDispatch, useSelect } from '@wordpress/data';
9
9
  import { InterfaceSkeleton, ComplementaryArea, store as interfaceStore } from '@wordpress/interface';
10
10
  import { __ } from '@wordpress/i18n';
@@ -53,7 +53,6 @@ function Interface({
53
53
  previousShortcut: select(keyboardShortcutsStore).getAllShortcutKeyCombinations('core/edit-widgets/previous-region'),
54
54
  nextShortcut: select(keyboardShortcutsStore).getAllShortcutKeyCombinations('core/edit-widgets/next-region')
55
55
  }), []);
56
- const [listViewToggleElement, setListViewToggleElement] = useState(null);
57
56
 
58
57
  // Inserter and Sidebars are mutually exclusive
59
58
  useEffect(() => {
@@ -74,12 +73,8 @@ function Interface({
74
73
  ...interfaceLabels,
75
74
  secondarySidebar: secondarySidebarLabel
76
75
  },
77
- header: createElement(Header, {
78
- setListViewToggleElement: setListViewToggleElement
79
- }),
80
- secondarySidebar: hasSecondarySidebar && createElement(SecondarySidebar, {
81
- listViewToggleElement: listViewToggleElement
82
- }),
76
+ header: createElement(Header, null),
77
+ secondarySidebar: hasSecondarySidebar && createElement(SecondarySidebar, null),
83
78
  sidebar: hasSidebarEnabled && createElement(ComplementaryArea.Slot, {
84
79
  scope: "core/edit-widgets"
85
80
  }),
@@ -1 +1 @@
1
- {"version":3,"names":["useViewportMatch","BlockBreadcrumb","useEffect","useState","useDispatch","useSelect","InterfaceSkeleton","ComplementaryArea","store","interfaceStore","__","keyboardShortcutsStore","preferencesStore","Header","WidgetAreasBlockEditorContent","editWidgetsStore","SecondarySidebar","interfaceLabels","header","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","previousShortcut","nextShortcut","select","getActiveComplementaryArea","name","get","getAllShortcutKeyCombinations","listViewToggleElement","setListViewToggleElement","secondarySidebarLabel","hasSecondarySidebar","createElement","labels","secondarySidebar","Slot","scope","content","Fragment","className","rootLabelText","shortcuts","previous","next"],"sources":["@wordpress/edit-widgets/src/components/layout/interface.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Header from '../header';\nimport WidgetAreasBlockEditorContent from '../widget-areas-block-editor-content';\nimport { store as editWidgetsStore } from '../../store';\nimport SecondarySidebar from '../secondary-sidebar';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the widgets screen top bar landmark region. */\n\theader: __( 'Widgets top bar' ),\n\t/* translators: accessibility text for the widgets screen content landmark region. */\n\tbody: __( 'Widgets and blocks' ),\n\t/* translators: accessibility text for the widgets screen settings landmark region. */\n\tsidebar: __( 'Widgets settings' ),\n\t/* translators: accessibility text for the widgets screen footer landmark region. */\n\tfooter: __( 'Widgets footer' ),\n};\n\nfunction Interface( { blockEditorSettings } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst {\n\t\thasBlockBreadCrumbsEnabled,\n\t\thasSidebarEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\thasSidebarEnabled: !! select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( editWidgetsStore.name ),\n\t\t\tisInserterOpened: !! select( editWidgetsStore ).isInserterOpened(),\n\t\t\tisListViewOpened: !! select( editWidgetsStore ).isListViewOpened(),\n\t\t\thasBlockBreadCrumbsEnabled: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-widgets/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-widgets/next-region' ),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst [ listViewToggleElement, setListViewToggleElement ] =\n\t\tuseState( null );\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( hasSidebarEnabled && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}, [ hasSidebarEnabled, isHugeViewport ] );\n\n\tuseEffect( () => {\n\t\tif ( ( isInserterOpened || isListViewOpened ) && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isListViewOpened, isHugeViewport ] );\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\n\tconst hasSecondarySidebar = isListViewOpened || isInserterOpened;\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tlabels={ {\n\t\t\t\t...interfaceLabels,\n\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t} }\n\t\t\theader={\n\t\t\t\t<Header setListViewToggleElement={ setListViewToggleElement } />\n\t\t\t}\n\t\t\tsecondarySidebar={\n\t\t\t\thasSecondarySidebar && (\n\t\t\t\t\t<SecondarySidebar\n\t\t\t\t\t\tlistViewToggleElement={ listViewToggleElement }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tsidebar={\n\t\t\t\thasSidebarEnabled && (\n\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<WidgetAreasBlockEditorContent\n\t\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\thasBlockBreadCrumbsEnabled &&\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<div className=\"edit-widgets-layout__footer\">\n\t\t\t\t\t\t<BlockBreadcrumb rootLabelText={ __( 'Widgets' ) } />\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t\tshortcuts={ {\n\t\t\t\tprevious: previousShortcut,\n\t\t\t\tnext: nextShortcut,\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default Interface;\n"],"mappings":";AAAA;AACA;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,IAAID,gBAAgB;EAEhE,OACCa,aAAA,CAACtC,iBAAiB;IACjBuC,MAAM,EAAG;MACR,GAAG5B,eAAe;MAClB6B,gBAAgB,EAAEJ;IACnB,CAAG;IACHxB,MAAM,EACL0B,aAAA,CAAC/B,MAAM;MAAC4B,wBAAwB,EAAGA;IAA0B,CAAE,CAC/D;IACDK,gBAAgB,EACfH,mBAAmB,IAClBC,aAAA,CAAC5B,gBAAgB;MAChBwB,qBAAqB,EAAGA;IAAuB,CAC/C,CAEF;IACDpB,OAAO,EACNU,iBAAiB,IAChBc,aAAA,CAACrC,iBAAiB,CAACwC,IAAI;MAACC,KAAK,EAAC;IAAmB,CAAE,CAEpD;IACDC,OAAO,EACNL,aAAA,CAAAM,QAAA,QACCN,aAAA,CAAC9B,6BAA6B;MAC7BS,mBAAmB,EAAGA;IAAqB,CAC3C,CACA,CACF;IACDF,MAAM,EACLQ,0BAA0B,IAC1B,CAAEL,gBAAgB,IACjBoB,aAAA;MAAKO,SAAS,EAAC;IAA6B,GAC3CP,aAAA,CAAC3C,eAAe;MAACmD,aAAa,EAAG1C,EAAE,CAAE,SAAU;IAAG,CAAE,CAChD,CAEN;IACD2C,SAAS,EAAG;MACXC,QAAQ,EAAErB,gBAAgB;MAC1BsB,IAAI,EAAErB;IACP;EAAG,CACH,CAAC;AAEJ;AAEA,eAAeZ,SAAS"}
1
+ {"version":3,"names":["useViewportMatch","BlockBreadcrumb","useEffect","useDispatch","useSelect","InterfaceSkeleton","ComplementaryArea","store","interfaceStore","__","keyboardShortcutsStore","preferencesStore","Header","WidgetAreasBlockEditorContent","editWidgetsStore","SecondarySidebar","interfaceLabels","header","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","previousShortcut","nextShortcut","select","getActiveComplementaryArea","name","get","getAllShortcutKeyCombinations","secondarySidebarLabel","hasSecondarySidebar","createElement","labels","secondarySidebar","Slot","scope","content","Fragment","className","rootLabelText","shortcuts","previous","next"],"sources":["@wordpress/edit-widgets/src/components/layout/interface.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Header from '../header';\nimport WidgetAreasBlockEditorContent from '../widget-areas-block-editor-content';\nimport { store as editWidgetsStore } from '../../store';\nimport SecondarySidebar from '../secondary-sidebar';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the widgets screen top bar landmark region. */\n\theader: __( 'Widgets top bar' ),\n\t/* translators: accessibility text for the widgets screen content landmark region. */\n\tbody: __( 'Widgets and blocks' ),\n\t/* translators: accessibility text for the widgets screen settings landmark region. */\n\tsidebar: __( 'Widgets settings' ),\n\t/* translators: accessibility text for the widgets screen footer landmark region. */\n\tfooter: __( 'Widgets footer' ),\n};\n\nfunction Interface( { blockEditorSettings } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst {\n\t\thasBlockBreadCrumbsEnabled,\n\t\thasSidebarEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\thasSidebarEnabled: !! select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( editWidgetsStore.name ),\n\t\t\tisInserterOpened: !! select( editWidgetsStore ).isInserterOpened(),\n\t\t\tisListViewOpened: !! select( editWidgetsStore ).isListViewOpened(),\n\t\t\thasBlockBreadCrumbsEnabled: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-widgets/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-widgets/next-region' ),\n\t\t} ),\n\t\t[]\n\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( hasSidebarEnabled && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}, [ hasSidebarEnabled, isHugeViewport ] );\n\n\tuseEffect( () => {\n\t\tif ( ( isInserterOpened || isListViewOpened ) && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isListViewOpened, isHugeViewport ] );\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\n\tconst hasSecondarySidebar = isListViewOpened || isInserterOpened;\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tlabels={ {\n\t\t\t\t...interfaceLabels,\n\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t} }\n\t\t\theader={ <Header /> }\n\t\t\tsecondarySidebar={ hasSecondarySidebar && <SecondarySidebar /> }\n\t\t\tsidebar={\n\t\t\t\thasSidebarEnabled && (\n\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<WidgetAreasBlockEditorContent\n\t\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\thasBlockBreadCrumbsEnabled &&\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<div className=\"edit-widgets-layout__footer\">\n\t\t\t\t\t\t<BlockBreadcrumb rootLabelText={ __( 'Widgets' ) } />\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t\tshortcuts={ {\n\t\t\t\tprevious: previousShortcut,\n\t\t\t\tnext: nextShortcut,\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default Interface;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,iBAAiB,EACjBC,iBAAiB,EACjBC,KAAK,IAAIC,cAAc,QACjB,sBAAsB;AAC7B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASF,KAAK,IAAIG,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASH,KAAK,IAAII,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,6BAA6B,MAAM,sCAAsC;AAChF,SAASN,KAAK,IAAIO,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,gBAAgB,MAAM,sBAAsB;AAEnD,MAAMC,eAAe,GAAG;EACvB;EACAC,MAAM,EAAER,EAAE,CAAE,iBAAkB,CAAC;EAC/B;EACAS,IAAI,EAAET,EAAE,CAAE,oBAAqB,CAAC;EAChC;EACAU,OAAO,EAAEV,EAAE,CAAE,kBAAmB,CAAC;EACjC;EACAW,MAAM,EAAEX,EAAE,CAAE,gBAAiB;AAC9B,CAAC;AAED,SAASY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AAC;EAE1CtB,SAAS,CAAE,MAAM;IAChB,IAAK,CAAE4B,gBAAgB,IAAIC,gBAAgB,KAAM,CAAEP,cAAc,EAAG;MACnEG,mBAAmB,CAAC,CAAC;IACtB;EACD,CAAC,EAAE,CAAEG,gBAAgB,EAAEC,gBAAgB,EAAEP,cAAc,CAAG,CAAC;EAE3D,MAAMe,qBAAqB,GAAGR,gBAAgB,GAC3CtB,EAAE,CAAE,WAAY,CAAC,GACjBA,EAAE,CAAE,eAAgB,CAAC;EAExB,MAAM+B,mBAAmB,GAAGT,gBAAgB,IAAID,gBAAgB;EAEhE,OACCW,aAAA,CAACpC,iBAAiB;IACjBqC,MAAM,EAAG;MACR,GAAG1B,eAAe;MAClB2B,gBAAgB,EAAEJ;IACnB,CAAG;IACHtB,MAAM,EAAGwB,aAAA,CAAC7B,MAAM,MAAE,CAAG;IACrB+B,gBAAgB,EAAGH,mBAAmB,IAAIC,aAAA,CAAC1B,gBAAgB,MAAE,CAAG;IAChEI,OAAO,EACNU,iBAAiB,IAChBY,aAAA,CAACnC,iBAAiB,CAACsC,IAAI;MAACC,KAAK,EAAC;IAAmB,CAAE,CAEpD;IACDC,OAAO,EACNL,aAAA,CAAAM,QAAA,QACCN,aAAA,CAAC5B,6BAA6B;MAC7BS,mBAAmB,EAAGA;IAAqB,CAC3C,CACA,CACF;IACDF,MAAM,EACLQ,0BAA0B,IAC1B,CAAEL,gBAAgB,IACjBkB,aAAA;MAAKO,SAAS,EAAC;IAA6B,GAC3CP,aAAA,CAACxC,eAAe;MAACgD,aAAa,EAAGxC,EAAE,CAAE,SAAU;IAAG,CAAE,CAChD,CAEN;IACDyC,SAAS,EAAG;MACXC,QAAQ,EAAEnB,gBAAgB;MAC1BoB,IAAI,EAAEnB;IACP;EAAG,CACH,CAAC;AAEJ;AAEA,eAAeZ,SAAS"}
@@ -13,9 +13,7 @@ import { store as editWidgetsStore } from '../../store';
13
13
  */
14
14
  import InserterSidebar from './inserter-sidebar';
15
15
  import ListViewSidebar from './list-view-sidebar';
16
- export default function SecondarySidebar({
17
- listViewToggleElement
18
- }) {
16
+ export default function SecondarySidebar() {
19
17
  const {
20
18
  isInserterOpen,
21
19
  isListViewOpen
@@ -33,9 +31,7 @@ export default function SecondarySidebar({
33
31
  return createElement(InserterSidebar, null);
34
32
  }
35
33
  if (isListViewOpen) {
36
- return createElement(ListViewSidebar, {
37
- listViewToggleElement: listViewToggleElement
38
- });
34
+ return createElement(ListViewSidebar, null);
39
35
  }
40
36
  return null;
41
37
  }
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","store","editWidgetsStore","InserterSidebar","ListViewSidebar","SecondarySidebar","listViewToggleElement","isInserterOpen","isListViewOpen","select","isInserterOpened","isListViewOpened","createElement"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\n/**\n * Internal dependencies\n */\nimport InserterSidebar from './inserter-sidebar';\nimport ListViewSidebar from './list-view-sidebar';\n\nexport default function SecondarySidebar( { listViewToggleElement } ) {\n\tconst { isInserterOpen, isListViewOpen } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t};\n\t}, [] );\n\n\tif ( isInserterOpen ) {\n\t\treturn <InserterSidebar />;\n\t}\n\tif ( isListViewOpen ) {\n\t\treturn (\n\t\t\t<ListViewSidebar listViewToggleElement={ listViewToggleElement } />\n\t\t);\n\t}\n\treturn null;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,oBAAoB;AAChD,OAAOC,eAAe,MAAM,qBAAqB;AAEjD,eAAe,SAASC,gBAAgBA,CAAE;EAAEC;AAAsB,CAAC,EAAG;EACrE,MAAM;IAAEC,cAAc;IAAEC;EAAe,CAAC,GAAGR,SAAS,CAAIS,MAAM,IAAM;IACnE,MAAM;MAAEC,gBAAgB;MAAEC;IAAiB,CAAC,GAC3CF,MAAM,CAAEP,gBAAiB,CAAC;IAC3B,OAAO;MACNK,cAAc,EAAEG,gBAAgB,CAAC,CAAC;MAClCF,cAAc,EAAEG,gBAAgB,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAKJ,cAAc,EAAG;IACrB,OAAOK,aAAA,CAACT,eAAe,MAAE,CAAC;EAC3B;EACA,IAAKK,cAAc,EAAG;IACrB,OACCI,aAAA,CAACR,eAAe;MAACE,qBAAqB,EAAGA;IAAuB,CAAE,CAAC;EAErE;EACA,OAAO,IAAI;AACZ"}
1
+ {"version":3,"names":["useSelect","store","editWidgetsStore","InserterSidebar","ListViewSidebar","SecondarySidebar","isInserterOpen","isListViewOpen","select","isInserterOpened","isListViewOpened","createElement"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\n/**\n * Internal dependencies\n */\nimport InserterSidebar from './inserter-sidebar';\nimport ListViewSidebar from './list-view-sidebar';\n\nexport default function SecondarySidebar() {\n\tconst { isInserterOpen, isListViewOpen } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t};\n\t}, [] );\n\n\tif ( isInserterOpen ) {\n\t\treturn <InserterSidebar />;\n\t}\n\tif ( isListViewOpen ) {\n\t\treturn <ListViewSidebar />;\n\t}\n\treturn null;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,oBAAoB;AAChD,OAAOC,eAAe,MAAM,qBAAqB;AAEjD,eAAe,SAASC,gBAAgBA,CAAA,EAAG;EAC1C,MAAM;IAAEC,cAAc;IAAEC;EAAe,CAAC,GAAGP,SAAS,CAAIQ,MAAM,IAAM;IACnE,MAAM;MAAEC,gBAAgB;MAAEC;IAAiB,CAAC,GAC3CF,MAAM,CAAEN,gBAAiB,CAAC;IAC3B,OAAO;MACNI,cAAc,EAAEG,gBAAgB,CAAC,CAAC;MAClCF,cAAc,EAAEG,gBAAgB,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAKJ,cAAc,EAAG;IACrB,OAAOK,aAAA,CAACR,eAAe,MAAE,CAAC;EAC3B;EACA,IAAKI,cAAc,EAAG;IACrB,OAAOI,aAAA,CAACP,eAAe,MAAE,CAAC;EAC3B;EACA,OAAO,IAAI;AACZ"}
@@ -5,7 +5,7 @@ import { createElement } from "react";
5
5
  import { __experimentalListView as ListView } from '@wordpress/block-editor';
6
6
  import { Button } from '@wordpress/components';
7
7
  import { useFocusOnMount, useMergeRefs } from '@wordpress/compose';
8
- import { useDispatch } from '@wordpress/data';
8
+ import { useDispatch, useSelect } from '@wordpress/data';
9
9
  import { useCallback, useState } from '@wordpress/element';
10
10
  import { __ } from '@wordpress/i18n';
11
11
  import { closeSmall } from '@wordpress/icons';
@@ -15,12 +15,14 @@ import { ESCAPE } from '@wordpress/keycodes';
15
15
  * Internal dependencies
16
16
  */
17
17
  import { store as editWidgetsStore } from '../../store';
18
- export default function ListViewSidebar({
19
- listViewToggleElement
20
- }) {
18
+ import { unlock } from '../../lock-unlock';
19
+ export default function ListViewSidebar() {
21
20
  const {
22
21
  setIsListViewOpened
23
22
  } = useDispatch(editWidgetsStore);
23
+ const {
24
+ getListViewToggleRef
25
+ } = unlock(useSelect(editWidgetsStore));
24
26
 
25
27
  // Use internal state instead of a ref to make sure that the component
26
28
  // re-renders when the dropZoneElement updates.
@@ -30,8 +32,8 @@ export default function ListViewSidebar({
30
32
  // When closing the list view, focus should return to the toggle button.
31
33
  const closeListView = useCallback(() => {
32
34
  setIsListViewOpened(false);
33
- listViewToggleElement?.focus();
34
- }, [listViewToggleElement, setIsListViewOpened]);
35
+ getListViewToggleRef().current?.focus();
36
+ }, [getListViewToggleRef, setIsListViewOpened]);
35
37
  const closeOnEscape = useCallback(event => {
36
38
  if (event.keyCode === ESCAPE && !event.defaultPrevented) {
37
39
  event.preventDefault();
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalListView","ListView","Button","useFocusOnMount","useMergeRefs","useDispatch","useCallback","useState","__","closeSmall","ESCAPE","store","editWidgetsStore","ListViewSidebar","listViewToggleElement","setIsListViewOpened","dropZoneElement","setDropZoneElement","focusOnMountRef","closeListView","focus","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","createElement","className","onKeyDown","icon","label","onClick","ref"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useFocusOnMount, useMergeRefs } from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function ListViewSidebar( { listViewToggleElement } ) {\n\tconst { setIsListViewOpened } = useDispatch( editWidgetsStore );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the dropZoneElement updates.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\t// When closing the list view, focus should return to the toggle button.\n\tconst closeListView = useCallback( () => {\n\t\tsetIsListViewOpened( false );\n\t\tlistViewToggleElement?.focus();\n\t}, [ listViewToggleElement, setIsListViewOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseListView();\n\t\t\t}\n\t\t},\n\t\t[ closeListView ]\n\t);\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"edit-widgets-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div className=\"edit-widgets-editor__list-view-panel-header\">\n\t\t\t\t<strong>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\tonClick={ closeListView }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [ focusOnMountRef, setDropZoneElement ] ) }\n\t\t\t>\n\t\t\t\t<ListView dropZoneElement={ dropZoneElement } />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,QAAQ,QAAQ,yBAAyB;AAC5E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,eAAe,EAAEC,YAAY,QAAQ,oBAAoB;AAClE,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,WAAW,EAAEC,QAAQ,QAAQ,oBAAoB;AAC1D,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC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/DS,aAAA,CAACzB,QAAQ;MAACe,eAAe,EAAGA;IAAiB,CAAE,CAC3C,CACD;EAAC;AAER"}
1
+ {"version":3,"names":["__experimentalListView","ListView","Button","useFocusOnMount","useMergeRefs","useDispatch","useSelect","useCallback","useState","__","closeSmall","ESCAPE","store","editWidgetsStore","unlock","ListViewSidebar","setIsListViewOpened","getListViewToggleRef","dropZoneElement","setDropZoneElement","focusOnMountRef","closeListView","current","focus","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","createElement","className","onKeyDown","icon","label","onClick","ref"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useFocusOnMount, useMergeRefs } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editWidgetsStore );\n\tconst { getListViewToggleRef } = unlock( useSelect( editWidgetsStore ) );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the dropZoneElement updates.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\t// When closing the list view, focus should return to the toggle button.\n\tconst closeListView = useCallback( () => {\n\t\tsetIsListViewOpened( false );\n\t\tgetListViewToggleRef().current?.focus();\n\t}, [ getListViewToggleRef, setIsListViewOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseListView();\n\t\t\t}\n\t\t},\n\t\t[ closeListView ]\n\t);\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"edit-widgets-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div className=\"edit-widgets-editor__list-view-panel-header\">\n\t\t\t\t<strong>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\tonClick={ closeListView }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [ focusOnMountRef, setDropZoneElement ] ) }\n\t\t\t>\n\t\t\t\t<ListView dropZoneElement={ dropZoneElement } />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,QAAQ,QAAQ,yBAAyB;AAC5E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,eAAe,EAAEC,YAAY,QAAQ,oBAAoB;AAClE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,WAAW,EAAEC,QAAQ,QAAQ,oBAAoB;AAC1D,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,MAAM,QAAQ,qBAAqB;;AAE5C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,eAAe,SAASC,eAAeA,CAAA,EAAG;EACzC,MAAM;IAAEC;EAAoB,CAAC,GAAGX,WAAW,CAAEQ,gBAAiB,CAAC;EAC/D,MAAM;IAAEI;EAAqB,CAAC,GAAGH,MAAM,CAAER,SAAS,CAAEO,gBAAiB,CAAE,CAAC;;EAExE;EACA;EACA,MAAM,CAAEK,eAAe,EAAEC,kBAAkB,CAAE,GAAGX,QAAQ,CAAE,IAAK,CAAC;EAEhE,MAAMY,eAAe,GAAGjB,eAAe,CAAE,cAAe,CAAC;;EAEzD;EACA,MAAMkB,aAAa,GAAGd,WAAW,CAAE,MAAM;IACxCS,mBAAmB,CAAE,KAAM,CAAC;IAC5BC,oBAAoB,CAAC,CAAC,CAACK,OAAO,EAAEC,KAAK,CAAC,CAAC;EACxC,CAAC,EAAE,CAAEN,oBAAoB,EAAED,mBAAmB,CAAG,CAAC;EAElD,MAAMQ,aAAa,GAAGjB,WAAW,CAC9BkB,KAAK,IAAM;IACZ,IAAKA,KAAK,CAACC,OAAO,KAAKf,MAAM,IAAI,CAAEc,KAAK,CAACE,gBAAgB,EAAG;MAC3DF,KAAK,CAACG,cAAc,CAAC,CAAC;MACtBP,aAAa,CAAC,CAAC;IAChB;EACD,CAAC,EACD,CAAEA,aAAa,CAChB,CAAC;EAED;IACC;IACAQ,aAAA;MACCC,SAAS,EAAC,sCAAsC;MAChDC,SAAS,EAAGP;IAAe,GAE3BK,aAAA;MAAKC,SAAS,EAAC;IAA6C,GAC3DD,aAAA,iBAAUpB,EAAE,CAAE,WAAY,CAAW,CAAC,EACtCoB,aAAA,CAAC3B,MAAM;MACN8B,IAAI,EAAGtB,UAAY;MACnBuB,KAAK,EAAGxB,EAAE,CAAE,OAAQ,CAAG;MACvByB,OAAO,EAAGb;IAAe,CACzB,CACG,CAAC,EACNQ,aAAA;MACCC,SAAS,EAAC,8CAA8C;MACxDK,GAAG,EAAG/B,YAAY,CAAE,CAAEgB,eAAe,EAAED,kBAAkB,CAAG;IAAG,GAE/DU,aAAA,CAAC5B,QAAQ;MAACiB,eAAe,EAAGA;IAAiB,CAAE,CAC3C,CACD;EAAC;AAER"}
@@ -11,7 +11,9 @@ import reducer from './reducer';
11
11
  import * as resolvers from './resolvers';
12
12
  import * as selectors from './selectors';
13
13
  import * as actions from './actions';
14
+ import * as privateSelectors from './private-selectors';
14
15
  import { STORE_NAME } from './constants';
16
+ import { unlock } from '../lock-unlock';
15
17
 
16
18
  /**
17
19
  * Block editor data store configuration.
@@ -46,4 +48,5 @@ apiFetch.use(function (options, next) {
46
48
  }
47
49
  return next(options);
48
50
  });
51
+ unlock(store).registerPrivateSelectors(privateSelectors);
49
52
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["apiFetch","createReduxStore","register","reducer","resolvers","selectors","actions","STORE_NAME","storeConfig","store","use","options","next","path","indexOf","Promise","resolve"],"sources":["@wordpress/edit-widgets/src/store/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as resolvers from './resolvers';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#register\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tresolvers,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets 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, storeConfig );\nregister( store );\n\n// This package uses a few in-memory post types as wrappers for convenience.\n// This middleware prevents any network requests related to these types as they are\n// bound to fail anyway.\napiFetch.use( function ( options, next ) {\n\tif ( options.path?.indexOf( '/wp/v2/types/widget-area' ) === 0 ) {\n\t\treturn Promise.resolve( {} );\n\t}\n\n\treturn next( options );\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,gBAAgB,EAAEC,QAAQ,QAAQ,iBAAiB;;AAE5D;AACA;AACA;AACA,OAAOC,OAAO,MAAM,WAAW;AAC/B,OAAO,KAAKC,SAAS,MAAM,aAAa;AACxC,OAAO,KAAKC,SAAS,MAAM,aAAa;AACxC,OAAO,KAAKC,OAAO,MAAM,WAAW;AACpC,SAASC,UAAU,QAAQ,aAAa;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAG;EACnBL,OAAO;EACPE,SAAS;EACTD,SAAS;EACTE;AACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,KAAK,GAAGR,gBAAgB,CAAEM,UAAU,EAAEC,WAAY,CAAC;AAChEN,QAAQ,CAAEO,KAAM,CAAC;;AAEjB;AACA;AACA;AACAT,QAAQ,CAACU,GAAG,CAAE,UAAWC,OAAO,EAAEC,IAAI,EAAG;EACxC,IAAKD,OAAO,CAACE,IAAI,EAAEC,OAAO,CAAE,0BAA2B,CAAC,KAAK,CAAC,EAAG;IAChE,OAAOC,OAAO,CAACC,OAAO,CAAE,CAAC,CAAE,CAAC;EAC7B;EAEA,OAAOJ,IAAI,CAAED,OAAQ,CAAC;AACvB,CAAE,CAAC"}
1
+ {"version":3,"names":["apiFetch","createReduxStore","register","reducer","resolvers","selectors","actions","privateSelectors","STORE_NAME","unlock","storeConfig","store","use","options","next","path","indexOf","Promise","resolve","registerPrivateSelectors"],"sources":["@wordpress/edit-widgets/src/store/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as resolvers from './resolvers';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport * as privateSelectors from './private-selectors';\nimport { STORE_NAME } from './constants';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#register\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tresolvers,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets 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, storeConfig );\nregister( store );\n\n// This package uses a few in-memory post types as wrappers for convenience.\n// This middleware prevents any network requests related to these types as they are\n// bound to fail anyway.\napiFetch.use( function ( options, next ) {\n\tif ( options.path?.indexOf( '/wp/v2/types/widget-area' ) === 0 ) {\n\t\treturn Promise.resolve( {} );\n\t}\n\n\treturn next( options );\n} );\n\nunlock( store ).registerPrivateSelectors( privateSelectors );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,gBAAgB,EAAEC,QAAQ,QAAQ,iBAAiB;;AAE5D;AACA;AACA;AACA,OAAOC,OAAO,MAAM,WAAW;AAC/B,OAAO,KAAKC,SAAS,MAAM,aAAa;AACxC,OAAO,KAAKC,SAAS,MAAM,aAAa;AACxC,OAAO,KAAKC,OAAO,MAAM,WAAW;AACpC,OAAO,KAAKC,gBAAgB,MAAM,qBAAqB;AACvD,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,MAAM,QAAQ,gBAAgB;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAG;EACnBP,OAAO;EACPE,SAAS;EACTD,SAAS;EACTE;AACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMK,KAAK,GAAGV,gBAAgB,CAAEO,UAAU,EAAEE,WAAY,CAAC;AAChER,QAAQ,CAAES,KAAM,CAAC;;AAEjB;AACA;AACA;AACAX,QAAQ,CAACY,GAAG,CAAE,UAAWC,OAAO,EAAEC,IAAI,EAAG;EACxC,IAAKD,OAAO,CAACE,IAAI,EAAEC,OAAO,CAAE,0BAA2B,CAAC,KAAK,CAAC,EAAG;IAChE,OAAOC,OAAO,CAACC,OAAO,CAAE,CAAC,CAAE,CAAC;EAC7B;EAEA,OAAOJ,IAAI,CAAED,OAAQ,CAAC;AACvB,CAAE,CAAC;AAEHJ,MAAM,CAAEE,KAAM,CAAC,CAACQ,wBAAwB,CAAEZ,gBAAiB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export function getListViewToggleRef(state) {
2
+ return state.listViewToggleRef;
3
+ }
4
+ //# sourceMappingURL=private-selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getListViewToggleRef","state","listViewToggleRef"],"sources":["@wordpress/edit-widgets/src/store/private-selectors.js"],"sourcesContent":["export function getListViewToggleRef( state ) {\n\treturn state.listViewToggleRef;\n}\n"],"mappings":"AAAA,OAAO,SAASA,oBAAoBA,CAAEC,KAAK,EAAG;EAC7C,OAAOA,KAAK,CAACC,iBAAiB;AAC/B"}
@@ -75,6 +75,19 @@ export function listViewPanel(state = false, action) {
75
75
  }
76
76
  return state;
77
77
  }
78
+
79
+ /**
80
+ * This reducer does nothing aside initializing a ref to the list view toggle.
81
+ * We will have a unique ref per "editor" instance.
82
+ *
83
+ * @param {Object} state
84
+ * @return {Object} Reference to the list view toggle button.
85
+ */
86
+ export function listViewToggleRef(state = {
87
+ current: null
88
+ }) {
89
+ return state;
90
+ }
78
91
  export default combineReducers({
79
92
  blockInserterPanel,
80
93
  listViewPanel,
@@ -1 +1 @@
1
- {"version":3,"names":["combineReducers","widgetAreasOpenState","state","action","type","clientId","isOpen","blockInserterPanel","value","listViewPanel"],"sources":["@wordpress/edit-widgets/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Controls the open state of the widget areas.\n *\n * @param {Object} state Redux state.\n * @param {Object} action Redux action.\n *\n * @return {Array} Updated state.\n */\nexport function widgetAreasOpenState( state = {}, action ) {\n\tconst { type } = action;\n\tswitch ( type ) {\n\t\tcase 'SET_WIDGET_AREAS_OPEN_STATE': {\n\t\t\treturn action.widgetAreasOpenState;\n\t\t}\n\t\tcase 'SET_IS_WIDGET_AREA_OPEN': {\n\t\t\tconst { clientId, isOpen } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ clientId ]: isOpen,\n\t\t\t};\n\t\t}\n\t\tdefault: {\n\t\t\treturn state;\n\t\t}\n\t}\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n\tlistViewPanel,\n\twidgetAreasOpenState,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC1D,MAAM;IAAEC;EAAK,CAAC,GAAGD,MAAM;EACvB,QAASC,IAAI;IACZ,KAAK,6BAA6B;MAAE;QACnC,OAAOD,MAAM,CAACF,oBAAoB;MACnC;IACA,KAAK,yBAAyB;MAAE;QAC/B,MAAM;UAAEI,QAAQ;UAAEC;QAAO,CAAC,GAAGH,MAAM;QACnC,OAAO;UACN,GAAGD,KAAK;UACR,CAAEG,QAAQ,GAAIC;QACf,CAAC;MACF;IACA;MAAS;QACR,OAAOJ,KAAK;MACb;EACD;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,kBAAkBA,CAAEL,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EAC3D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,yBAAyB;MAC7B,OAAOD,MAAM,CAACG,MAAM,GAAG,KAAK,GAAGJ,KAAK;IACrC,KAAK,wBAAwB;MAC5B,OAAOC,MAAM,CAACK,KAAK;EACrB;EACA,OAAON,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,aAAaA,CAAEP,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EACtD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,wBAAwB;MAC5B,OAAOD,MAAM,CAACK,KAAK,GAAG,KAAK,GAAGN,KAAK;IACpC,KAAK,yBAAyB;MAC7B,OAAOC,MAAM,CAACG,MAAM;EACtB;EACA,OAAOJ,KAAK;AACb;AAEA,eAAeF,eAAe,CAAE;EAC/BO,kBAAkB;EAClBE,aAAa;EACbR;AACD,CAAE,CAAC"}
1
+ {"version":3,"names":["combineReducers","widgetAreasOpenState","state","action","type","clientId","isOpen","blockInserterPanel","value","listViewPanel","listViewToggleRef","current"],"sources":["@wordpress/edit-widgets/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Controls the open state of the widget areas.\n *\n * @param {Object} state Redux state.\n * @param {Object} action Redux action.\n *\n * @return {Array} Updated state.\n */\nexport function widgetAreasOpenState( state = {}, action ) {\n\tconst { type } = action;\n\tswitch ( type ) {\n\t\tcase 'SET_WIDGET_AREAS_OPEN_STATE': {\n\t\t\treturn action.widgetAreasOpenState;\n\t\t}\n\t\tcase 'SET_IS_WIDGET_AREA_OPEN': {\n\t\t\tconst { clientId, isOpen } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ clientId ]: isOpen,\n\t\t\t};\n\t\t}\n\t\tdefault: {\n\t\t\treturn state;\n\t\t}\n\t}\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * This reducer does nothing aside initializing a ref to the list view toggle.\n * We will have a unique ref per \"editor\" instance.\n *\n * @param {Object} state\n * @return {Object} Reference to the list view toggle button.\n */\nexport function listViewToggleRef( state = { current: null } ) {\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n\tlistViewPanel,\n\twidgetAreasOpenState,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC1D,MAAM;IAAEC;EAAK,CAAC,GAAGD,MAAM;EACvB,QAASC,IAAI;IACZ,KAAK,6BAA6B;MAAE;QACnC,OAAOD,MAAM,CAACF,oBAAoB;MACnC;IACA,KAAK,yBAAyB;MAAE;QAC/B,MAAM;UAAEI,QAAQ;UAAEC;QAAO,CAAC,GAAGH,MAAM;QACnC,OAAO;UACN,GAAGD,KAAK;UACR,CAAEG,QAAQ,GAAIC;QACf,CAAC;MACF;IACA;MAAS;QACR,OAAOJ,KAAK;MACb;EACD;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,kBAAkBA,CAAEL,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EAC3D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,yBAAyB;MAC7B,OAAOD,MAAM,CAACG,MAAM,GAAG,KAAK,GAAGJ,KAAK;IACrC,KAAK,wBAAwB;MAC5B,OAAOC,MAAM,CAACK,KAAK;EACrB;EACA,OAAON,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,aAAaA,CAAEP,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EACtD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,wBAAwB;MAC5B,OAAOD,MAAM,CAACK,KAAK,GAAG,KAAK,GAAGN,KAAK;IACpC,KAAK,yBAAyB;MAC7B,OAAOC,MAAM,CAACG,MAAM;EACtB;EACA,OAAOJ,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ,iBAAiBA,CAAER,KAAK,GAAG;EAAES,OAAO,EAAE;AAAK,CAAC,EAAG;EAC9D,OAAOT,KAAK;AACb;AAEA,eAAeF,eAAe,CAAE;EAC/BO,kBAAkB;EAClBE,aAAa;EACbR;AACD,CAAE,CAAC"}
@@ -569,6 +569,10 @@ body.is-fullscreen-mode .interface-interface-skeleton {
569
569
  color: #757575;
570
570
  }
571
571
 
572
+ .interface-preferences-modal__section:has(.interface-preferences-modal__section-content:empty) {
573
+ display: none;
574
+ }
575
+
572
576
  .interface-preferences-modal__option + .interface-preferences-modal__option {
573
577
  margin-top: 16px;
574
578
  }
@@ -569,6 +569,10 @@ body.is-fullscreen-mode .interface-interface-skeleton {
569
569
  color: #757575;
570
570
  }
571
571
 
572
+ .interface-preferences-modal__section:has(.interface-preferences-modal__section-content:empty) {
573
+ display: none;
574
+ }
575
+
572
576
  .interface-preferences-modal__option + .interface-preferences-modal__option {
573
577
  margin-top: 16px;
574
578
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-widgets",
3
- "version": "5.25.0",
3
+ "version": "5.26.0",
4
4
  "description": "Widgets Page module for WordPress..",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,33 +27,34 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/api-fetch": "^6.45.0",
31
- "@wordpress/block-editor": "^12.16.0",
32
- "@wordpress/block-library": "^8.25.0",
33
- "@wordpress/blocks": "^12.25.0",
34
- "@wordpress/components": "^25.14.0",
35
- "@wordpress/compose": "^6.25.0",
36
- "@wordpress/core-data": "^6.25.0",
37
- "@wordpress/data": "^9.18.0",
38
- "@wordpress/deprecated": "^3.48.0",
39
- "@wordpress/dom": "^3.48.0",
40
- "@wordpress/element": "^5.25.0",
41
- "@wordpress/hooks": "^3.48.0",
42
- "@wordpress/i18n": "^4.48.0",
43
- "@wordpress/icons": "^9.39.0",
44
- "@wordpress/interface": "^5.25.0",
45
- "@wordpress/keyboard-shortcuts": "^4.25.0",
46
- "@wordpress/keycodes": "^3.48.0",
47
- "@wordpress/media-utils": "^4.39.0",
48
- "@wordpress/notices": "^4.16.0",
49
- "@wordpress/patterns": "^1.9.0",
50
- "@wordpress/plugins": "^6.16.0",
51
- "@wordpress/preferences": "^3.25.0",
52
- "@wordpress/private-apis": "^0.30.0",
53
- "@wordpress/reusable-blocks": "^4.25.0",
54
- "@wordpress/url": "^3.49.0",
55
- "@wordpress/widgets": "^3.25.0",
56
- "classnames": "^2.3.1"
30
+ "@wordpress/api-fetch": "^6.46.0",
31
+ "@wordpress/block-editor": "^12.17.0",
32
+ "@wordpress/block-library": "^8.26.0",
33
+ "@wordpress/blocks": "^12.26.0",
34
+ "@wordpress/components": "^25.15.0",
35
+ "@wordpress/compose": "^6.26.0",
36
+ "@wordpress/core-data": "^6.26.0",
37
+ "@wordpress/data": "^9.19.0",
38
+ "@wordpress/deprecated": "^3.49.0",
39
+ "@wordpress/dom": "^3.49.0",
40
+ "@wordpress/element": "^5.26.0",
41
+ "@wordpress/hooks": "^3.49.0",
42
+ "@wordpress/i18n": "^4.49.0",
43
+ "@wordpress/icons": "^9.40.0",
44
+ "@wordpress/interface": "^5.26.0",
45
+ "@wordpress/keyboard-shortcuts": "^4.26.0",
46
+ "@wordpress/keycodes": "^3.49.0",
47
+ "@wordpress/media-utils": "^4.40.0",
48
+ "@wordpress/notices": "^4.17.0",
49
+ "@wordpress/patterns": "^1.10.0",
50
+ "@wordpress/plugins": "^6.17.0",
51
+ "@wordpress/preferences": "^3.26.0",
52
+ "@wordpress/private-apis": "^0.31.0",
53
+ "@wordpress/reusable-blocks": "^4.26.0",
54
+ "@wordpress/url": "^3.50.0",
55
+ "@wordpress/widgets": "^3.26.0",
56
+ "classnames": "^2.3.1",
57
+ "rememo": "^4.0.2"
57
58
  },
58
59
  "peerDependencies": {
59
60
  "react": "^18.0.0",
@@ -62,5 +63,5 @@
62
63
  "publishConfig": {
63
64
  "access": "public"
64
65
  },
65
- "gitHead": "fcf61b4beff747222c2c81d09d757ca1a0abd925"
66
+ "gitHead": "5e6f9caa205d3bfdbac131952b7bf9c6ec60569b"
66
67
  }
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "name": "core/widget-area",
3
4
  "category": "widgets",
4
5
  "attributes": {
@@ -22,9 +22,9 @@ import useLastSelectedWidgetArea from '../../../hooks/use-last-selected-widget-a
22
22
  import { store as editWidgetsStore } from '../../../store';
23
23
  import { unlock } from '../../../lock-unlock';
24
24
 
25
- const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );
25
+ const { useCanBlockToolbarBeFocused } = unlock( blockEditorPrivateApis );
26
26
 
27
- function DocumentTools( { setListViewToggleElement } ) {
27
+ function DocumentTools() {
28
28
  const isMediumViewport = useViewportMatch( 'medium' );
29
29
  const inserterButton = useRef();
30
30
  const widgetAreaClientId = useLastSelectedWidgetArea();
@@ -35,14 +35,18 @@ function DocumentTools( { setListViewToggleElement } ) {
35
35
  ),
36
36
  [ widgetAreaClientId ]
37
37
  );
38
- const { isInserterOpen, isListViewOpen } = useSelect( ( select ) => {
39
- const { isInserterOpened, isListViewOpened } =
40
- select( editWidgetsStore );
41
- return {
42
- isInserterOpen: isInserterOpened(),
43
- isListViewOpen: isListViewOpened(),
44
- };
45
- }, [] );
38
+ const { isInserterOpen, isListViewOpen, listViewToggleRef } = useSelect(
39
+ ( select ) => {
40
+ const { isInserterOpened, isListViewOpened, getListViewToggleRef } =
41
+ unlock( select( editWidgetsStore ) );
42
+ return {
43
+ isInserterOpen: isInserterOpened(),
44
+ isListViewOpen: isListViewOpened(),
45
+ listViewToggleRef: getListViewToggleRef(),
46
+ };
47
+ },
48
+ []
49
+ );
46
50
  const { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =
47
51
  useDispatch( editWidgetsStore );
48
52
  const { selectBlock } = useDispatch( blockEditorStore );
@@ -71,17 +75,8 @@ function DocumentTools( { setListViewToggleElement } ) {
71
75
  [ setIsListViewOpened, isListViewOpen ]
72
76
  );
73
77
 
74
- const {
75
- shouldShowContextualToolbar,
76
- canFocusHiddenToolbar,
77
- fixedToolbarCanBeFocused,
78
- } = useShouldContextualToolbarShow();
79
78
  // If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
80
- // There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.
81
- const blockToolbarCanBeFocused =
82
- shouldShowContextualToolbar ||
83
- canFocusHiddenToolbar ||
84
- fixedToolbarCanBeFocused;
79
+ const blockToolbarCanBeFocused = useCanBlockToolbarBeFocused();
85
80
 
86
81
  return (
87
82
  <NavigableToolbar
@@ -119,7 +114,7 @@ function DocumentTools( { setListViewToggleElement } ) {
119
114
  /* translators: button label text should, if possible, be under 16 characters. */
120
115
  label={ __( 'List View' ) }
121
116
  onClick={ toggleListView }
122
- ref={ setListViewToggleElement }
117
+ ref={ listViewToggleRef }
123
118
  />
124
119
  </>
125
120
  ) }
@@ -17,7 +17,7 @@ import DocumentTools from './document-tools';
17
17
  import SaveButton from '../save-button';
18
18
  import MoreMenu from '../more-menu';
19
19
 
20
- function Header( { setListViewToggleElement } ) {
20
+ function Header() {
21
21
  const isLargeViewport = useViewportMatch( 'medium' );
22
22
  const blockToolbarRef = useRef();
23
23
  const { hasFixedToolbar } = useSelect(
@@ -47,9 +47,7 @@ function Header( { setListViewToggleElement } ) {
47
47
  { __( 'Widgets' ) }
48
48
  </VisuallyHidden>
49
49
  ) }
50
- <DocumentTools
51
- setListViewToggleElement={ setListViewToggleElement }
52
- />
50
+ <DocumentTools />
53
51
  { hasFixedToolbar && isLargeViewport && (
54
52
  <>
55
53
  <div className="selected-block-tools-wrapper">
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { useViewportMatch } from '@wordpress/compose';
5
5
  import { BlockBreadcrumb } from '@wordpress/block-editor';
6
- import { useEffect, useState } from '@wordpress/element';
6
+ import { useEffect } from '@wordpress/element';
7
7
  import { useDispatch, useSelect } from '@wordpress/data';
8
8
  import {
9
9
  InterfaceSkeleton,
@@ -68,9 +68,6 @@ function Interface( { blockEditorSettings } ) {
68
68
  []
69
69
  );
70
70
 
71
- const [ listViewToggleElement, setListViewToggleElement ] =
72
- useState( null );
73
-
74
71
  // Inserter and Sidebars are mutually exclusive
75
72
  useEffect( () => {
76
73
  if ( hasSidebarEnabled && ! isHugeViewport ) {
@@ -97,16 +94,8 @@ function Interface( { blockEditorSettings } ) {
97
94
  ...interfaceLabels,
98
95
  secondarySidebar: secondarySidebarLabel,
99
96
  } }
100
- header={
101
- <Header setListViewToggleElement={ setListViewToggleElement } />
102
- }
103
- secondarySidebar={
104
- hasSecondarySidebar && (
105
- <SecondarySidebar
106
- listViewToggleElement={ listViewToggleElement }
107
- />
108
- )
109
- }
97
+ header={ <Header /> }
98
+ secondarySidebar={ hasSecondarySidebar && <SecondarySidebar /> }
110
99
  sidebar={
111
100
  hasSidebarEnabled && (
112
101
  <ComplementaryArea.Slot scope="core/edit-widgets" />