stimeo-ui 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +106 -1
- package/README.md +19 -10
- package/dist/cable/index.d.ts +9 -8
- package/dist/cable/index.js +22 -14
- package/dist/cable/index.js.map +1 -1
- package/dist/coerce-JtZVNG5h.d.ts +20 -0
- package/dist/controllers/accordion_controller.js +14 -6
- package/dist/controllers/accordion_controller.js.map +1 -1
- package/dist/controllers/alert_dialog_controller.js +145 -118
- package/dist/controllers/alert_dialog_controller.js.map +1 -1
- package/dist/controllers/announcer_controller.d.ts +5 -3
- package/dist/controllers/announcer_controller.js +113 -17
- package/dist/controllers/announcer_controller.js.map +1 -1
- package/dist/controllers/auto_submit_controller.js +185 -60
- package/dist/controllers/auto_submit_controller.js.map +1 -1
- package/dist/controllers/avatar_controller.js +55 -43
- package/dist/controllers/avatar_controller.js.map +1 -1
- package/dist/controllers/breadcrumb_controller.js.map +1 -1
- package/dist/controllers/bulk_select_controller.d.ts +3 -3
- package/dist/controllers/bulk_select_controller.js +64 -50
- package/dist/controllers/bulk_select_controller.js.map +1 -1
- package/dist/controllers/calendar_controller.d.ts +15 -12
- package/dist/controllers/calendar_controller.js +55 -53
- package/dist/controllers/calendar_controller.js.map +1 -1
- package/dist/controllers/carousel_controller.d.ts +9 -5
- package/dist/controllers/carousel_controller.js +124 -86
- package/dist/controllers/carousel_controller.js.map +1 -1
- package/dist/controllers/character_counter_controller.d.ts +27 -6
- package/dist/controllers/character_counter_controller.js +291 -95
- package/dist/controllers/character_counter_controller.js.map +1 -1
- package/dist/controllers/checkbox_controller.js +6 -0
- package/dist/controllers/checkbox_controller.js.map +1 -1
- package/dist/controllers/clipboard_controller.js +118 -27
- package/dist/controllers/clipboard_controller.js.map +1 -1
- package/dist/controllers/collapsible_controller.d.ts +1 -1
- package/dist/controllers/collapsible_controller.js +52 -49
- package/dist/controllers/collapsible_controller.js.map +1 -1
- package/dist/controllers/color_picker_controller.js +29 -7
- package/dist/controllers/color_picker_controller.js.map +1 -1
- package/dist/controllers/combobox_controller.d.ts +1 -1
- package/dist/controllers/combobox_controller.js +210 -71
- package/dist/controllers/combobox_controller.js.map +1 -1
- package/dist/controllers/command_palette_controller.d.ts +9 -9
- package/dist/controllers/command_palette_controller.js +289 -140
- package/dist/controllers/command_palette_controller.js.map +1 -1
- package/dist/controllers/conditional_fields_controller.js +145 -58
- package/dist/controllers/conditional_fields_controller.js.map +1 -1
- package/dist/controllers/confirm_controller.js +145 -118
- package/dist/controllers/confirm_controller.js.map +1 -1
- package/dist/controllers/context_menu_controller.d.ts +49 -14
- package/dist/controllers/context_menu_controller.js +138 -73
- 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 +2 -2
- package/dist/controllers/countdown_controller.js +109 -21
- package/dist/controllers/countdown_controller.js.map +1 -1
- package/dist/controllers/currency_input_controller.d.ts +75 -11
- package/dist/controllers/currency_input_controller.js +446 -72
- package/dist/controllers/currency_input_controller.js.map +1 -1
- package/dist/controllers/data_grid_controller.d.ts +10 -8
- package/dist/controllers/data_grid_controller.js +134 -28
- package/dist/controllers/data_grid_controller.js.map +1 -1
- package/dist/controllers/date_range_picker_controller.d.ts +12 -9
- package/dist/controllers/date_range_picker_controller.js +93 -72
- package/dist/controllers/date_range_picker_controller.js.map +1 -1
- package/dist/controllers/dialog_controller.d.ts +4 -5
- package/dist/controllers/dialog_controller.js +145 -118
- package/dist/controllers/dialog_controller.js.map +1 -1
- package/dist/controllers/direct_upload_controller.d.ts +1 -1
- package/dist/controllers/direct_upload_controller.js +24 -14
- package/dist/controllers/direct_upload_controller.js.map +1 -1
- package/dist/controllers/dirty_form_controller.d.ts +6 -1
- package/dist/controllers/dirty_form_controller.js +68 -31
- package/dist/controllers/dirty_form_controller.js.map +1 -1
- package/dist/controllers/dismissible_controller.js +64 -46
- package/dist/controllers/dismissible_controller.js.map +1 -1
- package/dist/controllers/drawer_controller.js +145 -118
- package/dist/controllers/drawer_controller.js.map +1 -1
- package/dist/controllers/dropdown_controller.js +76 -63
- package/dist/controllers/dropdown_controller.js.map +1 -1
- package/dist/controllers/editable_controller.js +199 -62
- package/dist/controllers/editable_controller.js.map +1 -1
- package/dist/controllers/empty_state_controller.js +13 -6
- package/dist/controllers/empty_state_controller.js.map +1 -1
- package/dist/controllers/file_dropzone_controller.d.ts +3 -0
- package/dist/controllers/file_dropzone_controller.js +55 -48
- package/dist/controllers/file_dropzone_controller.js.map +1 -1
- package/dist/controllers/filter_controller.js +9 -2
- package/dist/controllers/filter_controller.js.map +1 -1
- package/dist/controllers/flash_controller.d.ts +4 -4
- package/dist/controllers/flash_controller.js +66 -33
- package/dist/controllers/flash_controller.js.map +1 -1
- package/dist/controllers/focus_controller.d.ts +3 -3
- package/dist/controllers/focus_controller.js +39 -14
- package/dist/controllers/focus_controller.js.map +1 -1
- package/dist/controllers/form_field_controller.js +52 -43
- package/dist/controllers/form_field_controller.js.map +1 -1
- package/dist/controllers/form_validation_controller.d.ts +3 -3
- package/dist/controllers/form_validation_controller.js +18 -11
- package/dist/controllers/form_validation_controller.js.map +1 -1
- package/dist/controllers/frame_loading_controller.d.ts +13 -12
- package/dist/controllers/frame_loading_controller.js +55 -48
- package/dist/controllers/frame_loading_controller.js.map +1 -1
- package/dist/controllers/highlight_controller.d.ts +5 -4
- package/dist/controllers/highlight_controller.js.map +1 -1
- package/dist/controllers/hover_card_controller.d.ts +4 -1
- package/dist/controllers/hover_card_controller.js +67 -61
- package/dist/controllers/hover_card_controller.js.map +1 -1
- package/dist/controllers/idle_controller.d.ts +6 -5
- package/dist/controllers/idle_controller.js +10 -6
- package/dist/controllers/idle_controller.js.map +1 -1
- package/dist/controllers/input_mask_controller.d.ts +30 -13
- package/dist/controllers/input_mask_controller.js +411 -24
- 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.d.ts +3 -2
- package/dist/controllers/lazy_frame_controller.js +15 -3
- package/dist/controllers/lazy_frame_controller.js.map +1 -1
- package/dist/controllers/listbox_controller.d.ts +10 -7
- package/dist/controllers/listbox_controller.js +260 -79
- package/dist/controllers/listbox_controller.js.map +1 -1
- package/dist/controllers/local_time_controller.d.ts +8 -6
- package/dist/controllers/local_time_controller.js +48 -13
- package/dist/controllers/local_time_controller.js.map +1 -1
- package/dist/controllers/masonry_controller.js +11 -4
- package/dist/controllers/masonry_controller.js.map +1 -1
- package/dist/controllers/menu_controller.d.ts +24 -5
- package/dist/controllers/menu_controller.js +138 -82
- package/dist/controllers/menu_controller.js.map +1 -1
- package/dist/controllers/menubar_controller.d.ts +49 -7
- package/dist/controllers/menubar_controller.js +65 -19
- package/dist/controllers/menubar_controller.js.map +1 -1
- package/dist/controllers/meter_controller.d.ts +13 -20
- package/dist/controllers/meter_controller.js +270 -24
- package/dist/controllers/meter_controller.js.map +1 -1
- package/dist/controllers/multi_select_controller.d.ts +17 -15
- package/dist/controllers/multi_select_controller.js +251 -94
- package/dist/controllers/multi_select_controller.js.map +1 -1
- package/dist/controllers/navigation_menu_controller.d.ts +19 -5
- package/dist/controllers/navigation_menu_controller.js +67 -19
- package/dist/controllers/navigation_menu_controller.js.map +1 -1
- package/dist/controllers/nested_form_controller.js +98 -64
- package/dist/controllers/nested_form_controller.js.map +1 -1
- package/dist/controllers/network_status_controller.js +70 -52
- package/dist/controllers/network_status_controller.js.map +1 -1
- package/dist/controllers/number_input_controller.d.ts +24 -6
- package/dist/controllers/number_input_controller.js +344 -94
- package/dist/controllers/number_input_controller.js.map +1 -1
- package/dist/controllers/optimistic_controller.d.ts +8 -5
- package/dist/controllers/optimistic_controller.js +29 -11
- package/dist/controllers/optimistic_controller.js.map +1 -1
- package/dist/controllers/otp_controller.d.ts +35 -4
- package/dist/controllers/otp_controller.js +502 -104
- package/dist/controllers/otp_controller.js.map +1 -1
- package/dist/controllers/overflow_indicator_controller.js +6 -0
- package/dist/controllers/overflow_indicator_controller.js.map +1 -1
- package/dist/controllers/overflow_menu_controller.d.ts +10 -9
- package/dist/controllers/overflow_menu_controller.js +136 -21
- package/dist/controllers/overflow_menu_controller.js.map +1 -1
- package/dist/controllers/pagination_controller.d.ts +3 -2
- package/dist/controllers/pagination_controller.js +47 -14
- package/dist/controllers/pagination_controller.js.map +1 -1
- package/dist/controllers/password_reveal_controller.d.ts +5 -4
- package/dist/controllers/password_reveal_controller.js +52 -49
- package/dist/controllers/password_reveal_controller.js.map +1 -1
- package/dist/controllers/password_strength_controller.d.ts +1 -1
- package/dist/controllers/password_strength_controller.js +13 -6
- package/dist/controllers/password_strength_controller.js.map +1 -1
- package/dist/controllers/persist_controller.js +48 -128
- package/dist/controllers/persist_controller.js.map +1 -1
- package/dist/controllers/pointer_drag_controller.d.ts +19 -8
- package/dist/controllers/pointer_drag_controller.js +249 -23
- package/dist/controllers/pointer_drag_controller.js.map +1 -1
- package/dist/controllers/popover_controller.d.ts +3 -3
- package/dist/controllers/popover_controller.js +82 -65
- package/dist/controllers/popover_controller.js.map +1 -1
- package/dist/controllers/portal_controller.js +6 -0
- package/dist/controllers/portal_controller.js.map +1 -1
- package/dist/controllers/preview_guard_controller.js +14 -3
- package/dist/controllers/preview_guard_controller.js.map +1 -1
- package/dist/controllers/progress_controller.d.ts +9 -19
- package/dist/controllers/progress_controller.js +271 -27
- package/dist/controllers/progress_controller.js.map +1 -1
- package/dist/controllers/radio_group_controller.d.ts +11 -8
- package/dist/controllers/radio_group_controller.js +167 -80
- package/dist/controllers/radio_group_controller.js.map +1 -1
- package/dist/controllers/range_slider_controller.d.ts +4 -3
- package/dist/controllers/range_slider_controller.js +27 -7
- package/dist/controllers/range_slider_controller.js.map +1 -1
- package/dist/controllers/rating_controller.js +93 -57
- package/dist/controllers/rating_controller.js.map +1 -1
- package/dist/controllers/read_more_controller.js +10 -6
- package/dist/controllers/read_more_controller.js.map +1 -1
- package/dist/controllers/reading_progress_controller.js +22 -5
- package/dist/controllers/reading_progress_controller.js.map +1 -1
- package/dist/controllers/relative_time_controller.d.ts +4 -4
- package/dist/controllers/relative_time_controller.js +75 -11
- package/dist/controllers/relative_time_controller.js.map +1 -1
- package/dist/controllers/reset_on_restore_controller.d.ts +3 -3
- package/dist/controllers/reset_on_restore_controller.js +6 -0
- package/dist/controllers/reset_on_restore_controller.js.map +1 -1
- package/dist/controllers/resizable_controller.d.ts +3 -0
- package/dist/controllers/resizable_controller.js +55 -22
- package/dist/controllers/resizable_controller.js.map +1 -1
- package/dist/controllers/roving_controller.d.ts +3 -3
- package/dist/controllers/roving_controller.js +10 -4
- package/dist/controllers/roving_controller.js.map +1 -1
- package/dist/controllers/scroll_area_controller.js +129 -88
- package/dist/controllers/scroll_area_controller.js.map +1 -1
- package/dist/controllers/scroll_restore_controller.d.ts +3 -3
- package/dist/controllers/scroll_restore_controller.js +14 -2
- package/dist/controllers/scroll_restore_controller.js.map +1 -1
- package/dist/controllers/scroll_visibility_controller.js +93 -60
- package/dist/controllers/scroll_visibility_controller.js.map +1 -1
- package/dist/controllers/scrollspy_controller.js +11 -5
- package/dist/controllers/scrollspy_controller.js.map +1 -1
- package/dist/controllers/separator_controller.d.ts +1 -1
- package/dist/controllers/separator_controller.js +59 -43
- package/dist/controllers/separator_controller.js.map +1 -1
- package/dist/controllers/sidebar_controller.d.ts +1 -1
- package/dist/controllers/sidebar_controller.js +150 -122
- package/dist/controllers/sidebar_controller.js.map +1 -1
- package/dist/controllers/skeleton_controller.js +55 -48
- package/dist/controllers/skeleton_controller.js.map +1 -1
- package/dist/controllers/slider_controller.d.ts +2 -1
- package/dist/controllers/slider_controller.js +27 -6
- package/dist/controllers/slider_controller.js.map +1 -1
- package/dist/controllers/smart_sticky_header_controller.d.ts +1 -1
- package/dist/controllers/smart_sticky_header_controller.js +13 -5
- package/dist/controllers/smart_sticky_header_controller.js.map +1 -1
- package/dist/controllers/sortable_controller.d.ts +4 -4
- package/dist/controllers/sortable_controller.js +27 -14
- package/dist/controllers/sortable_controller.js.map +1 -1
- package/dist/controllers/spinner_controller.js +55 -48
- package/dist/controllers/spinner_controller.js.map +1 -1
- package/dist/controllers/step_indicator_controller.d.ts +4 -4
- package/dist/controllers/step_indicator_controller.js +6 -0
- package/dist/controllers/step_indicator_controller.js.map +1 -1
- package/dist/controllers/stepper_controller.d.ts +2 -3
- package/dist/controllers/stepper_controller.js +6 -0
- package/dist/controllers/stepper_controller.js.map +1 -1
- package/dist/controllers/stick_to_bottom_controller.d.ts +3 -1
- package/dist/controllers/stick_to_bottom_controller.js +19 -8
- package/dist/controllers/stick_to_bottom_controller.js.map +1 -1
- package/dist/controllers/sticky_observer_controller.js +49 -43
- package/dist/controllers/sticky_observer_controller.js.map +1 -1
- package/dist/controllers/submit_once_controller.d.ts +2 -1
- package/dist/controllers/submit_once_controller.js +145 -85
- package/dist/controllers/submit_once_controller.js.map +1 -1
- package/dist/controllers/switch_controller.d.ts +7 -4
- package/dist/controllers/switch_controller.js +172 -28
- package/dist/controllers/switch_controller.js.map +1 -1
- package/dist/controllers/tabs_controller.d.ts +7 -4
- package/dist/controllers/tabs_controller.js +6 -1
- package/dist/controllers/tabs_controller.js.map +1 -1
- package/dist/controllers/tags_input_controller.d.ts +4 -3
- package/dist/controllers/tags_input_controller.js +157 -28
- package/dist/controllers/tags_input_controller.js.map +1 -1
- package/dist/controllers/textarea_autosize_controller.d.ts +1 -1
- package/dist/controllers/textarea_autosize_controller.js +40 -19
- package/dist/controllers/textarea_autosize_controller.js.map +1 -1
- package/dist/controllers/theme_controller.d.ts +3 -2
- package/dist/controllers/theme_controller.js +10 -4
- package/dist/controllers/theme_controller.js.map +1 -1
- package/dist/controllers/time_picker_controller.d.ts +38 -5
- package/dist/controllers/time_picker_controller.js +192 -54
- package/dist/controllers/time_picker_controller.js.map +1 -1
- package/dist/controllers/toast_controller.d.ts +4 -5
- package/dist/controllers/toast_controller.js +58 -27
- package/dist/controllers/toast_controller.js.map +1 -1
- package/dist/controllers/toggle_group_controller.d.ts +2 -3
- package/dist/controllers/toggle_group_controller.js +158 -56
- package/dist/controllers/toggle_group_controller.js.map +1 -1
- package/dist/controllers/toolbar_controller.d.ts +8 -6
- package/dist/controllers/toolbar_controller.js +150 -21
- package/dist/controllers/toolbar_controller.js.map +1 -1
- package/dist/controllers/tooltip_controller.d.ts +4 -1
- package/dist/controllers/tooltip_controller.js.map +1 -1
- package/dist/controllers/transition_controller.js.map +1 -1
- package/dist/controllers/tree_view_controller.d.ts +1 -1
- package/dist/controllers/tree_view_controller.js +134 -25
- package/dist/controllers/tree_view_controller.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2451 -1312
- package/dist/index.js.map +1 -1
- package/dist/inspector/cli.d.ts +15 -11
- package/dist/inspector/cli.js +16 -3
- package/dist/inspector/cli.js.map +1 -1
- package/dist/inspector/cli_bin.js +53 -8
- package/dist/inspector/cli_bin.js.map +1 -1
- package/dist/inspector/examples.json +13 -13
- package/dist/inspector/manifest.json +19 -5
- package/dist/positioning/index.d.ts +7 -7
- package/dist/positioning/index.js +6 -0
- package/dist/positioning/index.js.map +1 -1
- package/package.json +10 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/announce.ts","../../src/utils/default_attribute.ts","../../src/utils/listener_set.ts","../../src/utils/microtask_coalescer.ts","../../src/utils/morph_render_watcher.ts","../../src/utils/timer_bounds.ts","../../src/utils/number_bounds.ts","../../src/utils/coerce.ts","../../src/utils/number_value.ts","../../src/utils/safe_timeout.ts","../../src/controllers/clipboard_controller.ts"],"names":[],"mappings":";;AAoBO,SAAS,QAAA,CAAS,OAAA,EAAiB,OAAA,GAAmC,EAAC,EAAS;AACrF,EAAA,MAAM,IAAA,GAAO,QAAQ,IAAA,EAAK;AAC1B,EAAA,IAAI,IAAA,CAAK,WAAW,CAAA,EAAG;AACvB,EAAA,MAAA,CAAO,aAAA;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AAClC,IAAA,OAAO,KAAK,QAAA,CAAS,IAAA;AAAA,MACnB,IAAA;AAAA,MACA,kBAAA;AAAA,MACA,IAAA,CAAK,qBAAA;AAAA,MACL,oBAAA,CAAoB,OAAO,gBAAA,CAAiB,OAAA;AAAA,MAC5C,qBAAoB,gBAAA,CAAiB;AAAA,KACvC;AAAA,EACF;AACF","file":"clipboard_controller.js","sourcesContent":["/**\n * Sends one message to the page's shared `stimeo--announcer`.\n *\n * A component that has to reach assistive tech does not carry a live region of its\n * own: a region only announces what changes *after* assistive tech already knows\n * about it, which a region that appears (or is un-hidden) with its message cannot\n * satisfy. The one region that can is the announcer sitting in the page from the\n * start, so state changes are handed to it as an event and it does the reading.\n *\n * The event goes to `window` because the announcer is usually a sibling high in the\n * document rather than an ancestor of the component dispatching it.\n *\n * Wording comes from the consumer — the library ships no English strings — so an\n * empty message is silently dropped and nothing is announced.\n *\n * @example\n * ```ts\n * announce(this.announceTextValue, { assertive: false });\n * ```\n */\nexport function announce(message: string, options: { assertive?: boolean } = {}): void {\n const text = message.trim();\n if (text.length === 0) return;\n window.dispatchEvent(\n new CustomEvent(\"stimeo--announcer:announce\", {\n detail: { message: text, assertive: options.assertive === true },\n }),\n );\n}\n\n/**\n * Fills `{name}` placeholders in an announcement template from `values`.\n *\n * The same substitution the value-text templates use, so a consumer writes\n * `\"{percent}% complete\"` in one attribute and gets the same rules everywhere. A\n * placeholder with no matching entry is left as authored rather than blanked, which\n * keeps a typo visible instead of silently swallowing the word.\n */\nexport function fillTemplate(template: string, values: Record<string, string | number>): string {\n return template.replace(/\\{([a-zA-Z][a-zA-Z0-9]*)\\}/g, (match, name: string) => {\n const replacement = values[name];\n return replacement === undefined ? match : String(replacement);\n });\n}\n","/**\n * Adds an attribute default without displacing an authored value.\n *\n * Attribute presence — including an authored empty string — is the ownership\n * boundary. The return value lets a caller remember that it supplied the\n * default when that caller must later restore the authored state.\n *\n * @param element - Element that owns the attribute\n * @param name - Attribute name\n * @param value - Value to write only when the attribute is absent\n * @returns Whether this call added the attribute\n */\nexport function setDefaultAttribute(element: Element, name: string, value: string): boolean {\n if (element.hasAttribute(name)) return false;\n element.setAttribute(name, value);\n return true;\n}\n","/**\n * Owns every listener a controller attaches for one connected lifetime and\n * releases them together, so an event name is spelled once and the release\n * cannot drift from the registration.\n *\n * Detaching by hand repeats three things at the release site — the type, the\n * handler reference and the capture flag — and any one of them drifting leaves\n * a listener alive on an element the controller no longer drives. Aborting the\n * signal a registration was created with releases it whatever it was made of,\n * so the release site names nothing.\n *\n * One set per lifetime, held as a field and never rebuilt. {@link\n * ListenerSet.dispose} is the only thing that closes a generation, and it opens\n * the next one in the same step, so the lifecycle hooks can call `add` and\n * `dispose` in any order any number of times, and no `add` ever meets an\n * already aborted signal — a DOM that registers a listener on such a signal\n * would keep it forever. Rebuilding the set instead would leak:\n * `addEventListener` matches an existing registration on target, type, callback\n * and capture alone, so re-adding the same handler while the first registration\n * is live is discarded, and that live registration keeps the signal it was\n * attached with — a set built by a second `connect()` can never release what it\n * appears to own.\n *\n * Scope is the registration only. Timers, observers, leases and the order they\n * are unwound in stay with the controller, which places `dispose()` in its\n * cleanup sequence. A receiver that changes at runtime (a\n * swapped target) is rebound by calling `dispose()` and then `add()` again from\n * the rebind, not by a second set.\n *\n * The set must own every registration of a tuple it holds: a listener the same\n * target already carries for the same type, callback and capture flag keeps the\n * right to remove it, and this set's `add` for that tuple is discarded. A\n * subscription shared between instances behind a participant count, or one that\n * lives for less than the connection, keeps its own pair of calls.\n *\n * @example\n * ```ts\n * readonly #listeners = new ListenerSet();\n *\n * connect(): void {\n * this.#listeners.add(this.element, \"submit\", this.#onNativeSubmit, { capture: true });\n * this.#listeners.add(this.element, \"turbo:submit-start\", this.#onSubmitStart);\n * this.#listeners.add(this.element, \"turbo:submit-end\", this.#onSubmitEnd);\n * }\n *\n * disconnect(): void {\n * this.#listeners.dispose();\n * }\n * ```\n */\nexport class ListenerSet {\n /** The generation every `add` joins until the next `dispose()`. */\n #abort = new AbortController();\n\n /**\n * Attaches `handler` to the open generation, exactly as the caller spelled it.\n *\n * The set supplies the signal, so `options` carries everything else the DOM\n * accepts — `capture` included, which has to match at release time and no\n * longer has a second place to drift from.\n */\n add(\n target: EventTarget,\n type: string,\n handler: EventListener,\n options?: Omit<AddEventListenerOptions, \"signal\">,\n ): void {\n target.addEventListener(type, handler, { ...options, signal: this.#abort.signal });\n }\n\n /**\n * Releases every listener of the open generation, synchronously, and opens the\n * next one. Idempotent, and safe before anything has been added.\n */\n dispose(): void {\n this.#abort.abort();\n this.#abort = new AbortController();\n }\n}\n","/**\n * Collapses many Stimulus lifecycle callbacks from one DOM mutation into a\n * single pass.\n *\n * Stimulus fires `<name>TargetConnected` / `Disconnected` once per element and\n * `<name>ValueChanged` once per changed attribute. Replacing a list of N options\n * or morphing several render Values therefore delivers N callbacks — but the\n * useful unit of work is \"reconcile against the resulting declarative input\",\n * once, after the batch has settled. Every controller with reconcilable targets\n * or render Values needs the same shape: a `queued` flag plus `queueMicrotask`.\n *\n * **A microtask is the right horizon, and the reason is specific.** Stimulus\n * drives these callbacks from a `MutationObserver`, whose own callback already\n * runs as a microtask with the whole batch in hand; scheduling one more lands\n * after the last sibling callback of that batch and still before paint or any\n * event handler. A timer would be later than it needs to be, and reconciling\n * synchronously would run once per element against a half-applied DOM.\n *\n * **The two guards are not the same guard.** Scheduling is refused before the\n * controller connects, and running is refused after it disconnects:\n *\n * - **Before `connect()`** — Stimulus delivers initial target and Value callbacks\n * ahead of `connect()`. Reconciling there would compute output against a\n * controller whose own state has not been initialised, and `connect()` is\n * about to do a full pass anyway.\n * - **After `disconnect()`** — Stimulus fires a callback for **every** target\n * during teardown, and a microtask queued just before it would otherwise run\n * against a detached tree. {@link MicrotaskCoalescer.cancel} exists for the\n * teardown path to drop the pending pass outright.\n *\n * Both guards are part of one contract here rather than something each consumer\n * has to remember separately.\n *\n * Scope is the scheduling only. *What* to reconcile — keep the surviving active\n * option, fall back to the next / previous / first visible one, rebuild derived\n * chips or hidden fields — stays in the controller, because no two consumers\n * answer it the same way.\n *\n * @example\n * ```ts\n * readonly #reconcile = new MicrotaskCoalescer(() => this.#reconcileOptions());\n *\n * connect() { this.#reconcile.activate(); }\n * disconnect() { this.#reconcile.cancel(); }\n *\n * optionTargetConnected() { this.#reconcile.schedule(); }\n * optionTargetDisconnected() { this.#reconcile.schedule(); }\n * ```\n */\nexport class MicrotaskCoalescer {\n readonly #run: () => void;\n #queued = false;\n #active = false;\n #generation = 0;\n\n /** @param run - the single reconciliation pass, invoked at most once per batch. */\n constructor(run: () => void) {\n this.#run = run;\n }\n\n /** Opens the window in which {@link schedule} is honoured; call from `connect()`. */\n activate(): void {\n this.#active = true;\n }\n\n /** Closes the window and drops any pending pass; call from `disconnect()`. */\n cancel(): void {\n this.#active = false;\n this.#queued = false;\n this.#generation += 1;\n }\n\n /** Requests one pass after the batch settles. Idempotent; inert outside the window. */\n schedule(): void {\n if (!this.#active || this.#queued) return;\n this.#queued = true;\n const generation = this.#generation;\n queueMicrotask(() => {\n // A cancelled callback must not consume a pass queued after reconnect.\n if (generation !== this.#generation || !this.#queued || !this.#active) return;\n this.#queued = false;\n this.#run();\n });\n }\n}\n","import { ListenerSet } from \"./listener_set\";\nimport { MicrotaskCoalescer } from \"./microtask_coalescer\";\n\n/**\n * Coalesces retained-element morphs and explicit lifecycle requests into one pass.\n *\n * Observe the controller's element after its initial state is settled. Morphs on\n * that element and bubbling morphs on its descendants share the same microtask\n * as {@link schedule}. The callback repairs derived output; the controller owns\n * any logical transition reporting. {@link disconnect} releases the listener and\n * cancels pending work, including work from an earlier connected lifetime.\n */\nexport class MorphRenderWatcher {\n readonly #listeners = new ListenerSet();\n readonly #pass: MicrotaskCoalescer;\n #element: Element | null = null;\n readonly #onMorph = (): void => this.#pass.schedule();\n\n /** @param run - the single pass that repairs the settled controller's output. */\n constructor(run: () => void) {\n this.#pass = new MicrotaskCoalescer(run);\n }\n\n /** Opens observation; observing the same element again preserves queued work. */\n observe(element: Element): void {\n if (this.#element === element) return;\n this.disconnect();\n this.#element = element;\n this.#pass.activate();\n this.#listeners.add(element, \"turbo:morph-element\", this.#onMorph);\n }\n\n /** Requests one pass; requests outside an observed lifetime are ignored. */\n schedule(): void {\n this.#pass.schedule();\n }\n\n /** Releases observation and pending work synchronously; safe to repeat. */\n disconnect(): void {\n this.#listeners.dispose();\n this.#pass.cancel();\n this.#element = null;\n }\n}\n","/**\n * Largest delay a timer can hold: the platform stores it in a 32-bit signed\n * integer, and anything larger overflows to `1`, so a delay meant to be far in\n * the future fires almost immediately. A declared delay above this bound names\n * no delay at all, and a controller reading one falls back to its default.\n */\nexport const MAX_TIMER_DELAY_MS = 2_147_483_647;\n","import { MAX_TIMER_DELAY_MS } from \"./timer_bounds\";\n\n/** Semantic constraints on an already decoded number, independent of the DOM. */\nexport interface NumberBounds {\n /** Finite numbers are required, including when this field is omitted. */\n readonly finite?: true;\n /** Inclusive lower endpoint. */\n readonly min?: number;\n /** Inclusive upper endpoint. */\n readonly max?: number;\n /** Exclusive lower endpoint. */\n readonly exclusiveMin?: number;\n /** Require a number without a fractional part. */\n readonly integer?: boolean;\n /** Exact decoded numbers accepted by a discrete contract. */\n readonly allowedValues?: readonly number[];\n /** JSON-safe exceptions to finite-number checking for unbounded endpoints. */\n readonly allowInfinity?: \"negative\" | \"positive\" | \"both\";\n}\n\n/** One constraint for each Number Value, including shorthand declarations. */\nexport type NumberValueConstraints<Values> = {\n readonly [Key in keyof Values as Values[Key] extends\n | NumberConstructor\n | { type: NumberConstructor }\n ? Key\n : never]: NumberBounds;\n};\n\n/** Reusable semantic domains; fractional inputs remain fractional unless excluded. */\nexport const NUMBER_BOUNDS = {\n finite: { finite: true },\n nonNegative: { finite: true, min: 0 },\n positive: { finite: true, exclusiveMin: 0 },\n nonNegativeInteger: { finite: true, min: 0, integer: true },\n positiveInteger: { finite: true, exclusiveMin: 0, integer: true },\n lowerBound: { finite: true, allowInfinity: \"negative\" },\n upperBound: { finite: true, allowInfinity: \"positive\" },\n timer: { finite: true, min: 0, max: MAX_TIMER_DELAY_MS },\n positiveTimer: { finite: true, exclusiveMin: 0, max: MAX_TIMER_DELAY_MS },\n} as const satisfies Record<string, NumberBounds>;\n\n/**\n * Checks all declared bounds without rounding, clamping, or coercing the input.\n * Infinity exceptions relax only finite checking; every other bound still applies.\n */\nexport function matchesNumberBounds(value: number, bounds: NumberBounds): boolean {\n if (!Number.isFinite(value)) {\n const direction = value === Infinity ? \"positive\" : value === -Infinity ? \"negative\" : null;\n if (direction === null) return false;\n if (bounds.allowInfinity !== \"both\" && bounds.allowInfinity !== direction) return false;\n }\n if (bounds.min !== undefined && value < bounds.min) return false;\n if (bounds.max !== undefined && value > bounds.max) return false;\n if (bounds.exclusiveMin !== undefined && value <= bounds.exclusiveMin) return false;\n if (bounds.integer && !Number.isInteger(value)) return false;\n if (bounds.allowedValues !== undefined && !bounds.allowedValues.includes(value)) return false;\n return true;\n}\n\n/** Decodes a Number Value literal; action params use their own JSON decoder. */\nexport function decodeNumberValue(raw: string): number {\n return Number(raw.replace(/_/g, \"\"));\n}\n","/**\n * Numeric coercion for controllers that accept a number through a Value, an action\n * param, or an event detail.\n *\n * Stimulus decodes action params as JSON when possible and leaves other text\n * untouched. CustomEvent detail can also supply a number or numeric string.\n * The reader accepts those two types while rejecting blank and non-finite input.\n */\n\nimport { matchesNumberBounds, type NumberBounds } from \"./number_bounds\";\n\n/**\n * Reads a finite number or nonblank numeric string; other input returns `null`.\n * Blank strings cannot silently reset a value to zero.\n */\nexport function toFiniteNumber(raw: unknown): number | null {\n if (typeof raw !== \"number\" && typeof raw !== \"string\") return null;\n if (typeof raw === \"string\" && raw.trim().length === 0) return null;\n const value = Number(raw);\n return Number.isFinite(value) ? value : null;\n}\n\n/**\n * Returns an accepted decoded Number Value or the caller's fallback unchanged.\n * The caller owns the fallback contract; this reader does not parse or write a Value.\n */\nexport function readNumber(raw: number, fallback: number, bounds: NumberBounds): number {\n return matchesNumberBounds(raw, bounds) ? raw : fallback;\n}\n","import { readNumber } from \"./coerce\";\nimport { matchesNumberBounds, type NumberBounds } from \"./number_bounds\";\n\n/** The instance identity carried by a Number Value read. */\nexport interface NumberValueOwner {\n readonly identifier: string;\n readonly element: Element;\n}\n\n/** Reads current declarations at the point of use without rewriting their attributes. */\nexport class NumberValueReader {\n /** The last rejected literal per Value; no history grows for an unchanged instance. */\n readonly #lastRejected = new Map<string, string>();\n\n /** Resolves the declared number using its own fallback and shared class contract. */\n read(\n owner: NumberValueOwner,\n name: string,\n raw: number,\n fallback: number,\n bounds: NumberBounds,\n ): number {\n const resolved = readNumber(raw, fallback, bounds);\n if (matchesNumberBounds(raw, bounds)) {\n this.#lastRejected.delete(name);\n return resolved;\n }\n const attribute = `data-${owner.identifier}-${name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}-value`;\n const literal = owner.element.getAttribute(attribute);\n if (literal === null) {\n this.#lastRejected.delete(name);\n return resolved;\n }\n if (this.#lastRejected.get(name) !== literal) {\n this.#lastRejected.set(name, literal);\n console.warn(\n `Stimeo UI: \"${owner.identifier}\" has an invalid number Value \"${name}\" declaration ${JSON.stringify(literal)}; using ${fallback}.`,\n );\n }\n return resolved;\n }\n}\n","/**\n * Self-cleaning timer registries shared by Stimeo controllers.\n *\n * Stimulus controllers frequently schedule `setTimeout` / `setInterval` work\n * (auto-dismiss, debouncing, polling). When the element leaves the DOM — a\n * Turbo Drive navigation, a Turbo Stream replacement, or any `disconnect()` —\n * orphaned timers keep firing against a detached controller, leaking memory and\n * mutating stale state. {@link SafeTimeout} and {@link SafeInterval} track every\n * timer they create so a single {@link TimerRegistry.clearAll | clearAll()} call\n * in `disconnect()` tears them all down.\n *\n * These are intentionally low-level primitives: they own *registration and\n * cleanup only*. Higher-level policy (pause/resume, remaining-time accounting)\n * stays in the individual controllers so per-widget semantics are not flattened\n * into a lowest-common-denominator helper.\n */\n\nexport { MAX_TIMER_DELAY_MS } from \"./timer_bounds\";\n\n/**\n * Shared registry bookkeeping for the timeout/interval variants.\n *\n * Subclasses provide the scheduling primitive ({@link schedule}) and its matching\n * canceller ({@link cancel}); this base owns the set of live ids plus the\n * per-id and bulk teardown shared by both.\n */\nabstract class TimerRegistry {\n /** Live timer ids that have not yet been cleared (or, for timeouts, fired). */\n protected readonly ids = new Set<number>();\n\n /** Schedules the underlying platform timer and returns its id. */\n protected abstract schedule(callback: () => void, delay: number): number;\n\n /** Cancels the underlying platform timer for `id`. */\n protected abstract cancel(id: number): void;\n\n /**\n * Cancels a single tracked timer.\n *\n * No-ops if the id is unknown (already cleared, fired, or never owned by this\n * registry), so callers can clear defensively without guarding.\n */\n clear(id: number): void {\n if (this.ids.delete(id)) {\n this.cancel(id);\n }\n }\n\n /**\n * Cancels every tracked timer. Call this from a controller's `disconnect()`\n * to guarantee no timer outlives the element.\n */\n clearAll(): void {\n for (const id of this.ids) {\n this.cancel(id);\n }\n this.ids.clear();\n }\n\n /** Number of timers currently tracked (pending). */\n get size(): number {\n return this.ids.size;\n }\n}\n\n/**\n * `setTimeout` wrapper that auto-forgets each timer once it fires and supports\n * bulk teardown on disconnect.\n *\n * @example\n * ```ts\n * #timers = new SafeTimeout();\n *\n * connect() {\n * this.#timers.set(() => this.dismiss(), 5000);\n * }\n *\n * disconnect() {\n * this.#timers.clearAll();\n * }\n * ```\n */\nexport class SafeTimeout extends TimerRegistry {\n /**\n * Schedules `callback` after `delay` ms and returns the timer id.\n *\n * The id is removed from the registry automatically when the timeout fires,\n * so {@link TimerRegistry.size | size} reflects only still-pending timers.\n */\n set(callback: () => void, delay: number): number {\n const id = this.schedule(() => {\n this.ids.delete(id);\n callback();\n }, delay);\n this.ids.add(id);\n return id;\n }\n\n protected schedule(callback: () => void, delay: number): number {\n return window.setTimeout(callback, delay);\n }\n\n protected cancel(id: number): void {\n window.clearTimeout(id);\n }\n}\n\n/**\n * `setInterval` wrapper that tracks every interval for bulk teardown on\n * disconnect. Unlike {@link SafeTimeout}, intervals are retained until they are\n * explicitly cleared because they fire repeatedly.\n *\n * @example\n * ```ts\n * #intervals = new SafeInterval();\n *\n * connect() {\n * this.#intervals.set(() => this.tick(), 1000);\n * }\n *\n * disconnect() {\n * this.#intervals.clearAll();\n * }\n * ```\n */\nexport class SafeInterval extends TimerRegistry {\n /** Schedules a repeating `callback` every `delay` ms and returns the timer id. */\n set(callback: () => void, delay: number): number {\n const id = this.schedule(callback, delay);\n this.ids.add(id);\n return id;\n }\n\n protected schedule(callback: () => void, delay: number): number {\n return window.setInterval(callback, delay);\n }\n\n protected cancel(id: number): void {\n window.clearInterval(id);\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport { announce } from \"../utils/announce\";\nimport { setDefaultAttribute } from \"../utils/default_attribute\";\nimport { MorphRenderWatcher } from \"../utils/morph_render_watcher\";\nimport { NUMBER_BOUNDS, type NumberValueConstraints } from \"../utils/number_bounds\";\nimport { NumberValueReader } from \"../utils/number_value\";\nimport { SafeTimeout } from \"../utils/safe_timeout\";\n\n/**\n * The `data-state` values this controller writes itself. Any other value on the\n * attribute was authored by the consumer and is left alone.\n */\nconst TRANSIENT_STATES = new Set([\"copied\", \"error\"]);\n\n/**\n * Headless copy-to-clipboard behavior with a completion slot and a screen-reader\n * announcement.\n *\n * Markup contract (identifier: `stimeo--clipboard`):\n * <div data-controller=\"stimeo--clipboard\"\n * data-stimeo--clipboard-feedback-duration-value=\"2000\"\n * data-stimeo--clipboard-announce-copied-text-value=\"Copied to clipboard\"\n * data-stimeo--clipboard-announce-error-text-value=\"Copy failed\">\n * <input type=\"text\" value=\"https://example.com\" readonly\n * data-stimeo--clipboard-target=\"source\">\n * <button type=\"button\" data-stimeo--clipboard-target=\"button\"\n * data-action=\"click->stimeo--clipboard#copy\">Copy</button>\n * <span data-stimeo--clipboard-target=\"feedback\"></span>\n * </div>\n *\n * No dedicated APG pattern; this follows the Button practice plus a status message\n * ({@link https://www.w3.org/WAI/WCAG22/Understanding/status-changes.html | WCAG 2.2 SC 4.1.3}).\n * The copy uses the standard `navigator.clipboard` API (no extra dependency); every\n * failure mode — an API the browser withholds outside a secure context as much as a\n * rejected permission — settles the same way, as `data-state=\"error\"` plus the\n * `copy` event's `success: false`.\n *\n * Targets: `source` (the text to copy, when `text` is not set), `button` (the\n * control that triggers `copy`), `feedback` (the **visible** completion slot).\n *\n * Values: `text` (copy this instead of reading `source`), `feedbackDuration` (ms the\n * completion state is held; `0` or less arms no timer, so it stands until the next\n * copy — a reconnect still clears it), `copiedLabel` /\n * `errorLabel` (what the visible slot shows), `announceCopiedText` /\n * `announceErrorText` (what assistive tech hears; empty announces nothing).\n *\n * @remarks\n * Behavior only — icon swaps and styling are the consumer's, keyed off `data-state`\n * (`idle` / `copied` / `error`).\n *\n * **The `feedback` slot must not carry live-region semantics.** Announcing is the\n * page's shared `stimeo--announcer` job: it is seated before the change it reads,\n * which a slot filled on demand cannot be, and it already collapses a repeat of the\n * same wording so a second copy is still heard. A `role=\"status\"` on the slot as\n * well would say everything twice.\n *\n * `copied` and `error` are transient: the timer that clears them belongs to one\n * connection, so a fresh `connect()` that finds either — a page Turbo restores from its\n * cache, an in-page move — returns to `idle`, silently. `turbo:before-cache` changes\n * nothing: Turbo also dispatches it on pages that stay (a promoted frame navigation, a\n * `popstate` without Turbo state, a refresh of a cached URL), where the result is still\n * on screen and its return to idle still due. Returning to `idle` empties only a slot that\n * still shows the wording a copy wrote there; a slot the page swapped in, rewrote, or put\n * an element into keeps what it holds.\n *\n * A `copiedLabel` / `errorLabel` changed on the live element while its result is\n * shown rewrites the slot — only while the slot still reads the label the copy wrote\n * — without announcing, dispatching or moving the return to idle. Stimulus reports no\n * change when a label attribute whose value was empty is removed, so the slot keeps\n * the empty label until the next copy. `feedbackDuration` and the announcement texts\n * belong to one copy, so a change to them applies from the next.\n */\nexport class ClipboardController extends Controller<HTMLElement> {\n /** Numeric read boundaries share one reader for this controller instance. */\n readonly #numbers = new NumberValueReader();\n\n static override targets = [\"source\", \"button\", \"feedback\"];\n static override values = {\n text: { type: String, default: \"\" },\n feedbackDuration: { type: Number, default: 2000 },\n copiedLabel: { type: String, default: \"Copied\" },\n errorLabel: { type: String, default: \"Copy failed\" },\n announceCopiedText: { type: String, default: \"\" },\n announceErrorText: { type: String, default: \"\" },\n };\n\n static valueConstraints = {\n feedbackDuration: NUMBER_BOUNDS.timer,\n } satisfies NumberValueConstraints<typeof ClipboardController.values>;\n static actions = [\"copy\"] as const;\n static events = [\"copy\"] as const;\n\n declare readonly sourceTarget: HTMLElement;\n declare readonly buttonTarget: HTMLElement;\n declare readonly feedbackTarget: HTMLElement;\n declare readonly feedbackTargets: HTMLElement[];\n declare readonly hasSourceTarget: boolean;\n declare readonly hasButtonTarget: boolean;\n declare readonly hasFeedbackTarget: boolean;\n\n declare textValue: string;\n declare feedbackDurationValue: number;\n declare copiedLabelValue: string;\n declare errorLabelValue: string;\n declare announceCopiedTextValue: string;\n declare announceErrorTextValue: string;\n\n /**\n * The pending return to idle — the only timer this controller schedules, so\n * `clearAll()` is exactly \"drop the auto-clear\" and needs no id of its own.\n */\n readonly #timers = new SafeTimeout();\n\n /**\n * Whether this connection is still live. `copy()` suspends on the Clipboard API,\n * and a teardown that lands while it is suspended must win: the continuation\n * would otherwise write to an element nobody owns and arm a timer past the\n * `clearAll()` that was supposed to be the last word. Stimulus also runs the label\n * callbacks ahead of `connect()`, while this is still false: a result restored with\n * the markup is `connect()`'s to settle, not theirs.\n */\n #connected = false;\n #result: boolean | null = null;\n #feedback: { element: HTMLElement; original: string; text: string } | null = null;\n /**\n * Every feedback this controller wrote a result's wording into, with that wording. It\n * outlives a connection, so an in-page move still knows what it wrote.\n */\n readonly #written = new Map<HTMLElement, string>();\n readonly #morphRender = new MorphRenderWatcher(() => this.#renderResult());\n\n override connect(): void {\n this.#connected = true;\n this.#adopt();\n this.#result = null;\n this.#feedback = this.hasFeedbackTarget\n ? {\n element: this.feedbackTarget,\n original: this.feedbackTarget.textContent ?? \"\",\n text: this.feedbackTarget.textContent ?? \"\",\n }\n : null;\n this.#morphRender.observe(this.element);\n }\n\n override disconnect(): void {\n this.#connected = false;\n this.#morphRender.disconnect();\n this.#timers.clearAll();\n }\n\n /**\n * Follows a `copiedLabel` swapped in place while a successful copy is shown.\n *\n * Render only: nothing is announced or dispatched, and the return to idle keeps the\n * deadline the copy set. The slot changes only while `data-state` is `copied` and it\n * still reads the previous label — the one the copy wrote there — so text someone\n * else put in the slot stays. Stimulus also runs this ahead of `connect()`, which\n * settles a result restored with the markup itself, so nothing is written then.\n */\n copiedLabelValueChanged(label: string, previous: string | undefined): void {\n this.#followLabel(\"copied\", label, previous);\n }\n\n /**\n * Follows an `errorLabel` swapped in place while a failed copy is shown, on the same\n * terms as {@link ClipboardController.copiedLabelValueChanged}: only while\n * `data-state` is `error` and the slot still reads the previous label.\n */\n errorLabelValueChanged(label: string, previous: string | undefined): void {\n this.#followLabel(\"error\", label, previous);\n }\n\n /**\n * Copies the resolved text and reports the outcome. Bound via `data-action`\n * (click). Dispatches `stimeo--clipboard:copy` with `{ success, text, message }`\n * once per completed attempt — including on failure — so consumers can react\n * either way. `message` is the authored label for that outcome, so a part that\n * shows wording — `stimeo--clipboard:copy->stimeo--toast#show` — needs nothing\n * else; wiring both that and the announcer reads the same result twice.\n * An attempt whose connection ended while it was in flight reports nothing.\n */\n async copy(): Promise<void> {\n const text = this.#resolveText();\n let success = false;\n try {\n await navigator.clipboard.writeText(text);\n success = true;\n } catch {\n success = false;\n }\n if (!this.#connected) return;\n\n this.#reportResult(success);\n const message = success ? this.copiedLabelValue : this.errorLabelValue;\n this.dispatch(\"copy\", { detail: { success, text, message } });\n }\n\n /**\n * The text to copy: the explicit `text` value when set, otherwise the source\n * target's current value (inputs/textareas) or text content.\n */\n #resolveText(): string {\n if (this.textValue.length > 0) return this.textValue;\n if (!this.hasSourceTarget) return \"\";\n const source = this.sourceTarget;\n if (source instanceof HTMLInputElement || source instanceof HTMLTextAreaElement) {\n return source.value;\n }\n return source.textContent ?? \"\";\n }\n\n /**\n * Reads the current state back from the DOM.\n *\n * A `copied` or `error` found at connect time is this controller's own output\n * from a connection that is gone, and so is the timer that would have cleared it\n * — nothing else would ever return the element to `idle`. Any other authored\n * value belongs to the consumer and only a missing attribute takes the default.\n */\n #adopt(): void {\n if (this.#inTransientState()) {\n const restored = this.#written.size === 0;\n this.#reset();\n // A fresh instance on restored markup has no write on record: the first feedback\n // holds the restored result's wording, which goes with the result.\n if (restored && this.hasFeedbackTarget) this.feedbackTarget.textContent = \"\";\n return;\n }\n setDefaultAttribute(this.element, \"data-state\", \"idle\");\n }\n\n /** Whether `data-state` currently holds one of the values this controller writes. */\n #inTransientState(): boolean {\n const state = this.element.getAttribute(\"data-state\");\n return state !== null && TRANSIENT_STATES.has(state);\n }\n\n /**\n * Reflects the result, announces it, and schedules the return to idle.\n */\n #reportResult(success: boolean): void {\n this.#result = success;\n this.#renderResult(true);\n this.#announceResult(success);\n this.#scheduleReset();\n }\n\n /**\n * Repairs a held result without repeating its announcement or extending its deadline.\n * @stimeoRenderRoot\n */\n #renderResult(force = false): void {\n if (this.#result === null) {\n setDefaultAttribute(this.element, \"data-state\", \"idle\");\n return;\n }\n this.element.setAttribute(\"data-state\", this.#result ? \"copied\" : \"error\");\n if (!this.hasFeedbackTarget) return;\n const element = this.feedbackTarget;\n const held = this.#feedback;\n if (\n !force &&\n (!held ||\n element !== held.element ||\n element.firstElementChild !== null ||\n (element.textContent !== held.text && element.textContent !== held.original))\n )\n return;\n const text = this.#result ? this.copiedLabelValue : this.errorLabelValue;\n this.#feedback = {\n element,\n original: held?.element === element ? held.original : (element.textContent ?? \"\"),\n text,\n };\n element.textContent = text;\n this.#written.set(element, text);\n }\n\n /**\n * Reads the result out through the shared announcer.\n *\n * @stimeoRuntimeOnly `announceCopiedText` / `announceErrorText` word the one announcement a copy\n * makes.\n */\n #announceResult(success: boolean): void {\n announce(success ? this.announceCopiedTextValue : this.announceErrorTextValue);\n }\n\n /**\n * Arms the return to idle for the result just shown.\n *\n * @stimeoRuntimeOnly `feedbackDuration` is the delay of the one timer this call arms, and the\n * reset that timer runs reads no Value.\n */\n #scheduleReset(): void {\n // Drop any in-flight reset so consecutive copies restart the full window\n // rather than having the earlier timer clear the new result prematurely.\n this.#timers.clearAll();\n if (this.#safeFeedbackDuration > 0) {\n this.#timers.set(() => this.#reset(), this.#safeFeedbackDuration);\n }\n }\n\n /**\n * Rewrites the slot to `label` while `state` is shown and the slot still reads\n * `previous`, the label this controller wrote for that result.\n */\n #followLabel(state: \"copied\" | \"error\", label: string, previous: string | undefined): void {\n if (!this.#connected) return;\n if (this.element.getAttribute(\"data-state\") !== state || !this.hasFeedbackTarget) return;\n if (this.feedbackTarget.textContent !== previous) return;\n this.feedbackTarget.textContent = label;\n this.#written.set(this.feedbackTarget, label);\n if (this.#feedback?.element === this.feedbackTarget) this.#feedback.text = label;\n }\n\n /**\n * Returns to the idle state and empties each feedback this controller wrote into that is\n * still a feedback target showing the wording written there and nothing else. A slot the\n * page swapped in, rewrote, or put an element into keeps what it holds.\n */\n #reset(): void {\n this.#result = null;\n this.element.setAttribute(\"data-state\", \"idle\");\n for (const [element, text] of this.#written) {\n if (!this.feedbackTargets.includes(element)) continue;\n if (element.firstElementChild === null && element.textContent === text) {\n element.textContent = \"\";\n }\n }\n this.#written.clear();\n }\n /** Current `feedbackDuration` declaration resolved against its numeric contract. */\n get #safeFeedbackDuration(): number {\n return this.#numbers.read(\n this,\n \"feedbackDuration\",\n this.feedbackDurationValue,\n ClipboardController.values.feedbackDuration.default,\n ClipboardController.valueConstraints.feedbackDuration,\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/announce.ts","../../src/utils/default_attribute.ts","../../src/utils/listener_set.ts","../../src/utils/microtask_coalescer.ts","../../src/utils/morph_render_watcher.ts","../../src/utils/timer_bounds.ts","../../src/utils/number_bounds.ts","../../src/utils/coerce.ts","../../src/utils/number_value.ts","../../src/utils/attribute_write.ts","../../src/utils/owned_text.ts","../../src/utils/safe_timeout.ts","../../src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A;AAC9C,IAAA,KAAA,MAAW,OAAA,IAAW,KAAK,QAAA,EAAU;AACnC,MAAA,IAAI,IAAA,CAAK,eAAA,CAAgB,QAAA,CAAS,OAAO,CAAA;AACvC,QAAA,IAAA,CAAK,aAAA,CAAc,KAAA;AAAA,UACjB,OAAA;AAAA,UACA,IAAA,CAAK,cAAc,SAAA,CAAU,OAAO,IAAI,EAAC,GAAI,EAAE,MAAA,EAAQ,MAAA;AAAO,SAChE;AACF,MAAA,IAAA,CAAK,aAAA,CAAc,OAAO,OAAO,CAAA;AAAA,IACnC;AACA,IAAA,IAAA,CAAK,SAAS,KAAA,EAAM;AAAA,EACtB;AAAA,EAEA,IAAI,qBAAA,GAAgC;AAClC,IAAA,OAAO,KAAK,QAAA,CAAS,IAAA;AAAA,MACnB,IAAA;AAAA,MACA,kBAAA;AAAA,MACA,IAAA,CAAK,qBAAA;AAAA,MACL,oBAAA,CAAoB,OAAO,gBAAA,CAAiB,OAAA;AAAA,MAC5C,qBAAoB,gBAAA,CAAiB;AAAA,KACvC;AAAA,EACF;AACF","file":"clipboard_controller.js","sourcesContent":["export { fillTemplate } from \"./template\";\n\n/**\n * Sends one message to the page's shared `stimeo--announcer`.\n *\n * A message that has to reach assistive tech is not put into a live region created\n * or un-hidden along with it: a region only announces what changes *after* assistive\n * tech already knows about it, which such a region cannot satisfy. The announcer has\n * to be in the page before any message is handed to it — one sent while no announcer\n * is listening is not read — so state changes reach it as an event and it does the\n * reading.\n *\n * The event goes to `window` because the announcer is usually a sibling high in the\n * document rather than an ancestor of the component dispatching it.\n *\n * Wording comes from the consumer — this helper adds no text of its own — so an\n * empty message is silently dropped and nothing is announced.\n *\n * @example\n * ```ts\n * announce(this.announceTextValue, { assertive: false });\n * ```\n */\nexport function announce(message: string, options: { assertive?: boolean } = {}): void {\n const text = message.trim();\n if (text.length === 0) return;\n window.dispatchEvent(\n new CustomEvent(\"stimeo--announcer:announce\", {\n detail: { message: text, assertive: options.assertive === true },\n }),\n );\n}\n","/**\n * Adds an attribute default without displacing an authored value.\n *\n * Attribute presence — including an authored empty string — is the ownership\n * boundary. The return value lets a caller remember that it supplied the\n * default when that caller must later restore the authored state.\n *\n * @param element - Element that owns the attribute\n * @param name - Attribute name\n * @param value - Value to write only when the attribute is absent\n * @returns Whether this call added the attribute\n */\nexport function setDefaultAttribute(element: Element, name: string, value: string): boolean {\n if (element.hasAttribute(name)) return false;\n element.setAttribute(name, value);\n return true;\n}\n","/** What {@link ListenerSet.add} passes on besides the signal it supplies itself. */\nexport type ListenerOptions = Omit<AddEventListenerOptions, \"signal\">;\n\n/**\n * The event map a target's own `addEventListener` types its handlers with: the\n * window's, a document's, an HTML or SVG element's, any other element's, or a\n * media query list's. Other targets name none.\n */\ntype EventMapOf<T extends EventTarget> = T extends Window\n ? WindowEventMap\n : T extends Document\n ? DocumentEventMap\n : T extends HTMLElement\n ? HTMLElementEventMap\n : T extends SVGElement\n ? SVGElementEventMap\n : T extends Element\n ? ElementEventMap\n : T extends MediaQueryList\n ? MediaQueryListEventMap\n : Record<never, never>;\n\n/**\n * Owns every listener a controller attaches for one connected lifetime and\n * releases them together, so an event name is spelled once and the release\n * cannot drift from the registration.\n *\n * Detaching by hand repeats three things at the release site — the type, the\n * handler reference and the capture flag — and any one of them drifting leaves\n * a listener alive on an element the controller no longer drives. Aborting the\n * signal a registration was created with releases it whatever it was made of,\n * so the release site names nothing.\n *\n * One set per lifetime, held as a field and never rebuilt.\n * {@link ListenerSet.dispose} is the only thing that closes a generation, and it opens\n * the next one in the same step, so the lifecycle hooks can call `add` and\n * `dispose` in any order any number of times, and no `add` ever meets an\n * already aborted signal — a DOM that registers a listener on such a signal\n * would keep it forever. Rebuilding the set instead would leak:\n * `addEventListener` matches an existing registration on target, type, callback\n * and capture alone, so re-adding the same handler while the first registration\n * is live is discarded, and that live registration keeps the signal it was\n * attached with — a set built by a second `connect()` can never release what it\n * appears to own.\n *\n * Scope is the registration only. Timers, observers, leases and the order they\n * are unwound in stay with the controller, which places `dispose()` in its\n * cleanup sequence. A receiver that changes at runtime (a\n * swapped target) is rebound by calling `dispose()` and then `add()` again from\n * the rebind, not by a second set.\n *\n * A lifetime shorter than the connection — while a Value holds, until a first\n * load, while a subscription is open — gets a set of its own, which the end of\n * that lifetime disposes. A controller therefore holds one set per lifetime: the\n * connection's, and one for each swapped receiver or shorter span.\n *\n * The set must own every registration of a tuple it holds: a listener the same\n * target already carries for the same type, callback and capture flag keeps the\n * right to remove it, and this set's `add` for that tuple is discarded. A\n * subscription shared between instances behind a participant count, listeners of\n * several elements that come and go one at a time, and those one gesture holds\n * keep their own pair of calls or a signal of their own.\n *\n * @example\n * ```ts\n * readonly #listeners = new ListenerSet();\n *\n * connect(): void {\n * this.#listeners.add(this.element, \"submit\", this.#onNativeSubmit, { capture: true });\n * this.#listeners.add(this.element, \"turbo:submit-start\", this.#onSubmitStart);\n * this.#listeners.add(this.element, \"turbo:submit-end\", this.#onSubmitEnd);\n * }\n *\n * disconnect(): void {\n * this.#listeners.dispose();\n * }\n * ```\n */\nexport class ListenerSet {\n /** The generation every `add` joins until the next `dispose()`. */\n #abort = new AbortController();\n\n /**\n * Attaches `handler` to the open generation, exactly as the caller spelled it.\n *\n * The set supplies the signal, so `options` carries everything else the DOM\n * accepts — `capture` included. A removal by hand would have to repeat that\n * flag; aborting the signal releases the listener without it.\n *\n * A `type` the target's own event map names types `handler` with that event,\n * as the target's `addEventListener` does, so a handler written for a\n * `KeyboardEvent` is passed as it is; any other `type` takes an\n * `EventListener`.\n */\n add<T extends EventTarget, K extends keyof EventMapOf<T> & string>(\n target: T,\n type: K,\n handler: (event: EventMapOf<T>[K]) => void,\n options?: ListenerOptions,\n ): void;\n add(target: EventTarget, type: string, handler: EventListener, options?: ListenerOptions): void;\n add(target: EventTarget, type: string, handler: EventListener, options?: ListenerOptions): void {\n target.addEventListener(type, handler, { ...options, signal: this.#abort.signal });\n }\n\n /**\n * Releases every listener of the open generation, synchronously, and opens the\n * next one. Idempotent, and safe before anything has been added.\n */\n dispose(): void {\n this.#abort.abort();\n this.#abort = new AbortController();\n }\n}\n","/**\n * Collapses many Stimulus lifecycle callbacks from one DOM mutation into a\n * single pass.\n *\n * Stimulus fires `<name>TargetConnected` / `Disconnected` once per element and\n * `<name>ValueChanged` once per changed attribute. Replacing a list of N options\n * or morphing several render Values therefore delivers N callbacks — but the\n * useful unit of work is \"reconcile against the resulting declarative input\",\n * once, after the batch has settled. Every controller with reconcilable targets\n * or render Values needs the same shape: a `queued` flag plus `queueMicrotask`.\n *\n * **A microtask is the right horizon, and the reason is specific.** Stimulus\n * drives these callbacks from a `MutationObserver`, whose own callback already\n * runs as a microtask with the whole batch in hand; scheduling one more lands\n * after the last sibling callback of that batch and still before paint or any\n * event handler. A timer would be later than it needs to be, and reconciling\n * synchronously would run once per element against a half-applied DOM.\n *\n * **The two guards are not the same guard.** Scheduling is refused before the\n * controller connects, and running is refused after it disconnects:\n *\n * - **Before `connect()`** — Stimulus delivers initial target and Value callbacks\n * ahead of `connect()`. Reconciling there would compute output against a\n * controller whose own state has not been initialised, and `connect()` is\n * about to do a full pass anyway.\n * - **After `disconnect()`** — Stimulus fires a callback for **every** target\n * during teardown, and a microtask queued just before it would otherwise run\n * against a detached tree. {@link MicrotaskCoalescer.cancel} exists for the\n * teardown path to drop the pending pass outright.\n *\n * Both guards are part of one contract here rather than something each consumer\n * has to remember separately.\n *\n * Scope is the scheduling only. *What* to reconcile — keep the surviving active\n * option, fall back to the next / previous / first visible one, rebuild derived\n * chips or hidden fields — stays in the controller, because no two consumers\n * answer it the same way.\n *\n * @example\n * ```ts\n * readonly #reconcile = new MicrotaskCoalescer(() => this.#reconcileOptions());\n *\n * connect() { this.#reconcile.activate(); }\n * disconnect() { this.#reconcile.cancel(); }\n *\n * optionTargetConnected() { this.#reconcile.schedule(); }\n * optionTargetDisconnected() { this.#reconcile.schedule(); }\n * ```\n */\nexport class MicrotaskCoalescer {\n readonly #run: () => void;\n #queued = false;\n #active = false;\n #generation = 0;\n\n /** @param run - the single reconciliation pass, invoked at most once per batch. */\n constructor(run: () => void) {\n this.#run = run;\n }\n\n /** Opens the window in which {@link schedule} is honoured; call from `connect()`. */\n activate(): void {\n this.#active = true;\n }\n\n /** Closes the window and drops any pending pass; call from `disconnect()`. */\n cancel(): void {\n this.#active = false;\n this.#queued = false;\n this.#generation += 1;\n }\n\n /** Whether a requested pass has yet to run. */\n get pending(): boolean {\n return this.#queued;\n }\n\n /** Requests one pass after the batch settles. Idempotent; inert outside the window. */\n schedule(): void {\n if (!this.#active || this.#queued) return;\n this.#queued = true;\n const generation = this.#generation;\n queueMicrotask(() => {\n // A cancelled callback must not consume a pass queued after reconnect.\n if (generation !== this.#generation || !this.#queued || !this.#active) return;\n this.#queued = false;\n this.#run();\n });\n }\n}\n","import { ListenerSet } from \"./listener_set\";\nimport { MicrotaskCoalescer } from \"./microtask_coalescer\";\n\n/**\n * Coalesces retained-element morphs and explicit lifecycle requests into one pass.\n *\n * Observe the controller's element after its initial state is settled. Morphs on\n * that element and bubbling morphs on its descendants share the same microtask\n * as {@link schedule}. The callback repairs derived output; the controller owns\n * any logical transition reporting. {@link disconnect} releases the listener and\n * cancels pending work, including work from an earlier connected lifetime.\n */\nexport class MorphRenderWatcher {\n readonly #listeners = new ListenerSet();\n readonly #pass: MicrotaskCoalescer;\n #element: Element | null = null;\n readonly #onMorph = (): void => this.#pass.schedule();\n\n /** @param run - the single pass that repairs the settled controller's output. */\n constructor(run: () => void) {\n this.#pass = new MicrotaskCoalescer(run);\n }\n\n /** Opens observation; observing the same element again preserves queued work. */\n observe(element: Element): void {\n if (this.#element === element) return;\n this.disconnect();\n this.#element = element;\n this.#pass.activate();\n this.#listeners.add(element, \"turbo:morph-element\", this.#onMorph);\n }\n\n /** Requests one pass; requests outside an observed lifetime are ignored. */\n schedule(): void {\n this.#pass.schedule();\n }\n\n /** Whether a pass requested by a morph or {@link schedule} has yet to run. */\n get pending(): boolean {\n return this.#pass.pending;\n }\n\n /** Releases observation and pending work synchronously; safe to repeat. */\n disconnect(): void {\n this.#listeners.dispose();\n this.#pass.cancel();\n this.#element = null;\n }\n}\n","/**\n * Largest delay a timer can hold: the platform stores it in a 32-bit signed\n * integer, and anything larger wraps around, so a delay meant to be far in the\n * future can fire almost immediately. A declared delay above this bound names\n * no delay at all, and a controller reading one falls back to its default.\n */\nexport const MAX_TIMER_DELAY_MS = 2_147_483_647;\n","import { MAX_TIMER_DELAY_MS } from \"./timer_bounds\";\n\n/** Semantic constraints on an already decoded number, independent of the DOM. */\nexport interface NumberBounds {\n /** Finite numbers are required, including when this field is omitted. */\n readonly finite?: true;\n /** Inclusive lower endpoint. */\n readonly min?: number;\n /** Inclusive upper endpoint. */\n readonly max?: number;\n /** Exclusive lower endpoint. */\n readonly exclusiveMin?: number;\n /** Require a number without a fractional part. */\n readonly integer?: boolean;\n /** Exact decoded numbers accepted by a discrete contract. */\n readonly allowedValues?: readonly number[];\n /** JSON-safe exceptions to finite-number checking for unbounded endpoints. */\n readonly allowInfinity?: \"negative\" | \"positive\" | \"both\";\n}\n\n/** One constraint for each Number Value, including shorthand declarations. */\nexport type NumberValueConstraints<Values> = {\n readonly [Key in keyof Values as Values[Key] extends\n | NumberConstructor\n | { type: NumberConstructor }\n ? Key\n : never]: NumberBounds;\n};\n\n/** Reusable semantic domains; fractional inputs remain fractional unless excluded. */\nexport const NUMBER_BOUNDS = {\n finite: { finite: true },\n nonNegative: { finite: true, min: 0 },\n positive: { finite: true, exclusiveMin: 0 },\n nonNegativeInteger: { finite: true, min: 0, integer: true },\n positiveInteger: { finite: true, exclusiveMin: 0, integer: true },\n lowerBound: { finite: true, allowInfinity: \"negative\" },\n upperBound: { finite: true, allowInfinity: \"positive\" },\n timer: { finite: true, min: 0, max: MAX_TIMER_DELAY_MS },\n positiveTimer: { finite: true, exclusiveMin: 0, max: MAX_TIMER_DELAY_MS },\n} as const satisfies Record<string, NumberBounds>;\n\n/**\n * Checks all declared bounds without rounding, clamping, or coercing the input.\n * Infinity exceptions relax only finite checking; every other bound still applies.\n */\nexport function matchesNumberBounds(value: number, bounds: NumberBounds): boolean {\n if (!Number.isFinite(value)) {\n const direction = value === Infinity ? \"positive\" : value === -Infinity ? \"negative\" : null;\n if (direction === null) return false;\n if (bounds.allowInfinity !== \"both\" && bounds.allowInfinity !== direction) return false;\n }\n if (bounds.min !== undefined && value < bounds.min) return false;\n if (bounds.max !== undefined && value > bounds.max) return false;\n if (bounds.exclusiveMin !== undefined && value <= bounds.exclusiveMin) return false;\n if (bounds.integer && !Number.isInteger(value)) return false;\n if (bounds.allowedValues !== undefined && !bounds.allowedValues.includes(value)) return false;\n return true;\n}\n\n/** Decodes a Number Value literal; action params use their own JSON decoder. */\nexport function decodeNumberValue(raw: string): number {\n return Number(raw.replace(/_/g, \"\"));\n}\n","/**\n * Numeric coercion for controllers that accept a number through a Value, an action\n * param, or an event detail.\n *\n * Stimulus decodes action params as JSON when possible and leaves other text\n * untouched. CustomEvent detail can also supply a number or numeric string.\n * The reader accepts those two types while rejecting blank and non-finite input.\n */\n\nimport { matchesNumberBounds, type NumberBounds } from \"./number_bounds\";\n\n/** Numeric update input, accepting decoded action params before CustomEvent detail. */\nexport type NumericValueEvent = Event & {\n params?: { amount?: unknown };\n detail?: { value?: unknown };\n};\n\n/** Reads the nullish action-param/detail precedence without falling back from invalid input. */\nexport function eventNumber(event: NumericValueEvent): number | null {\n return toFiniteNumber(event.params?.amount ?? event.detail?.value);\n}\n\n/**\n * Reads a finite number or nonblank numeric string; other input returns `null`.\n * Blank strings cannot silently reset a value to zero.\n */\nexport function toFiniteNumber(raw: unknown): number | null {\n if (typeof raw !== \"number\" && typeof raw !== \"string\") return null;\n if (typeof raw === \"string\" && raw.trim().length === 0) return null;\n const value = Number(raw);\n return Number.isFinite(value) ? value : null;\n}\n\n/**\n * Returns an accepted decoded Number Value or the caller's fallback unchanged.\n * The caller owns the fallback contract; this reader does not parse or write a Value.\n */\nexport function readNumber(raw: number, fallback: number, bounds: NumberBounds): number {\n return matchesNumberBounds(raw, bounds) ? raw : fallback;\n}\n","import { readNumber } from \"./coerce\";\nimport { matchesNumberBounds, type NumberBounds } from \"./number_bounds\";\n\n/** The instance identity carried by a Number Value read. */\nexport interface NumberValueOwner {\n readonly identifier: string;\n readonly element: Element;\n}\n\n/** Reads current declarations at the point of use without rewriting their attributes. */\nexport class NumberValueReader {\n /** The last rejected literal per Value; no history grows for an unchanged instance. */\n readonly #lastRejected = new Map<string, string>();\n\n /** Resolves the declared number using its own fallback and shared class contract. */\n read(\n owner: NumberValueOwner,\n name: string,\n raw: number,\n fallback: number,\n bounds: NumberBounds,\n ): number {\n const resolved = readNumber(raw, fallback, bounds);\n if (matchesNumberBounds(raw, bounds)) {\n this.#lastRejected.delete(name);\n return resolved;\n }\n const attribute = `data-${owner.identifier}-${name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}-value`;\n const literal = owner.element.getAttribute(attribute);\n if (literal === null) {\n this.#lastRejected.delete(name);\n return resolved;\n }\n if (this.#lastRejected.get(name) !== literal) {\n this.#lastRejected.set(name, literal);\n console.warn(\n `Stimeo UI: \"${owner.identifier}\" has an invalid number Value \"${name}\" declaration ${JSON.stringify(literal)}; using ${fallback}.`,\n );\n }\n return resolved;\n }\n}\n","/**\n * Reflects a serialized attribute value only when the current value differs.\n *\n * A same-value `setAttribute` still queues a mutation record for every observer, so an\n * unchanged value writes nothing.\n *\n * @param element - The element whose attribute is reflected.\n * @param name - The attribute name, using the non-namespaced DOM API.\n * @param value - The serialized value, or null to remove the attribute.\n * @param beforeWrite - Called only for a change, before the DOM mutation, so the\n * caller can record ownership or identify its own observer records.\n * @returns Whether an attribute was written or removed.\n */\nexport function setAttributeIfChanged(\n element: Element,\n name: string,\n value: string | null,\n beforeWrite?: () => void,\n): boolean {\n if (element.getAttribute(name) === value) return false;\n beforeWrite?.();\n if (value === null) element.removeAttribute(name);\n else element.setAttribute(name, value);\n return true;\n}\n","import { setAttributeIfChanged } from \"./attribute_write\";\n\n/** The original string and the last string written through one channel. */\nexport interface TextWrite {\n readonly original: string;\n readonly written: string;\n}\n\n/** Live evidence is tied to this instance and this exact element. */\nexport type TextEvidence =\n | { readonly source?: \"dom\" }\n | { readonly source: \"live\"; readonly allowOriginal?: boolean };\n\n/**\n * Records plain text or an input's value as `[channel, original, written]` in\n * an identifier-derived attribute supplied by the caller. Ownership requires a\n * valid record and the same current string; text containing an element is never\n * owned. The caller decides when to acquire, clear, restore, or forget a slot.\n *\n * DOM evidence survives a clone. Live evidence only describes writes made by\n * this instance to that element, so it can preserve a caller's held semantic\n * state or repair a morph that omitted the record. Neither proves who last\n * wrote an identical string. An optional guard protects other authored state.\n */\nexport class OwnedText<T extends HTMLElement = HTMLElement> {\n readonly #attribute: string;\n readonly #channel: \"text\" | \"value\";\n readonly #guard: (element: T) => boolean;\n readonly #writes = new WeakMap<T, TextWrite>();\n\n constructor(\n attribute: string,\n channel: \"text\" | \"value\" = \"text\",\n guard: (element: T) => boolean = () => true,\n ) {\n this.#attribute = attribute;\n this.#channel = channel;\n this.#guard = guard;\n }\n\n /** Whether the slot carries a record, including an invalid one. */\n hasRecord(element: T): boolean {\n return element.hasAttribute(this.#attribute);\n }\n\n /** Reads validated DOM evidence, or explicitly requested instance evidence. */\n read(element: T, evidence: TextEvidence = {}): TextWrite | null {\n if (evidence.source === \"live\") return this.#writes.get(element) ?? null;\n const raw = element.getAttribute(this.#attribute);\n if (raw === null) return null;\n try {\n const record: unknown = JSON.parse(raw);\n if (\n !Array.isArray(record) ||\n record.length !== 3 ||\n record[0] !== this.#channel ||\n typeof record[1] !== \"string\" ||\n typeof record[2] !== \"string\"\n )\n return null;\n return { original: record[1], written: record[2] };\n } catch {\n return null;\n }\n }\n\n /** Checks the current string, the text structure, and the caller's guard. */\n owns(element: T, evidence: TextEvidence = {}): boolean {\n return this.#ownedRecord(element, evidence) !== null;\n }\n\n /** Returns the matching evidence after checking structure and the caller's guard. */\n #ownedRecord(element: T, evidence: TextEvidence): TextWrite | null {\n const record = this.read(element, evidence);\n if (record === null || !this.#guard(element)) return null;\n if (this.#channel === \"text\" && element.firstElementChild !== null) return null;\n const current = this.#current(element);\n return current === record.written ||\n (evidence.source === \"live\" && evidence.allowOriginal === true && current === record.original)\n ? record\n : null;\n }\n\n /** Acquires the slot, preserving the first original unless the caller supplies one. */\n write(element: T, written: string, original?: string, force = false): void {\n const current = this.#current(element);\n if (current === null) return;\n const before =\n original ?? this.#writes.get(element)?.original ?? this.read(element)?.original ?? current;\n if (force || current !== written) this.#put(element, written);\n this.remember(element, written, before);\n }\n\n /** Records a write whose property assignment, such as caret handling, the caller owns. */\n remember(element: T, written: string, original?: string): void {\n const current = this.#current(element);\n if (current === null) return;\n const before =\n original ?? this.#writes.get(element)?.original ?? this.read(element)?.original ?? current;\n this.#writes.set(element, { original: before, written });\n setAttributeIfChanged(\n element,\n this.#attribute,\n JSON.stringify([this.#channel, before, written]),\n );\n }\n\n /** Empties an owned slot and releases its evidence. */\n clear(element: T, evidence: TextEvidence = {}): boolean {\n if (!this.owns(element, evidence)) return false;\n if (this.#current(element) !== \"\") this.#put(element, \"\");\n this.forget(element);\n return true;\n }\n\n /** Restores an owned slot's original string and releases its evidence. */\n restore(element: T, evidence: TextEvidence = {}): boolean {\n const record = this.#ownedRecord(element, evidence);\n if (record === null) return false;\n if (this.#current(element) !== record.original) this.#put(element, record.original);\n this.forget(element);\n return true;\n }\n\n /** Drops evidence without changing the slot, including an invalid DOM record. */\n forget(element: T): void {\n setAttributeIfChanged(element, this.#attribute, null);\n this.#writes.delete(element);\n }\n\n /** Reads the property belonging to this channel. */\n #current(element: T): string | null {\n if (this.#channel === \"text\") return element.textContent ?? \"\";\n return element instanceof HTMLInputElement ? element.value : null;\n }\n\n /** Writes the property belonging to this channel. */\n #put(element: T, text: string): void {\n if (this.#channel === \"text\") element.textContent = text;\n else if (element instanceof HTMLInputElement) element.value = text;\n }\n}\n","/**\n * Self-cleaning timer registries shared by Stimeo controllers.\n *\n * Stimulus controllers frequently schedule `setTimeout` / `setInterval` work\n * (auto-dismiss, debouncing, polling). When the element leaves the DOM — a\n * Turbo Drive navigation, a Turbo Stream replacement, or any `disconnect()` —\n * orphaned timers keep firing against a detached controller, leaking memory and\n * mutating stale state. {@link SafeTimeout} and {@link SafeInterval} track every\n * timer they create so a single {@link TimerRegistry.clearAll | clearAll()} call\n * in `disconnect()` tears them all down.\n *\n * These are intentionally low-level primitives: they own *registration and\n * cleanup only*. One pending timer per key is `KeyedTimers`\n * (`keyed_timers.ts`), and a timer a person can hold open, with its remaining-time\n * accounting, is `PausableTimers` (`pausable_timers.ts`).\n */\n\nexport { MAX_TIMER_DELAY_MS } from \"./timer_bounds\";\n\n/**\n * Shared registry bookkeeping for the timeout/interval variants.\n *\n * Subclasses provide the scheduling primitive ({@link schedule}) and its matching\n * canceller ({@link cancel}); this base owns the set of live ids plus the\n * per-id and bulk teardown shared by both.\n */\nabstract class TimerRegistry {\n /** Live timer ids that have not yet been cleared (or, for timeouts, fired). */\n protected readonly ids = new Set<number>();\n\n /** Schedules the underlying platform timer and returns its id. */\n protected abstract schedule(callback: () => void, delay: number): number;\n\n /** Cancels the underlying platform timer for `id`. */\n protected abstract cancel(id: number): void;\n\n /**\n * Cancels a single tracked timer.\n *\n * No-ops if the id is unknown (already cleared, fired, or never owned by this\n * registry), so callers can clear defensively without guarding.\n */\n clear(id: number): void {\n if (this.ids.delete(id)) {\n this.cancel(id);\n }\n }\n\n /**\n * Cancels every tracked timer. Call this from a controller's `disconnect()`\n * to guarantee no timer outlives the element.\n */\n clearAll(): void {\n for (const id of this.ids) {\n this.cancel(id);\n }\n this.ids.clear();\n }\n\n /** Number of timers currently tracked (pending). */\n get size(): number {\n return this.ids.size;\n }\n}\n\n/**\n * `setTimeout` wrapper that auto-forgets each timer once it fires and supports\n * bulk teardown on disconnect.\n *\n * @example\n * ```ts\n * #timers = new SafeTimeout();\n *\n * connect() {\n * this.#timers.set(() => this.dismiss(), 5000);\n * }\n *\n * disconnect() {\n * this.#timers.clearAll();\n * }\n * ```\n */\nexport class SafeTimeout extends TimerRegistry {\n /**\n * Schedules `callback` after `delay` ms and returns the timer id.\n *\n * The id is removed from the registry automatically when the timeout fires,\n * so {@link TimerRegistry.size | size} reflects only still-pending timers.\n */\n set(callback: () => void, delay: number): number {\n const id = this.schedule(() => {\n this.ids.delete(id);\n callback();\n }, delay);\n this.ids.add(id);\n return id;\n }\n\n protected schedule(callback: () => void, delay: number): number {\n return window.setTimeout(callback, delay);\n }\n\n protected cancel(id: number): void {\n window.clearTimeout(id);\n }\n}\n\n/**\n * `setInterval` wrapper that tracks every interval for bulk teardown on\n * disconnect. Unlike {@link SafeTimeout}, intervals are retained until they are\n * explicitly cleared because they fire repeatedly.\n *\n * @example\n * ```ts\n * #intervals = new SafeInterval();\n *\n * connect() {\n * this.#intervals.set(() => this.tick(), 1000);\n * }\n *\n * disconnect() {\n * this.#intervals.clearAll();\n * }\n * ```\n */\nexport class SafeInterval extends TimerRegistry {\n /** Schedules a repeating `callback` every `delay` ms and returns the timer id. */\n set(callback: () => void, delay: number): number {\n const id = this.schedule(callback, delay);\n this.ids.add(id);\n return id;\n }\n\n protected schedule(callback: () => void, delay: number): number {\n return window.setInterval(callback, delay);\n }\n\n protected cancel(id: number): void {\n window.clearInterval(id);\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport { announce } from \"../utils/announce\";\nimport { setDefaultAttribute } from \"../utils/default_attribute\";\nimport { MorphRenderWatcher } from \"../utils/morph_render_watcher\";\nimport { NUMBER_BOUNDS, type NumberValueConstraints } from \"../utils/number_bounds\";\nimport { NumberValueReader } from \"../utils/number_value\";\nimport { OwnedText } from \"../utils/owned_text\";\nimport { SafeTimeout } from \"../utils/safe_timeout\";\n\n/**\n * The `data-state` values this controller writes itself. Any other value on the\n * attribute was authored by the consumer and is left alone.\n */\nconst TRANSIENT_STATES = new Set([\"copied\", \"error\"]);\n\n/**\n * Headless copy-to-clipboard behavior with a completion slot and a screen-reader\n * announcement.\n *\n * Markup contract (identifier: `stimeo--clipboard`):\n * <div data-controller=\"stimeo--clipboard\"\n * data-stimeo--clipboard-feedback-duration-value=\"2000\"\n * data-stimeo--clipboard-announce-copied-text-value=\"Copied to clipboard\"\n * data-stimeo--clipboard-announce-error-text-value=\"Copy failed\">\n * <input type=\"text\" value=\"https://example.com\" readonly\n * data-stimeo--clipboard-target=\"source\">\n * <button type=\"button\" data-stimeo--clipboard-target=\"button\"\n * data-action=\"click->stimeo--clipboard#copy\">Copy</button>\n * <span data-stimeo--clipboard-target=\"feedback\"></span>\n * </div>\n *\n * No dedicated APG pattern; this follows the Button practice plus a status message\n * ({@link https://www.w3.org/WAI/WCAG22/Understanding/status-changes.html | WCAG 2.2 SC 4.1.3}).\n * The copy uses the standard `navigator.clipboard` API (no extra dependency); every\n * failure mode — an API the browser withholds outside a secure context as much as a\n * rejected permission — settles the same way, as `data-state=\"error\"` plus the\n * `copy` event's `success: false`.\n *\n * Targets: `source` (the text to copy, when `text` is not set), `button` (the\n * control that triggers `copy`), `feedback` (the **visible** completion slot).\n *\n * Values: `text` (copy this instead of reading `source`), `feedbackDuration` (ms the\n * completion state is held; `0` or less arms no timer, so it stands until the next\n * copy — a reconnect still clears it), `copiedLabel` /\n * `errorLabel` (what the visible slot shows), `announceCopiedText` /\n * `announceErrorText` (what assistive tech hears; empty announces nothing).\n *\n * @remarks\n * Behavior only — icon swaps and styling are the consumer's, keyed off `data-state`\n * (`idle` / `copied` / `error`).\n *\n * **The `feedback` slot must not carry live-region semantics.** Announcing is the\n * page's shared `stimeo--announcer` job: it is seated before the change it reads,\n * which a slot filled on demand cannot be, and it already collapses a repeat of the\n * same wording so a second copy is still heard. A `role=\"status\"` on the slot as\n * well would say everything twice.\n *\n * `copied` and `error` are transient: the timer that clears them belongs to one\n * connection, so a fresh `connect()` that finds either — a page Turbo restores from its\n * cache, an in-page move — returns to `idle`, silently. `turbo:before-cache` changes\n * nothing: Turbo also dispatches it on pages that stay (a promoted frame navigation, a\n * `popstate` without Turbo state, a refresh of a cached URL), where the result is still\n * on screen and its return to idle still due. Returning to `idle` empties only a slot that\n * still shows the wording a copy wrote there; a slot the page swapped in, rewrote, or put\n * an element into keeps what it holds.\n *\n * A `copiedLabel` / `errorLabel` changed on the live element while its result is\n * shown rewrites the slot — only while the slot still reads the label the copy wrote\n * — without announcing, dispatching or moving the return to idle. Stimulus reports no\n * change when a label attribute whose value was empty is removed, so the slot keeps\n * the empty label until the next copy. `feedbackDuration` and the announcement texts\n * belong to one copy, so a change to them applies from the next.\n */\nexport class ClipboardController extends Controller<HTMLElement> {\n /** Numeric read boundaries share one reader for this controller instance. */\n readonly #numbers = new NumberValueReader();\n\n static override targets = [\"source\", \"button\", \"feedback\"];\n static override values = {\n text: { type: String, default: \"\" },\n feedbackDuration: { type: Number, default: 2000 },\n copiedLabel: { type: String, default: \"Copied\" },\n errorLabel: { type: String, default: \"Copy failed\" },\n announceCopiedText: { type: String, default: \"\" },\n announceErrorText: { type: String, default: \"\" },\n };\n\n static valueConstraints = {\n feedbackDuration: NUMBER_BOUNDS.timer,\n } satisfies NumberValueConstraints<typeof ClipboardController.values>;\n static actions = [\"copy\"] as const;\n static events = [\"copy\"] as const;\n\n declare readonly sourceTarget: HTMLElement;\n declare readonly buttonTarget: HTMLElement;\n declare readonly feedbackTarget: HTMLElement;\n declare readonly feedbackTargets: HTMLElement[];\n declare readonly hasSourceTarget: boolean;\n declare readonly hasButtonTarget: boolean;\n declare readonly hasFeedbackTarget: boolean;\n\n declare textValue: string;\n declare feedbackDurationValue: number;\n declare copiedLabelValue: string;\n declare errorLabelValue: string;\n declare announceCopiedTextValue: string;\n declare announceErrorTextValue: string;\n\n /**\n * The pending return to idle — the only timer this controller schedules, so\n * `clearAll()` is exactly \"drop the auto-clear\" and needs no id of its own.\n */\n readonly #timers = new SafeTimeout();\n\n /**\n * Whether this connection is still live. `copy()` suspends on the Clipboard API,\n * and a teardown that lands while it is suspended must win: the continuation\n * would otherwise write to an element nobody owns and arm a timer past the\n * `clearAll()` that was supposed to be the last word. Stimulus also runs the label\n * callbacks ahead of `connect()`, while this is still false: a result restored with\n * the markup is `connect()`'s to settle, not theirs.\n */\n #connected = false;\n #result: boolean | null = null;\n /** The first slot's authored baseline, retained until a copy acquires another slot. */\n #feedback: { element: HTMLElement; original: string } | null = null;\n readonly #feedbackText = new OwnedText(`data-${this.identifier}-feedback-text`);\n /**\n * Every feedback this controller wrote a result's wording into. It\n * outlives a connection, so an in-page move still knows what it wrote.\n */\n readonly #written = new Set<HTMLElement>();\n readonly #morphRender = new MorphRenderWatcher(() => this.#renderResult());\n\n override connect(): void {\n this.#connected = true;\n this.#adopt();\n this.#result = null;\n this.#feedback = this.hasFeedbackTarget\n ? { element: this.feedbackTarget, original: this.feedbackTarget.textContent ?? \"\" }\n : null;\n this.#morphRender.observe(this.element);\n }\n\n override disconnect(): void {\n this.#connected = false;\n this.#morphRender.disconnect();\n this.#timers.clearAll();\n }\n\n /**\n * Follows a `copiedLabel` swapped in place while a successful copy is shown.\n *\n * Render only: nothing is announced or dispatched, and the return to idle keeps the\n * deadline the copy set. The slot changes only while `data-state` is `copied` and it\n * still reads the previous label — the one the copy wrote there — so text someone\n * else put in the slot stays. Stimulus also runs this ahead of `connect()`, which\n * settles a result restored with the markup itself, so nothing is written then.\n */\n copiedLabelValueChanged(label: string, previous: string | undefined): void {\n this.#followLabel(\"copied\", label, previous);\n }\n\n /**\n * Follows an `errorLabel` swapped in place while a failed copy is shown, on the same\n * terms as {@link ClipboardController.copiedLabelValueChanged}: only while\n * `data-state` is `error` and the slot still reads the previous label.\n */\n errorLabelValueChanged(label: string, previous: string | undefined): void {\n this.#followLabel(\"error\", label, previous);\n }\n\n /**\n * Copies the resolved text and reports the outcome. Bound via `data-action`\n * (click). Dispatches `stimeo--clipboard:copy` with `{ success, text, message }`\n * once per completed attempt — including on failure — so consumers can react\n * either way. `message` is the authored label for that outcome, so a part that\n * shows wording — `stimeo--clipboard:copy->stimeo--toast#show` — needs nothing\n * else; wiring both that and the announcer reads the same result twice.\n * An attempt whose connection ended while it was in flight reports nothing.\n */\n async copy(): Promise<void> {\n const text = this.#resolveText();\n let success = false;\n try {\n await navigator.clipboard.writeText(text);\n success = true;\n } catch {\n success = false;\n }\n if (!this.#connected) return;\n\n this.#reportResult(success);\n const message = success ? this.copiedLabelValue : this.errorLabelValue;\n this.dispatch(\"copy\", { detail: { success, text, message } });\n }\n\n /**\n * The text to copy: the explicit `text` value when set, otherwise the source\n * target's current value (inputs/textareas) or text content.\n */\n #resolveText(): string {\n if (this.textValue.length > 0) return this.textValue;\n if (!this.hasSourceTarget) return \"\";\n const source = this.sourceTarget;\n if (source instanceof HTMLInputElement || source instanceof HTMLTextAreaElement) {\n return source.value;\n }\n return source.textContent ?? \"\";\n }\n\n /**\n * Reads the current state back from the DOM.\n *\n * A `copied` or `error` found at connect time is this controller's own output\n * from a connection that is gone, and so is the timer that would have cleared it;\n * any other authored `data-state` value belongs to the consumer, and only a missing\n * attribute takes the default. Only a feedback still showing the text recorded as\n * written in `data-<identifier>-feedback-text` (`[\"text\", original, written]`) is\n * emptied.\n */\n #adopt(): void {\n if (this.#inTransientState()) {\n this.#reset();\n for (const element of this.feedbackTargets) this.#feedbackText.clear(element);\n return;\n }\n setDefaultAttribute(this.element, \"data-state\", \"idle\");\n }\n\n /** Whether `data-state` currently holds one of the values this controller writes. */\n #inTransientState(): boolean {\n const state = this.element.getAttribute(\"data-state\");\n return state !== null && TRANSIENT_STATES.has(state);\n }\n\n /**\n * Reflects the result, announces it, and schedules the return to idle.\n */\n #reportResult(success: boolean): void {\n this.#result = success;\n this.#renderResult(true);\n this.#announceResult(success);\n this.#scheduleReset();\n }\n\n /**\n * Repairs a held result without repeating its announcement or extending its deadline.\n * @stimeoRenderRoot\n */\n #renderResult(force = false): void {\n if (this.#result === null) {\n setDefaultAttribute(this.element, \"data-state\", \"idle\");\n return;\n }\n this.element.setAttribute(\"data-state\", this.#result ? \"copied\" : \"error\");\n if (!this.hasFeedbackTarget) return;\n const element = this.feedbackTarget;\n if (!force && (element !== this.#feedback?.element || !this.#ownsFeedback(element))) return;\n const text = this.#result ? this.copiedLabelValue : this.errorLabelValue;\n const original =\n element === this.#feedback?.element ? this.#feedback.original : (element.textContent ?? \"\");\n this.#feedback = { element, original };\n this.#feedbackText.write(element, text, original, force);\n this.#written.add(element);\n }\n\n /** A morph may omit the record while returning this same slot to its original text. */\n #ownsFeedback(element: HTMLElement): boolean {\n return (\n this.#feedbackText.owns(element) ||\n (!this.#feedbackText.hasRecord(element) &&\n this.#feedbackText.owns(element, { source: \"live\", allowOriginal: true }))\n );\n }\n\n /**\n * Reads the result out through the shared announcer.\n *\n * @stimeoRuntimeOnly `announceCopiedText` / `announceErrorText` word the one announcement a copy\n * makes.\n */\n #announceResult(success: boolean): void {\n announce(success ? this.announceCopiedTextValue : this.announceErrorTextValue);\n }\n\n /**\n * Arms the return to idle for the result just shown.\n *\n * @stimeoRuntimeOnly `feedbackDuration` is the delay of the one timer this call arms, and the\n * reset that timer runs reads no Value.\n */\n #scheduleReset(): void {\n // Drop any in-flight reset so consecutive copies restart the full window\n // rather than having the earlier timer clear the new result prematurely.\n this.#timers.clearAll();\n if (this.#safeFeedbackDuration > 0) {\n this.#timers.set(() => this.#reset(), this.#safeFeedbackDuration);\n }\n }\n\n /**\n * Rewrites the slot to `label` while `state` is shown and the slot still reads\n * `previous`, the label this controller wrote for that result.\n */\n #followLabel(state: \"copied\" | \"error\", label: string, previous: string | undefined): void {\n if (!this.#connected) return;\n if (this.element.getAttribute(\"data-state\") !== state || !this.hasFeedbackTarget) return;\n const element = this.feedbackTarget;\n if (\n element !== this.#feedback?.element ||\n element.textContent !== previous ||\n !this.#ownsFeedback(element)\n )\n return;\n this.#feedbackText.write(element, label);\n this.#written.add(element);\n }\n\n /**\n * Returns to the idle state and empties each feedback this controller wrote into that is\n * still a feedback target showing the wording written there and nothing else. A slot the\n * page swapped in, rewrote, or put an element into keeps what it holds.\n */\n #reset(): void {\n this.#result = null;\n this.element.setAttribute(\"data-state\", \"idle\");\n for (const element of this.#written) {\n if (this.feedbackTargets.includes(element))\n this.#feedbackText.clear(\n element,\n this.#feedbackText.hasRecord(element) ? {} : { source: \"live\" },\n );\n this.#feedbackText.forget(element);\n }\n this.#written.clear();\n }\n /** Current `feedbackDuration` declaration resolved against its numeric contract. */\n get #safeFeedbackDuration(): number {\n return this.#numbers.read(\n this,\n \"feedbackDuration\",\n this.feedbackDurationValue,\n ClipboardController.values.feedbackDuration.default,\n ClipboardController.valueConstraints.feedbackDuration,\n );\n }\n}\n"]}
|
|
@@ -22,7 +22,7 @@ import { Controller } from '@hotwired/stimulus';
|
|
|
22
22
|
* </button>
|
|
23
23
|
*
|
|
24
24
|
* Implements the WAI-ARIA APG **Disclosure** pattern for a single inline region.
|
|
25
|
-
* Unlike
|
|
25
|
+
* Unlike `stimeo--accordion` it manages exactly one trigger/content pair
|
|
26
26
|
* with no sibling coordination, and unlike a dropdown the content expands in
|
|
27
27
|
* flow and never closes on an outside click.
|
|
28
28
|
*
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import { Controller } from '@hotwired/stimulus';
|
|
2
2
|
|
|
3
|
+
function setAttributeIfChanged(element, name, value, beforeWrite) {
|
|
4
|
+
if (element.getAttribute(name) === value) return false;
|
|
5
|
+
if (value === null) element.removeAttribute(name);
|
|
6
|
+
else element.setAttribute(name, value);
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
|
|
3
10
|
function sharedRegistry(key, create) {
|
|
4
11
|
const symbol = Symbol.for(key);
|
|
5
12
|
const scope = globalThis;
|
|
6
13
|
const existing = scope[symbol];
|
|
7
14
|
if (existing !== void 0) return existing;
|
|
8
|
-
const
|
|
9
|
-
Object.defineProperty(globalThis, symbol, { value:
|
|
10
|
-
return
|
|
15
|
+
const registry2 = create();
|
|
16
|
+
Object.defineProperty(globalThis, symbol, { value: registry2 });
|
|
17
|
+
return registry2;
|
|
11
18
|
}
|
|
12
19
|
|
|
20
|
+
var registry = sharedRegistry(
|
|
21
|
+
"stimeo-ui.attribute-lease.registry.v1",
|
|
22
|
+
() => ({ stacks: /* @__PURE__ */ new WeakMap(), names: /* @__PURE__ */ new Map() })
|
|
23
|
+
);
|
|
13
24
|
function isAttributeValue(value) {
|
|
14
25
|
return value === null || typeof value === "string";
|
|
15
26
|
}
|
|
@@ -26,24 +37,46 @@ function readLeaseRecord(element, record) {
|
|
|
26
37
|
return void 0;
|
|
27
38
|
}
|
|
28
39
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
);
|
|
40
|
+
function attributeStack(element, attribute) {
|
|
41
|
+
const byAttribute = registry.stacks.get(element) ?? /* @__PURE__ */ new Map();
|
|
42
|
+
registry.stacks.set(element, byAttribute);
|
|
43
|
+
const known = byAttribute.get(attribute);
|
|
44
|
+
if (known) return known;
|
|
45
|
+
const found = [];
|
|
46
|
+
for (const record of registry.names.get(attribute) ?? []) {
|
|
47
|
+
const read = readLeaseRecord(element, record);
|
|
48
|
+
if (read) found.push({ ...read, record });
|
|
49
|
+
}
|
|
50
|
+
const depth = ({ beneath }) => beneath.filter((name) => found.some((other) => other.record === name)).length;
|
|
51
|
+
const stack = found.sort((one, other) => depth(one) - depth(other)).map(({ record, written, original, linked }, index) => ({
|
|
52
|
+
lease: null,
|
|
53
|
+
record,
|
|
54
|
+
written,
|
|
55
|
+
original,
|
|
56
|
+
linked: linked && index > 0
|
|
57
|
+
}));
|
|
58
|
+
byAttribute.set(attribute, stack);
|
|
59
|
+
return stack;
|
|
60
|
+
}
|
|
61
|
+
function findHold(stack, lease, record) {
|
|
62
|
+
return stack.find((held) => held.lease === lease) ?? stack.find((held) => held.lease === null && held.record === record);
|
|
63
|
+
}
|
|
64
|
+
var AttributeLease = class {
|
|
34
65
|
#attribute;
|
|
35
66
|
#record;
|
|
36
67
|
#base;
|
|
68
|
+
#preserveAuthor;
|
|
37
69
|
#held = /* @__PURE__ */ new Set();
|
|
38
70
|
constructor(attribute, owner, options = {}) {
|
|
39
71
|
this.#attribute = attribute;
|
|
40
72
|
this.#record = `data-${owner}-${attribute}-lease`;
|
|
41
73
|
this.#base = options.base === true;
|
|
42
|
-
|
|
74
|
+
this.#preserveAuthor = options.preserveAuthor === true;
|
|
75
|
+
const names = registry.names;
|
|
43
76
|
names.set(attribute, (names.get(attribute) ?? /* @__PURE__ */ new Set()).add(this.#record));
|
|
44
77
|
}
|
|
45
78
|
write(element, value) {
|
|
46
|
-
const stack = this.#
|
|
79
|
+
const stack = attributeStack(element, this.#attribute);
|
|
47
80
|
const hold = this.#take(stack) ?? this.#acquire(element, stack);
|
|
48
81
|
this.#held.add(element);
|
|
49
82
|
const shows = !this.#covered(element, stack, hold);
|
|
@@ -53,8 +86,8 @@ var AttributeLease = class _AttributeLease {
|
|
|
53
86
|
}
|
|
54
87
|
return(element) {
|
|
55
88
|
const held = this.#held.delete(element);
|
|
56
|
-
const known =
|
|
57
|
-
const stack = held || known || element.hasAttribute(this.#record) ? this.#
|
|
89
|
+
const known = registry.stacks.get(element)?.has(this.#attribute);
|
|
90
|
+
const stack = held || known || element.hasAttribute(this.#record) ? attributeStack(element, this.#attribute) : [];
|
|
58
91
|
const hold = this.#take(stack);
|
|
59
92
|
if (!hold) return false;
|
|
60
93
|
const carries = element.getAttribute(this.#attribute) === hold.written;
|
|
@@ -72,31 +105,8 @@ var AttributeLease = class _AttributeLease {
|
|
|
72
105
|
returnAll() {
|
|
73
106
|
for (const element of Array.from(this.#held)) this.return(element);
|
|
74
107
|
}
|
|
75
|
-
#stack(element) {
|
|
76
|
-
const stacks = _AttributeLease.#registry.stacks;
|
|
77
|
-
const byAttribute = stacks.get(element) ?? /* @__PURE__ */ new Map();
|
|
78
|
-
stacks.set(element, byAttribute);
|
|
79
|
-
const stack = byAttribute.get(this.#attribute) ?? this.#seed(element);
|
|
80
|
-
byAttribute.set(this.#attribute, stack);
|
|
81
|
-
return stack;
|
|
82
|
-
}
|
|
83
|
-
#seed(element) {
|
|
84
|
-
const found = [];
|
|
85
|
-
for (const record of _AttributeLease.#registry.names.get(this.#attribute) ?? []) {
|
|
86
|
-
const read = readLeaseRecord(element, record);
|
|
87
|
-
if (read) found.push({ ...read, record });
|
|
88
|
-
}
|
|
89
|
-
const depth = ({ beneath }) => beneath.filter((name) => found.some((other) => other.record === name)).length;
|
|
90
|
-
return found.sort((one, other) => depth(one) - depth(other)).map(({ record, written, original, linked }, index) => ({
|
|
91
|
-
lease: null,
|
|
92
|
-
record,
|
|
93
|
-
written,
|
|
94
|
-
original,
|
|
95
|
-
linked: linked && index > 0
|
|
96
|
-
}));
|
|
97
|
-
}
|
|
98
108
|
#take(stack) {
|
|
99
|
-
const hold = stack
|
|
109
|
+
const hold = findHold(stack, this, this.#record);
|
|
100
110
|
if (hold) hold.lease = this;
|
|
101
111
|
return hold;
|
|
102
112
|
}
|
|
@@ -105,7 +115,7 @@ var AttributeLease = class _AttributeLease {
|
|
|
105
115
|
const top = stack.at(-1);
|
|
106
116
|
const bottom = stack[0];
|
|
107
117
|
const over = top?.written === current ? top : void 0;
|
|
108
|
-
const from = this.#base ? bottom : over;
|
|
118
|
+
const from = this.#base ? this.#preserveAuthor && !stack.some((held) => held.written === current) ? void 0 : bottom : over;
|
|
109
119
|
const hold = {
|
|
110
120
|
lease: this,
|
|
111
121
|
record: this.#record,
|
|
@@ -135,15 +145,11 @@ var AttributeLease = class _AttributeLease {
|
|
|
135
145
|
);
|
|
136
146
|
});
|
|
137
147
|
for (const [name, recorded] of records) {
|
|
138
|
-
|
|
139
|
-
if (recorded === null) element.removeAttribute(name);
|
|
140
|
-
else element.setAttribute(name, recorded);
|
|
148
|
+
setAttributeIfChanged(element, name, recorded);
|
|
141
149
|
}
|
|
142
150
|
}
|
|
143
151
|
#reflect(element, value) {
|
|
144
|
-
|
|
145
|
-
if (value === null) element.removeAttribute(this.#attribute);
|
|
146
|
-
else element.setAttribute(this.#attribute, value);
|
|
152
|
+
setAttributeIfChanged(element, this.#attribute, value);
|
|
147
153
|
}
|
|
148
154
|
};
|
|
149
155
|
|
|
@@ -200,9 +206,8 @@ var StateRegions = class _StateRegions {
|
|
|
200
206
|
const below = hold.linked ? stack[index - 1] : void 0;
|
|
201
207
|
if (below) {
|
|
202
208
|
if (region.hidden !== below.written) region.hidden = below.written;
|
|
203
|
-
} else
|
|
204
|
-
|
|
205
|
-
else region.setAttribute("hidden", hold.authored);
|
|
209
|
+
} else {
|
|
210
|
+
setAttributeIfChanged(region, "hidden", hold.authored);
|
|
206
211
|
}
|
|
207
212
|
}
|
|
208
213
|
this.#mark(region, stack);
|
|
@@ -277,9 +282,7 @@ var StateRegions = class _StateRegions {
|
|
|
277
282
|
);
|
|
278
283
|
});
|
|
279
284
|
for (const [name, recorded] of records) {
|
|
280
|
-
|
|
281
|
-
if (recorded === null) region.removeAttribute(name);
|
|
282
|
-
else region.setAttribute(name, recorded);
|
|
285
|
+
setAttributeIfChanged(region, name, recorded);
|
|
283
286
|
}
|
|
284
287
|
}
|
|
285
288
|
#recorded(region, name) {
|