|
1 this["wp"] = this["wp"] || {}; this["wp"]["element"] = |
|
2 /******/ (function(modules) { // webpackBootstrap |
|
3 /******/ // The module cache |
|
4 /******/ var installedModules = {}; |
|
5 /******/ |
|
6 /******/ // The require function |
|
7 /******/ function __webpack_require__(moduleId) { |
|
8 /******/ |
|
9 /******/ // Check if module is in cache |
|
10 /******/ if(installedModules[moduleId]) { |
|
11 /******/ return installedModules[moduleId].exports; |
|
12 /******/ } |
|
13 /******/ // Create a new module (and put it into the cache) |
|
14 /******/ var module = installedModules[moduleId] = { |
|
15 /******/ i: moduleId, |
|
16 /******/ l: false, |
|
17 /******/ exports: {} |
|
18 /******/ }; |
|
19 /******/ |
|
20 /******/ // Execute the module function |
|
21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
|
22 /******/ |
|
23 /******/ // Flag the module as loaded |
|
24 /******/ module.l = true; |
|
25 /******/ |
|
26 /******/ // Return the exports of the module |
|
27 /******/ return module.exports; |
|
28 /******/ } |
|
29 /******/ |
|
30 /******/ |
|
31 /******/ // expose the modules object (__webpack_modules__) |
|
32 /******/ __webpack_require__.m = modules; |
|
33 /******/ |
|
34 /******/ // expose the module cache |
|
35 /******/ __webpack_require__.c = installedModules; |
|
36 /******/ |
|
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 = 374); |
|
86 /******/ }) |
|
87 /************************************************************************/ |
|
88 /******/ ({ |
|
89 |
|
90 /***/ 15: |
|
91 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
92 |
|
93 "use strict"; |
|
94 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); |
|
95 function _defineProperty(obj, key, value) { |
|
96 if (key in obj) { |
|
97 Object.defineProperty(obj, key, { |
|
98 value: value, |
|
99 enumerable: true, |
|
100 configurable: true, |
|
101 writable: true |
|
102 }); |
|
103 } else { |
|
104 obj[key] = value; |
|
105 } |
|
106 |
|
107 return obj; |
|
108 } |
|
109 |
|
110 /***/ }), |
|
111 |
|
112 /***/ 2: |
|
113 /***/ (function(module, exports) { |
|
114 |
|
115 (function() { module.exports = this["lodash"]; }()); |
|
116 |
|
117 /***/ }), |
|
118 |
|
119 /***/ 21: |
|
120 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
121 |
|
122 "use strict"; |
|
123 |
|
124 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js |
|
125 function _objectWithoutPropertiesLoose(source, excluded) { |
|
126 if (source == null) return {}; |
|
127 var target = {}; |
|
128 var sourceKeys = Object.keys(source); |
|
129 var key, i; |
|
130 |
|
131 for (i = 0; i < sourceKeys.length; i++) { |
|
132 key = sourceKeys[i]; |
|
133 if (excluded.indexOf(key) >= 0) continue; |
|
134 target[key] = source[key]; |
|
135 } |
|
136 |
|
137 return target; |
|
138 } |
|
139 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js |
|
140 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); |
|
141 |
|
142 function _objectWithoutProperties(source, excluded) { |
|
143 if (source == null) return {}; |
|
144 var target = _objectWithoutPropertiesLoose(source, excluded); |
|
145 var key, i; |
|
146 |
|
147 if (Object.getOwnPropertySymbols) { |
|
148 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); |
|
149 |
|
150 for (i = 0; i < sourceSymbolKeys.length; i++) { |
|
151 key = sourceSymbolKeys[i]; |
|
152 if (excluded.indexOf(key) >= 0) continue; |
|
153 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; |
|
154 target[key] = source[key]; |
|
155 } |
|
156 } |
|
157 |
|
158 return target; |
|
159 } |
|
160 |
|
161 /***/ }), |
|
162 |
|
163 /***/ 27: |
|
164 /***/ (function(module, exports) { |
|
165 |
|
166 (function() { module.exports = this["React"]; }()); |
|
167 |
|
168 /***/ }), |
|
169 |
|
170 /***/ 32: |
|
171 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
172 |
|
173 "use strict"; |
|
174 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); |
|
175 function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } |
|
176 |
|
177 function _typeof(obj) { |
|
178 if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { |
|
179 _typeof = function _typeof(obj) { |
|
180 return _typeof2(obj); |
|
181 }; |
|
182 } else { |
|
183 _typeof = function _typeof(obj) { |
|
184 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); |
|
185 }; |
|
186 } |
|
187 |
|
188 return _typeof(obj); |
|
189 } |
|
190 |
|
191 /***/ }), |
|
192 |
|
193 /***/ 374: |
|
194 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
195 |
|
196 "use strict"; |
|
197 __webpack_require__.r(__webpack_exports__); |
|
198 |
|
199 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js |
|
200 var objectSpread = __webpack_require__(7); |
|
201 |
|
202 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules |
|
203 var objectWithoutProperties = __webpack_require__(21); |
|
204 |
|
205 // EXTERNAL MODULE: external "React" |
|
206 var external_React_ = __webpack_require__(27); |
|
207 |
|
208 // EXTERNAL MODULE: external "lodash" |
|
209 var external_lodash_ = __webpack_require__(2); |
|
210 |
|
211 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react.js |
|
212 |
|
213 |
|
214 |
|
215 /** |
|
216 * External dependencies |
|
217 */ |
|
218 |
|
219 |
|
220 /** |
|
221 * Object that provides utilities for dealing with React children. |
|
222 */ |
|
223 |
|
224 |
|
225 /** |
|
226 * Creates a copy of an element with extended props. |
|
227 * |
|
228 * @param {WPElement} element Element |
|
229 * @param {?Object} props Props to apply to cloned element |
|
230 * |
|
231 * @return {WPElement} Cloned element. |
|
232 */ |
|
233 |
|
234 |
|
235 /** |
|
236 * A base class to create WordPress Components (Refs, state and lifecycle hooks) |
|
237 */ |
|
238 |
|
239 |
|
240 /** |
|
241 * Creates a context object containing two components: a provider and consumer. |
|
242 * |
|
243 * @param {Object} defaultValue A default data stored in the context. |
|
244 * |
|
245 * @return {Object} Context object. |
|
246 */ |
|
247 |
|
248 |
|
249 /** |
|
250 * Returns a new element of given type. Type can be either a string tag name or |
|
251 * another function which itself returns an element. |
|
252 * |
|
253 * @param {?(string|Function)} type Tag name or element creator |
|
254 * @param {Object} props Element properties, either attribute |
|
255 * set to apply to DOM node or values to |
|
256 * pass through to element creator |
|
257 * @param {...WPElement} children Descendant elements |
|
258 * |
|
259 * @return {WPElement} Element. |
|
260 */ |
|
261 |
|
262 |
|
263 /** |
|
264 * Returns an object tracking a reference to a rendered element via its |
|
265 * `current` property as either a DOMElement or Element, dependent upon the |
|
266 * type of element rendered with the ref attribute. |
|
267 * |
|
268 * @return {Object} Ref object. |
|
269 */ |
|
270 |
|
271 |
|
272 /** |
|
273 * Component enhancer used to enable passing a ref to its wrapped component. |
|
274 * Pass a function argument which receives `props` and `ref` as its arguments, |
|
275 * returning an element using the forwarded ref. The return value is a new |
|
276 * component which forwards its ref. |
|
277 * |
|
278 * @param {Function} forwarder Function passed `props` and `ref`, expected to |
|
279 * return an element. |
|
280 * |
|
281 * @return {WPComponent} Enhanced component. |
|
282 */ |
|
283 |
|
284 |
|
285 /** |
|
286 * A component which renders its children without any wrapping element. |
|
287 */ |
|
288 |
|
289 |
|
290 /** |
|
291 * Checks if an object is a valid WPElement |
|
292 * |
|
293 * @param {Object} objectToCheck The object to be checked. |
|
294 * |
|
295 * @return {boolean} true if objectToTest is a valid WPElement and false otherwise. |
|
296 */ |
|
297 |
|
298 |
|
299 /** |
|
300 * Component that activates additional checks and warnings for its descendants. |
|
301 */ |
|
302 |
|
303 |
|
304 /** |
|
305 * @see https://reactjs.org/docs/hooks-reference.html#usecallback |
|
306 */ |
|
307 |
|
308 |
|
309 /** |
|
310 * @see https://reactjs.org/docs/hooks-reference.html#usecontext |
|
311 */ |
|
312 |
|
313 |
|
314 /** |
|
315 * @see https://reactjs.org/docs/hooks-reference.html#usedebugvalue |
|
316 */ |
|
317 |
|
318 |
|
319 /** |
|
320 * @see https://reactjs.org/docs/hooks-reference.html#useeffect |
|
321 */ |
|
322 |
|
323 |
|
324 /** |
|
325 * @see https://reactjs.org/docs/hooks-reference.html#useimperativehandle |
|
326 */ |
|
327 |
|
328 |
|
329 /** |
|
330 * @see https://reactjs.org/docs/hooks-reference.html#uselayouteffect |
|
331 */ |
|
332 |
|
333 |
|
334 /** |
|
335 * @see https://reactjs.org/docs/hooks-reference.html#usememo |
|
336 */ |
|
337 |
|
338 |
|
339 /** |
|
340 * @see https://reactjs.org/docs/hooks-reference.html#usereducer |
|
341 */ |
|
342 |
|
343 |
|
344 /** |
|
345 * @see https://reactjs.org/docs/hooks-reference.html#useref |
|
346 */ |
|
347 |
|
348 |
|
349 /** |
|
350 * @see https://reactjs.org/docs/hooks-reference.html#usestate |
|
351 */ |
|
352 |
|
353 |
|
354 /** |
|
355 * Concatenate two or more React children objects. |
|
356 * |
|
357 * @param {...?Object} childrenArguments Array of children arguments (array of arrays/strings/objects) to concatenate. |
|
358 * |
|
359 * @return {Array} The concatenated value. |
|
360 */ |
|
361 |
|
362 function concatChildren() { |
|
363 for (var _len = arguments.length, childrenArguments = new Array(_len), _key = 0; _key < _len; _key++) { |
|
364 childrenArguments[_key] = arguments[_key]; |
|
365 } |
|
366 |
|
367 return childrenArguments.reduce(function (memo, children, i) { |
|
368 external_React_["Children"].forEach(children, function (child, j) { |
|
369 if (child && 'string' !== typeof child) { |
|
370 child = Object(external_React_["cloneElement"])(child, { |
|
371 key: [i, j].join() |
|
372 }); |
|
373 } |
|
374 |
|
375 memo.push(child); |
|
376 }); |
|
377 return memo; |
|
378 }, []); |
|
379 } |
|
380 /** |
|
381 * Switches the nodeName of all the elements in the children object. |
|
382 * |
|
383 * @param {?Object} children Children object. |
|
384 * @param {string} nodeName Node name. |
|
385 * |
|
386 * @return {?Object} The updated children object. |
|
387 */ |
|
388 |
|
389 function switchChildrenNodeName(children, nodeName) { |
|
390 return children && external_React_["Children"].map(children, function (elt, index) { |
|
391 if (Object(external_lodash_["isString"])(elt)) { |
|
392 return Object(external_React_["createElement"])(nodeName, { |
|
393 key: index |
|
394 }, elt); |
|
395 } |
|
396 |
|
397 var _elt$props = elt.props, |
|
398 childrenProp = _elt$props.children, |
|
399 props = Object(objectWithoutProperties["a" /* default */])(_elt$props, ["children"]); |
|
400 |
|
401 return Object(external_React_["createElement"])(nodeName, Object(objectSpread["a" /* default */])({ |
|
402 key: index |
|
403 }, props), childrenProp); |
|
404 }); |
|
405 } |
|
406 |
|
407 // EXTERNAL MODULE: external "ReactDOM" |
|
408 var external_ReactDOM_ = __webpack_require__(52); |
|
409 |
|
410 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react-platform.js |
|
411 /** |
|
412 * External dependencies |
|
413 */ |
|
414 |
|
415 /** |
|
416 * Creates a portal into which a component can be rendered. |
|
417 * |
|
418 * @see https://github.com/facebook/react/issues/10309#issuecomment-318433235 |
|
419 * |
|
420 * @param {Component} component Component |
|
421 * @param {Element} target DOM node into which element should be rendered |
|
422 */ |
|
423 |
|
424 |
|
425 /** |
|
426 * Finds the dom node of a React component |
|
427 * |
|
428 * @param {Component} component component's instance |
|
429 * @param {Element} target DOM node into which element should be rendered |
|
430 */ |
|
431 |
|
432 |
|
433 /** |
|
434 * Renders a given element into the target DOM node. |
|
435 * |
|
436 * @param {WPElement} element Element to render |
|
437 * @param {Element} target DOM node into which element should be rendered |
|
438 */ |
|
439 |
|
440 |
|
441 /** |
|
442 * Removes any mounted element from the target DOM node. |
|
443 * |
|
444 * @param {Element} target DOM node in which element is to be removed |
|
445 */ |
|
446 |
|
447 |
|
448 |
|
449 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/utils.js |
|
450 /** |
|
451 * External dependencies |
|
452 */ |
|
453 |
|
454 /** |
|
455 * Checks if the provided WP element is empty. |
|
456 * |
|
457 * @param {*} element WP element to check. |
|
458 * @return {boolean} True when an element is considered empty. |
|
459 */ |
|
460 |
|
461 var utils_isEmptyElement = function isEmptyElement(element) { |
|
462 if (Object(external_lodash_["isNumber"])(element)) { |
|
463 return false; |
|
464 } |
|
465 |
|
466 if (Object(external_lodash_["isString"])(element) || Object(external_lodash_["isArray"])(element)) { |
|
467 return !element.length; |
|
468 } |
|
469 |
|
470 return !element; |
|
471 }; |
|
472 |
|
473 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js |
|
474 var esm_typeof = __webpack_require__(32); |
|
475 |
|
476 // EXTERNAL MODULE: external {"this":["wp","escapeHtml"]} |
|
477 var external_this_wp_escapeHtml_ = __webpack_require__(69); |
|
478 |
|
479 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/raw-html.js |
|
480 |
|
481 |
|
482 |
|
483 /** |
|
484 * Internal dependencies |
|
485 */ |
|
486 |
|
487 /** |
|
488 * Component used as equivalent of Fragment with unescaped HTML, in cases where |
|
489 * it is desirable to render dangerous HTML without needing a wrapper element. |
|
490 * To preserve additional props, a `div` wrapper _will_ be created if any props |
|
491 * aside from `children` are passed. |
|
492 * |
|
493 * @param {string} props.children HTML to render. |
|
494 * |
|
495 * @return {WPElement} Dangerously-rendering element. |
|
496 */ |
|
497 |
|
498 function RawHTML(_ref) { |
|
499 var children = _ref.children, |
|
500 props = Object(objectWithoutProperties["a" /* default */])(_ref, ["children"]); |
|
501 |
|
502 // The DIV wrapper will be stripped by serializer, unless there are |
|
503 // non-children props present. |
|
504 return Object(external_React_["createElement"])('div', Object(objectSpread["a" /* default */])({ |
|
505 dangerouslySetInnerHTML: { |
|
506 __html: children |
|
507 } |
|
508 }, props)); |
|
509 } |
|
510 |
|
511 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/serialize.js |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 /** |
|
517 * Parts of this source were derived and modified from fast-react-render, |
|
518 * released under the MIT license. |
|
519 * |
|
520 * https://github.com/alt-j/fast-react-render |
|
521 * |
|
522 * Copyright (c) 2016 Andrey Morozov |
|
523 * |
|
524 * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
525 * of this software and associated documentation files (the "Software"), to deal |
|
526 * in the Software without restriction, including without limitation the rights |
|
527 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
528 * copies of the Software, and to permit persons to whom the Software is |
|
529 * furnished to do so, subject to the following conditions: |
|
530 * |
|
531 * The above copyright notice and this permission notice shall be included in |
|
532 * all copies or substantial portions of the Software. |
|
533 * |
|
534 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
535 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
536 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
537 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
538 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
539 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
540 * THE SOFTWARE. |
|
541 */ |
|
542 |
|
543 /** |
|
544 * External dependencies |
|
545 */ |
|
546 |
|
547 /** |
|
548 * WordPress dependencies |
|
549 */ |
|
550 |
|
551 |
|
552 /** |
|
553 * Internal dependencies |
|
554 */ |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 var _createContext = Object(external_React_["createContext"])(), |
|
560 Provider = _createContext.Provider, |
|
561 Consumer = _createContext.Consumer; |
|
562 /** |
|
563 * Valid attribute types. |
|
564 * |
|
565 * @type {Set} |
|
566 */ |
|
567 |
|
568 |
|
569 var ATTRIBUTES_TYPES = new Set(['string', 'boolean', 'number']); |
|
570 /** |
|
571 * Element tags which can be self-closing. |
|
572 * |
|
573 * @type {Set} |
|
574 */ |
|
575 |
|
576 var SELF_CLOSING_TAGS = new Set(['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']); |
|
577 /** |
|
578 * Boolean attributes are attributes whose presence as being assigned is |
|
579 * meaningful, even if only empty. |
|
580 * |
|
581 * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes |
|
582 * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 |
|
583 * |
|
584 * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ] |
|
585 * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 ) |
|
586 * .reduce( ( result, tr ) => Object.assign( result, { |
|
587 * [ tr.firstChild.textContent.trim() ]: true |
|
588 * } ), {} ) ).sort(); |
|
589 * |
|
590 * @type {Set} |
|
591 */ |
|
592 |
|
593 var BOOLEAN_ATTRIBUTES = new Set(['allowfullscreen', 'allowpaymentrequest', 'allowusermedia', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'default', 'defer', 'disabled', 'download', 'formnovalidate', 'hidden', 'ismap', 'itemscope', 'loop', 'multiple', 'muted', 'nomodule', 'novalidate', 'open', 'playsinline', 'readonly', 'required', 'reversed', 'selected', 'typemustmatch']); |
|
594 /** |
|
595 * Enumerated attributes are attributes which must be of a specific value form. |
|
596 * Like boolean attributes, these are meaningful if specified, even if not of a |
|
597 * valid enumerated value. |
|
598 * |
|
599 * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute |
|
600 * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 |
|
601 * |
|
602 * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ] |
|
603 * .filter( ( tr ) => /^("(.+?)";?\s*)+/.test( tr.lastChild.textContent.trim() ) ) |
|
604 * .reduce( ( result, tr ) => Object.assign( result, { |
|
605 * [ tr.firstChild.textContent.trim() ]: true |
|
606 * } ), {} ) ).sort(); |
|
607 * |
|
608 * Some notable omissions: |
|
609 * |
|
610 * - `alt`: https://blog.whatwg.org/omit-alt |
|
611 * |
|
612 * @type {Set} |
|
613 */ |
|
614 |
|
615 var ENUMERATED_ATTRIBUTES = new Set(['autocapitalize', 'autocomplete', 'charset', 'contenteditable', 'crossorigin', 'decoding', 'dir', 'draggable', 'enctype', 'formenctype', 'formmethod', 'http-equiv', 'inputmode', 'kind', 'method', 'preload', 'scope', 'shape', 'spellcheck', 'translate', 'type', 'wrap']); |
|
616 /** |
|
617 * Set of CSS style properties which support assignment of unitless numbers. |
|
618 * Used in rendering of style properties, where `px` unit is assumed unless |
|
619 * property is included in this set or value is zero. |
|
620 * |
|
621 * Generated via: |
|
622 * |
|
623 * Object.entries( document.createElement( 'div' ).style ) |
|
624 * .filter( ( [ key ] ) => ( |
|
625 * ! /^(webkit|ms|moz)/.test( key ) && |
|
626 * ( e.style[ key ] = 10 ) && |
|
627 * e.style[ key ] === '10' |
|
628 * ) ) |
|
629 * .map( ( [ key ] ) => key ) |
|
630 * .sort(); |
|
631 * |
|
632 * @type {Set} |
|
633 */ |
|
634 |
|
635 var CSS_PROPERTIES_SUPPORTS_UNITLESS = new Set(['animation', 'animationIterationCount', 'baselineShift', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'columnCount', 'cx', 'cy', 'fillOpacity', 'flexGrow', 'flexShrink', 'floodOpacity', 'fontWeight', 'gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart', 'lineHeight', 'opacity', 'order', 'orphans', 'r', 'rx', 'ry', 'shapeImageThreshold', 'stopOpacity', 'strokeDasharray', 'strokeDashoffset', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'tabSize', 'widows', 'x', 'y', 'zIndex', 'zoom']); |
|
636 /** |
|
637 * Returns true if the specified string is prefixed by one of an array of |
|
638 * possible prefixes. |
|
639 * |
|
640 * @param {string} string String to check. |
|
641 * @param {string[]} prefixes Possible prefixes. |
|
642 * |
|
643 * @return {boolean} Whether string has prefix. |
|
644 */ |
|
645 |
|
646 function hasPrefix(string, prefixes) { |
|
647 return prefixes.some(function (prefix) { |
|
648 return string.indexOf(prefix) === 0; |
|
649 }); |
|
650 } |
|
651 /** |
|
652 * Returns true if the given prop name should be ignored in attributes |
|
653 * serialization, or false otherwise. |
|
654 * |
|
655 * @param {string} attribute Attribute to check. |
|
656 * |
|
657 * @return {boolean} Whether attribute should be ignored. |
|
658 */ |
|
659 |
|
660 function isInternalAttribute(attribute) { |
|
661 return 'key' === attribute || 'children' === attribute; |
|
662 } |
|
663 /** |
|
664 * Returns the normal form of the element's attribute value for HTML. |
|
665 * |
|
666 * @param {string} attribute Attribute name. |
|
667 * @param {*} value Non-normalized attribute value. |
|
668 * |
|
669 * @return {string} Normalized attribute value. |
|
670 */ |
|
671 |
|
672 |
|
673 function getNormalAttributeValue(attribute, value) { |
|
674 switch (attribute) { |
|
675 case 'style': |
|
676 return renderStyle(value); |
|
677 } |
|
678 |
|
679 return value; |
|
680 } |
|
681 /** |
|
682 * Returns the normal form of the element's attribute name for HTML. |
|
683 * |
|
684 * @param {string} attribute Non-normalized attribute name. |
|
685 * |
|
686 * @return {string} Normalized attribute name. |
|
687 */ |
|
688 |
|
689 |
|
690 function getNormalAttributeName(attribute) { |
|
691 switch (attribute) { |
|
692 case 'htmlFor': |
|
693 return 'for'; |
|
694 |
|
695 case 'className': |
|
696 return 'class'; |
|
697 } |
|
698 |
|
699 return attribute.toLowerCase(); |
|
700 } |
|
701 /** |
|
702 * Returns the normal form of the style property name for HTML. |
|
703 * |
|
704 * - Converts property names to kebab-case, e.g. 'backgroundColor' → 'background-color' |
|
705 * - Leaves custom attributes alone, e.g. '--myBackgroundColor' → '--myBackgroundColor' |
|
706 * - Converts vendor-prefixed property names to -kebab-case, e.g. 'MozTransform' → '-moz-transform' |
|
707 * |
|
708 * @param {string} property Property name. |
|
709 * |
|
710 * @return {string} Normalized property name. |
|
711 */ |
|
712 |
|
713 |
|
714 function getNormalStylePropertyName(property) { |
|
715 if (Object(external_lodash_["startsWith"])(property, '--')) { |
|
716 return property; |
|
717 } |
|
718 |
|
719 if (hasPrefix(property, ['ms', 'O', 'Moz', 'Webkit'])) { |
|
720 return '-' + Object(external_lodash_["kebabCase"])(property); |
|
721 } |
|
722 |
|
723 return Object(external_lodash_["kebabCase"])(property); |
|
724 } |
|
725 /** |
|
726 * Returns the normal form of the style property value for HTML. Appends a |
|
727 * default pixel unit if numeric, not a unitless property, and not zero. |
|
728 * |
|
729 * @param {string} property Property name. |
|
730 * @param {*} value Non-normalized property value. |
|
731 * |
|
732 * @return {*} Normalized property value. |
|
733 */ |
|
734 |
|
735 |
|
736 function getNormalStylePropertyValue(property, value) { |
|
737 if (typeof value === 'number' && 0 !== value && !CSS_PROPERTIES_SUPPORTS_UNITLESS.has(property)) { |
|
738 return value + 'px'; |
|
739 } |
|
740 |
|
741 return value; |
|
742 } |
|
743 /** |
|
744 * Serializes a React element to string. |
|
745 * |
|
746 * @param {WPElement} element Element to serialize. |
|
747 * @param {?Object} context Context object. |
|
748 * @param {?Object} legacyContext Legacy context object. |
|
749 * |
|
750 * @return {string} Serialized element. |
|
751 */ |
|
752 |
|
753 |
|
754 function renderElement(element, context) { |
|
755 var legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
|
756 |
|
757 if (null === element || undefined === element || false === element) { |
|
758 return ''; |
|
759 } |
|
760 |
|
761 if (Array.isArray(element)) { |
|
762 return renderChildren(element, context, legacyContext); |
|
763 } |
|
764 |
|
765 switch (Object(esm_typeof["a" /* default */])(element)) { |
|
766 case 'string': |
|
767 return Object(external_this_wp_escapeHtml_["escapeHTML"])(element); |
|
768 |
|
769 case 'number': |
|
770 return element.toString(); |
|
771 } |
|
772 |
|
773 var type = element.type, |
|
774 props = element.props; |
|
775 |
|
776 switch (type) { |
|
777 case external_React_["StrictMode"]: |
|
778 case external_React_["Fragment"]: |
|
779 return renderChildren(props.children, context, legacyContext); |
|
780 |
|
781 case RawHTML: |
|
782 var children = props.children, |
|
783 wrapperProps = Object(objectWithoutProperties["a" /* default */])(props, ["children"]); |
|
784 |
|
785 return renderNativeComponent(Object(external_lodash_["isEmpty"])(wrapperProps) ? null : 'div', Object(objectSpread["a" /* default */])({}, wrapperProps, { |
|
786 dangerouslySetInnerHTML: { |
|
787 __html: children |
|
788 } |
|
789 }), context, legacyContext); |
|
790 } |
|
791 |
|
792 switch (Object(esm_typeof["a" /* default */])(type)) { |
|
793 case 'string': |
|
794 return renderNativeComponent(type, props, context, legacyContext); |
|
795 |
|
796 case 'function': |
|
797 if (type.prototype && typeof type.prototype.render === 'function') { |
|
798 return renderComponent(type, props, context, legacyContext); |
|
799 } |
|
800 |
|
801 return renderElement(type(props, legacyContext), context, legacyContext); |
|
802 } |
|
803 |
|
804 switch (type && type.$$typeof) { |
|
805 case Provider.$$typeof: |
|
806 return renderChildren(props.children, props.value, legacyContext); |
|
807 |
|
808 case Consumer.$$typeof: |
|
809 return renderElement(props.children(context || type._currentValue), context, legacyContext); |
|
810 } |
|
811 |
|
812 return ''; |
|
813 } |
|
814 /** |
|
815 * Serializes a native component type to string. |
|
816 * |
|
817 * @param {?string} type Native component type to serialize, or null if |
|
818 * rendering as fragment of children content. |
|
819 * @param {Object} props Props object. |
|
820 * @param {?Object} context Context object. |
|
821 * @param {?Object} legacyContext Legacy context object. |
|
822 * |
|
823 * @return {string} Serialized element. |
|
824 */ |
|
825 |
|
826 function renderNativeComponent(type, props, context) { |
|
827 var legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; |
|
828 var content = ''; |
|
829 |
|
830 if (type === 'textarea' && props.hasOwnProperty('value')) { |
|
831 // Textarea children can be assigned as value prop. If it is, render in |
|
832 // place of children. Ensure to omit so it is not assigned as attribute |
|
833 // as well. |
|
834 content = renderChildren(props.value, context, legacyContext); |
|
835 props = Object(external_lodash_["omit"])(props, 'value'); |
|
836 } else if (props.dangerouslySetInnerHTML && typeof props.dangerouslySetInnerHTML.__html === 'string') { |
|
837 // Dangerous content is left unescaped. |
|
838 content = props.dangerouslySetInnerHTML.__html; |
|
839 } else if (typeof props.children !== 'undefined') { |
|
840 content = renderChildren(props.children, context, legacyContext); |
|
841 } |
|
842 |
|
843 if (!type) { |
|
844 return content; |
|
845 } |
|
846 |
|
847 var attributes = renderAttributes(props); |
|
848 |
|
849 if (SELF_CLOSING_TAGS.has(type)) { |
|
850 return '<' + type + attributes + '/>'; |
|
851 } |
|
852 |
|
853 return '<' + type + attributes + '>' + content + '</' + type + '>'; |
|
854 } |
|
855 /** |
|
856 * Serializes a non-native component type to string. |
|
857 * |
|
858 * @param {Function} Component Component type to serialize. |
|
859 * @param {Object} props Props object. |
|
860 * @param {?Object} context Context object. |
|
861 * @param {?Object} legacyContext Legacy context object. |
|
862 * |
|
863 * @return {string} Serialized element |
|
864 */ |
|
865 |
|
866 function renderComponent(Component, props, context) { |
|
867 var legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; |
|
868 var instance = new Component(props, legacyContext); |
|
869 |
|
870 if (typeof instance.getChildContext === 'function') { |
|
871 Object.assign(legacyContext, instance.getChildContext()); |
|
872 } |
|
873 |
|
874 var html = renderElement(instance.render(), context, legacyContext); |
|
875 return html; |
|
876 } |
|
877 /** |
|
878 * Serializes an array of children to string. |
|
879 * |
|
880 * @param {Array} children Children to serialize. |
|
881 * @param {?Object} context Context object. |
|
882 * @param {?Object} legacyContext Legacy context object. |
|
883 * |
|
884 * @return {string} Serialized children. |
|
885 */ |
|
886 |
|
887 function renderChildren(children, context) { |
|
888 var legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
|
889 var result = ''; |
|
890 children = Object(external_lodash_["castArray"])(children); |
|
891 |
|
892 for (var i = 0; i < children.length; i++) { |
|
893 var child = children[i]; |
|
894 result += renderElement(child, context, legacyContext); |
|
895 } |
|
896 |
|
897 return result; |
|
898 } |
|
899 /** |
|
900 * Renders a props object as a string of HTML attributes. |
|
901 * |
|
902 * @param {Object} props Props object. |
|
903 * |
|
904 * @return {string} Attributes string. |
|
905 */ |
|
906 |
|
907 |
|
908 function renderAttributes(props) { |
|
909 var result = ''; |
|
910 |
|
911 for (var key in props) { |
|
912 var attribute = getNormalAttributeName(key); |
|
913 |
|
914 if (!Object(external_this_wp_escapeHtml_["isValidAttributeName"])(attribute)) { |
|
915 continue; |
|
916 } |
|
917 |
|
918 var value = getNormalAttributeValue(key, props[key]); // If value is not of serializeable type, skip. |
|
919 |
|
920 if (!ATTRIBUTES_TYPES.has(Object(esm_typeof["a" /* default */])(value))) { |
|
921 continue; |
|
922 } // Don't render internal attribute names. |
|
923 |
|
924 |
|
925 if (isInternalAttribute(key)) { |
|
926 continue; |
|
927 } |
|
928 |
|
929 var isBooleanAttribute = BOOLEAN_ATTRIBUTES.has(attribute); // Boolean attribute should be omitted outright if its value is false. |
|
930 |
|
931 if (isBooleanAttribute && value === false) { |
|
932 continue; |
|
933 } |
|
934 |
|
935 var isMeaningfulAttribute = isBooleanAttribute || hasPrefix(key, ['data-', 'aria-']) || ENUMERATED_ATTRIBUTES.has(attribute); // Only write boolean value as attribute if meaningful. |
|
936 |
|
937 if (typeof value === 'boolean' && !isMeaningfulAttribute) { |
|
938 continue; |
|
939 } |
|
940 |
|
941 result += ' ' + attribute; // Boolean attributes should write attribute name, but without value. |
|
942 // Mere presence of attribute name is effective truthiness. |
|
943 |
|
944 if (isBooleanAttribute) { |
|
945 continue; |
|
946 } |
|
947 |
|
948 if (typeof value === 'string') { |
|
949 value = Object(external_this_wp_escapeHtml_["escapeAttribute"])(value); |
|
950 } |
|
951 |
|
952 result += '="' + value + '"'; |
|
953 } |
|
954 |
|
955 return result; |
|
956 } |
|
957 /** |
|
958 * Renders a style object as a string attribute value. |
|
959 * |
|
960 * @param {Object} style Style object. |
|
961 * |
|
962 * @return {string} Style attribute value. |
|
963 */ |
|
964 |
|
965 function renderStyle(style) { |
|
966 // Only generate from object, e.g. tolerate string value. |
|
967 if (!Object(external_lodash_["isPlainObject"])(style)) { |
|
968 return style; |
|
969 } |
|
970 |
|
971 var result; |
|
972 |
|
973 for (var property in style) { |
|
974 var value = style[property]; |
|
975 |
|
976 if (null === value || undefined === value) { |
|
977 continue; |
|
978 } |
|
979 |
|
980 if (result) { |
|
981 result += ';'; |
|
982 } else { |
|
983 result = ''; |
|
984 } |
|
985 |
|
986 var normalName = getNormalStylePropertyName(property); |
|
987 var normalValue = getNormalStylePropertyValue(property, value); |
|
988 result += normalName + ':' + normalValue; |
|
989 } |
|
990 |
|
991 return result; |
|
992 } |
|
993 /* harmony default export */ var serialize = (renderElement); |
|
994 |
|
995 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/index.js |
|
996 /* concated harmony reexport Children */__webpack_require__.d(__webpack_exports__, "Children", function() { return external_React_["Children"]; }); |
|
997 /* concated harmony reexport cloneElement */__webpack_require__.d(__webpack_exports__, "cloneElement", function() { return external_React_["cloneElement"]; }); |
|
998 /* concated harmony reexport Component */__webpack_require__.d(__webpack_exports__, "Component", function() { return external_React_["Component"]; }); |
|
999 /* concated harmony reexport createContext */__webpack_require__.d(__webpack_exports__, "createContext", function() { return external_React_["createContext"]; }); |
|
1000 /* concated harmony reexport createElement */__webpack_require__.d(__webpack_exports__, "createElement", function() { return external_React_["createElement"]; }); |
|
1001 /* concated harmony reexport createRef */__webpack_require__.d(__webpack_exports__, "createRef", function() { return external_React_["createRef"]; }); |
|
1002 /* concated harmony reexport forwardRef */__webpack_require__.d(__webpack_exports__, "forwardRef", function() { return external_React_["forwardRef"]; }); |
|
1003 /* concated harmony reexport Fragment */__webpack_require__.d(__webpack_exports__, "Fragment", function() { return external_React_["Fragment"]; }); |
|
1004 /* concated harmony reexport isValidElement */__webpack_require__.d(__webpack_exports__, "isValidElement", function() { return external_React_["isValidElement"]; }); |
|
1005 /* concated harmony reexport StrictMode */__webpack_require__.d(__webpack_exports__, "StrictMode", function() { return external_React_["StrictMode"]; }); |
|
1006 /* concated harmony reexport useCallback */__webpack_require__.d(__webpack_exports__, "useCallback", function() { return external_React_["useCallback"]; }); |
|
1007 /* concated harmony reexport useContext */__webpack_require__.d(__webpack_exports__, "useContext", function() { return external_React_["useContext"]; }); |
|
1008 /* concated harmony reexport useDebugValue */__webpack_require__.d(__webpack_exports__, "useDebugValue", function() { return external_React_["useDebugValue"]; }); |
|
1009 /* concated harmony reexport useEffect */__webpack_require__.d(__webpack_exports__, "useEffect", function() { return external_React_["useEffect"]; }); |
|
1010 /* concated harmony reexport useImperativeHandle */__webpack_require__.d(__webpack_exports__, "useImperativeHandle", function() { return external_React_["useImperativeHandle"]; }); |
|
1011 /* concated harmony reexport useLayoutEffect */__webpack_require__.d(__webpack_exports__, "useLayoutEffect", function() { return external_React_["useLayoutEffect"]; }); |
|
1012 /* concated harmony reexport useMemo */__webpack_require__.d(__webpack_exports__, "useMemo", function() { return external_React_["useMemo"]; }); |
|
1013 /* concated harmony reexport useReducer */__webpack_require__.d(__webpack_exports__, "useReducer", function() { return external_React_["useReducer"]; }); |
|
1014 /* concated harmony reexport useRef */__webpack_require__.d(__webpack_exports__, "useRef", function() { return external_React_["useRef"]; }); |
|
1015 /* concated harmony reexport useState */__webpack_require__.d(__webpack_exports__, "useState", function() { return external_React_["useState"]; }); |
|
1016 /* concated harmony reexport concatChildren */__webpack_require__.d(__webpack_exports__, "concatChildren", function() { return concatChildren; }); |
|
1017 /* concated harmony reexport switchChildrenNodeName */__webpack_require__.d(__webpack_exports__, "switchChildrenNodeName", function() { return switchChildrenNodeName; }); |
|
1018 /* concated harmony reexport createPortal */__webpack_require__.d(__webpack_exports__, "createPortal", function() { return external_ReactDOM_["createPortal"]; }); |
|
1019 /* concated harmony reexport findDOMNode */__webpack_require__.d(__webpack_exports__, "findDOMNode", function() { return external_ReactDOM_["findDOMNode"]; }); |
|
1020 /* concated harmony reexport render */__webpack_require__.d(__webpack_exports__, "render", function() { return external_ReactDOM_["render"]; }); |
|
1021 /* concated harmony reexport unmountComponentAtNode */__webpack_require__.d(__webpack_exports__, "unmountComponentAtNode", function() { return external_ReactDOM_["unmountComponentAtNode"]; }); |
|
1022 /* concated harmony reexport isEmptyElement */__webpack_require__.d(__webpack_exports__, "isEmptyElement", function() { return utils_isEmptyElement; }); |
|
1023 /* concated harmony reexport renderToString */__webpack_require__.d(__webpack_exports__, "renderToString", function() { return serialize; }); |
|
1024 /* concated harmony reexport RawHTML */__webpack_require__.d(__webpack_exports__, "RawHTML", function() { return RawHTML; }); |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 /***/ }), |
|
1033 |
|
1034 /***/ 52: |
|
1035 /***/ (function(module, exports) { |
|
1036 |
|
1037 (function() { module.exports = this["ReactDOM"]; }()); |
|
1038 |
|
1039 /***/ }), |
|
1040 |
|
1041 /***/ 69: |
|
1042 /***/ (function(module, exports) { |
|
1043 |
|
1044 (function() { module.exports = this["wp"]["escapeHtml"]; }()); |
|
1045 |
|
1046 /***/ }), |
|
1047 |
|
1048 /***/ 7: |
|
1049 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1050 |
|
1051 "use strict"; |
|
1052 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; }); |
|
1053 /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); |
|
1054 |
|
1055 function _objectSpread(target) { |
|
1056 for (var i = 1; i < arguments.length; i++) { |
|
1057 var source = arguments[i] != null ? arguments[i] : {}; |
|
1058 var ownKeys = Object.keys(source); |
|
1059 |
|
1060 if (typeof Object.getOwnPropertySymbols === 'function') { |
|
1061 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { |
|
1062 return Object.getOwnPropertyDescriptor(source, sym).enumerable; |
|
1063 })); |
|
1064 } |
|
1065 |
|
1066 ownKeys.forEach(function (key) { |
|
1067 Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); |
|
1068 }); |
|
1069 } |
|
1070 |
|
1071 return target; |
|
1072 } |
|
1073 |
|
1074 /***/ }) |
|
1075 |
|
1076 /******/ }); |