doccupine 0.0.151 → 0.0.152

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.
@@ -90,13 +90,28 @@ function fontDeclLine(fontConfig) {
90
90
  // and seeding the cookie so Cherry's ClientThemeProvider reconciles against
91
91
  // the same answer on mount instead of flipping the class back.
92
92
  //
93
- // The theme-color meta is deliberately NOT touched here. It is served by the
94
- // static viewport export below and corrected after hydration by Cherry's
95
- // $themeColor sync, mirroring the Doccupine platform site. A pre-paint edit
96
- // is the one thing that must never happen: React 19 hydration treats a head
97
- // meta whose attributes differ from its props as missing and inserts a
98
- // duplicate with the stale value beside it.
99
- const THEME_INIT_SCRIPT = `(function(){try{var c=document.cookie.split(";").map(function(s){return s.trim();}).find(function(s){return s.indexOf("theme=")===0;});var v=c?c.split("=")[1]:null;var d=v?v==="dark":(window.matchMedia&&window.matchMedia("(prefers-color-scheme:dark)").matches);if(!v){document.cookie="theme="+(d?"dark":"light")+";path=/;max-age=31536000;SameSite=Lax";}var r=document.documentElement;r.dataset.theme=d?"dark":"light";if(d){r.classList.add("dark");}}catch(e){}})();`;
93
+ // The script also emits the theme-color meta for the resolved mode through
94
+ // document.write, which hands the tag to the HTML parser itself: Safari only
95
+ // tints its chrome reliably from a parser-inserted tag - one created through
96
+ // the DOM APIs is honored inconsistently or not at all - though it does track
97
+ // content updates to such a tag, which is how Cherry's post-hydration sync
98
+ // and theme toggles keep it current. The meta cannot be rendered from the
99
+ // layout instead: pages are static, so the server would emit one mode's color
100
+ // and this script would have to correct it before paint, and React 19
101
+ // hydration treats a head meta whose attributes differ from its props as
102
+ // missing and inserts a duplicate with the stale light color beside it -
103
+ // suppressHydrationWarning does not cover hoisted metas, and a meta emitted
104
+ // through Next's viewport export hydrates the same way (both verified against
105
+ // Next 16.3; the duplicate is what broke the chrome tint on iPad Safari).
106
+ // OS-scheme-scoped SSR metas are no answer either: the site's mode is
107
+ // cookie-based, so a dark site on a light-OS device would show the wrong
108
+ // browser chrome until hydration - a visible flash on every load. Keeping the
109
+ // tag out of React leaves exactly one meta that nothing ever re-inserts. The
110
+ // \${...} palette interpolations below are escaped so they resolve in the
111
+ // generated layout, at app build time, from the imported theme palettes. The
112
+ // token must match the provider's $themeColor (primary), so the pre-paint
113
+ // chrome color equals what Cherry syncs after hydration.
114
+ const THEME_INIT_SCRIPT = `(function(){try{var c=document.cookie.split(";").map(function(s){return s.trim();}).find(function(s){return s.indexOf("theme=")===0;});var v=c?c.split("=")[1]:null;var d=v?v==="dark":(window.matchMedia&&window.matchMedia("(prefers-color-scheme:dark)").matches);if(!v){document.cookie="theme="+(d?"dark":"light")+";path=/;max-age=31536000;SameSite=Lax";}var r=document.documentElement;r.dataset.theme=d?"dark":"light";if(d){r.classList.add("dark");}document.write('<meta name="theme-color" content="'+(d?"\${colorsDark.primary}":"\${colorsLight.primary}")+'">');}catch(e){}})();`;
100
115
  /**
101
116
  * Root layout ("app/layout.tsx"). Minimal shell: html/body, fonts, the theme
102
117
  * provider stack, and (optionally) PostHog. It renders `children` directly so
@@ -107,10 +122,10 @@ const THEME_INIT_SCRIPT = `(function(){try{var c=document.cookie.split(";").map(
107
122
  * rewrites locked page requests to "/gate".
108
123
  */
109
124
  export const rootLayoutTemplate = (fontConfig, analyticsEnabled = false) => {
110
- return `import type { Metadata, Viewport } from "next";
125
+ return `import type { Metadata } from "next";
111
126
  ${fontImportLine(fontConfig)}
112
127
  import { StyledComponentsRegistry } from "cherry-styled-components";
113
- import { colorsLight, theme, themeDark } from "@/app/theme";
128
+ import { colorsDark, colorsLight, theme, themeDark } from "@/app/theme";
114
129
  import { CherryThemeProvider } from "@/components/layout/CherryThemeProvider";
115
130
  import { config } from "@/utils/config";
116
131
  import { siteIcons } from "@/utils/icons";
@@ -127,17 +142,6 @@ function resolveSiteUrl(): URL | undefined {
127
142
  }
128
143
  }
129
144
 
130
- // A single unscoped tag, server-rendered in the first bytes of head - the
131
- // same channel the Doccupine platform site uses. Pages are static, so the
132
- // server cannot know the cookie-based mode and renders the light \`primary\`;
133
- // Cherry's provider ($themeColor="primary") corrects the tag's content after
134
- // hydration, exactly as it does on the platform. The pre-paint script never
135
- // touches it: a pre-paint edit makes React 19 hydration insert a duplicate
136
- // with the stale value beside it.
137
- export const viewport: Viewport = {
138
- themeColor: colorsLight.primary,
139
- };
140
-
141
145
  export const metadata: Metadata = {
142
146
  metadataBase: resolveSiteUrl(),
143
147
  title: config.name || "${DEFAULT_SITE_NAME}",
@@ -1 +1 @@
1
- export declare const cherryThemeProviderTemplate = "\"use client\";\nimport React, { useEffect, useRef } from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { ClientThemeProvider } from \"cherry-styled-components\";\nimport { Theme } from \"@/app/theme\";\nimport { GlobalStyles } from \"@/components/layout/GlobalStyles\";\n\n/**\n * Mirrors the active mode onto the data-theme attribute that every themed\n * selector keys off (see GlobalStyles).\n *\n * The attribute is already correct before the first paint - the blocking script\n * in the root layout sets it from the theme cookie - but the provider's first\n * client render still carries the light theme the server rendered, so the\n * active theme cannot be trusted until the provider has reconciled it against\n * the cookie. The mirror therefore reads the cookie, not the theme object:\n * the blocking script seeds it pre-paint and Cherry persists it synchronously\n * before any re-render on toggles and reconciliation, so writing it is\n * idempotent. Counting effect passes instead (a \"skip the first run\" ref)\n * breaks under StrictMode's dev double-invocation: the second pass writes the\n * unreconciled light theme and the whole page flashes white on dark loads.\n * The theme object is only a fallback for browsers that block cookies, where\n * the first (unreconciled) pass must still be skipped.\n *\n * This effect must stay a child of ClientThemeProvider: child effects run\n * first, so the attribute is already correct before any provider-level\n * effect reads the document's computed styles.\n */\nfunction ThemeModeAttribute() {\n const activeTheme = useTheme() as Theme;\n const settled = useRef(false);\n\n useEffect(() => {\n const mode = /(?:^|;\\s*)theme=(dark|light)(?:;|$)/.exec(document.cookie);\n if (mode) {\n document.documentElement.dataset.theme = mode[1];\n } else if (settled.current) {\n document.documentElement.dataset.theme = activeTheme.isDark\n ? \"dark\"\n : \"light\";\n } else {\n settled.current = true;\n }\n }, [activeTheme.isDark]);\n\n return null;\n}\n\n/**\n * Wraps Cherry's ClientThemeProvider, which swaps theme/themeDark on toggle and\n * persists the choice to the `theme` cookie + localStorage. Deliberately reads\n * NO request data (cookies/headers) so pages stay statically renderable.\n *\n * The two theme objects hold the same CSS-variable colors and differ only in\n * `isDark`, so the visible mode is decided entirely by the data-theme\n * attribute on <html>, which ThemeModeAttribute keeps in step. The provider\n * also maintains a \"dark\" class of its own; nothing here depends on it, because\n * it is briefly out of step on mount while the provider reconciles the\n * server-rendered light theme against the cookie.\n *\n * $globalStyles is off because this app ships its own GlobalStyles.\n * $themeColor=\"primary\" hands the post-hydration theme-color sync to Cherry,\n * exactly as the Doccupine platform site does: since 0.2.15 the provider\n * resolves var() color references through computed styles, so the `primary`\n * token yields each mode's brand hex for the active data-theme. The layout's\n * static viewport export serves the light `primary`; Cherry corrects it once\n * hydrated and keeps it in step with theme toggles.\n */\nfunction CherryThemeProvider({\n children,\n theme,\n themeDark,\n}: {\n children: React.ReactNode;\n theme: Theme;\n themeDark: Theme;\n}) {\n return (\n <ClientThemeProvider\n theme={theme}\n themeDark={themeDark}\n $globalStyles={false}\n $themeColor=\"primary\"\n >\n <GlobalStyles />\n <ThemeModeAttribute />\n {children}\n </ClientThemeProvider>\n );\n}\n\nexport { CherryThemeProvider };\n";
1
+ export declare const cherryThemeProviderTemplate = "\"use client\";\nimport React, { useEffect, useRef } from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { ClientThemeProvider } from \"cherry-styled-components\";\nimport { Theme } from \"@/app/theme\";\nimport { GlobalStyles } from \"@/components/layout/GlobalStyles\";\n\n/**\n * Mirrors the active mode onto the data-theme attribute that every themed\n * selector keys off (see GlobalStyles).\n *\n * The attribute is already correct before the first paint - the blocking script\n * in the root layout sets it from the theme cookie - but the provider's first\n * client render still carries the light theme the server rendered, so the\n * active theme cannot be trusted until the provider has reconciled it against\n * the cookie. The mirror therefore reads the cookie, not the theme object:\n * the blocking script seeds it pre-paint and Cherry persists it synchronously\n * before any re-render on toggles and reconciliation, so writing it is\n * idempotent. Counting effect passes instead (a \"skip the first run\" ref)\n * breaks under StrictMode's dev double-invocation: the second pass writes the\n * unreconciled light theme and the whole page flashes white on dark loads.\n * The theme object is only a fallback for browsers that block cookies, where\n * the first (unreconciled) pass must still be skipped.\n *\n * This effect must stay a child of ClientThemeProvider: child effects run\n * first, so the attribute is updated before the provider's own theme-color\n * sync resolves var(--color-primary) against the document's computed styles.\n */\nfunction ThemeModeAttribute() {\n const activeTheme = useTheme() as Theme;\n const settled = useRef(false);\n\n useEffect(() => {\n const mode = /(?:^|;\\s*)theme=(dark|light)(?:;|$)/.exec(document.cookie);\n if (mode) {\n document.documentElement.dataset.theme = mode[1];\n } else if (settled.current) {\n document.documentElement.dataset.theme = activeTheme.isDark\n ? \"dark\"\n : \"light\";\n } else {\n settled.current = true;\n }\n }, [activeTheme.isDark]);\n\n return null;\n}\n\n/**\n * Wraps Cherry's ClientThemeProvider, which swaps theme/themeDark on toggle and\n * persists the choice to the `theme` cookie + localStorage. Deliberately reads\n * NO request data (cookies/headers) so pages stay statically renderable.\n *\n * The two theme objects hold the same CSS-variable colors and differ only in\n * `isDark`, so the visible mode is decided entirely by the data-theme\n * attribute on <html>, which ThemeModeAttribute keeps in step. The provider\n * also maintains a \"dark\" class of its own; nothing here depends on it, because\n * it is briefly out of step on mount while the provider reconciles the\n * server-rendered light theme against the cookie.\n *\n * $globalStyles is off because this app ships its own GlobalStyles.\n * $themeColor=\"primary\" hands the post-hydration theme-color sync to Cherry\n * with the branded chrome Cherry's own site uses: since 0.2.15 the provider\n * resolves var() color references through computed styles, so the `primary`\n * token yields each mode's brand hex for the active data-theme. The blocking\n * script in the root layout writes the same token's value before first\n * paint; the provider takes over from there, so the two must stay on the\n * same token.\n */\nfunction CherryThemeProvider({\n children,\n theme,\n themeDark,\n}: {\n children: React.ReactNode;\n theme: Theme;\n themeDark: Theme;\n}) {\n return (\n <ClientThemeProvider\n theme={theme}\n themeDark={themeDark}\n $globalStyles={false}\n $themeColor=\"primary\"\n >\n <GlobalStyles />\n <ThemeModeAttribute />\n {children}\n </ClientThemeProvider>\n );\n}\n\nexport { CherryThemeProvider };\n";
@@ -23,8 +23,8 @@ import { GlobalStyles } from "@/components/layout/GlobalStyles";
23
23
  * the first (unreconciled) pass must still be skipped.
24
24
  *
25
25
  * This effect must stay a child of ClientThemeProvider: child effects run
26
- * first, so the attribute is already correct before any provider-level
27
- * effect reads the document's computed styles.
26
+ * first, so the attribute is updated before the provider's own theme-color
27
+ * sync resolves var(--color-primary) against the document's computed styles.
28
28
  */
29
29
  function ThemeModeAttribute() {
30
30
  const activeTheme = useTheme() as Theme;
@@ -59,12 +59,13 @@ function ThemeModeAttribute() {
59
59
  * server-rendered light theme against the cookie.
60
60
  *
61
61
  * $globalStyles is off because this app ships its own GlobalStyles.
62
- * $themeColor="primary" hands the post-hydration theme-color sync to Cherry,
63
- * exactly as the Doccupine platform site does: since 0.2.15 the provider
62
+ * $themeColor="primary" hands the post-hydration theme-color sync to Cherry
63
+ * with the branded chrome Cherry's own site uses: since 0.2.15 the provider
64
64
  * resolves var() color references through computed styles, so the \`primary\`
65
- * token yields each mode's brand hex for the active data-theme. The layout's
66
- * static viewport export serves the light \`primary\`; Cherry corrects it once
67
- * hydrated and keeps it in step with theme toggles.
65
+ * token yields each mode's brand hex for the active data-theme. The blocking
66
+ * script in the root layout writes the same token's value before first
67
+ * paint; the provider takes over from there, so the two must stay on the
68
+ * same token.
68
69
  */
69
70
  function CherryThemeProvider({
70
71
  children,
@@ -1 +1 @@
1
- export declare const themeMdxTemplate = "---\ntitle: \"Theme\"\ndescription: \"Customize the documentation UI colors with a theme.json file.\"\ndate: \"2026-02-19\"\nupdated: \"2026-08-04\"\ncategory: \"Configuration\"\ncategoryOrder: 2\norder: 5\n---\n# Theme\n\nDefine your site\u2019s color system with a `theme.json` file. This lets you tailor the look and feel of your documentation without changing content.\n\n## theme.json\n\nPlace a `theme.json` at your project root (the same directory where you execute `npx doccupine`). It supports multiple modes. Define a `default` mode and a `dark` mode.\n\n```json\n{\n \"default\": {\n \"primaryLight\": \"#93c5fd\",\n \"primary\": \"#2563eb\",\n \"primaryDark\": \"#1e40af\",\n \"secondaryLight\": \"#c4b5fd\",\n \"secondary\": \"#8b5cf6\",\n \"secondaryDark\": \"#5b21b6\",\n \"tertiaryLight\": \"#fbbf24\",\n \"tertiary\": \"#f59e0b\",\n \"tertiaryDark\": \"#d97706\",\n \"grayLight\": \"#f3f4f6\",\n \"gray\": \"#9ca3af\",\n \"grayDark\": \"#374151\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#000000\",\n \"light\": \"#ffffff\"\n },\n \"dark\": {\n \"primaryLight\": \"#9bcaff\",\n \"primary\": \"#1e7ae0\",\n \"primaryDark\": \"#033d7e\",\n \"secondaryLight\": \"#ddd6fe\",\n \"secondary\": \"#a78bfa\",\n \"secondaryDark\": \"#7c3aed\",\n \"tertiaryLight\": \"#fed7aa\",\n \"tertiary\": \"#fb923c\",\n \"tertiaryDark\": \"#ea580c\",\n \"grayLight\": \"#1f2937\",\n \"gray\": \"#6b7280\",\n \"grayDark\": \"#9ca3af\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#ffffff\",\n \"light\": \"#000000\"\n },\n \"logo\": {\n \"dark\": \"https://docs.doccupine.com/logo-dark.svg\",\n \"light\": \"https://docs.doccupine.com/logo-light.svg\"\n }\n}\n```\n\n## Modes\n\n- **default**: The base color palette for your site.\n- **dark**: Dark\u2011mode palette.\n\n## Fields\n\n- **primaryLight**: A lighter variant of your brand color, used for subtle accents and backgrounds.\n- **primary**: The main brand color.\n- **primaryDark**: A darker variant of your brand color for emphasis and hover states.\n- **secondaryLight**: A lighter variant of your secondary color, used for subtle accents and backgrounds.\n- **secondary**: The secondary brand color used for highlights and UI accents.\n- **secondaryDark**: A darker variant of your secondary color for emphasis and hover states.\n- **tertiaryLight**: A lighter variant of your tertiary color, used for subtle accents and backgrounds.\n- **tertiary**: The tertiary accent color.\n- **tertiaryDark**: A darker variant of your tertiary color for emphasis and hover states.\n- **grayLight**: Light gray for surfaces and borders.\n- **gray**: Neutral gray for text and UI elements.\n- **grayDark**: Dark gray for headings or high\u2011contrast text.\n- **success**: Positive/confirmation color.\n- **error**: Error/destructive color.\n- **warning**: Warning/attention color.\n- **info**: Informational/highlight color.\n- **dark**: The darkest/base color (often page background in dark mode).\n- **light**: The lightest/base color (often page background in light mode).\n- **logo.light**: Path or URL to the logo used on light backgrounds. Recommended size: 164\u00D730 px.\n- **logo.dark**: Path or URL to the logo used on dark backgrounds. Recommended size: 164\u00D730 px.\n\n## Behavior\n\n- **Placement**: Put `theme.json` in the project root alongside `config.json`.\n- **Partial palettes**: If a key is missing in a mode, consumers may fall back to the `default` value.\n- **Logo size**: Recommended dimensions are 164px width and 30px height.\n- **Browser chrome**: The `theme-color` shown in browser UI (such as the iOS Safari status bar) carries your brand color: pages serve the light mode's `primary`, and once the page loads the active mode's `primary` takes over and follows the theme toggle. If your two modes define very different `primary` values, dark-mode visitors may notice the shade settle shortly after the page appears.\n\n<Callout type=\"warning\">\n Use valid hex colors (e.g., `#22c55e`). Invalid color values may cause unexpected rendering.\n</Callout>\n\n## Tips\n\n- **Contrast**: Ensure sufficient contrast between text and backgrounds for readability.\n- **Branding**: Start with your brand\u2019s `primary` color, then derive `primaryLight` and `primaryDark`.\n- **Iterate**: Adjust colors and refresh the site to preview changes quickly.\n\n# Demo\n\nIn the following demos, you can see how the theme can be changed. To override the theme, create a `theme.json` file in the project root and copy paste the code below.\n\n<DemoTheme variant=\"purple\" />\n<DemoTheme variant=\"green\" />\n<DemoTheme variant=\"yellow\" />\n<DemoTheme />\n\n## Purple\n\n```json\n{\n \"default\": {\n \"primaryLight\": \"#c4b5fd\",\n \"primary\": \"#8b5cf6\",\n \"primaryDark\": \"#5b21b6\",\n \"secondaryLight\": \"#86efac\",\n \"secondary\": \"#22c55e\",\n \"secondaryDark\": \"#15803d\",\n \"tertiaryLight\": \"#fbbf24\",\n \"tertiary\": \"#f59e0b\",\n \"tertiaryDark\": \"#d97706\",\n \"grayLight\": \"#f3f4f6\",\n \"gray\": \"#9ca3af\",\n \"grayDark\": \"#374151\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#000000\",\n \"light\": \"#ffffff\"\n },\n \"dark\": {\n \"primaryLight\": \"#ddd6fe\",\n \"primary\": \"#a78bfa\",\n \"primaryDark\": \"#7c3aed\",\n \"secondaryLight\": \"#6ee7b7\",\n \"secondary\": \"#10b981\",\n \"secondaryDark\": \"#065f46\",\n \"tertiaryLight\": \"#fed7aa\",\n \"tertiary\": \"#fb923c\",\n \"tertiaryDark\": \"#ea580c\",\n \"grayLight\": \"#1f2937\",\n \"gray\": \"#6b7280\",\n \"grayDark\": \"#9ca3af\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#ffffff\",\n \"light\": \"#000000\"\n }\n}\n```\n\n<DemoTheme variant=\"purple\" />\n\n## Green\n\n```json\n{\n \"default\": {\n \"primaryLight\": \"#86efac\",\n \"primary\": \"#22c55e\",\n \"primaryDark\": \"#15803d\",\n \"secondaryLight\": \"#c4b5fd\",\n \"secondary\": \"#8b5cf6\",\n \"secondaryDark\": \"#5b21b6\",\n \"tertiaryLight\": \"#fbbf24\",\n \"tertiary\": \"#f59e0b\",\n \"tertiaryDark\": \"#d97706\",\n \"grayLight\": \"#f3f4f6\",\n \"gray\": \"#9ca3af\",\n \"grayDark\": \"#374151\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#000000\",\n \"light\": \"#ffffff\"\n },\n \"dark\": {\n \"primaryLight\": \"#6ee7b7\",\n \"primary\": \"#10b981\",\n \"primaryDark\": \"#065f46\",\n \"secondaryLight\": \"#ddd6fe\",\n \"secondary\": \"#a78bfa\",\n \"secondaryDark\": \"#7c3aed\",\n \"tertiaryLight\": \"#fed7aa\",\n \"tertiary\": \"#fb923c\",\n \"tertiaryDark\": \"#ea580c\",\n \"grayLight\": \"#1f2937\",\n \"gray\": \"#6b7280\",\n \"grayDark\": \"#9ca3af\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#ffffff\",\n \"light\": \"#000000\"\n }\n}\n```\n\n<DemoTheme variant=\"green\" />\n\n## Yellow\n\n```json\n{\n \"default\": {\n \"primaryLight\": \"#fbbf24\",\n \"primary\": \"#f59e0b\",\n \"primaryDark\": \"#d97706\",\n \"secondaryLight\": \"#c4b5fd\",\n \"secondary\": \"#8b5cf6\",\n \"secondaryDark\": \"#5b21b6\",\n \"tertiaryLight\": \"#86efac\",\n \"tertiary\": \"#22c55e\",\n \"tertiaryDark\": \"#15803d\",\n \"grayLight\": \"#f3f4f6\",\n \"gray\": \"#9ca3af\",\n \"grayDark\": \"#374151\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#000000\",\n \"light\": \"#ffffff\"\n },\n \"dark\": {\n \"primaryLight\": \"#fed7aa\",\n \"primary\": \"#fb923c\",\n \"primaryDark\": \"#ea580c\",\n \"secondaryLight\": \"#ddd6fe\",\n \"secondary\": \"#a78bfa\",\n \"secondaryDark\": \"#7c3aed\",\n \"tertiaryLight\": \"#6ee7b7\",\n \"tertiary\": \"#10b981\",\n \"tertiaryDark\": \"#065f46\",\n \"grayLight\": \"#1f2937\",\n \"gray\": \"#6b7280\",\n \"grayDark\": \"#9ca3af\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#ffffff\",\n \"light\": \"#000000\"\n }\n}\n```\n\n<DemoTheme variant=\"yellow\" />";
1
+ export declare const themeMdxTemplate = "---\ntitle: \"Theme\"\ndescription: \"Customize the documentation UI colors with a theme.json file.\"\ndate: \"2026-02-19\"\nupdated: \"2026-08-04\"\ncategory: \"Configuration\"\ncategoryOrder: 2\norder: 5\n---\n# Theme\n\nDefine your site\u2019s color system with a `theme.json` file. This lets you tailor the look and feel of your documentation without changing content.\n\n## theme.json\n\nPlace a `theme.json` at your project root (the same directory where you execute `npx doccupine`). It supports multiple modes. Define a `default` mode and a `dark` mode.\n\n```json\n{\n \"default\": {\n \"primaryLight\": \"#93c5fd\",\n \"primary\": \"#2563eb\",\n \"primaryDark\": \"#1e40af\",\n \"secondaryLight\": \"#c4b5fd\",\n \"secondary\": \"#8b5cf6\",\n \"secondaryDark\": \"#5b21b6\",\n \"tertiaryLight\": \"#fbbf24\",\n \"tertiary\": \"#f59e0b\",\n \"tertiaryDark\": \"#d97706\",\n \"grayLight\": \"#f3f4f6\",\n \"gray\": \"#9ca3af\",\n \"grayDark\": \"#374151\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#000000\",\n \"light\": \"#ffffff\"\n },\n \"dark\": {\n \"primaryLight\": \"#9bcaff\",\n \"primary\": \"#1e7ae0\",\n \"primaryDark\": \"#033d7e\",\n \"secondaryLight\": \"#ddd6fe\",\n \"secondary\": \"#a78bfa\",\n \"secondaryDark\": \"#7c3aed\",\n \"tertiaryLight\": \"#fed7aa\",\n \"tertiary\": \"#fb923c\",\n \"tertiaryDark\": \"#ea580c\",\n \"grayLight\": \"#1f2937\",\n \"gray\": \"#6b7280\",\n \"grayDark\": \"#9ca3af\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#ffffff\",\n \"light\": \"#000000\"\n },\n \"logo\": {\n \"dark\": \"https://docs.doccupine.com/logo-dark.svg\",\n \"light\": \"https://docs.doccupine.com/logo-light.svg\"\n }\n}\n```\n\n## Modes\n\n- **default**: The base color palette for your site.\n- **dark**: Dark\u2011mode palette.\n\n## Fields\n\n- **primaryLight**: A lighter variant of your brand color, used for subtle accents and backgrounds.\n- **primary**: The main brand color.\n- **primaryDark**: A darker variant of your brand color for emphasis and hover states.\n- **secondaryLight**: A lighter variant of your secondary color, used for subtle accents and backgrounds.\n- **secondary**: The secondary brand color used for highlights and UI accents.\n- **secondaryDark**: A darker variant of your secondary color for emphasis and hover states.\n- **tertiaryLight**: A lighter variant of your tertiary color, used for subtle accents and backgrounds.\n- **tertiary**: The tertiary accent color.\n- **tertiaryDark**: A darker variant of your tertiary color for emphasis and hover states.\n- **grayLight**: Light gray for surfaces and borders.\n- **gray**: Neutral gray for text and UI elements.\n- **grayDark**: Dark gray for headings or high\u2011contrast text.\n- **success**: Positive/confirmation color.\n- **error**: Error/destructive color.\n- **warning**: Warning/attention color.\n- **info**: Informational/highlight color.\n- **dark**: The darkest/base color (often page background in dark mode).\n- **light**: The lightest/base color (often page background in light mode).\n- **logo.light**: Path or URL to the logo used on light backgrounds. Recommended size: 164\u00D730 px.\n- **logo.dark**: Path or URL to the logo used on dark backgrounds. Recommended size: 164\u00D730 px.\n\n## Behavior\n\n- **Placement**: Put `theme.json` in the project root alongside `config.json`.\n- **Partial palettes**: If a key is missing in a mode, consumers may fall back to the `default` value.\n- **Logo size**: Recommended dimensions are 164px width and 30px height.\n- **Browser chrome**: The `theme-color` shown in browser UI (such as the iOS Safari status bar) is derived from each mode's `primary` token, so it carries your brand color in both modes.\n\n<Callout type=\"warning\">\n Use valid hex colors (e.g., `#22c55e`). Invalid color values may cause unexpected rendering.\n</Callout>\n\n## Tips\n\n- **Contrast**: Ensure sufficient contrast between text and backgrounds for readability.\n- **Branding**: Start with your brand\u2019s `primary` color, then derive `primaryLight` and `primaryDark`.\n- **Iterate**: Adjust colors and refresh the site to preview changes quickly.\n\n# Demo\n\nIn the following demos, you can see how the theme can be changed. To override the theme, create a `theme.json` file in the project root and copy paste the code below.\n\n<DemoTheme variant=\"purple\" />\n<DemoTheme variant=\"green\" />\n<DemoTheme variant=\"yellow\" />\n<DemoTheme />\n\n## Purple\n\n```json\n{\n \"default\": {\n \"primaryLight\": \"#c4b5fd\",\n \"primary\": \"#8b5cf6\",\n \"primaryDark\": \"#5b21b6\",\n \"secondaryLight\": \"#86efac\",\n \"secondary\": \"#22c55e\",\n \"secondaryDark\": \"#15803d\",\n \"tertiaryLight\": \"#fbbf24\",\n \"tertiary\": \"#f59e0b\",\n \"tertiaryDark\": \"#d97706\",\n \"grayLight\": \"#f3f4f6\",\n \"gray\": \"#9ca3af\",\n \"grayDark\": \"#374151\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#000000\",\n \"light\": \"#ffffff\"\n },\n \"dark\": {\n \"primaryLight\": \"#ddd6fe\",\n \"primary\": \"#a78bfa\",\n \"primaryDark\": \"#7c3aed\",\n \"secondaryLight\": \"#6ee7b7\",\n \"secondary\": \"#10b981\",\n \"secondaryDark\": \"#065f46\",\n \"tertiaryLight\": \"#fed7aa\",\n \"tertiary\": \"#fb923c\",\n \"tertiaryDark\": \"#ea580c\",\n \"grayLight\": \"#1f2937\",\n \"gray\": \"#6b7280\",\n \"grayDark\": \"#9ca3af\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#ffffff\",\n \"light\": \"#000000\"\n }\n}\n```\n\n<DemoTheme variant=\"purple\" />\n\n## Green\n\n```json\n{\n \"default\": {\n \"primaryLight\": \"#86efac\",\n \"primary\": \"#22c55e\",\n \"primaryDark\": \"#15803d\",\n \"secondaryLight\": \"#c4b5fd\",\n \"secondary\": \"#8b5cf6\",\n \"secondaryDark\": \"#5b21b6\",\n \"tertiaryLight\": \"#fbbf24\",\n \"tertiary\": \"#f59e0b\",\n \"tertiaryDark\": \"#d97706\",\n \"grayLight\": \"#f3f4f6\",\n \"gray\": \"#9ca3af\",\n \"grayDark\": \"#374151\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#000000\",\n \"light\": \"#ffffff\"\n },\n \"dark\": {\n \"primaryLight\": \"#6ee7b7\",\n \"primary\": \"#10b981\",\n \"primaryDark\": \"#065f46\",\n \"secondaryLight\": \"#ddd6fe\",\n \"secondary\": \"#a78bfa\",\n \"secondaryDark\": \"#7c3aed\",\n \"tertiaryLight\": \"#fed7aa\",\n \"tertiary\": \"#fb923c\",\n \"tertiaryDark\": \"#ea580c\",\n \"grayLight\": \"#1f2937\",\n \"gray\": \"#6b7280\",\n \"grayDark\": \"#9ca3af\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#ffffff\",\n \"light\": \"#000000\"\n }\n}\n```\n\n<DemoTheme variant=\"green\" />\n\n## Yellow\n\n```json\n{\n \"default\": {\n \"primaryLight\": \"#fbbf24\",\n \"primary\": \"#f59e0b\",\n \"primaryDark\": \"#d97706\",\n \"secondaryLight\": \"#c4b5fd\",\n \"secondary\": \"#8b5cf6\",\n \"secondaryDark\": \"#5b21b6\",\n \"tertiaryLight\": \"#86efac\",\n \"tertiary\": \"#22c55e\",\n \"tertiaryDark\": \"#15803d\",\n \"grayLight\": \"#f3f4f6\",\n \"gray\": \"#9ca3af\",\n \"grayDark\": \"#374151\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#000000\",\n \"light\": \"#ffffff\"\n },\n \"dark\": {\n \"primaryLight\": \"#fed7aa\",\n \"primary\": \"#fb923c\",\n \"primaryDark\": \"#ea580c\",\n \"secondaryLight\": \"#ddd6fe\",\n \"secondary\": \"#a78bfa\",\n \"secondaryDark\": \"#7c3aed\",\n \"tertiaryLight\": \"#6ee7b7\",\n \"tertiary\": \"#10b981\",\n \"tertiaryDark\": \"#065f46\",\n \"grayLight\": \"#1f2937\",\n \"gray\": \"#6b7280\",\n \"grayDark\": \"#9ca3af\",\n \"success\": \"#10b981\",\n \"error\": \"#f43f5e\",\n \"warning\": \"#f59e0b\",\n \"info\": \"#3b82f6\",\n \"dark\": \"#ffffff\",\n \"light\": \"#000000\"\n }\n}\n```\n\n<DemoTheme variant=\"yellow\" />";
@@ -97,7 +97,7 @@ Place a \`theme.json\` at your project root (the same directory where you execut
97
97
  - **Placement**: Put \`theme.json\` in the project root alongside \`config.json\`.
98
98
  - **Partial palettes**: If a key is missing in a mode, consumers may fall back to the \`default\` value.
99
99
  - **Logo size**: Recommended dimensions are 164px width and 30px height.
100
- - **Browser chrome**: The \`theme-color\` shown in browser UI (such as the iOS Safari status bar) carries your brand color: pages serve the light mode's \`primary\`, and once the page loads the active mode's \`primary\` takes over and follows the theme toggle. If your two modes define very different \`primary\` values, dark-mode visitors may notice the shade settle shortly after the page appears.
100
+ - **Browser chrome**: The \`theme-color\` shown in browser UI (such as the iOS Safari status bar) is derived from each mode's \`primary\` token, so it carries your brand color in both modes.
101
101
 
102
102
  <Callout type="warning">
103
103
  Use valid hex colors (e.g., \`#22c55e\`). Invalid color values may cause unexpected rendering.
@@ -53,7 +53,7 @@ export const packageJsonTemplate = JSON.stringify({
53
53
  "eslint-plugin-react-hooks": "^7.1.1",
54
54
  globals: "^17.9.0",
55
55
  prettier: "^3.9.6",
56
- tsx: "^4.23.5",
56
+ tsx: "^4.23.6",
57
57
  typescript: "npm:@typescript/typescript6@^6.0.2",
58
58
  },
59
59
  }, null, 2) + "\n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doccupine",
3
- "version": "0.0.151",
3
+ "version": "0.0.152",
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": {