UNPKG

@tabnews/ui

Version:
62 lines (61 loc) 1.81 kB
import { jsx as n, jsxs as r } from "react/jsx-runtime"; import s, { Html as p, Head as u, Main as g, NextScript as y } from "next/document.js"; import f from "next/script.js"; import { ServerStyleSheet as P } from "styled-components"; const S = `if (['auto','night','dark','day','light'].includes(localStorage.getItem('colorMode'))) document.documentElement.setAttribute('data-no-flash', true)`; let a = { htmlProps: {} }; function w({ htmlProps: o = {}, headChildren: e } = {}) { a = { htmlProps: o, headChildren: e }; } var c; const l = ((c = s) == null ? void 0 : c.default) ?? s; class C extends l { static async getInitialProps(e) { const t = new P(), d = e.renderPage; try { e.renderPage = () => d({ enhanceApp: (m) => (h) => t.collectStyles(/* @__PURE__ */ n(m, { ...h })) }); const i = await l.getInitialProps(e); return { ...i, styles: [i.styles, t.getStyleElement()] }; } finally { t.seal(); } } render() { const { htmlProps: e, headChildren: t } = a; return /* @__PURE__ */ r(p, { ...e, children: [ /* @__PURE__ */ r(u, { children: [ t, /* @__PURE__ */ n( "link", { rel: "stylesheet", href: "https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css", integrity: "sha384-5TcZemv2l/9On385z///+d7MSYlvIEw9FuZTIdZ14vJLqWphw7e7ZPuOiCHJcFCP", crossOrigin: "anonymous" } ) ] }), /* @__PURE__ */ r("body", { children: [ /* @__PURE__ */ n(g, {}), /* @__PURE__ */ n(f, { id: "theme", strategy: "beforeInteractive", children: S }), /* @__PURE__ */ n(y, {}) ] }) ] }); } } export { C as Document, w as configureDocument, S as noFlashScript };