@tu-design/vue 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.d.mts +1150 -0
- package/dist/index.mjs +1377 -0
- package/dist/registry/vue/avatar.json +22 -0
- package/dist/registry/vue/badge.json +22 -0
- package/dist/registry/vue/button.json +22 -0
- package/dist/registry/vue/card.json +51 -0
- package/dist/registry/vue/checkbox.json +22 -0
- package/dist/registry/vue/dialog.json +64 -0
- package/dist/registry/vue/dropdown-menu.json +58 -0
- package/dist/registry/vue/input.json +21 -0
- package/dist/registry/vue/label.json +21 -0
- package/dist/registry/vue/radio-group.json +28 -0
- package/dist/registry/vue/registry.json +126 -0
- package/dist/registry/vue/select.json +52 -0
- package/dist/registry/vue/separator.json +21 -0
- package/dist/registry/vue/skeleton.json +21 -0
- package/dist/registry/vue/slider.json +22 -0
- package/dist/registry/vue/slot.json +21 -0
- package/dist/registry/vue/switch.json +22 -0
- package/dist/registry/vue/tabs.json +39 -0
- package/dist/registry/vue/tokens.json +14 -0
- package/dist/registry/vue/tooltip.json +34 -0
- package/dist/registry/vue/utils.json +15 -0
- package/package.json +60 -3
- package/README.md +0 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "slider",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"description": "滑块:基于 Ark UI Slider 原语,支持单值/区间、步进与键盘微调。",
|
|
6
|
+
"registryDependencies": ["utils"],
|
|
7
|
+
"dependencies": ["@ark-ui/vue@^5.39.2"],
|
|
8
|
+
"files": [
|
|
9
|
+
{
|
|
10
|
+
"path": "slider/Slider.vue",
|
|
11
|
+
"type": "registry:component",
|
|
12
|
+
"target": "components/ui/slider/Slider.vue",
|
|
13
|
+
"content": "<script setup lang=\"ts\">\nimport type { PropType } from \"vue\";\nimport { computed } from \"vue\";\nimport { Slider as ArkSlider } from \"@ark-ui/vue/slider\";\nimport { cn } from \"@/lib/utils\";\n\ninterface Props {\n /** 当前值(配合 v-model);单值或区间数组,不传时为非受控 */\n value?: number | number[];\n defaultValue?: number | number[];\n min?: number;\n max?: number;\n step?: number;\n disabled?: boolean;\n class?: string;\n}\n\nconst props = withDefaults(\n defineProps<{\n value?: number | number[];\n defaultValue?: number | number[];\n min?: number;\n max?: number;\n step?: number;\n disabled?: boolean;\n class?: string;\n }>(),\n { min: 0, max: 100, step: 1 },\n);\n\nconst emit = defineEmits<{ \"update:modelValue\": [value: number[]] }>();\n\nconst toArray = (v: number | number[] | undefined) =>\n v === undefined ? undefined : Array.isArray(v) ? v : [v];\n\nconst thumbs = computed(() => toArray(props.value) ?? toArray(props.defaultValue) ?? [props.min]);\n</script>\n\n<template>\n <ArkSlider.Root\n :model-value=\"toArray(props.value)\"\n :default-value=\"toArray(props.defaultValue)\"\n :min=\"props.min\"\n :max=\"props.max\"\n :step=\"props.step\"\n :disabled=\"props.disabled\"\n :class=\"\n cn(\n 'relative flex w-full touch-none select-none items-center data-[disabled]:opacity-50',\n props.class,\n )\n \"\n @update:model-value=\"(value: number[]) => emit('update:modelValue', value)\"\n >\n <ArkSlider.Control class=\"relative flex h-5 w-full items-center\">\n <ArkSlider.Track class=\"bg-muted relative h-1 w-full grow overflow-hidden rounded-full\">\n <ArkSlider.Range class=\"bg-primary absolute h-full\" />\n </ArkSlider.Track>\n <ArkSlider.Thumb\n v-for=\"(_, index) in thumbs\"\n :key=\"index\"\n :index=\"index\"\n class=\"border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50\"\n >\n <ArkSlider.HiddenInput />\n </ArkSlider.Thumb>\n </ArkSlider.Control>\n </ArkSlider.Root>\n</template>\n"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"path": "slider/index.ts",
|
|
17
|
+
"type": "registry:component",
|
|
18
|
+
"target": "components/ui/slider/index.ts",
|
|
19
|
+
"content": "export { default as Slider } from \"./Slider.vue\";\n"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "slot",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"description": "asChild 组合原语:将组件的 class 与 attrs 合并到子元素上,而不渲染额外 DOM。",
|
|
6
|
+
"registryDependencies": ["utils"],
|
|
7
|
+
"files": [
|
|
8
|
+
{
|
|
9
|
+
"path": "slot/Slot.ts",
|
|
10
|
+
"type": "registry:component",
|
|
11
|
+
"target": "components/ui/slot/Slot.ts",
|
|
12
|
+
"content": "import { Comment, createVNode, defineComponent, Fragment, h, Text } from \"vue\";\nimport type { VNode } from \"vue\";\nimport type { ClassValue } from \"clsx\";\nimport { cn } from \"../../lib/utils\";\n\n/** 递归展平 `<slot />` 插槽出口(renderSlot)产生的 Fragment 包裹,取出真实子节点。 */\nfunction flattenVNodes(children: VNode[]): VNode[] {\n const out: VNode[] = [];\n for (const child of children) {\n if (child.type === Fragment && Array.isArray(child.children)) {\n out.push(...flattenVNodes(child.children as VNode[]));\n } else {\n out.push(child);\n }\n }\n return out;\n}\n\n/**\n * asChild 组合原语:把落在自身上的 attrs(class、事件、透传属性)合并到默认插槽的\n * 第一个元素子节点上,而不是渲染额外 DOM。Button 的 asChild 与后续交互组件批次的\n * 组合能力都以此为基础。\n *\n * 合并语义(对齐 radix Slot):\n * - 子元素自身标量 props 优先于注入的同名属性;\n * - class 经 cn 做 tailwind-merge 冲突合并(注入方的变体类可被子元素同类覆盖),\n * 且以 createVNode 重建子节点,避免 cloneVNode 拼接造成 class 重复;\n * - 事件处理器链式合并(子元素先触发,注入方后触发);\n * - 子节点为文本/注释(如 v-if 为 false)时原样渲染,class 等注入丢弃;\n * - 默认插槽展平后为空时抛错。\n */\nexport const Slot = defineComponent({\n name: \"Slot\",\n inheritAttrs: false,\n setup(_, { attrs, slots }) {\n return () => {\n const children = flattenVNodes(slots.default?.() ?? []);\n if (children.length === 0) {\n throw new Error(\"Slot:需要一个默认插槽子节点\");\n }\n const [first, ...rest] = children;\n if (first.type === Text || first.type === Comment) {\n return rest.length > 0 ? h(Fragment, children) : first;\n }\n\n const childProps = (first.props ?? {}) as Record<string, unknown>;\n const injected = attrs as Record<string, unknown>;\n // 以子元素自身 props 为起点重建,再按规则合入注入值:\n // 标量子元素优先、style 子元素优先(数组后者覆盖)、事件链式(子元素先触发)。\n const props: Record<string, unknown> = { ...childProps, key: first.key };\n for (const [key, value] of Object.entries(injected)) {\n if (key === \"class\") {\n continue;\n }\n if (key === \"style\") {\n props.style = props.style === undefined ? value : [value, props.style];\n } else if (key.startsWith(\"on\")) {\n const prev = props[key];\n props[key] =\n prev === undefined ? value : Array.isArray(prev) ? [...prev, value] : [prev, value];\n } else if (!(key in props)) {\n props[key] = value;\n }\n }\n props.class = cn(injected.class as ClassValue, childProps.class as ClassValue);\n\n const target = createVNode(first.type, props, first.children);\n return rest.length > 0 ? h(Fragment, [target, ...rest]) : target;\n };\n },\n});\n"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"path": "slot/index.ts",
|
|
16
|
+
"type": "registry:component",
|
|
17
|
+
"target": "components/ui/slot/index.ts",
|
|
18
|
+
"content": "export { Slot } from \"./Slot\";\n"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "switch",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"description": "开关:基于 Ark UI Switch 原语,支持标签插槽、受控/非受控与禁用。",
|
|
6
|
+
"registryDependencies": ["utils"],
|
|
7
|
+
"dependencies": ["@ark-ui/vue@^5.39.2"],
|
|
8
|
+
"files": [
|
|
9
|
+
{
|
|
10
|
+
"path": "switch/Switch.vue",
|
|
11
|
+
"type": "registry:component",
|
|
12
|
+
"target": "components/ui/switch/Switch.vue",
|
|
13
|
+
"content": "<script setup lang=\"ts\">\nimport type { PropType } from \"vue\";\nimport { computed, ref } from \"vue\";\nimport { Switch as ArkSwitch } from \"@ark-ui/vue/switch\";\nimport { cn } from \"@/lib/utils\";\n\n// checked 用 default: undefined 禁用 Boolean casting(Dialog 同款约定)\nconst props = defineProps({\n checked: { type: Boolean as PropType<boolean | undefined>, default: undefined },\n defaultChecked: { type: Boolean, default: false },\n disabled: { type: Boolean, default: false },\n class: { type: String, default: undefined },\n});\n\nconst emit = defineEmits<{ \"update:checked\": [checked: boolean] }>();\n\n// 对 Root 恒走受控模式,非受控语义由内部 ref 实现(Dialog 同款)\nconst internalChecked = ref(props.defaultChecked);\nconst isChecked = computed(() => props.checked ?? internalChecked.value);\n\nfunction handleUpdate(checked: boolean) {\n internalChecked.value = checked;\n emit(\"update:checked\", checked);\n}\n</script>\n\n<template>\n <ArkSwitch.Root\n :checked=\"isChecked\"\n :disabled=\"props.disabled\"\n :class=\"cn('inline-flex items-center gap-2', props.class)\"\n @update:checked=\"handleUpdate\"\n >\n <ArkSwitch.HiddenInput />\n <ArkSwitch.Control\n class=\"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:ring-ring/50 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <ArkSwitch.Thumb\n class=\"bg-background pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0\"\n />\n </ArkSwitch.Control>\n <ArkSwitch.Label v-if=\"$slots.default\" class=\"text-sm font-medium select-none\">\n <slot />\n </ArkSwitch.Label>\n </ArkSwitch.Root>\n</template>\n"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"path": "switch/index.ts",
|
|
17
|
+
"type": "registry:component",
|
|
18
|
+
"target": "components/ui/switch/index.ts",
|
|
19
|
+
"content": "export { default as Switch } from \"./Switch.vue\";\n"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "tabs",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"description": "选项卡:基于 Ark UI Tabs 原语,键盘导航与受控/非受控双模式。",
|
|
6
|
+
"registryDependencies": ["utils"],
|
|
7
|
+
"files": [
|
|
8
|
+
{
|
|
9
|
+
"path": "tabs/Tabs.vue",
|
|
10
|
+
"type": "registry:component",
|
|
11
|
+
"target": "components/ui/tabs/Tabs.vue",
|
|
12
|
+
"content": "<script setup lang=\"ts\">\nimport { Tabs as ArkTabs } from \"@ark-ui/vue/tabs\";\n\ninterface Props {\n /** 当前激活的 tab 值(配合 v-model:value);不传时为非受控 */\n value?: string;\n defaultValue?: string;\n /** 切换模式:automatic 悬停聚焦即切换 / manual 需点击或 Enter */\n activationMode?: \"automatic\" | \"manual\";\n lazyMount?: boolean;\n unmountOnExit?: boolean;\n}\n\nconst props = defineProps<Props>();\n\nconst emit = defineEmits<{ \"update:value\": [value: string] }>();\n</script>\n\n<template>\n <ArkTabs.Root\n :model-value=\"props.value\"\n :default-value=\"props.defaultValue\"\n :activation-mode=\"props.activationMode\"\n :lazy-mount=\"props.lazyMount\"\n :unmount-on-exit=\"props.unmountOnExit\"\n @update:model-value=\"(value: string) => emit('update:value', value)\"\n >\n <slot />\n </ArkTabs.Root>\n</template>\n"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"path": "tabs/TabsContent.vue",
|
|
16
|
+
"type": "registry:component",
|
|
17
|
+
"target": "components/ui/tabs/TabsContent.vue",
|
|
18
|
+
"content": "<script setup lang=\"ts\">\nimport { Tabs as ArkTabs } from \"@ark-ui/vue/tabs\";\nimport { cn } from \"@/lib/utils\";\n\ninterface Props {\n value: string;\n class?: string;\n}\n\nconst props = defineProps<Props>();\n</script>\n\n<template>\n <ArkTabs.Content :value=\"props.value\" :class=\"cn('flex-1 outline-none', props.class)\">\n <slot />\n </ArkTabs.Content>\n</template>\n"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"path": "tabs/TabsList.vue",
|
|
22
|
+
"type": "registry:component",
|
|
23
|
+
"target": "components/ui/tabs/TabsList.vue",
|
|
24
|
+
"content": "<script setup lang=\"ts\">\nimport { Tabs as ArkTabs } from \"@ark-ui/vue/tabs\";\nimport { cn } from \"@/lib/utils\";\n\ninterface Props {\n class?: string;\n}\n\nconst props = defineProps<Props>();\n</script>\n\n<template>\n <ArkTabs.List\n :class=\"\n cn(\n 'bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]',\n props.class,\n )\n \"\n >\n <slot />\n </ArkTabs.List>\n</template>\n"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "tabs/TabsTrigger.vue",
|
|
28
|
+
"type": "registry:component",
|
|
29
|
+
"target": "components/ui/tabs/TabsTrigger.vue",
|
|
30
|
+
"content": "<script setup lang=\"ts\">\nimport { Tabs as ArkTabs } from \"@ark-ui/vue/tabs\";\nimport { cn } from \"@/lib/utils\";\n\ninterface Props {\n value: string;\n disabled?: boolean;\n class?: string;\n}\n\nconst props = defineProps<Props>();\n</script>\n\n<template>\n <ArkTabs.Trigger\n :value=\"props.value\"\n :disabled=\"props.disabled\"\n :class=\"\n cn(\n 'data-[selected]:bg-background data-[selected]:text-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-ring/50 focus-visible:outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 data-[selected]:shadow-sm',\n props.class,\n )\n \"\n >\n <slot />\n </ArkTabs.Trigger>\n</template>\n"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "tabs/index.ts",
|
|
34
|
+
"type": "registry:component",
|
|
35
|
+
"target": "components/ui/tabs/index.ts",
|
|
36
|
+
"content": "export { default as Tabs } from \"./Tabs.vue\";\nexport { default as TabsContent } from \"./TabsContent.vue\";\nexport { default as TabsList } from \"./TabsList.vue\";\nexport { default as TabsTrigger } from \"./TabsTrigger.vue\";\n"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "tokens",
|
|
4
|
+
"type": "registry:style",
|
|
5
|
+
"description": "Tailwind CSS v4 语义 tokens(shadcn 官方 v4 集合)。",
|
|
6
|
+
"files": [
|
|
7
|
+
{
|
|
8
|
+
"path": "styles/tokens.css",
|
|
9
|
+
"type": "registry:style",
|
|
10
|
+
"target": "styles/tokens.css",
|
|
11
|
+
"content": "@import \"tw-animate-css\";\n\n@custom-variant dark (&:where(.dark, .dark *));\n\n:root {\n --background: oklch(1 0 0);\n --foreground: oklch(0.145 0 0);\n --card: oklch(1 0 0);\n --card-foreground: oklch(0.145 0 0);\n --popover: oklch(1 0 0);\n --popover-foreground: oklch(0.145 0 0);\n --primary: oklch(0.205 0 0);\n --primary-foreground: oklch(0.985 0 0);\n --secondary: oklch(0.97 0 0);\n --secondary-foreground: oklch(0.205 0 0);\n --muted: oklch(0.97 0 0);\n --muted-foreground: oklch(0.556 0 0);\n --accent: oklch(0.97 0 0);\n --accent-foreground: oklch(0.205 0 0);\n --destructive: oklch(0.577 0.245 27.325);\n --border: oklch(0.922 0 0);\n --input: oklch(0.922 0 0);\n --ring: oklch(0.708 0 0);\n --radius: 0.625rem;\n}\n\n.dark {\n --background: oklch(0.145 0 0);\n --foreground: oklch(0.985 0 0);\n --card: oklch(0.205 0 0);\n --card-foreground: oklch(0.985 0 0);\n --popover: oklch(0.269 0 0);\n --popover-foreground: oklch(0.985 0 0);\n --primary: oklch(0.922 0 0);\n --primary-foreground: oklch(0.205 0 0);\n --secondary: oklch(0.269 0 0);\n --secondary-foreground: oklch(0.985 0 0);\n --muted: oklch(0.269 0 0);\n --muted-foreground: oklch(0.708 0 0);\n --accent: oklch(0.371 0 0);\n --accent-foreground: oklch(0.985 0 0);\n --destructive: oklch(0.704 0.191 22.216);\n --border: oklch(1 0 0 / 10%);\n --input: oklch(1 0 0 / 15%);\n --ring: oklch(0.556 0 0);\n}\n\n@theme inline {\n --radius-sm: calc(var(--radius) - 4px);\n --radius-md: calc(var(--radius) - 2px);\n --radius-lg: var(--radius);\n --radius-xl: calc(var(--radius) + 4px);\n --color-background: var(--background);\n --color-foreground: var(--foreground);\n --color-card: var(--card);\n --color-card-foreground: var(--card-foreground);\n --color-popover: var(--popover);\n --color-popover-foreground: var(--popover-foreground);\n --color-primary: var(--primary);\n --color-primary-foreground: var(--primary-foreground);\n --color-secondary: var(--secondary);\n --color-secondary-foreground: var(--secondary-foreground);\n --color-muted: var(--muted);\n --color-muted-foreground: var(--muted-foreground);\n --color-accent: var(--accent);\n --color-accent-foreground: var(--accent-foreground);\n --color-destructive: var(--destructive);\n --color-border: var(--border);\n --color-input: var(--input);\n --color-ring: var(--ring);\n}\n\n/* 全局边框色兜底,对齐 shadcn v4 官方 tokens(上游另含 outline-ring/50,此处仅移植 border):\n 裸 border 类不再回退 currentColor,而是使用 --border token。 */\n@layer base {\n * {\n border-color: var(--color-border);\n }\n}\n"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "tooltip",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"description": "文字提示气泡:悬停触发,基于 Ark UI Tooltip 原语,支持 asChild 与延迟配置。",
|
|
6
|
+
"registryDependencies": ["utils"],
|
|
7
|
+
"dependencies": ["@ark-ui/vue@^5.39.2"],
|
|
8
|
+
"files": [
|
|
9
|
+
{
|
|
10
|
+
"path": "tooltip/Tooltip.vue",
|
|
11
|
+
"type": "registry:component",
|
|
12
|
+
"target": "components/ui/tooltip/Tooltip.vue",
|
|
13
|
+
"content": "<script setup lang=\"ts\">\nimport type { PropType } from \"vue\";\nimport { computed, ref } from \"vue\";\nimport { Tooltip as ArkTooltip } from \"@ark-ui/vue/tooltip\";\n\ninterface Props {\n /** 受控开关(配合 v-model:open);不传时为非受控 */\n open?: boolean;\n defaultOpen?: boolean;\n /** 悬停多久后显示(毫秒) */\n delayDuration?: number;\n /** 移开后多久隐藏(毫秒) */\n closeDuration?: number;\n lazyMount?: boolean;\n unmountOnExit?: boolean;\n}\n\n// open 用 default: undefined 禁用 Boolean casting,保证「未传」可辨(Dialog 同款约定)\nconst props = defineProps({\n open: { type: Boolean as PropType<boolean | undefined>, default: undefined },\n defaultOpen: { type: Boolean, default: false },\n delayDuration: { type: Number, default: undefined },\n closeDuration: { type: Number, default: undefined },\n lazyMount: { type: Boolean, default: false },\n unmountOnExit: { type: Boolean, default: false },\n});\n\nconst emit = defineEmits<{ \"update:open\": [open: boolean] }>();\n\n// 对 Root 恒走受控模式,非受控语义由内部 ref 实现(Dialog 同款)\nconst internalOpen = ref(props.defaultOpen);\nconst isOpen = computed(() => props.open ?? internalOpen.value);\n\nfunction handleUpdate(open: boolean) {\n internalOpen.value = open;\n emit(\"update:open\", open);\n}\n</script>\n\n<template>\n <ArkTooltip.Root\n :open=\"isOpen\"\n :open-delay=\"props.delayDuration\"\n :close-delay=\"props.closeDuration\"\n :lazy-mount=\"props.lazyMount\"\n :unmount-on-exit=\"props.unmountOnExit\"\n @update:open=\"handleUpdate\"\n >\n <slot />\n </ArkTooltip.Root>\n</template>\n"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"path": "tooltip/TooltipContent.vue",
|
|
17
|
+
"type": "registry:component",
|
|
18
|
+
"target": "components/ui/tooltip/TooltipContent.vue",
|
|
19
|
+
"content": "<script setup lang=\"ts\">\nimport { Tooltip as ArkTooltip } from \"@ark-ui/vue/tooltip\";\nimport { cn } from \"@/lib/utils\";\n\ninterface Props {\n class?: string;\n}\n\nconst props = defineProps<Props>();\n</script>\n\n<template>\n <ArkTooltip.Positioner class=\"z-50\">\n <ArkTooltip.Content\n :class=\"\n cn(\n 'bg-primary text-primary-foreground z-50 w-fit rounded-md px-3 py-1.5 text-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',\n props.class,\n )\n \"\n >\n <slot />\n </ArkTooltip.Content>\n </ArkTooltip.Positioner>\n</template>\n"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"path": "tooltip/TooltipTrigger.vue",
|
|
23
|
+
"type": "registry:component",
|
|
24
|
+
"target": "components/ui/tooltip/TooltipTrigger.vue",
|
|
25
|
+
"content": "<script setup lang=\"ts\">\nimport { Tooltip as ArkTooltip } from \"@ark-ui/vue/tooltip\";\n\ninterface Props {\n /** 以默认插槽子元素为渲染目标,行为合并其上 */\n asChild?: boolean;\n}\n\nconst props = defineProps<Props>();\n</script>\n\n<template>\n <ArkTooltip.Trigger :as-child=\"props.asChild\">\n <slot />\n </ArkTooltip.Trigger>\n</template>\n"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"path": "tooltip/index.ts",
|
|
29
|
+
"type": "registry:component",
|
|
30
|
+
"target": "components/ui/tooltip/index.ts",
|
|
31
|
+
"content": "export { default as Tooltip } from \"./Tooltip.vue\";\nexport { default as TooltipContent } from \"./TooltipContent.vue\";\nexport { default as TooltipTrigger } from \"./TooltipTrigger.vue\";\n"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "utils",
|
|
4
|
+
"type": "registry:lib",
|
|
5
|
+
"description": "cn 类名合并工具(clsx + tailwind-merge)。",
|
|
6
|
+
"dependencies": ["clsx@^2.1.1", "tailwind-merge@^3.7.0", "class-variance-authority@^0.7.1"],
|
|
7
|
+
"files": [
|
|
8
|
+
{
|
|
9
|
+
"path": "lib/utils.ts",
|
|
10
|
+
"type": "registry:lib",
|
|
11
|
+
"target": "lib/utils.ts",
|
|
12
|
+
"content": "import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tu-design/vue",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "shadcn 风格的 Vue 3 组件库:Tailwind CSS v4 主题 + Ark UI 原语,CLI 分发组件源码。",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"components",
|
|
7
|
+
"registry",
|
|
8
|
+
"shadcn",
|
|
9
|
+
"tailwindcss",
|
|
10
|
+
"ui",
|
|
11
|
+
"vue",
|
|
12
|
+
"vue3"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/gopowerteam/tu-design#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/gopowerteam/tu-design/issues"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/gopowerteam/tu-design.git"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": "./dist/index.mjs",
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@ark-ui/vue": "^5.39.2",
|
|
36
|
+
"class-variance-authority": "^0.7.1",
|
|
37
|
+
"clsx": "^2.1.1",
|
|
38
|
+
"tailwind-merge": "^3.7.0",
|
|
39
|
+
"tw-animate-css": "^1.4.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@vitejs/plugin-vue": "^6",
|
|
43
|
+
"@vue/test-utils": "^2.5.1",
|
|
44
|
+
"happy-dom": "^20",
|
|
45
|
+
"tsx": "^4.0.0",
|
|
46
|
+
"typescript": "^5.9",
|
|
47
|
+
"unplugin-vue": "^8.0.0",
|
|
48
|
+
"vite-plus": "1.0.0",
|
|
49
|
+
"vitest": "^5.0.1",
|
|
50
|
+
"vue": "^3.5.43",
|
|
51
|
+
"vue-tsc": "^3.3.11",
|
|
52
|
+
"yaml": "^2.4.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"vue": ">=3.5"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "vp run generate:registry && vp pack && tsx scripts/copy-registry.ts",
|
|
59
|
+
"generate:registry": "tsx scripts/generate-registry.ts && vp fmt registry",
|
|
60
|
+
"typecheck": "vue-tsc --noEmit",
|
|
61
|
+
"test": "vp test --run"
|
|
62
|
+
}
|
|
6
63
|
}
|
package/README.md
DELETED