changeset 19 | 3d72ae0968f4 |
parent 18 | be944660c56a |
child 21 | 48c4eec2b7e6 |
18:be944660c56a | 19:3d72ae0968f4 |
---|---|
1 this["wp"] = this["wp"] || {}; this["wp"]["element"] = |
1 /******/ (function() { // webpackBootstrap |
2 /******/ (function(modules) { // webpackBootstrap |
2 /******/ "use strict"; |
3 /******/ // The module cache |
3 /******/ // The require scope |
4 /******/ var installedModules = {}; |
4 /******/ var __webpack_require__ = {}; |
5 /******/ |
5 /******/ |
6 /******/ // The require function |
6 /************************************************************************/ |
7 /******/ function __webpack_require__(moduleId) { |
7 /******/ /* webpack/runtime/define property getters */ |
8 /******/ |
8 /******/ !function() { |
9 /******/ // Check if module is in cache |
9 /******/ // define getter functions for harmony exports |
10 /******/ if(installedModules[moduleId]) { |
10 /******/ __webpack_require__.d = function(exports, definition) { |
11 /******/ return installedModules[moduleId].exports; |
11 /******/ for(var key in definition) { |
12 /******/ } |
12 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
13 /******/ // Create a new module (and put it into the cache) |
13 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
14 /******/ var module = installedModules[moduleId] = { |
14 /******/ } |
15 /******/ i: moduleId, |
15 /******/ } |
16 /******/ l: false, |
|
17 /******/ exports: {} |
|
18 /******/ }; |
16 /******/ }; |
19 /******/ |
17 /******/ }(); |
20 /******/ // Execute the module function |
18 /******/ |
21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
19 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
22 /******/ |
20 /******/ !function() { |
23 /******/ // Flag the module as loaded |
21 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
24 /******/ module.l = true; |
22 /******/ }(); |
25 /******/ |
23 /******/ |
26 /******/ // Return the exports of the module |
24 /******/ /* webpack/runtime/make namespace object */ |
27 /******/ return module.exports; |
25 /******/ !function() { |
28 /******/ } |
26 /******/ // define __esModule on exports |
29 /******/ |
27 /******/ __webpack_require__.r = function(exports) { |
30 /******/ |
28 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
31 /******/ // expose the modules object (__webpack_modules__) |
29 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
32 /******/ __webpack_require__.m = modules; |
30 /******/ } |
33 /******/ |
31 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
34 /******/ // expose the module cache |
32 /******/ }; |
35 /******/ __webpack_require__.c = installedModules; |
33 /******/ }(); |
36 /******/ |
34 /******/ |
37 /******/ // define getter function for harmony exports |
|
38 /******/ __webpack_require__.d = function(exports, name, getter) { |
|
39 /******/ if(!__webpack_require__.o(exports, name)) { |
|
40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
|
41 /******/ } |
|
42 /******/ }; |
|
43 /******/ |
|
44 /******/ // define __esModule on exports |
|
45 /******/ __webpack_require__.r = function(exports) { |
|
46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
48 /******/ } |
|
49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
50 /******/ }; |
|
51 /******/ |
|
52 /******/ // create a fake namespace object |
|
53 /******/ // mode & 1: value is a module id, require it |
|
54 /******/ // mode & 2: merge all properties of value into the ns |
|
55 /******/ // mode & 4: return value when already ns object |
|
56 /******/ // mode & 8|1: behave like require |
|
57 /******/ __webpack_require__.t = function(value, mode) { |
|
58 /******/ if(mode & 1) value = __webpack_require__(value); |
|
59 /******/ if(mode & 8) return value; |
|
60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
|
61 /******/ var ns = Object.create(null); |
|
62 /******/ __webpack_require__.r(ns); |
|
63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
|
64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
|
65 /******/ return ns; |
|
66 /******/ }; |
|
67 /******/ |
|
68 /******/ // getDefaultExport function for compatibility with non-harmony modules |
|
69 /******/ __webpack_require__.n = function(module) { |
|
70 /******/ var getter = module && module.__esModule ? |
|
71 /******/ function getDefault() { return module['default']; } : |
|
72 /******/ function getModuleExports() { return module; }; |
|
73 /******/ __webpack_require__.d(getter, 'a', getter); |
|
74 /******/ return getter; |
|
75 /******/ }; |
|
76 /******/ |
|
77 /******/ // Object.prototype.hasOwnProperty.call |
|
78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
|
79 /******/ |
|
80 /******/ // __webpack_public_path__ |
|
81 /******/ __webpack_require__.p = ""; |
|
82 /******/ |
|
83 /******/ |
|
84 /******/ // Load entry module and return exports |
|
85 /******/ return __webpack_require__(__webpack_require__.s = "o/Ny"); |
|
86 /******/ }) |
|
87 /************************************************************************/ |
35 /************************************************************************/ |
88 /******/ ({ |
36 var __webpack_exports__ = {}; |
89 |
|
90 /***/ "Vx3V": |
|
91 /***/ (function(module, exports) { |
|
92 |
|
93 (function() { module.exports = window["wp"]["escapeHtml"]; }()); |
|
94 |
|
95 /***/ }), |
|
96 |
|
97 /***/ "YLtl": |
|
98 /***/ (function(module, exports) { |
|
99 |
|
100 (function() { module.exports = window["lodash"]; }()); |
|
101 |
|
102 /***/ }), |
|
103 |
|
104 /***/ "cDcd": |
|
105 /***/ (function(module, exports) { |
|
106 |
|
107 (function() { module.exports = window["React"]; }()); |
|
108 |
|
109 /***/ }), |
|
110 |
|
111 /***/ "faye": |
|
112 /***/ (function(module, exports) { |
|
113 |
|
114 (function() { module.exports = window["ReactDOM"]; }()); |
|
115 |
|
116 /***/ }), |
|
117 |
|
118 /***/ "o/Ny": |
|
119 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
120 |
|
121 "use strict"; |
|
122 // ESM COMPAT FLAG |
37 // ESM COMPAT FLAG |
123 __webpack_require__.r(__webpack_exports__); |
38 __webpack_require__.r(__webpack_exports__); |
124 |
39 |
125 // EXPORTS |
40 // EXPORTS |
126 __webpack_require__.d(__webpack_exports__, "createInterpolateElement", function() { return /* reexport */ create_interpolate_element; }); |
41 __webpack_require__.d(__webpack_exports__, { |
127 __webpack_require__.d(__webpack_exports__, "Children", function() { return /* reexport */ external_React_["Children"]; }); |
42 "Children": function() { return /* reexport */ external_React_namespaceObject.Children; }, |
128 __webpack_require__.d(__webpack_exports__, "cloneElement", function() { return /* reexport */ external_React_["cloneElement"]; }); |
43 "Component": function() { return /* reexport */ external_React_namespaceObject.Component; }, |
129 __webpack_require__.d(__webpack_exports__, "Component", function() { return /* reexport */ external_React_["Component"]; }); |
44 "Fragment": function() { return /* reexport */ external_React_namespaceObject.Fragment; }, |
130 __webpack_require__.d(__webpack_exports__, "createContext", function() { return /* reexport */ external_React_["createContext"]; }); |
45 "Platform": function() { return /* reexport */ platform; }, |
131 __webpack_require__.d(__webpack_exports__, "createElement", function() { return /* reexport */ external_React_["createElement"]; }); |
46 "RawHTML": function() { return /* reexport */ RawHTML; }, |
132 __webpack_require__.d(__webpack_exports__, "createRef", function() { return /* reexport */ external_React_["createRef"]; }); |
47 "StrictMode": function() { return /* reexport */ external_React_namespaceObject.StrictMode; }, |
133 __webpack_require__.d(__webpack_exports__, "forwardRef", function() { return /* reexport */ external_React_["forwardRef"]; }); |
48 "Suspense": function() { return /* reexport */ external_React_namespaceObject.Suspense; }, |
134 __webpack_require__.d(__webpack_exports__, "Fragment", function() { return /* reexport */ external_React_["Fragment"]; }); |
49 "cloneElement": function() { return /* reexport */ external_React_namespaceObject.cloneElement; }, |
135 __webpack_require__.d(__webpack_exports__, "isValidElement", function() { return /* reexport */ external_React_["isValidElement"]; }); |
50 "concatChildren": function() { return /* reexport */ concatChildren; }, |
136 __webpack_require__.d(__webpack_exports__, "memo", function() { return /* reexport */ external_React_["memo"]; }); |
51 "createContext": function() { return /* reexport */ external_React_namespaceObject.createContext; }, |
137 __webpack_require__.d(__webpack_exports__, "StrictMode", function() { return /* reexport */ external_React_["StrictMode"]; }); |
52 "createElement": function() { return /* reexport */ external_React_namespaceObject.createElement; }, |
138 __webpack_require__.d(__webpack_exports__, "useCallback", function() { return /* reexport */ external_React_["useCallback"]; }); |
53 "createInterpolateElement": function() { return /* reexport */ create_interpolate_element; }, |
139 __webpack_require__.d(__webpack_exports__, "useContext", function() { return /* reexport */ external_React_["useContext"]; }); |
54 "createPortal": function() { return /* reexport */ external_ReactDOM_namespaceObject.createPortal; }, |
140 __webpack_require__.d(__webpack_exports__, "useDebugValue", function() { return /* reexport */ external_React_["useDebugValue"]; }); |
55 "createRef": function() { return /* reexport */ external_React_namespaceObject.createRef; }, |
141 __webpack_require__.d(__webpack_exports__, "useEffect", function() { return /* reexport */ external_React_["useEffect"]; }); |
56 "findDOMNode": function() { return /* reexport */ external_ReactDOM_namespaceObject.findDOMNode; }, |
142 __webpack_require__.d(__webpack_exports__, "useImperativeHandle", function() { return /* reexport */ external_React_["useImperativeHandle"]; }); |
57 "forwardRef": function() { return /* reexport */ external_React_namespaceObject.forwardRef; }, |
143 __webpack_require__.d(__webpack_exports__, "useLayoutEffect", function() { return /* reexport */ external_React_["useLayoutEffect"]; }); |
58 "isEmptyElement": function() { return /* reexport */ isEmptyElement; }, |
144 __webpack_require__.d(__webpack_exports__, "useMemo", function() { return /* reexport */ external_React_["useMemo"]; }); |
59 "isValidElement": function() { return /* reexport */ external_React_namespaceObject.isValidElement; }, |
145 __webpack_require__.d(__webpack_exports__, "useReducer", function() { return /* reexport */ external_React_["useReducer"]; }); |
60 "lazy": function() { return /* reexport */ external_React_namespaceObject.lazy; }, |
146 __webpack_require__.d(__webpack_exports__, "useRef", function() { return /* reexport */ external_React_["useRef"]; }); |
61 "memo": function() { return /* reexport */ external_React_namespaceObject.memo; }, |
147 __webpack_require__.d(__webpack_exports__, "useState", function() { return /* reexport */ external_React_["useState"]; }); |
62 "render": function() { return /* reexport */ external_ReactDOM_namespaceObject.render; }, |
148 __webpack_require__.d(__webpack_exports__, "lazy", function() { return /* reexport */ external_React_["lazy"]; }); |
63 "renderToString": function() { return /* reexport */ serialize; }, |
149 __webpack_require__.d(__webpack_exports__, "Suspense", function() { return /* reexport */ external_React_["Suspense"]; }); |
64 "switchChildrenNodeName": function() { return /* reexport */ switchChildrenNodeName; }, |
150 __webpack_require__.d(__webpack_exports__, "concatChildren", function() { return /* reexport */ concatChildren; }); |
65 "unmountComponentAtNode": function() { return /* reexport */ external_ReactDOM_namespaceObject.unmountComponentAtNode; }, |
151 __webpack_require__.d(__webpack_exports__, "switchChildrenNodeName", function() { return /* reexport */ switchChildrenNodeName; }); |
66 "useCallback": function() { return /* reexport */ external_React_namespaceObject.useCallback; }, |
152 __webpack_require__.d(__webpack_exports__, "createPortal", function() { return /* reexport */ external_ReactDOM_["createPortal"]; }); |
67 "useContext": function() { return /* reexport */ external_React_namespaceObject.useContext; }, |
153 __webpack_require__.d(__webpack_exports__, "findDOMNode", function() { return /* reexport */ external_ReactDOM_["findDOMNode"]; }); |
68 "useDebugValue": function() { return /* reexport */ external_React_namespaceObject.useDebugValue; }, |
154 __webpack_require__.d(__webpack_exports__, "render", function() { return /* reexport */ external_ReactDOM_["render"]; }); |
69 "useEffect": function() { return /* reexport */ external_React_namespaceObject.useEffect; }, |
155 __webpack_require__.d(__webpack_exports__, "unmountComponentAtNode", function() { return /* reexport */ external_ReactDOM_["unmountComponentAtNode"]; }); |
70 "useImperativeHandle": function() { return /* reexport */ external_React_namespaceObject.useImperativeHandle; }, |
156 __webpack_require__.d(__webpack_exports__, "isEmptyElement", function() { return /* reexport */ isEmptyElement; }); |
71 "useLayoutEffect": function() { return /* reexport */ external_React_namespaceObject.useLayoutEffect; }, |
157 __webpack_require__.d(__webpack_exports__, "Platform", function() { return /* reexport */ platform; }); |
72 "useMemo": function() { return /* reexport */ external_React_namespaceObject.useMemo; }, |
158 __webpack_require__.d(__webpack_exports__, "renderToString", function() { return /* reexport */ serialize; }); |
73 "useReducer": function() { return /* reexport */ external_React_namespaceObject.useReducer; }, |
159 __webpack_require__.d(__webpack_exports__, "RawHTML", function() { return /* reexport */ RawHTML; }); |
74 "useRef": function() { return /* reexport */ external_React_namespaceObject.useRef; }, |
160 |
75 "useState": function() { return /* reexport */ external_React_namespaceObject.useState; } |
161 // EXTERNAL MODULE: external "React" |
76 }); |
162 var external_React_ = __webpack_require__("cDcd"); |
77 |
163 |
78 ;// CONCATENATED MODULE: external "React" |
164 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/create-interpolate-element.js |
79 var external_React_namespaceObject = window["React"]; |
80 ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/create-interpolate-element.js |
|
165 /** |
81 /** |
166 * Internal dependencies |
82 * Internal dependencies |
167 */ |
83 */ |
168 |
84 |
169 /** @typedef {import('./react').WPElement} WPElement */ |
85 /** @typedef {import('./react').WPElement} WPElement */ |
189 /** |
105 /** |
190 * The stack frame tracking parse progress. |
106 * The stack frame tracking parse progress. |
191 * |
107 * |
192 * @typedef Frame |
108 * @typedef Frame |
193 * |
109 * |
194 * @property {WPElement} element A parent element which may still have |
110 * @property {WPElement} element A parent element which may still have |
195 * @property {number} tokenStart Offset at which parent element first |
111 * @property {number} tokenStart Offset at which parent element first |
196 * appears. |
112 * appears. |
197 * @property {number} tokenLength Length of string marking start of parent |
113 * @property {number} tokenLength Length of string marking start of parent |
198 * element. |
114 * element. |
199 * @property {number} [prevOffset] Running offset at which parsing should |
115 * @property {number} [prevOffset] Running offset at which parsing should |
200 * continue. |
116 * continue. |
201 * @property {number} [leadingTextStart] Offset at which last closing element |
117 * @property {number} [leadingTextStart] Offset at which last closing element |
202 * finished, used for finding text between |
118 * finished, used for finding text between |
203 * elements. |
119 * elements. |
204 * @property {WPElement[]} children Children. |
120 * @property {WPElement[]} children Children. |
205 */ |
121 */ |
206 |
122 |
207 /** |
123 /** |
208 * Tracks recursive-descent parse state. |
124 * Tracks recursive-descent parse state. |
209 * |
125 * |
255 * a: <a href={ 'https://github.com' } />, |
171 * a: <a href={ 'https://github.com' } />, |
256 * CustomComponentB: <CustomComponent />, |
172 * CustomComponentB: <CustomComponent />, |
257 * } |
173 * } |
258 * ``` |
174 * ``` |
259 * |
175 * |
260 * @param {string} interpolatedString The interpolation string to be parsed. |
176 * @param {string} interpolatedString The interpolation string to be parsed. |
261 * @param {Object} conversionMap The map used to convert the string to |
177 * @param {Object} conversionMap The map used to convert the string to |
262 * a react element. |
178 * a react element. |
263 * @throws {TypeError} |
179 * @throws {TypeError} |
264 * @return {WPElement} A wp element. |
180 * @return {WPElement} A wp element. |
265 */ |
181 */ |
266 |
182 |
267 |
183 |
277 } |
193 } |
278 |
194 |
279 do {// twiddle our thumbs |
195 do {// twiddle our thumbs |
280 } while (proceed(conversionMap)); |
196 } while (proceed(conversionMap)); |
281 |
197 |
282 return Object(external_React_["createElement"])(external_React_["Fragment"], null, ...output); |
198 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, ...output); |
283 }; |
199 }; |
284 /** |
200 /** |
285 * Validate conversion map. |
201 * Validate conversion map. |
286 * |
202 * |
287 * A map is considered valid if it's an object and every value in the object |
203 * A map is considered valid if it's an object and every value in the object |
288 * is a WPElement |
204 * is a WPElement |
289 * |
205 * |
290 * @private |
206 * @private |
291 * |
207 * |
292 * @param {Object} conversionMap The map being validated. |
208 * @param {Object} conversionMap The map being validated. |
293 * |
209 * |
294 * @return {boolean} True means the map is valid. |
210 * @return {boolean} True means the map is valid. |
295 */ |
211 */ |
296 |
212 |
297 |
213 |
298 const isValidConversionMap = conversionMap => { |
214 const isValidConversionMap = conversionMap => { |
299 const isObject = typeof conversionMap === 'object'; |
215 const isObject = typeof conversionMap === 'object'; |
300 const values = isObject && Object.values(conversionMap); |
216 const values = isObject && Object.values(conversionMap); |
301 return isObject && values.length && values.every(element => Object(external_React_["isValidElement"])(element)); |
217 return isObject && values.length && values.every(element => (0,external_React_namespaceObject.isValidElement)(element)); |
302 }; |
218 }; |
303 /** |
219 /** |
304 * This is the iterator over the matches in the string. |
220 * This is the iterator over the matches in the string. |
305 * |
221 * |
306 * @private |
222 * @private |
342 } |
258 } |
343 |
259 |
344 output.push(conversionMap[name]); |
260 output.push(conversionMap[name]); |
345 offset = startOffset + tokenLength; |
261 offset = startOffset + tokenLength; |
346 return true; |
262 return true; |
347 } // otherwise we found an inner element |
263 } // Otherwise we found an inner element. |
348 |
264 |
349 |
265 |
350 addChild(createFrame(conversionMap[name], startOffset, tokenLength)); |
266 addChild(createFrame(conversionMap[name], startOffset, tokenLength)); |
351 offset = startOffset + tokenLength; |
267 offset = startOffset + tokenLength; |
352 return true; |
268 return true; |
355 stack.push(createFrame(conversionMap[name], startOffset, tokenLength, startOffset + tokenLength, leadingTextStart)); |
271 stack.push(createFrame(conversionMap[name], startOffset, tokenLength, startOffset + tokenLength, leadingTextStart)); |
356 offset = startOffset + tokenLength; |
272 offset = startOffset + tokenLength; |
357 return true; |
273 return true; |
358 |
274 |
359 case 'closer': |
275 case 'closer': |
360 // if we're not nesting then this is easy - close the block |
276 // If we're not nesting then this is easy - close the block. |
361 if (1 === stackDepth) { |
277 if (1 === stackDepth) { |
362 closeOuterElement(startOffset); |
278 closeOuterElement(startOffset); |
363 offset = startOffset + tokenLength; |
279 offset = startOffset + tokenLength; |
364 return true; |
280 return true; |
365 } // otherwise we're nested and we have to close out the current |
281 } // Otherwise we're nested and we have to close out the current |
366 // block and add it as a innerBlock to the parent |
282 // block and add it as a innerBlock to the parent. |
367 |
283 |
368 |
284 |
369 const stackTop = stack.pop(); |
285 const stackTop = stack.pop(); |
370 const text = indoc.substr(stackTop.prevOffset, startOffset - stackTop.prevOffset); |
286 const text = indoc.substr(stackTop.prevOffset, startOffset - stackTop.prevOffset); |
371 stackTop.children.push(text); |
287 stackTop.children.push(text); |
389 * @return {Array} An array of details for the token matched. |
305 * @return {Array} An array of details for the token matched. |
390 */ |
306 */ |
391 |
307 |
392 |
308 |
393 function nextToken() { |
309 function nextToken() { |
394 const matches = tokenizer.exec(indoc); // we have no more tokens |
310 const matches = tokenizer.exec(indoc); // We have no more tokens. |
395 |
311 |
396 if (null === matches) { |
312 if (null === matches) { |
397 return ['no-more-tokens']; |
313 return ['no-more-tokens']; |
398 } |
314 } |
399 |
315 |
433 * Pushes a child element to the associated parent element's children for the |
349 * Pushes a child element to the associated parent element's children for the |
434 * parent currently active in the stack. |
350 * parent currently active in the stack. |
435 * |
351 * |
436 * @private |
352 * @private |
437 * |
353 * |
438 * @param {Frame} frame The Frame containing the child element and it's |
354 * @param {Frame} frame The Frame containing the child element and it's |
439 * token information. |
355 * token information. |
440 */ |
356 */ |
441 |
357 |
442 |
358 |
443 function addChild(frame) { |
359 function addChild(frame) { |
444 const { |
360 const { |
453 |
369 |
454 if (text) { |
370 if (text) { |
455 parent.children.push(text); |
371 parent.children.push(text); |
456 } |
372 } |
457 |
373 |
458 parent.children.push(Object(external_React_["cloneElement"])(element, null, ...children)); |
374 parent.children.push((0,external_React_namespaceObject.cloneElement)(element, null, ...children)); |
459 parent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength; |
375 parent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength; |
460 } |
376 } |
461 /** |
377 /** |
462 * This is called for closing tags. It creates the element currently active in |
378 * This is called for closing tags. It creates the element currently active in |
463 * the stack. |
379 * the stack. |
488 |
404 |
489 if (null !== leadingTextStart) { |
405 if (null !== leadingTextStart) { |
490 output.push(indoc.substr(leadingTextStart, tokenStart - leadingTextStart)); |
406 output.push(indoc.substr(leadingTextStart, tokenStart - leadingTextStart)); |
491 } |
407 } |
492 |
408 |
493 output.push(Object(external_React_["cloneElement"])(element, null, ...children)); |
409 output.push((0,external_React_namespaceObject.cloneElement)(element, null, ...children)); |
494 } |
410 } |
495 |
411 |
496 /* harmony default export */ var create_interpolate_element = (createInterpolateElement); |
412 /* harmony default export */ var create_interpolate_element = (createInterpolateElement); |
497 |
413 |
498 // EXTERNAL MODULE: external "lodash" |
414 ;// CONCATENATED MODULE: external "lodash" |
499 var external_lodash_ = __webpack_require__("YLtl"); |
415 var external_lodash_namespaceObject = window["lodash"]; |
500 |
416 ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react.js |
501 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react.js |
|
502 /** |
417 /** |
503 * External dependencies |
418 * External dependencies |
504 */ |
419 */ |
505 // eslint-disable-next-line no-restricted-imports |
420 // eslint-disable-next-line @typescript-eslint/no-restricted-imports |
506 |
421 |
507 |
422 |
508 /** |
423 /** |
509 * Object containing a React element. |
424 * Object containing a React element. |
510 * |
425 * |
678 * @param {...?Object} childrenArguments Array of children arguments (array of arrays/strings/objects) to concatenate. |
593 * @param {...?Object} childrenArguments Array of children arguments (array of arrays/strings/objects) to concatenate. |
679 * |
594 * |
680 * @return {Array} The concatenated value. |
595 * @return {Array} The concatenated value. |
681 */ |
596 */ |
682 |
597 |
683 function concatChildren(...childrenArguments) { |
598 function concatChildren() { |
599 for (var _len = arguments.length, childrenArguments = new Array(_len), _key = 0; _key < _len; _key++) { |
|
600 childrenArguments[_key] = arguments[_key]; |
|
601 } |
|
602 |
|
684 return childrenArguments.reduce((accumulator, children, i) => { |
603 return childrenArguments.reduce((accumulator, children, i) => { |
685 external_React_["Children"].forEach(children, (child, j) => { |
604 external_React_namespaceObject.Children.forEach(children, (child, j) => { |
686 if (child && 'string' !== typeof child) { |
605 if (child && 'string' !== typeof child) { |
687 child = Object(external_React_["cloneElement"])(child, { |
606 child = (0,external_React_namespaceObject.cloneElement)(child, { |
688 key: [i, j].join() |
607 key: [i, j].join() |
689 }); |
608 }); |
690 } |
609 } |
691 |
610 |
692 accumulator.push(child); |
611 accumulator.push(child); |
702 * |
621 * |
703 * @return {?Object} The updated children object. |
622 * @return {?Object} The updated children object. |
704 */ |
623 */ |
705 |
624 |
706 function switchChildrenNodeName(children, nodeName) { |
625 function switchChildrenNodeName(children, nodeName) { |
707 return children && external_React_["Children"].map(children, (elt, index) => { |
626 return children && external_React_namespaceObject.Children.map(children, (elt, index) => { |
708 if (Object(external_lodash_["isString"])(elt)) { |
627 if ((0,external_lodash_namespaceObject.isString)(elt)) { |
709 return Object(external_React_["createElement"])(nodeName, { |
628 return (0,external_React_namespaceObject.createElement)(nodeName, { |
710 key: index |
629 key: index |
711 }, elt); |
630 }, elt); |
712 } |
631 } |
713 |
632 |
714 const { |
633 const { |
715 children: childrenProp, |
634 children: childrenProp, |
716 ...props |
635 ...props |
717 } = elt.props; |
636 } = elt.props; |
718 return Object(external_React_["createElement"])(nodeName, { |
637 return (0,external_React_namespaceObject.createElement)(nodeName, { |
719 key: index, |
638 key: index, |
720 ...props |
639 ...props |
721 }, childrenProp); |
640 }, childrenProp); |
722 }); |
641 }); |
723 } |
642 } |
724 |
643 |
725 // EXTERNAL MODULE: external "ReactDOM" |
644 ;// CONCATENATED MODULE: external "ReactDOM" |
726 var external_ReactDOM_ = __webpack_require__("faye"); |
645 var external_ReactDOM_namespaceObject = window["ReactDOM"]; |
727 |
646 ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react-platform.js |
728 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react-platform.js |
|
729 /** |
647 /** |
730 * External dependencies |
648 * External dependencies |
731 */ |
649 */ |
732 |
650 |
733 /** |
651 /** |
734 * Creates a portal into which a component can be rendered. |
652 * Creates a portal into which a component can be rendered. |
735 * |
653 * |
736 * @see https://github.com/facebook/react/issues/10309#issuecomment-318433235 |
654 * @see https://github.com/facebook/react/issues/10309#issuecomment-318433235 |
737 * |
655 * |
738 * @param {import('./react').WPElement} child Any renderable child, such as an element, |
656 * @param {import('./react').WPElement} child Any renderable child, such as an element, |
739 * string, or fragment. |
657 * string, or fragment. |
740 * @param {HTMLElement} container DOM node into which element should be rendered. |
658 * @param {HTMLElement} container DOM node into which element should be rendered. |
741 */ |
659 */ |
742 |
660 |
743 |
661 |
744 /** |
662 /** |
745 * Finds the dom node of a React component. |
663 * Finds the dom node of a React component. |
749 |
667 |
750 |
668 |
751 /** |
669 /** |
752 * Renders a given element into the target DOM node. |
670 * Renders a given element into the target DOM node. |
753 * |
671 * |
754 * @param {import('./react').WPElement} element Element to render. |
672 * @param {import('./react').WPElement} element Element to render. |
755 * @param {HTMLElement} target DOM node into which element should be rendered. |
673 * @param {HTMLElement} target DOM node into which element should be rendered. |
756 */ |
674 */ |
757 |
675 |
758 |
676 |
759 /** |
677 /** |
760 * Removes any mounted element from the target DOM node. |
678 * Removes any mounted element from the target DOM node. |
762 * @param {Element} target DOM node in which element is to be removed |
680 * @param {Element} target DOM node in which element is to be removed |
763 */ |
681 */ |
764 |
682 |
765 |
683 |
766 |
684 |
767 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/utils.js |
685 ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/utils.js |
768 /** |
686 /** |
769 * External dependencies |
687 * External dependencies |
770 */ |
688 */ |
771 |
689 |
772 /** |
690 /** |
775 * @param {*} element WP element to check. |
693 * @param {*} element WP element to check. |
776 * @return {boolean} True when an element is considered empty. |
694 * @return {boolean} True when an element is considered empty. |
777 */ |
695 */ |
778 |
696 |
779 const isEmptyElement = element => { |
697 const isEmptyElement = element => { |
780 if (Object(external_lodash_["isNumber"])(element)) { |
698 if ((0,external_lodash_namespaceObject.isNumber)(element)) { |
781 return false; |
699 return false; |
782 } |
700 } |
783 |
701 |
784 if (Object(external_lodash_["isString"])(element) || Object(external_lodash_["isArray"])(element)) { |
702 if ((0,external_lodash_namespaceObject.isString)(element) || (0,external_lodash_namespaceObject.isArray)(element)) { |
785 return !element.length; |
703 return !element.length; |
786 } |
704 } |
787 |
705 |
788 return !element; |
706 return !element; |
789 }; |
707 }; |
790 |
708 |
791 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/platform.js |
709 ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/platform.js |
792 /** |
710 /** |
793 * Parts of this source were derived and modified from react-native-web, |
711 * Parts of this source were derived and modified from react-native-web, |
794 * released under the MIT license. |
712 * released under the MIT license. |
795 * |
713 * |
796 * Copyright (c) 2016-present, Nicolas Gallagher. |
714 * Copyright (c) 2016-present, Nicolas Gallagher. |
797 * Copyright (c) 2015-present, Facebook, Inc. |
715 * Copyright (c) 2015-present, Facebook, Inc. |
798 * |
716 * |
799 */ |
717 */ |
800 const Platform = { |
718 const Platform = { |
801 OS: 'web', |
719 OS: 'web', |
802 select: spec => 'web' in spec ? spec.web : spec.default |
720 select: spec => 'web' in spec ? spec.web : spec.default, |
721 isWeb: true |
|
803 }; |
722 }; |
804 /** |
723 /** |
805 * Component used to detect the current Platform being used. |
724 * Component used to detect the current Platform being used. |
806 * Use Platform.OS === 'web' to detect if running on web enviroment. |
725 * Use Platform.OS === 'web' to detect if running on web enviroment. |
807 * |
726 * |
821 * ``` |
740 * ``` |
822 */ |
741 */ |
823 |
742 |
824 /* harmony default export */ var platform = (Platform); |
743 /* harmony default export */ var platform = (Platform); |
825 |
744 |
826 // EXTERNAL MODULE: external ["wp","escapeHtml"] |
745 ;// CONCATENATED MODULE: external ["wp","escapeHtml"] |
827 var external_wp_escapeHtml_ = __webpack_require__("Vx3V"); |
746 var external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"]; |
828 |
747 ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/raw-html.js |
829 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/raw-html.js |
|
830 /** |
748 /** |
831 * Internal dependencies |
749 * Internal dependencies |
832 */ |
750 */ |
833 // Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly. |
751 // Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly. |
834 |
752 |
838 * Component used as equivalent of Fragment with unescaped HTML, in cases where |
756 * Component used as equivalent of Fragment with unescaped HTML, in cases where |
839 * it is desirable to render dangerous HTML without needing a wrapper element. |
757 * it is desirable to render dangerous HTML without needing a wrapper element. |
840 * To preserve additional props, a `div` wrapper _will_ be created if any props |
758 * To preserve additional props, a `div` wrapper _will_ be created if any props |
841 * aside from `children` are passed. |
759 * aside from `children` are passed. |
842 * |
760 * |
843 * @param {RawHTMLProps} props Children should be a string of HTML. Other props |
761 * @param {RawHTMLProps} props Children should be a string of HTML or an array |
844 * will be passed through to div wrapper. |
762 * of strings. Other props will be passed through |
763 * to the div wrapper. |
|
845 * |
764 * |
846 * @return {JSX.Element} Dangerously-rendering component. |
765 * @return {JSX.Element} Dangerously-rendering component. |
847 */ |
766 */ |
848 |
767 |
849 function RawHTML({ |
768 function RawHTML(_ref) { |
850 children, |
769 let { |
851 ...props |
770 children, |
852 }) { |
771 ...props |
853 // The DIV wrapper will be stripped by serializer, unless there are |
772 } = _ref; |
854 // non-children props present. |
773 let rawHtml = ''; // Cast children as an array, and concatenate each element if it is a string. |
855 return Object(external_React_["createElement"])('div', { |
774 |
775 external_React_namespaceObject.Children.toArray(children).forEach(child => { |
|
776 if (typeof child === 'string' && child.trim() !== '') { |
|
777 rawHtml += child; |
|
778 } |
|
779 }); // The `div` wrapper will be stripped by the `renderElement` serializer in |
|
780 // `./serialize.js` unless there are non-children props present. |
|
781 |
|
782 return (0,external_React_namespaceObject.createElement)('div', { |
|
856 dangerouslySetInnerHTML: { |
783 dangerouslySetInnerHTML: { |
857 __html: children |
784 __html: rawHtml |
858 }, |
785 }, |
859 ...props |
786 ...props |
860 }); |
787 }); |
861 } |
788 } |
862 |
789 |
863 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/serialize.js |
790 ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/serialize.js |
864 /** |
791 /** |
865 * Parts of this source were derived and modified from fast-react-render, |
792 * Parts of this source were derived and modified from fast-react-render, |
866 * released under the MIT license. |
793 * released under the MIT license. |
867 * |
794 * |
868 * https://github.com/alt-j/fast-react-render |
795 * https://github.com/alt-j/fast-react-render |
906 /** @typedef {import('./react').WPElement} WPElement */ |
833 /** @typedef {import('./react').WPElement} WPElement */ |
907 |
834 |
908 const { |
835 const { |
909 Provider, |
836 Provider, |
910 Consumer |
837 Consumer |
911 } = Object(external_React_["createContext"])(undefined); |
838 } = (0,external_React_namespaceObject.createContext)(undefined); |
912 const ForwardRef = Object(external_React_["forwardRef"])(() => { |
839 const ForwardRef = (0,external_React_namespaceObject.forwardRef)(() => { |
913 return null; |
840 return null; |
914 }); |
841 }); |
915 /** |
842 /** |
916 * Valid attribute types. |
843 * Valid attribute types. |
917 * |
844 * |
1027 } |
954 } |
1028 |
955 |
1029 return value; |
956 return value; |
1030 } |
957 } |
1031 /** |
958 /** |
959 * This is a map of all SVG attributes that have dashes. Map(lower case prop => dashed lower case attribute). |
|
960 * We need this to render e.g strokeWidth as stroke-width. |
|
961 * |
|
962 * List from: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute. |
|
963 */ |
|
964 |
|
965 |
|
966 const SVG_ATTRIBUTE_WITH_DASHES_LIST = ['accentHeight', 'alignmentBaseline', 'arabicForm', 'baselineShift', 'capHeight', 'clipPath', 'clipRule', 'colorInterpolation', 'colorInterpolationFilters', 'colorProfile', 'colorRendering', 'dominantBaseline', 'enableBackground', 'fillOpacity', 'fillRule', 'floodColor', 'floodOpacity', 'fontFamily', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontWeight', 'glyphName', 'glyphOrientationHorizontal', 'glyphOrientationVertical', 'horizAdvX', 'horizOriginX', 'imageRendering', 'letterSpacing', 'lightingColor', 'markerEnd', 'markerMid', 'markerStart', 'overlinePosition', 'overlineThickness', 'paintOrder', 'panose1', 'pointerEvents', 'renderingIntent', 'shapeRendering', 'stopColor', 'stopOpacity', 'strikethroughPosition', 'strikethroughThickness', 'strokeDasharray', 'strokeDashoffset', 'strokeLinecap', 'strokeLinejoin', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'textAnchor', 'textDecoration', 'textRendering', 'underlinePosition', 'underlineThickness', 'unicodeBidi', 'unicodeRange', 'unitsPerEm', 'vAlphabetic', 'vHanging', 'vIdeographic', 'vMathematical', 'vectorEffect', 'vertAdvY', 'vertOriginX', 'vertOriginY', 'wordSpacing', 'writingMode', 'xmlnsXlink', 'xHeight'].reduce((map, attribute) => { |
|
967 // The keys are lower-cased for more robust lookup. |
|
968 map[attribute.toLowerCase()] = attribute; |
|
969 return map; |
|
970 }, {}); |
|
971 /** |
|
972 * This is a map of all case-sensitive SVG attributes. Map(lowercase key => proper case attribute). |
|
973 * The keys are lower-cased for more robust lookup. |
|
974 * Note that this list only contains attributes that contain at least one capital letter. |
|
975 * Lowercase attributes don't need mapping, since we lowercase all attributes by default. |
|
976 */ |
|
977 |
|
978 const CASE_SENSITIVE_SVG_ATTRIBUTES = ['allowReorder', 'attributeName', 'attributeType', 'autoReverse', 'baseFrequency', 'baseProfile', 'calcMode', 'clipPathUnits', 'contentScriptType', 'contentStyleType', 'diffuseConstant', 'edgeMode', 'externalResourcesRequired', 'filterRes', 'filterUnits', 'glyphRef', 'gradientTransform', 'gradientUnits', 'kernelMatrix', 'kernelUnitLength', 'keyPoints', 'keySplines', 'keyTimes', 'lengthAdjust', 'limitingConeAngle', 'markerHeight', 'markerUnits', 'markerWidth', 'maskContentUnits', 'maskUnits', 'numOctaves', 'pathLength', 'patternContentUnits', 'patternTransform', 'patternUnits', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'preserveAlpha', 'preserveAspectRatio', 'primitiveUnits', 'refX', 'refY', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'specularConstant', 'specularExponent', 'spreadMethod', 'startOffset', 'stdDeviation', 'stitchTiles', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'surfaceScale', 'systemLanguage', 'tableValues', 'targetX', 'targetY', 'textLength', 'viewBox', 'viewTarget', 'xChannelSelector', 'yChannelSelector'].reduce((map, attribute) => { |
|
979 // The keys are lower-cased for more robust lookup. |
|
980 map[attribute.toLowerCase()] = attribute; |
|
981 return map; |
|
982 }, {}); |
|
983 /** |
|
984 * This is a map of all SVG attributes that have colons. |
|
985 * Keys are lower-cased and stripped of their colons for more robust lookup. |
|
986 */ |
|
987 |
|
988 const SVG_ATTRIBUTES_WITH_COLONS = ['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'xmlns:xlink'].reduce((map, attribute) => { |
|
989 map[attribute.replace(':', '').toLowerCase()] = attribute; |
|
990 return map; |
|
991 }, {}); |
|
992 /** |
|
1032 * Returns the normal form of the element's attribute name for HTML. |
993 * Returns the normal form of the element's attribute name for HTML. |
1033 * |
994 * |
1034 * @param {string} attribute Non-normalized attribute name. |
995 * @param {string} attribute Non-normalized attribute name. |
1035 * |
996 * |
1036 * @return {string} Normalized attribute name. |
997 * @return {string} Normalized attribute name. |
1037 */ |
998 */ |
1038 |
|
1039 |
999 |
1040 function getNormalAttributeName(attribute) { |
1000 function getNormalAttributeName(attribute) { |
1041 switch (attribute) { |
1001 switch (attribute) { |
1042 case 'htmlFor': |
1002 case 'htmlFor': |
1043 return 'for'; |
1003 return 'for'; |
1044 |
1004 |
1045 case 'className': |
1005 case 'className': |
1046 return 'class'; |
1006 return 'class'; |
1047 } |
1007 } |
1048 |
1008 |
1049 return attribute.toLowerCase(); |
1009 const attributeLowerCase = attribute.toLowerCase(); |
1010 |
|
1011 if (CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase]) { |
|
1012 return CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase]; |
|
1013 } else if (SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase]) { |
|
1014 return (0,external_lodash_namespaceObject.kebabCase)(SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase]); |
|
1015 } else if (SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase]) { |
|
1016 return SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase]; |
|
1017 } |
|
1018 |
|
1019 return attributeLowerCase; |
|
1050 } |
1020 } |
1051 /** |
1021 /** |
1052 * Returns the normal form of the style property name for HTML. |
1022 * Returns the normal form of the style property name for HTML. |
1053 * |
1023 * |
1054 * - Converts property names to kebab-case, e.g. 'backgroundColor' → 'background-color' |
1024 * - Converts property names to kebab-case, e.g. 'backgroundColor' → 'background-color' |
1060 * @return {string} Normalized property name. |
1030 * @return {string} Normalized property name. |
1061 */ |
1031 */ |
1062 |
1032 |
1063 |
1033 |
1064 function getNormalStylePropertyName(property) { |
1034 function getNormalStylePropertyName(property) { |
1065 if (Object(external_lodash_["startsWith"])(property, '--')) { |
1035 if ((0,external_lodash_namespaceObject.startsWith)(property, '--')) { |
1066 return property; |
1036 return property; |
1067 } |
1037 } |
1068 |
1038 |
1069 if (hasPrefix(property, ['ms', 'O', 'Moz', 'Webkit'])) { |
1039 if (hasPrefix(property, ['ms', 'O', 'Moz', 'Webkit'])) { |
1070 return '-' + Object(external_lodash_["kebabCase"])(property); |
1040 return '-' + (0,external_lodash_namespaceObject.kebabCase)(property); |
1071 } |
1041 } |
1072 |
1042 |
1073 return Object(external_lodash_["kebabCase"])(property); |
1043 return (0,external_lodash_namespaceObject.kebabCase)(property); |
1074 } |
1044 } |
1075 /** |
1045 /** |
1076 * Returns the normal form of the style property value for HTML. Appends a |
1046 * Returns the normal form of the style property value for HTML. Appends a |
1077 * default pixel unit if numeric, not a unitless property, and not zero. |
1047 * default pixel unit if numeric, not a unitless property, and not zero. |
1078 * |
1048 * |
1099 * |
1069 * |
1100 * @return {string} Serialized element. |
1070 * @return {string} Serialized element. |
1101 */ |
1071 */ |
1102 |
1072 |
1103 |
1073 |
1104 function renderElement(element, context, legacyContext = {}) { |
1074 function renderElement(element, context) { |
1075 let legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
|
1076 |
|
1105 if (null === element || undefined === element || false === element) { |
1077 if (null === element || undefined === element || false === element) { |
1106 return ''; |
1078 return ''; |
1107 } |
1079 } |
1108 |
1080 |
1109 if (Array.isArray(element)) { |
1081 if (Array.isArray(element)) { |
1110 return renderChildren(element, context, legacyContext); |
1082 return renderChildren(element, context, legacyContext); |
1111 } |
1083 } |
1112 |
1084 |
1113 switch (typeof element) { |
1085 switch (typeof element) { |
1114 case 'string': |
1086 case 'string': |
1115 return Object(external_wp_escapeHtml_["escapeHTML"])(element); |
1087 return (0,external_wp_escapeHtml_namespaceObject.escapeHTML)(element); |
1116 |
1088 |
1117 case 'number': |
1089 case 'number': |
1118 return element.toString(); |
1090 return element.toString(); |
1119 } |
1091 } |
1120 |
1092 |
1124 } = |
1096 } = |
1125 /** @type {{type?: any, props?: any}} */ |
1097 /** @type {{type?: any, props?: any}} */ |
1126 element; |
1098 element; |
1127 |
1099 |
1128 switch (type) { |
1100 switch (type) { |
1129 case external_React_["StrictMode"]: |
1101 case external_React_namespaceObject.StrictMode: |
1130 case external_React_["Fragment"]: |
1102 case external_React_namespaceObject.Fragment: |
1131 return renderChildren(props.children, context, legacyContext); |
1103 return renderChildren(props.children, context, legacyContext); |
1132 |
1104 |
1133 case RawHTML: |
1105 case RawHTML: |
1134 const { |
1106 const { |
1135 children, |
1107 children, |
1136 ...wrapperProps |
1108 ...wrapperProps |
1137 } = props; |
1109 } = props; |
1138 return renderNativeComponent(Object(external_lodash_["isEmpty"])(wrapperProps) ? null : 'div', { ...wrapperProps, |
1110 return renderNativeComponent((0,external_lodash_namespaceObject.isEmpty)(wrapperProps) ? null : 'div', { ...wrapperProps, |
1139 dangerouslySetInnerHTML: { |
1111 dangerouslySetInnerHTML: { |
1140 __html: children |
1112 __html: children |
1141 } |
1113 } |
1142 }, context, legacyContext); |
1114 }, context, legacyContext); |
1143 } |
1115 } |
1177 * @param {Object} [legacyContext] Legacy context object. |
1149 * @param {Object} [legacyContext] Legacy context object. |
1178 * |
1150 * |
1179 * @return {string} Serialized element. |
1151 * @return {string} Serialized element. |
1180 */ |
1152 */ |
1181 |
1153 |
1182 function renderNativeComponent(type, props, context, legacyContext = {}) { |
1154 function renderNativeComponent(type, props, context) { |
1155 let legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; |
|
1183 let content = ''; |
1156 let content = ''; |
1184 |
1157 |
1185 if (type === 'textarea' && props.hasOwnProperty('value')) { |
1158 if (type === 'textarea' && props.hasOwnProperty('value')) { |
1186 // Textarea children can be assigned as value prop. If it is, render in |
1159 // Textarea children can be assigned as value prop. If it is, render in |
1187 // place of children. Ensure to omit so it is not assigned as attribute |
1160 // place of children. Ensure to omit so it is not assigned as attribute |
1188 // as well. |
1161 // as well. |
1189 content = renderChildren(props.value, context, legacyContext); |
1162 content = renderChildren(props.value, context, legacyContext); |
1190 props = Object(external_lodash_["omit"])(props, 'value'); |
1163 props = (0,external_lodash_namespaceObject.omit)(props, 'value'); |
1191 } else if (props.dangerouslySetInnerHTML && typeof props.dangerouslySetInnerHTML.__html === 'string') { |
1164 } else if (props.dangerouslySetInnerHTML && typeof props.dangerouslySetInnerHTML.__html === 'string') { |
1192 // Dangerous content is left unescaped. |
1165 // Dangerous content is left unescaped. |
1193 content = props.dangerouslySetInnerHTML.__html; |
1166 content = props.dangerouslySetInnerHTML.__html; |
1194 } else if (typeof props.children !== 'undefined') { |
1167 } else if (typeof props.children !== 'undefined') { |
1195 content = renderChildren(props.children, context, legacyContext); |
1168 content = renderChildren(props.children, context, legacyContext); |
1218 * @param {Object} [legacyContext] Legacy context object. |
1191 * @param {Object} [legacyContext] Legacy context object. |
1219 * |
1192 * |
1220 * @return {string} Serialized element |
1193 * @return {string} Serialized element |
1221 */ |
1194 */ |
1222 |
1195 |
1223 function renderComponent(Component, props, context, legacyContext = {}) { |
1196 function renderComponent(Component, props, context) { |
1197 let legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; |
|
1224 const instance = new |
1198 const instance = new |
1225 /** @type {import('react').ComponentClass} */ |
1199 /** @type {import('react').ComponentClass} */ |
1226 Component(props, legacyContext); |
1200 Component(props, legacyContext); |
1227 |
1201 |
1228 if (typeof // Ignore reason: Current prettier reformats parens and mangles type assertion |
1202 if (typeof // Ignore reason: Current prettier reformats parens and mangles type assertion |
1246 * @param {Object} [legacyContext] Legacy context object. |
1220 * @param {Object} [legacyContext] Legacy context object. |
1247 * |
1221 * |
1248 * @return {string} Serialized children. |
1222 * @return {string} Serialized children. |
1249 */ |
1223 */ |
1250 |
1224 |
1251 function renderChildren(children, context, legacyContext = {}) { |
1225 function renderChildren(children, context) { |
1226 let legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
|
1252 let result = ''; |
1227 let result = ''; |
1253 children = Object(external_lodash_["castArray"])(children); |
1228 children = (0,external_lodash_namespaceObject.castArray)(children); |
1254 |
1229 |
1255 for (let i = 0; i < children.length; i++) { |
1230 for (let i = 0; i < children.length; i++) { |
1256 const child = children[i]; |
1231 const child = children[i]; |
1257 result += renderElement(child, context, legacyContext); |
1232 result += renderElement(child, context, legacyContext); |
1258 } |
1233 } |
1272 let result = ''; |
1247 let result = ''; |
1273 |
1248 |
1274 for (const key in props) { |
1249 for (const key in props) { |
1275 const attribute = getNormalAttributeName(key); |
1250 const attribute = getNormalAttributeName(key); |
1276 |
1251 |
1277 if (!Object(external_wp_escapeHtml_["isValidAttributeName"])(attribute)) { |
1252 if (!(0,external_wp_escapeHtml_namespaceObject.isValidAttributeName)(attribute)) { |
1278 continue; |
1253 continue; |
1279 } |
1254 } |
1280 |
1255 |
1281 let value = getNormalAttributeValue(key, props[key]); // If value is not of serializeable type, skip. |
1256 let value = getNormalAttributeValue(key, props[key]); // If value is not of serializeable type, skip. |
1282 |
1257 |
1307 if (isBooleanAttribute) { |
1282 if (isBooleanAttribute) { |
1308 continue; |
1283 continue; |
1309 } |
1284 } |
1310 |
1285 |
1311 if (typeof value === 'string') { |
1286 if (typeof value === 'string') { |
1312 value = Object(external_wp_escapeHtml_["escapeAttribute"])(value); |
1287 value = (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(value); |
1313 } |
1288 } |
1314 |
1289 |
1315 result += '="' + value + '"'; |
1290 result += '="' + value + '"'; |
1316 } |
1291 } |
1317 |
1292 |
1325 * @return {string} Style attribute value. |
1300 * @return {string} Style attribute value. |
1326 */ |
1301 */ |
1327 |
1302 |
1328 function renderStyle(style) { |
1303 function renderStyle(style) { |
1329 // Only generate from object, e.g. tolerate string value. |
1304 // Only generate from object, e.g. tolerate string value. |
1330 if (!Object(external_lodash_["isPlainObject"])(style)) { |
1305 if (!(0,external_lodash_namespaceObject.isPlainObject)(style)) { |
1331 return style; |
1306 return style; |
1332 } |
1307 } |
1333 |
1308 |
1334 let result; |
1309 let result; |
1335 |
1310 |
1353 |
1328 |
1354 return result; |
1329 return result; |
1355 } |
1330 } |
1356 /* harmony default export */ var serialize = (renderElement); |
1331 /* harmony default export */ var serialize = (renderElement); |
1357 |
1332 |
1358 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/index.js |
1333 ;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/index.js |
1359 |
1334 |
1360 |
1335 |
1361 |
1336 |
1362 |
1337 |
1363 |
1338 |
1364 |
1339 |
1365 |
1340 |
1366 |
1341 |
1367 |
1342 (window.wp = window.wp || {}).element = __webpack_exports__; |
1368 /***/ }) |
1343 /******/ })() |
1369 |
1344 ; |
1370 /******/ }); |