kui-vue 5.7.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.
Files changed (206) hide show
  1. package/ai/evals/cases.json +18 -0
  2. package/ai/kui-components.json +3803 -2038
  3. package/ai/kui-components.schema.json +33 -0
  4. package/ai/mcp.mjs +64 -15
  5. package/dist/index.js +2 -2
  6. package/es/index.js +5546 -2165
  7. package/es/locale/de.js +6 -2
  8. package/es/locale/el.js +6 -2
  9. package/es/locale/en.js +6 -2
  10. package/es/locale/fr.js +6 -2
  11. package/es/locale/it.js +6 -2
  12. package/es/locale/ja.js +6 -2
  13. package/es/locale/ko.js +6 -2
  14. package/es/locale/ru.js +6 -2
  15. package/es/locale/th.js +6 -2
  16. package/es/locale/uk.js +6 -2
  17. package/es/locale/vi.js +6 -2
  18. package/es/locale/zh-CN.js +6 -2
  19. package/es/locale/zh-TW.js +6 -2
  20. package/lib/index.cjs +2 -2
  21. package/lib/locale/de.cjs +2 -2
  22. package/lib/locale/el.cjs +2 -2
  23. package/lib/locale/en.cjs +2 -2
  24. package/lib/locale/fr.cjs +2 -2
  25. package/lib/locale/it.cjs +2 -2
  26. package/lib/locale/ja.cjs +2 -2
  27. package/lib/locale/ko.cjs +2 -2
  28. package/lib/locale/ru.cjs +2 -2
  29. package/lib/locale/th.cjs +2 -2
  30. package/lib/locale/uk.cjs +2 -2
  31. package/lib/locale/vi.cjs +2 -2
  32. package/lib/locale/zh-CN.cjs +2 -2
  33. package/lib/locale/zh-TW.cjs +2 -2
  34. package/package.json +28 -24
  35. package/style/base.css +1 -1
  36. package/style/components.css +2 -2
  37. package/style/index.css +2 -2
  38. package/style/motion.css +2 -2
  39. package/style/theme.css +1 -1
  40. package/types/affix/index.d.ts +0 -9
  41. package/types/alert/index.d.ts +7 -12
  42. package/types/anchor/anchor.d.ts +0 -18
  43. package/types/auto-complete/index.d.ts +21 -18
  44. package/types/back-top/index.d.ts +28 -14
  45. package/types/breadcrumb/breadcrumb-item.d.ts +12 -2
  46. package/types/calendar/index.d.ts +90 -0
  47. package/types/card/index.d.ts +7 -6
  48. package/types/carousel/carousel.d.ts +8 -2
  49. package/types/cascader/index.d.ts +39 -28
  50. package/types/cascader/types.d.ts +5 -1
  51. package/types/check-card/check-card-group.d.ts +11 -8
  52. package/types/check-card/check-card.d.ts +11 -8
  53. package/types/check-card/context.d.ts +1 -0
  54. package/types/check-card/types.d.ts +1 -0
  55. package/types/checkbox/checkbox-group.d.ts +13 -13
  56. package/types/checkbox/checkbox.d.ts +35 -69
  57. package/types/checkbox/index.d.ts +1 -1
  58. package/types/checkbox/types.d.ts +2 -1
  59. package/types/collapse/collapse-panel.d.ts +16 -6
  60. package/types/collapse/collapse.d.ts +14 -10
  61. package/types/color-picker/alpha.d.ts +6 -4
  62. package/types/color-picker/hue.d.ts +6 -5
  63. package/types/color-picker/index.d.ts +55 -58
  64. package/types/color-picker/mode.d.ts +9 -7
  65. package/types/color-picker/paint.d.ts +6 -4
  66. package/types/color-picker/presets.d.ts +7 -5
  67. package/types/components.d.ts +22 -12
  68. package/types/config/context.d.ts +20 -3
  69. package/types/config/index.d.ts +10 -0
  70. package/types/config/popup-host.d.ts +6 -0
  71. package/types/const/types.d.ts +2 -1
  72. package/types/date-picker/index.d.ts +33 -222
  73. package/types/descriptions/descriptions-item.d.ts +9 -16
  74. package/types/descriptions/descriptions.d.ts +11 -9
  75. package/types/descriptions/index.d.ts +2 -2
  76. package/types/drawer/index.d.ts +14 -14
  77. package/types/dropdown/dropdown-button.d.ts +10 -9
  78. package/types/dropdown/dropdown.d.ts +9 -12
  79. package/types/dropdown/trigger.d.ts +3 -1
  80. package/types/feature-card/index.d.ts +50 -8
  81. package/types/feedback-panel/feedback-panel.d.ts +5 -5
  82. package/types/flame-wrap/index.d.ts +13 -4
  83. package/types/form/context.d.ts +66 -0
  84. package/types/form/form-item.d.ts +16 -1
  85. package/types/form/form.d.ts +31 -21
  86. package/types/form/index.d.ts +1 -1
  87. package/types/form/types.d.ts +6 -2
  88. package/types/global.d.ts +11 -0
  89. package/types/grid/grid-item.d.ts +9 -6
  90. package/types/grid/grid.d.ts +8 -7
  91. package/types/grid/index.d.ts +1 -0
  92. package/types/grid/useBreakpoint.d.ts +9 -3
  93. package/types/icon/index.d.ts +24 -5
  94. package/types/image/image.d.ts +15 -14
  95. package/types/image/index.d.ts +1 -0
  96. package/types/image/preview.d.ts +16 -5
  97. package/types/input/input-box.d.ts +10 -2
  98. package/types/input/input.d.ts +122 -12
  99. package/types/input/textarea.d.ts +50 -4
  100. package/types/input-number/index.d.ts +31 -11
  101. package/types/input-otp/input-otp.d.ts +70 -9
  102. package/types/input-tag/index.d.ts +19 -15
  103. package/types/kanban/index.d.ts +123 -0
  104. package/types/list-panel/index.d.ts +79 -0
  105. package/types/loading/index.d.ts +5 -10
  106. package/types/locale/de.d.cts +2 -0
  107. package/types/locale/de.d.ts +2 -0
  108. package/types/locale/el.d.cts +2 -0
  109. package/types/locale/el.d.ts +2 -0
  110. package/types/locale/en.d.cts +2 -0
  111. package/types/locale/en.d.ts +2 -0
  112. package/types/locale/fr.d.cts +2 -0
  113. package/types/locale/fr.d.ts +2 -0
  114. package/types/locale/it.d.cts +2 -0
  115. package/types/locale/it.d.ts +2 -0
  116. package/types/locale/ja.d.cts +2 -0
  117. package/types/locale/ja.d.ts +2 -0
  118. package/types/locale/ko.d.cts +2 -0
  119. package/types/locale/ko.d.ts +2 -0
  120. package/types/locale/ru.d.cts +2 -0
  121. package/types/locale/ru.d.ts +2 -0
  122. package/types/locale/th.d.cts +2 -0
  123. package/types/locale/th.d.ts +2 -0
  124. package/types/locale/uk.d.cts +2 -0
  125. package/types/locale/uk.d.ts +2 -0
  126. package/types/locale/vi.d.cts +2 -0
  127. package/types/locale/vi.d.ts +2 -0
  128. package/types/locale/zh-CN.d.cts +2 -0
  129. package/types/locale/zh-CN.d.ts +2 -0
  130. package/types/locale/zh-TW.d.cts +2 -0
  131. package/types/locale/zh-TW.d.ts +2 -0
  132. package/types/mentions/index.d.ts +19 -15
  133. package/types/menu/menu-context.d.ts +2 -0
  134. package/types/menu/menu-keyboard.d.ts +7 -0
  135. package/types/menu/menu.d.ts +35 -24
  136. package/types/menu/types.d.ts +2 -2
  137. package/types/modal/index.d.ts +1 -1
  138. package/types/modal/modal.d.ts +14 -62
  139. package/types/modal/toast.d.ts +6 -2
  140. package/types/notice/content.d.ts +9 -9
  141. package/types/page/index.d.ts +10 -11
  142. package/types/page-header/index.d.ts +14 -0
  143. package/types/popconfirm/index.d.ts +10 -32
  144. package/types/poptip/index.d.ts +8 -17
  145. package/types/progress/index.d.ts +1 -1
  146. package/types/qrcode/index.d.ts +8 -3
  147. package/types/radio/radio-button.d.ts +21 -13
  148. package/types/radio/radio-group.d.ts +14 -49
  149. package/types/radio/radio.d.ts +28 -17
  150. package/types/radio/types.d.ts +2 -2
  151. package/types/rate/index.d.ts +20 -17
  152. package/types/rate/star.d.ts +6 -2
  153. package/types/row-col/row.d.ts +8 -13
  154. package/types/segmented/index.d.ts +46 -0
  155. package/types/select/option.d.ts +36 -3
  156. package/types/select/select.d.ts +17 -123
  157. package/types/select/types.d.ts +3 -1
  158. package/types/skeleton/index.d.ts +4 -0
  159. package/types/skeleton/skeleton-avatar.d.ts +11 -42
  160. package/types/skeleton/skeleton-button.d.ts +13 -42
  161. package/types/skeleton/skeleton-image.d.ts +9 -42
  162. package/types/skeleton/skeleton-text.d.ts +9 -42
  163. package/types/skeleton/skeleton.d.ts +12 -20
  164. package/types/skeleton/types.d.ts +52 -10
  165. package/types/slider/index.d.ts +24 -75
  166. package/types/slider/thumb.d.ts +18 -6
  167. package/types/space/index.d.ts +8 -4
  168. package/types/spin/index.d.ts +1 -1
  169. package/types/splitter/splitter.d.ts +10 -11
  170. package/types/stat-card/stat-card.d.ts +26 -13
  171. package/types/stat-card/stat-number.d.ts +0 -3
  172. package/types/stat-card/types.d.ts +2 -1
  173. package/types/stat-card/utils/countup.d.ts +1 -0
  174. package/types/stat-card/utils/odometer.d.ts +1 -0
  175. package/types/steps/index.d.ts +6 -5
  176. package/types/switch/index.d.ts +33 -56
  177. package/types/table/column-setting.d.ts +78 -0
  178. package/types/table/index.d.ts +40 -61
  179. package/types/tabs/tab-panel.d.ts +4 -4
  180. package/types/tabs/tabs.d.ts +18 -11
  181. package/types/tag/index.d.ts +6 -11
  182. package/types/time-line/timeline-item.d.ts +7 -7
  183. package/types/tooltip/index.d.ts +6 -2
  184. package/types/tour/index.d.ts +25 -11
  185. package/types/transfer/index.d.ts +20 -14
  186. package/types/tree/index.d.ts +40 -89
  187. package/types/tree/types.d.ts +21 -0
  188. package/types/tree/utils.d.ts +1 -0
  189. package/types/tree-select/index.d.ts +14 -183
  190. package/types/typography/index.d.ts +34 -36
  191. package/types/upload/file-list.d.ts +43 -2
  192. package/types/upload/index.d.ts +114 -48
  193. package/types/upload/selector.d.ts +10 -3
  194. package/types/upload/types.d.ts +22 -0
  195. package/types/utils/checked.d.ts +1 -1
  196. package/types/utils/css.d.ts +2 -0
  197. package/types/utils/focus.d.ts +5 -0
  198. package/types/utils/vue.d.ts +7 -1
  199. package/types/virtual-list/index.d.ts +4 -2
  200. package/types/virtual-list/range.d.ts +1 -0
  201. package/vetur/attributes.json +2553 -1265
  202. package/vetur/tags.json +602 -307
  203. package/vetur/web-types.json +2881 -1027
  204. package/test/use-unpkg.html +0 -45
  205. package/types/icon/demo/search.d.ts +0 -2
  206. package/types/icon/demo/tags.d.ts +0 -4
