stimeo-ui 0.5.0 → 0.7.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 (230) hide show
  1. package/CHANGELOG.md +178 -0
  2. package/dist/controllers/alert_dialog_controller.d.ts +2 -0
  3. package/dist/controllers/alert_dialog_controller.js +75 -4
  4. package/dist/controllers/alert_dialog_controller.js.map +1 -1
  5. package/dist/controllers/aspect_ratio_controller.d.ts +1 -3
  6. package/dist/controllers/aspect_ratio_controller.js +19 -11
  7. package/dist/controllers/aspect_ratio_controller.js.map +1 -1
  8. package/dist/controllers/auto_submit_controller.d.ts +2 -0
  9. package/dist/controllers/auto_submit_controller.js.map +1 -1
  10. package/dist/controllers/avatar_controller.d.ts +36 -15
  11. package/dist/controllers/avatar_controller.js +237 -40
  12. package/dist/controllers/avatar_controller.js.map +1 -1
  13. package/dist/controllers/breadcrumb_controller.d.ts +2 -0
  14. package/dist/controllers/breadcrumb_controller.js.map +1 -1
  15. package/dist/controllers/bulk_select_controller.d.ts +2 -0
  16. package/dist/controllers/bulk_select_controller.js.map +1 -1
  17. package/dist/controllers/calendar_controller.d.ts +2 -0
  18. package/dist/controllers/calendar_controller.js.map +1 -1
  19. package/dist/controllers/carousel_controller.d.ts +12 -3
  20. package/dist/controllers/carousel_controller.js +85 -9
  21. package/dist/controllers/carousel_controller.js.map +1 -1
  22. package/dist/controllers/character_counter_controller.d.ts +52 -20
  23. package/dist/controllers/character_counter_controller.js +338 -63
  24. package/dist/controllers/character_counter_controller.js.map +1 -1
  25. package/dist/controllers/checkbox_controller.d.ts +34 -5
  26. package/dist/controllers/checkbox_controller.js +136 -25
  27. package/dist/controllers/checkbox_controller.js.map +1 -1
  28. package/dist/controllers/color_picker_controller.d.ts +10 -1
  29. package/dist/controllers/color_picker_controller.js +35 -9
  30. package/dist/controllers/color_picker_controller.js.map +1 -1
  31. package/dist/controllers/combobox_controller.d.ts +2 -0
  32. package/dist/controllers/combobox_controller.js.map +1 -1
  33. package/dist/controllers/command_palette_controller.d.ts +2 -0
  34. package/dist/controllers/command_palette_controller.js +75 -4
  35. package/dist/controllers/command_palette_controller.js.map +1 -1
  36. package/dist/controllers/conditional_fields_controller.d.ts +42 -14
  37. package/dist/controllers/conditional_fields_controller.js +345 -51
  38. package/dist/controllers/conditional_fields_controller.js.map +1 -1
  39. package/dist/controllers/confirm_controller.d.ts +2 -0
  40. package/dist/controllers/confirm_controller.js +75 -4
  41. package/dist/controllers/confirm_controller.js.map +1 -1
  42. package/dist/controllers/count_up_controller.d.ts +2 -0
  43. package/dist/controllers/count_up_controller.js.map +1 -1
  44. package/dist/controllers/countdown_controller.d.ts +4 -0
  45. package/dist/controllers/countdown_controller.js.map +1 -1
  46. package/dist/controllers/currency_input_controller.d.ts +2 -0
  47. package/dist/controllers/currency_input_controller.js.map +1 -1
  48. package/dist/controllers/data_grid_controller.d.ts +3 -0
  49. package/dist/controllers/data_grid_controller.js.map +1 -1
  50. package/dist/controllers/date_range_picker_controller.d.ts +23 -4
  51. package/dist/controllers/date_range_picker_controller.js +157 -30
  52. package/dist/controllers/date_range_picker_controller.js.map +1 -1
  53. package/dist/controllers/dialog_controller.js +75 -4
  54. package/dist/controllers/dialog_controller.js.map +1 -1
  55. package/dist/controllers/direct_upload_controller.d.ts +56 -24
  56. package/dist/controllers/direct_upload_controller.js +201 -45
  57. package/dist/controllers/direct_upload_controller.js.map +1 -1
  58. package/dist/controllers/dirty_form_controller.d.ts +14 -6
  59. package/dist/controllers/dirty_form_controller.js +192 -29
  60. package/dist/controllers/dirty_form_controller.js.map +1 -1
  61. package/dist/controllers/dismissible_controller.d.ts +2 -0
  62. package/dist/controllers/dismissible_controller.js +83 -18
  63. package/dist/controllers/dismissible_controller.js.map +1 -1
  64. package/dist/controllers/drawer_controller.js +75 -4
  65. package/dist/controllers/drawer_controller.js.map +1 -1
  66. package/dist/controllers/empty_state_controller.d.ts +2 -0
  67. package/dist/controllers/empty_state_controller.js.map +1 -1
  68. package/dist/controllers/file_dropzone_controller.d.ts +9 -1
  69. package/dist/controllers/file_dropzone_controller.js +26 -3
  70. package/dist/controllers/file_dropzone_controller.js.map +1 -1
  71. package/dist/controllers/filter_controller.d.ts +2 -0
  72. package/dist/controllers/filter_controller.js.map +1 -1
  73. package/dist/controllers/flash_controller.d.ts +4 -0
  74. package/dist/controllers/flash_controller.js.map +1 -1
  75. package/dist/controllers/focus_controller.d.ts +4 -3
  76. package/dist/controllers/focus_controller.js +75 -4
  77. package/dist/controllers/focus_controller.js.map +1 -1
  78. package/dist/controllers/form_field_controller.d.ts +50 -10
  79. package/dist/controllers/form_field_controller.js +280 -62
  80. package/dist/controllers/form_field_controller.js.map +1 -1
  81. package/dist/controllers/form_validation_controller.d.ts +10 -8
  82. package/dist/controllers/form_validation_controller.js +208 -83
  83. package/dist/controllers/form_validation_controller.js.map +1 -1
  84. package/dist/controllers/frame_loading_controller.d.ts +2 -0
  85. package/dist/controllers/frame_loading_controller.js.map +1 -1
  86. package/dist/controllers/highlight_controller.d.ts +2 -0
  87. package/dist/controllers/highlight_controller.js.map +1 -1
  88. package/dist/controllers/hover_card_controller.d.ts +2 -2
  89. package/dist/controllers/hover_card_controller.js.map +1 -1
  90. package/dist/controllers/idle_controller.d.ts +5 -3
  91. package/dist/controllers/idle_controller.js +27 -5
  92. package/dist/controllers/idle_controller.js.map +1 -1
  93. package/dist/controllers/input_mask_controller.d.ts +2 -0
  94. package/dist/controllers/input_mask_controller.js.map +1 -1
  95. package/dist/controllers/lazy_frame_controller.d.ts +2 -0
  96. package/dist/controllers/lazy_frame_controller.js.map +1 -1
  97. package/dist/controllers/listbox_controller.d.ts +2 -0
  98. package/dist/controllers/listbox_controller.js.map +1 -1
  99. package/dist/controllers/local_time_controller.d.ts +2 -0
  100. package/dist/controllers/local_time_controller.js.map +1 -1
  101. package/dist/controllers/masonry_controller.d.ts +2 -0
  102. package/dist/controllers/masonry_controller.js.map +1 -1
  103. package/dist/controllers/menubar_controller.js +5 -3
  104. package/dist/controllers/menubar_controller.js.map +1 -1
  105. package/dist/controllers/meter_controller.d.ts +2 -0
  106. package/dist/controllers/meter_controller.js.map +1 -1
  107. package/dist/controllers/multi_select_controller.d.ts +48 -12
  108. package/dist/controllers/multi_select_controller.js +460 -151
  109. package/dist/controllers/multi_select_controller.js.map +1 -1
  110. package/dist/controllers/nested_form_controller.d.ts +2 -0
  111. package/dist/controllers/nested_form_controller.js.map +1 -1
  112. package/dist/controllers/network_status_controller.d.ts +2 -0
  113. package/dist/controllers/network_status_controller.js.map +1 -1
  114. package/dist/controllers/number_input_controller.d.ts +26 -6
  115. package/dist/controllers/number_input_controller.js +317 -51
  116. package/dist/controllers/number_input_controller.js.map +1 -1
  117. package/dist/controllers/otp_controller.d.ts +3 -0
  118. package/dist/controllers/otp_controller.js.map +1 -1
  119. package/dist/controllers/overflow_indicator_controller.d.ts +2 -0
  120. package/dist/controllers/overflow_indicator_controller.js.map +1 -1
  121. package/dist/controllers/overflow_menu_controller.d.ts +2 -0
  122. package/dist/controllers/overflow_menu_controller.js +6 -1
  123. package/dist/controllers/overflow_menu_controller.js.map +1 -1
  124. package/dist/controllers/pagination_controller.d.ts +2 -0
  125. package/dist/controllers/pagination_controller.js +35 -1
  126. package/dist/controllers/pagination_controller.js.map +1 -1
  127. package/dist/controllers/password_reveal_controller.d.ts +2 -0
  128. package/dist/controllers/password_reveal_controller.js.map +1 -1
  129. package/dist/controllers/password_strength_controller.d.ts +5 -3
  130. package/dist/controllers/password_strength_controller.js +20 -2
  131. package/dist/controllers/password_strength_controller.js.map +1 -1
  132. package/dist/controllers/persist_controller.d.ts +33 -19
  133. package/dist/controllers/persist_controller.js +449 -120
  134. package/dist/controllers/persist_controller.js.map +1 -1
  135. package/dist/controllers/pointer_drag_controller.d.ts +3 -0
  136. package/dist/controllers/pointer_drag_controller.js.map +1 -1
  137. package/dist/controllers/popover_controller.d.ts +2 -2
  138. package/dist/controllers/popover_controller.js +77 -4
  139. package/dist/controllers/popover_controller.js.map +1 -1
  140. package/dist/controllers/portal_controller.d.ts +3 -2
  141. package/dist/controllers/portal_controller.js.map +1 -1
  142. package/dist/controllers/preview_guard_controller.d.ts +2 -0
  143. package/dist/controllers/preview_guard_controller.js.map +1 -1
  144. package/dist/controllers/progress_controller.d.ts +3 -0
  145. package/dist/controllers/progress_controller.js.map +1 -1
  146. package/dist/controllers/radio_group_controller.d.ts +44 -15
  147. package/dist/controllers/radio_group_controller.js +540 -56
  148. package/dist/controllers/radio_group_controller.js.map +1 -1
  149. package/dist/controllers/rating_controller.d.ts +38 -31
  150. package/dist/controllers/rating_controller.js +276 -89
  151. package/dist/controllers/rating_controller.js.map +1 -1
  152. package/dist/controllers/reading_progress_controller.d.ts +2 -0
  153. package/dist/controllers/reading_progress_controller.js.map +1 -1
  154. package/dist/controllers/resizable_controller.d.ts +2 -0
  155. package/dist/controllers/resizable_controller.js +33 -0
  156. package/dist/controllers/resizable_controller.js.map +1 -1
  157. package/dist/controllers/roving_controller.d.ts +6 -0
  158. package/dist/controllers/roving_controller.js +60 -5
  159. package/dist/controllers/roving_controller.js.map +1 -1
  160. package/dist/controllers/scroll_area_controller.d.ts +25 -11
  161. package/dist/controllers/scroll_area_controller.js +557 -125
  162. package/dist/controllers/scroll_area_controller.js.map +1 -1
  163. package/dist/controllers/scroll_visibility_controller.d.ts +2 -0
  164. package/dist/controllers/scroll_visibility_controller.js +33 -0
  165. package/dist/controllers/scroll_visibility_controller.js.map +1 -1
  166. package/dist/controllers/scrollspy_controller.d.ts +2 -0
  167. package/dist/controllers/scrollspy_controller.js.map +1 -1
  168. package/dist/controllers/separator_controller.d.ts +54 -11
  169. package/dist/controllers/separator_controller.js +354 -38
  170. package/dist/controllers/separator_controller.js.map +1 -1
  171. package/dist/controllers/sidebar_controller.js +83 -10
  172. package/dist/controllers/sidebar_controller.js.map +1 -1
  173. package/dist/controllers/skeleton_controller.d.ts +2 -0
  174. package/dist/controllers/skeleton_controller.js.map +1 -1
  175. package/dist/controllers/slider_controller.d.ts +2 -0
  176. package/dist/controllers/slider_controller.js.map +1 -1
  177. package/dist/controllers/smart_sticky_header_controller.d.ts +2 -0
  178. package/dist/controllers/smart_sticky_header_controller.js.map +1 -1
  179. package/dist/controllers/spinner_controller.d.ts +2 -0
  180. package/dist/controllers/spinner_controller.js.map +1 -1
  181. package/dist/controllers/step_indicator_controller.d.ts +2 -0
  182. package/dist/controllers/step_indicator_controller.js.map +1 -1
  183. package/dist/controllers/stepper_controller.d.ts +2 -0
  184. package/dist/controllers/stepper_controller.js.map +1 -1
  185. package/dist/controllers/stick_to_bottom_controller.d.ts +2 -0
  186. package/dist/controllers/stick_to_bottom_controller.js.map +1 -1
  187. package/dist/controllers/sticky_observer_controller.d.ts +2 -0
  188. package/dist/controllers/sticky_observer_controller.js.map +1 -1
  189. package/dist/controllers/submit_once_controller.d.ts +94 -38
  190. package/dist/controllers/submit_once_controller.js +399 -121
  191. package/dist/controllers/submit_once_controller.js.map +1 -1
  192. package/dist/controllers/switch_controller.d.ts +2 -0
  193. package/dist/controllers/switch_controller.js.map +1 -1
  194. package/dist/controllers/tags_input_controller.d.ts +43 -11
  195. package/dist/controllers/tags_input_controller.js +356 -120
  196. package/dist/controllers/tags_input_controller.js.map +1 -1
  197. package/dist/controllers/textarea_autosize_controller.d.ts +2 -0
  198. package/dist/controllers/textarea_autosize_controller.js.map +1 -1
  199. package/dist/controllers/theme_controller.d.ts +2 -0
  200. package/dist/controllers/theme_controller.js +8 -6
  201. package/dist/controllers/theme_controller.js.map +1 -1
  202. package/dist/controllers/time_picker_controller.d.ts +44 -13
  203. package/dist/controllers/time_picker_controller.js +296 -107
  204. package/dist/controllers/time_picker_controller.js.map +1 -1
  205. package/dist/controllers/toast_controller.d.ts +4 -0
  206. package/dist/controllers/toast_controller.js.map +1 -1
  207. package/dist/controllers/toggle_group_controller.d.ts +41 -13
  208. package/dist/controllers/toggle_group_controller.js +378 -55
  209. package/dist/controllers/toggle_group_controller.js.map +1 -1
  210. package/dist/controllers/toolbar_controller.js +5 -3
  211. package/dist/controllers/toolbar_controller.js.map +1 -1
  212. package/dist/controllers/tooltip_controller.d.ts +2 -2
  213. package/dist/controllers/tooltip_controller.js.map +1 -1
  214. package/dist/controllers/transition_controller.d.ts +4 -3
  215. package/dist/controllers/transition_controller.js.map +1 -1
  216. package/dist/controllers/tree_view_controller.d.ts +2 -0
  217. package/dist/controllers/tree_view_controller.js +7 -4
  218. package/dist/controllers/tree_view_controller.js.map +1 -1
  219. package/dist/index.js +4963 -1581
  220. package/dist/index.js.map +1 -1
  221. package/dist/inspector/cli.d.ts +123 -6
  222. package/dist/inspector/cli.js +212 -18
  223. package/dist/inspector/cli.js.map +1 -1
  224. package/dist/inspector/cli_bin.js +274 -50
  225. package/dist/inspector/cli_bin.js.map +1 -1
  226. package/dist/inspector/examples.json +15 -15
  227. package/dist/inspector/manifest.json +602 -80
  228. package/dist/positioning/index.d.ts +4 -2
  229. package/dist/positioning/index.js.map +1 -1
  230. package/package.json +1 -1
