- buildRevalidateHook skips outside Next (no NEXT_RUNTIME) and with context.disableRevalidate - BuilderForm focuses only on a real step change (no scroll to the form on remount) - mediaImageProps: placeholder colour only for JPEG (placeholderColor); hook stores no colour for transparent images - buildLinkField: interface name per shape (CmsLink, CmsLinkPlain, CmsLinkNoLabel) + interfaceName option - Cookie Settings: buttons.save -> buttons.savePreferences (Mongoose reserved name) - ThemeScript, ThemeSwitcher, useTheme; Site Settings defaultTheme 'system' + themeToggleLabel; Turnstile follows page theme - extractHeadings, RenderRichText headingIds, TableOfContents, buildTableOfContentsField - createPageRoute onMissing: 'redirectHome' - Form builder: localized placeholder on text/email/textarea/number, new time field - ipal-audit: no false positive for object keys between JSX elements; /md route not reported as dynamic Co-Authored-By: Claude Opus 5.5 <[email protected]>
18 lines
785 B
TypeScript
18 lines
785 B
TypeScript
import type { ThemeConfig } from './theme.js'
|
|
|
|
import { themeScript } from './theme.js'
|
|
|
|
export type ThemeScriptProps = Partial<Pick<ThemeConfig, 'allowToggle' | 'defaultTheme'>>
|
|
|
|
/**
|
|
* Sets the theme on <html> BEFORE anything is painted — no flash of the light
|
|
* theme. Put it first in <body> (or turn on `theme` in <SiteProviders>), and
|
|
* add `suppressHydrationWarning` to <html>: the attribute differs from the server HTML on purpose.
|
|
*
|
|
* const shell = await getSiteShell(locale)
|
|
* <html lang={locale} suppressHydrationWarning><body><ThemeScript {...shell.theme} />…
|
|
*/
|
|
export function ThemeScript({ allowToggle = false, defaultTheme = null }: ThemeScriptProps) {
|
|
return <script dangerouslySetInnerHTML={{ __html: themeScript({ allowToggle, defaultTheme }) }} />
|
|
}
|