@lupinum/ginko-docs 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +130 -73
- package/app/app.config.ts +14 -12
- package/app/app.vue +2 -2
- package/app/assets/css/prose.css +2203 -149
- package/app/assets/css/tailwind.css +60 -38
- package/app/assets/css/theme-palettes.css +309 -0
- package/app/components/content/DocumentPageShell.vue +1 -1
- package/app/components/content/Feedback.vue +12 -11
- package/app/components/content/ImageZoomDialog.vue +84 -0
- package/app/components/content/PageMarkdownCopy.vue +2 -0
- package/app/components/content/imageZoom.ts +25 -0
- package/app/components/mdc/MdcAccordion.vue +6 -3
- package/app/components/mdc/MdcAccordionItem.vue +7 -16
- package/app/components/mdc/MdcApi.vue +159 -0
- package/app/components/mdc/MdcAside.vue +6 -10
- package/app/components/mdc/MdcCallout.vue +9 -10
- package/app/components/mdc/MdcCard.vue +36 -47
- package/app/components/mdc/MdcCards.vue +30 -0
- package/app/components/mdc/MdcCodeGroup.vue +4 -0
- package/app/components/mdc/MdcCodeTree.vue +234 -0
- package/app/components/mdc/MdcCollapse.vue +61 -0
- package/app/components/mdc/MdcError.vue +8 -1
- package/app/components/mdc/MdcExcerpt.vue +26 -0
- package/app/components/mdc/MdcFigure.vue +54 -20
- package/app/components/mdc/MdcFiles.vue +120 -0
- package/app/components/mdc/MdcIdea.vue +2 -1
- package/app/components/mdc/MdcInfo.vue +2 -1
- package/app/components/mdc/MdcInlineToc.vue +51 -0
- package/app/components/{ui/dialog/DialogHeader.vue → mdc/MdcKbd.vue} +2 -4
- package/app/components/mdc/MdcNote.vue +2 -1
- package/app/components/mdc/MdcQuiz.vue +43 -83
- package/app/components/mdc/MdcQuizQuestion.vue +104 -109
- package/app/components/mdc/MdcReadMore.vue +57 -77
- package/app/components/mdc/MdcSteps.vue +45 -11
- package/app/components/mdc/MdcSuccess.vue +8 -1
- package/app/components/mdc/MdcTabs.vue +44 -26
- package/app/components/mdc/MdcTimeline.vue +4 -1
- package/app/components/mdc/MdcTimelineItem.vue +18 -27
- package/app/components/mdc/MdcWarning.vue +8 -1
- package/app/components/mdc/api.utils.ts +132 -0
- package/app/components/mdc/code-tree.utils.ts +22 -0
- package/app/components/mdc/quiz.utils.ts +38 -0
- package/app/components/prose/ProseBlockquote.vue +17 -1
- package/app/components/prose/ProseH1.vue +1 -1
- package/app/components/prose/ProseH2.vue +7 -2
- package/app/components/prose/ProseH3.vue +7 -2
- package/app/components/prose/ProseH4.vue +17 -2
- package/app/components/{ui/kbd/KbdGroup.vue → prose/ProseH5.vue} +4 -3
- package/app/components/{ui/card/CardTitle.vue → prose/ProseH6.vue} +4 -3
- package/app/components/prose/ProseImg.vue +19 -112
- package/app/components/prose/ProsePre.vue +63 -100
- package/app/components/prose/ProseTable.vue +5 -3
- package/app/components/site/ModeToggle.vue +12 -3
- package/app/components/site/SiteBanner.vue +43 -2
- package/app/components/site/SiteFooter.vue +3 -5
- package/app/components/site/SiteHeader.vue +255 -132
- package/app/components/site/SiteHeroCode.vue +164 -0
- package/app/components/site/SiteLocaleSwitcher.vue +22 -4
- package/app/components/ui/badge/Badge.vue +1 -1
- package/app/components/ui/button/Button.vue +1 -1
- package/app/components/ui/collapsible/CollapsibleContent.vue +1 -1
- package/app/components/ui/dropdown-menu/DropdownMenuContent.vue +14 -4
- package/app/components/ui/dropdown-menu/DropdownMenuItem.vue +1 -1
- package/app/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +1 -1
- package/app/components/ui/dropdown-menu/DropdownMenuSeparator.vue +1 -1
- package/app/components/ui/dropdown-menu/index.ts +0 -9
- package/app/components/ui/kbd/Kbd.vue +1 -1
- package/app/components/ui/kbd/index.ts +0 -1
- package/app/components/ui/scroll-area/ScrollArea.vue +1 -1
- package/app/components/ui/scroll-area/ScrollBar.vue +1 -1
- package/app/components/ui/separator/Separator.vue +1 -1
- package/app/components/ui/sheet/SheetContent.vue +1 -1
- package/app/components/ui/sheet/SheetDescription.vue +1 -1
- package/app/components/ui/sheet/SheetOverlay.vue +1 -1
- package/app/components/ui/sheet/SheetTitle.vue +1 -1
- package/app/components/ui/sheet/index.ts +0 -3
- package/app/components/ui/tabs/Tabs.vue +1 -1
- package/app/components/ui/tabs/TabsList.vue +1 -1
- package/app/components/ui/tabs/TabsTrigger.vue +1 -1
- package/app/components/ui/tabs/index.ts +0 -1
- package/app/composables/site-navigation.utils.ts +29 -11
- package/app/composables/useContentRouteAlternates.ts +13 -21
- package/app/composables/useLocalizedRouteSwitch.ts +1 -1
- package/app/composables/useMetaKey.ts +18 -0
- package/app/composables/useProseAppearance.ts +24 -0
- package/app/composables/useSiteNavigation.ts +3 -18
- package/app/config/site.utils.ts +1 -1
- package/app/error.vue +1 -5
- package/app/features/docs/components/DocsBreadcrumb.vue +37 -0
- package/app/features/docs/components/DocsContributeLinks.vue +28 -18
- package/app/features/docs/components/DocsMobileToc.vue +12 -8
- package/app/features/docs/components/DocsPageContent.vue +84 -47
- package/app/features/docs/components/DocsPageNav.vue +1 -1
- package/app/features/docs/components/DocsSidebar.vue +30 -20
- package/app/features/docs/components/DocsSidebarItem.vue +53 -100
- package/app/features/docs/components/DocsSidebarRow.vue +27 -0
- package/app/features/docs/components/DocsSidebarTabs.vue +46 -22
- package/app/features/docs/components/DocsToc.vue +80 -34
- package/app/features/docs/composables/useDocsNavigation.ts +2 -2
- package/app/features/docs/composables/useDocsNavigationData.ts +4 -1
- package/app/features/docs/composables/useRevealActive.ts +58 -0
- package/app/features/docs/composables/useScrollspy.ts +87 -19
- package/app/features/docs/docs-navigation.ts +17 -30
- package/app/features/docs/toc-context.ts +6 -0
- package/app/features/search/command-center.ts +11 -90
- package/app/features/search/components/SiteCommandCenter.vue +58 -38
- package/app/features/search/useCommandCenter.ts +46 -46
- package/app/layouts/docs.vue +1 -1
- package/app/lib/errors.ts +2 -49
- package/app/pages/blog/[slug].vue +16 -8
- package/app/pages/blog/index.vue +26 -13
- package/app/pages/docs/index.vue +10 -14
- package/app/pages/index.vue +174 -59
- package/app/plugins/ginko-docs-theme.ts +12 -0
- package/app/utils/content.ts +11 -0
- package/app/utils/file-icons.ts +90 -0
- package/app/utils/index.ts +7 -1
- package/app/utils/repository.ts +20 -0
- package/content.js +23 -26
- package/content.ts +30 -28
- package/i18n/messages/global/blog.ts +4 -0
- package/i18n/messages/global/command.ts +6 -2
- package/i18n/messages/global/docs.ts +3 -0
- package/i18n/messages/global/nav.ts +6 -2
- package/i18n/messages/index.ts +3 -3
- package/icon-bundle.ts +5 -0
- package/index.d.ts +7 -1
- package/nuxt.config.ts +2 -2
- package/package.json +9 -6
- package/runtime/server/agent-markdown.ts +0 -2
- package/shared/theme-palettes.ts +37 -0
- package/shared/types/app-config.ts +63 -6
- package/tags.ts +47 -59
- package/app/components/mdc/MdcAlert.vue +0 -34
- package/app/components/mdc/MdcCardGroup.vue +0 -47
- package/app/components/mdc/MdcDocImg.vue +0 -25
- package/app/components/mdc/MdcField.vue +0 -62
- package/app/components/mdc/MdcFieldGroup.vue +0 -18
- package/app/components/mdc/MdcPassage.vue +0 -32
- package/app/components/mdc/MdcQuizOption.vue +0 -91
- package/app/components/mdc/MdcReadMoreGroup.vue +0 -18
- package/app/components/mdc/MdcShortcut.vue +0 -46
- package/app/components/mdc/MdcStep.vue +0 -42
- package/app/components/ui/accordion/Accordion.vue +0 -15
- package/app/components/ui/accordion/AccordionContent.vue +0 -23
- package/app/components/ui/accordion/AccordionItem.vue +0 -24
- package/app/components/ui/accordion/AccordionTrigger.vue +0 -35
- package/app/components/ui/accordion/index.ts +0 -4
- package/app/components/ui/alert/Alert.vue +0 -21
- package/app/components/ui/alert/AlertDescription.vue +0 -22
- package/app/components/ui/alert/AlertTitle.vue +0 -22
- package/app/components/ui/alert/index.ts +0 -34
- package/app/components/ui/card/Card.vue +0 -16
- package/app/components/ui/card/CardAction.vue +0 -17
- package/app/components/ui/card/CardContent.vue +0 -14
- package/app/components/ui/card/CardDescription.vue +0 -14
- package/app/components/ui/card/CardFooter.vue +0 -14
- package/app/components/ui/card/CardHeader.vue +0 -22
- package/app/components/ui/card/card-variants.ts +0 -15
- package/app/components/ui/card/index.ts +0 -8
- package/app/components/ui/checkbox/Checkbox.vue +0 -35
- package/app/components/ui/checkbox/index.ts +0 -1
- package/app/components/ui/dialog/Dialog.vue +0 -15
- package/app/components/ui/dialog/DialogClose.vue +0 -12
- package/app/components/ui/dialog/DialogContent.vue +0 -69
- package/app/components/ui/dialog/DialogDescription.vue +0 -21
- package/app/components/ui/dialog/DialogFooter.vue +0 -15
- package/app/components/ui/dialog/DialogOverlay.vue +0 -26
- package/app/components/ui/dialog/DialogPortal.vue +0 -12
- package/app/components/ui/dialog/DialogTitle.vue +0 -21
- package/app/components/ui/dialog/DialogTrigger.vue +0 -12
- package/app/components/ui/dialog/index.ts +0 -10
- package/app/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +0 -36
- package/app/components/ui/dropdown-menu/DropdownMenuGroup.vue +0 -12
- package/app/components/ui/dropdown-menu/DropdownMenuLabel.vue +0 -25
- package/app/components/ui/dropdown-menu/DropdownMenuShortcut.vue +0 -17
- package/app/components/ui/dropdown-menu/DropdownMenuSub.vue +0 -15
- package/app/components/ui/dropdown-menu/DropdownMenuSubContent.vue +0 -29
- package/app/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +0 -31
- package/app/components/ui/input/Input.vue +0 -23
- package/app/components/ui/input/index.ts +0 -1
- package/app/components/ui/label/Label.vue +0 -14
- package/app/components/ui/label/index.ts +0 -1
- package/app/components/ui/sheet/SheetClose.vue +0 -12
- package/app/components/ui/sheet/SheetFooter.vue +0 -12
- package/app/components/ui/sheet/SheetHeader.vue +0 -12
- package/app/components/ui/switch/Switch.vue +0 -39
- package/app/components/ui/switch/index.ts +0 -1
- package/app/components/ui/tabs/TabsContent.vue +0 -21
- package/app/components/ui/textarea/Textarea.vue +0 -31
- package/app/components/ui/textarea/index.ts +0 -1
- package/app/features/docs/composables/useDocsEntryPath.ts +0 -13
- package/app/lib/utils.ts +0 -7
- package/i18n/messages/source.ts +0 -5
- package/runtime/markdown/inline-code-highlight.ts +0 -155
- package/runtime/utils.ts +0 -7
package/app/lib/utils.ts
DELETED
package/i18n/messages/source.ts
DELETED
|
@@ -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;
|