doccupine 0.0.157 → 0.0.159

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.
Files changed (153) hide show
  1. package/README.md +52 -2
  2. package/dist/generator/app-scaffolder.js +11 -3
  3. package/dist/generator/generated-page-publisher.d.ts +6 -6
  4. package/dist/generator/generated-page-publisher.js +7 -5
  5. package/dist/generator/icon-registry-generator.d.ts +8 -5
  6. package/dist/generator/icon-registry-generator.js +19 -11
  7. package/dist/generator/mdx-pass-builder.d.ts +4 -4
  8. package/dist/generator/mdx-pass-builder.js +8 -1
  9. package/dist/generator/mdx-reconciliation-coordinator.d.ts +23 -9
  10. package/dist/generator/mdx-reconciliation-coordinator.js +63 -9
  11. package/dist/generator/page-catalog.d.ts +2 -4
  12. package/dist/generator/page-catalog.js +7 -2
  13. package/dist/generator/page-renderer.d.ts +15 -5
  14. package/dist/generator/page-renderer.js +38 -11
  15. package/dist/generator/project-config-repository.d.ts +4 -1
  16. package/dist/generator/project-config-repository.js +26 -0
  17. package/dist/generator/public-asset-manager.d.ts +10 -0
  18. package/dist/generator/public-asset-manager.js +63 -3
  19. package/dist/generator/section-index-generator.d.ts +10 -1
  20. package/dist/generator/section-index-generator.js +43 -15
  21. package/dist/generator/section-resolver.d.ts +8 -0
  22. package/dist/generator/site-artifacts.d.ts +4 -3
  23. package/dist/generator/site-artifacts.js +94 -9
  24. package/dist/generator/watch-coordinator.js +6 -1
  25. package/dist/lib/generated-artifacts.d.ts +3 -0
  26. package/dist/lib/generated-artifacts.js +36 -0
  27. package/dist/lib/icon-registry.d.ts +10 -4
  28. package/dist/lib/icon-registry.js +13 -4
  29. package/dist/lib/layout.d.ts +6 -3
  30. package/dist/lib/layout.js +107 -4
  31. package/dist/lib/metadata.d.ts +7 -0
  32. package/dist/lib/metadata.js +33 -10
  33. package/dist/lib/structures.js +20 -0
  34. package/dist/lib/types.d.ts +28 -0
  35. package/dist/lib/ui-strings.d.ts +44 -0
  36. package/dist/lib/ui-strings.js +48 -0
  37. package/dist/lib/variants.d.ts +91 -0
  38. package/dist/lib/variants.js +411 -0
  39. package/dist/mdx-to-nextjs-generator.d.ts +22 -5
  40. package/dist/mdx-to-nextjs-generator.js +92 -12
  41. package/dist/templates/app/api/mcp/route.d.ts +1 -1
  42. package/dist/templates/app/api/mcp/route.js +14 -1
  43. package/dist/templates/app/api/rag/route.d.ts +1 -1
  44. package/dist/templates/app/api/rag/route.js +13 -2
  45. package/dist/templates/app/api/search/route.d.ts +1 -1
  46. package/dist/templates/app/api/search/route.js +16 -1
  47. package/dist/templates/app/sitemap.d.ts +2 -0
  48. package/dist/templates/app/sitemap.js +48 -3
  49. package/dist/templates/components/Chat.d.ts +1 -1
  50. package/dist/templates/components/Chat.js +40 -12
  51. package/dist/templates/components/Docs.d.ts +1 -1
  52. package/dist/templates/components/Docs.js +5 -2
  53. package/dist/templates/components/DocsSideBar.d.ts +1 -1
  54. package/dist/templates/components/DocsSideBar.js +3 -1
  55. package/dist/templates/components/SearchDocs.d.ts +1 -1
  56. package/dist/templates/components/SearchDocs.js +17 -3
  57. package/dist/templates/components/SearchModalContent.d.ts +1 -1
  58. package/dist/templates/components/SearchModalContent.js +22 -14
  59. package/dist/templates/components/SectionNavProvider.d.ts +1 -1
  60. package/dist/templates/components/SectionNavProvider.js +32 -20
  61. package/dist/templates/components/SideBar.d.ts +1 -1
  62. package/dist/templates/components/SideBar.js +26 -12
  63. package/dist/templates/components/layout/ActionBar.d.ts +1 -1
  64. package/dist/templates/components/layout/ActionBar.js +9 -7
  65. package/dist/templates/components/layout/Code.d.ts +1 -1
  66. package/dist/templates/components/layout/Code.js +6 -3
  67. package/dist/templates/components/layout/DocsComponents.d.ts +1 -1
  68. package/dist/templates/components/layout/DocsComponents.js +38 -5
  69. package/dist/templates/components/layout/DocsNavigation.d.ts +1 -1
  70. package/dist/templates/components/layout/DocsNavigation.js +4 -2
  71. package/dist/templates/components/layout/Dropdown.d.ts +1 -0
  72. package/dist/templates/components/layout/Dropdown.js +308 -0
  73. package/dist/templates/components/layout/FocusModeToggle.d.ts +1 -1
  74. package/dist/templates/components/layout/FocusModeToggle.js +7 -4
  75. package/dist/templates/components/layout/Footer.d.ts +1 -1
  76. package/dist/templates/components/layout/Footer.js +4 -2
  77. package/dist/templates/components/layout/Header.d.ts +1 -1
  78. package/dist/templates/components/layout/Header.js +18 -8
  79. package/dist/templates/components/layout/SectionBar.d.ts +1 -1
  80. package/dist/templates/components/layout/SectionBar.js +16 -10
  81. package/dist/templates/components/layout/VariantSwitchers.d.ts +1 -0
  82. package/dist/templates/components/layout/VariantSwitchers.js +313 -0
  83. package/dist/templates/components/useStrings.d.ts +1 -0
  84. package/dist/templates/components/useStrings.js +10 -0
  85. package/dist/templates/components/useVariant.d.ts +1 -0
  86. package/dist/templates/components/useVariant.js +13 -0
  87. package/dist/templates/llms/llmsIndex.d.ts +13 -0
  88. package/dist/templates/llms/llmsIndex.js +18 -3
  89. package/dist/templates/mdx/ai-assistant.mdx.d.ts +1 -1
  90. package/dist/templates/mdx/ai-assistant.mdx.js +2 -0
  91. package/dist/templates/mdx/api-playground.mdx.d.ts +1 -1
  92. package/dist/templates/mdx/api-playground.mdx.js +2 -0
  93. package/dist/templates/mdx/commands.mdx.d.ts +1 -1
  94. package/dist/templates/mdx/commands.mdx.js +1 -1
  95. package/dist/templates/mdx/fonts.mdx.d.ts +1 -1
  96. package/dist/templates/mdx/fonts.mdx.js +1 -1
  97. package/dist/templates/mdx/footer-links.mdx.d.ts +1 -1
  98. package/dist/templates/mdx/footer-links.mdx.js +1 -1
  99. package/dist/templates/mdx/index.mdx.d.ts +1 -1
  100. package/dist/templates/mdx/index.mdx.js +2 -0
  101. package/dist/templates/mdx/languages.mdx.d.ts +1 -0
  102. package/dist/templates/mdx/languages.mdx.js +94 -0
  103. package/dist/templates/mdx/media-and-assets.mdx.d.ts +1 -1
  104. package/dist/templates/mdx/media-and-assets.mdx.js +1 -1
  105. package/dist/templates/mdx/model-context-protocol.mdx.d.ts +1 -1
  106. package/dist/templates/mdx/model-context-protocol.mdx.js +6 -0
  107. package/dist/templates/mdx/navigation.mdx.d.ts +1 -1
  108. package/dist/templates/mdx/navigation.mdx.js +2 -0
  109. package/dist/templates/mdx/platform/ai-assistant.mdx.d.ts +1 -1
  110. package/dist/templates/mdx/platform/ai-assistant.mdx.js +2 -0
  111. package/dist/templates/mdx/platform/api-playground.mdx.d.ts +1 -1
  112. package/dist/templates/mdx/platform/api-playground.mdx.js +2 -0
  113. package/dist/templates/mdx/platform/file-editor.mdx.d.ts +1 -1
  114. package/dist/templates/mdx/platform/file-editor.mdx.js +2 -0
  115. package/dist/templates/mdx/platform/index.mdx.d.ts +1 -1
  116. package/dist/templates/mdx/platform/index.mdx.js +1 -1
  117. package/dist/templates/mdx/platform/languages.mdx.d.ts +1 -0
  118. package/dist/templates/mdx/platform/languages.mdx.js +50 -0
  119. package/dist/templates/mdx/platform/mcp.mdx.d.ts +1 -1
  120. package/dist/templates/mdx/platform/mcp.mdx.js +2 -0
  121. package/dist/templates/mdx/platform/navigation-settings.mdx.d.ts +1 -1
  122. package/dist/templates/mdx/platform/navigation-settings.mdx.js +2 -0
  123. package/dist/templates/mdx/platform/publishing.mdx.d.ts +1 -1
  124. package/dist/templates/mdx/platform/publishing.mdx.js +4 -0
  125. package/dist/templates/mdx/platform/self-updating-docs.mdx.d.ts +1 -1
  126. package/dist/templates/mdx/platform/self-updating-docs.mdx.js +2 -0
  127. package/dist/templates/mdx/platform/versions.mdx.d.ts +1 -0
  128. package/dist/templates/mdx/platform/versions.mdx.js +33 -0
  129. package/dist/templates/mdx/sections.mdx.d.ts +1 -1
  130. package/dist/templates/mdx/sections.mdx.js +1 -1
  131. package/dist/templates/mdx/theme.mdx.d.ts +1 -1
  132. package/dist/templates/mdx/theme.mdx.js +1 -1
  133. package/dist/templates/mdx/versions.mdx.d.ts +1 -0
  134. package/dist/templates/mdx/versions.mdx.js +78 -0
  135. package/dist/templates/mdx/what-is-doccupine.mdx.d.ts +1 -1
  136. package/dist/templates/mdx/what-is-doccupine.mdx.js +1 -1
  137. package/dist/templates/prettierignore.d.ts +1 -1
  138. package/dist/templates/prettierignore.js +2 -0
  139. package/dist/templates/services/mcp/server.d.ts +1 -1
  140. package/dist/templates/services/mcp/server.js +54 -10
  141. package/dist/templates/services/mcp/tools.d.ts +1 -1
  142. package/dist/templates/services/mcp/tools.js +81 -6
  143. package/dist/templates/services/mcp/types.d.ts +1 -1
  144. package/dist/templates/services/mcp/types.js +10 -0
  145. package/dist/templates/services/search.d.ts +1 -1
  146. package/dist/templates/services/search.js +34 -4
  147. package/dist/templates/utils/orderNavItems.d.ts +1 -1
  148. package/dist/templates/utils/orderNavItems.js +2 -0
  149. package/dist/templates/utils/strings.d.ts +1 -0
  150. package/dist/templates/utils/strings.js +27 -0
  151. package/dist/templates/utils/variants.d.ts +1 -0
  152. package/dist/templates/utils/variants.js +170 -0
  153. package/package.json +1 -1
