@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,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<TabsTrigger
|
|
3
|
+
v-bind="forwardedProps"
|
|
4
|
+
:class="cn(
|
|
5
|
+
'inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm',
|
|
6
|
+
props.class,
|
|
7
|
+
)"
|
|
8
|
+
>
|
|
9
|
+
<slot />
|
|
10
|
+
</TabsTrigger>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { TabsTrigger, type TabsTriggerProps, useForwardProps } from 'reka-ui'
|
|
15
|
+
import { computed, type HTMLAttributes } from 'vue'
|
|
16
|
+
import { cn } from '@/lib/utils'
|
|
17
|
+
|
|
18
|
+
const props = defineProps<TabsTriggerProps & { class?: HTMLAttributes['class'] }>()
|
|
19
|
+
|
|
20
|
+
const delegatedProps = computed(() => {
|
|
21
|
+
const { class: _, ...delegated } = props
|
|
22
|
+
|
|
23
|
+
return delegated
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { useVModel } from '@vueuse/core'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
defaultValue?: string | number
|
|
9
|
+
modelValue?: string | number
|
|
10
|
+
}>()
|
|
11
|
+
|
|
12
|
+
const emits = defineEmits<{
|
|
13
|
+
(e: 'update:modelValue', payload: string | number): void
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const modelValue = useVModel(props, 'modelValue', emits, {
|
|
17
|
+
passive: true,
|
|
18
|
+
defaultValue: props.defaultValue,
|
|
19
|
+
})
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<textarea
|
|
24
|
+
v-model="modelValue"
|
|
25
|
+
:class="cn('flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50', props.class)"
|
|
26
|
+
/>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Textarea } from './Textarea.vue'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ToastRoot
|
|
3
|
+
v-bind="forwarded"
|
|
4
|
+
:class="cn(toastVariants({ variant }), props.class)"
|
|
5
|
+
@update:open="onOpenChange"
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
</ToastRoot>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import { ToastRoot, type ToastRootEmits, useForwardPropsEmits } from 'reka-ui'
|
|
13
|
+
import { computed } from 'vue'
|
|
14
|
+
import { type ToastProps, toastVariants } from '.'
|
|
15
|
+
import { cn } from '@/lib/utils'
|
|
16
|
+
|
|
17
|
+
const props = defineProps<ToastProps>()
|
|
18
|
+
|
|
19
|
+
const emits = defineEmits<ToastRootEmits>()
|
|
20
|
+
|
|
21
|
+
const delegatedProps = computed(() => {
|
|
22
|
+
const { class: _, ...delegated } = props
|
|
23
|
+
|
|
24
|
+
return delegated
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ToastAction
|
|
3
|
+
v-bind="delegatedProps"
|
|
4
|
+
:class="cn('inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive', props.class)"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</ToastAction>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { ToastAction, type ToastActionProps } from 'reka-ui'
|
|
12
|
+
import { computed, type HTMLAttributes } from 'vue'
|
|
13
|
+
import { cn } from '@/lib/utils'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<ToastActionProps & { class?: HTMLAttributes['class'] }>()
|
|
16
|
+
|
|
17
|
+
const delegatedProps = computed(() => {
|
|
18
|
+
const { class: _, ...delegated } = props
|
|
19
|
+
|
|
20
|
+
return delegated
|
|
21
|
+
})
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ToastClose
|
|
3
|
+
v-bind="delegatedProps"
|
|
4
|
+
:class="cn('absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600', props.class)"
|
|
5
|
+
>
|
|
6
|
+
<NuxtIcon
|
|
7
|
+
name="lucide:x"
|
|
8
|
+
class="size-4"
|
|
9
|
+
/>
|
|
10
|
+
</ToastClose>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { ToastClose, type ToastCloseProps } from 'reka-ui'
|
|
15
|
+
import { computed, type HTMLAttributes } from 'vue'
|
|
16
|
+
import { cn } from '@/lib/utils'
|
|
17
|
+
|
|
18
|
+
const props = defineProps<ToastCloseProps & {
|
|
19
|
+
class?: HTMLAttributes['class']
|
|
20
|
+
}>()
|
|
21
|
+
|
|
22
|
+
const delegatedProps = computed(() => {
|
|
23
|
+
const { class: _, ...delegated } = props
|
|
24
|
+
|
|
25
|
+
return delegated
|
|
26
|
+
})
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ToastDescription
|
|
3
|
+
:class="cn('text-sm opacity-90', props.class)"
|
|
4
|
+
v-bind="delegatedProps"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</ToastDescription>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { ToastDescription, type ToastDescriptionProps } from 'reka-ui'
|
|
12
|
+
import { computed, type HTMLAttributes } from 'vue'
|
|
13
|
+
import { cn } from '@/lib/utils'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<ToastDescriptionProps & { class?: HTMLAttributes['class'] }>()
|
|
16
|
+
|
|
17
|
+
const delegatedProps = computed(() => {
|
|
18
|
+
const { class: _, ...delegated } = props
|
|
19
|
+
|
|
20
|
+
return delegated
|
|
21
|
+
})
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ToastTitle
|
|
3
|
+
v-bind="delegatedProps"
|
|
4
|
+
:class="cn('text-sm font-semibold [&+div]:text-xs', props.class)"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</ToastTitle>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { ToastTitle, type ToastTitleProps } from 'reka-ui'
|
|
12
|
+
import { computed, type HTMLAttributes } from 'vue'
|
|
13
|
+
import { cn } from '@/lib/utils'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<ToastTitleProps & { class?: HTMLAttributes['class'] }>()
|
|
16
|
+
|
|
17
|
+
const delegatedProps = computed(() => {
|
|
18
|
+
const { class: _, ...delegated } = props
|
|
19
|
+
|
|
20
|
+
return delegated
|
|
21
|
+
})
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ToastViewport
|
|
3
|
+
v-bind="delegatedProps"
|
|
4
|
+
:class="cn('fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]', props.class)"
|
|
5
|
+
/>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { ToastViewport, type ToastViewportProps } from 'reka-ui'
|
|
10
|
+
import { computed, type HTMLAttributes } from 'vue'
|
|
11
|
+
import { cn } from '@/lib/utils'
|
|
12
|
+
|
|
13
|
+
const props = defineProps<ToastViewportProps & { class?: HTMLAttributes['class'] }>()
|
|
14
|
+
|
|
15
|
+
const delegatedProps = computed(() => {
|
|
16
|
+
const { class: _, ...delegated } = props
|
|
17
|
+
|
|
18
|
+
return delegated
|
|
19
|
+
})
|
|
20
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ToastProvider>
|
|
3
|
+
<Toast
|
|
4
|
+
v-for="toast in toasts"
|
|
5
|
+
:key="toast.id"
|
|
6
|
+
v-bind="toast"
|
|
7
|
+
>
|
|
8
|
+
<div class="grid gap-1">
|
|
9
|
+
<ToastTitle v-if="toast.title">
|
|
10
|
+
{{ toast.title }}
|
|
11
|
+
</ToastTitle>
|
|
12
|
+
<template v-if="toast.description">
|
|
13
|
+
<ToastDescription v-if="isVNode(toast.description)">
|
|
14
|
+
<component :is="toast.description" />
|
|
15
|
+
</ToastDescription>
|
|
16
|
+
<ToastDescription v-else>
|
|
17
|
+
{{ toast.description }}
|
|
18
|
+
</ToastDescription>
|
|
19
|
+
</template>
|
|
20
|
+
<ToastClose />
|
|
21
|
+
</div>
|
|
22
|
+
<component :is="toast.action" />
|
|
23
|
+
</Toast>
|
|
24
|
+
<ToastViewport />
|
|
25
|
+
</ToastProvider>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { isVNode } from 'vue'
|
|
30
|
+
import { useToast } from './use-toast'
|
|
31
|
+
import { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport } from '.'
|
|
32
|
+
|
|
33
|
+
const { toasts } = useToast()
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ToastRootProps } from 'reka-ui'
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
5
|
+
|
|
6
|
+
export { default as Toast } from './Toast.vue'
|
|
7
|
+
export { default as ToastAction } from './ToastAction.vue'
|
|
8
|
+
export { default as ToastClose } from './ToastClose.vue'
|
|
9
|
+
export { default as ToastDescription } from './ToastDescription.vue'
|
|
10
|
+
export { default as Toaster } from './Toaster.vue'
|
|
11
|
+
export { default as ToastProvider } from './ToastProvider.vue'
|
|
12
|
+
export { default as ToastTitle } from './ToastTitle.vue'
|
|
13
|
+
export { default as ToastViewport } from './ToastViewport.vue'
|
|
14
|
+
export { toast, useToast } from './use-toast'
|
|
15
|
+
|
|
16
|
+
export const toastVariants = cva(
|
|
17
|
+
'group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',
|
|
18
|
+
{
|
|
19
|
+
variants: {
|
|
20
|
+
variant: {
|
|
21
|
+
default: 'border bg-background text-foreground',
|
|
22
|
+
destructive:
|
|
23
|
+
'destructive group border-destructive bg-destructive text-destructive-foreground',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: 'default',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
type ToastVariants = VariantProps<typeof toastVariants>
|
|
33
|
+
|
|
34
|
+
export interface ToastProps extends ToastRootProps {
|
|
35
|
+
class?: HTMLAttributes['class']
|
|
36
|
+
variant?: ToastVariants['variant']
|
|
37
|
+
onOpenChange?: ((value: boolean) => void) | undefined
|
|
38
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { Component, VNode } from 'vue'
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import type { ToastProps } from '.'
|
|
4
|
+
|
|
5
|
+
const TOAST_LIMIT = 1
|
|
6
|
+
const TOAST_REMOVE_DELAY = 1000000
|
|
7
|
+
|
|
8
|
+
export type StringOrVNode =
|
|
9
|
+
| string
|
|
10
|
+
| VNode
|
|
11
|
+
| (() => VNode)
|
|
12
|
+
|
|
13
|
+
type ToasterToast = ToastProps & {
|
|
14
|
+
id: string
|
|
15
|
+
title?: string
|
|
16
|
+
description?: StringOrVNode
|
|
17
|
+
action?: Component
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const actionTypes = {
|
|
21
|
+
ADD_TOAST: 'ADD_TOAST',
|
|
22
|
+
UPDATE_TOAST: 'UPDATE_TOAST',
|
|
23
|
+
DISMISS_TOAST: 'DISMISS_TOAST',
|
|
24
|
+
REMOVE_TOAST: 'REMOVE_TOAST',
|
|
25
|
+
} as const
|
|
26
|
+
|
|
27
|
+
let count = 0
|
|
28
|
+
|
|
29
|
+
function genId() {
|
|
30
|
+
count = (count + 1) % Number.MAX_VALUE
|
|
31
|
+
return count.toString()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type ActionType = typeof actionTypes
|
|
35
|
+
|
|
36
|
+
type Action =
|
|
37
|
+
| {
|
|
38
|
+
type: ActionType['ADD_TOAST']
|
|
39
|
+
toast: ToasterToast
|
|
40
|
+
}
|
|
41
|
+
| {
|
|
42
|
+
type: ActionType['UPDATE_TOAST']
|
|
43
|
+
toast: Partial<ToasterToast>
|
|
44
|
+
}
|
|
45
|
+
| {
|
|
46
|
+
type: ActionType['DISMISS_TOAST']
|
|
47
|
+
toastId?: ToasterToast['id']
|
|
48
|
+
}
|
|
49
|
+
| {
|
|
50
|
+
type: ActionType['REMOVE_TOAST']
|
|
51
|
+
toastId?: ToasterToast['id']
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface State {
|
|
55
|
+
toasts: ToasterToast[]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()
|
|
59
|
+
|
|
60
|
+
function addToRemoveQueue(toastId: string) {
|
|
61
|
+
if (toastTimeouts.has(toastId))
|
|
62
|
+
return
|
|
63
|
+
|
|
64
|
+
const timeout = setTimeout(() => {
|
|
65
|
+
toastTimeouts.delete(toastId)
|
|
66
|
+
dispatch({
|
|
67
|
+
type: actionTypes.REMOVE_TOAST,
|
|
68
|
+
toastId,
|
|
69
|
+
})
|
|
70
|
+
}, TOAST_REMOVE_DELAY)
|
|
71
|
+
|
|
72
|
+
toastTimeouts.set(toastId, timeout)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const state = ref<State>({
|
|
76
|
+
toasts: [],
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
function dispatch(action: Action) {
|
|
80
|
+
switch (action.type) {
|
|
81
|
+
case actionTypes.ADD_TOAST:
|
|
82
|
+
state.value.toasts = [action.toast, ...state.value.toasts].slice(0, TOAST_LIMIT)
|
|
83
|
+
break
|
|
84
|
+
|
|
85
|
+
case actionTypes.UPDATE_TOAST:
|
|
86
|
+
state.value.toasts = state.value.toasts.map(t =>
|
|
87
|
+
t.id === action.toast.id ? { ...t, ...action.toast } : t,
|
|
88
|
+
)
|
|
89
|
+
break
|
|
90
|
+
|
|
91
|
+
case actionTypes.DISMISS_TOAST: {
|
|
92
|
+
const { toastId } = action
|
|
93
|
+
|
|
94
|
+
if (toastId) {
|
|
95
|
+
addToRemoveQueue(toastId)
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
state.value.toasts.forEach((toast) => {
|
|
99
|
+
addToRemoveQueue(toast.id)
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
state.value.toasts = state.value.toasts.map(t =>
|
|
104
|
+
t.id === toastId || toastId === undefined
|
|
105
|
+
? {
|
|
106
|
+
...t,
|
|
107
|
+
open: false,
|
|
108
|
+
}
|
|
109
|
+
: t,
|
|
110
|
+
)
|
|
111
|
+
break
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
case actionTypes.REMOVE_TOAST:
|
|
115
|
+
if (action.toastId === undefined)
|
|
116
|
+
state.value.toasts = []
|
|
117
|
+
else
|
|
118
|
+
state.value.toasts = state.value.toasts.filter(t => t.id !== action.toastId)
|
|
119
|
+
|
|
120
|
+
break
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function useToast() {
|
|
125
|
+
return {
|
|
126
|
+
toasts: computed(() => state.value.toasts),
|
|
127
|
+
toast,
|
|
128
|
+
dismiss: (toastId?: string) => dispatch({ type: actionTypes.DISMISS_TOAST, toastId }),
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
type Toast = Omit<ToasterToast, 'id'>
|
|
133
|
+
|
|
134
|
+
function toast(props: Toast) {
|
|
135
|
+
const id = genId()
|
|
136
|
+
|
|
137
|
+
const update = (props: ToasterToast) =>
|
|
138
|
+
dispatch({
|
|
139
|
+
type: actionTypes.UPDATE_TOAST,
|
|
140
|
+
toast: { ...props, id },
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
const dismiss = () => dispatch({ type: actionTypes.DISMISS_TOAST, toastId: id })
|
|
144
|
+
|
|
145
|
+
dispatch({
|
|
146
|
+
type: actionTypes.ADD_TOAST,
|
|
147
|
+
toast: {
|
|
148
|
+
...props,
|
|
149
|
+
id,
|
|
150
|
+
open: true,
|
|
151
|
+
onOpenChange: (open: boolean) => {
|
|
152
|
+
if (!open)
|
|
153
|
+
dismiss()
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
id,
|
|
160
|
+
dismiss,
|
|
161
|
+
update,
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export { toast, useToast }
|
package/components.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://shadcn-vue.com/schema.json",
|
|
3
|
+
"style": "default",
|
|
4
|
+
"typescript": true,
|
|
5
|
+
"tailwind": {
|
|
6
|
+
"config": "tailwind.config.js",
|
|
7
|
+
"css": "assets/css/tailwind.css",
|
|
8
|
+
"baseColor": "zinc",
|
|
9
|
+
"cssVariables": true
|
|
10
|
+
},
|
|
11
|
+
"aliases": {
|
|
12
|
+
"components": "@/components",
|
|
13
|
+
"utils": "@/lib/utils",
|
|
14
|
+
"ui": "@/components/ui",
|
|
15
|
+
"lib": "@/lib",
|
|
16
|
+
"composables": "@/composables"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export function useBreadcrumb(url: string): BreadcrumbItem[] {
|
|
2
|
+
const config = useConfig()
|
|
3
|
+
const { navigation } = useContent()
|
|
4
|
+
const breadcrumbItems: BreadcrumbItem[] = []
|
|
5
|
+
|
|
6
|
+
// Remove empty segments
|
|
7
|
+
const segments = url.split('/').filter(segment => segment !== '')
|
|
8
|
+
|
|
9
|
+
// Construct breadcrumb for each segment
|
|
10
|
+
let href = ''
|
|
11
|
+
let nav = navigation.value
|
|
12
|
+
|
|
13
|
+
if (!nav) return []
|
|
14
|
+
|
|
15
|
+
for (let i = 0; i < segments.length; i++) {
|
|
16
|
+
const segment = segments[i].replace('.html', '')
|
|
17
|
+
href += `/${segment}`
|
|
18
|
+
const page = nav?.find(x => (x._path as string) === href)
|
|
19
|
+
nav = page?.children
|
|
20
|
+
|
|
21
|
+
breadcrumbItems.push({
|
|
22
|
+
title: page?.title ?? segment,
|
|
23
|
+
href,
|
|
24
|
+
icon: page?.icon,
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Add home to breadcrumb
|
|
29
|
+
const _home = config.value.main.breadCrumb.home
|
|
30
|
+
if (_home) {
|
|
31
|
+
const defaultHome = {
|
|
32
|
+
title: '',
|
|
33
|
+
href: '/',
|
|
34
|
+
icon: 'i-lucide-house',
|
|
35
|
+
iconSize: 18,
|
|
36
|
+
}
|
|
37
|
+
const __home = typeof _home === 'object' ? Object.assign(defaultHome, _home) : defaultHome
|
|
38
|
+
breadcrumbItems.unshift({
|
|
39
|
+
title: __home.title,
|
|
40
|
+
href: '/',
|
|
41
|
+
icon: __home.icon,
|
|
42
|
+
iconSize: __home.iconSize,
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return breadcrumbItems
|
|
47
|
+
}
|