stimeo-ui 0.11.0 → 0.13.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 +107 -0
- package/dist/cable/index.d.ts +67 -13
- package/dist/cable/index.js +461 -154
- package/dist/cable/index.js.map +1 -1
- package/dist/controllers/alert_dialog_controller.d.ts +1 -1
- package/dist/controllers/alert_dialog_controller.js.map +1 -1
- package/dist/controllers/announcer_controller.d.ts +1 -1
- package/dist/controllers/announcer_controller.js.map +1 -1
- package/dist/controllers/auto_submit_controller.js.map +1 -1
- package/dist/controllers/breadcrumb_controller.d.ts +1 -1
- package/dist/controllers/breadcrumb_controller.js.map +1 -1
- package/dist/controllers/calendar_controller.d.ts +2 -1
- package/dist/controllers/calendar_controller.js +10 -2
- package/dist/controllers/calendar_controller.js.map +1 -1
- package/dist/controllers/carousel_controller.js +1 -1
- package/dist/controllers/carousel_controller.js.map +1 -1
- package/dist/controllers/character_counter_controller.js.map +1 -1
- package/dist/controllers/clipboard_controller.d.ts +1 -1
- package/dist/controllers/clipboard_controller.js.map +1 -1
- package/dist/controllers/collapsible_controller.js.map +1 -1
- package/dist/controllers/color_picker_controller.d.ts +1 -1
- package/dist/controllers/color_picker_controller.js.map +1 -1
- package/dist/controllers/command_palette_controller.d.ts +3 -3
- package/dist/controllers/command_palette_controller.js +2 -2
- package/dist/controllers/command_palette_controller.js.map +1 -1
- package/dist/controllers/conditional_fields_controller.js.map +1 -1
- package/dist/controllers/confirm_controller.d.ts +2 -2
- package/dist/controllers/confirm_controller.js.map +1 -1
- package/dist/controllers/context_menu_controller.d.ts +1 -1
- package/dist/controllers/context_menu_controller.js.map +1 -1
- package/dist/controllers/count_up_controller.d.ts +12 -10
- package/dist/controllers/count_up_controller.js +74 -35
- package/dist/controllers/count_up_controller.js.map +1 -1
- package/dist/controllers/countdown_controller.d.ts +1 -1
- package/dist/controllers/countdown_controller.js.map +1 -1
- package/dist/controllers/data_grid_controller.d.ts +1 -1
- package/dist/controllers/data_grid_controller.js.map +1 -1
- package/dist/controllers/date_range_picker_controller.js +10 -10
- package/dist/controllers/date_range_picker_controller.js.map +1 -1
- package/dist/controllers/dialog_controller.d.ts +1 -1
- package/dist/controllers/dialog_controller.js.map +1 -1
- package/dist/controllers/direct_upload_controller.js.map +1 -1
- package/dist/controllers/dirty_form_controller.js.map +1 -1
- package/dist/controllers/dismissible_controller.js.map +1 -1
- package/dist/controllers/drawer_controller.d.ts +2 -2
- package/dist/controllers/drawer_controller.js +2 -2
- package/dist/controllers/drawer_controller.js.map +1 -1
- package/dist/controllers/dropdown_controller.d.ts +1 -1
- package/dist/controllers/dropdown_controller.js.map +1 -1
- package/dist/controllers/file_dropzone_controller.js.map +1 -1
- package/dist/controllers/flash_controller.js.map +1 -1
- package/dist/controllers/focus_controller.d.ts +2 -2
- package/dist/controllers/focus_controller.js.map +1 -1
- package/dist/controllers/form_validation_controller.js.map +1 -1
- package/dist/controllers/frame_loading_controller.d.ts +3 -3
- package/dist/controllers/frame_loading_controller.js.map +1 -1
- package/dist/controllers/highlight_controller.js.map +1 -1
- package/dist/controllers/hover_card_controller.d.ts +1 -1
- package/dist/controllers/hover_card_controller.js.map +1 -1
- package/dist/controllers/idle_controller.d.ts +1 -1
- package/dist/controllers/idle_controller.js.map +1 -1
- package/dist/controllers/input_mask_controller.js.map +1 -1
- package/dist/controllers/intersection_controller.d.ts +20 -7
- package/dist/controllers/intersection_controller.js +55 -8
- package/dist/controllers/intersection_controller.js.map +1 -1
- package/dist/controllers/lazy_frame_controller.d.ts +31 -9
- package/dist/controllers/lazy_frame_controller.js +81 -19
- package/dist/controllers/lazy_frame_controller.js.map +1 -1
- package/dist/controllers/listbox_controller.js.map +1 -1
- package/dist/controllers/local_time_controller.d.ts +1 -1
- package/dist/controllers/local_time_controller.js.map +1 -1
- package/dist/controllers/masonry_controller.d.ts +1 -1
- package/dist/controllers/masonry_controller.js.map +1 -1
- package/dist/controllers/menu_controller.d.ts +1 -1
- package/dist/controllers/menu_controller.js.map +1 -1
- package/dist/controllers/menubar_controller.d.ts +2 -2
- package/dist/controllers/menubar_controller.js.map +1 -1
- package/dist/controllers/navigation_menu_controller.d.ts +1 -1
- package/dist/controllers/navigation_menu_controller.js.map +1 -1
- package/dist/controllers/nested_form_controller.js.map +1 -1
- package/dist/controllers/network_status_controller.js.map +1 -1
- package/dist/controllers/number_input_controller.js.map +1 -1
- package/dist/controllers/optimistic_controller.d.ts +23 -10
- package/dist/controllers/optimistic_controller.js +141 -20
- package/dist/controllers/optimistic_controller.js.map +1 -1
- package/dist/controllers/overflow_indicator_controller.d.ts +1 -1
- package/dist/controllers/overflow_indicator_controller.js.map +1 -1
- package/dist/controllers/overflow_menu_controller.js.map +1 -1
- package/dist/controllers/pagination_controller.js.map +1 -1
- package/dist/controllers/password_reveal_controller.js.map +1 -1
- package/dist/controllers/password_strength_controller.d.ts +2 -1
- package/dist/controllers/password_strength_controller.js.map +1 -1
- package/dist/controllers/persist_controller.js.map +1 -1
- package/dist/controllers/pointer_drag_controller.js +4 -0
- package/dist/controllers/pointer_drag_controller.js.map +1 -1
- package/dist/controllers/popover_controller.d.ts +1 -1
- package/dist/controllers/popover_controller.js.map +1 -1
- package/dist/controllers/portal_controller.d.ts +2 -2
- package/dist/controllers/portal_controller.js.map +1 -1
- package/dist/controllers/radio_group_controller.d.ts +1 -1
- package/dist/controllers/radio_group_controller.js.map +1 -1
- package/dist/controllers/reading_progress_controller.d.ts +18 -9
- package/dist/controllers/reading_progress_controller.js +177 -6
- package/dist/controllers/reading_progress_controller.js.map +1 -1
- package/dist/controllers/relative_time_controller.d.ts +3 -3
- package/dist/controllers/relative_time_controller.js.map +1 -1
- package/dist/controllers/roving_controller.d.ts +1 -1
- package/dist/controllers/roving_controller.js.map +1 -1
- package/dist/controllers/scroll_area_controller.js.map +1 -1
- package/dist/controllers/scrollspy_controller.js +13 -2
- package/dist/controllers/scrollspy_controller.js.map +1 -1
- package/dist/controllers/sidebar_controller.d.ts +1 -1
- package/dist/controllers/sidebar_controller.js.map +1 -1
- package/dist/controllers/skeleton_controller.d.ts +2 -2
- package/dist/controllers/skeleton_controller.js.map +1 -1
- package/dist/controllers/smart_sticky_header_controller.d.ts +17 -8
- package/dist/controllers/smart_sticky_header_controller.js +52 -10
- package/dist/controllers/smart_sticky_header_controller.js.map +1 -1
- package/dist/controllers/sortable_controller.d.ts +38 -8
- package/dist/controllers/sortable_controller.js +241 -67
- package/dist/controllers/sortable_controller.js.map +1 -1
- package/dist/controllers/spinner_controller.d.ts +3 -3
- package/dist/controllers/spinner_controller.js.map +1 -1
- package/dist/controllers/sticky_observer_controller.js +13 -2
- package/dist/controllers/sticky_observer_controller.js.map +1 -1
- package/dist/controllers/submit_once_controller.d.ts +3 -3
- package/dist/controllers/submit_once_controller.js.map +1 -1
- package/dist/controllers/switch_controller.js.map +1 -1
- package/dist/controllers/textarea_autosize_controller.d.ts +1 -1
- 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.map +1 -1
- package/dist/controllers/toast_controller.js +1 -1
- package/dist/controllers/toast_controller.js.map +1 -1
- package/dist/controllers/toggle_group_controller.js.map +1 -1
- package/dist/controllers/toolbar_controller.d.ts +1 -1
- package/dist/controllers/toolbar_controller.js.map +1 -1
- package/dist/controllers/tooltip_controller.d.ts +1 -1
- package/dist/controllers/tooltip_controller.js.map +1 -1
- package/dist/controllers/transition_controller.d.ts +1 -1
- package/dist/controllers/transition_controller.js.map +1 -1
- package/dist/controllers/tree_view_controller.d.ts +4 -3
- package/dist/controllers/tree_view_controller.js.map +1 -1
- package/dist/index.js +587 -183
- package/dist/index.js.map +1 -1
- package/dist/inspector/cli.d.ts +1 -1
- package/dist/inspector/cli.js +2 -1
- package/dist/inspector/cli.js.map +1 -1
- package/dist/inspector/cli_bin.js +2 -1
- package/dist/inspector/cli_bin.js.map +1 -1
- package/dist/inspector/examples.json +2 -2
- package/dist/inspector/manifest.json +13 -30
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,111 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
While the version is `0.x`, the public API (the `stimeo--*` data attributes) may
|
|
8
8
|
change between releases.
|
|
9
9
|
|
|
10
|
+
## [0.13.0] - 2026-09-13
|
|
11
|
+
|
|
12
|
+
Minor release with no new components. The three server-bound components are
|
|
13
|
+
reworked — live-counter, presence, and optimistic — and each changed a contract,
|
|
14
|
+
so read Changed before upgrading. The Inspector manifest stays on schema v12.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- live-counter: a broadcast whose `count` or `delta` is not an integer is
|
|
19
|
+
ignored, a `delta` param that is not an integer falls back to `1`, and a
|
|
20
|
+
declared `channel` keeps the gate closed until the subscription is confirmed.
|
|
21
|
+
A delta carrying your own `id` is applied unless an optimistic add of the same
|
|
22
|
+
size is still outstanding. Runtime changes to `channel` / `params`
|
|
23
|
+
re-subscribe.
|
|
24
|
+
- presence: a leave notice is sent by the last element claiming that `id` rather
|
|
25
|
+
than by every element, a `channel` key in `params` no longer overrides the
|
|
26
|
+
declared `channel`, `heartbeat` / `timeout` fall back to their defaults unless
|
|
27
|
+
finite, positive and at most 2147483647 — typing-indicator's `timeout` takes
|
|
28
|
+
the same bound — and `template` clones only its root element.
|
|
29
|
+
- optimistic: `turbo:submit-end` is matched to the submission it names instead of
|
|
30
|
+
to any ending that reaches the element, so a submission whose ending never
|
|
31
|
+
arrives no longer strands the element. The `data-optimistic-toggled` marker
|
|
32
|
+
carries the authored value to restore instead of `"true"`, `aria-busy` gets the
|
|
33
|
+
same record (`data-optimistic-busy`), and a rollback writes those records back
|
|
34
|
+
rather than inverting the current value — `hidden="until-found"` no longer
|
|
35
|
+
degrades to a bare `hidden`, and an element registered for both `show` and
|
|
36
|
+
`hide` returns to its authored state.
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
40
|
+
- calendar: a malformed `<html lang>` (an `en_US`-style tag that `Intl` rejects)
|
|
41
|
+
no longer stops the month grid from painting. The month label falls back to
|
|
42
|
+
English while the 42 cells, the single tab stop, and the `monthchange` /
|
|
43
|
+
`select` conditions stay as they were; any other failure of the label
|
|
44
|
+
formatter still propagates.
|
|
45
|
+
|
|
46
|
+
## [0.12.0] - 2026-09-06
|
|
47
|
+
|
|
48
|
+
Minor release with no new components. Six existing ones are reworked — count-up,
|
|
49
|
+
intersection, lazy-frame, reading-progress, smart-sticky-header, and sortable —
|
|
50
|
+
and the number reading count-up gained reaches live-counter too. Most of them
|
|
51
|
+
changed a contract, so read Removed and Changed before upgrading. The Inspector
|
|
52
|
+
manifest stays on schema v12.
|
|
53
|
+
|
|
54
|
+
### Removed
|
|
55
|
+
|
|
56
|
+
- sortable: the `status` target, its `data-grabbed` / `data-moved` /
|
|
57
|
+
`data-dropped` / `data-canceled` templates, and the English fallback wording.
|
|
58
|
+
Seat a `stimeo--announcer` on the page and set `announceGrabbedText` /
|
|
59
|
+
`announceMovedText` / `announceDroppedText` / `announceCanceledText`
|
|
60
|
+
(`{name}` / `{position}` / `{total}`); an unset one announces nothing.
|
|
61
|
+
`stimeo check` stops asking for the live region and warns when no announcer
|
|
62
|
+
is seated.
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
- count-up: only the text node holding the number is animated, and while it
|
|
67
|
+
ticks it is wrapped in a `role="img"` element named with the authored text —
|
|
68
|
+
the host's own `aria-label` and `role` are never touched, and sibling markup
|
|
69
|
+
stays where it was.
|
|
70
|
+
- count-up and live-counter read a formatted number by one rule: the first
|
|
71
|
+
numeric token, group separators dropped, the fraction truncated, and a hyphen
|
|
72
|
+
a sign only where it opens the token — `"Sign-ups: 1,200"` reads 1200, not
|
|
73
|
+
-1200.
|
|
74
|
+
- intersection: `0` is always among the observed lines, so a non-zero
|
|
75
|
+
`threshold` also reports the element leaving for good (one more `change`;
|
|
76
|
+
`data-passed` and the ratio property follow the departure to its end), and an
|
|
77
|
+
exit across the start edge reports `position: "before"` while the element
|
|
78
|
+
still overlaps the root.
|
|
79
|
+
- lazy-frame: a re-fetch needs a genuine re-entry — the frame is seen inside the
|
|
80
|
+
observed area, leaves it, and comes back; where a connection or a
|
|
81
|
+
focus-started load first finds it is the baseline. A frame with `once` off is
|
|
82
|
+
armed again after a cache restore, and `load` names the URL that was fetched.
|
|
83
|
+
- reading-progress: an article with no layout box is not measured, the
|
|
84
|
+
article's own box is watched so late-settling content re-measures, and the
|
|
85
|
+
connect frame is the baseline — a restored scroll position does not fire
|
|
86
|
+
`complete`. Both faces of the custom property are leased: the element's copy
|
|
87
|
+
is returned on `disconnect()` too, an authored `:root` declaration comes back,
|
|
88
|
+
and a later writer is left alone.
|
|
89
|
+
- smart-sticky-header: `change` fires on transitions only (connecting is
|
|
90
|
+
silent), and the `offset` zone is decided ahead of the jitter guard.
|
|
91
|
+
- sortable: insertion is relative to the neighbouring item — the `list`-less
|
|
92
|
+
markup works and the last slot is after the last item — and a drag signal from
|
|
93
|
+
a pointer-drag nested inside an item no longer moves the card. The pickup slot
|
|
94
|
+
is remembered as neighbours, so rows inserted or removed mid-drag shift neither
|
|
95
|
+
the restore nor `from`; only laid-out siblings take part in pointer following;
|
|
96
|
+
and a session whose item leaves the item set ends instead of refusing every
|
|
97
|
+
later grab. pointer-drag consumes `Home` / `End` while grabbed.
|
|
98
|
+
- A declaration that cannot be read falls back to its default: count-up's
|
|
99
|
+
`duration` / `from`, smart-sticky-header's `offset`, and a `rootSelector` /
|
|
100
|
+
`containerSelector` that does not parse (intersection, sticky-observer,
|
|
101
|
+
smart-sticky-header) observes the viewport or the window. Runtime changes to
|
|
102
|
+
intersection's `threshold`, lazy-frame's `url` / `rootMargin`, and
|
|
103
|
+
smart-sticky-header's `offset` are followed.
|
|
104
|
+
|
|
105
|
+
### Fixed
|
|
106
|
+
|
|
107
|
+
- lazy-frame: focus moving inside a loaded frame no longer re-fetches it, the
|
|
108
|
+
first intersection after a focus-started load is not a re-entry, and an empty
|
|
109
|
+
`url` is never written to `src`.
|
|
110
|
+
- intersection: with `once`, a handler calling `refresh()` from `enter` no longer
|
|
111
|
+
clears the one-shot marker, so a cache restore does not fire `enter` again.
|
|
112
|
+
- reading-progress: hiding a half-read article no longer publishes `1` and
|
|
113
|
+
`complete`.
|
|
114
|
+
|
|
10
115
|
## [0.11.0] - 2026-09-05
|
|
11
116
|
|
|
12
117
|
Minor release with no new components. Eight existing ones are reworked — the three
|
|
@@ -930,6 +1035,8 @@ Initial public alpha: 101 behavior-only, accessible Stimulus controllers driven
|
|
|
930
1035
|
by `data-*` attributes, shipping no CSS. Published to npm (with provenance) and
|
|
931
1036
|
RubyGems.
|
|
932
1037
|
|
|
1038
|
+
[0.13.0]: https://github.com/taiyaky/stimeo-ui/releases/tag/v0.13.0
|
|
1039
|
+
[0.12.0]: https://github.com/taiyaky/stimeo-ui/releases/tag/v0.12.0
|
|
933
1040
|
[0.11.0]: https://github.com/taiyaky/stimeo-ui/releases/tag/v0.11.0
|
|
934
1041
|
[0.10.0]: https://github.com/taiyaky/stimeo-ui/releases/tag/v0.10.0
|
|
935
1042
|
[0.9.0]: https://github.com/taiyaky/stimeo-ui/releases/tag/v0.9.0
|
package/dist/cable/index.d.ts
CHANGED
|
@@ -21,12 +21,18 @@ import { Controller, Application } from '@hotwired/stimulus';
|
|
|
21
21
|
* Wire contract — the broadcast is either **authoritative** or a **delta**:
|
|
22
22
|
* `{ count: 129 }` sets the absolute value (naturally idempotent; preferred —
|
|
23
23
|
* the server owns the number), while `{ delta: 1, by: "17" }` adds to it,
|
|
24
|
-
* skipped when `by` matches this client's `id`
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
24
|
+
* skipped when `by` matches this client's `id` **and its amount matches an
|
|
25
|
+
* optimistic bump this client is still waiting to see echoed**. A counter
|
|
26
|
+
* holding no such guess — a sibling on the page, this user's other tab, one
|
|
27
|
+
* stepping by a different amount — applies the delta like any other, so every
|
|
28
|
+
* display converges. Only whole numbers are accepted: the
|
|
29
|
+
* display is the state, and a value that cannot be read back from text is not
|
|
30
|
+
* a count. `increment` performs `increment` on the channel with `{ id, delta }`;
|
|
31
|
+
* the server persists and broadcasts. Without an own `id` the delta echo is
|
|
32
|
+
* indistinguishable from a foreign delta, so the optimistic bump is skipped and
|
|
33
|
+
* the broadcast applies the increment exactly once — set `id` (any per-client,
|
|
34
|
+
* per-tab string, e.g. `SecureRandom.uuid`) for optimistic UX. Comparing `by`
|
|
35
|
+
* to `id` is an echo guard, not authentication — identity belongs to the server.
|
|
30
36
|
*
|
|
31
37
|
* `change` dispatches `{ count }`.
|
|
32
38
|
*
|
|
@@ -38,7 +44,10 @@ import { Controller, Application } from '@hotwired/stimulus';
|
|
|
38
44
|
* subscription lifecycle (via the shared confirmation-aware subscription):
|
|
39
45
|
* increments are dropped before confirmation AND while the connection is down
|
|
40
46
|
* (`disconnected` shuts the gate until Action Cable re-confirms), so the
|
|
41
|
-
* display never advances past what the server can receive.
|
|
47
|
+
* display never advances past what the server can receive. The gate reads the
|
|
48
|
+
* declaration, not the subscription object: while a `channel` is declared it
|
|
49
|
+
* stays shut until that subscription confirms, including the window where one
|
|
50
|
+
* has yet to be opened. A refused
|
|
42
51
|
* subscription publishes the `data-live-counter-rejected` hook (cleared on
|
|
43
52
|
* `connect()` — rejection is transient server state) so the consumer's CSS can
|
|
44
53
|
* disable the trigger. Optional `trigger` targets make that declarative: they
|
|
@@ -47,9 +56,15 @@ import { Controller, Application } from '@hotwired/stimulus';
|
|
|
47
56
|
* required, and a disabled form control is announced as such by AT. An
|
|
48
57
|
* authored `disabled` (set by the consumer for its own reasons) is respected:
|
|
49
58
|
* only a disabled this controller applied — tracked via a marker attribute —
|
|
50
|
-
* is ever lifted
|
|
51
|
-
*
|
|
52
|
-
*
|
|
59
|
+
* is ever lifted, and it is given back when the controller or the target goes
|
|
60
|
+
* away. A trigger that holds focus keeps it: the disable waits for it to blur,
|
|
61
|
+
* since taking focus away mid-outage strands a keyboard user. Channel-less
|
|
62
|
+
* (local-only) counters never disable their triggers. `announceText` is opt-in
|
|
63
|
+
* and empty by default; when set, reconciled counts reach the page's shared
|
|
64
|
+
* announcer, debounced so a burst is one message. The subscription follows the
|
|
65
|
+
* declaration — a `channel` or `params` change moves it — and is released on
|
|
66
|
+
* `disconnect()` (Turbo navigation included) along with any pending
|
|
67
|
+
* announcement.
|
|
53
68
|
*/
|
|
54
69
|
declare class LiveCounterController extends Controller<HTMLElement> {
|
|
55
70
|
#private;
|
|
@@ -67,6 +82,10 @@ declare class LiveCounterController extends Controller<HTMLElement> {
|
|
|
67
82
|
type: StringConstructor;
|
|
68
83
|
default: string;
|
|
69
84
|
};
|
|
85
|
+
announceText: {
|
|
86
|
+
type: StringConstructor;
|
|
87
|
+
default: string;
|
|
88
|
+
};
|
|
70
89
|
};
|
|
71
90
|
static actions: readonly ["increment"];
|
|
72
91
|
static events: readonly ["change"];
|
|
@@ -76,17 +95,23 @@ declare class LiveCounterController extends Controller<HTMLElement> {
|
|
|
76
95
|
channelValue: string;
|
|
77
96
|
paramsValue: string;
|
|
78
97
|
idValue: string;
|
|
98
|
+
announceTextValue: string;
|
|
79
99
|
/**
|
|
80
|
-
* Re-parses the identifier parameters
|
|
100
|
+
* Re-parses the identifier parameters and moves the subscription to the
|
|
101
|
+
* identifier they now name.
|
|
81
102
|
*
|
|
82
103
|
* A malformed declaration falls back to no parameters, so the identifier keeps
|
|
83
104
|
* naming the channel instead of the subscription never being created at all.
|
|
84
105
|
*/
|
|
85
106
|
paramsValueChanged(): void;
|
|
107
|
+
/** Moves the subscription when the declaration names a different channel. */
|
|
108
|
+
channelValueChanged(): void;
|
|
86
109
|
connect(): void;
|
|
87
110
|
disconnect(): void;
|
|
88
111
|
/** Late-added triggers (e.g. via a Turbo Stream) pick up the current gate. */
|
|
89
112
|
triggerTargetConnected(target: HTMLElement): void;
|
|
113
|
+
/** A trigger that stops being one keeps nothing this controller lent it. */
|
|
114
|
+
triggerTargetDisconnected(target: HTMLElement): void;
|
|
90
115
|
/**
|
|
91
116
|
* Optimistic local increment: bumps the display immediately, then asks the
|
|
92
117
|
* server to persist and broadcast. The step comes from the action param
|
|
@@ -110,6 +135,11 @@ declare class LiveCounterController extends Controller<HTMLElement> {
|
|
|
110
135
|
* `disconnect()` never runs); a lost notice is caught by the expiry. Ships in
|
|
111
136
|
* the opt-in `stimeo-ui/cable` subpath (`@rails/actioncable` optional peer).
|
|
112
137
|
*
|
|
138
|
+
* The notice speaks for a *peer*, not for a wire subscription: on `disconnect()`
|
|
139
|
+
* only the last element claiming a given `id` on a given identifier sends it, so a
|
|
140
|
+
* sibling that stays mounted keeps the peer in every roster. `pagehide` takes the
|
|
141
|
+
* whole page with it, so there every element sends and peers absorb the duplicates.
|
|
142
|
+
*
|
|
113
143
|
* Roster convergence: a late joiner would otherwise see peers only as their
|
|
114
144
|
* next heartbeats arrive, so on hearing a beacon from an *unknown* peer, each
|
|
115
145
|
* client re-announces itself (at most one such answer every 2s) — the
|
|
@@ -146,7 +176,11 @@ declare class LiveCounterController extends Controller<HTMLElement> {
|
|
|
146
176
|
* `data-presence-id`), and the `count` target renders through localizable
|
|
147
177
|
* `data-zero` / `data-one` / `data-other` templates (`%{count}`). Richer
|
|
148
178
|
* per-user rendering (avatars, links) belongs to the consumer via the `join` /
|
|
149
|
-
* `leave` / `change` events or a server-rendered Turbo Stream.
|
|
179
|
+
* `leave` / `change` events or a server-rendered Turbo Stream. A `template` holds
|
|
180
|
+
* one root element: the clone appended for a peer, and the node removed when the
|
|
181
|
+
* peer goes, are that same element. Roster changes reach assistive tech only when
|
|
182
|
+
* the consumer opts in through `announceJoinText` / `announceLeaveText` — reading
|
|
183
|
+
* out every entry and exit of a busy room is noise, so silence is the default. The `id`
|
|
150
184
|
* comparison is display-level echo suppression, not authentication — identity
|
|
151
185
|
* belongs to the server. Sending tracks the full subscription lifecycle (via
|
|
152
186
|
* the shared confirmation-aware subscription): beacons — heartbeats, the
|
|
@@ -159,7 +193,8 @@ declare class LiveCounterController extends Controller<HTMLElement> {
|
|
|
159
193
|
* `data-live-counter-rejected`. Presence is transient: `connect()` clears
|
|
160
194
|
* whatever a Turbo cache snapshot preserved (hooks + rendered clones), renders
|
|
161
195
|
* the known-empty count (the `data-present*` hooks stay absent until the first
|
|
162
|
-
* beacon), and the stream re-populates;
|
|
196
|
+
* beacon), and the stream re-populates; a `count` or `list` target swapped in by a
|
|
197
|
+
* Stream or a morph arrives empty and is drawn from the roster as it connects; the subscription, heartbeat interval,
|
|
163
198
|
* per-peer expiry timers, and the `pagehide` listener are all released on
|
|
164
199
|
* `disconnect()` (Turbo navigation included).
|
|
165
200
|
*/
|
|
@@ -191,6 +226,14 @@ declare class PresenceController extends Controller<HTMLElement> {
|
|
|
191
226
|
type: NumberConstructor;
|
|
192
227
|
default: number;
|
|
193
228
|
};
|
|
229
|
+
announceJoinText: {
|
|
230
|
+
type: StringConstructor;
|
|
231
|
+
default: string;
|
|
232
|
+
};
|
|
233
|
+
announceLeaveText: {
|
|
234
|
+
type: StringConstructor;
|
|
235
|
+
default: string;
|
|
236
|
+
};
|
|
194
237
|
};
|
|
195
238
|
static events: readonly ["join", "leave", "change"];
|
|
196
239
|
readonly hasCountTarget: boolean;
|
|
@@ -205,6 +248,8 @@ declare class PresenceController extends Controller<HTMLElement> {
|
|
|
205
248
|
nameValue: string;
|
|
206
249
|
heartbeatValue: number;
|
|
207
250
|
timeoutValue: number;
|
|
251
|
+
announceJoinTextValue: string;
|
|
252
|
+
announceLeaveTextValue: string;
|
|
208
253
|
/**
|
|
209
254
|
* Re-parses the identifier parameters when the declaration changes.
|
|
210
255
|
*
|
|
@@ -212,6 +257,15 @@ declare class PresenceController extends Controller<HTMLElement> {
|
|
|
212
257
|
* naming the channel instead of the subscription never being created at all.
|
|
213
258
|
*/
|
|
214
259
|
paramsValueChanged(): void;
|
|
260
|
+
/**
|
|
261
|
+
* Draws the roster into a list target, which arrives empty from a Turbo Stream
|
|
262
|
+
* replacement or a morph. Stimulus runs this before `connect()` on the first mount
|
|
263
|
+
* too, where the roster is still empty and clearing whatever a cache snapshot
|
|
264
|
+
* preserved is what `connect()` goes on to do anyway.
|
|
265
|
+
*/
|
|
266
|
+
listTargetConnected(): void;
|
|
267
|
+
/** Paints the roster size into a count target that arrives blank, for the same reason. */
|
|
268
|
+
countTargetConnected(): void;
|
|
215
269
|
connect(): void;
|
|
216
270
|
disconnect(): void;
|
|
217
271
|
}
|