@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,226 @@
|
|
|
1
|
+
import type { Channel } from '../internal/channel.js';
|
|
2
|
+
import type { ChartSymbol } from '../internal/symbol.js';
|
|
3
|
+
import type { Scale } from '../scales/types.js';
|
|
4
|
+
/** A value of a channel: a number, a date, or a category of a band scale. */
|
|
5
|
+
export type ChartValue = number | Date | string;
|
|
6
|
+
/** One point of the chart, as the focus state and `onSelect` give it. */
|
|
7
|
+
export type ChartPoint<T = unknown> = {
|
|
8
|
+
/** The row of the data. */
|
|
9
|
+
datum: T;
|
|
10
|
+
/** The index of the row in the data of its mark. */
|
|
11
|
+
index: number;
|
|
12
|
+
/**
|
|
13
|
+
* The value that identifies the point in its series across updates, from the `key` channel. A
|
|
14
|
+
* date is its time.
|
|
15
|
+
*/
|
|
16
|
+
key: string | number;
|
|
17
|
+
/** The name of the series. It is empty when the chart has one series. */
|
|
18
|
+
series: string;
|
|
19
|
+
/** The value of the x channel. */
|
|
20
|
+
x: ChartValue;
|
|
21
|
+
/** The value of the y channel. */
|
|
22
|
+
y: ChartValue;
|
|
23
|
+
};
|
|
24
|
+
/** The values that a mark adds to the domains of the scales. */
|
|
25
|
+
export type ChartExtent = {
|
|
26
|
+
x?: ChartValue[];
|
|
27
|
+
y?: ChartValue[];
|
|
28
|
+
};
|
|
29
|
+
/** The state of the tooltip. */
|
|
30
|
+
export type ChartTooltipState<T = unknown> = {
|
|
31
|
+
point: ChartPoint<T>;
|
|
32
|
+
/** The position of the point in the plot, in pixels. */
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
/** The x value as text. */
|
|
36
|
+
xText: string;
|
|
37
|
+
/** The y value as text. */
|
|
38
|
+
yText: string;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the categories of the mark are on the y axis, as in a horizontal bar chart. Then
|
|
41
|
+
* `yText` names the category and `xText` is the value.
|
|
42
|
+
*/
|
|
43
|
+
horizontal: boolean;
|
|
44
|
+
};
|
|
45
|
+
/** The points of one series of a mark. */
|
|
46
|
+
export type ChartSeries<T = unknown> = {
|
|
47
|
+
name: string;
|
|
48
|
+
points: ChartPoint<T>[];
|
|
49
|
+
/** The indexes in `points` that come after a row without a valid value: a line breaks there. */
|
|
50
|
+
breaks: number[];
|
|
51
|
+
};
|
|
52
|
+
/** A mark, as it registers with the root. */
|
|
53
|
+
export type ChartMark = {
|
|
54
|
+
/** The series of the mark. */
|
|
55
|
+
read: () => ChartSeries[];
|
|
56
|
+
/**
|
|
57
|
+
* The values that the domains must include in addition to the data of the root: the data of a
|
|
58
|
+
* mark with data or channels of its own, or the tops of a stack.
|
|
59
|
+
*/
|
|
60
|
+
extent?: () => ChartExtent;
|
|
61
|
+
/** The position in pixels where the tooltip of a point points. */
|
|
62
|
+
anchor: (series: number, index: number) => [number, number];
|
|
63
|
+
/**
|
|
64
|
+
* The squared distance in pixels from a position on the plot to the shape of a point, for a
|
|
65
|
+
* mark with points that have an area. Without it, the distance goes to the anchor.
|
|
66
|
+
*/
|
|
67
|
+
distance?: (series: number, index: number, x: number, y: number) => number;
|
|
68
|
+
/**
|
|
69
|
+
* Whether the categories of the mark are on the y axis. Then the vertical arrows move in a
|
|
70
|
+
* series, and a name and a table row start with the y value.
|
|
71
|
+
*/
|
|
72
|
+
horizontal?: () => boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Whether the mark shows each point on its own, as the dot mark does. Then a name starts with the
|
|
75
|
+
* series, and the data table has one row per point.
|
|
76
|
+
*/
|
|
77
|
+
list?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* The shape of the dots of a series, for the legend: its name, and the `d` attribute of a path
|
|
80
|
+
* with its center at 0,0 that fits in 12 pixels.
|
|
81
|
+
*/
|
|
82
|
+
symbol?: (series: number) => {
|
|
83
|
+
name: ChartSymbol;
|
|
84
|
+
d: string;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* The share of a point in the total of its series, as text, for a mark that shows parts of a
|
|
88
|
+
* whole, as the arc mark does. It is empty when the total is 0. Then the names and the data
|
|
89
|
+
* table add the share, the legend lists the x values, and all of the arrows move in the series.
|
|
90
|
+
*/
|
|
91
|
+
share?: (point: ChartPoint) => string;
|
|
92
|
+
};
|
|
93
|
+
/** One series of a mark with points, in the order of the keyboard. */
|
|
94
|
+
export type ChartEntry = {
|
|
95
|
+
mark: string;
|
|
96
|
+
series: number;
|
|
97
|
+
points: ChartPoint[];
|
|
98
|
+
horizontal: boolean;
|
|
99
|
+
/** Whether the mark shows parts of a whole: all of the arrows move in the series. */
|
|
100
|
+
share: boolean;
|
|
101
|
+
};
|
|
102
|
+
/** A tick of an axis. */
|
|
103
|
+
export type ChartTick = {
|
|
104
|
+
/** The value, as a number. A date is its time in milliseconds. */
|
|
105
|
+
value: number;
|
|
106
|
+
/** The position on the axis, in pixels. */
|
|
107
|
+
position: number;
|
|
108
|
+
/** The text of the label. */
|
|
109
|
+
label: string;
|
|
110
|
+
};
|
|
111
|
+
/** The space around the plot, in pixels. */
|
|
112
|
+
export type ChartMargin = {
|
|
113
|
+
top: number;
|
|
114
|
+
right: number;
|
|
115
|
+
bottom: number;
|
|
116
|
+
left: number;
|
|
117
|
+
};
|
|
118
|
+
/** The attributes of the element of a point. A mark spreads them on the element. */
|
|
119
|
+
export type PointAttributes = {
|
|
120
|
+
id: string;
|
|
121
|
+
role: 'img';
|
|
122
|
+
tabindex: 0 | -1;
|
|
123
|
+
'aria-label': string;
|
|
124
|
+
'aria-current': 'true' | undefined;
|
|
125
|
+
'data-focused': 'true' | undefined;
|
|
126
|
+
'data-focus-visible': 'true' | undefined;
|
|
127
|
+
'data-selected': 'true' | undefined;
|
|
128
|
+
};
|
|
129
|
+
export type ChartContext = {
|
|
130
|
+
/** The instance id. Every id of the parts is made from it. */
|
|
131
|
+
readonly instanceId: string;
|
|
132
|
+
readonly data: readonly any[];
|
|
133
|
+
readonly x: Channel<any, ChartValue> | undefined;
|
|
134
|
+
readonly y: Channel<any, ChartValue> | undefined;
|
|
135
|
+
readonly series: Channel<any, string> | undefined;
|
|
136
|
+
readonly key: Channel<any, ChartValue> | undefined;
|
|
137
|
+
/** The name of the x channel for a user, for example "Weight (lb)", or `undefined`. */
|
|
138
|
+
readonly xLabel: string | undefined;
|
|
139
|
+
/** The name of the y channel for a user, or `undefined`. */
|
|
140
|
+
readonly yLabel: string | undefined;
|
|
141
|
+
/** The locale of the values in names, ticks, the tooltip and the data table. */
|
|
142
|
+
readonly locale: string | undefined;
|
|
143
|
+
/** The size of the SVG, in pixels. */
|
|
144
|
+
readonly width: number;
|
|
145
|
+
/**
|
|
146
|
+
* Whether the width is not known yet: there is no `width` prop and no measure. On the server and
|
|
147
|
+
* before the first measure, the SVG fills its container and scales the default width.
|
|
148
|
+
*/
|
|
149
|
+
readonly fluid: boolean;
|
|
150
|
+
readonly height: number;
|
|
151
|
+
readonly margin: ChartMargin;
|
|
152
|
+
readonly xScale: Scale;
|
|
153
|
+
readonly yScale: Scale;
|
|
154
|
+
/** The ticks of each axis. `Chart.Axis` and `Chart.Grid` share them. */
|
|
155
|
+
readonly xTicks: ChartTick[];
|
|
156
|
+
readonly yTicks: ChartTick[];
|
|
157
|
+
/**
|
|
158
|
+
* Asks for space around the plot, for the labels of an axis. The margin of a side is the
|
|
159
|
+
* largest space that a part asks for, unless the consumer gives the margin.
|
|
160
|
+
*/
|
|
161
|
+
reserve(needs: Partial<ChartMargin>): {
|
|
162
|
+
update(needs: Partial<ChartMargin>): void;
|
|
163
|
+
unregister(): void;
|
|
164
|
+
};
|
|
165
|
+
/** The id of the `Chart.Title` element, when one is in the DOM. */
|
|
166
|
+
titleId: string | null;
|
|
167
|
+
/** An x value as a number for the x scale: a date is its time, and a category is its index. */
|
|
168
|
+
toX(value: ChartValue): number;
|
|
169
|
+
/** A y value as a number for the y scale. */
|
|
170
|
+
toY(value: ChartValue): number;
|
|
171
|
+
/** Adds a mark. The root reads its functions again each time the data changes. */
|
|
172
|
+
register(mark: ChartMark): {
|
|
173
|
+
id: string;
|
|
174
|
+
unregister(): void;
|
|
175
|
+
};
|
|
176
|
+
/** The marks, in mount order. A part reads their series, for example a legend. */
|
|
177
|
+
readonly marks: ReadonlyArray<ChartMark>;
|
|
178
|
+
/** The series of all of the marks with points, in the order of the keyboard. */
|
|
179
|
+
readonly entries: ReadonlyArray<ChartEntry>;
|
|
180
|
+
/** The id of the element of a point. */
|
|
181
|
+
pointId(mark: string, series: number, index: number): string;
|
|
182
|
+
/** The point with the id, or `null`. */
|
|
183
|
+
pointAt(id: string | null): ChartPoint | null;
|
|
184
|
+
/** The entry and the index of the point with the id, or `null`. */
|
|
185
|
+
locate(id: string | null): {
|
|
186
|
+
entry: ChartEntry;
|
|
187
|
+
index: number;
|
|
188
|
+
} | null;
|
|
189
|
+
/** The position in pixels where the tooltip of a point points, from its mark. */
|
|
190
|
+
anchor(mark: string, series: number, index: number): [number, number] | null;
|
|
191
|
+
/** The id of the point nearest to a position on the screen, within 40 pixels, or `null`. */
|
|
192
|
+
nearest(clientX: number, clientY: number): string | null;
|
|
193
|
+
/** An x value (as a number for the x scale) as text, in the format of the chart. */
|
|
194
|
+
formatX(value: number): string;
|
|
195
|
+
/** A y value (as a number for the y scale) as text, in the format of the chart. */
|
|
196
|
+
formatY(value: number): string;
|
|
197
|
+
/** The point that has the focus, and whether it shows the focus ring. */
|
|
198
|
+
readonly focus: {
|
|
199
|
+
id: string | null;
|
|
200
|
+
visible: boolean;
|
|
201
|
+
};
|
|
202
|
+
/** Whether the point is the selected point. */
|
|
203
|
+
isSelected(point: ChartPoint): boolean;
|
|
204
|
+
/** The SVG element of `Chart.Plot`. */
|
|
205
|
+
plotElement: SVGSVGElement | null;
|
|
206
|
+
/** The attributes of the element of a point. */
|
|
207
|
+
point(mark: string, series: number, index: number, point: ChartPoint): PointAttributes;
|
|
208
|
+
/** The accessible name and description of the chart, for the `Chart.Plot` element. */
|
|
209
|
+
readonly labels: {
|
|
210
|
+
'aria-label': string | undefined;
|
|
211
|
+
'aria-labelledby': string | undefined;
|
|
212
|
+
'aria-describedby': string | undefined;
|
|
213
|
+
};
|
|
214
|
+
/** The handlers of the `Chart.Plot` element. */
|
|
215
|
+
readonly plotHandlers: {
|
|
216
|
+
onkeydown(event: KeyboardEvent): void;
|
|
217
|
+
onfocusin(event: FocusEvent): void;
|
|
218
|
+
onfocusout(event: FocusEvent): void;
|
|
219
|
+
onclick(event: MouseEvent): void;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
export declare function setChartContext(context: ChartContext): void;
|
|
223
|
+
/** The context of the closest `Chart.Root`, or `undefined` outside one. */
|
|
224
|
+
export declare function getChartContext(): ChartContext | undefined;
|
|
225
|
+
/** The context of the closest `Chart.Root`. It throws outside one. */
|
|
226
|
+
export declare function useChartContext(part: string): ChartContext;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
3
|
+
const KEY = Symbol('human-kit-chart');
|
|
4
|
+
export function setChartContext(context) {
|
|
5
|
+
setContext(KEY, context);
|
|
6
|
+
}
|
|
7
|
+
/** The context of the closest `Chart.Root`, or `undefined` outside one. */
|
|
8
|
+
export function getChartContext() {
|
|
9
|
+
return getContext(KEY);
|
|
10
|
+
}
|
|
11
|
+
/** The context of the closest `Chart.Root`. It throws outside one. */
|
|
12
|
+
export function useChartContext(part) {
|
|
13
|
+
const context = getChartContext();
|
|
14
|
+
if (!context)
|
|
15
|
+
throw new Error(`${part} must be inside Chart.Root.`);
|
|
16
|
+
return context;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Scale, ScaleSettings } from './types.js';
|
|
2
|
+
/** A scale that divides the range into one band per category. */
|
|
3
|
+
export type BandScale = Scale & {
|
|
4
|
+
readonly kind: 'band';
|
|
5
|
+
/** The distance from the start of a band to the start of the next band, in pixels. */
|
|
6
|
+
readonly step: number;
|
|
7
|
+
readonly categories: readonly string[];
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Makes a band scale. The values are the indexes of `settings.categories`; the domain is not
|
|
11
|
+
* used. `settings.padding` is the space between two bands, and half of it is at each end. The
|
|
12
|
+
* default is 0.2.
|
|
13
|
+
*/
|
|
14
|
+
export declare function scaleBand(_domain: readonly [number, number], range: readonly [number, number], settings?: ScaleSettings): BandScale;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Makes a band scale. The values are the indexes of `settings.categories`; the domain is not
|
|
3
|
+
* used. `settings.padding` is the space between two bands, and half of it is at each end. The
|
|
4
|
+
* default is 0.2.
|
|
5
|
+
*/
|
|
6
|
+
export function scaleBand(_domain, range, settings = { categories: [] }) {
|
|
7
|
+
const { categories, padding = 0.2 } = settings;
|
|
8
|
+
const n = categories.length;
|
|
9
|
+
const [r0, r1] = range;
|
|
10
|
+
// A step holds a band and one padding: n bands, n - 1 paddings between, and half at each end.
|
|
11
|
+
const step = (r1 - r0) / Math.max(1, n);
|
|
12
|
+
const bandwidth = Math.abs(step) * (1 - padding);
|
|
13
|
+
const scale = (index) => r0 + step * (index + 0.5);
|
|
14
|
+
const name = (index) => categories[index] ?? '';
|
|
15
|
+
const indexes = categories.map((_, i) => i);
|
|
16
|
+
return Object.assign(scale, {
|
|
17
|
+
kind: 'band',
|
|
18
|
+
domain: [0, Math.max(0, n - 1)],
|
|
19
|
+
range,
|
|
20
|
+
bandwidth,
|
|
21
|
+
step: Math.abs(step),
|
|
22
|
+
categories,
|
|
23
|
+
invert: (position) => Math.max(0, Math.min(n - 1, Math.floor((position - r0) / step))),
|
|
24
|
+
// Each category is a tick. An axis with more categories than room shows every k-th one.
|
|
25
|
+
ticks: (count = n) => indexes.filter((i) => i % Math.max(1, Math.ceil(n / count)) === 0),
|
|
26
|
+
tickFormat: () => name,
|
|
27
|
+
valueFormat: () => name,
|
|
28
|
+
nice: () => [0, Math.max(0, n - 1)]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Scale } from './types.js';
|
|
2
|
+
/** A scale that maps numbers to positions in proportion. */
|
|
3
|
+
export type LinearScale = Scale & {
|
|
4
|
+
readonly kind: 'linear';
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* The distance between two ticks: 1, 2 or 5 times a power of ten, so that about `count` ticks
|
|
8
|
+
* cover the span.
|
|
9
|
+
*/
|
|
10
|
+
export declare function tickStep(start: number, stop: number, count: number): number;
|
|
11
|
+
/** Round values from `start` to `stop`, about `count` of them. */
|
|
12
|
+
export declare function ticks(start: number, stop: number, count?: number): number[];
|
|
13
|
+
/** Extends the domain to round values, so that the first and the last tick are at the ends. */
|
|
14
|
+
export declare function nice(domain: readonly [number, number], count?: number): [number, number];
|
|
15
|
+
/** Makes a linear scale from `domain` to `range`. */
|
|
16
|
+
export declare function scaleLinear(domain: readonly [number, number], range: readonly [number, number]): LinearScale;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const E10 = Math.sqrt(50);
|
|
2
|
+
const E5 = Math.sqrt(10);
|
|
3
|
+
const E2 = Math.sqrt(2);
|
|
4
|
+
/**
|
|
5
|
+
* The distance between two ticks: 1, 2 or 5 times a power of ten, so that about `count` ticks
|
|
6
|
+
* cover the span.
|
|
7
|
+
*/
|
|
8
|
+
export function tickStep(start, stop, count) {
|
|
9
|
+
const raw = Math.abs(stop - start) / Math.max(1, count);
|
|
10
|
+
const power = 10 ** Math.floor(Math.log10(raw));
|
|
11
|
+
const error = raw / power;
|
|
12
|
+
const factor = error >= E10 ? 10 : error >= E5 ? 5 : error >= E2 ? 2 : 1;
|
|
13
|
+
return factor * power;
|
|
14
|
+
}
|
|
15
|
+
/** Round values from `start` to `stop`, about `count` of them. */
|
|
16
|
+
export function ticks(start, stop, count = 10) {
|
|
17
|
+
if (!(count > 0) || !Number.isFinite(start) || !Number.isFinite(stop))
|
|
18
|
+
return [];
|
|
19
|
+
if (start === stop)
|
|
20
|
+
return [start];
|
|
21
|
+
const reverse = stop < start;
|
|
22
|
+
const [lo, hi] = reverse ? [stop, start] : [start, stop];
|
|
23
|
+
const step = tickStep(lo, hi, count);
|
|
24
|
+
// Integer multiples avoid the drift of repeated additions (0.1 + 0.2).
|
|
25
|
+
const first = Math.ceil(lo / step);
|
|
26
|
+
const last = Math.floor(hi / step);
|
|
27
|
+
// A step below 1 divides: 0.1 is exact as 1 / 10, not as 1 * 0.1.
|
|
28
|
+
const inverse = step < 1 ? Math.round(1 / step) : 0;
|
|
29
|
+
const out = [];
|
|
30
|
+
for (let i = first; i <= last; i++)
|
|
31
|
+
out.push(inverse ? i / inverse : i * step);
|
|
32
|
+
return reverse ? out.reverse() : out;
|
|
33
|
+
}
|
|
34
|
+
/** Extends the domain to round values, so that the first and the last tick are at the ends. */
|
|
35
|
+
export function nice(domain, count = 10) {
|
|
36
|
+
let [start, stop] = domain;
|
|
37
|
+
if (!Number.isFinite(start) || !Number.isFinite(stop) || start === stop)
|
|
38
|
+
return [start, stop];
|
|
39
|
+
const reverse = stop < start;
|
|
40
|
+
if (reverse)
|
|
41
|
+
[start, stop] = [stop, start];
|
|
42
|
+
// Two passes: the first extension can change the step.
|
|
43
|
+
for (let i = 0; i < 2; i++) {
|
|
44
|
+
const step = tickStep(start, stop, count);
|
|
45
|
+
start = Math.floor(start / step) * step;
|
|
46
|
+
stop = Math.ceil(stop / step) * step;
|
|
47
|
+
}
|
|
48
|
+
return reverse ? [stop, start] : [start, stop];
|
|
49
|
+
}
|
|
50
|
+
/** Makes a linear scale from `domain` to `range`. */
|
|
51
|
+
export function scaleLinear(domain, range) {
|
|
52
|
+
const [d0, d1] = domain;
|
|
53
|
+
const [r0, r1] = range;
|
|
54
|
+
// An empty domain puts every value in the middle of the range.
|
|
55
|
+
const span = d1 - d0;
|
|
56
|
+
const k = span ? (r1 - r0) / span : 0;
|
|
57
|
+
const scale = (value) => (span ? r0 + (value - d0) * k : (r0 + r1) / 2);
|
|
58
|
+
return Object.assign(scale, {
|
|
59
|
+
kind: 'linear',
|
|
60
|
+
domain,
|
|
61
|
+
range,
|
|
62
|
+
bandwidth: 0,
|
|
63
|
+
invert: (position) => (k ? d0 + (position - r0) / k : d0),
|
|
64
|
+
ticks: (count) => ticks(d0, d1, count),
|
|
65
|
+
tickFormat(count = 10, locale) {
|
|
66
|
+
// As many decimals as the step has, and not more: 0.5 shows as "0.5", 2 as "2".
|
|
67
|
+
const digits = Math.max(0, -Math.floor(Math.log10(tickStep(d0, d1, count) || 1)));
|
|
68
|
+
const format = new Intl.NumberFormat(locale, {
|
|
69
|
+
minimumFractionDigits: digits,
|
|
70
|
+
maximumFractionDigits: digits
|
|
71
|
+
});
|
|
72
|
+
return (value) => format.format(value);
|
|
73
|
+
},
|
|
74
|
+
valueFormat(_values, locale, options) {
|
|
75
|
+
const format = new Intl.NumberFormat(locale, options);
|
|
76
|
+
return (value) => format.format(value);
|
|
77
|
+
},
|
|
78
|
+
nice: (count) => nice(domain, count)
|
|
79
|
+
});
|
|
80
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Scale } from './types.js';
|
|
2
|
+
/** A scale that maps dates to positions in proportion, with ticks at calendar boundaries. */
|
|
3
|
+
export type TimeScale = Scale & {
|
|
4
|
+
readonly kind: 'time';
|
|
5
|
+
};
|
|
6
|
+
/** Dates at calendar boundaries from `start` to `stop`, about `count` of them. */
|
|
7
|
+
export declare function timeTicks(start: number, stop: number, count?: number): number[];
|
|
8
|
+
/** Makes a time scale from `domain` (times in milliseconds) to `range`. */
|
|
9
|
+
export declare function scaleTime(domain: readonly [number, number], range: readonly [number, number]): TimeScale;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { scaleLinear, tickStep, ticks as linearTicks } from './linear.js';
|
|
2
|
+
const SECOND = 1e3;
|
|
3
|
+
const MINUTE = 6e4;
|
|
4
|
+
const HOUR = 36e5;
|
|
5
|
+
const DAY = 864e5;
|
|
6
|
+
const YEAR = 31536e6;
|
|
7
|
+
// The calendar fields, from the largest to the smallest. A day is stored from 0, as the others.
|
|
8
|
+
const FIELDS = ['FullYear', 'Month', 'Date', 'Hours', 'Minutes', 'Seconds'];
|
|
9
|
+
const WEEK = 6; // A pseudo field: seven days from a Sunday.
|
|
10
|
+
function get(date, field) {
|
|
11
|
+
return date[`get${FIELDS[field]}`]() - (field === 2 ? 1 : 0);
|
|
12
|
+
}
|
|
13
|
+
function set(date, field, value) {
|
|
14
|
+
date[`set${FIELDS[field]}`](value + (field === 2 ? 1 : 0));
|
|
15
|
+
}
|
|
16
|
+
/** The tick intervals: a field and a count of it, with the approximate length in milliseconds. */
|
|
17
|
+
const INTERVALS = [
|
|
18
|
+
[5, 1, SECOND],
|
|
19
|
+
[5, 5, 5 * SECOND],
|
|
20
|
+
[5, 15, 15 * SECOND],
|
|
21
|
+
[5, 30, 30 * SECOND],
|
|
22
|
+
[4, 1, MINUTE],
|
|
23
|
+
[4, 5, 5 * MINUTE],
|
|
24
|
+
[4, 15, 15 * MINUTE],
|
|
25
|
+
[4, 30, 30 * MINUTE],
|
|
26
|
+
[3, 1, HOUR],
|
|
27
|
+
[3, 3, 3 * HOUR],
|
|
28
|
+
[3, 6, 6 * HOUR],
|
|
29
|
+
[3, 12, 12 * HOUR],
|
|
30
|
+
[2, 1, DAY],
|
|
31
|
+
[2, 2, 2 * DAY],
|
|
32
|
+
[WEEK, 1, 7 * DAY],
|
|
33
|
+
[1, 1, YEAR / 12],
|
|
34
|
+
[1, 3, YEAR / 4],
|
|
35
|
+
[0, 1, YEAR]
|
|
36
|
+
];
|
|
37
|
+
/** The interval with the length closest to `span / count`. */
|
|
38
|
+
function interval(span, count) {
|
|
39
|
+
const target = span / count;
|
|
40
|
+
if (target < SECOND)
|
|
41
|
+
return null;
|
|
42
|
+
if (target > YEAR)
|
|
43
|
+
return [0, Math.max(1, tickStep(0, span / YEAR, count))];
|
|
44
|
+
let i = INTERVALS.findIndex(([, , length]) => length >= target);
|
|
45
|
+
if (i < 0)
|
|
46
|
+
i = INTERVALS.length - 1;
|
|
47
|
+
if (i > 0 && target / INTERVALS[i - 1][2] < INTERVALS[i][2] / target)
|
|
48
|
+
i--;
|
|
49
|
+
return [INTERVALS[i][0], INTERVALS[i][1]];
|
|
50
|
+
}
|
|
51
|
+
/** The start of the interval that holds `time`. */
|
|
52
|
+
function floor(time, field, step) {
|
|
53
|
+
const date = new Date(time);
|
|
54
|
+
const unit = field === WEEK ? 2 : field;
|
|
55
|
+
date.setMilliseconds(0);
|
|
56
|
+
for (let f = unit + 1; f < FIELDS.length; f++)
|
|
57
|
+
set(date, f, 0);
|
|
58
|
+
const value = get(date, unit);
|
|
59
|
+
set(date, unit, field === WEEK ? value - date.getDay() : value - (((value % step) + step) % step));
|
|
60
|
+
return date;
|
|
61
|
+
}
|
|
62
|
+
/** Dates at calendar boundaries from `start` to `stop`, about `count` of them. */
|
|
63
|
+
export function timeTicks(start, stop, count = 10) {
|
|
64
|
+
if (!Number.isFinite(start) || !Number.isFinite(stop))
|
|
65
|
+
return [];
|
|
66
|
+
if (stop < start)
|
|
67
|
+
return timeTicks(stop, start, count).reverse();
|
|
68
|
+
const chosen = interval(stop - start, count);
|
|
69
|
+
if (!chosen)
|
|
70
|
+
return linearTicks(start, stop, count);
|
|
71
|
+
const [field, step] = chosen;
|
|
72
|
+
const unit = field === WEEK ? 2 : field;
|
|
73
|
+
const size = field === WEEK ? 7 : step;
|
|
74
|
+
const out = [];
|
|
75
|
+
const date = floor(start, field, step);
|
|
76
|
+
if (+date < start)
|
|
77
|
+
set(date, unit, get(date, unit) + size);
|
|
78
|
+
// The guard stops a loop on an invalid date.
|
|
79
|
+
while (+date <= stop && out.length < 1000) {
|
|
80
|
+
out.push(+date);
|
|
81
|
+
set(date, unit, get(date, unit) + size);
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
const formats = new Map();
|
|
86
|
+
function format(locale, options, value) {
|
|
87
|
+
const key = `${locale}|${JSON.stringify(options)}`;
|
|
88
|
+
let formatter = formats.get(key);
|
|
89
|
+
if (!formatter)
|
|
90
|
+
formats.set(key, (formatter = new Intl.DateTimeFormat(locale, options)));
|
|
91
|
+
return formatter.format(value);
|
|
92
|
+
}
|
|
93
|
+
/** The label of a tick: only the largest calendar field that changes at the tick. */
|
|
94
|
+
function tickLabel(value, locale) {
|
|
95
|
+
const d = new Date(value);
|
|
96
|
+
return format(locale, d.getSeconds()
|
|
97
|
+
? { hour: 'numeric', minute: '2-digit', second: '2-digit' }
|
|
98
|
+
: d.getMinutes() || d.getHours()
|
|
99
|
+
? { hour: 'numeric', minute: '2-digit' }
|
|
100
|
+
: d.getDate() !== 1
|
|
101
|
+
? { month: 'short', day: 'numeric' }
|
|
102
|
+
: d.getMonth()
|
|
103
|
+
? { month: 'short' }
|
|
104
|
+
: { year: 'numeric' }, value);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The format of a date in full: as precise as the most precise of `values`. Dates that are all
|
|
108
|
+
* on the first of January show only the year.
|
|
109
|
+
*/
|
|
110
|
+
function fullFormat(values) {
|
|
111
|
+
let level = 0;
|
|
112
|
+
for (const value of values) {
|
|
113
|
+
const d = new Date(value);
|
|
114
|
+
level = Math.max(level, d.getSeconds()
|
|
115
|
+
? 4
|
|
116
|
+
: d.getMinutes() || d.getHours()
|
|
117
|
+
? 3
|
|
118
|
+
: d.getDate() !== 1
|
|
119
|
+
? 2
|
|
120
|
+
: d.getMonth()
|
|
121
|
+
? 1
|
|
122
|
+
: 0);
|
|
123
|
+
}
|
|
124
|
+
return [
|
|
125
|
+
{ year: 'numeric' },
|
|
126
|
+
{ month: 'long', year: 'numeric' },
|
|
127
|
+
{ dateStyle: 'medium' },
|
|
128
|
+
{ dateStyle: 'medium', timeStyle: 'short' },
|
|
129
|
+
{ dateStyle: 'medium', timeStyle: 'medium' }
|
|
130
|
+
][level];
|
|
131
|
+
}
|
|
132
|
+
/** Makes a time scale from `domain` (times in milliseconds) to `range`. */
|
|
133
|
+
export function scaleTime(domain, range) {
|
|
134
|
+
const linear = scaleLinear(domain, range);
|
|
135
|
+
return Object.assign((value) => linear(value), linear, {
|
|
136
|
+
kind: 'time',
|
|
137
|
+
ticks: (count) => timeTicks(domain[0], domain[1], count),
|
|
138
|
+
tickFormat: (_count, locale) => (value) => tickLabel(value, locale),
|
|
139
|
+
valueFormat(values, locale, options) {
|
|
140
|
+
const resolved = options ?? fullFormat(values);
|
|
141
|
+
return (value) => format(locale, resolved, value);
|
|
142
|
+
},
|
|
143
|
+
nice(count = 10) {
|
|
144
|
+
const chosen = interval(Math.abs(domain[1] - domain[0]), count);
|
|
145
|
+
if (!chosen)
|
|
146
|
+
return [domain[0], domain[1]];
|
|
147
|
+
const [field, step] = chosen;
|
|
148
|
+
const start = +floor(domain[0], field, step);
|
|
149
|
+
const end = floor(domain[1], field, step);
|
|
150
|
+
if (+end < domain[1])
|
|
151
|
+
set(end, field === WEEK ? 2 : field, get(end, field === WEEK ? 2 : field) + (field === WEEK ? 7 : step));
|
|
152
|
+
return [start, +end];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** The options of `Intl.NumberFormat` for numbers, and of `Intl.DateTimeFormat` for dates. */
|
|
2
|
+
export type FormatOptions = Intl.NumberFormatOptions | Intl.DateTimeFormatOptions;
|
|
3
|
+
/**
|
|
4
|
+
* A function that maps a value of the data to a position in pixels. The value is a number: a
|
|
5
|
+
* date is its time in milliseconds, and a category is its index in `categories`.
|
|
6
|
+
*/
|
|
7
|
+
export type Scale = {
|
|
8
|
+
(value: number): number;
|
|
9
|
+
/** The name of the type of scale. */
|
|
10
|
+
readonly kind: string;
|
|
11
|
+
/** The values at the two ends of the scale. */
|
|
12
|
+
readonly domain: readonly [number, number];
|
|
13
|
+
/** The positions, in pixels, of the two ends of the scale. */
|
|
14
|
+
readonly range: readonly [number, number];
|
|
15
|
+
/**
|
|
16
|
+
* The width of one band, in pixels, for a band scale. The scale gives the middle of the band.
|
|
17
|
+
* It is 0 for a continuous scale.
|
|
18
|
+
*/
|
|
19
|
+
readonly bandwidth: number;
|
|
20
|
+
/** The position back to a value. */
|
|
21
|
+
invert(position: number): number;
|
|
22
|
+
/** Round values in the domain, about `count` of them. */
|
|
23
|
+
ticks(count?: number): number[];
|
|
24
|
+
/** The function that writes the labels of the ticks that `ticks(count)` gives. */
|
|
25
|
+
tickFormat(count?: number, locale?: string): (value: number) => string;
|
|
26
|
+
/**
|
|
27
|
+
* The function that writes a value in full, for the names of the points and the data table.
|
|
28
|
+
* `values` are all of the values of the channel. Without `options`, a time scale chooses the
|
|
29
|
+
* precision from them.
|
|
30
|
+
*/
|
|
31
|
+
valueFormat(values: number[], locale?: string, options?: FormatOptions): (value: number) => string;
|
|
32
|
+
/** The domain, extended to round values. */
|
|
33
|
+
nice(count?: number): [number, number];
|
|
34
|
+
};
|
|
35
|
+
/** The settings that a scale type can use, in addition to the domain and the range. */
|
|
36
|
+
export type ScaleSettings = {
|
|
37
|
+
/** The categories of a band scale, in order. */
|
|
38
|
+
categories: readonly string[];
|
|
39
|
+
/** The space between two bands, as a fraction of a step. */
|
|
40
|
+
padding?: number;
|
|
41
|
+
};
|
|
42
|
+
/** A function that makes a scale from a domain, a range and the settings. */
|
|
43
|
+
export type ScaleType = (domain: readonly [number, number], range: readonly [number, number], settings?: ScaleSettings) => Scale;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useChartContext } from '../root/context.js';
|
|
3
|
+
import type { ChartTitleProps } from '../types.js';
|
|
4
|
+
|
|
5
|
+
let { children, class: className = '', ...restProps }: ChartTitleProps = $props();
|
|
6
|
+
|
|
7
|
+
const ctx = useChartContext('Chart.Title');
|
|
8
|
+
const id = `chart-${ctx.instanceId}-title`;
|
|
9
|
+
ctx.titleId = id;
|
|
10
|
+
$effect(() => () => {
|
|
11
|
+
if (ctx.titleId === id) ctx.titleId = null;
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<!-- Chart.Title is always a child of the <figure> of Chart.Root. -->
|
|
16
|
+
<!-- svelte-ignore a11y_figcaption_parent -->
|
|
17
|
+
<figcaption {id} class={className} {...restProps}>{@render children?.()}</figcaption>
|