@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,69 @@
1
+ /** Semantic description list contract: dl/dt/dd grid, shared by every adapter. */
2
+ export declare const DESCRIPTIONS_LAYOUTS: readonly ["horizontal", "vertical"];
3
+ export declare const DESCRIPTIONS_PARTS: readonly ["root", "title", "list", "item", "label", "value"];
4
+ export declare const DESCRIPTIONS_MAX_COLUMN = 4;
5
+ export type DescriptionsLayout = (typeof DESCRIPTIONS_LAYOUTS)[number];
6
+ export type DescriptionsPart = (typeof DESCRIPTIONS_PARTS)[number];
7
+ /** One label/value pair. `T` lets framework adapters pass rich nodes without changing Core decisions. */
8
+ export interface DescriptionsItem<T = string> {
9
+ /** Stable key; also exposed as data-value. */
10
+ id: string;
11
+ label: T;
12
+ /** undefined/null/"" renders `emptyText`. */
13
+ value?: T | null;
14
+ /** Columns occupied; integer clamped to 1..column. */
15
+ span?: number;
16
+ }
17
+ export interface QwDescriptionsProps<T = string> {
18
+ /** Optional caption above the list (plain region text, not a heading). */
19
+ title?: string;
20
+ items: readonly DescriptionsItem<T>[];
21
+ /** Integer 1–4; invalid values use 1. */
22
+ column?: number;
23
+ /** horizontal: label beside value (default); vertical: label above value. */
24
+ layout?: DescriptionsLayout;
25
+ bordered?: boolean;
26
+ /** Placeholder for empty values; default "-". */
27
+ emptyText?: string;
28
+ }
29
+ export interface ResolvedDescriptionsItem<T = string> extends DescriptionsItem<T> {
30
+ index: number;
31
+ span: number;
32
+ empty: boolean;
33
+ }
34
+ export interface ResolvedDescriptionsState<T = string> {
35
+ title?: string;
36
+ column: number;
37
+ layout: DescriptionsLayout;
38
+ bordered: boolean;
39
+ emptyText: string;
40
+ items: ResolvedDescriptionsItem<T>[];
41
+ }
42
+ export declare function normalizeDescriptionsColumn(column: unknown): number;
43
+ export declare function resolveDescriptionsState<T = string>(props: QwDescriptionsProps<T>): ResolvedDescriptionsState<T>;
44
+ type Part<P extends DescriptionsPart> = {
45
+ "data-scope": "descriptions";
46
+ "data-part": P;
47
+ };
48
+ export declare function getDescriptionsRootProps(state: ResolvedDescriptionsState<unknown>): Part<"root"> & {
49
+ "data-layout": DescriptionsLayout;
50
+ "data-bordered"?: "true";
51
+ style: Record<string, string>;
52
+ };
53
+ export declare function getDescriptionsTitleProps(present: boolean): Part<"title"> & {
54
+ hidden?: true;
55
+ };
56
+ export declare function getDescriptionsListProps(state: ResolvedDescriptionsState<unknown>): Part<"list"> & {
57
+ "data-column": number;
58
+ };
59
+ export declare function getDescriptionsItemProps(item: ResolvedDescriptionsItem<unknown>): Part<"item"> & {
60
+ "data-value": string;
61
+ "data-span": number;
62
+ "data-empty"?: "true";
63
+ style: Record<string, string>;
64
+ };
65
+ export declare function getDescriptionsLabelProps(): Part<"label">;
66
+ export declare function getDescriptionsValueProps(item: ResolvedDescriptionsItem<unknown>): Part<"value"> & {
67
+ "data-empty"?: "true";
68
+ };
69
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./descriptions.js";
@@ -0,0 +1,86 @@
1
+ //#region src/descriptions/descriptions.ts
2
+ /** Semantic description list contract: dl/dt/dd grid, shared by every adapter. */
3
+ const DESCRIPTIONS_LAYOUTS = ["horizontal", "vertical"];
4
+ const DESCRIPTIONS_PARTS = [
5
+ "root",
6
+ "title",
7
+ "list",
8
+ "item",
9
+ "label",
10
+ "value"
11
+ ];
12
+ const DESCRIPTIONS_MAX_COLUMN = 4;
13
+ function normalizeDescriptionsColumn(column) {
14
+ if (typeof column !== "number" || !Number.isFinite(column)) return 1;
15
+ const value = Math.floor(column);
16
+ return value < 1 ? 1 : Math.min(4, value);
17
+ }
18
+ function normalizeSpan(span, column) {
19
+ if (typeof span !== "number" || !Number.isFinite(span)) return 1;
20
+ return Math.max(1, Math.min(column, Math.floor(span)));
21
+ }
22
+ function isEmptyValue(value) {
23
+ return value === void 0 || value === null || value === "";
24
+ }
25
+ function resolveDescriptionsState(props) {
26
+ const column = normalizeDescriptionsColumn(props.column);
27
+ return {
28
+ title: typeof props.title === "string" && props.title !== "" ? props.title : void 0,
29
+ column,
30
+ layout: DESCRIPTIONS_LAYOUTS.includes(props.layout) ? props.layout : "horizontal",
31
+ bordered: props.bordered === true,
32
+ emptyText: typeof props.emptyText === "string" ? props.emptyText : "-",
33
+ items: (props.items ?? []).map((item, index) => ({
34
+ ...item,
35
+ index,
36
+ span: normalizeSpan(item.span, column),
37
+ empty: isEmptyValue(item.value)
38
+ }))
39
+ };
40
+ }
41
+ const part = (name) => ({
42
+ "data-scope": "descriptions",
43
+ "data-part": name
44
+ });
45
+ function getDescriptionsRootProps(state) {
46
+ return {
47
+ ...part("root"),
48
+ "data-layout": state.layout,
49
+ ...state.bordered ? { "data-bordered": "true" } : {},
50
+ style: { "--qw-descriptions-column": String(state.column) }
51
+ };
52
+ }
53
+ function getDescriptionsTitleProps(present) {
54
+ return {
55
+ ...part("title"),
56
+ ...present ? {} : { hidden: true }
57
+ };
58
+ }
59
+ function getDescriptionsListProps(state) {
60
+ return {
61
+ ...part("list"),
62
+ "data-column": state.column
63
+ };
64
+ }
65
+ function getDescriptionsItemProps(item) {
66
+ return {
67
+ ...part("item"),
68
+ "data-value": item.id,
69
+ "data-span": item.span,
70
+ ...item.empty ? { "data-empty": "true" } : {},
71
+ style: { gridColumnEnd: `span ${item.span}` }
72
+ };
73
+ }
74
+ function getDescriptionsLabelProps() {
75
+ return part("label");
76
+ }
77
+ function getDescriptionsValueProps(item) {
78
+ return {
79
+ ...part("value"),
80
+ ...item.empty ? { "data-empty": "true" } : {}
81
+ };
82
+ }
83
+ //#endregion
84
+ export { DESCRIPTIONS_LAYOUTS, DESCRIPTIONS_MAX_COLUMN, DESCRIPTIONS_PARTS, getDescriptionsItemProps, getDescriptionsLabelProps, getDescriptionsListProps, getDescriptionsRootProps, getDescriptionsTitleProps, getDescriptionsValueProps, normalizeDescriptionsColumn, resolveDescriptionsState };
85
+
86
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/descriptions/descriptions.ts"],"sourcesContent":["/** Semantic description list contract: dl/dt/dd grid, shared by every adapter. */\nexport const DESCRIPTIONS_LAYOUTS = [\"horizontal\", \"vertical\"] as const;\nexport const DESCRIPTIONS_PARTS = [\"root\", \"title\", \"list\", \"item\", \"label\", \"value\"] as const;\nexport const DESCRIPTIONS_MAX_COLUMN = 4;\nexport type DescriptionsLayout = (typeof DESCRIPTIONS_LAYOUTS)[number];\nexport type DescriptionsPart = (typeof DESCRIPTIONS_PARTS)[number];\n\n/** One label/value pair. `T` lets framework adapters pass rich nodes without changing Core decisions. */\nexport interface DescriptionsItem<T = string> {\n /** Stable key; also exposed as data-value. */\n id: string;\n label: T;\n /** undefined/null/\"\" renders `emptyText`. */\n value?: T | null;\n /** Columns occupied; integer clamped to 1..column. */\n span?: number;\n}\nexport interface QwDescriptionsProps<T = string> {\n /** Optional caption above the list (plain region text, not a heading). */\n title?: string;\n items: readonly DescriptionsItem<T>[];\n /** Integer 1–4; invalid values use 1. */\n column?: number;\n /** horizontal: label beside value (default); vertical: label above value. */\n layout?: DescriptionsLayout;\n bordered?: boolean;\n /** Placeholder for empty values; default \"-\". */\n emptyText?: string;\n}\nexport interface ResolvedDescriptionsItem<T = string> extends DescriptionsItem<T> {\n index: number;\n span: number;\n empty: boolean;\n}\nexport interface ResolvedDescriptionsState<T = string> {\n title?: string;\n column: number;\n layout: DescriptionsLayout;\n bordered: boolean;\n emptyText: string;\n items: ResolvedDescriptionsItem<T>[];\n}\n\nexport function normalizeDescriptionsColumn(column: unknown): number {\n if (typeof column !== \"number\" || !Number.isFinite(column)) return 1;\n const value = Math.floor(column);\n return value < 1 ? 1 : Math.min(DESCRIPTIONS_MAX_COLUMN, value);\n}\nfunction normalizeSpan(span: unknown, column: number): number {\n if (typeof span !== \"number\" || !Number.isFinite(span)) return 1;\n return Math.max(1, Math.min(column, Math.floor(span)));\n}\nfunction isEmptyValue(value: unknown): boolean {\n return value === undefined || value === null || value === \"\";\n}\n\nexport function resolveDescriptionsState<T = string>(props: QwDescriptionsProps<T>): ResolvedDescriptionsState<T> {\n const column = normalizeDescriptionsColumn(props.column);\n return {\n title: typeof props.title === \"string\" && props.title !== \"\" ? props.title : undefined,\n column,\n layout: DESCRIPTIONS_LAYOUTS.includes(props.layout!) ? props.layout! : \"horizontal\",\n bordered: props.bordered === true,\n emptyText: typeof props.emptyText === \"string\" ? props.emptyText : \"-\",\n items: (props.items ?? []).map((item, index) => ({ ...item, index, span: normalizeSpan(item.span, column), empty: isEmptyValue(item.value) })),\n };\n}\n\ntype Part<P extends DescriptionsPart> = { \"data-scope\": \"descriptions\"; \"data-part\": P };\nconst part = <P extends DescriptionsPart>(name: P): Part<P> => ({ \"data-scope\": \"descriptions\", \"data-part\": name });\n\nexport function getDescriptionsRootProps(state: ResolvedDescriptionsState<unknown>): Part<\"root\"> & { \"data-layout\": DescriptionsLayout; \"data-bordered\"?: \"true\"; style: Record<string, string> } {\n return { ...part(\"root\"), \"data-layout\": state.layout, ...(state.bordered ? { \"data-bordered\": \"true\" as const } : {}), style: { \"--qw-descriptions-column\": String(state.column) } };\n}\nexport function getDescriptionsTitleProps(present: boolean): Part<\"title\"> & { hidden?: true } {\n return { ...part(\"title\"), ...(present ? {} : { hidden: true as const }) };\n}\nexport function getDescriptionsListProps(state: ResolvedDescriptionsState<unknown>): Part<\"list\"> & { \"data-column\": number } {\n return { ...part(\"list\"), \"data-column\": state.column };\n}\nexport function getDescriptionsItemProps(item: ResolvedDescriptionsItem<unknown>): Part<\"item\"> & { \"data-value\": string; \"data-span\": number; \"data-empty\"?: \"true\"; style: Record<string, string> } {\n return { ...part(\"item\"), \"data-value\": item.id, \"data-span\": item.span, ...(item.empty ? { \"data-empty\": \"true\" as const } : {}), style: { gridColumnEnd: `span ${item.span}` } };\n}\nexport function getDescriptionsLabelProps(): Part<\"label\"> { return part(\"label\"); }\nexport function getDescriptionsValueProps(item: ResolvedDescriptionsItem<unknown>): Part<\"value\"> & { \"data-empty\"?: \"true\" } {\n return { ...part(\"value\"), ...(item.empty ? { \"data-empty\": \"true\" as const } : {}) };\n}\n"],"mappings":";;AACA,MAAa,uBAAuB,CAAC,cAAc,UAAU;AAC7D,MAAa,qBAAqB;CAAC;CAAQ;CAAS;CAAQ;CAAQ;CAAS;AAAO;AACpF,MAAa,0BAA0B;AAwCvC,SAAgB,4BAA4B,QAAyB;CACnE,IAAI,OAAO,WAAW,YAAY,CAAC,OAAO,SAAS,MAAM,GAAG,OAAO;CACnE,MAAM,QAAQ,KAAK,MAAM,MAAM;CAC/B,OAAO,QAAQ,IAAI,IAAI,KAAK,IAAA,GAA6B,KAAK;AAChE;AACA,SAAS,cAAc,MAAe,QAAwB;CAC5D,IAAI,OAAO,SAAS,YAAY,CAAC,OAAO,SAAS,IAAI,GAAG,OAAO;CAC/D,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,QAAQ,KAAK,MAAM,IAAI,CAAC,CAAC;AACvD;AACA,SAAS,aAAa,OAAyB;CAC7C,OAAO,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU;AAC5D;AAEA,SAAgB,yBAAqC,OAA6D;CAChH,MAAM,SAAS,4BAA4B,MAAM,MAAM;CACvD,OAAO;EACL,OAAO,OAAO,MAAM,UAAU,YAAY,MAAM,UAAU,KAAK,MAAM,QAAQ,KAAA;EAC7E;EACA,QAAQ,qBAAqB,SAAS,MAAM,MAAO,IAAI,MAAM,SAAU;EACvE,UAAU,MAAM,aAAa;EAC7B,WAAW,OAAO,MAAM,cAAc,WAAW,MAAM,YAAY;EACnE,QAAQ,MAAM,SAAS,CAAC,EAAA,CAAG,KAAK,MAAM,WAAW;GAAE,GAAG;GAAM;GAAO,MAAM,cAAc,KAAK,MAAM,MAAM;GAAG,OAAO,aAAa,KAAK,KAAK;EAAE,EAAE;CAC/I;AACF;AAGA,MAAM,QAAoC,UAAsB;CAAE,cAAc;CAAgB,aAAa;AAAK;AAElH,SAAgB,yBAAyB,OAA0J;CACjM,OAAO;EAAE,GAAG,KAAK,MAAM;EAAG,eAAe,MAAM;EAAQ,GAAI,MAAM,WAAW,EAAE,iBAAiB,OAAgB,IAAI,CAAC;EAAI,OAAO,EAAE,4BAA4B,OAAO,MAAM,MAAM,EAAE;CAAE;AACtL;AACA,SAAgB,0BAA0B,SAAqD;CAC7F,OAAO;EAAE,GAAG,KAAK,OAAO;EAAG,GAAI,UAAU,CAAC,IAAI,EAAE,QAAQ,KAAc;CAAG;AAC3E;AACA,SAAgB,yBAAyB,OAAqF;CAC5H,OAAO;EAAE,GAAG,KAAK,MAAM;EAAG,eAAe,MAAM;CAAO;AACxD;AACA,SAAgB,yBAAyB,MAA6J;CACpM,OAAO;EAAE,GAAG,KAAK,MAAM;EAAG,cAAc,KAAK;EAAI,aAAa,KAAK;EAAM,GAAI,KAAK,QAAQ,EAAE,cAAc,OAAgB,IAAI,CAAC;EAAI,OAAO,EAAE,eAAe,QAAQ,KAAK,OAAO;CAAE;AACnL;AACA,SAAgB,4BAA2C;CAAE,OAAO,KAAK,OAAO;AAAG;AACnF,SAAgB,0BAA0B,MAAoF;CAC5H,OAAO;EAAE,GAAG,KAAK,OAAO;EAAG,GAAI,KAAK,QAAQ,EAAE,cAAc,OAAgB,IAAI,CAAC;CAAG;AACtF"}
@@ -1,4 +1,5 @@
1
- import type { Props as ZagDialogProps } from "@zag-js/dialog";
1
+ import { type Api, type Props as ZagDialogProps, type Service } from "@zag-js/dialog";
2
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
2
3
  /**
3
4
  * QwDialogProps — H5 系统 Dialog 的跨框架行为输入。
4
5
  *
@@ -36,13 +37,41 @@ export interface QwDialogActionState {
36
37
  confirmLoading: boolean;
37
38
  }
38
39
  /**
39
- * 直接 re-export zag 的 dialog machine 与 connect。
40
+ * 共用 Core 的 Zag dialog 薄包装;connect 只追加纯声明属性 getter。
40
41
  * 各框架适配层只实例化 service 并摊 prop-getter。
41
42
  */
