@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,36 +1,42 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var block_appender_exports = {};
19
+ __export(block_appender_exports, {
20
+ default: () => BlockAppender
5
21
  });
6
- exports.default = BlockAppender;
7
- var _element = require("@wordpress/element");
8
- var _blockEditor = require("@wordpress/block-editor");
9
- var _data = require("@wordpress/data");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- /**
12
- * WordPress dependencies
13
- */
14
-
22
+ module.exports = __toCommonJS(block_appender_exports);
23
+ var import_jsx_runtime = require("react/jsx-runtime");
24
+ var import_element = require("@wordpress/element");
25
+ var import_block_editor = require("@wordpress/block-editor");
26
+ var import_data = require("@wordpress/data");
15
27
  function BlockAppender(props) {
16
- const ref = (0, _element.useRef)();
17
- const isBlocksListEmpty = (0, _data.useSelect)(select => select(_blockEditor.store).getBlockCount() === 0);
18
-
19
- // Move the focus to the block appender to prevent focus from
20
- // being lost when emptying the widget area.
21
- (0, _element.useEffect)(() => {
28
+ const ref = (0, import_element.useRef)();
29
+ const isBlocksListEmpty = (0, import_data.useSelect)(
30
+ (select) => select(import_block_editor.store).getBlockCount() === 0
31
+ );
32
+ (0, import_element.useEffect)(() => {
22
33
  if (isBlocksListEmpty && ref.current) {
23
- const {
24
- ownerDocument
25
- } = ref.current;
34
+ const { ownerDocument } = ref.current;
26
35
  if (!ownerDocument.activeElement || ownerDocument.activeElement === ownerDocument.body) {
27
36
  ref.current.focus();
28
37
  }
29
38
  }
30
39
  }, [isBlocksListEmpty]);
31
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.ButtonBlockAppender, {
32
- ...props,
33
- ref: ref
34
- });
40
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.ButtonBlockAppender, { ...props, ref });
35
41
  }
36
- //# sourceMappingURL=index.js.map
42
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_element","require","_blockEditor","_data","_jsxRuntime","BlockAppender","props","ref","useRef","isBlocksListEmpty","useSelect","select","blockEditorStore","getBlockCount","useEffect","current","ownerDocument","activeElement","body","focus","jsx","ButtonBlockAppender"],"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":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AAA4C,IAAAG,WAAA,GAAAH,OAAA;AAR5C;AACA;AACA;;AAQe,SAASI,aAAaA,CAAEC,KAAK,EAAG;EAC9C,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAC,CAAC;EACpB,MAAMC,iBAAiB,GAAG,IAAAC,eAAS,EAChCC,MAAM,IAAMA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,aAAa,CAAC,CAAC,KAAK,CAC9D,CAAC;;EAED;EACA;EACA,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKL,iBAAiB,IAAIF,GAAG,CAACQ,OAAO,EAAG;MACvC,MAAM;QAAEC;MAAc,CAAC,GAAGT,GAAG,CAACQ,OAAO;MAErC,IACC,CAAEC,aAAa,CAACC,aAAa,IAC7BD,aAAa,CAACC,aAAa,KAAKD,aAAa,CAACE,IAAI,EACjD;QACDX,GAAG,CAACQ,OAAO,CAACI,KAAK,CAAC,CAAC;MACpB;IACD;EACD,CAAC,EAAE,CAAEV,iBAAiB,CAAG,CAAC;EAE1B,oBAAO,IAAAL,WAAA,CAAAgB,GAAA,EAAClB,YAAA,CAAAmB,mBAAmB;IAAA,GAAMf,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": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BQ;AA5BR,qBAAkC;AAClC,0BAGO;AACP,kBAA0B;AAEX,SAAR,cAAgC,OAAQ;AAC9C,QAAM,UAAM,uBAAO;AACnB,QAAM,wBAAoB;AAAA,IACzB,CAAE,WAAY,OAAQ,oBAAAA,KAAiB,EAAE,cAAc,MAAM;AAAA,EAC9D;AAIA,gCAAW,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,4CAAC,2CAAsB,GAAG,OAAQ,KAAY;AACtD;",
6
+ "names": ["blockEditorStore"]
7
+ }
@@ -1,38 +1,53 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var block_inspector_button_exports = {};
19
+ __export(block_inspector_button_exports, {
20
+ default: () => block_inspector_button_default
5
21
  });
