glasslikeui 1.1.0 → 1.2.1

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 (41) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +215 -215
  3. package/dist/components/glass/Glass.svelte +165 -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 +261 -266
  11. package/dist/components/index.d.ts +1 -0
  12. package/dist/components/index.js +2 -0
  13. package/dist/components/interactive/Badge.svelte +52 -52
  14. package/dist/components/interactive/Button.svelte +168 -168
  15. package/dist/components/interactive/IconButton.svelte +74 -74
  16. package/dist/components/interactive/TabView.svelte +1 -1
  17. package/dist/components/layout/Divider.svelte +31 -31
  18. package/dist/components/layout/Grid.svelte +52 -52
  19. package/dist/components/layout/HStack.svelte +76 -76
  20. package/dist/components/layout/ScrollView.svelte +84 -83
  21. package/dist/components/layout/Spacer.svelte +18 -18
  22. package/dist/components/layout/VStack.svelte +56 -56
  23. package/dist/components/layout/ZStack.svelte +51 -51
  24. package/dist/components/list/List.svelte +50 -50
  25. package/dist/components/list/ListRow.svelte +181 -181
  26. package/dist/components/media/SymbolImage.svelte +46 -46
  27. package/dist/components/menu/Menu.svelte +189 -0
  28. package/dist/components/menu/Menu.svelte.d.ts +10 -0
  29. package/dist/components/menu/MenuItem.svelte +114 -0
  30. package/dist/components/menu/MenuItem.svelte.d.ts +12 -0
  31. package/dist/components/menu/index.d.ts +6 -0
  32. package/dist/components/menu/index.js +6 -0
  33. package/dist/components/navigation/NavigationBar.svelte +195 -195
  34. package/dist/components/navigation/NavigationLink.svelte +45 -45
  35. package/dist/components/typography/Text.svelte +98 -98
  36. package/dist/icons/index.js +4 -1
  37. package/dist/styles/glasslikeui.css +192 -192
  38. package/dist/styles/lens.css +93 -93
  39. package/dist/styles/squircle.css +17 -17
  40. package/dist/styles/typography.css +27 -27
  41. package/package.json +50 -50
@@ -0,0 +1,114 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { getIconPath } from '../../icons';
4
+
5
+ interface Props {
6
+ children: Snippet;
7
+ icon?: string;
8
+ href?: string;
9
+ onclick?: () => void;
10
+ destructive?: boolean;
11
+ class?: string;
12
+ }
13
+
14
+ let {
15
+ children,
16
+ icon,
17
+ href,
18
+ onclick,
19
+ destructive = false,
20
+ class: className = ''
21
+ }: Props = $props();
22
+
23
+ // Security Note: iconPath is always from the hardcoded ICONS map, never user input.
24
+ const iconPath = $derived(icon ? getIconPath(icon) : '');
25
+ </script>
26
+
27
+ {#snippet rowContent()}
28
+ {#if icon}
29
+ <svg
30
+ class="menu-item-icon"
31
+ xmlns="http://www.w3.org/2000/svg"
32
+ width="18"
33
+ height="18"
34
+ viewBox="0 0 24 24"
35
+ fill="none"
36
+ stroke="currentColor"
37
+ stroke-width="2"
38
+ stroke-linecap="round"
39
+ stroke-linejoin="round"
40
+ aria-hidden="true"
41
+ >
42
+ {@html iconPath}
43
+ </svg>
44
+ {/if}
45
+ <span class="menu-item-label">{@render children()}</span>
46
+ {/snippet}
47
+
48
+ {#if href}
49
+ <a
50
+ {href}
51
+ role="menuitem"
52
+ tabindex="-1"
53
+ class="menu-item {className}"
54
+ class:destructive
55
+ >
56
+ {@render rowContent()}
57
+ </a>
58
+ {:else}
59
+ <button
60
+ type="button"
61
+ role="menuitem"
62
+ tabindex="-1"
63
+ class="menu-item {className}"
64
+ class:destructive
65
+ {onclick}
66
+ >
67
+ {@render rowContent()}
68
+ </button>
69
+ {/if}
70
+
71
+ <style>
72
+ .menu-item {
73
+ display: flex;
74
+ align-items: center;
75
+ gap: 10px;
76
+ width: 100%;
77
+ padding: 9px 14px;
78
+ background: none;
79
+ border: none;
80
+ border-radius: 0;
81
+ font: inherit;
82
+ font-size: 0.95rem;
83
+ text-align: left;
84
+ text-decoration: none;
85
+ color: var(--color-text);
86
+ cursor: pointer;
87
+ }
88
+
89
+ .menu-item:hover {
90
+ background: var(--glass-hover-subtle);
91
+ }
92
+
93
+ .menu-item:active {
94
+ background: var(--glass-active-subtle);
95
+ }
96
+
97
+ .menu-item:focus-visible {
98
+ background: var(--glass-hover-subtle);
99
+ outline: 2px solid transparent;
100
+ }
101
+
102
+ .menu-item.destructive {
103
+ color: var(--color-danger);
104
+ }
105
+
106
+ .menu-item-icon {
107
+ flex-shrink: 0;
108
+ }
109
+
110
+ .menu-item-label {
111
+ flex: 1;
112
+ min-width: 0;
113
+ }
114
+ </style>
@@ -0,0 +1,12 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ children: Snippet;
4
+ icon?: string;
5
+ href?: string;
6
+ onclick?: () => void;
7
+ destructive?: boolean;
8
+ class?: string;
9
+ }
10
+ declare const MenuItem: import("svelte").Component<Props, {}, string>;
11
+ type MenuItem = ReturnType<typeof MenuItem>;
12
+ export default MenuItem;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Menu Components
3
+ * Dropdown menu and menu items
4
+ */
5
+ export { default as Menu } from './Menu.svelte';
6
+ export { default as MenuItem } from './MenuItem.svelte';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Menu Components
3
+ * Dropdown menu and menu items
4
+ */
5
+ export { default as Menu } from './Menu.svelte';
6
+ export { default as MenuItem } from './MenuItem.svelte';
@@ -1,195 +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
- 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>
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>
@@ -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>