@wordpress/element 5.15.0 → 5.17.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/create-interpolate-element.js +19 -49
  3. package/build/create-interpolate-element.js.map +1 -1
  4. package/build/index.js +0 -11
  5. package/build/index.js.map +1 -1
  6. package/build/platform.android.js +3 -4
  7. package/build/platform.android.js.map +1 -1
  8. package/build/platform.ios.js +3 -4
  9. package/build/platform.ios.js.map +1 -1
  10. package/build/platform.js +0 -2
  11. package/build/platform.js.map +1 -1
  12. package/build/raw-html.js +5 -6
  13. package/build/raw-html.js.map +1 -1
  14. package/build/react-platform.js +0 -2
  15. package/build/react-platform.js.map +1 -1
  16. package/build/react-platform.native.js +0 -3
  17. package/build/react-platform.native.js.map +1 -1
  18. package/build/react.js +1 -7
  19. package/build/react.js.map +1 -1
  20. package/build/serialize.js +37 -100
  21. package/build/serialize.js.map +1 -1
  22. package/build/utils.js +0 -4
  23. package/build/utils.js.map +1 -1
  24. package/build-module/create-interpolate-element.js +19 -47
  25. package/build-module/create-interpolate-element.js.map +1 -1
  26. package/build-module/index.js.map +1 -1
  27. package/build-module/platform.android.js +2 -2
  28. package/build-module/platform.android.js.map +1 -1
  29. package/build-module/platform.ios.js +2 -2
  30. package/build-module/platform.ios.js.map +1 -1
  31. package/build-module/platform.js +0 -1
  32. package/build-module/platform.js.map +1 -1
  33. package/build-module/raw-html.js +6 -4
  34. package/build-module/raw-html.js.map +1 -1
  35. package/build-module/react-platform.js +8 -8
  36. package/build-module/react-platform.js.map +1 -1
  37. package/build-module/react-platform.native.js +1 -1
  38. package/build-module/react-platform.native.js.map +1 -1
  39. package/build-module/react.js +31 -33
  40. package/build-module/react.js.map +1 -1
  41. package/build-module/serialize.js +39 -89
  42. package/build-module/serialize.js.map +1 -1
  43. package/build-module/utils.js +0 -2
  44. package/build-module/utils.js.map +1 -1
  45. package/build-types/platform.d.ts +2 -2
  46. package/build-types/react-platform.d.ts +8 -8
  47. package/build-types/react-platform.d.ts.map +1 -1
  48. package/build-types/react.d.ts +29 -29
  49. package/build-types/react.d.ts.map +1 -1
  50. package/package.json +3 -3
  51. package/tsconfig.tsbuildinfo +1 -1
