glasslikeui 1.0.0 → 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.
Files changed (32) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +215 -215
  3. package/dist/components/glass/Glass.svelte +164 -164
  4. package/dist/components/glass/GlassCard.svelte +71 -71
  5. package/dist/components/glass/GlassDimLayer.svelte +37 -37
  6. package/dist/components/glass/GlassEffectContainer.svelte +58 -58
  7. package/dist/components/glass/GlassMorph.svelte +42 -42
  8. package/dist/components/glass/GlassSection.svelte +82 -82
  9. package/dist/components/glass/LensFilters.svelte +41 -41
  10. package/dist/components/glass/Sheet.svelte +266 -266
  11. package/dist/components/interactive/Badge.svelte +52 -52
  12. package/dist/components/interactive/Button.svelte +168 -168
  13. package/dist/components/interactive/IconButton.svelte +74 -74
  14. package/dist/components/interactive/TabView.svelte +107 -18
  15. package/dist/components/layout/Divider.svelte +31 -31
  16. package/dist/components/layout/Grid.svelte +52 -52
  17. package/dist/components/layout/HStack.svelte +76 -76
  18. package/dist/components/layout/ScrollView.svelte +83 -83
  19. package/dist/components/layout/Spacer.svelte +18 -18
  20. package/dist/components/layout/VStack.svelte +56 -56
  21. package/dist/components/layout/ZStack.svelte +51 -51
  22. package/dist/components/list/List.svelte +50 -50
  23. package/dist/components/list/ListRow.svelte +181 -181
  24. package/dist/components/media/SymbolImage.svelte +46 -46
  25. package/dist/components/navigation/NavigationBar.svelte +195 -195
  26. package/dist/components/navigation/NavigationLink.svelte +45 -45
  27. package/dist/components/typography/Text.svelte +98 -98
  28. package/dist/styles/glasslikeui.css +192 -192
  29. package/dist/styles/lens.css +93 -93
  30. package/dist/styles/squircle.css +17 -17
  31. package/dist/styles/typography.css +27 -27
  32. package/package.json +50 -50
