stimeo-ui 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/CHANGELOG.md +106 -1
  2. package/README.md +19 -10
  3. package/dist/cable/index.d.ts +9 -8
  4. package/dist/cable/index.js +22 -14
  5. package/dist/cable/index.js.map +1 -1
  6. package/dist/coerce-JtZVNG5h.d.ts +20 -0
  7. package/dist/controllers/accordion_controller.js +14 -6
  8. package/dist/controllers/accordion_controller.js.map +1 -1
  9. package/dist/controllers/alert_dialog_controller.js +145 -118
  10. package/dist/controllers/alert_dialog_controller.js.map +1 -1
  11. package/dist/controllers/announcer_controller.d.ts +5 -3
  12. package/dist/controllers/announcer_controller.js +113 -17
  13. package/dist/controllers/announcer_controller.js.map +1 -1
  14. package/dist/controllers/auto_submit_controller.js +185 -60
  15. package/dist/controllers/auto_submit_controller.js.map +1 -1
  16. package/dist/controllers/avatar_controller.js +55 -43
  17. package/dist/controllers/avatar_controller.js.map +1 -1
  18. package/dist/controllers/breadcrumb_controller.js.map +1 -1
  19. package/dist/controllers/bulk_select_controller.d.ts +3 -3
  20. package/dist/controllers/bulk_select_controller.js +64 -50
  21. package/dist/controllers/bulk_select_controller.js.map +1 -1
  22. package/dist/controllers/calendar_controller.d.ts +15 -12
  23. package/dist/controllers/calendar_controller.js +55 -53
  24. package/dist/controllers/calendar_controller.js.map +1 -1
  25. package/dist/controllers/carousel_controller.d.ts +9 -5
  26. package/dist/controllers/carousel_controller.js +124 -86
  27. package/dist/controllers/carousel_controller.js.map +1 -1
  28. package/dist/controllers/character_counter_controller.d.ts +27 -6
  29. package/dist/controllers/character_counter_controller.js +291 -95
  30. package/dist/controllers/character_counter_controller.js.map +1 -1
  31. package/dist/controllers/checkbox_controller.js +6 -0
  32. package/dist/controllers/checkbox_controller.js.map +1 -1
  33. package/dist/controllers/clipboard_controller.js +118 -27
  34. package/dist/controllers/clipboard_controller.js.map +1 -1
  35. package/dist/controllers/collapsible_controller.d.ts +1 -1
  36. package/dist/controllers/collapsible_controller.js +52 -49
  37. package/dist/controllers/collapsible_controller.js.map +1 -1
  38. package/dist/controllers/color_picker_controller.js +29 -7
  39. package/dist/controllers/color_picker_controller.js.map +1 -1
  40. package/dist/controllers/combobox_controller.d.ts +1 -1
  41. package/dist/controllers/combobox_controller.js +210 -71
  42. package/dist/controllers/combobox_controller.js.map +1 -1
  43. package/dist/controllers/command_palette_controller.d.ts +9 -9
  44. package/dist/controllers/command_palette_controller.js +289 -140
  45. package/dist/controllers/command_palette_controller.js.map +1 -1
  46. package/dist/controllers/conditional_fields_controller.js +145 -58
  47. package/dist/controllers/conditional_fields_controller.js.map +1 -1
  48. package/dist/controllers/confirm_controller.js +145 -118
  49. package/dist/controllers/confirm_controller.js.map +1 -1
  50. package/dist/controllers/context_menu_controller.d.ts +49 -14
  51. package/dist/controllers/context_menu_controller.js +138 -73
  52. package/dist/controllers/context_menu_controller.js.map +1 -1
  53. package/dist/controllers/count_up_controller.js.map +1 -1
  54. package/dist/controllers/countdown_controller.d.ts +2 -2
  55. package/dist/controllers/countdown_controller.js +109 -21
  56. package/dist/controllers/countdown_controller.js.map +1 -1
  57. package/dist/controllers/currency_input_controller.d.ts +75 -11
  58. package/dist/controllers/currency_input_controller.js +446 -72
  59. package/dist/controllers/currency_input_controller.js.map +1 -1
  60. package/dist/controllers/data_grid_controller.d.ts +10 -8
  61. package/dist/controllers/data_grid_controller.js +134 -28
  62. package/dist/controllers/data_grid_controller.js.map +1 -1
  63. package/dist/controllers/date_range_picker_controller.d.ts +12 -9
  64. package/dist/controllers/date_range_picker_controller.js +93 -72
  65. package/dist/controllers/date_range_picker_controller.js.map +1 -1
  66. package/dist/controllers/dialog_controller.d.ts +4 -5
  67. package/dist/controllers/dialog_controller.js +145 -118
  68. package/dist/controllers/dialog_controller.js.map +1 -1
  69. package/dist/controllers/direct_upload_controller.d.ts +1 -1
  70. package/dist/controllers/direct_upload_controller.js +24 -14
  71. package/dist/controllers/direct_upload_controller.js.map +1 -1
  72. package/dist/controllers/dirty_form_controller.d.ts +6 -1
  73. package/dist/controllers/dirty_form_controller.js +68 -31
  74. package/dist/controllers/dirty_form_controller.js.map +1 -1
  75. package/dist/controllers/dismissible_controller.js +64 -46
  76. package/dist/controllers/dismissible_controller.js.map +1 -1
  77. package/dist/controllers/drawer_controller.js +145 -118
  78. package/dist/controllers/drawer_controller.js.map +1 -1
  79. package/dist/controllers/dropdown_controller.js +76 -63
  80. package/dist/controllers/dropdown_controller.js.map +1 -1
  81. package/dist/controllers/editable_controller.js +199 -62
  82. package/dist/controllers/editable_controller.js.map +1 -1
  83. package/dist/controllers/empty_state_controller.js +13 -6
  84. package/dist/controllers/empty_state_controller.js.map +1 -1
  85. package/dist/controllers/file_dropzone_controller.d.ts +3 -0
  86. package/dist/controllers/file_dropzone_controller.js +55 -48
  87. package/dist/controllers/file_dropzone_controller.js.map +1 -1
  88. package/dist/controllers/filter_controller.js +9 -2
  89. package/dist/controllers/filter_controller.js.map +1 -1
  90. package/dist/controllers/flash_controller.d.ts +4 -4
  91. package/dist/controllers/flash_controller.js +66 -33
  92. package/dist/controllers/flash_controller.js.map +1 -1
  93. package/dist/controllers/focus_controller.d.ts +3 -3
  94. package/dist/controllers/focus_controller.js +39 -14
  95. package/dist/controllers/focus_controller.js.map +1 -1
  96. package/dist/controllers/form_field_controller.js +52 -43
  97. package/dist/controllers/form_field_controller.js.map +1 -1
  98. package/dist/controllers/form_validation_controller.d.ts +3 -3
  99. package/dist/controllers/form_validation_controller.js +18 -11
  100. package/dist/controllers/form_validation_controller.js.map +1 -1
  101. package/dist/controllers/frame_loading_controller.d.ts +13 -12
  102. package/dist/controllers/frame_loading_controller.js +55 -48
  103. package/dist/controllers/frame_loading_controller.js.map +1 -1
  104. package/dist/controllers/highlight_controller.d.ts +5 -4
  105. package/dist/controllers/highlight_controller.js.map +1 -1
  106. package/dist/controllers/hover_card_controller.d.ts +4 -1
  107. package/dist/controllers/hover_card_controller.js +67 -61
  108. package/dist/controllers/hover_card_controller.js.map +1 -1
  109. package/dist/controllers/idle_controller.d.ts +6 -5
  110. package/dist/controllers/idle_controller.js +10 -6
  111. package/dist/controllers/idle_controller.js.map +1 -1
  112. package/dist/controllers/input_mask_controller.d.ts +30 -13
  113. package/dist/controllers/input_mask_controller.js +411 -24
  114. package/dist/controllers/input_mask_controller.js.map +1 -1
  115. package/dist/controllers/intersection_controller.js +3 -0
  116. package/dist/controllers/intersection_controller.js.map +1 -1
  117. package/dist/controllers/lazy_frame_controller.d.ts +3 -2
  118. package/dist/controllers/lazy_frame_controller.js +15 -3
  119. package/dist/controllers/lazy_frame_controller.js.map +1 -1
  120. package/dist/controllers/listbox_controller.d.ts +10 -7
  121. package/dist/controllers/listbox_controller.js +260 -79
  122. package/dist/controllers/listbox_controller.js.map +1 -1
  123. package/dist/controllers/local_time_controller.d.ts +8 -6
  124. package/dist/controllers/local_time_controller.js +48 -13
  125. package/dist/controllers/local_time_controller.js.map +1 -1
  126. package/dist/controllers/masonry_controller.js +11 -4
  127. package/dist/controllers/masonry_controller.js.map +1 -1
  128. package/dist/controllers/menu_controller.d.ts +24 -5
  129. package/dist/controllers/menu_controller.js +138 -82
  130. package/dist/controllers/menu_controller.js.map +1 -1
  131. package/dist/controllers/menubar_controller.d.ts +49 -7
  132. package/dist/controllers/menubar_controller.js +65 -19
  133. package/dist/controllers/menubar_controller.js.map +1 -1
  134. package/dist/controllers/meter_controller.d.ts +13 -20
  135. package/dist/controllers/meter_controller.js +270 -24
  136. package/dist/controllers/meter_controller.js.map +1 -1
  137. package/dist/controllers/multi_select_controller.d.ts +17 -15
  138. package/dist/controllers/multi_select_controller.js +251 -94
  139. package/dist/controllers/multi_select_controller.js.map +1 -1
  140. package/dist/controllers/navigation_menu_controller.d.ts +19 -5
  141. package/dist/controllers/navigation_menu_controller.js +67 -19
  142. package/dist/controllers/navigation_menu_controller.js.map +1 -1
  143. package/dist/controllers/nested_form_controller.js +98 -64
  144. package/dist/controllers/nested_form_controller.js.map +1 -1
  145. package/dist/controllers/network_status_controller.js +70 -52
  146. package/dist/controllers/network_status_controller.js.map +1 -1
  147. package/dist/controllers/number_input_controller.d.ts +24 -6
  148. package/dist/controllers/number_input_controller.js +344 -94
  149. package/dist/controllers/number_input_controller.js.map +1 -1
  150. package/dist/controllers/optimistic_controller.d.ts +8 -5
  151. package/dist/controllers/optimistic_controller.js +29 -11
  152. package/dist/controllers/optimistic_controller.js.map +1 -1
  153. package/dist/controllers/otp_controller.d.ts +35 -4
  154. package/dist/controllers/otp_controller.js +502 -104
  155. package/dist/controllers/otp_controller.js.map +1 -1
  156. package/dist/controllers/overflow_indicator_controller.js +6 -0
  157. package/dist/controllers/overflow_indicator_controller.js.map +1 -1
  158. package/dist/controllers/overflow_menu_controller.d.ts +10 -9
  159. package/dist/controllers/overflow_menu_controller.js +136 -21
  160. package/dist/controllers/overflow_menu_controller.js.map +1 -1
  161. package/dist/controllers/pagination_controller.d.ts +3 -2
  162. package/dist/controllers/pagination_controller.js +47 -14
  163. package/dist/controllers/pagination_controller.js.map +1 -1
  164. package/dist/controllers/password_reveal_controller.d.ts +5 -4
  165. package/dist/controllers/password_reveal_controller.js +52 -49
  166. package/dist/controllers/password_reveal_controller.js.map +1 -1
  167. package/dist/controllers/password_strength_controller.d.ts +1 -1
  168. package/dist/controllers/password_strength_controller.js +13 -6
  169. package/dist/controllers/password_strength_controller.js.map +1 -1
  170. package/dist/controllers/persist_controller.js +48 -128
  171. package/dist/controllers/persist_controller.js.map +1 -1
  172. package/dist/controllers/pointer_drag_controller.d.ts +19 -8
  173. package/dist/controllers/pointer_drag_controller.js +249 -23
  174. package/dist/controllers/pointer_drag_controller.js.map +1 -1
  175. package/dist/controllers/popover_controller.d.ts +3 -3
  176. package/dist/controllers/popover_controller.js +82 -65
  177. package/dist/controllers/popover_controller.js.map +1 -1
  178. package/dist/controllers/portal_controller.js +6 -0
  179. package/dist/controllers/portal_controller.js.map +1 -1
  180. package/dist/controllers/preview_guard_controller.js +14 -3
  181. package/dist/controllers/preview_guard_controller.js.map +1 -1
  182. package/dist/controllers/progress_controller.d.ts +9 -19
  183. package/dist/controllers/progress_controller.js +271 -27
  184. package/dist/controllers/progress_controller.js.map +1 -1
  185. package/dist/controllers/radio_group_controller.d.ts +11 -8
  186. package/dist/controllers/radio_group_controller.js +167 -80
  187. package/dist/controllers/radio_group_controller.js.map +1 -1
  188. package/dist/controllers/range_slider_controller.d.ts +4 -3
  189. package/dist/controllers/range_slider_controller.js +27 -7
  190. package/dist/controllers/range_slider_controller.js.map +1 -1
  191. package/dist/controllers/rating_controller.js +93 -57
  192. package/dist/controllers/rating_controller.js.map +1 -1
  193. package/dist/controllers/read_more_controller.js +10 -6
  194. package/dist/controllers/read_more_controller.js.map +1 -1
  195. package/dist/controllers/reading_progress_controller.js +22 -5
  196. package/dist/controllers/reading_progress_controller.js.map +1 -1
  197. package/dist/controllers/relative_time_controller.d.ts +4 -4
  198. package/dist/controllers/relative_time_controller.js +75 -11
  199. package/dist/controllers/relative_time_controller.js.map +1 -1
  200. package/dist/controllers/reset_on_restore_controller.d.ts +3 -3
  201. package/dist/controllers/reset_on_restore_controller.js +6 -0
  202. package/dist/controllers/reset_on_restore_controller.js.map +1 -1
  203. package/dist/controllers/resizable_controller.d.ts +3 -0
  204. package/dist/controllers/resizable_controller.js +55 -22
  205. package/dist/controllers/resizable_controller.js.map +1 -1
  206. package/dist/controllers/roving_controller.d.ts +3 -3
  207. package/dist/controllers/roving_controller.js +10 -4
  208. package/dist/controllers/roving_controller.js.map +1 -1
  209. package/dist/controllers/scroll_area_controller.js +129 -88
  210. package/dist/controllers/scroll_area_controller.js.map +1 -1
  211. package/dist/controllers/scroll_restore_controller.d.ts +3 -3
  212. package/dist/controllers/scroll_restore_controller.js +14 -2
  213. package/dist/controllers/scroll_restore_controller.js.map +1 -1
  214. package/dist/controllers/scroll_visibility_controller.js +93 -60
  215. package/dist/controllers/scroll_visibility_controller.js.map +1 -1
  216. package/dist/controllers/scrollspy_controller.js +11 -5
  217. package/dist/controllers/scrollspy_controller.js.map +1 -1
  218. package/dist/controllers/separator_controller.d.ts +1 -1
  219. package/dist/controllers/separator_controller.js +59 -43
  220. package/dist/controllers/separator_controller.js.map +1 -1
  221. package/dist/controllers/sidebar_controller.d.ts +1 -1
  222. package/dist/controllers/sidebar_controller.js +150 -122
  223. package/dist/controllers/sidebar_controller.js.map +1 -1
  224. package/dist/controllers/skeleton_controller.js +55 -48
  225. package/dist/controllers/skeleton_controller.js.map +1 -1
  226. package/dist/controllers/slider_controller.d.ts +2 -1
  227. package/dist/controllers/slider_controller.js +27 -6
  228. package/dist/controllers/slider_controller.js.map +1 -1
  229. package/dist/controllers/smart_sticky_header_controller.d.ts +1 -1
  230. package/dist/controllers/smart_sticky_header_controller.js +13 -5
  231. package/dist/controllers/smart_sticky_header_controller.js.map +1 -1
  232. package/dist/controllers/sortable_controller.d.ts +4 -4
  233. package/dist/controllers/sortable_controller.js +27 -14
  234. package/dist/controllers/sortable_controller.js.map +1 -1
  235. package/dist/controllers/spinner_controller.js +55 -48
  236. package/dist/controllers/spinner_controller.js.map +1 -1
  237. package/dist/controllers/step_indicator_controller.d.ts +4 -4
  238. package/dist/controllers/step_indicator_controller.js +6 -0
  239. package/dist/controllers/step_indicator_controller.js.map +1 -1
  240. package/dist/controllers/stepper_controller.d.ts +2 -3
  241. package/dist/controllers/stepper_controller.js +6 -0
  242. package/dist/controllers/stepper_controller.js.map +1 -1
  243. package/dist/controllers/stick_to_bottom_controller.d.ts +3 -1
  244. package/dist/controllers/stick_to_bottom_controller.js +19 -8
  245. package/dist/controllers/stick_to_bottom_controller.js.map +1 -1
  246. package/dist/controllers/sticky_observer_controller.js +49 -43
  247. package/dist/controllers/sticky_observer_controller.js.map +1 -1
  248. package/dist/controllers/submit_once_controller.d.ts +2 -1
  249. package/dist/controllers/submit_once_controller.js +145 -85
  250. package/dist/controllers/submit_once_controller.js.map +1 -1
  251. package/dist/controllers/switch_controller.d.ts +7 -4
  252. package/dist/controllers/switch_controller.js +172 -28
  253. package/dist/controllers/switch_controller.js.map +1 -1
  254. package/dist/controllers/tabs_controller.d.ts +7 -4
  255. package/dist/controllers/tabs_controller.js +6 -1
  256. package/dist/controllers/tabs_controller.js.map +1 -1
  257. package/dist/controllers/tags_input_controller.d.ts +4 -3
  258. package/dist/controllers/tags_input_controller.js +157 -28
  259. package/dist/controllers/tags_input_controller.js.map +1 -1
  260. package/dist/controllers/textarea_autosize_controller.d.ts +1 -1
  261. package/dist/controllers/textarea_autosize_controller.js +40 -19
  262. package/dist/controllers/textarea_autosize_controller.js.map +1 -1
  263. package/dist/controllers/theme_controller.d.ts +3 -2
  264. package/dist/controllers/theme_controller.js +10 -4
  265. package/dist/controllers/theme_controller.js.map +1 -1
  266. package/dist/controllers/time_picker_controller.d.ts +38 -5
  267. package/dist/controllers/time_picker_controller.js +192 -54
  268. package/dist/controllers/time_picker_controller.js.map +1 -1
  269. package/dist/controllers/toast_controller.d.ts +4 -5
  270. package/dist/controllers/toast_controller.js +58 -27
  271. package/dist/controllers/toast_controller.js.map +1 -1
  272. package/dist/controllers/toggle_group_controller.d.ts +2 -3
  273. package/dist/controllers/toggle_group_controller.js +158 -56
  274. package/dist/controllers/toggle_group_controller.js.map +1 -1
  275. package/dist/controllers/toolbar_controller.d.ts +8 -6
  276. package/dist/controllers/toolbar_controller.js +150 -21
  277. package/dist/controllers/toolbar_controller.js.map +1 -1
  278. package/dist/controllers/tooltip_controller.d.ts +4 -1
  279. package/dist/controllers/tooltip_controller.js.map +1 -1
  280. package/dist/controllers/transition_controller.js.map +1 -1
  281. package/dist/controllers/tree_view_controller.d.ts +1 -1
  282. package/dist/controllers/tree_view_controller.js +134 -25
  283. package/dist/controllers/tree_view_controller.js.map +1 -1
  284. package/dist/index.d.ts +2 -0
  285. package/dist/index.js +2451 -1312
  286. package/dist/index.js.map +1 -1
  287. package/dist/inspector/cli.d.ts +15 -11
  288. package/dist/inspector/cli.js +16 -3
  289. package/dist/inspector/cli.js.map +1 -1
  290. package/dist/inspector/cli_bin.js +53 -8
  291. package/dist/inspector/cli_bin.js.map +1 -1
  292. package/dist/inspector/examples.json +13 -13
  293. package/dist/inspector/manifest.json +19 -5
  294. package/dist/positioning/index.d.ts +7 -7
  295. package/dist/positioning/index.js +6 -0
  296. package/dist/positioning/index.js.map +1 -1
  297. package/package.json +10 -9
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/logical_scroll.ts","../../src/utils/arrow_step.ts","../../src/utils/field_mirror.ts","../../src/utils/listener_set.ts","../../src/utils/microtask_coalescer.ts","../../src/utils/morph_render_watcher.ts","../../src/utils/move_counter.ts","../../src/utils/number_bounds.ts","../../src/utils/coerce.ts","../../src/utils/number_value.ts","../../src/utils/target_selector.ts","../../src/controllers/time_picker_controller.ts"],"names":[],"mappings":";;AAiBO,SAAS,MAAM,OAAA,EAA2B;AAC/C,EAAA,OAAO,MAAA,CAAO,gBAAA,CAAiB,OAAO,CAAA,CAAE,SAAA,KAAc,KAAA;AACxD;;AC6CO,SAAS,eAAA,CAAgB,KAAa,OAAA,EAA0B;AACrE,EAAA,IAAI,GAAA,KAAQ,YAAA,IAAgB,GAAA,KAAQ,WAAA,EAAa,OAAO,GAAA;AACxD,EAAA,IAAI,CAAC,KAAA,CAAM,OAAO,CAAA,EAAG,OAAO,GAAA;AAC5B,EAAA,OAAO,GAAA,KAAQ,eAAe,WAAA,GAAc,YAAA;AAC9C;AA2BO,SAAS,oBAAA,CACd,KAAA,EACA,KAAA,GAAkC,EAAC,EAC1B;AACT,EAAA,IAAI,CAAC,KAAA,CAAM,GAAA,CAAI,UAAA,CAAW,OAAO,GAAG,OAAO,KAAA;AAC3C,EAAA,OACG,KAAA,CAAM,MAAA,IAAU,CAAC,KAAA,CAAM,QAAA,CAAS,KAAK,CAAA,IACrC,KAAA,CAAM,OAAA,IAAW,CAAC,KAAA,CAAM,QAAA,CAAS,MAAM,KACvC,KAAA,CAA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AAA,CAAK,OAAO,IAAA,GAAO,gBAAA,GACnB,KAAK,MAAA,CAAO,MAAA,GAAS,kBAAA,GACrB,IAAA,CAAK,MAAA,CAAO,MAAA;AAAA,EAEhB;AAAA,EAEA,IAAI,cAAA,GAAyB;AAC3B,IAAA,OAAO,KAAK,QAAA,CAAS,IAAA;AAAA,MACnB,IAAA;AAAA,MACA,WAAA;AAAA,MACA,IAAA,CAAK,cAAA;AAAA,MACL,qBAAA,CAAqB,OAAO,SAAA,CAAU,OAAA;AAAA,MACtC,sBAAqB,gBAAA,CAAiB;AAAA,KACxC;AAAA,EACF;AAAA,EAGA,IAAI,SAAA,GAAoB;AACtB,IAAA,OAAO,KAAK,QAAA,CAAS,IAAA;AAAA,MACnB,IAAA;AAAA,MACA,MAAA;AAAA,MACA,IAAA,CAAK,SAAA;AAAA,MACL,qBAAA,CAAqB,OAAO,IAAA,CAAK,OAAA;AAAA,MACjC,sBAAqB,gBAAA,CAAiB;AAAA,KACxC;AAAA,EACF;AACF;AAGA,SAAS,MAAA,CAAO,OAAe,OAAA,EAAyB;AACtD,EAAA,OAAA,CAAS,KAAA,GAAQ,UAAW,OAAA,IAAW,OAAA;AACzC;AAGA,SAAS,IAAI,KAAA,EAAuB;AAClC,EAAA,OAAO,MAAA,CAAO,KAAK,CAAA,CAAE,QAAA,CAAS,GAAG,GAAG,CAAA;AACtC","file":"time_picker_controller.js","sourcesContent":["/** Normalized scroll position and maximum distance on one logical axis. */\nexport interface LogicalScrollMetrics {\n position: number;\n max: number;\n}\n\n/**\n * Whether horizontal scrolling on `element` follows right-to-left inline flow.\n *\n * Resolved from the **computed** `direction`, so the authoring contract is the\n * usual `dir=\"rtl\"` (or a stylesheet) on the element or any ancestor.\n *\n * Scope: horizontal writing modes. A vertical writing mode (`writing-mode:\n * vertical-rl`) also inverts the horizontal axis, which this check does not\n * model — vertical writing modes are out of scope for the scroll utilities\n * (their consumers describe axes as horizontal/vertical, not inline/block).\n */\nexport function isRtl(element: Element): boolean {\n return window.getComputedStyle(element).direction === \"rtl\";\n}\n\n/**\n * Returns scroll distance from the logical start edge.\n *\n * CSSOM View exposes standards-mode RTL horizontal offsets as `0` at the inline\n * start (right) and increasingly negative values toward the inline end (left).\n * The normalized position is always clamped to `[0, max]`, which also absorbs\n * Safari's elastic overscroll values.\n */\nexport function logicalScrollMetrics(\n element: HTMLElement,\n horizontal: boolean,\n): LogicalScrollMetrics {\n const max = Math.max(\n 0,\n horizontal\n ? element.scrollWidth - element.clientWidth\n : element.scrollHeight - element.clientHeight,\n );\n const raw = horizontal ? element.scrollLeft : element.scrollTop;\n const position = horizontal && isRtl(element) ? -raw : raw;\n return { position: Math.min(max, Math.max(0, position)), max };\n}\n\n/**\n * Converts a logical start/end delta to the physical value accepted by\n * `Element.scrollBy`.\n */\nexport function physicalScrollDelta(\n element: HTMLElement,\n horizontal: boolean,\n logicalDelta: number,\n): number {\n return horizontal && isRtl(element) ? -logicalDelta : logicalDelta;\n}\n","import { isRtl } from \"./logical_scroll\";\n\n/**\n * Turns an arrow key into a **logical** step: `+1` for \"next\", `-1` for\n * \"previous\", `0` when the key names neither.\n *\n * APG defines the horizontal pair as *next / previous* and says a vertical\n * arrangement swaps in Down/Up for the same meaning — so the pair is one axis's\n * spelling of an order, and the order reverses with the writing direction. Only\n * the horizontal pair reverses. Down/Up name an axis the writing direction does\n * not mirror, and returning them unchanged is the point: many controllers fold\n * both pairs into one branch, where swapping the branches under RTL would flip\n * the vertical axis too — a bug that reads as \"the arrows work\" until someone\n * presses Down.\n *\n * **Direction is read from the element the caller passes, which should be the\n * container that lays the items out** — not the focused child. A child may carry\n * its own `dir` (an LTR input inside an RTL form is ordinary authoring), and\n * probing per handler makes two handlers disagree at the boundary between them.\n *\n * This decides direction only. Whether the axis is even active (an\n * `orientation=\"horizontal\"` widget ignoring Down/Up), how far the step lands,\n * and what wrapping does all stay with the caller.\n *\n * **It encodes the list-order convention: `ArrowDown` is *next*.** Widgets that\n * pair the arrows by *value* instead — `ArrowUp` meaning \"more\", as a rating or a\n * slider does — must not use this, or their vertical axis inverts. Reverse the\n * horizontal pair on its own there.\n *\n * @example\n * ```ts\n * const step = logicalArrowStep(event.key, this.element);\n * if (step === 0) return;\n * this.#roving.setActive(rovingMove(current, length, step, \"wrap\"), { focus: true });\n * ```\n */\nexport function logicalArrowStep(key: string, element: Element): 1 | -1 | 0 {\n if (key === \"ArrowDown\") return 1;\n if (key === \"ArrowUp\") return -1;\n if (key !== \"ArrowRight\" && key !== \"ArrowLeft\") return 0;\n const forward = isRtl(element) ? \"ArrowLeft\" : \"ArrowRight\";\n return key === forward ? 1 : -1;\n}\n\n/**\n * Rewrites `key` so an existing LTR-shaped branch keeps working under RTL:\n * `ArrowRight` and `ArrowLeft` trade places, everything else passes through.\n *\n * The alternative — negating a delta — silently breaks handlers whose two\n * horizontal branches are **not mirror images**. A grid that clamps one edge but\n * not the other, or a segmented field guarding `index > 0` on one side and\n * `index < length - 1` on the other, ends up applying the wrong guard to the\n * wrong direction. Swapping the key leaves each branch, guards and all, exactly\n * where its author put it.\n *\n * Same rule as {@link logicalArrowStep} about which element to read: pass the\n * container that lays the items out, not the focused child.\n *\n * @example\n * ```ts\n * switch (logicalArrowKey(event.key, this.element)) {\n * case \"ArrowLeft\": // \"previous\" — whatever direction that is on screen\n * ```\n */\nexport function logicalArrowKey(key: string, element: Element): string {\n if (key !== \"ArrowRight\" && key !== \"ArrowLeft\") return key;\n if (!isRtl(element)) return key;\n return key === \"ArrowRight\" ? \"ArrowLeft\" : \"ArrowRight\";\n}\n\n/** Modifiers a widget may claim on an arrow key, named for the `allow` list. */\nexport type ArrowModifier = \"alt\" | \"ctrl\" | \"meta\" | \"shift\";\n\n/**\n * True when an arrow key arrived carrying a modifier the widget must leave to\n * the browser: return without calling `preventDefault()` and without moving any\n * state.\n *\n * A bare arrow belongs to the widget; a chorded one usually does not.\n * `Alt`/`Meta` plus a horizontal arrow is history back/forward on every desktop\n * browser, and a widget that swallows it makes the shortcut work or not\n * depending on where focus happens to sit — a coin-flip the user cannot see.\n *\n * `allow` is for the combinations APG assigns to a pattern **and the widget\n * actually implements** — today only Combobox's optional `Alt+Down`/`Alt+Up`.\n * Listing one the widget does not implement defeats the point: the chord then\n * runs the plain-arrow branch, which is exactly what this guard exists to stop.\n * Non-arrow keys return `false`, so chorded letters and\n * `Control+Home`/`Control+End` are untouched.\n *\n * @example\n * ```ts\n * if (isReservedArrowChord(event)) return;\n * ```\n */\nexport function isReservedArrowChord(\n event: KeyboardEvent,\n allow: readonly ArrowModifier[] = [],\n): boolean {\n if (!event.key.startsWith(\"Arrow\")) return false;\n return (\n (event.altKey && !allow.includes(\"alt\")) ||\n (event.ctrlKey && !allow.includes(\"ctrl\")) ||\n (event.metaKey && !allow.includes(\"meta\")) ||\n (event.shiftKey && !allow.includes(\"shift\"))\n );\n}\n\n/**\n * True when a press arrived carrying any modifier, for the keys the browser and\n * the OS own outright: return without calling `preventDefault()` and without\n * moving any state.\n *\n * `Control+Home` and `Control+End` jump the document to its ends, and a widget\n * that swallows them makes the shortcut work or not depending on where focus\n * happens to sit. {@link isReservedArrowChord} answers the same question for the\n * arrows, but returns `false` for every other key so that this one can decide.\n *\n * There is no `allow` list here on purpose. APG assigns no modifier chord to\n * `Home`/`End`, so a widget that wanted one would be claiming a combination the\n * pattern never gave it.\n *\n * @example\n * ```ts\n * case \"Home\":\n * case \"End\":\n * if (hasModifierChord(event)) return;\n * ```\n */\nexport function hasModifierChord(event: KeyboardEvent): boolean {\n return event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;\n}\n","/**\n * The hidden form fields a widget keeps in step with the state it owns.\n *\n * A widget whose value lives in ARIA attributes submits nothing on its own, so\n * it mirrors that value into `<input type=\"hidden\">` — one field for a single\n * value, a container of generated fields for a set. The mirror is one-way: the\n * widget's own state stays the source of truth and the field is what the form\n * reads.\n *\n * The write and the report are separate calls because they answer to different\n * rules. A mirror is refreshed on connect, after a morph, and whenever the\n * widget repairs itself — none of which a form should treat as an edit. Only\n * the user's own commit reports one, which is why {@link commitField} is never\n * folded into the writes.\n */\n\n/** How a widget's generated fields identify themselves to the form. */\nexport interface GeneratedFieldOptions {\n /** The `name` every generated input submits under. */\n readonly name: string;\n /** The `form` id, for a widget that sits outside the form it submits to. */\n readonly form?: string;\n}\n\n/**\n * Mirrors one value into a hidden field.\n *\n * @returns Whether the field's value moved.\n *\n * @example\n * ```ts\n * if (writeField(this.fieldTarget, String(value)) && userDriven) {\n * commitField(this.fieldTarget);\n * }\n * ```\n */\nexport function writeField(field: HTMLInputElement, value: string): boolean {\n if (field.value === value) return false;\n field.value = value;\n return true;\n}\n\n/**\n * Mirrors a set of values into `container` as generated hidden fields, in the\n * order given.\n *\n * A container that already submits exactly this set is left untouched, children\n * and all — the mirror is refreshed far more often than it moves (every connect,\n * morph and repair), and a rebuild that changes nothing is still a DOM mutation\n * a consumer's observer and a `:empty` rule can see.\n *\n * @returns Whether the submitted set moved — its values, their order, the\n * `name`, or the `form`.\n */\nexport function writeFields(\n container: HTMLElement,\n values: readonly string[],\n { name, form = \"\" }: GeneratedFieldOptions,\n): boolean {\n const current = [...container.children];\n const submits =\n current.length === values.length &&\n current.every(\n (child, index) =>\n child instanceof HTMLInputElement &&\n child.type === \"hidden\" &&\n child.value === values[index] &&\n child.name === name &&\n (child.getAttribute(\"form\") ?? \"\") === form,\n );\n if (submits) return false;\n\n container.replaceChildren(\n ...values.map((value) => {\n const input = document.createElement(\"input\");\n input.type = \"hidden\";\n input.name = name;\n input.value = value;\n if (form !== \"\") input.setAttribute(\"form\", form);\n return input;\n }),\n );\n return true;\n}\n\n/**\n * Reports a committed value from `target` the way a native form control does:\n * one bubbling, non-cancelable `change`.\n *\n * Call it only for a move the user made. Form-level behaviors listen for this —\n * validation re-checks, auto-submit — and a mirror refreshed by a morph or a\n * repair is not something the user submitted.\n *\n * `target` is the element that carries the value: the hidden field for a single\n * mirrored value, the container for a generated set (whose own inputs are\n * replaced on every write), or a widget's own native control where that is what\n * the form reads.\n */\nexport function commitField(target: HTMLElement): void {\n target.dispatchEvent(new Event(\"change\", { bubbles: true }));\n}\n","/**\n * Owns every listener a controller attaches for one connected lifetime and\n * releases them together, so an event name is spelled once and the release\n * cannot drift from the registration.\n *\n * Detaching by hand repeats three things at the release site — the type, the\n * handler reference and the capture flag — and any one of them drifting leaves\n * a listener alive on an element the controller no longer drives. Aborting the\n * signal a registration was created with releases it whatever it was made of,\n * so the release site names nothing.\n *\n * One set per lifetime, held as a field and never rebuilt. {@link\n * ListenerSet.dispose} is the only thing that closes a generation, and it opens\n * the next one in the same step, so the lifecycle hooks can call `add` and\n * `dispose` in any order any number of times, and no `add` ever meets an\n * already aborted signal — a DOM that registers a listener on such a signal\n * would keep it forever. Rebuilding the set instead would leak:\n * `addEventListener` matches an existing registration on target, type, callback\n * and capture alone, so re-adding the same handler while the first registration\n * is live is discarded, and that live registration keeps the signal it was\n * attached with — a set built by a second `connect()` can never release what it\n * appears to own.\n *\n * Scope is the registration only. Timers, observers, leases and the order they\n * are unwound in stay with the controller, which places `dispose()` in its\n * cleanup sequence. A receiver that changes at runtime (a\n * swapped target) is rebound by calling `dispose()` and then `add()` again from\n * the rebind, not by a second set.\n *\n * The set must own every registration of a tuple it holds: a listener the same\n * target already carries for the same type, callback and capture flag keeps the\n * right to remove it, and this set's `add` for that tuple is discarded. A\n * subscription shared between instances behind a participant count, or one that\n * lives for less than the connection, keeps its own pair of calls.\n *\n * @example\n * ```ts\n * readonly #listeners = new ListenerSet();\n *\n * connect(): void {\n * this.#listeners.add(this.element, \"submit\", this.#onNativeSubmit, { capture: true });\n * this.#listeners.add(this.element, \"turbo:submit-start\", this.#onSubmitStart);\n * this.#listeners.add(this.element, \"turbo:submit-end\", this.#onSubmitEnd);\n * }\n *\n * disconnect(): void {\n * this.#listeners.dispose();\n * }\n * ```\n */\nexport class ListenerSet {\n /** The generation every `add` joins until the next `dispose()`. */\n #abort = new AbortController();\n\n /**\n * Attaches `handler` to the open generation, exactly as the caller spelled it.\n *\n * The set supplies the signal, so `options` carries everything else the DOM\n * accepts — `capture` included, which has to match at release time and no\n * longer has a second place to drift from.\n */\n add(\n target: EventTarget,\n type: string,\n handler: EventListener,\n options?: Omit<AddEventListenerOptions, \"signal\">,\n ): void {\n target.addEventListener(type, handler, { ...options, signal: this.#abort.signal });\n }\n\n /**\n * Releases every listener of the open generation, synchronously, and opens the\n * next one. Idempotent, and safe before anything has been added.\n */\n dispose(): void {\n this.#abort.abort();\n this.#abort = new AbortController();\n }\n}\n","/**\n * Collapses many Stimulus lifecycle callbacks from one DOM mutation into a\n * single pass.\n *\n * Stimulus fires `<name>TargetConnected` / `Disconnected` once per element and\n * `<name>ValueChanged` once per changed attribute. Replacing a list of N options\n * or morphing several render Values therefore delivers N callbacks — but the\n * useful unit of work is \"reconcile against the resulting declarative input\",\n * once, after the batch has settled. Every controller with reconcilable targets\n * or render Values needs the same shape: a `queued` flag plus `queueMicrotask`.\n *\n * **A microtask is the right horizon, and the reason is specific.** Stimulus\n * drives these callbacks from a `MutationObserver`, whose own callback already\n * runs as a microtask with the whole batch in hand; scheduling one more lands\n * after the last sibling callback of that batch and still before paint or any\n * event handler. A timer would be later than it needs to be, and reconciling\n * synchronously would run once per element against a half-applied DOM.\n *\n * **The two guards are not the same guard.** Scheduling is refused before the\n * controller connects, and running is refused after it disconnects:\n *\n * - **Before `connect()`** — Stimulus delivers initial target and Value callbacks\n * ahead of `connect()`. Reconciling there would compute output against a\n * controller whose own state has not been initialised, and `connect()` is\n * about to do a full pass anyway.\n * - **After `disconnect()`** — Stimulus fires a callback for **every** target\n * during teardown, and a microtask queued just before it would otherwise run\n * against a detached tree. {@link MicrotaskCoalescer.cancel} exists for the\n * teardown path to drop the pending pass outright.\n *\n * Both guards are part of one contract here rather than something each consumer\n * has to remember separately.\n *\n * Scope is the scheduling only. *What* to reconcile — keep the surviving active\n * option, fall back to the next / previous / first visible one, rebuild derived\n * chips or hidden fields — stays in the controller, because no two consumers\n * answer it the same way.\n *\n * @example\n * ```ts\n * readonly #reconcile = new MicrotaskCoalescer(() => this.#reconcileOptions());\n *\n * connect() { this.#reconcile.activate(); }\n * disconnect() { this.#reconcile.cancel(); }\n *\n * optionTargetConnected() { this.#reconcile.schedule(); }\n * optionTargetDisconnected() { this.#reconcile.schedule(); }\n * ```\n */\nexport class MicrotaskCoalescer {\n readonly #run: () => void;\n #queued = false;\n #active = false;\n #generation = 0;\n\n /** @param run - the single reconciliation pass, invoked at most once per batch. */\n constructor(run: () => void) {\n this.#run = run;\n }\n\n /** Opens the window in which {@link schedule} is honoured; call from `connect()`. */\n activate(): void {\n this.#active = true;\n }\n\n /** Closes the window and drops any pending pass; call from `disconnect()`. */\n cancel(): void {\n this.#active = false;\n this.#queued = false;\n this.#generation += 1;\n }\n\n /** Requests one pass after the batch settles. Idempotent; inert outside the window. */\n schedule(): void {\n if (!this.#active || this.#queued) return;\n this.#queued = true;\n const generation = this.#generation;\n queueMicrotask(() => {\n // A cancelled callback must not consume a pass queued after reconnect.\n if (generation !== this.#generation || !this.#queued || !this.#active) return;\n this.#queued = false;\n this.#run();\n });\n }\n}\n","import { ListenerSet } from \"./listener_set\";\nimport { MicrotaskCoalescer } from \"./microtask_coalescer\";\n\n/**\n * Coalesces retained-element morphs and explicit lifecycle requests into one pass.\n *\n * Observe the controller's element after its initial state is settled. Morphs on\n * that element and bubbling morphs on its descendants share the same microtask\n * as {@link schedule}. The callback repairs derived output; the controller owns\n * any logical transition reporting. {@link disconnect} releases the listener and\n * cancels pending work, including work from an earlier connected lifetime.\n */\nexport class MorphRenderWatcher {\n readonly #listeners = new ListenerSet();\n readonly #pass: MicrotaskCoalescer;\n #element: Element | null = null;\n readonly #onMorph = (): void => this.#pass.schedule();\n\n /** @param run - the single pass that repairs the settled controller's output. */\n constructor(run: () => void) {\n this.#pass = new MicrotaskCoalescer(run);\n }\n\n /** Opens observation; observing the same element again preserves queued work. */\n observe(element: Element): void {\n if (this.#element === element) return;\n this.disconnect();\n this.#element = element;\n this.#pass.activate();\n this.#listeners.add(element, \"turbo:morph-element\", this.#onMorph);\n }\n\n /** Requests one pass; requests outside an observed lifetime are ignored. */\n schedule(): void {\n this.#pass.schedule();\n }\n\n /** Releases observation and pending work synchronously; safe to repeat. */\n disconnect(): void {\n this.#listeners.dispose();\n this.#pass.cancel();\n this.#element = null;\n }\n}\n","/**\n * Identifies the latest reported state transition of one owner.\n *\n * Record a transition after its state is written and before invoking external\n * code. Check the returned token before each later report: a synchronous\n * transition made by a listener supersedes reports that have not been sent.\n * Reading state or committing an unchanged state must not advance the counter.\n * Reports stay in the caller so their ordering remains explicit.\n */\nexport class MoveCounter {\n #sequence = 0;\n\n /** Records a state transition and returns its report token. */\n record(): number {\n this.#sequence += 1;\n return this.#sequence;\n }\n\n /** Whether no later state transition has superseded this report token. */\n isLatest(token: number): boolean {\n return token === this.#sequence;\n }\n}\n","import { MAX_TIMER_DELAY_MS } from \"./timer_bounds\";\n\n/** Semantic constraints on an already decoded number, independent of the DOM. */\nexport interface NumberBounds {\n /** Finite numbers are required, including when this field is omitted. */\n readonly finite?: true;\n /** Inclusive lower endpoint. */\n readonly min?: number;\n /** Inclusive upper endpoint. */\n readonly max?: number;\n /** Exclusive lower endpoint. */\n readonly exclusiveMin?: number;\n /** Require a number without a fractional part. */\n readonly integer?: boolean;\n /** Exact decoded numbers accepted by a discrete contract. */\n readonly allowedValues?: readonly number[];\n /** JSON-safe exceptions to finite-number checking for unbounded endpoints. */\n readonly allowInfinity?: \"negative\" | \"positive\" | \"both\";\n}\n\n/** One constraint for each Number Value, including shorthand declarations. */\nexport type NumberValueConstraints<Values> = {\n readonly [Key in keyof Values as Values[Key] extends\n | NumberConstructor\n | { type: NumberConstructor }\n ? Key\n : never]: NumberBounds;\n};\n\n/** Reusable semantic domains; fractional inputs remain fractional unless excluded. */\nexport const NUMBER_BOUNDS = {\n finite: { finite: true },\n nonNegative: { finite: true, min: 0 },\n positive: { finite: true, exclusiveMin: 0 },\n nonNegativeInteger: { finite: true, min: 0, integer: true },\n positiveInteger: { finite: true, exclusiveMin: 0, integer: true },\n lowerBound: { finite: true, allowInfinity: \"negative\" },\n upperBound: { finite: true, allowInfinity: \"positive\" },\n timer: { finite: true, min: 0, max: MAX_TIMER_DELAY_MS },\n positiveTimer: { finite: true, exclusiveMin: 0, max: MAX_TIMER_DELAY_MS },\n} as const satisfies Record<string, NumberBounds>;\n\n/**\n * Checks all declared bounds without rounding, clamping, or coercing the input.\n * Infinity exceptions relax only finite checking; every other bound still applies.\n */\nexport function matchesNumberBounds(value: number, bounds: NumberBounds): boolean {\n if (!Number.isFinite(value)) {\n const direction = value === Infinity ? \"positive\" : value === -Infinity ? \"negative\" : null;\n if (direction === null) return false;\n if (bounds.allowInfinity !== \"both\" && bounds.allowInfinity !== direction) return false;\n }\n if (bounds.min !== undefined && value < bounds.min) return false;\n if (bounds.max !== undefined && value > bounds.max) return false;\n if (bounds.exclusiveMin !== undefined && value <= bounds.exclusiveMin) return false;\n if (bounds.integer && !Number.isInteger(value)) return false;\n if (bounds.allowedValues !== undefined && !bounds.allowedValues.includes(value)) return false;\n return true;\n}\n\n/** Decodes a Number Value literal; action params use their own JSON decoder. */\nexport function decodeNumberValue(raw: string): number {\n return Number(raw.replace(/_/g, \"\"));\n}\n","/**\n * Numeric coercion for controllers that accept a number through a Value, an action\n * param, or an event detail.\n *\n * Stimulus decodes action params as JSON when possible and leaves other text\n * untouched. CustomEvent detail can also supply a number or numeric string.\n * The reader accepts those two types while rejecting blank and non-finite input.\n */\n\nimport { matchesNumberBounds, type NumberBounds } from \"./number_bounds\";\n\n/**\n * Reads a finite number or nonblank numeric string; other input returns `null`.\n * Blank strings cannot silently reset a value to zero.\n */\nexport function toFiniteNumber(raw: unknown): number | null {\n if (typeof raw !== \"number\" && typeof raw !== \"string\") return null;\n if (typeof raw === \"string\" && raw.trim().length === 0) return null;\n const value = Number(raw);\n return Number.isFinite(value) ? value : null;\n}\n\n/**\n * Returns an accepted decoded Number Value or the caller's fallback unchanged.\n * The caller owns the fallback contract; this reader does not parse or write a Value.\n */\nexport function readNumber(raw: number, fallback: number, bounds: NumberBounds): number {\n return matchesNumberBounds(raw, bounds) ? raw : fallback;\n}\n","import { readNumber } from \"./coerce\";\nimport { matchesNumberBounds, type NumberBounds } from \"./number_bounds\";\n\n/** The instance identity carried by a Number Value read. */\nexport interface NumberValueOwner {\n readonly identifier: string;\n readonly element: Element;\n}\n\n/** Reads current declarations at the point of use without rewriting their attributes. */\nexport class NumberValueReader {\n /** The last rejected literal per Value; no history grows for an unchanged instance. */\n readonly #lastRejected = new Map<string, string>();\n\n /** Resolves the declared number using its own fallback and shared class contract. */\n read(\n owner: NumberValueOwner,\n name: string,\n raw: number,\n fallback: number,\n bounds: NumberBounds,\n ): number {\n const resolved = readNumber(raw, fallback, bounds);\n if (matchesNumberBounds(raw, bounds)) {\n this.#lastRejected.delete(name);\n return resolved;\n }\n const attribute = `data-${owner.identifier}-${name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}-value`;\n const literal = owner.element.getAttribute(attribute);\n if (literal === null) {\n this.#lastRejected.delete(name);\n return resolved;\n }\n if (this.#lastRejected.get(name) !== literal) {\n this.#lastRejected.set(name, literal);\n console.warn(\n `Stimeo UI: \"${owner.identifier}\" has an invalid number Value \"${name}\" declaration ${JSON.stringify(literal)}; using ${fallback}.`,\n );\n }\n return resolved;\n }\n}\n","/**\n * The attribute selector for one declared target, in a controller's own namespace.\n *\n * Stimulus reads `data-<identifier>-target` as a **space-separated token list**, so a\n * single element can carry several target names at once. Matching the attribute value\n * whole would reach only the elements that declare exactly one name, which is why the\n * name is paired with `~=`.\n *\n * `identifier` is the name the controller is registered under, so the selector reaches\n * the markup that registration renders rather than one fixed spelling.\n */\nexport function targetSelector(identifier: string, name: string): string {\n return `[data-${identifier}-target~=\"${name}\"]`;\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport { isReservedArrowChord, logicalArrowKey } from \"../utils/arrow_step\";\nimport { commitField, writeField } from \"../utils/field_mirror\";\nimport { MorphRenderWatcher } from \"../utils/morph_render_watcher\";\nimport { MoveCounter } from \"../utils/move_counter\";\nimport { NUMBER_BOUNDS, type NumberValueConstraints } from \"../utils/number_bounds\";\nimport { NumberValueReader } from \"../utils/number_value\";\nimport { targetSelector } from \"../utils/target_selector\";\n\n/** A time segment kind, as declared by `data-segment` on each spinbutton. */\ntype SegmentKind = \"hour\" | \"minute\" | \"second\" | \"meridiem\";\n\n/** Canonical controller state. Hours are always stored on the 24-hour clock. */\ninterface TimeState {\n hour: number;\n minute: number;\n second: number;\n}\n\n/** Meridiem encoding exposed through the meridiem spinbutton. */\nconst AM = 0;\nconst PM = 1;\nconst SECONDS_PER_MINUTE = 60;\nconst SECONDS_PER_HOUR = 60 * SECONDS_PER_MINUTE;\nconst SECONDS_PER_DAY = 24 * SECONDS_PER_HOUR;\n\n/** Modifier keys that reserve document/browser shortcuts outside the widget. */\nconst hasModifier = (event: KeyboardEvent): boolean =>\n event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;\n\n/**\n * Headless, accessible **time picker** behavior. Each segment (hour, minute,\n * optional second, optional AM/PM) is an APG **Spinbutton**; the controller\n * composes them into an `HH:MM[:SS]` value mirrored to an optional hidden field.\n *\n * Markup contract (identifier: `stimeo--time-picker`):\n * <div data-controller=\"stimeo--time-picker\"\n * data-stimeo--time-picker-hour-cycle-value=\"24\"\n * role=\"group\" aria-label=\"Time\">\n * <span role=\"spinbutton\" aria-label=\"Hours\" tabindex=\"0\"\n * aria-valuenow=\"9\" aria-valuemin=\"0\" aria-valuemax=\"23\" aria-valuetext=\"09\"\n * data-segment=\"hour\" data-stimeo--time-picker-target=\"segment\"\n * data-action=\"keydown->stimeo--time-picker#onKeydown\">09</span>\n * <span aria-hidden=\"true\">:</span>\n * <span role=\"spinbutton\" aria-label=\"Minutes\" tabindex=\"0\"\n * data-segment=\"minute\" data-stimeo--time-picker-target=\"segment\"\n * data-action=\"keydown->stimeo--time-picker#onKeydown\">30</span>\n * <input type=\"hidden\" data-stimeo--time-picker-target=\"field\" />\n * </div>\n *\n * `reconcile` dispatches `{ value: string }`.\n *\n * All published state is settled before its reports. A synchronous listener\n * that confirms another value leaves that newer confirmation to report itself;\n * reports still pending for the replaced value are not sent. A read-only listener\n * or a confirmation that moves no published value leaves pending reports intact.\n * An event already being dispatched still reaches its remaining listeners.\n *\n * @remarks\n * `segment` targets declare the spinbuttons; the optional `field` target receives\n * the composed form value. `hourCycle` selects 12- or 24-hour presentation\n * (default 24), `step` is the positive integer minute step (default 1), `seconds`\n * includes seconds in the composed value (default false), and `wrap` controls\n * whether stepping crosses segment bounds (default true). The author decides\n * which optional segment targets are present; `seconds` does not create or hide\n * markup.\n *\n * Every segment is its own Tab stop (multi-tabstop, *not* roving), while\n * `ArrowLeft`/`ArrowRight` provide auxiliary movement. `ArrowUp`/`ArrowDown`\n * step the focused spinbutton; wrapping seconds or minutes carries into the next\n * unit, and 12-hour stepping crosses AM/PM at noon and midnight. Typing digits\n * enters a value directly and advances after completion. The digit buffer is\n * discarded on another action, a segment target change, a page write taken in\n * from a segment, or focus departure.\n *\n * A user action that changes the composed value dispatches exactly one bubbling\n * native `change` from the field, when present, and one\n * `stimeo--time-picker:change` with `{ value: string }`. Retained\n * `aria-valuenow`/`data-segment` changes, runtime targets, and\n * `hourCycle`/`seconds` Value changes are reconciled for Turbo morph\n * compatibility; when such a pass moves the composed value — dropping a `second`\n * segment, say — it reports `stimeo--time-picker:reconcile` with the same detail\n * instead, so a consumer can tell its own edit from this controller's repair.\n * Initial connection reports neither.\n */\nexport class TimePickerController extends Controller<HTMLElement> {\n /** Numeric read boundaries share one reader for this controller instance. */\n readonly #numbers = new NumberValueReader();\n\n readonly #moves = new MoveCounter();\n #move = 0;\n\n static override targets = [\"segment\", \"field\"];\n static override values = {\n hourCycle: { type: Number, default: 24 },\n step: { type: Number, default: 1 },\n seconds: { type: Boolean, default: false },\n wrap: { type: Boolean, default: true },\n };\n\n static valueConstraints = {\n hourCycle: { finite: true, allowedValues: [12, 24] },\n step: NUMBER_BOUNDS.positive,\n } satisfies NumberValueConstraints<typeof TimePickerController.values>;\n static actions = [\"onKeydown\"] as const;\n static events = [\"change\", \"reconcile\"] as const;\n\n declare readonly segmentTargets: HTMLElement[];\n declare readonly fieldTarget: HTMLInputElement;\n declare readonly hasFieldTarget: boolean;\n declare hourCycleValue: number;\n declare stepValue: number;\n declare secondsValue: boolean;\n declare wrapValue: boolean;\n\n /**\n * Collapses target, Value, and retained-attribute morphs into one render that\n * dispatches no `change`.\n */\n readonly #reconcile = new MorphRenderWatcher(() => this.#reconcileDom());\n /** Canonical state; the displayed hour and meridiem are derived from this value. */\n #state: TimeState = { hour: 0, minute: 0, second: 0 };\n /** Direct-entry digit buffer and the segment it belongs to. */\n #typeBuffer = \"\";\n #typeSegment: SegmentKind | null = null;\n /** Last composed value, used to suppress duplicate user notifications. */\n #lastValue = \"\";\n #observer: MutationObserver | null = null;\n #connected = false;\n /**\n * Whether the segments changed since state was last adopted from them. The next\n * adoption also discards the direct-entry buffer, and runs before any key reads it.\n */\n #domDirty = false;\n\n /** Seeds state from the DOM, renders canonical ARIA, and starts morph observation. */\n override connect(): void {\n this.#connected = true;\n this.#reconcile.observe(this.element);\n this.element.addEventListener(\"focusout\", this.#onFocusOut);\n this.#domDirty = false;\n this.#adoptDomState();\n this.#render();\n this.#observeMutations();\n }\n\n /** Releases the observer, listener, queued reconciliation, and transient input state. */\n override disconnect(): void {\n this.#connected = false;\n this.#reconcile.disconnect();\n this.element.removeEventListener(\"focusout\", this.#onFocusOut);\n this.#observer?.disconnect();\n this.#observer = null;\n this.#domDirty = false;\n this.#clearTypeBuffer();\n this.#lastValue = \"\";\n }\n\n /** Re-renders the canonical instant when 12/24-hour presentation changes at runtime. */\n hourCycleValueChanged(): void {\n this.#reconcile.schedule();\n }\n\n /** Recomposes the optional seconds portion after a runtime Value change. */\n secondsValueChanged(): void {\n this.#reconcile.schedule();\n }\n\n /** Adopts a segment inserted or replaced by a Turbo morph. */\n segmentTargetConnected(): void {\n this.#domDirty = true;\n this.#reconcile.schedule();\n }\n\n /** Rebuilds state after a segment leaves the retained controller element. */\n segmentTargetDisconnected(): void {\n this.#domDirty = true;\n this.#reconcile.schedule();\n }\n\n /** Reflects the current composed value into a field added or replaced at runtime. */\n fieldTargetConnected(): void {\n this.#reconcile.schedule();\n }\n\n /** Reconciles silently when the optional field leaves at runtime. */\n fieldTargetDisconnected(): void {\n this.#reconcile.schedule();\n }\n\n /** Handles APG stepping, inter-segment focus moves, jumps, and direct entry. */\n onKeydown(event: KeyboardEvent): void {\n if (isReservedArrowChord(event)) return;\n const segment = (event.target as HTMLElement | null)?.closest<HTMLElement>(\n targetSelector(this.identifier, \"segment\"),\n );\n if (!segment || !this.segmentTargets.includes(segment)) return;\n const kind = this.#kindOf(segment);\n if (!kind) return;\n\n const key = logicalArrowKey(event.key, this.element);\n if ((key === \"Home\" || key === \"End\") && hasModifier(event)) return;\n\n // Taking in the page's writes consumes the records the observer would have\n // answered, so the pass it would have queued is queued here. A key that renders\n // leaves that pass nothing to report.\n if (this.#adoptPendingDom()) this.#reconcile.schedule();\n switch (key) {\n case \"ArrowUp\":\n event.preventDefault();\n this.#step(kind, this.#delta(kind));\n break;\n case \"ArrowDown\":\n event.preventDefault();\n this.#step(kind, -this.#delta(kind));\n break;\n case \"ArrowLeft\":\n event.preventDefault();\n this.#focusSibling(segment, -1);\n break;\n case \"ArrowRight\":\n event.preventDefault();\n this.#focusSibling(segment, 1);\n break;\n case \"Home\":\n event.preventDefault();\n this.#setDisplayed(kind, this.#bounds(kind).min);\n this.#commitRender();\n break;\n case \"End\":\n event.preventDefault();\n this.#setDisplayed(kind, this.#bounds(kind).max);\n this.#commitRender();\n break;\n default:\n if (kind !== \"meridiem\" && /^[0-9]$/.test(event.key) && !hasModifier(event)) {\n event.preventDefault();\n this.#typeDigit(segment, kind, event.key);\n return;\n }\n return;\n }\n this.#clearTypeBuffer();\n }\n\n /** Clears direct-entry state when Tab, Shift+Tab, or pointer focus leaves a segment. */\n readonly #onFocusOut = (event: FocusEvent): void => {\n const segment = (event.target as HTMLElement | null)?.closest<HTMLElement>(\n targetSelector(this.identifier, \"segment\"),\n );\n if (!segment || !this.segmentTargets.includes(segment)) return;\n this.#clearTypeBuffer();\n };\n\n /** Uses the normalized positive-integer minute step; other segments step by one. */\n #delta(kind: SegmentKind): number {\n if (kind !== \"minute\") return 1;\n const step = Math.trunc(this.#safeStep);\n return step > 0 ? step : 1;\n }\n\n /** Mutates one complete action and then renders/notifies its final value once. */\n #step(kind: SegmentKind, delta: number): void {\n if (kind === \"meridiem\" && this.wrapValue) {\n this.#state.hour = modulo(this.#state.hour + 12, 24);\n } else if (this.wrapValue) {\n const scale = kind === \"hour\" ? SECONDS_PER_HOUR : kind === \"minute\" ? SECONDS_PER_MINUTE : 1;\n this.#setFromSeconds(this.#secondsOfDay + delta * scale);\n } else if (kind === \"hour\") {\n // The displayed hour is a projection of the canonical one, so stepping it\n // moves the instant: 11 → 12 crosses noon or midnight even here, where the\n // step never leaves the segment's own bounds. Clamping on the canonical\n // clock is what \"no wrapping\" means — the day is not crossed.\n this.#state.hour = Math.min(23, Math.max(0, this.#state.hour + delta));\n } else {\n const { min, max } = this.#bounds(kind);\n const displayed = this.#displayValue(kind);\n this.#setDisplayed(kind, Math.min(max, Math.max(min, displayed + delta)));\n }\n this.#commitRender();\n }\n\n /** Accumulates a typed digit, rendering once and advancing after completion. */\n #typeDigit(segment: HTMLElement, kind: Exclude<SegmentKind, \"meridiem\">, digit: string): void {\n if (this.#typeSegment !== kind) this.#typeBuffer = \"\";\n this.#typeSegment = kind;\n\n const { max } = this.#bounds(kind);\n const candidate = Number(`${this.#typeBuffer}${digit}`);\n this.#typeBuffer = candidate <= max ? `${this.#typeBuffer}${digit}` : digit;\n\n this.#setDisplayed(kind, Number(this.#typeBuffer));\n this.#commitRender();\n\n if (this.#typeBuffer.length >= 2 || Number(this.#typeBuffer) * 10 > max) {\n this.#clearTypeBuffer();\n this.#focusSibling(segment, 1);\n }\n }\n\n /** Moves focus to the previous/next valid segment, if one exists. */\n #focusSibling(segment: HTMLElement, direction: 1 | -1): void {\n const segments = this.segmentTargets.filter((candidate) => this.#kindOf(candidate) !== null);\n const index = segments.indexOf(segment);\n segments[index + direction]?.focus();\n }\n\n /** Clears the direct-entry buffer and its owning segment together. */\n #clearTypeBuffer(): void {\n this.#typeBuffer = \"\";\n this.#typeSegment = null;\n }\n\n /**\n * Adopts authored segment state before a synchronous user operation consumes it,\n * and reports whether it did.\n */\n #adoptPendingDom(): boolean {\n const pending = this.#observer?.takeRecords() ?? [];\n if (pending.some(({ target }) => this.segmentTargets.includes(target as HTMLElement))) {\n this.#domDirty = true;\n }\n if (!this.#domDirty) return false;\n this.#domDirty = false;\n this.#clearTypeBuffer();\n this.#adoptDomState();\n return true;\n }\n\n /** Reconciles one coalesced target, Value, or retained-attribute mutation batch. */\n #reconcileDom(): void {\n this.#adoptPendingDom();\n this.#render();\n }\n\n /** Rebuilds canonical state from the targets; an absent hour represents midnight. */\n #adoptDomState(): void {\n let displayedHour = 0;\n let meridiem = AM;\n let minute = 0;\n let second = 0;\n\n for (const segment of this.segmentTargets) {\n const kind = this.#kindOf(segment);\n if (!kind) continue;\n const value = this.#authoredValue(segment, kind);\n if (kind === \"hour\") displayedHour = value;\n else if (kind === \"minute\") minute = value;\n else if (kind === \"second\") second = value;\n else meridiem = value;\n }\n\n this.#state = {\n hour:\n this.#safeHourCycle === 12\n ? (displayedHour % 12) + (meridiem === PM ? 12 : 0)\n : displayedHour,\n minute,\n second,\n };\n }\n\n /** Reads and integer-clamps one authored `aria-valuenow`. */\n #authoredValue(segment: HTMLElement, kind: SegmentKind): number {\n const raw = Number(segment.getAttribute(\"aria-valuenow\"));\n const { min, max } = this.#bounds(kind);\n if (!Number.isFinite(raw)) return min;\n return Math.min(max, Math.max(min, Math.trunc(raw)));\n }\n\n /** Writes a displayed segment value back into canonical state without rendering. */\n #setDisplayed(kind: SegmentKind, raw: number): void {\n const { min, max } = this.#bounds(kind);\n const value = Math.min(max, Math.max(min, Math.trunc(raw)));\n if (kind === \"hour\") {\n this.#state.hour =\n this.#safeHourCycle === 12 ? (value % 12) + (this.#state.hour >= 12 ? 12 : 0) : value;\n } else if (kind === \"minute\" || kind === \"second\") {\n this.#state[kind] = value;\n } else {\n this.#state.hour = (this.#state.hour % 12) + (value === PM ? 12 : 0);\n }\n }\n\n /** Converts seconds with day wrapping into the canonical three-unit state. */\n #setFromSeconds(raw: number): void {\n const seconds = modulo(raw, SECONDS_PER_DAY);\n this.#state.hour = Math.floor(seconds / SECONDS_PER_HOUR);\n this.#state.minute = Math.floor((seconds % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE);\n this.#state.second = seconds % SECONDS_PER_MINUTE;\n }\n\n /** Reflects canonical state to every segment without dispatching user events. */\n #renderSegments(): void {\n this.#withoutObservation(() => {\n for (const segment of this.segmentTargets) this.#renderSegment(segment);\n });\n }\n\n /**\n * Reflects canonical state during connection or DOM reconciliation.\n *\n * No user edit reaches here, so `change` never fires from this path. A pass\n * that moves the committed value reports `reconcile` instead.\n *\n * @stimeoRenderRoot\n */\n #render(): void {\n this.#renderSegments();\n const value = this.#composedValue;\n const previous = this.#lastValue;\n this.#writeField(value);\n this.#lastValue = value;\n // A reconciliation can move the committed value — dropping a `second`\n // segment recomposes without it, and a `seconds` Value change adds or\n // removes the unit. That is this controller's decision rather than the\n // user's, so it is reported apart from `change`. The empty baseline is the\n // initial connection, which reports nothing.\n if (previous !== \"\" && value !== previous) {\n this.#move = this.#moves.record();\n this.dispatch(\"reconcile\", { detail: { value } });\n }\n }\n\n /** Reflects one completed user action and dispatches its final change exactly once. */\n #commitRender(): void {\n this.#renderSegments();\n const value = this.#composedValue;\n const changed = value !== this.#lastValue;\n this.#lastValue = value;\n if (changed) this.#move = this.#moves.record();\n const move = this.#move;\n if (this.#writeField(value)) commitField(this.fieldTarget);\n if (!this.#moves.isLatest(move)) return;\n if (changed) this.dispatch(\"change\", { detail: { value } });\n }\n\n /** Reflects one segment's value and controller-owned ARIA bounds/text. */\n #renderSegment(segment: HTMLElement): void {\n const kind = this.#kindOf(segment);\n if (!kind) return;\n const value = this.#displayValue(kind);\n const text = kind === \"meridiem\" ? (value === PM ? \"PM\" : \"AM\") : pad(value);\n const { min, max } = this.#bounds(kind);\n\n segment.setAttribute(\"aria-valuenow\", String(value));\n segment.setAttribute(\"aria-valuetext\", text);\n segment.setAttribute(\"aria-valuemin\", String(min));\n segment.setAttribute(\"aria-valuemax\", String(max));\n segment.textContent = text;\n }\n\n /** Writes a composed value to the optional form field and reports whether it changed. */\n #writeField(value: string): boolean {\n return this.hasFieldTarget && writeField(this.fieldTarget, value);\n }\n\n /** The canonical form value composed as `HH:MM[:SS]`. */\n get #composedValue(): string {\n const parts = [pad(this.#state.hour), pad(this.#state.minute)];\n if (this.secondsValue) parts.push(pad(this.#state.second));\n return parts.join(\":\");\n }\n\n /** Returns a canonical unit in the presentation form exposed by its segment. */\n #displayValue(kind: SegmentKind): number {\n if (kind === \"hour\") {\n return this.#safeHourCycle === 12 ? this.#state.hour % 12 || 12 : this.#state.hour;\n }\n if (kind === \"meridiem\") return this.#state.hour >= 12 ? PM : AM;\n return this.#state[kind];\n }\n\n /** The inclusive controller-owned bounds for a segment kind. */\n #bounds(kind: SegmentKind): { min: number; max: number } {\n switch (kind) {\n case \"hour\":\n return this.#safeHourCycle === 12 ? { min: 1, max: 12 } : { min: 0, max: 23 };\n case \"minute\":\n case \"second\":\n return { min: 0, max: 59 };\n case \"meridiem\":\n return { min: AM, max: PM };\n }\n }\n\n /** Watches retained segment state while excluding this controller's own reflections. */\n #observeMutations(): void {\n const observer = new MutationObserver((records) => {\n const changed = records.some(\n ({ target }) => target instanceof HTMLElement && this.segmentTargets.includes(target),\n );\n if (!changed) return;\n this.#domDirty = true;\n this.#reconcile.schedule();\n });\n this.#observer = observer;\n this.#observeWith(observer);\n }\n\n /** Registers retained attribute observation on the controller subtree. */\n #observeWith(observer: MutationObserver): void {\n observer.observe(this.element, {\n subtree: true,\n attributes: true,\n attributeFilter: [\"aria-valuenow\", \"data-segment\"],\n });\n }\n\n /** Temporarily pauses observation so derived ARIA writes cannot become DOM input. */\n #withoutObservation(run: () => void): void {\n const observer = this.#observer;\n observer?.disconnect();\n try {\n run();\n } finally {\n if (observer && this.#connected) this.#observeWith(observer);\n }\n }\n\n /** Reads a segment's declared kind, or null when absent/invalid. */\n #kindOf(segment: HTMLElement): SegmentKind | null {\n const kind = segment.getAttribute(\"data-segment\");\n if (kind === \"hour\" || kind === \"minute\" || kind === \"second\" || kind === \"meridiem\") {\n return kind;\n }\n return null;\n }\n\n /** Canonical state as seconds since the start of its nominal day. */\n get #secondsOfDay(): number {\n return (\n this.#state.hour * SECONDS_PER_HOUR +\n this.#state.minute * SECONDS_PER_MINUTE +\n this.#state.second\n );\n }\n /** Current `hourCycle` declaration resolved against its numeric contract. */\n get #safeHourCycle(): number {\n return this.#numbers.read(\n this,\n \"hourCycle\",\n this.hourCycleValue,\n TimePickerController.values.hourCycle.default,\n TimePickerController.valueConstraints.hourCycle,\n );\n }\n\n /** Current `step` declaration resolved against its numeric contract. */\n get #safeStep(): number {\n return this.#numbers.read(\n this,\n \"step\",\n this.stepValue,\n TimePickerController.values.step.default,\n TimePickerController.valueConstraints.step,\n );\n }\n}\n\n/** Positive modulo for wrapping values in both keyboard directions. */\nfunction modulo(value: number, modulus: number): number {\n return ((value % modulus) + modulus) % modulus;\n}\n\n/** Zero-pads a number to two digits. */\nfunction pad(value: number): string {\n return String(value).padStart(2, \"0\");\n}\n"]}
1
+ {"version":3,"sources":["../../src/utils/logical_scroll.ts","../../src/utils/arrow_step.ts","../../src/utils/attribute_write.ts","../../src/utils/authored_mutation_watcher.ts","../../src/utils/field_mirror.ts","../../src/utils/listener_set.ts","../../src/utils/microtask_coalescer.ts","../../src/utils/morph_render_watcher.ts","../../src/utils/move_counter.ts","../../src/utils/number_bounds.ts","../../src/utils/coerce.ts","../../src/utils/number_value.ts","../../src/utils/target_selector.ts","../../src/controllers/time_picker_controller.ts"],"names":["pending"],"mappings":";;AAiBO,SAAS,MAAM,OAAA,EAA2B;AAC/C,EAAA,OAAO,MAAA,CAAO,gBAAA,CAAiB,OAAO,CAAA,CAAE,SAAA,KAAc,KAAA;AACxD;;AC6CO,SAAS,eAAA,CAAgB,KAAa,OAAA,EAA0B;AACrE,EAAA,IAAI,GAAA,KAAQ,YAAA,IAAgB,GAAA,KAAQ,WAAA,EAAa,OAAO,GAAA;AACxD,EAAA,IAAI,CAAC,KAAA,CAAM,OAAO,CAAA,EAAG,OAAO,GAAA;AAC5B,EAAA,OAAO,GAAA,KAAQ,eAAe,WAAA,GAAc,YAAA;AAC9C;AAuCO,SAAS,oBAAA,CACd,KAAA,EACA,KAAA,GAAkC,EAAC,EAC1B;AACT,EAAA,IAAI,CAAC,KAAA,CAAM,GAAA,CAAI,UAAA,CAAW,OAAO,GAAG,OAAO,KAAA;AAC3C,EAAA,OACG,KAAA,CAAM,MAAA,IAAU,CAAC,KAAA,CAAM,QAAA,CAAS,KAAK,CAAA,IACrC,KAAA,CAAM,OAAA,IAAW,CAAC,KAAA,CAAM,QAAA,CAAS,MAAM,KACvC,KAAA,CAAM,OAAA,IAAW,CAAC,KAAA,CAAM,QAAA,CAAS,MAAM,CAAA,IACvC,KAAA,CAAM,QAAA,IAAY,CAAC,KAAA,CAAM,QAAA,CAAS,OAAO,CAAA;AAE9C;AAsBO,SAAS,iBAAiB,KAAA,EAA+B;AAC9D,EAAA,OAAO,MAAM,MAAA,IAAU,KAAA,CAAM,OAAA,IAAW,KAAA,CAAM,WAAW,KAAA,CAAM,QAAA;AACjE;;ACjIO,SAAS,qBAAA,CACd,OAAA,EACA,IAAA,EACA,KAAA,EACA,WAAA,EACS;AACT,EAAA,IAAI,OAAA,CAAQ,YAAA,CAAa,IAAI,CAAA,KAAM,OAAO,OAAO,KAAA;AACjD,EAAA,WAAA,IAAc;AACd,EAAA,IAAI,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AAAA,MACA,IAAA,CAAK,SAAA;AAAA,MACL,qBAAA,CAAqB,OAAO,IAAA,CAAK,OAAA;AAAA,MACjC,sBAAqB,gBAAA,CAAiB;AAAA,KACxC;AAAA,EACF;AACF;AAGA,SAAS,MAAA,CAAO,OAAe,OAAA,EAAyB;AACtD,EAAA,OAAA,CAAS,KAAA,GAAQ,UAAW,OAAA,IAAW,OAAA;AACzC;AAGA,SAAS,IAAI,KAAA,EAAuB;AAClC,EAAA,OAAO,MAAA,CAAO,KAAK,CAAA,CAAE,QAAA,CAAS,GAAG,GAAG,CAAA;AACtC","file":"time_picker_controller.js","sourcesContent":["/** Normalized scroll position and maximum distance on one logical axis. */\nexport interface LogicalScrollMetrics {\n position: number;\n max: number;\n}\n\n/**\n * Whether horizontal scrolling on `element` follows right-to-left inline flow.\n *\n * Resolved from the **computed** `direction`, so the authoring contract is the\n * usual `dir=\"rtl\"` (or a stylesheet) on the element or any ancestor.\n *\n * Scope: horizontal writing modes. A vertical writing mode (`writing-mode:\n * vertical-rl`) also inverts the horizontal axis, which this check does not\n * model — vertical writing modes are out of scope for the scroll utilities\n * (their consumers describe axes as horizontal/vertical, not inline/block).\n */\nexport function isRtl(element: Element): boolean {\n return window.getComputedStyle(element).direction === \"rtl\";\n}\n\n/**\n * Returns scroll distance from the logical start edge.\n *\n * CSSOM View exposes standards-mode RTL horizontal offsets as `0` at the inline\n * start (right) and increasingly negative values toward the inline end (left).\n * The normalized position is always clamped to `[0, max]`, which also absorbs\n * Safari's elastic overscroll values.\n */\nexport function logicalScrollMetrics(\n element: HTMLElement,\n horizontal: boolean,\n): LogicalScrollMetrics {\n const max = Math.max(\n 0,\n horizontal\n ? element.scrollWidth - element.clientWidth\n : element.scrollHeight - element.clientHeight,\n );\n const raw = horizontal ? element.scrollLeft : element.scrollTop;\n const position = horizontal && isRtl(element) ? -raw : raw;\n return { position: Math.min(max, Math.max(0, position)), max };\n}\n\n/**\n * Converts a logical start/end delta to the physical value accepted by\n * `Element.scrollBy`.\n */\nexport function physicalScrollDelta(\n element: HTMLElement,\n horizontal: boolean,\n logicalDelta: number,\n): number {\n return horizontal && isRtl(element) ? -logicalDelta : logicalDelta;\n}\n","import { isRtl } from \"./logical_scroll\";\n\n/**\n * Turns an arrow key into a **logical** step: `+1` for \"next\", `-1` for\n * \"previous\", `0` when the key names neither.\n *\n * APG defines the horizontal pair as *next / previous* and says a vertical\n * arrangement swaps in Down/Up for the same meaning — so the pair is one axis's\n * spelling of an order, and the order reverses with the writing direction. Only\n * the horizontal pair reverses. Down/Up name an axis the writing direction does\n * not mirror, and returning them unchanged is the point: many controllers fold\n * both pairs into one branch, where swapping the branches under RTL would flip\n * the vertical axis too — a bug that reads as \"the arrows work\" until someone\n * presses Down.\n *\n * **Direction is read from the element the caller passes, which should be the\n * container that lays the items out** — not the focused child. A child may carry\n * its own `dir` (an LTR input inside an RTL form is ordinary authoring), and\n * probing per handler makes two handlers disagree at the boundary between them.\n *\n * This decides direction only. Whether the axis is even active (an\n * `orientation=\"horizontal\"` widget ignoring Down/Up), how far the step lands,\n * and what wrapping does all stay with the caller.\n *\n * **It encodes the list-order convention: `ArrowDown` is *next*.** Widgets that\n * pair the arrows by *value* instead — `ArrowUp` meaning \"more\", as a rating or a\n * slider does — must not use this, or their vertical axis inverts. Reverse the\n * horizontal pair on its own there.\n *\n * @example\n * ```ts\n * const step = logicalArrowStep(event.key, this.element);\n * if (step === 0) return;\n * this.#roving.setActive(rovingMove(current, length, step, \"wrap\"), { focus: true });\n * ```\n */\nexport function logicalArrowStep(key: string, element: Element): 1 | -1 | 0 {\n if (key === \"ArrowDown\") return 1;\n if (key === \"ArrowUp\") return -1;\n if (key !== \"ArrowRight\" && key !== \"ArrowLeft\") return 0;\n const forward = isRtl(element) ? \"ArrowLeft\" : \"ArrowRight\";\n return key === forward ? 1 : -1;\n}\n\n/**\n * Rewrites `key` so an existing LTR-shaped branch keeps working under RTL:\n * `ArrowRight` and `ArrowLeft` trade places, everything else passes through.\n *\n * The alternative — negating a delta — silently breaks handlers whose two\n * horizontal branches are **not mirror images**. A grid that clamps one edge but\n * not the other, or a segmented field guarding `index > 0` on one side and\n * `index < length - 1` on the other, ends up applying the wrong guard to the\n * wrong direction. Swapping the key leaves each branch, guards and all, exactly\n * where its author put it.\n *\n * Same rule as {@link logicalArrowStep} about which element to read: pass the\n * container that lays the items out, not the focused child.\n *\n * @example\n * ```ts\n * switch (logicalArrowKey(event.key, this.element)) {\n * case \"ArrowLeft\": // \"previous\" — whatever direction that is on screen\n * ```\n */\nexport function logicalArrowKey(key: string, element: Element): string {\n if (key !== \"ArrowRight\" && key !== \"ArrowLeft\") return key;\n if (!isRtl(element)) return key;\n return key === \"ArrowRight\" ? \"ArrowLeft\" : \"ArrowRight\";\n}\n\n/**\n * The element whose writing direction orders a grid's columns: the nearest\n * `<table>` holding `grid` inside `root`, else `grid` itself. Table columns follow\n * the table's direction, so a direction declared only on a row group such as\n * `<tbody>` does not reorder them and must not reverse the arrows either.\n */\nexport function gridDirectionElement(grid: Element, root: Element): Element {\n const table = grid.closest(\"table\");\n return table !== null && root.contains(table) ? table : grid;\n}\n\n/** Modifiers a widget may claim on an arrow key, named for the `allow` list. */\nexport type ArrowModifier = \"alt\" | \"ctrl\" | \"meta\" | \"shift\";\n\n/**\n * True when an arrow key arrived carrying a modifier the widget must leave to\n * the browser: return without calling `preventDefault()` and without moving any\n * state.\n *\n * A bare arrow belongs to the widget; a chorded one usually does not.\n * `Alt`/`Meta` plus a horizontal arrow is history back/forward on every desktop\n * browser, and a widget that swallows it makes the shortcut work or not\n * depending on where focus happens to sit — a coin-flip the user cannot see.\n *\n * `allow` is for the combinations APG assigns to a pattern **and the widget\n * actually implements** — for example `Alt+Down`/`Alt+Up`, which the APG Combobox\n * pattern makes optional and `stimeo--combobox` implements.\n * Listing one the widget does not implement defeats the point: the chord then\n * runs the plain-arrow branch, which is exactly what this guard exists to stop.\n * Non-arrow keys return `false`, so chorded letters and\n * `Control+Home`/`Control+End` are untouched.\n *\n * @example\n * ```ts\n * if (isReservedArrowChord(event)) return;\n * ```\n */\nexport function isReservedArrowChord(\n event: KeyboardEvent,\n allow: readonly ArrowModifier[] = [],\n): boolean {\n if (!event.key.startsWith(\"Arrow\")) return false;\n return (\n (event.altKey && !allow.includes(\"alt\")) ||\n (event.ctrlKey && !allow.includes(\"ctrl\")) ||\n (event.metaKey && !allow.includes(\"meta\")) ||\n (event.shiftKey && !allow.includes(\"shift\"))\n );\n}\n\n/**\n * True when a press carries Alt, Control, Meta, or Shift, regardless of its key.\n *\n * This predicate reports modifier presence only; key ownership stays with the\n * caller. Check the widget's implemented key/modifier bindings and their state\n * conditions before using this result to yield a chord. An unimplemented chord\n * must not fall through to the bare-key behavior.\n *\n * Dedicated bindings, such as a grid's Control+Home/End navigation, belong in\n * the caller. Unlike {@link isReservedArrowChord}, this function examines every\n * key and has no arrow-specific reservation or `allow` list.\n *\n * @example\n * ```ts\n * // A Home/End handler with no modifier bindings yields every modified press.\n * case \"Home\":\n * case \"End\":\n * if (hasModifierChord(event)) return;\n * ```\n */\nexport function hasModifierChord(event: KeyboardEvent): boolean {\n return event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;\n}\n","/**\n * Reflects a serialized attribute value only when the current value differs.\n *\n * A same-value `setAttribute` still queues a mutation record for every observer, so an\n * unchanged value writes nothing.\n *\n * @param element - The element whose attribute is reflected.\n * @param name - The attribute name, using the non-namespaced DOM API.\n * @param value - The serialized value, or null to remove the attribute.\n * @param beforeWrite - Called only for a change, before the DOM mutation, so the\n * caller can record ownership or identify its own observer records.\n * @returns Whether an attribute was written or removed.\n */\nexport function setAttributeIfChanged(\n element: Element,\n name: string,\n value: string | null,\n beforeWrite?: () => void,\n): boolean {\n if (element.getAttribute(name) === value) return false;\n beforeWrite?.();\n if (value === null) element.removeAttribute(name);\n else element.setAttribute(name, value);\n return true;\n}\n","/** The retained attributes, descendants, and inherited state one connection watches. */\nexport interface AuthoredMutationOptions {\n readonly attributes: readonly string[];\n readonly subtree?: boolean;\n readonly childList?: boolean;\n readonly ancestorAttributes?: readonly string[];\n}\n\n/** A final attribute value and the number of records its writes produce. */\ninterface AttributeClaim {\n value: string | null;\n count: number;\n}\n\n/** Added and removed nodes still represented by controller-owned child-list records. */\ninterface ChildClaim {\n readonly added: Map<Node, number>;\n readonly removed: Map<Node, number>;\n}\n\n/** Pending claims belong only to the active observed lifetime. */\ninterface MutationClaims {\n readonly attributes: Map<Element, Map<string, AttributeClaim>>;\n readonly children: Map<Node, ChildClaim>;\n}\n\n/**\n * Watches authored mutations without suspending observation during DOM repair.\n *\n * The consumer claims only actual writes, before an attribute write or immediately\n * after a synchronous helper writes. Matching uses the final value and one claim\n * per record, so an extra same-value page write remains authored. Child-list claims\n * identify the nodes a replacement adds and removes, independently of how the DOM\n * implementation splits those nodes into records. Every delivery or synchronous\n * take expires all claims before the consumer can move focus or notify subscribers.\n * Ownership, reconciliation, and DOM writes remain the consumer's responsibility.\n */\nexport class AuthoredMutationWatcher {\n readonly #onAuthored: (records: MutationRecord[]) => void;\n #claims: MutationClaims | null = null;\n #observer: MutationObserver | null = null;\n\n /** @param onAuthored - Receives a nonempty batch after controller records are excluded. */\n constructor(onAuthored: (records: MutationRecord[]) => void) {\n this.#onAuthored = onAuthored;\n }\n\n /** Starts a new connected lifetime, including the root's current ancestor chain. */\n observe(root: Element, options: AuthoredMutationOptions): void {\n this.disconnect();\n const observer = new MutationObserver((records) => {\n if (this.#observer !== observer) return;\n const authored = this.#filter(records);\n if (authored.length > 0) this.#onAuthored(authored);\n });\n this.#observer = observer;\n this.#claims = { attributes: new Map(), children: new Map() };\n observer.observe(root, {\n attributes: true,\n attributeFilter: [...options.attributes],\n subtree: options.subtree ?? false,\n childList: options.childList ?? false,\n });\n if (options.ancestorAttributes) {\n let ancestor = root.parentElement;\n while (ancestor) {\n observer.observe(ancestor, {\n attributes: true,\n attributeFilter: [...options.ancestorAttributes],\n });\n ancestor = ancestor.parentElement;\n }\n }\n }\n\n /** Claims one actual attribute write; calls outside observation own no records. */\n claim(target: Element, name: string, value: string | null): void {\n const claims = this.#claims?.attributes;\n let attributes = claims?.get(target);\n if (!attributes) {\n attributes = new Map();\n claims?.set(target, attributes);\n }\n const pending = attributes.get(name);\n attributes.set(name, { value, count: (pending?.count ?? 0) + 1 });\n }\n\n /** Claims a synchronous helper's actual attribute write before any external callback runs. */\n claimCurrent(target: Element, name: string): void {\n this.claim(target, name, target.getAttribute(name));\n }\n\n /** Claims the actual nodes added and removed by one synchronous child replacement. */\n claimChildList(target: Node, added: readonly Node[], removed: readonly Node[]): void {\n const claims = this.#claims?.children;\n const pending = claims?.get(target) ?? { added: new Map(), removed: new Map() };\n for (const node of added) pending.added.set(node, (pending.added.get(node) ?? 0) + 1);\n for (const node of removed) pending.removed.set(node, (pending.removed.get(node) ?? 0) + 1);\n claims?.set(target, pending);\n }\n\n /** Returns queued authored records synchronously and expires every pending claim. */\n take(): MutationRecord[] {\n return this.#filter(this.#observer?.takeRecords() ?? []);\n }\n\n /** Releases observation and claims; safe to repeat and reuse on a later connection. */\n disconnect(): void {\n this.#observer?.disconnect();\n this.#observer = null;\n this.#claims = null;\n }\n\n /** Applies one batch's claims before handing control back to the consumer. */\n #filter(records: MutationRecord[]): MutationRecord[] {\n const authored = records.filter((record) => !this.#consume(record));\n this.#claims?.attributes.clear();\n this.#claims?.children.clear();\n return authored;\n }\n\n /**\n * Matches the native attribute or nonempty child-list records this watcher registers.\n * @see https://dom.spec.whatwg.org/#queue-a-tree-mutation-record\n */\n #consume(record: MutationRecord): boolean {\n if (record.type === \"attributes\") {\n const target = record.target as Element;\n const pending = this.#claims?.attributes.get(target)?.get(record.attributeName as string);\n if (\n !pending ||\n pending.count === 0 ||\n target.getAttribute(record.attributeName as string) !== pending.value\n ) {\n return false;\n }\n pending.count -= 1;\n return true;\n }\n const pending = this.#claims?.children.get(record.target);\n if (!pending) return false;\n const added = [...record.addedNodes];\n const removed = [...record.removedNodes];\n if (\n added.some((node) => !pending.added.get(node)) ||\n removed.some((node) => !pending.removed.get(node))\n ) {\n return false;\n }\n for (const node of added) pending.added.set(node, (pending.added.get(node) ?? 0) - 1);\n for (const node of removed) pending.removed.set(node, (pending.removed.get(node) ?? 0) - 1);\n return true;\n }\n}\n","/**\n * The hidden form fields a widget keeps in step with the state it owns.\n *\n * A widget whose value lives in ARIA attributes submits nothing on its own, so\n * it mirrors that value into `<input type=\"hidden\">` — one field for a single\n * value, a container of generated fields for a set. The mirror is one-way: the\n * widget's own state stays the source of truth and the field is what the form\n * reads.\n *\n * The write and the report are separate calls because they answer to different\n * rules. A mirror is refreshed on connect, after a morph, and whenever the\n * widget repairs itself — none of which a form should treat as an edit. Only\n * the user's own commit reports one, which is why {@link commitField} is never\n * folded into the writes.\n */\n\n/** How a widget's generated fields identify themselves to the form. */\nexport interface GeneratedFieldOptions {\n /** The `name` every generated input submits under. */\n readonly name: string;\n /** The `form` id, for a widget that sits outside the form it submits to. */\n readonly form?: string;\n}\n\n/**\n * Mirrors one value into a hidden field.\n *\n * @returns Whether the field's value moved.\n *\n * @example\n * ```ts\n * if (writeField(this.fieldTarget, String(value)) && userDriven) {\n * commitField(this.fieldTarget);\n * }\n * ```\n */\nexport function writeField(field: HTMLInputElement, value: string): boolean {\n if (field.value === value) return false;\n field.value = value;\n return true;\n}\n\n/**\n * Mirrors a set of values into `container` as generated hidden fields, in the\n * order given.\n *\n * A container that already submits exactly this set is left untouched, children\n * and all — the mirror is refreshed far more often than it moves (every connect,\n * morph and repair), and a rebuild that changes nothing is still a DOM mutation\n * a consumer's observer and a `:empty` rule can see.\n *\n * @returns Whether the submitted set moved — its values, their order, the\n * `name`, or the `form`.\n */\nexport function writeFields(\n container: HTMLElement,\n values: readonly string[],\n { name, form = \"\" }: GeneratedFieldOptions,\n): boolean {\n const current = [...container.children];\n const submits =\n current.length === values.length &&\n current.every(\n (child, index) =>\n child instanceof HTMLInputElement &&\n child.type === \"hidden\" &&\n child.value === values[index] &&\n child.name === name &&\n (child.getAttribute(\"form\") ?? \"\") === form,\n );\n if (submits) return false;\n\n container.replaceChildren(\n ...values.map((value) => {\n const input = document.createElement(\"input\");\n input.type = \"hidden\";\n input.name = name;\n input.value = value;\n if (form !== \"\") input.setAttribute(\"form\", form);\n return input;\n }),\n );\n return true;\n}\n\n/**\n * Reports a committed value from `target` the way a native form control does:\n * one bubbling, non-cancelable `change`.\n *\n * Call it only for a move the user made. Form-level behaviors listen for this —\n * validation re-checks, auto-submit — and a mirror refreshed by a morph or a\n * repair is not something the user submitted.\n *\n * `target` is the element that carries the value: the hidden field for a single\n * mirrored value, the container for a generated set (whose own inputs are\n * replaced on every write), or a widget's own native control where that is what\n * the form reads.\n */\nexport function commitField(target: HTMLElement): void {\n target.dispatchEvent(new Event(\"change\", { bubbles: true }));\n}\n","/** What {@link ListenerSet.add} passes on besides the signal it supplies itself. */\nexport type ListenerOptions = Omit<AddEventListenerOptions, \"signal\">;\n\n/**\n * The event map a target's own `addEventListener` types its handlers with: the\n * window's, a document's, an HTML or SVG element's, any other element's, or a\n * media query list's. Other targets name none.\n */\ntype EventMapOf<T extends EventTarget> = T extends Window\n ? WindowEventMap\n : T extends Document\n ? DocumentEventMap\n : T extends HTMLElement\n ? HTMLElementEventMap\n : T extends SVGElement\n ? SVGElementEventMap\n : T extends Element\n ? ElementEventMap\n : T extends MediaQueryList\n ? MediaQueryListEventMap\n : Record<never, never>;\n\n/**\n * Owns every listener a controller attaches for one connected lifetime and\n * releases them together, so an event name is spelled once and the release\n * cannot drift from the registration.\n *\n * Detaching by hand repeats three things at the release site — the type, the\n * handler reference and the capture flag — and any one of them drifting leaves\n * a listener alive on an element the controller no longer drives. Aborting the\n * signal a registration was created with releases it whatever it was made of,\n * so the release site names nothing.\n *\n * One set per lifetime, held as a field and never rebuilt.\n * {@link ListenerSet.dispose} is the only thing that closes a generation, and it opens\n * the next one in the same step, so the lifecycle hooks can call `add` and\n * `dispose` in any order any number of times, and no `add` ever meets an\n * already aborted signal — a DOM that registers a listener on such a signal\n * would keep it forever. Rebuilding the set instead would leak:\n * `addEventListener` matches an existing registration on target, type, callback\n * and capture alone, so re-adding the same handler while the first registration\n * is live is discarded, and that live registration keeps the signal it was\n * attached with — a set built by a second `connect()` can never release what it\n * appears to own.\n *\n * Scope is the registration only. Timers, observers, leases and the order they\n * are unwound in stay with the controller, which places `dispose()` in its\n * cleanup sequence. A receiver that changes at runtime (a\n * swapped target) is rebound by calling `dispose()` and then `add()` again from\n * the rebind, not by a second set.\n *\n * A lifetime shorter than the connection — while a Value holds, until a first\n * load, while a subscription is open — gets a set of its own, which the end of\n * that lifetime disposes. A controller therefore holds one set per lifetime: the\n * connection's, and one for each swapped receiver or shorter span.\n *\n * The set must own every registration of a tuple it holds: a listener the same\n * target already carries for the same type, callback and capture flag keeps the\n * right to remove it, and this set's `add` for that tuple is discarded. A\n * subscription shared between instances behind a participant count, listeners of\n * several elements that come and go one at a time, and those one gesture holds\n * keep their own pair of calls or a signal of their own.\n *\n * @example\n * ```ts\n * readonly #listeners = new ListenerSet();\n *\n * connect(): void {\n * this.#listeners.add(this.element, \"submit\", this.#onNativeSubmit, { capture: true });\n * this.#listeners.add(this.element, \"turbo:submit-start\", this.#onSubmitStart);\n * this.#listeners.add(this.element, \"turbo:submit-end\", this.#onSubmitEnd);\n * }\n *\n * disconnect(): void {\n * this.#listeners.dispose();\n * }\n * ```\n */\nexport class ListenerSet {\n /** The generation every `add` joins until the next `dispose()`. */\n #abort = new AbortController();\n\n /**\n * Attaches `handler` to the open generation, exactly as the caller spelled it.\n *\n * The set supplies the signal, so `options` carries everything else the DOM\n * accepts — `capture` included. A removal by hand would have to repeat that\n * flag; aborting the signal releases the listener without it.\n *\n * A `type` the target's own event map names types `handler` with that event,\n * as the target's `addEventListener` does, so a handler written for a\n * `KeyboardEvent` is passed as it is; any other `type` takes an\n * `EventListener`.\n */\n add<T extends EventTarget, K extends keyof EventMapOf<T> & string>(\n target: T,\n type: K,\n handler: (event: EventMapOf<T>[K]) => void,\n options?: ListenerOptions,\n ): void;\n add(target: EventTarget, type: string, handler: EventListener, options?: ListenerOptions): void;\n add(target: EventTarget, type: string, handler: EventListener, options?: ListenerOptions): void {\n target.addEventListener(type, handler, { ...options, signal: this.#abort.signal });\n }\n\n /**\n * Releases every listener of the open generation, synchronously, and opens the\n * next one. Idempotent, and safe before anything has been added.\n */\n dispose(): void {\n this.#abort.abort();\n this.#abort = new AbortController();\n }\n}\n","/**\n * Collapses many Stimulus lifecycle callbacks from one DOM mutation into a\n * single pass.\n *\n * Stimulus fires `<name>TargetConnected` / `Disconnected` once per element and\n * `<name>ValueChanged` once per changed attribute. Replacing a list of N options\n * or morphing several render Values therefore delivers N callbacks — but the\n * useful unit of work is \"reconcile against the resulting declarative input\",\n * once, after the batch has settled. Every controller with reconcilable targets\n * or render Values needs the same shape: a `queued` flag plus `queueMicrotask`.\n *\n * **A microtask is the right horizon, and the reason is specific.** Stimulus\n * drives these callbacks from a `MutationObserver`, whose own callback already\n * runs as a microtask with the whole batch in hand; scheduling one more lands\n * after the last sibling callback of that batch and still before paint or any\n * event handler. A timer would be later than it needs to be, and reconciling\n * synchronously would run once per element against a half-applied DOM.\n *\n * **The two guards are not the same guard.** Scheduling is refused before the\n * controller connects, and running is refused after it disconnects:\n *\n * - **Before `connect()`** — Stimulus delivers initial target and Value callbacks\n * ahead of `connect()`. Reconciling there would compute output against a\n * controller whose own state has not been initialised, and `connect()` is\n * about to do a full pass anyway.\n * - **After `disconnect()`** — Stimulus fires a callback for **every** target\n * during teardown, and a microtask queued just before it would otherwise run\n * against a detached tree. {@link MicrotaskCoalescer.cancel} exists for the\n * teardown path to drop the pending pass outright.\n *\n * Both guards are part of one contract here rather than something each consumer\n * has to remember separately.\n *\n * Scope is the scheduling only. *What* to reconcile — keep the surviving active\n * option, fall back to the next / previous / first visible one, rebuild derived\n * chips or hidden fields — stays in the controller, because no two consumers\n * answer it the same way.\n *\n * @example\n * ```ts\n * readonly #reconcile = new MicrotaskCoalescer(() => this.#reconcileOptions());\n *\n * connect() { this.#reconcile.activate(); }\n * disconnect() { this.#reconcile.cancel(); }\n *\n * optionTargetConnected() { this.#reconcile.schedule(); }\n * optionTargetDisconnected() { this.#reconcile.schedule(); }\n * ```\n */\nexport class MicrotaskCoalescer {\n readonly #run: () => void;\n #queued = false;\n #active = false;\n #generation = 0;\n\n /** @param run - the single reconciliation pass, invoked at most once per batch. */\n constructor(run: () => void) {\n this.#run = run;\n }\n\n /** Opens the window in which {@link schedule} is honoured; call from `connect()`. */\n activate(): void {\n this.#active = true;\n }\n\n /** Closes the window and drops any pending pass; call from `disconnect()`. */\n cancel(): void {\n this.#active = false;\n this.#queued = false;\n this.#generation += 1;\n }\n\n /** Whether a requested pass has yet to run. */\n get pending(): boolean {\n return this.#queued;\n }\n\n /** Requests one pass after the batch settles. Idempotent; inert outside the window. */\n schedule(): void {\n if (!this.#active || this.#queued) return;\n this.#queued = true;\n const generation = this.#generation;\n queueMicrotask(() => {\n // A cancelled callback must not consume a pass queued after reconnect.\n if (generation !== this.#generation || !this.#queued || !this.#active) return;\n this.#queued = false;\n this.#run();\n });\n }\n}\n","import { ListenerSet } from \"./listener_set\";\nimport { MicrotaskCoalescer } from \"./microtask_coalescer\";\n\n/**\n * Coalesces retained-element morphs and explicit lifecycle requests into one pass.\n *\n * Observe the controller's element after its initial state is settled. Morphs on\n * that element and bubbling morphs on its descendants share the same microtask\n * as {@link schedule}. The callback repairs derived output; the controller owns\n * any logical transition reporting. {@link disconnect} releases the listener and\n * cancels pending work, including work from an earlier connected lifetime.\n */\nexport class MorphRenderWatcher {\n readonly #listeners = new ListenerSet();\n readonly #pass: MicrotaskCoalescer;\n #element: Element | null = null;\n readonly #onMorph = (): void => this.#pass.schedule();\n\n /** @param run - the single pass that repairs the settled controller's output. */\n constructor(run: () => void) {\n this.#pass = new MicrotaskCoalescer(run);\n }\n\n /** Opens observation; observing the same element again preserves queued work. */\n observe(element: Element): void {\n if (this.#element === element) return;\n this.disconnect();\n this.#element = element;\n this.#pass.activate();\n this.#listeners.add(element, \"turbo:morph-element\", this.#onMorph);\n }\n\n /** Requests one pass; requests outside an observed lifetime are ignored. */\n schedule(): void {\n this.#pass.schedule();\n }\n\n /** Whether a pass requested by a morph or {@link schedule} has yet to run. */\n get pending(): boolean {\n return this.#pass.pending;\n }\n\n /** Releases observation and pending work synchronously; safe to repeat. */\n disconnect(): void {\n this.#listeners.dispose();\n this.#pass.cancel();\n this.#element = null;\n }\n}\n","/**\n * Identifies the latest reported state transition of one owner.\n *\n * Record a transition after its state is written and before invoking external\n * code. Check the returned token before each later report: a synchronous\n * transition made by a listener supersedes reports that have not been sent.\n * Reading state or committing an unchanged state must not advance the counter.\n * Reports stay in the caller so their ordering remains explicit.\n */\nexport class MoveCounter {\n #sequence = 0;\n\n /** Records a state transition and returns its report token. */\n record(): number {\n this.#sequence += 1;\n return this.#sequence;\n }\n\n /** Whether no later state transition has superseded this report token. */\n isLatest(token: number): boolean {\n return token === this.#sequence;\n }\n}\n","import { MAX_TIMER_DELAY_MS } from \"./timer_bounds\";\n\n/** Semantic constraints on an already decoded number, independent of the DOM. */\nexport interface NumberBounds {\n /** Finite numbers are required, including when this field is omitted. */\n readonly finite?: true;\n /** Inclusive lower endpoint. */\n readonly min?: number;\n /** Inclusive upper endpoint. */\n readonly max?: number;\n /** Exclusive lower endpoint. */\n readonly exclusiveMin?: number;\n /** Require a number without a fractional part. */\n readonly integer?: boolean;\n /** Exact decoded numbers accepted by a discrete contract. */\n readonly allowedValues?: readonly number[];\n /** JSON-safe exceptions to finite-number checking for unbounded endpoints. */\n readonly allowInfinity?: \"negative\" | \"positive\" | \"both\";\n}\n\n/** One constraint for each Number Value, including shorthand declarations. */\nexport type NumberValueConstraints<Values> = {\n readonly [Key in keyof Values as Values[Key] extends\n | NumberConstructor\n | { type: NumberConstructor }\n ? Key\n : never]: NumberBounds;\n};\n\n/** Reusable semantic domains; fractional inputs remain fractional unless excluded. */\nexport const NUMBER_BOUNDS = {\n finite: { finite: true },\n nonNegative: { finite: true, min: 0 },\n positive: { finite: true, exclusiveMin: 0 },\n nonNegativeInteger: { finite: true, min: 0, integer: true },\n positiveInteger: { finite: true, exclusiveMin: 0, integer: true },\n lowerBound: { finite: true, allowInfinity: \"negative\" },\n upperBound: { finite: true, allowInfinity: \"positive\" },\n timer: { finite: true, min: 0, max: MAX_TIMER_DELAY_MS },\n positiveTimer: { finite: true, exclusiveMin: 0, max: MAX_TIMER_DELAY_MS },\n} as const satisfies Record<string, NumberBounds>;\n\n/**\n * Checks all declared bounds without rounding, clamping, or coercing the input.\n * Infinity exceptions relax only finite checking; every other bound still applies.\n */\nexport function matchesNumberBounds(value: number, bounds: NumberBounds): boolean {\n if (!Number.isFinite(value)) {\n const direction = value === Infinity ? \"positive\" : value === -Infinity ? \"negative\" : null;\n if (direction === null) return false;\n if (bounds.allowInfinity !== \"both\" && bounds.allowInfinity !== direction) return false;\n }\n if (bounds.min !== undefined && value < bounds.min) return false;\n if (bounds.max !== undefined && value > bounds.max) return false;\n if (bounds.exclusiveMin !== undefined && value <= bounds.exclusiveMin) return false;\n if (bounds.integer && !Number.isInteger(value)) return false;\n if (bounds.allowedValues !== undefined && !bounds.allowedValues.includes(value)) return false;\n return true;\n}\n\n/** Decodes a Number Value literal; action params use their own JSON decoder. */\nexport function decodeNumberValue(raw: string): number {\n return Number(raw.replace(/_/g, \"\"));\n}\n","/**\n * Numeric coercion for controllers that accept a number through a Value, an action\n * param, or an event detail.\n *\n * Stimulus decodes action params as JSON when possible and leaves other text\n * untouched. CustomEvent detail can also supply a number or numeric string.\n * The reader accepts those two types while rejecting blank and non-finite input.\n */\n\nimport { matchesNumberBounds, type NumberBounds } from \"./number_bounds\";\n\n/** Numeric update input, accepting decoded action params before CustomEvent detail. */\nexport type NumericValueEvent = Event & {\n params?: { amount?: unknown };\n detail?: { value?: unknown };\n};\n\n/** Reads the nullish action-param/detail precedence without falling back from invalid input. */\nexport function eventNumber(event: NumericValueEvent): number | null {\n return toFiniteNumber(event.params?.amount ?? event.detail?.value);\n}\n\n/**\n * Reads a finite number or nonblank numeric string; other input returns `null`.\n * Blank strings cannot silently reset a value to zero.\n */\nexport function toFiniteNumber(raw: unknown): number | null {\n if (typeof raw !== \"number\" && typeof raw !== \"string\") return null;\n if (typeof raw === \"string\" && raw.trim().length === 0) return null;\n const value = Number(raw);\n return Number.isFinite(value) ? value : null;\n}\n\n/**\n * Returns an accepted decoded Number Value or the caller's fallback unchanged.\n * The caller owns the fallback contract; this reader does not parse or write a Value.\n */\nexport function readNumber(raw: number, fallback: number, bounds: NumberBounds): number {\n return matchesNumberBounds(raw, bounds) ? raw : fallback;\n}\n","import { readNumber } from \"./coerce\";\nimport { matchesNumberBounds, type NumberBounds } from \"./number_bounds\";\n\n/** The instance identity carried by a Number Value read. */\nexport interface NumberValueOwner {\n readonly identifier: string;\n readonly element: Element;\n}\n\n/** Reads current declarations at the point of use without rewriting their attributes. */\nexport class NumberValueReader {\n /** The last rejected literal per Value; no history grows for an unchanged instance. */\n readonly #lastRejected = new Map<string, string>();\n\n /** Resolves the declared number using its own fallback and shared class contract. */\n read(\n owner: NumberValueOwner,\n name: string,\n raw: number,\n fallback: number,\n bounds: NumberBounds,\n ): number {\n const resolved = readNumber(raw, fallback, bounds);\n if (matchesNumberBounds(raw, bounds)) {\n this.#lastRejected.delete(name);\n return resolved;\n }\n const attribute = `data-${owner.identifier}-${name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}-value`;\n const literal = owner.element.getAttribute(attribute);\n if (literal === null) {\n this.#lastRejected.delete(name);\n return resolved;\n }\n if (this.#lastRejected.get(name) !== literal) {\n this.#lastRejected.set(name, literal);\n console.warn(\n `Stimeo UI: \"${owner.identifier}\" has an invalid number Value \"${name}\" declaration ${JSON.stringify(literal)}; using ${fallback}.`,\n );\n }\n return resolved;\n }\n}\n","/**\n * The attribute selector for one declared target, in a controller's own namespace.\n *\n * Stimulus reads `data-<identifier>-target` as a **space-separated token list**, so a\n * single element can carry several target names at once. Matching the attribute value\n * whole would reach only the elements that declare exactly one name, which is why the\n * name is paired with `~=`.\n *\n * `identifier` is the name the controller is registered under, so the selector reaches\n * the markup that registration renders rather than one fixed spelling.\n */\nexport function targetSelector(identifier: string, name: string): string {\n return `[data-${identifier}-target~=\"${name}\"]`;\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport { hasModifierChord, isReservedArrowChord, logicalArrowKey } from \"../utils/arrow_step\";\nimport { setAttributeIfChanged } from \"../utils/attribute_write\";\nimport { AuthoredMutationWatcher } from \"../utils/authored_mutation_watcher\";\nimport { commitField, writeField } from \"../utils/field_mirror\";\nimport { ListenerSet } from \"../utils/listener_set\";\nimport { MorphRenderWatcher } from \"../utils/morph_render_watcher\";\nimport { MoveCounter } from \"../utils/move_counter\";\nimport { NUMBER_BOUNDS, type NumberValueConstraints } from \"../utils/number_bounds\";\nimport { NumberValueReader } from \"../utils/number_value\";\nimport { targetSelector } from \"../utils/target_selector\";\n\n/** A time segment kind, as declared by `data-segment` on each spinbutton. */\ntype SegmentKind = \"hour\" | \"minute\" | \"second\" | \"meridiem\";\n\n/** The numeric hour presentation, independent of labels and canonical time. */\ntype HourMode = \"h11\" | \"h12\" | \"h23\";\n\n/** Canonical controller state. Hours are always stored on the 24-hour clock. */\ninterface TimeState {\n hour: number;\n minute: number;\n second: number;\n}\n\n/** Meridiem encoding exposed through the meridiem spinbutton. */\nconst AM = 0;\nconst PM = 1;\nconst SECONDS_PER_MINUTE = 60;\nconst SECONDS_PER_HOUR = 60 * SECONDS_PER_MINUTE;\nconst SECONDS_PER_DAY = 24 * SECONDS_PER_HOUR;\n\n/**\n * Headless, accessible **time picker** behavior. Each segment (hour, minute,\n * optional second, optional AM/PM) is an APG **Spinbutton**; the controller\n * composes them into an `HH:MM[:SS]` value mirrored to an optional hidden field.\n *\n * Markup contract (identifier: `stimeo--time-picker`):\n * <div data-controller=\"stimeo--time-picker\"\n * data-stimeo--time-picker-hour-cycle-value=\"24\"\n * role=\"group\" aria-label=\"Time\">\n * <span role=\"spinbutton\" aria-label=\"Hours\" tabindex=\"0\"\n * aria-valuenow=\"9\" aria-valuemin=\"0\" aria-valuemax=\"23\" aria-valuetext=\"09\"\n * data-segment=\"hour\" data-stimeo--time-picker-target=\"segment\"\n * data-action=\"keydown->stimeo--time-picker#onKeydown\">09</span>\n * <span aria-hidden=\"true\">:</span>\n * <span role=\"spinbutton\" aria-label=\"Minutes\" tabindex=\"0\"\n * data-segment=\"minute\" data-stimeo--time-picker-target=\"segment\"\n * data-action=\"keydown->stimeo--time-picker#onKeydown\">30</span>\n * <input type=\"hidden\" data-stimeo--time-picker-target=\"field\" />\n * </div>\n *\n * `reconcile` dispatches `{ value: string }`.\n *\n * All published state is settled before its reports. A synchronous listener\n * that confirms another value leaves that newer confirmation to report itself;\n * reports still pending for the replaced value are not sent. A listener that\n * disconnects the controller ends the reports still pending. A read-only listener\n * or a confirmation that moves no published value leaves pending reports intact.\n * An event already being dispatched still reaches its remaining listeners.\n *\n * @remarks\n * `segment` targets declare the spinbuttons; the optional `field` target receives\n * the composed form value. `hourCycle` selects 12- or 24-hour presentation\n * (default 24), `step` is the positive integer minute step (default 1), `seconds`\n * includes seconds in the composed value (default false), and `wrap` controls\n * whether stepping crosses segment bounds (default true). The author decides\n * which optional segment targets are present; `seconds` does not create or hide\n * markup.\n *\n * Every segment is its own Tab stop (multi-tabstop, *not* roving), while\n * `ArrowLeft`/`ArrowRight` provide auxiliary movement. `ArrowUp`/`ArrowDown`\n * step the focused spinbutton; wrapping seconds or minutes carries into the next\n * unit, and 12-hour stepping crosses AM/PM at noon and midnight. Typing digits\n * enters a value directly and advances after completion. The digit buffer is\n * discarded on another action, a segment target change, a page write taken in\n * from a segment, or focus departure.\n *\n * A user action that changes the composed value dispatches one bubbling native\n * `change` from the field, when present, then one `stimeo--time-picker:change` with\n * `{ value: string }` unless a listener of that native `change` has confirmed another\n * value or disconnected the controller. Retained\n * `aria-valuenow`/`data-segment` changes, runtime targets, and\n * `hourCycle`/`seconds` Value changes are reconciled for Turbo morph\n * compatibility; when such a pass moves the composed value — dropping a `second`\n * segment, say — it reports `stimeo--time-picker:reconcile` with the same detail\n * instead, so a consumer can tell its own edit from this controller's repair.\n * Initial connection reports neither.\n * `amLabel` and `pmLabel` supply the visible and accessible meridiem text,\n * defaulting to `AM` and `PM`. Label changes preserve the composed time and\n * do not dispatch value-change events.\n * `hour12ZeroBased` selects hours 0–11 when `hourCycle` is 12; its default\n * false keeps hours 1–12. It has no effect on a 24-hour presentation.\n * A change of the hour range (`hourCycle` or `hour12ZeroBased`) discards partial\n * digit entry and preserves the instant. A 12-hour presentation without a\n * `meridiem` segment reads as morning.\n * During a simultaneous DOM update, an untouched retained hour keeps its time;\n * an explicitly written or replacement hour is read in the new range.\n */\nexport class TimePickerController extends Controller<HTMLElement> {\n /** Numeric read boundaries share one reader for this controller instance. */\n readonly #numbers = new NumberValueReader();\n\n readonly #moves = new MoveCounter();\n #connectionGeneration = 0;\n #move = 0;\n\n static override targets = [\"segment\", \"field\"];\n static override values = {\n hourCycle: { type: Number, default: 24 },\n hour12ZeroBased: { type: Boolean, default: false },\n step: { type: Number, default: 1 },\n seconds: { type: Boolean, default: false },\n wrap: { type: Boolean, default: true },\n amLabel: { type: String, default: \"AM\" },\n pmLabel: { type: String, default: \"PM\" },\n };\n\n static valueConstraints = {\n hourCycle: { finite: true, allowedValues: [12, 24] },\n step: NUMBER_BOUNDS.positive,\n } satisfies NumberValueConstraints<typeof TimePickerController.values>;\n static actions = [\"onKeydown\"] as const;\n static events = [\"change\", \"reconcile\"] as const;\n\n declare readonly segmentTargets: HTMLElement[];\n declare readonly fieldTarget: HTMLInputElement;\n declare readonly hasFieldTarget: boolean;\n declare hourCycleValue: number;\n declare hour12ZeroBasedValue: boolean;\n declare stepValue: number;\n declare secondsValue: boolean;\n declare wrapValue: boolean;\n declare amLabelValue: string;\n declare pmLabelValue: string;\n\n /**\n * Collapses target, Value, and retained-attribute morphs into one render that\n * dispatches no `change`.\n */\n readonly #reconcile = new MorphRenderWatcher(() => this.#reconcileDom());\n /** Canonical state; the displayed hour and meridiem are derived from this value. */\n #state: TimeState = { hour: 0, minute: 0, second: 0 };\n /** Direct-entry digit buffer and the segment it belongs to. */\n #typeBuffer = \"\";\n #typeSegment: SegmentKind | null = null;\n /** Last composed value, used to suppress duplicate user notifications. */\n #lastValue = \"\";\n /** Presentation provenance distinguishes untouched segments from authored writes. */\n #renderedHourMode: HourMode | null = null;\n #renderedSegments = new WeakSet<HTMLElement>();\n readonly #authoredSegments = new Set<HTMLElement>();\n readonly #observer = new AuthoredMutationWatcher((records) => {\n if (!this.#recordAuthoredSegments(records)) return;\n this.#reconcile.schedule();\n });\n /**\n * Whether the segments changed since state was last adopted from them. The next\n * adoption also discards the direct-entry buffer, and runs before any key reads it.\n */\n #domDirty = false;\n\n /** The listeners of one connection, released together on `disconnect()`. */\n readonly #listeners = new ListenerSet();\n\n /** Seeds state from the DOM, renders canonical ARIA, and starts morph observation. */\n override connect(): void {\n this.#reconcile.observe(this.element);\n this.#listeners.add(this.element, \"focusout\", this.#onFocusOut);\n this.#domDirty = false;\n this.#adoptDomState();\n this.#render();\n this.#observeMutations();\n }\n\n /** Releases the observer, listener, queued reconciliation, and transient input state. */\n override disconnect(): void {\n this.#connectionGeneration += 1;\n this.#reconcile.disconnect();\n this.#listeners.dispose();\n this.#observer.disconnect();\n this.#domDirty = false;\n this.#renderedHourMode = null;\n this.#renderedSegments = new WeakSet<HTMLElement>();\n this.#authoredSegments.clear();\n this.#clearTypeBuffer();\n this.#lastValue = \"\";\n }\n\n /** Re-renders the canonical instant when 12/24-hour presentation changes at runtime. */\n hourCycleValueChanged(): void {\n this.#reconcile.schedule();\n }\n\n /** Refreshes the 12-hour range while retaining the canonical time. */\n hour12ZeroBasedValueChanged(): void {\n this.#reconcile.schedule();\n }\n\n /** Recomposes the optional seconds portion after a runtime Value change. */\n secondsValueChanged(): void {\n this.#reconcile.schedule();\n }\n\n /** Refreshes the visible and accessible AM label without changing the time. */\n amLabelValueChanged(): void {\n this.#reconcile.schedule();\n }\n\n /** Refreshes the visible and accessible PM label without changing the time. */\n pmLabelValueChanged(): void {\n this.#reconcile.schedule();\n }\n\n /** Adopts a segment inserted or replaced by a Turbo morph. */\n segmentTargetConnected(): void {\n this.#domDirty = true;\n this.#reconcile.schedule();\n }\n\n /** Rebuilds state after a segment leaves the retained controller element. */\n segmentTargetDisconnected(segment?: HTMLElement): void {\n if (segment && !this.segmentTargets.includes(segment)) this.#renderedSegments.delete(segment);\n this.#domDirty = true;\n this.#reconcile.schedule();\n }\n\n /** Reflects the current composed value into a field added or replaced at runtime. */\n fieldTargetConnected(): void {\n this.#reconcile.schedule();\n }\n\n /** Reconciles silently when the optional field leaves at runtime. */\n fieldTargetDisconnected(): void {\n this.#reconcile.schedule();\n }\n\n /** Handles APG stepping, inter-segment focus moves, jumps, and direct entry. */\n onKeydown(event: KeyboardEvent): void {\n if (isReservedArrowChord(event)) return;\n const segment = (event.target as HTMLElement | null)?.closest<HTMLElement>(\n targetSelector(this.identifier, \"segment\"),\n );\n if (!segment || !this.segmentTargets.includes(segment)) return;\n const kind = this.#kindOf(segment);\n if (!kind) return;\n\n const key = logicalArrowKey(event.key, this.element);\n if ((key === \"Home\" || key === \"End\") && hasModifierChord(event)) return;\n\n // Taking in the page's writes consumes the records the observer would have\n // answered, so the pass it would have queued is queued here. A key that renders\n // leaves that pass nothing to report.\n if (this.#adoptPendingDom()) this.#reconcile.schedule();\n if (this.#renderedHourMode !== this.#hourMode) this.#clearTypeBuffer();\n switch (key) {\n case \"ArrowUp\":\n event.preventDefault();\n this.#step(kind, this.#delta(kind));\n break;\n case \"ArrowDown\":\n event.preventDefault();\n this.#step(kind, -this.#delta(kind));\n break;\n case \"ArrowLeft\":\n event.preventDefault();\n this.#focusSibling(segment, -1);\n break;\n case \"ArrowRight\":\n event.preventDefault();\n this.#focusSibling(segment, 1);\n break;\n case \"Home\":\n event.preventDefault();\n this.#setDisplayed(kind, this.#bounds(kind).min);\n this.#commitRender();\n break;\n case \"End\":\n event.preventDefault();\n this.#setDisplayed(kind, this.#bounds(kind).max);\n this.#commitRender();\n break;\n default:\n if (\n kind !== \"meridiem\" &&\n /^[0-9]$/.test(event.key) &&\n !event.ctrlKey &&\n !event.altKey &&\n !event.metaKey\n ) {\n event.preventDefault();\n this.#typeDigit(segment, kind, event.key);\n return;\n }\n return;\n }\n this.#clearTypeBuffer();\n }\n\n /** Clears direct-entry state when Tab, Shift+Tab, or pointer focus leaves a segment. */\n readonly #onFocusOut = (event: FocusEvent): void => {\n const segment = (event.target as HTMLElement | null)?.closest<HTMLElement>(\n targetSelector(this.identifier, \"segment\"),\n );\n if (!segment || !this.segmentTargets.includes(segment)) return;\n this.#clearTypeBuffer();\n };\n\n /** Uses the normalized positive-integer minute step; other segments step by one. */\n #delta(kind: SegmentKind): number {\n if (kind !== \"minute\") return 1;\n const step = Math.trunc(this.#safeStep);\n return step > 0 ? step : 1;\n }\n\n /** Mutates one complete action and then renders/notifies its final value once. */\n #step(kind: SegmentKind, delta: number): void {\n if (kind === \"meridiem\" && this.wrapValue) {\n this.#state.hour = modulo(this.#state.hour + 12, 24);\n } else if (this.wrapValue) {\n const scale = kind === \"hour\" ? SECONDS_PER_HOUR : kind === \"minute\" ? SECONDS_PER_MINUTE : 1;\n this.#setFromSeconds(this.#secondsOfDay + delta * scale);\n } else if (kind === \"hour\") {\n // Hour stepping crosses noon while clamping at the first and last hour of the day.\n this.#state.hour = Math.min(23, Math.max(0, this.#state.hour + delta));\n } else {\n const { min, max } = this.#bounds(kind);\n const displayed = this.#displayValue(kind);\n this.#setDisplayed(kind, Math.min(max, Math.max(min, displayed + delta)));\n }\n this.#commitRender();\n }\n\n /** Accumulates a typed digit, rendering once and advancing after completion. */\n #typeDigit(segment: HTMLElement, kind: Exclude<SegmentKind, \"meridiem\">, digit: string): void {\n if (this.#typeSegment !== kind) this.#typeBuffer = \"\";\n this.#typeSegment = kind;\n\n const { max } = this.#bounds(kind);\n const candidate = Number(`${this.#typeBuffer}${digit}`);\n this.#typeBuffer = candidate <= max ? `${this.#typeBuffer}${digit}` : digit;\n\n this.#setDisplayed(kind, Number(this.#typeBuffer));\n this.#commitRender(true);\n\n if (this.#typeBuffer.length >= 2 || Number(this.#typeBuffer) * 10 > max) {\n this.#clearTypeBuffer();\n this.#focusSibling(segment, 1);\n }\n }\n\n /** Moves focus to the previous/next valid segment, if one exists. */\n #focusSibling(segment: HTMLElement, direction: 1 | -1): void {\n const segments = this.segmentTargets.filter((candidate) => this.#kindOf(candidate) !== null);\n const index = segments.indexOf(segment);\n segments[index + direction]?.focus();\n }\n\n /** Clears the direct-entry buffer and its owning segment together. */\n #clearTypeBuffer(): void {\n this.#typeBuffer = \"\";\n this.#typeSegment = null;\n }\n\n /**\n * Adopts authored segment state before a synchronous user operation consumes it,\n * and reports whether it did.\n */\n #adoptPendingDom(): boolean {\n this.#recordAuthoredSegments(this.#observer.take());\n if (!this.#domDirty) return false;\n this.#domDirty = false;\n this.#clearTypeBuffer();\n this.#adoptDomState();\n return true;\n }\n\n /** Keeps same-value author writes distinct from the controller's own reflections. */\n #recordAuthoredSegments(records: MutationRecord[]): boolean {\n let changed = false;\n for (const { target } of records) {\n if (!(target instanceof HTMLElement) || !this.segmentTargets.includes(target)) continue;\n this.#authoredSegments.add(target);\n changed = true;\n }\n if (changed) this.#domDirty = true;\n return changed;\n }\n\n /** Reconciles one coalesced target, Value, or retained-attribute mutation batch. */\n #reconcileDom(): void {\n this.#adoptPendingDom();\n this.#render();\n }\n\n /** Rebuilds canonical state from the targets; an absent hour represents midnight. */\n #adoptDomState(): void {\n const mode = this.#hourMode;\n const presentationChanged = this.#renderedHourMode !== null && this.#renderedHourMode !== mode;\n let displayedHour = 0;\n let meridiem = AM;\n let minute = 0;\n let second = 0;\n\n for (const segment of this.segmentTargets) {\n const kind = this.#kindOf(segment);\n if (!kind) continue;\n const retained =\n presentationChanged &&\n this.#renderedSegments.has(segment) &&\n !this.#authoredSegments.has(segment);\n let value: number;\n if (retained && kind === \"hour\") {\n value = mode === \"h23\" ? this.#state.hour : this.#state.hour % 12;\n } else if (retained && kind === \"meridiem\") {\n value = this.#state.hour >= 12 ? PM : AM;\n } else {\n value = this.#authoredValue(segment, kind);\n }\n if (kind === \"hour\") displayedHour = value;\n else if (kind === \"minute\") minute = value;\n else if (kind === \"second\") second = value;\n else meridiem = value;\n }\n\n this.#state = {\n hour:\n this.#safeHourCycle === 12\n ? (displayedHour % 12) + (meridiem === PM ? 12 : 0)\n : displayedHour,\n minute,\n second,\n };\n this.#authoredSegments.clear();\n }\n\n /** Reads and integer-clamps one authored `aria-valuenow`. */\n #authoredValue(segment: HTMLElement, kind: SegmentKind): number {\n const raw = Number(segment.getAttribute(\"aria-valuenow\"));\n const { min, max } = this.#bounds(kind);\n if (!Number.isFinite(raw)) return min;\n return Math.min(max, Math.max(min, Math.trunc(raw)));\n }\n\n /** Writes a displayed segment value back into canonical state without rendering. */\n #setDisplayed(kind: SegmentKind, raw: number): void {\n const { min, max } = this.#bounds(kind);\n const value = Math.min(max, Math.max(min, Math.trunc(raw)));\n if (kind === \"hour\") {\n this.#state.hour =\n this.#safeHourCycle === 12 ? (value % 12) + (this.#state.hour >= 12 ? 12 : 0) : value;\n } else if (kind === \"minute\" || kind === \"second\") {\n this.#state[kind] = value;\n } else {\n this.#state.hour = (this.#state.hour % 12) + (value === PM ? 12 : 0);\n }\n }\n\n /** Converts seconds with day wrapping into the canonical three-unit state. */\n #setFromSeconds(raw: number): void {\n const seconds = modulo(raw, SECONDS_PER_DAY);\n this.#state.hour = Math.floor(seconds / SECONDS_PER_HOUR);\n this.#state.minute = Math.floor((seconds % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE);\n this.#state.second = seconds % SECONDS_PER_MINUTE;\n }\n\n /** Reflects canonical state to every segment without dispatching user events. */\n #renderSegments(preserveTypeBuffer = false): void {\n const mode = this.#hourMode;\n if (this.#renderedHourMode !== mode && !preserveTypeBuffer) this.#clearTypeBuffer();\n this.#renderedHourMode = mode;\n for (const segment of this.segmentTargets) this.#renderSegment(segment);\n }\n\n /**\n * Reflects canonical state during connection or DOM reconciliation.\n *\n * No user edit reaches here, so `change` never fires from this path. A pass\n * that moves the committed value reports `reconcile` instead.\n *\n * @stimeoRenderRoot\n */\n #render(): void {\n this.#renderSegments();\n const value = this.#composedValue;\n const previous = this.#lastValue;\n this.#writeField(value);\n this.#lastValue = value;\n // A reconciliation can move the committed value — dropping a `second`\n // segment recomposes without it, and a `seconds` Value change adds or\n // removes the unit. That is this controller's decision rather than the\n // user's, so it is reported apart from `change`. The empty baseline is the\n // initial connection, which reports nothing.\n if (previous !== \"\" && value !== previous) {\n this.#move = this.#moves.record();\n this.dispatch(\"reconcile\", { detail: { value } });\n }\n }\n\n /** Reflects one completed user action and dispatches its final change at most once. */\n #commitRender(preserveTypeBuffer = false): void {\n const generation = this.#connectionGeneration;\n this.#renderSegments(preserveTypeBuffer);\n const value = this.#composedValue;\n const changed = value !== this.#lastValue;\n this.#lastValue = value;\n if (changed) this.#move = this.#moves.record();\n const move = this.#move;\n if (this.#writeField(value)) commitField(this.fieldTarget);\n if (generation !== this.#connectionGeneration || !this.#moves.isLatest(move)) return;\n if (changed) this.dispatch(\"change\", { detail: { value } });\n }\n\n /** Reflects one segment's value and controller-owned ARIA bounds/text. */\n #renderSegment(segment: HTMLElement): void {\n const kind = this.#kindOf(segment);\n if (!kind) return;\n this.#renderedSegments.add(segment);\n const value = this.#displayValue(kind);\n const text =\n kind === \"meridiem\" ? (value === PM ? this.pmLabelValue : this.amLabelValue) : pad(value);\n const { min, max } = this.#bounds(kind);\n\n const serialized = String(value);\n setAttributeIfChanged(segment, \"aria-valuenow\", serialized, () => {\n this.#observer.claim(segment, \"aria-valuenow\", serialized);\n });\n segment.setAttribute(\"aria-valuetext\", text);\n segment.setAttribute(\"aria-valuemin\", String(min));\n segment.setAttribute(\"aria-valuemax\", String(max));\n segment.textContent = text;\n }\n\n /** Writes a composed value to the optional form field and reports whether it changed. */\n #writeField(value: string): boolean {\n return this.hasFieldTarget && writeField(this.fieldTarget, value);\n }\n\n /** The canonical form value composed as `HH:MM[:SS]`. */\n get #composedValue(): string {\n const parts = [pad(this.#state.hour), pad(this.#state.minute)];\n if (this.secondsValue) parts.push(pad(this.#state.second));\n return parts.join(\":\");\n }\n\n /** Returns a canonical unit in the presentation form exposed by its segment. */\n #displayValue(kind: SegmentKind): number {\n if (kind === \"hour\") {\n const mode = this.#hourMode;\n if (mode === \"h23\") return this.#state.hour;\n const hour = this.#state.hour % 12;\n return mode === \"h11\" ? hour : hour || 12;\n }\n if (kind === \"meridiem\") return this.#state.hour >= 12 ? PM : AM;\n return this.#state[kind];\n }\n\n /** The inclusive controller-owned bounds for a segment kind. */\n #bounds(kind: SegmentKind): { min: number; max: number } {\n switch (kind) {\n case \"hour\":\n if (this.#hourMode === \"h23\") return { min: 0, max: 23 };\n return this.#hourMode === \"h11\" ? { min: 0, max: 11 } : { min: 1, max: 12 };\n case \"minute\":\n case \"second\":\n return { min: 0, max: 59 };\n case \"meridiem\":\n return { min: AM, max: PM };\n }\n }\n\n /** Watches retained segment state while excluding this controller's own reflections. */\n #observeMutations(): void {\n this.#observer.observe(this.element, {\n subtree: true,\n attributes: [\"aria-valuenow\", \"data-segment\"],\n });\n }\n\n /** Reads a segment's declared kind, or null when absent/invalid. */\n #kindOf(segment: HTMLElement): SegmentKind | null {\n const kind = segment.getAttribute(\"data-segment\");\n if (kind === \"hour\" || kind === \"minute\" || kind === \"second\" || kind === \"meridiem\") {\n return kind;\n }\n return null;\n }\n\n /** Canonical state as seconds since the start of its nominal day. */\n get #secondsOfDay(): number {\n return (\n this.#state.hour * SECONDS_PER_HOUR +\n this.#state.minute * SECONDS_PER_MINUTE +\n this.#state.second\n );\n }\n\n /** Selects one numeric presentation without inferring a language or changing time. */\n get #hourMode(): HourMode {\n if (this.#safeHourCycle !== 12) return \"h23\";\n return this.hour12ZeroBasedValue ? \"h11\" : \"h12\";\n }\n /** Current `hourCycle` declaration resolved against its numeric contract. */\n get #safeHourCycle(): number {\n return this.#numbers.read(\n this,\n \"hourCycle\",\n this.hourCycleValue,\n TimePickerController.values.hourCycle.default,\n TimePickerController.valueConstraints.hourCycle,\n );\n }\n\n /** Current `step` declaration resolved against its numeric contract. */\n get #safeStep(): number {\n return this.#numbers.read(\n this,\n \"step\",\n this.stepValue,\n TimePickerController.values.step.default,\n TimePickerController.valueConstraints.step,\n );\n }\n}\n\n/** Positive modulo for wrapping values in both keyboard directions. */\nfunction modulo(value: number, modulus: number): number {\n return ((value % modulus) + modulus) % modulus;\n}\n\n/** Zero-pads a number to two digits. */\nfunction pad(value: number): string {\n return String(value).padStart(2, \"0\");\n}\n"]}
@@ -169,11 +169,10 @@ declare class ToastController extends Controller<HTMLElement> {
169
169
  * Removes the oldest toasts while the list shows more than `maxValue`, passing
170
170
  * over every toast hover or focus holds.
171
171
  *
172
- * Public (not `#private`) as a deterministic seam: enforcement normally runs
173
- * as each toast is taken on in `itemTargetConnected`, a Stimulus callback delivered
174
- * through a MutationObserver, which a DOM-only environment does not reliably fire —
175
- * so it can also be invoked directly. It counts only the toasts taken on. It is not a
176
- * user-wired action.
172
+ * Public (not `#private`) as a deterministic seam: the limit is applied as each toast
173
+ * is taken on in `itemTargetConnected`, a callback Stimulus delivers through a
174
+ * MutationObserver, and this method applies it synchronously, without waiting for that
175
+ * delivery. It counts only the toasts taken on. It is not a user-wired action.
177
176
  */
178
177
  enforceMaxLimit(): void;
179
178
  }