6
- exports.default = void 0;
7
- var _element = require("@wordpress/element");
8
- var _i18n = require("@wordpress/i18n");
9
- var _components = require("@wordpress/components");
10
- var _data = require("@wordpress/data");
11
- var _blockEditor = require("@wordpress/block-editor");
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- /**
14
- * WordPress dependencies
15
- */
16
-
17
- function BlockInspectorButton({
18
- inspector,
19
- closeMenu,
20
- ...props
21
- }) {
22
- const selectedBlockClientId = (0, _data.useSelect)(select => select(_blockEditor.store).getSelectedBlockClientId(), []);
23
- const selectedBlock = (0, _element.useMemo)(() => document.getElementById(`block-${selectedBlockClientId}`), [selectedBlockClientId]);
24
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
25
- onClick: () => {
26
- // Open the inspector.
27
- inspector.open({
28
- returnFocusWhenClose: selectedBlock
29
- });
30
- // Then close the dropdown menu.
31
- closeMenu();
32
- },
33
- ...props,
34
- children: (0, _i18n.__)('Show more settings')
35
- });
22
+ module.exports = __toCommonJS(block_inspector_button_exports);
23
+ var import_jsx_runtime = require("react/jsx-runtime");
24
+ var import_element = require("@wordpress/element");
25
+ var import_i18n = require("@wordpress/i18n");
26
+ var import_components = require("@wordpress/components");
27
+ var import_data = require("@wordpress/data");
28
+ var import_block_editor = require("@wordpress/block-editor");
29
+ function BlockInspectorButton({ inspector, closeMenu, ...props }) {
30
+ const selectedBlockClientId = (0, import_data.useSelect)(
31
+ (select) => select(import_block_editor.store).getSelectedBlockClientId(),
32
+ []
33
+ );
34
+ const selectedBlock = (0, import_element.useMemo)(
35
+ () => document.getElementById(`block-${selectedBlockClientId}`),
36
+ [selectedBlockClientId]
37
+ );
38
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
39
+ import_components.MenuItem,
40
+ {
41
+ onClick: () => {
42
+ inspector.open({
43
+ returnFocusWhenClose: selectedBlock
44
+ });
45
+ closeMenu();
46
+ },
47
+ ...props,
48
+ children: (0, import_i18n.__)("Show more settings")
49
+ }
50
+ );
36
51
  }
37
- var _default = exports.default = BlockInspectorButton;
38
- //# sourceMappingURL=index.js.map
52
+ var block_inspector_button_default = BlockInspectorButton;
53
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_element","require","_i18n","_components","_data","_blockEditor","_jsxRuntime","BlockInspectorButton","inspector","closeMenu","props","selectedBlockClientId","useSelect","select","blockEditorStore","getSelectedBlockClientId","selectedBlock","useMemo","document","getElementById","jsx","MenuItem","onClick","open","returnFocusWhenClose","children","__","_default","exports","default"],"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":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAAoE,IAAAK,WAAA,GAAAL,OAAA;AAPpE;AACA;AACA;;AAOA,SAASM,oBAAoBA,CAAE;EAAEC,SAAS;EAAEC,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAG;EACnE,MAAMC,qBAAqB,GAAG,IAAAC,eAAS,EACpCC,MAAM,IAAMA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,wBAAwB,CAAC,CAAC,EACnE,EACD,CAAC;EAED,MAAMC,aAAa,GAAG,IAAAC,gBAAO,EAC5B,MAAMC,QAAQ,CAACC,cAAc,CAAE,SAAUR,qBAAqB,EAAI,CAAC,EACnE,CAAEA,qBAAqB,CACxB,CAAC;EAED,oBACC,IAAAL,WAAA,CAAAc,GAAA,EAACjB,WAAA,CAAAkB,QAAQ;IACRC,OAAO,EAAGA,CAAA,KAAM;MACf;MACAd,SAAS,CAACe,IAAI,CAAE;QACfC,oBAAoB,EAAER;MACvB,CAAE,CAAC;MACH;MACAP,SAAS,CAAC,CAAC;IACZ,CAAG;IAAA,GACEC,KAAK;IAAAe,QAAA,EAER,IAAAC,QAAE,EAAE,oBAAqB;EAAC,CACnB,CAAC;AAEb;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEctB,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": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBE;AAlBF,qBAAwB;AACxB,kBAAmB;AACnB,wBAAyB;AACzB,kBAA0B;AAC1B,0BAA0C;AAE1C,SAAS,qBAAsB,EAAE,WAAW,WAAW,GAAG,MAAM,GAAI;AACnE,QAAM,4BAAwB;AAAA,IAC7B,CAAE,WAAY,OAAQ,oBAAAA,KAAiB,EAAE,yBAAyB;AAAA,IAClE,CAAC;AAAA,EACF;AAEA,QAAM,oBAAgB;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,8BAAI,oBAAqB;AAAA;AAAA,EAC5B;AAEF;AAEA,IAAO,iCAAQ;",
6
+ "names": ["blockEditorStore"]
7
+ }
@@ -1,71 +1,93 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var customize_widgets_exports = {};
29
+ __export(customize_widgets_exports, {
30
+ default: () => CustomizeWidgets
6
31
  });