42
- export { machine as dialogMachine, connect } from "@zag-js/dialog";
43
+ export declare function connect<T extends PropTypes>(service: Service, normalize: NormalizeProps<T>): Api<T> & {
44
+ getOriginProps(): T["element"];
45
+ };
46
+ export { modalDialogMachine as dialogMachine } from "../modal-dialog-machine.js";
43
47
  /** rebrand zag 的 DialogApi 类型对外。 */
44
48
  export type { Api as QwDialogApi } from "@zag-js/dialog";
45
49
  /** 把 H5 Dialog 公开 props 转成 zag dialog machine context。 */
46
50
  export declare function createDialogProps(props?: QwDialogProps): Partial<ZagDialogProps>;
51
+ /** 键盘激活时适配层传入的最小事件。Core 不查询 document。 */
52
+ export interface DialogTriggerKeyEvent {
53
+ readonly key: string;
54
+ readonly defaultPrevented: boolean;
55
+ preventDefault(): void;
56
+ readonly currentTarget: object | null;
57
+ }
58
+ /**
59
+ * 非按钮触发器的 Enter / Space。先交给已有 keydown(例如 zag),
60
+ * 未被取消时 preventDefault,并点击 currentTarget,让点击路径统一打开。
61
+ */
62
+ export declare function handleDialogTriggerKey<E extends DialogTriggerKeyEvent>(event: E, previous?: (event: E) => void): void;
63
+ export interface DialogActionTask {
64
+ /** 动作当前不可用(含确认中的忙碌)。 */
65
+ disabled: boolean;
66
+ /** 先通知调用方。返回 Promise 时,关闭推迟到它完成。 */
67
+ invoke?: () => unknown;
68
+ close: () => void;
69
+ }
70
+ /** 禁用的动作不通知、不关闭。启用的动作先通知,再关闭;Promise 要等它完成。 */
71
+ export declare function runDialogAction(task: DialogActionTask): void;
72
+ /** 把触发器上的可序列化属性交给真实 button。函数和 type 留在适配层。 */
73
+ export declare function dialogSlottedTriggerAttrs(source: object): Array<[string, string]>;
47
74
  /** 双栈共享的 Dialog 操作区状态归一化。 */
