stimeo-ui 0.4.0 → 0.6.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 (173) hide show
  1. package/CHANGELOG.md +184 -0
  2. package/dist/controllers/announcer_controller.js.map +1 -1
  3. package/dist/controllers/aspect_ratio_controller.d.ts +3 -5
  4. package/dist/controllers/aspect_ratio_controller.js +19 -11
  5. package/dist/controllers/aspect_ratio_controller.js.map +1 -1
  6. package/dist/controllers/avatar_controller.d.ts +36 -15
  7. package/dist/controllers/avatar_controller.js +195 -40
  8. package/dist/controllers/avatar_controller.js.map +1 -1
  9. package/dist/controllers/breadcrumb_controller.js +5 -1
  10. package/dist/controllers/breadcrumb_controller.js.map +1 -1
  11. package/dist/controllers/carousel_controller.d.ts +12 -3
  12. package/dist/controllers/carousel_controller.js +90 -10
  13. package/dist/controllers/carousel_controller.js.map +1 -1
  14. package/dist/controllers/checkbox_controller.d.ts +31 -5
  15. package/dist/controllers/checkbox_controller.js +136 -25
  16. package/dist/controllers/checkbox_controller.js.map +1 -1
  17. package/dist/controllers/clipboard_controller.js +8 -3
  18. package/dist/controllers/clipboard_controller.js.map +1 -1
  19. package/dist/controllers/collapsible_controller.d.ts +1 -1
  20. package/dist/controllers/collapsible_controller.js +4 -1
  21. package/dist/controllers/collapsible_controller.js.map +1 -1
  22. package/dist/controllers/color_picker_controller.d.ts +9 -3
  23. package/dist/controllers/color_picker_controller.js +41 -11
  24. package/dist/controllers/color_picker_controller.js.map +1 -1
  25. package/dist/controllers/combobox_controller.js.map +1 -1
  26. package/dist/controllers/command_palette_controller.js.map +1 -1
  27. package/dist/controllers/context_menu_controller.d.ts +1 -1
  28. package/dist/controllers/context_menu_controller.js +2 -2
  29. package/dist/controllers/context_menu_controller.js.map +1 -1
  30. package/dist/controllers/countdown_controller.d.ts +5 -3
  31. package/dist/controllers/countdown_controller.js +5 -1
  32. package/dist/controllers/countdown_controller.js.map +1 -1
  33. package/dist/controllers/date_range_picker_controller.d.ts +23 -4
  34. package/dist/controllers/date_range_picker_controller.js +162 -31
  35. package/dist/controllers/date_range_picker_controller.js.map +1 -1
  36. package/dist/controllers/direct_upload_controller.d.ts +1 -1
  37. package/dist/controllers/direct_upload_controller.js +3 -3
  38. package/dist/controllers/direct_upload_controller.js.map +1 -1
  39. package/dist/controllers/empty_state_controller.d.ts +27 -7
  40. package/dist/controllers/empty_state_controller.js +107 -16
  41. package/dist/controllers/empty_state_controller.js.map +1 -1
  42. package/dist/controllers/file_dropzone_controller.d.ts +7 -1
  43. package/dist/controllers/file_dropzone_controller.js +26 -3
  44. package/dist/controllers/file_dropzone_controller.js.map +1 -1
  45. package/dist/controllers/flash_controller.d.ts +25 -5
  46. package/dist/controllers/flash_controller.js +161 -21
  47. package/dist/controllers/flash_controller.js.map +1 -1
  48. package/dist/controllers/focus_controller.d.ts +2 -3
  49. package/dist/controllers/focus_controller.js.map +1 -1
  50. package/dist/controllers/form_validation_controller.js +8 -2
  51. package/dist/controllers/form_validation_controller.js.map +1 -1
  52. package/dist/controllers/frame_loading_controller.d.ts +19 -2
  53. package/dist/controllers/frame_loading_controller.js +94 -22
  54. package/dist/controllers/frame_loading_controller.js.map +1 -1
  55. package/dist/controllers/highlight_controller.d.ts +8 -4
  56. package/dist/controllers/highlight_controller.js +38 -1
  57. package/dist/controllers/highlight_controller.js.map +1 -1
  58. package/dist/controllers/hover_card_controller.d.ts +2 -2
  59. package/dist/controllers/hover_card_controller.js.map +1 -1
  60. package/dist/controllers/idle_controller.d.ts +5 -4
  61. package/dist/controllers/idle_controller.js +39 -6
  62. package/dist/controllers/idle_controller.js.map +1 -1
  63. package/dist/controllers/listbox_controller.js.map +1 -1
  64. package/dist/controllers/local_time_controller.js +2 -0
  65. package/dist/controllers/local_time_controller.js.map +1 -1
  66. package/dist/controllers/masonry_controller.d.ts +1 -1
  67. package/dist/controllers/masonry_controller.js +1 -1
  68. package/dist/controllers/masonry_controller.js.map +1 -1
  69. package/dist/controllers/menubar_controller.js +5 -3
  70. package/dist/controllers/menubar_controller.js.map +1 -1
  71. package/dist/controllers/meter_controller.js +3 -1
  72. package/dist/controllers/meter_controller.js.map +1 -1
  73. package/dist/controllers/multi_select_controller.d.ts +46 -12
  74. package/dist/controllers/multi_select_controller.js +460 -151
  75. package/dist/controllers/multi_select_controller.js.map +1 -1
  76. package/dist/controllers/network_status_controller.d.ts +15 -13
  77. package/dist/controllers/network_status_controller.js +1 -3
  78. package/dist/controllers/network_status_controller.js.map +1 -1
  79. package/dist/controllers/number_input_controller.d.ts +29 -3
  80. package/dist/controllers/number_input_controller.js +455 -64
  81. package/dist/controllers/number_input_controller.js.map +1 -1
  82. package/dist/controllers/overflow_menu_controller.js +5 -1
  83. package/dist/controllers/overflow_menu_controller.js.map +1 -1
  84. package/dist/controllers/pagination_controller.js +38 -1
  85. package/dist/controllers/pagination_controller.js.map +1 -1
  86. package/dist/controllers/password_strength_controller.d.ts +4 -4
  87. package/dist/controllers/password_strength_controller.js +21 -3
  88. package/dist/controllers/password_strength_controller.js.map +1 -1
  89. package/dist/controllers/persist_controller.d.ts +4 -4
  90. package/dist/controllers/persist_controller.js +24 -5
  91. package/dist/controllers/persist_controller.js.map +1 -1
  92. package/dist/controllers/pointer_drag_controller.js +10 -0
  93. package/dist/controllers/pointer_drag_controller.js.map +1 -1
  94. package/dist/controllers/popover_controller.d.ts +2 -2
  95. package/dist/controllers/popover_controller.js.map +1 -1
  96. package/dist/controllers/portal_controller.d.ts +1 -2
  97. package/dist/controllers/portal_controller.js +10 -0
  98. package/dist/controllers/portal_controller.js.map +1 -1
  99. package/dist/controllers/progress_controller.d.ts +1 -1
  100. package/dist/controllers/progress_controller.js +7 -3
  101. package/dist/controllers/progress_controller.js.map +1 -1
  102. package/dist/controllers/radio_group_controller.d.ts +41 -15
  103. package/dist/controllers/radio_group_controller.js +540 -56
  104. package/dist/controllers/radio_group_controller.js.map +1 -1
  105. package/dist/controllers/range_slider_controller.d.ts +23 -0
  106. package/dist/controllers/range_slider_controller.js +385 -94
  107. package/dist/controllers/range_slider_controller.js.map +1 -1
  108. package/dist/controllers/rating_controller.d.ts +36 -31
  109. package/dist/controllers/rating_controller.js +274 -89
  110. package/dist/controllers/rating_controller.js.map +1 -1
  111. package/dist/controllers/relative_time_controller.js +2 -0
  112. package/dist/controllers/relative_time_controller.js.map +1 -1
  113. package/dist/controllers/resizable_controller.js +33 -0
  114. package/dist/controllers/resizable_controller.js.map +1 -1
  115. package/dist/controllers/roving_controller.d.ts +4 -0
  116. package/dist/controllers/roving_controller.js +60 -5
  117. package/dist/controllers/roving_controller.js.map +1 -1
  118. package/dist/controllers/scroll_area_controller.d.ts +7 -1
  119. package/dist/controllers/scroll_area_controller.js +155 -23
  120. package/dist/controllers/scroll_area_controller.js.map +1 -1
  121. package/dist/controllers/scroll_visibility_controller.js +33 -0
  122. package/dist/controllers/scroll_visibility_controller.js.map +1 -1
  123. package/dist/controllers/separator_controller.js +13 -17
  124. package/dist/controllers/separator_controller.js.map +1 -1
  125. package/dist/controllers/skeleton_controller.d.ts +2 -2
  126. package/dist/controllers/skeleton_controller.js +71 -3
  127. package/dist/controllers/skeleton_controller.js.map +1 -1
  128. package/dist/controllers/slider_controller.d.ts +17 -1
  129. package/dist/controllers/slider_controller.js +325 -48
  130. package/dist/controllers/slider_controller.js.map +1 -1
  131. package/dist/controllers/spinner_controller.d.ts +15 -10
  132. package/dist/controllers/spinner_controller.js +18 -3
  133. package/dist/controllers/spinner_controller.js.map +1 -1
  134. package/dist/controllers/step_indicator_controller.d.ts +1 -1
  135. package/dist/controllers/step_indicator_controller.js +3 -1
  136. package/dist/controllers/step_indicator_controller.js.map +1 -1
  137. package/dist/controllers/stepper_controller.js +2 -0
  138. package/dist/controllers/stepper_controller.js.map +1 -1
  139. package/dist/controllers/switch_controller.d.ts +12 -8
  140. package/dist/controllers/switch_controller.js +162 -18
  141. package/dist/controllers/switch_controller.js.map +1 -1
  142. package/dist/controllers/tags_input_controller.d.ts +41 -11
  143. package/dist/controllers/tags_input_controller.js +356 -120
  144. package/dist/controllers/tags_input_controller.js.map +1 -1
  145. package/dist/controllers/textarea_autosize_controller.js +1 -1
  146. package/dist/controllers/textarea_autosize_controller.js.map +1 -1
  147. package/dist/controllers/time_picker_controller.d.ts +42 -10
  148. package/dist/controllers/time_picker_controller.js +296 -104
  149. package/dist/controllers/time_picker_controller.js.map +1 -1
  150. package/dist/controllers/toggle_group_controller.d.ts +39 -13
  151. package/dist/controllers/toggle_group_controller.js +378 -55
  152. package/dist/controllers/toggle_group_controller.js.map +1 -1
  153. package/dist/controllers/toolbar_controller.js +5 -3
  154. package/dist/controllers/toolbar_controller.js.map +1 -1
  155. package/dist/controllers/tooltip_controller.d.ts +2 -2
  156. package/dist/controllers/tooltip_controller.js.map +1 -1
  157. package/dist/controllers/transition_controller.d.ts +2 -3
  158. package/dist/controllers/transition_controller.js.map +1 -1
  159. package/dist/controllers/tree_view_controller.d.ts +1 -2
  160. package/dist/controllers/tree_view_controller.js +24 -4
  161. package/dist/controllers/tree_view_controller.js.map +1 -1
  162. package/dist/index.js +3811 -1048
  163. package/dist/index.js.map +1 -1
  164. package/dist/inspector/cli.d.ts +92 -4
  165. package/dist/inspector/cli.js +174 -6
  166. package/dist/inspector/cli.js.map +1 -1
  167. package/dist/inspector/cli_bin.js +234 -8
  168. package/dist/inspector/cli_bin.js.map +1 -1
  169. package/dist/inspector/examples.json +24 -24
  170. package/dist/inspector/manifest.json +573 -59
  171. package/dist/positioning/index.d.ts +2 -2
  172. package/dist/positioning/index.js.map +1 -1
  173. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/logical_scroll.ts","../../src/utils/arrow_step.ts","../../src/utils/composition_tracker.ts","../../src/utils/roving_tabindex.ts","../../src/controllers/tags_input_controller.ts"],"names":[],"mappings":";;;;;AAiBO,SAAS,MAAM,OAAA,EAA2B;AAC/C,EAAA,OAAO,MAAA,CAAO,gBAAA,CAAiB,OAAO,CAAA,CAA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AAE,KAAA,EAAO,MAAA,IAAU,CAAA;AAAA,EACvD;AAAA;AAAA,EAGA,IAAI,cAAA,GAAsC;AACxC,IAAA,OAAO,MAAM,IAAA,CAAK,IAAA,CAAK,UAAA,CAAW,gBAAA,CAAoC,QAAQ,CAAC,CAAA;AAAA,EACjF;AAAA;AAAA,EAGA,IAAI,OAAA,GAAoB;AACtB,IAAA,OAAO,IAAA,CAAK,WAAW,GAAA,CAAI,CAAC,QAAQ,GAAA,CAAI,OAAA,CAAQ,SAAS,EAAE,CAAA;AAAA,EAC7D;AACF","file":"tags_input_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","/** Minimal event shape carrying the platform's per-event composition signal. */\nexport interface CompositionSignal {\n readonly isComposing?: boolean;\n}\n\n/** Hooks that keep component-specific work outside {@link CompositionTracker}. */\nexport interface CompositionTrackerOptions {\n /** Runs after lifecycle state is set for a `compositionstart` event. */\n readonly onStart?: (event: Event) => void;\n /** Runs after lifecycle state is cleared for a `compositionend` event. */\n readonly onEnd?: (event: Event) => void;\n}\n\n/**\n * Owns IME composition listeners and transient state for one or more event targets.\n *\n * Some browsers omit `KeyboardEvent.isComposing` on the keydown that confirms a\n * conversion. Tracking `compositionstart` through `compositionend` supplies the\n * missing lifecycle signal without relying on deprecated numeric key codes.\n * Component policy stays with the consumer: filtering, validation, and submission\n * belong in the optional {@link CompositionTrackerOptions.onEnd} callback.\n *\n * @example\n * ```ts\n * #composition = new CompositionTracker({ onEnd: () => this.filter() });\n *\n * connect(): void {\n * this.#composition.observe(this.inputTarget);\n * }\n *\n * disconnect(): void {\n * this.#composition.disconnect();\n * }\n *\n * onKeydown(event: KeyboardEvent): void {\n * if (this.#composition.isComposing(event)) return;\n * }\n * ```\n */\nexport class CompositionTracker {\n readonly #observedTargets = new Set<EventTarget>();\n readonly #activeTargets = new Set<EventTarget>();\n readonly #onStart: ((event: Event) => void) | undefined;\n readonly #onEnd: ((event: Event) => void) | undefined;\n\n constructor(options: CompositionTrackerOptions = {}) {\n this.#onStart = options.onStart;\n this.#onEnd = options.onEnd;\n }\n\n /** Starts lifecycle tracking for `target`; repeated calls are idempotent. */\n observe(target: EventTarget): void {\n if (this.#observedTargets.has(target)) return;\n target.addEventListener(\"compositionstart\", this.#handleStart);\n target.addEventListener(\"compositionend\", this.#handleEnd);\n this.#observedTargets.add(target);\n }\n\n /** Stops tracking one target and clears any active composition it owned. */\n unobserve(target: EventTarget): void {\n if (!this.#observedTargets.delete(target)) return;\n target.removeEventListener(\"compositionstart\", this.#handleStart);\n target.removeEventListener(\"compositionend\", this.#handleEnd);\n this.#activeTargets.delete(target);\n }\n\n /** Releases every listener and clears state so reconnect starts cleanly. */\n disconnect(): void {\n for (const target of this.#observedTargets) {\n target.removeEventListener(\"compositionstart\", this.#handleStart);\n target.removeEventListener(\"compositionend\", this.#handleEnd);\n }\n this.#observedTargets.clear();\n this.#activeTargets.clear();\n }\n\n /** True when lifecycle tracking or the current event reports composition. */\n isComposing(event?: CompositionSignal): boolean {\n return this.#activeTargets.size > 0 || event?.isComposing === true;\n }\n\n readonly #handleStart = (event: Event): void => {\n if (event.currentTarget) this.#activeTargets.add(event.currentTarget);\n this.#onStart?.(event);\n };\n\n readonly #handleEnd = (event: Event): void => {\n if (event.currentTarget) this.#activeTargets.delete(event.currentTarget);\n this.#onEnd?.(event);\n };\n}\n","/**\n * Low-level roving-tabindex primitive shared by composite-widget controllers.\n *\n * The APG roving-tabindex pattern keeps a composite widget a single Tab stop:\n * exactly one item is in the Tab sequence (`tabindex=\"0\"`) while the rest are\n * removed from it (`tabindex=\"-1\"`), and the arrow keys move both DOM focus and\n * that single tabbable position together. {@link RovingTabindex} owns *only* that\n * mechanical bookkeeping — \"which one item is tabbable, and move focus there\".\n *\n * It is intentionally **policy-free**. Orientation, wrapping vs. clamping,\n * selection-follows-focus, typeahead, and `Home`/`End` semantics differ per APG\n * pattern (Radio Group, Toolbar, Rating, …); folding them into one helper would\n * flatten those widgets to a lowest common denominator and lose each pattern's\n * correctness. Those decisions therefore stay in each controller, which calls\n * {@link RovingTabindex.setActive} with an index it computed itself (optionally\n * via the pure {@link rovingMove} helper).\n *\n * @remarks\n * Items are read lazily through a getter so a controller can add or remove\n * targets (Stimulus re-scans the DOM) without re-wiring this helper.\n */\nexport class RovingTabindex {\n /** Returns the current ordered item elements; called on every operation. */\n readonly #getItems: () => HTMLElement[];\n\n /**\n * @param getItems - Returns the current ordered item elements. Called on every\n * operation so the live target list is always used.\n */\n constructor(getItems: () => HTMLElement[]) {\n this.#getItems = getItems;\n }\n\n /** Index of the currently tabbable item (`tabindex=\"0\"`), or `-1` if none. */\n get activeIndex(): number {\n return this.#getItems().findIndex((item) => item.tabIndex === 0);\n }\n\n /**\n * Makes exactly the item at `index` tabbable (`tabindex=\"0\"`) and removes every\n * other item from the Tab sequence (`tabindex=\"-1\"`). An out-of-range `index`\n * (e.g. `-1`) leaves all items at `-1`, which a controller can use to express\n * \"nothing is currently tabbable\".\n *\n * @param index - Position of the item to make tabbable.\n * @param options - Pass `{ focus: true }` to also move DOM focus to that item.\n */\n setActive(index: number, { focus = false }: { focus?: boolean } = {}): void {\n const items = this.#getItems();\n items.forEach((item, i) => {\n item.tabIndex = i === index ? 0 : -1;\n });\n if (focus) items[index]?.focus();\n }\n}\n\n/** Edge behavior for {@link rovingMove}: cycle past the ends, or stop at them. */\nexport type RovingWrap = \"wrap\" | \"clamp\";\n\n/**\n * Pure helper that resolves the target index for a one-step directional move.\n *\n * Keyboard/orientation mapping stays in the caller: it decides that a key means\n * `delta` `+1` (next) or `-1` (previous) and whether the widget should `\"wrap\"`\n * (Radio Group, Toolbar) or `\"clamp\"` at the ends.\n *\n * @param current - The index focus is moving from.\n * @param length - Number of items in the set.\n * @param delta - `+1` to move to the next item, `-1` for the previous.\n * @param wrap - `\"wrap\"` cycles around the ends; `\"clamp\"` stops at them.\n * @returns The resolved index, or `-1` when there are no items.\n */\nexport function rovingMove(\n current: number,\n length: number,\n delta: number,\n wrap: RovingWrap,\n): number {\n if (length === 0) return -1;\n const next = current + delta;\n if (wrap === \"wrap\") return (next + length) % length;\n return Math.min(length - 1, Math.max(0, next));\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport { isReservedArrowChord, logicalArrowKey } from \"../utils/arrow_step\";\nimport { CompositionTracker } from \"../utils/composition_tracker\";\nimport { RovingTabindex } from \"../utils/roving_tabindex\";\n\n/**\n * Headless, accessible free-input tags / chips field.\n *\n * Markup contract (identifier: `stimeo--tags-input`):\n * <div data-controller=\"stimeo--tags-input\"\n * data-stimeo--tags-input-delimiter-value=\",\">\n * <ul role=\"list\" aria-label=\"Tags\" data-stimeo--tags-input-target=\"tags\"></ul>\n * <input type=\"text\" aria-label=\"Add tag\" aria-describedby=\"tags-help\"\n * data-stimeo--tags-input-target=\"input\"\n * data-action=\"keydown->stimeo--tags-input#onKeydown\" />\n * <span role=\"status\" aria-live=\"polite\" class=\"visually-hidden\"\n * data-stimeo--tags-input-target=\"status\"></span>\n * <div data-stimeo--tags-input-target=\"fields\"></div>\n * <template data-stimeo--tags-input-target=\"tagTemplate\">\n * <li role=\"listitem\" data-stimeo--tags-input-target=\"tag\">\n * <span data-tags-input-slot=\"label\"></span>\n * <!-- Removal is delegated on the tags container; no per-chip action needed. -->\n * <button type=\"button\" tabindex=\"-1\">×</button>\n * </li>\n * </template>\n * </div>\n *\n * There is no single established APG pattern; this composes a labeled text input\n * with a roving-tabindex list of removable chips, mapping to WCAG 2.1.1, 2.4.7,\n * 4.1.2, 4.1.3, and 1.3.1. Unlike {@link MultiSelectController} (pick from a\n * candidate list) the user types arbitrary strings.\n *\n * Behavior provided:\n * - `Enter` or the configured delimiter commits the trimmed input as a tag.\n * - Empty / duplicate / over-limit additions are rejected with\n * `stimeo--tags-input:reject`; duplicates are allowed when `allowDuplicates`.\n * - Tags render from the `tagTemplate`, each with a `Remove {label}` button; the\n * `fields` container mirrors the tag set as `name`d hidden inputs for form\n * submission, and every change dispatches `stimeo--tags-input:change`.\n * - The remove buttons form one roving Tab stop: `ArrowLeft`/`ArrowRight` move\n * between them (right past the end returns to the input), `Delete`/`Backspace`\n * delete the focused tag, and `Backspace` on an empty input deletes the last.\n * - Removing a tag moves focus to the neighboring tag, else back to the input.\n */\nexport class TagsInputController extends Controller<HTMLElement> {\n static override targets = [\"input\", \"tags\", \"tag\", \"tagTemplate\", \"status\", \"fields\"];\n static override values = {\n delimiter: { type: String, default: \",\" },\n max: { type: Number, default: 0 },\n allowDuplicates: { type: Boolean, default: false },\n name: { type: String, default: \"tags[]\" },\n };\n static actions = [\"onKeydown\"] as const;\n static events = [\"change\", \"reject\"] as const;\n\n declare readonly inputTarget: HTMLInputElement;\n declare readonly tagsTarget: HTMLElement;\n declare readonly tagTargets: HTMLElement[];\n declare readonly tagTemplateTarget: HTMLTemplateElement;\n declare readonly statusTarget: HTMLElement;\n declare readonly fieldsTarget: HTMLElement;\n declare readonly hasStatusTarget: boolean;\n declare readonly hasFieldsTarget: boolean;\n declare readonly hasTagTemplateTarget: boolean;\n declare readonly hasInputTarget: boolean;\n\n declare delimiterValue: string;\n declare maxValue: number;\n declare allowDuplicatesValue: boolean;\n declare nameValue: string;\n\n readonly #roving = new RovingTabindex(() => this.#removeButtons);\n /** Owns IME lifecycle state for commit-key guarding. */\n readonly #composition = new CompositionTracker();\n\n /** Wires tag-list keyboard navigation and removal, and seeds the single Tab stop. */\n override connect(): void {\n if (this.hasInputTarget) this.#composition.observe(this.inputTarget);\n this.tagsTarget.addEventListener(\"keydown\", this.#onTagKeydown);\n this.tagsTarget.addEventListener(\"click\", this.#onTagClick);\n this.#syncState();\n }\n\n /** Releases the delegated listeners so no handler outlives the element. */\n override disconnect(): void {\n this.#composition.disconnect();\n this.tagsTarget.removeEventListener(\"keydown\", this.#onTagKeydown);\n this.tagsTarget.removeEventListener(\"click\", this.#onTagClick);\n }\n\n /** Tracks an input added initially or after connect. */\n inputTargetConnected(input: HTMLInputElement): void {\n this.#composition.observe(input);\n }\n\n /** Removes composition listeners when the active input is replaced or removed. */\n inputTargetDisconnected(input: HTMLInputElement): void {\n this.#composition.unobserve(input);\n }\n\n /** Commits on `Enter`/delimiter and deletes the last tag on empty `Backspace`. */\n onKeydown(event: KeyboardEvent): void {\n // A descendant widget that already claimed the key must not ALSO commit a tag\n // or reach into the chips — composition depends on this yield.\n if (event.defaultPrevented) return;\n if (isReservedArrowChord(event)) return;\n // Ignore keys fired during IME composition: the `Enter` that confirms a\n // candidate (and arrows that move within it) must not commit/navigate the\n // chip list. Controller-owned lifecycle state covers confirming events that\n // omit the standard per-event signal.\n if (this.#composition.isComposing(event)) return;\n if (event.key === \"Enter\" || event.key === this.delimiterValue) {\n event.preventDefault();\n this.#commitInput();\n return;\n }\n if (event.key === \"Backspace\" && this.inputTarget.value === \"\") {\n const buttons = this.#removeButtons;\n if (buttons.length > 0) {\n event.preventDefault();\n this.#removeAt(buttons.length - 1);\n }\n return;\n }\n // Same normalisation as the chip handler below, read from the same element.\n if (logicalArrowKey(event.key, this.element) === \"ArrowLeft\" && this.inputTarget.value === \"\") {\n const buttons = this.#removeButtons;\n if (buttons.length > 0) {\n event.preventDefault();\n this.#roving.setActive(buttons.length - 1, { focus: true });\n }\n }\n }\n\n /**\n * Deletes the tag whose remove button was clicked. Delegated on the tags\n * container (like `#onTagKeydown`) rather than bound per chip via\n * `data-action`, so it works the instant a chip is appended without waiting on\n * Stimulus to wire a freshly created element.\n */\n readonly #onTagClick = (event: MouseEvent): void => {\n const button = (event.target as HTMLElement).closest(\"button\");\n if (!button || !this.tagsTarget.contains(button)) return;\n const index = this.#removeButtons.indexOf(button as HTMLButtonElement);\n if (index !== -1) this.#removeAt(index);\n };\n\n /** Validates and adds the current input value as a tag, then clears the input. */\n #commitInput(): void {\n const value = this.inputTarget.value.trim();\n if (value === \"\") {\n this.#reject(value, \"empty\");\n return;\n }\n if (this.maxValue > 0 && this.tagTargets.length >= this.maxValue) {\n this.#reject(value, \"max\");\n return;\n }\n if (!this.allowDuplicatesValue && this.#values.includes(value)) {\n this.#reject(value, \"duplicate\");\n return;\n }\n this.#appendTag(value);\n this.inputTarget.value = \"\";\n this.#announce(value);\n this.#syncState();\n this.dispatch(\"change\", { detail: { tags: this.#values } });\n }\n\n /** Builds one chip from the template and appends it to the tag list. */\n #appendTag(value: string): void {\n if (!this.hasTagTemplateTarget) return;\n const fragment = this.tagTemplateTarget.content.cloneNode(true) as DocumentFragment;\n const tag = fragment.querySelector<HTMLElement>('[data-stimeo--tags-input-target=\"tag\"]');\n const label = fragment.querySelector<HTMLElement>('[data-tags-input-slot=\"label\"]');\n const button = fragment.querySelector<HTMLButtonElement>(\"button\");\n if (!tag || !button) return;\n tag.dataset.value = value;\n if (label) label.textContent = value;\n button.setAttribute(\"aria-label\", `Remove ${value}`);\n button.tabIndex = -1;\n this.tagsTarget.appendChild(fragment);\n }\n\n /** Removes the tag at `index`, then moves focus to a neighbor or the input. */\n #removeAt(index: number): void {\n const tag = this.tagTargets[index];\n if (!tag) return;\n const value = tag.dataset.value ?? \"\";\n tag.remove();\n this.#announce(value);\n this.#syncState();\n this.dispatch(\"change\", { detail: { tags: this.#values } });\n const remaining = this.#removeButtons;\n if (remaining.length === 0) {\n this.inputTarget.focus();\n } else {\n this.#roving.setActive(Math.min(index, remaining.length - 1), { focus: true });\n }\n }\n\n /** Handles arrow navigation and deletion within the chip list (delegated). */\n readonly #onTagKeydown = (event: KeyboardEvent): void => {\n // A descendant widget that already claimed the key must not ALSO move the\n // chip focus — composition depends on this yield. Chips render from the\n // consumer's template, so an arbitrary widget can live inside one.\n if (event.defaultPrevented) return;\n if (isReservedArrowChord(event)) return;\n const button = (event.target as HTMLElement).closest(\"button\");\n if (!button) return;\n const buttons = this.#removeButtons;\n const index = buttons.indexOf(button);\n if (index === -1) return;\n // Logical, not physical. The key is normalised rather than a new case added:\n // the two horizontal branches are not mirror images — only one guards its\n // edge, and the other hands focus back to the input — so swapping the key\n // keeps each branch, guards and all, with its own direction. Both handlers\n // read the same element on purpose; probing the focused child would let the\n // input and the chips disagree at the boundary between them.\n switch (logicalArrowKey(event.key, this.element)) {\n case \"ArrowLeft\":\n if (index > 0) {\n event.preventDefault();\n this.#roving.setActive(index - 1, { focus: true });\n }\n break;\n case \"ArrowRight\":\n event.preventDefault();\n if (index < buttons.length - 1) {\n this.#roving.setActive(index + 1, { focus: true });\n } else {\n this.inputTarget.focus();\n }\n break;\n case \"Delete\":\n case \"Backspace\":\n event.preventDefault();\n this.#removeAt(index);\n break;\n default:\n break;\n }\n };\n\n /** Rebuilds the hidden form fields, the `full` flag, and the roving Tab stop. */\n #syncState(): void {\n if (this.hasFieldsTarget) {\n this.fieldsTarget.replaceChildren(\n ...this.#values.map((value) => {\n const input = document.createElement(\"input\");\n input.type = \"hidden\";\n input.name = this.nameValue;\n input.value = value;\n return input;\n }),\n );\n }\n const full = this.maxValue > 0 && this.tagTargets.length >= this.maxValue;\n this.element.toggleAttribute(\"data-stimeo--tags-input-full\", full);\n // Keep exactly one remove button tabbable so the chip list is a single stop.\n if (this.#removeButtons.length > 0 && this.#roving.activeIndex === -1) {\n this.#roving.setActive(0);\n }\n }\n\n /** Mirrors the changed tag into the live region for assistive tech. */\n #announce(value: string): void {\n if (this.hasStatusTarget) this.statusTarget.textContent = value;\n }\n\n /** Reports a rejected addition via `stimeo--tags-input:reject`. */\n #reject(value: string, reason: \"duplicate\" | \"empty\" | \"max\"): void {\n this.dispatch(\"reject\", { detail: { value, reason } });\n }\n\n /** The remove buttons in document order (the roving navigation set). */\n get #removeButtons(): HTMLButtonElement[] {\n return Array.from(this.tagsTarget.querySelectorAll<HTMLButtonElement>(\"button\"));\n }\n\n /** Current tag values in order. */\n get #values(): string[] {\n return this.tagTargets.map((tag) => tag.dataset.value ?? \"\");\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/utils/announce.ts","../../src/utils/logical_scroll.ts","../../src/utils/arrow_step.ts","../../src/utils/roving_tabindex.ts","../../src/utils/chip_row.ts","../../src/utils/composition_tracker.ts","../../src/utils/microtask_coalescer.ts","../../src/controllers/tags_input_controller.ts"],"names":["entry","button"],"mappings":";;;;;AAoBO,SAAS,QAAA,CAAS,OAAA,EAAiB,OAAA,GAAmC,EAAC,EAAS;AACrF,EAAA,MAAM,IAAA,GAAO,QAAQ,IAAA,EAAK;AAC1B,EAAA,IAAI,IAAA,CAAK,WAAW,CAAA,EAAG;AACvB,EAAA,MAAA,CAAO,aAAA;AAAA,IACL,IAAI,YAAY,4BAAA,EAA8B;AAAA,MAC5C,QAAQ,EAAE,OAAA,EAAS,MAAM,SAAA,EAAW,OAAA,CAAQ,cAAc,IAAA;AAAK,KAChE;AA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AAI,CAAA;AACpB,IAAA,MAAM,UAAU,CAAC,IAAA,CAAK,SAAA,CAAU,IAAA,CAAK,YAAY,IAAI,CAAA;AACrD,IAAA,IAAA,CAAK,UAAA,GAAa,IAAA;AAClB,IAAA,IAAI,OAAA,OAAc,QAAA,CAAS,WAAA,EAAa,EAAE,MAAA,EAAQ,EAAE,IAAA,EAAK,EAAG,CAAA;AAAA,EAC9D;AAAA;AAAA,EAGA,mBAAA,CAAoB,KAAA,EAAgB,KAAA,EAAe,KAAA,EAAqB;AACtE,IAAA,MAAM,QAAA,GAAW,KAAA,GAAQ,IAAA,CAAK,iBAAA,GAAoB,IAAA,CAAK,wBAAA;AACvD,IAAA,QAAA,CAAS,YAAA,CAAa,UAAU,EAAE,KAAA,EAAO,OAAO,KAAA,EAAO,KAAA,EAAO,CAAC,CAAA;AAAA,EACjE;AAAA;AAAA,EAGA,OAAA,CAAQ,OAAe,MAAA,EAA6C;AAClE,IAAA,IAAA,CAAK,QAAA,CAAS,UAAU,EAAE,MAAA,EAAQ,EAAE,KAAA,EAAO,MAAA,IAAU,CAAA;AAAA,EACvD;AAAA;AAAA,EAGA,IAAI,OAAA,GAAoB;AACtB,IAAA,OAAO,IAAA,CAAK,WAAW,GAAA,CAAI,CAAC,QAAQ,GAAA,CAAI,OAAA,CAAQ,SAAS,EAAE,CAAA;AAAA,EAC7D;AAAA;AAAA,EAGA,SAAA,CAAU,MAAyB,KAAA,EAAmC;AACpE,IAAA,OAAO,IAAA,CAAK,MAAA,KAAW,KAAA,CAAM,MAAA,IAAU,IAAA,CAAK,KAAA,CAAM,CAAC,KAAA,EAAO,KAAA,KAAU,KAAA,KAAU,KAAA,CAAM,KAAK,CAAC,CAAA;AAAA,EAC5F;AACF","file":"tags_input_controller.js","sourcesContent":["/**\n * Sends one message to the page's shared `stimeo--announcer`.\n *\n * A component that has to reach assistive tech does not carry a live region of its\n * own: a region only announces what changes *after* assistive tech already knows\n * about it, which a region that appears (or is un-hidden) with its message cannot\n * satisfy. The one region that can is the announcer sitting in the page from the\n * start, so state changes are handed to it as an event and it does the reading.\n *\n * The event goes to `window` because the announcer is usually a sibling high in the\n * document rather than an ancestor of the component dispatching it.\n *\n * Wording comes from the consumer — the library ships no English strings — so an\n * empty message is silently dropped and nothing is announced.\n *\n * @example\n * ```ts\n * announce(this.announceTextValue, { assertive: false });\n * ```\n */\nexport function announce(message: string, options: { assertive?: boolean } = {}): void {\n const text = message.trim();\n if (text.length === 0) return;\n window.dispatchEvent(\n new CustomEvent(\"stimeo--announcer:announce\", {\n detail: { message: text, assertive: options.assertive === true },\n }),\n );\n}\n\n/**\n * Fills `{name}` placeholders in an announcement template from `values`.\n *\n * The same substitution the value-text templates use, so a consumer writes\n * `\"{percent}% complete\"` in one attribute and gets the same rules everywhere. A\n * placeholder with no matching entry is left as authored rather than blanked, which\n * keeps a typo visible instead of silently swallowing the word.\n */\nexport function fillTemplate(template: string, values: Record<string, string | number>): string {\n return template.replace(/\\{([a-zA-Z][a-zA-Z0-9]*)\\}/g, (match, name: string) => {\n const replacement = values[name];\n return replacement === undefined ? match : String(replacement);\n });\n}\n","/** 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 * Low-level roving-tabindex primitive shared by composite-widget controllers.\n *\n * The APG roving-tabindex pattern keeps a composite widget a single Tab stop:\n * exactly one item is in the Tab sequence (`tabindex=\"0\"`) while the rest are\n * removed from it (`tabindex=\"-1\"`), and the arrow keys move both DOM focus and\n * that single tabbable position together. {@link RovingTabindex} owns *only* that\n * mechanical bookkeeping — \"which one item is tabbable, and move focus there\".\n *\n * It is intentionally **policy-free**. Orientation, wrapping vs. clamping,\n * selection-follows-focus, typeahead, and `Home`/`End` semantics differ per APG\n * pattern (Radio Group, Toolbar, Rating, …); folding them into one helper would\n * flatten those widgets to a lowest common denominator and lose each pattern's\n * correctness. Those decisions therefore stay in each controller, which calls\n * {@link RovingTabindex.setActive} with an index it computed itself (optionally\n * via the pure {@link rovingMove} helper).\n *\n * @remarks\n * Items are read lazily through a getter so a controller can add or remove\n * targets (Stimulus re-scans the DOM) without re-wiring this helper. A caller\n * that already captured one event-scoped snapshot may pass it to\n * {@link RovingTabindex.setActive}, avoiding a second live-target scan while\n * preserving one coherent collection for the whole operation.\n */\nexport class RovingTabindex {\n /** Returns the current ordered item elements; called on every operation. */\n readonly #getItems: () => HTMLElement[];\n\n /**\n * @param getItems - Returns the current ordered item elements. Called on every\n * operation so the live target list is always used.\n */\n constructor(getItems: () => HTMLElement[]) {\n this.#getItems = getItems;\n }\n\n /** Index of the currently tabbable item (`tabindex=\"0\"`), or `-1` if none. */\n get activeIndex(): number {\n return this.#getItems().findIndex((item) => item.tabIndex === 0);\n }\n\n /**\n * Makes exactly the item at `index` tabbable (`tabindex=\"0\"`) and removes every\n * other item from the Tab sequence (`tabindex=\"-1\"`). An out-of-range `index`\n * (e.g. `-1`) leaves all items at `-1`, which a controller can use to express\n * \"nothing is currently tabbable\".\n *\n * @param index - Position of the item to make tabbable.\n * @param options - Pass `{ focus: true }` to also move DOM focus to that item,\n * and `items` to reuse an event-scoped collection snapshot.\n */\n setActive(\n index: number,\n options: { focus?: boolean; items?: readonly HTMLElement[] } = {},\n ): void {\n const { focus = false } = options;\n const items = options.items ?? this.#getItems();\n items.forEach((item, i) => {\n item.tabIndex = i === index ? 0 : -1;\n });\n if (focus) items[index]?.focus();\n }\n}\n\n/** Edge behavior for {@link rovingMove}: cycle past the ends, or stop at them. */\nexport type RovingWrap = \"wrap\" | \"clamp\";\n\n/**\n * Pure helper that resolves the target index for a one-step directional move.\n *\n * Keyboard/orientation mapping stays in the caller: it decides that a key means\n * `delta` `+1` (next) or `-1` (previous) and whether the widget should `\"wrap\"`\n * (Radio Group, Toolbar) or `\"clamp\"` at the ends.\n *\n * @param current - The index focus is moving from.\n * @param length - Number of items in the set.\n * @param delta - `+1` to move to the next item, `-1` for the previous.\n * @param wrap - `\"wrap\"` cycles around the ends; `\"clamp\"` stops at them.\n * @returns The resolved index, or `-1` when there are no items.\n */\nexport function rovingMove(\n current: number,\n length: number,\n delta: number,\n wrap: RovingWrap,\n): number {\n if (length === 0) return -1;\n const next = current + delta;\n if (wrap === \"wrap\") return (next + length) % length;\n return Math.min(length - 1, Math.max(0, next));\n}\n","import { isReservedArrowChord, logicalArrowKey } from \"./arrow_step\";\nimport { RovingTabindex } from \"./roving_tabindex\";\n\n/** Consumer-owned behavior that differs between removable-chip widgets. */\nexport interface ChipRowOptions {\n /** Element whose writing direction defines logical previous/next. */\n readonly directionElement: HTMLElement;\n /** Returns the current chip elements in navigation order. */\n readonly getItems: () => readonly HTMLElement[];\n /** Resolves the one remove button owned by a chip. Defaults to its first button. */\n readonly getButton?: (item: HTMLElement) => HTMLButtonElement | null;\n /** Removes the chip currently occupying `index`. */\n readonly onRemove: (index: number) => void;\n /** Receives focus when navigation moves past the logical end of the row. */\n readonly focusAfterEnd: () => void;\n}\n\n/**\n * Delegated interaction and roving-tabindex mechanics for a row of removable chips.\n *\n * The selection model stays in the consuming controller: this helper knows only\n * how to resolve one consumer-declared remove button per chip, move between those\n * buttons, delegate click/delete requests by index, and bind those listeners to\n * a replaceable row target. Restricting the button set to the declared chip items\n * deliberately excludes sibling controls such as an authored \"Clear all\" button.\n */\nexport class ChipRow {\n readonly #directionElement: HTMLElement;\n readonly #getItems: () => readonly HTMLElement[];\n readonly #getButton: (item: HTMLElement) => HTMLButtonElement | null;\n readonly #onRemove: (index: number) => void;\n readonly #focusAfterEnd: () => void;\n readonly #roving = new RovingTabindex(() => this.buttons);\n #container: HTMLElement | null = null;\n\n constructor(options: ChipRowOptions) {\n this.#directionElement = options.directionElement;\n this.#getItems = options.getItems;\n this.#getButton = options.getButton ?? ((item) => item.querySelector(\"button\"));\n this.#onRemove = options.onRemove;\n this.#focusAfterEnd = options.focusAfterEnd;\n }\n\n /**\n * Binds delegation to `container`; any row currently bound is released first.\n * Idempotent for the same node, so target callbacks may call it freely.\n */\n connect(container: HTMLElement): void {\n if (this.#container === container) return;\n this.disconnect();\n this.#container = container;\n container.addEventListener(\"click\", this.#onClick);\n container.addEventListener(\"keydown\", this.#onKeydown);\n }\n\n /**\n * Releases the current row. When `container` is supplied, a stale disconnect\n * callback cannot tear listeners off a newer replacement target.\n */\n disconnect(container?: HTMLElement): void {\n const current = this.#container;\n if (!current || (container !== undefined && current !== container)) return;\n current.removeEventListener(\"click\", this.#onClick);\n current.removeEventListener(\"keydown\", this.#onKeydown);\n this.#container = null;\n }\n\n /** Current remove buttons, at most one consumer-resolved button per chip item. */\n get buttons(): HTMLButtonElement[] {\n return this.#entries.map(({ button }) => button);\n }\n\n /** Number of currently navigable remove buttons. */\n get length(): number {\n return this.buttons.length;\n }\n\n /** Declared-item index of the last navigable chip, or `-1` for an empty row. */\n get lastIndex(): number {\n return this.#entries.at(-1)?.itemIndex ?? -1;\n }\n\n /** Keeps exactly one button tabbable, preferring the first authored Tab stop. */\n ensureTabStop(): void {\n const buttons = this.#entries.map(({ button }) => button);\n const active = buttons.findIndex((button) => button.tabIndex === 0);\n const count = buttons.filter((button) => button.tabIndex === 0).length;\n if (buttons.length > 0 && count !== 1) {\n this.#roving.setActive(active === -1 ? 0 : active, { items: buttons });\n }\n }\n\n /** Focuses the last chip, returning false for an empty row. */\n focusLast(): boolean {\n const buttons = this.#entries.map(({ button }) => button);\n const last = buttons.length - 1;\n if (last < 0) return false;\n this.#roving.setActive(last, { focus: true, items: buttons });\n return true;\n }\n\n /**\n * Focuses the chip that followed a removed index, or the new last chip.\n * Returns false when removal emptied the row so the consumer can rescue focus.\n */\n focusAfterRemoval(index: number): boolean {\n const entries = this.#entries;\n if (entries.length === 0) return false;\n const following = entries.findIndex((entry) => entry.itemIndex >= index);\n this.#roving.setActive(following === -1 ? entries.length - 1 : following, {\n focus: true,\n items: entries.map(({ button }) => button),\n });\n return true;\n }\n\n /** Current remove-button entries, retaining each button's declared item index. */\n get #entries(): Array<{ button: HTMLButtonElement; itemIndex: number }> {\n return this.#getItems().flatMap((item, itemIndex) => {\n const button = this.#getButton(item);\n return button ? [{ button, itemIndex }] : [];\n });\n }\n\n /** Resolves a delegated event to the remove button owned by a declared chip. */\n #entry(event: Event): {\n button: HTMLButtonElement;\n buttonIndex: number;\n buttons: HTMLButtonElement[];\n itemIndex: number;\n } | null {\n const target = event.target;\n if (!(target instanceof Element)) return null;\n const button = target.closest<HTMLButtonElement>(\"button\");\n const entries = this.#entries;\n const buttonIndex = entries.findIndex((entry) => entry.button === button);\n if (buttonIndex === -1) return null;\n const entry = entries[buttonIndex] as { button: HTMLButtonElement; itemIndex: number };\n return { ...entry, buttonIndex, buttons: entries.map(({ button }) => button) };\n }\n\n /** Delegates removal clicks without waiting for Stimulus to wire a new chip. */\n readonly #onClick = (event: MouseEvent): void => {\n const entry = this.#entry(event);\n if (!entry) return;\n this.#onRemove(entry.itemIndex);\n };\n\n /** Applies the shared logical-arrow and removal policy within the chip row. */\n readonly #onKeydown = (event: KeyboardEvent): void => {\n if (event.defaultPrevented || isReservedArrowChord(event)) return;\n const entry = this.#entry(event);\n if (!entry) return;\n const buttons = entry.buttons;\n const index = entry.buttonIndex;\n\n switch (logicalArrowKey(event.key, this.#directionElement)) {\n case \"ArrowLeft\":\n if (index > 0) {\n event.preventDefault();\n this.#roving.setActive(index - 1, { focus: true, items: buttons });\n }\n break;\n case \"ArrowRight\":\n event.preventDefault();\n if (index < buttons.length - 1) {\n this.#roving.setActive(index + 1, { focus: true, items: buttons });\n } else {\n this.#focusAfterEnd();\n }\n break;\n case \"Delete\":\n case \"Backspace\":\n event.preventDefault();\n this.#onRemove(entry.itemIndex);\n break;\n default:\n break;\n }\n };\n}\n","/** Minimal event shape carrying the platform's per-event composition signal. */\nexport interface CompositionSignal {\n readonly isComposing?: boolean;\n}\n\n/** Hooks that keep component-specific work outside {@link CompositionTracker}. */\nexport interface CompositionTrackerOptions {\n /** Runs after lifecycle state is set for a `compositionstart` event. */\n readonly onStart?: (event: Event) => void;\n /** Runs after lifecycle state is cleared for a `compositionend` event. */\n readonly onEnd?: (event: Event) => void;\n}\n\n/**\n * Owns IME composition listeners and transient state for one or more event targets.\n *\n * Some browsers omit `KeyboardEvent.isComposing` on the keydown that confirms a\n * conversion. Tracking `compositionstart` through `compositionend` supplies the\n * missing lifecycle signal without relying on deprecated numeric key codes.\n * Component policy stays with the consumer: filtering, validation, and submission\n * belong in the optional {@link CompositionTrackerOptions.onEnd} callback.\n *\n * @example\n * ```ts\n * #composition = new CompositionTracker({ onEnd: () => this.filter() });\n *\n * connect(): void {\n * this.#composition.observe(this.inputTarget);\n * }\n *\n * disconnect(): void {\n * this.#composition.disconnect();\n * }\n *\n * onKeydown(event: KeyboardEvent): void {\n * if (this.#composition.isComposing(event)) return;\n * }\n * ```\n */\nexport class CompositionTracker {\n readonly #observedTargets = new Set<EventTarget>();\n readonly #activeTargets = new Set<EventTarget>();\n readonly #onStart: ((event: Event) => void) | undefined;\n readonly #onEnd: ((event: Event) => void) | undefined;\n\n constructor(options: CompositionTrackerOptions = {}) {\n this.#onStart = options.onStart;\n this.#onEnd = options.onEnd;\n }\n\n /** Starts lifecycle tracking for `target`; repeated calls are idempotent. */\n observe(target: EventTarget): void {\n if (this.#observedTargets.has(target)) return;\n target.addEventListener(\"compositionstart\", this.#handleStart);\n target.addEventListener(\"compositionend\", this.#handleEnd);\n this.#observedTargets.add(target);\n }\n\n /** Stops tracking one target and clears any active composition it owned. */\n unobserve(target: EventTarget): void {\n if (!this.#observedTargets.delete(target)) return;\n target.removeEventListener(\"compositionstart\", this.#handleStart);\n target.removeEventListener(\"compositionend\", this.#handleEnd);\n this.#activeTargets.delete(target);\n }\n\n /** Releases every listener and clears state so reconnect starts cleanly. */\n disconnect(): void {\n for (const target of this.#observedTargets) {\n target.removeEventListener(\"compositionstart\", this.#handleStart);\n target.removeEventListener(\"compositionend\", this.#handleEnd);\n }\n this.#observedTargets.clear();\n this.#activeTargets.clear();\n }\n\n /** True when lifecycle tracking or the current event reports composition. */\n isComposing(event?: CompositionSignal): boolean {\n return this.#activeTargets.size > 0 || event?.isComposing === true;\n }\n\n readonly #handleStart = (event: Event): void => {\n if (event.currentTarget) this.#activeTargets.add(event.currentTarget);\n this.#onStart?.(event);\n };\n\n readonly #handleEnd = (event: Event): void => {\n if (event.currentTarget) this.#activeTargets.delete(event.currentTarget);\n this.#onEnd?.(event);\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","import { Controller } from \"@hotwired/stimulus\";\nimport { announce, fillTemplate } from \"../utils/announce\";\nimport { isReservedArrowChord, logicalArrowKey } from \"../utils/arrow_step\";\nimport { ChipRow } from \"../utils/chip_row\";\nimport { CompositionTracker } from \"../utils/composition_tracker\";\nimport { MicrotaskCoalescer } from \"../utils/microtask_coalescer\";\n\n/**\n * Headless, accessible free-input tags / chips field.\n *\n * Markup contract (identifier: `stimeo--tags-input`):\n * <div data-controller=\"stimeo--tags-input\"\n * data-stimeo--tags-input-delimiter-value=\",\"\n * data-stimeo--tags-input-announce-text-value=\"{label} added; {count} total\"\n * data-stimeo--tags-input-announce-removed-text-value=\"{label} removed; {count} total\">\n * <ul role=\"list\" aria-label=\"Tags\" data-stimeo--tags-input-target=\"tags\"></ul>\n * <input type=\"text\" aria-label=\"Add tag\" aria-describedby=\"tags-help\"\n * data-stimeo--tags-input-target=\"input\"\n * data-action=\"keydown->stimeo--tags-input#onKeydown\" />\n * <div data-stimeo--tags-input-target=\"fields\"></div>\n * <template data-stimeo--tags-input-target=\"tagTemplate\">\n * <li role=\"listitem\" data-stimeo--tags-input-target=\"tag\">\n * <span data-stimeo--tags-input-target=\"label\"></span>\n * <!-- Removal is delegated on the tags container; no per-chip action needed. -->\n * <button type=\"button\" tabindex=\"-1\" aria-label=\"Remove {label}\"\n * data-stimeo--tags-input-target=\"remove\">×</button>\n * </li>\n * </template>\n * </div>\n *\n * There is no single established APG pattern; this composes a labeled text input\n * with a roving-tabindex list of removable chips, mapping to WCAG 2.1.1, 2.4.7,\n * 4.1.2, 4.1.3, and 1.3.1. Unlike {@link MultiSelectController} (pick from a\n * candidate list) the user types arbitrary strings.\n *\n * Behavior provided:\n * - `Enter` or the configured delimiter commits the trimmed input as a tag.\n * - Empty / duplicate / over-limit additions are rejected with\n * `stimeo--tags-input:reject`; duplicates are allowed when `allowDuplicates`.\n * - Tags render transactionally from the `tagTemplate`; its author-localized\n * remove-button `aria-label` expands `{label}` / `{value}`. The\n * `fields` container mirrors the tag set as `name`d hidden inputs for form\n * submission. User changes dispatch `stimeo--tags-input:change`; DOM/Turbo tag\n * changes dispatch `stimeo--tags-input:reconcile`; authored templates route\n * localized addition/removal text to the shared announcer.\n * - The remove buttons form one roving Tab stop: `ArrowLeft`/`ArrowRight` move\n * between them (right past the end returns to the input), `Delete`/`Backspace`\n * delete the focused tag, and `Backspace` on an empty input deletes the last.\n * - Removing from a chip moves focus to its neighbor (else the input); removing\n * via empty-input `Backspace` keeps focus in the input for continued editing.\n */\nexport class TagsInputController extends Controller<HTMLElement> {\n static override targets = [\"input\", \"tags\", \"tag\", \"tagTemplate\", \"label\", \"remove\", \"fields\"];\n static override values = {\n delimiter: { type: String, default: \",\" },\n max: { type: Number, default: 0 },\n allowDuplicates: { type: Boolean, default: false },\n name: { type: String, default: \"tags[]\" },\n announceText: { type: String, default: \"\" },\n announceRemovedText: { type: String, default: \"\" },\n };\n static actions = [\"onKeydown\"] as const;\n static events = [\"change\", \"reconcile\", \"reject\"] as const;\n\n declare readonly inputTarget: HTMLInputElement;\n declare readonly tagsTarget: HTMLElement;\n declare readonly tagTargets: HTMLElement[];\n declare readonly tagTemplateTarget: HTMLTemplateElement;\n declare readonly labelTargets: HTMLElement[];\n declare readonly removeTargets: HTMLButtonElement[];\n declare readonly fieldsTarget: HTMLElement;\n declare readonly hasFieldsTarget: boolean;\n declare readonly hasTagTemplateTarget: boolean;\n declare readonly hasInputTarget: boolean;\n declare readonly hasTagsTarget: boolean;\n\n declare delimiterValue: string;\n declare maxValue: number;\n declare allowDuplicatesValue: boolean;\n declare nameValue: string;\n declare announceTextValue: string;\n declare announceRemovedTextValue: string;\n\n /** Last reconciled tag order, separating user edits from DOM/Turbo repair. */\n #tagValues: string[] = [];\n /** Whether this connection already reported its unusable chip template. */\n #warnedTemplate = false;\n /** Collapses one target/Value mutation batch into one final-DOM repair pass. */\n readonly #reconcile = new MicrotaskCoalescer(() => this.#reconcileTags());\n readonly #chipRow = new ChipRow({\n directionElement: this.element,\n getItems: () => this.tagTargets,\n getButton: (tag) =>\n tag.querySelector<HTMLButtonElement>('button[data-stimeo--tags-input-target~=\"remove\"]'),\n onRemove: (index) => this.#removeAt(index),\n focusAfterEnd: () => this.#focusInput(),\n });\n /** Owns IME lifecycle state for commit-key guarding. */\n readonly #composition = new CompositionTracker();\n\n /** Wires tag-list keyboard navigation and removal, and seeds the single Tab stop. */\n override connect(): void {\n this.#warnedTemplate = false;\n if (this.hasInputTarget) this.#composition.observe(this.inputTarget);\n if (this.hasTagsTarget) this.#chipRow.connect(this.tagsTarget);\n const tags = this.#values;\n this.#syncState(tags);\n this.#tagValues = tags;\n this.#reconcile.activate();\n }\n\n /** Releases the delegated listeners so no handler outlives the element. */\n override disconnect(): void {\n this.#reconcile.cancel();\n this.#composition.disconnect();\n this.#chipRow.disconnect();\n }\n\n /** Tracks an input added initially or after connect. */\n inputTargetConnected(input: HTMLInputElement): void {\n this.#composition.observe(input);\n }\n\n /** Removes composition listeners when the active input is replaced or removed. */\n inputTargetDisconnected(input: HTMLInputElement): void {\n this.#composition.unobserve(input);\n }\n\n /** Rebinds delegation and derived state when the tags container is replaced. */\n tagsTargetConnected(_tags: HTMLElement): void {\n this.#reconcile.schedule();\n }\n\n /** Releases only the row that disconnected, leaving a newer target intact. */\n tagsTargetDisconnected(tags: HTMLElement): void {\n this.#chipRow.disconnect(tags);\n this.#reconcile.schedule();\n }\n\n /** Reconciles a tag inserted by Turbo, a server render, or another controller. */\n tagTargetConnected(_tag: HTMLElement): void {\n this.#reconcile.schedule();\n }\n\n /** Reconciles a tag removed by Turbo, a server render, or another controller. */\n tagTargetDisconnected(_tag: HTMLElement): void {\n this.#reconcile.schedule();\n }\n\n /** Seeds a fields target inserted after connect. */\n fieldsTargetConnected(): void {\n this.#reconcile.schedule();\n }\n\n /** Rebuilds submitted fields when the public name changes at runtime. */\n nameValueChanged(): void {\n this.#reconcile.schedule();\n }\n\n /** Recomputes the full hook when the cap changes at runtime. */\n maxValueChanged(): void {\n this.#reconcile.schedule();\n }\n\n /** Commits on `Enter`/delimiter and deletes the last tag on empty `Backspace`. */\n onKeydown(event: KeyboardEvent): void {\n // A descendant widget that already claimed the key must not ALSO commit a tag\n // or reach into the chips — composition depends on this yield.\n if (event.defaultPrevented) return;\n if (isReservedArrowChord(event)) return;\n if (!this.hasInputTarget) return;\n // Ignore keys fired during IME composition: the `Enter` that confirms a\n // candidate (and arrows that move within it) must not commit/navigate the\n // chip list. Controller-owned lifecycle state covers confirming events that\n // omit the standard per-event signal.\n if (this.#composition.isComposing(event)) return;\n if (event.key === \"Enter\" || event.key === this.delimiterValue) {\n event.preventDefault();\n this.#commitInput();\n return;\n }\n if (event.key === \"Backspace\" && this.inputTarget.value === \"\") {\n const last = this.#chipRow.lastIndex;\n if (last >= 0) {\n event.preventDefault();\n this.#removeAt(last, \"input\");\n }\n return;\n }\n // Same normalisation as the chip handler below, read from the same element.\n if (logicalArrowKey(event.key, this.element) === \"ArrowLeft\" && this.inputTarget.value === \"\") {\n if (this.#chipRow.length > 0) {\n event.preventDefault();\n this.#chipRow.focusLast();\n }\n }\n }\n\n /** Validates and adds the current input value as a tag, then clears the input. */\n #commitInput(): void {\n const value = this.inputTarget.value.trim();\n if (value === \"\") {\n this.#reject(value, \"empty\");\n return;\n }\n if (this.maxValue > 0 && this.tagTargets.length >= this.maxValue) {\n this.#reject(value, \"max\");\n return;\n }\n if (!this.allowDuplicatesValue && this.#values.includes(value)) {\n this.#reject(value, \"duplicate\");\n return;\n }\n if (!this.#appendTag(value)) return;\n this.inputTarget.value = \"\";\n const tags = this.#values;\n this.#syncState(tags);\n this.#tagValues = tags;\n this.#announceTransition(true, value, tags.length);\n this.dispatch(\"change\", { detail: { tags } });\n }\n\n /** Builds one chip from the template and appends it to the tag list. */\n #appendTag(value: string): boolean {\n if (!this.hasTagsTarget) return false;\n if (!this.hasTagTemplateTarget) return this.#warnTemplate('a \"tagTemplate\" target');\n const fragment = this.tagTemplateTarget.content.cloneNode(true) as DocumentFragment;\n const tag = fragment.querySelector<HTMLElement>('[data-stimeo--tags-input-target~=\"tag\"]');\n const label = fragment.querySelector<HTMLElement>('[data-stimeo--tags-input-target~=\"label\"]');\n const button = fragment.querySelector<HTMLButtonElement>(\n 'button[data-stimeo--tags-input-target~=\"remove\"]',\n );\n const removeName = button?.getAttribute(\"aria-label\")?.trim() ?? \"\";\n if (!tag) return this.#warnTemplate('a \"tag\" target');\n if (!label) return this.#warnTemplate('a \"label\" target');\n if (!button) return this.#warnTemplate('a \"remove\" target <button>');\n if (removeName === \"\") {\n return this.#warnTemplate('a non-empty aria-label on its \"remove\" target');\n }\n tag.dataset.value = value;\n label.textContent = value;\n button.setAttribute(\"aria-label\", fillTemplate(removeName, { label: value, value }));\n button.tabIndex = -1;\n this.tagsTarget.appendChild(fragment);\n return true;\n }\n\n /**\n * Reports an unusable chip template to the author, once per connection.\n *\n * The commit itself stays a no-op — nothing about the input, the tag set, the\n * hidden fields, the announcement, or the events changes. Without this line\n * the only symptom is a field that accepts no tags at all, and the two causes\n * the Inspector cannot see statically (a name that renders empty from a\n * missing translation, a server-rendered template) would have no diagnostic\n * anywhere.\n */\n #warnTemplate(missing: string): false {\n if (!this.#warnedTemplate) {\n this.#warnedTemplate = true;\n console.warn(\n `Stimeo UI: \"${this.identifier}\" added no tag because its chip template lacks ${missing}.`,\n );\n }\n return false;\n }\n\n /** Removes the tag at `index`, then applies the interaction-origin focus policy. */\n #removeAt(index: number, focus: \"neighbor\" | \"input\" = \"neighbor\"): void {\n const tag = this.tagTargets[index];\n if (!tag) return;\n const value = tag.dataset.value ?? \"\";\n tag.remove();\n const tags = this.#values;\n this.#syncState(tags);\n this.#tagValues = tags;\n this.#announceTransition(false, value, tags.length);\n this.dispatch(\"change\", { detail: { tags } });\n if (focus === \"input\") {\n this.#focusInput();\n return;\n }\n if (!this.#chipRow.focusAfterRemoval(index)) this.#focusInput();\n }\n\n /** Moves focus to the current input when one exists. */\n #focusInput(): void {\n if (this.hasInputTarget) this.inputTarget.focus();\n }\n\n /** Rebuilds the hidden form fields, the `full` flag, and the roving Tab stop. */\n #syncState(values: readonly string[]): void {\n if (this.hasFieldsTarget) {\n this.fieldsTarget.replaceChildren(\n ...values.map((value) => {\n const input = document.createElement(\"input\");\n input.type = \"hidden\";\n input.name = this.nameValue;\n input.value = value;\n return input;\n }),\n );\n }\n const full = this.maxValue > 0 && values.length >= this.maxValue;\n this.element.toggleAttribute(\"data-stimeo--tags-input-full\", full);\n // Keep exactly one remove button tabbable so the chip list is a single stop.\n this.#chipRow.ensureTabStop();\n }\n\n /** Repairs derived state after DOM/Turbo changes and reports a changed tag order. */\n #reconcileTags(): void {\n if (this.hasTagsTarget) this.#chipRow.connect(this.tagsTarget);\n else this.#chipRow.disconnect();\n const tags = this.#values;\n this.#syncState(tags);\n const changed = !this.#sameTags(this.#tagValues, tags);\n this.#tagValues = tags;\n if (changed) this.dispatch(\"reconcile\", { detail: { tags } });\n }\n\n /** Sends one localized tag transition through the page's shared announcer. */\n #announceTransition(added: boolean, value: string, count: number): void {\n const template = added ? this.announceTextValue : this.announceRemovedTextValue;\n announce(fillTemplate(template, { label: value, value, count }));\n }\n\n /** Reports rejection with `{ value, reason: \"duplicate\" | \"empty\" | \"max\" }`. */\n #reject(value: string, reason: \"duplicate\" | \"empty\" | \"max\"): void {\n this.dispatch(\"reject\", { detail: { value, reason } });\n }\n\n /** Current tag values in order. */\n get #values(): string[] {\n return this.tagTargets.map((tag) => tag.dataset.value ?? \"\");\n }\n\n /** Whether two arrays carry the same values in the same submitted order. */\n #sameTags(left: readonly string[], right: readonly string[]): boolean {\n return left.length === right.length && left.every((value, index) => value === right[index]);\n }\n}\n"]}
@@ -52,7 +52,7 @@ var TextareaAutosizeController = class extends Controller {
52
52
  } else {
53
53
  el.removeAttribute("data-at-max-rows");
54
54
  }
55
- el.style.setProperty("--stimeo-textarea-rows", String(rows));
55
+ el.style.setProperty("--stimeo--textarea-rows", String(rows));
56
56
  if (height !== this.#lastHeight) {
57
57
  this.#lastHeight = height;
58
58
  this.dispatch("resize", { detail: { height, rows } });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/controllers/textarea_autosize_controller.ts"],"names":[],"mappings":";;;AAGA,SAAS,GAAG,KAAA,EAAuB;AACjC,EAAA,MAAM,CAAA,GAAI,MAAA,CAAO,UAAA,CAAW,KAAK,CAAA;AACjC,EAAA,OAAO,MAAA,CAAO,KAAA,CAAM,CAAC,CAAA,GAAI,CAAA,GAAI,CAAA;AAC/B;AAwBO,IAAM,0BAAA,GAAN,cAAyC,UAAA,CAAgC;AAAA,EAC9E,OAAgB,MAAA,GAAS;AAAA,IACvB,OAAA,EAAS,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,CAAA,EAAE;AAAA,IACpC,OAAA,EAAS,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,CAAA;AAAE,GACtC;AAAA,EACA,OAAO,OAAA,GAAU,CAAC,QAAQ,CAAA;AAAA,EAC1B,OAAO,MAAA,GAAS,CAAC,QAAQ,CAAA;AAAA,EAKzB,WAAA,GAAc,EAAA;AAAA,EAEL,WAAW,MAAY;AAC9B,IAAA,IAAA,CAAK,MAAA,EAAO;AAAA,EACd,CAAA;AAAA,EAES,OAAA,GAAgB;AACvB,IAAA,IAAA,CAAK,OAAA,CAAQ,gBAAA,CAAiB,OAAA,EAAS,IAAA,CAAK,QAAQ,CAAA;AACpD,IAAA,IAAA,CAAK,MAAA,EAAO;AAAA,EACd;AAAA,EAES,UAAA,GAAmB;AAC1B,IAAA,IAAA,CAAK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MAAM,MAAA,GAAS,IAAA,CAAK,KAAA,CAAM,aAAA,GAAgB,QAAQ,CAAA;AAClD,IAAA,EAAA,CAAG,KAAA,CAAM,MAAA,GAAS,CAAA,EAAG,MAAM,CAAA,EAAA,CAAA;AAC3B,IAAA,EAAA,CAAG,KAAA,CAAM,SAAA,GAAY,KAAA,GAAQ,MAAA,GAAS,QAAA;AAEtC,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,EAAA,CAAG,YAAA,CAAa,oBAAoB,MAAM,CAAA;AAAA,IAC5C,CAAA,MAAO;AACL,MAAA,EAAA,CAAG,gBAAgB,kBAAkB,CAAA;AAAA,IACvC;AACA,IAAA,EAAA,CAAG,KAAA,CAAM,WAAA,CAAY,wBAAA,EAA0B,MAAA,CAAO,IAAI,CAAC,CAAA;AAE3D,IAAA,IAAI,MAAA,KAAW,KAAK,WAAA,EAAa;AAC/B,MAAA,IAAA,CAAK,WAAA,GAAc,MAAA;AACnB,MAAA,IAAA,CAAK,QAAA,CAAS,UAAU,EAAE,MAAA,EAAQ,EAAE,MAAA,EAAQ,IAAA,IAAQ,CAAA;AAAA,IACtD;AAAA,EACF;AAAA;AAAA,EAGA,YAAY,KAAA,EAAoC;AAC9C,IAAA,MAAM,EAAA,GAAK,EAAA,CAAG,KAAA,CAAM,UAAU,CAAA;AAC9B,IAAA,IAAI,EAAA,GAAK,GAAG,OAAO,EAAA;AACnB,IAAA,MAAM,QAAA,GAAW,EAAA,CAAG,KAAA,CAAM,QAAQ,CAAA;AAClC,IAAA,OAAO,QAAA,GAAW,CAAA,GAAI,QAAA,GAAW,GAAA,GAAM,EAAA;AAAA,EACzC;AACF","file":"textarea_autosize_controller.js","sourcesContent":["import { Controller } from \"@hotwired/stimulus\";\n\n/** Parses a CSS pixel length, defaulting to 0 for `auto` / empty / `normal`. */\nfunction px(value: string): number {\n const n = Number.parseFloat(value);\n return Number.isNaN(n) ? 0 : n;\n}\n\n/**\n * Headless autosize behavior for a `<textarea>`: grows the element to fit its\n * content (and clamps to `minRows` / `maxRows`, scrolling past the max). No APG\n * pattern; supports WCAG 1.4.4 by following the text as it grows.\n *\n * Markup contract (identifier: `stimeo--textarea-autosize`):\n * <textarea\n * data-controller=\"stimeo--textarea-autosize\"\n * data-stimeo--textarea-autosize-max-rows-value=\"10\"></textarea>\n *\n * On connect and on every input it collapses the element (`height:auto`), reads\n * `scrollHeight`, and sets an explicit pixel height clamped between `minRows` and\n * `maxRows` (in line-height units), toggling internal scrolling and the\n * `data-at-max-rows` hook at the cap. Height-only changes preserve focus and caret.\n *\n * @remarks\n * Behavior only — the height is written to the element's own inline style, never a\n * CSS class. State lives on the element (no module-scope state), so `connect()`\n * re-measures after a Turbo navigation / morph. The input listener is removed on\n * `disconnect()` (Turbo navigation included). Measurement is synchronous, so there\n * is no pending animation frame to tear down.\n */\nexport class TextareaAutosizeController extends Controller<HTMLTextAreaElement> {\n static override values = {\n minRows: { type: Number, default: 1 },\n maxRows: { type: Number, default: 0 },\n };\n static actions = [\"resize\"] as const;\n static events = [\"resize\"] as const;\n\n declare minRowsValue: number;\n declare maxRowsValue: number;\n\n #lastHeight = -1;\n\n readonly #onInput = (): void => {\n this.resize();\n };\n\n override connect(): void {\n this.element.addEventListener(\"input\", this.#onInput);\n this.resize();\n }\n\n override disconnect(): void {\n this.element.removeEventListener(\"input\", this.#onInput);\n }\n\n /** Re-measures the content and applies the clamped height. */\n resize(): void {\n const el = this.element;\n const style = window.getComputedStyle(el);\n const lineHeight = this.#lineHeight(style);\n const paddingV = px(style.paddingTop) + px(style.paddingBottom);\n const borderV = px(style.borderTopWidth) + px(style.borderBottomWidth);\n const borderBox = style.boxSizing === \"border-box\";\n\n // Collapse first so scrollHeight reflects the content, not the prior height.\n el.style.height = \"auto\";\n const contentHeight = Math.max(0, el.scrollHeight - paddingV);\n const rows = Math.max(1, Math.round(contentHeight / lineHeight));\n\n let targetContent = Math.max(contentHeight, this.minRowsValue * lineHeight);\n let atMax = false;\n if (this.maxRowsValue > 0) {\n const maxContent = this.maxRowsValue * lineHeight;\n if (targetContent > maxContent) {\n targetContent = maxContent;\n atMax = true;\n }\n }\n\n const boxExtra = borderBox ? paddingV + borderV : 0;\n const height = Math.round(targetContent + boxExtra);\n el.style.height = `${height}px`;\n el.style.overflowY = atMax ? \"auto\" : \"hidden\";\n\n if (atMax) {\n el.setAttribute(\"data-at-max-rows\", \"true\");\n } else {\n el.removeAttribute(\"data-at-max-rows\");\n }\n el.style.setProperty(\"--stimeo-textarea-rows\", String(rows));\n\n if (height !== this.#lastHeight) {\n this.#lastHeight = height;\n this.dispatch(\"resize\", { detail: { height, rows } });\n }\n }\n\n /** Resolved line height, falling back to ~1.2× font-size when `normal`. */\n #lineHeight(style: CSSStyleDeclaration): number {\n const lh = px(style.lineHeight);\n if (lh > 0) return lh;\n const fontSize = px(style.fontSize);\n return fontSize > 0 ? fontSize * 1.2 : 16;\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/controllers/textarea_autosize_controller.ts"],"names":[],"mappings":";;;AAGA,SAAS,GAAG,KAAA,EAAuB;AACjC,EAAA,MAAM,CAAA,GAAI,MAAA,CAAO,UAAA,CAAW,KAAK,CAAA;AACjC,EAAA,OAAO,MAAA,CAAO,KAAA,CAAM,CAAC,CAAA,GAAI,CAAA,GAAI,CAAA;AAC/B;AAwBO,IAAM,0BAAA,GAAN,cAAyC,UAAA,CAAgC;AAAA,EAC9E,OAAgB,MAAA,GAAS;AAAA,IACvB,OAAA,EAAS,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,CAAA,EAAE;AAAA,IACpC,OAAA,EAAS,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,CAAA;AAAE,GACtC;AAAA,EACA,OAAO,OAAA,GAAU,CAAC,QAAQ,CAAA;AAAA,EAC1B,OAAO,MAAA,GAAS,CAAC,QAAQ,CAAA;AAAA,EAKzB,WAAA,GAAc,EAAA;AAAA,EAEL,WAAW,MAAY;AAC9B,IAAA,IAAA,CAAK,MAAA,EAAO;A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,EACzC;AACF","file":"textarea_autosize_controller.js","sourcesContent":["import { Controller } from \"@hotwired/stimulus\";\n\n/** Parses a CSS pixel length, defaulting to 0 for `auto` / empty / `normal`. */\nfunction px(value: string): number {\n const n = Number.parseFloat(value);\n return Number.isNaN(n) ? 0 : n;\n}\n\n/**\n * Headless autosize behavior for a `<textarea>`: grows the element to fit its\n * content (and clamps to `minRows` / `maxRows`, scrolling past the max). No APG\n * pattern; supports WCAG 1.4.4 by following the text as it grows.\n *\n * Markup contract (identifier: `stimeo--textarea-autosize`):\n * <textarea\n * data-controller=\"stimeo--textarea-autosize\"\n * data-stimeo--textarea-autosize-max-rows-value=\"10\"></textarea>\n *\n * On connect and on every input it collapses the element (`height:auto`), reads\n * `scrollHeight`, and sets an explicit pixel height clamped between `minRows` and\n * `maxRows` (in line-height units), toggling internal scrolling and the\n * `data-at-max-rows` hook at the cap. Height-only changes preserve focus and caret.\n *\n * @remarks\n * Behavior only — the height is written to the element's own inline style, never a\n * CSS class. State lives on the element (no module-scope state), so `connect()`\n * re-measures after a Turbo navigation / morph. The input listener is removed on\n * `disconnect()` (Turbo navigation included). Measurement is synchronous, so there\n * is no pending animation frame to tear down.\n */\nexport class TextareaAutosizeController extends Controller<HTMLTextAreaElement> {\n static override values = {\n minRows: { type: Number, default: 1 },\n maxRows: { type: Number, default: 0 },\n };\n static actions = [\"resize\"] as const;\n static events = [\"resize\"] as const;\n\n declare minRowsValue: number;\n declare maxRowsValue: number;\n\n #lastHeight = -1;\n\n readonly #onInput = (): void => {\n this.resize();\n };\n\n override connect(): void {\n this.element.addEventListener(\"input\", this.#onInput);\n this.resize();\n }\n\n override disconnect(): void {\n this.element.removeEventListener(\"input\", this.#onInput);\n }\n\n /** Re-measures the content and applies the clamped height. */\n resize(): void {\n const el = this.element;\n const style = window.getComputedStyle(el);\n const lineHeight = this.#lineHeight(style);\n const paddingV = px(style.paddingTop) + px(style.paddingBottom);\n const borderV = px(style.borderTopWidth) + px(style.borderBottomWidth);\n const borderBox = style.boxSizing === \"border-box\";\n\n // Collapse first so scrollHeight reflects the content, not the prior height.\n el.style.height = \"auto\";\n const contentHeight = Math.max(0, el.scrollHeight - paddingV);\n const rows = Math.max(1, Math.round(contentHeight / lineHeight));\n\n let targetContent = Math.max(contentHeight, this.minRowsValue * lineHeight);\n let atMax = false;\n if (this.maxRowsValue > 0) {\n const maxContent = this.maxRowsValue * lineHeight;\n if (targetContent > maxContent) {\n targetContent = maxContent;\n atMax = true;\n }\n }\n\n const boxExtra = borderBox ? paddingV + borderV : 0;\n const height = Math.round(targetContent + boxExtra);\n el.style.height = `${height}px`;\n el.style.overflowY = atMax ? \"auto\" : \"hidden\";\n\n if (atMax) {\n el.setAttribute(\"data-at-max-rows\", \"true\");\n } else {\n el.removeAttribute(\"data-at-max-rows\");\n }\n el.style.setProperty(\"--stimeo--textarea-rows\", String(rows));\n\n if (height !== this.#lastHeight) {\n this.#lastHeight = height;\n this.dispatch(\"resize\", { detail: { height, rows } });\n }\n }\n\n /** Resolved line height, falling back to ~1.2× font-size when `normal`. */\n #lineHeight(style: CSSStyleDeclaration): number {\n const lh = px(style.lineHeight);\n if (lh > 0) return lh;\n const fontSize = px(style.fontSize);\n return fontSize > 0 ? fontSize * 1.2 : 16;\n }\n}\n"]}
