@lupinum/ginko-docs 0.4.0-rc.9 → 0.4.0

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 (296) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/LICENSE +1 -1
  3. package/README.md +206 -54
  4. package/app/app.config.ts +42 -55
  5. package/app/assets/docs.css +555 -0
  6. package/app/components/DocsBanner.vue +29 -0
  7. package/app/components/DocsExample.vue +43 -0
  8. package/app/components/DocsFooter.vue +19 -0
  9. package/app/components/DocsHeader.vue +112 -0
  10. package/app/components/DocsLanding.vue +55 -0
  11. package/app/components/DocsLanguage.vue +29 -0
  12. package/app/components/DocsNavTree.vue +38 -0
  13. package/app/components/DocsPage.vue +84 -0
  14. package/app/components/DocsPageActions.vue +47 -0
  15. package/app/components/DocsPost.vue +58 -0
  16. package/app/components/DocsSearch.vue +134 -0
  17. package/app/components/DocsShell.vue +20 -0
  18. package/app/components/DocsSidebar.vue +18 -0
  19. package/app/components/DocsTable.vue +11 -0
  20. package/app/components/DocsThemeToggle.vue +45 -0
  21. package/app/components/DocsToc.vue +73 -0
  22. package/app/composables/useDocs.ts +52 -0
  23. package/app/composables/useDocsBlog.ts +32 -0
  24. package/app/composables/useDocsCopy.ts +17 -0
  25. package/app/composables/useDocsPopover.ts +36 -0
  26. package/app/composables/useDocsSite.ts +10 -0
  27. package/app/docs-pages/blog.vue +47 -0
  28. package/app/docs-pages/changelog.vue +27 -0
  29. package/app/docs-pages/doc.vue +14 -0
  30. package/app/docs-pages/docs.vue +9 -0
  31. package/app/docs-pages/index.vue +12 -0
  32. package/app/docs-pages/post.vue +8 -0
  33. package/app/error.vue +23 -115
  34. package/app/layouts/default.vue +25 -7
  35. package/app/lib/blogTypes.ts +8 -0
  36. package/app/lib/docsFirst.ts +11 -0
  37. package/app/lib/docsInit.ts +18 -0
  38. package/app/lib/docsNav.ts +36 -0
  39. package/app/lib/docsPage.ts +44 -0
  40. package/app/lib/markdownComponents.ts +16 -0
  41. package/app/lib/previewToc.ts +18 -0
  42. package/dist/config.d.mts +232 -0
  43. package/dist/config.d.ts +232 -0
  44. package/dist/config.mjs +114 -0
  45. package/dist/pages.d.mts +5 -0
  46. package/dist/pages.d.ts +5 -0
  47. package/dist/pages.mjs +36 -0
  48. package/dist/shared/ginko-docs.BwbF7JBR.mjs +4 -0
  49. package/i18n/de.json +1 -0
  50. package/i18n/en.json +1 -0
  51. package/icons/README.md +2 -0
  52. package/icons/bluesky.svg +1 -0
  53. package/icons/claude.svg +1 -0
  54. package/icons/discord.svg +1 -0
  55. package/icons/github.svg +1 -0
  56. package/icons/linkedin.svg +1 -0
  57. package/icons/mastodon.svg +1 -0
  58. package/icons/openai.svg +1 -0
  59. package/icons/x.svg +1 -0
  60. package/icons/youtube.svg +1 -0
  61. package/nuxt.config.ts +34 -209
  62. package/package.json +43 -76
  63. package/public/_docs/fonts/LICENSE +188 -0
  64. package/public/_docs/fonts/inter-latin-wght-normal.woff2 +0 -0
  65. package/public/_docs/fonts/jetbrains-mono-latin-400-normal.woff2 +0 -0
  66. package/public/_docs/fonts/jetbrains-mono-latin-500-normal.woff2 +0 -0
  67. package/server/feeds/blog-locale.get.ts +9 -0
  68. package/server/feeds/blog.get.ts +4 -0
  69. package/server/lib/blogFeed.ts +35 -0
  70. package/server/lib/rss.ts +57 -0
  71. package/server/mcp/handler.ts +108 -0
  72. package/server/routes/__ginko/docs-mcp.ts +35 -0
  73. package/shared/paths.ts +4 -0
  74. package/app/app.vue +0 -98
  75. package/app/assets/css/prose.css +0 -3240
  76. package/app/assets/css/tailwind.css +0 -394
  77. package/app/assets/css/theme-palettes.css +0 -309
  78. package/app/assets/css/theme-presets.css +0 -141
  79. package/app/components/OgImage/GinkoDocs.satori.vue +0 -238
  80. package/app/components/content/DocumentPageShell.vue +0 -55
  81. package/app/components/content/Feedback.vue +0 -102
  82. package/app/components/content/ImageZoomDialog.vue +0 -84
  83. package/app/components/content/PageMarkdownCopy.vue +0 -104
  84. package/app/components/content/imageZoom.ts +0 -25
  85. package/app/components/mdc/MdcAccordion.vue +0 -67
  86. package/app/components/mdc/MdcAccordionItem.vue +0 -42
  87. package/app/components/mdc/MdcApi.vue +0 -159
  88. package/app/components/mdc/MdcAside.vue +0 -23
  89. package/app/components/mdc/MdcCallout.vue +0 -61
  90. package/app/components/mdc/MdcCard.vue +0 -175
  91. package/app/components/mdc/MdcCards.vue +0 -30
  92. package/app/components/mdc/MdcCenter.vue +0 -71
  93. package/app/components/mdc/MdcCodeGroup.vue +0 -197
  94. package/app/components/mdc/MdcCodeTree.vue +0 -234
  95. package/app/components/mdc/MdcCollapse.vue +0 -61
  96. package/app/components/mdc/MdcColumn.vue +0 -70
  97. package/app/components/mdc/MdcDropcap.vue +0 -84
  98. package/app/components/mdc/MdcError.vue +0 -23
  99. package/app/components/mdc/MdcExcerpt.vue +0 -26
  100. package/app/components/mdc/MdcFigure.vue +0 -85
  101. package/app/components/mdc/MdcFiles.vue +0 -120
  102. package/app/components/mdc/MdcIdea.vue +0 -17
  103. package/app/components/mdc/MdcInfo.vue +0 -17
  104. package/app/components/mdc/MdcInlineToc.vue +0 -51
  105. package/app/components/mdc/MdcKbd.vue +0 -10
  106. package/app/components/mdc/MdcLayout.vue +0 -57
  107. package/app/components/mdc/MdcNote.vue +0 -17
  108. package/app/components/mdc/MdcQuiz.vue +0 -241
  109. package/app/components/mdc/MdcQuizQuestion.vue +0 -221
  110. package/app/components/mdc/MdcReadMore.vue +0 -70
  111. package/app/components/mdc/MdcSteps.vue +0 -59
  112. package/app/components/mdc/MdcSuccess.vue +0 -23
  113. package/app/components/mdc/MdcTab.vue +0 -17
  114. package/app/components/mdc/MdcTabs.vue +0 -150
  115. package/app/components/mdc/MdcTimeline.vue +0 -17
  116. package/app/components/mdc/MdcTimelineItem.vue +0 -40
  117. package/app/components/mdc/MdcWarning.vue +0 -23
  118. package/app/components/mdc/api.utils.ts +0 -132
  119. package/app/components/mdc/code-tree.utils.ts +0 -22
  120. package/app/components/mdc/icons.ts +0 -10
  121. package/app/components/mdc/quiz.utils.ts +0 -38
  122. package/app/components/prose/ProseA.vue +0 -27
  123. package/app/components/prose/ProseBlockquote.vue +0 -30
  124. package/app/components/prose/ProseCode.vue +0 -14
  125. package/app/components/prose/ProseEm.vue +0 -14
  126. package/app/components/prose/ProseH1.vue +0 -18
  127. package/app/components/prose/ProseH2.vue +0 -29
  128. package/app/components/prose/ProseH3.vue +0 -29
  129. package/app/components/prose/ProseH4.vue +0 -29
  130. package/app/components/prose/ProseH5.vue +0 -15
  131. package/app/components/prose/ProseH6.vue +0 -15
  132. package/app/components/prose/ProseHr.vue +0 -12
  133. package/app/components/prose/ProseImg.vue +0 -55
  134. package/app/components/prose/ProseLi.vue +0 -14
  135. package/app/components/prose/ProseOl.vue +0 -14
  136. package/app/components/prose/ProseP.vue +0 -14
  137. package/app/components/prose/ProsePre.vue +0 -180
  138. package/app/components/prose/ProseStrong.vue +0 -14
  139. package/app/components/prose/ProseTable.vue +0 -18
  140. package/app/components/prose/ProseTbody.vue +0 -14
  141. package/app/components/prose/ProseTd.vue +0 -14
  142. package/app/components/prose/ProseTh.vue +0 -14
  143. package/app/components/prose/ProseThead.vue +0 -14
  144. package/app/components/prose/ProseTr.vue +0 -14
  145. package/app/components/prose/ProseUl.vue +0 -14
  146. package/app/components/site/ModeToggle.vue +0 -81
  147. package/app/components/site/SiteBanner.vue +0 -97
  148. package/app/components/site/SiteFooter.vue +0 -90
  149. package/app/components/site/SiteHeader.vue +0 -371
  150. package/app/components/site/SiteHeroCode.vue +0 -173
  151. package/app/components/site/SiteInteractionLayer.vue +0 -42
  152. package/app/components/site/SiteLocaleSwitcher.vue +0 -190
  153. package/app/components/site/SiteLogoMark.vue +0 -12
  154. package/app/components/site/SiteSkipLink.vue +0 -14
  155. package/app/components/site/SiteSocialLinks.vue +0 -33
  156. package/app/components/site/header-utils.ts +0 -3
  157. package/app/components/site/mode-toggle.utils.ts +0 -18
  158. package/app/components/ui/badge/Badge.vue +0 -28
  159. package/app/components/ui/badge/index.ts +0 -24
  160. package/app/components/ui/button/Button.vue +0 -31
  161. package/app/components/ui/button/index.ts +0 -35
  162. package/app/components/ui/collapsible/Collapsible.vue +0 -15
  163. package/app/components/ui/collapsible/CollapsibleContent.vue +0 -25
  164. package/app/components/ui/collapsible/CollapsibleTrigger.vue +0 -12
  165. package/app/components/ui/collapsible/index.ts +0 -3
  166. package/app/components/ui/dropdown-menu/DropdownMenu.vue +0 -15
  167. package/app/components/ui/dropdown-menu/DropdownMenuContent.vue +0 -50
  168. package/app/components/ui/dropdown-menu/DropdownMenuItem.vue +0 -41
  169. package/app/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +0 -15
  170. package/app/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +0 -37
  171. package/app/components/ui/dropdown-menu/DropdownMenuSeparator.vue +0 -23
  172. package/app/components/ui/dropdown-menu/DropdownMenuTrigger.vue +0 -14
  173. package/app/components/ui/dropdown-menu/index.ts +0 -7
  174. package/app/components/ui/kbd/Kbd.vue +0 -23
  175. package/app/components/ui/kbd/index.ts +0 -21
  176. package/app/components/ui/scroll-area/ScrollArea.vue +0 -39
  177. package/app/components/ui/scroll-area/ScrollBar.vue +0 -33
  178. package/app/components/ui/scroll-area/index.ts +0 -2
  179. package/app/components/ui/separator/Separator.vue +0 -27
  180. package/app/components/ui/separator/index.ts +0 -1
  181. package/app/components/ui/sheet/Sheet.vue +0 -15
  182. package/app/components/ui/sheet/SheetContent.vue +0 -59
  183. package/app/components/ui/sheet/SheetDescription.vue +0 -21
  184. package/app/components/ui/sheet/SheetOverlay.vue +0 -26
  185. package/app/components/ui/sheet/SheetTitle.vue +0 -21
  186. package/app/components/ui/sheet/SheetTrigger.vue +0 -12
  187. package/app/components/ui/sheet/index.ts +0 -5
  188. package/app/components/ui/tabs/Tabs.vue +0 -24
  189. package/app/components/ui/tabs/TabsList.vue +0 -26
  190. package/app/components/ui/tabs/TabsTrigger.vue +0 -28
  191. package/app/components/ui/tabs/index.ts +0 -3
  192. package/app/composables/site-navigation.utils.ts +0 -133
  193. package/app/composables/useCanonicalUrl.ts +0 -9
  194. package/app/composables/useContentRouteAlternates.ts +0 -35
  195. package/app/composables/useGinkoAnalytics.ts +0 -52
  196. package/app/composables/useGinkoDocsConfig.ts +0 -6
  197. package/app/composables/useGinkoOgImage.ts +0 -20
  198. package/app/composables/useLocalizedPath.ts +0 -12
  199. package/app/composables/useLocalizedRouteSwitch.ts +0 -31
  200. package/app/composables/useMetaKey.ts +0 -18
  201. package/app/composables/usePageMarkdownActions.ts +0 -79
  202. package/app/composables/useProseAppearance.ts +0 -24
  203. package/app/composables/useSchemaJsonLd.ts +0 -25
  204. package/app/composables/useSiteNavigation.ts +0 -64
  205. package/app/config/site.utils.ts +0 -36
  206. package/app/features/docs/components/DocsBreadcrumb.vue +0 -37
  207. package/app/features/docs/components/DocsContributeLinks.vue +0 -75
  208. package/app/features/docs/components/DocsMobileToc.vue +0 -108
  209. package/app/features/docs/components/DocsPageContent.vue +0 -234
  210. package/app/features/docs/components/DocsPageNav.vue +0 -57
  211. package/app/features/docs/components/DocsSidebar.vue +0 -145
  212. package/app/features/docs/components/DocsSidebarDropdown.vue +0 -70
  213. package/app/features/docs/components/DocsSidebarItem.vue +0 -122
  214. package/app/features/docs/components/DocsSidebarList.vue +0 -35
  215. package/app/features/docs/components/DocsSidebarRow.vue +0 -27
  216. package/app/features/docs/components/DocsSidebarTabs.vue +0 -59
  217. package/app/features/docs/components/DocsToc.vue +0 -106
  218. package/app/features/docs/composables/useDocsNavigation.ts +0 -29
  219. package/app/features/docs/composables/useDocsNavigationData.ts +0 -18
  220. package/app/features/docs/composables/useRevealActive.ts +0 -58
  221. package/app/features/docs/composables/useScrollspy.ts +0 -135
  222. package/app/features/docs/docs-navigation.ts +0 -157
  223. package/app/features/docs/toc-context.ts +0 -6
  224. package/app/features/search/command-center.ts +0 -110
  225. package/app/features/search/components/SiteCommandCenter.vue +0 -359
  226. package/app/features/search/components/SiteSearchPageHighlight.vue +0 -126
  227. package/app/features/search/useCommandCenter.ts +0 -292
  228. package/app/layouts/blog.vue +0 -15
  229. package/app/layouts/docs.vue +0 -20
  230. package/app/lib/errors.ts +0 -37
  231. package/app/lib/schema-org.ts +0 -38
  232. package/app/pages/blog/[slug].vue +0 -228
  233. package/app/pages/blog/index.vue +0 -130
  234. package/app/pages/docs/[...slug].vue +0 -10
  235. package/app/pages/docs/index.vue +0 -19
  236. package/app/pages/index.vue +0 -278
  237. package/app/plugins/ginko-docs-theme.ts +0 -14
  238. package/app/plugins/ssr-width.ts +0 -6
  239. package/app/utils/content.ts +0 -67
  240. package/app/utils/file-icons.ts +0 -90
  241. package/app/utils/index.ts +0 -7
  242. package/app/utils/repository.ts +0 -20
  243. package/components.ts +0 -9
  244. package/content-collections.ts +0 -89
  245. package/content.js +0 -200
  246. package/content.ts +0 -104
  247. package/i18n/i18n.config.ts +0 -10
  248. package/i18n/locales.ts +0 -81
  249. package/i18n/messages/global/banner.ts +0 -8
  250. package/i18n/messages/global/blog.ts +0 -18
  251. package/i18n/messages/global/command.ts +0 -49
  252. package/i18n/messages/global/docs.ts +0 -36
  253. package/i18n/messages/global/errors.ts +0 -36
  254. package/i18n/messages/global/feedback.ts +0 -11
  255. package/i18n/messages/global/index.ts +0 -21
  256. package/i18n/messages/global/nav.ts +0 -26
  257. package/i18n/messages/global/site.ts +0 -4
  258. package/i18n/messages/global/theme.ts +0 -9
  259. package/i18n/messages/index.ts +0 -20
  260. package/i18n/messages/localize.ts +0 -35
  261. package/i18n/routes.ts +0 -33
  262. package/icon-bundle.ts +0 -116
  263. package/index.d.ts +0 -37
  264. package/modules/analytics-boundary.ts +0 -23
  265. package/modules/feature-routing.ts +0 -68
  266. package/modules/syntax-highlighting.ts +0 -120
  267. package/public/fonts/public-sans/LICENSE +0 -93
  268. package/public/fonts/public-sans/README.md +0 -12
  269. package/public/fonts/public-sans/public-sans-400-normal-latin.woff +0 -0
  270. package/public/fonts/public-sans/public-sans-500-normal-latin.woff +0 -0
  271. package/public/fonts/public-sans/public-sans-600-normal-latin.woff +0 -0
  272. package/public/fonts/public-sans/public-sans-700-normal-latin.woff +0 -0
  273. package/runtime/generate-favicons.mjs +0 -124
  274. package/runtime/server/agent-markdown.ts +0 -19
  275. package/server/api/_ginko-docs/redirects.get.ts +0 -28
  276. package/server/mcp/tools/get-page.ts +0 -14
  277. package/server/mcp/tools/list-pages.ts +0 -10
  278. package/server/middleware/redirects.ts +0 -22
  279. package/server/plugins/agent-markdown.ts +0 -6
  280. package/server/plugins/sitemap-policy.ts +0 -12
  281. package/server/routes/.well-known/ai-catalog.json.get.ts +0 -10
  282. package/server/routes/[locale]/blog/rss.xml.get.ts +0 -13
  283. package/server/routes/blog/rss.xml.get.ts +0 -5
  284. package/server/routes/mcp/server-card.get.ts +0 -14
  285. package/server/utils/blog-feed.ts +0 -51
  286. package/server/utils/feed.ts +0 -70
  287. package/server/utils/mcp-server-card.ts +0 -45
  288. package/server/utils/redirects.ts +0 -38
  289. package/server/utils/redirects.utils.ts +0 -58
  290. package/server/utils/sitemap.ts +0 -45
  291. package/shared/route-slugs.ts +0 -5
  292. package/shared/theme-palettes.ts +0 -37
  293. package/shared/theme-presets.ts +0 -3
  294. package/shared/types/app-config.ts +0 -172
  295. package/shared/types/nuxt-config.ts +0 -14
  296. package/tags.ts +0 -192