48
75
  export declare function resolveDialogActionState(props?: QwDialogActionProps): QwDialogActionState;
76
+ export { createPortalPlan, readPortalHostLocale, resolvePortalCopy } from "../portal.js";
77
+ export type { PortalCopy, PortalCopyAttribute, PortalKind, PortalPart, PortalPlan, PortalResolvedCopy, PortalSnapshot, PortalTarget, PortalVariableMode, } from "../portal.js";
@@ -1,11 +1,28 @@
1
- import { connect, machine as dialogMachine } from "@zag-js/dialog";
1
+ import { i as modalOriginAttrs, o as modalRequestService, r as modalDialogMachine, t as cancelModalClose } from "../modal-dialog-machine-CF9_z3Dm.js";
2
+ import { n as readPortalHostLocale, r as resolvePortalCopy, t as createPortalPlan } from "../portal-BHCNTWhg.js";
3
+ import { connect as connect$1 } from "@zag-js/dialog";
2
4
  //#region src/dialog/dialog.ts
5
+ /**
6
+ * 共用 Core 的 Zag dialog 薄包装;connect 只追加纯声明属性 getter。
7
+ * 各框架适配层只实例化 service 并摊 prop-getter。
8
+ */
9
+ function connect(service, normalize) {
10
+ const api = connect$1(modalRequestService(service), normalize);
11
+ return {
12
+ ...api,
13
+ setOpen(open) {
14
+ if (open) cancelModalClose(service);
15
+ api.setOpen(open);
16
+ },
17
+ getOriginProps: () => normalize.element(modalOriginAttrs(service.scope.id, "dialog"))
18
+ };
19
+ }
3
20
  /** 把 H5 Dialog 公开 props 转成 zag dialog machine context。 */
