@wordpress/customize-widgets 5.32.0 → 5.32.1-next.ff1cebbba.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 (164) hide show
  1. package/build/components/block-appender/index.js +33 -27
  2. package/build/components/block-appender/index.js.map +7 -1
  3. package/build/components/block-inspector-button/index.js +51 -36
  4. package/build/components/block-inspector-button/index.js.map +7 -1
  5. package/build/components/customize-widgets/index.js +83 -61
  6. package/build/components/customize-widgets/index.js.map +7 -1
  7. package/build/components/customize-widgets/use-clear-selected-block.js +56 -63
  8. package/build/components/customize-widgets/use-clear-selected-block.js.map +7 -1
  9. package/build/components/error-boundary/index.js +46 -45
  10. package/build/components/error-boundary/index.js.map +7 -1
  11. package/build/components/focus-control/index.js +69 -57
  12. package/build/components/focus-control/index.js.map +7 -1
  13. package/build/components/focus-control/use-blocks-focus-control.js +38 -31
  14. package/build/components/focus-control/use-blocks-focus-control.js.map +7 -1
  15. package/build/components/header/index.js +110 -71
  16. package/build/components/header/index.js.map +7 -1
  17. package/build/components/inserter/index.js +77 -53
  18. package/build/components/inserter/index.js.map +7 -1
  19. package/build/components/inserter/use-inserter.js +46 -29
  20. package/build/components/inserter/use-inserter.js.map +7 -1
  21. package/build/components/keyboard-shortcut-help-modal/config.js +74 -71
  22. package/build/components/keyboard-shortcut-help-modal/config.js.map +7 -1
  23. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +61 -44
  24. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
  25. package/build/components/keyboard-shortcut-help-modal/index.js +155 -110
  26. package/build/components/keyboard-shortcut-help-modal/index.js.map +7 -1
  27. package/build/components/keyboard-shortcut-help-modal/shortcut.js +76 -56
  28. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
  29. package/build/components/keyboard-shortcuts/index.js +60 -51
  30. package/build/components/keyboard-shortcuts/index.js.map +7 -1
  31. package/build/components/more-menu/index.js +151 -90
  32. package/build/components/more-menu/index.js.map +7 -1
  33. package/build/components/sidebar-block-editor/index.js +133 -105
  34. package/build/components/sidebar-block-editor/index.js.map +7 -1
  35. package/build/components/sidebar-block-editor/sidebar-adapter.js +73 -67
  36. package/build/components/sidebar-block-editor/sidebar-adapter.js.map +7 -1
  37. package/build/components/sidebar-block-editor/sidebar-editor-provider.js +51 -33
  38. package/build/components/sidebar-block-editor/sidebar-editor-provider.js.map +7 -1
  39. package/build/components/sidebar-block-editor/use-sidebar-block-editor.js +100 -79
  40. package/build/components/sidebar-block-editor/use-sidebar-block-editor.js.map +7 -1
  41. package/build/components/sidebar-controls/index.js +45 -31
  42. package/build/components/sidebar-controls/index.js.map +7 -1
  43. package/build/components/welcome-guide/index.js +86 -58
  44. package/build/components/welcome-guide/index.js.map +7 -1
  45. package/build/controls/inserter-outer-section.js +49 -58
  46. package/build/controls/inserter-outer-section.js.map +7 -1
  47. package/build/controls/inspector-section.js +30 -36
  48. package/build/controls/inspector-section.js.map +7 -1
  49. package/build/controls/sidebar-control.js +51 -30
  50. package/build/controls/sidebar-control.js.map +7 -1
  51. package/build/controls/sidebar-section.js +71 -39
  52. package/build/controls/sidebar-section.js.map +7 -1
  53. package/build/filters/index.js +4 -6
  54. package/build/filters/index.js.map +7 -1
  55. package/build/filters/move-to-sidebar.js +77 -79
  56. package/build/filters/move-to-sidebar.js.map +7 -1
  57. package/build/filters/replace-media-upload.js +9 -11
  58. package/build/filters/replace-media-upload.js.map +7 -1
  59. package/build/filters/wide-widget-display.js +20 -25
  60. package/build/filters/wide-widget-display.js.map +7 -1
  61. package/build/index.js +81 -70
  62. package/build/index.js.map +7 -1
  63. package/build/lock-unlock.js +31 -15
  64. package/build/lock-unlock.js.map +7 -1
  65. package/build/store/actions.js +27 -44
  66. package/build/store/actions.js.map +7 -1
  67. package/build/store/constants.js +27 -10
  68. package/build/store/constants.js.map +7 -1
  69. package/build/store/index.js +44 -40
  70. package/build/store/index.js.map +7 -1
  71. package/build/store/reducer.js +25 -19
  72. package/build/store/reducer.js.map +7 -1
  73. package/build/store/selectors.js +31 -44
  74. package/build/store/selectors.js.map +7 -1
  75. package/build/utils.js +45 -73
  76. package/build/utils.js.map +7 -1
  77. package/build-module/components/block-appender/index.js +17 -20
  78. package/build-module/components/block-appender/index.js.map +7 -1
  79. package/build-module/components/block-inspector-button/index.js +33 -30
  80. package/build-module/components/block-inspector-button/index.js.map +7 -1
  81. package/build-module/components/customize-widgets/index.js +52 -51
  82. package/build-module/components/customize-widgets/index.js.map +7 -1
  83. package/build-module/components/customize-widgets/use-clear-selected-block.js +38 -58
  84. package/build-module/components/customize-widgets/use-clear-selected-block.js.map +7 -1
  85. package/build-module/components/error-boundary/index.js +27 -37
  86. package/build-module/components/error-boundary/index.js.map +7 -1
  87. package/build-module/components/focus-control/index.js +50 -45
  88. package/build-module/components/focus-control/index.js.map +7 -1
  89. package/build-module/components/focus-control/use-blocks-focus-control.js +17 -22
  90. package/build-module/components/focus-control/use-blocks-focus-control.js.map +7 -1
  91. package/build-module/components/header/index.js +81 -63
  92. package/build-module/components/header/index.js.map +7 -1
  93. package/build-module/components/inserter/index.js +59 -47
  94. package/build-module/components/inserter/index.js.map +7 -1
  95. package/build-module/components/inserter/use-inserter.js +28 -23
  96. package/build-module/components/inserter/use-inserter.js.map +7 -1
  97. package/build-module/components/keyboard-shortcut-help-modal/config.js +62 -75
  98. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +7 -1
  99. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +33 -37
  100. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
  101. package/build-module/components/keyboard-shortcut-help-modal/index.js +130 -103
  102. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +7 -1
  103. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -50
  104. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
  105. package/build-module/components/keyboard-shortcuts/index.js +44 -44
  106. package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
  107. package/build-module/components/more-menu/index.js +129 -84
  108. package/build-module/components/more-menu/index.js.map +7 -1
  109. package/build-module/components/sidebar-block-editor/index.js +109 -96
  110. package/build-module/components/sidebar-block-editor/index.js.map +7 -1
  111. package/build-module/components/sidebar-block-editor/sidebar-adapter.js +54 -59
  112. package/build-module/components/sidebar-block-editor/sidebar-adapter.js.map +7 -1
  113. package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js +22 -25
  114. package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js.map +7 -1
  115. package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js +70 -70
  116. package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js.map +7 -1
  117. package/build-module/components/sidebar-controls/index.js +24 -25
  118. package/build-module/components/sidebar-controls/index.js.map +7 -1
  119. package/build-module/components/welcome-guide/index.js +68 -52
  120. package/build-module/components/welcome-guide/index.js.map +7 -1
  121. package/build-module/controls/inserter-outer-section.js +31 -52
  122. package/build-module/controls/inserter-outer-section.js.map +7 -1
  123. package/build-module/controls/inspector-section.js +13 -32
  124. package/build-module/controls/inspector-section.js.map +7 -1
  125. package/build-module/controls/sidebar-control.js +22 -22
  126. package/build-module/controls/sidebar-control.js.map +7 -1
  127. package/build-module/controls/sidebar-section.js +43 -32
  128. package/build-module/controls/sidebar-section.js.map +7 -1
  129. package/build-module/filters/index.js +4 -7
  130. package/build-module/filters/index.js.map +7 -1
  131. package/build-module/filters/move-to-sidebar.js +83 -76
  132. package/build-module/filters/move-to-sidebar.js.map +7 -1
  133. package/build-module/filters/replace-media-upload.js +8 -7
  134. package/build-module/filters/replace-media-upload.js.map +7 -1
  135. package/build-module/filters/wide-widget-display.js +20 -22
  136. package/build-module/filters/wide-widget-display.js.map +7 -1
  137. package/build-module/index.js +53 -51
  138. package/build-module/index.js.map +7 -1
  139. package/build-module/lock-unlock.js +8 -7
  140. package/build-module/lock-unlock.js.map +7 -1
  141. package/build-module/store/actions.js +6 -40
  142. package/build-module/store/actions.js.map +7 -1
  143. package/build-module/store/constants.js +5 -5
  144. package/build-module/store/constants.js.map +7 -1
  145. package/build-module/store/index.js +10 -30
  146. package/build-module/store/index.js.map +7 -1
  147. package/build-module/store/reducer.js +7 -14
  148. package/build-module/store/reducer.js.map +7 -1
  149. package/build-module/store/selectors.js +10 -40
  150. package/build-module/store/selectors.js.map +7 -1
  151. package/build-module/utils.js +21 -66
  152. package/build-module/utils.js.map +7 -1
  153. package/build-style/style-rtl.css +14 -149
  154. package/build-style/style.css +14 -149
  155. package/package.json +30 -23
  156. package/src/components/block-inspector-button/style.scss +3 -0
  157. package/src/components/header/style.scss +5 -0
  158. package/src/components/inserter/style.scss +3 -0
  159. package/src/components/keyboard-shortcut-help-modal/style.scss +2 -0
  160. package/src/components/more-menu/style.scss +2 -0
  161. package/src/components/sidebar-block-editor/style.scss +2 -0
  162. package/src/components/welcome-guide/style.scss +2 -0
  163. package/src/controls/style.scss +2 -0
  164. package/src/style.scss +10 -8
