@lupinum/ginko-docs 0.2.2 → 0.2.5

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 (206) hide show
  1. package/README.md +130 -73
  2. package/app/app.config.ts +15 -13
  3. package/app/app.vue +4 -2
  4. package/app/assets/css/prose.css +2203 -149
  5. package/app/assets/css/tailwind.css +60 -38
  6. package/app/assets/css/theme-palettes.css +309 -0
  7. package/app/components/content/DocumentPageShell.vue +1 -1
  8. package/app/components/content/Feedback.vue +12 -11
  9. package/app/components/content/ImageZoomDialog.vue +84 -0
  10. package/app/components/content/PageMarkdownCopy.vue +2 -0
  11. package/app/components/content/imageZoom.ts +25 -0
  12. package/app/components/mdc/MdcAccordion.vue +6 -3
  13. package/app/components/mdc/MdcAccordionItem.vue +7 -16
  14. package/app/components/mdc/MdcApi.vue +159 -0
  15. package/app/components/mdc/MdcAside.vue +6 -10
  16. package/app/components/mdc/MdcCallout.vue +9 -10
  17. package/app/components/mdc/MdcCard.vue +36 -47
  18. package/app/components/mdc/MdcCards.vue +30 -0
  19. package/app/components/mdc/MdcCodeGroup.vue +4 -0
  20. package/app/components/mdc/MdcCodeTree.vue +234 -0
  21. package/app/components/mdc/MdcCollapse.vue +61 -0
  22. package/app/components/mdc/MdcError.vue +8 -1
  23. package/app/components/mdc/MdcExcerpt.vue +26 -0
  24. package/app/components/mdc/MdcFigure.vue +54 -20
  25. package/app/components/mdc/MdcFiles.vue +120 -0
  26. package/app/components/mdc/MdcIdea.vue +2 -1
  27. package/app/components/mdc/MdcInfo.vue +2 -1
  28. package/app/components/mdc/MdcInlineToc.vue +51 -0
  29. package/app/components/{ui/dialog/DialogHeader.vue → mdc/MdcKbd.vue} +2 -4
  30. package/app/components/mdc/MdcNote.vue +2 -1
  31. package/app/components/mdc/MdcQuiz.vue +43 -83
  32. package/app/components/mdc/MdcQuizQuestion.vue +104 -109
  33. package/app/components/mdc/MdcReadMore.vue +57 -77
  34. package/app/components/mdc/MdcSteps.vue +45 -11
  35. package/app/components/mdc/MdcSuccess.vue +8 -1
  36. package/app/components/mdc/MdcTabs.vue +44 -26
  37. package/app/components/mdc/MdcTimeline.vue +4 -1
  38. package/app/components/mdc/MdcTimelineItem.vue +18 -27
  39. package/app/components/mdc/MdcWarning.vue +8 -1
  40. package/app/components/mdc/api.utils.ts +132 -0
  41. package/app/components/mdc/code-tree.utils.ts +22 -0
  42. package/app/components/mdc/quiz.utils.ts +38 -0
  43. package/app/components/prose/ProseBlockquote.vue +17 -1
  44. package/app/components/prose/ProseH1.vue +1 -1
  45. package/app/components/prose/ProseH2.vue +7 -2
  46. package/app/components/prose/ProseH3.vue +7 -2
  47. package/app/components/prose/ProseH4.vue +17 -2
  48. package/app/components/{ui/kbd/KbdGroup.vue → prose/ProseH5.vue} +4 -3
  49. package/app/components/{ui/card/CardTitle.vue → prose/ProseH6.vue} +4 -3
  50. package/app/components/prose/ProseImg.vue +34 -99
  51. package/app/components/prose/ProsePre.vue +63 -100
  52. package/app/components/prose/ProseTable.vue +5 -3
  53. package/app/components/site/ModeToggle.vue +12 -3
  54. package/app/components/site/SiteBanner.vue +43 -2
  55. package/app/components/site/SiteFooter.vue +3 -5
  56. package/app/components/site/SiteHeader.vue +266 -132
  57. package/app/components/site/SiteHeroCode.vue +164 -0
  58. package/app/components/site/SiteLocaleSwitcher.vue +25 -9
  59. package/app/components/site/SiteSocialLinks.vue +31 -0
  60. package/app/components/ui/badge/Badge.vue +1 -1
  61. package/app/components/ui/button/Button.vue +1 -1
  62. package/app/components/ui/collapsible/CollapsibleContent.vue +1 -1
  63. package/app/components/ui/dropdown-menu/DropdownMenuContent.vue +14 -4
  64. package/app/components/ui/dropdown-menu/DropdownMenuItem.vue +1 -1
  65. package/app/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +1 -1
  66. package/app/components/ui/dropdown-menu/DropdownMenuSeparator.vue +1 -1
  67. package/app/components/ui/dropdown-menu/index.ts +0 -9
  68. package/app/components/ui/kbd/Kbd.vue +1 -1
  69. package/app/components/ui/kbd/index.ts +0 -1
  70. package/app/components/ui/scroll-area/ScrollArea.vue +1 -1
  71. package/app/components/ui/scroll-area/ScrollBar.vue +1 -1
  72. package/app/components/ui/separator/Separator.vue +1 -1
  73. package/app/components/ui/sheet/SheetContent.vue +1 -1
  74. package/app/components/ui/sheet/SheetDescription.vue +1 -1
  75. package/app/components/ui/sheet/SheetOverlay.vue +1 -1
  76. package/app/components/ui/sheet/SheetTitle.vue +1 -1
  77. package/app/components/ui/sheet/index.ts +0 -3
  78. package/app/components/ui/tabs/Tabs.vue +1 -1
  79. package/app/components/ui/tabs/TabsList.vue +1 -1
  80. package/app/components/ui/tabs/TabsTrigger.vue +1 -1
  81. package/app/components/ui/tabs/index.ts +0 -1
  82. package/app/composables/site-navigation.utils.ts +69 -12
  83. package/app/composables/useContentRouteAlternates.ts +13 -21
  84. package/app/composables/useLocalizedRouteSwitch.ts +1 -1
  85. package/app/composables/useMetaKey.ts +18 -0
  86. package/app/composables/useProseAppearance.ts +24 -0
  87. package/app/composables/useSiteNavigation.ts +10 -40
  88. package/app/config/site.utils.ts +1 -1
  89. package/app/error.vue +1 -5
  90. package/app/features/docs/components/DocsBreadcrumb.vue +37 -0
  91. package/app/features/docs/components/DocsContributeLinks.vue +28 -18
  92. package/app/features/docs/components/DocsMobileToc.vue +12 -8
  93. package/app/features/docs/components/DocsPageContent.vue +93 -47
  94. package/app/features/docs/components/DocsPageNav.vue +1 -1
  95. package/app/features/docs/components/DocsSidebar.vue +37 -21
  96. package/app/features/docs/components/DocsSidebarItem.vue +53 -100
  97. package/app/features/docs/components/DocsSidebarRow.vue +27 -0
  98. package/app/features/docs/components/DocsSidebarTabs.vue +46 -22
  99. package/app/features/docs/components/DocsToc.vue +80 -34
  100. package/app/features/docs/composables/useDocsNavigation.ts +2 -2
  101. package/app/features/docs/composables/useDocsNavigationData.ts +4 -1
  102. package/app/features/docs/composables/useRevealActive.ts +58 -0
  103. package/app/features/docs/composables/useScrollspy.ts +87 -19
  104. package/app/features/docs/docs-navigation.ts +17 -30
  105. package/app/features/docs/toc-context.ts +6 -0
  106. package/app/features/search/command-center.ts +11 -90
  107. package/app/features/search/components/SiteCommandCenter.vue +58 -38
  108. package/app/features/search/useCommandCenter.ts +48 -48
  109. package/app/layouts/docs.vue +1 -1
  110. package/app/lib/errors.ts +2 -49
  111. package/app/pages/blog/[slug].vue +26 -9
  112. package/app/pages/blog/index.vue +38 -14
  113. package/app/pages/docs/index.vue +10 -14
  114. package/app/pages/index.vue +180 -61
  115. package/app/plugins/ginko-docs-theme.ts +12 -0
  116. package/app/utils/content.ts +11 -0
  117. package/app/utils/file-icons.ts +90 -0
  118. package/app/utils/index.ts +7 -1
  119. package/app/utils/repository.ts +20 -0
  120. package/content.js +68 -50
  121. package/content.ts +51 -32
  122. package/i18n/messages/global/blog.ts +4 -0
  123. package/i18n/messages/global/command.ts +6 -2
  124. package/i18n/messages/global/docs.ts +4 -0
  125. package/i18n/messages/global/nav.ts +6 -3
  126. package/i18n/messages/index.ts +3 -3
  127. package/icon-bundle.ts +9 -56
  128. package/index.d.ts +7 -1
  129. package/modules/feature-routing.ts +15 -0
  130. package/nuxt.config.ts +21 -7
  131. package/package.json +29 -26
  132. package/runtime/server/agent-markdown.ts +0 -2
  133. package/server/api/_ginko-docs/redirects.get.ts +28 -0
  134. package/server/middleware/redirects.ts +22 -0
  135. package/server/routes/[locale]/blog/rss.xml.get.ts +13 -0
  136. package/server/routes/blog/rss.xml.get.ts +5 -0
  137. package/server/utils/blog-feed.ts +49 -0
  138. package/server/utils/feed.ts +70 -0
  139. package/server/utils/redirects.ts +38 -0
  140. package/server/utils/redirects.utils.ts +58 -0
  141. package/shared/theme-palettes.ts +37 -0
  142. package/shared/types/app-config.ts +75 -10
  143. package/tags.ts +47 -59
  144. package/app/components/mdc/MdcAlert.vue +0 -34
  145. package/app/components/mdc/MdcCardGroup.vue +0 -47
  146. package/app/components/mdc/MdcDocImg.vue +0 -25
  147. package/app/components/mdc/MdcField.vue +0 -62
  148. package/app/components/mdc/MdcFieldGroup.vue +0 -18
  149. package/app/components/mdc/MdcPassage.vue +0 -32
  150. package/app/components/mdc/MdcQuizOption.vue +0 -91
  151. package/app/components/mdc/MdcReadMoreGroup.vue +0 -18
  152. package/app/components/mdc/MdcShortcut.vue +0 -46
  153. package/app/components/mdc/MdcStep.vue +0 -42
  154. package/app/components/ui/accordion/Accordion.vue +0 -15
  155. package/app/components/ui/accordion/AccordionContent.vue +0 -23
  156. package/app/components/ui/accordion/AccordionItem.vue +0 -24
  157. package/app/components/ui/accordion/AccordionTrigger.vue +0 -35
  158. package/app/components/ui/accordion/index.ts +0 -4
  159. package/app/components/ui/alert/Alert.vue +0 -21
  160. package/app/components/ui/alert/AlertDescription.vue +0 -22
  161. package/app/components/ui/alert/AlertTitle.vue +0 -22
  162. package/app/components/ui/alert/index.ts +0 -34
  163. package/app/components/ui/card/Card.vue +0 -16
  164. package/app/components/ui/card/CardAction.vue +0 -17
  165. package/app/components/ui/card/CardContent.vue +0 -14
  166. package/app/components/ui/card/CardDescription.vue +0 -14
  167. package/app/components/ui/card/CardFooter.vue +0 -14
  168. package/app/components/ui/card/CardHeader.vue +0 -22
  169. package/app/components/ui/card/card-variants.ts +0 -15
  170. package/app/components/ui/card/index.ts +0 -8
  171. package/app/components/ui/checkbox/Checkbox.vue +0 -35
  172. package/app/components/ui/checkbox/index.ts +0 -1
  173. package/app/components/ui/dialog/Dialog.vue +0 -15
  174. package/app/components/ui/dialog/DialogClose.vue +0 -12
  175. package/app/components/ui/dialog/DialogContent.vue +0 -69
  176. package/app/components/ui/dialog/DialogDescription.vue +0 -21
  177. package/app/components/ui/dialog/DialogFooter.vue +0 -15
  178. package/app/components/ui/dialog/DialogOverlay.vue +0 -26
  179. package/app/components/ui/dialog/DialogPortal.vue +0 -12
  180. package/app/components/ui/dialog/DialogTitle.vue +0 -21
  181. package/app/components/ui/dialog/DialogTrigger.vue +0 -12
  182. package/app/components/ui/dialog/index.ts +0 -10
  183. package/app/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +0 -36
  184. package/app/components/ui/dropdown-menu/DropdownMenuGroup.vue +0 -12
  185. package/app/components/ui/dropdown-menu/DropdownMenuLabel.vue +0 -25
  186. package/app/components/ui/dropdown-menu/DropdownMenuShortcut.vue +0 -17
  187. package/app/components/ui/dropdown-menu/DropdownMenuSub.vue +0 -15
  188. package/app/components/ui/dropdown-menu/DropdownMenuSubContent.vue +0 -29
  189. package/app/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +0 -31
  190. package/app/components/ui/input/Input.vue +0 -23
  191. package/app/components/ui/input/index.ts +0 -1
  192. package/app/components/ui/label/Label.vue +0 -14
  193. package/app/components/ui/label/index.ts +0 -1
  194. package/app/components/ui/sheet/SheetClose.vue +0 -12
  195. package/app/components/ui/sheet/SheetFooter.vue +0 -12
  196. package/app/components/ui/sheet/SheetHeader.vue +0 -12
  197. package/app/components/ui/switch/Switch.vue +0 -39
  198. package/app/components/ui/switch/index.ts +0 -1
  199. package/app/components/ui/tabs/TabsContent.vue +0 -21
  200. package/app/components/ui/textarea/Textarea.vue +0 -31
  201. package/app/components/ui/textarea/index.ts +0 -1
  202. package/app/features/docs/composables/useDocsEntryPath.ts +0 -13
  203. package/app/lib/utils.ts +0 -7
  204. package/i18n/messages/source.ts +0 -5
  205. package/runtime/markdown/inline-code-highlight.ts +0 -155
  206. package/runtime/utils.ts +0 -7
