Skip to content

Commit

Permalink
next: fix circular deps (#1305)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte authored Oct 7, 2024
1 parent 1dbc70e commit 88c1e48
Show file tree
Hide file tree
Showing 141 changed files with 789 additions and 610 deletions.
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sites/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@internationalized/date": "^3.5.6",
"@unovis/svelte": "1.4.3",
"@unovis/ts": "1.4.3",
"bits-ui": "1.0.0-next.13",
"bits-ui": "1.0.0-next.14",
"clsx": "^2.1.1",
"d3-scale": "^4.0.2",
"embla-carousel-autoplay": "8.1.6",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<script lang="ts">
import { Accordion as AccordionPrimitive, type WithoutChildrenOrChild } from "bits-ui";
import type { Snippet } from "svelte";
import { Accordion as AccordionPrimitive, type WithoutChild } from "bits-ui";
import { cn } from "$lib/utils.js";
let {
ref = $bindable(null),
class: className,
children,
...restProps
}: WithoutChildrenOrChild<AccordionPrimitive.ContentProps> & {
children: Snippet;
} = $props();
}: WithoutChild<AccordionPrimitive.ContentProps> = $props();
</script>

<AccordionPrimitive.Content
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { AlertDialog as AlertDialogPrimitive, type WithoutChild } from "bits-ui";
import * as AlertDialog from "./index.js";
import AlertDialogOverlay from "./alert-dialog-overlay.svelte";
import { cn } from "$lib/utils.js";
let {
Expand All @@ -10,8 +10,8 @@
}: WithoutChild<AlertDialogPrimitive.ContentProps> = $props();
</script>

<AlertDialog.Portal>
<AlertDialog.Overlay />
<AlertDialogPrimitive.Portal>
<AlertDialogOverlay />
<AlertDialogPrimitive.Content
bind:ref
class={cn(
Expand All @@ -20,4 +20,4 @@
)}
{...restProps}
/>
</AlertDialog.Portal>
</AlertDialogPrimitive.Portal>
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script lang="ts">
import { type PrimitiveDivAttributes, cn } from "$lib/utils.js";
import type { WithElementRef } from "bits-ui";
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
let {
ref = $bindable(null),
class: className,
children,
...restProps
}: PrimitiveDivAttributes = $props();
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>

<div
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script lang="ts">
import { type PrimitiveDivAttributes, cn } from "$lib/utils.js";
import type { WithElementRef } from "bits-ui";
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
let {
ref = $bindable(null),
class: className,
children,
...restProps
}: PrimitiveDivAttributes = $props();
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>

<div
Expand Down

This file was deleted.

3 changes: 1 addition & 2 deletions sites/docs/src/lib/registry/default/ui/alert-dialog/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { AlertDialog as AlertDialogPrimitive } from "bits-ui";

import Title from "./alert-dialog-title.svelte";
import Action from "./alert-dialog-action.svelte";
import Cancel from "./alert-dialog-cancel.svelte";
import Portal from "./alert-dialog-portal.svelte";
import Footer from "./alert-dialog-footer.svelte";
import Header from "./alert-dialog-header.svelte";
import Overlay from "./alert-dialog-overlay.svelte";
Expand All @@ -12,6 +10,7 @@ import Description from "./alert-dialog-description.svelte";

const Root = AlertDialogPrimitive.Root;
const Trigger = AlertDialogPrimitive.Trigger;
const Portal = AlertDialogPrimitive.Portal;

