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,51 +1,51 @@
1
- <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
-
4
- interface Props {
5
- children: Snippet;
6
- alignment?: 'topLeading' | 'top' | 'topTrailing' | 'leading' | 'center' | 'trailing' | 'bottomLeading' | 'bottom' | 'bottomTrailing';
7
- class?: string;
8
- }
9
-
10
- let {
11
- children,
12
- alignment = 'center',
13
- class: className = ''
14
- }: Props = $props();
15
-
16
- const alignmentStyles = {
17
- topLeading: { justifyContent: 'flex-start', alignItems: 'flex-start' },
18
- top: { justifyContent: 'center', alignItems: 'flex-start' },
19
- topTrailing: { justifyContent: 'flex-end', alignItems: 'flex-start' },
20
- leading: { justifyContent: 'flex-start', alignItems: 'center' },
21
- center: { justifyContent: 'center', alignItems: 'center' },
22
- trailing: { justifyContent: 'flex-end', alignItems: 'center' },
23
- bottomLeading: { justifyContent: 'flex-start', alignItems: 'flex-end' },
24
- bottom: { justifyContent: 'center', alignItems: 'flex-end' },
25
- bottomTrailing: { justifyContent: 'flex-end', alignItems: 'flex-end' }
26
- };
27
-
28
- const style = $derived(alignmentStyles[alignment]);
29
- </script>
30
-
31
- <div
32
- class="zstack {className}"
33
- style="
34
- --zstack-justify: {style.justifyContent};
35
- --zstack-align: {style.alignItems};
36
- "
37
- >
38
- {@render children()}
39
- </div>
40
-
41
- <style>
42
- .zstack {
43
- display: grid;
44
- place-items: center;
45
- position: relative;
46
- }
47
-
48
- .zstack > :global(*) {
49
- grid-area: 1 / 1;
50
- }
51
- </style>
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+
4
+ interface Props {
5
+ children: Snippet;
6
+ alignment?: 'topLeading' | 'top' | 'topTrailing' | 'leading' | 'center' | 'trailing' | 'bottomLeading' | 'bottom' | 'bottomTrailing';
7
+ class?: string;
8
+ }
9
+
10
+ let {
11
+ children,
12
+ alignment = 'center',
13
+ class: className = ''
14
+ }: Props = $props();
15
+
16
+ const alignmentStyles = {
17
+ topLeading: { justifyContent: 'flex-start', alignItems: 'flex-start' },
18
+ top: { justifyContent: 'center', alignItems: 'flex-start' },
19
+ topTrailing: { justifyContent: 'flex-end', alignItems: 'flex-start' },
20
+ leading: { justifyContent: 'flex-start', alignItems: 'center' },
21
+ center: { justifyContent: 'center', alignItems: 'center' },
22
+ trailing: { justifyContent: 'flex-end', alignItems: 'center' },
23
+ bottomLeading: { justifyContent: 'flex-start', alignItems: 'flex-end' },
24
+ bottom: { justifyContent: 'center', alignItems: 'flex-end' },
25
+ bottomTrailing: { justifyContent: 'flex-end', alignItems: 'flex-end' }
26
+ };
27
+
28
+ const style = $derived(alignmentStyles[alignment]);
29
+ </script>
30
+
31
+ <div
32
+ class="zstack {className}"
33
+ style="
34
+ --zstack-justify: {style.justifyContent};
35
+ --zstack-align: {style.alignItems};
36
+ "
37
+ >
38
+ {@render children()}
39
+ </div>
40
+
41
+ <style>
42
+ .zstack {
43
+ display: grid;
44
+ place-items: center;
45
+ position: relative;
46
+ }
47
+
48
+ .zstack > :global(*) {
49
+ grid-area: 1 / 1;
50
+ }
51
+ </style>
@@ -1,50 +1,50 @@
1
- <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
- import { Glass } from '../glass';
4
-
5
- interface Props {
6
- children: Snippet;
7
- style?: 'plain' | 'inset' | 'grouped' | 'insetGrouped';
8
- class?: string;
9
- }
10
-
11
- let {
12
- children,
13
- style: listStyle = 'insetGrouped',
14
- class: className = ''
15
- }: Props = $props();
16
- </script>
17
-
18
- {#if listStyle === 'plain'}
19
- <div class="list list-plain {className}">
20
- {@render children()}
21
- </div>
22
- {:else}
23
- <Glass variant="regular" intensity="standard" padding="none" cornerRadius="xl" class="list list-{listStyle} {className}">
24
- {@render children()}
25
- </Glass>
26
- {/if}
27
-
28
- <style>
29
- :global(.list) {
30
- display: flex;
31
- flex-direction: column;
32
- width: 100%;
33
- }
34
-
35
- :global(.list-plain) {
36
- background: transparent;
37
- }
38
-
39
- :global(.list-inset) {
40
- margin: 0 var(--spacing-md);
41
- }
42
-
43
- :global(.list-grouped) {
44
- border-radius: 0;
45
- }
46
-
47
- :global(.list-insetGrouped) {
48
- margin: 0;
49
- }
50
- </style>
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { Glass } from '../glass';
4
+
5
+ interface Props {
6
+ children: Snippet;
7
+ style?: 'plain' | 'inset' | 'grouped' | 'insetGrouped';
8
+ class?: string;
9
+ }
10
+
11
+ let {
12
+ children,
13
+ style: listStyle = 'insetGrouped',
14
+ class: className = ''
15
+ }: Props = $props();
16
+ </script>
17
+
18
+ {#if listStyle === 'plain'}
19
+ <div class="list list-plain {className}">
20
+ {@render children()}
21
+ </div>
22
+ {:else}
23
+ <Glass variant="regular" intensity="standard" padding="none" cornerRadius="xl" class="list list-{listStyle} {className}">
24
+ {@render children()}
25
+ </Glass>
26
+ {/if}
27
+
28
+ <style>
29
+ :global(.list) {
30
+ display: flex;
31
+ flex-direction: column;
32
+ width: 100%;
33
+ }
34
+
35
+ :global(.list-plain) {
36
+ background: transparent;
37
+ }
38
+
39
+ :global(.list-inset) {
40
+ margin: 0 var(--spacing-md);
41
+ }
42
+
43
+ :global(.list-grouped) {
44
+ border-radius: 0;
45
+ }
46
+
47
+ :global(.list-insetGrouped) {
48
+ margin: 0;
49
+ }
50
+ </style>
@@ -1,181 +1,181 @@
1
- <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
- import { HStack } from '../layout';
4
- import { VStack } from '../layout';
5
- import { SymbolImage } from '../media';
6
-
7
- interface Props {
8
- children: Snippet;
9
- leading?: Snippet;
10
- trailing?: Snippet;
11
- subtitle?: string;
12
- showDivider?: boolean;
13
- interactive?: boolean;
14
- href?: string;
15
- onclick?: () => void;
16
- class?: string;
17
- }
18
-
19
- let {
20
- children,
21
- leading,
22
- trailing,
23
- subtitle = '',
24
- showDivider = true,
25
- interactive = false,
26
- href,
27
- onclick,
28
- class: className = ''
29
- }: Props = $props();
30
-
31
- const isInteractive = $derived(interactive || !!href || !!onclick);
32
- </script>
33
-
34
- {#if href}
35
- <a {href} class="list-row {className}" class:interactive={isInteractive} class:has-divider={showDivider}>
36
- <HStack spacing="sm" alignment="center" class="row-content">
37
- {#if leading}
38
- <div class="row-leading">
39
- {@render leading()}
40
- </div>
41
- {/if}
42
-
43
- <VStack spacing="none" alignment="leading" class="row-main">
44
- <div class="row-title">
45
- {@render children()}
46
- </div>
47
- {#if subtitle}
48
- <div class="row-subtitle">{subtitle}</div>
49
- {/if}
50
- </VStack>
51
-
52
- {#if trailing}
53
- <div class="row-trailing">
54
- {@render trailing()}
55
- </div>
56
- {:else if isInteractive}
57
- <SymbolImage name="chevron.right" size="sm" color="tertiary" />
58
- {/if}
59
- </HStack>
60
- </a>
61
- {:else if onclick}
62
- <button class="list-row {className}" class:interactive={isInteractive} class:has-divider={showDivider} {onclick}>
63
- <HStack spacing="sm" alignment="center" class="row-content">
64
- {#if leading}
65
- <div class="row-leading">
66
- {@render leading()}
67
- </div>
68
- {/if}
69
-
70
- <VStack spacing="none" alignment="leading" class="row-main">
71
- <div class="row-title">
72
- {@render children()}
73
- </div>
74
- {#if subtitle}
75
- <div class="row-subtitle">{subtitle}</div>
76
- {/if}
77
- </VStack>
78
-
79
- {#if trailing}
80
- <div class="row-trailing">
81
- {@render trailing()}
82
- </div>
83
- {:else if isInteractive}
84
- <SymbolImage name="chevron.right" size="sm" color="tertiary" />
85
- {/if}
86
- </HStack>
87
- </button>
88
- {:else}
89
- <div class="list-row {className}" class:has-divider={showDivider}>
90
- <HStack spacing="sm" alignment="center" class="row-content">
91
- {#if leading}
92
- <div class="row-leading">
93
- {@render leading()}
94
- </div>
95
- {/if}
96
-
97
- <VStack spacing="none" alignment="leading" class="row-main">
98
- <div class="row-title">
99
- {@render children()}
100
- </div>
101
- {#if subtitle}
102
- <div class="row-subtitle">{subtitle}</div>
103
- {/if}
104
- </VStack>
105
-
106
- {#if trailing}
107
- <div class="row-trailing">
108
- {@render trailing()}
109
- </div>
110
- {/if}
111
- </HStack>
112
- </div>
113
- {/if}
114
-
115
- <style>
116
- .list-row {
117
- display: block;
118
- width: 100%;
119
- padding: 0;
120
- background: transparent;
121
- border: none;
122
- text-decoration: none;
123
- color: inherit;
124
- text-align: left;
125
- font-family: inherit;
126
- cursor: default;
127
- }
128
-
129
- .list-row.interactive {
130
- cursor: pointer;
131
- }
132
-
133
- .list-row.interactive:hover {
134
- background: var(--glass-hover-subtle);
135
- }
136
-
137
- .list-row.interactive:active {
138
- background: var(--glass-active-subtle);
139
- }
140
-
141
- :global(.row-content) {
142
- padding: var(--spacing-sm) var(--spacing-md);
143
- min-height: 44px;
144
- }
145
-
146
- .list-row.has-divider {
147
- border-bottom: 1px solid var(--glass-divider);
148
- }
149
-
150
- .list-row:last-child {
151
- border-bottom: none;
152
- }
153
-
154
- .row-leading {
155
- display: flex;
156
- align-items: center;
157
- justify-content: center;
158
- }
159
-
160
- :global(.row-main) {
161
- flex: 1;
162
- min-width: 0;
163
- }
164
-
165
- .row-title {
166
- font-size: 1rem;
167
- color: var(--color-text);
168
- }
169
-
170
- .row-subtitle {
171
- font-size: 0.8125rem;
172
- color: var(--color-text-secondary);
173
- margin-top: 2px;
174
- }
175
-
176
- .row-trailing {
177
- display: flex;
178
- align-items: center;
179
- color: var(--color-text-tertiary);
180
- }
181
- </style>
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { HStack } from '../layout';
4
+ import { VStack } from '../layout';
5
+ import { SymbolImage } from '../media';
6
+
7
+ interface Props {
8
+ children: Snippet;
9
+ leading?: Snippet;
10
+ trailing?: Snippet;
11
+ subtitle?: string;
12
+ showDivider?: boolean;
13
+ interactive?: boolean;
14
+ href?: string;
15
+ onclick?: () => void;
16
+ class?: string;
17
+ }
18
+
19
+ let {
20
+ children,
21
+ leading,
22
+ trailing,
23
+ subtitle = '',
24
+ showDivider = true,
25
+ interactive = false,
26
+ href,
27
+ onclick,
28
+ class: className = ''
29
+ }: Props = $props();
30
+
31
+ const isInteractive = $derived(interactive || !!href || !!onclick);
32
+ </script>
33
+
34
+ {#if href}
35
+ <a {href} class="list-row {className}" class:interactive={isInteractive} class:has-divider={showDivider}>
36
+ <HStack spacing="sm" alignment="center" class="row-content">
37
+ {#if leading}
38
+ <div class="row-leading">
39
+ {@render leading()}
40
+ </div>
41
+ {/if}
42
+
43
+ <VStack spacing="none" alignment="leading" class="row-main">
44
+ <div class="row-title">
45
+ {@render children()}
46
+ </div>
47
+ {#if subtitle}
48
+ <div class="row-subtitle">{subtitle}</div>
49
+ {/if}
50
+ </VStack>
51
+
52
+ {#if trailing}
53
+ <div class="row-trailing">
54
+ {@render trailing()}
55
+ </div>
56
+ {:else if isInteractive}
57
+ <SymbolImage name="chevron.right" size="sm" color="tertiary" />
58
+ {/if}
59
+ </HStack>
60
+ </a>
61
+ {:else if onclick}
62
+ <button class="list-row {className}" class:interactive={isInteractive} class:has-divider={showDivider} {onclick}>
63
+ <HStack spacing="sm" alignment="center" class="row-content">
64
+ {#if leading}
65
+ <div class="row-leading">
66
+ {@render leading()}
67
+ </div>
68
+ {/if}
69
+
70
+ <VStack spacing="none" alignment="leading" class="row-main">
71
+ <div class="row-title">
72
+ {@render children()}
73
+ </div>
74
+ {#if subtitle}
75
+ <div class="row-subtitle">{subtitle}</div>
76
+ {/if}
77
+ </VStack>
78
+
79
+ {#if trailing}
80
+ <div class="row-trailing">
81
+ {@render trailing()}
82
+ </div>
83
+ {:else if isInteractive}
84
+ <SymbolImage name="chevron.right" size="sm" color="tertiary" />
85
+ {/if}
86
+ </HStack>
87
+ </button>
88
+ {:else}
89
+ <div class="list-row {className}" class:has-divider={showDivider}>
90
+ <HStack spacing="sm" alignment="center" class="row-content">
91
+ {#if leading}
92
+ <div class="row-leading">
93
+ {@render leading()}
94
+ </div>
95
+ {/if}
96
+
97
+ <VStack spacing="none" alignment="leading" class="row-main">
98
+ <div class="row-title">
99
+ {@render children()}
100
+ </div>
101
+ {#if subtitle}
102
+ <div class="row-subtitle">{subtitle}</div>
103
+ {/if}
104
+ </VStack>
105
+
106
+ {#if trailing}
107
+ <div class="row-trailing">
108
+ {@render trailing()}
109
+ </div>
110
+ {/if}
111
+ </HStack>
112
+ </div>
113
+ {/if}
114
+
115
+ <style>
116
+ .list-row {
117
+ display: block;
118
+ width: 100%;
119
+ padding: 0;
120
+ background: transparent;
121
+ border: none;
122
+ text-decoration: none;
123
+ color: inherit;
124
+ text-align: left;
125
+ font-family: inherit;
126
+ cursor: default;
127
+ }
128
+
129
+ .list-row.interactive {
130
+ cursor: pointer;
131
+ }
132
+
133
+ .list-row.interactive:hover {
134
+ background: var(--glass-hover-subtle);
135
+ }
136
+
137
+ .list-row.interactive:active {
138
+ background: var(--glass-active-subtle);
139
+ }
140
+
141
+ :global(.row-content) {
142
+ padding: var(--spacing-sm) var(--spacing-md);
143
+ min-height: 44px;
144
+ }
145
+
146
+ .list-row.has-divider {
147
+ border-bottom: 1px solid var(--glass-divider);
148
+ }
149
+
150
+ .list-row:last-child {
151
+ border-bottom: none;
152
+ }
153
+
154
+ .row-leading {
155
+ display: flex;
156
+ align-items: center;
157
+ justify-content: center;
158
+ }
159
+
160
+ :global(.row-main) {
161
+ flex: 1;
162
+ min-width: 0;
163
+ }
164
+
165
+ .row-title {
166
+ font-size: 1rem;
167
+ color: var(--color-text);
168
+ }
169
+
170
+ .row-subtitle {
171
+ font-size: 0.8125rem;
172
+ color: var(--color-text-secondary);
173
+ margin-top: 2px;
174
+ }
175
+
176
+ .row-trailing {
177
+ display: flex;
178
+ align-items: center;
179
+ color: var(--color-text-tertiary);
180
+ }
181
+ </style>
@@ -1,46 +1,46 @@
1
- <script lang="ts">
2
- import { ICON_SIZES, TEXT_COLORS } from '../../constants';
3
- import { getIconPath } from '../../icons';
4
- import type { IconSize, TextColor } from '../../constants';
5
-
6
- interface Props {
7
- name: string;
8
- size?: IconSize;
9
- color?: TextColor;
10
- class?: string;
11
- }
12
-
13
- let {
14
- name,
15
- size = 'md',
16
- color = 'primary',
17
- class: className = ''
18
- }: Props = $props();
19
-
20
- // Security Note: iconPath is always from hardcoded ICONS map, never user input
21
- const iconPath = $derived(getIconPath(name));
22
- const pixelSize = $derived(ICON_SIZES[size]);
23
- const colorValue = $derived(TEXT_COLORS[color]);
24
- </script>
25
-
26
- <svg
27
- class="symbol-image {className}"
28
- xmlns="http://www.w3.org/2000/svg"
29
- width={pixelSize}
30
- height={pixelSize}
31
- viewBox="0 0 24 24"
32
- fill="none"
33
- stroke={colorValue}
34
- stroke-width="2"
35
- stroke-linecap="round"
36
- stroke-linejoin="round"
37
- style="color: {colorValue}"
38
- >
39
- {@html iconPath}
40
- </svg>
41
-
42
- <style>
43
- .symbol-image {
44
- flex-shrink: 0;
45
- }
46
- </style>
1
+ <script lang="ts">
2
+ import { ICON_SIZES, TEXT_COLORS } from '../../constants';
3
+ import { getIconPath } from '../../icons';
4
+ import type { IconSize, TextColor } from '../../constants';
5
+
6
+ interface Props {
7
+ name: string;
8
+ size?: IconSize;
9
+ color?: TextColor;
10
+ class?: string;
11
+ }
12
+
13
+ let {
14
+ name,
15
+ size = 'md',
16
+ color = 'primary',
17
+ class: className = ''
18
+ }: Props = $props();
19
+
20
+ // Security Note: iconPath is always from hardcoded ICONS map, never user input
21
+ const iconPath = $derived(getIconPath(name));
22
+ const pixelSize = $derived(ICON_SIZES[size]);
23
+ const colorValue = $derived(TEXT_COLORS[color]);
24
+ </script>
25
+
26
+ <svg
27
+ class="symbol-image {className}"
28
+ xmlns="http://www.w3.org/2000/svg"
29
+ width={pixelSize}
30
+ height={pixelSize}
31
+ viewBox="0 0 24 24"
32
+ fill="none"
33
+ stroke={colorValue}
34
+ stroke-width="2"
35
+ stroke-linecap="round"
36
+ stroke-linejoin="round"
37
+ style="color: {colorValue}"
38
+ >
39
+ {@html iconPath}
40
+ </svg>
41
+
42
+ <style>
43
+ .symbol-image {
44
+ flex-shrink: 0;
45
+ }
46
+ </style>