@qw-ui/core 0.3.0-next.8 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (415) 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 +85 -0
  26. package/dist/badge/index.d.ts +1 -0
  27. package/dist/badge/index.js +88 -0
  28. package/dist/badge/index.js.map +1 -0
  29. package/dist/button/button.d.ts +13 -0
  30. package/dist/button/index.js +3 -5
  31. package/dist/button/index.js.map +1 -1
  32. package/dist/calendar/calendar.d.ts +100 -0
  33. package/dist/calendar/index.d.ts +1 -0
  34. package/dist/calendar/index.js +2 -0
  35. package/dist/calendar-CmpK3stz.js +363 -0
  36. package/dist/calendar-CmpK3stz.js.map +1 -0
  37. package/dist/card/card.d.ts +68 -0
  38. package/dist/card/index.d.ts +2 -0
  39. package/dist/card/index.js +2 -0
  40. package/dist/card-DRtWa6Cr.js +107 -0
  41. package/dist/card-DRtWa6Cr.js.map +1 -0
  42. package/dist/cascader/cascader.d.ts +115 -0
  43. package/dist/cascader/index.d.ts +1 -0
  44. package/dist/cascader/index.js +2 -0
  45. package/dist/cascader-D-xMjs7P.js +333 -0
  46. package/dist/cascader-D-xMjs7P.js.map +1 -0
  47. package/dist/cell/cell.d.ts +41 -0
  48. package/dist/cell/index.d.ts +1 -0
  49. package/dist/cell/index.js +43 -0
  50. package/dist/cell/index.js.map +1 -0
  51. package/dist/check-list/check-list.d.ts +78 -0
  52. package/dist/check-list/index.d.ts +2 -0
  53. package/dist/check-list/index.js +2 -0
  54. package/dist/check-list-BvZHQt5w.js +60 -0
  55. package/dist/check-list-BvZHQt5w.js.map +1 -0
  56. package/dist/checkbox/checkbox.d.ts +59 -0
  57. package/dist/checkbox/index.d.ts +2 -0
  58. package/dist/checkbox/index.js +2 -0
  59. package/dist/checkbox-BlndJrz5.js +127 -0
  60. package/dist/checkbox-BlndJrz5.js.map +1 -0
  61. package/dist/checkbox-group/checkbox-group.d.ts +86 -0
  62. package/dist/checkbox-group/index.d.ts +3 -0
  63. package/dist/checkbox-group/index.js +2 -0
  64. package/dist/checkbox-group-gGfsTv-e.js +223 -0
  65. package/dist/checkbox-group-gGfsTv-e.js.map +1 -0
  66. package/dist/choice-group-C4c9m0qe.js +373 -0
  67. package/dist/choice-group-C4c9m0qe.js.map +1 -0
  68. package/dist/circle/circle.d.ts +97 -0
  69. package/dist/circle/index.d.ts +1 -0
  70. package/dist/circle/index.js +119 -0
  71. package/dist/circle/index.js.map +1 -0
  72. package/dist/collapse/collapse.d.ts +98 -0
  73. package/dist/collapse/index.d.ts +2 -0
  74. package/dist/collapse/index.js +2 -0
  75. package/dist/collapse-B969h7-H.js +226 -0
  76. package/dist/collapse-B969h7-H.js.map +1 -0
  77. package/dist/countdown/countdown.d.ts +114 -0
  78. package/dist/countdown/index.d.ts +1 -0
  79. package/dist/countdown/index.js +309 -0
  80. package/dist/countdown/index.js.map +1 -0
  81. package/dist/date-picker/date-picker.d.ts +168 -0
  82. package/dist/date-picker/index.d.ts +1 -0
  83. package/dist/date-picker/index.js +401 -0
  84. package/dist/date-picker/index.js.map +1 -0
  85. package/dist/descriptions/descriptions.d.ts +69 -0
  86. package/dist/descriptions/index.d.ts +1 -0
  87. package/dist/descriptions/index.js +86 -0
  88. package/dist/descriptions/index.js.map +1 -0
  89. package/dist/dialog/dialog.d.ts +61 -43
  90. package/dist/dialog/index.js +73 -19
  91. package/dist/dialog/index.js.map +1 -1
  92. package/dist/divider/divider.d.ts +18 -2
  93. package/dist/divider/index.js +20 -2
  94. package/dist/divider/index.js.map +1 -1
  95. package/dist/dropdown/dropdown.d.ts +172 -0
  96. package/dist/dropdown/index.d.ts +2 -0
  97. package/dist/dropdown/index.js +467 -0
  98. package/dist/dropdown/index.js.map +1 -0
  99. package/dist/ellipsis/ellipsis-layout.d.ts +34 -0
  100. package/dist/ellipsis/ellipsis.d.ts +88 -0
  101. package/dist/ellipsis/index.d.ts +2 -0
  102. package/dist/ellipsis/index.js +320 -0
  103. package/dist/ellipsis/index.js.map +1 -0
  104. package/dist/empty/empty-illustration.d.ts +3 -0
  105. package/dist/empty/empty.d.ts +43 -1
  106. package/dist/empty/index.js +2 -21
  107. package/dist/empty-CAgyvhUI.js +166 -0
  108. package/dist/empty-CAgyvhUI.js.map +1 -0
  109. package/dist/field/field.d.ts +95 -0
  110. package/dist/field/index.d.ts +2 -0
  111. package/dist/field/index.js +2 -0
  112. package/dist/field-DMHGIMZF.js +241 -0
  113. package/dist/field-DMHGIMZF.js.map +1 -0
  114. package/dist/floating-bubble/floating-bubble.d.ts +116 -0
  115. package/dist/floating-bubble/index.d.ts +1 -0
  116. package/dist/floating-bubble/index.js +333 -0
  117. package/dist/floating-bubble/index.js.map +1 -0
  118. package/dist/floating-panel/floating-panel.d.ts +80 -0
  119. package/dist/floating-panel/index.d.ts +2 -0
  120. package/dist/floating-panel/index.js +2 -0
  121. package/dist/floating-panel-Cbm5njBJ.js +363 -0
  122. package/dist/floating-panel-Cbm5njBJ.js.map +1 -0
  123. package/dist/footer/footer.d.ts +94 -0
  124. package/dist/footer/index.d.ts +1 -0
  125. package/dist/footer/index.js +154 -0
  126. package/dist/footer/index.js.map +1 -0
  127. package/dist/form/connect.d.ts +6 -0
  128. package/dist/form/form.d.ts +100 -0
  129. package/dist/form/ids.d.ts +14 -0
  130. package/dist/form/index.d.ts +13 -0
  131. package/dist/form/index.js +3 -0
  132. package/dist/form/methods.d.ts +5 -0
  133. package/dist/form/model.d.ts +24 -0
  134. package/dist/form/native.d.ts +25 -0
  135. package/dist/form/rules.d.ts +40 -0
  136. package/dist/form/ssr.d.ts +7 -0
  137. package/dist/form/types.d.ts +150 -0
  138. package/dist/form-BAGkIEMY.js +1354 -0
  139. package/dist/form-BAGkIEMY.js.map +1 -0
  140. package/dist/format-BDUY0C_c.js +89 -0
  141. package/dist/format-BDUY0C_c.js.map +1 -0
  142. package/dist/gesture-_SRHIvBm.js +30 -0
  143. package/dist/gesture-_SRHIvBm.js.map +1 -0
  144. package/dist/grid/grid-item.d.ts +22 -0
  145. package/dist/grid/grid.d.ts +42 -0
  146. package/dist/grid/index.d.ts +2 -0
  147. package/dist/grid/index.js +73 -0
  148. package/dist/grid/index.js.map +1 -0
  149. package/dist/icon/icon.d.ts +37 -1
  150. package/dist/icon/identity.d.ts +3 -0
  151. package/dist/icon/index.js +2 -20
  152. package/dist/icon-Cgdbnk1u.js +77 -0
  153. package/dist/icon-Cgdbnk1u.js.map +1 -0
  154. package/dist/image/image-load.d.ts +24 -0
  155. package/dist/image/image.d.ts +45 -8
  156. package/dist/image/index.d.ts +1 -0
  157. package/dist/image/index.js +116 -14
  158. package/dist/image/index.js.map +1 -1
  159. package/dist/image-preview/image-preview.d.ts +124 -0
  160. package/dist/image-preview/index.d.ts +1 -0
  161. package/dist/image-preview/index.js +450 -0
  162. package/dist/image-preview/index.js.map +1 -0
  163. package/dist/index-bar/index-bar.d.ts +121 -0
  164. package/dist/index-bar/index.d.ts +1 -0
  165. package/dist/index-bar/index.js +386 -0
  166. package/dist/index-bar/index.js.map +1 -0
  167. package/dist/index.d.ts +115 -10
  168. package/dist/index.js +151 -11
  169. package/dist/index.js.map +1 -0
  170. package/dist/infinite-scroll/index.d.ts +1 -0
  171. package/dist/infinite-scroll/index.js +248 -0
  172. package/dist/infinite-scroll/index.js.map +1 -0
  173. package/dist/infinite-scroll/infinite-scroll.d.ts +95 -0
  174. package/dist/input/index.js +181 -22
  175. package/dist/input/index.js.map +1 -1
  176. package/dist/input/input.d.ts +44 -1
  177. package/dist/layer-IpFrl5--.js +414 -0
  178. package/dist/layer-IpFrl5--.js.map +1 -0
  179. package/dist/layout-BRSqi4AQ.js +43 -0
  180. package/dist/layout-BRSqi4AQ.js.map +1 -0
  181. package/dist/layout.d.ts +13 -0
  182. package/dist/list/index.d.ts +2 -0
  183. package/dist/list/index.js +2 -0
  184. package/dist/list/list.d.ts +30 -0
  185. package/dist/list-6-iz-Irh.js +28 -0
  186. package/dist/list-6-iz-Irh.js.map +1 -0
  187. package/dist/loading/index.js +45 -2
  188. package/dist/loading/index.js.map +1 -1
  189. package/dist/loading/loading.d.ts +45 -2
  190. package/dist/modal-dialog-machine-CF9_z3Dm.js +487 -0
  191. package/dist/modal-dialog-machine-CF9_z3Dm.js.map +1 -0
  192. package/dist/modal-dialog-machine.d.ts +21 -0
  193. package/dist/modal-dismissable-lifetime.d.ts +21 -0
  194. package/dist/modal-registry.d.ts +24 -0
  195. package/dist/modal-render-hydration.d.ts +35 -0
  196. package/dist/modal-render-runtime.d.ts +19 -0
  197. package/dist/modal-render-scope.d.ts +63 -0
  198. package/dist/nav-bar/index.d.ts +1 -0
  199. package/dist/nav-bar/index.js +115 -0
  200. package/dist/nav-bar/index.js.map +1 -0
  201. package/dist/nav-bar/nav-bar.d.ts +76 -0
  202. package/dist/notice-bar/index.d.ts +2 -0
  203. package/dist/notice-bar/index.js +2 -0
  204. package/dist/notice-bar/notice-bar.d.ts +103 -0
  205. package/dist/notice-bar-DMpwLvRb.js +231 -0
  206. package/dist/notice-bar-DMpwLvRb.js.map +1 -0
  207. package/dist/notify/index.d.ts +1 -0
  208. package/dist/notify/index.js +251 -0
  209. package/dist/notify/index.js.map +1 -0
  210. package/dist/notify/notify.d.ts +123 -0
  211. package/dist/number-keyboard/index.d.ts +1 -0
  212. package/dist/number-keyboard/index.js +333 -0
  213. package/dist/number-keyboard/index.js.map +1 -0
  214. package/dist/number-keyboard/number-keyboard.d.ts +141 -0
  215. package/dist/overlay-panel/index.d.ts +2 -0
  216. package/dist/overlay-panel/index.js +2 -0
  217. package/dist/overlay-panel/overlay-panel.d.ts +20 -0
  218. package/dist/overlay-panel-Z_qdKeBj.js +26 -0
  219. package/dist/overlay-panel-Z_qdKeBj.js.map +1 -0
  220. package/dist/page-indicator/index.d.ts +1 -0
  221. package/dist/page-indicator/index.js +138 -0
  222. package/dist/page-indicator/index.js.map +1 -0
  223. package/dist/page-indicator/page-indicator.d.ts +93 -0
  224. package/dist/pagination/index.d.ts +1 -0
  225. package/dist/pagination/index.js +198 -0
  226. package/dist/pagination/index.js.map +1 -0
  227. package/dist/pagination/pagination.d.ts +125 -0
  228. package/dist/password-input/index.d.ts +1 -0
  229. package/dist/password-input/index.js +317 -0
  230. package/dist/password-input/index.js.map +1 -0
  231. package/dist/password-input/password-input.d.ts +144 -0
  232. package/dist/picker/index.d.ts +8 -0
  233. package/dist/picker/index.js +2 -0
  234. package/dist/picker/picker-machine.d.ts +80 -0
  235. package/dist/picker/picker.d.ts +121 -0
  236. package/dist/picker/platform.d.ts +84 -0
  237. package/dist/picker/selection-connect.d.ts +90 -0
  238. package/dist/picker/selection-model.d.ts +211 -0
  239. package/dist/picker-BykFntQN.js +1675 -0
  240. package/dist/picker-BykFntQN.js.map +1 -0
  241. package/dist/popover/index.d.ts +3 -0
  242. package/dist/popover/index.js +253 -0
  243. package/dist/popover/index.js.map +1 -0
  244. package/dist/popover/layer.d.ts +44 -0
  245. package/dist/popover/popover.d.ts +104 -0
  246. package/dist/popover/positioning.d.ts +132 -0
  247. package/dist/popup/index.d.ts +2 -0
  248. package/dist/popup/index.js +2 -0
  249. package/dist/popup/popup.d.ts +60 -0
  250. package/dist/popup-z5d8IYCt.js +576 -0
  251. package/dist/popup-z5d8IYCt.js.map +1 -0
  252. package/dist/portal-BHCNTWhg.js +78 -0
  253. package/dist/portal-BHCNTWhg.js.map +1 -0
  254. package/dist/portal.d.ts +61 -0
  255. package/dist/price/format.d.ts +19 -0
  256. package/dist/price/index.d.ts +1 -0
  257. package/dist/price/index.js +154 -0
  258. package/dist/price/index.js.map +1 -0
  259. package/dist/price/price.d.ts +88 -0
  260. package/dist/progress/index.d.ts +1 -0
  261. package/dist/progress/index.js +2 -0
  262. package/dist/progress/progress.d.ts +32 -0
  263. package/dist/progress-f3iYEfdA.js +37 -0
  264. package/dist/progress-f3iYEfdA.js.map +1 -0
  265. package/dist/pull-refresh/index.d.ts +1 -0
  266. package/dist/pull-refresh/index.js +414 -0
  267. package/dist/pull-refresh/index.js.map +1 -0
  268. package/dist/pull-refresh/pull-refresh.d.ts +118 -0
  269. package/dist/radio-group/index.d.ts +3 -0
  270. package/dist/radio-group/index.js +2 -0
  271. package/dist/radio-group/radio-group.d.ts +78 -0
  272. package/dist/radio-group-BOIMuqnS.js +230 -0
  273. package/dist/radio-group-BOIMuqnS.js.map +1 -0
  274. package/dist/rate/index.d.ts +1 -0
  275. package/dist/rate/index.js +2 -0
  276. package/dist/rate/rate-form.d.ts +28 -0
  277. package/dist/rate/rate.d.ts +144 -0
  278. package/dist/rate-5XsU2QkY.js +631 -0
  279. package/dist/rate-5XsU2QkY.js.map +1 -0
  280. package/dist/reorder/index.d.ts +1 -0
  281. package/dist/reorder/index.js +720 -0
  282. package/dist/reorder/index.js.map +1 -0
  283. package/dist/reorder/reorder.d.ts +190 -0
  284. package/dist/result/index.d.ts +1 -0
  285. package/dist/result/index.js +123 -0
  286. package/dist/result/index.js.map +1 -0
  287. package/dist/result/result.d.ts +88 -0
  288. package/dist/safe-area/index.d.ts +1 -0
  289. package/dist/safe-area/index.js +42 -0
  290. package/dist/safe-area/index.js.map +1 -0
  291. package/dist/safe-area/safe-area.d.ts +28 -0
  292. package/dist/search-bar/index.js +4 -2
  293. package/dist/search-bar/index.js.map +1 -1
  294. package/dist/search-bar/search-bar.d.ts +6 -0
  295. package/dist/segmented/index.d.ts +2 -0
  296. package/dist/segmented/index.js +2 -0
  297. package/dist/segmented/segmented.d.ts +127 -0
  298. package/dist/segmented-BaU38_L4.js +367 -0
  299. package/dist/segmented-BaU38_L4.js.map +1 -0
  300. package/dist/selection-form-BOM_odUk.js +88 -0
  301. package/dist/selection-form-BOM_odUk.js.map +1 -0
  302. package/dist/selection-form.d.ts +27 -0
  303. package/dist/selection-ivXqO1eu.js +55 -0
  304. package/dist/selection-ivXqO1eu.js.map +1 -0
  305. package/dist/selection.d.ts +29 -0
  306. package/dist/selector/choice-group.d.ts +114 -0
  307. package/dist/selector/index.d.ts +2 -0
  308. package/dist/selector/index.js +2 -0
  309. package/dist/selector/selector.d.ts +90 -0
  310. package/dist/selector-BU2MMJ4N.js +93 -0
  311. package/dist/selector-BU2MMJ4N.js.map +1 -0
  312. package/dist/share-sheet/index.d.ts +1 -0
  313. package/dist/share-sheet/index.js +138 -0
  314. package/dist/share-sheet/index.js.map +1 -0
  315. package/dist/share-sheet/share-sheet.d.ts +139 -0
  316. package/dist/side-nav/index.d.ts +1 -0
  317. package/dist/side-nav/index.js +99 -0
  318. package/dist/side-nav/index.js.map +1 -0
  319. package/dist/side-nav/side-nav.d.ts +94 -0
  320. package/dist/skeleton/index.js +51 -2
  321. package/dist/skeleton/index.js.map +1 -1
  322. package/dist/skeleton/skeleton.d.ts +34 -3
  323. package/dist/slider/index.d.ts +1 -0
  324. package/dist/slider/index.js +482 -0
  325. package/dist/slider/index.js.map +1 -0
  326. package/dist/slider/slider.d.ts +174 -0
  327. package/dist/space/index.d.ts +1 -0
  328. package/dist/space/index.js +52 -0
  329. package/dist/space/index.js.map +1 -0
  330. package/dist/space/space.d.ts +46 -0
  331. package/dist/statistic/index.d.ts +1 -0
  332. package/dist/statistic/index.js +152 -0
  333. package/dist/statistic/index.js.map +1 -0
  334. package/dist/statistic/statistic.d.ts +101 -0
  335. package/dist/stepper/index.d.ts +1 -0
  336. package/dist/stepper/index.js +172 -0
  337. package/dist/stepper/index.js.map +1 -0
  338. package/dist/stepper/stepper.d.ts +161 -0
  339. package/dist/steps/index.d.ts +1 -0
  340. package/dist/steps/index.js +72 -0
  341. package/dist/steps/index.js.map +1 -0
  342. package/dist/steps/steps.d.ts +67 -0
  343. package/dist/sticky/index.d.ts +1 -0
  344. package/dist/sticky/index.js +145 -0
  345. package/dist/sticky/index.js.map +1 -0
  346. package/dist/sticky/sticky.d.ts +70 -0
  347. package/dist/swipe-action/index.d.ts +1 -0
  348. package/dist/swipe-action/index.js +417 -0
  349. package/dist/swipe-action/index.js.map +1 -0
  350. package/dist/swipe-action/swipe-action.d.ts +148 -0
  351. package/dist/swiper/gesture.d.ts +32 -0
  352. package/dist/swiper/index.d.ts +1 -0
  353. package/dist/swiper/index.js +2 -0
  354. package/dist/swiper/swiper.d.ts +177 -0
  355. package/dist/swiper-BKivDkHp.js +550 -0
  356. package/dist/swiper-BKivDkHp.js.map +1 -0
  357. package/dist/switch/index.d.ts +1 -0
  358. package/dist/switch/index.js +168 -0
  359. package/dist/switch/index.js.map +1 -0
  360. package/dist/switch/switch.d.ts +142 -0
  361. package/dist/tabbar/index.d.ts +1 -0
  362. package/dist/tabbar/index.js +95 -0
  363. package/dist/tabbar/index.js.map +1 -0
  364. package/dist/tabbar/tabbar.d.ts +119 -0
  365. package/dist/tabs/index.js +22 -1
  366. package/dist/tabs/index.js.map +1 -1
  367. package/dist/tabs/tabs.d.ts +12 -8
  368. package/dist/tag/index.js +123 -2
  369. package/dist/tag/index.js.map +1 -1
  370. package/dist/tag/tag.d.ts +67 -1
  371. package/dist/textarea/index.d.ts +2 -0
  372. package/dist/textarea/index.js +2 -242
  373. package/dist/textarea/platform.d.ts +22 -0
  374. package/dist/textarea/textarea.d.ts +169 -46
  375. package/dist/textarea-qbnruDUG.js +775 -0
  376. package/dist/textarea-qbnruDUG.js.map +1 -0
  377. package/dist/time-picker/index.d.ts +1 -0
  378. package/dist/time-picker/index.js +228 -0
  379. package/dist/time-picker/index.js.map +1 -0
  380. package/dist/time-picker/time-picker.d.ts +83 -0
  381. package/dist/timeline/index.d.ts +1 -0
  382. package/dist/timeline/index.js +131 -0
  383. package/dist/timeline/index.js.map +1 -0
  384. package/dist/timeline/timeline.d.ts +79 -0
  385. package/dist/toast/index.js +47 -4
  386. package/dist/toast/index.js.map +1 -1
  387. package/dist/toast/toast.d.ts +26 -3
  388. package/dist/top-bar/index.js +16 -2
  389. package/dist/top-bar/index.js.map +1 -1
  390. package/dist/top-bar/top-bar.d.ts +13 -2
  391. package/dist/tree-select/index.d.ts +1 -0
  392. package/dist/tree-select/index.js +512 -0
  393. package/dist/tree-select/index.js.map +1 -0
  394. package/dist/tree-select/tree-select.d.ts +215 -0
  395. package/dist/typography/index.d.ts +1 -0
  396. package/dist/typography/index.js +82 -0
  397. package/dist/typography/index.js.map +1 -0
  398. package/dist/typography/typography.d.ts +54 -0
  399. package/dist/upload/index.d.ts +1 -0
  400. package/dist/upload/index.js +458 -0
  401. package/dist/upload/index.js.map +1 -0
  402. package/dist/upload/upload.d.ts +172 -0
  403. package/dist/virtual-list/index.d.ts +1 -0
  404. package/dist/virtual-list/index.js +445 -0
  405. package/dist/virtual-list/index.js.map +1 -0
  406. package/dist/virtual-list/virtual-list.d.ts +160 -0
  407. package/dist/visual-manifest.d.ts +27 -0
  408. package/dist/watermark/index.d.ts +1 -0
  409. package/dist/watermark/index.js +260 -0
  410. package/dist/watermark/index.js.map +1 -0
  411. package/dist/watermark/watermark.d.ts +106 -0
  412. package/package.json +417 -44
  413. package/dist/empty/index.js.map +0 -1
  414. package/dist/icon/index.js.map +0 -1
  415. 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,59 +1,77 @@
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
- * QwDialogProps — Dialog 的用户输入。
4
+ * QwDialogProps — H5 系统 Dialog 的跨框架行为输入。
4
5
  *
