stimeo-ui 0.14.0 → 0.16.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 +212 -0
- package/README.md +120 -0
- package/dist/cable/index.js +123 -29
- package/dist/cable/index.js.map +1 -1
- package/dist/controllers/accordion_controller.d.ts +30 -3
- package/dist/controllers/accordion_controller.js +98 -9
- package/dist/controllers/accordion_controller.js.map +1 -1
- package/dist/controllers/alert_dialog_controller.d.ts +8 -7
- package/dist/controllers/alert_dialog_controller.js.map +1 -1
- package/dist/controllers/announcer_controller.d.ts +3 -2
- package/dist/controllers/announcer_controller.js +96 -62
- package/dist/controllers/announcer_controller.js.map +1 -1
- package/dist/controllers/auto_submit_controller.js +83 -7
- package/dist/controllers/auto_submit_controller.js.map +1 -1
- package/dist/controllers/avatar_controller.js +1 -1
- package/dist/controllers/avatar_controller.js.map +1 -1
- package/dist/controllers/breadcrumb_controller.d.ts +10 -7
- package/dist/controllers/breadcrumb_controller.js +38 -11
- package/dist/controllers/breadcrumb_controller.js.map +1 -1
- package/dist/controllers/bulk_select_controller.d.ts +4 -4
- package/dist/controllers/bulk_select_controller.js +7 -6
- package/dist/controllers/bulk_select_controller.js.map +1 -1
- package/dist/controllers/calendar_controller.d.ts +101 -23
- package/dist/controllers/calendar_controller.js +340 -123
- package/dist/controllers/calendar_controller.js.map +1 -1
- package/dist/controllers/carousel_controller.d.ts +67 -22
- package/dist/controllers/carousel_controller.js +263 -38
- package/dist/controllers/carousel_controller.js.map +1 -1
- package/dist/controllers/character_counter_controller.d.ts +1 -1
- package/dist/controllers/character_counter_controller.js +40 -2
- package/dist/controllers/character_counter_controller.js.map +1 -1
- package/dist/controllers/checkbox_controller.js +81 -12
- package/dist/controllers/checkbox_controller.js.map +1 -1
- package/dist/controllers/clipboard_controller.d.ts +28 -2
- package/dist/controllers/clipboard_controller.js +63 -5
- package/dist/controllers/clipboard_controller.js.map +1 -1
- package/dist/controllers/collapsible_controller.d.ts +25 -1
- package/dist/controllers/collapsible_controller.js +99 -14
- package/dist/controllers/collapsible_controller.js.map +1 -1
- package/dist/controllers/color_picker_controller.d.ts +29 -8
- package/dist/controllers/color_picker_controller.js +80 -34
- package/dist/controllers/color_picker_controller.js.map +1 -1
- package/dist/controllers/combobox_controller.d.ts +10 -1
- package/dist/controllers/combobox_controller.js +106 -16
- package/dist/controllers/combobox_controller.js.map +1 -1
- package/dist/controllers/command_palette_controller.d.ts +3 -3
- package/dist/controllers/command_palette_controller.js +35 -3
- package/dist/controllers/command_palette_controller.js.map +1 -1
- package/dist/controllers/conditional_fields_controller.js +85 -17
- package/dist/controllers/conditional_fields_controller.js.map +1 -1
- package/dist/controllers/confirm_controller.js +3 -0
- package/dist/controllers/confirm_controller.js.map +1 -1
- package/dist/controllers/context_menu_controller.d.ts +6 -0
- package/dist/controllers/context_menu_controller.js +32 -12
- package/dist/controllers/context_menu_controller.js.map +1 -1
- package/dist/controllers/count_up_controller.js.map +1 -1
- package/dist/controllers/countdown_controller.d.ts +30 -1
- package/dist/controllers/countdown_controller.js +129 -26
- package/dist/controllers/countdown_controller.js.map +1 -1
- package/dist/controllers/currency_input_controller.d.ts +77 -16
- package/dist/controllers/currency_input_controller.js +221 -67
- package/dist/controllers/currency_input_controller.js.map +1 -1
- package/dist/controllers/data_grid_controller.d.ts +63 -18
- package/dist/controllers/data_grid_controller.js +195 -29
- package/dist/controllers/data_grid_controller.js.map +1 -1
- package/dist/controllers/date_range_picker_controller.d.ts +41 -6
- package/dist/controllers/date_range_picker_controller.js +151 -30
- package/dist/controllers/date_range_picker_controller.js.map +1 -1
- package/dist/controllers/dialog_controller.d.ts +10 -3
- package/dist/controllers/dialog_controller.js +35 -8
- package/dist/controllers/dialog_controller.js.map +1 -1
- package/dist/controllers/direct_upload_controller.js +22 -4
- package/dist/controllers/direct_upload_controller.js.map +1 -1
- package/dist/controllers/dirty_form_controller.d.ts +2 -2
- package/dist/controllers/dirty_form_controller.js +46 -13
- package/dist/controllers/dirty_form_controller.js.map +1 -1
- package/dist/controllers/dismissible_controller.js +1 -0
- package/dist/controllers/dismissible_controller.js.map +1 -1
- package/dist/controllers/drawer_controller.d.ts +18 -10
- package/dist/controllers/drawer_controller.js +54 -19
- package/dist/controllers/drawer_controller.js.map +1 -1
- package/dist/controllers/dropdown_controller.d.ts +9 -3
- package/dist/controllers/dropdown_controller.js +36 -9
- package/dist/controllers/dropdown_controller.js.map +1 -1
- package/dist/controllers/editable_controller.js +34 -0
- package/dist/controllers/editable_controller.js.map +1 -1
- package/dist/controllers/file_dropzone_controller.js +144 -51
- package/dist/controllers/file_dropzone_controller.js.map +1 -1
- package/dist/controllers/filter_controller.d.ts +10 -4
- package/dist/controllers/filter_controller.js +20 -6
- package/dist/controllers/filter_controller.js.map +1 -1
- package/dist/controllers/flash_controller.d.ts +26 -6
- package/dist/controllers/flash_controller.js +432 -71
- package/dist/controllers/flash_controller.js.map +1 -1
- package/dist/controllers/focus_controller.js +1 -0
- package/dist/controllers/focus_controller.js.map +1 -1
- package/dist/controllers/form_field_controller.js +7 -5
- package/dist/controllers/form_field_controller.js.map +1 -1
- package/dist/controllers/form_validation_controller.js +19 -13
- package/dist/controllers/form_validation_controller.js.map +1 -1
- package/dist/controllers/frame_loading_controller.js +45 -8
- package/dist/controllers/frame_loading_controller.js.map +1 -1
- package/dist/controllers/highlight_controller.js +82 -25
- package/dist/controllers/highlight_controller.js.map +1 -1
- package/dist/controllers/hover_card_controller.d.ts +10 -2
- package/dist/controllers/hover_card_controller.js +40 -14
- package/dist/controllers/hover_card_controller.js.map +1 -1
- package/dist/controllers/idle_controller.d.ts +16 -3
- package/dist/controllers/idle_controller.js +90 -5
- package/dist/controllers/idle_controller.js.map +1 -1
- package/dist/controllers/input_mask_controller.d.ts +5 -2
- package/dist/controllers/input_mask_controller.js +65 -9
- package/dist/controllers/input_mask_controller.js.map +1 -1
- package/dist/controllers/intersection_controller.js +3 -0
- package/dist/controllers/intersection_controller.js.map +1 -1
- package/dist/controllers/lazy_frame_controller.js +11 -2
- package/dist/controllers/lazy_frame_controller.js.map +1 -1
- package/dist/controllers/listbox_controller.d.ts +50 -8
- package/dist/controllers/listbox_controller.js +203 -45
- package/dist/controllers/listbox_controller.js.map +1 -1
- package/dist/controllers/local_time_controller.js +10 -5
- package/dist/controllers/local_time_controller.js.map +1 -1
- package/dist/controllers/masonry_controller.d.ts +3 -3
- package/dist/controllers/masonry_controller.js +31 -15
- package/dist/controllers/masonry_controller.js.map +1 -1
- package/dist/controllers/menu_controller.d.ts +9 -3
- package/dist/controllers/menu_controller.js +45 -16
- package/dist/controllers/menu_controller.js.map +1 -1
- package/dist/controllers/menubar_controller.d.ts +11 -0
- package/dist/controllers/menubar_controller.js +58 -24
- package/dist/controllers/menubar_controller.js.map +1 -1
- package/dist/controllers/meter_controller.js +9 -5
- package/dist/controllers/meter_controller.js.map +1 -1
- package/dist/controllers/multi_select_controller.d.ts +18 -3
- package/dist/controllers/multi_select_controller.js +278 -104
- package/dist/controllers/multi_select_controller.js.map +1 -1
- package/dist/controllers/navigation_menu_controller.d.ts +11 -0
- package/dist/controllers/navigation_menu_controller.js +48 -15
- package/dist/controllers/navigation_menu_controller.js.map +1 -1
- package/dist/controllers/nested_form_controller.js +37 -8
- package/dist/controllers/nested_form_controller.js.map +1 -1
- package/dist/controllers/network_status_controller.js +9 -1
- package/dist/controllers/network_status_controller.js.map +1 -1
- package/dist/controllers/number_input_controller.d.ts +36 -8
- package/dist/controllers/number_input_controller.js +124 -21
- package/dist/controllers/number_input_controller.js.map +1 -1
- package/dist/controllers/optimistic_controller.js +42 -5
- package/dist/controllers/optimistic_controller.js.map +1 -1
- package/dist/controllers/otp_controller.d.ts +22 -7
- package/dist/controllers/otp_controller.js +198 -55
- package/dist/controllers/otp_controller.js.map +1 -1
- package/dist/controllers/overflow_indicator_controller.d.ts +8 -12
- package/dist/controllers/overflow_indicator_controller.js +115 -21
- package/dist/controllers/overflow_indicator_controller.js.map +1 -1
- package/dist/controllers/overflow_menu_controller.d.ts +26 -6
- package/dist/controllers/overflow_menu_controller.js +141 -44
- package/dist/controllers/overflow_menu_controller.js.map +1 -1
- package/dist/controllers/pagination_controller.d.ts +19 -11
- package/dist/controllers/pagination_controller.js +74 -28
- package/dist/controllers/pagination_controller.js.map +1 -1
- package/dist/controllers/password_reveal_controller.d.ts +15 -1
- package/dist/controllers/password_reveal_controller.js +59 -2
- package/dist/controllers/password_reveal_controller.js.map +1 -1
- package/dist/controllers/persist_controller.js +30 -8
- package/dist/controllers/persist_controller.js.map +1 -1
- package/dist/controllers/pointer_drag_controller.js +131 -52
- package/dist/controllers/pointer_drag_controller.js.map +1 -1
- package/dist/controllers/popover_controller.d.ts +9 -3
- package/dist/controllers/popover_controller.js +45 -11
- package/dist/controllers/popover_controller.js.map +1 -1
- package/dist/controllers/portal_controller.d.ts +1 -1
- package/dist/controllers/portal_controller.js +6 -2
- package/dist/controllers/portal_controller.js.map +1 -1
- package/dist/controllers/preview_guard_controller.js +16 -1
- package/dist/controllers/preview_guard_controller.js.map +1 -1
- package/dist/controllers/progress_controller.js +8 -4
- package/dist/controllers/progress_controller.js.map +1 -1
- package/dist/controllers/radio_group_controller.d.ts +6 -4
- package/dist/controllers/radio_group_controller.js +42 -17
- package/dist/controllers/radio_group_controller.js.map +1 -1
- package/dist/controllers/range_slider_controller.d.ts +49 -1
- package/dist/controllers/range_slider_controller.js +88 -42
- package/dist/controllers/range_slider_controller.js.map +1 -1
- package/dist/controllers/rating_controller.d.ts +14 -3
- package/dist/controllers/rating_controller.js +39 -15
- package/dist/controllers/rating_controller.js.map +1 -1
- package/dist/controllers/read_more_controller.d.ts +24 -2
- package/dist/controllers/read_more_controller.js +100 -7
- package/dist/controllers/read_more_controller.js.map +1 -1
- package/dist/controllers/reading_progress_controller.js +65 -19
- package/dist/controllers/reading_progress_controller.js.map +1 -1
- package/dist/controllers/relative_time_controller.js +10 -5
- package/dist/controllers/relative_time_controller.js.map +1 -1
- package/dist/controllers/resizable_controller.d.ts +16 -2
- package/dist/controllers/resizable_controller.js +82 -22
- package/dist/controllers/resizable_controller.js.map +1 -1
- package/dist/controllers/scroll_area_controller.js +75 -27
- package/dist/controllers/scroll_area_controller.js.map +1 -1
- package/dist/controllers/scroll_restore_controller.js +37 -16
- package/dist/controllers/scroll_restore_controller.js.map +1 -1
- package/dist/controllers/scroll_visibility_controller.js +49 -30
- package/dist/controllers/scroll_visibility_controller.js.map +1 -1
- package/dist/controllers/scrollspy_controller.d.ts +3 -2
- package/dist/controllers/scrollspy_controller.js +71 -26
- package/dist/controllers/scrollspy_controller.js.map +1 -1
- package/dist/controllers/separator_controller.d.ts +41 -14
- package/dist/controllers/separator_controller.js +66 -37
- package/dist/controllers/separator_controller.js.map +1 -1
- package/dist/controllers/sidebar_controller.d.ts +20 -3
- package/dist/controllers/sidebar_controller.js +77 -18
- package/dist/controllers/sidebar_controller.js.map +1 -1
- package/dist/controllers/skeleton_controller.js +6 -1
- package/dist/controllers/skeleton_controller.js.map +1 -1
- package/dist/controllers/slider_controller.d.ts +45 -7
- package/dist/controllers/slider_controller.js +82 -47
- package/dist/controllers/slider_controller.js.map +1 -1
- package/dist/controllers/smart_sticky_header_controller.js +60 -26
- package/dist/controllers/smart_sticky_header_controller.js.map +1 -1
- package/dist/controllers/sortable_controller.js +17 -2
- package/dist/controllers/sortable_controller.js.map +1 -1
- package/dist/controllers/spinner_controller.js +10 -2
- package/dist/controllers/spinner_controller.js.map +1 -1
- package/dist/controllers/step_indicator_controller.d.ts +19 -17
- package/dist/controllers/step_indicator_controller.js +18 -17
- package/dist/controllers/step_indicator_controller.js.map +1 -1
- package/dist/controllers/stepper_controller.d.ts +34 -9
- package/dist/controllers/stepper_controller.js +101 -19
- package/dist/controllers/stepper_controller.js.map +1 -1
- package/dist/controllers/stick_to_bottom_controller.d.ts +19 -0
- package/dist/controllers/stick_to_bottom_controller.js +104 -8
- package/dist/controllers/stick_to_bottom_controller.js.map +1 -1
- package/dist/controllers/submit_once_controller.d.ts +3 -2
- package/dist/controllers/submit_once_controller.js +45 -9
- package/dist/controllers/submit_once_controller.js.map +1 -1
- package/dist/controllers/switch_controller.d.ts +29 -7
- package/dist/controllers/switch_controller.js +101 -10
- package/dist/controllers/switch_controller.js.map +1 -1
- package/dist/controllers/tabs_controller.d.ts +12 -0
- package/dist/controllers/tabs_controller.js +21 -2
- package/dist/controllers/tabs_controller.js.map +1 -1
- package/dist/controllers/tags_input_controller.d.ts +15 -3
- package/dist/controllers/tags_input_controller.js +209 -59
- package/dist/controllers/tags_input_controller.js.map +1 -1
- package/dist/controllers/textarea_autosize_controller.js +29 -3
- package/dist/controllers/textarea_autosize_controller.js.map +1 -1
- package/dist/controllers/theme_controller.d.ts +20 -3
- package/dist/controllers/theme_controller.js +64 -14
- package/dist/controllers/theme_controller.js.map +1 -1
- package/dist/controllers/time_picker_controller.js +23 -8
- package/dist/controllers/time_picker_controller.js.map +1 -1
- package/dist/controllers/toast_controller.d.ts +55 -15
- package/dist/controllers/toast_controller.js +451 -105
- package/dist/controllers/toast_controller.js.map +1 -1
- package/dist/controllers/toggle_group_controller.d.ts +49 -7
- package/dist/controllers/toggle_group_controller.js +159 -23
- package/dist/controllers/toggle_group_controller.js.map +1 -1
- package/dist/controllers/toolbar_controller.js +32 -0
- package/dist/controllers/toolbar_controller.js.map +1 -1
- package/dist/controllers/tooltip_controller.d.ts +8 -0
- package/dist/controllers/tooltip_controller.js +39 -13
- package/dist/controllers/tooltip_controller.js.map +1 -1
- package/dist/controllers/transition_controller.js +4 -0
- package/dist/controllers/transition_controller.js.map +1 -1
- package/dist/controllers/tree_view_controller.d.ts +39 -8
- package/dist/controllers/tree_view_controller.js +169 -16
- package/dist/controllers/tree_view_controller.js.map +1 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +5002 -1911
- package/dist/index.js.map +1 -1
- package/dist/inspector/cli.d.ts +72 -6
- package/dist/inspector/cli.js +262 -51
- package/dist/inspector/cli.js.map +1 -1
- package/dist/inspector/cli_bin.js +309 -51
- package/dist/inspector/cli_bin.js.map +1 -1
- package/dist/inspector/examples.json +40 -40
- package/dist/inspector/manifest.json +529 -61
- package/dist/positioning/index.js +2 -0
- package/dist/positioning/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/arrow_step.ts","../../src/utils/attribute_lease.ts","../../src/utils/before_cache_reset.ts","../../src/utils/microtask_coalescer.ts","../../src/utils/stepped_value.ts","../../src/controllers/separator_controller.ts"],"names":["position"],"mappings":";;;;;AA+FO,SAAS,oBAAA,CACd,KAAA,EACA,KAAA,GAAkC,EAAC,EAC1B;AACT,EAAA,IAAI,CAAC,KAAA,CAAM,GAAA,CAAI,UAAA,CAAW,OAAO,GAAG,OAAO,KAAA;AAC3C,EAAA,OACG,KAAA,CAAM,MAAA,IAAU,CAAC,KAAA,CAAM,QAAA,CAAS,KAAK,CAAA,IACrC,KAAA,CAAM,OAAA,IAAW,CAAC,KAAA,CAAM,QAAA,CAAS,MAAM,KACvC,KAAA,CAAM,OAAA,IAAW,CAAC,KAAA,CAAM,QAAA,CAAS,MAAM,CAAA,IACvC,KAAA,CAAM,QAAA,IAAY,CAAC,KAAA,CAAM,QAAA,CAAS,OAAO,CAAA;AAE9C;;;AClFO,IAAM,iBAAN,MAAkD;AAAA,EAC9C,UAAA;AAAA,EACA,QAAA,uBAAe,GAAA,EAA6B;AAAA;AAAA,EAGrD,YAAY,SAAA,EAAmB;AAC7B,IAAA,IAAA,CAAK,UAAA,GAAa,SAAA;AAAA,EACpB;AAAA;AAAA,EAGA,KAAA,CAAM,SAAY,KAAA,EAA4B;AAC5C,IAAA,MAAM,QAAA,GAAW,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,OAAO,CAAA;AAC1C,IAAA,IAAI,QAAA,EAAU;AACZ,MAAA,QAAA,CAAS,OAAA,GAAU,KAAA;AAAA,IACrB,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,QAAA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AAO;AACrB,IAAA,IAAA,CAAK,iBAAA,EAAkB;AAAA,EACzB;AACF","file":"separator_controller.js","sourcesContent":["import { isRtl } from \"./logical_scroll\";\n\n/**\n * Turns an arrow key into a **logical** step: `+1` for \"next\", `-1` for\n * \"previous\", `0` when the key names neither.\n *\n * APG defines the horizontal pair as *next / previous* and says a vertical\n * arrangement swaps in Down/Up for the same meaning — so the pair is one axis's\n * spelling of an order, and the order reverses with the writing direction. Only\n * the horizontal pair reverses. Down/Up name an axis the writing direction does\n * not mirror, and returning them unchanged is the point: many controllers fold\n * both pairs into one branch, where swapping the branches under RTL would flip\n * the vertical axis too — a bug that reads as \"the arrows work\" until someone\n * presses Down.\n *\n * **Direction is read from the element the caller passes, which should be the\n * container that lays the items out** — not the focused child. A child may carry\n * its own `dir` (an LTR input inside an RTL form is ordinary authoring), and\n * probing per handler makes two handlers disagree at the boundary between them.\n *\n * This decides direction only. Whether the axis is even active (an\n * `orientation=\"horizontal\"` widget ignoring Down/Up), how far the step lands,\n * and what wrapping does all stay with the caller.\n *\n * **It encodes the list-order convention: `ArrowDown` is *next*.** Widgets that\n * pair the arrows by *value* instead — `ArrowUp` meaning \"more\", as a rating or a\n * slider does — must not use this, or their vertical axis inverts. Reverse the\n * horizontal pair on its own there.\n *\n * @example\n * ```ts\n * const step = logicalArrowStep(event.key, this.element);\n * if (step === 0) return;\n * this.#roving.setActive(rovingMove(current, length, step, \"wrap\"), { focus: true });\n * ```\n */\nexport function logicalArrowStep(key: string, element: Element): 1 | -1 | 0 {\n if (key === \"ArrowDown\") return 1;\n if (key === \"ArrowUp\") return -1;\n if (key !== \"ArrowRight\" && key !== \"ArrowLeft\") return 0;\n const forward = isRtl(element) ? \"ArrowLeft\" : \"ArrowRight\";\n return key === forward ? 1 : -1;\n}\n\n/**\n * Rewrites `key` so an existing LTR-shaped branch keeps working under RTL:\n * `ArrowRight` and `ArrowLeft` trade places, everything else passes through.\n *\n * The alternative — negating a delta — silently breaks handlers whose two\n * horizontal branches are **not mirror images**. A grid that clamps one edge but\n * not the other, or a segmented field guarding `index > 0` on one side and\n * `index < length - 1` on the other, ends up applying the wrong guard to the\n * wrong direction. Swapping the key leaves each branch, guards and all, exactly\n * where its author put it.\n *\n * Same rule as {@link logicalArrowStep} about which element to read: pass the\n * container that lays the items out, not the focused child.\n *\n * @example\n * ```ts\n * switch (logicalArrowKey(event.key, this.element)) {\n * case \"ArrowLeft\": // \"previous\" — whatever direction that is on screen\n * ```\n */\nexport function logicalArrowKey(key: string, element: Element): string {\n if (key !== \"ArrowRight\" && key !== \"ArrowLeft\") return key;\n if (!isRtl(element)) return key;\n return key === \"ArrowRight\" ? \"ArrowLeft\" : \"ArrowRight\";\n}\n\n/** Modifiers a widget may claim on an arrow key, named for the `allow` list. */\nexport type ArrowModifier = \"alt\" | \"ctrl\" | \"meta\" | \"shift\";\n\n/**\n * True when an arrow key arrived carrying a modifier the widget must leave to\n * the browser: return without calling `preventDefault()` and without moving any\n * state.\n *\n * A bare arrow belongs to the widget; a chorded one usually does not.\n * `Alt`/`Meta` plus a horizontal arrow is history back/forward on every desktop\n * browser, and a widget that swallows it makes the shortcut work or not\n * depending on where focus happens to sit — a coin-flip the user cannot see.\n *\n * `allow` is for the combinations APG assigns to a pattern **and the widget\n * actually implements** — today only Combobox's optional `Alt+Down`/`Alt+Up`.\n * Listing one the widget does not implement defeats the point: the chord then\n * runs the plain-arrow branch, which is exactly what this guard exists to stop.\n * Non-arrow keys return `false`, so chorded letters and\n * `Control+Home`/`Control+End` are untouched.\n *\n * @example\n * ```ts\n * if (isReservedArrowChord(event)) return;\n * ```\n */\nexport function isReservedArrowChord(\n event: KeyboardEvent,\n allow: readonly ArrowModifier[] = [],\n): boolean {\n if (!event.key.startsWith(\"Arrow\")) return false;\n return (\n (event.altKey && !allow.includes(\"alt\")) ||\n (event.ctrlKey && !allow.includes(\"ctrl\")) ||\n (event.metaKey && !allow.includes(\"meta\")) ||\n (event.shiftKey && !allow.includes(\"shift\"))\n );\n}\n\n/**\n * True when a press arrived carrying any modifier, for the keys the browser and\n * the OS own outright: return without calling `preventDefault()` and without\n * moving any state.\n *\n * `Control+Home` and `Control+End` jump the document to its ends, and a widget\n * that swallows them makes the shortcut work or not depending on where focus\n * happens to sit. {@link isReservedArrowChord} answers the same question for the\n * arrows, but returns `false` for every other key so that this one can decide.\n *\n * There is no `allow` list here on purpose. APG assigns no modifier chord to\n * `Home`/`End`, so a widget that wanted one would be claiming a combination the\n * pattern never gave it.\n *\n * @example\n * ```ts\n * case \"Home\":\n * case \"End\":\n * if (hasModifierChord(event)) return;\n * ```\n */\nexport function hasModifierChord(event: KeyboardEvent): boolean {\n return event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;\n}\n","/** One temporarily controlled attribute value and the authored value it displaced. */\ninterface AttributeLeaseRecord {\n readonly original: string | null;\n written: string | null;\n}\n\n/**\n * Temporarily controls one attribute across a changing set of elements.\n *\n * The first write remembers the authored value, including the distinction between\n * an absent attribute and an authored empty string. Returning a lease restores that\n * value only while the attribute still matches the controller's last write. If a\n * consumer changed it in the meantime, the consumer owns the new value and teardown\n * leaves it alone.\n *\n * A `null` write deliberately removes the attribute while retaining the lease. This\n * is useful for derived ARIA whose valid absence is itself controller state, such as\n * an unbounded `aria-valuemin` or a blank spinbutton's `aria-valuenow`.\n *\n * The lease has no lifecycle of its own, so it never subscribes to document events.\n * A consumer that must not let a derived value become the authored baseline of a\n * cached page returns its leases from its own `turbo:before-cache` rewind, where the\n * matching `disconnect()` also releases the subscription.\n */\nexport class AttributeLease<T extends Element = Element> {\n readonly #attribute: string;\n readonly #records = new Map<T, AttributeLeaseRecord>();\n\n /** @param attribute - The attribute whose temporary values this lease owns. */\n constructor(attribute: string) {\n this.#attribute = attribute;\n }\n\n /** Writes or removes the leased attribute while preserving its authored value. */\n write(element: T, value: string | null): void {\n const existing = this.#records.get(element);\n if (existing) {\n existing.written = value;\n } else {\n this.#records.set(element, {\n original: element.getAttribute(this.#attribute),\n written: value,\n });\n }\n\n this.#reflect(element, value);\n }\n\n /** Returns one lease without overwriting a value subsequently authored by a consumer. */\n return(element: T): void {\n const record = this.#records.get(element);\n if (!record) return;\n this.#records.delete(element);\n const stillOwned = element.getAttribute(this.#attribute) === record.written;\n if (stillOwned) this.#reflect(element, record.original);\n }\n\n /** Reflects only a real value transition, avoiding self-triggered mutation work. */\n #reflect(element: T, value: string | null): void {\n if (element.getAttribute(this.#attribute) === value) return;\n if (value === null) element.removeAttribute(this.#attribute);\n else element.setAttribute(this.#attribute, value);\n }\n\n /** Returns every outstanding lease using the same ownership check as {@link return}. */\n returnAll(): void {\n for (const element of Array.from(this.#records.keys())) this.return(element);\n }\n}\n","/**\n * Runs a controller's \"return to the initial state\" pass just before Turbo\n * caches the page.\n *\n * **`disconnect()` cannot do this job, for two independent reasons.** Turbo\n * queues the clone from this event rather than taking it here, and the body swap\n * that runs the controller's `disconnect()` is queued separately — so which of\n * the two lands first is not something a controller can rely on, and a rewind\n * written in `disconnect()` may reach only the DOM being thrown away. In the\n * other direction, `disconnect()` also fires on an in-page move (Stimulus tears\n * down and reconnects the same element), where rewinding would wipe a\n * legitimately in-progress interaction — a spinner mid-load would vanish. One\n * timing is unreliable, the other is too eager; `turbo:before-cache` is the only\n * point that is exactly \"the page is about to be frozen\".\n *\n * Scope is the subscription only: registering on `activate()`, unregistering on\n * `deactivate()`, and one shared document listener no matter how many instances\n * are live. *What* to return to its initial state — which `data-state`, which\n * `hidden`, which `aria-busy` — stays in the controller, because no two\n * consumers answer it the same way.\n *\n * **Rewind state, not appearance.** The pass writes attributes the controller\n * itself owns; the visual result of those attributes is the consumer's CSS, and\n * a library that reached for style or class names would be guessing at markup\n * it does not own.\n *\n * Both entry points are idempotent, so the lifecycle hooks can call them\n * unconditionally: a second `activate()` does not double-subscribe and does not\n * make the callback run twice, and `deactivate()` on an instance that never\n * subscribed is a no-op.\n *\n * This file's own doc block is dropped from `dist`, but every member comment is\n * inlined into each consumer entry (`tsup` builds with `splitting: false`), so\n * rationale belongs here and only the contract belongs on the members.\n *\n * @example\n * ```ts\n * readonly #beforeCache = new BeforeCacheReset(() => this.#rewind());\n *\n * connect() { this.#beforeCache.activate(); }\n * disconnect() { this.#beforeCache.deactivate(); }\n * ```\n */\nexport class BeforeCacheReset {\n /** Every subscribed instance, iterated by the one shared document listener. */\n static readonly #subscribers = new Set<BeforeCacheReset>();\n\n /** The shared listener; installed while at least one instance is subscribed. */\n static readonly #onBeforeCache = (): void => {\n for (const subscriber of BeforeCacheReset.#subscribers) subscriber.#rewind();\n };\n\n readonly #rewind: () => void;\n\n /** @param rewind - the pass that returns this controller's state to its initial form. */\n constructor(rewind: () => void) {\n this.#rewind = rewind;\n }\n\n /** Subscribes to `turbo:before-cache`; call from `connect()`. Idempotent. */\n activate(): void {\n const first = BeforeCacheReset.#subscribers.size === 0;\n BeforeCacheReset.#subscribers.add(this);\n if (first) {\n document.addEventListener(\"turbo:before-cache\", BeforeCacheReset.#onBeforeCache);\n }\n }\n\n /** Unsubscribes; call from `disconnect()`. Safe when never subscribed. */\n deactivate(): void {\n BeforeCacheReset.#subscribers.delete(this);\n if (BeforeCacheReset.#subscribers.size > 0) return;\n document.removeEventListener(\"turbo:before-cache\", BeforeCacheReset.#onBeforeCache);\n }\n}\n","/**\n * Collapses many Stimulus lifecycle callbacks from one DOM mutation into a\n * single pass.\n *\n * Stimulus fires `<name>TargetConnected` / `Disconnected` once per element and\n * `<name>ValueChanged` once per changed attribute. Replacing a list of N options\n * or morphing several render Values therefore delivers N callbacks — but the\n * useful unit of work is \"reconcile against the resulting declarative input\",\n * once, after the batch has settled. Every controller with reconcilable targets\n * or render Values needs the same shape: a `queued` flag plus `queueMicrotask`.\n *\n * **A microtask is the right horizon, and the reason is specific.** Stimulus\n * drives these callbacks from a `MutationObserver`, whose own callback already\n * runs as a microtask with the whole batch in hand; scheduling one more lands\n * after the last sibling callback of that batch and still before paint or any\n * event handler. A timer would be later than it needs to be, and reconciling\n * synchronously would run once per element against a half-applied DOM.\n *\n * **The two guards are not the same guard.** Scheduling is refused before the\n * controller connects, and running is refused after it disconnects:\n *\n * - **Before `connect()`** — Stimulus delivers initial target and Value callbacks\n * ahead of `connect()`. Reconciling there would compute output against a\n * controller whose own state has not been initialised, and `connect()` is\n * about to do a full pass anyway.\n * - **After `disconnect()`** — Stimulus fires a callback for **every** target\n * during teardown, and a microtask queued just before it would otherwise run\n * against a detached tree. {@link MicrotaskCoalescer.cancel} exists for the\n * teardown path to drop the pending pass outright.\n *\n * Both guards are part of one contract here rather than something each consumer\n * has to remember separately.\n *\n * Scope is the scheduling only. *What* to reconcile — keep the surviving active\n * option, fall back to the next / previous / first visible one, rebuild derived\n * chips or hidden fields — stays in the controller, because no two consumers\n * answer it the same way.\n *\n * This file's own doc block is dropped from `dist`, but every member comment is\n * inlined into each consumer entry (`tsup` builds with `splitting: false`), so\n * rationale belongs here and only the contract belongs on the members.\n *\n * @example\n * ```ts\n * readonly #reconcile = new MicrotaskCoalescer(() => this.#reconcileOptions());\n *\n * connect() { this.#reconcile.activate(); }\n * disconnect() { this.#reconcile.cancel(); }\n *\n * optionTargetConnected() { this.#reconcile.schedule(); }\n * optionTargetDisconnected() { this.#reconcile.schedule(); }\n * ```\n */\nexport class MicrotaskCoalescer {\n readonly #run: () => void;\n #queued = false;\n #active = false;\n #generation = 0;\n\n /** @param run - the single reconciliation pass, invoked at most once per batch. */\n constructor(run: () => void) {\n this.#run = run;\n }\n\n /** Opens the window in which {@link schedule} is honoured; call from `connect()`. */\n activate(): void {\n this.#active = true;\n }\n\n /** Closes the window and drops any pending pass; call from `disconnect()`. */\n cancel(): void {\n this.#active = false;\n this.#queued = false;\n this.#generation += 1;\n }\n\n /** Requests one pass after the batch settles. Idempotent; inert outside the window. */\n schedule(): void {\n if (!this.#active || this.#queued) return;\n this.#queued = true;\n const generation = this.#generation;\n queueMicrotask(() => {\n // A cancelled callback must not consume a pass queued after reconnect.\n if (generation !== this.#generation || !this.#queued || !this.#active) return;\n this.#queued = false;\n this.#run();\n });\n }\n}\n","/** Configuration for a value constrained to a stepped numeric range. */\nexport interface SteppedRange {\n /** Inclusive lower endpoint. May be infinite for an unbounded control. */\n readonly min: number;\n /** Inclusive upper endpoint. May be infinite for an unbounded control. */\n readonly max: number;\n /** Requested step. Non-finite and non-positive values fall back to `1`. */\n readonly step: number;\n /** Step-grid origin. Defaults to a finite `min`, otherwise `0`. */\n readonly base?: number;\n}\n\n/** The positive finite step used at runtime and by keyboard stepping. */\nexport function effectiveStep(step: number): number {\n return Number.isFinite(step) && step > 0 ? step : 1;\n}\n\n/**\n * Clamps a raw value and selects its nearest allowed value.\n *\n * The allowed set is the step grid plus each finite range endpoint. Keeping the\n * endpoints in that set makes an authored `aria-valuemin`/`aria-valuemax`\n * truthful even when the upper endpoint is not aligned to the grid. A value\n * exactly between two allowed values resolves upward.\n */\nexport function snapSteppedValue(raw: number, range: SteppedRange): number {\n if (!(range.min <= range.max)) return finiteFallback(range.min, range.max);\n\n const input = Number.isNaN(raw) ? finiteFallback(range.min, range.max) : raw;\n const clamped = Math.min(range.max, Math.max(range.min, input));\n const step = effectiveStep(range.step);\n const base = stepBase(range);\n const candidates: number[] = [];\n\n if (Number.isFinite(range.min)) candidates.push(range.min);\n if (Number.isFinite(range.max)) candidates.push(range.max);\n\n const gridPosition = (clamped - base) / step;\n if (Number.isFinite(gridPosition)) {\n addGridCandidate(candidates, Math.floor(gridPosition), range, base, step);\n addGridCandidate(candidates, Math.ceil(gridPosition), range, base, step);\n }\n\n if (candidates.length === 0) return clamped;\n let nearest = candidates[0] as number;\n let nearestDistance = Math.abs(clamped - nearest);\n for (const candidate of candidates.slice(1)) {\n const distance = Math.abs(clamped - candidate);\n if (\n distance < nearestDistance ||\n (nearlyEqual(distance, nearestDistance) && candidate > nearest)\n ) {\n nearest = candidate;\n nearestDistance = distance;\n }\n }\n return nearest;\n}\n\n/**\n * Moves through the ordered allowed-value set by an integer number of steps.\n *\n * This differs from adding `step * count` and snapping afterward at an\n * off-grid endpoint: with `max=94, step=10`, one decrement from `94` must land\n * on `90`, and one increment from `90` must reach the advertised maximum `94`.\n */\nexport function stepSteppedValue(current: number, count: number, range: SteppedRange): number {\n const value = snapSteppedValue(current, range);\n const distance = Math.abs(Math.trunc(count));\n if (!Number.isFinite(distance) || distance === 0) return value;\n const direction = Math.sign(count);\n const adjacent = adjacentSteppedValue(value, direction, range);\n\n // The first move accounts for a possibly off-grid endpoint. From there a\n // direct grid jump is equivalent to repeated adjacency, and avoids work that\n // grows with Page-step magnitudes or programmatic counts.\n const raw = adjacent + direction * (distance - 1) * effectiveStep(range.step);\n return snapSteppedValue(raw, range);\n}\n\n/** Returns the next member of the ordered endpoint-plus-grid set. */\nfunction adjacentSteppedValue(current: number, direction: number, range: SteppedRange): number {\n const step = effectiveStep(range.step);\n const base = stepBase(range);\n const candidates: number[] = [];\n\n if (direction > 0) {\n const position = (current - base) / step;\n if (Number.isFinite(position)) {\n let gridIndex = Math.floor(position) + 1;\n let candidate = cleanGridValue(base + gridIndex * step, base, step);\n if (candidate < current || nearlyEqual(candidate, current)) {\n gridIndex += 1;\n candidate = cleanGridValue(base + gridIndex * step, base, step);\n }\n if (\n candidate > current &&\n !nearlyEqual(candidate, current) &&\n within(candidate, range.min, range.max)\n ) {\n candidates.push(clamp(candidate, range));\n }\n }\n return clamp(Math.min(...candidates), range);\n }\n\n const position = (current - base) / step;\n if (Number.isFinite(position)) {\n let gridIndex = Math.ceil(position) - 1;\n let candidate = cleanGridValue(base + gridIndex * step, base, step);\n if (candidate > current || nearlyEqual(candidate, current)) {\n gridIndex -= 1;\n candidate = cleanGridValue(base + gridIndex * step, base, step);\n }\n if (\n candidate < current &&\n !nearlyEqual(candidate, current) &&\n within(candidate, range.min, range.max)\n ) {\n candidates.push(clamp(candidate, range));\n }\n }\n return clamp(Math.max(...candidates), range);\n}\n\n/** Adds one grid value when it falls inside the inclusive range. */\nfunction addGridCandidate(\n candidates: number[],\n index: number,\n range: SteppedRange,\n base: number,\n step: number,\n): void {\n const candidate = cleanGridValue(base + index * step, base, step);\n if (within(candidate, range.min, range.max)) candidates.push(clamp(candidate, range));\n}\n\n/** A finite authored base wins; otherwise the finite lower bound or zero does. */\nfunction stepBase(range: SteppedRange): number {\n if (range.base !== undefined && Number.isFinite(range.base)) return range.base;\n return Number.isFinite(range.min) ? range.min : 0;\n}\n\n/** Removes binary noise without discarding significant integer-place digits. */\nfunction cleanGridValue(value: number, base: number, step: number): number {\n const precision = Math.max(decimalPlaces(base), decimalPlaces(step));\n // `toFixed` accepts at most 100 fractional digits. Below that limit it rounds\n // according to the authored grid precision rather than an arbitrary total\n // significant-digit count, which keeps unit steps distinct at large bases.\n return precision <= 100 ? Number(value.toFixed(precision)) : value;\n}\n\n/** Number of fractional decimal places represented by a finite JS number. */\nfunction decimalPlaces(value: number): number {\n const [coefficient = \"\", exponentText] = Math.abs(value).toString().toLowerCase().split(\"e\");\n const fractionLength = coefficient.split(\".\")[1]?.length ?? 0;\n const exponent = exponentText === undefined ? 0 : Number(exponentText);\n return Math.max(0, fractionLength - exponent);\n}\n\n/** Inclusive range check tolerant only of arithmetic noise at an endpoint. */\nfunction within(value: number, min: number, max: number): boolean {\n return (value > min || nearlyEqual(value, min)) && (value < max || nearlyEqual(value, max));\n}\n\n/** Clamps a candidate whose only overshoot may be floating-point noise. */\nfunction clamp(value: number, range: SteppedRange): number {\n return Math.min(range.max, Math.max(range.min, value));\n}\n\n/** Relative comparison used only to collapse arithmetic noise, not real steps. */\nfunction nearlyEqual(left: number, right: number): boolean {\n const scale = Math.max(Math.abs(left), Math.abs(right));\n return (\n Number.isFinite(left) &&\n Number.isFinite(right) &&\n Math.abs(left - right) <= Number.EPSILON * scale\n );\n}\n\n/** Stable fallback for malformed ranges or `NaN` input. */\nfunction finiteFallback(min: number, max: number): number {\n if (Number.isFinite(min)) return min;\n if (Number.isFinite(max)) return max;\n return 0;\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport { isReservedArrowChord } from \"../utils/arrow_step\";\nimport { AttributeLease } from \"../utils/attribute_lease\";\nimport { BeforeCacheReset } from \"../utils/before_cache_reset\";\nimport { MicrotaskCoalescer } from \"../utils/microtask_coalescer\";\nimport { type SteppedRange, snapSteppedValue, stepSteppedValue } from \"../utils/stepped_value\";\n\nconst DEFAULT_MIN = 0;\nconst DEFAULT_MAX = 100;\n\n/**\n * Headless **Separator** behavior. The normative source depends on the case:\n * a decorative divider follows the WAI-ARIA `separator` role\n * (https://www.w3.org/TR/wai-aria-1.2/#separator), while the focusable,\n * value-bearing divider follows the APG Window Splitter pattern\n * (https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/).\n *\n * Markup contract (identifier: `stimeo--separator`):\n * <!-- decorative -->\n * <div data-controller=\"stimeo--separator\"\n * data-stimeo--separator-orientation-value=\"horizontal\"></div>\n *\n * <!-- focusable, value-bearing -->\n * <div data-controller=\"stimeo--separator\"\n * aria-labelledby=\"sidebar-heading\" aria-controls=\"sidebar\"\n * data-stimeo--separator-orientation-value=\"vertical\"\n * data-stimeo--separator-focusable-value=\"true\"\n * data-stimeo--separator-min-value=\"0\"\n * data-stimeo--separator-max-value=\"100\"\n * data-stimeo--separator-step-value=\"1\"\n * data-stimeo--separator-value-value=\"50\"\n * data-action=\"keydown->stimeo--separator#onKeydown\"></div>\n *\n * The Stimulus Values are the live inputs. The controller reflects them as\n * `role`, `tabindex`, `aria-orientation`, and the range ARIA while connected,\n * then restores the attributes it displaced on disconnect and before Turbo\n * caches the page. Existing finite range ARIA is hydrated into otherwise\n * absent Values once, which preserves progressively enhanced server markup\n * without leaving two live sources of truth.\n *\n * `change` dispatches `{ value: number }`.\n *\n * @remarks\n * Behavior only — line drawing is the consumer's CSS. The axis follows Window\n * Splitter: a vertical divider takes ArrowLeft/ArrowRight, a horizontal one\n * takes ArrowUp/ArrowDown. Which end counts as an increase is not defined\n * there, so it follows the slider convention (ArrowRight/ArrowUp increase).\n * Home/End are optional in the pattern and are implemented here; F6 is not.\n *\n * Runtime Value changes repaint silently. A maximum below the effective\n * minimum collapses to that minimum; non-finite bounds use `0`/`100`, and an\n * invalid or non-positive step uses `1`. Finite endpoints remain reachable even\n * when they do not align to the step grid.\n *\n * Because no position is ever applied here, two Window Splitter requirements\n * fall to the consumer: `aria-controls` naming the **primary** pane — the one\n * whose size the value reports — and `Enter` to toggle collapse/restore, since\n * collapsing applies a position — {@link ResizableController} implements that\n * key for the same divider. Because the increment direction is fixed, the\n * primary pane can only be the left one for a vertical splitter and the bottom\n * one for a horizontal splitter: those are the panes that grow as\n * ArrowRight/ArrowUp raise the value.\n */\nexport class SeparatorController extends Controller<HTMLElement> {\n static override values = {\n orientation: { type: String, default: \"horizontal\" },\n focusable: { type: Boolean, default: false },\n min: { type: Number, default: DEFAULT_MIN },\n max: { type: Number, default: DEFAULT_MAX },\n step: { type: Number, default: 1 },\n value: { type: Number, default: DEFAULT_MIN },\n };\n static actions = [\"onKeydown\"] as const;\n static events = [\"change\"] as const;\n\n declare orientationValue: string;\n declare focusableValue: boolean;\n declare minValue: number;\n declare maxValue: number;\n declare stepValue: number;\n declare valueValue: number;\n\n readonly #role = new AttributeLease<HTMLElement>(\"role\");\n readonly #tabindex = new AttributeLease<HTMLElement>(\"tabindex\");\n readonly #orientation = new AttributeLease<HTMLElement>(\"aria-orientation\");\n readonly #minimum = new AttributeLease<HTMLElement>(\"aria-valuemin\");\n readonly #maximum = new AttributeLease<HTMLElement>(\"aria-valuemax\");\n readonly #current = new AttributeLease<HTMLElement>(\"aria-valuenow\");\n\n /** Collapses a morph that changes several render Values into one silent repaint. */\n readonly #repaint = new MicrotaskCoalescer(() => this.#render());\n\n /** Restores authored semantics before Turbo snapshots the element. */\n readonly #beforeCache = new BeforeCacheReset(() => this.#rewindForCache());\n\n /** Hydrates legacy ARIA input once, normalizes the current Value, and renders. */\n override connect(): void {\n this.#hydrateValues();\n this.#repaint.activate();\n this.#beforeCache.activate();\n const value = this.#currentValue();\n if (!Object.is(this.valueValue, value)) this.valueValue = value;\n this.#render();\n }\n\n /** Cancels repaint work and returns every semantic attribute this instance controlled. */\n override disconnect(): void {\n this.#repaint.cancel();\n this.#beforeCache.deactivate();\n this.#returnAttributes();\n }\n\n /** Silently repaints an orientation changed by application code or a Turbo morph. */\n orientationValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Silently adds or removes the focusable range semantics at runtime. */\n focusableValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Silently repaints a minimum changed by application code or a Turbo morph. */\n minValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Silently repaints a maximum changed by application code or a Turbo morph. */\n maxValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Silently repaints a step changed by application code or a Turbo morph. */\n stepValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Silently repaints a current value changed by application code or a Turbo morph. */\n valueValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Adjusts the value on arrow / Home / End keys (focusable variant only). */\n onKeydown(event: KeyboardEvent): void {\n if (isReservedArrowChord(event) || !this.focusableValue) return;\n\n const horizontal = this.#effectiveOrientation === \"horizontal\";\n const range = this.#effectiveRange;\n const current = snapSteppedValue(this.valueValue, range);\n let next: number | null = null;\n switch (event.key) {\n case \"ArrowUp\":\n if (horizontal) next = stepSteppedValue(current, 1, range);\n break;\n case \"ArrowDown\":\n if (horizontal) next = stepSteppedValue(current, -1, range);\n break;\n case \"ArrowRight\":\n if (!horizontal) next = stepSteppedValue(current, 1, range);\n break;\n case \"ArrowLeft\":\n if (!horizontal) next = stepSteppedValue(current, -1, range);\n break;\n case \"Home\":\n next = range.min;\n break;\n case \"End\":\n next = range.max;\n break;\n default:\n return;\n }\n if (next === null) return;\n\n event.preventDefault();\n this.#commit(next, current);\n }\n\n /** Stores a normalized user value, renders immediately, and reports real changes. */\n #commit(raw: number, previous: number): void {\n const value = snapSteppedValue(raw, this.#effectiveRange);\n if (!Object.is(this.valueValue, value)) this.valueValue = value;\n this.#render();\n if (value !== previous) this.dispatch(\"change\", { detail: { value } });\n }\n\n /**\n * Reflects live Values into the connected element without dispatching.\n *\n * @stimeoRenderRoot\n */\n #render(): void {\n const range = this.#effectiveRange;\n const value = snapSteppedValue(this.valueValue, range);\n this.#role.write(this.element, \"separator\");\n this.#orientation.write(this.element, this.#effectiveOrientation);\n\n if (!this.focusableValue) {\n this.#tabindex.write(this.element, null);\n this.#minimum.write(this.element, null);\n this.#maximum.write(this.element, null);\n this.#current.write(this.element, null);\n return;\n }\n\n this.#tabindex.write(this.element, \"0\");\n this.#minimum.write(this.element, String(range.min));\n this.#maximum.write(this.element, String(range.max));\n this.#current.write(this.element, String(value));\n }\n\n /** Effective orientation; unknown strings fall back to the horizontal contract. */\n get #effectiveOrientation(): \"horizontal\" | \"vertical\" {\n return this.orientationValue === \"vertical\" ? \"vertical\" : \"horizontal\";\n }\n\n /** Finite, ordered range shared by rendering and keyboard stepping. */\n get #effectiveRange(): SteppedRange {\n const min = Number.isFinite(this.minValue) ? this.minValue : DEFAULT_MIN;\n const candidateMax = Number.isFinite(this.maxValue) ? this.maxValue : DEFAULT_MAX;\n return {\n min,\n max: Math.max(min, candidateMax),\n step: this.stepValue,\n base: min,\n };\n }\n\n /** Current normalized value derived from the live declarative inputs. */\n #currentValue(): number {\n return snapSteppedValue(this.valueValue, this.#effectiveRange);\n }\n\n /** Copies valid authored ARIA into Values only when no explicit Value exists. */\n #hydrateValues(): void {\n if (!this.#hasInput(\"orientation\")) {\n const orientation = this.element.getAttribute(\"aria-orientation\");\n if (orientation === \"horizontal\" || orientation === \"vertical\") {\n this.orientationValue = orientation;\n }\n }\n\n const min = this.#finiteAttribute(\"aria-valuemin\");\n if (!this.#hasInput(\"min\") && min !== null) this.minValue = min;\n const max = this.#finiteAttribute(\"aria-valuemax\");\n if (!this.#hasInput(\"max\") && max !== null) this.maxValue = max;\n const value = this.#finiteAttribute(\"aria-valuenow\");\n if (!this.#hasInput(\"value\") && value !== null) this.valueValue = value;\n }\n\n /** Whether the author supplied the namespaced Value instead of using its default. */\n #hasInput(name: \"orientation\" | \"min\" | \"max\" | \"value\"): boolean {\n return this.element.hasAttribute(`data-${this.identifier}-${name}-value`);\n }\n\n /** Strict finite-number parser for the one-time progressive-enhancement bridge. */\n #finiteAttribute(name: string): number | null {\n const raw = this.element.getAttribute(name);\n if (raw === null || raw.trim() === \"\") return null;\n const value = Number(raw);\n return Number.isFinite(value) ? value : null;\n }\n\n /** Returns attributes without overwriting values a consumer changed after render. */\n #returnAttributes(): void {\n this.#role.return(this.element);\n this.#tabindex.return(this.element);\n this.#orientation.return(this.element);\n this.#minimum.return(this.element);\n this.#maximum.return(this.element);\n this.#current.return(this.element);\n }\n\n /** Prevents a queued Value repaint from racing Turbo's restored snapshot. */\n #rewindForCache(): void {\n this.#repaint.cancel();\n this.#returnAttributes();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/arrow_step.ts","../../src/utils/attribute_lease.ts","../../src/utils/before_cache_reset.ts","../../src/utils/microtask_coalescer.ts","../../src/utils/stepped_value.ts","../../src/controllers/separator_controller.ts"],"names":["position"],"mappings":";;;;;AA+FO,SAAS,oBAAA,CACd,KAAA,EACA,KAAA,GAAkC,EAAC,EAC1B;AACT,EAAA,IAAI,CAAC,KAAA,CAAM,GAAA,CAAI,UAAA,CAAW,OAAO,GAAG,OAAO,KAAA;AAC3C,EAAA,OACG,KAAA,CAAM,MAAA,IAAU,CAAC,KAAA,CAAM,QAAA,CAAS,KAAK,CAAA,IACrC,KAAA,CAAM,OAAA,IAAW,CAAC,KAAA,CAAM,QAAA,CAAS,MAAM,KACvC,KAAA,CAAM,OAAA,IAAW,CAAC,KAAA,CAAM,QAAA,CAAS,MAAM,CAAA,IACvC,KAAA,CAAM,QAAA,IAAY,CAAC,KAAA,CAAM,QAAA,CAAS,OAAO,CAAA;AAE9C;;;AClFO,IAAM,iBAAN,MAAkD;AAAA,EAC9C,UAAA;AAAA,EACA,QAAA,uBAAe,GAAA,EAA6B;AAAA;AAAA,EAGrD,YAAY,SAAA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AA,CAAO,IAAA,CAAK,OAAO,CAAA;AAClC,IAAA,IAAA,CAAK,YAAA,CAAa,MAAA,CAAO,IAAA,CAAK,OAAO,CAAA;AACrC,IAAA,IAAA,CAAK,QAAA,CAAS,MAAA,CAAO,IAAA,CAAK,OAAO,CAAA;AACjC,IAAA,IAAA,CAAK,QAAA,CAAS,MAAA,CAAO,IAAA,CAAK,OAAO,CAAA;AACjC,IAAA,IAAA,CAAK,QAAA,CAAS,MAAA,CAAO,IAAA,CAAK,OAAO,CAAA;AAAA,EACnC;AAAA;AAAA,EAGA,eAAA,GAAwB;AACtB,IAAA,IAAA,CAAK,SAAS,MAAA,EAAO;AACrB,IAAA,IAAA,CAAK,iBAAA,EAAkB;AAAA,EACzB;AACF","file":"separator_controller.js","sourcesContent":["import { isRtl } from \"./logical_scroll\";\n\n/**\n * Turns an arrow key into a **logical** step: `+1` for \"next\", `-1` for\n * \"previous\", `0` when the key names neither.\n *\n * APG defines the horizontal pair as *next / previous* and says a vertical\n * arrangement swaps in Down/Up for the same meaning — so the pair is one axis's\n * spelling of an order, and the order reverses with the writing direction. Only\n * the horizontal pair reverses. Down/Up name an axis the writing direction does\n * not mirror, and returning them unchanged is the point: many controllers fold\n * both pairs into one branch, where swapping the branches under RTL would flip\n * the vertical axis too — a bug that reads as \"the arrows work\" until someone\n * presses Down.\n *\n * **Direction is read from the element the caller passes, which should be the\n * container that lays the items out** — not the focused child. A child may carry\n * its own `dir` (an LTR input inside an RTL form is ordinary authoring), and\n * probing per handler makes two handlers disagree at the boundary between them.\n *\n * This decides direction only. Whether the axis is even active (an\n * `orientation=\"horizontal\"` widget ignoring Down/Up), how far the step lands,\n * and what wrapping does all stay with the caller.\n *\n * **It encodes the list-order convention: `ArrowDown` is *next*.** Widgets that\n * pair the arrows by *value* instead — `ArrowUp` meaning \"more\", as a rating or a\n * slider does — must not use this, or their vertical axis inverts. Reverse the\n * horizontal pair on its own there.\n *\n * @example\n * ```ts\n * const step = logicalArrowStep(event.key, this.element);\n * if (step === 0) return;\n * this.#roving.setActive(rovingMove(current, length, step, \"wrap\"), { focus: true });\n * ```\n */\nexport function logicalArrowStep(key: string, element: Element): 1 | -1 | 0 {\n if (key === \"ArrowDown\") return 1;\n if (key === \"ArrowUp\") return -1;\n if (key !== \"ArrowRight\" && key !== \"ArrowLeft\") return 0;\n const forward = isRtl(element) ? \"ArrowLeft\" : \"ArrowRight\";\n return key === forward ? 1 : -1;\n}\n\n/**\n * Rewrites `key` so an existing LTR-shaped branch keeps working under RTL:\n * `ArrowRight` and `ArrowLeft` trade places, everything else passes through.\n *\n * The alternative — negating a delta — silently breaks handlers whose two\n * horizontal branches are **not mirror images**. A grid that clamps one edge but\n * not the other, or a segmented field guarding `index > 0` on one side and\n * `index < length - 1` on the other, ends up applying the wrong guard to the\n * wrong direction. Swapping the key leaves each branch, guards and all, exactly\n * where its author put it.\n *\n * Same rule as {@link logicalArrowStep} about which element to read: pass the\n * container that lays the items out, not the focused child.\n *\n * @example\n * ```ts\n * switch (logicalArrowKey(event.key, this.element)) {\n * case \"ArrowLeft\": // \"previous\" — whatever direction that is on screen\n * ```\n */\nexport function logicalArrowKey(key: string, element: Element): string {\n if (key !== \"ArrowRight\" && key !== \"ArrowLeft\") return key;\n if (!isRtl(element)) return key;\n return key === \"ArrowRight\" ? \"ArrowLeft\" : \"ArrowRight\";\n}\n\n/** Modifiers a widget may claim on an arrow key, named for the `allow` list. */\nexport type ArrowModifier = \"alt\" | \"ctrl\" | \"meta\" | \"shift\";\n\n/**\n * True when an arrow key arrived carrying a modifier the widget must leave to\n * the browser: return without calling `preventDefault()` and without moving any\n * state.\n *\n * A bare arrow belongs to the widget; a chorded one usually does not.\n * `Alt`/`Meta` plus a horizontal arrow is history back/forward on every desktop\n * browser, and a widget that swallows it makes the shortcut work or not\n * depending on where focus happens to sit — a coin-flip the user cannot see.\n *\n * `allow` is for the combinations APG assigns to a pattern **and the widget\n * actually implements** — today only Combobox's optional `Alt+Down`/`Alt+Up`.\n * Listing one the widget does not implement defeats the point: the chord then\n * runs the plain-arrow branch, which is exactly what this guard exists to stop.\n * Non-arrow keys return `false`, so chorded letters and\n * `Control+Home`/`Control+End` are untouched.\n *\n * @example\n * ```ts\n * if (isReservedArrowChord(event)) return;\n * ```\n */\nexport function isReservedArrowChord(\n event: KeyboardEvent,\n allow: readonly ArrowModifier[] = [],\n): boolean {\n if (!event.key.startsWith(\"Arrow\")) return false;\n return (\n (event.altKey && !allow.includes(\"alt\")) ||\n (event.ctrlKey && !allow.includes(\"ctrl\")) ||\n (event.metaKey && !allow.includes(\"meta\")) ||\n (event.shiftKey && !allow.includes(\"shift\"))\n );\n}\n\n/**\n * True when a press arrived carrying any modifier, for the keys the browser and\n * the OS own outright: return without calling `preventDefault()` and without\n * moving any state.\n *\n * `Control+Home` and `Control+End` jump the document to its ends, and a widget\n * that swallows them makes the shortcut work or not depending on where focus\n * happens to sit. {@link isReservedArrowChord} answers the same question for the\n * arrows, but returns `false` for every other key so that this one can decide.\n *\n * There is no `allow` list here on purpose. APG assigns no modifier chord to\n * `Home`/`End`, so a widget that wanted one would be claiming a combination the\n * pattern never gave it.\n *\n * @example\n * ```ts\n * case \"Home\":\n * case \"End\":\n * if (hasModifierChord(event)) return;\n * ```\n */\nexport function hasModifierChord(event: KeyboardEvent): boolean {\n return event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;\n}\n","/** One temporarily controlled attribute value and the authored value it displaced. */\ninterface AttributeLeaseRecord {\n readonly original: string | null;\n written: string | null;\n}\n\n/**\n * Temporarily controls one attribute across a changing set of elements.\n *\n * The first write remembers the authored value, including the distinction between\n * an absent attribute and an authored empty string. Returning a lease restores that\n * value only while the attribute still matches the controller's last write. If a\n * consumer changed it in the meantime, the consumer owns the new value and teardown\n * leaves it alone.\n *\n * A `null` write deliberately removes the attribute while retaining the lease. This\n * is useful for derived ARIA whose valid absence is itself controller state, such as\n * an unbounded `aria-valuemin` or a blank spinbutton's `aria-valuenow`.\n *\n * The lease has no lifecycle of its own, so it never subscribes to document events.\n * A consumer that must not let a derived value become the authored baseline of a\n * cached page returns its leases from its own `turbo:before-cache` rewind, where the\n * matching `disconnect()` also releases the subscription.\n */\nexport class AttributeLease<T extends Element = Element> {\n readonly #attribute: string;\n readonly #records = new Map<T, AttributeLeaseRecord>();\n\n /** @param attribute - The attribute whose temporary values this lease owns. */\n constructor(attribute: string) {\n this.#attribute = attribute;\n }\n\n /** Writes or removes the leased attribute while preserving its authored value. */\n write(element: T, value: string | null): void {\n const existing = this.#records.get(element);\n if (existing) {\n existing.written = value;\n } else {\n this.#records.set(element, {\n original: element.getAttribute(this.#attribute),\n written: value,\n });\n }\n\n this.#reflect(element, value);\n }\n\n /** Returns one lease without overwriting a value subsequently authored by a consumer. */\n return(element: T): void {\n const record = this.#records.get(element);\n if (!record) return;\n this.#records.delete(element);\n const stillOwned = element.getAttribute(this.#attribute) === record.written;\n if (stillOwned) this.#reflect(element, record.original);\n }\n\n /** Reflects only a real value transition, avoiding self-triggered mutation work. */\n #reflect(element: T, value: string | null): void {\n if (element.getAttribute(this.#attribute) === value) return;\n if (value === null) element.removeAttribute(this.#attribute);\n else element.setAttribute(this.#attribute, value);\n }\n\n /** Returns every outstanding lease using the same ownership check as {@link return}. */\n returnAll(): void {\n for (const element of Array.from(this.#records.keys())) this.return(element);\n }\n}\n","/**\n * Runs a controller's \"return to the initial state\" pass just before Turbo\n * caches the page.\n *\n * **`disconnect()` cannot do this job, for two independent reasons.** Turbo\n * queues the clone from this event rather than taking it here, and the body swap\n * that runs the controller's `disconnect()` is queued separately — so which of\n * the two lands first is not something a controller can rely on, and a rewind\n * written in `disconnect()` may reach only the DOM being thrown away. In the\n * other direction, `disconnect()` also fires on an in-page move (Stimulus tears\n * down and reconnects the same element), where rewinding would wipe a\n * legitimately in-progress interaction — a spinner mid-load would vanish. One\n * timing is unreliable, the other is too eager; `turbo:before-cache` is the only\n * point that is exactly \"the page is about to be frozen\".\n *\n * Scope is the subscription only: registering on `activate()`, unregistering on\n * `deactivate()`, and one shared document listener no matter how many instances\n * are live. *What* to return to its initial state — which `data-state`, which\n * `hidden`, which `aria-busy` — stays in the controller, because no two\n * consumers answer it the same way.\n *\n * **Rewind state, not appearance.** The pass writes attributes the controller\n * itself owns; the visual result of those attributes is the consumer's CSS, and\n * a library that reached for style or class names would be guessing at markup\n * it does not own.\n *\n * Both entry points are idempotent, so the lifecycle hooks can call them\n * unconditionally: a second `activate()` does not double-subscribe and does not\n * make the callback run twice, and `deactivate()` on an instance that never\n * subscribed is a no-op.\n *\n * This file's own doc block is dropped from `dist`, but every member comment is\n * inlined into each consumer entry (`tsup` builds with `splitting: false`), so\n * rationale belongs here and only the contract belongs on the members.\n *\n * @example\n * ```ts\n * readonly #beforeCache = new BeforeCacheReset(() => this.#rewind());\n *\n * connect() { this.#beforeCache.activate(); }\n * disconnect() { this.#beforeCache.deactivate(); }\n * ```\n */\nexport class BeforeCacheReset {\n /** Every subscribed instance, iterated by the one shared document listener. */\n static readonly #subscribers = new Set<BeforeCacheReset>();\n\n /** The shared listener; installed while at least one instance is subscribed. */\n static readonly #onBeforeCache = (): void => {\n for (const subscriber of BeforeCacheReset.#subscribers) subscriber.#rewind();\n };\n\n readonly #rewind: () => void;\n\n /** @param rewind - the pass that returns this controller's state to its initial form. */\n constructor(rewind: () => void) {\n this.#rewind = rewind;\n }\n\n /** Subscribes to `turbo:before-cache`; call from `connect()`. Idempotent. */\n activate(): void {\n const first = BeforeCacheReset.#subscribers.size === 0;\n BeforeCacheReset.#subscribers.add(this);\n if (first) {\n document.addEventListener(\"turbo:before-cache\", BeforeCacheReset.#onBeforeCache);\n }\n }\n\n /** Unsubscribes; call from `disconnect()`. Safe when never subscribed. */\n deactivate(): void {\n BeforeCacheReset.#subscribers.delete(this);\n if (BeforeCacheReset.#subscribers.size > 0) return;\n document.removeEventListener(\"turbo:before-cache\", BeforeCacheReset.#onBeforeCache);\n }\n}\n","/**\n * Collapses many Stimulus lifecycle callbacks from one DOM mutation into a\n * single pass.\n *\n * Stimulus fires `<name>TargetConnected` / `Disconnected` once per element and\n * `<name>ValueChanged` once per changed attribute. Replacing a list of N options\n * or morphing several render Values therefore delivers N callbacks — but the\n * useful unit of work is \"reconcile against the resulting declarative input\",\n * once, after the batch has settled. Every controller with reconcilable targets\n * or render Values needs the same shape: a `queued` flag plus `queueMicrotask`.\n *\n * **A microtask is the right horizon, and the reason is specific.** Stimulus\n * drives these callbacks from a `MutationObserver`, whose own callback already\n * runs as a microtask with the whole batch in hand; scheduling one more lands\n * after the last sibling callback of that batch and still before paint or any\n * event handler. A timer would be later than it needs to be, and reconciling\n * synchronously would run once per element against a half-applied DOM.\n *\n * **The two guards are not the same guard.** Scheduling is refused before the\n * controller connects, and running is refused after it disconnects:\n *\n * - **Before `connect()`** — Stimulus delivers initial target and Value callbacks\n * ahead of `connect()`. Reconciling there would compute output against a\n * controller whose own state has not been initialised, and `connect()` is\n * about to do a full pass anyway.\n * - **After `disconnect()`** — Stimulus fires a callback for **every** target\n * during teardown, and a microtask queued just before it would otherwise run\n * against a detached tree. {@link MicrotaskCoalescer.cancel} exists for the\n * teardown path to drop the pending pass outright.\n *\n * Both guards are part of one contract here rather than something each consumer\n * has to remember separately.\n *\n * Scope is the scheduling only. *What* to reconcile — keep the surviving active\n * option, fall back to the next / previous / first visible one, rebuild derived\n * chips or hidden fields — stays in the controller, because no two consumers\n * answer it the same way.\n *\n * This file's own doc block is dropped from `dist`, but every member comment is\n * inlined into each consumer entry (`tsup` builds with `splitting: false`), so\n * rationale belongs here and only the contract belongs on the members.\n *\n * @example\n * ```ts\n * readonly #reconcile = new MicrotaskCoalescer(() => this.#reconcileOptions());\n *\n * connect() { this.#reconcile.activate(); }\n * disconnect() { this.#reconcile.cancel(); }\n *\n * optionTargetConnected() { this.#reconcile.schedule(); }\n * optionTargetDisconnected() { this.#reconcile.schedule(); }\n * ```\n */\nexport class MicrotaskCoalescer {\n readonly #run: () => void;\n #queued = false;\n #active = false;\n #generation = 0;\n\n /** @param run - the single reconciliation pass, invoked at most once per batch. */\n constructor(run: () => void) {\n this.#run = run;\n }\n\n /** Opens the window in which {@link schedule} is honoured; call from `connect()`. */\n activate(): void {\n this.#active = true;\n }\n\n /** Closes the window and drops any pending pass; call from `disconnect()`. */\n cancel(): void {\n this.#active = false;\n this.#queued = false;\n this.#generation += 1;\n }\n\n /** Requests one pass after the batch settles. Idempotent; inert outside the window. */\n schedule(): void {\n if (!this.#active || this.#queued) return;\n this.#queued = true;\n const generation = this.#generation;\n queueMicrotask(() => {\n // A cancelled callback must not consume a pass queued after reconnect.\n if (generation !== this.#generation || !this.#queued || !this.#active) return;\n this.#queued = false;\n this.#run();\n });\n }\n}\n","/** Configuration for a value constrained to a stepped numeric range. */\nexport interface SteppedRange {\n /** Inclusive lower endpoint. May be infinite for an unbounded control. */\n readonly min: number;\n /** Inclusive upper endpoint. May be infinite for an unbounded control. */\n readonly max: number;\n /** Requested step. Non-finite and non-positive values fall back to `1`. */\n readonly step: number;\n /** Step-grid origin. Defaults to a finite `min`, otherwise `0`. */\n readonly base?: number;\n}\n\n/** The positive finite step used at runtime and by keyboard stepping. */\nexport function effectiveStep(step: number): number {\n return Number.isFinite(step) && step > 0 ? step : 1;\n}\n\n/**\n * Clamps a raw value and selects its nearest allowed value.\n *\n * The allowed set is the step grid plus each finite range endpoint. Keeping the\n * endpoints in that set makes an authored `aria-valuemin`/`aria-valuemax`\n * truthful even when the upper endpoint is not aligned to the grid. A value\n * exactly between two allowed values resolves upward.\n */\nexport function snapSteppedValue(raw: number, range: SteppedRange): number {\n if (!(range.min <= range.max)) return finiteFallback(range.min, range.max);\n\n const input = Number.isNaN(raw) ? finiteFallback(range.min, range.max) : raw;\n const clamped = Math.min(range.max, Math.max(range.min, input));\n const step = effectiveStep(range.step);\n const base = stepBase(range);\n const candidates: number[] = [];\n\n if (Number.isFinite(range.min)) candidates.push(range.min);\n if (Number.isFinite(range.max)) candidates.push(range.max);\n\n const gridPosition = (clamped - base) / step;\n if (Number.isFinite(gridPosition)) {\n addGridCandidate(candidates, Math.floor(gridPosition), range, base, step);\n addGridCandidate(candidates, Math.ceil(gridPosition), range, base, step);\n }\n\n if (candidates.length === 0) return clamped;\n let nearest = candidates[0] as number;\n let nearestDistance = Math.abs(clamped - nearest);\n for (const candidate of candidates.slice(1)) {\n const distance = Math.abs(clamped - candidate);\n if (\n distance < nearestDistance ||\n (nearlyEqual(distance, nearestDistance) && candidate > nearest)\n ) {\n nearest = candidate;\n nearestDistance = distance;\n }\n }\n return nearest;\n}\n\n/**\n * Moves through the ordered allowed-value set by an integer number of steps.\n *\n * This differs from adding `step * count` and snapping afterward at an\n * off-grid endpoint: with `max=94, step=10`, one decrement from `94` must land\n * on `90`, and one increment from `90` must reach the advertised maximum `94`.\n */\nexport function stepSteppedValue(current: number, count: number, range: SteppedRange): number {\n const value = snapSteppedValue(current, range);\n const distance = Math.abs(Math.trunc(count));\n if (!Number.isFinite(distance) || distance === 0) return value;\n const direction = Math.sign(count);\n const adjacent = adjacentSteppedValue(value, direction, range);\n\n // The first move accounts for a possibly off-grid endpoint. From there a\n // direct grid jump is equivalent to repeated adjacency, and avoids work that\n // grows with Page-step magnitudes or programmatic counts.\n const raw = adjacent + direction * (distance - 1) * effectiveStep(range.step);\n return snapSteppedValue(raw, range);\n}\n\n/** Returns the next member of the ordered endpoint-plus-grid set. */\nfunction adjacentSteppedValue(current: number, direction: number, range: SteppedRange): number {\n const step = effectiveStep(range.step);\n const base = stepBase(range);\n const candidates: number[] = [];\n\n if (direction > 0) {\n const position = (current - base) / step;\n if (Number.isFinite(position)) {\n let gridIndex = Math.floor(position) + 1;\n let candidate = cleanGridValue(base + gridIndex * step, base, step);\n if (candidate < current || nearlyEqual(candidate, current)) {\n gridIndex += 1;\n candidate = cleanGridValue(base + gridIndex * step, base, step);\n }\n if (\n candidate > current &&\n !nearlyEqual(candidate, current) &&\n within(candidate, range.min, range.max)\n ) {\n candidates.push(clamp(candidate, range));\n }\n }\n return clamp(Math.min(...candidates), range);\n }\n\n const position = (current - base) / step;\n if (Number.isFinite(position)) {\n let gridIndex = Math.ceil(position) - 1;\n let candidate = cleanGridValue(base + gridIndex * step, base, step);\n if (candidate > current || nearlyEqual(candidate, current)) {\n gridIndex -= 1;\n candidate = cleanGridValue(base + gridIndex * step, base, step);\n }\n if (\n candidate < current &&\n !nearlyEqual(candidate, current) &&\n within(candidate, range.min, range.max)\n ) {\n candidates.push(clamp(candidate, range));\n }\n }\n return clamp(Math.max(...candidates), range);\n}\n\n/** Adds one grid value when it falls inside the inclusive range. */\nfunction addGridCandidate(\n candidates: number[],\n index: number,\n range: SteppedRange,\n base: number,\n step: number,\n): void {\n const candidate = cleanGridValue(base + index * step, base, step);\n if (within(candidate, range.min, range.max)) candidates.push(clamp(candidate, range));\n}\n\n/** A finite authored base wins; otherwise the finite lower bound or zero does. */\nfunction stepBase(range: SteppedRange): number {\n if (range.base !== undefined && Number.isFinite(range.base)) return range.base;\n return Number.isFinite(range.min) ? range.min : 0;\n}\n\n/** Removes binary noise without discarding significant integer-place digits. */\nfunction cleanGridValue(value: number, base: number, step: number): number {\n const precision = Math.max(decimalPlaces(base), decimalPlaces(step));\n // `toFixed` accepts at most 100 fractional digits. Below that limit it rounds\n // according to the authored grid precision rather than an arbitrary total\n // significant-digit count, which keeps unit steps distinct at large bases.\n return precision <= 100 ? Number(value.toFixed(precision)) : value;\n}\n\n/** Number of fractional decimal places represented by a finite JS number. */\nfunction decimalPlaces(value: number): number {\n const [coefficient = \"\", exponentText] = Math.abs(value).toString().toLowerCase().split(\"e\");\n const fractionLength = coefficient.split(\".\")[1]?.length ?? 0;\n const exponent = exponentText === undefined ? 0 : Number(exponentText);\n return Math.max(0, fractionLength - exponent);\n}\n\n/** Inclusive range check tolerant only of arithmetic noise at an endpoint. */\nfunction within(value: number, min: number, max: number): boolean {\n return (value > min || nearlyEqual(value, min)) && (value < max || nearlyEqual(value, max));\n}\n\n/** Clamps a candidate whose only overshoot may be floating-point noise. */\nfunction clamp(value: number, range: SteppedRange): number {\n return Math.min(range.max, Math.max(range.min, value));\n}\n\n/** Relative comparison used only to collapse arithmetic noise, not real steps. */\nfunction nearlyEqual(left: number, right: number): boolean {\n const scale = Math.max(Math.abs(left), Math.abs(right));\n return (\n Number.isFinite(left) &&\n Number.isFinite(right) &&\n Math.abs(left - right) <= Number.EPSILON * scale\n );\n}\n\n/** Stable fallback for malformed ranges or `NaN` input. */\nfunction finiteFallback(min: number, max: number): number {\n if (Number.isFinite(min)) return min;\n if (Number.isFinite(max)) return max;\n return 0;\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport { isReservedArrowChord } from \"../utils/arrow_step\";\nimport { AttributeLease } from \"../utils/attribute_lease\";\nimport { BeforeCacheReset } from \"../utils/before_cache_reset\";\nimport { MicrotaskCoalescer } from \"../utils/microtask_coalescer\";\nimport { type SteppedRange, snapSteppedValue, stepSteppedValue } from \"../utils/stepped_value\";\n\nconst DEFAULT_MIN = 0;\nconst DEFAULT_MAX = 100;\n\n/**\n * Headless **Separator** behavior. The normative source depends on the case:\n * a decorative divider follows the WAI-ARIA `separator` role\n * (https://www.w3.org/TR/wai-aria-1.2/#separator), while the focusable,\n * value-bearing divider follows the APG Window Splitter pattern\n * (https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/).\n *\n * Markup contract (identifier: `stimeo--separator`):\n * <!-- decorative -->\n * <div data-controller=\"stimeo--separator\"\n * data-stimeo--separator-orientation-value=\"horizontal\"></div>\n *\n * <!-- focusable, value-bearing -->\n * <div data-controller=\"stimeo--separator\"\n * aria-labelledby=\"sidebar-heading\" aria-controls=\"sidebar\"\n * data-stimeo--separator-orientation-value=\"vertical\"\n * data-stimeo--separator-focusable-value=\"true\"\n * data-stimeo--separator-min-value=\"0\"\n * data-stimeo--separator-max-value=\"100\"\n * data-stimeo--separator-step-value=\"1\"\n * data-stimeo--separator-value-value=\"50\"\n * data-action=\"keydown->stimeo--separator#onKeydown\"></div>\n *\n * The Stimulus Values are the live inputs. The controller reflects them as\n * `role`, `tabindex`, `aria-orientation`, and the range ARIA while connected,\n * then restores the attributes it displaced on disconnect and before Turbo\n * caches the page. Existing finite range ARIA is hydrated into otherwise\n * absent Values once, which preserves progressively enhanced server markup\n * without leaving two live sources of truth. That fill is the one write\n * `connect()` makes to a Value: a declared Value is never overwritten, and the\n * normalized value is published through `aria-valuenow` without being written\n * back.\n *\n * `change` and `reconcile` dispatch `{ value: number }`.\n *\n * @remarks\n * Behavior only — line drawing is the consumer's CSS. The axis follows Window\n * Splitter: a vertical divider takes ArrowLeft/ArrowRight, a horizontal one\n * takes ArrowUp/ArrowDown. Which end counts as an increase is not defined\n * there, so it follows the slider convention (ArrowRight/ArrowUp increase).\n * Home/End are optional in the pattern and are implemented here; F6 is not.\n *\n * A maximum below the effective minimum collapses to that minimum; non-finite\n * bounds use `0`/`100`, and an invalid or non-positive step uses `1`. Finite\n * endpoints remain reachable even when they do not align to the step grid.\n * `change` reports a key the user pressed that left the value somewhere other\n * than the value last published. Runtime Value changes — a Turbo morph or\n * application code — repaint once per batch, and when they move the value a\n * focusable separator publishes, `reconcile` reports it with the same detail,\n * so a consumer can tell its user's move from the page's. A key handled before\n * a page write is repainted reads the written value, so its `change` covers the\n * write as well, and a key that ends on the value last published reports\n * nothing. A key dispatched from script runs every listener with no microtask\n * between them, so a write made just before it, or by a listener that runs\n * ahead of the separator, is handled that way. A key the browser dispatches\n * runs microtasks between the listeners it calls separately, so a write made\n * by one called ahead of the separator's — a capture listener on an ancestor or\n * on `document`, a `:capture` action, or a listener added to the separator\n * before its action was bound — is repainted, and reported as `reconcile`,\n * before the key is measured from it. Stimulus calls the actions an element\n * declares for one event and one set of listener options from a single\n * listener, in declaration order, so a write made by an action declared before\n * the separator's own is handled like a write within a key dispatched from\n * script. A decorative\n * separator publishes no value and reports nothing; one that becomes focusable\n * again reports a value that moved meanwhile. Connecting reports neither.\n *\n * Because no position is ever applied here, two Window Splitter requirements\n * fall to the consumer: `aria-controls` naming the **primary** pane — the one\n * whose size the value reports — and `Enter` to toggle collapse/restore, since\n * collapsing applies a position — {@link ResizableController} implements that\n * key for the same divider. Because the increment direction is fixed, the\n * primary pane can only be the left one for a vertical splitter and the bottom\n * one for a horizontal splitter: those are the panes that grow as\n * ArrowRight/ArrowUp raise the value.\n */\nexport class SeparatorController extends Controller<HTMLElement> {\n static override values = {\n orientation: { type: String, default: \"horizontal\" },\n focusable: { type: Boolean, default: false },\n min: { type: Number, default: DEFAULT_MIN },\n max: { type: Number, default: DEFAULT_MAX },\n step: { type: Number, default: 1 },\n value: { type: Number, default: DEFAULT_MIN },\n };\n static actions = [\"onKeydown\"] as const;\n static events = [\"change\", \"reconcile\"] as const;\n\n declare orientationValue: string;\n declare focusableValue: boolean;\n declare minValue: number;\n declare maxValue: number;\n declare stepValue: number;\n declare valueValue: number;\n\n readonly #role = new AttributeLease<HTMLElement>(\"role\");\n readonly #tabindex = new AttributeLease<HTMLElement>(\"tabindex\");\n readonly #orientation = new AttributeLease<HTMLElement>(\"aria-orientation\");\n readonly #minimum = new AttributeLease<HTMLElement>(\"aria-valuemin\");\n readonly #maximum = new AttributeLease<HTMLElement>(\"aria-valuemax\");\n readonly #current = new AttributeLease<HTMLElement>(\"aria-valuenow\");\n\n /** Collapses a morph that changes several render Values into one repaint. */\n readonly #repaint = new MicrotaskCoalescer(() => this.#render());\n\n /** Restores authored semantics before Turbo snapshots the element. */\n readonly #beforeCache = new BeforeCacheReset(() => this.#rewindForCache());\n\n /**\n * The baseline a published value is compared with: the value last published\n * through `aria-valuenow`, or `null` while this connection has published none.\n * It moves to each value a key the user presses or a repaint publishes. While\n * nothing is published — the separator is decorative — it keeps the last\n * value published, so a value that moved meanwhile is reported once when the\n * separator publishes again; one that connected decorative keeps `null`, so\n * its first published value is only taken as the baseline.\n */\n #settled: number | null = null;\n\n /**\n * Hydrates authored range ARIA into absent Values once and renders them\n * without writing the normalized value back. What the first render publishes\n * is the baseline, so connecting reports nothing.\n */\n override connect(): void {\n this.#hydrateValues();\n this.#repaint.activate();\n this.#beforeCache.activate();\n this.#settled = null;\n this.#render();\n }\n\n /** Cancels repaint work and returns every semantic attribute this instance controlled. */\n override disconnect(): void {\n this.#repaint.cancel();\n this.#beforeCache.deactivate();\n this.#returnAttributes();\n }\n\n /** Repaints an orientation changed by application code or a Turbo morph. */\n orientationValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Adds or removes the focusable range semantics at runtime. */\n focusableValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Repaints a minimum changed by application code or a Turbo morph. */\n minValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Repaints a maximum changed by application code or a Turbo morph. */\n maxValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Repaints a step changed by application code or a Turbo morph. */\n stepValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Repaints a current value changed by application code or a Turbo morph. */\n valueValueChanged(): void {\n this.#repaint.schedule();\n }\n\n /** Adjusts the value on arrow / Home / End keys (focusable variant only). */\n onKeydown(event: KeyboardEvent): void {\n if (isReservedArrowChord(event) || !this.focusableValue) return;\n\n const horizontal = this.#effectiveOrientation === \"horizontal\";\n const range = this.#effectiveRange;\n // Stepping snaps the declaration onto the value it publishes before moving.\n const declared = this.valueValue;\n let next: number | null = null;\n switch (event.key) {\n case \"ArrowUp\":\n if (horizontal) next = stepSteppedValue(declared, 1, range);\n break;\n case \"ArrowDown\":\n if (horizontal) next = stepSteppedValue(declared, -1, range);\n break;\n case \"ArrowRight\":\n if (!horizontal) next = stepSteppedValue(declared, 1, range);\n break;\n case \"ArrowLeft\":\n if (!horizontal) next = stepSteppedValue(declared, -1, range);\n break;\n case \"Home\":\n next = range.min;\n break;\n case \"End\":\n next = range.max;\n break;\n default:\n return;\n }\n if (next === null) return;\n\n event.preventDefault();\n this.#commit(next);\n }\n\n /**\n * Stores a normalized user value, renders immediately, and reports it as\n * `change` when it differs from the value last published. The comparison is\n * with the value last published, not with the value the key started from, so\n * a page write no repaint has published yet is reported once, as this change,\n * and a key that ends where the value was last published reports nothing. The\n * baseline moves before the render and the report, so neither the repaint the\n * Value write schedules nor a move a subscriber makes while `change` is\n * dispatched is measured from the value this key replaced.\n */\n #commit(raw: number): void {\n const value = snapSteppedValue(raw, this.#effectiveRange);\n const reported = this.#settled;\n this.#settled = value;\n if (!Object.is(this.valueValue, value)) this.valueValue = value;\n this.#render();\n if (value !== reported) this.dispatch(\"change\", { detail: { value } });\n }\n\n /**\n * Reflects live Values into the connected element without writing them back,\n * then compares what it published with the baseline. A decorative separator\n * publishes no value (`null` here): the baseline stays the last value\n * published. A value is reported once as `reconcile` only when it moved from a\n * published baseline, so the first value a connection publishes is only taken\n * as the baseline.\n *\n * @stimeoRenderRoot\n */\n #render(): void {\n const range = this.#effectiveRange;\n const focusable = this.focusableValue;\n const published = focusable ? snapSteppedValue(this.valueValue, range) : null;\n this.#role.write(this.element, \"separator\");\n this.#orientation.write(this.element, this.#effectiveOrientation);\n this.#tabindex.write(this.element, focusable ? \"0\" : null);\n this.#minimum.write(this.element, focusable ? String(range.min) : null);\n this.#maximum.write(this.element, focusable ? String(range.max) : null);\n this.#current.write(this.element, published === null ? null : String(published));\n\n const previous = this.#settled;\n if (published !== null) this.#settled = published;\n if (previous !== null && published !== null && published !== previous) {\n this.dispatch(\"reconcile\", { detail: { value: published } });\n }\n }\n\n /** Effective orientation; unknown strings fall back to the horizontal contract. */\n get #effectiveOrientation(): \"horizontal\" | \"vertical\" {\n return this.orientationValue === \"vertical\" ? \"vertical\" : \"horizontal\";\n }\n\n /** Finite, ordered range shared by rendering and keyboard stepping. */\n get #effectiveRange(): SteppedRange {\n const min = Number.isFinite(this.minValue) ? this.minValue : DEFAULT_MIN;\n const candidateMax = Number.isFinite(this.maxValue) ? this.maxValue : DEFAULT_MAX;\n return {\n min,\n max: Math.max(min, candidateMax),\n step: this.stepValue,\n base: min,\n };\n }\n\n /**\n * Copies valid authored ARIA into Values only when no explicit Value exists.\n * This fill is the one Value write `connect()` makes: it never overwrites a\n * declaration, and no Value callback runs it, so a declaration the page\n * changes later is only ever read.\n */\n #hydrateValues(): void {\n if (!this.#hasInput(\"orientation\")) {\n const orientation = this.element.getAttribute(\"aria-orientation\");\n if (orientation === \"horizontal\" || orientation === \"vertical\") {\n this.orientationValue = orientation;\n }\n }\n\n const min = this.#finiteAttribute(\"aria-valuemin\");\n if (!this.#hasInput(\"min\") && min !== null) this.minValue = min;\n const max = this.#finiteAttribute(\"aria-valuemax\");\n if (!this.#hasInput(\"max\") && max !== null) this.maxValue = max;\n const value = this.#finiteAttribute(\"aria-valuenow\");\n if (!this.#hasInput(\"value\") && value !== null) this.valueValue = value;\n }\n\n /** Whether the author supplied the namespaced Value instead of using its default. */\n #hasInput(name: \"orientation\" | \"min\" | \"max\" | \"value\"): boolean {\n return this.element.hasAttribute(`data-${this.identifier}-${name}-value`);\n }\n\n /** Strict finite-number parser for the one-time progressive-enhancement bridge. */\n #finiteAttribute(name: string): number | null {\n const raw = this.element.getAttribute(name);\n if (raw === null || raw.trim() === \"\") return null;\n const value = Number(raw);\n return Number.isFinite(value) ? value : null;\n }\n\n /** Returns attributes without overwriting values a consumer changed after render. */\n #returnAttributes(): void {\n this.#role.return(this.element);\n this.#tabindex.return(this.element);\n this.#orientation.return(this.element);\n this.#minimum.return(this.element);\n this.#maximum.return(this.element);\n this.#current.return(this.element);\n }\n\n /** Prevents a queued Value repaint from racing Turbo's restored snapshot. */\n #rewindForCache(): void {\n this.#repaint.cancel();\n this.#returnAttributes();\n }\n}\n"]}
|
|
@@ -44,6 +44,22 @@ import { Controller } from '@hotwired/stimulus';
|
|
|
44
44
|
* The collapsed preference persists across Turbo navigations and full reloads;
|
|
45
45
|
* the transient overlay-open state never persists, so "back/forward" never
|
|
46
46
|
* restores a stuck-open menu.
|
|
47
|
+
*
|
|
48
|
+
* Each move of the panel's expanded state is reported: `stimeo--sidebar:open`
|
|
49
|
+
* and `stimeo--sidebar:close` dispatch
|
|
50
|
+
* `{ reason: StateReason, mode: "inline" | "overlay" }` — `mode` tells an
|
|
51
|
+
* inline expand/collapse from an overlay open/close — as soon as `data-state`
|
|
52
|
+
* and `aria-expanded` are written, without waiting for the exit transition. A
|
|
53
|
+
* responsive mode change re-derives the state instead of the user moving it, so
|
|
54
|
+
* it reports `stimeo--sidebar:reconcile` with
|
|
55
|
+
* `{ mode: "inline" | "overlay", open: boolean }` and no reason. All three are
|
|
56
|
+
* informational, so none is cancelable. A call that leaves the state where it
|
|
57
|
+
* already was, the normalization in {@link connect}, the reconciliation that
|
|
58
|
+
* follows panel churn, the `turbo:before-cache` sanitization, and
|
|
59
|
+
* {@link disconnect} are all silent. A close the backdrop asked for reports
|
|
60
|
+
* `"outside"`: the backdrop carries no action of its own, so
|
|
61
|
+
* {@link SidebarController.close | close} is what the consumer wires onto it and it
|
|
62
|
+
* recognises that target.
|
|
47
63
|
*/
|
|
48
64
|
declare class SidebarController extends Controller<HTMLElement> {
|
|
49
65
|
#private;
|
|
@@ -63,6 +79,7 @@ declare class SidebarController extends Controller<HTMLElement> {
|
|
|
63
79
|
};
|
|
64
80
|
};
|
|
65
81
|
static actions: readonly ["close", "open", "toggle"];
|
|
82
|
+
static events: readonly ["close", "open", "reconcile"];
|
|
66
83
|
readonly triggerTarget: HTMLElement;
|
|
67
84
|
readonly panelTarget: HTMLElement;
|
|
68
85
|
readonly backdropTarget: HTMLElement;
|
|
@@ -87,11 +104,11 @@ declare class SidebarController extends Controller<HTMLElement> {
|
|
|
87
104
|
*/
|
|
88
105
|
breakpointValueChanged(): void;
|
|
89
106
|
/** Toggles the panel: inline flips collapsed/expanded, overlay flips open/closed. */
|
|
90
|
-
toggle(): void;
|
|
107
|
+
toggle(event?: Event): void;
|
|
91
108
|
/** Shows the panel (inline: expand; overlay: open). */
|
|
92
|
-
open(): void;
|
|
109
|
+
open(event?: Event): void;
|
|
93
110
|
/** Hides the panel (inline: collapse; overlay: close). */
|
|
94
|
-
close(): void;
|
|
111
|
+
close(event?: Event): void;
|
|
95
112
|
}
|
|
96
113
|
|
|
97
114
|
export { SidebarController };
|
|
@@ -382,6 +382,16 @@ function writeLocalStorage(key, value) {
|
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
+
// src/utils/state_reason.ts
|
|
386
|
+
var FOCUS_EVENTS = /* @__PURE__ */ new Set(["blur", "focus", "focusin", "focusout"]);
|
|
387
|
+
var POINTER_EVENTS = /* @__PURE__ */ new Set(["mouseenter", "mouseleave", "pointerenter", "pointerleave"]);
|
|
388
|
+
function stateReasonFor(event) {
|
|
389
|
+
if (!event) return "api";
|
|
390
|
+
if (FOCUS_EVENTS.has(event.type)) return "focus";
|
|
391
|
+
if (POINTER_EVENTS.has(event.type)) return "pointer";
|
|
392
|
+
return "user";
|
|
393
|
+
}
|
|
394
|
+
|
|
385
395
|
// src/utils/safe_timeout.ts
|
|
386
396
|
var TimerRegistry = class {
|
|
387
397
|
/** Live timer ids that have not yet been cleared (or, for timeouts, fired). */
|
|
@@ -585,11 +595,12 @@ var SidebarController = class extends Controller {
|
|
|
585
595
|
collapsed: { type: Boolean, default: false }
|
|
586
596
|
};
|
|
587
597
|
static actions = ["close", "open", "toggle"];
|
|
598
|
+
static events = ["close", "open", "reconcile"];
|
|
588
599
|
/** Exact panel currently owned by the modal lifecycle (survives target churn safely). */
|
|
589
600
|
#activePanel = null;
|
|
590
601
|
/** Owns the overlay modal side effects; Escape closes, focus falls to trigger. */
|
|
591
602
|
#trap = new FocusTrap(() => this.#activePanel ?? this.panelTarget, {
|
|
592
|
-
onEscape: () => this
|
|
603
|
+
onEscape: () => this.#closeOverlay("escape"),
|
|
593
604
|
fallbackFocus: () => this.hasTriggerTarget ? this.triggerTarget : null
|
|
594
605
|
});
|
|
595
606
|
/** Current responsive mode. */
|
|
@@ -604,6 +615,8 @@ var SidebarController = class extends Controller {
|
|
|
604
615
|
#transition = new TransitionCompletion();
|
|
605
616
|
/** Distinguishes dynamic target churn from callbacks around controller teardown. */
|
|
606
617
|
#connected = false;
|
|
618
|
+
/** Whether state moves are reported: set once `connect()` settled the baseline. */
|
|
619
|
+
#reporting = false;
|
|
607
620
|
connect() {
|
|
608
621
|
this.#connected = true;
|
|
609
622
|
this.#beforeCache.activate();
|
|
@@ -612,10 +625,12 @@ var SidebarController = class extends Controller {
|
|
|
612
625
|
this.#mqlQuery = this.#breakpointQuery;
|
|
613
626
|
this.#mql = this.#matchBreakpoint(this.#mqlQuery);
|
|
614
627
|
this.#mql?.addEventListener("change", this.#onMediaChange);
|
|
615
|
-
this.#applyMode(this.#computeMode());
|
|
628
|
+
this.#applyMode(this.#computeMode(), false);
|
|
629
|
+
this.#reporting = true;
|
|
616
630
|
}
|
|
617
631
|
disconnect() {
|
|
618
632
|
this.#connected = false;
|
|
633
|
+
this.#reporting = false;
|
|
619
634
|
this.#beforeCache.deactivate();
|
|
620
635
|
this.#mql?.removeEventListener("change", this.#onMediaChange);
|
|
621
636
|
this.#mql = null;
|
|
@@ -658,7 +673,7 @@ var SidebarController = class extends Controller {
|
|
|
658
673
|
this.#mql = this.#matchBreakpoint(query);
|
|
659
674
|
this.#mql?.addEventListener("change", this.#onMediaChange);
|
|
660
675
|
const next = this.#computeMode();
|
|
661
|
-
if (next !== this.#mode) this.#applyMode(next);
|
|
676
|
+
if (next !== this.#mode) this.#applyMode(next, true);
|
|
662
677
|
}
|
|
663
678
|
/**
|
|
664
679
|
* Sanitizes overlay markup before Turbo snapshots the page.
|
|
@@ -675,26 +690,44 @@ var SidebarController = class extends Controller {
|
|
|
675
690
|
this.#setOverlayClosedImmediate();
|
|
676
691
|
});
|
|
677
692
|
/** Toggles the panel: inline flips collapsed/expanded, overlay flips open/closed. */
|
|
678
|
-
toggle() {
|
|
693
|
+
toggle(event) {
|
|
694
|
+
const reason = stateReasonFor(event);
|
|
679
695
|
if (this.#isOverlay) {
|
|
680
|
-
this.#isOverlayOpen ? this.#closeOverlay() : this.#openOverlay();
|
|
696
|
+
this.#isOverlayOpen ? this.#closeOverlay(reason) : this.#openOverlay(reason);
|
|
681
697
|
} else {
|
|
682
|
-
this.#setCollapsed(!this.#collapsed);
|
|
698
|
+
this.#setCollapsed(!this.#collapsed, reason);
|
|
683
699
|
}
|
|
684
700
|
}
|
|
685
701
|
/** Shows the panel (inline: expand; overlay: open). */
|
|
686
|
-
open() {
|
|
687
|
-
|
|
688
|
-
|
|
702
|
+
open(event) {
|
|
703
|
+
const reason = stateReasonFor(event);
|
|
704
|
+
if (this.#isOverlay) this.#openOverlay(reason);
|
|
705
|
+
else this.#setCollapsed(false, reason);
|
|
689
706
|
}
|
|
690
707
|
/** Hides the panel (inline: collapse; overlay: close). */
|
|
691
|
-
close() {
|
|
692
|
-
|
|
693
|
-
|
|
708
|
+
close(event) {
|
|
709
|
+
const reason = this.#closeReason(event);
|
|
710
|
+
if (this.#isOverlay) this.#closeOverlay(reason);
|
|
711
|
+
else this.#setCollapsed(true, reason);
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Reads why a close happened. The backdrop has no action of its own — the
|
|
715
|
+
* consumer wires this one onto it — so the shared `"outside"` vocabulary is
|
|
716
|
+
* only reachable by recognising that target here.
|
|
717
|
+
*/
|
|
718
|
+
#closeReason(event) {
|
|
719
|
+
if (this.hasBackdropTarget && event?.currentTarget === this.backdropTarget) return "outside";
|
|
720
|
+
return stateReasonFor(event);
|
|
694
721
|
}
|
|
695
722
|
// --- Mode handling ---------------------------------------------------------
|
|
696
|
-
/**
|
|
697
|
-
|
|
723
|
+
/**
|
|
724
|
+
* Re-renders the closed/default state for `mode` and records it.
|
|
725
|
+
*
|
|
726
|
+
* @param report - Whether the mode change is one the consumer can observe: a
|
|
727
|
+
* viewport change re-derives the state under them, the connect-time baseline
|
|
728
|
+
* does not.
|
|
729
|
+
*/
|
|
730
|
+
#applyMode(mode, report) {
|
|
698
731
|
this.#mode = mode;
|
|
699
732
|
if (this.hasPanelTarget) this.panelTarget.setAttribute("data-mode", mode);
|
|
700
733
|
if (mode === "inline") {
|
|
@@ -708,6 +741,12 @@ var SidebarController = class extends Controller {
|
|
|
708
741
|
this.#trap.deactivate({ restoreFocus: false });
|
|
709
742
|
this.#setOverlayClosedImmediate();
|
|
710
743
|
}
|
|
744
|
+
if (report && this.#reporting) {
|
|
745
|
+
this.dispatch("reconcile", {
|
|
746
|
+
detail: { mode, open: this.#isExpanded },
|
|
747
|
+
cancelable: false
|
|
748
|
+
});
|
|
749
|
+
}
|
|
711
750
|
}
|
|
712
751
|
/** Reconciles a replacement panel with the current responsive mode and DOM state. */
|
|
713
752
|
#adoptPanel(panel) {
|
|
@@ -742,7 +781,7 @@ var SidebarController = class extends Controller {
|
|
|
742
781
|
}
|
|
743
782
|
#onMediaChange = (event) => {
|
|
744
783
|
const next = event.matches ? "inline" : "overlay";
|
|
745
|
-
if (next !== this.#mode) this.#applyMode(next);
|
|
784
|
+
if (next !== this.#mode) this.#applyMode(next, true);
|
|
746
785
|
};
|
|
747
786
|
#computeMode() {
|
|
748
787
|
return this.#mql?.matches ?? true ? "inline" : "overlay";
|
|
@@ -753,10 +792,11 @@ var SidebarController = class extends Controller {
|
|
|
753
792
|
}
|
|
754
793
|
// --- Inline (rail) ---------------------------------------------------------
|
|
755
794
|
/** Sets, reflects, and persists the inline collapsed preference. */
|
|
756
|
-
#setCollapsed(collapsed) {
|
|
795
|
+
#setCollapsed(collapsed, reason) {
|
|
757
796
|
if (collapsed === this.#collapsed) return;
|
|
758
797
|
this.#collapsed = collapsed;
|
|
759
798
|
this.#applyInlineState(collapsed);
|
|
799
|
+
this.#report(!collapsed, reason);
|
|
760
800
|
this.#persistCollapsed(collapsed);
|
|
761
801
|
}
|
|
762
802
|
/** Reflects the inline rail state onto the panel and trigger. */
|
|
@@ -768,7 +808,7 @@ var SidebarController = class extends Controller {
|
|
|
768
808
|
}
|
|
769
809
|
// --- Overlay (off-canvas modal) -------------------------------------------
|
|
770
810
|
/** Opens the overlay: reveal it, commit a starting frame, then trap focus. */
|
|
771
|
-
#openOverlay() {
|
|
811
|
+
#openOverlay(reason) {
|
|
772
812
|
if (!this.hasPanelTarget || this.#isOverlayOpen) return;
|
|
773
813
|
this.#transition.cancel();
|
|
774
814
|
this.#activePanel = this.panelTarget;
|
|
@@ -777,13 +817,17 @@ var SidebarController = class extends Controller {
|
|
|
777
817
|
void this.panelTarget.offsetWidth;
|
|
778
818
|
this.#setOverlayState("open");
|
|
779
819
|
this.#setExpandedAttr(true);
|
|
820
|
+
this.#report(true, reason);
|
|
821
|
+
if (!this.#isOverlayOpen) return;
|
|
780
822
|
this.#trap.activate();
|
|
781
823
|
}
|
|
782
824
|
/** Closes the overlay: start the exit transition, defer hide + trap teardown. */
|
|
783
|
-
#closeOverlay() {
|
|
825
|
+
#closeOverlay(reason) {
|
|
784
826
|
if (!this.hasPanelTarget || !this.#isOverlayOpen) return;
|
|
785
827
|
this.#setOverlayState("closed");
|
|
786
828
|
this.#setExpandedAttr(false);
|
|
829
|
+
this.#report(false, reason);
|
|
830
|
+
if (this.#isOverlayOpen) return;
|
|
787
831
|
this.#hideAfterTransition();
|
|
788
832
|
}
|
|
789
833
|
/** Renders the overlay closed state up front (used when entering overlay mode). */
|
|
@@ -826,6 +870,17 @@ var SidebarController = class extends Controller {
|
|
|
826
870
|
this.triggerTarget.setAttribute("aria-expanded", expanded ? "true" : "false");
|
|
827
871
|
}
|
|
828
872
|
}
|
|
873
|
+
/** Reports a move of the expanded state, naming the mode it happened in. */
|
|
874
|
+
#report(open, reason) {
|
|
875
|
+
if (!this.#reporting) return;
|
|
876
|
+
const detail = { reason, mode: this.#mode };
|
|
877
|
+
if (open) this.dispatch("open", { detail, cancelable: false });
|
|
878
|
+
else this.dispatch("close", { detail, cancelable: false });
|
|
879
|
+
}
|
|
880
|
+
/** Whether the panel currently counts as expanded in the mode it is in. */
|
|
881
|
+
get #isExpanded() {
|
|
882
|
+
return this.#isOverlay ? this.#isOverlayOpen : !this.#collapsed;
|
|
883
|
+
}
|
|
829
884
|
/**
|
|
830
885
|
* Resolves the inline collapsed preference, in priority order:
|
|
831
886
|
* 1. the persisted value (when a `key` is set and storage is readable),
|
|
@@ -851,6 +906,10 @@ var SidebarController = class extends Controller {
|
|
|
851
906
|
if (!key) return;
|
|
852
907
|
writeLocalStorage(key, collapsed ? "1" : "0");
|
|
853
908
|
}
|
|
909
|
+
/**
|
|
910
|
+
* @stimeoRuntimeOnly `key` names the storage slot the collapsed state is saved under; the state
|
|
911
|
+
* itself comes from the user.
|
|
912
|
+
*/
|
|
854
913
|
get #storageKey() {
|
|
855
914
|
return this.keyValue ? `stimeo--sidebar:${this.keyValue}` : "";
|
|
856
915
|
}
|