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