@wordpress/edit-widgets 7.0.0 → 7.1.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 (188) hide show
  1. package/build/blocks/widget-area/edit/index.cjs +106 -116
  2. package/build/blocks/widget-area/edit/index.cjs.map +1 -7
  3. package/build/blocks/widget-area/edit/inner-blocks.cjs +44 -62
  4. package/build/blocks/widget-area/edit/inner-blocks.cjs.map +1 -7
  5. package/build/blocks/widget-area/edit/use-is-dragging-within.cjs +41 -53
  6. package/build/blocks/widget-area/edit/use-is-dragging-within.cjs.map +1 -7
  7. package/build/blocks/widget-area/index.cjs +40 -44
  8. package/build/blocks/widget-area/index.cjs.map +1 -7
  9. package/build/components/error-boundary/index.cjs +115 -155
  10. package/build/components/error-boundary/index.cjs.map +1 -7
  11. package/build/components/header/document-tools/index.cjs +80 -115
  12. package/build/components/header/document-tools/index.cjs.map +1 -7
  13. package/build/components/header/index.cjs +72 -80
  14. package/build/components/header/index.cjs.map +1 -7
  15. package/build/components/header/undo-redo/redo.cjs +30 -52
  16. package/build/components/header/undo-redo/redo.cjs.map +1 -7
  17. package/build/components/header/undo-redo/undo.cjs +29 -51
  18. package/build/components/header/undo-redo/undo.cjs.map +1 -7
  19. package/build/components/keyboard-shortcut-help-modal/config.cjs +88 -85
  20. package/build/components/keyboard-shortcut-help-modal/config.cjs.map +1 -7
  21. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs +40 -57
  22. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs.map +1 -7
  23. package/build/components/keyboard-shortcut-help-modal/index.cjs +94 -161
  24. package/build/components/keyboard-shortcut-help-modal/index.cjs.map +1 -7
  25. package/build/components/keyboard-shortcut-help-modal/shortcut.cjs +37 -75
  26. package/build/components/keyboard-shortcut-help-modal/shortcut.cjs.map +1 -7
  27. package/build/components/keyboard-shortcuts/index.cjs +107 -140
  28. package/build/components/keyboard-shortcuts/index.cjs.map +1 -7
  29. package/build/components/layout/index.cjs +65 -74
  30. package/build/components/layout/index.cjs.map +1 -7
  31. package/build/components/layout/interface.cjs +82 -108
  32. package/build/components/layout/interface.cjs.map +1 -7
  33. package/build/components/layout/unsaved-changes-warning.cjs +44 -48
  34. package/build/components/layout/unsaved-changes-warning.cjs.map +1 -7
  35. package/build/components/more-menu/index.cjs +125 -191
  36. package/build/components/more-menu/index.cjs.map +1 -7
  37. package/build/components/more-menu/tools-more-menu-group.cjs +9 -29
  38. package/build/components/more-menu/tools-more-menu-group.cjs.map +1 -7
  39. package/build/components/notices/index.cjs +19 -39
  40. package/build/components/notices/index.cjs.map +1 -7
  41. package/build/components/save-button/index.cjs +31 -58
  42. package/build/components/save-button/index.cjs.map +1 -7
  43. package/build/components/secondary-sidebar/index.cjs +38 -45
  44. package/build/components/secondary-sidebar/index.cjs.map +1 -7
  45. package/build/components/secondary-sidebar/inserter-sidebar.cjs +50 -51
  46. package/build/components/secondary-sidebar/inserter-sidebar.cjs.map +1 -7
  47. package/build/components/secondary-sidebar/list-view-sidebar.cjs +51 -82
  48. package/build/components/secondary-sidebar/list-view-sidebar.cjs.map +1 -7
  49. package/build/components/sidebar/index.cjs +117 -180
  50. package/build/components/sidebar/index.cjs.map +1 -7
  51. package/build/components/sidebar/widget-areas.cjs +43 -85
  52. package/build/components/sidebar/widget-areas.cjs.map +1 -7
  53. package/build/components/welcome-guide/index.cjs +110 -186
  54. package/build/components/welcome-guide/index.cjs.map +1 -7
  55. package/build/components/widget-areas-block-editor-content/index.cjs +59 -64
  56. package/build/components/widget-areas-block-editor-content/index.cjs.map +1 -7
  57. package/build/components/widget-areas-block-editor-provider/index.cjs +105 -140
  58. package/build/components/widget-areas-block-editor-provider/index.cjs.map +1 -7
  59. package/build/constants.cjs +11 -32
  60. package/build/constants.cjs.map +1 -7
  61. package/build/filters/index.cjs +7 -4
  62. package/build/filters/move-to-widget-area.cjs +38 -53
  63. package/build/filters/move-to-widget-area.cjs.map +1 -7
  64. package/build/filters/replace-media-upload.cjs +11 -9
  65. package/build/filters/replace-media-upload.cjs.map +1 -7
  66. package/build/hooks/use-last-selected-widget-area.cjs +28 -49
  67. package/build/hooks/use-last-selected-widget-area.cjs.map +1 -7
  68. package/build/hooks/use-widget-library-insertion-point.cjs +33 -67
  69. package/build/hooks/use-widget-library-insertion-point.cjs.map +1 -7
  70. package/build/index.cjs +96 -97
  71. package/build/index.cjs.map +1 -7
  72. package/build/lock-unlock.cjs +10 -35
  73. package/build/lock-unlock.cjs.map +1 -7
  74. package/build/store/actions.cjs +269 -278
  75. package/build/store/actions.cjs.map +1 -7
  76. package/build/store/constants.cjs +12 -29
  77. package/build/store/constants.cjs.map +1 -7
  78. package/build/store/index.cjs +61 -52
  79. package/build/store/index.cjs.map +1 -7
  80. package/build/store/private-selectors.cjs +11 -32
  81. package/build/store/private-selectors.cjs.map +1 -7
  82. package/build/store/reducer.cjs +107 -88
  83. package/build/store/reducer.cjs.map +1 -7
  84. package/build/store/resolvers.cjs +60 -91
  85. package/build/store/resolvers.cjs.map +1 -7
  86. package/build/store/selectors.cjs +196 -229
  87. package/build/store/selectors.cjs.map +1 -7
  88. package/build/store/transformers.cjs +51 -82
  89. package/build/store/transformers.cjs.map +1 -7
  90. package/build/store/utils.cjs +76 -63
  91. package/build/store/utils.cjs.map +1 -7
  92. package/build-module/blocks/widget-area/edit/index.mjs +82 -94
  93. package/build-module/blocks/widget-area/edit/index.mjs.map +1 -7
  94. package/build-module/blocks/widget-area/edit/inner-blocks.mjs +19 -35
  95. package/build-module/blocks/widget-area/edit/inner-blocks.mjs.map +1 -7
  96. package/build-module/blocks/widget-area/edit/use-is-dragging-within.mjs +36 -33
  97. package/build-module/blocks/widget-area/edit/use-is-dragging-within.mjs.map +1 -7
  98. package/build-module/blocks/widget-area/index.mjs +12 -15
  99. package/build-module/blocks/widget-area/index.mjs.map +1 -7
  100. package/build-module/components/error-boundary/index.mjs +103 -128
  101. package/build-module/components/error-boundary/index.mjs.map +1 -7
  102. package/build-module/components/header/document-tools/index.mjs +51 -84
  103. package/build-module/components/header/document-tools/index.mjs.map +1 -7
  104. package/build-module/components/header/index.mjs +40 -47
  105. package/build-module/components/header/index.mjs.map +1 -7
  106. package/build-module/components/header/undo-redo/redo.mjs +20 -27
  107. package/build-module/components/header/undo-redo/redo.mjs.map +1 -7
  108. package/build-module/components/header/undo-redo/undo.mjs +19 -26
  109. package/build-module/components/header/undo-redo/undo.mjs.map +1 -7
  110. package/build-module/components/keyboard-shortcut-help-modal/config.mjs +83 -61
  111. package/build-module/components/keyboard-shortcut-help-modal/config.mjs.map +1 -7
  112. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs +19 -33
  113. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs.map +1 -7
  114. package/build-module/components/keyboard-shortcut-help-modal/index.mjs +67 -136
  115. package/build-module/components/keyboard-shortcut-help-modal/index.mjs.map +1 -7
  116. package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs +31 -54
  117. package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs.map +1 -7
  118. package/build-module/components/keyboard-shortcuts/index.mjs +99 -119
  119. package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -7
  120. package/build-module/components/layout/index.mjs +29 -40
  121. package/build-module/components/layout/index.mjs.map +1 -7
  122. package/build-module/components/layout/interface.mjs +53 -82
  123. package/build-module/components/layout/interface.mjs.map +1 -7
  124. package/build-module/components/layout/unsaved-changes-warning.mjs +37 -26
  125. package/build-module/components/layout/unsaved-changes-warning.mjs.map +1 -7
  126. package/build-module/components/more-menu/index.mjs +95 -162
  127. package/build-module/components/more-menu/index.mjs.map +1 -7
  128. package/build-module/components/more-menu/tools-more-menu-group.mjs +5 -9
  129. package/build-module/components/more-menu/tools-more-menu-group.mjs.map +1 -7
  130. package/build-module/components/notices/index.mjs +12 -17
  131. package/build-module/components/notices/index.mjs.map +1 -7
  132. package/build-module/components/save-button/index.mjs +23 -35
  133. package/build-module/components/save-button/index.mjs.map +1 -7
  134. package/build-module/components/secondary-sidebar/index.mjs +15 -20
  135. package/build-module/components/secondary-sidebar/index.mjs.map +1 -7
  136. package/build-module/components/secondary-sidebar/inserter-sidebar.mjs +27 -25
  137. package/build-module/components/secondary-sidebar/inserter-sidebar.mjs.map +1 -7
  138. package/build-module/components/secondary-sidebar/list-view-sidebar.mjs +39 -55
  139. package/build-module/components/secondary-sidebar/list-view-sidebar.mjs.map +1 -7
  140. package/build-module/components/sidebar/index.mjs +96 -162
  141. package/build-module/components/sidebar/index.mjs.map +1 -7
  142. package/build-module/components/sidebar/widget-areas.mjs +30 -57
  143. package/build-module/components/sidebar/widget-areas.mjs.map +1 -7
  144. package/build-module/components/welcome-guide/index.mjs +103 -164
  145. package/build-module/components/welcome-guide/index.mjs.map +1 -7
  146. package/build-module/components/widget-areas-block-editor-content/index.mjs +34 -44
  147. package/build-module/components/widget-areas-block-editor-content/index.mjs.map +1 -7
  148. package/build-module/components/widget-areas-block-editor-provider/index.mjs +76 -109
  149. package/build-module/components/widget-areas-block-editor-provider/index.mjs.map +1 -7
  150. package/build-module/constants.mjs +5 -7
  151. package/build-module/constants.mjs.map +1 -7
  152. package/build-module/filters/index.mjs +0 -2
  153. package/build-module/filters/move-to-widget-area.mjs +28 -48
  154. package/build-module/filters/move-to-widget-area.mjs.map +1 -7
  155. package/build-module/filters/replace-media-upload.mjs +5 -8
  156. package/build-module/filters/replace-media-upload.mjs.map +1 -7
  157. package/build-module/hooks/use-last-selected-widget-area.mjs +23 -29
  158. package/build-module/hooks/use-last-selected-widget-area.mjs.map +1 -7
  159. package/build-module/hooks/use-widget-library-insertion-point.mjs +28 -47
  160. package/build-module/hooks/use-widget-library-insertion-point.mjs.map +1 -7
  161. package/build-module/index.mjs +62 -79
  162. package/build-module/index.mjs.map +1 -7
  163. package/build-module/lock-unlock.mjs +5 -10
  164. package/build-module/lock-unlock.mjs.map +1 -7
  165. package/build-module/store/actions.mjs +250 -247
  166. package/build-module/store/actions.mjs.map +1 -7
  167. package/build-module/store/constants.mjs +7 -5
  168. package/build-module/store/constants.mjs.map +1 -7
  169. package/build-module/store/index.mjs +18 -16
  170. package/build-module/store/index.mjs.map +1 -7
  171. package/build-module/store/private-selectors.mjs +5 -7
  172. package/build-module/store/private-selectors.mjs.map +1 -7
  173. package/build-module/store/reducer.mjs +95 -58
  174. package/build-module/store/reducer.mjs.map +1 -7
  175. package/build-module/store/resolvers.mjs +52 -71
  176. package/build-module/store/resolvers.mjs.map +1 -7
  177. package/build-module/store/selectors.mjs +178 -199
  178. package/build-module/store/selectors.mjs.map +1 -7
  179. package/build-module/store/transformers.mjs +44 -56
  180. package/build-module/store/transformers.mjs.map +1 -7
  181. package/build-module/store/utils.mjs +64 -32
  182. package/build-module/store/utils.mjs.map +1 -7
  183. package/package.json +33 -33
  184. package/src/components/header/index.jsx +2 -2
  185. package/src/components/sidebar/index.jsx +18 -18
  186. package/src/components/welcome-guide/index.jsx +4 -2
  187. package/build/filters/index.cjs.map +0 -7
  188. package/build-module/filters/index.mjs.map +0 -7
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/secondary-sidebar/inserter-sidebar.jsx"],
4
- "sourcesContent": ["import { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { rootClientId, insertionIndex } = useWidgetLibraryInsertionPoint();\n\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst closeInserter = useCallback( () => {\n\t\treturn setIsInserterOpened( false );\n\t}, [ setIsInserterOpened ] );\n\n\tconst libraryRef = useRef();\n\n\treturn (\n\t\t<div className=\"edit-widgets-layout__inserter-panel\">\n\t\t\t<div className=\"edit-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={ insertionIndex }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t\tonClose={ closeInserter }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],
5
- "mappings": ";AAAA,SAAS,yBAAyB,eAAe;AACjD,SAAS,wBAAwB;AACjC,SAAS,aAAa,cAAc;AACpC,SAAS,mBAAmB;AAC5B,OAAO,oCAAoC;AAC3C,SAAS,SAAS,wBAAwB;AAiBtC;AAfW,SAAR,kBAAmC;AACzC,QAAM,mBAAmB,iBAAkB,UAAU,GAAI;AACzD,QAAM,EAAE,cAAc,eAAe,IAAI,+BAA+B;AAExE,QAAM,EAAE,oBAAoB,IAAI,YAAa,gBAAiB;AAE9D,QAAM,gBAAgB,YAAa,MAAM;AACxC,WAAO,oBAAqB,KAAM;AAAA,EACnC,GAAG,CAAE,mBAAoB,CAAE;AAE3B,QAAM,aAAa,OAAO;AAE1B,SACC,oBAAC,SAAI,WAAU,uCACd,8BAAC,SAAI,WAAU,+CACd;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,kBAAmB;AAAA,MACnB;AAAA,MACA,8BAA+B;AAAA,MAC/B,KAAM;AAAA,MACN,SAAU;AAAA;AAAA,EACX,GACD,GACD;AAEF;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"inserter-sidebar.mjs","names":["editWidgetsStore","Library"],"sources":["../../../src/components/secondary-sidebar/inserter-sidebar.jsx"],"sourcesContent":["import { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { rootClientId, insertionIndex } = useWidgetLibraryInsertionPoint();\n\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst closeInserter = useCallback( () => {\n\t\treturn setIsInserterOpened( false );\n\t}, [ setIsInserterOpened ] );\n\n\tconst libraryRef = useRef();\n\n\treturn (\n\t\t<div className=\"edit-widgets-layout__inserter-panel\">\n\t\t\t<div className=\"edit-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={ insertionIndex }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t\tonClose={ closeInserter }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAOA,SAAwB,kBAAkB;CACzC,MAAM,mBAAmB,iBAAkB,UAAU,GAAI;CACzD,MAAM,EAAE,cAAc,mBAAmB,+BAA+B;CAExE,MAAM,EAAE,wBAAwB,YAAaA,KAAiB;CAE9D,MAAM,gBAAgB,kBAAmB;EACxC,OAAO,oBAAqB,KAAM;CACnC,GAAG,CAAE,mBAAoB,CAAE;CAE3B,MAAM,aAAa,OAAO;CAE1B,OACC,oBAAC,OAAD;EAAK,WAAU;EACd,UAAA,oBAAC,OAAD;GAAK,WAAU;GACd,UAAA,oBAACC,uBAAD;IACC,uBAAA;IACA,kBAAmB;IACJ;IACf,8BAA+B;IAC/B,KAAM;IACN,SAAU;GACV,CAAA;EACG,CAAA;CACD,CAAA;AAEP"}
@@ -1,65 +1,49 @@
1
- // packages/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.jsx
2
- import { __experimentalListView as ListView } from "@wordpress/block-editor";
1
+ import { __experimentalListView } from "@wordpress/block-editor";
3
2
  import { Button } from "@wordpress/components";
4
3
  import { useDispatch, useSelect } from "@wordpress/data";
5
4
  import { useCallback, useState } from "@wordpress/element";
6
5
  import { __ } from "@wordpress/i18n";
7
6
  import { closeSmall } from "@wordpress/icons";
8
7
  import { ESCAPE } from "@wordpress/keycodes";
9
- import { store as editWidgetsStore } from "../../store/index.mjs";
8
+ import { store } from "../../store/index.mjs";
10
9
  import { unlock } from "../../lock-unlock.mjs";
11
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
+ // packages/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.jsx
12
12
  function ListViewSidebar() {
13
- const { setIsListViewOpened } = useDispatch(editWidgetsStore);
14
- const { getListViewToggleRef } = unlock(useSelect(editWidgetsStore));
15
- const [dropZoneElement, setDropZoneElement] = useState(null);
16
- const closeListView = useCallback(() => {
17
- setIsListViewOpened(false);
18
- getListViewToggleRef().current?.focus();
19
- }, [getListViewToggleRef, setIsListViewOpened]);
20
- const closeOnEscape = useCallback(
21
- (event) => {
22
- if (event.keyCode === ESCAPE && !event.defaultPrevented) {
23
- event.preventDefault();
24
- closeListView();
25
- }
26
- },
27
- [closeListView]
28
- );
29
- return (
30
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
31
- /* @__PURE__ */ jsxs(
32
- "div",
33
- {
34
- className: "edit-widgets-editor__list-view-panel",
35
- onKeyDown: closeOnEscape,
36
- children: [
37
- /* @__PURE__ */ jsxs("div", { className: "edit-widgets-editor__list-view-panel-header", children: [
38
- /* @__PURE__ */ jsx("strong", { children: __("List View") }),
39
- /* @__PURE__ */ jsx(
40
- Button,
41
- {
42
- icon: closeSmall,
43
- label: __("Close"),
44
- onClick: closeListView,
45
- size: "compact"
46
- }
47
- )
48
- ] }),
49
- /* @__PURE__ */ jsx(
50
- "div",
51
- {
52
- className: "edit-widgets-editor__list-view-panel-content",
53
- ref: setDropZoneElement,
54
- children: /* @__PURE__ */ jsx(ListView, { dropZoneElement, focusOnMount: true })
55
- }
56
- )
57
- ]
58
- }
59
- )
60
- );
13
+ const { setIsListViewOpened } = useDispatch(store);
14
+ const { getListViewToggleRef } = unlock(useSelect(store));
15
+ const [dropZoneElement, setDropZoneElement] = useState(null);
16
+ const closeListView = useCallback(() => {
17
+ setIsListViewOpened(false);
18
+ getListViewToggleRef().current?.focus();
19
+ }, [getListViewToggleRef, setIsListViewOpened]);
20
+ const closeOnEscape = useCallback((event) => {
21
+ if (event.keyCode === ESCAPE && !event.defaultPrevented) {
22
+ event.preventDefault();
23
+ closeListView();
24
+ }
25
+ }, [closeListView]);
26
+ return /* @__PURE__ */ jsxs("div", {
27
+ className: "edit-widgets-editor__list-view-panel",
28
+ onKeyDown: closeOnEscape,
29
+ children: [/* @__PURE__ */ jsxs("div", {
30
+ className: "edit-widgets-editor__list-view-panel-header",
31
+ children: [/* @__PURE__ */ jsx("strong", { children: __("List View") }), /* @__PURE__ */ jsx(Button, {
32
+ icon: closeSmall,
33
+ label: __("Close"),
34
+ onClick: closeListView,
35
+ size: "compact"
36
+ })]
37
+ }), /* @__PURE__ */ jsx("div", {
38
+ className: "edit-widgets-editor__list-view-panel-content",
39
+ ref: setDropZoneElement,
40
+ children: /* @__PURE__ */ jsx(__experimentalListView, {
41
+ dropZoneElement,
42
+ focusOnMount: true
43
+ })
44
+ })]
45
+ });
61
46
  }
62
- export {
63
- ListViewSidebar as default
64
- };
65
- //# sourceMappingURL=list-view-sidebar.mjs.map
47
+ export { ListViewSidebar as default };
48
+
49
+ //# sourceMappingURL=list-view-sidebar.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/secondary-sidebar/list-view-sidebar.jsx"],
4
- "sourcesContent": ["import { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\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';\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\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\tsize=\"compact\"\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={ setDropZoneElement }\n\t\t\t>\n\t\t\t\t<ListView dropZoneElement={ dropZoneElement } focusOnMount />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],
5
- "mappings": ";AAAA,SAAS,0BAA0B,gBAAgB;AACnD,SAAS,cAAc;AACvB,SAAS,aAAa,iBAAiB;AACvC,SAAS,aAAa,gBAAgB;AACtC,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AAgCpB,SACC,KADD;AA9BY,SAAR,kBAAmC;AACzC,QAAM,EAAE,oBAAoB,IAAI,YAAa,gBAAiB;AAC9D,QAAM,EAAE,qBAAqB,IAAI,OAAQ,UAAW,gBAAiB,CAAE;AAIvE,QAAM,CAAE,iBAAiB,kBAAmB,IAAI,SAAU,IAAK;AAG/D,QAAM,gBAAgB,YAAa,MAAM;AACxC,wBAAqB,KAAM;AAC3B,yBAAqB,EAAE,SAAS,MAAM;AAAA,EACvC,GAAG,CAAE,sBAAsB,mBAAoB,CAAE;AAEjD,QAAM,gBAAgB;AAAA,IACrB,CAAE,UAAW;AACZ,UAAK,MAAM,YAAY,UAAU,CAAE,MAAM,kBAAmB;AAC3D,cAAM,eAAe;AACrB,sBAAc;AAAA,MACf;AAAA,IACD;AAAA,IACA,CAAE,aAAc;AAAA,EACjB;AAEA;AAAA;AAAA,IAEC;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,WAAY;AAAA,QAEZ;AAAA,+BAAC,SAAI,WAAU,+CACd;AAAA,gCAAC,YAAS,aAAI,WAAY,GAAG;AAAA,YAC7B;AAAA,cAAC;AAAA;AAAA,gBACA,MAAO;AAAA,gBACP,OAAQ,GAAI,OAAQ;AAAA,gBACpB,SAAU;AAAA,gBACV,MAAK;AAAA;AAAA,YACN;AAAA,aACD;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,WAAU;AAAA,cACV,KAAM;AAAA,cAEN,8BAAC,YAAS,iBAAoC,cAAY,MAAC;AAAA;AAAA,UAC5D;AAAA;AAAA;AAAA,IACD;AAAA;AAEF;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"list-view-sidebar.mjs","names":["editWidgetsStore","ListView"],"sources":["../../../src/components/secondary-sidebar/list-view-sidebar.jsx"],"sourcesContent":["import { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\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';\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\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\tsize=\"compact\"\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={ setDropZoneElement }\n\t\t\t>\n\t\t\t\t<ListView dropZoneElement={ dropZoneElement } focusOnMount />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAwB,kBAAkB;CACzC,MAAM,EAAE,wBAAwB,YAAaA,KAAiB;CAC9D,MAAM,EAAE,yBAAyB,OAAQ,UAAWA,KAAiB,CAAE;CAIvE,MAAM,CAAE,iBAAiB,sBAAuB,SAAU,IAAK;CAG/D,MAAM,gBAAgB,kBAAmB;EACxC,oBAAqB,KAAM;EAC3B,qBAAqB,CAAC,CAAC,SAAS,MAAM;CACvC,GAAG,CAAE,sBAAsB,mBAAoB,CAAE;CAEjD,MAAM,gBAAgB,aACnB,UAAW;EACZ,IAAK,MAAM,YAAY,UAAU,CAAE,MAAM,kBAAmB;GAC3D,MAAM,eAAe;GACrB,cAAc;EACf;CACD,GACA,CAAE,aAAc,CACjB;CAEA,OAEC,qBAAC,OAAD;EACC,WAAU;EACV,WAAY;EAFb,UAAA,CAIC,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACC,oBAAC,UAAD,EAAA,UAAU,GAAI,WAAY,EAAW,CAAA,GACrC,oBAAC,QAAD;IACC,MAAO;IACP,OAAQ,GAAI,OAAQ;IACpB,SAAU;IACV,MAAK;GACL,CAAA,CACG;EACL,CAAA,GAAA,oBAAC,OAAD;GACC,WAAU;GACV,KAAM;GAEN,UAAA,oBAACC,wBAAD;IAA4B;IAAkB,cAAA;GAAc,CAAA;EACxD,CAAA,CACD;;AAEP"}
@@ -1,170 +1,104 @@
1
- // packages/edit-widgets/src/components/sidebar/index.jsx
2
- import { useEffect, useContext, useCallback } from "@wordpress/element";
3
- import { isRTL, __ } from "@wordpress/i18n";
4
- import {
5
- ComplementaryArea,
6
- store as interfaceStore
7
- } from "@wordpress/interface";
8
- import {
9
- BlockInspector,
10
- store as blockEditorStore
11
- } from "@wordpress/block-editor";
1
+ import { useCallback, useContext, useEffect } from "@wordpress/element";
2
+ import { __, isRTL } from "@wordpress/i18n";
3
+ import { ComplementaryArea, store } from "@wordpress/interface";
4
+ import { BlockInspector, store as store$1 } from "@wordpress/block-editor";
12
5
  import { drawerLeft, drawerRight } from "@wordpress/icons";
13
- import { privateApis as componentsPrivateApis } from "@wordpress/components";
14
- import { useSelect, useDispatch } from "@wordpress/data";
6
+ import { privateApis } from "@wordpress/components";
7
+ import { useDispatch, useSelect } from "@wordpress/data";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
15
9
  import WidgetAreas from "./widget-areas.mjs";
16
- import { store as editWidgetsStore } from "../../store/index.mjs";
10
+ import { store as store$2 } from "../../store/index.mjs";
17
11
  import { unlock } from "../../lock-unlock.mjs";
18
- import { jsx, jsxs } from "react/jsx-runtime";
19
- var SIDEBAR_ACTIVE_BY_DEFAULT = true;
20
- var BLOCK_INSPECTOR_IDENTIFIER = "edit-widgets/block-inspector";
21
- var WIDGET_AREAS_IDENTIFIER = "edit-widgets/block-areas";
22
- var { Tabs } = unlock(componentsPrivateApis);
12
+ // packages/edit-widgets/src/components/sidebar/index.jsx
13
+ const SIDEBAR_ACTIVE_BY_DEFAULT = true;
14
+ const BLOCK_INSPECTOR_IDENTIFIER = "edit-widgets/block-inspector";
15
+ const WIDGET_AREAS_IDENTIFIER = "edit-widgets/block-areas";
16
+ const { Tabs: WCTabs } = unlock(privateApis);
23
17
  function SidebarHeader({ selectedWidgetAreaBlock }) {
24
- return /* @__PURE__ */ jsxs(Tabs.TabList, { children: [
25
- /* @__PURE__ */ jsx(Tabs.Tab, { tabId: WIDGET_AREAS_IDENTIFIER, children: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : __("Widget Areas") }),
26
- /* @__PURE__ */ jsx(Tabs.Tab, { tabId: BLOCK_INSPECTOR_IDENTIFIER, children: __("Block") })
27
- ] });
18
+ return /* @__PURE__ */ jsxs(WCTabs.TabList, { children: [/* @__PURE__ */ jsx(WCTabs.Tab, {
19
+ tabId: WIDGET_AREAS_IDENTIFIER,
20
+ children: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : __("Widget Areas")
21
+ }), /* @__PURE__ */ jsx(WCTabs.Tab, {
22
+ tabId: BLOCK_INSPECTOR_IDENTIFIER,
23
+ children: __("Block")
24
+ })] });
28
25
  }
29
- function SidebarContent({
30
- hasSelectedNonAreaBlock,
31
- currentArea,
32
- isGeneralSidebarOpen,
33
- selectedWidgetAreaBlock
34
- }) {
35
- const { enableComplementaryArea } = useDispatch(interfaceStore);
36
- useEffect(() => {
37
- if (hasSelectedNonAreaBlock && currentArea === WIDGET_AREAS_IDENTIFIER && isGeneralSidebarOpen) {
38
- enableComplementaryArea(
39
- "core/edit-widgets",
40
- BLOCK_INSPECTOR_IDENTIFIER
41
- );
42
- }
43
- if (!hasSelectedNonAreaBlock && currentArea === BLOCK_INSPECTOR_IDENTIFIER && isGeneralSidebarOpen) {
44
- enableComplementaryArea(
45
- "core/edit-widgets",
46
- WIDGET_AREAS_IDENTIFIER
47
- );
48
- }
49
- }, [hasSelectedNonAreaBlock, enableComplementaryArea]);
50
- const tabsContextValue = useContext(Tabs.Context);
51
- return /* @__PURE__ */ jsx(
52
- ComplementaryArea,
53
- {
54
- className: "edit-widgets-sidebar",
55
- header: /* @__PURE__ */ jsx(Tabs.Context.Provider, { value: tabsContextValue, children: /* @__PURE__ */ jsx(
56
- SidebarHeader,
57
- {
58
- selectedWidgetAreaBlock
59
- }
60
- ) }),
61
- headerClassName: "edit-widgets-sidebar__panel-tabs",
62
- title: __("Settings"),
63
- closeLabel: __("Close Settings"),
64
- scope: "core/edit-widgets",
65
- identifier: currentArea,
66
- icon: isRTL() ? drawerLeft : drawerRight,
67
- isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT,
68
- children: /* @__PURE__ */ jsxs(Tabs.Context.Provider, { value: tabsContextValue, children: [
69
- /* @__PURE__ */ jsx(
70
- Tabs.TabPanel,
71
- {
72
- tabId: WIDGET_AREAS_IDENTIFIER,
73
- focusable: false,
74
- children: /* @__PURE__ */ jsx(
75
- WidgetAreas,
76
- {
77
- selectedWidgetAreaId: selectedWidgetAreaBlock?.attributes.id
78
- }
79
- )
80
- }
81
- ),
82
- /* @__PURE__ */ jsx(
83
- Tabs.TabPanel,
84
- {
85
- tabId: BLOCK_INSPECTOR_IDENTIFIER,
86
- focusable: false,
87
- children: hasSelectedNonAreaBlock ? /* @__PURE__ */ jsx(BlockInspector, {}) : (
88
- // Pretend that Widget Areas are part of the UI by not
89
- // showing the Block Inspector when one is selected.
90
- /* @__PURE__ */ jsx("span", { className: "block-editor-block-inspector__no-blocks", children: __("No block selected.") })
91
- )
92
- }
93
- )
94
- ] })
95
- }
96
- );
26
+ function SidebarContent({ hasSelectedNonAreaBlock, currentArea, isGeneralSidebarOpen, selectedWidgetAreaBlock }) {
27
+ const { enableComplementaryArea } = useDispatch(store);
28
+ useEffect(() => {
29
+ if (hasSelectedNonAreaBlock && currentArea === WIDGET_AREAS_IDENTIFIER && isGeneralSidebarOpen) enableComplementaryArea("core/edit-widgets", BLOCK_INSPECTOR_IDENTIFIER);
30
+ if (!hasSelectedNonAreaBlock && currentArea === BLOCK_INSPECTOR_IDENTIFIER && isGeneralSidebarOpen) enableComplementaryArea("core/edit-widgets", WIDGET_AREAS_IDENTIFIER);
31
+ }, [hasSelectedNonAreaBlock, enableComplementaryArea]);
32
+ const tabsContextValue = useContext(WCTabs.Context);
33
+ return /* @__PURE__ */ jsx(ComplementaryArea, {
34
+ className: "edit-widgets-sidebar",
35
+ header: /* @__PURE__ */ jsx(WCTabs.Context.Provider, {
36
+ value: tabsContextValue,
37
+ children: /* @__PURE__ */ jsx(SidebarHeader, { selectedWidgetAreaBlock })
38
+ }),
39
+ headerClassName: "edit-widgets-sidebar__panel-tabs",
40
+ title: __("Settings"),
41
+ closeLabel: __("Close Settings"),
42
+ scope: "core/edit-widgets",
43
+ identifier: currentArea,
44
+ icon: isRTL() ? drawerLeft : drawerRight,
45
+ isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT,
46
+ children: /* @__PURE__ */ jsxs(WCTabs.Context.Provider, {
47
+ value: tabsContextValue,
48
+ children: [/* @__PURE__ */ jsx(WCTabs.TabPanel, {
49
+ tabId: WIDGET_AREAS_IDENTIFIER,
50
+ focusable: false,
51
+ children: /* @__PURE__ */ jsx(WidgetAreas, { selectedWidgetAreaId: selectedWidgetAreaBlock?.attributes.id })
52
+ }), /* @__PURE__ */ jsx(WCTabs.TabPanel, {
53
+ tabId: BLOCK_INSPECTOR_IDENTIFIER,
54
+ focusable: false,
55
+ children: hasSelectedNonAreaBlock ? /* @__PURE__ */ jsx(BlockInspector, {}) : /* @__PURE__ */ jsx("span", {
56
+ className: "block-editor-block-inspector__no-blocks",
57
+ children: __("No block selected.")
58
+ })
59
+ })]
60
+ })
61
+ });
97
62
  }
98
63
  function Sidebar() {
99
- const {
100
- currentArea,
101
- hasSelectedNonAreaBlock,
102
- isGeneralSidebarOpen,
103
- selectedWidgetAreaBlock
104
- } = useSelect((select) => {
105
- const { getSelectedBlock, getBlock, getBlockParentsByBlockName } = select(blockEditorStore);
106
- const { getActiveComplementaryArea } = select(interfaceStore);
107
- const selectedBlock = getSelectedBlock();
108
- const activeArea = getActiveComplementaryArea(editWidgetsStore.name);
109
- let currentSelection = activeArea;
110
- if (!currentSelection) {
111
- if (selectedBlock) {
112
- currentSelection = BLOCK_INSPECTOR_IDENTIFIER;
113
- } else {
114
- currentSelection = WIDGET_AREAS_IDENTIFIER;
115
- }
116
- }
117
- let widgetAreaBlock;
118
- if (selectedBlock) {
119
- if (selectedBlock.name === "core/widget-area") {
120
- widgetAreaBlock = selectedBlock;
121
- } else {
122
- widgetAreaBlock = getBlock(
123
- getBlockParentsByBlockName(
124
- selectedBlock.clientId,
125
- "core/widget-area"
126
- )[0]
127
- );
128
- }
129
- }
130
- return {
131
- currentArea: currentSelection,
132
- hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== "core/widget-area"),
133
- isGeneralSidebarOpen: !!activeArea,
134
- selectedWidgetAreaBlock: widgetAreaBlock
135
- };
136
- }, []);
137
- const { enableComplementaryArea } = useDispatch(interfaceStore);
138
- const onTabSelect = useCallback(
139
- (newSelectedTabId) => {
140
- if (!!newSelectedTabId) {
141
- enableComplementaryArea(
142
- editWidgetsStore.name,
143
- newSelectedTabId
144
- );
145
- }
146
- },
147
- [enableComplementaryArea]
148
- );
149
- return /* @__PURE__ */ jsx(
150
- Tabs,
151
- {
152
- selectedTabId: isGeneralSidebarOpen ? currentArea : null,
153
- onSelect: onTabSelect,
154
- selectOnMove: false,
155
- children: /* @__PURE__ */ jsx(
156
- SidebarContent,
157
- {
158
- hasSelectedNonAreaBlock,
159
- currentArea,
160
- isGeneralSidebarOpen,
161
- selectedWidgetAreaBlock
162
- }
163
- )
164
- }
165
- );
64
+ const { currentArea, hasSelectedNonAreaBlock, isGeneralSidebarOpen, selectedWidgetAreaBlock } = useSelect((select) => {
65
+ const { getSelectedBlock, getBlock, getBlockParentsByBlockName } = select(store$1);
66
+ const { getActiveComplementaryArea } = select(store);
67
+ const selectedBlock = getSelectedBlock();
68
+ const activeArea = getActiveComplementaryArea(store$2.name);
69
+ let currentSelection = activeArea;
70
+ if (!currentSelection) {
71
+ if (selectedBlock) currentSelection = BLOCK_INSPECTOR_IDENTIFIER;
72
+ else currentSelection = WIDGET_AREAS_IDENTIFIER;
73
+ }
74
+ let widgetAreaBlock;
75
+ if (selectedBlock) {
76
+ if (selectedBlock.name === "core/widget-area") widgetAreaBlock = selectedBlock;
77
+ else widgetAreaBlock = getBlock(getBlockParentsByBlockName(selectedBlock.clientId, "core/widget-area")[0]);
78
+ }
79
+ return {
80
+ currentArea: currentSelection,
81
+ hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== "core/widget-area"),
82
+ isGeneralSidebarOpen: !!activeArea,
83
+ selectedWidgetAreaBlock: widgetAreaBlock
84
+ };
85
+ }, []);
86
+ const { enableComplementaryArea } = useDispatch(store);
87
+ const onTabSelect = useCallback((newSelectedTabId) => {
88
+ if (!!newSelectedTabId) enableComplementaryArea(store$2.name, newSelectedTabId);
89
+ }, [enableComplementaryArea]);
90
+ return /* @__PURE__ */ jsx(WCTabs, {
91
+ selectedTabId: isGeneralSidebarOpen ? currentArea : null,
92
+ onSelect: onTabSelect,
93
+ selectOnMove: false,
94
+ children: /* @__PURE__ */ jsx(SidebarContent, {
95
+ hasSelectedNonAreaBlock,
96
+ currentArea,
97
+ isGeneralSidebarOpen,
98
+ selectedWidgetAreaBlock
99
+ })
100
+ });
166
101
  }
167
- export {
168
- Sidebar as default
169
- };
170
- //# sourceMappingURL=index.mjs.map
102
+ export { Sidebar as default };
103
+
104
+ //# sourceMappingURL=index.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/sidebar/index.jsx"],
4
- "sourcesContent": ["import { useEffect, useContext, useCallback } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nconst SIDEBAR_ACTIVE_BY_DEFAULT = true;\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n// Widget areas were once called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<Tabs.TabList>\n\t\t\t<Tabs.Tab tabId={ WIDGET_AREAS_IDENTIFIER }>\n\t\t\t\t{ selectedWidgetAreaBlock\n\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t: __( 'Widget Areas' ) }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.TabList>\n\t);\n}\n\nfunction SidebarContent( {\n\thasSelectedNonAreaBlock,\n\tcurrentArea,\n\tisGeneralSidebarOpen,\n\tselectedWidgetAreaBlock,\n} ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\t// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`\n\t\t// out of the dep array because we want this effect to run based on\n\t\t// block selection changes, not sidebar state changes.\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader\n\t\t\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<WidgetAreas\n\t\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t{ hasSelectedNonAreaBlock ? (\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsy if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsy handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\teditWidgetsStore.name,\n\t\t\t\t\tnewSelectedTabId\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isGeneralSidebarOpen ? currentArea : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\thasSelectedNonAreaBlock={ hasSelectedNonAreaBlock }\n\t\t\t\tcurrentArea={ currentArea }\n\t\t\t\tisGeneralSidebarOpen={ isGeneralSidebarOpen }\n\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],
5
- "mappings": ";AAAA,SAAS,WAAW,YAAY,mBAAmB;AACnD,SAAS,OAAO,UAAU;AAC1B;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,YAAY,mBAAmB;AACxC,SAAS,eAAe,6BAA6B;AACrD,SAAS,WAAW,mBAAmB;AAMvC,OAAO,iBAAiB;AACxB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AAMrB,SACC,KADD;AAbF,IAAM,4BAA4B;AAClC,IAAM,6BAA6B;AAGnC,IAAM,0BAA0B;AAKhC,IAAM,EAAE,KAAK,IAAI,OAAQ,qBAAsB;AAE/C,SAAS,cAAe,EAAE,wBAAwB,GAAI;AACrD,SACC,qBAAC,KAAK,SAAL,EACA;AAAA,wBAAC,KAAK,KAAL,EAAS,OAAQ,yBACf,oCACC,wBAAwB,WAAW,OACnC,GAAI,cAAe,GACvB;AAAA,IACA,oBAAC,KAAK,KAAL,EAAS,OAAQ,4BACf,aAAI,OAAQ,GACf;AAAA,KACD;AAEF;AAEA,SAAS,eAAgB;AAAA,E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,"file":"index.mjs","names":["componentsPrivateApis","interfaceStore","blockEditorStore","editWidgetsStore"],"sources":["../../../src/components/sidebar/index.jsx"],"sourcesContent":["import { useEffect, useContext, useCallback } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nconst SIDEBAR_ACTIVE_BY_DEFAULT = true;\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n// Widget areas were once called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs: WCTabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<WCTabs.TabList>\n\t\t\t<WCTabs.Tab tabId={ WIDGET_AREAS_IDENTIFIER }>\n\t\t\t\t{ selectedWidgetAreaBlock\n\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t: __( 'Widget Areas' ) }\n\t\t\t</WCTabs.Tab>\n\t\t\t<WCTabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</WCTabs.Tab>\n\t\t</WCTabs.TabList>\n\t);\n}\n\nfunction SidebarContent( {\n\thasSelectedNonAreaBlock,\n\tcurrentArea,\n\tisGeneralSidebarOpen,\n\tselectedWidgetAreaBlock,\n} ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\t// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`\n\t\t// out of the dep array because we want this effect to run based on\n\t\t// block selection changes, not sidebar state changes.\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\tconst tabsContextValue = useContext( WCTabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<WCTabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader\n\t\t\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t\t\t/>\n\t\t\t\t</WCTabs.Context.Provider>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<WCTabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<WCTabs.TabPanel\n\t\t\t\t\ttabId={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<WidgetAreas\n\t\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</WCTabs.TabPanel>\n\t\t\t\t<WCTabs.TabPanel\n\t\t\t\t\ttabId={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t{ hasSelectedNonAreaBlock ? (\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</WCTabs.TabPanel>\n\t\t\t</WCTabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsy if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsy handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\teditWidgetsStore.name,\n\t\t\t\t\tnewSelectedTabId\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<WCTabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isGeneralSidebarOpen ? currentArea : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\thasSelectedNonAreaBlock={ hasSelectedNonAreaBlock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AEV"}
@@ -1,4 +1,3 @@
1
- // packages/edit-widgets/src/components/sidebar/widget-areas.jsx
2
1
  import { useSelect } from "@wordpress/data";
3
2
  import { useMemo } from "@wordpress/element";
4
3
  import { layout } from "@wordpress/icons";
@@ -7,62 +6,36 @@ import { Button } from "@wordpress/components";
7
6
  import { __ } from "@wordpress/i18n";
8
7
  import { addQueryArgs } from "@wordpress/url";
9
8
  import { safeHTML } from "@wordpress/dom";
10
- import { store as editWidgetsStore } from "../../store/index.mjs";
9
+ import { store } from "../../store/index.mjs";
11
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
+ // packages/edit-widgets/src/components/sidebar/widget-areas.jsx
12
12
  function WidgetAreas({ selectedWidgetAreaId }) {
13
- const widgetAreas = useSelect(
14
- (select) => select(editWidgetsStore).getWidgetAreas(),
15
- []
16
- );
17
- const selectedWidgetArea = useMemo(
18
- () => selectedWidgetAreaId && widgetAreas?.find(
19
- (widgetArea) => widgetArea.id === selectedWidgetAreaId
20
- ),
21
- [selectedWidgetAreaId, widgetAreas]
22
- );
23
- let description;
24
- if (!selectedWidgetArea) {
25
- description = __(
26
- // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts
27
- "Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer."
28
- );
29
- } else if (selectedWidgetAreaId === "wp_inactive_widgets") {
30
- description = __(
31
- "Blocks in this Widget Area will not be displayed in your site."
32
- );
33
- } else {
34
- description = selectedWidgetArea.description;
35
- }
36
- return /* @__PURE__ */ jsx("div", { className: "edit-widgets-widget-areas", children: /* @__PURE__ */ jsxs("div", { className: "edit-widgets-widget-areas__top-container", children: [
37
- /* @__PURE__ */ jsx(BlockIcon, { icon: layout }),
38
- /* @__PURE__ */ jsxs("div", { children: [
39
- /* @__PURE__ */ jsx(
40
- "p",
41
- {
42
- dangerouslySetInnerHTML: {
43
- __html: safeHTML(description)
44
- }
45
- }
46
- ),
47
- widgetAreas?.length === 0 && /* @__PURE__ */ jsx("p", { children: __(
48
- "Your theme does not contain any Widget Areas."
49
- ) }),
50
- !selectedWidgetArea && /* @__PURE__ */ jsx(
51
- Button,
52
- {
53
- __next40pxDefaultSize: true,
54
- href: addQueryArgs("customize.php", {
55
- "autofocus[panel]": "widgets",
56
- return: window.location.pathname
57
- }),
58
- variant: "tertiary",
59
- children: __("Manage with live preview")
60
- }
61
- )
62
- ] })
63
- ] }) });
13
+ const widgetAreas = useSelect((select) => select(store).getWidgetAreas(), []);
14
+ const selectedWidgetArea = useMemo(() => selectedWidgetAreaId && widgetAreas?.find((widgetArea) => widgetArea.id === selectedWidgetAreaId), [selectedWidgetAreaId, widgetAreas]);
15
+ let description;
16
+ if (!selectedWidgetArea) description = __("Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer.");
17
+ else if (selectedWidgetAreaId === "wp_inactive_widgets") description = __("Blocks in this Widget Area will not be displayed in your site.");
18
+ else description = selectedWidgetArea.description;
19
+ return /* @__PURE__ */ jsx("div", {
20
+ className: "edit-widgets-widget-areas",
21
+ children: /* @__PURE__ */ jsxs("div", {
22
+ className: "edit-widgets-widget-areas__top-container",
23
+ children: [/* @__PURE__ */ jsx(BlockIcon, { icon: layout }), /* @__PURE__ */ jsxs("div", { children: [
24
+ /* @__PURE__ */ jsx("p", { dangerouslySetInnerHTML: { __html: safeHTML(description) } }),
25
+ widgetAreas?.length === 0 && /* @__PURE__ */ jsx("p", { children: __("Your theme does not contain any Widget Areas.") }),
26
+ !selectedWidgetArea && /* @__PURE__ */ jsx(Button, {
27
+ __next40pxDefaultSize: true,
28
+ href: addQueryArgs("customize.php", {
29
+ "autofocus[panel]": "widgets",
30
+ return: window.location.pathname
31
+ }),
32
+ variant: "tertiary",
33
+ children: __("Manage with live preview")
34
+ })
35
+ ] })]
36
+ })
37
+ });
64
38
  }
65
- export {
66
- WidgetAreas as default
67
- };
68
- //# sourceMappingURL=widget-areas.mjs.map
39
+ export { WidgetAreas as default };
40
+
41
+ //# sourceMappingURL=widget-areas.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/sidebar/widget-areas.jsx"],
4
- "sourcesContent": ["import { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { layout } from '@wordpress/icons';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { safeHTML } from '@wordpress/dom';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function WidgetAreas( { selectedWidgetAreaId } ) {\n\tconst widgetAreas = useSelect(\n\t\t( select ) => select( editWidgetsStore ).getWidgetAreas(),\n\t\t[]\n\t);\n\n\tconst selectedWidgetArea = useMemo(\n\t\t() =>\n\t\t\tselectedWidgetAreaId &&\n\t\t\twidgetAreas?.find(\n\t\t\t\t( widgetArea ) => widgetArea.id === selectedWidgetAreaId\n\t\t\t),\n\t\t[ selectedWidgetAreaId, widgetAreas ]\n\t);\n\n\tlet description;\n\tif ( ! selectedWidgetArea ) {\n\t\tdescription = __(\n\t\t\t// eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts\n\t\t\t'Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer.'\n\t\t);\n\t} else if ( selectedWidgetAreaId === 'wp_inactive_widgets' ) {\n\t\tdescription = __(\n\t\t\t'Blocks in this Widget Area will not be displayed in your site.'\n\t\t);\n\t} else {\n\t\tdescription = selectedWidgetArea.description;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-widgets-widget-areas\">\n\t\t\t<div className=\"edit-widgets-widget-areas__top-container\">\n\t\t\t\t<BlockIcon icon={ layout } />\n\t\t\t\t<div>\n\t\t\t\t\t<p\n\t\t\t\t\t\t// Use `dangerouslySetInnerHTML` to keep backwards\n\t\t\t\t\t\t// compatibility. Basic markup in the description is an\n\t\t\t\t\t\t// established feature of WordPress.\n\t\t\t\t\t\t// @see https://github.com/WordPress/gutenberg/issues/33106\n\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t__html: safeHTML( description ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ widgetAreas?.length === 0 && (\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Your theme does not contain any Widget Areas.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! selectedWidgetArea && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\thref={ addQueryArgs( 'customize.php', {\n\t\t\t\t\t\t\t\t'autofocus[panel]': 'widgets',\n\t\t\t\t\t\t\t\treturn: window.location.pathname,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Manage with live preview' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],
5
- "mappings": ";AAAA,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AACvB,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,SAAS,wBAAwB;AAkCtC,cACA,YADA;AAhCW,SAAR,YAA8B,EAAE,qBAAqB,GAAI;AAC/D,QAAM,cAAc;AAAA,IACnB,CAAE,WAAY,OAAQ,gBAAiB,EAAE,eAAe;AAAA,IACxD,CAAC;AAAA,EACF;AAEA,QAAM,qBAAqB;AAAA,IAC1B,MACC,wBACA,aAAa;AAAA,MACZ,CAAE,eAAgB,WAAW,OAAO;AAAA,IACrC;AAAA,IACD,CAAE,sBAAsB,WAAY;AAAA,EACrC;AAEA,MAAI;AACJ,MAAK,CAAE,oBAAqB;AAC3B,kBAAc;AAAA;AAAA,MAEb;AAAA,IACD;AAAA,EACD,WAAY,yBAAyB,uBAAwB;AAC5D,kBAAc;AAAA,MACb;AAAA,IACD;AAAA,EACD,OAAO;AACN,kBAAc,mBAAmB;AAAA,EAClC;AAEA,SACC,oBAAC,SAAI,WAAU,6BACd,+BAAC,SAAI,WAAU,4CACd;AAAA,wBAAC,aAAU,MAAO,QAAS;AAAA,IAC3B,qBAAC,SACA;AAAA;AAAA,QAAC;AAAA;AAAA,UAKA,yBAA0B;AAAA,YACzB,QAAQ,SAAU,WAAY;AAAA,UAC/B;AAAA;AAAA,MACD;AAAA,MACE,aAAa,WAAW,KACzB,oBAAC,OACE;AAAA,QACD;AAAA,MACD,GACD;AAAA,MAEC,CAAE,sBACH;AAAA,QAAC;AAAA;AAAA,UACA,uBAAqB;AAAA,UACrB,MAAO,aAAc,iBAAiB;AAAA,YACrC,oBAAoB;AAAA,YACpB,QAAQ,OAAO,SAAS;AAAA,UACzB,CAAE;AAAA,UACF,SAAQ;AAAA,UAEN,aAAI,0BAA2B;AAAA;AAAA,MAClC;AAAA,OAEF;AAAA,KACD,GACD;AAEF;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"widget-areas.mjs","names":["editWidgetsStore"],"sources":["../../../src/components/sidebar/widget-areas.jsx"],"sourcesContent":["import { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { layout } from '@wordpress/icons';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { safeHTML } from '@wordpress/dom';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function WidgetAreas( { selectedWidgetAreaId } ) {\n\tconst widgetAreas = useSelect(\n\t\t( select ) => select( editWidgetsStore ).getWidgetAreas(),\n\t\t[]\n\t);\n\n\tconst selectedWidgetArea = useMemo(\n\t\t() =>\n\t\t\tselectedWidgetAreaId &&\n\t\t\twidgetAreas?.find(\n\t\t\t\t( widgetArea ) => widgetArea.id === selectedWidgetAreaId\n\t\t\t),\n\t\t[ selectedWidgetAreaId, widgetAreas ]\n\t);\n\n\tlet description;\n\tif ( ! selectedWidgetArea ) {\n\t\tdescription = __(\n\t\t\t// eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts\n\t\t\t'Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer.'\n\t\t);\n\t} else if ( selectedWidgetAreaId === 'wp_inactive_widgets' ) {\n\t\tdescription = __(\n\t\t\t'Blocks in this Widget Area will not be displayed in your site.'\n\t\t);\n\t} else {\n\t\tdescription = selectedWidgetArea.description;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-widgets-widget-areas\">\n\t\t\t<div className=\"edit-widgets-widget-areas__top-container\">\n\t\t\t\t<BlockIcon icon={ layout } />\n\t\t\t\t<div>\n\t\t\t\t\t<p\n\t\t\t\t\t\t// Use `dangerouslySetInnerHTML` to keep backwards\n\t\t\t\t\t\t// compatibility. Basic markup in the description is an\n\t\t\t\t\t\t// established feature of WordPress.\n\t\t\t\t\t\t// @see https://github.com/WordPress/gutenberg/issues/33106\n\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t__html: safeHTML( description ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ widgetAreas?.length === 0 && (\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Your theme does not contain any Widget Areas.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! selectedWidgetArea && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\thref={ addQueryArgs( 'customize.php', {\n\t\t\t\t\t\t\t\t'autofocus[panel]': 'widgets',\n\t\t\t\t\t\t\t\treturn: window.location.pathname,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Manage with live preview' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAwB,YAAa,EAAE,wBAAyB;CAC/D,MAAM,cAAc,WACjB,WAAY,OAAQA,KAAiB,CAAC,CAAC,eAAe,GACxD,CAAC,CACF;CAEA,MAAM,qBAAqB,cAEzB,wBACA,aAAa,MACV,eAAgB,WAAW,OAAO,oBACrC,GACD,CAAE,sBAAsB,WAAY,CACrC;CAEA,IAAI;CACJ,IAAK,CAAE,oBACN,cAAc,GAEb,uJACD;MACM,IAAK,yBAAyB,uBACpC,cAAc,GACb,gEACD;MAEA,cAAc,mBAAmB;CAGlC,OACC,oBAAC,OAAD;EAAK,WAAU;EACd,UAAA,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACC,oBAAC,WAAD,EAAW,MAAO,OAAU,CAAA,GAC5B,qBAAC,OAAD,EAAA,UAAA;IACC,oBAAC,KAAD,EAKC,yBAA0B,EACzB,QAAQ,SAAU,WAAY,EAC/B,EACA,CAAA;IACC,aAAa,WAAW,KACzB,oBAAC,KAAD,EAAA,UACG,GACD,+CACD,EACE,CAAA;IAEF,CAAE,sBACH,oBAAC,QAAD;KACC,uBAAA;KACA,MAAO,aAAc,iBAAiB;MACrC,oBAAoB;MACpB,QAAQ,OAAO,SAAS;KACzB,CAAE;KACF,SAAQ;KAEN,UAAA,GAAI,0BAA2B;IAC1B,CAAA;GAEL,EAAA,CAAA,CACD;;CACD,CAAA;AAEP"}