solely 0.7.0 → 0.8.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 (347) hide show
  1. package/README.md +46 -4
  2. package/dist/compiler/index.d.ts +2 -2
  3. package/dist/compiler/ir/buildIR.d.ts +1 -1
  4. package/dist/compiler/ir/index.d.ts +1 -1
  5. package/dist/compiler/parser/index.d.ts +1 -1
  6. package/dist/compiler/parser/parser.d.ts +1 -1
  7. package/dist/components/commands/drawer/index.cjs +1 -1
  8. package/dist/components/commands/drawer/index.d.ts +1 -1
  9. package/dist/components/commands/drawer/index.js +1 -1
  10. package/dist/components/commands/drawer/style.css.cjs +1 -1
  11. package/dist/components/commands/drawer/style.css.js +1 -1
  12. package/dist/components/commands/index.d.ts +12 -12
  13. package/dist/components/commands/message/index.cjs +1 -1
  14. package/dist/components/commands/message/index.d.ts +1 -1
  15. package/dist/components/commands/message/index.js +1 -1
  16. package/dist/components/commands/message/style.css.cjs +1 -1
  17. package/dist/components/commands/message/style.css.js +1 -1
  18. package/dist/components/commands/message/types.d.ts +1 -1
  19. package/dist/components/commands/modal/index.cjs +1 -1
  20. package/dist/components/commands/modal/index.d.ts +1 -1
  21. package/dist/components/commands/modal/index.js +1 -1
  22. package/dist/components/commands/modal/style.css.cjs +1 -1
  23. package/dist/components/commands/modal/style.css.js +1 -1
  24. package/dist/components/commands/modal/types.d.ts +8 -3
  25. package/dist/components/commands/popconfirm/index.cjs +1 -1
  26. package/dist/components/commands/popconfirm/index.d.ts +1 -1
  27. package/dist/components/commands/popconfirm/index.js +1 -1
  28. package/dist/components/commands/popconfirm/style.css.cjs +1 -1
  29. package/dist/components/commands/popconfirm/style.css.js +1 -1
  30. package/dist/components/commands/popconfirm/types.d.ts +10 -3
  31. package/dist/components/commands/tooltip/index.cjs +1 -1
  32. package/dist/components/commands/tooltip/index.d.ts +1 -1
  33. package/dist/components/commands/tooltip/index.js +1 -1
  34. package/dist/components/commands/tooltip/style.css.cjs +1 -1
  35. package/dist/components/commands/tooltip/style.css.js +1 -1
  36. package/dist/components/commands/tooltip/types.d.ts +1 -3
  37. package/dist/components/commands/utils.cjs +1 -1
  38. package/dist/components/commands/utils.d.ts +11 -0
  39. package/dist/components/commands/utils.js +1 -1
  40. package/dist/components/elements/alert/index.cjs +1 -1
  41. package/dist/components/elements/alert/index.d.ts +68 -6
  42. package/dist/components/elements/alert/index.html.cjs +1 -1
  43. package/dist/components/elements/alert/index.html.js +1 -1
  44. package/dist/components/elements/alert/index.js +1 -1
  45. package/dist/components/elements/alert/style.css.cjs +1 -1
  46. package/dist/components/elements/alert/style.css.js +1 -1
  47. package/dist/components/elements/alert/types.d.ts +5 -1
  48. package/dist/components/elements/backtop/index.cjs +1 -1
  49. package/dist/components/elements/backtop/index.d.ts +14 -2
  50. package/dist/components/elements/backtop/index.html.cjs +1 -1
  51. package/dist/components/elements/backtop/index.html.js +1 -1
  52. package/dist/components/elements/backtop/index.js +1 -1
  53. package/dist/components/elements/backtop/style.css.cjs +1 -1
  54. package/dist/components/elements/backtop/style.css.js +1 -1
  55. package/dist/components/elements/badge/index.cjs +1 -1
  56. package/dist/components/elements/badge/index.d.ts +12 -6
  57. package/dist/components/elements/badge/index.html.cjs +1 -1
  58. package/dist/components/elements/badge/index.html.js +1 -1
  59. package/dist/components/elements/badge/index.js +1 -1
  60. package/dist/components/elements/badge/types.d.ts +2 -4
  61. package/dist/components/elements/breadcrumb/index.cjs +1 -1
  62. package/dist/components/elements/breadcrumb/index.d.ts +13 -3
  63. package/dist/components/elements/breadcrumb/index.html.cjs +1 -1
  64. package/dist/components/elements/breadcrumb/index.html.js +1 -1
  65. package/dist/components/elements/breadcrumb/index.js +1 -1
  66. package/dist/components/elements/breadcrumb/style.css.cjs +1 -1
  67. package/dist/components/elements/breadcrumb/style.css.js +1 -1
  68. package/dist/components/elements/breadcrumb/types.d.ts +2 -0
  69. package/dist/components/elements/button/index.cjs +1 -1
  70. package/dist/components/elements/button/index.d.ts +14 -2
  71. package/dist/components/elements/button/index.html.cjs +1 -1
  72. package/dist/components/elements/button/index.html.js +1 -1
  73. package/dist/components/elements/button/index.js +1 -1
  74. package/dist/components/elements/button/style.css.cjs +1 -1
  75. package/dist/components/elements/button/style.css.js +1 -1
  76. package/dist/components/elements/button/types.d.ts +4 -0
  77. package/dist/components/elements/card/index.cjs +1 -1
  78. package/dist/components/elements/card/index.d.ts +22 -2
  79. package/dist/components/elements/card/index.html.cjs +1 -1
  80. package/dist/components/elements/card/index.html.js +1 -1
  81. package/dist/components/elements/card/index.js +1 -1
  82. package/dist/components/elements/card/style.css.cjs +1 -1
  83. package/dist/components/elements/card/style.css.js +1 -1
  84. package/dist/components/elements/card/types.d.ts +4 -2
  85. package/dist/components/elements/checkbox/index.cjs +1 -1
  86. package/dist/components/elements/checkbox/index.d.ts +56 -3
  87. package/dist/components/elements/checkbox/index.html.cjs +1 -1
  88. package/dist/components/elements/checkbox/index.html.js +1 -1
  89. package/dist/components/elements/checkbox/index.js +1 -1
  90. package/dist/components/elements/checkbox/style.css.cjs +1 -1
  91. package/dist/components/elements/checkbox/style.css.js +1 -1
  92. package/dist/components/elements/checkbox/types.d.ts +10 -0
  93. package/dist/components/elements/coordinate-input/index.cjs +1 -1
  94. package/dist/components/elements/coordinate-input/index.d.ts +27 -2
  95. package/dist/components/elements/coordinate-input/index.html.cjs +1 -1
  96. package/dist/components/elements/coordinate-input/index.html.js +1 -1
  97. package/dist/components/elements/coordinate-input/index.js +1 -1
  98. package/dist/components/elements/coordinate-input/style.css.cjs +1 -1
  99. package/dist/components/elements/coordinate-input/style.css.js +1 -1
  100. package/dist/components/elements/coordinate-input/types.d.ts +4 -4
  101. package/dist/components/elements/divider/index.cjs +1 -1
  102. package/dist/components/elements/divider/index.d.ts +11 -2
  103. package/dist/components/elements/divider/index.js +1 -1
  104. package/dist/components/elements/empty/index.cjs +1 -1
  105. package/dist/components/elements/empty/index.d.ts +14 -2
  106. package/dist/components/elements/empty/index.html.cjs +1 -1
  107. package/dist/components/elements/empty/index.html.js +1 -1
  108. package/dist/components/elements/empty/index.js +1 -1
  109. package/dist/components/elements/empty/style.css.cjs +1 -1
  110. package/dist/components/elements/empty/style.css.js +1 -1
  111. package/dist/components/elements/empty/types.d.ts +4 -2
  112. package/dist/components/elements/fab/index.cjs +1 -1
  113. package/dist/components/elements/fab/index.d.ts +12 -3
  114. package/dist/components/elements/fab/index.html.cjs +1 -1
  115. package/dist/components/elements/fab/index.html.js +1 -1
  116. package/dist/components/elements/fab/index.js +1 -1
  117. package/dist/components/elements/fab/style.css.cjs +1 -1
  118. package/dist/components/elements/fab/style.css.js +1 -1
  119. package/dist/components/elements/icon/index.cjs +1 -1
  120. package/dist/components/elements/icon/index.d.ts +23 -2
  121. package/dist/components/elements/icon/index.js +1 -1
  122. package/dist/components/elements/icon/style.css.cjs +1 -1
  123. package/dist/components/elements/icon/style.css.js +1 -1
  124. package/dist/components/elements/index.cjs +1 -1
  125. package/dist/components/elements/index.d.ts +61 -60
  126. package/dist/components/elements/index.js +1 -1
  127. package/dist/components/elements/input/index.cjs +1 -1
  128. package/dist/components/elements/input/index.d.ts +120 -5
  129. package/dist/components/elements/input/index.html.cjs +1 -1
  130. package/dist/components/elements/input/index.html.js +1 -1
  131. package/dist/components/elements/input/index.js +1 -1
  132. package/dist/components/elements/input/style.css.cjs +1 -1
  133. package/dist/components/elements/input/style.css.js +1 -1
  134. package/dist/components/elements/input/types.d.ts +46 -7
  135. package/dist/components/elements/not-found/index.cjs +1 -1
  136. package/dist/components/elements/not-found/index.d.ts +38 -2
  137. package/dist/components/elements/not-found/index.html.cjs +1 -1
  138. package/dist/components/elements/not-found/index.html.js +1 -1
  139. package/dist/components/elements/not-found/index.js +1 -1
  140. package/dist/components/elements/not-found/style.css.cjs +1 -1
  141. package/dist/components/elements/not-found/style.css.js +1 -1
  142. package/dist/components/elements/not-found/types.d.ts +2 -0
  143. package/dist/components/elements/pagination/index.cjs +1 -1
  144. package/dist/components/elements/pagination/index.d.ts +52 -7
  145. package/dist/components/elements/pagination/index.html.cjs +1 -1
  146. package/dist/components/elements/pagination/index.html.js +1 -1
  147. package/dist/components/elements/pagination/index.js +1 -1
  148. package/dist/components/elements/pagination/style.css.cjs +1 -1
  149. package/dist/components/elements/pagination/style.css.js +1 -1
  150. package/dist/components/elements/pagination/types.d.ts +1 -1
  151. package/dist/components/elements/progress/index.cjs +1 -1
  152. package/dist/components/elements/progress/index.d.ts +16 -7
  153. package/dist/components/elements/progress/index.html.cjs +1 -1
  154. package/dist/components/elements/progress/index.html.js +1 -1
  155. package/dist/components/elements/progress/index.js +1 -1
  156. package/dist/components/elements/progress/style.css.cjs +1 -1
  157. package/dist/components/elements/progress/style.css.js +1 -1
  158. package/dist/components/elements/progress/types.d.ts +4 -2
  159. package/dist/components/elements/radio/index.cjs +1 -1
  160. package/dist/components/elements/radio/index.d.ts +82 -3
  161. package/dist/components/elements/radio/index.html.cjs +1 -1
  162. package/dist/components/elements/radio/index.html.js +1 -1
  163. package/dist/components/elements/radio/index.js +1 -1
  164. package/dist/components/elements/radio/style.css.cjs +1 -1
  165. package/dist/components/elements/radio/style.css.js +1 -1
  166. package/dist/components/elements/radio/types.d.ts +6 -0
  167. package/dist/components/elements/rate/index.cjs +1 -1
  168. package/dist/components/elements/rate/index.d.ts +75 -3
  169. package/dist/components/elements/rate/index.html.cjs +1 -1
  170. package/dist/components/elements/rate/index.html.js +1 -1
  171. package/dist/components/elements/rate/index.js +1 -1
  172. package/dist/components/elements/rate/style.css.cjs +1 -1
  173. package/dist/components/elements/rate/style.css.js +1 -1
  174. package/dist/components/elements/rate/types.d.ts +2 -0
  175. package/dist/components/elements/select/index.cjs +1 -1
  176. package/dist/components/elements/select/index.d.ts +197 -22
  177. package/dist/components/elements/select/index.html.cjs +1 -1
  178. package/dist/components/elements/select/index.html.js +1 -1
  179. package/dist/components/elements/select/index.js +1 -1
  180. package/dist/components/elements/select/option.cjs +1 -0
  181. package/dist/components/elements/select/option.d.ts +2 -2
  182. package/dist/components/elements/select/option.js +1 -0
  183. package/dist/components/elements/select/style.css.cjs +1 -1
  184. package/dist/components/elements/select/style.css.js +1 -1
  185. package/dist/components/elements/select/types.d.ts +42 -6
  186. package/dist/components/elements/skeleton/index.cjs +1 -1
  187. package/dist/components/elements/skeleton/index.d.ts +15 -2
  188. package/dist/components/elements/skeleton/index.html.cjs +1 -1
  189. package/dist/components/elements/skeleton/index.html.js +1 -1
  190. package/dist/components/elements/skeleton/index.js +1 -1
  191. package/dist/components/elements/skeleton/style.css.cjs +1 -1
  192. package/dist/components/elements/skeleton/style.css.js +1 -1
  193. package/dist/components/elements/skeleton/types.d.ts +2 -1
  194. package/dist/components/elements/slider/index.cjs +1 -1
  195. package/dist/components/elements/slider/index.d.ts +115 -11
  196. package/dist/components/elements/slider/index.html.cjs +1 -1
  197. package/dist/components/elements/slider/index.html.js +1 -1
  198. package/dist/components/elements/slider/index.js +1 -1
  199. package/dist/components/elements/slider/style.css.cjs +1 -1
  200. package/dist/components/elements/slider/style.css.js +1 -1
  201. package/dist/components/elements/slider/types.d.ts +15 -4
  202. package/dist/components/elements/steps/index.cjs +1 -1
  203. package/dist/components/elements/steps/index.d.ts +73 -10
  204. package/dist/components/elements/steps/index.html.cjs +1 -1
  205. package/dist/components/elements/steps/index.html.js +1 -1
  206. package/dist/components/elements/steps/index.js +1 -1
  207. package/dist/components/elements/steps/style.css.cjs +1 -1
  208. package/dist/components/elements/steps/style.css.js +1 -1
  209. package/dist/components/elements/steps/types.d.ts +9 -2
  210. package/dist/components/elements/switch/index.cjs +1 -1
  211. package/dist/components/elements/switch/index.d.ts +52 -9
  212. package/dist/components/elements/switch/index.html.cjs +1 -1
  213. package/dist/components/elements/switch/index.html.js +1 -1
  214. package/dist/components/elements/switch/index.js +1 -1
  215. package/dist/components/elements/switch/types.d.ts +12 -0
  216. package/dist/components/elements/table/index.cjs +1 -1
  217. package/dist/components/elements/table/index.d.ts +251 -4
  218. package/dist/components/elements/table/index.html.cjs +1 -1
  219. package/dist/components/elements/table/index.html.js +1 -1
  220. package/dist/components/elements/table/index.js +1 -1
  221. package/dist/components/elements/table/style.css.cjs +1 -1
  222. package/dist/components/elements/table/style.css.js +1 -1
  223. package/dist/components/elements/table/types.d.ts +152 -7
  224. package/dist/components/elements/tabs/index.cjs +1 -1
  225. package/dist/components/elements/tabs/index.d.ts +47 -4
  226. package/dist/components/elements/tabs/index.html.cjs +1 -1
  227. package/dist/components/elements/tabs/index.html.js +1 -1
  228. package/dist/components/elements/tabs/index.js +1 -1
  229. package/dist/components/elements/tabs/style.css.cjs +1 -1
  230. package/dist/components/elements/tabs/style.css.js +1 -1
  231. package/dist/components/elements/tabs/types.d.ts +10 -0
  232. package/dist/components/elements/tag/index.cjs +1 -1
  233. package/dist/components/elements/tag/index.d.ts +11 -3
  234. package/dist/components/elements/tag/index.html.cjs +1 -1
  235. package/dist/components/elements/tag/index.html.js +1 -1
  236. package/dist/components/elements/tag/index.js +1 -1
  237. package/dist/components/elements/tag/style.css.cjs +1 -1
  238. package/dist/components/elements/tag/style.css.js +1 -1
  239. package/dist/components/elements/timeline/index.cjs +1 -1
  240. package/dist/components/elements/timeline/index.d.ts +8 -2
  241. package/dist/components/elements/timeline/index.js +1 -1
  242. package/dist/components/elements/timeline/style.css.cjs +1 -1
  243. package/dist/components/elements/timeline/style.css.js +1 -1
  244. package/dist/components/elements/timeline/types.d.ts +0 -1
  245. package/dist/components/elements/tooltip/index.cjs +1 -1
  246. package/dist/components/elements/tooltip/index.d.ts +78 -5
  247. package/dist/components/elements/tooltip/index.html.cjs +1 -1
  248. package/dist/components/elements/tooltip/index.html.js +1 -1
  249. package/dist/components/elements/tooltip/index.js +1 -1
  250. package/dist/components/elements/tooltip/style.css.cjs +1 -1
  251. package/dist/components/elements/tooltip/style.css.js +1 -1
  252. package/dist/components/elements/tooltip/types.d.ts +1 -1
  253. package/dist/components/elements/tree/index.cjs +1 -1
  254. package/dist/components/elements/tree/index.d.ts +163 -13
  255. package/dist/components/elements/tree/index.html.cjs +1 -1
  256. package/dist/components/elements/tree/index.html.js +1 -1
  257. package/dist/components/elements/tree/index.js +1 -1
  258. package/dist/components/elements/tree/style.css.cjs +1 -1
  259. package/dist/components/elements/tree/style.css.js +1 -1
  260. package/dist/components/elements/tree/types.d.ts +18 -4
  261. package/dist/components/elements/upload/index.cjs +1 -1
  262. package/dist/components/elements/upload/index.d.ts +59 -8
  263. package/dist/components/elements/upload/index.html.cjs +1 -1
  264. package/dist/components/elements/upload/index.html.js +1 -1
  265. package/dist/components/elements/upload/index.js +1 -1
  266. package/dist/components/elements/upload/style.css.cjs +1 -1
  267. package/dist/components/elements/upload/style.css.js +1 -1
  268. package/dist/components/elements/upload/types.d.ts +89 -5
  269. package/dist/components/elements/utils/helpers.cjs +1 -1
  270. package/dist/components/elements/utils/helpers.d.ts +10 -0
  271. package/dist/components/elements/utils/helpers.js +1 -1
  272. package/dist/components/index.cjs +1 -1
  273. package/dist/components/index.d.ts +3 -21
  274. package/dist/components/index.js +1 -1
  275. package/dist/components/theme/auto-inject.cjs +1 -0
  276. package/dist/components/theme/auto-inject.d.ts +23 -0
  277. package/dist/components/theme/auto-inject.js +1 -0
  278. package/dist/components/theme/index.cjs +1 -1
  279. package/dist/components/theme/index.d.ts +7 -1
  280. package/dist/components/theme/index.js +1 -1
  281. package/dist/components/theme/variables.css +25 -0
  282. package/dist/components/theme/variables.css.cjs +1 -0
  283. package/dist/components/theme/variables.css.js +1 -0
  284. package/dist/index.cjs +1 -1
  285. package/dist/index.d.ts +5 -5
  286. package/dist/index.js +1 -1
  287. package/dist/plugin.d.ts +2 -2
  288. package/dist/plugins/index.d.ts +2 -2
  289. package/dist/plugins/solely-vite-plugin.d.ts +1 -1
  290. package/dist/router/core.cjs +1 -1
  291. package/dist/router/core.d.ts +31 -1
  292. package/dist/router/core.js +1 -1
  293. package/dist/router/index.d.ts +4 -4
  294. package/dist/router/router-link.d.ts +1 -1
  295. package/dist/router/router-view.cjs +1 -1
  296. package/dist/router/router-view.d.ts +12 -2
  297. package/dist/router/router-view.js +1 -1
  298. package/dist/router/types.d.ts +3 -1
  299. package/dist/runtime/component/base-element.cjs +1 -1
  300. package/dist/runtime/component/base-element.d.ts +7 -0
  301. package/dist/runtime/component/base-element.js +1 -1
  302. package/dist/runtime/component/decorators.d.ts +7 -2
  303. package/dist/runtime/component/index.d.ts +2 -2
  304. package/dist/runtime/index.d.ts +3 -3
  305. package/dist/runtime/reactivity/computed.d.ts +1 -1
  306. package/dist/runtime/reactivity/index.d.ts +6 -6
  307. package/dist/runtime/reactivity/watch.d.ts +1 -1
  308. package/dist/runtime/renderer/index.d.ts +2 -2
  309. package/dist/runtime/renderer/renderIR.cjs +1 -1
  310. package/dist/runtime/renderer/renderIR.d.ts +1 -1
  311. package/dist/runtime/renderer/renderIR.js +1 -1
  312. package/dist/shared/aria.cjs +1 -0
  313. package/dist/shared/aria.d.ts +67 -0
  314. package/dist/shared/aria.js +1 -0
  315. package/dist/shared/boolean.cjs +1 -0
  316. package/dist/shared/boolean.d.ts +9 -0
  317. package/dist/shared/boolean.js +1 -0
  318. package/dist/shared/enum.cjs +1 -0
  319. package/dist/shared/enum.d.ts +10 -0
  320. package/dist/shared/enum.js +1 -0
  321. package/dist/shared/env.cjs +1 -1
  322. package/dist/shared/env.js +1 -1
  323. package/dist/shared/floating/overlay-stack.cjs +1 -0
  324. package/dist/shared/floating/overlay-stack.d.ts +56 -0
  325. package/dist/shared/floating/overlay-stack.js +1 -0
  326. package/dist/shared/floating/position.cjs +1 -0
  327. package/dist/shared/floating/position.d.ts +32 -0
  328. package/dist/shared/floating/position.js +1 -0
  329. package/dist/shared/floating/types.d.ts +112 -0
  330. package/dist/shared/form-associated.cjs +1 -0
  331. package/dist/shared/form-associated.d.ts +253 -0
  332. package/dist/shared/form-associated.js +1 -0
  333. package/dist/shared/gen-function.d.ts +1 -1
  334. package/dist/shared/icons.cjs +1 -0
  335. package/dist/shared/icons.d.ts +31 -0
  336. package/dist/shared/icons.js +1 -0
  337. package/dist/shared/index.cjs +1 -1
  338. package/dist/shared/index.d.ts +11 -9
  339. package/dist/shared/index.js +1 -1
  340. package/dist/shared/size.cjs +1 -0
  341. package/dist/shared/size.d.ts +17 -0
  342. package/dist/shared/size.js +1 -0
  343. package/dist/shared/templateError.d.ts +1 -1
  344. package/dist/types/index.d.ts +4 -4
  345. package/dist/types/ir.d.ts +1 -1
  346. package/package.json +27 -11
  347. package/dist/solely.svg +0 -1
