@wordpress/element 4.0.2 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/serialize.js"],"names":["Provider","Consumer","undefined","ForwardRef","ATTRIBUTES_TYPES","Set","SELF_CLOSING_TAGS","BOOLEAN_ATTRIBUTES","ENUMERATED_ATTRIBUTES","CSS_PROPERTIES_SUPPORTS_UNITLESS","hasPrefix","string","prefixes","some","prefix","indexOf","isInternalAttribute","attribute","getNormalAttributeValue","value","renderStyle","getNormalAttributeName","toLowerCase","getNormalStylePropertyName","property","getNormalStylePropertyValue","has","renderElement","element","context","legacyContext","Array","isArray","renderChildren","toString","type","props","StrictMode","Fragment","children","RawHTML","wrapperProps","renderNativeComponent","dangerouslySetInnerHTML","__html","prototype","render","renderComponent","$$typeof","_currentValue","content","hasOwnProperty","attributes","renderAttributes","Component","instance","getChildContext","Object","assign","html","result","i","length","child","key","isBooleanAttribute","isMeaningfulAttribute","style","normalName","normalValue"],"mappings":";;;;;;;;;;;;;;;AA8BA;;AAYA;;AASA;;AACA;;AApDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAUA;AACA;AACA;;AAOA;AACA;AACA;;AAIA;AAEA,MAAM;AAAEA,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,IAAyB,0BAAeC,SAAf,CAA/B;AACA,MAAMC,UAAU,GAAG,uBAAY,MAAM;AACpC,SAAO,IAAP;AACA,CAFkB,CAAnB;AAIA;AACA;AACA;AACA;AACA;;AACA,MAAMC,gBAAgB,GAAG,IAAIC,GAAJ,CAAS,CAAE,QAAF,EAAY,SAAZ,EAAuB,QAAvB,CAAT,CAAzB;AAEA;AACA;AACA;AACA;AACA;;AACA,MAAMC,iBAAiB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0B,CAqC1B;AACA;;AACA,QAAKgD,kBAAL,EAA0B;AACzB;AACA;;AAED,QAAK,OAAO9C,KAAP,KAAiB,QAAtB,EAAiC;AAChCA,MAAAA,KAAK,GAAG,iCAAiBA,KAAjB,CAAR;AACA;;AAEDyC,IAAAA,MAAM,IAAI,OAAOzC,KAAP,GAAe,GAAzB;AACA;;AAED,SAAOyC,MAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASxC,WAAT,CAAsB+C,KAAtB,EAA8B;AACpC;AACA,MAAK,CAAE,2BAAeA,KAAf,CAAP,EAAgC;AAC/B,WAAOA,KAAP;AACA;;AAED,MAAIP,MAAJ;;AAEA,OAAM,MAAMpC,QAAZ,IAAwB2C,KAAxB,EAAgC;AAC/B,UAAMhD,KAAK,GAAGgD,KAAK,CAAE3C,QAAF,CAAnB;;AACA,QAAK,SAASL,KAAT,IAAkBjB,SAAS,KAAKiB,KAArC,EAA6C;AAC5C;AACA;;AAED,QAAKyC,MAAL,EAAc;AACbA,MAAAA,MAAM,IAAI,GAAV;AACA,KAFD,MAEO;AACNA,MAAAA,MAAM,GAAG,EAAT;AACA;;AAED,UAAMQ,UAAU,GAAG7C,0BAA0B,CAAEC,QAAF,CAA7C;AACA,UAAM6C,WAAW,GAAG5C,2BAA2B,CAAED,QAAF,EAAYL,KAAZ,CAA/C;AACAyC,IAAAA,MAAM,IAAIQ,UAAU,GAAG,GAAb,GAAmBC,WAA7B;AACA;;AAED,SAAOT,MAAP;AACA;;eAEcjC,a","sourcesContent":["/**\n * Parts of this source were derived and modified from fast-react-render,\n * released under the MIT license.\n *\n * https://github.com/alt-j/fast-react-render\n *\n * Copyright (c) 2016 Andrey Morozov\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n/**\n * External dependencies\n */\nimport {\n\tisEmpty,\n\tcastArray,\n\tomit,\n\tstartsWith,\n\tkebabCase,\n\tisPlainObject,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tescapeHTML,\n\tescapeAttribute,\n\tisValidAttributeName,\n} from '@wordpress/escape-html';\n\n/**\n * Internal dependencies\n */\nimport { createContext, Fragment, StrictMode, forwardRef } from './react';\nimport RawHTML from './raw-html';\n\n/** @typedef {import('./react').WPElement} WPElement */\n\nconst { Provider, Consumer } = createContext( undefined );\nconst ForwardRef = forwardRef( () => {\n\treturn null;\n} );\n\n/**\n * Valid attribute types.\n *\n * @type {Set<string>}\n */\nconst ATTRIBUTES_TYPES = new Set( [ 'string', 'boolean', 'number' ] );\n\n/**\n * Element tags which can be self-closing.\n *\n * @type {Set<string>}\n */\nconst SELF_CLOSING_TAGS = new Set( [\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'keygen',\n\t'link',\n\t'meta',\n\t'param',\n\t'source',\n\t'track',\n\t'wbr',\n] );\n\n/**\n * Boolean attributes are attributes whose presence as being assigned is\n * meaningful, even if only empty.\n *\n * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes\n * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3\n *\n * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]\n * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 )\n * .reduce( ( result, tr ) => Object.assign( result, {\n * [ tr.firstChild.textContent.trim() ]: true\n * } ), {} ) ).sort();\n *\n * @type {Set<string>}\n */\nconst BOOLEAN_ATTRIBUTES = new Set( [\n\t'allowfullscreen',\n\t'allowpaymentrequest',\n\t'allowusermedia',\n\t'async',\n\t'autofocus',\n\t'autoplay',\n\t'checked',\n\t'controls',\n\t'default',\n\t'defer',\n\t'disabled',\n\t'download',\n\t'formnovalidate',\n\t'hidden',\n\t'ismap',\n\t'itemscope',\n\t'loop',\n\t'multiple',\n\t'muted',\n\t'nomodule',\n\t'novalidate',\n\t'open',\n\t'playsinline',\n\t'readonly',\n\t'required',\n\t'reversed',\n\t'selected',\n\t'typemustmatch',\n] );\n\n/**\n * Enumerated attributes are attributes which must be of a specific value form.\n * Like boolean attributes, these are meaningful if specified, even if not of a\n * valid enumerated value.\n *\n * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute\n * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3\n *\n * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]\n * .filter( ( tr ) => /^(\"(.+?)\";?\\s*)+/.test( tr.lastChild.textContent.trim() ) )\n * .reduce( ( result, tr ) => Object.assign( result, {\n * [ tr.firstChild.textContent.trim() ]: true\n * } ), {} ) ).sort();\n *\n * Some notable omissions:\n *\n * - `alt`: https://blog.whatwg.org/omit-alt\n *\n * @type {Set<string>}\n */\nconst ENUMERATED_ATTRIBUTES = new Set( [\n\t'autocapitalize',\n\t'autocomplete',\n\t'charset',\n\t'contenteditable',\n\t'crossorigin',\n\t'decoding',\n\t'dir',\n\t'draggable',\n\t'enctype',\n\t'formenctype',\n\t'formmethod',\n\t'http-equiv',\n\t'inputmode',\n\t'kind',\n\t'method',\n\t'preload',\n\t'scope',\n\t'shape',\n\t'spellcheck',\n\t'translate',\n\t'type',\n\t'wrap',\n] );\n\n/**\n * Set of CSS style properties which support assignment of unitless numbers.\n * Used in rendering of style properties, where `px` unit is assumed unless\n * property is included in this set or value is zero.\n *\n * Generated via:\n *\n * Object.entries( document.createElement( 'div' ).style )\n * .filter( ( [ key ] ) => (\n * ! /^(webkit|ms|moz)/.test( key ) &&\n * ( e.style[ key ] = 10 ) &&\n * e.style[ key ] === '10'\n * ) )\n * .map( ( [ key ] ) => key )\n * .sort();\n *\n * @type {Set<string>}\n */\nconst CSS_PROPERTIES_SUPPORTS_UNITLESS = new Set( [\n\t'animation',\n\t'animationIterationCount',\n\t'baselineShift',\n\t'borderImageOutset',\n\t'borderImageSlice',\n\t'borderImageWidth',\n\t'columnCount',\n\t'cx',\n\t'cy',\n\t'fillOpacity',\n\t'flexGrow',\n\t'flexShrink',\n\t'floodOpacity',\n\t'fontWeight',\n\t'gridColumnEnd',\n\t'gridColumnStart',\n\t'gridRowEnd',\n\t'gridRowStart',\n\t'lineHeight',\n\t'opacity',\n\t'order',\n\t'orphans',\n\t'r',\n\t'rx',\n\t'ry',\n\t'shapeImageThreshold',\n\t'stopOpacity',\n\t'strokeDasharray',\n\t'strokeDashoffset',\n\t'strokeMiterlimit',\n\t'strokeOpacity',\n\t'strokeWidth',\n\t'tabSize',\n\t'widows',\n\t'x',\n\t'y',\n\t'zIndex',\n\t'zoom',\n] );\n\n/**\n * Returns true if the specified string is prefixed by one of an array of\n * possible prefixes.\n *\n * @param {string} string String to check.\n * @param {string[]} prefixes Possible prefixes.\n *\n * @return {boolean} Whether string has prefix.\n */\nexport function hasPrefix( string, prefixes ) {\n\treturn prefixes.some( ( prefix ) => string.indexOf( prefix ) === 0 );\n}\n\n/**\n * Returns true if the given prop name should be ignored in attributes\n * serialization, or false otherwise.\n *\n * @param {string} attribute Attribute to check.\n *\n * @return {boolean} Whether attribute should be ignored.\n */\nfunction isInternalAttribute( attribute ) {\n\treturn 'key' === attribute || 'children' === attribute;\n}\n\n/**\n * Returns the normal form of the element's attribute value for HTML.\n *\n * @param {string} attribute Attribute name.\n * @param {*} value Non-normalized attribute value.\n *\n * @return {*} Normalized attribute value.\n */\nfunction getNormalAttributeValue( attribute, value ) {\n\tswitch ( attribute ) {\n\t\tcase 'style':\n\t\t\treturn renderStyle( value );\n\t}\n\n\treturn value;\n}\n\n/**\n * Returns the normal form of the element's attribute name for HTML.\n *\n * @param {string} attribute Non-normalized attribute name.\n *\n * @return {string} Normalized attribute name.\n */\nfunction getNormalAttributeName( attribute ) {\n\tswitch ( attribute ) {\n\t\tcase 'htmlFor':\n\t\t\treturn 'for';\n\n\t\tcase 'className':\n\t\t\treturn 'class';\n\t}\n\n\treturn attribute.toLowerCase();\n}\n\n/**\n * Returns the normal form of the style property name for HTML.\n *\n * - Converts property names to kebab-case, e.g. 'backgroundColor' → 'background-color'\n * - Leaves custom attributes alone, e.g. '--myBackgroundColor' → '--myBackgroundColor'\n * - Converts vendor-prefixed property names to -kebab-case, e.g. 'MozTransform' → '-moz-transform'\n *\n * @param {string} property Property name.\n *\n * @return {string} Normalized property name.\n */\nfunction getNormalStylePropertyName( property ) {\n\tif ( startsWith( property, '--' ) ) {\n\t\treturn property;\n\t}\n\n\tif ( hasPrefix( property, [ 'ms', 'O', 'Moz', 'Webkit' ] ) ) {\n\t\treturn '-' + kebabCase( property );\n\t}\n\n\treturn kebabCase( property );\n}\n\n/**\n * Returns the normal form of the style property value for HTML. Appends a\n * default pixel unit if numeric, not a unitless property, and not zero.\n *\n * @param {string} property Property name.\n * @param {*} value Non-normalized property value.\n *\n * @return {*} Normalized property value.\n */\nfunction getNormalStylePropertyValue( property, value ) {\n\tif (\n\t\ttypeof value === 'number' &&\n\t\t0 !== value &&\n\t\t! CSS_PROPERTIES_SUPPORTS_UNITLESS.has( property )\n\t) {\n\t\treturn value + 'px';\n\t}\n\n\treturn value;\n}\n\n/**\n * Serializes a React element to string.\n *\n * @param {import('react').ReactNode} element Element to serialize.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized element.\n */\nexport function renderElement( element, context, legacyContext = {} ) {\n\tif ( null === element || undefined === element || false === element ) {\n\t\treturn '';\n\t}\n\n\tif ( Array.isArray( element ) ) {\n\t\treturn renderChildren( element, context, legacyContext );\n\t}\n\n\tswitch ( typeof element ) {\n\t\tcase 'string':\n\t\t\treturn escapeHTML( element );\n\n\t\tcase 'number':\n\t\t\treturn element.toString();\n\t}\n\n\tconst {\n\t\ttype,\n\t\tprops,\n\t} = /** @type {{type?: any, props?: any}} */ ( element );\n\n\tswitch ( type ) {\n\t\tcase StrictMode:\n\t\tcase Fragment:\n\t\t\treturn renderChildren( props.children, context, legacyContext );\n\n\t\tcase RawHTML:\n\t\t\tconst { children, ...wrapperProps } = props;\n\n\t\t\treturn renderNativeComponent(\n\t\t\t\tisEmpty( wrapperProps ) ? null : 'div',\n\t\t\t\t{\n\t\t\t\t\t...wrapperProps,\n\t\t\t\t\tdangerouslySetInnerHTML: { __html: children },\n\t\t\t\t},\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\t}\n\n\tswitch ( typeof type ) {\n\t\tcase 'string':\n\t\t\treturn renderNativeComponent( type, props, context, legacyContext );\n\n\t\tcase 'function':\n\t\t\tif (\n\t\t\t\ttype.prototype &&\n\t\t\t\ttypeof type.prototype.render === 'function'\n\t\t\t) {\n\t\t\t\treturn renderComponent( type, props, context, legacyContext );\n\t\t\t}\n\n\t\t\treturn renderElement(\n\t\t\t\ttype( props, legacyContext ),\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\t}\n\n\tswitch ( type && type.$$typeof ) {\n\t\tcase Provider.$$typeof:\n\t\t\treturn renderChildren( props.children, props.value, legacyContext );\n\n\t\tcase Consumer.$$typeof:\n\t\t\treturn renderElement(\n\t\t\t\tprops.children( context || type._currentValue ),\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\n\t\tcase ForwardRef.$$typeof:\n\t\t\treturn renderElement(\n\t\t\t\ttype.render( props ),\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\t}\n\n\treturn '';\n}\n\n/**\n * Serializes a native component type to string.\n *\n * @param {?string} type Native component type to serialize, or null if\n * rendering as fragment of children content.\n * @param {Object} props Props object.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized element.\n */\nexport function renderNativeComponent(\n\ttype,\n\tprops,\n\tcontext,\n\tlegacyContext = {}\n) {\n\tlet content = '';\n\tif ( type === 'textarea' && props.hasOwnProperty( 'value' ) ) {\n\t\t// Textarea children can be assigned as value prop. If it is, render in\n\t\t// place of children. Ensure to omit so it is not assigned as attribute\n\t\t// as well.\n\t\tcontent = renderChildren( props.value, context, legacyContext );\n\t\tprops = omit( props, 'value' );\n\t} else if (\n\t\tprops.dangerouslySetInnerHTML &&\n\t\ttypeof props.dangerouslySetInnerHTML.__html === 'string'\n\t) {\n\t\t// Dangerous content is left unescaped.\n\t\tcontent = props.dangerouslySetInnerHTML.__html;\n\t} else if ( typeof props.children !== 'undefined' ) {\n\t\tcontent = renderChildren( props.children, context, legacyContext );\n\t}\n\n\tif ( ! type ) {\n\t\treturn content;\n\t}\n\n\tconst attributes = renderAttributes( props );\n\n\tif ( SELF_CLOSING_TAGS.has( type ) ) {\n\t\treturn '<' + type + attributes + '/>';\n\t}\n\n\treturn '<' + type + attributes + '>' + content + '</' + type + '>';\n}\n\n/** @typedef {import('./react').WPComponent} WPComponent */\n\n/**\n * Serializes a non-native component type to string.\n *\n * @param {WPComponent} Component Component type to serialize.\n * @param {Object} props Props object.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized element\n */\nexport function renderComponent(\n\tComponent,\n\tprops,\n\tcontext,\n\tlegacyContext = {}\n) {\n\tconst instance = new /** @type {import('react').ComponentClass} */ ( Component )(\n\t\tprops,\n\t\tlegacyContext\n\t);\n\n\tif (\n\t\ttypeof (\n\t\t\t// Ignore reason: Current prettier reformats parens and mangles type assertion\n\t\t\t// prettier-ignore\n\t\t\t/** @type {{getChildContext?: () => unknown}} */ ( instance ).getChildContext\n\t\t) === 'function'\n\t) {\n\t\tObject.assign(\n\t\t\tlegacyContext,\n\t\t\t/** @type {{getChildContext?: () => unknown}} */ ( instance ).getChildContext()\n\t\t);\n\t}\n\n\tconst html = renderElement( instance.render(), context, legacyContext );\n\n\treturn html;\n}\n\n/**\n * Serializes an array of children to string.\n *\n * @param {import('react').ReactNodeArray} children Children to serialize.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized children.\n */\nfunction renderChildren( children, context, legacyContext = {} ) {\n\tlet result = '';\n\n\tchildren = castArray( children );\n\n\tfor ( let i = 0; i < children.length; i++ ) {\n\t\tconst child = children[ i ];\n\n\t\tresult += renderElement( child, context, legacyContext );\n\t}\n\n\treturn result;\n}\n\n/**\n * Renders a props object as a string of HTML attributes.\n *\n * @param {Object} props Props object.\n *\n * @return {string} Attributes string.\n */\nexport function renderAttributes( props ) {\n\tlet result = '';\n\n\tfor ( const key in props ) {\n\t\tconst attribute = getNormalAttributeName( key );\n\t\tif ( ! isValidAttributeName( attribute ) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet value = getNormalAttributeValue( key, props[ key ] );\n\n\t\t// If value is not of serializeable type, skip.\n\t\tif ( ! ATTRIBUTES_TYPES.has( typeof value ) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Don't render internal attribute names.\n\t\tif ( isInternalAttribute( key ) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isBooleanAttribute = BOOLEAN_ATTRIBUTES.has( attribute );\n\n\t\t// Boolean attribute should be omitted outright if its value is false.\n\t\tif ( isBooleanAttribute && value === false ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isMeaningfulAttribute =\n\t\t\tisBooleanAttribute ||\n\t\t\thasPrefix( key, [ 'data-', 'aria-' ] ) ||\n\t\t\tENUMERATED_ATTRIBUTES.has( attribute );\n\n\t\t// Only write boolean value as attribute if meaningful.\n\t\tif ( typeof value === 'boolean' && ! isMeaningfulAttribute ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult += ' ' + attribute;\n\n\t\t// Boolean attributes should write attribute name, but without value.\n\t\t// Mere presence of attribute name is effective truthiness.\n\t\tif ( isBooleanAttribute ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ( typeof value === 'string' ) {\n\t\t\tvalue = escapeAttribute( value );\n\t\t}\n\n\t\tresult += '=\"' + value + '\"';\n\t}\n\n\treturn result;\n}\n\n/**\n * Renders a style object as a string attribute value.\n *\n * @param {Object} style Style object.\n *\n * @return {string} Style attribute value.\n */\nexport function renderStyle( style ) {\n\t// Only generate from object, e.g. tolerate string value.\n\tif ( ! isPlainObject( style ) ) {\n\t\treturn style;\n\t}\n\n\tlet result;\n\n\tfor ( const property in style ) {\n\t\tconst value = style[ property ];\n\t\tif ( null === value || undefined === value ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ( result ) {\n\t\t\tresult += ';';\n\t\t} else {\n\t\t\tresult = '';\n\t\t}\n\n\t\tconst normalName = getNormalStylePropertyName( property );\n\t\tconst normalValue = getNormalStylePropertyValue( property, value );\n\t\tresult += normalName + ':' + normalValue;\n\t}\n\n\treturn result;\n}\n\nexport default renderElement;\n"]}
1
+ {"version":3,"sources":["@wordpress/element/src/serialize.js"],"names":["Provider","Consumer","undefined","ForwardRef","ATTRIBUTES_TYPES","Set","SELF_CLOSING_TAGS","BOOLEAN_ATTRIBUTES","ENUMERATED_ATTRIBUTES","CSS_PROPERTIES_SUPPORTS_UNITLESS","hasPrefix","string","prefixes","some","prefix","indexOf","isInternalAttribute","attribute","getNormalAttributeValue","value","renderStyle","getNormalAttributeName","toLowerCase","getNormalStylePropertyName","property","getNormalStylePropertyValue","has","renderElement","element","context","legacyContext","Array","isArray","renderChildren","toString","type","props","StrictMode","Fragment","children","RawHTML","wrapperProps","renderNativeComponent","dangerouslySetInnerHTML","__html","prototype","render","renderComponent","$$typeof","_currentValue","content","hasOwnProperty","attributes","renderAttributes","Component","instance","getChildContext","Object","assign","html","result","i","length","child","key","isBooleanAttribute","isMeaningfulAttribute","style","normalName","normalValue"],"mappings":";;;;;;;;;;;;;;;AA8BA;;AAYA;;AASA;;AACA;;AApDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAUA;AACA;AACA;;AAOA;AACA;AACA;;AAIA;AAEA,MAAM;AAAEA,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,IAAyB,0BAAeC,SAAf,CAA/B;AACA,MAAMC,UAAU,GAAG,uBAAY,MAAM;AACpC,SAAO,IAAP;AACA,CAFkB,CAAnB;AAIA;AACA;AACA;AACA;AACA;;AACA,MAAMC,gBAAgB,GAAG,IAAIC,GAAJ,CAAS,CAAE,QAAF,EAAY,SAAZ,EAAuB,QAAvB,CAAT,CAAzB;AAEA;AACA;AACA;AACA;AACA;;AACA,MAAMC,iBAAiB,GAAG,IAAID,GAAJ,CAAS,CAClC,MADkC,EAElC,MAFkC,EAGlC,IAHkC,EAIlC,KAJkC,EAKlC,SALkC,EAMlC,OANkC,EAOlC,IAPkC,EAQlC,KARkC,EASlC,OATkC,EAUlC,QAVkC,EAWlC,MAXkC,EAYlC,MAZkC,EAalC,OAbkC,EAclC,QAdkC,EAelC,OAfkC,EAgBlC,KAhBkC,CAAT,CAA1B;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAME,kBA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AACA,MAAK,CAAE,2BAAeA,KAAf,CAAP,EAAgC;AAC/B,WAAOA,KAAP;AACA;;AAED,MAAIP,MAAJ;;AAEA,OAAM,MAAMpC,QAAZ,IAAwB2C,KAAxB,EAAgC;AAC/B,UAAMhD,KAAK,GAAGgD,KAAK,CAAE3C,QAAF,CAAnB;;AACA,QAAK,SAASL,KAAT,IAAkBjB,SAAS,KAAKiB,KAArC,EAA6C;AAC5C;AACA;;AAED,QAAKyC,MAAL,EAAc;AACbA,MAAAA,MAAM,IAAI,GAAV;AACA,KAFD,MAEO;AACNA,MAAAA,MAAM,GAAG,EAAT;AACA;;AAED,UAAMQ,UAAU,GAAG7C,0BAA0B,CAAEC,QAAF,CAA7C;AACA,UAAM6C,WAAW,GAAG5C,2BAA2B,CAAED,QAAF,EAAYL,KAAZ,CAA/C;AACAyC,IAAAA,MAAM,IAAIQ,UAAU,GAAG,GAAb,GAAmBC,WAA7B;AACA;;AAED,SAAOT,MAAP;AACA;;eAEcjC,a","sourcesContent":["/**\n * Parts of this source were derived and modified from fast-react-render,\n * released under the MIT license.\n *\n * https://github.com/alt-j/fast-react-render\n *\n * Copyright (c) 2016 Andrey Morozov\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n/**\n * External dependencies\n */\nimport {\n\tisEmpty,\n\tcastArray,\n\tomit,\n\tstartsWith,\n\tkebabCase,\n\tisPlainObject,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tescapeHTML,\n\tescapeAttribute,\n\tisValidAttributeName,\n} from '@wordpress/escape-html';\n\n/**\n * Internal dependencies\n */\nimport { createContext, Fragment, StrictMode, forwardRef } from './react';\nimport RawHTML from './raw-html';\n\n/** @typedef {import('./react').WPElement} WPElement */\n\nconst { Provider, Consumer } = createContext( undefined );\nconst ForwardRef = forwardRef( () => {\n\treturn null;\n} );\n\n/**\n * Valid attribute types.\n *\n * @type {Set<string>}\n */\nconst ATTRIBUTES_TYPES = new Set( [ 'string', 'boolean', 'number' ] );\n\n/**\n * Element tags which can be self-closing.\n *\n * @type {Set<string>}\n */\nconst SELF_CLOSING_TAGS = new Set( [\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'keygen',\n\t'link',\n\t'meta',\n\t'param',\n\t'source',\n\t'track',\n\t'wbr',\n] );\n\n/**\n * Boolean attributes are attributes whose presence as being assigned is\n * meaningful, even if only empty.\n *\n * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes\n * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3\n *\n * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]\n * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 )\n * .reduce( ( result, tr ) => Object.assign( result, {\n * [ tr.firstChild.textContent.trim() ]: true\n * } ), {} ) ).sort();\n *\n * @type {Set<string>}\n */\nconst BOOLEAN_ATTRIBUTES = new Set( [\n\t'allowfullscreen',\n\t'allowpaymentrequest',\n\t'allowusermedia',\n\t'async',\n\t'autofocus',\n\t'autoplay',\n\t'checked',\n\t'controls',\n\t'default',\n\t'defer',\n\t'disabled',\n\t'download',\n\t'formnovalidate',\n\t'hidden',\n\t'ismap',\n\t'itemscope',\n\t'loop',\n\t'multiple',\n\t'muted',\n\t'nomodule',\n\t'novalidate',\n\t'open',\n\t'playsinline',\n\t'readonly',\n\t'required',\n\t'reversed',\n\t'selected',\n\t'typemustmatch',\n] );\n\n/**\n * Enumerated attributes are attributes which must be of a specific value form.\n * Like boolean attributes, these are meaningful if specified, even if not of a\n * valid enumerated value.\n *\n * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute\n * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3\n *\n * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]\n * .filter( ( tr ) => /^(\"(.+?)\";?\\s*)+/.test( tr.lastChild.textContent.trim() ) )\n * .reduce( ( result, tr ) => Object.assign( result, {\n * [ tr.firstChild.textContent.trim() ]: true\n * } ), {} ) ).sort();\n *\n * Some notable omissions:\n *\n * - `alt`: https://blog.whatwg.org/omit-alt\n *\n * @type {Set<string>}\n */\nconst ENUMERATED_ATTRIBUTES = new Set( [\n\t'autocapitalize',\n\t'autocomplete',\n\t'charset',\n\t'contenteditable',\n\t'crossorigin',\n\t'decoding',\n\t'dir',\n\t'draggable',\n\t'enctype',\n\t'formenctype',\n\t'formmethod',\n\t'http-equiv',\n\t'inputmode',\n\t'kind',\n\t'method',\n\t'preload',\n\t'scope',\n\t'shape',\n\t'spellcheck',\n\t'translate',\n\t'type',\n\t'wrap',\n] );\n\n/**\n * Set of CSS style properties which support assignment of unitless numbers.\n * Used in rendering of style properties, where `px` unit is assumed unless\n * property is included in this set or value is zero.\n *\n * Generated via:\n *\n * Object.entries( document.createElement( 'div' ).style )\n * .filter( ( [ key ] ) => (\n * ! /^(webkit|ms|moz)/.test( key ) &&\n * ( e.style[ key ] = 10 ) &&\n * e.style[ key ] === '10'\n * ) )\n * .map( ( [ key ] ) => key )\n * .sort();\n *\n * @type {Set<string>}\n */\nconst CSS_PROPERTIES_SUPPORTS_UNITLESS = new Set( [\n\t'animation',\n\t'animationIterationCount',\n\t'baselineShift',\n\t'borderImageOutset',\n\t'borderImageSlice',\n\t'borderImageWidth',\n\t'columnCount',\n\t'cx',\n\t'cy',\n\t'fillOpacity',\n\t'flexGrow',\n\t'flexShrink',\n\t'floodOpacity',\n\t'fontWeight',\n\t'gridColumnEnd',\n\t'gridColumnStart',\n\t'gridRowEnd',\n\t'gridRowStart',\n\t'lineHeight',\n\t'opacity',\n\t'order',\n\t'orphans',\n\t'r',\n\t'rx',\n\t'ry',\n\t'shapeImageThreshold',\n\t'stopOpacity',\n\t'strokeDasharray',\n\t'strokeDashoffset',\n\t'strokeMiterlimit',\n\t'strokeOpacity',\n\t'strokeWidth',\n\t'tabSize',\n\t'widows',\n\t'x',\n\t'y',\n\t'zIndex',\n\t'zoom',\n] );\n\n/**\n * Returns true if the specified string is prefixed by one of an array of\n * possible prefixes.\n *\n * @param {string} string String to check.\n * @param {string[]} prefixes Possible prefixes.\n *\n * @return {boolean} Whether string has prefix.\n */\nexport function hasPrefix( string, prefixes ) {\n\treturn prefixes.some( ( prefix ) => string.indexOf( prefix ) === 0 );\n}\n\n/**\n * Returns true if the given prop name should be ignored in attributes\n * serialization, or false otherwise.\n *\n * @param {string} attribute Attribute to check.\n *\n * @return {boolean} Whether attribute should be ignored.\n */\nfunction isInternalAttribute( attribute ) {\n\treturn 'key' === attribute || 'children' === attribute;\n}\n\n/**\n * Returns the normal form of the element's attribute value for HTML.\n *\n * @param {string} attribute Attribute name.\n * @param {*} value Non-normalized attribute value.\n *\n * @return {*} Normalized attribute value.\n */\nfunction getNormalAttributeValue( attribute, value ) {\n\tswitch ( attribute ) {\n\t\tcase 'style':\n\t\t\treturn renderStyle( value );\n\t}\n\n\treturn value;\n}\n\n/**\n * Returns the normal form of the element's attribute name for HTML.\n *\n * @param {string} attribute Non-normalized attribute name.\n *\n * @return {string} Normalized attribute name.\n */\nfunction getNormalAttributeName( attribute ) {\n\tswitch ( attribute ) {\n\t\tcase 'htmlFor':\n\t\t\treturn 'for';\n\n\t\tcase 'className':\n\t\t\treturn 'class';\n\t}\n\n\treturn attribute.toLowerCase();\n}\n\n/**\n * Returns the normal form of the style property name for HTML.\n *\n * - Converts property names to kebab-case, e.g. 'backgroundColor' → 'background-color'\n * - Leaves custom attributes alone, e.g. '--myBackgroundColor' → '--myBackgroundColor'\n * - Converts vendor-prefixed property names to -kebab-case, e.g. 'MozTransform' → '-moz-transform'\n *\n * @param {string} property Property name.\n *\n * @return {string} Normalized property name.\n */\nfunction getNormalStylePropertyName( property ) {\n\tif ( startsWith( property, '--' ) ) {\n\t\treturn property;\n\t}\n\n\tif ( hasPrefix( property, [ 'ms', 'O', 'Moz', 'Webkit' ] ) ) {\n\t\treturn '-' + kebabCase( property );\n\t}\n\n\treturn kebabCase( property );\n}\n\n/**\n * Returns the normal form of the style property value for HTML. Appends a\n * default pixel unit if numeric, not a unitless property, and not zero.\n *\n * @param {string} property Property name.\n * @param {*} value Non-normalized property value.\n *\n * @return {*} Normalized property value.\n */\nfunction getNormalStylePropertyValue( property, value ) {\n\tif (\n\t\ttypeof value === 'number' &&\n\t\t0 !== value &&\n\t\t! CSS_PROPERTIES_SUPPORTS_UNITLESS.has( property )\n\t) {\n\t\treturn value + 'px';\n\t}\n\n\treturn value;\n}\n\n/**\n * Serializes a React element to string.\n *\n * @param {import('react').ReactNode} element Element to serialize.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized element.\n */\nexport function renderElement( element, context, legacyContext = {} ) {\n\tif ( null === element || undefined === element || false === element ) {\n\t\treturn '';\n\t}\n\n\tif ( Array.isArray( element ) ) {\n\t\treturn renderChildren( element, context, legacyContext );\n\t}\n\n\tswitch ( typeof element ) {\n\t\tcase 'string':\n\t\t\treturn escapeHTML( element );\n\n\t\tcase 'number':\n\t\t\treturn element.toString();\n\t}\n\n\tconst {\n\t\ttype,\n\t\tprops,\n\t} = /** @type {{type?: any, props?: any}} */ ( element );\n\n\tswitch ( type ) {\n\t\tcase StrictMode:\n\t\tcase Fragment:\n\t\t\treturn renderChildren( props.children, context, legacyContext );\n\n\t\tcase RawHTML:\n\t\t\tconst { children, ...wrapperProps } = props;\n\n\t\t\treturn renderNativeComponent(\n\t\t\t\tisEmpty( wrapperProps ) ? null : 'div',\n\t\t\t\t{\n\t\t\t\t\t...wrapperProps,\n\t\t\t\t\tdangerouslySetInnerHTML: { __html: children },\n\t\t\t\t},\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\t}\n\n\tswitch ( typeof type ) {\n\t\tcase 'string':\n\t\t\treturn renderNativeComponent( type, props, context, legacyContext );\n\n\t\tcase 'function':\n\t\t\tif (\n\t\t\t\ttype.prototype &&\n\t\t\t\ttypeof type.prototype.render === 'function'\n\t\t\t) {\n\t\t\t\treturn renderComponent( type, props, context, legacyContext );\n\t\t\t}\n\n\t\t\treturn renderElement(\n\t\t\t\ttype( props, legacyContext ),\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\t}\n\n\tswitch ( type && type.$$typeof ) {\n\t\tcase Provider.$$typeof:\n\t\t\treturn renderChildren( props.children, props.value, legacyContext );\n\n\t\tcase Consumer.$$typeof:\n\t\t\treturn renderElement(\n\t\t\t\tprops.children( context || type._currentValue ),\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\n\t\tcase ForwardRef.$$typeof:\n\t\t\treturn renderElement(\n\t\t\t\ttype.render( props ),\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\t}\n\n\treturn '';\n}\n\n/**\n * Serializes a native component type to string.\n *\n * @param {?string} type Native component type to serialize, or null if\n * rendering as fragment of children content.\n * @param {Object} props Props object.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized element.\n */\nexport function renderNativeComponent(\n\ttype,\n\tprops,\n\tcontext,\n\tlegacyContext = {}\n) {\n\tlet content = '';\n\tif ( type === 'textarea' && props.hasOwnProperty( 'value' ) ) {\n\t\t// Textarea children can be assigned as value prop. If it is, render in\n\t\t// place of children. Ensure to omit so it is not assigned as attribute\n\t\t// as well.\n\t\tcontent = renderChildren( props.value, context, legacyContext );\n\t\tprops = omit( props, 'value' );\n\t} else if (\n\t\tprops.dangerouslySetInnerHTML &&\n\t\ttypeof props.dangerouslySetInnerHTML.__html === 'string'\n\t) {\n\t\t// Dangerous content is left unescaped.\n\t\tcontent = props.dangerouslySetInnerHTML.__html;\n\t} else if ( typeof props.children !== 'undefined' ) {\n\t\tcontent = renderChildren( props.children, context, legacyContext );\n\t}\n\n\tif ( ! type ) {\n\t\treturn content;\n\t}\n\n\tconst attributes = renderAttributes( props );\n\n\tif ( SELF_CLOSING_TAGS.has( type ) ) {\n\t\treturn '<' + type + attributes + '/>';\n\t}\n\n\treturn '<' + type + attributes + '>' + content + '</' + type + '>';\n}\n\n/** @typedef {import('./react').WPComponent} WPComponent */\n\n/**\n * Serializes a non-native component type to string.\n *\n * @param {WPComponent} Component Component type to serialize.\n * @param {Object} props Props object.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized element\n */\nexport function renderComponent(\n\tComponent,\n\tprops,\n\tcontext,\n\tlegacyContext = {}\n) {\n\tconst instance = new /** @type {import('react').ComponentClass} */ ( Component )(\n\t\tprops,\n\t\tlegacyContext\n\t);\n\n\tif (\n\t\ttypeof (\n\t\t\t// Ignore reason: Current prettier reformats parens and mangles type assertion\n\t\t\t// prettier-ignore\n\t\t\t/** @type {{getChildContext?: () => unknown}} */ ( instance ).getChildContext\n\t\t) === 'function'\n\t) {\n\t\tObject.assign(\n\t\t\tlegacyContext,\n\t\t\t/** @type {{getChildContext?: () => unknown}} */ ( instance ).getChildContext()\n\t\t);\n\t}\n\n\tconst html = renderElement( instance.render(), context, legacyContext );\n\n\treturn html;\n}\n\n/**\n * Serializes an array of children to string.\n *\n * @param {import('react').ReactNodeArray} children Children to serialize.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized children.\n */\nfunction renderChildren( children, context, legacyContext = {} ) {\n\tlet result = '';\n\n\tchildren = castArray( children );\n\n\tfor ( let i = 0; i < children.length; i++ ) {\n\t\tconst child = children[ i ];\n\n\t\tresult += renderElement( child, context, legacyContext );\n\t}\n\n\treturn result;\n}\n\n/**\n * Renders a props object as a string of HTML attributes.\n *\n * @param {Object} props Props object.\n *\n * @return {string} Attributes string.\n */\nexport function renderAttributes( props ) {\n\tlet result = '';\n\n\tfor ( const key in props ) {\n\t\tconst attribute = getNormalAttributeName( key );\n\t\tif ( ! isValidAttributeName( attribute ) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet value = getNormalAttributeValue( key, props[ key ] );\n\n\t\t// If value is not of serializeable type, skip.\n\t\tif ( ! ATTRIBUTES_TYPES.has( typeof value ) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Don't render internal attribute names.\n\t\tif ( isInternalAttribute( key ) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isBooleanAttribute = BOOLEAN_ATTRIBUTES.has( attribute );\n\n\t\t// Boolean attribute should be omitted outright if its value is false.\n\t\tif ( isBooleanAttribute && value === false ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isMeaningfulAttribute =\n\t\t\tisBooleanAttribute ||\n\t\t\thasPrefix( key, [ 'data-', 'aria-' ] ) ||\n\t\t\tENUMERATED_ATTRIBUTES.has( attribute );\n\n\t\t// Only write boolean value as attribute if meaningful.\n\t\tif ( typeof value === 'boolean' && ! isMeaningfulAttribute ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult += ' ' + attribute;\n\n\t\t// Boolean attributes should write attribute name, but without value.\n\t\t// Mere presence of attribute name is effective truthiness.\n\t\tif ( isBooleanAttribute ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ( typeof value === 'string' ) {\n\t\t\tvalue = escapeAttribute( value );\n\t\t}\n\n\t\tresult += '=\"' + value + '\"';\n\t}\n\n\treturn result;\n}\n\n/**\n * Renders a style object as a string attribute value.\n *\n * @param {Object} style Style object.\n *\n * @return {string} Style attribute value.\n */\nexport function renderStyle( style ) {\n\t// Only generate from object, e.g. tolerate string value.\n\tif ( ! isPlainObject( style ) ) {\n\t\treturn style;\n\t}\n\n\tlet result;\n\n\tfor ( const property in style ) {\n\t\tconst value = style[ property ];\n\t\tif ( null === value || undefined === value ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ( result ) {\n\t\t\tresult += ';';\n\t\t} else {\n\t\t\tresult = '';\n\t\t}\n\n\t\tconst normalName = getNormalStylePropertyName( property );\n\t\tconst normalValue = getNormalStylePropertyValue( property, value );\n\t\tresult += normalName + ':' + normalValue;\n\t}\n\n\treturn result;\n}\n\nexport default renderElement;\n"]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { createElement } from './react'; // Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly.
4
+ import { Children, createElement } from './react'; // Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly.
5
5
 
6
6
  /** @typedef {{children: string} & import('react').ComponentPropsWithoutRef<'div'>} RawHTMLProps */
7
7
 
@@ -11,21 +11,30 @@ import { createElement } from './react'; // Disable reason: JSDoc linter doesn't
11
11
  * To preserve additional props, a `div` wrapper _will_ be created if any props
12
12
  * aside from `children` are passed.
13
13
  *
14
- * @param {RawHTMLProps} props Children should be a string of HTML. Other props
15
- * will be passed through to div wrapper.
14
+ * @param {RawHTMLProps} props Children should be a string of HTML or an array
15
+ * of strings. Other props will be passed through
16
+ * to the div wrapper.
16
17
  *
17
18
  * @return {JSX.Element} Dangerously-rendering component.
18
19
  */
19
20
 
20
- export default function RawHTML({
21
- children,
22
- ...props
23
- }) {
24
- // The DIV wrapper will be stripped by serializer, unless there are
25
- // non-children props present.
21
+ export default function RawHTML(_ref) {
22
+ let {
23
+ children,
24
+ ...props
25
+ } = _ref;
26
+ let rawHtml = ''; // Cast children as an array, and concatenate each element if it is a string.
27
+
28
+ Children.toArray(children).forEach(child => {
29
+ if (typeof child === 'string' && child.trim() !== '') {
30
+ rawHtml += child;
31
+ }
32
+ }); // The `div` wrapper will be stripped by the `renderElement` serializer in
33
+ // `./serialize.js` unless there are non-children props present.
34
+
26
35
  return createElement('div', {
27
36
  dangerouslySetInnerHTML: {
28
- __html: children
37
+ __html: rawHtml
29
38
  },
30
39
  ...props
31
40
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/raw-html.js"],"names":["createElement","RawHTML","children","props","dangerouslySetInnerHTML","__html"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,SAA9B,C,CAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,OAAT,CAAkB;AAAEC,EAAAA,QAAF;AAAY,KAAGC;AAAf,CAAlB,EAA2C;AACzD;AACA;AACA,SAAOH,aAAa,CAAE,KAAF,EAAS;AAC5BI,IAAAA,uBAAuB,EAAE;AAAEC,MAAAA,MAAM,EAAEH;AAAV,KADG;AAE5B,OAAGC;AAFyB,GAAT,CAApB;AAIA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { createElement } from './react';\n\n// Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly.\n/** @typedef {{children: string} & import('react').ComponentPropsWithoutRef<'div'>} RawHTMLProps */\n\n/**\n * Component used as equivalent of Fragment with unescaped HTML, in cases where\n * it is desirable to render dangerous HTML without needing a wrapper element.\n * To preserve additional props, a `div` wrapper _will_ be created if any props\n * aside from `children` are passed.\n *\n * @param {RawHTMLProps} props Children should be a string of HTML. Other props\n * will be passed through to div wrapper.\n *\n * @return {JSX.Element} Dangerously-rendering component.\n */\nexport default function RawHTML( { children, ...props } ) {\n\t// The DIV wrapper will be stripped by serializer, unless there are\n\t// non-children props present.\n\treturn createElement( 'div', {\n\t\tdangerouslySetInnerHTML: { __html: children },\n\t\t...props,\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/element/src/raw-html.js"],"names":["Children","createElement","RawHTML","children","props","rawHtml","toArray","forEach","child","trim","dangerouslySetInnerHTML","__html"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,aAAnB,QAAwC,SAAxC,C,CAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,OAAT,OAA2C;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAY,OAAGC;AAAf,GAAyB;AACzD,MAAIC,OAAO,GAAG,EAAd,CADyD,CAGzD;;AACAL,EAAAA,QAAQ,CAACM,OAAT,CAAkBH,QAAlB,EAA6BI,OAA7B,CAAwCC,KAAF,IAAa;AAClD,QAAK,OAAOA,KAAP,KAAiB,QAAjB,IAA6BA,KAAK,CAACC,IAAN,OAAiB,EAAnD,EAAwD;AACvDJ,MAAAA,OAAO,IAAIG,KAAX;AACA;AACD,GAJD,EAJyD,CAUzD;AACA;;AACA,SAAOP,aAAa,CAAE,KAAF,EAAS;AAC5BS,IAAAA,uBAAuB,EAAE;AAAEC,MAAAA,MAAM,EAAEN;AAAV,KADG;AAE5B,OAAGD;AAFyB,GAAT,CAApB;AAIA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { Children, createElement } from './react';\n\n// Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly.\n/** @typedef {{children: string} & import('react').ComponentPropsWithoutRef<'div'>} RawHTMLProps */\n\n/**\n * Component used as equivalent of Fragment with unescaped HTML, in cases where\n * it is desirable to render dangerous HTML without needing a wrapper element.\n * To preserve additional props, a `div` wrapper _will_ be created if any props\n * aside from `children` are passed.\n *\n * @param {RawHTMLProps} props Children should be a string of HTML or an array\n * of strings. Other props will be passed through\n * to the div wrapper.\n *\n * @return {JSX.Element} Dangerously-rendering component.\n */\nexport default function RawHTML( { children, ...props } ) {\n\tlet rawHtml = '';\n\n\t// Cast children as an array, and concatenate each element if it is a string.\n\tChildren.toArray( children ).forEach( ( child ) => {\n\t\tif ( typeof child === 'string' && child.trim() !== '' ) {\n\t\t\trawHtml += child;\n\t\t}\n\t} );\n\n\t// The `div` wrapper will be stripped by the `renderElement` serializer in\n\t// `./serialize.js` unless there are non-children props present.\n\treturn createElement( 'div', {\n\t\tdangerouslySetInnerHTML: { __html: rawHtml },\n\t\t...props,\n\t} );\n}\n"]}
@@ -2,46 +2,14 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { AppRegistry } from 'react-native';
5
- import { omit } from 'lodash';
6
5
  /**
7
- * WordPress dependencies
8
- */
9
-
10
- import { applyFilters, doAction } from '@wordpress/hooks';
11
- /**
12
- * Internal dependencies
13
- */
14
-
15
- import { Component, cloneElement } from './react';
16
-
17
- const render = (element, id) => {
18
- class App extends Component {
19
- constructor() {
20
- super(...arguments);
21
- const parentProps = omit(this.props || {}, ['rootTag']);
22
- doAction('native.pre-render', parentProps);
23
- this.filteredProps = applyFilters('native.block_editor_props', parentProps);
24
- }
25
-
26
- componentDidMount() {
27
- doAction('native.render', this.filteredProps);
28
- }
29
-
30
- render() {
31
- return cloneElement(element, this.filteredProps);
32
- }
33
-
34
- }
35
-
36
- AppRegistry.registerComponent(id, () => App);
37
- };
38
- /**
39
- * Render a given element on Native.
40
- * This actually returns a componentProvider that can be registered with `AppRegistry.registerComponent`
6
+ * Registers an app root component allowing the native system to run the app.
41
7
  *
42
- * @param {WPElement} element Element to render.
8
+ * @param {string} appKey Unique app name identifier.
9
+ * @param {Function} componentProvider Function returning the app root React component.
43
10
  */
44
11
 
45
-
46
- export { render };
12
+ export const registerComponent = (appKey, componentProvider) => {
13
+ AppRegistry.registerComponent(appKey, componentProvider);
14
+ };
47
15
  //# sourceMappingURL=react-platform.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/react-platform.native.js"],"names":["AppRegistry","omit","applyFilters","doAction","Component","cloneElement","render","element","id","App","constructor","arguments","parentProps","props","filteredProps","componentDidMount","registerComponent"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,cAA5B;AACA,SAASC,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,YAAT,EAAuBC,QAAvB,QAAuC,kBAAvC;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,YAApB,QAAwC,SAAxC;;AAEA,MAAMC,MAAM,GAAG,CAAEC,OAAF,EAAWC,EAAX,KAAmB;AACjC,QAAMC,GAAN,SAAkBL,SAAlB,CAA4B;AAC3BM,IAAAA,WAAW,GAAG;AACb,YAAO,GAAGC,SAAV;AAEA,YAAMC,WAAW,GAAGX,IAAI,CAAE,KAAKY,KAAL,IAAc,EAAhB,EAAoB,CAAE,SAAF,CAApB,CAAxB;AAEAV,MAAAA,QAAQ,CAAE,mBAAF,EAAuBS,WAAvB,CAAR;AAEA,WAAKE,aAAL,GAAqBZ,YAAY,CAChC,2BADgC,EAEhCU,WAFgC,CAAjC;AAIA;;AAEDG,IAAAA,iBAAiB,GAAG;AACnBZ,MAAAA,QAAQ,CAAE,eAAF,EAAmB,KAAKW,aAAxB,CAAR;AACA;;AAEDR,IAAAA,MAAM,GAAG;AACR,aAAOD,YAAY,CAAEE,OAAF,EAAW,KAAKO,aAAhB,CAAnB;AACA;;AApB0B;;AAuB5Bd,EAAAA,WAAW,CAACgB,iBAAZ,CAA+BR,EAA/B,EAAmC,MAAMC,GAAzC;AACA,CAzBD;AA2BA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASH,MAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { AppRegistry } from 'react-native';\nimport { omit } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { applyFilters, doAction } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { Component, cloneElement } from './react';\n\nconst render = ( element, id ) => {\n\tclass App extends Component {\n\t\tconstructor() {\n\t\t\tsuper( ...arguments );\n\n\t\t\tconst parentProps = omit( this.props || {}, [ 'rootTag' ] );\n\n\t\t\tdoAction( 'native.pre-render', parentProps );\n\n\t\t\tthis.filteredProps = applyFilters(\n\t\t\t\t'native.block_editor_props',\n\t\t\t\tparentProps\n\t\t\t);\n\t\t}\n\n\t\tcomponentDidMount() {\n\t\t\tdoAction( 'native.render', this.filteredProps );\n\t\t}\n\n\t\trender() {\n\t\t\treturn cloneElement( element, this.filteredProps );\n\t\t}\n\t}\n\n\tAppRegistry.registerComponent( id, () => App );\n};\n\n/**\n * Render a given element on Native.\n * This actually returns a componentProvider that can be registered with `AppRegistry.registerComponent`\n *\n * @param {WPElement} element Element to render.\n */\nexport { render };\n"]}
1
+ {"version":3,"sources":["@wordpress/element/src/react-platform.native.js"],"names":["AppRegistry","registerComponent","appKey","componentProvider"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,cAA5B;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,iBAAiB,GAAG,CAAEC,MAAF,EAAUC,iBAAV,KAAiC;AACjEH,EAAAA,WAAW,CAACC,iBAAZ,CAA+BC,MAA/B,EAAuCC,iBAAvC;AACA,CAFM","sourcesContent":["/**\n * External dependencies\n */\nimport { AppRegistry } from 'react-native';\n\n/**\n * Registers an app root component allowing the native system to run the app.\n *\n * @param {string} appKey Unique app name identifier.\n * @param {Function} componentProvider Function returning the app root React component.\n */\nexport const registerComponent = ( appKey, componentProvider ) => {\n\tAppRegistry.registerComponent( appKey, componentProvider );\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- // eslint-disable-next-line no-restricted-imports
4
+ // eslint-disable-next-line @typescript-eslint/no-restricted-imports
5
5
  import { Children, cloneElement, Component, createContext, createElement, createRef, forwardRef, Fragment, isValidElement, memo, StrictMode, useState, useEffect, useContext, useReducer, useCallback, useMemo, useRef, useImperativeHandle, useLayoutEffect, useDebugValue, lazy, Suspense } from 'react';
6
6
  import { isString } from 'lodash';
7
7
  /**
@@ -179,7 +179,11 @@ export { Suspense };
179
179
  * @return {Array} The concatenated value.
180
180
  */
181
181
 
182
- export function concatChildren(...childrenArguments) {
182
+ export function concatChildren() {
183
+ for (var _len = arguments.length, childrenArguments = new Array(_len), _key = 0; _key < _len; _key++) {
184
+ childrenArguments[_key] = arguments[_key];
185
+ }
186
+
183
187
  return childrenArguments.reduce((accumulator, children, i) => {
184
188
  Children.forEach(children, (child, j) => {
185
189
  if (child && 'string' !== typeof child) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/react.js"],"names":["Children","cloneElement","Component","createContext","createElement","createRef","forwardRef","Fragment","isValidElement","memo","StrictMode","useState","useEffect","useContext","useReducer","useCallback","useMemo","useRef","useImperativeHandle","useLayoutEffect","useDebugValue","lazy","Suspense","isString","concatChildren","childrenArguments","reduce","accumulator","children","i","forEach","child","j","key","join","push","switchChildrenNodeName","nodeName","map","elt","index","childrenProp","props"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SACCA,QADD,EAECC,YAFD,EAGCC,SAHD,EAICC,aAJD,EAKCC,aALD,EAMCC,SAND,EAOCC,UAPD,EAQCC,QARD,EASCC,cATD,EAUCC,IAVD,EAWCC,UAXD,EAYCC,QAZD,EAaCC,SAbD,EAcCC,UAdD,EAeCC,UAfD,EAgBCC,WAhBD,EAiBCC,OAjBD,EAkBCC,MAlBD,EAmBCC,mBAnBD,EAoBCC,eApBD,EAqBCC,aArBD,EAsBCC,IAtBD,EAuBCC,QAvBD,QAwBO,OAxBP;AAyBA,SAASC,QAAT,QAAyB,QAAzB;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AACA,SAASvB,QAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,YAAT;AAEA;AACA;AACA;;AACA,SAASC,SAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,SAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,UAAT;AAEA;AACA;AACA;;AACA,SAASC,QAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,cAAT;AAEA;AACA;AACA;;AACA,SAASC,IAAT;AAEA;AACA;AACA;;AACA,SAASC,UAAT;AAEA;AACA;AACA;;AACA,SAASK,WAAT;AAEA;AACA;AACA;;AACA,SAASF,UAAT;AAEA;AACA;AACA;;AACA,SAASO,aAAT;AAEA;AACA;AACA;;AACA,SAASR,SAAT;AAEA;AACA;AACA;;AACA,SAASM,mBAAT;AAEA;AACA;AACA;;AACA,SAASC,eAAT;AAEA;AACA;AACA;;AACA,SAASH,OAAT;AAEA;AACA;AACA;;AACA,SAASF,UAAT;AAEA;AACA;AACA;;AACA,SAASG,MAAT;AAEA;AACA;AACA;;AACA,SAASN,QAAT;AAEA;AACA;AACA;;AACA,SAASU,IAAT;AAEA;AACA;AACA;;AACA,SAASC,QAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,cAAT,CAAyB,GAAGC,iBAA5B,EAAgD;AACtD,SAAOA,iBAAiB,CAACC,MAAlB,CAA0B,CAAEC,WAAF,EAAeC,QAAf,EAAyBC,CAAzB,KAAgC;AAChE7B,IAAAA,QAAQ,CAAC8B,OAAT,CAAkBF,QAAlB,EAA4B,CAAEG,KAAF,EAASC,CAAT,KAAgB;AAC3C,UAAKD,KAAK,IAAI,aAAa,OAAOA,KAAlC,EAA0C;AACzCA,QAAAA,KAAK,GAAG9B,YAAY,CAAE8B,KAAF,EAAS;AAC5BE,UAAAA,GAAG,EAAE,CAAEJ,CAAF,EAAKG,CAAL,EAASE,IAAT;AADuB,SAAT,CAApB;AAGA;;AAEDP,MAAAA,WAAW,CAACQ,IAAZ,CAAkBJ,KAAlB;AACA,KARD;AAUA,WAAOJ,WAAP;AACA,GAZM,EAYJ,EAZI,CAAP;AAaA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASS,sBAAT,CAAiCR,QAAjC,EAA2CS,QAA3C,EAAsD;AAC5D,SACCT,QAAQ,IACR5B,QAAQ,CAACsC,GAAT,CAAcV,QAAd,EAAwB,CAAEW,GAAF,EAAOC,KAAP,KAAkB;AACzC,QAAKjB,QAAQ,CAAEgB,GAAF,CAAb,EAAuB;AACtB,aAAOnC,aAAa,CAAEiC,QAAF,EAAY;AAAEJ,QAAAA,GAAG,EAAEO;AAAP,OAAZ,EAA4BD,GAA5B,CAApB;AACA;;AACD,UAAM;AAAEX,MAAAA,QAAQ,EAAEa,YAAZ;AAA0B,SAAGC;AAA7B,QAAuCH,GAAG,CAACG,KAAjD;AACA,WAAOtC,aAAa,CACnBiC,QADmB,EAEnB;AAAEJ,MAAAA,GAAG,EAAEO,KAAP;AAAc,SAAGE;AAAjB,KAFmB,EAGnBD,YAHmB,CAApB;AAKA,GAVD,CAFD;AAcA","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport {\n\tChildren,\n\tcloneElement,\n\tComponent,\n\tcreateContext,\n\tcreateElement,\n\tcreateRef,\n\tforwardRef,\n\tFragment,\n\tisValidElement,\n\tmemo,\n\tStrictMode,\n\tuseState,\n\tuseEffect,\n\tuseContext,\n\tuseReducer,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseLayoutEffect,\n\tuseDebugValue,\n\tlazy,\n\tSuspense,\n} from 'react';\nimport { isString } from 'lodash';\n\n/**\n * Object containing a React element.\n *\n * @typedef {import('react').ReactElement} WPElement\n */\n\n/**\n * Object containing a React component.\n *\n * @typedef {import('react').ComponentType} WPComponent\n */\n\n/**\n * Object containing a React synthetic event.\n *\n * @typedef {import('react').SyntheticEvent} WPSyntheticEvent\n */\n\n/**\n * Object that provides utilities for dealing with React children.\n */\nexport { Children };\n\n/**\n * Creates a copy of an element with extended props.\n *\n * @param {WPElement} element Element\n * @param {?Object} props Props to apply to cloned element\n *\n * @return {WPElement} Cloned element.\n */\nexport { cloneElement };\n\n/**\n * A base class to create WordPress Components (Refs, state and lifecycle hooks)\n */\nexport { Component };\n\n/**\n * Creates a context object containing two components: a provider and consumer.\n *\n * @param {Object} defaultValue A default data stored in the context.\n *\n * @return {Object} Context object.\n */\nexport { createContext };\n\n/**\n * Returns a new element of given type. Type can be either a string tag name or\n * another function which itself returns an element.\n *\n * @param {?(string|Function)} type Tag name or element creator\n * @param {Object} props Element properties, either attribute\n * set to apply to DOM node or values to\n * pass through to element creator\n * @param {...WPElement} children Descendant elements\n *\n * @return {WPElement} Element.\n */\nexport { createElement };\n\n/**\n * Returns an object tracking a reference to a rendered element via its\n * `current` property as either a DOMElement or Element, dependent upon the\n * type of element rendered with the ref attribute.\n *\n * @return {Object} Ref object.\n */\nexport { createRef };\n\n/**\n * Component enhancer used to enable passing a ref to its wrapped component.\n * Pass a function argument which receives `props` and `ref` as its arguments,\n * returning an element using the forwarded ref. The return value is a new\n * component which forwards its ref.\n *\n * @param {Function} forwarder Function passed `props` and `ref`, expected to\n * return an element.\n *\n * @return {WPComponent} Enhanced component.\n */\nexport { forwardRef };\n\n/**\n * A component which renders its children without any wrapping element.\n */\nexport { Fragment };\n\n/**\n * Checks if an object is a valid WPElement.\n *\n * @param {Object} objectToCheck The object to be checked.\n *\n * @return {boolean} true if objectToTest is a valid WPElement and false otherwise.\n */\nexport { isValidElement };\n\n/**\n * @see https://reactjs.org/docs/react-api.html#reactmemo\n */\nexport { memo };\n\n/**\n * Component that activates additional checks and warnings for its descendants.\n */\nexport { StrictMode };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#usecallback\n */\nexport { useCallback };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#usecontext\n */\nexport { useContext };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#usedebugvalue\n */\nexport { useDebugValue };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#useeffect\n */\nexport { useEffect };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#useimperativehandle\n */\nexport { useImperativeHandle };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#uselayouteffect\n */\nexport { useLayoutEffect };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#usememo\n */\nexport { useMemo };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#usereducer\n */\nexport { useReducer };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#useref\n */\nexport { useRef };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#usestate\n */\nexport { useState };\n\n/**\n * @see https://reactjs.org/docs/react-api.html#reactlazy\n */\nexport { lazy };\n\n/**\n * @see https://reactjs.org/docs/react-api.html#reactsuspense\n */\nexport { Suspense };\n\n/**\n * Concatenate two or more React children objects.\n *\n * @param {...?Object} childrenArguments Array of children arguments (array of arrays/strings/objects) to concatenate.\n *\n * @return {Array} The concatenated value.\n */\nexport function concatChildren( ...childrenArguments ) {\n\treturn childrenArguments.reduce( ( accumulator, children, i ) => {\n\t\tChildren.forEach( children, ( child, j ) => {\n\t\t\tif ( child && 'string' !== typeof child ) {\n\t\t\t\tchild = cloneElement( child, {\n\t\t\t\t\tkey: [ i, j ].join(),\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\taccumulator.push( child );\n\t\t} );\n\n\t\treturn accumulator;\n\t}, [] );\n}\n\n/**\n * Switches the nodeName of all the elements in the children object.\n *\n * @param {?Object} children Children object.\n * @param {string} nodeName Node name.\n *\n * @return {?Object} The updated children object.\n */\nexport function switchChildrenNodeName( children, nodeName ) {\n\treturn (\n\t\tchildren &&\n\t\tChildren.map( children, ( elt, index ) => {\n\t\t\tif ( isString( elt ) ) {\n\t\t\t\treturn createElement( nodeName, { key: index }, elt );\n\t\t\t}\n\t\t\tconst { children: childrenProp, ...props } = elt.props;\n\t\t\treturn createElement(\n\t\t\t\tnodeName,\n\t\t\t\t{ key: index, ...props },\n\t\t\t\tchildrenProp\n\t\t\t);\n\t\t} )\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/element/src/react.js"],"names":["Children","cloneElement","Component","createContext","createElement","createRef","forwardRef","Fragment","isValidElement","memo","StrictMode","useState","useEffect","useContext","useReducer","useCallback","useMemo","useRef","useImperativeHandle","useLayoutEffect","useDebugValue","lazy","Suspense","isString","concatChildren","childrenArguments","reduce","accumulator","children","i","forEach","child","j","key","join","push","switchChildrenNodeName","nodeName","map","elt","index","childrenProp","props"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SACCA,QADD,EAECC,YAFD,EAGCC,SAHD,EAICC,aAJD,EAKCC,aALD,EAMCC,SAND,EAOCC,UAPD,EAQCC,QARD,EASCC,cATD,EAUCC,IAVD,EAWCC,UAXD,EAYCC,QAZD,EAaCC,SAbD,EAcCC,UAdD,EAeCC,UAfD,EAgBCC,WAhBD,EAiBCC,OAjBD,EAkBCC,MAlBD,EAmBCC,mBAnBD,EAoBCC,eApBD,EAqBCC,aArBD,EAsBCC,IAtBD,EAuBCC,QAvBD,QAwBO,OAxBP;AAyBA,SAASC,QAAT,QAAyB,QAAzB;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AACA,SAASvB,QAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,YAAT;AAEA;AACA;AACA;;AACA,SAASC,SAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,SAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,UAAT;AAEA;AACA;AACA;;AACA,SAASC,QAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,cAAT;AAEA;AACA;AACA;;AACA,SAASC,IAAT;AAEA;AACA;AACA;;AACA,SAASC,UAAT;AAEA;AACA;AACA;;AACA,SAASK,WAAT;AAEA;AACA;AACA;;AACA,SAASF,UAAT;AAEA;AACA;AACA;;AACA,SAASO,aAAT;AAEA;AACA;AACA;;AACA,SAASR,SAAT;AAEA;AACA;AACA;;AACA,SAASM,mBAAT;AAEA;AACA;AACA;;AACA,SAASC,eAAT;AAEA;AACA;AACA;;AACA,SAASH,OAAT;AAEA;AACA;AACA;;AACA,SAASF,UAAT;AAEA;AACA;AACA;;AACA,SAASG,MAAT;AAEA;AACA;AACA;;AACA,SAASN,QAAT;AAEA;AACA;AACA;;AACA,SAASU,IAAT;AAEA;AACA;AACA;;AACA,SAASC,QAAT;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,cAAT,GAAgD;AAAA,oCAApBC,iBAAoB;AAApBA,IAAAA,iBAAoB;AAAA;;AACtD,SAAOA,iBAAiB,CAACC,MAAlB,CAA0B,CAAEC,WAAF,EAAeC,QAAf,EAAyBC,CAAzB,KAAgC;AAChE7B,IAAAA,QAAQ,CAAC8B,OAAT,CAAkBF,QAAlB,EAA4B,CAAEG,KAAF,EAASC,CAAT,KAAgB;AAC3C,UAAKD,KAAK,IAAI,aAAa,OAAOA,KAAlC,EAA0C;AACzCA,QAAAA,KAAK,GAAG9B,YAAY,CAAE8B,KAAF,EAAS;AAC5BE,UAAAA,GAAG,EAAE,CAAEJ,CAAF,EAAKG,CAAL,EAASE,IAAT;AADuB,SAAT,CAApB;AAGA;;AAEDP,MAAAA,WAAW,CAACQ,IAAZ,CAAkBJ,KAAlB;AACA,KARD;AAUA,WAAOJ,WAAP;AACA,GAZM,EAYJ,EAZI,CAAP;AAaA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASS,sBAAT,CAAiCR,QAAjC,EAA2CS,QAA3C,EAAsD;AAC5D,SACCT,QAAQ,IACR5B,QAAQ,CAACsC,GAAT,CAAcV,QAAd,EAAwB,CAAEW,GAAF,EAAOC,KAAP,KAAkB;AACzC,QAAKjB,QAAQ,CAAEgB,GAAF,CAAb,EAAuB;AACtB,aAAOnC,aAAa,CAAEiC,QAAF,EAAY;AAAEJ,QAAAA,GAAG,EAAEO;AAAP,OAAZ,EAA4BD,GAA5B,CAApB;AACA;;AACD,UAAM;AAAEX,MAAAA,QAAQ,EAAEa,YAAZ;AAA0B,SAAGC;AAA7B,QAAuCH,GAAG,CAACG,KAAjD;AACA,WAAOtC,aAAa,CACnBiC,QADmB,EAEnB;AAAEJ,MAAAA,GAAG,EAAEO,KAAP;AAAc,SAAGE;AAAjB,KAFmB,EAGnBD,YAHmB,CAApB;AAKA,GAVD,CAFD;AAcA","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line @typescript-eslint/no-restricted-imports\nimport {\n\tChildren,\n\tcloneElement,\n\tComponent,\n\tcreateContext,\n\tcreateElement,\n\tcreateRef,\n\tforwardRef,\n\tFragment,\n\tisValidElement,\n\tmemo,\n\tStrictMode,\n\tuseState,\n\tuseEffect,\n\tuseContext,\n\tuseReducer,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseLayoutEffect,\n\tuseDebugValue,\n\tlazy,\n\tSuspense,\n} from 'react';\nimport { isString } from 'lodash';\n\n/**\n * Object containing a React element.\n *\n * @typedef {import('react').ReactElement} WPElement\n */\n\n/**\n * Object containing a React component.\n *\n * @typedef {import('react').ComponentType} WPComponent\n */\n\n/**\n * Object containing a React synthetic event.\n *\n * @typedef {import('react').SyntheticEvent} WPSyntheticEvent\n */\n\n/**\n * Object that provides utilities for dealing with React children.\n */\nexport { Children };\n\n/**\n * Creates a copy of an element with extended props.\n *\n * @param {WPElement} element Element\n * @param {?Object} props Props to apply to cloned element\n *\n * @return {WPElement} Cloned element.\n */\nexport { cloneElement };\n\n/**\n * A base class to create WordPress Components (Refs, state and lifecycle hooks)\n */\nexport { Component };\n\n/**\n * Creates a context object containing two components: a provider and consumer.\n *\n * @param {Object} defaultValue A default data stored in the context.\n *\n * @return {Object} Context object.\n */\nexport { createContext };\n\n/**\n * Returns a new element of given type. Type can be either a string tag name or\n * another function which itself returns an element.\n *\n * @param {?(string|Function)} type Tag name or element creator\n * @param {Object} props Element properties, either attribute\n * set to apply to DOM node or values to\n * pass through to element creator\n * @param {...WPElement} children Descendant elements\n *\n * @return {WPElement} Element.\n */\nexport { createElement };\n\n/**\n * Returns an object tracking a reference to a rendered element via its\n * `current` property as either a DOMElement or Element, dependent upon the\n * type of element rendered with the ref attribute.\n *\n * @return {Object} Ref object.\n */\nexport { createRef };\n\n/**\n * Component enhancer used to enable passing a ref to its wrapped component.\n * Pass a function argument which receives `props` and `ref` as its arguments,\n * returning an element using the forwarded ref. The return value is a new\n * component which forwards its ref.\n *\n * @param {Function} forwarder Function passed `props` and `ref`, expected to\n * return an element.\n *\n * @return {WPComponent} Enhanced component.\n */\nexport { forwardRef };\n\n/**\n * A component which renders its children without any wrapping element.\n */\nexport { Fragment };\n\n/**\n * Checks if an object is a valid WPElement.\n *\n * @param {Object} objectToCheck The object to be checked.\n *\n * @return {boolean} true if objectToTest is a valid WPElement and false otherwise.\n */\nexport { isValidElement };\n\n/**\n * @see https://reactjs.org/docs/react-api.html#reactmemo\n */\nexport { memo };\n\n/**\n * Component that activates additional checks and warnings for its descendants.\n */\nexport { StrictMode };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#usecallback\n */\nexport { useCallback };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#usecontext\n */\nexport { useContext };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#usedebugvalue\n */\nexport { useDebugValue };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#useeffect\n */\nexport { useEffect };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#useimperativehandle\n */\nexport { useImperativeHandle };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#uselayouteffect\n */\nexport { useLayoutEffect };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#usememo\n */\nexport { useMemo };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#usereducer\n */\nexport { useReducer };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#useref\n */\nexport { useRef };\n\n/**\n * @see https://reactjs.org/docs/hooks-reference.html#usestate\n */\nexport { useState };\n\n/**\n * @see https://reactjs.org/docs/react-api.html#reactlazy\n */\nexport { lazy };\n\n/**\n * @see https://reactjs.org/docs/react-api.html#reactsuspense\n */\nexport { Suspense };\n\n/**\n * Concatenate two or more React children objects.\n *\n * @param {...?Object} childrenArguments Array of children arguments (array of arrays/strings/objects) to concatenate.\n *\n * @return {Array} The concatenated value.\n */\nexport function concatChildren( ...childrenArguments ) {\n\treturn childrenArguments.reduce( ( accumulator, children, i ) => {\n\t\tChildren.forEach( children, ( child, j ) => {\n\t\t\tif ( child && 'string' !== typeof child ) {\n\t\t\t\tchild = cloneElement( child, {\n\t\t\t\t\tkey: [ i, j ].join(),\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\taccumulator.push( child );\n\t\t} );\n\n\t\treturn accumulator;\n\t}, [] );\n}\n\n/**\n * Switches the nodeName of all the elements in the children object.\n *\n * @param {?Object} children Children object.\n * @param {string} nodeName Node name.\n *\n * @return {?Object} The updated children object.\n */\nexport function switchChildrenNodeName( children, nodeName ) {\n\treturn (\n\t\tchildren &&\n\t\tChildren.map( children, ( elt, index ) => {\n\t\t\tif ( isString( elt ) ) {\n\t\t\t\treturn createElement( nodeName, { key: index }, elt );\n\t\t\t}\n\t\t\tconst { children: childrenProp, ...props } = elt.props;\n\t\t\treturn createElement(\n\t\t\t\tnodeName,\n\t\t\t\t{ key: index, ...props },\n\t\t\t\tchildrenProp\n\t\t\t);\n\t\t} )\n\t);\n}\n"]}
@@ -238,7 +238,9 @@ function getNormalStylePropertyValue(property, value) {
238
238
  */
239
239
 
240
240
 
241
- export function renderElement(element, context, legacyContext = {}) {
241
+ export function renderElement(element, context) {
242
+ let legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
243
+
242
244
  if (null === element || undefined === element || false === element) {
243
245
  return '';
244
246
  }
@@ -316,7 +318,8 @@ export function renderElement(element, context, legacyContext = {}) {
316
318
  * @return {string} Serialized element.
317
319
  */
318
320
 
319
- export function renderNativeComponent(type, props, context, legacyContext = {}) {
321
+ export function renderNativeComponent(type, props, context) {
322
+ let legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
320
323
  let content = '';
321
324
 
322
325
  if (type === 'textarea' && props.hasOwnProperty('value')) {
@@ -357,7 +360,8 @@ export function renderNativeComponent(type, props, context, legacyContext = {})
357
360
  * @return {string} Serialized element
358
361
  */
359
362
 
360
- export function renderComponent(Component, props, context, legacyContext = {}) {
363
+ export function renderComponent(Component, props, context) {
364
+ let legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
361
365
  const instance = new
362
366
  /** @type {import('react').ComponentClass} */
363
367
  Component(props, legacyContext);
@@ -385,7 +389,8 @@ export function renderComponent(Component, props, context, legacyContext = {}) {
385
389
  * @return {string} Serialized children.
386
390
  */
387
391
 
388
- function renderChildren(children, context, legacyContext = {}) {
392
+ function renderChildren(children, context) {
393
+ let legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
389
394
  let result = '';
390
395
  children = castArray(children);
391
396
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/serialize.js"],"names":["isEmpty","castArray","omit","startsWith","kebabCase","isPlainObject","escapeHTML","escapeAttribute","isValidAttributeName","createContext","Fragment","StrictMode","forwardRef","RawHTML","Provider","Consumer","undefined","ForwardRef","ATTRIBUTES_TYPES","Set","SELF_CLOSING_TAGS","BOOLEAN_ATTRIBUTES","ENUMERATED_ATTRIBUTES","CSS_PROPERTIES_SUPPORTS_UNITLESS","hasPrefix","string","prefixes","some","prefix","indexOf","isInternalAttribute","attribute","getNormalAttributeValue","value","renderStyle","getNormalAttributeName","toLowerCase","getNormalStylePropertyName","property","getNormalStylePropertyValue","has","renderElement","element","context","legacyContext","Array","isArray","renderChildren","toString","type","props","children","wrapperProps","renderNativeComponent","dangerouslySetInnerHTML","__html","prototype","render","renderComponent","$$typeof","_currentValue","content","hasOwnProperty","attributes","renderAttributes","Component","instance","getChildContext","Object","assign","html","result","i","length","child","key","isBooleanAttribute","isMeaningfulAttribute","style","normalName","normalValue"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SACCA,OADD,EAECC,SAFD,EAGCC,IAHD,EAICC,UAJD,EAKCC,SALD,EAMCC,aAND,QAOO,QAPP;AASA;AACA;AACA;;AACA,SACCC,UADD,EAECC,eAFD,EAGCC,oBAHD,QAIO,wBAJP;AAMA;AACA;AACA;;AACA,SAASC,aAAT,EAAwBC,QAAxB,EAAkCC,UAAlC,EAA8CC,UAA9C,QAAgE,SAAhE;AACA,OAAOC,OAAP,MAAoB,YAApB;AAEA;;AAEA,MAAM;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,IAAyBN,aAAa,CAAEO,SAAF,CAA5C;AACA,MAAMC,UAAU,GAAGL,UAAU,CAAE,MAAM;AACpC,SAAO,IAAP;AACA,CAF4B,CAA7B;AAIA;AACA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","sourcesContent":["/**\n * Parts of this source were derived and modified from fast-react-render,\n * released under the MIT license.\n *\n * https://github.com/alt-j/fast-react-render\n *\n * Copyright (c) 2016 Andrey Morozov\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n/**\n * External dependencies\n */\nimport {\n\tisEmpty,\n\tcastArray,\n\tomit,\n\tstartsWith,\n\tkebabCase,\n\tisPlainObject,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tescapeHTML,\n\tescapeAttribute,\n\tisValidAttributeName,\n} from '@wordpress/escape-html';\n\n/**\n * Internal dependencies\n */\nimport { createContext, Fragment, StrictMode, forwardRef } from './react';\nimport RawHTML from './raw-html';\n\n/** @typedef {import('./react').WPElement} WPElement */\n\nconst { Provider, Consumer } = createContext( undefined );\nconst ForwardRef = forwardRef( () => {\n\treturn null;\n} );\n\n/**\n * Valid attribute types.\n *\n * @type {Set<string>}\n */\nconst ATTRIBUTES_TYPES = new Set( [ 'string', 'boolean', 'number' ] );\n\n/**\n * Element tags which can be self-closing.\n *\n * @type {Set<string>}\n */\nconst SELF_CLOSING_TAGS = new Set( [\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'keygen',\n\t'link',\n\t'meta',\n\t'param',\n\t'source',\n\t'track',\n\t'wbr',\n] );\n\n/**\n * Boolean attributes are attributes whose presence as being assigned is\n * meaningful, even if only empty.\n *\n * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes\n * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3\n *\n * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]\n * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 )\n * .reduce( ( result, tr ) => Object.assign( result, {\n * [ tr.firstChild.textContent.trim() ]: true\n * } ), {} ) ).sort();\n *\n * @type {Set<string>}\n */\nconst BOOLEAN_ATTRIBUTES = new Set( [\n\t'allowfullscreen',\n\t'allowpaymentrequest',\n\t'allowusermedia',\n\t'async',\n\t'autofocus',\n\t'autoplay',\n\t'checked',\n\t'controls',\n\t'default',\n\t'defer',\n\t'disabled',\n\t'download',\n\t'formnovalidate',\n\t'hidden',\n\t'ismap',\n\t'itemscope',\n\t'loop',\n\t'multiple',\n\t'muted',\n\t'nomodule',\n\t'novalidate',\n\t'open',\n\t'playsinline',\n\t'readonly',\n\t'required',\n\t'reversed',\n\t'selected',\n\t'typemustmatch',\n] );\n\n/**\n * Enumerated attributes are attributes which must be of a specific value form.\n * Like boolean attributes, these are meaningful if specified, even if not of a\n * valid enumerated value.\n *\n * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute\n * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3\n *\n * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]\n * .filter( ( tr ) => /^(\"(.+?)\";?\\s*)+/.test( tr.lastChild.textContent.trim() ) )\n * .reduce( ( result, tr ) => Object.assign( result, {\n * [ tr.firstChild.textContent.trim() ]: true\n * } ), {} ) ).sort();\n *\n * Some notable omissions:\n *\n * - `alt`: https://blog.whatwg.org/omit-alt\n *\n * @type {Set<string>}\n */\nconst ENUMERATED_ATTRIBUTES = new Set( [\n\t'autocapitalize',\n\t'autocomplete',\n\t'charset',\n\t'contenteditable',\n\t'crossorigin',\n\t'decoding',\n\t'dir',\n\t'draggable',\n\t'enctype',\n\t'formenctype',\n\t'formmethod',\n\t'http-equiv',\n\t'inputmode',\n\t'kind',\n\t'method',\n\t'preload',\n\t'scope',\n\t'shape',\n\t'spellcheck',\n\t'translate',\n\t'type',\n\t'wrap',\n] );\n\n/**\n * Set of CSS style properties which support assignment of unitless numbers.\n * Used in rendering of style properties, where `px` unit is assumed unless\n * property is included in this set or value is zero.\n *\n * Generated via:\n *\n * Object.entries( document.createElement( 'div' ).style )\n * .filter( ( [ key ] ) => (\n * ! /^(webkit|ms|moz)/.test( key ) &&\n * ( e.style[ key ] = 10 ) &&\n * e.style[ key ] === '10'\n * ) )\n * .map( ( [ key ] ) => key )\n * .sort();\n *\n * @type {Set<string>}\n */\nconst CSS_PROPERTIES_SUPPORTS_UNITLESS = new Set( [\n\t'animation',\n\t'animationIterationCount',\n\t'baselineShift',\n\t'borderImageOutset',\n\t'borderImageSlice',\n\t'borderImageWidth',\n\t'columnCount',\n\t'cx',\n\t'cy',\n\t'fillOpacity',\n\t'flexGrow',\n\t'flexShrink',\n\t'floodOpacity',\n\t'fontWeight',\n\t'gridColumnEnd',\n\t'gridColumnStart',\n\t'gridRowEnd',\n\t'gridRowStart',\n\t'lineHeight',\n\t'opacity',\n\t'order',\n\t'orphans',\n\t'r',\n\t'rx',\n\t'ry',\n\t'shapeImageThreshold',\n\t'stopOpacity',\n\t'strokeDasharray',\n\t'strokeDashoffset',\n\t'strokeMiterlimit',\n\t'strokeOpacity',\n\t'strokeWidth',\n\t'tabSize',\n\t'widows',\n\t'x',\n\t'y',\n\t'zIndex',\n\t'zoom',\n] );\n\n/**\n * Returns true if the specified string is prefixed by one of an array of\n * possible prefixes.\n *\n * @param {string} string String to check.\n * @param {string[]} prefixes Possible prefixes.\n *\n * @return {boolean} Whether string has prefix.\n */\nexport function hasPrefix( string, prefixes ) {\n\treturn prefixes.some( ( prefix ) => string.indexOf( prefix ) === 0 );\n}\n\n/**\n * Returns true if the given prop name should be ignored in attributes\n * serialization, or false otherwise.\n *\n * @param {string} attribute Attribute to check.\n *\n * @return {boolean} Whether attribute should be ignored.\n */\nfunction isInternalAttribute( attribute ) {\n\treturn 'key' === attribute || 'children' === attribute;\n}\n\n/**\n * Returns the normal form of the element's attribute value for HTML.\n *\n * @param {string} attribute Attribute name.\n * @param {*} value Non-normalized attribute value.\n *\n * @return {*} Normalized attribute value.\n */\nfunction getNormalAttributeValue( attribute, value ) {\n\tswitch ( attribute ) {\n\t\tcase 'style':\n\t\t\treturn renderStyle( value );\n\t}\n\n\treturn value;\n}\n\n/**\n * Returns the normal form of the element's attribute name for HTML.\n *\n * @param {string} attribute Non-normalized attribute name.\n *\n * @return {string} Normalized attribute name.\n */\nfunction getNormalAttributeName( attribute ) {\n\tswitch ( attribute ) {\n\t\tcase 'htmlFor':\n\t\t\treturn 'for';\n\n\t\tcase 'className':\n\t\t\treturn 'class';\n\t}\n\n\treturn attribute.toLowerCase();\n}\n\n/**\n * Returns the normal form of the style property name for HTML.\n *\n * - Converts property names to kebab-case, e.g. 'backgroundColor' → 'background-color'\n * - Leaves custom attributes alone, e.g. '--myBackgroundColor' → '--myBackgroundColor'\n * - Converts vendor-prefixed property names to -kebab-case, e.g. 'MozTransform' → '-moz-transform'\n *\n * @param {string} property Property name.\n *\n * @return {string} Normalized property name.\n */\nfunction getNormalStylePropertyName( property ) {\n\tif ( startsWith( property, '--' ) ) {\n\t\treturn property;\n\t}\n\n\tif ( hasPrefix( property, [ 'ms', 'O', 'Moz', 'Webkit' ] ) ) {\n\t\treturn '-' + kebabCase( property );\n\t}\n\n\treturn kebabCase( property );\n}\n\n/**\n * Returns the normal form of the style property value for HTML. Appends a\n * default pixel unit if numeric, not a unitless property, and not zero.\n *\n * @param {string} property Property name.\n * @param {*} value Non-normalized property value.\n *\n * @return {*} Normalized property value.\n */\nfunction getNormalStylePropertyValue( property, value ) {\n\tif (\n\t\ttypeof value === 'number' &&\n\t\t0 !== value &&\n\t\t! CSS_PROPERTIES_SUPPORTS_UNITLESS.has( property )\n\t) {\n\t\treturn value + 'px';\n\t}\n\n\treturn value;\n}\n\n/**\n * Serializes a React element to string.\n *\n * @param {import('react').ReactNode} element Element to serialize.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized element.\n */\nexport function renderElement( element, context, legacyContext = {} ) {\n\tif ( null === element || undefined === element || false === element ) {\n\t\treturn '';\n\t}\n\n\tif ( Array.isArray( element ) ) {\n\t\treturn renderChildren( element, context, legacyContext );\n\t}\n\n\tswitch ( typeof element ) {\n\t\tcase 'string':\n\t\t\treturn escapeHTML( element );\n\n\t\tcase 'number':\n\t\t\treturn element.toString();\n\t}\n\n\tconst {\n\t\ttype,\n\t\tprops,\n\t} = /** @type {{type?: any, props?: any}} */ ( element );\n\n\tswitch ( type ) {\n\t\tcase StrictMode:\n\t\tcase Fragment:\n\t\t\treturn renderChildren( props.children, context, legacyContext );\n\n\t\tcase RawHTML:\n\t\t\tconst { children, ...wrapperProps } = props;\n\n\t\t\treturn renderNativeComponent(\n\t\t\t\tisEmpty( wrapperProps ) ? null : 'div',\n\t\t\t\t{\n\t\t\t\t\t...wrapperProps,\n\t\t\t\t\tdangerouslySetInnerHTML: { __html: children },\n\t\t\t\t},\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\t}\n\n\tswitch ( typeof type ) {\n\t\tcase 'string':\n\t\t\treturn renderNativeComponent( type, props, context, legacyContext );\n\n\t\tcase 'function':\n\t\t\tif (\n\t\t\t\ttype.prototype &&\n\t\t\t\ttypeof type.prototype.render === 'function'\n\t\t\t) {\n\t\t\t\treturn renderComponent( type, props, context, legacyContext );\n\t\t\t}\n\n\t\t\treturn renderElement(\n\t\t\t\ttype( props, legacyContext ),\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\t}\n\n\tswitch ( type && type.$$typeof ) {\n\t\tcase Provider.$$typeof:\n\t\t\treturn renderChildren( props.children, props.value, legacyContext );\n\n\t\tcase Consumer.$$typeof:\n\t\t\treturn renderElement(\n\t\t\t\tprops.children( context || type._currentValue ),\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\n\t\tcase ForwardRef.$$typeof:\n\t\t\treturn renderElement(\n\t\t\t\ttype.render( props ),\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\t}\n\n\treturn '';\n}\n\n/**\n * Serializes a native component type to string.\n *\n * @param {?string} type Native component type to serialize, or null if\n * rendering as fragment of children content.\n * @param {Object} props Props object.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized element.\n */\nexport function renderNativeComponent(\n\ttype,\n\tprops,\n\tcontext,\n\tlegacyContext = {}\n) {\n\tlet content = '';\n\tif ( type === 'textarea' && props.hasOwnProperty( 'value' ) ) {\n\t\t// Textarea children can be assigned as value prop. If it is, render in\n\t\t// place of children. Ensure to omit so it is not assigned as attribute\n\t\t// as well.\n\t\tcontent = renderChildren( props.value, context, legacyContext );\n\t\tprops = omit( props, 'value' );\n\t} else if (\n\t\tprops.dangerouslySetInnerHTML &&\n\t\ttypeof props.dangerouslySetInnerHTML.__html === 'string'\n\t) {\n\t\t// Dangerous content is left unescaped.\n\t\tcontent = props.dangerouslySetInnerHTML.__html;\n\t} else if ( typeof props.children !== 'undefined' ) {\n\t\tcontent = renderChildren( props.children, context, legacyContext );\n\t}\n\n\tif ( ! type ) {\n\t\treturn content;\n\t}\n\n\tconst attributes = renderAttributes( props );\n\n\tif ( SELF_CLOSING_TAGS.has( type ) ) {\n\t\treturn '<' + type + attributes + '/>';\n\t}\n\n\treturn '<' + type + attributes + '>' + content + '</' + type + '>';\n}\n\n/** @typedef {import('./react').WPComponent} WPComponent */\n\n/**\n * Serializes a non-native component type to string.\n *\n * @param {WPComponent} Component Component type to serialize.\n * @param {Object} props Props object.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized element\n */\nexport function renderComponent(\n\tComponent,\n\tprops,\n\tcontext,\n\tlegacyContext = {}\n) {\n\tconst instance = new /** @type {import('react').ComponentClass} */ ( Component )(\n\t\tprops,\n\t\tlegacyContext\n\t);\n\n\tif (\n\t\ttypeof (\n\t\t\t// Ignore reason: Current prettier reformats parens and mangles type assertion\n\t\t\t// prettier-ignore\n\t\t\t/** @type {{getChildContext?: () => unknown}} */ ( instance ).getChildContext\n\t\t) === 'function'\n\t) {\n\t\tObject.assign(\n\t\t\tlegacyContext,\n\t\t\t/** @type {{getChildContext?: () => unknown}} */ ( instance ).getChildContext()\n\t\t);\n\t}\n\n\tconst html = renderElement( instance.render(), context, legacyContext );\n\n\treturn html;\n}\n\n/**\n * Serializes an array of children to string.\n *\n * @param {import('react').ReactNodeArray} children Children to serialize.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized children.\n */\nfunction renderChildren( children, context, legacyContext = {} ) {\n\tlet result = '';\n\n\tchildren = castArray( children );\n\n\tfor ( let i = 0; i < children.length; i++ ) {\n\t\tconst child = children[ i ];\n\n\t\tresult += renderElement( child, context, legacyContext );\n\t}\n\n\treturn result;\n}\n\n/**\n * Renders a props object as a string of HTML attributes.\n *\n * @param {Object} props Props object.\n *\n * @return {string} Attributes string.\n */\nexport function renderAttributes( props ) {\n\tlet result = '';\n\n\tfor ( const key in props ) {\n\t\tconst attribute = getNormalAttributeName( key );\n\t\tif ( ! isValidAttributeName( attribute ) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet value = getNormalAttributeValue( key, props[ key ] );\n\n\t\t// If value is not of serializeable type, skip.\n\t\tif ( ! ATTRIBUTES_TYPES.has( typeof value ) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Don't render internal attribute names.\n\t\tif ( isInternalAttribute( key ) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isBooleanAttribute = BOOLEAN_ATTRIBUTES.has( attribute );\n\n\t\t// Boolean attribute should be omitted outright if its value is false.\n\t\tif ( isBooleanAttribute && value === false ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isMeaningfulAttribute =\n\t\t\tisBooleanAttribute ||\n\t\t\thasPrefix( key, [ 'data-', 'aria-' ] ) ||\n\t\t\tENUMERATED_ATTRIBUTES.has( attribute );\n\n\t\t// Only write boolean value as attribute if meaningful.\n\t\tif ( typeof value === 'boolean' && ! isMeaningfulAttribute ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult += ' ' + attribute;\n\n\t\t// Boolean attributes should write attribute name, but without value.\n\t\t// Mere presence of attribute name is effective truthiness.\n\t\tif ( isBooleanAttribute ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ( typeof value === 'string' ) {\n\t\t\tvalue = escapeAttribute( value );\n\t\t}\n\n\t\tresult += '=\"' + value + '\"';\n\t}\n\n\treturn result;\n}\n\n/**\n * Renders a style object as a string attribute value.\n *\n * @param {Object} style Style object.\n *\n * @return {string} Style attribute value.\n */\nexport function renderStyle( style ) {\n\t// Only generate from object, e.g. tolerate string value.\n\tif ( ! isPlainObject( style ) ) {\n\t\treturn style;\n\t}\n\n\tlet result;\n\n\tfor ( const property in style ) {\n\t\tconst value = style[ property ];\n\t\tif ( null === value || undefined === value ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ( result ) {\n\t\t\tresult += ';';\n\t\t} else {\n\t\t\tresult = '';\n\t\t}\n\n\t\tconst normalName = getNormalStylePropertyName( property );\n\t\tconst normalValue = getNormalStylePropertyValue( property, value );\n\t\tresult += normalName + ':' + normalValue;\n\t}\n\n\treturn result;\n}\n\nexport default renderElement;\n"]}
1
+ {"version":3,"sources":["@wordpress/element/src/serialize.js"],"names":["isEmpty","castArray","omit","startsWith","kebabCase","isPlainObject","escapeHTML","escapeAttribute","isValidAttributeName","createContext","Fragment","StrictMode","forwardRef","RawHTML","Provider","Consumer","undefined","ForwardRef","ATTRIBUTES_TYPES","Set","SELF_CLOSING_TAGS","BOOLEAN_ATTRIBUTES","ENUMERATED_ATTRIBUTES","CSS_PROPERTIES_SUPPORTS_UNITLESS","hasPrefix","string","prefixes","some","prefix","indexOf","isInternalAttribute","attribute","getNormalAttributeValue","value","renderStyle","getNormalAttributeName","toLowerCase","getNormalStylePropertyName","property","getNormalStylePropertyValue","has","renderElement","element","context","legacyContext","Array","isArray","renderChildren","toString","type","props","children","wrapperProps","renderNativeComponent","dangerouslySetInnerHTML","__html","prototype","render","renderComponent","$$typeof","_currentValue","content","hasOwnProperty","attributes","renderAttributes","Component","instance","getChildContext","Object","assign","html","result","i","length","child","key","isBooleanAttribute","isMeaningfulAttribute","style","normalName","normalValue"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SACCA,OADD,EAECC,SAFD,EAGCC,IAHD,EAICC,UAJD,EAKCC,SALD,EAMCC,aAND,QAOO,QAPP;AASA;AACA;AACA;;AACA,SACCC,UADD,EAECC,eAFD,EAGCC,oBAHD,QAIO,wBAJP;AAMA;AACA;AACA;;AACA,SAASC,aAAT,EAAwBC,QAAxB,EAAkCC,UAAlC,EAA8CC,UAA9C,QAAgE,SAAhE;AACA,OAAOC,OAAP,MAAoB,YAApB;AAEA;;AAEA,MAAM;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,IAAyBN,aAAa,CAAEO,SAAF,CAA5C;AACA,MAAMC,UAAU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AAM,IAAIQ,UAAU,GAAG,GAAb,GAAmBC,WAA7B;AACA;;AAED,SAAOT,MAAP;AACA;AAED,eAAe9B,aAAf","sourcesContent":["/**\n * Parts of this source were derived and modified from fast-react-render,\n * released under the MIT license.\n *\n * https://github.com/alt-j/fast-react-render\n *\n * Copyright (c) 2016 Andrey Morozov\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n/**\n * External dependencies\n */\nimport {\n\tisEmpty,\n\tcastArray,\n\tomit,\n\tstartsWith,\n\tkebabCase,\n\tisPlainObject,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tescapeHTML,\n\tescapeAttribute,\n\tisValidAttributeName,\n} from '@wordpress/escape-html';\n\n/**\n * Internal dependencies\n */\nimport { createContext, Fragment, StrictMode, forwardRef } from './react';\nimport RawHTML from './raw-html';\n\n/** @typedef {import('./react').WPElement} WPElement */\n\nconst { Provider, Consumer } = createContext( undefined );\nconst ForwardRef = forwardRef( () => {\n\treturn null;\n} );\n\n/**\n * Valid attribute types.\n *\n * @type {Set<string>}\n */\nconst ATTRIBUTES_TYPES = new Set( [ 'string', 'boolean', 'number' ] );\n\n/**\n * Element tags which can be self-closing.\n *\n * @type {Set<string>}\n */\nconst SELF_CLOSING_TAGS = new Set( [\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'keygen',\n\t'link',\n\t'meta',\n\t'param',\n\t'source',\n\t'track',\n\t'wbr',\n] );\n\n/**\n * Boolean attributes are attributes whose presence as being assigned is\n * meaningful, even if only empty.\n *\n * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes\n * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3\n *\n * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]\n * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 )\n * .reduce( ( result, tr ) => Object.assign( result, {\n * [ tr.firstChild.textContent.trim() ]: true\n * } ), {} ) ).sort();\n *\n * @type {Set<string>}\n */\nconst BOOLEAN_ATTRIBUTES = new Set( [\n\t'allowfullscreen',\n\t'allowpaymentrequest',\n\t'allowusermedia',\n\t'async',\n\t'autofocus',\n\t'autoplay',\n\t'checked',\n\t'controls',\n\t'default',\n\t'defer',\n\t'disabled',\n\t'download',\n\t'formnovalidate',\n\t'hidden',\n\t'ismap',\n\t'itemscope',\n\t'loop',\n\t'multiple',\n\t'muted',\n\t'nomodule',\n\t'novalidate',\n\t'open',\n\t'playsinline',\n\t'readonly',\n\t'required',\n\t'reversed',\n\t'selected',\n\t'typemustmatch',\n] );\n\n/**\n * Enumerated attributes are attributes which must be of a specific value form.\n * Like boolean attributes, these are meaningful if specified, even if not of a\n * valid enumerated value.\n *\n * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute\n * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3\n *\n * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]\n * .filter( ( tr ) => /^(\"(.+?)\";?\\s*)+/.test( tr.lastChild.textContent.trim() ) )\n * .reduce( ( result, tr ) => Object.assign( result, {\n * [ tr.firstChild.textContent.trim() ]: true\n * } ), {} ) ).sort();\n *\n * Some notable omissions:\n *\n * - `alt`: https://blog.whatwg.org/omit-alt\n *\n * @type {Set<string>}\n */\nconst ENUMERATED_ATTRIBUTES = new Set( [\n\t'autocapitalize',\n\t'autocomplete',\n\t'charset',\n\t'contenteditable',\n\t'crossorigin',\n\t'decoding',\n\t'dir',\n\t'draggable',\n\t'enctype',\n\t'formenctype',\n\t'formmethod',\n\t'http-equiv',\n\t'inputmode',\n\t'kind',\n\t'method',\n\t'preload',\n\t'scope',\n\t'shape',\n\t'spellcheck',\n\t'translate',\n\t'type',\n\t'wrap',\n] );\n\n/**\n * Set of CSS style properties which support assignment of unitless numbers.\n * Used in rendering of style properties, where `px` unit is assumed unless\n * property is included in this set or value is zero.\n *\n * Generated via:\n *\n * Object.entries( document.createElement( 'div' ).style )\n * .filter( ( [ key ] ) => (\n * ! /^(webkit|ms|moz)/.test( key ) &&\n * ( e.style[ key ] = 10 ) &&\n * e.style[ key ] === '10'\n * ) )\n * .map( ( [ key ] ) => key )\n * .sort();\n *\n * @type {Set<string>}\n */\nconst CSS_PROPERTIES_SUPPORTS_UNITLESS = new Set( [\n\t'animation',\n\t'animationIterationCount',\n\t'baselineShift',\n\t'borderImageOutset',\n\t'borderImageSlice',\n\t'borderImageWidth',\n\t'columnCount',\n\t'cx',\n\t'cy',\n\t'fillOpacity',\n\t'flexGrow',\n\t'flexShrink',\n\t'floodOpacity',\n\t'fontWeight',\n\t'gridColumnEnd',\n\t'gridColumnStart',\n\t'gridRowEnd',\n\t'gridRowStart',\n\t'lineHeight',\n\t'opacity',\n\t'order',\n\t'orphans',\n\t'r',\n\t'rx',\n\t'ry',\n\t'shapeImageThreshold',\n\t'stopOpacity',\n\t'strokeDasharray',\n\t'strokeDashoffset',\n\t'strokeMiterlimit',\n\t'strokeOpacity',\n\t'strokeWidth',\n\t'tabSize',\n\t'widows',\n\t'x',\n\t'y',\n\t'zIndex',\n\t'zoom',\n] );\n\n/**\n * Returns true if the specified string is prefixed by one of an array of\n * possible prefixes.\n *\n * @param {string} string String to check.\n * @param {string[]} prefixes Possible prefixes.\n *\n * @return {boolean} Whether string has prefix.\n */\nexport function hasPrefix( string, prefixes ) {\n\treturn prefixes.some( ( prefix ) => string.indexOf( prefix ) === 0 );\n}\n\n/**\n * Returns true if the given prop name should be ignored in attributes\n * serialization, or false otherwise.\n *\n * @param {string} attribute Attribute to check.\n *\n * @return {boolean} Whether attribute should be ignored.\n */\nfunction isInternalAttribute( attribute ) {\n\treturn 'key' === attribute || 'children' === attribute;\n}\n\n/**\n * Returns the normal form of the element's attribute value for HTML.\n *\n * @param {string} attribute Attribute name.\n * @param {*} value Non-normalized attribute value.\n *\n * @return {*} Normalized attribute value.\n */\nfunction getNormalAttributeValue( attribute, value ) {\n\tswitch ( attribute ) {\n\t\tcase 'style':\n\t\t\treturn renderStyle( value );\n\t}\n\n\treturn value;\n}\n\n/**\n * Returns the normal form of the element's attribute name for HTML.\n *\n * @param {string} attribute Non-normalized attribute name.\n *\n * @return {string} Normalized attribute name.\n */\nfunction getNormalAttributeName( attribute ) {\n\tswitch ( attribute ) {\n\t\tcase 'htmlFor':\n\t\t\treturn 'for';\n\n\t\tcase 'className':\n\t\t\treturn 'class';\n\t}\n\n\treturn attribute.toLowerCase();\n}\n\n/**\n * Returns the normal form of the style property name for HTML.\n *\n * - Converts property names to kebab-case, e.g. 'backgroundColor' → 'background-color'\n * - Leaves custom attributes alone, e.g. '--myBackgroundColor' → '--myBackgroundColor'\n * - Converts vendor-prefixed property names to -kebab-case, e.g. 'MozTransform' → '-moz-transform'\n *\n * @param {string} property Property name.\n *\n * @return {string} Normalized property name.\n */\nfunction getNormalStylePropertyName( property ) {\n\tif ( startsWith( property, '--' ) ) {\n\t\treturn property;\n\t}\n\n\tif ( hasPrefix( property, [ 'ms', 'O', 'Moz', 'Webkit' ] ) ) {\n\t\treturn '-' + kebabCase( property );\n\t}\n\n\treturn kebabCase( property );\n}\n\n/**\n * Returns the normal form of the style property value for HTML. Appends a\n * default pixel unit if numeric, not a unitless property, and not zero.\n *\n * @param {string} property Property name.\n * @param {*} value Non-normalized property value.\n *\n * @return {*} Normalized property value.\n */\nfunction getNormalStylePropertyValue( property, value ) {\n\tif (\n\t\ttypeof value === 'number' &&\n\t\t0 !== value &&\n\t\t! CSS_PROPERTIES_SUPPORTS_UNITLESS.has( property )\n\t) {\n\t\treturn value + 'px';\n\t}\n\n\treturn value;\n}\n\n/**\n * Serializes a React element to string.\n *\n * @param {import('react').ReactNode} element Element to serialize.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized element.\n */\nexport function renderElement( element, context, legacyContext = {} ) {\n\tif ( null === element || undefined === element || false === element ) {\n\t\treturn '';\n\t}\n\n\tif ( Array.isArray( element ) ) {\n\t\treturn renderChildren( element, context, legacyContext );\n\t}\n\n\tswitch ( typeof element ) {\n\t\tcase 'string':\n\t\t\treturn escapeHTML( element );\n\n\t\tcase 'number':\n\t\t\treturn element.toString();\n\t}\n\n\tconst {\n\t\ttype,\n\t\tprops,\n\t} = /** @type {{type?: any, props?: any}} */ ( element );\n\n\tswitch ( type ) {\n\t\tcase StrictMode:\n\t\tcase Fragment:\n\t\t\treturn renderChildren( props.children, context, legacyContext );\n\n\t\tcase RawHTML:\n\t\t\tconst { children, ...wrapperProps } = props;\n\n\t\t\treturn renderNativeComponent(\n\t\t\t\tisEmpty( wrapperProps ) ? null : 'div',\n\t\t\t\t{\n\t\t\t\t\t...wrapperProps,\n\t\t\t\t\tdangerouslySetInnerHTML: { __html: children },\n\t\t\t\t},\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\t}\n\n\tswitch ( typeof type ) {\n\t\tcase 'string':\n\t\t\treturn renderNativeComponent( type, props, context, legacyContext );\n\n\t\tcase 'function':\n\t\t\tif (\n\t\t\t\ttype.prototype &&\n\t\t\t\ttypeof type.prototype.render === 'function'\n\t\t\t) {\n\t\t\t\treturn renderComponent( type, props, context, legacyContext );\n\t\t\t}\n\n\t\t\treturn renderElement(\n\t\t\t\ttype( props, legacyContext ),\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\t}\n\n\tswitch ( type && type.$$typeof ) {\n\t\tcase Provider.$$typeof:\n\t\t\treturn renderChildren( props.children, props.value, legacyContext );\n\n\t\tcase Consumer.$$typeof:\n\t\t\treturn renderElement(\n\t\t\t\tprops.children( context || type._currentValue ),\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\n\t\tcase ForwardRef.$$typeof:\n\t\t\treturn renderElement(\n\t\t\t\ttype.render( props ),\n\t\t\t\tcontext,\n\t\t\t\tlegacyContext\n\t\t\t);\n\t}\n\n\treturn '';\n}\n\n/**\n * Serializes a native component type to string.\n *\n * @param {?string} type Native component type to serialize, or null if\n * rendering as fragment of children content.\n * @param {Object} props Props object.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized element.\n */\nexport function renderNativeComponent(\n\ttype,\n\tprops,\n\tcontext,\n\tlegacyContext = {}\n) {\n\tlet content = '';\n\tif ( type === 'textarea' && props.hasOwnProperty( 'value' ) ) {\n\t\t// Textarea children can be assigned as value prop. If it is, render in\n\t\t// place of children. Ensure to omit so it is not assigned as attribute\n\t\t// as well.\n\t\tcontent = renderChildren( props.value, context, legacyContext );\n\t\tprops = omit( props, 'value' );\n\t} else if (\n\t\tprops.dangerouslySetInnerHTML &&\n\t\ttypeof props.dangerouslySetInnerHTML.__html === 'string'\n\t) {\n\t\t// Dangerous content is left unescaped.\n\t\tcontent = props.dangerouslySetInnerHTML.__html;\n\t} else if ( typeof props.children !== 'undefined' ) {\n\t\tcontent = renderChildren( props.children, context, legacyContext );\n\t}\n\n\tif ( ! type ) {\n\t\treturn content;\n\t}\n\n\tconst attributes = renderAttributes( props );\n\n\tif ( SELF_CLOSING_TAGS.has( type ) ) {\n\t\treturn '<' + type + attributes + '/>';\n\t}\n\n\treturn '<' + type + attributes + '>' + content + '</' + type + '>';\n}\n\n/** @typedef {import('./react').WPComponent} WPComponent */\n\n/**\n * Serializes a non-native component type to string.\n *\n * @param {WPComponent} Component Component type to serialize.\n * @param {Object} props Props object.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized element\n */\nexport function renderComponent(\n\tComponent,\n\tprops,\n\tcontext,\n\tlegacyContext = {}\n) {\n\tconst instance = new /** @type {import('react').ComponentClass} */ ( Component )(\n\t\tprops,\n\t\tlegacyContext\n\t);\n\n\tif (\n\t\ttypeof (\n\t\t\t// Ignore reason: Current prettier reformats parens and mangles type assertion\n\t\t\t// prettier-ignore\n\t\t\t/** @type {{getChildContext?: () => unknown}} */ ( instance ).getChildContext\n\t\t) === 'function'\n\t) {\n\t\tObject.assign(\n\t\t\tlegacyContext,\n\t\t\t/** @type {{getChildContext?: () => unknown}} */ ( instance ).getChildContext()\n\t\t);\n\t}\n\n\tconst html = renderElement( instance.render(), context, legacyContext );\n\n\treturn html;\n}\n\n/**\n * Serializes an array of children to string.\n *\n * @param {import('react').ReactNodeArray} children Children to serialize.\n * @param {Object} [context] Context object.\n * @param {Object} [legacyContext] Legacy context object.\n *\n * @return {string} Serialized children.\n */\nfunction renderChildren( children, context, legacyContext = {} ) {\n\tlet result = '';\n\n\tchildren = castArray( children );\n\n\tfor ( let i = 0; i < children.length; i++ ) {\n\t\tconst child = children[ i ];\n\n\t\tresult += renderElement( child, context, legacyContext );\n\t}\n\n\treturn result;\n}\n\n/**\n * Renders a props object as a string of HTML attributes.\n *\n * @param {Object} props Props object.\n *\n * @return {string} Attributes string.\n */\nexport function renderAttributes( props ) {\n\tlet result = '';\n\n\tfor ( const key in props ) {\n\t\tconst attribute = getNormalAttributeName( key );\n\t\tif ( ! isValidAttributeName( attribute ) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet value = getNormalAttributeValue( key, props[ key ] );\n\n\t\t// If value is not of serializeable type, skip.\n\t\tif ( ! ATTRIBUTES_TYPES.has( typeof value ) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Don't render internal attribute names.\n\t\tif ( isInternalAttribute( key ) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isBooleanAttribute = BOOLEAN_ATTRIBUTES.has( attribute );\n\n\t\t// Boolean attribute should be omitted outright if its value is false.\n\t\tif ( isBooleanAttribute && value === false ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst isMeaningfulAttribute =\n\t\t\tisBooleanAttribute ||\n\t\t\thasPrefix( key, [ 'data-', 'aria-' ] ) ||\n\t\t\tENUMERATED_ATTRIBUTES.has( attribute );\n\n\t\t// Only write boolean value as attribute if meaningful.\n\t\tif ( typeof value === 'boolean' && ! isMeaningfulAttribute ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult += ' ' + attribute;\n\n\t\t// Boolean attributes should write attribute name, but without value.\n\t\t// Mere presence of attribute name is effective truthiness.\n\t\tif ( isBooleanAttribute ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ( typeof value === 'string' ) {\n\t\t\tvalue = escapeAttribute( value );\n\t\t}\n\n\t\tresult += '=\"' + value + '\"';\n\t}\n\n\treturn result;\n}\n\n/**\n * Renders a style object as a string attribute value.\n *\n * @param {Object} style Style object.\n *\n * @return {string} Style attribute value.\n */\nexport function renderStyle( style ) {\n\t// Only generate from object, e.g. tolerate string value.\n\tif ( ! isPlainObject( style ) ) {\n\t\treturn style;\n\t}\n\n\tlet result;\n\n\tfor ( const property in style ) {\n\t\tconst value = style[ property ];\n\t\tif ( null === value || undefined === value ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ( result ) {\n\t\t\tresult += ';';\n\t\t} else {\n\t\t\tresult = '';\n\t\t}\n\n\t\tconst normalName = getNormalStylePropertyName( property );\n\t\tconst normalValue = getNormalStylePropertyValue( property, value );\n\t\tresult += normalName + ':' + normalValue;\n\t}\n\n\treturn result;\n}\n\nexport default renderElement;\n"]}
@@ -5,8 +5,9 @@
5
5
  * To preserve additional props, a `div` wrapper _will_ be created if any props
6
6
  * aside from `children` are passed.
7
7
  *
8
- * @param {RawHTMLProps} props Children should be a string of HTML. Other props
9
- * will be passed through to div wrapper.
8
+ * @param {RawHTMLProps} props Children should be a string of HTML or an array
9
+ * of strings. Other props will be passed through
10
+ * to the div wrapper.
10
11
  *
11
12
  * @return {JSX.Element} Dangerously-rendering component.
12
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"raw-html.d.ts","sourceRoot":"","sources":["../src/raw-html.js"],"names":[],"mappings":"AAMA,mGAAmG;AAEnG;;;;;;;;;;GAUG;AACH,wDALW,YAAY,GAGX,WAAW,CAStB;2BApBa;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,GAAG,OAAO,OAAO,EAAE,wBAAwB,CAAC,KAAK,CAAC"}
1
+ {"version":3,"file":"raw-html.d.ts","sourceRoot":"","sources":["../src/raw-html.js"],"names":[],"mappings":"AAMA,mGAAmG;AAEnG;;;;;;;;;;;GAWG;AACH,wDANW,YAAY,GAIX,WAAW,CAkBtB;2BA9Ba;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,GAAG,OAAO,OAAO,EAAE,wBAAwB,CAAC,KAAK,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/element",
3
- "version": "4.0.2",
3
+ "version": "4.1.0",
4
4
  "description": "Element React module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -28,16 +28,16 @@
28
28
  "types": "build-types",
29
29
  "sideEffects": false,
30
30
  "dependencies": {
31
- "@babel/runtime": "^7.13.10",
32
- "@types/react": "^16.9.0",
33
- "@types/react-dom": "^16.9.0",
34
- "@wordpress/escape-html": "^2.2.2",
31
+ "@babel/runtime": "^7.16.0",
32
+ "@types/react": "^17.0.37",
33
+ "@types/react-dom": "^17.0.11",
34
+ "@wordpress/escape-html": "^2.3.0",
35
35
  "lodash": "^4.17.21",
36
- "react": "^17.0.1",
37
- "react-dom": "^17.0.1"
36
+ "react": "^17.0.2",
37
+ "react-dom": "^17.0.2"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  },
42
- "gitHead": "8f7f052bc04e3f4eb50f479ced14be1489b9fa79"
42
+ "gitHead": "d95ccb9366e249133cdb1d7b25c382446b9ee502"
43
43
  }