@wordup-md/nuxt-layer-shadcn-unocss 0.2.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.
- package/.cursor/rules/active-context-rule.mdc +8 -0
- package/.cursor/rules/memory-bank-overview.mdc +17 -0
- package/.cursor/rules/product-context-rule.mdc +8 -0
- package/.cursor/rules/progress-rule.mdc +8 -0
- package/.cursor/rules/projectbrief-rule.mdc +8 -0
- package/.cursor/rules/system-patterns-rule.mdc +8 -0
- package/.cursor/rules/tech-context-rule.mdc +8 -0
- package/.cursorrules +52 -0
- package/.editorconfig +12 -0
- package/.nuxtrc +1 -0
- package/.playground/app.config.ts +189 -0
- package/.playground/assets/style.css +15 -0
- package/.playground/components/content/MdcExample.vue +81 -0
- package/.playground/components/content/MdcReplay.vue +319 -0
- package/.playground/content/1.getting-started/1.introduction.md +8 -0
- package/.playground/content/1.getting-started/2.writing/1.markdown.md +56 -0
- package/.playground/content/1.getting-started/2.writing/2.pages.md +177 -0
- package/.playground/content/1.getting-started/2.writing/3.folders.md +56 -0
- package/.playground/content/1.getting-started/2.writing/_dir.yml +3 -0
- package/.playground/content/1.getting-started/_dir.yml +3 -0
- package/.playground/content/2.content-elements/1.text-formatting.md +60 -0
- package/.playground/content/2.content-elements/10.horizontal-rule.md +25 -0
- package/.playground/content/2.content-elements/11.tables.md +25 -0
- package/.playground/content/2.content-elements/12.overview.md +93 -0
- package/.playground/content/2.content-elements/13.text-components.md +36 -0
- package/.playground/content/2.content-elements/2.headings.md +32 -0
- package/.playground/content/2.content-elements/3.paragraphs.md +39 -0
- package/.playground/content/2.content-elements/4.lists.md +37 -0
- package/.playground/content/2.content-elements/5.links.md +17 -0
- package/.playground/content/2.content-elements/6.images.md +17 -0
- package/.playground/content/2.content-elements/7.blockquotes.md +17 -0
- package/.playground/content/2.content-elements/8.code-blocks.md +141 -0
- package/.playground/content/2.content-elements/9.inline-code.md +21 -0
- package/.playground/content/2.content-elements/_dir.yml +3 -0
- package/.playground/content/2.content-elements/index.md +8 -0
- package/.playground/content/3.components/1.index.md +187 -0
- package/.playground/content/3.components/2.docs/_dir.yml +3 -0
- package/.playground/content/3.components/2.docs/alert.md +152 -0
- package/.playground/content/3.components/2.docs/badge.md +131 -0
- package/.playground/content/3.components/2.docs/button-link.md +53 -0
- package/.playground/content/3.components/2.docs/callout.md +16 -0
- package/.playground/content/3.components/2.docs/code-group.md +77 -0
- package/.playground/content/3.components/2.docs/code-snippet.md +129 -0
- package/.playground/content/3.components/2.docs/field-group.md +62 -0
- package/.playground/content/3.components/2.docs/field.md +39 -0
- package/.playground/content/3.components/2.docs/file-tree.md +144 -0
- package/.playground/content/3.components/2.docs/icon.md +94 -0
- package/.playground/content/3.components/2.docs/pm.md +67 -0
- package/.playground/content/3.components/2.docs/read-more.md +44 -0
- package/.playground/content/3.components/2.docs/shortcut.md +36 -0
- package/.playground/content/3.components/2.docs/stack.md +81 -0
- package/.playground/content/3.components/2.docs/steps.md +148 -0
- package/.playground/content/3.components/2.docs/tabs.md +375 -0
- package/.playground/content/3.components/3.page/_dir.yml +2 -0
- package/.playground/content/3.components/3.page/accordion.md +74 -0
- package/.playground/content/3.components/3.page/card-group.md +115 -0
- package/.playground/content/3.components/3.page/card.md +142 -0
- package/.playground/content/3.components/3.page/collapsible.md +61 -0
- package/.playground/content/3.components/3.page/hero-alt.md +118 -0
- package/.playground/content/3.components/3.page/hero.md +60 -0
- package/.playground/content/3.components/3.page/team-card.md +82 -0
- package/.playground/content/3.components/_dir.yml +2 -0
- package/.playground/content/4.development/1.configuration/1.overview.md +297 -0
- package/.playground/content/4.development/1.configuration/2.nuxt-content.md +105 -0
- package/.playground/content/4.development/1.configuration/3.og-image.md +86 -0
- package/.playground/content/4.development/1.configuration/4.edit-link.md +63 -0
- package/.playground/content/4.development/1.configuration/5.banner.md +52 -0
- package/.playground/content/4.development/1.configuration/6.carbon-ads.md +65 -0
- package/.playground/content/4.development/1.configuration/7.umami.md +41 -0
- package/.playground/content/4.development/1.configuration/_dir.yml +3 -0
- package/.playground/content/4.development/2.advanced/1.override.md +49 -0
- package/.playground/content/4.development/2.advanced/2.math.md +89 -0
- package/.playground/content/4.development/2.advanced/_dir.yml +3 -0
- package/.playground/content/4.development/3.themes.md +9 -0
- package/.playground/content/4.development/4.composables.md +38 -0
- package/.playground/content/4.development/5.installation.md +36 -0
- package/.playground/content/4.development/_dir.yml +3 -0
- package/.playground/content/_menu-footer.md +5 -0
- package/.playground/content/index.md +67 -0
- package/.playground/content/test-card.md +187 -0
- package/.playground/content/test.md +88 -0
- package/.playground/content/test2.md +12 -0
- package/.playground/content/test3.md +187 -0
- package/.playground/nuxt.config.ts +52 -0
- package/.playground/public/banner-preview.png +0 -0
- package/.playground/public/favicon.ico +0 -0
- package/.playground/public/front-matter-showcase/authors.png +0 -0
- package/.playground/public/front-matter-showcase/badges.png +0 -0
- package/.playground/public/front-matter-showcase/nav-badges.png +0 -0
- package/.playground/public/hero.png +0 -0
- package/.playground/public/logo-dark.svg +12 -0
- package/.playground/public/logo.svg +12 -0
- package/.playground/public/og-nuxt-seo.png +0 -0
- package/.playground/public/og-nuxt.png +0 -0
- package/.playground/public/og-shadcn-docs-dark.png +0 -0
- package/.playground/public/og-shadcn-docs.png +0 -0
- package/.playground/public/sidebar-default.png +0 -0
- package/.playground/public/sidebar-group.png +0 -0
- package/.playground/public/sidebar-tree.png +0 -0
- package/.playground/uno.config.ts +16 -0
- package/README.md +93 -0
- package/app.vue +59 -0
- package/assets/css/a11y.css +48 -0
- package/assets/css/mdc-editor.css +91 -0
- package/components/A11yModeToggle.vue +23 -0
- package/components/DarkModeToggle.vue +26 -0
- package/components/LinkIcon.vue +32 -0
- package/components/OgImage/ShadcnDocs.vue +55 -0
- package/components/ThemeCustomizer.vue +156 -0
- package/components/ThemePopover.vue +27 -0
- package/components/content/Accordion.vue +18 -0
- package/components/content/AccordionItem.vue +32 -0
- package/components/content/Alert.vue +100 -0
- package/components/content/Badge.vue +52 -0
- package/components/content/ButtonLink.vue +38 -0
- package/components/content/Callout.vue +17 -0
- package/components/content/Card.vue +173 -0
- package/components/content/CardGroup.vue +38 -0
- package/components/content/CodeCopy.vue +52 -0
- package/components/content/CodeGroup._vue +27 -0
- package/components/content/CodeSnippet._vue +78 -0
- package/components/content/Collapsible.vue +80 -0
- package/components/content/Field.vue +53 -0
- package/components/content/FieldGroup.vue +5 -0
- package/components/content/FileTree.vue +110 -0
- package/components/content/FileTreeItem.vue +64 -0
- package/components/content/FileTreeRoot.vue +27 -0
- package/components/content/Hero.vue +154 -0
- package/components/content/HeroAlt.vue +116 -0
- package/components/content/Icon.vue +69 -0
- package/components/content/Kbd.vue +20 -0
- package/components/content/PmInstall.vue +35 -0
- package/components/content/PmRun.vue +31 -0
- package/components/content/PmX.vue +31 -0
- package/components/content/ProseA.vue +21 -0
- package/components/content/ProseBlockquote.vue +5 -0
- package/components/content/ProseCode.vue +121 -0
- package/components/content/ProseCodeInline.vue +24 -0
- package/components/content/ProseEm.vue +5 -0
- package/components/content/ProseH1.vue +27 -0
- package/components/content/ProseH2.vue +22 -0
- package/components/content/ProseH3.vue +21 -0
- package/components/content/ProseH4.vue +21 -0
- package/components/content/ProseH5.vue +21 -0
- package/components/content/ProseH6.vue +21 -0
- package/components/content/ProseHr.vue +3 -0
- package/components/content/ProseImg.vue +42 -0
- package/components/content/ProseLi.vue +5 -0
- package/components/content/ProseOl.vue +5 -0
- package/components/content/ProseP.vue +5 -0
- package/components/content/ProsePre.vue +56 -0
- package/components/content/ProseSection.vue +27 -0
- package/components/content/ProseStrong.vue +5 -0
- package/components/content/ProseTable.vue +7 -0
- package/components/content/ProseTbody.vue +5 -0
- package/components/content/ProseTd.vue +5 -0
- package/components/content/ProseTh.vue +5 -0
- package/components/content/ProseThead.vue +5 -0
- package/components/content/ProseTr.vue +5 -0
- package/components/content/ProseUl.vue +5 -0
- package/components/content/ReadMore.vue +41 -0
- package/components/content/Shortcut.vue +20 -0
- package/components/content/Stack.vue +17 -0
- package/components/content/Steps.vue +23 -0
- package/components/content/Tabs.vue +52 -0
- package/components/content/TabsInner.vue +263 -0
- package/components/content/TeamCard.vue +52 -0
- package/components/content/TeamCardGroup.vue +5 -0
- package/components/content/global/AlertEditor.vue +58 -0
- package/components/content/global/BadgeEditor.vue +56 -0
- package/components/content/global/BrEditor.vue +3 -0
- package/components/content/global/CardEditor.vue +142 -0
- package/components/content/global/CardGroupEditor.vue +50 -0
- package/components/content/global/CodeGroup.vue +13 -0
- package/components/content/global/CodeGroupEditor.vue +50 -0
- package/components/content/global/DivEditor.vue +22 -0
- package/components/content/global/FieldEditor.vue +38 -0
- package/components/content/global/FieldGroupEditor.vue +24 -0
- package/components/content/global/HeroEditor.vue +67 -0
- package/components/content/global/ProseSectionEditor.vue +180 -0
- package/components/content/global/ReadMoreEditor.vue +70 -0
- package/components/content/global/SectionEditor.vue +22 -0
- package/components/content/global/StackEditor.vue +35 -0
- package/components/content/global/StepsEditor.vue +55 -0
- package/components/content/global/Tabs._vue +97 -0
- package/components/content/global/TabsEditor.vue +38 -0
- package/components/layout/Aside.vue +83 -0
- package/components/layout/AsideTree.vue +25 -0
- package/components/layout/AsideTreeItem.vue +86 -0
- package/components/layout/AsideTreeItemButton.vue +32 -0
- package/components/layout/Banner.vue +77 -0
- package/components/layout/Breadcrumb.vue +34 -0
- package/components/layout/DocsFooter.vue +6 -0
- package/components/layout/EditLink.vue +23 -0
- package/components/layout/Footer.vue +80 -0
- package/components/layout/FooterItem.vue +50 -0
- package/components/layout/FooterSubmenuItem.vue +39 -0
- package/components/layout/Header/Logo.vue +30 -0
- package/components/layout/Header/MenuItem.vue +83 -0
- package/components/layout/Header/Nav.vue +112 -0
- package/components/layout/Header/NavMobile.vue +14 -0
- package/components/layout/Header/NavMobileItem.vue +79 -0
- package/components/layout/Header/SubmenuItem.vue +39 -0
- package/components/layout/Header.vue +160 -0
- package/components/layout/LangSwitcher.vue +90 -0
- package/components/layout/MobileNav.vue +44 -0
- package/components/layout/PrevNext.vue +24 -0
- package/components/layout/PrevNextButton.vue +50 -0
- package/components/layout/SearchButton.vue +46 -0
- package/components/layout/SearchDialog.vue +217 -0
- package/components/layout/Title.vue +98 -0
- package/components/layout/Toc.vue +99 -0
- package/components/layout/TocTree.vue +42 -0
- package/components/ui/accordion/Accordion.vue +19 -0
- package/components/ui/accordion/AccordionContent.vue +24 -0
- package/components/ui/accordion/AccordionItem.vue +24 -0
- package/components/ui/accordion/AccordionTrigger.vue +39 -0
- package/components/ui/accordion/index.ts +4 -0
- package/components/ui/alert/Alert.vue +19 -0
- package/components/ui/alert/AlertDescription.vue +14 -0
- package/components/ui/alert/AlertTitle.vue +14 -0
- package/components/ui/alert/index.ts +23 -0
- package/components/ui/avatar/Avatar.vue +25 -0
- package/components/ui/avatar/AvatarFallback.vue +11 -0
- package/components/ui/avatar/AvatarImage.vue +12 -0
- package/components/ui/avatar/index.ts +24 -0
- package/components/ui/badge/Badge.vue +17 -0
- package/components/ui/badge/index.ts +71 -0
- package/components/ui/breadcrumb/Breadcrumb.vue +16 -0
- package/components/ui/breadcrumb/BreadcrumbItem.vue +16 -0
- package/components/ui/breadcrumb/BreadcrumbLink.vue +23 -0
- package/components/ui/breadcrumb/BreadcrumbList.vue +16 -0
- package/components/ui/breadcrumb/BreadcrumbPage.vue +19 -0
- package/components/ui/breadcrumb/BreadcrumbSeparator.vue +23 -0
- package/components/ui/breadcrumb/index.ts +6 -0
- package/components/ui/button/Button.vue +29 -0
- package/components/ui/button/index.ts +35 -0
- package/components/ui/card/Card.vue +21 -0
- package/components/ui/card/CardContent.vue +14 -0
- package/components/ui/card/CardDescription.vue +14 -0
- package/components/ui/card/CardFooter.vue +14 -0
- package/components/ui/card/CardHeader.vue +14 -0
- package/components/ui/card/CardTitle.vue +18 -0
- package/components/ui/card/index.ts +6 -0
- package/components/ui/collapsible/Collapsible.vue +18 -0
- package/components/ui/collapsible/CollapsibleContent.vue +14 -0
- package/components/ui/collapsible/CollapsibleTrigger.vue +11 -0
- package/components/ui/collapsible/index.ts +3 -0
- package/components/ui/command/Command.vue +89 -0
- package/components/ui/command/CommandEmpty.vue +30 -0
- package/components/ui/command/CommandGroup.vue +50 -0
- package/components/ui/command/CommandInput.vue +44 -0
- package/components/ui/command/CommandInputOnly.vue +50 -0
- package/components/ui/command/CommandItem.vue +79 -0
- package/components/ui/command/CommandList.vue +28 -0
- package/components/ui/command/CommandSeparator.vue +24 -0
- package/components/ui/command/index.ts +24 -0
- package/components/ui/dialog/Dialog.vue +14 -0
- package/components/ui/dialog/DialogClose.vue +11 -0
- package/components/ui/dialog/DialogContent.vue +52 -0
- package/components/ui/dialog/DialogDescription.vue +24 -0
- package/components/ui/dialog/DialogFooter.vue +19 -0
- package/components/ui/dialog/DialogHeader.vue +16 -0
- package/components/ui/dialog/DialogScrollContent.vue +61 -0
- package/components/ui/dialog/DialogTitle.vue +29 -0
- package/components/ui/dialog/DialogTrigger.vue +11 -0
- package/components/ui/dialog/index.ts +9 -0
- package/components/ui/input/Input.vue +27 -0
- package/components/ui/input/index.ts +1 -0
- package/components/ui/label/Label.vue +27 -0
- package/components/ui/label/index.ts +1 -0
- package/components/ui/navigation-menu/NavigationMenu.vue +33 -0
- package/components/ui/navigation-menu/NavigationMenuContent.vue +34 -0
- package/components/ui/navigation-menu/NavigationMenuIndicator.vue +24 -0
- package/components/ui/navigation-menu/NavigationMenuItem.vue +11 -0
- package/components/ui/navigation-menu/NavigationMenuLink.vue +19 -0
- package/components/ui/navigation-menu/NavigationMenuList.vue +33 -0
- package/components/ui/navigation-menu/NavigationMenuTrigger.vue +34 -0
- package/components/ui/navigation-menu/NavigationMenuViewport.vue +33 -0
- package/components/ui/navigation-menu/index.ts +14 -0
- package/components/ui/popover/Popover.vue +15 -0
- package/components/ui/popover/PopoverContent.vue +49 -0
- package/components/ui/popover/PopoverTrigger.vue +11 -0
- package/components/ui/popover/index.ts +4 -0
- package/components/ui/scroll-area/ScrollArea.vue +32 -0
- package/components/ui/scroll-area/ScrollBar.vue +41 -0
- package/components/ui/scroll-area/index.ts +2 -0
- package/components/ui/separator/Separator.vue +20 -0
- package/components/ui/separator/index.ts +1 -0
- package/components/ui/sheet/Sheet.vue +14 -0
- package/components/ui/sheet/SheetClose.vue +11 -0
- package/components/ui/sheet/SheetContent.vue +58 -0
- package/components/ui/sheet/SheetDescription.vue +22 -0
- package/components/ui/sheet/SheetFooter.vue +19 -0
- package/components/ui/sheet/SheetHeader.vue +16 -0
- package/components/ui/sheet/SheetTitle.vue +22 -0
- package/components/ui/sheet/SheetTrigger.vue +11 -0
- package/components/ui/sheet/index.ts +31 -0
- package/components/ui/slider/Slider.vue +36 -0
- package/components/ui/slider/index.ts +1 -0
- package/components/ui/tabs/Tabs.vue +15 -0
- package/components/ui/tabs/TabsContent.vue +22 -0
- package/components/ui/tabs/TabsList.vue +25 -0
- package/components/ui/tabs/TabsTrigger.vue +27 -0
- package/components/ui/tabs/index.ts +4 -0
- package/components/ui/textarea/Textarea.vue +27 -0
- package/components/ui/textarea/index.ts +1 -0
- package/components/ui/toast/Toast.vue +28 -0
- package/components/ui/toast/ToastAction.vue +22 -0
- package/components/ui/toast/ToastClose.vue +27 -0
- package/components/ui/toast/ToastDescription.vue +22 -0
- package/components/ui/toast/ToastProvider.vue +11 -0
- package/components/ui/toast/ToastTitle.vue +22 -0
- package/components/ui/toast/ToastViewport.vue +20 -0
- package/components/ui/toast/Toaster.vue +34 -0
- package/components/ui/toast/index.ts +38 -0
- package/components/ui/toast/use-toast.ts +165 -0
- package/components.json +18 -0
- package/composables/useBreadcrumb.ts +47 -0
- package/composables/useCollapsedMap.ts +3 -0
- package/composables/useConfig.ts +227 -0
- package/composables/useEditLink.ts +27 -0
- package/composables/useI18nDocs.ts +114 -0
- package/composables/useMdcMenu.ts +204 -0
- package/composables/usePm.ts +58 -0
- package/composables/useScrollspy.ts +51 -0
- package/composables/useThemes.ts +46 -0
- package/composables/useToast.ts +1 -0
- package/content/index.md +45 -0
- package/eslint.config.js +3 -0
- package/i18n/i18n.config.ts +414 -0
- package/index.d.ts +610 -0
- package/layouts/blank.vue +5 -0
- package/layouts/default.vue +9 -0
- package/layouts/editorial.vue +83 -0
- package/lib/registry/themes.ts +636 -0
- package/lib/uno-preset.ts +143 -0
- package/memory-bank/activeContext.md +17 -0
- package/memory-bank/productContext.md +21 -0
- package/memory-bank/progress.md +16 -0
- package/memory-bank/projectbrief.md +20 -0
- package/memory-bank/systemPatterns.md +25 -0
- package/memory-bank/techContext.md +29 -0
- package/modules/inject-css.ts +40 -0
- package/nuxt.config.ts +124 -0
- package/package.json +71 -0
- package/pages/[...slug].vue +109 -0
- package/pages/admin/[...slug].vue +145 -0
- package/pages/index.vue +24 -0
- package/plugins/injectCssHmr.ts +26 -0
- package/plugins/wordup.ts +130 -0
- package/public/content-doc.json +792 -0
- package/public/iconesjs.svg +4 -0
- package/scripts/buildContentDoc-cli.ts +8 -0
- package/scripts/buildContentDoc.ts +165 -0
- package/tailwind.config.js +1 -0
- package/tsconfig.json +3 -0
- package/uno.config.mjs +58 -0
- package/utils/index.ts +12 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="group grid gap-4 md:grid-cols-2 [&:not(:first-child)]:mt-5">
|
|
3
|
+
<slot v-if="!data" />
|
|
4
|
+
|
|
5
|
+
<template v-else>
|
|
6
|
+
<Card
|
|
7
|
+
v-for="(item, index) in _data"
|
|
8
|
+
:key="index"
|
|
9
|
+
:title="item.title"
|
|
10
|
+
:description="item.description"
|
|
11
|
+
:to="item._path"
|
|
12
|
+
:icon="item.icon"
|
|
13
|
+
|
|
14
|
+
:media="item.cover"
|
|
15
|
+
/>
|
|
16
|
+
</template>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import type { ParsedContent } from '@nuxt/content'
|
|
22
|
+
|
|
23
|
+
const props = defineProps<{
|
|
24
|
+
data?: string
|
|
25
|
+
}>()
|
|
26
|
+
|
|
27
|
+
const _data = ref<ParsedContent[] | undefined>(undefined)
|
|
28
|
+
|
|
29
|
+
if (props.data) {
|
|
30
|
+
const { data } = await useAsyncData('card-group-data-' + String(props.data), () =>
|
|
31
|
+
queryContent(props.data!).find(),
|
|
32
|
+
)
|
|
33
|
+
// Remove _dir.yaml ...
|
|
34
|
+
_data.value = data.value?.filter(item => !item._partial)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
defineSlots()
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex">
|
|
3
|
+
<Transition
|
|
4
|
+
name="fade"
|
|
5
|
+
mode="out-in"
|
|
6
|
+
>
|
|
7
|
+
<div v-if="copied === false">
|
|
8
|
+
<NuxtIcon
|
|
9
|
+
name="lucide:copy"
|
|
10
|
+
class="block cursor-pointer self-center text-muted-foreground hover:text-primary"
|
|
11
|
+
@click="handleClick"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
<div v-else>
|
|
15
|
+
<NuxtIcon
|
|
16
|
+
ref="checkIconRef"
|
|
17
|
+
name="lucide:check"
|
|
18
|
+
class="block cursor-pointer self-center text-muted-foreground hover:text-primary"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
</Transition>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup lang="ts">
|
|
26
|
+
import { useToast } from '@/components/ui/toast/use-toast'
|
|
27
|
+
|
|
28
|
+
const { code } = defineProps<{
|
|
29
|
+
code: string
|
|
30
|
+
}>()
|
|
31
|
+
|
|
32
|
+
const { toast } = useToast()
|
|
33
|
+
|
|
34
|
+
const { copy } = useClipboard({ source: code })
|
|
35
|
+
const copied = ref(false)
|
|
36
|
+
|
|
37
|
+
async function handleClick() {
|
|
38
|
+
await copy(code)
|
|
39
|
+
copied.value = true
|
|
40
|
+
|
|
41
|
+
if (useConfig().value.main.codeCopyToast) {
|
|
42
|
+
toast({
|
|
43
|
+
description: useConfig().value.main.codeCopyToastText,
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const checkIconRef = ref<HTMLElement>()
|
|
49
|
+
onClickOutside(checkIconRef, () => {
|
|
50
|
+
copied.value = false
|
|
51
|
+
})
|
|
52
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<render />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import type { SetupContext } from 'vue';
|
|
7
|
+
import Tabs from './Tabs.vue';
|
|
8
|
+
|
|
9
|
+
const { inStack = false, sync } = defineProps<{
|
|
10
|
+
inStack?: boolean;
|
|
11
|
+
sync?: string;
|
|
12
|
+
}>();
|
|
13
|
+
|
|
14
|
+
const _slots: SetupContext['slots'] = useSlots();
|
|
15
|
+
function render() {
|
|
16
|
+
const slots = _slots?.default?.() || [];
|
|
17
|
+
return h(
|
|
18
|
+
Tabs,
|
|
19
|
+
{
|
|
20
|
+
variant: 'card',
|
|
21
|
+
inStack,
|
|
22
|
+
sync,
|
|
23
|
+
},
|
|
24
|
+
() => slots,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MDC
|
|
3
|
+
v-if="loadedCode"
|
|
4
|
+
:value="md"
|
|
5
|
+
class="[&:not(:first-child)]:mt-5"
|
|
6
|
+
/>
|
|
7
|
+
<UiAlert
|
|
8
|
+
v-else
|
|
9
|
+
variant="destructive"
|
|
10
|
+
>
|
|
11
|
+
<UiAlertTitle>Error</UiAlertTitle>
|
|
12
|
+
<UiAlertDescription>
|
|
13
|
+
Cannot load code: <ProseCodeInline>{{ file || url }}</ProseCodeInline>
|
|
14
|
+
</UiAlertDescription>
|
|
15
|
+
</UiAlert>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
const { file, url, language, title, highlights, meta, start, offset }
|
|
20
|
+
= defineProps<{
|
|
21
|
+
file?: string
|
|
22
|
+
url?: string
|
|
23
|
+
language: string
|
|
24
|
+
title?: string
|
|
25
|
+
highlights?: string
|
|
26
|
+
meta?: string
|
|
27
|
+
start?: number
|
|
28
|
+
offset?: number
|
|
29
|
+
}>()
|
|
30
|
+
|
|
31
|
+
const loadedCode = ref('')
|
|
32
|
+
|
|
33
|
+
const rawFiles = import.meta.glob(
|
|
34
|
+
[
|
|
35
|
+
'@/**/*.{abap,asc,ash,ampl,mod,g4,apib,apl,dyalog,asp,asax,ascx,ashx,asmx,aspx,axd,dats,hats,sats,as,adb,ada,ads,agda,als,apacheconf,vhost,cls,applescript,scpt,arc,ino,asciidoc,adoc,asc,aj,asm,a51,inc,nasm,aug,ahk,ahkl,au3,awk,auk,gawk,mawk,nawk,bat,cmd,befunge,bison,bb,decls,bmx,bsv,boo,b,bf,brs,bro,c,cats,h,idc,w,cs,cake,cshtml,csx,cpp,c++,cc,cp,cxx,h,h++,hh,hpp,hxx,inc,inl,ipp,tcc,tpp,c-objdump,chs,clp,cmake,cmake.in,cob,cbl,ccp,cobol,cpy,css,csv,capnp,mss,ceylon,chpl,ch,ck,cirru,clw,icl,dcl,click,clj,boot,cl2,cljc,cljs,cljs.hl,cljscm,cljx,hic,coffee,_coffee,cake,cjsx,cson,iced,cfm,cfml,cfc,lisp,asd,cl,l,lsp,ny,podsl,sexp,cp,cps,cl,coq,v,cppobjdump,c++-objdump,c++objdump,cpp-objdump,cxx-objdump,creole,cr,feature,cu,cuh,cy,pyx,pxd,pxi,d,di,d-objdump,com,dm,zone,arpa,d,darcspatch,dpatch,dart,diff,patch,dockerfile,djs,dylan,dyl,intr,lid,E,ecl,eclxml,ecl,sch,brd,epj,e,ex,exs,elm,el,emacs,emacs.desktop,em,emberscript,erl,es,escript,hrl,xrl,yrl,fs,fsi,fsx,fx,flux,f90,f,f03,f08,f77,f95,for,fpp,factor,fy,fancypack,fan,fs,for,eam.fs,fth,4th,f,for,forth,fr,frt,fs,ftl,fr,g,gco,gcode,gms,g,gap,gd,gi,tst,s,ms,gd,glsl,fp,frag,frg,fs,fsh,fshader,geo,geom,glslv,gshader,shader,vert,vrx,vsh,vshader,gml,kid,ebuild,eclass,po,pot,glf,gp,gnu,gnuplot,plot,plt,go,golo,gs,gst,gsx,vark,grace,gradle,gf,gml,graphql,dot,gv,man,1,1in,1m,1x,2,3,3in,3m,3qt,3x,4,5,6,7,8,9,l,me,ms,n,rno,roff,groovy,grt,gtpl,gvy,gsp,hcl,tf,hlsl,fx,fxh,hlsli,html,htm,html.hl,inc,st,xht,xhtml,mustache,jinja,eex,erb,erb.deface,phtml,http,hh,php,haml,haml.deface,handlebars,hbs,hb,hs,hsc,hx,hxsl,hy,bf,pro,dlm,ipf,ini,cfg,prefs,pro,properties,irclog,weechatlog,idr,lidr,ni,i7x,iss,io,ik,thy,ijs,flex,jflex,json,geojson,lock,topojson,json5,jsonld,jq,jsx,jade,j,java,jsp,js,_js,bones,es,es6,frag,gs,jake,jsb,jscad,jsfl,jsm,jss,njs,pac,sjs,ssjs,sublime-build,sublime-commands,sublime-completions,sublime-keymap,sublime-macro,sublime-menu,sublime-mousemap,sublime-project,sublime-settings,sublime-theme,sublime-workspace,sublime_metrics,sublime_session,xsjs,xsjslib,jl,ipynb,krl,sch,brd,kicad_pcb,kit,kt,ktm,kts,lfe,ll,lol,lsl,lslp,lvproj,lasso,las,lasso8,lasso9,ldml,latte,lean,hlean,less,l,lex,ly,ily,b,m,ld,lds,mod,liquid,lagda,litcoffee,lhs,ls,_ls,xm,x,xi,lgt,logtalk,lookml,ls,lua,fcgi,nse,pd_lua,rbxs,wlua,mumps,m,m4,m4,ms,mcr,mtml,muf,m,mak,d,mk,mkfile,mako,mao,md,markdown,mkd,mkdn,mkdown,ron,mask,mathematica,cdf,m,ma,mt,nb,nbp,wl,wlt,matlab,m,maxpat,maxhelp,maxproj,mxt,pat,mediawiki,wiki,m,moo,metal,minid,druby,duby,mir,mirah,mo,mod,mms,mmk,monkey,moo,moon,myt,ncl,nl,nsi,nsh,n,axs,axi,axs.erb,axi.erb,nlogo,nl,lisp,lsp,nginxconf,vhost,nim,nimrod,ninja,nit,nix,nu,numpy,numpyw,numsc,ml,eliom,eliomi,ml4,mli,mll,mly,objdump,m,h,mm,j,sj,omgrofl,opa,opal,cl,opencl,p,cls,scad,org,ox,oxh,oxo,oxygene,oz,pwn,inc,php,aw,ctp,fcgi,inc,php3,php4,php5,phps,phpt,pls,pck,pkb,pks,plb,plsql,sql,sql,pov,inc,pan,psc,parrot,pasm,pir,pas,dfm,dpr,inc,lpr,pp,pl,al,cgi,fcgi,perl,ph,plx,pm,pod,psgi,t,6pl,6pm,nqp,p6,p6l,p6m,pl,pl6,pm,pm6,t,pkl,l,pig,pike,pmod,pod,pogo,pony,ps,eps,ps1,psd1,psm1,pde,pl,pro,prolog,yap,spin,proto,asc,pub,pp,pd,pb,pbi,purs,py,bzl,cgi,fcgi,gyp,lmi,pyde,pyp,pyt,pyw,rpy,tac,wsgi,xpy,pytb,qml,qbs,pro,pri,r,rd,rsx,raml,rdoc,rbbas,rbfrm,rbmnu,rbres,rbtbar,rbuistate,rhtml,rmd,rkt,rktd,rktl,scrbl,rl,raw,reb,r,r2,r3,rebol,red,reds,cw,rpy,rs,rsh,robot,rg,rb,builder,fcgi,gemspec,god,irbrc,jbuilder,mspec,pluginspec,podspec,rabl,rake,rbuild,rbw,rbx,ru,ruby,thor,watchr,rs,rs.in,sas,scss,smt2,smt,sparql,rq,sqf,hqf,sql,cql,ddl,inc,prc,tab,udf,viw,sql,db2,ston,svg,sage,sagews,sls,sass,scala,sbt,sc,scaml,scm,sld,sls,sps,ss,sci,sce,tst,self,sh,bash,bats,cgi,command,fcgi,ksh,sh.in,tmux,tool,zsh,sh-session,shen,sl,slim,smali,st,cs,tpl,sp,inc,sma,nut,stan,ML,fun,sig,sml,do,ado,doh,ihlp,mata,matah,sthlp,styl,sc,scd,swift,sv,svh,vh,toml,txl,tcl,adp,tm,tcsh,csh,tex,aux,bbx,bib,cbx,cls,dtx,ins,lbx,ltx,mkii,mkiv,mkvi,sty,toc,tea,t,txt,fr,nb,ncl,no,textile,thrift,t,tu,ttl,twig,ts,tsx,upc,anim,asset,mat,meta,prefab,unity,uno,uc,ur,urs,vcl,vhdl,vhd,vhf,vhi,vho,vhs,vht,vhw,vala,vapi,v,veo,vim,vb,bas,cls,frm,frx,vba,vbhtml,vbs,volt,vue,owl,webidl,x10,xc,xml,ant,axml,ccxml,clixml,cproject,csl,csproj,ct,dita,ditamap,ditaval,dll.config,dotsettings,filters,fsproj,fxml,glade,gml,grxml,iml,ivy,jelly,jsproj,kml,launch,mdpolicy,mm,mod,mxml,nproj,nuspec,odd,osm,plist,pluginspec,props,ps1xml,psc1,pt,rdf,rss,scxml,srdf,storyboard,stTheme,sublime-snippet,targets,tmCommand,tml,tmLanguage,tmPreferences,tmSnippet,tmTheme,ts,tsx,ui,urdf,ux,vbproj,vcxproj,vssettings,vxml,wsdl,wsf,wxi,wxl,wxs,x3d,xacro,xaml,xib,xlf,xliff,xmi,xml.dist,xproj,xsd,xul,zcml,xsp-config,xsp.metadata,xpl,xproc,xquery,xq,xql,xqm,xqy,xs,xslt,xsl,xojo_code,xojo_menu,xojo_report,xojo_script,xojo_toolbar,xojo_window,xtend,yml,reek,rviz,sublime-syntax,syntax,yaml,yaml-tmlanguage,yang,y,yacc,yy,zep,zimpl,zmpl,zpl,desktop,desktop.in,ec,eh,edn,fish,mu,nc,ooc,rst,rest,rest.txt,rst.txt,wisp,prg,ch,prw}',
|
|
36
|
+
'!@/**/nuxt.config.ts',
|
|
37
|
+
],
|
|
38
|
+
{
|
|
39
|
+
query: '?raw',
|
|
40
|
+
import: 'default',
|
|
41
|
+
},
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
if (file) {
|
|
45
|
+
const importer = rawFiles[file]
|
|
46
|
+
if (importer) {
|
|
47
|
+
loadedCode.value = (await importer()) as string
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else if (url) {
|
|
51
|
+
try {
|
|
52
|
+
const data = await $fetch(url, { parseResponse: txt => txt })
|
|
53
|
+
if (data) {
|
|
54
|
+
loadedCode.value = data as string
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// Do nothing
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (loadedCode.value && start && offset) {
|
|
63
|
+
const lines = loadedCode.value.split('\n')
|
|
64
|
+
loadedCode.value = lines
|
|
65
|
+
.slice(Number(start || 1) - 1, Number(start || 1) - 1 + Number(offset))
|
|
66
|
+
.join('\n')
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const md = `
|
|
70
|
+
::div
|
|
71
|
+
\`\`\`\`${language} ${title && `[${title}]`} ${
|
|
72
|
+
highlights && `{${highlights}}`
|
|
73
|
+
} ${meta || ''}
|
|
74
|
+
${loadedCode.value}
|
|
75
|
+
\`\`\`\`
|
|
76
|
+
::
|
|
77
|
+
`
|
|
78
|
+
</script>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UiCollapsible
|
|
3
|
+
v-if="variant === 'card'"
|
|
4
|
+
v-model:open="isOpen"
|
|
5
|
+
class="space-y-2"
|
|
6
|
+
>
|
|
7
|
+
<div class="flex items-center justify-between space-x-4">
|
|
8
|
+
<h4 class="text-sm font-semibold">
|
|
9
|
+
<ContentSlot
|
|
10
|
+
:use="$slots.title"
|
|
11
|
+
unwrap="p"
|
|
12
|
+
/>
|
|
13
|
+
{{ title }}
|
|
14
|
+
</h4>
|
|
15
|
+
<UiCollapsibleTrigger as-child>
|
|
16
|
+
<UiButton
|
|
17
|
+
variant="ghost"
|
|
18
|
+
size="sm"
|
|
19
|
+
class="w-9 p-0"
|
|
20
|
+
>
|
|
21
|
+
<NuxtIcon name="lucide:chevrons-up-down" />
|
|
22
|
+
<span class="sr-only">Toggle</span>
|
|
23
|
+
</UiButton>
|
|
24
|
+
</UiCollapsibleTrigger>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<UiCollapsibleContent class="space-y-2">
|
|
28
|
+
<div class="rounded-md border px-4 py-3 font-mono text-sm">
|
|
29
|
+
<ContentSlot
|
|
30
|
+
:use="$slots.content"
|
|
31
|
+
unwrap="p"
|
|
32
|
+
/>
|
|
33
|
+
<ContentSlot unwrap="p" />
|
|
34
|
+
</div>
|
|
35
|
+
</UiCollapsibleContent>
|
|
36
|
+
</UiCollapsible>
|
|
37
|
+
|
|
38
|
+
<UiCollapsible
|
|
39
|
+
v-else-if="variant === 'simple'"
|
|
40
|
+
v-model:open="isOpen"
|
|
41
|
+
>
|
|
42
|
+
<UiCollapsibleTrigger class="w-full text-left">
|
|
43
|
+
<div class="flex w-full gap-1">
|
|
44
|
+
<NuxtIcon
|
|
45
|
+
name="lucide:chevron-down"
|
|
46
|
+
class="self-center transition-all"
|
|
47
|
+
:class="[!isOpen && '-rotate-90']"
|
|
48
|
+
/>
|
|
49
|
+
<span>
|
|
50
|
+
<ContentSlot
|
|
51
|
+
:use="$slots.title"
|
|
52
|
+
unwrap="p"
|
|
53
|
+
/>
|
|
54
|
+
{{ title }}
|
|
55
|
+
</span>
|
|
56
|
+
</div>
|
|
57
|
+
</UiCollapsibleTrigger>
|
|
58
|
+
<UiCollapsibleContent>
|
|
59
|
+
<div class="ml-2 border-l py-2 pl-4">
|
|
60
|
+
<ContentSlot
|
|
61
|
+
:use="$slots.content"
|
|
62
|
+
unwrap="p"
|
|
63
|
+
/>
|
|
64
|
+
<ContentSlot unwrap="p" />
|
|
65
|
+
</div>
|
|
66
|
+
</UiCollapsibleContent>
|
|
67
|
+
</UiCollapsible>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script setup lang="ts">
|
|
71
|
+
const { variant = 'simple', defaultOpen = false } = defineProps<{
|
|
72
|
+
variant?: 'simple' | 'card'
|
|
73
|
+
title?: string
|
|
74
|
+
defaultOpen?: boolean
|
|
75
|
+
}>()
|
|
76
|
+
|
|
77
|
+
defineSlots()
|
|
78
|
+
|
|
79
|
+
const isOpen = ref(defaultOpen)
|
|
80
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="[&:not(:first-child)]:mt-4 [&:not(:first-child)]:pt-4 animate-scroll-fade-in-up">
|
|
3
|
+
<div class="mb-2">
|
|
4
|
+
<div class="flex items-center gap-2">
|
|
5
|
+
<Badge
|
|
6
|
+
type="primary"
|
|
7
|
+
size="lg"
|
|
8
|
+
>
|
|
9
|
+
{{ name }}
|
|
10
|
+
</Badge>
|
|
11
|
+
|
|
12
|
+
<span
|
|
13
|
+
v-if="required"
|
|
14
|
+
class="font-mono text-sm text-muted-foreground"
|
|
15
|
+
>
|
|
16
|
+
{{ $t(fieldRequiredText) }}
|
|
17
|
+
</span>
|
|
18
|
+
|
|
19
|
+
<span class="ml-auto font-mono text-sm text-muted-foreground text-right text-balance">
|
|
20
|
+
{{ type }}
|
|
21
|
+
</span>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div
|
|
25
|
+
v-if="defaultValue"
|
|
26
|
+
class="text-muted-foreground text-right"
|
|
27
|
+
>
|
|
28
|
+
<span class="font-bold mr-1 text-sm text-muted-foreground">
|
|
29
|
+
default:
|
|
30
|
+
</span>
|
|
31
|
+
<ProseCodeInline>
|
|
32
|
+
{{ defaultValue }}
|
|
33
|
+
</ProseCodeInline>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<span class="text-sm text-muted-foreground">
|
|
37
|
+
<ContentSlot unwrap="p" />
|
|
38
|
+
{{ description }}
|
|
39
|
+
</span>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup lang="ts">
|
|
44
|
+
defineProps<{
|
|
45
|
+
name: string
|
|
46
|
+
type?: string
|
|
47
|
+
required?: boolean
|
|
48
|
+
description?: string
|
|
49
|
+
defaultValue?: string
|
|
50
|
+
}>()
|
|
51
|
+
|
|
52
|
+
const { fieldRequiredText } = useConfig().value.main
|
|
53
|
+
</script>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<UiCard
|
|
3
|
+
class="relative overflow-hidden [&:not(:first-child)]:mt-5 [&:not(:last-child)]:mb-5"
|
|
4
|
+
>
|
|
5
|
+
<div
|
|
6
|
+
v-if="title"
|
|
7
|
+
class="flex items-center border-b p-3 font-mono text-sm"
|
|
8
|
+
>
|
|
9
|
+
<Icon
|
|
10
|
+
v-if="icon"
|
|
11
|
+
:name="icon"
|
|
12
|
+
class="mr-1.5"
|
|
13
|
+
/>
|
|
14
|
+
<span>{{ title }}</span>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div class="w-auto bg-muted/30 p-2">
|
|
18
|
+
<FileTreeRoot
|
|
19
|
+
:tree="parsedTree"
|
|
20
|
+
:show-arrow
|
|
21
|
+
:show-icon
|
|
22
|
+
:level="0"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
</UiCard>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
type InputTreeItem =
|
|
30
|
+
| string
|
|
31
|
+
| {
|
|
32
|
+
[key: string]: InputTreeItem[]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const {
|
|
36
|
+
tree,
|
|
37
|
+
autoSlash = true,
|
|
38
|
+
showArrow = false,
|
|
39
|
+
showIcon = true,
|
|
40
|
+
} = defineProps<{
|
|
41
|
+
title?: string
|
|
42
|
+
icon?: string
|
|
43
|
+
autoSlash?: boolean
|
|
44
|
+
showArrow?: boolean
|
|
45
|
+
showIcon?: boolean
|
|
46
|
+
tree: InputTreeItem[]
|
|
47
|
+
}>()
|
|
48
|
+
|
|
49
|
+
const iconMap = new Map(Object.entries(useConfig().value.main.codeIcon))
|
|
50
|
+
|
|
51
|
+
function getIcon(filename: string, type: 'folder' | 'file') {
|
|
52
|
+
if (filename === '...') return
|
|
53
|
+
if (filename.endsWith('/')) return 'lucide:folder'
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
iconMap.get(filename.split('.')[filename.split('.').length - 1])
|
|
57
|
+
|| iconMap.get(filename.toLowerCase())
|
|
58
|
+
|| (type === 'file' ? 'lucide:file' : 'lucide:folder')
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getItem(
|
|
63
|
+
key: string,
|
|
64
|
+
type: 'folder' | 'file',
|
|
65
|
+
children?: InputTreeItem[],
|
|
66
|
+
): FileTreeItem {
|
|
67
|
+
let title = key
|
|
68
|
+
let highlighted = false
|
|
69
|
+
if (title.startsWith('^') && title.endsWith('^')) {
|
|
70
|
+
title = title.substring(1, title.length - 1)
|
|
71
|
+
highlighted = true
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (type === 'file') {
|
|
75
|
+
return {
|
|
76
|
+
title,
|
|
77
|
+
icon: getIcon(title, 'file'),
|
|
78
|
+
highlighted,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return {
|
|
83
|
+
title: `${title}${autoSlash ? '/' : ''}`,
|
|
84
|
+
icon: getIcon(title, 'folder'),
|
|
85
|
+
children: children && getTree(children),
|
|
86
|
+
highlighted,
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function getTree(tree: InputTreeItem[]) {
|
|
92
|
+
const res: FileTreeItem[] = []
|
|
93
|
+
|
|
94
|
+
for (const item of tree) {
|
|
95
|
+
if (typeof item === 'string') {
|
|
96
|
+
res.push(getItem(item, 'file'))
|
|
97
|
+
}
|
|
98
|
+
else if (typeof item === 'object') {
|
|
99
|
+
for (const key of Object.keys(item))
|
|
100
|
+
res.push(getItem(key, 'folder', item[key]))
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return res
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const parsedTree = computed(() => {
|
|
108
|
+
return getTree(tree)
|
|
109
|
+
})
|
|
110
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li>
|
|
3
|
+
<!-- Folder -->
|
|
4
|
+
<div v-if="tree.children">
|
|
5
|
+
<a
|
|
6
|
+
class="flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1 text-left text-sm font-medium text-foreground/80 hover:bg-muted hover:text-primary"
|
|
7
|
+
:class="[tree.highlighted && 'underline underline-offset-4']"
|
|
8
|
+
@click="isOpen = !isOpen"
|
|
9
|
+
>
|
|
10
|
+
<NuxtIcon
|
|
11
|
+
v-if="showArrow"
|
|
12
|
+
name="lucide:chevron-down"
|
|
13
|
+
class="transition-transform"
|
|
14
|
+
:class="[!isOpen && '-rotate-90']"
|
|
15
|
+
/>
|
|
16
|
+
|
|
17
|
+
<Icon
|
|
18
|
+
v-if="showIcon && tree.icon"
|
|
19
|
+
:name="tree.icon"
|
|
20
|
+
class="min-w-4"
|
|
21
|
+
/>
|
|
22
|
+
|
|
23
|
+
<span :class="[tree.highlighted && 'font-bold text-primary']">
|
|
24
|
+
{{ tree.title }}
|
|
25
|
+
</span>
|
|
26
|
+
</a>
|
|
27
|
+
<div v-show="isOpen">
|
|
28
|
+
<FileTreeRoot
|
|
29
|
+
:show-icon
|
|
30
|
+
:show-arrow
|
|
31
|
+
:tree="tree.children"
|
|
32
|
+
:level="level + 1"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<!-- File -->
|
|
37
|
+
<div
|
|
38
|
+
v-else
|
|
39
|
+
class="flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-foreground/80 hover:bg-muted hover:text-primary"
|
|
40
|
+
:class="[tree.highlighted && 'underline underline-offset-4']"
|
|
41
|
+
>
|
|
42
|
+
<Icon
|
|
43
|
+
v-if="showIcon && tree.icon"
|
|
44
|
+
:name="tree.icon"
|
|
45
|
+
class="min-w-4"
|
|
46
|
+
/>
|
|
47
|
+
|
|
48
|
+
<span :class="[tree.highlighted && 'font-bold text-primary']">
|
|
49
|
+
{{ tree.title }}
|
|
50
|
+
</span>
|
|
51
|
+
</div>
|
|
52
|
+
</li>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script setup lang="ts">
|
|
56
|
+
const { tree, level } = defineProps<{
|
|
57
|
+
showArrow: boolean
|
|
58
|
+
tree: FileTreeItem
|
|
59
|
+
showIcon: boolean
|
|
60
|
+
level: number
|
|
61
|
+
}>()
|
|
62
|
+
|
|
63
|
+
const isOpen = ref(true)
|
|
64
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul
|
|
3
|
+
class="flex flex-col font-mono"
|
|
4
|
+
:class="[level > 0 && 'mx-3.5 border-l px-2']"
|
|
5
|
+
>
|
|
6
|
+
<template
|
|
7
|
+
v-for="link in tree"
|
|
8
|
+
:key="link._id"
|
|
9
|
+
>
|
|
10
|
+
<FileTreeItem
|
|
11
|
+
:show-icon
|
|
12
|
+
:show-arrow
|
|
13
|
+
:tree="link"
|
|
14
|
+
:level="level"
|
|
15
|
+
/>
|
|
16
|
+
</template>
|
|
17
|
+
</ul>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
defineProps<{
|
|
22
|
+
tree: FileTreeItem[]
|
|
23
|
+
level: number
|
|
24
|
+
showArrow: boolean
|
|
25
|
+
showIcon: boolean
|
|
26
|
+
}>()
|
|
27
|
+
</script>
|