kui-vue 5.8.0 → 6.0.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/ai/kui-components.json +3054 -2253
- package/ai/mcp.mjs +64 -15
- package/dist/index.js +2 -2
- package/es/index.js +5087 -2213
- package/es/locale/de.js +1 -1
- package/es/locale/el.js +1 -1
- package/es/locale/en.js +1 -1
- package/es/locale/fr.js +1 -1
- package/es/locale/it.js +1 -1
- package/es/locale/ja.js +1 -1
- package/es/locale/ko.js +1 -1
- package/es/locale/ru.js +1 -1
- package/es/locale/th.js +1 -1
- package/es/locale/uk.js +1 -1
- package/es/locale/vi.js +1 -1
- package/es/locale/zh-CN.js +1 -1
- package/es/locale/zh-TW.js +1 -1
- package/lib/index.cjs +2 -2
- package/lib/locale/de.cjs +1 -1
- package/lib/locale/el.cjs +1 -1
- package/lib/locale/en.cjs +1 -1
- package/lib/locale/fr.cjs +1 -1
- package/lib/locale/it.cjs +1 -1
- package/lib/locale/ja.cjs +1 -1
- package/lib/locale/ko.cjs +1 -1
- package/lib/locale/ru.cjs +1 -1
- package/lib/locale/th.cjs +1 -1
- package/lib/locale/uk.cjs +1 -1
- package/lib/locale/vi.cjs +1 -1
- package/lib/locale/zh-CN.cjs +1 -1
- package/lib/locale/zh-TW.cjs +1 -1
- package/package.json +26 -24
- package/style/base.css +1 -1
- package/style/components.css +2 -2
- package/style/index.css +2 -2
- package/style/motion.css +2 -2
- package/style/theme.css +1 -1
- package/types/affix/index.d.ts +0 -9
- package/types/alert/index.d.ts +7 -12
- package/types/anchor/anchor.d.ts +0 -18
- package/types/auto-complete/index.d.ts +21 -18
- package/types/back-top/index.d.ts +28 -14
- package/types/breadcrumb/breadcrumb-item.d.ts +12 -2
- package/types/calendar/index.d.ts +13 -20
- package/types/card/index.d.ts +7 -6
- package/types/carousel/carousel.d.ts +8 -2
- package/types/cascader/index.d.ts +39 -28
- package/types/cascader/types.d.ts +5 -1
- package/types/check-card/check-card-group.d.ts +11 -8
- package/types/check-card/check-card.d.ts +11 -8
- package/types/check-card/context.d.ts +1 -0
- package/types/check-card/types.d.ts +1 -0
- package/types/checkbox/checkbox-group.d.ts +13 -13
- package/types/checkbox/checkbox.d.ts +35 -69
- package/types/checkbox/index.d.ts +1 -1
- package/types/checkbox/types.d.ts +2 -1
- package/types/collapse/collapse-panel.d.ts +16 -6
- package/types/collapse/collapse.d.ts +14 -10
- package/types/color-picker/alpha.d.ts +6 -4
- package/types/color-picker/hue.d.ts +6 -5
- package/types/color-picker/index.d.ts +55 -58
- package/types/color-picker/mode.d.ts +9 -7
- package/types/color-picker/paint.d.ts +6 -4
- package/types/color-picker/presets.d.ts +7 -5
- package/types/components.d.ts +12 -10
- package/types/config/context.d.ts +20 -3
- package/types/config/index.d.ts +10 -0
- package/types/config/popup-host.d.ts +6 -0
- package/types/const/types.d.ts +2 -1
- package/types/date-picker/index.d.ts +33 -222
- package/types/descriptions/descriptions-item.d.ts +9 -16
- package/types/descriptions/descriptions.d.ts +11 -9
- package/types/descriptions/index.d.ts +2 -2
- package/types/drawer/index.d.ts +14 -14
- package/types/dropdown/dropdown-button.d.ts +10 -9
- package/types/dropdown/dropdown.d.ts +9 -12
- package/types/dropdown/trigger.d.ts +3 -1
- package/types/feature-card/index.d.ts +10 -11
- package/types/feedback-panel/feedback-panel.d.ts +5 -5
- package/types/flame-wrap/index.d.ts +13 -4
- package/types/form/context.d.ts +66 -0
- package/types/form/form-item.d.ts +16 -1
- package/types/form/form.d.ts +31 -21
- package/types/form/index.d.ts +1 -1
- package/types/form/types.d.ts +6 -2
- package/types/global.d.ts +2 -0
- package/types/grid/grid-item.d.ts +9 -6
- package/types/grid/grid.d.ts +8 -7
- package/types/grid/index.d.ts +1 -0
- package/types/grid/useBreakpoint.d.ts +9 -3
- package/types/icon/index.d.ts +24 -5
- package/types/image/image.d.ts +15 -14
- package/types/image/index.d.ts +1 -0
- package/types/image/preview.d.ts +16 -5
- package/types/input/input-box.d.ts +10 -2
- package/types/input/input.d.ts +122 -12
- package/types/input/textarea.d.ts +50 -4
- package/types/input-number/index.d.ts +31 -11
- package/types/input-otp/input-otp.d.ts +70 -9
- package/types/input-tag/index.d.ts +19 -15
- package/types/kanban/index.d.ts +13 -27
- package/types/list-panel/index.d.ts +14 -13
- package/types/loading/index.d.ts +5 -10
- package/types/mentions/index.d.ts +19 -15
- package/types/menu/menu-context.d.ts +2 -0
- package/types/menu/menu-keyboard.d.ts +7 -0
- package/types/menu/menu.d.ts +35 -24
- package/types/menu/types.d.ts +2 -2
- package/types/modal/index.d.ts +1 -1
- package/types/modal/modal.d.ts +14 -62
- package/types/modal/toast.d.ts +6 -2
- package/types/notice/content.d.ts +9 -9
- package/types/page/index.d.ts +10 -11
- package/types/popconfirm/index.d.ts +10 -32
- package/types/poptip/index.d.ts +8 -17
- package/types/progress/index.d.ts +1 -1
- package/types/qrcode/index.d.ts +8 -3
- package/types/radio/radio-button.d.ts +21 -13
- package/types/radio/radio-group.d.ts +14 -49
- package/types/radio/radio.d.ts +28 -17
- package/types/radio/types.d.ts +2 -2
- package/types/rate/index.d.ts +20 -17
- package/types/rate/star.d.ts +6 -2
- package/types/row-col/row.d.ts +8 -13
- package/types/segmented/index.d.ts +46 -0
- package/types/select/option.d.ts +36 -3
- package/types/select/select.d.ts +17 -123
- package/types/select/types.d.ts +3 -1
- package/types/skeleton/index.d.ts +4 -0
- package/types/skeleton/skeleton-avatar.d.ts +11 -42
- package/types/skeleton/skeleton-button.d.ts +13 -42
- package/types/skeleton/skeleton-image.d.ts +9 -42
- package/types/skeleton/skeleton-text.d.ts +9 -42
- package/types/skeleton/skeleton.d.ts +12 -20
- package/types/skeleton/types.d.ts +52 -10
- package/types/slider/index.d.ts +24 -75
- package/types/slider/thumb.d.ts +18 -6
- package/types/space/index.d.ts +8 -4
- package/types/spin/index.d.ts +1 -1
- package/types/splitter/splitter.d.ts +10 -11
- package/types/stat-card/stat-card.d.ts +26 -13
- package/types/stat-card/stat-number.d.ts +0 -3
- package/types/stat-card/types.d.ts +2 -1
- package/types/stat-card/utils/countup.d.ts +1 -0
- package/types/stat-card/utils/odometer.d.ts +1 -0
- package/types/steps/index.d.ts +6 -5
- package/types/switch/index.d.ts +33 -56
- package/types/table/column-setting.d.ts +6 -3
- package/types/table/index.d.ts +25 -61
- package/types/tabs/tab-panel.d.ts +4 -4
- package/types/tabs/tabs.d.ts +18 -11
- package/types/tag/index.d.ts +6 -11
- package/types/time-line/timeline-item.d.ts +7 -7
- package/types/tooltip/index.d.ts +6 -2
- package/types/tour/index.d.ts +25 -11
- package/types/transfer/index.d.ts +20 -14
- package/types/tree/index.d.ts +40 -89
- package/types/tree/types.d.ts +21 -0
- package/types/tree/utils.d.ts +1 -0
- package/types/tree-select/index.d.ts +14 -183
- package/types/typography/index.d.ts +34 -36
- package/types/upload/file-list.d.ts +43 -2
- package/types/upload/index.d.ts +114 -48
- package/types/upload/selector.d.ts +10 -3
- package/types/upload/types.d.ts +22 -0
- package/types/utils/checked.d.ts +1 -1
- package/types/utils/css.d.ts +2 -0
- package/types/utils/focus.d.ts +5 -0
- package/types/utils/vue.d.ts +7 -1
- package/types/virtual-list/index.d.ts +4 -2
- package/types/virtual-list/range.d.ts +1 -0
- package/vetur/attributes.json +2210 -1270
- package/vetur/tags.json +486 -312
- package/vetur/web-types.json +2057 -875
- package/test/use-unpkg.html +0 -45
- package/types/icon/demo/search.d.ts +0 -2
- package/types/icon/demo/tags.d.ts +0 -4
package/ai/mcp.mjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import process from "node:process";
|
|
4
|
+
import { baseParse, ElementTypes, NodeTypes } from "@vue/compiler-dom";
|
|
4
5
|
|
|
5
6
|
const metadata = JSON.parse(fs.readFileSync(new URL("./kui-components.json", import.meta.url)));
|
|
6
7
|
const byName = new Map(metadata.components.map((item) => [item.name.toLowerCase(), item]));
|
|
7
8
|
const byTag = new Map(
|
|
8
9
|
metadata.components.flatMap((item) =>
|
|
9
|
-
[item.name, ...item.tags].map((tag) => [tag.toLowerCase(), item])
|
|
10
|
-
)
|
|
10
|
+
[item.name, ...item.tags].map((tag) => [tag.toLowerCase(), item]),
|
|
11
|
+
),
|
|
11
12
|
);
|
|
12
13
|
const tools = [
|
|
13
14
|
["search_components", "Search components by name, tag, or API description", "query"],
|
|
14
15
|
["get_component_api", "Get a component's complete public API and examples", "name"],
|
|
15
16
|
["recommend_components", "Recommend components for a UI requirement", "requirement"],
|
|
16
|
-
["validate_kui_usage", "Find unknown Kui Vue props
|
|
17
|
+
["validate_kui_usage", "Find unknown Kui Vue props using the Vue template AST", "source"],
|
|
17
18
|
].map(([name, description, argument]) => ({
|
|
18
19
|
name,
|
|
19
20
|
description,
|
|
@@ -51,6 +52,7 @@ const standardAttributes = new Set([
|
|
|
51
52
|
"slot",
|
|
52
53
|
"name",
|
|
53
54
|
"aria-label",
|
|
55
|
+
"tabindex",
|
|
54
56
|
]);
|
|
55
57
|
|
|
56
58
|
const search = (query) => {
|
|
@@ -70,7 +72,7 @@ const recommend = (requirement) => {
|
|
|
70
72
|
[/(layout|布局|admin|后台)/i, ["Layout", "Sider", "Header", "Content", "Menu"]],
|
|
71
73
|
];
|
|
72
74
|
const names = new Set(
|
|
73
|
-
groups.filter(([pattern]) => pattern.test(requirement)).flatMap(([, values]) => values)
|
|
75
|
+
groups.filter(([pattern]) => pattern.test(requirement)).flatMap(([, values]) => values),
|
|
74
76
|
);
|
|
75
77
|
if (!names.size)
|
|
76
78
|
search(requirement)
|
|
@@ -80,27 +82,74 @@ const recommend = (requirement) => {
|
|
|
80
82
|
};
|
|
81
83
|
const validate = (source) => {
|
|
82
84
|
const issues = [];
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
const parseErrors = [];
|
|
86
|
+
const ast = baseParse(String(source), { onError: (error) => parseErrors.push(error) });
|
|
87
|
+
|
|
88
|
+
for (const error of parseErrors) {
|
|
89
|
+
issues.push({
|
|
90
|
+
kind: "syntax",
|
|
91
|
+
message: error.message,
|
|
92
|
+
line: error.loc?.start.line,
|
|
93
|
+
column: error.loc?.start.column,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const visit = (node) => {
|
|
98
|
+
if (node.type === NodeTypes.ELEMENT) {
|
|
99
|
+
if (node.tagType === ElementTypes.COMPONENT) validateElement(node);
|
|
100
|
+
node.children.forEach(visit);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (Array.isArray(node.children)) node.children.forEach(visit);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const validateElement = (node) => {
|
|
107
|
+
const component = byTag.get(node.tag.toLowerCase());
|
|
108
|
+
if (!component) return;
|
|
86
109
|
const publicNames = new Set(
|
|
87
110
|
component.props.flatMap((prop) => [
|
|
88
111
|
prop.name.toLowerCase(),
|
|
89
112
|
prop.name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`).toLowerCase(),
|
|
90
|
-
])
|
|
113
|
+
]),
|
|
91
114
|
);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
115
|
+
|
|
116
|
+
for (const attribute of node.props) {
|
|
117
|
+
let rawName;
|
|
118
|
+
if (attribute.type === NodeTypes.ATTRIBUTE) {
|
|
119
|
+
rawName = attribute.name;
|
|
120
|
+
} else if (
|
|
121
|
+
attribute.type === NodeTypes.DIRECTIVE &&
|
|
122
|
+
(attribute.name === "bind" || attribute.name === "model") &&
|
|
123
|
+
attribute.arg?.type === NodeTypes.SIMPLE_EXPRESSION &&
|
|
124
|
+
attribute.arg.isStatic
|
|
125
|
+
) {
|
|
126
|
+
rawName =
|
|
127
|
+
attribute.name === "model" && !attribute.arg.content
|
|
128
|
+
? "modelValue"
|
|
129
|
+
: attribute.arg.content;
|
|
130
|
+
} else if (attribute.type === NodeTypes.DIRECTIVE && attribute.name === "model") {
|
|
131
|
+
rawName = "modelValue";
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (!rawName) continue;
|
|
135
|
+
const name = rawName.toLowerCase();
|
|
136
|
+
if (standardAttributes.has(name) || name.startsWith("aria-") || name.startsWith("data-")) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
95
139
|
if (!publicNames.has(name)) {
|
|
96
140
|
issues.push({
|
|
141
|
+
kind: "prop",
|
|
97
142
|
component: component.name,
|
|
98
|
-
prop:
|
|
99
|
-
message: `Unknown prop ${
|
|
143
|
+
prop: rawName,
|
|
144
|
+
message: `Unknown prop ${rawName} on ${component.name}`,
|
|
145
|
+
line: attribute.loc.start.line,
|
|
146
|
+
column: attribute.loc.start.column,
|
|
100
147
|
});
|
|
101
148
|
}
|
|
102
149
|
}
|
|
103
|
-
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
visit(ast);
|
|
104
153
|
return { valid: issues.length === 0, issues };
|
|
105
154
|
};
|
|
106
155
|
const toolResult = (value) => ({
|
|
@@ -185,7 +234,7 @@ process.stdin.on("data", (chunk) => {
|
|
|
185
234
|
documentation,
|
|
186
235
|
parent,
|
|
187
236
|
children,
|
|
188
|
-
})
|
|
237
|
+
}),
|
|
189
238
|
);
|
|
190
239
|
} else if (name === "validate_kui_usage") value = validate(args.source);
|
|
191
240
|
else value = { error: `Unknown tool: ${name}` };
|