@@ -3,7 +3,7 @@ import { Controller } from '@hotwired/stimulus';
3
3
  /**
4
4
  * Headless, accessible **time picker** behavior. Each segment (hour, minute,
5
5
  * optional second, optional AM/PM) is an APG **Spinbutton**; the controller
6
- * composes them into an `HH:MM[:SS]` value mirrored to a hidden field.
6
+ * composes them into an `HH:MM[:SS]` value mirrored to an optional hidden field.
7
7
  *
8
8
  * Markup contract (identifier: `stimeo--time-picker`):
9
9
  * <div data-controller="stimeo--time-picker"
@@ -21,12 +21,30 @@ import { Controller } from '@hotwired/stimulus';
21
21
  * </div>
22
22
  *
23
23
  * @remarks
24
- * Behavior only — no styling, no locale formatting. Every segment is its own Tab
25
- * stop (multi-tabstop, *not* roving); `ArrowLeft`/`ArrowRight` are an auxiliary
26
- * move between segments. `ArrowUp`/`ArrowDown` step the focused segment, wrapping
27
- * (and, when `wrap` is set, carrying minutes→hours and seconds→minutes). Typing
28
- * digits enters a value directly and advances after two digits. AM/PM is modeled
29
- * as a `meridiem` spinbutton that toggles; the hidden field is always 24-hour.
24
+ * `segment` targets declare the spinbuttons; the optional `field` target receives
25
+ * the composed form value. `hourCycle` selects 12- or 24-hour presentation
26
+ * (default 24), `step` is the positive integer minute step (default 1), `seconds`
27
+ * includes seconds in the composed value (default false), and `wrap` controls
28
+ * whether stepping crosses segment bounds (default true). The author decides
29
+ * which optional segment targets are present; `seconds` does not create or hide
30
+ * markup.
31
+ *
32
+ * Every segment is its own Tab stop (multi-tabstop, *not* roving), while
33
+ * `ArrowLeft`/`ArrowRight` provide auxiliary movement. `ArrowUp`/`ArrowDown`
34
+ * step the focused spinbutton; wrapping seconds or minutes carries into the next
35
+ * unit, and 12-hour stepping crosses AM/PM at noon and midnight. Typing digits
36
+ * enters a value directly and advances after completion. The digit buffer is
37
+ * discarded on another action, target replacement, or focus departure.
38
+ *
39
+ * A user action that changes the composed value dispatches exactly one bubbling
40
+ * native `change` from the field, when present, and one
41
+ * `stimeo--time-picker:change` with `{ value: string }`. Retained
42
+ * `aria-valuenow`/`data-segment` changes, runtime targets, and
43
+ * `hourCycle`/`seconds` Value changes are reconciled for Turbo morph
44
+ * compatibility; when such a pass moves the composed value — dropping a `second`
45
+ * segment, say — it reports `stimeo--time-picker:reconcile` with the same detail
46
+ * instead, so a consumer can tell its own edit from this controller's repair.
47
+ * Initial connection reports neither.
30
48
  */