@@ -0,0 +1,112 @@
1
+ /**
2
+ * 浮层定位纯函数的公共类型
3
+ *
4
+ * 约束见 `docs/architecture/contracts.md`(浮层部分);完整编号版见本地审计材料 `docs/internal/design-contracts.md`(不入库)。
5
+ * 这里的类型只描述几何与计算结果,不引用 DOM 实例,保证 `position.ts` 可在任意环境运行。
6
+ */
7
+ /** 12 个方位(`topLeft` 表示贴锚点左边,`leftTop` 表示贴锚点上边) */
8
+ export type Placement = 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight' | 'left' | 'leftTop' | 'leftBottom' | 'right' | 'rightTop' | 'rightBottom';
9
+ /** 定位坐标系:fixed 用视口坐标,absolute 用容器坐标 */
10
+ export type Strategy = 'fixed' | 'absolute';
11
+ /** 浮层尺寸 */
12
+ export interface Size {
13
+ readonly width: number;
14
+ readonly height: number;
15
+ }
16
+ /**
17
+ * 矩形(与 DOMRect 结构兼容)
18
+ *
19
+ * `right` / `bottom` 可省略,缺省时由 `left + width` / `top + height` 推导,
20
+ * 方便测试和调用方用最小数据构造。
21
+ */
22
+ export interface RectLike {
23
+ readonly top: number;
24
+ readonly left: number;
25
+ readonly width: number;
26
+ readonly height: number;
27
+ readonly right?: number;
28
+ readonly bottom?: number;
29
+ }
30
+ /** 视口尺寸(fixed 为浏览器视口,absolute 为容器可视区域) */
31
+ export interface ViewportSize {
32
+ readonly width: number;
33
+ readonly height: number;
34
+ }
35
+ /**
36
+ * `strategy='absolute'` 时的定位容器几何
37
+ *
38
+ * 纯函数不读取 DOM,容器信息必须由调用方测量后传入。
39
+ * 字段含义与 C-OVL-03 的换算公式一致。
40
+ */
41
+ export interface ContainerGeometry {
42
+ /** 容器 `getBoundingClientRect()` 的结果(视口坐标) */
43
+ readonly rect: RectLike;
44
+ readonly scrollTop?: number;
45
+ readonly scrollLeft?: number;
46
+ readonly clientTop?: number;
47
+ readonly clientLeft?: number;
48
+ }
49
+ /** `computePosition` 的输入选项 */
50
+ export interface ComputeOptions {
51
+ /** 期望方位;`auto` 由可用空间推导 */
52
+ readonly placement: Placement | 'auto';
53
+ /** 视口尺寸,必须由调用方传入,纯函数不读取 `window` */
54
+ readonly viewport: ViewportSize;
55
+ /** 锚点与浮层间距,默认 8 */
56
+ readonly offset?: number;
57
+ /** 与视口边界的最小内边距,默认 8 */
58
+ readonly boundaryPadding?: number;
59
+ /** 主轴越界时是否尝试切到对侧,默认 true */
60
+ readonly flip?: boolean;
61
+ /** 交叉轴越界时是否平移回边界内,默认 true */
62
+ readonly shift?: boolean;
63
+ /** 默认 `fixed` */
64
+ readonly strategy?: Strategy;
65
+ /** `strategy='absolute'` 时的定位容器;缺省时按视口坐标返回 */
66
+ readonly container?: ContainerGeometry;
67
+ }
68
+ /** 箭头偏移:相对浮层左上角,垂直方位用 x,水平方位用 y */
69
+ export interface ArrowPosition {
70
+ readonly x?: number;
71
+ readonly y?: number;
72
+ }
73
+ /**
74
+ * 主轴 / 交叉轴溢出量(像素,恒 >= 0)
75
+ *
76
+ * `main` 为 flip 之后、主轴钳制之前的溢出量。调用方可据此决定是否隐藏浮层
77
+ * (例如锚点被滚出视口)。`cross` 为 shift 之后的剩余溢出量。
78
+ */
79
+ export interface Overflow {
80
+ readonly main: number;
81
+ readonly cross: number;
82
+ }
83
+ /** flip 决策记录,便于调试与调用方判断是否发生过翻转 */
84
+ export interface FlipState {
85
+ /** 调用方原始请求(可能是 `auto`) */
86
+ readonly requested: Placement | 'auto';
87
+ /** 解析后的首选方位(`auto` 已按可用空间选定) */
88
+ readonly preferred: Placement;
89
+ /** 最终生效方位 */
90
+ readonly final: Placement;
91
+ /** 是否实际发生了翻转 */
92
+ readonly flipped: boolean;
93
+ /** 依次尝试的方位,`[preferred, opposite?]` */
94
+ readonly tried: Placement[];
95
+ }
96
+ /** 定位结果 */
97
+ export interface PositionResult {
98
+ /** 水平坐标(fixed 为视口坐标,absolute 为容器坐标) */
99
+ readonly x: number;
100
+ /** 垂直坐标(fixed 为视口坐标,absolute 为容器坐标) */
101
+ readonly y: number;
102
+ /** 与 y 同值;契约 C-OVL-01 使用 top/left 命名,保留别名便于迁移 */
103
+ readonly top: number;
104
+ /** 与 x 同值 */
105
+ readonly left: number;
106
+ /** 实际生效方位(翻转后) */
107
+ readonly placement: Placement;
108
+ /** 箭头相对浮层的偏移;未发生翻转/平移时也始终返回对象 */
109
+ readonly arrow: ArrowPosition;
110
+ readonly overflow: Overflow;
111
+ readonly flipState: FlipState;
112
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t={valueMissing:"请填写此项",valueMissingCheckbox:"请勾选此项",valueMissingSelect:"请选择一项",tooShort:"至少输入 {minlength} 个字符",tooLong:"最多输入 {maxlength} 个字符",typeMismatch:"请输入有效的{type}",patternMismatch:"输入格式不正确",badInput:"请输入有效内容",rangeUnderflow:"数值小于允许的最小值",rangeOverflow:"数值大于允许的最大值",stepMismatch:"数值不符合步长要求",customError:"输入内容无效"},e=new WeakMap,n=new WeakMap,r=["valueMissing","tooShort","tooLong","patternMismatch","typeMismatch","badInput","customError","rangeUnderflow","rangeOverflow","stepMismatch"];function a(t,e){console.warn(`[${function(t){return`<${(t.tagName||"element").toLowerCase()}>`}(t)}] ${e}`)}function o(t){if(n.has(t))return n.get(t)??null;let e=null;const r=t.attachInternals;if("function"!=typeof r)a(t,"当前环境不支持 attachInternals(),表单关联已降级为不参与表单。");else try{e=r.call(t)}catch(o){a(t,`attachInternals() 调用失败,表单关联已降级为不参与表单:${o instanceof Error?o.message:String(o)}`),e=null}return n.set(t,e),e}function s(t){return n.get(t)??null}function i(t){return!!t&&"function"==typeof t.setFormValue}function l(t){return!!t&&"function"==typeof t.setValidity}function u(t){return t?Array.isArray(t)?t:[t]:[]}function c(t,e){if(e.name){const t=e.name();if("string"==typeof t)return t}const n=t.getAttribute("name");if(null!==n)return n;const r=t.name;return"string"==typeof r?r:""}function f(t){const n=e.get(t);return!!n&&(!!n.adapter.disabled?.()||n.formDisabled)}function d(t){const n=e.get(t);if(!n||!i(n.internals))return;const r=c(t,n.adapter),a=n.adapter.read();if(f(t)||!r)return void n.internals.setFormValue(null,null);let o=n.adapter.encode(a);if(o&&0!==o.length){if("boolean"===n.adapter.family&&(o=o.map(t=>""===t?"on":t)),"multiple"===n.adapter.family){const t=new FormData;for(const e of o)t.append(r,e);return void n.internals.setFormValue(t,null)}n.internals.setFormValue(o[0],null)}else n.internals.setFormValue(null,null)}function p(n){const a=e.get(n);if(!a||!l(a.internals))return;if(f(n))return void a.internals.setValidity({});const o=a.adapter.read(),s=a.adapter.validate?.(o)??null,i={...s?.flags??{}};if(a.customMessage&&(i.customError=!0),!Object.values(i).some(Boolean))return void a.internals.setValidity({});const c=a.customMessage||function(e,n,a){const o=e.adapter,s=o.invalidMessage?.(),i=function(t){for(const e of r)if(t[e])return e;return null}(n);return a||s||(i?(l="valueMissing"===i?o.missingMessage?.()||t.valueMissing:t[i]||"",u=o.messageContext?.(),u?l.replace(/\{(\w+)\}/g,(t,e)=>Object.prototype.hasOwnProperty.call(u,e)?String(u[e]):t):l):"");var l,u}(a,i,s?.message),d=function(t,e){if(e)return e;const n=t.adapter.anchors?.();if(n&&n.length>0)return n[0];const r=u(t.adapter.ariaTarget?.());return r.length>0?r[0]:void 0}(a,s?.anchor);a.internals.setValidity(i,c,d)}function g(t){const n=e.get(t);if(!n)return;const r=u(n.adapter.ariaTarget?.()??t);if(0===r.length)return;const a=!!n.adapter.required?.(),o=f(t),s=function(t){const e=t.internals?.validity;let n=!1;return e&&("boolean"==typeof e.invalid?n=e.invalid:"boolean"==typeof e.valid&&(n=!e.valid)),n||!!t.adapter.hasVisualError?.()}(n);for(const e of r)e.setAttribute("aria-required",a?"true":"false"),e.setAttribute("aria-disabled",o?"true":"false"),e.setAttribute("aria-invalid",s?"true":"false")}function m(t,e){if(!e||!e.source)return!1;if(function(t){return"boolean"==typeof t.checked}(e)){if(e.checked===e.previousChecked)return!1}else if(function(t){return Array.isArray(t.value)}(e)){if(n=e.value,r=e.previousValue,n.length===r.length&&n.every((t,e)=>Object.is(t,r[e])))return!1}else if(Object.is(e.value,e.previousValue))return!1;var n,r;return t.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0,composed:!0,cancelable:!1})),!0}function h(t){const n=e.get(t);if(!n)return;const r=n.adapter;if(!r.write)return void a(t,"重置需要适配器提供 write();本次 formResetCallback 被忽略。");const o=r.read(),s=function(t){return t.resetCaptured||(t.resetValue=t.adapter.read(),t.resetCaptured=!0),t.resetValue}(n);r.write(s,!0),n.customMessage="",d(t),p(t),g(t);const i=function(t,e,n,r,a){return e.adapter.changeDetail?e.adapter.changeDetail(r,n,a):"scalar"===e.adapter.family?{name:c(t,e.adapter),value:r,previousValue:n,source:a}:null}(t,n,o,r.read(),"reset");i&&m(t,i)}function y(t,n){const r=e.get(t);if(r){if(r.formDisabled=!!n,f(t))return i(r.internals)&&r.internals.setFormValue(null,null),l(r.internals)&&r.internals.setValidity({}),g(t),function(t){const e=u(t.adapter.tabTargets?.()??t.adapter.ariaTarget?.()??null);for(const n of e)t.tabSnapshots.has(n)||t.tabSnapshots.set(n,n.getAttribute("tabindex")),n.setAttribute("tabindex","-1")}(r),void b(t);!function(t){for(const[e,n]of t.tabSnapshots)null===n?e.removeAttribute("tabindex"):e.setAttribute("tabindex",n);t.tabSnapshots.clear()}(r),d(t),p(t),g(t),b(t)}}function b(t){const e=t.refresh;"function"==typeof e&&e.call(t)}const v=Object.freeze({badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:!0,valueMissing:!1});exports.FORM_VALIDATION_MESSAGES=t,exports.attachInternals=o,exports.checkFormValidity=function(t){const e=s(t);return"function"!=typeof e?.checkValidity||e.checkValidity()},exports.effectiveDisabled=f,exports.emitChange=m,exports.formValidationMessage=function(t){const e=s(t)?.validationMessage;return"string"==typeof e?e:""},exports.formValidity=function(t){return s(t)?.validity??v},exports.handleFormAssociatedCallback=function(t){d(t),p(t)},exports.handleFormDisabledCallback=function(t,e){y(t,e)},exports.handleFormResetCallback=function(t){h(t)},exports.initFormAssociation=function(t,n){if(e.has(t))return void a(t,"initFormAssociation() 重复调用;已保留首次装配的适配器。");const r={adapter:n,internals:o(t),formDisabled:!1,resetValue:void 0,resetCaptured:!1,customMessage:"",tabSnapshots:new Map};e.set(t,r);const s=n.readDefault?.();void 0!==s&&(r.resetValue=s,r.resetCaptured=!0),queueMicrotask(()=>{e.get(t)===r&&(r.resetCaptured||(r.resetValue=r.adapter.read(),r.resetCaptured=!0),d(t),p(t),g(t))})},exports.reportFormValidity=function(t){const e=s(t);return"function"!=typeof e?.reportValidity||e.reportValidity()},exports.resetFormControl=h,exports.setCustomValidity=function(t,n){const r=e.get(t);r?(r.customMessage="string"==typeof n?n:"",p(t)):a(t,"setCustomValidity() 必须在 initFormAssociation() 之后调用。")},exports.setFormDefault=function(t,n){const r=e.get(t);r&&(r.resetValue=n,r.resetCaptured=!0)},exports.setFormDisabled=y,exports.syncAria=g,exports.syncFormValue=d,exports.syncValidity=p;
@@ -0,0 +1,253 @@
1
+ /**
2
+ * Solely 表单关联基座(0.8.0)
3
+ *
4
+ * 契约来源:`docs/architecture/contracts.md`(表单部分);完整编号版见本地审计材料 `docs/internal/design-contracts.md`(不入库)。
5
+ *
6
+ * 本模块只提供“装配 + 同步”能力,不包含任何组件特化逻辑,也不注册到 `src/shared/index.ts`:
7
+ * 它是组件内部工具,不是公开 API。
8
+ *
9
+ * 使用方式(组件在 `created()` 中调用,禁止在构造函数中调用):
10
+ *
11
+ * ```ts
12
+ * created(): void {
13
+ * initFormAssociation(this, {
14
+ * family: 'scalar',
15
+ * read: () => this.getValue(),
16
+ * write: (value, silent) => this.setValue(value as string, silent),
17
+ * encode: value => [String(value)],
18
+ * defaultValue: () => this.defaultValue,
19
+ * anchors: () => [this.$refs.input],
20
+ * disabled: () => this.$data.disabled,
21
+ * required: () => this.$data.required,
22
+ * });
23
+ * }
24
+ * ```
25
+ */
26
+ /** change 事件的来源;静默路径(属性赋值 / 初始化)不派发事件,因此不会出现 `undefined` */
27
+ export type ChangeSource = 'user' | 'api' | 'reset';
28
+ /** 值族:决定 FormData 写入方式与默认比较规则 */
29
+ export type FormValueFamily = 'scalar' | 'boolean' | 'multiple';
30
+ /** 标量 detail:input / select 单选 / slider / rate / radio-group */
31
+ export interface ScalarChangeDetail<T = unknown> {
32
+ name: string;
33
+ value: T;
34
+ previousValue: T;
35
+ source: ChangeSource;
36
+ }
37
+ /** 布尔 detail:checkbox / switch / radio(value 保留原始值,不做 `'on'` 归一化) */
38
+ export interface BooleanChangeDetail {
39
+ name: string;
40
+ value: string;
41
+ checked: boolean;
42
+ previousChecked: boolean;
43
+ source: ChangeSource;
44
+ }
45
+ /** 多值 detail:select multiple / 未来 tree */
46
+ export interface MultipleChangeDetail {
47
+ name: string;
48
+ value: string[];
49
+ previousValue: string[];
50
+ source: ChangeSource;
51
+ }
52
+ export type FormChangeDetail = ScalarChangeDetail | BooleanChangeDetail | MultipleChangeDetail;
53
+ /** 组件自身计算出的校验结果;返回 `null` 表示有效 */
54
+ export interface FormValidationResult {
55
+ /** 只使用组件真正支持的标志(C-FORM-18) */
56
+ flags: ValidityStateFlags;
57
+ /** 显式消息;未提供时回退到 `invalidMessage` → 内置默认消息(D9) */
58
+ message?: string;
59
+ /** 校验锚点;必须与组件在同一个 shadow tree(C-FORM-17) */
60
+ anchor?: HTMLElement;
61
+ }
62
+ /**
63
+ * 组件与基座之间的适配器。
64
+ *
65
+ * 基座不读取组件的任何私有字段,所有值语义都由适配器提供,
66
+ * 从而避免 `form-associated.ts` 反向依赖具体组件。
67
+ */
68
+ export interface FormAdapter<T = unknown> {
69
+ /** 值族;决定单值/多值与 `'' → 'on'` 归一化策略 */
70
+ family: FormValueFamily;
71
+ /** 读取当前值(必须与宿主 `value` / `checked` getter 保持一致) */
72
+ read(): T;
73
+ /**
74
+ * 重置写回当前值。基座固定以 `silent = true` 调用(C-FORM-10),
75
+ * 实现必须保证零事件。
76
+ */
77
+ write?(value: T, silent: true): void;
78
+ /**
79
+ * 生成 FormData 条目。
80
+ * - 返回 `null` 或 `[]`:不产生提交条目(未选中 / 空选择)。
81
+ * - 空字符串是否提交由组件决定:`input` 空值应返回 `['']`(§3.1),
82
+ * `select` 空值应返回 `null`。
83
+ * - `family = 'boolean'` 时,基座会把条目中的 `''` 归一化为 `'on'`(D4),
84
+ * 但 change detail 中的 `value` 仍是原始 `''`。
85
+ */
86
+ encode(value: T): string[] | null;
87
+ /** 字段名;默认读取宿主的 `name` attribute(其次读取同名 property) */
88
+ name?(): string;
89
+ /** 作者声明的 disabled;**不包含** formDisabled(C-FORM-12) */
90
+ disabled?(): boolean;
91
+ /** required;用于 `aria-required` 与 valueMissing 判定 */
92
+ required?(): boolean;
93
+ /** ARIA 属性承载元素;默认宿主本身 */
94
+ ariaTarget?(): Element | Element[] | null;
95
+ /** 禁用时移出 Tab 序的元素;默认复用 `ariaTarget` */
96
+ tabTargets?(): Element | Element[] | null;
97
+ /** 校验锚点候选;默认复用 `ariaTarget` */
98
+ anchors?(): HTMLElement[] | null;
99
+ /** 计算约束校验;只在未禁用时调用(C-FORM-17) */
100
+ validate?(value: T): FormValidationResult | null;
101
+ /** valueMissing 的组件级默认消息(checkbox/switch/select 用各自文案) */
102
+ missingMessage?(): string;
103
+ /** `invalidMessage` 属性值;覆盖所有内置消息 */
104
+ invalidMessage?(): string;
105
+ /** 内置消息占位符替换(如 `{minlength}` / `{type}`);未提供时保留占位符 */
106
+ messageContext?(): Record<string, string | number>;
107
+ /** 视觉错误态(如 `status === 'error'`),并入 `aria-invalid`(C-FORM-20) */
108
+ hasVisualError?(): boolean;
109
+ /** 显式重置目标;返回 `undefined` 表示未显式设置,由基座在首轮微任务捕获(C-FORM-09) */
110
+ readDefault?(): T | undefined;
111
+ /** 生成 change detail;标量族缺省时基座可直接构造,布尔/多值族必须提供 */
112
+ changeDetail?(value: T, previousValue: T, source: ChangeSource): FormChangeDetail;
113
+ }
114
+ /** 内置中文默认消息(D9:0.8.0 不引入 locale,后续只替换本常量) */
115
+ export declare const FORM_VALIDATION_MESSAGES: {
116
+ readonly valueMissing: "请填写此项";
117
+ readonly valueMissingCheckbox: "请勾选此项";
118
+ readonly valueMissingSelect: "请选择一项";
119
+ readonly tooShort: "至少输入 {minlength} 个字符";
120
+ readonly tooLong: "最多输入 {maxlength} 个字符";
121
+ readonly typeMismatch: "请输入有效的{type}";
122
+ readonly patternMismatch: "输入格式不正确";
123
+ readonly badInput: "请输入有效内容";
124
+ readonly rangeUnderflow: "数值小于允许的最小值";
125
+ readonly rangeOverflow: "数值大于允许的最大值";
126
+ readonly stepMismatch: "数值不符合步长要求";
127
+ readonly customError: "输入内容无效";
128
+ };
129
+ /**
130
+ * `attachInternals()` 的唯一入口(C-FORM-02)。
131
+ *
132
+ * - 每个元素只调用一次,结果(包括失败时的 `null`)缓存在 `WeakMap`。
133
+ * - 禁止在构造函数中调用;组件必须在 `created()` 里通过 `initFormAssociation` 进入。
134
+ * - 失败时告警并降级为“不参与表单”,后续同步函数均为安全空操作。
135
+ */
136
+ export declare function attachInternals(el: HTMLElement): ElementInternals | null;
137
+ /**
138
+ * 获取表单 owner(C-FORM-03 的 form owner 语义)。
139
+ *
140
+ * 优先级:
141
+ * 1. `ElementInternals.form`(浏览器维护,支持 `form="id"` 与动态换 form);
142
+ * 2. 回退到同一 tree 内最近的 `<form>` 祖先。
143
+ *
144
+ * 回退路径刻意不跨 shadow 边界:原生表单关联本身就只在同一 tree 内成立,
145
+ * 跨 shadow 的 `<form>` 不属于该元素的 form owner。
146
+ */
147
+ export declare function getFormOwner(el: HTMLElement): HTMLFormElement | null;
148
+ /**
149
+ * 有效禁用态(C-FORM-12):作者 disabled 与 formDisabled 的 OR。
150
+ *
151
+ * 只读取适配器提供的作者态,**绝不**把 formDisabled 写回组件的 disabled。
152
+ */
153
+ export declare function effectiveDisabled(el: HTMLElement): boolean;
154
+ /**
155
+ * 同步提交值(C-FORM-05 / C-FORM-06 / C-FORM-07)。
156
+ *
157
+ * - 未初始化 / 环境不支持 `setFormValue`:安全空操作(jsdom 属于此列)。
158
+ * - `name` 为空:不产生条目,但仍参与校验(C-FORM-01 注)。
159
+ * - `effectiveDisabled`:`setFormValue(null)`。
160
+ * - 单值:`setFormValue(entry[0], null)`。
161
+ * - 多值:`new FormData()` 逐条 `append(name, value)` 后 `setFormValue(fd, null)`。
162
+ * - 布尔族:条目中的 `''` 归一化为 `'on'`,仅发生在 FormData 边界。
163
+ */
164
+ export declare function syncFormValue(el: HTMLElement): void;
165
+ /**
166
+ * 同步约束校验(C-FORM-17 / C-FORM-18 / C-FORM-19)。
167
+ *
168
+ * 自定义消息通过 `setCustomValidity` 保存在基座状态中,再与组件标志合并,
169
+ * 避免 `setValidity({})` 覆盖用户消息(原生 `setCustomValidity` 不存在于 ElementInternals)。
170
+ * 禁用时按 C-FORM-13 清空标志,但保留自定义消息,重新启用后恢复。
171
+ */
172
+ export declare function syncValidity(el: HTMLElement): void;
173
+ /**
174
+ * 设置自定义错误消息(组件 `setCustomValidity()` 委托到这里)。
175
+ *
176
+ * 传空字符串清除。消息优先级:自定义消息 > `invalidMessage` > 内置默认(C-FORM-19)。
177
+ */
178
+ export declare function setCustomValidity(el: HTMLElement, message: string): void;
179
+ /**
180
+ * 同步 ARIA(C-FORM-20)。
181
+ *
182
+ * - `aria-required`:适配器 `required()`。
183
+ * - `aria-invalid`:`internals.validity.invalid` 或视觉错误态。
184
+ * - `aria-disabled`:`effectiveDisabled`。
185
+ *
186
+ * 只写属性,不派发事件;默认作用在宿主上,组件可通过 `ariaTarget` 指定承载 `role` 的节点。
187
+ */
188
+ export declare function syncAria(el: HTMLElement): void;
189
+ /**
190
+ * 统一派发 `change`(C-FORM-23)。
191
+ *
192
+ * - 值未变化时**绝不派发**(C-FORM-21);按 detail 形状判断值族并比较:
193
+ * 布尔比较 `checked`,多值按顺序逐项比较,标量用 `Object.is`。
194
+ * - 事件由宿主派发:`CustomEvent`、`bubbles: true`、`composed: true`、`cancelable: false`。
195
+ * - `source` 由调用方决定,基座不做推断:
196
+ * - `'user'`:用户交互(点击 / 输入 / 键盘 / 拖拽);
197
+ * - `'api'`:显式 `setValue(v, false)` / `setChecked(v, false)`;
198
+ * - `'reset'`:仅由 `formResetCallback` → `resetFormControl` 使用。
199
+ * - 返回是否真正派发,便于组件短路后续逻辑。
200
+ */
201
+ export declare function emitChange(el: HTMLElement, detail: FormChangeDetail): boolean;
202
+ /**
203
+ * 重置(C-FORM-10 / C-FORM-11)。
204
+ *
205
+ * 时序:读取重置目标 → silent 写回 → syncFormValue → syncValidity → syncAria →
206
+ * 值确实变化时派发一次 `change`(`source: 'reset'`)。
207
+ * 不派发 `input`;禁用态也写回并按需派发(受控数据需要同步)。
208
+ */
209
+ export declare function resetFormControl(el: HTMLElement): void;
210
+ /**
211
+ * 禁用级联(C-FORM-13)。
212
+ *
213
+ * - 只记录 `formDisabled`,**不写回**作者 `disabled`,因此 fieldset 重新启用后可恢复。
214
+ * - 禁用:`setFormValue(null)`、`setValidity({})`、`aria-disabled="true"`、承载交互元素 `tabindex="-1"`。
215
+ * - 启用:恢复 `tabindex`,重新同步值 / 有效性 / ARIA。
216
+ * - 不清空值,不派发 `change`。
217
+ */
218
+ export declare function setFormDisabled(el: HTMLElement, disabled: boolean): void;
219
+ /** `formAssociatedCallback` 的委托骨架(C-FORM-03):换 form owner 后重算提交值与有效性 */
220
+ export declare function handleFormAssociatedCallback(el: HTMLElement): void;
221
+ /** `formResetCallback` 的委托骨架 */
222
+ export declare function handleFormResetCallback(el: HTMLElement): void;
223
+ /** `formDisabledCallback` 的委托骨架 */
224
+ export declare function handleFormDisabledCallback(el: HTMLElement, disabled: boolean): void;
225
+ /**
226
+ * 统一装配(C-FORM-02 / C-FORM-09)。
227
+ *
228
+ * 组件必须在 `created()` 中调用,**禁止在构造函数中调用**。
229
+ *
230
+ * 职责:
231
+ * 1. 调用一次 `attachInternals()` 并缓存结果;
232
+ * 2. 建立适配器状态;
233
+ * 3. 初始化重置目标:显式 `readDefault()` 立即生效,否则在首个 microtask
234
+ * (首轮属性同步结束后的最小安全点)捕获一次当前值,之后不再随交互变化;
235
+ * 4. 在同一 microtask 完成首次 `syncFormValue → syncValidity → syncAria`。
236
+ *
237
+ * 重复调用会告警并保留第一次的适配器。
238
+ */
239
+ export declare function initFormAssociation<T>(el: HTMLElement, adapter: FormAdapter<T>): void;
240
+ /**
241
+ * 显式更新重置目标(C-FORM-09:`defaultValue` / `defaultChecked` 被赋值时立即替换)。
242
+ *
243
+ * 只更新重置目标,不同步当前值、不派发事件。
244
+ */
245
+ export declare function setFormDefault<T>(el: HTMLElement, value: T): void;
246
+ /** 代理 `internals.validity`;jsdom 等环境没有该字段时返回全 false 快照 */
247
+ export declare function formValidity(el: HTMLElement): ValidityState;
248
+ /** 代理 `internals.validationMessage` */
249
+ export declare function formValidationMessage(el: HTMLElement): string;
250
+ /** 代理 `internals.checkValidity()`;环境不支持时视为有效 */
251
+ export declare function checkFormValidity(el: HTMLElement): boolean;
252
+ /** 代理 `internals.reportValidity()`;环境不支持时视为有效 */
253
+ export declare function reportFormValidity(el: HTMLElement): boolean;
@@ -0,0 +1 @@
1
+ const t={valueMissing:"请填写此项",valueMissingCheckbox:"请勾选此项",valueMissingSelect:"请选择一项",tooShort:"至少输入 {minlength} 个字符",tooLong:"最多输入 {maxlength} 个字符",typeMismatch:"请输入有效的{type}",patternMismatch:"输入格式不正确",badInput:"请输入有效内容",rangeUnderflow:"数值小于允许的最小值",rangeOverflow:"数值大于允许的最大值",stepMismatch:"数值不符合步长要求",customError:"输入内容无效"},e=new WeakMap,n=new WeakMap,r=["valueMissing","tooShort","tooLong","patternMismatch","typeMismatch","badInput","customError","rangeUnderflow","rangeOverflow","stepMismatch"];function a(t,e){console.warn(`[${function(t){return`<${(t.tagName||"element").toLowerCase()}>`}(t)}] ${e}`)}function i(t){if(n.has(t))return n.get(t)??null;let e=null;const r=t.attachInternals;if("function"!=typeof r)a(t,"当前环境不支持 attachInternals(),表单关联已降级为不参与表单。");else try{e=r.call(t)}catch(i){a(t,`attachInternals() 调用失败,表单关联已降级为不参与表单:${i instanceof Error?i.message:String(i)}`),e=null}return n.set(t,e),e}function o(t){return n.get(t)??null}function s(t){return!!t&&"function"==typeof t.setFormValue}function u(t){return!!t&&"function"==typeof t.setValidity}function l(t){return t?Array.isArray(t)?t:[t]:[]}function c(t,e){if(e.name){const t=e.name();if("string"==typeof t)return t}const n=t.getAttribute("name");if(null!==n)return n;const r=t.name;return"string"==typeof r?r:""}function f(t){const n=e.get(t);return!!n&&(!!n.adapter.disabled?.()||n.formDisabled)}function d(t){const n=e.get(t);if(!n||!s(n.internals))return;const r=c(t,n.adapter),a=n.adapter.read();if(f(t)||!r)return void n.internals.setFormValue(null,null);let i=n.adapter.encode(a);if(i&&0!==i.length){if("boolean"===n.adapter.family&&(i=i.map(t=>""===t?"on":t)),"multiple"===n.adapter.family){const t=new FormData;for(const e of i)t.append(r,e);return void n.internals.setFormValue(t,null)}n.internals.setFormValue(i[0],null)}else n.internals.setFormValue(null,null)}function p(n){const a=e.get(n);if(!a||!u(a.internals))return;if(f(n))return void a.internals.setValidity({});const i=a.adapter.read(),o=a.adapter.validate?.(i)??null,s={...o?.flags??{}};if(a.customMessage&&(s.customError=!0),!Object.values(s).some(Boolean))return void a.internals.setValidity({});const c=a.customMessage||function(e,n,a){const i=e.adapter,o=i.invalidMessage?.(),s=function(t){for(const e of r)if(t[e])return e;return null}(n);return a||o||(s?(u="valueMissing"===s?i.missingMessage?.()||t.valueMissing:t[s]||"",l=i.messageContext?.(),l?u.replace(/\{(\w+)\}/g,(t,e)=>Object.prototype.hasOwnProperty.call(l,e)?String(l[e]):t):u):"");var u,l}(a,s,o?.message),d=function(t,e){if(e)return e;const n=t.adapter.anchors?.();if(n&&n.length>0)return n[0];const r=l(t.adapter.ariaTarget?.());return r.length>0?r[0]:void 0}(a,o?.anchor);a.internals.setValidity(s,c,d)}function g(t,n){const r=e.get(t);r?(r.customMessage="string"==typeof n?n:"",p(t)):a(t,"setCustomValidity() 必须在 initFormAssociation() 之后调用。")}function m(t){const n=e.get(t);if(!n)return;const r=l(n.adapter.ariaTarget?.()??t);if(0===r.length)return;const a=!!n.adapter.required?.(),i=f(t),o=function(t){const e=t.internals?.validity;let n=!1;return e&&("boolean"==typeof e.invalid?n=e.invalid:"boolean"==typeof e.valid&&(n=!e.valid)),n||!!t.adapter.hasVisualError?.()}(n);for(const e of r)e.setAttribute("aria-required",a?"true":"false"),e.setAttribute("aria-disabled",i?"true":"false"),e.setAttribute("aria-invalid",o?"true":"false")}function h(t,e){if(!e||!e.source)return!1;if(function(t){return"boolean"==typeof t.checked}(e)){if(e.checked===e.previousChecked)return!1}else if(function(t){return Array.isArray(t.value)}(e)){if(n=e.value,r=e.previousValue,n.length===r.length&&n.every((t,e)=>Object.is(t,r[e])))return!1}else if(Object.is(e.value,e.previousValue))return!1;var n,r;return t.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0,composed:!0,cancelable:!1})),!0}function v(t){const n=e.get(t);if(!n)return;const r=n.adapter;if(!r.write)return void a(t,"重置需要适配器提供 write();本次 formResetCallback 被忽略。");const i=r.read(),o=function(t){return t.resetCaptured||(t.resetValue=t.adapter.read(),t.resetCaptured=!0),t.resetValue}(n);r.write(o,!0),n.customMessage="",d(t),p(t),m(t);const s=function(t,e,n,r,a){return e.adapter.changeDetail?e.adapter.changeDetail(r,n,a):"scalar"===e.adapter.family?{name:c(t,e.adapter),value:r,previousValue:n,source:a}:null}(t,n,i,r.read(),"reset");s&&h(t,s)}function b(t,n){const r=e.get(t);if(r){if(r.formDisabled=!!n,f(t))return s(r.internals)&&r.internals.setFormValue(null,null),u(r.internals)&&r.internals.setValidity({}),m(t),function(t){const e=l(t.adapter.tabTargets?.()??t.adapter.ariaTarget?.()??null);for(const n of e)t.tabSnapshots.has(n)||t.tabSnapshots.set(n,n.getAttribute("tabindex")),n.setAttribute("tabindex","-1")}(r),void y(t);!function(t){for(const[e,n]of t.tabSnapshots)null===n?e.removeAttribute("tabindex"):e.setAttribute("tabindex",n);t.tabSnapshots.clear()}(r),d(t),p(t),m(t),y(t)}}function y(t){const e=t.refresh;"function"==typeof e&&e.call(t)}function M(t){d(t),p(t)}function V(t){v(t)}function w(t,e){b(t,e)}function A(t,n){if(e.has(t))return void a(t,"initFormAssociation() 重复调用;已保留首次装配的适配器。");const r={adapter:n,internals:i(t),formDisabled:!1,resetValue:void 0,resetCaptured:!1,customMessage:"",tabSnapshots:new Map};e.set(t,r);const o=n.readDefault?.();void 0!==o&&(r.resetValue=o,r.resetCaptured=!0),queueMicrotask(()=>{e.get(t)===r&&(r.resetCaptured||(r.resetValue=r.adapter.read(),r.resetCaptured=!0),d(t),p(t),m(t))})}function C(t,n){const r=e.get(t);r&&(r.resetValue=n,r.resetCaptured=!0)}const S=Object.freeze({badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:!0,valueMissing:!1});function k(t){return o(t)?.validity??S}function F(t){const e=o(t)?.validationMessage;return"string"==typeof e?e:""}function O(t){const e=o(t);return"function"!=typeof e?.checkValidity||e.checkValidity()}function x(t){const e=o(t);return"function"!=typeof e?.reportValidity||e.reportValidity()}export{t as FORM_VALIDATION_MESSAGES,i as attachInternals,O as checkFormValidity,f as effectiveDisabled,h as emitChange,F as formValidationMessage,k as formValidity,M as handleFormAssociatedCallback,w as handleFormDisabledCallback,V as handleFormResetCallback,A as initFormAssociation,x as reportFormValidity,v as resetFormControl,g as setCustomValidity,C as setFormDefault,b as setFormDisabled,m as syncAria,d as syncFormValue,p as syncValidity};
@@ -1,4 +1,4 @@
1
- import { IRLocal } from '../types';
1
+ import { IRLocal } from '../types/index.js';
2
2
  export type GenType = 'template' | 'handler' | 'expression' | 'lifecycle';
