UNPKG

@tanstack/solid-router

Version:

Modern and scalable routing for Solid applications

1 lines 1.55 kB
{"version":3,"file":"HeadContent.cjs","names":["MetaProvider","For","Asset","useTags","AssetCrossOriginConfig","HeadContentProps","assetCrossOrigin","HeadContent","props","tags","_$createComponent","children","each","tag"],"sources":["../../src/HeadContent.tsx"],"sourcesContent":["import { MetaProvider } from '@solidjs/meta'\nimport { For } from 'solid-js'\nimport { Asset } from './Asset'\nimport { useTags } from './headContentUtils'\nimport type { AssetCrossOriginConfig } from '@tanstack/router-core'\n\nexport interface HeadContentProps {\n assetCrossOrigin?: AssetCrossOriginConfig\n}\n\n/**\n * @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.\n * When using full document hydration (hydrating from `<html>`), this component should be rendered in the `<body>`\n * to ensure it's part of the reactive tree and updates correctly during client-side navigation.\n * The component uses portals internally to render content into the `<head>` element.\n */\nexport function HeadContent(props: HeadContentProps) {\n const tags = useTags(props.assetCrossOrigin)\n\n return (\n <MetaProvider>\n <For each={tags()}>{(tag) => <Asset {...tag} />}</For>\n </MetaProvider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,SAAgBO,YAAYC,OAAyB;CACnD,MAAMC,OAAON,yBAAAA,QAAQK,MAAMF,iBAAiB;AAE5C,SAAA,GAAA,aAAA,iBACGN,cAAAA,cAAY,EAAA,IAAAW,WAAA;AAAA,UAAA,GAAA,aAAA,iBACVV,SAAAA,KAAG;GAAA,IAACW,OAAI;AAAA,WAAEH,MAAM;;GAAAE,WAAIE,SAAAA,GAAAA,aAAAA,iBAASX,cAAAA,OAAUW,IAAG;GAAI,CAAA;IAAA,CAAA"}