@@ -8,82 +8,398 @@ function isReservedArrowChord(event, allow = []) {
8
8
  return event.altKey && !allow.includes("alt") || event.ctrlKey && !allow.includes("ctrl") || event.metaKey && !allow.includes("meta") || event.shiftKey && !allow.includes("shift");
9
9
  }
10
10
 
11
- // src/utils/default_attribute.ts
12
- function setDefaultAttribute(element, name, value) {
13
- if (element.hasAttribute(name)) return false;
14
- element.setAttribute(name, value);
15
- return true;
11
+ // src/utils/attribute_lease.ts
12
+ var AttributeLease = class {
13
+ #attribute;
14
+ #records = /* @__PURE__ */ new Map();
15
+ /** @param attribute - The attribute whose temporary values this lease owns. */
16
+ constructor(attribute) {
17
+ this.#attribute = attribute;
18
+ }
19
+ /** Writes or removes the leased attribute while preserving its authored value. */
20
+ write(element, value) {
21
+ const existing = this.#records.get(element);
22
+ if (existing) {
23
+ existing.written = value;
24
+ } else {
25
+ this.#records.set(element, {
26
+ original: element.getAttribute(this.#attribute),
27
+ written: value
28
+ });
29
+ }
30
+ this.#reflect(element, value);
31
+ }
32
+ /** Returns one lease without overwriting a value subsequently authored by a consumer. */
33
+ return(element) {
34
+ const record = this.#records.get(element);
35
+ if (!record) return;
36
+ this.#records.delete(element);
37
+ const stillOwned = element.getAttribute(this.#attribute) === record.written;
38
+ if (stillOwned) this.#reflect(element, record.original);
39
+ }
40
+ /** Reflects only a real value transition, avoiding self-triggered mutation work. */
41
+ #reflect(element, value) {
42
+ if (element.getAttribute(this.#attribute) === value) return;
43
+ if (value === null) element.removeAttribute(this.#attribute);
44
+ else element.setAttribute(this.#attribute, value);
45
+ }
46
+ /** Returns every outstanding lease using the same ownership check as {@link return}. */
47
+ returnAll() {
48
+ for (const element of Array.from(this.#records.keys())) this.return(element);
49
+ }
50
+ };
51
+
52
+ // src/utils/before_cache_reset.ts
53
+ var BeforeCacheReset = class _BeforeCacheReset {
54
+ /** Every subscribed instance, iterated by the one shared document listener. */
55
+ static #subscribers = /* @__PURE__ */ new Set();
56
+ /** The shared listener; installed while at least one instance is subscribed. */
57
+ static #onBeforeCache = () => {
58
+ for (const subscriber of _BeforeCacheReset.#subscribers) subscriber.#rewind();
59
+ };
60
+ #rewind;
61
+ /** @param rewind - the pass that returns this controller's state to its initial form. */
62
+ constructor(rewind) {
63
+ this.#rewind = rewind;
64
+ }
65
+ /** Subscribes to `turbo:before-cache`; call from `connect()`. Idempotent. */
66
+ activate() {
67
+ const first = _BeforeCacheReset.#subscribers.size === 0;
68
+ _BeforeCacheReset.#subscribers.add(this);
69
+ if (first) {
70
+ document.addEventListener("turbo:before-cache", _BeforeCacheReset.#onBeforeCache);
71
+ }
72
+ }
73
+ /** Unsubscribes; call from `disconnect()`. Safe when never subscribed. */
74
+ deactivate() {
75
+ _BeforeCacheReset.#subscribers.delete(this);
76
+ if (_BeforeCacheReset.#subscribers.size > 0) return;
77
+ document.removeEventListener("turbo:before-cache", _BeforeCacheReset.#onBeforeCache);
78
+ }
79
+ };
80
+
81
+ // src/utils/microtask_coalescer.ts
82
+ var MicrotaskCoalescer = class {
83
+ #run;
84
+ #queued = false;
85
+ #active = false;
86
+ #generation = 0;
87
+ /** @param run - the single reconciliation pass, invoked at most once per batch. */
88
+ constructor(run) {
89
+ this.#run = run;
90
+ }
91
+ /** Opens the window in which {@link schedule} is honoured; call from `connect()`. */
92
+ activate() {
93
+ this.#active = true;
94
+ }
95
+ /** Closes the window and drops any pending pass; call from `disconnect()`. */
96
+ cancel() {
97
+ this.#active = false;
98
+ this.#queued = false;
99
+ this.#generation += 1;
100
+ }
101
+ /** Requests one pass after the batch settles. Idempotent; inert outside the window. */
102
+ schedule() {
103
+ if (!this.#active || this.#queued) return;
104
+ this.#queued = true;
105
+ const generation = this.#generation;
106
+ queueMicrotask(() => {
107
+ if (generation !== this.#generation || !this.#queued || !this.#active) return;
108
+ this.#queued = false;
109
+ this.#run();
110
+ });
111
+ }
112
+ };
113
+
114
+ // src/utils/stepped_value.ts
115
+ function effectiveStep(step) {
116
+ return Number.isFinite(step) && step > 0 ? step : 1;
117
+ }
118
+ function snapSteppedValue(raw, range) {
119
+ if (!(range.min <= range.max)) return finiteFallback(range.min, range.max);
120
+ const input = Number.isNaN(raw) ? finiteFallback(range.min, range.max) : raw;
121
+ const clamped = Math.min(range.max, Math.max(range.min, input));
122
+ const step = effectiveStep(range.step);
123
+ const base = stepBase(range);
124
+ const candidates = [];
125
+ if (Number.isFinite(range.min)) candidates.push(range.min);
126
+ if (Number.isFinite(range.max)) candidates.push(range.max);
127
+ const gridPosition = (clamped - base) / step;
128
+ if (Number.isFinite(gridPosition)) {
129
+ addGridCandidate(candidates, Math.floor(gridPosition), range, base, step);
130
+ addGridCandidate(candidates, Math.ceil(gridPosition), range, base, step);
131
+ }
132
+ if (candidates.length === 0) return clamped;
133
+ let nearest = candidates[0];
134
+ let nearestDistance = Math.abs(clamped - nearest);
135
+ for (const candidate of candidates.slice(1)) {
136
+ const distance = Math.abs(clamped - candidate);
137
+ if (distance < nearestDistance || nearlyEqual(distance, nearestDistance) && candidate > nearest) {
138
+ nearest = candidate;
139
+ nearestDistance = distance;
140
+ }
141
+ }
142
+ return nearest;
143
+ }
144
+ function stepSteppedValue(current, count, range) {
145
+ const value = snapSteppedValue(current, range);
146
+ const distance = Math.abs(Math.trunc(count));
147
+ if (!Number.isFinite(distance) || distance === 0) return value;
148
+ const direction = Math.sign(count);
149
+ const adjacent = adjacentSteppedValue(value, direction, range);
150
+ const raw = adjacent + direction * (distance - 1) * effectiveStep(range.step);
151
+ return snapSteppedValue(raw, range);
152
+ }
153
+ function adjacentSteppedValue(current, direction, range) {
154
+ const step = effectiveStep(range.step);
155
+ const base = stepBase(range);
156
+ const candidates = [];
157
+ if (direction > 0) {
158
+ const position2 = (current - base) / step;
159
+ if (Number.isFinite(position2)) {
160
+ let gridIndex = Math.floor(position2) + 1;
161
+ let candidate = cleanGridValue(base + gridIndex * step, base, step);
162
+ if (candidate < current || nearlyEqual(candidate, current)) {
163
+ gridIndex += 1;
164
+ candidate = cleanGridValue(base + gridIndex * step, base, step);
165
+ }
166
+ if (candidate > current && !nearlyEqual(candidate, current) && within(candidate, range.min, range.max)) {
167
+ candidates.push(clamp(candidate, range));
168
+ }
169
+ }
170
+ return clamp(Math.min(...candidates), range);
171
+ }
172
+ const position = (current - base) / step;
173
+ if (Number.isFinite(position)) {
174
+ let gridIndex = Math.ceil(position) - 1;
175
+ let candidate = cleanGridValue(base + gridIndex * step, base, step);
176
+ if (candidate > current || nearlyEqual(candidate, current)) {
177
+ gridIndex -= 1;
178
+ candidate = cleanGridValue(base + gridIndex * step, base, step);
179
+ }
180
+ if (candidate < current && !nearlyEqual(candidate, current) && within(candidate, range.min, range.max)) {
181
+ candidates.push(clamp(candidate, range));
182
+ }
183
+ }
184
+ return clamp(Math.max(...candidates), range);
185
+ }
186
+ function addGridCandidate(candidates, index, range, base, step) {
187
+ const candidate = cleanGridValue(base + index * step, base, step);
188
+ if (within(candidate, range.min, range.max)) candidates.push(clamp(candidate, range));
189
+ }
190
+ function stepBase(range) {
191
+ if (range.base !== void 0 && Number.isFinite(range.base)) return range.base;
192
+ return Number.isFinite(range.min) ? range.min : 0;
193
+ }
194
+ function cleanGridValue(value, base, step) {
195
+ const precision = Math.max(decimalPlaces(base), decimalPlaces(step));
196
+ return precision <= 100 ? Number(value.toFixed(precision)) : value;
197
+ }
198
+ function decimalPlaces(value) {
199
+ const [coefficient = "", exponentText] = Math.abs(value).toString().toLowerCase().split("e");
200
+ const fractionLength = coefficient.split(".")[1]?.length ?? 0;
201
+ const exponent = exponentText === void 0 ? 0 : Number(exponentText);
202
+ return Math.max(0, fractionLength - exponent);
203
+ }
204
+ function within(value, min, max) {
205
+ return (value > min || nearlyEqual(value, min)) && (value < max || nearlyEqual(value, max));
206
+ }
207
+ function clamp(value, range) {
208
+ return Math.min(range.max, Math.max(range.min, value));
209
+ }
210
+ function nearlyEqual(left, right) {
211
+ const scale = Math.max(Math.abs(left), Math.abs(right));
212
+ return Number.isFinite(left) && Number.isFinite(right) && Math.abs(left - right) <= Number.EPSILON * scale;
213
+ }
214
+ function finiteFallback(min, max) {
215
+ if (Number.isFinite(min)) return min;
216
+ if (Number.isFinite(max)) return max;
217
+ return 0;
16
218
  }
17
219
 
18
220
  // src/controllers/separator_controller.ts
221
+ var DEFAULT_MIN = 0;
222
+ var DEFAULT_MAX = 100;
19
223
  var SeparatorController = class extends Controller {
20
224
  static values = {
21
225
  orientation: { type: String, default: "horizontal" },
22
226
  focusable: { type: Boolean, default: false },
23
- step: { type: Number, default: 1 }
227
+ min: { type: Number, default: DEFAULT_MIN },
228
+ max: { type: Number, default: DEFAULT_MAX },
229
+ step: { type: Number, default: 1 },
230
+ value: { type: Number, default: DEFAULT_MIN }
24
231
  };
25
232
  static actions = ["onKeydown"];
26
233
  static events = ["change"];
234
+ #role = new AttributeLease("role");
235
+ #tabindex = new AttributeLease("tabindex");
236
+ #orientation = new AttributeLease("aria-orientation");
237
+ #minimum = new AttributeLease("aria-valuemin");
238
+ #maximum = new AttributeLease("aria-valuemax");
239
+ #current = new AttributeLease("aria-valuenow");
240
+ /** Collapses a morph that changes several render Values into one silent repaint. */
241
+ #repaint = new MicrotaskCoalescer(() => this.#render());
242
+ /** Restores authored semantics before Turbo snapshots the element. */
243
+ #beforeCache = new BeforeCacheReset(() => this.#rewindForCache());
244
+ /** Hydrates legacy ARIA input once, normalizes the current Value, and renders. */
27
245
  connect() {
28
- setDefaultAttribute(this.element, "role", "separator");
29
- setDefaultAttribute(this.element, "aria-orientation", this.orientationValue);
30
- if (this.focusableValue) {
31
- setDefaultAttribute(this.element, "tabindex", "0");
32
- setDefaultAttribute(this.element, "aria-valuemin", "0");
33
- setDefaultAttribute(this.element, "aria-valuemax", "100");
34
- setDefaultAttribute(this.element, "aria-valuenow", String(this.#clamp(this.#value)));
35
- }
246
+ this.#hydrateValues();
247
+ this.#repaint.activate();
248
+ this.#beforeCache.activate();
249
+ const value = this.#currentValue();
250
+ if (!Object.is(this.valueValue, value)) this.valueValue = value;
251
+ this.#render();
252
+ }
253
+ /** Cancels repaint work and returns every semantic attribute this instance controlled. */
254
+ disconnect() {
255
+ this.#repaint.cancel();
256
+ this.#beforeCache.deactivate();
257
+ this.#returnAttributes();
258
+ }
259
+ /** Silently repaints an orientation changed by application code or a Turbo morph. */
260
+ orientationValueChanged() {
261
+ this.#repaint.schedule();
262
+ }
263
+ /** Silently adds or removes the focusable range semantics at runtime. */
264
+ focusableValueChanged() {
265
+ this.#repaint.schedule();
266
+ }
267
+ /** Silently repaints a minimum changed by application code or a Turbo morph. */
268
+ minValueChanged() {
269
+ this.#repaint.schedule();
270
+ }
271
+ /** Silently repaints a maximum changed by application code or a Turbo morph. */
272
+ maxValueChanged() {
273
+ this.#repaint.schedule();
274
+ }
275
+ /** Silently repaints a step changed by application code or a Turbo morph. */
276
+ stepValueChanged() {
277
+ this.#repaint.schedule();
278
+ }
279
+ /** Silently repaints a current value changed by application code or a Turbo morph. */
280
+ valueValueChanged() {
281
+ this.#repaint.schedule();
36
282
  }
37
283
  /** Adjusts the value on arrow / Home / End keys (focusable variant only). */
38
284
  onKeydown(event) {
39
- if (isReservedArrowChord(event)) return;
40
- if (!this.focusableValue) return;
41
- const horizontal = this.element.getAttribute("aria-orientation") !== "vertical";
285
+ if (isReservedArrowChord(event) || !this.focusableValue) return;
286
+ const horizontal = this.#effectiveOrientation === "horizontal";
287
+ const range = this.#effectiveRange;
288
+ const current = snapSteppedValue(this.valueValue, range);
42
289
  let next = null;
43
290
  switch (event.key) {
44
291
  case "ArrowUp":
45
- if (horizontal) next = this.#value + this.stepValue;
292
+ if (horizontal) next = stepSteppedValue(current, 1, range);
46
293
  break;
47
294
  case "ArrowDown":
48
- if (horizontal) next = this.#value - this.stepValue;
295
+ if (horizontal) next = stepSteppedValue(current, -1, range);
49
296
  break;
50
297
  case "ArrowRight":
51
- if (!horizontal) next = this.#value + this.stepValue;
298
+ if (!horizontal) next = stepSteppedValue(current, 1, range);
52
299
  break;
53
300
  case "ArrowLeft":
54
- if (!horizontal) next = this.#value - this.stepValue;
301
+ if (!horizontal) next = stepSteppedValue(current, -1, range);
55
302
  break;
56
303
  case "Home":
57
- next = this.#min;
304
+ next = range.min;
58
305
  break;
59
306
  case "End":
60
- next = this.#max;
307
+ next = range.max;
61
308
  break;
62
309
  default:
63
310
  return;
64
311
  }
65
312
  if (next === null) return;
66
313
  event.preventDefault();
67
- const clamped = this.#clamp(next);
68
- if (clamped === this.#value) return;
69
- this.element.setAttribute("aria-valuenow", String(clamped));
70
- this.dispatch("change", { detail: { value: clamped } });
314
+ this.#commit(next, current);
315
+ }
316
+ /** Stores a normalized user value, renders immediately, and reports real changes. */
317
+ #commit(raw, previous) {
318
+ const value = snapSteppedValue(raw, this.#effectiveRange);
319
+ if (!Object.is(this.valueValue, value)) this.valueValue = value;
320
+ this.#render();
321
+ if (value !== previous) this.dispatch("change", { detail: { value } });
71
322
  }
72
- get #value() {
73
- return this.#numericAttr("aria-valuenow", 0);
323
+ /**
324
+ * Reflects live Values into the connected element without dispatching.
325
+ *
326
+ * @stimeoRenderRoot
327
+ */
328
+ #render() {
329
+ const range = this.#effectiveRange;
330
+ const value = snapSteppedValue(this.valueValue, range);
331
+ this.#role.write(this.element, "separator");
332
+ this.#orientation.write(this.element, this.#effectiveOrientation);
333
+ if (!this.focusableValue) {
334
+ this.#tabindex.write(this.element, null);
335
+ this.#minimum.write(this.element, null);
336
+ this.#maximum.write(this.element, null);
337
+ this.#current.write(this.element, null);
338
+ return;
339
+ }
340
+ this.#tabindex.write(this.element, "0");
341
+ this.#minimum.write(this.element, String(range.min));
342
+ this.#maximum.write(this.element, String(range.max));
343
+ this.#current.write(this.element, String(value));
344
+ }
345
+ /** Effective orientation; unknown strings fall back to the horizontal contract. */
346
+ get #effectiveOrientation() {
347
+ return this.orientationValue === "vertical" ? "vertical" : "horizontal";
348
+ }
349
+ /** Finite, ordered range shared by rendering and keyboard stepping. */
350
+ get #effectiveRange() {
351
+ const min = Number.isFinite(this.minValue) ? this.minValue : DEFAULT_MIN;
352
+ const candidateMax = Number.isFinite(this.maxValue) ? this.maxValue : DEFAULT_MAX;
353
+ return {
354
+ min,
355
+ max: Math.max(min, candidateMax),
356
+ step: this.stepValue,
357
+ base: min
358
+ };
359
+ }
360
+ /** Current normalized value derived from the live declarative inputs. */
361
+ #currentValue() {
362
+ return snapSteppedValue(this.valueValue, this.#effectiveRange);
363
+ }
364
+ /** Copies valid authored ARIA into Values only when no explicit Value exists. */
365
+ #hydrateValues() {
366
+ if (!this.#hasInput("orientation")) {
367
+ const orientation = this.element.getAttribute("aria-orientation");
368
+ if (orientation === "horizontal" || orientation === "vertical") {
369
+ this.orientationValue = orientation;
370
+ }
371
+ }
372
+ const min = this.#finiteAttribute("aria-valuemin");
373
+ if (!this.#hasInput("min") && min !== null) this.minValue = min;
374
+ const max = this.#finiteAttribute("aria-valuemax");
375
+ if (!this.#hasInput("max") && max !== null) this.maxValue = max;
376
+ const value = this.#finiteAttribute("aria-valuenow");
377
+ if (!this.#hasInput("value") && value !== null) this.valueValue = value;
74
378
  }
75
- get #min() {
76
- return this.#numericAttr("aria-valuemin", 0);
379
+ /** Whether the author supplied the namespaced Value instead of using its default. */
380
+ #hasInput(name) {
381
+ return this.element.hasAttribute(`data-${this.identifier}-${name}-value`);
77
382
  }
78
- get #max() {
79
- return this.#numericAttr("aria-valuemax", 100);
383
+ /** Strict finite-number parser for the one-time progressive-enhancement bridge. */
384
+ #finiteAttribute(name) {
385
+ const raw = this.element.getAttribute(name);
386
+ if (raw === null || raw.trim() === "") return null;
387
+ const value = Number(raw);
388
+ return Number.isFinite(value) ? value : null;
80
389
  }
81
- #clamp(value) {
82
- return Math.min(this.#max, Math.max(this.#min, value));
390
+ /** Returns attributes without overwriting values a consumer changed after render. */
391
+ #returnAttributes() {
392
+ this.#role.return(this.element);
393
+ this.#tabindex.return(this.element);
394
+ this.#orientation.return(this.element);
395
+ this.#minimum.return(this.element);
396
+ this.#maximum.return(this.element);
397
+ this.#current.return(this.element);
83
398
  }
84
- #numericAttr(name, fallback) {
85
- const parsed = Number.parseFloat(this.element.getAttribute(name) ?? "");
86
- return Number.isNaN(parsed) ? fallback : parsed;
399
+ /** Prevents a queued Value repaint from racing Turbo's restored snapshot. */
400
+ #rewindForCache() {
401
+ this.#repaint.cancel();
402
+ this.#returnAttributes();
87
403
  }
88
404
  };
89
405
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/arrow_step.ts","../../src/utils/default_attribute.ts","../../src/controllers/separator_controller.ts"],"names":[],"mappings":";;;;;AA+FO,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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AI,CAAA;AAChC,IAAA,IAAI,OAAA,KAAY,KAAK,MAAA,EAAQ;AAE7B,IAAA,IAAA,CAAK,OAAA,CAAQ,YAAA,CAAa,eAAA,EAAiB,MAAA,CAAO,OAAO,CAAC,CAAA;AAC1D,IAAA,IAAA,CAAK,QAAA,CAAS,UAAU,EAAE,MAAA,EAAQ,EAAE,KAAA,EAAO,OAAA,IAAW,CAAA;AAAA,EACxD;AAAA,EAEA,IAAI,MAAA,GAAiB;AACnB,IAAA,OAAO,IAAA,CAAK,YAAA,CAAa,eAAA,EAAiB,CAAC,CAAA;AAAA,EAC7C;AAAA,EAEA,IAAI,IAAA,GAAe;AACjB,IAAA,OAAO,IAAA,CAAK,YAAA,CAAa,eAAA,EAAiB,CAAC,CAAA;AAAA,EAC7C;AAAA,EAEA,IAAI,IAAA,GAAe;AACjB,IAAA,OAAO,IAAA,CAAK,YAAA,CAAa,eAAA,EAAiB,GAAG,CAAA;AAAA,EAC/C;AAAA,EAEA,OAAO,KAAA,EAAuB;AAC5B,IAAA,OAAO,IAAA,CAAK,IAAI,IAAA,CAAK,IAAA,EAAM,KAAK,GAAA,CAAI,IAAA,CAAK,IAAA,EAAM,KAAK,CAAC,CAAA;AAAA,EACvD;AAAA,EAEA,YAAA,CAAa,MAAc,QAAA,EAA0B;AACnD,IAAA,MAAM,MAAA,GAAS,OAAO,UAAA,CAAW,IAAA,CAAK,QAAQ,YAAA,CAAa,IAAI,KAAK,EAAE,CAAA;AACtE,IAAA,OAAO,MAAA,CAAO,KAAA,CAAM,MAAM,CAAA,GAAI,QAAA,GAAW,MAAA;AAAA,EAC3C;AACF","file":"separator_controller.js","sourcesContent":["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 * Adds an attribute default without displacing an authored value.\n *\n * Attribute presence — including an authored empty string — is the ownership\n * boundary. The return value lets a caller remember that it supplied the\n * default when that caller must later restore the authored state.\n *\n * @param element - Element that owns the attribute\n * @param name - Attribute name\n * @param value - Value to write only when the attribute is absent\n * @returns Whether this call added the attribute\n */\nexport function setDefaultAttribute(element: Element, name: string, value: string): boolean {\n if (element.hasAttribute(name)) return false;\n element.setAttribute(name, value);\n return true;\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport { isReservedArrowChord } from \"../utils/arrow_step\";\nimport { setDefaultAttribute } from \"../utils/default_attribute\";\n\n/**\n * Headless **Separator** behavior. The normative source depends on the case:\n * a decorative divider follows the WAI-ARIA `separator` role\n * (https://www.w3.org/TR/wai-aria-1.2/#separator), while the focusable,\n * value-bearing divider follows the APG Window Splitter pattern\n * (https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/).\n *\n * Markup contract (identifier: `stimeo--separator`):\n * <!-- decorative -->\n * <div data-controller=\"stimeo--separator\" role=\"separator\"\n * data-stimeo--separator-orientation-value=\"horizontal\"></div>\n *\n * <!-- focusable, value-bearing -->\n * <div data-controller=\"stimeo--separator\" role=\"separator\" tabindex=\"0\"\n * aria-labelledby=\"sidebar-heading\" aria-controls=\"sidebar\"\n * aria-orientation=\"vertical\"\n * aria-valuemin=\"0\" aria-valuemax=\"100\" aria-valuenow=\"50\"\n * data-stimeo--separator-focusable-value=\"true\"\n * data-action=\"keydown->stimeo--separator#onKeydown\"></div>\n *\n * Most separators are static (`role=\"separator\"` + `aria-orientation`); this\n * controller adds those semantics and, for the optional **focusable** variant,\n * keeps `aria-valuenow` in sync and emits arrow-key value changes. The actual\n * pane resize/drag is out of scope — that belongs to {@link ResizableController}.\n *\n * @remarks\n * Behavior only — line drawing is the consumer's CSS. The axis follows Window\n * Splitter: a vertical divider takes ArrowLeft/ArrowRight, a horizontal one\n * takes ArrowUp/ArrowDown. Which end counts as an increase is not defined\n * there, so it follows the slider convention (ArrowRight/ArrowUp increase).\n * Home/End are optional in the pattern and are implemented here; F6 is not.\n *\n * Because no position is ever applied here, two Window Splitter requirements\n * fall to the consumer: `aria-controls` naming the **primary** pane — the one\n * whose size the value reports — and `Enter` to toggle collapse/restore, since\n * collapsing applies a position — {@link ResizableController} implements that\n * key for the same divider. Because the increment direction is fixed, the primary pane can only\n * be the left one for a vertical splitter and the bottom one for a horizontal\n * splitter: those are the panes that grow as ArrowRight/ArrowUp raise the value.\n */\nexport class SeparatorController extends Controller<HTMLElement> {\n static override values = {\n orientation: { type: String, default: \"horizontal\" },\n focusable: { type: Boolean, default: false },\n step: { type: Number, default: 1 },\n };\n static actions = [\"onKeydown\"] as const;\n static events = [\"change\"] as const;\n\n declare orientationValue: string;\n declare focusableValue: boolean;\n declare stepValue: number;\n\n override connect(): void {\n setDefaultAttribute(this.element, \"role\", \"separator\");\n setDefaultAttribute(this.element, \"aria-orientation\", this.orientationValue);\n\n if (this.focusableValue) {\n setDefaultAttribute(this.element, \"tabindex\", \"0\");\n // A value-bearing separator needs a bounded range; default it if the\n // consumer left any bound off so arrow keys have something to clamp to.\n setDefaultAttribute(this.element, \"aria-valuemin\", \"0\");\n setDefaultAttribute(this.element, \"aria-valuemax\", \"100\");\n setDefaultAttribute(this.element, \"aria-valuenow\", String(this.#clamp(this.#value)));\n }\n }\n\n /** Adjusts the value on arrow / Home / End keys (focusable variant only). */\n onKeydown(event: KeyboardEvent): void {\n if (isReservedArrowChord(event)) return;\n if (!this.focusableValue) return;\n\n // `aria-orientation` is the source of truth (connect seeds it from the\n // orientation value when the consumer left it off), so the focusable variant\n // that sets the attribute directly drives the axis correctly.\n const horizontal = this.element.getAttribute(\"aria-orientation\") !== \"vertical\";\n let next: number | null = null;\n switch (event.key) {\n case \"ArrowUp\":\n if (horizontal) next = this.#value + this.stepValue;\n break;\n case \"ArrowDown\":\n if (horizontal) next = this.#value - this.stepValue;\n break;\n case \"ArrowRight\":\n if (!horizontal) next = this.#value + this.stepValue;\n break;\n case \"ArrowLeft\":\n if (!horizontal) next = this.#value - this.stepValue;\n break;\n case \"Home\":\n next = this.#min;\n break;\n case \"End\":\n next = this.#max;\n break;\n default:\n return;\n }\n if (next === null) return;\n\n event.preventDefault();\n const clamped = this.#clamp(next);\n if (clamped === this.#value) return;\n\n this.element.setAttribute(\"aria-valuenow\", String(clamped));\n this.dispatch(\"change\", { detail: { value: clamped } });\n }\n\n get #value(): number {\n return this.#numericAttr(\"aria-valuenow\", 0);\n }\n\n get #min(): number {\n return this.#numericAttr(\"aria-valuemin\", 0);\n }\n\n get #max(): number {\n return this.#numericAttr(\"aria-valuemax\", 100);\n }\n\n #clamp(value: number): number {\n return Math.min(this.#max, Math.max(this.#min, value));\n }\n\n #numericAttr(name: string, fallback: number): number {\n const parsed = Number.parseFloat(this.element.getAttribute(name) ?? \"\");\n return Number.isNaN(parsed) ? fallback : parsed;\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/utils/arrow_step.ts","../../src/utils/attribute_lease.ts","../../src/utils/before_cache_reset.ts","../../src/utils/microtask_coalescer.ts","../../src/utils/stepped_value.ts","../../src/controllers/separator_controller.ts"],"names":["position"],"mappings":";;;;;AA+FO,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;;;AClFO,IAAM,iBAAN,MAAkD;AAAA,EAC9C,UAAA;AAAA,EACA,QAAA,uBAAe,GAAA,EAA6B;AAAA;AAAA,EAGrD,YAAY,SAAA,EAAmB;AAC7B,IAAA,IAAA,CAAK,UAAA,GAAa,SAAA;AAAA,EACpB;AAAA;AAAA,EAGA,KAAA,CAAM,SAAY,KAAA,EAA4B;AAC5C,IAAA,MAAM,QAAA,GAAW,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,OAAO,CAAA;AAC1C,IAAA,IAAI,QAAA,EAAU;AACZ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O,CAAA;AAAA,EACnC;AAAA;AAAA,EAGA,eAAA,GAAwB;AACtB,IAAA,IAAA,CAAK,SAAS,MAAA,EAAO;AACrB,IAAA,IAAA,CAAK,iBAAA,EAAkB;AAAA,EACzB;AACF","file":"separator_controller.js","sourcesContent":["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","/** One temporarily controlled attribute value and the authored value it displaced. */\ninterface AttributeLeaseRecord {\n readonly original: string | null;\n written: string | null;\n}\n\n/**\n * Temporarily controls one attribute across a changing set of elements.\n *\n * The first write remembers the authored value, including the distinction between\n * an absent attribute and an authored empty string. Returning a lease restores that\n * value only while the attribute still matches the controller's last write. If a\n * consumer changed it in the meantime, the consumer owns the new value and teardown\n * leaves it alone.\n *\n * A `null` write deliberately removes the attribute while retaining the lease. This\n * is useful for derived ARIA whose valid absence is itself controller state, such as\n * an unbounded `aria-valuemin` or a blank spinbutton's `aria-valuenow`.\n *\n * The lease has no lifecycle of its own, so it never subscribes to document events.\n * A consumer that must not let a derived value become the authored baseline of a\n * cached page returns its leases from its own `turbo:before-cache` rewind, where the\n * matching `disconnect()` also releases the subscription.\n */\nexport class AttributeLease<T extends Element = Element> {\n readonly #attribute: string;\n readonly #records = new Map<T, AttributeLeaseRecord>();\n\n /** @param attribute - The attribute whose temporary values this lease owns. */\n constructor(attribute: string) {\n this.#attribute = attribute;\n }\n\n /** Writes or removes the leased attribute while preserving its authored value. */\n write(element: T, value: string | null): void {\n const existing = this.#records.get(element);\n if (existing) {\n existing.written = value;\n } else {\n this.#records.set(element, {\n original: element.getAttribute(this.#attribute),\n written: value,\n });\n }\n\n this.#reflect(element, value);\n }\n\n /** Returns one lease without overwriting a value subsequently authored by a consumer. */\n return(element: T): void {\n const record = this.#records.get(element);\n if (!record) return;\n this.#records.delete(element);\n const stillOwned = element.getAttribute(this.#attribute) === record.written;\n if (stillOwned) this.#reflect(element, record.original);\n }\n\n /** Reflects only a real value transition, avoiding self-triggered mutation work. */\n #reflect(element: T, value: string | null): void {\n if (element.getAttribute(this.#attribute) === value) return;\n if (value === null) element.removeAttribute(this.#attribute);\n else element.setAttribute(this.#attribute, value);\n }\n\n /** Returns every outstanding lease using the same ownership check as {@link return}. */\n returnAll(): void {\n for (const element of Array.from(this.#records.keys())) this.return(element);\n }\n}\n","/**\n * Runs a controller's \"return to the initial state\" pass just before Turbo\n * caches the page.\n *\n * **`disconnect()` cannot do this job, for two independent reasons.** Turbo\n * queues the clone from this event rather than taking it here, and the body swap\n * that runs the controller's `disconnect()` is queued separately — so which of\n * the two lands first is not something a controller can rely on, and a rewind\n * written in `disconnect()` may reach only the DOM being thrown away. In the\n * other direction, `disconnect()` also fires on an in-page move (Stimulus tears\n * down and reconnects the same element), where rewinding would wipe a\n * legitimately in-progress interaction — a spinner mid-load would vanish. One\n * timing is unreliable, the other is too eager; `turbo:before-cache` is the only\n * point that is exactly \"the page is about to be frozen\".\n *\n * Scope is the subscription only: registering on `activate()`, unregistering on\n * `deactivate()`, and one shared document listener no matter how many instances\n * are live. *What* to return to its initial state — which `data-state`, which\n * `hidden`, which `aria-busy` — stays in the controller, because no two\n * consumers answer it the same way (the `MicrotaskCoalescer` split).\n *\n * **Rewind state, not appearance.** The pass writes attributes the controller\n * itself owns; the visual result of those attributes is the consumer's CSS, and\n * a library that reached for style or class names would be guessing at markup\n * it does not own.\n *\n * Both entry points are idempotent, so the lifecycle hooks can call them\n * unconditionally: a second `activate()` does not double-subscribe and does not\n * make the callback run twice, and `deactivate()` on an instance that never\n * subscribed is a no-op.\n *\n * This file's own doc block is dropped from `dist`, but every member comment is\n * inlined into each consumer entry (`tsup` builds with `splitting: false`), so\n * rationale belongs here and only the contract belongs on the members.\n *\n * @example\n * ```ts\n * readonly #beforeCache = new BeforeCacheReset(() => this.#rewind());\n *\n * connect() { this.#beforeCache.activate(); }\n * disconnect() { this.#beforeCache.deactivate(); }\n * ```\n */\nexport class BeforeCacheReset {\n /** Every subscribed instance, iterated by the one shared document listener. */\n static readonly #subscribers = new Set<BeforeCacheReset>();\n\n /** The shared listener; installed while at least one instance is subscribed. */\n static readonly #onBeforeCache = (): void => {\n for (const subscriber of BeforeCacheReset.#subscribers) subscriber.#rewind();\n };\n\n readonly #rewind: () => void;\n\n /** @param rewind - the pass that returns this controller's state to its initial form. */\n constructor(rewind: () => void) {\n this.#rewind = rewind;\n }\n\n /** Subscribes to `turbo:before-cache`; call from `connect()`. Idempotent. */\n activate(): void {\n const first = BeforeCacheReset.#subscribers.size === 0;\n BeforeCacheReset.#subscribers.add(this);\n if (first) {\n document.addEventListener(\"turbo:before-cache\", BeforeCacheReset.#onBeforeCache);\n }\n }\n\n /** Unsubscribes; call from `disconnect()`. Safe when never subscribed. */\n deactivate(): void {\n BeforeCacheReset.#subscribers.delete(this);\n if (BeforeCacheReset.#subscribers.size > 0) return;\n document.removeEventListener(\"turbo:before-cache\", BeforeCacheReset.#onBeforeCache);\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 * This file's own doc block is dropped from `dist`, but every member comment is\n * inlined into each consumer entry (`tsup` builds with `splitting: false`), so\n * rationale belongs here and only the contract belongs on the members.\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","/** Configuration for a value constrained to a stepped numeric range. */\nexport interface SteppedRange {\n /** Inclusive lower endpoint. May be infinite for an unbounded control. */\n readonly min: number;\n /** Inclusive upper endpoint. May be infinite for an unbounded control. */\n readonly max: number;\n /** Requested step. Non-finite and non-positive values fall back to `1`. */\n readonly step: number;\n /** Step-grid origin. Defaults to a finite `min`, otherwise `0`. */\n readonly base?: number;\n}\n\n/** The positive finite step used at runtime and by keyboard stepping. */\nexport function effectiveStep(step: number): number {\n return Number.isFinite(step) && step > 0 ? step : 1;\n}\n\n/**\n * Clamps a raw value and selects its nearest allowed value.\n *\n * The allowed set is the step grid plus each finite range endpoint. Keeping the\n * endpoints in that set makes an authored `aria-valuemin`/`aria-valuemax`\n * truthful even when the upper endpoint is not aligned to the grid. A value\n * exactly between two allowed values resolves upward.\n */\nexport function snapSteppedValue(raw: number, range: SteppedRange): number {\n if (!(range.min <= range.max)) return finiteFallback(range.min, range.max);\n\n const input = Number.isNaN(raw) ? finiteFallback(range.min, range.max) : raw;\n const clamped = Math.min(range.max, Math.max(range.min, input));\n const step = effectiveStep(range.step);\n const base = stepBase(range);\n const candidates: number[] = [];\n\n if (Number.isFinite(range.min)) candidates.push(range.min);\n if (Number.isFinite(range.max)) candidates.push(range.max);\n\n const gridPosition = (clamped - base) / step;\n if (Number.isFinite(gridPosition)) {\n addGridCandidate(candidates, Math.floor(gridPosition), range, base, step);\n addGridCandidate(candidates, Math.ceil(gridPosition), range, base, step);\n }\n\n if (candidates.length === 0) return clamped;\n let nearest = candidates[0] as number;\n let nearestDistance = Math.abs(clamped - nearest);\n for (const candidate of candidates.slice(1)) {\n const distance = Math.abs(clamped - candidate);\n if (\n distance < nearestDistance ||\n (nearlyEqual(distance, nearestDistance) && candidate > nearest)\n ) {\n nearest = candidate;\n nearestDistance = distance;\n }\n }\n return nearest;\n}\n\n/**\n * Moves through the ordered allowed-value set by an integer number of steps.\n *\n * This differs from adding `step * count` and snapping afterward at an\n * off-grid endpoint: with `max=94, step=10`, one decrement from `94` must land\n * on `90`, and one increment from `90` must reach the advertised maximum `94`.\n */\nexport function stepSteppedValue(current: number, count: number, range: SteppedRange): number {\n const value = snapSteppedValue(current, range);\n const distance = Math.abs(Math.trunc(count));\n if (!Number.isFinite(distance) || distance === 0) return value;\n const direction = Math.sign(count);\n const adjacent = adjacentSteppedValue(value, direction, range);\n\n // The first move accounts for a possibly off-grid endpoint. From there a\n // direct grid jump is equivalent to repeated adjacency, and avoids work that\n // grows with Page-step magnitudes or programmatic counts.\n const raw = adjacent + direction * (distance - 1) * effectiveStep(range.step);\n return snapSteppedValue(raw, range);\n}\n\n/** Returns the next member of the ordered endpoint-plus-grid set. */\nfunction adjacentSteppedValue(current: number, direction: number, range: SteppedRange): number {\n const step = effectiveStep(range.step);\n const base = stepBase(range);\n const candidates: number[] = [];\n\n if (direction > 0) {\n const position = (current - base) / step;\n if (Number.isFinite(position)) {\n let gridIndex = Math.floor(position) + 1;\n let candidate = cleanGridValue(base + gridIndex * step, base, step);\n if (candidate < current || nearlyEqual(candidate, current)) {\n gridIndex += 1;\n candidate = cleanGridValue(base + gridIndex * step, base, step);\n }\n if (\n candidate > current &&\n !nearlyEqual(candidate, current) &&\n within(candidate, range.min, range.max)\n ) {\n candidates.push(clamp(candidate, range));\n }\n }\n return clamp(Math.min(...candidates), range);\n }\n\n const position = (current - base) / step;\n if (Number.isFinite(position)) {\n let gridIndex = Math.ceil(position) - 1;\n let candidate = cleanGridValue(base + gridIndex * step, base, step);\n if (candidate > current || nearlyEqual(candidate, current)) {\n gridIndex -= 1;\n candidate = cleanGridValue(base + gridIndex * step, base, step);\n }\n if (\n candidate < current &&\n !nearlyEqual(candidate, current) &&\n within(candidate, range.min, range.max)\n ) {\n candidates.push(clamp(candidate, range));\n }\n }\n return clamp(Math.max(...candidates), range);\n}\n\n/** Adds one grid value when it falls inside the inclusive range. */\nfunction addGridCandidate(\n candidates: number[],\n index: number,\n range: SteppedRange,\n base: number,\n step: number,\n): void {\n const candidate = cleanGridValue(base + index * step, base, step);\n if (within(candidate, range.min, range.max)) candidates.push(clamp(candidate, range));\n}\n\n/** A finite authored base wins; otherwise the finite lower bound or zero does. */\nfunction stepBase(range: SteppedRange): number {\n if (range.base !== undefined && Number.isFinite(range.base)) return range.base;\n return Number.isFinite(range.min) ? range.min : 0;\n}\n\n/** Removes binary noise without discarding significant integer-place digits. */\nfunction cleanGridValue(value: number, base: number, step: number): number {\n const precision = Math.max(decimalPlaces(base), decimalPlaces(step));\n // `toFixed` accepts at most 100 fractional digits. Below that limit it rounds\n // according to the authored grid precision rather than an arbitrary total\n // significant-digit count, which keeps unit steps distinct at large bases.\n return precision <= 100 ? Number(value.toFixed(precision)) : value;\n}\n\n/** Number of fractional decimal places represented by a finite JS number. */\nfunction decimalPlaces(value: number): number {\n const [coefficient = \"\", exponentText] = Math.abs(value).toString().toLowerCase().split(\"e\");\n const fractionLength = coefficient.split(\".\")[1]?.length ?? 0;\n const exponent = exponentText === undefined ? 0 : Number(exponentText);\n return Math.max(0, fractionLength - exponent);\n}\n\n/** Inclusive range check tolerant only of arithmetic noise at an endpoint. */\nfunction within(value: number, min: number, max: number): boolean {\n return (value > min || nearlyEqual(value, min)) && (value < max || nearlyEqual(value, max));\n}\n\n/** Clamps a candidate whose only overshoot may be floating-point noise. */\nfunction clamp(value: number, range: SteppedRange): number {\n return Math.min(range.max, Math.max(range.min, value));\n}\n\n/** Relative comparison used only to collapse arithmetic noise, not real steps. */\nfunction nearlyEqual(left: number, right: number): boolean {\n const scale = Math.max(Math.abs(left), Math.abs(right));\n return (\n Number.isFinite(left) &&\n Number.isFinite(right) &&\n Math.abs(left - right) <= Number.EPSILON * scale\n );\n}\n\n/** Stable fallback for malformed ranges or `NaN` input. */\nfunction finiteFallback(min: number, max: number): number {\n if (Number.isFinite(min)) return min;\n if (Number.isFinite(max)) return max;\n return 0;\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport { isReservedArrowChord } from \"../utils/arrow_step\";\nimport { AttributeLease } from \"../utils/attribute_lease\";\nimport { BeforeCacheReset } from \"../utils/before_cache_reset\";\nimport { MicrotaskCoalescer } from \"../utils/microtask_coalescer\";\nimport { type SteppedRange, snapSteppedValue, stepSteppedValue } from \"../utils/stepped_value\";\n\nconst DEFAULT_MIN = 0;\nconst DEFAULT_MAX = 100;\n\n/**\n * Headless **Separator** behavior. The normative source depends on the case:\n * a decorative divider follows the WAI-ARIA `separator` role\n * (https://www.w3.org/TR/wai-aria-1.2/#separator), while the focusable,\n * value-bearing divider follows the APG Window Splitter pattern\n * (https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/).\n *\n * Markup contract (identifier: `stimeo--separator`):\n * <!-- decorative -->\n * <div data-controller=\"stimeo--separator\"\n * data-stimeo--separator-orientation-value=\"horizontal\"></div>\n *\n * <!-- focusable, value-bearing -->\n * <div data-controller=\"stimeo--separator\"\n * aria-labelledby=\"sidebar-heading\" aria-controls=\"sidebar\"\n * data-stimeo--separator-orientation-value=\"vertical\"\n * data-stimeo--separator-focusable-value=\"true\"\n * data-stimeo--separator-min-value=\"0\"\n * data-stimeo--separator-max-value=\"100\"\n * data-stimeo--separator-step-value=\"1\"\n * data-stimeo--separator-value-value=\"50\"\n * data-action=\"keydown->stimeo--separator#onKeydown\"></div>\n *\n * The Stimulus Values are the live inputs. The controller reflects them as\n * `role`, `tabindex`, `aria-orientation`, and the range ARIA while connected,\n * then restores the attributes it displaced on disconnect and before Turbo\n * caches the page. Existing finite range ARIA is hydrated into otherwise\n * absent Values once, which preserves progressively enhanced server markup\n * without leaving two live sources of truth.\n *\n * `change` dispatches `{ value: number }`.\n *\n * @remarks\n * Behavior only — line drawing is the consumer's CSS. The axis follows Window\n * Splitter: a vertical divider takes ArrowLeft/ArrowRight, a horizontal one\n * takes ArrowUp/ArrowDown. Which end counts as an increase is not defined\n * there, so it follows the slider convention (ArrowRight/ArrowUp increase).\n * Home/End are optional in the pattern and are implemented here; F6 is not.\n *\n * Runtime Value changes repaint silently. A maximum below the effective\n * minimum collapses to that minimum; non-finite bounds use `0`/`100`, and an\n * invalid or non-positive step uses `1`. Finite endpoints remain reachable even\n * when they do not align to the step grid.\n *\n * Because no position is ever applied here, two Window Splitter requirements\n * fall to the consumer: `aria-controls` naming the **primary** pane — the one\n * whose size the value reports — and `Enter` to toggle collapse/restore, since\n * collapsing applies a position — {@link ResizableController} implements that\n * key for the same divider. Because the increment direction is fixed, the\n * primary pane can only be the left one for a vertical splitter and the bottom\n * one for a horizontal splitter: those are the panes that grow as\n * ArrowRight/ArrowUp raise the value.\n */\nexport class SeparatorController extends Controller<HTMLElement> {\n static override values = {\n orientation: { type: String, default: \"horizontal\" },\n focusable: { type: Boolean, default: false },\n min: { type: Number, default: DEFAULT_MIN },\n max: { type: Number, default: DEFAULT_MAX },\n step: { type: Number, default: 1 },\n value: { type: Number, default: DEFAULT_MIN },\n };\n static actions = [\"onKeydown\"] as const;\n static events = [\"change\"] as const;\n\n declare orientationValue: string;\n declare focusableValue: boolean;\n declare minValue: number;\n declare maxValue: number;\n declare stepValue: number;\n declare valueValue: number;\n\n readonly #role = new AttributeLease<HTMLElement>(\"role\");\n readonly #tabindex = new AttributeLease<HTMLElement>(\"tabindex\");\n readonly #orientation = new AttributeLease<HTMLElement>(\"aria-orientation\");\n readonly #minimum = new AttributeLease<HTMLElement>(\"aria-valuemin\");\n readonly #maximum = new AttributeLease<HTMLElement>(\"aria-valuemax\");\n readonly #current = new AttributeLease<HTMLElement>(\"aria-valuenow\");\n\n /** Collapses a morph that changes several render Values into one silent repaint. */\n readonly #repaint = new MicrotaskCoalescer(() => this.#render());\n\n /** Restores authored semantics before Turbo snapshots the element. */\n readonly #beforeCache = new BeforeCacheReset(() => this.#rewindForCache());\n\n /** Hydrates legacy ARIA input once, normalizes the current Value, and renders. */\n override connect(): void {\n this.#hydrateValues();\n this.#repaint.activate();\n this.#beforeCache.activate();\n const value = this.#currentValue();\n if (!Object.is(this.valueValue, value)) this.valueValue = value;\n this.#render();\n }\n\n /** Cancels repaint work and returns every semantic attribute this instance controlled. */\n override disconnect(): void {\n this.#repaint.cancel();\n this.#beforeCache.deactivate();\n this.#returnAttributes();\n }\n\n /** Silently repaints an orientation changed by application code or a Turbo morph. */\n orientationValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Silently adds or removes the focusable range semantics at runtime. */\n focusableValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Silently repaints a minimum changed by application code or a Turbo morph. */\n minValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Silently repaints a maximum changed by application code or a Turbo morph. */\n maxValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Silently repaints a step changed by application code or a Turbo morph. */\n stepValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Silently repaints a current value changed by application code or a Turbo morph. */\n valueValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Adjusts the value on arrow / Home / End keys (focusable variant only). */\n onKeydown(event: KeyboardEvent): void {\n if (isReservedArrowChord(event) || !this.focusableValue) return;\n\n const horizontal = this.#effectiveOrientation === \"horizontal\";\n const range = this.#effectiveRange;\n const current = snapSteppedValue(this.valueValue, range);\n let next: number | null = null;\n switch (event.key) {\n case \"ArrowUp\":\n if (horizontal) next = stepSteppedValue(current, 1, range);\n break;\n case \"ArrowDown\":\n if (horizontal) next = stepSteppedValue(current, -1, range);\n break;\n case \"ArrowRight\":\n if (!horizontal) next = stepSteppedValue(current, 1, range);\n break;\n case \"ArrowLeft\":\n if (!horizontal) next = stepSteppedValue(current, -1, range);\n break;\n case \"Home\":\n next = range.min;\n break;\n case \"End\":\n next = range.max;\n break;\n default:\n return;\n }\n if (next === null) return;\n\n event.preventDefault();\n this.#commit(next, current);\n }\n\n /** Stores a normalized user value, renders immediately, and reports real changes. */\n #commit(raw: number, previous: number): void {\n const value = snapSteppedValue(raw, this.#effectiveRange);\n if (!Object.is(this.valueValue, value)) this.valueValue = value;\n this.#render();\n if (value !== previous) this.dispatch(\"change\", { detail: { value } });\n }\n\n /**\n * Reflects live Values into the connected element without dispatching.\n *\n * @stimeoRenderRoot\n */\n #render(): void {\n const range = this.#effectiveRange;\n const value = snapSteppedValue(this.valueValue, range);\n this.#role.write(this.element, \"separator\");\n this.#orientation.write(this.element, this.#effectiveOrientation);\n\n if (!this.focusableValue) {\n this.#tabindex.write(this.element, null);\n this.#minimum.write(this.element, null);\n this.#maximum.write(this.element, null);\n this.#current.write(this.element, null);\n return;\n }\n\n this.#tabindex.write(this.element, \"0\");\n this.#minimum.write(this.element, String(range.min));\n this.#maximum.write(this.element, String(range.max));\n this.#current.write(this.element, String(value));\n }\n\n /** Effective orientation; unknown strings fall back to the horizontal contract. */\n get #effectiveOrientation(): \"horizontal\" | \"vertical\" {\n return this.orientationValue === \"vertical\" ? \"vertical\" : \"horizontal\";\n }\n\n /** Finite, ordered range shared by rendering and keyboard stepping. */\n get #effectiveRange(): SteppedRange {\n const min = Number.isFinite(this.minValue) ? this.minValue : DEFAULT_MIN;\n const candidateMax = Number.isFinite(this.maxValue) ? this.maxValue : DEFAULT_MAX;\n return {\n min,\n max: Math.max(min, candidateMax),\n step: this.stepValue,\n base: min,\n };\n }\n\n /** Current normalized value derived from the live declarative inputs. */\n #currentValue(): number {\n return snapSteppedValue(this.valueValue, this.#effectiveRange);\n }\n\n /** Copies valid authored ARIA into Values only when no explicit Value exists. */\n #hydrateValues(): void {\n if (!this.#hasInput(\"orientation\")) {\n const orientation = this.element.getAttribute(\"aria-orientation\");\n if (orientation === \"horizontal\" || orientation === \"vertical\") {\n this.orientationValue = orientation;\n }\n }\n\n const min = this.#finiteAttribute(\"aria-valuemin\");\n if (!this.#hasInput(\"min\") && min !== null) this.minValue = min;\n const max = this.#finiteAttribute(\"aria-valuemax\");\n if (!this.#hasInput(\"max\") && max !== null) this.maxValue = max;\n const value = this.#finiteAttribute(\"aria-valuenow\");\n if (!this.#hasInput(\"value\") && value !== null) this.valueValue = value;\n }\n\n /** Whether the author supplied the namespaced Value instead of using its default. */\n #hasInput(name: \"orientation\" | \"min\" | \"max\" | \"value\"): boolean {\n return this.element.hasAttribute(`data-${this.identifier}-${name}-value`);\n }\n\n /** Strict finite-number parser for the one-time progressive-enhancement bridge. */\n #finiteAttribute(name: string): number | null {\n const raw = this.element.getAttribute(name);\n if (raw === null || raw.trim() === \"\") return null;\n const value = Number(raw);\n return Number.isFinite(value) ? value : null;\n }\n\n /** Returns attributes without overwriting values a consumer changed after render. */\n #returnAttributes(): void {\n this.#role.return(this.element);\n this.#tabindex.return(this.element);\n this.#orientation.return(this.element);\n this.#minimum.return(this.element);\n this.#maximum.return(this.element);\n this.#current.return(this.element);\n }\n\n /** Prevents a queued Value repaint from racing Turbo's restored snapshot. */\n #rewindForCache(): void {\n this.#repaint.cancel();\n this.#returnAttributes();\n }\n}\n"]}