@human-kit/ui 1.0.0-beta.0 → 1.0.0-beta.10
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/README.md +29 -16
- package/dist/FOCUS_STATE_CONTRACT.md +18 -4
- package/dist/FOCUS_STATE_REVIEW_TEMPLATE.md +8 -8
- package/dist/accordion/README.md +3 -3
- package/dist/accordion/root/accordion-root.svelte +15 -3
- package/dist/accordion/root/context.svelte.js +4 -4
- package/dist/accordion/types.d.ts +40 -19
- package/dist/autocomplete/README.md +6 -7
- package/dist/autocomplete/empty/autocomplete-empty.svelte +1 -1
- package/dist/autocomplete/empty/autocomplete-empty.svelte.d.ts +1 -1
- package/dist/autocomplete/input/autocomplete-input.svelte +3 -3
- package/dist/autocomplete/input/autocomplete-input.svelte.d.ts +3 -3
- package/dist/autocomplete/item/autocomplete-item.svelte +10 -0
- package/dist/autocomplete/item-indicator/autocomplete-item-indicator.svelte +2 -2
- package/dist/autocomplete/item-indicator/autocomplete-item-indicator.svelte.d.ts +2 -2
- package/dist/autocomplete/list/autocomplete-list.svelte +2 -2
- package/dist/autocomplete/list/autocomplete-list.svelte.d.ts +11 -3
- package/dist/autocomplete/root/autocomplete.svelte +7 -7
- package/dist/autocomplete/root/autocomplete.svelte.d.ts +7 -7
- package/dist/autocomplete/status/autocomplete-status.svelte +1 -1
- package/dist/autocomplete/status/autocomplete-status.svelte.d.ts +1 -1
- package/dist/avatar/README.md +52 -0
- package/dist/avatar/count/avatar-count.svelte +56 -0
- package/dist/avatar/count/avatar-count.svelte.d.ts +4 -0
- package/dist/avatar/fallback/avatar-fallback.svelte +67 -0
- package/dist/avatar/fallback/avatar-fallback.svelte.d.ts +4 -0
- package/dist/avatar/group/avatar-group.svelte +65 -0
- package/dist/avatar/group/avatar-group.svelte.d.ts +4 -0
- package/dist/avatar/group/context.d.ts +15 -0
- package/dist/avatar/group/context.js +15 -0
- package/dist/avatar/image/avatar-image.svelte +104 -0
- package/dist/avatar/image/avatar-image.svelte.d.ts +4 -0
- package/dist/avatar/index.d.ts +22 -0
- package/dist/avatar/index.js +10 -0
- package/dist/avatar/index.parts.d.ts +5 -0
- package/dist/avatar/index.parts.js +5 -0
- package/dist/avatar/root/avatar-root.svelte +79 -0
- package/dist/avatar/root/avatar-root.svelte.d.ts +4 -0
- package/dist/avatar/root/context.d.ts +14 -0
- package/dist/avatar/root/context.js +15 -0
- package/dist/avatar/types.d.ts +84 -0
- package/dist/avatar/types.js +1 -0
- package/dist/breadcrumbs/README.md +65 -0
- package/dist/breadcrumbs/ellipsis/breadcrumbs-ellipsis.svelte +62 -0
- package/dist/breadcrumbs/ellipsis/breadcrumbs-ellipsis.svelte.d.ts +4 -0
- package/dist/breadcrumbs/index.d.ts +23 -0
- package/dist/breadcrumbs/index.js +10 -0
- package/dist/breadcrumbs/index.parts.d.ts +6 -0
- package/dist/breadcrumbs/index.parts.js +6 -0
- package/dist/breadcrumbs/item/breadcrumbs-item.svelte +42 -0
- package/dist/breadcrumbs/item/breadcrumbs-item.svelte.d.ts +4 -0
- package/dist/breadcrumbs/link/breadcrumbs-link.svelte +47 -0
- package/dist/breadcrumbs/link/breadcrumbs-link.svelte.d.ts +4 -0
- package/dist/breadcrumbs/list/breadcrumbs-list.svelte +31 -0
- package/dist/breadcrumbs/list/breadcrumbs-list.svelte.d.ts +4 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.svelte +112 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.svelte.d.ts +4 -0
- package/dist/breadcrumbs/root/context.d.ts +19 -0
- package/dist/breadcrumbs/root/context.js +15 -0
- package/dist/breadcrumbs/separator/breadcrumbs-separator.svelte +35 -0
- package/dist/breadcrumbs/separator/breadcrumbs-separator.svelte.d.ts +4 -0
- package/dist/breadcrumbs/types.d.ts +80 -0
- package/dist/breadcrumbs/types.js +1 -0
- package/dist/button/README.md +1 -1
- package/dist/button/root/button-root.svelte +37 -7
- package/dist/button/root/button-root.svelte.d.ts +19 -4
- package/dist/calendar/README.md +3 -3
- package/dist/calendar/body-cell/calendar-body-cell.svelte +7 -0
- package/dist/calendar/grid-header/calendar-grid-header.svelte +3 -4
- package/dist/calendar/grid-header/calendar-grid-header.svelte.d.ts +3 -4
- package/dist/calendar/root/calendar-root.svelte +8 -2
- package/dist/calendar/root/calendar-root.svelte.d.ts +8 -2
- package/dist/calendar/root/context.svelte.js +8 -2
- package/dist/calendar/trigger-next/README.md +1 -1
- package/dist/calendar/trigger-previous/README.md +1 -1
- package/dist/checkbox/README.md +1 -1
- package/dist/checkbox/indicator/README.md +1 -1
- package/dist/checkbox/indicator/checkbox-indicator.svelte +1 -0
- package/dist/checkbox/indicator/checkbox-indicator.svelte.d.ts +1 -0
- package/dist/checkbox/root/README.md +2 -2
- package/dist/checkbox/root/checkbox-root.svelte +133 -38
- package/dist/checkbox/root/checkbox-root.svelte.d.ts +21 -1
- package/dist/checkbox-group/README.md +95 -0
- package/dist/checkbox-group/index.d.ts +15 -0
- package/dist/checkbox-group/index.js +6 -0
- package/dist/checkbox-group/index.parts.d.ts +4 -0
- package/dist/checkbox-group/index.parts.js +7 -0
- package/dist/checkbox-group/label/checkbox-group-label.svelte +36 -0
- package/dist/checkbox-group/label/checkbox-group-label.svelte.d.ts +4 -0
- package/dist/checkbox-group/root/checkbox-group-root.svelte +118 -0
- package/dist/checkbox-group/root/checkbox-group-root.svelte.d.ts +4 -0
- package/dist/checkbox-group/root/context.svelte.d.ts +52 -0
- package/dist/checkbox-group/root/context.svelte.js +251 -0
- package/dist/checkbox-group/types.d.ts +57 -0
- package/dist/checkbox-group/types.js +1 -0
- package/dist/clock/README.md +3 -3
- package/dist/clock/axis/README.md +1 -1
- package/dist/clock/root/README.md +1 -1
- package/dist/clock/root/create-time-selection-state.svelte.d.ts +5 -0
- package/dist/clock/root/create-time-selection-state.svelte.js +113 -10
- package/dist/clock/root/wheel-options.d.ts +7 -3
- package/dist/clock/root/wheel-options.js +7 -15
- package/dist/clock/wheel-column/clock-wheel-column.svelte +10 -2
- package/dist/clock/wheel-column/clock-wheel-column.svelte.d.ts +2 -1
- package/dist/collapsible/README.md +3 -3
- package/dist/collapsible/root/collapsible-root.svelte +9 -4
- package/dist/collapsible/types.d.ts +13 -1
- package/dist/combobox/README.md +2 -2
- package/dist/combobox/button/README.md +6 -6
- package/dist/combobox/input/README.md +1 -1
- package/dist/combobox/input/combobox-input.svelte +15 -4
- package/dist/combobox/input/combobox-input.svelte.d.ts +3 -3
- package/dist/combobox/item/combobox-listboxitem.svelte +4 -2
- package/dist/combobox/item/combobox-listboxitem.svelte.d.ts +4 -2
- package/dist/combobox/item-indicator/README.md +1 -1
- package/dist/combobox/item-indicator/combobox-item-indicator.svelte +2 -2
- package/dist/combobox/item-indicator/combobox-item-indicator.svelte.d.ts +2 -2
- package/dist/combobox/list/combobox-listbox.svelte +98 -3
- package/dist/combobox/list/combobox-listbox.svelte.d.ts +28 -3
- package/dist/combobox/popover/README.md +1 -1
- package/dist/combobox/popover/combobox-popover.svelte +4 -56
- package/dist/combobox/root/README.md +24 -24
- package/dist/combobox/root/combobox.svelte +138 -56
- package/dist/combobox/root/combobox.svelte.d.ts +31 -11
- package/dist/combobox/root/context.d.ts +12 -0
- package/dist/combobox/status/README.md +3 -3
- package/dist/combobox/status/combobox-status.svelte +1 -1
- package/dist/combobox/status/combobox-status.svelte.d.ts +1 -1
- package/dist/combobox/tag/README.md +1 -1
- package/dist/combobox/tag/combobox-tag.svelte +1 -1
- package/dist/combobox/tag/combobox-tag.svelte.d.ts +1 -1
- package/dist/combobox/tag-remove/README.md +1 -1
- package/dist/combobox/tag-remove/combobox-tag-remove.svelte +14 -3
- package/dist/combobox/tag-remove/combobox-tag-remove.svelte.d.ts +7 -1
- package/dist/combobox/tags/README.md +1 -1
- package/dist/combobox/tags/combobox-tags.svelte +15 -12
- package/dist/combobox/tags/combobox-tags.svelte.d.ts +12 -10
- package/dist/combobox/trigger/README.md +7 -7
- package/dist/combobox/trigger/combobox-trigger.svelte +4 -1
- package/dist/datepicker/README.md +5 -4
- package/dist/datepicker/input/date-picker-input.svelte +3 -4
- package/dist/datepicker/input/date-picker-input.svelte.d.ts +3 -4
- package/dist/datepicker/root/date-picker-root.svelte +38 -2
- package/dist/datepicker/root/date-picker-root.svelte.d.ts +2 -0
- package/dist/datepicker/root/draft-evaluation.d.ts +7 -0
- package/dist/datepicker/root/draft-evaluation.js +2 -2
- package/dist/datepicker/trigger/README.md +1 -1
- package/dist/daterangepicker/README.md +3 -3
- package/dist/daterangepicker/input/date-range-picker-input.svelte +3 -4
- package/dist/daterangepicker/input/date-range-picker-input.svelte.d.ts +3 -4
- package/dist/daterangepicker/root/date-range-picker-root.svelte +19 -1
- package/dist/daterangepicker/root/date-range-picker-root.svelte.d.ts +2 -0
- package/dist/dialog/README.md +10 -2
- package/dist/dialog/close/dialog-close.svelte +57 -0
- package/dist/dialog/close/dialog-close.svelte.d.ts +19 -0
- package/dist/dialog/content/dialog-content.svelte +6 -4
- package/dist/dialog/content/dialog-content.svelte.d.ts +4 -4
- package/dist/dialog/description/dialog-description.svelte +46 -0
- package/dist/dialog/description/dialog-description.svelte.d.ts +20 -0
- package/dist/dialog/index.d.ts +9 -0
- package/dist/dialog/index.js +3 -0
- package/dist/dialog/index.parts.d.ts +3 -0
- package/dist/dialog/index.parts.js +3 -0
- package/dist/dialog/overlay/dialog-overlay.svelte +1 -1
- package/dist/dialog/overlay/dialog-overlay.svelte.d.ts +1 -1
- package/dist/dialog/portal/dialog-portal.svelte +1 -1
- package/dist/dialog/portal/dialog-portal.svelte.d.ts +1 -1
- package/dist/dialog/root/README.md +1 -1
- package/dist/dialog/root/context.d.ts +8 -0
- package/dist/dialog/root/dialog-root.svelte +100 -20
- package/dist/dialog/root/dialog-root.svelte.d.ts +15 -6
- package/dist/dialog/root/dialog-stack.d.ts +6 -22
- package/dist/dialog/root/dialog-stack.js +4 -33
- package/dist/dialog/title/dialog-title.svelte +43 -0
- package/dist/dialog/title/dialog-title.svelte.d.ts +21 -0
- package/dist/dialog/trigger/README.md +1 -1
- package/dist/drawer/README.md +111 -0
- package/dist/drawer/body/drawer-body.svelte +47 -0
- package/dist/drawer/body/drawer-body.svelte.d.ts +32 -0
- package/dist/drawer/close/drawer-close.svelte +52 -0
- package/dist/drawer/close/drawer-close.svelte.d.ts +20 -0
- package/dist/drawer/content/drawer-content.svelte +600 -0
- package/dist/drawer/content/drawer-content.svelte.d.ts +31 -0
- package/dist/drawer/description/drawer-description.svelte +40 -0
- package/dist/drawer/description/drawer-description.svelte.d.ts +20 -0
- package/dist/drawer/indent/drawer-indent-background.svelte +36 -0
- package/dist/drawer/indent/drawer-indent-background.svelte.d.ts +17 -0
- package/dist/drawer/indent/drawer-indent.svelte +59 -0
- package/dist/drawer/indent/drawer-indent.svelte.d.ts +32 -0
- package/dist/drawer/index.d.ts +49 -0
- package/dist/drawer/index.js +25 -0
- package/dist/drawer/index.parts.d.ts +14 -0
- package/dist/drawer/index.parts.js +15 -0
- package/dist/drawer/overlay/drawer-overlay.svelte +67 -0
- package/dist/drawer/overlay/drawer-overlay.svelte.d.ts +12 -0
- package/dist/drawer/portal/drawer-portal.svelte +57 -0
- package/dist/drawer/portal/drawer-portal.svelte.d.ts +13 -0
- package/dist/drawer/root/context.d.ts +81 -0
- package/dist/drawer/root/context.js +20 -0
- package/dist/drawer/root/drawer-root.svelte +348 -0
- package/dist/drawer/root/drawer-root.svelte.d.ts +79 -0
- package/dist/drawer/root/drawer-stack.svelte.d.ts +73 -0
- package/dist/drawer/root/drawer-stack.svelte.js +113 -0
- package/dist/drawer/root/handle.svelte.d.ts +39 -0
- package/dist/drawer/root/handle.svelte.js +64 -0
- package/dist/drawer/root/keyboard-context.d.ts +13 -0
- package/dist/drawer/root/keyboard-context.js +8 -0
- package/dist/drawer/root/presence-context.d.ts +22 -0
- package/dist/drawer/root/presence-context.js +8 -0
- package/dist/drawer/root/snap-points.d.ts +68 -0
- package/dist/drawer/root/snap-points.js +120 -0
- package/dist/drawer/root/starting-style.svelte.d.ts +18 -0
- package/dist/drawer/root/starting-style.svelte.js +38 -0
- package/dist/drawer/root/types.d.ts +36 -0
- package/dist/drawer/root/types.js +1 -0
- package/dist/drawer/root/viewport-context.d.ts +2 -0
- package/dist/drawer/root/viewport-context.js +16 -0
- package/dist/drawer/swipe-area/drawer-swipe-area.svelte +143 -0
- package/dist/drawer/swipe-area/drawer-swipe-area.svelte.d.ts +22 -0
- package/dist/drawer/title/drawer-title.svelte +37 -0
- package/dist/drawer/title/drawer-title.svelte.d.ts +21 -0
- package/dist/drawer/trigger/drawer-trigger.svelte +90 -0
- package/dist/drawer/trigger/drawer-trigger.svelte.d.ts +41 -0
- package/dist/drawer/viewport/drawer-viewport.svelte +69 -0
- package/dist/drawer/viewport/drawer-viewport.svelte.d.ts +15 -0
- package/dist/drawer/virtual-keyboard/drawer-virtual-keyboard-provider.svelte +88 -0
- package/dist/drawer/virtual-keyboard/drawer-virtual-keyboard-provider.svelte.d.ts +29 -0
- package/dist/dropzone/README.md +4 -6
- package/dist/hooks/use-virtual-focus.svelte.d.ts +9 -0
- package/dist/hooks/use-virtual-focus.svelte.js +7 -1
- package/dist/index.d.ts +24 -0
- package/dist/index.js +23 -0
- package/dist/input/input.svelte +6 -6
- package/dist/input/input.svelte.d.ts +6 -6
- package/dist/internal/environment.d.ts +11 -0
- package/dist/internal/environment.js +14 -0
- package/dist/internal/localized-strings.d.ts +152 -0
- package/dist/internal/localized-strings.js +152 -0
- package/dist/internal/number-precision.d.ts +9 -0
- package/dist/internal/number-precision.js +27 -0
- package/dist/listbox/README.md +20 -1
- package/dist/listbox/item/listbox-item.svelte +43 -18
- package/dist/listbox/item/listbox-item.svelte.d.ts +24 -15
- package/dist/listbox/root/README.md +1 -1
- package/dist/listbox/root/context.d.ts +56 -1
- package/dist/listbox/root/context.js +118 -1
- package/dist/listbox/root/listbox.svelte +400 -27
- package/dist/listbox/root/listbox.svelte.d.ts +73 -16
- package/dist/locale-provider/README.md +1 -6
- package/dist/menu/README.md +41 -4
- package/dist/menu/content/menu-content.svelte +31 -14
- package/dist/menu/content/menu-content.svelte.d.ts +14 -9
- package/dist/menu/context-trigger/menu-context-trigger.svelte +194 -0
- package/dist/menu/context-trigger/menu-context-trigger.svelte.d.ts +35 -0
- package/dist/menu/group/menu-group-label.svelte +1 -1
- package/dist/menu/group/menu-group-label.svelte.d.ts +1 -1
- package/dist/menu/index.d.ts +4 -1
- package/dist/menu/index.js +1 -0
- package/dist/menu/index.parts.d.ts +1 -0
- package/dist/menu/index.parts.js +1 -0
- package/dist/menu/item/menu-item.svelte +11 -8
- package/dist/menu/item/menu-item.svelte.d.ts +11 -8
- package/dist/menu/overlay/menu-overlay.svelte +2 -2
- package/dist/menu/overlay/menu-overlay.svelte.d.ts +1 -1
- package/dist/menu/root/context.d.ts +24 -3
- package/dist/menu/root/focus-state.d.ts +2 -2
- package/dist/menu/root/focus-state.js +8 -32
- package/dist/menu/root/menu-root.svelte +14 -8
- package/dist/menu/root/menu-root.svelte.d.ts +14 -8
- package/dist/menu/root/menu-state.svelte.d.ts +1 -1
- package/dist/menu/root/menu-state.svelte.js +24 -1
- package/dist/menu/separator/menu-separator.svelte +1 -1
- package/dist/menu/separator/menu-separator.svelte.d.ts +1 -1
- package/dist/menu/submenu/menu-submenu-root.svelte +10 -7
- package/dist/menu/submenu/menu-submenu-root.svelte.d.ts +10 -7
- package/dist/numberfield/root/README.md +1 -1
- package/dist/numberfield/root/number-field-root.svelte +2 -1
- package/dist/numberfield/root/number-utils.js +1 -20
- package/dist/numberfield/scrub-area-cursor/README.md +1 -1
- package/dist/popover/README.md +1 -1
- package/dist/popover/content/popover-content.svelte +22 -16
- package/dist/popover/content/popover-content.svelte.d.ts +19 -14
- package/dist/popover/overlay/popover-overlay.svelte +2 -2
- package/dist/popover/overlay/popover-overlay.svelte.d.ts +1 -1
- package/dist/popover/root/README.md +1 -1
- package/dist/popover/root/focus-state.d.ts +2 -2
- package/dist/popover/root/focus-state.js +7 -34
- package/dist/popover/root/popover-root.svelte +29 -14
- package/dist/popover/root/popover-root.svelte.d.ts +16 -5
- package/dist/popover/trigger/README.md +1 -1
- package/dist/primitives/aria-hide-outside.d.ts +13 -0
- package/dist/primitives/aria-hide-outside.js +7 -1
- package/dist/primitives/contain-wheel.d.ts +9 -0
- package/dist/primitives/contain-wheel.js +41 -0
- package/dist/primitives/floating.d.ts +49 -8
- package/dist/primitives/floating.js +75 -7
- package/dist/primitives/focus-trap.d.ts +2 -0
- package/dist/primitives/focus-trap.js +7 -1
- package/dist/primitives/focus-visible.svelte.d.ts +14 -0
- package/dist/primitives/focus-visible.svelte.js +19 -0
- package/dist/primitives/index.d.ts +3 -0
- package/dist/primitives/index.js +3 -0
- package/dist/primitives/input-modality.d.ts +7 -0
- package/dist/primitives/input-modality.js +32 -5
- package/dist/primitives/keyboard-navigation.d.ts +29 -5
- package/dist/primitives/keyboard-navigation.js +27 -17
- package/dist/primitives/layer-stack.d.ts +29 -0
- package/dist/primitives/layer-stack.js +35 -0
- package/dist/primitives/list-virtualizer.d.ts +75 -0
- package/dist/primitives/list-virtualizer.js +59 -0
- package/dist/primitives/long-press.d.ts +59 -0
- package/dist/primitives/long-press.js +142 -0
- package/dist/primitives/presence.svelte.js +6 -1
- package/dist/primitives/scroll-lock.d.ts +47 -3
- package/dist/primitives/scroll-lock.js +191 -9
- package/dist/primitives/swipe-gesture.d.ts +126 -0
- package/dist/primitives/swipe-gesture.js +351 -0
- package/dist/primitives/text.d.ts +8 -0
- package/dist/primitives/text.js +13 -0
- package/dist/primitives/trigger-focus-state.d.ts +29 -0
- package/dist/primitives/trigger-focus-state.js +57 -0
- package/dist/progress/README.md +54 -0
- package/dist/progress/index.d.ts +21 -0
- package/dist/progress/index.js +9 -0
- package/dist/progress/index.parts.d.ts +5 -0
- package/dist/progress/index.parts.js +5 -0
- package/dist/progress/indicator/progress-indicator.svelte +37 -0
- package/dist/progress/indicator/progress-indicator.svelte.d.ts +4 -0
- package/dist/progress/label/progress-label.svelte +34 -0
- package/dist/progress/label/progress-label.svelte.d.ts +4 -0
- package/dist/progress/root/context.d.ts +26 -0
- package/dist/progress/root/context.js +15 -0
- package/dist/progress/root/progress-root.svelte +136 -0
- package/dist/progress/root/progress-root.svelte.d.ts +4 -0
- package/dist/progress/root/progress-utils.d.ts +12 -0
- package/dist/progress/root/progress-utils.js +41 -0
- package/dist/progress/track/progress-track.svelte +27 -0
- package/dist/progress/track/progress-track.svelte.d.ts +4 -0
- package/dist/progress/types.d.ts +81 -0
- package/dist/progress/types.js +1 -0
- package/dist/progress/value/progress-value.svelte +36 -0
- package/dist/progress/value/progress-value.svelte.d.ts +4 -0
- package/dist/radio-group/README.md +103 -0
- package/dist/radio-group/index.d.ts +18 -0
- package/dist/radio-group/index.js +9 -0
- package/dist/radio-group/index.parts.d.ts +4 -0
- package/dist/radio-group/index.parts.js +4 -0
- package/dist/radio-group/indicator/radio-group-indicator.svelte +43 -0
- package/dist/radio-group/indicator/radio-group-indicator.svelte.d.ts +12 -0
- package/dist/radio-group/item/context.d.ts +18 -0
- package/dist/radio-group/item/context.js +15 -0
- package/dist/radio-group/item/radio-group-item.svelte +377 -0
- package/dist/radio-group/item/radio-group-item.svelte.d.ts +35 -0
- package/dist/radio-group/label/radio-group-label.svelte +37 -0
- package/dist/radio-group/label/radio-group-label.svelte.d.ts +4 -0
- package/dist/radio-group/root/context.svelte.d.ts +57 -0
- package/dist/radio-group/root/context.svelte.js +284 -0
- package/dist/radio-group/root/radio-group-root.svelte +193 -0
- package/dist/radio-group/root/radio-group-root.svelte.d.ts +4 -0
- package/dist/radio-group/types.d.ts +50 -0
- package/dist/radio-group/types.js +1 -0
- package/dist/select/README.md +129 -0
- package/dist/select/index.d.ts +30 -0
- package/dist/select/index.js +16 -0
- package/dist/select/index.parts.d.ts +8 -0
- package/dist/select/index.parts.js +9 -0
- package/dist/select/item/select-item.svelte +68 -0
- package/dist/select/item/select-item.svelte.d.ts +10 -0
- package/dist/select/item-indicator/select-item-indicator.svelte +55 -0
- package/dist/select/item-indicator/select-item-indicator.svelte.d.ts +4 -0
- package/dist/select/label/select-label.svelte +46 -0
- package/dist/select/label/select-label.svelte.d.ts +4 -0
- package/dist/select/list/select-list.svelte +241 -0
- package/dist/select/list/select-list.svelte.d.ts +62 -0
- package/dist/select/popover/select-popover.svelte +80 -0
- package/dist/select/popover/select-popover.svelte.d.ts +9 -0
- package/dist/select/root/context.d.ts +106 -0
- package/dist/select/root/context.js +22 -0
- package/dist/select/root/select-root.svelte +544 -0
- package/dist/select/root/select-root.svelte.d.ts +25 -0
- package/dist/select/trigger/select-trigger.svelte +192 -0
- package/dist/select/trigger/select-trigger.svelte.d.ts +4 -0
- package/dist/select/types.d.ts +133 -0
- package/dist/select/types.js +1 -0
- package/dist/select/value/select-value.svelte +61 -0
- package/dist/select/value/select-value.svelte.d.ts +4 -0
- package/dist/separator/README.md +35 -0
- package/dist/separator/index.d.ts +7 -0
- package/dist/separator/index.js +3 -0
- package/dist/separator/separator.svelte +254 -0
- package/dist/separator/separator.svelte.d.ts +45 -0
- package/dist/separator/types.d.ts +1 -0
- package/dist/separator/types.js +1 -0
- package/dist/slider/README.md +61 -0
- package/dist/slider/fill/slider-fill.svelte +40 -0
- package/dist/slider/fill/slider-fill.svelte.d.ts +4 -0
- package/dist/slider/index.d.ts +9 -0
- package/dist/slider/index.js +8 -0
- package/dist/slider/index.parts.d.ts +6 -0
- package/dist/slider/index.parts.js +6 -0
- package/dist/slider/label/slider-label.svelte +44 -0
- package/dist/slider/label/slider-label.svelte.d.ts +4 -0
- package/dist/slider/output/slider-output.svelte +46 -0
- package/dist/slider/output/slider-output.svelte.d.ts +4 -0
- package/dist/slider/root/context.d.ts +106 -0
- package/dist/slider/root/context.js +15 -0
- package/dist/slider/root/slider-root.svelte +545 -0
- package/dist/slider/root/slider-root.svelte.d.ts +4 -0
- package/dist/slider/root/slider-utils.d.ts +57 -0
- package/dist/slider/root/slider-utils.js +88 -0
- package/dist/slider/thumb/slider-thumb.svelte +276 -0
- package/dist/slider/thumb/slider-thumb.svelte.d.ts +4 -0
- package/dist/slider/track/slider-track.svelte +60 -0
- package/dist/slider/track/slider-track.svelte.d.ts +4 -0
- package/dist/slider/types.d.ts +144 -0
- package/dist/slider/types.js +1 -0
- package/dist/switch/root/README.md +2 -2
- package/dist/switch/root/switch-root.svelte +49 -21
- package/dist/switch/root/switch-root.svelte.d.ts +26 -14
- package/dist/switch/thumb/switch-thumb.svelte +1 -1
- package/dist/switch/thumb/switch-thumb.svelte.d.ts +1 -1
- package/dist/table/README.md +16 -9
- package/dist/table/body/table-body.svelte +84 -9
- package/dist/table/cell/table-cell.svelte +27 -10
- package/dist/table/checkbox/table-checkbox.svelte +3 -0
- package/dist/table/checkbox-indicator/README.md +1 -1
- package/dist/table/column/table-column.svelte +5 -1
- package/dist/table/column-header-cell/table-column-header-cell.svelte +24 -0
- package/dist/table/column-resizer/README.md +2 -2
- package/dist/table/column-resizer/table-column-resizer.svelte +1 -5
- package/dist/table/index.d.ts +1 -1
- package/dist/table/index.js +1 -1
- package/dist/table/interactive-cell/table-interactive-cell.svelte +26 -10
- package/dist/table/root/README.md +1 -1
- package/dist/table/root/context.svelte.d.ts +17 -0
- package/dist/table/root/context.svelte.js +212 -66
- package/dist/table/root/table-root.svelte +36 -6
- package/dist/table/row/table-row.svelte +14 -14
- package/dist/table/sort-trigger/README.md +1 -1
- package/dist/table/sort-trigger/table-sort-trigger.svelte +5 -1
- package/dist/table/types.d.ts +32 -14
- package/dist/tabs/root/tabs-root.svelte +20 -6
- package/dist/tabs/types.d.ts +9 -0
- package/dist/timepicker/README.md +3 -2
- package/dist/timepicker/input/README.md +1 -1
- package/dist/timepicker/input/time-picker-input.svelte +66 -5
- package/dist/timepicker/input/time-picker-input.svelte.d.ts +18 -1
- package/dist/timepicker/root/README.md +1 -1
- package/dist/timepicker/root/time-picker-root.svelte +11 -0
- package/dist/timepicker/root/time-picker-root.svelte.d.ts +2 -0
- package/dist/timepicker/trigger/README.md +1 -1
- package/dist/toast/README.md +75 -0
- package/dist/toast/action/toast-action.svelte +42 -0
- package/dist/toast/action/toast-action.svelte.d.ts +4 -0
- package/dist/toast/close/toast-close.svelte +41 -0
- package/dist/toast/close/toast-close.svelte.d.ts +4 -0
- package/dist/toast/content/toast-content.svelte +24 -0
- package/dist/toast/content/toast-content.svelte.d.ts +4 -0
- package/dist/toast/description/toast-description.svelte +41 -0
- package/dist/toast/description/toast-description.svelte.d.ts +4 -0
- package/dist/toast/index.d.ts +34 -0
- package/dist/toast/index.js +15 -0
- package/dist/toast/index.parts.d.ts +9 -0
- package/dist/toast/index.parts.js +9 -0
- package/dist/toast/positioner/toast-positioner.svelte +75 -0
- package/dist/toast/positioner/toast-positioner.svelte.d.ts +4 -0
- package/dist/toast/provider/context.d.ts +36 -0
- package/dist/toast/provider/context.js +22 -0
- package/dist/toast/provider/toast-manager.svelte.d.ts +113 -0
- package/dist/toast/provider/toast-manager.svelte.js +210 -0
- package/dist/toast/provider/toast-provider.svelte +98 -0
- package/dist/toast/provider/toast-provider.svelte.d.ts +4 -0
- package/dist/toast/root/context.d.ts +18 -0
- package/dist/toast/root/context.js +15 -0
- package/dist/toast/root/toast-root.svelte +296 -0
- package/dist/toast/root/toast-root.svelte.d.ts +4 -0
- package/dist/toast/title/toast-title.svelte +38 -0
- package/dist/toast/title/toast-title.svelte.d.ts +4 -0
- package/dist/toast/types.d.ts +100 -0
- package/dist/toast/types.js +1 -0
- package/dist/toast/viewport/toast-viewport.svelte +389 -0
- package/dist/toast/viewport/toast-viewport.svelte.d.ts +4 -0
- package/dist/toggle/README.md +1 -1
- package/dist/toggle/root/toggle-root.svelte +28 -0
- package/dist/toggle/root/toggle-root.svelte.d.ts +19 -0
- package/dist/toggle-group/README.md +12 -4
- package/dist/toggle-group/index.d.ts +2 -0
- package/dist/toggle-group/index.parts.d.ts +1 -0
- package/dist/toggle-group/index.parts.js +4 -0
- package/dist/toggle-group/root/context.svelte.d.ts +1 -1
- package/dist/toggle-group/root/context.svelte.js +24 -8
- package/dist/toggle-group/root/toggle-group-root.svelte +24 -4
- package/dist/toggle-group/root/toggle-group-teardown-order-child.svelte +13 -0
- package/dist/toggle-group/root/toggle-group-teardown-order-child.svelte.d.ts +7 -0
- package/dist/toggle-group/types.d.ts +9 -0
- package/dist/tooltip/README.md +53 -0
- package/dist/tooltip/arrow/tooltip-arrow.svelte +36 -0
- package/dist/tooltip/arrow/tooltip-arrow.svelte.d.ts +4 -0
- package/dist/tooltip/content/tooltip-content.svelte +148 -0
- package/dist/tooltip/content/tooltip-content.svelte.d.ts +4 -0
- package/dist/tooltip/index.d.ts +8 -0
- package/dist/tooltip/index.js +7 -0
- package/dist/tooltip/index.parts.d.ts +5 -0
- package/dist/tooltip/index.parts.js +5 -0
- package/dist/tooltip/provider/tooltip-provider.svelte +36 -0
- package/dist/tooltip/provider/tooltip-provider.svelte.d.ts +4 -0
- package/dist/tooltip/root/context.d.ts +46 -0
- package/dist/tooltip/root/context.js +22 -0
- package/dist/tooltip/root/safe-polygon.d.ts +26 -0
- package/dist/tooltip/root/safe-polygon.js +66 -0
- package/dist/tooltip/root/tooltip-group.d.ts +26 -0
- package/dist/tooltip/root/tooltip-group.js +41 -0
- package/dist/tooltip/root/tooltip-root.svelte +461 -0
- package/dist/tooltip/root/tooltip-root.svelte.d.ts +4 -0
- package/dist/tooltip/trigger/tooltip-trigger.svelte +52 -0
- package/dist/tooltip/trigger/tooltip-trigger.svelte.d.ts +4 -0
- package/dist/tooltip/types.d.ts +105 -0
- package/dist/tooltip/types.js +1 -0
- package/dist/transfer-list/README.md +110 -0
- package/dist/transfer-list/index.d.ts +33 -0
- package/dist/transfer-list/index.js +18 -0
- package/dist/transfer-list/index.parts.d.ts +9 -0
- package/dist/transfer-list/index.parts.js +10 -0
- package/dist/transfer-list/item/transfer-list-item.svelte +74 -0
- package/dist/transfer-list/item/transfer-list-item.svelte.d.ts +35 -0
- package/dist/transfer-list/list/transfer-list-list.svelte +162 -0
- package/dist/transfer-list/list/transfer-list-list.svelte.d.ts +56 -0
- package/dist/transfer-list/list/transfer-list-source.svelte +13 -0
- package/dist/transfer-list/list/transfer-list-source.svelte.d.ts +36 -0
- package/dist/transfer-list/list/transfer-list-target.svelte +14 -0
- package/dist/transfer-list/list/transfer-list-target.svelte.d.ts +36 -0
- package/dist/transfer-list/move/transfer-list-move-all.svelte +14 -0
- package/dist/transfer-list/move/transfer-list-move-all.svelte.d.ts +10 -0
- package/dist/transfer-list/move/transfer-list-move-button.svelte +103 -0
- package/dist/transfer-list/move/transfer-list-move-button.svelte.d.ts +25 -0
- package/dist/transfer-list/move/transfer-list-move-down.svelte +14 -0
- package/dist/transfer-list/move/transfer-list-move-down.svelte.d.ts +10 -0
- package/dist/transfer-list/move/transfer-list-move-selected.svelte +14 -0
- package/dist/transfer-list/move/transfer-list-move-selected.svelte.d.ts +10 -0
- package/dist/transfer-list/move/transfer-list-move-up.svelte +14 -0
- package/dist/transfer-list/move/transfer-list-move-up.svelte.d.ts +10 -0
- package/dist/transfer-list/move/transfer-list-reorder-button.svelte +83 -0
- package/dist/transfer-list/move/transfer-list-reorder-button.svelte.d.ts +21 -0
- package/dist/transfer-list/root/context.d.ts +70 -0
- package/dist/transfer-list/root/context.js +24 -0
- package/dist/transfer-list/root/transfer-list-root.svelte +345 -0
- package/dist/transfer-list/root/transfer-list-root.svelte.d.ts +68 -0
- package/dist/transfer-list/root/types.d.ts +22 -0
- package/dist/transfer-list/root/types.js +4 -0
- package/dist/transfer-list/status/transfer-list-status.svelte +70 -0
- package/dist/transfer-list/status/transfer-list-status.svelte.d.ts +15 -0
- package/dist/tree/README.md +3 -3
- package/dist/tree/checkbox-indicator/README.md +1 -1
- package/dist/tree/root/README.md +1 -1
- package/dist/tree/root/context.svelte.js +6 -0
- package/dist/tree/root/tree-root.svelte +22 -8
- package/dist/tree/types.d.ts +23 -1
- package/package.json +282 -224
|
@@ -8,6 +8,20 @@ let currentModality = 'virtual';
|
|
|
8
8
|
const RECENT_INPUT_WINDOW_MS = 50;
|
|
9
9
|
let lastInputEventTime = Number.NEGATIVE_INFINITY;
|
|
10
10
|
const listenedWindows = new WeakSet();
|
|
11
|
+
/**
|
|
12
|
+
* Notified whenever the modality changes. `data-focus-visible` is otherwise a snapshot taken
|
|
13
|
+
* when the element took focus, so a pointer press followed by a key press left the ring off
|
|
14
|
+
* while the browser had already flipped `:focus-visible` back on.
|
|
15
|
+
*/
|
|
16
|
+
const modalityListeners = new Set();
|
|
17
|
+
function setModality(next) {
|
|
18
|
+
if (currentModality === next)
|
|
19
|
+
return;
|
|
20
|
+
currentModality = next;
|
|
21
|
+
for (const listener of [...modalityListeners]) {
|
|
22
|
+
listener(next);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
11
25
|
let forcedFocusTarget = null;
|
|
12
26
|
let forcedFocusModality = null;
|
|
13
27
|
function isModifierOnlyKey(event) {
|
|
@@ -29,11 +43,11 @@ function ensureWindowListeners(win) {
|
|
|
29
43
|
lastInputEventTime = Date.now();
|
|
30
44
|
if (!isKeyboardModalityKey(event))
|
|
31
45
|
return;
|
|
32
|
-
|
|
46
|
+
setModality('keyboard');
|
|
33
47
|
};
|
|
34
48
|
const onPointerDown = () => {
|
|
35
49
|
lastInputEventTime = Date.now();
|
|
36
|
-
|
|
50
|
+
setModality('pointer');
|
|
37
51
|
};
|
|
38
52
|
const onFocusIn = (event) => {
|
|
39
53
|
// A programmatic focus with an explicit modality (`focusWithModality`) must keep it —
|
|
@@ -45,7 +59,7 @@ function ensureWindowListeners(win) {
|
|
|
45
59
|
return;
|
|
46
60
|
// No recent keyboard/pointer input: this focus move came from an assistive technology
|
|
47
61
|
// (or a script), so focus rings must show again.
|
|
48
|
-
|
|
62
|
+
setModality('virtual');
|
|
49
63
|
};
|
|
50
64
|
win.addEventListener('keydown', onKeyDown, true);
|
|
51
65
|
win.addEventListener('pointerdown', onPointerDown, true);
|
|
@@ -90,12 +104,25 @@ export function trackInteractionModality(event, target) {
|
|
|
90
104
|
initInputModality(target);
|
|
91
105
|
const inferred = inferModalityFromEvent(event);
|
|
92
106
|
if (inferred) {
|
|
93
|
-
|
|
107
|
+
setModality(inferred);
|
|
94
108
|
}
|
|
95
109
|
}
|
|
96
110
|
export function getInteractionModality() {
|
|
97
111
|
return currentModality;
|
|
98
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Calls `listener` whenever the interaction modality changes, and returns the unsubscribe
|
|
115
|
+
* function. Components use it to re-read `shouldShowFocusVisible` for an element that already
|
|
116
|
+
* holds focus: the browser re-evaluates `:focus-visible` on its own, and this is what lets a
|
|
117
|
+
* component notice.
|
|
118
|
+
*/
|
|
119
|
+
export function subscribeInputModality(listener) {
|
|
120
|
+
initInputModality();
|
|
121
|
+
modalityListeners.add(listener);
|
|
122
|
+
return () => {
|
|
123
|
+
modalityListeners.delete(listener);
|
|
124
|
+
};
|
|
125
|
+
}
|
|
99
126
|
export function shouldShowFocusVisible(target) {
|
|
100
127
|
if (!target)
|
|
101
128
|
return false;
|
|
@@ -111,7 +138,7 @@ export function focusWithModality(target, modality, options) {
|
|
|
111
138
|
// If it is consumed later, currentModality still preserves the same modality as fallback.
|
|
112
139
|
forcedFocusTarget = target;
|
|
113
140
|
forcedFocusModality = modality;
|
|
114
|
-
|
|
141
|
+
setModality(modality);
|
|
115
142
|
if (modality === 'pointer') {
|
|
116
143
|
const pointerFocusOptions = {
|
|
117
144
|
...(options ?? {}),
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import { type Writable } from 'svelte/store';
|
|
2
2
|
export type KeyboardNavigationOrientation = 'vertical' | 'horizontal' | 'both';
|
|
3
|
+
/**
|
|
4
|
+
* Why the focus moved, for consumers that do more than move a highlight.
|
|
5
|
+
*
|
|
6
|
+
* `extend` is set when the key was pressed with Shift held — the multi-select
|
|
7
|
+
* listbox pattern, where arrowing extends the selection from an anchor instead of
|
|
8
|
+
* just walking it. Programmatic moves (`focusNext()`, `focusById()`) carry no
|
|
9
|
+
* intent at all, so a consumer that ignores this argument behaves exactly as before.
|
|
10
|
+
*/
|
|
11
|
+
export type NavigationIntent = {
|
|
12
|
+
extend?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The item focus moved away from. Reported because the consumer cannot recover it
|
|
15
|
+
* afterwards: `focusItem` focuses the element before it notifies, and the focused
|
|
16
|
+
* element's own `focus` handler has already overwritten the consumer's idea of where
|
|
17
|
+
* focus was by the time this runs.
|
|
18
|
+
*/
|
|
19
|
+
from?: string | number | null;
|
|
20
|
+
};
|
|
3
21
|
export type KeyboardNavigationOptions = {
|
|
4
22
|
/**
|
|
5
23
|
* Orientation of the navigation
|
|
@@ -26,7 +44,7 @@ export type KeyboardNavigationOptions = {
|
|
|
26
44
|
/**
|
|
27
45
|
* Callback when focused item changes
|
|
28
46
|
*/
|
|
29
|
-
onFocusChange?: (id: string | number | null, element: HTMLElement | null) => void;
|
|
47
|
+
onFocusChange?: (id: string | number | null, element: HTMLElement | null, intent?: NavigationIntent) => void;
|
|
30
48
|
/**
|
|
31
49
|
* Callback for Ctrl+A (select all)
|
|
32
50
|
*/
|
|
@@ -53,14 +71,20 @@ export type KeyboardNavigationReturn = {
|
|
|
53
71
|
destroy: () => void;
|
|
54
72
|
};
|
|
55
73
|
/** Programmatic navigation methods */
|
|
56
|
-
focusNext: () => void;
|
|
57
|
-
focusPrevious: () => void;
|
|
58
|
-
focusFirst: () => void;
|
|
59
|
-
focusLast: () => void;
|
|
74
|
+
focusNext: (intent?: NavigationIntent) => void;
|
|
75
|
+
focusPrevious: (intent?: NavigationIntent) => void;
|
|
76
|
+
focusFirst: (intent?: NavigationIntent) => void;
|
|
77
|
+
focusLast: (intent?: NavigationIntent) => void;
|
|
60
78
|
focusById: (id: string | number) => void;
|
|
61
79
|
setCurrentId: (id: string | number | null) => void;
|
|
62
80
|
/** Update items (call after DOM changes) */
|
|
63
81
|
updateItems: () => void;
|
|
82
|
+
/**
|
|
83
|
+
* Searches with a printable character, the same as a key press on the container. For a
|
|
84
|
+
* widget that opens on a character typed outside the container, such as a select: the
|
|
85
|
+
* character is applied once the items exist.
|
|
86
|
+
*/
|
|
87
|
+
typeahead: (char: string) => void;
|
|
64
88
|
};
|
|
65
89
|
/**
|
|
66
90
|
* Creates a keyboard navigation controller for list-like components.
|
|
@@ -95,11 +95,14 @@ export function createKeyboardNavigation(options = {}) {
|
|
|
95
95
|
}
|
|
96
96
|
return rawId;
|
|
97
97
|
}
|
|
98
|
-
function focusItem(element) {
|
|
98
|
+
function focusItem(element, intent) {
|
|
99
|
+
let previousId = null;
|
|
100
|
+
focusedId.subscribe((value) => (previousId = value))();
|
|
101
|
+
const resolvedIntent = intent ? { ...intent, from: previousId } : undefined;
|
|
99
102
|
if (!element) {
|
|
100
103
|
focusedId.set(null);
|
|
101
104
|
focusedElement.set(null);
|
|
102
|
-
onFocusChange?.(null, null);
|
|
105
|
+
onFocusChange?.(null, null, resolvedIntent);
|
|
103
106
|
return;
|
|
104
107
|
}
|
|
105
108
|
const id = getItemId(element);
|
|
@@ -108,7 +111,7 @@ export function createKeyboardNavigation(options = {}) {
|
|
|
108
111
|
// Note: tabIndex is controlled by Svelte via isFocused state
|
|
109
112
|
// We just call focus() and notify - the component will react to onFocusChange
|
|
110
113
|
element.focus();
|
|
111
|
-
onFocusChange?.(id, element);
|
|
114
|
+
onFocusChange?.(id, element, resolvedIntent);
|
|
112
115
|
}
|
|
113
116
|
function getCurrentIndex() {
|
|
114
117
|
// The live DOM focus wins: a native focus change (mouse click, script `.focus()`, focus
|
|
@@ -126,7 +129,7 @@ export function createKeyboardNavigation(options = {}) {
|
|
|
126
129
|
focusedElement.subscribe((el) => (currentElement = el))();
|
|
127
130
|
return currentElement ? items.indexOf(currentElement) : -1;
|
|
128
131
|
}
|
|
129
|
-
function focusNext() {
|
|
132
|
+
function focusNext(intent) {
|
|
130
133
|
items = getItems();
|
|
131
134
|
if (items.length === 0)
|
|
132
135
|
return;
|
|
@@ -141,9 +144,9 @@ export function createKeyboardNavigation(options = {}) {
|
|
|
141
144
|
else {
|
|
142
145
|
nextIdx = Math.min(currentIdx + 1, items.length - 1);
|
|
143
146
|
}
|
|
144
|
-
focusItem(items[nextIdx]);
|
|
147
|
+
focusItem(items[nextIdx], intent);
|
|
145
148
|
}
|
|
146
|
-
function focusPrevious() {
|
|
149
|
+
function focusPrevious(intent) {
|
|
147
150
|
items = getItems();
|
|
148
151
|
if (items.length === 0)
|
|
149
152
|
return;
|
|
@@ -158,19 +161,19 @@ export function createKeyboardNavigation(options = {}) {
|
|
|
158
161
|
else {
|
|
159
162
|
prevIdx = Math.max(currentIdx - 1, 0);
|
|
160
163
|
}
|
|
161
|
-
focusItem(items[prevIdx]);
|
|
164
|
+
focusItem(items[prevIdx], intent);
|
|
162
165
|
}
|
|
163
|
-
function focusFirst() {
|
|
166
|
+
function focusFirst(intent) {
|
|
164
167
|
items = getItems();
|
|
165
168
|
if (items.length === 0)
|
|
166
169
|
return;
|
|
167
|
-
focusItem(items[0]);
|
|
170
|
+
focusItem(items[0], intent);
|
|
168
171
|
}
|
|
169
|
-
function focusLast() {
|
|
172
|
+
function focusLast(intent) {
|
|
170
173
|
items = getItems();
|
|
171
174
|
if (items.length === 0)
|
|
172
175
|
return;
|
|
173
|
-
focusItem(items[items.length - 1]);
|
|
176
|
+
focusItem(items[items.length - 1], intent);
|
|
174
177
|
}
|
|
175
178
|
function focusById(id) {
|
|
176
179
|
items = getItems();
|
|
@@ -216,7 +219,9 @@ export function createKeyboardNavigation(options = {}) {
|
|
|
216
219
|
// the candidate list as the LAST entry, so a growing multi-character buffer can still
|
|
217
220
|
// confirm it. With nothing focused, this is a plain first-match-from-start search.
|
|
218
221
|
const currentIdx = getCurrentIndex();
|
|
219
|
-
const ordered = currentIdx === -1
|
|
222
|
+
const ordered = currentIdx === -1
|
|
223
|
+
? items
|
|
224
|
+
: [...items.slice(currentIdx + 1), ...items.slice(0, currentIdx + 1)];
|
|
220
225
|
const match = ordered.find((el) => {
|
|
221
226
|
// Prefer an explicit text value (e.g. Menu.Item's `textValue` exposed as
|
|
222
227
|
// `data-text-value`) over the rendered text content.
|
|
@@ -246,14 +251,18 @@ export function createKeyboardNavigation(options = {}) {
|
|
|
246
251
|
: orientation === 'vertical'
|
|
247
252
|
? ['ArrowUp']
|
|
248
253
|
: ['ArrowUp', 'ArrowLeft'];
|
|
254
|
+
// Shift turns a move into an extension of the selection from the anchor — the
|
|
255
|
+
// multi-select listbox pattern. The move itself is unchanged; only consumers that
|
|
256
|
+
// read the intent do anything extra with it.
|
|
257
|
+
const intent = event.shiftKey ? { extend: true } : undefined;
|
|
249
258
|
if (nextKeys.includes(key)) {
|
|
250
259
|
event.preventDefault();
|
|
251
|
-
focusNext();
|
|
260
|
+
focusNext(intent);
|
|
252
261
|
return;
|
|
253
262
|
}
|
|
254
263
|
if (prevKeys.includes(key)) {
|
|
255
264
|
event.preventDefault();
|
|
256
|
-
focusPrevious();
|
|
265
|
+
focusPrevious(intent);
|
|
257
266
|
return;
|
|
258
267
|
}
|
|
259
268
|
// NOTE: key repeat is only suppressed for keys this handler actually consumes
|
|
@@ -263,12 +272,12 @@ export function createKeyboardNavigation(options = {}) {
|
|
|
263
272
|
if (homeEndKeys) {
|
|
264
273
|
if (key === 'Home') {
|
|
265
274
|
event.preventDefault();
|
|
266
|
-
focusFirst();
|
|
275
|
+
focusFirst(intent);
|
|
267
276
|
return;
|
|
268
277
|
}
|
|
269
278
|
if (key === 'End') {
|
|
270
279
|
event.preventDefault();
|
|
271
|
-
focusLast();
|
|
280
|
+
focusLast(intent);
|
|
272
281
|
return;
|
|
273
282
|
}
|
|
274
283
|
}
|
|
@@ -349,7 +358,8 @@ export function createKeyboardNavigation(options = {}) {
|
|
|
349
358
|
focusLast,
|
|
350
359
|
focusById,
|
|
351
360
|
setCurrentId,
|
|
352
|
-
updateItems
|
|
361
|
+
updateItems,
|
|
362
|
+
typeahead: handleTypeahead
|
|
353
363
|
};
|
|
354
364
|
}
|
|
355
365
|
/**
|
|
@@ -9,6 +9,17 @@
|
|
|
9
9
|
* over this shared stack; keeping them separate was the root cause of a single
|
|
10
10
|
* Escape or outside press dismissing a dialog together with the popover/menu
|
|
11
11
|
* opened inside it.
|
|
12
|
+
*
|
|
13
|
+
* It also owns the z-index math for every layer, so modal surfaces (dialogs,
|
|
14
|
+
* drawers) and floating ones (popovers, menus) are laid out against a single
|
|
15
|
+
* scale. The math used to live in `dialog/root/dialog-stack.ts`, which meant
|
|
16
|
+
* Menu and Popover imported from Dialog just to place themselves.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* `dialog` covers every MODAL surface — dialogs and drawers alike. They share the
|
|
20
|
+
* kind on purpose: the level that drives their z-index counts layers per kind, so
|
|
21
|
+
* a separate `drawer` kind would mint a drawer opened over a dialog the very same
|
|
22
|
+
* level, and the two would collide at the same z-index.
|
|
12
23
|
*/
|
|
13
24
|
export type LayerKind = 'dialog' | 'popover' | 'menu';
|
|
14
25
|
/** Subscribe to stack changes (any push/remove). Returns an unsubscribe function. */
|
|
@@ -27,3 +38,21 @@ export declare function getLayerKindIndex(id: symbol): number;
|
|
|
27
38
|
export declare function isTopmostLayer(id: symbol): boolean;
|
|
28
39
|
/** Number of open layers, optionally filtered by kind. */
|
|
29
40
|
export declare function getLayerCount(kind?: LayerKind): number;
|
|
41
|
+
/** Z-index for a modal layer's backdrop at `level` (its index among open modals). */
|
|
42
|
+
export declare function getOverlayZIndex(level: number): number;
|
|
43
|
+
/** Z-index for a modal layer's panel — one above its own backdrop. */
|
|
44
|
+
export declare function getContentZIndex(level: number): number;
|
|
45
|
+
/**
|
|
46
|
+
* Z-index a floating layer (popover/menu/calendar) should use so it renders ABOVE
|
|
47
|
+
* the topmost open modal — or above page content when none is open. Without this,
|
|
48
|
+
* a popover opened inside a (nested) dialog kept its fixed z-index and rendered
|
|
49
|
+
* behind the dialog, because each nested modal's panel sits at a higher z-index
|
|
50
|
+
* than the popover's old constant. Resolves to 9999 with no modals open (the prior
|
|
51
|
+
* fixed value), and climbs past the stack as modals nest.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getFloatingLayerZIndex(): number;
|
|
54
|
+
/**
|
|
55
|
+
* Z-index for a floating layer's backdrop — one below its content (mirrors the
|
|
56
|
+
* modal overlay/content pairing).
|
|
57
|
+
*/
|
|
58
|
+
export declare function getFloatingLayerOverlayZIndex(): number;
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* over this shared stack; keeping them separate was the root cause of a single
|
|
10
10
|
* Escape or outside press dismissing a dialog together with the popover/menu
|
|
11
11
|
* opened inside it.
|
|
12
|
+
*
|
|
13
|
+
* It also owns the z-index math for every layer, so modal surfaces (dialogs,
|
|
14
|
+
* drawers) and floating ones (popovers, menus) are laid out against a single
|
|
15
|
+
* scale. The math used to live in `dialog/root/dialog-stack.ts`, which meant
|
|
16
|
+
* Menu and Popover imported from Dialog just to place themselves.
|
|
12
17
|
*/
|
|
13
18
|
const layerStack = [];
|
|
14
19
|
/**
|
|
@@ -79,3 +84,33 @@ export function getLayerCount(kind) {
|
|
|
79
84
|
}
|
|
80
85
|
return count;
|
|
81
86
|
}
|
|
87
|
+
/* ── z-index scale ──────────────────────────────────────────────────── */
|
|
88
|
+
/** Base z-index for the first modal layer. Each nested one climbs by the increment. */
|
|
89
|
+
const BASE_Z_INDEX = 9990;
|
|
90
|
+
const Z_INDEX_INCREMENT = 10;
|
|
91
|
+
/** Z-index for a modal layer's backdrop at `level` (its index among open modals). */
|
|
92
|
+
export function getOverlayZIndex(level) {
|
|
93
|
+
return BASE_Z_INDEX + level * Z_INDEX_INCREMENT;
|
|
94
|
+
}
|
|
95
|
+
/** Z-index for a modal layer's panel — one above its own backdrop. */
|
|
96
|
+
export function getContentZIndex(level) {
|
|
97
|
+
return BASE_Z_INDEX + level * Z_INDEX_INCREMENT + 1;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Z-index a floating layer (popover/menu/calendar) should use so it renders ABOVE
|
|
101
|
+
* the topmost open modal — or above page content when none is open. Without this,
|
|
102
|
+
* a popover opened inside a (nested) dialog kept its fixed z-index and rendered
|
|
103
|
+
* behind the dialog, because each nested modal's panel sits at a higher z-index
|
|
104
|
+
* than the popover's old constant. Resolves to 9999 with no modals open (the prior
|
|
105
|
+
* fixed value), and climbs past the stack as modals nest.
|
|
106
|
+
*/
|
|
107
|
+
export function getFloatingLayerZIndex() {
|
|
108
|
+
return BASE_Z_INDEX + getLayerCount('dialog') * Z_INDEX_INCREMENT + 9;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Z-index for a floating layer's backdrop — one below its content (mirrors the
|
|
112
|
+
* modal overlay/content pairing).
|
|
113
|
+
*/
|
|
114
|
+
export function getFloatingLayerOverlayZIndex() {
|
|
115
|
+
return getFloatingLayerZIndex() - 1;
|
|
116
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Window maths for a vertically virtualized list of uniform-height rows.
|
|
3
|
+
*
|
|
4
|
+
* Pure and framework-free so the arithmetic can be tested on its own: everything about
|
|
5
|
+
* *when* to recompute (scroll, resize, measurement) belongs to the component that calls it.
|
|
6
|
+
*
|
|
7
|
+
* Rows are assumed to be the same height. That is the trade this makes to stay cheap —
|
|
8
|
+
* knowing the height of every row up front is what lets the list place a scrollbar of the
|
|
9
|
+
* right size without measuring a thousand elements. A list of mixed-height rows must not be
|
|
10
|
+
* virtualized with this.
|
|
11
|
+
*/
|
|
12
|
+
export type ListWindowOptions = {
|
|
13
|
+
/** How many rows the list holds in total, not how many are rendered. */
|
|
14
|
+
count: number;
|
|
15
|
+
/** Height of one row, in pixels. */
|
|
16
|
+
itemHeight: number;
|
|
17
|
+
/** Vertical space between rows (a flex/grid `gap`), in pixels. */
|
|
18
|
+
gap?: number;
|
|
19
|
+
/** Height of the scrolling viewport, in pixels. */
|
|
20
|
+
viewportHeight: number;
|
|
21
|
+
/** Current scroll offset of that viewport, in pixels. */
|
|
22
|
+
scrollTop: number;
|
|
23
|
+
/**
|
|
24
|
+
* Rows rendered beyond each edge of the viewport, as a buffer against how long a row
|
|
25
|
+
* takes to render: while the main thread builds rows the compositor keeps scrolling, and
|
|
26
|
+
* anything past the last rendered row shows as blank.
|
|
27
|
+
*/
|
|
28
|
+
overscan?: number;
|
|
29
|
+
/**
|
|
30
|
+
* The scroller's top padding, in pixels.
|
|
31
|
+
*
|
|
32
|
+
* `scrollTop` is measured from the top of the padding box but the rows start after it, so
|
|
33
|
+
* ignoring it offsets every row by that much — a few pixels, which is exactly enough to
|
|
34
|
+
* leave a row clipped by the edge it was just scrolled to.
|
|
35
|
+
*/
|
|
36
|
+
padding?: number;
|
|
37
|
+
};
|
|
38
|
+
export type ListWindow = {
|
|
39
|
+
/** First rendered index (inclusive). */
|
|
40
|
+
from: number;
|
|
41
|
+
/** Last rendered index (inclusive). `from - 1` when there is nothing to render. */
|
|
42
|
+
to: number;
|
|
43
|
+
/** Distance from the top of the content to the first rendered row, in pixels. */
|
|
44
|
+
offset: number;
|
|
45
|
+
/** Height the full list would occupy, so the scrollbar matches the real count. */
|
|
46
|
+
contentHeight: number;
|
|
47
|
+
};
|
|
48
|
+
export declare function computeListWindow({ count, itemHeight, gap, viewportHeight, scrollTop, overscan, padding }: ListWindowOptions): ListWindow;
|
|
49
|
+
export type ScrollIntoViewOptions = {
|
|
50
|
+
index: number;
|
|
51
|
+
count: number;
|
|
52
|
+
itemHeight: number;
|
|
53
|
+
gap?: number;
|
|
54
|
+
viewportHeight: number;
|
|
55
|
+
scrollTop: number;
|
|
56
|
+
/** The scroller's top padding — see {@link ListWindowOptions.padding}. */
|
|
57
|
+
padding?: number;
|
|
58
|
+
/**
|
|
59
|
+
* How to place the row.
|
|
60
|
+
*
|
|
61
|
+
* `nearest` moves as little as possible, which is what stepping through a list with the
|
|
62
|
+
* arrows wants. `center` puts the row in the middle of the viewport, for when the list
|
|
63
|
+
* opens on a selection the user has to *find*: flush against an edge reads as "the list
|
|
64
|
+
* happens to end here" and, one pixel off, as a row cut in half.
|
|
65
|
+
*/
|
|
66
|
+
align?: 'nearest' | 'center';
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* The scroll offset that brings a row fully into view, or `null` when it already is.
|
|
70
|
+
*
|
|
71
|
+
* Returning `null` for the no-op case matters: assigning `scrollTop` unconditionally on
|
|
72
|
+
* every focus change fights the user's own scrolling and makes the list jitter while the
|
|
73
|
+
* pointer moves over it.
|
|
74
|
+
*/
|
|
75
|
+
export declare function scrollTopForIndex({ index, count, itemHeight, gap, viewportHeight, scrollTop, padding, align }: ScrollIntoViewOptions): number | null;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Window maths for a vertically virtualized list of uniform-height rows.
|
|
3
|
+
*
|
|
4
|
+
* Pure and framework-free so the arithmetic can be tested on its own: everything about
|
|
5
|
+
* *when* to recompute (scroll, resize, measurement) belongs to the component that calls it.
|
|
6
|
+
*
|
|
7
|
+
* Rows are assumed to be the same height. That is the trade this makes to stay cheap —
|
|
8
|
+
* knowing the height of every row up front is what lets the list place a scrollbar of the
|
|
9
|
+
* right size without measuring a thousand elements. A list of mixed-height rows must not be
|
|
10
|
+
* virtualized with this.
|
|
11
|
+
*/
|
|
12
|
+
/** Distance from one row's top edge to the next one's. */
|
|
13
|
+
function pitchOf(itemHeight, gap) {
|
|
14
|
+
return Math.max(1, itemHeight + gap);
|
|
15
|
+
}
|
|
16
|
+
export function computeListWindow({ count, itemHeight, gap = 0, viewportHeight, scrollTop, overscan = 0, padding = 0 }) {
|
|
17
|
+
if (count <= 0 || itemHeight <= 0) {
|
|
18
|
+
return { from: 0, to: -1, offset: 0, contentHeight: 0 };
|
|
19
|
+
}
|
|
20
|
+
const pitch = pitchOf(itemHeight, gap);
|
|
21
|
+
// No trailing gap: the last row ends the content.
|
|
22
|
+
const contentHeight = count * pitch - gap;
|
|
23
|
+
// One extra row: a viewport that isn't a whole multiple of the pitch shows part of one
|
|
24
|
+
// more, and that partial row still has to exist.
|
|
25
|
+
const visibleCount = Math.max(1, Math.ceil(Math.max(0, viewportHeight) / pitch) + 1);
|
|
26
|
+
const startIndex = Math.min(count - 1, Math.max(0, Math.floor(Math.max(0, scrollTop - padding) / pitch)));
|
|
27
|
+
const from = Math.max(0, startIndex - overscan);
|
|
28
|
+
const to = Math.min(count - 1, startIndex + visibleCount - 1 + overscan);
|
|
29
|
+
return { from, to, offset: from * pitch, contentHeight };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The scroll offset that brings a row fully into view, or `null` when it already is.
|
|
33
|
+
*
|
|
34
|
+
* Returning `null` for the no-op case matters: assigning `scrollTop` unconditionally on
|
|
35
|
+
* every focus change fights the user's own scrolling and makes the list jitter while the
|
|
36
|
+
* pointer moves over it.
|
|
37
|
+
*/
|
|
38
|
+
export function scrollTopForIndex({ index, count, itemHeight, gap = 0, viewportHeight, scrollTop, padding = 0, align = 'nearest' }) {
|
|
39
|
+
if (index < 0 || index >= count || itemHeight <= 0) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const pitch = pitchOf(itemHeight, gap);
|
|
43
|
+
const contentHeight = count * pitch - gap;
|
|
44
|
+
const maxScrollTop = Math.max(0, padding * 2 + contentHeight - viewportHeight);
|
|
45
|
+
const clamp = (value) => Math.min(Math.max(0, value), maxScrollTop);
|
|
46
|
+
const top = padding + index * pitch;
|
|
47
|
+
const bottom = top + itemHeight;
|
|
48
|
+
if (align === 'center') {
|
|
49
|
+
const centered = clamp(top - (viewportHeight - itemHeight) / 2);
|
|
50
|
+
return centered === scrollTop ? null : centered;
|
|
51
|
+
}
|
|
52
|
+
if (top < scrollTop) {
|
|
53
|
+
return clamp(top);
|
|
54
|
+
}
|
|
55
|
+
if (bottom > scrollTop + viewportHeight) {
|
|
56
|
+
return clamp(bottom - viewportHeight);
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Long press on a touch or pen pointer, for surfaces that expose an alternative
|
|
3
|
+
* action the way a right click does on a mouse.
|
|
4
|
+
*
|
|
5
|
+
* It exists because touch has no `contextmenu` worth relying on: Android Chrome
|
|
6
|
+
* fires it, iOS Safari only does so for a few built-in element types, so a
|
|
7
|
+
* context menu that waits for that event is unreachable on a phone.
|
|
8
|
+
*
|
|
9
|
+
* Two details are what make it survive contact with a real device:
|
|
10
|
+
*
|
|
11
|
+
* 1. The press is abandoned as soon as the finger travels — a long press and the
|
|
12
|
+
* start of a scroll look identical for the first few hundred milliseconds, and
|
|
13
|
+
* the one thing worse than no menu is a menu that opens whenever the page is
|
|
14
|
+
* slow to scroll. Nothing captures the pointer either: capturing it would take
|
|
15
|
+
* the scroll away from the browser for the whole delay.
|
|
16
|
+
* 2. The `click` and `contextmenu` that the platform emits around the same
|
|
17
|
+
* gesture are swallowed afterwards. Without that, the same finger press opens
|
|
18
|
+
* the menu and then immediately dismisses it.
|
|
19
|
+
*/
|
|
20
|
+
export type LongPressPoint = {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
};
|
|
24
|
+
/** How long the pointer has to stay down. Matches the platform convention. */
|
|
25
|
+
export declare const LONG_PRESS_DELAY_MS = 500;
|
|
26
|
+
/** How far the pointer may drift before the press is treated as a drag/scroll. */
|
|
27
|
+
export declare const LONG_PRESS_MOVE_TOLERANCE_PX = 10;
|
|
28
|
+
/** Whether the pointer moved far enough from where it went down to abandon the press. */
|
|
29
|
+
export declare function hasMovedBeyond(start: LongPressPoint, current: LongPressPoint, tolerance: number): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether this pointer should be considered for a long press at all.
|
|
32
|
+
*
|
|
33
|
+
* A mouse is excluded on purpose: it already has `contextmenu`, and treating a
|
|
34
|
+
* held left button as a long press would fire on every slow drag.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isLongPressPointer(event: PointerEvent): boolean;
|
|
37
|
+
export type LongPressOptions = {
|
|
38
|
+
/** Whether the action listens at all. */
|
|
39
|
+
enabled?: boolean;
|
|
40
|
+
/** How long the pointer must stay down. Defaults to `LONG_PRESS_DELAY_MS`. */
|
|
41
|
+
delay?: number;
|
|
42
|
+
/** Movement tolerance in px. Defaults to `LONG_PRESS_MOVE_TOLERANCE_PX`. */
|
|
43
|
+
tolerance?: number;
|
|
44
|
+
/** Called once the press is held long enough, with the viewport point of the pointer. */
|
|
45
|
+
onLongPress: (point: LongPressPoint, event: PointerEvent) => void;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Svelte action: calls `onLongPress` when a touch or pen pointer is held on the
|
|
49
|
+
* node without travelling.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```svelte
|
|
53
|
+
* <div use:longPress={{ onLongPress: (point) => openAt(point) }}>…</div>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function longPress(node: HTMLElement, options: LongPressOptions): {
|
|
57
|
+
update(newOptions: LongPressOptions): void;
|
|
58
|
+
destroy(): void;
|
|
59
|
+
};
|