Merge branch 'dev' into cli-nypm-and-other-improves

This commit is contained in:
Sadegh Barati 2024-02-21 14:30:57 +03:30 committed by GitHub
commit 8bae3c6f81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 53 additions and 23 deletions

View File

@ -5,6 +5,7 @@ import type { TableOfContents, TableOfContentsItem } from '../types/docs'
import TableOfContentTree from './TableOfContentTree.vue' import TableOfContentTree from './TableOfContentTree.vue'
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/lib/registry/default/ui/collapsible' import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/lib/registry/default/ui/collapsible'
import { buttonVariants } from '@/lib/registry/default/ui/button' import { buttonVariants } from '@/lib/registry/default/ui/button'
import { ScrollArea } from '@/lib/registry/default/ui/scroll-area'
const headers = shallowRef<TableOfContents>() const headers = shallowRef<TableOfContents>()
@ -22,7 +23,7 @@ function getHeadingsWithHierarchy(divId: string) {
headings.forEach((heading: HTMLHeadingElement) => { headings.forEach((heading: HTMLHeadingElement) => {
const level = Number.parseInt(heading.tagName.charAt(1)) const level = Number.parseInt(heading.tagName.charAt(1))
if (!heading.id) { if (!heading.id) {
const newId = heading.innerText const newId = heading.textContent
.replaceAll(/[^a-zA-Z0-9 ]/g, '') .replaceAll(/[^a-zA-Z0-9 ]/g, '')
.replaceAll(' ', '-') .replaceAll(' ', '-')
.toLowerCase() .toLowerCase()
@ -55,12 +56,16 @@ onContentUpdated(() => {
</script> </script>
<template> <template>
<div class="space-y-2 hidden xl:block"> <div class="hidden xl:block">
<ScrollArea orientation="vertical" class="h-[calc(100vh-6.5rem)] z-30 md:block overflow-y-auto" type="hover">
<div class="space-y-2">
<p class="font-medium"> <p class="font-medium">
On This Page On This Page
</p> </p>
<TableOfContentTree :tree="headers" :level="1" /> <TableOfContentTree :tree="headers" :level="1" />
</div> </div>
</ScrollArea>
</div>
<div class="block xl:hidden mb-6"> <div class="block xl:hidden mb-6">
<Collapsible> <Collapsible>

View File

@ -32,7 +32,7 @@
"embla-carousel-autoplay": "^8.0.0-rc22", "embla-carousel-autoplay": "^8.0.0-rc22",
"embla-carousel-vue": "^8.0.0-rc22", "embla-carousel-vue": "^8.0.0-rc22",
"lucide-vue-next": "^0.276.0", "lucide-vue-next": "^0.276.0",
"radix-vue": "^1.4.6", "radix-vue": "^1.4.8",
"tailwindcss-animate": "^1.0.7", "tailwindcss-animate": "^1.0.7",
"v-calendar": "^3.1.2", "v-calendar": "^3.1.2",
"vee-validate": "4.12.5", "vee-validate": "4.12.5",

View File

@ -37,6 +37,13 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
) )
" "
v-bind="forwarded" v-bind="forwarded"
@pointer-down-outside="(event) => {
const originalEvent = event.detail.originalEvent;
const target = originalEvent.target as HTMLElement;
if (originalEvent.offsetX > target.clientWidth || originalEvent.offsetY > target.clientHeight) {
event.preventDefault();
}
}"
> >
<slot /> <slot />

View File

@ -37,6 +37,13 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
) )
" "
v-bind="forwarded" v-bind="forwarded"
@pointer-down-outside="(event) => {
const originalEvent = event.detail.originalEvent;
const target = originalEvent.target as HTMLElement;
if (originalEvent.offsetX > target.clientWidth || originalEvent.offsetY > target.clientHeight) {
event.preventDefault();
}
}"
> >
<slot /> <slot />

View File

@ -31,7 +31,7 @@
}, },
{ {
"name": "DialogScrollContent.vue", "name": "DialogScrollContent.vue",
"content": "<script setup lang=\"ts\">\nimport { type HTMLAttributes, computed } from 'vue'\nimport {\n DialogClose,\n DialogContent,\n type DialogContentEmits,\n type DialogContentProps,\n DialogOverlay,\n DialogPortal,\n useForwardPropsEmits,\n} from 'radix-vue'\nimport { X } from 'lucide-vue-next'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<DialogContentProps & { class?: HTMLAttributes['class'] }>()\nconst emits = defineEmits<DialogContentEmits>()\n\nconst delegatedProps = computed(() => {\n const { class: _, ...delegated } = props\n\n return delegated\n})\n\nconst forwarded = useForwardPropsEmits(delegatedProps, emits)\n</script>\n\n<template>\n <DialogPortal>\n <DialogOverlay\n class=\"fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\"\n >\n <DialogContent\n :class=\"\n cn(\n 'relative z-50 grid w-full max-w-lg my-8 gap-4 border border-border bg-background p-6 shadow-lg duration-200 sm:rounded-lg md:w-full',\n props.class,\n )\n \"\n v-bind=\"forwarded\"\n >\n <slot />\n\n <DialogClose\n class=\"absolute top-3 right-3 p-0.5 transition-colors rounded-md hover:bg-secondary\"\n >\n <X class=\"w-4 h-4\" />\n <span class=\"sr-only\">Close</span>\n </DialogClose>\n </DialogContent>\n </DialogOverlay>\n </DialogPortal>\n</template>\n" "content": "<script setup lang=\"ts\">\nimport { type HTMLAttributes, computed } from 'vue'\nimport {\n DialogClose,\n DialogContent,\n type DialogContentEmits,\n type DialogContentProps,\n DialogOverlay,\n DialogPortal,\n useForwardPropsEmits,\n} from 'radix-vue'\nimport { X } from 'lucide-vue-next'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<DialogContentProps & { class?: HTMLAttributes['class'] }>()\nconst emits = defineEmits<DialogContentEmits>()\n\nconst delegatedProps = computed(() => {\n const { class: _, ...delegated } = props\n\n return delegated\n})\n\nconst forwarded = useForwardPropsEmits(delegatedProps, emits)\n</script>\n\n<template>\n <DialogPortal>\n <DialogOverlay\n class=\"fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\"\n >\n <DialogContent\n :class=\"\n cn(\n 'relative z-50 grid w-full max-w-lg my-8 gap-4 border border-border bg-background p-6 shadow-lg duration-200 sm:rounded-lg md:w-full',\n props.class,\n )\n \"\n v-bind=\"forwarded\"\n @pointer-down-outside=\"(event) => {\n const originalEvent = event.detail.originalEvent;\n const target = originalEvent.target as HTMLElement;\n if (originalEvent.offsetX > target.clientWidth || originalEvent.offsetY > target.clientHeight) {\n event.preventDefault();\n }\n }\"\n >\n <slot />\n\n <DialogClose\n class=\"absolute top-3 right-3 p-0.5 transition-colors rounded-md hover:bg-secondary\"\n >\n <X class=\"w-4 h-4\" />\n <span class=\"sr-only\">Close</span>\n </DialogClose>\n </DialogContent>\n </DialogOverlay>\n </DialogPortal>\n</template>\n"
}, },
{ {
"name": "DialogTitle.vue", "name": "DialogTitle.vue",

View File

@ -31,7 +31,7 @@
}, },
{ {
"name": "DialogScrollContent.vue", "name": "DialogScrollContent.vue",
"content": "<script setup lang=\"ts\">\nimport { type HTMLAttributes, computed } from 'vue'\nimport {\n DialogClose,\n DialogContent,\n type DialogContentEmits,\n type DialogContentProps,\n DialogOverlay,\n DialogPortal,\n useForwardPropsEmits,\n} from 'radix-vue'\nimport { X } from 'lucide-vue-next'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<DialogContentProps & { class?: HTMLAttributes['class'] }>()\nconst emits = defineEmits<DialogContentEmits>()\n\nconst delegatedProps = computed(() => {\n const { class: _, ...delegated } = props\n\n return delegated\n})\n\nconst forwarded = useForwardPropsEmits(delegatedProps, emits)\n</script>\n\n<template>\n <DialogPortal>\n <DialogOverlay\n class=\"fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\"\n >\n <DialogContent\n :class=\"\n cn(\n 'relative z-50 grid w-full max-w-lg my-8 gap-4 border border-border bg-background p-6 shadow-lg duration-200 sm:rounded-lg md:w-full',\n props.class,\n )\n \"\n v-bind=\"forwarded\"\n >\n <slot />\n\n <DialogClose\n class=\"absolute top-4 right-4 p-0.5 transition-colors rounded-md hover:bg-secondary\"\n >\n <Cross2Icon class=\"w-4 h-4\" />\n <span class=\"sr-only\">Close</span>\n </DialogClose>\n </DialogContent>\n </DialogOverlay>\n </DialogPortal>\n</template>\n" "content": "<script setup lang=\"ts\">\nimport { type HTMLAttributes, computed } from 'vue'\nimport {\n DialogClose,\n DialogContent,\n type DialogContentEmits,\n type DialogContentProps,\n DialogOverlay,\n DialogPortal,\n useForwardPropsEmits,\n} from 'radix-vue'\nimport { X } from 'lucide-vue-next'\nimport { cn } from '@/lib/utils'\n\nconst props = defineProps<DialogContentProps & { class?: HTMLAttributes['class'] }>()\nconst emits = defineEmits<DialogContentEmits>()\n\nconst delegatedProps = computed(() => {\n const { class: _, ...delegated } = props\n\n return delegated\n})\n\nconst forwarded = useForwardPropsEmits(delegatedProps, emits)\n</script>\n\n<template>\n <DialogPortal>\n <DialogOverlay\n class=\"fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\"\n >\n <DialogContent\n :class=\"\n cn(\n 'relative z-50 grid w-full max-w-lg my-8 gap-4 border border-border bg-background p-6 shadow-lg duration-200 sm:rounded-lg md:w-full',\n props.class,\n )\n \"\n v-bind=\"forwarded\"\n @pointer-down-outside=\"(event) => {\n const originalEvent = event.detail.originalEvent;\n const target = originalEvent.target as HTMLElement;\n if (originalEvent.offsetX > target.clientWidth || originalEvent.offsetY > target.clientHeight) {\n event.preventDefault();\n }\n }\"\n >\n <slot />\n\n <DialogClose\n class=\"absolute top-4 right-4 p-0.5 transition-colors rounded-md hover:bg-secondary\"\n >\n <Cross2Icon class=\"w-4 h-4\" />\n <span class=\"sr-only\">Close</span>\n </DialogClose>\n </DialogContent>\n </DialogOverlay>\n </DialogPortal>\n</template>\n"
}, },
{ {
"name": "DialogTitle.vue", "name": "DialogTitle.vue",

View File

@ -47,7 +47,7 @@
"dependencies": { "dependencies": {
"@babel/core": "^7.23.9", "@babel/core": "^7.23.9",
"@babel/parser": "^7.23.9", "@babel/parser": "^7.23.9",
"@vue/compiler-sfc": "^3.4.19", "@vue/compiler-sfc": "^3.4",
"c12": "^1.8.0", "c12": "^1.8.0",
"commander": "^12.0.0", "commander": "^12.0.0",
"consola": "^3.2.3", "consola": "^3.2.3",
@ -62,7 +62,7 @@
"ora": "^8.0.1", "ora": "^8.0.1",
"pathe": "^1.1.2", "pathe": "^1.1.2",
"prompts": "^2.4.2", "prompts": "^2.4.2",
"radix-vue": "^1.4.6", "radix-vue": "^1.4.8",
"ts-morph": "^21.0.1", "ts-morph": "^21.0.1",
"tsconfig-paths": "^4.2.0", "tsconfig-paths": "^4.2.0",
"zod": "^3.22.4" "zod": "^3.22.4"

View File

@ -13,7 +13,7 @@
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"clsx": "^2.0.0", "clsx": "^2.0.0",
"lucide-vue-next": "^0.276.0", "lucide-vue-next": "^0.276.0",
"radix-vue": "^1.4.6", "radix-vue": "^1.4.8",
"tailwind-merge": "^1.14.0", "tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.7" "tailwindcss-animate": "^1.0.7"
}, },

View File

@ -14,7 +14,7 @@
"embla-carousel": "8.0.0-rc19", "embla-carousel": "8.0.0-rc19",
"embla-carousel-vue": "8.0.0-rc19", "embla-carousel-vue": "8.0.0-rc19",
"lucide-vue-next": "^0.276.0", "lucide-vue-next": "^0.276.0",
"radix-vue": "^1.4.6", "radix-vue": "^1.4.8",
"tailwind-merge": "^2.0.0", "tailwind-merge": "^2.0.0",
"tailwindcss-animate": "^1.0.7" "tailwindcss-animate": "^1.0.7"
}, },

View File

@ -93,8 +93,8 @@ importers:
specifier: ^0.276.0 specifier: ^0.276.0
version: 0.276.0(vue@3.4.19) version: 0.276.0(vue@3.4.19)
radix-vue: radix-vue:
specifier: ^1.4.6 specifier: ^1.4.8
version: 1.4.6(vue@3.4.19) version: 1.4.8(vue@3.4.15)
tailwindcss-animate: tailwindcss-animate:
specifier: ^1.0.7 specifier: ^1.0.7
version: 1.0.7(tailwindcss@3.4.1) version: 1.0.7(tailwindcss@3.4.1)
@ -205,7 +205,7 @@ importers:
specifier: ^7.23.9 specifier: ^7.23.9
version: 7.23.9 version: 7.23.9
'@vue/compiler-sfc': '@vue/compiler-sfc':
specifier: ^3.4.19 specifier: ^3.4
version: 3.4.19 version: 3.4.19
c12: c12:
specifier: ^1.8.0 specifier: ^1.8.0
@ -217,8 +217,8 @@ importers:
specifier: ^3.2.3 specifier: ^3.2.3
version: 3.2.3 version: 3.2.3
detype: detype:
specifier: npm:detypes@^0.7.6 specifier: npm:detypes@^0.7.9
version: /detypes@0.7.6 version: /detypes@0.7.9
diff: diff:
specifier: ^5.2.0 specifier: ^5.2.0
version: 5.2.0 version: 5.2.0
@ -250,8 +250,8 @@ importers:
specifier: ^2.4.2 specifier: ^2.4.2
version: 2.4.2 version: 2.4.2
radix-vue: radix-vue:
specifier: ^1.4.6 specifier: ^1.4.8
version: 1.4.6(vue@3.4.19) version: 1.4.8(vue@3.4.19)
ts-morph: ts-morph:
specifier: ^21.0.1 specifier: ^21.0.1
version: 21.0.1 version: 21.0.1
@ -4444,7 +4444,6 @@ packages:
lru-cache: 6.0.0 lru-cache: 6.0.0
source-map: 0.6.1 source-map: 0.6.1
dev: false dev: false
/@vuedx/template-ast-types@0.7.1: /@vuedx/template-ast-types@0.7.1:
resolution: {integrity: sha512-Mqugk/F0lFN2u9bhimH6G1kSu2hhLi2WoqgCVxrMvgxm2kDc30DtdvVGRq+UgEmKVP61OudcMtZqkUoGQeFBUQ==} resolution: {integrity: sha512-Mqugk/F0lFN2u9bhimH6G1kSu2hhLi2WoqgCVxrMvgxm2kDc30DtdvVGRq+UgEmKVP61OudcMtZqkUoGQeFBUQ==}
dependencies: dependencies:
@ -6242,8 +6241,8 @@ packages:
engines: {node: '>=8'} engines: {node: '>=8'}
dev: true dev: true
/detypes@0.7.6: /detypes@0.7.9:
resolution: {integrity: sha512-u4FNjEoBY/Wxhtim3JX5sIZzfRsjYiaaWX0SCPbNkU0NbIcvcVPW0TzFPXdq1td6XoCxIMdmY/B/XmMLYOCqPA==} resolution: {integrity: sha512-4dGl/e6rHnIFU+2HB9B//0sV0pMx8eLnzN4zfTg9FWAkuFqv8MPVmZo1fLoOjHzTGRzKH8mr/mzKmZ2DcOuCkg==}
engines: {node: '>=18'} engines: {node: '>=18'}
hasBin: true hasBin: true
dependencies: dependencies:
@ -6252,6 +6251,7 @@ packages:
'@vue/compiler-dom': 3.4.19 '@vue/compiler-dom': 3.4.19
'@vue/compiler-sfc': 3.4.19 '@vue/compiler-sfc': 3.4.19
'@vuedx/compiler-sfc': 0.7.1 '@vuedx/compiler-sfc': 0.7.1
'@vuedx/template-ast-types': 0.7.1 '@vuedx/template-ast-types': 0.7.1
fast-glob: 3.3.2 fast-glob: 3.3.2
prettier: 2.8.8 prettier: 2.8.8
@ -10687,6 +10687,17 @@ packages:
- vue - vue
dev: false dev: false
/radix-vue@1.4.8(vue@3.4.19):
resolution: {integrity: sha512-DDCA9QjyBpV9iOyUrSWjK8B5j78aFKZFl8DRGKYeR7l4nIejtxulVyWzaCk4lv+KXmupyP9SXC4LlC3AGjeR5w==}
dependencies:
'@floating-ui/dom': 1.6.1
'@floating-ui/vue': 1.0.6(vue@3.4.19)
fast-deep-equal: 3.1.3
transitivePeerDependencies:
- '@vue/composition-api'
- vue
dev: false
/radix3@1.1.0: /radix3@1.1.0:
resolution: {integrity: sha512-pNsHDxbGORSvuSScqNJ+3Km6QAVqk8CfsCBIEoDgpqLrkD2f3QM4I7d1ozJJ172OmIcoUcerZaNWqtLkRXTV3A==} resolution: {integrity: sha512-pNsHDxbGORSvuSScqNJ+3Km6QAVqk8CfsCBIEoDgpqLrkD2f3QM4I7d1ozJJ172OmIcoUcerZaNWqtLkRXTV3A==}
dev: true dev: true