4
21
  function createDialogProps(props = {}) {
5
22
  const ctx = {
6
23
  id: props.id,
7
24
  open: props.open,
8
- defaultOpen: props.defaultOpen,
25
+ defaultOpen: typeof props.open === "boolean" ? false : props.defaultOpen,
9
26
  role: "dialog",
10
27
  modal: true,
11
28
  closeOnEscape: true,
@@ -18,6 +35,44 @@ function createDialogProps(props = {}) {
18
35
  }
19
36
  return ctx;
20
37
  }
38
+ function clickTarget(target) {
39
+ if (target && "click" in target && typeof target.click === "function") target.click();
40
+ }
41
+ /**
42
+ * 非按钮触发器的 Enter / Space。先交给已有 keydown(例如 zag),
43
+ * 未被取消时 preventDefault,并点击 currentTarget,让点击路径统一打开。
44
+ */
45
+ function handleDialogTriggerKey(event, previous) {
46
+ previous?.(event);
47
+ if (event.defaultPrevented) return;
48
+ if (event.key !== "Enter" && event.key !== " ") return;
49
+ event.preventDefault();
50
+ clickTarget(event.currentTarget);
51
+ }
52
+ function isThenable(value) {
53
+ return !!value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
54
+ }
55
+ /** 禁用的动作不通知、不关闭。启用的动作先通知,再关闭;Promise 要等它完成。 */
56
+ function runDialogAction(task) {
57
+ if (task.disabled) return;
58
+ const result = task.invoke?.();
59
+ if (isThenable(result)) {
60
+ result.then(() => task.close());
61
+ return;
62
+ }
63
+ task.close();
64
+ }
65
+ /** 把触发器上的可序列化属性交给真实 button。函数和 type 留在适配层。 */
66
+ function dialogSlottedTriggerAttrs(source) {
67
+ const assigned = [];
68
+ for (const [key, value] of Object.entries(source)) {
69
+ if (value == null || typeof value === "function") continue;
70
+ if (key === "type" || key === "style" || key === "tabIndex" || key === "tabindex") continue;
71
+ if (typeof value === "boolean") assigned.push([key, value ? "true" : "false"]);
72
+ else if (typeof value === "string" || typeof value === "number") assigned.push([key, String(value)]);
73
+ }
74
+ return assigned;
75
+ }
21
76
  /** 双栈共享的 Dialog 操作区状态归一化。 */
22
77
  function resolveDialogActionState(props = {}) {
23
78
  const confirmLoading = props.confirmLoading ?? false;
@@ -29,6 +84,6 @@ function resolveDialogActionState(props = {}) {
29
84
  };
30
85
  }
31
86
  //#endregion
32
- export { connect, createDialogProps, dialogMachine, resolveDialogActionState };
87
+ export { connect, createDialogProps, createPortalPlan, modalDialogMachine as dialogMachine, dialogSlottedTriggerAttrs, handleDialogTriggerKey, readPortalHostLocale, resolveDialogActionState, resolvePortalCopy, runDialogAction };
33
88
 
34
89
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/dialog/dialog.ts"],"sourcesContent":["import type { OpenChangeDetails, Props as ZagDialogProps } from \"@zag-js/dialog\";\n\n/**\n * QwDialogProps — H5 系统 Dialog 的跨框架行为输入。\n *\n * 只暴露业务能理解的开合、遮罩点击、body 滚动控制;modal / role / focus\n * 策略是组件内部无障碍政策,不作为业务 API。\n */\nexport interface QwDialogProps {\n /** 唯一 id 前缀;不传时由适配层提供 SSR/CSR 稳定 id。 */\n id?: string;\n /** 受控开关。 */\n open?: boolean;\n /** 非受控初值。 */\n defaultOpen?: boolean;\n /** 点击遮罩关闭,默认 true。 */\n closeOnMaskClick?: boolean;\n /** Dialog 打开时禁止 body 滚动,默认 true。 */\n disableBodyScroll?: boolean;\n /** 状态变化回调。 */\n onOpenChange?: (open: boolean) => void;\n}\n\nexport interface QwDialogActionProps {\n /** 是否展示取消按钮,默认 true。 */\n showCancel?: boolean;\n /** 取消按钮禁用。 */\n cancelDisabled?: boolean;\n /** 确认按钮禁用。 */\n confirmDisabled?: boolean;\n /** 确认按钮忙碌;忙碌时视为禁用。 */\n confirmLoading?: boolean;\n}\n\nexport interface QwDialogActionState {\n showCancel: boolean;\n cancelDisabled: boolean;\n confirmDisabled: boolean;\n confirmLoading: boolean;\n}\n\n/**\n * 直接 re-export zag 的 dialog machine 与 connect。\n * 各框架适配层只实例化 service 并摊 prop-getter。\n */\nexport { machine as dialogMachine, connect } from \"@zag-js/dialog\";\n\n/** rebrand zag 的 DialogApi 类型对外。 */\nexport type { Api as QwDialogApi } from \"@zag-js/dialog\";\n\n/** 把 H5 Dialog 公开 props 转成 zag dialog machine context。 */\nexport function createDialogProps(props: QwDialogProps = {}): Partial<ZagDialogProps> {\n const ctx: Partial<ZagDialogProps> = {\n id: props.id,\n open: props.open,\n defaultOpen: props.defaultOpen,\n role: \"dialog\",\n modal: true,\n closeOnEscape: true,\n closeOnInteractOutside: props.closeOnMaskClick !== false,\n preventScroll: props.disableBodyScroll !== false,\n };\n\n if (props.onOpenChange) {\n const cb = props.onOpenChange;\n ctx.onOpenChange = (d: OpenChangeDetails) => cb(d.open);\n }\n\n return ctx;\n}\n\n/** 双栈共享的 Dialog 操作区状态归一化。 */\nexport function resolveDialogActionState(\n props: QwDialogActionProps = {},\n): QwDialogActionState {\n const confirmLoading = props.confirmLoading ?? false;\n return {\n showCancel: props.showCancel !== false,\n cancelDisabled: props.cancelDisabled ?? false,\n confirmDisabled: (props.confirmDisabled ?? false) || confirmLoading,\n confirmLoading,\n };\n}\n"],"mappings":";;;AAmDA,SAAgB,kBAAkB,QAAuB,CAAC,GAA4B;CACpF,MAAM,MAA+B;EACnC,IAAI,MAAM;EACV,MAAM,MAAM;EACZ,aAAa,MAAM;EACnB,MAAM;EACN,OAAO;EACP,eAAe;EACf,wBAAwB,MAAM,qBAAqB;EACnD,eAAe,MAAM,sBAAsB;CAC7C;CAEA,IAAI,MAAM,cAAc;EACtB,MAAM,KAAK,MAAM;EACjB,IAAI,gBAAgB,MAAyB,GAAG,EAAE,IAAI;CACxD;CAEA,OAAO;AACT;;AAGA,SAAgB,yBACd,QAA6B,CAAC,GACT;CACrB,MAAM,iBAAiB,MAAM,kBAAkB;CAC/C,OAAO;EACL,YAAY,MAAM,eAAe;EACjC,gBAAgB,MAAM,kBAAkB;EACxC,kBAAkB,MAAM,mBAAmB,UAAU;EACrD;CACF;AACF"}
1
+ {"version":3,"file":"index.js","names":["zagConnect"],"sources":["../../src/dialog/dialog.ts"],"sourcesContent":["import { connect as zagConnect, type Api, type OpenChangeDetails, type Props as ZagDialogProps, type Service } from \"@zag-js/dialog\";\nimport type { NormalizeProps, PropTypes } from \"@zag-js/types\";\nimport { modalOriginAttrs, modalRequestService, cancelModalClose } from \"../modal-dialog-machine.js\";\n\n/**\n * QwDialogProps — H5 系统 Dialog 的跨框架行为输入。\n *\n * 只暴露业务能理解的开合、遮罩点击、body 滚动控制;modal / role / focus\n * 策略是组件内部无障碍政策,不作为业务 API。\n */\nexport interface QwDialogProps {\n /** 唯一 id 前缀;不传时由适配层提供 SSR/CSR 稳定 id。 */\n id?: string;\n /** 受控开关。 */\n open?: boolean;\n /** 非受控初值。 */\n defaultOpen?: boolean;\n /** 点击遮罩关闭,默认 true。 */\n closeOnMaskClick?: boolean;\n /** Dialog 打开时禁止 body 滚动,默认 true。 */\n disableBodyScroll?: boolean;\n /** 状态变化回调。 */\n onOpenChange?: (open: boolean) => void;\n}\n\nexport interface QwDialogActionProps {\n /** 是否展示取消按钮,默认 true。 */\n showCancel?: boolean;\n /** 取消按钮禁用。 */\n cancelDisabled?: boolean;\n /** 确认按钮禁用。 */\n confirmDisabled?: boolean;\n /** 确认按钮忙碌;忙碌时视为禁用。 */\n confirmLoading?: boolean;\n}\n\nexport interface QwDialogActionState {\n showCancel: boolean;\n cancelDisabled: boolean;\n confirmDisabled: boolean;\n confirmLoading: boolean;\n}\n\n/**\n * 共用 Core 的 Zag dialog 薄包装;connect 只追加纯声明属性 getter。\n * 各框架适配层只实例化 service 并摊 prop-getter。\n */\nexport function connect<T extends PropTypes>(service: Service, normalize: NormalizeProps<T>): Api<T> & { getOriginProps(): T[\"element\"] } {\n const api = zagConnect(modalRequestService(service), normalize);\n return { ...api, setOpen(open) { if (open) cancelModalClose(service); api.setOpen(open); }, getOriginProps: () => normalize.element(modalOriginAttrs(service.scope.id, \"dialog\")) };\n}\nexport { modalDialogMachine as dialogMachine } from \"../modal-dialog-machine.js\";\n\n/** rebrand zag 的 DialogApi 类型对外。 */\nexport type { Api as QwDialogApi } from \"@zag-js/dialog\";\n\n/** 把 H5 Dialog 公开 props 转成 zag dialog machine context。 */\nexport function createDialogProps(props: QwDialogProps = {}): Partial<ZagDialogProps> {\n const ctx: Partial<ZagDialogProps> = {\n id: props.id,\n open: props.open,\n // Zag seeds initialState with open || defaultOpen; a controlled boolean owns the initial state.\n defaultOpen: typeof props.open === \"boolean\" ? false : props.defaultOpen,\n role: \"dialog\",\n modal: true,\n closeOnEscape: true,\n closeOnInteractOutside: props.closeOnMaskClick !== false,\n preventScroll: props.disableBodyScroll !== false,\n };\n\n if (props.onOpenChange) {\n const cb = props.onOpenChange;\n ctx.onOpenChange = (d: OpenChangeDetails) => cb(d.open);\n }\n\n return ctx;\n}\n\n/** 键盘激活时适配层传入的最小事件。Core 不查询 document。 */\nexport interface DialogTriggerKeyEvent {\n readonly key: string;\n readonly defaultPrevented: boolean;\n preventDefault(): void;\n readonly currentTarget: object | null;\n}\n\nfunction clickTarget(target: object | null): void {\n if (target && \"click\" in target && typeof target.click === \"function\") target.click();\n}\n\n/**\n * 非按钮触发器的 Enter / Space。先交给已有 keydown(例如 zag),\n * 未被取消时 preventDefault,并点击 currentTarget,让点击路径统一打开。\n */\nexport function handleDialogTriggerKey<E extends DialogTriggerKeyEvent>(\n event: E,\n previous?: (event: E) => void,\n): void {\n previous?.(event);\n if (event.defaultPrevented) return;\n if (event.key !== \"Enter\" && event.key !== \" \") return;\n event.preventDefault();\n clickTarget(event.currentTarget);\n}\n\nexport interface DialogActionTask {\n /** 动作当前不可用(含确认中的忙碌)。 */\n disabled: boolean;\n /** 先通知调用方。返回 Promise 时,关闭推迟到它完成。 */\n invoke?: () => unknown;\n close: () => void;\n}\n\nfunction isThenable(value: unknown): value is PromiseLike<unknown> {\n return !!value && (typeof value === \"object\" || typeof value === \"function\") && typeof (value as PromiseLike<unknown>).then === \"function\";\n}\n\n/** 禁用的动作不通知、不关闭。启用的动作先通知,再关闭;Promise 要等它完成。 */\nexport function runDialogAction(task: DialogActionTask): void {\n if (task.disabled) return;\n const result = task.invoke?.();\n if (isThenable(result)) {\n void result.then(() => task.close());\n return;\n }\n task.close();\n}\n\n/** 把触发器上的可序列化属性交给真实 button。函数和 type 留在适配层。 */\nexport function dialogSlottedTriggerAttrs(source: object): Array<[string, string]> {\n const assigned: Array<[string, string]> = [];\n for (const [key, value] of Object.entries(source)) {\n if (value == null || typeof value === \"function\") continue;\n if (key === \"type\" || key === \"style\" || key === \"tabIndex\" || key === \"tabindex\") continue;\n if (typeof value === \"boolean\") assigned.push([key, value ? \"true\" : \"false\"]);\n else if (typeof value === \"string\" || typeof value === \"number\") assigned.push([key, String(value)]);\n }\n return assigned;\n}\n\n/** 双栈共享的 Dialog 操作区状态归一化。 */\nexport function resolveDialogActionState(\n props: QwDialogActionProps = {},\n): QwDialogActionState {\n const confirmLoading = props.confirmLoading ?? false;\n return {\n showCancel: props.showCancel !== false,\n cancelDisabled: props.cancelDisabled ?? false,\n confirmDisabled: (props.confirmDisabled ?? false) || confirmLoading,\n confirmLoading,\n };\n}\n\nexport { createPortalPlan, readPortalHostLocale, resolvePortalCopy } from \"../portal.js\";\nexport type {\n PortalCopy,\n PortalCopyAttribute,\n PortalKind,\n PortalPart,\n PortalPlan,\n PortalResolvedCopy,\n PortalSnapshot,\n PortalTarget,\n PortalVariableMode,\n} from \"../portal.js\";\n"],"mappings":";;;;;;;;AA+CA,SAAgB,QAA6B,SAAkB,WAA2E;CACxI,MAAM,MAAMA,UAAW,oBAAoB,OAAO,GAAG,SAAS;CAC9D,OAAO;EAAE,GAAG;EAAK,QAAQ,MAAM;GAAE,IAAI,MAAM,iBAAiB,OAAO;GAAG,IAAI,QAAQ,IAAI;EAAG;EAAG,sBAAsB,UAAU,QAAQ,iBAAiB,QAAQ,MAAM,IAAI,QAAQ,CAAC;CAAE;AACpL;;AAOA,SAAgB,kBAAkB,QAAuB,CAAC,GAA4B;CACpF,MAAM,MAA+B;EACnC,IAAI,MAAM;EACV,MAAM,MAAM;EAEZ,aAAa,OAAO,MAAM,SAAS,YAAY,QAAQ,MAAM;EAC7D,MAAM;EACN,OAAO;EACP,eAAe;EACf,wBAAwB,MAAM,qBAAqB;EACnD,eAAe,MAAM,sBAAsB;CAC7C;CAEA,IAAI,MAAM,cAAc;EACtB,MAAM,KAAK,MAAM;EACjB,IAAI,gBAAgB,MAAyB,GAAG,EAAE,IAAI;CACxD;CAEA,OAAO;AACT;AAUA,SAAS,YAAY,QAA6B;CAChD,IAAI,UAAU,WAAW,UAAU,OAAO,OAAO,UAAU,YAAY,OAAO,MAAM;AACtF;;;;;AAMA,SAAgB,uBACd,OACA,UACM;CACN,WAAW,KAAK;CAChB,IAAI,MAAM,kBAAkB;CAC5B,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;CAChD,MAAM,eAAe;CACrB,YAAY,MAAM,aAAa;AACjC;AAUA,SAAS,WAAW,OAA+C;CACjE,OAAO,CAAC,CAAC,UAAU,OAAO,UAAU,YAAY,OAAO,UAAU,eAAe,OAAQ,MAA+B,SAAS;AAClI;;AAGA,SAAgB,gBAAgB,MAA8B;CAC5D,IAAI,KAAK,UAAU;CACnB,MAAM,SAAS,KAAK,SAAS;CAC7B,IAAI,WAAW,MAAM,GAAG;EACtB,OAAY,WAAW,KAAK,MAAM,CAAC;EACnC;CACF;CACA,KAAK,MAAM;AACb;;AAGA,SAAgB,0BAA0B,QAAyC;CACjF,MAAM,WAAoC,CAAC;CAC3C,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAAG;EACjD,IAAI,SAAS,QAAQ,OAAO,UAAU,YAAY;EAClD,IAAI,QAAQ,UAAU,QAAQ,WAAW,QAAQ,cAAc,QAAQ,YAAY;EACnF,IAAI,OAAO,UAAU,WAAW,SAAS,KAAK,CAAC,KAAK,QAAQ,SAAS,OAAO,CAAC;OACxE,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAAU,SAAS,KAAK,CAAC,KAAK,OAAO,KAAK,CAAC,CAAC;CACrG;CACA,OAAO;AACT;;AAGA,SAAgB,yBACd,QAA6B,CAAC,GACT;CACrB,MAAM,iBAAiB,MAAM,kBAAkB;CAC/C,OAAO;EACL,YAAY,MAAM,eAAe;EACjC,gBAAgB,MAAM,kBAAkB;EACxC,kBAAkB,MAAM,mBAAmB,UAAU;EACrD;CACF;AACF"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Divider 契约 — 原型 A(无状态),core 无 machine,只承载双栈共享的类型契约。
2
+ * Divider 契约 — 原型 A(无状态),Core 无 machine,承载三栈共享的类型与渲染契约。
3
3
  * 渲染契约:`role="separator"`,`data-scope="divider"`,`data-part="root"`;
4
4
  * `data-orientation` / `data-weight` 摊平枚举,`vertical` 额外输出 `aria-orientation`。
5
5
  *
@@ -14,10 +14,26 @@ export declare const DIVIDER_PARTS: readonly ["root"];
14
14
  export type DividerOrientation = (typeof DIVIDER_ORIENTATIONS)[number];
15
15
  export type DividerWeight = (typeof DIVIDER_WEIGHTS)[number];
16
16
  export type DividerPart = (typeof DIVIDER_PARTS)[number];
17
- /** QwDividerProps — 双栈共享的行为契约(全字段可选)。 */
17
+ /** QwDividerProps — 三栈共享的行为与渲染契约(全字段可选)。 */
18
18
  export interface QwDividerProps {
19
19
  /** 方向,默认 horizontal。 */
20
20
  orientation?: DividerOrientation;
21
21
  /** 粗细,默认 thin(细,0.5px)。 */
22
22
  weight?: DividerWeight;
23
23
  }
24
+ export interface ResolvedDividerState {
25
+ orientation: DividerOrientation;
26
+ weight: DividerWeight;
27
+ }
28
+ /** Resolve the passive display contract once for every adapter. */
29
+ export declare function resolveDividerState(props?: QwDividerProps): ResolvedDividerState;
30
+ export interface DividerRootProps {
31
+ role: "separator";
32
+ "data-scope": "divider";
33
+ "data-part": "root";
34
+ "data-orientation": DividerOrientation;
35
+ "data-weight": DividerWeight;
36
+ "aria-orientation"?: "vertical";
37
+ }
38
+ /** Spread after caller attributes: Core owns these semantics. */
39
+ export declare function getDividerRootProps(state: ResolvedDividerState): DividerRootProps;
@@ -1,6 +1,6 @@
1
1
  //#region src/divider/divider.ts
2
2
  /**
3
- * Divider 契约 — 原型 A(无状态),core 无 machine,只承载双栈共享的类型契约。
3
+ * Divider 契约 — 原型 A(无状态),Core 无 machine,承载三栈共享的类型与渲染契约。
4
4
  * 渲染契约:`role="separator"`,`data-scope="divider"`,`data-part="root"`;
5
5
  * `data-orientation` / `data-weight` 摊平枚举,`vertical` 额外输出 `aria-orientation`。
6
6
  *
@@ -12,7 +12,25 @@ const DIVIDER_ORIENTATIONS = ["horizontal", "vertical"];
12
12
  const DIVIDER_WEIGHTS = ["thin", "thick"];
13
13
  /** Divider 各渲染部位全集(data-part 取值)。 */
14
14
  const DIVIDER_PARTS = ["root"];
15
+ /** Resolve the passive display contract once for every adapter. */
16
+ function resolveDividerState(props = {}) {
17
+ return {
18
+ orientation: DIVIDER_ORIENTATIONS.includes(props.orientation) ? props.orientation : "horizontal",
19
+ weight: DIVIDER_WEIGHTS.includes(props.weight) ? props.weight : "thin"
20
+ };
21
+ }
22
+ /** Spread after caller attributes: Core owns these semantics. */
23
+ function getDividerRootProps(state) {
24
+ return {
25
+ role: "separator",
26
+ "data-scope": "divider",
27
+ "data-part": "root",
28
+ "data-orientation": state.orientation,
29
+ "data-weight": state.weight,
30
+ "aria-orientation": state.orientation === "vertical" ? "vertical" : void 0
31
+ };
32
+ }
15
33
  //#endregion
16
- export { DIVIDER_ORIENTATIONS, DIVIDER_PARTS, DIVIDER_WEIGHTS };
34
+ export { DIVIDER_ORIENTATIONS, DIVIDER_PARTS, DIVIDER_WEIGHTS, getDividerRootProps, resolveDividerState };
17
35
 
18
36
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/divider/divider.ts"],"sourcesContent":["/**\n * Divider 契约 — 原型 A(无状态),core 无 machine,只承载双栈共享的类型契约。\n * 渲染契约:`role=\"separator\"`,`data-scope=\"divider\"`,`data-part=\"root\"`;\n * `data-orientation` / `data-weight` 摊平枚举,`vertical` 额外输出 `aria-orientation`。\n *\n * 方向 / 粗细词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。\n */\n\n/** 方向全集:horizontal 水平(默认)/ vertical 垂直。 */\nexport const DIVIDER_ORIENTATIONS = [\"horizontal\", \"vertical\"] as const;\n\n/** 粗细全集:thin 细 0.5px(默认)/ thick 粗 1px。 */\nexport const DIVIDER_WEIGHTS = [\"thin\", \"thick\"] as const;\n\n/** Divider 各渲染部位全集(data-part 取值)。 */\nexport const DIVIDER_PARTS = [\"root\"] as const;\n\nexport type DividerOrientation = (typeof DIVIDER_ORIENTATIONS)[number];\nexport type DividerWeight = (typeof DIVIDER_WEIGHTS)[number];\nexport type DividerPart = (typeof DIVIDER_PARTS)[number];\n\n/** QwDividerProps — 双栈共享的行为契约(全字段可选)。 */\nexport interface QwDividerProps {\n /** 方向,默认 horizontal。 */\n orientation?: DividerOrientation;\n /** 粗细,默认 thin(细,0.5px)。 */\n weight?: DividerWeight;\n}\n"],"mappings":";;;;;;;;;AASA,MAAa,uBAAuB,CAAC,cAAc,UAAU;;AAG7D,MAAa,kBAAkB,CAAC,QAAQ,OAAO;;AAG/C,MAAa,gBAAgB,CAAC,MAAM"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/divider/divider.ts"],"sourcesContent":["/**\n * Divider 契约 — 原型 A(无状态),Core 无 machine,承载三栈共享的类型与渲染契约。\n * 渲染契约:`role=\"separator\"`,`data-scope=\"divider\"`,`data-part=\"root\"`;\n * `data-orientation` / `data-weight` 摊平枚举,`vertical` 额外输出 `aria-orientation`。\n *\n * 方向 / 粗细词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。\n */\n\n/** 方向全集:horizontal 水平(默认)/ vertical 垂直。 */\nexport const DIVIDER_ORIENTATIONS = [\"horizontal\", \"vertical\"] as const;\n\n/** 粗细全集:thin 细 0.5px(默认)/ thick 粗 1px。 */\nexport const DIVIDER_WEIGHTS = [\"thin\", \"thick\"] as const;\n\n/** Divider 各渲染部位全集(data-part 取值)。 */\nexport const DIVIDER_PARTS = [\"root\"] as const;\n\nexport type DividerOrientation = (typeof DIVIDER_ORIENTATIONS)[number];\nexport type DividerWeight = (typeof DIVIDER_WEIGHTS)[number];\nexport type DividerPart = (typeof DIVIDER_PARTS)[number];\n\n/** QwDividerProps — 三栈共享的行为与渲染契约(全字段可选)。 */\nexport interface QwDividerProps {\n /** 方向,默认 horizontal。 */\n orientation?: DividerOrientation;\n /** 粗细,默认 thin(细,0.5px)。 */\n weight?: DividerWeight;\n}\n\n\nexport interface ResolvedDividerState { orientation: DividerOrientation; weight: DividerWeight }\n/** Resolve the passive display contract once for every adapter. */\nexport function resolveDividerState(props: QwDividerProps = {}): ResolvedDividerState {\n return { orientation: DIVIDER_ORIENTATIONS.includes(props.orientation!) ? props.orientation! : \"horizontal\", weight: DIVIDER_WEIGHTS.includes(props.weight!) ? props.weight! : \"thin\" };\n}\nexport interface DividerRootProps {\n role: \"separator\"; \"data-scope\": \"divider\"; \"data-part\": \"root\";\n \"data-orientation\": DividerOrientation; \"data-weight\": DividerWeight; \"aria-orientation\"?: \"vertical\";\n}\n/** Spread after caller attributes: Core owns these semantics. */\nexport function getDividerRootProps(state: ResolvedDividerState): DividerRootProps {\n return { role: \"separator\", \"data-scope\": \"divider\", \"data-part\": \"root\", \"data-orientation\": state.orientation, \"data-weight\": state.weight, \"aria-orientation\": state.orientation === \"vertical\" ? \"vertical\" : undefined };\n}\n"],"mappings":";;;;;;;;;AASA,MAAa,uBAAuB,CAAC,cAAc,UAAU;;AAG7D,MAAa,kBAAkB,CAAC,QAAQ,OAAO;;AAG/C,MAAa,gBAAgB,CAAC,MAAM;;AAiBpC,SAAgB,oBAAoB,QAAwB,CAAC,GAAyB;CACpF,OAAO;EAAE,aAAa,qBAAqB,SAAS,MAAM,WAAY,IAAI,MAAM,cAAe;EAAc,QAAQ,gBAAgB,SAAS,MAAM,MAAO,IAAI,MAAM,SAAU;CAAO;AACxL;;AAMA,SAAgB,oBAAoB,OAA+C;CACjF,OAAO;EAAE,MAAM;EAAa,cAAc;EAAW,aAAa;EAAQ,oBAAoB,MAAM;EAAa,eAAe,MAAM;EAAQ,oBAAoB,MAAM,gBAAgB,aAAa,aAAa,KAAA;CAAU;AAC9N"}
@@ -0,0 +1,172 @@
1
+ import { type Machine, type Service } from "@zag-js/core";
2
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
3
+ import { type FloatingAlign, type FloatingLayout, type FloatingPlacement, type FloatingSide } from "../popover/positioning.js";
4
+ import { type FloatingCloseRequest } from "../popover/layer.js";
5
+ /** Stable DOM parts shared by every adapter. */
6
+ export declare const DROPDOWN_PARTS: readonly ["trigger", "positioner", "content", "item"];
7
+ export type DropdownPlacement = FloatingPlacement;
8
+ export declare const DROPDOWN_DEFAULT_PLACEMENT: DropdownPlacement;
9
+ /** Main-axis gap between the trigger and the menu in CSS px. */
10
+ export declare const DROPDOWN_DEFAULT_OFFSET = 4;
11
+ /** Characters typed within this many milliseconds extend the typeahead query. */
12
+ export declare const DROPDOWN_TYPEAHEAD_TIMEOUT = 500;
13
+ export declare const DROPDOWN_MOVES: readonly ["first", "last", "next", "prev"];
14
+ export type DropdownMove = (typeof DROPDOWN_MOVES)[number];
15
+ /** One text menu item. value is the exact selection notification; label is the visible and typeahead text. */
16
+ export interface QwDropdownItem {
17
+ value: string;
18
+ label: string;
19
+ /** Visible and announced (aria-disabled) but skipped by roving focus and never selected. */
20
+ disabled?: boolean;
21
+ /** Destructive styling only; there is no second confirmation. */
22
+ danger?: boolean;
23
+ }
24
+ export interface QwResolvedDropdownItem {
25
+ readonly source: QwDropdownItem;
26
+ /** Position in the caller's items array; part of the item id. */
27
+ readonly index: number;
28
+ readonly value: string;
29
+ readonly label: string;
30
+ /** Disabled by the caller, or a later duplicate of an earlier value. */
31
+ readonly disabled: boolean;
32
+ readonly danger: boolean;
33
+ readonly duplicate: boolean;
34
+ }
35
+ /** keyboard: ArrowDown/ArrowUp on the trigger; tab / focus-outside: focus left the menu; select: an item was chosen. */
36
+ export type DropdownOpenChangeReason = "trigger" | "keyboard" | "escape" | "outside" | "focus-outside" | "tab" | "select" | "api";
37
+ export interface DropdownOpenChangeDetails {
38
+ open: boolean;
39
+ reason: DropdownOpenChangeReason;
40
+ }
41
+ export interface DropdownSelectDetails {
42
+ value: string;
43
+ }
44
+ export interface QwDropdownProps {
45
+ /** Page-unique instance identity; adapters generate one when omitted. */
46
+ id?: string;
47
+ /** Caller-owned menu items, never mutated; default []. */
48
+ items?: readonly QwDropdownItem[];
49
+ /** Controlled open state; undefined lets Core own it. */
50
+ open?: boolean;
51
+ /** Initial open state when uncontrolled. */
52
+ defaultOpen?: boolean;
53
+ /** Every open/close request, controlled or not; controlled owners accept by updating open, or refuse by keeping it. */
54
+ onOpenChange?: (details: DropdownOpenChangeDetails) => void;
55
+ /** An enabled item was activated (click, Enter or Space); a close request (reason select) follows. */
56
+ onSelect?: (details: DropdownSelectDetails) => void;
57
+ /** Preferred placement (default bottom-start; unknown values use it); positioning is Popover's Core module. */
58
+ placement?: DropdownPlacement;
59
+ /** Main-axis gap in CSS px; default 4. */
60
+ offset?: number;
61
+ /** Accessible name of the menu; omitted names it by the trigger (aria-labelledby). */
62
+ label?: string;
63
+ }
64
+ export interface ResolvedDropdownState {
65
+ placement: DropdownPlacement;
66
+ offset: number;
67
+ label: string | undefined;
68
+ }
69
+ export declare function resolveDropdownState(props?: QwDropdownProps): ResolvedDropdownState;
70
+ /** Keeps every item in order; a repeated value only keeps its first item enabled (a disabled first item does not promote a later one). */
71
+ export declare function resolveDropdownItems(items: readonly QwDropdownItem[] | undefined): readonly QwResolvedDropdownItem[];
72
+ /** Source index of the enabled item a move lands on, or -1 when nothing is enabled. next/prev wrap; from no highlight they start at the ends. */
73
+ export declare function getDropdownMoveTarget(items: readonly QwResolvedDropdownItem[], current: string | null, move: DropdownMove): number;
74
+ /**
75
+ * Explicit text match: the first enabled item, searching forward and wrapping, whose trimmed label starts
76
+ * with the query (locale lower case). A single or repeated character starts after the current item (so
77
+ * repeating it cycles); a longer query keeps the current item while it still matches. -1 when none matches.
78
+ */
79
+ export declare function getDropdownTypeaheadTarget(items: readonly QwResolvedDropdownItem[], current: string | null, query: string): number;
80
+ export declare function createDropdownProps(props?: QwDropdownProps): QwDropdownProps;
81
+ type FocusIntent = "first" | "last";
82
+ export interface QwDropdownSchema {
83
+ props: QwDropdownProps;
84
+ context: {
85
+ dismissReady: boolean;
86
+ layout: FloatingLayout | null;
87
+ highlighted: string | null;
88
+ };
89
+ refs: {
90
+ request: FloatingCloseRequest | null;
91
+ focus: FocusIntent | null;
92
+ typeahead: {
93
+ query: string;
94
+ at: number;
95
+ };
96
+ cancelFocus: (() => void) | null;
97
+ };
98
+ state: "open" | "closed";
99
+ guard: "isControlled";
100
+ action: "notifyOpen" | "notifyClose" | "restoreFocus" | "setLayout" | "dismissReady" | "clearLayout" | "syncControlled" | "highlight" | "move" | "typeahead" | "select" | "reconcile";
101
+ effect: "trackLayout" | "trackDismiss";
102
+ event: {
103
+ type: "DISMISS.READY";
104
+ } | {
105
+ type: "OPEN" | "TOGGLE";
106
+ reason?: DropdownOpenChangeReason;
107
+ focus?: FocusIntent;
108
+ } | {
109
+ type: "CLOSE";
110
+ reason?: DropdownOpenChangeReason;
111
+ focusable?: boolean;
112
+ } | {
113
+ type: "CONTROLLED.OPEN" | "CONTROLLED.CLOSE";
114
+ } | {
115
+ type: "LAYOUT";
116
+ layout: FloatingLayout;
117
+ } | {
118
+ type: "HIGHLIGHT";
119
+ value: string;
120
+ } | {
121
+ type: "MOVE";
122
+ to: DropdownMove;
123
+ } | {
124
+ type: "TYPEAHEAD";
125
+ key: string;
126
+ } | {
127
+ type: "SELECT";
128
+ index: number;
129
+ value: string;
130
+ };
131
+ }
132
+ export type QwDropdownMachine = Machine<QwDropdownSchema>;
133
+ export type QwDropdownService = Service<QwDropdownSchema>;
134
+ /**
135
+ * Core owns the menu: open/close with controlled refusal, Popover's positioning module while open, the
136
+ * shared non-modal layer (Escape, outside pointer, focus leaving), roving focus, typeahead, selection and
137
+ * focus return to the original trigger.
138
+ */
139
+ export declare const dropdownMachine: QwDropdownMachine;
140
+ /** Minimal event surfaces shared by React, Vue and native events. */
141
+ export interface DropdownDomEvent {
142
+ readonly defaultPrevented: boolean;
143
+ preventDefault(): void;
144
+ }
145
+ export interface DropdownKeyboardEvent extends DropdownDomEvent {
146
+ readonly key: string;
147
+ readonly shiftKey?: boolean;
148
+ readonly altKey?: boolean;
149
+ readonly ctrlKey?: boolean;
150
+ readonly metaKey?: boolean;
151
+ readonly isComposing?: boolean;
152
+ }
153
+ export interface QwDropdownApi<T extends PropTypes = PropTypes> {
154
+ open: boolean;
155
+ /** The measured placement while open (after flipping), otherwise the preferred one. */
156
+ placement: DropdownPlacement;
157
+ side: FloatingSide;
158
+ align: FloatingAlign;
159
+ positioned: boolean;
160
+ items: readonly QwResolvedDropdownItem[];
161
+ /** Value of the item holding roving focus. */
162
+ highlighted: string | null;
163
+ /** Request a state; controlled owners decide through onOpenChange (reason api). */
164
+ setOpen(open: boolean): void;
165
+ /** Merge onto the caller's own trigger node (click toggles; ArrowDown/ArrowUp open on the first/last item); preventDefault() in its handlers skips Core. */
166
+ getTriggerProps(): T["element"];
167
+ getPositionerProps(): T["element"];
168
+ getContentProps(): T["element"];
169
+ getItemProps(item: QwResolvedDropdownItem): T["element"];
170
+ }
171
+ export declare function connectDropdown<T extends PropTypes>(service: QwDropdownService, normalize: NormalizeProps<T>): QwDropdownApi<T>;
172
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./dropdown.js";
2
+ export type { FloatingAlign, FloatingLayout, FloatingPlacement, FloatingSide } from "../popover/positioning.js";