1 /******/ (function() { // webpackBootstrap |
1 /******/ (() => { // webpackBootstrap |
2 /******/ var __webpack_modules__ = ({ |
2 /******/ "use strict"; |
3 |
3 /******/ // The require scope |
4 /***/ 4403: |
4 /******/ var __webpack_require__ = {}; |
5 /***/ (function(module, exports) { |
|
6 |
|
7 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
|
8 Copyright (c) 2018 Jed Watson. |
|
9 Licensed under the MIT License (MIT), see |
|
10 http://jedwatson.github.io/classnames |
|
11 */ |
|
12 /* global define */ |
|
13 |
|
14 (function () { |
|
15 'use strict'; |
|
16 |
|
17 var hasOwn = {}.hasOwnProperty; |
|
18 |
|
19 function classNames() { |
|
20 var classes = []; |
|
21 |
|
22 for (var i = 0; i < arguments.length; i++) { |
|
23 var arg = arguments[i]; |
|
24 if (!arg) continue; |
|
25 |
|
26 var argType = typeof arg; |
|
27 |
|
28 if (argType === 'string' || argType === 'number') { |
|
29 classes.push(arg); |
|
30 } else if (Array.isArray(arg)) { |
|
31 if (arg.length) { |
|
32 var inner = classNames.apply(null, arg); |
|
33 if (inner) { |
|
34 classes.push(inner); |
|
35 } |
|
36 } |
|
37 } else if (argType === 'object') { |
|
38 if (arg.toString === Object.prototype.toString) { |
|
39 for (var key in arg) { |
|
40 if (hasOwn.call(arg, key) && arg[key]) { |
|
41 classes.push(key); |
|
42 } |
|
43 } |
|
44 } else { |
|
45 classes.push(arg.toString()); |
|
46 } |
|
47 } |
|
48 } |
|
49 |
|
50 return classes.join(' '); |
|
51 } |
|
52 |
|
53 if ( true && module.exports) { |
|
54 classNames.default = classNames; |
|
55 module.exports = classNames; |
|
56 } else if (true) { |
|
57 // register as 'classnames', consistent with npm package name |
|
58 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { |
|
59 return classNames; |
|
60 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), |
|
61 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
|
62 } else {} |
|
63 }()); |
|
64 |
|
65 |
|
66 /***/ }) |
|
67 |
|
68 /******/ }); |
|
69 /************************************************************************/ |
|
70 /******/ // The module cache |
|
71 /******/ var __webpack_module_cache__ = {}; |
|
72 /******/ |
|
73 /******/ // The require function |
|
74 /******/ function __webpack_require__(moduleId) { |
|
75 /******/ // Check if module is in cache |
|
76 /******/ var cachedModule = __webpack_module_cache__[moduleId]; |
|
77 /******/ if (cachedModule !== undefined) { |
|
78 /******/ return cachedModule.exports; |
|
79 /******/ } |
|
80 /******/ // Create a new module (and put it into the cache) |
|
81 /******/ var module = __webpack_module_cache__[moduleId] = { |
|
82 /******/ // no module.id needed |
|
83 /******/ // no module.loaded needed |
|
84 /******/ exports: {} |
|
85 /******/ }; |
|
86 /******/ |
|
87 /******/ // Execute the module function |
|
88 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
|
89 /******/ |
|
90 /******/ // Return the exports of the module |
|
91 /******/ return module.exports; |
|
92 /******/ } |
|
93 /******/ |
5 /******/ |
94 /************************************************************************/ |
6 /************************************************************************/ |
95 /******/ /* webpack/runtime/compat get default export */ |
7 /******/ /* webpack/runtime/compat get default export */ |
96 /******/ !function() { |
8 /******/ (() => { |
97 /******/ // getDefaultExport function for compatibility with non-harmony modules |
9 /******/ // getDefaultExport function for compatibility with non-harmony modules |
98 /******/ __webpack_require__.n = function(module) { |
10 /******/ __webpack_require__.n = (module) => { |
99 /******/ var getter = module && module.__esModule ? |
11 /******/ var getter = module && module.__esModule ? |
100 /******/ function() { return module['default']; } : |
12 /******/ () => (module['default']) : |
101 /******/ function() { return module; }; |
13 /******/ () => (module); |
102 /******/ __webpack_require__.d(getter, { a: getter }); |
14 /******/ __webpack_require__.d(getter, { a: getter }); |
103 /******/ return getter; |
15 /******/ return getter; |
104 /******/ }; |
16 /******/ }; |
105 /******/ }(); |
17 /******/ })(); |
106 /******/ |
18 /******/ |
107 /******/ /* webpack/runtime/define property getters */ |
19 /******/ /* webpack/runtime/define property getters */ |
108 /******/ !function() { |
20 /******/ (() => { |
109 /******/ // define getter functions for harmony exports |
21 /******/ // define getter functions for harmony exports |
110 /******/ __webpack_require__.d = function(exports, definition) { |
22 /******/ __webpack_require__.d = (exports, definition) => { |
111 /******/ for(var key in definition) { |
23 /******/ for(var key in definition) { |
112 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
24 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
113 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
25 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
114 /******/ } |
26 /******/ } |
115 /******/ } |
27 /******/ } |
116 /******/ }; |
28 /******/ }; |
117 /******/ }(); |
29 /******/ })(); |
118 /******/ |
30 /******/ |
119 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
31 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
120 /******/ !function() { |
32 /******/ (() => { |
121 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
33 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
122 /******/ }(); |
34 /******/ })(); |
123 /******/ |
35 /******/ |
124 /******/ /* webpack/runtime/make namespace object */ |
36 /******/ /* webpack/runtime/make namespace object */ |
125 /******/ !function() { |
37 /******/ (() => { |
126 /******/ // define __esModule on exports |
38 /******/ // define __esModule on exports |
127 /******/ __webpack_require__.r = function(exports) { |
39 /******/ __webpack_require__.r = (exports) => { |
128 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
40 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
129 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
41 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
130 /******/ } |
42 /******/ } |
131 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
43 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
132 /******/ }; |
44 /******/ }; |
133 /******/ }(); |
45 /******/ })(); |
134 /******/ |
46 /******/ |
135 /************************************************************************/ |
47 /************************************************************************/ |
136 var __webpack_exports__ = {}; |
48 var __webpack_exports__ = {}; |
137 // This entry need to be wrapped in an IIFE because it need to be in strict mode. |
|
138 !function() { |
|
139 "use strict"; |
|
140 // ESM COMPAT FLAG |
49 // ESM COMPAT FLAG |
141 __webpack_require__.r(__webpack_exports__); |
50 __webpack_require__.r(__webpack_exports__); |
142 |
51 |
143 // EXPORTS |
52 // EXPORTS |
144 __webpack_require__.d(__webpack_exports__, { |
53 __webpack_require__.d(__webpack_exports__, { |
145 "MoveToWidgetArea": function() { return /* reexport */ MoveToWidgetArea; }, |
54 MoveToWidgetArea: () => (/* reexport */ MoveToWidgetArea), |
146 "addWidgetIdToBlock": function() { return /* reexport */ addWidgetIdToBlock; }, |
55 addWidgetIdToBlock: () => (/* reexport */ addWidgetIdToBlock), |
147 "getWidgetIdFromBlock": function() { return /* reexport */ getWidgetIdFromBlock; }, |
56 getWidgetIdFromBlock: () => (/* reexport */ getWidgetIdFromBlock), |
148 "registerLegacyWidgetBlock": function() { return /* binding */ registerLegacyWidgetBlock; }, |
57 registerLegacyWidgetBlock: () => (/* binding */ registerLegacyWidgetBlock), |
149 "registerLegacyWidgetVariations": function() { return /* reexport */ registerLegacyWidgetVariations; }, |
58 registerLegacyWidgetVariations: () => (/* reexport */ registerLegacyWidgetVariations), |
150 "registerWidgetGroupBlock": function() { return /* binding */ registerWidgetGroupBlock; } |
59 registerWidgetGroupBlock: () => (/* binding */ registerWidgetGroupBlock) |
151 }); |
60 }); |
152 |
61 |
153 // NAMESPACE OBJECT: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/index.js |
62 // NAMESPACE OBJECT: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/index.js |
154 var legacy_widget_namespaceObject = {}; |
63 var legacy_widget_namespaceObject = {}; |
155 __webpack_require__.r(legacy_widget_namespaceObject); |
64 __webpack_require__.r(legacy_widget_namespaceObject); |
156 __webpack_require__.d(legacy_widget_namespaceObject, { |
65 __webpack_require__.d(legacy_widget_namespaceObject, { |
157 "metadata": function() { return metadata; }, |
66 metadata: () => (metadata), |
158 "name": function() { return legacy_widget_name; }, |
67 name: () => (legacy_widget_name), |
159 "settings": function() { return settings; } |
68 settings: () => (settings) |
160 }); |
69 }); |
161 |
70 |
162 // NAMESPACE OBJECT: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/index.js |
71 // NAMESPACE OBJECT: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/index.js |
163 var widget_group_namespaceObject = {}; |
72 var widget_group_namespaceObject = {}; |
164 __webpack_require__.r(widget_group_namespaceObject); |
73 __webpack_require__.r(widget_group_namespaceObject); |
165 __webpack_require__.d(widget_group_namespaceObject, { |
74 __webpack_require__.d(widget_group_namespaceObject, { |
166 "metadata": function() { return widget_group_metadata; }, |
75 metadata: () => (widget_group_metadata), |
167 "name": function() { return widget_group_name; }, |
76 name: () => (widget_group_name), |
168 "settings": function() { return widget_group_settings; } |
77 settings: () => (widget_group_settings) |
169 }); |
78 }); |
170 |
79 |
171 ;// CONCATENATED MODULE: external ["wp","blocks"] |
80 ;// CONCATENATED MODULE: external ["wp","blocks"] |
172 var external_wp_blocks_namespaceObject = window["wp"]["blocks"]; |
81 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; |
|
82 ;// CONCATENATED MODULE: external ["wp","primitives"] |
|
83 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
|
84 ;// CONCATENATED MODULE: external "ReactJSXRuntime" |
|
85 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; |
|
86 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/widget.js |
|
87 /** |
|
88 * WordPress dependencies |
|
89 */ |
|
90 |
|
91 |
|
92 const widget = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
|
93 xmlns: "http://www.w3.org/2000/svg", |
|
94 viewBox: "0 0 24 24", |
|
95 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { |
|
96 d: "M6 3H8V5H16V3H18V5C19.1046 5 20 5.89543 20 7V19C20 20.1046 19.1046 21 18 21H6C4.89543 21 4 20.1046 4 19V7C4 5.89543 4.89543 5 6 5V3ZM18 6.5H6C5.72386 6.5 5.5 6.72386 5.5 7V8H18.5V7C18.5 6.72386 18.2761 6.5 18 6.5ZM18.5 9.5H5.5V19C5.5 19.2761 5.72386 19.5 6 19.5H18C18.2761 19.5 18.5 19.2761 18.5 19V9.5ZM11 11H13V13H11V11ZM7 11V13H9V11H7ZM15 13V11H17V13H15Z" |
|
97 }) |
|
98 }); |
|
99 /* harmony default export */ const library_widget = (widget); |
|
100 |
|
101 ;// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.mjs |
|
102 function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); |
|
103 ;// CONCATENATED MODULE: external ["wp","blockEditor"] |
|
104 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; |
|
105 ;// CONCATENATED MODULE: external ["wp","components"] |
|
106 const external_wp_components_namespaceObject = window["wp"]["components"]; |
|
107 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/brush.js |
|
108 /** |
|
109 * WordPress dependencies |
|
110 */ |
|
111 |
|
112 |
|
113 const brush = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
|
114 xmlns: "http://www.w3.org/2000/svg", |
|
115 viewBox: "0 0 24 24", |
|
116 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { |
|
117 d: "M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z" |
|
118 }) |
|
119 }); |
|
120 /* harmony default export */ const library_brush = (brush); |
|
121 |
|
122 ;// CONCATENATED MODULE: external ["wp","i18n"] |
|
123 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
173 ;// CONCATENATED MODULE: external ["wp","element"] |
124 ;// CONCATENATED MODULE: external ["wp","element"] |
174 var external_wp_element_namespaceObject = window["wp"]["element"]; |
125 const external_wp_element_namespaceObject = window["wp"]["element"]; |
175 ;// CONCATENATED MODULE: external ["wp","primitives"] |
|
176 var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
|
177 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/widget.js |
|
178 |
|
179 |
|
180 /** |
|
181 * WordPress dependencies |
|
182 */ |
|
183 |
|
184 const widget = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
185 xmlns: "http://www.w3.org/2000/svg", |
|
186 viewBox: "0 0 24 24" |
|
187 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
188 d: "M6 3H8V5H16V3H18V5C19.1046 5 20 5.89543 20 7V19C20 20.1046 19.1046 21 18 21H6C4.89543 21 4 20.1046 4 19V7C4 5.89543 4.89543 5 6 5V3ZM18 6.5H6C5.72386 6.5 5.5 6.72386 5.5 7V8H18.5V7C18.5 6.72386 18.2761 6.5 18 6.5ZM18.5 9.5H5.5V19C5.5 19.2761 5.72386 19.5 6 19.5H18C18.2761 19.5 18.5 19.2761 18.5 19V9.5ZM11 11H13V13H11V11ZM7 11V13H9V11H7ZM15 13V11H17V13H15Z" |
|
189 })); |
|
190 /* harmony default export */ var library_widget = (widget); |
|
191 |
|
192 // EXTERNAL MODULE: ./node_modules/classnames/index.js |
|
193 var classnames = __webpack_require__(4403); |
|
194 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); |
|
195 ;// CONCATENATED MODULE: external ["wp","blockEditor"] |
|
196 var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; |
|
197 ;// CONCATENATED MODULE: external ["wp","components"] |
|
198 var external_wp_components_namespaceObject = window["wp"]["components"]; |
|
199 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/brush.js |
|
200 |
|
201 |
|
202 /** |
|
203 * WordPress dependencies |
|
204 */ |
|
205 |
|
206 const brush = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
207 xmlns: "http://www.w3.org/2000/svg", |
|
208 viewBox: "0 0 24 24" |
|
209 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
210 d: "M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z" |
|
211 })); |
|
212 /* harmony default export */ var library_brush = (brush); |
|
213 |
|
214 ;// CONCATENATED MODULE: external ["wp","i18n"] |
|
215 var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
|
216 ;// CONCATENATED MODULE: external ["wp","data"] |
126 ;// CONCATENATED MODULE: external ["wp","data"] |
217 var external_wp_data_namespaceObject = window["wp"]["data"]; |
127 const external_wp_data_namespaceObject = window["wp"]["data"]; |
218 ;// CONCATENATED MODULE: external ["wp","coreData"] |
128 ;// CONCATENATED MODULE: external ["wp","coreData"] |
219 var external_wp_coreData_namespaceObject = window["wp"]["coreData"]; |
129 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; |
220 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/widget-type-selector.js |
130 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/widget-type-selector.js |
221 |
131 /** |
222 |
132 * WordPress dependencies |
223 /** |
133 */ |
224 * WordPress dependencies |
134 |
225 */ |
135 |
226 |
136 |
227 |
137 |
228 |
138 |
229 |
139 |
230 |
140 function WidgetTypeSelector({ |
231 function WidgetTypeSelector(_ref) { |
141 selectedId, |
232 let { |
142 onSelect |
233 selectedId, |
143 }) { |
234 onSelect |
|
235 } = _ref; |
|
236 const widgetTypes = (0,external_wp_data_namespaceObject.useSelect)(select => { |
144 const widgetTypes = (0,external_wp_data_namespaceObject.useSelect)(select => { |
237 var _select$getSettings$w, _select$getSettings, _select$getWidgetType; |
145 var _select$getSettings$w; |
238 |
146 const hiddenIds = (_select$getSettings$w = select(external_wp_blockEditor_namespaceObject.store).getSettings()?.widgetTypesToHideFromLegacyWidgetBlock) !== null && _select$getSettings$w !== void 0 ? _select$getSettings$w : []; |
239 const hiddenIds = (_select$getSettings$w = (_select$getSettings = select(external_wp_blockEditor_namespaceObject.store).getSettings()) === null || _select$getSettings === void 0 ? void 0 : _select$getSettings.widgetTypesToHideFromLegacyWidgetBlock) !== null && _select$getSettings$w !== void 0 ? _select$getSettings$w : []; |
147 return select(external_wp_coreData_namespaceObject.store).getWidgetTypes({ |
240 return (_select$getWidgetType = select(external_wp_coreData_namespaceObject.store).getWidgetTypes({ |
|
241 per_page: -1 |
148 per_page: -1 |
242 })) === null || _select$getWidgetType === void 0 ? void 0 : _select$getWidgetType.filter(widgetType => !hiddenIds.includes(widgetType.id)); |
149 })?.filter(widgetType => !hiddenIds.includes(widgetType.id)); |
243 }, []); |
150 }, []); |
244 |
|
245 if (!widgetTypes) { |
151 if (!widgetTypes) { |
246 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null); |
152 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}); |
247 } |
153 } |
248 |
|
249 if (widgetTypes.length === 0) { |
154 if (widgetTypes.length === 0) { |
250 return (0,external_wp_i18n_namespaceObject.__)('There are no widgets available.'); |
155 return (0,external_wp_i18n_namespaceObject.__)('There are no widgets available.'); |
251 } |
156 } |
252 |
157 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { |
253 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, { |
158 __nextHasNoMarginBottom: true, |
254 label: (0,external_wp_i18n_namespaceObject.__)('Select a legacy widget to display:'), |
159 label: (0,external_wp_i18n_namespaceObject.__)('Select a legacy widget to display:'), |
255 value: selectedId !== null && selectedId !== void 0 ? selectedId : '', |
160 value: selectedId !== null && selectedId !== void 0 ? selectedId : '', |
256 options: [{ |
161 options: [{ |
257 value: '', |
162 value: '', |
258 label: (0,external_wp_i18n_namespaceObject.__)('Select widget') |
163 label: (0,external_wp_i18n_namespaceObject.__)('Select widget') |
758 |
628 |
759 |
629 |
760 |
630 |
761 |
631 |
762 |
632 |
763 |
|
764 /** |
633 /** |
765 * Internal dependencies |
634 * Internal dependencies |
766 */ |
635 */ |
767 |
636 |
768 |
637 |
769 function Form(_ref) { |
638 |
770 let { |
639 function Form({ |
771 title, |
640 title, |
772 isVisible, |
641 isVisible, |
773 id, |
642 id, |
774 idBase, |
643 idBase, |
775 instance, |
644 instance, |
776 isWide, |
645 isWide, |
777 onChangeInstance, |
646 onChangeInstance, |
778 onChangeHasPreview |
647 onChangeHasPreview |
779 } = _ref; |
648 }) { |
780 const ref = (0,external_wp_element_namespaceObject.useRef)(); |
649 const ref = (0,external_wp_element_namespaceObject.useRef)(); |
781 const isMediumLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small'); // We only want to remount the control when the instance changes |
650 const isMediumLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small'); |
|
651 |
|
652 // We only want to remount the control when the instance changes |
782 // *externally*. For example, if the user performs an undo. To do this, we |
653 // *externally*. For example, if the user performs an undo. To do this, we |
783 // keep track of changes made to instance by the control itself and then |
654 // keep track of changes made to instance by the control itself and then |
784 // ignore those. |
655 // ignore those. |
785 |
|
786 const outgoingInstances = (0,external_wp_element_namespaceObject.useRef)(new Set()); |
656 const outgoingInstances = (0,external_wp_element_namespaceObject.useRef)(new Set()); |
787 const incomingInstances = (0,external_wp_element_namespaceObject.useRef)(new Set()); |
657 const incomingInstances = (0,external_wp_element_namespaceObject.useRef)(new Set()); |
788 const { |
658 const { |
789 createNotice |
659 createNotice |
790 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
660 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
791 (0,external_wp_element_namespaceObject.useEffect)(() => { |
661 (0,external_wp_element_namespaceObject.useEffect)(() => { |
792 if (incomingInstances.current.has(instance)) { |
662 if (incomingInstances.current.has(instance)) { |
793 incomingInstances.current.delete(instance); |
663 incomingInstances.current.delete(instance); |
794 return; |
664 return; |
795 } |
665 } |
796 |
|
797 const control = new Control({ |
666 const control = new Control({ |
798 id, |
667 id, |
799 idBase, |
668 idBase, |
800 instance, |
669 instance, |
801 |
|
802 onChangeInstance(nextInstance) { |
670 onChangeInstance(nextInstance) { |
803 outgoingInstances.current.add(instance); |
671 outgoingInstances.current.add(instance); |
804 incomingInstances.current.add(nextInstance); |
672 incomingInstances.current.add(nextInstance); |
805 onChangeInstance(nextInstance); |
673 onChangeInstance(nextInstance); |
806 }, |
674 }, |
807 |
|
808 onChangeHasPreview, |
675 onChangeHasPreview, |
809 |
|
810 onError(error) { |
676 onError(error) { |
811 window.console.error(error); |
677 window.console.error(error); |
812 createNotice('error', (0,external_wp_i18n_namespaceObject.sprintf)( |
678 createNotice('error', (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the name of the affected block. */ |
813 /* translators: %s: the name of the affected block. */ |
|
814 (0,external_wp_i18n_namespaceObject.__)('The "%s" block was affected by errors and may not function properly. Check the developer tools for more details.'), idBase || id)); |
679 (0,external_wp_i18n_namespaceObject.__)('The "%s" block was affected by errors and may not function properly. Check the developer tools for more details.'), idBase || id)); |
815 } |
680 } |
816 |
|
817 }); |
681 }); |
818 ref.current.appendChild(control.element); |
682 ref.current.appendChild(control.element); |
819 return () => { |
683 return () => { |
820 if (outgoingInstances.current.has(instance)) { |
684 if (outgoingInstances.current.has(instance)) { |
821 outgoingInstances.current.delete(instance); |
685 outgoingInstances.current.delete(instance); |
822 return; |
686 return; |
823 } |
687 } |
824 |
|
825 control.destroy(); |
688 control.destroy(); |
826 }; |
689 }; |
827 }, [id, idBase, instance, onChangeInstance, onChangeHasPreview, isMediumLargeViewport]); |
690 }, [id, idBase, instance, onChangeInstance, onChangeHasPreview, isMediumLargeViewport]); |
828 |
|
829 if (isWide && isMediumLargeViewport) { |
691 if (isWide && isMediumLargeViewport) { |
830 return (0,external_wp_element_namespaceObject.createElement)("div", { |
692 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { |
831 className: classnames_default()({ |
693 className: dist_clsx({ |
832 'wp-block-legacy-widget__container': isVisible |
694 'wp-block-legacy-widget__container': isVisible |
833 }) |
695 }), |
834 }, isVisible && (0,external_wp_element_namespaceObject.createElement)("h3", { |
696 children: [isVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { |
835 className: "wp-block-legacy-widget__edit-form-title" |
697 className: "wp-block-legacy-widget__edit-form-title", |
836 }, title), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, { |
698 children: title |
837 focusOnMount: false, |
699 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { |
838 position: "middle right", |
700 focusOnMount: false, |
839 __unstableForceXAlignment: true |
701 placement: "right", |
840 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
702 offset: 32, |
841 ref: ref, |
703 resize: false, |
842 className: "wp-block-legacy-widget__edit-form", |
704 flip: false, |
843 hidden: !isVisible |
705 shift: true, |
844 }))); |
706 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
845 } |
707 ref: ref, |
846 |
708 className: "wp-block-legacy-widget__edit-form", |
847 return (0,external_wp_element_namespaceObject.createElement)("div", { |
709 hidden: !isVisible |
|
710 }) |
|
711 })] |
|
712 }); |
|
713 } |
|
714 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
848 ref: ref, |
715 ref: ref, |
849 className: "wp-block-legacy-widget__edit-form", |
716 className: "wp-block-legacy-widget__edit-form", |
850 hidden: !isVisible |
717 hidden: !isVisible, |
851 }, (0,external_wp_element_namespaceObject.createElement)("h3", { |
718 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { |
852 className: "wp-block-legacy-widget__edit-form-title" |
719 className: "wp-block-legacy-widget__edit-form-title", |
853 }, title)); |
720 children: title |
|
721 }) |
|
722 }); |
854 } |
723 } |
855 |
724 |
856 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/preview.js |
725 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/preview.js |
857 |
|
858 |
|
859 /** |
726 /** |
860 * External dependencies |
727 * External dependencies |
861 */ |
728 */ |
862 |
729 |
863 /** |
730 |
864 * WordPress dependencies |
731 /** |
865 */ |
732 * WordPress dependencies |
866 |
733 */ |
867 |
734 |
868 |
735 |
869 |
736 |
870 |
737 |
871 |
738 |
872 function Preview(_ref) { |
739 |
873 let { |
740 |
874 idBase, |
741 |
875 instance, |
742 function Preview({ |
876 isVisible |
743 idBase, |
877 } = _ref; |
744 instance, |
|
745 isVisible |
|
746 }) { |
878 const [isLoaded, setIsLoaded] = (0,external_wp_element_namespaceObject.useState)(false); |
747 const [isLoaded, setIsLoaded] = (0,external_wp_element_namespaceObject.useState)(false); |
879 const [srcDoc, setSrcDoc] = (0,external_wp_element_namespaceObject.useState)(''); |
748 const [srcDoc, setSrcDoc] = (0,external_wp_element_namespaceObject.useState)(''); |
880 (0,external_wp_element_namespaceObject.useEffect)(() => { |
749 (0,external_wp_element_namespaceObject.useEffect)(() => { |
881 const abortController = typeof window.AbortController === 'undefined' ? undefined : new window.AbortController(); |
750 const abortController = typeof window.AbortController === 'undefined' ? undefined : new window.AbortController(); |
882 |
|
883 async function fetchPreviewHTML() { |
751 async function fetchPreviewHTML() { |
884 const restRoute = `/wp/v2/widget-types/${idBase}/render`; |
752 const restRoute = `/wp/v2/widget-types/${idBase}/render`; |
885 return await external_wp_apiFetch_default()({ |
753 return await external_wp_apiFetch_default()({ |
886 path: restRoute, |
754 path: restRoute, |
887 method: 'POST', |
755 method: 'POST', |
888 signal: abortController === null || abortController === void 0 ? void 0 : abortController.signal, |
756 signal: abortController?.signal, |
889 data: instance ? { |
757 data: instance ? { |
890 instance |
758 instance |
891 } : {} |
759 } : {} |
892 }); |
760 }); |
893 } |
761 } |
894 |
|
895 fetchPreviewHTML().then(response => { |
762 fetchPreviewHTML().then(response => { |
896 setSrcDoc(response.preview); |
763 setSrcDoc(response.preview); |
897 }).catch(error => { |
764 }).catch(error => { |
898 if ('AbortError' === error.name) { |
765 if ('AbortError' === error.name) { |
899 // We don't want to log aborted requests. |
766 // We don't want to log aborted requests. |
900 return; |
767 return; |
901 } |
768 } |
902 |
|
903 throw error; |
769 throw error; |
904 }); |
770 }); |
905 return () => abortController === null || abortController === void 0 ? void 0 : abortController.abort(); |
771 return () => abortController?.abort(); |
906 }, [idBase, instance]); // Resize the iframe on either the load event, or when the iframe becomes visible. |
772 }, [idBase, instance]); |
907 |
773 |
|
774 // Resize the iframe on either the load event, or when the iframe becomes visible. |
908 const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(iframe => { |
775 const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(iframe => { |
909 // Only set height if the iframe is loaded, |
776 // Only set height if the iframe is loaded, |
910 // or it will grow to an unexpected large height in Safari if it's hidden initially. |
777 // or it will grow to an unexpected large height in Safari if it's hidden initially. |
911 if (!isLoaded) { |
778 if (!isLoaded) { |
912 return; |
779 return; |
913 } // If the preview frame has another origin then this won't work. |
780 } |
|
781 // If the preview frame has another origin then this won't work. |
914 // One possible solution is to add custom script to call `postMessage` in the preview frame. |
782 // One possible solution is to add custom script to call `postMessage` in the preview frame. |
915 // Or, better yet, we migrate away from iframe. |
783 // Or, better yet, we migrate away from iframe. |
916 |
|
917 |
|
918 function setHeight() { |
784 function setHeight() { |
|
785 var _iframe$contentDocume, _iframe$contentDocume2; |
919 // Pick the maximum of these two values to account for margin collapsing. |
786 // Pick the maximum of these two values to account for margin collapsing. |
920 const height = Math.max(iframe.contentDocument.documentElement.offsetHeight, iframe.contentDocument.body.offsetHeight); |
787 const height = Math.max((_iframe$contentDocume = iframe.contentDocument.documentElement?.offsetHeight) !== null && _iframe$contentDocume !== void 0 ? _iframe$contentDocume : 0, (_iframe$contentDocume2 = iframe.contentDocument.body?.offsetHeight) !== null && _iframe$contentDocume2 !== void 0 ? _iframe$contentDocume2 : 0); |
921 iframe.style.height = `${height}px`; |
788 |
922 } |
789 // Fallback to a height of 100px if the height cannot be determined. |
923 |
790 // This ensures the block is still selectable. 100px should hopefully |
|
791 // be not so big that it's annoying, and not so small that nothing |
|
792 // can be seen. |
|
793 iframe.style.height = `${height !== 0 ? height : 100}px`; |
|
794 } |
924 const { |
795 const { |
925 IntersectionObserver |
796 IntersectionObserver |
926 } = iframe.ownerDocument.defaultView; // Observe for intersections that might cause a change in the height of |
797 } = iframe.ownerDocument.defaultView; |
|
798 |
|
799 // Observe for intersections that might cause a change in the height of |
927 // the iframe, e.g. a Widget Area becoming expanded. |
800 // the iframe, e.g. a Widget Area becoming expanded. |
928 |
801 const intersectionObserver = new IntersectionObserver(([entry]) => { |
929 const intersectionObserver = new IntersectionObserver(_ref2 => { |
|
930 let [entry] = _ref2; |
|
931 |
|
932 if (entry.isIntersecting) { |
802 if (entry.isIntersecting) { |
933 setHeight(); |
803 setHeight(); |
934 } |
804 } |
935 }, { |
805 }, { |
936 threshold: 1 |
806 threshold: 1 |
940 return () => { |
810 return () => { |
941 intersectionObserver.disconnect(); |
811 intersectionObserver.disconnect(); |
942 iframe.removeEventListener('load', setHeight); |
812 iframe.removeEventListener('load', setHeight); |
943 }; |
813 }; |
944 }, [isLoaded]); |
814 }, [isLoaded]); |
945 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isVisible && !isLoaded && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)), (0,external_wp_element_namespaceObject.createElement)("div", { |
815 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
946 className: classnames_default()('wp-block-legacy-widget__edit-preview', { |
816 children: [isVisible && !isLoaded && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { |
947 'is-offscreen': !isVisible || !isLoaded |
817 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) |
948 }) |
818 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
949 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, null, (0,external_wp_element_namespaceObject.createElement)("iframe", { |
819 className: dist_clsx('wp-block-legacy-widget__edit-preview', { |
950 ref: ref, |
820 'is-offscreen': !isVisible || !isLoaded |
951 className: "wp-block-legacy-widget__edit-preview-iframe", |
821 }), |
952 tabIndex: "-1", |
822 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { |
953 title: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget Preview'), |
823 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("iframe", { |
954 srcDoc: srcDoc, |
824 ref: ref, |
955 onLoad: event => { |
825 className: "wp-block-legacy-widget__edit-preview-iframe", |
956 // To hide the scrollbars of the preview frame for some edge cases, |
826 tabIndex: "-1", |
957 // such as negative margins in the Gallery Legacy Widget. |
827 title: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget Preview'), |
958 // It can't be scrolled anyway. |
828 srcDoc: srcDoc, |
959 // TODO: Ideally, this should be fixed in core. |
829 onLoad: event => { |
960 event.target.contentDocument.body.style.overflow = 'hidden'; |
830 // To hide the scrollbars of the preview frame for some edge cases, |
961 setIsLoaded(true); |
831 // such as negative margins in the Gallery Legacy Widget. |
962 }, |
832 // It can't be scrolled anyway. |
963 height: 100 |
833 // TODO: Ideally, this should be fixed in core. |
964 })))); |
834 event.target.contentDocument.body.style.overflow = 'hidden'; |
|
835 setIsLoaded(true); |
|
836 }, |
|
837 height: 100 |
|
838 }) |
|
839 }) |
|
840 })] |
|
841 }); |
965 } |
842 } |
966 |
843 |
967 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/no-preview.js |
844 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/no-preview.js |
968 |
845 /** |
969 |
846 * WordPress dependencies |
970 /** |
847 */ |
971 * WordPress dependencies |
848 |
972 */ |
849 |
973 |
850 |
974 function NoPreview(_ref) { |
851 function NoPreview({ |
975 let { |
852 name |
976 name |
853 }) { |
977 } = _ref; |
854 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { |
978 return (0,external_wp_element_namespaceObject.createElement)("div", { |
855 className: "wp-block-legacy-widget__edit-no-preview", |
979 className: "wp-block-legacy-widget__edit-no-preview" |
856 children: [name && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { |
980 }, name && (0,external_wp_element_namespaceObject.createElement)("h3", null, name), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No preview available.'))); |
857 children: name |
|
858 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
|
859 children: (0,external_wp_i18n_namespaceObject.__)('No preview available.') |
|
860 })] |
|
861 }); |
981 } |
862 } |
982 |
863 |
983 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js |
864 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js |
984 |
865 /** |
985 |
866 * WordPress dependencies |
986 /** |
867 */ |
987 * WordPress dependencies |
868 |
988 */ |
869 |
989 |
870 |
990 |
871 |
991 |
872 |
992 |
873 |
993 |
874 function ConvertToBlocksButton({ |
994 function ConvertToBlocksButton(_ref) { |
875 clientId, |
995 let { |
876 rawInstance |
996 clientId, |
877 }) { |
997 rawInstance |
|
998 } = _ref; |
|
999 const { |
878 const { |
1000 replaceBlocks |
879 replaceBlocks |
1001 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
880 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
1002 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, { |
881 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { |
1003 onClick: () => { |
882 onClick: () => { |
1004 if (rawInstance.title) { |
883 if (rawInstance.title) { |
1005 replaceBlocks(clientId, [(0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { |
884 replaceBlocks(clientId, [(0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { |
1006 content: rawInstance.title |
885 content: rawInstance.title |
1007 }), ...(0,external_wp_blocks_namespaceObject.rawHandler)({ |
886 }), ...(0,external_wp_blocks_namespaceObject.rawHandler)({ |
1051 } = props.attributes; |
932 } = props.attributes; |
1052 const { |
933 const { |
1053 isWide = false |
934 isWide = false |
1054 } = props; |
935 } = props; |
1055 const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ |
936 const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ |
1056 className: classnames_default()({ |
937 className: dist_clsx({ |
1057 'is-wide-widget': isWide |
938 'is-wide-widget': isWide |
1058 }) |
939 }) |
1059 }); |
940 }); |
1060 return (0,external_wp_element_namespaceObject.createElement)("div", blockProps, !id && !idBase ? (0,external_wp_element_namespaceObject.createElement)(Empty, props) : (0,external_wp_element_namespaceObject.createElement)(NotEmpty, props)); |
941 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
1061 } |
942 ...blockProps, |
1062 |
943 children: !id && !idBase ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Empty, { |
1063 function Empty(_ref) { |
944 ...props |
1064 let { |
945 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NotEmpty, { |
1065 attributes: { |
946 ...props |
1066 id, |
947 }) |
1067 idBase |
948 }); |
1068 }, |
949 } |
1069 setAttributes |
950 function Empty({ |
1070 } = _ref; |
951 attributes: { |
1071 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, { |
952 id, |
1072 icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
953 idBase |
|
954 }, |
|
955 setAttributes |
|
956 }) { |
|
957 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { |
|
958 icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
1073 icon: library_brush |
959 icon: library_brush |
1074 }), |
960 }), |
1075 label: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget') |
961 label: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget'), |
1076 }, (0,external_wp_element_namespaceObject.createElement)(WidgetTypeSelector, { |
962 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { |
1077 selectedId: id !== null && id !== void 0 ? id : idBase, |
963 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { |
1078 onSelect: _ref2 => { |
964 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WidgetTypeSelector, { |
1079 let { |
965 selectedId: id !== null && id !== void 0 ? id : idBase, |
1080 selectedId, |
966 onSelect: ({ |
1081 isMulti |
967 selectedId, |
1082 } = _ref2; |
968 isMulti |
1083 |
969 }) => { |
1084 if (!selectedId) { |
970 if (!selectedId) { |
1085 setAttributes({ |
971 setAttributes({ |
1086 id: null, |
972 id: null, |
1087 idBase: null, |
973 idBase: null, |
1088 instance: null |
974 instance: null |
1089 }); |
975 }); |
1090 } else if (isMulti) { |
976 } else if (isMulti) { |
1091 setAttributes({ |
977 setAttributes({ |
1092 id: null, |
978 id: null, |
1093 idBase: selectedId, |
979 idBase: selectedId, |
1094 instance: {} |
980 instance: {} |
1095 }); |
981 }); |
1096 } else { |
982 } else { |
1097 setAttributes({ |
983 setAttributes({ |
1098 id: selectedId, |
984 id: selectedId, |
1099 idBase: null, |
985 idBase: null, |
1100 instance: null |
986 instance: null |
1101 }); |
987 }); |
1102 } |
988 } |
1103 } |
989 } |
1104 })); |
990 }) |
1105 } |
991 }) |
1106 |
992 }) |
1107 function NotEmpty(_ref3) { |
993 }); |
1108 let { |
994 } |
1109 attributes: { |
995 function NotEmpty({ |
1110 id, |
996 attributes: { |
1111 idBase, |
997 id, |
1112 instance |
998 idBase, |
1113 }, |
999 instance |
1114 setAttributes, |
1000 }, |
1115 clientId, |
1001 setAttributes, |
1116 isSelected, |
1002 clientId, |
1117 isWide = false |
1003 isSelected, |
1118 } = _ref3; |
1004 isWide = false |
|
1005 }) { |
1119 const [hasPreview, setHasPreview] = (0,external_wp_element_namespaceObject.useState)(null); |
1006 const [hasPreview, setHasPreview] = (0,external_wp_element_namespaceObject.useState)(null); |
1120 const widgetTypeId = id !== null && id !== void 0 ? id : idBase; |
1007 const widgetTypeId = id !== null && id !== void 0 ? id : idBase; |
1121 const { |
1008 const { |
1122 record: widgetType, |
1009 record: widgetType, |
1123 hasResolved: hasResolvedWidgetType |
1010 hasResolved: hasResolvedWidgetType |
1124 } = (0,external_wp_coreData_namespaceObject.__experimentalUseEntityRecord)('root', 'widgetType', widgetTypeId); |
1011 } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'widgetType', widgetTypeId); |
1125 const isNavigationMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).isNavigationMode(), []); |
1012 const isNavigationMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).isNavigationMode(), []); |
1126 const setInstance = (0,external_wp_element_namespaceObject.useCallback)(nextInstance => { |
1013 const setInstance = (0,external_wp_element_namespaceObject.useCallback)(nextInstance => { |
1127 setAttributes({ |
1014 setAttributes({ |
1128 instance: nextInstance |
1015 instance: nextInstance |
1129 }); |
1016 }); |
1130 }, []); |
1017 }, []); |
1131 |
|
1132 if (!widgetType && hasResolvedWidgetType) { |
1018 if (!widgetType && hasResolvedWidgetType) { |
1133 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, { |
1019 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { |
1134 icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
1020 icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
1135 icon: library_brush |
1021 icon: library_brush |
1136 }), |
1022 }), |
1137 label: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget') |
1023 label: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget'), |
1138 }, (0,external_wp_i18n_namespaceObject.__)('Widget is missing.')); |
1024 children: (0,external_wp_i18n_namespaceObject.__)('Widget is missing.') |
1139 } |
1025 }); |
1140 |
1026 } |
1141 if (!hasResolvedWidgetType) { |
1027 if (!hasResolvedWidgetType) { |
1142 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)); |
1028 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { |
1143 } |
1029 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) |
1144 |
1030 }); |
|
1031 } |
1145 const mode = idBase && (isNavigationMode || !isSelected) ? 'preview' : 'edit'; |
1032 const mode = idBase && (isNavigationMode || !isSelected) ? 'preview' : 'edit'; |
1146 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, idBase === 'text' && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, { |
1033 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
1147 group: "other" |
1034 children: [idBase === 'text' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { |
1148 }, (0,external_wp_element_namespaceObject.createElement)(ConvertToBlocksButton, { |
1035 group: "other", |
1149 clientId: clientId, |
1036 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToBlocksButton, { |
1150 rawInstance: instance.raw |
1037 clientId: clientId, |
1151 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_wp_element_namespaceObject.createElement)(InspectorCard, { |
1038 rawInstance: instance.raw |
1152 name: widgetType.name, |
1039 }) |
1153 description: widgetType.description |
1040 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { |
1154 })), (0,external_wp_element_namespaceObject.createElement)(Form, { |
1041 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorCard, { |
1155 title: widgetType.name, |
1042 name: widgetType.name, |
1156 isVisible: mode === 'edit', |
1043 description: widgetType.description |
1157 id: id, |
1044 }) |
1158 idBase: idBase, |
1045 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Form, { |
1159 instance: instance, |
1046 title: widgetType.name, |
1160 isWide: isWide, |
1047 isVisible: mode === 'edit', |
1161 onChangeInstance: setInstance, |
1048 id: id, |
1162 onChangeHasPreview: setHasPreview |
1049 idBase: idBase, |
1163 }), idBase && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, hasPreview === null && mode === 'preview' && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)), hasPreview === true && (0,external_wp_element_namespaceObject.createElement)(Preview, { |
1050 instance: instance, |
1164 idBase: idBase, |
1051 isWide: isWide, |
1165 instance: instance, |
1052 onChangeInstance: setInstance, |
1166 isVisible: mode === 'preview' |
1053 onChangeHasPreview: setHasPreview |
1167 }), hasPreview === false && mode === 'preview' && (0,external_wp_element_namespaceObject.createElement)(NoPreview, { |
1054 }), idBase && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
1168 name: widgetType.name |
1055 children: [hasPreview === null && mode === 'preview' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { |
1169 }))); |
1056 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) |
|
1057 }), hasPreview === true && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Preview, { |
|
1058 idBase: idBase, |
|
1059 instance: instance, |
|
1060 isVisible: mode === 'preview' |
|
1061 }), hasPreview === false && mode === 'preview' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NoPreview, { |
|
1062 name: widgetType.name |
|
1063 })] |
|
1064 })] |
|
1065 }); |
1170 } |
1066 } |
1171 |
1067 |
1172 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/transforms.js |
1068 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/transforms.js |
1173 /** |
1069 /** |
1174 * WordPress dependencies |
1070 * WordPress dependencies |
1181 block: 'core/search', |
1077 block: 'core/search', |
1182 widget: 'search' |
1078 widget: 'search' |
1183 }, { |
1079 }, { |
1184 block: 'core/html', |
1080 block: 'core/html', |
1185 widget: 'custom_html', |
1081 widget: 'custom_html', |
1186 transform: _ref => { |
1082 transform: ({ |
1187 let { |
1083 content |
1188 content |
1084 }) => ({ |
1189 } = _ref; |
1085 content |
1190 return { |
1086 }) |
1191 content |
|
1192 }; |
|
1193 } |
|
1194 }, { |
1087 }, { |
1195 block: 'core/archives', |
1088 block: 'core/archives', |
1196 widget: 'archives', |
1089 widget: 'archives', |
1197 transform: _ref2 => { |
1090 transform: ({ |
1198 let { |
1091 count, |
1199 count, |
1092 dropdown |
1200 dropdown |
1093 }) => { |
1201 } = _ref2; |
|
1202 return { |
1094 return { |
1203 displayAsDropdown: !!dropdown, |
1095 displayAsDropdown: !!dropdown, |
1204 showPostCounts: !!count |
1096 showPostCounts: !!count |
1205 }; |
1097 }; |
1206 } |
1098 } |
1207 }, { |
1099 }, { |
1208 block: 'core/latest-posts', |
1100 block: 'core/latest-posts', |
1209 widget: 'recent-posts', |
1101 widget: 'recent-posts', |
1210 transform: _ref3 => { |
1102 transform: ({ |
1211 let { |
1103 show_date: displayPostDate, |
1212 show_date: displayPostDate, |
1104 number |
1213 number |
1105 }) => { |
1214 } = _ref3; |
|
1215 return { |
1106 return { |
1216 displayPostDate: !!displayPostDate, |
1107 displayPostDate: !!displayPostDate, |
1217 postsToShow: number |
1108 postsToShow: number |
1218 }; |
1109 }; |
1219 } |
1110 } |
1220 }, { |
1111 }, { |
1221 block: 'core/latest-comments', |
1112 block: 'core/latest-comments', |
1222 widget: 'recent-comments', |
1113 widget: 'recent-comments', |
1223 transform: _ref4 => { |
1114 transform: ({ |
1224 let { |
1115 number |
1225 number |
1116 }) => { |
1226 } = _ref4; |
|
1227 return { |
1117 return { |
1228 commentsToShow: number |
1118 commentsToShow: number |
1229 }; |
1119 }; |
1230 } |
1120 } |
1231 }, { |
1121 }, { |
1232 block: 'core/tag-cloud', |
1122 block: 'core/tag-cloud', |
1233 widget: 'tag_cloud', |
1123 widget: 'tag_cloud', |
1234 transform: _ref5 => { |
1124 transform: ({ |
1235 let { |
1125 taxonomy, |
1236 taxonomy, |
1126 count |
1237 count |
1127 }) => { |
1238 } = _ref5; |
|
1239 return { |
1128 return { |
1240 showTagCounts: !!count, |
1129 showTagCounts: !!count, |
1241 taxonomy |
1130 taxonomy |
1242 }; |
1131 }; |
1243 } |
1132 } |
1244 }, { |
1133 }, { |
1245 block: 'core/categories', |
1134 block: 'core/categories', |
1246 widget: 'categories', |
1135 widget: 'categories', |
1247 transform: _ref6 => { |
1136 transform: ({ |
1248 let { |
1137 count, |
1249 count, |
1138 dropdown, |
1250 dropdown, |
1139 hierarchical |
1251 hierarchical |
1140 }) => { |
1252 } = _ref6; |
|
1253 return { |
1141 return { |
1254 displayAsDropdown: !!dropdown, |
1142 displayAsDropdown: !!dropdown, |
1255 showPostCounts: !!count, |
1143 showPostCounts: !!count, |
1256 showHierarchy: !!hierarchical |
1144 showHierarchy: !!hierarchical |
1257 }; |
1145 }; |
1258 } |
1146 } |
1259 }, { |
1147 }, { |
1260 block: 'core/audio', |
1148 block: 'core/audio', |
1261 widget: 'media_audio', |
1149 widget: 'media_audio', |
1262 transform: _ref7 => { |
1150 transform: ({ |
1263 let { |
1151 url, |
1264 url, |
1152 preload, |
1265 preload, |
1153 loop, |
1266 loop, |
1154 attachment_id: id |
1267 attachment_id: id |
1155 }) => { |
1268 } = _ref7; |
|
1269 return { |
1156 return { |
1270 src: url, |
1157 src: url, |
1271 id, |
1158 id, |
1272 preload, |
1159 preload, |
1273 loop |
1160 loop |
1274 }; |
1161 }; |
1275 } |
1162 } |
1276 }, { |
1163 }, { |
1277 block: 'core/video', |
1164 block: 'core/video', |
1278 widget: 'media_video', |
1165 widget: 'media_video', |
1279 transform: _ref8 => { |
1166 transform: ({ |
1280 let { |
1167 url, |
1281 url, |
1168 preload, |
1282 preload, |
1169 loop, |
1283 loop, |
1170 attachment_id: id |
1284 attachment_id: id |
1171 }) => { |
1285 } = _ref8; |
|
1286 return { |
1172 return { |
1287 src: url, |
1173 src: url, |
1288 id, |
1174 id, |
1289 preload, |
1175 preload, |
1290 loop |
1176 loop |
1291 }; |
1177 }; |
1292 } |
1178 } |
1293 }, { |
1179 }, { |
1294 block: 'core/image', |
1180 block: 'core/image', |
1295 widget: 'media_image', |
1181 widget: 'media_image', |
1296 transform: _ref9 => { |
1182 transform: ({ |
1297 let { |
1183 alt, |
1298 alt, |
1184 attachment_id: id, |
1299 attachment_id: id, |
1185 caption, |
1300 caption, |
1186 height, |
1301 height, |
1187 link_classes: linkClass, |
1302 link_classes: linkClass, |
1188 link_rel: rel, |
1303 link_rel: rel, |
1189 link_target_blank: targetBlack, |
1304 link_target_blank: targetBlack, |
1190 link_type: linkDestination, |
1305 link_type: linkDestination, |
1191 link_url: link, |
1306 link_url: link, |
1192 size: sizeSlug, |
1307 size: sizeSlug, |
1193 url, |
1308 url, |
1194 width |
1309 width |
1195 }) => { |
1310 } = _ref9; |
|
1311 return { |
1196 return { |
1312 alt, |
1197 alt, |
1313 caption, |
1198 caption, |
1314 height, |
1199 height, |
1315 id, |
1200 id, |
1481 clientId |
1359 clientId |
1482 } = props; |
1360 } = props; |
1483 const { |
1361 const { |
1484 innerBlocks |
1362 innerBlocks |
1485 } = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId), [clientId]); |
1363 } = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId), [clientId]); |
1486 return (0,external_wp_element_namespaceObject.createElement)("div", (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ |
1364 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
1487 className: 'widget' |
1365 ...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({ |
1488 }), innerBlocks.length === 0 ? (0,external_wp_element_namespaceObject.createElement)(PlaceholderContent, props) : (0,external_wp_element_namespaceObject.createElement)(PreviewContent, props)); |
1366 className: 'widget' |
1489 } |
|
1490 |
|
1491 function PlaceholderContent(_ref) { |
|
1492 let { |
|
1493 clientId |
|
1494 } = _ref; |
|
1495 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, { |
|
1496 className: "wp-block-widget-group__placeholder", |
|
1497 icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
|
1498 icon: library_group |
|
1499 }), |
1367 }), |
1500 label: (0,external_wp_i18n_namespaceObject.__)('Widget Group') |
1368 children: innerBlocks.length === 0 ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PlaceholderContent, { |
1501 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ButtonBlockAppender, { |
1369 ...props |
1502 rootClientId: clientId |
1370 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewContent, { |
1503 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks, { |
1371 ...props |
1504 renderAppender: false |
1372 }) |
1505 })); |
1373 }); |
1506 } |
1374 } |
1507 |
1375 function PlaceholderContent({ |
1508 function PreviewContent(_ref2) { |
1376 clientId |
|
1377 }) { |
|
1378 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
|
1379 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { |
|
1380 className: "wp-block-widget-group__placeholder", |
|
1381 icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
|
1382 icon: library_group |
|
1383 }), |
|
1384 label: (0,external_wp_i18n_namespaceObject.__)('Widget Group'), |
|
1385 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.ButtonBlockAppender, { |
|
1386 rootClientId: clientId |
|
1387 }) |
|
1388 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks, { |
|
1389 renderAppender: false |
|
1390 })] |
|
1391 }); |
|
1392 } |
|
1393 function PreviewContent({ |
|
1394 attributes, |
|
1395 setAttributes |
|
1396 }) { |
1509 var _attributes$title; |
1397 var _attributes$title; |
1510 |
1398 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
1511 let { |
1399 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, { |
1512 attributes, |
1400 tagName: "h2", |
1513 setAttributes |
1401 identifier: "title", |
1514 } = _ref2; |
1402 className: "widget-title", |
1515 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, { |
1403 allowedFormats: [], |
1516 tagName: "h2", |
1404 placeholder: (0,external_wp_i18n_namespaceObject.__)('Title'), |
1517 className: "widget-title", |
1405 value: (_attributes$title = attributes.title) !== null && _attributes$title !== void 0 ? _attributes$title : '', |
1518 allowedFormats: [], |
1406 onChange: title => setAttributes({ |
1519 placeholder: (0,external_wp_i18n_namespaceObject.__)('Title'), |
1407 title |
1520 value: (_attributes$title = attributes.title) !== null && _attributes$title !== void 0 ? _attributes$title : '', |
1408 }) |
1521 onChange: title => setAttributes({ |
1409 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks, {})] |
1522 title |
1410 }); |
1523 }) |
|
1524 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks, null)); |
|
1525 } |
1411 } |
1526 |
1412 |
1527 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/save.js |
1413 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/save.js |
1528 |
1414 /** |
1529 |
1415 * WordPress dependencies |
1530 /** |
1416 */ |
1531 * WordPress dependencies |
1417 |
1532 */ |
1418 |
1533 |
1419 |
1534 function save(_ref) { |
1420 |
1535 let { |
1421 function save({ |
1536 attributes |
1422 attributes |
1537 } = _ref; |
1423 }) { |
1538 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, { |
1424 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
1539 tagName: "h2", |
1425 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { |
1540 className: "widget-title", |
1426 tagName: "h2", |
1541 value: attributes.title |
1427 className: "widget-title", |
1542 }), (0,external_wp_element_namespaceObject.createElement)("div", { |
1428 value: attributes.title |
1543 className: "wp-widget-group__inner-blocks" |
1429 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
1544 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null))); |
1430 className: "wp-widget-group__inner-blocks", |
|
1431 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}) |
|
1432 })] |
|
1433 }); |
1545 } |
1434 } |
1546 |
1435 |
1547 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/deprecated.js |
1436 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/deprecated.js |
1548 |
1437 /** |
1549 |
1438 * WordPress dependencies |
1550 /** |
1439 */ |
1551 * WordPress dependencies |
1440 |
1552 */ |
1441 |
|
1442 |
1553 |
1443 |
1554 const v1 = { |
1444 const v1 = { |
1555 attributes: { |
1445 attributes: { |
1556 title: { |
1446 title: { |
1557 type: 'string' |
1447 type: 'string' |
1616 |
1507 |
1617 const widget_group_settings = { |
1508 const widget_group_settings = { |
1618 title: (0,external_wp_i18n_namespaceObject.__)('Widget Group'), |
1509 title: (0,external_wp_i18n_namespaceObject.__)('Widget Group'), |
1619 description: (0,external_wp_i18n_namespaceObject.__)('Create a classic widget layout with a title that’s styled by your theme for your widget areas.'), |
1510 description: (0,external_wp_i18n_namespaceObject.__)('Create a classic widget layout with a title that’s styled by your theme for your widget areas.'), |
1620 icon: library_group, |
1511 icon: library_group, |
1621 __experimentalLabel: _ref => { |
1512 __experimentalLabel: ({ |
1622 let { |
1513 name: label |
1623 name: label |
1514 }) => label, |
1624 } = _ref; |
|
1625 return label; |
|
1626 }, |
|
1627 edit: edit_Edit, |
1515 edit: edit_Edit, |
1628 save: save, |
1516 save: save, |
1629 transforms: { |
1517 transforms: { |
1630 from: [{ |
1518 from: [{ |
1631 type: 'block', |
1519 type: 'block', |
1632 isMultiBlock: true, |
1520 isMultiBlock: true, |
1633 blocks: ['*'], |
1521 blocks: ['*'], |
1634 |
|
1635 isMatch(attributes, blocks) { |
1522 isMatch(attributes, blocks) { |
1636 // Avoid transforming existing `widget-group` blocks. |
1523 // Avoid transforming existing `widget-group` blocks. |
1637 return !blocks.some(block => block.name === 'core/widget-group'); |
1524 return !blocks.some(block => block.name === 'core/widget-group'); |
1638 }, |
1525 }, |
1639 |
|
1640 __experimentalConvert(blocks) { |
1526 __experimentalConvert(blocks) { |
1641 // Put the selected blocks inside the new Widget Group's innerBlocks. |
1527 // Put the selected blocks inside the new Widget Group's innerBlocks. |
1642 let innerBlocks = [...blocks.map(block => { |
1528 let innerBlocks = [...blocks.map(block => { |
1643 return (0,external_wp_blocks_namespaceObject.createBlock)(block.name, block.attributes, block.innerBlocks); |
1529 return (0,external_wp_blocks_namespaceObject.createBlock)(block.name, block.attributes, block.innerBlocks); |
1644 })]; // If the first block is a heading then assume this is intended |
1530 })]; |
|
1531 |
|
1532 // If the first block is a heading then assume this is intended |
1645 // to be the Widget's "title". |
1533 // to be the Widget's "title". |
1646 |
1534 const firstHeadingBlock = innerBlocks[0].name === 'core/heading' ? innerBlocks[0] : null; |
1647 const firstHeadingBlock = innerBlocks[0].name === 'core/heading' ? innerBlocks[0] : null; // Remove the first heading block as we're copying |
1535 |
|
1536 // Remove the first heading block as we're copying |
1648 // it's content into the Widget Group's title attribute. |
1537 // it's content into the Widget Group's title attribute. |
1649 |
|
1650 innerBlocks = innerBlocks.filter(block => block !== firstHeadingBlock); |
1538 innerBlocks = innerBlocks.filter(block => block !== firstHeadingBlock); |
1651 return (0,external_wp_blocks_namespaceObject.createBlock)('core/widget-group', { ...(firstHeadingBlock && { |
1539 return (0,external_wp_blocks_namespaceObject.createBlock)('core/widget-group', { |
|
1540 ...(firstHeadingBlock && { |
1652 title: firstHeadingBlock.attributes.content |
1541 title: firstHeadingBlock.attributes.content |
1653 }) |
1542 }) |
1654 }, innerBlocks); |
1543 }, innerBlocks); |
1655 } |
1544 } |
1656 |
|
1657 }] |
1545 }] |
1658 }, |
1546 }, |
1659 deprecated: deprecated |
1547 deprecated: deprecated |
1660 }; |
1548 }; |
1661 |
1549 |
1662 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/move-to.js |
1550 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/move-to.js |
1663 |
1551 /** |
1664 |
1552 * WordPress dependencies |
1665 /** |
1553 */ |
1666 * WordPress dependencies |
1554 |
1667 */ |
1555 |
1668 |
1556 const moveTo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
1669 const moveTo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
1670 xmlns: "http://www.w3.org/2000/svg", |
1557 xmlns: "http://www.w3.org/2000/svg", |
1671 viewBox: "0 0 24 24" |
1558 viewBox: "0 0 24 24", |
1672 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
1559 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { |
1673 d: "M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z" |
1560 d: "M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z" |
1674 })); |
1561 }) |
1675 /* harmony default export */ var move_to = (moveTo); |
1562 }); |
|
1563 /* harmony default export */ const move_to = (moveTo); |
1676 |
1564 |
1677 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/components/move-to-widget-area/index.js |
1565 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/components/move-to-widget-area/index.js |
1678 |
1566 /** |
1679 |
1567 * WordPress dependencies |
1680 /** |
1568 */ |
1681 * WordPress dependencies |
1569 |
1682 */ |
1570 |
1683 |
1571 |
1684 |
1572 |
1685 |
1573 function MoveToWidgetArea({ |
1686 function MoveToWidgetArea(_ref) { |
1574 currentWidgetAreaId, |
1687 let { |
1575 widgetAreas, |
1688 currentWidgetAreaId, |
1576 onSelect |
1689 widgetAreas, |
1577 }) { |
1690 onSelect |
1578 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { |
1691 } = _ref; |
1579 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { |
1692 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, { |
1580 children: toggleProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { |
1693 icon: move_to, |
1581 icon: move_to, |
1694 label: (0,external_wp_i18n_namespaceObject.__)('Move to widget area'), |
1582 label: (0,external_wp_i18n_namespaceObject.__)('Move to widget area'), |
1695 toggleProps: toggleProps |
1583 toggleProps: toggleProps, |
1696 }, _ref2 => { |
1584 children: ({ |
1697 let { |
1585 onClose |
1698 onClose |
1586 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { |
1699 } = _ref2; |
1587 label: (0,external_wp_i18n_namespaceObject.__)('Move to'), |
1700 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
1588 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { |
1701 label: (0,external_wp_i18n_namespaceObject.__)('Move to') |
1589 choices: widgetAreas.map(widgetArea => ({ |
1702 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { |
1590 value: widgetArea.id, |
1703 choices: widgetAreas.map(widgetArea => ({ |
1591 label: widgetArea.name, |
1704 value: widgetArea.id, |
1592 info: widgetArea.description |
1705 label: widgetArea.name, |
1593 })), |
1706 info: widgetArea.description |
1594 value: currentWidgetAreaId, |
1707 })), |
1595 onSelect: value => { |
1708 value: currentWidgetAreaId, |
1596 onSelect(value); |
1709 onSelect: value => { |
1597 onClose(); |
1710 onSelect(value); |
1598 } |
1711 onClose(); |
1599 }) |
1712 } |
1600 }) |
1713 })); |
1601 }) |
1714 }))); |
1602 }) |
|
1603 }); |
1715 } |
1604 } |
1716 |
1605 |
1717 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/components/index.js |
1606 ;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/components/index.js |
1718 |
1607 |
1719 |
1608 |