UNPKG

@tanstack/solid-router

Version:

Modern and scalable routing for Solid applications

1 lines 1.2 kB
{"version":3,"file":"nonRouteComponentContext.cjs","names":["<Context value={component}>{render()}</Context>","value={component}"],"sources":["../../src/nonRouteComponentContext.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport type { JSX } from '@solidjs/web'\n\nexport type NonRouteComponent =\n | 'pendingComponent'\n | 'errorComponent'\n | 'notFoundComponent'\n\n// Solid 2's `useContext` throws for a default-less context with no mounted\n// provider, so default to `null` to keep the unset read falsy instead.\nexport const nonRouteComponentContext =\n process.env.NODE_ENV !== 'production'\n ? /* @__PURE__ */ Solid.createContext<NonRouteComponent | null>(null)\n : undefined\n\nexport function renderInNonRouteComponentContext(\n render: () => JSX.Element,\n component: NonRouteComponent,\n) {\n // In Solid 2 the context object itself is the provider component.\n const Context = nonRouteComponentContext!\n return <Context value={component}>{render()}</Context>\n}\n"],"mappings":";;;;;AAUA,IAAa,2BAAA,QAAA,IAAA,aACc,eACL,yBAAM,cAAwC,IAAI,IAClE,KAAA;AAEN,SAAgB,iCACd,QACA,WACA;CAGA,QAAA,GAAA,aAAA,iBAAOA,0BAAAA;EAASC,OAAO;EAAhB,IAAA,WAAA;UAA4B,OAAO;EAAW;;AACvD"}