@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,4 @@
|
|
|
1
|
+
<svg viewBox="0 0 284 284" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill="var(--primary)" d="M145.755 81.37C105.991 81.37 81.058 98.5802 67.1536 113.001C49.174 131.799 39.1017 156.724 39 182.669C39 209.43 49.4699 234.063 68.4727 252.018C87.1308 269.654 112.325 279.37 139.397 279.37C167.694 279.37 194.065 269.335 213.661 251.108C233.865 232.314 245 206.274 245 177.823C245 117.433 194.54 81.37 145.755 81.37ZM146.338 263.011C135.941 263.129 125.639 261.039 116.12 256.881C106.601 252.722 98.0828 246.591 91.1358 238.898C76.4826 222.633 68.7342 200.317 68.7342 174.336C68.7342 149.868 75.9479 129.809 89.6146 116.334C101.63 104.514 118.6 97.871 137.377 97.7291C159.957 97.7291 179.233 105.483 192.947 120.187C207.921 136.239 215.848 160.376 215.848 189.868C215.848 240.387 180.933 263.011 146.338 263.011Z"/>
|
|
3
|
+
<path fill="var(--primary)" d="M209 63.37H186.205L142.081 19.4378L97.6962 63.37H76L137.356 3.37H147.655L209 63.37Z"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { readdir, readFile, stat, writeFile } from 'fs/promises'
|
|
2
|
+
import { join } from 'path'
|
|
3
|
+
import { parse } from 'yaml'
|
|
4
|
+
import * as flat from 'flat'
|
|
5
|
+
|
|
6
|
+
interface TreeNode {
|
|
7
|
+
title: string
|
|
8
|
+
_id?: string
|
|
9
|
+
_path?: string
|
|
10
|
+
data?: Record<string, unknown>
|
|
11
|
+
content?: string
|
|
12
|
+
children?: TreeNode[]
|
|
13
|
+
description?: string
|
|
14
|
+
icon?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function buildContentTree(dirPath: string): Promise<TreeNode[]> {
|
|
18
|
+
const tree: TreeNode[] = []
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
const files = await readdir(dirPath)
|
|
22
|
+
|
|
23
|
+
for (const file of files) {
|
|
24
|
+
const fullPath = join(dirPath, file)
|
|
25
|
+
const stats = await stat(fullPath)
|
|
26
|
+
|
|
27
|
+
// Skip hidden files and _dir.yml
|
|
28
|
+
if (file.startsWith('.') || file === '_dir.yml') {
|
|
29
|
+
continue
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (stats.isDirectory()) {
|
|
33
|
+
// Handle directory
|
|
34
|
+
const children = await buildContentTree(fullPath)
|
|
35
|
+
if (children.length > 0) {
|
|
36
|
+
let dir: TreeNode = {
|
|
37
|
+
title: file,
|
|
38
|
+
children,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const dirConfigPath = join(fullPath, '_dir.yml')
|
|
42
|
+
if (await stat(dirConfigPath).catch(() => false)) {
|
|
43
|
+
const _dir = await readFile(fullPath + '/_dir.yml', 'utf-8')
|
|
44
|
+
const yaml = parse(_dir)
|
|
45
|
+
dir = {
|
|
46
|
+
...dir,
|
|
47
|
+
...yaml,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Get relative path from content dir
|
|
51
|
+
const relativePath = fullPath.split('content/')[1]
|
|
52
|
+
dir._path = relativePath.replaceAll(/(^|\/)\d+\./g, '/').replace(/^\//, '')
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
tree.push(dir)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const _content = await readFile(fullPath, 'utf-8')
|
|
60
|
+
const { content, data } = parseFrontMatter(_content)
|
|
61
|
+
// Get relative path from content dir
|
|
62
|
+
const relativePath = fullPath.split('content/')[1]
|
|
63
|
+
const pathWithoutExt = relativePath.replaceAll(/(^|\/)\d+\./g, '/').replace(/\.md$/, '').replace(/^\//, '')
|
|
64
|
+
|
|
65
|
+
// Extract the numeric prefix if it exists
|
|
66
|
+
// const numMatch = pathWithoutExt.match(/^(\d+)\./)
|
|
67
|
+
const node: TreeNode = {
|
|
68
|
+
title: pathWithoutExt, // Remove numeric prefix from title
|
|
69
|
+
_id: 'content:' + relativePath.replace(/\//g, ':'),
|
|
70
|
+
_path: pathWithoutExt,
|
|
71
|
+
content,
|
|
72
|
+
...data,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (node._path !== 'index' && !/^test.*/i.test(node._path || '') && !node._path?.startsWith('_'))
|
|
76
|
+
tree.push(node)
|
|
77
|
+
// if (numMatch) {
|
|
78
|
+
// // Use the number as index (subtract 1 since arrays are 0-based)
|
|
79
|
+
// const index = parseInt(numMatch[1]) - 1
|
|
80
|
+
// tree.splice(index, 0, node)
|
|
81
|
+
// }
|
|
82
|
+
// else {
|
|
83
|
+
// // If no number prefix, just push to the end
|
|
84
|
+
|
|
85
|
+
// }
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Sort items with numeric prefixes first, then alphabetically
|
|
90
|
+
// return tree.sort((a, b) => {
|
|
91
|
+
// const aMatch = a._path.match(/^(\d+)\./)
|
|
92
|
+
// const bMatch = b._path.match(/^(\d+)\./)
|
|
93
|
+
|
|
94
|
+
// // If both have numeric prefixes, sort by number
|
|
95
|
+
// if (aMatch && bMatch) {
|
|
96
|
+
// const aNum = parseInt(aMatch[1])
|
|
97
|
+
// const bNum = parseInt(bMatch[1])
|
|
98
|
+
// if (aNum !== bNum) {
|
|
99
|
+
// return aNum - bNum
|
|
100
|
+
// }
|
|
101
|
+
// }
|
|
102
|
+
|
|
103
|
+
// // If only one has prefix, it goes first
|
|
104
|
+
// if (aMatch && !bMatch) return -1
|
|
105
|
+
// if (!aMatch && bMatch) return 1
|
|
106
|
+
|
|
107
|
+
// // Otherwise sort alphabetically
|
|
108
|
+
// return a.title.localeCompare(b.title)
|
|
109
|
+
// })
|
|
110
|
+
return tree
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
console.error('Error reading directory:', err)
|
|
114
|
+
return []
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export async function generateAndSaveContentDoc(file: string = 'content-doc.json'): Promise<void> {
|
|
119
|
+
try {
|
|
120
|
+
// Get the root directory of the project
|
|
121
|
+
const rootDir = process.cwd()
|
|
122
|
+
const basePath = join(rootDir, '.playground/content')
|
|
123
|
+
|
|
124
|
+
// Generate the tree
|
|
125
|
+
const tree = await buildContentTree(basePath)
|
|
126
|
+
|
|
127
|
+
// Write to components-tree.json in the root directory
|
|
128
|
+
const outputPath = join(rootDir, 'public', file)
|
|
129
|
+
await writeFile(
|
|
130
|
+
outputPath,
|
|
131
|
+
JSON.stringify(tree, null, 2),
|
|
132
|
+
'utf-8',
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
console.log(`Components tree saved to ${outputPath}`)
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
console.error('Error generating or saving component tree:', err)
|
|
139
|
+
throw err
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const FRONTMATTER_DELIMITER_DEFAULT = '---'
|
|
144
|
+
const LF = '\n'
|
|
145
|
+
const CR = '\r'
|
|
146
|
+
export function parseFrontMatter(content: string) {
|
|
147
|
+
let data: Record<string, unknown> = {}
|
|
148
|
+
if (content.startsWith(FRONTMATTER_DELIMITER_DEFAULT)) {
|
|
149
|
+
const idx = content.indexOf(LF + FRONTMATTER_DELIMITER_DEFAULT)
|
|
150
|
+
if (idx !== -1) {
|
|
151
|
+
const hasCarriageReturn = content[idx - 1] === CR
|
|
152
|
+
const frontmatter = content.slice(4, idx - (hasCarriageReturn ? 1 : 0))
|
|
153
|
+
if (frontmatter) {
|
|
154
|
+
data = parse(frontmatter)
|
|
155
|
+
content = content.slice(idx + 4 + (hasCarriageReturn ? 1 : 0))
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return {
|
|
161
|
+
content,
|
|
162
|
+
// unflatten frontmatter data. convert `parent.child` keys into `parent: { child: ... }`
|
|
163
|
+
data: flat.unflatten(data || {}, {}) as Record<string, unknown>,
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {}
|
package/tsconfig.json
ADDED
package/uno.config.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { dirname, join } from 'node:path'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
|
|
4
|
+
import extractorMdc from '@unocss/extractor-mdc'
|
|
5
|
+
import {
|
|
6
|
+
defineConfig,
|
|
7
|
+
presetAttributify,
|
|
8
|
+
presetIcons,
|
|
9
|
+
presetTypography,
|
|
10
|
+
presetWind3,
|
|
11
|
+
transformerDirectives,
|
|
12
|
+
} from 'unocss'
|
|
13
|
+
import presetAnimations from 'unocss-preset-animations'
|
|
14
|
+
|
|
15
|
+
import mdcEditorPreset from '@unpress/mdc-editor/unocss-preset'
|
|
16
|
+
import nuxtLayerPreset from './lib/uno-preset.ts'
|
|
17
|
+
|
|
18
|
+
const currentDir = dirname(fileURLToPath(import.meta.url))
|
|
19
|
+
|
|
20
|
+
export default defineConfig({
|
|
21
|
+
presets: [
|
|
22
|
+
presetWind3(),
|
|
23
|
+
presetAttributify(),
|
|
24
|
+
presetIcons({
|
|
25
|
+
scale: 1.2,
|
|
26
|
+
cdn: 'https://esm.sh/',
|
|
27
|
+
}),
|
|
28
|
+
presetTypography(),
|
|
29
|
+
presetAnimations(),
|
|
30
|
+
nuxtLayerPreset(),
|
|
31
|
+
mdcEditorPreset(),
|
|
32
|
+
],
|
|
33
|
+
extractors: [
|
|
34
|
+
extractorMdc(),
|
|
35
|
+
],
|
|
36
|
+
transformers: [
|
|
37
|
+
transformerDirectives(),
|
|
38
|
+
],
|
|
39
|
+
content: {
|
|
40
|
+
filesystem: [
|
|
41
|
+
'content/**/*.md',
|
|
42
|
+
`${join(currentDir, 'content')}/**/*.{md,yaml,yml}`,
|
|
43
|
+
],
|
|
44
|
+
pipeline: {
|
|
45
|
+
include: [
|
|
46
|
+
// the default
|
|
47
|
+
/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/,
|
|
48
|
+
// include js/ts files
|
|
49
|
+
'components/ui/**/*.{js,ts}',
|
|
50
|
+
// include css files
|
|
51
|
+
'assets/**/*.css',
|
|
52
|
+
// Need this for layer
|
|
53
|
+
`${join(currentDir, 'components/ui')}/**/*.{js,ts}`,
|
|
54
|
+
`${join(currentDir, 'assets')}/**/*.css`,
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
})
|
package/utils/index.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function classToString(classAttr: string | string[] | Record<string, boolean> | unknown) {
|
|
2
|
+
if (Array.isArray(classAttr))
|
|
3
|
+
return classAttr.join(' ')
|
|
4
|
+
|
|
5
|
+
if (typeof classAttr === 'object' && classAttr !== null)
|
|
6
|
+
return Object.entries(classAttr)
|
|
7
|
+
.filter(([_, value]) => value) // Filter out falsy values
|
|
8
|
+
.map(([key]) => key)
|
|
9
|
+
.join(' ')
|
|
10
|
+
|
|
11
|
+
return classAttr ? String(classAttr) : ''
|
|
12
|
+
}
|