1 this["wp"] = this["wp"] || {}; this["wp"]["blockDirectory"] = |
1 /******/ (function() { // webpackBootstrap |
2 /******/ (function(modules) { // webpackBootstrap |
2 /******/ "use strict"; |
3 /******/ // The module cache |
3 /******/ // The require scope |
4 /******/ var installedModules = {}; |
4 /******/ var __webpack_require__ = {}; |
5 /******/ |
5 /******/ |
6 /******/ // The require function |
6 /************************************************************************/ |
7 /******/ function __webpack_require__(moduleId) { |
7 /******/ /* webpack/runtime/compat get default export */ |
8 /******/ |
8 /******/ !function() { |
9 /******/ // Check if module is in cache |
9 /******/ // getDefaultExport function for compatibility with non-harmony modules |
10 /******/ if(installedModules[moduleId]) { |
10 /******/ __webpack_require__.n = function(module) { |
11 /******/ return installedModules[moduleId].exports; |
11 /******/ var getter = module && module.__esModule ? |
12 /******/ } |
12 /******/ function() { return module['default']; } : |
13 /******/ // Create a new module (and put it into the cache) |
13 /******/ function() { return module; }; |
14 /******/ var module = installedModules[moduleId] = { |
14 /******/ __webpack_require__.d(getter, { a: getter }); |
15 /******/ i: moduleId, |
15 /******/ return getter; |
16 /******/ l: false, |
|
17 /******/ exports: {} |
|
18 /******/ }; |
16 /******/ }; |
19 /******/ |
17 /******/ }(); |
20 /******/ // Execute the module function |
18 /******/ |
21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
19 /******/ /* webpack/runtime/define property getters */ |
22 /******/ |
20 /******/ !function() { |
23 /******/ // Flag the module as loaded |
21 /******/ // define getter functions for harmony exports |
24 /******/ module.l = true; |
22 /******/ __webpack_require__.d = function(exports, definition) { |
25 /******/ |
23 /******/ for(var key in definition) { |
26 /******/ // Return the exports of the module |
24 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
27 /******/ return module.exports; |
25 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
28 /******/ } |
26 /******/ } |
29 /******/ |
27 /******/ } |
30 /******/ |
28 /******/ }; |
31 /******/ // expose the modules object (__webpack_modules__) |
29 /******/ }(); |
32 /******/ __webpack_require__.m = modules; |
30 /******/ |
33 /******/ |
31 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
34 /******/ // expose the module cache |
32 /******/ !function() { |
35 /******/ __webpack_require__.c = installedModules; |
33 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
36 /******/ |
34 /******/ }(); |
37 /******/ // define getter function for harmony exports |
35 /******/ |
38 /******/ __webpack_require__.d = function(exports, name, getter) { |
36 /******/ /* webpack/runtime/make namespace object */ |
39 /******/ if(!__webpack_require__.o(exports, name)) { |
37 /******/ !function() { |
40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
38 /******/ // define __esModule on exports |
41 /******/ } |
39 /******/ __webpack_require__.r = function(exports) { |
42 /******/ }; |
40 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
43 /******/ |
41 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
44 /******/ // define __esModule on exports |
42 /******/ } |
45 /******/ __webpack_require__.r = function(exports) { |
43 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
44 /******/ }; |
47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
45 /******/ }(); |
48 /******/ } |
46 /******/ |
49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
50 /******/ }; |
|
51 /******/ |
|
52 /******/ // create a fake namespace object |
|
53 /******/ // mode & 1: value is a module id, require it |
|
54 /******/ // mode & 2: merge all properties of value into the ns |
|
55 /******/ // mode & 4: return value when already ns object |
|
56 /******/ // mode & 8|1: behave like require |
|
57 /******/ __webpack_require__.t = function(value, mode) { |
|
58 /******/ if(mode & 1) value = __webpack_require__(value); |
|
59 /******/ if(mode & 8) return value; |
|
60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
|
61 /******/ var ns = Object.create(null); |
|
62 /******/ __webpack_require__.r(ns); |
|
63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
|
64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
|
65 /******/ return ns; |
|
66 /******/ }; |
|
67 /******/ |
|
68 /******/ // getDefaultExport function for compatibility with non-harmony modules |
|
69 /******/ __webpack_require__.n = function(module) { |
|
70 /******/ var getter = module && module.__esModule ? |
|
71 /******/ function getDefault() { return module['default']; } : |
|
72 /******/ function getModuleExports() { return module; }; |
|
73 /******/ __webpack_require__.d(getter, 'a', getter); |
|
74 /******/ return getter; |
|
75 /******/ }; |
|
76 /******/ |
|
77 /******/ // Object.prototype.hasOwnProperty.call |
|
78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
|
79 /******/ |
|
80 /******/ // __webpack_public_path__ |
|
81 /******/ __webpack_require__.p = ""; |
|
82 /******/ |
|
83 /******/ |
|
84 /******/ // Load entry module and return exports |
|
85 /******/ return __webpack_require__(__webpack_require__.s = "7f3f"); |
|
86 /******/ }) |
|
87 /************************************************************************/ |
47 /************************************************************************/ |
88 /******/ ({ |
48 var __webpack_exports__ = {}; |
89 |
|
90 /***/ "//Lo": |
|
91 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
92 |
|
93 "use strict"; |
|
94 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
95 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
96 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
97 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
98 |
|
99 |
|
100 /** |
|
101 * WordPress dependencies |
|
102 */ |
|
103 |
|
104 const blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
105 xmlns: "http://www.w3.org/2000/svg", |
|
106 viewBox: "0 0 24 24" |
|
107 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
108 d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" |
|
109 })); |
|
110 /* harmony default export */ __webpack_exports__["a"] = (blockDefault); |
|
111 |
|
112 |
|
113 /***/ }), |
|
114 |
|
115 /***/ "1ZqX": |
|
116 /***/ (function(module, exports) { |
|
117 |
|
118 (function() { module.exports = window["wp"]["data"]; }()); |
|
119 |
|
120 /***/ }), |
|
121 |
|
122 /***/ "51Zz": |
|
123 /***/ (function(module, exports) { |
|
124 |
|
125 (function() { module.exports = window["wp"]["dataControls"]; }()); |
|
126 |
|
127 /***/ }), |
|
128 |
|
129 /***/ "7f3f": |
|
130 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
131 |
|
132 "use strict"; |
|
133 // ESM COMPAT FLAG |
49 // ESM COMPAT FLAG |
134 __webpack_require__.r(__webpack_exports__); |
50 __webpack_require__.r(__webpack_exports__); |
135 |
51 |
136 // EXPORTS |
52 // EXPORTS |
137 __webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; }); |
53 __webpack_require__.d(__webpack_exports__, { |
|
54 "store": function() { return /* reexport */ store; } |
|
55 }); |
138 |
56 |
139 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/selectors.js |
57 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/selectors.js |
140 var selectors_namespaceObject = {}; |
58 var selectors_namespaceObject = {}; |
141 __webpack_require__.r(selectors_namespaceObject); |
59 __webpack_require__.r(selectors_namespaceObject); |
142 __webpack_require__.d(selectors_namespaceObject, "isRequestingDownloadableBlocks", function() { return selectors_isRequestingDownloadableBlocks; }); |
60 __webpack_require__.d(selectors_namespaceObject, { |
143 __webpack_require__.d(selectors_namespaceObject, "getDownloadableBlocks", function() { return selectors_getDownloadableBlocks; }); |
61 "getDownloadableBlocks": function() { return getDownloadableBlocks; }, |
144 __webpack_require__.d(selectors_namespaceObject, "getInstalledBlockTypes", function() { return getInstalledBlockTypes; }); |
62 "getErrorNoticeForBlock": function() { return getErrorNoticeForBlock; }, |
145 __webpack_require__.d(selectors_namespaceObject, "getNewBlockTypes", function() { return getNewBlockTypes; }); |
63 "getErrorNotices": function() { return getErrorNotices; }, |
146 __webpack_require__.d(selectors_namespaceObject, "getUnusedBlockTypes", function() { return getUnusedBlockTypes; }); |
64 "getInstalledBlockTypes": function() { return getInstalledBlockTypes; }, |
147 __webpack_require__.d(selectors_namespaceObject, "isInstalling", function() { return selectors_isInstalling; }); |
65 "getNewBlockTypes": function() { return getNewBlockTypes; }, |
148 __webpack_require__.d(selectors_namespaceObject, "getErrorNotices", function() { return getErrorNotices; }); |
66 "getUnusedBlockTypes": function() { return getUnusedBlockTypes; }, |
149 __webpack_require__.d(selectors_namespaceObject, "getErrorNoticeForBlock", function() { return selectors_getErrorNoticeForBlock; }); |
67 "isInstalling": function() { return isInstalling; }, |
|
68 "isRequestingDownloadableBlocks": function() { return isRequestingDownloadableBlocks; } |
|
69 }); |
150 |
70 |
151 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/actions.js |
71 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/actions.js |
152 var actions_namespaceObject = {}; |
72 var actions_namespaceObject = {}; |
153 __webpack_require__.r(actions_namespaceObject); |
73 __webpack_require__.r(actions_namespaceObject); |
154 __webpack_require__.d(actions_namespaceObject, "fetchDownloadableBlocks", function() { return fetchDownloadableBlocks; }); |
74 __webpack_require__.d(actions_namespaceObject, { |
155 __webpack_require__.d(actions_namespaceObject, "receiveDownloadableBlocks", function() { return receiveDownloadableBlocks; }); |
75 "addInstalledBlockType": function() { return addInstalledBlockType; }, |
156 __webpack_require__.d(actions_namespaceObject, "installBlockType", function() { return actions_installBlockType; }); |
76 "clearErrorNotice": function() { return clearErrorNotice; }, |
157 __webpack_require__.d(actions_namespaceObject, "uninstallBlockType", function() { return actions_uninstallBlockType; }); |
77 "fetchDownloadableBlocks": function() { return fetchDownloadableBlocks; }, |
158 __webpack_require__.d(actions_namespaceObject, "addInstalledBlockType", function() { return addInstalledBlockType; }); |
78 "installBlockType": function() { return installBlockType; }, |
159 __webpack_require__.d(actions_namespaceObject, "removeInstalledBlockType", function() { return removeInstalledBlockType; }); |
79 "receiveDownloadableBlocks": function() { return receiveDownloadableBlocks; }, |
160 __webpack_require__.d(actions_namespaceObject, "setIsInstalling", function() { return setIsInstalling; }); |
80 "removeInstalledBlockType": function() { return removeInstalledBlockType; }, |
161 __webpack_require__.d(actions_namespaceObject, "setErrorNotice", function() { return setErrorNotice; }); |
81 "setErrorNotice": function() { return setErrorNotice; }, |
162 __webpack_require__.d(actions_namespaceObject, "clearErrorNotice", function() { return clearErrorNotice; }); |
82 "setIsInstalling": function() { return setIsInstalling; }, |
163 |
83 "uninstallBlockType": function() { return uninstallBlockType; } |
164 // EXTERNAL MODULE: external ["wp","element"] |
84 }); |
165 var external_wp_element_ = __webpack_require__("GRId"); |
85 |
166 |
86 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js |
167 // EXTERNAL MODULE: external ["wp","plugins"] |
87 var resolvers_namespaceObject = {}; |
168 var external_wp_plugins_ = __webpack_require__("TvNi"); |
88 __webpack_require__.r(resolvers_namespaceObject); |
169 |
89 __webpack_require__.d(resolvers_namespaceObject, { |
170 // EXTERNAL MODULE: external ["wp","hooks"] |
90 "getDownloadableBlocks": function() { return resolvers_getDownloadableBlocks; } |
171 var external_wp_hooks_ = __webpack_require__("g56x"); |
91 }); |
172 |
92 |
173 // EXTERNAL MODULE: external ["wp","blocks"] |
93 ;// CONCATENATED MODULE: external ["wp","element"] |
174 var external_wp_blocks_ = __webpack_require__("HSyU"); |
94 var external_wp_element_namespaceObject = window["wp"]["element"]; |
175 |
95 ;// CONCATENATED MODULE: external ["wp","plugins"] |
176 // EXTERNAL MODULE: external ["wp","data"] |
96 var external_wp_plugins_namespaceObject = window["wp"]["plugins"]; |
177 var external_wp_data_ = __webpack_require__("1ZqX"); |
97 ;// CONCATENATED MODULE: external ["wp","hooks"] |
178 |
98 var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; |
179 // EXTERNAL MODULE: external ["wp","editor"] |
99 ;// CONCATENATED MODULE: external ["wp","blocks"] |
180 var external_wp_editor_ = __webpack_require__("jSdM"); |
100 var external_wp_blocks_namespaceObject = window["wp"]["blocks"]; |
181 |
101 ;// CONCATENATED MODULE: external ["wp","data"] |
182 // EXTERNAL MODULE: external ["wp","dataControls"] |
102 var external_wp_data_namespaceObject = window["wp"]["data"]; |
183 var external_wp_dataControls_ = __webpack_require__("51Zz"); |
103 ;// CONCATENATED MODULE: external ["wp","editor"] |
184 |
104 var external_wp_editor_namespaceObject = window["wp"]["editor"]; |
185 // EXTERNAL MODULE: external "lodash" |
105 ;// CONCATENATED MODULE: external "lodash" |
186 var external_lodash_ = __webpack_require__("YLtl"); |
106 var external_lodash_namespaceObject = window["lodash"]; |
187 |
107 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/reducer.js |
188 // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/reducer.js |
|
189 /** |
108 /** |
190 * External dependencies |
109 * External dependencies |
191 */ |
110 */ |
192 |
111 |
193 /** |
112 /** |
265 * @param {Object} action Dispatched action. |
190 * @param {Object} action Dispatched action. |
266 * |
191 * |
267 * @return {Object} Updated state. |
192 * @return {Object} Updated state. |
268 */ |
193 */ |
269 |
194 |
270 const errorNotices = (state = {}, action) => { |
195 const errorNotices = function () { |
|
196 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
197 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
198 |
271 switch (action.type) { |
199 switch (action.type) { |
272 case 'SET_ERROR_NOTICE': |
200 case 'SET_ERROR_NOTICE': |
273 return { ...state, |
201 return { ...state, |
274 [action.blockId]: { |
202 [action.blockId]: { |
275 message: action.message, |
203 message: action.message, |
276 isFatal: action.isFatal |
204 isFatal: action.isFatal |
277 } |
205 } |
278 }; |
206 }; |
279 |
207 |
280 case 'CLEAR_ERROR_NOTICE': |
208 case 'CLEAR_ERROR_NOTICE': |
281 return Object(external_lodash_["omit"])(state, action.blockId); |
209 return (0,external_lodash_namespaceObject.omit)(state, action.blockId); |
282 } |
210 } |
283 |
211 |
284 return state; |
212 return state; |
285 }; |
213 }; |
286 /* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({ |
214 /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ |
287 downloadableBlocks, |
215 downloadableBlocks, |
288 blockManagement, |
216 blockManagement, |
289 errorNotices |
217 errorNotices |
290 })); |
218 })); |
291 |
219 |
292 // EXTERNAL MODULE: external ["wp","blockEditor"] |
220 ;// CONCATENATED MODULE: external ["wp","blockEditor"] |
293 var external_wp_blockEditor_ = __webpack_require__("axFQ"); |
221 var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; |
294 |
222 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/utils/has-block-type.js |
295 // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/utils/has-block-type.js |
|
296 /** |
223 /** |
297 * Check if a block list contains a specific block type. Recursively searches |
224 * Check if a block list contains a specific block type. Recursively searches |
298 * through `innerBlocks` if they exist. |
225 * through `innerBlocks` if they exist. |
299 * |
226 * |
300 * @param {Object} blockType A block object to search for. |
227 * @param {Object} blockType A block object to search for. |
301 * @param {Object[]} blocks The list of blocks to look through. |
228 * @param {Object[]} blocks The list of blocks to look through. |
302 * |
229 * |
303 * @return {boolean} Whether the blockType is found. |
230 * @return {boolean} Whether the blockType is found. |
304 */ |
231 */ |
305 function hasBlockType(blockType, blocks = []) { |
232 function hasBlockType(blockType) { |
|
233 let blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; |
|
234 |
306 if (!blocks.length) { |
235 if (!blocks.length) { |
307 return false; |
236 return false; |
308 } |
237 } |
309 |
238 |
310 if (blocks.some(({ |
239 if (blocks.some(_ref => { |
311 name |
240 let { |
312 }) => name === blockType.name)) { |
241 name |
|
242 } = _ref; |
|
243 return name === blockType.name; |
|
244 })) { |
313 return true; |
245 return true; |
314 } |
246 } |
315 |
247 |
316 for (let i = 0; i < blocks.length; i++) { |
248 for (let i = 0; i < blocks.length; i++) { |
317 if (hasBlockType(blockType, blocks[i].innerBlocks)) { |
249 if (hasBlockType(blockType, blocks[i].innerBlocks)) { |
613 * @param {Object} block The block item returned by search. |
531 * @param {Object} block The block item returned by search. |
614 * |
532 * |
615 * @return {boolean} Whether the block was successfully installed & loaded. |
533 * @return {boolean} Whether the block was successfully installed & loaded. |
616 */ |
534 */ |
617 |
535 |
618 function* actions_installBlockType(block) { |
536 const installBlockType = block => async _ref => { |
|
537 let { |
|
538 registry, |
|
539 dispatch |
|
540 } = _ref; |
619 const { |
541 const { |
620 id, |
542 id, |
621 assets |
543 name |
622 } = block; |
544 } = block; |
623 let success = false; |
545 let success = false; |
624 yield clearErrorNotice(id); |
546 dispatch.clearErrorNotice(id); |
625 |
547 |
626 try { |
548 try { |
627 yield setIsInstalling(block.id, true); // If we have a wp:plugin link, the plugin is installed but inactive. |
549 dispatch.setIsInstalling(id, true); // If we have a wp:plugin link, the plugin is installed but inactive. |
628 |
550 |
629 const url = getPluginUrl(block); |
551 const url = getPluginUrl(block); |
630 let links = {}; |
552 let links = {}; |
631 |
553 |
632 if (url) { |
554 if (url) { |
633 yield Object(external_wp_dataControls_["apiFetch"])({ |
555 await external_wp_apiFetch_default()({ |
|
556 method: 'PUT', |
634 url, |
557 url, |
635 data: { |
558 data: { |
636 status: 'active' |
559 status: 'active' |
637 }, |
560 } |
638 method: 'PUT' |
|
639 }); |
561 }); |
640 } else { |
562 } else { |
641 const response = yield Object(external_wp_dataControls_["apiFetch"])({ |
563 const response = await external_wp_apiFetch_default()({ |
|
564 method: 'POST', |
642 path: 'wp/v2/plugins', |
565 path: 'wp/v2/plugins', |
643 data: { |
566 data: { |
644 slug: block.id, |
567 slug: id, |
645 status: 'active' |
568 status: 'active' |
646 }, |
569 } |
647 method: 'POST' |
|
648 }); // Add the `self` link for newly-installed blocks. |
570 }); // Add the `self` link for newly-installed blocks. |
649 |
571 |
650 links = response._links; |
572 links = response._links; |
651 } |
573 } |
652 |
574 |
653 yield addInstalledBlockType({ ...block, |
575 dispatch.addInstalledBlockType({ ...block, |
654 links: { ...block.links, |
576 links: { ...block.links, |
655 ...links |
577 ...links |
656 } |
578 } |
|
579 }); // Ensures that the block metadata is propagated to the editor when registered on the server. |
|
580 |
|
581 const metadataFields = ['api_version', 'title', 'category', 'parent', 'icon', 'description', 'keywords', 'attributes', 'provides_context', 'uses_context', 'supports', 'styles', 'example', 'variations']; |
|
582 await external_wp_apiFetch_default()({ |
|
583 path: (0,external_wp_url_namespaceObject.addQueryArgs)(`/wp/v2/block-types/${name}`, { |
|
584 _fields: metadataFields |
|
585 }) |
|
586 }) // Ignore when the block is not registered on the server. |
|
587 .catch(() => {}).then(response => { |
|
588 if (!response) { |
|
589 return; |
|
590 } |
|
591 |
|
592 (0,external_wp_blocks_namespaceObject.unstable__bootstrapServerSideBlockDefinitions)({ |
|
593 [name]: (0,external_lodash_namespaceObject.pick)(response, metadataFields) |
|
594 }); |
657 }); |
595 }); |
658 yield loadAssets(assets); |
596 await loadAssets(); |
659 const registeredBlocks = yield external_wp_data_["controls"].select(external_wp_blocks_["store"].name, 'getBlockTypes'); |
597 const registeredBlocks = registry.select(external_wp_blocks_namespaceObject.store).getBlockTypes(); |
660 |
598 |
661 if (!registeredBlocks.some(i => i.name === block.name)) { |
599 if (!registeredBlocks.some(i => i.name === name)) { |
662 throw new Error(Object(external_wp_i18n_["__"])('Error registering block. Try reloading the page.')); |
600 throw new Error((0,external_wp_i18n_namespaceObject.__)('Error registering block. Try reloading the page.')); |
663 } |
601 } |
664 |
602 |
665 yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createInfoNotice', Object(external_wp_i18n_["sprintf"])( // translators: %s is the block title. |
603 registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is the block title. |
666 Object(external_wp_i18n_["__"])('Block %s installed and added.'), block.title), { |
604 (0,external_wp_i18n_namespaceObject.__)('Block %s installed and added.'), block.title), { |
667 speak: true, |
605 speak: true, |
668 type: 'snackbar' |
606 type: 'snackbar' |
669 }); |
607 }); |
670 success = true; |
608 success = true; |
671 } catch (error) { |
609 } catch (error) { |
672 let message = error.message || Object(external_wp_i18n_["__"])('An error occurred.'); // Errors we throw are fatal |
610 let message = error.message || (0,external_wp_i18n_namespaceObject.__)('An error occurred.'); // Errors we throw are fatal. |
673 |
611 |
674 |
612 |
675 let isFatal = error instanceof Error; // Specific API errors that are fatal |
613 let isFatal = error instanceof Error; // Specific API errors that are fatal. |
676 |
614 |
677 const fatalAPIErrors = { |
615 const fatalAPIErrors = { |
678 folder_exists: Object(external_wp_i18n_["__"])('This block is already installed. Try reloading the page.'), |
616 folder_exists: (0,external_wp_i18n_namespaceObject.__)('This block is already installed. Try reloading the page.'), |
679 unable_to_connect_to_filesystem: Object(external_wp_i18n_["__"])('Error installing block. You can reload the page and try again.') |
617 unable_to_connect_to_filesystem: (0,external_wp_i18n_namespaceObject.__)('Error installing block. You can reload the page and try again.') |
680 }; |
618 }; |
681 |
619 |
682 if (fatalAPIErrors[error.code]) { |
620 if (fatalAPIErrors[error.code]) { |
683 isFatal = true; |
621 isFatal = true; |
684 message = fatalAPIErrors[error.code]; |
622 message = fatalAPIErrors[error.code]; |
685 } |
623 } |
686 |
624 |
687 yield setErrorNotice(id, message, isFatal); |
625 dispatch.setErrorNotice(id, message, isFatal); |
688 yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createErrorNotice', message, { |
626 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(message, { |
689 speak: true, |
627 speak: true, |
690 isDismissible: true |
628 isDismissible: true |
691 }); |
629 }); |
692 } |
630 } |
693 |
631 |
694 yield setIsInstalling(block.id, false); |
632 dispatch.setIsInstalling(id, false); |
695 return success; |
633 return success; |
696 } |
634 }; |
697 /** |
635 /** |
698 * Action triggered to uninstall a block plugin. |
636 * Action triggered to uninstall a block plugin. |
699 * |
637 * |
700 * @param {Object} block The blockType object. |
638 * @param {Object} block The blockType object. |
701 */ |
639 */ |
702 |
640 |
703 function* actions_uninstallBlockType(block) { |
641 const uninstallBlockType = block => async _ref2 => { |
|
642 let { |
|
643 registry, |
|
644 dispatch |
|
645 } = _ref2; |
|
646 |
704 try { |
647 try { |
705 yield Object(external_wp_dataControls_["apiFetch"])({ |
648 const url = getPluginUrl(block); |
706 url: getPluginUrl(block), |
649 await external_wp_apiFetch_default()({ |
|
650 method: 'PUT', |
|
651 url, |
707 data: { |
652 data: { |
708 status: 'inactive' |
653 status: 'inactive' |
709 }, |
654 } |
710 method: 'PUT' |
|
711 }); |
655 }); |
712 yield Object(external_wp_dataControls_["apiFetch"])({ |
656 await external_wp_apiFetch_default()({ |
713 url: getPluginUrl(block), |
657 method: 'DELETE', |
714 method: 'DELETE' |
658 url |
715 }); |
659 }); |
716 yield removeInstalledBlockType(block); |
660 dispatch.removeInstalledBlockType(block); |
717 } catch (error) { |
661 } catch (error) { |
718 yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createErrorNotice', error.message || Object(external_wp_i18n_["__"])('An error occurred.')); |
662 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(error.message || (0,external_wp_i18n_namespaceObject.__)('An error occurred.')); |
719 } |
663 } |
720 } |
664 }; |
721 /** |
665 /** |
722 * Returns an action object used to add a block type to the "newly installed" |
666 * Returns an action object used to add a block type to the "newly installed" |
723 * tracking list. |
667 * tracking list. |
724 * |
668 * |
725 * @param {Object} item The block item with the block id and name. |
669 * @param {Object} item The block item with the block id and name. |
894 |
833 |
895 |
834 |
896 function AutoBlockUninstaller() { |
835 function AutoBlockUninstaller() { |
897 const { |
836 const { |
898 uninstallBlockType |
837 uninstallBlockType |
899 } = Object(external_wp_data_["useDispatch"])(store); |
838 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
900 const shouldRemoveBlockTypes = Object(external_wp_data_["useSelect"])(select => { |
839 const shouldRemoveBlockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => { |
901 const { |
840 const { |
902 isAutosavingPost, |
841 isAutosavingPost, |
903 isSavingPost |
842 isSavingPost |
904 } = select(external_wp_editor_["store"]); |
843 } = select(external_wp_editor_namespaceObject.store); |
905 return isSavingPost() && !isAutosavingPost(); |
844 return isSavingPost() && !isAutosavingPost(); |
906 }, []); |
845 }, []); |
907 const unusedBlockTypes = Object(external_wp_data_["useSelect"])(select => select(store).getUnusedBlockTypes(), []); |
846 const unusedBlockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getUnusedBlockTypes(), []); |
908 Object(external_wp_element_["useEffect"])(() => { |
847 (0,external_wp_element_namespaceObject.useEffect)(() => { |
909 if (shouldRemoveBlockTypes && unusedBlockTypes.length) { |
848 if (shouldRemoveBlockTypes && unusedBlockTypes.length) { |
910 unusedBlockTypes.forEach(blockType => { |
849 unusedBlockTypes.forEach(blockType => { |
911 uninstallBlockType(blockType); |
850 uninstallBlockType(blockType); |
912 Object(external_wp_blocks_["unregisterBlockType"])(blockType.name); |
851 (0,external_wp_blocks_namespaceObject.unregisterBlockType)(blockType.name); |
913 }); |
852 }); |
914 } |
853 } |
915 }, [shouldRemoveBlockTypes]); |
854 }, [shouldRemoveBlockTypes]); |
916 return null; |
855 return null; |
917 } |
856 } |
918 |
857 |
919 // EXTERNAL MODULE: external ["wp","components"] |
858 ;// CONCATENATED MODULE: external ["wp","components"] |
920 var external_wp_components_ = __webpack_require__("tI+e"); |
859 var external_wp_components_namespaceObject = window["wp"]["components"]; |
921 |
860 ;// CONCATENATED MODULE: external ["wp","compose"] |
922 // EXTERNAL MODULE: external ["wp","compose"] |
861 var external_wp_compose_namespaceObject = window["wp"]["compose"]; |
923 var external_wp_compose_ = __webpack_require__("K9lf"); |
862 ;// CONCATENATED MODULE: external ["wp","coreData"] |
924 |
863 var external_wp_coreData_namespaceObject = window["wp"]["coreData"]; |
925 // EXTERNAL MODULE: external ["wp","coreData"] |
864 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
926 var external_wp_coreData_ = __webpack_require__("jZUy"); |
865 function _extends() { |
927 |
866 _extends = Object.assign ? Object.assign.bind() : function (target) { |
928 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
867 for (var i = 1; i < arguments.length; i++) { |
929 var esm_extends = __webpack_require__("wx14"); |
868 var source = arguments[i]; |
930 |
869 |
931 // EXTERNAL MODULE: external ["wp","htmlEntities"] |
870 for (var key in source) { |
932 var external_wp_htmlEntities_ = __webpack_require__("rmEH"); |
871 if (Object.prototype.hasOwnProperty.call(source, key)) { |
933 |
872 target[key] = source[key]; |
934 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js |
873 } |
935 var build_module_icon = __webpack_require__("iClF"); |
874 } |
936 |
875 } |
937 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js |
876 |
938 var star_filled = __webpack_require__("URob"); |
877 return target; |
939 |
878 }; |
940 // EXTERNAL MODULE: external ["wp","primitives"] |
879 return _extends.apply(this, arguments); |
941 var external_wp_primitives_ = __webpack_require__("Tqx9"); |
880 } |
942 |
881 ;// CONCATENATED MODULE: external ["wp","htmlEntities"] |
943 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-half.js |
882 var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; |
944 |
883 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js |
945 |
884 /** |
946 /** |
885 * WordPress dependencies |
947 * WordPress dependencies |
886 */ |
948 */ |
887 |
949 |
888 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ |
950 const starHalf = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { |
889 |
|
890 /** |
|
891 * Return an SVG icon. |
|
892 * |
|
893 * @param {IconProps} props icon is the SVG component to render |
|
894 * size is a number specifiying the icon size in pixels |
|
895 * Other props will be passed to wrapped SVG component |
|
896 * |
|
897 * @return {JSX.Element} Icon component |
|
898 */ |
|
899 |
|
900 function Icon(_ref) { |
|
901 let { |
|
902 icon, |
|
903 size = 24, |
|
904 ...props |
|
905 } = _ref; |
|
906 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { |
|
907 width: size, |
|
908 height: size, |
|
909 ...props |
|
910 }); |
|
911 } |
|
912 |
|
913 /* harmony default export */ var icon = (Icon); |
|
914 |
|
915 ;// CONCATENATED MODULE: external ["wp","primitives"] |
|
916 var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
|
917 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js |
|
918 |
|
919 |
|
920 /** |
|
921 * WordPress dependencies |
|
922 */ |
|
923 |
|
924 const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
951 xmlns: "http://www.w3.org/2000/svg", |
925 xmlns: "http://www.w3.org/2000/svg", |
952 viewBox: "0 0 24 24" |
926 viewBox: "0 0 24 24" |
953 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { |
927 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
928 d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" |
|
929 })); |
|
930 /* harmony default export */ var star_filled = (starFilled); |
|
931 |
|
932 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-half.js |
|
933 |
|
934 |
|
935 /** |
|
936 * WordPress dependencies |
|
937 */ |
|
938 |
|
939 const starHalf = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
940 xmlns: "http://www.w3.org/2000/svg", |
|
941 viewBox: "0 0 24 24" |
|
942 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
954 d: "M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39v7.143z" |
943 d: "M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39v7.143z" |
955 })); |
944 })); |
956 /* harmony default export */ var star_half = (starHalf); |
945 /* harmony default export */ var star_half = (starHalf); |
957 |
946 |
958 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js |
947 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js |
959 var star_empty = __webpack_require__("Xxwi"); |
948 |
960 |
949 |
961 // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/stars.js |
950 /** |
|
951 * WordPress dependencies |
|
952 */ |
|
953 |
|
954 const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
955 xmlns: "http://www.w3.org/2000/svg", |
|
956 viewBox: "0 0 24 24" |
|
957 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
958 fillRule: "evenodd", |
|
959 d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z", |
|
960 clipRule: "evenodd" |
|
961 })); |
|
962 /* harmony default export */ var star_empty = (starEmpty); |
|
963 |
|
964 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/stars.js |
962 |
965 |
963 |
966 |
964 /** |
967 /** |
965 * External dependencies |
968 * External dependencies |
966 */ |
969 */ |
970 */ |
973 */ |
971 |
974 |
972 |
975 |
973 |
976 |
974 |
977 |
975 function Stars({ |
978 function Stars(_ref) { |
976 rating |
979 let { |
977 }) { |
980 rating |
|
981 } = _ref; |
978 const stars = Math.round(rating / 0.5) * 0.5; |
982 const stars = Math.round(rating / 0.5) * 0.5; |
979 const fullStarCount = Math.floor(rating); |
983 const fullStarCount = Math.floor(rating); |
980 const halfStarCount = Math.ceil(rating - fullStarCount); |
984 const halfStarCount = Math.ceil(rating - fullStarCount); |
981 const emptyStarCount = 5 - (fullStarCount + halfStarCount); |
985 const emptyStarCount = 5 - (fullStarCount + halfStarCount); |
982 return Object(external_wp_element_["createElement"])("span", { |
986 return (0,external_wp_element_namespaceObject.createElement)("span", { |
983 "aria-label": Object(external_wp_i18n_["sprintf"])( |
987 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( |
984 /* translators: %s: number of stars. */ |
988 /* translators: %s: number of stars. */ |
985 Object(external_wp_i18n_["__"])('%s out of 5 stars'), stars) |
989 (0,external_wp_i18n_namespaceObject.__)('%s out of 5 stars'), stars) |
986 }, Object(external_lodash_["times"])(fullStarCount, i => Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { |
990 }, (0,external_lodash_namespaceObject.times)(fullStarCount, i => (0,external_wp_element_namespaceObject.createElement)(icon, { |
987 key: `full_stars_${i}`, |
991 key: `full_stars_${i}`, |
988 className: "block-directory-block-ratings__star-full", |
992 className: "block-directory-block-ratings__star-full", |
989 icon: star_filled["a" /* default */], |
993 icon: star_filled, |
990 size: 16 |
994 size: 16 |
991 })), Object(external_lodash_["times"])(halfStarCount, i => Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { |
995 })), (0,external_lodash_namespaceObject.times)(halfStarCount, i => (0,external_wp_element_namespaceObject.createElement)(icon, { |
992 key: `half_stars_${i}`, |
996 key: `half_stars_${i}`, |
993 className: "block-directory-block-ratings__star-half-full", |
997 className: "block-directory-block-ratings__star-half-full", |
994 icon: star_half, |
998 icon: star_half, |
995 size: 16 |
999 size: 16 |
996 })), Object(external_lodash_["times"])(emptyStarCount, i => Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { |
1000 })), (0,external_lodash_namespaceObject.times)(emptyStarCount, i => (0,external_wp_element_namespaceObject.createElement)(icon, { |
997 key: `empty_stars_${i}`, |
1001 key: `empty_stars_${i}`, |
998 className: "block-directory-block-ratings__star-empty", |
1002 className: "block-directory-block-ratings__star-empty", |
999 icon: star_empty["a" /* default */], |
1003 icon: star_empty, |
1000 size: 16 |
1004 size: 16 |
1001 }))); |
1005 }))); |
1002 } |
1006 } |
1003 |
1007 |
1004 /* harmony default export */ var block_ratings_stars = (Stars); |
1008 /* harmony default export */ var stars = (Stars); |
1005 |
1009 |
1006 // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/index.js |
1010 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/index.js |
1007 |
1011 |
1008 |
1012 |
1009 /** |
1013 /** |
1010 * Internal dependencies |
1014 * Internal dependencies |
1011 */ |
1015 */ |
1012 |
1016 |
1013 const BlockRatings = ({ |
1017 const BlockRatings = _ref => { |
1014 rating |
1018 let { |
1015 }) => Object(external_wp_element_["createElement"])("span", { |
1019 rating |
1016 className: "block-directory-block-ratings" |
1020 } = _ref; |
1017 }, Object(external_wp_element_["createElement"])(block_ratings_stars, { |
1021 return (0,external_wp_element_namespaceObject.createElement)("span", { |
1018 rating: rating |
1022 className: "block-directory-block-ratings" |
1019 })); |
1023 }, (0,external_wp_element_namespaceObject.createElement)(stars, { |
|
1024 rating: rating |
|
1025 })); |
|
1026 }; |
1020 /* harmony default export */ var block_ratings = (BlockRatings); |
1027 /* harmony default export */ var block_ratings = (BlockRatings); |
1021 |
1028 |
1022 // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-icon/index.js |
1029 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-icon/index.js |
1023 |
1030 |
1024 |
1031 |
1025 /** |
1032 /** |
1026 * WordPress dependencies |
1033 * WordPress dependencies |
1027 */ |
1034 */ |
1028 |
1035 |
1029 |
1036 |
1030 function DownloadableBlockIcon({ |
1037 function DownloadableBlockIcon(_ref) { |
1031 icon |
1038 let { |
1032 }) { |
1039 icon |
|
1040 } = _ref; |
1033 const className = 'block-directory-downloadable-block-icon'; |
1041 const className = 'block-directory-downloadable-block-icon'; |
1034 return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? Object(external_wp_element_["createElement"])("img", { |
1042 return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? (0,external_wp_element_namespaceObject.createElement)("img", { |
1035 className: className, |
1043 className: className, |
1036 src: icon, |
1044 src: icon, |
1037 alt: "" |
1045 alt: "" |
1038 }) : Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], { |
1046 }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
1039 className: className, |
1047 className: className, |
1040 icon: icon, |
1048 icon: icon, |
1041 showColors: true |
1049 showColors: true |
1042 }); |
1050 }); |
1043 } |
1051 } |
1044 |
1052 |
1045 /* harmony default export */ var downloadable_block_icon = (DownloadableBlockIcon); |
1053 /* harmony default export */ var downloadable_block_icon = (DownloadableBlockIcon); |
1046 |
1054 |
1047 // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-notice/index.js |
1055 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-notice/index.js |
1048 |
1056 |
1049 |
1057 |
1050 /** |
1058 /** |
1051 * WordPress dependencies |
1059 * WordPress dependencies |
1052 */ |
1060 */ |
1094 |
1103 |
1095 |
1104 |
1096 |
1105 |
1097 // Return the appropriate block item label, given the block data and status. |
1106 // Return the appropriate block item label, given the block data and status. |
1098 |
1107 |
1099 function getDownloadableBlockLabel({ |
1108 function getDownloadableBlockLabel(_ref, _ref2) { |
1100 title, |
1109 let { |
1101 rating, |
1110 title, |
1102 ratingCount |
1111 rating, |
1103 }, { |
1112 ratingCount |
1104 hasNotice, |
1113 } = _ref; |
1105 isInstalled, |
1114 let { |
1106 isInstalling |
1115 hasNotice, |
1107 }) { |
1116 isInstalled, |
|
1117 isInstalling |
|
1118 } = _ref2; |
1108 const stars = Math.round(rating / 0.5) * 0.5; |
1119 const stars = Math.round(rating / 0.5) * 0.5; |
1109 |
1120 |
1110 if (!isInstalled && hasNotice) { |
1121 if (!isInstalled && hasNotice) { |
1111 /* translators: %1$s: block title */ |
1122 /* translators: %1$s: block title */ |
1112 return Object(external_wp_i18n_["sprintf"])('Retry installing %s.', Object(external_wp_htmlEntities_["decodeEntities"])(title)); |
1123 return (0,external_wp_i18n_namespaceObject.sprintf)('Retry installing %s.', (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)); |
1113 } |
1124 } |
1114 |
1125 |
1115 if (isInstalled) { |
1126 if (isInstalled) { |
1116 /* translators: %1$s: block title */ |
1127 /* translators: %1$s: block title */ |
1117 return Object(external_wp_i18n_["sprintf"])('Add %s.', Object(external_wp_htmlEntities_["decodeEntities"])(title)); |
1128 return (0,external_wp_i18n_namespaceObject.sprintf)('Add %s.', (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)); |
1118 } |
1129 } |
1119 |
1130 |
1120 if (isInstalling) { |
1131 if (isInstalling) { |
1121 /* translators: %1$s: block title */ |
1132 /* translators: %1$s: block title */ |
1122 return Object(external_wp_i18n_["sprintf"])('Installing %s.', Object(external_wp_htmlEntities_["decodeEntities"])(title)); |
1133 return (0,external_wp_i18n_namespaceObject.sprintf)('Installing %s.', (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)); |
1123 } // No ratings yet, just use the title. |
1134 } // No ratings yet, just use the title. |
1124 |
1135 |
1125 |
1136 |
1126 if (ratingCount < 1) { |
1137 if (ratingCount < 1) { |
1127 /* translators: %1$s: block title */ |
1138 /* translators: %1$s: block title */ |
1128 return Object(external_wp_i18n_["sprintf"])('Install %s.', Object(external_wp_htmlEntities_["decodeEntities"])(title)); |
1139 return (0,external_wp_i18n_namespaceObject.sprintf)('Install %s.', (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)); |
1129 } |
1140 } |
1130 |
1141 |
1131 return Object(external_wp_i18n_["sprintf"])( |
1142 return (0,external_wp_i18n_namespaceObject.sprintf)( |
1132 /* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */ |
1143 /* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */ |
1133 Object(external_wp_i18n_["_n"])('Install %1$s. %2$s stars with %3$s review.', 'Install %1$s. %2$s stars with %3$s reviews.', ratingCount), Object(external_wp_htmlEntities_["decodeEntities"])(title), stars, ratingCount); |
1144 (0,external_wp_i18n_namespaceObject._n)('Install %1$s. %2$s stars with %3$s review.', 'Install %1$s. %2$s stars with %3$s reviews.', ratingCount), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), stars, ratingCount); |
1134 } |
1145 } |
1135 |
1146 |
1136 function DownloadableBlockListItem({ |
1147 function DownloadableBlockListItem(_ref3) { |
1137 composite, |
1148 let { |
1138 item, |
1149 composite, |
1139 onClick |
1150 item, |
1140 }) { |
1151 onClick |
|
1152 } = _ref3; |
1141 const { |
1153 const { |
1142 author, |
1154 author, |
1143 description, |
1155 description, |
1144 icon, |
1156 icon, |
1145 rating, |
1157 rating, |
1146 title |
1158 title |
1147 } = item; // getBlockType returns a block object if this block exists, or null if not. |
1159 } = item; // getBlockType returns a block object if this block exists, or null if not. |
1148 |
1160 |
1149 const isInstalled = !!Object(external_wp_blocks_["getBlockType"])(item.name); |
1161 const isInstalled = !!(0,external_wp_blocks_namespaceObject.getBlockType)(item.name); |
1150 const { |
1162 const { |
1151 hasNotice, |
1163 hasNotice, |
1152 isInstalling, |
1164 isInstalling, |
1153 isInstallable |
1165 isInstallable |
1154 } = Object(external_wp_data_["useSelect"])(select => { |
1166 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
1155 const { |
1167 const { |
1156 getErrorNoticeForBlock, |
1168 getErrorNoticeForBlock, |
1157 isInstalling: isBlockInstalling |
1169 isInstalling: isBlockInstalling |
1158 } = select(store); |
1170 } = select(store); |
1159 const notice = getErrorNoticeForBlock(item.id); |
1171 const notice = getErrorNoticeForBlock(item.id); |
1188 isInstalled, |
1201 isInstalled, |
1189 isInstalling |
1202 isInstalling |
1190 }), |
1203 }), |
1191 showTooltip: true, |
1204 showTooltip: true, |
1192 tooltipPosition: "top center" |
1205 tooltipPosition: "top center" |
1193 }), Object(external_wp_element_["createElement"])("div", { |
1206 }), (0,external_wp_element_namespaceObject.createElement)("div", { |
1194 className: "block-directory-downloadable-block-list-item__icon" |
1207 className: "block-directory-downloadable-block-list-item__icon" |
1195 }, Object(external_wp_element_["createElement"])(downloadable_block_icon, { |
1208 }, (0,external_wp_element_namespaceObject.createElement)(downloadable_block_icon, { |
1196 icon: icon, |
1209 icon: icon, |
1197 title: title |
1210 title: title |
1198 }), isInstalling ? Object(external_wp_element_["createElement"])("span", { |
1211 }), isInstalling ? (0,external_wp_element_namespaceObject.createElement)("span", { |
1199 className: "block-directory-downloadable-block-list-item__spinner" |
1212 className: "block-directory-downloadable-block-list-item__spinner" |
1200 }, Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null)) : Object(external_wp_element_["createElement"])(block_ratings, { |
1213 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)) : (0,external_wp_element_namespaceObject.createElement)(block_ratings, { |
1201 rating: rating |
1214 rating: rating |
1202 })), Object(external_wp_element_["createElement"])("span", { |
1215 })), (0,external_wp_element_namespaceObject.createElement)("span", { |
1203 className: "block-directory-downloadable-block-list-item__details" |
1216 className: "block-directory-downloadable-block-list-item__details" |
1204 }, Object(external_wp_element_["createElement"])("span", { |
1217 }, (0,external_wp_element_namespaceObject.createElement)("span", { |
1205 className: "block-directory-downloadable-block-list-item__title" |
1218 className: "block-directory-downloadable-block-list-item__title" |
1206 }, Object(external_wp_element_["createInterpolateElement"])(Object(external_wp_i18n_["sprintf"])( |
1219 }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( |
1207 /* translators: %1$s: block title, %2$s: author name. */ |
1220 /* translators: %1$s: block title, %2$s: author name. */ |
1208 Object(external_wp_i18n_["__"])('%1$s <span>by %2$s</span>'), Object(external_wp_htmlEntities_["decodeEntities"])(title), author), { |
1221 (0,external_wp_i18n_namespaceObject.__)('%1$s <span>by %2$s</span>'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), author), { |
1209 span: Object(external_wp_element_["createElement"])("span", { |
1222 span: (0,external_wp_element_namespaceObject.createElement)("span", { |
1210 className: "block-directory-downloadable-block-list-item__author" |
1223 className: "block-directory-downloadable-block-list-item__author" |
1211 }) |
1224 }) |
1212 })), hasNotice ? Object(external_wp_element_["createElement"])(downloadable_block_notice, { |
1225 })), hasNotice ? (0,external_wp_element_namespaceObject.createElement)(downloadable_block_notice, { |
1213 block: item |
1226 block: item |
1214 }) : Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("span", { |
1227 }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("span", { |
1215 className: "block-directory-downloadable-block-list-item__desc" |
1228 className: "block-directory-downloadable-block-list-item__desc" |
1216 }, !!statusText ? statusText : Object(external_wp_htmlEntities_["decodeEntities"])(description)), isInstallable && !(isInstalled || isInstalling) && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], null, Object(external_wp_i18n_["__"])('Install block'))))); |
1229 }, !!statusText ? statusText : (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(description)), isInstallable && !(isInstalled || isInstalling) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Install block'))))); |
1217 } |
1230 } |
1218 |
1231 |
1219 /* harmony default export */ var downloadable_block_list_item = (DownloadableBlockListItem); |
1232 /* harmony default export */ var downloadable_block_list_item = (DownloadableBlockListItem); |
1220 |
1233 |
1221 // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-list/index.js |
1234 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-list/index.js |
1222 |
1235 |
1223 |
1236 |
1224 |
1237 |
1225 /** |
1238 /** |
1226 * External dependencies |
1239 * External dependencies |
1285 })); |
1299 })); |
1286 } |
1300 } |
1287 |
1301 |
1288 /* harmony default export */ var downloadable_blocks_list = (DownloadableBlocksList); |
1302 /* harmony default export */ var downloadable_blocks_list = (DownloadableBlocksList); |
1289 |
1303 |
1290 // EXTERNAL MODULE: external ["wp","a11y"] |
1304 ;// CONCATENATED MODULE: external ["wp","a11y"] |
1291 var external_wp_a11y_ = __webpack_require__("gdqT"); |
1305 var external_wp_a11y_namespaceObject = window["wp"]["a11y"]; |
1292 |
1306 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/inserter-panel.js |
1293 // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/inserter-panel.js |
1307 |
1294 |
1308 |
1295 |
1309 /** |
1296 /** |
1310 * WordPress dependencies |
1297 * WordPress dependencies |
1311 */ |
1298 */ |
1312 |
1299 |
1313 |
1300 |
1314 |
1301 |
1315 |
1302 |
1316 function DownloadableBlocksInserterPanel(_ref) { |
1303 function DownloadableBlocksInserterPanel({ |
1317 let { |
1304 children, |
1318 children, |
1305 downloadableItems, |
1319 downloadableItems, |
1306 hasLocalBlocks |
1320 hasLocalBlocks |
1307 }) { |
1321 } = _ref; |
1308 const count = downloadableItems.length; |
1322 const count = downloadableItems.length; |
1309 Object(external_wp_element_["useEffect"])(() => { |
1323 (0,external_wp_element_namespaceObject.useEffect)(() => { |
1310 Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["sprintf"])( |
1324 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( |
1311 /* translators: %d: number of available blocks. */ |
1325 /* translators: %d: number of available blocks. */ |
1312 Object(external_wp_i18n_["_n"])('%d additional block is available to install.', '%d additional blocks are available to install.', count), count)); |
1326 (0,external_wp_i18n_namespaceObject._n)('%d additional block is available to install.', '%d additional blocks are available to install.', count), count)); |
1313 }, [count]); |
1327 }, [count]); |
1314 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, !hasLocalBlocks && Object(external_wp_element_["createElement"])("p", { |
1328 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !hasLocalBlocks && (0,external_wp_element_namespaceObject.createElement)("p", { |
1315 className: "block-directory-downloadable-blocks-panel__no-local" |
1329 className: "block-directory-downloadable-blocks-panel__no-local" |
1316 }, Object(external_wp_i18n_["__"])('No results available from your installed blocks.')), Object(external_wp_element_["createElement"])("div", { |
1330 }, (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.')), (0,external_wp_element_namespaceObject.createElement)("div", { |
1317 className: "block-editor-inserter__quick-inserter-separator" |
1331 className: "block-editor-inserter__quick-inserter-separator" |
1318 }), Object(external_wp_element_["createElement"])("div", { |
1332 }), (0,external_wp_element_namespaceObject.createElement)("div", { |
1319 className: "block-directory-downloadable-blocks-panel" |
1333 className: "block-directory-downloadable-blocks-panel" |
1320 }, Object(external_wp_element_["createElement"])("div", { |
1334 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
1321 className: "block-directory-downloadable-blocks-panel__header" |
1335 className: "block-directory-downloadable-blocks-panel__header" |
1322 }, Object(external_wp_element_["createElement"])("h2", { |
1336 }, (0,external_wp_element_namespaceObject.createElement)("h2", { |
1323 className: "block-directory-downloadable-blocks-panel__title" |
1337 className: "block-directory-downloadable-blocks-panel__title" |
1324 }, Object(external_wp_i18n_["__"])('Available to install')), Object(external_wp_element_["createElement"])("p", { |
1338 }, (0,external_wp_i18n_namespaceObject.__)('Available to install')), (0,external_wp_element_namespaceObject.createElement)("p", { |
1325 className: "block-directory-downloadable-blocks-panel__description" |
1339 className: "block-directory-downloadable-blocks-panel__description" |
1326 }, Object(external_wp_i18n_["__"])('Select a block to install and add it to your post.'))), children)); |
1340 }, (0,external_wp_i18n_namespaceObject.__)('Select a block to install and add it to your post.'))), children)); |
1327 } |
1341 } |
1328 |
1342 |
1329 /* harmony default export */ var inserter_panel = (DownloadableBlocksInserterPanel); |
1343 /* harmony default export */ var inserter_panel = (DownloadableBlocksInserterPanel); |
1330 |
1344 |
1331 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js |
1345 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js |
1332 var block_default = __webpack_require__("//Lo"); |
1346 |
1333 |
1347 |
1334 // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/no-results.js |
1348 /** |
|
1349 * WordPress dependencies |
|
1350 */ |
|
1351 |
|
1352 const blockDefault = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
1353 xmlns: "http://www.w3.org/2000/svg", |
|
1354 viewBox: "0 0 24 24" |
|
1355 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
1356 d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" |
|
1357 })); |
|
1358 /* harmony default export */ var block_default = (blockDefault); |
|
1359 |
|
1360 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/no-results.js |
1335 |
1361 |
1336 |
1362 |
1337 /** |
1363 /** |
1338 * WordPress dependencies |
1364 * WordPress dependencies |
1339 */ |
1365 */ |
1340 |
1366 |
1341 |
1367 |
1342 |
1368 |
1343 function DownloadableBlocksNoResults() { |
1369 function DownloadableBlocksNoResults() { |
1344 return Object(external_wp_element_["createElement"])("div", { |
1370 return (0,external_wp_element_namespaceObject.createElement)("div", { |
1345 className: "block-editor-inserter__no-results" |
1371 className: "block-editor-inserter__no-results" |
1346 }, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { |
1372 }, (0,external_wp_element_namespaceObject.createElement)(icon, { |
1347 className: "block-editor-inserter__no-results-icon", |
1373 className: "block-editor-inserter__no-results-icon", |
1348 icon: block_default["a" /* default */] |
1374 icon: block_default |
1349 }), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('No results found.'))); |
1375 }), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No results found.'))); |
1350 } |
1376 } |
1351 |
1377 |
1352 /* harmony default export */ var no_results = (DownloadableBlocksNoResults); |
1378 /* harmony default export */ var no_results = (DownloadableBlocksNoResults); |
1353 |
1379 |
1354 // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/index.js |
1380 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/index.js |
1355 |
1381 |
1356 |
1382 |
1357 /** |
1383 /** |
1358 * WordPress dependencies |
1384 * WordPress dependencies |
1359 */ |
1385 */ |
1370 |
1396 |
1371 |
1397 |
1372 |
1398 |
1373 |
1399 |
1374 |
1400 |
1375 function DownloadableBlocksPanel({ |
1401 function DownloadableBlocksPanel(_ref) { |
1376 downloadableItems, |
1402 let { |
1377 onSelect, |
1403 downloadableItems, |
1378 onHover, |
1404 onSelect, |
1379 hasLocalBlocks, |
1405 onHover, |
1380 hasPermission, |
1406 hasLocalBlocks, |
1381 isLoading, |
1407 hasPermission, |
1382 isTyping |
1408 isLoading, |
1383 }) { |
1409 isTyping |
|
1410 } = _ref; |
|
1411 |
1384 if (typeof hasPermission === 'undefined' || isLoading || isTyping) { |
1412 if (typeof hasPermission === 'undefined' || isLoading || isTyping) { |
1385 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, hasPermission && !hasLocalBlocks && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("p", { |
1413 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, hasPermission && !hasLocalBlocks && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", { |
1386 className: "block-directory-downloadable-blocks-panel__no-local" |
1414 className: "block-directory-downloadable-blocks-panel__no-local" |
1387 }, Object(external_wp_i18n_["__"])('No results available from your installed blocks.')), Object(external_wp_element_["createElement"])("div", { |
1415 }, (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.')), (0,external_wp_element_namespaceObject.createElement)("div", { |
1388 className: "block-editor-inserter__quick-inserter-separator" |
1416 className: "block-editor-inserter__quick-inserter-separator" |
1389 })), Object(external_wp_element_["createElement"])("div", { |
1417 })), (0,external_wp_element_namespaceObject.createElement)("div", { |
1390 className: "block-directory-downloadable-blocks-panel has-blocks-loading" |
1418 className: "block-directory-downloadable-blocks-panel has-blocks-loading" |
1391 }, Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null))); |
1419 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null))); |
1392 } |
1420 } |
1393 |
1421 |
1394 if (false === hasPermission) { |
1422 if (false === hasPermission) { |
1395 if (!hasLocalBlocks) { |
1423 if (!hasLocalBlocks) { |
1396 return Object(external_wp_element_["createElement"])(no_results, null); |
1424 return (0,external_wp_element_namespaceObject.createElement)(no_results, null); |
1397 } |
1425 } |
1398 |
1426 |
1399 return null; |
1427 return null; |
1400 } |
1428 } |
1401 |
1429 |
1402 return !!downloadableItems.length ? Object(external_wp_element_["createElement"])(inserter_panel, { |
1430 return !!downloadableItems.length ? (0,external_wp_element_namespaceObject.createElement)(inserter_panel, { |
1403 downloadableItems: downloadableItems, |
1431 downloadableItems: downloadableItems, |
1404 hasLocalBlocks: hasLocalBlocks |
1432 hasLocalBlocks: hasLocalBlocks |
1405 }, Object(external_wp_element_["createElement"])(downloadable_blocks_list, { |
1433 }, (0,external_wp_element_namespaceObject.createElement)(downloadable_blocks_list, { |
1406 items: downloadableItems, |
1434 items: downloadableItems, |
1407 onSelect: onSelect, |
1435 onSelect: onSelect, |
1408 onHover: onHover |
1436 onHover: onHover |
1409 })) : !hasLocalBlocks && Object(external_wp_element_["createElement"])(no_results, null); |
1437 })) : !hasLocalBlocks && (0,external_wp_element_namespaceObject.createElement)(no_results, null); |
1410 } |
1438 } |
1411 |
1439 |
1412 /* harmony default export */ var downloadable_blocks_panel = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, { |
1440 /* harmony default export */ var downloadable_blocks_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => { |
1413 filterValue, |
1441 let { |
1414 rootClientId = null |
1442 filterValue, |
1415 }) => { |
1443 rootClientId = null |
|
1444 } = _ref2; |
1416 const { |
1445 const { |
1417 getDownloadableBlocks, |
1446 getDownloadableBlocks, |
1418 isRequestingDownloadableBlocks |
1447 isRequestingDownloadableBlocks |
1419 } = select(store); |
1448 } = select(store); |
1420 const { |
1449 const { |
1421 canInsertBlockType |
1450 canInsertBlockType |
1422 } = select(external_wp_blockEditor_["store"]); |
1451 } = select(external_wp_blockEditor_namespaceObject.store); |
1423 const hasPermission = select(external_wp_coreData_["store"]).canUser('read', 'block-directory/search'); |
1452 const hasPermission = select(external_wp_coreData_namespaceObject.store).canUser('read', 'block-directory/search'); |
1424 |
1453 |
1425 function getInstallableBlocks(term) { |
1454 function getInstallableBlocks(term) { |
1426 return getDownloadableBlocks(term).filter(block => canInsertBlockType(block, rootClientId, true)); |
1455 return getDownloadableBlocks(term).filter(block => canInsertBlockType(block, rootClientId, true)); |
1427 } |
1456 } |
1428 |
1457 |
1641 // eslint-disable-next-line react-hooks/rules-of-hooks |
1677 // eslint-disable-next-line react-hooks/rules-of-hooks |
1642 |
1678 |
1643 const { |
1679 const { |
1644 block, |
1680 block, |
1645 hasPermission |
1681 hasPermission |
1646 } = Object(external_wp_data_["useSelect"])(select => { |
1682 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
1647 const { |
1683 const { |
1648 getDownloadableBlocks |
1684 getDownloadableBlocks |
1649 } = select(store); |
1685 } = select(store); |
1650 const blocks = getDownloadableBlocks('block:' + originalName).filter(({ |
1686 const blocks = getDownloadableBlocks('block:' + originalName).filter(_ref => { |
1651 name |
1687 let { |
1652 }) => originalName === name); |
1688 name |
|
1689 } = _ref; |
|
1690 return originalName === name; |
|
1691 }); |
1653 return { |
1692 return { |
1654 hasPermission: select(external_wp_coreData_["store"]).canUser('read', 'block-directory/search'), |
1693 hasPermission: select(external_wp_coreData_namespaceObject.store).canUser('read', 'block-directory/search'), |
1655 block: blocks.length && blocks[0] |
1694 block: blocks.length && blocks[0] |
1656 }; |
1695 }; |
1657 }, [originalName]); // The user can't install blocks, or the block isn't available for download. |
1696 }, [originalName]); // The user can't install blocks, or the block isn't available for download. |
1658 |
1697 |
1659 if (!hasPermission || !block) { |
1698 if (!hasPermission || !block) { |
1660 return Object(external_wp_element_["createElement"])(OriginalComponent, props); |
1699 return (0,external_wp_element_namespaceObject.createElement)(OriginalComponent, props); |
1661 } |
1700 } |
1662 |
1701 |
1663 return Object(external_wp_element_["createElement"])(ModifiedWarning, Object(esm_extends["a" /* default */])({}, props, { |
1702 return (0,external_wp_element_namespaceObject.createElement)(ModifiedWarning, _extends({}, props, { |
1664 originalBlock: block |
1703 originalBlock: block |
1665 })); |
1704 })); |
1666 }; |
1705 }; |
1667 |
1706 |
1668 const ModifiedWarning = ({ |
1707 const ModifiedWarning = _ref2 => { |
1669 originalBlock, |
1708 let { |
1670 ...props |
1709 originalBlock, |
1671 }) => { |
1710 ...props |
|
1711 } = _ref2; |
1672 const { |
1712 const { |
1673 originalName, |
1713 originalName, |
1674 originalUndelimitedContent |
1714 originalUndelimitedContent |
1675 } = props.attributes; |
1715 } = props.attributes; |
1676 const { |
1716 const { |
1677 replaceBlock |
1717 replaceBlock |
1678 } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]); |
1718 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
1679 |
1719 |
1680 const convertToHTML = () => { |
1720 const convertToHTML = () => { |
1681 replaceBlock(props.clientId, Object(external_wp_blocks_["createBlock"])('core/html', { |
1721 replaceBlock(props.clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/html', { |
1682 content: originalUndelimitedContent |
1722 content: originalUndelimitedContent |
1683 })); |
1723 })); |
1684 }; |
1724 }; |
1685 |
1725 |
1686 const hasContent = !!originalUndelimitedContent; |
1726 const hasContent = !!originalUndelimitedContent; |
1687 const hasHTMLBlock = Object(external_wp_blocks_["getBlockType"])('core/html'); |
1727 const hasHTMLBlock = (0,external_wp_blocks_namespaceObject.getBlockType)('core/html'); |
1688 let messageHTML = Object(external_wp_i18n_["sprintf"])( |
1728 let messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( |
1689 /* translators: %s: block name */ |
1729 /* translators: %s: block name */ |
1690 Object(external_wp_i18n_["__"])('Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'), originalBlock.title || originalName); |
1730 (0,external_wp_i18n_namespaceObject.__)('Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'), originalBlock.title || originalName); |
1691 const actions = [Object(external_wp_element_["createElement"])(InstallButton, { |
1731 const actions = [(0,external_wp_element_namespaceObject.createElement)(InstallButton, { |
1692 key: "install", |
1732 key: "install", |
1693 block: originalBlock, |
1733 block: originalBlock, |
1694 attributes: props.attributes, |
1734 attributes: props.attributes, |
1695 clientId: props.clientId |
1735 clientId: props.clientId |
1696 })]; |
1736 })]; |
1697 |
1737 |
1698 if (hasContent && hasHTMLBlock) { |
1738 if (hasContent && hasHTMLBlock) { |
1699 messageHTML = Object(external_wp_i18n_["sprintf"])( |
1739 messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( |
1700 /* translators: %s: block name */ |
1740 /* translators: %s: block name */ |
1701 Object(external_wp_i18n_["__"])('Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'), originalBlock.title || originalName); |
1741 (0,external_wp_i18n_namespaceObject.__)('Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'), originalBlock.title || originalName); |
1702 actions.push(Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
1742 actions.push((0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
1703 key: "convert", |
1743 key: "convert", |
1704 onClick: convertToHTML, |
1744 onClick: convertToHTML, |
1705 isLink: true |
1745 variant: "link" |
1706 }, Object(external_wp_i18n_["__"])('Keep as HTML'))); |
1746 }, (0,external_wp_i18n_namespaceObject.__)('Keep as HTML'))); |
1707 } |
1747 } |
1708 |
1748 |
1709 return Object(external_wp_element_["createElement"])("div", Object(external_wp_blockEditor_["useBlockProps"])(), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], { |
1749 return (0,external_wp_element_namespaceObject.createElement)("div", (0,external_wp_blockEditor_namespaceObject.useBlockProps)(), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, { |
1710 actions: actions |
1750 actions: actions |
1711 }, messageHTML), Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, originalUndelimitedContent)); |
1751 }, messageHTML), (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, originalUndelimitedContent)); |
1712 }; |
1752 }; |
1713 |
1753 |
1714 /* harmony default export */ var get_install_missing = (getInstallMissing); |
1754 /* harmony default export */ var get_install_missing = (getInstallMissing); |
1715 |
1755 |
1716 // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/index.js |
1756 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/index.js |
1717 |
1757 |
1718 |
1758 |
1719 /** |
1759 /** |
1720 * WordPress dependencies |
1760 * WordPress dependencies |
1721 */ |
1761 */ |
1727 |
1767 |
1728 |
1768 |
1729 |
1769 |
1730 |
1770 |
1731 |
1771 |
1732 Object(external_wp_plugins_["registerPlugin"])('block-directory', { |
1772 (0,external_wp_plugins_namespaceObject.registerPlugin)('block-directory', { |
1733 render() { |
1773 render() { |
1734 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(AutoBlockUninstaller, null), Object(external_wp_element_["createElement"])(inserter_menu_downloadable_blocks_panel, null), Object(external_wp_element_["createElement"])(InstalledBlocksPrePublishPanel, null)); |
1774 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(AutoBlockUninstaller, null), (0,external_wp_element_namespaceObject.createElement)(inserter_menu_downloadable_blocks_panel, null), (0,external_wp_element_namespaceObject.createElement)(InstalledBlocksPrePublishPanel, null)); |
1735 } |
1775 } |
1736 |
1776 |
1737 }); |
1777 }); |
1738 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'block-directory/fallback', (settings, name) => { |
1778 (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'block-directory/fallback', (settings, name) => { |
1739 if (name !== 'core/missing') { |
1779 if (name !== 'core/missing') { |
1740 return settings; |
1780 return settings; |
1741 } |
1781 } |
1742 |
1782 |
1743 settings.edit = get_install_missing(settings.edit); |
1783 settings.edit = get_install_missing(settings.edit); |
1744 return settings; |
1784 return settings; |
1745 }); |
1785 }); |
1746 |
1786 |
1747 // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/index.js |
1787 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/index.js |
1748 /** |
1788 /** |
1749 * Internal dependencies |
1789 * Internal dependencies |
1750 */ |
1790 */ |
1751 |
1791 |
1752 |
1792 |
1753 |
1793 |
1754 |
1794 (window.wp = window.wp || {}).blockDirectory = __webpack_exports__; |
1755 /***/ }), |
1795 /******/ })() |
1756 |
1796 ; |
1757 /***/ "BLhE": |
|
1758 /***/ (function(module, exports) { |
|
1759 |
|
1760 (function() { module.exports = window["wp"]["editPost"]; }()); |
|
1761 |
|
1762 /***/ }), |
|
1763 |
|
1764 /***/ "GRId": |
|
1765 /***/ (function(module, exports) { |
|
1766 |
|
1767 (function() { module.exports = window["wp"]["element"]; }()); |
|
1768 |
|
1769 /***/ }), |
|
1770 |
|
1771 /***/ "HSyU": |
|
1772 /***/ (function(module, exports) { |
|
1773 |
|
1774 (function() { module.exports = window["wp"]["blocks"]; }()); |
|
1775 |
|
1776 /***/ }), |
|
1777 |
|
1778 /***/ "K9lf": |
|
1779 /***/ (function(module, exports) { |
|
1780 |
|
1781 (function() { module.exports = window["wp"]["compose"]; }()); |
|
1782 |
|
1783 /***/ }), |
|
1784 |
|
1785 /***/ "Tqx9": |
|
1786 /***/ (function(module, exports) { |
|
1787 |
|
1788 (function() { module.exports = window["wp"]["primitives"]; }()); |
|
1789 |
|
1790 /***/ }), |
|
1791 |
|
1792 /***/ "TvNi": |
|
1793 /***/ (function(module, exports) { |
|
1794 |
|
1795 (function() { module.exports = window["wp"]["plugins"]; }()); |
|
1796 |
|
1797 /***/ }), |
|
1798 |
|
1799 /***/ "URob": |
|
1800 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1801 |
|
1802 "use strict"; |
|
1803 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
1804 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
1805 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
1806 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
1807 |
|
1808 |
|
1809 /** |
|
1810 * WordPress dependencies |
|
1811 */ |
|
1812 |
|
1813 const starFilled = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
1814 xmlns: "http://www.w3.org/2000/svg", |
|
1815 viewBox: "0 0 24 24" |
|
1816 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
1817 d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" |
|
1818 })); |
|
1819 /* harmony default export */ __webpack_exports__["a"] = (starFilled); |
|
1820 |
|
1821 |
|
1822 /***/ }), |
|
1823 |
|
1824 /***/ "Xxwi": |
|
1825 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1826 |
|
1827 "use strict"; |
|
1828 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
1829 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
1830 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
1831 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
1832 |
|
1833 |
|
1834 /** |
|
1835 * WordPress dependencies |
|
1836 */ |
|
1837 |
|
1838 const starEmpty = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
1839 xmlns: "http://www.w3.org/2000/svg", |
|
1840 viewBox: "0 0 24 24" |
|
1841 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
1842 fillRule: "evenodd", |
|
1843 d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z", |
|
1844 clipRule: "evenodd" |
|
1845 })); |
|
1846 /* harmony default export */ __webpack_exports__["a"] = (starEmpty); |
|
1847 |
|
1848 |
|
1849 /***/ }), |
|
1850 |
|
1851 /***/ "YLtl": |
|
1852 /***/ (function(module, exports) { |
|
1853 |
|
1854 (function() { module.exports = window["lodash"]; }()); |
|
1855 |
|
1856 /***/ }), |
|
1857 |
|
1858 /***/ "axFQ": |
|
1859 /***/ (function(module, exports) { |
|
1860 |
|
1861 (function() { module.exports = window["wp"]["blockEditor"]; }()); |
|
1862 |
|
1863 /***/ }), |
|
1864 |
|
1865 /***/ "g56x": |
|
1866 /***/ (function(module, exports) { |
|
1867 |
|
1868 (function() { module.exports = window["wp"]["hooks"]; }()); |
|
1869 |
|
1870 /***/ }), |
|
1871 |
|
1872 /***/ "gdqT": |
|
1873 /***/ (function(module, exports) { |
|
1874 |
|
1875 (function() { module.exports = window["wp"]["a11y"]; }()); |
|
1876 |
|
1877 /***/ }), |
|
1878 |
|
1879 /***/ "iClF": |
|
1880 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1881 |
|
1882 "use strict"; |
|
1883 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
1884 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
1885 /** |
|
1886 * WordPress dependencies |
|
1887 */ |
|
1888 |
|
1889 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ |
|
1890 |
|
1891 /** |
|
1892 * Return an SVG icon. |
|
1893 * |
|
1894 * @param {IconProps} props icon is the SVG component to render |
|
1895 * size is a number specifiying the icon size in pixels |
|
1896 * Other props will be passed to wrapped SVG component |
|
1897 * |
|
1898 * @return {JSX.Element} Icon component |
|
1899 */ |
|
1900 |
|
1901 function Icon({ |
|
1902 icon, |
|
1903 size = 24, |
|
1904 ...props |
|
1905 }) { |
|
1906 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cloneElement"])(icon, { |
|
1907 width: size, |
|
1908 height: size, |
|
1909 ...props |
|
1910 }); |
|
1911 } |
|
1912 |
|
1913 /* harmony default export */ __webpack_exports__["a"] = (Icon); |
|
1914 |
|
1915 |
|
1916 /***/ }), |
|
1917 |
|
1918 /***/ "jSdM": |
|
1919 /***/ (function(module, exports) { |
|
1920 |
|
1921 (function() { module.exports = window["wp"]["editor"]; }()); |
|
1922 |
|
1923 /***/ }), |
|
1924 |
|
1925 /***/ "jZUy": |
|
1926 /***/ (function(module, exports) { |
|
1927 |
|
1928 (function() { module.exports = window["wp"]["coreData"]; }()); |
|
1929 |
|
1930 /***/ }), |
|
1931 |
|
1932 /***/ "l3Sj": |
|
1933 /***/ (function(module, exports) { |
|
1934 |
|
1935 (function() { module.exports = window["wp"]["i18n"]; }()); |
|
1936 |
|
1937 /***/ }), |
|
1938 |
|
1939 /***/ "onLe": |
|
1940 /***/ (function(module, exports) { |
|
1941 |
|
1942 (function() { module.exports = window["wp"]["notices"]; }()); |
|
1943 |
|
1944 /***/ }), |
|
1945 |
|
1946 /***/ "rmEH": |
|
1947 /***/ (function(module, exports) { |
|
1948 |
|
1949 (function() { module.exports = window["wp"]["htmlEntities"]; }()); |
|
1950 |
|
1951 /***/ }), |
|
1952 |
|
1953 /***/ "tI+e": |
|
1954 /***/ (function(module, exports) { |
|
1955 |
|
1956 (function() { module.exports = window["wp"]["components"]; }()); |
|
1957 |
|
1958 /***/ }), |
|
1959 |
|
1960 /***/ "wx14": |
|
1961 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1962 |
|
1963 "use strict"; |
|
1964 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); |
|
1965 function _extends() { |
|
1966 _extends = Object.assign || function (target) { |
|
1967 for (var i = 1; i < arguments.length; i++) { |
|
1968 var source = arguments[i]; |
|
1969 |
|
1970 for (var key in source) { |
|
1971 if (Object.prototype.hasOwnProperty.call(source, key)) { |
|
1972 target[key] = source[key]; |
|
1973 } |
|
1974 } |
|
1975 } |
|
1976 |
|
1977 return target; |
|
1978 }; |
|
1979 |
|
1980 return _extends.apply(this, arguments); |
|
1981 } |
|
1982 |
|
1983 /***/ }), |
|
1984 |
|
1985 /***/ "ywyh": |
|
1986 /***/ (function(module, exports) { |
|
1987 |
|
1988 (function() { module.exports = window["wp"]["apiFetch"]; }()); |
|
1989 |
|
1990 /***/ }) |
|
1991 |
|
1992 /******/ }); |
|