@@ -1,29 +1,26 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useRef, useEffect } from '@wordpress/element';
5
- import { ButtonBlockAppender, store as blockEditorStore } from '@wordpress/block-editor';
6
- import { useSelect } from '@wordpress/data';
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- export default function BlockAppender(props) {
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useRef, useEffect } from "@wordpress/element";
3
+ import {
4
+ ButtonBlockAppender,
5
+ store as blockEditorStore
6
+ } from "@wordpress/block-editor";
7
+ import { useSelect } from "@wordpress/data";
8
+ function BlockAppender(props) {
9
9
  const ref = useRef();
10
- const isBlocksListEmpty = useSelect(select => select(blockEditorStore).getBlockCount() === 0);
11
-
12
- // Move the focus to the block appender to prevent focus from
13
- // being lost when emptying the widget area.
10
+ const isBlocksListEmpty = useSelect(
11
+ (select) => select(blockEditorStore).getBlockCount() === 0
12
+ );
14
13
  useEffect(() => {
15
14
  if (isBlocksListEmpty && ref.current) {
16
- const {
17
- ownerDocument
18
- } = ref.current;
15
+ const { ownerDocument } = ref.current;
19
16
  if (!ownerDocument.activeElement || ownerDocument.activeElement === ownerDocument.body) {
20
17
  ref.current.focus();
21
18
  }
22
19
  }
23
20
  }, [isBlocksListEmpty]);
24
- return /*#__PURE__*/_jsx(ButtonBlockAppender, {
25
- ...props,
26
- ref: ref
27
- });
21
+ return /* @__PURE__ */ jsx(ButtonBlockAppender, { ...props, ref });
28
22
  }
