@openvort/vort-ui 1.0.0 → 1.0.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.
@@ -0,0 +1,4 @@
1
+ import type { ComponentResolver } from "unplugin-vue-components/types";
2
+
3
+ export declare function VortResolver(): ComponentResolver;
4
+ export declare const vortComponentNames: string[];
@@ -0,0 +1,246 @@
1
+ /**
2
+ * Vort UI 组件解析器(npm 版本)
3
+ *
4
+ * 用于 unplugin-vue-components 自动导入
5
+ * 支持 <vort-button> 或 <VortButton> 两种写法
6
+ *
7
+ * 注意:所有组件都从主入口 @riskboy999/vort-ui 导入
8
+ */
9
+
10
+ // 组件名列表(所有组件都从主入口导入)
11
+ const componentNames = new Set([
12
+ // ConfigProvider
13
+ "VortConfigProvider",
14
+
15
+ // Anchor
16
+ "Anchor",
17
+ "AnchorLink",
18
+
19
+ // AutoComplete
20
+ "AutoComplete",
21
+
22
+ // Button
23
+ "Button",
24
+
25
+ // Card
26
+ "Card",
27
+
28
+ // Input
29
+ "Input",
30
+ "InputNumber",
31
+ "InputPassword",
32
+ "InputSearch",
33
+
34
+ // Textarea
35
+ "Textarea",
36
+
37
+ // Checkbox
38
+ "Checkbox",
39
+ "CheckboxGroup",
40
+
41
+ // Radio
42
+ "Radio",
43
+ "RadioGroup",
44
+ "RadioButton",
45
+
46
+ // Select
47
+ "Select",
48
+ "SelectOption",
49
+
50
+ // Cascader
51
+ "Cascader",
52
+
53
+ // Switch
54
+ "Switch",
55
+
56
+ // Dialog
57
+ "Dialog",
58
+
59
+ // Divider
60
+ "Divider",
61
+
62
+ // Drawer
63
+ "Drawer",
64
+
65
+ // Dropdown
66
+ "Dropdown",
67
+ "DropdownButton",
68
+ "DropdownMenuItem",
69
+ "DropdownMenuSeparator",
70
+ "DropdownMenuLabel",
71
+ "DropdownMenuGroup",
72
+ "DropdownMenuSub",
73
+ "DropdownMenuCheckboxItem",
74
+ "DropdownMenuRadioGroup",
75
+ "DropdownMenuRadioItem",
76
+
77
+ // Alert
78
+ "Alert",
79
+
80
+ // Badge
81
+ "Badge",
82
+ "BadgeRibbon",
83
+ "StatusDot",
84
+
85
+ // Form
86
+ "Form",
87
+ "FormItem",
88
+
89
+ // Grid
90
+ "Row",
91
+ "Col",
92
+
93
+ // Table
94
+ "Table",
95
+ "TableColumn",
96
+
97
+ // Pagination
98
+ "Pagination",
99
+
100
+ // Image
101
+ "Image",
102
+ "ImagePreviewGroup",
103
+
104
+ // Popover
105
+ "Popover",
106
+
107
+ // Popconfirm
108
+ "Popconfirm",
109
+
110
+ // Tooltip
111
+ "Tooltip",
112
+
113
+ // Tag
114
+ "Tag",
115
+ "CheckableTag",
116
+ "DraggableTags",
117
+
118
+ // DatePicker
119
+ "DatePicker",
120
+ "RangePicker",
121
+
122
+ // TimePicker
123
+ "TimePicker",
124
+
125
+ // Upload
126
+ "Upload",
127
+ "UploadDragger",
128
+
129
+ // Tabs
130
+ "Tabs",
131
+ "TabPane",
132
+
133
+ // Scrollbar
134
+ "Scrollbar",
135
+
136
+ // Slider
137
+ "Slider",
138
+
139
+ // ColorPicker
140
+ "ColorPicker",
141
+
142
+ // Steps
143
+ "Steps",
144
+
145
+ // Spin
146
+ "Spin",
147
+
148
+ // Skeleton
149
+ "Skeleton",
150
+ "SkeletonAvatar",
151
+ "SkeletonButton",
152
+ "SkeletonInput",
153
+ "SkeletonImage",
154
+ "SkeletonNode",
155
+
156
+ // Statistic
157
+ "Statistic",
158
+ "StatisticCountdown",
159
+
160
+ // Timeline
161
+ "Timeline",
162
+ "TimelineItem",
163
+
164
+ // Segmented
165
+ "Segmented",
166
+
167
+ // Menu
168
+ "Menu",
169
+ "MenuItem",
170
+ "MenuItemGroup",
171
+ "SubMenu",
172
+
173
+ // Icon
174
+ "VortIcon",
175
+
176
+ // SearchToolbar
177
+ "SearchToolbar",
178
+ "SearchForm",
179
+ "SearchFormItem",
180
+ "SearchFormActions",
181
+
182
+ // DialogForm
183
+ "DialogForm",
184
+
185
+ // PopForm
186
+ "PopForm",
187
+
188
+ // TableActions
189
+ "TableActions",
190
+ "TableActionsItem",
191
+ "TableActionsMoreItem",
192
+
193
+ // DeleteRecord
194
+ "DeleteRecord",
195
+
196
+ // BatchActions
197
+ "BatchActions"
198
+ ]);
199
+
200
+ /**
201
+ * Vort UI 组件解析器
202
+ *
203
+ * @example
204
+ * // vite.config.ts
205
+ * import Components from 'unplugin-vue-components/vite';
206
+ * import { VortResolver } from '@riskboy999/vort-ui/resolver';
207
+ *
208
+ * export default defineConfig({
209
+ * plugins: [
210
+ * Components({
211
+ * resolvers: [VortResolver()]
212
+ * })
213
+ * ]
214
+ * });
215
+ *
216
+ * @example
217
+ * // 使用组件(无需手动导入)
218
+ * <vort-button type="primary">按钮</vort-button>
219
+ * <VortButton type="primary">按钮</VortButton>
220
+ */
221
+ export function VortResolver() {
222
+ return {
223
+ type: "component",
224
+ resolve: (name) => {
225
+ // 处理 Vort 前缀的组件名
226
+ let componentName = name;
227
+ if (name.startsWith("Vort")) {
228
+ // VortButton -> Button
229
+ componentName = name.slice(4);
230
+ }
231
+
232
+ // 检查是否是支持的组件
233
+ if (componentNames.has(componentName) || componentNames.has(name)) {
234
+ return {
235
+ name: componentNames.has(name) ? name : componentName,
236
+ from: "@riskboy999/vort-ui"
237
+ };
238
+ }
239
+
240
+ return undefined;
241
+ }
242
+ };
243
+ }
244
+
245
+ // 导出组件名列表(用于类型声明)
246
+ export const vortComponentNames = Array.from(componentNames);