From a342eb93573904abe0a8d48fe49bc271f9c45aab Mon Sep 17 00:00:00 2001 From: Hunter Johnston <64506580+huntabyte@users.noreply.github.com> Date: Thu, 4 Jan 2024 22:29:28 -0500 Subject: [PATCH] fix: tree shaking (#255) --- .changeset/olive-cats-compete.md | 5 + .../components/accordion-content.svelte | 9 +- .../components/accordion-header.svelte | 5 +- .../components/accordion-item.svelte | 8 +- .../components/accordion-trigger.svelte | 8 +- .../accordion/components/accordion.svelte | 5 +- src/lib/bits/accordion/ctx.ts | 67 ++++---- .../components/alert-dialog-action.svelte | 5 +- .../components/alert-dialog-cancel.svelte | 5 +- .../components/alert-dialog-content.svelte | 5 +- .../alert-dialog-description.svelte | 5 +- .../components/alert-dialog-overlay.svelte | 5 +- .../components/alert-dialog-portal.svelte | 5 +- .../components/alert-dialog-title.svelte | 5 +- .../components/alert-dialog-trigger.svelte | 5 +- src/lib/bits/alert-dialog/ctx.ts | 51 +++--- .../avatar/components/avatar-fallback.svelte | 5 +- .../avatar/components/avatar-image.svelte | 6 +- src/lib/bits/avatar/components/avatar.svelte | 5 +- src/lib/bits/avatar/ctx.ts | 22 ++- .../calendar/components/calendar-cell.svelte | 5 +- .../calendar/components/calendar-day.svelte | 5 +- .../components/calendar-grid-body.svelte | 3 +- .../components/calendar-grid-head.svelte | 9 +- .../components/calendar-grid-row.svelte | 4 +- .../calendar/components/calendar-grid.svelte | 5 +- .../components/calendar-head-cell.svelte | 3 +- .../components/calendar-header.svelte | 4 +- .../components/calendar-heading.svelte | 5 +- .../components/calendar-next-button.svelte | 5 +- .../components/calendar-prev-button.svelte | 5 +- .../bits/calendar/components/calendar.svelte | 5 +- src/lib/bits/calendar/ctx.ts | 54 +++--- .../components/checkbox-indicator.svelte | 5 +- .../bits/checkbox/components/checkbox.svelte | 5 +- src/lib/bits/checkbox/ctx.ts | 28 ++-- .../components/collapsible-content.svelte | 5 +- .../components/collapsible-trigger.svelte | 5 +- .../collapsible/components/collapsible.svelte | 5 +- src/lib/bits/collapsible/ctx.ts | 25 +-- .../components/context-menu-content.svelte | 5 +- .../components/context-menu-trigger.svelte | 5 +- src/lib/bits/context-menu/ctx.ts | 63 +++---- .../components/date-field-input.svelte | 5 +- .../components/date-field-label.svelte | 5 +- .../components/date-field-segment.svelte | 5 +- src/lib/bits/date-field/ctx.ts | 25 +-- .../components/date-picker-arrow.svelte | 5 +- .../components/date-picker-calendar.svelte | 5 +- .../components/date-picker-cell.svelte | 5 +- .../components/date-picker-close.svelte | 5 +- .../components/date-picker-content.svelte | 5 +- .../components/date-picker-day.svelte | 5 +- .../components/date-picker-grid.svelte | 5 +- .../components/date-picker-heading.svelte | 5 +- .../components/date-picker-input.svelte | 5 +- .../components/date-picker-label.svelte | 5 +- .../components/date-picker-next-button.svelte | 5 +- .../components/date-picker-prev-button.svelte | 5 +- .../components/date-picker-segment.svelte | 5 +- .../components/date-picker-trigger.svelte | 5 +- src/lib/bits/date-picker/ctx.ts | 44 +++-- .../components/date-range-field-input.svelte | 5 +- .../components/date-range-field-label.svelte | 5 +- .../date-range-field-segment.svelte | 5 +- src/lib/bits/date-range-field/ctx.ts | 26 ++- .../components/date-range-picker-arrow.svelte | 5 +- .../date-range-picker-calendar.svelte | 5 +- .../components/date-range-picker-cell.svelte | 5 +- .../components/date-range-picker-close.svelte | 5 +- .../date-range-picker-content.svelte | 5 +- .../components/date-range-picker-day.svelte | 5 +- .../components/date-range-picker-grid.svelte | 5 +- .../date-range-picker-heading.svelte | 5 +- .../components/date-range-picker-input.svelte | 5 +- .../components/date-range-picker-label.svelte | 5 +- .../date-range-picker-next-button.svelte | 5 +- .../date-range-picker-prev-button.svelte | 5 +- .../date-range-picker-segment.svelte | 5 +- .../date-range-picker-trigger.svelte | 5 +- src/lib/bits/date-range-picker/ctx.ts | 46 +++-- .../dialog/components/dialog-close.svelte | 5 +- .../dialog/components/dialog-content.svelte | 5 +- .../components/dialog-description.svelte | 5 +- .../dialog/components/dialog-overlay.svelte | 5 +- .../dialog/components/dialog-portal.svelte | 5 +- .../dialog/components/dialog-title.svelte | 5 +- .../dialog/components/dialog-trigger.svelte | 5 +- src/lib/bits/dialog/ctx.ts | 31 +++- src/lib/bits/floating/helpers.ts | 22 +-- src/lib/bits/label/components/label.svelte | 3 +- src/lib/bits/label/ctx.ts | 13 +- .../components/link-preview-arrow.svelte | 5 +- .../components/link-preview-content.svelte | 5 +- .../components/link-preview-trigger.svelte | 5 +- src/lib/bits/link-preview/ctx.ts | 53 +++--- .../bits/menu/components/menu-arrow.svelte | 5 +- .../components/menu-checkbox-indicator.svelte | 3 +- .../menu/components/menu-checkbox-item.svelte | 5 +- .../bits/menu/components/menu-content.svelte | 5 +- .../bits/menu/components/menu-group.svelte | 4 +- src/lib/bits/menu/components/menu-item.svelte | 5 +- .../bits/menu/components/menu-label.svelte | 4 +- .../menu/components/menu-radio-group.svelte | 5 +- .../components/menu-radio-indicator.svelte | 9 +- .../menu/components/menu-radio-item.svelte | 5 +- .../menu/components/menu-separator.svelte | 5 +- .../menu/components/menu-sub-content.svelte | 5 +- .../menu/components/menu-sub-trigger.svelte | 5 +- .../bits/menu/components/menu-trigger.svelte | 5 +- src/lib/bits/menu/ctx.ts | 157 +++++++++++------- .../menubar/components/menubar-trigger.svelte | 5 +- .../bits/menubar/components/menubar.svelte | 5 +- src/lib/bits/menubar/ctx.ts | 83 +++++---- .../components/pagination-next-button.svelte | 5 +- .../components/pagination-page.svelte | 5 +- .../components/pagination-prev-button.svelte | 5 +- .../pagination/components/pagination.svelte | 5 +- src/lib/bits/pagination/ctx.ts | 25 +-- .../components/pin-input-hidden-input.svelte | 5 +- .../components/pin-input-input.svelte | 5 +- .../pin-input/components/pin-input.svelte | 5 +- src/lib/bits/pin-input/ctx.ts | 26 +-- .../popover/components/popover-arrow.svelte | 5 +- .../popover/components/popover-close.svelte | 5 +- .../popover/components/popover-content.svelte | 5 +- .../popover/components/popover-trigger.svelte | 5 +- src/lib/bits/popover/ctx.ts | 43 +++-- .../bits/progress/components/progress.svelte | 5 +- src/lib/bits/progress/ctx.ts | 15 +- .../components/radio-group-input.svelte | 5 +- .../radio-group-item-indicator.svelte | 8 +- .../components/radio-group-item.svelte | 5 +- .../radio-group/components/radio-group.svelte | 5 +- src/lib/bits/radio-group/ctx.ts | 40 +++-- .../components/range-calendar-cell.svelte | 5 +- .../components/range-calendar-day.svelte | 5 +- .../range-calendar-grid-body.svelte | 4 +- .../range-calendar-grid-head.svelte | 3 +- .../components/range-calendar-grid-row.svelte | 3 +- .../components/range-calendar-grid.svelte | 5 +- .../range-calendar-head-cell.svelte | 4 +- .../components/range-calendar-header.svelte | 4 +- .../components/range-calendar-heading.svelte | 5 +- .../range-calendar-next-button.svelte | 5 +- .../range-calendar-prev-button.svelte | 5 +- .../components/range-calendar.svelte | 5 +- src/lib/bits/range-calendar/ctx.ts | 47 +++--- .../select/components/select-arrow.svelte | 5 +- .../select/components/select-content.svelte | 5 +- .../select/components/select-group.svelte | 4 +- .../select/components/select-input.svelte | 5 +- .../components/select-item-indicator.svelte | 4 +- .../bits/select/components/select-item.svelte | 5 +- .../select/components/select-label.svelte | 4 +- .../select/components/select-trigger.svelte | 5 +- .../select/components/select-value.svelte | 5 +- src/lib/bits/select/ctx.ts | 80 +++++---- .../separator/components/separator.svelte | 5 +- src/lib/bits/separator/ctx.ts | 16 +- .../slider/components/slider-input.svelte | 5 +- .../slider/components/slider-range.svelte | 5 +- .../slider/components/slider-thumb.svelte | 5 +- .../bits/slider/components/slider-tick.svelte | 5 +- src/lib/bits/slider/components/slider.svelte | 5 +- src/lib/bits/slider/ctx.ts | 20 ++- .../switch/components/switch-thumb.svelte | 5 +- src/lib/bits/switch/components/switch.svelte | 5 +- src/lib/bits/switch/ctx.ts | 21 ++- .../bits/tabs/components/tabs-content.svelte | 5 +- src/lib/bits/tabs/components/tabs-list.svelte | 5 +- .../bits/tabs/components/tabs-trigger.svelte | 5 +- src/lib/bits/tabs/components/tabs.svelte | 5 +- src/lib/bits/tabs/ctx.ts | 21 ++- .../components/toggle-group-item.svelte | 5 +- .../components/toggle-group.svelte | 5 +- src/lib/bits/toggle-group/ctx.ts | 26 +-- src/lib/bits/toggle/components/toggle.svelte | 5 +- src/lib/bits/toggle/ctx.ts | 21 ++- .../toolbar/components/toolbar-button.svelte | 5 +- .../components/toolbar-group-item.svelte | 5 +- .../toolbar/components/toolbar-group.svelte | 5 +- .../toolbar/components/toolbar-link.svelte | 5 +- .../bits/toolbar/components/toolbar.svelte | 5 +- src/lib/bits/toolbar/ctx.ts | 34 ++-- .../tooltip/components/tooltip-arrow.svelte | 5 +- .../tooltip/components/tooltip-content.svelte | 5 +- .../tooltip/components/tooltip-trigger.svelte | 5 +- src/lib/bits/tooltip/ctx.ts | 49 +++--- 189 files changed, 1257 insertions(+), 822 deletions(-) create mode 100644 .changeset/olive-cats-compete.md diff --git a/.changeset/olive-cats-compete.md b/.changeset/olive-cats-compete.md new file mode 100644 index 000000000..24cf55fb2 --- /dev/null +++ b/.changeset/olive-cats-compete.md @@ -0,0 +1,5 @@ +--- +"bits-ui": patch +--- + +fix: issues with tree shaking diff --git a/src/lib/bits/accordion/components/accordion-content.svelte b/src/lib/bits/accordion/components/accordion-content.svelte index 3cfce7777..540163ca8 100644 --- a/src/lib/bits/accordion/components/accordion-content.svelte +++ b/src/lib/bits/accordion/components/accordion-content.svelte @@ -2,7 +2,7 @@ import { melt } from "@melt-ui/svelte"; import type { Transition } from "$lib/internal/index.js"; import type { ContentProps } from "../types.js"; - import { getContent, getAttrs } from "../ctx.js"; + import { getContent } from "../ctx.js"; type T = $$Generic; type In = $$Generic; @@ -20,7 +20,12 @@ export let asChild: $$Props["asChild"] = false; export let el: $$Props["el"] = undefined; - const { content, isSelected, props } = getContent(); + const { + elements: { content }, + helpers: { isSelected }, + props, + getAttrs + } = getContent(); const attrs = getAttrs("content"); diff --git a/src/lib/bits/accordion/components/accordion-header.svelte b/src/lib/bits/accordion/components/accordion-header.svelte index 9efe0f826..4babb5823 100644 --- a/src/lib/bits/accordion/components/accordion-header.svelte +++ b/src/lib/bits/accordion/components/accordion-header.svelte @@ -1,6 +1,6 @@ diff --git a/src/lib/bits/calendar/components/calendar-grid-head.svelte b/src/lib/bits/calendar/components/calendar-grid-head.svelte index 94b21cd63..641142d25 100644 --- a/src/lib/bits/calendar/components/calendar-grid-head.svelte +++ b/src/lib/bits/calendar/components/calendar-grid-head.svelte @@ -1,12 +1,17 @@ {#if asChild} diff --git a/src/lib/bits/calendar/components/calendar-grid-row.svelte b/src/lib/bits/calendar/components/calendar-grid-row.svelte index 2df2ef4ff..811ebd41a 100644 --- a/src/lib/bits/calendar/components/calendar-grid-row.svelte +++ b/src/lib/bits/calendar/components/calendar-grid-row.svelte @@ -1,5 +1,5 @@ diff --git a/src/lib/bits/calendar/components/calendar-grid.svelte b/src/lib/bits/calendar/components/calendar-grid.svelte index b88ccff26..faa3a1bce 100644 --- a/src/lib/bits/calendar/components/calendar-grid.svelte +++ b/src/lib/bits/calendar/components/calendar-grid.svelte @@ -1,6 +1,6 @@ diff --git a/src/lib/bits/calendar/components/calendar-header.svelte b/src/lib/bits/calendar/components/calendar-header.svelte index b2462b943..92ad4808b 100644 --- a/src/lib/bits/calendar/components/calendar-header.svelte +++ b/src/lib/bits/calendar/components/calendar-header.svelte @@ -1,11 +1,13 @@ diff --git a/src/lib/bits/calendar/components/calendar-heading.svelte b/src/lib/bits/calendar/components/calendar-heading.svelte index 6c4d69249..27d3a77a8 100644 --- a/src/lib/bits/calendar/components/calendar-heading.svelte +++ b/src/lib/bits/calendar/components/calendar-heading.svelte @@ -1,6 +1,6 @@ diff --git a/src/lib/bits/menu/components/menu-checkbox-item.svelte b/src/lib/bits/menu/components/menu-checkbox-item.svelte index 8acd61ad5..2b578ef17 100644 --- a/src/lib/bits/menu/components/menu-checkbox-item.svelte +++ b/src/lib/bits/menu/components/menu-checkbox-item.svelte @@ -1,6 +1,6 @@ diff --git a/src/lib/bits/menu/components/menu-radio-item.svelte b/src/lib/bits/menu/components/menu-radio-item.svelte index 347274862..a424958e0 100644 --- a/src/lib/bits/menu/components/menu-radio-item.svelte +++ b/src/lib/bits/menu/components/menu-radio-item.svelte @@ -1,6 +1,6 @@ diff --git a/src/lib/bits/range-calendar/components/range-calendar-grid-head.svelte b/src/lib/bits/range-calendar/components/range-calendar-grid-head.svelte index 908454a70..819d14a43 100644 --- a/src/lib/bits/range-calendar/components/range-calendar-grid-head.svelte +++ b/src/lib/bits/range-calendar/components/range-calendar-grid-head.svelte @@ -1,10 +1,11 @@ diff --git a/src/lib/bits/range-calendar/components/range-calendar-grid-row.svelte b/src/lib/bits/range-calendar/components/range-calendar-grid-row.svelte index 2df2ef4ff..b991e62fd 100644 --- a/src/lib/bits/range-calendar/components/range-calendar-grid-row.svelte +++ b/src/lib/bits/range-calendar/components/range-calendar-grid-row.svelte @@ -1,11 +1,12 @@ diff --git a/src/lib/bits/range-calendar/components/range-calendar-grid.svelte b/src/lib/bits/range-calendar/components/range-calendar-grid.svelte index 3a6cd10c5..a67b6c2c6 100644 --- a/src/lib/bits/range-calendar/components/range-calendar-grid.svelte +++ b/src/lib/bits/range-calendar/components/range-calendar-grid.svelte @@ -1,6 +1,6 @@ diff --git a/src/lib/bits/range-calendar/components/range-calendar-header.svelte b/src/lib/bits/range-calendar/components/range-calendar-header.svelte index b2462b943..92ad4808b 100644 --- a/src/lib/bits/range-calendar/components/range-calendar-header.svelte +++ b/src/lib/bits/range-calendar/components/range-calendar-header.svelte @@ -1,11 +1,13 @@ diff --git a/src/lib/bits/range-calendar/components/range-calendar-heading.svelte b/src/lib/bits/range-calendar/components/range-calendar-heading.svelte index 6c4d69249..27d3a77a8 100644 --- a/src/lib/bits/range-calendar/components/range-calendar-heading.svelte +++ b/src/lib/bits/range-calendar/components/range-calendar-heading.svelte @@ -1,6 +1,6 @@ diff --git a/src/lib/bits/select/components/select-item.svelte b/src/lib/bits/select/components/select-item.svelte index ad4297972..b070df732 100644 --- a/src/lib/bits/select/components/select-item.svelte +++ b/src/lib/bits/select/components/select-item.svelte @@ -1,6 +1,6 @@