-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from huntabyte/forward-more-events
- Loading branch information
Showing
107 changed files
with
1,168 additions
and
474 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@huntabyte/primitives": patch | ||
--- | ||
|
||
- Add types to component events | ||
- Forward component events | ||
- Add transition options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/lib/primitives/accordion/components/AccordionTrigger.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
<script lang="ts"> | ||
import { melt } from "@melt-ui/svelte"; | ||
import { ctx } from "../ctx.js"; | ||
import type { TriggerProps } from "../types.js"; | ||
import type { TriggerEvents, TriggerProps } from "../types.js"; | ||
type $$Props = TriggerProps; | ||
type $$Events = TriggerEvents; | ||
const { trigger, props } = ctx.getTrigger(); | ||
</script> | ||
|
||
<button use:melt={$trigger(props)} {...$$restProps} on:m-click on:m-keydown> | ||
<button use:melt={$trigger(props)} {...$$restProps} on:click on:keydown on:m-keydown on:m-click> | ||
<slot /> | ||
</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/lib/primitives/alert-dialog/components/AlertDialogAction.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
<script lang="ts"> | ||
import { melt } from "@melt-ui/svelte"; | ||
import { ctx } from "../ctx.js"; | ||
import type { ActionProps } from "../types.js"; | ||
import type { ActionEvents, ActionProps } from "../types.js"; | ||
type $$Props = ActionProps; | ||
type $$Events = ActionEvents; | ||
export let asChild = false; | ||
const action = ctx.getClose(); | ||
</script> | ||
|
||
{#if asChild} | ||
<slot action={$action} /> | ||
{:else} | ||
<button use:melt={$action} {...$$restProps}> | ||
<button use:melt={$action} {...$$restProps} on:click on:keydown on:m-click on:m-keydown> | ||
<slot /> | ||
</button> | ||
{/if} |
5 changes: 3 additions & 2 deletions
5
src/lib/primitives/alert-dialog/components/AlertDialogCancel.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
<script lang="ts"> | ||
import { melt } from "@melt-ui/svelte"; | ||
import { ctx } from "../ctx.js"; | ||
import type { CancelProps } from "../types.js"; | ||
import type { CancelEvents, CancelProps } from "../types.js"; | ||
type $$Props = CancelProps; | ||
type $$Events = CancelEvents; | ||
export let asChild = false; | ||
const cancel = ctx.getClose(); | ||
</script> | ||
|
||
{#if asChild} | ||
<slot cancel={$cancel} /> | ||
{:else} | ||
<button use:melt={$cancel} on:m-click on:m-keydown {...$$restProps}> | ||
<button use:melt={$cancel} on:click on:keydown on:m-click on:m-keydown {...$$restProps}> | ||
<slot cancel={$cancel} /> | ||
</button> | ||
{/if} |
20 changes: 16 additions & 4 deletions
20
src/lib/primitives/alert-dialog/components/AlertDialogContent.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
<script lang="ts"> | ||
import { melt } from "@melt-ui/svelte"; | ||
import type { Transition } from "$internal/index.js"; | ||
import { ctx } from "../ctx.js"; | ||
import type { ContentProps } from "../types.js"; | ||
type $$Props = ContentProps; | ||
type T = $$Generic<Transition>; | ||
type $$Props = ContentProps<T>; | ||
export let transition: ContentProps<T>["transition"] = undefined; | ||
export let transitionConfig: ContentProps<T>["transitionConfig"] = undefined; | ||
const content = ctx.getContent(); | ||
</script> | ||
|
||
<div use:melt={$content} {...$$restProps}> | ||
<slot /> | ||
</div> | ||
{#if transition} | ||
<div use:melt={$content} {...$$restProps} transition:transition={transitionConfig}> | ||
<slot /> | ||
</div> | ||
{:else} | ||
<div use:melt={$content} {...$$restProps}> | ||
<slot /> | ||
</div> | ||
{/if} |
5 changes: 3 additions & 2 deletions
5
src/lib/primitives/alert-dialog/components/AlertDialogTrigger.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
<script lang="ts"> | ||
import { melt } from "@melt-ui/svelte"; | ||
import { ctx } from "../ctx.js"; | ||
import type { TriggerProps } from "../types.js"; | ||
import type { TriggerEvents, TriggerProps } from "../types.js"; | ||
type $$Props = TriggerProps; | ||
type $$Events = TriggerEvents; | ||
export let asChild = false; | ||
const trigger = ctx.getTrigger(); | ||
</script> | ||
|
||
{#if asChild} | ||
<slot trigger={$trigger} /> | ||
{:else} | ||
<button use:melt={$trigger} {...$$restProps}> | ||
<button use:melt={$trigger} on:click on:keydown on:m-click on:m-keydown {...$$restProps}> | ||
<slot trigger={$trigger} /> | ||
</button> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.