7
- exports.default = CustomizeWidgets;
8
- var _element = require("@wordpress/element");
9
- var _components = require("@wordpress/components");
10
- var _errorBoundary = _interopRequireDefault(require("../error-boundary"));
11
- var _sidebarBlockEditor = _interopRequireDefault(require("../sidebar-block-editor"));
12
- var _focusControl = _interopRequireDefault(require("../focus-control"));
13
- var _sidebarControls = _interopRequireDefault(require("../sidebar-controls"));
14
- var _useClearSelectedBlock = _interopRequireDefault(require("./use-clear-selected-block"));
15
- var _jsxRuntime = require("react/jsx-runtime");
16
- /**
17
- * WordPress dependencies
18
- */
19
-
20
- /**
21
- * Internal dependencies
22
- */
23
-
32
+ module.exports = __toCommonJS(customize_widgets_exports);
33
+ var import_jsx_runtime = require("react/jsx-runtime");
34
+ var import_element = require("@wordpress/element");
35
+ var import_components = require("@wordpress/components");
36
+ var import_error_boundary = __toESM(require("../error-boundary"));
37
+ var import_sidebar_block_editor = __toESM(require("../sidebar-block-editor"));
38
+ var import_focus_control = __toESM(require("../focus-control"));
39
+ var import_sidebar_controls = __toESM(require("../sidebar-controls"));
40
+ var import_use_clear_selected_block = __toESM(require("./use-clear-selected-block"));
24
41
  function CustomizeWidgets({
25
42
  api,
26
43
  sidebarControls,
27
44
  blockEditorSettings
28
45
  }) {
29
- const [activeSidebarControl, setActiveSidebarControl] = (0, _element.useState)(null);
30
- const parentContainer = document.getElementById('customize-theme-controls');
31
- const popoverRef = (0, _element.useRef)();
32
- (0, _useClearSelectedBlock.default)(activeSidebarControl, popoverRef);
33
- (0, _element.useEffect)(() => {
34
- const unsubscribers = sidebarControls.map(sidebarControl => sidebarControl.subscribe(expanded => {
35
- if (expanded) {
36
- setActiveSidebarControl(sidebarControl);
37
- }
38
- }));
46
+ const [activeSidebarControl, setActiveSidebarControl] = (0, import_element.useState)(null);
47
+ const parentContainer = document.getElementById(
48
+ "customize-theme-controls"
49
+ );
50
+ const popoverRef = (0, import_element.useRef)();
51
+ (0, import_use_clear_selected_block.default)(activeSidebarControl, popoverRef);
52
+ (0, import_element.useEffect)(() => {
53
+ const unsubscribers = sidebarControls.map(
54
+ (sidebarControl) => sidebarControl.subscribe((expanded) => {
55
+ if (expanded) {
56
+ setActiveSidebarControl(sidebarControl);
57
+ }
58
+ })
59
+ );
39
60
  return () => {
40
- unsubscribers.forEach(unsubscriber => unsubscriber());
61
+ unsubscribers.forEach((unsubscriber) => unsubscriber());
41
62
  };
42
63
  }, [sidebarControls]);
43
- const activeSidebar = activeSidebarControl && (0, _element.createPortal)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_errorBoundary.default, {
44
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarBlockEditor.default, {
45
- blockEditorSettings: blockEditorSettings,
46
- sidebar: activeSidebarControl.sidebarAdapter,
47
- inserter: activeSidebarControl.inserter,
48
- inspector: activeSidebarControl.inspector
49
- }, activeSidebarControl.id)
50
- }), activeSidebarControl.container[0]);
51
-
52
- // We have to portal this to the parent of both the editor and the inspector,
53
- // so that the popovers will appear above both of them.
54
- const popover = parentContainer && (0, _element.createPortal)(/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
55
- className: "customize-widgets-popover",
56
- ref: popoverRef,
57
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Popover.Slot, {})
58
- }), parentContainer);
59
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SlotFillProvider, {
60
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarControls.default, {
61
- sidebarControls: sidebarControls,
62
- activeSidebarControl: activeSidebarControl,
63
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_focusControl.default, {
64
- api: api,
65
- sidebarControls: sidebarControls,
66
- children: [activeSidebar, popover]
67
- })
68
- })
69
- });
64
+ const activeSidebar = activeSidebarControl && (0, import_element.createPortal)(
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_error_boundary.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
66
+ import_sidebar_block_editor.default,
67
+ {
68
+ blockEditorSettings,
69
+ sidebar: activeSidebarControl.sidebarAdapter,
70
+ inserter: activeSidebarControl.inserter,
71
+ inspector: activeSidebarControl.inspector
72
+ },
73
+ activeSidebarControl.id
74
+ ) }),
75
+ activeSidebarControl.container[0]
76
+ );
77
+ const popover = parentContainer && (0, import_element.createPortal)(
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "customize-widgets-popover", ref: popoverRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Popover.Slot, {}) }),
79
+ parentContainer
80
+ );
81
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.SlotFillProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
82
+ import_sidebar_controls.default,
83
+ {
84
+ sidebarControls,
85
+ activeSidebarControl,
86
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_focus_control.default, { api, sidebarControls, children: [
87
+ activeSidebar,
88
+ popover
89
+ ] })
90
+ }
91
+ ) });
70
92
  }