29
- //# sourceMappingURL=index.js.map
23
+ export {
24
+ BlockAppender as default
25
+ };
26
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useRef","useEffect","ButtonBlockAppender","store","blockEditorStore","useSelect","jsx","_jsx","BlockAppender","props","ref","isBlocksListEmpty","select","getBlockCount","current","ownerDocument","activeElement","body","focus"],"sources":["@wordpress/customize-widgets/src/components/block-appender/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport {\n\tButtonBlockAppender,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\nexport default function BlockAppender( props ) {\n\tconst ref = useRef();\n\tconst isBlocksListEmpty = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockCount() === 0\n\t);\n\n\t// Move the focus to the block appender to prevent focus from\n\t// being lost when emptying the widget area.\n\tuseEffect( () => {\n\t\tif ( isBlocksListEmpty && ref.current ) {\n\t\t\tconst { ownerDocument } = ref.current;\n\n\t\t\tif (\n\t\t\t\t! ownerDocument.activeElement ||\n\t\t\t\townerDocument.activeElement === ownerDocument.body\n\t\t\t) {\n\t\t\t\tref.current.focus();\n\t\t\t}\n\t\t}\n\t}, [ isBlocksListEmpty ] );\n\n\treturn <ButtonBlockAppender { ...props } ref={ ref } />;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,SAAS,QAAQ,oBAAoB;AACtD,SACCC,mBAAmB,EACnBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,SAAS,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5C,eAAe,SAASC,aAAaA,CAAEC,KAAK,EAAG;EAC9C,MAAMC,GAAG,GAAGV,MAAM,CAAC,CAAC;EACpB,MAAMW,iBAAiB,GAAGN,SAAS,CAChCO,MAAM,IAAMA,MAAM,CAAER,gBAAiB,CAAC,CAACS,aAAa,CAAC,CAAC,KAAK,CAC9D,CAAC;;EAED;EACA;EACAZ,SAAS,CAAE,MAAM;IAChB,IAAKU,iBAAiB,IAAID,GAAG,CAACI,OAAO,EAAG;MACvC,MAAM;QAAEC;MAAc,CAAC,GAAGL,GAAG,CAACI,OAAO;MAErC,IACC,CAAEC,aAAa,CAACC,aAAa,IAC7BD,aAAa,CAACC,aAAa,KAAKD,aAAa,CAACE,IAAI,EACjD;QACDP,GAAG,CAACI,OAAO,CAACI,KAAK,CAAC,CAAC;MACpB;IACD;EACD,CAAC,EAAE,CAAEP,iBAAiB,CAAG,CAAC;EAE1B,oBAAOJ,IAAA,CAACL,mBAAmB;IAAA,GAAMO,KAAK;IAAGC,GAAG,EAAGA;EAAK,CAAE,CAAC;AACxD","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/block-appender/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport {\n\tButtonBlockAppender,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\nexport default function BlockAppender( props ) {\n\tconst ref = useRef();\n\tconst isBlocksListEmpty = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockCount() === 0\n\t);\n\n\t// Move the focus to the block appender to prevent focus from\n\t// being lost when emptying the widget area.\n\tuseEffect( () => {\n\t\tif ( isBlocksListEmpty && ref.current ) {\n\t\t\tconst { ownerDocument } = ref.current;\n\n\t\t\tif (\n\t\t\t\t! ownerDocument.activeElement ||\n\t\t\t\townerDocument.activeElement === ownerDocument.body\n\t\t\t) {\n\t\t\t\tref.current.focus();\n\t\t\t}\n\t\t}\n\t}, [ isBlocksListEmpty ] );\n\n\treturn <ButtonBlockAppender { ...props } ref={ ref } />;\n}\n"],
5
+ "mappings": "AA+BQ;AA5BR,SAAS,QAAQ,iBAAiB;AAClC;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,iBAAiB;AAEX,SAAR,cAAgC,OAAQ;AAC9C,QAAM,MAAM,OAAO;AACnB,QAAM,oBAAoB;AAAA,IACzB,CAAE,WAAY,OAAQ,gBAAiB,EAAE,cAAc,MAAM;AAAA,EAC9D;AAIA,YAAW,MAAM;AAChB,QAAK,qBAAqB,IAAI,SAAU;AACvC,YAAM,EAAE,cAAc,IAAI,IAAI;AAE9B,UACC,CAAE,cAAc,iBAChB,cAAc,kBAAkB,cAAc,MAC7C;AACD,YAAI,QAAQ,MAAM;AAAA,MACnB;AAAA,IACD;AAAA,EACD,GAAG,CAAE,iBAAkB,CAAE;AAEzB,SAAO,oBAAC,uBAAsB,GAAG,OAAQ,KAAY;AACtD;",
6
+ "names": []
7
+ }
@@ -1,31 +1,34 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useMemo } from '@wordpress/element';
5
- import { __ } from '@wordpress/i18n';
6
- import { MenuItem } from '@wordpress/components';
7
- import { useSelect } from '@wordpress/data';
8
- import { store as blockEditorStore } from '@wordpress/block-editor';
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- function BlockInspectorButton({
11
- inspector,
12
- closeMenu,
13
- ...props
14
- }) {
15
- const selectedBlockClientId = useSelect(select => select(blockEditorStore).getSelectedBlockClientId(), []);
16
- const selectedBlock = useMemo(() => document.getElementById(`block-${selectedBlockClientId}`), [selectedBlockClientId]);
17
- return /*#__PURE__*/_jsx(MenuItem, {
18
- onClick: () => {
19
- // Open the inspector.
20
- inspector.open({
21
- returnFocusWhenClose: selectedBlock
22
- });
23
- // Then close the dropdown menu.
24
- closeMenu();
25
- },
26
- ...props,
27
- children: __('Show more settings')
28
- });
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "@wordpress/element";
3
+ import { __ } from "@wordpress/i18n";
4
+ import { MenuItem } from "@wordpress/components";
5
+ import { useSelect } from "@wordpress/data";
6
+ import { store as blockEditorStore } from "@wordpress/block-editor";
7
+ function BlockInspectorButton({ inspector, closeMenu, ...props }) {
8
+ const selectedBlockClientId = useSelect(
9
+ (select) => select(blockEditorStore).getSelectedBlockClientId(),
10
+ []
11
+ );
12
+ const selectedBlock = useMemo(
13
+ () => document.getElementById(`block-${selectedBlockClientId}`),
14
+ [selectedBlockClientId]
15
+ );
16
+ return /* @__PURE__ */ jsx(
17
+ MenuItem,
18
+ {
19
+ onClick: () => {
20
+ inspector.open({
21
+ returnFocusWhenClose: selectedBlock
22
+ });
23
+ closeMenu();
24
+ },
25
+ ...props,
26
+ children: __("Show more settings")
27
+ }
28
+ );
29
29
  }
30
- export default BlockInspectorButton;
31
- //# sourceMappingURL=index.js.map
30
+ var block_inspector_button_default = BlockInspectorButton;
31
+ export {
32
+ block_inspector_button_default as default
33
+ };
34
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useMemo","__","MenuItem","useSelect","store","blockEditorStore","jsx","_jsx","BlockInspectorButton","inspector","closeMenu","props","selectedBlockClientId","select","getSelectedBlockClientId","selectedBlock","document","getElementById","onClick","open","returnFocusWhenClose","children"],"sources":["@wordpress/customize-widgets/src/components/block-inspector-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction BlockInspectorButton( { inspector, closeMenu, ...props } ) {\n\tconst selectedBlockClientId = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSelectedBlockClientId(),\n\t\t[]\n\t);\n\n\tconst selectedBlock = useMemo(\n\t\t() => document.getElementById( `block-${ selectedBlockClientId }` ),\n\t\t[ selectedBlockClientId ]\n\t);\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\t// Open the inspector.\n\t\t\t\tinspector.open( {\n\t\t\t\t\treturnFocusWhenClose: selectedBlock,\n\t\t\t\t} );\n\t\t\t\t// Then close the dropdown menu.\n\t\t\t\tcloseMenu();\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ __( 'Show more settings' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default BlockInspectorButton;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEpE,SAASC,oBAAoBA,CAAE;EAAEC,SAAS;EAAEC,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAG;EACnE,MAAMC,qBAAqB,GAAGT,SAAS,CACpCU,MAAM,IAAMA,MAAM,CAAER,gBAAiB,CAAC,CAACS,wBAAwB,CAAC,CAAC,EACnE,EACD,CAAC;EAED,MAAMC,aAAa,GAAGf,OAAO,CAC5B,MAAMgB,QAAQ,CAACC,cAAc,CAAE,SAAUL,qBAAqB,EAAI,CAAC,EACnE,CAAEA,qBAAqB,CACxB,CAAC;EAED,oBACCL,IAAA,CAACL,QAAQ;IACRgB,OAAO,EAAGA,CAAA,KAAM;MACf;MACAT,SAAS,CAACU,IAAI,CAAE;QACfC,oBAAoB,EAAEL;MACvB,CAAE,CAAC;MACH;MACAL,SAAS,CAAC,CAAC;IACZ,CAAG;IAAA,GACEC,KAAK;IAAAU,QAAA,EAERpB,EAAE,CAAE,oBAAqB;EAAC,CACnB,CAAC;AAEb;AAEA,eAAeO,oBAAoB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/block-inspector-button/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction BlockInspectorButton( { inspector, closeMenu, ...props } ) {\n\tconst selectedBlockClientId = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSelectedBlockClientId(),\n\t\t[]\n\t);\n\n\tconst selectedBlock = useMemo(\n\t\t() => document.getElementById( `block-${ selectedBlockClientId }` ),\n\t\t[ selectedBlockClientId ]\n\t);\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\t// Open the inspector.\n\t\t\t\tinspector.open( {\n\t\t\t\t\treturnFocusWhenClose: selectedBlock,\n\t\t\t\t} );\n\t\t\t\t// Then close the dropdown menu.\n\t\t\t\tcloseMenu();\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ __( 'Show more settings' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default BlockInspectorButton;\n"],
5
+ "mappings": "AAqBE;AAlBF,SAAS,eAAe;AACxB,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,SAAS,wBAAwB;AAE1C,SAAS,qBAAsB,EAAE,WAAW,WAAW,GAAG,MAAM,GAAI;AACnE,QAAM,wBAAwB;AAAA,IAC7B,CAAE,WAAY,OAAQ,gBAAiB,EAAE,yBAAyB;AAAA,IAClE,CAAC;AAAA,EACF;AAEA,QAAM,gBAAgB;AAAA,IACrB,MAAM,SAAS,eAAgB,SAAU,qBAAsB,EAAG;AAAA,IAClE,CAAE,qBAAsB;AAAA,EACzB;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAU,MAAM;AAEf,kBAAU,KAAM;AAAA,UACf,sBAAsB;AAAA,QACvB,CAAE;AAEF,kBAAU;AAAA,MACX;AAAA,MACE,GAAG;AAAA,MAEH,aAAI,oBAAqB;AAAA;AAAA,EAC5B;AAEF;AAEA,IAAO,iCAAQ;",
6
+ "names": []
7
+ }
@@ -1,63 +1,64 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useState, useEffect, useRef, createPortal } from '@wordpress/element';
5
- import { SlotFillProvider, Popover } from '@wordpress/components';
6
-
7
- /**
8
- * Internal dependencies
9
- */
10
- import ErrorBoundary from '../error-boundary';
11
- import SidebarBlockEditor from '../sidebar-block-editor';
12
- import FocusControl from '../focus-control';
13
- import SidebarControls from '../sidebar-controls';
14
- import useClearSelectedBlock from './use-clear-selected-block';
15
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
- export default function CustomizeWidgets({
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect, useRef, createPortal } from "@wordpress/element";
3
+ import { SlotFillProvider, Popover } from "@wordpress/components";
4
+ import ErrorBoundary from "../error-boundary";
5
+ import SidebarBlockEditor from "../sidebar-block-editor";
6
+ import FocusControl from "../focus-control";
7
+ import SidebarControls from "../sidebar-controls";
8
+ import useClearSelectedBlock from "./use-clear-selected-block";
9
+ function CustomizeWidgets({
17
10
  api,
18
11
  sidebarControls,
19
12
  blockEditorSettings
20
13
  }) {
21
14
  const [activeSidebarControl, setActiveSidebarControl] = useState(null);
22
- const parentContainer = document.getElementById('customize-theme-controls');
15
+ const parentContainer = document.getElementById(
16
+ "customize-theme-controls"
17
+ );
23
18
  const popoverRef = useRef();
24
19
  useClearSelectedBlock(activeSidebarControl, popoverRef);
25
20
  useEffect(() => {
26
- const unsubscribers = sidebarControls.map(sidebarControl => sidebarControl.subscribe(expanded => {
27
- if (expanded) {
28
- setActiveSidebarControl(sidebarControl);
29
- }
30
- }));
21
+ const unsubscribers = sidebarControls.map(
22
+ (sidebarControl) => sidebarControl.subscribe((expanded) => {
23
+ if (expanded) {
24
+ setActiveSidebarControl(sidebarControl);
25
+ }
26
+ })
27
+ );
31
28
  return () => {
32
- unsubscribers.forEach(unsubscriber => unsubscriber());
29
+ unsubscribers.forEach((unsubscriber) => unsubscriber());
33
30
  };
34
31
  }, [sidebarControls]);
35
- const activeSidebar = activeSidebarControl && createPortal(/*#__PURE__*/_jsx(ErrorBoundary, {
36
- children: /*#__PURE__*/_jsx(SidebarBlockEditor, {
37
- blockEditorSettings: blockEditorSettings,
38
- sidebar: activeSidebarControl.sidebarAdapter,
39
- inserter: activeSidebarControl.inserter,
40
- inspector: activeSidebarControl.inspector
41
- }, activeSidebarControl.id)
42
- }), activeSidebarControl.container[0]);
43
-
44
- // We have to portal this to the parent of both the editor and the inspector,
45
- // so that the popovers will appear above both of them.
46
- const popover = parentContainer && createPortal(/*#__PURE__*/_jsx("div", {
47
- className: "customize-widgets-popover",
48
- ref: popoverRef,
49
- children: /*#__PURE__*/_jsx(Popover.Slot, {})
50
- }), parentContainer);
51
- return /*#__PURE__*/_jsx(SlotFillProvider, {
52
- children: /*#__PURE__*/_jsx(SidebarControls, {
53
- sidebarControls: sidebarControls,
54
- activeSidebarControl: activeSidebarControl,
55
- children: /*#__PURE__*/_jsxs(FocusControl, {
56
- api: api,
57
- sidebarControls: sidebarControls,
58
- children: [activeSidebar, popover]
59
- })
60
- })
61
- });
32
+ const activeSidebar = activeSidebarControl && createPortal(
33
+ /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(
34
+ SidebarBlockEditor,
35
+ {
36
+ blockEditorSettings,
37
+ sidebar: activeSidebarControl.sidebarAdapter,
38
+ inserter: activeSidebarControl.inserter,
39
+ inspector: activeSidebarControl.inspector
40
+ },
41
+ activeSidebarControl.id
42
+ ) }),
43
+ activeSidebarControl.container[0]
44
+ );
45
+ const popover = parentContainer && createPortal(
46
+ /* @__PURE__ */ jsx("div", { className: "customize-widgets-popover", ref: popoverRef, children: /* @__PURE__ */ jsx(Popover.Slot, {}) }),
47
+ parentContainer
48
+ );
49
+ return /* @__PURE__ */ jsx(SlotFillProvider, { children: /* @__PURE__ */ jsx(
50
+ SidebarControls,
51
+ {
52
+ sidebarControls,
53
+ activeSidebarControl,
54
+ children: /* @__PURE__ */ jsxs(FocusControl, { api, sidebarControls, children: [
55
+ activeSidebar,
56
+ popover
57
+ ] })
58
+ }
59
+ ) });
62
60
  }
