king-design-analyzer 2.2.0 → 2.2.1

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