@@ -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","SVG_ATTRIBUTE_WITH_DASHES_LIST","reduce","map","toLowerCase","CASE_SENSITIVE_SVG_ATTRIBUTES","SVG_ATTRIBUTES_WITH_COLONS","replace","getNormalAttributeName","attributeLowerCase","getNormalStylePropertyName","property","startsWith","getNormalStylePropertyValue","has","renderElement","element","context","legacyContext","Array","isArray","renderChildren","toString","type","props","StrictMode","Fragment","children","RawHTML","wrapperProps","renderNativeComponent","Object","keys","length","dangerouslySetInnerHTML","__html","prototype","render","renderComponent","$$typeof","_currentValue","content","hasOwnProperty","restProps","attributes","renderAttributes","Component","instance","getChildContext","assign","html","result","i","child","key","isBooleanAttribute","isMeaningfulAttribute","style","normalName","normalValue"],"mappings":";;;;;;;;;;;;;;;AA8BA;;AACA;;AAKA;;AASA;;AACA;;AA9CA;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;;AAIA;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,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AAW,OAAX,CAAP,CADT,IAEAlE,qBAAqB,CAAC0B,GAAtB,CAA2BjB,SAA3B,CAHD,CAzB0B,CA8B1B;;AACA,QAAK,OAAOE,KAAP,KAAiB,SAAjB,IAA8B,CAAEyD,qBAArC,EAA6D;AAC5D;AACA;;AAEDL,IAAAA,MAAM,IAAI,MAAMtD,SAAhB,CAnC0B,CAqC1B;AACA;;AACA,QAAK0D,kBAAL,EAA0B;AACzB;AACA;;AAED,QAAK,OAAOxD,KAAP,KAAiB,QAAtB,EAAiC;AAChCA,MAAAA,KAAK,GAAG,iCAAiBA,KAAjB,CAAR;AACA;;AAEDoD,IAAAA,MAAM,IAAI,OAAOpD,KAAP,GAAe,GAAzB;AACA;;AAED,SAAOoD,MAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASnD,WAAT,CAAsByD,KAAtB,EAA8B;AACpC;AACA,MAAK,CAAE,kCAAeA,KAAf,CAAP,EAAgC;AAC/B,WAAOA,KAAP;AACA;;AAED,MAAIN,MAAJ;;AAEA,OAAM,MAAMxC,QAAZ,IAAwB8C,KAAxB,EAAgC;AAC/B,UAAM1D,KAAK,GAAG0D,KAAK,CAAE9C,QAAF,CAAnB;;AACA,QAAK,SAASZ,KAAT,IAAkBjB,SAAS,KAAKiB,KAArC,EAA6C;AAC5C;AACA;;AAED,QAAKoD,MAAL,EAAc;AACbA,MAAAA,MAAM,IAAI,GAAV;AACA,KAFD,MAEO;AACNA,MAAAA,MAAM,GAAG,EAAT;AACA;;AAED,UAAMO,UAAU,GAAGhD,0BAA0B,CAAEC,QAAF,CAA7C;AACA,UAAMgD,WAAW,GAAG9C,2BAA2B,CAAEF,QAAF,EAAYZ,KAAZ,CAA/C;AACAoD,IAAAA,MAAM,IAAIO,UAAU,GAAG,GAAb,GAAmBC,WAA7B;AACA;;AAED,SAAOR,MAAP;AACA;;eAEcpC,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 { isPlainObject } from 'is-plain-object';\nimport { paramCase as kebabCase } from 'change-case';\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 * This is a map of all SVG attributes that have dashes. Map(lower case prop => dashed lower case attribute).\n * We need this to render e.g strokeWidth as stroke-width.\n *\n * List from: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute.\n */\nconst SVG_ATTRIBUTE_WITH_DASHES_LIST = [\n\t'accentHeight',\n\t'alignmentBaseline',\n\t'arabicForm',\n\t'baselineShift',\n\t'capHeight',\n\t'clipPath',\n\t'clipRule',\n\t'colorInterpolation',\n\t'colorInterpolationFilters',\n\t'colorProfile',\n\t'colorRendering',\n\t'dominantBaseline',\n\t'enableBackground',\n\t'fillOpacity',\n\t'fillRule',\n\t'floodColor',\n\t'floodOpacity',\n\t'fontFamily',\n\t'fontSize',\n\t'fontSizeAdjust',\n\t'fontStretch',\n\t'fontStyle',\n\t'fontVariant',\n\t'fontWeight',\n\t'glyphName',\n\t'glyphOrientationHorizontal',\n\t'glyphOrientationVertical',\n\t'horizAdvX',\n\t'horizOriginX',\n\t'imageRendering',\n\t'letterSpacing',\n\t'lightingColor',\n\t'markerEnd',\n\t'markerMid',\n\t'markerStart',\n\t'overlinePosition',\n\t'overlineThickness',\n\t'paintOrder',\n\t'panose1',\n\t'pointerEvents',\n\t'renderingIntent',\n\t'shapeRendering',\n\t'stopColor',\n\t'stopOpacity',\n\t'strikethroughPosition',\n\t'strikethroughThickness',\n\t'strokeDasharray',\n\t'strokeDashoffset',\n\t'strokeLinecap',\n\t'strokeLinejoin',\n\t'strokeMiterlimit',\n\t'strokeOpacity',\n\t'strokeWidth',\n\t'textAnchor',\n\t'textDecoration',\n\t'textRendering',\n\t'underlinePosition',\n\t'underlineThickness',\n\t'unicodeBidi',\n\t'unicodeRange',\n\t'unitsPerEm',\n\t'vAlphabetic',\n\t'vHanging',\n\t'vIdeographic',\n\t'vMathematical',\n\t'vectorEffect',\n\t'vertAdvY',\n\t'vertOriginX',\n\t'vertOriginY',\n\t'wordSpacing',\n\t'writingMode',\n\t'xmlnsXlink',\n\t'xHeight',\n].reduce( ( map, attribute ) => {\n\t// The keys are lower-cased for more robust lookup.\n\tmap[ attribute.toLowerCase() ] = attribute;\n\treturn map;\n}, {} );\n\n/**\n * This is a map of all case-sensitive SVG attributes. Map(lowercase key => proper case attribute).\n * The keys are lower-cased for more robust lookup.\n * Note that this list only contains attributes that contain at least one capital letter.\n * Lowercase attributes don't need mapping, since we lowercase all attributes by default.\n */\nconst CASE_SENSITIVE_SVG_ATTRIBUTES = [\n\t'allowReorder',\n\t'attributeName',\n\t'attributeType',\n\t'autoReverse',\n\t'baseFrequency',\n\t'baseProfile',\n\t'calcMode',\n\t'clipPathUnits',\n\t'contentScriptType',\n\t'contentStyleType',\n\t'diffuseConstant',\n\t'edgeMode',\n\t'externalResourcesRequired',\n\t'filterRes',\n\t'filterUnits',\n\t'glyphRef',\n\t'gradientTransform',\n\t'gradientUnits',\n\t'kernelMatrix',\n\t'kernelUnitLength',\n\t'keyPoints',\n\t'keySplines',\n\t'keyTimes',\n\t'lengthAdjust',\n\t'limitingConeAngle',\n\t'markerHeight',\n\t'markerUnits',\n\t'markerWidth',\n\t'maskContentUnits',\n\t'maskUnits',\n\t'numOctaves',\n\t'pathLength',\n\t'patternContentUnits',\n\t'patternTransform',\n\t'patternUnits',\n\t'pointsAtX',\n\t'pointsAtY',\n\t'pointsAtZ',\n\t'preserveAlpha',\n\t'preserveAspectRatio',\n\t'primitiveUnits',\n\t'refX',\n\t'refY',\n\t'repeatCount',\n\t'repeatDur',\n\t'requiredExtensions',\n\t'requiredFeatures',\n\t'specularConstant',\n\t'specularExponent',\n\t'spreadMethod',\n\t'startOffset',\n\t'stdDeviation',\n\t'stitchTiles',\n\t'suppressContentEditableWarning',\n\t'suppressHydrationWarning',\n\t'surfaceScale',\n\t'systemLanguage',\n\t'tableValues',\n\t'targetX',\n\t'targetY',\n\t'textLength',\n\t'viewBox',\n\t'viewTarget',\n\t'xChannelSelector',\n\t'yChannelSelector',\n].reduce( ( map, attribute ) => {\n\t// The keys are lower-cased for more robust lookup.\n\tmap[ attribute.toLowerCase() ] = attribute;\n\treturn map;\n}, {} );\n\n/**\n * This is a map of all SVG attributes that have colons.\n * Keys are lower-cased and stripped of their colons for more robust lookup.\n */\nconst SVG_ATTRIBUTES_WITH_COLONS = [\n\t'xlink:actuate',\n\t'xlink:arcrole',\n\t'xlink:href',\n\t'xlink:role',\n\t'xlink:show',\n\t'xlink:title',\n\t'xlink:type',\n\t'xml:base',\n\t'xml:lang',\n\t'xml:space',\n\t'xmlns:xlink',\n].reduce( ( map, attribute ) => {\n\tmap[ attribute.replace( ':', '' ).toLowerCase() ] = attribute;\n\treturn map;\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\tconst attributeLowerCase = attribute.toLowerCase();\n\n\tif ( CASE_SENSITIVE_SVG_ATTRIBUTES[ attributeLowerCase ] ) {\n\t\treturn CASE_SENSITIVE_SVG_ATTRIBUTES[ attributeLowerCase ];\n\t} else if ( SVG_ATTRIBUTE_WITH_DASHES_LIST[ attributeLowerCase ] ) {\n\t\treturn kebabCase(\n\t\t\tSVG_ATTRIBUTE_WITH_DASHES_LIST[ attributeLowerCase ]\n\t\t);\n\t} else if ( SVG_ATTRIBUTES_WITH_COLONS[ attributeLowerCase ] ) {\n\t\treturn SVG_ATTRIBUTES_WITH_COLONS[ attributeLowerCase ];\n\t}\n\n\treturn attributeLowerCase;\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 ( property.startsWith( '--' ) ) {\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 { type, props } = /** @type {{type?: any, props?: any}} */ (\n\t\telement\n\t);\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\t! Object.keys( wrapperProps ).length ? 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\tconst { value, ...restProps } = props;\n\t\tprops = restProps;\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} */ (\n\t\tComponent\n\t)( props, legacyContext );\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}} */ (\n\t\t\t\tinstance\n\t\t\t).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 = Array.isArray( children ) ? children : [ 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,"names":["_isPlainObject","require","_changeCase","_escapeHtml","_react","_rawHtml","_interopRequireDefault","Provider","Consumer","createContext","undefined","ForwardRef","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","SVG_ATTRIBUTE_WITH_DASHES_LIST","reduce","map","toLowerCase","CASE_SENSITIVE_SVG_ATTRIBUTES","SVG_ATTRIBUTES_WITH_COLONS","replace","getNormalAttributeName","attributeLowerCase","kebabCase","getNormalStylePropertyName","property","startsWith","getNormalStylePropertyValue","has","renderElement","element","context","legacyContext","Array","isArray","renderChildren","escapeHTML","toString","type","props","StrictMode","Fragment","children","RawHTML","wrapperProps","renderNativeComponent","Object","keys","length","dangerouslySetInnerHTML","__html","prototype","render","renderComponent","$$typeof","_currentValue","content","hasOwnProperty","restProps","attributes","renderAttributes","Component","instance","getChildContext","assign","html","result","i","child","key","isValidAttributeName","isBooleanAttribute","isMeaningfulAttribute","escapeAttribute","style","isPlainObject","normalName","normalValue","_default","exports","default"],"sources":["@wordpress/element/src/serialize.js"],"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 { isPlainObject } from 'is-plain-object';\nimport { paramCase as kebabCase } from 'change-case';\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 * This is a map of all SVG attributes that have dashes. Map(lower case prop => dashed lower case attribute).\n * We need this to render e.g strokeWidth as stroke-width.\n *\n * List from: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute.\n */\nconst SVG_ATTRIBUTE_WITH_DASHES_LIST = [\n\t'accentHeight',\n\t'alignmentBaseline',\n\t'arabicForm',\n\t'baselineShift',\n\t'capHeight',\n\t'clipPath',\n\t'clipRule',\n\t'colorInterpolation',\n\t'colorInterpolationFilters',\n\t'colorProfile',\n\t'colorRendering',\n\t'dominantBaseline',\n\t'enableBackground',\n\t'fillOpacity',\n\t'fillRule',\n\t'floodColor',\n\t'floodOpacity',\n\t'fontFamily',\n\t'fontSize',\n\t'fontSizeAdjust',\n\t'fontStretch',\n\t'fontStyle',\n\t'fontVariant',\n\t'fontWeight',\n\t'glyphName',\n\t'glyphOrientationHorizontal',\n\t'glyphOrientationVertical',\n\t'horizAdvX',\n\t'horizOriginX',\n\t'imageRendering',\n\t'letterSpacing',\n\t'lightingColor',\n\t'markerEnd',\n\t'markerMid',\n\t'markerStart',\n\t'overlinePosition',\n\t'overlineThickness',\n\t'paintOrder',\n\t'panose1',\n\t'pointerEvents',\n\t'renderingIntent',\n\t'shapeRendering',\n\t'stopColor',\n\t'stopOpacity',\n\t'strikethroughPosition',\n\t'strikethroughThickness',\n\t'strokeDasharray',\n\t'strokeDashoffset',\n\t'strokeLinecap',\n\t'strokeLinejoin',\n\t'strokeMiterlimit',\n\t'strokeOpacity',\n\t'strokeWidth',\n\t'textAnchor',\n\t'textDecoration',\n\t'textRendering',\n\t'underlinePosition',\n\t'underlineThickness',\n\t'unicodeBidi',\n\t'unicodeRange',\n\t'unitsPerEm',\n\t'vAlphabetic',\n\t'vHanging',\n\t'vIdeographic',\n\t'vMathematical',\n\t'vectorEffect',\n\t'vertAdvY',\n\t'vertOriginX',\n\t'vertOriginY',\n\t'wordSpacing',\n\t'writingMode',\n\t'xmlnsXlink',\n\t'xHeight',\n].reduce( ( map, attribute ) => {\n\t// The keys are lower-cased for more robust lookup.\n\tmap[ attribute.toLowerCase() ] = attribute;\n\treturn map;\n}, {} );\n\n/**\n * This is a map of all case-sensitive SVG attributes. Map(lowercase key => proper case attribute).\n * The keys are lower-cased for more robust lookup.\n * Note that this list only contains attributes that contain at least one capital letter.\n * Lowercase attributes don't need mapping, since we lowercase all attributes by default.\n */\nconst CASE_SENSITIVE_SVG_ATTRIBUTES = [\n\t'allowReorder',\n\t'attributeName',\n\t'attributeType',\n\t'autoReverse',\n\t'baseFrequency',\n\t'baseProfile',\n\t'calcMode',\n\t'clipPathUnits',\n\t'contentScriptType',\n\t'contentStyleType',\n\t'diffuseConstant',\n\t'edgeMode',\n\t'externalResourcesRequired',\n\t'filterRes',\n\t'filterUnits',\n\t'glyphRef',\n\t'gradientTransform',\n\t'gradientUnits',\n\t'kernelMatrix',\n\t'kernelUnitLength',\n\t'keyPoints',\n\t'keySplines',\n\t'keyTimes',\n\t'lengthAdjust',\n\t'limitingConeAngle',\n\t'markerHeight',\n\t'markerUnits',\n\t'markerWidth',\n\t'maskContentUnits',\n\t'maskUnits',\n\t'numOctaves',\n\t'pathLength',\n\t'patternContentUnits',\n\t'patternTransform',\n\t'patternUnits',\n\t'pointsAtX',\n\t'pointsAtY',\n\t'pointsAtZ',\n\t'preserveAlpha',\n\t'preserveAspectRatio',\n\t'primitiveUnits',\n\t'refX',\n\t'refY',\n\t'repeatCount',\n\t'repeatDur',\n\t'requiredExtensions',\n\t'requiredFeatures',\n\t'specularConstant',\n\t'specularExponent',\n\t'spreadMethod',\n\t'startOffset',\n\t'stdDeviation',\n\t'stitchTiles',\n\t'suppressContentEditableWarning',\n\t'suppressHydrationWarning',\n\t'surfaceScale',\n\t'systemLanguage',\n\t'tableValues',\n\t'targetX',\n\t'targetY',\n\t'textLength',\n\t'viewBox',\n\t'viewTarget',\n\t'xChannelSelector',\n\t'yChannelSelector',\n].reduce( ( map, attribute ) => {\n\t// The keys are lower-cased for more robust lookup.\n\tmap[ attribute.toLowerCase() ] = attribute;\n\treturn map;\n}, {} );\n\n/**\n * This is a map of all SVG attributes that have colons.\n * Keys are lower-cased and stripped of their colons for more robust lookup.\n */\nconst SVG_ATTRIBUTES_WITH_COLONS = [\n\t'xlink:actuate',\n\t'xlink:arcrole',\n\t'xlink:href',\n\t'xlink:role',\n\t'xlink:show',\n\t'xlink:title',\n\t'xlink:type',\n\t'xml:base',\n\t'xml:lang',\n\t'xml:space',\n\t'xmlns:xlink',\n].reduce( ( map, attribute ) => {\n\tmap[ attribute.replace( ':', '' ).toLowerCase() ] = attribute;\n\treturn map;\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\tconst attributeLowerCase = attribute.toLowerCase();\n\n\tif ( CASE_SENSITIVE_SVG_ATTRIBUTES[ attributeLowerCase ] ) {\n\t\treturn CASE_SENSITIVE_SVG_ATTRIBUTES[ attributeLowerCase ];\n\t} else if ( SVG_ATTRIBUTE_WITH_DASHES_LIST[ attributeLowerCase ] ) {\n\t\treturn kebabCase(\n\t\t\tSVG_ATTRIBUTE_WITH_DASHES_LIST[ attributeLowerCase ]\n\t\t);\n\t} else if ( SVG_ATTRIBUTES_WITH_COLONS[ attributeLowerCase ] ) {\n\t\treturn SVG_ATTRIBUTES_WITH_COLONS[ attributeLowerCase ];\n\t}\n\n\treturn attributeLowerCase;\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 ( property.startsWith( '--' ) ) {\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 { type, props } = /** @type {{type?: any, props?: any}} */ (\n\t\telement\n\t);\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\t! Object.keys( wrapperProps ).length ? 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\tconst { value, ...restProps } = props;\n\t\tprops = restProps;\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} */ (\n\t\tComponent\n\t)( props, legacyContext );\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}} */ (\n\t\t\t\tinstance\n\t\t\t).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 = Array.isArray( children ) ? children : [ 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"],"mappings":";;;;;;;;;;;;;AA8BA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,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AM,MAAMzC,QAAQ,IAAIiD,KAAK,EAAG;IAC/B,MAAM9D,KAAK,GAAG8D,KAAK,CAAEjD,QAAQ,CAAE;IAC/B,IAAK,IAAI,KAAKb,KAAK,IAAIlB,SAAS,KAAKkB,KAAK,EAAG;MAC5C;IACD;IAEA,IAAKsD,MAAM,EAAG;MACbA,MAAM,IAAI,GAAG;IACd,CAAC,MAAM;MACNA,MAAM,GAAG,EAAE;IACZ;IAEA,MAAMU,UAAU,GAAGpD,0BAA0B,CAAEC,QAAS,CAAC;IACzD,MAAMoD,WAAW,GAAGlD,2BAA2B,CAAEF,QAAQ,EAAEb,KAAM,CAAC;IAClEsD,MAAM,IAAIU,UAAU,GAAG,GAAG,GAAGC,WAAW;EACzC;EAEA,OAAOX,MAAM;AACd;AAAC,IAAAY,QAAA,GAEcjD,aAAa;AAAAkD,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
package/build/utils.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isEmptyElement = void 0;
7
-
8
7
  /**
9
8
  * Checks if the provided WP element is empty.
10
9
  *
@@ -15,13 +14,10 @@ const isEmptyElement = element => {
15
14
  if (typeof element === 'number') {
16
15
  return false;
17
16
  }
18
-
19
17
  if (typeof element?.valueOf() === 'string' || Array.isArray(element)) {
20
18
  return !element.length;
21
19
  }
22
-
23
20
  return !element;
24
21
  };
25
-
26
22
  exports.isEmptyElement = isEmptyElement;
27
23
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/utils.js"],"names":["isEmptyElement","element","valueOf","Array","isArray","length"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,cAAc,GAAKC,OAAF,IAAe;AAC5C,MAAK,OAAOA,OAAP,KAAmB,QAAxB,EAAmC;AAClC,WAAO,KAAP;AACA;;AAED,MAAK,OAAOA,OAAO,EAAEC,OAAT,EAAP,KAA8B,QAA9B,IAA0CC,KAAK,CAACC,OAAN,CAAeH,OAAf,CAA/C,EAA0E;AACzE,WAAO,CAAEA,OAAO,CAACI,MAAjB;AACA;;AAED,SAAO,CAAEJ,OAAT;AACA,CAVM","sourcesContent":["/**\n * Checks if the provided WP element is empty.\n *\n * @param {*} element WP element to check.\n * @return {boolean} True when an element is considered empty.\n */\nexport const isEmptyElement = ( element ) => {\n\tif ( typeof element === 'number' ) {\n\t\treturn false;\n\t}\n\n\tif ( typeof element?.valueOf() === 'string' || Array.isArray( element ) ) {\n\t\treturn ! element.length;\n\t}\n\n\treturn ! element;\n};\n"]}
1
+ {"version":3,"names":["isEmptyElement","element","valueOf","Array","isArray","length","exports"],"sources":["@wordpress/element/src/utils.js"],"sourcesContent":["/**\n * Checks if the provided WP element is empty.\n *\n * @param {*} element WP element to check.\n * @return {boolean} True when an element is considered empty.\n */\nexport const isEmptyElement = ( element ) => {\n\tif ( typeof element === 'number' ) {\n\t\treturn false;\n\t}\n\n\tif ( typeof element?.valueOf() === 'string' || Array.isArray( element ) ) {\n\t\treturn ! element.length;\n\t}\n\n\treturn ! element;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,cAAc,GAAKC,OAAO,IAAM;EAC5C,IAAK,OAAOA,OAAO,KAAK,QAAQ,EAAG;IAClC,OAAO,KAAK;EACb;EAEA,IAAK,OAAOA,OAAO,EAAEC,OAAO,CAAC,CAAC,KAAK,QAAQ,IAAIC,KAAK,CAACC,OAAO,CAAEH,OAAQ,CAAC,EAAG;IACzE,OAAO,CAAEA,OAAO,CAACI,MAAM;EACxB;EAEA,OAAO,CAAEJ,OAAO;AACjB,CAAC;AAACK,OAAA,CAAAN,cAAA,GAAAA,cAAA"}
@@ -2,9 +2,11 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import { createElement, cloneElement, Fragment, isValidElement } from './react';
5
+
5
6
  /** @typedef {import('./react').WPElement} WPElement */
6
7
 
7
8
  let indoc, offset, output, stack;
9
+
8
10
  /**
9
11
  * Matches tags in the localized string
10
12
  *
@@ -20,8 +22,8 @@ let indoc, offset, output, stack;
20
22
  *
21
23
  * @type {RegExp}
22
24
  */
23
-
24
25
  const tokenizer = /<(\/)?(\w+)\s*(\/)?>/g;
26
+
25
27
  /**
26
28
  * The stack frame tracking parse progress.
27
29
  *
@@ -61,7 +63,6 @@ const tokenizer = /<(\/)?(\w+)\s*(\/)?>/g;
61
63
  *
62
64
  * @return {Frame} The stack frame tracking parse progress.
63
65
  */
64
-
65
66
  function createFrame(element, tokenStart, tokenLength, prevOffset, leadingTextStart) {
66
67
  return {
67
68
  element,
@@ -72,6 +73,7 @@ function createFrame(element, tokenStart, tokenLength, prevOffset, leadingTextSt
72
73
  children: []
73
74
  };
74
75
  }
76
+
75
77
  /**
76
78
  * This function creates an interpolated element from a passed in string with
77
79
  * specific tags matching how the string should be converted to an element via
@@ -99,24 +101,21 @@ function createFrame(element, tokenStart, tokenLength, prevOffset, leadingTextSt
99
101
  * @throws {TypeError}
100
102
  * @return {WPElement} A wp element.
101
103
  */
102
-
103
-
104
104
  const createInterpolateElement = (interpolatedString, conversionMap) => {
105
105
  indoc = interpolatedString;
106
106
  offset = 0;
107
107
  output = [];
108
108
  stack = [];
109
109
  tokenizer.lastIndex = 0;
110
-
111
110
  if (!isValidConversionMap(conversionMap)) {
112
111
  throw new TypeError('The conversionMap provided is not valid. It must be an object with values that are WPElements');
113
112
  }
114
-
115
- do {// twiddle our thumbs
113
+ do {
114
+ // twiddle our thumbs
116
115
  } while (proceed(conversionMap));
117
-
118
116
  return createElement(Fragment, null, ...output);
119
117
  };
118
+
120
119
  /**
121
120
  * Validate conversion map.
122
121
  *
@@ -129,13 +128,12 @@ const createInterpolateElement = (interpolatedString, conversionMap) => {
129
128
  *
130
129
  * @return {boolean} True means the map is valid.
131
130
  */
132
-
133
-
134
131
  const isValidConversionMap = conversionMap => {
135
132
  const isObject = typeof conversionMap === 'object';
136
133
  const values = isObject && Object.values(conversionMap);
137
134
  return isObject && values.length && values.every(element => isValidElement(element));
138
135
  };
136
+
139
137
  /**
140
138
  * This is the iterator over the matches in the string.
141
139
  *
@@ -145,19 +143,15 @@ const isValidConversionMap = conversionMap => {
145
143
  *
146
144
  * @return {boolean} true for continuing to iterate, false for finished.
147
145
  */
148
-
149
-
150
146
  function proceed(conversionMap) {
151
147
  const next = nextToken();
152
148
  const [tokenType, name, startOffset, tokenLength] = next;
153
149
  const stackDepth = stack.length;
154
150
  const leadingTextStart = startOffset > offset ? offset : null;
155
-
156
151
  if (!conversionMap[name]) {
157
152
  addText();
158
153
  return false;
159
154
  }
160
-
161
155
  switch (tokenType) {
162
156
  case 'no-more-tokens':
163
157
  if (stackDepth !== 0) {
@@ -167,41 +161,36 @@ function proceed(conversionMap) {
167
161
  } = stack.pop();
168
162
  output.push(indoc.substr(stackLeadingText, tokenStart));
169
163
  }
170
-
171
164
  addText();
172
165
  return false;
173
-
174
166
  case 'self-closed':
175
167
  if (0 === stackDepth) {
176
168
  if (null !== leadingTextStart) {
177
169
  output.push(indoc.substr(leadingTextStart, startOffset - leadingTextStart));
178
170
  }
179
-
180
171
  output.push(conversionMap[name]);
181
172
  offset = startOffset + tokenLength;
182
173
  return true;
183
- } // Otherwise we found an inner element.
184
-
174
+ }
185
175
 
176
+ // Otherwise we found an inner element.
186
177
  addChild(createFrame(conversionMap[name], startOffset, tokenLength));
187
178
  offset = startOffset + tokenLength;
188
179
  return true;
189
-
190
180
  case 'opener':
191
181
  stack.push(createFrame(conversionMap[name], startOffset, tokenLength, startOffset + tokenLength, leadingTextStart));
192
182
  offset = startOffset + tokenLength;
193
183
  return true;
194
-
195
184
  case 'closer':
196
185
  // If we're not nesting then this is easy - close the block.
197
186
  if (1 === stackDepth) {
198
187
  closeOuterElement(startOffset);
199
188
  offset = startOffset + tokenLength;
200
189
  return true;
201
- } // Otherwise we're nested and we have to close out the current
202
- // block and add it as a innerBlock to the parent.
203
-
190
+ }
204
191
 
192
+ // Otherwise we're nested and we have to close out the current
193
+ // block and add it as a innerBlock to the parent.
205
194
  const stackTop = stack.pop();
206
195
  const text = indoc.substr(stackTop.prevOffset, startOffset - stackTop.prevOffset);
207
196
  stackTop.children.push(text);
@@ -211,12 +200,12 @@ function proceed(conversionMap) {
211
200
  addChild(frame);
212
201
  offset = startOffset + tokenLength;
213
202
  return true;
214
-
215
203
  default:
216
204
  addText();
217
205
  return false;
218
206
  }
219
207
  }
208
+
220
209
  /**
221
210
  * Grabs the next token match in the string and returns it's details.
222
211
  *
@@ -224,29 +213,24 @@ function proceed(conversionMap) {
224
213
  *
225
214
  * @return {Array} An array of details for the token matched.
226
215
  */
227
-
228
-
229
216
  function nextToken() {
230
- const matches = tokenizer.exec(indoc); // We have no more tokens.
231
-
217
+ const matches = tokenizer.exec(indoc);
218
+ // We have no more tokens.
232
219
  if (null === matches) {
233
220
  return ['no-more-tokens'];
234
221
  }
235
-
236
222
  const startedAt = matches.index;
237
223
  const [match, isClosing, name, isSelfClosed] = matches;
238
224
  const length = match.length;
239
-
240
225
  if (isSelfClosed) {
241
226
  return ['self-closed', name, startedAt, length];
242
227
  }
243
-
244
228
  if (isClosing) {
245
229
  return ['closer', name, startedAt, length];
246
230
  }
247
-
248
231
  return ['opener', name, startedAt, length];
249
232
  }
233
+
250
234
  /**
251
235
  * Pushes text extracted from the indoc string to the output stack given the
252
236
  * current rawLength value and offset (if rawLength is provided ) or the
@@ -254,17 +238,14 @@ function nextToken() {
254
238
  *
255
239
  * @private
256
240
  */
257
-
258
-
259
241
  function addText() {
260
242
  const length = indoc.length - offset;
261
-
262
243
  if (0 === length) {
263
244
  return;
264
245
  }
265
-
266
246
  output.push(indoc.substr(offset, length));
267
247
  }
248
+
268
249
  /**
269
250
  * Pushes a child element to the associated parent element's children for the
270
251
  * parent currently active in the stack.
@@ -274,8 +255,6 @@ function addText() {
274
255
  * @param {Frame} frame The Frame containing the child element and it's
275
256
  * token information.
276
257
  */
277
-
278
-
279
258
  function addChild(frame) {
280
259
  const {
281
260
  element,
@@ -286,14 +265,13 @@ function addChild(frame) {
286
265
  } = frame;
287
266
  const parent = stack[stack.length - 1];
288
267
  const text = indoc.substr(parent.prevOffset, tokenStart - parent.prevOffset);
289
-
290
268
  if (text) {
291
269
  parent.children.push(text);
292
270
  }
293
-
294
271
  parent.children.push(cloneElement(element, null, ...children));
295
272
  parent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength;
296
273
  }
274
+
297
275
  /**
298
276
  * This is called for closing tags. It creates the element currently active in
299
277
  * the stack.
@@ -306,8 +284,6 @@ function addChild(frame) {
306
284
  * helps capture any remaining nested text nodes in
307
285
  * the element.
308
286
  */
309
-
310
-
311
287
  function closeOuterElement(endOffset) {
312
288
  const {
313
289
  element,
@@ -317,17 +293,13 @@ function closeOuterElement(endOffset) {
317
293
  children
318
294
  } = stack.pop();
319
295
  const text = endOffset ? indoc.substr(prevOffset, endOffset - prevOffset) : indoc.substr(prevOffset);
320
-
321
296
  if (text) {
322
297
  children.push(text);
323
298
  }
324
-
325
299
  if (null !== leadingTextStart) {
326
300
  output.push(indoc.substr(leadingTextStart, tokenStart - leadingTextStart));
327
301
  }
328
-
329
302
  output.push(cloneElement(element, null, ...children));
330
303
  }
331
-
332
304
  export default createInterpolateElement;
333
305
  //# sourceMappingURL=create-interpolate-element.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/create-interpolate-element.js"],"names":["createElement","cloneElement","Fragment","isValidElement","indoc","offset","output","stack","tokenizer","createFrame","element","tokenStart","tokenLength","prevOffset","leadingTextStart","children","createInterpolateElement","interpolatedString","conversionMap","lastIndex","isValidConversionMap","TypeError","proceed","isObject","values","Object","length","every","next","nextToken","tokenType","name","startOffset","stackDepth","addText","stackLeadingText","pop","push","substr","addChild","closeOuterElement","stackTop","text","frame","matches","exec","startedAt","index","match","isClosing","isSelfClosed","parent","endOffset"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAT,EAAwBC,YAAxB,E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C,MAAN,CAAczB,UAAd,CAFH;;AAIA,MAAK6B,IAAL,EAAY;AACX3B,IAAAA,QAAQ,CAACsB,IAAT,CAAeK,IAAf;AACA;;AAED,MAAK,SAAS5B,gBAAd,EAAiC;AAChCR,IAAAA,MAAM,CAAC+B,IAAP,CACCjC,KAAK,CAACkC,MAAN,CAAcxB,gBAAd,EAAgCH,UAAU,GAAGG,gBAA7C,CADD;AAGA;;AAEDR,EAAAA,MAAM,CAAC+B,IAAP,CAAapC,YAAY,CAAES,OAAF,EAAW,IAAX,EAAiB,GAAGK,QAApB,CAAzB;AACA;;AAED,eAAeC,wBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { createElement, cloneElement, Fragment, isValidElement } from './react';\n\n/** @typedef {import('./react').WPElement} WPElement */\n\nlet indoc, offset, output, stack;\n\n/**\n * Matches tags in the localized string\n *\n * This is used for extracting the tag pattern groups for parsing the localized\n * string and along with the map converting it to a react element.\n *\n * There are four references extracted using this tokenizer:\n *\n * match: Full match of the tag (i.e. <strong>, </strong>, <br/>)\n * isClosing: The closing slash, if it exists.\n * name: The name portion of the tag (strong, br) (if )\n * isSelfClosed: The slash on a self closing tag, if it exists.\n *\n * @type {RegExp}\n */\nconst tokenizer = /<(\\/)?(\\w+)\\s*(\\/)?>/g;\n\n/**\n * The stack frame tracking parse progress.\n *\n * @typedef Frame\n *\n * @property {WPElement} element A parent element which may still have\n * @property {number} tokenStart Offset at which parent element first\n * appears.\n * @property {number} tokenLength Length of string marking start of parent\n * element.\n * @property {number} [prevOffset] Running offset at which parsing should\n * continue.\n * @property {number} [leadingTextStart] Offset at which last closing element\n * finished, used for finding text between\n * elements.\n * @property {WPElement[]} children Children.\n */\n\n/**\n * Tracks recursive-descent parse state.\n *\n * This is a Stack frame holding parent elements until all children have been\n * parsed.\n *\n * @private\n * @param {WPElement} element A parent element which may still have\n * nested children not yet parsed.\n * @param {number} tokenStart Offset at which parent element first\n * appears.\n * @param {number} tokenLength Length of string marking start of parent\n * element.\n * @param {number} [prevOffset] Running offset at which parsing should\n * continue.\n * @param {number} [leadingTextStart] Offset at which last closing element\n * finished, used for finding text between\n * elements.\n *\n * @return {Frame} The stack frame tracking parse progress.\n */\nfunction createFrame(\n\telement,\n\ttokenStart,\n\ttokenLength,\n\tprevOffset,\n\tleadingTextStart\n) {\n\treturn {\n\t\telement,\n\t\ttokenStart,\n\t\ttokenLength,\n\t\tprevOffset,\n\t\tleadingTextStart,\n\t\tchildren: [],\n\t};\n}\n\n/**\n * This function creates an interpolated element from a passed in string with\n * specific tags matching how the string should be converted to an element via\n * the conversion map value.\n *\n * @example\n * For example, for the given string:\n *\n * \"This is a <span>string</span> with <a>a link</a> and a self-closing\n * <CustomComponentB/> tag\"\n *\n * You would have something like this as the conversionMap value:\n *\n * ```js\n * {\n * span: <span />,\n * a: <a href={ 'https://github.com' } />,\n * CustomComponentB: <CustomComponent />,\n * }\n * ```\n *\n * @param {string} interpolatedString The interpolation string to be parsed.\n * @param {Record<string, WPElement>} conversionMap The map used to convert the string to\n * a react element.\n * @throws {TypeError}\n * @return {WPElement} A wp element.\n */\nconst createInterpolateElement = ( interpolatedString, conversionMap ) => {\n\tindoc = interpolatedString;\n\toffset = 0;\n\toutput = [];\n\tstack = [];\n\ttokenizer.lastIndex = 0;\n\n\tif ( ! isValidConversionMap( conversionMap ) ) {\n\t\tthrow new TypeError(\n\t\t\t'The conversionMap provided is not valid. It must be an object with values that are WPElements'\n\t\t);\n\t}\n\n\tdo {\n\t\t// twiddle our thumbs\n\t} while ( proceed( conversionMap ) );\n\treturn createElement( Fragment, null, ...output );\n};\n\n/**\n * Validate conversion map.\n *\n * A map is considered valid if it's an object and every value in the object\n * is a WPElement\n *\n * @private\n *\n * @param {Object} conversionMap The map being validated.\n *\n * @return {boolean} True means the map is valid.\n */\nconst isValidConversionMap = ( conversionMap ) => {\n\tconst isObject = typeof conversionMap === 'object';\n\tconst values = isObject && Object.values( conversionMap );\n\treturn (\n\t\tisObject &&\n\t\tvalues.length &&\n\t\tvalues.every( ( element ) => isValidElement( element ) )\n\t);\n};\n\n/**\n * This is the iterator over the matches in the string.\n *\n * @private\n *\n * @param {Object} conversionMap The conversion map for the string.\n *\n * @return {boolean} true for continuing to iterate, false for finished.\n */\nfunction proceed( conversionMap ) {\n\tconst next = nextToken();\n\tconst [ tokenType, name, startOffset, tokenLength ] = next;\n\tconst stackDepth = stack.length;\n\tconst leadingTextStart = startOffset > offset ? offset : null;\n\tif ( ! conversionMap[ name ] ) {\n\t\taddText();\n\t\treturn false;\n\t}\n\tswitch ( tokenType ) {\n\t\tcase 'no-more-tokens':\n\t\t\tif ( stackDepth !== 0 ) {\n\t\t\t\tconst { leadingTextStart: stackLeadingText, tokenStart } =\n\t\t\t\t\tstack.pop();\n\t\t\t\toutput.push( indoc.substr( stackLeadingText, tokenStart ) );\n\t\t\t}\n\t\t\taddText();\n\t\t\treturn false;\n\n\t\tcase 'self-closed':\n\t\t\tif ( 0 === stackDepth ) {\n\t\t\t\tif ( null !== leadingTextStart ) {\n\t\t\t\t\toutput.push(\n\t\t\t\t\t\tindoc.substr(\n\t\t\t\t\t\t\tleadingTextStart,\n\t\t\t\t\t\t\tstartOffset - leadingTextStart\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\toutput.push( conversionMap[ name ] );\n\t\t\t\toffset = startOffset + tokenLength;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Otherwise we found an inner element.\n\t\t\taddChild(\n\t\t\t\tcreateFrame( conversionMap[ name ], startOffset, tokenLength )\n\t\t\t);\n\t\t\toffset = startOffset + tokenLength;\n\t\t\treturn true;\n\n\t\tcase 'opener':\n\t\t\tstack.push(\n\t\t\t\tcreateFrame(\n\t\t\t\t\tconversionMap[ name ],\n\t\t\t\t\tstartOffset,\n\t\t\t\t\ttokenLength,\n\t\t\t\t\tstartOffset + tokenLength,\n\t\t\t\t\tleadingTextStart\n\t\t\t\t)\n\t\t\t);\n\t\t\toffset = startOffset + tokenLength;\n\t\t\treturn true;\n\n\t\tcase 'closer':\n\t\t\t// If we're not nesting then this is easy - close the block.\n\t\t\tif ( 1 === stackDepth ) {\n\t\t\t\tcloseOuterElement( startOffset );\n\t\t\t\toffset = startOffset + tokenLength;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Otherwise we're nested and we have to close out the current\n\t\t\t// block and add it as a innerBlock to the parent.\n\t\t\tconst stackTop = stack.pop();\n\t\t\tconst text = indoc.substr(\n\t\t\t\tstackTop.prevOffset,\n\t\t\t\tstartOffset - stackTop.prevOffset\n\t\t\t);\n\t\t\tstackTop.children.push( text );\n\t\t\tstackTop.prevOffset = startOffset + tokenLength;\n\t\t\tconst frame = createFrame(\n\t\t\t\tstackTop.element,\n\t\t\t\tstackTop.tokenStart,\n\t\t\t\tstackTop.tokenLength,\n\t\t\t\tstartOffset + tokenLength\n\t\t\t);\n\t\t\tframe.children = stackTop.children;\n\t\t\taddChild( frame );\n\t\t\toffset = startOffset + tokenLength;\n\t\t\treturn true;\n\n\t\tdefault:\n\t\t\taddText();\n\t\t\treturn false;\n\t}\n}\n\n/**\n * Grabs the next token match in the string and returns it's details.\n *\n * @private\n *\n * @return {Array} An array of details for the token matched.\n */\nfunction nextToken() {\n\tconst matches = tokenizer.exec( indoc );\n\t// We have no more tokens.\n\tif ( null === matches ) {\n\t\treturn [ 'no-more-tokens' ];\n\t}\n\tconst startedAt = matches.index;\n\tconst [ match, isClosing, name, isSelfClosed ] = matches;\n\tconst length = match.length;\n\tif ( isSelfClosed ) {\n\t\treturn [ 'self-closed', name, startedAt, length ];\n\t}\n\tif ( isClosing ) {\n\t\treturn [ 'closer', name, startedAt, length ];\n\t}\n\treturn [ 'opener', name, startedAt, length ];\n}\n\n/**\n * Pushes text extracted from the indoc string to the output stack given the\n * current rawLength value and offset (if rawLength is provided ) or the\n * indoc.length and offset.\n *\n * @private\n */\nfunction addText() {\n\tconst length = indoc.length - offset;\n\tif ( 0 === length ) {\n\t\treturn;\n\t}\n\toutput.push( indoc.substr( offset, length ) );\n}\n\n/**\n * Pushes a child element to the associated parent element's children for the\n * parent currently active in the stack.\n *\n * @private\n *\n * @param {Frame} frame The Frame containing the child element and it's\n * token information.\n */\nfunction addChild( frame ) {\n\tconst { element, tokenStart, tokenLength, prevOffset, children } = frame;\n\tconst parent = stack[ stack.length - 1 ];\n\tconst text = indoc.substr(\n\t\tparent.prevOffset,\n\t\ttokenStart - parent.prevOffset\n\t);\n\n\tif ( text ) {\n\t\tparent.children.push( text );\n\t}\n\n\tparent.children.push( cloneElement( element, null, ...children ) );\n\tparent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength;\n}\n\n/**\n * This is called for closing tags. It creates the element currently active in\n * the stack.\n *\n * @private\n *\n * @param {number} endOffset Offset at which the closing tag for the element\n * begins in the string. If this is greater than the\n * prevOffset attached to the element, then this\n * helps capture any remaining nested text nodes in\n * the element.\n */\nfunction closeOuterElement( endOffset ) {\n\tconst { element, leadingTextStart, prevOffset, tokenStart, children } =\n\t\tstack.pop();\n\n\tconst text = endOffset\n\t\t? indoc.substr( prevOffset, endOffset - prevOffset )\n\t\t: indoc.substr( prevOffset );\n\n\tif ( text ) {\n\t\tchildren.push( text );\n\t}\n\n\tif ( null !== leadingTextStart ) {\n\t\toutput.push(\n\t\t\tindoc.substr( leadingTextStart, tokenStart - leadingTextStart )\n\t\t);\n\t}\n\n\toutput.push( cloneElement( element, null, ...children ) );\n}\n\nexport default createInterpolateElement;\n"]}
1
+ {"version":3,"names":["createElement","cloneElement","Fragment","isValidElement","indoc","offset","output","stack","tokenizer","createFrame","element","tokenStart","tokenLength","prevOffset","leadingTextStart","children","createInterpolateElement","interpolatedString","conversionMap","lastIndex","isValidConversionMap","TypeError","proceed","isObject","values","Object","length","every","next","nextToken","tokenType","name","startOffset","stackDepth","addText","stackLeadingText","pop","push","substr","addChild","closeOuterElement","stackTop","text","frame","matches","exec","startedAt","index","match","isClosing","isSelfClosed","parent","endOffset"],"sources":["@wordpress/element/src/create-interpolate-element.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { createElement, cloneElement, Fragment, isValidElement } from './react';\n\n/** @typedef {import('./react').WPElement} WPElement */\n\nlet indoc, offset, output, stack;\n\n/**\n * Matches tags in the localized string\n *\n * This is used for extracting the tag pattern groups for parsing the localized\n * string and along with the map converting it to a react element.\n *\n * There are four references extracted using this tokenizer:\n *\n * match: Full match of the tag (i.e. <strong>, </strong>, <br/>)\n * isClosing: The closing slash, if it exists.\n * name: The name portion of the tag (strong, br) (if )\n * isSelfClosed: The slash on a self closing tag, if it exists.\n *\n * @type {RegExp}\n */\nconst tokenizer = /<(\\/)?(\\w+)\\s*(\\/)?>/g;\n\n/**\n * The stack frame tracking parse progress.\n *\n * @typedef Frame\n *\n * @property {WPElement} element A parent element which may still have\n * @property {number} tokenStart Offset at which parent element first\n * appears.\n * @property {number} tokenLength Length of string marking start of parent\n * element.\n * @property {number} [prevOffset] Running offset at which parsing should\n * continue.\n * @property {number} [leadingTextStart] Offset at which last closing element\n * finished, used for finding text between\n * elements.\n * @property {WPElement[]} children Children.\n */\n\n/**\n * Tracks recursive-descent parse state.\n *\n * This is a Stack frame holding parent elements until all children have been\n * parsed.\n *\n * @private\n * @param {WPElement} element A parent element which may still have\n * nested children not yet parsed.\n * @param {number} tokenStart Offset at which parent element first\n * appears.\n * @param {number} tokenLength Length of string marking start of parent\n * element.\n * @param {number} [prevOffset] Running offset at which parsing should\n * continue.\n * @param {number} [leadingTextStart] Offset at which last closing element\n * finished, used for finding text between\n * elements.\n *\n * @return {Frame} The stack frame tracking parse progress.\n */\nfunction createFrame(\n\telement,\n\ttokenStart,\n\ttokenLength,\n\tprevOffset,\n\tleadingTextStart\n) {\n\treturn {\n\t\telement,\n\t\ttokenStart,\n\t\ttokenLength,\n\t\tprevOffset,\n\t\tleadingTextStart,\n\t\tchildren: [],\n\t};\n}\n\n/**\n * This function creates an interpolated element from a passed in string with\n * specific tags matching how the string should be converted to an element via\n * the conversion map value.\n *\n * @example\n * For example, for the given string:\n *\n * \"This is a <span>string</span> with <a>a link</a> and a self-closing\n * <CustomComponentB/> tag\"\n *\n * You would have something like this as the conversionMap value:\n *\n * ```js\n * {\n * span: <span />,\n * a: <a href={ 'https://github.com' } />,\n * CustomComponentB: <CustomComponent />,\n * }\n * ```\n *\n * @param {string} interpolatedString The interpolation string to be parsed.\n * @param {Record<string, WPElement>} conversionMap The map used to convert the string to\n * a react element.\n * @throws {TypeError}\n * @return {WPElement} A wp element.\n */\nconst createInterpolateElement = ( interpolatedString, conversionMap ) => {\n\tindoc = interpolatedString;\n\toffset = 0;\n\toutput = [];\n\tstack = [];\n\ttokenizer.lastIndex = 0;\n\n\tif ( ! isValidConversionMap( conversionMap ) ) {\n\t\tthrow new TypeError(\n\t\t\t'The conversionMap provided is not valid. It must be an object with values that are WPElements'\n\t\t);\n\t}\n\n\tdo {\n\t\t// twiddle our thumbs\n\t} while ( proceed( conversionMap ) );\n\treturn createElement( Fragment, null, ...output );\n};\n\n/**\n * Validate conversion map.\n *\n * A map is considered valid if it's an object and every value in the object\n * is a WPElement\n *\n * @private\n *\n * @param {Object} conversionMap The map being validated.\n *\n * @return {boolean} True means the map is valid.\n */\nconst isValidConversionMap = ( conversionMap ) => {\n\tconst isObject = typeof conversionMap === 'object';\n\tconst values = isObject && Object.values( conversionMap );\n\treturn (\n\t\tisObject &&\n\t\tvalues.length &&\n\t\tvalues.every( ( element ) => isValidElement( element ) )\n\t);\n};\n\n/**\n * This is the iterator over the matches in the string.\n *\n * @private\n *\n * @param {Object} conversionMap The conversion map for the string.\n *\n * @return {boolean} true for continuing to iterate, false for finished.\n */\nfunction proceed( conversionMap ) {\n\tconst next = nextToken();\n\tconst [ tokenType, name, startOffset, tokenLength ] = next;\n\tconst stackDepth = stack.length;\n\tconst leadingTextStart = startOffset > offset ? offset : null;\n\tif ( ! conversionMap[ name ] ) {\n\t\taddText();\n\t\treturn false;\n\t}\n\tswitch ( tokenType ) {\n\t\tcase 'no-more-tokens':\n\t\t\tif ( stackDepth !== 0 ) {\n\t\t\t\tconst { leadingTextStart: stackLeadingText, tokenStart } =\n\t\t\t\t\tstack.pop();\n\t\t\t\toutput.push( indoc.substr( stackLeadingText, tokenStart ) );\n\t\t\t}\n\t\t\taddText();\n\t\t\treturn false;\n\n\t\tcase 'self-closed':\n\t\t\tif ( 0 === stackDepth ) {\n\t\t\t\tif ( null !== leadingTextStart ) {\n\t\t\t\t\toutput.push(\n\t\t\t\t\t\tindoc.substr(\n\t\t\t\t\t\t\tleadingTextStart,\n\t\t\t\t\t\t\tstartOffset - leadingTextStart\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\toutput.push( conversionMap[ name ] );\n\t\t\t\toffset = startOffset + tokenLength;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Otherwise we found an inner element.\n\t\t\taddChild(\n\t\t\t\tcreateFrame( conversionMap[ name ], startOffset, tokenLength )\n\t\t\t);\n\t\t\toffset = startOffset + tokenLength;\n\t\t\treturn true;\n\n\t\tcase 'opener':\n\t\t\tstack.push(\n\t\t\t\tcreateFrame(\n\t\t\t\t\tconversionMap[ name ],\n\t\t\t\t\tstartOffset,\n\t\t\t\t\ttokenLength,\n\t\t\t\t\tstartOffset + tokenLength,\n\t\t\t\t\tleadingTextStart\n\t\t\t\t)\n\t\t\t);\n\t\t\toffset = startOffset + tokenLength;\n\t\t\treturn true;\n\n\t\tcase 'closer':\n\t\t\t// If we're not nesting then this is easy - close the block.\n\t\t\tif ( 1 === stackDepth ) {\n\t\t\t\tcloseOuterElement( startOffset );\n\t\t\t\toffset = startOffset + tokenLength;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Otherwise we're nested and we have to close out the current\n\t\t\t// block and add it as a innerBlock to the parent.\n\t\t\tconst stackTop = stack.pop();\n\t\t\tconst text = indoc.substr(\n\t\t\t\tstackTop.prevOffset,\n\t\t\t\tstartOffset - stackTop.prevOffset\n\t\t\t);\n\t\t\tstackTop.children.push( text );\n\t\t\tstackTop.prevOffset = startOffset + tokenLength;\n\t\t\tconst frame = createFrame(\n\t\t\t\tstackTop.element,\n\t\t\t\tstackTop.tokenStart,\n\t\t\t\tstackTop.tokenLength,\n\t\t\t\tstartOffset + tokenLength\n\t\t\t);\n\t\t\tframe.children = stackTop.children;\n\t\t\taddChild( frame );\n\t\t\toffset = startOffset + tokenLength;\n\t\t\treturn true;\n\n\t\tdefault:\n\t\t\taddText();\n\t\t\treturn false;\n\t}\n}\n\n/**\n * Grabs the next token match in the string and returns it's details.\n *\n * @private\n *\n * @return {Array} An array of details for the token matched.\n */\nfunction nextToken() {\n\tconst matches = tokenizer.exec( indoc );\n\t// We have no more tokens.\n\tif ( null === matches ) {\n\t\treturn [ 'no-more-tokens' ];\n\t}\n\tconst startedAt = matches.index;\n\tconst [ match, isClosing, name, isSelfClosed ] = matches;\n\tconst length = match.length;\n\tif ( isSelfClosed ) {\n\t\treturn [ 'self-closed', name, startedAt, length ];\n\t}\n\tif ( isClosing ) {\n\t\treturn [ 'closer', name, startedAt, length ];\n\t}\n\treturn [ 'opener', name, startedAt, length ];\n}\n\n/**\n * Pushes text extracted from the indoc string to the output stack given the\n * current rawLength value and offset (if rawLength is provided ) or the\n * indoc.length and offset.\n *\n * @private\n */\nfunction addText() {\n\tconst length = indoc.length - offset;\n\tif ( 0 === length ) {\n\t\treturn;\n\t}\n\toutput.push( indoc.substr( offset, length ) );\n}\n\n/**\n * Pushes a child element to the associated parent element's children for the\n * parent currently active in the stack.\n *\n * @private\n *\n * @param {Frame} frame The Frame containing the child element and it's\n * token information.\n */\nfunction addChild( frame ) {\n\tconst { element, tokenStart, tokenLength, prevOffset, children } = frame;\n\tconst parent = stack[ stack.length - 1 ];\n\tconst text = indoc.substr(\n\t\tparent.prevOffset,\n\t\ttokenStart - parent.prevOffset\n\t);\n\n\tif ( text ) {\n\t\tparent.children.push( text );\n\t}\n\n\tparent.children.push( cloneElement( element, null, ...children ) );\n\tparent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength;\n}\n\n/**\n * This is called for closing tags. It creates the element currently active in\n * the stack.\n *\n * @private\n *\n * @param {number} endOffset Offset at which the closing tag for the element\n * begins in the string. If this is greater than the\n * prevOffset attached to the element, then this\n * helps capture any remaining nested text nodes in\n * the element.\n */\nfunction closeOuterElement( endOffset ) {\n\tconst { element, leadingTextStart, prevOffset, tokenStart, children } =\n\t\tstack.pop();\n\n\tconst text = endOffset\n\t\t? indoc.substr( prevOffset, endOffset - prevOffset )\n\t\t: indoc.substr( prevOffset );\n\n\tif ( text ) {\n\t\tchildren.push( text );\n\t}\n\n\tif ( null !== leadingTextStart ) {\n\t\toutput.push(\n\t\t\tindoc.substr( leadingTextStart, tokenStart - leadingTextStart )\n\t\t);\n\t}\n\n\toutput.push( cloneElement( element, null, ...children ) );\n}\n\nexport default createInterpolateElement;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,SAAS;;AAE/E;;AAEA,IAAIC,KAAK,EAAEC,MAAM,EAAEC,MAAM,EAAEC,KAAK;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,SAAS,GAAG,uBAAuB;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,WAAWA,CACnBC,OAAO,EACPC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,gBAAgB,EACf;EACD,OAAO;IACNJ,OAAO;IACPC,UAAU;IACVC,WAAW;IACXC,UAAU;IACVC,gBAAgB;IAChBC,QAAQ,EAAE;EACX,CAAC;AACF;;AAEA;AACA;AACA;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;AACvE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS4B,iBAAiBA,CAAEY,SAAS,EAAG;EACvC,MAAM;IAAE1C,OAAO;IAAEI,gBAAgB;IAAED,UAAU;IAAEF,UAAU;IAAEI;EAAS,CAAC,GACpER,KAAK,CAAC6B,GAAG,CAAC,CAAC;EAEZ,MAAMM,IAAI,GAAGU,SAAS,GACnBhD,KAAK,CAACkC,MAAM,CAAEzB,UAAU,EAAEuC,SAAS,GAAGvC,UAAW,CAAC,GAClDT,KAAK,CAACkC,MAAM,CAAEzB,UAAW,CAAC;EAE7B,IAAK6B,IAAI,EAAG;IACX3B,QAAQ,CAACsB,IAAI,CAAEK,IAAK,CAAC;EACtB;EAEA,IAAK,IAAI,KAAK5B,gBAAgB,EAAG;IAChCR,MAAM,CAAC+B,IAAI,CACVjC,KAAK,CAACkC,MAAM,CAAExB,gBAAgB,EAAEH,UAAU,GAAGG,gBAAiB,CAC/D,CAAC;EACF;EAEAR,MAAM,CAAC+B,IAAI,CAAEpC,YAAY,CAAES,OAAO,EAAE,IAAI,EAAE,GAAGK,QAAS,CAAE,CAAC;AAC1D;AAEA,eAAeC,wBAAwB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/index.js"],"names":["default","createInterpolateElement","Platform","renderToString","RawHTML"],"mappings":"AAAA,SAASA,OAAO,IAAIC,wBAApB,QAAoD,8BAApD;AACA,cAAc,SAAd;AACA,cAAc,kBAAd;AACA,cAAc,SAAd;AACA,SAASD,OAAO,IAAIE,QAApB,QAAoC,YAApC;AACA,SAASF,OAAO,IAAIG,cAApB,QAA0C,aAA1C;AACA,SAASH,OAAO,IAAII,OAApB,QAAmC,YAAnC","sourcesContent":["export { default as createInterpolateElement } from './create-interpolate-element';\nexport * from './react';\nexport * from './react-platform';\nexport * from './utils';\nexport { default as Platform } from './platform';\nexport { default as renderToString } from './serialize';\nexport { default as RawHTML } from './raw-html';\n"]}
1
+ {"version":3,"names":["default","createInterpolateElement","Platform","renderToString","RawHTML"],"sources":["@wordpress/element/src/index.js"],"sourcesContent":["export { default as createInterpolateElement } from './create-interpolate-element';\nexport * from './react';\nexport * from './react-platform';\nexport * from './utils';\nexport { default as Platform } from './platform';\nexport { default as renderToString } from './serialize';\nexport { default as RawHTML } from './raw-html';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,wBAAwB,QAAQ,8BAA8B;AAClF,cAAc,SAAS;AACvB,cAAc,kBAAkB;AAChC,cAAc,SAAS;AACvB,SAASD,OAAO,IAAIE,QAAQ,QAAQ,YAAY;AAChD,SAASF,OAAO,IAAIG,cAAc,QAAQ,aAAa;AACvD,SAASH,OAAO,IAAII,OAAO,QAAQ,YAAY"}
@@ -2,7 +2,8 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { Platform as OriginalPlatform } from 'react-native';
5
- const Platform = { ...OriginalPlatform,
5
+ const Platform = {
6
+ ...OriginalPlatform,
6
7
  OS: 'native',
7
8
  select: spec => {
8
9
  if ('android' in spec) {
@@ -10,7 +11,6 @@ const Platform = { ...OriginalPlatform,
10
11
  } else if ('native' in spec) {
11
12
  return spec.native;
12
13
  }
13
-
14
14
  return spec.default;
15
15
  },
16
16
  isNative: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/platform.android.js"],"names":["Platform","OriginalPlatform","OS","select","spec","android","native","default","isNative","isAndroid"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,gBAArB,QAA6C,cAA7C;AAEA,MAAMD,QAAQ,GAAG,EAChB,GAAGC,gBADa;AAEhBC,EAAAA,EAAE,EAAE,QAFY;AAGhBC,EAAAA,MAAM,EAAIC,IAAF,IAAY;AACnB,QAAK,aAAaA,IAAlB,EAAyB;AACxB,aAAOA,IAAI,CAACC,OAAZ;AACA,KAFD,MAEO,IAAK,YAAYD,IAAjB,EAAwB;AAC9B,aAAOA,IAAI,CAACE,MAAZ;AACA;;AACD,WAAOF,IAAI,CAACG,OAAZ;AACA,GAVe;AAWhBC,EAAAA,QAAQ,EAAE,IAXM;AAYhBC,EAAAA,SAAS,EAAE;AAZK,CAAjB;AAeA,eAAeT,QAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { Platform as OriginalPlatform } from 'react-native';\n\nconst Platform = {\n\t...OriginalPlatform,\n\tOS: 'native',\n\tselect: ( spec ) => {\n\t\tif ( 'android' in spec ) {\n\t\t\treturn spec.android;\n\t\t} else if ( 'native' in spec ) {\n\t\t\treturn spec.native;\n\t\t}\n\t\treturn spec.default;\n\t},\n\tisNative: true,\n\tisAndroid: true,\n};\n\nexport default Platform;\n"]}
1
+ {"version":3,"names":["Platform","OriginalPlatform","OS","select","spec","android","native","default","isNative","isAndroid"],"sources":["@wordpress/element/src/platform.android.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Platform as OriginalPlatform } from 'react-native';\n\nconst Platform = {\n\t...OriginalPlatform,\n\tOS: 'native',\n\tselect: ( spec ) => {\n\t\tif ( 'android' in spec ) {\n\t\t\treturn spec.android;\n\t\t} else if ( 'native' in spec ) {\n\t\t\treturn spec.native;\n\t\t}\n\t\treturn spec.default;\n\t},\n\tisNative: true,\n\tisAndroid: true,\n};\n\nexport default Platform;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,gBAAgB,QAAQ,cAAc;AAE3D,MAAMD,QAAQ,GAAG;EAChB,GAAGC,gBAAgB;EACnBC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAIC,IAAI,IAAM;IACnB,IAAK,SAAS,IAAIA,IAAI,EAAG;MACxB,OAAOA,IAAI,CAACC,OAAO;IACpB,CAAC,MAAM,IAAK,QAAQ,IAAID,IAAI,EAAG;MAC9B,OAAOA,IAAI,CAACE,MAAM;IACnB;IACA,OAAOF,IAAI,CAACG,OAAO;EACpB,CAAC;EACDC,QAAQ,EAAE,IAAI;EACdC,SAAS,EAAE;AACZ,CAAC;AAED,eAAeT,QAAQ"}
@@ -2,7 +2,8 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { Platform as OriginalPlatform } from 'react-native';
5
- const Platform = { ...OriginalPlatform,
5
+ const Platform = {
6
+ ...OriginalPlatform,
6
7
  OS: 'native',
7
8
  select: spec => {
8
9
  if ('ios' in spec) {
@@ -10,7 +11,6 @@ const Platform = { ...OriginalPlatform,
10
11
  } else if ('native' in spec) {
11
12
  return spec.native;
12
13
  }
13
-
14
14
  return spec.default;
15
15
  },
16
16
  isNative: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/platform.ios.js"],"names":["Platform","OriginalPlatform","OS","select","spec","ios","native","default","isNative","isIOS"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,gBAArB,QAA6C,cAA7C;AAEA,MAAMD,QAAQ,GAAG,EAChB,GAAGC,gBADa;AAEhBC,EAAAA,EAAE,EAAE,QAFY;AAGhBC,EAAAA,MAAM,EAAIC,IAAF,IAAY;AACnB,QAAK,SAASA,IAAd,EAAqB;AACpB,aAAOA,IAAI,CAACC,GAAZ;AACA,KAFD,MAEO,IAAK,YAAYD,IAAjB,EAAwB;AAC9B,aAAOA,IAAI,CAACE,MAAZ;AACA;;AACD,WAAOF,IAAI,CAACG,OAAZ;AACA,GAVe;AAWhBC,EAAAA,QAAQ,EAAE,IAXM;AAYhBC,EAAAA,KAAK,EAAE;AAZS,CAAjB;AAeA,eAAeT,QAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { Platform as OriginalPlatform } from 'react-native';\n\nconst Platform = {\n\t...OriginalPlatform,\n\tOS: 'native',\n\tselect: ( spec ) => {\n\t\tif ( 'ios' in spec ) {\n\t\t\treturn spec.ios;\n\t\t} else if ( 'native' in spec ) {\n\t\t\treturn spec.native;\n\t\t}\n\t\treturn spec.default;\n\t},\n\tisNative: true,\n\tisIOS: true,\n};\n\nexport default Platform;\n"]}
1
+ {"version":3,"names":["Platform","OriginalPlatform","OS","select","spec","ios","native","default","isNative","isIOS"],"sources":["@wordpress/element/src/platform.ios.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Platform as OriginalPlatform } from 'react-native';\n\nconst Platform = {\n\t...OriginalPlatform,\n\tOS: 'native',\n\tselect: ( spec ) => {\n\t\tif ( 'ios' in spec ) {\n\t\t\treturn spec.ios;\n\t\t} else if ( 'native' in spec ) {\n\t\t\treturn spec.native;\n\t\t}\n\t\treturn spec.default;\n\t},\n\tisNative: true,\n\tisIOS: true,\n};\n\nexport default Platform;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,gBAAgB,QAAQ,cAAc;AAE3D,MAAMD,QAAQ,GAAG;EAChB,GAAGC,gBAAgB;EACnBC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAIC,IAAI,IAAM;IACnB,IAAK,KAAK,IAAIA,IAAI,EAAG;MACpB,OAAOA,IAAI,CAACC,GAAG;IAChB,CAAC,MAAM,IAAK,QAAQ,IAAID,IAAI,EAAG;MAC9B,OAAOA,IAAI,CAACE,MAAM;IACnB;IACA,OAAOF,IAAI,CAACG,OAAO;EACpB,CAAC;EACDC,QAAQ,EAAE,IAAI;EACdC,KAAK,EAAE;AACR,CAAC;AAED,eAAeT,QAAQ"}
@@ -30,6 +30,5 @@ const Platform = {
30
30
  * } );
31
31
  * ```
32
32
  */
33
-
34
33
  export default Platform;
35
34
  //# sourceMappingURL=platform.js.map