-
Notifications
You must be signed in to change notification settings - Fork 37
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 #276 from Muhammed-Rahif/alpha
Updates from alpha
- Loading branch information
Showing
26 changed files
with
403 additions
and
57 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
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
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
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<script module> | ||
import { writable } from 'svelte/store'; | ||
export type Status = 'save' | 'dont-save' | 'cancel'; | ||
const open = writable(false); | ||
const resolve = writable<(value: Status) => void>(() => {}); | ||
const fileName = writable(''); | ||
export function openEditorCloseConfirmationDialog({ | ||
fileName: fl | ||
}: { | ||
fileName: string; | ||
}): Promise<Status> { | ||
fileName.set(fl); | ||
open.set(true); | ||
return new Promise((res) => { | ||
resolve.set(res); | ||
}); | ||
} | ||
</script> | ||
|
||
<script lang="ts"> | ||
import * as AlertDialog from '@/components/ui/alert-dialog'; | ||
import Button from '@/components/ui/button/button.svelte'; | ||
function onSave() { | ||
$resolve('save'); | ||
open.set(false); | ||
} | ||
function onDontSave(e: Event) { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
$resolve('dont-save'); | ||
open.set(false); | ||
} | ||
function onCancel() { | ||
$resolve('cancel'); | ||
open.set(false); | ||
} | ||
function onOpenChange(op: boolean) { | ||
open.set(op); | ||
if (op == false) { | ||
$resolve('cancel'); | ||
} | ||
} | ||
</script> | ||
|
||
<AlertDialog.Root open={$open} {onOpenChange}> | ||
<AlertDialog.Content> | ||
<AlertDialog.Header> | ||
<AlertDialog.Title>Unsaved Changes</AlertDialog.Title> | ||
<AlertDialog.Description> | ||
The contents from "{$fileName}" are not saved to local file. Do you want to save it to a | ||
file before closing this editor? If you don't save, your changes will be lost. | ||
</AlertDialog.Description> | ||
</AlertDialog.Header> | ||
<AlertDialog.Footer> | ||
<AlertDialog.Cancel onclick={onCancel}>Cancel</AlertDialog.Cancel> | ||
<Button variant="outline" onclick={onDontSave}>Don't Save</Button> | ||
<AlertDialog.Action onclick={onSave}>Save</AlertDialog.Action> | ||
</AlertDialog.Footer> | ||
</AlertDialog.Content> | ||
</AlertDialog.Root> |
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
13 changes: 13 additions & 0 deletions
13
src/lib/components/ui/alert-dialog/alert-dialog-action.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script lang="ts"> | ||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui'; | ||
import { buttonVariants } from '@/components/ui/button/index.js'; | ||
import { cn } from '@/utils.js'; | ||
let { | ||
class: className, | ||
ref = $bindable(null), | ||
...restProps | ||
}: AlertDialogPrimitive.ActionProps = $props(); | ||
</script> | ||
|
||
<AlertDialogPrimitive.Action bind:ref class={cn(buttonVariants(), className)} {...restProps} /> |
17 changes: 17 additions & 0 deletions
17
src/lib/components/ui/alert-dialog/alert-dialog-cancel.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script lang="ts"> | ||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui'; | ||
import { buttonVariants } from '@/components/ui/button/index.js'; | ||
import { cn } from '@/utils.js'; | ||
let { | ||
class: className, | ||
ref = $bindable(null), | ||
...restProps | ||
}: AlertDialogPrimitive.CancelProps = $props(); | ||
</script> | ||
|
||
<AlertDialogPrimitive.Cancel | ||
bind:ref | ||
class={cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', className)} | ||
{...restProps} | ||
/> |
26 changes: 26 additions & 0 deletions
26
src/lib/components/ui/alert-dialog/alert-dialog-content.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<script lang="ts"> | ||
import { AlertDialog as AlertDialogPrimitive, type WithoutChild } from 'bits-ui'; | ||
import AlertDialogOverlay from './alert-dialog-overlay.svelte'; | ||
import { cn } from '@/utils.js'; | ||
let { | ||
ref = $bindable(null), | ||
class: className, | ||
portalProps, | ||
...restProps | ||
}: WithoutChild<AlertDialogPrimitive.ContentProps> & { | ||
portalProps?: AlertDialogPrimitive.PortalProps; | ||
} = $props(); | ||
</script> | ||
|
||
<AlertDialogPrimitive.Portal {...portalProps}> | ||
<AlertDialogOverlay /> | ||
<AlertDialogPrimitive.Content | ||
bind:ref | ||
class={cn( | ||
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg', | ||
className | ||
)} | ||
{...restProps} | ||
/> | ||
</AlertDialogPrimitive.Portal> |
Oops, something went wrong.