63
- //# sourceMappingURL=index.js.map
61
+ export {
62
+ CustomizeWidgets as default
63
+ };
64
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useState","useEffect","useRef","createPortal","SlotFillProvider","Popover","ErrorBoundary","SidebarBlockEditor","FocusControl","SidebarControls","useClearSelectedBlock","jsx","_jsx","jsxs","_jsxs","CustomizeWidgets","api","sidebarControls","blockEditorSettings","activeSidebarControl","setActiveSidebarControl","parentContainer","document","getElementById","popoverRef","unsubscribers","map","sidebarControl","subscribe","expanded","forEach","unsubscriber","activeSidebar","children","sidebar","sidebarAdapter","inserter","inspector","id","container","popover","className","ref","Slot"],"sources":["@wordpress/customize-widgets/src/components/customize-widgets/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, createPortal } from '@wordpress/element';\nimport { SlotFillProvider, Popover } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ErrorBoundary from '../error-boundary';\nimport SidebarBlockEditor from '../sidebar-block-editor';\nimport FocusControl from '../focus-control';\nimport SidebarControls from '../sidebar-controls';\nimport useClearSelectedBlock from './use-clear-selected-block';\n\nexport default function CustomizeWidgets( {\n\tapi,\n\tsidebarControls,\n\tblockEditorSettings,\n} ) {\n\tconst [ activeSidebarControl, setActiveSidebarControl ] = useState( null );\n\tconst parentContainer = document.getElementById(\n\t\t'customize-theme-controls'\n\t);\n\tconst popoverRef = useRef();\n\n\tuseClearSelectedBlock( activeSidebarControl, popoverRef );\n\n\tuseEffect( () => {\n\t\tconst unsubscribers = sidebarControls.map( ( sidebarControl ) =>\n\t\t\tsidebarControl.subscribe( ( expanded ) => {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tsetActiveSidebarControl( sidebarControl );\n\t\t\t\t}\n\t\t\t} )\n\t\t);\n\n\t\treturn () => {\n\t\t\tunsubscribers.forEach( ( unsubscriber ) => unsubscriber() );\n\t\t};\n\t}, [ sidebarControls ] );\n\n\tconst activeSidebar =\n\t\tactiveSidebarControl &&\n\t\tcreatePortal(\n\t\t\t<ErrorBoundary>\n\t\t\t\t<SidebarBlockEditor\n\t\t\t\t\tkey={ activeSidebarControl.id }\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\tsidebar={ activeSidebarControl.sidebarAdapter }\n\t\t\t\t\tinserter={ activeSidebarControl.inserter }\n\t\t\t\t\tinspector={ activeSidebarControl.inspector }\n\t\t\t\t/>\n\t\t\t</ErrorBoundary>,\n\t\t\tactiveSidebarControl.container[ 0 ]\n\t\t);\n\n\t// We have to portal this to the parent of both the editor and the inspector,\n\t// so that the popovers will appear above both of them.\n\tconst popover =\n\t\tparentContainer &&\n\t\tcreatePortal(\n\t\t\t<div className=\"customize-widgets-popover\" ref={ popoverRef }>\n\t\t\t\t<Popover.Slot />\n\t\t\t</div>,\n\t\t\tparentContainer\n\t\t);\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<SidebarControls\n\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\tactiveSidebarControl={ activeSidebarControl }\n\t\t\t>\n\t\t\t\t<FocusControl api={ api } sidebarControls={ sidebarControls }>\n\t\t\t\t\t{ activeSidebar }\n\t\t\t\t\t{ popover }\n\t\t\t\t</FocusControl>\n\t\t\t</SidebarControls>\n\t\t</SlotFillProvider>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,MAAM,EAAEC,YAAY,QAAQ,oBAAoB;AAC9E,SAASC,gBAAgB,EAAEC,OAAO,QAAQ,uBAAuB;;AAEjE;AACA;AACA;AACA,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,kBAAkB,MAAM,yBAAyB;AACxD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,qBAAqB,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE/D,eAAe,SAASC,gBAAgBA,CAAE;EACzCC,GAAG;EACHC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,oBAAoB,EAAEC,uBAAuB,CAAE,GAAGpB,QAAQ,CAAE,IAAK,CAAC;EAC1E,MAAMqB,eAAe,GAAGC,QAAQ,CAACC,cAAc,CAC9C,0BACD,CAAC;EACD,MAAMC,UAAU,GAAGtB,MAAM,CAAC,CAAC;EAE3BQ,qBAAqB,CAAES,oBAAoB,EAAEK,UAAW,CAAC;EAEzDvB,SAAS,CAAE,MAAM;IAChB,MAAMwB,aAAa,GAAGR,eAAe,CAACS,GAAG,CAAIC,cAAc,IAC1DA,cAAc,CAACC,SAAS,CAAIC,QAAQ,IAAM;MACzC,IAAKA,QAAQ,EAAG;QACfT,uBAAuB,CAAEO,cAAe,CAAC;MAC1C;IACD,CAAE,CACH,CAAC;IAED,OAAO,MAAM;MACZF,aAAa,CAACK,OAAO,CAAIC,YAAY,IAAMA,YAAY,CAAC,CAAE,CAAC;IAC5D,CAAC;EACF,CAAC,EAAE,CAAEd,eAAe,CAAG,CAAC;EAExB,MAAMe,aAAa,GAClBb,oBAAoB,IACpBhB,YAAY,cACXS,IAAA,CAACN,aAAa;IAAA2B,QAAA,eACbrB,IAAA,CAACL,kBAAkB;MAElBW,mBAAmB,EAAGA,mBAAqB;MAC3CgB,OAAO,EAAGf,oBAAoB,CAACgB,cAAgB;MAC/CC,QAAQ,EAAGjB,oBAAoB,CAACiB,QAAU;MAC1CC,SAAS,EAAGlB,oBAAoB,CAACkB;IAAW,GAJtClB,oBAAoB,CAACmB,EAK3B;EAAC,CACY,CAAC,EAChBnB,oBAAoB,CAACoB,SAAS,CAAE,CAAC,CAClC,CAAC;;EAEF;EACA;EACA,MAAMC,OAAO,GACZnB,eAAe,IACflB,YAAY,cACXS,IAAA;IAAK6B,SAAS,EAAC,2BAA2B;IAACC,GAAG,EAAGlB,UAAY;IAAAS,QAAA,eAC5DrB,IAAA,CAACP,OAAO,CAACsC,IAAI,IAAE;EAAC,CACZ,CAAC,EACNtB,eACD,CAAC;EAEF,oBACCT,IAAA,CAACR,gBAAgB;IAAA6B,QAAA,eAChBrB,IAAA,CAACH,eAAe;MACfQ,eAAe,EAAGA,eAAiB;MACnCE,oBAAoB,EAAGA,oBAAsB;MAAAc,QAAA,eAE7CnB,KAAA,CAACN,YAAY;QAACQ,GAAG,EAAGA,GAAK;QAACC,eAAe,EAAGA,eAAiB;QAAAgB,QAAA,GAC1DD,aAAa,EACbQ,OAAO;MAAA,CACI;IAAC,CACC;EAAC,CACD,CAAC;AAErB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/customize-widgets/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, createPortal } from '@wordpress/element';\nimport { SlotFillProvider, Popover } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ErrorBoundary from '../error-boundary';\nimport SidebarBlockEditor from '../sidebar-block-editor';\nimport FocusControl from '../focus-control';\nimport SidebarControls from '../sidebar-controls';\nimport useClearSelectedBlock from './use-clear-selected-block';\n\nexport default function CustomizeWidgets( {\n\tapi,\n\tsidebarControls,\n\tblockEditorSettings,\n} ) {\n\tconst [ activeSidebarControl, setActiveSidebarControl ] = useState( null );\n\tconst parentContainer = document.getElementById(\n\t\t'customize-theme-controls'\n\t);\n\tconst popoverRef = useRef();\n\n\tuseClearSelectedBlock( activeSidebarControl, popoverRef );\n\n\tuseEffect( () => {\n\t\tconst unsubscribers = sidebarControls.map( ( sidebarControl ) =>\n\t\t\tsidebarControl.subscribe( ( expanded ) => {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tsetActiveSidebarControl( sidebarControl );\n\t\t\t\t}\n\t\t\t} )\n\t\t);\n\n\t\treturn () => {\n\t\t\tunsubscribers.forEach( ( unsubscriber ) => unsubscriber() );\n\t\t};\n\t}, [ sidebarControls ] );\n\n\tconst activeSidebar =\n\t\tactiveSidebarControl &&\n\t\tcreatePortal(\n\t\t\t<ErrorBoundary>\n\t\t\t\t<SidebarBlockEditor\n\t\t\t\t\tkey={ activeSidebarControl.id }\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\tsidebar={ activeSidebarControl.sidebarAdapter }\n\t\t\t\t\tinserter={ activeSidebarControl.inserter }\n\t\t\t\t\tinspector={ activeSidebarControl.inspector }\n\t\t\t\t/>\n\t\t\t</ErrorBoundary>,\n\t\t\tactiveSidebarControl.container[ 0 ]\n\t\t);\n\n\t// We have to portal this to the parent of both the editor and the inspector,\n\t// so that the popovers will appear above both of them.\n\tconst popover =\n\t\tparentContainer &&\n\t\tcreatePortal(\n\t\t\t<div className=\"customize-widgets-popover\" ref={ popoverRef }>\n\t\t\t\t<Popover.Slot />\n\t\t\t</div>,\n\t\t\tparentContainer\n\t\t);\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<SidebarControls\n\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\tactiveSidebarControl={ activeSidebarControl }\n\t\t\t>\n\t\t\t\t<FocusControl api={ api } sidebarControls={ sidebarControls }>\n\t\t\t\t\t{ activeSidebar }\n\t\t\t\t\t{ popover }\n\t\t\t\t</FocusControl>\n\t\t\t</SidebarControls>\n\t\t</SlotFillProvider>\n\t);\n}\n"],
5
+ "mappings": "AA8CI,cA4BA,YA5BA;AA3CJ,SAAS,UAAU,WAAW,QAAQ,oBAAoB;AAC1D,SAAS,kBAAkB,eAAe;AAK1C,OAAO,mBAAmB;AAC1B,OAAO,wBAAwB;AAC/B,OAAO,kBAAkB;AACzB,OAAO,qBAAqB;AAC5B,OAAO,2BAA2B;AAEnB,SAAR,iBAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,CAAE,sBAAsB,uBAAwB,IAAI,SAAU,IAAK;AACzE,QAAM,kBAAkB,SAAS;AAAA,IAChC;AAAA,EACD;AACA,QAAM,aAAa,OAAO;AAE1B,wBAAuB,sBAAsB,UAAW;AAExD,YAAW,MAAM;AAChB,UAAM,gBAAgB,gBAAgB;AAAA,MAAK,CAAE,mBAC5C,eAAe,UAAW,CAAE,aAAc;AACzC,YAAK,UAAW;AACf,kCAAyB,cAAe;AAAA,QACzC;AAAA,MACD,CAAE;AAAA,IACH;AAEA,WAAO,MAAM;AACZ,oBAAc,QAAS,CAAE,iBAAkB,aAAa,CAAE;AAAA,IAC3D;AAAA,EACD,GAAG,CAAE,eAAgB,CAAE;AAEvB,QAAM,gBACL,wBACA;AAAA,IACC,oBAAC,iBACA;AAAA,MAAC;AAAA;AAAA,QAEA;AAAA,QACA,SAAU,qBAAqB;AAAA,QAC/B,UAAW,qBAAqB;AAAA,QAChC,WAAY,qBAAqB;AAAA;AAAA,MAJ3B,qBAAqB;AAAA,IAK5B,GACD;AAAA,IACA,qBAAqB,UAAW,CAAE;AAAA,EACnC;AAID,QAAM,UACL,mBACA;AAAA,IACC,oBAAC,SAAI,WAAU,6BAA4B,KAAM,YAChD,8BAAC,QAAQ,MAAR,EAAa,GACf;AAAA,IACA;AAAA,EACD;AAED,SACC,oBAAC,oBACA;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,+BAAC,gBAAa,KAAY,iBACvB;AAAA;AAAA,QACA;AAAA,SACH;AAAA;AAAA,EACD,GACD;AAEF;",
6
+ "names": []
7
+ }
@@ -1,69 +1,49 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useEffect } from '@wordpress/element';
5
- import { useDispatch, useSelect } from '@wordpress/data';
6
- import { store as blockEditorStore } from '@wordpress/block-editor';
7
-
8
- /**
9
- * We can't just use <BlockSelectionClearer> because the customizer has
10
- * many root nodes rather than just one in the post editor.
11
- * We need to listen to the focus events in all those roots, and also in
12
- * the preview iframe.
13
- * This hook will clear the selected block when focusing outside the editor,
14
- * with a few exceptions:
15
- * 1. Focusing on popovers.
16
- * 2. Focusing on the inspector.
17
- * 3. Focusing on any modals/dialogs.
18
- * These cases are normally triggered by user interactions from the editor,
19
- * not by explicitly focusing outside the editor, hence no need for clearing.
20
- *
21
- * @param {Object} sidebarControl The sidebar control instance.
22
- * @param {Object} popoverRef The ref object of the popover node container.
23
- */
24
- export default function useClearSelectedBlock(sidebarControl, popoverRef) {
25
- const {
26
- hasSelectedBlock,
27
- hasMultiSelection
28
- } = useSelect(blockEditorStore);
29
- const {
30
- clearSelectedBlock
31
- } = useDispatch(blockEditorStore);
1
+ import { useEffect } from "@wordpress/element";
2
+ import { useDispatch, useSelect } from "@wordpress/data";
3
+ import { store as blockEditorStore } from "@wordpress/block-editor";
4
+ function useClearSelectedBlock(sidebarControl, popoverRef) {
5
+ const { hasSelectedBlock, hasMultiSelection } = useSelect(blockEditorStore);
6
+ const { clearSelectedBlock } = useDispatch(blockEditorStore);
32
7
  useEffect(() => {
33
8
  if (popoverRef.current && sidebarControl) {
34
- const inspector = sidebarControl.inspector;
35
- const container = sidebarControl.container[0];
36
- const ownerDocument = container.ownerDocument;
37
- const ownerWindow = ownerDocument.defaultView;
38
- function handleClearSelectedBlock(element) {
9
+ let handleClearSelectedBlock = function(element) {
39
10
  if (
40
- // 1. Make sure there are blocks being selected.
41
- (hasSelectedBlock() || hasMultiSelection()) &&
42
- // 2. The element should exist in the DOM (not deleted).
43
- element && ownerDocument.contains(element) &&
44
- // 3. It should also not exist in the container, the popover, nor the dialog.
45
- !container.contains(element) && !popoverRef.current.contains(element) && !element.closest('[role="dialog"]') &&
46
- // 4. The inspector should not be opened.
47
- !inspector.expanded()) {
11
+ // 1. Make sure there are blocks being selected.
12
+ (hasSelectedBlock() || hasMultiSelection()) && // 2. The element should exist in the DOM (not deleted).
13
+ element && ownerDocument.contains(element) && // 3. It should also not exist in the container, the popover, nor the dialog.
14
+ !container.contains(element) && !popoverRef.current.contains(element) && !element.closest('[role="dialog"]') && // 4. The inspector should not be opened.
15
+ !inspector.expanded()
16
+ ) {
48
17
  clearSelectedBlock();
49
18
  }
50
- }
51
-
52
- // Handle mouse down in the same document.
53
- function handleMouseDown(event) {
19
+ }, handleMouseDown = function(event) {
54
20
  handleClearSelectedBlock(event.target);
55
- }
56
- // Handle focusing outside the current document, like to iframes.
57
- function handleBlur() {
21
+ }, handleBlur = function() {
58
22
  handleClearSelectedBlock(ownerDocument.activeElement);
59
- }
60
- ownerDocument.addEventListener('mousedown', handleMouseDown);
61
- ownerWindow.addEventListener('blur', handleBlur);
23
+ };
24
+ const inspector = sidebarControl.inspector;
25
+ const container = sidebarControl.container[0];
26
+ const ownerDocument = container.ownerDocument;
27
+ const ownerWindow = ownerDocument.defaultView;
28
+ ownerDocument.addEventListener("mousedown", handleMouseDown);
29
+ ownerWindow.addEventListener("blur", handleBlur);
62
30
  return () => {
63
- ownerDocument.removeEventListener('mousedown', handleMouseDown);
64
- ownerWindow.removeEventListener('blur', handleBlur);
31
+ ownerDocument.removeEventListener(
32
+ "mousedown",
33
+ handleMouseDown
34
+ );
35
+ ownerWindow.removeEventListener("blur", handleBlur);
65
36
  };
66
37
  }
67
- }, [popoverRef, sidebarControl, hasSelectedBlock, hasMultiSelection, clearSelectedBlock]);
38
+ }, [
39
+ popoverRef,
40
+ sidebarControl,
41
+ hasSelectedBlock,
42
+ hasMultiSelection,
43
+ clearSelectedBlock
44
+ ]);
68
45
  }
