glasslikeui 0.2.2 → 1.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 -21
- package/README.md +215 -1
- package/dist/actions/a11ySync.d.ts +9 -0
- package/dist/actions/a11ySync.js +49 -0
- package/dist/actions/deviceMotion.d.ts +31 -0
- package/dist/actions/deviceMotion.js +142 -0
- package/dist/actions/dragSnap.d.ts +47 -0
- package/dist/actions/dragSnap.js +222 -0
- package/dist/actions/index.d.ts +5 -0
- package/dist/actions/index.js +5 -0
- package/dist/actions/scrollEdge.d.ts +21 -0
- package/dist/actions/scrollEdge.js +61 -0
- package/dist/actions/viewTransition.d.ts +23 -0
- package/dist/actions/viewTransition.js +34 -0
- package/dist/components/glass/Glass.svelte +164 -0
- package/dist/components/glass/Glass.svelte.d.ts +19 -0
- package/dist/components/glass/GlassCard.svelte +71 -64
- package/dist/components/glass/GlassCard.svelte.d.ts +4 -2
- package/dist/components/glass/GlassDimLayer.svelte +37 -0
- package/dist/components/glass/GlassDimLayer.svelte.d.ts +8 -0
- package/dist/components/glass/GlassEffectContainer.svelte +58 -0
- package/dist/components/glass/GlassEffectContainer.svelte.d.ts +12 -0
- package/dist/components/glass/GlassMorph.svelte +42 -0
- package/dist/components/glass/GlassMorph.svelte.d.ts +10 -0
- package/dist/components/glass/GlassSection.svelte +82 -76
- package/dist/components/glass/GlassSection.svelte.d.ts +4 -2
- package/dist/components/glass/LensFilters.svelte +41 -0
- package/dist/components/glass/LensFilters.svelte.d.ts +18 -0
- package/dist/components/glass/Sheet.svelte +266 -236
- package/dist/components/glass/Sheet.svelte.d.ts +6 -2
- package/dist/components/glass/index.d.ts +5 -5
- package/dist/components/glass/index.js +5 -5
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/interactive/Badge.svelte +52 -60
- package/dist/components/interactive/Badge.svelte.d.ts +2 -2
- package/dist/components/interactive/Button.svelte +168 -191
- package/dist/components/interactive/Button.svelte.d.ts +4 -4
- package/dist/components/interactive/IconButton.svelte +74 -85
- package/dist/components/interactive/IconButton.svelte.d.ts +4 -4
- package/dist/components/interactive/TabView.svelte +112 -22
- package/dist/components/interactive/TabView.svelte.d.ts +1 -1
- package/dist/components/layout/Divider.svelte +31 -31
- package/dist/components/layout/Divider.svelte.d.ts +1 -1
- package/dist/components/layout/Grid.svelte +52 -52
- package/dist/components/layout/Grid.svelte.d.ts +1 -1
- package/dist/components/layout/HStack.svelte +76 -76
- package/dist/components/layout/HStack.svelte.d.ts +1 -1
- package/dist/components/layout/ScrollView.svelte +83 -60
- package/dist/components/layout/ScrollView.svelte.d.ts +5 -1
- package/dist/components/layout/Spacer.svelte +18 -18
- package/dist/components/layout/Spacer.svelte.d.ts +1 -1
- package/dist/components/layout/VStack.svelte +56 -56
- package/dist/components/layout/VStack.svelte.d.ts +1 -1
- package/dist/components/layout/ZStack.svelte +51 -51
- package/dist/components/layout/ZStack.svelte.d.ts +1 -1
- package/dist/components/list/List.svelte +50 -50
- package/dist/components/list/List.svelte.d.ts +1 -1
- package/dist/components/list/ListRow.svelte +181 -181
- package/dist/components/list/ListRow.svelte.d.ts +1 -1
- package/dist/components/media/SymbolImage.svelte +46 -46
- package/dist/components/media/SymbolImage.svelte.d.ts +1 -1
- package/dist/components/navigation/NavigationBar.svelte +195 -106
- package/dist/components/navigation/NavigationBar.svelte.d.ts +2 -1
- package/dist/components/navigation/NavigationLink.svelte +45 -45
- package/dist/components/navigation/NavigationLink.svelte.d.ts +1 -1
- package/dist/components/typography/Text.svelte +98 -97
- package/dist/components/typography/Text.svelte.d.ts +2 -2
- package/dist/constants/colors.js +2 -2
- package/dist/constants/index.d.ts +1 -5
- package/dist/constants/index.js +1 -5
- package/dist/constants/sizes.js +4 -4
- package/dist/constants/variants.d.ts +23 -0
- package/dist/constants/variants.js +18 -0
- package/dist/icons/index.js +10 -7
- package/dist/index.d.ts +2 -4
- package/dist/index.js +2 -7
- package/dist/styles/glasslikeui.css +192 -0
- package/dist/styles/lens.css +93 -0
- package/dist/styles/squircle.css +17 -0
- package/dist/styles/typography.css +27 -0
- package/dist/test-setup.d.ts +1 -0
- package/dist/test-setup.js +6 -0
- package/package.json +50 -38
- package/dist/components/glass/LiquidGlass.svelte +0 -123
- package/dist/components/glass/LiquidGlass.svelte.d.ts +0 -17
- package/dist/constants/materials.d.ts +0 -13
- package/dist/constants/materials.js +0 -43
- package/dist/styles/liquidglass.css +0 -139
|
@@ -1,106 +1,195 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
import { HStack } from '../layout';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
title?: string;
|
|
7
|
-
leading?: Snippet;
|
|
8
|
-
trailing?: Snippet;
|
|
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
|
-
|
|
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
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { HStack } from '../layout';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
title?: string;
|
|
7
|
+
leading?: Snippet;
|
|
8
|
+
trailing?: Snippet;
|
|
9
|
+
largeTitle?: boolean;
|
|
10
|
+
transparent?: boolean;
|
|
11
|
+
scrolled?: boolean;
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
title = '',
|
|
17
|
+
leading,
|
|
18
|
+
trailing,
|
|
19
|
+
largeTitle = false,
|
|
20
|
+
transparent = false,
|
|
21
|
+
scrolled = $bindable(false),
|
|
22
|
+
class: className = ''
|
|
23
|
+
}: Props = $props();
|
|
24
|
+
|
|
25
|
+
let sentinelEl = $state<HTMLElement | undefined>();
|
|
26
|
+
let collapsed = $state(false);
|
|
27
|
+
|
|
28
|
+
$effect(() => {
|
|
29
|
+
if (!largeTitle || !sentinelEl || typeof IntersectionObserver === 'undefined') return;
|
|
30
|
+
|
|
31
|
+
const observer = new IntersectionObserver(
|
|
32
|
+
(entries) => {
|
|
33
|
+
for (const entry of entries) {
|
|
34
|
+
collapsed = !entry.isIntersecting;
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{ threshold: 0.1, rootMargin: '0px 0px -40px 0px' }
|
|
38
|
+
);
|
|
39
|
+
observer.observe(sentinelEl);
|
|
40
|
+
return () => observer.disconnect();
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
{#if largeTitle}
|
|
45
|
+
<div class="nav-large {className}" class:is-collapsed={collapsed}>
|
|
46
|
+
<header class="navigation-bar large" class:transparent class:scrolled={collapsed || scrolled}>
|
|
47
|
+
<nav class="nav-content">
|
|
48
|
+
<HStack spacing="sm" alignment="center" justify="between">
|
|
49
|
+
<div class="nav-leading">
|
|
50
|
+
{#if leading}
|
|
51
|
+
{@render leading()}
|
|
52
|
+
{/if}
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
{#if title}
|
|
56
|
+
<h1 class="nav-title-compact">{title}</h1>
|
|
57
|
+
{/if}
|
|
58
|
+
|
|
59
|
+
<div class="nav-trailing">
|
|
60
|
+
{#if trailing}
|
|
61
|
+
{@render trailing()}
|
|
62
|
+
{/if}
|
|
63
|
+
</div>
|
|
64
|
+
</HStack>
|
|
65
|
+
</nav>
|
|
66
|
+
</header>
|
|
67
|
+
|
|
68
|
+
<div class="nav-large-title-block">
|
|
69
|
+
<h1 class="nav-large-title">{title}</h1>
|
|
70
|
+
<div bind:this={sentinelEl} class="nav-title-sentinel" aria-hidden="true"></div>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
{:else}
|
|
74
|
+
<header class="navigation-bar {className}" class:transparent class:scrolled>
|
|
75
|
+
<nav class="nav-content">
|
|
76
|
+
<HStack spacing="sm" alignment="center" justify="between">
|
|
77
|
+
<div class="nav-leading">
|
|
78
|
+
{#if leading}
|
|
79
|
+
{@render leading()}
|
|
80
|
+
{/if}
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
{#if title}
|
|
84
|
+
<h1 class="nav-title-compact">{title}</h1>
|
|
85
|
+
{/if}
|
|
86
|
+
|
|
87
|
+
<div class="nav-trailing">
|
|
88
|
+
{#if trailing}
|
|
89
|
+
{@render trailing()}
|
|
90
|
+
{/if}
|
|
91
|
+
</div>
|
|
92
|
+
</HStack>
|
|
93
|
+
</nav>
|
|
94
|
+
</header>
|
|
95
|
+
{/if}
|
|
96
|
+
|
|
97
|
+
<style>
|
|
98
|
+
.navigation-bar {
|
|
99
|
+
position: fixed;
|
|
100
|
+
top: 0;
|
|
101
|
+
left: 0;
|
|
102
|
+
right: 0;
|
|
103
|
+
z-index: 100;
|
|
104
|
+
height: 56px;
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
background: var(--glass-nav-bg);
|
|
108
|
+
backdrop-filter: blur(var(--glass-blur-nav)) saturate(var(--glass-saturation));
|
|
109
|
+
-webkit-backdrop-filter: blur(var(--glass-blur-nav)) saturate(var(--glass-saturation));
|
|
110
|
+
border-bottom: 1px solid var(--glass-border);
|
|
111
|
+
transition: all var(--transition);
|
|
112
|
+
font-family: var(--font-system);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.navigation-bar.transparent {
|
|
116
|
+
background: transparent;
|
|
117
|
+
backdrop-filter: none;
|
|
118
|
+
-webkit-backdrop-filter: none;
|
|
119
|
+
border-bottom-color: transparent;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.navigation-bar.transparent.scrolled {
|
|
123
|
+
background: var(--glass-nav-bg);
|
|
124
|
+
backdrop-filter: blur(var(--glass-blur-nav)) saturate(var(--glass-saturation));
|
|
125
|
+
-webkit-backdrop-filter: blur(var(--glass-blur-nav)) saturate(var(--glass-saturation));
|
|
126
|
+
border-bottom-color: var(--glass-border);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.nav-content {
|
|
130
|
+
width: 100%;
|
|
131
|
+
max-width: var(--max-width);
|
|
132
|
+
margin: 0 auto;
|
|
133
|
+
padding: 0 var(--spacing-md);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.nav-leading,
|
|
137
|
+
.nav-trailing {
|
|
138
|
+
display: flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
gap: var(--spacing-sm);
|
|
141
|
+
min-width: 80px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.nav-trailing {
|
|
145
|
+
justify-content: flex-end;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.nav-title-compact {
|
|
149
|
+
font-size: 17px;
|
|
150
|
+
font-weight: 600;
|
|
151
|
+
color: var(--color-text);
|
|
152
|
+
text-align: center;
|
|
153
|
+
flex: 1;
|
|
154
|
+
white-space: nowrap;
|
|
155
|
+
overflow: hidden;
|
|
156
|
+
text-overflow: ellipsis;
|
|
157
|
+
margin: 0;
|
|
158
|
+
transition: opacity var(--transition);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.nav-large {
|
|
162
|
+
position: relative;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.navigation-bar.large .nav-title-compact {
|
|
166
|
+
opacity: 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.nav-large.is-collapsed .navigation-bar.large .nav-title-compact {
|
|
170
|
+
opacity: 1;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.nav-large-title-block {
|
|
174
|
+
padding: calc(56px + var(--spacing-sm)) var(--spacing-md) var(--spacing-md);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.nav-large-title {
|
|
178
|
+
font-size: clamp(1.75rem, 5vw, 2.25rem);
|
|
179
|
+
font-weight: 700;
|
|
180
|
+
color: var(--color-text);
|
|
181
|
+
letter-spacing: -0.02em;
|
|
182
|
+
margin: 0;
|
|
183
|
+
font-family: var(--font-system);
|
|
184
|
+
transition: opacity var(--transition);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.nav-large.is-collapsed .nav-large-title {
|
|
188
|
+
opacity: 0;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.nav-title-sentinel {
|
|
192
|
+
height: 1px;
|
|
193
|
+
width: 100%;
|
|
194
|
+
}
|
|
195
|
+
</style>
|
|
@@ -3,10 +3,11 @@ interface Props {
|
|
|
3
3
|
title?: string;
|
|
4
4
|
leading?: Snippet;
|
|
5
5
|
trailing?: Snippet;
|
|
6
|
+
largeTitle?: boolean;
|
|
6
7
|
transparent?: boolean;
|
|
7
8
|
scrolled?: boolean;
|
|
8
9
|
class?: string;
|
|
9
10
|
}
|
|
10
|
-
declare const NavigationBar: import("svelte").Component<Props, {},
|
|
11
|
+
declare const NavigationBar: import("svelte").Component<Props, {}, string>;
|
|
11
12
|
type NavigationBar = ReturnType<typeof NavigationBar>;
|
|
12
13
|
export default NavigationBar;
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
children: Snippet;
|
|
6
|
-
href: string;
|
|
7
|
-
active?: boolean;
|
|
8
|
-
class?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
let {
|
|
12
|
-
children,
|
|
13
|
-
href,
|
|
14
|
-
active = false,
|
|
15
|
-
class: className = ''
|
|
16
|
-
}: Props = $props();
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<a {href} class="navigation-link {className}" class:active aria-current={active ? 'page' : undefined}>
|
|
20
|
-
{@render children()}
|
|
21
|
-
</a>
|
|
22
|
-
|
|
23
|
-
<style>
|
|
24
|
-
.navigation-link {
|
|
25
|
-
display: inline-flex;
|
|
26
|
-
align-items: center;
|
|
27
|
-
padding: 8px 16px;
|
|
28
|
-
font-size: 0.875rem;
|
|
29
|
-
font-weight: 500;
|
|
30
|
-
color: var(--color-text-secondary);
|
|
31
|
-
text-decoration: none;
|
|
32
|
-
border-radius: var(--glass-radius-full);
|
|
33
|
-
transition: color var(--transition-spring);
|
|
34
|
-
position: relative;
|
|
35
|
-
z-index: 1;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.navigation-link:hover {
|
|
39
|
-
color: var(--color-text);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.navigation-link.active {
|
|
43
|
-
color: white;
|
|
44
|
-
}
|
|
45
|
-
</style>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
href: string;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
children,
|
|
13
|
+
href,
|
|
14
|
+
active = false,
|
|
15
|
+
class: className = ''
|
|
16
|
+
}: Props = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<a {href} class="navigation-link {className}" class:active aria-current={active ? 'page' : undefined}>
|
|
20
|
+
{@render children()}
|
|
21
|
+
</a>
|
|
22
|
+
|
|
23
|
+
<style>
|
|
24
|
+
.navigation-link {
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
padding: 8px 16px;
|
|
28
|
+
font-size: 0.875rem;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
color: var(--color-text-secondary);
|
|
31
|
+
text-decoration: none;
|
|
32
|
+
border-radius: var(--glass-radius-full);
|
|
33
|
+
transition: color var(--transition-spring);
|
|
34
|
+
position: relative;
|
|
35
|
+
z-index: 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.navigation-link:hover {
|
|
39
|
+
color: var(--color-text);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.navigation-link.active {
|
|
43
|
+
color: white;
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
@@ -5,6 +5,6 @@ interface Props {
|
|
|
5
5
|
active?: boolean;
|
|
6
6
|
class?: string;
|
|
7
7
|
}
|
|
8
|
-
declare const NavigationLink: import("svelte").Component<Props, {},
|
|
8
|
+
declare const NavigationLink: import("svelte").Component<Props, {}, string>;
|
|
9
9
|
type NavigationLink = ReturnType<typeof NavigationLink>;
|
|
10
10
|
export default NavigationLink;
|
|
@@ -1,97 +1,98 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
children: Snippet;
|
|
6
|
-
size?: 'xs' | 'sm' | 'body' | 'callout' | 'headline' | 'title1' | 'title2' | 'title3' | 'largeTitle' | 'hero';
|
|
7
|
-
weight?: 'regular' | 'medium' | 'semibold' | 'bold' | 'heavy';
|
|
8
|
-
color?: 'primary' | 'secondary' | 'tertiary' | 'accent' | 'white' | 'danger';
|
|
9
|
-
alignment?: 'leading' | 'center' | 'trailing';
|
|
10
|
-
gradient?: boolean;
|
|
11
|
-
class?: string;
|
|
12
|
-
id?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
let {
|
|
16
|
-
children,
|
|
17
|
-
size = 'body',
|
|
18
|
-
weight = 'regular',
|
|
19
|
-
color = 'primary',
|
|
20
|
-
alignment = 'leading',
|
|
21
|
-
gradient = false,
|
|
22
|
-
class: className = '',
|
|
23
|
-
id
|
|
24
|
-
}: Props = $props();
|
|
25
|
-
|
|
26
|
-
const sizeMap = {
|
|
27
|
-
xs: { fontSize: '0.6875rem', lineHeight: '1.4' },
|
|
28
|
-
sm: { fontSize: '0.8125rem', lineHeight: '1.4' },
|
|
29
|
-
body: { fontSize: '1rem', lineHeight: '1.6' },
|
|
30
|
-
callout: { fontSize: '1.0625rem', lineHeight: '1.5' },
|
|
31
|
-
headline: { fontSize: '1.125rem', lineHeight: '1.4' },
|
|
32
|
-
title3: { fontSize: '1.25rem', lineHeight: '1.3' },
|
|
33
|
-
title2: { fontSize: '1.5rem', lineHeight: '1.25' },
|
|
34
|
-
title1: { fontSize: 'clamp(1.75rem, 4vw, 2rem)', lineHeight: '1.2' },
|
|
35
|
-
largeTitle: { fontSize: 'clamp(2rem, 5vw, 3rem)', lineHeight: '1.1' },
|
|
36
|
-
hero: { fontSize: 'clamp(3rem, 12vw, 6rem)', lineHeight: '1' }
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const weightMap = {
|
|
40
|
-
regular: 400,
|
|
41
|
-
medium: 500,
|
|
42
|
-
semibold: 600,
|
|
43
|
-
bold: 700,
|
|
44
|
-
heavy: 800
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const colorMap = {
|
|
48
|
-
primary: 'var(--color-text)',
|
|
49
|
-
secondary: 'var(--color-text-secondary)',
|
|
50
|
-
tertiary: 'var(--color-text-tertiary)',
|
|
51
|
-
accent: 'var(--color-accent)',
|
|
52
|
-
white: '#ffffff',
|
|
53
|
-
danger: 'var(--color-danger, #ef4444)'
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const alignmentMap = {
|
|
57
|
-
leading: 'left',
|
|
58
|
-
center: 'center',
|
|
59
|
-
trailing: 'right'
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const styles = $derived(sizeMap[size]);
|
|
63
|
-
</script>
|
|
64
|
-
|
|
65
|
-
<span
|
|
66
|
-
{id}
|
|
67
|
-
class="text {className}"
|
|
68
|
-
class:gradient
|
|
69
|
-
style="
|
|
70
|
-
--text-size: {styles.fontSize};
|
|
71
|
-
--text-line-height: {styles.lineHeight};
|
|
72
|
-
--text-weight: {weightMap[weight]};
|
|
73
|
-
--text-color: {colorMap[color]};
|
|
74
|
-
--text-align: {alignmentMap[alignment]};
|
|
75
|
-
"
|
|
76
|
-
>
|
|
77
|
-
{@render children()}
|
|
78
|
-
</span>
|
|
79
|
-
|
|
80
|
-
<style>
|
|
81
|
-
.text {
|
|
82
|
-
display: block;
|
|
83
|
-
font-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
-webkit-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
size?: 'xs' | 'sm' | 'body' | 'callout' | 'headline' | 'title1' | 'title2' | 'title3' | 'largeTitle' | 'hero';
|
|
7
|
+
weight?: 'regular' | 'medium' | 'semibold' | 'bold' | 'heavy';
|
|
8
|
+
color?: 'primary' | 'secondary' | 'tertiary' | 'accent' | 'white' | 'danger';
|
|
9
|
+
alignment?: 'leading' | 'center' | 'trailing';
|
|
10
|
+
gradient?: boolean;
|
|
11
|
+
class?: string;
|
|
12
|
+
id?: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
children,
|
|
17
|
+
size = 'body',
|
|
18
|
+
weight = 'regular',
|
|
19
|
+
color = 'primary',
|
|
20
|
+
alignment = 'leading',
|
|
21
|
+
gradient = false,
|
|
22
|
+
class: className = '',
|
|
23
|
+
id
|
|
24
|
+
}: Props = $props();
|
|
25
|
+
|
|
26
|
+
const sizeMap = {
|
|
27
|
+
xs: { fontSize: '0.6875rem', lineHeight: '1.4' },
|
|
28
|
+
sm: { fontSize: '0.8125rem', lineHeight: '1.4' },
|
|
29
|
+
body: { fontSize: '1rem', lineHeight: '1.6' },
|
|
30
|
+
callout: { fontSize: '1.0625rem', lineHeight: '1.5' },
|
|
31
|
+
headline: { fontSize: '1.125rem', lineHeight: '1.4' },
|
|
32
|
+
title3: { fontSize: '1.25rem', lineHeight: '1.3' },
|
|
33
|
+
title2: { fontSize: '1.5rem', lineHeight: '1.25' },
|
|
34
|
+
title1: { fontSize: 'clamp(1.75rem, 4vw, 2rem)', lineHeight: '1.2' },
|
|
35
|
+
largeTitle: { fontSize: 'clamp(2rem, 5vw, 3rem)', lineHeight: '1.1' },
|
|
36
|
+
hero: { fontSize: 'clamp(3rem, 12vw, 6rem)', lineHeight: '1' }
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const weightMap = {
|
|
40
|
+
regular: 400,
|
|
41
|
+
medium: 500,
|
|
42
|
+
semibold: 600,
|
|
43
|
+
bold: 700,
|
|
44
|
+
heavy: 800
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const colorMap = {
|
|
48
|
+
primary: 'var(--color-text)',
|
|
49
|
+
secondary: 'var(--color-text-secondary)',
|
|
50
|
+
tertiary: 'var(--color-text-tertiary)',
|
|
51
|
+
accent: 'var(--color-accent)',
|
|
52
|
+
white: '#ffffff',
|
|
53
|
+
danger: 'var(--color-danger, #ef4444)'
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const alignmentMap = {
|
|
57
|
+
leading: 'left',
|
|
58
|
+
center: 'center',
|
|
59
|
+
trailing: 'right'
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const styles = $derived(sizeMap[size]);
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<span
|
|
66
|
+
{id}
|
|
67
|
+
class="text {className}"
|
|
68
|
+
class:gradient
|
|
69
|
+
style="
|
|
70
|
+
--text-size: {styles.fontSize};
|
|
71
|
+
--text-line-height: {styles.lineHeight};
|
|
72
|
+
--text-weight: {weightMap[weight]};
|
|
73
|
+
--text-color: {colorMap[color]};
|
|
74
|
+
--text-align: {alignmentMap[alignment]};
|
|
75
|
+
"
|
|
76
|
+
>
|
|
77
|
+
{@render children()}
|
|
78
|
+
</span>
|
|
79
|
+
|
|
80
|
+
<style>
|
|
81
|
+
.text {
|
|
82
|
+
display: block;
|
|
83
|
+
font-family: var(--font-system);
|
|
84
|
+
font-size: calc(var(--text-size) * var(--dynamic-type-scale, 1));
|
|
85
|
+
line-height: var(--text-line-height);
|
|
86
|
+
font-weight: var(--text-weight);
|
|
87
|
+
color: var(--text-color);
|
|
88
|
+
text-align: var(--text-align);
|
|
89
|
+
letter-spacing: -0.01em;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.text.gradient {
|
|
93
|
+
background: var(--glass-text-gradient);
|
|
94
|
+
-webkit-background-clip: text;
|
|
95
|
+
-webkit-text-fill-color: transparent;
|
|
96
|
+
background-clip: text;
|
|
97
|
+
}
|
|
98
|
+
</style>
|
|
@@ -7,8 +7,8 @@ interface Props {
|
|
|
7
7
|
alignment?: 'leading' | 'center' | 'trailing';
|
|
8
8
|
gradient?: boolean;
|
|
9
9
|
class?: string;
|
|
10
|
-
id?: string;
|
|
10
|
+
id?: string | undefined;
|
|
11
11
|
}
|
|
12
|
-
declare const Text: import("svelte").Component<Props, {},
|
|
12
|
+
declare const Text: import("svelte").Component<Props, {}, string>;
|
|
13
13
|
type Text = ReturnType<typeof Text>;
|
|
14
14
|
export default Text;
|
package/dist/constants/colors.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Centralized color constants for consistent theming
|
|
4
4
|
*/
|
|
5
5
|
/** Text color CSS values */
|
|
6
|
-
export
|
|
6
|
+
export var TEXT_COLORS = {
|
|
7
7
|
primary: 'var(--color-text)',
|
|
8
8
|
secondary: 'var(--color-text-secondary)',
|
|
9
9
|
tertiary: 'var(--color-text-tertiary)',
|
|
@@ -11,7 +11,7 @@ export const TEXT_COLORS = {
|
|
|
11
11
|
white: '#ffffff'
|
|
12
12
|
};
|
|
13
13
|
/** Background color variants */
|
|
14
|
-
export
|
|
14
|
+
export var BG_COLORS = {
|
|
15
15
|
primary: 'var(--color-bg)',
|
|
16
16
|
secondary: 'var(--color-bg-secondary)',
|
|
17
17
|
tertiary: 'var(--color-bg-tertiary)',
|