stimeo-ui 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/dist/controllers/alert_dialog_controller.d.ts +2 -0
- package/dist/controllers/alert_dialog_controller.js +75 -4
- package/dist/controllers/alert_dialog_controller.js.map +1 -1
- package/dist/controllers/auto_submit_controller.d.ts +2 -0
- package/dist/controllers/auto_submit_controller.js.map +1 -1
- package/dist/controllers/avatar_controller.js +47 -5
- package/dist/controllers/avatar_controller.js.map +1 -1
- package/dist/controllers/breadcrumb_controller.d.ts +2 -0
- package/dist/controllers/breadcrumb_controller.js.map +1 -1
- package/dist/controllers/bulk_select_controller.d.ts +2 -0
- package/dist/controllers/bulk_select_controller.js.map +1 -1
- package/dist/controllers/calendar_controller.d.ts +2 -0
- package/dist/controllers/calendar_controller.js.map +1 -1
- package/dist/controllers/character_counter_controller.d.ts +52 -20
- package/dist/controllers/character_counter_controller.js +338 -63
- package/dist/controllers/character_counter_controller.js.map +1 -1
- package/dist/controllers/checkbox_controller.d.ts +3 -0
- package/dist/controllers/checkbox_controller.js.map +1 -1
- package/dist/controllers/color_picker_controller.d.ts +3 -0
- package/dist/controllers/color_picker_controller.js.map +1 -1
- package/dist/controllers/combobox_controller.d.ts +2 -0
- package/dist/controllers/combobox_controller.js.map +1 -1
- package/dist/controllers/command_palette_controller.d.ts +2 -0
- package/dist/controllers/command_palette_controller.js +75 -4
- package/dist/controllers/command_palette_controller.js.map +1 -1
- package/dist/controllers/conditional_fields_controller.d.ts +42 -14
- package/dist/controllers/conditional_fields_controller.js +345 -51
- package/dist/controllers/conditional_fields_controller.js.map +1 -1
- package/dist/controllers/confirm_controller.d.ts +2 -0
- package/dist/controllers/confirm_controller.js +75 -4
- package/dist/controllers/confirm_controller.js.map +1 -1
- package/dist/controllers/count_up_controller.d.ts +2 -0
- package/dist/controllers/count_up_controller.js.map +1 -1
- package/dist/controllers/countdown_controller.d.ts +4 -0
- package/dist/controllers/countdown_controller.js.map +1 -1
- package/dist/controllers/currency_input_controller.d.ts +2 -0
- package/dist/controllers/currency_input_controller.js.map +1 -1
- package/dist/controllers/data_grid_controller.d.ts +3 -0
- package/dist/controllers/data_grid_controller.js.map +1 -1
- package/dist/controllers/dialog_controller.js +75 -4
- package/dist/controllers/dialog_controller.js.map +1 -1
- package/dist/controllers/direct_upload_controller.d.ts +56 -24
- package/dist/controllers/direct_upload_controller.js +201 -45
- package/dist/controllers/direct_upload_controller.js.map +1 -1
- package/dist/controllers/dirty_form_controller.d.ts +14 -6
- package/dist/controllers/dirty_form_controller.js +192 -29
- package/dist/controllers/dirty_form_controller.js.map +1 -1
- package/dist/controllers/dismissible_controller.d.ts +2 -0
- package/dist/controllers/dismissible_controller.js +83 -18
- package/dist/controllers/dismissible_controller.js.map +1 -1
- package/dist/controllers/drawer_controller.js +75 -4
- package/dist/controllers/drawer_controller.js.map +1 -1
- package/dist/controllers/empty_state_controller.d.ts +2 -0
- package/dist/controllers/empty_state_controller.js.map +1 -1
- package/dist/controllers/file_dropzone_controller.d.ts +2 -0
- package/dist/controllers/file_dropzone_controller.js.map +1 -1
- package/dist/controllers/filter_controller.d.ts +2 -0
- package/dist/controllers/filter_controller.js.map +1 -1
- package/dist/controllers/flash_controller.d.ts +4 -0
- package/dist/controllers/flash_controller.js.map +1 -1
- package/dist/controllers/focus_controller.d.ts +2 -0
- package/dist/controllers/focus_controller.js +75 -4
- package/dist/controllers/focus_controller.js.map +1 -1
- package/dist/controllers/form_field_controller.d.ts +50 -10
- package/dist/controllers/form_field_controller.js +280 -62
- package/dist/controllers/form_field_controller.js.map +1 -1
- package/dist/controllers/form_validation_controller.d.ts +10 -8
- package/dist/controllers/form_validation_controller.js +208 -83
- package/dist/controllers/form_validation_controller.js.map +1 -1
- package/dist/controllers/frame_loading_controller.d.ts +2 -0
- package/dist/controllers/frame_loading_controller.js.map +1 -1
- package/dist/controllers/highlight_controller.d.ts +2 -0
- package/dist/controllers/highlight_controller.js.map +1 -1
- package/dist/controllers/idle_controller.d.ts +2 -0
- package/dist/controllers/idle_controller.js.map +1 -1
- package/dist/controllers/input_mask_controller.d.ts +2 -0
- package/dist/controllers/input_mask_controller.js.map +1 -1
- package/dist/controllers/lazy_frame_controller.d.ts +2 -0
- package/dist/controllers/lazy_frame_controller.js.map +1 -1
- package/dist/controllers/listbox_controller.d.ts +2 -0
- package/dist/controllers/listbox_controller.js.map +1 -1
- package/dist/controllers/local_time_controller.d.ts +2 -0
- package/dist/controllers/local_time_controller.js.map +1 -1
- package/dist/controllers/masonry_controller.d.ts +2 -0
- package/dist/controllers/masonry_controller.js.map +1 -1
- package/dist/controllers/meter_controller.d.ts +2 -0
- package/dist/controllers/meter_controller.js.map +1 -1
- package/dist/controllers/multi_select_controller.d.ts +2 -0
- package/dist/controllers/multi_select_controller.js.map +1 -1
- package/dist/controllers/nested_form_controller.d.ts +2 -0
- package/dist/controllers/nested_form_controller.js.map +1 -1
- package/dist/controllers/network_status_controller.d.ts +2 -0
- package/dist/controllers/network_status_controller.js.map +1 -1
- package/dist/controllers/number_input_controller.d.ts +2 -0
- package/dist/controllers/number_input_controller.js +47 -5
- package/dist/controllers/number_input_controller.js.map +1 -1
- package/dist/controllers/otp_controller.d.ts +3 -0
- package/dist/controllers/otp_controller.js.map +1 -1
- package/dist/controllers/overflow_indicator_controller.d.ts +2 -0
- package/dist/controllers/overflow_indicator_controller.js.map +1 -1
- package/dist/controllers/overflow_menu_controller.d.ts +2 -0
- package/dist/controllers/overflow_menu_controller.js +2 -1
- package/dist/controllers/overflow_menu_controller.js.map +1 -1
- package/dist/controllers/pagination_controller.d.ts +2 -0
- package/dist/controllers/pagination_controller.js +2 -1
- package/dist/controllers/pagination_controller.js.map +1 -1
- package/dist/controllers/password_reveal_controller.d.ts +2 -0
- package/dist/controllers/password_reveal_controller.js.map +1 -1
- package/dist/controllers/password_strength_controller.d.ts +2 -0
- package/dist/controllers/password_strength_controller.js.map +1 -1
- package/dist/controllers/persist_controller.d.ts +30 -16
- package/dist/controllers/persist_controller.js +432 -122
- package/dist/controllers/persist_controller.js.map +1 -1
- package/dist/controllers/pointer_drag_controller.d.ts +3 -0
- package/dist/controllers/pointer_drag_controller.js.map +1 -1
- package/dist/controllers/popover_controller.js +77 -4
- package/dist/controllers/popover_controller.js.map +1 -1
- package/dist/controllers/portal_controller.d.ts +2 -0
- package/dist/controllers/portal_controller.js.map +1 -1
- package/dist/controllers/preview_guard_controller.d.ts +2 -0
- package/dist/controllers/preview_guard_controller.js.map +1 -1
- package/dist/controllers/progress_controller.d.ts +3 -0
- package/dist/controllers/progress_controller.js.map +1 -1
- package/dist/controllers/radio_group_controller.d.ts +3 -0
- package/dist/controllers/radio_group_controller.js.map +1 -1
- package/dist/controllers/rating_controller.d.ts +2 -0
- package/dist/controllers/rating_controller.js +9 -5
- package/dist/controllers/rating_controller.js.map +1 -1
- package/dist/controllers/reading_progress_controller.d.ts +2 -0
- package/dist/controllers/reading_progress_controller.js.map +1 -1
- package/dist/controllers/resizable_controller.d.ts +2 -0
- package/dist/controllers/resizable_controller.js.map +1 -1
- package/dist/controllers/roving_controller.d.ts +2 -0
- package/dist/controllers/roving_controller.js.map +1 -1
- package/dist/controllers/scroll_area_controller.d.ts +23 -15
- package/dist/controllers/scroll_area_controller.js +462 -162
- package/dist/controllers/scroll_area_controller.js.map +1 -1
- package/dist/controllers/scroll_visibility_controller.d.ts +2 -0
- package/dist/controllers/scroll_visibility_controller.js.map +1 -1
- package/dist/controllers/scrollspy_controller.d.ts +2 -0
- package/dist/controllers/scrollspy_controller.js.map +1 -1
- package/dist/controllers/separator_controller.d.ts +54 -11
- package/dist/controllers/separator_controller.js +354 -38
- package/dist/controllers/separator_controller.js.map +1 -1
- package/dist/controllers/sidebar_controller.js +83 -10
- package/dist/controllers/sidebar_controller.js.map +1 -1
- package/dist/controllers/skeleton_controller.d.ts +2 -0
- package/dist/controllers/skeleton_controller.js.map +1 -1
- package/dist/controllers/slider_controller.d.ts +2 -0
- package/dist/controllers/slider_controller.js.map +1 -1
- package/dist/controllers/smart_sticky_header_controller.d.ts +2 -0
- package/dist/controllers/smart_sticky_header_controller.js.map +1 -1
- package/dist/controllers/spinner_controller.d.ts +2 -0
- package/dist/controllers/spinner_controller.js.map +1 -1
- package/dist/controllers/step_indicator_controller.d.ts +2 -0
- package/dist/controllers/step_indicator_controller.js.map +1 -1
- package/dist/controllers/stepper_controller.d.ts +2 -0
- package/dist/controllers/stepper_controller.js.map +1 -1
- package/dist/controllers/stick_to_bottom_controller.d.ts +2 -0
- package/dist/controllers/stick_to_bottom_controller.js.map +1 -1
- package/dist/controllers/sticky_observer_controller.d.ts +2 -0
- package/dist/controllers/sticky_observer_controller.js.map +1 -1
- package/dist/controllers/submit_once_controller.d.ts +94 -38
- package/dist/controllers/submit_once_controller.js +399 -121
- package/dist/controllers/submit_once_controller.js.map +1 -1
- package/dist/controllers/switch_controller.d.ts +2 -0
- package/dist/controllers/switch_controller.js.map +1 -1
- package/dist/controllers/tags_input_controller.d.ts +2 -0
- package/dist/controllers/tags_input_controller.js.map +1 -1
- package/dist/controllers/textarea_autosize_controller.d.ts +2 -0
- package/dist/controllers/textarea_autosize_controller.js.map +1 -1
- package/dist/controllers/theme_controller.d.ts +2 -0
- package/dist/controllers/theme_controller.js +8 -6
- package/dist/controllers/theme_controller.js.map +1 -1
- package/dist/controllers/time_picker_controller.d.ts +2 -0
- package/dist/controllers/time_picker_controller.js.map +1 -1
- package/dist/controllers/toast_controller.d.ts +4 -0
- package/dist/controllers/toast_controller.js.map +1 -1
- package/dist/controllers/toggle_group_controller.d.ts +2 -0
- package/dist/controllers/toggle_group_controller.js.map +1 -1
- package/dist/controllers/toolbar_controller.js.map +1 -1
- package/dist/controllers/transition_controller.d.ts +2 -0
- package/dist/controllers/transition_controller.js.map +1 -1
- package/dist/controllers/tree_view_controller.d.ts +2 -0
- package/dist/controllers/tree_view_controller.js +2 -1
- package/dist/controllers/tree_view_controller.js.map +1 -1
- package/dist/index.js +2387 -861
- package/dist/index.js.map +1 -1
- package/dist/inspector/cli.d.ts +107 -3
- package/dist/inspector/cli.js +192 -14
- package/dist/inspector/cli.js.map +1 -1
- package/dist/inspector/cli_bin.js +254 -46
- package/dist/inspector/cli_bin.js.map +1 -1
- package/dist/inspector/examples.json +7 -7
- package/dist/inspector/manifest.json +434 -44
- package/dist/positioning/index.d.ts +2 -0
- package/dist/positioning/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/logical_scroll.ts","../../src/utils/arrow_step.ts","../../src/utils/focus_candidate.ts","../../src/utils/interactive_host.ts","../../src/utils/microtask_coalescer.ts","../../src/utils/roving_tabindex.ts","../../src/controllers/radio_group_controller.ts"],"names":[],"mappings":";;;;;AAiBO,SAAS,MAAM,OAAA,EAA2B;AAC/C,EAAA,OAAO,MAAA,CAAO,gBAAA,CAAiB,OAAO,CAAA,CAAE,SAAA,KAAc,KAAA;AACxD;;;ACiBO,SAAS,gBAAA,CAAiB,KAAa,OAAA,EAA8B;AAC1E,EAAA,IAAI,GAAA,KAAQ,aAAa,OAAO,CAAA;AAChC,EAAA,IAAI,GAAA,KAAQ,WAAW,OAAO,EAAA;AAC9B,EAAA,IAAI,GAAA,KAAQ,YAAA,IAAgB,GAAA,KAAQ,WAAA,EAAa,OAAO,CAAA;AACxD,EAAA,MAAM,OAAA,GAAU,KAAA,CAAM,OAAO,CAAA,GAAI,WAAA,GAAc,YAAA;AAC/C,EAAA,OAAO,GAAA,KAAQ,UAAU,CAAA,GAAI,EAAA;AAC/B;AAqDO,SAAS,oBAAA,CACd,KAAA,EACA,KAAA,GAAkC,EAAC,EAC1B;AACT,EAAA,IAAI,CAAC,KAAA,CAAM,GAAA,CAAI,UAAA,CAAW,OAAO,GAAG,OAAO,KAAA;AAC3C,EAAA,OACG,KAAA,CAAM,MAAA,IAAU,CAAC,KAAA,CAAM,QAAA,CAAS,KAAK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A0B,EAAC,EACtC;AACN,IAAA,IAAI,CAAC,KAAK,cAAA,EAAgB;AAC1B,IAAA,MAAM,KAAA,GAAQ,KAAA,GAAQ,IAAA,CAAK,WAAA,CAAY,KAAK,CAAA,GAAI,EAAA;AAChD,IAAA,IAAI,IAAA,CAAK,WAAA,CAAY,KAAA,KAAU,KAAA,EAAO;AACtC,IAAA,IAAA,CAAK,YAAY,KAAA,GAAQ,KAAA;AACzB,IAAA,IAAI,CAAC,MAAA,EAAQ,IAAA,CAAK,WAAA,CAAY,aAAA,CAAc,IAAI,KAAA,CAAM,QAAA,EAAU,EAAE,OAAA,EAAS,IAAA,EAAM,CAAC,CAAA;AAAA,EACpF;AAAA;AAAA,EAGA,YAAY,KAAA,EAA4B;AACtC,IAAA,OAAO,KAAA,CAAM,YAAA,CAAa,YAAY,CAAA,IAAK,EAAA;AAAA,EAC7C;AACF","file":"radio_group_controller.js","sourcesContent":["/** Normalized scroll position and maximum distance on one logical axis. */\nexport interface LogicalScrollMetrics {\n position: number;\n max: number;\n}\n\n/**\n * Whether horizontal scrolling on `element` follows right-to-left inline flow.\n *\n * Resolved from the **computed** `direction`, so the authoring contract is the\n * usual `dir=\"rtl\"` (or a stylesheet) on the element or any ancestor.\n *\n * Scope: horizontal writing modes. A vertical writing mode (`writing-mode:\n * vertical-rl`) also inverts the horizontal axis, which this check does not\n * model — vertical writing modes are out of scope for the scroll utilities\n * (their consumers describe axes as horizontal/vertical, not inline/block).\n */\nexport function isRtl(element: Element): boolean {\n return window.getComputedStyle(element).direction === \"rtl\";\n}\n\n/**\n * Returns scroll distance from the logical start edge.\n *\n * CSSOM View exposes standards-mode RTL horizontal offsets as `0` at the inline\n * start (right) and increasingly negative values toward the inline end (left).\n * The normalized position is always clamped to `[0, max]`, which also absorbs\n * Safari's elastic overscroll values.\n */\nexport function logicalScrollMetrics(\n element: HTMLElement,\n horizontal: boolean,\n): LogicalScrollMetrics {\n const max = Math.max(\n 0,\n horizontal\n ? element.scrollWidth - element.clientWidth\n : element.scrollHeight - element.clientHeight,\n );\n const raw = horizontal ? element.scrollLeft : element.scrollTop;\n const position = horizontal && isRtl(element) ? -raw : raw;\n return { position: Math.min(max, Math.max(0, position)), max };\n}\n\n/**\n * Converts a logical start/end delta to the physical value accepted by\n * `Element.scrollBy`.\n */\nexport function physicalScrollDelta(\n element: HTMLElement,\n horizontal: boolean,\n logicalDelta: number,\n): number {\n return horizontal && isRtl(element) ? -logicalDelta : logicalDelta;\n}\n","import { isRtl } from \"./logical_scroll\";\n\n/**\n * Turns an arrow key into a **logical** step: `+1` for \"next\", `-1` for\n * \"previous\", `0` when the key names neither.\n *\n * APG defines the horizontal pair as *next / previous* and says a vertical\n * arrangement swaps in Down/Up for the same meaning — so the pair is one axis's\n * spelling of an order, and the order reverses with the writing direction. Only\n * the horizontal pair reverses. Down/Up name an axis the writing direction does\n * not mirror, and returning them unchanged is the point: many controllers fold\n * both pairs into one branch, where swapping the branches under RTL would flip\n * the vertical axis too — a bug that reads as \"the arrows work\" until someone\n * presses Down.\n *\n * **Direction is read from the element the caller passes, which should be the\n * container that lays the items out** — not the focused child. A child may carry\n * its own `dir` (an LTR input inside an RTL form is ordinary authoring), and\n * probing per handler makes two handlers disagree at the boundary between them.\n *\n * This decides direction only. Whether the axis is even active (an\n * `orientation=\"horizontal\"` widget ignoring Down/Up), how far the step lands,\n * and what wrapping does all stay with the caller.\n *\n * **It encodes the list-order convention: `ArrowDown` is *next*.** Widgets that\n * pair the arrows by *value* instead — `ArrowUp` meaning \"more\", as a rating or a\n * slider does — must not use this, or their vertical axis inverts. Reverse the\n * horizontal pair on its own there.\n *\n * @example\n * ```ts\n * const step = logicalArrowStep(event.key, this.element);\n * if (step === 0) return;\n * this.#roving.setActive(rovingMove(current, length, step, \"wrap\"), { focus: true });\n * ```\n */\nexport function logicalArrowStep(key: string, element: Element): 1 | -1 | 0 {\n if (key === \"ArrowDown\") return 1;\n if (key === \"ArrowUp\") return -1;\n if (key !== \"ArrowRight\" && key !== \"ArrowLeft\") return 0;\n const forward = isRtl(element) ? \"ArrowLeft\" : \"ArrowRight\";\n return key === forward ? 1 : -1;\n}\n\n/**\n * Rewrites `key` so an existing LTR-shaped branch keeps working under RTL:\n * `ArrowRight` and `ArrowLeft` trade places, everything else passes through.\n *\n * The alternative — negating a delta — silently breaks handlers whose two\n * horizontal branches are **not mirror images**. A grid that clamps one edge but\n * not the other, or a segmented field guarding `index > 0` on one side and\n * `index < length - 1` on the other, ends up applying the wrong guard to the\n * wrong direction. Swapping the key leaves each branch, guards and all, exactly\n * where its author put it.\n *\n * Same rule as {@link logicalArrowStep} about which element to read: pass the\n * container that lays the items out, not the focused child.\n *\n * @example\n * ```ts\n * switch (logicalArrowKey(event.key, this.element)) {\n * case \"ArrowLeft\": // \"previous\" — whatever direction that is on screen\n * ```\n */\nexport function logicalArrowKey(key: string, element: Element): string {\n if (key !== \"ArrowRight\" && key !== \"ArrowLeft\") return key;\n if (!isRtl(element)) return key;\n return key === \"ArrowRight\" ? \"ArrowLeft\" : \"ArrowRight\";\n}\n\n/** Modifiers a widget may claim on an arrow key, named for the `allow` list. */\nexport type ArrowModifier = \"alt\" | \"ctrl\" | \"meta\" | \"shift\";\n\n/**\n * True when an arrow key arrived carrying a modifier the widget must leave to\n * the browser: return without calling `preventDefault()` and without moving any\n * state.\n *\n * A bare arrow belongs to the widget; a chorded one usually does not.\n * `Alt`/`Meta` plus a horizontal arrow is history back/forward on every desktop\n * browser, and a widget that swallows it makes the shortcut work or not\n * depending on where focus happens to sit — a coin-flip the user cannot see.\n *\n * `allow` is for the combinations APG assigns to a pattern **and the widget\n * actually implements** — today only Combobox's optional `Alt+Down`/`Alt+Up`.\n * Listing one the widget does not implement defeats the point: the chord then\n * runs the plain-arrow branch, which is exactly what this guard exists to stop.\n * Non-arrow keys return `false`, so chorded letters and\n * `Control+Home`/`Control+End` are untouched.\n *\n * @example\n * ```ts\n * if (isReservedArrowChord(event)) return;\n * ```\n */\nexport function isReservedArrowChord(\n event: KeyboardEvent,\n allow: readonly ArrowModifier[] = [],\n): boolean {\n if (!event.key.startsWith(\"Arrow\")) return false;\n return (\n (event.altKey && !allow.includes(\"alt\")) ||\n (event.ctrlKey && !allow.includes(\"ctrl\")) ||\n (event.metaKey && !allow.includes(\"meta\")) ||\n (event.shiftKey && !allow.includes(\"shift\"))\n );\n}\n","/**\n * Whether a disabled `<fieldset>` ancestor actually reaches `control`.\n *\n * HTML exempts the contents of a fieldset's **first direct-child `<legend>`**, and\n * the exemption is per fieldset — a control legal in one legend can still be\n * disabled by a second, outer fieldset, so the walk continues upward.\n *\n * Exported for the consumer that needs this rule *without* the rest of\n * {@link canTakeFocus}: `toolbar` bounds its own `hidden` walk at the toolbar\n * root, which is a different rule, so it composes the two itself.\n */\nexport function inheritsFieldsetDisabled(control: HTMLElement): boolean {\n let fieldset: Element | null = control.closest(\"fieldset[disabled]\");\n while (fieldset) {\n const legend = Array.from(fieldset.children).find((child) => child.tagName === \"LEGEND\");\n if (!legend?.contains(control)) return true;\n fieldset = fieldset.parentElement?.closest(\"fieldset[disabled]\") ?? null;\n }\n return false;\n}\n\n/**\n * Whether an element can actually take focus, checked **before** `focus()` runs.\n *\n * A controller that must move focus off a control it is about to disable or hide\n * picks a destination and calls `focus()` on it. If that destination cannot take\n * focus, the call **fails silently**: `hidden` and natively `disabled` elements\n * swallow it, so the caret stays in the subtree that is disappearing and lands on\n * `<body>` a frame later — the exact outcome the rescue exists to prevent, minus\n * any signal that it happened.\n *\n * Testing after the fact is the obvious alternative and is deliberately not the\n * rule. Reading `document.activeElement` back only works in a real browser, and\n * looping over candidates that way performs a real focus move per failure —\n * observable to assistive technology. Checking first costs nothing and catches\n * the cases that actually occur.\n *\n * **`aria-disabled` is not disqualifying.** It is the attribute an author uses\n * for a control that must stay *discoverable*, and the roving contract keeps\n * such items reachable. Only the three conditions that make the platform refuse\n * focus are checked: `hidden` (an ancestor's counts), the native `disabled`\n * property, and `disabled` inherited from an ancestor `fieldset`. CSS-only\n * invisibility is not detectable here and stays the consumer's problem.\n *\n * Reading `:disabled` instead of walking the fieldset chain would be shorter, but\n * that pseudo-class is not evaluated consistently outside real browsers and this\n * has to be right headlessly too. happy-dom in particular focuses a `<button>`\n * inside a disabled fieldset where a real engine refuses, so the inheritance is\n * spelled out rather than delegated.\n *\n * What a consumer does when nothing survives is its own call: some fall back to\n * their landmark, while a widget whose caret already sits somewhere legitimate\n * refuses the move outright rather than relocating it.\n *\n * @example\n * ```ts\n * const target = candidates.find(canTakeFocus);\n * if (target) target.focus();\n * else {\n * this.#tabindex.lend(this.element); // nothing left: fall back to the landmark\n * this.element.focus();\n * }\n * ```\n *\n * @param element - the candidate destination\n */\nexport function canTakeFocus(element: HTMLElement): boolean {\n if (element.closest(\"[hidden]\")) return false;\n if (!(\"disabled\" in element)) return true;\n if ((element as HTMLElement & { disabled: boolean }).disabled) return false;\n return !inheritsFieldsetDisabled(element);\n}\n","/**\n * Native interactive elements whose built-in activation must not be replaced\n * wholesale by a controller. Deliberately excludes `[tabindex]`: a generic\n * element made focusable is the supported host for several headless patterns.\n * Contenteditable is handled by {@link isInteractiveHost} because its state is\n * inherited and its keywords are ASCII-case-insensitive.\n */\nexport const INTERACTIVE_HOST_SELECTOR =\n \"button, input, select, textarea, label, a[href], area[href], summary, details, audio[controls], video[controls], iframe, object, embed\";\n\n/**\n * Whether an element owns native activation or an inherited editing surface.\n *\n * The `contenteditable` missing and invalid states inherit. Walking explicitly\n * also keeps `contenteditable=\"false\"` as a real boundary inside an editable\n * ancestor instead of treating any ancestor attribute as decisive.\n */\nexport function isInteractiveHost(element: HTMLElement): boolean {\n if (element.matches(INTERACTIVE_HOST_SELECTOR)) return true;\n\n let current: HTMLElement | null = element;\n while (current) {\n const raw = current.getAttribute(\"contenteditable\");\n if (raw !== null) {\n const value = raw.trim().toLowerCase();\n if (value === \"false\") return false;\n if (value === \"\" || value === \"true\" || value === \"plaintext-only\") return true;\n }\n current = current.parentElement;\n }\n return false;\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","/**\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 { Controller } from \"@hotwired/stimulus\";\nimport { isReservedArrowChord, logicalArrowStep } from \"../utils/arrow_step\";\nimport { inheritsFieldsetDisabled } from \"../utils/focus_candidate\";\nimport { isInteractiveHost } from \"../utils/interactive_host\";\nimport { MicrotaskCoalescer } from \"../utils/microtask_coalescer\";\nimport { RovingTabindex, rovingMove } from \"../utils/roving_tabindex\";\n\n/**\n * An attribute value this controller wrote, with how many observer records it\n * still owns. A pass that writes the same attribute more than once produces one\n * record per write, all reading back the final value, so the count is what keeps\n * the later records from looking like an author's edit.\n */\ninterface InternalWrite {\n value: string | null;\n count: number;\n}\n\n/** Radio and field attributes whose retained-element changes alter group state. */\nconst OBSERVED_ATTRIBUTES = [\n \"aria-checked\",\n \"aria-disabled\",\n \"contenteditable\",\n \"controls\",\n \"data-value\",\n \"disabled\",\n \"hidden\",\n \"href\",\n \"tabindex\",\n \"type\",\n \"value\",\n];\n\n/** Modifier keys that leave document-level Home/End shortcuts outside the widget. */\nconst hasModifier = (event: KeyboardEvent): boolean =>\n event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;\n\n/**\n * Headless, accessible radio-group behavior for **custom** radios.\n *\n * Markup contract (identifier: `stimeo--radio-group`):\n * <div data-controller=\"stimeo--radio-group\" role=\"radiogroup\" aria-label=\"Plan\">\n * <div role=\"radio\" aria-checked=\"true\" tabindex=\"0\" data-value=\"basic\"\n * data-stimeo--radio-group-target=\"radio\">Basic</div>\n * <!-- more radios; exactly one navigable radio has tabindex=0 -->\n * <input type=\"hidden\" data-stimeo--radio-group-target=\"field\" />\n * </div>\n *\n * Implements the WAI-ARIA APG **Radio Group** pattern. Use this only for custom\n * radios; native `<input type=\"radio\">` already owns its activation and form\n * semantics and should be preferred when its appearance is sufficient.\n *\n * @remarks\n * Behavior only — selection is exposed through `aria-checked`, the single Tab\n * stop through roving `tabindex` ({@link RovingTabindex}); the consumer styles\n * those attributes. Selection follows focus for enabled radios.\n *\n * A supported radio is either `<button type=\"button\">` or a non-interactive\n * host such as `<div role=\"radio\">`. Other native interactive elements retain\n * their activation model and this controller stands down on them.\n *\n * Click and keydown handling are delegated from the group, so radios added at\n * runtime need only the `radio` target. Per-radio `data-action` bindings to\n * {@link select} and {@link onKeydown} remain supported and are idempotent when\n * combined with delegation.\n *\n * Behavior provided:\n * - Click selects a radio.\n * - `ArrowDown`/`ArrowRight` select the next, `ArrowUp`/`ArrowLeft` the previous\n * (wrapping); `Home`/`End` the first/last; `Space` selects the focused radio.\n * - Native-disabled and hidden radios are skipped. ARIA-disabled radios remain\n * discoverable in the roving order but cannot be selected.\n * - The selected radio's `data-value` is mirrored to the optional hidden field.\n * `stimeo--radio-group:change` is dispatched only when selection identity\n * changes through user interaction.\n * - `stimeo--radio-group:reconcile` reports a selection this controller decided\n * on its own — a removed selection, or first-wins over duplicate checked state\n * — carrying the same detail as `change`. The hidden field's native `change`\n * stays reserved for user edits, so form automation never sees a repair as one.\n */\nexport class RadioGroupController extends Controller<HTMLElement> {\n static override targets = [\"radio\", \"field\"];\n static actions = [\"onKeydown\", \"select\"] as const;\n static events = [\"change\", \"reconcile\"] as const;\n\n declare readonly radioTargets: HTMLElement[];\n declare readonly fieldTarget: HTMLInputElement;\n declare readonly hasFieldTarget: boolean;\n\n readonly #roving = new RovingTabindex(() => this.#managedTargets);\n readonly #reconcile = new MicrotaskCoalescer(() => this.#reconcileDom());\n readonly #handledEvents = new WeakSet<Event>();\n readonly #managedRadios = new Set<HTMLElement>();\n readonly #originalTabindex = new Map<HTMLElement, string | null>();\n readonly #ownedChecked = new Set<HTMLElement>();\n readonly #internalCheckedValues = new Map<HTMLElement, InternalWrite>();\n readonly #internalTabindexValues = new Map<HTMLElement, InternalWrite>();\n #observer: MutationObserver | null = null;\n #committedRadio: HTMLElement | null = null;\n #connected = false;\n #lastOrder: HTMLElement[] = [];\n #focusedRadio: HTMLElement | null = null;\n #pendingFocusIndex: number | null = null;\n #preferChecked = false;\n\n /**\n * Normalizes authored selection, establishes the APG Tab entry point, and\n * reflects derived form state without reporting a user edit.\n */\n override connect(): void {\n const currentRadios = new Set(this.radioTargets);\n for (const radio of this.#managedRadios) {\n if (!currentRadios.has(radio)) this.#releaseRadio(radio);\n }\n for (const radio of this.radioTargets) this.#reconcileHost(radio, false);\n this.#normalizeSelection();\n this.#ensureTabStop(true);\n this.#reflectField(this.#selectedRadio, { silent: true });\n this.#committedRadio = this.#selectedRadio ?? null;\n this.#lastOrder = this.#managedTargets;\n\n this.element.addEventListener(\"click\", this.#onClickCapture, true);\n this.element.addEventListener(\"keydown\", this.#onKeydownCapture, true);\n this.element.addEventListener(\"click\", this.#onClick);\n this.element.addEventListener(\"keydown\", this.#onKeydown);\n this.element.addEventListener(\"focusin\", this.#onFocusin);\n this.element.addEventListener(\"focusout\", this.#onFocusout);\n this.#connected = true;\n this.#preferChecked = false;\n this.#internalCheckedValues.clear();\n this.#internalTabindexValues.clear();\n this.#reconcile.activate();\n this.#observeMutations();\n }\n\n /** Releases every listener, observer, and queued pass while retaining live DOM state. */\n override disconnect(): void {\n this.#connected = false;\n this.#reconcile.cancel();\n this.element.removeEventListener(\"click\", this.#onClickCapture, true);\n this.element.removeEventListener(\"keydown\", this.#onKeydownCapture, true);\n this.element.removeEventListener(\"click\", this.#onClick);\n this.element.removeEventListener(\"keydown\", this.#onKeydown);\n this.element.removeEventListener(\"focusin\", this.#onFocusin);\n this.element.removeEventListener(\"focusout\", this.#onFocusout);\n this.#observer?.disconnect();\n this.#observer = null;\n this.#internalCheckedValues.clear();\n this.#internalTabindexValues.clear();\n this.#focusedRadio = null;\n this.#pendingFocusIndex = null;\n this.#committedRadio = null;\n this.#preferChecked = false;\n }\n\n /** Removes a newly connected radio from the Tab sequence before batch reconciliation. */\n radioTargetConnected(radio: HTMLElement): void {\n if (this.#connected === false) return;\n this.#reconcileHost(radio, true);\n this.#preferChecked = true;\n this.#reconcile.schedule();\n }\n\n /** Releases target-only attributes and repairs selection, form state, focus, and roving. */\n radioTargetDisconnected(radio: HTMLElement): void {\n if (!this.#connected) return;\n if (this.#focusedRadio === radio) {\n // A radio that arrived and left inside one batch is absent from the saved\n // order; `-1` then makes the search start from the top, which is where a\n // group with no position to return to belongs.\n this.#pendingFocusIndex = this.#lastOrder.indexOf(radio);\n this.#focusedRadio = null;\n }\n this.#releaseRadio(radio);\n this.#preferChecked = true;\n this.#reconcile.schedule();\n }\n\n /** Reflects the current selection into a field added or replaced at runtime. */\n fieldTargetConnected(): void {\n this.#reconcile.schedule();\n }\n\n /** Reconciles after a field target is removed from a retained group. */\n fieldTargetDisconnected(): void {\n this.#reconcile.schedule();\n }\n\n /** Selects the action's radio. Per-radio action wiring is optional. */\n select(event: Event): void {\n if (event.defaultPrevented || !this.#ownsEventTarget(event.target)) return;\n const radio = event.currentTarget as HTMLElement | null;\n if (!radio || !this.radioTargets.includes(radio)) return;\n this.#handledEvents.add(event);\n this.#selectRadio(radio, { focus: false });\n }\n\n /** Applies the APG key map to the action's radio. Per-radio action wiring is optional. */\n onKeydown(event: KeyboardEvent): void {\n const radio = event.currentTarget as HTMLElement | null;\n if (!radio || !this.radioTargets.includes(radio)) return;\n this.#handleKeydown(event, radio);\n }\n\n /** Blocks disabled pointer activation before per-radio and consumer handlers run. */\n readonly #onClickCapture = (event: MouseEvent): void => {\n const radio = this.#radioForEventTarget(event.target);\n if (!radio || !this.#isSupportedHost(radio) || !this.#isActivationDisabled(radio)) return;\n event.preventDefault();\n event.stopImmediatePropagation();\n };\n\n /** Blocks disabled activation and suppresses a button's non-APG Enter activation. */\n readonly #onKeydownCapture = (event: KeyboardEvent): void => {\n if (event.key !== \" \" && event.key !== \"Enter\") return;\n const radio = this.#radioForEventTarget(event.target);\n if (!radio || !this.#isSupportedHost(radio)) return;\n if (\n this.#isActivationDisabled(radio) ||\n (event.key === \"Enter\" && radio instanceof HTMLButtonElement)\n ) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n };\n\n /** Delegated click path for static and runtime-added radios without actions. */\n readonly #onClick = (event: MouseEvent): void => {\n if (this.#handledEvents.delete(event) || event.defaultPrevented) return;\n const radio = this.#radioForEventTarget(event.target);\n if (radio) this.#selectRadio(radio, { focus: false });\n };\n\n /** Delegated keydown path for static and runtime-added radios without actions. */\n readonly #onKeydown = (event: KeyboardEvent): void => {\n const radio = this.#radioForEventTarget(event.target);\n if (radio) this.#handleKeydown(event, radio);\n };\n\n /** Keeps programmatic and pointer focus as the group's current roving position. */\n readonly #onFocusin = (event: FocusEvent): void => {\n const radio = this.#radioForEventTarget(event.target);\n if (!radio || !this.#isNavigable(radio)) return;\n this.#focusedRadio = radio;\n this.#setActive(radio);\n };\n\n /** Distinguishes ordinary focus departure from focus lost because its radio was removed. */\n readonly #onFocusout = (event: FocusEvent): void => {\n const radio = this.#radioForEventTarget(event.target);\n if (!radio) return;\n queueMicrotask(() => {\n if (!this.#connected || this.#focusedRadio !== radio || !radio.isConnected) return;\n const active = document.activeElement;\n if (!(active instanceof Node) || !radio.contains(active)) this.#focusedRadio = null;\n });\n };\n\n /** Applies navigation and Space activation to one supported radio. */\n #handleKeydown(event: KeyboardEvent, radio: HTMLElement): void {\n if (event.defaultPrevented || !this.#isSupportedHost(radio)) return;\n if (event.isComposing || isReservedArrowChord(event)) return;\n if ((event.key === \"Home\" || event.key === \"End\") && hasModifier(event)) return;\n\n if (event.key === \" \") {\n if (this.#isActivationDisabled(radio)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n if (radio instanceof HTMLButtonElement) {\n if (event.repeat) event.preventDefault();\n return;\n }\n event.preventDefault();\n if (!event.repeat) this.#selectRadio(radio, { focus: true });\n return;\n }\n\n const items = this.#managedTargets;\n const current = items.indexOf(radio);\n const step = logicalArrowStep(event.key, this.element);\n let destination: HTMLElement | undefined;\n if (step !== 0) {\n destination = this.#nextNavigable(current, step);\n } else if (event.key === \"Home\") {\n destination = this.#navigableRadios[0];\n } else if (event.key === \"End\") {\n const navigable = this.#navigableRadios;\n destination = navigable[navigable.length - 1];\n } else {\n return;\n }\n\n event.preventDefault();\n if (!destination) return;\n if (this.#isActivationDisabled(destination)) this.#setActive(destination, true);\n else this.#selectRadio(destination, { focus: true });\n }\n\n /** Applies one user selection and emits only when selected identity changes. */\n #selectRadio(radio: HTMLElement, { focus }: { focus: boolean }): void {\n if (!this.#isSupportedHost(radio) || this.#isActivationDisabled(radio)) return;\n const previous = this.#selectedRadio;\n const changed = previous !== radio;\n if (changed) {\n for (const item of this.#managedTargets) this.#setChecked(item, item === radio);\n }\n this.#setActive(radio, focus);\n this.#reflectField(radio, { silent: !changed });\n this.#committedRadio = radio;\n if (changed) {\n this.dispatch(\"change\", { detail: { value: this.#radioValue(radio), radio } });\n }\n }\n\n /** Reconciles target ownership, selection, roving, focus continuity, and form state. */\n #reconcileDom(): void {\n const observer = this.#observer;\n observer?.disconnect();\n\n for (const radio of this.radioTargets) this.#reconcileHost(radio, true);\n this.#normalizeSelection();\n\n const pendingFocusIndex = this.#pendingFocusIndex;\n this.#pendingFocusIndex = null;\n if (pendingFocusIndex !== null) {\n const destination = this.#nearestNavigable(pendingFocusIndex);\n this.#setActive(destination, destination !== null);\n } else {\n this.#ensureTabStop(this.#preferChecked);\n }\n this.#reflectField(this.#selectedRadio, { silent: true });\n this.#lastOrder = this.#managedTargets;\n this.#preferChecked = false;\n this.#internalCheckedValues.clear();\n this.#internalTabindexValues.clear();\n\n if (this.#connected && observer) this.#observeWith(observer);\n this.#reportReconciledSelection();\n }\n\n /**\n * Announces a selection this pass decided rather than the user. Dispatched after\n * observation resumes so a consumer's own DOM edits are seen by the next pass.\n */\n #reportReconciledSelection(): void {\n const settled = this.#selectedRadio ?? null;\n if (settled === this.#committedRadio) return;\n this.#committedRadio = settled;\n this.dispatch(\"reconcile\", {\n detail: { value: settled ? this.#radioValue(settled) : \"\", radio: settled },\n });\n }\n\n /** Begins or ends ownership according to a radio's current host semantics. */\n #reconcileHost(radio: HTMLElement, dropFromTabSequence: boolean): void {\n if (!this.#isSupportedHost(radio)) {\n this.#releaseRadio(radio);\n return;\n }\n if (!this.#managedRadios.has(radio)) {\n this.#managedRadios.add(radio);\n this.#originalTabindex.set(radio, radio.getAttribute(\"tabindex\"));\n if (dropFromTabSequence) this.#writeTabindex(radio, -1);\n }\n this.#normalizeChecked(radio);\n }\n\n /** Restores only defaults owned while an element belonged to this group. */\n #releaseRadio(radio: HTMLElement): void {\n this.#managedRadios.delete(radio);\n const original = this.#originalTabindex.get(radio);\n if (original === null) {\n this.#markInternal(this.#internalTabindexValues, radio, null);\n radio.removeAttribute(\"tabindex\");\n } else if (original !== undefined) {\n this.#markInternal(this.#internalTabindexValues, radio, original);\n radio.setAttribute(\"tabindex\", original);\n }\n this.#originalTabindex.delete(radio);\n if (this.#ownedChecked.delete(radio)) {\n this.#markInternal(this.#internalCheckedValues, radio, null);\n radio.removeAttribute(\"aria-checked\");\n }\n }\n\n /** Supplies a missing checked state and normalizes invalid ARIA tokens. */\n #normalizeChecked(radio: HTMLElement): void {\n const value = radio.getAttribute(\"aria-checked\");\n if (value === null) {\n this.#ownedChecked.add(radio);\n this.#setChecked(radio, false);\n } else if (value !== \"true\" && value !== \"false\") {\n this.#setChecked(radio, false);\n }\n }\n\n /** Makes the first DOM-ordered checked radio the sole checked radio. */\n #normalizeSelection(): void {\n let found = false;\n for (const radio of this.#managedTargets) {\n this.#normalizeChecked(radio);\n if (!this.#isChecked(radio)) continue;\n if (!found) found = true;\n else this.#setChecked(radio, false);\n }\n }\n\n /** Keeps one navigable Tab stop, preferring checked state when selection changed externally. */\n #ensureTabStop(preferChecked: boolean): void {\n const navigable = this.#navigableRadios;\n let active: HTMLElement | undefined;\n if (!preferChecked) {\n const current = this.#managedTargets.filter(\n (radio) => radio.tabIndex === 0 && this.#isNavigable(radio),\n );\n if (current.length === 1) active = current[0];\n }\n const selected = this.#selectedRadio;\n if (!active && selected && this.#isNavigable(selected)) active = selected;\n active ??= navigable[0];\n this.#setActive(active ?? null);\n }\n\n /**\n * The surviving navigable radio closest to a position in the order captured\n * before the removal: the first one at or after it, else the last one before it.\n * The saved position and this search read the same population, so a `hidden` or\n * natively disabled sibling never shifts the destination past its neighbor.\n */\n #nearestNavigable(index: number): HTMLElement | null {\n const navigable = new Set(this.#navigableRadios);\n for (let i = index; i < this.#lastOrder.length; i++) {\n const radio = this.#lastOrder[i];\n if (radio && navigable.has(radio)) return radio;\n }\n for (let i = index - 1; i >= 0; i--) {\n const radio = this.#lastOrder[i];\n if (radio && navigable.has(radio)) return radio;\n }\n // Only radios added in the same batch survive; fall back to document order.\n return this.#navigableRadios[0] ?? null;\n }\n\n /** Moves through full DOM order until a navigable radio is found. */\n #nextNavigable(fromIndex: number, delta: 1 | -1): HTMLElement | undefined {\n const items = this.#managedTargets;\n let index = fromIndex;\n for (let step = 0; step < items.length; step++) {\n index = rovingMove(index, items.length, delta, \"wrap\");\n const candidate = items[index];\n if (candidate && this.#isNavigable(candidate)) return candidate;\n }\n return undefined;\n }\n\n /** Assigns the single roving Tab stop and optionally moves DOM focus. */\n #setActive(radio: HTMLElement | null, focus = false): void {\n const items = this.#managedTargets;\n const index = items.indexOf(radio as HTMLElement);\n this.#roving.setActive(index, { focus });\n for (const item of items) {\n this.#markInternal(this.#internalTabindexValues, item, item.getAttribute(\"tabindex\"));\n }\n }\n\n /** Finds this group's radio containing an event target, excluding nested groups. */\n #radioForEventTarget(target: EventTarget | null): HTMLElement | undefined {\n if (!this.#ownsEventTarget(target)) return undefined;\n const node = target as Element;\n return this.radioTargets.find((radio) => radio === node || radio.contains(node));\n }\n\n /** Whether the closest Radio Group scope around a target is this instance. */\n #ownsEventTarget(target: EventTarget | null): boolean {\n return (\n target instanceof Element &&\n target.closest('[data-controller~=\"stimeo--radio-group\"]') === this.element\n );\n }\n\n /** Hosts whose activation model can be owned without conflicting native behavior. */\n #isSupportedHost(radio: HTMLElement): boolean {\n if (radio instanceof HTMLButtonElement) return radio.type === \"button\";\n return !isInteractiveHost(radio);\n }\n\n /** Radios eligible for roving focus; ARIA-disabled deliberately remains eligible. */\n #isNavigable(radio: HTMLElement): boolean {\n if (!this.#isSupportedHost(radio) || this.#isHidden(radio)) return false;\n if (!(radio instanceof HTMLButtonElement)) return true;\n return !radio.disabled && !inheritsFieldsetDisabled(radio);\n }\n\n /** Whether hidden applies on the path from a radio up to the group root. */\n #isHidden(radio: HTMLElement): boolean {\n let current: HTMLElement | null = radio;\n while (current && current !== this.element) {\n if (current.hasAttribute(\"hidden\")) return true;\n current = current.parentElement;\n }\n return false;\n }\n\n /** Whether ARIA, visibility, or native HTML semantics suppress selection. */\n #isActivationDisabled(radio: HTMLElement): boolean {\n if (!this.#isNavigable(radio)) return true;\n let current: HTMLElement | null = radio;\n while (current) {\n if (current.getAttribute(\"aria-disabled\") === \"true\") return true;\n current = current.parentElement;\n }\n return false;\n }\n\n /** Distinguishes external retained-element changes from this controller's own writes. */\n #handleMutationRecords(records: MutationRecord[]): void {\n let external = false;\n for (const record of records) {\n const target = record.target as HTMLElement;\n const attribute = record.attributeName;\n if (attribute === \"aria-checked\") {\n const value = target.getAttribute(attribute);\n if (this.#matchesInternal(this.#internalCheckedValues, target, value)) continue;\n this.#ownedChecked.delete(target);\n this.#preferChecked = true;\n external = true;\n } else if (attribute === \"tabindex\") {\n const value = target.getAttribute(attribute);\n if (this.#matchesInternal(this.#internalTabindexValues, target, value)) continue;\n if (this.#managedRadios.has(target)) this.#originalTabindex.set(target, value);\n external = true;\n } else {\n external = true;\n }\n }\n this.#internalCheckedValues.clear();\n this.#internalTabindexValues.clear();\n if (external) this.#reconcile.schedule();\n }\n\n /** Records an attribute write this pass made, keeping one claim per record it will produce. */\n #markInternal(\n values: Map<HTMLElement, InternalWrite>,\n target: HTMLElement,\n value: string | null,\n ): void {\n const pending = values.get(target);\n if (pending) {\n pending.value = value;\n pending.count += 1;\n } else {\n values.set(target, { value, count: 1 });\n }\n }\n\n /** Consumes one claim on a record whose value this pass wrote. */\n #matchesInternal(\n values: Map<HTMLElement, InternalWrite>,\n target: HTMLElement,\n value: string | null,\n ): boolean {\n const pending = values.get(target);\n if (!pending || pending.value !== value) return false;\n pending.count -= 1;\n if (pending.count === 0) values.delete(target);\n return true;\n }\n\n /** Watches target membership, retained state/hosts, form state, and fieldset ancestry. */\n #observeMutations(): void {\n const observer = new MutationObserver((records) => this.#handleMutationRecords(records));\n this.#observer = observer;\n this.#observeWith(observer);\n }\n\n /** Registers root and ancestor observation on one observer instance. */\n #observeWith(observer: MutationObserver): void {\n observer.observe(this.element, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: OBSERVED_ATTRIBUTES,\n });\n let ancestor = this.element.parentElement;\n while (ancestor) {\n observer.observe(ancestor, {\n attributes: true,\n attributeFilter: [\"contenteditable\", \"disabled\"],\n });\n ancestor = ancestor.parentElement;\n }\n }\n\n /** Supported targets currently managed by the roving primitive. */\n get #managedTargets(): HTMLElement[] {\n return this.radioTargets.filter((radio) => this.#managedRadios.has(radio));\n }\n\n /** Managed radios eligible for the roving Tab stop. */\n get #navigableRadios(): HTMLElement[] {\n return this.#managedTargets.filter((radio) => this.#isNavigable(radio));\n }\n\n /** The currently checked managed radio, if any. */\n get #selectedRadio(): HTMLElement | undefined {\n return this.#managedTargets.find((radio) => this.#isChecked(radio));\n }\n\n /** Whether a radio is currently checked. */\n #isChecked(radio: HTMLElement): boolean {\n return radio.getAttribute(\"aria-checked\") === \"true\";\n }\n\n /** Reflects checked state while distinguishing controller writes from authored morphs. */\n #setChecked(radio: HTMLElement, checked: boolean): void {\n const value = checked ? \"true\" : \"false\";\n if (radio.getAttribute(\"aria-checked\") === value) return;\n this.#markInternal(this.#internalCheckedValues, radio, value);\n radio.setAttribute(\"aria-checked\", value);\n }\n\n /** Writes a roving value before the radio is visible to the shared primitive. */\n #writeTabindex(radio: HTMLElement, value: number): void {\n const serialized = String(value);\n this.#markInternal(this.#internalTabindexValues, radio, serialized);\n radio.tabIndex = value;\n }\n\n /** Mirrors the selected value or the empty state to the optional hidden field. */\n #reflectField(\n radio: HTMLElement | undefined,\n { silent = false }: { silent?: boolean } = {},\n ): void {\n if (!this.hasFieldTarget) return;\n const value = radio ? this.#radioValue(radio) : \"\";\n if (this.fieldTarget.value === value) return;\n this.fieldTarget.value = value;\n if (!silent) this.fieldTarget.dispatchEvent(new Event(\"change\", { bubbles: true }));\n }\n\n /** A radio's submitted value (`data-value`, defaulting to empty). */\n #radioValue(radio: HTMLElement): string {\n return radio.getAttribute(\"data-value\") ?? \"\";\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/logical_scroll.ts","../../src/utils/arrow_step.ts","../../src/utils/focus_candidate.ts","../../src/utils/interactive_host.ts","../../src/utils/microtask_coalescer.ts","../../src/utils/roving_tabindex.ts","../../src/controllers/radio_group_controller.ts"],"names":[],"mappings":";;;;;AAiBO,SAAS,MAAM,OAAA,EAA2B;AAC/C,EAAA,OAAO,MAAA,CAAO,gBAAA,CAAiB,OAAO,CAAA,CAAE,SAAA,KAAc,KAAA;AACxD;;;ACiBO,SAAS,gBAAA,CAAiB,KAAa,OAAA,EAA8B;AAC1E,EAAA,IAAI,GAAA,KAAQ,aAAa,OAAO,CAAA;AAChC,EAAA,IAAI,GAAA,KAAQ,WAAW,OAAO,EAAA;AAC9B,EAAA,IAAI,GAAA,KAAQ,YAAA,IAAgB,GAAA,KAAQ,WAAA,EAAa,OAAO,CAAA;AACxD,EAAA,MAAM,OAAA,GAAU,KAAA,CAAM,OAAO,CAAA,GAAI,WAAA,GAAc,YAAA;AAC/C,EAAA,OAAO,GAAA,KAAQ,UAAU,CAAA,GAAI,EAAA;AAC/B;AAqDO,SAAS,oBAAA,CACd,KAAA,EACA,KAAA,GAAkC,EAAC,EAC1B;AACT,EAAA,IAAI,CAAC,KAAA,CAAM,GAAA,CAAI,UAAA,CAAW,OAAO,GAAG,OAAO,KAAA;AAC3C,EAAA,OACG,KAAA,CAAM,MAAA,IAAU,CAAC,KAAA,CAAM,QAAA,CAAS,KAAK,CAAA,IACrC,KAAA,CAAM,OAAA,IAAW,CAAC,KAAA,CAAM,QAAA,CAAS,MAAM,KACvC,KAAA,CAAM,OAAA,IAAW,CAAC,KAAA,CAAM,QAAA,CAAS,MAAM,CAAA,IACvC,KAAA,CAAM,QAAA,IA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AAA,CAAK,WAAA,CAAY,KAAA,KAAU,KAAA,EAAO;AACtC,IAAA,IAAA,CAAK,YAAY,KAAA,GAAQ,KAAA;AACzB,IAAA,IAAI,CAAC,MAAA,EAAQ,IAAA,CAAK,WAAA,CAAY,aAAA,CAAc,IAAI,KAAA,CAAM,QAAA,EAAU,EAAE,OAAA,EAAS,IAAA,EAAM,CAAC,CAAA;AAAA,EACpF;AAAA;AAAA,EAGA,YAAY,KAAA,EAA4B;AACtC,IAAA,OAAO,KAAA,CAAM,YAAA,CAAa,YAAY,CAAA,IAAK,EAAA;AAAA,EAC7C;AACF","file":"radio_group_controller.js","sourcesContent":["/** Normalized scroll position and maximum distance on one logical axis. */\nexport interface LogicalScrollMetrics {\n position: number;\n max: number;\n}\n\n/**\n * Whether horizontal scrolling on `element` follows right-to-left inline flow.\n *\n * Resolved from the **computed** `direction`, so the authoring contract is the\n * usual `dir=\"rtl\"` (or a stylesheet) on the element or any ancestor.\n *\n * Scope: horizontal writing modes. A vertical writing mode (`writing-mode:\n * vertical-rl`) also inverts the horizontal axis, which this check does not\n * model — vertical writing modes are out of scope for the scroll utilities\n * (their consumers describe axes as horizontal/vertical, not inline/block).\n */\nexport function isRtl(element: Element): boolean {\n return window.getComputedStyle(element).direction === \"rtl\";\n}\n\n/**\n * Returns scroll distance from the logical start edge.\n *\n * CSSOM View exposes standards-mode RTL horizontal offsets as `0` at the inline\n * start (right) and increasingly negative values toward the inline end (left).\n * The normalized position is always clamped to `[0, max]`, which also absorbs\n * Safari's elastic overscroll values.\n */\nexport function logicalScrollMetrics(\n element: HTMLElement,\n horizontal: boolean,\n): LogicalScrollMetrics {\n const max = Math.max(\n 0,\n horizontal\n ? element.scrollWidth - element.clientWidth\n : element.scrollHeight - element.clientHeight,\n );\n const raw = horizontal ? element.scrollLeft : element.scrollTop;\n const position = horizontal && isRtl(element) ? -raw : raw;\n return { position: Math.min(max, Math.max(0, position)), max };\n}\n\n/**\n * Converts a logical start/end delta to the physical value accepted by\n * `Element.scrollBy`.\n */\nexport function physicalScrollDelta(\n element: HTMLElement,\n horizontal: boolean,\n logicalDelta: number,\n): number {\n return horizontal && isRtl(element) ? -logicalDelta : logicalDelta;\n}\n","import { isRtl } from \"./logical_scroll\";\n\n/**\n * Turns an arrow key into a **logical** step: `+1` for \"next\", `-1` for\n * \"previous\", `0` when the key names neither.\n *\n * APG defines the horizontal pair as *next / previous* and says a vertical\n * arrangement swaps in Down/Up for the same meaning — so the pair is one axis's\n * spelling of an order, and the order reverses with the writing direction. Only\n * the horizontal pair reverses. Down/Up name an axis the writing direction does\n * not mirror, and returning them unchanged is the point: many controllers fold\n * both pairs into one branch, where swapping the branches under RTL would flip\n * the vertical axis too — a bug that reads as \"the arrows work\" until someone\n * presses Down.\n *\n * **Direction is read from the element the caller passes, which should be the\n * container that lays the items out** — not the focused child. A child may carry\n * its own `dir` (an LTR input inside an RTL form is ordinary authoring), and\n * probing per handler makes two handlers disagree at the boundary between them.\n *\n * This decides direction only. Whether the axis is even active (an\n * `orientation=\"horizontal\"` widget ignoring Down/Up), how far the step lands,\n * and what wrapping does all stay with the caller.\n *\n * **It encodes the list-order convention: `ArrowDown` is *next*.** Widgets that\n * pair the arrows by *value* instead — `ArrowUp` meaning \"more\", as a rating or a\n * slider does — must not use this, or their vertical axis inverts. Reverse the\n * horizontal pair on its own there.\n *\n * @example\n * ```ts\n * const step = logicalArrowStep(event.key, this.element);\n * if (step === 0) return;\n * this.#roving.setActive(rovingMove(current, length, step, \"wrap\"), { focus: true });\n * ```\n */\nexport function logicalArrowStep(key: string, element: Element): 1 | -1 | 0 {\n if (key === \"ArrowDown\") return 1;\n if (key === \"ArrowUp\") return -1;\n if (key !== \"ArrowRight\" && key !== \"ArrowLeft\") return 0;\n const forward = isRtl(element) ? \"ArrowLeft\" : \"ArrowRight\";\n return key === forward ? 1 : -1;\n}\n\n/**\n * Rewrites `key` so an existing LTR-shaped branch keeps working under RTL:\n * `ArrowRight` and `ArrowLeft` trade places, everything else passes through.\n *\n * The alternative — negating a delta — silently breaks handlers whose two\n * horizontal branches are **not mirror images**. A grid that clamps one edge but\n * not the other, or a segmented field guarding `index > 0` on one side and\n * `index < length - 1` on the other, ends up applying the wrong guard to the\n * wrong direction. Swapping the key leaves each branch, guards and all, exactly\n * where its author put it.\n *\n * Same rule as {@link logicalArrowStep} about which element to read: pass the\n * container that lays the items out, not the focused child.\n *\n * @example\n * ```ts\n * switch (logicalArrowKey(event.key, this.element)) {\n * case \"ArrowLeft\": // \"previous\" — whatever direction that is on screen\n * ```\n */\nexport function logicalArrowKey(key: string, element: Element): string {\n if (key !== \"ArrowRight\" && key !== \"ArrowLeft\") return key;\n if (!isRtl(element)) return key;\n return key === \"ArrowRight\" ? \"ArrowLeft\" : \"ArrowRight\";\n}\n\n/** Modifiers a widget may claim on an arrow key, named for the `allow` list. */\nexport type ArrowModifier = \"alt\" | \"ctrl\" | \"meta\" | \"shift\";\n\n/**\n * True when an arrow key arrived carrying a modifier the widget must leave to\n * the browser: return without calling `preventDefault()` and without moving any\n * state.\n *\n * A bare arrow belongs to the widget; a chorded one usually does not.\n * `Alt`/`Meta` plus a horizontal arrow is history back/forward on every desktop\n * browser, and a widget that swallows it makes the shortcut work or not\n * depending on where focus happens to sit — a coin-flip the user cannot see.\n *\n * `allow` is for the combinations APG assigns to a pattern **and the widget\n * actually implements** — today only Combobox's optional `Alt+Down`/`Alt+Up`.\n * Listing one the widget does not implement defeats the point: the chord then\n * runs the plain-arrow branch, which is exactly what this guard exists to stop.\n * Non-arrow keys return `false`, so chorded letters and\n * `Control+Home`/`Control+End` are untouched.\n *\n * @example\n * ```ts\n * if (isReservedArrowChord(event)) return;\n * ```\n */\nexport function isReservedArrowChord(\n event: KeyboardEvent,\n allow: readonly ArrowModifier[] = [],\n): boolean {\n if (!event.key.startsWith(\"Arrow\")) return false;\n return (\n (event.altKey && !allow.includes(\"alt\")) ||\n (event.ctrlKey && !allow.includes(\"ctrl\")) ||\n (event.metaKey && !allow.includes(\"meta\")) ||\n (event.shiftKey && !allow.includes(\"shift\"))\n );\n}\n","/**\n * Whether a disabled `<fieldset>` ancestor actually reaches `control`.\n *\n * HTML exempts the contents of a fieldset's **first direct-child `<legend>`**, and\n * the exemption is per fieldset — a control legal in one legend can still be\n * disabled by a second, outer fieldset, so the walk continues upward.\n *\n * Exported for the consumer that needs this rule *without* the rest of\n * {@link canTakeFocus}: `toolbar` bounds its own `hidden` walk at the toolbar\n * root, which is a different rule, so it composes the two itself.\n */\nexport function inheritsFieldsetDisabled(control: HTMLElement): boolean {\n let fieldset: Element | null = control.closest(\"fieldset[disabled]\");\n while (fieldset) {\n const legend = Array.from(fieldset.children).find((child) => child.tagName === \"LEGEND\");\n if (!legend?.contains(control)) return true;\n fieldset = fieldset.parentElement?.closest(\"fieldset[disabled]\") ?? null;\n }\n return false;\n}\n\n/**\n * Whether an element can actually take focus, checked **before** `focus()` runs.\n *\n * A controller that must move focus off a control it is about to disable or hide\n * picks a destination and calls `focus()` on it. If that destination cannot take\n * focus, the call **fails silently**: `hidden` and natively `disabled` elements\n * swallow it, so the caret stays in the subtree that is disappearing and lands on\n * `<body>` a frame later — the exact outcome the rescue exists to prevent, minus\n * any signal that it happened.\n *\n * Testing after the fact is the obvious alternative and is deliberately not the\n * rule. Reading `document.activeElement` back only works in a real browser, and\n * looping over candidates that way performs a real focus move per failure —\n * observable to assistive technology. Checking first costs nothing and catches\n * the cases that actually occur.\n *\n * **`aria-disabled` is not disqualifying.** It is the attribute an author uses\n * for a control that must stay *discoverable*, and the roving contract keeps\n * such items reachable. Only the three conditions that make the platform refuse\n * focus are checked: `hidden` / `inert` (an ancestor's counts),\n * `input[type=\"hidden\"]`, the native `disabled` property, and `disabled`\n * inherited from an ancestor `fieldset`. CSS-only invisibility is handled by\n * {@link isRenderedForFocus} when a consumer needs sequential-focus semantics.\n *\n * Reading `:disabled` instead of walking the fieldset chain would be shorter, but\n * that pseudo-class is not evaluated consistently outside real browsers and this\n * has to be right headlessly too. happy-dom in particular focuses a `<button>`\n * inside a disabled fieldset where a real engine refuses, so the inheritance is\n * spelled out rather than delegated.\n *\n * What a consumer does when nothing survives is its own call: some fall back to\n * their landmark, while a widget whose caret already sits somewhere legitimate\n * refuses the move outright rather than relocating it.\n *\n * @example\n * ```ts\n * const target = candidates.find(canTakeFocus);\n * if (target) target.focus();\n * else {\n * this.#tabindex.lend(this.element); // nothing left: fall back to the landmark\n * this.element.focus();\n * }\n * ```\n *\n * @param element - the candidate destination\n */\nexport function canTakeFocus(element: HTMLElement): boolean {\n if (element.closest(\"[hidden], [inert]\")) return false;\n if (element instanceof HTMLInputElement && element.type === \"hidden\") return false;\n if (!(\"disabled\" in element)) return true;\n if ((element as HTMLElement & { disabled: boolean }).disabled) return false;\n return !inheritsFieldsetDisabled(element);\n}\n\n/** Elements whose semantics or authored attributes can place them in sequential focus order. */\nexport const TAB_STOP_CANDIDATE_SELECTOR = [\n \"a[href]\",\n \"area[href]\",\n \"button\",\n \"input\",\n \"select\",\n \"textarea\",\n \"summary\",\n \"iframe\",\n \"audio[controls]\",\n \"video[controls]\",\n \"[tabindex]\",\n \"[contenteditable]\",\n].join(\",\");\n\n/** Optional browser visibility API used to exclude CSS-hidden candidates. */\ninterface VisibilityCheckable {\n checkVisibility?: (options?: { visibilityProperty?: boolean }) => boolean;\n}\n\n/** Whether CSS visibility allows an otherwise eligible element to participate in focus order. */\nexport function isRenderedForFocus(element: HTMLElement): boolean {\n const check = (element as HTMLElement & VisibilityCheckable).checkVisibility;\n return typeof check === \"function\" ? check.call(element, { visibilityProperty: true }) : true;\n}\n\n/** Parses an authored `tabindex`; invalid syntax has no explicit focus-order meaning. */\nfunction authoredTabindex(element: HTMLElement): number | null {\n const value = element.getAttribute(\"tabindex\");\n if (value === null || !/^[+-]?\\d+$/.test(value.trim())) return null;\n return Number(value);\n}\n\n/** Whether the element's native semantics place it in sequential focus order. */\nfunction hasNativeTabStop(element: HTMLElement): boolean {\n if (element instanceof HTMLAnchorElement || element instanceof HTMLAreaElement) {\n return element.hasAttribute(\"href\");\n }\n if (\n element instanceof HTMLButtonElement ||\n element instanceof HTMLSelectElement ||\n element instanceof HTMLTextAreaElement\n ) {\n return true;\n }\n if (element instanceof HTMLInputElement) return element.type !== \"hidden\";\n if (element instanceof HTMLIFrameElement) return true;\n if (element.tagName === \"AUDIO\" || element.tagName === \"VIDEO\") {\n return element.hasAttribute(\"controls\");\n }\n if (element instanceof HTMLElement && element.tagName === \"SUMMARY\") {\n const details = element.parentElement;\n return (\n details instanceof HTMLDetailsElement &&\n Array.from(details.children).find((child) => child.tagName === \"SUMMARY\") === element\n );\n }\n return false;\n}\n\n/** Whether an explicit `contenteditable` value creates an editable tab stop. */\nfunction hasEditableTabStop(element: HTMLElement): boolean {\n const value = element.getAttribute(\"contenteditable\")?.toLowerCase();\n return value === \"\" || value === \"true\" || value === \"plaintext-only\";\n}\n\n/**\n * Whether an element is a usable sequential Tab stop right now.\n *\n * Native semantics, authored `tabindex`, editable hosts, inherited disabled state,\n * HTML `hidden`/`inert`, and CSS visibility are evaluated together. `aria-disabled`\n * remains focusable because it communicates unavailability without removing the\n * control from discovery order.\n */\nexport function isTabStop(element: HTMLElement): boolean {\n if (!canTakeFocus(element) || !isRenderedForFocus(element)) return false;\n\n const tabindex = authoredTabindex(element);\n if (tabindex !== null) return tabindex >= 0;\n return hasNativeTabStop(element) || hasEditableTabStop(element);\n}\n\n/** Returns every usable sequential Tab stop below `root` in document order. */\nexport function tabStopsWithin(root: ParentNode): HTMLElement[] {\n return Array.from(root.querySelectorAll<HTMLElement>(TAB_STOP_CANDIDATE_SELECTOR)).filter(\n isTabStop,\n );\n}\n\n/** Returns the first usable sequential Tab stop below `root`, if one exists. */\nexport function firstTabStop(root: ParentNode): HTMLElement | null {\n for (const candidate of root.querySelectorAll<HTMLElement>(TAB_STOP_CANDIDATE_SELECTOR)) {\n if (isTabStop(candidate)) return candidate;\n }\n return null;\n}\n\n/** Whether `root` contains at least one usable sequential Tab stop. */\nexport function hasTabStop(root: ParentNode): boolean {\n return firstTabStop(root) !== null;\n}\n","/**\n * Native interactive elements whose built-in activation must not be replaced\n * wholesale by a controller. Deliberately excludes `[tabindex]`: a generic\n * element made focusable is the supported host for several headless patterns.\n * Contenteditable is handled by {@link isInteractiveHost} because its state is\n * inherited and its keywords are ASCII-case-insensitive.\n */\nexport const INTERACTIVE_HOST_SELECTOR =\n \"button, input, select, textarea, label, a[href], area[href], summary, details, audio[controls], video[controls], iframe, object, embed\";\n\n/**\n * Whether an element owns native activation or an inherited editing surface.\n *\n * The `contenteditable` missing and invalid states inherit. Walking explicitly\n * also keeps `contenteditable=\"false\"` as a real boundary inside an editable\n * ancestor instead of treating any ancestor attribute as decisive.\n */\nexport function isInteractiveHost(element: HTMLElement): boolean {\n if (element.matches(INTERACTIVE_HOST_SELECTOR)) return true;\n\n let current: HTMLElement | null = element;\n while (current) {\n const raw = current.getAttribute(\"contenteditable\");\n if (raw !== null) {\n const value = raw.trim().toLowerCase();\n if (value === \"false\") return false;\n if (value === \"\" || value === \"true\" || value === \"plaintext-only\") return true;\n }\n current = current.parentElement;\n }\n return false;\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","/**\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 { Controller } from \"@hotwired/stimulus\";\nimport { isReservedArrowChord, logicalArrowStep } from \"../utils/arrow_step\";\nimport { inheritsFieldsetDisabled } from \"../utils/focus_candidate\";\nimport { isInteractiveHost } from \"../utils/interactive_host\";\nimport { MicrotaskCoalescer } from \"../utils/microtask_coalescer\";\nimport { RovingTabindex, rovingMove } from \"../utils/roving_tabindex\";\n\n/**\n * An attribute value this controller wrote, with how many observer records it\n * still owns. A pass that writes the same attribute more than once produces one\n * record per write, all reading back the final value, so the count is what keeps\n * the later records from looking like an author's edit.\n */\ninterface InternalWrite {\n value: string | null;\n count: number;\n}\n\n/** Radio and field attributes whose retained-element changes alter group state. */\nconst OBSERVED_ATTRIBUTES = [\n \"aria-checked\",\n \"aria-disabled\",\n \"contenteditable\",\n \"controls\",\n \"data-value\",\n \"disabled\",\n \"hidden\",\n \"href\",\n \"tabindex\",\n \"type\",\n \"value\",\n];\n\n/** Modifier keys that leave document-level Home/End shortcuts outside the widget. */\nconst hasModifier = (event: KeyboardEvent): boolean =>\n event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;\n\n/**\n * Headless, accessible radio-group behavior for **custom** radios.\n *\n * Markup contract (identifier: `stimeo--radio-group`):\n * <div data-controller=\"stimeo--radio-group\" role=\"radiogroup\" aria-label=\"Plan\">\n * <div role=\"radio\" aria-checked=\"true\" tabindex=\"0\" data-value=\"basic\"\n * data-stimeo--radio-group-target=\"radio\">Basic</div>\n * <!-- more radios; exactly one navigable radio has tabindex=0 -->\n * <input type=\"hidden\" data-stimeo--radio-group-target=\"field\" />\n * </div>\n *\n * Implements the WAI-ARIA APG **Radio Group** pattern. Use this only for custom\n * radios; native `<input type=\"radio\">` already owns its activation and form\n * semantics and should be preferred when its appearance is sufficient.\n *\n * `change` dispatches `{ value: string, radio: HTMLElement }`; `reconcile` dispatches\n * `{ value: string, radio: HTMLElement | null }`.\n *\n * @remarks\n * Behavior only — selection is exposed through `aria-checked`, the single Tab\n * stop through roving `tabindex` ({@link RovingTabindex}); the consumer styles\n * those attributes. Selection follows focus for enabled radios.\n *\n * A supported radio is either `<button type=\"button\">` or a non-interactive\n * host such as `<div role=\"radio\">`. Other native interactive elements retain\n * their activation model and this controller stands down on them.\n *\n * Click and keydown handling are delegated from the group, so radios added at\n * runtime need only the `radio` target. Per-radio `data-action` bindings to\n * {@link select} and {@link onKeydown} remain supported and are idempotent when\n * combined with delegation.\n *\n * Behavior provided:\n * - Click selects a radio.\n * - `ArrowDown`/`ArrowRight` select the next, `ArrowUp`/`ArrowLeft` the previous\n * (wrapping); `Home`/`End` the first/last; `Space` selects the focused radio.\n * - Native-disabled and hidden radios are skipped. ARIA-disabled radios remain\n * discoverable in the roving order but cannot be selected.\n * - The selected radio's `data-value` is mirrored to the optional hidden field.\n * `stimeo--radio-group:change` is dispatched only when selection identity\n * changes through user interaction.\n * - `stimeo--radio-group:reconcile` reports a selection this controller decided\n * on its own — a removed selection, or first-wins over duplicate checked state\n * — carrying the same detail as `change`. The hidden field's native `change`\n * stays reserved for user edits, so form automation never sees a repair as one.\n */\nexport class RadioGroupController extends Controller<HTMLElement> {\n static override targets = [\"radio\", \"field\"];\n static actions = [\"onKeydown\", \"select\"] as const;\n static events = [\"change\", \"reconcile\"] as const;\n\n declare readonly radioTargets: HTMLElement[];\n declare readonly fieldTarget: HTMLInputElement;\n declare readonly hasFieldTarget: boolean;\n\n readonly #roving = new RovingTabindex(() => this.#managedTargets);\n readonly #reconcile = new MicrotaskCoalescer(() => this.#reconcileDom());\n readonly #handledEvents = new WeakSet<Event>();\n readonly #managedRadios = new Set<HTMLElement>();\n readonly #originalTabindex = new Map<HTMLElement, string | null>();\n readonly #ownedChecked = new Set<HTMLElement>();\n readonly #internalCheckedValues = new Map<HTMLElement, InternalWrite>();\n readonly #internalTabindexValues = new Map<HTMLElement, InternalWrite>();\n #observer: MutationObserver | null = null;\n #committedRadio: HTMLElement | null = null;\n #connected = false;\n #lastOrder: HTMLElement[] = [];\n #focusedRadio: HTMLElement | null = null;\n #pendingFocusIndex: number | null = null;\n #preferChecked = false;\n\n /**\n * Normalizes authored selection, establishes the APG Tab entry point, and\n * reflects derived form state without reporting a user edit.\n */\n override connect(): void {\n const currentRadios = new Set(this.radioTargets);\n for (const radio of this.#managedRadios) {\n if (!currentRadios.has(radio)) this.#releaseRadio(radio);\n }\n for (const radio of this.radioTargets) this.#reconcileHost(radio, false);\n this.#normalizeSelection();\n this.#ensureTabStop(true);\n this.#reflectField(this.#selectedRadio, { silent: true });\n this.#committedRadio = this.#selectedRadio ?? null;\n this.#lastOrder = this.#managedTargets;\n\n this.element.addEventListener(\"click\", this.#onClickCapture, true);\n this.element.addEventListener(\"keydown\", this.#onKeydownCapture, true);\n this.element.addEventListener(\"click\", this.#onClick);\n this.element.addEventListener(\"keydown\", this.#onKeydown);\n this.element.addEventListener(\"focusin\", this.#onFocusin);\n this.element.addEventListener(\"focusout\", this.#onFocusout);\n this.#connected = true;\n this.#preferChecked = false;\n this.#internalCheckedValues.clear();\n this.#internalTabindexValues.clear();\n this.#reconcile.activate();\n this.#observeMutations();\n }\n\n /** Releases every listener, observer, and queued pass while retaining live DOM state. */\n override disconnect(): void {\n this.#connected = false;\n this.#reconcile.cancel();\n this.element.removeEventListener(\"click\", this.#onClickCapture, true);\n this.element.removeEventListener(\"keydown\", this.#onKeydownCapture, true);\n this.element.removeEventListener(\"click\", this.#onClick);\n this.element.removeEventListener(\"keydown\", this.#onKeydown);\n this.element.removeEventListener(\"focusin\", this.#onFocusin);\n this.element.removeEventListener(\"focusout\", this.#onFocusout);\n this.#observer?.disconnect();\n this.#observer = null;\n this.#internalCheckedValues.clear();\n this.#internalTabindexValues.clear();\n this.#focusedRadio = null;\n this.#pendingFocusIndex = null;\n this.#committedRadio = null;\n this.#preferChecked = false;\n }\n\n /** Removes a newly connected radio from the Tab sequence before batch reconciliation. */\n radioTargetConnected(radio: HTMLElement): void {\n if (this.#connected === false) return;\n this.#reconcileHost(radio, true);\n this.#preferChecked = true;\n this.#reconcile.schedule();\n }\n\n /** Releases target-only attributes and repairs selection, form state, focus, and roving. */\n radioTargetDisconnected(radio: HTMLElement): void {\n if (!this.#connected) return;\n if (this.#focusedRadio === radio) {\n // A radio that arrived and left inside one batch is absent from the saved\n // order; `-1` then makes the search start from the top, which is where a\n // group with no position to return to belongs.\n this.#pendingFocusIndex = this.#lastOrder.indexOf(radio);\n this.#focusedRadio = null;\n }\n this.#releaseRadio(radio);\n this.#preferChecked = true;\n this.#reconcile.schedule();\n }\n\n /** Reflects the current selection into a field added or replaced at runtime. */\n fieldTargetConnected(): void {\n this.#reconcile.schedule();\n }\n\n /** Reconciles after a field target is removed from a retained group. */\n fieldTargetDisconnected(): void {\n this.#reconcile.schedule();\n }\n\n /** Selects the action's radio. Per-radio action wiring is optional. */\n select(event: Event): void {\n if (event.defaultPrevented || !this.#ownsEventTarget(event.target)) return;\n const radio = event.currentTarget as HTMLElement | null;\n if (!radio || !this.radioTargets.includes(radio)) return;\n this.#handledEvents.add(event);\n this.#selectRadio(radio, { focus: false });\n }\n\n /** Applies the APG key map to the action's radio. Per-radio action wiring is optional. */\n onKeydown(event: KeyboardEvent): void {\n const radio = event.currentTarget as HTMLElement | null;\n if (!radio || !this.radioTargets.includes(radio)) return;\n this.#handleKeydown(event, radio);\n }\n\n /** Blocks disabled pointer activation before per-radio and consumer handlers run. */\n readonly #onClickCapture = (event: MouseEvent): void => {\n const radio = this.#radioForEventTarget(event.target);\n if (!radio || !this.#isSupportedHost(radio) || !this.#isActivationDisabled(radio)) return;\n event.preventDefault();\n event.stopImmediatePropagation();\n };\n\n /** Blocks disabled activation and suppresses a button's non-APG Enter activation. */\n readonly #onKeydownCapture = (event: KeyboardEvent): void => {\n if (event.key !== \" \" && event.key !== \"Enter\") return;\n const radio = this.#radioForEventTarget(event.target);\n if (!radio || !this.#isSupportedHost(radio)) return;\n if (\n this.#isActivationDisabled(radio) ||\n (event.key === \"Enter\" && radio instanceof HTMLButtonElement)\n ) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n };\n\n /** Delegated click path for static and runtime-added radios without actions. */\n readonly #onClick = (event: MouseEvent): void => {\n if (this.#handledEvents.delete(event) || event.defaultPrevented) return;\n const radio = this.#radioForEventTarget(event.target);\n if (radio) this.#selectRadio(radio, { focus: false });\n };\n\n /** Delegated keydown path for static and runtime-added radios without actions. */\n readonly #onKeydown = (event: KeyboardEvent): void => {\n const radio = this.#radioForEventTarget(event.target);\n if (radio) this.#handleKeydown(event, radio);\n };\n\n /** Keeps programmatic and pointer focus as the group's current roving position. */\n readonly #onFocusin = (event: FocusEvent): void => {\n const radio = this.#radioForEventTarget(event.target);\n if (!radio || !this.#isNavigable(radio)) return;\n this.#focusedRadio = radio;\n this.#setActive(radio);\n };\n\n /** Distinguishes ordinary focus departure from focus lost because its radio was removed. */\n readonly #onFocusout = (event: FocusEvent): void => {\n const radio = this.#radioForEventTarget(event.target);\n if (!radio) return;\n queueMicrotask(() => {\n if (!this.#connected || this.#focusedRadio !== radio || !radio.isConnected) return;\n const active = document.activeElement;\n if (!(active instanceof Node) || !radio.contains(active)) this.#focusedRadio = null;\n });\n };\n\n /** Applies navigation and Space activation to one supported radio. */\n #handleKeydown(event: KeyboardEvent, radio: HTMLElement): void {\n if (event.defaultPrevented || !this.#isSupportedHost(radio)) return;\n if (event.isComposing || isReservedArrowChord(event)) return;\n if ((event.key === \"Home\" || event.key === \"End\") && hasModifier(event)) return;\n\n if (event.key === \" \") {\n if (this.#isActivationDisabled(radio)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n if (radio instanceof HTMLButtonElement) {\n if (event.repeat) event.preventDefault();\n return;\n }\n event.preventDefault();\n if (!event.repeat) this.#selectRadio(radio, { focus: true });\n return;\n }\n\n const items = this.#managedTargets;\n const current = items.indexOf(radio);\n const step = logicalArrowStep(event.key, this.element);\n let destination: HTMLElement | undefined;\n if (step !== 0) {\n destination = this.#nextNavigable(current, step);\n } else if (event.key === \"Home\") {\n destination = this.#navigableRadios[0];\n } else if (event.key === \"End\") {\n const navigable = this.#navigableRadios;\n destination = navigable[navigable.length - 1];\n } else {\n return;\n }\n\n event.preventDefault();\n if (!destination) return;\n if (this.#isActivationDisabled(destination)) this.#setActive(destination, true);\n else this.#selectRadio(destination, { focus: true });\n }\n\n /** Applies one user selection and emits only when selected identity changes. */\n #selectRadio(radio: HTMLElement, { focus }: { focus: boolean }): void {\n if (!this.#isSupportedHost(radio) || this.#isActivationDisabled(radio)) return;\n const previous = this.#selectedRadio;\n const changed = previous !== radio;\n if (changed) {\n for (const item of this.#managedTargets) this.#setChecked(item, item === radio);\n }\n this.#setActive(radio, focus);\n this.#reflectField(radio, { silent: !changed });\n this.#committedRadio = radio;\n if (changed) {\n this.dispatch(\"change\", { detail: { value: this.#radioValue(radio), radio } });\n }\n }\n\n /** Reconciles target ownership, selection, roving, focus continuity, and form state. */\n #reconcileDom(): void {\n const observer = this.#observer;\n observer?.disconnect();\n\n for (const radio of this.radioTargets) this.#reconcileHost(radio, true);\n this.#normalizeSelection();\n\n const pendingFocusIndex = this.#pendingFocusIndex;\n this.#pendingFocusIndex = null;\n if (pendingFocusIndex !== null) {\n const destination = this.#nearestNavigable(pendingFocusIndex);\n this.#setActive(destination, destination !== null);\n } else {\n this.#ensureTabStop(this.#preferChecked);\n }\n this.#reflectField(this.#selectedRadio, { silent: true });\n this.#lastOrder = this.#managedTargets;\n this.#preferChecked = false;\n this.#internalCheckedValues.clear();\n this.#internalTabindexValues.clear();\n\n if (this.#connected && observer) this.#observeWith(observer);\n this.#reportReconciledSelection();\n }\n\n /**\n * Announces a selection this pass decided rather than the user. Dispatched after\n * observation resumes so a consumer's own DOM edits are seen by the next pass.\n */\n #reportReconciledSelection(): void {\n const settled = this.#selectedRadio ?? null;\n if (settled === this.#committedRadio) return;\n this.#committedRadio = settled;\n this.dispatch(\"reconcile\", {\n detail: { value: settled ? this.#radioValue(settled) : \"\", radio: settled },\n });\n }\n\n /** Begins or ends ownership according to a radio's current host semantics. */\n #reconcileHost(radio: HTMLElement, dropFromTabSequence: boolean): void {\n if (!this.#isSupportedHost(radio)) {\n this.#releaseRadio(radio);\n return;\n }\n if (!this.#managedRadios.has(radio)) {\n this.#managedRadios.add(radio);\n this.#originalTabindex.set(radio, radio.getAttribute(\"tabindex\"));\n if (dropFromTabSequence) this.#writeTabindex(radio, -1);\n }\n this.#normalizeChecked(radio);\n }\n\n /** Restores only defaults owned while an element belonged to this group. */\n #releaseRadio(radio: HTMLElement): void {\n this.#managedRadios.delete(radio);\n const original = this.#originalTabindex.get(radio);\n if (original === null) {\n this.#markInternal(this.#internalTabindexValues, radio, null);\n radio.removeAttribute(\"tabindex\");\n } else if (original !== undefined) {\n this.#markInternal(this.#internalTabindexValues, radio, original);\n radio.setAttribute(\"tabindex\", original);\n }\n this.#originalTabindex.delete(radio);\n if (this.#ownedChecked.delete(radio)) {\n this.#markInternal(this.#internalCheckedValues, radio, null);\n radio.removeAttribute(\"aria-checked\");\n }\n }\n\n /** Supplies a missing checked state and normalizes invalid ARIA tokens. */\n #normalizeChecked(radio: HTMLElement): void {\n const value = radio.getAttribute(\"aria-checked\");\n if (value === null) {\n this.#ownedChecked.add(radio);\n this.#setChecked(radio, false);\n } else if (value !== \"true\" && value !== \"false\") {\n this.#setChecked(radio, false);\n }\n }\n\n /** Makes the first DOM-ordered checked radio the sole checked radio. */\n #normalizeSelection(): void {\n let found = false;\n for (const radio of this.#managedTargets) {\n this.#normalizeChecked(radio);\n if (!this.#isChecked(radio)) continue;\n if (!found) found = true;\n else this.#setChecked(radio, false);\n }\n }\n\n /** Keeps one navigable Tab stop, preferring checked state when selection changed externally. */\n #ensureTabStop(preferChecked: boolean): void {\n const navigable = this.#navigableRadios;\n let active: HTMLElement | undefined;\n if (!preferChecked) {\n const current = this.#managedTargets.filter(\n (radio) => radio.tabIndex === 0 && this.#isNavigable(radio),\n );\n if (current.length === 1) active = current[0];\n }\n const selected = this.#selectedRadio;\n if (!active && selected && this.#isNavigable(selected)) active = selected;\n active ??= navigable[0];\n this.#setActive(active ?? null);\n }\n\n /**\n * The surviving navigable radio closest to a position in the order captured\n * before the removal: the first one at or after it, else the last one before it.\n * The saved position and this search read the same population, so a `hidden` or\n * natively disabled sibling never shifts the destination past its neighbor.\n */\n #nearestNavigable(index: number): HTMLElement | null {\n const navigable = new Set(this.#navigableRadios);\n for (let i = index; i < this.#lastOrder.length; i++) {\n const radio = this.#lastOrder[i];\n if (radio && navigable.has(radio)) return radio;\n }\n for (let i = index - 1; i >= 0; i--) {\n const radio = this.#lastOrder[i];\n if (radio && navigable.has(radio)) return radio;\n }\n // Only radios added in the same batch survive; fall back to document order.\n return this.#navigableRadios[0] ?? null;\n }\n\n /** Moves through full DOM order until a navigable radio is found. */\n #nextNavigable(fromIndex: number, delta: 1 | -1): HTMLElement | undefined {\n const items = this.#managedTargets;\n let index = fromIndex;\n for (let step = 0; step < items.length; step++) {\n index = rovingMove(index, items.length, delta, \"wrap\");\n const candidate = items[index];\n if (candidate && this.#isNavigable(candidate)) return candidate;\n }\n return undefined;\n }\n\n /** Assigns the single roving Tab stop and optionally moves DOM focus. */\n #setActive(radio: HTMLElement | null, focus = false): void {\n const items = this.#managedTargets;\n const index = items.indexOf(radio as HTMLElement);\n this.#roving.setActive(index, { focus });\n for (const item of items) {\n this.#markInternal(this.#internalTabindexValues, item, item.getAttribute(\"tabindex\"));\n }\n }\n\n /** Finds this group's radio containing an event target, excluding nested groups. */\n #radioForEventTarget(target: EventTarget | null): HTMLElement | undefined {\n if (!this.#ownsEventTarget(target)) return undefined;\n const node = target as Element;\n return this.radioTargets.find((radio) => radio === node || radio.contains(node));\n }\n\n /** Whether the closest Radio Group scope around a target is this instance. */\n #ownsEventTarget(target: EventTarget | null): boolean {\n return (\n target instanceof Element &&\n target.closest('[data-controller~=\"stimeo--radio-group\"]') === this.element\n );\n }\n\n /** Hosts whose activation model can be owned without conflicting native behavior. */\n #isSupportedHost(radio: HTMLElement): boolean {\n if (radio instanceof HTMLButtonElement) return radio.type === \"button\";\n return !isInteractiveHost(radio);\n }\n\n /** Radios eligible for roving focus; ARIA-disabled deliberately remains eligible. */\n #isNavigable(radio: HTMLElement): boolean {\n if (!this.#isSupportedHost(radio) || this.#isHidden(radio)) return false;\n if (!(radio instanceof HTMLButtonElement)) return true;\n return !radio.disabled && !inheritsFieldsetDisabled(radio);\n }\n\n /** Whether hidden applies on the path from a radio up to the group root. */\n #isHidden(radio: HTMLElement): boolean {\n let current: HTMLElement | null = radio;\n while (current && current !== this.element) {\n if (current.hasAttribute(\"hidden\")) return true;\n current = current.parentElement;\n }\n return false;\n }\n\n /** Whether ARIA, visibility, or native HTML semantics suppress selection. */\n #isActivationDisabled(radio: HTMLElement): boolean {\n if (!this.#isNavigable(radio)) return true;\n let current: HTMLElement | null = radio;\n while (current) {\n if (current.getAttribute(\"aria-disabled\") === \"true\") return true;\n current = current.parentElement;\n }\n return false;\n }\n\n /** Distinguishes external retained-element changes from this controller's own writes. */\n #handleMutationRecords(records: MutationRecord[]): void {\n let external = false;\n for (const record of records) {\n const target = record.target as HTMLElement;\n const attribute = record.attributeName;\n if (attribute === \"aria-checked\") {\n const value = target.getAttribute(attribute);\n if (this.#matchesInternal(this.#internalCheckedValues, target, value)) continue;\n this.#ownedChecked.delete(target);\n this.#preferChecked = true;\n external = true;\n } else if (attribute === \"tabindex\") {\n const value = target.getAttribute(attribute);\n if (this.#matchesInternal(this.#internalTabindexValues, target, value)) continue;\n if (this.#managedRadios.has(target)) this.#originalTabindex.set(target, value);\n external = true;\n } else {\n external = true;\n }\n }\n this.#internalCheckedValues.clear();\n this.#internalTabindexValues.clear();\n if (external) this.#reconcile.schedule();\n }\n\n /** Records an attribute write this pass made, keeping one claim per record it will produce. */\n #markInternal(\n values: Map<HTMLElement, InternalWrite>,\n target: HTMLElement,\n value: string | null,\n ): void {\n const pending = values.get(target);\n if (pending) {\n pending.value = value;\n pending.count += 1;\n } else {\n values.set(target, { value, count: 1 });\n }\n }\n\n /** Consumes one claim on a record whose value this pass wrote. */\n #matchesInternal(\n values: Map<HTMLElement, InternalWrite>,\n target: HTMLElement,\n value: string | null,\n ): boolean {\n const pending = values.get(target);\n if (!pending || pending.value !== value) return false;\n pending.count -= 1;\n if (pending.count === 0) values.delete(target);\n return true;\n }\n\n /** Watches target membership, retained state/hosts, form state, and fieldset ancestry. */\n #observeMutations(): void {\n const observer = new MutationObserver((records) => this.#handleMutationRecords(records));\n this.#observer = observer;\n this.#observeWith(observer);\n }\n\n /** Registers root and ancestor observation on one observer instance. */\n #observeWith(observer: MutationObserver): void {\n observer.observe(this.element, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: OBSERVED_ATTRIBUTES,\n });\n let ancestor = this.element.parentElement;\n while (ancestor) {\n observer.observe(ancestor, {\n attributes: true,\n attributeFilter: [\"contenteditable\", \"disabled\"],\n });\n ancestor = ancestor.parentElement;\n }\n }\n\n /** Supported targets currently managed by the roving primitive. */\n get #managedTargets(): HTMLElement[] {\n return this.radioTargets.filter((radio) => this.#managedRadios.has(radio));\n }\n\n /** Managed radios eligible for the roving Tab stop. */\n get #navigableRadios(): HTMLElement[] {\n return this.#managedTargets.filter((radio) => this.#isNavigable(radio));\n }\n\n /** The currently checked managed radio, if any. */\n get #selectedRadio(): HTMLElement | undefined {\n return this.#managedTargets.find((radio) => this.#isChecked(radio));\n }\n\n /** Whether a radio is currently checked. */\n #isChecked(radio: HTMLElement): boolean {\n return radio.getAttribute(\"aria-checked\") === \"true\";\n }\n\n /** Reflects checked state while distinguishing controller writes from authored morphs. */\n #setChecked(radio: HTMLElement, checked: boolean): void {\n const value = checked ? \"true\" : \"false\";\n if (radio.getAttribute(\"aria-checked\") === value) return;\n this.#markInternal(this.#internalCheckedValues, radio, value);\n radio.setAttribute(\"aria-checked\", value);\n }\n\n /** Writes a roving value before the radio is visible to the shared primitive. */\n #writeTabindex(radio: HTMLElement, value: number): void {\n const serialized = String(value);\n this.#markInternal(this.#internalTabindexValues, radio, serialized);\n radio.tabIndex = value;\n }\n\n /** Mirrors the selected value or the empty state to the optional hidden field. */\n #reflectField(\n radio: HTMLElement | undefined,\n { silent = false }: { silent?: boolean } = {},\n ): void {\n if (!this.hasFieldTarget) return;\n const value = radio ? this.#radioValue(radio) : \"\";\n if (this.fieldTarget.value === value) return;\n this.fieldTarget.value = value;\n if (!silent) this.fieldTarget.dispatchEvent(new Event(\"change\", { bubbles: true }));\n }\n\n /** A radio's submitted value (`data-value`, defaulting to empty). */\n #radioValue(radio: HTMLElement): string {\n return radio.getAttribute(\"data-value\") ?? \"\";\n }\n}\n"]}
|
|
@@ -23,6 +23,8 @@ import { Controller } from '@hotwired/stimulus';
|
|
|
23
23
|
* the last is N. Unlike a generic radio group, arrows deliberately clamp rather
|
|
24
24
|
* than wrap because the values have an ordered lower and upper bound.
|
|
25
25
|
*
|
|
26
|
+
* `change` and `reconcile` dispatch `{ value: number }`.
|
|
27
|
+
*
|
|
26
28
|
* @remarks
|
|
27
29
|
* Behavior only — consumers style `[aria-checked]` and `data-rating-hover`. In
|
|
28
30
|
* `readonly` mode the group becomes `role="img"`; the consumer supplies the
|
|
@@ -32,17 +32,21 @@ var AttributeLease = class {
|
|
|
32
32
|
written: value
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
else element.setAttribute(this.#attribute, value);
|
|
35
|
+
this.#reflect(element, value);
|
|
37
36
|
}
|
|
38
37
|
/** Returns one lease without overwriting a value subsequently authored by a consumer. */
|
|
39
38
|
return(element) {
|
|
40
39
|
const record = this.#records.get(element);
|
|
41
40
|
if (!record) return;
|
|
42
41
|
this.#records.delete(element);
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
|
|
42
|
+
const stillOwned = element.getAttribute(this.#attribute) === record.written;
|
|
43
|
+
if (stillOwned) this.#reflect(element, record.original);
|
|
44
|
+
}
|
|
45
|
+
/** Reflects only a real value transition, avoiding self-triggered mutation work. */
|
|
46
|
+
#reflect(element, value) {
|
|
47
|
+
if (element.getAttribute(this.#attribute) === value) return;
|
|
48
|
+
if (value === null) element.removeAttribute(this.#attribute);
|
|
49
|
+
else element.setAttribute(this.#attribute, value);
|
|
46
50
|
}
|
|
47
51
|
/** Returns every outstanding lease using the same ownership check as {@link return}. */
|
|
48
52
|
returnAll() {
|