71
- //# sourceMappingURL=index.js.map
93
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_element","require","_components","_errorBoundary","_interopRequireDefault","_sidebarBlockEditor","_focusControl","_sidebarControls","_useClearSelectedBlock","_jsxRuntime","CustomizeWidgets","api","sidebarControls","blockEditorSettings","activeSidebarControl","setActiveSidebarControl","useState","parentContainer","document","getElementById","popoverRef","useRef","useClearSelectedBlock","useEffect","unsubscribers","map","sidebarControl","subscribe","expanded","forEach","unsubscriber","activeSidebar","createPortal","jsx","default","children","sidebar","sidebarAdapter","inserter","inspector","id","container","popover","className","ref","Popover","Slot","SlotFillProvider","jsxs"],"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":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,aAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,gBAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,sBAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAA+D,IAAAQ,WAAA,GAAAR,OAAA;AAb/D;AACA;AACA;;AAIA;AACA;AACA;;AAOe,SAASS,gBAAgBA,CAAE;EACzCC,GAAG;EACHC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,oBAAoB,EAAEC,uBAAuB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,IAAK,CAAC;EAC1E,MAAMC,eAAe,GAAGC,QAAQ,CAACC,cAAc,CAC9C,0BACD,CAAC;EACD,MAAMC,UAAU,GAAG,IAAAC,eAAM,EAAC,CAAC;EAE3B,IAAAC,8BAAqB,EAAER,oBAAoB,EAAEM,UAAW,CAAC;EAEzD,IAAAG,kBAAS,EAAE,MAAM;IAChB,MAAMC,aAAa,GAAGZ,eAAe,CAACa,GAAG,CAAIC,cAAc,IAC1DA,cAAc,CAACC,SAAS,CAAIC,QAAQ,IAAM;MACzC,IAAKA,QAAQ,EAAG;QACfb,uBAAuB,CAAEW,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,CAAElB,eAAe,CAAG,CAAC;EAExB,MAAMmB,aAAa,GAClBjB,oBAAoB,IACpB,IAAAkB,qBAAY,eACX,IAAAvB,WAAA,CAAAwB,GAAA,EAAC9B,cAAA,CAAA+B,OAAa;IAAAC,QAAA,eACb,IAAA1B,WAAA,CAAAwB,GAAA,EAAC5B,mBAAA,CAAA6B,OAAkB;MAElBrB,mBAAmB,EAAGA,mBAAqB;MAC3CuB,OAAO,EAAGtB,oBAAoB,CAACuB,cAAgB;MAC/CC,QAAQ,EAAGxB,oBAAoB,CAACwB,QAAU;MAC1CC,SAAS,EAAGzB,oBAAoB,CAACyB;IAAW,GAJtCzB,oBAAoB,CAAC0B,EAK3B;EAAC,CACY,CAAC,EAChB1B,oBAAoB,CAAC2B,SAAS,CAAE,CAAC,CAClC,CAAC;;EAEF;EACA;EACA,MAAMC,OAAO,GACZzB,eAAe,IACf,IAAAe,qBAAY,eACX,IAAAvB,WAAA,CAAAwB,GAAA;IAAKU,SAAS,EAAC,2BAA2B;IAACC,GAAG,EAAGxB,UAAY;IAAAe,QAAA,eAC5D,IAAA1B,WAAA,CAAAwB,GAAA,EAAC/B,WAAA,CAAA2C,OAAO,CAACC,IAAI,IAAE;EAAC,CACZ,CAAC,EACN7B,eACD,CAAC;EAEF,oBACC,IAAAR,WAAA,CAAAwB,GAAA,EAAC/B,WAAA,CAAA6C,gBAAgB;IAAAZ,QAAA,eAChB,IAAA1B,WAAA,CAAAwB,GAAA,EAAC1B,gBAAA,CAAA2B,OAAe;MACftB,eAAe,EAAGA,eAAiB;MACnCE,oBAAoB,EAAGA,oBAAsB;MAAAqB,QAAA,eAE7C,IAAA1B,WAAA,CAAAuC,IAAA,EAAC1C,aAAA,CAAA4B,OAAY;QAACvB,GAAG,EAAGA,GAAK;QAACC,eAAe,EAAGA,eAAiB;QAAAuB,QAAA,GAC1DJ,aAAa,EACbW,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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8CI;AA3CJ,qBAA0D;AAC1D,wBAA0C;AAK1C,4BAA0B;AAC1B,kCAA+B;AAC/B,2BAAyB;AACzB,8BAA4B;AAC5B,sCAAkC;AAEnB,SAAR,iBAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,CAAE,sBAAsB,uBAAwB,QAAI,yBAAU,IAAK;AACzE,QAAM,kBAAkB,SAAS;AAAA,IAChC;AAAA,EACD;AACA,QAAM,iBAAa,uBAAO;AAE1B,sCAAAA,SAAuB,sBAAsB,UAAW;AAExD,gCAAW,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,4BACA;AAAA,IACC,4CAAC,sBAAAC,SAAA,EACA;AAAA,MAAC,4BAAAC;AAAA,MAAA;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,uBACA;AAAA,IACC,4CAAC,SAAI,WAAU,6BAA4B,KAAM,YAChD,sDAAC,0BAAQ,MAAR,EAAa,GACf;AAAA,IACA;AAAA,EACD;AAED,SACC,4CAAC,sCACA;AAAA,IAAC,wBAAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,uDAAC,qBAAAC,SAAA,EAAa,KAAY,iBACvB;AAAA;AAAA,QACA;AAAA,SACH;AAAA;AAAA,EACD,GACD;AAEF;",
6
+ "names": ["useClearSelectedBlock", "ErrorBoundary", "SidebarBlockEditor", "SidebarControls", "FocusControl"]
7
+ }
@@ -1,75 +1,68 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var use_clear_selected_block_exports = {};
19
+ __export(use_clear_selected_block_exports, {
20
+ default: () => useClearSelectedBlock
5
21
  });
