kui-vue 5.6.0 → 5.7.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.
Files changed (91) hide show
  1. package/AI.en-US.md +53 -0
  2. package/AI.md +59 -0
  3. package/README.md +51 -17
  4. package/README.zh-CN.md +52 -18
  5. package/ai/cli.mjs +27 -0
  6. package/ai/evals/cases.json +122 -0
  7. package/ai/kui-components.json +13690 -0
  8. package/ai/kui-components.schema.json +139 -0
  9. package/ai/mcp.mjs +196 -0
  10. package/ai/skills/kui-vue/SKILL.md +24 -0
  11. package/ai/skills/kui-vue/references/components.md +10 -0
  12. package/ai/skills/kui-vue/references/mcp.md +14 -0
  13. package/dist/index.js +2 -2
  14. package/es/index.js +8979 -7053
  15. package/es/locale/de.js +1 -1
  16. package/es/locale/el.js +1 -1
  17. package/es/locale/en.js +1 -1
  18. package/es/locale/fr.js +1 -1
  19. package/es/locale/it.js +1 -1
  20. package/es/locale/ja.js +1 -1
  21. package/es/locale/ko.js +1 -1
  22. package/es/locale/ru.js +1 -1
  23. package/es/locale/th.js +1 -1
  24. package/es/locale/uk.js +1 -1
  25. package/es/locale/vi.js +1 -1
  26. package/es/locale/zh-CN.js +1 -1
  27. package/es/locale/zh-TW.js +1 -1
  28. package/lib/index.cjs +2 -2
  29. package/lib/locale/de.cjs +1 -1
  30. package/lib/locale/el.cjs +1 -1
  31. package/lib/locale/en.cjs +1 -1
  32. package/lib/locale/fr.cjs +1 -1
  33. package/lib/locale/it.cjs +1 -1
  34. package/lib/locale/ja.cjs +1 -1
  35. package/lib/locale/ko.cjs +1 -1
  36. package/lib/locale/ru.cjs +1 -1
  37. package/lib/locale/th.cjs +1 -1
  38. package/lib/locale/uk.cjs +1 -1
  39. package/lib/locale/vi.cjs +1 -1
  40. package/lib/locale/zh-CN.cjs +1 -1
  41. package/lib/locale/zh-TW.cjs +1 -1
  42. package/package.json +31 -17
  43. package/style/base.css +2 -2
  44. package/style/components.css +2 -2
  45. package/style/index.css +2 -2
  46. package/style/motion.css +9 -0
  47. package/style/theme.css +2 -2
  48. package/types/auto-complete/index.d.ts +130 -0
  49. package/types/card/index.d.ts +14 -1
  50. package/types/cascader/index.d.ts +4 -4
  51. package/types/check-card/check-card-group.d.ts +78 -0
  52. package/types/check-card/check-card.d.ts +101 -0
  53. package/types/check-card/context.d.ts +19 -0
  54. package/types/check-card/index.d.ts +7 -0
  55. package/types/check-card/types.d.ts +22 -0
  56. package/types/color-picker/index.d.ts +1 -1
  57. package/types/color-picker/paint.d.ts +9 -0
  58. package/types/components.d.ts +18 -0
  59. package/types/date-picker/index.d.ts +4 -4
  60. package/types/drawer/index.d.ts +1 -1
  61. package/types/dropdown/dropdown.d.ts +6 -6
  62. package/types/global.d.ts +28 -0
  63. package/types/input-number/index.d.ts +1 -1
  64. package/types/input-tag/index.d.ts +114 -0
  65. package/types/mentions/index.d.ts +147 -0
  66. package/types/message/index.d.ts +7 -6
  67. package/types/notice/content.d.ts +10 -10
  68. package/types/page/index.d.ts +3 -0
  69. package/types/popconfirm/index.d.ts +6 -6
  70. package/types/poptip/index.d.ts +6 -6
  71. package/types/rate/index.d.ts +1 -1
  72. package/types/select/select.d.ts +34 -2
  73. package/types/skeleton/skeleton-avatar.d.ts +1 -1
  74. package/types/skeleton/skeleton-button.d.ts +1 -1
  75. package/types/skeleton/skeleton-image.d.ts +1 -1
  76. package/types/skeleton/skeleton-text.d.ts +1 -1
  77. package/types/skeleton/skeleton.d.ts +1 -1
  78. package/types/slider/index.d.ts +2 -2
  79. package/types/steps/index.d.ts +85 -0
  80. package/types/table/index.d.ts +29 -0
  81. package/types/tag/index.d.ts +3 -0
  82. package/types/tour/index.d.ts +97 -0
  83. package/types/transfer/index.d.ts +109 -0
  84. package/types/tree/index.d.ts +42 -0
  85. package/types/tree-select/index.d.ts +44 -2
  86. package/types/typography/index.d.ts +309 -0
  87. package/types/virtual-list/index.d.ts +74 -0
  88. package/types/virtual-list/range.d.ts +14 -0
  89. package/vetur/attributes.json +2239 -759
  90. package/vetur/tags.json +604 -176
  91. package/vetur/web-types.json +5966 -3486
