@wordpress/edit-widgets 5.34.0 → 6.0.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 (123) hide show
  1. package/CHANGELOG.md +15 -2
  2. package/build/blocks/widget-area/edit/index.js +33 -30
  3. package/build/blocks/widget-area/edit/index.js.map +1 -1
  4. package/build/blocks/widget-area/edit/inner-blocks.js +8 -7
  5. package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
  6. package/build/components/error-boundary/index.js +14 -12
  7. package/build/components/error-boundary/index.js.map +1 -1
  8. package/build/components/header/document-tools/index.js +40 -60
  9. package/build/components/header/document-tools/index.js.map +1 -1
  10. package/build/components/header/index.js +32 -22
  11. package/build/components/header/index.js.map +1 -1
  12. package/build/components/header/undo-redo/redo.js +2 -2
  13. package/build/components/header/undo-redo/redo.js.map +1 -1
  14. package/build/components/header/undo-redo/undo.js +2 -2
  15. package/build/components/header/undo-redo/undo.js.map +1 -1
  16. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
  17. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  18. package/build/components/keyboard-shortcut-help-modal/index.js +54 -49
  19. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  20. package/build/components/keyboard-shortcut-help-modal/shortcut.js +30 -26
  21. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  22. package/build/components/layout/index.js +11 -8
  23. package/build/components/layout/index.js.map +1 -1
  24. package/build/components/layout/interface.js +16 -13
  25. package/build/components/layout/interface.js.map +1 -1
  26. package/build/components/more-menu/index.js +81 -70
  27. package/build/components/more-menu/index.js.map +1 -1
  28. package/build/components/more-menu/tools-more-menu-group.js +5 -4
  29. package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
  30. package/build/components/notices/index.js +15 -13
  31. package/build/components/notices/index.js.map +1 -1
  32. package/build/components/save-button/index.js +5 -4
  33. package/build/components/save-button/index.js.map +1 -1
  34. package/build/components/secondary-sidebar/index.js +3 -3
  35. package/build/components/secondary-sidebar/index.js.map +1 -1
  36. package/build/components/secondary-sidebar/inserter-sidebar.js +21 -18
  37. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  38. package/build/components/secondary-sidebar/list-view-sidebar.js +21 -15
  39. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  40. package/build/components/sidebar/index.js +49 -37
  41. package/build/components/sidebar/index.js.map +1 -1
  42. package/build/components/sidebar/widget-areas.js +29 -22
  43. package/build/components/sidebar/widget-areas.js.map +1 -1
  44. package/build/components/welcome-guide/index.js +80 -53
  45. package/build/components/welcome-guide/index.js.map +1 -1
  46. package/build/components/widget-areas-block-editor-content/index.js +18 -11
  47. package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
  48. package/build/components/widget-areas-block-editor-provider/index.js +14 -11
  49. package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
  50. package/build/filters/move-to-widget-area.js +14 -10
  51. package/build/filters/move-to-widget-area.js.map +1 -1
  52. package/build/index.js +3 -3
  53. package/build/index.js.map +1 -1
  54. package/build/store/private-selectors.js +4 -0
  55. package/build/store/private-selectors.js.map +1 -1
  56. package/build/store/reducer.js +16 -0
  57. package/build/store/reducer.js.map +1 -1
  58. package/build-module/blocks/widget-area/edit/index.js +32 -28
  59. package/build-module/blocks/widget-area/edit/index.js.map +1 -1
  60. package/build-module/blocks/widget-area/edit/inner-blocks.js +8 -7
  61. package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
  62. package/build-module/components/error-boundary/index.js +14 -12
  63. package/build-module/components/error-boundary/index.js.map +1 -1
  64. package/build-module/components/header/document-tools/index.js +44 -62
  65. package/build-module/components/header/document-tools/index.js.map +1 -1
  66. package/build-module/components/header/index.js +34 -22
  67. package/build-module/components/header/index.js.map +1 -1
  68. package/build-module/components/header/undo-redo/redo.js +2 -2
  69. package/build-module/components/header/undo-redo/redo.js.map +1 -1
  70. package/build-module/components/header/undo-redo/undo.js +2 -2
  71. package/build-module/components/header/undo-redo/undo.js.map +1 -1
  72. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
  73. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  74. package/build-module/components/keyboard-shortcut-help-modal/index.js +55 -49
  75. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  76. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +32 -26
  77. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  78. package/build-module/components/layout/index.js +12 -8
  79. package/build-module/components/layout/index.js.map +1 -1
  80. package/build-module/components/layout/interface.js +17 -13
  81. package/build-module/components/layout/interface.js.map +1 -1
  82. package/build-module/components/more-menu/index.js +83 -70
  83. package/build-module/components/more-menu/index.js.map +1 -1
  84. package/build-module/components/more-menu/tools-more-menu-group.js +5 -4
  85. package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
  86. package/build-module/components/notices/index.js +17 -13
  87. package/build-module/components/notices/index.js.map +1 -1
  88. package/build-module/components/save-button/index.js +5 -4
  89. package/build-module/components/save-button/index.js.map +1 -1
  90. package/build-module/components/secondary-sidebar/index.js +3 -3
  91. package/build-module/components/secondary-sidebar/index.js.map +1 -1
  92. package/build-module/components/secondary-sidebar/inserter-sidebar.js +22 -18
  93. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  94. package/build-module/components/secondary-sidebar/list-view-sidebar.js +22 -15
  95. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  96. package/build-module/components/sidebar/index.js +50 -37
  97. package/build-module/components/sidebar/index.js.map +1 -1
  98. package/build-module/components/sidebar/widget-areas.js +30 -22
  99. package/build-module/components/sidebar/widget-areas.js.map +1 -1
  100. package/build-module/components/welcome-guide/index.js +82 -53
  101. package/build-module/components/welcome-guide/index.js.map +1 -1
  102. package/build-module/components/widget-areas-block-editor-content/index.js +19 -11
  103. package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
  104. package/build-module/components/widget-areas-block-editor-provider/index.js +15 -11
  105. package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
  106. package/build-module/filters/move-to-widget-area.js +16 -10
  107. package/build-module/filters/move-to-widget-area.js.map +1 -1
  108. package/build-module/index.js +3 -3
  109. package/build-module/index.js.map +1 -1
  110. package/build-module/store/private-selectors.js +3 -0
  111. package/build-module/store/private-selectors.js.map +1 -1
  112. package/build-module/store/reducer.js +15 -0
  113. package/build-module/store/reducer.js.map +1 -1
  114. package/build-style/style-rtl.css +15 -14
  115. package/build-style/style.css +15 -14
  116. package/package.json +31 -30
  117. package/src/blocks/widget-area/edit/inner-blocks.js +2 -2
  118. package/src/components/header/document-tools/index.js +30 -50
  119. package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
  120. package/src/components/layout/style.scss +1 -1
  121. package/src/index.js +1 -1
  122. package/src/store/private-selectors.js +4 -0
  123. package/src/store/reducer.js +13 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 6.0.0 (2024-05-31)
