king-design-analyzer 2.2.0 → 2.2.2

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 (154) hide show
  1. package/components/actions.json +8 -0
  2. package/components/advancedset.json +1 -0
  3. package/components/affix.json +1 -0
  4. package/components/anchor.json +220 -0
  5. package/components/anchorlink.json +111 -0
  6. package/components/badge.json +1 -0
  7. package/components/breadcrumb.json +2 -1
  8. package/components/button.json +1 -0
  9. package/components/buttonlink.json +1 -0
  10. package/components/card.json +6 -3
  11. package/components/cardcontent.json +5 -0
  12. package/components/cascader.json +56 -0
  13. package/components/collapse.json +335 -348
  14. package/components/configprovider.json +96 -0
  15. package/components/copyrow.json +1 -0
  16. package/components/descriptions.json +10 -3
  17. package/components/diagram.json +295 -0
  18. package/components/dialog.json +4 -0
  19. package/components/divider.json +1 -0
  20. package/components/drawer.json +32 -0
  21. package/components/dropdown.json +13 -4
  22. package/components/flex.json +1 -0
  23. package/components/form.json +12 -3
  24. package/components/header.json +4 -0
  25. package/components/input.json +8 -4
  26. package/components/layoutcontent.json +9 -0
  27. package/components/layoutlistcontent.json +9 -0
  28. package/components/layoutpermissioncontent.json +1 -0
  29. package/components/layoutstandardlist.json +1 -0
  30. package/components/lazymount.json +1 -0
  31. package/components/lazyteleport.json +1 -0
  32. package/components/menu.json +4 -3
  33. package/components/notification.json +351 -0
  34. package/components/popover.json +23 -0
  35. package/components/protable.json +2 -0
  36. package/components/rate.json +1 -0
  37. package/components/scrollselect.json +140 -0
  38. package/components/select.json +72 -0
  39. package/components/skeleton.json +1 -0
  40. package/components/slider.json +12 -2
  41. package/components/spin.json +2 -1
  42. package/components/spinner.json +422 -428
  43. package/components/split.json +3 -0
  44. package/components/switch.json +4 -2
  45. package/components/table.json +6 -1
  46. package/components/tabs.json +2 -2
  47. package/components/tag.json +8 -5
  48. package/components/timeline.json +3 -1
  49. package/components/tip.json +20 -0
  50. package/components/tooltip.json +8 -0
  51. package/components/tour.json +16 -0
  52. package/components/transfer.json +52 -5
  53. package/components/tree.json +22 -1
  54. package/components/treeselect.json +56 -0
  55. package/components/upload.json +16 -0
  56. package/components/vdialog.json +1 -0
  57. package/components/vdrawer.json +4 -0
  58. package/components/virtuallist.json +9 -0
  59. package/dist/ast/index.d.mts +30 -1
  60. package/dist/ast/index.d.ts +30 -1
  61. package/dist/ast/index.js +3 -3
  62. package/dist/ast/index.mjs +1 -1
  63. package/dist/{chunk-BI5TIQID.mjs → chunk-4OTQAQ6J.mjs} +13 -2
  64. package/dist/chunk-6HOIRUQB.mjs +409 -0
  65. package/dist/{chunk-XGPHQHLR.mjs → chunk-BSCASJTV.mjs} +27 -4
  66. package/dist/{chunk-CR3GC4H3.js → chunk-DHLWNT53.js} +13 -2
  67. package/dist/{chunk-CJGGFVQJ.js → chunk-HARQRI4F.js} +31 -8
  68. package/dist/{chunk-TA3SV4SP.js → chunk-JJ6AB4ZH.js} +2 -2
  69. package/dist/{chunk-3LYQ5XFM.mjs → chunk-NZL6T22V.mjs} +1 -1
  70. package/dist/chunk-V5N65MRP.js +411 -0
  71. package/dist/{chunk-SZYVGYKK.js → chunk-XPHDD6XR.js} +113 -35
  72. package/dist/{chunk-KMIDURUR.mjs → chunk-YRGYDK2I.mjs} +113 -35
  73. package/dist/full/index.d.mts +2 -0
  74. package/dist/full/index.d.ts +2 -0
  75. package/dist/full/index.js +6 -6
  76. package/dist/full/index.mjs +4 -4
  77. package/dist/index.js +13 -13
  78. package/dist/index.mjs +5 -5
  79. package/dist/metadata/index.d.mts +17 -2
  80. package/dist/metadata/index.d.ts +17 -2
  81. package/dist/runtime/index.d.mts +2 -0
  82. package/dist/runtime/index.d.ts +2 -0
  83. package/dist/runtime/index.js +4 -4
  84. package/dist/runtime/index.mjs +2 -2
  85. package/dist/static/index.js +5 -5
  86. package/dist/static/index.mjs +2 -2
  87. package/docs_for_llm/actions.doc.md +11 -1
  88. package/docs_for_llm/advancedset.doc.md +10 -1
  89. package/docs_for_llm/affix.doc.md +5 -0
  90. package/docs_for_llm/anchor.doc.md +155 -0
  91. package/docs_for_llm/anchorlink.doc.md +75 -0
  92. package/docs_for_llm/badge.doc.md +5 -0
  93. package/docs_for_llm/breadcrumb.doc.md +74 -1
  94. package/docs_for_llm/button.doc.md +57 -0
  95. package/docs_for_llm/buttonlink.doc.md +10 -1
  96. package/docs_for_llm/card.doc.md +50 -3
  97. package/docs_for_llm/cardcontent.doc.md +21 -0
  98. package/docs_for_llm/carousel.doc.md +71 -0
  99. package/docs_for_llm/cascader.doc.md +62 -0
  100. package/docs_for_llm/collapse.doc.md +138 -8
  101. package/docs_for_llm/configprovider.doc.md +77 -0
  102. package/docs_for_llm/copyrow.doc.md +10 -1
  103. package/docs_for_llm/datepicker.doc.md +19 -0
  104. package/docs_for_llm/descriptions.doc.md +113 -4
  105. package/docs_for_llm/diagram.doc.md +343 -0
  106. package/docs_for_llm/dialog.doc.md +49 -0
  107. package/docs_for_llm/divider.doc.md +5 -0
  108. package/docs_for_llm/drawer.doc.md +86 -0
  109. package/docs_for_llm/dropdown.doc.md +257 -3
  110. package/docs_for_llm/flex.doc.md +10 -1
  111. package/docs_for_llm/form.doc.md +163 -4
  112. package/docs_for_llm/formitemspinner.doc.md +1 -1
  113. package/docs_for_llm/grid.doc.md +71 -0
  114. package/docs_for_llm/header.doc.md +33 -4
  115. package/docs_for_llm/input.doc.md +109 -2
  116. package/docs_for_llm/layoutcontent.doc.md +37 -0
  117. package/docs_for_llm/layoutlistcontent.doc.md +82 -9
  118. package/docs_for_llm/layoutpermissioncontent.doc.md +10 -1
  119. package/docs_for_llm/layoutstandardlist.doc.md +10 -1
  120. package/docs_for_llm/lazymount.doc.md +10 -1
  121. package/docs_for_llm/lazyteleport.doc.md +10 -1
  122. package/docs_for_llm/menu.doc.md +125 -3
  123. package/docs_for_llm/message.doc.md +45 -0
  124. package/docs_for_llm/notification.doc.md +214 -0
  125. package/docs_for_llm/popover.doc.md +34 -0
  126. package/docs_for_llm/protable.doc.md +9 -0
  127. package/docs_for_llm/rate.doc.md +5 -0
  128. package/docs_for_llm/scrollselect.doc.md +90 -0
  129. package/docs_for_llm/select.doc.md +189 -0
  130. package/docs_for_llm/skeleton.doc.md +35 -0
  131. package/docs_for_llm/slider.doc.md +11 -1
  132. package/docs_for_llm/spin.doc.md +10 -1
  133. package/docs_for_llm/spinner.doc.md +1 -1
  134. package/docs_for_llm/split.doc.md +13 -0
  135. package/docs_for_llm/steps.doc.md +71 -0
  136. package/docs_for_llm/switch.doc.md +15 -2
  137. package/docs_for_llm/table.doc.md +199 -4
  138. package/docs_for_llm/tabs.doc.md +98 -2
  139. package/docs_for_llm/tag.doc.md +148 -5
  140. package/docs_for_llm/timeline.doc.md +80 -2
  141. package/docs_for_llm/timepicker.doc.md +19 -0
  142. package/docs_for_llm/tip.doc.md +30 -0
  143. package/docs_for_llm/tooltip.doc.md +46 -0
  144. package/docs_for_llm/tour.doc.md +102 -0
  145. package/docs_for_llm/transfer.doc.md +59 -4
  146. package/docs_for_llm/tree.doc.md +64 -1
  147. package/docs_for_llm/treeselect.doc.md +68 -0
  148. package/docs_for_llm/upload.doc.md +28 -0
  149. package/docs_for_llm/vdialog.doc.md +26 -1
  150. package/docs_for_llm/vdrawer.doc.md +33 -4
  151. package/docs_for_llm/virtuallist.doc.md +165 -0
  152. package/package.json +3 -3
  153. package/dist/chunk-D2SXGGTX.mjs +0 -162
  154. package/dist/chunk-EYKZY2F3.js +0 -164
