doccupine 0.0.130 → 0.0.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/metadata.js +4 -4
- package/dist/lib/structures.js +4 -0
- package/dist/templates/components/MDXComponents.d.ts +1 -1
- package/dist/templates/components/MDXComponents.js +2 -0
- package/dist/templates/components/PostHogProviderLazy.d.ts +1 -1
- package/dist/templates/components/PostHogProviderLazy.js +3 -2
- package/dist/templates/components/layout/Frame.d.ts +1 -0
- package/dist/templates/components/layout/Frame.js +205 -0
- package/dist/templates/mdx/components.mdx.d.ts +1 -1
- package/dist/templates/mdx/components.mdx.js +3 -0
- package/dist/templates/mdx/frames.mdx.d.ts +1 -0
- package/dist/templates/mdx/frames.mdx.js +124 -0
- package/dist/templates/mdx/navigation.mdx.d.ts +1 -1
- package/dist/templates/mdx/navigation.mdx.js +2 -1
- package/dist/templates/package.js +6 -6
- package/dist/templates/proxy.js +2 -1
- package/package.json +4 -4
package/dist/lib/metadata.js
CHANGED
|
@@ -19,11 +19,11 @@ export function generateJsonLdScript(opts) {
|
|
|
19
19
|
? JSON.stringify(opts.date)
|
|
20
20
|
: "undefined";
|
|
21
21
|
const defaultFaviconLiteral = JSON.stringify(DEFAULT_FAVICON);
|
|
22
|
+
// When the page declares an image, it always wins - emitting a `||` chain
|
|
23
|
+
// after a string literal makes TypeScript fail the build with
|
|
24
|
+
// "This kind of expression is always truthy".
|
|
22
25
|
const faviconLine = opts.image
|
|
23
|
-
? `const faviconUrl =
|
|
24
|
-
${JSON.stringify(opts.image)} ||
|
|
25
|
-
config.icon ||
|
|
26
|
-
${defaultFaviconLiteral};`
|
|
26
|
+
? `const faviconUrl = ${JSON.stringify(opts.image)};`
|
|
27
27
|
: `const faviconUrl = config.icon || ${defaultFaviconLiteral};`;
|
|
28
28
|
// Indent 10 + "description: ".length(13) + ",".length(1) = 24. Prettier
|
|
29
29
|
// wraps the value to the next line (indent 12) once total exceeds 80.
|
package/dist/lib/structures.js
CHANGED
|
@@ -45,6 +45,7 @@ import { docsComponentsTemplate } from "../templates/components/layout/DocsCompo
|
|
|
45
45
|
import { docsNavigationTemplate } from "../templates/components/layout/DocsNavigation.js";
|
|
46
46
|
import { fieldTemplate } from "../templates/components/layout/Field.js";
|
|
47
47
|
import { footerTemplate } from "../templates/components/layout/Footer.js";
|
|
48
|
+
import { frameTemplate } from "../templates/components/layout/Frame.js";
|
|
48
49
|
import { globalStylesTemplate } from "../templates/components/layout/GlobalStyles.js";
|
|
49
50
|
import { headerTemplate } from "../templates/components/layout/Header.js";
|
|
50
51
|
import { iconTemplate } from "../templates/components/layout/Icon.js";
|
|
@@ -98,6 +99,7 @@ import { iconsMdxTemplate } from "../templates/mdx/icons.mdx.js";
|
|
|
98
99
|
import { imageAndEmbedsMdxTemplate } from "../templates/mdx/image-and-embeds.mdx.js";
|
|
99
100
|
import { indexMdxTemplate } from "../templates/mdx/index.mdx.js";
|
|
100
101
|
import { footerLinksMdxTemplate } from "../templates/mdx/footer-links.mdx.js";
|
|
102
|
+
import { framesMdxTemplate } from "../templates/mdx/frames.mdx.js";
|
|
101
103
|
import { listsAndTablesMdxTemplate } from "../templates/mdx/lists-and-tables.mdx.js";
|
|
102
104
|
import { mediaAndAssetsMdxTemplate } from "../templates/mdx/media-and-assets.mdx.js";
|
|
103
105
|
import { mermaidMdxTemplate } from "../templates/mdx/mermaid.mdx.js";
|
|
@@ -192,6 +194,7 @@ export const appStructure = {
|
|
|
192
194
|
"components/layout/SectionBar.tsx": sectionBarTemplate,
|
|
193
195
|
"components/layout/Field.tsx": fieldTemplate,
|
|
194
196
|
"components/layout/Footer.tsx": footerTemplate,
|
|
197
|
+
"components/layout/Frame.tsx": frameTemplate,
|
|
195
198
|
"components/layout/GlobalStyles.ts": globalStylesTemplate,
|
|
196
199
|
"components/layout/Header.tsx": headerTemplate,
|
|
197
200
|
"components/layout/Icon.tsx": iconTemplate,
|
|
@@ -238,6 +241,7 @@ export const startingDocsStructure = {
|
|
|
238
241
|
"image-and-embeds.mdx": imageAndEmbedsMdxTemplate,
|
|
239
242
|
"index.mdx": indexMdxTemplate,
|
|
240
243
|
"footer-links.mdx": footerLinksMdxTemplate,
|
|
244
|
+
"frames.mdx": framesMdxTemplate,
|
|
241
245
|
"lists-and-tables.mdx": listsAndTablesMdxTemplate,
|
|
242
246
|
"media-and-assets.mdx": mediaAndAssetsMdxTemplate,
|
|
243
247
|
"mermaid.mdx": mermaidMdxTemplate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const mdxComponentsTemplate = "import React from \"react\";\nimport Link from \"next/link\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype MDXComponents = Record<string, React.ComponentType<any>>;\nimport { Space } from \"cherry-styled-components\";\nimport { Code as CodeBlock, CodeTabs } from \"@/components/layout/Code\";\nimport { Card } from \"@/components/layout/Card\";\nimport { Accordion } from \"@/components/layout/Accordion\";\nimport { Tabs, TabContent } from \"@/components/layout/Tabs\";\nimport { Callout } from \"@/components/layout/Callout\";\nimport { Icon } from \"@/components/layout/Icon\";\nimport { Columns } from \"@/components/layout/Columns\";\nimport { Field } from \"@/components/layout/Field\";\nimport { Update } from \"@/components/layout/Update\";\nimport { Steps, Step } from \"@/components/layout/Steps\";\nimport { Button } from \"@/components/layout/Button\";\nimport { ColorSwatch, ColorSwatchGroup } from \"@/components/layout/ColorSwatch\";\nimport { DemoTheme } from \"@/components/layout/DemoTheme\";\nimport { createSlugger } from \"@/components/layout/Slug\";\n\ninterface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {\n children?: React.ReactNode;\n}\n\ninterface PreProps extends React.HTMLAttributes<HTMLPreElement> {\n children?: React.ReactNode;\n}\n\nexport function extractAllTextFromChildren(children: React.ReactNode): string {\n if (children == null) return \"\";\n if (typeof children === \"string\") return children;\n if (typeof children === \"number\") return String(children);\n if (typeof children === \"boolean\") return \"\";\n if (Array.isArray(children))\n return children.map(extractAllTextFromChildren).join(\"\");\n if (React.isValidElement(children)) {\n const element = children as React.ReactElement<{\n children?: React.ReactNode;\n }>;\n return extractAllTextFromChildren(element.props.children);\n }\n return \"\";\n}\n\n// Map <pre><code class=\"language-xyz\"> to our <Code /> component\nexport function Pre(props: PreProps) {\n const child = React.Children.only(props.children) as React.ReactElement<{\n className?: string;\n children?: React.ReactNode;\n }> | null;\n if (child && child.type === \"code\") {\n const className = child.props.className || \"\";\n const match = /language-(\\w+)/.exec(className);\n const language = match ? match[1] : undefined;\n const code = extractAllTextFromChildren(child.props.children).replace(\n /\\n$/,\n \"\",\n );\n if (language) {\n return (\n <CodeBlock className={className} code={code} language={language} />\n );\n }\n }\n return <pre {...props} />;\n}\n\nexport function useMDXComponents(components: MDXComponents): MDXComponents {\n // One slugger per render so repeated heading text (and <Update> labels)\n // resolve to unique, document-order ids that match the index sidebar built\n // in components/Docs.tsx.\n const slug = createSlugger();\n return {\n // Headings with auto-generated ids for TOC and deep links\n h1: ({ children, ...props }: HeadingProps) => {\n const id = slug(extractAllTextFromChildren(children));\n return (\n <h1 id={id} {...props}>\n {children}\n </h1>\n );\n },\n h2: ({ children, ...props }: HeadingProps) => {\n const id = slug(extractAllTextFromChildren(children));\n return (\n <h2 id={id} {...props}>\n {children}\n </h2>\n );\n },\n h3: ({ children, ...props }: HeadingProps) => {\n const id = slug(extractAllTextFromChildren(children));\n return (\n <h3 id={id} {...props}>\n {children}\n </h3>\n );\n },\n h4: ({ children, ...props }: HeadingProps) => {\n const id = slug(extractAllTextFromChildren(children));\n return (\n <h4 id={id} {...props}>\n {children}\n </h4>\n );\n },\n h5: ({ children, ...props }: HeadingProps) => {\n const id = slug(extractAllTextFromChildren(children));\n return (\n <h5 id={id} {...props}>\n {children}\n </h5>\n );\n },\n h6: ({ children, ...props }: HeadingProps) => {\n const id = slug(extractAllTextFromChildren(children));\n return (\n <h6 id={id} {...props}>\n {children}\n </h6>\n );\n },\n\n // Links - use Next.js Link for internal paths\n a: ({\n href,\n children,\n ...props\n }: React.AnchorHTMLAttributes<HTMLAnchorElement>) => {\n if (href && href.startsWith(\"/\")) {\n return (\n <Link href={href} {...props}>\n {children}\n </Link>\n );\n }\n return (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n );\n },\n\n // Tables - wrap in a div for responsive overflow\n table: (props: React.TableHTMLAttributes<HTMLTableElement>) => (\n <div className=\"table-wrapper\">\n <table {...props} />\n </div>\n ),\n\n // Code blocks\n pre: Pre,\n\n // Expose your custom components for MDX usage\n Code: CodeBlock,\n CodeTabs,\n Card,\n Accordion,\n Tabs,\n TabContent,\n Callout,\n Icon,\n Columns,\n Field,\n // Share the heading slugger so an <Update> label anchor stays unique and\n // in document order alongside the surrounding headings. Only consume a\n // slug when a label is present so a label-less <Update> does not crash the\n // slugger (Update itself renders gracefully without a label anchor).\n Update: (props: React.ComponentProps<typeof Update>) => (\n <Update {...props} id={props.label ? slug(props.label) : undefined} />\n ),\n Steps,\n Step,\n Button,\n ColorSwatch,\n ColorSwatchGroup,\n DemoTheme,\n Space,\n ...components,\n };\n}\n";
|
|
1
|
+
export declare const mdxComponentsTemplate = "import React from \"react\";\nimport Link from \"next/link\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype MDXComponents = Record<string, React.ComponentType<any>>;\nimport { Space } from \"cherry-styled-components\";\nimport { Code as CodeBlock, CodeTabs } from \"@/components/layout/Code\";\nimport { Card } from \"@/components/layout/Card\";\nimport { Accordion } from \"@/components/layout/Accordion\";\nimport { Tabs, TabContent } from \"@/components/layout/Tabs\";\nimport { Callout } from \"@/components/layout/Callout\";\nimport { Icon } from \"@/components/layout/Icon\";\nimport { Columns } from \"@/components/layout/Columns\";\nimport { Field } from \"@/components/layout/Field\";\nimport { Frame } from \"@/components/layout/Frame\";\nimport { Update } from \"@/components/layout/Update\";\nimport { Steps, Step } from \"@/components/layout/Steps\";\nimport { Button } from \"@/components/layout/Button\";\nimport { ColorSwatch, ColorSwatchGroup } from \"@/components/layout/ColorSwatch\";\nimport { DemoTheme } from \"@/components/layout/DemoTheme\";\nimport { createSlugger } from \"@/components/layout/Slug\";\n\ninterface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {\n children?: React.ReactNode;\n}\n\ninterface PreProps extends React.HTMLAttributes<HTMLPreElement> {\n children?: React.ReactNode;\n}\n\nexport function extractAllTextFromChildren(children: React.ReactNode): string {\n if (children == null) return \"\";\n if (typeof children === \"string\") return children;\n if (typeof children === \"number\") return String(children);\n if (typeof children === \"boolean\") return \"\";\n if (Array.isArray(children))\n return children.map(extractAllTextFromChildren).join(\"\");\n if (React.isValidElement(children)) {\n const element = children as React.ReactElement<{\n children?: React.ReactNode;\n }>;\n return extractAllTextFromChildren(element.props.children);\n }\n return \"\";\n}\n\n// Map <pre><code class=\"language-xyz\"> to our <Code /> component\nexport function Pre(props: PreProps) {\n const child = React.Children.only(props.children) as React.ReactElement<{\n className?: string;\n children?: React.ReactNode;\n }> | null;\n if (child && child.type === \"code\") {\n const className = child.props.className || \"\";\n const match = /language-(\\w+)/.exec(className);\n const language = match ? match[1] : undefined;\n const code = extractAllTextFromChildren(child.props.children).replace(\n /\\n$/,\n \"\",\n );\n if (language) {\n return (\n <CodeBlock className={className} code={code} language={language} />\n );\n }\n }\n return <pre {...props} />;\n}\n\nexport function useMDXComponents(components: MDXComponents): MDXComponents {\n // One slugger per render so repeated heading text (and <Update> labels)\n // resolve to unique, document-order ids that match the index sidebar built\n // in components/Docs.tsx.\n const slug = createSlugger();\n return {\n // Headings with auto-generated ids for TOC and deep links\n h1: ({ children, ...props }: HeadingProps) => {\n const id = slug(extractAllTextFromChildren(children));\n return (\n <h1 id={id} {...props}>\n {children}\n </h1>\n );\n },\n h2: ({ children, ...props }: HeadingProps) => {\n const id = slug(extractAllTextFromChildren(children));\n return (\n <h2 id={id} {...props}>\n {children}\n </h2>\n );\n },\n h3: ({ children, ...props }: HeadingProps) => {\n const id = slug(extractAllTextFromChildren(children));\n return (\n <h3 id={id} {...props}>\n {children}\n </h3>\n );\n },\n h4: ({ children, ...props }: HeadingProps) => {\n const id = slug(extractAllTextFromChildren(children));\n return (\n <h4 id={id} {...props}>\n {children}\n </h4>\n );\n },\n h5: ({ children, ...props }: HeadingProps) => {\n const id = slug(extractAllTextFromChildren(children));\n return (\n <h5 id={id} {...props}>\n {children}\n </h5>\n );\n },\n h6: ({ children, ...props }: HeadingProps) => {\n const id = slug(extractAllTextFromChildren(children));\n return (\n <h6 id={id} {...props}>\n {children}\n </h6>\n );\n },\n\n // Links - use Next.js Link for internal paths\n a: ({\n href,\n children,\n ...props\n }: React.AnchorHTMLAttributes<HTMLAnchorElement>) => {\n if (href && href.startsWith(\"/\")) {\n return (\n <Link href={href} {...props}>\n {children}\n </Link>\n );\n }\n return (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n );\n },\n\n // Tables - wrap in a div for responsive overflow\n table: (props: React.TableHTMLAttributes<HTMLTableElement>) => (\n <div className=\"table-wrapper\">\n <table {...props} />\n </div>\n ),\n\n // Code blocks\n pre: Pre,\n\n // Expose your custom components for MDX usage\n Code: CodeBlock,\n CodeTabs,\n Card,\n Accordion,\n Tabs,\n TabContent,\n Callout,\n Icon,\n Columns,\n Field,\n Frame,\n // Share the heading slugger so an <Update> label anchor stays unique and\n // in document order alongside the surrounding headings. Only consume a\n // slug when a label is present so a label-less <Update> does not crash the\n // slugger (Update itself renders gracefully without a label anchor).\n Update: (props: React.ComponentProps<typeof Update>) => (\n <Update {...props} id={props.label ? slug(props.label) : undefined} />\n ),\n Steps,\n Step,\n Button,\n ColorSwatch,\n ColorSwatchGroup,\n DemoTheme,\n Space,\n ...components,\n };\n}\n";
|
|
@@ -12,6 +12,7 @@ import { Callout } from "@/components/layout/Callout";
|
|
|
12
12
|
import { Icon } from "@/components/layout/Icon";
|
|
13
13
|
import { Columns } from "@/components/layout/Columns";
|
|
14
14
|
import { Field } from "@/components/layout/Field";
|
|
15
|
+
import { Frame } from "@/components/layout/Frame";
|
|
15
16
|
import { Update } from "@/components/layout/Update";
|
|
16
17
|
import { Steps, Step } from "@/components/layout/Steps";
|
|
17
18
|
import { Button } from "@/components/layout/Button";
|
|
@@ -163,6 +164,7 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {
|
|
|
163
164
|
Icon,
|
|
164
165
|
Columns,
|
|
165
166
|
Field,
|
|
167
|
+
Frame,
|
|
166
168
|
// Share the heading slugger so an <Update> label anchor stays unique and
|
|
167
169
|
// in document order alongside the surrounding headings. Only consume a
|
|
168
170
|
// slug when a label is present so a label-less <Update> does not crash the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const postHogProviderLazyTemplate = "\"use client\";\n\nimport posthog from \"posthog-js\";\nimport { Suspense, useEffect, useRef, useState } from \"react\";\nimport { usePathname, useSearchParams } from \"next/navigation\";\nimport rawAnalyticsConfig from \"@/analytics.json\";\n\ninterface AnalyticsConfig {\n provider?: string;\n posthog?: {\n key?: string;\n host?: string;\n };\n}\n\nconst analyticsConfig = rawAnalyticsConfig as AnalyticsConfig;\n\nconst posthogKey =\n analyticsConfig?.provider === \"posthog\" ? analyticsConfig.posthog?.key : null;\n\n// `host` is the *ingestion* endpoint (us.i.posthog.com); `ui_host` wants the\n// dashboard it belongs to (us.posthog.com), which is what \"view in PostHog\"\n// links and the toolbar point at. Self-hosted instances serve both from one\n// origin, so leaving those untouched is correct.\nconst uiHost = (analyticsConfig.posthog?.host || \"https://us.i.posthog.com\"
|
|
1
|
+
export declare const postHogProviderLazyTemplate = "\"use client\";\n\nimport posthog from \"posthog-js\";\nimport { Suspense, useEffect, useRef, useState } from \"react\";\nimport { usePathname, useSearchParams } from \"next/navigation\";\nimport rawAnalyticsConfig from \"@/analytics.json\";\n\ninterface AnalyticsConfig {\n provider?: string;\n posthog?: {\n key?: string;\n host?: string;\n };\n}\n\nconst analyticsConfig = rawAnalyticsConfig as AnalyticsConfig;\n\nconst posthogKey =\n analyticsConfig?.provider === \"posthog\" ? analyticsConfig.posthog?.key : null;\n\n// `host` is the *ingestion* endpoint (us.i.posthog.com); `ui_host` wants the\n// dashboard it belongs to (us.posthog.com), which is what \"view in PostHog\"\n// links and the toolbar point at. Self-hosted instances serve both from one\n// origin, so leaving those untouched is correct.\nconst uiHost = (\n analyticsConfig.posthog?.host || \"https://us.i.posthog.com\"\n).replace(\".i.posthog.com\", \".posthog.com\");\n\n/**\n * Adopt the session id the middleware already decided on (see proxy.ts), so the\n * server's document-load `$pageview` and every client event after it land in\n * the same session.\n *\n * Without this the two disagree: the middleware used to forward posthog-js's\n * own session id without checking whether it had expired, so a returning\n * reader's pageview was filed under a dead session and the real new session\n * began with no pageview in it \u2014 wrong landing page, wrong bounce rate.\n *\n * Reading document.cookie works on the first request because the middleware\n * sets the cookie on the same response that carries this HTML. Returns\n * undefined if absent or malformed, in which case posthog-js mints its own id\n * as before: degraded, never broken.\n */\n// Both the middleware and this file WRITE the session cookie, so these three\n// must stay identical to their counterparts in proxy.ts. They are duplicated\n// rather than shared because a client component cannot import from the\n// middleware. A drifted max-age here would silently expire live sessions.\nconst SESSION_COOKIE = \"dcp_sid\";\nconst SESSION_MAX_MS = 24 * 60 * 60 * 1000;\n\nfunction isValidSessionId(id: string): boolean {\n return /^[0-9a-f]{32}$/i.test(id.replace(/-/g, \"\"));\n}\n\nfunction readSessionCookie(): { id: string; startTs: number } | undefined {\n if (typeof document === \"undefined\") return undefined;\n\n const match = document.cookie.match(/(?:^|;\\s*)dcp_sid=([^;]*)/);\n if (!match) return undefined;\n\n // Cookie is `id.startTs.lastTs`; posthog-js requires the id be a UUID and\n // logs an error if not, so check before handing it over.\n const [id, startRaw] = decodeURIComponent(match[1]).split(\".\");\n const startTs = Number(startRaw);\n if (!isValidSessionId(id) || !Number.isFinite(startTs)) return undefined;\n\n return { id, startTs };\n}\n\nfunction readEdgeSessionId(): string | undefined {\n return readSessionCookie()?.id;\n}\n\n/**\n * Keep the session cookie's last-activity fresh, from the browser.\n *\n * This is the half of session upkeep the middleware deliberately does NOT do.\n * A response carrying `Set-Cookie` is not cacheable by Vercel's CDN, so\n * refreshing last-activity server-side would have put one on roughly every doc\n * page an engaged reader loads. A `document.cookie` write sets no response\n * header at all, so your doc pages stay cacheable \u2014 and the browser is the side\n * that actually sees soft navigations and in-page activity.\n *\n * `startTs` is carried forward while the id is unchanged, so the 24h hard cap\n * still measures from when the session really began; a rotation restarts it.\n */\nfunction syncSessionCookie(sessionId: string | undefined) {\n if (typeof document === \"undefined\" || !sessionId) return;\n if (!isValidSessionId(sessionId)) return;\n\n const now = Date.now();\n const existing = readSessionCookie();\n const startTs = existing?.id === sessionId ? existing.startTs : now;\n const secure = location.protocol === \"https:\" ? \"; secure\" : \"\";\n\n document.cookie =\n SESSION_COOKIE +\n \"=\" +\n sessionId +\n \".\" +\n startTs +\n \".\" +\n now +\n \"; path=/; max-age=\" +\n SESSION_MAX_MS / 1000 +\n \"; samesite=lax\" +\n secure;\n}\n\nfunction PostHogInit({ onReady }: { onReady: () => void }) {\n const initRef = useRef(false);\n\n useEffect(() => {\n if (!posthogKey) return;\n\n // The init guard deliberately does NOT wrap the subscription below.\n //\n // Under React StrictMode's dev double-invoke the effect runs, is cleaned\n // up, then runs again. With an early `return` here, that second run would\n // skip past the subscription and leave `onSessionId` permanently\n // unsubscribed \u2014 in dev only, which is precisely where you would go to\n // check that any of this works. Initialising once while re-subscribing on\n // every run is correct in both modes.\n if (!initRef.current) {\n initRef.current = true;\n\n const sessionID = readEdgeSessionId();\n\n posthog.init(posthogKey, {\n api_host: \"/ingest\",\n ui_host: uiHost,\n capture_pageview: false,\n capture_pageleave: true,\n // The middleware owns session identity; this makes the SDK agree.\n ...(sessionID ? { bootstrap: { sessionID } } : {}),\n loaded: (ph) => {\n // Write once at startup so a session the middleware adopted (and\n // therefore did not rewrite) still gets its last-activity advanced.\n syncSessionCookie(ph.get_session_id());\n onReady();\n },\n });\n }\n\n // Fires when the session id first appears and on every rotation, so the\n // cookie follows posthog-js rather than drifting from it. posthog-js is the\n // better judge of idleness \u2014 it sees every captured event, not just\n // navigations. Returning its unsubscribe doubles as the effect cleanup.\n return posthog.onSessionId((id: string) => syncSessionCookie(id));\n }, [onReady]);\n\n return null;\n}\n\n/**\n * Captures soft navigations only.\n *\n * The document load that got the reader here was already captured in the\n * middleware (see proxy.ts), so counting it again here is what produced two\n * `$pageview` events per page load. Server owns document loads, client owns\n * soft navigations: disjoint, so neither double-counts nor leaves a gap.\n */\nfunction PostHogPageviewTracker() {\n const pathname = usePathname();\n const searchParams = useSearchParams();\n const isFirstRun = useRef(true);\n\n useEffect(() => {\n if (isFirstRun.current) {\n isFirstRun.current = false;\n return;\n }\n if (pathname) {\n const url = searchParams?.size\n ? `${pathname}?${searchParams.toString()}`\n : pathname;\n posthog.capture(\"$pageview\", { $current_url: url });\n\n // A soft navigation is activity the middleware never sees, and\n // `onSessionId` won't fire because the id hasn't changed. Without this, a\n // reader who browses only via client-side links would look idle to the\n // next document load and have their session rotated out from under them.\n syncSessionCookie(posthog.get_session_id());\n }\n }, [pathname, searchParams]);\n\n return null;\n}\n\nexport function PostHogSetup() {\n const [ready, setReady] = useState(false);\n\n if (!posthogKey) {\n return null;\n }\n\n return (\n <>\n <PostHogInit onReady={() => setReady(true)} />\n <Suspense fallback={null}>{ready && <PostHogPageviewTracker />}</Suspense>\n </>\n );\n}\n";
|
|
@@ -22,8 +22,9 @@ const posthogKey =
|
|
|
22
22
|
// dashboard it belongs to (us.posthog.com), which is what "view in PostHog"
|
|
23
23
|
// links and the toolbar point at. Self-hosted instances serve both from one
|
|
24
24
|
// origin, so leaving those untouched is correct.
|
|
25
|
-
const uiHost = (
|
|
26
|
-
.
|
|
25
|
+
const uiHost = (
|
|
26
|
+
analyticsConfig.posthog?.host || "https://us.i.posthog.com"
|
|
27
|
+
).replace(".i.posthog.com", ".posthog.com");
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Adopt the session id the middleware already decided on (see proxy.ts), so the
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const frameTemplate = "\"use client\";\nimport React from \"react\";\nimport Link from \"next/link\";\nimport styled from \"styled-components\";\nimport { styledSmall } from \"cherry-styled-components\";\nimport { Theme } from \"@/app/theme\";\n\n// Captions and hints accept a deliberately small slice of Markdown: links,\n// bold, italic and inline code. Everything is parsed into React elements -\n// never dangerouslySetInnerHTML - so author text can't inject raw markup.\nconst INLINE_MD =\n /\\[([^\\]]+)\\]\\(([^)\\s]+)\\)|\\*\\*([^*]+)\\*\\*|__([^_]+)__|`([^`]+)`|\\*([^*]+)\\*|_([^_]+)_/g;\n\n// Link targets are limited to schemes that can't execute script. Anything\n// else (javascript:, data:, vbscript:) falls back to literal text.\nconst SAFE_HREF = /^(?:https?:\\/\\/|mailto:|[/#]|\\.{1,2}\\/)/i;\n\n// Emphasis and link labels are parsed recursively, so the matcher must not\n// carry state between calls - matchAll() iterates over its own clone of the\n// pattern, leaving INLINE_MD.lastIndex untouched for the caller mid-loop.\nfunction renderInline(text: string, keyPrefix = \"\"): React.ReactNode[] {\n const nodes: React.ReactNode[] = [];\n let lastIndex = 0;\n\n for (const match of text.matchAll(INLINE_MD)) {\n const start = match.index ?? 0;\n if (start > lastIndex) {\n nodes.push(text.slice(lastIndex, start));\n }\n\n // RegExpExecArray types every group as string, but unmatched alternatives\n // are undefined at runtime - widen so the branch checks below are honest.\n const full = match[0];\n const groups: Array<string | undefined> = match;\n const [, linkText, href, strong, strongAlt, code, em, emAlt] = groups;\n const key = `${keyPrefix}${start}`;\n\n if (href !== undefined) {\n const label = renderInline(linkText as string, `${key}-`);\n if (!SAFE_HREF.test(href)) {\n nodes.push(full);\n } else if (href.startsWith(\"/\")) {\n nodes.push(\n <Link key={key} href={href}>\n {label}\n </Link>,\n );\n } else if (href.startsWith(\"#\")) {\n nodes.push(\n <a key={key} href={href}>\n {label}\n </a>,\n );\n } else {\n nodes.push(\n <a key={key} href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {label}\n </a>,\n );\n }\n } else if (strong !== undefined || strongAlt !== undefined) {\n nodes.push(\n <strong key={key}>\n {renderInline((strong ?? strongAlt) as string, `${key}-`)}\n </strong>,\n );\n } else if (code !== undefined) {\n nodes.push(<code key={key}>{code}</code>);\n } else {\n nodes.push(\n <em key={key}>{renderInline((em ?? emAlt) as string, `${key}-`)}</em>,\n );\n }\n\n lastIndex = start + full.length;\n }\n\n if (lastIndex < text.length) {\n nodes.push(text.slice(lastIndex));\n }\n\n return nodes;\n}\n\n// A self-playing video only works across browsers when it is also muted and\n// inline, so the frame fills those in. Explicit author values always win, and\n// videos without autoPlay are left untouched. Recursion is capped and limited\n// to host elements so a markdown-wrapped <p> is still traversed while author\n// components are never re-cloned.\nfunction withVideoDefaults(\n children: React.ReactNode,\n depth = 0,\n): React.ReactNode {\n if (depth > 2) return children;\n\n return React.Children.map(children, (child) => {\n if (!React.isValidElement(child)) return child;\n\n if (child.type === \"video\") {\n const videoProps =\n child.props as React.VideoHTMLAttributes<HTMLVideoElement>;\n if (!videoProps.autoPlay) return child;\n return React.cloneElement(\n child as React.ReactElement<\n React.VideoHTMLAttributes<HTMLVideoElement>\n >,\n {\n playsInline: videoProps.playsInline ?? true,\n loop: videoProps.loop ?? true,\n muted: videoProps.muted ?? true,\n },\n );\n }\n\n if (typeof child.type !== \"string\") return child;\n\n const hostProps = child.props as { children?: React.ReactNode };\n if (hostProps.children == null) return child;\n\n return React.cloneElement(\n child as React.ReactElement<{ children?: React.ReactNode }>,\n { children: withVideoDefaults(hostProps.children, depth + 1) },\n );\n });\n}\n\nconst StyledFrameWrapper = styled.div`\n display: flex;\n flex-direction: column;\n gap: 10px;\n max-width: 100%;\n`;\n\nconst StyledFrameHint = styled.p<{ theme: Theme }>`\n ${({ theme }) => styledSmall(theme)};\n color: ${({ theme }) => theme.colors.grayDark};\n margin: 0;\n`;\n\nconst StyledFrame = styled.figure<{ theme: Theme }>`\n display: flex;\n flex-direction: column;\n gap: 8px;\n margin: 0;\n padding: 8px;\n border: solid 1px ${({ theme }) => theme.colors.grayLight};\n border-radius: ${({ theme }) => theme.spacing.radius.lg};\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.grayLight} 25%, transparent)`};\n`;\n\nconst StyledFrameContent = styled.div<{ theme: Theme }>`\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 15px;\n\n & > * {\n max-width: 100%;\n }\n\n & p {\n margin: 0;\n }\n\n & img,\n & video,\n & iframe {\n display: block;\n max-width: 100%;\n height: auto;\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n }\n`;\n\nconst StyledFrameCaption = styled.figcaption<{ theme: Theme }>`\n ${({ theme }) => styledSmall(theme)};\n color: ${({ theme }) => theme.colors.gray};\n text-align: center;\n margin: 0;\n`;\n\ninterface FrameProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n caption?: string;\n hint?: string;\n}\n\nfunction Frame({ children, caption, hint, ...props }: FrameProps) {\n return (\n <StyledFrameWrapper {...props}>\n {hint && <StyledFrameHint>{renderInline(hint)}</StyledFrameHint>}\n <StyledFrame>\n <StyledFrameContent>{withVideoDefaults(children)}</StyledFrameContent>\n {caption && (\n <StyledFrameCaption>{renderInline(caption)}</StyledFrameCaption>\n )}\n </StyledFrame>\n </StyledFrameWrapper>\n );\n}\n\nexport { Frame };\n";
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
export const frameTemplate = `"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import styled from "styled-components";
|
|
5
|
+
import { styledSmall } from "cherry-styled-components";
|
|
6
|
+
import { Theme } from "@/app/theme";
|
|
7
|
+
|
|
8
|
+
// Captions and hints accept a deliberately small slice of Markdown: links,
|
|
9
|
+
// bold, italic and inline code. Everything is parsed into React elements -
|
|
10
|
+
// never dangerouslySetInnerHTML - so author text can't inject raw markup.
|
|
11
|
+
const INLINE_MD =
|
|
12
|
+
/\\[([^\\]]+)\\]\\(([^)\\s]+)\\)|\\*\\*([^*]+)\\*\\*|__([^_]+)__|\`([^\`]+)\`|\\*([^*]+)\\*|_([^_]+)_/g;
|
|
13
|
+
|
|
14
|
+
// Link targets are limited to schemes that can't execute script. Anything
|
|
15
|
+
// else (javascript:, data:, vbscript:) falls back to literal text.
|
|
16
|
+
const SAFE_HREF = /^(?:https?:\\/\\/|mailto:|[/#]|\\.{1,2}\\/)/i;
|
|
17
|
+
|
|
18
|
+
// Emphasis and link labels are parsed recursively, so the matcher must not
|
|
19
|
+
// carry state between calls - matchAll() iterates over its own clone of the
|
|
20
|
+
// pattern, leaving INLINE_MD.lastIndex untouched for the caller mid-loop.
|
|
21
|
+
function renderInline(text: string, keyPrefix = ""): React.ReactNode[] {
|
|
22
|
+
const nodes: React.ReactNode[] = [];
|
|
23
|
+
let lastIndex = 0;
|
|
24
|
+
|
|
25
|
+
for (const match of text.matchAll(INLINE_MD)) {
|
|
26
|
+
const start = match.index ?? 0;
|
|
27
|
+
if (start > lastIndex) {
|
|
28
|
+
nodes.push(text.slice(lastIndex, start));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// RegExpExecArray types every group as string, but unmatched alternatives
|
|
32
|
+
// are undefined at runtime - widen so the branch checks below are honest.
|
|
33
|
+
const full = match[0];
|
|
34
|
+
const groups: Array<string | undefined> = match;
|
|
35
|
+
const [, linkText, href, strong, strongAlt, code, em, emAlt] = groups;
|
|
36
|
+
const key = \`\${keyPrefix}\${start}\`;
|
|
37
|
+
|
|
38
|
+
if (href !== undefined) {
|
|
39
|
+
const label = renderInline(linkText as string, \`\${key}-\`);
|
|
40
|
+
if (!SAFE_HREF.test(href)) {
|
|
41
|
+
nodes.push(full);
|
|
42
|
+
} else if (href.startsWith("/")) {
|
|
43
|
+
nodes.push(
|
|
44
|
+
<Link key={key} href={href}>
|
|
45
|
+
{label}
|
|
46
|
+
</Link>,
|
|
47
|
+
);
|
|
48
|
+
} else if (href.startsWith("#")) {
|
|
49
|
+
nodes.push(
|
|
50
|
+
<a key={key} href={href}>
|
|
51
|
+
{label}
|
|
52
|
+
</a>,
|
|
53
|
+
);
|
|
54
|
+
} else {
|
|
55
|
+
nodes.push(
|
|
56
|
+
<a key={key} href={href} target="_blank" rel="noopener noreferrer">
|
|
57
|
+
{label}
|
|
58
|
+
</a>,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
} else if (strong !== undefined || strongAlt !== undefined) {
|
|
62
|
+
nodes.push(
|
|
63
|
+
<strong key={key}>
|
|
64
|
+
{renderInline((strong ?? strongAlt) as string, \`\${key}-\`)}
|
|
65
|
+
</strong>,
|
|
66
|
+
);
|
|
67
|
+
} else if (code !== undefined) {
|
|
68
|
+
nodes.push(<code key={key}>{code}</code>);
|
|
69
|
+
} else {
|
|
70
|
+
nodes.push(
|
|
71
|
+
<em key={key}>{renderInline((em ?? emAlt) as string, \`\${key}-\`)}</em>,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
lastIndex = start + full.length;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (lastIndex < text.length) {
|
|
79
|
+
nodes.push(text.slice(lastIndex));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return nodes;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// A self-playing video only works across browsers when it is also muted and
|
|
86
|
+
// inline, so the frame fills those in. Explicit author values always win, and
|
|
87
|
+
// videos without autoPlay are left untouched. Recursion is capped and limited
|
|
88
|
+
// to host elements so a markdown-wrapped <p> is still traversed while author
|
|
89
|
+
// components are never re-cloned.
|
|
90
|
+
function withVideoDefaults(
|
|
91
|
+
children: React.ReactNode,
|
|
92
|
+
depth = 0,
|
|
93
|
+
): React.ReactNode {
|
|
94
|
+
if (depth > 2) return children;
|
|
95
|
+
|
|
96
|
+
return React.Children.map(children, (child) => {
|
|
97
|
+
if (!React.isValidElement(child)) return child;
|
|
98
|
+
|
|
99
|
+
if (child.type === "video") {
|
|
100
|
+
const videoProps =
|
|
101
|
+
child.props as React.VideoHTMLAttributes<HTMLVideoElement>;
|
|
102
|
+
if (!videoProps.autoPlay) return child;
|
|
103
|
+
return React.cloneElement(
|
|
104
|
+
child as React.ReactElement<
|
|
105
|
+
React.VideoHTMLAttributes<HTMLVideoElement>
|
|
106
|
+
>,
|
|
107
|
+
{
|
|
108
|
+
playsInline: videoProps.playsInline ?? true,
|
|
109
|
+
loop: videoProps.loop ?? true,
|
|
110
|
+
muted: videoProps.muted ?? true,
|
|
111
|
+
},
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (typeof child.type !== "string") return child;
|
|
116
|
+
|
|
117
|
+
const hostProps = child.props as { children?: React.ReactNode };
|
|
118
|
+
if (hostProps.children == null) return child;
|
|
119
|
+
|
|
120
|
+
return React.cloneElement(
|
|
121
|
+
child as React.ReactElement<{ children?: React.ReactNode }>,
|
|
122
|
+
{ children: withVideoDefaults(hostProps.children, depth + 1) },
|
|
123
|
+
);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const StyledFrameWrapper = styled.div\`
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
gap: 10px;
|
|
131
|
+
max-width: 100%;
|
|
132
|
+
\`;
|
|
133
|
+
|
|
134
|
+
const StyledFrameHint = styled.p<{ theme: Theme }>\`
|
|
135
|
+
\${({ theme }) => styledSmall(theme)};
|
|
136
|
+
color: \${({ theme }) => theme.colors.grayDark};
|
|
137
|
+
margin: 0;
|
|
138
|
+
\`;
|
|
139
|
+
|
|
140
|
+
const StyledFrame = styled.figure<{ theme: Theme }>\`
|
|
141
|
+
display: flex;
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
gap: 8px;
|
|
144
|
+
margin: 0;
|
|
145
|
+
padding: 8px;
|
|
146
|
+
border: solid 1px \${({ theme }) => theme.colors.grayLight};
|
|
147
|
+
border-radius: \${({ theme }) => theme.spacing.radius.lg};
|
|
148
|
+
background: \${({ theme }) =>
|
|
149
|
+
\`color-mix(in srgb, \${theme.colors.grayLight} 25%, transparent)\`};
|
|
150
|
+
\`;
|
|
151
|
+
|
|
152
|
+
const StyledFrameContent = styled.div<{ theme: Theme }>\`
|
|
153
|
+
display: flex;
|
|
154
|
+
flex-direction: column;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
gap: 15px;
|
|
158
|
+
|
|
159
|
+
& > * {
|
|
160
|
+
max-width: 100%;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
& p {
|
|
164
|
+
margin: 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
& img,
|
|
168
|
+
& video,
|
|
169
|
+
& iframe {
|
|
170
|
+
display: block;
|
|
171
|
+
max-width: 100%;
|
|
172
|
+
height: auto;
|
|
173
|
+
border-radius: \${({ theme }) => theme.spacing.radius.xs};
|
|
174
|
+
}
|
|
175
|
+
\`;
|
|
176
|
+
|
|
177
|
+
const StyledFrameCaption = styled.figcaption<{ theme: Theme }>\`
|
|
178
|
+
\${({ theme }) => styledSmall(theme)};
|
|
179
|
+
color: \${({ theme }) => theme.colors.gray};
|
|
180
|
+
text-align: center;
|
|
181
|
+
margin: 0;
|
|
182
|
+
\`;
|
|
183
|
+
|
|
184
|
+
interface FrameProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
185
|
+
children: React.ReactNode;
|
|
186
|
+
caption?: string;
|
|
187
|
+
hint?: string;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function Frame({ children, caption, hint, ...props }: FrameProps) {
|
|
191
|
+
return (
|
|
192
|
+
<StyledFrameWrapper {...props}>
|
|
193
|
+
{hint && <StyledFrameHint>{renderInline(hint)}</StyledFrameHint>}
|
|
194
|
+
<StyledFrame>
|
|
195
|
+
<StyledFrameContent>{withVideoDefaults(children)}</StyledFrameContent>
|
|
196
|
+
{caption && (
|
|
197
|
+
<StyledFrameCaption>{renderInline(caption)}</StyledFrameCaption>
|
|
198
|
+
)}
|
|
199
|
+
</StyledFrame>
|
|
200
|
+
</StyledFrameWrapper>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export { Frame };
|
|
205
|
+
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const componentsMdxTemplate = "---\ntitle: \"Components\"\ndescription: \"Explore the full library of built-in components available in your documentation pages.\"\ndate: \"2026-02-19\"\ncategory: \"Components\"\ncategoryOrder: 1\ncategoryIcon: \"blocks\"\norder: 0\n---\n# Components\n\nDoccupine includes a rich set of built-in components you can use directly in your MDX files - no imports needed. Browse the full library below.\n\n<Columns cols={2}>\n <Card title=\"Headers and Text\" icon=\"heading\" href=\"/headers-and-text\">\n Headings, paragraphs, bold, italic, links, and other text formatting.\n </Card>\n <Card title=\"Lists and Tables\" icon=\"list\" href=\"/lists-and-tables\">\n Ordered lists, unordered lists, and data tables.\n </Card>\n <Card title=\"Code\" icon=\"code\" href=\"/code\">\n Inline code, fenced code blocks, and syntax highlighting.\n </Card>\n <Card title=\"Accordion\" icon=\"chevrons-down\" href=\"/accordion\">\n Collapsible sections for organizing lengthy content.\n </Card>\n <Card title=\"Tabs\" icon=\"panel-top\" href=\"/tabs\">\n Tabbed interfaces for grouping related content.\n </Card>\n <Card title=\"Cards\" icon=\"square\" href=\"/cards\">\n Visual containers for content, icons, and links.\n </Card>\n <Card title=\"Buttons\" icon=\"mouse-pointer-click\" href=\"/buttons\">\n Action components with variants, sizes, and icons.\n </Card>\n <Card title=\"Callouts\" icon=\"megaphone\" href=\"/callouts\">\n Highlighted blocks for tips, warnings, and important notes.\n </Card>\n <Card title=\"Images and Embeds\" icon=\"image\" href=\"/image-and-embeds\">\n Images, videos, and embedded content.\n </Card>\n <Card title=\"Icons\" icon=\"smile\" href=\"/icons\">\n Lucide icons you can use anywhere in your docs.\n </Card>\n <Card title=\"Fields\" icon=\"text-cursor-input\" href=\"/fields\">\n Property and parameter documentation blocks.\n </Card>\n <Card title=\"Update\" icon=\"bell\" href=\"/update\">\n Changelog and update announcement blocks.\n </Card>\n <Card title=\"Columns\" icon=\"columns-3\" href=\"/columns\">\n Grid layouts for arranging cards and content side by side.\n </Card>\n <Card title=\"Steps\" icon=\"footprints\" href=\"/steps\">\n Numbered step-by-step guides and walkthroughs.\n </Card>\n <Card title=\"Color Swatches\" icon=\"palette\" href=\"/color-swatches\">\n Visual color palette swatches to document your theme colors.\n </Card>\n <Card title=\"Mermaid\" icon=\"workflow\" href=\"/mermaid\">\n Flowcharts, sequence diagrams, and other visualizations from Mermaid syntax.\n </Card>\n</Columns>";
|
|
1
|
+
export declare const componentsMdxTemplate = "---\ntitle: \"Components\"\ndescription: \"Explore the full library of built-in components available in your documentation pages.\"\ndate: \"2026-02-19\"\ncategory: \"Components\"\ncategoryOrder: 1\ncategoryIcon: \"blocks\"\norder: 0\n---\n# Components\n\nDoccupine includes a rich set of built-in components you can use directly in your MDX files - no imports needed. Browse the full library below.\n\n<Columns cols={2}>\n <Card title=\"Headers and Text\" icon=\"heading\" href=\"/headers-and-text\">\n Headings, paragraphs, bold, italic, links, and other text formatting.\n </Card>\n <Card title=\"Lists and Tables\" icon=\"list\" href=\"/lists-and-tables\">\n Ordered lists, unordered lists, and data tables.\n </Card>\n <Card title=\"Code\" icon=\"code\" href=\"/code\">\n Inline code, fenced code blocks, and syntax highlighting.\n </Card>\n <Card title=\"Accordion\" icon=\"chevrons-down\" href=\"/accordion\">\n Collapsible sections for organizing lengthy content.\n </Card>\n <Card title=\"Tabs\" icon=\"panel-top\" href=\"/tabs\">\n Tabbed interfaces for grouping related content.\n </Card>\n <Card title=\"Cards\" icon=\"square\" href=\"/cards\">\n Visual containers for content, icons, and links.\n </Card>\n <Card title=\"Buttons\" icon=\"mouse-pointer-click\" href=\"/buttons\">\n Action components with variants, sizes, and icons.\n </Card>\n <Card title=\"Callouts\" icon=\"megaphone\" href=\"/callouts\">\n Highlighted blocks for tips, warnings, and important notes.\n </Card>\n <Card title=\"Images and Embeds\" icon=\"image\" href=\"/image-and-embeds\">\n Images, videos, and embedded content.\n </Card>\n <Card title=\"Frames\" icon=\"frame\" href=\"/frames\">\n Bordered containers with captions for images, videos, and diagrams.\n </Card>\n <Card title=\"Icons\" icon=\"smile\" href=\"/icons\">\n Lucide icons you can use anywhere in your docs.\n </Card>\n <Card title=\"Fields\" icon=\"text-cursor-input\" href=\"/fields\">\n Property and parameter documentation blocks.\n </Card>\n <Card title=\"Update\" icon=\"bell\" href=\"/update\">\n Changelog and update announcement blocks.\n </Card>\n <Card title=\"Columns\" icon=\"columns-3\" href=\"/columns\">\n Grid layouts for arranging cards and content side by side.\n </Card>\n <Card title=\"Steps\" icon=\"footprints\" href=\"/steps\">\n Numbered step-by-step guides and walkthroughs.\n </Card>\n <Card title=\"Color Swatches\" icon=\"palette\" href=\"/color-swatches\">\n Visual color palette swatches to document your theme colors.\n </Card>\n <Card title=\"Mermaid\" icon=\"workflow\" href=\"/mermaid\">\n Flowcharts, sequence diagrams, and other visualizations from Mermaid syntax.\n </Card>\n</Columns>";
|
|
@@ -39,6 +39,9 @@ Doccupine includes a rich set of built-in components you can use directly in you
|
|
|
39
39
|
<Card title="Images and Embeds" icon="image" href="/image-and-embeds">
|
|
40
40
|
Images, videos, and embedded content.
|
|
41
41
|
</Card>
|
|
42
|
+
<Card title="Frames" icon="frame" href="/frames">
|
|
43
|
+
Bordered containers with captions for images, videos, and diagrams.
|
|
44
|
+
</Card>
|
|
42
45
|
<Card title="Icons" icon="smile" href="/icons">
|
|
43
46
|
Lucide icons you can use anywhere in your docs.
|
|
44
47
|
</Card>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const framesMdxTemplate = "---\ntitle: \"Frames\"\ndescription: \"Give images, videos, and diagrams a bordered container with an optional caption.\"\ndate: \"2026-02-19\"\ncategory: \"Components\"\ncategoryOrder: 1\norder: 17\n---\n# Frames\n\nGive images, videos, and diagrams a bordered container with an optional caption.\n\nA frame lifts visual content out of the surrounding prose. It centers whatever you put inside, wraps it in a soft border, and gives you a place to attach a caption - so screenshots and diagrams read as deliberate figures rather than stray images.\n\n<Frame>\n <img src=\"https://docs.doccupine.com/demo.png\" alt=\"A product screenshot displayed inside a frame.\" />\n</Frame>\n\n## Frame usage\n\nWrap any visual element in `<Frame>`. Images, videos, iframes, and Mermaid diagrams all work.\n\n```html\n<Frame>\n <img src=\"/images/dashboard.png\" alt=\"The project dashboard.\" />\n</Frame>\n```\n\n## Captions\n\nPass a `caption` to add a short line of context under the content, inside the frame.\n\n```html\n<Frame caption=\"The dashboard groups every project by workspace.\">\n <img src=\"/images/dashboard.png\" alt=\"The project dashboard.\" />\n</Frame>\n```\n\n<Frame caption=\"The dashboard groups every project by workspace.\">\n <img src=\"https://docs.doccupine.com/demo.png\" alt=\"The project dashboard.\" />\n</Frame>\n\n### Formatting inside captions\n\nCaptions understand a small set of inline Markdown: links, bold, italic, and inline code wrapped in backticks. Everything else is rendered as plain text.\n\n```html\n<Frame caption=\"**Heads up:** run `doccupine build` before you [deploy](/deployment-and-hosting).\">\n <img src=\"/images/dashboard.png\" alt=\"The project dashboard.\" />\n</Frame>\n```\n\n<Frame caption=\"**Heads up:** run `doccupine build` before you [deploy](/deployment-and-hosting).\">\n <img src=\"https://docs.doccupine.com/demo.png\" alt=\"The project dashboard.\" />\n</Frame>\n\n<Callout type=\"note\">\n Links that point to a path starting with `/` are routed through Next.js, so they navigate without a full page reload. External links open in a new tab.\n</Callout>\n\n## Hints\n\nA `hint` is a line of text that sits above the frame. Use it to set up what the reader is about to look at - captions work better for describing what they just saw.\n\n```html\n<Frame hint=\"Every workspace you belong to appears in the switcher.\" caption=\"The dashboard groups every project by workspace.\">\n <img src=\"/images/dashboard.png\" alt=\"The project dashboard.\" />\n</Frame>\n```\n\n<Frame hint=\"Every workspace you belong to appears in the switcher.\" caption=\"The dashboard groups every project by workspace.\">\n <img src=\"https://docs.doccupine.com/demo.png\" alt=\"The project dashboard.\" />\n</Frame>\n\nHints accept the same inline Markdown as captions.\n\n## Videos\n\nVideos can be framed like any other element. A video with `autoPlay` is given `muted`, `loop`, and `playsInline` automatically, because browsers refuse to autoplay a video with sound and iOS otherwise opens it fullscreen.\n\n```html\n<Frame caption=\"Creating a project takes about twenty seconds.\">\n <video autoPlay src=\"/videos/create-project.mp4\" />\n</Frame>\n```\n\nSet any of those attributes yourself and your value is kept. Videos without `autoPlay` are left exactly as you wrote them, so add `controls` when you want the reader to press play.\n\n```html\n<Frame caption=\"A twenty second walkthrough.\">\n <video controls src=\"/videos/create-project.mp4\" />\n</Frame>\n```\n\n<Frame caption=\"A twenty second walkthrough.\">\n <video controls className=\"aspect-video\" src=\"https://samplelib.com/lib/preview/mp4/sample-20s.mp4\" />\n</Frame>\n\n## Multiple elements\n\nA frame can hold more than one child. They stack vertically and stay centered, which is handy for a before-and-after pair under a single caption.\n\n<Frame caption=\"Light and dark renderings of the same diagram.\">\n <img src=\"https://docs.doccupine.com/demo.png\" alt=\"The diagram in light mode.\" />\n <img src=\"https://docs.doccupine.com/demo.png\" alt=\"The diagram in dark mode.\" style={{ filter: \"invert(1)\" }} />\n</Frame>\n\n<Callout type=\"note\">\n Frames don't replace alt text. Keep writing descriptive `alt` attributes - a caption is visible to everyone, while alt text is what screen readers announce in place of the image.\n</Callout>\n\n## Properties\n\n<Field value=\"children\" type=\"node\" required>\n The content to frame. Usually an image, video, iframe, or diagram.\n</Field>\n\n<Field value=\"caption\" type=\"string\">\n Text shown inside the frame, centered below the content. Supports inline Markdown.\n</Field>\n\n<Field value=\"hint\" type=\"string\">\n Text shown above the frame. Supports inline Markdown.\n</Field>";
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export const framesMdxTemplate = `---
|
|
2
|
+
title: "Frames"
|
|
3
|
+
description: "Give images, videos, and diagrams a bordered container with an optional caption."
|
|
4
|
+
date: "2026-02-19"
|
|
5
|
+
category: "Components"
|
|
6
|
+
categoryOrder: 1
|
|
7
|
+
order: 17
|
|
8
|
+
---
|
|
9
|
+
# Frames
|
|
10
|
+
|
|
11
|
+
Give images, videos, and diagrams a bordered container with an optional caption.
|
|
12
|
+
|
|
13
|
+
A frame lifts visual content out of the surrounding prose. It centers whatever you put inside, wraps it in a soft border, and gives you a place to attach a caption - so screenshots and diagrams read as deliberate figures rather than stray images.
|
|
14
|
+
|
|
15
|
+
<Frame>
|
|
16
|
+
<img src="https://docs.doccupine.com/demo.png" alt="A product screenshot displayed inside a frame." />
|
|
17
|
+
</Frame>
|
|
18
|
+
|
|
19
|
+
## Frame usage
|
|
20
|
+
|
|
21
|
+
Wrap any visual element in \`<Frame>\`. Images, videos, iframes, and Mermaid diagrams all work.
|
|
22
|
+
|
|
23
|
+
\`\`\`html
|
|
24
|
+
<Frame>
|
|
25
|
+
<img src="/images/dashboard.png" alt="The project dashboard." />
|
|
26
|
+
</Frame>
|
|
27
|
+
\`\`\`
|
|
28
|
+
|
|
29
|
+
## Captions
|
|
30
|
+
|
|
31
|
+
Pass a \`caption\` to add a short line of context under the content, inside the frame.
|
|
32
|
+
|
|
33
|
+
\`\`\`html
|
|
34
|
+
<Frame caption="The dashboard groups every project by workspace.">
|
|
35
|
+
<img src="/images/dashboard.png" alt="The project dashboard." />
|
|
36
|
+
</Frame>
|
|
37
|
+
\`\`\`
|
|
38
|
+
|
|
39
|
+
<Frame caption="The dashboard groups every project by workspace.">
|
|
40
|
+
<img src="https://docs.doccupine.com/demo.png" alt="The project dashboard." />
|
|
41
|
+
</Frame>
|
|
42
|
+
|
|
43
|
+
### Formatting inside captions
|
|
44
|
+
|
|
45
|
+
Captions understand a small set of inline Markdown: links, bold, italic, and inline code wrapped in backticks. Everything else is rendered as plain text.
|
|
46
|
+
|
|
47
|
+
\`\`\`html
|
|
48
|
+
<Frame caption="**Heads up:** run \`doccupine build\` before you [deploy](/deployment-and-hosting).">
|
|
49
|
+
<img src="/images/dashboard.png" alt="The project dashboard." />
|
|
50
|
+
</Frame>
|
|
51
|
+
\`\`\`
|
|
52
|
+
|
|
53
|
+
<Frame caption="**Heads up:** run \`doccupine build\` before you [deploy](/deployment-and-hosting).">
|
|
54
|
+
<img src="https://docs.doccupine.com/demo.png" alt="The project dashboard." />
|
|
55
|
+
</Frame>
|
|
56
|
+
|
|
57
|
+
<Callout type="note">
|
|
58
|
+
Links that point to a path starting with \`/\` are routed through Next.js, so they navigate without a full page reload. External links open in a new tab.
|
|
59
|
+
</Callout>
|
|
60
|
+
|
|
61
|
+
## Hints
|
|
62
|
+
|
|
63
|
+
A \`hint\` is a line of text that sits above the frame. Use it to set up what the reader is about to look at - captions work better for describing what they just saw.
|
|
64
|
+
|
|
65
|
+
\`\`\`html
|
|
66
|
+
<Frame hint="Every workspace you belong to appears in the switcher." caption="The dashboard groups every project by workspace.">
|
|
67
|
+
<img src="/images/dashboard.png" alt="The project dashboard." />
|
|
68
|
+
</Frame>
|
|
69
|
+
\`\`\`
|
|
70
|
+
|
|
71
|
+
<Frame hint="Every workspace you belong to appears in the switcher." caption="The dashboard groups every project by workspace.">
|
|
72
|
+
<img src="https://docs.doccupine.com/demo.png" alt="The project dashboard." />
|
|
73
|
+
</Frame>
|
|
74
|
+
|
|
75
|
+
Hints accept the same inline Markdown as captions.
|
|
76
|
+
|
|
77
|
+
## Videos
|
|
78
|
+
|
|
79
|
+
Videos can be framed like any other element. A video with \`autoPlay\` is given \`muted\`, \`loop\`, and \`playsInline\` automatically, because browsers refuse to autoplay a video with sound and iOS otherwise opens it fullscreen.
|
|
80
|
+
|
|
81
|
+
\`\`\`html
|
|
82
|
+
<Frame caption="Creating a project takes about twenty seconds.">
|
|
83
|
+
<video autoPlay src="/videos/create-project.mp4" />
|
|
84
|
+
</Frame>
|
|
85
|
+
\`\`\`
|
|
86
|
+
|
|
87
|
+
Set any of those attributes yourself and your value is kept. Videos without \`autoPlay\` are left exactly as you wrote them, so add \`controls\` when you want the reader to press play.
|
|
88
|
+
|
|
89
|
+
\`\`\`html
|
|
90
|
+
<Frame caption="A twenty second walkthrough.">
|
|
91
|
+
<video controls src="/videos/create-project.mp4" />
|
|
92
|
+
</Frame>
|
|
93
|
+
\`\`\`
|
|
94
|
+
|
|
95
|
+
<Frame caption="A twenty second walkthrough.">
|
|
96
|
+
<video controls className="aspect-video" src="https://samplelib.com/lib/preview/mp4/sample-20s.mp4" />
|
|
97
|
+
</Frame>
|
|
98
|
+
|
|
99
|
+
## Multiple elements
|
|
100
|
+
|
|
101
|
+
A frame can hold more than one child. They stack vertically and stay centered, which is handy for a before-and-after pair under a single caption.
|
|
102
|
+
|
|
103
|
+
<Frame caption="Light and dark renderings of the same diagram.">
|
|
104
|
+
<img src="https://docs.doccupine.com/demo.png" alt="The diagram in light mode." />
|
|
105
|
+
<img src="https://docs.doccupine.com/demo.png" alt="The diagram in dark mode." style={{ filter: "invert(1)" }} />
|
|
106
|
+
</Frame>
|
|
107
|
+
|
|
108
|
+
<Callout type="note">
|
|
109
|
+
Frames don't replace alt text. Keep writing descriptive \`alt\` attributes - a caption is visible to everyone, while alt text is what screen readers announce in place of the image.
|
|
110
|
+
</Callout>
|
|
111
|
+
|
|
112
|
+
## Properties
|
|
113
|
+
|
|
114
|
+
<Field value="children" type="node" required>
|
|
115
|
+
The content to frame. Usually an image, video, iframe, or diagram.
|
|
116
|
+
</Field>
|
|
117
|
+
|
|
118
|
+
<Field value="caption" type="string">
|
|
119
|
+
Text shown inside the frame, centered below the content. Supports inline Markdown.
|
|
120
|
+
</Field>
|
|
121
|
+
|
|
122
|
+
<Field value="hint" type="string">
|
|
123
|
+
Text shown above the frame. Supports inline Markdown.
|
|
124
|
+
</Field>`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const navigationMdxTemplate = "---\ntitle: \"Navigation\"\ndescription: \"Organize and structure your navigation.\"\ndate: \"2026-02-19\"\ncategory: \"Configuration\"\ncategoryOrder: 3\norder: 2\n---\n# Navigation\n\nDoccupine builds your sidebar automatically from your MDX pages. By default, it reads the page frontmatter and groups pages into categories in the order you define. For larger docs, you can take full control with a `navigation.json` file.\n\n## Automatic navigation (default)\n\nWhen no custom navigation is provided, Doccupine generates a structure based on each page's frontmatter.\n\n### Frontmatter fields\n\n- **category**: The category name that groups the page in the sidebar.\n- **categoryOrder**: The position of the category within the sidebar. Lower numbers appear first.\n- **order**: The position of the page within its category. Lower numbers appear first.\n- **navIcon**: Optional [Lucide](https://lucide.dev/icons) icon name shown next to the page's sidebar link.\n- **categoryIcon**: Optional Lucide icon name for the page's category header. The first page in a category that sets it wins.\n\n### Example frontmatter\n\n```text\n---\ntitle: \"Navigation\"\ndescription: \"Organize and structure your navigation.\"\ndate: \"2025-01-15\"\ncategory: \"Configuration\"\ncategoryOrder: 3\norder: 2\n---\n```\n\nThis approach is great for small sets of documents. For larger projects, setting these fields on every page can become repetitive.\n\n## Custom navigation with navigation.json\n\nTo centrally define the entire sidebar, create a `navigation.json` at your project root (the same directory where you execute `npx doccupine`). When present, it takes priority over page frontmatter and fully controls the navigation structure.\n\n### Array format\n\nThe simplest format is an array of categories. When using [sections](/sections), this applies to the root section only.\n\n```json\n[\n {\n \"label\": \"Getting Started\",\n \"links\": [\n { \"slug\": \"\", \"title\": \"Introduction\" },\n { \"slug\": \"commands\", \"title\": \"Commands\" },\n { \"slug\": \"what-is-doccupine\", \"title\": \"What is Doccupine\" }\n ]\n },\n {\n \"label\": \"Components\",\n \"links\": [\n { \"slug\": \"components\", \"title\": \"Components\" },\n { \"slug\": \"headers-and-text\", \"title\": \"Headers and Text\" },\n { \"slug\": \"lists-and-tables\", \"title\": \"Lists and tables\" },\n { \"slug\": \"code\", \"title\": \"Code\" },\n { \"slug\": \"accordion\", \"title\": \"Accordion\" },\n { \"slug\": \"tabs\", \"title\": \"Tabs\" },\n { \"slug\": \"cards\", \"title\": \"Cards\" },\n { \"slug\": \"buttons\", \"title\": \"Buttons\" },\n { \"slug\": \"callouts\", \"title\": \"Callouts\" },\n { \"slug\": \"image-and-embeds\", \"title\": \"Images and embeds\" },\n { \"slug\": \"icons\", \"title\": \"Icons\" },\n { \"slug\": \"fields\", \"title\": \"Fields\" },\n { \"slug\": \"update\", \"title\": \"Update\" },\n { \"slug\": \"columns\", \"title\": \"Columns\" },\n { \"slug\": \"steps\", \"title\": \"Steps\" },\n { \"slug\": \"color-swatches\", \"title\": \"Color Swatches\" },\n { \"slug\": \"mermaid\", \"title\": \"Mermaid\" }\n ]\n },\n {\n \"label\": \"Configuration\",\n \"links\": [\n { \"slug\": \"globals\", \"title\": \"Globals\" },\n { \"slug\": \"navigation\", \"title\": \"Navigation\" },\n { \"slug\": \"sections\", \"title\": \"Sections\" },\n { \"slug\": \"footer-links\", \"title\": \"Footer Links\" },\n { \"slug\": \"theme\", \"title\": \"Theme\" },\n { \"slug\": \"media-and-assets\", \"title\": \"Media and assets\" },\n { \"slug\": \"fonts\", \"title\": \"Fonts\" },\n { \"slug\": \"ai-assistant\", \"title\": \"AI Assistant\" },\n { \"slug\": \"model-context-protocol\", \"title\": \"Model Context Protocol\" },\n { \"slug\": \"analytics\", \"title\": \"Analytics\" },\n { \"slug\": \"deployment-and-hosting\", \"title\": \"Deployment & Hosting\" },\n { \"slug\": \"authentication\", \"title\": \"Authentication\" }\n ]\n }\n]\n```\n\n### Object format (per-section)\n\nWhen using [sections](/sections), you can define navigation for each section by using an object keyed by section slug. Sections without a key fall back to auto-generated navigation from frontmatter.\n\n```json\n{\n \"\": [\n {\n \"label\": \"General\",\n \"links\": [\n { \"slug\": \"\", \"title\": \"Getting Started\" },\n { \"slug\": \"commands\", \"title\": \"Commands\" }\n ]\n }\n ],\n \"platform\": [\n {\n \"label\": \"Overview\",\n \"links\": [\n { \"slug\": \"platform/auth\", \"title\": \"Authentication\" },\n { \"slug\": \"platform/users\", \"title\": \"Users\" }\n ]\n }\n ]\n}\n```\n\nThe key `\"\"` controls the root section. Other keys match section slugs defined in `sections.json` or derived from frontmatter. See [Sections](/sections) for details on configuring sections.\n\n### Fields\n\n- **label**: The section header shown in the sidebar.\n- **icon**: Optional [Lucide](https://lucide.dev/icons) icon name shown next to the category header.\n- **links**: An array of page entries for that section.\n - **slug**: The MDX file slug (filename without extension). Use an empty string `\"\"` for `index.mdx`.\n - **title**: The display title in the navigation. This can differ from the page's `title` frontmatter.\n - **icon**: Optional Lucide icon name shown next to the link.\n - **links**: Optional array of nested child links. See [Nested navigation](#nested-navigation).\n\n## Icons\n\nAdd icons to categories and links to make the sidebar easier to scan. Icons use [Lucide](https://lucide.dev/icons) names in kebab-case (e.g. `rocket`, `book-open`, `settings`). Unknown names render nothing, so a typo never breaks the build.\n\nWith frontmatter, set `navIcon` on a page for its sidebar link and `categoryIcon` for its category:\n\n```text\n---\ntitle: \"Introduction\"\ncategory: \"Getting Started\"\ncategoryOrder: 1\norder: 1\nnavIcon: \"rocket\"\ncategoryIcon: \"book-open\"\n---\n```\n\nWith `navigation.json`, add an `icon` to any category or link:\n\n```json\n[\n {\n \"label\": \"Getting Started\",\n \"icon\": \"book-open\",\n \"links\": [\n { \"slug\": \"\", \"title\": \"Introduction\", \"icon\": \"rocket\" },\n { \"slug\": \"commands\", \"title\": \"Commands\", \"icon\": \"terminal\" }\n ]\n }\n]\n```\n\n## Nested navigation\n\nA link in `navigation.json` can hold its own `links` array to create a collapsible group. Groups expand and collapse on click and open automatically when one of their pages is active. Nesting can go as deep as you need.\n\n```json\n[\n {\n \"label\": \"Guides\",\n \"icon\": \"book-open\",\n \"links\": [\n { \"slug\": \"guides\", \"title\": \"Overview\", \"icon\": \"compass\" },\n {\n \"title\": \"Advanced\",\n \"icon\": \"settings\",\n \"links\": [\n { \"slug\": \"guides/caching\", \"title\": \"Caching\" },\n { \"slug\": \"guides/streaming\", \"title\": \"Streaming\" }\n ]\n }\n ]\n }\n]\n```\n\nA group can be a plain label - omit `slug` and it acts only as a collapsible header - or a real page, by adding a `slug` so the group title is also a link.\n\n<Callout type=\"note\">\n Nested groups are only available through `navigation.json`. Frontmatter navigation is always two levels: category and pages.\n</Callout>\n\n## Precedence and behavior\n\n<Callout type=\"note\">\n `navigation.json` takes priority over frontmatter. If present, it fully controls the sidebar structure for the sections it covers.\n</Callout>\n\n- Without `navigation.json`, the sidebar is built from page frontmatter: `category` -> grouped; `categoryOrder` -> category position; `order` -> page position.\n- When using the object format, sections not listed in `navigation.json` fall back to frontmatter-based navigation.\n- Pages without a `category` appear at the top level.\n\n## Tips\n\n- **Start simple**: Use frontmatter for small docs. Switch to `navigation.json` as the structure grows.\n- **Keep slugs consistent**: `slug` must match the MDX filename (e.g., `text.mdx` -> `text`).\n- **Control titles**: Use `title` in `navigation.json` to customize sidebar labels without changing page frontmatter.\n- **Per-section navigation**: Use the object format to define different sidebars for each section. Mix and match - define some sections explicitly and let others auto-generate.";
|
|
1
|
+
export declare const navigationMdxTemplate = "---\ntitle: \"Navigation\"\ndescription: \"Organize and structure your navigation.\"\ndate: \"2026-02-19\"\ncategory: \"Configuration\"\ncategoryOrder: 3\norder: 2\n---\n# Navigation\n\nDoccupine builds your sidebar automatically from your MDX pages. By default, it reads the page frontmatter and groups pages into categories in the order you define. For larger docs, you can take full control with a `navigation.json` file.\n\n## Automatic navigation (default)\n\nWhen no custom navigation is provided, Doccupine generates a structure based on each page's frontmatter.\n\n### Frontmatter fields\n\n- **category**: The category name that groups the page in the sidebar.\n- **categoryOrder**: The position of the category within the sidebar. Lower numbers appear first.\n- **order**: The position of the page within its category. Lower numbers appear first.\n- **navIcon**: Optional [Lucide](https://lucide.dev/icons) icon name shown next to the page's sidebar link.\n- **categoryIcon**: Optional Lucide icon name for the page's category header. The first page in a category that sets it wins.\n\n### Example frontmatter\n\n```text\n---\ntitle: \"Navigation\"\ndescription: \"Organize and structure your navigation.\"\ndate: \"2025-01-15\"\ncategory: \"Configuration\"\ncategoryOrder: 3\norder: 2\n---\n```\n\nThis approach is great for small sets of documents. For larger projects, setting these fields on every page can become repetitive.\n\n## Custom navigation with navigation.json\n\nTo centrally define the entire sidebar, create a `navigation.json` at your project root (the same directory where you execute `npx doccupine`). When present, it takes priority over page frontmatter and fully controls the navigation structure.\n\n### Array format\n\nThe simplest format is an array of categories. When using [sections](/sections), this applies to the root section only.\n\n```json\n[\n {\n \"label\": \"Getting Started\",\n \"links\": [\n { \"slug\": \"\", \"title\": \"Introduction\" },\n { \"slug\": \"commands\", \"title\": \"Commands\" },\n { \"slug\": \"what-is-doccupine\", \"title\": \"What is Doccupine\" }\n ]\n },\n {\n \"label\": \"Components\",\n \"links\": [\n { \"slug\": \"components\", \"title\": \"Components\" },\n { \"slug\": \"headers-and-text\", \"title\": \"Headers and Text\" },\n { \"slug\": \"lists-and-tables\", \"title\": \"Lists and tables\" },\n { \"slug\": \"code\", \"title\": \"Code\" },\n { \"slug\": \"accordion\", \"title\": \"Accordion\" },\n { \"slug\": \"tabs\", \"title\": \"Tabs\" },\n { \"slug\": \"cards\", \"title\": \"Cards\" },\n { \"slug\": \"buttons\", \"title\": \"Buttons\" },\n { \"slug\": \"callouts\", \"title\": \"Callouts\" },\n { \"slug\": \"image-and-embeds\", \"title\": \"Images and embeds\" },\n { \"slug\": \"icons\", \"title\": \"Icons\" },\n { \"slug\": \"fields\", \"title\": \"Fields\" },\n { \"slug\": \"update\", \"title\": \"Update\" },\n { \"slug\": \"columns\", \"title\": \"Columns\" },\n { \"slug\": \"steps\", \"title\": \"Steps\" },\n { \"slug\": \"color-swatches\", \"title\": \"Color Swatches\" },\n { \"slug\": \"mermaid\", \"title\": \"Mermaid\" },\n { \"slug\": \"frames\", \"title\": \"Frames\" }\n ]\n },\n {\n \"label\": \"Configuration\",\n \"links\": [\n { \"slug\": \"globals\", \"title\": \"Globals\" },\n { \"slug\": \"navigation\", \"title\": \"Navigation\" },\n { \"slug\": \"sections\", \"title\": \"Sections\" },\n { \"slug\": \"footer-links\", \"title\": \"Footer Links\" },\n { \"slug\": \"theme\", \"title\": \"Theme\" },\n { \"slug\": \"media-and-assets\", \"title\": \"Media and assets\" },\n { \"slug\": \"fonts\", \"title\": \"Fonts\" },\n { \"slug\": \"ai-assistant\", \"title\": \"AI Assistant\" },\n { \"slug\": \"model-context-protocol\", \"title\": \"Model Context Protocol\" },\n { \"slug\": \"analytics\", \"title\": \"Analytics\" },\n { \"slug\": \"deployment-and-hosting\", \"title\": \"Deployment & Hosting\" },\n { \"slug\": \"authentication\", \"title\": \"Authentication\" }\n ]\n }\n]\n```\n\n### Object format (per-section)\n\nWhen using [sections](/sections), you can define navigation for each section by using an object keyed by section slug. Sections without a key fall back to auto-generated navigation from frontmatter.\n\n```json\n{\n \"\": [\n {\n \"label\": \"General\",\n \"links\": [\n { \"slug\": \"\", \"title\": \"Getting Started\" },\n { \"slug\": \"commands\", \"title\": \"Commands\" }\n ]\n }\n ],\n \"platform\": [\n {\n \"label\": \"Overview\",\n \"links\": [\n { \"slug\": \"platform/auth\", \"title\": \"Authentication\" },\n { \"slug\": \"platform/users\", \"title\": \"Users\" }\n ]\n }\n ]\n}\n```\n\nThe key `\"\"` controls the root section. Other keys match section slugs defined in `sections.json` or derived from frontmatter. See [Sections](/sections) for details on configuring sections.\n\n### Fields\n\n- **label**: The section header shown in the sidebar.\n- **icon**: Optional [Lucide](https://lucide.dev/icons) icon name shown next to the category header.\n- **links**: An array of page entries for that section.\n - **slug**: The MDX file slug (filename without extension). Use an empty string `\"\"` for `index.mdx`.\n - **title**: The display title in the navigation. This can differ from the page's `title` frontmatter.\n - **icon**: Optional Lucide icon name shown next to the link.\n - **links**: Optional array of nested child links. See [Nested navigation](#nested-navigation).\n\n## Icons\n\nAdd icons to categories and links to make the sidebar easier to scan. Icons use [Lucide](https://lucide.dev/icons) names in kebab-case (e.g. `rocket`, `book-open`, `settings`). Unknown names render nothing, so a typo never breaks the build.\n\nWith frontmatter, set `navIcon` on a page for its sidebar link and `categoryIcon` for its category:\n\n```text\n---\ntitle: \"Introduction\"\ncategory: \"Getting Started\"\ncategoryOrder: 1\norder: 1\nnavIcon: \"rocket\"\ncategoryIcon: \"book-open\"\n---\n```\n\nWith `navigation.json`, add an `icon` to any category or link:\n\n```json\n[\n {\n \"label\": \"Getting Started\",\n \"icon\": \"book-open\",\n \"links\": [\n { \"slug\": \"\", \"title\": \"Introduction\", \"icon\": \"rocket\" },\n { \"slug\": \"commands\", \"title\": \"Commands\", \"icon\": \"terminal\" }\n ]\n }\n]\n```\n\n## Nested navigation\n\nA link in `navigation.json` can hold its own `links` array to create a collapsible group. Groups expand and collapse on click and open automatically when one of their pages is active. Nesting can go as deep as you need.\n\n```json\n[\n {\n \"label\": \"Guides\",\n \"icon\": \"book-open\",\n \"links\": [\n { \"slug\": \"guides\", \"title\": \"Overview\", \"icon\": \"compass\" },\n {\n \"title\": \"Advanced\",\n \"icon\": \"settings\",\n \"links\": [\n { \"slug\": \"guides/caching\", \"title\": \"Caching\" },\n { \"slug\": \"guides/streaming\", \"title\": \"Streaming\" }\n ]\n }\n ]\n }\n]\n```\n\nA group can be a plain label - omit `slug` and it acts only as a collapsible header - or a real page, by adding a `slug` so the group title is also a link.\n\n<Callout type=\"note\">\n Nested groups are only available through `navigation.json`. Frontmatter navigation is always two levels: category and pages.\n</Callout>\n\n## Precedence and behavior\n\n<Callout type=\"note\">\n `navigation.json` takes priority over frontmatter. If present, it fully controls the sidebar structure for the sections it covers.\n</Callout>\n\n- Without `navigation.json`, the sidebar is built from page frontmatter: `category` -> grouped; `categoryOrder` -> category position; `order` -> page position.\n- When using the object format, sections not listed in `navigation.json` fall back to frontmatter-based navigation.\n- Pages without a `category` appear at the top level.\n\n## Tips\n\n- **Start simple**: Use frontmatter for small docs. Switch to `navigation.json` as the structure grows.\n- **Keep slugs consistent**: `slug` must match the MDX filename (e.g., `text.mdx` -> `text`).\n- **Control titles**: Use `title` in `navigation.json` to customize sidebar labels without changing page frontmatter.\n- **Per-section navigation**: Use the object format to define different sidebars for each section. Mix and match - define some sections explicitly and let others auto-generate.";
|
|
@@ -74,7 +74,8 @@ The simplest format is an array of categories. When using [sections](/sections),
|
|
|
74
74
|
{ "slug": "columns", "title": "Columns" },
|
|
75
75
|
{ "slug": "steps", "title": "Steps" },
|
|
76
76
|
{ "slug": "color-swatches", "title": "Color Swatches" },
|
|
77
|
-
{ "slug": "mermaid", "title": "Mermaid" }
|
|
77
|
+
{ "slug": "mermaid", "title": "Mermaid" },
|
|
78
|
+
{ "slug": "frames", "title": "Frames" }
|
|
78
79
|
]
|
|
79
80
|
},
|
|
80
81
|
{
|
|
@@ -22,12 +22,12 @@ export const packageJsonTemplate = JSON.stringify({
|
|
|
22
22
|
langchain: "^1.5.3",
|
|
23
23
|
"lucide-react": "^1.25.0",
|
|
24
24
|
minisearch: "^7.2.0",
|
|
25
|
-
next: "16.2.
|
|
25
|
+
next: "16.2.11",
|
|
26
26
|
"next-mdx-remote": "^6.0.0",
|
|
27
|
-
"posthog-js": "^1.
|
|
27
|
+
"posthog-js": "^1.406.2",
|
|
28
28
|
"posthog-node": "^5.46.0",
|
|
29
|
-
react: "19.2.
|
|
30
|
-
"react-dom": "19.2.
|
|
29
|
+
react: "19.2.8",
|
|
30
|
+
"react-dom": "19.2.8",
|
|
31
31
|
"rehype-highlight": "^7.0.2",
|
|
32
32
|
"rehype-parse": "^9.0.1",
|
|
33
33
|
"rehype-stringify": "^10.0.1",
|
|
@@ -37,8 +37,8 @@ export const packageJsonTemplate = JSON.stringify({
|
|
|
37
37
|
zod: "^4.4.3",
|
|
38
38
|
},
|
|
39
39
|
devDependencies: {
|
|
40
|
-
"@next/env": "16.2.
|
|
41
|
-
"@next/eslint-plugin-next": "16.2.
|
|
40
|
+
"@next/env": "16.2.11",
|
|
41
|
+
"@next/eslint-plugin-next": "16.2.11",
|
|
42
42
|
"@types/node": "^26",
|
|
43
43
|
"@types/react": "^19",
|
|
44
44
|
"@types/react-dom": "^19",
|
package/dist/templates/proxy.js
CHANGED
|
@@ -121,7 +121,8 @@ function resolveTrackingIdentity(req: NextRequest): TrackingIdentity {
|
|
|
121
121
|
if (phCookie) {
|
|
122
122
|
try {
|
|
123
123
|
const parsed = JSON.parse(phCookie);
|
|
124
|
-
if (typeof parsed.distinct_id === "string")
|
|
124
|
+
if (typeof parsed.distinct_id === "string")
|
|
125
|
+
distinctId = parsed.distinct_id;
|
|
125
126
|
// Note we deliberately do NOT read \`$sesid\` — see resolveSession above.
|
|
126
127
|
if (typeof parsed.$device_id === "string") deviceId = parsed.$device_id;
|
|
127
128
|
} catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doccupine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.132",
|
|
4
4
|
"description": "Free and open-source documentation platform. Write MDX, get a production-ready site with AI chat, built-in components, and an MCP server - in one command.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"commander": "^15.0.0",
|
|
40
40
|
"fs-extra": "^11.3.6",
|
|
41
41
|
"gray-matter": "^4.0.3",
|
|
42
|
-
"next": "^16.2.
|
|
42
|
+
"next": "^16.2.11",
|
|
43
43
|
"prompts": "^2.4.2",
|
|
44
|
-
"react": "^19.2.
|
|
45
|
-
"react-dom": "^19.2.
|
|
44
|
+
"react": "^19.2.8",
|
|
45
|
+
"react-dom": "^19.2.8"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/fs-extra": "^11.0.4",
|