69
- //# sourceMappingURL=use-clear-selected-block.js.map
46
+ export {
47
+ useClearSelectedBlock as default
48
+ };
49
+ //# sourceMappingURL=use-clear-selected-block.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useEffect","useDispatch","useSelect","store","blockEditorStore","useClearSelectedBlock","sidebarControl","popoverRef","hasSelectedBlock","hasMultiSelection","clearSelectedBlock","current","inspector","container","ownerDocument","ownerWindow","defaultView","handleClearSelectedBlock","element","contains","closest","expanded","handleMouseDown","event","target","handleBlur","activeElement","addEventListener","removeEventListener"],"sources":["@wordpress/customize-widgets/src/components/customize-widgets/use-clear-selected-block.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * We can't just use <BlockSelectionClearer> because the customizer has\n * many root nodes rather than just one in the post editor.\n * We need to listen to the focus events in all those roots, and also in\n * the preview iframe.\n * This hook will clear the selected block when focusing outside the editor,\n * with a few exceptions:\n * 1. Focusing on popovers.\n * 2. Focusing on the inspector.\n * 3. Focusing on any modals/dialogs.\n * These cases are normally triggered by user interactions from the editor,\n * not by explicitly focusing outside the editor, hence no need for clearing.\n *\n * @param {Object} sidebarControl The sidebar control instance.\n * @param {Object} popoverRef The ref object of the popover node container.\n */\nexport default function useClearSelectedBlock( sidebarControl, popoverRef ) {\n\tconst { hasSelectedBlock, hasMultiSelection } =\n\t\tuseSelect( blockEditorStore );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( popoverRef.current && sidebarControl ) {\n\t\t\tconst inspector = sidebarControl.inspector;\n\t\t\tconst container = sidebarControl.container[ 0 ];\n\t\t\tconst ownerDocument = container.ownerDocument;\n\t\t\tconst ownerWindow = ownerDocument.defaultView;\n\n\t\t\tfunction handleClearSelectedBlock( element ) {\n\t\t\t\tif (\n\t\t\t\t\t// 1. Make sure there are blocks being selected.\n\t\t\t\t\t( hasSelectedBlock() || hasMultiSelection() ) &&\n\t\t\t\t\t// 2. The element should exist in the DOM (not deleted).\n\t\t\t\t\telement &&\n\t\t\t\t\townerDocument.contains( element ) &&\n\t\t\t\t\t// 3. It should also not exist in the container, the popover, nor the dialog.\n\t\t\t\t\t! container.contains( element ) &&\n\t\t\t\t\t! popoverRef.current.contains( element ) &&\n\t\t\t\t\t! element.closest( '[role=\"dialog\"]' ) &&\n\t\t\t\t\t// 4. The inspector should not be opened.\n\t\t\t\t\t! inspector.expanded()\n\t\t\t\t) {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Handle mouse down in the same document.\n\t\t\tfunction handleMouseDown( event ) {\n\t\t\t\thandleClearSelectedBlock( event.target );\n\t\t\t}\n\t\t\t// Handle focusing outside the current document, like to iframes.\n\t\t\tfunction handleBlur() {\n\t\t\t\thandleClearSelectedBlock( ownerDocument.activeElement );\n\t\t\t}\n\n\t\t\townerDocument.addEventListener( 'mousedown', handleMouseDown );\n\t\t\townerWindow.addEventListener( 'blur', handleBlur );\n\n\t\t\treturn () => {\n\t\t\t\townerDocument.removeEventListener(\n\t\t\t\t\t'mousedown',\n\t\t\t\t\thandleMouseDown\n\t\t\t\t);\n\t\t\t\townerWindow.removeEventListener( 'blur', handleBlur );\n\t\t\t};\n\t\t}\n\t}, [\n\t\tpopoverRef,\n\t\tsidebarControl,\n\t\thasSelectedBlock,\n\t\thasMultiSelection,\n\t\tclearSelectedBlock,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,qBAAqBA,CAAEC,cAAc,EAAEC,UAAU,EAAG;EAC3E,MAAM;IAAEC,gBAAgB;IAAEC;EAAkB,CAAC,GAC5CP,SAAS,CAAEE,gBAAiB,CAAC;EAC9B,MAAM;IAAEM;EAAmB,CAAC,GAAGT,WAAW,CAAEG,gBAAiB,CAAC;EAE9DJ,SAAS,CAAE,MAAM;IAChB,IAAKO,UAAU,CAACI,OAAO,IAAIL,cAAc,EAAG;MAC3C,MAAMM,SAAS,GAAGN,cAAc,CAACM,SAAS;MAC1C,MAAMC,SAAS,GAAGP,cAAc,CAACO,SAAS,CAAE,CAAC,CAAE;MAC/C,MAAMC,aAAa,GAAGD,SAAS,CAACC,aAAa;MAC7C,MAAMC,WAAW,GAAGD,aAAa,CAACE,WAAW;MAE7C,SAASC,wBAAwBA,CAAEC,OAAO,EAAG;QAC5C;QACC;QACA,CAAEV,gBAAgB,CAAC,CAAC,IAAIC,iBAAiB,CAAC,CAAC;QAC3C;QACAS,OAAO,IACPJ,aAAa,CAACK,QAAQ,CAAED,OAAQ,CAAC;QACjC;QACA,CAAEL,SAAS,CAACM,QAAQ,CAAED,OAAQ,CAAC,IAC/B,CAAEX,UAAU,CAACI,OAAO,CAACQ,QAAQ,CAAED,OAAQ,CAAC,IACxC,CAAEA,OAAO,CAACE,OAAO,CAAE,iBAAkB,CAAC;QACtC;QACA,CAAER,SAAS,CAACS,QAAQ,CAAC,CAAC,EACrB;UACDX,kBAAkB,CAAC,CAAC;QACrB;MACD;;MAEA;MACA,SAASY,eAAeA,CAAEC,KAAK,EAAG;QACjCN,wBAAwB,CAAEM,KAAK,CAACC,MAAO,CAAC;MACzC;MACA;MACA,SAASC,UAAUA,CAAA,EAAG;QACrBR,wBAAwB,CAAEH,aAAa,CAACY,aAAc,CAAC;MACxD;MAEAZ,aAAa,CAACa,gBAAgB,CAAE,WAAW,EAAEL,eAAgB,CAAC;MAC9DP,WAAW,CAACY,gBAAgB,CAAE,MAAM,EAAEF,UAAW,CAAC;MAElD,OAAO,MAAM;QACZX,aAAa,CAACc,mBAAmB,CAChC,WAAW,EACXN,eACD,CAAC;QACDP,WAAW,CAACa,mBAAmB,CAAE,MAAM,EAAEH,UAAW,CAAC;MACtD,CAAC;IACF;EACD,CAAC,EAAE,CACFlB,UAAU,EACVD,cAAc,EACdE,gBAAgB,EAChBC,iBAAiB,EACjBC,kBAAkB,CACjB,CAAC;AACJ","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/customize-widgets/use-clear-selected-block.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * We can't just use <BlockSelectionClearer> because the customizer has\n * many root nodes rather than just one in the post editor.\n * We need to listen to the focus events in all those roots, and also in\n * the preview iframe.\n * This hook will clear the selected block when focusing outside the editor,\n * with a few exceptions:\n * 1. Focusing on popovers.\n * 2. Focusing on the inspector.\n * 3. Focusing on any modals/dialogs.\n * These cases are normally triggered by user interactions from the editor,\n * not by explicitly focusing outside the editor, hence no need for clearing.\n *\n * @param {Object} sidebarControl The sidebar control instance.\n * @param {Object} popoverRef The ref object of the popover node container.\n */\nexport default function useClearSelectedBlock( sidebarControl, popoverRef ) {\n\tconst { hasSelectedBlock, hasMultiSelection } =\n\t\tuseSelect( blockEditorStore );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( popoverRef.current && sidebarControl ) {\n\t\t\tconst inspector = sidebarControl.inspector;\n\t\t\tconst container = sidebarControl.container[ 0 ];\n\t\t\tconst ownerDocument = container.ownerDocument;\n\t\t\tconst ownerWindow = ownerDocument.defaultView;\n\n\t\t\tfunction handleClearSelectedBlock( element ) {\n\t\t\t\tif (\n\t\t\t\t\t// 1. Make sure there are blocks being selected.\n\t\t\t\t\t( hasSelectedBlock() || hasMultiSelection() ) &&\n\t\t\t\t\t// 2. The element should exist in the DOM (not deleted).\n\t\t\t\t\telement &&\n\t\t\t\t\townerDocument.contains( element ) &&\n\t\t\t\t\t// 3. It should also not exist in the container, the popover, nor the dialog.\n\t\t\t\t\t! container.contains( element ) &&\n\t\t\t\t\t! popoverRef.current.contains( element ) &&\n\t\t\t\t\t! element.closest( '[role=\"dialog\"]' ) &&\n\t\t\t\t\t// 4. The inspector should not be opened.\n\t\t\t\t\t! inspector.expanded()\n\t\t\t\t) {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Handle mouse down in the same document.\n\t\t\tfunction handleMouseDown( event ) {\n\t\t\t\thandleClearSelectedBlock( event.target );\n\t\t\t}\n\t\t\t// Handle focusing outside the current document, like to iframes.\n\t\t\tfunction handleBlur() {\n\t\t\t\thandleClearSelectedBlock( ownerDocument.activeElement );\n\t\t\t}\n\n\t\t\townerDocument.addEventListener( 'mousedown', handleMouseDown );\n\t\t\townerWindow.addEventListener( 'blur', handleBlur );\n\n\t\t\treturn () => {\n\t\t\t\townerDocument.removeEventListener(\n\t\t\t\t\t'mousedown',\n\t\t\t\t\thandleMouseDown\n\t\t\t\t);\n\t\t\t\townerWindow.removeEventListener( 'blur', handleBlur );\n\t\t\t};\n\t\t}\n\t}, [\n\t\tpopoverRef,\n\t\tsidebarControl,\n\t\thasSelectedBlock,\n\t\thasMultiSelection,\n\t\tclearSelectedBlock,\n\t] );\n}\n"],
5
+ "mappings": "AAGA,SAAS,iBAAiB;AAC1B,SAAS,aAAa,iBAAiB;AACvC,SAAS,SAAS,wBAAwB;AAkB3B,SAAR,sBAAwC,gBAAgB,YAAa;AAC3E,QAAM,EAAE,kBAAkB,kBAAkB,IAC3C,UAAW,gBAAiB;AAC7B,QAAM,EAAE,mBAAmB,IAAI,YAAa,gBAAiB;AAE7D,YAAW,MAAM;AAChB,QAAK,WAAW,WAAW,gBAAiB;AAM3C,UAAS,2BAAT,SAAmC,SAAU;AAC5C;AAAA;AAAA,WAEG,iBAAiB,KAAK,kBAAkB;AAAA,UAE1C,WACA,cAAc,SAAU,OAAQ;AAAA,UAEhC,CAAE,UAAU,SAAU,OAAQ,KAC9B,CAAE,WAAW,QAAQ,SAAU,OAAQ,KACvC,CAAE,QAAQ,QAAS,iBAAkB;AAAA,UAErC,CAAE,UAAU,SAAS;AAAA,UACpB;AACD,6BAAmB;AAAA,QACpB;AAAA,MACD,GAGS,kBAAT,SAA0B,OAAQ;AACjC,iCAA0B,MAAM,MAAO;AAAA,MACxC,GAES,aAAT,WAAsB;AACrB,iCAA0B,cAAc,aAAc;AAAA,MACvD;AA9BA,YAAM,YAAY,eAAe;AACjC,YAAM,YAAY,eAAe,UAAW,CAAE;AAC9C,YAAM,gBAAgB,UAAU;AAChC,YAAM,cAAc,cAAc;AA6BlC,oBAAc,iBAAkB,aAAa,eAAgB;AAC7D,kBAAY,iBAAkB,QAAQ,UAAW;AAEjD,aAAO,MAAM;AACZ,sBAAc;AAAA,UACb;AAAA,UACA;AAAA,QACD;AACA,oBAAY,oBAAqB,QAAQ,UAAW;AAAA,MACrD;AAAA,IACD;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;",
6
+ "names": []
7
+ }
@@ -1,26 +1,15 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { Component } from '@wordpress/element';
5
- import { __ } from '@wordpress/i18n';
6
- import { Button } from '@wordpress/components';
7
- import { Warning } from '@wordpress/block-editor';
8
- import { useCopyToClipboard } from '@wordpress/compose';
9
- import { doAction } from '@wordpress/hooks';
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- function CopyButton({
12
- text,
13
- children
14
- }) {
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Component } from "@wordpress/element";
3
+ import { __ } from "@wordpress/i18n";
4
+ import { Button } from "@wordpress/components";
5
+ import { Warning } from "@wordpress/block-editor";
6
+ import { useCopyToClipboard } from "@wordpress/compose";
7
+ import { doAction } from "@wordpress/hooks";
8
+ function CopyButton({ text, children }) {
15
9
  const ref = useCopyToClipboard(text);
16
- return /*#__PURE__*/_jsx(Button, {
17
- size: "compact",
18
- variant: "secondary",
19
- ref: ref,
20
- children: children
21
- });
10
+ return /* @__PURE__ */ jsx(Button, { size: "compact", variant: "secondary", ref, children });
22
11
  }