5
- * 对 zag.js 输入做两件事 (§06):
6
- * 1. 默认值收口:closeOnEsc / closeOnOutside / scrollLock 默认全 true;
7
- * 2. 命名 rebrand:把 zag 的 closeOnInteractOutside / preventScroll 改成业务易懂命名;
8
- * 3. 业务 props 透出:onOpenChange / initialFocus / returnFocus 在 React/Vue 同名。
9
- *
10
- * 业务方只需 import 本类型,不需要直接 import `@zag-js/*`。
6
+ * 只暴露业务能理解的开合、遮罩点击、body 滚动控制;modal / role / focus
7
+ * 策略是组件内部无障碍政策,不作为业务 API。
11
8
  */
12
9
  export interface QwDialogProps {
13
- /** 唯一 id 前缀;不传时由 zag 安全生成 (SSR/CSR 一致)。 */
10
+ /** 唯一 id 前缀;不传时由适配层提供 SSR/CSR 稳定 id。 */
14
11
  id?: string;
15
12
  /** 受控开关。 */
16
13
  open?: boolean;
17
14
  /** 非受控初值。 */
18
15
  defaultOpen?: boolean;
19
- /** ESC 关闭,默认 true (zag 原名 closeOnEscape)。 */
20
- closeOnEsc?: boolean;
21
- /** 点击 backdrop 关闭,默认 true (zag 原名 closeOnInteractOutside)。 */
22
- closeOnOutside?: boolean;
23
- /** 滚动锁,默认 true (zag 原名 preventScroll)。 */
24
- scrollLock?: boolean;
25
- /** 模态遮蔽,默认 true。 */
26
- modal?: boolean;
27
- /** 角色,默认 dialog。 */
28
- role?: "dialog" | "alertdialog";
29
- /** 初始焦点策略;对象形式提供 selector,由 core 翻译成 zag 的 initialFocusEl。 */
30
- initialFocus?: "autofocus" | "first" | "none" | {
31
- selector: string;
32
- };
33
- /** 关闭回焦策略;对应 zag 的 restoreFocus + finalFocusEl。 */
34
- returnFocus?: "previous" | "none" | {
35
- selector: string;
36
- };
37
- /** 状态变化回调;zag 原生 onOpenChange。 */
38
- onOpenChange?: (e: {
39
- open: boolean;
40
- }) => void;
41
- /**
42
- * 禁用 trigger:禁用后点击/键盘都不打开。
43
- * adapter 层声明式属性(落到原生 button[disabled])——zag dialog 无此 context,不进 machine。
44
- */
45
- disabled?: boolean;
16
+ /** 点击遮罩关闭,默认 true。 */
17
+ closeOnMaskClick?: boolean;
18
+ /** Dialog 打开时禁止 body 滚动,默认 true。 */
19
+ disableBodyScroll?: boolean;
20
+ /** 状态变化回调。 */
21
+ onOpenChange?: (open: boolean) => void;
22
+ }
23
+ export interface QwDialogActionProps {
24
+ /** 是否展示取消按钮,默认 true。 */
25
+ showCancel?: boolean;
26
+ /** 取消按钮禁用。 */
27
+ cancelDisabled?: boolean;
28
+ /** 确认按钮禁用。 */
29
+ confirmDisabled?: boolean;
30
+ /** 确认按钮忙碌;忙碌时视为禁用。 */
31
+ confirmLoading?: boolean;
32
+ }
33
+ export interface QwDialogActionState {
34
+ showCancel: boolean;
35
+ cancelDisabled: boolean;
36
+ confirmDisabled: boolean;
37
+ confirmLoading: boolean;
46
38
  }