@@ -0,0 +1,411 @@
1
+ 'use strict';
2
+
3
+ var chunkDHLWNT53_js = require('./chunk-DHLWNT53.js');
4
+
5
+ // src/runtime/index.ts
6
+ var scopeIdCounter = 0;
7
+ var ENVIRONMENT_SENSITIVE_IDENTIFIERS = [
8
+ "window",
9
+ "document",
10
+ "location",
11
+ "navigator"
12
+ ];
13
+ var ENVIRONMENT_SENSITIVE_CALLS = [
14
+ "getCurrentInstance",
15
+ "useRouter",
16
+ "useRoute",
17
+ "onBeforeRouteLeave",
18
+ "onBeforeRouteUpdate"
19
+ ];
20
+ function createMockProxy(path) {
21
+ const target = function mockTarget() {
22
+ };
23
+ return new Proxy(target, {
24
+ get: (_target, prop, receiver) => {
25
+ const existing = Reflect.get(target, prop, receiver);
26
+ if (existing !== void 0) return existing;
27
+ if (prop === Symbol.toPrimitive) return () => 0;
28
+ if (prop === "then") return void 0;
29
+ if (prop === "toString") return () => `[MockProxy ${path}]`;
30
+ if (prop === "valueOf") return () => 0;
31
+ if (prop === "__path") return path;
32
+ return createMockProxy(`${path}.${String(prop)}`);
33
+ },
34
+ apply: () => createMockProxy(`${path}()`),
35
+ construct: () => createMockProxy(`new ${path}()`),
36
+ has: (_target, prop) => Reflect.has(target, prop),
37
+ set: (_target, prop, value, receiver) => Reflect.set(target, prop, value, receiver)
38
+ });
39
+ }
40
+ function createWhitelistedModule(source, context) {
41
+ if (source === "vue" || source.startsWith("@vue/")) {
42
+ return context;
43
+ }
44
+ if (source === "vue-router") {
45
+ return context.__mockVueRouter;
46
+ }
47
+ return new Proxy({}, {
48
+ get: (_target, prop) => {
49
+ if (prop === "default") return createMockProxy(source);
50
+ if (typeof prop === "string" && prop in context) {
51
+ return context[prop];
52
+ }
53
+ return createMockProxy(`${source}.${String(prop)}`);
54
+ }
55
+ });
56
+ }
57
+ function createMockElement(path) {
58
+ const element = createMockProxy(path);
59
+ element.style = {};
60
+ element.classList = {
61
+ add: () => {
62
+ },
63
+ remove: () => {
64
+ },
65
+ contains: () => false
66
+ };
67
+ element.dataset = {};
68
+ element.getBoundingClientRect = () => ({
69
+ x: 0,
70
+ y: 0,
71
+ top: 0,
72
+ left: 0,
73
+ right: 0,
74
+ bottom: 0,
75
+ width: 0,
76
+ height: 0
77
+ });
78
+ return element;
79
+ }
80
+ var MOCK_LOCATION = {
81
+ href: "https://mock.local/",
82
+ pathname: "/",
83
+ search: "",
84
+ hash: "",
85
+ origin: "https://mock.local",
86
+ host: "mock.local",
87
+ hostname: "mock.local",
88
+ port: "",
89
+ protocol: "https:",
90
+ assign: () => {
91
+ },
92
+ replace: () => {
93
+ },
94
+ reload: () => {
95
+ }
96
+ };
97
+ var MOCK_NAVIGATOR = {
98
+ userAgent: "king-design-analyzer-runtime-mock",
99
+ language: "zh-CN",
100
+ languages: ["zh-CN"],
101
+ clipboard: {
102
+ writeText: async () => {
103
+ },
104
+ readText: async () => ""
105
+ }
106
+ };
107
+ var MOCK_DOCUMENT = {
108
+ body: createMockElement("document.body"),
109
+ head: createMockElement("document.head"),
110
+ documentElement: createMockElement("document.documentElement"),
111
+ createElement: (_tag) => createMockElement("document.createElement()"),
112
+ createTextNode: (_text) => createMockElement("document.createTextNode()"),
113
+ getElementById: (_id) => createMockElement("document.getElementById()"),
114
+ querySelector: (_selector) => createMockElement("document.querySelector()"),
115
+ querySelectorAll: () => [],
116
+ addEventListener: () => {
117
+ },
118
+ removeEventListener: () => {
119
+ }
120
+ };
121
+ var MOCK_WINDOW = {
122
+ document: MOCK_DOCUMENT,
123
+ navigator: MOCK_NAVIGATOR,
124
+ location: MOCK_LOCATION,
125
+ innerWidth: 1440,
126
+ innerHeight: 900,
127
+ addEventListener: () => {
128
+ },
129
+ removeEventListener: () => {
130
+ },
131
+ matchMedia: () => ({
132
+ matches: false,
133
+ media: "",
134
+ onchange: null,
135
+ addListener: () => {
136
+ },
137
+ removeListener: () => {
138
+ },
139
+ addEventListener: () => {
140
+ },
141
+ removeEventListener: () => {
142
+ },
143
+ dispatchEvent: () => false
144
+ }),
145
+ requestAnimationFrame: (cb) => {
146
+ cb(0);
147
+ return 0;
148
+ },
149
+ cancelAnimationFrame: () => {
150
+ },
151
+ setTimeout,
152
+ clearTimeout,
153
+ setInterval,
154
+ clearInterval,
155
+ open: () => createMockProxy("window.open()")
156
+ };
157
+ var MOCK_ROUTE = {
158
+ path: "/",
159
+ name: void 0,
160
+ fullPath: "/",
161
+ params: {},
162
+ query: {},
163
+ hash: "",
164
+ meta: {},
165
+ matched: []
166
+ };
167
+ var MOCK_ROUTER = {
168
+ currentRoute: { value: MOCK_ROUTE },
169
+ push: async () => void 0,
170
+ replace: async () => void 0,
171
+ back: () => {
172
+ },
173
+ go: () => {
174
+ },
175
+ forward: () => {
176
+ },
177
+ beforeEach: () => () => {
178
+ },
179
+ afterEach: () => () => {
180
+ }
181
+ };
182
+ function detectEnvironmentSensitivity(code, strippedImports = []) {
183
+ const warnings = [];
184
+ let status = "passed";
185
+ for (const identifier of ENVIRONMENT_SENSITIVE_IDENTIFIERS) {
186
+ if (new RegExp(`\\b${identifier}\\b`).test(code)) {
187
+ warnings.push(`\u68C0\u6D4B\u5230\u6D4F\u89C8\u5668\u73AF\u5883\u5BF9\u8C61 ${identifier}\uFF0C\u8FD0\u884C\u65F6\u7ED3\u679C\u4F9D\u8D56\u5BBF\u4E3B\u73AF\u5883 mock\u3002`);
188
+ status = "env_dependent";
189
+ }
190
+ }
191
+ for (const callee of ENVIRONMENT_SENSITIVE_CALLS) {
192
+ if (new RegExp(`\\b${callee}\\s*\\(`).test(code)) {
193
+ warnings.push(`\u68C0\u6D4B\u5230\u73AF\u5883\u654F\u611F\u8C03\u7528 ${callee}()\uFF0C\u8FD0\u884C\u65F6\u7ED3\u679C\u4F9D\u8D56 mock\u3002`);
194
+ status = "env_dependent";
195
+ }
196
+ }
197
+ const skippedImports = strippedImports.filter(
198
+ (item) => item.reason === "unknown" && !item.source.startsWith(".")
199
+ );
200
+ if (skippedImports.length > 0) {
201
+ status = "runtime_skipped";
202
+ warnings.push(
203
+ `\u68C0\u6D4B\u5230\u7B2C\u4E09\u65B9\u5BFC\u5165 ${skippedImports.map((item) => item.source).join(", ")}\uFF0C\u5DF2\u4F7F\u7528\u6A21\u5757 mock\uFF0C\u8FD0\u884C\u65F6\u7ED3\u679C\u4EC5\u4F9B\u53C2\u8003\u3002`
204
+ );
205
+ }
206
+ return { status, warnings };
207
+ }
208
+ function isEnvironmentRelatedRuntimeError(message) {
209
+ return /(window|document|location|navigator|getCurrentInstance|useRouter|useRoute|route|router)/i.test(message);
210
+ }
211
+ var MOCK_VUE_CONTEXT = {
212
+ // Reactivity
213
+ ref: (v) => ({ value: v }),
214
+ reactive: (v) => v,
215
+ computed: (fn) => ({ value: typeof fn === "function" ? fn() : fn }),
216
+ readonly: (v) => v,
217
+ shallowRef: (v) => ({ value: v }),
218
+ shallowReactive: (v) => v,
219
+ toRef: () => ({ value: void 0 }),
220
+ toRefs: (obj) => Object.fromEntries(
221
+ Object.keys(obj || {}).map((k) => [k, { value: obj[k] }])
222
+ ),
223
+ toRaw: (v) => v,
224
+ markRaw: (v) => v,
225
+ isRef: () => false,
226
+ isReactive: () => false,
227
+ isReadonly: () => false,
228
+ isProxy: () => false,
229
+ triggerRef: () => {
230
+ },
231
+ customRef: (factory) => factory(() => {
232
+ }, () => {
233
+ }),
234
+ // Lifecycle
235
+ onMounted: () => {
236
+ },
237
+ onUnmounted: () => {
238
+ },
239
+ onBeforeMount: () => {
240
+ },
241
+ onBeforeUnmount: () => {
242
+ },
243
+ onUpdated: () => {
244
+ },
245
+ onBeforeUpdate: () => {
246
+ },
247
+ onActivated: () => {
248
+ },
249
+ onDeactivated: () => {
250
+ },
251
+ onErrorCaptured: () => {
252
+ },
253
+ // Watchers
254
+ watch: () => () => {
255
+ },
256
+ watchEffect: () => () => {
257
+ },
258
+ watchPostEffect: () => () => {
259
+ },
260
+ watchSyncEffect: () => () => {
261
+ },
262
+ // Composition API
263
+ defineProps: () => ({}),
264
+ defineEmits: () => () => {
265
+ },
266
+ defineExpose: () => {
267
+ },
268
+ defineOptions: () => {
269
+ },
270
+ defineSlots: () => ({}),
271
+ defineModel: () => ({ value: void 0 }),
272
+ withDefaults: (_props, defaults) => defaults,
273
+ useSlots: () => ({}),
274
+ useAttrs: () => ({}),
275
+ // Dependency Injection
276
+ inject: () => void 0,
277
+ provide: () => {
278
+ },
279
+ // Utilities
280
+ nextTick: () => Promise.resolve(),
281
+ getCurrentInstance: () => ({
282
+ proxy: createMockProxy("instance.proxy"),
283
+ appContext: createMockProxy("instance.appContext"),
284
+ emit: () => {
285
+ },
286
+ attrs: {},
287
+ slots: {}
288
+ }),
289
+ h: () => ({}),
290
+ createVNode: () => ({}),
291
+ resolveComponent: () => ({}),
292
+ // Browser-ish globals
293
+ window: MOCK_WINDOW,
294
+ document: MOCK_DOCUMENT,
295
+ location: MOCK_LOCATION,
296
+ navigator: MOCK_NAVIGATOR,
297
+ self: MOCK_WINDOW,
298
+ globalThis: MOCK_WINDOW,
299
+ // vue-router
300
+ useRouter: () => MOCK_ROUTER,
301
+ useRoute: () => MOCK_ROUTE,
302
+ onBeforeRouteLeave: () => {
303
+ },
304
+ onBeforeRouteUpdate: () => {
305
+ },
306
+ RouterLink: createMockProxy("vue-router.RouterLink"),
307
+ RouterView: createMockProxy("vue-router.RouterView"),
308
+ __mockVueRouter: {
309
+ useRouter: () => MOCK_ROUTER,
310
+ useRoute: () => MOCK_ROUTE,
311
+ onBeforeRouteLeave: () => {
312
+ },
313
+ onBeforeRouteUpdate: () => {
314
+ },
315
+ RouterLink: createMockProxy("vue-router.RouterLink"),
316
+ RouterView: createMockProxy("vue-router.RouterView"),
317
+ createRouter: () => createMockProxy("vue-router.createRouter()"),
318
+ createWebHistory: () => createMockProxy("vue-router.createWebHistory()"),
319
+ createWebHashHistory: () => createMockProxy("vue-router.createWebHashHistory()")
320
+ },
321
+ // =========================================================================
322
+ // @ksyun-internal/versatile Hooks
323
+ // =========================================================================
324
+ useToState: (_props, _key, _emit, defaultValue) => ({ value: defaultValue ?? void 0 }),
325
+ useIdEntity: () => ({ value: void 0 }),
326
+ // =========================================================================
327
+ // Module Mocking
328
+ // =========================================================================
329
+ __mockModule: (modulePath) => createMockProxy(modulePath),
330
+ __getWhitelistedModule: (source) => createWhitelistedModule(source, MOCK_VUE_CONTEXT)
331
+ };
332
+ function validateRuntimePrecheck(code) {
333
+ const scopeId = `runtime-${Date.now()}-${++scopeIdCounter}`;
334
+ const { script, bindings, strippedImports, error } = chunkDHLWNT53_js.compileSFC(code, scopeId);
335
+ if (error) {
336
+ return {
337
+ name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
338
+ passed: false,
339
+ status: "failed",
340
+ errors: [error]
341
+ };
342
+ }
343
+ const sensitivity = detectEnvironmentSensitivity(code, strippedImports);
344
+ try {
345
+ const funcBody = `
346
+ "use strict";
347
+ ${script}
348
+ return { ${bindings.join(", ")} };
349
+ `;
350
+ const keys = Object.keys(MOCK_VUE_CONTEXT);
351
+ const values = Object.values(MOCK_VUE_CONTEXT);
352
+ const runner = new Function(...keys, funcBody);
353
+ const result = runner(...values);
354
+ const missingBindings = bindings.filter((binding) => !(binding in result));
355
+ if (missingBindings.length > 0) {
356
+ return {
357
+ name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
358
+ passed: false,
359
+ status: "failed",
360
+ errors: missingBindings.map((b) => `\u53D8\u91CF ${b} \u672A\u6B63\u786E\u5BFC\u51FA`),
361
+ warnings: sensitivity.warnings.length > 0 ? sensitivity.warnings : void 0
362
+ };
363
+ }
364
+ return {
365
+ name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
366
+ passed: true,
367
+ status: sensitivity.status,
368
+ errors: [],
369
+ warnings: sensitivity.warnings.length > 0 ? sensitivity.warnings : void 0
370
+ };
371
+ } catch (e) {
372
+ const errorMessage = e.message || String(e);
373
+ const errorLocation = e.stack?.split("\n")[1]?.trim() || "";
374
+ if (sensitivity.status === "runtime_skipped") {
375
+ return {
376
+ name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
377
+ passed: true,
378
+ status: "runtime_skipped",
379
+ errors: [],
380
+ warnings: [
381
+ ...sensitivity.warnings,
382
+ `\u8FD0\u884C\u65F6\u6267\u884C\u5DF2\u8DF3\u8FC7\u4E25\u683C\u5224\u5B9A: ${errorMessage}`
383
+ ]
384
+ };
385
+ }
386
+ if (sensitivity.status === "env_dependent" && isEnvironmentRelatedRuntimeError(errorMessage)) {
387
+ return {
388
+ name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
389
+ passed: true,
390
+ status: "env_dependent",
391
+ errors: [],
392
+ warnings: [
393
+ ...sensitivity.warnings,
394
+ `\u8FD0\u884C\u65F6\u6267\u884C\u53D7\u5BBF\u4E3B\u73AF\u5883\u5F71\u54CD: ${errorMessage}`
395
+ ]
396
+ };
397
+ }
398
+ return {
399
+ name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
400
+ passed: false,
401
+ status: "failed",
402
+ errors: [
403
+ `JavaScript \u6267\u884C\u9519\u8BEF: ${errorMessage}`,
404
+ ...errorLocation ? [`\u4F4D\u7F6E: ${errorLocation}`] : []
405
+ ],
406
+ warnings: sensitivity.warnings.length > 0 ? sensitivity.warnings : void 0
407
+ };
408
+ }
409
+ }
410
+
411
+ exports.validateRuntimePrecheck = validateRuntimePrecheck;
@@ -32269,7 +32269,14 @@ var ComponentRegistry = class {
32269
32269
  newComponents.set(resolvedData.name, resolvedData);
32270
32270
  if (resolvedData.subComponents) {
32271
32271
  for (const sub of resolvedData.subComponents) {
32272
- newComponents.set(sub.name, sub);
32272
+ newComponents.set(sub.name, {
32273
+ id: sub.name,
32274
+ name: sub.name,
32275
+ props: sub.props || [],
32276
+ events: sub.events || [],
32277
+ slots: sub.slots || [],
32278
+ methods: sub.methods || []
32279
+ });
32273
32280
  }
32274
32281
  }
32275
32282
  }