@@ -21,6 +21,8 @@ import {
21
21
  stylesLists,
22
22
  } from "@/components/layout/SharedStyled";
23
23
  import { Badge } from "@/components/layout/Badge";
24
+ import { useVariant } from "@/components/useVariant";
25
+ import { joinVariantSlug } from "@/utils/variants";
24
26
 
25
27
  const SectionBarContext = createContext(false);
26
28
 
@@ -202,7 +204,14 @@ export const StyledSidebar = styled.nav<Props>\`
202
204
  }
203
205
  \`;
204
206
 
207
+ // One row of 30px controls: the focus-mode toggle, the language and version
208
+ // switchers, then the theme toggle. The focus toggle is fixed rather than a
209
+ // child (it outlives the sidebar in focus mode), so on the rail the row's own
210
+ // padding leaves its 30px plus a gap free at the left.
205
211
  export const StyledSidebarFooter = styled.div\`
212
+ display: flex;
213
+ align-items: center;
214
+ gap: 8px;
206
215
  padding: 22px 20px;
207
216
  position: sticky;
208
217
  border-top: 1px solid \${({ theme }) => theme.colors.grayLight};
@@ -214,7 +223,25 @@ export const StyledSidebarFooter = styled.div\`
214
223
  bottom: -20px;
215
224
 
216
225
  \${mq("lg")} {
217
- padding: 16px 20px;
226
+ padding: 16px 20px 16px 58px;
227
+ }
228
+ \`;
229
+
230
+ // The theme toggle's slot takes whatever the switchers leave, so the toggle
231
+ // stays beside them in the mobile menu and holds the right end of the rail.
232
+ // A plain flex row rather than Cherry's Flex: the slot has to grow, which is a
233
+ // property of the child, and styled(Flex) would swallow Flex's own $-prefixed
234
+ // props on the way through.
235
+ export const StyledSidebarFooterToggle = styled.div\`
236
+ display: flex;
237
+ flex: 1;
238
+ justify-content: flex-start;
239
+
240
+ /* On the rail the switchers claim the free width when both are configured,
241
+ so the toggle keeps its own size and is pushed to the right end. */
242
+ \${mq("lg")} {
243
+ flex: 0 0 auto;
244
+ margin-left: auto;
218
245
  }
219
246
  \`;
220
247
 
@@ -596,11 +623,15 @@ const StyledLlmsDirective = styled.div\`
596
623
  \`;
597
624
 
598
625
  function LlmsDirective() {
626
+ // Every language and version has its own llms.txt under its URL prefix.
627
+ const { prefix } = useVariant();
628
+ const indexHref = "/" + joinVariantSlug(prefix, "llms.txt");
629
+ const fullHref = "/" + joinVariantSlug(prefix, "llms-full.txt");
599
630
  return (
600
631
  <StyledLlmsDirective data-markdown-ignore>
601
- <a href="/llms.txt">Documentation index for AI agents (llms.txt)</a>.
632
+ <a href={indexHref}>Documentation index for AI agents (llms.txt)</a>.
602
633
  Markdown versions of every page are available by appending .md to the page
603
- URL. The full corpus is at <a href="/llms-full.txt">/llms-full.txt</a>.
634
+ URL. The full corpus is at <a href={fullHref}>{fullHref}</a>.
604
635
  </StyledLlmsDirective>
605
636
  );
606
637
  }
@@ -617,11 +648,13 @@ function DocsSidebar({ children }: DocsProps) {
617
648
  return <StyledDocsSidebar>{children}</StyledDocsSidebar>;
618
649
  }
619
650
 
620
- function DocsContainer({ children }: DocsProps) {
651
+ function DocsContainer({ children, lang }: DocsProps & { lang?: string }) {
621
652
  const { isOpen } = useChat();
622
653
 
623
654
  return (
624
- <StyledDocsContainer $isChatOpen={isOpen}>{children}</StyledDocsContainer>
655
+ <StyledDocsContainer $isChatOpen={isOpen} lang={lang}>
656
+ {children}
657
+ </StyledDocsContainer>
625
658
  );
626
659
  }
627
660
 
@@ -1 +1 @@
1
- export declare const docsNavigationTemplate = "\"use client\";\nimport { usePathname } from \"next/navigation\";\nimport Link from \"next/link\";\nimport styled, { css } from \"styled-components\";\nimport { useChat } from \"cherry-styled-components\";\nimport { Icon } from \"@/components/layout/Icon\";\nimport { mq, Theme } from \"@/app/theme\";\nimport {\n focusModeColumn,\n interactiveStyles,\n sidePanelOffset,\n} from \"@/components/layout/SharedStyled\";\n\nconst StyledNavigationWrapper = styled.div<{\n $isChatOpen?: boolean;\n}>`\n transition: all 0.3s ease;\n padding: 0 20px 100px 20px;\n ${mq(\"lg\")} {\n padding: 0 300px 80px 300px;\n ${({ $isChatOpen }) =>\n $isChatOpen &&\n css`\n padding: 0 440px 80px 300px;\n `}\n }\n\n ${sidePanelOffset};\n ${({ $isChatOpen }) => !$isChatOpen && focusModeColumn};\n`;\n\nconst StyledNavigationInner = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 20px;\n max-width: 640px;\n margin: auto;\n`;\n\nconst StyledNavButton = styled(Link)<{ theme: Theme }>`\n ${interactiveStyles};\n display: flex;\n flex-direction: column;\n text-decoration: none;\n padding: 20px;\n flex: 50%;\n max-width: 50%;\n border-radius: ${({ theme }) => theme.spacing.radius.lg};\n border: solid 1px ${({ theme }) => theme.colors.grayLight};\n color: ${({ theme }) => theme.colors.dark};\n\n &:hover {\n border-color: ${({ theme }) => theme.colors.primary};\n }\n\n &[data-direction=\"prev\"] {\n align-items: flex-start;\n }\n\n &[data-direction=\"next\"] {\n align-items: flex-end;\n margin-left: auto;\n text-align: right;\n }\n`;\n\nconst StyledNavLabel = styled.span<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.grayDark};\n display: flex;\n flex-direction: row;\n gap: 4px;\n\n & svg {\n margin: auto 0;\n }\n`;\n\nconst StyledNavTitle = styled.span<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.dark};\n font-weight: 600;\n margin: 0 0 4px 0;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n max-width: 100%;\n`;\n\nconst StyledSpacer = styled.div`\n flex: 1;\n`;\n\ninterface Page {\n // Optional: nested group nodes may act as headers without their own page.\n // collectPages() only pushes nodes that actually have a slug.\n slug?: string;\n title: string;\n category?: string;\n links?: Page[];\n items?: Page[];\n [key: string]: unknown;\n}\n\ninterface NavigationItem {\n category?: string;\n slug?: string;\n title?: string;\n links?: Page[];\n items?: Page[];\n [key: string]: unknown;\n}\n\ninterface DocsNavigationProps {\n result: NavigationItem[];\n}\n\nfunction DocsNavigation({ result }: DocsNavigationProps) {\n const { isOpen } = useChat();\n const pathname = usePathname();\n // Walk categories and any nested link groups depth-first so prev/next spans\n // every real page (a node with a slug), in reading order.\n const collectPages = (nodes: unknown): Page[] => {\n if (!Array.isArray(nodes)) return [];\n const pages: Page[] = [];\n for (const node of nodes as Page[]) {\n if (node && node.slug !== undefined) {\n pages.push(node);\n }\n const children = node && ((node.links ?? node.items) as unknown);\n if (Array.isArray(children)) {\n pages.push(...collectPages(children));\n }\n }\n return pages;\n };\n const allPages: Page[] = result.flatMap((item) =>\n collectPages(\n item.links ??\n item.items ??\n (item.slug !== undefined ? [item as Page] : []),\n ),\n );\n const currentSlug = pathname.replace(/^\\//, \"\").replace(/\\/$/, \"\");\n const currentIndex = allPages.findIndex((page) => page.slug === currentSlug);\n const prevPage = currentIndex > 0 ? allPages[currentIndex - 1] : null;\n const nextPage =\n currentIndex < allPages.length - 1 ? allPages[currentIndex + 1] : null;\n if (currentIndex === -1 || allPages.length === 0) {\n return null;\n }\n if (!prevPage && !nextPage) {\n return null;\n }\n return (\n <StyledNavigationWrapper $isChatOpen={isOpen}>\n <StyledNavigationInner>\n {prevPage ? (\n <StyledNavButton href={`/${prevPage.slug}`} data-direction=\"prev\">\n <StyledNavTitle>{prevPage.title}</StyledNavTitle>\n <StyledNavLabel>\n <Icon name=\"arrow-left\" size={16} /> Previous\n </StyledNavLabel>\n </StyledNavButton>\n ) : (\n <StyledSpacer />\n )}\n {nextPage && (\n <StyledNavButton href={`/${nextPage.slug}`} data-direction=\"next\">\n <StyledNavTitle>{nextPage.title}</StyledNavTitle>\n <StyledNavLabel>\n Next <Icon name=\"arrow-right\" size={16} />\n </StyledNavLabel>\n </StyledNavButton>\n )}\n </StyledNavigationInner>\n </StyledNavigationWrapper>\n );\n}\n\nexport { DocsNavigation };\n";
1
+ export declare const docsNavigationTemplate = "\"use client\";\nimport { usePathname } from \"next/navigation\";\nimport { useStrings } from \"@/components/useStrings\";\nimport Link from \"next/link\";\nimport styled, { css } from \"styled-components\";\nimport { useChat } from \"cherry-styled-components\";\nimport { Icon } from \"@/components/layout/Icon\";\nimport { mq, Theme } from \"@/app/theme\";\nimport {\n focusModeColumn,\n interactiveStyles,\n sidePanelOffset,\n} from \"@/components/layout/SharedStyled\";\n\nconst StyledNavigationWrapper = styled.div<{\n $isChatOpen?: boolean;\n}>`\n transition: all 0.3s ease;\n padding: 0 20px 100px 20px;\n ${mq(\"lg\")} {\n padding: 0 300px 80px 300px;\n ${({ $isChatOpen }) =>\n $isChatOpen &&\n css`\n padding: 0 440px 80px 300px;\n `}\n }\n\n ${sidePanelOffset};\n ${({ $isChatOpen }) => !$isChatOpen && focusModeColumn};\n`;\n\nconst StyledNavigationInner = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 20px;\n max-width: 640px;\n margin: auto;\n`;\n\nconst StyledNavButton = styled(Link)<{ theme: Theme }>`\n ${interactiveStyles};\n display: flex;\n flex-direction: column;\n text-decoration: none;\n padding: 20px;\n flex: 50%;\n max-width: 50%;\n border-radius: ${({ theme }) => theme.spacing.radius.lg};\n border: solid 1px ${({ theme }) => theme.colors.grayLight};\n color: ${({ theme }) => theme.colors.dark};\n\n &:hover {\n border-color: ${({ theme }) => theme.colors.primary};\n }\n\n &[data-direction=\"prev\"] {\n align-items: flex-start;\n }\n\n &[data-direction=\"next\"] {\n align-items: flex-end;\n margin-left: auto;\n text-align: right;\n }\n`;\n\nconst StyledNavLabel = styled.span<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.grayDark};\n display: flex;\n flex-direction: row;\n gap: 4px;\n\n & svg {\n margin: auto 0;\n }\n`;\n\nconst StyledNavTitle = styled.span<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.dark};\n font-weight: 600;\n margin: 0 0 4px 0;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n max-width: 100%;\n`;\n\nconst StyledSpacer = styled.div`\n flex: 1;\n`;\n\ninterface Page {\n // Optional: nested group nodes may act as headers without their own page.\n // collectPages() only pushes nodes that actually have a slug.\n slug?: string;\n title: string;\n category?: string;\n links?: Page[];\n items?: Page[];\n [key: string]: unknown;\n}\n\ninterface NavigationItem {\n category?: string;\n slug?: string;\n title?: string;\n links?: Page[];\n items?: Page[];\n [key: string]: unknown;\n}\n\ninterface DocsNavigationProps {\n result: NavigationItem[];\n}\n\nfunction DocsNavigation({ result }: DocsNavigationProps) {\n const { isOpen } = useChat();\n const pathname = usePathname();\n const t = useStrings();\n // Walk categories and any nested link groups depth-first so prev/next spans\n // every real page (a node with a slug), in reading order.\n const collectPages = (nodes: unknown): Page[] => {\n if (!Array.isArray(nodes)) return [];\n const pages: Page[] = [];\n for (const node of nodes as Page[]) {\n if (node && node.slug !== undefined) {\n pages.push(node);\n }\n const children = node && ((node.links ?? node.items) as unknown);\n if (Array.isArray(children)) {\n pages.push(...collectPages(children));\n }\n }\n return pages;\n };\n const allPages: Page[] = result.flatMap((item) =>\n collectPages(\n item.links ??\n item.items ??\n (item.slug !== undefined ? [item as Page] : []),\n ),\n );\n const currentSlug = pathname.replace(/^\\//, \"\").replace(/\\/$/, \"\");\n const currentIndex = allPages.findIndex((page) => page.slug === currentSlug);\n const prevPage = currentIndex > 0 ? allPages[currentIndex - 1] : null;\n const nextPage =\n currentIndex < allPages.length - 1 ? allPages[currentIndex + 1] : null;\n if (currentIndex === -1 || allPages.length === 0) {\n return null;\n }\n if (!prevPage && !nextPage) {\n return null;\n }\n return (\n <StyledNavigationWrapper $isChatOpen={isOpen}>\n <StyledNavigationInner>\n {prevPage ? (\n <StyledNavButton href={`/${prevPage.slug}`} data-direction=\"prev\">\n <StyledNavTitle>{prevPage.title}</StyledNavTitle>\n <StyledNavLabel>\n <Icon name=\"arrow-left\" size={16} /> {t.previous}\n </StyledNavLabel>\n </StyledNavButton>\n ) : (\n <StyledSpacer />\n )}\n {nextPage && (\n <StyledNavButton href={`/${nextPage.slug}`} data-direction=\"next\">\n <StyledNavTitle>{nextPage.title}</StyledNavTitle>\n <StyledNavLabel>\n {t.next} <Icon name=\"arrow-right\" size={16} />\n </StyledNavLabel>\n </StyledNavButton>\n )}\n </StyledNavigationInner>\n </StyledNavigationWrapper>\n );\n}\n\nexport { DocsNavigation };\n";
@@ -1,6 +1,7 @@
1
1
  import { SIDEBAR_WIDTH, CHAT_WIDTH } from "../../app/theme.js";
2
2
  export const docsNavigationTemplate = `"use client";
3
3
  import { usePathname } from "next/navigation";
4
+ import { useStrings } from "@/components/useStrings";
4
5
  import Link from "next/link";
5
6
  import styled, { css } from "styled-components";
6
7
  import { useChat } from "cherry-styled-components";
@@ -118,6 +119,7 @@ interface DocsNavigationProps {
118
119
  function DocsNavigation({ result }: DocsNavigationProps) {
119
120
  const { isOpen } = useChat();
120
121
  const pathname = usePathname();
122
+ const t = useStrings();
121
123
  // Walk categories and any nested link groups depth-first so prev/next spans
122
124
  // every real page (a node with a slug), in reading order.
123
125
  const collectPages = (nodes: unknown): Page[] => {
@@ -159,7 +161,7 @@ function DocsNavigation({ result }: DocsNavigationProps) {
159
161
  <StyledNavButton href={\`/\${prevPage.slug}\`} data-direction="prev">
160
162
  <StyledNavTitle>{prevPage.title}</StyledNavTitle>
161
163
  <StyledNavLabel>
162
- <Icon name="arrow-left" size={16} /> Previous
164
+ <Icon name="arrow-left" size={16} /> {t.previous}
163
165
  </StyledNavLabel>
164
166
  </StyledNavButton>
165
167
  ) : (
@@ -169,7 +171,7 @@ function DocsNavigation({ result }: DocsNavigationProps) {
169
171
  <StyledNavButton href={\`/\${nextPage.slug}\`} data-direction="next">
170
172
  <StyledNavTitle>{nextPage.title}</StyledNavTitle>
171
173
  <StyledNavLabel>
172
- Next <Icon name="arrow-right" size={16} />
174
+ {t.next} <Icon name="arrow-right" size={16} />
173
175
  </StyledNavLabel>
174
176
  </StyledNavButton>
175
177
  )}
@@ -0,0 +1 @@
1
+ export declare const dropdownTemplate = "\"use client\";\nimport React, { useCallback, useEffect, useId, useRef, useState } from \"react\";\nimport styled, { css } from \"styled-components\";\nimport { interactiveStyles, useOnClickOutside } from \"cherry-styled-components\";\nimport { Theme } from \"@/app/theme\";\n\n// The Doccupine platform's Dropdown, ported for the generated site: a\n// bordered trigger that mirrors the search trigger, a menu that scales in and\n// out, and click-outside dismissal. Menus that hold a set of choices pass\n// role=\"menu\" and render DropdownItem entries; the menu then also handles\n// Escape (close, refocus the trigger), ArrowUp/ArrowDown (cycle the items),\n// and moves focus to the checked entry when it opens.\n\ninterface DropdownProps {\n trigger: React.ReactNode;\n children: React.ReactNode;\n align?: \"left\" | \"right\";\n /** Open below the trigger (default) or above it (sidebar footer). */\n placement?: \"bottom\" | \"top\";\n /** Stretch the trigger to its container's width. */\n fullWidth?: boolean;\n /** 30px pill trigger, for rows of icon buttons (the sidebar footer). */\n compact?: boolean;\n /** Accessible name of the menu, and of the trigger unless overridden. */\n label?: string;\n /** Accessible name of the trigger when its content does not say enough. */\n triggerLabel?: string;\n /** A menu of choices gets role=\"menu\" and keyboard handling. */\n role?: \"menu\";\n}\n\nconst DropdownContainer = styled.div<{ $fullWidth: boolean }>`\n position: relative;\n display: ${({ $fullWidth }) => ($fullWidth ? \"flex\" : \"inline-block\")};\n ${({ $fullWidth }) =>\n $fullWidth &&\n css`\n flex: 1;\n min-width: 0;\n `}\n`;\n\n// Mirrors the header's search trigger: the same bordered pill with Cherry's\n// interactiveStyles for hover, focus, and active, applied to the focusable\n// button itself so keyboard focus shows the rounded ring.\nconst DropdownTrigger = styled.button<{\n theme: Theme;\n $fullWidth: boolean;\n $compact: boolean;\n}>`\n ${interactiveStyles};\n display: flex;\n align-items: center;\n gap: 8px;\n width: ${({ $fullWidth }) => ($fullWidth ? \"100%\" : \"auto\")};\n min-width: 0;\n padding: 5px 10px;\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n border: 1px solid\n var(--border-color, ${({ theme }) => theme.colors.grayLight});\n background: transparent;\n color: inherit;\n font-family: inherit;\n cursor: pointer;\n\n /* Standing in a row of icon buttons: the same 30px pill, filled surface and\n border as the toggles beside it, so the whole row shares one rhythm. */\n ${({ $compact, theme }) =>\n $compact &&\n css`\n gap: 6px;\n height: 30px;\n min-height: 0;\n padding: 0 10px;\n border-radius: ${theme.spacing.radius.xl};\n background: ${theme.colors.light};\n `}\n`;\n\nconst DropdownMenu = styled.div<{\n theme: Theme;\n $align: \"left\" | \"right\";\n $placement: \"bottom\" | \"top\";\n $compact: boolean;\n $closing: boolean;\n}>`\n position: absolute;\n ${({ $placement }) =>\n $placement === \"top\"\n ? \"bottom: calc(100% + 8px);\"\n : \"top: calc(100% + 8px);\"}\n ${({ $align }) => ($align === \"right\" ? \"right: 0;\" : \"left: 0;\")}\n /* A compact trigger sits in a narrow rail, so its menu starts narrower too\n and still clears both edges of that rail whichever way it is aligned. */\n min-width: ${({ $compact }) => ($compact ? \"160px\" : \"200px\")};\n max-height: 280px;\n overflow-y: auto;\n background: ${({ theme }) => theme.colors.light};\n border: 1px solid ${({ theme }) => theme.colors.grayLight};\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n box-shadow: ${({ theme }) => theme.shadows.xs};\n z-index: 1000;\n transform-origin: ${({ $align, $placement }) =>\n `${$placement === \"top\" ? \"bottom\" : \"top\"} ${$align}`};\n animation: ${({ $closing }) => ($closing ? \"dropdownOut\" : \"dropdownIn\")}\n 0.15s ease forwards;\n\n @keyframes dropdownIn {\n from {\n opacity: 0;\n transform: scale(0.95) translateY(-4px);\n }\n to {\n opacity: 1;\n transform: scale(1) translateY(0);\n }\n }\n\n @keyframes dropdownOut {\n from {\n opacity: 1;\n transform: scale(1) translateY(0);\n }\n to {\n opacity: 0;\n transform: scale(0.95) translateY(-4px);\n }\n }\n`;\n\nconst DropdownDivider = styled.div<{ theme: Theme }>`\n height: 1px;\n background: ${({ theme }) => theme.colors.grayLight};\n margin: 0;\n`;\n\n// One entry of a menu: the platform's menu link, as a button. The checked\n// entry of a choice menu is tinted like a hovered one and keeps its weight.\nconst DropdownItem = styled.button<{ theme: Theme; $checked?: boolean }>`\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 10px;\n background: none;\n border: none;\n text-align: left;\n font-family: inherit;\n font-size: ${({ theme }) => theme.fontSizes.small.xs};\n color: ${({ theme }) => theme.colors.primary};\n font-weight: 600;\n text-decoration: none;\n white-space: nowrap;\n cursor: pointer;\n transition: all 0.3s ease;\n\n & svg {\n flex-shrink: 0;\n transition: color 0.3s;\n }\n\n /* A hairline between neighbours only: the first entry meets the menu's own\n border, and no entry draws a line on both edges. */\n & + & {\n border-top: 1px solid ${({ theme }) => theme.colors.grayLight};\n }\n\n &:hover {\n background: color-mix(\n in srgb,\n ${({ theme }) => theme.colors.primaryLight} 10%,\n transparent\n );\n color: ${({ theme }) =>\n theme.isDark ? theme.colors.primaryLight : theme.colors.primaryDark};\n }\n\n /* Inset so the menu's overflow does not clip it, square so the menu's own\n rounded corners shape it. */\n &:focus-visible {\n outline: none;\n box-shadow: inset 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};\n }\n\n ${({ $checked, theme }) =>\n $checked &&\n css`\n background: color-mix(\n in srgb,\n ${theme.colors.primaryLight} 10%,\n transparent\n );\n `}\n`;\n\nfunction Dropdown({\n trigger,\n children,\n align = \"right\",\n placement = \"bottom\",\n fullWidth = false,\n compact = false,\n label,\n triggerLabel,\n role,\n}: DropdownProps) {\n const [isOpen, setIsOpen] = useState(false);\n const [isVisible, setIsVisible] = useState(false);\n const [isClosing, setIsClosing] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const menuId = useId();\n\n const close = useCallback(() => {\n setIsClosing(true);\n }, []);\n\n const open = useCallback(() => {\n setIsVisible(true);\n setIsOpen(true);\n setIsClosing(false);\n }, []);\n\n const handleToggle = useCallback(() => {\n if (isOpen) {\n close();\n } else {\n open();\n }\n }, [isOpen, close, open]);\n\n const handleAnimationEnd = useCallback(() => {\n if (isClosing) {\n setIsOpen(false);\n setIsVisible(false);\n setIsClosing(false);\n }\n }, [isClosing]);\n\n useOnClickOutside([containerRef], isOpen && !isClosing ? close : () => {});\n\n // A choice menu lands focus on the checked entry (or the first one).\n useEffect(() => {\n if (!isOpen || isClosing || role !== \"menu\") return;\n const menu = menuRef.current;\n if (!menu) return;\n const checked = menu.querySelector<HTMLElement>('[aria-checked=\"true\"]');\n (checked ?? menu.querySelector<HTMLElement>(\"button, a\"))?.focus();\n }, [isOpen, isClosing, role]);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n close();\n triggerRef.current?.focus();\n return;\n }\n if (role !== \"menu\") return;\n if (event.key !== \"ArrowDown\" && event.key !== \"ArrowUp\") return;\n event.preventDefault();\n const items = Array.from(\n event.currentTarget.querySelectorAll<HTMLElement>(\"button, a\"),\n );\n if (items.length === 0) return;\n const step = event.key === \"ArrowDown\" ? 1 : -1;\n const index = items.indexOf(document.activeElement as HTMLElement);\n items[(index + step + items.length) % items.length]?.focus();\n };\n\n return (\n <DropdownContainer ref={containerRef} $fullWidth={fullWidth}>\n <DropdownTrigger\n ref={triggerRef}\n type=\"button\"\n $fullWidth={fullWidth}\n $compact={compact}\n aria-label={triggerLabel ?? label}\n aria-haspopup={role}\n aria-expanded={role ? isOpen && !isClosing : undefined}\n aria-controls={role ? menuId : undefined}\n onClick={handleToggle}\n >\n {trigger}\n </DropdownTrigger>\n {isVisible && (\n <DropdownMenu\n id={role ? menuId : undefined}\n ref={menuRef}\n role={role}\n aria-label={role ? label : undefined}\n $align={align}\n $placement={placement}\n $compact={compact}\n $closing={isClosing}\n onClick={close}\n onKeyDown={handleKeyDown}\n onAnimationEnd={handleAnimationEnd}\n >\n {children}\n </DropdownMenu>\n )}\n </DropdownContainer>\n );\n}\n\nexport { Dropdown, DropdownDivider, DropdownItem };\n";
@@ -0,0 +1,308 @@
1
+ export const dropdownTemplate = `"use client";
2
+ import React, { useCallback, useEffect, useId, useRef, useState } from "react";
3
+ import styled, { css } from "styled-components";
4
+ import { interactiveStyles, useOnClickOutside } from "cherry-styled-components";
5
+ import { Theme } from "@/app/theme";
6
+
7
+ // The Doccupine platform's Dropdown, ported for the generated site: a
8
+ // bordered trigger that mirrors the search trigger, a menu that scales in and
9
+ // out, and click-outside dismissal. Menus that hold a set of choices pass
10
+ // role="menu" and render DropdownItem entries; the menu then also handles
11
+ // Escape (close, refocus the trigger), ArrowUp/ArrowDown (cycle the items),
12
+ // and moves focus to the checked entry when it opens.
13
+
14
+ interface DropdownProps {
15
+ trigger: React.ReactNode;
16
+ children: React.ReactNode;
17
+ align?: "left" | "right";
18
+ /** Open below the trigger (default) or above it (sidebar footer). */
19
+ placement?: "bottom" | "top";
20
+ /** Stretch the trigger to its container's width. */
21
+ fullWidth?: boolean;
22
+ /** 30px pill trigger, for rows of icon buttons (the sidebar footer). */
23
+ compact?: boolean;
24
+ /** Accessible name of the menu, and of the trigger unless overridden. */
25
+ label?: string;
26
+ /** Accessible name of the trigger when its content does not say enough. */
27
+ triggerLabel?: string;
28
+ /** A menu of choices gets role="menu" and keyboard handling. */
29
+ role?: "menu";
30
+ }
31
+
32
+ const DropdownContainer = styled.div<{ $fullWidth: boolean }>\`
33
+ position: relative;
34
+ display: \${({ $fullWidth }) => ($fullWidth ? "flex" : "inline-block")};
35
+ \${({ $fullWidth }) =>
36
+ $fullWidth &&
37
+ css\`
38
+ flex: 1;
39
+ min-width: 0;
40
+ \`}
41
+ \`;
42
+
43
+ // Mirrors the header's search trigger: the same bordered pill with Cherry's
44
+ // interactiveStyles for hover, focus, and active, applied to the focusable
45
+ // button itself so keyboard focus shows the rounded ring.
46
+ const DropdownTrigger = styled.button<{
47
+ theme: Theme;
48
+ $fullWidth: boolean;
49
+ $compact: boolean;
50
+ }>\`
51
+ \${interactiveStyles};
52
+ display: flex;
53
+ align-items: center;
54
+ gap: 8px;
55
+ width: \${({ $fullWidth }) => ($fullWidth ? "100%" : "auto")};
56
+ min-width: 0;
57
+ padding: 5px 10px;
58
+ border-radius: \${({ theme }) => theme.spacing.radius.xs};
59
+ border: 1px solid
60
+ var(--border-color, \${({ theme }) => theme.colors.grayLight});
61
+ background: transparent;
62
+ color: inherit;
63
+ font-family: inherit;
64
+ cursor: pointer;
65
+
66
+ /* Standing in a row of icon buttons: the same 30px pill, filled surface and
67
+ border as the toggles beside it, so the whole row shares one rhythm. */
68
+ \${({ $compact, theme }) =>
69
+ $compact &&
70
+ css\`
71
+ gap: 6px;
72
+ height: 30px;
73
+ min-height: 0;
74
+ padding: 0 10px;
75
+ border-radius: \${theme.spacing.radius.xl};
76
+ background: \${theme.colors.light};
77
+ \`}
78
+ \`;
79
+
80
+ const DropdownMenu = styled.div<{
81
+ theme: Theme;
82
+ $align: "left" | "right";
83
+ $placement: "bottom" | "top";
84
+ $compact: boolean;
85
+ $closing: boolean;
86
+ }>\`
87
+ position: absolute;
88
+ \${({ $placement }) =>
89
+ $placement === "top"
90
+ ? "bottom: calc(100% + 8px);"
91
+ : "top: calc(100% + 8px);"}
92
+ \${({ $align }) => ($align === "right" ? "right: 0;" : "left: 0;")}
93
+ /* A compact trigger sits in a narrow rail, so its menu starts narrower too
94
+ and still clears both edges of that rail whichever way it is aligned. */
95
+ min-width: \${({ $compact }) => ($compact ? "160px" : "200px")};
96
+ max-height: 280px;
97
+ overflow-y: auto;
98
+ background: \${({ theme }) => theme.colors.light};
99
+ border: 1px solid \${({ theme }) => theme.colors.grayLight};
100
+ border-radius: \${({ theme }) => theme.spacing.radius.xs};
101
+ box-shadow: \${({ theme }) => theme.shadows.xs};
102
+ z-index: 1000;
103
+ transform-origin: \${({ $align, $placement }) =>
104
+ \`\${$placement === "top" ? "bottom" : "top"} \${$align}\`};
105
+ animation: \${({ $closing }) => ($closing ? "dropdownOut" : "dropdownIn")}
106
+ 0.15s ease forwards;
107
+
108
+ @keyframes dropdownIn {
109
+ from {
110
+ opacity: 0;
111
+ transform: scale(0.95) translateY(-4px);
112
+ }
113
+ to {
114
+ opacity: 1;
115
+ transform: scale(1) translateY(0);
116
+ }
117
+ }
118
+
119
+ @keyframes dropdownOut {
120
+ from {
121
+ opacity: 1;
122
+ transform: scale(1) translateY(0);
123
+ }
124
+ to {
125
+ opacity: 0;
126
+ transform: scale(0.95) translateY(-4px);
127
+ }
128
+ }
129
+ \`;
130
+
131
+ const DropdownDivider = styled.div<{ theme: Theme }>\`
132
+ height: 1px;
133
+ background: \${({ theme }) => theme.colors.grayLight};
134
+ margin: 0;
135
+ \`;
136
+
137
+ // One entry of a menu: the platform's menu link, as a button. The checked
138
+ // entry of a choice menu is tinted like a hovered one and keeps its weight.
139
+ const DropdownItem = styled.button<{ theme: Theme; $checked?: boolean }>\`
140
+ display: flex;
141
+ align-items: center;
142
+ gap: 8px;
143
+ width: 100%;
144
+ padding: 10px;
145
+ background: none;
146
+ border: none;
147
+ text-align: left;
148
+ font-family: inherit;
149
+ font-size: \${({ theme }) => theme.fontSizes.small.xs};
150
+ color: \${({ theme }) => theme.colors.primary};
151
+ font-weight: 600;
152
+ text-decoration: none;
153
+ white-space: nowrap;
154
+ cursor: pointer;
155
+ transition: all 0.3s ease;
156
+
157
+ & svg {
158
+ flex-shrink: 0;
159
+ transition: color 0.3s;
160
+ }
161
+
162
+ /* A hairline between neighbours only: the first entry meets the menu's own
163
+ border, and no entry draws a line on both edges. */
164
+ & + & {
165
+ border-top: 1px solid \${({ theme }) => theme.colors.grayLight};
166
+ }
167
+
168
+ &:hover {
169
+ background: color-mix(
170
+ in srgb,
171
+ \${({ theme }) => theme.colors.primaryLight} 10%,
172
+ transparent
173
+ );
174
+ color: \${({ theme }) =>
175
+ theme.isDark ? theme.colors.primaryLight : theme.colors.primaryDark};
176
+ }
177
+
178
+ /* Inset so the menu's overflow does not clip it, square so the menu's own
179
+ rounded corners shape it. */
180
+ &:focus-visible {
181
+ outline: none;
182
+ box-shadow: inset 0 0 0 2px \${({ theme }) => theme.colors.primaryLight};
183
+ }
184
+
185
+ \${({ $checked, theme }) =>
186
+ $checked &&
187
+ css\`
188
+ background: color-mix(
189
+ in srgb,
190
+ \${theme.colors.primaryLight} 10%,
191
+ transparent
192
+ );
193
+ \`}
194
+ \`;
195
+
196
+ function Dropdown({
197
+ trigger,
198
+ children,
199
+ align = "right",
200
+ placement = "bottom",
201
+ fullWidth = false,
202
+ compact = false,
203
+ label,
204
+ triggerLabel,
205
+ role,
206
+ }: DropdownProps) {
207
+ const [isOpen, setIsOpen] = useState(false);
208
+ const [isVisible, setIsVisible] = useState(false);
209
+ const [isClosing, setIsClosing] = useState(false);
210
+ const containerRef = useRef<HTMLDivElement>(null);
211
+ const triggerRef = useRef<HTMLButtonElement>(null);
212
+ const menuRef = useRef<HTMLDivElement>(null);
213
+ const menuId = useId();
214
+
215
+ const close = useCallback(() => {
216
+ setIsClosing(true);
217
+ }, []);
218
+
219
+ const open = useCallback(() => {
220
+ setIsVisible(true);
221
+ setIsOpen(true);
222
+ setIsClosing(false);
223
+ }, []);
224
+
225
+ const handleToggle = useCallback(() => {
226
+ if (isOpen) {
227
+ close();
228
+ } else {
229
+ open();
230
+ }
231
+ }, [isOpen, close, open]);
232
+
233
+ const handleAnimationEnd = useCallback(() => {
234
+ if (isClosing) {
235
+ setIsOpen(false);
236
+ setIsVisible(false);
237
+ setIsClosing(false);
238
+ }
239
+ }, [isClosing]);
240
+
241
+ useOnClickOutside([containerRef], isOpen && !isClosing ? close : () => {});
242
+
243
+ // A choice menu lands focus on the checked entry (or the first one).
244
+ useEffect(() => {
245
+ if (!isOpen || isClosing || role !== "menu") return;
246
+ const menu = menuRef.current;
247
+ if (!menu) return;
248
+ const checked = menu.querySelector<HTMLElement>('[aria-checked="true"]');
249
+ (checked ?? menu.querySelector<HTMLElement>("button, a"))?.focus();
250
+ }, [isOpen, isClosing, role]);
251
+
252
+ const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
253
+ if (event.key === "Escape") {
254
+ event.preventDefault();
255
+ close();
256
+ triggerRef.current?.focus();
257
+ return;
258
+ }
259
+ if (role !== "menu") return;
260
+ if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
261
+ event.preventDefault();
262
+ const items = Array.from(
263
+ event.currentTarget.querySelectorAll<HTMLElement>("button, a"),
264
+ );
265
+ if (items.length === 0) return;
266
+ const step = event.key === "ArrowDown" ? 1 : -1;
267
+ const index = items.indexOf(document.activeElement as HTMLElement);
268
+ items[(index + step + items.length) % items.length]?.focus();
269
+ };
270
+
271
+ return (
272
+ <DropdownContainer ref={containerRef} $fullWidth={fullWidth}>
273
+ <DropdownTrigger
274
+ ref={triggerRef}
275
+ type="button"
276
+ $fullWidth={fullWidth}
277
+ $compact={compact}
278
+ aria-label={triggerLabel ?? label}
279
+ aria-haspopup={role}
280
+ aria-expanded={role ? isOpen && !isClosing : undefined}
281
+ aria-controls={role ? menuId : undefined}
282
+ onClick={handleToggle}
283
+ >
284
+ {trigger}
285
+ </DropdownTrigger>
286
+ {isVisible && (
287
+ <DropdownMenu
288
+ id={role ? menuId : undefined}
289
+ ref={menuRef}
290
+ role={role}
291
+ aria-label={role ? label : undefined}
292
+ $align={align}
293
+ $placement={placement}
294
+ $compact={compact}
295
+ $closing={isClosing}
296
+ onClick={close}
297
+ onKeyDown={handleKeyDown}
298
+ onAnimationEnd={handleAnimationEnd}
299
+ >
300
+ {children}
301
+ </DropdownMenu>
302
+ )}
303
+ </DropdownContainer>
304
+ );
305
+ }
306
+
307
+ export { Dropdown, DropdownDivider, DropdownItem };
308
+ `;
@@ -1 +1 @@
1
- export declare const focusModeToggleTemplate = "\"use client\";\nimport { useEffect, useRef, useState } from \"react\";\nimport styled from \"styled-components\";\nimport { resetButton } from \"cherry-styled-components\";\nimport { Icon } from \"@/components/layout/Icon\";\nimport { mq, Theme } from \"@/app/theme\";\nimport { interactiveStyles } from \"@/components/layout/SharedStyled\";\n\n// Desktop-only affordance that collapses both rails for distraction-free\n// reading. The button is fixed rather than living in the sidebar footer next\n// to the ThemeToggle: the footer slides away with the sidebar, and the way\n// back out of focus mode has to stay on screen.\nconst StyledFocusToggle = styled.button<{ theme: Theme }>`\n display: none;\n\n ${mq(\"lg\")} {\n ${resetButton};\n ${interactiveStyles};\n display: flex;\n align-items: center;\n justify-content: center;\n position: fixed;\n /* Above the sidebar (99) so it stays clickable once the rails are out,\n below the chat panel (1000). */\n z-index: 100;\n /* Sidebar footer row, flush with the footer's left padding (the\n ThemeToggle holds the right end of the same row). */\n left: 20px;\n bottom: 16px;\n width: 30px;\n height: 30px;\n border-radius: 50%;\n background: ${({ theme }) => theme.colors.light};\n border-color: ${({ theme }) => theme.colors.grayLight};\n\n & svg {\n width: 16px;\n height: 16px;\n }\n\n & svg[stroke] {\n stroke: ${({ theme }) => theme.colors.primary};\n }\n\n &:hover svg[stroke] {\n stroke: ${({ theme }) => theme.colors.accent};\n }\n }\n`;\n\nfunction FocusModeToggle() {\n const [isFocusMode, setIsFocusMode] = useState(false);\n const buttonRef = useRef<HTMLButtonElement>(null);\n\n // Cmd/Ctrl+B, the editor convention for collapsing the side columns. Sits\n // alongside the app's other chords (Cmd+K search, Cmd+I chat,\n // Cmd+Shift+L theme) and stays out of the way while the reader is typing.\n useEffect(() => {\n function handleKeyDown(e: KeyboardEvent) {\n if (!(e.metaKey || e.ctrlKey) || e.shiftKey || e.altKey) return;\n if (e.key.toLowerCase() !== \"b\") return;\n const target = e.target as HTMLElement | null;\n if (target?.closest(\"input, textarea, [contenteditable='true']\")) return;\n // The button is display:none below \"lg\" and focus mode is a desktop\n // layout, so the shortcut is live exactly when the button is.\n const button = buttonRef.current;\n if (!button || getComputedStyle(button).display === \"none\") return;\n e.preventDefault();\n setIsFocusMode((value) => !value);\n }\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => document.removeEventListener(\"keydown\", handleKeyDown);\n }, []);\n\n // The nav sidebar, the right rail and the content columns sit in separate\n // subtrees, so the state rides on the root element and each of them reacts\n // in CSS (see focusModeHide / focusModeColumn in SharedStyled).\n useEffect(() => {\n const root = document.documentElement;\n if (isFocusMode) {\n root.setAttribute(\"data-focus-mode\", \"\");\n } else {\n root.removeAttribute(\"data-focus-mode\");\n }\n return () => root.removeAttribute(\"data-focus-mode\");\n }, [isFocusMode]);\n\n return (\n <StyledFocusToggle\n ref={buttonRef}\n type=\"button\"\n onClick={() => setIsFocusMode((value) => !value)}\n aria-pressed={isFocusMode}\n aria-label={isFocusMode ? \"Exit focus mode\" : \"Enter focus mode\"}\n title={isFocusMode ? \"Exit focus mode (\u2318B)\" : \"Focus mode (\u2318B)\"}\n >\n <Icon name={isFocusMode ? \"minimize\" : \"maximize\"} size={16} />\n </StyledFocusToggle>\n );\n}\n\nexport { FocusModeToggle };\n";
1
+ export declare const focusModeToggleTemplate = "\"use client\";\nimport { useEffect, useRef, useState } from \"react\";\nimport styled from \"styled-components\";\nimport { resetButton } from \"cherry-styled-components\";\nimport { useStrings } from \"@/components/useStrings\";\nimport { Icon } from \"@/components/layout/Icon\";\nimport { mq, Theme } from \"@/app/theme\";\nimport { interactiveStyles } from \"@/components/layout/SharedStyled\";\n\n// Desktop-only affordance that collapses both rails for distraction-free\n// reading. The button is fixed rather than living in the sidebar footer next\n// to the ThemeToggle: the footer slides away with the sidebar, and the way\n// back out of focus mode has to stay on screen.\nconst StyledFocusToggle = styled.button<{ theme: Theme }>`\n display: none;\n\n ${mq(\"lg\")} {\n ${resetButton};\n ${interactiveStyles};\n display: flex;\n align-items: center;\n justify-content: center;\n position: fixed;\n /* Above the sidebar (99) so it stays clickable once the rails are out,\n below the chat panel (1000). */\n z-index: 100;\n /* Left end of the sidebar footer row, flush with the footer's left\n padding; the switchers follow and the ThemeToggle holds the right end,\n all of them 30px tall. */\n left: 20px;\n bottom: 16px;\n width: 30px;\n height: 30px;\n border-radius: 50%;\n background: ${({ theme }) => theme.colors.light};\n border-color: ${({ theme }) => theme.colors.grayLight};\n\n & svg {\n width: 16px;\n height: 16px;\n }\n\n & svg[stroke] {\n stroke: ${({ theme }) => theme.colors.primary};\n }\n\n &:hover svg[stroke] {\n stroke: ${({ theme }) => theme.colors.accent};\n }\n }\n`;\n\nfunction FocusModeToggle() {\n const [isFocusMode, setIsFocusMode] = useState(false);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const t = useStrings();\n\n // Cmd/Ctrl+B, the editor convention for collapsing the side columns. Sits\n // alongside the app's other chords (Cmd+K search, Cmd+I chat,\n // Cmd+Shift+L theme) and stays out of the way while the reader is typing.\n useEffect(() => {\n function handleKeyDown(e: KeyboardEvent) {\n if (!(e.metaKey || e.ctrlKey) || e.shiftKey || e.altKey) return;\n if (e.key.toLowerCase() !== \"b\") return;\n const target = e.target as HTMLElement | null;\n if (target?.closest(\"input, textarea, [contenteditable='true']\")) return;\n // The button is display:none below \"lg\" and focus mode is a desktop\n // layout, so the shortcut is live exactly when the button is.\n const button = buttonRef.current;\n if (!button || getComputedStyle(button).display === \"none\") return;\n e.preventDefault();\n setIsFocusMode((value) => !value);\n }\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => document.removeEventListener(\"keydown\", handleKeyDown);\n }, []);\n\n // The nav sidebar, the right rail and the content columns sit in separate\n // subtrees, so the state rides on the root element and each of them reacts\n // in CSS (see focusModeHide / focusModeColumn in SharedStyled).\n useEffect(() => {\n const root = document.documentElement;\n if (isFocusMode) {\n root.setAttribute(\"data-focus-mode\", \"\");\n } else {\n root.removeAttribute(\"data-focus-mode\");\n }\n return () => root.removeAttribute(\"data-focus-mode\");\n }, [isFocusMode]);\n\n return (\n <StyledFocusToggle\n ref={buttonRef}\n type=\"button\"\n onClick={() => setIsFocusMode((value) => !value)}\n aria-pressed={isFocusMode}\n aria-label={isFocusMode ? t.exitFocusMode : t.enterFocusMode}\n title={(isFocusMode ? t.exitFocusMode : t.focusMode) + \" (\u2318B)\"}\n >\n <Icon name={isFocusMode ? \"minimize\" : \"maximize\"} size={16} />\n </StyledFocusToggle>\n );\n}\n\nexport { FocusModeToggle };\n";
@@ -2,6 +2,7 @@ export const focusModeToggleTemplate = `"use client";
2
2
  import { useEffect, useRef, useState } from "react";
3
3
  import styled from "styled-components";
4
4
  import { resetButton } from "cherry-styled-components";
5
+ import { useStrings } from "@/components/useStrings";
5
6
  import { Icon } from "@/components/layout/Icon";
6
7
  import { mq, Theme } from "@/app/theme";
7
8
  import { interactiveStyles } from "@/components/layout/SharedStyled";
@@ -23,8 +24,9 @@ const StyledFocusToggle = styled.button<{ theme: Theme }>\`
23
24
  /* Above the sidebar (99) so it stays clickable once the rails are out,
24
25
  below the chat panel (1000). */
25
26
  z-index: 100;
26
- /* Sidebar footer row, flush with the footer's left padding (the
27
- ThemeToggle holds the right end of the same row). */
27
+ /* Left end of the sidebar footer row, flush with the footer's left
28
+ padding; the switchers follow and the ThemeToggle holds the right end,
29
+ all of them 30px tall. */
28
30
  left: 20px;
29
31
  bottom: 16px;
30
32
  width: 30px;
@@ -51,6 +53,7 @@ const StyledFocusToggle = styled.button<{ theme: Theme }>\`
51
53
  function FocusModeToggle() {
52
54
  const [isFocusMode, setIsFocusMode] = useState(false);
53
55
  const buttonRef = useRef<HTMLButtonElement>(null);
56
+ const t = useStrings();
54
57
 
55
58
  // Cmd/Ctrl+B, the editor convention for collapsing the side columns. Sits
56
59
  // alongside the app's other chords (Cmd+K search, Cmd+I chat,
@@ -91,8 +94,8 @@ function FocusModeToggle() {
91
94
  type="button"
92
95
  onClick={() => setIsFocusMode((value) => !value)}
93
96
  aria-pressed={isFocusMode}
94
- aria-label={isFocusMode ? "Exit focus mode" : "Enter focus mode"}
95
- title={isFocusMode ? "Exit focus mode (⌘B)" : "Focus mode (⌘B)"}
97
+ aria-label={isFocusMode ? t.exitFocusMode : t.enterFocusMode}
98
+ title={(isFocusMode ? t.exitFocusMode : t.focusMode) + " (⌘B)"}
96
99
  >
97
100
  <Icon name={isFocusMode ? "minimize" : "maximize"} size={16} />
98
101
  </StyledFocusToggle>
@@ -1 +1 @@
1
- export declare const footerTemplate = "\"use client\";\nimport styled, { css } from \"styled-components\";\nimport { Space, styledSmall, useChat } from \"cherry-styled-components\";\nimport { mq, Theme } from \"@/app/theme\";\nimport { GitHubLogo } from \"@/components/layout/Pictograms\";\nimport {\n focusModeColumn,\n sidePanelOffset,\n} from \"@/components/layout/SharedStyled\";\nimport linksData from \"@/links.json\";\n\ninterface LinkProps {\n title: string;\n url: string;\n icon?: string;\n}\n\nconst links = linksData as LinkProps[];\n\nconst StyledFooter = styled.footer<{\n theme: Theme;\n $isChatOpen?: boolean;\n $hasLinks?: boolean;\n}>`\n padding: 0 20px;\n transition: all 0.3s ease;\n\n ${({ $hasLinks }) =>\n $hasLinks &&\n css`\n margin-top: 20px;\n `}\n\n ${mq(\"lg\")} {\n margin: 0;\n padding: 0 300px 0 300px;\n\n ${({ $isChatOpen }) =>\n $isChatOpen &&\n css`\n padding: 0 440px 0 300px;\n `}\n }\n\n ${sidePanelOffset};\n ${({ $isChatOpen }) => !$isChatOpen && focusModeColumn};\n`;\n\nconst StyledFooterInner = styled.div<{ theme: Theme }>`\n border-top: solid 1px ${({ theme }) => theme.colors.grayLight};\n max-width: 640px;\n margin: 0 auto;\n padding: 28px 0;\n color: ${({ theme }) => theme.colors.grayDark};\n ${({ theme }) => styledSmall(theme)};\n\n ${mq(\"lg\")} {\n padding: 20px 0;\n }\n\n & a {\n font-weight: 700;\n color: ${({ theme }) => theme.colors.accent};\n text-decoration: none;\n transition: all 0.3s ease;\n display: inline-flex;\n\n &:hover {\n color: ${({ theme }) => theme.colors.primary};\n }\n\n /* The GitHub logo is an icon-only link - round the global focus ring so it\n hugs the icon instead of drawing a rectangle. */\n &:has(svg):focus-visible {\n border-radius: 100%;\n }\n\n & svg {\n width: 18px;\n height: 18px;\n }\n }\n`;\n\nconst StyledFooterFlex = styled.div`\n display: flex;\n justify-content: flex-start;\n align-items: center;\n gap: 20px;\n\n ${mq(\"lg\")} {\n justify-content: space-between;\n }\n`;\n\nfunction Footer({ hideBranding }: { hideBranding?: boolean }) {\n const { isOpen } = useChat();\n\n if (hideBranding) return <Space $xs={80} $lg=\"none\" />;\n\n return (\n <StyledFooter $isChatOpen={isOpen} $hasLinks={links.length > 0}>\n <StyledFooterInner>\n <StyledFooterFlex>\n <span>\n Powered by{\" \"}\n <a\n href=\"https://doccupine.com\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Doccupine\n </a>\n </span>\n <a\n href=\"https://github.com/doccupine/cli\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n aria-label=\"Doccupine on GitHub\"\n >\n <GitHubLogo />\n </a>\n </StyledFooterFlex>\n </StyledFooterInner>\n </StyledFooter>\n );\n}\n\nexport { Footer };\n";
1
+ export declare const footerTemplate = "\"use client\";\nimport styled, { css } from \"styled-components\";\nimport { useStrings } from \"@/components/useStrings\";\nimport { Space, styledSmall, useChat } from \"cherry-styled-components\";\nimport { mq, Theme } from \"@/app/theme\";\nimport { GitHubLogo } from \"@/components/layout/Pictograms\";\nimport {\n focusModeColumn,\n sidePanelOffset,\n} from \"@/components/layout/SharedStyled\";\nimport linksData from \"@/links.json\";\n\ninterface LinkProps {\n title: string;\n url: string;\n icon?: string;\n}\n\nconst links = linksData as LinkProps[];\n\nconst StyledFooter = styled.footer<{\n theme: Theme;\n $isChatOpen?: boolean;\n $hasLinks?: boolean;\n}>`\n padding: 0 20px;\n transition: all 0.3s ease;\n\n ${({ $hasLinks }) =>\n $hasLinks &&\n css`\n margin-top: 20px;\n `}\n\n ${mq(\"lg\")} {\n margin: 0;\n padding: 0 300px 0 300px;\n\n ${({ $isChatOpen }) =>\n $isChatOpen &&\n css`\n padding: 0 440px 0 300px;\n `}\n }\n\n ${sidePanelOffset};\n ${({ $isChatOpen }) => !$isChatOpen && focusModeColumn};\n`;\n\nconst StyledFooterInner = styled.div<{ theme: Theme }>`\n border-top: solid 1px ${({ theme }) => theme.colors.grayLight};\n max-width: 640px;\n margin: 0 auto;\n padding: 28px 0;\n color: ${({ theme }) => theme.colors.grayDark};\n ${({ theme }) => styledSmall(theme)};\n\n ${mq(\"lg\")} {\n padding: 20px 0;\n }\n\n & a {\n font-weight: 700;\n color: ${({ theme }) => theme.colors.accent};\n text-decoration: none;\n transition: all 0.3s ease;\n display: inline-flex;\n\n &:hover {\n color: ${({ theme }) => theme.colors.primary};\n }\n\n /* The GitHub logo is an icon-only link - round the global focus ring so it\n hugs the icon instead of drawing a rectangle. */\n &:has(svg):focus-visible {\n border-radius: 100%;\n }\n\n & svg {\n width: 18px;\n height: 18px;\n }\n }\n`;\n\nconst StyledFooterFlex = styled.div`\n display: flex;\n justify-content: flex-start;\n align-items: center;\n gap: 20px;\n\n ${mq(\"lg\")} {\n justify-content: space-between;\n }\n`;\n\nfunction Footer({ hideBranding }: { hideBranding?: boolean }) {\n const { isOpen } = useChat();\n const t = useStrings();\n\n if (hideBranding) return <Space $xs={80} $lg=\"none\" />;\n\n return (\n <StyledFooter $isChatOpen={isOpen} $hasLinks={links.length > 0}>\n <StyledFooterInner>\n <StyledFooterFlex>\n <span>\n {t.poweredBy}{\" \"}\n <a\n href=\"https://doccupine.com\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Doccupine\n </a>\n </span>\n <a\n href=\"https://github.com/doccupine/cli\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n aria-label={t.githubLink}\n >\n <GitHubLogo />\n </a>\n </StyledFooterFlex>\n </StyledFooterInner>\n </StyledFooter>\n );\n}\n\nexport { Footer };\n";
@@ -1,6 +1,7 @@
1
1
  import { SIDEBAR_WIDTH, CHAT_WIDTH } from "../../app/theme.js";
2
2
  export const footerTemplate = `"use client";
3
3
  import styled, { css } from "styled-components";
4
+ import { useStrings } from "@/components/useStrings";
4
5
  import { Space, styledSmall, useChat } from "cherry-styled-components";
5
6
  import { mq, Theme } from "@/app/theme";
6
7
  import { GitHubLogo } from "@/components/layout/Pictograms";
@@ -96,6 +97,7 @@ const StyledFooterFlex = styled.div\`
96
97
 
97
98
  function Footer({ hideBranding }: { hideBranding?: boolean }) {
98
99
  const { isOpen } = useChat();
100
+ const t = useStrings();
99
101
 
100
102
  if (hideBranding) return <Space $xs={80} $lg="none" />;
101
103
 
@@ -104,7 +106,7 @@ function Footer({ hideBranding }: { hideBranding?: boolean }) {
104
106
  <StyledFooterInner>
105
107
  <StyledFooterFlex>
106
108
  <span>
107
- Powered by{" "}
109
+ {t.poweredBy}{" "}
108
110
  <a
109
111
  href="https://doccupine.com"
110
112
  target="_blank"
@@ -117,7 +119,7 @@ function Footer({ hideBranding }: { hideBranding?: boolean }) {
117
119
  href="https://github.com/doccupine/cli"
118
120
  target="_blank"
119
121
  rel="noopener noreferrer"
120
- aria-label="Doccupine on GitHub"
122
+ aria-label={t.githubLink}
121
123
  >
122
124
  <GitHubLogo />
123
125
  </a>
@@ -1 +1 @@
1
- export declare const headerTemplate = "\"use client\";\nimport React from \"react\";\nimport { useCallback, useContext, useEffect, useRef, useState } from \"react\";\nimport styled, { css } from \"styled-components\";\nimport Link from \"next/link\";\nimport { mq, Theme } from \"@/app/theme\";\nimport { ChatLauncher, useOnClickOutside } from \"cherry-styled-components\";\nimport { Search } from \"lucide-react\";\nimport { Logo } from \"@/components/layout/Pictograms\";\nimport { ChatContext } from \"@/components/Chat\";\nimport {\n SearchContext,\n SearchKbd,\n StyledSearchButton,\n} from \"@/components/SearchDocs\";\nimport themeJson from \"@/theme.json\";\n\nconst customThemeJson = themeJson as typeof themeJson & {\n logo?: { dark: string; light: string };\n};\n\nconst StyledHeader = styled.header<{\n theme: Theme;\n $hasChildren: boolean;\n $pinned: boolean;\n}>`\n /* In normal flow at the top of the page, fixed only once the page scrolls.\n iOS Safari refuses to color its toolbar from the theme-color meta while\n a sticky or fixed element touches the top edge - whatever that element's\n background (transparent, frosted, or opaque; the Doccupine platform\n site's header is position: relative on its app pages for the same\n reason). At scroll position zero an in-flow header occupies exactly the\n place a sticky one would, so the swap is invisible; while scrolled, the\n toolbar is collapsed anyway. StyledHeaderShell holds the header's\n measured height while it is fixed, so pinning never shifts the page. */\n position: relative;\n top: 0;\n margin: 0;\n z-index: 1000;\n width: 100%;\n border-bottom: solid 1px ${({ theme }) => theme.colors.grayLight};\n\n ${({ $pinned }) =>\n $pinned &&\n css`\n position: fixed;\n left: 0;\n `}\n\n ${({ $hasChildren }) =>\n !$hasChildren &&\n css`\n ${mq(\"lg\")} {\n padding-bottom: 16px;\n padding-top: 16px;\n }\n `}\n\n &::before,\n &::after {\n display: block;\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n background: ${({ theme }) => theme.colors.light};\n z-index: -2;\n }\n\n &::after {\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 5%, transparent)`};\n z-index: -1;\n }\n\n & .logo {\n display: flex;\n min-width: max-content;\n\n & svg,\n & img {\n margin: auto;\n height: auto;\n width: fit-content;\n min-width: fit-content;\n max-width: 182px;\n max-height: 30px;\n\n & [fill]:not(.ignore-fill) {\n fill: ${({ theme }) => theme.colors.primary};\n }\n }\n }\n`;\n\n/**\n * In-flow placeholder that owns the header's space. While the header is\n * pinned (position: fixed, out of flow), the shell keeps the header's\n * measured height so pinning never shifts the page; at the top of the page\n * it collapses to its content.\n */\nconst StyledHeaderShell = styled.div<{ $pinned: boolean; $height: number }>`\n ${({ $pinned, $height }) =>\n $pinned &&\n $height > 0 &&\n css`\n height: ${$height}px;\n `}\n`;\n\nconst StyledHeaderInner = styled.div<{ $hasChildren: boolean }>`\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n padding: 16px 0 0 20px;\n\n ${({ $hasChildren }) =>\n !$hasChildren &&\n css`\n padding-bottom: 16px;\n `}\n\n ${mq(\"lg\")} {\n flex-wrap: nowrap;\n padding: 0 20px;\n }\n`;\n\nconst StyledLeftWrapper = styled.div`\n display: flex;\n align-items: center;\n gap: 10px;\n min-width: fit-content;\n padding-right: 20px;\n\n ${mq(\"lg\")} {\n padding-right: 0;\n }\n`;\n\ninterface HeaderProps {\n children?: React.ReactNode;\n}\n\nfunction Header({ children }: HeaderProps) {\n const [isOptionActive, setIsOptionActive] = useState(false);\n const [isLangActive, setIsLangActive] = useState(false);\n const [isPinned, setIsPinned] = useState(false);\n const [headerHeight, setHeaderHeight] = useState(0);\n const headerRef = useRef<HTMLElement>(null);\n\n useEffect(() => {\n const onScroll = () => {\n if (headerRef.current) {\n setHeaderHeight(headerRef.current.getBoundingClientRect().height);\n }\n setIsPinned(window.scrollY > 0);\n };\n onScroll();\n window.addEventListener(\"scroll\", onScroll, { passive: true });\n window.addEventListener(\"resize\", onScroll);\n return () => {\n window.removeEventListener(\"scroll\", onScroll);\n window.removeEventListener(\"resize\", onScroll);\n };\n }, []);\n\n const wrapperRef = useRef<HTMLSpanElement>(null);\n const elmRef = useRef<HTMLDivElement>(null);\n const langRef = useRef<HTMLSpanElement>(null);\n const closeMenu = useCallback(() => {\n setIsOptionActive(false);\n setIsLangActive(false);\n }, []);\n\n useOnClickOutside(\n [elmRef, wrapperRef],\n isOptionActive ? closeMenu : () => {},\n );\n useOnClickOutside([langRef, wrapperRef], isLangActive ? closeMenu : () => {});\n const { isChatActive } = useContext(ChatContext);\n const { openSearch } = useContext(SearchContext);\n\n return (\n <StyledHeaderShell $pinned={isPinned} $height={headerHeight}>\n <StyledHeader\n $hasChildren={children ? true : false}\n $pinned={isPinned}\n id=\"header\"\n ref={headerRef}\n >\n <StyledHeaderInner $hasChildren={children ? true : false}>\n <Link href=\"/\" className=\"logo\" aria-label=\"Logo\">\n {customThemeJson.logo ? (\n <>\n {/* Both logos render; .light-only and .dark-only classes in\n GlobalStyles hide the inactive one based on the \"dark\" class\n on <html>. Avoids a JS-driven swap so no flash on first load. */}\n {/* eslint-disable-next-line @next/next/no-img-element */}\n <img\n className=\"light-only\"\n src={customThemeJson.logo.light}\n alt=\"Logo\"\n width=\"100\"\n height=\"100\"\n />\n {/* eslint-disable-next-line @next/next/no-img-element */}\n <img\n className=\"dark-only\"\n src={customThemeJson.logo.dark}\n alt=\"Logo\"\n width=\"100\"\n height=\"100\"\n />\n </>\n ) : (\n <Logo />\n )}\n </Link>\n {children}\n <StyledLeftWrapper>\n <StyledSearchButton onClick={openSearch} aria-label=\"Search docs\">\n <Search size={14} />\n <SearchKbd>&#8984;K</SearchKbd>\n </StyledSearchButton>\n {isChatActive && <ChatLauncher $glow />}\n </StyledLeftWrapper>\n </StyledHeaderInner>\n </StyledHeader>\n </StyledHeaderShell>\n );\n}\n\nexport { Header };\n";
1
+ export declare const headerTemplate = "\"use client\";\nimport React from \"react\";\nimport { useCallback, useContext, useEffect, useRef, useState } from \"react\";\nimport styled, { css } from \"styled-components\";\nimport Link from \"next/link\";\nimport { mq, Theme } from \"@/app/theme\";\nimport {\n ChatLauncher,\n Icon,\n useOnClickOutside,\n} from \"cherry-styled-components\";\nimport { Search, Sparkles } from \"lucide-react\";\nimport { Logo } from \"@/components/layout/Pictograms\";\nimport { ChatContext } from \"@/components/Chat\";\nimport { useStrings } from \"@/components/useStrings\";\nimport {\n SearchContext,\n SearchKbd,\n StyledSearchButton,\n} from \"@/components/SearchDocs\";\nimport themeJson from \"@/theme.json\";\n\nconst customThemeJson = themeJson as typeof themeJson & {\n logo?: { dark: string; light: string };\n};\n\nconst StyledHeader = styled.header<{\n theme: Theme;\n $hasChildren: boolean;\n $pinned: boolean;\n}>`\n /* In normal flow at the top of the page, fixed only once the page scrolls.\n iOS Safari refuses to color its toolbar from the theme-color meta while\n a sticky or fixed element touches the top edge - whatever that element's\n background (transparent, frosted, or opaque; the Doccupine platform\n site's header is position: relative on its app pages for the same\n reason). At scroll position zero an in-flow header occupies exactly the\n place a sticky one would, so the swap is invisible; while scrolled, the\n toolbar is collapsed anyway. StyledHeaderShell holds the header's\n measured height while it is fixed, so pinning never shifts the page. */\n position: relative;\n top: 0;\n margin: 0;\n z-index: 1000;\n width: 100%;\n border-bottom: solid 1px ${({ theme }) => theme.colors.grayLight};\n\n ${({ $pinned }) =>\n $pinned &&\n css`\n position: fixed;\n left: 0;\n `}\n\n ${({ $hasChildren }) =>\n !$hasChildren &&\n css`\n ${mq(\"lg\")} {\n padding-bottom: 16px;\n padding-top: 16px;\n }\n `}\n\n &::before,\n &::after {\n display: block;\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n background: ${({ theme }) => theme.colors.light};\n z-index: -2;\n }\n\n &::after {\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 5%, transparent)`};\n z-index: -1;\n }\n\n & .logo {\n display: flex;\n min-width: max-content;\n\n & svg,\n & img {\n margin: auto;\n height: auto;\n width: fit-content;\n min-width: fit-content;\n max-width: 182px;\n max-height: 30px;\n\n & [fill]:not(.ignore-fill) {\n fill: ${({ theme }) => theme.colors.primary};\n }\n }\n }\n`;\n\n/**\n * In-flow placeholder that owns the header's space. While the header is\n * pinned (position: fixed, out of flow), the shell keeps the header's\n * measured height so pinning never shifts the page; at the top of the page\n * it collapses to its content.\n */\nconst StyledHeaderShell = styled.div<{ $pinned: boolean; $height: number }>`\n ${({ $pinned, $height }) =>\n $pinned &&\n $height > 0 &&\n css`\n height: ${$height}px;\n `}\n`;\n\nconst StyledHeaderInner = styled.div<{ $hasChildren: boolean }>`\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n padding: 16px 0 0 20px;\n\n ${({ $hasChildren }) =>\n !$hasChildren &&\n css`\n padding-bottom: 16px;\n `}\n\n ${mq(\"lg\")} {\n flex-wrap: nowrap;\n padding: 0 20px;\n }\n`;\n\nconst StyledLeftWrapper = styled.div`\n display: flex;\n align-items: center;\n gap: 10px;\n min-width: fit-content;\n padding-right: 20px;\n\n ${mq(\"lg\")} {\n padding-right: 0;\n }\n`;\n\ninterface HeaderProps {\n children?: React.ReactNode;\n}\n\nfunction Header({ children }: HeaderProps) {\n const [isOptionActive, setIsOptionActive] = useState(false);\n const [isPinned, setIsPinned] = useState(false);\n const [headerHeight, setHeaderHeight] = useState(0);\n const headerRef = useRef<HTMLElement>(null);\n\n useEffect(() => {\n const onScroll = () => {\n if (headerRef.current) {\n setHeaderHeight(headerRef.current.getBoundingClientRect().height);\n }\n setIsPinned(window.scrollY > 0);\n };\n onScroll();\n window.addEventListener(\"scroll\", onScroll, { passive: true });\n window.addEventListener(\"resize\", onScroll);\n return () => {\n window.removeEventListener(\"scroll\", onScroll);\n window.removeEventListener(\"resize\", onScroll);\n };\n }, []);\n\n const wrapperRef = useRef<HTMLSpanElement>(null);\n const elmRef = useRef<HTMLDivElement>(null);\n const closeMenu = useCallback(() => {\n setIsOptionActive(false);\n }, []);\n\n useOnClickOutside(\n [elmRef, wrapperRef],\n isOptionActive ? closeMenu : () => {},\n );\n const { isChatActive } = useContext(ChatContext);\n const { openSearch } = useContext(SearchContext);\n const t = useStrings();\n\n return (\n <StyledHeaderShell $pinned={isPinned} $height={headerHeight}>\n <StyledHeader\n $hasChildren={children ? true : false}\n $pinned={isPinned}\n id=\"header\"\n ref={headerRef}\n >\n <StyledHeaderInner $hasChildren={children ? true : false}>\n <Link href=\"/\" className=\"logo\" aria-label=\"Logo\">\n {customThemeJson.logo ? (\n <>\n {/* Both logos render; .light-only and .dark-only classes in\n GlobalStyles hide the inactive one based on the \"dark\" class\n on <html>. Avoids a JS-driven swap so no flash on first load. */}\n {/* eslint-disable-next-line @next/next/no-img-element */}\n <img\n className=\"light-only\"\n src={customThemeJson.logo.light}\n alt=\"Logo\"\n width=\"100\"\n height=\"100\"\n />\n {/* eslint-disable-next-line @next/next/no-img-element */}\n <img\n className=\"dark-only\"\n src={customThemeJson.logo.dark}\n alt=\"Logo\"\n width=\"100\"\n height=\"100\"\n />\n </>\n ) : (\n <Logo />\n )}\n </Link>\n {children}\n <StyledLeftWrapper>\n <StyledSearchButton\n onClick={openSearch}\n aria-label={t.searchButton}\n >\n <Search size={14} />\n <SearchKbd>&#8984;K</SearchKbd>\n </StyledSearchButton>\n {isChatActive && (\n <ChatLauncher $glow aria-label={t.askAiAssistant}>\n <Icon icon={Sparkles} />\n {t.askAi}\n </ChatLauncher>\n )}\n </StyledLeftWrapper>\n </StyledHeaderInner>\n </StyledHeader>\n </StyledHeaderShell>\n );\n}\n\nexport { Header };\n";