PluginProbe
Gutenberg / 14.7.0
Gutenberg v14.7.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
gutenberg / build / customize-widgets / index.js

index.js in Gutenberg 14.7.0, at build/customize-widgets/index.js

3,189 lines 104.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (function() { // webpackBootstrap
2 /******/ var __webpack_modules__ = ({
3
4 /***/ 4403:
5 /***/ (function(module, exports) {
6
7 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
8 Copyright (c) 2018 Jed Watson.
9 Licensed under the MIT License (MIT), see
10 http://jedwatson.github.io/classnames
11 */
12 /* global define */
13
14 (function () {
15 'use strict';
16
17 var hasOwn = {}.hasOwnProperty;
18
19 function classNames() {
20 var classes = [];
21
22 for (var i = 0; i < arguments.length; i++) {
23 var arg = arguments[i];
24 if (!arg) continue;
25
26 var argType = typeof arg;
27
28 if (argType === 'string' || argType === 'number') {
29 classes.push(arg);
30 } else if (Array.isArray(arg)) {
31 if (arg.length) {
32 var inner = classNames.apply(null, arg);
33 if (inner) {
34 classes.push(inner);
35 }
36 }
37 } else if (argType === 'object') {
38 if (arg.toString === Object.prototype.toString) {
39 for (var key in arg) {
40 if (hasOwn.call(arg, key) && arg[key]) {
41 classes.push(key);
42 }
43 }
44 } else {
45 classes.push(arg.toString());
46 }
47 }
48 }
49
50 return classes.join(' ');
51 }
52
53 if ( true && module.exports) {
54 classNames.default = classNames;
55 module.exports = classNames;
56 } else if (true) {
57 // register as 'classnames', consistent with npm package name
58 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
59 return classNames;
60 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
61 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
62 } else {}
63 }());
64
65
66 /***/ })
67
68 /******/ });
69 /************************************************************************/
70 /******/ // The module cache
71 /******/ var __webpack_module_cache__ = {};
72 /******/
73 /******/ // The require function
74 /******/ function __webpack_require__(moduleId) {
75 /******/ // Check if module is in cache
76 /******/ var cachedModule = __webpack_module_cache__[moduleId];
77 /******/ if (cachedModule !== undefined) {
78 /******/ return cachedModule.exports;
79 /******/ }
80 /******/ // Create a new module (and put it into the cache)
81 /******/ var module = __webpack_module_cache__[moduleId] = {
82 /******/ // no module.id needed
83 /******/ // no module.loaded needed
84 /******/ exports: {}
85 /******/ };
86 /******/
87 /******/ // Execute the module function
88 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
89 /******/
90 /******/ // Return the exports of the module
91 /******/ return module.exports;
92 /******/ }
93 /******/
94 /************************************************************************/
95 /******/ /* webpack/runtime/compat get default export */
96 /******/ !function() {
97 /******/ // getDefaultExport function for compatibility with non-harmony modules
98 /******/ __webpack_require__.n = function(module) {
99 /******/ var getter = module && module.__esModule ?
100 /******/ function() { return module['default']; } :
101 /******/ function() { return module; };
102 /******/ __webpack_require__.d(getter, { a: getter });
103 /******/ return getter;
104 /******/ };
105 /******/ }();
106 /******/
107 /******/ /* webpack/runtime/define property getters */
108 /******/ !function() {
109 /******/ // define getter functions for harmony exports
110 /******/ __webpack_require__.d = function(exports, definition) {
111 /******/ for(var key in definition) {
112 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
113 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
114 /******/ }
115 /******/ }
116 /******/ };
117 /******/ }();
118 /******/
119 /******/ /* webpack/runtime/hasOwnProperty shorthand */
120 /******/ !function() {
121 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
122 /******/ }();
123 /******/
124 /******/ /* webpack/runtime/make namespace object */
125 /******/ !function() {
126 /******/ // define __esModule on exports
127 /******/ __webpack_require__.r = function(exports) {
128 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
129 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
130 /******/ }
131 /******/ Object.defineProperty(exports, '__esModule', { value: true });
132 /******/ };
133 /******/ }();
134 /******/
135 /************************************************************************/
136 var __webpack_exports__ = {};
137 // This entry need to be wrapped in an IIFE because it need to be in strict mode.
138 !function() {
139 "use strict";
140 // ESM COMPAT FLAG
141 __webpack_require__.r(__webpack_exports__);
142
143 // EXPORTS
144 __webpack_require__.d(__webpack_exports__, {
145 "initialize": function() { return /* binding */ initialize; }
146 });
147
148 // NAMESPACE OBJECT: ./packages/customize-widgets/build-module/store/selectors.js
149 var selectors_namespaceObject = {};
150 __webpack_require__.r(selectors_namespaceObject);
151 __webpack_require__.d(selectors_namespaceObject, {
152 "__experimentalGetInsertionPoint": function() { return __experimentalGetInsertionPoint; },
153 "isInserterOpened": function() { return isInserterOpened; }
154 });
155
156 // NAMESPACE OBJECT: ./packages/customize-widgets/build-module/store/actions.js
157 var actions_namespaceObject = {};
158 __webpack_require__.r(actions_namespaceObject);
159 __webpack_require__.d(actions_namespaceObject, {
160 "setIsInserterOpened": function() { return setIsInserterOpened; }
161 });
162
163 // NAMESPACE OBJECT: ./packages/interface/build-module/store/actions.js
164 var store_actions_namespaceObject = {};
165 __webpack_require__.r(store_actions_namespaceObject);
166 __webpack_require__.d(store_actions_namespaceObject, {
167 "disableComplementaryArea": function() { return disableComplementaryArea; },
168 "enableComplementaryArea": function() { return enableComplementaryArea; },
169 "pinItem": function() { return pinItem; },
170 "setDefaultComplementaryArea": function() { return setDefaultComplementaryArea; },
171 "setFeatureDefaults": function() { return setFeatureDefaults; },
172 "setFeatureValue": function() { return setFeatureValue; },
173 "toggleFeature": function() { return toggleFeature; },
174 "unpinItem": function() { return unpinItem; }
175 });
176
177 // NAMESPACE OBJECT: ./packages/interface/build-module/store/selectors.js
178 var store_selectors_namespaceObject = {};
179 __webpack_require__.r(store_selectors_namespaceObject);
180 __webpack_require__.d(store_selectors_namespaceObject, {
181 "getActiveComplementaryArea": function() { return getActiveComplementaryArea; },
182 "isFeatureActive": function() { return isFeatureActive; },
183 "isItemPinned": function() { return isItemPinned; }
184 });
185
186 ;// CONCATENATED MODULE: external ["wp","element"]
187 var external_wp_element_namespaceObject = window["wp"]["element"];
188 ;// CONCATENATED MODULE: external ["wp","blockLibrary"]
189 var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"];
190 ;// CONCATENATED MODULE: external ["wp","widgets"]
191 var external_wp_widgets_namespaceObject = window["wp"]["widgets"];
192 ;// CONCATENATED MODULE: external ["wp","blocks"]
193 var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
194 ;// CONCATENATED MODULE: external ["wp","data"]
195 var external_wp_data_namespaceObject = window["wp"]["data"];
196 ;// CONCATENATED MODULE: external ["wp","preferences"]
197 var external_wp_preferences_namespaceObject = window["wp"]["preferences"];
198 ;// CONCATENATED MODULE: external ["wp","components"]
199 var external_wp_components_namespaceObject = window["wp"]["components"];
200 ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
201 var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
202 ;// CONCATENATED MODULE: external ["wp","i18n"]
203 var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
204 ;// CONCATENATED MODULE: external ["wp","blockEditor"]
205 var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
206 ;// CONCATENATED MODULE: external ["wp","compose"]
207 var external_wp_compose_namespaceObject = window["wp"]["compose"];
208 ;// CONCATENATED MODULE: external ["wp","hooks"]
209 var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
210 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/error-boundary/index.js
211
212
213 /**
214 * WordPress dependencies
215 */
216
217
218
219
220
221
222
223 function CopyButton(_ref) {
224 let {
225 text,
226 children
227 } = _ref;
228 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
229 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
230 variant: "secondary",
231 ref: ref
232 }, children);
233 }
234
235 class ErrorBoundary extends external_wp_element_namespaceObject.Component {
236 constructor() {
237 super(...arguments);
238 this.state = {
239 error: null
240 };
241 }
242
243 componentDidCatch(error) {
244 this.setState({
245 error
246 });
247 (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error);
248 }
249
250 render() {
251 const {
252 error
253 } = this.state;
254
255 if (!error) {
256 return this.props.children;
257 }
258
259 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
260 className: "customize-widgets-error-boundary",
261 actions: [(0,external_wp_element_namespaceObject.createElement)(CopyButton, {
262 key: "copy-error",
263 text: error.stack
264 }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))]
265 }, (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'));
266 }
267
268 }
269
270 ;// CONCATENATED MODULE: external ["wp","coreData"]
271 var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
272 ;// CONCATENATED MODULE: external ["wp","mediaUtils"]
273 var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
274 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
275 function _extends() {
276 _extends = Object.assign || function (target) {
277 for (var i = 1; i < arguments.length; i++) {
278 var source = arguments[i];
279
280 for (var key in source) {
281 if (Object.prototype.hasOwnProperty.call(source, key)) {
282 target[key] = source[key];
283 }
284 }
285 }
286
287 return target;
288 };
289
290 return _extends.apply(this, arguments);
291 }
292 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/block-inspector-button/index.js
293
294
295
296 /**
297 * WordPress dependencies
298 */
299
300
301
302
303
304
305 function BlockInspectorButton(_ref) {
306 let {
307 inspector,
308 closeMenu,
309 ...props
310 } = _ref;
311 const selectedBlockClientId = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSelectedBlockClientId(), []);
312 const selectedBlock = (0,external_wp_element_namespaceObject.useMemo)(() => document.getElementById(`block-${selectedBlockClientId}`), [selectedBlockClientId]);
313 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, _extends({
314 onClick: () => {
315 // Open the inspector.
316 inspector.open({
317 returnFocusWhenClose: selectedBlock
318 }); // Then close the dropdown menu.
319
320 closeMenu();
321 }
322 }, props), (0,external_wp_i18n_namespaceObject.__)('Show more settings'));
323 }
324
325 /* harmony default export */ var block_inspector_button = (BlockInspectorButton);
326
327 // EXTERNAL MODULE: ./node_modules/classnames/index.js
328 var classnames = __webpack_require__(4403);
329 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
330 ;// CONCATENATED MODULE: external ["wp","keycodes"]
331 var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
332 ;// CONCATENATED MODULE: external ["wp","primitives"]
333 var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
334 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/undo.js
335
336
337 /**
338 * WordPress dependencies
339 */
340
341 const undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
342 xmlns: "http://www.w3.org/2000/svg",
343 viewBox: "0 0 24 24"
344 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
345 d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"
346 }));
347 /* harmony default export */ var library_undo = (undo);
348
349 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/redo.js
350
351
352 /**
353 * WordPress dependencies
354 */
355
356 const redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
357 xmlns: "http://www.w3.org/2000/svg",
358 viewBox: "0 0 24 24"
359 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
360 d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"
361 }));
362 /* harmony default export */ var library_redo = (redo);
363
364 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/plus.js
365
366
367 /**
368 * WordPress dependencies
369 */
370
371 const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
372 xmlns: "http://www.w3.org/2000/svg",
373 viewBox: "0 0 24 24"
374 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
375 d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
376 }));
377 /* harmony default export */ var library_plus = (plus);
378
379 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/close-small.js
380
381
382 /**
383 * WordPress dependencies
384 */
385
386 const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
387 xmlns: "http://www.w3.org/2000/svg",
388 viewBox: "0 0 24 24"
389 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
390 d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
391 }));
392 /* harmony default export */ var close_small = (closeSmall);
393
394 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/store/reducer.js
395 /**
396 * WordPress dependencies
397 */
398
399 /**
400 * Reducer tracking whether the inserter is open.
401 *
402 * @param {boolean|Object} state
403 * @param {Object} action
404 */
405
406 function blockInserterPanel() {
407 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
408 let action = arguments.length > 1 ? arguments[1] : undefined;
409
410 switch (action.type) {
411 case 'SET_IS_INSERTER_OPENED':
412 return action.value;
413 }
414
415 return state;
416 }
417
418 /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
419 blockInserterPanel
420 }));
421
422 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/store/selectors.js
423 /**
424 * Returns true if the inserter is opened.
425 *
426 * @param {Object} state Global application state.
427 *
428 * @return {boolean} Whether the inserter is opened.
429 */
430 function isInserterOpened(state) {
431 return !!state.blockInserterPanel;
432 }
433 /**
434 * Get the insertion point for the inserter.
435 *
436 * @param {Object} state Global application state.
437 *
438 * @return {Object} The root client ID and index to insert at.
439 */
440
441 function __experimentalGetInsertionPoint(state) {
442 const {
443 rootClientId,
444 insertionIndex
445 } = state.blockInserterPanel;
446 return {
447 rootClientId,
448 insertionIndex
449 };
450 }
451
452 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/store/actions.js
453 /**
454 * Returns an action object used to open/close the inserter.
455 *
456 * @param {boolean|Object} value Whether the inserter should be
457 * opened (true) or closed (false).
458 * To specify an insertion point,
459 * use an object.
460 * @param {string} value.rootClientId The root client ID to insert at.
461 * @param {number} value.insertionIndex The index to insert at.
462 *
463 * @return {Object} Action object.
464 */
465 function setIsInserterOpened(value) {
466 return {
467 type: 'SET_IS_INSERTER_OPENED',
468 value
469 };
470 }
471
472 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/store/constants.js
473 /**
474 * Module Constants
475 */
476 const STORE_NAME = 'core/customize-widgets';
477
478 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/store/index.js
479 /**
480 * WordPress dependencies
481 */
482
483 /**
484 * Internal dependencies
485 */
486
487
488
489
490
491 /**
492 * Block editor data store configuration.
493 *
494 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registering-a-store
495 *
496 * @type {Object}
497 */
498
499 const storeConfig = {
500 reducer: reducer,
501 selectors: selectors_namespaceObject,
502 actions: actions_namespaceObject
503 };
504 /**
505 * Store definition for the edit widgets namespace.
506 *
507 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
508 *
509 * @type {Object}
510 */
511
512 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig);
513 (0,external_wp_data_namespaceObject.register)(store);
514
515 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/inserter/index.js
516
517
518 /**
519 * WordPress dependencies
520 */
521
522
523
524
525
526
527 /**
528 * Internal dependencies
529 */
530
531
532
533 function Inserter(_ref) {
534 let {
535 setIsOpened
536 } = _ref;
537 const inserterTitleId = (0,external_wp_compose_namespaceObject.useInstanceId)(Inserter, 'customize-widget-layout__inserter-panel-title');
538 const insertionPoint = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).__experimentalGetInsertionPoint(), []);
539 return (0,external_wp_element_namespaceObject.createElement)("div", {
540 className: "customize-widgets-layout__inserter-panel",
541 "aria-labelledby": inserterTitleId
542 }, (0,external_wp_element_namespaceObject.createElement)("div", {
543 className: "customize-widgets-layout__inserter-panel-header"
544 }, (0,external_wp_element_namespaceObject.createElement)("h2", {
545 id: inserterTitleId,
546 className: "customize-widgets-layout__inserter-panel-header-title"
547 }, (0,external_wp_i18n_namespaceObject.__)('Add a block')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
548 className: "customize-widgets-layout__inserter-panel-header-close-button",
549 icon: close_small,
550 onClick: () => setIsOpened(false),
551 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Close inserter')
552 })), (0,external_wp_element_namespaceObject.createElement)("div", {
553 className: "customize-widgets-layout__inserter-panel-content"
554 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, {
555 rootClientId: insertionPoint.rootClientId,
556 __experimentalInsertionIndex: insertionPoint.insertionIndex,
557 showInserterHelpPanel: true,
558 onSelect: () => setIsOpened(false)
559 })));
560 }
561
562 /* harmony default export */ var components_inserter = (Inserter);
563
564 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/external.js
565
566
567 /**
568 * WordPress dependencies
569 */
570
571 const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
572 xmlns: "http://www.w3.org/2000/svg",
573 viewBox: "0 0 24 24"
574 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
575 d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"
576 }));
577 /* harmony default export */ var library_external = (external);
578
579 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/more-vertical.js
580
581
582 /**
583 * WordPress dependencies
584 */
585
586 const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
587 xmlns: "http://www.w3.org/2000/svg",
588 viewBox: "0 0 24 24"
589 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
590 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
591 }));
592 /* harmony default export */ var more_vertical = (moreVertical);
593
594 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/more-menu-dropdown/index.js
595
596
597 /**
598 * External dependencies
599 */
600
601 /**
602 * WordPress dependencies
603 */
604
605
606
607
608 function MoreMenuDropdown(_ref) {
609 let {
610 as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu,
611 className,
612
613 /* translators: button label text should, if possible, be under 16 characters. */
614 label = (0,external_wp_i18n_namespaceObject.__)('Options'),
615 popoverProps,
616 toggleProps,
617 children
618 } = _ref;
619 return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, {
620 className: classnames_default()('interface-more-menu-dropdown', className),
621 icon: more_vertical,
622 label: label,
623 popoverProps: {
624 position: 'bottom left',
625 ...popoverProps,
626 className: classnames_default()('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className)
627 },
628 toggleProps: {
629 tooltipPosition: 'bottom',
630 ...toggleProps
631 }
632 }, onClose => children(onClose));
633 }
634
635 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/index.js
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650 ;// CONCATENATED MODULE: external ["wp","deprecated"]
651 var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
652 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
653 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/actions.js
654 /**
655 * WordPress dependencies
656 */
657
658
659 /**
660 * Set a default complementary area.
661 *
662 * @param {string} scope Complementary area scope.
663 * @param {string} area Area identifier.
664 *
665 * @return {Object} Action object.
666 */
667
668 const setDefaultComplementaryArea = (scope, area) => ({
669 type: 'SET_DEFAULT_COMPLEMENTARY_AREA',
670 scope,
671 area
672 });
673 /**
674 * Enable the complementary area.
675 *
676 * @param {string} scope Complementary area scope.
677 * @param {string} area Area identifier.
678 */
679
680 const enableComplementaryArea = (scope, area) => _ref => {
681 let {
682 registry,
683 dispatch
684 } = _ref;
685
686 // Return early if there's no area.
687 if (!area) {
688 return;
689 }
690
691 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
692
693 if (!isComplementaryAreaVisible) {
694 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true);
695 }
696
697 dispatch({
698 type: 'ENABLE_COMPLEMENTARY_AREA',
699 scope,
700 area
701 });
702 };
703 /**
704 * Disable the complementary area.
705 *
706 * @param {string} scope Complementary area scope.
707 */
708
709 const disableComplementaryArea = scope => _ref2 => {
710 let {
711 registry
712 } = _ref2;
713 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
714
715 if (isComplementaryAreaVisible) {
716 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false);
717 }
718 };
719 /**
720 * Pins an item.
721 *
722 * @param {string} scope Item scope.
723 * @param {string} item Item identifier.
724 *
725 * @return {Object} Action object.
726 */
727
728 const pinItem = (scope, item) => _ref3 => {
729 let {
730 registry
731 } = _ref3;
732
733 // Return early if there's no item.
734 if (!item) {
735 return;
736 }
737
738 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do.
739
740 if ((pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) === true) {
741 return;
742 }
743
744 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
745 [item]: true
746 });
747 };
748 /**
749 * Unpins an item.
750 *
751 * @param {string} scope Item scope.
752 * @param {string} item Item identifier.
753 */
754
755 const unpinItem = (scope, item) => _ref4 => {
756 let {
757 registry
758 } = _ref4;
759
760 // Return early if there's no item.
761 if (!item) {
762 return;
763 }
764
765 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
766 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
767 [item]: false
768 });
769 };
770 /**
771 * Returns an action object used in signalling that a feature should be toggled.
772 *
773 * @param {string} scope The feature scope (e.g. core/edit-post).
774 * @param {string} featureName The feature name.
775 */
776
777 function toggleFeature(scope, featureName) {
778 return function (_ref5) {
779 let {
780 registry
781 } = _ref5;
782 external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, {
783 since: '6.0',
784 alternative: `dispatch( 'core/preferences' ).toggle`
785 });
786 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName);
787 };
788 }
789 /**
790 * Returns an action object used in signalling that a feature should be set to
791 * a true or false value
792 *
793 * @param {string} scope The feature scope (e.g. core/edit-post).
794 * @param {string} featureName The feature name.
795 * @param {boolean} value The value to set.
796 *
797 * @return {Object} Action object.
798 */
799
800 function setFeatureValue(scope, featureName, value) {
801 return function (_ref6) {
802 let {
803 registry
804 } = _ref6;
805 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, {
806 since: '6.0',
807 alternative: `dispatch( 'core/preferences' ).set`
808 });
809 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value);
810 };
811 }
812 /**
813 * Returns an action object used in signalling that defaults should be set for features.
814 *
815 * @param {string} scope The feature scope (e.g. core/edit-post).
816 * @param {Object<string, boolean>} defaults A key/value map of feature names to values.
817 *
818 * @return {Object} Action object.
819 */
820
821 function setFeatureDefaults(scope, defaults) {
822 return function (_ref7) {
823 let {
824 registry
825 } = _ref7;
826 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, {
827 since: '6.0',
828 alternative: `dispatch( 'core/preferences' ).setDefaults`
829 });
830 registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults);
831 };
832 }
833
834 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/selectors.js
835 /**
836 * WordPress dependencies
837 */
838
839
840
841 /**
842 * Returns the complementary area that is active in a given scope.
843 *
844 * @param {Object} state Global application state.
845 * @param {string} scope Item scope.
846 *
847 * @return {string | null | undefined} The complementary area that is active in the given scope.
848 */
849
850 const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
851 var _state$complementaryA;
852
853 const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); // Return `undefined` to indicate that the user has never toggled
854 // visibility, this is the vanilla default. Other code relies on this
855 // nuance in the return value.
856
857 if (isComplementaryAreaVisible === undefined) {
858 return undefined;
859 } // Return `null` to indicate the user hid the complementary area.
860
861
862 if (!isComplementaryAreaVisible) {
863 return null;
864 }
865
866 return state === null || state === void 0 ? void 0 : (_state$complementaryA = state.complementaryAreas) === null || _state$complementaryA === void 0 ? void 0 : _state$complementaryA[scope];
867 });
868 /**
869 * Returns a boolean indicating if an item is pinned or not.
870 *
871 * @param {Object} state Global application state.
872 * @param {string} scope Scope.
873 * @param {string} item Item to check.
874 *
875 * @return {boolean} True if the item is pinned and false otherwise.
876 */
877
878 const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => {
879 var _pinnedItems$item;
880
881 const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
882 return (_pinnedItems$item = pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
883 });
884 /**
885 * Returns a boolean indicating whether a feature is active for a particular
886 * scope.
887 *
888 * @param {Object} state The store state.
889 * @param {string} scope The scope of the feature (e.g. core/edit-post).
890 * @param {string} featureName The name of the feature.
891 *
892 * @return {boolean} Is the feature enabled?
893 */
894
895 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => {
896 external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
897 since: '6.0',
898 alternative: `select( 'core/preferences' ).get( scope, featureName )`
899 });
900 return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName);
901 });
902
903 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/reducer.js
904 /**
905 * WordPress dependencies
906 */
907
908 function complementaryAreas() {
909 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
910 let action = arguments.length > 1 ? arguments[1] : undefined;
911
912 switch (action.type) {
913 case 'SET_DEFAULT_COMPLEMENTARY_AREA':
914 {
915 const {
916 scope,
917 area
918 } = action; // If there's already an area, don't overwrite it.
919
920 if (state[scope]) {
921 return state;
922 }
923
924 return { ...state,
925 [scope]: area
926 };
927 }
928
929 case 'ENABLE_COMPLEMENTARY_AREA':
930 {
931 const {
932 scope,
933 area
934 } = action;
935 return { ...state,
936 [scope]: area
937 };
938 }
939 }
940
941 return state;
942 }
943 /* harmony default export */ var store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
944 complementaryAreas
945 }));
946
947 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/constants.js
948 /**
949 * The identifier for the data store.
950 *
951 * @type {string}
952 */
953 const constants_STORE_NAME = 'core/interface';
954
955 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/index.js
956 /**
957 * WordPress dependencies
958 */
959
960 /**
961 * Internal dependencies
962 */
963
964
965
966
967
968 /**
969 * Store definition for the interface namespace.
970 *
971 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
972 *
973 * @type {Object}
974 */
975
976 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, {
977 reducer: store_reducer,
978 actions: store_actions_namespaceObject,
979 selectors: store_selectors_namespaceObject
980 }); // Once we build a more generic persistence plugin that works across types of stores
981 // we'd be able to replace this with a register call.
982
983 (0,external_wp_data_namespaceObject.register)(store_store);
984
985 ;// CONCATENATED MODULE: ./packages/interface/build-module/index.js
986
987
988
989 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/config.js
990 /**
991 * WordPress dependencies
992 */
993
994 const textFormattingShortcuts = [{
995 keyCombination: {
996 modifier: 'primary',
997 character: 'b'
998 },
999 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.')
1000 }, {
1001 keyCombination: {
1002 modifier: 'primary',
1003 character: 'i'
1004 },
1005 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.')
1006 }, {
1007 keyCombination: {
1008 modifier: 'primary',
1009 character: 'k'
1010 },
1011 description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.')
1012 }, {
1013 keyCombination: {
1014 modifier: 'primaryShift',
1015 character: 'k'
1016 },
1017 description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.')
1018 }, {
1019 keyCombination: {
1020 character: '[['
1021 },
1022 description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page')
1023 }, {
1024 keyCombination: {
1025 modifier: 'primary',
1026 character: 'u'
1027 },
1028 description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.')
1029 }, {
1030 keyCombination: {
1031 modifier: 'access',
1032 character: 'd'
1033 },
1034 description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.')
1035 }, {
1036 keyCombination: {
1037 modifier: 'access',
1038 character: 'x'
1039 },
1040 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.')
1041 }];
1042
1043 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.js
1044
1045
1046 /**
1047 * WordPress dependencies
1048 */
1049
1050
1051
1052 function KeyCombination(_ref) {
1053 let {
1054 keyCombination,
1055 forceAriaLabel
1056 } = _ref;
1057 const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
1058 const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
1059 return (0,external_wp_element_namespaceObject.createElement)("kbd", {
1060 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination",
1061 "aria-label": forceAriaLabel || ariaLabel
1062 }, (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => {
1063 if (character === '+') {
1064 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, {
1065 key: index
1066 }, character);
1067 }
1068
1069 return (0,external_wp_element_namespaceObject.createElement)("kbd", {
1070 key: index,
1071 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key"
1072 }, character);
1073 }));
1074 }
1075
1076 function Shortcut(_ref2) {
1077 let {
1078 description,
1079 keyCombination,
1080 aliases = [],
1081 ariaLabel
1082 } = _ref2;
1083 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
1084 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-description"
1085 }, description), (0,external_wp_element_namespaceObject.createElement)("div", {
1086 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-term"
1087 }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
1088 keyCombination: keyCombination,
1089 forceAriaLabel: ariaLabel
1090 }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
1091 keyCombination: alias,
1092 forceAriaLabel: ariaLabel,
1093 key: index
1094 }))));
1095 }
1096
1097 /* harmony default export */ var keyboard_shortcut_help_modal_shortcut = (Shortcut);
1098
1099 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js
1100
1101
1102 /**
1103 * WordPress dependencies
1104 */
1105
1106
1107 /**
1108 * Internal dependencies
1109 */
1110
1111
1112
1113 function DynamicShortcut(_ref) {
1114 let {
1115 name
1116 } = _ref;
1117 const {
1118 keyCombination,
1119 description,
1120 aliases
1121 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
1122 const {
1123 getShortcutKeyCombination,
1124 getShortcutDescription,
1125 getShortcutAliases
1126 } = select(external_wp_keyboardShortcuts_namespaceObject.store);
1127 return {
1128 keyCombination: getShortcutKeyCombination(name),
1129 aliases: getShortcutAliases(name),
1130 description: getShortcutDescription(name)
1131 };
1132 }, [name]);
1133
1134 if (!keyCombination) {
1135 return null;
1136 }
1137
1138 return (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, {
1139 keyCombination: keyCombination,
1140 description: description,
1141 aliases: aliases
1142 });
1143 }
1144
1145 /* harmony default export */ var dynamic_shortcut = (DynamicShortcut);
1146
1147 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/index.js
1148
1149
1150 /**
1151 * External dependencies
1152 */
1153
1154 /**
1155 * WordPress dependencies
1156 */
1157
1158
1159
1160
1161
1162 /**
1163 * Internal dependencies
1164 */
1165
1166
1167
1168
1169
1170 const ShortcutList = _ref => {
1171 let {
1172 shortcuts
1173 } = _ref;
1174 return (
1175 /*
1176 * Disable reason: The `list` ARIA role is redundant but
1177 * Safari+VoiceOver won't announce the list otherwise.
1178 */
1179
1180 /* eslint-disable jsx-a11y/no-redundant-roles */
1181 (0,external_wp_element_namespaceObject.createElement)("ul", {
1182 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-list",
1183 role: "list"
1184 }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", {
1185 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut",
1186 key: index
1187 }, typeof shortcut === 'string' ? (0,external_wp_element_namespaceObject.createElement)(dynamic_shortcut, {
1188 name: shortcut
1189 }) : (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, shortcut))))
1190 /* eslint-enable jsx-a11y/no-redundant-roles */
1191
1192 );
1193 };
1194
1195 const ShortcutSection = _ref2 => {
1196 let {
1197 title,
1198 shortcuts,
1199 className
1200 } = _ref2;
1201 return (0,external_wp_element_namespaceObject.createElement)("section", {
1202 className: classnames_default()('customize-widgets-keyboard-shortcut-help-modal__section', className)
1203 }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", {
1204 className: "customize-widgets-keyboard-shortcut-help-modal__section-title"
1205 }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, {
1206 shortcuts: shortcuts
1207 }));
1208 };
1209
1210 const ShortcutCategorySection = _ref3 => {
1211 let {
1212 title,
1213 categoryName,
1214 additionalShortcuts = []
1215 } = _ref3;
1216 const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
1217 return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName);
1218 }, [categoryName]);
1219 return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
1220 title: title,
1221 shortcuts: categoryShortcuts.concat(additionalShortcuts)
1222 });
1223 };
1224
1225 function KeyboardShortcutHelpModal(_ref4) {
1226 let {
1227 isModalActive,
1228 toggleModal
1229 } = _ref4;
1230 const {
1231 registerShortcut
1232 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
1233 registerShortcut({
1234 name: 'core/customize-widgets/keyboard-shortcuts',
1235 category: 'main',
1236 description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'),
1237 keyCombination: {
1238 modifier: 'access',
1239 character: 'h'
1240 }
1241 });
1242 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/keyboard-shortcuts', toggleModal);
1243
1244 if (!isModalActive) {
1245 return null;
1246 }
1247
1248 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
1249 className: "customize-widgets-keyboard-shortcut-help-modal",
1250 title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
1251 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
1252 onRequestClose: toggleModal
1253 }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
1254 className: "customize-widgets-keyboard-shortcut-help-modal__main-shortcuts",
1255 shortcuts: ['core/customize-widgets/keyboard-shortcuts']
1256 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
1257 title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'),
1258 categoryName: "global"
1259 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
1260 title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'),
1261 categoryName: "selection"
1262 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
1263 title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'),
1264 categoryName: "block",
1265 additionalShortcuts: [{
1266 keyCombination: {
1267 character: '/'
1268 },
1269 description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'),
1270
1271 /* translators: The forward-slash character. e.g. '/'. */
1272 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash')
1273 }]
1274 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
1275 title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'),
1276 shortcuts: textFormattingShortcuts
1277 }));
1278 }
1279
1280 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/more-menu/index.js
1281
1282
1283 /**
1284 * WordPress dependencies
1285 */
1286
1287
1288
1289
1290
1291
1292
1293
1294 /**
1295 * Internal dependencies
1296 */
1297
1298
1299 function MoreMenu() {
1300 const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = (0,external_wp_element_namespaceObject.useState)(false);
1301
1302 const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive);
1303
1304 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal);
1305 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, {
1306 as: external_wp_components_namespaceObject.ToolbarDropdownMenu
1307 }, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
1308 label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun')
1309 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
1310 scope: "core/customize-widgets",
1311 name: "fixedToolbar",
1312 label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'),
1313 info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'),
1314 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'),
1315 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated')
1316 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
1317 label: (0,external_wp_i18n_namespaceObject.__)('Tools')
1318 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
1319 onClick: () => {
1320 setIsKeyboardShortcutsModalVisible(true);
1321 },
1322 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h')
1323 }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
1324 scope: "core/customize-widgets",
1325 name: "welcomeGuide",
1326 label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide')
1327 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
1328 role: "menuitem",
1329 icon: library_external,
1330 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/block-based-widgets-editor/'),
1331 target: "_blank",
1332 rel: "noopener noreferrer"
1333 }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
1334 as: "span"
1335 },
1336 /* translators: accessibility text */
1337 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
1338 label: (0,external_wp_i18n_namespaceObject.__)('Preferences')
1339 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
1340 scope: "core/customize-widgets",
1341 name: "keepCaretInsideBlock",
1342 label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block'),
1343 info: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'),
1344 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block activated'),
1345 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block deactivated')
1346 })))), (0,external_wp_element_namespaceObject.createElement)(KeyboardShortcutHelpModal, {
1347 isModalActive: isKeyboardShortcutsModalActive,
1348 toggleModal: toggleKeyboardShortcutsModal
1349 }));
1350 }
1351
1352 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/header/index.js
1353
1354
1355 /**
1356 * External dependencies
1357 */
1358
1359 /**
1360 * WordPress dependencies
1361 */
1362
1363
1364
1365
1366
1367
1368
1369 /**
1370 * Internal dependencies
1371 */
1372
1373
1374
1375
1376 function Header(_ref) {
1377 let {
1378 sidebar,
1379 inserter,
1380 isInserterOpened,
1381 setIsInserterOpened,
1382 isFixedToolbarActive
1383 } = _ref;
1384 const [[hasUndo, hasRedo], setUndoRedo] = (0,external_wp_element_namespaceObject.useState)([sidebar.hasUndo(), sidebar.hasRedo()]);
1385 const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y');
1386 (0,external_wp_element_namespaceObject.useEffect)(() => {
1387 return sidebar.subscribeHistory(() => {
1388 setUndoRedo([sidebar.hasUndo(), sidebar.hasRedo()]);
1389 });
1390 }, [sidebar]);
1391 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
1392 className: classnames_default()('customize-widgets-header', {
1393 'is-fixed-toolbar-active': isFixedToolbarActive
1394 })
1395 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, {
1396 className: "customize-widgets-header-toolbar",
1397 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document tools')
1398 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
1399 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo
1400 /* translators: button label text should, if possible, be under 16 characters. */
1401 ,
1402 label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
1403 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this
1404 // button, because it will remove focus for keyboard users.
1405 // See: https://github.com/WordPress/gutenberg/issues/3486
1406 ,
1407 "aria-disabled": !hasUndo,
1408 onClick: sidebar.undo,
1409 className: "customize-widgets-editor-history-button undo-button"
1410 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
1411 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo
1412 /* translators: button label text should, if possible, be under 16 characters. */
1413 ,
1414 label: (0,external_wp_i18n_namespaceObject.__)('Redo'),
1415 shortcut: shortcut // If there are no undo levels we don't want to actually disable this
1416 // button, because it will remove focus for keyboard users.
1417 // See: https://github.com/WordPress/gutenberg/issues/3486
1418 ,
1419 "aria-disabled": !hasRedo,
1420 onClick: sidebar.redo,
1421 className: "customize-widgets-editor-history-button redo-button"
1422 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
1423 className: "customize-widgets-header-toolbar__inserter-toggle",
1424 isPressed: isInserterOpened,
1425 variant: "primary",
1426 icon: library_plus,
1427 label: (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button'),
1428 onClick: () => {
1429 setIsInserterOpened(isOpen => !isOpen);
1430 }
1431 }), (0,external_wp_element_namespaceObject.createElement)(MoreMenu, null))), (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)(components_inserter, {
1432 setIsOpened: setIsInserterOpened
1433 }), inserter.contentContainer[0]));
1434 }
1435
1436 /* harmony default export */ var header = (Header);
1437
1438 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/inserter/use-inserter.js
1439 /**
1440 * WordPress dependencies
1441 */
1442
1443
1444 /**
1445 * Internal dependencies
1446 */
1447
1448
1449 function useInserter(inserter) {
1450 const isInserterOpened = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isInserterOpened(), []);
1451 const {
1452 setIsInserterOpened
1453 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
1454 (0,external_wp_element_namespaceObject.useEffect)(() => {
1455 if (isInserterOpened) {
1456 inserter.open();
1457 } else {
1458 inserter.close();
1459 }
1460 }, [inserter, isInserterOpened]);
1461 return [isInserterOpened, (0,external_wp_element_namespaceObject.useCallback)(updater => {
1462 let isOpen = updater;
1463
1464 if (typeof updater === 'function') {
1465 isOpen = updater((0,external_wp_data_namespaceObject.select)(store).isInserterOpened());
1466 }
1467
1468 setIsInserterOpened(isOpen);
1469 }, [setIsInserterOpened])];
1470 }
1471
1472 ;// CONCATENATED MODULE: external "lodash"
1473 var external_lodash_namespaceObject = window["lodash"];
1474 ;// CONCATENATED MODULE: external ["wp","isShallowEqual"]
1475 var external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"];
1476 var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject);
1477 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/utils.js
1478 // @ts-check
1479
1480 /**
1481 * WordPress dependencies
1482 */
1483
1484
1485 /**
1486 * Convert settingId to widgetId.
1487 *
1488 * @param {string} settingId The setting id.
1489 * @return {string} The widget id.
1490 */
1491
1492 function settingIdToWidgetId(settingId) {
1493 const matches = settingId.match(/^widget_(.+)(?:\[(\d+)\])$/);
1494
1495 if (matches) {
1496 const idBase = matches[1];
1497 const number = parseInt(matches[2], 10);
1498 return `${idBase}-${number}`;
1499 }
1500
1501 return settingId;
1502 }
1503 /**
1504 * Transform a block to a customizable widget.
1505 *
1506 * @param {WPBlock} block The block to be transformed from.
1507 * @param {Object} existingWidget The widget to be extended from.
1508 * @return {Object} The transformed widget.
1509 */
1510
1511 function blockToWidget(block) {
1512 let existingWidget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1513 let widget;
1514 const isValidLegacyWidgetBlock = block.name === 'core/legacy-widget' && (block.attributes.id || block.attributes.instance);
1515
1516 if (isValidLegacyWidgetBlock) {
1517 if (block.attributes.id) {
1518 // Widget that does not extend WP_Widget.
1519 widget = {
1520 id: block.attributes.id
1521 };
1522 } else {
1523 const {
1524 encoded,
1525 hash,
1526 raw,
1527 ...rest
1528 } = block.attributes.instance; // Widget that extends WP_Widget.
1529
1530 widget = {
1531 idBase: block.attributes.idBase,
1532 instance: { ...(existingWidget === null || existingWidget === void 0 ? void 0 : existingWidget.instance),
1533 // Required only for the customizer.
1534 is_widget_customizer_js_value: true,
1535 encoded_serialized_instance: encoded,
1536 instance_hash_key: hash,
1537 raw_instance: raw,
1538 ...rest
1539 }
1540 };
1541 }
1542 } else {
1543 const instance = {
1544 content: (0,external_wp_blocks_namespaceObject.serialize)(block)
1545 };
1546 widget = {
1547 idBase: 'block',
1548 widgetClass: 'WP_Widget_Block',
1549 instance: {
1550 raw_instance: instance
1551 }
1552 };
1553 }
1554
1555 const {
1556 form,
1557 rendered,
1558 ...restExistingWidget
1559 } = existingWidget || {};
1560 return { ...restExistingWidget,
1561 ...widget
1562 };
1563 }
1564 /**
1565 * Transform a widget to a block.
1566 *
1567 * @param {Object} widget The widget to be transformed from.
1568 * @param {string} widget.id The widget id.
1569 * @param {string} widget.idBase The id base of the widget.
1570 * @param {number} widget.number The number/index of the widget.
1571 * @param {Object} widget.instance The instance of the widget.
1572 * @return {WPBlock} The transformed block.
1573 */
1574
1575 function widgetToBlock(_ref) {
1576 let {
1577 id,
1578 idBase,
1579 number,
1580 instance
1581 } = _ref;
1582 let block;
1583 const {
1584 encoded_serialized_instance: encoded,
1585 instance_hash_key: hash,
1586 raw_instance: raw,
1587 ...rest
1588 } = instance;
1589
1590 if (idBase === 'block') {
1591 const parsedBlocks = (0,external_wp_blocks_namespaceObject.parse)(raw.content, {
1592 __unstableSkipAutop: true
1593 });
1594 block = parsedBlocks.length ? parsedBlocks[0] : (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {});
1595 } else if (number) {
1596 // Widget that extends WP_Widget.
1597 block = (0,external_wp_blocks_namespaceObject.createBlock)('core/legacy-widget', {
1598 idBase,
1599 instance: {
1600 encoded,
1601 hash,
1602 raw,
1603 ...rest
1604 }
1605 });
1606 } else {
1607 // Widget that does not extend WP_Widget.
1608 block = (0,external_wp_blocks_namespaceObject.createBlock)('core/legacy-widget', {
1609 id
1610 });
1611 }
1612
1613 return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)(block, id);
1614 }
1615
1616 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js
1617 /**
1618 * External dependencies
1619 */
1620
1621 /**
1622 * WordPress dependencies
1623 */
1624
1625
1626
1627
1628 /**
1629 * Internal dependencies
1630 */
1631
1632
1633
1634 function widgetsToBlocks(widgets) {
1635 return widgets.map(widget => widgetToBlock(widget));
1636 }
1637
1638 function useSidebarBlockEditor(sidebar) {
1639 const [blocks, setBlocks] = (0,external_wp_element_namespaceObject.useState)(() => widgetsToBlocks(sidebar.getWidgets()));
1640 (0,external_wp_element_namespaceObject.useEffect)(() => {
1641 return sidebar.subscribe((prevWidgets, nextWidgets) => {
1642 setBlocks(prevBlocks => {
1643 const prevWidgetsMap = new Map(prevWidgets.map(widget => [widget.id, widget]));
1644 const prevBlocksMap = new Map(prevBlocks.map(block => [(0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block), block]));
1645 const nextBlocks = nextWidgets.map(nextWidget => {
1646 const prevWidget = prevWidgetsMap.get(nextWidget.id); // Bail out updates.
1647
1648 if (prevWidget && prevWidget === nextWidget) {
1649 return prevBlocksMap.get(nextWidget.id);
1650 }
1651
1652 return widgetToBlock(nextWidget);
1653 }); // Bail out updates.
1654
1655 if (external_wp_isShallowEqual_default()(prevBlocks, nextBlocks)) {
1656 return prevBlocks;
1657 }
1658
1659 return nextBlocks;
1660 });
1661 });
1662 }, [sidebar]);
1663 const onChangeBlocks = (0,external_wp_element_namespaceObject.useCallback)(nextBlocks => {
1664 setBlocks(prevBlocks => {
1665 if (external_wp_isShallowEqual_default()(prevBlocks, nextBlocks)) {
1666 return prevBlocks;
1667 }
1668
1669 const prevBlocksMap = new Map(prevBlocks.map(block => [(0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block), block]));
1670 const nextWidgets = nextBlocks.map(nextBlock => {
1671 const widgetId = (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(nextBlock); // Update existing widgets.
1672
1673 if (widgetId && prevBlocksMap.has(widgetId)) {
1674 const prevBlock = prevBlocksMap.get(widgetId);
1675 const prevWidget = sidebar.getWidget(widgetId); // Bail out updates by returning the previous widgets.
1676 // Deep equality is necessary until the block editor's internals changes.
1677
1678 if ((0,external_lodash_namespaceObject.isEqual)(nextBlock, prevBlock) && prevWidget) {
1679 return prevWidget;
1680 }
1681
1682 return blockToWidget(nextBlock, prevWidget);
1683 } // Add a new widget.
1684
1685
1686 return blockToWidget(nextBlock);
1687 }); // Bail out updates if the updated widgets are the same.
1688
1689 if (external_wp_isShallowEqual_default()(sidebar.getWidgets(), nextWidgets)) {
1690 return prevBlocks;
1691 }
1692
1693 const addedWidgetIds = sidebar.setWidgets(nextWidgets);
1694 return nextBlocks.reduce((updatedNextBlocks, nextBlock, index) => {
1695 const addedWidgetId = addedWidgetIds[index];
1696
1697 if (addedWidgetId !== null) {
1698 // Only create a new instance if necessary to prevent
1699 // the whole editor from re-rendering on every edit.
1700 if (updatedNextBlocks === nextBlocks) {
1701 updatedNextBlocks = nextBlocks.slice();
1702 }
1703
1704 updatedNextBlocks[index] = (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)(nextBlock, addedWidgetId);
1705 }
1706
1707 return updatedNextBlocks;
1708 }, nextBlocks);
1709 });
1710 }, [sidebar]);
1711 return [blocks, onChangeBlocks, onChangeBlocks];
1712 }
1713
1714 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/focus-control/index.js
1715
1716
1717 /**
1718 * WordPress dependencies
1719 */
1720
1721 /**
1722 * Internal dependencies
1723 */
1724
1725
1726 const FocusControlContext = (0,external_wp_element_namespaceObject.createContext)();
1727 function FocusControl(_ref) {
1728 let {
1729 api,
1730 sidebarControls,
1731 children
1732 } = _ref;
1733 const [focusedWidgetIdRef, setFocusedWidgetIdRef] = (0,external_wp_element_namespaceObject.useState)({
1734 current: null
1735 });
1736 const focusWidget = (0,external_wp_element_namespaceObject.useCallback)(widgetId => {
1737 for (const sidebarControl of sidebarControls) {
1738 const widgets = sidebarControl.setting.get();
1739
1740 if (widgets.includes(widgetId)) {
1741 sidebarControl.sectionInstance.expand({
1742 // Schedule it after the complete callback so that
1743 // it won't be overridden by the "Back" button focus.
1744 completeCallback() {
1745 // Create a "ref-like" object every time to ensure
1746 // the same widget id can also triggers the focus control.
1747 setFocusedWidgetIdRef({
1748 current: widgetId
1749 });
1750 }
1751
1752 });
1753 break;
1754 }
1755 }
1756 }, [sidebarControls]);
1757 (0,external_wp_element_namespaceObject.useEffect)(() => {
1758 function handleFocus(settingId) {
1759 const widgetId = settingIdToWidgetId(settingId);
1760 focusWidget(widgetId);
1761 }
1762
1763 function handleReady() {
1764 api.previewer.preview.bind('focus-control-for-setting', handleFocus);
1765 }
1766
1767 api.previewer.bind('ready', handleReady);
1768 return () => {
1769 api.previewer.unbind('ready', handleReady);
1770 api.previewer.preview.unbind('focus-control-for-setting', handleFocus);
1771 };
1772 }, [api, focusWidget]);
1773 const context = (0,external_wp_element_namespaceObject.useMemo)(() => [focusedWidgetIdRef, focusWidget], [focusedWidgetIdRef, focusWidget]);
1774 return (0,external_wp_element_namespaceObject.createElement)(FocusControlContext.Provider, {
1775 value: context
1776 }, children);
1777 }
1778 const useFocusControl = () => (0,external_wp_element_namespaceObject.useContext)(FocusControlContext);
1779
1780 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/focus-control/use-blocks-focus-control.js
1781 /**
1782 * WordPress dependencies
1783 */
1784
1785
1786
1787
1788 /**
1789 * Internal dependencies
1790 */
1791
1792
1793 function useBlocksFocusControl(blocks) {
1794 const {
1795 selectBlock
1796 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
1797 const [focusedWidgetIdRef] = useFocusControl();
1798 const blocksRef = (0,external_wp_element_namespaceObject.useRef)(blocks);
1799 (0,external_wp_element_namespaceObject.useEffect)(() => {
1800 blocksRef.current = blocks;
1801 }, [blocks]);
1802 (0,external_wp_element_namespaceObject.useEffect)(() => {
1803 if (focusedWidgetIdRef.current) {
1804 const focusedBlock = blocksRef.current.find(block => (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block) === focusedWidgetIdRef.current);
1805
1806 if (focusedBlock) {
1807 selectBlock(focusedBlock.clientId); // If the block is already being selected, the DOM node won't
1808 // get focused again automatically.
1809 // We select the DOM and focus it manually here.
1810
1811 const blockNode = document.querySelector(`[data-block="${focusedBlock.clientId}"]`);
1812 blockNode === null || blockNode === void 0 ? void 0 : blockNode.focus();
1813 }
1814 }
1815 }, [focusedWidgetIdRef, selectBlock]);
1816 }
1817
1818 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/sidebar-block-editor/sidebar-editor-provider.js
1819
1820
1821 /**
1822 * WordPress dependencies
1823 */
1824
1825 /**
1826 * Internal dependencies
1827 */
1828
1829
1830
1831 function SidebarEditorProvider(_ref) {
1832 let {
1833 sidebar,
1834 settings,
1835 children
1836 } = _ref;
1837 const [blocks, onInput, onChange] = useSidebarBlockEditor(sidebar);
1838 useBlocksFocusControl(blocks);
1839 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, {
1840 value: blocks,
1841 onInput: onInput,
1842 onChange: onChange,
1843 settings: settings,
1844 useSubRegistry: false
1845 }, children);
1846 }
1847
1848 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/welcome-guide/index.js
1849
1850
1851 /**
1852 * WordPress dependencies
1853 */
1854
1855
1856
1857
1858 function WelcomeGuide(_ref) {
1859 let {
1860 sidebar
1861 } = _ref;
1862 const {
1863 toggle
1864 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
1865 const isEntirelyBlockWidgets = sidebar.getWidgets().every(widget => widget.id.startsWith('block-'));
1866 return (0,external_wp_element_namespaceObject.createElement)("div", {
1867 className: "customize-widgets-welcome-guide"
1868 }, (0,external_wp_element_namespaceObject.createElement)("div", {
1869 className: "customize-widgets-welcome-guide__image__wrapper"
1870 }, (0,external_wp_element_namespaceObject.createElement)("picture", null, (0,external_wp_element_namespaceObject.createElement)("source", {
1871 srcSet: "https://s.w.org/images/block-editor/welcome-editor.svg",
1872 media: "(prefers-reduced-motion: reduce)"
1873 }), (0,external_wp_element_namespaceObject.createElement)("img", {
1874 className: "customize-widgets-welcome-guide__image",
1875 src: "https://s.w.org/images/block-editor/welcome-editor.gif",
1876 width: "312",
1877 height: "240",
1878 alt: ""
1879 }))), (0,external_wp_element_namespaceObject.createElement)("h1", {
1880 className: "customize-widgets-welcome-guide__heading"
1881 }, (0,external_wp_i18n_namespaceObject.__)('Welcome to block Widgets')), (0,external_wp_element_namespaceObject.createElement)("p", {
1882 className: "customize-widgets-welcome-guide__text"
1883 }, isEntirelyBlockWidgets ? (0,external_wp_i18n_namespaceObject.__)('Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.') : (0,external_wp_i18n_namespaceObject.__)('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
1884 className: "customize-widgets-welcome-guide__button",
1885 variant: "primary",
1886 onClick: () => toggle('core/customize-widgets', 'welcomeGuide')
1887 }, (0,external_wp_i18n_namespaceObject.__)('Got it')), (0,external_wp_element_namespaceObject.createElement)("hr", {
1888 className: "customize-widgets-welcome-guide__separator"
1889 }), !isEntirelyBlockWidgets && (0,external_wp_element_namespaceObject.createElement)("p", {
1890 className: "customize-widgets-welcome-guide__more-info"
1891 }, (0,external_wp_i18n_namespaceObject.__)('Want to stick with the old widgets?'), (0,external_wp_element_namespaceObject.createElement)("br", null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
1892 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/plugins/classic-widgets/')
1893 }, (0,external_wp_i18n_namespaceObject.__)('Get the Classic Widgets plugin.'))), (0,external_wp_element_namespaceObject.createElement)("p", {
1894 className: "customize-widgets-welcome-guide__more-info"
1895 }, (0,external_wp_i18n_namespaceObject.__)('New to the block editor?'), (0,external_wp_element_namespaceObject.createElement)("br", null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
1896 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/')
1897 }, (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide."))));
1898 }
1899
1900 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/keyboard-shortcuts/index.js
1901 /**
1902 * WordPress dependencies
1903 */
1904
1905
1906
1907
1908
1909 function KeyboardShortcuts(_ref) {
1910 let {
1911 undo,
1912 redo,
1913 save
1914 } = _ref;
1915 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/undo', event => {
1916 undo();
1917 event.preventDefault();
1918 });
1919 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/redo', event => {
1920 redo();
1921 event.preventDefault();
1922 });
1923 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/customize-widgets/save', event => {
1924 event.preventDefault();
1925 save();
1926 });
1927 return null;
1928 }
1929
1930 function KeyboardShortcutsRegister() {
1931 const {
1932 registerShortcut,
1933 unregisterShortcut
1934 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
1935 (0,external_wp_element_namespaceObject.useEffect)(() => {
1936 registerShortcut({
1937 name: 'core/customize-widgets/undo',
1938 category: 'global',
1939 description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'),
1940 keyCombination: {
1941 modifier: 'primary',
1942 character: 'z'
1943 }
1944 });
1945 registerShortcut({
1946 name: 'core/customize-widgets/redo',
1947 category: 'global',
1948 description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'),
1949 keyCombination: {
1950 modifier: 'primaryShift',
1951 character: 'z'
1952 }
1953 });
1954 registerShortcut({
1955 name: 'core/customize-widgets/save',
1956 category: 'global',
1957 description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'),
1958 keyCombination: {
1959 modifier: 'primary',
1960 character: 's'
1961 }
1962 });
1963 return () => {
1964 unregisterShortcut('core/customize-widgets/undo');
1965 unregisterShortcut('core/customize-widgets/redo');
1966 unregisterShortcut('core/customize-widgets/save');
1967 };
1968 }, [registerShortcut]);
1969 return null;
1970 }
1971
1972 KeyboardShortcuts.Register = KeyboardShortcutsRegister;
1973 /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
1974
1975 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/block-appender/index.js
1976
1977
1978
1979 /**
1980 * WordPress dependencies
1981 */
1982
1983
1984
1985 function BlockAppender(props) {
1986 const ref = (0,external_wp_element_namespaceObject.useRef)();
1987 const isBlocksListEmpty = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlockCount() === 0); // Move the focus to the block appender to prevent focus from
1988 // being lost when emptying the widget area.
1989
1990 (0,external_wp_element_namespaceObject.useEffect)(() => {
1991 if (isBlocksListEmpty && ref.current) {
1992 const {
1993 ownerDocument
1994 } = ref.current;
1995
1996 if (!ownerDocument.activeElement || ownerDocument.activeElement === ownerDocument.body) {
1997 ref.current.focus();
1998 }
1999 }
2000 }, [isBlocksListEmpty]);
2001 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ButtonBlockAppender, _extends({}, props, {
2002 ref: ref
2003 }));
2004 }
2005
2006 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/sidebar-block-editor/index.js
2007
2008
2009 /**
2010 * WordPress dependencies
2011 */
2012
2013
2014
2015
2016
2017
2018 /**
2019 * Internal dependencies
2020 */
2021
2022
2023
2024
2025
2026
2027
2028
2029 function SidebarBlockEditor(_ref) {
2030 let {
2031 blockEditorSettings,
2032 sidebar,
2033 inserter,
2034 inspector
2035 } = _ref;
2036 const [isInserterOpened, setIsInserterOpened] = useInserter(inserter);
2037 const {
2038 hasUploadPermissions,
2039 isFixedToolbarActive,
2040 keepCaretInsideBlock,
2041 isWelcomeGuideActive
2042 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
2043 var _select$canUser;
2044
2045 const {
2046 get
2047 } = select(external_wp_preferences_namespaceObject.store);
2048 return {
2049 hasUploadPermissions: (_select$canUser = select(external_wp_coreData_namespaceObject.store).canUser('create', 'media')) !== null && _select$canUser !== void 0 ? _select$canUser : true,
2050 isFixedToolbarActive: !!get('core/customize-widgets', 'fixedToolbar'),
2051 keepCaretInsideBlock: !!get('core/customize-widgets', 'keepCaretInsideBlock'),
2052 isWelcomeGuideActive: !!get('core/customize-widgets', 'welcomeGuide')
2053 };
2054 }, []);
2055 const settings = (0,external_wp_element_namespaceObject.useMemo)(() => {
2056 let mediaUploadBlockEditor;
2057
2058 if (hasUploadPermissions) {
2059 mediaUploadBlockEditor = _ref2 => {
2060 let {
2061 onError,
2062 ...argumentsObject
2063 } = _ref2;
2064 (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({
2065 wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,
2066 onError: _ref3 => {
2067 let {
2068 message
2069 } = _ref3;
2070 return onError(message);
2071 },
2072 ...argumentsObject
2073 });
2074 };
2075 }
2076
2077 return { ...blockEditorSettings,
2078 __experimentalSetIsInserterOpened: setIsInserterOpened,
2079 mediaUpload: mediaUploadBlockEditor,
2080 hasFixedToolbar: isFixedToolbarActive,
2081 keepCaretInsideBlock,
2082 __unstableHasCustomAppender: true
2083 };
2084 }, [hasUploadPermissions, blockEditorSettings, isFixedToolbarActive, keepCaretInsideBlock, setIsInserterOpened]);
2085
2086 if (isWelcomeGuideActive) {
2087 return (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, {
2088 sidebar: sidebar
2089 });
2090 }
2091
2092 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(SidebarEditorProvider, {
2093 sidebar: sidebar,
2094 settings: settings
2095 }, (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, {
2096 undo: sidebar.undo,
2097 redo: sidebar.redo,
2098 save: sidebar.save
2099 }), (0,external_wp_element_namespaceObject.createElement)(header, {
2100 sidebar: sidebar,
2101 inserter: inserter,
2102 isInserterOpened: isInserterOpened,
2103 setIsInserterOpened: setIsInserterOpened,
2104 isFixedToolbarActive: isFixedToolbarActive
2105 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.CopyHandler, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
2106 styles: settings.defaultEditorStyles
2107 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSelectionClearer, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.WritingFlow, {
2108 className: "editor-styles-wrapper"
2109 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ObserveTyping, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, {
2110 renderAppender: BlockAppender
2111 })))))), (0,external_wp_element_namespaceObject.createPortal)( // This is a temporary hack to prevent button component inside <BlockInspector>
2112 // from submitting form when type="button" is not specified.
2113 (0,external_wp_element_namespaceObject.createElement)("form", {
2114 onSubmit: event => event.preventDefault()
2115 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null)), inspector.contentContainer[0])), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, null, _ref4 => {
2116 let {
2117 onClose
2118 } = _ref4;
2119 return (0,external_wp_element_namespaceObject.createElement)(block_inspector_button, {
2120 inspector: inspector,
2121 closeMenu: onClose
2122 });
2123 }));
2124 }
2125
2126 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/sidebar-controls/index.js
2127
2128
2129 /**
2130 * WordPress dependencies
2131 */
2132
2133 const SidebarControlsContext = (0,external_wp_element_namespaceObject.createContext)();
2134 function SidebarControls(_ref) {
2135 let {
2136 sidebarControls,
2137 activeSidebarControl,
2138 children
2139 } = _ref;
2140 const context = (0,external_wp_element_namespaceObject.useMemo)(() => ({
2141 sidebarControls,
2142 activeSidebarControl
2143 }), [sidebarControls, activeSidebarControl]);
2144 return (0,external_wp_element_namespaceObject.createElement)(SidebarControlsContext.Provider, {
2145 value: context
2146 }, children);
2147 }
2148 function useSidebarControls() {
2149 const {
2150 sidebarControls
2151 } = (0,external_wp_element_namespaceObject.useContext)(SidebarControlsContext);
2152 return sidebarControls;
2153 }
2154 function useActiveSidebarControl() {
2155 const {
2156 activeSidebarControl
2157 } = (0,external_wp_element_namespaceObject.useContext)(SidebarControlsContext);
2158 return activeSidebarControl;
2159 }
2160
2161 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/customize-widgets/use-clear-selected-block.js
2162 /**
2163 * WordPress dependencies
2164 */
2165
2166
2167
2168 /**
2169 * We can't just use <BlockSelectionClearer> because the customizer has
2170 * many root nodes rather than just one in the post editor.
2171 * We need to listen to the focus events in all those roots, and also in
2172 * the preview iframe.
2173 * This hook will clear the selected block when focusing outside the editor,
2174 * with a few exceptions:
2175 * 1. Focusing on popovers.
2176 * 2. Focusing on the inspector.
2177 * 3. Focusing on any modals/dialogs.
2178 * These cases are normally triggered by user interactions from the editor,
2179 * not by explicitly focusing outside the editor, hence no need for clearing.
2180 *
2181 * @param {Object} sidebarControl The sidebar control instance.
2182 * @param {Object} popoverRef The ref object of the popover node container.
2183 */
2184
2185 function useClearSelectedBlock(sidebarControl, popoverRef) {
2186 const {
2187 hasSelectedBlock,
2188 hasMultiSelection
2189 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
2190 const {
2191 clearSelectedBlock
2192 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
2193 (0,external_wp_element_namespaceObject.useEffect)(() => {
2194 if (popoverRef.current && sidebarControl) {
2195 const inspector = sidebarControl.inspector;
2196 const container = sidebarControl.container[0];
2197 const ownerDocument = container.ownerDocument;
2198 const ownerWindow = ownerDocument.defaultView;
2199
2200 function handleClearSelectedBlock(element) {
2201 if ( // 1. Make sure there are blocks being selected.
2202 (hasSelectedBlock() || hasMultiSelection()) && // 2. The element should exist in the DOM (not deleted).
2203 element && ownerDocument.contains(element) && // 3. It should also not exist in the container, the popover, nor the dialog.
2204 !container.contains(element) && !popoverRef.current.contains(element) && !element.closest('[role="dialog"]') && // 4. The inspector should not be opened.
2205 !inspector.expanded()) {
2206 clearSelectedBlock();
2207 }
2208 } // Handle mouse down in the same document.
2209
2210
2211 function handleMouseDown(event) {
2212 handleClearSelectedBlock(event.target);
2213 } // Handle focusing outside the current document, like to iframes.
2214
2215
2216 function handleBlur() {
2217 handleClearSelectedBlock(ownerDocument.activeElement);
2218 }
2219
2220 ownerDocument.addEventListener('mousedown', handleMouseDown);
2221 ownerWindow.addEventListener('blur', handleBlur);
2222 return () => {
2223 ownerDocument.removeEventListener('mousedown', handleMouseDown);
2224 ownerWindow.removeEventListener('blur', handleBlur);
2225 };
2226 }
2227 }, [popoverRef, sidebarControl, hasSelectedBlock, hasMultiSelection, clearSelectedBlock]);
2228 }
2229
2230 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/customize-widgets/index.js
2231
2232
2233 /**
2234 * WordPress dependencies
2235 */
2236
2237
2238
2239 /**
2240 * Internal dependencies
2241 */
2242
2243
2244
2245
2246
2247
2248 function CustomizeWidgets(_ref) {
2249 let {
2250 api,
2251 sidebarControls,
2252 blockEditorSettings
2253 } = _ref;
2254 const [activeSidebarControl, setActiveSidebarControl] = (0,external_wp_element_namespaceObject.useState)(null);
2255 const parentContainer = document.getElementById('customize-theme-controls');
2256 const popoverRef = (0,external_wp_element_namespaceObject.useRef)();
2257 useClearSelectedBlock(activeSidebarControl, popoverRef);
2258 (0,external_wp_element_namespaceObject.useEffect)(() => {
2259 const unsubscribers = sidebarControls.map(sidebarControl => sidebarControl.subscribe(expanded => {
2260 if (expanded) {
2261 setActiveSidebarControl(sidebarControl);
2262 }
2263 }));
2264 return () => {
2265 unsubscribers.forEach(unsubscriber => unsubscriber());
2266 };
2267 }, [sidebarControls]);
2268 const activeSidebar = activeSidebarControl && (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)(ErrorBoundary, null, (0,external_wp_element_namespaceObject.createElement)(SidebarBlockEditor, {
2269 key: activeSidebarControl.id,
2270 blockEditorSettings: blockEditorSettings,
2271 sidebar: activeSidebarControl.sidebarAdapter,
2272 inserter: activeSidebarControl.inserter,
2273 inspector: activeSidebarControl.inspector
2274 })), activeSidebarControl.container[0]); // We have to portal this to the parent of both the editor and the inspector,
2275 // so that the popovers will appear above both of them.
2276
2277 const popover = parentContainer && (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)("div", {
2278 className: "customize-widgets-popover",
2279 ref: popoverRef
2280 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, null)), parentContainer);
2281 return (0,external_wp_element_namespaceObject.createElement)(external_wp_keyboardShortcuts_namespaceObject.ShortcutProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(SidebarControls, {
2282 sidebarControls: sidebarControls,
2283 activeSidebarControl: activeSidebarControl
2284 }, (0,external_wp_element_namespaceObject.createElement)(FocusControl, {
2285 api: api,
2286 sidebarControls: sidebarControls
2287 }, activeSidebar, popover))));
2288 }
2289
2290 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/controls/inspector-section.js
2291 function getInspectorSection() {
2292 const {
2293 wp: {
2294 customize
2295 }
2296 } = window;
2297 return class InspectorSection extends customize.Section {
2298 constructor(id, options) {
2299 super(id, options);
2300 this.parentSection = options.parentSection;
2301 this.returnFocusWhenClose = null;
2302 this._isOpen = false;
2303 }
2304
2305 get isOpen() {
2306 return this._isOpen;
2307 }
2308
2309 set isOpen(value) {
2310 this._isOpen = value;
2311 this.triggerActiveCallbacks();
2312 }
2313
2314 ready() {
2315 this.contentContainer[0].classList.add('customize-widgets-layout__inspector');
2316 }
2317
2318 isContextuallyActive() {
2319 return this.isOpen;
2320 }
2321
2322 onChangeExpanded(expanded, args) {
2323 super.onChangeExpanded(expanded, args);
2324
2325 if (this.parentSection && !args.unchanged) {
2326 if (expanded) {
2327 this.parentSection.collapse({
2328 manualTransition: true
2329 });
2330 } else {
2331 this.parentSection.expand({
2332 manualTransition: true,
2333 completeCallback: () => {
2334 // Return focus after finishing the transition.
2335 if (this.returnFocusWhenClose && !this.contentContainer[0].contains(this.returnFocusWhenClose)) {
2336 this.returnFocusWhenClose.focus();
2337 }
2338 }
2339 });
2340 }
2341 }
2342 }
2343
2344 open() {
2345 let {
2346 returnFocusWhenClose
2347 } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2348 this.isOpen = true;
2349 this.returnFocusWhenClose = returnFocusWhenClose;
2350 this.expand({
2351 allowMultiple: true
2352 });
2353 }
2354
2355 close() {
2356 this.collapse({
2357 allowMultiple: true
2358 });
2359 }
2360
2361 collapse(options) {
2362 // Overridden collapse() function. Mostly call the parent collapse(), but also
2363 // move our .isOpen to false.
2364 // Initially, I tried tracking this with onChangeExpanded(), but it doesn't work
2365 // because the block settings sidebar is a layer "on top of" the G editor sidebar.
2366 //
2367 // For example, when closing the block settings sidebar, the G
2368 // editor sidebar would display, and onChangeExpanded in
2369 // inspector-section would run with expanded=true, but I want
2370 // isOpen to be false when the block settings is closed.
2371 this.isOpen = false;
2372 super.collapse(options);
2373 }
2374
2375 triggerActiveCallbacks() {
2376 // Manually fire the callbacks associated with moving this.active
2377 // from false to true. "active" is always true for this section,
2378 // and "isContextuallyActive" reflects if the block settings
2379 // sidebar is currently visible, that is, it has replaced the main
2380 // Gutenberg view.
2381 // The WP customizer only checks ".isContextuallyActive()" when
2382 // ".active" changes values. But our ".active" never changes value.
2383 // The WP customizer never foresaw a section being used a way we
2384 // fit the block settings sidebar into a section. By manually
2385 // triggering the "this.active" callbacks, we force the WP
2386 // customizer to query our .isContextuallyActive() function and
2387 // update its view of our status.
2388 this.active.callbacks.fireWith(this.active, [false, true]);
2389 }
2390
2391 };
2392 }
2393
2394 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/controls/sidebar-section.js
2395 /**
2396 * WordPress dependencies
2397 */
2398
2399 /**
2400 * Internal dependencies
2401 */
2402
2403
2404
2405 const getInspectorSectionId = sidebarId => `widgets-inspector-${sidebarId}`;
2406
2407 function getSidebarSection() {
2408 const {
2409 wp: {
2410 customize
2411 }
2412 } = window;
2413 const reduceMotionMediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
2414 let isReducedMotion = reduceMotionMediaQuery.matches;
2415 reduceMotionMediaQuery.addEventListener('change', event => {
2416 isReducedMotion = event.matches;
2417 });
2418 return class SidebarSection extends customize.Section {
2419 ready() {
2420 const InspectorSection = getInspectorSection();
2421 this.inspector = new InspectorSection(getInspectorSectionId(this.id), {
2422 title: (0,external_wp_i18n_namespaceObject.__)('Block Settings'),
2423 parentSection: this,
2424 customizeAction: [(0,external_wp_i18n_namespaceObject.__)('Customizing'), (0,external_wp_i18n_namespaceObject.__)('Widgets'), this.params.title].join('')
2425 });
2426 customize.section.add(this.inspector);
2427 this.contentContainer[0].classList.add('customize-widgets__sidebar-section');
2428 }
2429
2430 hasSubSectionOpened() {
2431 return this.inspector.expanded();
2432 }
2433
2434 onChangeExpanded(expanded, _args) {
2435 const controls = this.controls();
2436 const args = { ..._args,
2437
2438 completeCallback() {
2439 var _args$completeCallbac;
2440
2441 controls.forEach(control => {
2442 var _control$onChangeSect;
2443
2444 (_control$onChangeSect = control.onChangeSectionExpanded) === null || _control$onChangeSect === void 0 ? void 0 : _control$onChangeSect.call(control, expanded, args);
2445 });
2446 (_args$completeCallbac = _args.completeCallback) === null || _args$completeCallbac === void 0 ? void 0 : _args$completeCallbac.call(_args);
2447 }
2448
2449 };
2450
2451 if (args.manualTransition) {
2452 if (expanded) {
2453 this.contentContainer.addClass(['busy', 'open']);
2454 this.contentContainer.removeClass('is-sub-section-open');
2455 this.contentContainer.closest('.wp-full-overlay').addClass('section-open');
2456 } else {
2457 this.contentContainer.addClass(['busy', 'is-sub-section-open']);
2458 this.contentContainer.closest('.wp-full-overlay').addClass('section-open');
2459 this.contentContainer.removeClass('open');
2460 }
2461
2462 const handleTransitionEnd = () => {
2463 this.contentContainer.removeClass('busy');
2464 args.completeCallback();
2465 };
2466
2467 if (isReducedMotion) {
2468 handleTransitionEnd();
2469 } else {
2470 this.contentContainer.one('transitionend', handleTransitionEnd);
2471 }
2472 } else {
2473 super.onChangeExpanded(expanded, args);
2474 }
2475 }
2476
2477 };
2478 }
2479
2480 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/components/sidebar-block-editor/sidebar-adapter.js
2481 /**
2482 * Internal dependencies
2483 */
2484
2485 const {
2486 wp
2487 } = window;
2488
2489 function parseWidgetId(widgetId) {
2490 const matches = widgetId.match(/^(.+)-(\d+)$/);
2491
2492 if (matches) {
2493 return {
2494 idBase: matches[1],
2495 number: parseInt(matches[2], 10)
2496 };
2497 } // Likely an old single widget.
2498
2499
2500 return {
2501 idBase: widgetId
2502 };
2503 }
2504
2505 function widgetIdToSettingId(widgetId) {
2506 const {
2507 idBase,
2508 number
2509 } = parseWidgetId(widgetId);
2510
2511 if (number) {
2512 return `widget_${idBase}[${number}]`;
2513 }
2514
2515 return `widget_${idBase}`;
2516 }
2517 /**
2518 * This is a custom debounce function to call different callbacks depending on
2519 * whether it's the _leading_ call or not.
2520 *
2521 * @param {Function} leading The callback that gets called first.
2522 * @param {Function} callback The callback that gets called after the first time.
2523 * @param {number} timeout The debounced time in milliseconds.
2524 * @return {Function} The debounced function.
2525 */
2526
2527
2528 function debounce(leading, callback, timeout) {
2529 let isLeading = false;
2530 let timerID;
2531
2532 function debounced() {
2533 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2534 args[_key] = arguments[_key];
2535 }
2536
2537 const result = (isLeading ? callback : leading).apply(this, args);
2538 isLeading = true;
2539 clearTimeout(timerID);
2540 timerID = setTimeout(() => {
2541 isLeading = false;
2542 }, timeout);
2543 return result;
2544 }
2545
2546 debounced.cancel = () => {
2547 isLeading = false;
2548 clearTimeout(timerID);
2549 };
2550
2551 return debounced;
2552 }
2553
2554 class SidebarAdapter {
2555 constructor(setting, api) {
2556 this.setting = setting;
2557 this.api = api;
2558 this.locked = false;
2559 this.widgetsCache = new WeakMap();
2560 this.subscribers = new Set();
2561 this.history = [this._getWidgetIds().map(widgetId => this.getWidget(widgetId))];
2562 this.historyIndex = 0;
2563 this.historySubscribers = new Set(); // Debounce the input for 1 second.
2564
2565 this._debounceSetHistory = debounce(this._pushHistory, this._replaceHistory, 1000);
2566 this.setting.bind(this._handleSettingChange.bind(this));
2567 this.api.bind('change', this._handleAllSettingsChange.bind(this));
2568 this.undo = this.undo.bind(this);
2569 this.redo = this.redo.bind(this);
2570 this.save = this.save.bind(this);
2571 }
2572
2573 subscribe(callback) {
2574 this.subscribers.add(callback);
2575 return () => {
2576 this.subscribers.delete(callback);
2577 };
2578 }
2579
2580 getWidgets() {
2581 return this.history[this.historyIndex];
2582 }
2583
2584 _emit() {
2585 for (const callback of this.subscribers) {
2586 callback(...arguments);
2587 }
2588 }
2589
2590 _getWidgetIds() {
2591 return this.setting.get();
2592 }
2593
2594 _pushHistory() {
2595 this.history = [...this.history.slice(0, this.historyIndex + 1), this._getWidgetIds().map(widgetId => this.getWidget(widgetId))];
2596 this.historyIndex += 1;
2597 this.historySubscribers.forEach(listener => listener());
2598 }
2599
2600 _replaceHistory() {
2601 this.history[this.historyIndex] = this._getWidgetIds().map(widgetId => this.getWidget(widgetId));
2602 }
2603
2604 _handleSettingChange() {
2605 if (this.locked) {
2606 return;
2607 }
2608
2609 const prevWidgets = this.getWidgets();
2610
2611 this._pushHistory();
2612
2613 this._emit(prevWidgets, this.getWidgets());
2614 }
2615
2616 _handleAllSettingsChange(setting) {
2617 if (this.locked) {
2618 return;
2619 }
2620
2621 if (!setting.id.startsWith('widget_')) {
2622 return;
2623 }
2624
2625 const widgetId = settingIdToWidgetId(setting.id);
2626
2627 if (!this.setting.get().includes(widgetId)) {
2628 return;
2629 }
2630
2631 const prevWidgets = this.getWidgets();
2632
2633 this._pushHistory();
2634
2635 this._emit(prevWidgets, this.getWidgets());
2636 }
2637
2638 _createWidget(widget) {
2639 const widgetModel = wp.customize.Widgets.availableWidgets.findWhere({
2640 id_base: widget.idBase
2641 });
2642 let number = widget.number;
2643
2644 if (widgetModel.get('is_multi') && !number) {
2645 widgetModel.set('multi_number', widgetModel.get('multi_number') + 1);
2646 number = widgetModel.get('multi_number');
2647 }
2648
2649 const settingId = number ? `widget_${widget.idBase}[${number}]` : `widget_${widget.idBase}`;
2650 const settingArgs = {
2651 transport: wp.customize.Widgets.data.selectiveRefreshableWidgets[widgetModel.get('id_base')] ? 'postMessage' : 'refresh',
2652 previewer: this.setting.previewer
2653 };
2654 const setting = this.api.create(settingId, settingId, '', settingArgs);
2655 setting.set(widget.instance);
2656 const widgetId = settingIdToWidgetId(settingId);
2657 return widgetId;
2658 }
2659
2660 _removeWidget(widget) {
2661 const settingId = widgetIdToSettingId(widget.id);
2662 const setting = this.api(settingId);
2663
2664 if (setting) {
2665 const instance = setting.get();
2666 this.widgetsCache.delete(instance);
2667 }
2668
2669 this.api.remove(settingId);
2670 }
2671
2672 _updateWidget(widget) {
2673 const prevWidget = this.getWidget(widget.id); // Bail out update if nothing changed.
2674
2675 if (prevWidget === widget) {
2676 return widget.id;
2677 } // Update existing setting if only the widget's instance changed.
2678
2679
2680 if (prevWidget.idBase && widget.idBase && prevWidget.idBase === widget.idBase) {
2681 const settingId = widgetIdToSettingId(widget.id);
2682 this.api(settingId).set(widget.instance);
2683 return widget.id;
2684 } // Otherwise delete and re-create.
2685
2686
2687 this._removeWidget(widget);
2688
2689 return this._createWidget(widget);
2690 }
2691
2692 getWidget(widgetId) {
2693 if (!widgetId) {
2694 return null;
2695 }
2696
2697 const {
2698 idBase,
2699 number
2700 } = parseWidgetId(widgetId);
2701 const settingId = widgetIdToSettingId(widgetId);
2702 const setting = this.api(settingId);
2703
2704 if (!setting) {
2705 return null;
2706 }
2707
2708 const instance = setting.get();
2709
2710 if (this.widgetsCache.has(instance)) {
2711 return this.widgetsCache.get(instance);
2712 }
2713
2714 const widget = {
2715 id: widgetId,
2716 idBase,
2717 number,
2718 instance
2719 };
2720 this.widgetsCache.set(instance, widget);
2721 return widget;
2722 }
2723
2724 _updateWidgets(nextWidgets) {
2725 this.locked = true;
2726 const addedWidgetIds = [];
2727 const nextWidgetIds = nextWidgets.map(nextWidget => {
2728 if (nextWidget.id && this.getWidget(nextWidget.id)) {
2729 addedWidgetIds.push(null);
2730 return this._updateWidget(nextWidget);
2731 }
2732
2733 const widgetId = this._createWidget(nextWidget);
2734
2735 addedWidgetIds.push(widgetId);
2736 return widgetId;
2737 });
2738 const deletedWidgets = this.getWidgets().filter(widget => !nextWidgetIds.includes(widget.id));
2739 deletedWidgets.forEach(widget => this._removeWidget(widget));
2740 this.setting.set(nextWidgetIds);
2741 this.locked = false;
2742 return addedWidgetIds;
2743 }
2744
2745 setWidgets(nextWidgets) {
2746 const addedWidgetIds = this._updateWidgets(nextWidgets);
2747
2748 this._debounceSetHistory();
2749
2750 return addedWidgetIds;
2751 }
2752 /**
2753 * Undo/Redo related features
2754 */
2755
2756
2757 hasUndo() {
2758 return this.historyIndex > 0;
2759 }
2760
2761 hasRedo() {
2762 return this.historyIndex < this.history.length - 1;
2763 }
2764
2765 _seek(historyIndex) {
2766 const currentWidgets = this.getWidgets();
2767 this.historyIndex = historyIndex;
2768 const widgets = this.history[this.historyIndex];
2769
2770 this._updateWidgets(widgets);
2771
2772 this._emit(currentWidgets, this.getWidgets());
2773
2774 this.historySubscribers.forEach(listener => listener());
2775
2776 this._debounceSetHistory.cancel();
2777 }
2778
2779 undo() {
2780 if (!this.hasUndo()) {
2781 return;
2782 }
2783
2784 this._seek(this.historyIndex - 1);
2785 }
2786
2787 redo() {
2788 if (!this.hasRedo()) {
2789 return;
2790 }
2791
2792 this._seek(this.historyIndex + 1);
2793 }
2794
2795 subscribeHistory(listener) {
2796 this.historySubscribers.add(listener);
2797 return () => {
2798 this.historySubscribers.delete(listener);
2799 };
2800 }
2801
2802 save() {
2803 this.api.previewer.save();
2804 }
2805
2806 }
2807
2808 ;// CONCATENATED MODULE: external ["wp","dom"]
2809 var external_wp_dom_namespaceObject = window["wp"]["dom"];
2810 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/controls/inserter-outer-section.js
2811 /**
2812 * WordPress dependencies
2813 */
2814
2815
2816
2817 /**
2818 * Internal dependencies
2819 */
2820
2821
2822 function getInserterOuterSection() {
2823 const {
2824 wp: {
2825 customize
2826 }
2827 } = window;
2828 const OuterSection = customize.OuterSection; // Override the OuterSection class to handle multiple outer sections.
2829 // It closes all the other outer sections whenever one is opened.
2830 // The result is that at most one outer section can be opened at the same time.
2831
2832 customize.OuterSection = class extends OuterSection {
2833 onChangeExpanded(expanded, args) {
2834 if (expanded) {
2835 customize.section.each(section => {
2836 if (section.params.type === 'outer' && section.id !== this.id) {
2837 if (section.expanded()) {
2838 section.collapse();
2839 }
2840 }
2841 });
2842 }
2843
2844 return super.onChangeExpanded(expanded, args);
2845 }
2846
2847 }; // Handle constructor so that "params.type" can be correctly pointed to "outer".
2848
2849 customize.sectionConstructor.outer = customize.OuterSection;
2850 return class InserterOuterSection extends customize.OuterSection {
2851 constructor() {
2852 super(...arguments); // This is necessary since we're creating a new class which is not identical to the original OuterSection.
2853 // @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436
2854
2855 this.params.type = 'outer';
2856 this.activeElementBeforeExpanded = null;
2857 const ownerWindow = this.contentContainer[0].ownerDocument.defaultView; // Handle closing the inserter when pressing the Escape key.
2858
2859 ownerWindow.addEventListener('keydown', event => {
2860 if (this.expanded() && (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE || event.code === 'Escape') && !event.defaultPrevented) {
2861 event.preventDefault();
2862 event.stopPropagation();
2863 (0,external_wp_data_namespaceObject.dispatch)(store).setIsInserterOpened(false);
2864 }
2865 }, // Use capture mode to make this run before other event listeners.
2866 true);
2867 this.contentContainer.addClass('widgets-inserter'); // Set a flag if the state is being changed from open() or close().
2868 // Don't propagate the event if it's an internal action to prevent infinite loop.
2869
2870 this.isFromInternalAction = false;
2871 this.expanded.bind(() => {
2872 if (!this.isFromInternalAction) {
2873 // Propagate the event to React to sync the state.
2874 (0,external_wp_data_namespaceObject.dispatch)(store).setIsInserterOpened(this.expanded());
2875 }
2876
2877 this.isFromInternalAction = false;
2878 });
2879 }
2880
2881 open() {
2882 if (!this.expanded()) {
2883 const contentContainer = this.contentContainer[0];
2884 this.activeElementBeforeExpanded = contentContainer.ownerDocument.activeElement;
2885 this.isFromInternalAction = true;
2886 this.expand({
2887 completeCallback() {
2888 // We have to do this in a "completeCallback" or else the elements will not yet be visible/tabbable.
2889 // The first one should be the close button,
2890 // we want to skip it and choose the second one instead, which is the search box.
2891 const searchBox = external_wp_dom_namespaceObject.focus.tabbable.find(contentContainer)[1];
2892
2893 if (searchBox) {
2894 searchBox.focus();
2895 }
2896 }
2897
2898 });
2899 }
2900 }
2901
2902 close() {
2903 if (this.expanded()) {
2904 const contentContainer = this.contentContainer[0];
2905 const activeElement = contentContainer.ownerDocument.activeElement;
2906 this.isFromInternalAction = true;
2907 this.collapse({
2908 completeCallback() {
2909 // Return back the focus when closing the inserter.
2910 // Only do this if the active element which triggers the action is inside the inserter,
2911 // (the close button for instance). In that case the focus will be lost.
2912 // Otherwise, we don't hijack the focus when the user is focusing on other elements
2913 // (like the quick inserter).
2914 if (contentContainer.contains(activeElement)) {
2915 // Return back the focus when closing the inserter.
2916 if (this.activeElementBeforeExpanded) {
2917 this.activeElementBeforeExpanded.focus();
2918 }
2919 }
2920 }
2921
2922 });
2923 }
2924 }
2925
2926 };
2927 }
2928
2929 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/controls/sidebar-control.js
2930 /**
2931 * WordPress dependencies
2932 */
2933
2934 /**
2935 * Internal dependencies
2936 */
2937
2938
2939
2940
2941
2942 const getInserterId = controlId => `widgets-inserter-${controlId}`;
2943
2944 function getSidebarControl() {
2945 const {
2946 wp: {
2947 customize
2948 }
2949 } = window;
2950 return class SidebarControl extends customize.Control {
2951 constructor() {
2952 super(...arguments);
2953 this.subscribers = new Set();
2954 }
2955
2956 ready() {
2957 const InserterOuterSection = getInserterOuterSection();
2958 this.inserter = new InserterOuterSection(getInserterId(this.id), {});
2959 customize.section.add(this.inserter);
2960 this.sectionInstance = customize.section(this.section());
2961 this.inspector = this.sectionInstance.inspector;
2962 this.sidebarAdapter = new SidebarAdapter(this.setting, customize);
2963 }
2964
2965 subscribe(callback) {
2966 this.subscribers.add(callback);
2967 return () => {
2968 this.subscribers.delete(callback);
2969 };
2970 }
2971
2972 onChangeSectionExpanded(expanded, args) {
2973 if (!args.unchanged) {
2974 // Close the inserter when the section collapses.
2975 if (!expanded) {
2976 (0,external_wp_data_namespaceObject.dispatch)(store).setIsInserterOpened(false);
2977 }
2978
2979 this.subscribers.forEach(subscriber => subscriber(expanded, args));
2980 }
2981 }
2982
2983 };
2984 }
2985
2986 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/filters/move-to-sidebar.js
2987
2988
2989 /**
2990 * WordPress dependencies
2991 */
2992
2993
2994
2995
2996
2997 /**
2998 * Internal dependencies
2999 */
3000
3001
3002
3003
3004 const withMoveToSidebarToolbarItem = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
3005 let widgetId = (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(props);
3006 const sidebarControls = useSidebarControls();
3007 const activeSidebarControl = useActiveSidebarControl();
3008 const hasMultipleSidebars = (sidebarControls === null || sidebarControls === void 0 ? void 0 : sidebarControls.length) > 1;
3009 const blockName = props.name;
3010 const clientId = props.clientId;
3011 const canInsertBlockInSidebar = (0,external_wp_data_namespaceObject.useSelect)(select => {
3012 // Use an empty string to represent the root block list, which
3013 // in the customizer editor represents a sidebar/widget area.
3014 return select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType(blockName, '');
3015 }, [blockName]);
3016 const block = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId), [clientId]);
3017 const {
3018 removeBlock
3019 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
3020 const [, focusWidget] = useFocusControl();
3021
3022 function moveToSidebar(sidebarControlId) {
3023 const newSidebarControl = sidebarControls.find(sidebarControl => sidebarControl.id === sidebarControlId);
3024
3025 if (widgetId) {
3026 /**
3027 * If there's a widgetId, move it to the other sidebar.
3028 */
3029 const oldSetting = activeSidebarControl.setting;
3030 const newSetting = newSidebarControl.setting;
3031 oldSetting(oldSetting().filter(id => id !== widgetId));
3032 newSetting([...newSetting(), widgetId]);
3033 } else {
3034 /**
3035 * If there isn't a widgetId, it's most likely a inner block.
3036 * First, remove the block in the original sidebar,
3037 * then, create a new widget in the new sidebar and get back its widgetId.
3038 */
3039 const sidebarAdapter = newSidebarControl.sidebarAdapter;
3040 removeBlock(clientId);
3041 const addedWidgetIds = sidebarAdapter.setWidgets([...sidebarAdapter.getWidgets(), blockToWidget(block)]); // The last non-null id is the added widget's id.
3042
3043 widgetId = addedWidgetIds.reverse().find(id => !!id);
3044 } // Move focus to the moved widget and expand the sidebar.
3045
3046
3047 focusWidget(widgetId);
3048 }
3049
3050 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props), hasMultipleSidebars && canInsertBlockInSidebar && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_widgets_namespaceObject.MoveToWidgetArea, {
3051 widgetAreas: sidebarControls.map(sidebarControl => ({
3052 id: sidebarControl.id,
3053 name: sidebarControl.params.label,
3054 description: sidebarControl.params.description
3055 })),
3056 currentWidgetAreaId: activeSidebarControl === null || activeSidebarControl === void 0 ? void 0 : activeSidebarControl.id,
3057 onSelect: moveToSidebar
3058 })));
3059 }, 'withMoveToSidebarToolbarItem');
3060 (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/customize-widgets/block-edit', withMoveToSidebarToolbarItem);
3061
3062 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/filters/replace-media-upload.js
3063 /**
3064 * WordPress dependencies
3065 */
3066
3067
3068
3069 const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload;
3070
3071 (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload);
3072
3073 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/filters/wide-widget-display.js
3074
3075
3076
3077 /**
3078 * WordPress dependencies
3079 */
3080
3081
3082 const {
3083 wp: wide_widget_display_wp
3084 } = window;
3085 const withWideWidgetDisplay = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
3086 var _wp$customize$Widgets, _wp$customize$Widgets2;
3087
3088 const {
3089 idBase
3090 } = props.attributes;
3091 const isWide = (_wp$customize$Widgets = (_wp$customize$Widgets2 = wide_widget_display_wp.customize.Widgets.data.availableWidgets.find(widget => widget.id_base === idBase)) === null || _wp$customize$Widgets2 === void 0 ? void 0 : _wp$customize$Widgets2.is_wide) !== null && _wp$customize$Widgets !== void 0 ? _wp$customize$Widgets : false;
3092 return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, _extends({}, props, {
3093 isWide: isWide
3094 }));
3095 }, 'withWideWidgetDisplay');
3096 (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/customize-widgets/wide-widget-display', withWideWidgetDisplay);
3097
3098 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/filters/index.js
3099 /**
3100 * Internal dependencies
3101 */
3102
3103
3104
3105
3106 ;// CONCATENATED MODULE: ./packages/customize-widgets/build-module/index.js
3107
3108
3109 /**
3110 * WordPress dependencies
3111 */
3112
3113
3114
3115
3116
3117
3118 /**
3119 * Internal dependencies
3120 */
3121
3122
3123
3124
3125
3126 const {
3127 wp: build_module_wp
3128 } = window;
3129 const DISABLED_BLOCKS = ['core/more', 'core/block', 'core/freeform', 'core/template-part'];
3130 const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
3131 /**
3132 * Initializes the widgets block editor in the customizer.
3133 *
3134 * @param {string} editorName The editor name.
3135 * @param {Object} blockEditorSettings Block editor settings.
3136 */
3137
3138 function initialize(editorName, blockEditorSettings) {
3139 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/customize-widgets', {
3140 fixedToolbar: false,
3141 welcomeGuide: true
3142 });
3143
3144 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters();
3145
3146 const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(block => {
3147 return !(DISABLED_BLOCKS.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site') || block.name.startsWith('core/navigation'));
3148 });
3149
3150 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks);
3151 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)();
3152
3153 if (true) {
3154 (0,external_wp_blockLibrary_namespaceObject.__experimentalRegisterExperimentalCoreBlocks)({
3155 enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS
3156 });
3157 }
3158
3159 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetVariations)(blockEditorSettings);
3160 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)(); // As we are unregistering `core/freeform` to avoid the Classic block, we must
3161 // replace it with something as the default freeform content handler. Failure to
3162 // do this will result in errors in the default block parser.
3163 // see: https://github.com/WordPress/gutenberg/issues/33097
3164
3165 (0,external_wp_blocks_namespaceObject.setFreeformContentHandlerName)('core/html');
3166 const SidebarControl = getSidebarControl(blockEditorSettings);
3167 build_module_wp.customize.sectionConstructor.sidebar = getSidebarSection();
3168 build_module_wp.customize.controlConstructor.sidebar_block_editor = SidebarControl;
3169 const container = document.createElement('div');
3170 document.body.appendChild(container);
3171 build_module_wp.customize.bind('ready', () => {
3172 const sidebarControls = [];
3173 build_module_wp.customize.control.each(control => {
3174 if (control instanceof SidebarControl) {
3175 sidebarControls.push(control);
3176 }
3177 });
3178 (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(CustomizeWidgets, {
3179 api: build_module_wp.customize,
3180 sidebarControls: sidebarControls,
3181 blockEditorSettings: blockEditorSettings
3182 }), container);
3183 });
3184 }
3185
3186 }();
3187 (window.wp = window.wp || {}).customizeWidgets = __webpack_exports__;
3188 /******/ })()
3189 ;