@qw-ui/core 0.3.0-next.4 → 0.3.0-next.42

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 @@
1
+ {"version":3,"file":"modal-dialog-machine-CF9_z3Dm.js","names":[],"sources":["../src/modal-dismissable-lifetime.ts","../src/modal-registry.ts","../src/modal-dialog-machine.ts"],"sourcesContent":["import { machine } from \"@zag-js/dialog\";\nimport { trackDismissableElement } from \"@zag-js/dismissable\";\nimport { contains, isHTMLElement, queryAll, raf } from \"@zag-js/dom-query\";\nimport type { Scope } from \"@zag-js/core\";\n\ntype Effect = NonNullable<\n NonNullable<typeof machine.implementations>[\"effects\"]\n>[\"trackDismissableElement\"];\ntype Params = Parameters<NonNullable<Effect>>[0];\n\ntype DeclarationScope = Pick<Scope, \"getById\" | \"id\">;\n\n/** 这个层的声明节点:显式 origin 优先,退回 trigger。准入与归属两处同一口径。 */\nexport function modalDeclaration(scope: DeclarationScope): HTMLElement | null {\n const node = scope.getById(`dialog:${scope.id}:origin`) ?? scope.getById(`dialog:${scope.id}:trigger`);\n return isHTMLElement(node) ? node : null;\n}\n\n/**\n * 实例的物理身份 = 它的 effect 起步时拿到的声明节点。id 查不出实例:同一个 id 先后渲染\n * 两遍时,旧实例按 id 回查只会查到新实例的节点。所以起步时的声明一旦离树、又有别的节点\n * 顶着同一个 id 回答查询,就说明声明与内容都已经换了实例,旧的既不能再认领,也不能在\n * 清理时把新实例的层摘走。\n *\n * 起步时本来就没有声明的调用方(headless 自绘)没有可被顶替的身份,保持原口径不变。\n */\nexport function modalDeclarationOwned(\n scope: DeclarationScope,\n declaredAtStart: HTMLElement | null,\n): boolean {\n if (!declaredAtStart) return true;\n if (declaredAtStart.isConnected) return true;\n return !modalDeclaration(scope);\n}\n\n/**\n * Zag 的 layer stack 按入栈顺序判断嵌套:后代层必须晚于祖先层入栈,否则祖先会把\n * 「焦点落进后代层」读成层外交互,自己关掉自己。入栈时刻取决于物理节点什么时候出现,\n * 和声明层级并不一致——父层开始监听时内容还没渲染出来,要等一帧;子层连接时父层内容\n * 已经在文档里,它可以在同一批微任务里就入栈,于是顺序倒过来。\n *\n * 声明在某个层内容里的层,一定更晚开始自己的 dismissable effect。所以每个层开始之前,\n * 先让仍在等待物理节点的更早的层试一次:它的节点这时已经出现了,就会先入栈。\n *\n * 只推进「内容里真的装着这个声明」的等待层。等待的 admit 靠 id 回查自己的内容节点,\n * 无条件推进就会认领另一个同 id 实例的节点——比如同一个 id 先后渲染两遍。层序只在\n * 祖先—后代之间才有意义,所以把物理包含关系当准入条件,顺带挡掉这类张冠李戴。\n *\n * 物理包含只能证明「按 id 查到的内容装着这个子声明」,证明不了这份内容属于这张票据。\n * 票据还要自己持有声明归属:起步时的声明离树、又有同 id 的新节点顶上来时,这张票据\n * 就不再认领任何内容,它的清理也因此摘不走新实例的层。\n */\ntype WaitingTicket = {\n content: () => HTMLElement | null;\n owned: () => boolean;\n};\nconst waiting = new Map<() => void, WaitingTicket>();\nlet flushing = false;\n/** 在任何层开始监听之前调用;只推进既有的等待,不改变任何层的关闭政策。 */\nexport function admitWaitingModalLayers(declaration: HTMLElement | null): void {\n if (!declaration || flushing) return;\n flushing = true;\n try {\n for (const [admit, ticket] of [...waiting]) {\n // 归属先于读节点:陈旧票据连 content() 都不该去查,免得把别人的节点当自己的记下来。\n if (ticket.owned() && contains(ticket.content(), declaration)) admit();\n }\n } finally {\n flushing = false;\n }\n}\n\n/** Wait for the physical node once; keep the public Zag dismissal policy intact. */\nexport function trackModalDismissableElement({\n scope,\n send,\n prop,\n}: Params): () => void {\n const getIds = () =>\n scope.ids as NonNullable<ReturnType<typeof prop<\"ids\">>> | undefined;\n const id = (part: \"content\" | \"backdrop\" | \"positioner\") =>\n getIds()?.[part] ?? `dialog:${scope.id}:${part}`;\n const customTrigger = getIds()?.trigger;\n const triggerId =\n typeof customTrigger === \"function\"\n ? customTrigger(undefined)\n : (customTrigger ?? `dialog:${scope.id}:trigger`);\n const triggers = () => queryAll(\n scope.getRootNode(),\n '[data-scope=\"dialog\"][data-part=\"trigger\"], [data-scope=\"popup\"][data-part=\"trigger\"]',\n ).filter((node) =>\n node\n .getAttribute(\"data-ownedby\")\n ?.split(/\\s+/)\n .filter(Boolean)\n .includes(String(scope.id)),\n );\n const options = {\n type: \"dialog\" as const,\n defer: false,\n pointerBlocking: prop(\"modal\"),\n layerStyleTargets: [\n () => scope.getById<HTMLElement>(id(\"backdrop\")),\n () => scope.getById<HTMLElement>(id(\"positioner\")),\n ],\n exclude: () => [scope.getById<HTMLElement>(triggerId), ...triggers()].filter(\n Boolean,\n ),\n onInteractOutside(\n event: Parameters<\n NonNullable<ReturnType<typeof prop<\"onInteractOutside\">>>\n >[0],\n ) {\n prop(\"onInteractOutside\")?.(event);\n if (!prop(\"closeOnInteractOutside\")) event.preventDefault();\n },\n persistentElements: prop(\"persistentElements\"),\n onFocusOutside: prop(\"onFocusOutside\"),\n onPointerDownOutside: prop(\"onPointerDownOutside\"),\n onRequestDismiss: prop(\"onRequestDismiss\"),\n onEscapeKeyDown(\n event: Parameters<\n NonNullable<ReturnType<typeof prop<\"onEscapeKeyDown\">>>\n >[0],\n ) {\n prop(\"onEscapeKeyDown\")?.(event);\n if (!prop(\"closeOnEscape\")) event.preventDefault();\n },\n onDismiss() {\n send({ type: \"CLOSE\", src: \"interact-outside\" });\n },\n };\n let release: (() => void) | undefined;\n let cancelFrame: (() => void) | undefined;\n let observer: MutationObserver | undefined;\n let canceled = false;\n const contentNode = () => scope.getById<HTMLElement>(id(\"content\"));\n // 这个实例起步时的声明节点;微任务、raf 与准入 flush 三条路径共用同一条归属判定。\n const declaredAtStart = modalDeclaration(scope);\n const owned = () => modalDeclarationOwned(scope, declaredAtStart);\n const admit = () => {\n if (canceled || release || !owned()) return;\n const content = contentNode();\n // getById 可能回到这里;节点读完后再确认一次,避免同一个层入栈两次。\n if (canceled || release || !content) return;\n waiting.delete(admit);\n cancelFrame?.();\n cancelFrame = undefined;\n observer?.disconnect();\n observer = undefined;\n release = trackDismissableElement(content, options);\n };\n waiting.set(admit, { content: contentNode, owned });\n queueMicrotask(() => {\n if (canceled || release) return;\n admit();\n if (release || canceled) return;\n // Vanilla (WC) runs this effect before its view commits. Admit on the commit that inserts the\n // content, so Zag's zero-delay outside-pointer capture is queued in the opening task as it is\n // where the content commits first, not after the trap's initial-focus frame.\n const doc = scope.getDoc();\n const Observer = doc?.defaultView?.MutationObserver;\n if (Observer) {\n observer = new Observer(() => admit());\n observer.observe(doc, { childList: true, subtree: true });\n }\n cancelFrame = raf(admit);\n });\n return () => {\n if (canceled) return;\n canceled = true;\n waiting.delete(admit);\n cancelFrame?.();\n observer?.disconnect();\n observer = undefined;\n release?.();\n release = undefined;\n };\n}\n","/**\n * 模态登记。Dialog 与 Popup 共用,只放在模块内存,不读 document。\n * 被拒打开「只通知一次」也记在这里:createPopupProps 每次渲染都会重入,纯函数记不住。\n */\n\nconst modals = new Map<string, \"dialog\" | \"popup\">();\nconst rejectedOpenNotices = new Set<string>();\nconst modalSessionTokens = new Map<string, symbol>();\n\n/** Private read-only qualification; does not register a DOM node or change admission. */\nexport function registeredModalKind(id: string): \"dialog\" | \"popup\" | undefined { return modals.get(id); }\n\n/** Private finite effect snapshot of current registrations; no DOM or historical state. */\nexport function registeredModalEntries(): ReadonlyArray<readonly [string, \"dialog\" | \"popup\"]> { return [...modals]; }\n\n/** open 为 true 时登记(同 id 覆盖,不计两次);为 false 时注销。幂等。 */\nexport function syncModalRegistration(id: string, kind: \"dialog\" | \"popup\", open: boolean): void {\n if (open) modals.set(id, kind);\n else modals.delete(id);\n}\n\n/** 是否存在 id 不同的已登记模态。 */\nexport function hasOtherModal(id: string): boolean {\n if (modals.size === 0) return false;\n if (modals.size === 1 && modals.has(id)) return false;\n return true;\n}\n\n/** 本次被拒的打开尝试还没通知过时返回 true。不从包入口导出。 */\nexport function claimRejectedOpenNotice(id: string): boolean {\n if (rejectedOpenNotices.has(id)) return false;\n rejectedOpenNotices.add(id);\n if (!modalSessionTokens.has(id)) modalSessionTokens.set(id, Symbol(id));\n return true;\n}\n\n/** 调用方撤回打开,或阻塞模态消失后,允许下一次尝试再通知。 */\nexport function releaseRejectedOpenNotice(id: string): void {\n rejectedOpenNotices.delete(id);\n}\n\n/** 只供测试使用,不从包入口导出。 */\nexport function resetModalRegistryForTest(): void {\n modals.clear();\n rejectedOpenNotices.clear();\n modalSessionTokens.clear();\n}\n\n/** Internal token: invalidates deferred notices when the session is disposed. */\nexport function rejectedOpenNoticeToken(id: string): symbol | undefined { return modalSessionTokens.get(id); }\n\n/** Dispose a modal session on unmount/disconnect, including its pending rejection notice. */\nexport function disposeModalSession(id: string): void {\n modals.delete(id);\n modalSessionTokens.delete(id);\n releaseRejectedOpenNotice(id);\n}\n\n/** Internal identity replacement: ignore only the same runtime's retiring sessions. */\nexport function hasOtherModalExcept(id: string, ignored: readonly string[]): boolean {\n return [...modals.keys()].some(owner => owner !== id && !ignored.includes(owner));\n}\n","import { machine, type Service } from \"@zag-js/dialog\";\nimport { getActiveElement, getParentElement, isHTMLElement, isShadowRoot } from \"@zag-js/dom-query\";\nimport { MachineStatus, type Scope } from \"@zag-js/core\";\nimport { admitWaitingModalLayers, modalDeclaration, modalDeclarationOwned } from \"./modal-dismissable-lifetime.js\";\nimport { registeredModalKind, registeredModalEntries } from \"./modal-registry.js\";\n\ntype ModalParams = Parameters<NonNullable<NonNullable<typeof machine.implementations>[\"actions\"]>[\"invokeOnClose\"]>[0];\ntype ModalTarget = Pick<ModalParams, \"scope\" | \"state\" | \"prop\" | \"send\">;\ntype CloseToken = { cancelled: boolean; lifetime: object };\nconst closeToken = Symbol(\"qw-modal-close\");\nconst requests = new WeakMap<object, { current?: CloseToken }>();\nconst beforeClose = new WeakMap<object, () => void>();\n/** Pinned Zag adapters recreate scopes on render; their bindable state ref owns the service lifetime. */\nfunction modalInstance(target: Pick<ModalParams, \"state\">): object { return target.state.ref as object; }\n/** A composed modal may restore its draft before the owner receives a close request. */\nexport function onModalBeforeClose(target: Pick<ModalParams, \"state\">, prepare: () => void): () => void {\n const instance = modalInstance(target);\n beforeClose.set(instance, prepare);\n return () => { if (beforeClose.get(instance) === prepare) beforeClose.delete(instance); };\n}\nexport function cancelModalClose(target: Pick<ModalParams, \"state\">): void {\n const token = requests.get(modalInstance(target))?.current;\n if (token) token.cancelled = true;\n}\nfunction delivered(event: object): CloseToken | undefined {\n return (event as { [closeToken]?: CloseToken })[closeToken];\n}\n\n/** Client request boundary shared by connectors and native dismissal effects. Never run during render. */\nexport function modalRequestSend(target: ModalTarget): ModalTarget[\"send\"] {\n return event => {\n const lifetime = requests.get(modalInstance(target));\n if (!lifetime) return;\n if (event.type === \"OPEN\") {\n if (lifetime.current) lifetime.current.cancelled = true;\n target.send(event);\n return;\n }\n const closing = (event.type === \"CLOSE\" || event.type === \"TOGGLE\") && target.state.matches(\"open\");\n if (!closing) { target.send(event); return; }\n if (lifetime.current) return;\n const token: CloseToken = { cancelled: false, lifetime };\n lifetime.current = token;\n try {\n beforeClose.get(modalInstance(target))?.();\n if (token.cancelled || requests.get(modalInstance(target)) !== lifetime) return;\n target.prop(\"onOpenChange\")?.({ open: false });\n if (!token.cancelled && requests.get(modalInstance(target)) === lifetime) {\n target.send({ ...event, [closeToken]: token });\n }\n } finally {\n lifetime.current = undefined;\n }\n };\n}\n\n/** Preserve the upstream service and its method receiver; replace only its request transport. */\nexport function modalRequestService(service: Service): Service {\n const active = () => service.getStatus() === MachineStatus.Started;\n const send = modalRequestSend({ ...service, send: event => { if (active()) service.send(event); } });\n return { ...service, send: event => {\n // React schedules machine initialization; preserve an earlier real input on its original queue.\n if (service.getStatus() === MachineStatus.NotStarted) service.send(event);\n else if (active()) send(event);\n } };\n}\n\nfunction closeAllowed(params: ModalParams): boolean {\n const token = delivered(params.event);\n return !token || (!token.cancelled && requests.get(modalInstance(params)) === token.lifetime);\n}\n\ntype ModalTransitions = NonNullable<NonNullable<typeof machine.states.open.on>[\"CLOSE\"]>;\ntype ModalTransition = ModalTransitions extends (infer Item)[] ? Item : Exclude<ModalTransitions, unknown[]>;\nfunction guardClose(input: ModalTransition | ModalTransition[] | undefined): ModalTransition[] | undefined {\n return input && (Array.isArray(input) ? input : [input]).map(item => ({\n ...item,\n guard: params => closeAllowed(params) && (!item.guard || (typeof item.guard === \"function\" ? item.guard(params) : params.guard(item.guard)) === true),\n }));\n}\n\nconst HTML_NAMESPACE = \"http://www.w3.org/1999/xhtml\";\n// Only the synchronous native cleanup stack owns this fact; never retained after it.\nlet removingContent: HTMLElement | null = null;\n/** Pure declaration facts; not modal registration or trigger behavior. */\nexport function modalOriginAttrs(id: string | undefined, kind: \"dialog\" | \"popup\") {\n return { id: `dialog:${id}:origin`, \"data-qw-modal-origin\": kind };\n}\n\nconst installed = new WeakSet<Scope>();\nconst parts = { backdrop: \"backdrop\", positioner: \"positioner\", content: \"content\", title: \"title\", description: \"description\", close: \"close-trigger\" };\n\n/** Keep the physical scope; resolve only this instance's generated owner-body parts. */\nfunction installModalLookup(scope: Scope): void {\n if (installed.has(scope)) return;\n installed.add(scope);\n const getById = scope.getById;\n scope.getById = <T extends Element = HTMLElement>(id: string): T | null => {\n const found = getById<T>(id);\n if (found) return found;\n const root = scope.getRootNode();\n if (!isShadowRoot(root) || !root.host.isConnected) return null;\n const prefix = `dialog:${scope.id}:`;\n const suffix = id.slice(prefix.length);\n if (!id.startsWith(prefix) || !Object.hasOwn(parts, suffix)) return null;\n const doc = root.ownerDocument;\n const node = doc.getElementById(id);\n const kind = node?.getAttribute(\"data-scope\");\n if (!node || node.namespaceURI !== HTML_NAMESPACE || (kind !== \"dialog\" && kind !== \"popup\") || node.getAttribute(\"data-part\") !== parts[suffix as keyof typeof parts]) return null;\n const positioner = suffix === \"backdrop\" ? node : node.closest(`[data-scope=\"${kind}\"][data-part=\"positioner\"]`);\n if (positioner?.namespaceURI !== HTML_NAMESPACE || positioner.parentElement !== doc.body || positioner.id !== prefix + (suffix === \"backdrop\" ? \"backdrop\" : \"positioner\")) return null;\n if (suffix !== \"backdrop\" && suffix !== \"positioner\") {\n const content = node.closest(`[data-scope=\"${kind}\"][data-part=\"content\"]`);\n if (content?.namespaceURI !== HTML_NAMESPACE || content.id !== prefix + \"content\") return null;\n }\n return node as unknown as T;\n };\n}\n\ntype DismissableEffect = NonNullable<NonNullable<typeof machine.implementations>[\"effects\"]>[\"trackDismissableElement\"];\n\n/** Share ownership and focus delegation while selecting the component's effect. */\nexport function createModalDialogMachine(trackDismissableElement: DismissableEffect = machine.implementations!.effects!.trackDismissableElement): typeof machine {\nreturn {\n ...machine,\n entry(params) {\n requests.set(modalInstance(params), {});\n return typeof machine.entry === \"function\" ? machine.entry(params) : machine.entry;\n },\n exit(params) {\n const lifetime = requests.get(modalInstance(params));\n if (lifetime?.current) lifetime.current.cancelled = true;\n requests.delete(modalInstance(params));\n return typeof machine.exit === \"function\" ? machine.exit(params) : machine.exit;\n },\n states: {\n ...machine.states,\n open: {\n ...machine.states.open,\n on: {\n ...machine.states.open.on,\n CLOSE: guardClose(machine.states.open.on!.CLOSE),\n TOGGLE: guardClose(machine.states.open.on!.TOGGLE),\n },\n },\n },\n implementations: {\n ...machine.implementations!,\n actions: {\n ...machine.implementations!.actions!,\n invokeOnClose(params) {\n const token = delivered(params.event);\n if (token) return;\n machine.implementations!.actions!.invokeOnClose(params);\n },\n },\n effects: {\n ...machine.implementations!.effects!,\n trackDismissableElement(params) {\n // 这个层声明在谁的内容里,谁就更早开始;先放它入栈,保住 layer stack 的嵌套顺序。\n const declaredAtStart = modalDeclaration(params.scope);\n admitWaitingModalLayers(declaredAtStart);\n let content: HTMLElement | null = null;\n let origin: HTMLElement | null = null;\n let parents: HTMLElement[] = [];\n let kind: \"dialog\" | \"popup\" | undefined;\n const sources = new Set<HTMLElement>();\n const captureSources = () => {\n const doc = params.scope.getDoc();\n for (const [id, registered] of registeredModalEntries()) {\n const node = doc.getElementById(`dialog:${id}:content`);\n const positioner = node?.parentElement;\n if (isHTMLElement(node) && node.namespaceURI === HTML_NAMESPACE && node.getAttribute(\"data-scope\") === registered && node.getAttribute(\"data-part\") === \"content\" && node.getAttribute(\"role\") === \"dialog\" && positioner?.namespaceURI === HTML_NAMESPACE && positioner.id === `dialog:${id}:positioner` && positioner.getAttribute(\"data-scope\") === registered && positioner.getAttribute(\"data-part\") === \"positioner\" && positioner.parentElement === doc.body) sources.add(node);\n }\n };\n const readParents = (node: HTMLElement): HTMLElement[] => {\n const found: HTMLElement[] = [];\n for (let parent: Element | null = getParentElement(node); isHTMLElement(parent); parent = getParentElement(parent)) {\n if (parent.namespaceURI !== HTML_NAMESPACE || parent.getAttribute(\"data-part\") !== \"content\" || parent.getAttribute(\"role\") !== \"dialog\") continue;\n const id = parent.id;\n if (!id.startsWith(\"dialog:\") || !id.endsWith(\":content\")) continue;\n const owner = id.slice(7, -8);\n const registered = registeredModalKind(owner);\n if (owner !== params.scope.id && ((registered && parent.getAttribute(\"data-scope\") === registered && parent.ownerDocument.getElementById(id) === parent) || parents.includes(parent))) found.push(parent);\n }\n return found;\n };\n const scope: Scope = {\n ...params.scope,\n getById<T extends Element = HTMLElement>(id: string): T | null {\n const node = params.scope.getById<T>(id);\n // 归属与准入同一口径:起步时的声明被同 id 的新节点顶替后,这个 effect 不再\n // 记下任何内容——否则它的 release 会带着别人的 content 与祖先快照去清理。\n if (!origin && params.scope.id !== undefined && id === `dialog:${params.scope.id}:content` && isHTMLElement(node) && node.namespaceURI === HTML_NAMESPACE && modalDeclarationOwned(params.scope, declaredAtStart)) {\n kind ??= registeredModalKind(params.scope.id);\n if (kind) {\n const declaration = modalDeclaration(params.scope);\n if (declaration && declaration.namespaceURI === HTML_NAMESPACE && declaration.ownerDocument === node.ownerDocument && (declaration.getAttribute(\"data-qw-modal-origin\") === kind || (declaration.getAttribute(\"data-scope\") === kind && declaration.getAttribute(\"data-part\") === \"trigger\"))) {\n content = node; origin = declaration; parents = readParents(declaration); captureSources();\n }\n }\n }\n return node;\n },\n };\n const overrides: Parameters<NonNullable<typeof machine.props>>[0][\"props\"] = {\n get onRequestDismiss() {\n const original = params.prop(\"onRequestDismiss\");\n const handler: NonNullable<Parameters<NonNullable<typeof machine.props>>[0][\"props\"][\"onRequestDismiss\"]> = function(this: unknown, event) {\n original?.call(this, event);\n if (event.defaultPrevented || !origin || !content || kind !== \"dialog\" || event.detail.originalLayer !== content || event.target !== content) return;\n const parent = event.detail.targetLayer;\n if (!parent || parent === content) return;\n if (parent.ownerDocument !== content.ownerDocument) {\n if (parent === removingContent) event.preventDefault();\n return;\n }\n if (!sources.has(parent)) { captureSources(); if (!sources.has(parent)) return; }\n // A removed declaration retains only its own effect's captured, qualified ancestors.\n const currentParents = origin.isConnected ? readParents(origin) : parents;\n if (!currentParents.includes(parent)) event.preventDefault();\n };\n return handler;\n },\n };\n const prop: typeof params.prop = key => overrides[key] ?? params.prop(key);\n let active = true;\n const send = modalRequestSend(params);\n const cleanup = trackDismissableElement?.call(machine.implementations!.effects!, { ...params, scope, prop, send: event => { if (active) send(event); } });\n return () => {\n active = false;\n const previous = removingContent;\n // Qualification was captured by this effect while it owned the real declaration.\n removingContent = content && sources.has(content) ? content : null;\n try { cleanup?.(); }\n finally { removingContent = previous; sources.clear(); parents = []; origin = null; content = null; }\n };\n },\n trapFocus(params) {\n const docBeforeTrap = params.scope.getDoc();\n const focusBeforeTrap = docBeforeTrap ? getActiveElement(docBeforeTrap) : null;\n const contentBeforeTrap = params.scope.getById(`dialog:${params.scope.id}:content`);\n let kind: \"dialog\" | \"popup\" | undefined;\n const scope: Scope = {\n ...params.scope,\n getById<T extends Element = HTMLElement>(id: string): T | null {\n const node = params.scope.getById<T>(id);\n if (params.scope.id !== undefined && id === `dialog:${params.scope.id}:content` && node?.namespaceURI === HTML_NAMESPACE && node.getAttribute(\"data-part\") === \"content\") kind ??= registeredModalKind(params.scope.id);\n return node;\n },\n };\n const overrides: Parameters<NonNullable<typeof machine.props>>[0][\"props\"] = {\n finalFocusEl: () => {\n const original = params.prop(\"finalFocusEl\");\n if (original) return original();\n const doc = params.scope.getDoc();\n if (kind === \"popup\") {\n // Opened without a prior focus (e.g. SSR defaultOpen): Zag would restore to <body>, so target the owned popup trigger.\n if (isHTMLElement(focusBeforeTrap) && focusBeforeTrap.isConnected && focusBeforeTrap.ownerDocument === doc && focusBeforeTrap !== doc.body && !contentBeforeTrap?.contains(focusBeforeTrap)) return null;\n for (const trigger of params.scope.getRootNode().querySelectorAll('[data-scope=\"popup\"][data-part=\"trigger\"][data-ownedby]')) {\n if (trigger.getAttribute(\"data-ownedby\") === params.scope.id && isHTMLElement(trigger) && trigger.isConnected) return trigger;\n }\n return null;\n }\n if (kind !== \"dialog\") return null;\n const fallback = () => {\n if (!isHTMLElement(focusBeforeTrap) || !focusBeforeTrap.isConnected || focusBeforeTrap.ownerDocument !== doc || focusBeforeTrap === doc.body || contentBeforeTrap?.contains(focusBeforeTrap) || params.prop(\"ids\")?.trigger != null) return null;\n // Leave every actual owned trigger to Zag, including its valued trigger lookup.\n const root = params.scope.getRootNode();\n for (const trigger of root.querySelectorAll('[data-scope=\"dialog\"][data-part=\"trigger\"][data-ownedby]')) {\n if (trigger.getAttribute(\"data-ownedby\") === params.scope.id) return null;\n }\n return focusBeforeTrap;\n };\n const active = getActiveElement(doc);\n if (!active || active.ownerDocument !== doc) return fallback();\n for (let node: Element | null = active; isHTMLElement(node); node = getParentElement(node)) {\n if (node.namespaceURI !== HTML_NAMESPACE || node.getAttribute(\"data-scope\") !== \"dialog\" || node.getAttribute(\"data-part\") !== \"content\") continue;\n const id = node.id;\n if (!id.startsWith(\"dialog:\") || !id.endsWith(\":content\")) return null;\n const owner = id.slice(7, -8);\n const positioner = node.parentElement;\n if (owner !== params.scope.id && registeredModalKind(owner) === \"dialog\" && doc.getElementById(id) === node && node.getAttribute(\"role\") === \"dialog\" && positioner?.namespaceURI === HTML_NAMESPACE && positioner.id === `dialog:${owner}:positioner` && positioner.getAttribute(\"data-scope\") === \"dialog\" && positioner.getAttribute(\"data-part\") === \"positioner\" && positioner.parentElement === doc.body) return active;\n return fallback();\n }\n return fallback();\n },\n };\n const prop: typeof params.prop = key => overrides[key] ?? params.prop(key);\n return machine.implementations!.effects!.trapFocus({ ...params, scope, prop });\n },\n },\n },\n props(params) {\n installModalLookup(params.scope);\n return machine.props!(params);\n },\n};\n}\n\n/** Props initialization receives the real instance scope; all DOM reads stay lazy. */\nexport const modalDialogMachine: typeof machine = createModalDialogMachine();\n"],"mappings":";;;;;;AAaA,SAAgB,iBAAiB,OAA6C;CAC5E,MAAM,OAAO,MAAM,QAAQ,UAAU,MAAM,GAAG,QAAQ,KAAK,MAAM,QAAQ,UAAU,MAAM,GAAG,SAAS;CACrG,OAAO,cAAc,IAAI,IAAI,OAAO;AACtC;;;;;;;;;AAUA,SAAgB,sBACd,OACA,iBACS;CACT,IAAI,CAAC,iBAAiB,OAAO;CAC7B,IAAI,gBAAgB,aAAa,OAAO;CACxC,OAAO,CAAC,iBAAiB,KAAK;AAChC;AAuBA,MAAM,0BAAU,IAAI,IAA+B;AACnD,IAAI,WAAW;;AAEf,SAAgB,wBAAwB,aAAuC;CAC7E,IAAI,CAAC,eAAe,UAAU;CAC9B,WAAW;CACX,IAAI;EACF,KAAK,MAAM,CAAC,OAAO,WAAW,CAAC,GAAG,OAAO,GAEvC,IAAI,OAAO,MAAM,KAAK,SAAS,OAAO,QAAQ,GAAG,WAAW,GAAG,MAAM;CAEzE,UAAU;EACR,WAAW;CACb;AACF;;AAGA,SAAgB,6BAA6B,EAC3C,OACA,MACA,QACqB;CACrB,MAAM,eACJ,MAAM;CACR,MAAM,MAAM,SACV,OAAO,CAAC,GAAG,SAAS,UAAU,MAAM,GAAG,GAAG;CAC5C,MAAM,gBAAgB,OAAO,CAAC,EAAE;CAChC,MAAM,YACJ,OAAO,kBAAkB,aACrB,cAAc,KAAA,CAAS,IACtB,iBAAiB,UAAU,MAAM,GAAG;CAC3C,MAAM,iBAAiB,SACrB,MAAM,YAAY,GAClB,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AAG;MAAQ;MAAO;KAAK,CAAC;IAC/E;GACF;EACF;EACA,MAAM,QAAQ;GACZ,mBAAmB,OAAO,KAAK;GAC/B,OAAO,QAAQ,MAAO,MAAM;EAC9B;CACF;AACA;;AAGA,MAAa,qBAAqC,yBAAyB"}
@@ -0,0 +1,21 @@
1
+ import { machine, type Service } from "@zag-js/dialog";
2
+ type ModalParams = Parameters<NonNullable<NonNullable<typeof machine.implementations>["actions"]>["invokeOnClose"]>[0];
3
+ type ModalTarget = Pick<ModalParams, "scope" | "state" | "prop" | "send">;
4
+ /** A composed modal may restore its draft before the owner receives a close request. */
5
+ export declare function onModalBeforeClose(target: Pick<ModalParams, "state">, prepare: () => void): () => void;
6
+ export declare function cancelModalClose(target: Pick<ModalParams, "state">): void;
7
+ /** Client request boundary shared by connectors and native dismissal effects. Never run during render. */
8
+ export declare function modalRequestSend(target: ModalTarget): ModalTarget["send"];
9
+ /** Preserve the upstream service and its method receiver; replace only its request transport. */
10
+ export declare function modalRequestService(service: Service): Service;
11
+ /** Pure declaration facts; not modal registration or trigger behavior. */
12
+ export declare function modalOriginAttrs(id: string | undefined, kind: "dialog" | "popup"): {
13
+ id: string;
14
+ "data-qw-modal-origin": "dialog" | "popup";
15
+ };
16
+ type DismissableEffect = NonNullable<NonNullable<typeof machine.implementations>["effects"]>["trackDismissableElement"];
17
+ /** Share ownership and focus delegation while selecting the component's effect. */
18
+ export declare function createModalDialogMachine(trackDismissableElement?: DismissableEffect): typeof machine;
19
+ /** Props initialization receives the real instance scope; all DOM reads stay lazy. */
20
+ export declare const modalDialogMachine: typeof machine;
21
+ export {};
@@ -0,0 +1,21 @@
1
+ import { machine } from "@zag-js/dialog";
2
+ import type { Scope } from "@zag-js/core";
3
+ type Effect = NonNullable<NonNullable<typeof machine.implementations>["effects"]>["trackDismissableElement"];
4
+ type Params = Parameters<NonNullable<Effect>>[0];
5
+ type DeclarationScope = Pick<Scope, "getById" | "id">;
6
+ /** 这个层的声明节点:显式 origin 优先,退回 trigger。准入与归属两处同一口径。 */
7
+ export declare function modalDeclaration(scope: DeclarationScope): HTMLElement | null;
8
+ /**
9
+ * 实例的物理身份 = 它的 effect 起步时拿到的声明节点。id 查不出实例:同一个 id 先后渲染
10
+ * 两遍时,旧实例按 id 回查只会查到新实例的节点。所以起步时的声明一旦离树、又有别的节点
11
+ * 顶着同一个 id 回答查询,就说明声明与内容都已经换了实例,旧的既不能再认领,也不能在
12
+ * 清理时把新实例的层摘走。
13
+ *
14
+ * 起步时本来就没有声明的调用方(headless 自绘)没有可被顶替的身份,保持原口径不变。
15
+ */
16
+ export declare function modalDeclarationOwned(scope: DeclarationScope, declaredAtStart: HTMLElement | null): boolean;
17
+ /** 在任何层开始监听之前调用;只推进既有的等待,不改变任何层的关闭政策。 */
18
+ export declare function admitWaitingModalLayers(declaration: HTMLElement | null): void;
19
+ /** Wait for the physical node once; keep the public Zag dismissal policy intact. */
20
+ export declare function trackModalDismissableElement({ scope, send, prop, }: Params): () => void;
21
+ export {};
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 模态登记。Dialog 与 Popup 共用,只放在模块内存,不读 document。
3
+ * 被拒打开「只通知一次」也记在这里:createPopupProps 每次渲染都会重入,纯函数记不住。
4
+ */
5
+ /** Private read-only qualification; does not register a DOM node or change admission. */
6
+ export declare function registeredModalKind(id: string): "dialog" | "popup" | undefined;
7
+ /** Private finite effect snapshot of current registrations; no DOM or historical state. */
8
+ export declare function registeredModalEntries(): ReadonlyArray<readonly [string, "dialog" | "popup"]>;
9
+ /** open 为 true 时登记(同 id 覆盖,不计两次);为 false 时注销。幂等。 */
10
+ export declare function syncModalRegistration(id: string, kind: "dialog" | "popup", open: boolean): void;
11
+ /** 是否存在 id 不同的已登记模态。 */
12
+ export declare function hasOtherModal(id: string): boolean;
13
+ /** 本次被拒的打开尝试还没通知过时返回 true。不从包入口导出。 */
14
+ export declare function claimRejectedOpenNotice(id: string): boolean;
15
+ /** 调用方撤回打开,或阻塞模态消失后,允许下一次尝试再通知。 */
16
+ export declare function releaseRejectedOpenNotice(id: string): void;
17
+ /** 只供测试使用,不从包入口导出。 */
18
+ export declare function resetModalRegistryForTest(): void;
19
+ /** Internal token: invalidates deferred notices when the session is disposed. */
20
+ export declare function rejectedOpenNoticeToken(id: string): symbol | undefined;
21
+ /** Dispose a modal session on unmount/disconnect, including its pending rejection notice. */
22
+ export declare function disposeModalSession(id: string): void;
23
+ /** Internal identity replacement: ignore only the same runtime's retiring sessions. */
24
+ export declare function hasOtherModalExcept(id: string, ignored: readonly string[]): boolean;
@@ -0,0 +1,35 @@
1
+ import type { ModalRenderScope, ModalRenderTicket } from "./modal-render-scope.js";
2
+ /**
3
+ * The fixed cross-stack hydration marker contract. Every adapter serializes one
4
+ * ticket per declaration onto a hidden element carrying both attributes, and
5
+ * every adapter must adopt the *whole page's* markers — including foreign
6
+ * stacks' — before hydrating any one root, so ordinals stay page-global.
7
+ *
8
+ * This module is pure transport: it reads attributes and defers every validity
9
+ * and admission decision to the scope. Adapters keep only their own framework
10
+ * glue (where the root comes from, what to do with the returned tickets).
11
+ */
12
+ export declare const MODAL_TICKET_ATTRIBUTE = "data-qw-modal-ticket";
13
+ export declare const MODAL_STACK_ATTRIBUTE = "data-qw-modal-stack";
14
+ /** The finite set of stacks that may declare a modal root. */
15
+ export type ModalRenderStack = "react" | "vue" | "wc";
16
+ /** One scanned marker: its element, its declaring stack and its raw ticket data. */
17
+ export interface ModalHydrationMarker {
18
+ readonly element: Element;
19
+ readonly stack: ModalRenderStack;
20
+ readonly input: ModalRenderTicket;
21
+ }
22
+ /**
23
+ * Collect a root's markers in render order, recursing into `<template>` content
24
+ * so parked caller content is not skipped. A WC owner may only be declared by
25
+ * the WC stack; that is a transport rule, so it is rejected here, before any
26
+ * adoption happens.
27
+ */
28
+ export declare function scanModalHydrationMarkers(root: ParentNode): readonly ModalHydrationMarker[];
29
+ /** Adopt every scanned marker in render order; the canonical tickets stay index-aligned. */
30
+ export declare function adoptModalHydrationMarkers(markers: readonly ModalHydrationMarker[], scope: ModalRenderScope): readonly ModalRenderTicket[];
31
+ /**
32
+ * Bootstrap one page root: adopt the complete marker set, then return only the
33
+ * tickets this stack owns. Adapters pass their own stack tag.
34
+ */
35
+ export declare function adoptModalHydration(root: ParentNode, scope: ModalRenderScope, stack: ModalRenderStack): readonly ModalRenderTicket[];
@@ -0,0 +1,19 @@
1
+ import { type ModalRenderInputs, type ModalRenderPhase, type ModalRenderScope, type ModalRenderTicket } from "./modal-render-scope.js";
2
+ /** Stable per-component transport object. Frameworks mechanically supply phase. */
3
+ export interface ModalRenderRuntime {
4
+ scope: ModalRenderScope;
5
+ ticket: ModalRenderTicket;
6
+ phase: ModalRenderPhase;
7
+ }
8
+ /** Resolve explicit identity changes without render-time global registration. */
9
+ export declare function updateModalRenderIdentity(runtime: ModalRenderRuntime, props: ModalRenderInputs): string;
10
+ /** Pure server projection; a hydrated first tree follows its declaration ticket. */
11
+ export declare function modalRenderBlocked(runtime: ModalRenderRuntime, wantsOpen: boolean): boolean;
12
+ /** Notify a mounted client request once until a close or successful admission. */
13
+ export declare function notifyModalRenderRejection(runtime: ModalRenderRuntime, notify?: (open: false) => void): void;
14
+ /** The machine's close projection must not duplicate a rejection already notified. */
15
+ export declare function notifyModalRenderOpenChange(runtime: ModalRenderRuntime, open: boolean, notify: (open: boolean) => void): void;
16
+ /** Mounted/layout transport: acquire atomically, sync both registries, return actual open. */
17
+ export declare function syncModalRender(runtime: ModalRenderRuntime, open: boolean, notify?: (open: false) => void): boolean;
18
+ /** Session ownership prevents obsolete cleanup from clearing a reacquired ticket. */
19
+ export declare function disposeModalRender(runtime: ModalRenderRuntime): void;
@@ -0,0 +1,63 @@
1
+ /** A request-local declaration scope. It never accesses DOM or the client registry. */
2
+ export type ModalRenderKind = "dialog" | "popup";
3
+ /** A finite logical WC host identity; the physical modal remains Popup. */
4
+ export type ModalRenderOwner = "wc:action-sheet" | "wc:picker";
5
+ /** JSON bootstrap data. A rejected initial request has a non-null foreign owner. */
6
+ export interface ModalRenderTicket {
7
+ id: string;
8
+ kind: ModalRenderKind;
9
+ owner?: ModalRenderOwner;
10
+ pageSeed: string;
11
+ ordinal: number;
12
+ initialAdmitted: boolean;
13
+ initialOwnerId: string | null;
14
+ /** Native framework render identity, scoped to one root bootstrap list. */
15
+ declarationKey?: string;
16
+ /** False for SSR markup stored in an inert platform template. */
17
+ initialActive?: boolean;
18
+ }
19
+ export interface ModalRenderScopeOptions {
20
+ pageSeed?: string;
21
+ }
22
+ export type ModalRenderPhase = "server" | "client";
23
+ /** A mount session; ordinal guards identity reuse, session guards effect replay. */
24
+ export interface ModalRenderLease {
25
+ id: string;
26
+ ordinal: number;
27
+ session: number;
28
+ admitted: boolean;
29
+ }
30
+ export interface ModalRenderScope {
31
+ readonly pageSeed: string;
32
+ readonly tickets: readonly ModalRenderTicket[];
33
+ allocate(kind: ModalRenderKind, explicitId?: string, wantsOpen?: boolean, phase?: ModalRenderPhase, declarationKey?: string, initialActive?: boolean, owner?: ModalRenderOwner): ModalRenderTicket;
34
+ acquire(ticket: ModalRenderTicket, wantsOpen: boolean, claimant?: object): ModalRenderLease;
35
+ syncLease(lease: ModalRenderLease, open: boolean): boolean;
36
+ releaseLease(lease: ModalRenderLease): boolean;
37
+ adopt(ticket: ModalRenderTicket): ModalRenderTicket;
38
+ /** Called on the first client admission after the complete page bootstrap. */
39
+ completeBootstrap(): void;
40
+ hasOther(id: string, ignored?: readonly string[]): boolean;
41
+ isServerTicket(ticket: ModalRenderTicket): boolean;
42
+ sync(id: string, kind: ModalRenderKind, open: boolean, ordinal?: number): void;
43
+ release(id: string, ordinal?: number): void;
44
+ notifyInitialRejection(id: string, notify?: (open: false) => void): void;
45
+ }
46
+ /**
47
+ * Create once per page/request and share across its render roots. Bootstrap
48
+ * tickets before hydrating any root, including roots hydrated in reverse order.
49
+ * Default seeds are non-random identities, never global modal declarations.
50
+ */
51
+ export declare function createModalRenderScope(options?: ModalRenderScopeOptions): ModalRenderScope;
52
+ /** Consume one root's declaration tickets in framework render order. */
53
+ export interface ModalRenderInputs {
54
+ id?: string;
55
+ open?: boolean;
56
+ defaultOpen?: boolean;
57
+ }
58
+ export declare function wantsModalOpen(props: ModalRenderInputs): boolean;
59
+ export interface ModalTicketCursor {
60
+ takeProps(kind: ModalRenderKind, props: ModalRenderInputs, phase?: ModalRenderPhase, declarationKey?: string, initialActive?: boolean, owner?: ModalRenderOwner): ModalRenderTicket;
61
+ take(kind: ModalRenderKind, explicitId?: string, wantsOpen?: boolean, phase?: ModalRenderPhase, declarationKey?: string, initialActive?: boolean, owner?: ModalRenderOwner): ModalRenderTicket;
62
+ }
63
+ export declare function createModalTicketCursor(scope: ModalRenderScope, tickets?: readonly ModalRenderTicket[]): ModalTicketCursor;
@@ -0,0 +1 @@
1
+ export * from "./nav-bar.js";
@@ -0,0 +1,115 @@
1
+ import { createMachine } from "@zag-js/core";
2
+ //#region src/nav-bar/nav-bar.ts
3
+ /** Stable DOM parts shared by every adapter. */
4
+ const NAV_BAR_PARTS = [
5
+ "root",
6
+ "back",
7
+ "back-icon",
8
+ "back-text",
9
+ "left",
10
+ "center",
11
+ "title",
12
+ "subtitle",
13
+ "right"
14
+ ];
15
+ /** 0 renders the title without heading semantics. */
16
+ const NAV_BAR_HEADING_LEVELS = [
17
+ 0,
18
+ 1,
19
+ 2,
20
+ 3,
21
+ 4,
22
+ 5,
23
+ 6
24
+ ];
25
+ const str = (value) => typeof value === "string" ? value : "";
26
+ function resolveNavBarState(props = {}) {
27
+ const label = str(props.backLabel).trim(), href = str(props.backHref).trim();
28
+ return {
29
+ title: str(props.title),
30
+ subtitle: str(props.subtitle),
31
+ back: props.back !== false,
32
+ backText: str(props.backText).trim(),
33
+ backLabel: label || "返回",
34
+ backHref: href || void 0,
35
+ headingLevel: NAV_BAR_HEADING_LEVELS.includes(props.headingLevel) ? props.headingLevel : 1,
36
+ safeAreaTop: props.safeAreaTop !== false
37
+ };
38
+ }
39
+ function createNavBarProps(props = {}) {
40
+ if (props.id !== void 0 && (typeof props.id !== "string" || !props.id.trim())) throw new TypeError("NavBar requires a nonempty instance id when provided");
41
+ return { ...props };
42
+ }
43
+ const navBarMachine = createMachine({
44
+ props: ({ props }) => createNavBarProps(props),
45
+ initialState: () => "ready",
46
+ states: { ready: {} }
47
+ });
48
+ const live = (service) => resolveNavBarState({
49
+ title: service.prop("title"),
50
+ subtitle: service.prop("subtitle"),
51
+ back: service.prop("back"),
52
+ backText: service.prop("backText"),
53
+ backLabel: service.prop("backLabel"),
54
+ backHref: service.prop("backHref"),
55
+ headingLevel: service.prop("headingLevel"),
56
+ safeAreaTop: service.prop("safeAreaTop")
57
+ });
58
+ function connectNavBar(service, normalize) {
59
+ const state = live(service), id = `nav-bar:${service.scope.id}`, part = (name) => ({
60
+ "data-scope": "nav-bar",
61
+ "data-part": name
62
+ });
63
+ const backTag = state.backHref ? "a" : "button";
64
+ return {
65
+ title: state.title,
66
+ subtitle: state.subtitle,
67
+ back: state.back,
68
+ backText: state.backText,
69
+ backTag,
70
+ getRootProps: () => normalize.element({
71
+ ...part("root"),
72
+ id,
73
+ "data-safe-area": state.safeAreaTop ? "top" : void 0
74
+ }),
75
+ getBackProps: () => normalize.element({
76
+ ...part("back"),
77
+ ...backTag === "a" ? { href: state.backHref } : { type: "button" },
78
+ "aria-label": state.backText ? void 0 : state.backLabel,
79
+ hidden: !state.back || void 0,
80
+ onClick(event) {
81
+ service.prop("onBack")?.({
82
+ event,
83
+ href: state.backHref
84
+ });
85
+ }
86
+ }),
87
+ getBackIconProps: () => normalize.element({
88
+ ...part("back-icon"),
89
+ "aria-hidden": true
90
+ }),
91
+ getBackTextProps: () => normalize.element({
92
+ ...part("back-text"),
93
+ hidden: !state.backText || void 0
94
+ }),
95
+ getLeftProps: () => normalize.element({ ...part("left") }),
96
+ getCenterProps: () => normalize.element({ ...part("center") }),
97
+ getTitleProps: () => normalize.element({
98
+ ...part("title"),
99
+ id: `${id}:title`,
100
+ ...state.headingLevel ? {
101
+ role: "heading",
102
+ "aria-level": state.headingLevel
103
+ } : {}
104
+ }),
105
+ getSubtitleProps: () => normalize.element({
106
+ ...part("subtitle"),
107
+ hidden: !state.subtitle || void 0
108
+ }),
109
+ getRightProps: () => normalize.element({ ...part("right") })
110
+ };
111
+ }
112
+ //#endregion
113
+ export { NAV_BAR_HEADING_LEVELS, NAV_BAR_PARTS, connectNavBar, createNavBarProps, navBarMachine, resolveNavBarState };
114
+
115
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/nav-bar/nav-bar.ts"],"sourcesContent":["import { createMachine, type Machine, type Service } from \"@zag-js/core\";\nimport type { NormalizeProps, PropTypes } from \"@zag-js/types\";\n\n/** Stable DOM parts shared by every adapter. */\nexport const NAV_BAR_PARTS = [\"root\", \"back\", \"back-icon\", \"back-text\", \"left\", \"center\", \"title\", \"subtitle\", \"right\"] as const;\n/** 0 renders the title without heading semantics. */\nexport const NAV_BAR_HEADING_LEVELS = [0, 1, 2, 3, 4, 5, 6] as const;\nexport type NavBarHeadingLevel = (typeof NAV_BAR_HEADING_LEVELS)[number];\n/** Common cancellation contract; framework and native click events both satisfy it. */\nexport interface NavBarBackEvent { readonly defaultPrevented: boolean; preventDefault(): void }\nexport interface NavBarBackDetails { event: NavBarBackEvent; href: string | undefined }\n\nexport interface QwNavBarProps {\n /** Page-unique instance identity; adapters generate one when omitted. */\n id?: string;\n /** Page title; one visual line with ellipsis, the full text stays in the DOM. */\n title?: string;\n /** Optional second line under the title. */\n subtitle?: string;\n /** Render the back control; default true. */\n back?: boolean;\n /** Visible text after the back arrow (for example 返回); omitted shows the arrow only. */\n backText?: string;\n /** Accessible name when backText is omitted; default 返回. */\n backLabel?: string;\n /** Render the back control as a link to this URL instead of a button. */\n backHref?: string;\n /** aria-level of the title; default 1, 0 disables heading semantics. */\n headingLevel?: NavBarHeadingLevel;\n /** Pad the top edge by the safe-area inset; default true. */\n safeAreaTop?: boolean;\n /** Called first on back activation; call event.preventDefault() to cancel a backHref navigation. */\n onBack?: (details: NavBarBackDetails) => void;\n}\nexport interface ResolvedNavBarState {\n title: string; subtitle: string; back: boolean; backText: string; backLabel: string; backHref: string | undefined; headingLevel: NavBarHeadingLevel; safeAreaTop: boolean;\n}\nconst str = (value: unknown): string => typeof value === \"string\" ? value : \"\";\nexport function resolveNavBarState(props: QwNavBarProps = {}): ResolvedNavBarState {\n const label = str(props.backLabel).trim(), href = str(props.backHref).trim();\n return {\n title: str(props.title), subtitle: str(props.subtitle), back: props.back !== false, backText: str(props.backText).trim(), backLabel: label || \"返回\",\n backHref: href || undefined, headingLevel: NAV_BAR_HEADING_LEVELS.includes(props.headingLevel!) ? props.headingLevel! : 1, safeAreaTop: props.safeAreaTop !== false,\n };\n}\nexport function createNavBarProps(props: QwNavBarProps = {}): QwNavBarProps {\n if (props.id !== undefined && (typeof props.id !== \"string\" || !props.id.trim())) throw new TypeError(\"NavBar requires a nonempty instance id when provided\");\n return { ...props };\n}\n\n/** Stateless: NavBar has no interaction state; the machine only carries props and identity. */\nexport interface QwNavBarSchema { props: QwNavBarProps; state: \"ready\" }\nexport type QwNavBarMachine = Machine<QwNavBarSchema>;\nexport type QwNavBarService = Service<QwNavBarSchema>;\nexport const navBarMachine: QwNavBarMachine = createMachine<QwNavBarSchema>({\n props: ({ props }) => createNavBarProps(props), initialState: () => \"ready\", states: { ready: {} },\n});\nconst live = (service: Pick<QwNavBarService, \"prop\">) => resolveNavBarState({\n title: service.prop(\"title\"), subtitle: service.prop(\"subtitle\"), back: service.prop(\"back\"), backText: service.prop(\"backText\"), backLabel: service.prop(\"backLabel\"),\n backHref: service.prop(\"backHref\"), headingLevel: service.prop(\"headingLevel\"), safeAreaTop: service.prop(\"safeAreaTop\"),\n});\n\nexport interface QwNavBarApi<T extends PropTypes = PropTypes> {\n title: string; subtitle: string; back: boolean; backText: string;\n /** Element the adapter renders for the back control. */\n backTag: \"a\" | \"button\";\n getRootProps(): T[\"element\"];\n getBackProps(): T[\"element\"];\n getBackIconProps(): T[\"element\"];\n getBackTextProps(): T[\"element\"];\n getLeftProps(): T[\"element\"];\n getCenterProps(): T[\"element\"];\n getTitleProps(): T[\"element\"];\n getSubtitleProps(): T[\"element\"];\n getRightProps(): T[\"element\"];\n}\nexport function connectNavBar<T extends PropTypes>(service: QwNavBarService, normalize: NormalizeProps<T>): QwNavBarApi<T> {\n const state = live(service), id = `nav-bar:${service.scope.id}`, part = (name: string) => ({ \"data-scope\": \"nav-bar\", \"data-part\": name });\n const backTag = state.backHref ? \"a\" : \"button\";\n return {\n title: state.title, subtitle: state.subtitle, back: state.back, backText: state.backText, backTag,\n // The root carries no Core handlers, so caller root events are never overwritten.\n getRootProps: () => normalize.element({ ...part(\"root\"), id, \"data-safe-area\": state.safeAreaTop ? \"top\" : undefined }),\n getBackProps: () => normalize.element({ ...part(\"back\"), ...(backTag === \"a\" ? { href: state.backHref } : { type: \"button\" }),\n \"aria-label\": state.backText ? undefined : state.backLabel, hidden: !state.back || undefined,\n onClick(event: NavBarBackEvent) { service.prop(\"onBack\")?.({ event, href: state.backHref }); } }),\n getBackIconProps: () => normalize.element({ ...part(\"back-icon\"), \"aria-hidden\": true }),\n getBackTextProps: () => normalize.element({ ...part(\"back-text\"), hidden: !state.backText || undefined }),\n getLeftProps: () => normalize.element({ ...part(\"left\") }),\n getCenterProps: () => normalize.element({ ...part(\"center\") }),\n getTitleProps: () => normalize.element({ ...part(\"title\"), id: `${id}:title`, ...(state.headingLevel ? { role: \"heading\", \"aria-level\": state.headingLevel } : {}) }),\n getSubtitleProps: () => normalize.element({ ...part(\"subtitle\"), hidden: !state.subtitle || undefined }),\n getRightProps: () => normalize.element({ ...part(\"right\") }),\n };\n}\n"],"mappings":";;;AAIA,MAAa,gBAAgB;CAAC;CAAQ;CAAQ;CAAa;CAAa;CAAQ;CAAU;CAAS;CAAY;AAAO;;AAEtH,MAAa,yBAAyB;CAAC;CAAG;CAAG;CAAG;CAAG;CAAG;CAAG;AAA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@@ -0,0 +1,76 @@
1
+ import { type Machine, type Service } from "@zag-js/core";
2
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
3
+ /** Stable DOM parts shared by every adapter. */
4
+ export declare const NAV_BAR_PARTS: readonly ["root", "back", "back-icon", "back-text", "left", "center", "title", "subtitle", "right"];
5
+ /** 0 renders the title without heading semantics. */
6
+ export declare const NAV_BAR_HEADING_LEVELS: readonly [0, 1, 2, 3, 4, 5, 6];
7
+ export type NavBarHeadingLevel = (typeof NAV_BAR_HEADING_LEVELS)[number];
8
+ /** Common cancellation contract; framework and native click events both satisfy it. */
9
+ export interface NavBarBackEvent {
10
+ readonly defaultPrevented: boolean;
11
+ preventDefault(): void;
12
+ }
13
+ export interface NavBarBackDetails {
14
+ event: NavBarBackEvent;
15
+ href: string | undefined;
16
+ }
17
+ export interface QwNavBarProps {
18
+ /** Page-unique instance identity; adapters generate one when omitted. */
19
+ id?: string;
20
+ /** Page title; one visual line with ellipsis, the full text stays in the DOM. */
21
+ title?: string;
22
+ /** Optional second line under the title. */
23
+ subtitle?: string;
24
+ /** Render the back control; default true. */
25
+ back?: boolean;
26
+ /** Visible text after the back arrow (for example 返回); omitted shows the arrow only. */
27
+ backText?: string;
28
+ /** Accessible name when backText is omitted; default 返回. */
29
+ backLabel?: string;
30
+ /** Render the back control as a link to this URL instead of a button. */
31
+ backHref?: string;
32
+ /** aria-level of the title; default 1, 0 disables heading semantics. */
33
+ headingLevel?: NavBarHeadingLevel;
34
+ /** Pad the top edge by the safe-area inset; default true. */
35
+ safeAreaTop?: boolean;
36
+ /** Called first on back activation; call event.preventDefault() to cancel a backHref navigation. */
37
+ onBack?: (details: NavBarBackDetails) => void;
38
+ }
39
+ export interface ResolvedNavBarState {
40
+ title: string;
41
+ subtitle: string;
42
+ back: boolean;
43
+ backText: string;
44
+ backLabel: string;
45
+ backHref: string | undefined;
46
+ headingLevel: NavBarHeadingLevel;
47
+ safeAreaTop: boolean;
48
+ }
49
+ export declare function resolveNavBarState(props?: QwNavBarProps): ResolvedNavBarState;
50
+ export declare function createNavBarProps(props?: QwNavBarProps): QwNavBarProps;
51
+ /** Stateless: NavBar has no interaction state; the machine only carries props and identity. */
52
+ export interface QwNavBarSchema {
53
+ props: QwNavBarProps;
54
+ state: "ready";
55
+ }
56
+ export type QwNavBarMachine = Machine<QwNavBarSchema>;
57
+ export type QwNavBarService = Service<QwNavBarSchema>;
58
+ export declare const navBarMachine: QwNavBarMachine;
59
+ export interface QwNavBarApi<T extends PropTypes = PropTypes> {
60
+ title: string;
61
+ subtitle: string;
62
+ back: boolean;
63
+ backText: string;
64
+ /** Element the adapter renders for the back control. */
65
+ backTag: "a" | "button";
66
+ getRootProps(): T["element"];
67
+ getBackProps(): T["element"];
68
+ getBackIconProps(): T["element"];
69
+ getBackTextProps(): T["element"];
70
+ getLeftProps(): T["element"];
71
+ getCenterProps(): T["element"];
72
+ getTitleProps(): T["element"];
73
+ getSubtitleProps(): T["element"];
74
+ getRightProps(): T["element"];
75
+ }
76
+ export declare function connectNavBar<T extends PropTypes>(service: QwNavBarService, normalize: NormalizeProps<T>): QwNavBarApi<T>;
@@ -0,0 +1,2 @@
1
+ export { NOTICE_BAR_TONES, NOTICE_BAR_PARTS, NOTICE_BAR_DEFAULT_SPEED, NOTICE_BAR_DEFAULT_DELAY, resolveNoticeBarSpeed, resolveNoticeBarDelay, resolveNoticeBarMarquee, createNoticeBarProps, noticeBarMachine, connectNoticeBar } from "./notice-bar.js";
2
+ export type { NoticeBarTone, NoticeBarPart, NoticeBarMarqueePhase, QwNoticeBarProps, QwNoticeBarSchema, QwNoticeBarMachine, QwNoticeBarService, QwNoticeBarApi } from "./notice-bar.js";
@@ -0,0 +1,2 @@
1
+ import { a as connectNoticeBar, c as resolveNoticeBarDelay, i as NOTICE_BAR_TONES, l as resolveNoticeBarMarquee, n as NOTICE_BAR_DEFAULT_SPEED, o as createNoticeBarProps, r as NOTICE_BAR_PARTS, s as noticeBarMachine, t as NOTICE_BAR_DEFAULT_DELAY, u as resolveNoticeBarSpeed } from "../notice-bar-DMpwLvRb.js";
2
+ export { NOTICE_BAR_DEFAULT_DELAY, NOTICE_BAR_DEFAULT_SPEED, NOTICE_BAR_PARTS, NOTICE_BAR_TONES, connectNoticeBar, createNoticeBarProps, noticeBarMachine, resolveNoticeBarDelay, resolveNoticeBarMarquee, resolveNoticeBarSpeed };
@@ -0,0 +1,103 @@
1
+ import { type Machine, type Service } from "@zag-js/core";
2
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
3
+ import { type IconNameInput, type IconState } from "../icon/index.js";
4
+ /** Existing T3 status roles. */
5
+ export declare const NOTICE_BAR_TONES: readonly ["info", "warning", "danger", "success"];
6
+ /** Stable DOM parts shared by every adapter. */
7
+ export declare const NOTICE_BAR_PARTS: readonly ["root", "icon", "content", "text", "extra", "close"];
8
+ export declare const NOTICE_BAR_DEFAULT_SPEED = 50;
9
+ export declare const NOTICE_BAR_DEFAULT_DELAY = 2000;
10
+ export type NoticeBarTone = (typeof NOTICE_BAR_TONES)[number];
11
+ export type NoticeBarPart = (typeof NOTICE_BAR_PARTS)[number];
12
+ /** idle: static/waiting; first: 0 → −text; loop: container → −text, infinite. */
13
+ export type NoticeBarMarqueePhase = "idle" | "first" | "loop";
14
+ export interface QwNoticeBarProps {
15
+ id?: string;
16
+ /** Required full announcement text; always present once in the DOM. */
17
+ content: string;
18
+ tone?: NoticeBarTone;
19
+ /** System icon name; defaults "info". */
20
+ icon?: IconNameInput;
21
+ /** Defaults true. */
22
+ showIcon?: boolean;
23
+ /** Show every line instead of a single truncated line. Disables marquee. */
24
+ wrap?: boolean;
25
+ /** Scroll horizontally only while the text overflows; never under reduced motion. */
26
+ marquee?: boolean;
27
+ /** Pixels per second; non-finite/≤0 uses 50. */
28
+ speed?: number;
29
+ /** Milliseconds before the first pass; negative/non-finite uses 2000. */
30
+ delay?: number;
31
+ closeable?: boolean;
32
+ /** Close button accessible name; defaults 「关闭」 (not translated by the component). */
33
+ closeLabel?: string;
34
+ /** Controlled visibility; closing only calls onClose. */
35
+ open?: boolean;
36
+ /** Initial uncontrolled visibility; defaults true. */
37
+ defaultOpen?: boolean;
38
+ onClose?: () => void;
39
+ }
40
+ interface Geometry {
41
+ container: number;
42
+ text: number;
43
+ }
44
+ export interface QwNoticeBarSchema {
45
+ props: Omit<QwNoticeBarProps, "icon"> & {
46
+ tone: NoticeBarTone;
47
+ icon: string;
48
+ showIcon: boolean;
49
+ speed: number;
50
+ delay: number;
51
+ closeLabel: string;
52
+ defaultOpen: boolean;
53
+ };
54
+ context: {
55
+ open: boolean;
56
+ overflow: boolean;
57
+ reduced: boolean;
58
+ phase: NoticeBarMarqueePhase;
59
+ geometry: Geometry;
60
+ };
61
+ state: "ready";
62
+ action: "close" | "restart" | "resetPhase";
63
+ effect: "trackLayout";
64
+ event: {
65
+ type: "CLOSE";
66
+ } | {
67
+ type: "LAYOUT.RESET";
68
+ };
69
+ }
70
+ export type QwNoticeBarMachine = Machine<QwNoticeBarSchema>;
71
+ export type QwNoticeBarService = Service<QwNoticeBarSchema>;
72
+ export declare function resolveNoticeBarSpeed(speed: unknown): number;
73
+ export declare function resolveNoticeBarDelay(delay: unknown): number;
74
+ /** Pure marquee geometry: CSS variables for the current phase, or null when static. */
75
+ export declare function resolveNoticeBarMarquee(phase: NoticeBarMarqueePhase, geometry: Geometry, speed: number): {
76
+ from: number;
77
+ to: number;
78
+ duration: number;
79
+ } | null;
80
+ export declare function createNoticeBarProps(props: QwNoticeBarProps): QwNoticeBarSchema["props"];
81
+ /** Core owns close requests, overflow measurement, reduced-motion reads, delay timer and phase changes. */
82
+ export declare const noticeBarMachine: QwNoticeBarMachine;
83
+ export interface QwNoticeBarApi<T extends PropTypes = PropTypes> {
84
+ open: boolean;
85
+ content: string;
86
+ tone: NoticeBarTone;
87
+ /** Text currently overflows its single-line container (static truncation or marquee). */
88
+ overflow: boolean;
89
+ /** Marquee animation is running (requested, overflowing, not wrapped, motion allowed, delay elapsed). */
90
+ scrolling: boolean;
91
+ close(): void;
92
+ getRootProps(): T["element"];
93
+ getIconProps(): T["element"];
94
+ getIconState(): IconState;
95
+ getContentProps(): T["element"];
96
+ getTextProps(): T["element"];
97
+ getExtraProps(): T["element"];
98
+ getCloseProps(): T["button"];
99
+ getCloseIconState(): IconState;
100
+ }
101
+ /** SSR-pure getters. Without measurement SSR renders the static, complete text. */
102
+ export declare function connectNoticeBar<T extends PropTypes>(service: QwNoticeBarService, normalize: NormalizeProps<T>): QwNoticeBarApi<T>;
103
+ export {};