1 /******/ (function() { // webpackBootstrap |
1 /******/ (() => { // webpackBootstrap |
2 /******/ "use strict"; |
2 /******/ "use strict"; |
3 /******/ // The require scope |
3 /******/ // The require scope |
4 /******/ var __webpack_require__ = {}; |
4 /******/ var __webpack_require__ = {}; |
5 /******/ |
5 /******/ |
6 /************************************************************************/ |
6 /************************************************************************/ |
7 /******/ /* webpack/runtime/compat get default export */ |
7 /******/ /* webpack/runtime/compat get default export */ |
8 /******/ !function() { |
8 /******/ (() => { |
9 /******/ // getDefaultExport function for compatibility with non-harmony modules |
9 /******/ // getDefaultExport function for compatibility with non-harmony modules |
10 /******/ __webpack_require__.n = function(module) { |
10 /******/ __webpack_require__.n = (module) => { |
11 /******/ var getter = module && module.__esModule ? |
11 /******/ var getter = module && module.__esModule ? |
12 /******/ function() { return module['default']; } : |
12 /******/ () => (module['default']) : |
13 /******/ function() { return module; }; |
13 /******/ () => (module); |
14 /******/ __webpack_require__.d(getter, { a: getter }); |
14 /******/ __webpack_require__.d(getter, { a: getter }); |
15 /******/ return getter; |
15 /******/ return getter; |
16 /******/ }; |
16 /******/ }; |
17 /******/ }(); |
17 /******/ })(); |
18 /******/ |
18 /******/ |
19 /******/ /* webpack/runtime/define property getters */ |
19 /******/ /* webpack/runtime/define property getters */ |
20 /******/ !function() { |
20 /******/ (() => { |
21 /******/ // define getter functions for harmony exports |
21 /******/ // define getter functions for harmony exports |
22 /******/ __webpack_require__.d = function(exports, definition) { |
22 /******/ __webpack_require__.d = (exports, definition) => { |
23 /******/ for(var key in definition) { |
23 /******/ for(var key in definition) { |
24 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
24 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
25 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
25 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
26 /******/ } |
26 /******/ } |
27 /******/ } |
27 /******/ } |
28 /******/ }; |
28 /******/ }; |
29 /******/ }(); |
29 /******/ })(); |
30 /******/ |
30 /******/ |
31 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
31 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
32 /******/ !function() { |
32 /******/ (() => { |
33 /******/ __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)) |
34 /******/ }(); |
34 /******/ })(); |
35 /******/ |
35 /******/ |
36 /******/ /* webpack/runtime/make namespace object */ |
36 /******/ /* webpack/runtime/make namespace object */ |
37 /******/ !function() { |
37 /******/ (() => { |
38 /******/ // define __esModule on exports |
38 /******/ // define __esModule on exports |
39 /******/ __webpack_require__.r = function(exports) { |
39 /******/ __webpack_require__.r = (exports) => { |
40 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
40 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
41 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
41 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
42 /******/ } |
42 /******/ } |
43 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
43 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
44 /******/ }; |
44 /******/ }; |
45 /******/ }(); |
45 /******/ })(); |
46 /******/ |
46 /******/ |
47 /************************************************************************/ |
47 /************************************************************************/ |
48 var __webpack_exports__ = {}; |
48 var __webpack_exports__ = {}; |
49 // ESM COMPAT FLAG |
49 // ESM COMPAT FLAG |
50 __webpack_require__.r(__webpack_exports__); |
50 __webpack_require__.r(__webpack_exports__); |
51 |
51 |
52 // EXPORTS |
52 // EXPORTS |
53 __webpack_require__.d(__webpack_exports__, { |
53 __webpack_require__.d(__webpack_exports__, { |
54 "store": function() { return /* reexport */ store; } |
54 store: () => (/* reexport */ store) |
55 }); |
55 }); |
56 |
56 |
57 // 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 |
58 var selectors_namespaceObject = {}; |
58 var selectors_namespaceObject = {}; |
59 __webpack_require__.r(selectors_namespaceObject); |
59 __webpack_require__.r(selectors_namespaceObject); |
60 __webpack_require__.d(selectors_namespaceObject, { |
60 __webpack_require__.d(selectors_namespaceObject, { |
61 "getDownloadableBlocks": function() { return getDownloadableBlocks; }, |
61 getDownloadableBlocks: () => (getDownloadableBlocks), |
62 "getErrorNoticeForBlock": function() { return getErrorNoticeForBlock; }, |
62 getErrorNoticeForBlock: () => (getErrorNoticeForBlock), |
63 "getErrorNotices": function() { return getErrorNotices; }, |
63 getErrorNotices: () => (getErrorNotices), |
64 "getInstalledBlockTypes": function() { return getInstalledBlockTypes; }, |
64 getInstalledBlockTypes: () => (getInstalledBlockTypes), |
65 "getNewBlockTypes": function() { return getNewBlockTypes; }, |
65 getNewBlockTypes: () => (getNewBlockTypes), |
66 "getUnusedBlockTypes": function() { return getUnusedBlockTypes; }, |
66 getUnusedBlockTypes: () => (getUnusedBlockTypes), |
67 "isInstalling": function() { return isInstalling; }, |
67 isInstalling: () => (isInstalling), |
68 "isRequestingDownloadableBlocks": function() { return isRequestingDownloadableBlocks; } |
68 isRequestingDownloadableBlocks: () => (isRequestingDownloadableBlocks) |
69 }); |
69 }); |
70 |
70 |
71 // 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 |
72 var actions_namespaceObject = {}; |
72 var actions_namespaceObject = {}; |
73 __webpack_require__.r(actions_namespaceObject); |
73 __webpack_require__.r(actions_namespaceObject); |
74 __webpack_require__.d(actions_namespaceObject, { |
74 __webpack_require__.d(actions_namespaceObject, { |
75 "addInstalledBlockType": function() { return addInstalledBlockType; }, |
75 addInstalledBlockType: () => (addInstalledBlockType), |
76 "clearErrorNotice": function() { return clearErrorNotice; }, |
76 clearErrorNotice: () => (clearErrorNotice), |
77 "fetchDownloadableBlocks": function() { return fetchDownloadableBlocks; }, |
77 fetchDownloadableBlocks: () => (fetchDownloadableBlocks), |
78 "installBlockType": function() { return installBlockType; }, |
78 installBlockType: () => (installBlockType), |
79 "receiveDownloadableBlocks": function() { return receiveDownloadableBlocks; }, |
79 receiveDownloadableBlocks: () => (receiveDownloadableBlocks), |
80 "removeInstalledBlockType": function() { return removeInstalledBlockType; }, |
80 removeInstalledBlockType: () => (removeInstalledBlockType), |
81 "setErrorNotice": function() { return setErrorNotice; }, |
81 setErrorNotice: () => (setErrorNotice), |
82 "setIsInstalling": function() { return setIsInstalling; }, |
82 setIsInstalling: () => (setIsInstalling), |
83 "uninstallBlockType": function() { return uninstallBlockType; } |
83 uninstallBlockType: () => (uninstallBlockType) |
84 }); |
84 }); |
85 |
85 |
86 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js |
86 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js |
87 var resolvers_namespaceObject = {}; |
87 var resolvers_namespaceObject = {}; |
88 __webpack_require__.r(resolvers_namespaceObject); |
88 __webpack_require__.r(resolvers_namespaceObject); |
89 __webpack_require__.d(resolvers_namespaceObject, { |
89 __webpack_require__.d(resolvers_namespaceObject, { |
90 "getDownloadableBlocks": function() { return resolvers_getDownloadableBlocks; } |
90 getDownloadableBlocks: () => (resolvers_getDownloadableBlocks) |
91 }); |
91 }); |
92 |
92 |
|
93 ;// CONCATENATED MODULE: external ["wp","plugins"] |
|
94 const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; |
|
95 ;// CONCATENATED MODULE: external ["wp","hooks"] |
|
96 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; |
|
97 ;// CONCATENATED MODULE: external ["wp","blocks"] |
|
98 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; |
|
99 ;// CONCATENATED MODULE: external ["wp","data"] |
|
100 const external_wp_data_namespaceObject = window["wp"]["data"]; |
93 ;// CONCATENATED MODULE: external ["wp","element"] |
101 ;// CONCATENATED MODULE: external ["wp","element"] |
94 var external_wp_element_namespaceObject = window["wp"]["element"]; |
102 const external_wp_element_namespaceObject = window["wp"]["element"]; |
95 ;// CONCATENATED MODULE: external ["wp","plugins"] |
|
96 var external_wp_plugins_namespaceObject = window["wp"]["plugins"]; |
|
97 ;// CONCATENATED MODULE: external ["wp","hooks"] |
|
98 var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; |
|
99 ;// CONCATENATED MODULE: external ["wp","blocks"] |
|
100 var external_wp_blocks_namespaceObject = window["wp"]["blocks"]; |
|
101 ;// CONCATENATED MODULE: external ["wp","data"] |
|
102 var external_wp_data_namespaceObject = window["wp"]["data"]; |
|
103 ;// CONCATENATED MODULE: external ["wp","editor"] |
103 ;// CONCATENATED MODULE: external ["wp","editor"] |
104 var external_wp_editor_namespaceObject = window["wp"]["editor"]; |
104 const external_wp_editor_namespaceObject = window["wp"]["editor"]; |
105 ;// CONCATENATED MODULE: external "lodash" |
|
106 var external_lodash_namespaceObject = window["lodash"]; |
|
107 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/reducer.js |
105 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/reducer.js |
108 /** |
|
109 * External dependencies |
|
110 */ |
|
111 |
|
112 /** |
106 /** |
113 * WordPress dependencies |
107 * WordPress dependencies |
114 */ |
108 */ |
115 |
109 |
116 |
110 |
120 * @param {Object} state Current state. |
114 * @param {Object} state Current state. |
121 * @param {Object} action Dispatched action. |
115 * @param {Object} action Dispatched action. |
122 * |
116 * |
123 * @return {Object} Updated state. |
117 * @return {Object} Updated state. |
124 */ |
118 */ |
125 |
119 const downloadableBlocks = (state = {}, action) => { |
126 const downloadableBlocks = function () { |
|
127 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
128 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
129 |
|
130 switch (action.type) { |
120 switch (action.type) { |
131 case 'FETCH_DOWNLOADABLE_BLOCKS': |
121 case 'FETCH_DOWNLOADABLE_BLOCKS': |
132 return { ...state, |
122 return { |
|
123 ...state, |
133 [action.filterValue]: { |
124 [action.filterValue]: { |
134 isRequesting: true |
125 isRequesting: true |
135 } |
126 } |
136 }; |
127 }; |
137 |
|
138 case 'RECEIVE_DOWNLOADABLE_BLOCKS': |
128 case 'RECEIVE_DOWNLOADABLE_BLOCKS': |
139 return { ...state, |
129 return { |
|
130 ...state, |
140 [action.filterValue]: { |
131 [action.filterValue]: { |
141 results: action.downloadableBlocks, |
132 results: action.downloadableBlocks, |
142 isRequesting: false |
133 isRequesting: false |
143 } |
134 } |
144 }; |
135 }; |
145 } |
136 } |
146 |
|
147 return state; |
137 return state; |
148 }; |
138 }; |
|
139 |
149 /** |
140 /** |
150 * Reducer managing the installation and deletion of blocks. |
141 * Reducer managing the installation and deletion of blocks. |
151 * |
142 * |
152 * @param {Object} state Current state. |
143 * @param {Object} state Current state. |
153 * @param {Object} action Dispatched action. |
144 * @param {Object} action Dispatched action. |
154 * |
145 * |
155 * @return {Object} Updated state. |
146 * @return {Object} Updated state. |
156 */ |
147 */ |
157 |
148 const blockManagement = (state = { |
158 const blockManagement = function () { |
149 installedBlockTypes: [], |
159 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { |
150 isInstalling: {} |
160 installedBlockTypes: [], |
151 }, action) => { |
161 isInstalling: {} |
|
162 }; |
|
163 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
164 |
|
165 switch (action.type) { |
152 switch (action.type) { |
166 case 'ADD_INSTALLED_BLOCK_TYPE': |
153 case 'ADD_INSTALLED_BLOCK_TYPE': |
167 return { ...state, |
154 return { |
|
155 ...state, |
168 installedBlockTypes: [...state.installedBlockTypes, action.item] |
156 installedBlockTypes: [...state.installedBlockTypes, action.item] |
169 }; |
157 }; |
170 |
|
171 case 'REMOVE_INSTALLED_BLOCK_TYPE': |
158 case 'REMOVE_INSTALLED_BLOCK_TYPE': |
172 return { ...state, |
159 return { |
|
160 ...state, |
173 installedBlockTypes: state.installedBlockTypes.filter(blockType => blockType.name !== action.item.name) |
161 installedBlockTypes: state.installedBlockTypes.filter(blockType => blockType.name !== action.item.name) |
174 }; |
162 }; |
175 |
|
176 case 'SET_INSTALLING_BLOCK': |
163 case 'SET_INSTALLING_BLOCK': |
177 return { ...state, |
164 return { |
178 isInstalling: { ...state.isInstalling, |
165 ...state, |
|
166 isInstalling: { |
|
167 ...state.isInstalling, |
179 [action.blockId]: action.isInstalling |
168 [action.blockId]: action.isInstalling |
180 } |
169 } |
181 }; |
170 }; |
182 } |
171 } |
183 |
|
184 return state; |
172 return state; |
185 }; |
173 }; |
|
174 |
186 /** |
175 /** |
187 * Reducer returning an object of error notices. |
176 * Reducer returning an object of error notices. |
188 * |
177 * |
189 * @param {Object} state Current state. |
178 * @param {Object} state Current state. |
190 * @param {Object} action Dispatched action. |
179 * @param {Object} action Dispatched action. |
191 * |
180 * |
192 * @return {Object} Updated state. |
181 * @return {Object} Updated state. |
193 */ |
182 */ |
194 |
183 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 |
|
199 switch (action.type) { |
184 switch (action.type) { |
200 case 'SET_ERROR_NOTICE': |
185 case 'SET_ERROR_NOTICE': |
201 return { ...state, |
186 return { |
|
187 ...state, |
202 [action.blockId]: { |
188 [action.blockId]: { |
203 message: action.message, |
189 message: action.message, |
204 isFatal: action.isFatal |
190 isFatal: action.isFatal |
205 } |
191 } |
206 }; |
192 }; |
207 |
|
208 case 'CLEAR_ERROR_NOTICE': |
193 case 'CLEAR_ERROR_NOTICE': |
209 return (0,external_lodash_namespaceObject.omit)(state, action.blockId); |
194 const { |
210 } |
195 [action.blockId]: blockId, |
211 |
196 ...restState |
|
197 } = state; |
|
198 return restState; |
|
199 } |
212 return state; |
200 return state; |
213 }; |
201 }; |
214 /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ |
202 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ |
215 downloadableBlocks, |
203 downloadableBlocks, |
216 blockManagement, |
204 blockManagement, |
217 errorNotices |
205 errorNotices |
218 })); |
206 })); |
219 |
207 |
220 ;// CONCATENATED MODULE: external ["wp","blockEditor"] |
208 ;// CONCATENATED MODULE: external ["wp","blockEditor"] |
221 var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; |
209 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; |
222 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/utils/has-block-type.js |
210 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/utils/has-block-type.js |
223 /** |
211 /** |
224 * Check if a block list contains a specific block type. Recursively searches |
212 * Check if a block list contains a specific block type. Recursively searches |
225 * through `innerBlocks` if they exist. |
213 * through `innerBlocks` if they exist. |
226 * |
214 * |
227 * @param {Object} blockType A block object to search for. |
215 * @param {Object} blockType A block object to search for. |
228 * @param {Object[]} blocks The list of blocks to look through. |
216 * @param {Object[]} blocks The list of blocks to look through. |
229 * |
217 * |
230 * @return {boolean} Whether the blockType is found. |
218 * @return {boolean} Whether the blockType is found. |
231 */ |
219 */ |
232 function hasBlockType(blockType) { |
220 function hasBlockType(blockType, blocks = []) { |
233 let blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; |
|
234 |
|
235 if (!blocks.length) { |
221 if (!blocks.length) { |
236 return false; |
222 return false; |
237 } |
223 } |
238 |
224 if (blocks.some(({ |
239 if (blocks.some(_ref => { |
225 name |
240 let { |
226 }) => name === blockType.name)) { |
241 name |
|
242 } = _ref; |
|
243 return name === blockType.name; |
|
244 })) { |
|
245 return true; |
227 return true; |
246 } |
228 } |
247 |
|
248 for (let i = 0; i < blocks.length; i++) { |
229 for (let i = 0; i < blocks.length; i++) { |
249 if (hasBlockType(blockType, blocks[i].innerBlocks)) { |
230 if (hasBlockType(blockType, blocks[i].innerBlocks)) { |
250 return true; |
231 return true; |
251 } |
232 } |
252 } |
233 } |
253 |
|
254 return false; |
234 return false; |
255 } |
235 } |
256 |
236 |
257 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/selectors.js |
237 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/selectors.js |
258 /** |
238 /** |
259 * WordPress dependencies |
239 * WordPress dependencies |
260 */ |
240 */ |
|
241 |
261 |
242 |
262 |
243 |
263 /** |
244 /** |
264 * Internal dependencies |
245 * Internal dependencies |
265 */ |
246 */ |
271 * @param {Object} state Global application state. |
252 * @param {Object} state Global application state. |
272 * @param {string} filterValue Search string. |
253 * @param {string} filterValue Search string. |
273 * |
254 * |
274 * @return {boolean} Whether a request is in progress for the blocks list. |
255 * @return {boolean} Whether a request is in progress for the blocks list. |
275 */ |
256 */ |
276 |
|
277 function isRequestingDownloadableBlocks(state, filterValue) { |
257 function isRequestingDownloadableBlocks(state, filterValue) { |
278 var _state$downloadableBl, _state$downloadableBl2; |
258 var _state$downloadableBl; |
279 |
259 return (_state$downloadableBl = state.downloadableBlocks[filterValue]?.isRequesting) !== null && _state$downloadableBl !== void 0 ? _state$downloadableBl : false; |
280 return (_state$downloadableBl = (_state$downloadableBl2 = state.downloadableBlocks[filterValue]) === null || _state$downloadableBl2 === void 0 ? void 0 : _state$downloadableBl2.isRequesting) !== null && _state$downloadableBl !== void 0 ? _state$downloadableBl : false; |
260 } |
281 } |
261 |
282 /** |
262 /** |
283 * Returns the available uninstalled blocks. |
263 * Returns the available uninstalled blocks. |
284 * |
264 * |
285 * @param {Object} state Global application state. |
265 * @param {Object} state Global application state. |
286 * @param {string} filterValue Search string. |
266 * @param {string} filterValue Search string. |
287 * |
267 * |
288 * @return {Array} Downloadable blocks. |
268 * @return {Array} Downloadable blocks. |
289 */ |
269 */ |
290 |
|
291 function getDownloadableBlocks(state, filterValue) { |
270 function getDownloadableBlocks(state, filterValue) { |
292 var _state$downloadableBl3, _state$downloadableBl4; |
271 var _state$downloadableBl2; |
293 |
272 return (_state$downloadableBl2 = state.downloadableBlocks[filterValue]?.results) !== null && _state$downloadableBl2 !== void 0 ? _state$downloadableBl2 : []; |
294 return (_state$downloadableBl3 = (_state$downloadableBl4 = state.downloadableBlocks[filterValue]) === null || _state$downloadableBl4 === void 0 ? void 0 : _state$downloadableBl4.results) !== null && _state$downloadableBl3 !== void 0 ? _state$downloadableBl3 : []; |
273 } |
295 } |
274 |
296 /** |
275 /** |
297 * Returns the block types that have been installed on the server in this |
276 * Returns the block types that have been installed on the server in this |
298 * session. |
277 * session. |
299 * |
278 * |
300 * @param {Object} state Global application state. |
279 * @param {Object} state Global application state. |
301 * |
280 * |
302 * @return {Array} Block type items |
281 * @return {Array} Block type items |
303 */ |
282 */ |
304 |
|
305 function getInstalledBlockTypes(state) { |
283 function getInstalledBlockTypes(state) { |
306 return state.blockManagement.installedBlockTypes; |
284 return state.blockManagement.installedBlockTypes; |
307 } |
285 } |
|
286 |
308 /** |
287 /** |
309 * Returns block types that have been installed on the server and used in the |
288 * Returns block types that have been installed on the server and used in the |
310 * current post. |
289 * current post. |
311 * |
290 * |
312 * @param {Object} state Global application state. |
291 * @param {Object} state Global application state. |
313 * |
292 * |
314 * @return {Array} Block type items. |
293 * @return {Array} Block type items. |
315 */ |
294 */ |
316 |
|
317 const getNewBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
295 const getNewBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
318 const usedBlockTree = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); |
296 const usedBlockTree = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); |
319 const installedBlockTypes = getInstalledBlockTypes(state); |
297 const installedBlockTypes = getInstalledBlockTypes(state); |
320 return installedBlockTypes.filter(blockType => hasBlockType(blockType, usedBlockTree)); |
298 return installedBlockTypes.filter(blockType => hasBlockType(blockType, usedBlockTree)); |
321 }); |
299 }); |
|
300 |
322 /** |
301 /** |
323 * Returns the block types that have been installed on the server but are not |
302 * Returns the block types that have been installed on the server but are not |
324 * used in the current post. |
303 * used in the current post. |
325 * |
304 * |
326 * @param {Object} state Global application state. |
305 * @param {Object} state Global application state. |
327 * |
306 * |
328 * @return {Array} Block type items. |
307 * @return {Array} Block type items. |
329 */ |
308 */ |
330 |
|
331 const getUnusedBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
309 const getUnusedBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
332 const usedBlockTree = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); |
310 const usedBlockTree = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); |
333 const installedBlockTypes = getInstalledBlockTypes(state); |
311 const installedBlockTypes = getInstalledBlockTypes(state); |
334 return installedBlockTypes.filter(blockType => !hasBlockType(blockType, usedBlockTree)); |
312 return installedBlockTypes.filter(blockType => !hasBlockType(blockType, usedBlockTree)); |
335 }); |
313 }); |
|
314 |
336 /** |
315 /** |
337 * Returns true if a block plugin install is in progress. |
316 * Returns true if a block plugin install is in progress. |
338 * |
317 * |
339 * @param {Object} state Global application state. |
318 * @param {Object} state Global application state. |
340 * @param {string} blockId Id of the block. |
319 * @param {string} blockId Id of the block. |
341 * |
320 * |
342 * @return {boolean} Whether this block is currently being installed. |
321 * @return {boolean} Whether this block is currently being installed. |
343 */ |
322 */ |
344 |
|
345 function isInstalling(state, blockId) { |
323 function isInstalling(state, blockId) { |
346 return state.blockManagement.isInstalling[blockId] || false; |
324 return state.blockManagement.isInstalling[blockId] || false; |
347 } |
325 } |
|
326 |
348 /** |
327 /** |
349 * Returns all block error notices. |
328 * Returns all block error notices. |
350 * |
329 * |
351 * @param {Object} state Global application state. |
330 * @param {Object} state Global application state. |
352 * |
331 * |
353 * @return {Object} Object with error notices. |
332 * @return {Object} Object with error notices. |
354 */ |
333 */ |
355 |
|
356 function getErrorNotices(state) { |
334 function getErrorNotices(state) { |
357 return state.errorNotices; |
335 return state.errorNotices; |
358 } |
336 } |
|
337 |
359 /** |
338 /** |
360 * Returns the error notice for a given block. |
339 * Returns the error notice for a given block. |
361 * |
340 * |
362 * @param {Object} state Global application state. |
341 * @param {Object} state Global application state. |
363 * @param {string} blockId The ID of the block plugin. eg: my-block |
342 * @param {string} blockId The ID of the block plugin. eg: my-block |
364 * |
343 * |
365 * @return {string|boolean} The error text, or false if no error. |
344 * @return {string|boolean} The error text, or false if no error. |
366 */ |
345 */ |
367 |
|
368 function getErrorNoticeForBlock(state, blockId) { |
346 function getErrorNoticeForBlock(state, blockId) { |
369 return state.errorNotices[blockId]; |
347 return state.errorNotices[blockId]; |
370 } |
348 } |
371 |
349 |
372 ;// CONCATENATED MODULE: external ["wp","i18n"] |
350 ;// CONCATENATED MODULE: external ["wp","i18n"] |
373 var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
351 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
374 ;// CONCATENATED MODULE: external ["wp","apiFetch"] |
352 ;// CONCATENATED MODULE: external ["wp","apiFetch"] |
375 var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; |
353 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; |
376 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); |
354 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); |
377 ;// CONCATENATED MODULE: external ["wp","notices"] |
355 ;// CONCATENATED MODULE: external ["wp","notices"] |
378 var external_wp_notices_namespaceObject = window["wp"]["notices"]; |
356 const external_wp_notices_namespaceObject = window["wp"]["notices"]; |
379 ;// CONCATENATED MODULE: external ["wp","url"] |
357 ;// CONCATENATED MODULE: external ["wp","url"] |
380 var external_wp_url_namespaceObject = window["wp"]["url"]; |
358 const external_wp_url_namespaceObject = window["wp"]["url"]; |
381 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/load-assets.js |
359 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/load-assets.js |
382 /** |
360 /** |
383 * WordPress dependencies |
361 * WordPress dependencies |
384 */ |
362 */ |
|
363 |
385 |
364 |
386 /** |
365 /** |
387 * Load an asset for a block. |
366 * Load an asset for a block. |
388 * |
367 * |
389 * This function returns a Promise that will resolve once the asset is loaded, |
368 * This function returns a Promise that will resolve once the asset is loaded, |
565 path: 'wp/v2/plugins', |
532 path: 'wp/v2/plugins', |
566 data: { |
533 data: { |
567 slug: id, |
534 slug: id, |
568 status: 'active' |
535 status: 'active' |
569 } |
536 } |
570 }); // Add the `self` link for newly-installed blocks. |
537 }); |
571 |
538 // Add the `self` link for newly-installed blocks. |
572 links = response._links; |
539 links = response._links; |
573 } |
540 } |
574 |
541 dispatch.addInstalledBlockType({ |
575 dispatch.addInstalledBlockType({ ...block, |
542 ...block, |
576 links: { ...block.links, |
543 links: { |
|
544 ...block.links, |
577 ...links |
545 ...links |
578 } |
546 } |
579 }); // Ensures that the block metadata is propagated to the editor when registered on the server. |
547 }); |
580 |
548 |
|
549 // Ensures that the block metadata is propagated to the editor when registered on the server. |
581 const metadataFields = ['api_version', 'title', 'category', 'parent', 'icon', 'description', 'keywords', 'attributes', 'provides_context', 'uses_context', 'supports', 'styles', 'example', 'variations']; |
550 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()({ |
551 await external_wp_apiFetch_default()({ |
583 path: (0,external_wp_url_namespaceObject.addQueryArgs)(`/wp/v2/block-types/${name}`, { |
552 path: (0,external_wp_url_namespaceObject.addQueryArgs)(`/wp/v2/block-types/${name}`, { |
584 _fields: metadataFields |
553 _fields: metadataFields |
585 }) |
554 }) |
586 }) // Ignore when the block is not registered on the server. |
555 }) |
|
556 // Ignore when the block is not registered on the server. |
587 .catch(() => {}).then(response => { |
557 .catch(() => {}).then(response => { |
588 if (!response) { |
558 if (!response) { |
589 return; |
559 return; |
590 } |
560 } |
591 |
|
592 (0,external_wp_blocks_namespaceObject.unstable__bootstrapServerSideBlockDefinitions)({ |
561 (0,external_wp_blocks_namespaceObject.unstable__bootstrapServerSideBlockDefinitions)({ |
593 [name]: (0,external_lodash_namespaceObject.pick)(response, metadataFields) |
562 [name]: Object.fromEntries(Object.entries(response).filter(([key]) => metadataFields.includes(key))) |
594 }); |
563 }); |
595 }); |
564 }); |
596 await loadAssets(); |
565 await loadAssets(); |
597 const registeredBlocks = registry.select(external_wp_blocks_namespaceObject.store).getBlockTypes(); |
566 const registeredBlocks = registry.select(external_wp_blocks_namespaceObject.store).getBlockTypes(); |
598 |
|
599 if (!registeredBlocks.some(i => i.name === name)) { |
567 if (!registeredBlocks.some(i => i.name === name)) { |
600 throw new Error((0,external_wp_i18n_namespaceObject.__)('Error registering block. Try reloading the page.')); |
568 throw new Error((0,external_wp_i18n_namespaceObject.__)('Error registering block. Try reloading the page.')); |
601 } |
569 } |
602 |
570 registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice((0,external_wp_i18n_namespaceObject.sprintf)( |
603 registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is the block title. |
571 // translators: %s is the block title. |
604 (0,external_wp_i18n_namespaceObject.__)('Block %s installed and added.'), block.title), { |
572 (0,external_wp_i18n_namespaceObject.__)('Block %s installed and added.'), block.title), { |
605 speak: true, |
573 speak: true, |
606 type: 'snackbar' |
574 type: 'snackbar' |
607 }); |
575 }); |
608 success = true; |
576 success = true; |
609 } catch (error) { |
577 } catch (error) { |
610 let message = error.message || (0,external_wp_i18n_namespaceObject.__)('An error occurred.'); // Errors we throw are fatal. |
578 let message = error.message || (0,external_wp_i18n_namespaceObject.__)('An error occurred.'); |
611 |
579 |
612 |
580 // Errors we throw are fatal. |
613 let isFatal = error instanceof Error; // Specific API errors that are fatal. |
581 let isFatal = error instanceof Error; |
614 |
582 |
|
583 // Specific API errors that are fatal. |
615 const fatalAPIErrors = { |
584 const fatalAPIErrors = { |
616 folder_exists: (0,external_wp_i18n_namespaceObject.__)('This block is already installed. Try reloading the page.'), |
585 folder_exists: (0,external_wp_i18n_namespaceObject.__)('This block is already installed. Try reloading the page.'), |
617 unable_to_connect_to_filesystem: (0,external_wp_i18n_namespaceObject.__)('Error installing block. You can reload the page and try again.') |
586 unable_to_connect_to_filesystem: (0,external_wp_i18n_namespaceObject.__)('Error installing block. You can reload the page and try again.') |
618 }; |
587 }; |
619 |
|
620 if (fatalAPIErrors[error.code]) { |
588 if (fatalAPIErrors[error.code]) { |
621 isFatal = true; |
589 isFatal = true; |
622 message = fatalAPIErrors[error.code]; |
590 message = fatalAPIErrors[error.code]; |
623 } |
591 } |
624 |
|
625 dispatch.setErrorNotice(id, message, isFatal); |
592 dispatch.setErrorNotice(id, message, isFatal); |
626 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(message, { |
593 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(message, { |
627 speak: true, |
594 speak: true, |
628 isDismissible: true |
595 isDismissible: true |
629 }); |
596 }); |
630 } |
597 } |
631 |
|
632 dispatch.setIsInstalling(id, false); |
598 dispatch.setIsInstalling(id, false); |
633 return success; |
599 return success; |
634 }; |
600 }; |
|
601 |
635 /** |
602 /** |
636 * Action triggered to uninstall a block plugin. |
603 * Action triggered to uninstall a block plugin. |
637 * |
604 * |
638 * @param {Object} block The blockType object. |
605 * @param {Object} block The blockType object. |
639 */ |
606 */ |
640 |
607 const uninstallBlockType = block => async ({ |
641 const uninstallBlockType = block => async _ref2 => { |
608 registry, |
642 let { |
609 dispatch |
643 registry, |
610 }) => { |
644 dispatch |
|
645 } = _ref2; |
|
646 |
|
647 try { |
611 try { |
648 const url = getPluginUrl(block); |
612 const url = getPluginUrl(block); |
649 await external_wp_apiFetch_default()({ |
613 await external_wp_apiFetch_default()({ |
650 method: 'PUT', |
614 method: 'PUT', |
651 url, |
615 url, |
660 dispatch.removeInstalledBlockType(block); |
624 dispatch.removeInstalledBlockType(block); |
661 } catch (error) { |
625 } catch (error) { |
662 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(error.message || (0,external_wp_i18n_namespaceObject.__)('An error occurred.')); |
626 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(error.message || (0,external_wp_i18n_namespaceObject.__)('An error occurred.')); |
663 } |
627 } |
664 }; |
628 }; |
|
629 |
665 /** |
630 /** |
666 * Returns an action object used to add a block type to the "newly installed" |
631 * Returns an action object used to add a block type to the "newly installed" |
667 * tracking list. |
632 * tracking list. |
668 * |
633 * |
669 * @param {Object} item The block item with the block id and name. |
634 * @param {Object} item The block item with the block id and name. |
670 * |
635 * |
671 * @return {Object} Action object. |
636 * @return {Object} Action object. |
672 */ |
637 */ |
673 |
|
674 function addInstalledBlockType(item) { |
638 function addInstalledBlockType(item) { |
675 return { |
639 return { |
676 type: 'ADD_INSTALLED_BLOCK_TYPE', |
640 type: 'ADD_INSTALLED_BLOCK_TYPE', |
677 item |
641 item |
678 }; |
642 }; |
679 } |
643 } |
|
644 |
680 /** |
645 /** |
681 * Returns an action object used to remove a block type from the "newly installed" |
646 * Returns an action object used to remove a block type from the "newly installed" |
682 * tracking list. |
647 * tracking list. |
683 * |
648 * |
684 * @param {string} item The block item with the block id and name. |
649 * @param {string} item The block item with the block id and name. |
685 * |
650 * |
686 * @return {Object} Action object. |
651 * @return {Object} Action object. |
687 */ |
652 */ |
688 |
|
689 function removeInstalledBlockType(item) { |
653 function removeInstalledBlockType(item) { |
690 return { |
654 return { |
691 type: 'REMOVE_INSTALLED_BLOCK_TYPE', |
655 type: 'REMOVE_INSTALLED_BLOCK_TYPE', |
692 item |
656 item |
693 }; |
657 }; |
694 } |
658 } |
|
659 |
695 /** |
660 /** |
696 * Returns an action object used to indicate install in progress. |
661 * Returns an action object used to indicate install in progress. |
697 * |
662 * |
698 * @param {string} blockId |
663 * @param {string} blockId |
699 * @param {boolean} isInstalling |
664 * @param {boolean} isInstalling |
700 * |
665 * |
701 * @return {Object} Action object. |
666 * @return {Object} Action object. |
702 */ |
667 */ |
703 |
|
704 function setIsInstalling(blockId, isInstalling) { |
668 function setIsInstalling(blockId, isInstalling) { |
705 return { |
669 return { |
706 type: 'SET_INSTALLING_BLOCK', |
670 type: 'SET_INSTALLING_BLOCK', |
707 blockId, |
671 blockId, |
708 isInstalling |
672 isInstalling |
709 }; |
673 }; |
710 } |
674 } |
|
675 |
711 /** |
676 /** |
712 * Sets an error notice to be displayed to the user for a given block. |
677 * Sets an error notice to be displayed to the user for a given block. |
713 * |
678 * |
714 * @param {string} blockId The ID of the block plugin. eg: my-block |
679 * @param {string} blockId The ID of the block plugin. eg: my-block |
715 * @param {string} message The message shown in the notice. |
680 * @param {string} message The message shown in the notice. |
716 * @param {boolean} isFatal Whether the user can recover from the error. |
681 * @param {boolean} isFatal Whether the user can recover from the error. |
717 * |
682 * |
718 * @return {Object} Action object. |
683 * @return {Object} Action object. |
719 */ |
684 */ |
720 |
685 function setErrorNotice(blockId, message, isFatal = false) { |
721 function setErrorNotice(blockId, message) { |
|
722 let isFatal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; |
|
723 return { |
686 return { |
724 type: 'SET_ERROR_NOTICE', |
687 type: 'SET_ERROR_NOTICE', |
725 blockId, |
688 blockId, |
726 message, |
689 message, |
727 isFatal |
690 isFatal |
728 }; |
691 }; |
729 } |
692 } |
|
693 |
730 /** |
694 /** |
731 * Sets the error notice to empty for specific block. |
695 * Sets the error notice to empty for specific block. |
732 * |
696 * |
733 * @param {string} blockId The ID of the block plugin. eg: my-block |
697 * @param {string} blockId The ID of the block plugin. eg: my-block |
734 * |
698 * |
735 * @return {Object} Action object. |
699 * @return {Object} Action object. |
736 */ |
700 */ |
737 |
|
738 function clearErrorNotice(blockId) { |
701 function clearErrorNotice(blockId) { |
739 return { |
702 return { |
740 type: 'CLEAR_ERROR_NOTICE', |
703 type: 'CLEAR_ERROR_NOTICE', |
741 blockId |
704 blockId |
742 }; |
705 }; |
743 } |
706 } |
744 |
707 |
|
708 ;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs |
|
709 /****************************************************************************** |
|
710 Copyright (c) Microsoft Corporation. |
|
711 |
|
712 Permission to use, copy, modify, and/or distribute this software for any |
|
713 purpose with or without fee is hereby granted. |
|
714 |
|
715 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
|
716 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
|
717 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
|
718 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
|
719 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|
720 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|
721 PERFORMANCE OF THIS SOFTWARE. |
|
722 ***************************************************************************** */ |
|
723 /* global Reflect, Promise, SuppressedError, Symbol */ |
|
724 |
|
725 var extendStatics = function(d, b) { |
|
726 extendStatics = Object.setPrototypeOf || |
|
727 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || |
|
728 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; |
|
729 return extendStatics(d, b); |
|
730 }; |
|
731 |
|
732 function __extends(d, b) { |
|
733 if (typeof b !== "function" && b !== null) |
|
734 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); |
|
735 extendStatics(d, b); |
|
736 function __() { this.constructor = d; } |
|
737 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
|
738 } |
|
739 |
|
740 var __assign = function() { |
|
741 __assign = Object.assign || function __assign(t) { |
|
742 for (var s, i = 1, n = arguments.length; i < n; i++) { |
|
743 s = arguments[i]; |
|
744 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; |
|
745 } |
|
746 return t; |
|
747 } |
|
748 return __assign.apply(this, arguments); |
|
749 } |
|
750 |
|
751 function __rest(s, e) { |
|
752 var t = {}; |
|
753 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) |
|
754 t[p] = s[p]; |
|
755 if (s != null && typeof Object.getOwnPropertySymbols === "function") |
|
756 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { |
|
757 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) |
|
758 t[p[i]] = s[p[i]]; |
|
759 } |
|
760 return t; |
|
761 } |
|
762 |
|
763 function __decorate(decorators, target, key, desc) { |
|
764 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
|
765 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
|
766 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; |
|
767 return c > 3 && r && Object.defineProperty(target, key, r), r; |
|
768 } |
|
769 |
|
770 function __param(paramIndex, decorator) { |
|
771 return function (target, key) { decorator(target, key, paramIndex); } |
|
772 } |
|
773 |
|
774 function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { |
|
775 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } |
|
776 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; |
|
777 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; |
|
778 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); |
|
779 var _, done = false; |
|
780 for (var i = decorators.length - 1; i >= 0; i--) { |
|
781 var context = {}; |
|
782 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; |
|
783 for (var p in contextIn.access) context.access[p] = contextIn.access[p]; |
|
784 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; |
|
785 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); |
|
786 if (kind === "accessor") { |
|
787 if (result === void 0) continue; |
|
788 if (result === null || typeof result !== "object") throw new TypeError("Object expected"); |
|
789 if (_ = accept(result.get)) descriptor.get = _; |
|
790 if (_ = accept(result.set)) descriptor.set = _; |
|
791 if (_ = accept(result.init)) initializers.unshift(_); |
|
792 } |
|
793 else if (_ = accept(result)) { |
|
794 if (kind === "field") initializers.unshift(_); |
|
795 else descriptor[key] = _; |
|
796 } |
|
797 } |
|
798 if (target) Object.defineProperty(target, contextIn.name, descriptor); |
|
799 done = true; |
|
800 }; |
|
801 |
|
802 function __runInitializers(thisArg, initializers, value) { |
|
803 var useValue = arguments.length > 2; |
|
804 for (var i = 0; i < initializers.length; i++) { |
|
805 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); |
|
806 } |
|
807 return useValue ? value : void 0; |
|
808 }; |
|
809 |
|
810 function __propKey(x) { |
|
811 return typeof x === "symbol" ? x : "".concat(x); |
|
812 }; |
|
813 |
|
814 function __setFunctionName(f, name, prefix) { |
|
815 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; |
|
816 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); |
|
817 }; |
|
818 |
|
819 function __metadata(metadataKey, metadataValue) { |
|
820 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); |
|
821 } |
|
822 |
|
823 function __awaiter(thisArg, _arguments, P, generator) { |
|
824 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
|
825 return new (P || (P = Promise))(function (resolve, reject) { |
|
826 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |
|
827 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |
|
828 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |
|
829 step((generator = generator.apply(thisArg, _arguments || [])).next()); |
|
830 }); |
|
831 } |
|
832 |
|
833 function __generator(thisArg, body) { |
|
834 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; |
|
835 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; |
|
836 function verb(n) { return function (v) { return step([n, v]); }; } |
|
837 function step(op) { |
|
838 if (f) throw new TypeError("Generator is already executing."); |
|
839 while (g && (g = 0, op[0] && (_ = 0)), _) try { |
|
840 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; |
|
841 if (y = 0, t) op = [op[0] & 2, t.value]; |
|
842 switch (op[0]) { |
|
843 case 0: case 1: t = op; break; |
|
844 case 4: _.label++; return { value: op[1], done: false }; |
|
845 case 5: _.label++; y = op[1]; op = [0]; continue; |
|
846 case 7: op = _.ops.pop(); _.trys.pop(); continue; |
|
847 default: |
|
848 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } |
|
849 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } |
|
850 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } |
|
851 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } |
|
852 if (t[2]) _.ops.pop(); |
|
853 _.trys.pop(); continue; |
|
854 } |
|
855 op = body.call(thisArg, _); |
|
856 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } |
|
857 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; |
|
858 } |
|
859 } |
|
860 |
|
861 var __createBinding = Object.create ? (function(o, m, k, k2) { |
|
862 if (k2 === undefined) k2 = k; |
|
863 var desc = Object.getOwnPropertyDescriptor(m, k); |
|
864 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { |
|
865 desc = { enumerable: true, get: function() { return m[k]; } }; |
|
866 } |
|
867 Object.defineProperty(o, k2, desc); |
|
868 }) : (function(o, m, k, k2) { |
|
869 if (k2 === undefined) k2 = k; |
|
870 o[k2] = m[k]; |
|
871 }); |
|
872 |
|
873 function __exportStar(m, o) { |
|
874 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); |
|
875 } |
|
876 |
|
877 function __values(o) { |
|
878 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; |
|
879 if (m) return m.call(o); |
|
880 if (o && typeof o.length === "number") return { |
|
881 next: function () { |
|
882 if (o && i >= o.length) o = void 0; |
|
883 return { value: o && o[i++], done: !o }; |
|
884 } |
|
885 }; |
|
886 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); |
|
887 } |
|
888 |
|
889 function __read(o, n) { |
|
890 var m = typeof Symbol === "function" && o[Symbol.iterator]; |
|
891 if (!m) return o; |
|
892 var i = m.call(o), r, ar = [], e; |
|
893 try { |
|
894 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); |
|
895 } |
|
896 catch (error) { e = { error: error }; } |
|
897 finally { |
|
898 try { |
|
899 if (r && !r.done && (m = i["return"])) m.call(i); |
|
900 } |
|
901 finally { if (e) throw e.error; } |
|
902 } |
|
903 return ar; |
|
904 } |
|
905 |
|
906 /** @deprecated */ |
|
907 function __spread() { |
|
908 for (var ar = [], i = 0; i < arguments.length; i++) |
|
909 ar = ar.concat(__read(arguments[i])); |
|
910 return ar; |
|
911 } |
|
912 |
|
913 /** @deprecated */ |
|
914 function __spreadArrays() { |
|
915 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; |
|
916 for (var r = Array(s), k = 0, i = 0; i < il; i++) |
|
917 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) |
|
918 r[k] = a[j]; |
|
919 return r; |
|
920 } |
|
921 |
|
922 function __spreadArray(to, from, pack) { |
|
923 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { |
|
924 if (ar || !(i in from)) { |
|
925 if (!ar) ar = Array.prototype.slice.call(from, 0, i); |
|
926 ar[i] = from[i]; |
|
927 } |
|
928 } |
|
929 return to.concat(ar || Array.prototype.slice.call(from)); |
|
930 } |
|
931 |
|
932 function __await(v) { |
|
933 return this instanceof __await ? (this.v = v, this) : new __await(v); |
|
934 } |
|
935 |
|
936 function __asyncGenerator(thisArg, _arguments, generator) { |
|
937 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); |
|
938 var g = generator.apply(thisArg, _arguments || []), i, q = []; |
|
939 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; |
|
940 function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } |
|
941 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } |
|
942 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } |
|
943 function fulfill(value) { resume("next", value); } |
|
944 function reject(value) { resume("throw", value); } |
|
945 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } |
|
946 } |
|
947 |
|
948 function __asyncDelegator(o) { |
|
949 var i, p; |
|
950 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; |
|
951 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } |
|
952 } |
|
953 |
|
954 function __asyncValues(o) { |
|
955 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); |
|
956 var m = o[Symbol.asyncIterator], i; |
|
957 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); |
|
958 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } |
|
959 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } |
|
960 } |
|
961 |
|
962 function __makeTemplateObject(cooked, raw) { |
|
963 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } |
|
964 return cooked; |
|
965 }; |
|
966 |
|
967 var __setModuleDefault = Object.create ? (function(o, v) { |
|
968 Object.defineProperty(o, "default", { enumerable: true, value: v }); |
|
969 }) : function(o, v) { |
|
970 o["default"] = v; |
|
971 }; |
|
972 |
|
973 function __importStar(mod) { |
|
974 if (mod && mod.__esModule) return mod; |
|
975 var result = {}; |
|
976 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); |
|
977 __setModuleDefault(result, mod); |
|
978 return result; |
|
979 } |
|
980 |
|
981 function __importDefault(mod) { |
|
982 return (mod && mod.__esModule) ? mod : { default: mod }; |
|
983 } |
|
984 |
|
985 function __classPrivateFieldGet(receiver, state, kind, f) { |
|
986 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); |
|
987 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); |
|
988 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); |
|
989 } |
|
990 |
|
991 function __classPrivateFieldSet(receiver, state, value, kind, f) { |
|
992 if (kind === "m") throw new TypeError("Private method is not writable"); |
|
993 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); |
|
994 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); |
|
995 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; |
|
996 } |
|
997 |
|
998 function __classPrivateFieldIn(state, receiver) { |
|
999 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); |
|
1000 return typeof state === "function" ? receiver === state : state.has(receiver); |
|
1001 } |
|
1002 |
|
1003 function __addDisposableResource(env, value, async) { |
|
1004 if (value !== null && value !== void 0) { |
|
1005 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); |
|
1006 var dispose; |
|
1007 if (async) { |
|
1008 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); |
|
1009 dispose = value[Symbol.asyncDispose]; |
|
1010 } |
|
1011 if (dispose === void 0) { |
|
1012 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); |
|
1013 dispose = value[Symbol.dispose]; |
|
1014 } |
|
1015 if (typeof dispose !== "function") throw new TypeError("Object not disposable."); |
|
1016 env.stack.push({ value: value, dispose: dispose, async: async }); |
|
1017 } |
|
1018 else if (async) { |
|
1019 env.stack.push({ async: true }); |
|
1020 } |
|
1021 return value; |
|
1022 } |
|
1023 |
|
1024 var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { |
|
1025 var e = new Error(message); |
|
1026 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; |
|
1027 }; |
|
1028 |
|
1029 function __disposeResources(env) { |
|
1030 function fail(e) { |
|
1031 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; |
|
1032 env.hasError = true; |
|
1033 } |
|
1034 function next() { |
|
1035 while (env.stack.length) { |
|
1036 var rec = env.stack.pop(); |
|
1037 try { |
|
1038 var result = rec.dispose && rec.dispose.call(rec.value); |
|
1039 if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); |
|
1040 } |
|
1041 catch (e) { |
|
1042 fail(e); |
|
1043 } |
|
1044 } |
|
1045 if (env.hasError) throw env.error; |
|
1046 } |
|
1047 return next(); |
|
1048 } |
|
1049 |
|
1050 /* harmony default export */ const tslib_es6 = ({ |
|
1051 __extends, |
|
1052 __assign, |
|
1053 __rest, |
|
1054 __decorate, |
|
1055 __param, |
|
1056 __metadata, |
|
1057 __awaiter, |
|
1058 __generator, |
|
1059 __createBinding, |
|
1060 __exportStar, |
|
1061 __values, |
|
1062 __read, |
|
1063 __spread, |
|
1064 __spreadArrays, |
|
1065 __spreadArray, |
|
1066 __await, |
|
1067 __asyncGenerator, |
|
1068 __asyncDelegator, |
|
1069 __asyncValues, |
|
1070 __makeTemplateObject, |
|
1071 __importStar, |
|
1072 __importDefault, |
|
1073 __classPrivateFieldGet, |
|
1074 __classPrivateFieldSet, |
|
1075 __classPrivateFieldIn, |
|
1076 __addDisposableResource, |
|
1077 __disposeResources, |
|
1078 }); |
|
1079 |
|
1080 ;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js |
|
1081 /** |
|
1082 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt |
|
1083 */ |
|
1084 var SUPPORTED_LOCALE = { |
|
1085 tr: { |
|
1086 regexp: /\u0130|\u0049|\u0049\u0307/g, |
|
1087 map: { |
|
1088 İ: "\u0069", |
|
1089 I: "\u0131", |
|
1090 İ: "\u0069", |
|
1091 }, |
|
1092 }, |
|
1093 az: { |
|
1094 regexp: /\u0130/g, |
|
1095 map: { |
|
1096 İ: "\u0069", |
|
1097 I: "\u0131", |
|
1098 İ: "\u0069", |
|
1099 }, |
|
1100 }, |
|
1101 lt: { |
|
1102 regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, |
|
1103 map: { |
|
1104 I: "\u0069\u0307", |
|
1105 J: "\u006A\u0307", |
|
1106 Į: "\u012F\u0307", |
|
1107 Ì: "\u0069\u0307\u0300", |
|
1108 Í: "\u0069\u0307\u0301", |
|
1109 Ĩ: "\u0069\u0307\u0303", |
|
1110 }, |
|
1111 }, |
|
1112 }; |
|
1113 /** |
|
1114 * Localized lower case. |
|
1115 */ |
|
1116 function localeLowerCase(str, locale) { |
|
1117 var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; |
|
1118 if (lang) |
|
1119 return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); |
|
1120 return lowerCase(str); |
|
1121 } |
|
1122 /** |
|
1123 * Lower case as a function. |
|
1124 */ |
|
1125 function lowerCase(str) { |
|
1126 return str.toLowerCase(); |
|
1127 } |
|
1128 |
|
1129 ;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js |
|
1130 |
|
1131 // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). |
|
1132 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; |
|
1133 // Remove all non-word characters. |
|
1134 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; |
|
1135 /** |
|
1136 * Normalize the string into something other libraries can manipulate easier. |
|
1137 */ |
|
1138 function noCase(input, options) { |
|
1139 if (options === void 0) { options = {}; } |
|
1140 var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; |
|
1141 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); |
|
1142 var start = 0; |
|
1143 var end = result.length; |
|
1144 // Trim the delimiter from around the output string. |
|
1145 while (result.charAt(start) === "\0") |
|
1146 start++; |
|
1147 while (result.charAt(end - 1) === "\0") |
|
1148 end--; |
|
1149 // Transform each token independently. |
|
1150 return result.slice(start, end).split("\0").map(transform).join(delimiter); |
|
1151 } |
|
1152 /** |
|
1153 * Replace `re` in the input string with the replacement value. |
|
1154 */ |
|
1155 function replace(input, re, value) { |
|
1156 if (re instanceof RegExp) |
|
1157 return input.replace(re, value); |
|
1158 return re.reduce(function (input, re) { return input.replace(re, value); }, input); |
|
1159 } |
|
1160 |
|
1161 ;// CONCATENATED MODULE: ./node_modules/pascal-case/dist.es2015/index.js |
|
1162 |
|
1163 |
|
1164 function pascalCaseTransform(input, index) { |
|
1165 var firstChar = input.charAt(0); |
|
1166 var lowerChars = input.substr(1).toLowerCase(); |
|
1167 if (index > 0 && firstChar >= "0" && firstChar <= "9") { |
|
1168 return "_" + firstChar + lowerChars; |
|
1169 } |
|
1170 return "" + firstChar.toUpperCase() + lowerChars; |
|
1171 } |
|
1172 function dist_es2015_pascalCaseTransformMerge(input) { |
|
1173 return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase(); |
|
1174 } |
|
1175 function pascalCase(input, options) { |
|
1176 if (options === void 0) { options = {}; } |
|
1177 return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options)); |
|
1178 } |
|
1179 |
|
1180 ;// CONCATENATED MODULE: ./node_modules/camel-case/dist.es2015/index.js |
|
1181 |
|
1182 |
|
1183 function camelCaseTransform(input, index) { |
|
1184 if (index === 0) |
|
1185 return input.toLowerCase(); |
|
1186 return pascalCaseTransform(input, index); |
|
1187 } |
|
1188 function camelCaseTransformMerge(input, index) { |
|
1189 if (index === 0) |
|
1190 return input.toLowerCase(); |
|
1191 return pascalCaseTransformMerge(input); |
|
1192 } |
|
1193 function camelCase(input, options) { |
|
1194 if (options === void 0) { options = {}; } |
|
1195 return pascalCase(input, __assign({ transform: camelCaseTransform }, options)); |
|
1196 } |
|
1197 |
745 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js |
1198 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js |
746 /** |
1199 /** |
747 * External dependencies |
1200 * External dependencies |
748 */ |
1201 */ |
749 |
1202 |
|
1203 |
750 /** |
1204 /** |
751 * WordPress dependencies |
1205 * WordPress dependencies |
752 */ |
1206 */ |
753 |
1207 |
754 |
1208 |
755 /** |
1209 /** |
756 * Internal dependencies |
1210 * Internal dependencies |
757 */ |
1211 */ |
758 |
1212 |
759 |
1213 const resolvers_getDownloadableBlocks = filterValue => async ({ |
760 const resolvers_getDownloadableBlocks = filterValue => async _ref => { |
1214 dispatch |
761 let { |
1215 }) => { |
762 dispatch |
|
763 } = _ref; |
|
764 |
|
765 if (!filterValue) { |
1216 if (!filterValue) { |
766 return; |
1217 return; |
767 } |
1218 } |
768 |
|
769 try { |
1219 try { |
770 dispatch(fetchDownloadableBlocks(filterValue)); |
1220 dispatch(fetchDownloadableBlocks(filterValue)); |
771 const results = await external_wp_apiFetch_default()({ |
1221 const results = await external_wp_apiFetch_default()({ |
772 path: `wp/v2/block-directory/search?term=${filterValue}` |
1222 path: `wp/v2/block-directory/search?term=${filterValue}` |
773 }); |
1223 }); |
774 const blocks = results.map(result => (0,external_lodash_namespaceObject.mapKeys)(result, (value, key) => (0,external_lodash_namespaceObject.camelCase)(key))); |
1224 const blocks = results.map(result => Object.fromEntries(Object.entries(result).map(([key, value]) => [camelCase(key), value]))); |
775 dispatch(receiveDownloadableBlocks(blocks, filterValue)); |
1225 dispatch(receiveDownloadableBlocks(blocks, filterValue)); |
776 } catch {} |
1226 } catch {} |
777 }; |
1227 }; |
778 |
1228 |
779 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/index.js |
1229 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/index.js |
780 /** |
1230 /** |
781 * WordPress dependencies |
1231 * WordPress dependencies |
782 */ |
1232 */ |
783 |
1233 |
|
1234 |
784 /** |
1235 /** |
785 * Internal dependencies |
1236 * Internal dependencies |
786 */ |
1237 */ |
787 |
1238 |
788 |
1239 |
853 } |
1303 } |
854 }, [shouldRemoveBlockTypes]); |
1304 }, [shouldRemoveBlockTypes]); |
855 return null; |
1305 return null; |
856 } |
1306 } |
857 |
1307 |
|
1308 ;// CONCATENATED MODULE: external ["wp","compose"] |
|
1309 const external_wp_compose_namespaceObject = window["wp"]["compose"]; |
858 ;// CONCATENATED MODULE: external ["wp","components"] |
1310 ;// CONCATENATED MODULE: external ["wp","components"] |
859 var external_wp_components_namespaceObject = window["wp"]["components"]; |
1311 const external_wp_components_namespaceObject = window["wp"]["components"]; |
860 ;// CONCATENATED MODULE: external ["wp","compose"] |
|
861 var external_wp_compose_namespaceObject = window["wp"]["compose"]; |
|
862 ;// CONCATENATED MODULE: external ["wp","coreData"] |
1312 ;// CONCATENATED MODULE: external ["wp","coreData"] |
863 var external_wp_coreData_namespaceObject = window["wp"]["coreData"]; |
1313 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; |
864 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
|
865 function _extends() { |
|
866 _extends = Object.assign ? Object.assign.bind() : function (target) { |
|
867 for (var i = 1; i < arguments.length; i++) { |
|
868 var source = arguments[i]; |
|
869 |
|
870 for (var key in source) { |
|
871 if (Object.prototype.hasOwnProperty.call(source, key)) { |
|
872 target[key] = source[key]; |
|
873 } |
|
874 } |
|
875 } |
|
876 |
|
877 return target; |
|
878 }; |
|
879 return _extends.apply(this, arguments); |
|
880 } |
|
881 ;// CONCATENATED MODULE: external ["wp","htmlEntities"] |
1314 ;// CONCATENATED MODULE: external ["wp","htmlEntities"] |
882 var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; |
1315 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; |
883 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js |
1316 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js |
884 /** |
1317 /** |
885 * WordPress dependencies |
1318 * WordPress dependencies |
886 */ |
1319 */ |
887 |
1320 |
|
1321 |
888 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ |
1322 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ |
889 |
1323 |
890 /** |
1324 /** |
891 * Return an SVG icon. |
1325 * Return an SVG icon. |
892 * |
1326 * |
893 * @param {IconProps} props icon is the SVG component to render |
1327 * @param {IconProps} props icon is the SVG component to render |
894 * size is a number specifiying the icon size in pixels |
1328 * size is a number specifiying the icon size in pixels |
895 * Other props will be passed to wrapped SVG component |
1329 * Other props will be passed to wrapped SVG component |
|
1330 * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. |
896 * |
1331 * |
897 * @return {JSX.Element} Icon component |
1332 * @return {JSX.Element} Icon component |
898 */ |
1333 */ |
899 |
1334 function Icon({ |
900 function Icon(_ref) { |
1335 icon, |
901 let { |
1336 size = 24, |
902 icon, |
1337 ...props |
903 size = 24, |
1338 }, ref) { |
904 ...props |
|
905 } = _ref; |
|
906 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { |
1339 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { |
907 width: size, |
1340 width: size, |
908 height: size, |
1341 height: size, |
909 ...props |
1342 ...props, |
|
1343 ref |
910 }); |
1344 }); |
911 } |
1345 } |
912 |
1346 /* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); |
913 /* harmony default export */ var icon = (Icon); |
|
914 |
1347 |
915 ;// CONCATENATED MODULE: external ["wp","primitives"] |
1348 ;// CONCATENATED MODULE: external ["wp","primitives"] |
916 var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
1349 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
|
1350 ;// CONCATENATED MODULE: external "ReactJSXRuntime" |
|
1351 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; |
917 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js |
1352 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js |
918 |
1353 /** |
919 |
1354 * WordPress dependencies |
920 /** |
1355 */ |
921 * WordPress dependencies |
1356 |
922 */ |
1357 |
923 |
1358 const starFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
924 const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
925 xmlns: "http://www.w3.org/2000/svg", |
1359 xmlns: "http://www.w3.org/2000/svg", |
926 viewBox: "0 0 24 24" |
1360 viewBox: "0 0 24 24", |
927 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
1361 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(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" |
1362 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 })); |
1363 }) |
930 /* harmony default export */ var star_filled = (starFilled); |
1364 }); |
|
1365 /* harmony default export */ const star_filled = (starFilled); |
931 |
1366 |
932 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-half.js |
1367 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-half.js |
933 |
1368 /** |
934 |
1369 * WordPress dependencies |
935 /** |
1370 */ |
936 * WordPress dependencies |
1371 |
937 */ |
1372 |
938 |
1373 const starHalf = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
939 const starHalf = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
940 xmlns: "http://www.w3.org/2000/svg", |
1374 xmlns: "http://www.w3.org/2000/svg", |
941 viewBox: "0 0 24 24" |
1375 viewBox: "0 0 24 24", |
942 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
1376 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { |
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" |
1377 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" |
944 })); |
1378 }) |
945 /* harmony default export */ var star_half = (starHalf); |
1379 }); |
|
1380 /* harmony default export */ const star_half = (starHalf); |
946 |
1381 |
947 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js |
1382 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js |
948 |
1383 /** |
949 |
1384 * WordPress dependencies |
950 /** |
1385 */ |
951 * WordPress dependencies |
1386 |
952 */ |
1387 |
953 |
1388 const starEmpty = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
954 const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
955 xmlns: "http://www.w3.org/2000/svg", |
1389 xmlns: "http://www.w3.org/2000/svg", |
956 viewBox: "0 0 24 24" |
1390 viewBox: "0 0 24 24", |
957 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
1391 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { |
958 fillRule: "evenodd", |
1392 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", |
1393 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" |
1394 clipRule: "evenodd" |
961 })); |
1395 }) |
962 /* harmony default export */ var star_empty = (starEmpty); |
1396 }); |
|
1397 /* harmony default export */ const star_empty = (starEmpty); |
963 |
1398 |
964 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/stars.js |
1399 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/stars.js |
965 |
1400 /** |
966 |
1401 * WordPress dependencies |
967 /** |
1402 */ |
968 * External dependencies |
1403 |
969 */ |
1404 |
970 |
1405 |
971 /** |
1406 |
972 * WordPress dependencies |
1407 function Stars({ |
973 */ |
1408 rating |
974 |
1409 }) { |
975 |
|
976 |
|
977 |
|
978 function Stars(_ref) { |
|
979 let { |
|
980 rating |
|
981 } = _ref; |
|
982 const stars = Math.round(rating / 0.5) * 0.5; |
1410 const stars = Math.round(rating / 0.5) * 0.5; |
983 const fullStarCount = Math.floor(rating); |
1411 const fullStarCount = Math.floor(rating); |
984 const halfStarCount = Math.ceil(rating - fullStarCount); |
1412 const halfStarCount = Math.ceil(rating - fullStarCount); |
985 const emptyStarCount = 5 - (fullStarCount + halfStarCount); |
1413 const emptyStarCount = 5 - (fullStarCount + halfStarCount); |
986 return (0,external_wp_element_namespaceObject.createElement)("span", { |
1414 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { |
987 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( |
1415 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: number of stars. */ |
988 /* translators: %s: number of stars. */ |
1416 (0,external_wp_i18n_namespaceObject.__)('%s out of 5 stars'), stars), |
989 (0,external_wp_i18n_namespaceObject.__)('%s out of 5 stars'), stars) |
1417 children: [Array.from({ |
990 }, (0,external_lodash_namespaceObject.times)(fullStarCount, i => (0,external_wp_element_namespaceObject.createElement)(icon, { |
1418 length: fullStarCount |
991 key: `full_stars_${i}`, |
1419 }).map((_, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { |
992 className: "block-directory-block-ratings__star-full", |
1420 className: "block-directory-block-ratings__star-full", |
993 icon: star_filled, |
1421 icon: star_filled, |
994 size: 16 |
1422 size: 16 |
995 })), (0,external_lodash_namespaceObject.times)(halfStarCount, i => (0,external_wp_element_namespaceObject.createElement)(icon, { |
1423 }, `full_stars_${i}`)), Array.from({ |
996 key: `half_stars_${i}`, |
1424 length: halfStarCount |
997 className: "block-directory-block-ratings__star-half-full", |
1425 }).map((_, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { |
998 icon: star_half, |
1426 className: "block-directory-block-ratings__star-half-full", |
999 size: 16 |
1427 icon: star_half, |
1000 })), (0,external_lodash_namespaceObject.times)(emptyStarCount, i => (0,external_wp_element_namespaceObject.createElement)(icon, { |
1428 size: 16 |
1001 key: `empty_stars_${i}`, |
1429 }, `half_stars_${i}`)), Array.from({ |
1002 className: "block-directory-block-ratings__star-empty", |
1430 length: emptyStarCount |
1003 icon: star_empty, |
1431 }).map((_, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { |
1004 size: 16 |
1432 className: "block-directory-block-ratings__star-empty", |
1005 }))); |
1433 icon: star_empty, |
1006 } |
1434 size: 16 |
1007 |
1435 }, `empty_stars_${i}`))] |
1008 /* harmony default export */ var stars = (Stars); |
1436 }); |
|
1437 } |
|
1438 /* harmony default export */ const stars = (Stars); |
1009 |
1439 |
1010 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/index.js |
1440 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/index.js |
1011 |
|
1012 |
|
1013 /** |
1441 /** |
1014 * Internal dependencies |
1442 * Internal dependencies |
1015 */ |
1443 */ |
1016 |
1444 |
1017 const BlockRatings = _ref => { |
1445 |
1018 let { |
1446 const BlockRatings = ({ |
1019 rating |
1447 rating |
1020 } = _ref; |
1448 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { |
1021 return (0,external_wp_element_namespaceObject.createElement)("span", { |
1449 className: "block-directory-block-ratings", |
1022 className: "block-directory-block-ratings" |
1450 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(stars, { |
1023 }, (0,external_wp_element_namespaceObject.createElement)(stars, { |
|
1024 rating: rating |
1451 rating: rating |
1025 })); |
1452 }) |
1026 }; |
1453 }); |
1027 /* harmony default export */ var block_ratings = (BlockRatings); |
1454 /* harmony default export */ const block_ratings = (BlockRatings); |
1028 |
1455 |
1029 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-icon/index.js |
1456 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-icon/index.js |
1030 |
1457 /** |
1031 |
1458 * WordPress dependencies |
1032 /** |
1459 */ |
1033 * WordPress dependencies |
1460 |
1034 */ |
1461 |
1035 |
1462 function DownloadableBlockIcon({ |
1036 |
1463 icon |
1037 function DownloadableBlockIcon(_ref) { |
1464 }) { |
1038 let { |
|
1039 icon |
|
1040 } = _ref; |
|
1041 const className = 'block-directory-downloadable-block-icon'; |
1465 const className = 'block-directory-downloadable-block-icon'; |
1042 return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? (0,external_wp_element_namespaceObject.createElement)("img", { |
1466 return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { |
1043 className: className, |
1467 className: className, |
1044 src: icon, |
1468 src: icon, |
1045 alt: "" |
1469 alt: "" |
1046 }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
1470 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
1047 className: className, |
1471 className: className, |
1048 icon: icon, |
1472 icon: icon, |
1049 showColors: true |
1473 showColors: true |
1050 }); |
1474 }); |
1051 } |
1475 } |
1052 |
1476 /* harmony default export */ const downloadable_block_icon = (DownloadableBlockIcon); |
1053 /* harmony default export */ var downloadable_block_icon = (DownloadableBlockIcon); |
|
1054 |
1477 |
1055 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-notice/index.js |
1478 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-notice/index.js |
1056 |
1479 /** |
1057 |
1480 * WordPress dependencies |
1058 /** |
1481 */ |
1059 * WordPress dependencies |
1482 |
1060 */ |
|
1061 |
1483 |
1062 |
1484 |
1063 /** |
1485 /** |
1064 * Internal dependencies |
1486 * Internal dependencies |
1065 */ |
1487 */ |
1066 |
1488 |
1067 |
1489 |
1068 const DownloadableBlockNotice = _ref => { |
1490 |
1069 let { |
1491 const DownloadableBlockNotice = ({ |
1070 block |
1492 block |
1071 } = _ref; |
1493 }) => { |
1072 const errorNotice = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getErrorNoticeForBlock(block.id), [block]); |
1494 const errorNotice = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getErrorNoticeForBlock(block.id), [block]); |
1073 |
|
1074 if (!errorNotice) { |
1495 if (!errorNotice) { |
1075 return null; |
1496 return null; |
1076 } |
1497 } |
1077 |
1498 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
1078 return (0,external_wp_element_namespaceObject.createElement)("div", { |
1499 className: "block-directory-downloadable-block-notice", |
1079 className: "block-directory-downloadable-block-notice" |
1500 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { |
1080 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
1501 className: "block-directory-downloadable-block-notice__content", |
1081 className: "block-directory-downloadable-block-notice__content" |
1502 children: [errorNotice.message, errorNotice.isFatal ? ' ' + (0,external_wp_i18n_namespaceObject.__)('Try reloading the page.') : null] |
1082 }, errorNotice.message, errorNotice.isFatal ? ' ' + (0,external_wp_i18n_namespaceObject.__)('Try reloading the page.') : null)); |
1503 }) |
|
1504 }); |
1083 }; |
1505 }; |
1084 /* harmony default export */ var downloadable_block_notice = (DownloadableBlockNotice); |
1506 /* harmony default export */ const downloadable_block_notice = (DownloadableBlockNotice); |
|
1507 |
|
1508 ;// CONCATENATED MODULE: external ["wp","privateApis"] |
|
1509 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; |
|
1510 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/lock-unlock.js |
|
1511 /** |
|
1512 * WordPress dependencies |
|
1513 */ |
|
1514 |
|
1515 const { |
|
1516 lock, |
|
1517 unlock |
|
1518 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/block-directory'); |
1085 |
1519 |
1086 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-list-item/index.js |
1520 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-list-item/index.js |
1087 |
1521 /** |
1088 |
1522 * WordPress dependencies |
1089 |
1523 */ |
1090 /** |
1524 |
1091 * WordPress dependencies |
|
1092 */ |
|
1093 |
1525 |
1094 |
1526 |
1095 |
1527 |
1096 |
1528 |
1097 |
1529 |
1175 isInstalling: isBlockInstalling(item.id), |
1605 isInstalling: isBlockInstalling(item.id), |
1176 isInstallable: !hasFatal |
1606 isInstallable: !hasFatal |
1177 }; |
1607 }; |
1178 }, [item]); |
1608 }, [item]); |
1179 let statusText = ''; |
1609 let statusText = ''; |
1180 |
|
1181 if (isInstalled) { |
1610 if (isInstalled) { |
1182 statusText = (0,external_wp_i18n_namespaceObject.__)('Installed!'); |
1611 statusText = (0,external_wp_i18n_namespaceObject.__)('Installed!'); |
1183 } else if (isInstalling) { |
1612 } else if (isInstalling) { |
1184 statusText = (0,external_wp_i18n_namespaceObject.__)('Installing…'); |
1613 statusText = (0,external_wp_i18n_namespaceObject.__)('Installing…'); |
1185 } |
1614 } |
1186 |
1615 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(CompositeItem, { |
1187 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeItem, _extends({ |
1616 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { |
1188 __experimentalIsFocusable: true, |
1617 __experimentalIsFocusable: true, |
1189 role: "option", |
1618 type: "button", |
1190 as: external_wp_components_namespaceObject.Button |
1619 role: "option", |
1191 }, composite, { |
1620 className: "block-directory-downloadable-block-list-item", |
1192 className: "block-directory-downloadable-block-list-item", |
1621 isBusy: isInstalling, |
1193 onClick: event => { |
1622 onClick: event => { |
1194 event.preventDefault(); |
1623 event.preventDefault(); |
1195 onClick(); |
1624 onClick(); |
1196 }, |
1625 }, |
1197 isBusy: isInstalling, |
1626 label: getDownloadableBlockLabel(item, { |
|
1627 hasNotice, |
|
1628 isInstalled, |
|
1629 isInstalling |
|
1630 }), |
|
1631 showTooltip: true, |
|
1632 tooltipPosition: "top center" |
|
1633 }), |
|
1634 store: composite, |
1198 disabled: isInstalling || !isInstallable, |
1635 disabled: isInstalling || !isInstallable, |
1199 label: getDownloadableBlockLabel(item, { |
1636 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { |
1200 hasNotice, |
1637 className: "block-directory-downloadable-block-list-item__icon", |
1201 isInstalled, |
1638 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_block_icon, { |
1202 isInstalling |
1639 icon: icon, |
1203 }), |
1640 title: title |
1204 showTooltip: true, |
1641 }), isInstalling ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { |
1205 tooltipPosition: "top center" |
1642 className: "block-directory-downloadable-block-list-item__spinner", |
1206 }), (0,external_wp_element_namespaceObject.createElement)("div", { |
1643 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) |
1207 className: "block-directory-downloadable-block-list-item__icon" |
1644 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_ratings, { |
1208 }, (0,external_wp_element_namespaceObject.createElement)(downloadable_block_icon, { |
1645 rating: rating |
1209 icon: icon, |
1646 })] |
1210 title: title |
1647 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { |
1211 }), isInstalling ? (0,external_wp_element_namespaceObject.createElement)("span", { |
1648 className: "block-directory-downloadable-block-list-item__details", |
1212 className: "block-directory-downloadable-block-list-item__spinner" |
1649 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { |
1213 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)) : (0,external_wp_element_namespaceObject.createElement)(block_ratings, { |
1650 className: "block-directory-downloadable-block-list-item__title", |
1214 rating: rating |
1651 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1$s: block title, %2$s: author name. */ |
1215 })), (0,external_wp_element_namespaceObject.createElement)("span", { |
1652 (0,external_wp_i18n_namespaceObject.__)('%1$s <span>by %2$s</span>'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), author), { |
1216 className: "block-directory-downloadable-block-list-item__details" |
1653 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { |
1217 }, (0,external_wp_element_namespaceObject.createElement)("span", { |
1654 className: "block-directory-downloadable-block-list-item__author" |
1218 className: "block-directory-downloadable-block-list-item__title" |
1655 }) |
1219 }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( |
1656 }) |
1220 /* translators: %1$s: block title, %2$s: author name. */ |
1657 }), hasNotice ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_block_notice, { |
1221 (0,external_wp_i18n_namespaceObject.__)('%1$s <span>by %2$s</span>'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), author), { |
1658 block: item |
1222 span: (0,external_wp_element_namespaceObject.createElement)("span", { |
1659 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
1223 className: "block-directory-downloadable-block-list-item__author" |
1660 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { |
1224 }) |
1661 className: "block-directory-downloadable-block-list-item__desc", |
1225 })), hasNotice ? (0,external_wp_element_namespaceObject.createElement)(downloadable_block_notice, { |
1662 children: !!statusText ? statusText : (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(description) |
1226 block: item |
1663 }), isInstallable && !(isInstalled || isInstalling) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { |
1227 }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("span", { |
1664 children: (0,external_wp_i18n_namespaceObject.__)('Install block') |
1228 className: "block-directory-downloadable-block-list-item__desc" |
1665 })] |
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'))))); |
1666 })] |
1230 } |
1667 })] |
1231 |
1668 }); |
1232 /* harmony default export */ var downloadable_block_list_item = (DownloadableBlockListItem); |
1669 } |
|
1670 /* harmony default export */ const downloadable_block_list_item = (DownloadableBlockListItem); |
1233 |
1671 |
1234 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-list/index.js |
1672 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-list/index.js |
1235 |
|
1236 |
|
1237 |
|
1238 /** |
|
1239 * External dependencies |
|
1240 */ |
|
1241 |
|
1242 /** |
1673 /** |
1243 * WordPress dependencies |
1674 * WordPress dependencies |
1244 */ |
1675 */ |
1245 |
1676 |
1246 |
1677 |
1252 */ |
1683 */ |
1253 |
1684 |
1254 |
1685 |
1255 |
1686 |
1256 |
1687 |
1257 function DownloadableBlocksList(_ref) { |
1688 const { |
1258 let { |
1689 CompositeV2: Composite, |
1259 items, |
1690 useCompositeStoreV2: useCompositeStore |
1260 onHover = external_lodash_namespaceObject.noop, |
1691 } = unlock(external_wp_components_namespaceObject.privateApis); |
1261 onSelect |
1692 const noop = () => {}; |
1262 } = _ref; |
1693 function DownloadableBlocksList({ |
1263 const composite = (0,external_wp_components_namespaceObject.__unstableUseCompositeState)(); |
1694 items, |
|
1695 onHover = noop, |
|
1696 onSelect |
|
1697 }) { |
|
1698 const composite = useCompositeStore(); |
1264 const { |
1699 const { |
1265 installBlockType |
1700 installBlockType |
1266 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
1701 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
1267 |
|
1268 if (!items.length) { |
1702 if (!items.length) { |
1269 return null; |
1703 return null; |
1270 } |
1704 } |
1271 |
1705 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Composite, { |
1272 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableComposite, _extends({}, composite, { |
1706 store: composite, |
1273 role: "listbox", |
1707 role: "listbox", |
1274 className: "block-directory-downloadable-blocks-list", |
1708 className: "block-directory-downloadable-blocks-list", |
1275 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Blocks available for install') |
1709 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Blocks available for install'), |
1276 }), items.map(item => { |
1710 children: items.map(item => { |
1277 return (0,external_wp_element_namespaceObject.createElement)(downloadable_block_list_item, { |
1711 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_block_list_item, { |
1278 key: item.id, |
1712 composite: composite, |
1279 composite: composite, |
1713 onClick: () => { |
1280 onClick: () => { |
1714 // Check if the block is registered (`getBlockType` |
1281 // Check if the block is registered (`getBlockType` |
1715 // will return an object). If so, insert the block. |
1282 // will return an object). If so, insert the block. |
1716 // This prevents installing existing plugins. |
1283 // This prevents installing existing plugins. |
1717 if ((0,external_wp_blocks_namespaceObject.getBlockType)(item.name)) { |
1284 if ((0,external_wp_blocks_namespaceObject.getBlockType)(item.name)) { |
1718 onSelect(item); |
1285 onSelect(item); |
1719 } else { |
1286 } else { |
1720 installBlockType(item).then(success => { |
1287 installBlockType(item).then(success => { |
1721 if (success) { |
1288 if (success) { |
1722 onSelect(item); |
1289 onSelect(item); |
1723 } |
1290 } |
1724 }); |
1291 }); |
1725 } |
1292 } |
1726 onHover(null); |
1293 |
1727 }, |
1294 onHover(null); |
1728 onHover: onHover, |
1295 }, |
1729 item: item |
1296 onHover: onHover, |
1730 }, item.id); |
1297 item: item |
1731 }) |
1298 }); |
1732 }); |
1299 })); |
1733 } |
1300 } |
1734 /* harmony default export */ const downloadable_blocks_list = (DownloadableBlocksList); |
1301 |
|
1302 /* harmony default export */ var downloadable_blocks_list = (DownloadableBlocksList); |
|
1303 |
1735 |
1304 ;// CONCATENATED MODULE: external ["wp","a11y"] |
1736 ;// CONCATENATED MODULE: external ["wp","a11y"] |
1305 var external_wp_a11y_namespaceObject = window["wp"]["a11y"]; |
1737 const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; |
1306 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/inserter-panel.js |
1738 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/inserter-panel.js |
1307 |
1739 /** |
1308 |
1740 * WordPress dependencies |
1309 /** |
1741 */ |
1310 * WordPress dependencies |
1742 |
1311 */ |
1743 |
1312 |
1744 |
1313 |
1745 |
1314 |
1746 |
1315 |
1747 |
1316 function DownloadableBlocksInserterPanel(_ref) { |
1748 function DownloadableBlocksInserterPanel({ |
1317 let { |
1749 children, |
1318 children, |
1750 downloadableItems, |
1319 downloadableItems, |
1751 hasLocalBlocks |
1320 hasLocalBlocks |
1752 }) { |
1321 } = _ref; |
|
1322 const count = downloadableItems.length; |
1753 const count = downloadableItems.length; |
1323 (0,external_wp_element_namespaceObject.useEffect)(() => { |
1754 (0,external_wp_element_namespaceObject.useEffect)(() => { |
1324 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( |
1755 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of available blocks. */ |
1325 /* translators: %d: number of available blocks. */ |
|
1326 (0,external_wp_i18n_namespaceObject._n)('%d additional block is available to install.', '%d additional blocks are available to install.', count), count)); |
1756 (0,external_wp_i18n_namespaceObject._n)('%d additional block is available to install.', '%d additional blocks are available to install.', count), count)); |
1327 }, [count]); |
1757 }, [count]); |
1328 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !hasLocalBlocks && (0,external_wp_element_namespaceObject.createElement)("p", { |
1758 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
1329 className: "block-directory-downloadable-blocks-panel__no-local" |
1759 children: [!hasLocalBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
1330 }, (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.')), (0,external_wp_element_namespaceObject.createElement)("div", { |
1760 className: "block-directory-downloadable-blocks-panel__no-local", |
1331 className: "block-editor-inserter__quick-inserter-separator" |
1761 children: (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.') |
1332 }), (0,external_wp_element_namespaceObject.createElement)("div", { |
1762 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
1333 className: "block-directory-downloadable-blocks-panel" |
1763 className: "block-editor-inserter__quick-inserter-separator" |
1334 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
1764 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { |
1335 className: "block-directory-downloadable-blocks-panel__header" |
1765 className: "block-directory-downloadable-blocks-panel", |
1336 }, (0,external_wp_element_namespaceObject.createElement)("h2", { |
1766 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { |
1337 className: "block-directory-downloadable-blocks-panel__title" |
1767 className: "block-directory-downloadable-blocks-panel__header", |
1338 }, (0,external_wp_i18n_namespaceObject.__)('Available to install')), (0,external_wp_element_namespaceObject.createElement)("p", { |
1768 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { |
1339 className: "block-directory-downloadable-blocks-panel__description" |
1769 className: "block-directory-downloadable-blocks-panel__title", |
1340 }, (0,external_wp_i18n_namespaceObject.__)('Select a block to install and add it to your post.'))), children)); |
1770 children: (0,external_wp_i18n_namespaceObject.__)('Available to install') |
1341 } |
1771 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
1342 |
1772 className: "block-directory-downloadable-blocks-panel__description", |
1343 /* harmony default export */ var inserter_panel = (DownloadableBlocksInserterPanel); |
1773 children: (0,external_wp_i18n_namespaceObject.__)('Select a block to install and add it to your post.') |
|
1774 })] |
|
1775 }), children] |
|
1776 })] |
|
1777 }); |
|
1778 } |
|
1779 /* harmony default export */ const inserter_panel = (DownloadableBlocksInserterPanel); |
1344 |
1780 |
1345 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js |
1781 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js |
1346 |
1782 /** |
1347 |
1783 * WordPress dependencies |
1348 /** |
1784 */ |
1349 * WordPress dependencies |
1785 |
1350 */ |
1786 |
1351 |
1787 const blockDefault = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
1352 const blockDefault = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
1353 xmlns: "http://www.w3.org/2000/svg", |
1788 xmlns: "http://www.w3.org/2000/svg", |
1354 viewBox: "0 0 24 24" |
1789 viewBox: "0 0 24 24", |
1355 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
1790 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(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" |
1791 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 })); |
1792 }) |
1358 /* harmony default export */ var block_default = (blockDefault); |
1793 }); |
|
1794 /* harmony default export */ const block_default = (blockDefault); |
1359 |
1795 |
1360 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/no-results.js |
1796 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/no-results.js |
1361 |
1797 /** |
1362 |
1798 * WordPress dependencies |
1363 /** |
1799 */ |
1364 * WordPress dependencies |
1800 |
1365 */ |
1801 |
|
1802 |
1366 |
1803 |
1367 |
1804 |
1368 |
1805 |
1369 function DownloadableBlocksNoResults() { |
1806 function DownloadableBlocksNoResults() { |
1370 return (0,external_wp_element_namespaceObject.createElement)("div", { |
1807 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
1371 className: "block-editor-inserter__no-results" |
1808 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { |
1372 }, (0,external_wp_element_namespaceObject.createElement)(icon, { |
1809 className: "block-editor-inserter__no-results", |
1373 className: "block-editor-inserter__no-results-icon", |
1810 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { |
1374 icon: block_default |
1811 className: "block-editor-inserter__no-results-icon", |
1375 }), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No results found.'))); |
1812 icon: block_default |
1376 } |
1813 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
1377 |
1814 children: (0,external_wp_i18n_namespaceObject.__)('No results found.') |
1378 /* harmony default export */ var no_results = (DownloadableBlocksNoResults); |
1815 })] |
|
1816 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
|
1817 className: "block-editor-inserter__tips", |
|
1818 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Tip, { |
|
1819 children: [(0,external_wp_i18n_namespaceObject.__)('Interested in creating your own block?'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ExternalLink, { |
|
1820 href: "https://developer.wordpress.org/block-editor/", |
|
1821 children: [(0,external_wp_i18n_namespaceObject.__)('Get started here'), "."] |
|
1822 })] |
|
1823 }) |
|
1824 })] |
|
1825 }); |
|
1826 } |
|
1827 /* harmony default export */ const no_results = (DownloadableBlocksNoResults); |
1379 |
1828 |
1380 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/index.js |
1829 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/index.js |
1381 |
|
1382 |
|
1383 /** |
1830 /** |
1384 * WordPress dependencies |
1831 * WordPress dependencies |
1385 */ |
1832 */ |
1386 |
1833 |
1387 |
1834 |
1396 |
1843 |
1397 |
1844 |
1398 |
1845 |
1399 |
1846 |
1400 |
1847 |
1401 function DownloadableBlocksPanel(_ref) { |
1848 |
1402 let { |
1849 const EMPTY_ARRAY = []; |
1403 downloadableItems, |
1850 const useDownloadableBlocks = filterValue => (0,external_wp_data_namespaceObject.useSelect)(select => { |
1404 onSelect, |
1851 const { |
1405 onHover, |
1852 getDownloadableBlocks, |
1406 hasLocalBlocks, |
1853 isRequestingDownloadableBlocks, |
|
1854 getInstalledBlockTypes |
|
1855 } = select(store); |
|
1856 const hasPermission = select(external_wp_coreData_namespaceObject.store).canUser('read', 'block-directory/search'); |
|
1857 let downloadableBlocks = EMPTY_ARRAY; |
|
1858 if (hasPermission) { |
|
1859 downloadableBlocks = getDownloadableBlocks(filterValue); |
|
1860 |
|
1861 // Filter out blocks that are already installed. |
|
1862 const installedBlockTypes = getInstalledBlockTypes(); |
|
1863 const installableBlocks = downloadableBlocks.filter(({ |
|
1864 name |
|
1865 }) => { |
|
1866 // Check if the block has just been installed, in which case it |
|
1867 // should still show in the list to avoid suddenly disappearing. |
|
1868 // `installedBlockTypes` only returns blocks stored in state |
|
1869 // immediately after installation, not all installed blocks. |
|
1870 const isJustInstalled = installedBlockTypes.some(blockType => blockType.name === name); |
|
1871 const isPreviouslyInstalled = (0,external_wp_blocks_namespaceObject.getBlockType)(name); |
|
1872 return isJustInstalled || !isPreviouslyInstalled; |
|
1873 }); |
|
1874 |
|
1875 // Keep identity of the `downloadableBlocks` array if nothing was filtered out |
|
1876 if (installableBlocks.length !== downloadableBlocks.length) { |
|
1877 downloadableBlocks = installableBlocks; |
|
1878 } |
|
1879 |
|
1880 // Return identical empty array when there are no blocks |
|
1881 if (downloadableBlocks.length === 0) { |
|
1882 downloadableBlocks = EMPTY_ARRAY; |
|
1883 } |
|
1884 } |
|
1885 return { |
1407 hasPermission, |
1886 hasPermission, |
1408 isLoading, |
1887 downloadableBlocks, |
1409 isTyping |
1888 isLoading: isRequestingDownloadableBlocks(filterValue) |
1410 } = _ref; |
1889 }; |
1411 |
1890 }, [filterValue]); |
1412 if (typeof hasPermission === 'undefined' || isLoading || isTyping) { |
1891 function DownloadableBlocksPanel({ |
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", { |
1892 onSelect, |
1414 className: "block-directory-downloadable-blocks-panel__no-local" |
1893 onHover, |
1415 }, (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.')), (0,external_wp_element_namespaceObject.createElement)("div", { |
1894 hasLocalBlocks, |
1416 className: "block-editor-inserter__quick-inserter-separator" |
1895 isTyping, |
1417 })), (0,external_wp_element_namespaceObject.createElement)("div", { |
1896 filterValue |
1418 className: "block-directory-downloadable-blocks-panel has-blocks-loading" |
1897 }) { |
1419 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null))); |
1898 const { |
1420 } |
1899 hasPermission, |
1421 |
1900 downloadableBlocks, |
|
1901 isLoading |
|
1902 } = useDownloadableBlocks(filterValue); |
|
1903 if (hasPermission === undefined || isLoading || isTyping) { |
|
1904 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
|
1905 children: [hasPermission && !hasLocalBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
|
1906 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
|
1907 className: "block-directory-downloadable-blocks-panel__no-local", |
|
1908 children: (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.') |
|
1909 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
|
1910 className: "block-editor-inserter__quick-inserter-separator" |
|
1911 })] |
|
1912 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
|
1913 className: "block-directory-downloadable-blocks-panel has-blocks-loading", |
|
1914 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) |
|
1915 })] |
|
1916 }); |
|
1917 } |
1422 if (false === hasPermission) { |
1918 if (false === hasPermission) { |
1423 if (!hasLocalBlocks) { |
1919 if (!hasLocalBlocks) { |
1424 return (0,external_wp_element_namespaceObject.createElement)(no_results, null); |
1920 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); |
1425 } |
1921 } |
1426 |
|
1427 return null; |
1922 return null; |
1428 } |
1923 } |
1429 |
1924 if (downloadableBlocks.length === 0) { |
1430 return !!downloadableItems.length ? (0,external_wp_element_namespaceObject.createElement)(inserter_panel, { |
1925 return hasLocalBlocks ? null : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); |
1431 downloadableItems: downloadableItems, |
1926 } |
1432 hasLocalBlocks: hasLocalBlocks |
1927 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_panel, { |
1433 }, (0,external_wp_element_namespaceObject.createElement)(downloadable_blocks_list, { |
1928 downloadableItems: downloadableBlocks, |
1434 items: downloadableItems, |
1929 hasLocalBlocks: hasLocalBlocks, |
1435 onSelect: onSelect, |
1930 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_blocks_list, { |
1436 onHover: onHover |
1931 items: downloadableBlocks, |
1437 })) : !hasLocalBlocks && (0,external_wp_element_namespaceObject.createElement)(no_results, null); |
1932 onSelect: onSelect, |
1438 } |
1933 onHover: onHover |
1439 |
1934 }) |
1440 /* harmony default export */ var downloadable_blocks_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => { |
1935 }); |
1441 let { |
1936 } |
1442 filterValue, |
|
1443 rootClientId = null |
|
1444 } = _ref2; |
|
1445 const { |
|
1446 getDownloadableBlocks, |
|
1447 isRequestingDownloadableBlocks |
|
1448 } = select(store); |
|
1449 const { |
|
1450 canInsertBlockType |
|
1451 } = select(external_wp_blockEditor_namespaceObject.store); |
|
1452 const hasPermission = select(external_wp_coreData_namespaceObject.store).canUser('read', 'block-directory/search'); |
|
1453 |
|
1454 function getInstallableBlocks(term) { |
|
1455 return getDownloadableBlocks(term).filter(block => canInsertBlockType(block, rootClientId, true)); |
|
1456 } |
|
1457 |
|
1458 const downloadableItems = hasPermission ? getInstallableBlocks(filterValue) : []; |
|
1459 const isLoading = isRequestingDownloadableBlocks(filterValue); |
|
1460 return { |
|
1461 downloadableItems, |
|
1462 hasPermission, |
|
1463 isLoading |
|
1464 }; |
|
1465 })])(DownloadableBlocksPanel)); |
|
1466 |
1937 |
1467 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js |
1938 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js |
1468 |
1939 /** |
1469 |
1940 * WordPress dependencies |
1470 /** |
1941 */ |
1471 * External dependencies |
1942 |
1472 */ |
|
1473 |
|
1474 /** |
|
1475 * WordPress dependencies |
|
1476 */ |
|
1477 |
1943 |
1478 |
1944 |
1479 |
1945 |
1480 /** |
1946 /** |
1481 * Internal dependencies |
1947 * Internal dependencies |
1482 */ |
1948 */ |
1483 |
|
1484 |
1949 |
1485 |
1950 |
1486 function InserterMenuDownloadableBlocksPanel() { |
1951 function InserterMenuDownloadableBlocksPanel() { |
1487 const [debouncedFilterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); |
1952 const [debouncedFilterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); |
1488 const debouncedSetFilterValue = (0,external_lodash_namespaceObject.debounce)(setFilterValue, 400); |
1953 const debouncedSetFilterValue = (0,external_wp_compose_namespaceObject.debounce)(setFilterValue, 400); |
1489 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableInserterMenuExtension, null, _ref => { |
1954 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableInserterMenuExtension, { |
1490 let { |
1955 children: ({ |
1491 onSelect, |
1956 onSelect, |
1492 onHover, |
1957 onHover, |
1493 filterValue, |
1958 filterValue, |
1494 hasItems, |
1959 hasItems |
1495 rootClientId |
1960 }) => { |
1496 } = _ref; |
1961 if (debouncedFilterValue !== filterValue) { |
1497 |
1962 debouncedSetFilterValue(filterValue); |
1498 if (debouncedFilterValue !== filterValue) { |
1963 } |
1499 debouncedSetFilterValue(filterValue); |
1964 if (!debouncedFilterValue) { |
|
1965 return null; |
|
1966 } |
|
1967 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DownloadableBlocksPanel, { |
|
1968 onSelect: onSelect, |
|
1969 onHover: onHover, |
|
1970 filterValue: debouncedFilterValue, |
|
1971 hasLocalBlocks: hasItems, |
|
1972 isTyping: filterValue !== debouncedFilterValue |
|
1973 }); |
1500 } |
1974 } |
1501 |
|
1502 if (!debouncedFilterValue) { |
|
1503 return null; |
|
1504 } |
|
1505 |
|
1506 return (0,external_wp_element_namespaceObject.createElement)(downloadable_blocks_panel, { |
|
1507 onSelect: onSelect, |
|
1508 onHover: onHover, |
|
1509 rootClientId: rootClientId, |
|
1510 filterValue: debouncedFilterValue, |
|
1511 hasLocalBlocks: hasItems, |
|
1512 isTyping: filterValue !== debouncedFilterValue |
|
1513 }); |
|
1514 }); |
1975 }); |
1515 } |
1976 } |
1516 |
1977 /* harmony default export */ const inserter_menu_downloadable_blocks_panel = (InserterMenuDownloadableBlocksPanel); |
1517 /* harmony default export */ var inserter_menu_downloadable_blocks_panel = (InserterMenuDownloadableBlocksPanel); |
1978 |
1518 |
|
1519 ;// CONCATENATED MODULE: external ["wp","editPost"] |
|
1520 var external_wp_editPost_namespaceObject = window["wp"]["editPost"]; |
|
1521 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/compact-list/index.js |
1979 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/compact-list/index.js |
1522 |
1980 /** |
1523 |
1981 * WordPress dependencies |
1524 /** |
1982 */ |
1525 * WordPress dependencies |
1983 |
1526 */ |
|
1527 |
1984 |
1528 /** |
1985 /** |
1529 * Internal dependencies |
1986 * Internal dependencies |
1530 */ |
1987 */ |
1531 |
1988 |
1532 |
1989 |
1533 function CompactList(_ref) { |
1990 |
1534 let { |
1991 function CompactList({ |
1535 items |
1992 items |
1536 } = _ref; |
1993 }) { |
1537 |
|
1538 if (!items.length) { |
1994 if (!items.length) { |
1539 return null; |
1995 return null; |
1540 } |
1996 } |
1541 |
1997 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { |
1542 return (0,external_wp_element_namespaceObject.createElement)("ul", { |
1998 className: "block-directory-compact-list", |
1543 className: "block-directory-compact-list" |
1999 children: items.map(({ |
1544 }, items.map(_ref2 => { |
|
1545 let { |
|
1546 icon, |
2000 icon, |
1547 id, |
2001 id, |
1548 title, |
2002 title, |
1549 author |
2003 author |
1550 } = _ref2; |
2004 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { |
1551 return (0,external_wp_element_namespaceObject.createElement)("li", { |
2005 className: "block-directory-compact-list__item", |
1552 key: id, |
2006 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_block_icon, { |
1553 className: "block-directory-compact-list__item" |
2007 icon: icon, |
1554 }, (0,external_wp_element_namespaceObject.createElement)(downloadable_block_icon, { |
2008 title: title |
1555 icon: icon, |
2009 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { |
1556 title: title |
2010 className: "block-directory-compact-list__item-details", |
1557 }), (0,external_wp_element_namespaceObject.createElement)("div", { |
2011 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
1558 className: "block-directory-compact-list__item-details" |
2012 className: "block-directory-compact-list__item-title", |
1559 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
2013 children: title |
1560 className: "block-directory-compact-list__item-title" |
2014 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
1561 }, title), (0,external_wp_element_namespaceObject.createElement)("div", { |
2015 className: "block-directory-compact-list__item-author", |
1562 className: "block-directory-compact-list__item-author" |
2016 children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block author. */ |
1563 }, (0,external_wp_i18n_namespaceObject.sprintf)( |
2017 (0,external_wp_i18n_namespaceObject.__)('By %s'), author) |
1564 /* translators: %s: Name of the block author. */ |
2018 })] |
1565 (0,external_wp_i18n_namespaceObject.__)('By %s'), author)))); |
2019 })] |
1566 })); |
2020 }, id)) |
|
2021 }); |
1567 } |
2022 } |
1568 |
2023 |
1569 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/installed-blocks-pre-publish-panel/index.js |
2024 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/installed-blocks-pre-publish-panel/index.js |
1570 |
2025 var _window$wp$editor; |
1571 |
|
1572 /** |
2026 /** |
1573 * WordPress dependencies |
2027 * WordPress dependencies |
1574 */ |
2028 */ |
1575 |
2029 |
1576 |
2030 |
1580 * Internal dependencies |
2034 * Internal dependencies |
1581 */ |
2035 */ |
1582 |
2036 |
1583 |
2037 |
1584 |
2038 |
|
2039 // We shouldn't import the editor package directly |
|
2040 // because it would include the wp-editor in all pages loading the block-directory script. |
|
2041 |
|
2042 |
|
2043 const { |
|
2044 PluginPrePublishPanel |
|
2045 } = (_window$wp$editor = window?.wp?.editor) !== null && _window$wp$editor !== void 0 ? _window$wp$editor : {}; |
1585 function InstalledBlocksPrePublishPanel() { |
2046 function InstalledBlocksPrePublishPanel() { |
1586 const newBlockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getNewBlockTypes(), []); |
2047 const newBlockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getNewBlockTypes(), []); |
1587 |
|
1588 if (!newBlockTypes.length) { |
2048 if (!newBlockTypes.length) { |
1589 return null; |
2049 return null; |
1590 } |
2050 } |
1591 |
2051 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PluginPrePublishPanel, { |
1592 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editPost_namespaceObject.PluginPrePublishPanel, { |
|
1593 icon: block_default, |
2052 icon: block_default, |
1594 title: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: number of blocks (number). |
2053 title: (0,external_wp_i18n_namespaceObject.sprintf)( |
|
2054 // translators: %d: number of blocks (number). |
1595 (0,external_wp_i18n_namespaceObject._n)('Added: %d block', 'Added: %d blocks', newBlockTypes.length), newBlockTypes.length), |
2055 (0,external_wp_i18n_namespaceObject._n)('Added: %d block', 'Added: %d blocks', newBlockTypes.length), newBlockTypes.length), |
1596 initialOpen: true |
2056 initialOpen: true, |
1597 }, (0,external_wp_element_namespaceObject.createElement)("p", { |
2057 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
1598 className: "installed-blocks-pre-publish-panel__copy" |
2058 className: "installed-blocks-pre-publish-panel__copy", |
1599 }, (0,external_wp_i18n_namespaceObject._n)('The following block has been added to your site.', 'The following blocks have been added to your site.', newBlockTypes.length)), (0,external_wp_element_namespaceObject.createElement)(CompactList, { |
2059 children: (0,external_wp_i18n_namespaceObject._n)('The following block has been added to your site.', 'The following blocks have been added to your site.', newBlockTypes.length) |
1600 items: newBlockTypes |
2060 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactList, { |
1601 })); |
2061 items: newBlockTypes |
|
2062 })] |
|
2063 }); |
1602 } |
2064 } |
1603 |
2065 |
1604 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/get-install-missing/install-button.js |
2066 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/get-install-missing/install-button.js |
1605 |
2067 /** |
1606 |
2068 * WordPress dependencies |
1607 /** |
2069 */ |
1608 * WordPress dependencies |
2070 |
1609 */ |
|
1610 |
2071 |
1611 |
2072 |
1612 |
2073 |
1613 |
2074 |
1614 |
2075 |
1615 /** |
2076 /** |
1616 * Internal dependencies |
2077 * Internal dependencies |
1617 */ |
2078 */ |
1618 |
2079 |
1619 |
2080 |
1620 function InstallButton(_ref) { |
2081 function InstallButton({ |
1621 let { |
2082 attributes, |
1622 attributes, |
2083 block, |
1623 block, |
2084 clientId |
1624 clientId |
2085 }) { |
1625 } = _ref; |
|
1626 const isInstallingBlock = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isInstalling(block.id), [block.id]); |
2086 const isInstallingBlock = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isInstalling(block.id), [block.id]); |
1627 const { |
2087 const { |
1628 installBlockType |
2088 installBlockType |
1629 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
2089 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
1630 const { |
2090 const { |
1631 replaceBlock |
2091 replaceBlock |
1632 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
2092 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
1633 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
2093 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { |
1634 onClick: () => installBlockType(block).then(success => { |
2094 onClick: () => installBlockType(block).then(success => { |
1635 if (success) { |
2095 if (success) { |
1636 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); |
2096 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); |
1637 const [originalBlock] = (0,external_wp_blocks_namespaceObject.parse)(attributes.originalContent); |
2097 const [originalBlock] = (0,external_wp_blocks_namespaceObject.parse)(attributes.originalContent); |
1638 |
|
1639 if (originalBlock && blockType) { |
2098 if (originalBlock && blockType) { |
1640 replaceBlock(clientId, (0,external_wp_blocks_namespaceObject.createBlock)(blockType.name, originalBlock.attributes, originalBlock.innerBlocks)); |
2099 replaceBlock(clientId, (0,external_wp_blocks_namespaceObject.createBlock)(blockType.name, originalBlock.attributes, originalBlock.innerBlocks)); |
1641 } |
2100 } |
1642 } |
2101 } |
1643 }), |
2102 }), |
|
2103 __experimentalIsFocusable: true, |
1644 disabled: isInstallingBlock, |
2104 disabled: isInstallingBlock, |
1645 isBusy: isInstallingBlock, |
2105 isBusy: isInstallingBlock, |
1646 variant: "primary" |
2106 variant: "primary", |
1647 }, (0,external_wp_i18n_namespaceObject.sprintf)( |
2107 children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ |
1648 /* translators: %s: block name */ |
2108 (0,external_wp_i18n_namespaceObject.__)('Install %s'), block.title) |
1649 (0,external_wp_i18n_namespaceObject.__)('Install %s'), block.title)); |
2109 }); |
1650 } |
2110 } |
1651 |
2111 |
1652 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/get-install-missing/index.js |
2112 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/get-install-missing/index.js |
1653 |
2113 /** |
1654 |
2114 * WordPress dependencies |
1655 |
2115 */ |
1656 /** |
2116 |
1657 * WordPress dependencies |
|
1658 */ |
|
1659 |
2117 |
1660 |
2118 |
1661 |
2119 |
1662 |
2120 |
1663 |
2121 |
1671 |
2129 |
1672 |
2130 |
1673 const getInstallMissing = OriginalComponent => props => { |
2131 const getInstallMissing = OriginalComponent => props => { |
1674 const { |
2132 const { |
1675 originalName |
2133 originalName |
1676 } = props.attributes; // Disable reason: This is a valid component, but it's mistaken for a callback. |
2134 } = props.attributes; |
|
2135 // Disable reason: This is a valid component, but it's mistaken for a callback. |
1677 // eslint-disable-next-line react-hooks/rules-of-hooks |
2136 // eslint-disable-next-line react-hooks/rules-of-hooks |
1678 |
|
1679 const { |
2137 const { |
1680 block, |
2138 block, |
1681 hasPermission |
2139 hasPermission |
1682 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
2140 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
1683 const { |
2141 const { |
1684 getDownloadableBlocks |
2142 getDownloadableBlocks |
1685 } = select(store); |
2143 } = select(store); |
1686 const blocks = getDownloadableBlocks('block:' + originalName).filter(_ref => { |
2144 const blocks = getDownloadableBlocks('block:' + originalName).filter(({ |
1687 let { |
2145 name |
1688 name |
2146 }) => originalName === name); |
1689 } = _ref; |
|
1690 return originalName === name; |
|
1691 }); |
|
1692 return { |
2147 return { |
1693 hasPermission: select(external_wp_coreData_namespaceObject.store).canUser('read', 'block-directory/search'), |
2148 hasPermission: select(external_wp_coreData_namespaceObject.store).canUser('read', 'block-directory/search'), |
1694 block: blocks.length && blocks[0] |
2149 block: blocks.length && blocks[0] |
1695 }; |
2150 }; |
1696 }, [originalName]); // The user can't install blocks, or the block isn't available for download. |
2151 }, [originalName]); |
1697 |
2152 |
|
2153 // The user can't install blocks, or the block isn't available for download. |
1698 if (!hasPermission || !block) { |
2154 if (!hasPermission || !block) { |
1699 return (0,external_wp_element_namespaceObject.createElement)(OriginalComponent, props); |
2155 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalComponent, { |
1700 } |
2156 ...props |
1701 |
2157 }); |
1702 return (0,external_wp_element_namespaceObject.createElement)(ModifiedWarning, _extends({}, props, { |
2158 } |
|
2159 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ModifiedWarning, { |
|
2160 ...props, |
1703 originalBlock: block |
2161 originalBlock: block |
1704 })); |
2162 }); |
1705 }; |
2163 }; |
1706 |
2164 const ModifiedWarning = ({ |
1707 const ModifiedWarning = _ref2 => { |
2165 originalBlock, |
1708 let { |
2166 ...props |
1709 originalBlock, |
2167 }) => { |
1710 ...props |
|
1711 } = _ref2; |
|
1712 const { |
2168 const { |
1713 originalName, |
2169 originalName, |
1714 originalUndelimitedContent |
2170 originalUndelimitedContent, |
|
2171 clientId |
1715 } = props.attributes; |
2172 } = props.attributes; |
1716 const { |
2173 const { |
1717 replaceBlock |
2174 replaceBlock |
1718 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
2175 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
1719 |
|
1720 const convertToHTML = () => { |
2176 const convertToHTML = () => { |
1721 replaceBlock(props.clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/html', { |
2177 replaceBlock(props.clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/html', { |
1722 content: originalUndelimitedContent |
2178 content: originalUndelimitedContent |
1723 })); |
2179 })); |
1724 }; |
2180 }; |
1725 |
|
1726 const hasContent = !!originalUndelimitedContent; |
2181 const hasContent = !!originalUndelimitedContent; |
1727 const hasHTMLBlock = (0,external_wp_blocks_namespaceObject.getBlockType)('core/html'); |
2182 const hasHTMLBlock = (0,external_wp_data_namespaceObject.useSelect)(select => { |
1728 let messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( |
2183 const { |
1729 /* translators: %s: block name */ |
2184 canInsertBlockType, |
|
2185 getBlockRootClientId |
|
2186 } = select(external_wp_blockEditor_namespaceObject.store); |
|
2187 return canInsertBlockType('core/html', getBlockRootClientId(clientId)); |
|
2188 }, [clientId]); |
|
2189 let messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ |
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); |
2190 (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); |
1731 const actions = [(0,external_wp_element_namespaceObject.createElement)(InstallButton, { |
2191 const actions = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InstallButton, { |
1732 key: "install", |
|
1733 block: originalBlock, |
2192 block: originalBlock, |
1734 attributes: props.attributes, |
2193 attributes: props.attributes, |
1735 clientId: props.clientId |
2194 clientId: props.clientId |
1736 })]; |
2195 }, "install")]; |
1737 |
|
1738 if (hasContent && hasHTMLBlock) { |
2196 if (hasContent && hasHTMLBlock) { |
1739 messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( |
2197 messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ |
1740 /* translators: %s: block name */ |
|
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); |
2198 (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); |
1742 actions.push((0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
2199 actions.push( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { |
1743 key: "convert", |
|
1744 onClick: convertToHTML, |
2200 onClick: convertToHTML, |
1745 variant: "link" |
2201 variant: "tertiary", |
1746 }, (0,external_wp_i18n_namespaceObject.__)('Keep as HTML'))); |
2202 children: (0,external_wp_i18n_namespaceObject.__)('Keep as HTML') |
1747 } |
2203 }, "convert")); |
1748 |
2204 } |
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, { |
2205 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { |
1750 actions: actions |
2206 ...(0,external_wp_blockEditor_namespaceObject.useBlockProps)(), |
1751 }, messageHTML), (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, originalUndelimitedContent)); |
2207 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, { |
|
2208 actions: actions, |
|
2209 children: messageHTML |
|
2210 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { |
|
2211 children: originalUndelimitedContent |
|
2212 })] |
|
2213 }); |
1752 }; |
2214 }; |
1753 |
2215 /* harmony default export */ const get_install_missing = (getInstallMissing); |
1754 /* harmony default export */ var get_install_missing = (getInstallMissing); |
|
1755 |
2216 |
1756 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/index.js |
2217 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/index.js |
1757 |
2218 /** |
1758 |
2219 * WordPress dependencies |
1759 /** |
2220 */ |
1760 * WordPress dependencies |
2221 |
1761 */ |
|
1762 |
2222 |
1763 |
2223 |
1764 /** |
2224 /** |
1765 * Internal dependencies |
2225 * Internal dependencies |
1766 */ |
2226 */ |
|
2227 |
|
2228 |
1767 |
2229 |
1768 |
2230 |
1769 |
2231 |
1770 |
2232 |
1771 |
2233 |
1772 (0,external_wp_plugins_namespaceObject.registerPlugin)('block-directory', { |
2234 (0,external_wp_plugins_namespaceObject.registerPlugin)('block-directory', { |
1773 render() { |
2235 render() { |
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)); |
2236 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
1775 } |
2237 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AutoBlockUninstaller, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_menu_downloadable_blocks_panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InstalledBlocksPrePublishPanel, {})] |
1776 |
2238 }); |
|
2239 } |
1777 }); |
2240 }); |
1778 (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'block-directory/fallback', (settings, name) => { |
2241 (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'block-directory/fallback', (settings, name) => { |
1779 if (name !== 'core/missing') { |
2242 if (name !== 'core/missing') { |
1780 return settings; |
2243 return settings; |
1781 } |
2244 } |
1782 |
|
1783 settings.edit = get_install_missing(settings.edit); |
2245 settings.edit = get_install_missing(settings.edit); |
1784 return settings; |
2246 return settings; |
1785 }); |
2247 }); |
1786 |
2248 |
1787 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/index.js |
2249 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/index.js |