6
+
7
+ ### Breaking Changes
8
+
9
+ - Variables like `process.env.IS_GUTENBERG_PLUGIN` have been replaced by `globalThis.IS_GUTENBERG_PLUGIN`. Build systems using `process.env` should be updated ([#61486](https://github.com/WordPress/gutenberg/pull/61486)).
10
+ - Increase the minimum required Node.js version to v18.12.0 matching long-term support releases ([#31270](https://github.com/WordPress/gutenberg/pull/61930)). Learn more about [Node.js releases](https://nodejs.org/en/about/previous-releases).
11
+
12
+ ## 5.35.0 (2024-05-16)
13
+
14
+ ### Internal
15
+
16
+ - Replaced `classnames` package with the faster and smaller `clsx` package ([#61138](https://github.com/WordPress/gutenberg/pull/61138)).
17
+
5
18
  ## 5.34.0 (2024-05-02)
6
19
 
7
20
  ## 5.33.0 (2024-04-19)
@@ -146,8 +159,8 @@
146
159
 
147
160
  ### Breaking Changes
148
161
 
149
- - Drop support for Internet Explorer 11 ([#31110](https://github.com/WordPress/gutenberg/pull/31110)). Learn more at https://make.wordpress.org/core/2021/04/22/ie-11-support-phase-out-plan/.
150
- - Increase the minimum Node.js version to v12 matching Long Term Support releases ([#31270](https://github.com/WordPress/gutenberg/pull/31270)). Learn more at https://nodejs.org/en/about/releases/.
162
+ - Drop support for Internet Explorer 11 ([#31110](https://github.com/WordPress/gutenberg/pull/31110)). Learn more at <https://make.wordpress.org/core/2021/04/22/ie-11-support-phase-out-plan/>.
163
+ - Increase the minimum Node.js version to v12 matching Long Term Support releases ([#31270](https://github.com/WordPress/gutenberg/pull/31270)). Learn more at <https://nodejs.org/en/about/releases/>.
151
164
 
152
165
  ## 1.3.0 (2021-03-17)
153
166
 
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = WidgetAreaEdit;
8
- var _react = require("react");
9
8
  var _element = require("@wordpress/element");
10
9
  var _data = require("@wordpress/data");
11
10
  var _coreData = require("@wordpress/core-data");
@@ -13,6 +12,7 @@ var _components = require("@wordpress/components");
13
12
  var _innerBlocks = _interopRequireDefault(require("./inner-blocks"));
14
13
  var _store = require("../../../store");
15
14
  var _useIsDraggingWithin = _interopRequireDefault(require("./use-is-dragging-within"));
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
16
  /**
17
17
  * WordPress dependencies
18
18
  */
@@ -21,9 +21,7 @@ var _useIsDraggingWithin = _interopRequireDefault(require("./use-is-dragging-wit
21
21
  * Internal dependencies
22
22
  */
23
23
 
24
- /** @typedef {import('@wordpress/element').RefObject} RefObject */
25
-
26
- function WidgetAreaEdit({
24
+ /** @typedef {import('@wordpress/element').RefObject} RefObject */function WidgetAreaEdit({
27
25
  clientId,
28
26
  className,
29
27
  attributes: {
@@ -52,33 +50,38 @@ function WidgetAreaEdit({
52
50
  setOpen(false);
53
51
  }
54
52
  }, [isOpen, isDragging, isDraggingWithin, openedWhileDragging]);
55
- return (0, _react.createElement)(_components.Panel, {
53
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Panel, {
56
54
  className: className,
57
- ref: wrapper
58
- }, (0, _react.createElement)(_components.PanelBody, {
59
- title: name,
60
- opened: isOpen,
61
- onToggle: () => {
62
- setIsWidgetAreaOpen(clientId, !isOpen);
63
- },
64
- scrollAfterOpen: !isDragging
65
- }, ({
66
- opened
67
- }) =>
68
- // This is required to ensure LegacyWidget blocks are not
69
- // unmounted when the panel is collapsed. Unmounting legacy
70
- // widgets may have unintended consequences (e.g. TinyMCE
71
- // not being properly reinitialized)
72
- (0, _react.createElement)(_components.__unstableDisclosureContent, {
73
- className: "wp-block-widget-area__panel-body-content",
74
- visible: opened
75
- }, (0, _react.createElement)(_coreData.EntityProvider, {
76
- kind: "root",
77
- type: "postType",
78
- id: `widget-area-${id}`
79
- }, (0, _react.createElement)(_innerBlocks.default, {
80
- id: id
81
- })))));
55
+ ref: wrapper,
56
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PanelBody, {
57
+ title: name,
58
+ opened: isOpen,
59
+ onToggle: () => {
60
+ setIsWidgetAreaOpen(clientId, !isOpen);
61
+ },
62
+ scrollAfterOpen: !isDragging,
63
+ children: ({
64
+ opened
65
+ }) =>
66
+ /*#__PURE__*/
67
+ // This is required to ensure LegacyWidget blocks are not
68
+ // unmounted when the panel is collapsed. Unmounting legacy
69
+ // widgets may have unintended consequences (e.g. TinyMCE
70
+ // not being properly reinitialized)
71
+ (0, _jsxRuntime.jsx)(_components.__unstableDisclosureContent, {
72
+ className: "wp-block-widget-area__panel-body-content",
73
+ visible: opened,
74
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_coreData.EntityProvider, {
75
+ kind: "root",
76
+ type: "postType",
77
+ id: `widget-area-${id}`,
78
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_innerBlocks.default, {
79
+ id: id
80
+ })
81
+ })
82
+ })
83
+ })
84
+ });
82
85
  }
83
86
 
84
87
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_coreData","_components","_innerBlocks","_interopRequireDefault","_store","_useIsDraggingWithin","WidgetAreaEdit","clientId","className","attributes","id","name","isOpen","useSelect","select","editWidgetsStore","getIsWidgetAreaOpen","setIsWidgetAreaOpen","useDispatch","wrapper","useRef","setOpen","useCallback","openState","isDragging","useIsDragging","isDraggingWithin","useIsDraggingWithin","openedWhileDragging","setOpenedWhileDragging","useState","useEffect","_react","createElement","Panel","ref","PanelBody","title","opened","onToggle","scrollAfterOpen","__unstableDisclosureContent","visible","EntityProvider","kind","type","default","elementRef","setIsDragging","ownerDocument","current","handleDragStart","handleDragEnd","addEventListener","removeEventListener"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useCallback, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { EntityProvider } from '@wordpress/core-data';\nimport {\n\t__unstableDisclosureContent as DisclosureContent,\n\tPanel,\n\tPanelBody,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreaInnerBlocks from './inner-blocks';\nimport { store as editWidgetsStore } from '../../../store';\nimport useIsDraggingWithin from './use-is-dragging-within';\n\n/** @typedef {import('@wordpress/element').RefObject} RefObject */\n\nexport default function WidgetAreaEdit( {\n\tclientId,\n\tclassName,\n\tattributes: { id, name },\n} ) {\n\tconst isOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen( clientId ),\n\t\t[ clientId ]\n\t);\n\tconst { setIsWidgetAreaOpen } = useDispatch( editWidgetsStore );\n\n\tconst wrapper = useRef();\n\tconst setOpen = useCallback(\n\t\t( openState ) => setIsWidgetAreaOpen( clientId, openState ),\n\t\t[ clientId ]\n\t);\n\tconst isDragging = useIsDragging( wrapper );\n\tconst isDraggingWithin = useIsDraggingWithin( wrapper );\n\n\tconst [ openedWhileDragging, setOpenedWhileDragging ] = useState( false );\n\tuseEffect( () => {\n\t\tif ( ! isDragging ) {\n\t\t\tsetOpenedWhileDragging( false );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isDraggingWithin && ! isOpen ) {\n\t\t\tsetOpen( true );\n\t\t\tsetOpenedWhileDragging( true );\n\t\t} else if ( ! isDraggingWithin && isOpen && openedWhileDragging ) {\n\t\t\tsetOpen( false );\n\t\t}\n\t}, [ isOpen, isDragging, isDraggingWithin, openedWhileDragging ] );\n\n\treturn (\n\t\t<Panel className={ className } ref={ wrapper }>\n\t\t\t<PanelBody\n\t\t\t\ttitle={ name }\n\t\t\t\topened={ isOpen }\n\t\t\t\tonToggle={ () => {\n\t\t\t\t\tsetIsWidgetAreaOpen( clientId, ! isOpen );\n\t\t\t\t} }\n\t\t\t\tscrollAfterOpen={ ! isDragging }\n\t\t\t>\n\t\t\t\t{ ( { opened } ) => (\n\t\t\t\t\t// This is required to ensure LegacyWidget blocks are not\n\t\t\t\t\t// unmounted when the panel is collapsed. Unmounting legacy\n\t\t\t\t\t// widgets may have unintended consequences (e.g. TinyMCE\n\t\t\t\t\t// not being properly reinitialized)\n\t\t\t\t\t<DisclosureContent\n\t\t\t\t\t\tclassName=\"wp-block-widget-area__panel-body-content\"\n\t\t\t\t\t\tvisible={ opened }\n\t\t\t\t\t>\n\t\t\t\t\t\t<EntityProvider\n\t\t\t\t\t\t\tkind=\"root\"\n\t\t\t\t\t\t\ttype=\"postType\"\n\t\t\t\t\t\t\tid={ `widget-area-${ id }` }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<WidgetAreaInnerBlocks id={ id } />\n\t\t\t\t\t\t</EntityProvider>\n\t\t\t\t\t</DisclosureContent>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</Panel>\n\t);\n}\n\n/**\n * A React hook to determine if dragging is active.\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the entire document.\n */\nconst useIsDragging = ( elementRef ) => {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart() {\n\t\t\tsetIsDragging( true );\n\t\t}\n\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDragging( false );\n\t\t}\n\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t};\n\t}, [] );\n\n\treturn isDragging;\n};\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,YAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,oBAAA,GAAAF,sBAAA,CAAAL,OAAA;AAjBA;AACA;AACA;;AAUA;AACA;AACA;;AAKA;;AAEe,SAASQ,cAAcA,CAAE;EACvCC,QAAQ;EACRC,SAAS;EACTC,UAAU,EAAE;IAAEC,EAAE;IAAEC;EAAK;AACxB,CAAC,EAAG;EACH,MAAMC,MAAM,GAAG,IAAAC,eAAS,EACrBC,MAAM,IACPA,MAAM,CAAEC,YAAiB,CAAC,CAACC,mBAAmB,CAAET,QAAS,CAAC,EAC3D,CAAEA,QAAQ,CACX,CAAC;EACD,MAAM;IAAEU;EAAoB,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAiB,CAAC;EAE/D,MAAMI,OAAO,GAAG,IAAAC,eAAM,EAAC,CAAC;EACxB,MAAMC,OAAO,GAAG,IAAAC,oBAAW,EACxBC,SAAS,IAAMN,mBAAmB,CAAEV,QAAQ,EAAEgB,SAAU,CAAC,EAC3D,CAAEhB,QAAQ,CACX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2C,cAAc;IACdC,IAAI,EAAC,MAAM;IACXC,IAAI,EAAC,UAAU;IACfnC,EAAE,EAAI,eAAeA,EAAI;EAAG,GAE5B,IAAAsB,MAAA,CAAAC,aAAA,EAAC/B,YAAA,CAAA4C,OAAqB;IAACpC,EAAE,EAAGA;EAAI,CAAE,CACnB,CACE,CAEV,CACL,CAAC;AAEV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMe,aAAa,GAAKsB,UAAU,IAAM;EACvC,MAAM,CAAEvB,UAAU,EAAEwB,aAAa,CAAE,GAAG,IAAAlB,iBAAQ,EAAE,KAAM,CAAC;EAEvD,IAAAC,kBAAS,EAAE,MAAM;IAChB,MAAM;MAAEkB;IAAc,CAAC,GAAGF,UAAU,CAACG,OAAO;IAE5C,SAASC,eAAeA,CAAA,EAAG;MAC1BH,aAAa,CAAE,IAAK,CAAC;IACtB;IAEA,SAASI,aAAaA,CAAA,EAAG;MACxBJ,aAAa,CAAE,KAAM,CAAC;IACvB;IAEAC,aAAa,CAACI,gBAAgB,CAAE,WAAW,EAAEF,eAAgB,CAAC;IAC9DF,aAAa,CAACI,gBAAgB,CAAE,SAAS,EAAED,aAAc,CAAC;IAE1D,OAAO,MAAM;MACZH,aAAa,CAACK,mBAAmB,CAAE,WAAW,EAAEH,eAAgB,CAAC;MACjEF,aAAa,CAACK,mBAAmB,CAAE,SAAS,EAAEF,aAAc,CAAC;IAC9D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,OAAO5B,UAAU;AAClB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_data","_coreData","_components","_innerBlocks","_interopRequireDefault","_store","_useIsDraggingWithin","_jsxRuntime","WidgetAreaEdit","clientId","className","attributes","id","name","isOpen","useSelect","select","editWidgetsStore","getIsWidgetAreaOpen","setIsWidgetAreaOpen","useDispatch","wrapper","useRef","setOpen","useCallback","openState","isDragging","useIsDragging","isDraggingWithin","useIsDraggingWithin","openedWhileDragging","setOpenedWhileDragging","useState","useEffect","jsx","Panel","ref","children","PanelBody","title","opened","onToggle","scrollAfterOpen","__unstableDisclosureContent","visible","EntityProvider","kind","type","default","elementRef","setIsDragging","ownerDocument","current","handleDragStart","handleDragEnd","addEventListener","removeEventListener"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useCallback, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { EntityProvider } from '@wordpress/core-data';\nimport {\n\t__unstableDisclosureContent as DisclosureContent,\n\tPanel,\n\tPanelBody,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreaInnerBlocks from './inner-blocks';\nimport { store as editWidgetsStore } from '../../../store';\nimport useIsDraggingWithin from './use-is-dragging-within';\n\n/** @typedef {import('@wordpress/element').RefObject} RefObject */\n\nexport default function WidgetAreaEdit( {\n\tclientId,\n\tclassName,\n\tattributes: { id, name },\n} ) {\n\tconst isOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen( clientId ),\n\t\t[ clientId ]\n\t);\n\tconst { setIsWidgetAreaOpen } = useDispatch( editWidgetsStore );\n\n\tconst wrapper = useRef();\n\tconst setOpen = useCallback(\n\t\t( openState ) => setIsWidgetAreaOpen( clientId, openState ),\n\t\t[ clientId ]\n\t);\n\tconst isDragging = useIsDragging( wrapper );\n\tconst isDraggingWithin = useIsDraggingWithin( wrapper );\n\n\tconst [ openedWhileDragging, setOpenedWhileDragging ] = useState( false );\n\tuseEffect( () => {\n\t\tif ( ! isDragging ) {\n\t\t\tsetOpenedWhileDragging( false );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isDraggingWithin && ! isOpen ) {\n\t\t\tsetOpen( true );\n\t\t\tsetOpenedWhileDragging( true );\n\t\t} else if ( ! isDraggingWithin && isOpen && openedWhileDragging ) {\n\t\t\tsetOpen( false );\n\t\t}\n\t}, [ isOpen, isDragging, isDraggingWithin, openedWhileDragging ] );\n\n\treturn (\n\t\t<Panel className={ className } ref={ wrapper }>\n\t\t\t<PanelBody\n\t\t\t\ttitle={ name }\n\t\t\t\topened={ isOpen }\n\t\t\t\tonToggle={ () => {\n\t\t\t\t\tsetIsWidgetAreaOpen( clientId, ! isOpen );\n\t\t\t\t} }\n\t\t\t\tscrollAfterOpen={ ! isDragging }\n\t\t\t>\n\t\t\t\t{ ( { opened } ) => (\n\t\t\t\t\t// This is required to ensure LegacyWidget blocks are not\n\t\t\t\t\t// unmounted when the panel is collapsed. Unmounting legacy\n\t\t\t\t\t// widgets may have unintended consequences (e.g. TinyMCE\n\t\t\t\t\t// not being properly reinitialized)\n\t\t\t\t\t<DisclosureContent\n\t\t\t\t\t\tclassName=\"wp-block-widget-area__panel-body-content\"\n\t\t\t\t\t\tvisible={ opened }\n\t\t\t\t\t>\n\t\t\t\t\t\t<EntityProvider\n\t\t\t\t\t\t\tkind=\"root\"\n\t\t\t\t\t\t\ttype=\"postType\"\n\t\t\t\t\t\t\tid={ `widget-area-${ id }` }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<WidgetAreaInnerBlocks id={ id } />\n\t\t\t\t\t\t</EntityProvider>\n\t\t\t\t\t</DisclosureContent>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</Panel>\n\t);\n}\n\n/**\n * A React hook to determine if dragging is active.\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the entire document.\n */\nconst useIsDragging = ( elementRef ) => {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart() {\n\t\t\tsetIsDragging( true );\n\t\t}\n\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDragging( false );\n\t\t}\n\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t};\n\t}, [] );\n\n\treturn isDragging;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,YAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,oBAAA,GAAAF,sBAAA,CAAAL,OAAA;AAA2D,IAAAQ,WAAA,GAAAR,OAAA;AAjB3D;AACA;AACA;;AAUA;AACA;AACA;;AAKA,kEAEe,SAASS,cAAcA,CAAE;EACvCC,QAAQ;EACRC,SAAS;EACTC,UAAU,EAAE;IAAEC,EAAE;IAAEC;EAAK;AACxB,CAAC,EAAG;EACH,MAAMC,MAAM,GAAG,IAAAC,eAAS,EACrBC,MAAM,IACPA,MAAM,CAAEC,YAAiB,CAAC,CAACC,mBAAmB,CAAET,QAAS,CAAC,EAC3D,CAAEA,QAAQ,CACX,CAAC;EACD,MAAM;IAAEU;EAAoB,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAiB,CAAC;EAE/D,MAAMI,OAAO,GAAG,IAAAC,eAAM,EAAC,CAAC;EACxB,MAAMC,OAAO,GAAG,IAAAC,oBAAW,EACxBC,SAAS,IAAMN,mBAAmB,CAAEV,QAAQ,EAAEgB,SAAU,CAAC,EAC3D,CAAEhB,QAAQ,CACX,CAAC;EACD,MAAMiB,UAAU,GAAGC,aAAa,CAAEN,OAAQ,CAAC;EAC3C,MAAMO,gBAAgB,GAAG,IAAAC,4BAAmB,EAAER,OAAQ,CAAC;EAEvD,MAAM,CAAES,mBAAmB,EAAEC,sBAAsB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACzE,IAAAC,kBA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qB;YAACpC,EAAE,EAAGA;UAAI,CAAE;QAAC,CACpB;MAAC,CACC;IACnB,CACS;EAAC,CACN,CAAC;AAEV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMe,aAAa,GAAKsB,UAAU,IAAM;EACvC,MAAM,CAAEvB,UAAU,EAAEwB,aAAa,CAAE,GAAG,IAAAlB,iBAAQ,EAAE,KAAM,CAAC;EAEvD,IAAAC,kBAAS,EAAE,MAAM;IAChB,MAAM;MAAEkB;IAAc,CAAC,GAAGF,UAAU,CAACG,OAAO;IAE5C,SAASC,eAAeA,CAAA,EAAG;MAC1BH,aAAa,CAAE,IAAK,CAAC;IACtB;IAEA,SAASI,aAAaA,CAAA,EAAG;MACxBJ,aAAa,CAAE,KAAM,CAAC;IACvB;IAEAC,aAAa,CAACI,gBAAgB,CAAE,WAAW,EAAEF,eAAgB,CAAC;IAC9DF,aAAa,CAACI,gBAAgB,CAAE,SAAS,EAAED,aAAc,CAAC;IAE1D,OAAO,MAAM;MACZH,aAAa,CAACK,mBAAmB,CAAE,WAAW,EAAEH,eAAgB,CAAC;MACjEF,aAAa,CAACK,mBAAmB,CAAE,SAAS,EAAEF,aAAc,CAAC;IAC9D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,OAAO5B,UAAU;AAClB,CAAC","ignoreList":[]}
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = WidgetAreaInnerBlocks;
8
- var _react = require("react");
9
- var _classnames = _interopRequireDefault(require("classnames"));
8
+ var _clsx = _interopRequireDefault(require("clsx"));
10
9
  var _coreData = require("@wordpress/core-data");
11
10
  var _blockEditor = require("@wordpress/block-editor");
12
11
  var _element = require("@wordpress/element");
13
12
  var _useIsDraggingWithin = _interopRequireDefault(require("./use-is-dragging-within"));
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
14
  /**
15
15
  * External dependencies
16
16
  */
@@ -40,13 +40,14 @@ function WidgetAreaInnerBlocks({
40
40
  templateLock: false,
41
41
  renderAppender: _blockEditor.InnerBlocks.ButtonBlockAppender
42
42
  });
43
- return (0, _react.createElement)("div", {
43
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
44
44
  "data-widget-area-id": id,
45
- className: (0, _classnames.default)('wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper', {
45
+ className: (0, _clsx.default)('wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper', {
46
46
  'wp-block-widget-area__highlight-drop-zone': shouldHighlightDropZone
47
+ }),
48
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
49
+ ...innerBlocksProps
47
50
  })
48
- }, (0, _react.createElement)("div", {
49
- ...innerBlocksProps
50
- }));
51
+ });
51
52
  }
52
53
  //# sourceMappingURL=inner-blocks.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_coreData","_blockEditor","_element","_useIsDraggingWithin","WidgetAreaInnerBlocks","id","blocks","onInput","onChange","useEntityBlockEditor","innerBlocksRef","useRef","isDraggingWithinInnerBlocks","useIsDraggingWithin","shouldHighlightDropZone","innerBlocksProps","useInnerBlocksProps","ref","value","templateLock","renderAppender","InnerBlocks","ButtonBlockAppender","_react","createElement","className","classnames"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/inner-blocks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport { InnerBlocks, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useIsDraggingWithin from './use-is-dragging-within';\n\nexport default function WidgetAreaInnerBlocks( { id } ) {\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'root',\n\t\t'postType'\n\t);\n\tconst innerBlocksRef = useRef();\n\tconst isDraggingWithinInnerBlocks = useIsDraggingWithin( innerBlocksRef );\n\tconst shouldHighlightDropZone = isDraggingWithinInnerBlocks;\n\t// Using the experimental hook so that we can control the className of the element.\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ ref: innerBlocksRef },\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\ttemplateLock: false,\n\t\t\trenderAppender: InnerBlocks.ButtonBlockAppender,\n\t\t}\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tdata-widget-area-id={ id }\n\t\t\tclassName={ classnames(\n\t\t\t\t'wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper',\n\t\t\t\t{\n\t\t\t\t\t'wp-block-widget-area__highlight-drop-zone':\n\t\t\t\t\t\tshouldHighlightDropZone,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,oBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASK,qBAAqBA,CAAE;EAAEC;AAAG,CAAC,EAAG;EACvD,MAAM,CAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,CAAE,GAAG,IAAAC,8BAAoB,EACzD,MAAM,EACN,UACD,CAAC;EACD,MAAMC,cAAc,GAAG,IAAAC,eAAM,EAAC,CAAC;EAC/B,MAAMC,2BAA2B,GAAG,IAAAC,4BAAmB,EAAEH,cAAe,CAAC;EACzE,MAAMI,uBAAuB,GAAGF,2BAA2B;EAC3D;EACA,MAAMG,gBAAgB,GAAG,IAAAC,gCAAmB,EAC3C;IAAEC,GAAG,EAAEP;EAAe,CAAC,EACvB;IACCQ,KAAK,EAAEZ,MAAM;IACbC,OAAO;IACPC,QAAQ;IACRW,YAAY,EAAE,KAAK;IACnBC,cAAc,EAAEC,wBAAW,CAACC;EAC7B,CACD,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA;IACC,uBAAsBnB,EAAI;IAC1BoB,SAAS,EAAG,IAAAC,mBAAU,EACrB,oFAAoF,EACpF;MACC,2CAA2C,EAC1CZ;IACF,CACD;EAAG,GAEH,IAAAS,MAAA,CAAAC,aAAA;IAAA,GAAUT;EAAgB,CAAI,CAC1B,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_coreData","_blockEditor","_element","_useIsDraggingWithin","_jsxRuntime","WidgetAreaInnerBlocks","id","blocks","onInput","onChange","useEntityBlockEditor","innerBlocksRef","useRef","isDraggingWithinInnerBlocks","useIsDraggingWithin","shouldHighlightDropZone","innerBlocksProps","useInnerBlocksProps","ref","value","templateLock","renderAppender","InnerBlocks","ButtonBlockAppender","jsx","className","clsx","children"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/inner-blocks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport { InnerBlocks, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useIsDraggingWithin from './use-is-dragging-within';\n\nexport default function WidgetAreaInnerBlocks( { id } ) {\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'root',\n\t\t'postType'\n\t);\n\tconst innerBlocksRef = useRef();\n\tconst isDraggingWithinInnerBlocks = useIsDraggingWithin( innerBlocksRef );\n\tconst shouldHighlightDropZone = isDraggingWithinInnerBlocks;\n\t// Using the experimental hook so that we can control the className of the element.\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ ref: innerBlocksRef },\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\ttemplateLock: false,\n\t\t\trenderAppender: InnerBlocks.ButtonBlockAppender,\n\t\t}\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tdata-widget-area-id={ id }\n\t\t\tclassName={ clsx(\n\t\t\t\t'wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper',\n\t\t\t\t{\n\t\t\t\t\t'wp-block-widget-area__highlight-drop-zone':\n\t\t\t\t\t\tshouldHighlightDropZone,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,oBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAA2D,IAAAK,WAAA,GAAAL,OAAA;AAf3D;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASM,qBAAqBA,CAAE;EAAEC;AAAG,CAAC,EAAG;EACvD,MAAM,CAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,CAAE,GAAG,IAAAC,8BAAoB,EACzD,MAAM,EACN,UACD,CAAC;EACD,MAAMC,cAAc,GAAG,IAAAC,eAAM,EAAC,CAAC;EAC/B,MAAMC,2BAA2B,GAAG,IAAAC,4BAAmB,EAAEH,cAAe,CAAC;EACzE,MAAMI,uBAAuB,GAAGF,2BAA2B;EAC3D;EACA,MAAMG,gBAAgB,GAAG,IAAAC,gCAAmB,EAC3C;IAAEC,GAAG,EAAEP;EAAe,CAAC,EACvB;IACCQ,KAAK,EAAEZ,MAAM;IACbC,OAAO;IACPC,QAAQ;IACRW,YAAY,EAAE,KAAK;IACnBC,cAAc,EAAEC,wBAAW,CAACC;EAC7B,CACD,CAAC;EAED,oBACC,IAAAnB,WAAA,CAAAoB,GAAA;IACC,uBAAsBlB,EAAI;IAC1BmB,SAAS,EAAG,IAAAC,aAAI,EACf,oFAAoF,EACpF;MACC,2CAA2C,EAC1CX;IACF,CACD,CAAG;IAAAY,QAAA,eAEH,IAAAvB,WAAA,CAAAoB,GAAA;MAAA,GAAUR;IAAgB,CAAI;EAAC,CAC3B,CAAC;AAER","ignoreList":[]}
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = require("react");
8
7
  var _element = require("@wordpress/element");
9
8
  var _i18n = require("@wordpress/i18n");
10
9
  var _components = require("@wordpress/components");
11
10
  var _blockEditor = require("@wordpress/block-editor");
12
11
  var _compose = require("@wordpress/compose");
13
12
  var _hooks = require("@wordpress/hooks");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
14
  /**
15
15
  * WordPress dependencies
16
16
  */
@@ -20,23 +20,25 @@ function CopyButton({
20
20
  children
21
21
  }) {
22
22
  const ref = (0, _compose.useCopyToClipboard)(text);
23
- return (0, _react.createElement)(_components.Button, {
23
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
24
24
  variant: "secondary",
25
- ref: ref
26
- }, children);
25
+ ref: ref,
26
+ children: children
27
+ });
27
28
  }
28
29
  function ErrorBoundaryWarning({
29
30
  message,
30
31
  error
31
32
  }) {
32
- const actions = [(0, _react.createElement)(CopyButton, {
33
- key: "copy-error",
34
- text: error.stack
35
- }, (0, _i18n.__)('Copy Error'))];
36
- return (0, _react.createElement)(_blockEditor.Warning, {
33
+ const actions = [/*#__PURE__*/(0, _jsxRuntime.jsx)(CopyButton, {
34
+ text: error.stack,
35
+ children: (0, _i18n.__)('Copy Error')
36
+ }, "copy-error")];
37
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.Warning, {
37
38
  className: "edit-widgets-error-boundary",
38
- actions: actions
39
- }, message);
39
+ actions: actions,
40
+ children: message
41
+ });
40
42
  }
41
43
  class ErrorBoundary extends _element.Component {
42
44
  constructor() {
@@ -57,7 +59,7 @@ class ErrorBoundary extends _element.Component {
57
59
  if (!this.state.error) {
58
60
  return this.props.children;
59
61
  }
60
- return (0, _react.createElement)(ErrorBoundaryWarning, {
62
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(ErrorBoundaryWarning, {
61
63
  message: (0, _i18n.__)('The editor has encountered an unexpected error.'),
62
64
  error: this.state.error
63
65
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_i18n","_components","_blockEditor","_compose","_hooks","CopyButton","text","children","ref","useCopyToClipboard","_react","createElement","Button","variant","ErrorBoundaryWarning","message","error","actions","key","stack","__","Warning","className","ErrorBoundary","Component","constructor","arguments","state","componentDidCatch","doAction","getDerivedStateFromError","render","props","exports","default"],"sources":["@wordpress/edit-widgets/src/components/error-boundary/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nfunction ErrorBoundaryWarning( { message, error } ) {\n\tconst actions = [\n\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t{ __( 'Copy Error' ) }\n\t\t</CopyButton>,\n\t];\n\n\treturn (\n\t\t<Warning className=\"edit-widgets-error-boundary\" actions={ actions }>\n\t\t\t{ message }\n\t\t</Warning>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tif ( ! this.state.error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor has encountered an unexpected error.'\n\t\t\t\t) }\n\t\t\t\terror={ this.state.error }\n\t\t\t/>\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AARA;AACA;AACA;;AAQA,SAASM,UAAUA,CAAE;EAAEC,IAAI;EAAEC;AAAS,CAAC,EAAG;EACzC,MAAMC,GAAG,GAAG,IAAAC,2BAAkB,EAAEH,IAAK,CAAC;EACtC,OACC,IAAAI,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,MAAM;IAACC,OAAO,EAAC,WAAW;IAACL,GAAG,EAAGA;EAAK,GACpCD,QACK,CAAC;AAEX;AAEA,SAASO,oBAAoBA,CAAE;EAAEC,OAAO;EAAEC;AAAM,CAAC,EAAG;EACnD,MAAMC,OAAO,GAAG,CACf,IAAAP,MAAA,CAAAC,aAAA,EAACN,UAAU;IAACa,GAAG,EAAC,YAAY;IAACZ,IAAI,EAAGU,KAAK,CAACG;EAAO,GAC9C,IAAAC,QAAE,EAAE,YAAa,CACR,CAAC,CACb;EAED,OACC,IAAAV,MAAA,CAAAC,aAAA,EAACT,YAAA,CAAAmB,OAAO;IAACC,SAAS,EAAC,6BAA6B;IAACL,OAAO,EAAGA;EAAS,GACjEF,OACM,CAAC;AAEZ;AAEe,MAAMQ,aAAa,SAASC,kBAAS,CAAC;EACpDC,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IAErB,IAAI,CAACC,KAAK,GAAG;MACZX,KAAK,EAAE;IACR,CAAC;EACF;EAEAY,iBAAiBA,CAAEZ,KAAK,EAAG;IAC1B,IAAAa,eAAQ,EAAE,kCAAkC,EAAEb,KAAM,CAAC;EACtD;EAEA,OAAOc,wBAAwBA,CAAEd,KAAK,EAAG;IACxC,OAAO;MAAEA;IAAM,CAAC;EACjB;EAEAe,MAAMA,CAAA,EAAG;IACR,IAAK,CAAE,IAAI,CAACJ,KAAK,CAACX,KAAK,EAAG;MACzB,OAAO,IAAI,CAACgB,KAAK,CAACzB,QAAQ;IAC3B;IAEA,OACC,IAAAG,MAAA,CAAAC,aAAA,EAACG,oBAAoB;MACpBC,OAAO,EAAG,IAAAK,QAAE,EACX,iDACD,CAAG;MACHJ,KAAK,EAAG,IAAI,CAACW,KAAK,CAACX;IAAO,CAC1B,CAAC;EAEJ;AACD;AAACiB,OAAA,CAAAC,OAAA,GAAAX,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_i18n","_components","_blockEditor","_compose","_hooks","_jsxRuntime","CopyButton","text","children","ref","useCopyToClipboard","jsx","Button","variant","ErrorBoundaryWarning","message","error","actions","stack","__","Warning","className","ErrorBoundary","Component","constructor","arguments","state","componentDidCatch","doAction","getDerivedStateFromError","render","props","exports","default"],"sources":["@wordpress/edit-widgets/src/components/error-boundary/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nfunction ErrorBoundaryWarning( { message, error } ) {\n\tconst actions = [\n\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t{ __( 'Copy Error' ) }\n\t\t</CopyButton>,\n\t];\n\n\treturn (\n\t\t<Warning className=\"edit-widgets-error-boundary\" actions={ actions }>\n\t\t\t{ message }\n\t\t</Warning>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tif ( ! this.state.error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor has encountered an unexpected error.'\n\t\t\t\t) }\n\t\t\t\terror={ this.state.error }\n\t\t\t/>\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA4C,IAAAM,WAAA,GAAAN,OAAA;AAR5C;AACA;AACA;;AAQA,SAASO,UAAUA,CAAE;EAAEC,IAAI;EAAEC;AAAS,CAAC,EAAG;EACzC,MAAMC,GAAG,GAAG,IAAAC,2BAAkB,EAAEH,IAAK,CAAC;EACtC,oBACC,IAAAF,WAAA,CAAAM,GAAA,EAACV,WAAA,CAAAW,MAAM;IAACC,OAAO,EAAC,WAAW;IAACJ,GAAG,EAAGA,GAAK;IAAAD,QAAA,EACpCA;EAAQ,CACH,CAAC;AAEX;AAEA,SAASM,oBAAoBA,CAAE;EAAEC,OAAO;EAAEC;AAAM,CAAC,EAAG;EACnD,MAAMC,OAAO,GAAG,cACf,IAAAZ,WAAA,CAAAM,GAAA,EAACL,UAAU;IAAkBC,IAAI,EAAGS,KAAK,CAACE,KAAO;IAAAV,QAAA,EAC9C,IAAAW,QAAE,EAAE,YAAa;EAAC,GADL,YAEJ,CAAC,CACb;EAED,oBACC,IAAAd,WAAA,CAAAM,GAAA,EAACT,YAAA,CAAAkB,OAAO;IAACC,SAAS,EAAC,6BAA6B;IAACJ,OAAO,EAAGA,OAAS;IAAAT,QAAA,EACjEO;EAAO,CACD,CAAC;AAEZ;AAEe,MAAMO,aAAa,SAASC,kBAAS,CAAC;EACpDC,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IAErB,IAAI,CAACC,KAAK,GAAG;MACZV,KAAK,EAAE;IACR,CAAC;EACF;EAEAW,iBAAiBA,CAAEX,KAAK,EAAG;IAC1B,IAAAY,eAAQ,EAAE,kCAAkC,EAAEZ,KAAM,CAAC;EACtD;EAEA,OAAOa,wBAAwBA,CAAEb,KAAK,EAAG;IACxC,OAAO;MAAEA;IAAM,CAAC;EACjB;EAEAc,MAAMA,CAAA,EAAG;IACR,IAAK,CAAE,IAAI,CAACJ,KAAK,CAACV,KAAK,EAAG;MACzB,OAAO,IAAI,CAACe,KAAK,CAACvB,QAAQ;IAC3B;IAEA,oBACC,IAAAH,WAAA,CAAAM,GAAA,EAACG,oBAAoB;MACpBC,OAAO,EAAG,IAAAI,QAAE,EACX,iDACD,CAAG;MACHH,KAAK,EAAG,IAAI,CAACU,KAAK,CAACV;IAAO,CAC1B,CAAC;EAEJ;AACD;AAACgB,OAAA,CAAAC,OAAA,GAAAX,aAAA","ignoreList":[]}
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _react = require("react");
9
8
  var _data = require("@wordpress/data");
10
9
  var _i18n = require("@wordpress/i18n");
11
10
  var _components = require("@wordpress/components");
@@ -15,9 +14,9 @@ var _element = require("@wordpress/element");
15
14
  var _compose = require("@wordpress/compose");
16
15
  var _undo = _interopRequireDefault(require("../undo-redo/undo"));
17
16
  var _redo = _interopRequireDefault(require("../undo-redo/redo"));
18
- var _useLastSelectedWidgetArea = _interopRequireDefault(require("../../../hooks/use-last-selected-widget-area"));
19
17
  var _store = require("../../../store");
20
18
  var _lockUnlock = require("../../../lock-unlock");
19
+ var _jsxRuntime = require("react/jsx-runtime");
21
20
  /**
22
21
  * WordPress dependencies
23
22
  */
@@ -28,87 +27,68 @@ var _lockUnlock = require("../../../lock-unlock");
28
27
 
29
28
  function DocumentTools() {
30
29
  const isMediumViewport = (0, _compose.useViewportMatch)('medium');
31
- const inserterButton = (0, _element.useRef)();
32
- const widgetAreaClientId = (0, _useLastSelectedWidgetArea.default)();
33
- const isLastSelectedWidgetAreaOpen = (0, _data.useSelect)(select => select(_store.store).getIsWidgetAreaOpen(widgetAreaClientId), [widgetAreaClientId]);
34
30
  const {
35
31
  isInserterOpen,
36
32
  isListViewOpen,
33
+ inserterSidebarToggleRef,
37
34
  listViewToggleRef
38
35
  } = (0, _data.useSelect)(select => {
39
36
  const {
40
37
  isInserterOpened,
38
+ getInserterSidebarToggleRef,
41
39
  isListViewOpened,
42
40
  getListViewToggleRef
43
41
  } = (0, _lockUnlock.unlock)(select(_store.store));
44
42
  return {
45
43
  isInserterOpen: isInserterOpened(),
46
44
  isListViewOpen: isListViewOpened(),
45
+ inserterSidebarToggleRef: getInserterSidebarToggleRef(),
47
46
  listViewToggleRef: getListViewToggleRef()
48
47
  };
49
48
  }, []);
50
49
  const {
51
- setIsWidgetAreaOpen,
52
50
  setIsInserterOpened,
53
51
  setIsListViewOpened
54
52
  } = (0, _data.useDispatch)(_store.store);
55
- const {
56
- selectBlock
57
- } = (0, _data.useDispatch)(_blockEditor.store);
58
- const handleClick = () => {
59
- if (isInserterOpen) {
60
- // Focusing the inserter button closes the inserter popover.
61
- setIsInserterOpened(false);
62
- } else {
63
- if (!isLastSelectedWidgetAreaOpen) {
64
- // Select the last selected block if hasn't already.
65
- selectBlock(widgetAreaClientId);
66
- // Open the last selected widget area when opening the inserter.
67
- setIsWidgetAreaOpen(widgetAreaClientId, true);
68
- }
69
- // The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the
70
- // same tick and pretty much in a random order. The inserter is closed if any other part of the
71
- // app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then
72
- // the inserter is visible for a brief moment and then gets auto-closed due to focus moving to
73
- // the selected block.
74
- window.requestAnimationFrame(() => setIsInserterOpened(true));
75
- }
76
- };
77
53
  const toggleListView = (0, _element.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
78
- return (0, _react.createElement)(_blockEditor.NavigableToolbar, {
54
+ const toggleInserterSidebar = (0, _element.useCallback)(() => setIsInserterOpened(!isInserterOpen), [setIsInserterOpened, isInserterOpen]);
55
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_blockEditor.NavigableToolbar, {
79
56
  className: "edit-widgets-header-toolbar",
80
57
  "aria-label": (0, _i18n.__)('Document tools'),
81
- variant: "unstyled"
82
- }, (0, _react.createElement)(_components.ToolbarItem, {
83
- ref: inserterButton,
84
- as: _components.Button,
85
- className: "edit-widgets-header-toolbar__inserter-toggle",
86
- variant: "primary",
87
- isPressed: isInserterOpen,
88
- onMouseDown: event => {
89
- event.preventDefault();
90
- },
91
- onClick: handleClick,
92
- icon: _icons.plus
93
- /* translators: button label text should, if possible, be under 16
94
- characters. */,
95
- label: (0, _i18n._x)('Toggle block inserter', 'Generic label for block inserter button'),
96
- size: "compact"
97
- }), isMediumViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.ToolbarItem, {
98
- as: _undo.default
99
- }), (0, _react.createElement)(_components.ToolbarItem, {
100
- as: _redo.default
101
- }), (0, _react.createElement)(_components.ToolbarItem, {
102
- as: _components.Button,
103
- className: "edit-widgets-header-toolbar__list-view-toggle",
104
- icon: _icons.listView,
105
- isPressed: isListViewOpen
106
- /* translators: button label text should, if possible, be under 16 characters. */,
107
- label: (0, _i18n.__)('List View'),
108
- onClick: toggleListView,
109
- ref: listViewToggleRef,
110
- size: "compact"
111
- })));
58
+ variant: "unstyled",
59
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarItem, {
60
+ ref: inserterSidebarToggleRef,
61
+ as: _components.Button,
62
+ className: "edit-widgets-header-toolbar__inserter-toggle",
63
+ variant: "primary",
64
+ isPressed: isInserterOpen,
65
+ onMouseDown: event => {
66
+ event.preventDefault();
67
+ },
68
+ onClick: toggleInserterSidebar,
69
+ icon: _icons.plus
70
+ /* translators: button label text should, if possible, be under 16
71
+ characters. */,
72
+ label: (0, _i18n._x)('Toggle block inserter', 'Generic label for block inserter button'),
73
+ size: "compact"
74
+ }), isMediumViewport && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
75
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarItem, {
76
+ as: _undo.default
77
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarItem, {
78
+ as: _redo.default
79
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarItem, {
80
+ as: _components.Button,
81
+ className: "edit-widgets-header-toolbar__list-view-toggle",
82
+ icon: _icons.listView,
83
+ isPressed: isListViewOpen
84
+ /* translators: button label text should, if possible, be under 16 characters. */,
85
+ label: (0, _i18n.__)('List View'),
86
+ onClick: toggleListView,
87
+ ref: listViewToggleRef,
88
+ size: "compact"
89
+ })]
90
+ })]
91
+ });
112
92
  }
113
93
  var _default = exports.default = DocumentTools;
114
94
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_components","_blockEditor","_icons","_element","_compose","_undo","_interopRequireDefault","_redo","_useLastSelectedWidgetArea","_store","_lockUnlock","DocumentTools","isMediumViewport","useViewportMatch","inserterButton","useRef","widgetAreaClientId","useLastSelectedWidgetArea","isLastSelectedWidgetAreaOpen","useSelect","select","editWidgetsStore","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","listViewToggleRef","isInserterOpened","isListViewOpened","getListViewToggleRef","unlock","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","useDispatch","selectBlock","blockEditorStore","handleClick","window","requestAnimationFrame","toggleListView","useCallback","_react","createElement","NavigableToolbar","className","__","variant","ToolbarItem","ref","as","Button","isPressed","onMouseDown","event","preventDefault","onClick","icon","plus","label","_x","size","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} 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\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\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\taria-label={ __( 'Document tools' ) }\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\tsize=\"compact\"\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\tsize=\"compact\"\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;AAIA,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,MA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AAE,EAAGC,kBAAQ;IACbN,SAAS,EAAC,+CAA+C;IACzDY,IAAI,EAAGQ,eAAU;IACjBb,SAAS,EAAG3B;IACZ;IACAkC,KAAK,EAAG,IAAAb,QAAE,EAAE,WAAY,CAAG;IAC3BU,OAAO,EAAGhB,cAAgB;IAC1BS,GAAG,EAAGvB,iBAAmB;IACzBmC,IAAI,EAAC;EAAS,CACd,CACA,CAEc,CAAC;AAErB;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcxD,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_i18n","_components","_blockEditor","_icons","_element","_compose","_undo","_interopRequireDefault","_redo","_store","_lockUnlock","_jsxRuntime","DocumentTools","isMediumViewport","useViewportMatch","isInserterOpen","isListViewOpen","inserterSidebarToggleRef","listViewToggleRef","useSelect","select","isInserterOpened","getInserterSidebarToggleRef","isListViewOpened","getListViewToggleRef","unlock","editWidgetsStore","setIsInserterOpened","setIsListViewOpened","useDispatch","toggleListView","useCallback","toggleInserterSidebar","jsxs","NavigableToolbar","className","__","variant","children","jsx","ToolbarItem","ref","as","Button","isPressed","onMouseDown","event","preventDefault","onClick","icon","plus","label","_x","size","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 { NavigableToolbar } from '@wordpress/block-editor';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback } 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 { store as editWidgetsStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nfunction DocumentTools() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\n\tconst {\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tinserterSidebarToggleRef,\n\t\tlistViewToggleRef,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisInserterOpened,\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tisListViewOpened,\n\t\t\tgetListViewToggleRef,\n\t\t} = unlock( select( editWidgetsStore ) );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserterSidebar = useCallback(\n\t\t() => setIsInserterOpened( ! isInserterOpen ),\n\t\t[ setIsInserterOpened, isInserterOpen ]\n\t);\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\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<ToolbarItem\n\t\t\t\tref={ inserterSidebarToggleRef }\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={ toggleInserterSidebar }\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\tsize=\"compact\"\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\tsize=\"compact\"\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;AACA,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,MAAA,GAAAV,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AAA8C,IAAAY,WAAA,GAAAZ,OAAA;AAjB9C;AACA;AACA;;AASA;AACA;AACA;;AAMA,SAASa,aAAaA,CAAA,EAAG;EACxB,MAAMC,gBAAgB,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;EAErD,MAAM;IACLC,cAAc;IACdC,cAAc;IACdC,wBAAwB;IACxBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5B,MAAM;MAC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AACJ,qBADI;MAEAC,KAAK,EAAG,IAAAC,QAAE,EACT,uBAAuB,EACvB,yCACD,CAAG;MACHC,IAAI,EAAC;IAAS,CACd,CAAC,EACAxC,gBAAgB,iBACjB,IAAAF,WAAA,CAAAsB,IAAA,EAAAtB,WAAA,CAAA2C,QAAA;MAAAhB,QAAA,gBACC,IAAA3B,WAAA,CAAA4B,GAAA,EAACtC,WAAA,CAAAuC,WAAW;QAACE,EAAE,EAAGa;MAAY,CAAE,CAAC,eACjC,IAAA5C,WAAA,CAAA4B,GAAA,EAACtC,WAAA,CAAAuC,WAAW;QAACE,EAAE,EAAGc;MAAY,CAAE,CAAC,eACjC,IAAA7C,WAAA,CAAA4B,GAAA,EAACtC,WAAA,CAAAuC,WAAW;QACXE,EAAE,EAAGC,kBAAQ;QACbR,SAAS,EAAC,+CAA+C;QACzDc,IAAI,EAAGQ,eAAU;QACjBb,SAAS,EAAG5B;QACZ;QACAmC,KAAK,EAAG,IAAAf,QAAE,EAAE,WAAY,CAAG;QAC3BY,OAAO,EAAGlB,cAAgB;QAC1BW,GAAG,EAAGvB,iBAAmB;QACzBmC,IAAI,EAAC;MAAS,CACd,CAAC;IAAA,CACD,CACF;EAAA,CACgB,CAAC;AAErB;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEchD,aAAa","ignoreList":[]}
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _react = require("react");
9
8
  var _blockEditor = require("@wordpress/block-editor");
10
9
  var _data = require("@wordpress/data");
11
10
  var _element = require("@wordpress/element");
@@ -17,6 +16,7 @@ var _preferences = require("@wordpress/preferences");
17
16
  var _documentTools = _interopRequireDefault(require("./document-tools"));
18
17
  var _saveButton = _interopRequireDefault(require("../save-button"));
19
18
  var _moreMenu = _interopRequireDefault(require("../more-menu"));
19
+ var _jsxRuntime = require("react/jsx-runtime");
20
20
  /**
21
21
  * WordPress dependencies
22
22
  */
@@ -33,27 +33,37 @@ function Header() {
33
33
  } = (0, _data.useSelect)(select => ({
34
34
  hasFixedToolbar: !!select(_preferences.store).get('core/edit-widgets', 'fixedToolbar')
35
35
  }), []);
36
- return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
37
- className: "edit-widgets-header"
38
- }, (0, _react.createElement)("div", {
39
- className: "edit-widgets-header__navigable-toolbar-wrapper"
40
- }, isLargeViewport && (0, _react.createElement)("h1", {
41
- className: "edit-widgets-header__title"
42
- }, (0, _i18n.__)('Widgets')), !isLargeViewport && (0, _react.createElement)(_components.VisuallyHidden, {
43
- as: "h1",
44
- className: "edit-widgets-header__title"
45
- }, (0, _i18n.__)('Widgets')), (0, _react.createElement)(_documentTools.default, null), hasFixedToolbar && isLargeViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
46
- className: "selected-block-tools-wrapper"
47
- }, (0, _react.createElement)(_blockEditor.BlockToolbar, {
48
- hideDragHandle: true
49
- })), (0, _react.createElement)(_components.Popover.Slot, {
50
- ref: blockToolbarRef,
51
- name: "block-toolbar"
52
- }))), (0, _react.createElement)("div", {
53
- className: "edit-widgets-header__actions"
54
- }, (0, _react.createElement)(_saveButton.default, null), (0, _react.createElement)(_interface.PinnedItems.Slot, {
55
- scope: "core/edit-widgets"
56
- }), (0, _react.createElement)(_moreMenu.default, null))));
36
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
37
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
38
+ className: "edit-widgets-header",
39
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
40
+ className: "edit-widgets-header__navigable-toolbar-wrapper",
41
+ children: [isLargeViewport && /*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
42
+ className: "edit-widgets-header__title",
43
+ children: (0, _i18n.__)('Widgets')
44
+ }), !isLargeViewport && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.VisuallyHidden, {
45
+ as: "h1",
46
+ className: "edit-widgets-header__title",
47
+ children: (0, _i18n.__)('Widgets')
48
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_documentTools.default, {}), hasFixedToolbar && isLargeViewport && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
49
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
50
+ className: "selected-block-tools-wrapper",
51
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockToolbar, {
52
+ hideDragHandle: true
53
+ })
54
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Popover.Slot, {
55
+ ref: blockToolbarRef,
56
+ name: "block-toolbar"
57
+ })]
58
+ })]
59
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
60
+ className: "edit-widgets-header__actions",
61
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_saveButton.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_interface.PinnedItems.Slot, {
62
+ scope: "core/edit-widgets"
63
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_moreMenu.default, {})]
64
+ })]
65
+ })
66
+ });
57
67
  }
58
68
  var _default = exports.default = Header;
59
69
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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,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,QACC,IAAAF,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAAqB,GACnC,IAAAH,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAAgD,GAC5DZ,eAAe,IAChB,IAAAS,MAAA,CAAAC,aAAA;IAAIE,SAAS,EAAC;EAA4B,GACvC,IAAAC,QAAE,EAAE,SAAU,CACb,CACJ,EACC,CAAEb,eAAe,IAClB,IAAAS,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAAuB,cAAc;IACdC,EAAE,EAAC,IAAI;IACPH,SAAS,EAAC;EAA4B,GAEpC,IAAAC,QAAE,EAAE,SAAU,CACD,CAChB,EACD,IAAAJ,MAAA,CAAAC,aAAA,EAACf,cAAA,CAAAqB,OAAa,MAAE,CAAC,EACfZ,eAAe,IAAIJ,eAAe,IACnC,IAAAS,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC5C,IAAAH,MAAA,CAAAC,aAAA,EAACxB,YAAA,CAAA+B,YAAY;IAACC,cAAc;EAAA,CAAE,CAC1B,CAAC,EACN,IAAAT,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAA4B,OAAO,CAACC,IAAI;IACZC,GAAG,EAAGnB,eAAiB;IACvBoB,IAAI,EAAC;EAAe,CACpB,CACA,CAEC,CAAC,EACN,IAAAb,MAAA,CAAAC,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,GAAAC,OAAA,CAAAV,OAAA,GAEcjB,MAAM","ignoreList":[]}
1
+ {"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_components","_interface","_compose","_preferences","_documentTools","_interopRequireDefault","_saveButton","_moreMenu","_jsxRuntime","Header","isLargeViewport","useViewportMatch","blockToolbarRef","useRef","hasFixedToolbar","useSelect","select","preferencesStore","get","jsx","Fragment","children","jsxs","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;AAAoC,IAAAY,WAAA,GAAAZ,OAAA;AAjBpC;AACA;AACA;;AAUA;AACA;AACA;;AAKA,SAASa,MAAMA,CAAA,EAAG;EACjB,MAAMC,eAAe,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;EACpD,MAAMC,eAAe,GAAG,IAAAC,eAAM,EAAC,CAAC;EAChC,MAAM;IAAEC;EAAgB,CAAC,GAAG,IAAAC,eAAS,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