@qw-ui/core 0.3.0-next.40 → 0.3.0-next.43

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 (402) hide show
  1. package/README.md +21 -37
  2. package/dist/action-sheet/action-sheet.d.ts +110 -0
  3. package/dist/action-sheet/index.d.ts +2 -0
  4. package/dist/action-sheet/index.js +2 -0
  5. package/dist/action-sheet-Cvcr1S_m.js +183 -0
  6. package/dist/action-sheet-Cvcr1S_m.js.map +1 -0
  7. package/dist/area-picker/area-picker.d.ts +113 -0
  8. package/dist/area-picker/index.d.ts +1 -0
  9. package/dist/area-picker/index.js +348 -0
  10. package/dist/area-picker/index.js.map +1 -0
  11. package/dist/aria-description-CimD2M_C.js +13 -0
  12. package/dist/aria-description-CimD2M_C.js.map +1 -0
  13. package/dist/aria-description.d.ts +2 -0
  14. package/dist/avatar/avatar-load.d.ts +76 -0
  15. package/dist/avatar/avatar.d.ts +22 -5
  16. package/dist/avatar/index.d.ts +1 -0
  17. package/dist/avatar/index.js +57 -18
  18. package/dist/avatar/index.js.map +1 -1
  19. package/dist/avatar-load-w9dq05oV.js +139 -0
  20. package/dist/avatar-load-w9dq05oV.js.map +1 -0
  21. package/dist/back-top/back-top.d.ts +77 -0
  22. package/dist/back-top/index.d.ts +1 -0
  23. package/dist/back-top/index.js +189 -0
  24. package/dist/back-top/index.js.map +1 -0
  25. package/dist/badge/badge.d.ts +9 -0
  26. package/dist/badge/index.js +14 -1
  27. package/dist/badge/index.js.map +1 -1
  28. package/dist/button/button.d.ts +13 -0
  29. package/dist/button/index.js +3 -5
  30. package/dist/button/index.js.map +1 -1
  31. package/dist/calendar/calendar.d.ts +100 -0
  32. package/dist/calendar/index.d.ts +1 -0
  33. package/dist/calendar/index.js +2 -0
  34. package/dist/calendar-CmpK3stz.js +363 -0
  35. package/dist/calendar-CmpK3stz.js.map +1 -0
  36. package/dist/card/card.d.ts +68 -0
  37. package/dist/card/index.d.ts +2 -0
  38. package/dist/card/index.js +2 -0
  39. package/dist/card-DRtWa6Cr.js +107 -0
  40. package/dist/card-DRtWa6Cr.js.map +1 -0
  41. package/dist/cascader/cascader.d.ts +115 -0
  42. package/dist/cascader/index.d.ts +1 -0
  43. package/dist/cascader/index.js +2 -0
  44. package/dist/cascader-D-xMjs7P.js +333 -0
  45. package/dist/cascader-D-xMjs7P.js.map +1 -0
  46. package/dist/cell/cell.d.ts +41 -0
  47. package/dist/cell/index.d.ts +1 -0
  48. package/dist/cell/index.js +43 -0
  49. package/dist/cell/index.js.map +1 -0
  50. package/dist/check-list/check-list.d.ts +78 -0
  51. package/dist/check-list/index.d.ts +2 -0
  52. package/dist/check-list/index.js +2 -0
  53. package/dist/check-list-BvZHQt5w.js +60 -0
  54. package/dist/check-list-BvZHQt5w.js.map +1 -0
  55. package/dist/checkbox/checkbox.d.ts +59 -0
  56. package/dist/checkbox/index.d.ts +2 -0
  57. package/dist/checkbox/index.js +2 -0
  58. package/dist/checkbox-BlndJrz5.js +127 -0
  59. package/dist/checkbox-BlndJrz5.js.map +1 -0
  60. package/dist/checkbox-group/checkbox-group.d.ts +86 -0
  61. package/dist/checkbox-group/index.d.ts +3 -0
  62. package/dist/checkbox-group/index.js +2 -0
  63. package/dist/checkbox-group-gGfsTv-e.js +223 -0
  64. package/dist/checkbox-group-gGfsTv-e.js.map +1 -0
  65. package/dist/choice-group-C4c9m0qe.js +373 -0
  66. package/dist/choice-group-C4c9m0qe.js.map +1 -0
  67. package/dist/circle/circle.d.ts +97 -0
  68. package/dist/circle/index.d.ts +1 -0
  69. package/dist/circle/index.js +119 -0
  70. package/dist/circle/index.js.map +1 -0
  71. package/dist/collapse/collapse.d.ts +98 -0
  72. package/dist/collapse/index.d.ts +2 -0
  73. package/dist/collapse/index.js +2 -0
  74. package/dist/collapse-B969h7-H.js +226 -0
  75. package/dist/collapse-B969h7-H.js.map +1 -0
  76. package/dist/countdown/countdown.d.ts +114 -0
  77. package/dist/countdown/index.d.ts +1 -0
  78. package/dist/countdown/index.js +309 -0
  79. package/dist/countdown/index.js.map +1 -0
  80. package/dist/date-picker/date-picker.d.ts +168 -0
  81. package/dist/date-picker/index.d.ts +1 -0
  82. package/dist/date-picker/index.js +401 -0
  83. package/dist/date-picker/index.js.map +1 -0
  84. package/dist/descriptions/descriptions.d.ts +69 -0
  85. package/dist/descriptions/index.d.ts +1 -0
  86. package/dist/descriptions/index.js +86 -0
  87. package/dist/descriptions/index.js.map +1 -0
  88. package/dist/dialog/dialog.d.ts +32 -3
  89. package/dist/dialog/index.js +58 -3
  90. package/dist/dialog/index.js.map +1 -1
  91. package/dist/divider/divider.d.ts +18 -2
  92. package/dist/divider/index.js +20 -2
  93. package/dist/divider/index.js.map +1 -1
  94. package/dist/dropdown/dropdown.d.ts +172 -0
  95. package/dist/dropdown/index.d.ts +2 -0
  96. package/dist/dropdown/index.js +467 -0
  97. package/dist/dropdown/index.js.map +1 -0
  98. package/dist/ellipsis/ellipsis-layout.d.ts +34 -0
  99. package/dist/ellipsis/ellipsis.d.ts +88 -0
  100. package/dist/ellipsis/index.d.ts +2 -0
  101. package/dist/ellipsis/index.js +320 -0
  102. package/dist/ellipsis/index.js.map +1 -0
  103. package/dist/empty/empty-illustration.d.ts +3 -0
  104. package/dist/empty/empty.d.ts +43 -1
  105. package/dist/empty/index.js +2 -21
  106. package/dist/empty-CAgyvhUI.js +166 -0
  107. package/dist/empty-CAgyvhUI.js.map +1 -0
  108. package/dist/field/field.d.ts +95 -0
  109. package/dist/field/index.d.ts +2 -0
  110. package/dist/field/index.js +2 -0
  111. package/dist/field-DMHGIMZF.js +241 -0
  112. package/dist/field-DMHGIMZF.js.map +1 -0
  113. package/dist/floating-bubble/floating-bubble.d.ts +116 -0
  114. package/dist/floating-bubble/index.d.ts +1 -0
  115. package/dist/floating-bubble/index.js +333 -0
  116. package/dist/floating-bubble/index.js.map +1 -0
  117. package/dist/floating-panel/floating-panel.d.ts +80 -0
  118. package/dist/floating-panel/index.d.ts +2 -0
  119. package/dist/floating-panel/index.js +2 -0
  120. package/dist/floating-panel-Cbm5njBJ.js +363 -0
  121. package/dist/floating-panel-Cbm5njBJ.js.map +1 -0
  122. package/dist/footer/footer.d.ts +94 -0
  123. package/dist/footer/index.d.ts +1 -0
  124. package/dist/footer/index.js +154 -0
  125. package/dist/footer/index.js.map +1 -0
  126. package/dist/form/connect.d.ts +6 -0
  127. package/dist/form/form.d.ts +100 -0
  128. package/dist/form/ids.d.ts +14 -0
  129. package/dist/form/index.d.ts +13 -0
  130. package/dist/form/index.js +3 -0
  131. package/dist/form/methods.d.ts +5 -0
  132. package/dist/form/model.d.ts +24 -0
  133. package/dist/form/native.d.ts +25 -0
  134. package/dist/form/rules.d.ts +40 -0
  135. package/dist/form/ssr.d.ts +7 -0
  136. package/dist/form/types.d.ts +150 -0
  137. package/dist/form-BAGkIEMY.js +1354 -0
  138. package/dist/form-BAGkIEMY.js.map +1 -0
  139. package/dist/format-BDUY0C_c.js +89 -0
  140. package/dist/format-BDUY0C_c.js.map +1 -0
  141. package/dist/gesture-_SRHIvBm.js +30 -0
  142. package/dist/gesture-_SRHIvBm.js.map +1 -0
  143. package/dist/grid/grid-item.d.ts +22 -0
  144. package/dist/grid/grid.d.ts +42 -0
  145. package/dist/grid/index.d.ts +2 -0
  146. package/dist/grid/index.js +73 -0
  147. package/dist/grid/index.js.map +1 -0
  148. package/dist/icon/icon.d.ts +37 -1
  149. package/dist/icon/identity.d.ts +3 -0
  150. package/dist/icon/index.js +2 -20
  151. package/dist/icon-Cgdbnk1u.js +77 -0
  152. package/dist/icon-Cgdbnk1u.js.map +1 -0
  153. package/dist/image/image-load.d.ts +24 -0
  154. package/dist/image/image.d.ts +45 -8
  155. package/dist/image/index.d.ts +1 -0
  156. package/dist/image/index.js +116 -14
  157. package/dist/image/index.js.map +1 -1
  158. package/dist/image-preview/image-preview.d.ts +124 -0
  159. package/dist/image-preview/index.d.ts +1 -0
  160. package/dist/image-preview/index.js +450 -0
  161. package/dist/image-preview/index.js.map +1 -0
  162. package/dist/index-bar/index-bar.d.ts +121 -0
  163. package/dist/index-bar/index.d.ts +1 -0
  164. package/dist/index-bar/index.js +386 -0
  165. package/dist/index-bar/index.js.map +1 -0
  166. package/dist/index.d.ts +107 -14
  167. package/dist/index.js +148 -14
  168. package/dist/index.js.map +1 -0
  169. package/dist/infinite-scroll/index.d.ts +1 -0
  170. package/dist/infinite-scroll/index.js +248 -0
  171. package/dist/infinite-scroll/index.js.map +1 -0
  172. package/dist/infinite-scroll/infinite-scroll.d.ts +95 -0
  173. package/dist/input/index.js +181 -22
  174. package/dist/input/index.js.map +1 -1
  175. package/dist/input/input.d.ts +44 -1
  176. package/dist/layer-IpFrl5--.js +414 -0
  177. package/dist/layer-IpFrl5--.js.map +1 -0
  178. package/dist/layout-BRSqi4AQ.js +43 -0
  179. package/dist/layout-BRSqi4AQ.js.map +1 -0
  180. package/dist/layout.d.ts +13 -0
  181. package/dist/list/index.d.ts +2 -0
  182. package/dist/list/index.js +2 -0
  183. package/dist/list/list.d.ts +30 -0
  184. package/dist/list-6-iz-Irh.js +28 -0
  185. package/dist/list-6-iz-Irh.js.map +1 -0
  186. package/dist/loading/index.js +45 -2
  187. package/dist/loading/index.js.map +1 -1
  188. package/dist/loading/loading.d.ts +45 -2
  189. package/dist/modal-dialog-machine-CF9_z3Dm.js +487 -0
  190. package/dist/modal-dialog-machine-CF9_z3Dm.js.map +1 -0
  191. package/dist/modal-dialog-machine.d.ts +21 -0
  192. package/dist/modal-dismissable-lifetime.d.ts +21 -0
  193. package/dist/modal-registry.d.ts +24 -0
  194. package/dist/modal-render-hydration.d.ts +35 -0
  195. package/dist/modal-render-runtime.d.ts +19 -0
  196. package/dist/modal-render-scope.d.ts +63 -0
  197. package/dist/nav-bar/index.d.ts +1 -0
  198. package/dist/nav-bar/index.js +115 -0
  199. package/dist/nav-bar/index.js.map +1 -0
  200. package/dist/nav-bar/nav-bar.d.ts +76 -0
  201. package/dist/notice-bar/index.d.ts +2 -0
  202. package/dist/notice-bar/index.js +2 -0
  203. package/dist/notice-bar/notice-bar.d.ts +103 -0
  204. package/dist/notice-bar-DMpwLvRb.js +231 -0
  205. package/dist/notice-bar-DMpwLvRb.js.map +1 -0
  206. package/dist/notify/index.d.ts +1 -0
  207. package/dist/notify/index.js +251 -0
  208. package/dist/notify/index.js.map +1 -0
  209. package/dist/notify/notify.d.ts +123 -0
  210. package/dist/number-keyboard/index.d.ts +1 -0
  211. package/dist/number-keyboard/index.js +333 -0
  212. package/dist/number-keyboard/index.js.map +1 -0
  213. package/dist/number-keyboard/number-keyboard.d.ts +141 -0
  214. package/dist/page-indicator/index.d.ts +1 -0
  215. package/dist/page-indicator/index.js +138 -0
  216. package/dist/page-indicator/index.js.map +1 -0
  217. package/dist/page-indicator/page-indicator.d.ts +93 -0
  218. package/dist/pagination/index.d.ts +1 -0
  219. package/dist/pagination/index.js +198 -0
  220. package/dist/pagination/index.js.map +1 -0
  221. package/dist/pagination/pagination.d.ts +125 -0
  222. package/dist/password-input/index.d.ts +1 -0
  223. package/dist/password-input/index.js +317 -0
  224. package/dist/password-input/index.js.map +1 -0
  225. package/dist/password-input/password-input.d.ts +144 -0
  226. package/dist/picker/index.d.ts +8 -0
  227. package/dist/picker/index.js +2 -0
  228. package/dist/picker/picker-machine.d.ts +80 -0
  229. package/dist/picker/picker.d.ts +121 -0
  230. package/dist/picker/platform.d.ts +84 -0
  231. package/dist/picker/selection-connect.d.ts +90 -0
  232. package/dist/picker/selection-model.d.ts +211 -0
  233. package/dist/picker-BykFntQN.js +1675 -0
  234. package/dist/picker-BykFntQN.js.map +1 -0
  235. package/dist/popover/index.d.ts +3 -0
  236. package/dist/popover/index.js +253 -0
  237. package/dist/popover/index.js.map +1 -0
  238. package/dist/popover/layer.d.ts +44 -0
  239. package/dist/popover/popover.d.ts +104 -0
  240. package/dist/popover/positioning.d.ts +132 -0
  241. package/dist/popup/index.d.ts +2 -0
  242. package/dist/popup/index.js +2 -0
  243. package/dist/popup/popup.d.ts +60 -0
  244. package/dist/popup-z5d8IYCt.js +576 -0
  245. package/dist/popup-z5d8IYCt.js.map +1 -0
  246. package/dist/portal-BHCNTWhg.js +78 -0
  247. package/dist/portal-BHCNTWhg.js.map +1 -0
  248. package/dist/portal.d.ts +61 -0
  249. package/dist/price/format.d.ts +19 -0
  250. package/dist/price/index.d.ts +1 -0
  251. package/dist/price/index.js +154 -0
  252. package/dist/price/index.js.map +1 -0
  253. package/dist/price/price.d.ts +88 -0
  254. package/dist/progress/index.d.ts +1 -0
  255. package/dist/progress/index.js +2 -0
  256. package/dist/progress/progress.d.ts +32 -0
  257. package/dist/progress-f3iYEfdA.js +37 -0
  258. package/dist/progress-f3iYEfdA.js.map +1 -0
  259. package/dist/pull-refresh/index.d.ts +1 -0
  260. package/dist/pull-refresh/index.js +414 -0
  261. package/dist/pull-refresh/index.js.map +1 -0
  262. package/dist/pull-refresh/pull-refresh.d.ts +118 -0
  263. package/dist/radio-group/index.d.ts +3 -0
  264. package/dist/radio-group/index.js +2 -0
  265. package/dist/radio-group/radio-group.d.ts +78 -0
  266. package/dist/radio-group-BOIMuqnS.js +230 -0
  267. package/dist/radio-group-BOIMuqnS.js.map +1 -0
  268. package/dist/rate/index.d.ts +1 -0
  269. package/dist/rate/index.js +2 -0
  270. package/dist/rate/rate-form.d.ts +28 -0
  271. package/dist/rate/rate.d.ts +144 -0
  272. package/dist/rate-5XsU2QkY.js +631 -0
  273. package/dist/rate-5XsU2QkY.js.map +1 -0
  274. package/dist/reorder/index.d.ts +1 -0
  275. package/dist/reorder/index.js +720 -0
  276. package/dist/reorder/index.js.map +1 -0
  277. package/dist/reorder/reorder.d.ts +190 -0
  278. package/dist/result/index.d.ts +1 -0
  279. package/dist/result/index.js +123 -0
  280. package/dist/result/index.js.map +1 -0
  281. package/dist/result/result.d.ts +88 -0
  282. package/dist/safe-area/index.d.ts +1 -0
  283. package/dist/safe-area/index.js +42 -0
  284. package/dist/safe-area/index.js.map +1 -0
  285. package/dist/safe-area/safe-area.d.ts +28 -0
  286. package/dist/search-bar/index.js +3 -1
  287. package/dist/search-bar/index.js.map +1 -1
  288. package/dist/search-bar/search-bar.d.ts +4 -0
  289. package/dist/segmented/index.d.ts +2 -0
  290. package/dist/segmented/index.js +2 -0
  291. package/dist/segmented/segmented.d.ts +127 -0
  292. package/dist/segmented-BaU38_L4.js +367 -0
  293. package/dist/segmented-BaU38_L4.js.map +1 -0
  294. package/dist/selection-form-BOM_odUk.js +88 -0
  295. package/dist/selection-form-BOM_odUk.js.map +1 -0
  296. package/dist/selection-form.d.ts +27 -0
  297. package/dist/selection-ivXqO1eu.js +55 -0
  298. package/dist/selection-ivXqO1eu.js.map +1 -0
  299. package/dist/selection.d.ts +29 -0
  300. package/dist/selector/choice-group.d.ts +114 -0
  301. package/dist/selector/index.d.ts +2 -0
  302. package/dist/selector/index.js +2 -0
  303. package/dist/selector/selector.d.ts +90 -0
  304. package/dist/selector-BU2MMJ4N.js +93 -0
  305. package/dist/selector-BU2MMJ4N.js.map +1 -0
  306. package/dist/share-sheet/index.d.ts +1 -0
  307. package/dist/share-sheet/index.js +138 -0
  308. package/dist/share-sheet/index.js.map +1 -0
  309. package/dist/share-sheet/share-sheet.d.ts +139 -0
  310. package/dist/skeleton/index.js +51 -2
  311. package/dist/skeleton/index.js.map +1 -1
  312. package/dist/skeleton/skeleton.d.ts +34 -3
  313. package/dist/slider/index.d.ts +1 -0
  314. package/dist/slider/index.js +482 -0
  315. package/dist/slider/index.js.map +1 -0
  316. package/dist/slider/slider.d.ts +174 -0
  317. package/dist/space/index.d.ts +1 -0
  318. package/dist/space/index.js +52 -0
  319. package/dist/space/index.js.map +1 -0
  320. package/dist/space/space.d.ts +46 -0
  321. package/dist/statistic/index.d.ts +1 -0
  322. package/dist/statistic/index.js +152 -0
  323. package/dist/statistic/index.js.map +1 -0
  324. package/dist/statistic/statistic.d.ts +101 -0
  325. package/dist/stepper/index.js +62 -3
  326. package/dist/stepper/index.js.map +1 -1
  327. package/dist/stepper/stepper.d.ts +44 -4
  328. package/dist/steps/index.d.ts +1 -0
  329. package/dist/steps/index.js +72 -0
  330. package/dist/steps/index.js.map +1 -0
  331. package/dist/steps/steps.d.ts +67 -0
  332. package/dist/sticky/index.d.ts +1 -0
  333. package/dist/sticky/index.js +145 -0
  334. package/dist/sticky/index.js.map +1 -0
  335. package/dist/sticky/sticky.d.ts +70 -0
  336. package/dist/swipe-action/index.d.ts +1 -0
  337. package/dist/swipe-action/index.js +417 -0
  338. package/dist/swipe-action/index.js.map +1 -0
  339. package/dist/swipe-action/swipe-action.d.ts +148 -0
  340. package/dist/swiper/gesture.d.ts +32 -0
  341. package/dist/swiper/index.d.ts +1 -0
  342. package/dist/swiper/index.js +2 -0
  343. package/dist/swiper/swiper.d.ts +177 -0
  344. package/dist/swiper-BKivDkHp.js +550 -0
  345. package/dist/swiper-BKivDkHp.js.map +1 -0
  346. package/dist/switch/index.js +135 -10
  347. package/dist/switch/index.js.map +1 -1
  348. package/dist/switch/switch.d.ts +93 -6
  349. package/dist/tabbar/index.js +46 -1
  350. package/dist/tabbar/index.js.map +1 -1
  351. package/dist/tabbar/tabbar.d.ts +50 -0
  352. package/dist/tabs/index.js +22 -1
  353. package/dist/tabs/index.js.map +1 -1
  354. package/dist/tabs/tabs.d.ts +12 -8
  355. package/dist/tag/index.js +123 -2
  356. package/dist/tag/index.js.map +1 -1
  357. package/dist/tag/tag.d.ts +67 -1
  358. package/dist/textarea/index.d.ts +2 -0
  359. package/dist/textarea/index.js +2 -242
  360. package/dist/textarea/platform.d.ts +22 -0
  361. package/dist/textarea/textarea.d.ts +165 -46
  362. package/dist/textarea-qbnruDUG.js +775 -0
  363. package/dist/textarea-qbnruDUG.js.map +1 -0
  364. package/dist/time-picker/index.d.ts +1 -0
  365. package/dist/time-picker/index.js +228 -0
  366. package/dist/time-picker/index.js.map +1 -0
  367. package/dist/time-picker/time-picker.d.ts +83 -0
  368. package/dist/timeline/index.d.ts +1 -0
  369. package/dist/timeline/index.js +131 -0
  370. package/dist/timeline/index.js.map +1 -0
  371. package/dist/timeline/timeline.d.ts +79 -0
  372. package/dist/toast/index.js +47 -4
  373. package/dist/toast/index.js.map +1 -1
  374. package/dist/toast/toast.d.ts +26 -3
  375. package/dist/top-bar/index.js +16 -2
  376. package/dist/top-bar/index.js.map +1 -1
  377. package/dist/top-bar/top-bar.d.ts +13 -2
  378. package/dist/tree-select/index.d.ts +1 -0
  379. package/dist/tree-select/index.js +512 -0
  380. package/dist/tree-select/index.js.map +1 -0
  381. package/dist/tree-select/tree-select.d.ts +215 -0
  382. package/dist/typography/index.d.ts +1 -0
  383. package/dist/typography/index.js +82 -0
  384. package/dist/typography/index.js.map +1 -0
  385. package/dist/typography/typography.d.ts +54 -0
  386. package/dist/upload/index.d.ts +1 -0
  387. package/dist/upload/index.js +458 -0
  388. package/dist/upload/index.js.map +1 -0
  389. package/dist/upload/upload.d.ts +172 -0
  390. package/dist/virtual-list/index.d.ts +1 -0
  391. package/dist/virtual-list/index.js +445 -0
  392. package/dist/virtual-list/index.js.map +1 -0
  393. package/dist/virtual-list/virtual-list.d.ts +160 -0
  394. package/dist/visual-manifest.d.ts +6 -0
  395. package/dist/watermark/index.d.ts +1 -0
  396. package/dist/watermark/index.js +260 -0
  397. package/dist/watermark/index.js.map +1 -0
  398. package/dist/watermark/watermark.d.ts +106 -0
  399. package/package.json +399 -50
  400. package/dist/empty/index.js.map +0 -1
  401. package/dist/icon/index.js.map +0 -1
  402. package/dist/textarea/index.js.map +0 -1