@@ -41,6 +41,48 @@ var ListenerSet = class {
41
41
  }
42
42
  };
43
43
 
44
+ var HoverRecheck = class {
45
+ #document;
46
+ #release;
47
+ #listeners = new ListenerSet();
48
+ #pending = /* @__PURE__ */ new Set();
49
+ #tickets = /* @__PURE__ */ new WeakMap();
50
+ constructor(document2, release) {
51
+ this.#document = document2;
52
+ this.#release = release;
53
+ }
54
+ wait(element) {
55
+ this.#pending.add(element);
56
+ this.#tickets.set(element, /* @__PURE__ */ Symbol());
57
+ this.#listeners.add(this.#document, "pointermove", this.#onPointerMove, {
58
+ capture: true,
59
+ passive: true
60
+ });
61
+ }
62
+ cancel(element) {
63
+ this.#tickets.delete(element);
64
+ this.#pending.delete(element);
65
+ if (this.#pending.size === 0) this.#listeners.dispose();
66
+ }
67
+ dispose() {
68
+ this.#listeners.dispose();
69
+ this.#pending.clear();
70
+ this.#tickets = /* @__PURE__ */ new WeakMap();
71
+ }
72
+ #onPointerMove = () => {
73
+ this.#listeners.dispose();
74
+ const waiting = [...this.#pending].map(
75
+ (element) => [element, this.#tickets.get(element)]
76
+ );
77
+ this.#pending.clear();
78
+ for (const [element, ticket] of waiting) {
79
+ if (this.#tickets.get(element) !== ticket) continue;
80
+ if (element.matches(":hover")) continue;
81
+ this.#release(element);
82
+ }
83
+ };
84
+ };
85
+
44
86
  var MicrotaskCoalescer = class {
45
87
  #run;
46
88
  #queued = false;
@@ -57,6 +99,9 @@ var MicrotaskCoalescer = class {
57
99
  this.#queued = false;
58
100
  this.#generation += 1;
59
101
  }
102
+ get pending() {
103
+ return this.#queued;
104
+ }
60
105
  schedule() {
61
106
  if (!this.#active || this.#queued) return;
62
107
  this.#queued = true;
@@ -87,6 +132,9 @@ var MorphRenderWatcher = class {
87
132
  schedule() {
88
133
  this.#pass.schedule();
89
134
  }
135
+ get pending() {
136
+ return this.#pass.pending;
137
+ }
90
138
  disconnect() {
91
139
  this.#listeners.dispose();
92
140
  this.#pass.cancel();
@@ -323,10 +371,13 @@ var ToastController = class _ToastController extends Controller {
323
371
  #phases = /* @__PURE__ */ new WeakMap();
324
372
  #reapply = new MorphRenderWatcher(() => this.#reapplyLimit());
325
373
  #spared = [];
326
- #pointer = new ListenerSet();
327
- #awaitingPointer = /* @__PURE__ */ new Set();
374
+ #pointer = new HoverRecheck(
375
+ this.element.ownerDocument,
376
+ (item) => this.#release(item, "hover", null)
377
+ );
328
378
  #rafHandles = /* @__PURE__ */ new Map();
329
379
  #delegatedList = null;
380
+ #listListeners = new ListenerSet();
330
381
  #connected = false;
331
382
  #arrivals = /* @__PURE__ */ new Set();
332
383
  #appliedMax = null;
@@ -357,7 +408,6 @@ var ToastController = class _ToastController extends Controller {
357
408
  this.#reapply.disconnect();
358
409
  this.#spared = [];
359
410
  this.#pointer.dispose();
360
- this.#awaitingPointer.clear();
361
411
  for (const handle of this.#rafHandles.values()) {
362
412
  window.cancelAnimationFrame(handle);
363
413
  }
@@ -506,34 +556,18 @@ var ToastController = class _ToastController extends Controller {
506
556
  }
507
557
  #afterMove(item) {
508
558
  if (!item.contains(document.activeElement)) this.#release(item, "focus", null);
509
- if (this.#dismiss.isHeld(item)) this.#awaitPointer(item);
559
+ if (this.#dismiss.isHeld(item)) this.#pointer.wait(item);
510
560
  }
511
561
  #readHolds(item) {
512
562
  if (item.contains(document.activeElement)) this.#dismiss.pause(item, "focus");
513
563
  if (!item.matches(":hover")) return;
514
564
  this.#dismiss.pause(item, "hover");
515
- this.#awaitPointer(item);
565
+ this.#pointer.wait(item);
516
566
  }
517
- #awaitPointer(item) {
518
- this.#awaitingPointer.add(item);
519
- this.#pointer.add(document, "pointermove", this.#onPointerMove, {
520
- capture: true,
521
- passive: true
522
- });
523
- }
524
- #onPointerMove = () => {
525
- this.#pointer.dispose();
526
- const waiting = [...this.#awaitingPointer];
527
- this.#awaitingPointer.clear();
528
- for (const item of waiting) {
529
- if (!item.matches(":hover")) this.#release(item, "hover", null);
530
- }
531
- };
532
567
  #letGo(item) {
533
568
  if (this.#dismiss.isHeld(item)) this.#limitLater(null);
534
569
  this.#dismiss.clear(item);
535
- this.#awaitingPointer.delete(item);
536
- if (this.#awaitingPointer.size === 0) this.#pointer.dispose();
570
+ this.#pointer.cancel(item);
537
571
  }
538
572
  #itemFromSource(source) {
539
573
  const target = source.origin ?? source.host;
@@ -598,14 +632,11 @@ var ToastController = class _ToastController extends Controller {
598
632
  if (!list) return;
599
633
  this.#delegatedList = list;
600
634
  for (const type of DELEGATED_EVENTS) {
601
- this.#delegatedList.addEventListener(type, this.#onListEvent);
635
+ this.#listListeners.add(list, type, this.#onListEvent);
602
636
  }
603
637
  }
604
638
  #disconnectDelegatedEvents() {
605
- if (!this.#delegatedList) return;
606
- for (const type of DELEGATED_EVENTS) {
607
- this.#delegatedList.removeEventListener(type, this.#onListEvent);
608
- }
639
+ this.#listListeners.dispose();
609
640
  this.#delegatedList = null;
610
641
  }
611
642
  #onListEvent = (event) => {