@@ -35,6 +35,7 @@
35
35
  "documentation",
36
36
  "props",
37
37
  "events",
38
+ "slots",
38
39
  "examples"
39
40
  ],
40
41
  "properties": {
@@ -72,6 +73,12 @@
72
73
  "$ref": "#/$defs/api"
73
74
  }
74
75
  },
76
+ "slots": {
77
+ "type": "array",
78
+ "items": {
79
+ "$ref": "#/$defs/slot"
80
+ }
81
+ },
75
82
  "examples": {
76
83
  "type": "array",
77
84
  "items": {
@@ -134,6 +141,32 @@
134
141
  "type": "boolean"
135
142
  }
136
143
  }
144
+ },
145
+ "slot": {
146
+ "type": "object",
147
+ "required": [
148
+ "name",
149
+ "description",
150
+ "descriptionZh",
151
+ "descriptionEn"
152
+ ],
153
+ "properties": {
154
+ "name": {
155
+ "type": "string"
156
+ },
157
+ "description": {
158
+ "type": "string"
159
+ },
160
+ "descriptionZh": {
161
+ "type": "string"
162
+ },
163
+ "descriptionEn": {
164
+ "type": "string"
165
+ },
166
+ "scope": {
167
+ "type": "string"
168
+ }
169
+ }
137
170
  }
138
171
  }
139
172
  }
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 in a Vue template", "source"],
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
- 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;
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
- 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;
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: attribute[1],
99
- message: `Unknown prop ${attribute[1]} on ${component.name}`,
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}` };