47
39
  /**
48
- * 直接 re-export zag 的 dialog machine 与 connect —— 不再包一层。
49
- * machine 由各框架 useMachine 消费;connect 把 service 接成 prop-getter。
50
- * 用 re-export 而非 `const x = dialog.x` 以保留原始可移植类型 (避免 TS2742)。
40
+ * 共用 Core 的 Zag dialog 薄包装;connect 只追加纯声明属性 getter。
41
+ * 各框架适配层只实例化 service 并摊 prop-getter。
51
42
  */
52
- 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";
53
47
  /** rebrand zag 的 DialogApi 类型对外。 */
54
48
  export type { Api as QwDialogApi } from "@zag-js/dialog";
49
+ /** 把 H5 Dialog 公开 props 转成 zag dialog machine context。 */
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
+ }
55
58
  /**
56
- * 把 QwDialogProps 转成 zag dialog machine 的 context (默认值收口 + 命名 rebrand)。
57
- * 用法:`useMachine(dialogMachine, createDialogProps(props))`。
59
+ * 非按钮触发器的 Enter / Space。先交给已有 keydown(例如 zag),
60
+ * 未被取消时 preventDefault,并点击 currentTarget,让点击路径统一打开。
58
61
  */
59
- export declare function createDialogProps(props?: QwDialogProps): Partial<ZagDialogProps>;
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]>;
74
+ /** 双栈共享的 Dialog 操作区状态归一化。 */
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,35 +1,89 @@
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
3
5
  /**
4
- * 把 QwDialogProps 转成 zag dialog machine 的 context (默认值收口 + 命名 rebrand)。
5
- * 用法:`useMachine(dialogMachine, createDialogProps(props))`。
6
+ * 共用 Core 的 Zag dialog 薄包装;connect 只追加纯声明属性 getter。
7
+ * 各框架适配层只实例化 service 并摊 prop-getter。
6
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
+ }
20
+ /** 把 H5 Dialog 公开 props 转成 zag dialog machine context。 */
7
21
  function createDialogProps(props = {}) {
8
22
  const ctx = {
9
23
  id: props.id,
10
24
  open: props.open,
11
- defaultOpen: props.defaultOpen,
12
- role: props.role,
13
- closeOnEscape: props.closeOnEsc !== false,
14
- closeOnInteractOutside: props.closeOnOutside !== false,
15
- preventScroll: props.scrollLock !== false
25
+ defaultOpen: typeof props.open === "boolean" ? false : props.defaultOpen,
26
+ role: "dialog",
27
+ modal: true,
28
+ closeOnEscape: true,
29
+ closeOnInteractOutside: props.closeOnMaskClick !== false,
30
+ preventScroll: props.disableBodyScroll !== false
16
31
  };
17
- if (props.modal !== void 0) ctx.modal = props.modal;
18
32
  if (props.onOpenChange) {
19
33
  const cb = props.onOpenChange;
20
- ctx.onOpenChange = (d) => cb({ open: d.open });
34
+ ctx.onOpenChange = (d) => cb(d.open);
21
35
  }
22
- if (typeof props.initialFocus === "object") {
23
- const sel = props.initialFocus.selector;
24
- ctx.initialFocusEl = () => document.querySelector(sel);
25
- }
26
- if (typeof props.returnFocus === "object") {
27
- const sel = props.returnFocus.selector;
28
- ctx.finalFocusEl = () => document.querySelector(sel);
29
- } else if (props.returnFocus === "none") ctx.restoreFocus = false;
30
36
  return ctx;
31
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
+ }
76
+ /** 双栈共享的 Dialog 操作区状态归一化。 */
77
+ function resolveDialogActionState(props = {}) {
78
+ const confirmLoading = props.confirmLoading ?? false;
79
+ return {
80
+ showCancel: props.showCancel !== false,
81
+ cancelDisabled: props.cancelDisabled ?? false,
82
+ confirmDisabled: (props.confirmDisabled ?? false) || confirmLoading,
83
+ confirmLoading
84
+ };
85
+ }
32
86
  //#endregion
