@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,363 @@
1
+ import { t as lockGestureAxis } from "./gesture-_SRHIvBm.js";
2
+ import { createMachine } from "@zag-js/core";
3
+ import { visuallyHiddenStyle } from "@zag-js/dom-query";
4
+ //#region src/floating-panel/floating-panel.ts
5
+ const FLOATING_PANEL_PARTS = [
6
+ "root",
7
+ "handle",
8
+ "indicator",
9
+ "content",
10
+ "status"
11
+ ];
12
+ const FLOATING_PANEL_BOUNDARIES = ["viewport", "parent"];
13
+ const FLOATING_PANEL_DEFAULT_ANCHORS = [
14
+ 100,
15
+ 300,
16
+ 600
17
+ ];
18
+ const finite = (value) => typeof value === "number" && Number.isFinite(value);
19
+ function resolveFloatingPanelAnchors(anchors, available = Infinity) {
20
+ const valid = Array.isArray(anchors) ? anchors.filter((value) => finite(value) && value > 0) : [];
21
+ const source = valid.length ? valid : FLOATING_PANEL_DEFAULT_ANCHORS;
22
+ const limit = finite(available) ? Math.max(0, available) : Infinity;
23
+ return [...new Set(source.map((value) => Math.min(value, limit)))].sort((a, b) => a - b);
24
+ }
25
+ /** Nearest anchor, ties choose the larger anchor. */
26
+ function snapFloatingPanelHeight(height, anchors) {
27
+ const value = finite(height) ? height : anchors[0];
28
+ return anchors.reduce((best, anchor) => Math.abs(value - anchor) <= Math.abs(value - best) ? anchor : best, anchors[0]);
29
+ }
30
+ function createFloatingPanelProps(props) {
31
+ if (typeof props.label !== "string" || !props.label.trim()) throw new TypeError("FloatingPanel requires a nonempty label");
32
+ if (props.id !== void 0 && (typeof props.id !== "string" || !props.id.trim())) throw new TypeError("FloatingPanel id must be nonempty");
33
+ return {
34
+ ...props,
35
+ anchors: resolveFloatingPanelAnchors(props.anchors),
36
+ height: finite(props.height) ? props.height : void 0,
37
+ defaultHeight: finite(props.defaultHeight) ? props.defaultHeight : void 0
38
+ };
39
+ }
40
+ const ids = (scope) => ({
41
+ root: `floating-panel:${scope.id}`,
42
+ handle: `floating-panel:${scope.id}:handle`,
43
+ content: `floating-panel:${scope.id}:content`
44
+ });
45
+ const anchorsOf = (context, prop) => resolveFloatingPanelAnchors(prop("anchors"), context.get("available") ?? Infinity);
46
+ const settled = (context, prop) => snapFloatingPanelHeight(context.get("height"), anchorsOf(context, prop));
47
+ const heightText = (prop, height) => (prop("heightTextTemplate") || "{height}px").replace(/\{height\}/g, String(Math.round(height)));
48
+ function request(context, prop, height, reason) {
49
+ const next = snapFloatingPanelHeight(height, anchorsOf(context, prop)), before = settled(context, prop);
50
+ context.set("preview", null);
51
+ if (next === before) return;
52
+ context.set("height", next);
53
+ prop("onHeightChange")?.({
54
+ height: next,
55
+ reason
56
+ });
57
+ context.set("announcement", heightText(prop, prop("height") === void 0 ? next : settled(context, prop)));
58
+ }
59
+ const px = (value) => Number.parseFloat(value) || 0;
60
+ const floatingPanelMachine = createMachine({
61
+ props: ({ props }) => createFloatingPanelProps({
62
+ ...props,
63
+ label: props.label ?? ""
64
+ }),
65
+ initialState: () => "ready",
66
+ context: ({ bindable, prop }) => ({
67
+ height: bindable(() => ({
68
+ defaultValue: snapFloatingPanelHeight(prop("defaultHeight"), resolveFloatingPanelAnchors(prop("anchors"))),
69
+ value: prop("height")
70
+ })),
71
+ preview: bindable(() => ({ defaultValue: null })),
72
+ available: bindable(() => ({ defaultValue: null })),
73
+ announcement: bindable(() => ({ defaultValue: "" }))
74
+ }),
75
+ refs: () => ({ cancelGesture: null }),
76
+ effects: ["track"],
77
+ states: { ready: {} },
78
+ watch({ track, prop, context, action }) {
79
+ track([
80
+ () => prop("height"),
81
+ () => JSON.stringify(prop("anchors")),
82
+ () => prop("disabled"),
83
+ () => prop("boundary"),
84
+ () => prop("contentDraggable")
85
+ ], () => action(["reconcile"]));
86
+ track([() => context.get("height")], () => action(["announce"]));
87
+ },
88
+ on: {
89
+ PREVIEW: { actions: ["preview"] },
90
+ SETTLE: { actions: ["settle"] },
91
+ CANCEL: { actions: ["cancel"] },
92
+ MEASURE: { actions: ["measure"] }
93
+ },
94
+ implementations: {
95
+ actions: {
96
+ announce({ context, prop }) {
97
+ context.set("announcement", heightText(prop, settled(context, prop)));
98
+ },
99
+ preview({ context, event, prop }) {
100
+ if (event.type !== "PREVIEW") return;
101
+ const anchors = anchorsOf(context, prop);
102
+ context.set("preview", Math.min(anchors.at(-1), Math.max(anchors[0], event.height)));
103
+ },
104
+ settle({ context, event, prop }) {
105
+ if (event.type === "SETTLE") request(context, prop, event.height, event.reason);
106
+ },
107
+ cancel({ context }) {
108
+ context.set("preview", null);
109
+ },
110
+ reconcile({ context, refs, prop }) {
111
+ refs.get("cancelGesture")?.();
112
+ context.set("preview", null);
113
+ if (prop("height") === void 0) context.set("height", settled(context, prop));
114
+ },
115
+ measure({ context, event, prop, refs }) {
116
+ if (event.type !== "MEASURE" || context.get("available") === event.available) return;
117
+ const previous = settled(context, prop), first = context.get("available") === null;
118
+ refs.get("cancelGesture")?.();
119
+ context.set("preview", null);
120
+ context.set("available", event.available);
121
+ const next = snapFloatingPanelHeight(context.get("height"), resolveFloatingPanelAnchors(prop("anchors"), event.available));
122
+ if (prop("height") === void 0) context.set("height", next);
123
+ if (!first && previous !== next) {
124
+ prop("onHeightChange")?.({
125
+ height: next,
126
+ reason: "resize"
127
+ });
128
+ context.set("announcement", heightText(prop, next));
129
+ }
130
+ }
131
+ },
132
+ effects: { track({ scope, context, prop, refs, send }) {
133
+ const id = ids(scope), root = scope.getById(id.root), doc = root?.ownerDocument, win = doc?.defaultView;
134
+ if (!root || !doc || !win) return;
135
+ const content = () => scope.getById(id.content);
136
+ let gesture = null;
137
+ const cancel = () => {
138
+ const previous = gesture;
139
+ gesture = null;
140
+ if (previous?.kind === "pointer" && root.hasPointerCapture?.(previous.id)) try {
141
+ root.releasePointerCapture(previous.id);
142
+ } catch {}
143
+ send({ type: "CANCEL" });
144
+ };
145
+ refs.set("cancelGesture", cancel);
146
+ const measure = () => {
147
+ const style = win.getComputedStyle(root), parent = prop("boundary") === "parent" ? root.offsetParent : null;
148
+ const height = parent ? parent.clientHeight : win.visualViewport?.height ?? (doc.documentElement.clientHeight || win.innerHeight);
149
+ send({
150
+ type: "MEASURE",
151
+ available: Math.max(0, height - px(style.scrollMarginTop) - px(style.scrollMarginBottom))
152
+ });
153
+ };
154
+ const start = (target, kind, id, x, y) => {
155
+ if (gesture || prop("disabled") || !(target instanceof win.Element)) return;
156
+ const handle = target.closest("[data-scope=\"floating-panel\"][data-part=\"handle\"]");
157
+ const inContent = !!content()?.contains(target);
158
+ if (!handle && (!inContent || prop("contentDraggable") === false || target.closest("button,a,input,select,textarea,[contenteditable],[role=button],[role=slider]"))) return;
159
+ gesture = {
160
+ id,
161
+ kind,
162
+ x,
163
+ y,
164
+ origin: settled(context, prop),
165
+ last: settled(context, prop),
166
+ content: !handle,
167
+ scroll: content()?.scrollTop ?? 0,
168
+ active: false
169
+ };
170
+ };
171
+ const move = (id, x, y, event) => {
172
+ if (!gesture || gesture.id !== id) return;
173
+ const dx = x - gesture.x, dy = y - gesture.y, axis = lockGestureAxis(dx, dy, true);
174
+ if (!gesture.active) {
175
+ if (axis === "pending") return;
176
+ const max = anchorsOf(context, prop).at(-1);
177
+ if (axis === "cross" || gesture.content && (gesture.scroll > 0 || gesture.origin >= max && (dy < 0 || (content()?.scrollTop ?? 0) > 0))) {
178
+ cancel();
179
+ return;
180
+ }
181
+ gesture.active = true;
182
+ if (gesture.kind === "pointer") try {
183
+ root.setPointerCapture?.(id);
184
+ } catch {}
185
+ }
186
+ if (event.cancelable) event.preventDefault();
187
+ const anchors = anchorsOf(context, prop);
188
+ gesture.last = Math.min(anchors.at(-1), Math.max(anchors[0], gesture.origin - dy));
189
+ send({
190
+ type: "PREVIEW",
191
+ height: gesture.last
192
+ });
193
+ };
194
+ const end = (id, cancelled) => {
195
+ if (!gesture || gesture.id !== id) return;
196
+ const previous = gesture;
197
+ gesture = null;
198
+ if (previous.kind === "pointer" && root.hasPointerCapture?.(id)) try {
199
+ root.releasePointerCapture(id);
200
+ } catch {}
201
+ if (cancelled || !previous.active) send({ type: "CANCEL" });
202
+ else send({
203
+ type: "SETTLE",
204
+ height: previous.last,
205
+ reason: "drag"
206
+ });
207
+ };
208
+ const down = (event) => {
209
+ if (event.pointerType !== "touch" && event.button === 0 && event.isPrimary !== false) start(event.target, "pointer", event.pointerId, event.clientX, event.clientY);
210
+ };
211
+ const pointerMove = (event) => {
212
+ if (gesture?.kind === "pointer") move(event.pointerId, event.clientX, event.clientY, event);
213
+ };
214
+ const up = (event) => {
215
+ if (gesture?.kind === "pointer") end(event.pointerId, false);
216
+ };
217
+ const abort = (event) => {
218
+ if (gesture?.kind === "pointer") end(event.pointerId, true);
219
+ };
220
+ const touchStart = (event) => {
221
+ if (event.touches.length !== 1) {
222
+ cancel();
223
+ return;
224
+ }
225
+ const point = event.touches[0];
226
+ start(event.target, "touch", point.identifier, point.clientX, point.clientY);
227
+ };
228
+ const touchMove = (event) => {
229
+ if (gesture?.kind !== "touch") return;
230
+ if (event.touches.length !== 1) {
231
+ cancel();
232
+ return;
233
+ }
234
+ const point = event.touches[0];
235
+ move(point.identifier, point.clientX, point.clientY, event);
236
+ };
237
+ const touchEnd = (event) => {
238
+ for (const point of Array.from(event.changedTouches)) if (gesture?.kind === "touch") end(point.identifier, event.type === "touchcancel");
239
+ };
240
+ const key = (event) => {
241
+ if (event.key === "Escape" && gesture) {
242
+ event.preventDefault();
243
+ cancel();
244
+ }
245
+ };
246
+ root.addEventListener("pointerdown", down);
247
+ doc.addEventListener("pointermove", pointerMove, { passive: false });
248
+ doc.addEventListener("pointerup", up);
249
+ root.addEventListener("lostpointercapture", abort);
250
+ doc.addEventListener("pointercancel", abort);
251
+ root.addEventListener("touchstart", touchStart, { passive: true });
252
+ root.addEventListener("touchmove", touchMove, { passive: false });
253
+ root.addEventListener("touchend", touchEnd);
254
+ root.addEventListener("touchcancel", touchEnd);
255
+ doc.addEventListener("keydown", key);
256
+ const observer = win.ResizeObserver ? new win.ResizeObserver(measure) : null;
257
+ observer?.observe(root);
258
+ if (root.offsetParent) observer?.observe(root.offsetParent);
259
+ win.addEventListener("resize", measure);
260
+ win.visualViewport?.addEventListener("resize", measure);
261
+ win.visualViewport?.addEventListener("scroll", measure);
262
+ measure();
263
+ return () => {
264
+ cancel();
265
+ refs.set("cancelGesture", null);
266
+ observer?.disconnect();
267
+ root.removeEventListener("pointerdown", down);
268
+ doc.removeEventListener("pointermove", pointerMove);
269
+ doc.removeEventListener("pointerup", up);
270
+ root.removeEventListener("lostpointercapture", abort);
271
+ doc.removeEventListener("pointercancel", abort);
272
+ root.removeEventListener("touchstart", touchStart);
273
+ root.removeEventListener("touchmove", touchMove);
274
+ root.removeEventListener("touchend", touchEnd);
275
+ root.removeEventListener("touchcancel", touchEnd);
276
+ doc.removeEventListener("keydown", key);
277
+ win.removeEventListener("resize", measure);
278
+ win.visualViewport?.removeEventListener("resize", measure);
279
+ win.visualViewport?.removeEventListener("scroll", measure);
280
+ };
281
+ } }
282
+ }
283
+ });
284
+ function connectFloatingPanel(service, normalize) {
285
+ const { context, prop, send, scope } = service, id = ids(scope), anchors = anchorsOf(context, prop), resting = settled(context, prop), preview = context.get("preview"), height = preview ?? resting;
286
+ const part = (name) => ({
287
+ "data-scope": "floating-panel",
288
+ "data-part": name
289
+ });
290
+ const label = prop("label"), disabled = !!prop("disabled"), dragging = finite(preview);
291
+ return {
292
+ height,
293
+ anchors,
294
+ dragging,
295
+ label,
296
+ announcement: context.get("announcement"),
297
+ setHeight(value) {
298
+ if (finite(value)) send({
299
+ type: "SETTLE",
300
+ height: value,
301
+ reason: "api"
302
+ });
303
+ },
304
+ getRootProps: () => normalize.element({
305
+ ...part("root"),
306
+ id: id.root,
307
+ role: "region",
308
+ "aria-label": label,
309
+ dir: prop("dir"),
310
+ "data-boundary": prop("boundary") === "parent" ? "parent" : "viewport",
311
+ "data-dragging": dragging ? "" : void 0,
312
+ "data-disabled": disabled ? "" : void 0,
313
+ style: { "--qw-floating-panel-height": `${height}px` }
314
+ }),
315
+ getHandleProps: () => normalize.element({
316
+ ...part("handle"),
317
+ id: id.handle,
318
+ role: "slider",
319
+ tabIndex: disabled ? -1 : 0,
320
+ "aria-label": label,
321
+ "aria-orientation": "vertical",
322
+ "aria-valuemin": anchors[0],
323
+ "aria-valuemax": anchors.at(-1),
324
+ "aria-valuenow": resting,
325
+ "aria-valuetext": heightText(prop, resting),
326
+ "aria-controls": id.content,
327
+ "aria-disabled": disabled || void 0,
328
+ onKeyDown(event) {
329
+ if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || disabled) return;
330
+ const index = anchors.indexOf(resting);
331
+ const next = event.key === "Home" ? anchors[0] : event.key === "End" ? anchors.at(-1) : ["ArrowUp", "PageUp"].includes(event.key) ? anchors[Math.min(anchors.length - 1, index + 1)] : ["ArrowDown", "PageDown"].includes(event.key) ? anchors[Math.max(0, index - 1)] : void 0;
332
+ if (next !== void 0) {
333
+ event.preventDefault();
334
+ send({
335
+ type: "SETTLE",
336
+ height: next,
337
+ reason: "keyboard"
338
+ });
339
+ }
340
+ }
341
+ }),
342
+ getIndicatorProps: () => normalize.element({
343
+ ...part("indicator"),
344
+ "aria-hidden": "true"
345
+ }),
346
+ getContentProps: () => normalize.element({
347
+ ...part("content"),
348
+ id: id.content,
349
+ "data-expanded": resting === anchors.at(-1) ? "" : void 0
350
+ }),
351
+ getStatusProps: () => normalize.element({
352
+ ...part("status"),
353
+ role: "status",
354
+ "aria-live": "polite",
355
+ "aria-atomic": "true",
356
+ style: visuallyHiddenStyle
357
+ })
358
+ };
359
+ }
360
+ //#endregion
361
+ export { createFloatingPanelProps as a, snapFloatingPanelHeight as c, connectFloatingPanel as i, FLOATING_PANEL_DEFAULT_ANCHORS as n, floatingPanelMachine as o, FLOATING_PANEL_PARTS as r, resolveFloatingPanelAnchors as s, FLOATING_PANEL_BOUNDARIES as t };
362
+
363
+ //# sourceMappingURL=floating-panel-Cbm5njBJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floating-panel-Cbm5njBJ.js","names":[],"sources":["../src/floating-panel/floating-panel.ts"],"sourcesContent":["import { createMachine, type Machine, type Service } from \"@zag-js/core\";\nimport type { NormalizeProps, PropTypes } from \"@zag-js/types\";\nimport { visuallyHiddenStyle } from \"@zag-js/dom-query\";\nimport { lockGestureAxis } from \"../swiper/gesture.js\";\n\nexport const FLOATING_PANEL_PARTS = [\"root\", \"handle\", \"indicator\", \"content\", \"status\"] as const;\nexport const FLOATING_PANEL_BOUNDARIES = [\"viewport\", \"parent\"] as const;\nexport const FLOATING_PANEL_DEFAULT_ANCHORS: readonly number[] = [100, 300, 600];\nexport type FloatingPanelBoundary = (typeof FLOATING_PANEL_BOUNDARIES)[number];\nexport type FloatingPanelHeightReason = \"drag\" | \"keyboard\" | \"api\" | \"resize\";\nexport interface FloatingPanelHeightChangeDetails { height: number; reason: FloatingPanelHeightReason }\nexport interface QwFloatingPanelProps {\n id?: string;\n /** Required accessible name for the region and height slider. */\n label: string;\n /** Positive finite visible border-box heights in CSS px; sorted and deduplicated. */\n anchors?: readonly number[];\n /** Owner-controlled settled height; keeping the value rejects a request. */\n height?: number;\n /** Initial uncontrolled height, defaults to the smallest anchor. */\n defaultHeight?: number;\n onHeightChange?: (details: FloatingPanelHeightChangeDetails) => void;\n /** Fixed to viewport, or absolute in a positioned parent. */\n boundary?: FloatingPanelBoundary;\n /** Allow content drag until expanded; native scrolling takes over at maximum. Default true. */\n contentDraggable?: boolean;\n disabled?: boolean;\n dir?: \"ltr\" | \"rtl\";\n /** Accessible height text; {height} is replaced by CSS px. Default \"{height}px\". */\n heightTextTemplate?: string;\n}\nconst finite = (value: unknown): value is number => typeof value === \"number\" && Number.isFinite(value);\nexport function resolveFloatingPanelAnchors(anchors: readonly number[] | undefined, available = Infinity): number[] {\n const valid = Array.isArray(anchors) ? anchors.filter(value => finite(value) && value > 0) : [];\n const source = valid.length ? valid : FLOATING_PANEL_DEFAULT_ANCHORS;\n const limit = finite(available) ? Math.max(0, available) : Infinity;\n return [...new Set(source.map(value => Math.min(value, limit)))].sort((a, b) => a - b);\n}\n/** Nearest anchor, ties choose the larger anchor. */\nexport function snapFloatingPanelHeight(height: number | undefined, anchors: readonly number[]): number {\n const value = finite(height) ? height : anchors[0]!;\n return anchors.reduce((best, anchor) => Math.abs(value - anchor) <= Math.abs(value - best) ? anchor : best, anchors[0]!);\n}\nexport function createFloatingPanelProps(props: QwFloatingPanelProps): QwFloatingPanelProps {\n if (typeof props.label !== \"string\" || !props.label.trim()) throw new TypeError(\"FloatingPanel requires a nonempty label\");\n if (props.id !== undefined && (typeof props.id !== \"string\" || !props.id.trim())) throw new TypeError(\"FloatingPanel id must be nonempty\");\n return { ...props, anchors: resolveFloatingPanelAnchors(props.anchors), height: finite(props.height) ? props.height : undefined, defaultHeight: finite(props.defaultHeight) ? props.defaultHeight : undefined };\n}\nexport interface QwFloatingPanelSchema {\n props: QwFloatingPanelProps;\n context: { height: number; preview: number | null; available: number | null; announcement: string };\n refs: { cancelGesture: (() => void) | null };\n state: \"ready\";\n action: \"preview\" | \"settle\" | \"cancel\" | \"measure\" | \"reconcile\" | \"announce\";\n effect: \"track\";\n event:\n | { type: \"PREVIEW\"; height: number }\n | { type: \"SETTLE\"; height: number; reason: FloatingPanelHeightReason }\n | { type: \"CANCEL\" }\n | { type: \"MEASURE\"; available: number };\n}\nexport type QwFloatingPanelMachine = Machine<QwFloatingPanelSchema>;\nexport type QwFloatingPanelService = Service<QwFloatingPanelSchema>;\ntype Context = QwFloatingPanelService[\"context\"];\ntype Prop = QwFloatingPanelService[\"prop\"];\nconst ids = (scope: QwFloatingPanelService[\"scope\"]) => ({ root: `floating-panel:${scope.id}`, handle: `floating-panel:${scope.id}:handle`, content: `floating-panel:${scope.id}:content` });\nconst anchorsOf = (context: Context, prop: Prop) => resolveFloatingPanelAnchors(prop(\"anchors\"), context.get(\"available\") ?? Infinity);\nconst settled = (context: Context, prop: Prop) => snapFloatingPanelHeight(context.get(\"height\"), anchorsOf(context, prop));\nconst heightText = (prop: Prop, height: number) => (prop(\"heightTextTemplate\") || \"{height}px\").replace(/\\{height\\}/g, String(Math.round(height)));\nfunction request(context: Context, prop: Prop, height: number, reason: FloatingPanelHeightReason): void {\n const next = snapFloatingPanelHeight(height, anchorsOf(context, prop)), before = settled(context, prop);\n context.set(\"preview\", null);\n if (next === before) return;\n context.set(\"height\", next);\n prop(\"onHeightChange\")?.({ height: next, reason });\n // The announcement always reflects accepted state, including controlled refusal.\n context.set(\"announcement\", heightText(prop, prop(\"height\") === undefined ? next : settled(context, prop)));\n}\nconst px = (value: string) => Number.parseFloat(value) || 0;\nexport const floatingPanelMachine: QwFloatingPanelMachine = createMachine<QwFloatingPanelSchema>({\n props: ({ props }) => createFloatingPanelProps({ ...props, label: props.label ?? \"\" }), initialState: () => \"ready\",\n context: ({ bindable, prop }) => ({\n height: bindable(() => ({ defaultValue: snapFloatingPanelHeight(prop(\"defaultHeight\"), resolveFloatingPanelAnchors(prop(\"anchors\"))), value: prop(\"height\") })),\n preview: bindable<number | null>(() => ({ defaultValue: null })), available: bindable<number | null>(() => ({ defaultValue: null })), announcement: bindable(() => ({ defaultValue: \"\" })),\n }),\n refs: () => ({ cancelGesture: null }), effects: [\"track\"], states: { ready: {} },\n watch({ track, prop, context, action }) {\n track([() => prop(\"height\"), () => JSON.stringify(prop(\"anchors\")), () => prop(\"disabled\"), () => prop(\"boundary\"), () => prop(\"contentDraggable\")], () => action([\"reconcile\"]));\n track([() => context.get(\"height\")], () => action([\"announce\"]));\n },\n on: { PREVIEW: { actions: [\"preview\"] }, SETTLE: { actions: [\"settle\"] }, CANCEL: { actions: [\"cancel\"] }, MEASURE: { actions: [\"measure\"] } },\n implementations: {\n actions: {\n announce({ context, prop }) { context.set(\"announcement\", heightText(prop, settled(context, prop))); },\n preview({ context, event, prop }) { if (event.type !== \"PREVIEW\") return; const anchors = anchorsOf(context, prop); context.set(\"preview\", Math.min(anchors.at(-1)!, Math.max(anchors[0]!, event.height))); },\n settle({ context, event, prop }) { if (event.type === \"SETTLE\") request(context, prop, event.height, event.reason); },\n cancel({ context }) { context.set(\"preview\", null); },\n reconcile({ context, refs, prop }) { refs.get(\"cancelGesture\")?.(); context.set(\"preview\", null); if (prop(\"height\") === undefined) context.set(\"height\", settled(context, prop)); },\n measure({ context, event, prop, refs }) {\n if (event.type !== \"MEASURE\" || context.get(\"available\") === event.available) return;\n const previous = settled(context, prop), first = context.get(\"available\") === null;\n refs.get(\"cancelGesture\")?.(); context.set(\"preview\", null); context.set(\"available\", event.available);\n const next = snapFloatingPanelHeight(context.get(\"height\"), resolveFloatingPanelAnchors(prop(\"anchors\"), event.available));\n if (prop(\"height\") === undefined) context.set(\"height\", next);\n if (!first && previous !== next) { prop(\"onHeightChange\")?.({ height: next, reason: \"resize\" }); context.set(\"announcement\", heightText(prop, next)); }\n },\n },\n effects: {\n track({ scope, context, prop, refs, send }) {\n const id = ids(scope), root = scope.getById<HTMLElement>(id.root), doc = root?.ownerDocument, win = doc?.defaultView;\n if (!root || !doc || !win) return;\n const content = () => scope.getById<HTMLElement>(id.content);\n let gesture: { id: number; kind: \"pointer\" | \"touch\"; x: number; y: number; origin: number; content: boolean; scroll: number; active: boolean; last: number } | null = null;\n const cancel = () => {\n const previous = gesture; gesture = null;\n if (previous?.kind === \"pointer\" && root.hasPointerCapture?.(previous.id)) { try { root.releasePointerCapture(previous.id); } catch { /* Platform already released. */ } }\n send({ type: \"CANCEL\" });\n };\n refs.set(\"cancelGesture\", cancel);\n const measure = () => {\n const style = win.getComputedStyle(root), parent = prop(\"boundary\") === \"parent\" ? root.offsetParent as HTMLElement | null : null;\n const height = parent ? parent.clientHeight : win.visualViewport?.height ?? (doc.documentElement.clientHeight || win.innerHeight);\n send({ type: \"MEASURE\", available: Math.max(0, height - px(style.scrollMarginTop) - px(style.scrollMarginBottom)) });\n };\n const start = (target: EventTarget | null, kind: \"pointer\" | \"touch\", id: number, x: number, y: number) => {\n if (gesture || prop(\"disabled\") || !(target instanceof win.Element)) return;\n const handle = target.closest('[data-scope=\"floating-panel\"][data-part=\"handle\"]');\n const inContent = !!content()?.contains(target);\n if (!handle && (!inContent || prop(\"contentDraggable\") === false || target.closest(\"button,a,input,select,textarea,[contenteditable],[role=button],[role=slider]\"))) return;\n gesture = { id, kind, x, y, origin: settled(context, prop), last: settled(context, prop), content: !handle, scroll: content()?.scrollTop ?? 0, active: false };\n };\n const move = (id: number, x: number, y: number, event: { preventDefault(): void; cancelable: boolean }) => {\n if (!gesture || gesture.id !== id) return;\n const dx = x - gesture.x, dy = y - gesture.y, axis = lockGestureAxis(dx, dy, true);\n if (!gesture.active) {\n if (axis === \"pending\") return;\n const max = anchorsOf(context, prop).at(-1)!;\n if (axis === \"cross\" || (gesture.content && (gesture.scroll > 0 || (gesture.origin >= max && (dy < 0 || (content()?.scrollTop ?? 0) > 0))))) { cancel(); return; }\n gesture.active = true;\n if (gesture.kind === \"pointer\") { try { root.setPointerCapture?.(id); } catch { /* Pointer ended before capture. */ } }\n }\n if (event.cancelable) event.preventDefault();\n const anchors = anchorsOf(context, prop); gesture.last = Math.min(anchors.at(-1)!, Math.max(anchors[0]!, gesture.origin - dy));\n send({ type: \"PREVIEW\", height: gesture.last });\n };\n const end = (id: number, cancelled: boolean) => {\n if (!gesture || gesture.id !== id) return;\n const previous = gesture; gesture = null;\n if (previous.kind === \"pointer\" && root.hasPointerCapture?.(id)) { try { root.releasePointerCapture(id); } catch { /* Already released. */ } }\n if (cancelled || !previous.active) send({ type: \"CANCEL\" }); else send({ type: \"SETTLE\", height: previous.last, reason: \"drag\" });\n };\n const down = (event: PointerEvent) => { if (event.pointerType !== \"touch\" && event.button === 0 && event.isPrimary !== false) start(event.target, \"pointer\", event.pointerId, event.clientX, event.clientY); };\n const pointerMove = (event: PointerEvent) => { if (gesture?.kind === \"pointer\") move(event.pointerId, event.clientX, event.clientY, event); };\n const up = (event: PointerEvent) => { if (gesture?.kind === \"pointer\") end(event.pointerId, false); };\n const abort = (event: PointerEvent) => { if (gesture?.kind === \"pointer\") end(event.pointerId, true); };\n const touchStart = (event: TouchEvent) => { if (event.touches.length !== 1) { cancel(); return; } const point = event.touches[0]!; start(event.target, \"touch\", point.identifier, point.clientX, point.clientY); };\n const touchMove = (event: TouchEvent) => { if (gesture?.kind !== \"touch\") return; if (event.touches.length !== 1) { cancel(); return; } const point = event.touches[0]!; move(point.identifier, point.clientX, point.clientY, event); };\n const touchEnd = (event: TouchEvent) => { for (const point of Array.from(event.changedTouches)) if (gesture?.kind === \"touch\") end(point.identifier, event.type === \"touchcancel\"); };\n const key = (event: KeyboardEvent) => { if (event.key === \"Escape\" && gesture) { event.preventDefault(); cancel(); } };\n root.addEventListener(\"pointerdown\", down); doc.addEventListener(\"pointermove\", pointerMove, { passive: false }); doc.addEventListener(\"pointerup\", up); root.addEventListener(\"lostpointercapture\", abort); doc.addEventListener(\"pointercancel\", abort);\n root.addEventListener(\"touchstart\", touchStart, { passive: true }); root.addEventListener(\"touchmove\", touchMove, { passive: false }); root.addEventListener(\"touchend\", touchEnd); root.addEventListener(\"touchcancel\", touchEnd); doc.addEventListener(\"keydown\", key);\n const observer = win.ResizeObserver ? new win.ResizeObserver(measure) : null;\n observer?.observe(root); if (root.offsetParent) observer?.observe(root.offsetParent);\n win.addEventListener(\"resize\", measure); win.visualViewport?.addEventListener(\"resize\", measure); win.visualViewport?.addEventListener(\"scroll\", measure);\n measure();\n return () => {\n cancel(); refs.set(\"cancelGesture\", null); observer?.disconnect();\n root.removeEventListener(\"pointerdown\", down); doc.removeEventListener(\"pointermove\", pointerMove); doc.removeEventListener(\"pointerup\", up); root.removeEventListener(\"lostpointercapture\", abort); doc.removeEventListener(\"pointercancel\", abort);\n root.removeEventListener(\"touchstart\", touchStart); root.removeEventListener(\"touchmove\", touchMove); root.removeEventListener(\"touchend\", touchEnd); root.removeEventListener(\"touchcancel\", touchEnd); doc.removeEventListener(\"keydown\", key);\n win.removeEventListener(\"resize\", measure); win.visualViewport?.removeEventListener(\"resize\", measure); win.visualViewport?.removeEventListener(\"scroll\", measure);\n };\n },\n },\n },\n});\nexport interface QwFloatingPanelApi<T extends PropTypes = PropTypes> {\n height: number; anchors: number[]; dragging: boolean; label: string; announcement: string;\n setHeight(height: number): void;\n getRootProps(): T[\"element\"];\n getHandleProps(): T[\"element\"];\n getIndicatorProps(): T[\"element\"];\n getContentProps(): T[\"element\"];\n getStatusProps(): T[\"element\"];\n}\nexport function connectFloatingPanel<T extends PropTypes>(service: QwFloatingPanelService, normalize: NormalizeProps<T>): QwFloatingPanelApi<T> {\n const { context, prop, send, scope } = service, id = ids(scope), anchors = anchorsOf(context, prop), resting = settled(context, prop), preview = context.get(\"preview\"), height = preview ?? resting;\n const part = (name: typeof FLOATING_PANEL_PARTS[number]) => ({ \"data-scope\": \"floating-panel\", \"data-part\": name });\n const label = prop(\"label\"), disabled = !!prop(\"disabled\"), dragging = finite(preview);\n return {\n height, anchors, dragging, label, announcement: context.get(\"announcement\"),\n setHeight(value) { if (finite(value)) send({ type: \"SETTLE\", height: value, reason: \"api\" }); },\n getRootProps: () => normalize.element({ ...part(\"root\"), id: id.root, role: \"region\", \"aria-label\": label, dir: prop(\"dir\"), \"data-boundary\": prop(\"boundary\") === \"parent\" ? \"parent\" : \"viewport\", \"data-dragging\": dragging ? \"\" : undefined, \"data-disabled\": disabled ? \"\" : undefined, style: { \"--qw-floating-panel-height\": `${height}px` } }),\n getHandleProps: () => normalize.element({ ...part(\"handle\"), id: id.handle, role: \"slider\", tabIndex: disabled ? -1 : 0, \"aria-label\": label, \"aria-orientation\": \"vertical\", \"aria-valuemin\": anchors[0], \"aria-valuemax\": anchors.at(-1), \"aria-valuenow\": resting, \"aria-valuetext\": heightText(prop, resting), \"aria-controls\": id.content, \"aria-disabled\": disabled || undefined,\n onKeyDown(event: Pick<KeyboardEvent, \"key\" | \"defaultPrevented\" | \"altKey\" | \"ctrlKey\" | \"metaKey\" | \"preventDefault\">) {\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || disabled) return;\n const index = anchors.indexOf(resting);\n const next = event.key === \"Home\" ? anchors[0] : event.key === \"End\" ? anchors.at(-1) : [\"ArrowUp\", \"PageUp\"].includes(event.key) ? anchors[Math.min(anchors.length - 1, index + 1)] : [\"ArrowDown\", \"PageDown\"].includes(event.key) ? anchors[Math.max(0, index - 1)] : undefined;\n if (next !== undefined) { event.preventDefault(); send({ type: \"SETTLE\", height: next, reason: \"keyboard\" }); }\n },\n }),\n getIndicatorProps: () => normalize.element({ ...part(\"indicator\"), \"aria-hidden\": \"true\" }),\n getContentProps: () => normalize.element({ ...part(\"content\"), id: id.content, \"data-expanded\": resting === anchors.at(-1) ? \"\" : undefined }),\n getStatusProps: () => normalize.element({ ...part(\"status\"), role: \"status\", \"aria-live\": \"polite\", \"aria-atomic\": \"true\", style: visuallyHiddenStyle }),\n };\n}\n"],"mappings":";;;;AAKA,MAAa,uBAAuB;CAAC;CAAQ;CAAU;CAAa;CAAW;AAAQ;AACvF,MAAa,4BAA4B,CAAC,YAAY,QAAQ;AAC9D,MAAa,iCAAoD;CAAC;CAAK;CAAK;AAAG;AAwB/E,MAAM,UAAU,UAAoC,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK;AACtG,SAAgB,4BAA4B,SAAwC,YAAY,UAAoB;CAClH,MAAM,QAAQ,MAAM,QAAQ,OAAO,IAAI,QAAQ,QAAO,UAAS,OAAO,KAAK,KAAK,QAAQ,CAAC,IAAI,CAAC;CAC9F,MAAM,SAAS,MAAM,SAAS,QAAQ;CACtC,MAAM,QAAQ,OAAO,SAAS,IAAI,KAAK,IAAI,GAAG,SAAS,IAAI;CAC3D,OAAO,CAAC,GAAG,IAAI,IAAI,OAAO,KAAI,UAAS,KAAK,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC;AACvF;;AAEA,SAAgB,wBAAwB,QAA4B,SAAoC;CACtG,MAAM,QAAQ,OAAO,MAAM,IAAI,SAAS,QAAQ;CAChD,OAAO,QAAQ,QAAQ,MAAM,WAAW,KAAK,IAAI,QAAQ,MAAM,KAAK,KAAK,IAAI,QAAQ,IAAI,IAAI,SAAS,MAAM,QAAQ,EAAG;AACzH;AACA,SAAgB,yBAAyB,OAAmD;CAC1F,IAAI,OAAO,MAAM,UAAU,YAAY,CAAC,MAAM,MAAM,KAAK,GAAG,MAAM,IAAI,UAAU,yCAAyC;CACzH,IAAI,MAAM,OAAO,KAAA,MAAc,OAAO,MAAM,OAAO,YAAY,CAAC,MAAM,GAAG,KAAK,IAAI,MAAM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KAAA,GAAW;KAAE,MAAM,eAAe;KAAG,KAAK;MAAE,MAAM;MAAU,QAAQ;MAAM,QAAQ;KAAW,CAAC;IAAG;GAChH;EACF,CAAC;EACD,yBAAyB,UAAU,QAAQ;GAAE,GAAG,KAAK,WAAW;GAAG,eAAe;EAAO,CAAC;EAC1F,uBAAuB,UAAU,QAAQ;GAAE,GAAG,KAAK,SAAS;GAAG,IAAI,GAAG;GAAS,iBAAiB,YAAY,QAAQ,GAAG,EAAE,IAAI,KAAK,KAAA;EAAU,CAAC;EAC7I,sBAAsB,UAAU,QAAQ;GAAE,GAAG,KAAK,QAAQ;GAAG,MAAM;GAAU,aAAa;GAAU,eAAe;GAAQ,OAAO;EAAoB,CAAC;CACzJ;AACF"}
@@ -0,0 +1,94 @@
1
+ import { type Machine, type Service } from "@zag-js/core";
2
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
3
+ /** Page/section closing area: separator label, links, content text and action chips. */
4
+ export declare const FOOTER_PARTS: readonly ["root", "label", "links", "link-item", "link", "content", "chips", "chip", "extra"];
5
+ export declare const FOOTER_CHIP_VARIANTS: readonly ["plain", "link"];
6
+ export type FooterPart = (typeof FOOTER_PARTS)[number];
7
+ export type FooterChipVariant = (typeof FOOTER_CHIP_VARIANTS)[number];
8
+ export interface FooterLink {
9
+ id: string;
10
+ text: string;
11
+ href: string;
12
+ disabled?: boolean;
13
+ target?: string;
14
+ rel?: string;
15
+ }
16
+ export interface FooterChip {
17
+ id: string;
18
+ text: string;
19
+ disabled?: boolean;
20
+ /** plain: filled pill (default); link: text-style action. */
21
+ variant?: FooterChipVariant;
22
+ }
23
+ export interface FooterChipClickDetails {
24
+ id: string;
25
+ index: number;
26
+ }
27
+ export interface FooterLinkClickDetails {
28
+ id: string;
29
+ index: number;
30
+ href?: string;
31
+ }
32
+ export interface QwFooterProps {
33
+ /** Separator label text above the footer content. */
34
+ label?: string;
35
+ /** Plain footer text such as a copyright line. */
36
+ content?: string;
37
+ links?: readonly FooterLink[];
38
+ chips?: readonly FooterChip[];
39
+ /** Opt-in page-level contentinfo landmark; default is a plain region. */
40
+ landmark?: boolean;
41
+ /** Accessible name of the link list; default "页脚链接". */
42
+ linksLabel?: string;
43
+ onChipClick?: (details: FooterChipClickDetails) => void;
44
+ /** Notification only; native navigation is never prevented. */
45
+ onLinkClick?: (details: FooterLinkClickDetails) => void;
46
+ }
47
+ export interface ResolvedFooterLink extends FooterLink {
48
+ index: number;
49
+ href: string;
50
+ safeHref?: string;
51
+ disabled: boolean;
52
+ }
53
+ export interface ResolvedFooterChip extends FooterChip {
54
+ index: number;
55
+ disabled: boolean;
56
+ variant: FooterChipVariant;
57
+ }
58
+ /** Relative URLs and http(s)/mailto/tel are kept; other schemes (javascript:, data:, …) are dropped. */
59
+ export declare function sanitizeFooterHref(href: unknown): string | undefined;
60
+ export declare function resolveFooterLinks(links: readonly FooterLink[] | undefined): ResolvedFooterLink[];
61
+ export declare function resolveFooterChips(chips: readonly FooterChip[] | undefined): ResolvedFooterChip[];
62
+ export interface QwFooterSchema {
63
+ props: QwFooterProps;
64
+ context: Record<string, never>;
65
+ state: "idle";
66
+ action: "notifyChip" | "notifyLink";
67
+ event: {
68
+ type: "CHIP.CLICK";
69
+ index: number;
70
+ } | {
71
+ type: "LINK.CLICK";
72
+ index: number;
73
+ };
74
+ }
75
+ export type QwFooterMachine = Machine<QwFooterSchema>;
76
+ export type QwFooterService = Service<QwFooterSchema>;
77
+ /** Stateless notification machine so every stack (including WC events) shares one activation path. */
78
+ export declare const footerMachine: QwFooterMachine;
79
+ export interface QwFooterApi<T extends PropTypes = PropTypes> {
80
+ label?: string;
81
+ content?: string;
82
+ links: ResolvedFooterLink[];
83
+ chips: ResolvedFooterChip[];
84
+ getRootProps(): T["element"];
85
+ getLabelProps(): T["element"];
86
+ getLinksProps(): T["element"];
87
+ getLinkItemProps(link: ResolvedFooterLink): T["element"];
88
+ getLinkProps(link: ResolvedFooterLink): T["element"];
89
+ getContentProps(): T["element"];
90
+ getChipsProps(): T["element"];
91
+ getChipProps(chip: ResolvedFooterChip): T["button"];
92
+ getExtraProps(): T["element"];
93
+ }
94
+ export declare function connectFooter<T extends PropTypes>(service: QwFooterService, normalize: NormalizeProps<T>): QwFooterApi<T>;
@@ -0,0 +1 @@
1
+ export * from "./footer.js";
@@ -0,0 +1,154 @@
1
+ import { createMachine } from "@zag-js/core";
2
+ //#region src/footer/footer.ts
3
+ /** Page/section closing area: separator label, links, content text and action chips. */
4
+ const FOOTER_PARTS = [
5
+ "root",
6
+ "label",
7
+ "links",
8
+ "link-item",
9
+ "link",
10
+ "content",
11
+ "chips",
12
+ "chip",
13
+ "extra"
14
+ ];
15
+ const FOOTER_CHIP_VARIANTS = ["plain", "link"];
16
+ const SAFE_SCHEMES = /* @__PURE__ */ new Set([
17
+ "http",
18
+ "https",
19
+ "mailto",
20
+ "tel"
21
+ ]);
22
+ /** Relative URLs and http(s)/mailto/tel are kept; other schemes (javascript:, data:, …) are dropped. */
23
+ function sanitizeFooterHref(href) {
24
+ if (typeof href !== "string") return void 0;
25
+ const value = href.trim().replace(/[\x00-\x1f\x7f]/g, "");
26
+ if (!value) return void 0;
27
+ const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(value)?.[1]?.toLowerCase();
28
+ if (scheme) return SAFE_SCHEMES.has(scheme) ? href.trim() : void 0;
29
+ return href.trim();
30
+ }
31
+ function resolveFooterLinks(links) {
32
+ return (links ?? []).map((link, index) => {
33
+ const safeHref = sanitizeFooterHref(link.href);
34
+ return {
35
+ ...link,
36
+ index,
37
+ href: link.href,
38
+ safeHref,
39
+ disabled: link.disabled === true || safeHref === void 0
40
+ };
41
+ });
42
+ }
43
+ function resolveFooterChips(chips) {
44
+ return (chips ?? []).map((chip, index) => ({
45
+ ...chip,
46
+ index,
47
+ disabled: chip.disabled === true,
48
+ variant: FOOTER_CHIP_VARIANTS.includes(chip.variant) ? chip.variant : "plain"
49
+ }));
50
+ }
51
+ /** Stateless notification machine so every stack (including WC events) shares one activation path. */
52
+ const footerMachine = createMachine({
53
+ initialState: () => "idle",
54
+ on: {
55
+ "CHIP.CLICK": { actions: ["notifyChip"] },
56
+ "LINK.CLICK": { actions: ["notifyLink"] }
57
+ },
58
+ states: { idle: {} },
59
+ implementations: { actions: {
60
+ notifyChip({ prop, event }) {
61
+ if (event.type !== "CHIP.CLICK") return;
62
+ const chip = resolveFooterChips(prop("chips"))[event.index];
63
+ if (chip && !chip.disabled) prop("onChipClick")?.({
64
+ id: chip.id,
65
+ index: chip.index
66
+ });
67
+ },
68
+ notifyLink({ prop, event }) {
69
+ if (event.type !== "LINK.CLICK") return;
70
+ const link = resolveFooterLinks(prop("links"))[event.index];
71
+ if (link && !link.disabled) prop("onLinkClick")?.({
72
+ id: link.id,
73
+ index: link.index,
74
+ href: link.safeHref
75
+ });
76
+ }
77
+ } }
78
+ });
79
+ const part = (name) => ({
80
+ "data-scope": "footer",
81
+ "data-part": name
82
+ });
83
+ const text = (value) => typeof value === "string" && value !== "" ? value : void 0;
84
+ function connectFooter(service, normalize) {
85
+ const label = text(service.prop("label")), content = text(service.prop("content"));
86
+ const links = resolveFooterLinks(service.prop("links")), chips = resolveFooterChips(service.prop("chips"));
87
+ return {
88
+ label,
89
+ content,
90
+ links,
91
+ chips,
92
+ getRootProps: () => normalize.element({
93
+ ...part("root"),
94
+ ...service.prop("landmark") ? { role: "contentinfo" } : {}
95
+ }),
96
+ getLabelProps: () => normalize.element({
97
+ ...part("label"),
98
+ hidden: label === void 0
99
+ }),
100
+ getLinksProps: () => normalize.element({
101
+ ...part("links"),
102
+ hidden: links.length === 0,
103
+ "aria-label": links.length ? text(service.prop("linksLabel")) ?? "页脚链接" : void 0
104
+ }),
105
+ getLinkItemProps: (link) => normalize.element({
106
+ ...part("link-item"),
107
+ "data-value": link.id
108
+ }),
109
+ getLinkProps: (link) => normalize.element({
110
+ ...part("link"),
111
+ "data-value": link.id,
112
+ ...link.disabled ? {
113
+ "aria-disabled": "true",
114
+ "data-disabled": "true"
115
+ } : {
116
+ href: link.safeHref,
117
+ target: link.target,
118
+ rel: link.rel ?? (link.target === "_blank" ? "noopener noreferrer" : void 0)
119
+ },
120
+ onClick() {
121
+ if (!link.disabled) service.send({
122
+ type: "LINK.CLICK",
123
+ index: link.index
124
+ });
125
+ }
126
+ }),
127
+ getContentProps: () => normalize.element({
128
+ ...part("content"),
129
+ hidden: content === void 0
130
+ }),
131
+ getChipsProps: () => normalize.element({
132
+ ...part("chips"),
133
+ hidden: chips.length === 0
134
+ }),
135
+ getChipProps: (chip) => normalize.button({
136
+ ...part("chip"),
137
+ type: "button",
138
+ disabled: chip.disabled,
139
+ "data-value": chip.id,
140
+ "data-variant": chip.variant,
141
+ onClick() {
142
+ service.send({
143
+ type: "CHIP.CLICK",
144
+ index: chip.index
145
+ });
146
+ }
147
+ }),
148
+ getExtraProps: () => normalize.element(part("extra"))
149
+ };
150
+ }
151
+ //#endregion
152
+ export { FOOTER_CHIP_VARIANTS, FOOTER_PARTS, connectFooter, footerMachine, resolveFooterChips, resolveFooterLinks, sanitizeFooterHref };
153
+
154
+ //# sourceMappingURL=index.js.map