@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,39 @@
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 inserter_outer_section_exports = {};
19
+ __export(inserter_outer_section_exports, {
20
+ default: () => getInserterOuterSection
5
21
  });
6
- exports.default = getInserterOuterSection;
7
- var _keycodes = require("@wordpress/keycodes");
8
- var _dom = require("@wordpress/dom");
9
- var _data = require("@wordpress/data");
10
- var _store = require("../store");
11
- /**
12
- * WordPress dependencies
13
- */
14
-
15
- /**
16
- * Internal dependencies
17
- */
18
-
22
+ module.exports = __toCommonJS(inserter_outer_section_exports);
23
+ var import_keycodes = require("@wordpress/keycodes");
24
+ var import_dom = require("@wordpress/dom");
25
+ var import_data = require("@wordpress/data");
26
+ var import_store = require("../store");
19
27
  function getInserterOuterSection() {
20
28
  const {
21
- wp: {
22
- customize
23
- }
29
+ wp: { customize }
24
30
  } = window;
25
31
  const OuterSection = customize.OuterSection;
26
- // Override the OuterSection class to handle multiple outer sections.
27
- // It closes all the other outer sections whenever one is opened.
28
- // The result is that at most one outer section can be opened at the same time.
29
32
  customize.OuterSection = class extends OuterSection {
30
33
  onChangeExpanded(expanded, args) {
31
34
  if (expanded) {
32
- customize.section.each(section => {
33
- if (section.params.type === 'outer' && section.id !== this.id) {
35
+ customize.section.each((section) => {
36
+ if (section.params.type === "outer" && section.id !== this.id) {
34
37
  if (section.expanded()) {
35
38
  section.collapse();
36
39
  }
@@ -40,37 +43,34 @@ function getInserterOuterSection() {
40
43
  return super.onChangeExpanded(expanded, args);
41
44
  }
42
45
  };
43
- // Handle constructor so that "params.type" can be correctly pointed to "outer".
44
46
  customize.sectionConstructor.outer = customize.OuterSection;
45
47
  return class InserterOuterSection extends customize.OuterSection {
46
48
  constructor(...args) {
47
49
  super(...args);
48
-
49
- // This is necessary since we're creating a new class which is not identical to the original OuterSection.
50
- // @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436
51
- this.params.type = 'outer';
50
+ this.params.type = "outer";
52
51
  this.activeElementBeforeExpanded = null;
53
52
  const ownerWindow = this.contentContainer[0].ownerDocument.defaultView;
54
-
55
- // Handle closing the inserter when pressing the Escape key.
56
- ownerWindow.addEventListener('keydown', event => {
57
- if (this.expanded() && (event.keyCode === _keycodes.ESCAPE || event.code === 'Escape') && !event.defaultPrevented) {
58
- event.preventDefault();
59
- event.stopPropagation();
60
- (0, _data.dispatch)(_store.store).setIsInserterOpened(false);
61
- }
62
- },
63
- // Use capture mode to make this run before other event listeners.
64
- true);
65
- this.contentContainer.addClass('widgets-inserter');
66
-
67
- // Set a flag if the state is being changed from open() or close().
68
- // Don't propagate the event if it's an internal action to prevent infinite loop.
53
+ ownerWindow.addEventListener(
54
+ "keydown",
55
+ (event) => {
56
+ if (this.expanded() && (event.keyCode === import_keycodes.ESCAPE || event.code === "Escape") && !event.defaultPrevented) {
57
+ event.preventDefault();
58
+ event.stopPropagation();
59
+ (0, import_data.dispatch)(import_store.store).setIsInserterOpened(
60
+ false
61
+ );
62
+ }
63
+ },
64
+ // Use capture mode to make this run before other event listeners.
65
+ true
66
+ );
67
+ this.contentContainer.addClass("widgets-inserter");
69
68
  this.isFromInternalAction = false;
70
69
  this.expanded.bind(() => {
71
70
  if (!this.isFromInternalAction) {
72
- // Propagate the event to React to sync the state.
73
- (0, _data.dispatch)(_store.store).setIsInserterOpened(this.expanded());
71
+ (0, import_data.dispatch)(import_store.store).setIsInserterOpened(
72
+ this.expanded()
73
+ );
74
74
  }
75
75
  this.isFromInternalAction = false;
76
76
  });
@@ -82,10 +82,7 @@ function getInserterOuterSection() {
82
82
  this.isFromInternalAction = true;
83
83
  this.expand({
84
84
  completeCallback() {
85
- // We have to do this in a "completeCallback" or else the elements will not yet be visible/tabbable.
86
- // The first one should be the close button,
87
- // we want to skip it and choose the second one instead, which is the search box.
88
- const searchBox = _dom.focus.tabbable.find(contentContainer)[1];
85
+ const searchBox = import_dom.focus.tabbable.find(contentContainer)[1];
89
86
  if (searchBox) {
90
87
  searchBox.focus();
91
88
  }
@@ -100,13 +97,7 @@ function getInserterOuterSection() {
100
97
  this.isFromInternalAction = true;
101
98
  this.collapse({
102
99
  completeCallback() {
103
- // Return back the focus when closing the inserter.
104
- // Only do this if the active element which triggers the action is inside the inserter,
105
- // (the close button for instance). In that case the focus will be lost.
106
- // Otherwise, we don't hijack the focus when the user is focusing on other elements
107
- // (like the quick inserter).
108
100
  if (contentContainer.contains(activeElement)) {
109
- // Return back the focus when closing the inserter.
110
101
  if (this.activeElementBeforeExpanded) {
111
102
  this.activeElementBeforeExpanded.focus();
112
103
  }
@@ -117,4 +108,4 @@ function getInserterOuterSection() {
117
108
  }
118
109
  };
119
110
  }
120
- //# sourceMappingURL=inserter-outer-section.js.map
111
+ //# sourceMappingURL=inserter-outer-section.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_keycodes","require","_dom","_data","_store","getInserterOuterSection","wp","customize","window","OuterSection","onChangeExpanded","expanded","args","section","each","params","type","id","collapse","sectionConstructor","outer","InserterOuterSection","constructor","activeElementBeforeExpanded","ownerWindow","contentContainer","ownerDocument","defaultView","addEventListener","event","keyCode","ESCAPE","code","defaultPrevented","preventDefault","stopPropagation","dispatch","customizeWidgetsStore","setIsInserterOpened","addClass","isFromInternalAction","bind","open","activeElement","expand","completeCallback","searchBox","focus","tabbable","find","close","contains"],"sources":["@wordpress/customize-widgets/src/controls/inserter-outer-section.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as customizeWidgetsStore } from '../store';\n\nexport default function getInserterOuterSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst OuterSection = customize.OuterSection;\n\t// Override the OuterSection class to handle multiple outer sections.\n\t// It closes all the other outer sections whenever one is opened.\n\t// The result is that at most one outer section can be opened at the same time.\n\tcustomize.OuterSection = class extends OuterSection {\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tif ( expanded ) {\n\t\t\t\tcustomize.section.each( ( section ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tsection.params.type === 'outer' &&\n\t\t\t\t\t\tsection.id !== this.id\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ( section.expanded() ) {\n\t\t\t\t\t\t\tsection.collapse();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn super.onChangeExpanded( expanded, args );\n\t\t}\n\t};\n\t// Handle constructor so that \"params.type\" can be correctly pointed to \"outer\".\n\tcustomize.sectionConstructor.outer = customize.OuterSection;\n\n\treturn class InserterOuterSection extends customize.OuterSection {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\t// This is necessary since we're creating a new class which is not identical to the original OuterSection.\n\t\t\t// @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436\n\t\t\tthis.params.type = 'outer';\n\n\t\t\tthis.activeElementBeforeExpanded = null;\n\n\t\t\tconst ownerWindow =\n\t\t\t\tthis.contentContainer[ 0 ].ownerDocument.defaultView;\n\n\t\t\t// Handle closing the inserter when pressing the Escape key.\n\t\t\townerWindow.addEventListener(\n\t\t\t\t'keydown',\n\t\t\t\t( event ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.expanded() &&\n\t\t\t\t\t\t( event.keyCode === ESCAPE ||\n\t\t\t\t\t\t\tevent.code === 'Escape' ) &&\n\t\t\t\t\t\t! event.defaultPrevented\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t// Use capture mode to make this run before other event listeners.\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\tthis.contentContainer.addClass( 'widgets-inserter' );\n\n\t\t\t// Set a flag if the state is being changed from open() or close().\n\t\t\t// Don't propagate the event if it's an internal action to prevent infinite loop.\n\t\t\tthis.isFromInternalAction = false;\n\t\t\tthis.expanded.bind( () => {\n\t\t\t\tif ( ! this.isFromInternalAction ) {\n\t\t\t\t\t// Propagate the event to React to sync the state.\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tthis.expanded()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.isFromInternalAction = false;\n\t\t\t} );\n\t\t}\n\t\topen() {\n\t\t\tif ( ! this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tthis.activeElementBeforeExpanded =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.expand( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// We have to do this in a \"completeCallback\" or else the elements will not yet be visible/tabbable.\n\t\t\t\t\t\t// The first one should be the close button,\n\t\t\t\t\t\t// we want to skip it and choose the second one instead, which is the search box.\n\t\t\t\t\t\tconst searchBox =\n\t\t\t\t\t\t\tfocus.tabbable.find( contentContainer )[ 1 ];\n\t\t\t\t\t\tif ( searchBox ) {\n\t\t\t\t\t\t\tsearchBox.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t\tclose() {\n\t\t\tif ( this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tconst activeElement =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.collapse( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t// Only do this if the active element which triggers the action is inside the inserter,\n\t\t\t\t\t\t// (the close button for instance). In that case the focus will be lost.\n\t\t\t\t\t\t// Otherwise, we don't hijack the focus when the user is focusing on other elements\n\t\t\t\t\t\t// (like the quick inserter).\n\t\t\t\t\t\tif ( contentContainer.contains( activeElement ) ) {\n\t\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t\tif ( this.activeElementBeforeExpanded ) {\n\t\t\t\t\t\t\t\tthis.activeElementBeforeExpanded.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASI,uBAAuBA,CAAA,EAAG;EACjD,MAAM;IACLC,EAAE,EAAE;MAAEC;IAAU;EACjB,CAAC,GAAGC,MAAM;EAEV,MAAMC,YAAY,GAAGF,SAAS,CAACE,YAAY;EAC3C;EACA;EACA;EACAF,SAAS,CAACE,YAAY,GAAG,cAAcA,YAAY,CAAC;IACnDC,gBAAgBA,CAAEC,QAAQ,EAAEC,IAAI,EAAG;MAClC,IAAKD,QAAQ,EAAG;QACfJ,SAAS,CAACM,OAAO,CAACC,IAAI,CAAID,OAAO,IAAM;UACtC,IACCA,OAAO,CAACE,MAAM,CAACC,IAAI,KAAK,OAAO,IAC/BH,OAAO,CAACI,EAAE,KAAK,IAAI,CAACA,EAAE,EACrB;YACD,IAAKJ,OAAO,CAACF,QAAQ,CAAC,CAAC,EAAG;cACzBE,OAAO,CAACK,QAAQ,CAAC,CAAC;YACnB;UACD;QACD,CAAE,CAAC;MACJ;MAEA,OAAO,KAAK,CAACR,gBAAgB,CAAEC,QAAQ,EAAEC,IAAK,CAAC;IAChD;EACD,CAAC;EACD;EACAL,SAAS,CAACY,kBAAkB,CAACC,KAAK,GAAGb,SAAS,CAACE,YAAY;E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IAAI,CAACA,gBAAgB,CAAE,CAAC,CAAE;QACnD,IAAI,CAACF,2BAA2B,GAC/BE,gBAAgB,CAACC,aAAa,CAACiB,aAAa;QAE7C,IAAI,CAACH,oBAAoB,GAAG,IAAI;QAEhC,IAAI,CAACI,MAAM,CAAE;UACZC,gBAAgBA,CAAA,EAAG;YAClB;YACA;YACA;YACA,MAAMC,SAAS,GACdC,UAAK,CAACC,QAAQ,CAACC,IAAI,CAAExB,gBAAiB,CAAC,CAAE,CAAC,CAAE;YAC7C,IAAKqB,SAAS,EAAG;cAChBA,SAAS,CAACC,KAAK,CAAC,CAAC;YAClB;UACD;QACD,CAAE,CAAC;MACJ;IACD;IACAG,KAAKA,CAAA,EAAG;MACP,IAAK,IAAI,CAACvC,QAAQ,CAAC,CAAC,EAAG;QACtB,MAAMc,gBAAgB,GAAG,IAAI,CAACA,gBAAgB,CAAE,CAAC,CAAE;QACnD,MAAMkB,aAAa,GAClBlB,gBAAgB,CAACC,aAAa,CAACiB,aAAa;QAE7C,IAAI,CAACH,oBAAoB,GAAG,IAAI;QAEhC,IAAI,CAACtB,QAAQ,CAAE;UACd2B,gBAAgBA,CAAA,EAAG;YAClB;YACA;YACA;YACA;YACA;YACA,IAAKpB,gBAAgB,CAAC0B,QAAQ,CAAER,aAAc,CAAC,EAAG;cACjD;cACA,IAAK,IAAI,CAACpB,2BAA2B,EAAG;gBACvC,IAAI,CAACA,2BAA2B,CAACwB,KAAK,CAAC,CAAC;cACzC;YACD;UACD;QACD,CAAE,CAAC;MACJ;IACD;EACD,CAAC;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/controls/inserter-outer-section.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as customizeWidgetsStore } from '../store';\n\nexport default function getInserterOuterSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst OuterSection = customize.OuterSection;\n\t// Override the OuterSection class to handle multiple outer sections.\n\t// It closes all the other outer sections whenever one is opened.\n\t// The result is that at most one outer section can be opened at the same time.\n\tcustomize.OuterSection = class extends OuterSection {\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tif ( expanded ) {\n\t\t\t\tcustomize.section.each( ( section ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tsection.params.type === 'outer' &&\n\t\t\t\t\t\tsection.id !== this.id\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ( section.expanded() ) {\n\t\t\t\t\t\t\tsection.collapse();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn super.onChangeExpanded( expanded, args );\n\t\t}\n\t};\n\t// Handle constructor so that \"params.type\" can be correctly pointed to \"outer\".\n\tcustomize.sectionConstructor.outer = customize.OuterSection;\n\n\treturn class InserterOuterSection extends customize.OuterSection {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\t// This is necessary since we're creating a new class which is not identical to the original OuterSection.\n\t\t\t// @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436\n\t\t\tthis.params.type = 'outer';\n\n\t\t\tthis.activeElementBeforeExpanded = null;\n\n\t\t\tconst ownerWindow =\n\t\t\t\tthis.contentContainer[ 0 ].ownerDocument.defaultView;\n\n\t\t\t// Handle closing the inserter when pressing the Escape key.\n\t\t\townerWindow.addEventListener(\n\t\t\t\t'keydown',\n\t\t\t\t( event ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.expanded() &&\n\t\t\t\t\t\t( event.keyCode === ESCAPE ||\n\t\t\t\t\t\t\tevent.code === 'Escape' ) &&\n\t\t\t\t\t\t! event.defaultPrevented\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t// Use capture mode to make this run before other event listeners.\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\tthis.contentContainer.addClass( 'widgets-inserter' );\n\n\t\t\t// Set a flag if the state is being changed from open() or close().\n\t\t\t// Don't propagate the event if it's an internal action to prevent infinite loop.\n\t\t\tthis.isFromInternalAction = false;\n\t\t\tthis.expanded.bind( () => {\n\t\t\t\tif ( ! this.isFromInternalAction ) {\n\t\t\t\t\t// Propagate the event to React to sync the state.\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tthis.expanded()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.isFromInternalAction = false;\n\t\t\t} );\n\t\t}\n\t\topen() {\n\t\t\tif ( ! this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tthis.activeElementBeforeExpanded =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.expand( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// We have to do this in a \"completeCallback\" or else the elements will not yet be visible/tabbable.\n\t\t\t\t\t\t// The first one should be the close button,\n\t\t\t\t\t\t// we want to skip it and choose the second one instead, which is the search box.\n\t\t\t\t\t\tconst searchBox =\n\t\t\t\t\t\t\tfocus.tabbable.find( contentContainer )[ 1 ];\n\t\t\t\t\t\tif ( searchBox ) {\n\t\t\t\t\t\t\tsearchBox.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t\tclose() {\n\t\t\tif ( this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tconst activeElement =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.collapse( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t// Only do this if the active element which triggers the action is inside the inserter,\n\t\t\t\t\t\t// (the close button for instance). In that case the focus will be lost.\n\t\t\t\t\t\t// Otherwise, we don't hijack the focus when the user is focusing on other elements\n\t\t\t\t\t\t// (like the quick inserter).\n\t\t\t\t\t\tif ( contentContainer.contains( activeElement ) ) {\n\t\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t\tif ( this.activeElementBeforeExpanded ) {\n\t\t\t\t\t\t\t\tthis.activeElementBeforeExpanded.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAuB;AACvB,iBAAsB;AACtB,kBAAyB;AAKzB,mBAA+C;AAEhC,SAAR,0BAA2C;AACjD,QAAM;AAAA,IACL,IAAI,EAAE,UAAU;AAAA,EACjB,IAAI;AAEJ,QAAM,eAAe,UAAU;AAI/B,YAAU,eAAe,cAAc,aAAa;AAAA,IACnD,iBAAkB,UAAU,MAAO;AAClC,UAAK,UAAW;AACf,kBAAU,QAAQ,KAAM,CAAE,YAAa;AACtC,cACC,QAAQ,OAAO,SAAS,WACxB,QAAQ,OAAO,KAAK,IACnB;AACD,gBAAK,QAAQ,SAAS,GAAI;AACzB,sBAAQ,SAAS;AAAA,YAClB;AAAA,UACD;AAAA,QACD,CAAE;AAAA,MACH;AAEA,aAAO,MAAM,iBAAkB,UAAU,IAAK;AAAA,IAC/C;AAAA,EACD;AAEA,YAAU,mBAAmB,QAAQ,UAAU;AAE/C,SAAO,MAAM,6BAA6B,UAAU,aAAa;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AAc,GAAI;AAEjD,kBAAK,KAAK,6BAA8B;AACvC,qBAAK,4BAA4B,MAAM;AAAA,cACxC;AAAA,YACD;AAAA,UACD;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD;AAAA,EACD;AACD;",
6
+ "names": ["customizeWidgetsStore"]
7
+ }
@@ -1,14 +1,28 @@
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 inspector_section_exports = {};
19
+ __export(inspector_section_exports, {
20
+ default: () => getInspectorSection
5
21
  });
6
- exports.default = getInspectorSection;
22
+ module.exports = __toCommonJS(inspector_section_exports);
7
23
  function getInspectorSection() {
8
24
  const {
9
- wp: {
10
- customize
11
- }
25
+ wp: { customize }
12
26
  } = window;
13
27
  return class InspectorSection extends customize.Section {
14
28
  constructor(id, options) {
@@ -25,7 +39,9 @@ function getInspectorSection() {
25
39
  this.triggerActiveCallbacks();
26
40
  }
27
41
  ready() {
28
- this.contentContainer[0].classList.add('customize-widgets-layout__inspector');
42
+ this.contentContainer[0].classList.add(
43
+ "customize-widgets-layout__inspector"
44
+ );
29
45
  }
30
46
  isContextuallyActive() {
31
47
  return this.isOpen;
@@ -41,8 +57,9 @@ function getInspectorSection() {
41
57
  this.parentSection.expand({
42
58
  manualTransition: true,
43
59
  completeCallback: () => {
44
- // Return focus after finishing the transition.
45
- if (this.returnFocusWhenClose && !this.contentContainer[0].contains(this.returnFocusWhenClose)) {
60
+ if (this.returnFocusWhenClose && !this.contentContainer[0].contains(
61
+ this.returnFocusWhenClose
62
+ )) {
46
63
  this.returnFocusWhenClose.focus();
47
64
  }
48
65
  }
@@ -50,9 +67,7 @@ function getInspectorSection() {
50
67
  }
51
68
  }
52
69
  }
53
- open({
54
- returnFocusWhenClose
55
- } = {}) {
70
+ open({ returnFocusWhenClose } = {}) {
56
71
  this.isOpen = true;
57
72
  this.returnFocusWhenClose = returnFocusWhenClose;
58
73
  this.expand({
@@ -65,33 +80,12 @@ function getInspectorSection() {
65
80
  });
66
81
  }
67
82
  collapse(options) {
68
- // Overridden collapse() function. Mostly call the parent collapse(), but also
69
- // move our .isOpen to false.
70
- // Initially, I tried tracking this with onChangeExpanded(), but it doesn't work
71
- // because the block settings sidebar is a layer "on top of" the G editor sidebar.
72
- //
73
- // For example, when closing the block settings sidebar, the G
74
- // editor sidebar would display, and onChangeExpanded in
75
- // inspector-section would run with expanded=true, but I want
76
- // isOpen to be false when the block settings is closed.
77
83
  this.isOpen = false;
78
84
  super.collapse(options);
79
85
  }
80
86
  triggerActiveCallbacks() {
81
- // Manually fire the callbacks associated with moving this.active
82
- // from false to true. "active" is always true for this section,
83
- // and "isContextuallyActive" reflects if the block settings
84
- // sidebar is currently visible, that is, it has replaced the main
85
- // Gutenberg view.
86
- // The WP customizer only checks ".isContextuallyActive()" when
87
- // ".active" changes values. But our ".active" never changes value.
88
- // The WP customizer never foresaw a section being used a way we
89
- // fit the block settings sidebar into a section. By manually
90
- // triggering the "this.active" callbacks, we force the WP
91
- // customizer to query our .isContextuallyActive() function and
92
- // update its view of our status.
93
87
  this.active.callbacks.fireWith(this.active, [false, true]);
94
88
  }
95
89
  };
96
90
  }
97
- //# sourceMappingURL=inspector-section.js.map
91
+ //# sourceMappingURL=inspector-section.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["getInspectorSection","wp","customize","window","InspectorSection","Section","constructor","id","options","parentSection","returnFocusWhenClose","_isOpen","isOpen","value","triggerActiveCallbacks","ready","contentContainer","classList","add","isContextuallyActive","onChangeExpanded","expanded","args","unchanged","collapse","manualTransition","expand","completeCallback","contains","focus","open","allowMultiple","close","active","callbacks","fireWith"],"sources":["@wordpress/customize-widgets/src/controls/inspector-section.js"],"sourcesContent":["export default function getInspectorSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class InspectorSection extends customize.Section {\n\t\tconstructor( id, options ) {\n\t\t\tsuper( id, options );\n\n\t\t\tthis.parentSection = options.parentSection;\n\n\t\t\tthis.returnFocusWhenClose = null;\n\t\t\tthis._isOpen = false;\n\t\t}\n\t\tget isOpen() {\n\t\t\treturn this._isOpen;\n\t\t}\n\t\tset isOpen( value ) {\n\t\t\tthis._isOpen = value;\n\t\t\tthis.triggerActiveCallbacks();\n\t\t}\n\t\tready() {\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets-layout__inspector'\n\t\t\t);\n\t\t}\n\t\tisContextuallyActive() {\n\t\t\treturn this.isOpen;\n\t\t}\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tsuper.onChangeExpanded( expanded, args );\n\n\t\t\tif ( this.parentSection && ! args.unchanged ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.parentSection.collapse( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tthis.parentSection.expand( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t\tcompleteCallback: () => {\n\t\t\t\t\t\t\t// Return focus after finishing the transition.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose &&\n\t\t\t\t\t\t\t\t! this.contentContainer[ 0 ].contains(\n\t\t\t\t\t\t\t\t\tthis.returnFocusWhenClose\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\topen( { returnFocusWhenClose } = {} ) {\n\t\t\tthis.isOpen = true;\n\t\t\tthis.returnFocusWhenClose = returnFocusWhenClose;\n\n\t\t\tthis.expand( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tclose() {\n\t\t\tthis.collapse( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tcollapse( options ) {\n\t\t\t// Overridden collapse() function. Mostly call the parent collapse(), but also\n\t\t\t// move our .isOpen to false.\n\t\t\t// Initially, I tried tracking this with onChangeExpanded(), but it doesn't work\n\t\t\t// because the block settings sidebar is a layer \"on top of\" the G editor sidebar.\n\t\t\t//\n\t\t\t// For example, when closing the block settings sidebar, the G\n\t\t\t// editor sidebar would display, and onChangeExpanded in\n\t\t\t// inspector-section would run with expanded=true, but I want\n\t\t\t// isOpen to be false when the block settings is closed.\n\t\t\tthis.isOpen = false;\n\t\t\tsuper.collapse( options );\n\t\t}\n\t\ttriggerActiveCallbacks() {\n\t\t\t// Manually fire the callbacks associated with moving this.active\n\t\t\t// from false to true. \"active\" is always true for this section,\n\t\t\t// and \"isContextuallyActive\" reflects if the block settings\n\t\t\t// sidebar is currently visible, that is, it has replaced the main\n\t\t\t// Gutenberg view.\n\t\t\t// The WP customizer only checks \".isContextuallyActive()\" when\n\t\t\t// \".active\" changes values. But our \".active\" never changes value.\n\t\t\t// The WP customizer never foresaw a section being used a way we\n\t\t\t// fit the block settings sidebar into a section. By manually\n\t\t\t// triggering the \"this.active\" callbacks, we force the WP\n\t\t\t// customizer to query our .isContextuallyActive() function and\n\t\t\t// update its view of our status.\n\t\t\tthis.active.callbacks.fireWith( this.active, [ false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,CAACjB,oBAAoB,IACzB,CAAE,IAAI,CAACM,gBAAgB,CAAE,CAAC,CAAE,CAACY,QAAQ,CACpC,IAAI,CAAClB,oBACN,CAAC,EACA;gBACD,IAAI,CAACA,oBAAoB,CAACmB,KAAK,CAAC,CAAC;cAClC;YACD;UACD,CAAE,CAAC;QACJ;MACD;IACD;IACAC,IAAIA,CAAE;MAAEpB;IAAqB,CAAC,GAAG,CAAC,CAAC,EAAG;MACrC,IAAI,CAACE,MAAM,GAAG,IAAI;MAClB,IAAI,CAACF,oBAAoB,GAAGA,oBAAoB;MAEhD,IAAI,CAACgB,MAAM,CAAE;QACZK,aAAa,EAAE;MAChB,CAAE,CAAC;IACJ;IACAC,KAAKA,CAAA,EAAG;MACP,IAAI,CAACR,QAAQ,CAAE;QACdO,aAAa,EAAE;MAChB,CAAE,CAAC;IACJ;IACAP,QAAQA,CAAEhB,OAAO,EAAG;MACnB;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,IAAI,CAACI,MAAM,GAAG,KAAK;MACnB,KAAK,CAACY,QAAQ,CAAEhB,OAAQ,CAAC;IAC1B;IACAM,sBAAsBA,CAAA,EAAG;MACxB;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,IAAI,CAACmB,MAAM,CAACC,SAAS,CAACC,QAAQ,CAAE,IAAI,CAACF,MAAM,EAAE,CAAE,KAAK,EAAE,IAAI,CAAG,CAAC;IAC/D;EACD,CAAC;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/controls/inspector-section.js"],
4
+ "sourcesContent": ["export default function getInspectorSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class InspectorSection extends customize.Section {\n\t\tconstructor( id, options ) {\n\t\t\tsuper( id, options );\n\n\t\t\tthis.parentSection = options.parentSection;\n\n\t\t\tthis.returnFocusWhenClose = null;\n\t\t\tthis._isOpen = false;\n\t\t}\n\t\tget isOpen() {\n\t\t\treturn this._isOpen;\n\t\t}\n\t\tset isOpen( value ) {\n\t\t\tthis._isOpen = value;\n\t\t\tthis.triggerActiveCallbacks();\n\t\t}\n\t\tready() {\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets-layout__inspector'\n\t\t\t);\n\t\t}\n\t\tisContextuallyActive() {\n\t\t\treturn this.isOpen;\n\t\t}\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tsuper.onChangeExpanded( expanded, args );\n\n\t\t\tif ( this.parentSection && ! args.unchanged ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.parentSection.collapse( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tthis.parentSection.expand( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t\tcompleteCallback: () => {\n\t\t\t\t\t\t\t// Return focus after finishing the transition.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose &&\n\t\t\t\t\t\t\t\t! this.contentContainer[ 0 ].contains(\n\t\t\t\t\t\t\t\t\tthis.returnFocusWhenClose\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\topen( { returnFocusWhenClose } = {} ) {\n\t\t\tthis.isOpen = true;\n\t\t\tthis.returnFocusWhenClose = returnFocusWhenClose;\n\n\t\t\tthis.expand( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tclose() {\n\t\t\tthis.collapse( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tcollapse( options ) {\n\t\t\t// Overridden collapse() function. Mostly call the parent collapse(), but also\n\t\t\t// move our .isOpen to false.\n\t\t\t// Initially, I tried tracking this with onChangeExpanded(), but it doesn't work\n\t\t\t// because the block settings sidebar is a layer \"on top of\" the G editor sidebar.\n\t\t\t//\n\t\t\t// For example, when closing the block settings sidebar, the G\n\t\t\t// editor sidebar would display, and onChangeExpanded in\n\t\t\t// inspector-section would run with expanded=true, but I want\n\t\t\t// isOpen to be false when the block settings is closed.\n\t\t\tthis.isOpen = false;\n\t\t\tsuper.collapse( options );\n\t\t}\n\t\ttriggerActiveCallbacks() {\n\t\t\t// Manually fire the callbacks associated with moving this.active\n\t\t\t// from false to true. \"active\" is always true for this section,\n\t\t\t// and \"isContextuallyActive\" reflects if the block settings\n\t\t\t// sidebar is currently visible, that is, it has replaced the main\n\t\t\t// Gutenberg view.\n\t\t\t// The WP customizer only checks \".isContextuallyActive()\" when\n\t\t\t// \".active\" changes values. But our \".active\" never changes value.\n\t\t\t// The WP customizer never foresaw a section being used a way we\n\t\t\t// fit the block settings sidebar into a section. By manually\n\t\t\t// triggering the \"this.active\" callbacks, we force the WP\n\t\t\t// customizer to query our .isContextuallyActive() function and\n\t\t\t// update its view of our status.\n\t\t\tthis.active.callbacks.fireWith( this.active, [ false, true ] );\n\t\t}\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAe,SAAR,sBAAuC;AAC7C,QAAM;AAAA,IACL,IAAI,EAAE,UAAU;AAAA,EACjB,IAAI;AAEJ,SAAO,MAAM,yBAAyB,UAAU,QAAQ;AAAA,IACvD,YAAa,IAAI,SAAU;AAC1B,YAAO,IAAI,OAAQ;AAEnB,WAAK,gBAAgB,QAAQ;AAE7B,WAAK,uBAAuB;AAC5B,WAAK,UAAU;AAAA,IAChB;AAAA,IACA,IAAI,SAAS;AACZ,aAAO,KAAK;AAAA,IACb;AAAA,IACA,IAAI,OAAQ,OAAQ;AACnB,WAAK,UAAU;AACf,WAAK,uBAAuB;AAAA,IAC7B;AAAA,IACA,QAAQ;AACP,WAAK,iBAAkB,CAAE,EAAE,UAAU;AAAA,QACpC;AAAA,MACD;AAAA,IACD;AAAA,IACA,uBAAuB;AACtB,aAAO,KAAK;AAAA,IACb;AAAA,IACA,iBAAkB,UAAU,MAAO;AAClC,YAAM,iBAAkB,UAAU,IAAK;AAEvC,UAAK,KAAK,iBAAiB,CAAE,KAAK,WAAY;AAC7C,YAAK,UAAW;AACf,eAAK,cAAc,SAAU;AAAA,YAC5B,kBAAkB;AAAA,UACnB,CAAE;AAAA,QACH,OAAO;AACN,eAAK,cAAc,OAAQ;AAAA,YAC1B,kBAAkB;AAAA,YAClB,kBAAkB,MAAM;AAEvB,kBACC,KAAK,wBACL,CAAE,KAAK,iBAAkB,CAAE,EAAE;AAAA,gBAC5B,KAAK;AAAA,cACN,GACC;AACD,qBAAK,qBAAqB,MAAM;AAAA,cACjC;AAAA,YACD;AAAA,UACD,CAAE;AAAA,QACH;AAAA,MACD;AAAA,IACD;AAAA,IACA,KAAM,EAAE,qBAAqB,IAAI,CAAC,GAAI;AACrC,WAAK,SAAS;AACd,WAAK,uBAAuB;AAE5B,WAAK,OAAQ;AAAA,QACZ,eAAe;AAAA,MAChB,CAAE;AAAA,IACH;AAAA,IACA,QAAQ;AACP,WAAK,SAAU;AAAA,QACd,eAAe;AAAA,MAChB,CAAE;AAAA,IACH;AAAA,IACA,SAAU,SAAU;AAUnB,WAAK,SAAS;AACd,YAAM,SAAU,OAAQ;AAAA,IACzB;AAAA,IACA,yBAAyB;AAaxB,WAAK,OAAO,UAAU,SAAU,KAAK,QAAQ,CAAE,OAAO,IAAK,CAAE;AAAA,IAC9D;AAAA,EACD;AACD;",
6
+ "names": []
7
+ }
@@ -1,41 +1,59 @@
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 sidebar_control_exports = {};
29
+ __export(sidebar_control_exports, {
30
+ default: () => getSidebarControl
6
31
  });
7
- exports.default = getSidebarControl;
8
- var _data = require("@wordpress/data");
9
- var _sidebarAdapter = _interopRequireDefault(require("../components/sidebar-block-editor/sidebar-adapter"));
10
- var _inserterOuterSection = _interopRequireDefault(require("./inserter-outer-section"));
11
- var _store = require("../store");
12
- /**
13
- * WordPress dependencies
14
- */
15
-
16
- /**
17
- * Internal dependencies
18
- */
19
-
20
- const getInserterId = controlId => `widgets-inserter-${controlId}`;
32
+ module.exports = __toCommonJS(sidebar_control_exports);
33
+ var import_data = require("@wordpress/data");
34
+ var import_sidebar_adapter = __toESM(require("../components/sidebar-block-editor/sidebar-adapter"));
35
+ var import_inserter_outer_section = __toESM(require("./inserter-outer-section"));
36
+ var import_store = require("../store");
37
+ const getInserterId = (controlId) => `widgets-inserter-${controlId}`;
21
38
  function getSidebarControl() {
22
39
  const {
23
- wp: {
24
- customize
25
- }
40
+ wp: { customize }
26
41
  } = window;
27
42
  return class SidebarControl extends customize.Control {
28
43
  constructor(...args) {
29
44
  super(...args);
30
- this.subscribers = new Set();
45
+ this.subscribers = /* @__PURE__ */ new Set();
31
46
  }
32
47
  ready() {
33
- const InserterOuterSection = (0, _inserterOuterSection.default)();
34
- this.inserter = new InserterOuterSection(getInserterId(this.id), {});
48
+ const InserterOuterSection = (0, import_inserter_outer_section.default)();
49
+ this.inserter = new InserterOuterSection(
50
+ getInserterId(this.id),
51
+ {}
52
+ );
35
53
  customize.section.add(this.inserter);
36
54
  this.sectionInstance = customize.section(this.section());
37
55
  this.inspector = this.sectionInstance.inspector;
38
- this.sidebarAdapter = new _sidebarAdapter.default(this.setting, customize);
56
+ this.sidebarAdapter = new import_sidebar_adapter.default(this.setting, customize);
39
57
  }
40
58
  subscribe(callback) {
41
59
  this.subscribers.add(callback);
@@ -45,13 +63,16 @@ function getSidebarControl() {
45
63
  }
46
64
  onChangeSectionExpanded(expanded, args) {
47
65
  if (!args.unchanged) {
48
- // Close the inserter when the section collapses.
49
66
  if (!expanded) {
50
- (0, _data.dispatch)(_store.store).setIsInserterOpened(false);
67
+ (0, import_data.dispatch)(import_store.store).setIsInserterOpened(
68
+ false
69
+ );
51
70
  }
52
- this.subscribers.forEach(subscriber => subscriber(expanded, args));
71
+ this.subscribers.forEach(
72
+ (subscriber) => subscriber(expanded, args)
73
+ );
53
74
  }
54
75
  }
55
76
  };
56
77
  }
57
- //# sourceMappingURL=sidebar-control.js.map
78
+ //# sourceMappingURL=sidebar-control.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_data","require","_sidebarAdapter","_interopRequireDefault","_inserterOuterSection","_store","getInserterId","controlId","getSidebarControl","wp","customize","window","SidebarControl","Control","constructor","args","subscribers","Set","ready","InserterOuterSection","getInserterOuterSection","inserter","id","section","add","sectionInstance","inspector","sidebarAdapter","SidebarAdapter","setting","subscribe","callback","delete","onChangeSectionExpanded","expanded","unchanged","dispatch","customizeWidgetsStore","setIsInserterOpened","forEach","subscriber"],"sources":["@wordpress/customize-widgets/src/controls/sidebar-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarAdapter from '../components/sidebar-block-editor/sidebar-adapter';\nimport getInserterOuterSection from './inserter-outer-section';\nimport { store as customizeWidgetsStore } from '../store';\n\nconst getInserterId = ( controlId ) => `widgets-inserter-${ controlId }`;\n\nexport default function getSidebarControl() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class SidebarControl extends customize.Control {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\tthis.subscribers = new Set();\n\t\t}\n\n\t\tready() {\n\t\t\tconst InserterOuterSection = getInserterOuterSection();\n\t\t\tthis.inserter = new InserterOuterSection(\n\t\t\t\tgetInserterId( this.id ),\n\t\t\t\t{}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inserter );\n\n\t\t\tthis.sectionInstance = customize.section( this.section() );\n\n\t\t\tthis.inspector = this.sectionInstance.inspector;\n\n\t\t\tthis.sidebarAdapter = new SidebarAdapter( this.setting, customize );\n\t\t}\n\n\t\tsubscribe( callback ) {\n\t\t\tthis.subscribers.add( callback );\n\n\t\t\treturn () => {\n\t\t\t\tthis.subscribers.delete( callback );\n\t\t\t};\n\t\t}\n\n\t\tonChangeSectionExpanded( expanded, args ) {\n\t\t\tif ( ! args.unchanged ) {\n\t\t\t\t// Close the inserter when the section collapses.\n\t\t\t\tif ( ! expanded ) {\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.subscribers.forEach( ( subscriber ) =>\n\t\t\t\t\tsubscriber( expanded, args )\n\t\t\t\t);\n\t\t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ACf,WAAW,CAACgB,MAAM,CAAED,QAAS,CAAC;MACpC,CAAC;IACF;IAEAE,uBAAuBA,CAAEC,QAAQ,EAAEnB,IAAI,EAAG;MACzC,IAAK,CAAEA,IAAI,CAACoB,SAAS,EAAG;QACvB;QACA,IAAK,CAAED,QAAQ,EAAG;UACjB,IAAAE,cAAQ,EAAEC,YAAsB,CAAC,CAACC,mBAAmB,CACpD,KACD,CAAC;QACF;QAEA,IAAI,CAACtB,WAAW,CAACuB,OAAO,CAAIC,UAAU,IACrCA,UAAU,CAAEN,QAAQ,EAAEnB,IAAK,CAC5B,CAAC;MACF;IACD;EACD,CAAC;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/controls/sidebar-control.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarAdapter from '../components/sidebar-block-editor/sidebar-adapter';\nimport getInserterOuterSection from './inserter-outer-section';\nimport { store as customizeWidgetsStore } from '../store';\n\nconst getInserterId = ( controlId ) => `widgets-inserter-${ controlId }`;\n\nexport default function getSidebarControl() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class SidebarControl extends customize.Control {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\tthis.subscribers = new Set();\n\t\t}\n\n\t\tready() {\n\t\t\tconst InserterOuterSection = getInserterOuterSection();\n\t\t\tthis.inserter = new InserterOuterSection(\n\t\t\t\tgetInserterId( this.id ),\n\t\t\t\t{}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inserter );\n\n\t\t\tthis.sectionInstance = customize.section( this.section() );\n\n\t\t\tthis.inspector = this.sectionInstance.inspector;\n\n\t\t\tthis.sidebarAdapter = new SidebarAdapter( this.setting, customize );\n\t\t}\n\n\t\tsubscribe( callback ) {\n\t\t\tthis.subscribers.add( callback );\n\n\t\t\treturn () => {\n\t\t\t\tthis.subscribers.delete( callback );\n\t\t\t};\n\t\t}\n\n\t\tonChangeSectionExpanded( expanded, args ) {\n\t\t\tif ( ! args.unchanged ) {\n\t\t\t\t// Close the inserter when the section collapses.\n\t\t\t\tif ( ! expanded ) {\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.subscribers.forEach( ( subscriber ) =>\n\t\t\t\t\tsubscriber( expanded, args )\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAyB;AAKzB,6BAA2B;AAC3B,oCAAoC;AACpC,mBAA+C;AAE/C,MAAM,gBAAgB,CAAE,cAAe,oBAAqB,SAAU;AAEvD,SAAR,oBAAqC;AAC3C,QAAM;AAAA,IACL,IAAI,EAAE,UAAU;AAAA,EACjB,IAAI;AAEJ,SAAO,MAAM,uBAAuB,UAAU,QAAQ;AAAA,IACrD,eAAgB,MAAO;AACtB,YAAO,GAAG,IAAK;AAEf,WAAK,cAAc,oBAAI,IAAI;AAAA,IAC5B;AAAA,IAEA,QAAQ;AACP,YAAM,2BAAuB,8BAAAA,SAAwB;AACrD,WAAK,WAAW,IAAI;AAAA,QACnB,cAAe,KAAK,EAAG;AAAA,QACvB,CAAC;AAAA,MACF;AACA,gBAAU,QAAQ,IAAK,KAAK,QAAS;AAErC,WAAK,kBAAkB,UAAU,QAAS,KAAK,QAAQ,CAAE;AAEzD,WAAK,YAAY,KAAK,gBAAgB;AAEtC,WAAK,iBAAiB,IAAI,uBAAAC,QAAgB,KAAK,SAAS,SAAU;AAAA,IACnE;AAAA,IAEA,UAAW,UAAW;AACrB,WAAK,YAAY,IAAK,QAAS;AAE/B,aAAO,MAAM;AACZ,aAAK,YAAY,OAAQ,QAAS;AAAA,MACnC;AAAA,IACD;AAAA,IAEA,wBAAyB,UAAU,MAAO;AACzC,UAAK,CAAE,KAAK,WAAY;AAEvB,YAAK,CAAE,UAAW;AACjB,oCAAU,aAAAC,KAAsB,EAAE;AAAA,YACjC;AAAA,UACD;AAAA,QACD;AAEA,aAAK,YAAY;AAAA,UAAS,CAAE,eAC3B,WAAY,UAAU,IAAK;AAAA,QAC5B;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;",
6
+ "names": ["getInserterOuterSection", "SidebarAdapter", "customizeWidgetsStore"]
7
+ }
@@ -1,42 +1,68 @@
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 sidebar_section_exports = {};
29
+ __export(sidebar_section_exports, {
30
+ default: () => getSidebarSection
6
31
  });
7
- exports.default = getSidebarSection;
8
- var _i18n = require("@wordpress/i18n");
9
- var _inspectorSection = _interopRequireDefault(require("./inspector-section"));
10
- /**
11
- * WordPress dependencies
12
- */
13
-
14
- /**
15
- * Internal dependencies
16
- */
17
-
18
- const getInspectorSectionId = sidebarId => `widgets-inspector-${sidebarId}`;
32
+ module.exports = __toCommonJS(sidebar_section_exports);
33
+ var import_i18n = require("@wordpress/i18n");
34
+ var import_inspector_section = __toESM(require("./inspector-section"));
35
+ const getInspectorSectionId = (sidebarId) => `widgets-inspector-${sidebarId}`;
19
36
  function getSidebarSection() {
20
37
  const {
21
- wp: {
22
- customize
23
- }
38
+ wp: { customize }
24
39
  } = window;
25
- const reduceMotionMediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
40
+ const reduceMotionMediaQuery = window.matchMedia(
41
+ "(prefers-reduced-motion: reduce)"
42
+ );
26
43
  let isReducedMotion = reduceMotionMediaQuery.matches;
27
- reduceMotionMediaQuery.addEventListener('change', event => {
44
+ reduceMotionMediaQuery.addEventListener("change", (event) => {
28
45
  isReducedMotion = event.matches;
29
46
  });
30
47
  return class SidebarSection extends customize.Section {
31
48
  ready() {
32
- const InspectorSection = (0, _inspectorSection.default)();
33
- this.inspector = new InspectorSection(getInspectorSectionId(this.id), {
34
- title: (0, _i18n.__)('Block Settings'),
35
- parentSection: this,
36
- customizeAction: [(0, _i18n.__)('Customizing'), (0, _i18n.__)('Widgets'), this.params.title].join(' ▸ ')
37
- });
49
+ const InspectorSection = (0, import_inspector_section.default)();
50
+ this.inspector = new InspectorSection(
51
+ getInspectorSectionId(this.id),
52
+ {
53
+ title: (0, import_i18n.__)("Block Settings"),
54
+ parentSection: this,
55
+ customizeAction: [
56
+ (0, import_i18n.__)("Customizing"),
57
+ (0, import_i18n.__)("Widgets"),
58
+ this.params.title
59
+ ].join(" \u25B8 ")
60
+ }
61
+ );
38
62
  customize.section.add(this.inspector);
39
- this.contentContainer[0].classList.add('customize-widgets__sidebar-section');
63
+ this.contentContainer[0].classList.add(
64
+ "customize-widgets__sidebar-section"
65
+ );
40
66
  }
41
67
  hasSubSectionOpened() {
42
68
  return this.inspector.expanded();
@@ -46,7 +72,7 @@ function getSidebarSection() {
46
72
  const args = {
47
73
  ..._args,
48
74
  completeCallback() {
49
- controls.forEach(control => {
75
+ controls.forEach((control) => {
50
76
  control.onChangeSectionExpanded?.(expanded, args);
51
77
  });
52
78
  _args.completeCallback?.();
@@ -54,22 +80,28 @@ function getSidebarSection() {
54
80
  };
55
81
  if (args.manualTransition) {
56
82
  if (expanded) {
57
- this.contentContainer.addClass(['busy', 'open']);
58
- this.contentContainer.removeClass('is-sub-section-open');
59
- this.contentContainer.closest('.wp-full-overlay').addClass('section-open');
83
+ this.contentContainer.addClass(["busy", "open"]);
84
+ this.contentContainer.removeClass("is-sub-section-open");
85
+ this.contentContainer.closest(".wp-full-overlay").addClass("section-open");
60
86
  } else {
61
- this.contentContainer.addClass(['busy', 'is-sub-section-open']);
62
- this.contentContainer.closest('.wp-full-overlay').addClass('section-open');
63
- this.contentContainer.removeClass('open');
87
+ this.contentContainer.addClass([
88
+ "busy",
89
+ "is-sub-section-open"
90
+ ]);
91
+ this.contentContainer.closest(".wp-full-overlay").addClass("section-open");
92
+ this.contentContainer.removeClass("open");
64
93
  }
65
94
  const handleTransitionEnd = () => {
66
- this.contentContainer.removeClass('busy');
95
+ this.contentContainer.removeClass("busy");
67
96
  args.completeCallback();
68
97
  };
69
98
  if (isReducedMotion) {
70
99
  handleTransitionEnd();
71
100
  } else {
72
- this.contentContainer.one('transitionend', handleTransitionEnd);
101
+ this.contentContainer.one(
102
+ "transitionend",
103
+ handleTransitionEnd
104
+ );
73
105
  }
74
106
  } else {
75
107
  super.onChangeExpanded(expanded, args);
@@ -77,4 +109,4 @@ function getSidebarSection() {
77
109
  }
78
110
  };
79
111
  }
80
- //# sourceMappingURL=sidebar-section.js.map
112
+ //# sourceMappingURL=sidebar-section.js.map