23
- export default class ErrorBoundary extends Component {
12
+ class ErrorBoundary extends Component {
24
13
  constructor() {
25
14
  super(...arguments);
26
15
  this.state = {
@@ -28,26 +17,27 @@ export default class ErrorBoundary extends Component {
28
17
  };
29
18
  }
30
19
  componentDidCatch(error) {
31
- this.setState({
32
- error
33
- });
34
- doAction('editor.ErrorBoundary.errorLogged', error);
20
+ this.setState({ error });
21
+ doAction("editor.ErrorBoundary.errorLogged", error);
35
22
  }
36
23
  render() {
37
- const {
38
- error
39
- } = this.state;
24
+ const { error } = this.state;
40
25
  if (!error) {
41
26
  return this.props.children;
42
27
  }
43
- return /*#__PURE__*/_jsx(Warning, {
44
- className: "customize-widgets-error-boundary",
45
- actions: [/*#__PURE__*/_jsx(CopyButton, {
46
- text: error.stack,
47
- children: __('Copy Error')
48
- }, "copy-error")],
49
- children: __('The editor has encountered an unexpected error.')
50
- });
28
+ return /* @__PURE__ */ jsx(
29
+ Warning,
30
+ {
31
+ className: "customize-widgets-error-boundary",
32
+ actions: [
33
+ /* @__PURE__ */ jsx(CopyButton, { text: error.stack, children: __("Copy Error") }, "copy-error")
34
+ ],
35
+ children: __("The editor has encountered an unexpected error.")
36
+ }
37
+ );
51
38
  }
52
39
  }
53
- //# sourceMappingURL=index.js.map
40
+ export {
41
+ ErrorBoundary as default
42
+ };
43
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["Component","__","Button","Warning","useCopyToClipboard","doAction","jsx","_jsx","CopyButton","text","children","ref","size","variant","ErrorBoundary","constructor","arguments","state","error","componentDidCatch","setState","render","props","className","actions","stack"],"sources":["@wordpress/customize-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 size=\"compact\" variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tthis.setState( { error } );\n\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tclassName=\"customize-widgets-error-boundary\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t\t\t</CopyButton>,\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ __( 'The editor has encountered an unexpected error.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,SAASC,QAAQ,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5C,SAASC,UAAUA,CAAE;EAAEC,IAAI;EAAEC;AAAS,CAAC,EAAG;EACzC,MAAMC,GAAG,GAAGP,kBAAkB,CAAEK,IAAK,CAAC;EACtC,oBACCF,IAAA,CAACL,MAAM;IAACU,IAAI,EAAC,SAAS;IAACC,OAAO,EAAC,WAAW;IAACF,GAAG,EAAGA,GAAK;IAAAD,QAAA,EACnDA;EAAQ,CACH,CAAC;AAEX;AAEA,eAAe,MAAMI,aAAa,SAASd,SAAS,CAAC;EACpDe,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IACrB,IAAI,CAACC,KAAK,GAAG;MACZC,KAAK,EAAE;IACR,CAAC;EACF;EAEAC,iBAAiBA,CAAED,KAAK,EAAG;IAC1B,IAAI,CAACE,QAAQ,CAAE;MAAEF;IAAM,CAAE,CAAC;IAE1Bb,QAAQ,CAAE,kCAAkC,EAAEa,KAAM,CAAC;EACtD;EAEAG,MAAMA,CAAA,EAAG;IACR,MAAM;MAAEH;IAAM,CAAC,GAAG,IAAI,CAACD,KAAK;IAC5B,IAAK,CAAEC,KAAK,EAAG;MACd,OAAO,IAAI,CAACI,KAAK,CAACZ,QAAQ;IAC3B;IAEA,oBACCH,IAAA,CAACJ,OAAO;MACPoB,SAAS,EAAC,kCAAkC;MAC5CC,OAAO,EAAG,cACTjB,IAAA,CAACC,UAAU;QAAkBC,IAAI,EAAGS,KAAK,CAACO,KAAO;QAAAf,QAAA,EAC9CT,EAAE,CAAE,YAAa;MAAC,GADL,YAEJ,CAAC,CACX;MAAAS,QAAA,EAEDT,EAAE,CAAE,iDAAkD;IAAC,CACjD,CAAC;EAEZ;AACD","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/error-boundary/index.js"],
4
+ "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 size=\"compact\" variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tthis.setState( { error } );\n\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tclassName=\"customize-widgets-error-boundary\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t\t\t</CopyButton>,\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ __( 'The editor has encountered an unexpected error.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n}\n"],
5
+ "mappings": "AAaE;AAVF,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,0BAA0B;AACnC,SAAS,gBAAgB;AAEzB,SAAS,WAAY,EAAE,MAAM,SAAS,GAAI;AACzC,QAAM,MAAM,mBAAoB,IAAK;AACrC,SACC,oBAAC,UAAO,MAAK,WAAU,SAAQ,aAAY,KACxC,UACH;AAEF;AAEA,MAAO,sBAAoC,UAAU;AAAA,EACpD,cAAc;AACb,UAAO,GAAG,SAAU;AACpB,SAAK,QAAQ;AAAA,MACZ,OAAO;AAAA,IACR;AAAA,EACD;AAAA,EAEA,kBAAmB,OAAQ;AAC1B,SAAK,SAAU,EAAE,MAAM,CAAE;AAEzB,aAAU,oCAAoC,KAAM;AAAA,EACrD;AAAA,EAEA,SAAS;AACR,UAAM,EAAE,MAAM,IAAI,KAAK;AACvB,QAAK,CAAE,OAAQ;AACd,aAAO,KAAK,MAAM;AAAA,IACnB;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,SAAU;AAAA,UACT,oBAAC,cAA4B,MAAO,MAAM,OACvC,aAAI,YAAa,KADJ,YAEhB;AAAA,QACD;AAAA,QAEE,aAAI,iDAAkD;AAAA;AAAA,IACzD;AAAA,EAEF;AACD;",
6
+ "names": []
7
+ }