UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

1 lines 2.4 kB
{"version":3,"names":["filterRootHTML","el","htmlProps","bodyProps","head","traverse","element","Array","isArray","map","reactElement","type","props","children","children2","restProps"],"sources":["filterRootHTML.mjs"],"sourcesContent":["\n\nfunction filterRootHTML(el) {\n\tlet htmlProps;\n\tlet bodyProps;\n\tlet head;\n\tfunction traverse(element) {\n\t\tif (!element || typeof element !== \"object\") return element;\n\t\tif (Array.isArray(element)) return element.map(traverse);\n\t\tconst reactElement = element;\n\t\tconst { type, props } = reactElement;\n\t\tif (type === \"html\") {\n\t\t\tif (props && typeof props === \"object\" && \"children\" in props) {\n\t\t\t\tconst { children: children2, ...restProps } = props;\n\t\t\t\thtmlProps = restProps;\n\t\t\t\treturn traverse(children2);\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t\tif (type === \"head\") {\n\t\t\thead = reactElement;\n\t\t\treturn null;\n\t\t}\n\t\tif (type === \"body\") {\n\t\t\tif (props && typeof props === \"object\" && \"children\" in props) {\n\t\t\t\tconst { children: children2, ...restProps } = props;\n\t\t\t\tbodyProps = restProps;\n\t\t\t\treturn children2;\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t\treturn element;\n\t}\n\treturn {\n\t\tchildren: traverse(el) || el,\n\t\thtmlProps,\n\t\tbodyProps,\n\t\thead\n\t};\n}\n\nexport { filterRootHTML };"],"mappings":"AAEA,SAASA,cAAcA,CAACC,EAAE,EAAE;EAC3B,IAAIC,SAAS;EACb,IAAIC,SAAS;EACb,IAAIC,IAAI;EACR,SAASC,QAAQA,CAACC,OAAO,EAAE;IAC1B,IAAI,CAACA,OAAO,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE,OAAOA,OAAO;IAC3D,IAAIC,KAAK,CAACC,OAAO,CAACF,OAAO,CAAC,EAAE,OAAOA,OAAO,CAACG,GAAG,CAACJ,QAAQ,CAAC;IACxD,MAAMK,YAAY,GAAGJ,OAAO;IAC5B,MAAM;MAAE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