kui-vue 6.0.0 → 6.2.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 (265) hide show
  1. package/AI.en-US.md +21 -1
  2. package/AI.md +37 -1
  3. package/ai/behaviors.json +82 -0
  4. package/ai/evals/README.md +59 -0
  5. package/ai/evals/cases.json +91 -24
  6. package/ai/evals/config.json +4 -0
  7. package/ai/evals/evaluate.mjs +267 -0
  8. package/ai/evals/run.mjs +118 -0
  9. package/ai/kui-components.json +7894 -955
  10. package/ai/kui-components.schema.json +67 -0
  11. package/ai/mcp.mjs +210 -166
  12. package/ai/skills/kui-vue/SKILL.md +2 -1
  13. package/ai/skills/kui-vue/references/mcp.md +12 -12
  14. package/ai/templates/form.vue +49 -0
  15. package/ai/templates/index.json +23 -0
  16. package/ai/templates/modal-editor.vue +59 -0
  17. package/ai/templates/table.vue +63 -0
  18. package/ai/validate.mjs +225 -0
  19. package/dist/index.js +2 -2
  20. package/es/index.js +2180 -2179
  21. package/es/locale/de.js +1 -1
  22. package/es/locale/el.js +1 -1
  23. package/es/locale/en.js +1 -1
  24. package/es/locale/fr.js +1 -1
  25. package/es/locale/it.js +1 -1
  26. package/es/locale/ja.js +1 -1
  27. package/es/locale/ko.js +1 -1
  28. package/es/locale/ru.js +1 -1
  29. package/es/locale/th.js +1 -1
  30. package/es/locale/uk.js +1 -1
  31. package/es/locale/vi.js +1 -1
  32. package/es/locale/zh-CN.js +1 -1
  33. package/es/locale/zh-TW.js +1 -1
  34. package/lib/index.cjs +2 -2
  35. package/lib/locale/de.cjs +1 -1
  36. package/lib/locale/el.cjs +1 -1
  37. package/lib/locale/en.cjs +1 -1
  38. package/lib/locale/fr.cjs +1 -1
  39. package/lib/locale/it.cjs +1 -1
  40. package/lib/locale/ja.cjs +1 -1
  41. package/lib/locale/ko.cjs +1 -1
  42. package/lib/locale/ru.cjs +1 -1
  43. package/lib/locale/th.cjs +1 -1
  44. package/lib/locale/uk.cjs +1 -1
  45. package/lib/locale/vi.cjs +1 -1
  46. package/lib/locale/zh-CN.cjs +1 -1
  47. package/lib/locale/zh-TW.cjs +1 -1
  48. package/package.json +37 -31
  49. package/style/base.css +1 -1
  50. package/style/components.css +2 -2
  51. package/style/index.css +2 -2
  52. package/style/motion.css +1 -1
  53. package/style/theme.css +2 -2
  54. package/types/affix/index.d.ts +5 -5
  55. package/types/alert/index.d.ts +9 -7
  56. package/types/anchor/anchor-link.d.ts +4 -4
  57. package/types/anchor/anchor.d.ts +6 -6
  58. package/types/anchor/context.d.ts +1 -1
  59. package/types/anchor/index.d.ts +4 -4
  60. package/types/auto-complete/index.d.ts +7 -11
  61. package/types/avatar/avatar-group.d.ts +5 -5
  62. package/types/avatar/avatar.d.ts +6 -6
  63. package/types/avatar/context.d.ts +1 -1
  64. package/types/avatar/index.d.ts +4 -4
  65. package/types/back-top/index.d.ts +5 -5
  66. package/types/badge/index.d.ts +6 -6
  67. package/types/base/transition.d.ts +1 -1
  68. package/types/breadcrumb/breadcrumb-item.d.ts +6 -6
  69. package/types/breadcrumb/breadcrumb.d.ts +4 -4
  70. package/types/breadcrumb/index.d.ts +4 -4
  71. package/types/button/button-group.d.ts +5 -5
  72. package/types/button/button.d.ts +4 -4
  73. package/types/button/index.d.ts +4 -4
  74. package/types/calendar/index.d.ts +8 -5
  75. package/types/card/card-meta.d.ts +4 -4
  76. package/types/card/index.d.ts +8 -8
  77. package/types/carousel/carousel-item.d.ts +1 -1
  78. package/types/carousel/carousel.d.ts +20 -7
  79. package/types/carousel/index.d.ts +3 -3
  80. package/types/cascader/index.d.ts +41 -32
  81. package/types/cascader/types.d.ts +7 -3
  82. package/types/check-card/check-card-group.d.ts +10 -7
  83. package/types/check-card/check-card.d.ts +21 -8
  84. package/types/check-card/context.d.ts +3 -3
  85. package/types/check-card/index.d.ts +5 -5
  86. package/types/check-card/types.d.ts +2 -2
  87. package/types/checkbox/checkbox-group.d.ts +20 -7
  88. package/types/checkbox/checkbox.d.ts +4 -3
  89. package/types/checkbox/index.d.ts +5 -5
  90. package/types/collapse/collapse-panel.d.ts +6 -6
  91. package/types/collapse/collapse.d.ts +7 -7
  92. package/types/collapse/context.d.ts +1 -1
  93. package/types/collapse/index.d.ts +4 -4
  94. package/types/color-picker/alpha.d.ts +10 -6
  95. package/types/color-picker/hue.d.ts +7 -4
  96. package/types/color-picker/index.d.ts +34 -20
  97. package/types/color-picker/mode.d.ts +9 -9
  98. package/types/color-picker/paint.d.ts +9 -6
  99. package/types/color-picker/presets.d.ts +7 -7
  100. package/types/color-picker/types.d.ts +1 -0
  101. package/types/components.d.ts +166 -161
  102. package/types/config/context.d.ts +2 -2
  103. package/types/config/index.d.ts +7 -7
  104. package/types/config/popup.d.ts +1 -1
  105. package/types/const/types.d.ts +2 -2
  106. package/types/date-picker/index.d.ts +49 -19
  107. package/types/descriptions/descriptions-item.d.ts +5 -5
  108. package/types/descriptions/descriptions.d.ts +5 -5
  109. package/types/descriptions/index.d.ts +4 -2
  110. package/types/directives/outsiteclick.d.ts +1 -1
  111. package/types/directives/resize.d.ts +1 -1
  112. package/types/directives/scroll.d.ts +1 -1
  113. package/types/divider/index.d.ts +5 -5
  114. package/types/drawer/index.d.ts +24 -11
  115. package/types/dropdown/dropdown-button.d.ts +7 -7
  116. package/types/dropdown/dropdown.d.ts +12 -16
  117. package/types/dropdown/index.d.ts +4 -2
  118. package/types/dropdown/trigger.d.ts +6 -6
  119. package/types/empty/index.d.ts +1 -1
  120. package/types/feature-card/index.d.ts +7 -7
  121. package/types/feedback-panel/feedback-panel.d.ts +7 -7
  122. package/types/feedback-panel/index.d.ts +3 -3
  123. package/types/flame-wrap/index.d.ts +9 -9
  124. package/types/flex/index.d.ts +7 -7
  125. package/types/flex/types.d.ts +1 -1
  126. package/types/form/context.d.ts +3 -3
  127. package/types/form/form-item.d.ts +6 -6
  128. package/types/form/form.d.ts +9 -13
  129. package/types/form/index.d.ts +6 -6
  130. package/types/global.d.ts +2 -0
  131. package/types/grid/grid-item.d.ts +2 -2
  132. package/types/grid/grid.d.ts +3 -3
  133. package/types/grid/index.d.ts +5 -5
  134. package/types/grid/useBreakpoint.d.ts +1 -1
  135. package/types/icon/index.d.ts +8 -8
  136. package/types/image/context.d.ts +2 -2
  137. package/types/image/group.d.ts +4 -4
  138. package/types/image/image.d.ts +7 -7
  139. package/types/image/index.d.ts +5 -5
  140. package/types/image/instance.d.ts +11 -4
  141. package/types/image/preview.d.ts +6 -6
  142. package/types/index.d.cts +2 -2
  143. package/types/index.d.ts +2 -2
  144. package/types/input/index.d.ts +6 -6
  145. package/types/input/input-box.d.ts +6 -6
  146. package/types/input/input-group.d.ts +5 -5
  147. package/types/input/input.d.ts +27 -10
  148. package/types/input/textarea.d.ts +17 -8
  149. package/types/input-number/index.d.ts +10 -7
  150. package/types/input-otp/index.d.ts +3 -3
  151. package/types/input-otp/input-otp.d.ts +21 -8
  152. package/types/input-tag/index.d.ts +6 -6
  153. package/types/kanban/index.d.ts +5 -5
  154. package/types/layout/index.d.ts +17 -17
  155. package/types/list-panel/index.d.ts +7 -7
  156. package/types/mentions/index.d.ts +7 -7
  157. package/types/menu/index.d.ts +6 -6
  158. package/types/menu/menu-context.d.ts +4 -2
  159. package/types/menu/menu-divider.d.ts +1 -1
  160. package/types/menu/menu-group.d.ts +4 -4
  161. package/types/menu/menu-item.d.ts +10 -6
  162. package/types/menu/menu.d.ts +24 -17
  163. package/types/menu/recursive-menu.d.ts +5 -5
  164. package/types/menu/sub-menu.d.ts +6 -6
  165. package/types/menu/types.d.ts +2 -2
  166. package/types/message/index.d.ts +3 -3
  167. package/types/modal/index.d.ts +15 -10
  168. package/types/modal/modal.d.ts +25 -97
  169. package/types/modal/toast.d.ts +11 -10
  170. package/types/notice/container.d.ts +3 -3
  171. package/types/notice/content.d.ts +10 -77
  172. package/types/notice/index.d.ts +3 -3
  173. package/types/notice/instance.d.ts +2 -2
  174. package/types/page/index.d.ts +6 -6
  175. package/types/page-header/index.d.ts +4 -4
  176. package/types/popconfirm/index.d.ts +8 -45
  177. package/types/poptip/index.d.ts +9 -47
  178. package/types/popup/index.d.ts +251 -0
  179. package/types/popup/layers.d.ts +9 -0
  180. package/types/popup/types.d.ts +15 -0
  181. package/types/progress/index.d.ts +6 -6
  182. package/types/qrcode/index.d.ts +7 -7
  183. package/types/radio/index.d.ts +8 -7
  184. package/types/radio/radio-button.d.ts +8 -8
  185. package/types/radio/radio-group.d.ts +4 -3
  186. package/types/radio/radio.d.ts +7 -7
  187. package/types/radio/types.d.ts +1 -1
  188. package/types/rate/index.d.ts +7 -7
  189. package/types/rate/star.d.ts +7 -7
  190. package/types/result/index.d.ts +3 -3
  191. package/types/result/result.d.ts +7 -7
  192. package/types/ripple/index.d.ts +6 -6
  193. package/types/row-col/col.d.ts +4 -4
  194. package/types/row-col/index.d.ts +4 -4
  195. package/types/row-col/row.d.ts +4 -4
  196. package/types/segmented/index.d.ts +6 -4
  197. package/types/select/index.d.ts +5 -5
  198. package/types/select/option.d.ts +13 -14
  199. package/types/select/select.d.ts +10 -6
  200. package/types/select/types.d.ts +1 -1
  201. package/types/skeleton/index.d.ts +10 -10
  202. package/types/skeleton/skeleton-avatar.d.ts +13 -13
  203. package/types/skeleton/skeleton-button.d.ts +15 -15
  204. package/types/skeleton/skeleton-image.d.ts +11 -11
  205. package/types/skeleton/skeleton-text.d.ts +11 -11
  206. package/types/skeleton/skeleton.d.ts +15 -15
  207. package/types/skeleton/types.d.ts +2 -2
  208. package/types/skeleton/use-skeleton-loading.d.ts +1 -1
  209. package/types/slider/index.d.ts +8 -3
  210. package/types/slider/thumb.d.ts +7 -7
  211. package/types/space/index.d.ts +4 -4
  212. package/types/spin/index.d.ts +18 -5
  213. package/types/splitter/index.d.ts +2 -2
  214. package/types/splitter/splitter-panel.d.ts +4 -4
  215. package/types/splitter/splitter.d.ts +6 -6
  216. package/types/stat-card/countup.d.ts +4 -4
  217. package/types/stat-card/index.d.ts +5 -5
  218. package/types/stat-card/rollup.d.ts +6 -4
  219. package/types/stat-card/stat-card.d.ts +7 -7
  220. package/types/stat-card/stat-number.d.ts +19 -6
  221. package/types/stat-card/types.d.ts +1 -1
  222. package/types/stat-card/utils/countup.d.ts +1 -1
  223. package/types/stat-card/utils/odometer.d.ts +8 -5
  224. package/types/steps/index.d.ts +8 -8
  225. package/types/switch/index.d.ts +3 -2
  226. package/types/table/column-setting.d.ts +7 -7
  227. package/types/table/index.d.ts +13 -26
  228. package/types/table/types.d.ts +2 -2
  229. package/types/table/utils.d.ts +1 -1
  230. package/types/tabs/index.d.ts +5 -4
  231. package/types/tabs/tab-panel.d.ts +6 -6
  232. package/types/tabs/tabs.d.ts +6 -6
  233. package/types/tabs/types.d.ts +1 -1
  234. package/types/tag/index.d.ts +9 -7
  235. package/types/time-line/index.d.ts +5 -5
  236. package/types/time-line/timeline-item.d.ts +5 -5
  237. package/types/time-line/timeline.d.ts +6 -6
  238. package/types/tooltip/index.d.ts +21 -35
  239. package/types/tour/index.d.ts +34 -23
  240. package/types/transfer/index.d.ts +18 -5
  241. package/types/tree/context.d.ts +1 -1
  242. package/types/tree/index.d.ts +13 -10
  243. package/types/tree/types.d.ts +1 -1
  244. package/types/tree/utils.d.ts +1 -1
  245. package/types/tree-select/index.d.ts +14 -7
  246. package/types/typography/index.d.ts +26 -17
  247. package/types/upload/file-list.d.ts +8 -8
  248. package/types/upload/index.d.ts +9 -22
  249. package/types/upload/picture-sort.d.ts +2 -0
  250. package/types/upload/selector.d.ts +9 -9
  251. package/types/upload/types.d.ts +1 -1
  252. package/types/utils/checked.d.ts +1 -1
  253. package/types/utils/model-value.d.ts +10 -0
  254. package/types/utils/number.d.ts +1 -1
  255. package/types/utils/placement.d.ts +1 -1
  256. package/types/utils/popup.d.ts +11 -0
  257. package/types/utils/selection-tags.d.ts +18 -0
  258. package/types/utils/vnode.d.ts +3 -3
  259. package/types/utils/vue.d.ts +7 -1
  260. package/types/virtual-list/index.d.ts +6 -6
  261. package/types/watermark/index.d.ts +8 -8
  262. package/vetur/attributes.json +1717 -781
  263. package/vetur/tags.json +359 -159
  264. package/vetur/web-types.json +7563 -6197
  265. package/types/directives/transfer.d.ts +0 -2
