svelora 3.0.5 → 3.0.7
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/BentoGrid/BentoCard.svelte +45 -0
- package/dist/BentoGrid/BentoCard.svelte.d.ts +4 -0
- package/dist/BentoGrid/BentoGrid.svelte +9 -0
- package/dist/BentoGrid/BentoGrid.svelte.d.ts +4 -0
- package/dist/BentoGrid/bento-grid.types.d.ts +47 -0
- package/dist/BentoGrid/bento-grid.types.js +1 -0
- package/dist/BentoGrid/bento-grid.variants.d.ts +30 -0
- package/dist/BentoGrid/bento-grid.variants.js +16 -0
- package/dist/BentoGrid/index.d.ts +5 -0
- package/dist/BentoGrid/index.js +5 -0
- package/dist/Chart/Chart.svelte +47 -0
- package/dist/Chart/Chart.svelte.d.ts +4 -0
- package/dist/Chart/chart.types.d.ts +20 -0
- package/dist/Chart/chart.types.js +1 -0
- package/dist/Chart/chart.variants.d.ts +3 -0
- package/dist/Chart/chart.variants.js +4 -0
- package/dist/Chart/index.d.ts +4 -0
- package/dist/Chart/index.js +4 -0
- package/dist/Chat/ChatBubble.svelte +30 -0
- package/dist/Chat/ChatBubble.svelte.d.ts +4 -0
- package/dist/Chat/ChatInput.svelte +50 -0
- package/dist/Chat/ChatInput.svelte.d.ts +4 -0
- package/dist/Chat/ChatMessage.svelte +15 -0
- package/dist/Chat/ChatMessage.svelte.d.ts +4 -0
- package/dist/Chat/chat.types.d.ts +63 -0
- package/dist/Chat/chat.types.js +1 -0
- package/dist/Chat/chat.variants.d.ts +117 -0
- package/dist/Chat/chat.variants.js +47 -0
- package/dist/Chat/index.d.ts +6 -0
- package/dist/Chat/index.js +6 -0
- package/dist/ColorPicker/ColorPicker.svelte +109 -0
- package/dist/ColorPicker/ColorPicker.svelte.d.ts +4 -0
- package/dist/ColorPicker/color-picker.types.d.ts +26 -0
- package/dist/ColorPicker/color-picker.types.js +1 -0
- package/dist/ColorPicker/color-picker.variants.d.ts +69 -0
- package/dist/ColorPicker/color-picker.variants.js +13 -0
- package/dist/ColorPicker/index.d.ts +4 -0
- package/dist/ColorPicker/index.js +4 -0
- package/dist/DateRangePicker/DateRangePicker.svelte +59 -0
- package/dist/DateRangePicker/DateRangePicker.svelte.d.ts +4 -0
- package/dist/DateRangePicker/date-range-picker.types.d.ts +34 -0
- package/dist/DateRangePicker/date-range-picker.types.js +1 -0
- package/dist/DateRangePicker/date-range-picker.variants.d.ts +39 -0
- package/dist/DateRangePicker/date-range-picker.variants.js +20 -0
- package/dist/DateRangePicker/index.d.ts +4 -0
- package/dist/DateRangePicker/index.js +4 -0
- package/dist/Fonts/fonts.js +3 -1
- package/dist/Link/Link.context-harness.svelte +8 -0
- package/dist/Link/Link.context-harness.svelte.d.ts +7 -0
- package/dist/Link/Link.svelte +57 -30
- package/dist/Link/index.d.ts +2 -0
- package/dist/Link/index.js +1 -0
- package/dist/Link/location-context.d.ts +4 -0
- package/dist/Link/location-context.js +1 -0
- package/dist/List/List.svelte +14 -0
- package/dist/List/List.svelte.d.ts +4 -0
- package/dist/List/ListItem.svelte +64 -0
- package/dist/List/ListItem.svelte.d.ts +4 -0
- package/dist/List/index.d.ts +5 -0
- package/dist/List/index.js +5 -0
- package/dist/List/list.types.d.ts +62 -0
- package/dist/List/list.types.js +1 -0
- package/dist/List/list.variants.d.ts +99 -0
- package/dist/List/list.variants.js +42 -0
- package/dist/Marquee/Marquee.svelte +50 -0
- package/dist/Marquee/Marquee.svelte.d.ts +4 -0
- package/dist/Marquee/index.d.ts +4 -0
- package/dist/Marquee/index.js +4 -0
- package/dist/Marquee/marquee.types.d.ts +38 -0
- package/dist/Marquee/marquee.types.js +1 -0
- package/dist/Marquee/marquee.variants.d.ts +78 -0
- package/dist/Marquee/marquee.variants.js +28 -0
- package/dist/Menu/Menu.svelte +134 -0
- package/dist/Menu/Menu.svelte.d.ts +4 -0
- package/dist/Menu/index.d.ts +4 -0
- package/dist/Menu/index.js +4 -0
- package/dist/Menu/menu.types.d.ts +82 -0
- package/dist/Menu/menu.types.js +1 -0
- package/dist/Menu/menu.variants.d.ts +46 -0
- package/dist/Menu/menu.variants.js +32 -0
- package/dist/NumberTicker/NumberTicker.svelte +59 -0
- package/dist/NumberTicker/NumberTicker.svelte.d.ts +4 -0
- package/dist/NumberTicker/index.d.ts +4 -0
- package/dist/NumberTicker/index.js +4 -0
- package/dist/NumberTicker/number-ticker.types.d.ts +26 -0
- package/dist/NumberTicker/number-ticker.types.js +1 -0
- package/dist/NumberTicker/number-ticker.variants.d.ts +27 -0
- package/dist/NumberTicker/number-ticker.variants.js +6 -0
- package/dist/PasswordInput/PasswordInput.svelte +74 -0
- package/dist/PasswordInput/PasswordInput.svelte.d.ts +4 -0
- package/dist/PasswordInput/index.d.ts +4 -0
- package/dist/PasswordInput/index.js +4 -0
- package/dist/PasswordInput/password-input.types.d.ts +18 -0
- package/dist/PasswordInput/password-input.types.js +1 -0
- package/dist/PasswordInput/password-input.variants.d.ts +57 -0
- package/dist/PasswordInput/password-input.variants.js +11 -0
- package/dist/Prose/Prose.svelte +13 -0
- package/dist/Prose/Prose.svelte.d.ts +4 -0
- package/dist/Prose/index.d.ts +4 -0
- package/dist/Prose/index.js +4 -0
- package/dist/Prose/prose.types.d.ts +22 -0
- package/dist/Prose/prose.types.js +1 -0
- package/dist/Prose/prose.variants.d.ts +45 -0
- package/dist/Prose/prose.variants.js +45 -0
- package/dist/Rating/Rating.svelte +93 -0
- package/dist/Rating/Rating.svelte.d.ts +4 -0
- package/dist/Rating/index.d.ts +4 -0
- package/dist/Rating/index.js +4 -0
- package/dist/Rating/rating.types.d.ts +59 -0
- package/dist/Rating/rating.types.js +1 -0
- package/dist/Rating/rating.variants.d.ts +93 -0
- package/dist/Rating/rating.variants.js +32 -0
- package/dist/Resizable/Resizable.svelte +9 -0
- package/dist/Resizable/Resizable.svelte.d.ts +4 -0
- package/dist/Resizable/index.d.ts +4 -0
- package/dist/Resizable/index.js +4 -0
- package/dist/Resizable/resizable.types.d.ts +18 -0
- package/dist/Resizable/resizable.types.js +1 -0
- package/dist/Resizable/resizable.variants.d.ts +48 -0
- package/dist/Resizable/resizable.variants.js +17 -0
- package/dist/ScrollArea/ScrollArea.svelte +54 -0
- package/dist/ScrollArea/ScrollArea.svelte.d.ts +4 -0
- package/dist/ScrollArea/index.d.ts +4 -0
- package/dist/ScrollArea/index.js +4 -0
- package/dist/ScrollArea/scroll-area.types.d.ts +27 -0
- package/dist/ScrollArea/scroll-area.types.js +1 -0
- package/dist/ScrollArea/scroll-area.variants.d.ts +45 -0
- package/dist/ScrollArea/scroll-area.variants.js +27 -0
- package/dist/SelectMenu/SelectMenu.svelte +46 -14
- package/dist/Sidebar/Sidebar.svelte +30 -0
- package/dist/Sidebar/Sidebar.svelte.d.ts +4 -0
- package/dist/Sidebar/index.d.ts +4 -0
- package/dist/Sidebar/index.js +4 -0
- package/dist/Sidebar/sidebar.types.d.ts +31 -0
- package/dist/Sidebar/sidebar.types.js +1 -0
- package/dist/Sidebar/sidebar.variants.d.ts +69 -0
- package/dist/Sidebar/sidebar.variants.js +23 -0
- package/dist/Spotlight/Spotlight.svelte +31 -0
- package/dist/Spotlight/Spotlight.svelte.d.ts +4 -0
- package/dist/Spotlight/index.d.ts +4 -0
- package/dist/Spotlight/index.js +4 -0
- package/dist/Spotlight/spotlight.types.d.ts +22 -0
- package/dist/Spotlight/spotlight.types.js +1 -0
- package/dist/Spotlight/spotlight.variants.d.ts +39 -0
- package/dist/Spotlight/spotlight.variants.js +8 -0
- package/dist/Stepper/Stepper.svelte +12 -9
- package/dist/TagsInput/TagsInput.svelte +100 -0
- package/dist/TagsInput/TagsInput.svelte.d.ts +4 -0
- package/dist/TagsInput/index.d.ts +4 -0
- package/dist/TagsInput/index.js +4 -0
- package/dist/TagsInput/tags-input.types.d.ts +32 -0
- package/dist/TagsInput/tags-input.types.js +1 -0
- package/dist/TagsInput/tags-input.variants.d.ts +45 -0
- package/dist/TagsInput/tags-input.variants.js +22 -0
- package/dist/TreeView/TreeView.svelte +95 -0
- package/dist/TreeView/TreeView.svelte.d.ts +4 -0
- package/dist/TreeView/index.d.ts +4 -0
- package/dist/TreeView/index.js +4 -0
- package/dist/TreeView/tree-view.types.d.ts +68 -0
- package/dist/TreeView/tree-view.types.js +1 -0
- package/dist/TreeView/tree-view.variants.d.ts +69 -0
- package/dist/TreeView/tree-view.variants.js +30 -0
- package/dist/docs/navigation.js +162 -0
- package/dist/hooks/index.d.ts +14 -0
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/useDebouncedState.svelte.d.ts +30 -0
- package/dist/hooks/useDebouncedState.svelte.js +45 -0
- package/dist/hooks/useEventListener.svelte.d.ts +30 -0
- package/dist/hooks/useEventListener.svelte.js +16 -0
- package/dist/hooks/useFocusTrap.svelte.d.ts +42 -0
- package/dist/hooks/useFocusTrap.svelte.js +87 -0
- package/dist/hooks/useIntersectionObserver.svelte.d.ts +30 -0
- package/dist/hooks/useIntersectionObserver.svelte.js +46 -0
- package/dist/hooks/useLocalStorage.svelte.d.ts +39 -0
- package/dist/hooks/useLocalStorage.svelte.js +73 -0
- package/dist/hooks/useResizeObserver.svelte.d.ts +50 -0
- package/dist/hooks/useResizeObserver.svelte.js +71 -0
- package/dist/hooks/useScrollLock.svelte.d.ts +28 -0
- package/dist/hooks/useScrollLock.svelte.js +79 -0
- package/dist/hooks/useThrottle.svelte.d.ts +37 -0
- package/dist/hooks/useThrottle.svelte.js +72 -0
- package/dist/hooks/useTimers.svelte.d.ts +62 -0
- package/dist/hooks/useTimers.svelte.js +90 -0
- package/dist/hooks/utils.d.ts +1 -0
- package/dist/hooks/utils.js +3 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +18 -0
- package/dist/mcp/svelora-docs.data.json +59 -5
- package/package.json +8 -6
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script lang="ts">import { twMerge } from "tailwind-merge";
|
|
2
|
+
import Icon from "../Icon/Icon.svelte";
|
|
3
|
+
import { treeViewVariants } from "./tree-view.variants.js";
|
|
4
|
+
let { items = [], selectedIds = [], expandedIds = $bindable([]), size = "md", expandOnRowClick = true, class: className, onItemClick, onItemExpand, labelSnippet, ...restProps } = $props();
|
|
5
|
+
let styles = $derived(treeViewVariants({ size }));
|
|
6
|
+
// Internal state tracking for faster lookup
|
|
7
|
+
let expandedSet = $derived(new Set(expandedIds));
|
|
8
|
+
let selectedSet = $derived(new Set(selectedIds));
|
|
9
|
+
function toggleExpand(e, item) {
|
|
10
|
+
e.stopPropagation();
|
|
11
|
+
if (item.disabled || !item.children?.length) return;
|
|
12
|
+
const isExpanded = expandedSet.has(item.id);
|
|
13
|
+
if (isExpanded) {
|
|
14
|
+
expandedIds = expandedIds.filter((id) => id !== item.id);
|
|
15
|
+
} else {
|
|
16
|
+
expandedIds = [...expandedIds, item.id];
|
|
17
|
+
}
|
|
18
|
+
onItemExpand?.(item, !isExpanded);
|
|
19
|
+
}
|
|
20
|
+
function handleRowClick(e, item) {
|
|
21
|
+
if (item.disabled) return;
|
|
22
|
+
if (expandOnRowClick && item.children?.length) {
|
|
23
|
+
toggleExpand(e, item);
|
|
24
|
+
}
|
|
25
|
+
onItemClick?.(item);
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
{#snippet renderTree(treeItems: TreeItem[])}
|
|
30
|
+
<div class={styles.root()}>
|
|
31
|
+
{#each treeItems as item}
|
|
32
|
+
{@const hasChildren = item.children && item.children.length > 0}
|
|
33
|
+
{@const isExpanded = expandedSet.has(item.id)}
|
|
34
|
+
{@const isSelected = selectedSet.has(item.id)}
|
|
35
|
+
|
|
36
|
+
<div class={styles.item()}>
|
|
37
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
38
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
39
|
+
<div
|
|
40
|
+
class={twMerge(
|
|
41
|
+
styles.itemRow(),
|
|
42
|
+
isSelected && styles.itemRowActive(),
|
|
43
|
+
item.disabled && styles.itemRowDisabled()
|
|
44
|
+
)}
|
|
45
|
+
onclick={(e) => handleRowClick(e, item)}
|
|
46
|
+
>
|
|
47
|
+
<!-- Chevron / Spacer -->
|
|
48
|
+
<div class={styles.chevronWrapper()}>
|
|
49
|
+
{#if hasChildren}
|
|
50
|
+
<button
|
|
51
|
+
type="button"
|
|
52
|
+
class="w-full h-full flex items-center justify-center outline-none"
|
|
53
|
+
onclick={(e) => {
|
|
54
|
+
if (!expandOnRowClick) toggleExpand(e, item)
|
|
55
|
+
}}
|
|
56
|
+
tabindex="-1"
|
|
57
|
+
disabled={item.disabled}
|
|
58
|
+
>
|
|
59
|
+
<Icon
|
|
60
|
+
name="lucide:chevron-right"
|
|
61
|
+
class={twMerge(styles.chevron(), isExpanded && 'rotate-90')}
|
|
62
|
+
/>
|
|
63
|
+
</button>
|
|
64
|
+
{/if}
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<!-- Icon -->
|
|
68
|
+
{#if item.icon}
|
|
69
|
+
<Icon name={item.icon} class={styles.icon()} />
|
|
70
|
+
{/if}
|
|
71
|
+
|
|
72
|
+
<!-- Label -->
|
|
73
|
+
<div class={styles.label()}>
|
|
74
|
+
{#if labelSnippet}
|
|
75
|
+
{@render labelSnippet(item)}
|
|
76
|
+
{:else}
|
|
77
|
+
{item.label}
|
|
78
|
+
{/if}
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<!-- Children -->
|
|
83
|
+
{#if hasChildren && isExpanded}
|
|
84
|
+
<div class={styles.childrenWrapper()}>
|
|
85
|
+
{@render renderTree(item.children!)}
|
|
86
|
+
</div>
|
|
87
|
+
{/if}
|
|
88
|
+
</div>
|
|
89
|
+
{/each}
|
|
90
|
+
</div>
|
|
91
|
+
{/snippet}
|
|
92
|
+
|
|
93
|
+
<div class={className} {...restProps}>
|
|
94
|
+
{@render renderTree(items)}
|
|
95
|
+
</div>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { TreeViewVariantProps } from './tree-view.variants.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
export interface TreeItem {
|
|
5
|
+
/**
|
|
6
|
+
* Unique identifier for the item.
|
|
7
|
+
*/
|
|
8
|
+
id: string | number;
|
|
9
|
+
/**
|
|
10
|
+
* Text label to display.
|
|
11
|
+
*/
|
|
12
|
+
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional icon name.
|
|
15
|
+
*/
|
|
16
|
+
icon?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the item is disabled.
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Child items (for nested trees).
|
|
23
|
+
*/
|
|
24
|
+
children?: TreeItem[];
|
|
25
|
+
/**
|
|
26
|
+
* Any other custom data you want to attach.
|
|
27
|
+
*/
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
30
|
+
export interface TreeViewProps extends HTMLAttributes<HTMLDivElement> {
|
|
31
|
+
/**
|
|
32
|
+
* Array of tree items to display.
|
|
33
|
+
*/
|
|
34
|
+
items: TreeItem[];
|
|
35
|
+
/**
|
|
36
|
+
* Currently selected item IDs.
|
|
37
|
+
*/
|
|
38
|
+
selectedIds?: (string | number)[];
|
|
39
|
+
/**
|
|
40
|
+
* Currently expanded item IDs.
|
|
41
|
+
*/
|
|
42
|
+
expandedIds?: (string | number)[];
|
|
43
|
+
/**
|
|
44
|
+
* Component size.
|
|
45
|
+
*/
|
|
46
|
+
size?: TreeViewVariantProps['size'];
|
|
47
|
+
/**
|
|
48
|
+
* Whether clicking the row expands the item, or only clicking the chevron expands it.
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
expandOnRowClick?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Additional CSS classes.
|
|
54
|
+
*/
|
|
55
|
+
class?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Event fired when an item is clicked.
|
|
58
|
+
*/
|
|
59
|
+
onItemClick?: (item: TreeItem) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Event fired when an item's expanded state changes.
|
|
62
|
+
*/
|
|
63
|
+
onItemExpand?: (item: TreeItem, isExpanded: boolean) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Custom snippet for rendering the label part of the item.
|
|
66
|
+
*/
|
|
67
|
+
labelSnippet?: Snippet<[TreeItem]>;
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const treeViewVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
size: {
|
|
4
|
+
sm: {
|
|
5
|
+
itemRow: string;
|
|
6
|
+
chevron: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
};
|
|
9
|
+
md: {
|
|
10
|
+
itemRow: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}, {
|
|
14
|
+
root: string;
|
|
15
|
+
item: string;
|
|
16
|
+
itemRow: string;
|
|
17
|
+
itemRowActive: string;
|
|
18
|
+
itemRowDisabled: string;
|
|
19
|
+
chevronWrapper: string;
|
|
20
|
+
chevron: string;
|
|
21
|
+
icon: string;
|
|
22
|
+
label: string;
|
|
23
|
+
childrenWrapper: string;
|
|
24
|
+
}, undefined, {
|
|
25
|
+
size: {
|
|
26
|
+
sm: {
|
|
27
|
+
itemRow: string;
|
|
28
|
+
chevron: string;
|
|
29
|
+
icon: string;
|
|
30
|
+
};
|
|
31
|
+
md: {
|
|
32
|
+
itemRow: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}, {
|
|
36
|
+
root: string;
|
|
37
|
+
item: string;
|
|
38
|
+
itemRow: string;
|
|
39
|
+
itemRowActive: string;
|
|
40
|
+
itemRowDisabled: string;
|
|
41
|
+
chevronWrapper: string;
|
|
42
|
+
chevron: string;
|
|
43
|
+
icon: string;
|
|
44
|
+
label: string;
|
|
45
|
+
childrenWrapper: string;
|
|
46
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
47
|
+
size: {
|
|
48
|
+
sm: {
|
|
49
|
+
itemRow: string;
|
|
50
|
+
chevron: string;
|
|
51
|
+
icon: string;
|
|
52
|
+
};
|
|
53
|
+
md: {
|
|
54
|
+
itemRow: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}, {
|
|
58
|
+
root: string;
|
|
59
|
+
item: string;
|
|
60
|
+
itemRow: string;
|
|
61
|
+
itemRowActive: string;
|
|
62
|
+
itemRowDisabled: string;
|
|
63
|
+
chevronWrapper: string;
|
|
64
|
+
chevron: string;
|
|
65
|
+
icon: string;
|
|
66
|
+
label: string;
|
|
67
|
+
childrenWrapper: string;
|
|
68
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
69
|
+
export type TreeViewVariantProps = VariantProps<typeof treeViewVariants>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const treeViewVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: 'flex flex-col text-sm',
|
|
5
|
+
item: 'flex flex-col',
|
|
6
|
+
itemRow: 'flex items-center gap-1.5 py-1.5 px-2 rounded-md hover:bg-surface-100 dark:hover:bg-surface-800 cursor-pointer select-none transition-colors text-surface-900 dark:text-surface-50',
|
|
7
|
+
itemRowActive: 'bg-primary-50 dark:bg-primary-900/30 text-primary-900 dark:text-primary-100',
|
|
8
|
+
itemRowDisabled: 'opacity-50 cursor-not-allowed hover:bg-transparent dark:hover:bg-transparent',
|
|
9
|
+
chevronWrapper: 'flex items-center justify-center w-5 h-5 shrink-0 rounded hover:bg-surface-200 dark:hover:bg-surface-700 transition-colors',
|
|
10
|
+
chevron: 'w-4 h-4 transition-transform duration-200',
|
|
11
|
+
icon: 'w-4 h-4 shrink-0 text-surface-500 dark:text-surface-400',
|
|
12
|
+
label: 'truncate flex-1',
|
|
13
|
+
childrenWrapper: 'flex flex-col pl-4 ml-2.5 border-l border-outline-variant/50 mt-1'
|
|
14
|
+
},
|
|
15
|
+
variants: {
|
|
16
|
+
size: {
|
|
17
|
+
sm: {
|
|
18
|
+
itemRow: 'py-1 text-xs',
|
|
19
|
+
chevron: 'w-3 h-3',
|
|
20
|
+
icon: 'w-3 h-3'
|
|
21
|
+
},
|
|
22
|
+
md: {
|
|
23
|
+
itemRow: 'py-1.5 text-sm'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
size: 'md'
|
|
29
|
+
}
|
|
30
|
+
});
|
package/dist/docs/navigation.js
CHANGED
|
@@ -121,6 +121,12 @@ export const docsComponentGroups = [
|
|
|
121
121
|
{
|
|
122
122
|
title: 'Layout',
|
|
123
123
|
items: [
|
|
124
|
+
{
|
|
125
|
+
title: 'BentoGrid',
|
|
126
|
+
href: '/docs/components/bento-grid',
|
|
127
|
+
legacyHref: '/bento-grid',
|
|
128
|
+
icon: 'lucide:layout-dashboard'
|
|
129
|
+
},
|
|
124
130
|
{
|
|
125
131
|
title: 'Card',
|
|
126
132
|
href: '/docs/components/card',
|
|
@@ -133,6 +139,18 @@ export const docsComponentGroups = [
|
|
|
133
139
|
legacyHref: '/container',
|
|
134
140
|
icon: 'lucide:box'
|
|
135
141
|
},
|
|
142
|
+
{
|
|
143
|
+
title: 'Resizable',
|
|
144
|
+
href: '/docs/components/resizable',
|
|
145
|
+
legacyHref: '/resizable',
|
|
146
|
+
icon: 'lucide:layout-panel-left-right'
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
title: 'ScrollArea',
|
|
150
|
+
href: '/docs/components/scroll-area',
|
|
151
|
+
legacyHref: '/scroll-area',
|
|
152
|
+
icon: 'lucide:mouse-pointer-square-dashed'
|
|
153
|
+
},
|
|
136
154
|
{
|
|
137
155
|
title: 'Separator',
|
|
138
156
|
href: '/docs/components/separator',
|
|
@@ -150,6 +168,12 @@ export const docsComponentGroups = [
|
|
|
150
168
|
legacyHref: '/accordion',
|
|
151
169
|
icon: 'lucide:chevrons-down-up'
|
|
152
170
|
},
|
|
171
|
+
{
|
|
172
|
+
title: 'Chart',
|
|
173
|
+
href: '/docs/components/chart',
|
|
174
|
+
legacyHref: '/chart',
|
|
175
|
+
icon: 'lucide:bar-chart-2'
|
|
176
|
+
},
|
|
153
177
|
{
|
|
154
178
|
title: 'Avatar',
|
|
155
179
|
href: '/docs/components/avatar',
|
|
@@ -180,6 +204,24 @@ export const docsComponentGroups = [
|
|
|
180
204
|
legacyHref: '/chip',
|
|
181
205
|
icon: 'lucide:circle-dot'
|
|
182
206
|
},
|
|
207
|
+
{
|
|
208
|
+
title: 'List',
|
|
209
|
+
href: '/docs/components/list',
|
|
210
|
+
legacyHref: '/list',
|
|
211
|
+
icon: 'lucide:list'
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
title: 'NumberTicker',
|
|
215
|
+
href: '/docs/components/number-ticker',
|
|
216
|
+
legacyHref: '/number-ticker',
|
|
217
|
+
icon: 'lucide:clock-10'
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
title: 'Prose',
|
|
221
|
+
href: '/docs/components/prose',
|
|
222
|
+
legacyHref: '/prose',
|
|
223
|
+
icon: 'lucide:type'
|
|
224
|
+
},
|
|
183
225
|
{
|
|
184
226
|
title: 'Empty',
|
|
185
227
|
href: '/docs/components/empty',
|
|
@@ -209,6 +251,12 @@ export const docsComponentGroups = [
|
|
|
209
251
|
href: '/docs/components/table',
|
|
210
252
|
legacyHref: '/table',
|
|
211
253
|
icon: 'lucide:table'
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
title: 'TreeView',
|
|
257
|
+
href: '/docs/components/tree-view',
|
|
258
|
+
legacyHref: '/tree-view',
|
|
259
|
+
icon: 'lucide:folder-tree'
|
|
212
260
|
}
|
|
213
261
|
]
|
|
214
262
|
},
|
|
@@ -221,6 +269,12 @@ export const docsComponentGroups = [
|
|
|
221
269
|
legacyHref: '/checkbox',
|
|
222
270
|
icon: 'lucide:square-check'
|
|
223
271
|
},
|
|
272
|
+
{
|
|
273
|
+
title: 'ColorPicker',
|
|
274
|
+
href: '/docs/components/color-picker',
|
|
275
|
+
legacyHref: '/color-picker',
|
|
276
|
+
icon: 'lucide:pipette'
|
|
277
|
+
},
|
|
224
278
|
{
|
|
225
279
|
title: 'CheckboxGroup',
|
|
226
280
|
href: '/docs/components/checkbox-group',
|
|
@@ -275,6 +329,12 @@ export const docsComponentGroups = [
|
|
|
275
329
|
legacyHref: '/textarea',
|
|
276
330
|
icon: 'lucide:text'
|
|
277
331
|
},
|
|
332
|
+
{
|
|
333
|
+
title: 'PasswordInput',
|
|
334
|
+
href: '/docs/components/password-input',
|
|
335
|
+
legacyHref: '/password-input',
|
|
336
|
+
icon: 'lucide:key'
|
|
337
|
+
},
|
|
278
338
|
{
|
|
279
339
|
title: 'FileUpload',
|
|
280
340
|
href: '/docs/components/file-upload',
|
|
@@ -287,6 +347,18 @@ export const docsComponentGroups = [
|
|
|
287
347
|
legacyHref: '/pin-input',
|
|
288
348
|
icon: 'lucide:square-asterisk'
|
|
289
349
|
},
|
|
350
|
+
{
|
|
351
|
+
title: 'Rating',
|
|
352
|
+
href: '/docs/components/rating',
|
|
353
|
+
legacyHref: '/rating',
|
|
354
|
+
icon: 'lucide:star'
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
title: 'TagsInput',
|
|
358
|
+
href: '/docs/components/tags-input',
|
|
359
|
+
legacyHref: '/tags-input',
|
|
360
|
+
icon: 'lucide:tags'
|
|
361
|
+
},
|
|
290
362
|
{
|
|
291
363
|
title: 'FormField',
|
|
292
364
|
href: '/docs/components/form-field',
|
|
@@ -316,6 +388,18 @@ export const docsComponentGroups = [
|
|
|
316
388
|
legacyHref: '/banner',
|
|
317
389
|
icon: 'lucide:megaphone'
|
|
318
390
|
},
|
|
391
|
+
{
|
|
392
|
+
title: 'Chat',
|
|
393
|
+
href: '/docs/components/chat',
|
|
394
|
+
legacyHref: '/chat',
|
|
395
|
+
icon: 'lucide:message-circle'
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
title: 'Marquee',
|
|
399
|
+
href: '/docs/components/marquee',
|
|
400
|
+
legacyHref: '/marquee',
|
|
401
|
+
icon: 'lucide:move-right'
|
|
402
|
+
},
|
|
319
403
|
{
|
|
320
404
|
title: 'Progress',
|
|
321
405
|
href: '/docs/components/progress',
|
|
@@ -327,6 +411,12 @@ export const docsComponentGroups = [
|
|
|
327
411
|
href: '/docs/components/toast',
|
|
328
412
|
legacyHref: '/toast',
|
|
329
413
|
icon: 'lucide:message-square-warning'
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
title: 'Spotlight',
|
|
417
|
+
href: '/docs/components/spotlight',
|
|
418
|
+
legacyHref: '/spotlight',
|
|
419
|
+
icon: 'lucide:flashlight'
|
|
330
420
|
}
|
|
331
421
|
]
|
|
332
422
|
},
|
|
@@ -345,6 +435,18 @@ export const docsComponentGroups = [
|
|
|
345
435
|
legacyHref: '/pagination',
|
|
346
436
|
icon: 'lucide:ellipsis'
|
|
347
437
|
},
|
|
438
|
+
{
|
|
439
|
+
title: 'Menu',
|
|
440
|
+
href: '/docs/components/menu',
|
|
441
|
+
legacyHref: '/menu',
|
|
442
|
+
icon: 'lucide:menu-square'
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
title: 'Sidebar',
|
|
446
|
+
href: '/docs/components/sidebar',
|
|
447
|
+
legacyHref: '/sidebar',
|
|
448
|
+
icon: 'lucide:layout-sidebar'
|
|
449
|
+
},
|
|
348
450
|
{
|
|
349
451
|
title: 'Stepper',
|
|
350
452
|
href: '/docs/components/stepper',
|
|
@@ -432,6 +534,12 @@ export const docsComponentGroups = [
|
|
|
432
534
|
href: '/docs/components/range-calendar',
|
|
433
535
|
legacyHref: '/range-calendar',
|
|
434
536
|
icon: 'lucide:calendar-range'
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
title: 'DateRangePicker',
|
|
540
|
+
href: '/docs/components/date-range-picker',
|
|
541
|
+
legacyHref: '/date-range-picker',
|
|
542
|
+
icon: 'lucide:calendar-days'
|
|
435
543
|
}
|
|
436
544
|
]
|
|
437
545
|
}
|
|
@@ -478,6 +586,60 @@ export const docsHookItems = [
|
|
|
478
586
|
href: '/docs/hooks/use-debounce',
|
|
479
587
|
legacyHref: '/use-debounce',
|
|
480
588
|
icon: 'lucide:timer'
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
title: 'useDebouncedState',
|
|
592
|
+
href: '/docs/hooks/use-debounced-state',
|
|
593
|
+
legacyHref: '/use-debounced-state',
|
|
594
|
+
icon: 'lucide:clock-3'
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
title: 'useEventListener',
|
|
598
|
+
href: '/docs/hooks/use-event-listener',
|
|
599
|
+
legacyHref: '/use-event-listener',
|
|
600
|
+
icon: 'lucide:radio'
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
title: 'useResizeObserver / useElementSize',
|
|
604
|
+
href: '/docs/hooks/use-resize-observer',
|
|
605
|
+
legacyHref: '/use-resize-observer',
|
|
606
|
+
icon: 'lucide:scaling'
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
title: 'useIntersectionObserver',
|
|
610
|
+
href: '/docs/hooks/use-intersection-observer',
|
|
611
|
+
legacyHref: '/use-intersection-observer',
|
|
612
|
+
icon: 'lucide:scan-search'
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
title: 'useScrollLock',
|
|
616
|
+
href: '/docs/hooks/use-scroll-lock',
|
|
617
|
+
legacyHref: '/use-scroll-lock',
|
|
618
|
+
icon: 'lucide:lock'
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
title: 'useFocusTrap',
|
|
622
|
+
href: '/docs/hooks/use-focus-trap',
|
|
623
|
+
legacyHref: '/use-focus-trap',
|
|
624
|
+
icon: 'lucide:focus'
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
title: 'useLocalStorage',
|
|
628
|
+
href: '/docs/hooks/use-local-storage',
|
|
629
|
+
legacyHref: '/use-local-storage',
|
|
630
|
+
icon: 'lucide:hard-drive'
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
title: 'useThrottle',
|
|
634
|
+
href: '/docs/hooks/use-throttle',
|
|
635
|
+
legacyHref: '/use-throttle',
|
|
636
|
+
icon: 'lucide:gauge'
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
title: 'useTimeout / useInterval',
|
|
640
|
+
href: '/docs/hooks/use-timers',
|
|
641
|
+
legacyHref: '/use-timers',
|
|
642
|
+
icon: 'lucide:timer-reset'
|
|
481
643
|
}
|
|
482
644
|
];
|
|
483
645
|
export const docsTopNav = [
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -4,11 +4,25 @@ export type { UseClipboardOptions } from './useClipboard.svelte.js';
|
|
|
4
4
|
export { useClipboard } from './useClipboard.svelte.js';
|
|
5
5
|
export type { UseDebounceOptions } from './useDebounce.svelte.js';
|
|
6
6
|
export { useDebounce } from './useDebounce.svelte.js';
|
|
7
|
+
export { useDebouncedState } from './useDebouncedState.svelte.js';
|
|
7
8
|
export type { UseEscapeKeydownOptions } from './useEscapeKeydown.svelte.js';
|
|
8
9
|
export { useEscapeKeydown } from './useEscapeKeydown.svelte.js';
|
|
10
|
+
export { useEventListener } from './useEventListener.svelte.js';
|
|
11
|
+
export type { UseFocusTrapOptions } from './useFocusTrap.svelte.js';
|
|
12
|
+
export { useFocusTrap } from './useFocusTrap.svelte.js';
|
|
9
13
|
export type { FormFieldContext } from './useFormField.svelte.js';
|
|
10
14
|
export { FORM_FIELD_CONTEXT_KEY, useFormField, useFormFieldEmit } from './useFormField.svelte.js';
|
|
11
15
|
export type { UseInfiniteScrollOptions } from './useInfiniteScroll.svelte.js';
|
|
12
16
|
export { useInfiniteScroll } from './useInfiniteScroll.svelte.js';
|
|
17
|
+
export type { UseIntersectionObserverOptions } from './useIntersectionObserver.svelte.js';
|
|
18
|
+
export { useIntersectionObserver } from './useIntersectionObserver.svelte.js';
|
|
19
|
+
export type { UseLocalStorageOptions, UseLocalStorageReturn, UseLocalStorageSerializer } from './useLocalStorage.svelte.js';
|
|
20
|
+
export { useLocalStorage } from './useLocalStorage.svelte.js';
|
|
13
21
|
export type { UseMediaQueryOptions } from './useMediaQuery.svelte.js';
|
|
14
22
|
export { useMediaQuery } from './useMediaQuery.svelte.js';
|
|
23
|
+
export { useElementSize, useResizeObserver } from './useResizeObserver.svelte.js';
|
|
24
|
+
export { useScrollLock } from './useScrollLock.svelte.js';
|
|
25
|
+
export type { UseThrottleOptions } from './useThrottle.svelte.js';
|
|
26
|
+
export { useThrottle } from './useThrottle.svelte.js';
|
|
27
|
+
export type { UseIntervalOptions } from './useTimers.svelte.js';
|
|
28
|
+
export { useInterval, useTimeout } from './useTimers.svelte.js';
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
export { useClickOutside } from './useClickOutside.svelte.js';
|
|
2
2
|
export { useClipboard } from './useClipboard.svelte.js';
|
|
3
3
|
export { useDebounce } from './useDebounce.svelte.js';
|
|
4
|
+
export { useDebouncedState } from './useDebouncedState.svelte.js';
|
|
4
5
|
export { useEscapeKeydown } from './useEscapeKeydown.svelte.js';
|
|
6
|
+
export { useEventListener } from './useEventListener.svelte.js';
|
|
7
|
+
export { useFocusTrap } from './useFocusTrap.svelte.js';
|
|
5
8
|
export { FORM_FIELD_CONTEXT_KEY, useFormField, useFormFieldEmit } from './useFormField.svelte.js';
|
|
6
9
|
export { useInfiniteScroll } from './useInfiniteScroll.svelte.js';
|
|
10
|
+
export { useIntersectionObserver } from './useIntersectionObserver.svelte.js';
|
|
11
|
+
export { useLocalStorage } from './useLocalStorage.svelte.js';
|
|
7
12
|
export { useMediaQuery } from './useMediaQuery.svelte.js';
|
|
13
|
+
export { useElementSize, useResizeObserver } from './useResizeObserver.svelte.js';
|
|
14
|
+
export { useScrollLock } from './useScrollLock.svelte.js';
|
|
15
|
+
export { useThrottle } from './useThrottle.svelte.js';
|
|
16
|
+
export { useInterval, useTimeout } from './useTimers.svelte.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
interface UseDebouncedStateReturn<T> {
|
|
2
|
+
/** The immediate value — read it or write it (bindable). */
|
|
3
|
+
current: T;
|
|
4
|
+
/** The debounced value — settles `delay` ms after the last write. */
|
|
5
|
+
readonly debounced: T;
|
|
6
|
+
/** Set both `current` and `debounced` now, cancelling any pending update. */
|
|
7
|
+
setImmediate(value: T): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Reactive state whose `debounced` mirror lags behind `current` by `delay` ms.
|
|
11
|
+
*
|
|
12
|
+
* Combines a value with debouncing: write `current` (e.g. bound to an input)
|
|
13
|
+
* and derive from `debounced` — no manual two-state + run wiring. Built on
|
|
14
|
+
* `useDebounce`, so the pending timer is cleared on teardown. Use `setImmediate`
|
|
15
|
+
* to skip the delay (e.g. on reset).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```svelte
|
|
19
|
+
* <script>
|
|
20
|
+
* import { useDebouncedState } from 'svelora'
|
|
21
|
+
*
|
|
22
|
+
* const search = useDebouncedState('', 200)
|
|
23
|
+
* const results = $derived(filter(items, search.debounced))
|
|
24
|
+
* </script>
|
|
25
|
+
*
|
|
26
|
+
* <input bind:value={search.current} />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function useDebouncedState<T>(initial: T, delay?: number): UseDebouncedStateReturn<T>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useDebounce } from './useDebounce.svelte.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reactive state whose `debounced` mirror lags behind `current` by `delay` ms.
|
|
4
|
+
*
|
|
5
|
+
* Combines a value with debouncing: write `current` (e.g. bound to an input)
|
|
6
|
+
* and derive from `debounced` — no manual two-state + run wiring. Built on
|
|
7
|
+
* `useDebounce`, so the pending timer is cleared on teardown. Use `setImmediate`
|
|
8
|
+
* to skip the delay (e.g. on reset).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```svelte
|
|
12
|
+
* <script>
|
|
13
|
+
* import { useDebouncedState } from 'svelora'
|
|
14
|
+
*
|
|
15
|
+
* const search = useDebouncedState('', 200)
|
|
16
|
+
* const results = $derived(filter(items, search.debounced))
|
|
17
|
+
* </script>
|
|
18
|
+
*
|
|
19
|
+
* <input bind:value={search.current} />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function useDebouncedState(initial, delay = 300) {
|
|
23
|
+
let current = $state(initial);
|
|
24
|
+
let debounced = $state(initial);
|
|
25
|
+
const debounce = useDebounce({ delay });
|
|
26
|
+
return {
|
|
27
|
+
get current() {
|
|
28
|
+
return current;
|
|
29
|
+
},
|
|
30
|
+
set current(value) {
|
|
31
|
+
current = value;
|
|
32
|
+
debounce.run(() => {
|
|
33
|
+
debounced = value;
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
get debounced() {
|
|
37
|
+
return debounced;
|
|
38
|
+
},
|
|
39
|
+
setImmediate(value) {
|
|
40
|
+
debounce.cancel();
|
|
41
|
+
current = value;
|
|
42
|
+
debounced = value;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|