glasslikeui 0.1.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 +1 -0
- package/dist/components/glass/GlassCard.svelte +64 -0
- package/dist/components/glass/GlassCard.svelte.d.ts +13 -0
- package/dist/components/glass/GlassSection.svelte +76 -0
- package/dist/components/glass/GlassSection.svelte.d.ts +12 -0
- package/dist/components/glass/LiquidGlass.svelte +123 -0
- package/dist/components/glass/LiquidGlass.svelte.d.ts +17 -0
- package/dist/components/glass/Sheet.svelte +236 -0
- package/dist/components/glass/Sheet.svelte.d.ts +13 -0
- package/dist/components/glass/index.d.ts +8 -0
- package/dist/components/glass/index.js +8 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.js +18 -0
- package/dist/components/interactive/Badge.svelte +60 -0
- package/dist/components/interactive/Badge.svelte.d.ts +9 -0
- package/dist/components/interactive/Button.svelte +156 -0
- package/dist/components/interactive/Button.svelte.d.ts +14 -0
- package/dist/components/interactive/IconButton.svelte +85 -0
- package/dist/components/interactive/IconButton.svelte.d.ts +12 -0
- package/dist/components/interactive/TabView.svelte +118 -0
- package/dist/components/interactive/TabView.svelte.d.ts +16 -0
- package/dist/components/interactive/index.d.ts +8 -0
- package/dist/components/interactive/index.js +8 -0
- package/dist/components/layout/Divider.svelte +31 -0
- package/dist/components/layout/Divider.svelte.d.ts +7 -0
- package/dist/components/layout/Grid.svelte +52 -0
- package/dist/components/layout/Grid.svelte.d.ts +11 -0
- package/dist/components/layout/HStack.svelte +76 -0
- package/dist/components/layout/HStack.svelte.d.ts +13 -0
- package/dist/components/layout/ScrollView.svelte +60 -0
- package/dist/components/layout/ScrollView.svelte.d.ts +10 -0
- package/dist/components/layout/Spacer.svelte +18 -0
- package/dist/components/layout/Spacer.svelte.d.ts +7 -0
- package/dist/components/layout/VStack.svelte +56 -0
- package/dist/components/layout/VStack.svelte.d.ts +11 -0
- package/dist/components/layout/ZStack.svelte +51 -0
- package/dist/components/layout/ZStack.svelte.d.ts +9 -0
- package/dist/components/layout/index.d.ts +11 -0
- package/dist/components/layout/index.js +11 -0
- package/dist/components/list/List.svelte +50 -0
- package/dist/components/list/List.svelte.d.ts +9 -0
- package/dist/components/list/ListRow.svelte +181 -0
- package/dist/components/list/ListRow.svelte.d.ts +15 -0
- package/dist/components/list/index.d.ts +6 -0
- package/dist/components/list/index.js +6 -0
- package/dist/components/media/SymbolImage.svelte +46 -0
- package/dist/components/media/SymbolImage.svelte.d.ts +10 -0
- package/dist/components/media/index.d.ts +5 -0
- package/dist/components/media/index.js +5 -0
- package/dist/components/navigation/NavigationBar.svelte +106 -0
- package/dist/components/navigation/NavigationBar.svelte.d.ts +12 -0
- package/dist/components/navigation/NavigationLink.svelte +45 -0
- package/dist/components/navigation/NavigationLink.svelte.d.ts +10 -0
- package/dist/components/navigation/index.d.ts +6 -0
- package/dist/components/navigation/index.js +6 -0
- package/dist/components/typography/Text.svelte +96 -0
- package/dist/components/typography/Text.svelte.d.ts +14 -0
- package/dist/components/typography/index.d.ts +5 -0
- package/dist/components/typography/index.js +5 -0
- package/dist/constants/colors.d.ts +22 -0
- package/dist/constants/colors.js +20 -0
- package/dist/constants/index.d.ts +7 -0
- package/dist/constants/index.js +7 -0
- package/dist/constants/materials.d.ts +13 -0
- package/dist/constants/materials.js +43 -0
- package/dist/constants/sizes.d.ts +44 -0
- package/dist/constants/sizes.js +40 -0
- package/dist/icons/index.d.ts +17 -0
- package/dist/icons/index.js +51 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +12 -0
- package/dist/styles/liquidglass.css +125 -0
- package/package.json +38 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
variant?: 'filled' | 'glass' | 'outlined' | 'plain' | 'tinted';
|
|
7
|
+
size?: 'sm' | 'md' | 'lg';
|
|
8
|
+
fullWidth?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
href?: string;
|
|
11
|
+
onclick?: (e: MouseEvent) => void;
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
children,
|
|
17
|
+
variant = 'filled',
|
|
18
|
+
size = 'md',
|
|
19
|
+
fullWidth = false,
|
|
20
|
+
disabled = false,
|
|
21
|
+
href,
|
|
22
|
+
onclick,
|
|
23
|
+
class: className = ''
|
|
24
|
+
}: Props = $props();
|
|
25
|
+
|
|
26
|
+
const sizeStyles = {
|
|
27
|
+
sm: { padding: '8px 16px', fontSize: '0.875rem' },
|
|
28
|
+
md: { padding: '12px 24px', fontSize: '1rem' },
|
|
29
|
+
lg: { padding: '16px 32px', fontSize: '1.0625rem' }
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const styles = $derived(sizeStyles[size]);
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
{#if href}
|
|
36
|
+
<a
|
|
37
|
+
{href}
|
|
38
|
+
class="button variant-{variant} size-{size} {className}"
|
|
39
|
+
class:full-width={fullWidth}
|
|
40
|
+
class:disabled
|
|
41
|
+
onclick={onclick}
|
|
42
|
+
style="
|
|
43
|
+
--btn-padding: {styles.padding};
|
|
44
|
+
--btn-font-size: {styles.fontSize};
|
|
45
|
+
"
|
|
46
|
+
>
|
|
47
|
+
{@render children()}
|
|
48
|
+
</a>
|
|
49
|
+
{:else}
|
|
50
|
+
<button
|
|
51
|
+
class="button variant-{variant} size-{size} {className}"
|
|
52
|
+
class:full-width={fullWidth}
|
|
53
|
+
{disabled}
|
|
54
|
+
{onclick}
|
|
55
|
+
style="
|
|
56
|
+
--btn-padding: {styles.padding};
|
|
57
|
+
--btn-font-size: {styles.fontSize};
|
|
58
|
+
"
|
|
59
|
+
>
|
|
60
|
+
{@render children()}
|
|
61
|
+
</button>
|
|
62
|
+
{/if}
|
|
63
|
+
|
|
64
|
+
<style>
|
|
65
|
+
.button {
|
|
66
|
+
display: inline-flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
gap: 8px;
|
|
70
|
+
padding: var(--btn-padding);
|
|
71
|
+
font-size: var(--btn-font-size);
|
|
72
|
+
font-weight: 500;
|
|
73
|
+
font-family: inherit;
|
|
74
|
+
border: none;
|
|
75
|
+
border-radius: var(--glass-radius-full);
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
text-decoration: none;
|
|
78
|
+
transition: all var(--transition-fast);
|
|
79
|
+
position: relative;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.button.full-width {
|
|
84
|
+
width: 100%;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.button.disabled {
|
|
88
|
+
opacity: 0.5;
|
|
89
|
+
pointer-events: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Filled variant */
|
|
93
|
+
.button.variant-filled {
|
|
94
|
+
background: var(--color-accent);
|
|
95
|
+
color: white;
|
|
96
|
+
box-shadow: 0 4px 16px -4px rgba(0, 113, 227, 0.5);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.button.variant-filled:hover {
|
|
100
|
+
background: var(--color-accent-hover);
|
|
101
|
+
transform: translateY(-2px);
|
|
102
|
+
box-shadow: 0 8px 24px -4px rgba(0, 113, 227, 0.5);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.button.variant-filled:active {
|
|
106
|
+
transform: translateY(0);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Glass variant */
|
|
110
|
+
.button.variant-glass {
|
|
111
|
+
background: var(--glass-button-bg);
|
|
112
|
+
backdrop-filter: blur(20px) saturate(1.8);
|
|
113
|
+
-webkit-backdrop-filter: blur(20px) saturate(1.8);
|
|
114
|
+
color: var(--color-text);
|
|
115
|
+
border: 1px solid var(--glass-border);
|
|
116
|
+
box-shadow:
|
|
117
|
+
inset 0 1px 0 0 var(--glass-highlight),
|
|
118
|
+
0 4px 16px -4px var(--glass-shadow);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.button.variant-glass:hover {
|
|
122
|
+
background: var(--glass-button-hover);
|
|
123
|
+
transform: translateY(-2px);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Outlined variant */
|
|
127
|
+
.button.variant-outlined {
|
|
128
|
+
background: transparent;
|
|
129
|
+
color: var(--color-accent);
|
|
130
|
+
border: 1.5px solid var(--color-accent);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.button.variant-outlined:hover {
|
|
134
|
+
background: rgba(0, 113, 227, 0.1);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Plain variant */
|
|
138
|
+
.button.variant-plain {
|
|
139
|
+
background: transparent;
|
|
140
|
+
color: var(--color-accent);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.button.variant-plain:hover {
|
|
144
|
+
text-decoration: underline;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* Tinted variant */
|
|
148
|
+
.button.variant-tinted {
|
|
149
|
+
background: rgba(0, 113, 227, 0.15);
|
|
150
|
+
color: var(--color-accent);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.button.variant-tinted:hover {
|
|
154
|
+
background: rgba(0, 113, 227, 0.25);
|
|
155
|
+
}
|
|
156
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
variant?: 'filled' | 'glass' | 'outlined' | 'plain' | 'tinted';
|
|
5
|
+
size?: 'sm' | 'md' | 'lg';
|
|
6
|
+
fullWidth?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
href?: string;
|
|
9
|
+
onclick?: (e: MouseEvent) => void;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type Button = ReturnType<typeof Button>;
|
|
14
|
+
export default Button;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
variant?: 'plain' | 'glass' | 'filled';
|
|
7
|
+
size?: 'sm' | 'md' | 'lg';
|
|
8
|
+
label?: string;
|
|
9
|
+
onclick?: (e: MouseEvent) => void;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
variant = 'plain',
|
|
16
|
+
size = 'md',
|
|
17
|
+
label = '',
|
|
18
|
+
onclick,
|
|
19
|
+
class: className = ''
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
|
|
22
|
+
const sizeMap = {
|
|
23
|
+
sm: 32,
|
|
24
|
+
md: 40,
|
|
25
|
+
lg: 48
|
|
26
|
+
};
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<button
|
|
30
|
+
class="icon-button variant-{variant} size-{size} {className}"
|
|
31
|
+
aria-label={label}
|
|
32
|
+
title={label}
|
|
33
|
+
{onclick}
|
|
34
|
+
style="--btn-size: {sizeMap[size]}px"
|
|
35
|
+
>
|
|
36
|
+
{@render children()}
|
|
37
|
+
</button>
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
.icon-button {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
width: var(--btn-size);
|
|
45
|
+
height: var(--btn-size);
|
|
46
|
+
border: none;
|
|
47
|
+
border-radius: var(--glass-radius-full);
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
transition: all var(--transition-fast);
|
|
50
|
+
background: transparent;
|
|
51
|
+
color: var(--color-text-secondary);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.icon-button:hover {
|
|
55
|
+
color: var(--color-text);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.icon-button.variant-plain {
|
|
59
|
+
background: transparent;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.icon-button.variant-plain:hover {
|
|
63
|
+
background: var(--glass-hover-subtle);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.icon-button.variant-glass {
|
|
67
|
+
background: var(--glass-button-bg);
|
|
68
|
+
backdrop-filter: blur(12px);
|
|
69
|
+
-webkit-backdrop-filter: blur(12px);
|
|
70
|
+
border: 1px solid var(--glass-border);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.icon-button.variant-glass:hover {
|
|
74
|
+
background: var(--glass-button-hover);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.icon-button.variant-filled {
|
|
78
|
+
background: var(--color-accent);
|
|
79
|
+
color: white;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.icon-button.variant-filled:hover {
|
|
83
|
+
background: var(--color-accent-hover);
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
variant?: 'plain' | 'glass' | 'filled';
|
|
5
|
+
size?: 'sm' | 'md' | 'lg';
|
|
6
|
+
label?: string;
|
|
7
|
+
onclick?: (e: MouseEvent) => void;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const IconButton: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type IconButton = ReturnType<typeof IconButton>;
|
|
12
|
+
export default IconButton;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { LiquidGlass } from '../glass';
|
|
4
|
+
import { HStack } from '../layout';
|
|
5
|
+
|
|
6
|
+
interface Tab {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
icon?: Snippet;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
tabs: Tab[];
|
|
14
|
+
activeTab?: string;
|
|
15
|
+
children: Snippet<[string]>;
|
|
16
|
+
position?: 'top' | 'bottom';
|
|
17
|
+
class?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
tabs,
|
|
22
|
+
activeTab = $bindable(tabs[0]?.id || ''),
|
|
23
|
+
children,
|
|
24
|
+
position = 'bottom',
|
|
25
|
+
class: className = ''
|
|
26
|
+
}: Props = $props();
|
|
27
|
+
|
|
28
|
+
function selectTab(tabId: string) {
|
|
29
|
+
activeTab = tabId;
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<div class="tab-view {className}" class:position-bottom={position === 'bottom'}>
|
|
34
|
+
<div class="tab-content">
|
|
35
|
+
{@render children(activeTab)}
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<LiquidGlass material="thick" cornerRadius="full" padding="xs" class="tab-bar-container">
|
|
39
|
+
<HStack spacing="xs" justify="center" class="tab-bar">
|
|
40
|
+
{#each tabs as tab}
|
|
41
|
+
<button
|
|
42
|
+
class="tab-item"
|
|
43
|
+
class:active={activeTab === tab.id}
|
|
44
|
+
onclick={() => selectTab(tab.id)}
|
|
45
|
+
>
|
|
46
|
+
{#if tab.icon}
|
|
47
|
+
<span class="tab-icon">{@render tab.icon()}</span>
|
|
48
|
+
{/if}
|
|
49
|
+
<span class="tab-label">{tab.label}</span>
|
|
50
|
+
</button>
|
|
51
|
+
{/each}
|
|
52
|
+
</HStack>
|
|
53
|
+
</LiquidGlass>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<style>
|
|
57
|
+
.tab-view {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
min-height: 100%;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.tab-view.position-bottom {
|
|
64
|
+
flex-direction: column-reverse;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.tab-content {
|
|
68
|
+
flex: 1;
|
|
69
|
+
overflow: auto;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:global(.tab-bar-container) {
|
|
73
|
+
position: fixed;
|
|
74
|
+
bottom: var(--spacing-md);
|
|
75
|
+
left: 50%;
|
|
76
|
+
transform: translateX(-50%);
|
|
77
|
+
z-index: 50;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:global(.tab-bar) {
|
|
81
|
+
min-width: 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.tab-item {
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
align-items: center;
|
|
88
|
+
gap: 4px;
|
|
89
|
+
padding: 10px 20px;
|
|
90
|
+
background: transparent;
|
|
91
|
+
border: none;
|
|
92
|
+
border-radius: var(--glass-radius-full);
|
|
93
|
+
color: var(--color-text-secondary);
|
|
94
|
+
font-size: 0.75rem;
|
|
95
|
+
font-weight: 500;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
transition: all var(--transition-fast);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.tab-item:hover {
|
|
101
|
+
color: var(--color-text);
|
|
102
|
+
background: var(--glass-hover-subtle);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.tab-item.active {
|
|
106
|
+
color: var(--color-accent);
|
|
107
|
+
background: var(--glass-active-bg);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.tab-icon {
|
|
111
|
+
font-size: 1.25rem;
|
|
112
|
+
line-height: 1;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.tab-label {
|
|
116
|
+
white-space: nowrap;
|
|
117
|
+
}
|
|
118
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Tab {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: Snippet;
|
|
6
|
+
}
|
|
7
|
+
interface Props {
|
|
8
|
+
tabs: Tab[];
|
|
9
|
+
activeTab?: string;
|
|
10
|
+
children: Snippet<[string]>;
|
|
11
|
+
position?: 'top' | 'bottom';
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const TabView: import("svelte").Component<Props, {}, "activeTab">;
|
|
15
|
+
type TabView = ReturnType<typeof TabView>;
|
|
16
|
+
export default TabView;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive Components
|
|
3
|
+
* Buttons, badges, and other interactive elements
|
|
4
|
+
*/
|
|
5
|
+
export { default as Button } from './Button.svelte';
|
|
6
|
+
export { default as IconButton } from './IconButton.svelte';
|
|
7
|
+
export { default as Badge } from './Badge.svelte';
|
|
8
|
+
export { default as TabView } from './TabView.svelte';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive Components
|
|
3
|
+
* Buttons, badges, and other interactive elements
|
|
4
|
+
*/
|
|
5
|
+
export { default as Button } from './Button.svelte';
|
|
6
|
+
export { default as IconButton } from './IconButton.svelte';
|
|
7
|
+
export { default as Badge } from './Badge.svelte';
|
|
8
|
+
export { default as TabView } from './TabView.svelte';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
orientation?: 'horizontal' | 'vertical';
|
|
4
|
+
class?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
orientation = 'horizontal',
|
|
9
|
+
class: className = ''
|
|
10
|
+
}: Props = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div class="divider {orientation} {className}"></div>
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
.divider {
|
|
17
|
+
background: var(--glass-divider);
|
|
18
|
+
flex-shrink: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.divider.horizontal {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 1px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.divider.vertical {
|
|
27
|
+
width: 1px;
|
|
28
|
+
height: 100%;
|
|
29
|
+
min-height: 16px;
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
columns?: number | 'auto';
|
|
7
|
+
minItemWidth?: string;
|
|
8
|
+
spacing?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
children,
|
|
14
|
+
columns = 'auto',
|
|
15
|
+
minItemWidth = '300px',
|
|
16
|
+
spacing = 'md',
|
|
17
|
+
class: className = ''
|
|
18
|
+
}: Props = $props();
|
|
19
|
+
|
|
20
|
+
const spacingMap = {
|
|
21
|
+
none: '0',
|
|
22
|
+
xs: 'var(--spacing-xs)',
|
|
23
|
+
sm: 'var(--spacing-sm)',
|
|
24
|
+
md: 'var(--spacing-md)',
|
|
25
|
+
lg: 'var(--spacing-lg)',
|
|
26
|
+
xl: 'var(--spacing-xl)'
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const gridTemplate = $derived(
|
|
30
|
+
columns === 'auto'
|
|
31
|
+
? `repeat(auto-fit, minmax(${minItemWidth}, 1fr))`
|
|
32
|
+
: `repeat(${columns}, 1fr)`
|
|
33
|
+
);
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<div
|
|
37
|
+
class="grid {className}"
|
|
38
|
+
style="
|
|
39
|
+
--grid-template: {gridTemplate};
|
|
40
|
+
--grid-spacing: {spacingMap[spacing]};
|
|
41
|
+
"
|
|
42
|
+
>
|
|
43
|
+
{@render children()}
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<style>
|
|
47
|
+
.grid {
|
|
48
|
+
display: grid;
|
|
49
|
+
grid-template-columns: var(--grid-template);
|
|
50
|
+
gap: var(--grid-spacing);
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
columns?: number | 'auto';
|
|
5
|
+
minItemWidth?: string;
|
|
6
|
+
spacing?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Grid: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type Grid = ReturnType<typeof Grid>;
|
|
11
|
+
export default Grid;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
spacing?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
+
alignment?: 'top' | 'center' | 'bottom' | 'stretch';
|
|
8
|
+
justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
9
|
+
wrap?: boolean;
|
|
10
|
+
padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
11
|
+
class?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
children,
|
|
16
|
+
spacing = 'md',
|
|
17
|
+
alignment = 'center',
|
|
18
|
+
justify = 'start',
|
|
19
|
+
wrap = false,
|
|
20
|
+
padding = 'none',
|
|
21
|
+
class: className = ''
|
|
22
|
+
}: Props = $props();
|
|
23
|
+
|
|
24
|
+
const spacingMap = {
|
|
25
|
+
none: '0',
|
|
26
|
+
xs: 'var(--spacing-xs)',
|
|
27
|
+
sm: 'var(--spacing-sm)',
|
|
28
|
+
md: 'var(--spacing-md)',
|
|
29
|
+
lg: 'var(--spacing-lg)',
|
|
30
|
+
xl: 'var(--spacing-xl)'
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const alignmentMap = {
|
|
34
|
+
top: 'flex-start',
|
|
35
|
+
center: 'center',
|
|
36
|
+
bottom: 'flex-end',
|
|
37
|
+
stretch: 'stretch'
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const justifyMap = {
|
|
41
|
+
start: 'flex-start',
|
|
42
|
+
center: 'center',
|
|
43
|
+
end: 'flex-end',
|
|
44
|
+
between: 'space-between',
|
|
45
|
+
around: 'space-around',
|
|
46
|
+
evenly: 'space-evenly'
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<div
|
|
51
|
+
class="hstack {className}"
|
|
52
|
+
class:wrap
|
|
53
|
+
style="
|
|
54
|
+
--hstack-spacing: {spacingMap[spacing]};
|
|
55
|
+
--hstack-alignment: {alignmentMap[alignment]};
|
|
56
|
+
--hstack-justify: {justifyMap[justify]};
|
|
57
|
+
--hstack-padding: {spacingMap[padding]};
|
|
58
|
+
"
|
|
59
|
+
>
|
|
60
|
+
{@render children()}
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<style>
|
|
64
|
+
.hstack {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: row;
|
|
67
|
+
gap: var(--hstack-spacing);
|
|
68
|
+
align-items: var(--hstack-alignment);
|
|
69
|
+
justify-content: var(--hstack-justify);
|
|
70
|
+
padding: var(--hstack-padding);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.hstack.wrap {
|
|
74
|
+
flex-wrap: wrap;
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
spacing?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
alignment?: 'top' | 'center' | 'bottom' | 'stretch';
|
|
6
|
+
justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
7
|
+
wrap?: boolean;
|
|
8
|
+
padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const HStack: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type HStack = ReturnType<typeof HStack>;
|
|
13
|
+
export default HStack;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
axis?: 'vertical' | 'horizontal' | 'both';
|
|
7
|
+
showsIndicators?: boolean;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
children,
|
|
13
|
+
axis = 'vertical',
|
|
14
|
+
showsIndicators = true,
|
|
15
|
+
class: className = ''
|
|
16
|
+
}: Props = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<div class="scroll-view axis-{axis} {className}" class:hide-indicators={!showsIndicators}>
|
|
20
|
+
<div class="scroll-content">
|
|
21
|
+
{@render children()}
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<style>
|
|
26
|
+
.scroll-view {
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
-webkit-overflow-scrolling: touch;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.scroll-view.axis-vertical {
|
|
32
|
+
overflow-y: auto;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.scroll-view.axis-horizontal {
|
|
36
|
+
overflow-x: auto;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.scroll-view.axis-both {
|
|
40
|
+
overflow: auto;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.scroll-view.hide-indicators {
|
|
44
|
+
scrollbar-width: none;
|
|
45
|
+
-ms-overflow-style: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.scroll-view.hide-indicators::-webkit-scrollbar {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.scroll-content {
|
|
53
|
+
min-height: 100%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.scroll-view.axis-horizontal .scroll-content {
|
|
57
|
+
display: flex;
|
|
58
|
+
width: max-content;
|
|
59
|
+
}
|
|
60
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
axis?: 'vertical' | 'horizontal' | 'both';
|
|
5
|
+
showsIndicators?: boolean;
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const ScrollView: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type ScrollView = ReturnType<typeof ScrollView>;
|
|
10
|
+
export default ScrollView;
|