diff --git a/packages/docs/next.config.mjs b/packages/docs/next.config.mjs
index 261b223c8..7fcc87d51 100644
--- a/packages/docs/next.config.mjs
+++ b/packages/docs/next.config.mjs
@@ -26,12 +26,18 @@ const config = {
},
{
protocol: 'https',
- hostname: 'avatars.githubusercontent.com'
+ hostname: 'avatars.githubusercontent.com',
+ pathname: '/u/**'
},
{
protocol: 'https',
hostname: 'media.licdn.com',
pathname: '/dms/image/**'
+ },
+ {
+ protocol: 'https',
+ hostname: 'i.redd.it',
+ pathname: '/snoovatar/avatars/**'
}
]
}
diff --git a/packages/docs/package.json b/packages/docs/package.json
index 2b86a9efb..3106f4431 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -9,16 +9,24 @@
"start": "next start"
},
"dependencies": {
+ "@faker-js/faker": "^8.4.0",
+ "@radix-ui/react-label": "^2.0.2",
+ "@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
+ "@radix-ui/react-switch": "^1.0.3",
+ "@radix-ui/react-toggle": "^1.0.3",
+ "@radix-ui/react-toggle-group": "^1.0.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"dayjs": "^1.11.10",
+ "execa": "^8.0.1",
"lucide-react": "^0.298.0",
"next": "14.0.4",
"next-docs-mdx": "^6.0.2",
"next-docs-ui": "^6.0.2",
"next-docs-zeta": "^6.0.2",
"nuqs": "workspace:*",
+ "pretty-bytes": "^6.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"recharts": "^2.10.3",
diff --git a/packages/docs/src/app/(pages)/_landing/bundle-size.tsx b/packages/docs/src/app/(pages)/_landing/bundle-size.tsx
new file mode 100644
index 000000000..b95280eb3
--- /dev/null
+++ b/packages/docs/src/app/(pages)/_landing/bundle-size.tsx
@@ -0,0 +1,11 @@
+import { execa } from 'execa'
+import path from 'node:path'
+import prettyBytes from 'pretty-bytes'
+
+export async function BundleSize() {
+ const { stdout } = await execa('./node_modules/.bin/size-limit', ['--json'], {
+ cwd: path.resolve(process.cwd(), '../../packages/nuqs')
+ })
+ const [{ size }] = JSON.parse(stdout)
+ return prettyBytes(size)
+}
diff --git a/packages/docs/src/app/(pages)/_landing/demo.tsx b/packages/docs/src/app/(pages)/_landing/demo.tsx
index 685601d09..297d0b44e 100644
--- a/packages/docs/src/app/(pages)/_landing/demo.tsx
+++ b/packages/docs/src/app/(pages)/_landing/demo.tsx
@@ -1,8 +1,8 @@
+import { CodeBlock } from '@/src/components/code-block'
import fs from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { Suspense } from 'react'
-import { codeToHtml } from 'shikiji'
import { Demo } from './demo.client'
export async function LandingDemo() {
@@ -11,42 +11,14 @@ export async function LandingDemo() {
'./demo.client.tsx'
)
const demoFile = await fs.readFile(demoFilePath, 'utf8')
- const demoCode = await codeToHtml(
- demoFile
- .split('\n')
- .filter(
- line =>
- !line.includes('className="') && !line.includes('data-interacted=')
- )
- .join('\n')
- .replaceAll('next-usequerystate', 'nuqs'),
- {
- lang: 'tsx',
- themes: {
- dark: 'github-dark',
- light: 'github-light'
- },
- transformers: [
- {
- name: 'transparent background',
- pre(node) {
- if (typeof node.properties.style !== 'string') {
- return node
- }
- node.properties.style = node.properties.style
- .split(';')
- .filter(style => !style.includes('-bg:'))
- .concat([
- '--shiki-dark-bg:transparent',
- '--shiki-light-bg:transparent'
- ])
- .join(';')
- return node
- }
- }
- ]
- }
- )
+ const demoCode = demoFile
+ .split('\n')
+ .filter(
+ line =>
+ !line.includes('className="') && !line.includes('data-interacted=')
+ )
+ .join('\n')
+ .replaceAll('next-usequerystate', 'nuqs')
return (
<>
+
+
) } diff --git a/packages/docs/src/app/(pages)/playground/_components/playground-page-layout.tsx b/packages/docs/src/app/(pages)/playground/_components/playground-page-layout.tsx deleted file mode 100644 index 5f71cabbc..000000000 --- a/packages/docs/src/app/(pages)/playground/_components/playground-page-layout.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import Link from 'next/link' -import { QuerySpy } from './query-spy' - -export function PlaygroundPageLayout({ - children -}: { - children: React.ReactNode -}) { - return ( -
- State is stored in the URL query string -
- -Counter: {counter}
- - > - ) -} diff --git a/packages/docs/src/app/(pages)/playground/layout.tsx b/packages/docs/src/app/(pages)/playground/layout.tsx deleted file mode 100644 index df0dc100c..000000000 --- a/packages/docs/src/app/(pages)/playground/layout.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import dynamic from 'next/dynamic' -import React, { Suspense } from 'react' -import { PlaygroundPageLayout } from './_components/playground-page-layout' - -export const metadata = { - title: 'Playground' -} - -const DebugControlsSkeleton = () => ( - - - - -) - -const DebugControl = dynamic(() => import('./_components/debug-control'), { - ssr: false, - loading: DebugControlsSkeleton -}) - -export default function PlaygroundLayout({ - children -}: { - children: React.ReactNode -}) { - return ( - <> -- {page.matter.description} -
+