6
- exports.default = useClearSelectedBlock;
7
- var _element = require("@wordpress/element");
8
- var _data = require("@wordpress/data");
9
- var _blockEditor = require("@wordpress/block-editor");
10
- /**
11
- * WordPress dependencies
12
- */
13
-
14
- /**
15
- * We can't just use <BlockSelectionClearer> because the customizer has
16
- * many root nodes rather than just one in the post editor.
17
- * We need to listen to the focus events in all those roots, and also in
18
- * the preview iframe.
19
- * This hook will clear the selected block when focusing outside the editor,
20
- * with a few exceptions:
21
- * 1. Focusing on popovers.
22
- * 2. Focusing on the inspector.
23
- * 3. Focusing on any modals/dialogs.
24
- * These cases are normally triggered by user interactions from the editor,
25
- * not by explicitly focusing outside the editor, hence no need for clearing.
26
- *
27
- * @param {Object} sidebarControl The sidebar control instance.
28
- * @param {Object} popoverRef The ref object of the popover node container.
29
- */
22
+ module.exports = __toCommonJS(use_clear_selected_block_exports);
23
+ var import_element = require("@wordpress/element");
24
+ var import_data = require("@wordpress/data");
25
+ var import_block_editor = require("@wordpress/block-editor");
30
26
  function useClearSelectedBlock(sidebarControl, popoverRef) {
31
- const {
32
- hasSelectedBlock,
33
- hasMultiSelection
34
- } = (0, _data.useSelect)(_blockEditor.store);
35
- const {
36
- clearSelectedBlock
37
- } = (0, _data.useDispatch)(_blockEditor.store);
38
- (0, _element.useEffect)(() => {
27
+ const { hasSelectedBlock, hasMultiSelection } = (0, import_data.useSelect)(import_block_editor.store);
28
+ const { clearSelectedBlock } = (0, import_data.useDispatch)(import_block_editor.store);
29
+ (0, import_element.useEffect)(() => {
39
30
  if (popoverRef.current && sidebarControl) {
40
- const inspector = sidebarControl.inspector;
41
- const container = sidebarControl.container[0];
42
- const ownerDocument = container.ownerDocument;
43
- const ownerWindow = ownerDocument.defaultView;
44
- function handleClearSelectedBlock(element) {
31
+ let handleClearSelectedBlock = function(element) {
45
32
  if (
46
- // 1. Make sure there are blocks being selected.
47
- (hasSelectedBlock() || hasMultiSelection()) &&
48
- // 2. The element should exist in the DOM (not deleted).
49
- element && ownerDocument.contains(element) &&
50
- // 3. It should also not exist in the container, the popover, nor the dialog.
51
- !container.contains(element) && !popoverRef.current.contains(element) && !element.closest('[role="dialog"]') &&
52
- // 4. The inspector should not be opened.
53
- !inspector.expanded()) {
33
+ // 1. Make sure there are blocks being selected.
34
+ (hasSelectedBlock() || hasMultiSelection()) && // 2. The element should exist in the DOM (not deleted).
35
+ element && ownerDocument.contains(element) && // 3. It should also not exist in the container, the popover, nor the dialog.
36
+ !container.contains(element) && !popoverRef.current.contains(element) && !element.closest('[role="dialog"]') && // 4. The inspector should not be opened.
37
+ !inspector.expanded()
38
+ ) {
54
39
  clearSelectedBlock();
55
40
  }
56
- }
57
-
58
- // Handle mouse down in the same document.
59
- function handleMouseDown(event) {
41
+ }, handleMouseDown = function(event) {
60
42
  handleClearSelectedBlock(event.target);
61
- }
62
- // Handle focusing outside the current document, like to iframes.
63
- function handleBlur() {
43
+ }, handleBlur = function() {
64
44
  handleClearSelectedBlock(ownerDocument.activeElement);
65
- }
66
- ownerDocument.addEventListener('mousedown', handleMouseDown);
67
- ownerWindow.addEventListener('blur', handleBlur);
45
+ };
46
+ const inspector = sidebarControl.inspector;
47
+ const container = sidebarControl.container[0];
48
+ const ownerDocument = container.ownerDocument;
49
+ const ownerWindow = ownerDocument.defaultView;
50
+ ownerDocument.addEventListener("mousedown", handleMouseDown);
51
+ ownerWindow.addEventListener("blur", handleBlur);
68
52
  return () => {
69
- ownerDocument.removeEventListener('mousedown', handleMouseDown);
70
- ownerWindow.removeEventListener('blur', handleBlur);
53
+ ownerDocument.removeEventListener(
54
+ "mousedown",
55
+ handleMouseDown
56
+ );
57
+ ownerWindow.removeEventListener("blur", handleBlur);
71
58
  };
72
59
  }
73
- }, [popoverRef, sidebarControl, hasSelectedBlock, hasMultiSelection, clearSelectedBlock]);
60
+ }, [
61
+ popoverRef,
62
+ sidebarControl,
63
+ hasSelectedBlock,
64
+ hasMultiSelection,
65
+ clearSelectedBlock
66
+ ]);
74
67
  }
