@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
|
@@ -3,6 +3,20 @@ export type TableRowItem = Record<string, unknown> & {
|
|
|
3
3
|
id: TableSelectionKey;
|
|
4
4
|
};
|
|
5
5
|
export type TableSelectionMode = 'none' | 'single' | 'multiple';
|
|
6
|
+
/**
|
|
7
|
+
* How far the roving tab stop reaches into the body.
|
|
8
|
+
*
|
|
9
|
+
* `'grid'` is the full ARIA grid pattern: every body cell is a focus target,
|
|
10
|
+
* which costs a registration plus focus-derived state per cell — with a
|
|
11
|
+
* virtualizer that is paid again on every scroll block. `'row'` keeps the body
|
|
12
|
+
* reachable (arrows walk rows, Enter/Space press one) at one focus target per
|
|
13
|
+
* row instead of one per cell. `'none'` drops body focus entirely; use it only
|
|
14
|
+
* when nothing in the body is actionable.
|
|
15
|
+
*
|
|
16
|
+
* The header keeps its own cell navigation in every mode — it is a single row,
|
|
17
|
+
* so it costs nothing, and it is where sorting and resizing live.
|
|
18
|
+
*/
|
|
19
|
+
export type TableKeyboardNavigation = 'grid' | 'row' | 'none';
|
|
6
20
|
export type TableSelectionBehavior = 'toggle' | 'replace';
|
|
7
21
|
export type TableDisabledBehavior = 'selection' | 'all';
|
|
8
22
|
export type TableSortDirection = 'ascending' | 'descending';
|
|
@@ -84,6 +98,7 @@ type TableCellRegistration = {
|
|
|
84
98
|
};
|
|
85
99
|
export type CreateTableContextOptions = {
|
|
86
100
|
selectionMode?: TableSelectionMode;
|
|
101
|
+
keyboardNavigation?: TableKeyboardNavigation;
|
|
87
102
|
selectionBehavior?: TableSelectionBehavior;
|
|
88
103
|
disabledBehavior?: TableDisabledBehavior;
|
|
89
104
|
disallowEmptySelection?: boolean;
|
|
@@ -126,6 +141,7 @@ export type TableContext = {
|
|
|
126
141
|
widthEpoch: number;
|
|
127
142
|
createInstanceToken: (prefix: string) => string;
|
|
128
143
|
selectionMode: TableSelectionMode;
|
|
144
|
+
keyboardNavigation: TableKeyboardNavigation;
|
|
129
145
|
selectionBehavior: TableSelectionBehavior;
|
|
130
146
|
disabledBehavior: TableDisabledBehavior;
|
|
131
147
|
disallowEmptySelection: boolean;
|
|
@@ -213,6 +229,7 @@ export type TableContext = {
|
|
|
213
229
|
deselectAllRows: () => void;
|
|
214
230
|
setSelection: (keys: Iterable<TableSelectionKey>) => void;
|
|
215
231
|
setSelectionMode: (mode: TableSelectionMode) => void;
|
|
232
|
+
setKeyboardNavigation: (navigation: TableKeyboardNavigation) => void;
|
|
216
233
|
setSelectionBehavior: (behavior: TableSelectionBehavior) => void;
|
|
217
234
|
setDisabledBehavior: (behavior: TableDisabledBehavior) => void;
|
|
218
235
|
setDisallowEmptySelection: (disallow: boolean) => void;
|
|
@@ -53,6 +53,7 @@ export function createTableContext(options = {}) {
|
|
|
53
53
|
// mutated in place), so a plain `Set` inside `$state` is enough; the
|
|
54
54
|
// in-place-mutated collections use SvelteSet/SvelteMap instead.
|
|
55
55
|
let selectionMode = $state(options.selectionMode ?? 'none');
|
|
56
|
+
let keyboardNavigation = $state(options.keyboardNavigation ?? 'grid');
|
|
56
57
|
let selectionBehavior = $state(options.selectionBehavior ?? 'toggle');
|
|
57
58
|
let disabledBehavior = $state(options.disabledBehavior ?? 'all');
|
|
58
59
|
let disallowEmptySelection = $state(options.disallowEmptySelection ?? false);
|
|
@@ -61,7 +62,7 @@ export function createTableContext(options = {}) {
|
|
|
61
62
|
let focusedCellKey = $state(null);
|
|
62
63
|
let focusedRowTarget = $state(null);
|
|
63
64
|
let focusVisible = $state(false);
|
|
64
|
-
const initialSelectedKeys = new
|
|
65
|
+
const initialSelectedKeys = new SvelteSet(options.initialSelectedKeys ?? []);
|
|
65
66
|
let selectedKeys = $state(initialSelectedKeys);
|
|
66
67
|
let selectionAnchorKey = $state(initialSelectedKeys.values().next().value ?? null);
|
|
67
68
|
const disabledKeys = new SvelteSet(options.disabledKeys ?? []);
|
|
@@ -69,24 +70,29 @@ export function createTableContext(options = {}) {
|
|
|
69
70
|
let resizingColumnId = $state(null);
|
|
70
71
|
let resizeSession = null;
|
|
71
72
|
let suppressNextHeaderClick = false;
|
|
72
|
-
const columns = new
|
|
73
|
-
const columnIds = new
|
|
73
|
+
const columns = new SvelteMap();
|
|
74
|
+
const columnIds = new SvelteMap();
|
|
74
75
|
const columnOrder = [];
|
|
75
|
-
const columnsWithSortTriggers = new
|
|
76
|
-
const columnsWithResizers = new
|
|
76
|
+
const columnsWithSortTriggers = new SvelteSet();
|
|
77
|
+
const columnsWithResizers = new SvelteSet();
|
|
77
78
|
let resizerLayoutReady = false;
|
|
78
79
|
const columnWidths = new SvelteMap(options.initialColumnWidths ?? []);
|
|
79
|
-
const rows = new
|
|
80
|
+
const rows = new SvelteMap();
|
|
80
81
|
const headerRowOrder = [];
|
|
81
|
-
const headerRowOrderSet = new
|
|
82
|
+
const headerRowOrderSet = new SvelteSet();
|
|
82
83
|
const bodyRowOrder = [];
|
|
83
|
-
const bodyRowOrderSet = new
|
|
84
|
+
const bodyRowOrderSet = new SvelteSet();
|
|
84
85
|
let bodyRowsInitialized = false;
|
|
85
86
|
let selectableBodyRowCount = 0;
|
|
86
87
|
let logicalBodyRowIds = null;
|
|
87
88
|
let logicalBodyRowIndexCache = null;
|
|
88
|
-
const cells = new
|
|
89
|
-
const cellOrderSet = new
|
|
89
|
+
const cells = new SvelteMap();
|
|
90
|
+
const cellOrderSet = new SvelteSet();
|
|
91
|
+
// Cell keys grouped by row, so dropping a row does not have to scan every
|
|
92
|
+
// registered cell. Virtualized scrolling unmounts rows continuously, and a
|
|
93
|
+
// full scan there costs (rows unmounted x total cells) per frame.
|
|
94
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity -- a lookup index, not state: see the note above on the per-frame cost.
|
|
95
|
+
const cellKeysByRowToken = new Map();
|
|
90
96
|
let orderedRowTokensCache = {
|
|
91
97
|
header: null,
|
|
92
98
|
body: null
|
|
@@ -113,9 +119,14 @@ export function createTableContext(options = {}) {
|
|
|
113
119
|
let layoutEpoch = $state(0);
|
|
114
120
|
let selectionEpoch = $state(0);
|
|
115
121
|
let widthEpoch = $state(0);
|
|
122
|
+
// Plain Map on purpose. These counters only ever mint unique tokens; nothing
|
|
123
|
+
// reads them reactively. As a SvelteMap every row and every cell created a
|
|
124
|
+
// reactive source on mount — hundreds per scroll tick — and in dev each of
|
|
125
|
+
// those costs a stack capture (`get_stack` was 58% of mount in the profile).
|
|
126
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity -- see the note above: reactive here cost 58% of mount time.
|
|
116
127
|
const instanceCounters = new Map();
|
|
117
128
|
const selectionUnavailableDescriptionId = createInstanceToken('selection-unavailable');
|
|
118
|
-
setSelectedKeys(new
|
|
129
|
+
setSelectedKeys(new SvelteSet(initialSelectedKeys), initialSelectedKeys.values().next().value ?? null);
|
|
119
130
|
function createInstanceToken(prefix) {
|
|
120
131
|
const nextCount = (instanceCounters.get(prefix) ?? 0) + 1;
|
|
121
132
|
instanceCounters.set(prefix, nextCount);
|
|
@@ -205,8 +216,14 @@ export function createTableContext(options = {}) {
|
|
|
205
216
|
columnWidthsCache = null;
|
|
206
217
|
visibleColumnWidthsCache = null;
|
|
207
218
|
resolvedVisibleColumnWidthsCache = null;
|
|
208
|
-
|
|
209
|
-
|
|
219
|
+
// The measured *container* width is deliberately NOT invalidated here.
|
|
220
|
+
// It is the stable reference fr/% resolution is built on (see
|
|
221
|
+
// `getMeasuredTableWidth`), and setting a column width cannot change it —
|
|
222
|
+
// only a real container/window resize can, which arrives through
|
|
223
|
+
// `refreshMeasuredLayout`. Clearing it on every width write made each
|
|
224
|
+
// resize frame re-run `getBoundingClientRect` + `getComputedStyle`
|
|
225
|
+
// immediately after writing new widths: a forced synchronous layout per
|
|
226
|
+
// frame, which profiled as ~87% of the column-drag cost.
|
|
210
227
|
if (!widthNotifyScheduled) {
|
|
211
228
|
widthNotifyScheduled = true;
|
|
212
229
|
queueMicrotask(() => {
|
|
@@ -478,7 +495,17 @@ export function createTableContext(options = {}) {
|
|
|
478
495
|
return key ? (cells.get(key) ?? null) : null;
|
|
479
496
|
}
|
|
480
497
|
function getResolvedBodyCellsForRow(rowToken) {
|
|
481
|
-
|
|
498
|
+
const rowCellKeys = cellKeysByRowToken.get(rowToken);
|
|
499
|
+
if (!rowCellKeys)
|
|
500
|
+
return [];
|
|
501
|
+
const rowCells = [];
|
|
502
|
+
for (const key of rowCellKeys) {
|
|
503
|
+
const cell = cells.get(key);
|
|
504
|
+
if (cell?.section === 'body') {
|
|
505
|
+
rowCells.push(cell);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
return rowCells;
|
|
482
509
|
}
|
|
483
510
|
function registerColumn(column) {
|
|
484
511
|
const existing = columns.get(column.token);
|
|
@@ -525,7 +552,7 @@ export function createTableContext(options = {}) {
|
|
|
525
552
|
return orderedColumnTokensCache;
|
|
526
553
|
// Pre-build a lookup from columnToken → header cell element to avoid
|
|
527
554
|
// O(columns × cells) scanning inside the comparator.
|
|
528
|
-
const headerElementByToken = new
|
|
555
|
+
const headerElementByToken = new SvelteMap();
|
|
529
556
|
for (const cell of cells.values()) {
|
|
530
557
|
if (cell.section === 'header' && cell.columnToken && cell.element) {
|
|
531
558
|
headerElementByToken.set(cell.columnToken, cell.element);
|
|
@@ -568,7 +595,7 @@ export function createTableContext(options = {}) {
|
|
|
568
595
|
function getVisibleColumnIndexByTokenMap() {
|
|
569
596
|
if (visibleColumnIndexByTokenCache)
|
|
570
597
|
return visibleColumnIndexByTokenCache;
|
|
571
|
-
const visibleColumnIndexByToken = new
|
|
598
|
+
const visibleColumnIndexByToken = new SvelteMap(getVisibleOrderedColumnTokens().map((token, index) => [token, index]));
|
|
572
599
|
visibleColumnIndexByTokenCache = visibleColumnIndexByToken;
|
|
573
600
|
return visibleColumnIndexByToken;
|
|
574
601
|
}
|
|
@@ -710,7 +737,7 @@ export function createTableContext(options = {}) {
|
|
|
710
737
|
function getColumnWidths() {
|
|
711
738
|
if (columnWidthsCache)
|
|
712
739
|
return columnWidthsCache;
|
|
713
|
-
const widths = new
|
|
740
|
+
const widths = new SvelteMap();
|
|
714
741
|
for (const token of getOrderedColumnTokens()) {
|
|
715
742
|
const column = columns.get(token);
|
|
716
743
|
if (!column)
|
|
@@ -726,7 +753,7 @@ export function createTableContext(options = {}) {
|
|
|
726
753
|
function getVisibleColumnWidths() {
|
|
727
754
|
if (visibleColumnWidthsCache)
|
|
728
755
|
return visibleColumnWidthsCache;
|
|
729
|
-
const widths = new
|
|
756
|
+
const widths = new SvelteMap();
|
|
730
757
|
for (const [columnId, width] of getColumnWidths()) {
|
|
731
758
|
if (isColumnHidden(columnId))
|
|
732
759
|
continue;
|
|
@@ -749,7 +776,7 @@ export function createTableContext(options = {}) {
|
|
|
749
776
|
function getResolvedVisibleColumnWidths() {
|
|
750
777
|
if (resolvedVisibleColumnWidthsCache)
|
|
751
778
|
return resolvedVisibleColumnWidthsCache;
|
|
752
|
-
const widths = new
|
|
779
|
+
const widths = new SvelteMap();
|
|
753
780
|
const flexibleColumns = [];
|
|
754
781
|
const relativeColumns = [];
|
|
755
782
|
const tableWidth = getMeasuredTableWidth();
|
|
@@ -837,8 +864,8 @@ export function createTableContext(options = {}) {
|
|
|
837
864
|
.at(-1)?.id;
|
|
838
865
|
}
|
|
839
866
|
function prepareColumnWidthsForResize(activeColumnId) {
|
|
840
|
-
const next = new
|
|
841
|
-
const baselineWidths = new
|
|
867
|
+
const next = new SvelteMap(columnWidths);
|
|
868
|
+
const baselineWidths = new SvelteMap();
|
|
842
869
|
const preservedFlexibleColumnId = getResizableRelativeTailColumnId(activeColumnId);
|
|
843
870
|
const preservedFlexibleEffectiveWidth = preservedFlexibleColumnId
|
|
844
871
|
? normalizeColumnWidth(getEffectiveColumnWidthSpec(preservedFlexibleColumnId))
|
|
@@ -900,8 +927,8 @@ export function createTableContext(options = {}) {
|
|
|
900
927
|
return resizeSession?.activeColumnId !== columnId;
|
|
901
928
|
}
|
|
902
929
|
function setColumnWidths(widths) {
|
|
903
|
-
const next = new
|
|
904
|
-
const incomingWidths = widths ? new
|
|
930
|
+
const next = new SvelteMap();
|
|
931
|
+
const incomingWidths = widths ? new SvelteMap(widths) : undefined;
|
|
905
932
|
for (const token of columnOrder) {
|
|
906
933
|
const column = columns.get(token);
|
|
907
934
|
if (!column)
|
|
@@ -1052,7 +1079,7 @@ export function createTableContext(options = {}) {
|
|
|
1052
1079
|
}
|
|
1053
1080
|
}
|
|
1054
1081
|
function setHiddenColumns(columnIds) {
|
|
1055
|
-
const next = new
|
|
1082
|
+
const next = new SvelteSet(columnIds ?? []);
|
|
1056
1083
|
let changed = next.size !== hiddenColumnIds.size;
|
|
1057
1084
|
if (!changed) {
|
|
1058
1085
|
for (const columnId of hiddenColumnIds) {
|
|
@@ -1257,11 +1284,13 @@ export function createTableContext(options = {}) {
|
|
|
1257
1284
|
}
|
|
1258
1285
|
headerRowOrderSet.delete(token);
|
|
1259
1286
|
bodyRowOrderSet.delete(token);
|
|
1260
|
-
|
|
1261
|
-
|
|
1287
|
+
const rowCellKeys = cellKeysByRowToken.get(token);
|
|
1288
|
+
if (rowCellKeys) {
|
|
1289
|
+
for (const key of rowCellKeys) {
|
|
1262
1290
|
cells.delete(key);
|
|
1263
1291
|
cellOrderSet.delete(key);
|
|
1264
1292
|
}
|
|
1293
|
+
cellKeysByRowToken.delete(token);
|
|
1265
1294
|
}
|
|
1266
1295
|
if (row && focusedCellKey) {
|
|
1267
1296
|
const focusedCell = resolveCellTargetByKey(focusedCellKey);
|
|
@@ -1304,7 +1333,7 @@ export function createTableContext(options = {}) {
|
|
|
1304
1333
|
if (!logicalBodyRowIds)
|
|
1305
1334
|
return -1;
|
|
1306
1335
|
if (!logicalBodyRowIndexCache) {
|
|
1307
|
-
logicalBodyRowIndexCache = new
|
|
1336
|
+
logicalBodyRowIndexCache = new SvelteMap();
|
|
1308
1337
|
for (let index = 0; index < logicalBodyRowIds.length; index += 1) {
|
|
1309
1338
|
const rowId = logicalBodyRowIds[index];
|
|
1310
1339
|
if (!logicalBodyRowIndexCache.has(rowId)) {
|
|
@@ -1459,6 +1488,7 @@ export function createTableContext(options = {}) {
|
|
|
1459
1488
|
return;
|
|
1460
1489
|
}
|
|
1461
1490
|
cells.set(cell.key, cell);
|
|
1491
|
+
indexCellByRow(cell);
|
|
1462
1492
|
seedDefaultFocusKeyFromCell(cell);
|
|
1463
1493
|
if (!alreadyOrdered) {
|
|
1464
1494
|
cellOrderSet.add(cell.key);
|
|
@@ -1471,9 +1501,30 @@ export function createTableContext(options = {}) {
|
|
|
1471
1501
|
scheduleBodyStructureCacheInvalidation();
|
|
1472
1502
|
}
|
|
1473
1503
|
}
|
|
1504
|
+
function indexCellByRow(cell) {
|
|
1505
|
+
const existing = cellKeysByRowToken.get(cell.rowToken);
|
|
1506
|
+
if (existing) {
|
|
1507
|
+
existing.add(cell.key);
|
|
1508
|
+
return;
|
|
1509
|
+
}
|
|
1510
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity -- a bucket inside the non-reactive index above.
|
|
1511
|
+
cellKeysByRowToken.set(cell.rowToken, new Set([cell.key]));
|
|
1512
|
+
}
|
|
1513
|
+
function unindexCellByRow(cell) {
|
|
1514
|
+
if (!cell)
|
|
1515
|
+
return;
|
|
1516
|
+
const keys = cellKeysByRowToken.get(cell.rowToken);
|
|
1517
|
+
if (!keys)
|
|
1518
|
+
return;
|
|
1519
|
+
keys.delete(cell.key);
|
|
1520
|
+
if (keys.size === 0) {
|
|
1521
|
+
cellKeysByRowToken.delete(cell.rowToken);
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1474
1524
|
function unregisterCell(key) {
|
|
1475
1525
|
defaultFocusKeyCache = undefined;
|
|
1476
1526
|
const cell = cells.get(key);
|
|
1527
|
+
unindexCellByRow(cell);
|
|
1477
1528
|
cells.delete(key);
|
|
1478
1529
|
cellOrderSet.delete(key);
|
|
1479
1530
|
if (focusedCellKey === key) {
|
|
@@ -1529,7 +1580,16 @@ export function createTableContext(options = {}) {
|
|
|
1529
1580
|
return getDefaultFocusKey() === key;
|
|
1530
1581
|
}
|
|
1531
1582
|
function isRowTabStop(token) {
|
|
1532
|
-
|
|
1583
|
+
if (focusedRowTarget)
|
|
1584
|
+
return focusedRowTarget.rowToken === token;
|
|
1585
|
+
if (keyboardNavigation !== 'row')
|
|
1586
|
+
return false;
|
|
1587
|
+
// Row navigation with nothing focused yet: the body needs its own entry
|
|
1588
|
+
// point, but only when the header does not already provide the grid's
|
|
1589
|
+
// single tab stop.
|
|
1590
|
+
if (focusedCellKey || getDefaultFocusKey())
|
|
1591
|
+
return false;
|
|
1592
|
+
return getFocusableBodyRowToken('start') === token;
|
|
1533
1593
|
}
|
|
1534
1594
|
function getGlobalRowIndex(rowToken) {
|
|
1535
1595
|
const orderedHeaderRows = getOrderedRowTokens('header');
|
|
@@ -1576,7 +1636,7 @@ export function createTableContext(options = {}) {
|
|
|
1576
1636
|
function getRowsWithCells() {
|
|
1577
1637
|
if (rowsWithCellsCache)
|
|
1578
1638
|
return rowsWithCellsCache;
|
|
1579
|
-
const rowsByIndex = new
|
|
1639
|
+
const rowsByIndex = new SvelteMap();
|
|
1580
1640
|
for (const { cell, coord } of getNavigableCells()) {
|
|
1581
1641
|
const rowCells = rowsByIndex.get(coord.row) ?? [];
|
|
1582
1642
|
rowCells.push({ col: coord.col, key: cell.key, element: cell.element });
|
|
@@ -1695,13 +1755,13 @@ export function createTableContext(options = {}) {
|
|
|
1695
1755
|
return true;
|
|
1696
1756
|
}
|
|
1697
1757
|
function setSelectedKeys(next, anchor) {
|
|
1698
|
-
const previousSelectedKeys = new
|
|
1758
|
+
const previousSelectedKeys = new SvelteSet(selectedKeys);
|
|
1699
1759
|
selectedKeys =
|
|
1700
1760
|
selectionMode === 'none'
|
|
1701
|
-
? new
|
|
1761
|
+
? new SvelteSet()
|
|
1702
1762
|
: selectionMode === 'single' && next.size > 1
|
|
1703
|
-
? new
|
|
1704
|
-
: next;
|
|
1763
|
+
? new SvelteSet([next.values().next().value])
|
|
1764
|
+
: new SvelteSet(next);
|
|
1705
1765
|
if (selectionMode !== 'none' && disallowEmptySelection && selectedKeys.size === 0) {
|
|
1706
1766
|
const fallbackKey = (anchor !== undefined && anchor !== null && !isRowSelectionDisabled(anchor)
|
|
1707
1767
|
? anchor
|
|
@@ -1711,7 +1771,7 @@ export function createTableContext(options = {}) {
|
|
|
1711
1771
|
if (fallbackKey !== undefined &&
|
|
1712
1772
|
fallbackKey !== null &&
|
|
1713
1773
|
!isRowSelectionDisabled(fallbackKey)) {
|
|
1714
|
-
selectedKeys = new
|
|
1774
|
+
selectedKeys = new SvelteSet([fallbackKey]);
|
|
1715
1775
|
}
|
|
1716
1776
|
}
|
|
1717
1777
|
const fallbackAnchor = selectedKeys.values().next().value ?? null;
|
|
@@ -1724,7 +1784,7 @@ export function createTableContext(options = {}) {
|
|
|
1724
1784
|
function replaceSelectionWithRow(id) {
|
|
1725
1785
|
if (id === undefined || isRowSelectionDisabled(id))
|
|
1726
1786
|
return;
|
|
1727
|
-
const next = new
|
|
1787
|
+
const next = new SvelteSet([id]);
|
|
1728
1788
|
if (hasSameSelection(selectedKeys, next)) {
|
|
1729
1789
|
setSelectedKeys(next, id);
|
|
1730
1790
|
notifySelection();
|
|
@@ -1734,7 +1794,7 @@ export function createTableContext(options = {}) {
|
|
|
1734
1794
|
emitSelectionChange();
|
|
1735
1795
|
}
|
|
1736
1796
|
function applySelectionChange(next, anchor) {
|
|
1737
|
-
const previousSelection = new
|
|
1797
|
+
const previousSelection = new SvelteSet(selectedKeys);
|
|
1738
1798
|
const previousAnchor = selectionAnchorKey;
|
|
1739
1799
|
setSelectedKeys(next, anchor);
|
|
1740
1800
|
if (!hasSameSelection(previousSelection, selectedKeys)) {
|
|
@@ -1750,10 +1810,10 @@ export function createTableContext(options = {}) {
|
|
|
1750
1810
|
return;
|
|
1751
1811
|
if (selectionMode === 'single') {
|
|
1752
1812
|
const wasSelected = selectedKeys.has(id);
|
|
1753
|
-
applySelectionChange(selectionBehavior === 'toggle' && wasSelected ? new
|
|
1813
|
+
applySelectionChange(selectionBehavior === 'toggle' && wasSelected ? new SvelteSet() : new SvelteSet([id]), selectionBehavior === 'toggle' && wasSelected ? null : id);
|
|
1754
1814
|
return;
|
|
1755
1815
|
}
|
|
1756
|
-
const next = new
|
|
1816
|
+
const next = new SvelteSet(selectedKeys);
|
|
1757
1817
|
if (next.has(id)) {
|
|
1758
1818
|
next.delete(id);
|
|
1759
1819
|
}
|
|
@@ -1784,7 +1844,7 @@ export function createTableContext(options = {}) {
|
|
|
1784
1844
|
}
|
|
1785
1845
|
const start = Math.min(anchorIndex, targetIndex);
|
|
1786
1846
|
const end = Math.max(anchorIndex, targetIndex);
|
|
1787
|
-
applySelectionChange(new
|
|
1847
|
+
applySelectionChange(new SvelteSet(orderedIds.slice(start, end + 1)), anchor);
|
|
1788
1848
|
}
|
|
1789
1849
|
function performRowAction(id) {
|
|
1790
1850
|
if (!onRowAction || id === undefined || isRowActionDisabled(id))
|
|
@@ -1867,12 +1927,81 @@ export function createTableContext(options = {}) {
|
|
|
1867
1927
|
const target = cellElement?.closest('table') ?? cellElement;
|
|
1868
1928
|
return isRtl(target);
|
|
1869
1929
|
}
|
|
1930
|
+
function syncSelectionAfterFocusMove(direction, interaction, previousFocusedRowId) {
|
|
1931
|
+
if (direction !== 'up' && direction !== 'down')
|
|
1932
|
+
return;
|
|
1933
|
+
if (selectionMode === 'none')
|
|
1934
|
+
return;
|
|
1935
|
+
if (interaction.ctrlKey || interaction.metaKey || interaction.altKey)
|
|
1936
|
+
return;
|
|
1937
|
+
const targetRowId = getFocusedRowId();
|
|
1938
|
+
if (targetRowId === null)
|
|
1939
|
+
return;
|
|
1940
|
+
if (interaction.shiftKey) {
|
|
1941
|
+
extendSelectionToRow(targetRowId, selectionAnchorKey ?? previousFocusedRowId);
|
|
1942
|
+
return;
|
|
1943
|
+
}
|
|
1944
|
+
if (selectionBehavior !== 'replace')
|
|
1945
|
+
return;
|
|
1946
|
+
replaceSelectionWithRow(targetRowId);
|
|
1947
|
+
}
|
|
1948
|
+
function getOrderedFocusableBodyRowTokens() {
|
|
1949
|
+
return getOrderedRowTokens('body').filter((token) => {
|
|
1950
|
+
const row = rows.get(token);
|
|
1951
|
+
return Boolean(row) && !isRowDisabled(row?.id, row?.disabled);
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
/**
|
|
1955
|
+
* Focus movement for `keyboardNavigation: 'row'`, where body cells never
|
|
1956
|
+
* register and the row itself is the only focus target in the body. Returns
|
|
1957
|
+
* `false` when the move belongs to the header, which keeps cell navigation.
|
|
1958
|
+
*/
|
|
1959
|
+
function moveRowFocus(direction, interaction) {
|
|
1960
|
+
const tokens = getOrderedFocusableBodyRowTokens();
|
|
1961
|
+
if (tokens.length === 0)
|
|
1962
|
+
return false;
|
|
1963
|
+
if (!focusedRowTarget) {
|
|
1964
|
+
// Coming from the header (or from nothing at all): only downwards
|
|
1965
|
+
// enters the body, so anything else stays with the cell path.
|
|
1966
|
+
if (direction !== 'down')
|
|
1967
|
+
return false;
|
|
1968
|
+
const previousFocusedRowId = getFocusedRowId();
|
|
1969
|
+
focusRowByToken(tokens[0], 'start');
|
|
1970
|
+
syncSelectionAfterFocusMove(direction, interaction, previousFocusedRowId);
|
|
1971
|
+
return true;
|
|
1972
|
+
}
|
|
1973
|
+
// A row spans every column, so there is nothing to move to sideways.
|
|
1974
|
+
if (direction === 'left' || direction === 'right')
|
|
1975
|
+
return true;
|
|
1976
|
+
const previousFocusedRowId = getFocusedRowId();
|
|
1977
|
+
const currentIndex = tokens.indexOf(focusedRowTarget.rowToken);
|
|
1978
|
+
const targetToken = tokens[direction === 'up' ? currentIndex - 1 : currentIndex + 1];
|
|
1979
|
+
if (targetToken) {
|
|
1980
|
+
focusRowByToken(targetToken, focusedRowTarget.edge);
|
|
1981
|
+
syncSelectionAfterFocusMove(direction, interaction, previousFocusedRowId);
|
|
1982
|
+
return true;
|
|
1983
|
+
}
|
|
1984
|
+
// Past the first row, focus leaves the body upwards into the header.
|
|
1985
|
+
if (direction === 'up' && currentIndex === 0) {
|
|
1986
|
+
const headerRowIndexes = getOrderedRowTokens('header')
|
|
1987
|
+
.map((token) => getGlobalRowIndex(token))
|
|
1988
|
+
.filter((index) => index >= 0)
|
|
1989
|
+
.sort((left, right) => left - right);
|
|
1990
|
+
const lastHeaderRowIndex = headerRowIndexes.at(-1);
|
|
1991
|
+
if (lastHeaderRowIndex !== undefined) {
|
|
1992
|
+
focusCellByKey(getClosestCellKey(lastHeaderRowIndex, 0));
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
return true;
|
|
1996
|
+
}
|
|
1870
1997
|
function moveFocus(direction, interaction = {}) {
|
|
1871
1998
|
// ArrowLeft/ArrowRight are physical: in RTL layouts the visually next
|
|
1872
1999
|
// cell is the previous one in DOM order, so invert before navigating.
|
|
1873
2000
|
if ((direction === 'left' || direction === 'right') && isRtlLayout()) {
|
|
1874
2001
|
direction = direction === 'left' ? 'right' : 'left';
|
|
1875
2002
|
}
|
|
2003
|
+
if (keyboardNavigation === 'row' && moveRowFocus(direction, interaction))
|
|
2004
|
+
return;
|
|
1876
2005
|
const rowMap = getRowsWithCells();
|
|
1877
2006
|
const currentCoord = getFocusedCoord();
|
|
1878
2007
|
const rowIndexes = Array.from(rowMap.keys()).sort((a, b) => a - b);
|
|
@@ -1880,22 +2009,7 @@ export function createTableContext(options = {}) {
|
|
|
1880
2009
|
return;
|
|
1881
2010
|
const previousFocusedRowId = getFocusedRowId();
|
|
1882
2011
|
function maybeSyncSelectionAfterFocus() {
|
|
1883
|
-
|
|
1884
|
-
return;
|
|
1885
|
-
if (selectionMode === 'none')
|
|
1886
|
-
return;
|
|
1887
|
-
if (interaction.ctrlKey || interaction.metaKey || interaction.altKey)
|
|
1888
|
-
return;
|
|
1889
|
-
const targetRowId = getFocusedRowId();
|
|
1890
|
-
if (targetRowId === null)
|
|
1891
|
-
return;
|
|
1892
|
-
if (interaction.shiftKey) {
|
|
1893
|
-
extendSelectionToRow(targetRowId, selectionAnchorKey ?? previousFocusedRowId);
|
|
1894
|
-
return;
|
|
1895
|
-
}
|
|
1896
|
-
if (selectionBehavior !== 'replace')
|
|
1897
|
-
return;
|
|
1898
|
-
replaceSelectionWithRow(targetRowId);
|
|
2012
|
+
syncSelectionAfterFocusMove(direction, interaction, previousFocusedRowId);
|
|
1899
2013
|
}
|
|
1900
2014
|
if (!currentCoord) {
|
|
1901
2015
|
if (focusedRowTarget) {
|
|
@@ -2002,6 +2116,12 @@ export function createTableContext(options = {}) {
|
|
|
2002
2116
|
focusCellByKey(rowCells[rowCells.length - 1]?.key ?? null);
|
|
2003
2117
|
}
|
|
2004
2118
|
function moveToGridStart() {
|
|
2119
|
+
// With row navigation the grid's edges are its first and last body rows;
|
|
2120
|
+
// body cells are not focus targets.
|
|
2121
|
+
if (keyboardNavigation === 'row' && focusedRowTarget) {
|
|
2122
|
+
moveToBodyRowStart();
|
|
2123
|
+
return;
|
|
2124
|
+
}
|
|
2005
2125
|
const rowIndexes = Array.from(getRowsWithCells().keys()).sort((a, b) => a - b);
|
|
2006
2126
|
if (rowIndexes.length === 0)
|
|
2007
2127
|
return;
|
|
@@ -2020,6 +2140,10 @@ export function createTableContext(options = {}) {
|
|
|
2020
2140
|
focusRowByToken(targetToken, focusedRowTarget?.edge ?? 'end');
|
|
2021
2141
|
}
|
|
2022
2142
|
function moveToGridEnd() {
|
|
2143
|
+
if (keyboardNavigation === 'row' && focusedRowTarget) {
|
|
2144
|
+
moveToBodyRowEnd();
|
|
2145
|
+
return;
|
|
2146
|
+
}
|
|
2023
2147
|
const rowMap = getRowsWithCells();
|
|
2024
2148
|
const bodyGlobalRows = getOrderedRowTokens('body')
|
|
2025
2149
|
.map((token) => getGlobalRowIndex(token))
|
|
@@ -2035,7 +2159,7 @@ export function createTableContext(options = {}) {
|
|
|
2035
2159
|
focusCellByKey(rowCells[rowCells.length - 1]?.key ?? null);
|
|
2036
2160
|
}
|
|
2037
2161
|
function emitSelectionChange() {
|
|
2038
|
-
options.onSelectionChange?.(new
|
|
2162
|
+
options.onSelectionChange?.(new SvelteSet(selectedKeys));
|
|
2039
2163
|
notifySelection();
|
|
2040
2164
|
}
|
|
2041
2165
|
function toggleRowSelection(id) {
|
|
@@ -2043,10 +2167,10 @@ export function createTableContext(options = {}) {
|
|
|
2043
2167
|
return;
|
|
2044
2168
|
if (selectionMode === 'single') {
|
|
2045
2169
|
const wasSelected = selectedKeys.has(id);
|
|
2046
|
-
applySelectionChange(wasSelected ? new
|
|
2170
|
+
applySelectionChange(wasSelected ? new SvelteSet() : new SvelteSet([id]), wasSelected ? null : id);
|
|
2047
2171
|
return;
|
|
2048
2172
|
}
|
|
2049
|
-
const next = new
|
|
2173
|
+
const next = new SvelteSet(selectedKeys);
|
|
2050
2174
|
if (next.has(id)) {
|
|
2051
2175
|
next.delete(id);
|
|
2052
2176
|
}
|
|
@@ -2058,18 +2182,18 @@ export function createTableContext(options = {}) {
|
|
|
2058
2182
|
function selectAllRows() {
|
|
2059
2183
|
if (selectionMode !== 'multiple')
|
|
2060
2184
|
return;
|
|
2061
|
-
const next = new
|
|
2185
|
+
const next = new SvelteSet(getOrderedSelectableRowIds());
|
|
2062
2186
|
applySelectionChange(next, next.values().next().value ?? null);
|
|
2063
2187
|
}
|
|
2064
2188
|
function deselectAllRows() {
|
|
2065
2189
|
if (selectedKeys.size === 0)
|
|
2066
2190
|
return;
|
|
2067
|
-
applySelectionChange(new
|
|
2191
|
+
applySelectionChange(new SvelteSet(), null);
|
|
2068
2192
|
}
|
|
2069
2193
|
function setSelection(keys) {
|
|
2070
|
-
const previousSelection = new
|
|
2194
|
+
const previousSelection = new SvelteSet(selectedKeys);
|
|
2071
2195
|
const previousAnchor = selectionAnchorKey;
|
|
2072
|
-
const next = new
|
|
2196
|
+
const next = new SvelteSet(keys);
|
|
2073
2197
|
const preservedAnchor = selectionAnchorKey !== null && next.has(selectionAnchorKey) ? selectionAnchorKey : undefined;
|
|
2074
2198
|
setSelectedKeys(next, preservedAnchor);
|
|
2075
2199
|
if (!hasSameSelection(previousSelection, selectedKeys)) {
|
|
@@ -2081,10 +2205,10 @@ export function createTableContext(options = {}) {
|
|
|
2081
2205
|
}
|
|
2082
2206
|
}
|
|
2083
2207
|
function setSelectionMode(mode) {
|
|
2084
|
-
const previousSelectedKeys = new
|
|
2208
|
+
const previousSelectedKeys = new SvelteSet(selectedKeys);
|
|
2085
2209
|
const previousAnchor = selectionAnchorKey;
|
|
2086
2210
|
selectionMode = mode;
|
|
2087
|
-
setSelectedKeys(new
|
|
2211
|
+
setSelectedKeys(new SvelteSet(selectedKeys), selectionAnchorKey);
|
|
2088
2212
|
if (!hasSameSelection(previousSelectedKeys, selectedKeys) ||
|
|
2089
2213
|
previousAnchor !== selectionAnchorKey) {
|
|
2090
2214
|
emitSelectionChange();
|
|
@@ -2092,6 +2216,24 @@ export function createTableContext(options = {}) {
|
|
|
2092
2216
|
}
|
|
2093
2217
|
notifySelection();
|
|
2094
2218
|
}
|
|
2219
|
+
function setKeyboardNavigation(navigation) {
|
|
2220
|
+
if (keyboardNavigation === navigation)
|
|
2221
|
+
return;
|
|
2222
|
+
keyboardNavigation = navigation;
|
|
2223
|
+
if (navigation === 'grid') {
|
|
2224
|
+
// Body cells re-register on their own: their registration effect
|
|
2225
|
+
// reads this state, so it re-runs for every mounted cell.
|
|
2226
|
+
return;
|
|
2227
|
+
}
|
|
2228
|
+
for (const cell of Array.from(cells.values())) {
|
|
2229
|
+
if (cell.section === 'body') {
|
|
2230
|
+
unregisterCell(cell.key);
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
if (navigation === 'none') {
|
|
2234
|
+
focusedRowTarget = null;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2095
2237
|
function setSelectionBehavior(behavior) {
|
|
2096
2238
|
selectionBehavior = behavior;
|
|
2097
2239
|
notifySelection();
|
|
@@ -2105,8 +2247,8 @@ export function createTableContext(options = {}) {
|
|
|
2105
2247
|
}
|
|
2106
2248
|
function setDisallowEmptySelection(disallow) {
|
|
2107
2249
|
disallowEmptySelection = disallow;
|
|
2108
|
-
const previousSelection = new
|
|
2109
|
-
setSelectedKeys(new
|
|
2250
|
+
const previousSelection = new SvelteSet(selectedKeys);
|
|
2251
|
+
setSelectedKeys(new SvelteSet(selectedKeys), selectionAnchorKey);
|
|
2110
2252
|
if (!hasSameSelection(previousSelection, selectedKeys)) {
|
|
2111
2253
|
emitSelectionChange();
|
|
2112
2254
|
return;
|
|
@@ -2188,6 +2330,9 @@ export function createTableContext(options = {}) {
|
|
|
2188
2330
|
get selectionMode() {
|
|
2189
2331
|
return selectionMode;
|
|
2190
2332
|
},
|
|
2333
|
+
get keyboardNavigation() {
|
|
2334
|
+
return keyboardNavigation;
|
|
2335
|
+
},
|
|
2191
2336
|
get selectionBehavior() {
|
|
2192
2337
|
return selectionBehavior;
|
|
2193
2338
|
},
|
|
@@ -2291,6 +2436,7 @@ export function createTableContext(options = {}) {
|
|
|
2291
2436
|
deselectAllRows: asCommand(deselectAllRows),
|
|
2292
2437
|
setSelection: asCommand(setSelection),
|
|
2293
2438
|
setSelectionMode: asCommand(setSelectionMode),
|
|
2439
|
+
setKeyboardNavigation: asCommand(setKeyboardNavigation),
|
|
2294
2440
|
setSelectionBehavior: asCommand(setSelectionBehavior),
|
|
2295
2441
|
setDisabledBehavior: asCommand(setDisabledBehavior),
|
|
2296
2442
|
setDisallowEmptySelection: asCommand(setDisallowEmptySelection),
|