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.
Files changed (177) hide show
  1. package/ai/kui-components.json +3054 -2253
  2. package/ai/mcp.mjs +64 -15
  3. package/dist/index.js +2 -2
  4. package/es/index.js +5087 -2213
  5. package/es/locale/de.js +1 -1
  6. package/es/locale/el.js +1 -1
  7. package/es/locale/en.js +1 -1
  8. package/es/locale/fr.js +1 -1
  9. package/es/locale/it.js +1 -1
  10. package/es/locale/ja.js +1 -1
  11. package/es/locale/ko.js +1 -1
  12. package/es/locale/ru.js +1 -1
  13. package/es/locale/th.js +1 -1
  14. package/es/locale/uk.js +1 -1
  15. package/es/locale/vi.js +1 -1
  16. package/es/locale/zh-CN.js +1 -1
  17. package/es/locale/zh-TW.js +1 -1
  18. package/lib/index.cjs +2 -2
  19. package/lib/locale/de.cjs +1 -1
  20. package/lib/locale/el.cjs +1 -1
  21. package/lib/locale/en.cjs +1 -1
  22. package/lib/locale/fr.cjs +1 -1
  23. package/lib/locale/it.cjs +1 -1
  24. package/lib/locale/ja.cjs +1 -1
  25. package/lib/locale/ko.cjs +1 -1
  26. package/lib/locale/ru.cjs +1 -1
  27. package/lib/locale/th.cjs +1 -1
  28. package/lib/locale/uk.cjs +1 -1
  29. package/lib/locale/vi.cjs +1 -1
  30. package/lib/locale/zh-CN.cjs +1 -1
  31. package/lib/locale/zh-TW.cjs +1 -1
  32. package/package.json +26 -24
  33. package/style/base.css +1 -1
  34. package/style/components.css +2 -2
  35. package/style/index.css +2 -2
  36. package/style/motion.css +2 -2
  37. package/style/theme.css +1 -1
  38. package/types/affix/index.d.ts +0 -9
  39. package/types/alert/index.d.ts +7 -12
  40. package/types/anchor/anchor.d.ts +0 -18
  41. package/types/auto-complete/index.d.ts +21 -18
  42. package/types/back-top/index.d.ts +28 -14
  43. package/types/breadcrumb/breadcrumb-item.d.ts +12 -2
  44. package/types/calendar/index.d.ts +13 -20
  45. package/types/card/index.d.ts +7 -6
  46. package/types/carousel/carousel.d.ts +8 -2
  47. package/types/cascader/index.d.ts +39 -28
  48. package/types/cascader/types.d.ts +5 -1
  49. package/types/check-card/check-card-group.d.ts +11 -8
  50. package/types/check-card/check-card.d.ts +11 -8
  51. package/types/check-card/context.d.ts +1 -0
  52. package/types/check-card/types.d.ts +1 -0
  53. package/types/checkbox/checkbox-group.d.ts +13 -13
  54. package/types/checkbox/checkbox.d.ts +35 -69
  55. package/types/checkbox/index.d.ts +1 -1
  56. package/types/checkbox/types.d.ts +2 -1
  57. package/types/collapse/collapse-panel.d.ts +16 -6
  58. package/types/collapse/collapse.d.ts +14 -10
  59. package/types/color-picker/alpha.d.ts +6 -4
  60. package/types/color-picker/hue.d.ts +6 -5
  61. package/types/color-picker/index.d.ts +55 -58
  62. package/types/color-picker/mode.d.ts +9 -7
  63. package/types/color-picker/paint.d.ts +6 -4
  64. package/types/color-picker/presets.d.ts +7 -5
  65. package/types/components.d.ts +12 -10
  66. package/types/config/context.d.ts +20 -3
  67. package/types/config/index.d.ts +10 -0
  68. package/types/config/popup-host.d.ts +6 -0
  69. package/types/const/types.d.ts +2 -1
  70. package/types/date-picker/index.d.ts +33 -222
  71. package/types/descriptions/descriptions-item.d.ts +9 -16
  72. package/types/descriptions/descriptions.d.ts +11 -9
  73. package/types/descriptions/index.d.ts +2 -2
  74. package/types/drawer/index.d.ts +14 -14
  75. package/types/dropdown/dropdown-button.d.ts +10 -9
  76. package/types/dropdown/dropdown.d.ts +9 -12
  77. package/types/dropdown/trigger.d.ts +3 -1
  78. package/types/feature-card/index.d.ts +10 -11
  79. package/types/feedback-panel/feedback-panel.d.ts +5 -5
  80. package/types/flame-wrap/index.d.ts +13 -4
  81. package/types/form/context.d.ts +66 -0
  82. package/types/form/form-item.d.ts +16 -1
  83. package/types/form/form.d.ts +31 -21
  84. package/types/form/index.d.ts +1 -1
  85. package/types/form/types.d.ts +6 -2
  86. package/types/global.d.ts +2 -0
  87. package/types/grid/grid-item.d.ts +9 -6
  88. package/types/grid/grid.d.ts +8 -7
  89. package/types/grid/index.d.ts +1 -0
  90. package/types/grid/useBreakpoint.d.ts +9 -3
  91. package/types/icon/index.d.ts +24 -5
  92. package/types/image/image.d.ts +15 -14
  93. package/types/image/index.d.ts +1 -0
  94. package/types/image/preview.d.ts +16 -5
  95. package/types/input/input-box.d.ts +10 -2
  96. package/types/input/input.d.ts +122 -12
  97. package/types/input/textarea.d.ts +50 -4
  98. package/types/input-number/index.d.ts +31 -11
  99. package/types/input-otp/input-otp.d.ts +70 -9
  100. package/types/input-tag/index.d.ts +19 -15
  101. package/types/kanban/index.d.ts +13 -27
  102. package/types/list-panel/index.d.ts +14 -13
  103. package/types/loading/index.d.ts +5 -10
  104. package/types/mentions/index.d.ts +19 -15
  105. package/types/menu/menu-context.d.ts +2 -0
  106. package/types/menu/menu-keyboard.d.ts +7 -0
  107. package/types/menu/menu.d.ts +35 -24
  108. package/types/menu/types.d.ts +2 -2
  109. package/types/modal/index.d.ts +1 -1
  110. package/types/modal/modal.d.ts +14 -62
  111. package/types/modal/toast.d.ts +6 -2
  112. package/types/notice/content.d.ts +9 -9
  113. package/types/page/index.d.ts +10 -11
  114. package/types/popconfirm/index.d.ts +10 -32
  115. package/types/poptip/index.d.ts +8 -17
  116. package/types/progress/index.d.ts +1 -1
  117. package/types/qrcode/index.d.ts +8 -3
  118. package/types/radio/radio-button.d.ts +21 -13
  119. package/types/radio/radio-group.d.ts +14 -49
  120. package/types/radio/radio.d.ts +28 -17
  121. package/types/radio/types.d.ts +2 -2
  122. package/types/rate/index.d.ts +20 -17
  123. package/types/rate/star.d.ts +6 -2
  124. package/types/row-col/row.d.ts +8 -13
  125. package/types/segmented/index.d.ts +46 -0
  126. package/types/select/option.d.ts +36 -3
  127. package/types/select/select.d.ts +17 -123
  128. package/types/select/types.d.ts +3 -1
  129. package/types/skeleton/index.d.ts +4 -0
  130. package/types/skeleton/skeleton-avatar.d.ts +11 -42
  131. package/types/skeleton/skeleton-button.d.ts +13 -42
  132. package/types/skeleton/skeleton-image.d.ts +9 -42
  133. package/types/skeleton/skeleton-text.d.ts +9 -42
  134. package/types/skeleton/skeleton.d.ts +12 -20
  135. package/types/skeleton/types.d.ts +52 -10
  136. package/types/slider/index.d.ts +24 -75
  137. package/types/slider/thumb.d.ts +18 -6
  138. package/types/space/index.d.ts +8 -4
  139. package/types/spin/index.d.ts +1 -1
  140. package/types/splitter/splitter.d.ts +10 -11
  141. package/types/stat-card/stat-card.d.ts +26 -13
  142. package/types/stat-card/stat-number.d.ts +0 -3
  143. package/types/stat-card/types.d.ts +2 -1
  144. package/types/stat-card/utils/countup.d.ts +1 -0
  145. package/types/stat-card/utils/odometer.d.ts +1 -0
  146. package/types/steps/index.d.ts +6 -5
  147. package/types/switch/index.d.ts +33 -56
  148. package/types/table/column-setting.d.ts +6 -3
  149. package/types/table/index.d.ts +25 -61
  150. package/types/tabs/tab-panel.d.ts +4 -4
  151. package/types/tabs/tabs.d.ts +18 -11
  152. package/types/tag/index.d.ts +6 -11
  153. package/types/time-line/timeline-item.d.ts +7 -7
  154. package/types/tooltip/index.d.ts +6 -2
  155. package/types/tour/index.d.ts +25 -11
  156. package/types/transfer/index.d.ts +20 -14
  157. package/types/tree/index.d.ts +40 -89
  158. package/types/tree/types.d.ts +21 -0
  159. package/types/tree/utils.d.ts +1 -0
  160. package/types/tree-select/index.d.ts +14 -183
  161. package/types/typography/index.d.ts +34 -36
  162. package/types/upload/file-list.d.ts +43 -2
  163. package/types/upload/index.d.ts +114 -48
  164. package/types/upload/selector.d.ts +10 -3
  165. package/types/upload/types.d.ts +22 -0
  166. package/types/utils/checked.d.ts +1 -1
  167. package/types/utils/css.d.ts +2 -0
  168. package/types/utils/focus.d.ts +5 -0
  169. package/types/utils/vue.d.ts +7 -1
  170. package/types/virtual-list/index.d.ts +4 -2
  171. package/types/virtual-list/range.d.ts +1 -0
  172. package/vetur/attributes.json +2210 -1270
  173. package/vetur/tags.json +486 -312
  174. package/vetur/web-types.json +2057 -875
  175. package/test/use-unpkg.html +0 -45
  176. package/types/icon/demo/search.d.ts +0 -2
  177. 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 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}` };