@@ -0,0 +1,95 @@
1
+ import { type QwNamePath } from "../form/model.js";
2
+ export declare const FIELD_LABEL_MODES: readonly ["label", "control", "custom"];
3
+ export declare const FIELD_LAYOUTS: readonly ["stacked", "inline"];
4
+ export declare const FIELD_PARTS: readonly ["root", "label", "required", "control", "description", "error", "status"];
5
+ export type FieldLabelMode = (typeof FIELD_LABEL_MODES)[number];
6
+ export type FieldLayout = (typeof FIELD_LAYOUTS)[number];
7
+ /** Pure association/feedback container; Form owns value and validation. */
8
+ export interface QwFieldProps {
9
+ /** Adapters supply an SSR-safe identity when omitted. */
10
+ id?: string;
11
+ name?: QwNamePath;
12
+ label?: string;
13
+ description?: string;
14
+ errors?: string[];
15
+ controlId?: string;
16
+ /** label links an actual labelable input; control avoids duplicate own names. */
17
+ labelMode?: FieldLabelMode;
18
+ required?: boolean;
19
+ disabled?: boolean;
20
+ invalid?: boolean;
21
+ validating?: boolean;
22
+ layout?: FieldLayout;
23
+ validatingLabel?: string;
24
+ }
25
+ export interface ResolvedFieldState {
26
+ id: string;
27
+ key?: string;
28
+ label: string;
29
+ description: string;
30
+ errors: string[];
31
+ controlId?: string;
32
+ labelMode: FieldLabelMode;
33
+ labelTag: "label" | "span";
34
+ layout: FieldLayout;
35
+ required: boolean;
36
+ disabled: boolean;
37
+ invalid: boolean;
38
+ validating: boolean;
39
+ validatingLabel: string;
40
+ labelId: string;
41
+ descriptionId: string;
42
+ errorId: string;
43
+ statusId: string;
44
+ describedBy?: string;
45
+ }
46
+ export declare function resolveFieldState(props: QwFieldProps): ResolvedFieldState;
47
+ export declare function getFieldRootProps(state: ResolvedFieldState): {
48
+ "data-scope": "field";
49
+ "data-part": string;
50
+ id: string;
51
+ "data-field-key": string | undefined;
52
+ "data-label-mode": "control" | "custom" | "label";
53
+ "data-layout": "inline" | "stacked";
54
+ "data-required": string | undefined;
55
+ "data-disabled": string | undefined;
56
+ "data-invalid": string | undefined;
57
+ "aria-busy": true | undefined;
58
+ };
59
+ export declare function getFieldLabelProps(state: ResolvedFieldState): {
60
+ "data-scope": "field";
61
+ "data-part": string;
62
+ id: string;
63
+ htmlFor: string | undefined;
64
+ hidden: boolean;
65
+ };
66
+ export declare function getFieldRequiredProps(state: ResolvedFieldState): {
67
+ "data-scope": "field";
68
+ "data-part": string;
69
+ hidden: boolean;
70
+ "aria-hidden": boolean;
71
+ };
72
+ export declare function getFieldControlProps(_state: ResolvedFieldState): {
73
+ "data-scope": "field";
74
+ "data-part": string;
75
+ };
76
+ export declare function getFieldDescriptionProps(state: ResolvedFieldState): {
77
+ "data-scope": "field";
78
+ "data-part": string;
79
+ id: string;
80
+ hidden: boolean;
81
+ };
82
+ export declare function getFieldErrorProps(state: ResolvedFieldState): {
83
+ "data-scope": "field";
84
+ "data-part": string;
85
+ id: string;
86
+ role: "alert";
87
+ hidden: boolean;
88
+ };
89
+ export declare function getFieldStatusProps(state: ResolvedFieldState): {
90
+ "data-scope": "field";
91
+ "data-part": string;
92
+ id: string;
93
+ role: "status";
94
+ hidden: boolean;
95
+ };
@@ -0,0 +1,2 @@
1
+ export { FIELD_LABEL_MODES, FIELD_LAYOUTS, FIELD_PARTS, resolveFieldState, getFieldRootProps, getFieldLabelProps, getFieldRequiredProps, getFieldControlProps, getFieldDescriptionProps, getFieldErrorProps, getFieldStatusProps } from "./field.js";
2
+ export type { FieldLabelMode, FieldLayout, QwFieldProps, ResolvedFieldState } from "./field.js";
@@ -0,0 +1,2 @@
1
+ import { a as getFieldDescriptionProps, c as getFieldRequiredProps, d as resolveFieldState, i as getFieldControlProps, l as getFieldRootProps, n as FIELD_LAYOUTS, o as getFieldErrorProps, r as FIELD_PARTS, s as getFieldLabelProps, t as FIELD_LABEL_MODES, u as getFieldStatusProps } from "../field-DMHGIMZF.js";
2
+ export { FIELD_LABEL_MODES, FIELD_LAYOUTS, FIELD_PARTS, getFieldControlProps, getFieldDescriptionProps, getFieldErrorProps, getFieldLabelProps, getFieldRequiredProps, getFieldRootProps, getFieldStatusProps, resolveFieldState };
@@ -0,0 +1,241 @@
1
+ //#region src/form/model.ts
2
+ const forbidden = /* @__PURE__ */ new Set([
3
+ "__proto__",
4
+ "constructor",
5
+ "prototype"
6
+ ]);
7
+ const plain = (value) => !!value && typeof value === "object" && !Array.isArray(value) && [Object.prototype, null].includes(Object.getPrototypeOf(value));
8
+ /** Strings are literal single segments, never implicit dot/bracket parsing. */
9
+ function normalizeFormNamePath(name) {
10
+ const path = typeof name === "string" ? [name] : Array.isArray(name) ? [...name] : [];
11
+ if (!path.length || path.length > 64 || path.some((segment) => typeof segment === "string" ? !segment.length || forbidden.has(segment) : typeof segment !== "number" || !Number.isSafeInteger(segment) || segment < 0)) throw new TypeError("Form name paths require nonempty safe string/integer segments without prototype names");
12
+ return path;
13
+ }
14
+ function formFieldKey(name) {
15
+ return JSON.stringify(normalizeFormNamePath(name));
16
+ }
17
+ function formFieldNativeName(name) {
18
+ return normalizeFormNamePath(name).map((segment, index) => index ? `[${segment}]` : String(segment)).join("");
19
+ }
20
+ function copy(value, ancestors, depth) {
21
+ if (depth > 64) throw new TypeError("Form values exceed maximum depth");
22
+ if (value === null || typeof value === "string" || typeof value === "boolean") return value;
23
+ if (typeof value === "number" && Number.isFinite(value)) return value;
24
+ if (!Array.isArray(value) && !plain(value)) throw new TypeError("Form values must be finite plain JSON without undefined, classes or functions");
25
+ if (ancestors.has(value)) throw new TypeError("Cyclic Form values");
26
+ ancestors.add(value);
27
+ let result;
28
+ if (Array.isArray(value)) {
29
+ const entries = [];
30
+ for (let index = 0; index < value.length; index++) {
31
+ if (!Object.hasOwn(value, index)) throw new TypeError("Form JSON arrays must be dense");
32
+ entries.push(copy(value[index], ancestors, depth + 1));
33
+ }
34
+ result = entries;
35
+ } else result = Object.fromEntries(Object.entries(value).map(([key, child]) => [key, copy(child, ancestors, depth + 1)]));
36
+ ancestors.delete(value);
37
+ return result;
38
+ }
39
+ function cloneFormValue(value) {
40
+ return copy(value, /* @__PURE__ */ new Set(), 0);
41
+ }
42
+ function cloneFormValues(values = {}) {
43
+ if (!plain(values)) throw new TypeError("Form values root must be a plain record");
44
+ return cloneFormValue(values);
45
+ }
46
+ /** Fresh recursively frozen validator snapshot; never freeze caller storage. */
47
+ function freezeFormValues(values) {
48
+ const freeze = (value) => {
49
+ if (value && typeof value === "object") {
50
+ Object.values(value).forEach(freeze);
51
+ Object.freeze(value);
52
+ }
53
+ };
54
+ const cloned = cloneFormValues(values);
55
+ freeze(cloned);
56
+ return cloned;
57
+ }
58
+ /** Canonical comparison keeps object key order from manufacturing dirty changes. */
59
+ function formValueFingerprint(value) {
60
+ const canonical = (node) => Array.isArray(node) ? node.map(canonical) : plain(node) ? Object.fromEntries(Object.keys(node).sort().map((key) => [key, canonical(node[key])])) : node;
61
+ return value === void 0 ? "undefined" : JSON.stringify(canonical(value));
62
+ }
63
+ function formValuesEqual(a, b) {
64
+ return !!b && formValueFingerprint(a) === formValueFingerprint(b);
65
+ }
66
+ function getFormValue(values, name) {
67
+ let current = values;
68
+ for (const segment of normalizeFormNamePath(name)) {
69
+ if (!current || typeof current !== "object" || Array.isArray(current) && typeof segment !== "number" || !Object.hasOwn(current, segment)) return void 0;
70
+ current = current[segment];
71
+ }
72
+ return current === void 0 ? void 0 : cloneFormValue(current);
73
+ }
74
+ function hasFormValue(values, name) {
75
+ return getFormValue(values, name) !== void 0;
76
+ }
77
+ /** Immutable path update. Dense arrays retain explicit JSON semantics. */
78
+ function setFormValue(values, name, value) {
79
+ const path = normalizeFormNamePath(name), result = cloneFormValues(values), nextValue = value === void 0 ? void 0 : cloneFormValue(value);
80
+ let current = result;
81
+ for (let index = 0; index < path.length; index++) {
82
+ const segment = path[index], last = index === path.length - 1;
83
+ if (Array.isArray(current)) {
84
+ if (typeof segment !== "number" || segment > 4294967293) throw new TypeError("Form array paths require valid numeric indexes");
85
+ if (segment - current.length > 1e4) throw new RangeError("Form sparse array expansion exceeds 10000 missing positions");
86
+ if (last && nextValue === void 0) {
87
+ if (segment < current.length) current.splice(segment, 1);
88
+ break;
89
+ }
90
+ while (current.length <= segment) current.push(null);
91
+ }
92
+ const record = current;
93
+ if (last) {
94
+ if (nextValue === void 0) delete record[segment];
95
+ else Object.defineProperty(record, segment, {
96
+ value: nextValue,
97
+ enumerable: true,
98
+ configurable: true,
99
+ writable: true
100
+ });
101
+ break;
102
+ }
103
+ const existing = record[segment];
104
+ if (!(Array.isArray(existing) || plain(existing))) {
105
+ const child = typeof path[index + 1] === "number" ? [] : {};
106
+ Object.defineProperty(record, segment, {
107
+ value: child,
108
+ enumerable: true,
109
+ configurable: true,
110
+ writable: true
111
+ });
112
+ }
113
+ current = record[segment];
114
+ }
115
+ return result;
116
+ }
117
+ /** Object recursion, array replacement; all inputs and outputs are independent. */
118
+ function mergeFormValues(values, patch) {
119
+ const result = cloneFormValues(values), safePatch = cloneFormValues(patch);
120
+ const merge = (target, source) => {
121
+ for (const [key, value] of Object.entries(source)) if (plain(value) && plain(target[key])) merge(target[key], value);
122
+ else Object.defineProperty(target, key, {
123
+ value,
124
+ enumerable: true,
125
+ configurable: true,
126
+ writable: true
127
+ });
128
+ };
129
+ merge(result, safePatch);
130
+ return result;
131
+ }
132
+ //#endregion
133
+ //#region src/field/field.ts
134
+ const FIELD_LABEL_MODES = [
135
+ "label",
136
+ "control",
137
+ "custom"
138
+ ];
139
+ const FIELD_LAYOUTS = ["stacked", "inline"];
140
+ const FIELD_PARTS = [
141
+ "root",
142
+ "label",
143
+ "required",
144
+ "control",
145
+ "description",
146
+ "error",
147
+ "status"
148
+ ];
149
+ const part = (name) => ({
150
+ "data-scope": "field",
151
+ "data-part": name
152
+ });
153
+ function resolveFieldState(props) {
154
+ if (typeof props.id !== "string" || !props.id.trim()) throw new TypeError("Field requires a nonempty stable identity");
155
+ const labelMode = FIELD_LABEL_MODES.includes(props.labelMode) ? props.labelMode : "label";
156
+ const label = props.label ?? "";
157
+ if (labelMode !== "control" && !label.trim()) throw new TypeError("Field requires a nonempty label unless the control names itself");
158
+ if (labelMode === "label" && !props.controlId?.trim()) throw new TypeError("Field label mode requires an actual labelable control id");
159
+ if (props.errors !== void 0 && (!Array.isArray(props.errors) || props.errors.some((error) => typeof error !== "string"))) throw new TypeError("Field errors must be strings");
160
+ const errors = [...new Set((props.errors ?? []).filter((error) => !!error.trim()))], id = `field:${props.id}`;
161
+ const description = props.description ?? "", descriptionId = `${id}:description`, errorId = `${id}:error`;
162
+ return {
163
+ id,
164
+ key: props.name === void 0 ? void 0 : formFieldKey(props.name),
165
+ label,
166
+ description,
167
+ errors,
168
+ controlId: props.controlId,
169
+ labelMode,
170
+ labelTag: labelMode === "label" ? "label" : "span",
171
+ layout: props.layout === "inline" ? "inline" : "stacked",
172
+ required: !!props.required,
173
+ disabled: !!props.disabled,
174
+ invalid: !!props.invalid || !!errors.length,
175
+ validating: !!props.validating,
176
+ validatingLabel: props.validatingLabel ?? "正在校验",
177
+ labelId: `${id}:label`,
178
+ descriptionId,
179
+ errorId,
180
+ statusId: `${id}:status`,
181
+ describedBy: [description ? descriptionId : "", errors.length ? errorId : ""].filter(Boolean).join(" ") || void 0
182
+ };
183
+ }
184
+ function getFieldRootProps(state) {
185
+ return {
186
+ ...part("root"),
187
+ id: state.id,
188
+ "data-field-key": state.key,
189
+ "data-label-mode": state.labelMode,
190
+ "data-layout": state.layout,
191
+ "data-required": state.required ? "" : void 0,
192
+ "data-disabled": state.disabled ? "" : void 0,
193
+ "data-invalid": state.invalid ? "" : void 0,
194
+ "aria-busy": state.validating || void 0
195
+ };
196
+ }
197
+ function getFieldLabelProps(state) {
198
+ return {
199
+ ...part("label"),
200
+ id: state.labelId,
201
+ htmlFor: state.labelMode === "label" ? state.controlId : void 0,
202
+ hidden: state.labelMode === "control"
203
+ };
204
+ }
205
+ function getFieldRequiredProps(state) {
206
+ return {
207
+ ...part("required"),
208
+ hidden: !state.required || state.labelMode === "control",
209
+ "aria-hidden": true
210
+ };
211
+ }
212
+ function getFieldControlProps(_state) {
213
+ return part("control");
214
+ }
215
+ function getFieldDescriptionProps(state) {
216
+ return {
217
+ ...part("description"),
218
+ id: state.descriptionId,
219
+ hidden: !state.description
220
+ };
221
+ }
222
+ function getFieldErrorProps(state) {
223
+ return {
224
+ ...part("error"),
225
+ id: state.errorId,
226
+ role: "alert",
227
+ hidden: !state.errors.length
228
+ };
229
+ }
230
+ function getFieldStatusProps(state) {
231
+ return {
232
+ ...part("status"),
233
+ id: state.statusId,
234
+ role: "status",
235
+ hidden: !state.validating
236
+ };
237
+ }
238
+ //#endregion
239
+ export { setFormValue as C, normalizeFormNamePath as S, formValuesEqual as _, getFieldDescriptionProps as a, hasFormValue as b, getFieldRequiredProps as c, resolveFieldState as d, cloneFormValue as f, formValueFingerprint as g, formFieldNativeName as h, getFieldControlProps as i, getFieldRootProps as l, formFieldKey as m, FIELD_LAYOUTS as n, getFieldErrorProps as o, cloneFormValues as p, FIELD_PARTS as r, getFieldLabelProps as s, FIELD_LABEL_MODES as t, getFieldStatusProps as u, freezeFormValues as v, mergeFormValues as x, getFormValue as y };
240
+
241
+ //# sourceMappingURL=field-DMHGIMZF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-DMHGIMZF.js","names":[],"sources":["../src/form/model.ts","../src/field/field.ts"],"sourcesContent":["/** Finite JSON values form the public value/SSR boundary. */\nexport type QwFormValue = string | number | boolean | null | QwFormValue[] | { [key: string]: QwFormValue };\nexport type QwFormValues = Record<string, QwFormValue>;\nexport type QwNamePath = string | readonly (string | number)[];\nexport type FormNamePath = (string | number)[];\nconst forbidden = new Set([\"__proto__\", \"constructor\", \"prototype\"]);\nconst plain = (value: unknown): value is Record<string, QwFormValue> => !!value && typeof value === \"object\" && !Array.isArray(value) && [Object.prototype, null].includes(Object.getPrototypeOf(value));\n\n/** Strings are literal single segments, never implicit dot/bracket parsing. */\nexport function normalizeFormNamePath(name: unknown): FormNamePath {\n const path = typeof name === \"string\" ? [name] : Array.isArray(name) ? [...name] : [];\n if (!path.length || path.length > 64 || path.some((segment) => typeof segment === \"string\" ? !segment.length || forbidden.has(segment) : typeof segment !== \"number\" || !Number.isSafeInteger(segment) || segment < 0)) throw new TypeError(\"Form name paths require nonempty safe string/integer segments without prototype names\");\n return path as FormNamePath;\n}\nexport function formFieldKey(name: QwNamePath): string { return JSON.stringify(normalizeFormNamePath(name)); }\nexport function formFieldNativeName(name: QwNamePath): string { return normalizeFormNamePath(name).map((segment, index) => index ? `[${segment}]` : String(segment)).join(\"\"); }\n\nfunction copy(value: unknown, ancestors: Set<object>, depth: number): QwFormValue {\n if (depth > 64) throw new TypeError(\"Form values exceed maximum depth\");\n if (value === null || typeof value === \"string\" || typeof value === \"boolean\") return value;\n if (typeof value === \"number\" && Number.isFinite(value)) return value;\n if (!Array.isArray(value) && !plain(value)) throw new TypeError(\"Form values must be finite plain JSON without undefined, classes or functions\");\n if (ancestors.has(value)) throw new TypeError(\"Cyclic Form values\");\n ancestors.add(value);\n let result: QwFormValue;\n if (Array.isArray(value)) {\n const entries: QwFormValue[] = [];\n for (let index = 0; index < value.length; index++) {\n if (!Object.hasOwn(value, index)) throw new TypeError(\"Form JSON arrays must be dense\");\n entries.push(copy(value[index], ancestors, depth + 1));\n }\n result = entries;\n } else result = Object.fromEntries(Object.entries(value).map(([key, child]) => [key, copy(child, ancestors, depth + 1)]));\n ancestors.delete(value);\n return result;\n}\nexport function cloneFormValue(value: unknown): QwFormValue { return copy(value, new Set(), 0); }\nexport function cloneFormValues(values: unknown = {}): QwFormValues {\n if (!plain(values)) throw new TypeError(\"Form values root must be a plain record\");\n return cloneFormValue(values) as QwFormValues;\n}\n/** Fresh recursively frozen validator snapshot; never freeze caller storage. */\nexport function freezeFormValues(values: QwFormValues): Readonly<QwFormValues> {\n const freeze = (value: QwFormValue): void => { if (value && typeof value === \"object\") { Object.values(value).forEach(freeze); Object.freeze(value); } };\n const cloned = cloneFormValues(values); freeze(cloned); return cloned;\n}\n/** Canonical comparison keeps object key order from manufacturing dirty changes. */\nexport function formValueFingerprint(value: QwFormValue | undefined): string {\n const canonical = (node: QwFormValue): QwFormValue => Array.isArray(node) ? node.map(canonical) : plain(node) ? Object.fromEntries(Object.keys(node).sort().map((key) => [key, canonical(node[key]!)])) : node;\n return value === undefined ? \"undefined\" : JSON.stringify(canonical(value));\n}\nexport function formValuesEqual(a: QwFormValues, b: QwFormValues | undefined): boolean { return !!b && formValueFingerprint(a) === formValueFingerprint(b); }\nexport function getFormValue(values: QwFormValues, name: QwNamePath): QwFormValue | undefined {\n let current: QwFormValue | undefined = values;\n for (const segment of normalizeFormNamePath(name)) {\n if (!current || typeof current !== \"object\" || (Array.isArray(current) && typeof segment !== \"number\") || !Object.hasOwn(current, segment)) return undefined;\n current = (current as Record<string | number, QwFormValue>)[segment];\n }\n return current === undefined ? undefined : cloneFormValue(current);\n}\nexport function hasFormValue(values: QwFormValues, name: QwNamePath): boolean { return getFormValue(values, name) !== undefined; }\n\n/** Immutable path update. Dense arrays retain explicit JSON semantics. */\nexport function setFormValue(values: QwFormValues, name: QwNamePath, value: QwFormValue | undefined): QwFormValues {\n const path = normalizeFormNamePath(name), result = cloneFormValues(values), nextValue = value === undefined ? undefined : cloneFormValue(value);\n let current: Record<string, QwFormValue> | QwFormValue[] = result;\n for (let index = 0; index < path.length; index++) {\n const segment = path[index]!, last = index === path.length - 1;\n if (Array.isArray(current)) {\n if (typeof segment !== \"number\" || segment > 0xffffffff - 2) throw new TypeError(\"Form array paths require valid numeric indexes\");\n if (segment - current.length > 10_000) throw new RangeError(\"Form sparse array expansion exceeds 10000 missing positions\");\n if (last && nextValue === undefined) { if (segment < current.length) current.splice(segment, 1); break; }\n while (current.length <= segment) current.push(null);\n }\n const record = current as Record<string | number, QwFormValue>;\n if (last) { if (nextValue === undefined) delete record[segment]; else Object.defineProperty(record, segment, { value: nextValue, enumerable: true, configurable: true, writable: true }); break; }\n const existing = record[segment], container = Array.isArray(existing) || plain(existing);\n if (!container) {\n const child = typeof path[index + 1] === \"number\" ? [] : {};\n Object.defineProperty(record, segment, { value: child, enumerable: true, configurable: true, writable: true });\n }\n current = record[segment] as Record<string, QwFormValue> | QwFormValue[];\n }\n return result;\n}\n/** Object recursion, array replacement; all inputs and outputs are independent. */\nexport function mergeFormValues(values: QwFormValues, patch: QwFormValues): QwFormValues {\n const result = cloneFormValues(values), safePatch = cloneFormValues(patch);\n const merge = (target: Record<string, QwFormValue>, source: Record<string, QwFormValue>) => {\n for (const [key, value] of Object.entries(source)) {\n if (plain(value) && plain(target[key])) merge(target[key] as Record<string, QwFormValue>, value);\n else Object.defineProperty(target, key, { value, enumerable: true, configurable: true, writable: true });\n }\n };\n merge(result, safePatch); return result;\n}\n","import { formFieldKey, type QwNamePath } from \"../form/model.js\";\nexport const FIELD_LABEL_MODES = [\"label\", \"control\", \"custom\"] as const;\nexport const FIELD_LAYOUTS = [\"stacked\", \"inline\"] as const;\nexport const FIELD_PARTS = [\"root\", \"label\", \"required\", \"control\", \"description\", \"error\", \"status\"] as const;\nexport type FieldLabelMode = (typeof FIELD_LABEL_MODES)[number];\nexport type FieldLayout = (typeof FIELD_LAYOUTS)[number];\n/** Pure association/feedback container; Form owns value and validation. */\nexport interface QwFieldProps {\n /** Adapters supply an SSR-safe identity when omitted. */\n id?: string;\n name?: QwNamePath;\n label?: string;\n description?: string;\n errors?: string[];\n controlId?: string;\n /** label links an actual labelable input; control avoids duplicate own names. */\n labelMode?: FieldLabelMode;\n required?: boolean;\n disabled?: boolean;\n invalid?: boolean;\n validating?: boolean;\n layout?: FieldLayout;\n validatingLabel?: string;\n}\nexport interface ResolvedFieldState {\n id: string; key?: string; label: string; description: string; errors: string[]; controlId?: string;\n labelMode: FieldLabelMode; labelTag: \"label\" | \"span\"; layout: FieldLayout;\n required: boolean; disabled: boolean; invalid: boolean; validating: boolean; validatingLabel: string;\n labelId: string; descriptionId: string; errorId: string; statusId: string; describedBy?: string;\n}\nconst part = (name: string) => ({ \"data-scope\": \"field\" as const, \"data-part\": name });\nexport function resolveFieldState(props: QwFieldProps): ResolvedFieldState {\n if (typeof props.id !== \"string\" || !props.id.trim()) throw new TypeError(\"Field requires a nonempty stable identity\");\n const labelMode = FIELD_LABEL_MODES.includes(props.labelMode!) ? props.labelMode! : \"label\";\n const label = props.label ?? \"\";\n if (labelMode !== \"control\" && !label.trim()) throw new TypeError(\"Field requires a nonempty label unless the control names itself\");\n if (labelMode === \"label\" && !props.controlId?.trim()) throw new TypeError(\"Field label mode requires an actual labelable control id\");\n if (props.errors !== undefined && (!Array.isArray(props.errors) || props.errors.some((error) => typeof error !== \"string\"))) throw new TypeError(\"Field errors must be strings\");\n const errors = [...new Set((props.errors ?? []).filter((error) => !!error.trim()))], id = `field:${props.id}`;\n const description = props.description ?? \"\", descriptionId = `${id}:description`, errorId = `${id}:error`;\n return { id, key: props.name === undefined ? undefined : formFieldKey(props.name), label, description, errors, controlId: props.controlId,\n labelMode, labelTag: labelMode === \"label\" ? \"label\" : \"span\", layout: props.layout === \"inline\" ? \"inline\" : \"stacked\",\n required: !!props.required, disabled: !!props.disabled, invalid: !!props.invalid || !!errors.length, validating: !!props.validating,\n validatingLabel: props.validatingLabel ?? \"正在校验\", labelId: `${id}:label`, descriptionId, errorId, statusId: `${id}:status`,\n describedBy: [description ? descriptionId : \"\", errors.length ? errorId : \"\"].filter(Boolean).join(\" \") || undefined };\n}\nexport function getFieldRootProps(state: ResolvedFieldState) { return { ...part(\"root\"), id: state.id, \"data-field-key\": state.key, \"data-label-mode\": state.labelMode, \"data-layout\": state.layout, \"data-required\": state.required ? \"\" : undefined, \"data-disabled\": state.disabled ? \"\" : undefined, \"data-invalid\": state.invalid ? \"\" : undefined, \"aria-busy\": state.validating || undefined }; }\nexport function getFieldLabelProps(state: ResolvedFieldState) { return { ...part(\"label\"), id: state.labelId, htmlFor: state.labelMode === \"label\" ? state.controlId : undefined, hidden: state.labelMode === \"control\" }; }\nexport function getFieldRequiredProps(state: ResolvedFieldState) { return { ...part(\"required\"), hidden: !state.required || state.labelMode === \"control\", \"aria-hidden\": true }; }\nexport function getFieldControlProps(_state: ResolvedFieldState) { return part(\"control\"); }\nexport function getFieldDescriptionProps(state: ResolvedFieldState) { return { ...part(\"description\"), id: state.descriptionId, hidden: !state.description }; }\nexport function getFieldErrorProps(state: ResolvedFieldState) { return { ...part(\"error\"), id: state.errorId, role: \"alert\" as const, hidden: !state.errors.length }; }\nexport function getFieldStatusProps(state: ResolvedFieldState) { return { ...part(\"status\"), id: state.statusId, role: \"status\" as const, hidden: !state.validating }; }\n"],"mappings":";AAKA,MAAM,4BAA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;EAAW,eAAe,MAAM;EAAQ,iBAAiB,MAAM,WAAW,KAAK,KAAA;EAAW,iBAAiB,MAAM,WAAW,KAAK,KAAA;EAAW,gBAAgB,MAAM,UAAU,KAAK,KAAA;EAAW,aAAa,MAAM,cAAc,KAAA;CAAU;AAAG;AACvY,SAAgB,mBAAmB,OAA2B;CAAE,OAAO;EAAE,GAAG,KAAK,OAAO;EAAG,IAAI,MAAM;EAAS,SAAS,MAAM,cAAc,UAAU,MAAM,YAAY,KAAA;EAAW,QAAQ,MAAM,cAAc;CAAU;AAAG;AAC3N,SAAgB,sBAAsB,OAA2B;CAAE,OAAO;EAAE,GAAG,KAAK,UAAU;EAAG,QAAQ,CAAC,MAAM,YAAY,MAAM,cAAc;EAAW,eAAe;CAAK;AAAG;AAClL,SAAgB,qBAAqB,QAA4B;CAAE,OAAO,KAAK,SAAS;AAAG;AAC3F,SAAgB,yBAAyB,OAA2B;CAAE,OAAO;EAAE,GAAG,KAAK,aAAa;EAAG,IAAI,MAAM;EAAe,QAAQ,CAAC,MAAM;CAAY;AAAG;AAC9J,SAAgB,mBAAmB,OAA2B;CAAE,OAAO;EAAE,GAAG,KAAK,OAAO;EAAG,IAAI,MAAM;EAAS,MAAM;EAAkB,QAAQ,CAAC,MAAM,OAAO;CAAO;AAAG;AACtK,SAAgB,oBAAoB,OAA2B;CAAE,OAAO;EAAE,GAAG,KAAK,QAAQ;EAAG,IAAI,MAAM;EAAU,MAAM;EAAmB,QAAQ,CAAC,MAAM;CAAW;AAAG"}
@@ -0,0 +1,116 @@
1
+ import { type Machine, type Service } from "@zag-js/core";
2
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
3
+ /** Stable DOM parts shared by every adapter. */
4
+ export declare const FLOATING_BUBBLE_PARTS: readonly ["root"];
5
+ export declare const FLOATING_BUBBLE_AXES: readonly ["xy", "x", "y", "lock"];
6
+ export declare const FLOATING_BUBBLE_MAGNETS: readonly ["x", "y", "none"];
7
+ export declare const FLOATING_BUBBLE_BOUNDARIES: readonly ["viewport", "parent"];
8
+ export type FloatingBubbleAxis = (typeof FLOATING_BUBBLE_AXES)[number];
9
+ export type FloatingBubbleMagnet = (typeof FLOATING_BUBBLE_MAGNETS)[number];
10
+ export type FloatingBubbleBoundary = (typeof FLOATING_BUBBLE_BOUNDARIES)[number];
11
+ export declare const FLOATING_BUBBLE_DEFAULT_STEP = 16;
12
+ /** Physical CSS px of the bubble's top-left corner relative to the containing block (viewport or offsetParent padding box). */
13
+ export interface FloatingBubbleOffset {
14
+ x: number;
15
+ y: number;
16
+ }
17
+ export type FloatingBubbleOffsetReason = "drag" | "keyboard" | "resize";
18
+ export interface FloatingBubbleOffsetChangeDetails {
19
+ offset: FloatingBubbleOffset;
20
+ reason: FloatingBubbleOffsetReason;
21
+ }
22
+ /** Allowed resting range after subtracting the CSS-provided insets (gap + safe area) and the bubble size. */
23
+ export interface FloatingBubbleBounds {
24
+ minX: number;
25
+ maxX: number;
26
+ minY: number;
27
+ maxY: number;
28
+ }
29
+ export interface QwFloatingBubbleProps {
30
+ id?: string;
31
+ /** Required accessible name of the button. */
32
+ label?: string;
33
+ /** Controlled position; undefined lets Core own it (seeded by defaultOffset, else inline-end bottom after measuring). */
34
+ offset?: FloatingBubbleOffset;
35
+ defaultOffset?: FloatingBubbleOffset;
36
+ /** Called once per drag release, keyboard move or resize correction; controlled owners accept by updating offset. */
37
+ onOffsetChange?: (details: FloatingBubbleOffsetChangeDetails) => void;
38
+ /** Drag axes; lock disables dragging. Default xy. */
39
+ axis?: FloatingBubbleAxis;
40
+ /** Snap to the nearest horizontal (x) or vertical (y) edge after moving; default x. */
41
+ magnet?: FloatingBubbleMagnet;
42
+ /** viewport (position: fixed, default) or parent (position: absolute in the offsetParent). */
43
+ boundary?: FloatingBubbleBoundary;
44
+ /** Arrow-key step in px; 0 disables keyboard moving. Default 16. */
45
+ keyboardStep?: number;
46
+ disabled?: boolean;
47
+ }
48
+ export interface ResolvedFloatingBubbleState {
49
+ label: string;
50
+ axis: FloatingBubbleAxis;
51
+ magnet: FloatingBubbleMagnet;
52
+ boundary: FloatingBubbleBoundary;
53
+ keyboardStep: number;
54
+ disabled: boolean;
55
+ }
56
+ export declare function resolveFloatingBubbleState(props?: QwFloatingBubbleProps): ResolvedFloatingBubbleState;
57
+ export declare function createFloatingBubbleProps(props?: QwFloatingBubbleProps): QwFloatingBubbleProps;
58
+ export declare function clampFloatingBubbleOffset(offset: FloatingBubbleOffset, bounds: FloatingBubbleBounds): FloatingBubbleOffset;
59
+ /** Clamp, then move to the nearest edge on the magnet axis (ties go to the larger edge). */
60
+ export declare function snapFloatingBubbleOffset(offset: FloatingBubbleOffset, bounds: FloatingBubbleBounds, magnet: FloatingBubbleMagnet): FloatingBubbleOffset;
61
+ export interface QwFloatingBubbleSchema {
62
+ props: QwFloatingBubbleProps;
63
+ context: {
64
+ offset: FloatingBubbleOffset | null;
65
+ drag: FloatingBubbleOffset | null;
66
+ bounds: FloatingBubbleBounds | null;
67
+ animate: boolean;
68
+ };
69
+ refs: {
70
+ rtl: boolean;
71
+ suppressClick: boolean;
72
+ };
73
+ state: "ready";
74
+ action: "measure" | "drag" | "release" | "key";
75
+ effect: "track";
76
+ event: {
77
+ type: "MEASURE";
78
+ bounds: FloatingBubbleBounds;
79
+ rtl: boolean;
80
+ } | {
81
+ type: "DRAG";
82
+ position: FloatingBubbleOffset;
83
+ } | {
84
+ type: "RELEASE";
85
+ } | {
86
+ type: "KEY";
87
+ key: string;
88
+ };
89
+ }
90
+ export type QwFloatingBubbleMachine = Machine<QwFloatingBubbleSchema>;
91
+ export type QwFloatingBubbleService = Service<QwFloatingBubbleSchema>;
92
+ /** Core owns click/drag discrimination, clamping, magnet snapping, measurement, keyboard moving and listener cleanup. */
93
+ export declare const floatingBubbleMachine: QwFloatingBubbleMachine;
94
+ /** Minimal event surface shared by React, Vue and native events. */
95
+ export interface FloatingBubbleDomEvent {
96
+ readonly defaultPrevented: boolean;
97
+ readonly key?: string;
98
+ preventDefault?(): void;
99
+ stopPropagation?(): void;
100
+ }
101
+ export type FloatingBubbleEventHandler = (event: FloatingBubbleDomEvent) => void;
102
+ type Handlers = FloatingBubbleEventHandler | readonly FloatingBubbleEventHandler[] | undefined;
103
+ /** Caller onClick/onKeyDown run first (except the click swallowed after a drag); preventDefault() skips Core. */
104
+ export interface FloatingBubbleConnectOptions {
105
+ onClick?: Handlers;
106
+ onKeyDown?: Handlers;
107
+ }
108
+ export interface QwFloatingBubbleApi<T extends PropTypes = PropTypes> {
109
+ label: string;
110
+ dragging: boolean;
111
+ /** Rendered position, or null before the first measurement (CSS logical fallback). */
112
+ position: FloatingBubbleOffset | null;
113
+ getRootProps(): T["button"];
114
+ }
115
+ export declare function connectFloatingBubble<T extends PropTypes>(service: QwFloatingBubbleService, normalize: NormalizeProps<T>, options?: FloatingBubbleConnectOptions): QwFloatingBubbleApi<T>;
116
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./floating-bubble.js";