@@ -33085,23 +33092,7 @@ function checkNestingRules(tagName, metadata, ancestors, violations) {
33085
33092
  });
33086
33093
  }
33087
33094
  }
33088
- function checkComponentSpecificRules(tagName, node, violations) {
33089
- if (tagName === "Dropdown") {
33090
- node.children?.forEach((child) => {
33091
- if (child.type === 1 && child.tag === "template") {
33092
- const slotProp = child.props?.find(
33093
- (p) => p.type === 7 && p.name === "slot" && p.arg?.content === "menu"
33094
- );
33095
- if (slotProp) {
33096
- violations.push({
33097
- rule: "DropdownMenu \u4E0D\u80FD\u653E\u5728 #menu \u63D2\u69FD\u4E2D",
33098
- match: "<template #menu>",
33099
- suggestion: "\u8BF7\u79FB\u9664 <template #menu>\uFF0C\u5C06 DropdownMenu \u76F4\u63A5\u4F5C\u4E3A Dropdown \u7684\u7B2C\u4E8C\u4E2A\u5B50\u5143\u7D20"
33100
- });
33101
- }
33102
- }
33103
- });
33104
- }
33095
+ function checkComponentSpecificRules(tagName, node, metadata, violations) {
33105
33096
  if (tagName === "Table") {
33106
33097
  node.props.forEach((prop) => {
33107
33098
  if (prop.type === 6 && (prop.name === "rowKey" || prop.name === "row-key")) {
@@ -33124,23 +33115,110 @@ function checkComponentSpecificRules(tagName, node, violations) {
33124
33115
  }
33125
33116
  });
33126
33117
  }
33127
- if (tagName === "TableColumn") {
33128
- node.children?.forEach((child) => {
33129
- if (child.type === 1 && child.tag === "template") {
33130
- const slotProp = child.props?.find((p) => p.type === 7 && p.name === "slot");
33131
- if (slotProp && slotProp.exp && slotProp.exp.content) {
33132
- const exp = slotProp.exp.content.trim();
33133
- if (exp.startsWith("{") && exp.endsWith("}")) {
33134
- violations.push({
33135
- rule: "TableColumn \u63D2\u69FD\u53C2\u6570\u5E94\u4E3A\u6570\u7EC4\u7ED3\u6784",
33136
- match: exp,
33137
- suggestion: `King Design \u8868\u683C\u63D2\u69FD\u53C2\u6570\u4E3A\u6570\u7EC4\u987A\u5E8F\u4F20\u9012\uFF0C\u8BF7\u5C06 ${exp} \u6539\u4E3A [row]`
33138
- });
33139
- }
33140
- }
33141
- }
33142
- });
33118
+ if (!metadata?.slots?.length) {
33119
+ return;
33120
+ }
33121
+ const validateSlotBinding = (slotName, expression) => {
33122
+ if (!expression) return;
33123
+ const slot = metadata.slots.find((item) => item.name === slotName);
33124
+ if (!slot) return;
33125
+ const exp = expression.trim();
33126
+ const bindingType = resolveSlotBindingType(slot);
33127
+ if (!bindingType) return;
33128
+ if (bindingType === "none") {
33129
+ violations.push({
33130
+ rule: `${tagName} \u63D2\u69FD #${slotName} \u4E0D\u63D0\u4F9B\u53C2\u6570`,
33131
+ match: exp,
33132
+ suggestion: `\u8BF7\u79FB\u9664 ${slotName} \u63D2\u69FD\u4E0A\u7684\u53C2\u6570\u58F0\u660E`
33133
+ });
33134
+ return;
33135
+ }
33136
+ if (bindingType === "array" && isObjectDestructuringExpression(exp)) {
33137
+ violations.push({
33138
+ rule: `${tagName} \u63D2\u69FD\u53C2\u6570\u5E94\u4E3A\u6570\u7EC4\u7ED3\u6784`,
33139
+ match: exp,
33140
+ suggestion: `\u8BF7\u5C06 ${exp} \u6539\u4E3A ${getSlotBindingExample(slot, "array")}`
33141
+ });
33142
+ return;
33143
+ }
33144
+ if (bindingType === "object" && isArrayDestructuringExpression(exp)) {
33145
+ violations.push({
33146
+ rule: `${tagName} \u63D2\u69FD\u53C2\u6570\u5E94\u4E3A\u5BF9\u8C61\u7ED3\u6784`,
33147
+ match: exp,
33148
+ suggestion: `\u8BF7\u5C06 ${exp} \u6539\u4E3A ${getSlotBindingExample(slot, "object")}`
33149
+ });
33150
+ return;
33151
+ }
33152
+ if (bindingType === "single" && (isArrayDestructuringExpression(exp) || isObjectDestructuringExpression(exp))) {
33153
+ violations.push({
33154
+ rule: `${tagName} \u63D2\u69FD\u53C2\u6570\u5E94\u4E3A\u5355\u503C\u7ED3\u6784`,
33155
+ match: exp,
33156
+ suggestion: `\u8BF7\u5C06 ${exp} \u6539\u4E3A ${getSlotBindingExample(slot, "single")}`
33157
+ });
33158
+ }
33159
+ };
33160
+ node.props.forEach((prop) => {
33161
+ if (prop.type !== 7 || prop.name !== "slot") return;
33162
+ validateSlotBinding(slotNameFromVSlotDirective(prop), getDirectiveExpressionContent(prop.exp));
33163
+ });
33164
+ node.children?.forEach((child) => {
33165
+ if (child.type !== 1 || child.tag !== "template") return;
33166
+ const slotProp = child.props?.find((p) => p.type === 7 && p.name === "slot");
33167
+ if (!slotProp) return;
33168
+ validateSlotBinding(slotNameFromVSlotDirective(slotProp), getDirectiveExpressionContent(slotProp.exp));
33169
+ });
33170
+ }
33171
+ function isArrayDestructuringExpression(expression) {
33172
+ return expression.startsWith("[") && expression.endsWith("]");
33173
+ }
33174
+ function isObjectDestructuringExpression(expression) {
33175
+ return expression.startsWith("{") && expression.endsWith("}");
33176
+ }
33177
+ function extractBindingExpressionFromVueTemplate(vueTemplate) {
33178
+ if (!vueTemplate) return void 0;
33179
+ const match = vueTemplate.match(/=\s*"([^"]+)"/);
33180
+ return match?.[1]?.trim();
33181
+ }
33182
+ function getDirectiveExpressionContent(exp) {
33183
+ if (!exp || !("content" in exp)) return void 0;
33184
+ return typeof exp.content === "string" ? exp.content : void 0;
33185
+ }
33186
+ function resolveSlotBindingType(slot) {
33187
+ if (slot.bindingType) {
33188
+ return slot.bindingType;
33189
+ }
33190
+ const templateExpression = extractBindingExpressionFromVueTemplate(slot.vueTemplate);
33191
+ if (templateExpression) {
33192
+ if (isArrayDestructuringExpression(templateExpression)) return "array";
33193
+ if (isObjectDestructuringExpression(templateExpression)) return "object";
33194
+ }
33195
+ const destructuringExample = slot.slotProps?.find((prop) => prop.destructuringExample)?.destructuringExample?.trim();
33196
+ if (destructuringExample) {
33197
+ if (isArrayDestructuringExpression(destructuringExample)) return "array";
33198
+ if (isObjectDestructuringExpression(destructuringExample)) return "object";
33199
+ }
33200
+ return void 0;
33201
+ }
33202
+ function getSlotBindingExample(slot, fallbackType) {
33203
+ const templateExpression = extractBindingExpressionFromVueTemplate(slot.vueTemplate);
33204
+ if (templateExpression) {
33205
+ return templateExpression;
33206
+ }
33207
+ const destructuringExample = slot.slotProps?.find((prop) => prop.destructuringExample)?.destructuringExample?.trim();
33208
+ if (destructuringExample) {
33209
+ return destructuringExample;
33210
+ }
33211
+ const paramNames = slot.slotProps?.map((prop) => prop.name).filter(Boolean) || [];
33212
+ if (paramNames.length > 0) {
33213
+ if (fallbackType === "single") {
33214
+ return paramNames[0];
33215
+ }
33216
+ return fallbackType === "array" ? `[${paramNames.join(", ")}]` : `{ ${paramNames.join(", ")} }`;
33217
+ }
33218
+ if (fallbackType === "single") {
33219
+ return "slotProp";
33143
33220
  }
33221
+ return fallbackType === "array" ? "[slotProps]" : "{ slotProps }";
33144
33222
  }
33145
33223
  function typeRawAllowsNumber(typeRaw) {
33146
33224
  if (!typeRaw) return false;
@@ -33306,7 +33384,7 @@ function checkTemplate(node, violations, ancestors) {
33306
33384
  if (metadata) {
33307
33385
  checkNestingRules(displayTag, metadata, ancestors, violations);
33308
33386
  }
33309
- checkComponentSpecificRules(displayTag, elementNode, violations);
33387
+ checkComponentSpecificRules(displayTag, elementNode, metadata, violations);
33310
33388
  if (metadata) {
33311
33389
  checkProps(displayTag, elementNode, metadata, violations);
33312
33390
  checkEvents(displayTag, elementNode, metadata, violations);