@@ -0,0 +1,59 @@
1
+ <script setup lang="ts">
2
+ import { reactive, ref } from "vue";
3
+ import { Button, Form, FormItem, Input, Modal, Space, type FormSubmitEvent } from "kui-vue";
4
+
5
+ const saved = ref({ name: "示例用户" });
6
+ const model = reactive({ name: "" });
7
+ const visible = ref(false);
8
+ const saving = ref(false);
9
+ const error = ref("");
10
+ const session = ref(0);
11
+ const rules = { name: [{ required: true, message: "请输入姓名" }] };
12
+ function open(create: boolean) {
13
+ model.name = create ? "" : saved.value.name;
14
+ error.value = "";
15
+ session.value++;
16
+ visible.value = true;
17
+ }
18
+ async function save({ valid }: FormSubmitEvent) {
19
+ if (!valid || saving.value) return;
20
+ saving.value = true;
21
+ error.value = "";
22
+ try {
23
+ const payload = { ...model };
24
+ // Replace this local mock with a create/update API request.
25
+ await new Promise((resolve) => setTimeout(resolve, 200));
26
+ saved.value = payload;
27
+ visible.value = false;
28
+ } catch {
29
+ error.value = "保存失败,请重试";
30
+ } finally {
31
+ saving.value = false;
32
+ }
33
+ }
34
+ </script>
35
+
36
+ <template>
37
+ <Space>
38
+ <Button @click="open(true)">新增</Button>
39
+ <Button @click="open(false)">编辑</Button>
40
+ <span>{{ saved.name }}</span>
41
+ </Space>
42
+ <Modal v-model="visible" title="用户编辑" :footer="false" :loading="saving">
43
+ <Form
44
+ :key="session"
45
+ :model="model"
46
+ :rules="rules"
47
+ :disabled="saving"
48
+ layout="vertical"
49
+ @submit="save"
50
+ >
51
+ <FormItem label="姓名" prop="name"><Input /></FormItem>
52
+ <p v-if="error" role="alert">{{ error }}</p>
53
+ <Space>
54
+ <Button type="primary" html-type="submit" :loading="saving" :disabled="saving">保存</Button>
55
+ <Button :disabled="saving" @click="visible = false">取消</Button>
56
+ </Space>
57
+ </Form>
58
+ </Modal>
59
+ </template>
@@ -0,0 +1,63 @@
1
+ <script setup lang="ts">
2
+ import { onBeforeUnmount, ref, watch } from "vue";
3
+ import { Button, Input, Page, Space, Table } from "kui-vue";
4
+
5
+ type Row = { id: number; name: string };
6
+ const allRows: Row[] = Array.from({ length: 47 }, (_, index) => ({
7
+ id: index + 1,
8
+ name: `用户 ${index + 1}`,
9
+ }));
10
+ const columns = [
11
+ { title: "编号", key: "id" },
12
+ { title: "姓名", key: "name" },
13
+ ];
14
+ const keyword = ref("");
15
+ const query = ref("");
16
+ const page = ref(1);
17
+ const pageSize = ref(10);
18
+ const data = ref<Row[]>([]);
19
+ const total = ref(0);
20
+ const loading = ref(false);
21
+ const error = ref("");
22
+ let requestId = 0;
23
+
24
+ async function load() {
25
+ const id = ++requestId;
26
+ loading.value = true;
27
+ error.value = "";
28
+ const params = { query: query.value, page: page.value, pageSize: pageSize.value };
29
+ try {
30
+ // Replace this local mock with your paginated API returning { data, total }.
31
+ await new Promise((resolve) => setTimeout(resolve, 200));
32
+ const rows = allRows.filter((row) => row.name.includes(params.query));
33
+ if (id !== requestId) return;
34
+ total.value = rows.length;
35
+ data.value = rows.slice((params.page - 1) * params.pageSize, params.page * params.pageSize);
36
+ } catch {
37
+ if (id === requestId) error.value = "加载失败,请重试";
38
+ } finally {
39
+ if (id === requestId) loading.value = false;
40
+ }
41
+ }
42
+ function search() {
43
+ query.value = keyword.value.trim();
44
+ page.value = 1;
45
+ }
46
+ watch([query, page, pageSize], load, { immediate: true });
47
+ onBeforeUnmount(() => {
48
+ requestId++;
49
+ });
50
+ </script>
51
+
52
+ <template>
53
+ <Space vertical block>
54
+ <Space>
55
+ <Input v-model="keyword" placeholder="搜索姓名" />
56
+ <Button type="primary" @click="search">搜索</Button>
57
+ <Button :disabled="loading" @click="load">刷新</Button>
58
+ </Space>
59
+ <p v-if="error" role="alert">{{ error }}</p>
60
+ <Table :columns="columns" :data="data" :loading="loading" />
61
+ <Page v-model:page="page" v-model:pageSize="pageSize" :total="total" show-sizer />
62
+ </Space>
63
+ </template>
@@ -0,0 +1,225 @@
1
+ import { baseParse, ElementTypes, NodeTypes, parserOptions } from "@vue/compiler-dom";
2
+
3
+ const canonical = (name) => name.replace(/-/g, "").toLowerCase();
4
+ const nativeEvents = new Set([
5
+ "click",
6
+ "dblclick",
7
+ "focus",
8
+ "blur",
9
+ "focusin",
10
+ "focusout",
11
+ "keydown",
12
+ "keyup",
13
+ "keypress",
14
+ "mouseenter",
15
+ "mouseleave",
16
+ "mousemove",
17
+ "mousedown",
18
+ "mouseup",
19
+ "pointerdown",
20
+ "pointerup",
21
+ "input",
22
+ "change",
23
+ "submit",
24
+ "reset",
25
+ "scroll",
26
+ "wheel",
27
+ "contextmenu",
28
+ "dragstart",
29
+ "dragend",
30
+ "drop",
31
+ ]);
32
+ const attributes = new Set([
33
+ "class",
34
+ "style",
35
+ "id",
36
+ "key",
37
+ "ref",
38
+ "role",
39
+ "title",
40
+ "tabindex",
41
+ "name",
42
+ "type",
43
+ "autofocus",
44
+ "autocomplete",
45
+ "placeholder",
46
+ "maxlength",
47
+ "minlength",
48
+ "min",
49
+ "max",
50
+ "step",
51
+ "pattern",
52
+ "inputmode",
53
+ "accept",
54
+ "rows",
55
+ "cols",
56
+ "readonly",
57
+ "required",
58
+ "for",
59
+ "href",
60
+ "target",
61
+ "rel",
62
+ ]);
63
+
64
+ // Deliberately never evaluate user expressions. Only unambiguous literals are checked.
65
+ const literal = (expression) => {
66
+ const text = expression?.trim() || "";
67
+ if (/^(true|false|null|-?\d+(?:\.\d+)?)$/.test(text))
68
+ return { known: true, value: JSON.parse(text) };
69
+ if (/^"(?:[^"\\]|\\.)*"$/.test(text)) return { known: true, value: JSON.parse(text) };
70
+ if (/^'[^'\\]*'$/.test(text)) return { known: true, value: text.slice(1, -1) };
71
+ return { known: false };
72
+ };
73
+
74
+ export function validateUsage(source, metadata) {
75
+ const tags = new Map(
76
+ metadata.components.flatMap((c) => [c.name, ...c.tags].map((t) => [t.toLowerCase(), c])),
77
+ );
78
+ const issues = [];
79
+ const skipped = [];
80
+ const add = (kind, message, node, extra = {}) =>
81
+ issues.push({
82
+ kind,
83
+ message,
84
+ line: node.loc?.start.line,
85
+ column: node.loc?.start.column,
86
+ ...extra,
87
+ });
88
+ let ast;
89
+ try {
90
+ ast = baseParse(source, {
91
+ ...parserOptions,
92
+ onError: (error) => add("syntax", error.message, error),
93
+ parseMode: "html",
94
+ });
95
+ } catch (error) {
96
+ add("syntax", error.message, error);
97
+ return { valid: false, issues, skipped, scope: "static-template", complete: false };
98
+ }
99
+ const visit = (node, owner) => {
100
+ if (node.type !== NodeTypes.ELEMENT) {
101
+ node.children?.forEach((child) => visit(child, owner));
102
+ return;
103
+ }
104
+ if (["script", "style"].includes(node.tag.toLowerCase())) return;
105
+ const component =
106
+ node.tagType === ElementTypes.COMPONENT ? tags.get(node.tag.toLowerCase()) : undefined;
107
+ if (component) {
108
+ const props = new Map(
109
+ component.props.filter((p) => !p.eventName).map((p) => [canonical(p.name), p]),
110
+ );
111
+ const events = new Set(component.events.map((e) => canonical(e.name)));
112
+ const present = new Set();
113
+ let spread = false;
114
+ for (const attr of node.props) {
115
+ if (attr.type === NodeTypes.DIRECTIVE && attr.name === "on") {
116
+ if (!attr.arg?.isStatic) {
117
+ skipped.push("dynamic events");
118
+ continue;
119
+ }
120
+ const event = attr.arg.content;
121
+ if (!events.has(canonical(event)) && !nativeEvents.has(event.toLowerCase()))
122
+ add("event", `Unknown event ${event} on ${component.name}`, attr, {
123
+ component: component.name,
124
+ event,
125
+ });
126
+ continue;
127
+ }
128
+ let name;
129
+ let value = { known: false };
130
+ if (attr.type === NodeTypes.ATTRIBUTE) {
131
+ name = attr.name;
132
+ value = { known: true, value: attr.value?.content ?? "" };
133
+ } else if (attr.type === NodeTypes.DIRECTIVE && ["bind", "model"].includes(attr.name)) {
134
+ if ((attr.arg && !attr.arg.isStatic) || (attr.name === "bind" && !attr.arg)) {
135
+ spread = true;
136
+ skipped.push("dynamic or spread bindings");
137
+ continue;
138
+ }
139
+ name = attr.arg?.content || "modelValue";
140
+ if (attr.name === "model") {
141
+ if (!events.has(canonical(`update:${name}`)))
142
+ add("model", `No update:${name} event on ${component.name}`, attr, {
143
+ component: component.name,
144
+ prop: name,
145
+ });
146
+ } else value = literal(attr.exp?.content);
147
+ if (!value.known) skipped.push("binding expression types");
148
+ }
149
+ if (!name) continue;
150
+ present.add(canonical(name));
151
+ const prop = props.get(canonical(name));
152
+ if (!prop) {
153
+ if (!attributes.has(name.toLowerCase()) && !/^(aria-|data-)/i.test(name))
154
+ add("prop", `Unknown prop ${name} on ${component.name}`, attr, {
155
+ component: component.name,
156
+ prop: name,
157
+ });
158
+ continue;
159
+ }
160
+ if (!value.known) continue;
161
+ // Bare boolean attributes are valid; string "false" is not a false boolean.
162
+ const actual =
163
+ prop.boolean && value.value === "" && attr.type === NodeTypes.ATTRIBUTE
164
+ ? true
165
+ : value.value;
166
+ if (prop.enumValues && !prop.enumValues.includes(actual))
167
+ add(
168
+ "value",
169
+ `Invalid ${name} on ${component.name}; expected ${prop.enumValues.map((v) => JSON.stringify(v)).join(" | ")}`,
170
+ attr,
171
+ { component: component.name, prop: name },
172
+ );
173
+ else if (prop.boolean && typeof actual !== "boolean")
174
+ add("value", `${name} requires a boolean binding`, attr, {
175
+ component: component.name,
176
+ prop: name,
177
+ });
178
+ else if (/^number(?: \| undefined)?$/.test(prop.type) && typeof actual !== "number")
179
+ add("value", `${name} requires a numeric binding`, attr, {
180
+ component: component.name,
181
+ prop: name,
182
+ });
183
+ }
184
+ if (!spread)
185
+ for (const prop of props.values())
186
+ if (prop.required && !present.has(canonical(prop.name)))
187
+ add("required", `Missing required prop ${prop.name} on ${component.name}`, node, {
188
+ component: component.name,
189
+ prop: prop.name,
190
+ });
191
+ } else if (node.tagType === ElementTypes.COMPONENT)
192
+ skipped.push(`unresolved component: ${node.tag}`);
193
+ const slotOwner = node.tag === "template" ? owner : component;
194
+ for (const attr of node.props) {
195
+ if (attr.type !== NodeTypes.DIRECTIVE || attr.name !== "slot") continue;
196
+ if (!slotOwner?.behavior?.slotsComplete) {
197
+ skipped.push("slots without a complete contract");
198
+ continue;
199
+ }
200
+ if (attr.arg && !attr.arg.isStatic) {
201
+ skipped.push("dynamic slots");
202
+ continue;
203
+ }
204
+ const name = attr.arg?.content || "default";
205
+ if (!slotOwner.behavior.slots.includes(name))
206
+ add("slot", `Unknown slot ${name} on ${slotOwner.name}`, attr, {
207
+ component: slotOwner.name,
208
+ slot: name,
209
+ });
210
+ }
211
+ node.children.forEach((child) =>
212
+ visit(child, component || (node.tag === "template" ? owner : undefined)),
213
+ );
214
+ };
215
+ visit(ast);
216
+ return {
217
+ valid: issues.length === 0,
218
+ issues,
219
+ skipped: [...new Set(skipped)],
220
+ scope: "static-template",
221
+ complete: false,
222
+ nextStep:
223
+ "Run the application's vue-tsc --noEmit and interaction tests. Static checks do not validate imports, arbitrary expressions or runtime behavior.",
224
+ };
225
+ }