Skip to content

Modern Docker Management, Designed for Everyone

refactor: update imports from 'bits-ui' to '$lib/utils.js' for consistency

Kyle Mendell448500ceb9c7
diff --git a/src/lib/components/ui/alert/alert-description.svelte b/src/lib/components/ui/alert/alert-description.svelte
index a2ab61891..a47e9ebdc 100644
--- a/src/lib/components/ui/alert/alert-description.svelte
+++ b/src/lib/components/ui/alert/alert-description.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
diff --git a/src/lib/components/ui/alert/alert-title.svelte b/src/lib/components/ui/alert/alert-title.svelte
index 890c372ce..b9d156afb 100644
--- a/src/lib/components/ui/alert/alert-title.svelte
+++ b/src/lib/components/ui/alert/alert-title.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
let {
diff --git a/src/lib/components/ui/alert/alert.svelte b/src/lib/components/ui/alert/alert.svelte
index b3dbdd046..b279972dc 100644
--- a/src/lib/components/ui/alert/alert.svelte
+++ b/src/lib/components/ui/alert/alert.svelte
@@ -19,7 +19,7 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
let {
diff --git a/src/lib/components/ui/badge/badge.svelte b/src/lib/components/ui/badge/badge.svelte
index 1e0ae8116..0488589a7 100644
--- a/src/lib/components/ui/badge/badge.svelte
+++ b/src/lib/components/ui/badge/badge.svelte
@@ -20,7 +20,7 @@
</script>
<script lang="ts">
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAnchorAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
diff --git a/src/lib/components/ui/breadcrumb/breadcrumb-item.svelte b/src/lib/components/ui/breadcrumb/breadcrumb-item.svelte
index b10432f89..f08ea6d2b 100644
--- a/src/lib/components/ui/breadcrumb/breadcrumb-item.svelte
+++ b/src/lib/components/ui/breadcrumb/breadcrumb-item.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLLiAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
diff --git a/src/lib/components/ui/breadcrumb/breadcrumb-link.svelte b/src/lib/components/ui/breadcrumb/breadcrumb-link.svelte
index 72a33f545..669f15676 100644
--- a/src/lib/components/ui/breadcrumb/breadcrumb-link.svelte
+++ b/src/lib/components/ui/breadcrumb/breadcrumb-link.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import type { HTMLAnchorAttributes } from 'svelte/elements';
import type { Snippet } from 'svelte';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
let {
diff --git a/src/lib/components/ui/breadcrumb/breadcrumb-list.svelte b/src/lib/components/ui/breadcrumb/breadcrumb-list.svelte
index 3289ac935..077253897 100644
--- a/src/lib/components/ui/breadcrumb/breadcrumb-list.svelte
+++ b/src/lib/components/ui/breadcrumb/breadcrumb-list.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLOlAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
diff --git a/src/lib/components/ui/breadcrumb/breadcrumb-page.svelte b/src/lib/components/ui/breadcrumb/breadcrumb-page.svelte
index 84778ea98..c2a203d7d 100644
--- a/src/lib/components/ui/breadcrumb/breadcrumb-page.svelte
+++ b/src/lib/components/ui/breadcrumb/breadcrumb-page.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
diff --git a/src/lib/components/ui/breadcrumb/breadcrumb-separator.svelte b/src/lib/components/ui/breadcrumb/breadcrumb-separator.svelte
index 184d5f374..b5ce55402 100644
--- a/src/lib/components/ui/breadcrumb/breadcrumb-separator.svelte
+++ b/src/lib/components/ui/breadcrumb/breadcrumb-separator.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import ChevronRight from '@lucide/svelte/icons/chevron-right';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLLiAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
diff --git a/src/lib/components/ui/breadcrumb/breadcrumb.svelte b/src/lib/components/ui/breadcrumb/breadcrumb.svelte
index 15d31f97e..89be45e20 100644
--- a/src/lib/components/ui/breadcrumb/breadcrumb.svelte
+++ b/src/lib/components/ui/breadcrumb/breadcrumb.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
let { ref = $bindable(), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
diff --git a/src/lib/components/ui/button/button.svelte b/src/lib/components/ui/button/button.svelte
index 6cdf2ad3e..85fb8261e 100644
--- a/src/lib/components/ui/button/button.svelte
+++ b/src/lib/components/ui/button/button.svelte
@@ -1,5 +1,5 @@
<script lang="ts" module>
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
import { type VariantProps, tv } from 'tailwind-variants';
diff --git a/src/lib/components/ui/card/card-content.svelte b/src/lib/components/ui/card/card-content.svelte
index e6e18f9d1..7c37e9180 100644
--- a/src/lib/components/ui/card/card-content.svelte
+++ b/src/lib/components/ui/card/card-content.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
diff --git a/src/lib/components/ui/card/card-description.svelte b/src/lib/components/ui/card/card-description.svelte
index 3ef8380f0..471bf175f 100644
--- a/src/lib/components/ui/card/card-description.svelte
+++ b/src/lib/components/ui/card/card-description.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
diff --git a/src/lib/components/ui/card/card-footer.svelte b/src/lib/components/ui/card/card-footer.svelte
index f1e5d9e65..bea56fdf0 100644
--- a/src/lib/components/ui/card/card-footer.svelte
+++ b/src/lib/components/ui/card/card-footer.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
diff --git a/src/lib/components/ui/card/card-header.svelte b/src/lib/components/ui/card/card-header.svelte
index 74ebd3f08..972b59d4f 100644
--- a/src/lib/components/ui/card/card-header.svelte
+++ b/src/lib/components/ui/card/card-header.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
diff --git a/src/lib/components/ui/card/card-title.svelte b/src/lib/components/ui/card/card-title.svelte
index 4d77be5d9..4743246ca 100644
--- a/src/lib/components/ui/card/card-title.svelte
+++ b/src/lib/components/ui/card/card-title.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
diff --git a/src/lib/components/ui/card/card.svelte b/src/lib/components/ui/card/card.svelte
index 06068b91b..cb3596a14 100644
--- a/src/lib/components/ui/card/card.svelte
+++ b/src/lib/components/ui/card/card.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
diff --git a/src/lib/components/ui/dialog/dialog-footer.svelte b/src/lib/components/ui/dialog/dialog-footer.svelte
index 24fee61b8..6857eb5ca 100644
--- a/src/lib/components/ui/dialog/dialog-footer.svelte
+++ b/src/lib/components/ui/dialog/dialog-footer.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
diff --git a/src/lib/components/ui/dialog/dialog-header.svelte b/src/lib/components/ui/dialog/dialog-header.svelte
index 798f7e283..6a209be60 100644
--- a/src/lib/components/ui/dialog/dialog-header.svelte
+++ b/src/lib/components/ui/dialog/dialog-header.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
diff --git a/src/lib/components/ui/input/input.svelte b/src/lib/components/ui/input/input.svelte
index 27c094148..5877828a9 100644
--- a/src/lib/components/ui/input/input.svelte
+++ b/src/lib/components/ui/input/input.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLInputAttributes, HTMLInputTypeAttribute } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
type InputType = Exclude<HTMLInputTypeAttribute, 'file'>;
diff --git a/src/lib/components/ui/pagination/pagination-content.svelte b/src/lib/components/ui/pagination/pagination-content.svelte
index 9dacb9379..e2a771ecc 100644
--- a/src/lib/components/ui/pagination/pagination-content.svelte
+++ b/src/lib/components/ui/pagination/pagination-content.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLUListElement>> = $props();
diff --git a/src/lib/components/ui/pagination/pagination-item.svelte b/src/lib/components/ui/pagination/pagination-item.svelte
index e62e06ff4..4848ebebc 100644
--- a/src/lib/components/ui/pagination/pagination-item.svelte
+++ b/src/lib/components/ui/pagination/pagination-item.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLLiAttributes } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
let { ref = $bindable(null), children, ...restProps }: WithElementRef<HTMLLiAttributes> = $props();
</script>
diff --git a/src/lib/components/ui/table/table-body.svelte b/src/lib/components/ui/table/table-body.svelte
index b2c62c80f..0fa52ef02 100644
--- a/src/lib/components/ui/table/table-body.svelte
+++ b/src/lib/components/ui/table/table-body.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLTableSectionElement>> = $props();
diff --git a/src/lib/components/ui/table/table-caption.svelte b/src/lib/components/ui/table/table-caption.svelte
index f83c51532..3faa8c7c2 100644
--- a/src/lib/components/ui/table/table-caption.svelte
+++ b/src/lib/components/ui/table/table-caption.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
diff --git a/src/lib/components/ui/table/table-cell.svelte b/src/lib/components/ui/table/table-cell.svelte
index b1868edd4..955ed7770 100644
--- a/src/lib/components/ui/table/table-cell.svelte
+++ b/src/lib/components/ui/table/table-cell.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLTdAttributes } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLTdAttributes> = $props();
diff --git a/src/lib/components/ui/table/table-footer.svelte b/src/lib/components/ui/table/table-footer.svelte
index 2b6c1286f..b3ec796c1 100644
--- a/src/lib/components/ui/table/table-footer.svelte
+++ b/src/lib/components/ui/table/table-footer.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLTableSectionElement>> = $props();
diff --git a/src/lib/components/ui/table/table-head.svelte b/src/lib/components/ui/table/table-head.svelte
index 3097f77a9..0c65d65fd 100644
--- a/src/lib/components/ui/table/table-head.svelte
+++ b/src/lib/components/ui/table/table-head.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLThAttributes } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLThAttributes> = $props();
diff --git a/src/lib/components/ui/table/table-header.svelte b/src/lib/components/ui/table/table-header.svelte
index 4234ee688..fa8eaaf81 100644
--- a/src/lib/components/ui/table/table-header.svelte
+++ b/src/lib/components/ui/table/table-header.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLTableSectionElement>> = $props();
diff --git a/src/lib/components/ui/table/table-row.svelte b/src/lib/components/ui/table/table-row.svelte
index c679f34ad..7358f0928 100644
--- a/src/lib/components/ui/table/table-row.svelte
+++ b/src/lib/components/ui/table/table-row.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLTableRowElement>> = $props();
diff --git a/src/lib/components/ui/table/table.svelte b/src/lib/components/ui/table/table.svelte
index f04da242c..2c89f7f8c 100644
--- a/src/lib/components/ui/table/table.svelte
+++ b/src/lib/components/ui/table/table.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLTableAttributes } from 'svelte/elements';
- import type { WithElementRef } from 'bits-ui';
+ import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLTableAttributes> = $props();
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index d6304fd36..d15671fb1 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -1,10 +1,17 @@
-import { type ClassValue, clsx } from 'clsx';
+import { clsx, type ClassValue } from 'clsx';
import { twMerge } from 'tailwind-merge';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export type WithoutChild<T> = T extends { child?: any } ? Omit<T, 'child'> : T;
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export type WithoutChildren<T> = T extends { children?: any } ? Omit<T, 'children'> : T;
+export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
+export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & { ref?: U | null };
+
export function debounced<T extends (...args: any[]) => void>(func: T, delay: number) {
let debounceTimeout: ReturnType<typeof setTimeout>;