@@ -1,104 +0,0 @@
1
- <script setup lang="ts">
2
- import { Button } from "#ginko-docs/components/ui/button";
3
- import {
4
- DropdownMenu,
5
- DropdownMenuContent,
6
- DropdownMenuItem,
7
- DropdownMenuSeparator,
8
- DropdownMenuTrigger,
9
- } from "#ginko-docs/components/ui/dropdown-menu";
10
- import { computed } from "vue";
11
- import { useI18n } from "#imports";
12
- import { usePageMarkdownActions } from "#ginko-docs/composables/usePageMarkdownActions";
13
-
14
- const props = withDefaults(
15
- defineProps<{
16
- label?: string;
17
- copiedLabel?: string;
18
- }>(),
19
- {},
20
- );
21
-
22
- const { t } = useI18n();
23
- const { actions, chatGptUrl, claudeUrl, copyMarkdown, copyValue, mcpUrl, rawPath, rawUrl, result } =
24
- usePageMarkdownActions();
25
- const label = computed(() => props.label ?? t("docs.copyMarkdown"));
26
- const copiedLabel = computed(() => props.copiedLabel ?? t("docs.copied"));
27
- const markdownSucceeded = computed(
28
- () => result.value?.action === "markdown" && result.value.status === "success",
29
- );
30
- const actionSucceeded = (action: "link" | "mcp") =>
31
- result.value?.action === action && result.value.status === "success";
32
- const statusMessage = computed(() => {
33
- if (!result.value) return "";
34
- return result.value.status === "success" ? copiedLabel.value : t("docs.copyFailed");
35
- });
36
- </script>
37
-
38
- <template>
39
- <div class="inline-flex shrink-0 items-center">
40
- <Button
41
- type="button"
42
- variant="outline"
43
- size="sm"
44
- class="h-9 gap-1.5 rounded-r-none border-r-0 px-2.5 text-xs has-[>svg]:px-2.5"
45
- :aria-label="markdownSucceeded ? copiedLabel : label"
46
- @click="copyMarkdown"
47
- >
48
- <Icon
49
- :name="markdownSucceeded ? 'lucide:check' : 'lucide:copy'"
50
- class="size-3.5"
51
- aria-hidden="true"
52
- />
53
- <span class="hidden sm:inline">{{ markdownSucceeded ? copiedLabel : label }}</span>
54
- </Button>
55
-
56
- <DropdownMenu>
57
- <!-- No tooltip here: Tooltip is itself a popper root, so wrapping the
58
- dropdown trigger steals its anchor and the menu renders off-screen. -->
59
- <DropdownMenuTrigger as-child>
60
- <Button
61
- type="button"
62
- variant="outline"
63
- size="icon"
64
- class="h-9 w-8 rounded-l-none px-0"
65
- :aria-label="t('docs.moreActions')"
66
- >
67
- <Icon name="lucide:chevron-down" class="size-3.5" aria-hidden="true" />
68
- </Button>
69
- </DropdownMenuTrigger>
70
- <DropdownMenuContent align="end" class="w-56">
71
- <DropdownMenuItem @select="copyValue(rawUrl, 'link')">
72
- <Icon :name="actionSucceeded('link') ? 'lucide:check' : 'lucide:link'" />
73
- {{ actionSucceeded("link") ? t("docs.copied") : t("docs.copyLink") }}
74
- </DropdownMenuItem>
75
- <DropdownMenuItem as-child>
76
- <a :href="rawPath" target="_blank" rel="noopener noreferrer">
77
- <Icon name="lucide:file-code-2" />
78
- {{ t("docs.viewMarkdown") }}
79
- </a>
80
- </DropdownMenuItem>
81
- <DropdownMenuItem v-if="actions.claude" as-child>
82
- <a :href="claudeUrl" target="_blank" rel="noopener noreferrer">
83
- <Icon name="lucide:sparkles" />
84
- {{ t("docs.askClaude") }}
85
- </a>
86
- </DropdownMenuItem>
87
- <DropdownMenuItem v-if="actions.chatGpt" as-child>
88
- <a :href="chatGptUrl" target="_blank" rel="noopener noreferrer">
89
- <Icon name="lucide:message-circle" />
90
- {{ t("docs.askChatGpt") }}
91
- </a>
92
- </DropdownMenuItem>
93
- <template v-if="actions.mcp">
94
- <DropdownMenuSeparator />
95
- <DropdownMenuItem @select="copyValue(mcpUrl, 'mcp')">
96
- <Icon :name="actionSucceeded('mcp') ? 'lucide:check' : 'lucide:plug'" />
97
- {{ actionSucceeded("mcp") ? t("docs.copied") : t("docs.copyMcpUrl") }}
98
- </DropdownMenuItem>
99
- </template>
100
- </DropdownMenuContent>
101
- </DropdownMenu>
102
- <span class="sr-only" role="status" aria-live="polite">{{ statusMessage }}</span>
103
- </div>
104
- </template>
@@ -1,25 +0,0 @@
1
- import { useReducedMotion } from "motion-v";
2
- import { computed } from "vue";
3
-
4
- export const imageZoomTransition = {
5
- type: "spring",
6
- bounce: 0,
7
- duration: 0.42,
8
- ease: "easeInOut",
9
- } as const;
10
-
11
- const imageZoomFadeTransition = { duration: 0.16, ease: "easeOut" } as const;
12
- const noMotionTransition = { duration: 0 } as const;
13
-
14
- export function useImageZoomMotion() {
15
- const reducedMotion = useReducedMotion();
16
-
17
- return {
18
- imageTransition: computed(() =>
19
- reducedMotion.value ? noMotionTransition : imageZoomTransition,
20
- ),
21
- fadeTransition: computed(() =>
22
- reducedMotion.value ? noMotionTransition : imageZoomFadeTransition,
23
- ),
24
- };
25
- }
@@ -1,67 +0,0 @@
1
- <script setup lang="ts">
2
- import { onMounted, ref } from "vue";
3
- import { AccordionRoot } from "reka-ui";
4
- import { cn } from "../../utils";
5
- import { useProseAppearance } from "../../composables/useProseAppearance";
6
-
7
- const props = withDefaults(
8
- defineProps<{
9
- type?: "single" | "multiple";
10
- collapsible?: boolean;
11
- defaultValue?: string | string[];
12
- class?: string;
13
- appearance?: "quiet" | "tint";
14
- }>(),
15
- {
16
- type: "single",
17
- collapsible: true,
18
- },
19
- );
20
- const appearance = useProseAppearance("accordion", () => props.appearance);
21
-
22
- const root = ref<HTMLElement | null>(null);
23
- const value = ref<string | string[]>(
24
- props.type === "multiple"
25
- ? ((props.defaultValue as string[]) ?? [])
26
- : ((props.defaultValue as string) ?? ""),
27
- );
28
-
29
- function applyHash(hash: string) {
30
- if (!hash || !root.value) return;
31
- const target = root.value.querySelector<HTMLElement>(`#${CSS.escape(hash)}`);
32
- if (!target) return;
33
-
34
- const accordionValue =
35
- target.dataset.accordionValue ??
36
- target.closest("[data-accordion-value]")?.getAttribute("data-accordion-value");
37
- if (!accordionValue) return;
38
-
39
- if (props.type === "multiple") {
40
- const current = Array.isArray(value.value) ? value.value : [];
41
- value.value = current.includes(accordionValue) ? current : [accordionValue, ...current];
42
- return;
43
- }
44
-
45
- value.value = accordionValue;
46
- }
47
-
48
- onMounted(() => {
49
- applyHash(window.location.hash.slice(1));
50
- });
51
- </script>
52
-
53
- <template>
54
- <div ref="root">
55
- <AccordionRoot
56
- v-model="value"
57
- :type="props.type"
58
- :collapsible="props.collapsible"
59
- :unmount-on-hide="false"
60
- data-slot="accordion"
61
- :data-appearance="appearance"
62
- :class="cn('content-accordion not-prose', props.class)"
63
- >
64
- <slot />
65
- </AccordionRoot>
66
- </div>
67
- </template>
@@ -1,42 +0,0 @@
1
- <script setup lang="ts">
2
- import { useId } from "vue";
3
- import { AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger } from "reka-ui";
4
-
5
- const props = defineProps<{
6
- value?: string;
7
- title?: string;
8
- content?: string;
9
- }>();
10
-
11
- const autoValue = useId();
12
- </script>
13
-
14
- <template>
15
- <AccordionItem
16
- :value="props.value || autoValue"
17
- :data-accordion-value="props.value || autoValue"
18
- class="content-accordion-item"
19
- >
20
- <AccordionHeader class="content-accordion-header">
21
- <AccordionTrigger class="content-accordion-trigger">
22
- <slot name="title">
23
- {{ title }}
24
- </slot>
25
- <Icon name="lucide:chevron-down" class="content-accordion-chevron" aria-hidden="true" />
26
- </AccordionTrigger>
27
- </AccordionHeader>
28
- <AccordionContent
29
- data-slot="accordion-content"
30
- class="content-accordion-content accordion-content"
31
- >
32
- <slot name="content">
33
- <div v-if="content" class="content-accordion-copy">
34
- {{ content }}
35
- </div>
36
- </slot>
37
- <div v-if="$slots.default" class="content-accordion-copy content-prose content-prose-trim">
38
- <slot unwrap="p" />
39
- </div>
40
- </AccordionContent>
41
- </AccordionItem>
42
- </template>
@@ -1,159 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, onMounted, ref, useId } from "vue";
3
- import { cn } from "../../utils";
4
- import { apiEntryId, normalizeApiGroups, signatureTail, splitInlineCode } from "./api.utils";
5
- import { resolveIconifyIcon } from "./icons";
6
- import { useProseAppearance } from "../../composables/useProseAppearance";
7
-
8
- const props = defineProps<{
9
- title?: string;
10
- icon?: string;
11
- method?: string;
12
- path?: string;
13
- groups?: unknown;
14
- appearance?: "quiet" | "tint";
15
- }>();
16
- const appearance = useProseAppearance("api", () => props.appearance);
17
-
18
- const groups = computed(() => normalizeApiGroups(props.groups));
19
- const activeIndex = ref(0);
20
- const panelId = useId();
21
-
22
- const iconName = computed(() => resolveIconifyIcon(props.icon));
23
-
24
- function handleKeydown(event: KeyboardEvent, currentIndex: number) {
25
- let nextIndex: number | undefined;
26
- if (event.key === "ArrowRight") nextIndex = (currentIndex + 1) % groups.value.length;
27
- if (event.key === "ArrowLeft") {
28
- nextIndex = (currentIndex - 1 + groups.value.length) % groups.value.length;
29
- }
30
- if (event.key === "Home") nextIndex = 0;
31
- if (event.key === "End") nextIndex = groups.value.length - 1;
32
- if (nextIndex === undefined) return;
33
-
34
- event.preventDefault();
35
- activeIndex.value = nextIndex;
36
- const tabs = (event.currentTarget as HTMLElement).parentElement?.querySelectorAll<HTMLElement>(
37
- '[role="tab"]',
38
- );
39
- tabs?.[nextIndex]?.focus();
40
- }
41
-
42
- function applyHash(hash: string) {
43
- if (!hash) return;
44
- const index = groups.value.findIndex((group) =>
45
- group.entries.some((entry) => apiEntryId(group.label, entry.name) === hash),
46
- );
47
- if (index === -1) return;
48
- activeIndex.value = index;
49
- requestAnimationFrame(() => {
50
- document.getElementById(hash)?.scrollIntoView();
51
- });
52
- }
53
-
54
- onMounted(() => {
55
- applyHash(window.location.hash.slice(1));
56
- });
57
- </script>
58
-
59
- <template>
60
- <div
61
- v-if="groups.length"
62
- class="content-api content-tabs not-prose"
63
- :data-appearance="appearance"
64
- :data-stacked-header="groups.length > 1 ? 'true' : undefined"
65
- >
66
- <div class="content-tabs-header content-api-header">
67
- <span v-if="method && path" class="content-api-identity">
68
- <span class="content-api-method">
69
- {{ method.toUpperCase() }}
70
- </span>
71
- <span class="content-api-path">{{ path }}</span>
72
- </span>
73
- <span v-else-if="title" class="content-api-identity content-api-title">
74
- <Icon
75
- v-if="iconName"
76
- :name="iconName"
77
- mode="svg"
78
- class="content-api-title-icon"
79
- aria-hidden="true"
80
- />
81
- <span class="content-api-path">{{ title }}</span>
82
- </span>
83
-
84
- <div class="content-tabs-list content-api-tabs" role="tablist">
85
- <button
86
- v-for="(group, index) in groups"
87
- :key="group.label"
88
- type="button"
89
- role="tab"
90
- :id="`${panelId}-tab-${index}`"
91
- :aria-selected="activeIndex === index"
92
- :aria-controls="`${panelId}-${index}`"
93
- :tabindex="activeIndex === index ? 0 : -1"
94
- :class="cn('content-tabs-tab', activeIndex === index && 'content-tabs-tab-active')"
95
- @click="activeIndex = index"
96
- @keydown="handleKeydown($event, index)"
97
- >
98
- {{ group.label }}
99
- <span class="content-api-count">
100
- {{ group.entries.length }}
101
- </span>
102
- </button>
103
- </div>
104
- </div>
105
-
106
- <div class="content-tabs-panels">
107
- <div
108
- v-for="(group, index) in groups"
109
- :id="`${panelId}-${index}`"
110
- :key="group.label"
111
- role="tabpanel"
112
- :aria-labelledby="`${panelId}-tab-${index}`"
113
- :style="activeIndex === index ? undefined : { display: 'none' }"
114
- >
115
- <div
116
- v-for="entry in group.entries"
117
- :id="apiEntryId(group.label, entry.name)"
118
- :key="entry.name"
119
- class="content-api-row"
120
- style="scroll-margin-top: var(--content-scroll-margin)"
121
- >
122
- <code class="content-api-signature" :data-entry="entry.name">
123
- <span
124
- :class="cn('content-api-name', entry.deprecated && 'content-api-name-deprecated')"
125
- >{{ entry.name }}</span
126
- ><span v-if="signatureTail(entry)" class="content-api-type">{{
127
- signatureTail(entry)
128
- }}</span>
129
- </code>
130
-
131
- <span v-if="entry.required || entry.deprecated || entry.since" class="content-api-badges">
132
- <span v-if="entry.required" class="content-api-badge" data-state="required">
133
- required
134
- </span>
135
- <span v-if="entry.deprecated" class="content-api-badge" data-state="deprecated">
136
- deprecated
137
- </span>
138
- <span v-if="entry.since" class="content-api-badge" data-state="since">
139
- since {{ entry.since }}
140
- </span>
141
- </span>
142
-
143
- <!-- A div, not a p: the prose stylesheet's unlayered `.content-prose p`
144
- rules (1rem margins, inherited 1rem/1.75 type) override layered
145
- utilities and are not guarded by not-prose. -->
146
- <div v-if="entry.description" class="content-api-description">
147
- <template
148
- v-for="(part, partIndex) in splitInlineCode(entry.description)"
149
- :key="partIndex"
150
- >
151
- <code v-if="part.code" class="content-api-inline-code">{{ part.text }}</code
152
- ><template v-else>{{ part.text }}</template>
153
- </template>
154
- </div>
155
- </div>
156
- </div>
157
- </div>
158
- </div>
159
- </template>
@@ -1,23 +0,0 @@
1
- <script setup lang="ts">
2
- import type { HTMLAttributes } from "vue";
3
- import { useProseAppearance } from "../../composables/useProseAppearance";
4
- import { cn } from "../../utils";
5
-
6
- const props = defineProps<{
7
- label?: string;
8
- appearance?: "quiet" | "tint";
9
- class?: HTMLAttributes["class"];
10
- }>();
11
- const appearance = useProseAppearance("aside", () => props.appearance);
12
- </script>
13
-
14
- <template>
15
- <aside :data-appearance="appearance" :class="cn('content-aside not-prose', props.class)">
16
- <p v-if="label" class="content-aside-label">
17
- {{ label }}
18
- </p>
19
- <div class="content-aside-body content-prose content-prose-trim">
20
- <slot />
21
- </div>
22
- </aside>
23
- </template>
@@ -1,61 +0,0 @@
1
- <script setup lang="ts">
2
- import type { HTMLAttributes } from "vue";
3
- import { computed } from "vue";
4
- import { useProseAppearance } from "../../composables/useProseAppearance";
5
- import { cn } from "../../utils";
6
- import { resolveIconifyIcon } from "./icons";
7
-
8
- type CalloutType = "note" | "info" | "warning" | "error" | "success" | "idea";
9
-
10
- const props = withDefaults(
11
- defineProps<{
12
- title?: string;
13
- type?: CalloutType;
14
- icon?: string;
15
- appearance?: "quiet" | "tint";
16
- class?: HTMLAttributes["class"];
17
- }>(),
18
- {
19
- type: "info",
20
- },
21
- );
22
-
23
- const appearance = useProseAppearance("callout", () => props.appearance);
24
-
25
- const iconName = computed(() => {
26
- if (props.icon) return resolveIconifyIcon(props.icon) ?? props.icon;
27
-
28
- return (
29
- {
30
- note: "lucide:file-text",
31
- info: "lucide:info",
32
- warning: "lucide:triangle-alert",
33
- error: "lucide:circle-x",
34
- success: "lucide:circle-check",
35
- idea: "lucide:lightbulb",
36
- }[props.type] ?? "lucide:info"
37
- );
38
- });
39
- </script>
40
-
41
- <template>
42
- <div
43
- data-slot="alert"
44
- :data-appearance="appearance"
45
- role="note"
46
- :class="cn('content-callout not-prose my-4', `content-callout-${props.type}`, props.class)"
47
- >
48
- <span class="content-callout-bar" aria-hidden="true" />
49
- <span data-slot="alert-icon" class="content-callout-icon" aria-hidden="true">
50
- <Icon :name="iconName" />
51
- </span>
52
- <div class="content-callout-body">
53
- <div v-if="title" data-slot="alert-title" class="content-alert-title">
54
- {{ title }}
55
- </div>
56
- <div data-slot="alert-description" class="content-prose content-prose-trim">
57
- <slot unwrap="p" />
58
- </div>
59
- </div>
60
- </div>
61
- </template>
@@ -1,175 +0,0 @@
1
- <script setup lang="ts">
2
- import { NuxtLink } from "#components";
3
- import {
4
- computed,
5
- inject,
6
- useSlots,
7
- type ComputedRef,
8
- type CSSProperties,
9
- type HTMLAttributes,
10
- } from "vue";
11
- import { cn } from "../../utils";
12
- import { isExternalLink, resolveIconifyIcon } from "./icons";
13
- import { useProseAppearance } from "../../composables/useProseAppearance";
14
-
15
- type CardIconColor =
16
- | "muted"
17
- | "foreground"
18
- | "primary"
19
- | "info"
20
- | "success"
21
- | "warning"
22
- | "destructive";
23
-
24
- const props = withDefaults(
25
- defineProps<{
26
- title?: string;
27
- description?: string;
28
- footer?: string;
29
- to?: string;
30
- target?: string;
31
- icon?: string;
32
- iconColor?: CardIconColor;
33
- img?: string;
34
- showLinkIcon?: boolean;
35
- horizontal?: boolean;
36
- inStack?: boolean;
37
- class?: HTMLAttributes["class"];
38
- appearance?: "quiet" | "tint";
39
- }>(),
40
- {
41
- showLinkIcon: true,
42
- horizontal: false,
43
- inStack: false,
44
- },
45
- );
46
-
47
- const slots = useSlots();
48
- const inGroup = inject("contentCardInGroup", false);
49
- // Instance prop wins, then the surrounding ::cards tray, then config.
50
- const groupAppearance = inject<ComputedRef<"quiet" | "tint"> | null>(
51
- "contentCardsAppearance",
52
- null,
53
- );
54
- const appearance = useProseAppearance("cards", () => props.appearance ?? groupAppearance?.value);
55
-
56
- const wrapperTag = computed(() => (props.to ? (isExternalLink(props.to) ? "a" : NuxtLink) : "div"));
57
-
58
- const linkProps = computed(() => {
59
- if (!props.to) return null;
60
- if (isExternalLink(props.to)) {
61
- return {
62
- href: props.to,
63
- target: props.target,
64
- rel: "noreferrer noopener",
65
- };
66
- }
67
- return {
68
- to: props.to,
69
- target: props.target,
70
- };
71
- });
72
-
73
- const iconName = computed(() => resolveIconifyIcon(props.icon));
74
-
75
- const hasHeader = computed(() =>
76
- Boolean(props.title || props.description || slots.title || slots.description || props.icon),
77
- );
78
-
79
- const hasFooter = computed(() => Boolean(props.footer || slots.footer));
80
-
81
- const hasBody = computed(() => Boolean(slots.default));
82
-
83
- const showOutgoingLinkIcon = computed(
84
- () => props.showLinkIcon && Boolean(props.to && isExternalLink(props.to)),
85
- );
86
-
87
- const cardIconColor = computed(() => {
88
- if (!props.iconColor || props.iconColor === "muted") return undefined;
89
-
90
- return {
91
- foreground: "var(--foreground)",
92
- primary: "var(--primary)",
93
- info: "var(--info)",
94
- success: "var(--success)",
95
- warning: "var(--warning)",
96
- destructive: "var(--destructive)",
97
- }[props.iconColor];
98
- });
99
-
100
- const cardIconStyle = computed<CSSProperties | undefined>(() =>
101
- cardIconColor.value
102
- ? ({ "--content-card-icon-color": cardIconColor.value } as CSSProperties)
103
- : undefined,
104
- );
105
- </script>
106
-
107
- <template>
108
- <component
109
- :is="wrapperTag"
110
- v-bind="linkProps || {}"
111
- :data-appearance="appearance"
112
- :class="
113
- cn(
114
- 'content-card group not-prose',
115
- !inStack && !inGroup && 'content-card-standalone',
116
- inStack && 'content-card-in-stack',
117
- to && 'focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none',
118
- props.class,
119
- )
120
- "
121
- >
122
- <div data-slot="card" class="content-card-surface">
123
- <img v-if="img" :src="img" alt="" class="content-card-media" />
124
-
125
- <div
126
- v-if="hasHeader"
127
- class="content-card-header"
128
- :data-trailing="hasBody || hasFooter ? 'true' : undefined"
129
- :data-horizontal="horizontal ? 'true' : undefined"
130
- :data-reserve-link-icon="showOutgoingLinkIcon ? 'true' : undefined"
131
- >
132
- <div
133
- v-if="iconName"
134
- v-bind="cardIconStyle ? { style: cardIconStyle } : {}"
135
- class="content-card-icon content-card-tile"
136
- >
137
- <Icon :name="iconName" aria-hidden="true" />
138
- </div>
139
-
140
- <div class="content-card-copy">
141
- <div v-if="title || $slots.title" data-slot="card-title" class="content-card-title">
142
- <slot name="title">{{ title }}</slot>
143
- </div>
144
- <div
145
- v-if="description || $slots.description"
146
- data-slot="card-description"
147
- class="content-card-description"
148
- >
149
- <slot name="description">{{ description }}</slot>
150
- </div>
151
- </div>
152
- </div>
153
-
154
- <div
155
- v-if="hasBody"
156
- data-slot="card-content"
157
- class="content-card-body content-prose content-prose-trim"
158
- :data-reserve-link-icon="showOutgoingLinkIcon && !hasHeader ? 'true' : undefined"
159
- >
160
- <slot unwrap="p" />
161
- </div>
162
-
163
- <div v-if="hasFooter" data-slot="card-footer" class="content-card-footer">
164
- <slot name="footer">{{ footer }}</slot>
165
- </div>
166
-
167
- <Icon
168
- v-if="showOutgoingLinkIcon"
169
- name="lucide:arrow-up-right"
170
- class="content-card-arrow"
171
- aria-hidden="true"
172
- />
173
- </div>
174
- </component>
175
- </template>
@@ -1,30 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, provide, type HTMLAttributes } from "vue";
3
- import { useProseAppearance } from "../../composables/useProseAppearance";
4
- import { cn } from "../../utils";
5
-
6
- const props = withDefaults(
7
- defineProps<{
8
- cols?: 1 | 2 | 3 | "1" | "2" | "3";
9
- appearance?: "quiet" | "tint";
10
- class?: HTMLAttributes["class"];
11
- }>(),
12
- { cols: 2 },
13
- );
14
-
15
- provide("contentCardInGroup", true);
16
- const appearance = useProseAppearance("cards", () => props.appearance);
17
- // Children must render on the same surface as the tray they sit in.
18
- provide("contentCardsAppearance", appearance);
19
- const columns = computed(() => Math.min(3, Math.max(1, Number(props.cols) || 2)));
20
- </script>
21
-
22
- <template>
23
- <div
24
- :class="cn('content-cards not-prose', props.class)"
25
- :data-appearance="appearance"
26
- :data-columns="columns"
27
- >
28
- <slot />
29
- </div>
30
- </template>