sv5ui-plus 4.0.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/LICENSE +21 -0
- package/README.md +62 -0
- package/dist/adapters/notify.d.ts +29 -0
- package/dist/adapters/notify.js +88 -0
- package/dist/compat.d.ts +6 -0
- package/dist/compat.js +6 -0
- package/dist/components/BentoGrid/BentoCard.svelte +45 -0
- package/dist/components/BentoGrid/BentoCard.svelte.d.ts +4 -0
- package/dist/components/BentoGrid/BentoGrid.svelte +9 -0
- package/dist/components/BentoGrid/BentoGrid.svelte.d.ts +4 -0
- package/dist/components/BentoGrid/bento-grid.types.d.ts +47 -0
- package/dist/components/BentoGrid/bento-grid.types.js +1 -0
- package/dist/components/BentoGrid/bento-grid.variants.d.ts +30 -0
- package/dist/components/BentoGrid/bento-grid.variants.js +16 -0
- package/dist/components/BentoGrid/index.d.ts +5 -0
- package/dist/components/BentoGrid/index.js +5 -0
- package/dist/components/Chart/Chart.svelte +62 -0
- package/dist/components/Chart/Chart.svelte.d.ts +4 -0
- package/dist/components/Chart/chart.types.d.ts +16 -0
- package/dist/components/Chart/chart.types.js +1 -0
- package/dist/components/Chart/index.d.ts +2 -0
- package/dist/components/Chart/index.js +2 -0
- package/dist/components/Chat/ChatBubble.svelte +30 -0
- package/dist/components/Chat/ChatBubble.svelte.d.ts +4 -0
- package/dist/components/Chat/ChatInput.svelte +50 -0
- package/dist/components/Chat/ChatInput.svelte.d.ts +4 -0
- package/dist/components/Chat/ChatMessage.svelte +15 -0
- package/dist/components/Chat/ChatMessage.svelte.d.ts +4 -0
- package/dist/components/Chat/chat.types.d.ts +63 -0
- package/dist/components/Chat/chat.types.js +1 -0
- package/dist/components/Chat/chat.variants.d.ts +117 -0
- package/dist/components/Chat/chat.variants.js +47 -0
- package/dist/components/Chat/index.d.ts +6 -0
- package/dist/components/Chat/index.js +6 -0
- package/dist/components/CodeBlock/CodeBlock.svelte +66 -0
- package/dist/components/CodeBlock/CodeBlock.svelte.d.ts +5 -0
- package/dist/components/CodeBlock/code-block.types.d.ts +15 -0
- package/dist/components/CodeBlock/code-block.types.js +1 -0
- package/dist/components/CodeBlock/code-block.variants.d.ts +288 -0
- package/dist/components/CodeBlock/code-block.variants.js +69 -0
- package/dist/components/CodeBlock/index.d.ts +2 -0
- package/dist/components/CodeBlock/index.js +1 -0
- package/dist/components/ColorPicker/ColorPicker.svelte +109 -0
- package/dist/components/ColorPicker/ColorPicker.svelte.d.ts +4 -0
- package/dist/components/ColorPicker/color-picker.types.d.ts +26 -0
- package/dist/components/ColorPicker/color-picker.types.js +1 -0
- package/dist/components/ColorPicker/color-picker.variants.d.ts +69 -0
- package/dist/components/ColorPicker/color-picker.variants.js +13 -0
- package/dist/components/ColorPicker/index.d.ts +4 -0
- package/dist/components/ColorPicker/index.js +4 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.svelte +175 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.svelte.d.ts +10 -0
- package/dist/components/ConfirmDialog/confirm.d.ts +9 -0
- package/dist/components/ConfirmDialog/confirm.js +24 -0
- package/dist/components/ConfirmDialog/confirm.types.d.ts +21 -0
- package/dist/components/ConfirmDialog/confirm.types.js +1 -0
- package/dist/components/ConfirmDialog/index.d.ts +4 -0
- package/dist/components/ConfirmDialog/index.js +2 -0
- package/dist/components/Fonts/Fonts.svelte +32 -0
- package/dist/components/Fonts/Fonts.svelte.d.ts +5 -0
- package/dist/components/Fonts/fonts.d.ts +12 -0
- package/dist/components/Fonts/fonts.js +126 -0
- package/dist/components/Fonts/fonts.types.d.ts +40 -0
- package/dist/components/Fonts/fonts.types.js +1 -0
- package/dist/components/Fonts/index.d.ts +3 -0
- package/dist/components/Fonts/index.js +2 -0
- package/dist/components/List/List.svelte +14 -0
- package/dist/components/List/List.svelte.d.ts +4 -0
- package/dist/components/List/ListItem.svelte +64 -0
- package/dist/components/List/ListItem.svelte.d.ts +4 -0
- package/dist/components/List/index.d.ts +5 -0
- package/dist/components/List/index.js +5 -0
- package/dist/components/List/list.types.d.ts +62 -0
- package/dist/components/List/list.types.js +1 -0
- package/dist/components/List/list.variants.d.ts +99 -0
- package/dist/components/List/list.variants.js +42 -0
- package/dist/components/LocaleButton/LocaleButton.svelte +181 -0
- package/dist/components/LocaleButton/LocaleButton.svelte.d.ts +5 -0
- package/dist/components/LocaleButton/index.d.ts +2 -0
- package/dist/components/LocaleButton/index.js +1 -0
- package/dist/components/LocaleButton/locale-button.types.d.ts +208 -0
- package/dist/components/LocaleButton/locale-button.types.js +1 -0
- package/dist/components/LocaleButton/locale-button.variants.d.ts +245 -0
- package/dist/components/LocaleButton/locale-button.variants.js +98 -0
- package/dist/components/Marquee/Marquee.svelte +50 -0
- package/dist/components/Marquee/Marquee.svelte.d.ts +4 -0
- package/dist/components/Marquee/index.d.ts +4 -0
- package/dist/components/Marquee/index.js +4 -0
- package/dist/components/Marquee/marquee.types.d.ts +38 -0
- package/dist/components/Marquee/marquee.types.js +1 -0
- package/dist/components/Marquee/marquee.variants.d.ts +78 -0
- package/dist/components/Marquee/marquee.variants.js +28 -0
- package/dist/components/NavigationMenu/NavigationMenu.svelte +623 -0
- package/dist/components/NavigationMenu/NavigationMenu.svelte.d.ts +5 -0
- package/dist/components/NavigationMenu/index.d.ts +2 -0
- package/dist/components/NavigationMenu/index.js +1 -0
- package/dist/components/NavigationMenu/navigation-menu.types.d.ts +245 -0
- package/dist/components/NavigationMenu/navigation-menu.types.js +1 -0
- package/dist/components/NavigationMenu/navigation-menu.variants.d.ts +543 -0
- package/dist/components/NavigationMenu/navigation-menu.variants.js +287 -0
- package/dist/components/NumberTicker/NumberTicker.svelte +59 -0
- package/dist/components/NumberTicker/NumberTicker.svelte.d.ts +4 -0
- package/dist/components/NumberTicker/index.d.ts +4 -0
- package/dist/components/NumberTicker/index.js +4 -0
- package/dist/components/NumberTicker/number-ticker.types.d.ts +26 -0
- package/dist/components/NumberTicker/number-ticker.types.js +1 -0
- package/dist/components/NumberTicker/number-ticker.variants.d.ts +27 -0
- package/dist/components/NumberTicker/number-ticker.variants.js +6 -0
- package/dist/components/PasswordInput/PasswordInput.svelte +182 -0
- package/dist/components/PasswordInput/PasswordInput.svelte.d.ts +5 -0
- package/dist/components/PasswordInput/index.d.ts +2 -0
- package/dist/components/PasswordInput/index.js +1 -0
- package/dist/components/PasswordInput/password-input.types.d.ts +111 -0
- package/dist/components/PasswordInput/password-input.types.js +1 -0
- package/dist/components/PasswordInput/password-input.variants.d.ts +273 -0
- package/dist/components/PasswordInput/password-input.variants.js +105 -0
- package/dist/components/Prose/Prose.svelte +13 -0
- package/dist/components/Prose/Prose.svelte.d.ts +4 -0
- package/dist/components/Prose/index.d.ts +4 -0
- package/dist/components/Prose/index.js +4 -0
- package/dist/components/Prose/prose.types.d.ts +22 -0
- package/dist/components/Prose/prose.types.js +1 -0
- package/dist/components/Prose/prose.variants.d.ts +45 -0
- package/dist/components/Prose/prose.variants.js +45 -0
- package/dist/components/Resizable/Resizable.svelte +9 -0
- package/dist/components/Resizable/Resizable.svelte.d.ts +4 -0
- package/dist/components/Resizable/index.d.ts +4 -0
- package/dist/components/Resizable/index.js +4 -0
- package/dist/components/Resizable/resizable.types.d.ts +18 -0
- package/dist/components/Resizable/resizable.types.js +1 -0
- package/dist/components/Resizable/resizable.variants.d.ts +48 -0
- package/dist/components/Resizable/resizable.variants.js +17 -0
- package/dist/components/ScrollArea/ScrollArea.svelte +54 -0
- package/dist/components/ScrollArea/ScrollArea.svelte.d.ts +4 -0
- package/dist/components/ScrollArea/index.d.ts +4 -0
- package/dist/components/ScrollArea/index.js +4 -0
- package/dist/components/ScrollArea/scroll-area.types.d.ts +27 -0
- package/dist/components/ScrollArea/scroll-area.types.js +1 -0
- package/dist/components/ScrollArea/scroll-area.variants.d.ts +45 -0
- package/dist/components/ScrollArea/scroll-area.variants.js +27 -0
- package/dist/components/Search/Search.svelte +94 -0
- package/dist/components/Search/Search.svelte.d.ts +4 -0
- package/dist/components/Search/index.d.ts +2 -0
- package/dist/components/Search/index.js +1 -0
- package/dist/components/Search/search.types.d.ts +40 -0
- package/dist/components/Search/search.types.js +1 -0
- package/dist/components/SortableGroup/SortableGroup.svelte +53 -0
- package/dist/components/SortableGroup/SortableGroup.svelte.d.ts +13 -0
- package/dist/components/SortableGroup/index.d.ts +1 -0
- package/dist/components/SortableGroup/index.js +1 -0
- package/dist/components/SortableList/SortableList.svelte +81 -0
- package/dist/components/SortableList/SortableList.svelte.d.ts +26 -0
- package/dist/components/SortableList/index.d.ts +2 -0
- package/dist/components/SortableList/index.js +1 -0
- package/dist/components/SortableList/sortable-list.types.d.ts +21 -0
- package/dist/components/SortableList/sortable-list.types.js +1 -0
- package/dist/components/Spotlight/Spotlight.svelte +31 -0
- package/dist/components/Spotlight/Spotlight.svelte.d.ts +4 -0
- package/dist/components/Spotlight/index.d.ts +4 -0
- package/dist/components/Spotlight/index.js +4 -0
- package/dist/components/Spotlight/spotlight.types.d.ts +22 -0
- package/dist/components/Spotlight/spotlight.types.js +1 -0
- package/dist/components/Spotlight/spotlight.variants.d.ts +39 -0
- package/dist/components/Spotlight/spotlight.variants.js +8 -0
- package/dist/components/TableBulkActionBar/TableBulkActionBar.svelte +38 -0
- package/dist/components/TableBulkActionBar/TableBulkActionBar.svelte.d.ts +5 -0
- package/dist/components/TableBulkActionBar/index.d.ts +2 -0
- package/dist/components/TableBulkActionBar/index.js +1 -0
- package/dist/components/TableBulkActionBar/table-bulk-action-bar.types.d.ts +31 -0
- package/dist/components/TableBulkActionBar/table-bulk-action-bar.types.js +1 -0
- package/dist/components/TableBulkActionBar/table-bulk-action-bar.variants.d.ts +52 -0
- package/dist/components/TableBulkActionBar/table-bulk-action-bar.variants.js +10 -0
- package/dist/components/TreeView/TreeView.svelte +95 -0
- package/dist/components/TreeView/TreeView.svelte.d.ts +4 -0
- package/dist/components/TreeView/index.d.ts +4 -0
- package/dist/components/TreeView/index.js +3 -0
- package/dist/components/TreeView/tree-view.types.d.ts +68 -0
- package/dist/components/TreeView/tree-view.types.js +1 -0
- package/dist/components/TreeView/tree-view.variants.d.ts +69 -0
- package/dist/components/TreeView/tree-view.variants.js +30 -0
- package/dist/config.d.ts +91 -0
- package/dist/config.js +124 -0
- package/dist/editor.d.ts +2 -0
- package/dist/editor.js +2 -0
- package/dist/form/resolve-form-field-name.d.ts +5 -0
- package/dist/form/resolve-form-field-name.js +11 -0
- package/dist/hooks/internal/DragDropProviderScope.svelte +29 -0
- package/dist/hooks/internal/DragDropProviderScope.svelte.d.ts +7 -0
- package/dist/hooks/internal/SortableProvider.svelte +68 -0
- package/dist/hooks/internal/SortableProvider.svelte.d.ts +30 -0
- package/dist/hooks/internal/drag-drop-context.d.ts +12 -0
- package/dist/hooks/internal/drag-drop-context.js +1 -0
- package/dist/hooks/internal/sortable-context.d.ts +26 -0
- package/dist/hooks/internal/sortable-context.js +2 -0
- package/dist/hooks/useDragDrop/index.d.ts +1 -0
- package/dist/hooks/useDragDrop/index.js +1 -0
- package/dist/hooks/useDragDrop/useDragDrop.svelte.d.ts +40 -0
- package/dist/hooks/useDragDrop/useDragDrop.svelte.js +128 -0
- package/dist/hooks/useSortable/index.d.ts +2 -0
- package/dist/hooks/useSortable/index.js +2 -0
- package/dist/hooks/useSortable/sortable-utils.d.ts +1 -0
- package/dist/hooks/useSortable/sortable-utils.js +13 -0
- package/dist/hooks/useSortable/useSortable.svelte.d.ts +60 -0
- package/dist/hooks/useSortable/useSortable.svelte.js +151 -0
- package/dist/hooks/utils.d.ts +1 -0
- package/dist/hooks/utils.js +3 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +30 -0
- package/dist/mcp/cursor.mcp.json +12 -0
- package/dist/mcp/install-template.mjs +55 -0
- package/dist/mcp/server.mjs +338 -0
- package/dist/mcp/sv5ui-plus-docs.data.json +17 -0
- package/dist/theme.css +64 -0
- package/package.json +176 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const resizableVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
direction: {
|
|
4
|
+
horizontal: {
|
|
5
|
+
base: string;
|
|
6
|
+
};
|
|
7
|
+
vertical: {
|
|
8
|
+
base: string;
|
|
9
|
+
};
|
|
10
|
+
both: {
|
|
11
|
+
base: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}, {
|
|
15
|
+
base: string;
|
|
16
|
+
handle: string;
|
|
17
|
+
}, undefined, {
|
|
18
|
+
direction: {
|
|
19
|
+
horizontal: {
|
|
20
|
+
base: string;
|
|
21
|
+
};
|
|
22
|
+
vertical: {
|
|
23
|
+
base: string;
|
|
24
|
+
};
|
|
25
|
+
both: {
|
|
26
|
+
base: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}, {
|
|
30
|
+
base: string;
|
|
31
|
+
handle: string;
|
|
32
|
+
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
33
|
+
direction: {
|
|
34
|
+
horizontal: {
|
|
35
|
+
base: string;
|
|
36
|
+
};
|
|
37
|
+
vertical: {
|
|
38
|
+
base: string;
|
|
39
|
+
};
|
|
40
|
+
both: {
|
|
41
|
+
base: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}, {
|
|
45
|
+
base: string;
|
|
46
|
+
handle: string;
|
|
47
|
+
}>>;
|
|
48
|
+
export type ResizableVariantProps = VariantProps<typeof resizableVariants>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const resizableVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
base: 'relative overflow-auto border border-outline-variant bg-surface-50 dark:bg-surface-900',
|
|
5
|
+
handle: 'absolute right-0 bottom-0 w-4 h-4 cursor-se-resize flex items-center justify-center opacity-0 hover:opacity-100 transition-opacity'
|
|
6
|
+
},
|
|
7
|
+
variants: {
|
|
8
|
+
direction: {
|
|
9
|
+
horizontal: { base: 'resize-x' },
|
|
10
|
+
vertical: { base: 'resize-y' },
|
|
11
|
+
both: { base: 'resize' }
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
direction: 'both'
|
|
16
|
+
}
|
|
17
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts">import { twMerge } from "tailwind-merge";
|
|
2
|
+
import { scrollAreaVariants } from "./scroll-area.variants.js";
|
|
3
|
+
let { orientation = "vertical", hideScrollbar = false, class: className, viewportClass, children, ...restProps } = $props();
|
|
4
|
+
let styles = $derived(scrollAreaVariants({
|
|
5
|
+
orientation,
|
|
6
|
+
hideScrollbar
|
|
7
|
+
}));
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<div class={twMerge(styles.root(), className)} {...restProps}>
|
|
11
|
+
<div
|
|
12
|
+
class={twMerge(
|
|
13
|
+
styles.viewport(),
|
|
14
|
+
!hideScrollbar && 'sv5ui-plus-scrollbar',
|
|
15
|
+
viewportClass
|
|
16
|
+
)}
|
|
17
|
+
data-orientation={orientation}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<style>
|
|
24
|
+
/* Custom scrollbar styling for Webkit browsers */
|
|
25
|
+
:global(.sv5ui-plus-scrollbar::-webkit-scrollbar) {
|
|
26
|
+
width: 6px;
|
|
27
|
+
height: 6px;
|
|
28
|
+
}
|
|
29
|
+
:global(.sv5ui-plus-scrollbar::-webkit-scrollbar-track) {
|
|
30
|
+
background: transparent;
|
|
31
|
+
}
|
|
32
|
+
:global(.sv5ui-plus-scrollbar::-webkit-scrollbar-thumb) {
|
|
33
|
+
background-color: var(--color-outline-variant, rgba(156, 163, 175, 0.5));
|
|
34
|
+
border-radius: 9999px;
|
|
35
|
+
}
|
|
36
|
+
:global(.sv5ui-plus-scrollbar::-webkit-scrollbar-thumb:hover) {
|
|
37
|
+
background-color: var(--color-outline, rgba(107, 114, 128, 0.8));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Firefox support */
|
|
41
|
+
:global(.sv5ui-plus-scrollbar) {
|
|
42
|
+
scrollbar-width: thin;
|
|
43
|
+
scrollbar-color: var(--color-outline-variant, rgba(156, 163, 175, 0.5)) transparent;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Hide scrollbar utility */
|
|
47
|
+
:global(.scrollbar-none::-webkit-scrollbar) {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
:global(.scrollbar-none) {
|
|
51
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
52
|
+
scrollbar-width: none; /* Firefox */
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { ScrollAreaVariantProps } from './scroll-area.variants.js';
|
|
4
|
+
export interface ScrollAreaProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Orientation of the scrolling area.
|
|
7
|
+
* @default 'vertical'
|
|
8
|
+
*/
|
|
9
|
+
orientation?: ScrollAreaVariantProps['orientation'];
|
|
10
|
+
/**
|
|
11
|
+
* Whether to hide the scrollbar track/thumb completely while still allowing scrolling.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
hideScrollbar?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Additional CSS classes for the root container.
|
|
17
|
+
*/
|
|
18
|
+
class?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Additional CSS classes for the viewport (the scrollable area).
|
|
21
|
+
*/
|
|
22
|
+
viewportClass?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Content to be scrolled.
|
|
25
|
+
*/
|
|
26
|
+
children?: Snippet;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const scrollAreaVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
orientation: {
|
|
4
|
+
vertical: "";
|
|
5
|
+
horizontal: "";
|
|
6
|
+
both: "";
|
|
7
|
+
};
|
|
8
|
+
hideScrollbar: {
|
|
9
|
+
true: {
|
|
10
|
+
viewport: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}, {
|
|
14
|
+
root: string;
|
|
15
|
+
viewport: string;
|
|
16
|
+
}, undefined, {
|
|
17
|
+
orientation: {
|
|
18
|
+
vertical: "";
|
|
19
|
+
horizontal: "";
|
|
20
|
+
both: "";
|
|
21
|
+
};
|
|
22
|
+
hideScrollbar: {
|
|
23
|
+
true: {
|
|
24
|
+
viewport: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}, {
|
|
28
|
+
root: string;
|
|
29
|
+
viewport: string;
|
|
30
|
+
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
31
|
+
orientation: {
|
|
32
|
+
vertical: "";
|
|
33
|
+
horizontal: "";
|
|
34
|
+
both: "";
|
|
35
|
+
};
|
|
36
|
+
hideScrollbar: {
|
|
37
|
+
true: {
|
|
38
|
+
viewport: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}, {
|
|
42
|
+
root: string;
|
|
43
|
+
viewport: string;
|
|
44
|
+
}>>;
|
|
45
|
+
export type ScrollAreaVariantProps = VariantProps<typeof scrollAreaVariants>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const scrollAreaVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: 'relative overflow-hidden',
|
|
5
|
+
viewport: 'h-full w-full rounded-[inherit] overflow-auto'
|
|
6
|
+
// Note: For actual custom scrollbars without a JS library, we can use
|
|
7
|
+
// global CSS webkit scrollbar styles or a plugin.
|
|
8
|
+
// Here we just define standard utility classes to hide or style them if Tailwind scrollbar plugin is used.
|
|
9
|
+
// We'll add a custom class `sv5ui-plus-scrollbar` to be styled in global css if needed.
|
|
10
|
+
},
|
|
11
|
+
variants: {
|
|
12
|
+
orientation: {
|
|
13
|
+
vertical: '',
|
|
14
|
+
horizontal: '',
|
|
15
|
+
both: ''
|
|
16
|
+
},
|
|
17
|
+
hideScrollbar: {
|
|
18
|
+
true: {
|
|
19
|
+
viewport: 'scrollbar-none' // Requires tailwind-scrollbar plugin or custom CSS
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
orientation: 'vertical',
|
|
25
|
+
hideScrollbar: false
|
|
26
|
+
}
|
|
27
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts">import { twMerge } from "tailwind-merge";
|
|
2
|
+
import { Input } from "sv5ui";
|
|
3
|
+
import { Button } from "sv5ui";
|
|
4
|
+
import { Modal } from "sv5ui";
|
|
5
|
+
import { Command } from "sv5ui";
|
|
6
|
+
import { Kbd } from "sv5ui";
|
|
7
|
+
import { onMount } from "svelte";
|
|
8
|
+
let { variant = "input", value = $bindable(""), kbd = [], groups = [], onSelect, placeholder = "Search...", class: className, ...rest } = $props();
|
|
9
|
+
let open = $state(false);
|
|
10
|
+
onMount(() => {
|
|
11
|
+
if (kbd.length > 0 && (variant === "modal" || variant === "button")) {
|
|
12
|
+
const handleKeydown = (e) => {
|
|
13
|
+
const isMac = navigator.userAgent.toLowerCase().includes("mac");
|
|
14
|
+
const isMeta = kbd.includes("meta") || kbd.includes("ctrl");
|
|
15
|
+
const key = kbd.find((k) => k.length === 1)?.toLowerCase();
|
|
16
|
+
if (isMeta && key) {
|
|
17
|
+
if ((isMac ? e.metaKey : e.ctrlKey) && e.key.toLowerCase() === key) {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
open = true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
window.addEventListener("keydown", handleKeydown);
|
|
24
|
+
return () => window.removeEventListener("keydown", handleKeydown);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
{#if variant === 'input'}
|
|
30
|
+
<Input
|
|
31
|
+
type="search"
|
|
32
|
+
{placeholder}
|
|
33
|
+
bind:value
|
|
34
|
+
leadingIcon="lucide:search"
|
|
35
|
+
class={className}
|
|
36
|
+
{...(rest as any)}
|
|
37
|
+
>
|
|
38
|
+
{#snippet trailingSlot()}
|
|
39
|
+
{#if kbd.length > 0}
|
|
40
|
+
<div class="pointer-events-none flex items-center gap-1">
|
|
41
|
+
{#each kbd as key}
|
|
42
|
+
<Kbd value={key} size="sm" />
|
|
43
|
+
{/each}
|
|
44
|
+
</div>
|
|
45
|
+
{/if}
|
|
46
|
+
{/snippet}
|
|
47
|
+
</Input>
|
|
48
|
+
{:else if variant === 'modal'}
|
|
49
|
+
<button
|
|
50
|
+
type="button"
|
|
51
|
+
class={twMerge(
|
|
52
|
+
'flex h-10 w-full items-center justify-between rounded-md border border-outline-variant bg-surface px-3 py-2 text-sm text-on-surface-variant shadow-sm transition-colors hover:bg-surface-container hover:text-on-surface focus:outline-none focus:ring-2 focus:ring-primary',
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
55
|
+
onclick={() => (open = true)}
|
|
56
|
+
{...(rest as any)}
|
|
57
|
+
>
|
|
58
|
+
<span class="flex items-center gap-2">
|
|
59
|
+
<span class="iconify lucide--search text-lg"></span>
|
|
60
|
+
<span>{placeholder}</span>
|
|
61
|
+
</span>
|
|
62
|
+
{#if kbd.length > 0}
|
|
63
|
+
<span class="flex items-center gap-1">
|
|
64
|
+
{#each kbd as key}
|
|
65
|
+
<Kbd value={key} size="sm" />
|
|
66
|
+
{/each}
|
|
67
|
+
</span>
|
|
68
|
+
{/if}
|
|
69
|
+
</button>
|
|
70
|
+
{:else if variant === 'button'}
|
|
71
|
+
<Button
|
|
72
|
+
variant="ghost"
|
|
73
|
+
color="surface"
|
|
74
|
+
leadingIcon="lucide:search"
|
|
75
|
+
class={className}
|
|
76
|
+
onclick={() => (open = true)}
|
|
77
|
+
{...(rest as any)}
|
|
78
|
+
/>
|
|
79
|
+
{/if}
|
|
80
|
+
|
|
81
|
+
{#if variant === 'modal' || variant === 'button'}
|
|
82
|
+
<Modal bind:open size="lg">
|
|
83
|
+
{#snippet content()}
|
|
84
|
+
<Command
|
|
85
|
+
{groups}
|
|
86
|
+
bind:search={value}
|
|
87
|
+
placeholder="Type a command or search..."
|
|
88
|
+
ui={{
|
|
89
|
+
root: 'border-0 shadow-none'
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
{/snippet}
|
|
93
|
+
</Modal>
|
|
94
|
+
{/if}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Search } from './Search.svelte';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
+
import type { CommandGroup } from 'sv5ui';
|
|
4
|
+
export type SearchVariant = 'input' | 'modal' | 'button';
|
|
5
|
+
export interface SearchProps extends Omit<HTMLAttributes<HTMLInputElement | HTMLButtonElement>, 'class'> {
|
|
6
|
+
/**
|
|
7
|
+
* Determines the visual style and behavior of the search component.
|
|
8
|
+
* - `input`: A standard input box.
|
|
9
|
+
* - `modal`: A fake input that opens a modal containing a Command palette when clicked.
|
|
10
|
+
* - `button`: A simple icon button that opens a modal containing a Command palette.
|
|
11
|
+
* @default 'input'
|
|
12
|
+
*/
|
|
13
|
+
variant?: SearchVariant;
|
|
14
|
+
/**
|
|
15
|
+
* The value of the search input (when variant is 'input' or internal modal search).
|
|
16
|
+
*/
|
|
17
|
+
value?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Keyboard shortcut to display (and listen to) for opening the modal.
|
|
20
|
+
* E.g. `['meta', 'K']` or `['ctrl', '/']`
|
|
21
|
+
*/
|
|
22
|
+
kbd?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Data groups to display in the Command palette (used when variant is 'modal' or 'button').
|
|
25
|
+
*/
|
|
26
|
+
groups?: CommandGroup[];
|
|
27
|
+
/**
|
|
28
|
+
* Callback fired when an item is selected from the Command palette.
|
|
29
|
+
*/
|
|
30
|
+
onSelect?: (value: string) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Placeholder text for the input or fake input.
|
|
33
|
+
* @default 'Search...'
|
|
34
|
+
*/
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Additional CSS classes for the root element.
|
|
38
|
+
*/
|
|
39
|
+
class?: ClassNameValue;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts">import { DragDropProvider, DragOverlay } from "@dnd-kit/svelte";
|
|
2
|
+
import { setContext } from "svelte";
|
|
3
|
+
import { SORTABLE_GROUP_CONTEXT_KEY } from "../../hooks/internal/sortable-context.js";
|
|
4
|
+
let { children, onDragStart, onDragMove, onDragOver, onDragEnd, ...rest } = $props();
|
|
5
|
+
let draggingId = $state(null);
|
|
6
|
+
let draggingGroupId = $state(null);
|
|
7
|
+
// Map of groupId -> overlay snippet registered by each SortableList
|
|
8
|
+
const overlayRegistry = new Map();
|
|
9
|
+
const ctx = {
|
|
10
|
+
get draggingId() {
|
|
11
|
+
return draggingId;
|
|
12
|
+
},
|
|
13
|
+
registerOverlay(groupId, snippet) {
|
|
14
|
+
overlayRegistry.set(groupId, snippet);
|
|
15
|
+
},
|
|
16
|
+
unregisterOverlay(groupId) {
|
|
17
|
+
overlayRegistry.delete(groupId);
|
|
18
|
+
},
|
|
19
|
+
getOverlay(groupId) {
|
|
20
|
+
return overlayRegistry.get(groupId);
|
|
21
|
+
},
|
|
22
|
+
setDraggingGroupId(groupId) {
|
|
23
|
+
draggingGroupId = groupId;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
setContext(SORTABLE_GROUP_CONTEXT_KEY, ctx);
|
|
27
|
+
function handleDragStart(event, manager) {
|
|
28
|
+
draggingId = event.operation.source?.id ?? null;
|
|
29
|
+
onDragStart?.(event, manager);
|
|
30
|
+
}
|
|
31
|
+
function handleDragEnd(event, manager) {
|
|
32
|
+
const sourceId = event.operation.source?.id;
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
if (draggingId === sourceId) {
|
|
35
|
+
draggingId = null;
|
|
36
|
+
draggingGroupId = null;
|
|
37
|
+
}
|
|
38
|
+
}, 250);
|
|
39
|
+
onDragEnd?.(event, manager);
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<DragDropProvider {...rest} onDragStart={handleDragStart} onDragEnd={handleDragEnd} {onDragMove} {onDragOver}>
|
|
44
|
+
{@render children?.()}
|
|
45
|
+
<DragOverlay>
|
|
46
|
+
{#snippet children(draggable)}
|
|
47
|
+
{@const snippet = ctx.getOverlay(draggingGroupId ?? '')}
|
|
48
|
+
{#if snippet}
|
|
49
|
+
{@render snippet({ item: draggable.data })}
|
|
50
|
+
{/if}
|
|
51
|
+
{/snippet}
|
|
52
|
+
</DragOverlay>
|
|
53
|
+
</DragDropProvider>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { DragStartEvent, DragEndEvent, DragOverEvent, DragMoveEvent, DragDropManagerInput } from '@dnd-kit/dom';
|
|
3
|
+
import type { DragDropManager } from '@dnd-kit/dom';
|
|
4
|
+
interface Props extends DragDropManagerInput {
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
onDragStart?: (event: DragStartEvent, manager: DragDropManager) => void;
|
|
7
|
+
onDragMove?: (event: DragMoveEvent, manager: DragDropManager) => void;
|
|
8
|
+
onDragOver?: (event: DragOverEvent, manager: DragDropManager) => void;
|
|
9
|
+
onDragEnd?: (event: DragEndEvent, manager: DragDropManager) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const SortableGroup: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type SortableGroup = ReturnType<typeof SortableGroup>;
|
|
13
|
+
export default SortableGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SortableGroup } from './SortableGroup.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SortableGroup } from './SortableGroup.svelte';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<script lang="ts" module>export {};
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<script lang="ts" generics="T">import { twMerge } from "tailwind-merge";
|
|
5
|
+
import { Icon } from "sv5ui";
|
|
6
|
+
import { useSortable } from "../../hooks/useSortable/index.js";
|
|
7
|
+
let { items = $bindable(), getKey, onReorder, axis = "vertical", handle = true, disabled = false, class: className, itemClass, children, overlay, group } = $props();
|
|
8
|
+
const sortable = useSortable({
|
|
9
|
+
getItems: () => items,
|
|
10
|
+
getId: (item) => getKey(item),
|
|
11
|
+
group: () => group,
|
|
12
|
+
axis: () => axis,
|
|
13
|
+
handle: () => handle === true ? "[data-sortable-handle]" : typeof handle === "string" ? handle : undefined,
|
|
14
|
+
disabled: () => disabled,
|
|
15
|
+
onReorder(nextItems) {
|
|
16
|
+
items = nextItems;
|
|
17
|
+
onReorder?.(nextItems);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const listClass = $derived(twMerge(axis === "vertical" ? "flex flex-col gap-2" : axis === "horizontal" ? "flex flex-row flex-wrap gap-2" : "gap-3", className));
|
|
21
|
+
const itemClasses = $derived(twMerge("relative flex items-center gap-3 rounded-lg border border-outline-variant/60 bg-surface-container-low px-3 py-2 select-none", itemClass));
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<sortable.Provider {overlay}>
|
|
25
|
+
<div use:sortable.container class={listClass} role="list">
|
|
26
|
+
{#each items as item, index (getKey(item))}
|
|
27
|
+
{@const id = getKey(item)}
|
|
28
|
+
{@const dragging = sortable.draggingId === String(id)}
|
|
29
|
+
<div
|
|
30
|
+
use:sortable.item={{ index, item }}
|
|
31
|
+
role="listitem"
|
|
32
|
+
class={twMerge(
|
|
33
|
+
'relative sortable-item',
|
|
34
|
+
itemClasses,
|
|
35
|
+
dragging && (overlay ? 'bg-transparent border-transparent' : 'z-10 opacity-95 shadow-md')
|
|
36
|
+
)}
|
|
37
|
+
aria-grabbed={dragging}
|
|
38
|
+
>
|
|
39
|
+
{#if overlay && dragging}
|
|
40
|
+
<div class="absolute inset-0 z-10 rounded-[inherit] border-2 border-dashed border-primary/50 bg-primary/5 pointer-events-none"></div>
|
|
41
|
+
{/if}
|
|
42
|
+
<div class={['flex w-full items-center gap-3', overlay && dragging && 'invisible']}>
|
|
43
|
+
{#if handle === true}
|
|
44
|
+
<button
|
|
45
|
+
type="button"
|
|
46
|
+
data-sortable-handle
|
|
47
|
+
class="inline-flex shrink-0 cursor-grab rounded-md p-1 text-on-surface-variant hover:bg-surface-container-high active:cursor-grabbing"
|
|
48
|
+
aria-label="Drag to reorder"
|
|
49
|
+
>
|
|
50
|
+
<Icon name="lucide:grip-vertical" size="16" />
|
|
51
|
+
</button>
|
|
52
|
+
{/if}
|
|
53
|
+
{@render children({ item, index, dragging })}
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
{/each}
|
|
57
|
+
</div>
|
|
58
|
+
</sortable.Provider>
|
|
59
|
+
|
|
60
|
+
<style>
|
|
61
|
+
:global([data-sortable-active='true']) {
|
|
62
|
+
user-select: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* dnd-kit animates items via Web Animations API using the CSS `translate` property.
|
|
67
|
+
* Using will-change:translate tells the browser to promote these elements to their own
|
|
68
|
+
* GPU layer so the WAAPI animation (smooth push/shift) runs without layout thrashing.
|
|
69
|
+
* Do NOT add CSS transition:transform here — it conflicts with WAAPI and causes jank.
|
|
70
|
+
*/
|
|
71
|
+
:global(.sortable-item) {
|
|
72
|
+
will-change: translate;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* Smooth color/opacity transitions for the dragging state indicator */
|
|
76
|
+
:global(.sortable-item:not([aria-grabbed='true'])) {
|
|
77
|
+
transition: background-color 150ms ease,
|
|
78
|
+
border-color 150ms ease,
|
|
79
|
+
opacity 150ms ease;
|
|
80
|
+
}
|
|
81
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type { SortableListProps } from './sortable-list.types.js';
|
|
2
|
+
import type { SortableListProps } from './sortable-list.types.js';
|
|
3
|
+
declare function $$render<T>(): {
|
|
4
|
+
props: SortableListProps<T>;
|
|
5
|
+
exports: {};
|
|
6
|
+
bindings: "items";
|
|
7
|
+
slots: {};
|
|
8
|
+
events: {};
|
|
9
|
+
};
|
|
10
|
+
declare class __sveltets_Render<T> {
|
|
11
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
12
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
13
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
14
|
+
bindings(): "items";
|
|
15
|
+
exports(): {};
|
|
16
|
+
}
|
|
17
|
+
interface $$IsomorphicComponent {
|
|
18
|
+
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
19
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
20
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
21
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
22
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
23
|
+
}
|
|
24
|
+
declare const SortableList: $$IsomorphicComponent;
|
|
25
|
+
type SortableList<T> = InstanceType<typeof SortableList<T>>;
|
|
26
|
+
export default SortableList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SortableList } from './SortableList.svelte';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
+
export interface SortableListProps<T> {
|
|
4
|
+
items: T[];
|
|
5
|
+
getKey: (item: T) => string | number;
|
|
6
|
+
onReorder?: (items: T[]) => void;
|
|
7
|
+
axis?: 'vertical' | 'horizontal' | 'grid';
|
|
8
|
+
handle?: boolean | string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
class?: ClassNameValue;
|
|
11
|
+
itemClass?: ClassNameValue;
|
|
12
|
+
children: Snippet<[{
|
|
13
|
+
item: T;
|
|
14
|
+
index: number;
|
|
15
|
+
dragging: boolean;
|
|
16
|
+
}]>;
|
|
17
|
+
overlay?: Snippet<[{
|
|
18
|
+
item: T;
|
|
19
|
+
}]>;
|
|
20
|
+
group?: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">import { twMerge } from "tailwind-merge";
|
|
2
|
+
import { spotlightVariants } from "./spotlight.variants.js";
|
|
3
|
+
let { size = 400, color = "rgba(255, 255, 255, 0.1)", class: className, children, ...restProps } = $props();
|
|
4
|
+
let styles = $derived(spotlightVariants());
|
|
5
|
+
let mouseX = $state(0);
|
|
6
|
+
let mouseY = $state(0);
|
|
7
|
+
function handleMouseMove(e) {
|
|
8
|
+
const target = e.currentTarget;
|
|
9
|
+
const rect = target.getBoundingClientRect();
|
|
10
|
+
mouseX = e.clientX - rect.left;
|
|
11
|
+
mouseY = e.clientY - rect.top;
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
16
|
+
<div
|
|
17
|
+
class={twMerge(styles.root() as string, className)}
|
|
18
|
+
onmousemove={handleMouseMove}
|
|
19
|
+
{...restProps}
|
|
20
|
+
>
|
|
21
|
+
<!-- Spotlight Effect Background -->
|
|
22
|
+
<div
|
|
23
|
+
class={styles.spotlight() as string}
|
|
24
|
+
style:background={`radial-gradient(${size}px circle at ${mouseX}px ${mouseY}px, ${color}, transparent 80%)`}
|
|
25
|
+
></div>
|
|
26
|
+
|
|
27
|
+
<!-- Content -->
|
|
28
|
+
<div class={styles.content() as string}>
|
|
29
|
+
{@render children?.()}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|