Current collected state Current
Observed since 20 Oct, 21:49 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@-ft/mode-next
Next wrapper for theme mode manager
mode-next - Theme mode manager wrapper for NextNext wrapper of dark/light theme mode manager for web
/public/mode.js using @-ft/mode-codegen package.{
"variableName": "__theme_mode",
"persist": {
"type": "cookie",
"key": "THEME"
}
}
/mode.js in src/app/layout.tsx, apply default cookie-stored theme mode to class name/ssrInitialMode and suppress hydration warningimport { ModeContextProvider } from '@-ft/mode-next';
export default function RootLayout({ children }: PropsWithChildren) {
return (
<html
lang="en"
className={cookies().get('THEME')?.value === "dark" ? "dark" : undefined}
suppressHydrationWarning
>
<head>
<script src="/mode.js" />
</head>
<body>
<ModeContextProvider
variableName="__theme_mode"
ssrInitialMode={theme?.value ?? "system"}
>
{children}
</ModeContextProvider>
</body>
</html>
);
}
ModeContext in your app.'use client';
import { ModeContext } from '@-ft/mode-next';
function ModeBar() {
const { mode, setMode } = useContext(ModeContext);
return (
<Bar>
Current theme mode is {mode}.
<Select
onChange={useCallback((mode) => setMode(mode), [setMode])}
>
{['system', 'light', 'dark']}
</Select>
</Bar>
)
}
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
@-ft/modeEnvironment{
"local_name": "@-ft/mode",
"alias": false,
"peer_metadata": null
} | ^0.1.0 | peer |
nextEnvironment{
"local_name": "next",
"alias": false,
"peer_metadata": null
} | 13 || 14 || 15 | peer |
Source distribution
{
"integrity": "sha512-7R8eA4th06okSp6ITXYk/3ky/qc/qJeoXlP0ahzl0+iAwCg15TxmTqF/ev5Vmheo1PTcO5+pBZenDBAvw620eQ==",
"shasum": "7a2bb37d4278bf2fdc8422c904344e5cc0ae5dff",
"tarball": "https://registry.npmjs.org/@-ft/mode-next/-/mode-next-0.1.7.tgz",
"fileCount": 4,
"unpackedSize": 3202,
"signatures": [
{
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
"sig": "MEUCIF7chydaQLPKtkliJccjluNMPy3y9QJT7lzGTxCPxOwQAiEA3JDFiuo1+UXwRqDaPs+i8HYEtme3PLe5JmbT5E2v77U="
}
]
}Observed since 20 Oct, 21:49 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:ca81d800761a6dcd80a437fbebc47936df46d8f90652e402dce61603c64cd53e