@wordpress/edit-widgets 5.24.1 → 5.25.1-next.79a6196f.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 (71) 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 +19 -18
  6. package/build/components/header/document-tools/index.js.map +1 -1
  7. package/build/components/header/index.js +4 -12
  8. package/build/components/header/index.js.map +1 -1
  9. package/build/components/header/undo-redo/redo.js +8 -3
  10. package/build/components/header/undo-redo/redo.js.map +1 -1
  11. package/build/components/header/undo-redo/undo.js +8 -3
  12. package/build/components/header/undo-redo/undo.js.map +1 -1
  13. package/build/components/layout/interface.js +2 -7
  14. package/build/components/layout/interface.js.map +1 -1
  15. package/build/components/secondary-sidebar/index.js +2 -6
  16. package/build/components/secondary-sidebar/index.js.map +1 -1
  17. package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
  18. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  19. package/build/components/widget-areas-block-editor-content/index.js +5 -1
  20. package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
  21. package/build/components/widget-areas-block-editor-provider/index.js +4 -2
  22. package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
  23. package/build/store/index.js +3 -0
  24. package/build/store/index.js.map +1 -1
  25. package/build/store/private-selectors.js +10 -0
  26. package/build/store/private-selectors.js.map +1 -0
  27. package/build/store/reducer.js +14 -0
  28. package/build/store/reducer.js.map +1 -1
  29. package/build-module/blocks/widget-area/index.js +1 -0
  30. package/build-module/blocks/widget-area/index.js.map +1 -1
  31. package/build-module/components/header/document-tools/index.js +19 -18
  32. package/build-module/components/header/document-tools/index.js.map +1 -1
  33. package/build-module/components/header/index.js +5 -13
  34. package/build-module/components/header/index.js.map +1 -1
  35. package/build-module/components/header/undo-redo/redo.js +7 -3
  36. package/build-module/components/header/undo-redo/redo.js.map +1 -1
  37. package/build-module/components/header/undo-redo/undo.js +7 -3
  38. package/build-module/components/header/undo-redo/undo.js.map +1 -1
  39. package/build-module/components/layout/interface.js +3 -8
  40. package/build-module/components/layout/interface.js.map +1 -1
  41. package/build-module/components/secondary-sidebar/index.js +2 -6
  42. package/build-module/components/secondary-sidebar/index.js.map +1 -1
  43. package/build-module/components/secondary-sidebar/list-view-sidebar.js +8 -6
  44. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  45. package/build-module/components/widget-areas-block-editor-content/index.js +6 -2
  46. package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
  47. package/build-module/components/widget-areas-block-editor-provider/index.js +4 -2
  48. package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
  49. package/build-module/store/index.js +3 -0
  50. package/build-module/store/index.js.map +1 -1
  51. package/build-module/store/private-selectors.js +4 -0
  52. package/build-module/store/private-selectors.js.map +1 -0
  53. package/build-module/store/reducer.js +13 -0
  54. package/build-module/store/reducer.js.map +1 -1
  55. package/build-style/style-rtl.css +25 -5
  56. package/build-style/style.css +25 -5
  57. package/package.json +30 -29
  58. package/src/blocks/widget-area/block.json +1 -0
  59. package/src/components/header/document-tools/index.js +19 -23
  60. package/src/components/header/index.js +4 -9
  61. package/src/components/header/style.scss +25 -5
  62. package/src/components/header/undo-redo/redo.js +8 -3
  63. package/src/components/header/undo-redo/undo.js +8 -3
  64. package/src/components/layout/interface.js +3 -14
  65. package/src/components/secondary-sidebar/index.js +2 -4
  66. package/src/components/secondary-sidebar/list-view-sidebar.js +6 -4
  67. package/src/components/widget-areas-block-editor-content/index.js +4 -0
  68. package/src/components/widget-areas-block-editor-provider/index.js +4 -1
  69. package/src/store/index.js +4 -0
  70. package/src/store/private-selectors.js +3 -0
  71. package/src/store/reducer.js +11 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.25.0 (2023-12-13)
6
+
5
7
  ## 5.24.0 (2023-11-29)
6
8
 
7
9
  ## 5.23.0 (2023-11-16)
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Gutenberg
2
2
 
3
- Copyright 2016-2023 by the contributors
3
+ Copyright 2016-2024 by the contributors
4
4
 
5
5
  **License for Contributions (on and after April 15, 2021)**
6
6
 
@@ -14,6 +14,7 @@ var _edit = _interopRequireDefault(require("./edit"));
14
14
  * Internal dependencies
15
15
  */