@@ -1,266 +1,266 @@
1
- <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
- import { HStack, Spacer } from '../layout';
4
- import {
5
- dragSnap,
6
- detentFractions,
7
- type SheetDetentName
8
- } from '../../actions/dragSnap';
9
-
10
- const isBrowser = typeof window !== 'undefined';
11
-
12
- interface Props {
13
- isOpen?: boolean;
14
- title?: string;
15
- children: Snippet;
16
- onClose?: () => void;
17
- onDetentChange?: (name: SheetDetentName) => void;
18
- detents?: readonly SheetDetentName[];
19
- initialDetent?: SheetDetentName;
20
- showHandle?: boolean;
21
- draggable?: boolean;
22
- class?: string;
23
- }
24
-
25
- let {
26
- isOpen = $bindable(false),
27
- title = '',
28
- children,
29
- onClose,
30
- onDetentChange,
31
- detents = ['medium', 'large'],
32
- initialDetent = 'medium',
33
- showHandle = true,
34
- draggable = true,
35
- class: className = ''
36
- }: Props = $props();
37
-
38
- const fractions = $derived(detentFractions(detents));
39
- const initialIndex = $derived(Math.max(0, detents.indexOf(initialDetent)));
40
-
41
- let currentIndex = $state(0);
42
- let sheetEl = $state<HTMLElement | undefined>();
43
-
44
- $effect(() => {
45
- currentIndex = initialIndex;
46
- });
47
-
48
- function close() {
49
- isOpen = false;
50
- onClose?.();
51
- if (isBrowser) {
52
- document.body.style.overflow = '';
53
- }
54
- }
55
-
56
- function handleKeydown(e: KeyboardEvent) {
57
- if (e.key === 'Escape') {
58
- close();
59
- }
60
- }
61
-
62
- function handleBackdropClick(e: MouseEvent) {
63
- if (e.target === e.currentTarget) {
64
- close();
65
- }
66
- }
67
-
68
- function handleSnap(index: number) {
69
- currentIndex = index;
70
- const name = detents[index];
71
- if (name) onDetentChange?.(name);
72
- }
73
-
74
- $effect(() => {
75
- if (isBrowser && isOpen) {
76
- document.body.style.overflow = 'hidden';
77
- }
78
- return () => {
79
- if (isBrowser) {
80
- document.body.style.overflow = '';
81
- }
82
- };
83
- });
84
- </script>
85
-
86
- <svelte:window onkeydown={handleKeydown} />
87
-
88
- {#if isOpen}
89
- <div
90
- class="sheet-backdrop"
91
- class:open={isOpen}
92
- onclick={handleBackdropClick}
93
- onkeydown={(e) => e.key === 'Escape' && close()}
94
- role="presentation"
95
- >
96
- <div
97
- bind:this={sheetEl}
98
- class="sheet-container {className}"
99
- class:open={isOpen}
100
- >
101
- {#if showHandle}
102
- <div
103
- class="sheet-handle-container"
104
- use:dragSnap={{
105
- target: sheetEl,
106
- detents: fractions,
107
- initial: currentIndex,
108
- disabled: !draggable || fractions.length < 2,
109
- onSnap: handleSnap
110
- }}
111
- >
112
- <div class="sheet-handle"></div>
113
- </div>
114
- {/if}
115
-
116
- {#if title}
117
- <header class="sheet-header">
118
- <HStack alignment="center">
119
- <button class="sheet-close-btn" onclick={close} aria-label="Close">
120
- <svg
121
- xmlns="http://www.w3.org/2000/svg"
122
- width="20"
123
- height="20"
124
- viewBox="0 0 24 24"
125
- fill="none"
126
- stroke="currentColor"
127
- stroke-width="2"
128
- stroke-linecap="round"
129
- stroke-linejoin="round"
130
- >
131
- <polyline points="15 18 9 12 15 6"></polyline>
132
- </svg>
133
- <span>Back</span>
134
- </button>
135
- <Spacer />
136
- <h2 class="sheet-title">{title}</h2>
137
- <Spacer />
138
- <div class="sheet-spacer"></div>
139
- </HStack>
140
- </header>
141
- {/if}
142
-
143
- <div class="sheet-content">
144
- {@render children()}
145
- </div>
146
- </div>
147
- </div>
148
- {/if}
149
-
150
- <style>
151
- .sheet-backdrop {
152
- position: fixed;
153
- inset: 0;
154
- background: rgba(0, 0, 0, 0.4);
155
- backdrop-filter: blur(4px);
156
- -webkit-backdrop-filter: blur(4px);
157
- z-index: 1000;
158
- opacity: 0;
159
- visibility: hidden;
160
- transition: all 0.3s ease;
161
- }
162
-
163
- .sheet-backdrop.open {
164
- opacity: 1;
165
- visibility: visible;
166
- }
167
-
168
- .sheet-container {
169
- --sheet-y: 100vh;
170
- position: fixed;
171
- left: 0;
172
- right: 0;
173
- top: 0;
174
- height: 100vh;
175
- margin: 0 auto;
176
- background: var(--glass-sheet-bg);
177
- backdrop-filter: blur(var(--glass-blur-nav)) saturate(var(--glass-saturation));
178
- -webkit-backdrop-filter: blur(var(--glass-blur-nav)) saturate(var(--glass-saturation));
179
- border-radius: var(--glass-radius-xl) var(--glass-radius-xl) 0 0;
180
- overflow: hidden;
181
- display: flex;
182
- flex-direction: column;
183
- transform: translateY(var(--sheet-y));
184
- transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
185
- z-index: 1001;
186
- border-top: 1px solid var(--glass-border);
187
- box-shadow:
188
- 0 -8px 32px -8px var(--glass-shadow),
189
- inset 0 1px 0 0 var(--glass-highlight);
190
- touch-action: none;
191
- }
192
-
193
- .sheet-handle-container {
194
- display: flex;
195
- justify-content: center;
196
- padding: 8px 0;
197
- cursor: grab;
198
- }
199
- .sheet-handle-container:active {
200
- cursor: grabbing;
201
- }
202
-
203
- .sheet-handle {
204
- width: 36px;
205
- height: 5px;
206
- background: var(--glass-handle);
207
- border-radius: 3px;
208
- }
209
-
210
- .sheet-header {
211
- padding: 0 var(--spacing-md);
212
- height: 56px;
213
- border-bottom: 1px solid var(--glass-divider);
214
- display: flex;
215
- align-items: center;
216
- }
217
-
218
- .sheet-close-btn {
219
- display: flex;
220
- align-items: center;
221
- gap: 4px;
222
- background: none;
223
- border: none;
224
- color: var(--color-accent);
225
- font-size: 17px;
226
- font-weight: 400;
227
- cursor: pointer;
228
- padding: 8px 0;
229
- transition: opacity var(--transition-fast);
230
- font-family: var(--font-system);
231
- }
232
-
233
- .sheet-close-btn:hover {
234
- opacity: 0.7;
235
- }
236
-
237
- .sheet-close-btn svg {
238
- margin-left: -6px;
239
- }
240
-
241
- .sheet-title {
242
- font-size: 17px;
243
- font-weight: 600;
244
- color: var(--color-text);
245
- text-align: center;
246
- font-family: var(--font-system);
247
- }
248
-
249
- .sheet-spacer {
250
- width: 80px;
251
- }
252
-
253
- .sheet-content {
254
- flex: 1;
255
- overflow-y: auto;
256
- overflow-x: hidden;
257
- -webkit-overflow-scrolling: touch;
258
- font-family: var(--font-system);
259
- }
260
-
261
- @media (min-width: 769px) {
262
- .sheet-container {
263
- max-width: 900px;
264
- }
265
- }
266
- </style>
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { HStack, Spacer } from '../layout';
4
+ import {
5
+ dragSnap,
6
+ detentFractions,
7
+ type SheetDetentName
8
+ } from '../../actions/dragSnap';
9
+
10
+ const isBrowser = typeof window !== 'undefined';
11
+
12
+ interface Props {
13
+ isOpen?: boolean;
14
+ title?: string;
15
+ children: Snippet;
16
+ onClose?: () => void;
17
+ onDetentChange?: (name: SheetDetentName) => void;
18
+ detents?: readonly SheetDetentName[];
19
+ initialDetent?: SheetDetentName;
20
+ showHandle?: boolean;
21
+ draggable?: boolean;
22
+ class?: string;
23
+ }
24
+
25
+ let {
26
+ isOpen = $bindable(false),
27
+ title = '',
28
+ children,
29
+ onClose,
30
+ onDetentChange,
31
+ detents = ['medium', 'large'],
32
+ initialDetent = 'medium',
33
+ showHandle = true,
34
+ draggable = true,
35
+ class: className = ''
36
+ }: Props = $props();
37
+
38
+ const fractions = $derived(detentFractions(detents));
39
+ const initialIndex = $derived(Math.max(0, detents.indexOf(initialDetent)));
40
+
41
+ let currentIndex = $state(0);
42
+ let sheetEl = $state<HTMLElement | undefined>();
43
+
44
+ $effect(() => {
45
+ currentIndex = initialIndex;
46
+ });
47
+
48
+ function close() {
49
+ isOpen = false;
50
+ onClose?.();
51
+ if (isBrowser) {
52
+ document.body.style.overflow = '';
53
+ }
54
+ }
55
+
56
+ function handleKeydown(e: KeyboardEvent) {
57
+ if (e.key === 'Escape') {
58
+ close();
59
+ }
60
+ }
61
+
62
+ function handleBackdropClick(e: MouseEvent) {
63
+ if (e.target === e.currentTarget) {
64
+ close();
65
+ }
66
+ }
67
+
68
+ function handleSnap(index: number) {
69
+ currentIndex = index;
70
+ const name = detents[index];
71
+ if (name) onDetentChange?.(name);
72
+ }
73
+
74
+ $effect(() => {
75
+ if (isBrowser && isOpen) {
76
+ document.body.style.overflow = 'hidden';
77
+ }
78
+ return () => {
79
+ if (isBrowser) {
80
+ document.body.style.overflow = '';
81
+ }
82
+ };
83
+ });
84
+ </script>
85
+
86
+ <svelte:window onkeydown={handleKeydown} />
87
+
88
+ {#if isOpen}
89
+ <div
90
+ class="sheet-backdrop"
91
+ class:open={isOpen}
92
+ onclick={handleBackdropClick}
93
+ onkeydown={(e) => e.key === 'Escape' && close()}
94
+ role="presentation"
95
+ >
96
+ <div
97
+ bind:this={sheetEl}
98
+ class="sheet-container {className}"
99
+ class:open={isOpen}
100
+ >
101
+ {#if showHandle}
102
+ <div
103
+ class="sheet-handle-container"
104
+ use:dragSnap={{
105
+ target: sheetEl,
106
+ detents: fractions,
107
+ initial: currentIndex,
108
+ disabled: !draggable || fractions.length < 2,
109
+ onSnap: handleSnap
110
+ }}
111
+ >
112
+ <div class="sheet-handle"></div>
113
+ </div>
114
+ {/if}
115
+
116
+ {#if title}
117
+ <header class="sheet-header">
118
+ <HStack alignment="center">
119
+ <button class="sheet-close-btn" onclick={close} aria-label="Close">
120
+ <svg
121
+ xmlns="http://www.w3.org/2000/svg"
122
+ width="20"
123
+ height="20"
124
+ viewBox="0 0 24 24"
125
+ fill="none"
126
+ stroke="currentColor"
127
+ stroke-width="2"
128
+ stroke-linecap="round"
129
+ stroke-linejoin="round"
130
+ >
131
+ <polyline points="15 18 9 12 15 6"></polyline>
132
+ </svg>
133
+ <span>Back</span>
134
+ </button>
135
+ <Spacer />
136
+ <h2 class="sheet-title">{title}</h2>
137
+ <Spacer />
138
+ <div class="sheet-spacer"></div>
139
+ </HStack>
140
+ </header>
141
+ {/if}
142
+
143
+ <div class="sheet-content">
144
+ {@render children()}
145
+ </div>
146
+ </div>
147
+ </div>
148
+ {/if}
149
+
150
+ <style>
151
+ .sheet-backdrop {
152
+ position: fixed;
153
+ inset: 0;
154
+ background: rgba(0, 0, 0, 0.4);
155
+ backdrop-filter: blur(4px);
156
+ -webkit-backdrop-filter: blur(4px);
157
+ z-index: 1000;
158
+ opacity: 0;
159
+ visibility: hidden;
160
+ transition: all 0.3s ease;
161
+ }
162
+
163
+ .sheet-backdrop.open {
164
+ opacity: 1;
165
+ visibility: visible;
166
+ }
167
+
168
+ .sheet-container {
169
+ --sheet-y: 100vh;
170
+ position: fixed;
171
+ left: 0;
172
+ right: 0;
173
+ top: 0;
174
+ height: 100vh;
175
+ margin: 0 auto;
176
+ background: var(--glass-sheet-bg);
177
+ backdrop-filter: blur(var(--glass-blur-nav)) saturate(var(--glass-saturation));
178
+ -webkit-backdrop-filter: blur(var(--glass-blur-nav)) saturate(var(--glass-saturation));
179
+ border-radius: var(--glass-radius-xl) var(--glass-radius-xl) 0 0;
180
+ overflow: hidden;
181
+ display: flex;
182
+ flex-direction: column;
183
+ transform: translateY(var(--sheet-y));
184
+ transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
185
+ z-index: 1001;
186
+ border-top: 1px solid var(--glass-border);
187
+ box-shadow:
188
+ 0 -8px 32px -8px var(--glass-shadow),
189
+ inset 0 1px 0 0 var(--glass-highlight);
190
+ touch-action: none;
191
+ }
192
+
193
+ .sheet-handle-container {
194
+ display: flex;
195
+ justify-content: center;
196
+ padding: 8px 0;
197
+ cursor: grab;
198
+ }
199
+ .sheet-handle-container:active {
200
+ cursor: grabbing;
201
+ }
202
+
203
+ .sheet-handle {
204
+ width: 36px;
205
+ height: 5px;
206
+ background: var(--glass-handle);
207
+ border-radius: 3px;
208
+ }
209
+
210
+ .sheet-header {
211
+ padding: 0 var(--spacing-md);
212
+ height: 56px;
213
+ border-bottom: 1px solid var(--glass-divider);
214
+ display: flex;
215
+ align-items: center;
216
+ }
217
+
218
+ .sheet-close-btn {
219
+ display: flex;
220
+ align-items: center;
221
+ gap: 4px;
222
+ background: none;
223
+ border: none;
224
+ color: var(--color-accent);
225
+ font-size: 17px;
226
+ font-weight: 400;
227
+ cursor: pointer;
228
+ padding: 8px 0;
229
+ transition: opacity var(--transition-fast);
230
+ font-family: var(--font-system);
231
+ }
232
+
233
+ .sheet-close-btn:hover {
234
+ opacity: 0.7;
235
+ }
236
+
237
+ .sheet-close-btn svg {
238
+ margin-left: -6px;
239
+ }
240
+
241
+ .sheet-title {
242
+ font-size: 17px;
243
+ font-weight: 600;
244
+ color: var(--color-text);
245
+ text-align: center;
246
+ font-family: var(--font-system);
247
+ }
248
+
249
+ .sheet-spacer {
250
+ width: 80px;
251
+ }
252
+
253
+ .sheet-content {
254
+ flex: 1;
255
+ overflow-y: auto;
256
+ overflow-x: hidden;
257
+ -webkit-overflow-scrolling: touch;
258
+ font-family: var(--font-system);
259
+ }
260
+
261
+ @media (min-width: 769px) {
262
+ .sheet-container {
263
+ max-width: 900px;
264
+ }
265
+ }
266
+ </style>
@@ -1,52 +1,52 @@
1
- <script lang="ts">
2
- interface Props {
3
- label: string;
4
- variant?: 'default' | 'accent';
5
- size?: 'sm' | 'md';
6
- class?: string;
7
- }
8
-
9
- let {
10
- label,
11
- variant = 'default',
12
- size = 'md',
13
- class: className = ''
14
- }: Props = $props();
15
- </script>
16
-
17
- <span class="badge variant-{variant} size-{size} {className}">
18
- {label}
19
- </span>
20
-
21
- <style>
22
- .badge {
23
- display: inline-flex;
24
- align-items: center;
25
- justify-content: center;
26
- border-radius: var(--glass-radius-full);
27
- font-weight: 500;
28
- white-space: nowrap;
29
- }
30
-
31
- .badge.size-sm {
32
- padding: 4px 10px;
33
- font-size: 0.6875rem;
34
- }
35
-
36
- .badge.size-md {
37
- padding: 6px 14px;
38
- font-size: 0.75rem;
39
- }
40
-
41
- .badge.variant-default {
42
- background: var(--glass-badge-bg);
43
- color: var(--color-text-secondary);
44
- border: 1px solid var(--glass-border);
45
- }
46
-
47
- .badge.variant-accent {
48
- background: var(--color-accent-15);
49
- color: var(--color-accent);
50
- border: 1px solid var(--color-accent-25);
51
- }
52
- </style>
1
+ <script lang="ts">
2
+ interface Props {
3
+ label: string;
4
+ variant?: 'default' | 'accent';
5
+ size?: 'sm' | 'md';
6
+ class?: string;
7
+ }
8
+
9
+ let {
10
+ label,
11
+ variant = 'default',
12
+ size = 'md',
13
+ class: className = ''
14
+ }: Props = $props();
15
+ </script>
16
+
17
+ <span class="badge variant-{variant} size-{size} {className}">
18
+ {label}
19
+ </span>
20
+
21
+ <style>
22
+ .badge {
23
+ display: inline-flex;
24
+ align-items: center;
25
+ justify-content: center;
26
+ border-radius: var(--glass-radius-full);
27
+ font-weight: 500;
28
+ white-space: nowrap;
29
+ }
30
+
31
+ .badge.size-sm {
32
+ padding: 4px 10px;
33
+ font-size: 0.6875rem;
34
+ }
35
+
36
+ .badge.size-md {
37
+ padding: 6px 14px;
38
+ font-size: 0.75rem;
39
+ }
40
+
41
+ .badge.variant-default {
42
+ background: var(--glass-badge-bg);
43
+ color: var(--color-text-secondary);
44
+ border: 1px solid var(--glass-border);
45
+ }
46
+
47
+ .badge.variant-accent {
48
+ background: var(--color-accent-15);
49
+ color: var(--color-accent);
50
+ border: 1px solid var(--color-accent-25);
51
+ }
52
+ </style>