@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,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared per-part styling shape behind a single-control field
|
|
3
|
+
* convenience wrapper's `parts` prop: a caption, the control itself, an
|
|
4
|
+
* optional supporting passage, and an optional validation message, each
|
|
5
|
+
* keyed to the `mix` its wrapper forwards onto that part's own host element.
|
|
6
|
+
* A wrapper composing more parts than these four — pairing its control with
|
|
7
|
+
* a live preview, say — extends this shape with its own additional named
|
|
8
|
+
* members instead of repeating the four it already covers.
|
|
9
|
+
*
|
|
10
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
11
|
+
* @copyright Sergio Xalambrí 2026
|
|
12
|
+
*/
|
|
13
|
+
import type { Props as TagProps } from "remix/ui";
|
|
14
|
+
/**
|
|
15
|
+
* Per-part styling for a field's caption, control, supporting description,
|
|
16
|
+
* and validation message, layered after each part's own built-in styling.
|
|
17
|
+
* Every member is optional, so unstyled parts keep their built-in appearance.
|
|
18
|
+
*/
|
|
19
|
+
export interface FieldPartsProps {
|
|
20
|
+
label?: TagProps<"label">["mix"];
|
|
21
|
+
input?: TagProps<"input">["mix"];
|
|
22
|
+
/** Styling for the supporting description, rendered only once the field's description copy is set. */
|
|
23
|
+
description?: TagProps<"p">["mix"];
|
|
24
|
+
/** Styling for the validation message, rendered only once the field's error copy is set. */
|
|
25
|
+
error?: TagProps<"span">["mix"];
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared per-part styling shape behind a single-control field
|
|
3
|
+
* convenience wrapper's `parts` prop: a caption, the control itself, an
|
|
4
|
+
* optional supporting passage, and an optional validation message, each
|
|
5
|
+
* keyed to the `mix` its wrapper forwards onto that part's own host element.
|
|
6
|
+
* A wrapper composing more parts than these four — pairing its control with
|
|
7
|
+
* a live preview, say — extends this shape with its own additional named
|
|
8
|
+
* members instead of repeating the four it already covers.
|
|
9
|
+
*
|
|
10
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
11
|
+
* @copyright Sergio Xalambrí 2026
|
|
12
|
+
*/
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The radian measure of a full turn around a circle — the shared constant
|
|
3
|
+
* behind computations that recognize or default to a complete revolution:
|
|
4
|
+
* pie wedge sweep detection, a pie chart's default total span, and folding
|
|
5
|
+
* an angle or hue back into its wraparound range.
|
|
6
|
+
*
|
|
7
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
8
|
+
* @copyright Sergio Xalambrí 2026
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Radians in a full turn around a circle (`Math.PI * 2`).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* let endAngle = startAngle + FULL_TURN_RADIANS; // one complete revolution
|
|
15
|
+
*/
|
|
16
|
+
export declare const FULL_TURN_RADIANS: number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The radian measure of a full turn around a circle — the shared constant
|
|
3
|
+
* behind computations that recognize or default to a complete revolution:
|
|
4
|
+
* pie wedge sweep detection, a pie chart's default total span, and folding
|
|
5
|
+
* an angle or hue back into its wraparound range.
|
|
6
|
+
*
|
|
7
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
8
|
+
* @copyright Sergio Xalambrí 2026
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Radians in a full turn around a circle (`Math.PI * 2`).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* let endAngle = startAngle + FULL_TURN_RADIANS; // one complete revolution
|
|
15
|
+
*/
|
|
16
|
+
export const FULL_TURN_RADIANS = Math.PI * 2;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A plain 2D point, shared by every module under `utils/` that works in
|
|
3
|
+
* pixel or normalized coordinates — an already-scaled SVG plotting position,
|
|
4
|
+
* a pointer position, a normalized `[0, 1]` coordinate, or a circle's
|
|
5
|
+
* center, depending on which function it's passed to.
|
|
6
|
+
*
|
|
7
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
8
|
+
* @copyright Sergio Xalambrí 2026
|
|
9
|
+
*/
|
|
10
|
+
/** A single 2D position. */
|
|
11
|
+
export interface Point {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A plain 2D point, shared by every module under `utils/` that works in
|
|
3
|
+
* pixel or normalized coordinates — an already-scaled SVG plotting position,
|
|
4
|
+
* a pointer position, a normalized `[0, 1]` coordinate, or a circle's
|
|
5
|
+
* center, depending on which function it's passed to.
|
|
6
|
+
*
|
|
7
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
8
|
+
* @copyright Sergio Xalambrí 2026
|
|
9
|
+
*/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree-walk that answers whether a `children` value resolves to visible
|
|
3
|
+
* text once rendered — the shared dev-mode contract check behind every
|
|
4
|
+
* icon-capable interactive component, distinguishing an icon-only control
|
|
5
|
+
* needing an explicit `aria-label` from one whose visible content already
|
|
6
|
+
* names it.
|
|
7
|
+
*
|
|
8
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
9
|
+
* @copyright Sergio Xalambrí 2026
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* A `children` value counts as accessible once it flattens — recursively
|
|
13
|
+
* through arrays and `props.children` — to a non-whitespace string, or to
|
|
14
|
+
* any number or bigint, since either always renders as visible content.
|
|
15
|
+
*
|
|
16
|
+
* @param node A `children` value, or any nested value reached while walking one.
|
|
17
|
+
* @returns Whether `node` resolves to visible text once rendered.
|
|
18
|
+
*/
|
|
19
|
+
export declare function hasAccessibleText(node: unknown): boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree-walk that answers whether a `children` value resolves to visible
|
|
3
|
+
* text once rendered — the shared dev-mode contract check behind every
|
|
4
|
+
* icon-capable interactive component, distinguishing an icon-only control
|
|
5
|
+
* needing an explicit `aria-label` from one whose visible content already
|
|
6
|
+
* names it.
|
|
7
|
+
*
|
|
8
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
9
|
+
* @copyright Sergio Xalambrí 2026
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* A `children` value counts as accessible once it flattens — recursively
|
|
13
|
+
* through arrays and `props.children` — to a non-whitespace string, or to
|
|
14
|
+
* any number or bigint, since either always renders as visible content.
|
|
15
|
+
*
|
|
16
|
+
* @param node A `children` value, or any nested value reached while walking one.
|
|
17
|
+
* @returns Whether `node` resolves to visible text once rendered.
|
|
18
|
+
*/
|
|
19
|
+
export function hasAccessibleText(node) {
|
|
20
|
+
if (typeof node === "string")
|
|
21
|
+
return node.trim().length > 0;
|
|
22
|
+
if (typeof node === "number" || typeof node === "bigint")
|
|
23
|
+
return true;
|
|
24
|
+
if (Array.isArray(node))
|
|
25
|
+
return node.some(hasAccessibleText);
|
|
26
|
+
if (node && typeof node === "object" && "props" in node) {
|
|
27
|
+
return hasAccessibleText(node.props?.children);
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fixed seven-stop hue spectrum shared by every hue-based gradient this
|
|
3
|
+
* component family paints, reused verbatim wherever a gradient formula needs
|
|
4
|
+
* the complete hue spectrum as its color stops.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The seven hue stops, `0` through `360` in even sixty-degree steps, sweep
|
|
11
|
+
* through the full spectrum and land back on red so every hue gradient this
|
|
12
|
+
* component family paints stays pixel-for-pixel identical.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* `linear-gradient(to right, ${HUE_GRADIENT_STOPS})`;
|
|
16
|
+
* @example
|
|
17
|
+
* `conic-gradient(from 0deg, ${HUE_GRADIENT_STOPS})`;
|
|
18
|
+
*/
|
|
19
|
+
export declare const HUE_GRADIENT_STOPS = "hsl(0 100% 50%), hsl(60 100% 50%), hsl(120 100% 50%), hsl(180 100% 50%), hsl(240 100% 50%), hsl(300 100% 50%), hsl(360 100% 50%)";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fixed seven-stop hue spectrum shared by every hue-based gradient this
|
|
3
|
+
* component family paints, reused verbatim wherever a gradient formula needs
|
|
4
|
+
* the complete hue spectrum as its color stops.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The seven hue stops, `0` through `360` in even sixty-degree steps, sweep
|
|
11
|
+
* through the full spectrum and land back on red so every hue gradient this
|
|
12
|
+
* component family paints stays pixel-for-pixel identical.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* `linear-gradient(to right, ${HUE_GRADIENT_STOPS})`;
|
|
16
|
+
* @example
|
|
17
|
+
* `conic-gradient(from 0deg, ${HUE_GRADIENT_STOPS})`;
|
|
18
|
+
*/
|
|
19
|
+
export const HUE_GRADIENT_STOPS = "hsl(0 100% 50%), hsl(60 100% 50%), hsl(120 100% 50%), hsl(180 100% 50%), hsl(240 100% 50%), hsl(300 100% 50%), hsl(360 100% 50%)";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel for framework-free helper modules: pure scale, path, and color math
|
|
3
|
+
* that specific components build on, kept separate from the components that
|
|
4
|
+
* consume them so both stay plain TypeScript that any renderer can import.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
export * from "./chart-marker-indices.js";
|
|
10
|
+
export * from "./chart-path.js";
|
|
11
|
+
export * from "./chart-scale.js";
|
|
12
|
+
export * from "./color-math.js";
|
|
13
|
+
export * from "./command-event.js";
|
|
14
|
+
export * from "./css-styles.js";
|
|
15
|
+
export * from "./decorative-icon.js";
|
|
16
|
+
export * from "./disabled-selector.js";
|
|
17
|
+
export * from "./dispatch-change.js";
|
|
18
|
+
export * from "./field-parts.js";
|
|
19
|
+
export * from "./full-turn-radians.js";
|
|
20
|
+
export * from "./geometry.js";
|
|
21
|
+
export * from "./has-accessible-text.js";
|
|
22
|
+
export * from "./hue-spectrum.js";
|
|
23
|
+
export * from "./is-new-primary-press.js";
|
|
24
|
+
export * from "./keyboard-nav.js";
|
|
25
|
+
export * from "./merge-style.js";
|
|
26
|
+
export * from "./paired-range-inputs.js";
|
|
27
|
+
export * from "./placement.js";
|
|
28
|
+
export * from "./prefers-reduced-motion.js";
|
|
29
|
+
export * from "./resolve-field-wiring.js";
|
|
30
|
+
export * from "./resolve-fill-percent.js";
|
|
31
|
+
export * from "./round-precision.js";
|
|
32
|
+
export * from "./semantic-color.js";
|
|
33
|
+
export * from "./semantic-color-panel.js";
|
|
34
|
+
export * from "./warn-if-no-accessible-name.js";
|
|
35
|
+
export * from "./write-cookie.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel for framework-free helper modules: pure scale, path, and color math
|
|
3
|
+
* that specific components build on, kept separate from the components that
|
|
4
|
+
* consume them so both stay plain TypeScript that any renderer can import.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
export * from "./chart-marker-indices.js";
|
|
10
|
+
export * from "./chart-path.js";
|
|
11
|
+
export * from "./chart-scale.js";
|
|
12
|
+
export * from "./color-math.js";
|
|
13
|
+
export * from "./command-event.js";
|
|
14
|
+
export * from "./css-styles.js";
|
|
15
|
+
export * from "./decorative-icon.js";
|
|
16
|
+
export * from "./disabled-selector.js";
|
|
17
|
+
export * from "./dispatch-change.js";
|
|
18
|
+
export * from "./field-parts.js";
|
|
19
|
+
export * from "./full-turn-radians.js";
|
|
20
|
+
export * from "./geometry.js";
|
|
21
|
+
export * from "./has-accessible-text.js";
|
|
22
|
+
export * from "./hue-spectrum.js";
|
|
23
|
+
export * from "./is-new-primary-press.js";
|
|
24
|
+
export * from "./keyboard-nav.js";
|
|
25
|
+
export * from "./merge-style.js";
|
|
26
|
+
export * from "./paired-range-inputs.js";
|
|
27
|
+
export * from "./placement.js";
|
|
28
|
+
export * from "./prefers-reduced-motion.js";
|
|
29
|
+
export * from "./resolve-field-wiring.js";
|
|
30
|
+
export * from "./resolve-fill-percent.js";
|
|
31
|
+
export * from "./round-precision.js";
|
|
32
|
+
export * from "./semantic-color.js";
|
|
33
|
+
export * from "./semantic-color-panel.js";
|
|
34
|
+
export * from "./warn-if-no-accessible-name.js";
|
|
35
|
+
export * from "./write-cookie.js";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `pointerdown` guard every pointer-tracking mixin evaluates before it
|
|
3
|
+
* starts a gesture: a press only begins tracking when no other pointer is
|
|
4
|
+
* already mid-gesture, the event's own pointer is the primary one for its
|
|
5
|
+
* type, and it was pressed with the primary button — the same three
|
|
6
|
+
* conditions a long-press timer and a resize-handle drag each confirm first,
|
|
7
|
+
* so a secondary pointer, a non-primary button, or a press arriving while
|
|
8
|
+
* another is already tracked all leave the existing gesture alone.
|
|
9
|
+
*
|
|
10
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
11
|
+
* @copyright Sergio Xalambrí 2026
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Confirms a `pointerdown` event starts a fresh primary press:
|
|
15
|
+
* `activePointerId` holds `undefined`, `event.isPrimary` is `true`, and
|
|
16
|
+
* `event.button` is `0`.
|
|
17
|
+
*
|
|
18
|
+
* @param event The `pointerdown` event to evaluate.
|
|
19
|
+
* @param activePointerId The pointer id the caller currently tracks, or
|
|
20
|
+
* `undefined` when it tracks none.
|
|
21
|
+
* @returns Whether `event` starts a fresh primary press the caller should
|
|
22
|
+
* begin tracking.
|
|
23
|
+
* @example
|
|
24
|
+
* on<HTMLElement, "pointerdown">("pointerdown", (event) => {
|
|
25
|
+
* if (!isNewPrimaryPress(event, activePointerId)) return;
|
|
26
|
+
* activePointerId = event.pointerId;
|
|
27
|
+
* });
|
|
28
|
+
*/
|
|
29
|
+
export declare function isNewPrimaryPress(event: Pick<PointerEvent, "isPrimary" | "button">, activePointerId: number | undefined): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `pointerdown` guard every pointer-tracking mixin evaluates before it
|
|
3
|
+
* starts a gesture: a press only begins tracking when no other pointer is
|
|
4
|
+
* already mid-gesture, the event's own pointer is the primary one for its
|
|
5
|
+
* type, and it was pressed with the primary button — the same three
|
|
6
|
+
* conditions a long-press timer and a resize-handle drag each confirm first,
|
|
7
|
+
* so a secondary pointer, a non-primary button, or a press arriving while
|
|
8
|
+
* another is already tracked all leave the existing gesture alone.
|
|
9
|
+
*
|
|
10
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
11
|
+
* @copyright Sergio Xalambrí 2026
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Confirms a `pointerdown` event starts a fresh primary press:
|
|
15
|
+
* `activePointerId` holds `undefined`, `event.isPrimary` is `true`, and
|
|
16
|
+
* `event.button` is `0`.
|
|
17
|
+
*
|
|
18
|
+
* @param event The `pointerdown` event to evaluate.
|
|
19
|
+
* @param activePointerId The pointer id the caller currently tracks, or
|
|
20
|
+
* `undefined` when it tracks none.
|
|
21
|
+
* @returns Whether `event` starts a fresh primary press the caller should
|
|
22
|
+
* begin tracking.
|
|
23
|
+
* @example
|
|
24
|
+
* on<HTMLElement, "pointerdown">("pointerdown", (event) => {
|
|
25
|
+
* if (!isNewPrimaryPress(event, activePointerId)) return;
|
|
26
|
+
* activePointerId = event.pointerId;
|
|
27
|
+
* });
|
|
28
|
+
*/
|
|
29
|
+
export function isNewPrimaryPress(event, activePointerId) {
|
|
30
|
+
return activePointerId === undefined && event.isPrimary && event.button === 0;
|
|
31
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared keyboard-navigation primitives for a flat list of focusable items:
|
|
3
|
+
* collecting a subtree's enabled candidates, assigning roving `tabindex`,
|
|
4
|
+
* moving real DOM focus, detecting a printable keystroke, and normalizing an
|
|
5
|
+
* item's typeahead search text. Backs the WAI-ARIA menu, menubar, and tree
|
|
6
|
+
* keyboard patterns alike, each pairing these primitives with its own
|
|
7
|
+
* traversal, activation, and expand/collapse rules.
|
|
8
|
+
*
|
|
9
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
10
|
+
* @copyright Sergio Xalambrí 2026
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Collects `root`'s enabled descendants matching `selector`, in document
|
|
14
|
+
* order. Queried fresh on every keystroke or focus change so a keyboard
|
|
15
|
+
* pattern built on it stays correct as items change while the widget is open.
|
|
16
|
+
*
|
|
17
|
+
* @param root Subtree to search — a menu surface, a menu row's open surface, or any other container of focusable items.
|
|
18
|
+
* @param selector Selector identifying the items to collect.
|
|
19
|
+
* @returns The matching elements, excluding any carrying the native `disabled` attribute or `aria-disabled="true"`.
|
|
20
|
+
* @example
|
|
21
|
+
* queryItems(menuSurface, '[role^="menuitem"]');
|
|
22
|
+
*/
|
|
23
|
+
export declare function queryItems(root: HTMLElement, selector: string): HTMLElement[];
|
|
24
|
+
/**
|
|
25
|
+
* Reports whether `event` is a single, unmodified printable character,
|
|
26
|
+
* matching the WAI-ARIA menu pattern's typeahead trigger.
|
|
27
|
+
*
|
|
28
|
+
* @param event Keyboard event to inspect.
|
|
29
|
+
* @returns `true` when `event.key` is a single character struck with no Ctrl, Alt, or Meta modifier held.
|
|
30
|
+
* @example
|
|
31
|
+
* if (isPrintableKey(event)) buffer += event.key.toLowerCase();
|
|
32
|
+
*/
|
|
33
|
+
export declare function isPrintableKey(event: KeyboardEvent): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Assigns roving tabindex across `items`: `current` becomes the sole
|
|
36
|
+
* Tab-reachable stop (`tabIndex = 0`) and every other item drops out of Tab
|
|
37
|
+
* order (`tabIndex = -1`).
|
|
38
|
+
*
|
|
39
|
+
* @param items Every item participating in the roving-tabindex group.
|
|
40
|
+
* @param current The item that becomes the sole Tab stop.
|
|
41
|
+
* @example
|
|
42
|
+
* setRovingTabindex(items, items[0]);
|
|
43
|
+
*/
|
|
44
|
+
export declare function setRovingTabindex(items: readonly HTMLElement[], current: HTMLElement): void;
|
|
45
|
+
/**
|
|
46
|
+
* Moves roving tabindex and real DOM focus to `item`.
|
|
47
|
+
*
|
|
48
|
+
* @param items Every item participating in the roving-tabindex group.
|
|
49
|
+
* @param item The item to focus.
|
|
50
|
+
* @example
|
|
51
|
+
* focusItem(items, items[0]);
|
|
52
|
+
*/
|
|
53
|
+
export declare function focusItem(items: readonly HTMLElement[], item: HTMLElement): void;
|
|
54
|
+
/**
|
|
55
|
+
* Normalizes an item's typeahead text: its `data-search-value` override when
|
|
56
|
+
* the visible content isn't the best match text, otherwise its trimmed,
|
|
57
|
+
* lowercased text content.
|
|
58
|
+
*
|
|
59
|
+
* @param item The item to read typeahead text from.
|
|
60
|
+
* @returns The item's lowercased, trimmed typeahead text.
|
|
61
|
+
* @example
|
|
62
|
+
* searchOrder.find((item) => labelFor(item).startsWith(buffer));
|
|
63
|
+
*/
|
|
64
|
+
export declare function labelFor(item: HTMLElement): string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared keyboard-navigation primitives for a flat list of focusable items:
|
|
3
|
+
* collecting a subtree's enabled candidates, assigning roving `tabindex`,
|
|
4
|
+
* moving real DOM focus, detecting a printable keystroke, and normalizing an
|
|
5
|
+
* item's typeahead search text. Backs the WAI-ARIA menu, menubar, and tree
|
|
6
|
+
* keyboard patterns alike, each pairing these primitives with its own
|
|
7
|
+
* traversal, activation, and expand/collapse rules.
|
|
8
|
+
*
|
|
9
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
10
|
+
* @copyright Sergio Xalambrí 2026
|
|
11
|
+
*/
|
|
12
|
+
import { DISABLED_SELECTOR } from "./disabled-selector.js";
|
|
13
|
+
/**
|
|
14
|
+
* Collects `root`'s enabled descendants matching `selector`, in document
|
|
15
|
+
* order. Queried fresh on every keystroke or focus change so a keyboard
|
|
16
|
+
* pattern built on it stays correct as items change while the widget is open.
|
|
17
|
+
*
|
|
18
|
+
* @param root Subtree to search — a menu surface, a menu row's open surface, or any other container of focusable items.
|
|
19
|
+
* @param selector Selector identifying the items to collect.
|
|
20
|
+
* @returns The matching elements, excluding any carrying the native `disabled` attribute or `aria-disabled="true"`.
|
|
21
|
+
* @example
|
|
22
|
+
* queryItems(menuSurface, '[role^="menuitem"]');
|
|
23
|
+
*/
|
|
24
|
+
export function queryItems(root, selector) {
|
|
25
|
+
let candidates = root.querySelectorAll(selector);
|
|
26
|
+
return Array.from(candidates).filter((item) => !item.matches(DISABLED_SELECTOR));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Reports whether `event` is a single, unmodified printable character,
|
|
30
|
+
* matching the WAI-ARIA menu pattern's typeahead trigger.
|
|
31
|
+
*
|
|
32
|
+
* @param event Keyboard event to inspect.
|
|
33
|
+
* @returns `true` when `event.key` is a single character struck with no Ctrl, Alt, or Meta modifier held.
|
|
34
|
+
* @example
|
|
35
|
+
* if (isPrintableKey(event)) buffer += event.key.toLowerCase();
|
|
36
|
+
*/
|
|
37
|
+
export function isPrintableKey(event) {
|
|
38
|
+
return event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Assigns roving tabindex across `items`: `current` becomes the sole
|
|
42
|
+
* Tab-reachable stop (`tabIndex = 0`) and every other item drops out of Tab
|
|
43
|
+
* order (`tabIndex = -1`).
|
|
44
|
+
*
|
|
45
|
+
* @param items Every item participating in the roving-tabindex group.
|
|
46
|
+
* @param current The item that becomes the sole Tab stop.
|
|
47
|
+
* @example
|
|
48
|
+
* setRovingTabindex(items, items[0]);
|
|
49
|
+
*/
|
|
50
|
+
export function setRovingTabindex(items, current) {
|
|
51
|
+
for (let item of items)
|
|
52
|
+
item.tabIndex = item === current ? 0 : -1;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Moves roving tabindex and real DOM focus to `item`.
|
|
56
|
+
*
|
|
57
|
+
* @param items Every item participating in the roving-tabindex group.
|
|
58
|
+
* @param item The item to focus.
|
|
59
|
+
* @example
|
|
60
|
+
* focusItem(items, items[0]);
|
|
61
|
+
*/
|
|
62
|
+
export function focusItem(items, item) {
|
|
63
|
+
setRovingTabindex(items, item);
|
|
64
|
+
item.focus();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Normalizes an item's typeahead text: its `data-search-value` override when
|
|
68
|
+
* the visible content isn't the best match text, otherwise its trimmed,
|
|
69
|
+
* lowercased text content.
|
|
70
|
+
*
|
|
71
|
+
* @param item The item to read typeahead text from.
|
|
72
|
+
* @returns The item's lowercased, trimmed typeahead text.
|
|
73
|
+
* @example
|
|
74
|
+
* searchOrder.find((item) => labelFor(item).startsWith(buffer));
|
|
75
|
+
*/
|
|
76
|
+
export function labelFor(item) {
|
|
77
|
+
let searchValue = item.getAttribute("data-search-value");
|
|
78
|
+
return (searchValue ?? item.textContent ?? "").trim().toLowerCase();
|
|
79
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merges per-instance declarations into whatever `style` prop a host received.
|
|
3
|
+
* Components that carry a value too dynamic for a hashed `css()` class — a
|
|
4
|
+
* ratio, a hue, a fill percentage — have to write it inline, and the incoming
|
|
5
|
+
* prop may already be either CSS text or a declaration object, so each one
|
|
6
|
+
* would otherwise hand-roll the same two-branch merge.
|
|
7
|
+
*
|
|
8
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
9
|
+
* @copyright Sergio Xalambrí 2026
|
|
10
|
+
*/
|
|
11
|
+
import type { Props } from "remix/ui";
|
|
12
|
+
/** The `style` prop an element accepts: CSS text, a declaration object, or nothing. */
|
|
13
|
+
export type StyleProp = Props<"div">["style"];
|
|
14
|
+
/**
|
|
15
|
+
* Declarations to merge into a host's `style`, keyed by CSS property name.
|
|
16
|
+
* Keys match CSS spelling exactly — `--ui-slider-fill`, `view-transition-name`
|
|
17
|
+
* — so one record works for both prop forms; empty entries are dropped.
|
|
18
|
+
*/
|
|
19
|
+
export type StyleDeclarations = Record<string, string | number | null | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* Merges declarations into a host's `style` prop and returns a new value, so
|
|
22
|
+
* shared props stay untouched. Assigned via `Object.assign`, since remix/ui's
|
|
23
|
+
* style type's `Symbol.iterator` key type-checks under a spread despite carrying no runtime iterator.
|
|
24
|
+
*
|
|
25
|
+
* @param style The host's incoming `style` prop, in either form.
|
|
26
|
+
* @param declarations Per-instance declarations to merge in.
|
|
27
|
+
* @returns The merged `style` prop, in the same form as `style`.
|
|
28
|
+
* @example
|
|
29
|
+
* mergeStyle(style, { "--ui-slider-fill": `${fillPercent}%` })
|
|
30
|
+
* @example
|
|
31
|
+
* mergeStyle(style, { "--ui-resizable-panel-size": size == null ? null : `${size}%` })
|
|
32
|
+
*/
|
|
33
|
+
export declare function mergeStyle(style: StyleProp, declarations: StyleDeclarations): StyleProp;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merges per-instance declarations into whatever `style` prop a host received.
|
|
3
|
+
* Components that carry a value too dynamic for a hashed `css()` class — a
|
|
4
|
+
* ratio, a hue, a fill percentage — have to write it inline, and the incoming
|
|
5
|
+
* prop may already be either CSS text or a declaration object, so each one
|
|
6
|
+
* would otherwise hand-roll the same two-branch merge.
|
|
7
|
+
*
|
|
8
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
9
|
+
* @copyright Sergio Xalambrí 2026
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Merges declarations into a host's `style` prop and returns a new value, so
|
|
13
|
+
* shared props stay untouched. Assigned via `Object.assign`, since remix/ui's
|
|
14
|
+
* style type's `Symbol.iterator` key type-checks under a spread despite carrying no runtime iterator.
|
|
15
|
+
*
|
|
16
|
+
* @param style The host's incoming `style` prop, in either form.
|
|
17
|
+
* @param declarations Per-instance declarations to merge in.
|
|
18
|
+
* @returns The merged `style` prop, in the same form as `style`.
|
|
19
|
+
* @example
|
|
20
|
+
* mergeStyle(style, { "--ui-slider-fill": `${fillPercent}%` })
|
|
21
|
+
* @example
|
|
22
|
+
* mergeStyle(style, { "--ui-resizable-panel-size": size == null ? null : `${size}%` })
|
|
23
|
+
*/
|
|
24
|
+
export function mergeStyle(style, declarations) {
|
|
25
|
+
let present = Object.entries(declarations).filter(([, value]) => value != null);
|
|
26
|
+
if (typeof style === "string") {
|
|
27
|
+
return [style, ...present.map(([name, value]) => `${name}:${value}`)].filter(Boolean).join(";");
|
|
28
|
+
}
|
|
29
|
+
return Object.assign({}, style, Object.fromEntries(present));
|
|
30
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared query for a pair of `<input type="range">` elements living under a
|
|
3
|
+
* host element, told apart by a single `data-*` attribute carrying a
|
|
4
|
+
* different value on each half — a horizontal/vertical axis pair, a
|
|
5
|
+
* lower/upper-bound thumb, or any other paired arrangement a mixin
|
|
6
|
+
* coordinates through the same attribute-and-value convention.
|
|
7
|
+
*
|
|
8
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
9
|
+
* @copyright Sergio Xalambrí 2026
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Finds the pair of `<input type="range">` elements under `host` carrying
|
|
13
|
+
* `attribute` set to `valueA` and `valueB` respectively.
|
|
14
|
+
*
|
|
15
|
+
* @param host Element the paired range inputs render inside.
|
|
16
|
+
* @param attribute `data-*` attribute name distinguishing the two inputs from each other.
|
|
17
|
+
* @param valueA `attribute` value identifying the first input of the pair.
|
|
18
|
+
* @param valueB `attribute` value identifying the second input of the pair.
|
|
19
|
+
* @returns The matched pair, keyed `a` and `b` in the same order as `valueA` and `valueB`, or `null` when either input is missing.
|
|
20
|
+
* @example
|
|
21
|
+
* findPairedRangeInputs(host, "data-thumb", "min", "max");
|
|
22
|
+
*/
|
|
23
|
+
export declare function findPairedRangeInputs(host: HTMLElement, attribute: string, valueA: string, valueB: string): {
|
|
24
|
+
a: HTMLInputElement;
|
|
25
|
+
b: HTMLInputElement;
|
|
26
|
+
} | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared query for a pair of `<input type="range">` elements living under a
|
|
3
|
+
* host element, told apart by a single `data-*` attribute carrying a
|
|
4
|
+
* different value on each half — a horizontal/vertical axis pair, a
|
|
5
|
+
* lower/upper-bound thumb, or any other paired arrangement a mixin
|
|
6
|
+
* coordinates through the same attribute-and-value convention.
|
|
7
|
+
*
|
|
8
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
9
|
+
* @copyright Sergio Xalambrí 2026
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Finds the pair of `<input type="range">` elements under `host` carrying
|
|
13
|
+
* `attribute` set to `valueA` and `valueB` respectively.
|
|
14
|
+
*
|
|
15
|
+
* @param host Element the paired range inputs render inside.
|
|
16
|
+
* @param attribute `data-*` attribute name distinguishing the two inputs from each other.
|
|
17
|
+
* @param valueA `attribute` value identifying the first input of the pair.
|
|
18
|
+
* @param valueB `attribute` value identifying the second input of the pair.
|
|
19
|
+
* @returns The matched pair, keyed `a` and `b` in the same order as `valueA` and `valueB`, or `null` when either input is missing.
|
|
20
|
+
* @example
|
|
21
|
+
* findPairedRangeInputs(host, "data-thumb", "min", "max");
|
|
22
|
+
*/
|
|
23
|
+
export function findPairedRangeInputs(host, attribute, valueA, valueB) {
|
|
24
|
+
let a = host.querySelector(`input[type="range"][${attribute}="${valueA}"]`);
|
|
25
|
+
let b = host.querySelector(`input[type="range"][${attribute}="${valueB}"]`);
|
|
26
|
+
if (!a || !b)
|
|
27
|
+
return null;
|
|
28
|
+
return { a, b };
|
|
29
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The floating-surface placement shared by every component that anchors a
|
|
3
|
+
* panel against a trigger through CSS anchor positioning — a popover's own
|
|
4
|
+
* surface, and any panel layering its content and motion on top of one. Each
|
|
5
|
+
* of the twelve values names a physical side of the viewport, the same one a
|
|
6
|
+
* positioning engine would choose when flipping the surface to stay in view,
|
|
7
|
+
* so a placement keeps attaching to that same physical side for every `dir`
|
|
8
|
+
* value.
|
|
9
|
+
*
|
|
10
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
11
|
+
* @copyright Sergio Xalambrí 2026
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Side of the anchor a floating surface renders against, and — for the four
|
|
15
|
+
* corner variants — which of the anchor's edges it aligns to along the
|
|
16
|
+
* perpendicular axis.
|
|
17
|
+
*/
|
|
18
|
+
export type AnchorPlacement = "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The floating-surface placement shared by every component that anchors a
|
|
3
|
+
* panel against a trigger through CSS anchor positioning — a popover's own
|
|
4
|
+
* surface, and any panel layering its content and motion on top of one. Each
|
|
5
|
+
* of the twelve values names a physical side of the viewport, the same one a
|
|
6
|
+
* positioning engine would choose when flipping the surface to stay in view,
|
|
7
|
+
* so a placement keeps attaching to that same physical side for every `dir`
|
|
8
|
+
* value.
|
|
9
|
+
*
|
|
10
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
11
|
+
* @copyright Sergio Xalambrí 2026
|
|
12
|
+
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The visitor's live `prefers-reduced-motion` preference, read through a
|
|
3
|
+
* single `matchMedia` query — the one check every motion-aware mixin
|
|
4
|
+
* consults before choosing between a full motion effect and its instant or
|
|
5
|
+
* opacity-only alternative.
|
|
6
|
+
*
|
|
7
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
8
|
+
* @copyright Sergio Xalambrí 2026
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Reads whether the visitor's platform currently requests reduced motion.
|
|
12
|
+
*
|
|
13
|
+
* @returns `true` when the platform's `prefers-reduced-motion` setting is `reduce`, `false` otherwise.
|
|
14
|
+
* @example
|
|
15
|
+
* let behavior: ScrollBehavior = prefersReducedMotion() ? "instant" : "smooth";
|
|
16
|
+
*/
|
|
17
|
+
export declare function prefersReducedMotion(): boolean;
|