16
16
  const metadata = {
17
+ $schema: "https://schemas.wp.org/trunk/block.json",
17
18
  name: "core/widget-area",
18
19
  category: "widgets",
19
20
  attributes: {
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_edit","_interopRequireDefault","metadata","name","category","attributes","id","type","supports","html","inserter","customClassName","reusable","__experimentalToolbar","__experimentalParentSelector","__experimentalDisableBlockOverlay","editorStyle","style","exports","settings","title","__","description","__experimentalLabel","label","edit"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\tedit,\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAG,QAAA;EAAAC,IAAA;EAAAC,QAAA;EAAAC,UAAA;IAAAC,EAAA;MAAAC,IAAA;IAAA;IAAAJ,IAAA;MAAAI,IAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,QAAA;IAAAC,eAAA;IAAAC,QAAA;IAAAC,qBAAA;IAAAC,4BAAA;IAAAC,iCAAA;EAAA;EAAAC,WAAA;EAAAC,KAAA;AAAA;AAAAC,OAAA,CAAAhB,QAAA,GAAAA,QAAA;AAMA,MAAM;EAAEC;AAAK,CAAC,GAAGD,QAAQ;AAACgB,OAAA,CAAAf,IAAA,GAAAA,IAAA;AAGnB,MAAMgB,QAAQ,GAAG;EACvBC,KAAK,EAAE,IAAAC,QAAE,EAAE,aAAc,CAAC;EAC1BC,WAAW,EAAE,IAAAD,QAAE,EAAE,0BAA2B,CAAC;EAC7CE,mBAAmB,EAAEA,CAAE;IAAEpB,IAAI,EAAEqB;EAAM,CAAC,KAAMA,KAAK;EACjDC,IAAI,EAAJA;AACD,CAAC;AAACP,OAAA,CAAAC,QAAA,GAAAA,QAAA"}
1
+ {"version":3,"names":["_i18n","require","_edit","_interopRequireDefault","metadata","$schema","name","category","attributes","id","type","supports","html","inserter","customClassName","reusable","__experimentalToolbar","__experimentalParentSelector","__experimentalDisableBlockOverlay","editorStyle","style","exports","settings","title","__","description","__experimentalLabel","label","edit"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\tedit,\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAG,QAAA;EAAAC,OAAA;EAAAC,IAAA;EAAAC,QAAA;EAAAC,UAAA;IAAAC,EAAA;MAAAC,IAAA;IAAA;IAAAJ,IAAA;MAAAI,IAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,QAAA;IAAAC,eAAA;IAAAC,QAAA;IAAAC,qBAAA;IAAAC,4BAAA;IAAAC,iCAAA;EAAA;EAAAC,WAAA;EAAAC,KAAA;AAAA;AAAAC,OAAA,CAAAjB,QAAA,GAAAA,QAAA;AAMA,MAAM;EAAEE;AAAK,CAAC,GAAGF,QAAQ;AAACiB,OAAA,CAAAf,IAAA,GAAAA,IAAA;AAGnB,MAAMgB,QAAQ,GAAG;EACvBC,KAAK,EAAE,IAAAC,QAAE,EAAE,aAAc,CAAC;EAC1BC,WAAW,EAAE,IAAAD,QAAE,EAAE,0BAA2B,CAAC;EAC7CE,mBAAmB,EAAEA,CAAE;IAAEpB,IAAI,EAAEqB;EAAM,CAAC,KAAMA,KAAK;EACjDC,IAAI,EAAJA;AACD,CAAC;AAACP,OAAA,CAAAC,QAAA,GAAAA,QAAA"}
@@ -27,26 +27,27 @@ var _lockUnlock = require("../../../lock-unlock");
27
27
  */
28
28
 
29
29
  const {
30
- useShouldContextualToolbarShow
30
+ useCanBlockToolbarBeFocused
31
31
  } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
32
- function DocumentTools({
33
- setListViewToggleElement
34
- }) {
32
+ function DocumentTools() {
35
33
  const isMediumViewport = (0, _compose.useViewportMatch)('medium');
36
34
  const inserterButton = (0, _element.useRef)();
37
35
  const widgetAreaClientId = (0, _useLastSelectedWidgetArea.default)();
38
36
  const isLastSelectedWidgetAreaOpen = (0, _data.useSelect)(select => select(_store.store).getIsWidgetAreaOpen(widgetAreaClientId), [widgetAreaClientId]);
39
37
  const {
40
38
  isInserterOpen,
41
- isListViewOpen
39
+ isListViewOpen,
40
+ listViewToggleRef
42
41
  } = (0, _data.useSelect)(select => {
43
42
  const {
44
43
  isInserterOpened,
45
- isListViewOpened
46
- } = select(_store.store);
44
+ isListViewOpened,
45
+ getListViewToggleRef
46
+ } = (0, _lockUnlock.unlock)(select(_store.store));
47
47
  return {
48
48
  isInserterOpen: isInserterOpened(),
49
- isListViewOpen: isListViewOpened()
49
+ isListViewOpen: isListViewOpened(),
50
+ listViewToggleRef: getListViewToggleRef()
50
51
  };
51
52
  }, []);
52
53
  const {
@@ -77,18 +78,14 @@ function DocumentTools({
77
78
  }
78
79
  };
79
80
  const toggleListView = (0, _element.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
80
- const {
81
- shouldShowContextualToolbar,
82
- canFocusHiddenToolbar,
83
- fixedToolbarCanBeFocused
84
- } = useShouldContextualToolbarShow();
81
+
85
82
  // If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
86
- // There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.
87
- const blockToolbarCanBeFocused = shouldShowContextualToolbar || canFocusHiddenToolbar || fixedToolbarCanBeFocused;
83
+ const blockToolbarCanBeFocused = useCanBlockToolbarBeFocused();
88
84
  return (0, _react.createElement)(_blockEditor.NavigableToolbar, {
89
85
  className: "edit-widgets-header-toolbar",
90
86
  "aria-label": (0, _i18n.__)('Document tools'),
91
- shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused
87
+ shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused,
88
+ variant: "unstyled"
92
89
  }, (0, _react.createElement)(_components.ToolbarItem, {
93
90
  ref: inserterButton,
94
91
  as: _components.Button,
@@ -103,7 +100,11 @@ function DocumentTools({
103
100
  /* translators: button label text should, if possible, be under 16
104
101
  characters. */,
105
102
  label: (0, _i18n._x)('Toggle block inserter', 'Generic label for block inserter button')
106
- }), isMediumViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_undo.default, null), (0, _react.createElement)(_redo.default, null), (0, _react.createElement)(_components.ToolbarItem, {
103
+ }), isMediumViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.ToolbarItem, {
104
+ as: _undo.default
105
+ }), (0, _react.createElement)(_components.ToolbarItem, {
106
+ as: _redo.default
107
+ }), (0, _react.createElement)(_components.ToolbarItem, {
107
108
  as: _components.Button,
108
109
  className: "edit-widgets-header-toolbar__list-view-toggle",
109
110
  icon: _icons.listView,
@@ -111,7 +112,7 @@ function DocumentTools({
111
112
  /* translators: button label text should, if possible, be under 16 characters. */,
112
113
  label: (0, _i18n.__)('List View'),
113
114
  onClick: toggleListView,
114
- ref: setListViewToggleElement
115
+ ref: listViewToggleRef
115
116
  })));
116
117
  }
117
118
  var _default = DocumentTools;
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_components","_blockEditor","_icons","_element","_compose","_undo","_interopRequireDefault","_redo","_useLastSelectedWidgetArea","_store","_lockUnlock","useShouldContextualToolbarShow","unlock","blockEditorPrivateApis","DocumentTools","setListViewToggleElement","isMediumViewport","useViewportMatch","inserterButton","useRef","widgetAreaClientId","useLastSelectedWidgetArea","isLastSelectedWidgetAreaOpen","useSelect","select","editWidgetsStore","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","useDispatch","selectBlock","blockEditorStore","handleClick","window","requestAnimationFrame","toggleListView","useCallback","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","_react","createElement","NavigableToolbar","className","__","shouldUseKeyboardFocusShortcut","ToolbarItem","ref","as","Button","variant","isPressed","onMouseDown","event","preventDefault","onClick","icon","plus","label","_x","Fragment","default","listView","_default","exports"],"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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,KAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,KAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,0BAAA,GAAAF,sBAAA,CAAAR,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AAtBA;AACA;AACA;;AAaA;AACA;AACA;;AAOA,MAAM;EAAEa;AAA+B,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE3E,SAASC,aAAaA,CAAE;EAAEC;AAAyB,CAAC,EAAG;EACtD,MAAMC,gBAAgB,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;EACrD,MAAMC,cAAc,GAAG,IAAAC,eAAM,EAAC,CAAC;EAC/B,MAAMC,kBAAkB,GAAG,IAAAC,kCAAyB,EAAC,CAAC;EACtD,MAAMC,4BAA4B,GAAG,IAAAC,eAAS,EAC3CC,MAAM,IACPA,MAAM,CAAEC,YAAiB,CAAC,CAACC,mBAAmB,CAC7CN,kBACD,CAAC,EACF,C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BAAgB;IAChBC,SAAS,EAAC,6BAA6B;IACvC,cAAa,IAAAC,QAAE,EAAE,gBAAiB,CAAG;IACrCC,8BAA8B,EAAG,CAAEN;EAA0B,GAE7D,IAAAC,MAAA,CAAAC,aAAA,EAAC/C,WAAA,CAAAoD,WAAW;IACXC,GAAG,EAAGnC,cAAgB;IACtBoC,EAAE,EAAGC,kBAAQ;IACbN,SAAS,EAAC,8CAA8C;IACxDO,OAAO,EAAC,SAAS;IACjBC,SAAS,EAAG9B,cAAgB;IAC5B+B,WAAW,EAAKC,KAAK,IAAM;MAC1BA,KAAK,CAACC,cAAc,CAAC,CAAC;IACvB,CAAG;IACHC,OAAO,EAAGxB,WAAa;IACvByB,IAAI,EAAGC;IACP;AACJ,mBADI;IAEAC,KAAK,EAAG,IAAAC,QAAE,EACT,uBAAuB,EACvB,yCACD;EAAG,CACH,CAAC,EACAjD,gBAAgB,IACjB,IAAA8B,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAoB,QAAA,QACC,IAAApB,MAAA,CAAAC,aAAA,EAAC1C,KAAA,CAAA8D,OAAU,MAAE,CAAC,EACd,IAAArB,MAAA,CAAAC,aAAA,EAACxC,KAAA,CAAA4D,OAAU,MAAE,CAAC,EACd,IAAArB,MAAA,CAAAC,aAAA,EAAC/C,WAAA,CAAAoD,WAAW;IACXE,EAAE,EAAGC,kBAAQ;IACbN,SAAS,EAAC,+CAA+C;IACzDa,IAAI,EAAGM,eAAU;IACjBX,SAAS,EAAG7B;IACZ;IACAoC,KAAK,EAAG,IAAAd,QAAE,EAAE,WAAY,CAAG;IAC3BW,OAAO,EAAGrB,cAAgB;IAC1Ba,GAAG,EAAGtC;EAA0B,CAChC,CACA,CAEc,CAAC;AAErB;AAAC,IAAAsD,QAAA,GAEcvD,aAAa;AAAAwD,OAAA,CAAAH,OAAA,GAAAE,QAAA"}
1
+ {"version":3,"names":["_data","require","_i18n","_components","_blockEditor","_icons","_element","_compose","_undo","_interopRequireDefault","_redo","_useLastSelectedWidgetArea","_store","_lockUnlock","useCanBlockToolbarBeFocused","unlock","blockEditorPrivateApis","DocumentTools","isMediumViewport","useViewportMatch","inserterButton","useRef","widgetAreaClientId","useLastSelectedWidgetArea","isLastSelectedWidgetAreaOpen","useSelect","select","editWidgetsStore","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","listViewToggleRef","isInserterOpened","isListViewOpened","getListViewToggleRef","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","useDispatch","selectBlock","blockEditorStore","handleClick","window","requestAnimationFrame","toggleListView","useCallback","blockToolbarCanBeFocused","_react","createElement","NavigableToolbar","className","__","shouldUseKeyboardFocusShortcut","variant","ToolbarItem","ref","as","Button","isPressed","onMouseDown","event","preventDefault","onClick","icon","plus","label","_x","Fragment","UndoButton","RedoButton","listView","_default","exports","default"],"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\tvariant=\"unstyled\"\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<ToolbarItem as={ UndoButton } />\n\t\t\t\t\t<ToolbarItem as={ 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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAC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ACP;AACJ,mBADI;IAEAC,KAAK,EAAG,IAAAC,QAAE,EACT,uBAAuB,EACvB,yCACD;EAAG,CACH,CAAC,EACAhD,gBAAgB,IACjB,IAAA6B,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAoB,QAAA,QACC,IAAApB,MAAA,CAAAC,aAAA,EAAC7C,WAAA,CAAAmD,WAAW;IAACE,EAAE,EAAGY;EAAY,CAAE,CAAC,EACjC,IAAArB,MAAA,CAAAC,aAAA,EAAC7C,WAAA,CAAAmD,WAAW;IAACE,EAAE,EAAGa;EAAY,CAAE,CAAC,EACjC,IAAAtB,MAAA,CAAAC,aAAA,EAAC7C,WAAA,CAAAmD,WAAW;IACXE,EAAE,EAAGC,kBAAQ;IACbP,SAAS,EAAC,+CAA+C;IACzDa,IAAI,EAAGO,eAAU;IACjBZ,SAAS,EAAG5B;IACZ;IACAmC,KAAK,EAAG,IAAAd,QAAE,EAAE,WAAY,CAAG;IAC3BW,OAAO,EAAGlB,cAAgB;IAC1BW,GAAG,EAAGxB;EAAmB,CACzB,CACA,CAEc,CAAC;AAErB;AAAC,IAAAwC,QAAA,GAEctD,aAAa;AAAAuD,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -17,7 +17,6 @@ var _preferences = require("@wordpress/preferences");
17
17
  var _documentTools = _interopRequireDefault(require("./document-tools"));
18
18
  var _saveButton = _interopRequireDefault(require("../save-button"));
19
19
  var _moreMenu = _interopRequireDefault(require("../more-menu"));
20
- var _lockUnlock = require("../../lock-unlock");
21
20
  /**
22
21
  * WordPress dependencies
23
22
  */
@@ -26,12 +25,7 @@ var _lockUnlock = require("../../lock-unlock");
26
25
  * Internal dependencies
27
26
  */
28
27
 
29
- const {
30
- BlockContextualToolbar
31
- } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
32
- function Header({
33
- setListViewToggleElement
34
- }) {
28
+ function Header() {
35
29
  const isLargeViewport = (0, _compose.useViewportMatch)('medium');
36
30
  const blockToolbarRef = (0, _element.useRef)();
37
31
  const {
@@ -48,12 +42,10 @@ function Header({
48
42
  }, (0, _i18n.__)('Widgets')), !isLargeViewport && (0, _react.createElement)(_components.VisuallyHidden, {
49
43
  as: "h1",
50
44
  className: "edit-widgets-header__title"
51
- }, (0, _i18n.__)('Widgets')), (0, _react.createElement)(_documentTools.default, {
52
- setListViewToggleElement: setListViewToggleElement
53
- }), hasFixedToolbar && isLargeViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
45
+ }, (0, _i18n.__)('Widgets')), (0, _react.createElement)(_documentTools.default, null), hasFixedToolbar && isLargeViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
54
46
  className: "selected-block-tools-wrapper"
55
- }, (0, _react.createElement)(BlockContextualToolbar, {
56
- isFixed: true
47
+ }, (0, _react.createElement)(_blockEditor.BlockToolbar, {
48
+ hideDragHandle: true
57
49
  })), (0, _react.createElement)(_components.Popover.Slot, {
58
50
  ref: blockToolbarRef,
59
51
  name: "block-toolbar"
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_components","_interface","_compose","_preferences","_documentTools","_interopRequireDefault","_saveButton","_moreMenu","_lockUnlock","BlockContextualToolbar","unlock","blockEditorPrivateApis","Header","setListViewToggleElement","isLargeViewport","useViewportMatch","blockToolbarRef","useRef","hasFixedToolbar","useSelect","select","preferencesStore","get","_react","createElement","Fragment","className","__","VisuallyHidden","as","default","isFixed","Popover","Slot","ref","name","PinnedItems","scope","_default","exports"],"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } 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';\nimport { unlock } from '../../lock-unlock';\n\nconst { BlockContextualToolbar } = unlock( blockEditorPrivateApis );\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<BlockContextualToolbar isFixed />\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":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,cAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,WAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,SAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AAlBA;AACA;AACA;;AAUA;AACA;AACA;;AAMA,MAAM;EAAEa;AAAuB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEnE,SAASC,MAAMA,CAAE;EAAEC;AAAyB,CAAC,EAAG;EAC/C,MAAMC,eAAe,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;EACpD,MAAMC,eAAe,GAAG,IAAAC,eAAM,EAAC,CAAC;EAChC,MAAM;IAAEC;EAAgB,CAAC,GAAG,IAAAC,eAAS,EAClCC,MAAM,KAAQ;IACfF,eAAe,EAAE,CAAC,CAAEE,MAAM,CAAEC,kBAAiB,CAAC,CAACC,GAAG,CACjD,mBAAmB,EACnB,cACD;EACD,CAAC,CAAE,EACH,EACD,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA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AQ,QAAA,GAEc1B,MAAM;AAAA2B,OAAA,CAAAT,OAAA,GAAAQ,QAAA"}
1
+ {"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_components","_interface","_compose","_preferences","_documentTools","_interopRequireDefault","_saveButton","_moreMenu","Header","isLargeViewport","useViewportMatch","blockToolbarRef","useRef","hasFixedToolbar","useSelect","select","preferencesStore","get","_react","createElement","Fragment","className","__","VisuallyHidden","as","default","BlockToolbar","hideDragHandle","Popover","Slot","ref","name","PinnedItems","scope","_default","exports"],"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\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,cAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,WAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,SAAA,GAAAF,sBAAA,CAAAT,OAAA;AAjBA;AACA;AACA;;AAUA;AACA;AACA;;AAKA,SAASY,MAAMA,CAAA,EAAG;EACjB,MAAMC,eAAe,GAAG,IAAA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C,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC5C,IAAAH,MAAA,CAAAC,aAAA,EAACb,WAAA,CAAAmB,OAAU,MAAE,CAAC,EACd,IAAAP,MAAA,CAAAC,aAAA,EAAClB,UAAA,CAAA+B,WAAW,CAACH,IAAI;IAACI,KAAK,EAAC;EAAmB,CAAE,CAAC,EAC9C,IAAAf,MAAA,CAAAC,aAAA,EAACZ,SAAA,CAAAkB,OAAQ,MAAE,CACP,CACD,CACJ,CAAC;AAEL;AAAC,IAAAS,QAAA,GAEc1B,MAAM;AAAA2B,OAAA,CAAAV,OAAA,GAAAS,QAAA"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = RedoButton;
6
+ exports.default = void 0;
7
7
  var _react = require("react");
8
8
  var _i18n = require("@wordpress/i18n");
9
9
  var _components = require("@wordpress/components");
@@ -11,17 +11,20 @@ var _data = require("@wordpress/data");
11
11
  var _icons = require("@wordpress/icons");
12
12
  var _keycodes = require("@wordpress/keycodes");
13
13
  var _coreData = require("@wordpress/core-data");
14
+ var _element = require("@wordpress/element");
14
15
  /**
15
16
  * WordPress dependencies
16
17
  */
17
18
 
18
- function RedoButton() {
19
+ function RedoButton(props, ref) {
19
20
  const shortcut = (0, _keycodes.isAppleOS)() ? _keycodes.displayShortcut.primaryShift('z') : _keycodes.displayShortcut.primary('y');
20
21
  const hasRedo = (0, _data.useSelect)(select => select(_coreData.store).hasRedo(), []);
21
22
  const {
22
23
  redo
23
24
  } = (0, _data.useDispatch)(_coreData.store);
24
- return (0, _react.createElement)(_components.ToolbarButton, {
25
+ return (0, _react.createElement)(_components.Button, {
26
+ ...props,
27
+ ref: ref,
25
28
  icon: !(0, _i18n.isRTL)() ? _icons.redo : _icons.undo,
26
29
  label: (0, _i18n.__)('Redo'),
27
30
  shortcut: shortcut
@@ -33,4 +36,6 @@ function RedoButton() {
33
36
  onClick: hasRedo ? redo : undefined
34
37
  });
35
38
  }
39
+ var _default = (0, _element.forwardRef)(RedoButton);
40
+ exports.default = _default;
36
41
  //# sourceMappingURL=redo.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","RedoButton","shortcut","isAppleOS","displayShortcut","primaryShift","primary","hasRedo","useSelect","select","coreStore","redo","useDispatch","_react","createElement","ToolbarButton","icon","isRTL","redoIcon","undoIcon","label","__","onClick","undefined"],"sources":["@wordpress/edit-widgets/src/components/header/undo-redo/redo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { redo as redoIcon, undo as undoIcon } from '@wordpress/icons';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\n\nexport default function RedoButton() {\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tconst hasRedo = useSelect(\n\t\t( select ) => select( coreStore ).hasRedo(),\n\t\t[]\n\t);\n\tconst { redo } = useDispatch( coreStore );\n\treturn (\n\t\t<ToolbarButton\n\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\tlabel={ __( 'Redo' ) }\n\t\t\tshortcut={ shortcut }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasRedo }\n\t\t\tonClick={ hasRedo ? redo : undefined }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AARA;AACA;AACA;;AAQe,SAASM,UAAUA,CAAA,EAAG;EACpC,MAAMC,QAAQ,GAAG,IAAAC,mBAAS,EAAC,CAAC,GACzBC,yBAAe,CAACC,YAAY,CAAE,GAAI,CAAC,GACnCD,yBAAe,CAACE,OAAO,CAAE,GAAI,CAAC;EAEjC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,eAAU,CAAC,CAACH,OAAO,CAAC,CAAC,EAC3C,EACD,CAAC;EACD,MAAM;IAAEI;EAAK,CAAC,GAAG,IAAAC,iBAAW,EAAEF,eAAU,CAAC;EACzC,OACC,IAAAG,MAAA,CAAAC,aAAA,EAAClB,WAAA,CAAAmB,aAAa;IACbC,IAAI,EAAG,CAAE,IAAAC,WAAK,EAAC,CAAC,GAAGC,WAAQ,GAAGC,WAAU;IACxCC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBnB,QAAQ,EAAGA;IACX;IACA;IACA;IAAA;IACA,iBAAgB,CAAEK,OAAS;IAC3Be,OAAO,EAAGf,OAAO,GAAGI,IAAI,GAAGY;EAAW,CACtC,CAAC;AAEJ"}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","_element","RedoButton","props","ref","shortcut","isAppleOS","displayShortcut","primaryShift","primary","hasRedo","useSelect","select","coreStore","redo","useDispatch","_react","createElement","Button","icon","isRTL","redoIcon","undoIcon","label","__","onClick","undefined","_default","forwardRef","exports","default"],"sources":["@wordpress/edit-widgets/src/components/header/undo-redo/redo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { redo as redoIcon, undo as undoIcon } from '@wordpress/icons';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\nfunction RedoButton( props, ref ) {\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tconst hasRedo = useSelect(\n\t\t( select ) => select( coreStore ).hasRedo(),\n\t\t[]\n\t);\n\tconst { redo } = useDispatch( coreStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\tlabel={ __( 'Redo' ) }\n\t\t\tshortcut={ shortcut }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasRedo }\n\t\t\tonClick={ hasRedo ? redo : undefined }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( RedoButton );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AATA;AACA;AACA;;AASA,SAASO,UAAUA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACjC,MAAMC,QAAQ,GAAG,IAAAC,mBAAS,EAAC,CAAC,GACzBC,yBAAe,CAACC,YAAY,CAAE,GAAI,CAAC,GACnCD,yBAAe,CAACE,OAAO,CAAE,GAAI,CAAC;EAEjC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,eAAU,CAAC,CAACH,OAAO,CAAC,CAAC,EAC3C,EACD,CAAC;EACD,MAAM;IAAEI;EAAK,CAAC,GAAG,IAAAC,iBAAW,EAAEF,eAAU,CAAC;EACzC,OACC,IAAAG,MAAA,CAAAC,aAAA,EAACrB,WAAA,CAAAsB,MAAM;IAAA,GACDf,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXe,IAAI,EAAG,CAAE,IAAAC,WAAK,EAAC,CAAC,GAAGC,WAAQ,GAAGC,WAAU;IACxCC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBnB,QAAQ,EAAGA;IACX;IACA;IACA;IAAA;IACA,iBAAgB,CAAEK,OAAS;IAC3Be,OAAO,EAAGf,OAAO,GAAGI,IAAI,GAAGY;EAAW,CACtC,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEc,IAAAC,mBAAU,EAAE1B,UAAW,CAAC;AAAA2B,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = UndoButton;
6
+ exports.default = void 0;
7
7
  var _react = require("react");
8
8
  var _i18n = require("@wordpress/i18n");
9
9
  var _components = require("@wordpress/components");
@@ -11,16 +11,19 @@ var _data = require("@wordpress/data");
11
11
  var _icons = require("@wordpress/icons");
12
12
  var _keycodes = require("@wordpress/keycodes");
13
13
  var _coreData = require("@wordpress/core-data");
14
+ var _element = require("@wordpress/element");
14
15
  /**
15
16
  * WordPress dependencies
16
17
  */
17
18
 
18
- function UndoButton() {
19
+ function UndoButton(props, ref) {
19
20
  const hasUndo = (0, _data.useSelect)(select => select(_coreData.store).hasUndo(), []);
20
21
  const {
21
22
  undo
22
23
  } = (0, _data.useDispatch)(_coreData.store);
23
- return (0, _react.createElement)(_components.ToolbarButton, {
24
+ return (0, _react.createElement)(_components.Button, {
25
+ ...props,
26
+ ref: ref,
24
27
  icon: !(0, _i18n.isRTL)() ? _icons.undo : _icons.redo,
25
28
  label: (0, _i18n.__)('Undo'),
26
29
  shortcut: _keycodes.displayShortcut.primary('z')
@@ -32,4 +35,6 @@ function UndoButton() {
32
35
  onClick: hasUndo ? undo : undefined
33
36
  });
34
37
  }
38
+ var _default = (0, _element.forwardRef)(UndoButton);
39
+ exports.default = _default;
35
40
  //# sourceMappingURL=undo.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","UndoButton","hasUndo","useSelect","select","coreStore","undo","useDispatch","_react","createElement","ToolbarButton","icon","isRTL","undoIcon","redoIcon","label","__","shortcut","displayShortcut","primary","onClick","undefined"],"sources":["@wordpress/edit-widgets/src/components/header/undo-redo/undo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\n\nexport default function UndoButton() {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( coreStore ).hasUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( coreStore );\n\treturn (\n\t\t<ToolbarButton\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AARA;AACA;AACA;;AAQe,SAASM,UAAUA,CAAA,EAAG;EACpC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,eAAU,CAAC,CAACH,OAAO,CAAC,CAAC,EAC3C,EACD,CAAC;EACD,MAAM;IAAEI;EAAK,CAAC,GAAG,IAAAC,iBAAW,EAAEF,eAAU,CAAC;EACzC,OACC,IAAAG,MAAA,CAAAC,aAAA,EAACb,WAAA,CAAAc,aAAa;IACbC,IAAI,EAAG,CAAE,IAAAC,WAAK,EAAC,CAAC,GAAGC,WAAQ,GAAGC,WAAU;IACxCC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBC,QAAQ,EAAGC,yBAAe,CAACC,OAAO,CAAE,GAAI;IACxC;IACA;IACA;IAAA;IACA,iBAAgB,CAAEjB,OAAS;IAC3BkB,OAAO,EAAGlB,OAAO,GAAGI,IAAI,GAAGe;EAAW,CACtC,CAAC;AAEJ"}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","_element","UndoButton","props","ref","hasUndo","useSelect","select","coreStore","undo","useDispatch","_react","createElement","Button","icon","isRTL","undoIcon","redoIcon","label","__","shortcut","displayShortcut","primary","onClick","undefined","_default","forwardRef","exports","default"],"sources":["@wordpress/edit-widgets/src/components/header/undo-redo/undo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\nfunction UndoButton( props, ref ) {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( coreStore ).hasUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( coreStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( UndoButton );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AATA;AACA;AACA;;AASA,SAASO,UAAUA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACjC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,eAAU,CAAC,CAACH,OAAO,CAAC,CAAC,EAC3C,EACD,CAAC;EACD,MAAM;IAAEI;EAAK,CAAC,GAAG,IAAAC,iBAAW,EAAEF,eAAU,CAAC;EACzC,OACC,IAAAG,MAAA,CAAAC,aAAA,EAAChB,WAAA,CAAAiB,MAAM;IAAA,GACDV,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXU,IAAI,EAAG,CAAE,IAAAC,WAAK,EAAC,CAAC,GAAGC,WAAQ,GAAGC,WAAU;IACxCC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBC,QAAQ,EAAGC,yBAAe,CAACC,OAAO,CAAE,GAAI;IACxC;IACA;IACA;IAAA;IACA,iBAAgB,CAAEjB,OAAS;IAC3BkB,OAAO,EAAGlB,OAAO,GAAGI,IAAI,GAAGe;EAAW,CACtC,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEc,IAAAC,mBAAU,EAAExB,UAAW,CAAC;AAAAyB,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
@@ -61,7 +61,6 @@ function Interface({
61
61
  previousShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-widgets/previous-region'),
62
62
  nextShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-widgets/next-region')
63
63
  }), []);
64
- const [listViewToggleElement, setListViewToggleElement] = (0, _element.useState)(null);
65
64
 
66
65
  // Inserter and Sidebars are mutually exclusive
67
66
  (0, _element.useEffect)(() => {
@@ -82,12 +81,8 @@ function Interface({
82
81
  ...interfaceLabels,
83
82
  secondarySidebar: secondarySidebarLabel
84
83
  },
85
- header: (0, _react.createElement)(_header.default, {
86
- setListViewToggleElement: setListViewToggleElement
87
- }),
88
- secondarySidebar: hasSecondarySidebar && (0, _react.createElement)(_secondarySidebar.default, {
89
- listViewToggleElement: listViewToggleElement
90
- }),
84
+ header: (0, _react.createElement)(_header.default, null),
85
+ secondarySidebar: hasSecondarySidebar && (0, _react.createElement)(_secondarySidebar.default, null),
91
86
  sidebar: hasSidebarEnabled && (0, _react.createElement)(_interface.ComplementaryArea.Slot, {
92
87
  scope: "core/edit-widgets"
93
88
  }),
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_blockEditor","_element","_data","_interface","_i18n","_keyboardShortcuts","_preferences","_header","_interopRequireDefault","_widgetAreasBlockEditorContent","_store","_secondarySidebar","interfaceLabels","header","__","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","useViewportMatch","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","useDispatch","editWidgetsStore","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","previousShortcut","nextShortcut","useSelect","select","interfaceStore","getActiveComplementaryArea","name","preferencesStore","get","keyboardShortcutsStore","getAllShortcutKeyCombinations","listViewToggleElement","setListViewToggleElement","useState","useEffect","secondarySidebarLabel","hasSecondarySidebar","_react","createElement","InterfaceSkeleton","labels","secondarySidebar","default","ComplementaryArea","Slot","scope","content","Fragment","className","BlockBreadcrumb","rootLabelText","shortcuts","previous","next","_default","exports"],"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":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,OAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,8BAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,iBAAA,GAAAH,sBAAA,CAAAT,OAAA;AAtBA;AACA;AACA;;AAcA;AACA;AACA;;AAMA,MAAMa,eAAe,GAAG;EACvB;EACAC,MAAM,EAAE,IAAAC,QAAE,EAAE,iBAAkB,CAAC;EAC/B;EACAC,IAAI,EAAE,IAAAD,QAAE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,QAAA,QACC,IAAAV,MAAA,CAAAC,aAAA,EAACzC,8BAAA,CAAA6C,OAA6B;MAC7BnC,mBAAmB,EAAGA;IAAqB,CAC3C,CACA,CACF;IACDF,MAAM,EACLW,0BAA0B,IAC1B,CAAER,gBAAgB,IACjB,IAAA6B,MAAA,CAAAC,aAAA;MAAKU,SAAS,EAAC;IAA6B,GAC3C,IAAAX,MAAA,CAAAC,aAAA,EAAClD,YAAA,CAAA6D,eAAe;MAACC,aAAa,EAAG,IAAAhD,QAAE,EAAE,SAAU;IAAG,CAAE,CAChD,CAEN;IACDiD,SAAS,EAAG;MACXC,QAAQ,EAAEhC,gBAAgB;MAC1BiC,IAAI,EAAEhC;IACP;EAAG,CACH,CAAC;AAEJ;AAAC,IAAAiC,QAAA,GAEchD,SAAS;AAAAiD,OAAA,CAAAb,OAAA,GAAAY,QAAA"}
1
+ {"version":3,"names":["_compose","require","_blockEditor","_element","_data","_interface","_i18n","_keyboardShortcuts","_preferences","_header","_interopRequireDefault","_widgetAreasBlockEditorContent","_store","_secondarySidebar","interfaceLabels","header","__","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","useViewportMatch","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","useDispatch","editWidgetsStore","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","previousShortcut","nextShortcut","useSelect","select","interfaceStore","getActiveComplementaryArea","name","preferencesStore","get","keyboardShortcutsStore","getAllShortcutKeyCombinations","useEffect","secondarySidebarLabel","hasSecondarySidebar","_react","createElement","InterfaceSkeleton","labels","secondarySidebar","default","ComplementaryArea","Slot","scope","content","Fragment","className","BlockBreadcrumb","rootLabelText","shortcuts","previous","next","_default","exports"],"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":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,OAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,8BAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,iBAAA,GAAAH,sBAAA,CAAAT,OAAA;AAtBA;AACA;AACA;;AAcA;AACA;AACA;;AAMA,MAAMa,eAAe,GAAG;EACvB;EACAC,MAAM,EAAE,IAAAC,QAAE,EAAE,iBAAkB,CAAC;EAC/B;EACAC,IAAI,EAAE,IAAAD,QAAE,EAAE,oBAAqB,CAAC;EAChC;EACAE,OAAO,EAAE,IAAAF,QAAE,EAAE,kBAAmB,CAAC;EACjC;EACAG,MAAM,EAAE,IAAAH,QAAE,EAAE,gBAAiB;AAC9B,CAAC;AAED,SAASI,SAASA,CAAE;EAAEC;AAAoB,CAAC,EAAG;EAC7C,MAAMC,gBAAgB,GAAG,IAAAC,yBAAgB,EAAE,QAAQ,EAAE,GAAI,CAAC;EAC1D,MAAMC,cAAc,GAAG,IAAAD,yBAAgB,EAAE,MAAM,EAAE,IAAK,CAAC;EACvD,MAAM;IAAEE,mBAAmB;IAAEC,mBAAmB;IAAEC;EAAoB,CAAC,GACtE,IAAAC,iBAAW,EAAEC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./list-view-sidebar"));
22
22
  * Internal dependencies
23
23
  */
24
24
 
25
- function SecondarySidebar({
26
- listViewToggleElement
27
- }) {
25
+ function SecondarySidebar() {
28
26
  const {
29
27
  isInserterOpen,
30
28
  isListViewOpen
@@ -42,9 +40,7 @@ function SecondarySidebar({
42
40
  return (0, _react.createElement)(_inserterSidebar.default, null);
43
41
  }
44
42
  if (isListViewOpen) {
45
- return (0, _react.createElement)(_listViewSidebar.default, {
46
- listViewToggleElement: listViewToggleElement
47
- });
43
+ return (0, _react.createElement)(_listViewSidebar.default, null);
48
44
  }
49
45
  return null;
50
46
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_store","_inserterSidebar","_interopRequireDefault","_listViewSidebar","SecondarySidebar","listViewToggleElement","isInserterOpen","isListViewOpen","useSelect","select","isInserterOpened","isListViewOpened","editWidgetsStore","_react","createElement","default"],"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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAD,sBAAA,CAAAH,OAAA;AAbA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;;AAIe,SAASK,gBAAgBA,CAAE;EAAEC;AAAsB,CAAC,EAAG;EACrE,MAAM;IAAEC,cAAc;IAAEC;EAAe,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACnE,MAAM;MAAEC,gBAAgB;MAAEC;IAAiB,CAAC,GAC3CF,MAAM,CAAEG,YAAiB,CAAC;IAC3B,OAAO;MACNN,cAAc,EAAEI,gBAAgB,CAAC,CAAC;MAClCH,cAAc,EAAEI,gBAAgB,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAKL,cAAc,EAAG;IACrB,OAAO,IAAAO,MAAA,CAAAC,aAAA,EAACb,gBAAA,CAAAc,OAAe,MAAE,CAAC;EAC3B;EACA,IAAKR,cAAc,EAAG;IACrB,OACC,IAAAM,MAAA,CAAAC,aAAA,EAACX,gBAAA,CAAAY,OAAe;MAACV,qBAAqB,EAAGA;IAAuB,CAAE,CAAC;EAErE;EACA,OAAO,IAAI;AACZ"}
1
+ {"version":3,"names":["_data","require","_store","_inserterSidebar","_interopRequireDefault","_listViewSidebar","SecondarySidebar","isInserterOpen","isListViewOpen","useSelect","select","isInserterOpened","isListViewOpened","editWidgetsStore","_react","createElement","default"],"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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAD,sBAAA,CAAAH,OAAA;AAbA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;;AAIe,SAASK,gBAAgBA,CAAA,EAAG;EAC1C,MAAM;IAAEC,cAAc;IAAEC;EAAe,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACnE,MAAM;MAAEC,gBAAgB;MAAEC;IAAiB,CAAC,GAC3CF,MAAM,CAAEG,YAAiB,CAAC;IAC3B,OAAO;MACNN,cAAc,EAAEI,gBAAgB,CAAC,CAAC;MAClCH,cAAc,EAAEI,gBAAgB,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAKL,cAAc,EAAG;IACrB,OAAO,IAAAO,MAAA,CAAAC,aAAA,EAACZ,gBAAA,CAAAa,OAAe,MAAE,CAAC;EAC3B;EACA,IAAKR,cAAc,EAAG;IACrB,OAAO,IAAAM,MAAA,CAAAC,aAAA,EAACV,gBAAA,CAAAW,OAAe,MAAE,CAAC;EAC3B;EACA,OAAO,IAAI;AACZ"}
@@ -14,6 +14,7 @@ var _i18n = require("@wordpress/i18n");
14
14
  var _icons = require("@wordpress/icons");
15
15
  var _keycodes = require("@wordpress/keycodes");
16
16
  var _store = require("../../store");
17
+ var _lockUnlock = require("../../lock-unlock");
17
18
  /**
18
19
  * WordPress dependencies
19
20
  */
@@ -22,12 +23,13 @@ var _store = require("../../store");
22
23
  * Internal dependencies
23
24
  */
24
25
 
25
- function ListViewSidebar({
26
- listViewToggleElement
27
- }) {
26
+ function ListViewSidebar() {
28
27
  const {
29
28
  setIsListViewOpened
30
29
  } = (0, _data.useDispatch)(_store.store);
30
+ const {
31
+ getListViewToggleRef
32
+ } = (0, _lockUnlock.unlock)((0, _data.useSelect)(_store.store));
31
33
 
32
34
  // Use internal state instead of a ref to make sure that the component
33
35
  // re-renders when the dropZoneElement updates.
@@ -37,8 +39,8 @@ function ListViewSidebar({
37
39
  // When closing the list view, focus should return to the toggle button.
38
40
  const closeListView = (0, _element.useCallback)(() => {
39
41
  setIsListViewOpened(false);
40
- listViewToggleElement?.focus();
41
- }, [listViewToggleElement, setIsListViewOpened]);
42
+ getListViewToggleRef().current?.focus();
43
+ }, [getListViewToggleRef, setIsListViewOpened]);
42
44
  const closeOnEscape = (0, _element.useCallback)(event => {
43
45
  if (event.keyCode === _keycodes.ESCAPE && !event.defaultPrevented) {
44
46
  event.preventDefault();
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_components","_compose","_data","_element","_i18n","_icons","_keycodes","_store","ListViewSidebar","listViewToggleElement","setIsListViewOpened","useDispatch","editWidgetsStore","dropZoneElement","setDropZoneElement","useState","focusOnMountRef","useFocusOnMount","closeListView","useCallback","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","_react","createElement","className","onKeyDown","__","Button","icon","closeSmall","label","onClick","ref","useMergeRefs","__experimentalListView"],"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":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,K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AAgC,MAAM;MACNC,IAAI,EAAGC,iBAAY;MACnBC,KAAK,EAAG,IAAAJ,QAAE,EAAE,OAAQ,CAAG;MACvBK,OAAO,EAAGlB;IAAe,CACzB,CACG,CAAC,EACN,IAAAS,MAAA,CAAAC,aAAA;MACCC,SAAS,EAAC,8CAA8C;MACxDQ,GAAG,EAAG,IAAAC,qBAAY,EAAE,CAAEtB,eAAe,EAAEF,kBAAkB,CAAG;IAAG,GAE/D,IAAAa,MAAA,CAAAC,aAAA,EAAC9B,YAAA,CAAAyC,sBAAQ;MAAC1B,eAAe,EAAGA;IAAiB,CAAE,CAC3C,CACD;EAAC;AAER"}
1
+ {"version":3,"names":["_blockEditor","require","_components","_compose","_data","_element","_i18n","_icons","_keycodes","_store","_lockUnlock","ListViewSidebar","setIsListViewOpened","useDispatch","editWidgetsStore","getListViewToggleRef","unlock","useSelect","dropZoneElement","setDropZoneElement","useState","focusOnMountRef","useFocusOnMount","closeListView","useCallback","current","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","_react","createElement","className","onKeyDown","__","Button","icon","closeSmall","label","onClick","ref","useMergeRefs","__experimentalListView"],"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":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAA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M;MACNC,IAAI,EAAGC,iBAAY;MACnBC,KAAK,EAAG,IAAAJ,QAAE,EAAE,OAAQ,CAAG;MACvBK,OAAO,EAAGnB;IAAe,CACzB,CACG,CAAC,EACN,IAAAU,MAAA,CAAAC,aAAA;MACCC,SAAS,EAAC,8CAA8C;MACxDQ,GAAG,EAAG,IAAAC,qBAAY,EAAE,CAAEvB,eAAe,EAAEF,kBAAkB,CAAG;IAAG,GAE/D,IAAAc,MAAA,CAAAC,aAAA,EAAClC,YAAA,CAAA6C,sBAAQ;MAAC3B,eAAe,EAAGA;IAAiB,CAAE,CAC3C,CACD;EAAC;AAER"}
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = WidgetAreasBlockEditorContent;
8
8
  var _react = require("react");
9
9
  var _blockEditor = require("@wordpress/block-editor");
10
+ var _compose = require("@wordpress/compose");
10
11
  var _data = require("@wordpress/data");
11
12
  var _element = require("@wordpress/element");
12
13
  var _preferences = require("@wordpress/preferences");
@@ -24,12 +25,15 @@ function WidgetAreasBlockEditorContent({
24
25
  blockEditorSettings
25
26
  }) {
26
27
  const hasThemeStyles = (0, _data.useSelect)(select => !!select(_preferences.store).get('core/edit-widgets', 'themeStyles'), []);
28
+ const isLargeViewport = (0, _compose.useViewportMatch)('medium');
27
29
  const styles = (0, _element.useMemo)(() => {
28
30
  return hasThemeStyles ? blockEditorSettings.styles : [];
29
31
  }, [blockEditorSettings, hasThemeStyles]);
30
32
  return (0, _react.createElement)("div", {
31
33
  className: "edit-widgets-block-editor"
32
- }, (0, _react.createElement)(_notices.default, null), (0, _react.createElement)(_blockEditor.BlockTools, null, (0, _react.createElement)(_keyboardShortcuts.default, null), (0, _react.createElement)(_blockEditor.__unstableEditorStyles, {
34
+ }, (0, _react.createElement)(_notices.default, null), !isLargeViewport && (0, _react.createElement)(_blockEditor.BlockToolbar, {
35
+ hideDragHandle: true
36
+ }), (0, _react.createElement)(_blockEditor.BlockTools, null, (0, _react.createElement)(_keyboardShortcuts.default, null), (0, _react.createElement)(_blockEditor.__unstableEditorStyles, {
33
37
  styles: styles,
34
38
  scope: ".editor-styles-wrapper"
35
39
  }), (0, _react.createElement)(_blockEditor.BlockSelectionClearer, null, (0, _react.createElement)(_blockEditor.WritingFlow, null, (0, _react.createElement)(_blockEditor.BlockList, {
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_data","_element","_preferences","_notices","_interopRequireDefault","_keyboardShortcuts","WidgetAreasBlockEditorContent","blockEditorSettings","hasThemeStyles","useSelect","select","preferencesStore","get","styles","useMemo","_react","createElement","className","default","BlockTools","__unstableEditorStyles","scope","BlockSelectionClearer","WritingFlow","BlockList"],"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-content/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tWritingFlow,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Notices from '../notices';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\n\nexport default function WidgetAreasBlockEditorContent( {\n\tblockEditorSettings,\n} ) {\n\tconst hasThemeStyles = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'themeStyles'\n\t\t\t),\n\t\t[]\n\t);\n\n\tconst styles = useMemo( () => {\n\t\treturn hasThemeStyles ? blockEditorSettings.styles : [];\n\t}, [ blockEditorSettings, hasThemeStyles ] );\n\n\treturn (\n\t\t<div className=\"edit-widgets-block-editor\">\n\t\t\t<Notices />\n\t\t\t<BlockTools>\n\t\t\t\t<KeyboardShortcuts />\n\t\t\t\t<EditorStyles\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tscope=\".editor-styles-wrapper\"\n\t\t\t\t/>\n\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t<WritingFlow>\n\t\t\t\t\t\t<BlockList className=\"edit-widgets-main-block-list\" />\n\t\t\t\t\t</WritingFlow>\n\t\t\t\t</BlockSelectionClearer>\n\t\t\t</BlockTools>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAD,sBAAA,CAAAL,OAAA;AAlBA;AACA;AACA;;AAYA;AACA;AACA;;AAIe,SAASO,6BAA6BA,CAAE;EACtDC;AACD,CAAC,EAAG;EACH,MAAMC,cAAc,GAAG,IAAAC,eAAS,EAC7BC,MAAM,IACP,CAAC,CAAEA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,GAAG,CAChC,mBAAmB,EACnB,aACD,CAAC,EACF,EACD,CAAC;EAED,MAAMC,MAAM,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAC7B,OAAON,cAAc,GAAGD,mBAAmB,CAACM,MAAM,GAAG,EAAE;EACxD,CAAC,EAAE,CAAEN,mBAAmB,EAAEC,cAAc,CAAG,CAAC;EAE5C,OACC,IAAAO,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA2B,GACzC,IAAAF,MAAA,CAAAC,aAAA,EAACb,QAAA,CAAAe,OAAO,MAAE,CAAC,EACX,IAAAH,MAAA,CAAAC,aAAA,EAAClB,YAAA,CAAAqB,UAAU,QACV,IAAAJ,MAAA,CAAAC,aAAA,EAACX,kBAAA,CAAAa,OAAiB,MAAE,CAAC,EACrB,IAAAH,MAAA,CAAAC,aAAA,EAAClB,YAAA,CAAAsB,sBAAY;IACZP,MAAM,EAAGA,MAAQ;IACjBQ,KAAK,EAAC;EAAwB,CAC9B,CAAC,EACF,IAAAN,MAAA,CAAAC,aAAA,EAAClB,YAAA,CAAAwB,qBAAqB,QACrB,IAAAP,MAAA,CAAAC,aAAA,EAAClB,YAAA,CAAAyB,WAAW,QACX,IAAAR,MAAA,CAAAC,aAAA,EAAClB,YAAA,CAAA0B,SAAS;IAACP,SAAS,EAAC;EAA8B,CAAE,CACzC,CACS,CACZ,CACR,CAAC;AAER"}
1
+ {"version":3,"names":["_blockEditor","require","_compose","_data","_element","_preferences","_notices","_interopRequireDefault","_keyboardShortcuts","WidgetAreasBlockEditorContent","blockEditorSettings","hasThemeStyles","useSelect","select","preferencesStore","get","isLargeViewport","useViewportMatch","styles","useMemo","_react","createElement","className","default","BlockToolbar","hideDragHandle","BlockTools","__unstableEditorStyles","scope","BlockSelectionClearer","WritingFlow","BlockList"],"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-content/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tBlockToolbar,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tWritingFlow,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Notices from '../notices';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\n\nexport default function WidgetAreasBlockEditorContent( {\n\tblockEditorSettings,\n} ) {\n\tconst hasThemeStyles = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'themeStyles'\n\t\t\t),\n\t\t[]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst styles = useMemo( () => {\n\t\treturn hasThemeStyles ? blockEditorSettings.styles : [];\n\t}, [ blockEditorSettings, hasThemeStyles ] );\n\n\treturn (\n\t\t<div className=\"edit-widgets-block-editor\">\n\t\t\t<Notices />\n\t\t\t{ ! isLargeViewport && <BlockToolbar hideDragHandle /> }\n\t\t\t<BlockTools>\n\t\t\t\t<KeyboardShortcuts />\n\t\t\t\t<EditorStyles\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tscope=\".editor-styles-wrapper\"\n\t\t\t\t/>\n\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t<WritingFlow>\n\t\t\t\t\t\t<BlockList className=\"edit-widgets-main-block-list\" />\n\t\t\t\t\t</WritingFlow>\n\t\t\t\t</BlockSelectionClearer>\n\t\t\t</BlockTools>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAQA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,QAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAD,sBAAA,CAAAN,OAAA;AApBA;AACA;AACA;;AAcA;AACA;AACA;;AAIe,SAASQ,6BAA6BA,CAAE;EACtDC;AACD,CAAC,EAAG;EACH,MAAMC,cAAc,GAAG,IAAAC,eAAS,EAC7BC,MAAM,IACP,CAAC,CAAEA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,GAAG,CAChC,mBAAmB,EACnB,aACD,CAAC,EACF,EACD,CAAC;EACD,MAAMC,eAAe,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;EAEpD,MAAMC,MAAM,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAC7B,OAAOR,cAAc,GAAGD,mBAAmB,CAACQ,MAAM,GAAG,EAAE;EACxD,CAAC,EAAE,CAAER,mBAAmB,EAAEC,cAAc,CAAG,CAAC;EAE5C,OACC,IAAAS,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA2B,GACzC,IAAAF,MAAA,CAAAC,aAA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