@lupinum/ginko-docs 0.2.2
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/LICENSE +21 -0
- package/README.md +112 -0
- package/app/app.config.ts +49 -0
- package/app/app.vue +71 -0
- package/app/assets/css/prose.css +1154 -0
- package/app/assets/css/tailwind.css +365 -0
- package/app/components/OgImage/GinkoDocs.satori.vue +117 -0
- package/app/components/content/DocumentPageShell.vue +55 -0
- package/app/components/content/Feedback.vue +97 -0
- package/app/components/content/PageMarkdownCopy.vue +102 -0
- package/app/components/mdc/MdcAccordion.vue +64 -0
- package/app/components/mdc/MdcAccordionItem.vue +51 -0
- package/app/components/mdc/MdcAlert.vue +34 -0
- package/app/components/mdc/MdcAside.vue +27 -0
- package/app/components/mdc/MdcCallout.vue +62 -0
- package/app/components/mdc/MdcCard.vue +186 -0
- package/app/components/mdc/MdcCardGroup.vue +47 -0
- package/app/components/mdc/MdcCenter.vue +71 -0
- package/app/components/mdc/MdcCodeGroup.vue +193 -0
- package/app/components/mdc/MdcColumn.vue +70 -0
- package/app/components/mdc/MdcDocImg.vue +25 -0
- package/app/components/mdc/MdcDropcap.vue +84 -0
- package/app/components/mdc/MdcError.vue +16 -0
- package/app/components/mdc/MdcField.vue +62 -0
- package/app/components/mdc/MdcFieldGroup.vue +18 -0
- package/app/components/mdc/MdcFigure.vue +51 -0
- package/app/components/mdc/MdcIdea.vue +16 -0
- package/app/components/mdc/MdcInfo.vue +16 -0
- package/app/components/mdc/MdcLayout.vue +57 -0
- package/app/components/mdc/MdcNote.vue +16 -0
- package/app/components/mdc/MdcPassage.vue +32 -0
- package/app/components/mdc/MdcQuiz.vue +281 -0
- package/app/components/mdc/MdcQuizOption.vue +91 -0
- package/app/components/mdc/MdcQuizQuestion.vue +226 -0
- package/app/components/mdc/MdcReadMore.vue +90 -0
- package/app/components/mdc/MdcReadMoreGroup.vue +18 -0
- package/app/components/mdc/MdcShortcut.vue +46 -0
- package/app/components/mdc/MdcStep.vue +42 -0
- package/app/components/mdc/MdcSteps.vue +25 -0
- package/app/components/mdc/MdcSuccess.vue +16 -0
- package/app/components/mdc/MdcTab.vue +17 -0
- package/app/components/mdc/MdcTabs.vue +132 -0
- package/app/components/mdc/MdcTimeline.vue +14 -0
- package/app/components/mdc/MdcTimelineItem.vue +49 -0
- package/app/components/mdc/MdcWarning.vue +16 -0
- package/app/components/mdc/icons.ts +10 -0
- package/app/components/prose/ProseA.vue +27 -0
- package/app/components/prose/ProseBlockquote.vue +14 -0
- package/app/components/prose/ProseCode.vue +14 -0
- package/app/components/prose/ProseEm.vue +14 -0
- package/app/components/prose/ProseH1.vue +18 -0
- package/app/components/prose/ProseH2.vue +24 -0
- package/app/components/prose/ProseH3.vue +24 -0
- package/app/components/prose/ProseH4.vue +14 -0
- package/app/components/prose/ProseHr.vue +12 -0
- package/app/components/prose/ProseImg.vue +120 -0
- package/app/components/prose/ProseLi.vue +14 -0
- package/app/components/prose/ProseOl.vue +14 -0
- package/app/components/prose/ProseP.vue +14 -0
- package/app/components/prose/ProsePre.vue +217 -0
- package/app/components/prose/ProseStrong.vue +14 -0
- package/app/components/prose/ProseTable.vue +16 -0
- package/app/components/prose/ProseTbody.vue +14 -0
- package/app/components/prose/ProseTd.vue +14 -0
- package/app/components/prose/ProseTh.vue +14 -0
- package/app/components/prose/ProseThead.vue +14 -0
- package/app/components/prose/ProseTr.vue +14 -0
- package/app/components/prose/ProseUl.vue +14 -0
- package/app/components/site/ModeToggle.vue +123 -0
- package/app/components/site/SiteBanner.vue +56 -0
- package/app/components/site/SiteFooter.vue +80 -0
- package/app/components/site/SiteHeader.vue +250 -0
- package/app/components/site/SiteInteractionLayer.vue +35 -0
- package/app/components/site/SiteLocaleSwitcher.vue +268 -0
- package/app/components/site/SiteLogoMark.vue +12 -0
- package/app/components/site/SiteSkipLink.vue +14 -0
- package/app/components/ui/accordion/Accordion.vue +15 -0
- package/app/components/ui/accordion/AccordionContent.vue +23 -0
- package/app/components/ui/accordion/AccordionItem.vue +24 -0
- package/app/components/ui/accordion/AccordionTrigger.vue +35 -0
- package/app/components/ui/accordion/index.ts +4 -0
- package/app/components/ui/alert/Alert.vue +21 -0
- package/app/components/ui/alert/AlertDescription.vue +22 -0
- package/app/components/ui/alert/AlertTitle.vue +22 -0
- package/app/components/ui/alert/index.ts +34 -0
- package/app/components/ui/badge/Badge.vue +28 -0
- package/app/components/ui/badge/index.ts +24 -0
- package/app/components/ui/button/Button.vue +31 -0
- package/app/components/ui/button/index.ts +35 -0
- package/app/components/ui/card/Card.vue +16 -0
- package/app/components/ui/card/CardAction.vue +17 -0
- package/app/components/ui/card/CardContent.vue +14 -0
- package/app/components/ui/card/CardDescription.vue +14 -0
- package/app/components/ui/card/CardFooter.vue +14 -0
- package/app/components/ui/card/CardHeader.vue +22 -0
- package/app/components/ui/card/CardTitle.vue +14 -0
- package/app/components/ui/card/card-variants.ts +15 -0
- package/app/components/ui/card/index.ts +8 -0
- package/app/components/ui/checkbox/Checkbox.vue +35 -0
- package/app/components/ui/checkbox/index.ts +1 -0
- package/app/components/ui/collapsible/Collapsible.vue +15 -0
- package/app/components/ui/collapsible/CollapsibleContent.vue +25 -0
- package/app/components/ui/collapsible/CollapsibleTrigger.vue +12 -0
- package/app/components/ui/collapsible/index.ts +3 -0
- package/app/components/ui/dialog/Dialog.vue +15 -0
- package/app/components/ui/dialog/DialogClose.vue +12 -0
- package/app/components/ui/dialog/DialogContent.vue +69 -0
- package/app/components/ui/dialog/DialogDescription.vue +21 -0
- package/app/components/ui/dialog/DialogFooter.vue +15 -0
- package/app/components/ui/dialog/DialogHeader.vue +12 -0
- package/app/components/ui/dialog/DialogOverlay.vue +26 -0
- package/app/components/ui/dialog/DialogPortal.vue +12 -0
- package/app/components/ui/dialog/DialogTitle.vue +21 -0
- package/app/components/ui/dialog/DialogTrigger.vue +12 -0
- package/app/components/ui/dialog/index.ts +10 -0
- package/app/components/ui/dropdown-menu/DropdownMenu.vue +15 -0
- package/app/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +36 -0
- package/app/components/ui/dropdown-menu/DropdownMenuContent.vue +40 -0
- package/app/components/ui/dropdown-menu/DropdownMenuGroup.vue +12 -0
- package/app/components/ui/dropdown-menu/DropdownMenuItem.vue +41 -0
- package/app/components/ui/dropdown-menu/DropdownMenuLabel.vue +25 -0
- package/app/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +15 -0
- package/app/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +37 -0
- package/app/components/ui/dropdown-menu/DropdownMenuSeparator.vue +23 -0
- package/app/components/ui/dropdown-menu/DropdownMenuShortcut.vue +17 -0
- package/app/components/ui/dropdown-menu/DropdownMenuSub.vue +15 -0
- package/app/components/ui/dropdown-menu/DropdownMenuSubContent.vue +29 -0
- package/app/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +31 -0
- package/app/components/ui/dropdown-menu/DropdownMenuTrigger.vue +14 -0
- package/app/components/ui/dropdown-menu/index.ts +16 -0
- package/app/components/ui/input/Input.vue +23 -0
- package/app/components/ui/input/index.ts +1 -0
- package/app/components/ui/kbd/Kbd.vue +23 -0
- package/app/components/ui/kbd/KbdGroup.vue +14 -0
- package/app/components/ui/kbd/index.ts +22 -0
- package/app/components/ui/label/Label.vue +14 -0
- package/app/components/ui/label/index.ts +1 -0
- package/app/components/ui/scroll-area/ScrollArea.vue +39 -0
- package/app/components/ui/scroll-area/ScrollBar.vue +33 -0
- package/app/components/ui/scroll-area/index.ts +2 -0
- package/app/components/ui/separator/Separator.vue +27 -0
- package/app/components/ui/separator/index.ts +1 -0
- package/app/components/ui/sheet/Sheet.vue +15 -0
- package/app/components/ui/sheet/SheetClose.vue +12 -0
- package/app/components/ui/sheet/SheetContent.vue +59 -0
- package/app/components/ui/sheet/SheetDescription.vue +21 -0
- package/app/components/ui/sheet/SheetFooter.vue +12 -0
- package/app/components/ui/sheet/SheetHeader.vue +12 -0
- package/app/components/ui/sheet/SheetOverlay.vue +26 -0
- package/app/components/ui/sheet/SheetTitle.vue +21 -0
- package/app/components/ui/sheet/SheetTrigger.vue +12 -0
- package/app/components/ui/sheet/index.ts +8 -0
- package/app/components/ui/switch/Switch.vue +39 -0
- package/app/components/ui/switch/index.ts +1 -0
- package/app/components/ui/tabs/Tabs.vue +24 -0
- package/app/components/ui/tabs/TabsContent.vue +21 -0
- package/app/components/ui/tabs/TabsList.vue +26 -0
- package/app/components/ui/tabs/TabsTrigger.vue +28 -0
- package/app/components/ui/tabs/index.ts +4 -0
- package/app/components/ui/textarea/Textarea.vue +31 -0
- package/app/components/ui/textarea/index.ts +1 -0
- package/app/composables/site-navigation.utils.ts +80 -0
- package/app/composables/useCanonicalUrl.ts +9 -0
- package/app/composables/useContentRouteAlternates.ts +43 -0
- package/app/composables/useGinkoAnalytics.ts +37 -0
- package/app/composables/useGinkoDocsConfig.ts +6 -0
- package/app/composables/useGinkoOgImage.ts +20 -0
- package/app/composables/useLocalizedPath.ts +12 -0
- package/app/composables/useLocalizedRouteSwitch.ts +31 -0
- package/app/composables/usePageMarkdownActions.ts +79 -0
- package/app/composables/useSchemaJsonLd.ts +25 -0
- package/app/composables/useSiteNavigation.ts +86 -0
- package/app/config/site.utils.ts +36 -0
- package/app/error.vue +125 -0
- package/app/features/docs/components/DocsContributeLinks.vue +65 -0
- package/app/features/docs/components/DocsMobileToc.vue +104 -0
- package/app/features/docs/components/DocsPageContent.vue +188 -0
- package/app/features/docs/components/DocsPageNav.vue +57 -0
- package/app/features/docs/components/DocsSidebar.vue +129 -0
- package/app/features/docs/components/DocsSidebarDropdown.vue +70 -0
- package/app/features/docs/components/DocsSidebarItem.vue +169 -0
- package/app/features/docs/components/DocsSidebarList.vue +35 -0
- package/app/features/docs/components/DocsSidebarTabs.vue +35 -0
- package/app/features/docs/components/DocsToc.vue +60 -0
- package/app/features/docs/composables/useDocsEntryPath.ts +13 -0
- package/app/features/docs/composables/useDocsNavigation.ts +29 -0
- package/app/features/docs/composables/useDocsNavigationData.ts +15 -0
- package/app/features/docs/composables/useScrollspy.ts +67 -0
- package/app/features/docs/docs-navigation.ts +170 -0
- package/app/features/search/command-center.ts +156 -0
- package/app/features/search/components/SiteCommandCenter.vue +323 -0
- package/app/features/search/components/SiteSearchPageHighlight.vue +124 -0
- package/app/features/search/useCommandCenter.ts +300 -0
- package/app/layouts/blog.vue +15 -0
- package/app/layouts/default.vue +12 -0
- package/app/layouts/docs.vue +20 -0
- package/app/lib/errors.ts +84 -0
- package/app/lib/schema-org.ts +38 -0
- package/app/lib/utils.ts +7 -0
- package/app/pages/blog/[slug].vue +211 -0
- package/app/pages/blog/index.vue +106 -0
- package/app/pages/docs/[...slug].vue +10 -0
- package/app/pages/docs/index.vue +23 -0
- package/app/pages/index.vue +140 -0
- package/app/plugins/ssr-width.ts +6 -0
- package/app/utils/content.ts +56 -0
- package/app/utils/index.ts +1 -0
- package/components.ts +9 -0
- package/content.js +175 -0
- package/content.ts +148 -0
- package/i18n/i18n.config.ts +10 -0
- package/i18n/locales.ts +81 -0
- package/i18n/messages/global/banner.ts +8 -0
- package/i18n/messages/global/blog.ts +14 -0
- package/i18n/messages/global/command.ts +44 -0
- package/i18n/messages/global/docs.ts +32 -0
- package/i18n/messages/global/errors.ts +36 -0
- package/i18n/messages/global/feedback.ts +11 -0
- package/i18n/messages/global/index.ts +21 -0
- package/i18n/messages/global/nav.ts +18 -0
- package/i18n/messages/global/site.ts +4 -0
- package/i18n/messages/global/theme.ts +7 -0
- package/i18n/messages/index.ts +20 -0
- package/i18n/messages/localize.ts +35 -0
- package/i18n/messages/source.ts +5 -0
- package/i18n/routes.ts +33 -0
- package/icon-bundle.ts +141 -0
- package/index.d.ts +13 -0
- package/modules/feature-routing.ts +32 -0
- package/nuxt.config.ts +194 -0
- package/package.json +91 -0
- package/runtime/markdown/inline-code-highlight.ts +155 -0
- package/runtime/server/agent-markdown.ts +21 -0
- package/runtime/utils.ts +7 -0
- package/server/mcp/tools/get-page.ts +14 -0
- package/server/mcp/tools/list-pages.ts +10 -0
- package/server/plugins/agent-markdown.ts +6 -0
- package/shared/route-slugs.ts +5 -0
- package/shared/types/app-config.ts +100 -0
- package/tags.ts +204 -0
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
<DropdownMenuTrigger as-child>
|
|
58
|
+
<Button
|
|
59
|
+
type="button"
|
|
60
|
+
variant="outline"
|
|
61
|
+
size="icon"
|
|
62
|
+
class="h-9 w-8 rounded-l-none px-0"
|
|
63
|
+
:aria-label="t('docs.moreActions')"
|
|
64
|
+
>
|
|
65
|
+
<Icon name="lucide:chevron-down" class="size-3.5" aria-hidden="true" />
|
|
66
|
+
</Button>
|
|
67
|
+
</DropdownMenuTrigger>
|
|
68
|
+
<DropdownMenuContent align="end" class="w-56">
|
|
69
|
+
<DropdownMenuItem @select="copyValue(rawUrl, 'link')">
|
|
70
|
+
<Icon :name="actionSucceeded('link') ? 'lucide:check' : 'lucide:link'" />
|
|
71
|
+
{{ actionSucceeded("link") ? t("docs.copied") : t("docs.copyLink") }}
|
|
72
|
+
</DropdownMenuItem>
|
|
73
|
+
<DropdownMenuItem as-child>
|
|
74
|
+
<a :href="rawPath" target="_blank" rel="noopener noreferrer">
|
|
75
|
+
<Icon name="lucide:file-code-2" />
|
|
76
|
+
{{ t("docs.viewMarkdown") }}
|
|
77
|
+
</a>
|
|
78
|
+
</DropdownMenuItem>
|
|
79
|
+
<DropdownMenuItem v-if="actions.claude" as-child>
|
|
80
|
+
<a :href="claudeUrl" target="_blank" rel="noopener noreferrer">
|
|
81
|
+
<Icon name="lucide:sparkles" />
|
|
82
|
+
{{ t("docs.askClaude") }}
|
|
83
|
+
</a>
|
|
84
|
+
</DropdownMenuItem>
|
|
85
|
+
<DropdownMenuItem v-if="actions.chatGpt" as-child>
|
|
86
|
+
<a :href="chatGptUrl" target="_blank" rel="noopener noreferrer">
|
|
87
|
+
<Icon name="lucide:message-circle" />
|
|
88
|
+
{{ t("docs.askChatGpt") }}
|
|
89
|
+
</a>
|
|
90
|
+
</DropdownMenuItem>
|
|
91
|
+
<template v-if="actions.mcp">
|
|
92
|
+
<DropdownMenuSeparator />
|
|
93
|
+
<DropdownMenuItem @select="copyValue(mcpUrl, 'mcp')">
|
|
94
|
+
<Icon :name="actionSucceeded('mcp') ? 'lucide:check' : 'lucide:plug'" />
|
|
95
|
+
{{ actionSucceeded("mcp") ? t("docs.copied") : t("docs.copyMcpUrl") }}
|
|
96
|
+
</DropdownMenuItem>
|
|
97
|
+
</template>
|
|
98
|
+
</DropdownMenuContent>
|
|
99
|
+
</DropdownMenu>
|
|
100
|
+
<span class="sr-only" role="status" aria-live="polite">{{ statusMessage }}</span>
|
|
101
|
+
</div>
|
|
102
|
+
</template>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { onMounted, ref } from "vue";
|
|
3
|
+
import { AccordionRoot } from "reka-ui";
|
|
4
|
+
import { cn } from "../../utils";
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
type?: "single" | "multiple";
|
|
9
|
+
collapsible?: boolean;
|
|
10
|
+
defaultValue?: string | string[];
|
|
11
|
+
class?: string;
|
|
12
|
+
}>(),
|
|
13
|
+
{
|
|
14
|
+
type: "single",
|
|
15
|
+
collapsible: true,
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const root = ref<HTMLElement | null>(null);
|
|
20
|
+
const value = ref<string | string[]>(
|
|
21
|
+
props.type === "multiple"
|
|
22
|
+
? ((props.defaultValue as string[]) ?? [])
|
|
23
|
+
: ((props.defaultValue as string) ?? ""),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
function applyHash(hash: string) {
|
|
27
|
+
if (!hash || !root.value) return;
|
|
28
|
+
const target = root.value.querySelector<HTMLElement>(`#${CSS.escape(hash)}`);
|
|
29
|
+
if (!target) return;
|
|
30
|
+
|
|
31
|
+
const accordionValue =
|
|
32
|
+
target.dataset.accordionValue ??
|
|
33
|
+
target.closest("[data-accordion-value]")?.getAttribute("data-accordion-value");
|
|
34
|
+
if (!accordionValue) return;
|
|
35
|
+
|
|
36
|
+
if (props.type === "multiple") {
|
|
37
|
+
const current = Array.isArray(value.value) ? value.value : [];
|
|
38
|
+
value.value = current.includes(accordionValue) ? current : [accordionValue, ...current];
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
value.value = accordionValue;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
onMounted(() => {
|
|
46
|
+
applyHash(window.location.hash.slice(1));
|
|
47
|
+
});
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<div ref="root">
|
|
52
|
+
<AccordionRoot
|
|
53
|
+
v-model="value"
|
|
54
|
+
:type="props.type"
|
|
55
|
+
:collapsible="props.collapsible"
|
|
56
|
+
data-slot="accordion"
|
|
57
|
+
:class="
|
|
58
|
+
cn('not-prose my-4 w-full divide-y overflow-hidden rounded-lg border bg-card', props.class)
|
|
59
|
+
"
|
|
60
|
+
>
|
|
61
|
+
<slot />
|
|
62
|
+
</AccordionRoot>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
@@ -0,0 +1,51 @@
|
|
|
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="border-b last:border-b-0"
|
|
19
|
+
>
|
|
20
|
+
<AccordionHeader class="flex">
|
|
21
|
+
<AccordionTrigger
|
|
22
|
+
class="flex flex-1 items-start justify-between gap-4 rounded-md px-4 py-3 text-left text-sm font-medium transition-all outline-none hover:no-underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180"
|
|
23
|
+
>
|
|
24
|
+
<slot name="title">
|
|
25
|
+
{{ title }}
|
|
26
|
+
</slot>
|
|
27
|
+
<Icon
|
|
28
|
+
name="lucide:chevron-down"
|
|
29
|
+
class="pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200"
|
|
30
|
+
aria-hidden="true"
|
|
31
|
+
/>
|
|
32
|
+
</AccordionTrigger>
|
|
33
|
+
</AccordionHeader>
|
|
34
|
+
<AccordionContent
|
|
35
|
+
data-slot="accordion-content"
|
|
36
|
+
class="accordion-content overflow-hidden text-sm"
|
|
37
|
+
>
|
|
38
|
+
<slot name="content">
|
|
39
|
+
<div v-if="content" class="text-muted-foreground">
|
|
40
|
+
{{ content }}
|
|
41
|
+
</div>
|
|
42
|
+
</slot>
|
|
43
|
+
<div
|
|
44
|
+
v-if="$slots.default"
|
|
45
|
+
class="content-prose content-prose-trim px-4 pb-2 text-muted-foreground"
|
|
46
|
+
>
|
|
47
|
+
<slot unwrap="p" />
|
|
48
|
+
</div>
|
|
49
|
+
</AccordionContent>
|
|
50
|
+
</AccordionItem>
|
|
51
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "vue";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import MdcCallout from "./MdcCallout.vue";
|
|
5
|
+
|
|
6
|
+
type AlertType = "default" | "info" | "warning" | "success" | "danger" | "secondary";
|
|
7
|
+
type CalloutType = "info" | "warning" | "error" | "success" | "idea";
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(
|
|
10
|
+
defineProps<{
|
|
11
|
+
title?: string;
|
|
12
|
+
icon?: string;
|
|
13
|
+
type?: AlertType;
|
|
14
|
+
class?: HTMLAttributes["class"];
|
|
15
|
+
}>(),
|
|
16
|
+
{
|
|
17
|
+
type: "warning",
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const calloutType = computed<CalloutType>(() => {
|
|
22
|
+
if (props.type === "danger") return "error";
|
|
23
|
+
if (props.type === "success") return "success";
|
|
24
|
+
if (props.type === "info" || props.type === "secondary") return "info";
|
|
25
|
+
|
|
26
|
+
return "warning";
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<MdcCallout :title="title" :icon="icon" :type="calloutType" :class="props.class">
|
|
32
|
+
<slot />
|
|
33
|
+
</MdcCallout>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "vue";
|
|
3
|
+
import { cn } from "../../utils";
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
label?: string;
|
|
7
|
+
class?: HTMLAttributes["class"];
|
|
8
|
+
}>();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<aside
|
|
13
|
+
:class="
|
|
14
|
+
cn(
|
|
15
|
+
'not-prose my-4 rounded-lg border-l-2 border-muted-foreground/20 bg-muted/20 px-4 py-3',
|
|
16
|
+
props.class,
|
|
17
|
+
)
|
|
18
|
+
"
|
|
19
|
+
>
|
|
20
|
+
<p v-if="label" class="mb-2 text-xs font-medium tracking-wider text-muted-foreground uppercase">
|
|
21
|
+
{{ label }}
|
|
22
|
+
</p>
|
|
23
|
+
<div :class="cn('content-prose content-prose-trim text-muted-foreground')">
|
|
24
|
+
<slot />
|
|
25
|
+
</div>
|
|
26
|
+
</aside>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "vue";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import { cn } from "../../utils";
|
|
5
|
+
import { resolveIconifyIcon } from "./icons";
|
|
6
|
+
|
|
7
|
+
type CalloutType = "note" | "alert" | "info" | "warn" | "warning" | "error" | "success" | "idea";
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(
|
|
10
|
+
defineProps<{
|
|
11
|
+
title?: string;
|
|
12
|
+
type?: CalloutType;
|
|
13
|
+
icon?: string;
|
|
14
|
+
class?: HTMLAttributes["class"];
|
|
15
|
+
}>(),
|
|
16
|
+
{
|
|
17
|
+
type: "info",
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const normalizedType = computed(() => {
|
|
22
|
+
if (props.type === "warn" || props.type === "alert") return "warning";
|
|
23
|
+
|
|
24
|
+
return props.type;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const iconName = computed(() => {
|
|
28
|
+
if (props.icon) return resolveIconifyIcon(props.icon) ?? props.icon;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
{
|
|
32
|
+
note: "lucide:file-text",
|
|
33
|
+
info: "lucide:info",
|
|
34
|
+
warning: "lucide:triangle-alert",
|
|
35
|
+
error: "lucide:circle-x",
|
|
36
|
+
success: "lucide:circle-check",
|
|
37
|
+
idea: "lucide:lightbulb",
|
|
38
|
+
}[normalizedType.value] ?? "lucide:info"
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<div
|
|
45
|
+
data-slot="alert"
|
|
46
|
+
role="alert"
|
|
47
|
+
:class="cn('content-callout not-prose my-4', `content-callout-${normalizedType}`, props.class)"
|
|
48
|
+
>
|
|
49
|
+
<span class="content-callout-bar" aria-hidden="true" />
|
|
50
|
+
<span data-slot="alert-icon" class="content-callout-icon" aria-hidden="true">
|
|
51
|
+
<Icon :name="iconName" class="mt-1 size-5" />
|
|
52
|
+
</span>
|
|
53
|
+
<div class="content-callout-body">
|
|
54
|
+
<div v-if="title" data-slot="alert-title" class="content-alert-title">
|
|
55
|
+
{{ title }}
|
|
56
|
+
</div>
|
|
57
|
+
<div data-slot="alert-description" class="content-prose content-prose-trim">
|
|
58
|
+
<slot unwrap="p" />
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { NuxtLink } from "#components";
|
|
3
|
+
import { computed, inject, useSlots, type CSSProperties, type HTMLAttributes } from "vue";
|
|
4
|
+
import { cn } from "../../utils";
|
|
5
|
+
import { isExternalLink, resolveIconifyIcon } from "./icons";
|
|
6
|
+
|
|
7
|
+
type CardIconColor =
|
|
8
|
+
| "muted"
|
|
9
|
+
| "foreground"
|
|
10
|
+
| "primary"
|
|
11
|
+
| "info"
|
|
12
|
+
| "success"
|
|
13
|
+
| "warning"
|
|
14
|
+
| "destructive";
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(
|
|
17
|
+
defineProps<{
|
|
18
|
+
title?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
footer?: string;
|
|
21
|
+
to?: string;
|
|
22
|
+
target?: string;
|
|
23
|
+
icon?: string;
|
|
24
|
+
iconColor?: CardIconColor;
|
|
25
|
+
img?: string;
|
|
26
|
+
showLinkIcon?: boolean;
|
|
27
|
+
horizontal?: boolean;
|
|
28
|
+
inStack?: boolean;
|
|
29
|
+
class?: HTMLAttributes["class"];
|
|
30
|
+
}>(),
|
|
31
|
+
{
|
|
32
|
+
showLinkIcon: true,
|
|
33
|
+
horizontal: false,
|
|
34
|
+
inStack: false,
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const slots = useSlots();
|
|
39
|
+
const inGroup = inject("contentCardInGroup", false);
|
|
40
|
+
|
|
41
|
+
const wrapperTag = computed(() => (props.to ? (isExternalLink(props.to) ? "a" : NuxtLink) : "div"));
|
|
42
|
+
|
|
43
|
+
const linkProps = computed(() => {
|
|
44
|
+
if (!props.to) return null;
|
|
45
|
+
if (isExternalLink(props.to)) {
|
|
46
|
+
return {
|
|
47
|
+
href: props.to,
|
|
48
|
+
target: props.target,
|
|
49
|
+
rel: "noreferrer noopener",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
to: props.to,
|
|
54
|
+
target: props.target,
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const iconName = computed(() => resolveIconifyIcon(props.icon));
|
|
59
|
+
|
|
60
|
+
const hasHeader = computed(() =>
|
|
61
|
+
Boolean(props.title || props.description || slots.title || slots.description || props.icon),
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const hasFooter = computed(() => Boolean(props.footer || slots.footer));
|
|
65
|
+
|
|
66
|
+
const hasBody = computed(() => Boolean(slots.default));
|
|
67
|
+
|
|
68
|
+
const showOutgoingLinkIcon = computed(
|
|
69
|
+
() => props.showLinkIcon && Boolean(props.to && isExternalLink(props.to)),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const cardIconColor = computed(() => {
|
|
73
|
+
if (!props.iconColor || props.iconColor === "muted") return undefined;
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
foreground: "var(--foreground)",
|
|
77
|
+
primary: "var(--primary)",
|
|
78
|
+
info: "var(--info)",
|
|
79
|
+
success: "var(--success)",
|
|
80
|
+
warning: "var(--warning)",
|
|
81
|
+
destructive: "var(--destructive)",
|
|
82
|
+
}[props.iconColor];
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const cardIconStyle = computed<CSSProperties | undefined>(() =>
|
|
86
|
+
cardIconColor.value
|
|
87
|
+
? ({ "--content-card-icon-color": cardIconColor.value } as CSSProperties)
|
|
88
|
+
: undefined,
|
|
89
|
+
);
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<template>
|
|
93
|
+
<component
|
|
94
|
+
:is="wrapperTag"
|
|
95
|
+
v-bind="linkProps || {}"
|
|
96
|
+
:class="
|
|
97
|
+
cn(
|
|
98
|
+
'content-card group not-prose relative block h-auto',
|
|
99
|
+
!inStack && !inGroup && 'my-4',
|
|
100
|
+
to &&
|
|
101
|
+
'rounded-xl focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none',
|
|
102
|
+
props.class,
|
|
103
|
+
)
|
|
104
|
+
"
|
|
105
|
+
>
|
|
106
|
+
<div
|
|
107
|
+
data-slot="card"
|
|
108
|
+
:class="
|
|
109
|
+
cn(
|
|
110
|
+
'content-card-surface relative overflow-hidden rounded-xl border bg-card text-card-foreground shadow-xs transition-colors',
|
|
111
|
+
hasBody || hasFooter ? 'p-0' : 'p-0',
|
|
112
|
+
to && 'cursor-pointer hover:bg-accent/50',
|
|
113
|
+
showOutgoingLinkIcon && (hasBody || hasFooter ? '' : 'pr-10'),
|
|
114
|
+
inStack &&
|
|
115
|
+
'rounded-none border-x-0 shadow-none first:rounded-t-xl first:border-t last:rounded-b-xl last:border-b',
|
|
116
|
+
)
|
|
117
|
+
"
|
|
118
|
+
>
|
|
119
|
+
<img v-if="img" :src="img" alt="" class="w-full border-b border-border object-cover" />
|
|
120
|
+
|
|
121
|
+
<div
|
|
122
|
+
v-if="hasHeader"
|
|
123
|
+
:class="
|
|
124
|
+
cn(
|
|
125
|
+
hasBody || hasFooter ? 'p-4 pb-0' : 'p-4',
|
|
126
|
+
showOutgoingLinkIcon && 'pr-10',
|
|
127
|
+
horizontal && 'flex items-start gap-3',
|
|
128
|
+
)
|
|
129
|
+
"
|
|
130
|
+
>
|
|
131
|
+
<div
|
|
132
|
+
v-if="iconName"
|
|
133
|
+
:style="cardIconStyle"
|
|
134
|
+
:class="
|
|
135
|
+
cn(
|
|
136
|
+
'content-card-icon flex size-10 shrink-0 items-center justify-center rounded-lg border bg-muted shadow-xs [&_.iconify]:size-5',
|
|
137
|
+
horizontal ? '' : 'mb-2',
|
|
138
|
+
)
|
|
139
|
+
"
|
|
140
|
+
>
|
|
141
|
+
<Icon :name="iconName" aria-hidden="true" />
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div :class="cn('min-w-0', horizontal ? 'flex-1 space-y-1' : 'space-y-1')">
|
|
145
|
+
<div
|
|
146
|
+
v-if="title || $slots.title"
|
|
147
|
+
data-slot="card-title"
|
|
148
|
+
:class="cn('text-sm font-medium', !horizontal && 'mb-0')"
|
|
149
|
+
>
|
|
150
|
+
<slot name="title">{{ title }}</slot>
|
|
151
|
+
</div>
|
|
152
|
+
<div
|
|
153
|
+
v-if="description || $slots.description"
|
|
154
|
+
data-slot="card-description"
|
|
155
|
+
class="text-sm leading-snug text-pretty"
|
|
156
|
+
>
|
|
157
|
+
<slot name="description">{{ description }}</slot>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<div
|
|
163
|
+
v-if="hasBody"
|
|
164
|
+
data-slot="card-content"
|
|
165
|
+
class="content-prose content-prose-trim p-4 pt-2 text-muted-foreground"
|
|
166
|
+
>
|
|
167
|
+
<slot unwrap="p" />
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<div
|
|
171
|
+
v-if="hasFooter"
|
|
172
|
+
data-slot="card-footer"
|
|
173
|
+
class="flex flex-col items-stretch border-t px-4 py-3 text-xs text-muted-foreground [&_p]:my-0 [&_p]:leading-normal"
|
|
174
|
+
>
|
|
175
|
+
<slot name="footer">{{ footer }}</slot>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
<Icon
|
|
179
|
+
v-if="showOutgoingLinkIcon"
|
|
180
|
+
name="lucide:arrow-up-right"
|
|
181
|
+
class="pointer-events-none absolute top-4 right-4 size-4 text-muted-foreground/50 transition-colors group-hover:text-foreground"
|
|
182
|
+
aria-hidden="true"
|
|
183
|
+
/>
|
|
184
|
+
</div>
|
|
185
|
+
</component>
|
|
186
|
+
</template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, provide, type HTMLAttributes } from "vue";
|
|
3
|
+
import { cn } from "../../utils";
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(
|
|
6
|
+
defineProps<{
|
|
7
|
+
cols?: 1 | 2 | 3 | 4 | 5 | 6 | "1" | "2" | "3" | "4" | "5" | "6";
|
|
8
|
+
class?: HTMLAttributes["class"];
|
|
9
|
+
}>(),
|
|
10
|
+
{
|
|
11
|
+
cols: 2,
|
|
12
|
+
},
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
provide("contentCardInGroup", true);
|
|
16
|
+
|
|
17
|
+
const colsClass = {
|
|
18
|
+
1: "sm:grid-cols-1",
|
|
19
|
+
2: "sm:grid-cols-2",
|
|
20
|
+
3: "sm:grid-cols-3",
|
|
21
|
+
4: "sm:grid-cols-4",
|
|
22
|
+
5: "sm:grid-cols-5",
|
|
23
|
+
6: "sm:grid-cols-6",
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
const normalizedCols = computed<keyof typeof colsClass>(() => {
|
|
27
|
+
const cols = Number(props.cols);
|
|
28
|
+
|
|
29
|
+
return cols === 1 || cols === 2 || cols === 3 || cols === 4 || cols === 5 || cols === 6
|
|
30
|
+
? cols
|
|
31
|
+
: 2;
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<div
|
|
37
|
+
:class="
|
|
38
|
+
cn(
|
|
39
|
+
'content-card-group not-prose my-4 grid grid-cols-1 items-start gap-2',
|
|
40
|
+
colsClass[normalizedCols],
|
|
41
|
+
props.class,
|
|
42
|
+
)
|
|
43
|
+
"
|
|
44
|
+
>
|
|
45
|
+
<slot />
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, type HTMLAttributes } from "vue";
|
|
3
|
+
import { cn } from "../../utils";
|
|
4
|
+
|
|
5
|
+
type ValueProp<T extends string> = T | { value?: T | string };
|
|
6
|
+
type CenterSize = "sm" | "md" | "lg";
|
|
7
|
+
type CenterType = "default" | "card" | "border" | "border-dashed" | "outline" | "outline-dashed";
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(
|
|
10
|
+
defineProps<{
|
|
11
|
+
size?: ValueProp<CenterSize>;
|
|
12
|
+
max?: CenterSize;
|
|
13
|
+
type?: ValueProp<CenterType>;
|
|
14
|
+
class?: HTMLAttributes["class"];
|
|
15
|
+
}>(),
|
|
16
|
+
{
|
|
17
|
+
size: "md",
|
|
18
|
+
type: "default",
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const centerTypeValue = computed<CenterType>(() => {
|
|
23
|
+
if (typeof props.type === "string") return props.type;
|
|
24
|
+
return (props.type?.value as CenterType | undefined) ?? "default";
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const sizeValue = computed<CenterSize>(() => {
|
|
28
|
+
if (props.max) return props.max;
|
|
29
|
+
if (typeof props.size === "string") return props.size;
|
|
30
|
+
return (props.size?.value as CenterSize | undefined) ?? "md";
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const centerSizeClass = {
|
|
34
|
+
sm: "max-w-sm",
|
|
35
|
+
md: "max-w-md",
|
|
36
|
+
lg: "max-w-lg",
|
|
37
|
+
} as const;
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div :class="cn('mx-auto flex justify-center p-2', props.class)">
|
|
42
|
+
<div
|
|
43
|
+
v-if="centerTypeValue === 'card'"
|
|
44
|
+
:class="
|
|
45
|
+
cn(
|
|
46
|
+
'mx-auto w-full rounded-lg border bg-card p-6 text-center shadow-xs',
|
|
47
|
+
centerSizeClass[sizeValue],
|
|
48
|
+
)
|
|
49
|
+
"
|
|
50
|
+
>
|
|
51
|
+
<slot />
|
|
52
|
+
</div>
|
|
53
|
+
<div
|
|
54
|
+
v-else
|
|
55
|
+
:class="
|
|
56
|
+
cn(
|
|
57
|
+
'mx-auto w-full text-center',
|
|
58
|
+
centerSizeClass[sizeValue],
|
|
59
|
+
centerTypeValue !== 'default' && 'rounded-lg p-4',
|
|
60
|
+
centerTypeValue === 'border' && 'border border-border',
|
|
61
|
+
centerTypeValue === 'border-dashed' && 'border border-dashed border-border',
|
|
62
|
+
centerTypeValue === 'outline' && 'outline outline-1 outline-offset-2 outline-border',
|
|
63
|
+
centerTypeValue === 'outline-dashed' &&
|
|
64
|
+
'outline-1 outline-offset-2 outline-border outline-dashed',
|
|
65
|
+
)
|
|
66
|
+
"
|
|
67
|
+
>
|
|
68
|
+
<slot />
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|