75
- //# sourceMappingURL=use-clear-selected-block.js.map
68
+ //# sourceMappingURL=use-clear-selected-block.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_element","require","_data","_blockEditor","useClearSelectedBlock","sidebarControl","popoverRef","hasSelectedBlock","hasMultiSelection","useSelect","blockEditorStore","clearSelectedBlock","useDispatch","useEffect","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":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,qBAAqBA,CAAEC,cAAc,EAAEC,UAAU,EAAG;EAC3E,MAAM;IAAEC,gBAAgB;IAAEC;EAAkB,CAAC,GAC5C,IAAAC,eAAS,EAAEC,kBAAiB,CAAC;EAC9B,MAAM;IAAEC;EAAmB,CAAC,GAAG,IAAAC,iBAAW,EAAEF,kBAAiB,CAAC;EAE9D,IAAAG,kBAAS,EAAE,MAAM;IAChB,IAAKP,UAAU,CAACQ,OAAO,IAAIT,cAAc,EAAG;MAC3C,MAAMU,SAAS,GAAGV,cAAc,CAACU,SAAS;MAC1C,MAAMC,SAAS,GAAGX,cAAc,CAACW,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,CAAEd,gBAAgB,CAAC,CAAC,IAAIC,iBAAiB,CAAC,CAAC;QAC3C;QACAa,OAAO,IACPJ,aAAa,CAACK,QAAQ,CAAED,OAAQ,CAAC;QACjC;QACA,CAAEL,SAAS,CAACM,QAAQ,CAAED,OAAQ,CAAC,IAC/B,CAAEf,UAAU,CAACQ,OAAO,CAACQ,QAAQ,CAAED,OAAQ,CAAC,IACxC,CAAEA,OAAO,CAACE,OAAO,CAAE,iBAAkB,CAAC;QACtC;QACA,CAAER,SAAS,CAACS,QAAQ,CAAC,CAAC,EACrB;UACDb,kBAAkB,CAAC,CAAC;QACrB;MACD;;MAEA;MACA,SAASc,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,CACFtB,UAAU,EACVD,cAAc,EACdE,gBAAgB,EAChBC,iBAAiB,EACjBG,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": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA0B;AAC1B,kBAAuC;AACvC,0BAA0C;AAkB3B,SAAR,sBAAwC,gBAAgB,YAAa;AAC3E,QAAM,EAAE,kBAAkB,kBAAkB,QAC3C,uBAAW,oBAAAA,KAAiB;AAC7B,QAAM,EAAE,mBAAmB,QAAI,yBAAa,oBAAAA,KAAiB;AAE7D,gCAAW,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": ["blockEditorStore"]
7
+ }