@@ -1,21 +0,0 @@
1
- <script setup lang="ts">
2
- import type { TabsContentProps } from "reka-ui";
3
- import type { HTMLAttributes } from "vue";
4
- import { reactiveOmit } from "@vueuse/core";
5
- import { TabsContent } from "reka-ui";
6
- import { cn } from "#ginko-docs/lib/utils";
7
-
8
- const props = defineProps<TabsContentProps & { class?: HTMLAttributes["class"] }>();
9
-
10
- const delegatedProps = reactiveOmit(props, "class");
11
- </script>
12
-
13
- <template>
14
- <TabsContent
15
- data-slot="tabs-content"
16
- :class="cn('flex-1 outline-none', props.class)"
17
- v-bind="delegatedProps"
18
- >
19
- <slot />
20
- </TabsContent>
21
- </template>
@@ -1,31 +0,0 @@
1
- <script setup lang="ts">
2
- import type { HTMLAttributes } from "vue";
3
- import { ref } from "vue";
4
- import { cn } from "#ginko-docs/lib/utils";
5
- import { h } from "vue";
6
-
7
- const model = defineModel<string>();
8
- const textarea = ref<HTMLTextAreaElement | null>(null);
9
-
10
- const props = defineProps<{
11
- class?: HTMLAttributes["class"];
12
- }>();
13
-
14
- defineExpose({
15
- focus: () => textarea.value?.focus(),
16
- });
17
- </script>
18
-
19
- <template>
20
- <textarea
21
- ref="textarea"
22
- v-model="model"
23
- data-slot="textarea"
24
- :class="
25
- cn(
26
- 'min-h-36 w-full resize-y rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground shadow-xs transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40',
27
- props.class,
28
- )
29
- "
30
- />
31
- </template>
@@ -1 +0,0 @@
1
- export { default as Textarea } from "./Textarea.vue";
@@ -1,13 +0,0 @@
1
- import { computed } from "vue";
2
- import { findFirstNavigationPage } from "@lupinum/ginko-content/client";
3
- import { useLocalizedPath } from "#ginko-docs/composables/useLocalizedPath";
4
- import { useDocsNavigationData } from "./useDocsNavigationData";
5
-
6
- export async function useDocsEntryPath() {
7
- const localizedPath = useLocalizedPath();
8
- const { data } = await useDocsNavigationData();
9
-
10
- return computed(
11
- () => findFirstNavigationPage(data.value ?? undefined)?.path ?? localizedPath("docs"),
12
- );
13
- }
package/app/lib/utils.ts DELETED
@@ -1,7 +0,0 @@
1
- import type { ClassValue } from "clsx";
2
- import { clsx } from "clsx";
3
- import { twMerge } from "tailwind-merge";
4
-
5
- export function cn(...inputs: ClassValue[]) {
6
- return twMerge(clsx(inputs));
7
- }
@@ -1,5 +0,0 @@
1
- import { globalMessages } from "./global";
2
-
3
- export const messageSource = {
4
- ...globalMessages,
5
- } as const;
@@ -1,155 +0,0 @@
1
- import type { ComarkElement, ComarkNode, ComarkPluginFactory } from "comark";
2
- import { getHighlighter, type HighlightOptions } from "comark/plugins/highlight";
3
- import { codeToTokens, getTokenStyleObject, stringifyTokenStyle } from "shiki/core";
4
-
5
- type CodeAttributes = {
6
- class?: string;
7
- lang?: string;
8
- language?: string;
9
- };
10
-
11
- type ThemeRegistration = NonNullable<NonNullable<HighlightOptions["themes"]>["light"]>;
12
-
13
- type CodeThemes = {
14
- light: ThemeRegistration;
15
- dark: ThemeRegistration;
16
- };
17
-
18
- function cloneTheme<T extends ThemeRegistration>(theme: T): T {
19
- return structuredClone(theme);
20
- }
21
-
22
- async function resolveCodeThemes(themes?: HighlightOptions["themes"]): Promise<CodeThemes> {
23
- if (themes?.light || themes?.dark) {
24
- const light = themes.light || themes.dark;
25
- const dark = themes.dark || themes.light;
26
-
27
- return {
28
- light: cloneTheme(light as ThemeRegistration),
29
- dark: cloneTheme(dark as ThemeRegistration),
30
- };
31
- }
32
-
33
- const [light, dark] = await Promise.all([
34
- import("shiki/dist/themes/material-theme-lighter.mjs"),
35
- import("shiki/dist/themes/material-theme-palenight.mjs"),
36
- ]);
37
-
38
- return {
39
- light: cloneTheme(light.default),
40
- dark: cloneTheme(dark.default),
41
- };
42
- }
43
-
44
- function getThemeName(theme: ThemeRegistration, fallback: string): string {
45
- return typeof theme === "object" &&
46
- theme !== null &&
47
- "name" in theme &&
48
- typeof theme.name === "string"
49
- ? theme.name
50
- : fallback;
51
- }
52
-
53
- function isElement(node: ComarkNode): node is ComarkElement {
54
- return Array.isArray(node) && typeof node[0] === "string";
55
- }
56
-
57
- function getCodeLanguage(attrs: CodeAttributes): string | undefined {
58
- const language = attrs.language ?? attrs.lang;
59
-
60
- return language?.trim() || undefined;
61
- }
62
-
63
- function appendClass(attrs: CodeAttributes, className: string): CodeAttributes {
64
- return {
65
- ...attrs,
66
- class: [attrs.class, className].filter(Boolean).join(" "),
67
- };
68
- }
69
-
70
- async function highlightInlineCodeNode(
71
- node: ComarkElement,
72
- options: HighlightOptions,
73
- ): Promise<ComarkElement> {
74
- const attrs = (node[1] ?? {}) as CodeAttributes;
75
- const language = getCodeLanguage(attrs);
76
- const code = node
77
- .slice(2)
78
- .filter((child): child is string => typeof child === "string")
79
- .join("");
80
-
81
- if (!language || !code) {
82
- return node;
83
- }
84
-
85
- const themes = await resolveCodeThemes(options.themes);
86
- const lightThemeName = getThemeName(themes.light, "material-theme-lighter");
87
- const darkThemeName = getThemeName(themes.dark, "material-theme-palenight");
88
- const highlighter = await getHighlighter({
89
- ...options,
90
- registerDefaultThemes: false,
91
- themes,
92
- });
93
- const result = codeToTokens(highlighter, code, {
94
- lang: language,
95
- themes: {
96
- light: lightThemeName,
97
- dark: lightThemeName !== darkThemeName ? darkThemeName : undefined,
98
- },
99
- });
100
- const children: ComarkNode[] = [];
101
-
102
- for (let lineIndex = 0; lineIndex < result.tokens.length; lineIndex += 1) {
103
- const line = result.tokens[lineIndex] ?? [];
104
-
105
- for (const token of line) {
106
- const style = stringifyTokenStyle(token.htmlStyle || getTokenStyleObject(token));
107
- children.push(style ? ["span", { style }, token.content] : ["span", {}, token.content]);
108
- }
109
-
110
- if (lineIndex < result.tokens.length - 1) {
111
- children.push("\n");
112
- }
113
- }
114
-
115
- return [
116
- "code",
117
- appendClass(attrs, `shiki ${result.themeName || ""} language-${language}`.trim()),
118
- ...children,
119
- ];
120
- }
121
-
122
- async function highlightInlineCodeChildren(
123
- parent: ComarkElement,
124
- options: HighlightOptions,
125
- ): Promise<void> {
126
- const insidePre = parent[0] === "pre";
127
-
128
- for (let index = 2; index < parent.length; index += 1) {
129
- const child = parent[index] as ComarkNode;
130
-
131
- if (!isElement(child)) {
132
- continue;
133
- }
134
-
135
- if (!insidePre && child[0] === "code") {
136
- parent[index] = await highlightInlineCodeNode(child, options);
137
- continue;
138
- }
139
-
140
- await highlightInlineCodeChildren(child, options);
141
- }
142
- }
143
-
144
- const inlineCodeHighlightPlugin: ComarkPluginFactory<HighlightOptions> = (options = {}) => ({
145
- name: "inline-code-highlight",
146
- async post(state) {
147
- for (const node of state.tree.nodes) {
148
- if (isElement(node)) {
149
- await highlightInlineCodeChildren(node, options);
150
- }
151
- }
152
- },
153
- });
154
-
155
- export default inlineCodeHighlightPlugin;
package/runtime/utils.ts DELETED
@@ -1,7 +0,0 @@
1
- import type { ClassValue } from "clsx";
2
- import { clsx } from "clsx";
3
- import { twMerge } from "tailwind-merge";
4
-
5
- export function cn(...inputs: ClassValue[]) {
6
- return twMerge(clsx(inputs));
7
- }