@human-kit/ui 1.5.3 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/accordion/header/accordion-header.svelte +2 -2
- package/dist/accordion/index.d.ts +1 -1
- package/dist/accordion/index.js +1 -1
- package/dist/accordion/item/accordion-item.svelte +2 -2
- package/dist/accordion/item/context.d.ts +1 -1
- package/dist/accordion/panel/accordion-panel.svelte +3 -3
- package/dist/accordion/root/accordion-root.svelte +1 -1
- package/dist/accordion/trigger/accordion-trigger.svelte +4 -4
- package/dist/accordion/types.d.ts +2 -2
- package/dist/autocomplete/empty/autocomplete-empty.svelte +1 -1
- package/dist/autocomplete/input/autocomplete-input.svelte +3 -3
- package/dist/autocomplete/item/autocomplete-item.svelte +1 -1
- package/dist/autocomplete/item-indicator/autocomplete-item-indicator.svelte +1 -1
- package/dist/autocomplete/list/autocomplete-list.svelte +2 -2
- package/dist/autocomplete/list/autocomplete-list.svelte.d.ts +1 -1
- package/dist/autocomplete/root/autocomplete.svelte +3 -3
- package/dist/autocomplete/root/autocomplete.svelte.d.ts +1 -1
- package/dist/autocomplete/root/context.d.ts +1 -1
- package/dist/autocomplete/status/autocomplete-status.svelte +2 -2
- package/dist/avatar/count/avatar-count.svelte +3 -3
- package/dist/avatar/fallback/avatar-fallback.svelte +1 -1
- package/dist/avatar/group/avatar-group.svelte +1 -1
- package/dist/avatar/image/avatar-image.svelte +1 -1
- package/dist/avatar/root/avatar-root.svelte +2 -2
- package/dist/breadcrumbs/ellipsis/breadcrumbs-ellipsis.svelte +3 -3
- package/dist/breadcrumbs/item/breadcrumbs-item.svelte +1 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.svelte +3 -3
- package/dist/button/root/button-root.svelte +4 -4
- package/dist/calendar/body-cell/calendar-body-cell.svelte +5 -5
- package/dist/calendar/grid/calendar-grid-month-scope.svelte +1 -1
- package/dist/calendar/grid/calendar-grid.svelte +3 -3
- package/dist/calendar/grid/calendar-grid.svelte.d.ts +1 -1
- package/dist/calendar/grid/context.d.ts +1 -1
- package/dist/calendar/grid-body/calendar-grid-body.svelte +2 -2
- package/dist/calendar/grid-header/calendar-grid-header.svelte +2 -2
- package/dist/calendar/heading/calendar-heading.svelte +1 -1
- package/dist/calendar/index.d.ts +1 -1
- package/dist/calendar/index.js +1 -1
- package/dist/calendar/root/calendar-root.svelte +3 -3
- package/dist/calendar/root/calendar-root.svelte.d.ts +2 -2
- package/dist/calendar/root/context.svelte.d.ts +1 -1
- package/dist/calendar/root/context.svelte.js +1 -1
- package/dist/calendar/root/date-utils.js +1 -1
- package/dist/calendar/trigger-next/calendar-trigger-next.svelte +2 -2
- package/dist/calendar/trigger-previous/calendar-trigger-previous.svelte +2 -2
- package/dist/chart/README.md +51 -0
- package/dist/chart/arc/chart-arc.svelte +160 -0
- package/dist/chart/arc/chart-arc.svelte.d.ts +25 -0
- package/dist/chart/area/chart-area.svelte +106 -0
- package/dist/chart/area/chart-area.svelte.d.ts +25 -0
- package/dist/chart/axis/chart-axis.svelte +133 -0
- package/dist/chart/axis/chart-axis.svelte.d.ts +4 -0
- package/dist/chart/bar/chart-bar.svelte +271 -0
- package/dist/chart/bar/chart-bar.svelte.d.ts +25 -0
- package/dist/chart/data-table/chart-data-table.svelte +126 -0
- package/dist/chart/data-table/chart-data-table.svelte.d.ts +4 -0
- package/dist/chart/dot/chart-dot.svelte +93 -0
- package/dist/chart/dot/chart-dot.svelte.d.ts +25 -0
- package/dist/chart/grid/chart-grid.svelte +22 -0
- package/dist/chart/grid/chart-grid.svelte.d.ts +4 -0
- package/dist/chart/index.d.ts +16 -0
- package/dist/chart/index.js +15 -0
- package/dist/chart/index.parts.d.ts +13 -0
- package/dist/chart/index.parts.js +13 -0
- package/dist/chart/internal/arc.d.ts +13 -0
- package/dist/chart/internal/arc.js +32 -0
- package/dist/chart/internal/channel.d.ts +15 -0
- package/dist/chart/internal/channel.js +8 -0
- package/dist/chart/internal/modality.d.ts +11 -0
- package/dist/chart/internal/modality.js +44 -0
- package/dist/chart/internal/navigation.d.ts +16 -0
- package/dist/chart/internal/navigation.js +67 -0
- package/dist/chart/internal/path.d.ts +14 -0
- package/dist/chart/internal/path.js +36 -0
- package/dist/chart/internal/series.d.ts +19 -0
- package/dist/chart/internal/series.js +64 -0
- package/dist/chart/internal/stack.d.ts +14 -0
- package/dist/chart/internal/stack.js +29 -0
- package/dist/chart/internal/symbol.d.ts +8 -0
- package/dist/chart/internal/symbol.js +39 -0
- package/dist/chart/legend/chart-legend.svelte +50 -0
- package/dist/chart/legend/chart-legend.svelte.d.ts +4 -0
- package/dist/chart/line/chart-line.svelte +72 -0
- package/dist/chart/line/chart-line.svelte.d.ts +25 -0
- package/dist/chart/plot/chart-plot.svelte +39 -0
- package/dist/chart/plot/chart-plot.svelte.d.ts +4 -0
- package/dist/chart/root/chart-root.svelte +622 -0
- package/dist/chart/root/chart-root.svelte.d.ts +25 -0
- package/dist/chart/root/context.d.ts +226 -0
- package/dist/chart/root/context.js +17 -0
- package/dist/chart/scales/band.d.ts +14 -0
- package/dist/chart/scales/band.js +30 -0
- package/dist/chart/scales/linear.d.ts +16 -0
- package/dist/chart/scales/linear.js +80 -0
- package/dist/chart/scales/time.d.ts +9 -0
- package/dist/chart/scales/time.js +155 -0
- package/dist/chart/scales/types.d.ts +43 -0
- package/dist/chart/scales/types.js +1 -0
- package/dist/chart/title/chart-title.svelte +17 -0
- package/dist/chart/title/chart-title.svelte.d.ts +4 -0
- package/dist/chart/tooltip/chart-tooltip.svelte +200 -0
- package/dist/chart/tooltip/chart-tooltip.svelte.d.ts +4 -0
- package/dist/chart/types.d.ts +309 -0
- package/dist/chart/types.js +1 -0
- package/dist/checkbox/indicator/checkbox-indicator.svelte +1 -1
- package/dist/checkbox/root/checkbox-root.svelte +4 -4
- package/dist/checkbox-group/index.d.ts +1 -1
- package/dist/checkbox-group/index.js +1 -1
- package/dist/checkbox-group/label/checkbox-group-label.svelte +1 -1
- package/dist/checkbox-group/root/checkbox-group-root.svelte +1 -1
- package/dist/clock/axis/clock-axis.svelte +1 -1
- package/dist/clock/root/clock-root.svelte +4 -4
- package/dist/clock/root/clock-root.svelte.d.ts +2 -2
- package/dist/clock/root/context.d.ts +1 -1
- package/dist/clock/root/create-time-selection-state.svelte.d.ts +1 -1
- package/dist/clock/root/create-time-selection-state.svelte.js +3 -3
- package/dist/clock/root/resolve-visible-columns.d.ts +2 -2
- package/dist/clock/root/wheel-options.d.ts +1 -1
- package/dist/clock/root/wheel-options.js +1 -1
- package/dist/clock/wheel-column/clock-wheel-column.svelte +5 -5
- package/dist/clock/wheel-column/clock-wheel-column.svelte.d.ts +1 -1
- package/dist/clock/wheel-item/clock-wheel-item.svelte +1 -1
- package/dist/clock/wheel-item/clock-wheel-item.svelte.d.ts +1 -1
- package/dist/collapsible/panel/collapsible-panel.svelte +2 -2
- package/dist/collapsible/root/collapsible-root.svelte +1 -1
- package/dist/collapsible/trigger/collapsible-trigger.svelte +1 -1
- package/dist/color-picker/area/color-picker-area.svelte +4 -4
- package/dist/color-picker/area/color-picker-area.svelte.d.ts +1 -1
- package/dist/color-picker/area-thumb/color-picker-area-thumb.svelte +5 -5
- package/dist/color-picker/area-thumb/color-picker-area-thumb.svelte.d.ts +1 -1
- package/dist/color-picker/channel-field/color-picker-channel-field.svelte +2 -2
- package/dist/color-picker/channel-field/color-picker-channel-field.svelte.d.ts +1 -1
- package/dist/color-picker/eye-dropper/color-picker-eye-dropper.svelte +4 -4
- package/dist/color-picker/eye-dropper/color-picker-eye-dropper.svelte.d.ts +1 -1
- package/dist/color-picker/hex-field/color-picker-hex-field.svelte +5 -5
- package/dist/color-picker/hex-field/color-picker-hex-field.svelte.d.ts +1 -1
- package/dist/color-picker/label/color-picker-label.svelte +2 -2
- package/dist/color-picker/label/color-picker-label.svelte.d.ts +1 -1
- package/dist/color-picker/preview/color-picker-preview.svelte +2 -2
- package/dist/color-picker/preview/color-picker-preview.svelte.d.ts +1 -1
- package/dist/color-picker/root/color-picker-root.svelte +6 -6
- package/dist/color-picker/root/color-picker-root.svelte.d.ts +1 -1
- package/dist/color-picker/root/context.d.ts +1 -1
- package/dist/color-picker/slider/color-picker-slider.svelte +3 -3
- package/dist/color-picker/slider/color-picker-slider.svelte.d.ts +1 -1
- package/dist/color-picker/slider-thumb/color-picker-slider-thumb.svelte +5 -5
- package/dist/color-picker/slider-thumb/color-picker-slider-thumb.svelte.d.ts +1 -1
- package/dist/color-picker/swatch/color-picker-swatch.svelte +5 -5
- package/dist/color-picker/swatch/color-picker-swatch.svelte.d.ts +1 -1
- package/dist/color-picker/swatch-list/color-picker-swatch-list.svelte +7 -7
- package/dist/color-picker/swatch-list/color-picker-swatch-list.svelte.d.ts +1 -1
- package/dist/color-picker/types.d.ts +1 -1
- package/dist/combobox/clear/combobox-clear.svelte +1 -1
- package/dist/combobox/input/combobox-input.svelte +3 -3
- package/dist/combobox/item/combobox-listboxitem.svelte +1 -1
- package/dist/combobox/item/combobox-listboxitem.svelte.d.ts +1 -1
- package/dist/combobox/item-indicator/combobox-item-indicator.svelte +1 -1
- package/dist/combobox/list/combobox-listbox.svelte +3 -3
- package/dist/combobox/list/combobox-listbox.svelte.d.ts +1 -1
- package/dist/combobox/popover/combobox-popover.svelte +5 -5
- package/dist/combobox/popover/combobox-popover.svelte.d.ts +1 -1
- package/dist/combobox/root/combobox.svelte +6 -6
- package/dist/combobox/root/combobox.svelte.d.ts +1 -1
- package/dist/combobox/root/context.d.ts +1 -1
- package/dist/combobox/status/combobox-status.svelte +4 -4
- package/dist/combobox/tag/combobox-tag.svelte +1 -1
- package/dist/combobox/trigger/combobox-trigger.svelte +3 -3
- package/dist/datepicker/calendar/date-picker-calendar.svelte +3 -3
- package/dist/datepicker/calendar/date-picker-calendar.svelte.d.ts +1 -1
- package/dist/datepicker/input/date-picker-input.svelte +2 -2
- package/dist/datepicker/input/date-picker-input.svelte.d.ts +1 -1
- package/dist/datepicker/internal/strict-props.d.ts +1 -1
- package/dist/datepicker/internal/strict-props.js +2 -2
- package/dist/datepicker/popover/date-picker-popover.svelte +6 -6
- package/dist/datepicker/popover/date-picker-popover.svelte.d.ts +1 -1
- package/dist/datepicker/root/context.d.ts +2 -2
- package/dist/datepicker/root/date-picker-root.svelte +12 -12
- package/dist/datepicker/root/date-picker-root.svelte.d.ts +2 -2
- package/dist/datepicker/root/date-utils.js +1 -1
- package/dist/datepicker/root/draft-evaluation.d.ts +2 -2
- package/dist/datepicker/root/draft-evaluation.js +1 -1
- package/dist/datepicker/root/focus-controller.d.ts +1 -1
- package/dist/datepicker/root/focus-controller.js +1 -1
- package/dist/datepicker/root/open-change.d.ts +1 -1
- package/dist/datepicker/root/open-controller.d.ts +1 -1
- package/dist/datepicker/root/open-controller.js +1 -1
- package/dist/datepicker/root/segment-controller.d.ts +1 -1
- package/dist/datepicker/root/segment-engine.d.ts +2 -2
- package/dist/datepicker/root/segment-engine.js +1 -1
- package/dist/datepicker/root/segment-state.d.ts +1 -1
- package/dist/datepicker/root/segment-state.js +1 -1
- package/dist/datepicker/root/value-commit.d.ts +1 -1
- package/dist/datepicker/segment/date-picker-segment.svelte +5 -5
- package/dist/datepicker/segment/date-picker-segment.svelte.d.ts +1 -1
- package/dist/datepicker/trigger/date-picker-trigger.svelte +2 -2
- package/dist/daterangepicker/calendar/date-range-picker-calendar.svelte +4 -4
- package/dist/daterangepicker/calendar/date-range-picker-calendar.svelte.d.ts +1 -1
- package/dist/daterangepicker/index.d.ts +1 -1
- package/dist/daterangepicker/index.js +1 -1
- package/dist/daterangepicker/input/date-range-picker-input.svelte +2 -2
- package/dist/daterangepicker/input/date-range-picker-input.svelte.d.ts +1 -1
- package/dist/daterangepicker/internal/strict-props.d.ts +1 -1
- package/dist/daterangepicker/internal/strict-props.js +2 -2
- package/dist/daterangepicker/popover/date-range-picker-popover.svelte +6 -6
- package/dist/daterangepicker/popover/date-range-picker-popover.svelte.d.ts +1 -1
- package/dist/daterangepicker/root/context.d.ts +2 -2
- package/dist/daterangepicker/root/date-range-picker-root.svelte +13 -13
- package/dist/daterangepicker/root/date-range-picker-root.svelte.d.ts +2 -2
- package/dist/daterangepicker/root/value-commit.d.ts +1 -1
- package/dist/daterangepicker/root/value-commit.js +1 -1
- package/dist/daterangepicker/segment/date-range-picker-segment.svelte +5 -5
- package/dist/daterangepicker/segment/date-range-picker-segment.svelte.d.ts +1 -1
- package/dist/daterangepicker/trigger/date-range-picker-trigger.svelte +2 -2
- package/dist/dialog/close/dialog-close.svelte +1 -1
- package/dist/dialog/content/dialog-content.svelte +8 -8
- package/dist/dialog/description/dialog-description.svelte +1 -1
- package/dist/dialog/overlay/dialog-overlay.svelte +3 -3
- package/dist/dialog/portal/dialog-portal.svelte +4 -4
- package/dist/dialog/root/dialog-root.svelte +5 -5
- package/dist/dialog/root/dialog-root.svelte.d.ts +1 -1
- package/dist/dialog/root/dialog-stack.d.ts +1 -1
- package/dist/dialog/root/dialog-stack.js +2 -2
- package/dist/dialog/title/dialog-title.svelte +1 -1
- package/dist/dialog/trigger/dialog-trigger.svelte +1 -1
- package/dist/drawer/body/drawer-body.svelte +1 -1
- package/dist/drawer/close/drawer-close.svelte +1 -1
- package/dist/drawer/content/drawer-content.svelte +15 -15
- package/dist/drawer/description/drawer-description.svelte +1 -1
- package/dist/drawer/indent/drawer-indent-background.svelte +1 -1
- package/dist/drawer/indent/drawer-indent.svelte +1 -1
- package/dist/drawer/overlay/drawer-overlay.svelte +4 -4
- package/dist/drawer/portal/drawer-portal.svelte +4 -4
- package/dist/drawer/root/context.d.ts +1 -1
- package/dist/drawer/root/drawer-root.svelte +5 -5
- package/dist/drawer/root/drawer-root.svelte.d.ts +2 -2
- package/dist/drawer/root/snap-points.d.ts +1 -1
- package/dist/drawer/root/snap-points.js +1 -1
- package/dist/drawer/swipe-area/drawer-swipe-area.svelte +4 -4
- package/dist/drawer/title/drawer-title.svelte +1 -1
- package/dist/drawer/trigger/drawer-trigger.svelte +2 -2
- package/dist/drawer/trigger/drawer-trigger.svelte.d.ts +1 -1
- package/dist/drawer/viewport/drawer-viewport.svelte +5 -5
- package/dist/drawer/virtual-keyboard/drawer-virtual-keyboard-provider.svelte +2 -2
- package/dist/dropzone/dropzone.svelte +7 -4
- package/dist/dropzone/dropzone.svelte.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/input/input.svelte +8 -5
- package/dist/input/input.svelte.d.ts +1 -1
- package/dist/internal/strict-props.d.ts +1 -1
- package/dist/internal/strict-props.js +2 -2
- package/dist/label/label.svelte +2 -2
- package/dist/label/label.svelte.d.ts +1 -1
- package/dist/listbox/item/listbox-item.svelte +2 -2
- package/dist/listbox/root/context.d.ts +1 -1
- package/dist/listbox/root/context.js +1 -1
- package/dist/listbox/root/listbox.svelte +3 -3
- package/dist/listbox/root/listbox.svelte.d.ts +1 -1
- package/dist/locale-provider/index.d.ts +1 -1
- package/dist/locale-provider/index.js +1 -1
- package/dist/locale-provider/locale-provider-value-probe.svelte +1 -1
- package/dist/locale-provider/locale-provider.svelte +1 -1
- package/dist/menu/content/menu-content.svelte +14 -10
- package/dist/menu/content/menu-content.svelte.d.ts +1 -1
- package/dist/menu/context-trigger/menu-context-trigger.svelte +2 -2
- package/dist/menu/group/menu-group-label.svelte +1 -1
- package/dist/menu/group/menu-group.svelte +1 -1
- package/dist/menu/item/menu-item.svelte +1 -1
- package/dist/menu/overlay/menu-overlay.svelte +4 -4
- package/dist/menu/root/context.d.ts +1 -1
- package/dist/menu/root/focus-state.d.ts +2 -2
- package/dist/menu/root/focus-state.js +1 -1
- package/dist/menu/root/menu-root.svelte +2 -2
- package/dist/menu/root/menu-root.svelte.d.ts +1 -1
- package/dist/menu/root/menu-stack.js +1 -1
- package/dist/menu/root/menu-state.svelte.d.ts +1 -1
- package/dist/menu/root/menu-state.svelte.js +3 -3
- package/dist/menu/root/submenu-intent.d.ts +1 -1
- package/dist/menu/submenu/menu-submenu-root.svelte +2 -2
- package/dist/menu/submenu/menu-submenu-root.svelte.d.ts +1 -1
- package/dist/menu/submenu/menu-submenu-trigger.svelte +1 -1
- package/dist/menu/trigger/menu-trigger.svelte +1 -1
- package/dist/numberfield/group/number-field-group.svelte +2 -2
- package/dist/numberfield/input/number-field-input.svelte +4 -4
- package/dist/numberfield/internal/number-field-stepper.svelte +1 -1
- package/dist/numberfield/root/context.d.ts +1 -1
- package/dist/numberfield/root/number-field-root.svelte +5 -5
- package/dist/numberfield/root/number-field-root.svelte.d.ts +1 -1
- package/dist/numberfield/root/number-utils.js +1 -1
- package/dist/numberfield/scrub-area/number-field-scrub-area.svelte +2 -2
- package/dist/numberfield/scrub-area-cursor/number-field-scrub-area-cursor.svelte +2 -2
- package/dist/overflow-row/overflow-row.svelte +1 -1
- package/dist/overflow-row/overflow-row.svelte.d.ts +1 -1
- package/dist/pin-input/cell/pin-input-cell.svelte +5 -5
- package/dist/pin-input/cell/pin-input-cell.svelte.d.ts +1 -1
- package/dist/pin-input/label/pin-input-label.svelte +2 -2
- package/dist/pin-input/label/pin-input-label.svelte.d.ts +1 -1
- package/dist/pin-input/root/context.d.ts +1 -1
- package/dist/pin-input/root/pin-input-root.svelte +11 -7
- package/dist/pin-input/root/pin-input-root.svelte.d.ts +1 -1
- package/dist/pin-input/types.d.ts +1 -1
- package/dist/popover/content/popover-content.svelte +13 -13
- package/dist/popover/content/popover-content.svelte.d.ts +3 -3
- package/dist/popover/overlay/popover-overlay.svelte +4 -4
- package/dist/popover/root/focus-state.d.ts +2 -2
- package/dist/popover/root/focus-state.js +1 -1
- package/dist/popover/root/popover-root.svelte +2 -2
- package/dist/popover/root/popover-root.svelte.d.ts +1 -1
- package/dist/popover/root/popover-stack.js +1 -1
- package/dist/popover/trigger/popover-trigger.svelte +1 -1
- package/dist/portal/portal.svelte +1 -1
- package/dist/primitives/aria-hide-outside.js +1 -1
- package/dist/primitives/collapse-transition.svelte.js +1 -1
- package/dist/primitives/focus-trap.js +2 -2
- package/dist/primitives/presence.svelte.js +1 -1
- package/dist/primitives/release-focused-descendant.js +1 -1
- package/dist/progress/indicator/progress-indicator.svelte +1 -1
- package/dist/progress/label/progress-label.svelte +1 -1
- package/dist/progress/root/context.d.ts +1 -1
- package/dist/progress/root/progress-root.svelte +3 -3
- package/dist/progress/track/progress-track.svelte +1 -1
- package/dist/progress/value/progress-value.svelte +1 -1
- package/dist/radio-group/index.d.ts +1 -1
- package/dist/radio-group/index.js +1 -1
- package/dist/radio-group/indicator/radio-group-indicator.svelte +1 -1
- package/dist/radio-group/item/radio-group-item.svelte +4 -4
- package/dist/radio-group/label/radio-group-label.svelte +1 -1
- package/dist/radio-group/root/radio-group-root.svelte +3 -3
- package/dist/rating/item/rating-item.svelte +5 -5
- package/dist/rating/item/rating-item.svelte.d.ts +1 -1
- package/dist/rating/label/rating-label.svelte +2 -2
- package/dist/rating/label/rating-label.svelte.d.ts +1 -1
- package/dist/rating/output/rating-output.svelte +2 -2
- package/dist/rating/output/rating-output.svelte.d.ts +1 -1
- package/dist/rating/root/rating-root.svelte +9 -9
- package/dist/rating/root/rating-root.svelte.d.ts +1 -1
- package/dist/rating/types.d.ts +1 -1
- package/dist/search-field/clear/search-field-clear.svelte +3 -3
- package/dist/search-field/input/search-field-input.svelte +5 -5
- package/dist/search-field/label/search-field-label.svelte +1 -1
- package/dist/search-field/root/search-field-root.svelte +5 -5
- package/dist/select/item/select-item.svelte +1 -1
- package/dist/select/item-indicator/select-item-indicator.svelte +2 -2
- package/dist/select/item-indicator/select-item-indicator.svelte.d.ts +1 -1
- package/dist/select/label/select-label.svelte +2 -2
- package/dist/select/label/select-label.svelte.d.ts +1 -1
- package/dist/select/list/select-list.svelte +2 -2
- package/dist/select/list/select-list.svelte.d.ts +1 -1
- package/dist/select/popover/select-popover.svelte +4 -4
- package/dist/select/popover/select-popover.svelte.d.ts +1 -1
- package/dist/select/root/context.d.ts +2 -2
- package/dist/select/root/select-root.svelte +7 -7
- package/dist/select/root/select-root.svelte.d.ts +1 -1
- package/dist/select/trigger/select-trigger.svelte +4 -4
- package/dist/select/trigger/select-trigger.svelte.d.ts +1 -1
- package/dist/select/types.d.ts +1 -1
- package/dist/select/value/select-value.svelte +3 -3
- package/dist/select/value/select-value.svelte.d.ts +1 -1
- package/dist/separator/separator.svelte +5 -2
- package/dist/slider/fill/slider-fill.svelte +2 -2
- package/dist/slider/fill/slider-fill.svelte.d.ts +1 -1
- package/dist/slider/label/slider-label.svelte +2 -2
- package/dist/slider/label/slider-label.svelte.d.ts +1 -1
- package/dist/slider/output/slider-output.svelte +3 -3
- package/dist/slider/output/slider-output.svelte.d.ts +1 -1
- package/dist/slider/root/slider-root.svelte +7 -7
- package/dist/slider/root/slider-root.svelte.d.ts +1 -1
- package/dist/slider/root/slider-utils.d.ts +1 -1
- package/dist/slider/root/slider-utils.js +1 -1
- package/dist/slider/thumb/slider-thumb.svelte +7 -7
- package/dist/slider/thumb/slider-thumb.svelte.d.ts +1 -1
- package/dist/slider/track/slider-track.svelte +2 -2
- package/dist/slider/track/slider-track.svelte.d.ts +1 -1
- package/dist/slider/types.d.ts +1 -1
- package/dist/switch/root/switch-root.svelte +3 -3
- package/dist/switch/thumb/switch-thumb.svelte +1 -1
- package/dist/table/body/table-body.svelte +1 -1
- package/dist/table/cell/table-cell.svelte +3 -3
- package/dist/table/checkbox/table-checkbox.svelte +5 -5
- package/dist/table/checkbox-indicator/table-checkbox-indicator.svelte +2 -2
- package/dist/table/column/table-column.svelte +1 -1
- package/dist/table/column-header-cell/table-column-header-cell.svelte +4 -4
- package/dist/table/column-resizer/table-column-resizer.svelte +6 -6
- package/dist/table/empty-state/table-empty-state.svelte +1 -1
- package/dist/table/footer/table-footer.svelte +1 -1
- package/dist/table/header/table-header.svelte +1 -1
- package/dist/table/index.d.ts +1 -1
- package/dist/table/index.js +1 -1
- package/dist/table/interactive-cell/table-interactive-cell.svelte +3 -3
- package/dist/table/root/context.svelte.js +1 -1
- package/dist/table/root/table-root.svelte +7 -7
- package/dist/table/root/table-ssr-wrapper-column.svelte +1 -1
- package/dist/table/root/table-ssr-wrapper-column.svelte.d.ts +1 -1
- package/dist/table/row/table-row.svelte +3 -3
- package/dist/table/section-row/table-section-row.svelte +3 -3
- package/dist/table/sort-trigger/table-sort-trigger.svelte +2 -2
- package/dist/table/types.d.ts +2 -2
- package/dist/table/utils/handle-body-keydown.d.ts +1 -1
- package/dist/table/utils/handle-body-keydown.js +1 -1
- package/dist/table/utils/ssr-min-width.d.ts +1 -1
- package/dist/table/utils/ssr-min-width.js +1 -1
- package/dist/tabs/index.d.ts +1 -1
- package/dist/tabs/index.js +1 -1
- package/dist/tabs/indicator/tabs-indicator.svelte +1 -1
- package/dist/tabs/list/tabs-list.svelte +3 -3
- package/dist/tabs/panel/tabs-panel.svelte +1 -1
- package/dist/tabs/root/tabs-root.svelte +1 -1
- package/dist/tabs/tab/tabs-tab.svelte +2 -2
- package/dist/tabs/types.d.ts +2 -2
- package/dist/textarea/textarea.svelte +8 -5
- package/dist/textarea/textarea.svelte.d.ts +1 -1
- package/dist/timepicker/clock/time-picker-clock.svelte +3 -3
- package/dist/timepicker/clock/time-picker-clock.svelte.d.ts +1 -1
- package/dist/timepicker/input/time-picker-input.svelte +3 -3
- package/dist/timepicker/input/time-picker-input.svelte.d.ts +1 -1
- package/dist/timepicker/internal/strict-props.d.ts +1 -1
- package/dist/timepicker/internal/strict-props.js +2 -2
- package/dist/timepicker/popover/time-picker-popover.svelte +5 -5
- package/dist/timepicker/popover/time-picker-popover.svelte.d.ts +1 -1
- package/dist/timepicker/root/context.d.ts +2 -2
- package/dist/timepicker/root/time-picker-root.svelte +4 -4
- package/dist/timepicker/root/time-picker-root.svelte.d.ts +2 -2
- package/dist/timepicker/root/time-utils.d.ts +1 -1
- package/dist/timepicker/root/time-utils.js +1 -1
- package/dist/timepicker/segment/time-picker-segment.svelte +5 -5
- package/dist/timepicker/segment/time-picker-segment.svelte.d.ts +1 -1
- package/dist/timepicker/trigger/time-picker-trigger.svelte +3 -3
- package/dist/toast/action/toast-action.svelte +2 -2
- package/dist/toast/close/toast-close.svelte +2 -2
- package/dist/toast/content/toast-content.svelte +1 -1
- package/dist/toast/description/toast-description.svelte +1 -1
- package/dist/toast/positioner/toast-positioner.svelte +3 -3
- package/dist/toast/provider/context.d.ts +1 -1
- package/dist/toast/provider/toast-manager.svelte.d.ts +1 -1
- package/dist/toast/provider/toast-provider.svelte +2 -2
- package/dist/toast/root/context.d.ts +1 -1
- package/dist/toast/root/toast-root.svelte +4 -4
- package/dist/toast/title/toast-title.svelte +1 -1
- package/dist/toast/viewport/toast-viewport.svelte +10 -10
- package/dist/toggle/root/toggle-root.svelte +3 -3
- package/dist/toggle/root/toggle-root.svelte.d.ts +1 -1
- package/dist/toggle/types.d.ts +1 -1
- package/dist/toggle-group/index.d.ts +1 -1
- package/dist/toggle-group/index.js +1 -1
- package/dist/toggle-group/root/toggle-group-root.svelte +3 -3
- package/dist/toggle-group/types.d.ts +2 -2
- package/dist/tooltip/arrow/tooltip-arrow.svelte +2 -2
- package/dist/tooltip/arrow/tooltip-arrow.svelte.d.ts +1 -1
- package/dist/tooltip/content/tooltip-content.svelte +6 -6
- package/dist/tooltip/content/tooltip-content.svelte.d.ts +1 -1
- package/dist/tooltip/provider/tooltip-provider.svelte +3 -3
- package/dist/tooltip/provider/tooltip-provider.svelte.d.ts +1 -1
- package/dist/tooltip/root/tooltip-root.svelte +7 -7
- package/dist/tooltip/root/tooltip-root.svelte.d.ts +1 -1
- package/dist/tooltip/trigger/tooltip-trigger.svelte +2 -2
- package/dist/tooltip/trigger/tooltip-trigger.svelte.d.ts +1 -1
- package/dist/tooltip/types.d.ts +2 -2
- package/dist/transfer-list/item/transfer-list-item.svelte +3 -3
- package/dist/transfer-list/list/transfer-list-list.svelte +4 -4
- package/dist/transfer-list/list/transfer-list-list.svelte.d.ts +1 -1
- package/dist/transfer-list/move/transfer-list-move-button.svelte +5 -5
- package/dist/transfer-list/move/transfer-list-move-button.svelte.d.ts +1 -1
- package/dist/transfer-list/move/transfer-list-reorder-button.svelte +4 -4
- package/dist/transfer-list/root/context.d.ts +2 -2
- package/dist/transfer-list/root/transfer-list-root.svelte +4 -4
- package/dist/transfer-list/root/transfer-list-root.svelte.d.ts +1 -1
- package/dist/transfer-list/status/transfer-list-status.svelte +5 -5
- package/dist/transfer-list/status/transfer-list-status.svelte.d.ts +1 -1
- package/dist/tree/checkbox/tree-checkbox.svelte +8 -8
- package/dist/tree/checkbox/tree-checkbox.svelte.d.ts +1 -1
- package/dist/tree/checkbox-indicator/tree-checkbox-indicator.svelte +3 -3
- package/dist/tree/checkbox-indicator/tree-checkbox-indicator.svelte.d.ts +1 -1
- package/dist/tree/children/tree-children.svelte +3 -3
- package/dist/tree/children/tree-children.svelte.d.ts +1 -1
- package/dist/tree/header/tree-header.svelte +3 -3
- package/dist/tree/header/tree-header.svelte.d.ts +1 -1
- package/dist/tree/item/context.d.ts +1 -1
- package/dist/tree/item/tree-item-renderer.svelte +5 -5
- package/dist/tree/item/tree-item-renderer.svelte.d.ts +2 -2
- package/dist/tree/item/tree-item.svelte +4 -4
- package/dist/tree/item/tree-item.svelte.d.ts +1 -1
- package/dist/tree/label/tree-label.svelte +3 -3
- package/dist/tree/label/tree-label.svelte.d.ts +1 -1
- package/dist/tree/root/tree-root.svelte +4 -4
- package/dist/tree/root/tree-root.svelte.d.ts +1 -1
- package/dist/tree/section/tree-section.svelte +3 -3
- package/dist/tree/section/tree-section.svelte.d.ts +1 -1
- package/dist/tree/trigger/tree-trigger.svelte +5 -5
- package/dist/tree/trigger/tree-trigger.svelte.d.ts +1 -1
- package/package.json +24 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { round } from './path.js';
|
|
2
|
+
const TAU = 2 * Math.PI;
|
|
3
|
+
/** The position at a radius and an angle. The angle starts at the top and goes clockwise. */
|
|
4
|
+
export function polar(r, angle) {
|
|
5
|
+
return [round(r * Math.sin(angle)), round(-r * Math.cos(angle))];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The `d` attribute of a slice of a ring with its center at 0,0: from the angle `a0` to the
|
|
9
|
+
* angle `a1`, between the radius `r0` and the radius `r1`. A radius `r0` of 0 makes a slice of a
|
|
10
|
+
* pie. A full circle is two half circles, because one arc cannot start and end at one position.
|
|
11
|
+
*/
|
|
12
|
+
export function arcPath(r0, r1, a0, a1) {
|
|
13
|
+
if (a1 - a0 >= TAU - 1e-9) {
|
|
14
|
+
const ring = (r, sweep) => `M0,${-r}A${r},${r} 0 1 ${sweep} 0,${r}A${r},${r} 0 1 ${sweep} 0,${-r}Z`;
|
|
15
|
+
// The inner circle goes the other way, thus it makes a hole.
|
|
16
|
+
return ring(round(r1), 1) + (r0 > 0 ? ring(round(r0), 0) : '');
|
|
17
|
+
}
|
|
18
|
+
const large = a1 - a0 > Math.PI ? 1 : 0;
|
|
19
|
+
const side = (r, to, sweep) => `A${round(r)},${round(r)} 0 ${large} ${sweep} ${polar(r, to)}`;
|
|
20
|
+
return (`M${polar(r1, a0)}${side(r1, a1, 1)}` +
|
|
21
|
+
(r0 > 0 ? `L${polar(r0, a1)}${side(r0, a0, 0)}` : 'L0,0') +
|
|
22
|
+
'Z');
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Whether a position, from the center, is in the slice. The start angle is in the slice and the
|
|
26
|
+
* end angle is not, thus a position on the line between two slices is in one slice only.
|
|
27
|
+
*/
|
|
28
|
+
export function inArc(r0, r1, a0, a1, x, y) {
|
|
29
|
+
const r = Math.hypot(x, y);
|
|
30
|
+
const angle = (Math.atan2(x, -y) + TAU) % TAU;
|
|
31
|
+
return r >= r0 && r <= r1 && angle >= a0 && angle < a1;
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The field names of `T` that hold a value of the type `V`. The value can be missing: a row
|
|
3
|
+
* without a valid value has no point.
|
|
4
|
+
*/
|
|
5
|
+
export type FieldOf<T, V> = {
|
|
6
|
+
[K in keyof T]-?: T[K] extends V | null | undefined ? K : never;
|
|
7
|
+
}[keyof T] & string;
|
|
8
|
+
/**
|
|
9
|
+
* A channel: the name of a field of the row, or a function that reads the value from the row.
|
|
10
|
+
*/
|
|
11
|
+
export type Channel<T, V> = FieldOf<T, V> | ((row: T, index: number) => V | null | undefined);
|
|
12
|
+
/** Reads the value of a channel from a row. The value can be missing. */
|
|
13
|
+
export declare function read<T, V>(channel: Channel<T, V>, row: T, index: number): V | null | undefined;
|
|
14
|
+
/** The text that names a channel: the field name, or `fallback` for a function. */
|
|
15
|
+
export declare function channelName(channel: unknown, fallback: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Reads the value of a channel from a row. The value can be missing. */
|
|
2
|
+
export function read(channel, row, index) {
|
|
3
|
+
return typeof channel === 'function' ? channel(row, index) : row[channel];
|
|
4
|
+
}
|
|
5
|
+
/** The text that names a channel: the field name, or `fallback` for a function. */
|
|
6
|
+
export function channelName(channel, fallback) {
|
|
7
|
+
return typeof channel === 'string' ? channel : fallback;
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The input modality, for the focus contract of `@human-kit/ui`: a focus that a pointer gave
|
|
3
|
+
* does not show `data-focus-visible`. This is the subset of the ui primitive that a chart needs.
|
|
4
|
+
*/
|
|
5
|
+
export type Modality = 'keyboard' | 'pointer' | 'virtual';
|
|
6
|
+
/** Calls `listener` at each change of the modality. Returns the function that stops it. */
|
|
7
|
+
export declare function onModalityChange(listener: () => void): () => void;
|
|
8
|
+
/** Whether the element must show `data-focus-visible`. */
|
|
9
|
+
export declare function isFocusVisible(element: Element | null): boolean;
|
|
10
|
+
/** Focuses the element without a focus ring, as a pointer press does. */
|
|
11
|
+
export declare function focusFromPointer(element: HTMLElement | SVGElement): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
let modality = 'virtual';
|
|
2
|
+
let lastInput = Number.NEGATIVE_INFINITY;
|
|
3
|
+
const listeners = new Set();
|
|
4
|
+
let installed = false;
|
|
5
|
+
function set(next) {
|
|
6
|
+
if (modality === next)
|
|
7
|
+
return;
|
|
8
|
+
modality = next;
|
|
9
|
+
for (const listener of [...listeners])
|
|
10
|
+
listener();
|
|
11
|
+
}
|
|
12
|
+
function install() {
|
|
13
|
+
if (installed || typeof window === 'undefined')
|
|
14
|
+
return;
|
|
15
|
+
installed = true;
|
|
16
|
+
window.addEventListener('keydown', (event) => {
|
|
17
|
+
lastInput = Date.now();
|
|
18
|
+
if (!event.ctrlKey && !event.metaKey && !event.altKey)
|
|
19
|
+
set('keyboard');
|
|
20
|
+
}, true);
|
|
21
|
+
window.addEventListener('pointerdown', () => {
|
|
22
|
+
lastInput = Date.now();
|
|
23
|
+
set('pointer');
|
|
24
|
+
}, true);
|
|
25
|
+
// A focus move without a recent input came from assistive technology or a script.
|
|
26
|
+
window.addEventListener('focusin', () => Date.now() - lastInput > 50 && set('virtual'), true);
|
|
27
|
+
}
|
|
28
|
+
/** Calls `listener` at each change of the modality. Returns the function that stops it. */
|
|
29
|
+
export function onModalityChange(listener) {
|
|
30
|
+
install();
|
|
31
|
+
listeners.add(listener);
|
|
32
|
+
return () => listeners.delete(listener);
|
|
33
|
+
}
|
|
34
|
+
/** Whether the element must show `data-focus-visible`. */
|
|
35
|
+
export function isFocusVisible(element) {
|
|
36
|
+
install();
|
|
37
|
+
return !!element && modality !== 'pointer' && element.matches(':focus-visible');
|
|
38
|
+
}
|
|
39
|
+
/** Focuses the element without a focus ring, as a pointer press does. */
|
|
40
|
+
export function focusFromPointer(element) {
|
|
41
|
+
install();
|
|
42
|
+
set('pointer');
|
|
43
|
+
element.focus({ focusVisible: false });
|
|
44
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** The place of a point: the index of its series, and its index in that series. */
|
|
2
|
+
export type Position = {
|
|
3
|
+
series: number;
|
|
4
|
+
index: number;
|
|
5
|
+
};
|
|
6
|
+
/** The number of points that `PageUp` and `PageDown` move. */
|
|
7
|
+
export declare const PAGE = 10;
|
|
8
|
+
/** The position of a point: its value along the series, and its value across the series. */
|
|
9
|
+
export type Place = readonly [number, number];
|
|
10
|
+
/**
|
|
11
|
+
* The position after a key press, or `null` when the key does not move the focus. `series`
|
|
12
|
+
* holds the places of the points of each series, in the order of the keyboard.
|
|
13
|
+
*
|
|
14
|
+
* The keys do not wrap: at the end of a series, `ArrowRight` does nothing.
|
|
15
|
+
*/
|
|
16
|
+
export declare function move(series: ReadonlyArray<readonly Place[]>, from: Position, key: string): Position | null;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** The number of points that `PageUp` and `PageDown` move. */
|
|
2
|
+
export const PAGE = 10;
|
|
3
|
+
/**
|
|
4
|
+
* The point in `places` with the value along the series closest to `from`. When two have the
|
|
5
|
+
* same distance, the value across the series breaks the tie. Returns its index, or -1 for an
|
|
6
|
+
* empty list.
|
|
7
|
+
*/
|
|
8
|
+
function nearest(places, from) {
|
|
9
|
+
let best = -1;
|
|
10
|
+
let distance = Infinity;
|
|
11
|
+
let across = Infinity;
|
|
12
|
+
places.forEach(([x, y], i) => {
|
|
13
|
+
const d = Math.abs(x - from[0]);
|
|
14
|
+
const a = Math.abs(y - from[1]);
|
|
15
|
+
if (d < distance || (d === distance && a < across))
|
|
16
|
+
[best, distance, across] = [i, d, a];
|
|
17
|
+
});
|
|
18
|
+
return best;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The position after a key press, or `null` when the key does not move the focus. `series`
|
|
22
|
+
* holds the places of the points of each series, in the order of the keyboard.
|
|
23
|
+
*
|
|
24
|
+
* The keys do not wrap: at the end of a series, `ArrowRight` does nothing.
|
|
25
|
+
*/
|
|
26
|
+
export function move(series, from, key) {
|
|
27
|
+
const points = series[from.series];
|
|
28
|
+
if (!points?.length)
|
|
29
|
+
return null;
|
|
30
|
+
const last = points.length - 1;
|
|
31
|
+
let index = from.index;
|
|
32
|
+
switch (key) {
|
|
33
|
+
case 'ArrowRight':
|
|
34
|
+
index++;
|
|
35
|
+
break;
|
|
36
|
+
case 'ArrowLeft':
|
|
37
|
+
index--;
|
|
38
|
+
break;
|
|
39
|
+
case 'PageDown':
|
|
40
|
+
index += PAGE;
|
|
41
|
+
break;
|
|
42
|
+
case 'PageUp':
|
|
43
|
+
index -= PAGE;
|
|
44
|
+
break;
|
|
45
|
+
case 'Home':
|
|
46
|
+
index = 0;
|
|
47
|
+
break;
|
|
48
|
+
case 'End':
|
|
49
|
+
index = last;
|
|
50
|
+
break;
|
|
51
|
+
case 'ArrowDown':
|
|
52
|
+
case 'ArrowUp': {
|
|
53
|
+
const step = key === 'ArrowDown' ? 1 : -1;
|
|
54
|
+
// Skip the series without points.
|
|
55
|
+
for (let s = from.series + step; s >= 0 && s < series.length; s += step) {
|
|
56
|
+
const target = nearest(series[s], points[from.index]);
|
|
57
|
+
if (target >= 0)
|
|
58
|
+
return { series: s, index: target };
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
default:
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
index = Math.max(0, Math.min(last, index));
|
|
66
|
+
return index === from.index ? null : { series: from.series, index };
|
|
67
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Two decimals are below the precision of a screen, and they keep the markup short. */
|
|
2
|
+
export declare function round(value: number): number;
|
|
3
|
+
type Position = readonly [number, number];
|
|
4
|
+
/**
|
|
5
|
+
* The `d` attribute of a polyline through the points. The line breaks before each index in
|
|
6
|
+
* `breaks`, and around a point with a value that is not finite.
|
|
7
|
+
*/
|
|
8
|
+
export declare function linePath(points: ReadonlyArray<Position>, breaks?: ReadonlyArray<number>): string;
|
|
9
|
+
/**
|
|
10
|
+
* The `d` attribute of a filled area between two lines with the same x positions: along `top`,
|
|
11
|
+
* back along `bottom`, and closed. Each part between two `breaks` is a closed area of its own.
|
|
12
|
+
*/
|
|
13
|
+
export declare function areaPath(top: ReadonlyArray<Position>, bottom: ReadonlyArray<Position>, breaks?: ReadonlyArray<number>): string;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Two decimals are below the precision of a screen, and they keep the markup short. */
|
|
2
|
+
export function round(value) {
|
|
3
|
+
return Math.round(value * 100) / 100;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The `d` attribute of a polyline through the points. The line breaks before each index in
|
|
7
|
+
* `breaks`, and around a point with a value that is not finite.
|
|
8
|
+
*/
|
|
9
|
+
export function linePath(points, breaks = []) {
|
|
10
|
+
let d = '';
|
|
11
|
+
let open = false;
|
|
12
|
+
points.forEach(([x, y], i) => {
|
|
13
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) {
|
|
14
|
+
open = false;
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
d += `${open && !breaks.includes(i) ? 'L' : 'M'}${round(x)},${round(y)}`;
|
|
18
|
+
open = true;
|
|
19
|
+
});
|
|
20
|
+
return d;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The `d` attribute of a filled area between two lines with the same x positions: along `top`,
|
|
24
|
+
* back along `bottom`, and closed. Each part between two `breaks` is a closed area of its own.
|
|
25
|
+
*/
|
|
26
|
+
export function areaPath(top, bottom, breaks = []) {
|
|
27
|
+
let d = '';
|
|
28
|
+
[0, ...breaks].forEach((start, part, starts) => {
|
|
29
|
+
const end = starts[part + 1] ?? top.length;
|
|
30
|
+
if (end <= start)
|
|
31
|
+
return;
|
|
32
|
+
const back = bottom.slice(start, end).reverse();
|
|
33
|
+
d += `${linePath(top.slice(start, end))}L${linePath(back).slice(1)}Z`;
|
|
34
|
+
});
|
|
35
|
+
return d;
|
|
36
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ChartSeries, ChartValue } from '../root/context.js';
|
|
2
|
+
import { type Channel } from './channel.js';
|
|
3
|
+
/**
|
|
4
|
+
* Whether a value can have a position: a category, a valid date, or a finite number. `null`,
|
|
5
|
+
* `undefined` and other types have no position: they are not zero.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isValue(value: unknown): value is ChartValue;
|
|
8
|
+
/**
|
|
9
|
+
* The rows as series of points, in the order of their first appearance. A row without a valid x
|
|
10
|
+
* or y value has no point: it is a gap in a line, and it takes no focus. Without a series channel,
|
|
11
|
+
* all of the rows are one series with the name `fallback`.
|
|
12
|
+
*
|
|
13
|
+
* The `key` channel identifies a point across updates. Without it, the key is the row index. When
|
|
14
|
+
* two points of a series have the same key, the points of that series use their row index as the
|
|
15
|
+
* key.
|
|
16
|
+
*/
|
|
17
|
+
export declare function groupRows<T>(rows: readonly T[], x: Channel<T, ChartValue> | undefined, y: Channel<T, ChartValue> | undefined, series: Channel<T, string> | undefined, fallback?: string, key?: Channel<T, ChartValue>): ChartSeries<T>[];
|
|
18
|
+
/** A key of a value for a stack: the same category, date or number gives the same key. */
|
|
19
|
+
export declare function stackKey(value: ChartValue): string | number;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { read } from './channel.js';
|
|
2
|
+
import { dev } from '../../internal/environment.js';
|
|
3
|
+
/**
|
|
4
|
+
* Whether a value can have a position: a category, a valid date, or a finite number. `null`,
|
|
5
|
+
* `undefined` and other types have no position: they are not zero.
|
|
6
|
+
*/
|
|
7
|
+
export function isValue(value) {
|
|
8
|
+
if (typeof value === 'string')
|
|
9
|
+
return true;
|
|
10
|
+
return (typeof value === 'number' || value instanceof Date) && Number.isFinite(+value);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The rows as series of points, in the order of their first appearance. A row without a valid x
|
|
14
|
+
* or y value has no point: it is a gap in a line, and it takes no focus. Without a series channel,
|
|
15
|
+
* all of the rows are one series with the name `fallback`.
|
|
16
|
+
*
|
|
17
|
+
* The `key` channel identifies a point across updates. Without it, the key is the row index. When
|
|
18
|
+
* two points of a series have the same key, the points of that series use their row index as the
|
|
19
|
+
* key.
|
|
20
|
+
*/
|
|
21
|
+
export function groupRows(rows, x, y, series, fallback = '', key) {
|
|
22
|
+
const out = new Map();
|
|
23
|
+
// The series that have a row without a value after their last point.
|
|
24
|
+
const open = new Set();
|
|
25
|
+
if (!x || !y)
|
|
26
|
+
return [];
|
|
27
|
+
rows.forEach((datum, index) => {
|
|
28
|
+
const name = series ? String(read(series, datum, index) ?? '') : fallback;
|
|
29
|
+
const [xv, yv] = [read(x, datum, index), read(y, datum, index)];
|
|
30
|
+
let group = out.get(name);
|
|
31
|
+
if (!isValue(xv) || !isValue(yv)) {
|
|
32
|
+
if (group?.points.length)
|
|
33
|
+
open.add(name);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const point = {
|
|
37
|
+
datum,
|
|
38
|
+
index,
|
|
39
|
+
key: key ? read(key, datum, index)?.valueOf() : index,
|
|
40
|
+
series: name,
|
|
41
|
+
x: xv,
|
|
42
|
+
y: yv
|
|
43
|
+
};
|
|
44
|
+
if (!group)
|
|
45
|
+
out.set(name, (group = { name, points: [], breaks: [] }));
|
|
46
|
+
if (open.delete(name))
|
|
47
|
+
group.breaks.push(group.points.length);
|
|
48
|
+
group.points.push(point);
|
|
49
|
+
});
|
|
50
|
+
for (const group of out.values()) {
|
|
51
|
+
if (new Set(group.points.map((p) => p.key)).size < group.points.length) {
|
|
52
|
+
if (dev) {
|
|
53
|
+
console.warn(`Chart: two points of the series "${group.name}" have the same key. The chart uses the row index as the key of this series. Give a \`key\` channel with a value that is unique in each series.`);
|
|
54
|
+
}
|
|
55
|
+
for (const p of group.points)
|
|
56
|
+
p.key = p.index;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return [...out.values()];
|
|
60
|
+
}
|
|
61
|
+
/** A key of a value for a stack: the same category, date or number gives the same key. */
|
|
62
|
+
export function stackKey(value) {
|
|
63
|
+
return typeof value === 'string' ? value : +value;
|
|
64
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Puts the series one on the other. Each point has a `key` (the x value) and a `y` value. The
|
|
3
|
+
* function returns the bottom and the top of each point, in the order of the input. Positive
|
|
4
|
+
* values go up from zero and negative values go down from zero, each on their own stack.
|
|
5
|
+
*
|
|
6
|
+
* The order of the series in a stack follows the keyboard: `ArrowDown` goes to the next series,
|
|
7
|
+
* and on a vertical stack the next series is below on the screen. Thus with `vertical`, the first
|
|
8
|
+
* series is on the top of the positive stack and next to zero on the negative stack. Without it,
|
|
9
|
+
* the next series is on the right: the first series is next to zero on the positive stack.
|
|
10
|
+
*/
|
|
11
|
+
export declare function stack(series: ReadonlyArray<ReadonlyArray<{
|
|
12
|
+
key: string | number;
|
|
13
|
+
y: number;
|
|
14
|
+
}>>, vertical: boolean): [number, number][][];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Puts the series one on the other. Each point has a `key` (the x value) and a `y` value. The
|
|
3
|
+
* function returns the bottom and the top of each point, in the order of the input. Positive
|
|
4
|
+
* values go up from zero and negative values go down from zero, each on their own stack.
|
|
5
|
+
*
|
|
6
|
+
* The order of the series in a stack follows the keyboard: `ArrowDown` goes to the next series,
|
|
7
|
+
* and on a vertical stack the next series is below on the screen. Thus with `vertical`, the first
|
|
8
|
+
* series is on the top of the positive stack and next to zero on the negative stack. Without it,
|
|
9
|
+
* the next series is on the right: the first series is next to zero on the positive stack.
|
|
10
|
+
*/
|
|
11
|
+
export function stack(series, vertical) {
|
|
12
|
+
const out = series.map(() => []);
|
|
13
|
+
for (const positive of [true, false]) {
|
|
14
|
+
const sums = new Map();
|
|
15
|
+
const order = series.map((_, s) => s);
|
|
16
|
+
if (positive === vertical)
|
|
17
|
+
order.reverse();
|
|
18
|
+
for (const s of order) {
|
|
19
|
+
series[s].forEach(({ key, y }, i) => {
|
|
20
|
+
if (y < 0 === positive)
|
|
21
|
+
return;
|
|
22
|
+
const base = sums.get(key) ?? 0;
|
|
23
|
+
sums.set(key, base + y);
|
|
24
|
+
out[s][i] = [base, base + y];
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The shapes of a dot, in the order that `symbol="auto"` gives them to the series. */
|
|
2
|
+
export declare const SYMBOLS: readonly ["circle", "square", "triangle", "diamond", "cross", "triangle-down"];
|
|
3
|
+
export type ChartSymbol = (typeof SYMBOLS)[number];
|
|
4
|
+
/**
|
|
5
|
+
* The `d` attribute of a shape with its center at 0,0. All of the shapes with the same `area`
|
|
6
|
+
* have the same area, thus no series looks larger than the others.
|
|
7
|
+
*/
|
|
8
|
+
export declare function symbolPath(symbol: ChartSymbol, area: number): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { round } from './path.js';
|
|
2
|
+
/** The shapes of a dot, in the order that `symbol="auto"` gives them to the series. */
|
|
3
|
+
export const SYMBOLS = [
|
|
4
|
+
'circle',
|
|
5
|
+
'square',
|
|
6
|
+
'triangle',
|
|
7
|
+
'diamond',
|
|
8
|
+
'cross',
|
|
9
|
+
'triangle-down'
|
|
10
|
+
];
|
|
11
|
+
const T = Math.sqrt(4 / Math.sqrt(3)); // The side of an equilateral triangle with an area of 1.
|
|
12
|
+
const H = (T * Math.sqrt(3)) / 2; // Its height.
|
|
13
|
+
const D = Math.SQRT1_2; // Half the diagonal of a square with an area of 1.
|
|
14
|
+
const C = Math.sqrt(0.05); // Half the width of an arm of a cross with an area of 1.
|
|
15
|
+
/** The corners of each polygon, with an area of 1 and the center at 0,0. */
|
|
16
|
+
const POLYGONS = {
|
|
17
|
+
square: [-0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5],
|
|
18
|
+
triangle: [0, (-2 * H) / 3, T / 2, H / 3, -T / 2, H / 3],
|
|
19
|
+
diamond: [0, -D, D, 0, 0, D, -D, 0],
|
|
20
|
+
// prettier-ignore
|
|
21
|
+
cross: [-C, -3 * C, C, -3 * C, C, -C, 3 * C, -C, 3 * C, C, C, C, C, 3 * C, -C, 3 * C, -C, C, -3 * C, C, -3 * C, -C, -C, -C],
|
|
22
|
+
'triangle-down': [0, (2 * H) / 3, -T / 2, -H / 3, T / 2, -H / 3]
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The `d` attribute of a shape with its center at 0,0. All of the shapes with the same `area`
|
|
26
|
+
* have the same area, thus no series looks larger than the others.
|
|
27
|
+
*/
|
|
28
|
+
export function symbolPath(symbol, area) {
|
|
29
|
+
if (symbol === 'circle') {
|
|
30
|
+
const r = round(Math.sqrt(area / Math.PI));
|
|
31
|
+
return `M${r},0A${r},${r} 0 1 1 ${-r},0A${r},${r} 0 1 1 ${r},0Z`;
|
|
32
|
+
}
|
|
33
|
+
const scale = Math.sqrt(area);
|
|
34
|
+
const corners = POLYGONS[symbol].map((value) => round(value * scale));
|
|
35
|
+
let d = '';
|
|
36
|
+
for (let i = 0; i < corners.length; i += 2)
|
|
37
|
+
d += `${i ? 'L' : 'M'}${corners[i]},${corners[i + 1]}`;
|
|
38
|
+
return d + 'Z';
|
|
39
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ChartSymbol } from '../internal/symbol.js';
|
|
3
|
+
import { useChartContext } from '../root/context.js';
|
|
4
|
+
import type { ChartLegendProps } from '../types.js';
|
|
5
|
+
|
|
6
|
+
let { children, class: className = '', ...restProps }: ChartLegendProps = $props();
|
|
7
|
+
|
|
8
|
+
const ctx = useChartContext('Chart.Legend');
|
|
9
|
+
// The names in the order of the marks, without duplicates, with the shape of the first mark that
|
|
10
|
+
// gives the series one. One series without a name has nothing to show. A mark of parts of a
|
|
11
|
+
// whole gives its categories, in the order of its parts.
|
|
12
|
+
const items = $derived.by(() => {
|
|
13
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity -- a scratch map for one pass.
|
|
14
|
+
const out = new Map<string, { name: ChartSymbol; d: string } | undefined>();
|
|
15
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity -- a scratch set for one pass.
|
|
16
|
+
const categories = new Set<string>();
|
|
17
|
+
for (const mark of ctx.marks) {
|
|
18
|
+
mark.read().forEach((s, i) => {
|
|
19
|
+
if (mark.share) for (const p of s.points) categories.add(String(p.x));
|
|
20
|
+
else if (s.name) out.set(s.name, out.get(s.name) ?? mark.symbol?.(i));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return [...out, ...[...categories].map((name) => [name, undefined, true] as const)];
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<!-- The names of the points also give the series, thus the legend is decoration. -->
|
|
28
|
+
{#if items.length}
|
|
29
|
+
<ul class={className} aria-hidden="true" data-legend="" {...restProps}>
|
|
30
|
+
{#each items as [name, shape, category], index (name)}
|
|
31
|
+
<li
|
|
32
|
+
data-series={category ? undefined : name}
|
|
33
|
+
data-category={category ? name : undefined}
|
|
34
|
+
data-symbol={shape?.name}
|
|
35
|
+
data-legend-item=""
|
|
36
|
+
>
|
|
37
|
+
{#if children}
|
|
38
|
+
{@render children({ name, index, symbol: shape?.name })}
|
|
39
|
+
{:else}
|
|
40
|
+
<span data-swatch="">
|
|
41
|
+
{#if shape}<svg width="12" height="12" viewBox="-6 -6 12 12"
|
|
42
|
+
><path d={shape.d} fill="currentColor" /></svg
|
|
43
|
+
>{/if}
|
|
44
|
+
</span>
|
|
45
|
+
{name}
|
|
46
|
+
{/if}
|
|
47
|
+
</li>
|
|
48
|
+
{/each}
|
|
49
|
+
</ul>
|
|
50
|
+
{/if}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import { untrack } from 'svelte';
|
|
3
|
+
import type { Channel } from '../internal/channel.js';
|
|
4
|
+
import { linePath, round } from '../internal/path.js';
|
|
5
|
+
import { groupRows } from '../internal/series.js';
|
|
6
|
+
import {
|
|
7
|
+
useChartContext,
|
|
8
|
+
type ChartPoint,
|
|
9
|
+
type ChartSeries,
|
|
10
|
+
type ChartValue
|
|
11
|
+
} from '../root/context.js';
|
|
12
|
+
import type { ChartLineProps } from '../types.js';
|
|
13
|
+
|
|
14
|
+
let { data, x, y, series, key, name, r = 3, class: className = '' }: ChartLineProps<T> = $props();
|
|
15
|
+
|
|
16
|
+
const ctx = useChartContext('Chart.Line');
|
|
17
|
+
|
|
18
|
+
const groups = $derived(
|
|
19
|
+
groupRows(
|
|
20
|
+
(data ?? ctx.data) as readonly T[],
|
|
21
|
+
(x ?? ctx.x) as Channel<T, ChartValue> | undefined,
|
|
22
|
+
(y ?? ctx.y) as Channel<T, ChartValue> | undefined,
|
|
23
|
+
(series ?? ctx.series) as Channel<T, string> | undefined,
|
|
24
|
+
name,
|
|
25
|
+
(key ?? ctx.key) as Channel<T, ChartValue> | undefined
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
/** The position of a point in the plot. */
|
|
30
|
+
const at = (p: ChartPoint<T>): [number, number] => [
|
|
31
|
+
ctx.xScale(ctx.toX(p.x)),
|
|
32
|
+
ctx.yScale(ctx.toY(p.y))
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
// A mark with data or channels of its own adds its values to the domains.
|
|
36
|
+
const own = untrack(() => data !== undefined || x !== undefined || y !== undefined);
|
|
37
|
+
const registration = ctx.register({
|
|
38
|
+
read: () => groups as ChartSeries[],
|
|
39
|
+
extent: own
|
|
40
|
+
? () => ({
|
|
41
|
+
x: groups.flatMap((s) => s.points.map((p) => p.x)),
|
|
42
|
+
y: groups.flatMap((s) => s.points.map((p) => p.y))
|
|
43
|
+
})
|
|
44
|
+
: undefined,
|
|
45
|
+
anchor: (si, i) => at(groups[si].points[i])
|
|
46
|
+
});
|
|
47
|
+
$effect(() => registration.unregister);
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<g class={className} data-mark="line">
|
|
51
|
+
{#each groups as s, si (s.name)}
|
|
52
|
+
<g role="group" aria-label={s.name || undefined} data-series={s.name || undefined}>
|
|
53
|
+
<path
|
|
54
|
+
d={linePath(s.points.map(at), s.breaks)}
|
|
55
|
+
fill="none"
|
|
56
|
+
stroke="currentColor"
|
|
57
|
+
aria-hidden="true"
|
|
58
|
+
data-line=""
|
|
59
|
+
/>
|
|
60
|
+
{#each s.points as p, i (p.key)}
|
|
61
|
+
<circle
|
|
62
|
+
cx={round(at(p)[0])}
|
|
63
|
+
cy={round(at(p)[1])}
|
|
64
|
+
{r}
|
|
65
|
+
fill="currentColor"
|
|
66
|
+
data-point=""
|
|
67
|
+
{...ctx.point(registration.id, si, i, p as ChartPoint)}
|
|
68
|
+
/>
|
|
69
|
+
{/each}
|
|
70
|
+
</g>
|
|
71
|
+
{/each}
|
|
72
|
+
</g>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ChartLineProps } from '../types.js';
|
|
2
|
+
declare function $$render<T>(): {
|
|
3
|
+
props: ChartLineProps<T>;
|
|
4
|
+
exports: {};
|
|
5
|
+
bindings: "";
|
|
6
|
+
slots: {};
|
|
7
|
+
events: {};
|
|
8
|
+
};
|
|
9
|
+
declare class __sveltets_Render<T> {
|
|
10
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
11
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
12
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
13
|
+
bindings(): "";
|
|
14
|
+
exports(): {};
|
|
15
|
+
}
|
|
16
|
+
interface $$IsomorphicComponent {
|
|
17
|
+
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
18
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
19
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
20
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
21
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
22
|
+
}
|
|
23
|
+
declare const ChartLine: $$IsomorphicComponent;
|
|
24
|
+
type ChartLine<T> = InstanceType<typeof ChartLine<T>>;
|
|
25
|
+
export default ChartLine;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useChartContext } from '../root/context.js';
|
|
3
|
+
import type { ChartPlotProps } from '../types.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
children,
|
|
7
|
+
class: className = '',
|
|
8
|
+
element = $bindable<SVGSVGElement | null>(null),
|
|
9
|
+
...restProps
|
|
10
|
+
}: ChartPlotProps = $props();
|
|
11
|
+
|
|
12
|
+
const ctx = useChartContext('Chart.Plot');
|
|
13
|
+
$effect(() => {
|
|
14
|
+
ctx.plotElement = element;
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<!--
|
|
19
|
+
The handlers act on the focused point: the points are the interactive elements.
|
|
20
|
+
`application` makes a screen reader go into focus mode on a point, thus the arrow keys come to
|
|
21
|
+
the chart. With `group`, a screen reader in browse mode keeps the arrow keys for itself.
|
|
22
|
+
Before the first measure, the SVG fills its container: on a narrow screen, the default width
|
|
23
|
+
must not make the page wider.
|
|
24
|
+
-->
|
|
25
|
+
<svg
|
|
26
|
+
bind:this={element}
|
|
27
|
+
class={className}
|
|
28
|
+
width={ctx.fluid ? '100%' : ctx.width}
|
|
29
|
+
height={ctx.height}
|
|
30
|
+
viewBox="0 0 {ctx.width} {ctx.height}"
|
|
31
|
+
role="application"
|
|
32
|
+
aria-roledescription="chart"
|
|
33
|
+
{...ctx.labels}
|
|
34
|
+
data-plot=""
|
|
35
|
+
{...restProps}
|
|
36
|
+
{...ctx.plotHandlers}
|
|
37
|
+
>
|
|
38
|
+
{@render children?.()}
|
|
39
|
+
</svg>
|