export {
Root,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script lang="ts">
import { type PrimitiveDivAttributes, cn } from "$lib/utils.js";
import type { WithElementRef } from "bits-ui";
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
let {
ref = $bindable(null),
class: className,
children,
...restProps
}: PrimitiveDivAttributes = $props();
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>

<div bind:this={ref} class={cn("text-sm [&_p]:leading-relaxed", className)} {...restProps}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<script lang="ts">
import type { AlertHeadingLevel } from "./index.js";
import { type PrimitiveDivAttributes, cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements";
import type { WithElementRef } from "bits-ui";
import { cn } from "$lib/utils.js";
let {
ref = $bindable(null),
class: className,
level = 5,
children,
...restProps
}: PrimitiveDivAttributes & {
level?: AlertHeadingLevel;
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
level?: 1 | 2 | 3 | 4 | 5 | 6;
} = $props();
</script>

Expand Down
27 changes: 24 additions & 3 deletions sites/docs/src/lib/registry/default/ui/alert/alert.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
<script lang="ts" module>
import { type VariantProps, tv } from "tailwind-variants";
export const alertVariants = tv({
base: "[&>svg]:text-foreground relative w-full rounded-lg border p-4 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-7",
variants: {
variant: {
default: "bg-background text-foreground",
destructive:
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
},
},
defaultVariants: {
variant: "default",
},
});
export type AlertVariant = VariantProps<typeof alertVariants>["variant"];
</script>

<script lang="ts">
import { type AlertVariant, alertVariants } from "./index.js";
import { type PrimitiveDivAttributes, cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements";
import type { WithElementRef } from "bits-ui";
import { cn } from "$lib/utils.js";
let {
ref = $bindable(null),
class: className,
variant = "default",
children,
...restProps
}: PrimitiveDivAttributes & {
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
variant?: AlertVariant;
} = $props();
</script>
Expand Down
20 changes: 1 addition & 19 deletions sites/docs/src/lib/registry/default/ui/alert/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
import { type VariantProps, tv } from "tailwind-variants";

import Root from "./alert.svelte";
import Description from "./alert-description.svelte";
import Title from "./alert-title.svelte";

export const alertVariants = tv({
base: "[&>svg]:text-foreground relative w-full rounded-lg border p-4 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-7",
variants: {
variant: {
default: "bg-background text-foreground",
destructive:
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
},
},
defaultVariants: {
variant: "default",
},
});

export type AlertVariant = VariantProps<typeof alertVariants>["variant"];
export type AlertHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
export { alertVariants, type AlertVariant } from "./alert.svelte";

export {
Root,
Expand Down
31 changes: 28 additions & 3 deletions sites/docs/src/lib/registry/default/ui/badge/badge.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
<script lang="ts" module>
import { type VariantProps, tv } from "tailwind-variants";
export const badgeVariants = tv({
base: "focus:ring-ring inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2",
variants: {
variant: {
default:
"bg-primary text-primary-foreground hover:bg-primary/80 border-transparent",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent",
destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent",
outline: "text-foreground",
},
},
defaultVariants: {
variant: "default",
},
});
export type BadgeVariant = VariantProps<typeof badgeVariants>["variant"];
</script>

<script lang="ts">
import { type BadgeVariant, badgeVariants } from "./index.js";
import { type PrimitiveAnchorAttributes, cn } from "$lib/utils.js";
import type { WithElementRef } from "bits-ui";
import type { HTMLAnchorAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
let {
ref = $bindable(null),
Expand All @@ -9,7 +34,7 @@
variant = "default",
children,
...restProps
}: PrimitiveAnchorAttributes & {
}: WithElementRef<HTMLAnchorAttributes> & {
variant?: BadgeVariant;
} = $props();
</script>
Expand Down
21 changes: 1 addition & 20 deletions sites/docs/src/lib/registry/default/ui/badge/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
import { type VariantProps, tv } from "tailwind-variants";
export { default as Badge } from "./badge.svelte";

export const badgeVariants = tv({
base: "focus:ring-ring inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2",
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/80 border-transparent",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent",
destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent",
outline: "text-foreground",
},
},
defaultVariants: {
variant: "default",
},
});

export type BadgeVariant = VariantProps<typeof badgeVariants>["variant"];
export { badgeVariants, type BadgeVariant } from "./badge.svelte";
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<script lang="ts">
import Ellipsis from "lucide-svelte/icons/ellipsis";
import type { WithoutChildren } from "bits-ui";
import { type PrimitiveSpanAttributes, cn } from "$lib/utils.js";
import type { WithElementRef, WithoutChildren } from "bits-ui";
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
let {
ref = $bindable(null),
class: className,
...restProps
}: WithoutChildren<PrimitiveSpanAttributes> = $props();
export { className as class };
}: WithoutChildren<WithElementRef<HTMLAttributes<HTMLSpanElement>>> = $props();
</script>

<span
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script lang="ts">
import { type PrimitiveLiAttributes, cn } from "$lib/utils.js";
import type { WithElementRef } from "bits-ui";
import type { HTMLLiAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
let {
ref = $bindable(null),
class: className,
children,
...restProps
}: PrimitiveLiAttributes = $props();
}: WithElementRef<HTMLLiAttributes> = $props();
</script>

<li bind:this={ref} class={cn("inline-flex items-center gap-1.5", className)} {...restProps}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts">
import type { HTMLAnchorAttributes } from "svelte/elements";
import type { Snippet } from "svelte";
import { type PrimitiveAnchorAttributes, cn } from "$lib/utils.js";
import type { WithElementRef } from "bits-ui";
import { cn } from "$lib/utils.js";
let {
ref = $bindable(null),
Expand All @@ -10,7 +11,7 @@
child,
children,
...restProps
}: PrimitiveAnchorAttributes & {
}: WithElementRef<HTMLAnchorAttributes> & {
child?: Snippet<[{ props: HTMLAnchorAttributes }]>;
} = $props();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script lang="ts">
import { type PrimitiveOlAttributes, cn } from "$lib/utils.js";
import type { WithElementRef } from "bits-ui";
import type { HTMLOlAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
let {
ref = $bindable(null),
class: className,
children,
...restProps
}: PrimitiveOlAttributes = $props();
}: WithElementRef<HTMLOlAttributes> = $props();
</script>

<ol
Expand Down
Loading

0 comments on commit 88c1e48

Please sign in to comment.