33
- export { connect, createDialogProps, dialogMachine };
87
+ export { connect, createDialogProps, createPortalPlan, modalDialogMachine as dialogMachine, dialogSlottedTriggerAttrs, handleDialogTriggerKey, readPortalHostLocale, resolveDialogActionState, resolvePortalCopy, runDialogAction };
34
88
 
35
89
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/dialog/dialog.ts"],"sourcesContent":["import type { Props as ZagDialogProps, OpenChangeDetails } from \"@zag-js/dialog\";\n\n/**\n * QwDialogProps — Dialog 的用户输入。\n *\n * 对 zag.js 输入做两件事 (§06):\n * 1. 默认值收口:closeOnEsc / closeOnOutside / scrollLock 默认全 true;\n * 2. 命名 rebrand:把 zag 的 closeOnInteractOutside / preventScroll 改成业务易懂命名;\n * 3. 业务 props 透出:onOpenChange / initialFocus / returnFocus 在 React/Vue 同名。\n *\n * 业务方只需 import 本类型,不需要直接 import `@zag-js/*`。\n */\nexport interface QwDialogProps {\n /** 唯一 id 前缀;不传时由 zag 安全生成 (SSR/CSR 一致)。 */\n id?: string;\n /** 受控开关。 */\n open?: boolean;\n /** 非受控初值。 */\n defaultOpen?: boolean;\n /** ESC 关闭,默认 true (zag 原名 closeOnEscape)。 */\n closeOnEsc?: boolean;\n /** 点击 backdrop 关闭,默认 true (zag 原名 closeOnInteractOutside)。 */\n closeOnOutside?: boolean;\n /** 滚动锁,默认 true (zag 原名 preventScroll)。 */\n scrollLock?: boolean;\n /** 模态遮蔽,默认 true。 */\n modal?: boolean;\n /** 角色,默认 dialog。 */\n role?: \"dialog\" | \"alertdialog\";\n /** 初始焦点策略;对象形式提供 selector,由 core 翻译成 zag 的 initialFocusEl。 */\n initialFocus?: \"autofocus\" | \"first\" | \"none\" | { selector: string };\n /** 关闭回焦策略;对应 zag 的 restoreFocus + finalFocusEl。 */\n returnFocus?: \"previous\" | \"none\" | { selector: string };\n /** 状态变化回调;zag 原生 onOpenChange。 */\n onOpenChange?: (e: { open: boolean }) => void;\n /**\n * 禁用 trigger:禁用后点击/键盘都不打开。\n * adapter 层声明式属性(落到原生 button[disabled])——zag dialog 无此 context,不进 machine。\n */\n disabled?: boolean;\n}\n\n/**\n * 直接 re-export zag 的 dialog machine 与 connect —— 不再包一层。\n * machine 由各框架 useMachine 消费;connect 把 service 接成 prop-getter。\n * 用 re-export 而非 `const x = dialog.x` 以保留原始可移植类型 (避免 TS2742)。\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/**\n * 把 QwDialogProps 转成 zag dialog machine 的 context (默认值收口 + 命名 rebrand)。\n * 用法:`useMachine(dialogMachine, createDialogProps(props))`。\n */\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: props.role,\n closeOnEscape: props.closeOnEsc !== false,\n closeOnInteractOutside: props.closeOnOutside !== false,\n preventScroll: props.scrollLock !== false,\n };\n\n if (props.modal !== undefined) ctx.modal = props.modal;\n\n if (props.onOpenChange) {\n const cb = props.onOpenChange;\n ctx.onOpenChange = (d: OpenChangeDetails) => cb({ open: d.open });\n }\n\n // initialFocus: { selector } → initialFocusEl 回调;'none' 关闭自动聚焦\n if (typeof props.initialFocus === \"object\") {\n const sel = props.initialFocus.selector;\n ctx.initialFocusEl = () => document.querySelector<HTMLElement>(sel);\n }\n\n // returnFocus: { selector } → finalFocusEl;'none' → restoreFocus=false\n if (typeof props.returnFocus === \"object\") {\n const sel = props.returnFocus.selector;\n ctx.finalFocusEl = () => document.querySelector<HTMLElement>(sel);\n } else if (props.returnFocus === \"none\") {\n ctx.restoreFocus = false;\n }\n\n return ctx;\n}\n"],"mappings":";;;;;;AAwDA,SAAgB,kBAAkB,QAAuB,CAAC,GAA4B;CACpF,MAAM,MAA+B;EACnC,IAAI,MAAM;EACV,MAAM,MAAM;EACZ,aAAa,MAAM;EACnB,MAAM,MAAM;EACZ,eAAe,MAAM,eAAe;EACpC,wBAAwB,MAAM,mBAAmB;EACjD,eAAe,MAAM,eAAe;CACtC;CAEA,IAAI,MAAM,UAAU,KAAA,GAAW,IAAI,QAAQ,MAAM;CAEjD,IAAI,MAAM,cAAc;EACtB,MAAM,KAAK,MAAM;EACjB,IAAI,gBAAgB,MAAyB,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC;CAClE;CAGA,IAAI,OAAO,MAAM,iBAAiB,UAAU;EAC1C,MAAM,MAAM,MAAM,aAAa;EAC/B,IAAI,uBAAuB,SAAS,cAA2B,GAAG;CACpE;CAGA,IAAI,OAAO,MAAM,gBAAgB,UAAU;EACzC,MAAM,MAAM,MAAM,YAAY;EAC9B,IAAI,qBAAqB,SAAS,cAA2B,GAAG;CAClE,OAAO,IAAI,MAAM,gBAAgB,QAC/B,IAAI,eAAe;CAGrB,OAAO;AACT"}
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"}