@profidev/pleiades 1.7.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/command/command-input.svelte +6 -3
- package/dist/components/ui/field/field-label.svelte +1 -1
- package/dist/components/ui/field/field-title.svelte +1 -1
- package/dist/components/ui/slider/slider.svelte +1 -1
- package/dist/components/ui/tooltip/tooltip.svelte +1 -4
- package/dist/components/ui-extra/alert-dialog/alert-dialog-action.svelte +40 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-action.svelte.d.ts +10 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-cancel.svelte +31 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-cancel.svelte.d.ts +9 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-content.svelte +38 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-content.svelte.d.ts +11 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-description.svelte +20 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-description.svelte.d.ts +4 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-footer.svelte +23 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-footer.svelte.d.ts +5 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-header.svelte +23 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-header.svelte.d.ts +5 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-media.svelte +23 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-media.svelte.d.ts +5 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-overlay.svelte +20 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-overlay.svelte.d.ts +4 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-portal.svelte +7 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-portal.svelte.d.ts +3 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-title.svelte +20 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-title.svelte.d.ts +4 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-trigger.svelte +14 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog-trigger.svelte.d.ts +4 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog.svelte +10 -0
- package/dist/components/ui-extra/alert-dialog/alert-dialog.svelte.d.ts +3 -0
- package/dist/components/ui-extra/alert-dialog/index.d.ts +13 -0
- package/dist/components/ui-extra/alert-dialog/index.js +15 -0
- package/dist/components/ui-extra/button-group/button-group-separator.svelte +23 -0
- package/dist/components/ui-extra/button-group/button-group-separator.svelte.d.ts +13 -0
- package/dist/components/ui-extra/button-group/button-group-text.svelte +31 -0
- package/dist/components/ui-extra/button-group/button-group-text.svelte.d.ts +11 -0
- package/dist/components/ui-extra/button-group/button-group.svelte +48 -0
- package/dist/components/ui-extra/button-group/button-group.svelte.d.ts +26 -0
- package/dist/components/ui-extra/button-group/index.d.ts +4 -0
- package/dist/components/ui-extra/button-group/index.js +6 -0
- package/dist/components/ui-extra/confirm-delete-dialog/confirm-delete-dialog.svelte +131 -0
- package/dist/components/ui-extra/confirm-delete-dialog/confirm-delete-dialog.svelte.d.ts +35 -0
- package/dist/components/ui-extra/confirm-delete-dialog/index.d.ts +2 -0
- package/dist/components/ui-extra/confirm-delete-dialog/index.js +2 -0
- package/dist/components/ui-extra/github-button/github-button.svelte +81 -0
- package/dist/components/ui-extra/github-button/github-button.svelte.d.ts +13 -0
- package/dist/components/ui-extra/github-button/index.d.ts +20 -0
- package/dist/components/ui-extra/github-button/index.js +27 -0
- package/dist/components/ui-extra/select/index.d.ts +12 -0
- package/dist/components/ui-extra/select/index.js +14 -0
- package/dist/components/ui-extra/select/select-content.svelte +45 -0
- package/dist/components/ui-extra/select/select-content.svelte.d.ts +11 -0
- package/dist/components/ui-extra/select/select-group-heading.svelte +21 -0
- package/dist/components/ui-extra/select/select-group-heading.svelte.d.ts +10 -0
- package/dist/components/ui-extra/select/select-group.svelte +17 -0
- package/dist/components/ui-extra/select/select-group.svelte.d.ts +4 -0
- package/dist/components/ui-extra/select/select-item.svelte +38 -0
- package/dist/components/ui-extra/select/select-item.svelte.d.ts +4 -0
- package/dist/components/ui-extra/select/select-label.svelte +20 -0
- package/dist/components/ui-extra/select/select-label.svelte.d.ts +6 -0
- package/dist/components/ui-extra/select/select-portal.svelte +7 -0
- package/dist/components/ui-extra/select/select-portal.svelte.d.ts +3 -0
- package/dist/components/ui-extra/select/select-scroll-down-button.svelte +23 -0
- package/dist/components/ui-extra/select/select-scroll-down-button.svelte.d.ts +4 -0
- package/dist/components/ui-extra/select/select-scroll-up-button.svelte +23 -0
- package/dist/components/ui-extra/select/select-scroll-up-button.svelte.d.ts +4 -0
- package/dist/components/ui-extra/select/select-separator.svelte +18 -0
- package/dist/components/ui-extra/select/select-separator.svelte.d.ts +4 -0
- package/dist/components/ui-extra/select/select-trigger.svelte +29 -0
- package/dist/components/ui-extra/select/select-trigger.svelte.d.ts +8 -0
- package/dist/components/ui-extra/select/select.svelte +11 -0
- package/dist/components/ui-extra/select/select.svelte.d.ts +3 -0
- package/dist/components/ui-extra/separator/index.d.ts +2 -0
- package/dist/components/ui-extra/separator/index.js +4 -0
- package/dist/components/ui-extra/separator/separator.svelte +23 -0
- package/dist/components/ui-extra/separator/separator.svelte.d.ts +4 -0
- package/dist/components/ui-extra/split-button/index.d.ts +14 -0
- package/dist/components/ui-extra/split-button/index.js +9 -0
- package/dist/components/ui-extra/split-button/split-button-action.svelte +41 -0
- package/dist/components/ui-extra/split-button/split-button-action.svelte.d.ts +9 -0
- package/dist/components/ui-extra/split-button/split-button-content.svelte +19 -0
- package/dist/components/ui-extra/split-button/split-button-content.svelte.d.ts +6 -0
- package/dist/components/ui-extra/split-button/split-button-select-action.svelte +54 -0
- package/dist/components/ui-extra/split-button/split-button-select-action.svelte.d.ts +6 -0
- package/dist/components/ui-extra/split-button/split-button-select-trigger.svelte +47 -0
- package/dist/components/ui-extra/split-button/split-button-select-trigger.svelte.d.ts +10 -0
- package/dist/components/ui-extra/split-button/split-button-select.svelte +31 -0
- package/dist/components/ui-extra/split-button/split-button-select.svelte.d.ts +6 -0
- package/dist/components/ui-extra/split-button/split-button.svelte +53 -0
- package/dist/components/ui-extra/split-button/split-button.svelte.d.ts +17 -0
- package/dist/components/ui-extra/split-button/split-button.svelte.js +82 -0
- package/package.json +47 -19
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import Root, { buttonGroupVariants } from './button-group.svelte';
|
|
2
|
+
import Text from './button-group-text.svelte';
|
|
3
|
+
import Separator from './button-group-separator.svelte';
|
|
4
|
+
export { Root, Text, Separator, buttonGroupVariants,
|
|
5
|
+
//
|
|
6
|
+
Root as ButtonGroup, Text as ButtonGroupText, Separator as ButtonGroupSeparator };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
class ConfirmDeleteDialogState {
|
|
3
|
+
open = $state(false);
|
|
4
|
+
inputText = $state('');
|
|
5
|
+
options = $state<ConfirmDeleteOptions | null>(null);
|
|
6
|
+
loading = $state(false);
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
this.confirm = this.confirm.bind(this);
|
|
10
|
+
this.cancel = this.cancel.bind(this);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
newConfirmation(options: ConfirmDeleteOptions) {
|
|
14
|
+
this.reset();
|
|
15
|
+
this.options = options;
|
|
16
|
+
this.open = true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
reset() {
|
|
20
|
+
this.open = false;
|
|
21
|
+
this.inputText = '';
|
|
22
|
+
this.options = null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
confirm() {
|
|
26
|
+
if (this.options?.input) {
|
|
27
|
+
if (this.inputText !== this.options.input.confirmationText) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
this.loading = true;
|
|
33
|
+
this.options
|
|
34
|
+
?.onConfirm()
|
|
35
|
+
.then(() => {
|
|
36
|
+
this.open = false;
|
|
37
|
+
})
|
|
38
|
+
.finally(() => {
|
|
39
|
+
this.loading = false;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
cancel() {
|
|
44
|
+
this.options?.onCancel?.();
|
|
45
|
+
this.open = false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const dialogState = new ConfirmDeleteDialogState();
|
|
50
|
+
|
|
51
|
+
export type ConfirmDeleteOptions = {
|
|
52
|
+
title: string;
|
|
53
|
+
description: string;
|
|
54
|
+
skipConfirmation?: boolean;
|
|
55
|
+
input?: {
|
|
56
|
+
confirmationText: string;
|
|
57
|
+
};
|
|
58
|
+
confirm?: {
|
|
59
|
+
text?: string;
|
|
60
|
+
};
|
|
61
|
+
cancel?: {
|
|
62
|
+
text?: string;
|
|
63
|
+
};
|
|
64
|
+
onConfirm: () => Promise<unknown>;
|
|
65
|
+
onCancel?: () => void;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export function confirmDelete(options: ConfirmDeleteOptions) {
|
|
69
|
+
if (options.skipConfirmation) {
|
|
70
|
+
options.onConfirm();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
dialogState.newConfirmation(options);
|
|
75
|
+
}
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<script lang="ts">
|
|
79
|
+
import * as AlertDialog from '../alert-dialog';
|
|
80
|
+
import { Input } from '../input';
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<AlertDialog.Root bind:open={dialogState.open}>
|
|
84
|
+
<AlertDialog.Content>
|
|
85
|
+
<form
|
|
86
|
+
method="POST"
|
|
87
|
+
onsubmit={(e) => {
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
dialogState.confirm();
|
|
90
|
+
}}
|
|
91
|
+
class="flex flex-col gap-4"
|
|
92
|
+
>
|
|
93
|
+
<AlertDialog.Header>
|
|
94
|
+
<AlertDialog.Title>
|
|
95
|
+
{dialogState.options?.title}
|
|
96
|
+
</AlertDialog.Title>
|
|
97
|
+
<AlertDialog.Description>
|
|
98
|
+
{dialogState.options?.description}
|
|
99
|
+
</AlertDialog.Description>
|
|
100
|
+
</AlertDialog.Header>
|
|
101
|
+
{#if dialogState.options?.input}
|
|
102
|
+
<Input
|
|
103
|
+
bind:value={dialogState.inputText}
|
|
104
|
+
placeholder={`Enter \"${dialogState.options.input.confirmationText}\" to confirm.`}
|
|
105
|
+
onkeydown={(e) => {
|
|
106
|
+
if (e.key === 'Enter') {
|
|
107
|
+
// for some reason without this the form will submit and the dialog will close immediately
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
dialogState.confirm();
|
|
110
|
+
}
|
|
111
|
+
}}
|
|
112
|
+
/>
|
|
113
|
+
{/if}
|
|
114
|
+
<AlertDialog.Footer>
|
|
115
|
+
<AlertDialog.Cancel type="button" onclick={dialogState.cancel}>
|
|
116
|
+
{dialogState.options?.cancel?.text ?? 'Cancel'}
|
|
117
|
+
</AlertDialog.Cancel>
|
|
118
|
+
<AlertDialog.Action
|
|
119
|
+
type="submit"
|
|
120
|
+
variant="destructive"
|
|
121
|
+
loading={dialogState.loading}
|
|
122
|
+
disabled={dialogState.options?.input &&
|
|
123
|
+
dialogState.inputText !==
|
|
124
|
+
dialogState.options.input.confirmationText}
|
|
125
|
+
>
|
|
126
|
+
{dialogState.options?.confirm?.text ?? 'Delete'}
|
|
127
|
+
</AlertDialog.Action>
|
|
128
|
+
</AlertDialog.Footer>
|
|
129
|
+
</form>
|
|
130
|
+
</AlertDialog.Content>
|
|
131
|
+
</AlertDialog.Root>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type ConfirmDeleteOptions = {
|
|
2
|
+
title: string;
|
|
3
|
+
description: string;
|
|
4
|
+
skipConfirmation?: boolean;
|
|
5
|
+
input?: {
|
|
6
|
+
confirmationText: string;
|
|
7
|
+
};
|
|
8
|
+
confirm?: {
|
|
9
|
+
text?: string;
|
|
10
|
+
};
|
|
11
|
+
cancel?: {
|
|
12
|
+
text?: string;
|
|
13
|
+
};
|
|
14
|
+
onConfirm: () => Promise<unknown>;
|
|
15
|
+
onCancel?: () => void;
|
|
16
|
+
};
|
|
17
|
+
export declare function confirmDelete(options: ConfirmDeleteOptions): void;
|
|
18
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
19
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
20
|
+
$$bindings?: Bindings;
|
|
21
|
+
} & Exports;
|
|
22
|
+
(internal: unknown, props: {
|
|
23
|
+
$$events?: Events;
|
|
24
|
+
$$slots?: Slots;
|
|
25
|
+
}): Exports & {
|
|
26
|
+
$set?: any;
|
|
27
|
+
$on?: any;
|
|
28
|
+
};
|
|
29
|
+
z_$$bindings?: Bindings;
|
|
30
|
+
}
|
|
31
|
+
declare const ConfirmDeleteDialog: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
32
|
+
[evt: string]: CustomEvent<any>;
|
|
33
|
+
}, {}, {}, string>;
|
|
34
|
+
type ConfirmDeleteDialog = InstanceType<typeof ConfirmDeleteDialog>;
|
|
35
|
+
export default ConfirmDeleteDialog;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { ButtonProps, Size } from '../../../blocks/button.svelte';
|
|
3
|
+
|
|
4
|
+
export type GithubButtonProps = Omit<
|
|
5
|
+
ButtonProps,
|
|
6
|
+
'href' | 'children' | 'size'
|
|
7
|
+
> & {
|
|
8
|
+
repo: {
|
|
9
|
+
owner: string;
|
|
10
|
+
repo: string;
|
|
11
|
+
};
|
|
12
|
+
stars?: Promise<number> | number;
|
|
13
|
+
starsTweenedDuration?: number;
|
|
14
|
+
size?: Size;
|
|
15
|
+
};
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
import Button, { sizeMap } from '../../../blocks/button.svelte';
|
|
20
|
+
import { cn } from '../../../blocks/utils';
|
|
21
|
+
import { cubicInOut } from 'svelte/easing';
|
|
22
|
+
import { Tween } from 'svelte/motion';
|
|
23
|
+
|
|
24
|
+
let {
|
|
25
|
+
starsTweenedDuration = 5000,
|
|
26
|
+
variant = 'outline',
|
|
27
|
+
repo,
|
|
28
|
+
class: className,
|
|
29
|
+
stars,
|
|
30
|
+
size = 'default',
|
|
31
|
+
...rest
|
|
32
|
+
}: GithubButtonProps = $props();
|
|
33
|
+
|
|
34
|
+
function displayStars(stars: number): string {
|
|
35
|
+
if (stars < 1000) return `${stars.toFixed(0)}`;
|
|
36
|
+
|
|
37
|
+
return `${(parseInt(stars.toFixed(0)) / 1000).toFixed(1)}k`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// svelte-ignore state_referenced_locally
|
|
41
|
+
const starsTweened = new Tween(typeof stars === 'number' ? stars : 0, {
|
|
42
|
+
duration: starsTweenedDuration,
|
|
43
|
+
easing: cubicInOut
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
$effect(() => {
|
|
47
|
+
if (stars instanceof Promise) {
|
|
48
|
+
stars.then((value) => starsTweened.set(value));
|
|
49
|
+
} else if (stars !== undefined) {
|
|
50
|
+
starsTweened.set(stars);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<Button
|
|
56
|
+
href={`https://github.com/${repo.owner}/${repo.repo}`}
|
|
57
|
+
class={cn(
|
|
58
|
+
'[&_span]:text-muted-foreground gap-2 font-mono text-xs',
|
|
59
|
+
className
|
|
60
|
+
)}
|
|
61
|
+
{variant}
|
|
62
|
+
size={stars === undefined ? sizeMap[size].icon : sizeMap[size].normal}
|
|
63
|
+
{...rest}
|
|
64
|
+
>
|
|
65
|
+
<svg
|
|
66
|
+
class={cn('text-foreground size-4 shrink-0 fill-current', className)}
|
|
67
|
+
viewBox="0 0 256 250"
|
|
68
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
69
|
+
preserveAspectRatio="xMidYMid"
|
|
70
|
+
aria-hidden="true"
|
|
71
|
+
>
|
|
72
|
+
<path
|
|
73
|
+
d="M128.001 0C57.317 0 0 57.307 0 128.001c0 56.554 36.676 104.535 87.535 121.46 6.397 1.185 8.746-2.777 8.746-6.158 0-3.052-.12-13.135-.174-23.83-35.61 7.742-43.124-15.103-43.124-15.103-5.823-14.795-14.213-18.73-14.213-18.73-11.613-7.944.876-7.78.876-7.78 12.853.902 19.621 13.19 19.621 13.19 11.417 19.568 29.945 13.911 37.249 10.64 1.149-8.272 4.466-13.92 8.127-17.116-28.431-3.236-58.318-14.212-58.318-63.258 0-13.975 5-25.394 13.188-34.358-1.329-3.224-5.71-16.242 1.24-33.874 0 0 10.749-3.44 35.21 13.121 10.21-2.836 21.16-4.258 32.038-4.307 10.878.049 21.837 1.47 32.066 4.307 24.431-16.56 35.165-13.12 35.165-13.12 6.967 17.63 2.584 30.65 1.255 33.873 8.207 8.964 13.173 20.383 13.173 34.358 0 49.163-29.944 59.988-58.447 63.157 4.591 3.972 8.682 11.762 8.682 23.704 0 17.126-.148 30.91-.148 35.126 0 3.407 2.304 7.398 8.792 6.14C219.37 232.5 256 184.537 256 128.002 256 57.307 198.691 0 128.001 0Zm-80.06 182.34c-.282.636-1.283.827-2.194.39-.929-.417-1.45-1.284-1.15-1.922.276-.655 1.279-.838 2.205-.399.93.418 1.46 1.293 1.139 1.931Zm6.296 5.618c-.61.566-1.804.303-2.614-.591-.837-.892-.994-2.086-.375-2.66.63-.566 1.787-.301 2.626.591.838.903 1 2.088.363 2.66Zm4.32 7.188c-.785.545-2.067.034-2.86-1.104-.784-1.138-.784-2.503.017-3.05.795-.547 2.058-.055 2.861 1.075.782 1.157.782 2.522-.019 3.08Zm7.304 8.325c-.701.774-2.196.566-3.29-.49-1.119-1.032-1.43-2.496-.726-3.27.71-.776 2.213-.558 3.315.49 1.11 1.03 1.45 2.505.701 3.27Zm9.442 2.81c-.31 1.003-1.75 1.459-3.199 1.033-1.448-.439-2.395-1.613-2.103-2.626.301-1.01 1.747-1.484 3.207-1.028 1.446.436 2.396 1.602 2.095 2.622Zm10.744 1.193c.036 1.055-1.193 1.93-2.715 1.95-1.53.034-2.769-.82-2.786-1.86 0-1.065 1.202-1.932 2.733-1.958 1.522-.03 2.768.818 2.768 1.868Zm10.555-.405c.182 1.03-.875 2.088-2.387 2.37-1.485.271-2.861-.365-3.05-1.386-.184-1.056.893-2.114 2.376-2.387 1.514-.263 2.868.356 3.061 1.403Z"
|
|
74
|
+
/>
|
|
75
|
+
</svg>
|
|
76
|
+
{#if stars !== undefined}
|
|
77
|
+
<span aria-label="Stars on GitHub" class="tabular-nums">
|
|
78
|
+
{displayStars(starsTweened.current)}
|
|
79
|
+
</span>
|
|
80
|
+
{/if}
|
|
81
|
+
</Button>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ButtonProps, Size } from '../../../blocks/button.svelte';
|
|
2
|
+
export type GithubButtonProps = Omit<ButtonProps, 'href' | 'children' | 'size'> & {
|
|
3
|
+
repo: {
|
|
4
|
+
owner: string;
|
|
5
|
+
repo: string;
|
|
6
|
+
};
|
|
7
|
+
stars?: Promise<number> | number;
|
|
8
|
+
starsTweenedDuration?: number;
|
|
9
|
+
size?: Size;
|
|
10
|
+
};
|
|
11
|
+
declare const GithubButton: import("svelte").Component<GithubButtonProps, {}, "">;
|
|
12
|
+
type GithubButton = ReturnType<typeof GithubButton>;
|
|
13
|
+
export default GithubButton;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Root from './github-button.svelte';
|
|
2
|
+
/**
|
|
3
|
+
* Get the stars for a GitHub repository using the ungh.cc API.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const stars = await getStars({ owner: 'ieedan', repo: 'shadcn-svelte-extras', fallback: 539 });
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* @param owner - The owner of the repository
|
|
11
|
+
* @param repoName - The name of the repository
|
|
12
|
+
* @param fallback - The fallback value to return if the request fails
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare function getStars({ owner, repo: repoName, fallback }: {
|
|
16
|
+
owner: string;
|
|
17
|
+
repo: string;
|
|
18
|
+
fallback?: number;
|
|
19
|
+
}): Promise<any>;
|
|
20
|
+
export { Root as GitHubButton };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Root from './github-button.svelte';
|
|
2
|
+
/**
|
|
3
|
+
* Get the stars for a GitHub repository using the ungh.cc API.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const stars = await getStars({ owner: 'ieedan', repo: 'shadcn-svelte-extras', fallback: 539 });
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* @param owner - The owner of the repository
|
|
11
|
+
* @param repoName - The name of the repository
|
|
12
|
+
* @param fallback - The fallback value to return if the request fails
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export async function getStars({ owner, repo: repoName, fallback = 0 }) {
|
|
16
|
+
try {
|
|
17
|
+
const response = await fetch(`https://ungh.cc/repos/${owner}/${repoName}`);
|
|
18
|
+
if (!response.ok)
|
|
19
|
+
return fallback;
|
|
20
|
+
const { repo } = await response.json();
|
|
21
|
+
return repo.stars;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return fallback;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export { Root as GitHubButton };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Root from './select.svelte';
|
|
2
|
+
import Group from './select-group.svelte';
|
|
3
|
+
import Label from './select-label.svelte';
|
|
4
|
+
import Item from './select-item.svelte';
|
|
5
|
+
import Content from './select-content.svelte';
|
|
6
|
+
import Trigger from './select-trigger.svelte';
|
|
7
|
+
import Separator from './select-separator.svelte';
|
|
8
|
+
import ScrollDownButton from './select-scroll-down-button.svelte';
|
|
9
|
+
import ScrollUpButton from './select-scroll-up-button.svelte';
|
|
10
|
+
import GroupHeading from './select-group-heading.svelte';
|
|
11
|
+
import Portal from './select-portal.svelte';
|
|
12
|
+
export { Root, Group, Label, Item, Content, Trigger, Separator, ScrollDownButton, ScrollUpButton, GroupHeading, Portal, Root as Select, Group as SelectGroup, Label as SelectLabel, Item as SelectItem, Content as SelectContent, Trigger as SelectTrigger, Separator as SelectSeparator, ScrollDownButton as SelectScrollDownButton, ScrollUpButton as SelectScrollUpButton, GroupHeading as SelectGroupHeading, Portal as SelectPortal };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Root from './select.svelte';
|
|
2
|
+
import Group from './select-group.svelte';
|
|
3
|
+
import Label from './select-label.svelte';
|
|
4
|
+
import Item from './select-item.svelte';
|
|
5
|
+
import Content from './select-content.svelte';
|
|
6
|
+
import Trigger from './select-trigger.svelte';
|
|
7
|
+
import Separator from './select-separator.svelte';
|
|
8
|
+
import ScrollDownButton from './select-scroll-down-button.svelte';
|
|
9
|
+
import ScrollUpButton from './select-scroll-up-button.svelte';
|
|
10
|
+
import GroupHeading from './select-group-heading.svelte';
|
|
11
|
+
import Portal from './select-portal.svelte';
|
|
12
|
+
export { Root, Group, Label, Item, Content, Trigger, Separator, ScrollDownButton, ScrollUpButton, GroupHeading, Portal,
|
|
13
|
+
//
|
|
14
|
+
Root as Select, Group as SelectGroup, Label as SelectLabel, Item as SelectItem, Content as SelectContent, Trigger as SelectTrigger, Separator as SelectSeparator, ScrollDownButton as SelectScrollDownButton, ScrollUpButton as SelectScrollUpButton, GroupHeading as SelectGroupHeading, Portal as SelectPortal };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
3
|
+
import SelectPortal from './select-portal.svelte';
|
|
4
|
+
import SelectScrollUpButton from './select-scroll-up-button.svelte';
|
|
5
|
+
import SelectScrollDownButton from './select-scroll-down-button.svelte';
|
|
6
|
+
import { cn, type WithoutChild } from '../../../blocks/utils.js';
|
|
7
|
+
import type { ComponentProps } from 'svelte';
|
|
8
|
+
import type { WithoutChildrenOrChild } from '../../../blocks/utils.js';
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
ref = $bindable(null),
|
|
12
|
+
class: className,
|
|
13
|
+
sideOffset = 4,
|
|
14
|
+
portalProps,
|
|
15
|
+
children,
|
|
16
|
+
preventScroll = true,
|
|
17
|
+
...restProps
|
|
18
|
+
}: WithoutChild<SelectPrimitive.ContentProps> & {
|
|
19
|
+
portalProps?: WithoutChildrenOrChild<ComponentProps<typeof SelectPortal>>;
|
|
20
|
+
} = $props();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<SelectPortal {...portalProps}>
|
|
24
|
+
<SelectPrimitive.Content
|
|
25
|
+
bind:ref
|
|
26
|
+
{sideOffset}
|
|
27
|
+
{preventScroll}
|
|
28
|
+
data-slot="select-content"
|
|
29
|
+
class={cn(
|
|
30
|
+
'bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 relative isolate z-50 min-w-36 overflow-x-hidden overflow-y-auto rounded-md shadow-md ring-1 duration-100',
|
|
31
|
+
className
|
|
32
|
+
)}
|
|
33
|
+
{...restProps}
|
|
34
|
+
>
|
|
35
|
+
<SelectScrollUpButton />
|
|
36
|
+
<SelectPrimitive.Viewport
|
|
37
|
+
class={cn(
|
|
38
|
+
'h-(--bits-select-anchor-height) w-full min-w-(--bits-select-anchor-width) scroll-my-1'
|
|
39
|
+
)}
|
|
40
|
+
>
|
|
41
|
+
{@render children?.()}
|
|
42
|
+
</SelectPrimitive.Viewport>
|
|
43
|
+
<SelectScrollDownButton />
|
|
44
|
+
</SelectPrimitive.Content>
|
|
45
|
+
</SelectPortal>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
2
|
+
import SelectPortal from './select-portal.svelte';
|
|
3
|
+
import { type WithoutChild } from '../../../blocks/utils.js';
|
|
4
|
+
import type { ComponentProps } from 'svelte';
|
|
5
|
+
import type { WithoutChildrenOrChild } from '../../../blocks/utils.js';
|
|
6
|
+
type $$ComponentProps = WithoutChild<SelectPrimitive.ContentProps> & {
|
|
7
|
+
portalProps?: WithoutChildrenOrChild<ComponentProps<typeof SelectPortal>>;
|
|
8
|
+
};
|
|
9
|
+
declare const SelectContent: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
10
|
+
type SelectContent = ReturnType<typeof SelectContent>;
|
|
11
|
+
export default SelectContent;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../../blocks/utils.js';
|
|
4
|
+
import type { ComponentProps } from 'svelte';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
}: ComponentProps<typeof SelectPrimitive.GroupHeading> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<SelectPrimitive.GroupHeading
|
|
15
|
+
bind:ref
|
|
16
|
+
data-slot="select-group-heading"
|
|
17
|
+
class={cn('text-muted-foreground px-2 py-1.5 text-xs', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
>
|
|
20
|
+
{@render children?.()}
|
|
21
|
+
</SelectPrimitive.GroupHeading>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const SelectGroupHeading: import("svelte").Component<Omit<{}, "child" | "children"> & {
|
|
2
|
+
child?: import("svelte").Snippet<[{
|
|
3
|
+
props: Record<string, unknown>;
|
|
4
|
+
}]> | undefined;
|
|
5
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
6
|
+
style?: import("bits-ui").StyleProperties | string | null | undefined;
|
|
7
|
+
ref?: HTMLElement | null | undefined;
|
|
8
|
+
} & import("bits-ui").Without<import("bits-ui").BitsPrimitiveDivAttributes, import("bits-ui").ComboboxGroupHeadingPropsWithoutHTML>, {}, "ref">;
|
|
9
|
+
type SelectGroupHeading = ReturnType<typeof SelectGroupHeading>;
|
|
10
|
+
export default SelectGroupHeading;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../../blocks/utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: SelectPrimitive.GroupProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<SelectPrimitive.Group
|
|
13
|
+
bind:ref
|
|
14
|
+
data-slot="select-group"
|
|
15
|
+
class={cn('scroll-my-1 p-1', className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
/>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn, type WithoutChild } from '../../../blocks/utils.js';
|
|
4
|
+
import CheckIcon from '@lucide/svelte/icons/check';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
value,
|
|
10
|
+
label,
|
|
11
|
+
children: childrenProp,
|
|
12
|
+
...restProps
|
|
13
|
+
}: WithoutChild<SelectPrimitive.ItemProps> = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<SelectPrimitive.Item
|
|
17
|
+
bind:ref
|
|
18
|
+
{value}
|
|
19
|
+
data-slot="select-item"
|
|
20
|
+
class={cn(
|
|
21
|
+
"focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground focus:bg-accent data-highlighted:bg-accent data-highlighted:text-accent-foreground focus:text-accent-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...restProps}
|
|
25
|
+
>
|
|
26
|
+
{#snippet children({ selected, highlighted })}
|
|
27
|
+
<span class="absolute end-2 flex size-3.5 items-center justify-center">
|
|
28
|
+
{#if selected}
|
|
29
|
+
<CheckIcon class="cn-select-item-indicator-icon" />
|
|
30
|
+
{/if}
|
|
31
|
+
</span>
|
|
32
|
+
{#if childrenProp}
|
|
33
|
+
{@render childrenProp({ selected, highlighted })}
|
|
34
|
+
{:else}
|
|
35
|
+
{label || value}
|
|
36
|
+
{/if}
|
|
37
|
+
{/snippet}
|
|
38
|
+
</SelectPrimitive.Item>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '../../../blocks/utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {} = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="select-label"
|
|
16
|
+
class={cn('text-muted-foreground px-2 py-1.5 text-xs', className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type WithElementRef } from '../../../blocks/utils.js';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {};
|
|
4
|
+
declare const SelectLabel: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
5
|
+
type SelectLabel = ReturnType<typeof SelectLabel>;
|
|
6
|
+
export default SelectLabel;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn, type WithoutChildrenOrChild } from '../../../blocks/utils.js';
|
|
4
|
+
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithoutChildrenOrChild<SelectPrimitive.ScrollDownButtonProps> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<SelectPrimitive.ScrollDownButton
|
|
14
|
+
bind:ref
|
|
15
|
+
data-slot="select-scroll-down-button"
|
|
16
|
+
class={cn(
|
|
17
|
+
"bg-popover bottom-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...restProps}
|
|
21
|
+
>
|
|
22
|
+
<ChevronDownIcon />
|
|
23
|
+
</SelectPrimitive.ScrollDownButton>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
2
|
+
declare const SelectScrollDownButton: import("svelte").Component<Omit<Omit<SelectPrimitive.ScrollDownButtonProps, "child">, "children">, {}, "ref">;
|
|
3
|
+
type SelectScrollDownButton = ReturnType<typeof SelectScrollDownButton>;
|
|
4
|
+
export default SelectScrollDownButton;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn, type WithoutChildrenOrChild } from '../../../blocks/utils.js';
|
|
4
|
+
import ChevronUpIcon from '@lucide/svelte/icons/chevron-up';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithoutChildrenOrChild<SelectPrimitive.ScrollUpButtonProps> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<SelectPrimitive.ScrollUpButton
|
|
14
|
+
bind:ref
|
|
15
|
+
data-slot="select-scroll-up-button"
|
|
16
|
+
class={cn(
|
|
17
|
+
"bg-popover top-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...restProps}
|
|
21
|
+
>
|
|
22
|
+
<ChevronUpIcon />
|
|
23
|
+
</SelectPrimitive.ScrollUpButton>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
2
|
+
declare const SelectScrollUpButton: import("svelte").Component<Omit<Omit<SelectPrimitive.ScrollUpButtonProps, "child">, "children">, {}, "ref">;
|
|
3
|
+
type SelectScrollUpButton = ReturnType<typeof SelectScrollUpButton>;
|
|
4
|
+
export default SelectScrollUpButton;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Separator as SeparatorPrimitive } from 'bits-ui';
|
|
3
|
+
import { Separator } from '../separator/index.js';
|
|
4
|
+
import { cn } from '../../../blocks/utils.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: SeparatorPrimitive.RootProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Separator
|
|
14
|
+
bind:ref
|
|
15
|
+
data-slot="select-separator"
|
|
16
|
+
class={cn('bg-border pointer-events-none -mx-1 my-1 h-px', className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
/>
|