3
3
  /**
4
4
  * 主入口:生成可执行的函数(支持上层捕获异常)
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={info:"M8 1.8a6.2 6.2 0 1 0 0 12.4A6.2 6.2 0 0 0 8 1.8Z M8 7.2v4.4 M8 4.8h.01",success:"M8 1.8a6.2 6.2 0 1 0 0 12.4A6.2 6.2 0 0 0 8 1.8Z M4.9 8.2 7 10.3 11.3 5.8",warning:"M8 2.2 14.6 13.4H1.4L8 2.2Z M8 6.2v3.4 M8 11.6h.01",error:"M8 1.8a6.2 6.2 0 1 0 0 12.4A6.2 6.2 0 0 0 8 1.8Z M5.7 5.7 10.3 10.3 M10.3 5.7 5.7 10.3",check:"M3.5 8.5 6.8 11.5 12.5 4.8",close:"M4.4 4.4 11.6 11.6 M11.6 4.4 4.4 11.6",question:"M8 1.8a6.2 6.2 0 1 0 0 12.4A6.2 6.2 0 0 0 8 1.8Z M6.2 6.2a1.9 1.9 0 1 1 2.6 1.8c-.6.3-.8.7-.8 1.4 M8 11.5h.01"};exports.STATUS_ICON_BY_TYPE={info:"info",success:"success",warning:"warning",warn:"warning",error:"error",exception:"error",danger:"error",confirm:"question"},exports.STATUS_ICON_PATHS=e,exports.createStatusIcon=function(t,r="solely-linear-icon"){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("class",r),s.setAttribute("viewBox","0 0 16 16"),s.setAttribute("aria-hidden","true"),s.setAttribute("focusable","false");const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d",e[t]),s.appendChild(n),s};
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Solely 线性状态图标
3
+ *
4
+ * 16×16 viewBox、stroke: currentColor,配合 shadow DOM 内的 `.solely-linear-icon`
5
+ * 样式规则使用。命令式组件用 createStatusIcon() 以 DOM API 创建(兼容严格 CSP),
6
+ * 声明式模板可直接把 STATUS_ICON_PATHS 绑到 `<path :d="...">`。
7
+ */
8
+ export declare const STATUS_ICON_PATHS: {
9
+ /** 圆形 + i */
10
+ readonly info: "M8 1.8a6.2 6.2 0 1 0 0 12.4A6.2 6.2 0 0 0 8 1.8Z M8 7.2v4.4 M8 4.8h.01";
11
+ /** 圆形 + 勾 */
12
+ readonly success: "M8 1.8a6.2 6.2 0 1 0 0 12.4A6.2 6.2 0 0 0 8 1.8Z M4.9 8.2 7 10.3 11.3 5.8";
13
+ /** 三角 + ! */
14
+ readonly warning: "M8 2.2 14.6 13.4H1.4L8 2.2Z M8 6.2v3.4 M8 11.6h.01";
15
+ /** 圆形 + 叉 */
16
+ readonly error: "M8 1.8a6.2 6.2 0 1 0 0 12.4A6.2 6.2 0 0 0 8 1.8Z M5.7 5.7 10.3 10.3 M10.3 5.7 5.7 10.3";
17
+ /** 单独勾 */
18
+ readonly check: "M3.5 8.5 6.8 11.5 12.5 4.8";
19
+ /** 单独叉 */
20
+ readonly close: "M4.4 4.4 11.6 11.6 M11.6 4.4 4.4 11.6";
21
+ /** 圆形 + 问号(confirm 弹窗) */
22
+ readonly question: string;
23
+ };
24
+ export type StatusIconName = keyof typeof STATUS_ICON_PATHS;
25
+ /** 状态提示类型 → 图标名(alert / message / modal / popconfirm 共用) */
26
+ export declare const STATUS_ICON_BY_TYPE: Record<string, StatusIconName>;
27
+ /**
28
+ * 创建线性 SVG 图标元素。用 createElementNS 而非 innerHTML,兼容严格 CSP;
29
+ * 惰性调用,模块顶层不触碰 document(SSR 安全)。
30
+ */
31
+ export declare function createStatusIcon(name: StatusIconName, className?: string): SVGElement;
@@ -0,0 +1 @@
1
+ const e={info:"M8 1.8a6.2 6.2 0 1 0 0 12.4A6.2 6.2 0 0 0 8 1.8Z M8 7.2v4.4 M8 4.8h.01",success:"M8 1.8a6.2 6.2 0 1 0 0 12.4A6.2 6.2 0 0 0 8 1.8Z M4.9 8.2 7 10.3 11.3 5.8",warning:"M8 2.2 14.6 13.4H1.4L8 2.2Z M8 6.2v3.4 M8 11.6h.01",error:"M8 1.8a6.2 6.2 0 1 0 0 12.4A6.2 6.2 0 0 0 8 1.8Z M5.7 5.7 10.3 10.3 M10.3 5.7 5.7 10.3",check:"M3.5 8.5 6.8 11.5 12.5 4.8",close:"M4.4 4.4 11.6 11.6 M11.6 4.4 4.4 11.6",question:"M8 1.8a6.2 6.2 0 1 0 0 12.4A6.2 6.2 0 0 0 8 1.8Z M6.2 6.2a1.9 1.9 0 1 1 2.6 1.8c-.6.3-.8.7-.8 1.4 M8 11.5h.01"},t={info:"info",success:"success",warning:"warning",warn:"warning",error:"error",exception:"error",danger:"error",confirm:"question"};function r(t,r="solely-linear-icon"){const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("class",r),n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false");const s=document.createElementNS("http://www.w3.org/2000/svg","path");return s.setAttribute("d",e[t]),n.appendChild(s),n}export{t as STATUS_ICON_BY_TYPE,e as STATUS_ICON_PATHS,r as createStatusIcon};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./templateError.cjs"),r=require("./gen-function.cjs"),s=require("./functions.cjs"),t=require("./event-listeners.cjs"),o=require("./is-object.cjs"),i=require("./url.cjs"),c=require("./env.cjs"),n=require("./case-convert.cjs"),a=require("./svg-sanitize.cjs");exports.showTemplateError=e.showTemplateError,exports.genFunction=r.genFunction,exports.createFunction=s.createFunction,exports.isCSPBlocked=s.isCSPBlocked,exports.listeners=t.default,exports.isObject=o.isObject,exports.parseHashUrl=i.parseHashUrl,exports.IS_DEV=c.IS_DEV,exports.IS_PROD=c.IS_PROD,exports.SOLELY_VERSION=c.SOLELY_VERSION,exports.camelToKebab=n.camelToKebab,exports.sanitizeSvg=a.sanitizeSvg;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./templateError.cjs"),r=require("./gen-function.cjs"),s=require("./functions.cjs"),t=require("./event-listeners.cjs"),i=require("./is-object.cjs"),o=require("./url.cjs"),a=require("./env.cjs"),c=require("./case-convert.cjs"),n=require("./svg-sanitize.cjs"),p=require("./aria.cjs"),u=require("./size.cjs");exports.showTemplateError=e.showTemplateError,exports.genFunction=r.genFunction,exports.createFunction=s.createFunction,exports.isCSPBlocked=s.isCSPBlocked,exports.listeners=t.default,exports.isObject=i.isObject,exports.parseHashUrl=o.parseHashUrl,exports.IS_DEV=a.IS_DEV,exports.IS_PROD=a.IS_PROD,exports.SOLELY_VERSION=a.SOLELY_VERSION,exports.camelToKebab=c.camelToKebab,exports.sanitizeSvg=n.sanitizeSvg,exports.assertSameTree=p.assertSameTree,exports.createAriaId=p.createAriaId,exports.linkAria=p.linkAria,exports.normalizeSize=u.normalizeSize;
@@ -1,9 +1,11 @@
1
- export * from './templateError';
2
- export * from './gen-function';
3
- export * from './functions';
4
- export { default as listeners } from './event-listeners';
5
- export * from './is-object';
6
- export * from './url';
7
- export * from './env';
8
- export * from './case-convert';
9
- export * from './svg-sanitize';
1
+ export * from './templateError.js';
2
+ export * from './gen-function.js';
3
+ export * from './functions.js';
4
+ export { default as listeners } from './event-listeners.js';
5
+ export * from './is-object.js';
6
+ export * from './url.js';
7
+ export * from './env.js';
8
+ export * from './case-convert.js';
9
+ export * from './svg-sanitize.js';
10
+ export * from './aria.js';
11
+ export * from './size.js';
@@ -1 +1 @@
1
- import{showTemplateError as r}from"./templateError.js";import{genFunction as o}from"./gen-function.js";import{createFunction as t,isCSPBlocked as s}from"./functions.js";import{default as m}from"./event-listeners.js";import{isObject as e}from"./is-object.js";import{parseHashUrl as i}from"./url.js";import{IS_DEV as f,IS_PROD as n,SOLELY_VERSION as p}from"./env.js";import{camelToKebab as j}from"./case-convert.js";import{sanitizeSvg as a}from"./svg-sanitize.js";export{f as IS_DEV,n as IS_PROD,p as SOLELY_VERSION,j as camelToKebab,t as createFunction,o as genFunction,s as isCSPBlocked,e as isObject,m as listeners,i as parseHashUrl,a as sanitizeSvg,r as showTemplateError};
1
+ import{showTemplateError as r}from"./templateError.js";import{genFunction as o}from"./gen-function.js";import{createFunction as m,isCSPBlocked as s}from"./functions.js";import{default as t}from"./event-listeners.js";import{isObject as i}from"./is-object.js";import{parseHashUrl as e}from"./url.js";import{IS_DEV as f,IS_PROD as p,SOLELY_VERSION as j}from"./env.js";import{camelToKebab as n}from"./case-convert.js";import{sanitizeSvg as a}from"./svg-sanitize.js";import{assertSameTree as c,createAriaId as l,linkAria as u}from"./aria.js";import{normalizeSize as v}from"./size.js";export{f as IS_DEV,p as IS_PROD,j as SOLELY_VERSION,c as assertSameTree,n as camelToKebab,l as createAriaId,m as createFunction,o as genFunction,s as isCSPBlocked,i as isObject,u as linkAria,t as listeners,v as normalizeSize,e as parseHashUrl,a as sanitizeSvg,r as showTemplateError};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.normalizeSize=function(e){return"small"===e||"large"===e?e:"medium"};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 组件尺寸的统一语义。
3
+ *
4
+ * 目标档位只有 small / medium / large。
5
+ * middle 与 default 是历史兼容别名,解析时统一归一为 medium,
6
+ * 不再作为独立档位参与样式映射。
7
+ */
8
+ export type CanonicalSize = 'small' | 'medium' | 'large';
9
+ /** 历史兼容别名 */
10
+ export type SizeAlias = 'middle' | 'default';
11
+ /** 对外接受的尺寸输入:标准档位 + 兼容别名 */
12
+ export type SizeInput = CanonicalSize | SizeAlias;
13
+ /**
14
+ * 将组件 size 输入归一为标准档位。
15
+ * 别名与所有非法值都落到 medium,保证渲染与属性读回一致。
16
+ */
17
+ export declare function normalizeSize(value: unknown): CanonicalSize;
@@ -0,0 +1 @@
1
+ function e(e){return"small"===e||"large"===e?e:"medium"}export{e as normalizeSize};
@@ -1,4 +1,4 @@
1
- import { Meta } from '../types';
1
+ import { Meta } from '../types/index.js';
2
2
  /**
3
3
  * 显示模板错误信息,提供友好的错误提示和代码定位
4
4
  * @param error 错误对象
@@ -1,4 +1,4 @@
1
- export * from './ast';
2
- export * from './ir';
3
- export * from './loop';
4
- export * from './lifecycle';
1
+ export * from './ast.js';
2
+ export * from './ir.js';
3
+ export * from './loop.js';
4
+ export * from './lifecycle.js';
@@ -1,4 +1,4 @@
1
- import { ASTType, SourceLocation } from './ast';
1
+ import { ASTType, SourceLocation } from './ast.js';
2
2
  /** IR 属性 */
3
3
  export interface IRAttr {
4
4
  /** key 属性键名 */
package/package.json CHANGED
@@ -1,16 +1,34 @@
1
1
  {
2
2
  "name": "solely",
3
3
  "private": false,
4
- "version": "0.7.0",
4
+ "version": "0.8.0",
5
5
  "description": "A lightweight TypeScript framework for building web components with compile-time optimizations",
6
6
  "type": "module",
7
7
  "sideEffects": [
8
8
  "*.css",
9
9
  "**/*.css?inline",
10
10
  "**/*.css?raw",
11
+ "src/components/theme/index.ts",
12
+ "dist/components/theme/index.js",
13
+ "dist/components/theme/index.cjs",
14
+ "src/components/theme/auto-inject.ts",
15
+ "dist/components/theme/auto-inject.js",
16
+ "dist/components/theme/auto-inject.cjs",
17
+ "src/components/index.ts",
18
+ "dist/components/index.js",
19
+ "dist/components/index.cjs",
20
+ "src/components/elements/index.ts",
21
+ "dist/components/elements/index.js",
22
+ "dist/components/elements/index.cjs",
11
23
  "src/components/elements/*/index.ts",
12
24
  "dist/components/elements/*/index.js",
13
25
  "dist/components/elements/*/index.cjs",
26
+ "src/components/elements/select/option.ts",
27
+ "dist/components/elements/select/option.js",
28
+ "dist/components/elements/select/option.cjs",
29
+ "src/components/commands/index.ts",
30
+ "dist/components/commands/index.js",
31
+ "dist/components/commands/index.cjs",
14
32
  "src/components/commands/*/index.ts",
15
33
  "dist/components/commands/*/index.js",
16
34
  "dist/components/commands/*/index.cjs"
@@ -162,6 +180,8 @@
162
180
  "files": [
163
181
  "dist",
164
182
  "!dist/icons",
183
+ "!dist/build-meta.json",
184
+ "!dist/solely.svg",
165
185
  "README.md",
166
186
  "LICENSE"
167
187
  ],
@@ -221,11 +241,13 @@
221
241
  "format": "prettier --write \"src/**/*.{ts,tsx,js,json,md}\"",
222
242
  "format:check": "prettier --check \"src/**/*.{ts,tsx,js,json,md}\"",
223
243
  "clean": "rimraf dist",
224
- "prebuild": "npm run clean",
244
+ "prebuild": "node scripts/clean-dist.mjs",
225
245
  "check:exports": "node scripts/check-exports.mjs",
226
- "verify": "npm run typecheck && npm run lint && npm run format:check && npm run test:run && npm run build && npm run check:exports",
227
- "prepublishOnly": "npm run build && npm run test:run && npm run check:exports",
228
- "pack:local": "npm run build && npm run check:exports && npm pack && echo '✅ 打包完成,可在其他项目中使用 file: 引用'",
246
+ "check:dist-fresh": "node scripts/check-dist-fresh.mjs",
247
+ "verify": "npm run typecheck && npm run lint && npm run format:check && npm run test:run && npm run build && npm run check:exports && npm run check:dist-fresh",
248
+ "prepublishOnly": "npm run build && npm run test:run && npm run check:exports && npm run check:dist-fresh",
249
+ "prepack": "npm run check:dist-fresh && npm run check:exports",
250
+ "pack:local": "npm run build && npm run check:exports && npm run check:dist-fresh && npm pack && echo '✅ 打包完成,可在其他项目中使用 file: 引用'",
229
251
  "dev:debug": "node --inspect-brk ./node_modules/vite/bin/vite.js",
230
252
  "prepare": "husky"
231
253
  },
@@ -236,15 +258,11 @@
236
258
  "@commitlint/cli": "^19.0.0",
237
259
  "@commitlint/config-conventional": "^19.0.0",
238
260
  "@eslint/js": "^9.39.4",
239
- "@rollup/plugin-strip": "^3.0.4",
240
- "@testing-library/dom": "^10.4.1",
241
- "@testing-library/user-event": "^14.6.1",
242
261
  "@types/node": "^22.10.2",
243
262
  "@typescript-eslint/eslint-plugin": "^8.71.2",
244
263
  "@typescript-eslint/parser": "^8.71.2",
245
264
  "@vitest/coverage-v8": "^3.2.4",
246
265
  "@vitest/ui": "^3.2.4",
247
- "cpx": "^1.5.0",
248
266
  "eslint": "^9.39.4",
249
267
  "globals": "^16.5.0",
250
268
  "husky": "^9.0.0",
@@ -252,9 +270,7 @@
252
270
  "lint-staged": "^15.0.0",
253
271
  "prettier": "^3.0.0",
254
272
  "rimraf": "^5.0.10",
255
- "sass": "^1.83.0",
256
273
  "terser": "^5.44.0",
257
- "tsup": "^8.5.1",
258
274
  "typescript": "^5.9.3",
259
275
  "vite": "^7.3.7",
260
276
  "vite-plugin-dts": "^4.5.4",