@sdxc/ui 0.0.0-pre.1
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/LICENSE.md +21 -0
- package/README.md +812 -0
- package/dist/animations/index.d.ts +12 -0
- package/dist/animations/index.js +12 -0
- package/dist/animations/keyframes.d.ts +162 -0
- package/dist/animations/keyframes.js +297 -0
- package/dist/animations/scroll.d.ts +154 -0
- package/dist/animations/scroll.js +228 -0
- package/dist/animations/tokens.d.ts +47 -0
- package/dist/animations/tokens.js +47 -0
- package/dist/animations/transitions.d.ts +143 -0
- package/dist/animations/transitions.js +147 -0
- package/dist/behaviors/announcer.d.ts +90 -0
- package/dist/behaviors/announcer.js +93 -0
- package/dist/behaviors/calendar-model.d.ts +218 -0
- package/dist/behaviors/calendar-model.js +376 -0
- package/dist/behaviors/drag-session.d.ts +119 -0
- package/dist/behaviors/drag-session.js +110 -0
- package/dist/behaviors/filter-model.d.ts +117 -0
- package/dist/behaviors/filter-model.js +185 -0
- package/dist/behaviors/index.d.ts +16 -0
- package/dist/behaviors/index.js +16 -0
- package/dist/behaviors/resize-session.d.ts +115 -0
- package/dist/behaviors/resize-session.js +157 -0
- package/dist/behaviors/scroll-follow-model.d.ts +180 -0
- package/dist/behaviors/scroll-follow-model.js +197 -0
- package/dist/behaviors/selection-model.d.ts +129 -0
- package/dist/behaviors/selection-model.js +259 -0
- package/dist/behaviors/toaster.d.ts +144 -0
- package/dist/behaviors/toaster.js +228 -0
- package/dist/components/accordion.d.ts +93 -0
- package/dist/components/accordion.js +165 -0
- package/dist/components/alert-dialog.d.ts +110 -0
- package/dist/components/alert-dialog.js +169 -0
- package/dist/components/alert.d.ts +109 -0
- package/dist/components/alert.js +160 -0
- package/dist/components/aspect-ratio.d.ts +44 -0
- package/dist/components/aspect-ratio.js +35 -0
- package/dist/components/attachment.d.ts +146 -0
- package/dist/components/attachment.js +320 -0
- package/dist/components/avatar.d.ts +118 -0
- package/dist/components/avatar.js +89 -0
- package/dist/components/badge.d.ts +66 -0
- package/dist/components/badge.js +129 -0
- package/dist/components/breadcrumbs.d.ts +67 -0
- package/dist/components/breadcrumbs.js +121 -0
- package/dist/components/bubble.d.ts +91 -0
- package/dist/components/bubble.js +216 -0
- package/dist/components/button.d.ts +78 -0
- package/dist/components/button.js +207 -0
- package/dist/components/calendar.d.ts +166 -0
- package/dist/components/calendar.js +320 -0
- package/dist/components/card.d.ts +82 -0
- package/dist/components/card.js +126 -0
- package/dist/components/carousel.d.ts +96 -0
- package/dist/components/carousel.js +214 -0
- package/dist/components/chart.d.ts +485 -0
- package/dist/components/chart.js +563 -0
- package/dist/components/checkbox-group.d.ts +58 -0
- package/dist/components/checkbox-group.js +53 -0
- package/dist/components/checkbox.d.ts +61 -0
- package/dist/components/checkbox.js +81 -0
- package/dist/components/color-area.d.ts +83 -0
- package/dist/components/color-area.js +251 -0
- package/dist/components/color-field.d.ts +128 -0
- package/dist/components/color-field.js +73 -0
- package/dist/components/color-picker.d.ts +132 -0
- package/dist/components/color-picker.js +183 -0
- package/dist/components/color-slider.d.ts +103 -0
- package/dist/components/color-slider.js +198 -0
- package/dist/components/color-swatch-picker.d.ts +106 -0
- package/dist/components/color-swatch-picker.js +75 -0
- package/dist/components/color-swatch.d.ts +57 -0
- package/dist/components/color-swatch.js +82 -0
- package/dist/components/color-wheel.d.ts +58 -0
- package/dist/components/color-wheel.js +160 -0
- package/dist/components/combobox.d.ts +73 -0
- package/dist/components/combobox.js +108 -0
- package/dist/components/command.d.ts +80 -0
- package/dist/components/command.js +151 -0
- package/dist/components/confirm.d.ts +124 -0
- package/dist/components/confirm.js +56 -0
- package/dist/components/context-menu.d.ts +108 -0
- package/dist/components/context-menu.js +200 -0
- package/dist/components/date-field.d.ts +110 -0
- package/dist/components/date-field.js +49 -0
- package/dist/components/date-picker.d.ts +136 -0
- package/dist/components/date-picker.js +155 -0
- package/dist/components/date-range-picker.d.ts +152 -0
- package/dist/components/date-range-picker.js +106 -0
- package/dist/components/description.d.ts +36 -0
- package/dist/components/description.js +21 -0
- package/dist/components/dialog.d.ts +97 -0
- package/dist/components/dialog.js +203 -0
- package/dist/components/disclosure.d.ts +85 -0
- package/dist/components/disclosure.js +180 -0
- package/dist/components/drawer.d.ts +82 -0
- package/dist/components/drawer.js +162 -0
- package/dist/components/drop-indicator.d.ts +43 -0
- package/dist/components/drop-indicator.js +47 -0
- package/dist/components/drop-zone.d.ts +73 -0
- package/dist/components/drop-zone.js +54 -0
- package/dist/components/empty.d.ts +89 -0
- package/dist/components/empty.js +129 -0
- package/dist/components/field-error.d.ts +41 -0
- package/dist/components/field-error.js +36 -0
- package/dist/components/file-trigger.d.ts +84 -0
- package/dist/components/file-trigger.js +169 -0
- package/dist/components/form.d.ts +118 -0
- package/dist/components/form.js +113 -0
- package/dist/components/grid-list.d.ts +112 -0
- package/dist/components/grid-list.js +220 -0
- package/dist/components/group.d.ts +45 -0
- package/dist/components/group.js +44 -0
- package/dist/components/header.d.ts +33 -0
- package/dist/components/header.js +29 -0
- package/dist/components/heading-scope.d.ts +83 -0
- package/dist/components/heading-scope.js +82 -0
- package/dist/components/heading.d.ts +50 -0
- package/dist/components/heading.js +31 -0
- package/dist/components/hover-card.d.ts +77 -0
- package/dist/components/hover-card.js +151 -0
- package/dist/components/image-placeholder.d.ts +105 -0
- package/dist/components/image-placeholder.js +212 -0
- package/dist/components/index.d.ts +109 -0
- package/dist/components/index.js +109 -0
- package/dist/components/input.d.ts +53 -0
- package/dist/components/input.js +76 -0
- package/dist/components/item.d.ts +97 -0
- package/dist/components/item.js +185 -0
- package/dist/components/keyboard.d.ts +33 -0
- package/dist/components/keyboard.js +20 -0
- package/dist/components/label.d.ts +38 -0
- package/dist/components/label.js +24 -0
- package/dist/components/link-button.d.ts +59 -0
- package/dist/components/link-button.js +174 -0
- package/dist/components/link.d.ts +43 -0
- package/dist/components/link.js +85 -0
- package/dist/components/listbox.d.ts +119 -0
- package/dist/components/listbox.js +114 -0
- package/dist/components/logo.d.ts +117 -0
- package/dist/components/logo.js +89 -0
- package/dist/components/marker.d.ts +82 -0
- package/dist/components/marker.js +163 -0
- package/dist/components/menu.d.ts +90 -0
- package/dist/components/menu.js +146 -0
- package/dist/components/menubar.d.ts +54 -0
- package/dist/components/menubar.js +118 -0
- package/dist/components/message-scroller.d.ts +109 -0
- package/dist/components/message-scroller.js +180 -0
- package/dist/components/message.d.ts +104 -0
- package/dist/components/message.js +200 -0
- package/dist/components/meter.d.ts +60 -0
- package/dist/components/meter.js +110 -0
- package/dist/components/modal.d.ts +71 -0
- package/dist/components/modal.js +120 -0
- package/dist/components/nav-link.d.ts +53 -0
- package/dist/components/nav-link.js +83 -0
- package/dist/components/navigation-menu.d.ts +150 -0
- package/dist/components/navigation-menu.js +381 -0
- package/dist/components/number-field.d.ts +76 -0
- package/dist/components/number-field.js +190 -0
- package/dist/components/otp-field.d.ts +68 -0
- package/dist/components/otp-field.js +46 -0
- package/dist/components/overlay-arrow.d.ts +51 -0
- package/dist/components/overlay-arrow.js +77 -0
- package/dist/components/pagination.d.ts +67 -0
- package/dist/components/pagination.js +164 -0
- package/dist/components/popover.d.ts +69 -0
- package/dist/components/popover.js +68 -0
- package/dist/components/progress-bar.d.ts +53 -0
- package/dist/components/progress-bar.js +90 -0
- package/dist/components/radio-group.d.ts +102 -0
- package/dist/components/radio-group.js +114 -0
- package/dist/components/range-calendar.d.ts +169 -0
- package/dist/components/range-calendar.js +216 -0
- package/dist/components/resizable.d.ts +98 -0
- package/dist/components/resizable.js +151 -0
- package/dist/components/scroll-area.d.ts +54 -0
- package/dist/components/scroll-area.js +89 -0
- package/dist/components/search-field.d.ts +55 -0
- package/dist/components/search-field.js +49 -0
- package/dist/components/section.d.ts +37 -0
- package/dist/components/section.js +22 -0
- package/dist/components/select.d.ts +96 -0
- package/dist/components/select.js +285 -0
- package/dist/components/selection-indicator.d.ts +47 -0
- package/dist/components/selection-indicator.js +50 -0
- package/dist/components/sentinel-row.d.ts +22 -0
- package/dist/components/sentinel-row.js +29 -0
- package/dist/components/separator.d.ts +35 -0
- package/dist/components/separator.js +48 -0
- package/dist/components/shared-element.d.ts +45 -0
- package/dist/components/shared-element.js +48 -0
- package/dist/components/sheet.d.ts +78 -0
- package/dist/components/sheet.js +167 -0
- package/dist/components/sidebar.d.ts +288 -0
- package/dist/components/sidebar.js +1068 -0
- package/dist/components/skeleton.d.ts +36 -0
- package/dist/components/skeleton.js +38 -0
- package/dist/components/slider.d.ts +102 -0
- package/dist/components/slider.js +179 -0
- package/dist/components/spinner.d.ts +55 -0
- package/dist/components/spinner.js +51 -0
- package/dist/components/switch.d.ts +47 -0
- package/dist/components/switch.js +82 -0
- package/dist/components/table.d.ts +139 -0
- package/dist/components/table.js +216 -0
- package/dist/components/tabs.d.ts +124 -0
- package/dist/components/tabs.js +246 -0
- package/dist/components/tag-group.d.ts +83 -0
- package/dist/components/tag-group.js +157 -0
- package/dist/components/text-field.d.ts +119 -0
- package/dist/components/text-field.js +51 -0
- package/dist/components/text.d.ts +34 -0
- package/dist/components/text.js +19 -0
- package/dist/components/textarea.d.ts +52 -0
- package/dist/components/textarea.js +82 -0
- package/dist/components/time-field.d.ts +110 -0
- package/dist/components/time-field.js +48 -0
- package/dist/components/toast.d.ts +149 -0
- package/dist/components/toast.js +365 -0
- package/dist/components/toggle-button.d.ts +115 -0
- package/dist/components/toggle-button.js +237 -0
- package/dist/components/toolbar.d.ts +47 -0
- package/dist/components/toolbar.js +54 -0
- package/dist/components/tooltip.d.ts +52 -0
- package/dist/components/tooltip.js +92 -0
- package/dist/components/tree.d.ts +123 -0
- package/dist/components/tree.js +239 -0
- package/dist/components/typeset.d.ts +53 -0
- package/dist/components/typeset.js +271 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/mixins/aria-checked.d.ts +42 -0
- package/dist/mixins/aria-checked.js +127 -0
- package/dist/mixins/attachment-trigger.d.ts +64 -0
- package/dist/mixins/attachment-trigger.js +190 -0
- package/dist/mixins/calendar-keys.d.ts +27 -0
- package/dist/mixins/calendar-keys.js +113 -0
- package/dist/mixins/carousel-controls.d.ts +30 -0
- package/dist/mixins/carousel-controls.js +222 -0
- package/dist/mixins/chart-tooltip.d.ts +118 -0
- package/dist/mixins/chart-tooltip.js +323 -0
- package/dist/mixins/clear-field.d.ts +60 -0
- package/dist/mixins/clear-field.js +100 -0
- package/dist/mixins/color-area-drag.d.ts +58 -0
- package/dist/mixins/color-area-drag.js +162 -0
- package/dist/mixins/color-channel-sync.d.ts +73 -0
- package/dist/mixins/color-channel-sync.js +169 -0
- package/dist/mixins/color-preview.d.ts +28 -0
- package/dist/mixins/color-preview.js +77 -0
- package/dist/mixins/color-wheel-drag.d.ts +58 -0
- package/dist/mixins/color-wheel-drag.js +139 -0
- package/dist/mixins/combobox-filter.d.ts +59 -0
- package/dist/mixins/combobox-filter.js +81 -0
- package/dist/mixins/command-filter.d.ts +55 -0
- package/dist/mixins/command-filter.js +121 -0
- package/dist/mixins/command-keys.d.ts +31 -0
- package/dist/mixins/command-keys.js +116 -0
- package/dist/mixins/context-menu.d.ts +24 -0
- package/dist/mixins/context-menu.js +64 -0
- package/dist/mixins/copy-to-clipboard.d.ts +64 -0
- package/dist/mixins/copy-to-clipboard.js +109 -0
- package/dist/mixins/dismiss.d.ts +77 -0
- package/dist/mixins/dismiss.js +151 -0
- package/dist/mixins/drag-reorder.d.ts +88 -0
- package/dist/mixins/drag-reorder.js +214 -0
- package/dist/mixins/drop-zone.d.ts +52 -0
- package/dist/mixins/drop-zone.js +132 -0
- package/dist/mixins/dual-range.d.ts +60 -0
- package/dist/mixins/dual-range.js +100 -0
- package/dist/mixins/grid-list-keys.d.ts +34 -0
- package/dist/mixins/grid-list-keys.js +260 -0
- package/dist/mixins/heading-level-fallback.d.ts +81 -0
- package/dist/mixins/heading-level-fallback.js +112 -0
- package/dist/mixins/hotkey.d.ts +26 -0
- package/dist/mixins/hotkey.js +132 -0
- package/dist/mixins/image-fallback.d.ts +57 -0
- package/dist/mixins/image-fallback.js +86 -0
- package/dist/mixins/index.d.ts +48 -0
- package/dist/mixins/index.js +48 -0
- package/dist/mixins/listbox-keys.d.ts +52 -0
- package/dist/mixins/listbox-keys.js +63 -0
- package/dist/mixins/long-press.d.ts +76 -0
- package/dist/mixins/long-press.js +130 -0
- package/dist/mixins/menu-keys.d.ts +40 -0
- package/dist/mixins/menu-keys.js +117 -0
- package/dist/mixins/menubar-keys.d.ts +59 -0
- package/dist/mixins/menubar-keys.js +230 -0
- package/dist/mixins/message-follow.d.ts +56 -0
- package/dist/mixins/message-follow.js +368 -0
- package/dist/mixins/otp-slots.d.ts +53 -0
- package/dist/mixins/otp-slots.js +175 -0
- package/dist/mixins/persist.d.ts +36 -0
- package/dist/mixins/persist.js +78 -0
- package/dist/mixins/press-toggle.d.ts +43 -0
- package/dist/mixins/press-toggle.js +61 -0
- package/dist/mixins/range-preview.d.ts +26 -0
- package/dist/mixins/range-preview.js +120 -0
- package/dist/mixins/resize-handle.d.ts +101 -0
- package/dist/mixins/resize-handle.js +288 -0
- package/dist/mixins/stepper.d.ts +81 -0
- package/dist/mixins/stepper.js +194 -0
- package/dist/mixins/tab-keys.d.ts +30 -0
- package/dist/mixins/tab-keys.js +63 -0
- package/dist/mixins/theme-toggle.d.ts +82 -0
- package/dist/mixins/theme-toggle.js +158 -0
- package/dist/mixins/track-host-node.d.ts +34 -0
- package/dist/mixins/track-host-node.js +42 -0
- package/dist/mixins/treeKeys.d.ts +57 -0
- package/dist/mixins/treeKeys.js +266 -0
- package/dist/mixins/validate.d.ts +65 -0
- package/dist/mixins/validate.js +139 -0
- package/dist/mixins/view-transition.d.ts +56 -0
- package/dist/mixins/view-transition.js +111 -0
- package/dist/styles/chart-palette.d.ts +34 -0
- package/dist/styles/chart-palette.js +27 -0
- package/dist/styles/field-stack-layout.d.ts +27 -0
- package/dist/styles/field-stack-layout.js +16 -0
- package/dist/styles/floating-surface.d.ts +32 -0
- package/dist/styles/floating-surface.js +30 -0
- package/dist/styles/graphic-host.d.ts +25 -0
- package/dist/styles/graphic-host.js +18 -0
- package/dist/styles/index.d.ts +20 -0
- package/dist/styles/index.js +20 -0
- package/dist/styles/interactive-transition.d.ts +32 -0
- package/dist/styles/interactive-transition.js +32 -0
- package/dist/styles/legend-toggle.d.ts +29 -0
- package/dist/styles/legend-toggle.js +24 -0
- package/dist/styles/output-caption-text.d.ts +22 -0
- package/dist/styles/output-caption-text.js +15 -0
- package/dist/styles/panel-chrome.d.ts +34 -0
- package/dist/styles/panel-chrome.js +26 -0
- package/dist/styles/range-thumb-appearance.d.ts +36 -0
- package/dist/styles/range-thumb-appearance.js +76 -0
- package/dist/styles/rtl-aware-gradient-direction.d.ts +28 -0
- package/dist/styles/rtl-aware-gradient-direction.js +28 -0
- package/dist/styles/semantic-color-panel.d.ts +35 -0
- package/dist/styles/semantic-color-panel.js +41 -0
- package/dist/utils/chart-marker-indices.d.ts +22 -0
- package/dist/utils/chart-marker-indices.js +45 -0
- package/dist/utils/chart-path.d.ts +86 -0
- package/dist/utils/chart-path.js +122 -0
- package/dist/utils/chart-scale.d.ts +182 -0
- package/dist/utils/chart-scale.js +221 -0
- package/dist/utils/color-math.d.ts +252 -0
- package/dist/utils/color-math.js +480 -0
- package/dist/utils/command-event.d.ts +24 -0
- package/dist/utils/command-event.js +26 -0
- package/dist/utils/css-styles.d.ts +21 -0
- package/dist/utils/css-styles.js +11 -0
- package/dist/utils/decorative-icon.d.ts +15 -0
- package/dist/utils/decorative-icon.js +15 -0
- package/dist/utils/disabled-selector.d.ts +22 -0
- package/dist/utils/disabled-selector.js +22 -0
- package/dist/utils/dispatch-change.d.ts +17 -0
- package/dist/utils/dispatch-change.js +19 -0
- package/dist/utils/field-parts.d.ts +26 -0
- package/dist/utils/field-parts.js +12 -0
- package/dist/utils/full-turn-radians.d.ts +16 -0
- package/dist/utils/full-turn-radians.js +16 -0
- package/dist/utils/geometry.d.ts +14 -0
- package/dist/utils/geometry.js +9 -0
- package/dist/utils/has-accessible-text.d.ts +19 -0
- package/dist/utils/has-accessible-text.js +30 -0
- package/dist/utils/hue-spectrum.d.ts +19 -0
- package/dist/utils/hue-spectrum.js +19 -0
- package/dist/utils/index.d.ts +35 -0
- package/dist/utils/index.js +35 -0
- package/dist/utils/is-new-primary-press.d.ts +29 -0
- package/dist/utils/is-new-primary-press.js +31 -0
- package/dist/utils/keyboard-nav.d.ts +64 -0
- package/dist/utils/keyboard-nav.js +79 -0
- package/dist/utils/merge-style.d.ts +33 -0
- package/dist/utils/merge-style.js +30 -0
- package/dist/utils/paired-range-inputs.d.ts +26 -0
- package/dist/utils/paired-range-inputs.js +29 -0
- package/dist/utils/placement.d.ts +18 -0
- package/dist/utils/placement.js +12 -0
- package/dist/utils/prefers-reduced-motion.d.ts +17 -0
- package/dist/utils/prefers-reduced-motion.js +19 -0
- package/dist/utils/resolve-field-wiring.d.ts +83 -0
- package/dist/utils/resolve-field-wiring.js +53 -0
- package/dist/utils/resolve-fill-percent.d.ts +28 -0
- package/dist/utils/resolve-fill-percent.js +34 -0
- package/dist/utils/round-precision.d.ts +22 -0
- package/dist/utils/round-precision.js +25 -0
- package/dist/utils/semantic-color-panel.d.ts +35 -0
- package/dist/utils/semantic-color-panel.js +28 -0
- package/dist/utils/semantic-color.d.ts +17 -0
- package/dist/utils/semantic-color.js +11 -0
- package/dist/utils/warn-if-no-accessible-name.d.ts +52 -0
- package/dist/utils/warn-if-no-accessible-name.js +55 -0
- package/dist/utils/write-cookie.d.ts +35 -0
- package/dist/utils/write-cookie.js +37 -0
- package/package.json +32 -0
- package/src/reset.css +223 -0
- package/src/theme.css +146 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless scroll-follow state for a conversational message viewport: the
|
|
3
|
+
* pinned live edge, the anchored turn, the visible messages, and the
|
|
4
|
+
* reachable scroll edges. Every measurement arrives through a setter, so the
|
|
5
|
+
* state and its transitions stay unit-testable without a DOM.
|
|
6
|
+
*
|
|
7
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
8
|
+
* @copyright Sergio Xalambrí 2026
|
|
9
|
+
*/
|
|
10
|
+
import { TypedEventTarget } from "remix/ui";
|
|
11
|
+
/**
|
|
12
|
+
* Types associated with {@link ScrollFollowModel}: the shape of a scroll
|
|
13
|
+
* intent, its constructor options, and the event it dispatches.
|
|
14
|
+
*/
|
|
15
|
+
export declare namespace ScrollFollowModel {
|
|
16
|
+
/**
|
|
17
|
+
* Where a scrolled-to message should land inside the viewport once an
|
|
18
|
+
* intent is fulfilled, matching `Element.scrollIntoView`'s `block` option.
|
|
19
|
+
*/
|
|
20
|
+
type Align = "start" | "center" | "end";
|
|
21
|
+
/** Options accepted by {@link ScrollFollowModel.scrollToMessage}. */
|
|
22
|
+
interface ScrollToMessageOptions {
|
|
23
|
+
/** Where the message lands in the viewport. Defaults to `"start"`. */
|
|
24
|
+
align?: Align;
|
|
25
|
+
/** Whether the viewport animates on its way to the message. Defaults to `true`. */
|
|
26
|
+
smooth?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* One scroll intent recorded by an intent method (`scrollToEnd`,
|
|
30
|
+
* `scrollToStart`, `scrollToMessage`) and read back by the caller that
|
|
31
|
+
* fulfills it against the real viewport.
|
|
32
|
+
*/
|
|
33
|
+
type ScrollRequest = {
|
|
34
|
+
type: "end";
|
|
35
|
+
} | {
|
|
36
|
+
type: "start";
|
|
37
|
+
} | {
|
|
38
|
+
type: "message";
|
|
39
|
+
id: string;
|
|
40
|
+
align: Align;
|
|
41
|
+
smooth: boolean;
|
|
42
|
+
};
|
|
43
|
+
/** Reachability of the two ends of the scrollable region, as last measured. */
|
|
44
|
+
interface ReachableEdges {
|
|
45
|
+
/** Whether the viewport can still be scrolled toward its start edge. */
|
|
46
|
+
start: boolean;
|
|
47
|
+
/** Whether the viewport can still be scrolled toward its end edge. */
|
|
48
|
+
end: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** Constructor options for {@link ScrollFollowModel}. */
|
|
51
|
+
interface Options {
|
|
52
|
+
/** Whether auto-follow starts engaged. Defaults to `true`. */
|
|
53
|
+
pinned?: boolean;
|
|
54
|
+
/** Turn id the viewport starts anchored to. Defaults to `null`. */
|
|
55
|
+
anchorTurnId?: string | null;
|
|
56
|
+
/** Message ids visible in the viewport at construction. Defaults to none. */
|
|
57
|
+
visibleMessageIds?: Iterable<string>;
|
|
58
|
+
/** Reachability of the start/end edges at construction. Defaults to both unreachable. */
|
|
59
|
+
reachableEdges?: ReachableEdges;
|
|
60
|
+
}
|
|
61
|
+
/** Events dispatched by {@link ScrollFollowModel} as its state changes. */
|
|
62
|
+
interface EventMap {
|
|
63
|
+
/** Dispatched after any owned state changes, or a scroll intent is recorded. */
|
|
64
|
+
change: Event;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Auto-follow state for a message viewport: the pinned live edge, the
|
|
69
|
+
* anchored turn, the visible messages, and the reachable scroll edges. Every
|
|
70
|
+
* measurement arrives through a setter, so transitions stay DOM-free.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* let model = new ScrollFollowModel();
|
|
74
|
+
* model.addEventListener("change", () => update());
|
|
75
|
+
* model.setReachableEdges({ start: true, end: false });
|
|
76
|
+
* model.scrollToEnd();
|
|
77
|
+
* model.consumeScrollRequest(); // { type: "end" }
|
|
78
|
+
*/
|
|
79
|
+
export declare class ScrollFollowModel extends TypedEventTarget<ScrollFollowModel.EventMap> {
|
|
80
|
+
#private;
|
|
81
|
+
/**
|
|
82
|
+
* @param options Initial pinned state, anchor turn, visible messages, and edge reachability. All are optional and default to a freshly pinned model anchored to nothing, with no visible messages and both edges unreachable.
|
|
83
|
+
*/
|
|
84
|
+
constructor(options?: ScrollFollowModel.Options);
|
|
85
|
+
/**
|
|
86
|
+
* Whether the viewport is auto-following the live edge, so arriving
|
|
87
|
+
* messages scroll the reader down. Updated through {@link setPinned}.
|
|
88
|
+
*/
|
|
89
|
+
get pinned(): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Id of the turn the viewport is anchored to, or `null` before one has
|
|
92
|
+
* been measured. Read back to hold the reader's position while older
|
|
93
|
+
* history prepends above this turn.
|
|
94
|
+
*/
|
|
95
|
+
get anchorTurnId(): string | null;
|
|
96
|
+
/**
|
|
97
|
+
* Ids of the messages currently visible in the viewport, as last
|
|
98
|
+
* reported through {@link setMessageVisible}.
|
|
99
|
+
*/
|
|
100
|
+
get visibleMessageIds(): ReadonlySet<string>;
|
|
101
|
+
/** Whether the viewport can still be scrolled toward its start edge. */
|
|
102
|
+
get startReachable(): boolean;
|
|
103
|
+
/** Whether the viewport can still be scrolled toward its end edge. */
|
|
104
|
+
get endReachable(): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* The scroll intent recorded by {@link scrollToEnd},
|
|
107
|
+
* {@link scrollToStart}, or {@link scrollToMessage} that is still
|
|
108
|
+
* unfulfilled, or `null` once {@link consumeScrollRequest} has cleared it.
|
|
109
|
+
*/
|
|
110
|
+
get pendingScrollRequest(): ScrollFollowModel.ScrollRequest | null;
|
|
111
|
+
/**
|
|
112
|
+
* Records whether the viewport is auto-following the live edge, as
|
|
113
|
+
* observed while the reader scrolls. A no-op, dispatching nothing, when
|
|
114
|
+
* `pinned` already matches the current value.
|
|
115
|
+
*
|
|
116
|
+
* @param pinned Whether auto-follow is engaged.
|
|
117
|
+
*/
|
|
118
|
+
setPinned(pinned: boolean): void;
|
|
119
|
+
/**
|
|
120
|
+
* Records which turn the viewport is anchored to, once the caller has
|
|
121
|
+
* measured which turn sits nearest the anchor edge. A no-op, dispatching
|
|
122
|
+
* nothing, when `id` already matches the current anchor.
|
|
123
|
+
*
|
|
124
|
+
* @param id Id of the turn to anchor to, or `null` when none is measured.
|
|
125
|
+
*/
|
|
126
|
+
setAnchorTurnId(id: string | null): void;
|
|
127
|
+
/**
|
|
128
|
+
* Records whether a single message is visible, one entry at a time to
|
|
129
|
+
* match an `IntersectionObserver` callback. A no-op, dispatching nothing,
|
|
130
|
+
* when `visible` already matches membership in {@link visibleMessageIds}.
|
|
131
|
+
*
|
|
132
|
+
* @param id Id of the message the visibility report is about.
|
|
133
|
+
* @param visible Whether the message is currently visible.
|
|
134
|
+
*/
|
|
135
|
+
setMessageVisible(id: string, visible: boolean): void;
|
|
136
|
+
/**
|
|
137
|
+
* Reports whether a message is visible, per the last report given to
|
|
138
|
+
* {@link setMessageVisible}. The read side of the visibility API, so a
|
|
139
|
+
* consumer reads visibility here after each `"change"`.
|
|
140
|
+
*
|
|
141
|
+
* @param id Id of the message to test.
|
|
142
|
+
* @returns `true` when the message is currently visible.
|
|
143
|
+
*/
|
|
144
|
+
isMessageVisible(id: string): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Records which scrollable edges the viewport can reach. Takes both edges
|
|
147
|
+
* at once because one scroll or resize measurement yields both. A no-op,
|
|
148
|
+
* dispatching nothing, when neither edge's reachability changes.
|
|
149
|
+
*
|
|
150
|
+
* @param edges Reachability of the start and end edges.
|
|
151
|
+
*/
|
|
152
|
+
setReachableEdges(edges: ScrollFollowModel.ReachableEdges): void;
|
|
153
|
+
/**
|
|
154
|
+
* Records an intent to scroll to the live edge of the conversation. Always
|
|
155
|
+
* dispatches `"change"`, even while a request is pending, so a repeated
|
|
156
|
+
* "jump to latest" click still reaches the viewport.
|
|
157
|
+
*/
|
|
158
|
+
scrollToEnd(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Records an intent to scroll to the start of the conversation. Always
|
|
161
|
+
* dispatches `"change"`, even when a request is already pending.
|
|
162
|
+
*/
|
|
163
|
+
scrollToStart(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Records an intent to scroll to a specific message. Always dispatches
|
|
166
|
+
* `"change"`, even when a request is already pending.
|
|
167
|
+
*
|
|
168
|
+
* @param id Id of the message to scroll to.
|
|
169
|
+
* @param options Alignment within the viewport and whether to animate; both default when omitted.
|
|
170
|
+
*/
|
|
171
|
+
scrollToMessage(id: string, options?: ScrollFollowModel.ScrollToMessageOptions): void;
|
|
172
|
+
/**
|
|
173
|
+
* Reads and clears the pending scroll request in one step, so an intent is
|
|
174
|
+
* fulfilled exactly once. Clearing stays silent — subscribers already
|
|
175
|
+
* reacted when the intent was recorded.
|
|
176
|
+
*
|
|
177
|
+
* @returns The scroll request that was pending, or `null` when there was none.
|
|
178
|
+
*/
|
|
179
|
+
consumeScrollRequest(): ScrollFollowModel.ScrollRequest | null;
|
|
180
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless scroll-follow state for a conversational message viewport: the
|
|
3
|
+
* pinned live edge, the anchored turn, the visible messages, and the
|
|
4
|
+
* reachable scroll edges. Every measurement arrives through a setter, so the
|
|
5
|
+
* state and its transitions stay unit-testable without a DOM.
|
|
6
|
+
*
|
|
7
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
8
|
+
* @copyright Sergio Xalambrí 2026
|
|
9
|
+
*/
|
|
10
|
+
import { TypedEventTarget } from "remix/ui";
|
|
11
|
+
import { dispatchChange } from "../utils/dispatch-change.js";
|
|
12
|
+
const DEFAULT_PINNED = true;
|
|
13
|
+
const DEFAULT_ALIGN = "start";
|
|
14
|
+
const DEFAULT_SMOOTH = true;
|
|
15
|
+
/**
|
|
16
|
+
* Auto-follow state for a message viewport: the pinned live edge, the
|
|
17
|
+
* anchored turn, the visible messages, and the reachable scroll edges. Every
|
|
18
|
+
* measurement arrives through a setter, so transitions stay DOM-free.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* let model = new ScrollFollowModel();
|
|
22
|
+
* model.addEventListener("change", () => update());
|
|
23
|
+
* model.setReachableEdges({ start: true, end: false });
|
|
24
|
+
* model.scrollToEnd();
|
|
25
|
+
* model.consumeScrollRequest(); // { type: "end" }
|
|
26
|
+
*/
|
|
27
|
+
export class ScrollFollowModel extends TypedEventTarget {
|
|
28
|
+
#pinned;
|
|
29
|
+
#anchorTurnId;
|
|
30
|
+
#visibleMessageIds;
|
|
31
|
+
#startReachable;
|
|
32
|
+
#endReachable;
|
|
33
|
+
#pendingScrollRequest = null;
|
|
34
|
+
/**
|
|
35
|
+
* @param options Initial pinned state, anchor turn, visible messages, and edge reachability. All are optional and default to a freshly pinned model anchored to nothing, with no visible messages and both edges unreachable.
|
|
36
|
+
*/
|
|
37
|
+
constructor(options = {}) {
|
|
38
|
+
super();
|
|
39
|
+
this.#pinned = options.pinned ?? DEFAULT_PINNED;
|
|
40
|
+
this.#anchorTurnId = options.anchorTurnId ?? null;
|
|
41
|
+
this.#visibleMessageIds = new Set(options.visibleMessageIds ?? []);
|
|
42
|
+
this.#startReachable = options.reachableEdges?.start ?? false;
|
|
43
|
+
this.#endReachable = options.reachableEdges?.end ?? false;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Whether the viewport is auto-following the live edge, so arriving
|
|
47
|
+
* messages scroll the reader down. Updated through {@link setPinned}.
|
|
48
|
+
*/
|
|
49
|
+
get pinned() {
|
|
50
|
+
return this.#pinned;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Id of the turn the viewport is anchored to, or `null` before one has
|
|
54
|
+
* been measured. Read back to hold the reader's position while older
|
|
55
|
+
* history prepends above this turn.
|
|
56
|
+
*/
|
|
57
|
+
get anchorTurnId() {
|
|
58
|
+
return this.#anchorTurnId;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Ids of the messages currently visible in the viewport, as last
|
|
62
|
+
* reported through {@link setMessageVisible}.
|
|
63
|
+
*/
|
|
64
|
+
get visibleMessageIds() {
|
|
65
|
+
return this.#visibleMessageIds;
|
|
66
|
+
}
|
|
67
|
+
/** Whether the viewport can still be scrolled toward its start edge. */
|
|
68
|
+
get startReachable() {
|
|
69
|
+
return this.#startReachable;
|
|
70
|
+
}
|
|
71
|
+
/** Whether the viewport can still be scrolled toward its end edge. */
|
|
72
|
+
get endReachable() {
|
|
73
|
+
return this.#endReachable;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The scroll intent recorded by {@link scrollToEnd},
|
|
77
|
+
* {@link scrollToStart}, or {@link scrollToMessage} that is still
|
|
78
|
+
* unfulfilled, or `null` once {@link consumeScrollRequest} has cleared it.
|
|
79
|
+
*/
|
|
80
|
+
get pendingScrollRequest() {
|
|
81
|
+
return this.#pendingScrollRequest;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Records whether the viewport is auto-following the live edge, as
|
|
85
|
+
* observed while the reader scrolls. A no-op, dispatching nothing, when
|
|
86
|
+
* `pinned` already matches the current value.
|
|
87
|
+
*
|
|
88
|
+
* @param pinned Whether auto-follow is engaged.
|
|
89
|
+
*/
|
|
90
|
+
setPinned(pinned) {
|
|
91
|
+
if (pinned === this.#pinned)
|
|
92
|
+
return;
|
|
93
|
+
this.#pinned = pinned;
|
|
94
|
+
dispatchChange(this);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Records which turn the viewport is anchored to, once the caller has
|
|
98
|
+
* measured which turn sits nearest the anchor edge. A no-op, dispatching
|
|
99
|
+
* nothing, when `id` already matches the current anchor.
|
|
100
|
+
*
|
|
101
|
+
* @param id Id of the turn to anchor to, or `null` when none is measured.
|
|
102
|
+
*/
|
|
103
|
+
setAnchorTurnId(id) {
|
|
104
|
+
if (id === this.#anchorTurnId)
|
|
105
|
+
return;
|
|
106
|
+
this.#anchorTurnId = id;
|
|
107
|
+
dispatchChange(this);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Records whether a single message is visible, one entry at a time to
|
|
111
|
+
* match an `IntersectionObserver` callback. A no-op, dispatching nothing,
|
|
112
|
+
* when `visible` already matches membership in {@link visibleMessageIds}.
|
|
113
|
+
*
|
|
114
|
+
* @param id Id of the message the visibility report is about.
|
|
115
|
+
* @param visible Whether the message is currently visible.
|
|
116
|
+
*/
|
|
117
|
+
setMessageVisible(id, visible) {
|
|
118
|
+
let wasVisible = this.#visibleMessageIds.has(id);
|
|
119
|
+
if (wasVisible === visible)
|
|
120
|
+
return;
|
|
121
|
+
if (visible)
|
|
122
|
+
this.#visibleMessageIds.add(id);
|
|
123
|
+
else
|
|
124
|
+
this.#visibleMessageIds.delete(id);
|
|
125
|
+
dispatchChange(this);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Reports whether a message is visible, per the last report given to
|
|
129
|
+
* {@link setMessageVisible}. The read side of the visibility API, so a
|
|
130
|
+
* consumer reads visibility here after each `"change"`.
|
|
131
|
+
*
|
|
132
|
+
* @param id Id of the message to test.
|
|
133
|
+
* @returns `true` when the message is currently visible.
|
|
134
|
+
*/
|
|
135
|
+
isMessageVisible(id) {
|
|
136
|
+
return this.#visibleMessageIds.has(id);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Records which scrollable edges the viewport can reach. Takes both edges
|
|
140
|
+
* at once because one scroll or resize measurement yields both. A no-op,
|
|
141
|
+
* dispatching nothing, when neither edge's reachability changes.
|
|
142
|
+
*
|
|
143
|
+
* @param edges Reachability of the start and end edges.
|
|
144
|
+
*/
|
|
145
|
+
setReachableEdges(edges) {
|
|
146
|
+
if (edges.start === this.#startReachable && edges.end === this.#endReachable)
|
|
147
|
+
return;
|
|
148
|
+
this.#startReachable = edges.start;
|
|
149
|
+
this.#endReachable = edges.end;
|
|
150
|
+
dispatchChange(this);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Records an intent to scroll to the live edge of the conversation. Always
|
|
154
|
+
* dispatches `"change"`, even while a request is pending, so a repeated
|
|
155
|
+
* "jump to latest" click still reaches the viewport.
|
|
156
|
+
*/
|
|
157
|
+
scrollToEnd() {
|
|
158
|
+
this.#pendingScrollRequest = { type: "end" };
|
|
159
|
+
dispatchChange(this);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Records an intent to scroll to the start of the conversation. Always
|
|
163
|
+
* dispatches `"change"`, even when a request is already pending.
|
|
164
|
+
*/
|
|
165
|
+
scrollToStart() {
|
|
166
|
+
this.#pendingScrollRequest = { type: "start" };
|
|
167
|
+
dispatchChange(this);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Records an intent to scroll to a specific message. Always dispatches
|
|
171
|
+
* `"change"`, even when a request is already pending.
|
|
172
|
+
*
|
|
173
|
+
* @param id Id of the message to scroll to.
|
|
174
|
+
* @param options Alignment within the viewport and whether to animate; both default when omitted.
|
|
175
|
+
*/
|
|
176
|
+
scrollToMessage(id, options = {}) {
|
|
177
|
+
this.#pendingScrollRequest = {
|
|
178
|
+
type: "message",
|
|
179
|
+
id,
|
|
180
|
+
align: options.align ?? DEFAULT_ALIGN,
|
|
181
|
+
smooth: options.smooth ?? DEFAULT_SMOOTH,
|
|
182
|
+
};
|
|
183
|
+
dispatchChange(this);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Reads and clears the pending scroll request in one step, so an intent is
|
|
187
|
+
* fulfilled exactly once. Clearing stays silent — subscribers already
|
|
188
|
+
* reacted when the intent was recorded.
|
|
189
|
+
*
|
|
190
|
+
* @returns The scroll request that was pending, or `null` when there was none.
|
|
191
|
+
*/
|
|
192
|
+
consumeScrollRequest() {
|
|
193
|
+
let request = this.#pendingScrollRequest;
|
|
194
|
+
this.#pendingScrollRequest = null;
|
|
195
|
+
return request;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection state for list-shaped widgets: a set of selected keys plus the
|
|
3
|
+
* toggle, contiguous-range, and select-all semantics behind row selection.
|
|
4
|
+
* Consumers subscribe to the `"change"` event and render from
|
|
5
|
+
* `selectedKeys`, so selection lives on independently of the rendering.
|
|
6
|
+
*
|
|
7
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
8
|
+
* @copyright Sergio Xalambrí 2026
|
|
9
|
+
*/
|
|
10
|
+
import { TypedEventTarget } from "remix/ui";
|
|
11
|
+
/**
|
|
12
|
+
* Types associated with {@link SelectionModel}.
|
|
13
|
+
*/
|
|
14
|
+
export declare namespace SelectionModel {
|
|
15
|
+
/**
|
|
16
|
+
* Identifier for a selectable item. Row/item identity is left to the
|
|
17
|
+
* consumer — a string slug and a numeric row id are both valid keys.
|
|
18
|
+
*/
|
|
19
|
+
type Key = string | number;
|
|
20
|
+
/**
|
|
21
|
+
* Selection cardinality a model enforces: `"none"` accepts no selection
|
|
22
|
+
* at all, `"single"` keeps at most one selected key, and `"multiple"`
|
|
23
|
+
* allows any subset of the known keys.
|
|
24
|
+
*/
|
|
25
|
+
type Mode = "none" | "single" | "multiple";
|
|
26
|
+
/**
|
|
27
|
+
* Constructor options for {@link SelectionModel}.
|
|
28
|
+
*/
|
|
29
|
+
interface Options {
|
|
30
|
+
/** Selection cardinality; defaults to `"multiple"`. */
|
|
31
|
+
mode?: Mode;
|
|
32
|
+
/**
|
|
33
|
+
* Ordered universe of selectable keys, backing
|
|
34
|
+
* {@link SelectionModel.selectRange} spans and the full set for
|
|
35
|
+
* {@link SelectionModel.selectAll}. Point selection works without it.
|
|
36
|
+
*/
|
|
37
|
+
keys?: Iterable<Key>;
|
|
38
|
+
/** Keys excluded from selection; any of them present in `selectedKeys` are dropped. */
|
|
39
|
+
disabledKeys?: Iterable<Key>;
|
|
40
|
+
/** Keys selected on construction, clamped to `mode` and `disabledKeys`. */
|
|
41
|
+
selectedKeys?: Iterable<Key>;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* State model for list, grid, tree, and table row selection. Every mutating
|
|
46
|
+
* method dispatches a plain `"change"` event exactly once, and only when the
|
|
47
|
+
* selected-key set really changes, so a subscriber can re-render blindly.
|
|
48
|
+
*/
|
|
49
|
+
export declare class SelectionModel extends TypedEventTarget<{
|
|
50
|
+
change: Event;
|
|
51
|
+
}> {
|
|
52
|
+
#private;
|
|
53
|
+
/**
|
|
54
|
+
* @param options - Initial mode, known key order, disabled keys, and
|
|
55
|
+
* pre-selected keys. All are optional and default to an empty,
|
|
56
|
+
* `"multiple"`-mode model with no known keys.
|
|
57
|
+
*/
|
|
58
|
+
constructor(options?: SelectionModel.Options);
|
|
59
|
+
/** Current selection cardinality. */
|
|
60
|
+
get mode(): SelectionModel.Mode;
|
|
61
|
+
/** Known selectable keys, in the order last provided to the constructor or {@link setKeys}. */
|
|
62
|
+
get keys(): readonly SelectionModel.Key[];
|
|
63
|
+
/** Currently selected keys. */
|
|
64
|
+
get selectedKeys(): ReadonlySet<SelectionModel.Key>;
|
|
65
|
+
/** Keys excluded from selection. */
|
|
66
|
+
get disabledKeys(): ReadonlySet<SelectionModel.Key>;
|
|
67
|
+
/** Key that anchors the next {@link selectRange} call, or `null` before any point interaction. */
|
|
68
|
+
get anchorKey(): SelectionModel.Key | null;
|
|
69
|
+
/** Number of currently selected keys. */
|
|
70
|
+
get size(): number;
|
|
71
|
+
/** `true` when no key is selected. */
|
|
72
|
+
get isEmpty(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* `true` when every non-disabled key in {@link keys} is selected. Always
|
|
75
|
+
* `false` when {@link keys} is empty, since there is nothing to select.
|
|
76
|
+
*/
|
|
77
|
+
get isAll(): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Replaces the selection mode. The current selection clamps to it
|
|
80
|
+
* (`"none"` empties it, `"single"` keeps at most the first selected key),
|
|
81
|
+
* dispatching `"change"` when that clamp shrinks the selected-key set.
|
|
82
|
+
*/
|
|
83
|
+
setMode(mode: SelectionModel.Mode): void;
|
|
84
|
+
/**
|
|
85
|
+
* Replaces the known universe of selectable keys, in order. Selected and
|
|
86
|
+
* anchor keys no longer present in `keys` are dropped, so removing a
|
|
87
|
+
* rendered row also removes it from the selection.
|
|
88
|
+
*/
|
|
89
|
+
setKeys(keys: Iterable<SelectionModel.Key>): void;
|
|
90
|
+
/**
|
|
91
|
+
* Replaces the set of keys excluded from selection. Any of those keys
|
|
92
|
+
* currently selected are dropped from the selection.
|
|
93
|
+
*/
|
|
94
|
+
setDisabledKeys(keys: Iterable<SelectionModel.Key>): void;
|
|
95
|
+
/** Reports whether `key` is currently selected. */
|
|
96
|
+
isSelected(key: SelectionModel.Key): boolean;
|
|
97
|
+
/** Reports whether `key` is excluded from selection. */
|
|
98
|
+
isDisabled(key: SelectionModel.Key): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Selects `key`, replacing the selection in `"single"` mode or adding to
|
|
101
|
+
* it in `"multiple"` mode. No-op for a disabled key or in `"none"` mode.
|
|
102
|
+
* Sets {@link anchorKey} to `key` on success.
|
|
103
|
+
*/
|
|
104
|
+
select(key: SelectionModel.Key): void;
|
|
105
|
+
/**
|
|
106
|
+
* Removes `key` from the selection, regardless of mode. Sets
|
|
107
|
+
* {@link anchorKey} to `key` when it was selected; no-op otherwise.
|
|
108
|
+
*/
|
|
109
|
+
deselect(key: SelectionModel.Key): void;
|
|
110
|
+
/**
|
|
111
|
+
* Flips whether `key` is selected, replacing the selection in `"single"`
|
|
112
|
+
* mode and staying a no-op for a disabled key or in `"none"` mode. Sets
|
|
113
|
+
* {@link anchorKey} on success; a plain click maps to this operation.
|
|
114
|
+
*/
|
|
115
|
+
toggle(key: SelectionModel.Key): void;
|
|
116
|
+
/**
|
|
117
|
+
* Selects the contiguous span between {@link anchorKey} and `key` in
|
|
118
|
+
* {@link keys} order, skipping disabled keys; the anchor stays put so
|
|
119
|
+
* repeated shift-clicks re-span. Anchorless calls run {@link toggle}.
|
|
120
|
+
*/
|
|
121
|
+
selectRange(key: SelectionModel.Key): void;
|
|
122
|
+
/**
|
|
123
|
+
* Selects every non-disabled key in {@link keys}. No-op outside
|
|
124
|
+
* `"multiple"` mode or when {@link keys} is empty.
|
|
125
|
+
*/
|
|
126
|
+
selectAll(): void;
|
|
127
|
+
/** Deselects every key, regardless of mode. */
|
|
128
|
+
clear(): void;
|
|
129
|
+
}
|