Skip to content

Commit

Permalink
wow
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte committed Aug 6, 2024
1 parent 98da6e3 commit 1127425
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Dialog as DialogPrimitive, type WithoutChildrenOrChild, useId } from "bits-ui";
import { type WithChildren, box, mergeProps } from "svelte-toolbelt";
import Mounted from "../utils/mounted.svelte";
import type { DrawerContentProps } from "./types.js";
import type { ContentProps } from "./index.js";
import { useDrawerContent } from "$lib/vaul.svelte.js";
import { noop } from "$lib/internal/helpers/noop.js";
Expand All @@ -15,7 +15,7 @@
onFocusOutside = noop,
children,
...restProps
}: WithChildren<WithoutChildrenOrChild<DrawerContentProps>> = $props();
}: WithChildren<WithoutChildrenOrChild<ContentProps>> = $props();
const contentState = useDrawerContent({
id: box.with(() => id),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { box, mergeProps } from "svelte-toolbelt";
import { useId } from "bits-ui";
import type { DrawerHandleProps } from "./types.js";
import type { HandleProps } from "./index.js";
import { useDrawerHandle } from "$lib/vaul.svelte.js";
let {
Expand All @@ -10,7 +10,7 @@
preventCycle = false,
children,
...restProps
}: DrawerHandleProps = $props();
}: HandleProps = $props();
const handleState = useDrawerHandle({
id: box.with(() => id),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script lang="ts">
import DrawerRoot from "./drawer.svelte";
import type { DrawerRootProps } from "./types.js";
import type { RootProps } from "./index.js";
import { noop } from "$lib/internal/helpers/noop.js";
import { getDrawerRootContext } from "$lib/vaul.svelte.js";
let {
onOpenChange = noop,
onDrag = noop,
...restProps
}: Omit<DrawerRootProps, "nested" | "onRelease" | "onClose"> = $props();
}: Omit<RootProps, "nested" | "onRelease" | "onClose"> = $props();
const rootState = getDrawerRootContext();
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
import { Dialog as DialogPrimitive, type WithoutChildrenOrChild, useId } from "bits-ui";
import { type WithChildren, box, mergeProps } from "svelte-toolbelt";
import Mounted from "../utils/mounted.svelte";
import type { DrawerOverlayProps } from "./types.js";
import type { OverlayProps } from "./index.js";
import { useDrawerOverlay } from "$lib/vaul.svelte.js";
let {
id = useId(),
ref = $bindable(null),
children,
...restProps
}: WithChildren<WithoutChildrenOrChild<DrawerOverlayProps>> = $props();
}: WithChildren<WithoutChildrenOrChild<OverlayProps>> = $props();
const overlayState = useDrawerOverlay({
id: box.with(() => id),
Expand Down
4 changes: 2 additions & 2 deletions packages/vaul-svelte/src/lib/components/drawer/drawer.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { Dialog as DialogPrimitive } from "bits-ui";
import { box } from "svelte-toolbelt";
import type { DrawerRootProps } from "./types.js";
import type { RootProps } from "./index.js";
import { noop } from "$lib/internal/helpers/noop.js";
import {
DEFAULT_CLOSE_THRESHOLD,
Expand Down Expand Up @@ -33,7 +33,7 @@
setBackgroundColorOnScale = true,
disablePreventScroll = false,
...restProps
}: DrawerRootProps = $props();
}: RootProps = $props();
const rootState = useDrawerRoot({
open: box.with(
Expand Down
12 changes: 5 additions & 7 deletions packages/vaul-svelte/src/lib/components/drawer/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { Dialog as DrawerPrimitive } from "bits-ui";

export { default as Root } from "./drawer.svelte";
export { default as Content } from "./drawer-content.svelte";
export { default as Overlay } from "./drawer-overlay.svelte";
export { default as NestedRoot } from "./drawer-nested.svelte";
export { default as Handle } from "./drawer-handle.svelte";

export const Portal = DrawerPrimitive.Portal;
export const Trigger = DrawerPrimitive.Trigger;
export const Title = DrawerPrimitive.Title;
export const Description = DrawerPrimitive.Description;
export const Close = DrawerPrimitive.Close;
export const Portal: typeof DrawerPrimitive.Portal = DrawerPrimitive.Portal;
export const Trigger: typeof DrawerPrimitive.Trigger = DrawerPrimitive.Trigger;
export const Title: typeof DrawerPrimitive.Title = DrawerPrimitive.Title;
export const Description: typeof DrawerPrimitive.Description = DrawerPrimitive.Description;
export const Close: typeof DrawerPrimitive.Close = DrawerPrimitive.Close;

export type {
DrawerRootProps as RootProps,
Expand All @@ -22,5 +21,4 @@ export type {
DrawerDescriptionProps as DescriptionProps,
DrawerCloseProps as CloseProps,
DrawerPortalProps as PortalProps,
DrawerTriggerProps as TriggerProps,
} from "./types.js";
8 changes: 2 additions & 6 deletions packages/vaul-svelte/src/lib/components/drawer/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Dialog as DialogPrimitive, PrimitiveDivAttributes, WithChild } from "bits-ui";
import type { Dialog as DrawerPrimitive, PrimitiveDivAttributes, WithChild } from "bits-ui";
import type { WithChildren, Without } from "svelte-toolbelt";
import type { DrawerDirection, OnChangeFn, OnDrag, OnRelease } from "$lib/types.js";

Expand Down Expand Up @@ -159,7 +159,7 @@ export type BaseDrawerRootPropsWithoutHTML = WithChildren<{
}>;

export type DrawerRootPropsWithoutHTML = BaseDrawerRootPropsWithoutHTML &
Without<DialogPrimitive.RootProps, BaseDrawerRootPropsWithoutHTML>;
Without<DrawerPrimitive.RootProps, BaseDrawerRootPropsWithoutHTML>;

export type DrawerRootProps = DrawerRootPropsWithoutHTML;

Expand All @@ -185,12 +185,8 @@ export type {
DialogOverlayProps as DrawerOverlayProps,
DialogPortalPropsWithoutHTML as DrawerPortalPropsWithoutHTML,
DialogPortalProps as DrawerPortalProps,
DialogTriggerPropsWithoutHTML as DrawerTriggerPropsWithoutHTML,
DialogTriggerProps as DrawerTriggerProps,
DialogTitlePropsWithoutHTML as DrawerTitlePropsWithoutHTML,
DialogTitleProps as DrawerTitleProps,
DialogDescriptionPropsWithoutHTML as DrawerDescriptionPropsWithoutHTML,
DialogDescriptionProps as DrawerDescriptionProps,
DialogClosePropsWithoutHTML as DrawerClosePropsWithoutHTML,
DialogCloseProps as DrawerCloseProps,
} from "bits-ui";
2 changes: 0 additions & 2 deletions packages/vaul-svelte/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
export * from "./components/index.js";
export * from "./components/drawer/index.js";
export * from "./types.js";
export type { OnDrag, OnRelease } from "./vaul.svelte.js";

0 comments on commit 1127425

Please sign in to comment.