@@ -0,0 +1,139 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://k-ui.cn/schema/kui-components.schema.json",
4
+ "title": "Kui Vue component metadata",
5
+ "type": "object",
6
+ "required": [
7
+ "library",
8
+ "version",
9
+ "homepage",
10
+ "components"
11
+ ],
12
+ "properties": {
13
+ "$schema": {
14
+ "type": "string",
15
+ "format": "uri"
16
+ },
17
+ "library": {
18
+ "const": "kui-vue"
19
+ },
20
+ "version": {
21
+ "type": "string"
22
+ },
23
+ "homepage": {
24
+ "type": "string",
25
+ "format": "uri"
26
+ },
27
+ "components": {
28
+ "type": "array",
29
+ "items": {
30
+ "type": "object",
31
+ "required": [
32
+ "name",
33
+ "tags",
34
+ "children",
35
+ "documentation",
36
+ "props",
37
+ "events",
38
+ "examples"
39
+ ],
40
+ "properties": {
41
+ "name": {
42
+ "type": "string"
43
+ },
44
+ "tags": {
45
+ "type": "array",
46
+ "items": {
47
+ "type": "string"
48
+ }
49
+ },
50
+ "parent": {
51
+ "type": "string"
52
+ },
53
+ "children": {
54
+ "type": "array",
55
+ "items": {
56
+ "type": "string"
57
+ }
58
+ },
59
+ "documentation": {
60
+ "type": "string",
61
+ "format": "uri"
62
+ },
63
+ "props": {
64
+ "type": "array",
65
+ "items": {
66
+ "$ref": "#/$defs/api"
67
+ }
68
+ },
69
+ "events": {
70
+ "type": "array",
71
+ "items": {
72
+ "$ref": "#/$defs/api"
73
+ }
74
+ },
75
+ "examples": {
76
+ "type": "array",
77
+ "items": {
78
+ "type": "object",
79
+ "required": [
80
+ "title",
81
+ "file",
82
+ "source"
83
+ ],
84
+ "properties": {
85
+ "title": {
86
+ "type": "string"
87
+ },
88
+ "file": {
89
+ "type": "string"
90
+ },
91
+ "source": {
92
+ "type": "string"
93
+ }
94
+ }
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ },
101
+ "$defs": {
102
+ "api": {
103
+ "type": "object",
104
+ "required": [
105
+ "name",
106
+ "description",
107
+ "descriptionZh",
108
+ "descriptionEn",
109
+ "type"
110
+ ],
111
+ "properties": {
112
+ "name": {
113
+ "type": "string"
114
+ },
115
+ "description": {
116
+ "type": "string"
117
+ },
118
+ "descriptionZh": {
119
+ "type": "string"
120
+ },
121
+ "descriptionEn": {
122
+ "type": "string"
123
+ },
124
+ "type": {
125
+ "type": "string"
126
+ },
127
+ "eventName": {
128
+ "type": "string"
129
+ },
130
+ "boolean": {
131
+ "type": "boolean"
132
+ },
133
+ "documented": {
134
+ "type": "boolean"
135
+ }
136
+ }
137
+ }
138
+ }
139
+ }
package/ai/mcp.mjs ADDED
@@ -0,0 +1,196 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import process from "node:process";
4
+
5
+ const metadata = JSON.parse(fs.readFileSync(new URL("./kui-components.json", import.meta.url)));
6
+ const byName = new Map(metadata.components.map((item) => [item.name.toLowerCase(), item]));
7
+ const byTag = new Map(
8
+ metadata.components.flatMap((item) =>
9
+ [item.name, ...item.tags].map((tag) => [tag.toLowerCase(), item])
10
+ )
11
+ );
12
+ const tools = [
13
+ ["search_components", "Search components by name, tag, or API description", "query"],
14
+ ["get_component_api", "Get a component's complete public API and examples", "name"],
15
+ ["recommend_components", "Recommend components for a UI requirement", "requirement"],
16
+ ["validate_kui_usage", "Find unknown Kui Vue props in a Vue template", "source"],
17
+ ].map(([name, description, argument]) => ({
18
+ name,
19
+ description,
20
+ inputSchema: {
21
+ type: "object",
22
+ properties: { [argument]: { type: "string" } },
23
+ required: [argument],
24
+ },
25
+ }));
26
+ const prompts = [
27
+ { name: "build_form", description: "Build a validated Kui Vue form", argument: "fields" },
28
+ { name: "build_table", description: "Build a searchable Kui Vue table", argument: "columns" },
29
+ { name: "build_modal_editor", description: "Build a modal form editor", argument: "entity" },
30
+ ].map(({ name, description, argument }) => ({
31
+ name,
32
+ description,
33
+ arguments: [{ name: argument, required: true }],
34
+ }));
35
+ const promptText = {
36
+ build_form: ({ fields = "" }) =>
37
+ `Create a Vue 3 TypeScript form using Kui Vue Form, FormItem, Input and Button for: ${fields}. Include validation and use documented APIs only.`,
38
+ build_table: ({ columns = "" }) =>
39
+ `Create a Vue 3 TypeScript searchable table using Kui Vue Input, Button, Table and Page for: ${columns}. Use documented APIs only.`,
40
+ build_modal_editor: ({ entity = "" }) =>
41
+ `Create a Vue 3 TypeScript editor for ${entity} using Kui Vue Modal, Form, FormItem, Input and Button. Use documented APIs only.`,
42
+ };
43
+ const standardAttributes = new Set([
44
+ "class",
45
+ "style",
46
+ "id",
47
+ "key",
48
+ "ref",
49
+ "role",
50
+ "title",
51
+ "slot",
52
+ "name",
53
+ "aria-label",
54
+ ]);
55
+
56
+ const search = (query) => {
57
+ const terms = String(query).toLowerCase().split(/\s+/).filter(Boolean);
58
+ return metadata.components.filter((item) => {
59
+ const text = JSON.stringify(item).toLowerCase();
60
+ return terms.every((term) => text.includes(term));
61
+ });
62
+ };
63
+ const recommend = (requirement) => {
64
+ const groups = [
65
+ [/(form|表单|edit|编辑)/i, ["Form", "FormItem", "Input", "Button"]],
66
+ [/(table|列表|data|数据)/i, ["Table", "Page", "Input", "Button"]],
67
+ [/(select|选择|dropdown|下拉)/i, ["Select", "Option", "TreeSelect"]],
68
+ [/(modal|dialog|弹窗|对话框)/i, ["Modal", "Button"]],
69
+ [/(upload|上传)/i, ["Upload"]],
70
+ [/(layout|布局|admin|后台)/i, ["Layout", "Sider", "Header", "Content", "Menu"]],
71
+ ];
72
+ const names = new Set(
73
+ groups.filter(([pattern]) => pattern.test(requirement)).flatMap(([, values]) => values)
74
+ );
75
+ if (!names.size)
76
+ search(requirement)
77
+ .slice(0, 8)
78
+ .forEach((item) => names.add(item.name));
79
+ return [...names].map((name) => byName.get(name.toLowerCase())).filter(Boolean);
80
+ };
81
+ const validate = (source) => {
82
+ const issues = [];
83
+ for (const match of String(source).matchAll(/<([A-Z][\w]*|k-[\w-]+)\b([^>]*)>/g)) {
84
+ const component = byTag.get(match[1].toLowerCase());
85
+ if (!component) continue;
86
+ const publicNames = new Set(
87
+ component.props.flatMap((prop) => [
88
+ prop.name.toLowerCase(),
89
+ prop.name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`).toLowerCase(),
90
+ ])
91
+ );
92
+ for (const attribute of match[2].matchAll(/(?:^|\s)(?:v-bind:|:)?([\w-]+)(?:\s*=|\s|$)/g)) {
93
+ const name = attribute[1].toLowerCase();
94
+ if (name.startsWith("v-") || standardAttributes.has(name)) continue;
95
+ if (!publicNames.has(name)) {
96
+ issues.push({
97
+ component: component.name,
98
+ prop: attribute[1],
99
+ message: `Unknown prop ${attribute[1]} on ${component.name}`,
100
+ });
101
+ }
102
+ }
103
+ }
104
+ return { valid: issues.length === 0, issues };
105
+ };
106
+ const toolResult = (value) => ({
107
+ content: [{ type: "text", text: JSON.stringify(value, null, 2) }],
108
+ structuredContent: { result: value },
109
+ });
110
+ const send = (message) => process.stdout.write(`${JSON.stringify(message)}\n`);
111
+
112
+ process.stdin.setEncoding("utf8");
113
+ let buffer = "";
114
+ process.stdin.on("data", (chunk) => {
115
+ buffer += chunk;
116
+ const lines = buffer.split("\n");
117
+ buffer = lines.pop() || "";
118
+ for (const line of lines) {
119
+ if (!line.trim()) continue;
120
+ const request = JSON.parse(line);
121
+ let result = {};
122
+ if (request.method === "initialize") {
123
+ result = {
124
+ protocolVersion: request.params?.protocolVersion || "2025-06-18",
125
+ capabilities: { tools: {}, resources: {}, prompts: {} },
126
+ serverInfo: { name: "kui-vue", version: metadata.version },
127
+ };
128
+ } else if (request.method === "tools/list") result = { tools };
129
+ else if (request.method === "resources/list") {
130
+ result = {
131
+ resources: metadata.components.map((item) => ({
132
+ uri: `kui-vue://components/${item.name}`,
133
+ name: item.name,
134
+ description: item.documentation,
135
+ mimeType: "application/json",
136
+ })),
137
+ };
138
+ } else if (request.method === "resources/read") {
139
+ const name =
140
+ String(request.params?.uri || "")
141
+ .split("/")
142
+ .at(-1) || "";
143
+ const item = byName.get(name.toLowerCase());
144
+ result = {
145
+ contents: item
146
+ ? [
147
+ {
148
+ uri: request.params.uri,
149
+ mimeType: "application/json",
150
+ text: JSON.stringify(item, null, 2),
151
+ },
152
+ ]
153
+ : [],
154
+ };
155
+ } else if (request.method === "prompts/list") result = { prompts };
156
+ else if (request.method === "prompts/get") {
157
+ const create = promptText[request.params?.name];
158
+ result = {
159
+ description: prompts.find((item) => item.name === request.params?.name)?.description,
160
+ messages: create
161
+ ? [
162
+ {
163
+ role: "user",
164
+ content: { type: "text", text: create(request.params?.arguments || {}) },
165
+ },
166
+ ]
167
+ : [],
168
+ };
169
+ } else if (request.method === "tools/call") {
170
+ const { name, arguments: args = {} } = request.params || {};
171
+ let value;
172
+ if (name === "search_components") {
173
+ value = search(args.query).map(({ name, tags, documentation }) => ({
174
+ name,
175
+ tags,
176
+ documentation,
177
+ }));
178
+ } else if (name === "get_component_api") {
179
+ value = byName.get(String(args.name).toLowerCase()) || null;
180
+ } else if (name === "recommend_components") {
181
+ value = recommend(args.requirement).map(
182
+ ({ name, tags, documentation, parent, children }) => ({
183
+ name,
184
+ tags,
185
+ documentation,
186
+ parent,
187
+ children,
188
+ })
189
+ );
190
+ } else if (name === "validate_kui_usage") value = validate(args.source);
191
+ else value = { error: `Unknown tool: ${name}` };
192
+ result = toolResult(value);
193
+ }
194
+ if (request.id !== undefined) send({ jsonrpc: "2.0", id: request.id, result });
195
+ }
196
+ });
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: kui-vue
3
+ description: Build Vue 3 interfaces with Kui Vue components and APIs. Use when creating, editing, reviewing, or troubleshooting applications that depend on kui-vue.
4
+ ---
5
+
6
+ # Kui Vue
7
+
8
+ ## Instructions
9
+
10
+ 1. Confirm the project uses Vue 3 and install `kui-vue` plus `kui-icons` when missing.
11
+ 2. Import `kui-vue/style/index.css` once at the application entry.
12
+ 3. Read `references/components.md` or `kui-vue/metadata` before choosing props, events, and slots. Do not invent APIs.
13
+ 4. Prefer existing Kui Vue controls, layout primitives, popup behavior, theme, size, and shape conventions over custom replacements.
14
+ 5. Use TypeScript types exported by `kui-vue`; avoid `any` and native-element substitutions when a library component exists.
15
+ 6. After changes, run the consuming project's typecheck, lint, and relevant tests.
16
+ 7. When the Kui Vue MCP server is available, use `recommend_components` to plan, `get_component_api` for exact APIs, and `validate_kui_usage` before finishing.
17
+
18
+ ## Common patterns
19
+
20
+ - Use `v-model` for controlled values and the documented update/change events.
21
+ - Use `theme`, `size`, and `shape` consistently across related controls.
22
+ - Use `ConfigProvider` for global configuration.
23
+ - For large Select, Table, Tree, or TreeSelect data sets, consult the virtual scrolling examples.
24
+ - For MCP resources, prompts, and client setup, read `references/mcp.md`.
@@ -0,0 +1,10 @@
1
+ # Kui Vue component reference
2
+
3
+ The canonical machine-readable reference is `../../../kui-components.json` in the npm package.
4
+
5
+ - Documentation: https://k-ui.cn/components
6
+ - Compact AI index: https://k-ui.cn/llms.txt
7
+ - Complete AI documentation: https://k-ui.cn/llms-full.txt
8
+ - Metadata: https://k-ui.cn/kui-components.json
9
+
10
+ Always prefer the metadata shipped with the installed `kui-vue` version because its API matches the user's dependency.
@@ -0,0 +1,14 @@
1
+ # Kui Vue MCP
2
+
3
+ Start the server with `pnpm exec kui-vue-mcp`.
4
+
5
+ ## Tools
6
+
7
+ - `search_components`: search names, tags, descriptions, props, and examples.
8
+ - `get_component_api`: retrieve the complete API for one component.
9
+ - `recommend_components`: map a UI requirement to suitable components.
10
+ - `validate_kui_usage`: detect unknown props in a Vue template.
11
+
12
+ ## Resources and prompts
13
+
14
+ Component resources use `kui-vue://components/{Name}`. Reusable prompts cover forms, searchable tables, and modal editors.