31
49
  declare class TimePickerController extends Controller<HTMLElement> {
32
50
  #private;
@@ -50,7 +68,7 @@ declare class TimePickerController extends Controller<HTMLElement> {
50
68
  };
51
69
  };
52
70
  static actions: readonly ["onKeydown"];
53
- static events: readonly ["change"];
71
+ static events: readonly ["change", "reconcile"];
54
72
  readonly segmentTargets: HTMLElement[];
55
73
  readonly fieldTarget: HTMLInputElement;
56
74
  readonly hasFieldTarget: boolean;
@@ -58,9 +76,23 @@ declare class TimePickerController extends Controller<HTMLElement> {
58
76
  stepValue: number;
59
77
  secondsValue: boolean;
60
78
  wrapValue: boolean;
61
- /** Seeds each segment from its initial `aria-valuenow` and syncs the field. */
79
+ /** Seeds state from the DOM, renders canonical ARIA, and starts morph observation. */
62
80
  connect(): void;
63
- /** Handles stepping, inter-segment focus moves, jumps, and direct entry. */
81
+ /** Releases the observer, listener, queued reconciliation, and transient input state. */
82
+ disconnect(): void;
83
+ /** Re-renders the canonical instant when 12/24-hour presentation changes at runtime. */
84
+ hourCycleValueChanged(): void;
85
+ /** Recomposes the optional seconds portion after a runtime Value change. */
86
+ secondsValueChanged(): void;
87
+ /** Adopts a segment inserted or replaced by a Turbo morph. */
88
+ segmentTargetConnected(): void;
89
+ /** Rebuilds state after a segment leaves the retained controller element. */
90
+ segmentTargetDisconnected(): void;
91
+ /** Reflects the current composed value into a field added or replaced at runtime. */
92
+ fieldTargetConnected(): void;
93
+ /** Reconciles silently when the optional field leaves at runtime. */
94
+ fieldTargetDisconnected(): void;
95
+ /** Handles APG stepping, inter-segment focus moves, jumps, and direct entry. */
64
96
  onKeydown(event: KeyboardEvent): void;
65
97
  }
66
98