@mrintel/villain-ui 0.3.0 → 0.6.3
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 -21
- package/README.md +3490 -1296
- package/dist/components/buttons/Button.svelte +27 -33
- package/dist/components/buttons/Button.svelte.d.ts +4 -1
- package/dist/components/buttons/ButtonGroup.svelte +17 -30
- package/dist/components/buttons/FloatingActionButton.svelte +20 -44
- package/dist/components/buttons/FloatingActionButton.svelte.d.ts +2 -1
- package/dist/components/buttons/IconButton.svelte +23 -53
- package/dist/components/buttons/IconButton.svelte.d.ts +2 -1
- package/dist/components/buttons/LinkButton.svelte +24 -37
- package/dist/components/buttons/LinkButton.svelte.d.ts +4 -1
- package/dist/components/buttons/buttonClasses.d.ts +5 -0
- package/dist/components/buttons/buttonClasses.js +8 -3
- package/dist/components/cards/Card.svelte +60 -46
- package/dist/components/cards/Card.svelte.d.ts +6 -2
- package/dist/components/cards/Container.svelte +17 -33
- package/dist/components/cards/Divider.svelte +36 -52
- package/dist/components/cards/Divider.svelte.d.ts +2 -0
- package/dist/components/cards/Grid.svelte +55 -44
- package/dist/components/cards/Panel.svelte +18 -32
- package/dist/components/cards/Panel.svelte.d.ts +2 -1
- package/dist/components/cards/SectionHeader.svelte +24 -38
- package/dist/components/cards/SectionHeader.svelte.d.ts +1 -0
- package/dist/components/data/Avatar.svelte +48 -67
- package/dist/components/data/Badge.svelte +45 -32
- package/dist/components/data/Badge.svelte.d.ts +7 -1
- package/dist/components/data/CalendarGrid.svelte +433 -0
- package/dist/components/data/CalendarGrid.svelte.d.ts +25 -0
- package/dist/components/data/CalendarGrid.types.d.ts +7 -0
- package/dist/components/data/CalendarGrid.types.js +1 -0
- package/dist/components/data/CodeBlock.svelte +119 -121
- package/dist/components/data/CodeBlock.svelte.d.ts +8 -0
- package/dist/components/data/List.svelte +87 -64
- package/dist/components/data/List.svelte.d.ts +7 -0
- package/dist/components/data/Pagination.svelte +121 -123
- package/dist/components/data/Pagination.svelte.d.ts +5 -0
- package/dist/components/data/Sparkline.svelte +117 -0
- package/dist/components/data/Sparkline.svelte.d.ts +43 -0
- package/dist/components/data/Stat.svelte +92 -103
- package/dist/components/data/Table.svelte +443 -76
- package/dist/components/data/Table.svelte.d.ts +23 -2
- package/dist/components/data/Table.types.d.ts +14 -0
- package/dist/components/data/Table.types.js +1 -0
- package/dist/components/data/Tag.svelte +51 -53
- package/dist/components/data/Tag.svelte.d.ts +5 -1
- package/dist/components/data/index.d.ts +4 -0
- package/dist/components/data/index.js +2 -0
- package/dist/components/forms/Checkbox.svelte +39 -51
- package/dist/components/forms/Checkbox.svelte.d.ts +3 -1
- package/dist/components/forms/DatePicker.svelte +61 -0
- package/dist/components/forms/DatePicker.svelte.d.ts +15 -0
- package/dist/components/forms/DateTimePicker.svelte +63 -0
- package/dist/components/forms/DateTimePicker.svelte.d.ts +16 -0
- package/dist/components/forms/FileUpload.svelte +136 -164
- package/dist/components/forms/FileUpload.svelte.d.ts +1 -0
- package/dist/components/forms/Input.svelte +282 -57
- package/dist/components/forms/Input.svelte.d.ts +9 -3
- package/dist/components/forms/InputGroup.svelte +7 -7
- package/dist/components/forms/RadioGroup.svelte +77 -87
- package/dist/components/forms/RadioGroup.svelte.d.ts +3 -1
- package/dist/components/forms/RangeSlider.svelte +90 -116
- package/dist/components/forms/Select.svelte +106 -71
- package/dist/components/forms/Select.svelte.d.ts +3 -1
- package/dist/components/forms/Switch.svelte +44 -56
- package/dist/components/forms/Switch.svelte.d.ts +3 -1
- package/dist/components/forms/Textarea.svelte +52 -57
- package/dist/components/forms/Textarea.svelte.d.ts +3 -1
- package/dist/components/forms/TimePicker.svelte +63 -0
- package/dist/components/forms/TimePicker.svelte.d.ts +16 -0
- package/dist/components/forms/formClasses.d.ts +3 -0
- package/dist/components/forms/formClasses.js +3 -0
- package/dist/components/forms/index.d.ts +3 -0
- package/dist/components/forms/index.js +3 -0
- package/dist/components/navigation/Breadcrumbs.svelte +56 -59
- package/dist/components/navigation/Breadcrumbs.svelte.d.ts +1 -0
- package/dist/components/navigation/ContextMenu.svelte +133 -83
- package/dist/components/navigation/ContextMenu.svelte.d.ts +8 -1
- package/dist/components/navigation/DropdownMenu.svelte +139 -80
- package/dist/components/navigation/DropdownMenu.svelte.d.ts +8 -1
- package/dist/components/navigation/Menu.svelte +72 -48
- package/dist/components/navigation/Navbar.svelte +111 -32
- package/dist/components/navigation/Navbar.svelte.d.ts +6 -0
- package/dist/components/navigation/Sidebar.svelte +236 -35
- package/dist/components/navigation/Sidebar.svelte.d.ts +2 -0
- package/dist/components/navigation/Tabs.svelte +86 -54
- package/dist/components/navigation/Tabs.svelte.d.ts +5 -1
- package/dist/components/overlays/Alert.svelte +81 -99
- package/dist/components/overlays/Alert.svelte.d.ts +5 -1
- package/dist/components/overlays/CommandPalette.svelte +182 -217
- package/dist/components/overlays/Drawer.svelte +158 -167
- package/dist/components/overlays/Drawer.svelte.d.ts +3 -1
- package/dist/components/overlays/Dropdown.svelte +62 -30
- package/dist/components/overlays/Dropdown.svelte.d.ts +2 -0
- package/dist/components/overlays/Modal.svelte +125 -130
- package/dist/components/overlays/Modal.svelte.d.ts +3 -1
- package/dist/components/overlays/Popover.svelte +106 -131
- package/dist/components/overlays/ProgressBar.svelte +29 -45
- package/dist/components/overlays/SkeletonLoader.svelte +66 -82
- package/dist/components/overlays/Spinner.svelte +33 -43
- package/dist/components/overlays/Toast.svelte +111 -140
- package/dist/components/overlays/Toast.svelte.d.ts +3 -0
- package/dist/components/overlays/Tooltip.svelte +94 -115
- package/dist/components/overlays/Tooltip.svelte.d.ts +3 -1
- package/dist/components/typography/Code.svelte +10 -14
- package/dist/components/typography/Heading.svelte +15 -22
- package/dist/components/typography/Heading.svelte.d.ts +1 -0
- package/dist/components/typography/Text.svelte +21 -24
- package/dist/components/typography/Text.svelte.d.ts +2 -1
- package/dist/components/utilities/Accordion.svelte +54 -67
- package/dist/components/utilities/Accordion.svelte.d.ts +4 -1
- package/dist/components/utilities/Carousel.svelte +124 -152
- package/dist/components/utilities/Collapse.svelte +46 -60
- package/dist/components/utilities/Hero.svelte +42 -0
- package/dist/components/utilities/Hero.svelte.d.ts +10 -0
- package/dist/components/utilities/Portal.svelte +47 -72
- package/dist/components/utilities/ScrollArea.svelte +33 -41
- package/dist/components/utilities/SystemConsole.svelte +310 -0
- package/dist/components/utilities/SystemConsole.svelte.d.ts +20 -0
- package/dist/components/utilities/SystemInterface.svelte +726 -0
- package/dist/components/utilities/SystemInterface.svelte.d.ts +19 -0
- package/dist/components/utilities/index.d.ts +4 -0
- package/dist/components/utilities/index.js +3 -0
- package/dist/components/utilities/utilities.types.d.ts +46 -0
- package/dist/components/utilities/utilities.types.js +4 -0
- package/dist/index.d.ts +49 -4
- package/dist/index.js +4 -4
- package/dist/theme.css +2821 -218
- package/package.json +83 -76
|
@@ -1,152 +1,124 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
</button>
|
|
126
|
-
|
|
127
|
-
<button
|
|
128
|
-
type="button"
|
|
129
|
-
onclick={goToNext}
|
|
130
|
-
class="absolute right-4 top-1/2 -translate-y-1/2 glass-panel rounded-full p-2 text-text hover:accent-glow transition-all"
|
|
131
|
-
aria-label="Next item"
|
|
132
|
-
>
|
|
133
|
-
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
134
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
|
135
|
-
</svg>
|
|
136
|
-
</button>
|
|
137
|
-
{/if}
|
|
138
|
-
|
|
139
|
-
{#if showDots && items.length}
|
|
140
|
-
<div class="absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2">
|
|
141
|
-
{#each items as item, index (item.id)}
|
|
142
|
-
<button
|
|
143
|
-
type="button"
|
|
144
|
-
onclick={() => goToIndex(index)}
|
|
145
|
-
class="w-2 h-2 rounded-full transition-all {index === currentIndex ? 'accent-glow bg-accent w-8' : 'bg-text-muted'}"
|
|
146
|
-
aria-label="Go to item {index + 1}"
|
|
147
|
-
>
|
|
148
|
-
</button>
|
|
149
|
-
{/each}
|
|
150
|
-
</div>
|
|
151
|
-
{/if}
|
|
152
|
-
</div>
|
|
1
|
+
<script lang="ts">let { items, currentIndex = $bindable(0), autoplay = false, autoplayInterval = 3000, showDots = true, showArrows = true } = $props();
|
|
2
|
+
let startX = $state(0);
|
|
3
|
+
let currentX = $state(0);
|
|
4
|
+
let isDragging = $state(false);
|
|
5
|
+
function goToNext() {
|
|
6
|
+
if (!items.length)
|
|
7
|
+
return;
|
|
8
|
+
currentIndex = (currentIndex + 1) % items.length;
|
|
9
|
+
}
|
|
10
|
+
function goToPrev() {
|
|
11
|
+
if (!items.length)
|
|
12
|
+
return;
|
|
13
|
+
currentIndex = (currentIndex - 1 + items.length) % items.length;
|
|
14
|
+
}
|
|
15
|
+
function goToIndex(index) {
|
|
16
|
+
if (items.length === 0 || index < 0 || index >= items.length)
|
|
17
|
+
return;
|
|
18
|
+
currentIndex = index;
|
|
19
|
+
}
|
|
20
|
+
function handleTouchStart(event) {
|
|
21
|
+
isDragging = true;
|
|
22
|
+
startX = event.touches[0].clientX;
|
|
23
|
+
currentX = startX;
|
|
24
|
+
}
|
|
25
|
+
function handleTouchMove(event) {
|
|
26
|
+
if (!isDragging)
|
|
27
|
+
return;
|
|
28
|
+
currentX = event.touches[0].clientX;
|
|
29
|
+
}
|
|
30
|
+
function handleTouchEnd() {
|
|
31
|
+
if (!isDragging)
|
|
32
|
+
return;
|
|
33
|
+
if (!items.length) {
|
|
34
|
+
isDragging = false;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
isDragging = false;
|
|
38
|
+
const diff = startX - currentX;
|
|
39
|
+
const threshold = 50;
|
|
40
|
+
if (diff > threshold) {
|
|
41
|
+
goToNext();
|
|
42
|
+
}
|
|
43
|
+
else if (diff < -threshold) {
|
|
44
|
+
goToPrev();
|
|
45
|
+
}
|
|
46
|
+
startX = 0;
|
|
47
|
+
currentX = 0;
|
|
48
|
+
}
|
|
49
|
+
$effect(() => {
|
|
50
|
+
if (!autoplay || items.length < 2)
|
|
51
|
+
return;
|
|
52
|
+
const interval = setInterval(goToNext, autoplayInterval);
|
|
53
|
+
return () => {
|
|
54
|
+
clearInterval(interval);
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
// Clamp currentIndex when items change
|
|
58
|
+
$effect(() => {
|
|
59
|
+
if (items.length && (currentIndex < 0 || currentIndex >= items.length)) {
|
|
60
|
+
currentIndex = 0;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
export {};
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<div class="relative">
|
|
67
|
+
<div class="panel-raised rounded-[var(--radius-lg)] overflow-hidden">
|
|
68
|
+
<div
|
|
69
|
+
class="flex transition-transform duration-300 ease-luxe"
|
|
70
|
+
style="transform: translateX(-{currentIndex * 100}%);"
|
|
71
|
+
ontouchstart={handleTouchStart}
|
|
72
|
+
ontouchmove={handleTouchMove}
|
|
73
|
+
ontouchend={handleTouchEnd}
|
|
74
|
+
>
|
|
75
|
+
{#each items as item (item.id)}
|
|
76
|
+
<div class="min-w-full flex items-center justify-center p-8">
|
|
77
|
+
{#if typeof item.content === 'string'}
|
|
78
|
+
<div class="text-text">{item.content}</div>
|
|
79
|
+
{:else}
|
|
80
|
+
{@render item.content()}
|
|
81
|
+
{/if}
|
|
82
|
+
</div>
|
|
83
|
+
{/each}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
{#if showArrows && items.length}
|
|
88
|
+
<button
|
|
89
|
+
type="button"
|
|
90
|
+
onclick={goToPrev}
|
|
91
|
+
class="absolute left-2 top-1/2 -translate-y-1/2 obsidian-surface metal-edge rounded-full p-2 text-text hover:accent-glow transition-all"
|
|
92
|
+
aria-label="Previous item"
|
|
93
|
+
>
|
|
94
|
+
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
95
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
|
|
96
|
+
</svg>
|
|
97
|
+
</button>
|
|
98
|
+
|
|
99
|
+
<button
|
|
100
|
+
type="button"
|
|
101
|
+
onclick={goToNext}
|
|
102
|
+
class="absolute right-2 top-1/2 -translate-y-1/2 obsidian-surface metal-edge rounded-full p-2 text-text hover:accent-glow transition-all"
|
|
103
|
+
aria-label="Next item"
|
|
104
|
+
>
|
|
105
|
+
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
106
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
|
107
|
+
</svg>
|
|
108
|
+
</button>
|
|
109
|
+
{/if}
|
|
110
|
+
|
|
111
|
+
{#if showDots && items.length}
|
|
112
|
+
<div class="absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2">
|
|
113
|
+
{#each items as item, index (item.id)}
|
|
114
|
+
<button
|
|
115
|
+
type="button"
|
|
116
|
+
onclick={() => goToIndex(index)}
|
|
117
|
+
class="w-2 h-2 rounded-full transition-all {index === currentIndex ? 'accent-glow bg-accent w-8' : 'bg-text-muted'}"
|
|
118
|
+
aria-label="Go to item {index + 1}"
|
|
119
|
+
>
|
|
120
|
+
</button>
|
|
121
|
+
{/each}
|
|
122
|
+
</div>
|
|
123
|
+
{/if}
|
|
124
|
+
</div>
|
|
@@ -1,60 +1,46 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<div
|
|
49
|
-
bind:this={contentElement}
|
|
50
|
-
id={contentId}
|
|
51
|
-
class="overflow-hidden transition-[max-height] duration-300 ease-luxe"
|
|
52
|
-
style="max-height: {maxHeight};"
|
|
53
|
-
role="region"
|
|
54
|
-
aria-labelledby={headerId}
|
|
55
|
-
>
|
|
56
|
-
<div class="p-4 text-text-soft border-t border-border">
|
|
57
|
-
{@render children?.()}
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
1
|
+
<script lang="ts">import { createId } from '../../lib/internal/id.js';
|
|
2
|
+
let { open, title, children, onToggle } = $props();
|
|
3
|
+
let contentElement = $state();
|
|
4
|
+
let openLocal = $state(open);
|
|
5
|
+
const headerId = createId('collapse-header');
|
|
6
|
+
const contentId = createId('collapse-content');
|
|
7
|
+
function toggleLocal() {
|
|
8
|
+
openLocal = !openLocal;
|
|
9
|
+
}
|
|
10
|
+
let effectiveOpen = $derived(onToggle ? open : openLocal);
|
|
11
|
+
let maxHeight = $derived(effectiveOpen && contentElement ? `${contentElement.scrollHeight}px` : '0px');
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div class="border border-border rounded-md overflow-hidden {effectiveOpen ? 'panel-raised' : ''}">
|
|
15
|
+
<button
|
|
16
|
+
id={headerId}
|
|
17
|
+
type="button"
|
|
18
|
+
onclick={onToggle ?? toggleLocal}
|
|
19
|
+
class="w-full flex items-center justify-between p-4 text-left text-text font-medium hover:bg-base-3 transition-colors"
|
|
20
|
+
aria-expanded={effectiveOpen}
|
|
21
|
+
aria-controls={contentId}
|
|
22
|
+
>
|
|
23
|
+
<span>{title}</span>
|
|
24
|
+
<svg
|
|
25
|
+
class="w-5 h-5 transition-transform duration-300 ease-luxe {effectiveOpen ? 'rotate-180' : ''}"
|
|
26
|
+
fill="none"
|
|
27
|
+
stroke="currentColor"
|
|
28
|
+
viewBox="0 0 24 24"
|
|
29
|
+
>
|
|
30
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
|
|
31
|
+
</svg>
|
|
32
|
+
</button>
|
|
33
|
+
|
|
34
|
+
<div
|
|
35
|
+
bind:this={contentElement}
|
|
36
|
+
id={contentId}
|
|
37
|
+
class="overflow-hidden transition-[max-height] duration-300 ease-luxe"
|
|
38
|
+
style="max-height: {maxHeight};"
|
|
39
|
+
role="region"
|
|
40
|
+
aria-labelledby={headerId}
|
|
41
|
+
>
|
|
42
|
+
<div class="p-4 text-text-soft border-t border-border">
|
|
43
|
+
{@render children?.()}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts">"use strict";
|
|
2
|
+
let { title, text, features, children, class: className = '', ...restProps } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="hero-section {className}" {...restProps}>
|
|
6
|
+
{#if title}
|
|
7
|
+
<div class="mb-4">
|
|
8
|
+
{@render title()}
|
|
9
|
+
</div>
|
|
10
|
+
{/if}
|
|
11
|
+
|
|
12
|
+
{#if text}
|
|
13
|
+
<div class="mb-8 mx-auto max-w-3xl">
|
|
14
|
+
{@render text()}
|
|
15
|
+
</div>
|
|
16
|
+
{/if}
|
|
17
|
+
|
|
18
|
+
{#if features}
|
|
19
|
+
<div class="feature-tags">
|
|
20
|
+
{@render features()}
|
|
21
|
+
</div>
|
|
22
|
+
{/if}
|
|
23
|
+
|
|
24
|
+
{#if children}
|
|
25
|
+
{@render children()}
|
|
26
|
+
{/if}
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<style>
|
|
30
|
+
.feature-tags {
|
|
31
|
+
display: flex;
|
|
32
|
+
gap: 1rem;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
margin-top: 2rem;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.hero-section {
|
|
39
|
+
text-align: center;
|
|
40
|
+
padding-bottom: 3rem;
|
|
41
|
+
margin-bottom: 3rem;
|
|
42
|
+
}</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
title?: import('svelte').Snippet;
|
|
3
|
+
text?: import('svelte').Snippet;
|
|
4
|
+
features?: import('svelte').Snippet;
|
|
5
|
+
children?: import('svelte').Snippet;
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const Hero: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type Hero = ReturnType<typeof Hero>;
|
|
10
|
+
export default Hero;
|
|
@@ -1,72 +1,47 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
? document.querySelector<HTMLElement>(target)
|
|
49
|
-
: target;
|
|
50
|
-
|
|
51
|
-
if (!targetElement) return;
|
|
52
|
-
|
|
53
|
-
// Create container div
|
|
54
|
-
const container = document.createElement('div');
|
|
55
|
-
targetElement.appendChild(container);
|
|
56
|
-
mountElement = container;
|
|
57
|
-
|
|
58
|
-
return () => {
|
|
59
|
-
// Cleanup: remove container from DOM
|
|
60
|
-
container.remove();
|
|
61
|
-
mountElement = null;
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
{#if mountElement}
|
|
67
|
-
{#if children}
|
|
68
|
-
<div use:portal={mountElement}>
|
|
69
|
-
{@render children()}
|
|
70
|
-
</div>
|
|
71
|
-
{/if}
|
|
72
|
-
{/if}
|
|
1
|
+
<script lang="ts">let { target = 'body', children } = $props();
|
|
2
|
+
let mountElement = $state(null);
|
|
3
|
+
function portal(node, currentTarget) {
|
|
4
|
+
currentTarget.appendChild(node);
|
|
5
|
+
return {
|
|
6
|
+
update(newTarget) {
|
|
7
|
+
// Handle target prop changes by moving node to new parent
|
|
8
|
+
if (newTarget !== currentTarget) {
|
|
9
|
+
newTarget.appendChild(node);
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
destroy() {
|
|
13
|
+
if (node.parentNode) {
|
|
14
|
+
node.parentNode.removeChild(node);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
$effect(() => {
|
|
20
|
+
if (typeof document === 'undefined')
|
|
21
|
+
return;
|
|
22
|
+
// Resolve target element
|
|
23
|
+
const targetElement = typeof target === 'string'
|
|
24
|
+
? document.querySelector(target)
|
|
25
|
+
: target;
|
|
26
|
+
if (!targetElement)
|
|
27
|
+
return;
|
|
28
|
+
// Create container div
|
|
29
|
+
const container = document.createElement('div');
|
|
30
|
+
targetElement.appendChild(container);
|
|
31
|
+
mountElement = container;
|
|
32
|
+
return () => {
|
|
33
|
+
// Cleanup: remove container from DOM
|
|
34
|
+
container.remove();
|
|
35
|
+
mountElement = null;
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
export {};
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
{#if mountElement}
|
|
42
|
+
{#if children}
|
|
43
|
+
<div use:portal={mountElement}>
|
|
44
|
+
{@render children()}
|
|
45
|
+
</div>
|
|
46
|
+
{/if}
|
|
47
|
+
{/if}
|
|
@@ -1,41 +1,33 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
background: var(--color-accent);
|
|
35
|
-
border-radius: var(--radius-sm);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
div::-webkit-scrollbar-thumb:hover {
|
|
39
|
-
background: var(--color-accent-soft);
|
|
40
|
-
}
|
|
41
|
-
</style>
|
|
1
|
+
<script lang="ts">let { height = '400px', children } = $props();
|
|
2
|
+
export {};
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div
|
|
6
|
+
class="overflow-y-auto"
|
|
7
|
+
style="
|
|
8
|
+
height: {height};
|
|
9
|
+
scrollbar-width: thin;
|
|
10
|
+
scrollbar-color: var(--color-accent) var(--color-base-3);
|
|
11
|
+
"
|
|
12
|
+
>
|
|
13
|
+
{@render children?.()}
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
div::-webkit-scrollbar {
|
|
18
|
+
width: 8px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
div::-webkit-scrollbar-track {
|
|
22
|
+
background: var(--color-base-3);
|
|
23
|
+
border-radius: var(--radius-sm);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
div::-webkit-scrollbar-thumb {
|
|
27
|
+
background: var(--color-accent);
|
|
28
|
+
border-radius: var(--radius-sm);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
div::-webkit-scrollbar-thumb:hover {
|
|
32
|
+
background: var(--color-accent-soft);
|
|
33
|
+
}</style>
|