bref-ui 2.0.1 → 2.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 (109) hide show
  1. package/dist/button/button.svelte +67 -47
  2. package/dist/button/types.d.ts +1 -0
  3. package/dist/checkbox/checkbox.svelte +40 -35
  4. package/dist/combobox/combobox.svelte +2 -3
  5. package/dist/combobox/input.svelte +1 -1
  6. package/dist/combobox/list.svelte +5 -5
  7. package/dist/combobox/option.svelte +29 -9
  8. package/dist/dialog/dialog.svelte +15 -12
  9. package/dist/dialog/footer.svelte +2 -2
  10. package/dist/dialog/header.svelte +4 -4
  11. package/dist/icon/icon.svelte +6 -4
  12. package/dist/pill/content.svelte +11 -4
  13. package/dist/pill/content.svelte.d.ts +1 -1
  14. package/dist/pill/on-delete.svelte +42 -13
  15. package/dist/pill/pill.svelte +74 -94
  16. package/dist/pill/registry.json +1 -1
  17. package/dist/pill/types.d.ts +1 -0
  18. package/dist/pill-choice-group/pill-choice-group.svelte +19 -0
  19. package/dist/pill-choice-group/types.d.ts +1 -0
  20. package/dist/pill-group/pill-group.svelte +2 -0
  21. package/dist/pill-group/types.d.ts +1 -0
  22. package/dist/popover/popover.svelte +31 -6
  23. package/dist/popover/types.d.ts +1 -1
  24. package/dist/progress/progress.svelte +42 -55
  25. package/dist/select/empty.svelte +2 -3
  26. package/dist/select/list.svelte +2 -1
  27. package/dist/select/option.svelte +20 -6
  28. package/dist/select/select.svelte +7 -4
  29. package/dist/select/trigger.svelte +30 -7
  30. package/dist/spinner/spinner.svelte +8 -21
  31. package/dist/surface/surface.svelte +6 -1
  32. package/dist/surface/types.d.ts +2 -0
  33. package/dist/switch/switch.svelte +48 -51
  34. package/dist/text-area/registry.json +1 -1
  35. package/dist/text-area/text-area.svelte +33 -73
  36. package/dist/text-area/types.d.ts +1 -0
  37. package/dist/text-input/registry.json +1 -1
  38. package/dist/text-input/text-input.svelte +33 -73
  39. package/dist/text-input/types.d.ts +1 -0
  40. package/dist/theme/cli-theme.svelte +2 -0
  41. package/dist/theme/glass.svelte +60 -0
  42. package/dist/theme/glass.svelte.d.ts +26 -0
  43. package/dist/theme/registry.json +1 -0
  44. package/dist/theme/styles.svelte +6 -0
  45. package/dist/theme/surface.d.ts +1 -1
  46. package/dist/theme/surface.js +3 -2
  47. package/dist/theme/surfaces.svelte +23 -45
  48. package/dist/theme/theme.svelte +2 -0
  49. package/dist/tree-view/tree-node/chevron-button.svelte +9 -9
  50. package/dist/tree-view/tree-node/content.svelte +15 -12
  51. package/dist/tree-view/tree-node/delete-button.svelte +6 -5
  52. package/dist/tree-view/tree-node/tree-node.svelte +23 -24
  53. package/dist/tree-view/tree-view-section.svelte +9 -9
  54. package/dist/tree-view/tree-view.svelte +17 -9
  55. package/dist/tree-view/types.d.ts +2 -1
  56. package/package.json +1 -1
  57. package/readme.md +3 -1
  58. package/src/lib/button/button.svelte +67 -47
  59. package/src/lib/button/types.ts +1 -0
  60. package/src/lib/checkbox/checkbox.svelte +40 -35
  61. package/src/lib/combobox/combobox.svelte +2 -3
  62. package/src/lib/combobox/input.svelte +1 -1
  63. package/src/lib/combobox/list.svelte +5 -5
  64. package/src/lib/combobox/option.svelte +29 -9
  65. package/src/lib/dialog/dialog.svelte +15 -12
  66. package/src/lib/dialog/footer.svelte +2 -2
  67. package/src/lib/dialog/header.svelte +4 -4
  68. package/src/lib/icon/icon.svelte +6 -4
  69. package/src/lib/pill/content.svelte +11 -4
  70. package/src/lib/pill/on-delete.svelte +42 -13
  71. package/src/lib/pill/pill.svelte +74 -94
  72. package/src/lib/pill/registry.json +1 -1
  73. package/src/lib/pill/types.ts +1 -0
  74. package/src/lib/pill-choice-group/pill-choice-group.svelte +19 -0
  75. package/src/lib/pill-choice-group/types.ts +1 -0
  76. package/src/lib/pill-group/pill-group.svelte +2 -0
  77. package/src/lib/pill-group/types.ts +1 -0
  78. package/src/lib/popover/popover.svelte +31 -6
  79. package/src/lib/popover/types.ts +16 -1
  80. package/src/lib/progress/progress.svelte +42 -55
  81. package/src/lib/select/empty.svelte +2 -3
  82. package/src/lib/select/list.svelte +2 -1
  83. package/src/lib/select/option.svelte +20 -6
  84. package/src/lib/select/select.svelte +7 -4
  85. package/src/lib/select/trigger.svelte +30 -7
  86. package/src/lib/spinner/spinner.svelte +8 -21
  87. package/src/lib/surface/surface.svelte +6 -1
  88. package/src/lib/surface/types.ts +2 -0
  89. package/src/lib/switch/switch.svelte +48 -51
  90. package/src/lib/text-area/registry.json +1 -1
  91. package/src/lib/text-area/text-area.svelte +33 -73
  92. package/src/lib/text-area/types.ts +1 -0
  93. package/src/lib/text-input/registry.json +1 -1
  94. package/src/lib/text-input/text-input.svelte +33 -73
  95. package/src/lib/text-input/types.ts +1 -0
  96. package/src/lib/theme/cli-theme.svelte +2 -0
  97. package/src/lib/theme/glass.svelte +60 -0
  98. package/src/lib/theme/registry.json +1 -0
  99. package/src/lib/theme/styles.svelte +6 -0
  100. package/src/lib/theme/surface.ts +4 -2
  101. package/src/lib/theme/surfaces.svelte +23 -45
  102. package/src/lib/theme/theme.svelte +2 -0
  103. package/src/lib/tree-view/tree-node/chevron-button.svelte +9 -9
  104. package/src/lib/tree-view/tree-node/content.svelte +15 -12
  105. package/src/lib/tree-view/tree-node/delete-button.svelte +6 -5
  106. package/src/lib/tree-view/tree-node/tree-node.svelte +23 -24
  107. package/src/lib/tree-view/tree-view-section.svelte +9 -9
  108. package/src/lib/tree-view/tree-view.svelte +17 -9
  109. package/src/lib/tree-view/types.ts +2 -1
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
- /* eslint-disable max-lines -- Keep the native control and its scoped style recipe together. */
3
2
  import Icon from '../icon/icon.svelte';
3
+ import { surface } from '../theme/surface.js';
4
4
  import type { TextInputProps } from './types.js';
5
5
 
6
6
  let {
@@ -9,7 +9,8 @@
9
9
  icon,
10
10
  size = 'medium',
11
11
  wide = false,
12
- variant = 'neutral',
12
+ variant = 'soft',
13
+ glass = false,
13
14
  oninput,
14
15
  defaultValue,
15
16
  ...attributes
@@ -22,7 +23,17 @@
22
23
  };
23
24
  </script>
24
25
 
25
- <div data-size={size} data-variant={variant} data-wide={wide || undefined}>
26
+ <div
27
+ class={surface({
28
+ color: 'background',
29
+ variant,
30
+ glass,
31
+ hover: variant === 'soft' && !attributes.disabled ? 'small' : undefined
32
+ })}
33
+ data-size={size}
34
+ data-variant={variant}
35
+ data-wide={wide || undefined}
36
+ >
26
37
  {#if icon}
27
38
  <span><Icon {...icon} label={undefined} /></span>
28
39
  {/if}
@@ -37,75 +48,38 @@
37
48
  <style>
38
49
  div {
39
50
  --internal-height: 2.5rem;
40
- --internal-padding: 0.85rem;
51
+ --internal-padding: 1rem;
41
52
  --internal-icon-size: 1.25rem;
42
- --internal-tint: var(--color-foreground, black);
43
- --internal-strength-light: 3%;
44
- --internal-strength-dark: 3%;
45
- --internal-opacity: 15%;
46
- --internal-border: transparent;
47
- --internal-highlight: color-mix(in srgb, var(--color-foreground, black) 12%, transparent);
53
+ --internal-placeholder: color-mix(in srgb, var(--color-muted,) 35%, var(--color-foreground));
48
54
  box-sizing: border-box;
49
55
  display: inline-flex;
50
56
  align-items: center;
51
57
  align-self: start;
52
- gap: 0.6rem;
58
+ gap: 0.625rem;
53
59
  width: min(100%, 18rem);
54
60
  min-width: 0;
55
61
  max-width: 100%;
56
62
  min-height: var(--internal-height);
57
63
  padding-inline: var(--internal-padding);
58
- border: 1px solid var(--internal-border);
59
- border-radius: 0.5rem;
60
- background: color-mix(
61
- in srgb,
62
- light-dark(
63
- color-mix(
64
- in srgb,
65
- var(--internal-tint) var(--internal-strength-light),
66
- var(--color-background, white)
67
- ),
68
- color-mix(
69
- in srgb,
70
- var(--internal-tint) var(--internal-strength-dark),
71
- var(--color-background, white)
72
- )
73
- )
74
- var(--internal-opacity),
75
- transparent
76
- );
77
- color: var(--color-foreground, black);
78
- transition: all 150ms ease;
79
- -webkit-backdrop-filter: blur(0.5rem) saturate(120%);
80
- backdrop-filter: blur(0.5rem) saturate(120%);
64
+ border-radius: 0.625rem;
81
65
  }
82
66
  div[data-wide] {
83
67
  width: 100%;
84
68
  }
85
69
  div[data-size='small'] {
86
70
  --internal-height: 2rem;
87
- --internal-padding: 0.65rem;
71
+ --internal-padding: 0.75rem;
88
72
  --internal-icon-size: 1rem;
89
73
  }
90
74
  div[data-size='large'] {
91
75
  --internal-height: 3rem;
92
- --internal-padding: 1rem;
76
+ --internal-padding: 1.125rem;
93
77
  --internal-icon-size: 1.5rem;
94
78
  }
95
- div[data-variant='soft'] {
96
- --internal-strength-light: 4%;
97
- --internal-strength-dark: 16%;
98
- --internal-opacity: 85%;
99
- --internal-border: light-dark(
100
- color-mix(in srgb, var(--color-foreground, black) 12%, transparent),
101
- color-mix(in srgb, var(--color-foreground, black) 30%, transparent)
102
- );
103
- box-shadow: inset 0 1px 0 var(--internal-highlight);
104
- }
105
79
  span {
106
80
  display: inline-flex;
107
81
  flex: 0 0 auto;
108
- color: var(--color-muted, #666);
82
+ color: var(--color-muted);
109
83
  font-size: var(--internal-icon-size);
110
84
  pointer-events: none;
111
85
  }
@@ -121,7 +95,7 @@
121
95
  font: inherit;
122
96
  font-size: 1rem;
123
97
  font-weight: 200;
124
- line-height: 1.4;
98
+ line-height: 1.5;
125
99
  }
126
100
  input {
127
101
  height: calc(var(--internal-height) - 2px);
@@ -136,41 +110,27 @@
136
110
  margin: 0;
137
111
  }
138
112
  input::placeholder {
139
- color: var(--color-muted, #666);
140
- }
141
- div[data-variant='soft']:hover:not(:has(:disabled)) {
142
- --internal-border: light-dark(
143
- color-mix(in srgb, var(--color-foreground, black) 18%, transparent),
144
- color-mix(in srgb, var(--color-foreground, black) 38%, transparent)
145
- );
146
- --internal-strength-light: 6%;
147
- --internal-strength-dark: 20%;
113
+ color: var(--internal-placeholder);
114
+ opacity: 1;
148
115
  }
149
116
  div:has(input:focus) {
150
- --internal-tint: var(--color-primary, blue);
151
- --internal-strength-light: 6%;
152
- --internal-strength-dark: 12%;
153
- --internal-border: color-mix(in srgb, var(--internal-tint) 55%, transparent);
154
- box-shadow:
155
- inset 0 1px 0 var(--internal-highlight),
156
- 0 0 0 3px color-mix(in srgb, var(--internal-tint) 16%, transparent);
157
- }
158
- div:has(input:invalid, [aria-invalid='true']) {
159
- --internal-tint: var(--color-error, #bc2436);
160
- --internal-border: color-mix(in srgb, var(--internal-tint) 65%, transparent);
117
+ outline: 2px solid var(--color-primary);
118
+ outline-offset: 2px;
119
+ }
120
+ div:has(input:user-invalid, input[aria-invalid='true']) {
121
+ --surface-border: var(--color-error);
122
+ outline-color: var(--color-error);
161
123
  }
162
124
  div:has(:disabled) {
163
125
  opacity: 0.5;
164
126
  cursor: not-allowed;
165
127
  }
128
+ div[data-variant='soft']:has(input:disabled):hover {
129
+ --surface-strength: var(--surface-soft-strength);
130
+ }
166
131
  input:disabled {
167
132
  cursor: inherit;
168
133
  }
169
- @media (prefers-reduced-motion: reduce) {
170
- div {
171
- transition: none;
172
- }
173
- }
174
134
  @media (forced-colors: active) {
175
135
  div {
176
136
  border-color: ButtonText;
@@ -8,4 +8,5 @@ export type TextInputProps = Omit<HTMLInputAttributes, 'value' | 'size'> & {
8
8
  size?: BaseSize;
9
9
  wide?: boolean;
10
10
  variant?: Exclude<Variant, 'filled'>;
11
+ glass?: boolean;
11
12
  };
@@ -2,6 +2,7 @@
2
2
  import type { Snippet } from 'svelte';
3
3
  import Colors from './colors.svelte';
4
4
  import Surfaces from './surfaces.svelte';
5
+ import Glass from './glass.svelte';
5
6
  import Fonts from './fonts.svelte';
6
7
  import Styles from './styles.svelte';
7
8
 
@@ -10,6 +11,7 @@
10
11
 
11
12
  <Colors />
12
13
  <Surfaces />
14
+ <Glass />
13
15
  <Fonts />
14
16
  <Styles />
15
17
 
@@ -0,0 +1,60 @@
1
+ <style>
2
+ :global(.glass) {
3
+ --glass-paint: var(--surface-fill, var(--color-background, white));
4
+ --glass-opacity: 20%;
5
+ --glass-blur: blur(0.75rem) saturate(120%);
6
+ }
7
+ /* Three class selectors keep opt-in material above ordinary scoped component paint.
8
+ Inline styles and explicit selectors can still override it. */
9
+ :global(.glass.glass.glass) {
10
+ background: var(--glass-paint);
11
+ color: var(--surface-content, var(--color-foreground, black));
12
+ box-shadow:
13
+ inset 0 1px 0 color-mix(in srgb, var(--color-foreground, black) 8%, transparent),
14
+ var(--surface-shadow, 0 0.5rem 1.5rem color-mix(in srgb, black 12%, transparent));
15
+ }
16
+ :global(.glass:where(.surface-neutral)) {
17
+ --glass-paint: color-mix(
18
+ in srgb,
19
+ var(--surface-tint) var(--surface-strength),
20
+ var(--surface-base)
21
+ );
22
+ }
23
+ :global(.glass:where(.surface-soft)) {
24
+ --glass-opacity: 40%;
25
+ }
26
+ :global(.glass:where(.surface-filled)) {
27
+ --glass-opacity: 65%;
28
+ }
29
+ @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
30
+ :global(.glass.glass.glass) {
31
+ background: color-mix(in srgb, var(--glass-paint) var(--glass-opacity), transparent);
32
+ -webkit-backdrop-filter: var(--glass-blur);
33
+ backdrop-filter: var(--glass-blur);
34
+ }
35
+ }
36
+ @media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
37
+ :global(.glass.glass.glass) {
38
+ background: var(--glass-paint);
39
+ box-shadow: var(--surface-shadow, 0 0 0 transparent);
40
+ -webkit-backdrop-filter: none;
41
+ backdrop-filter: none;
42
+ }
43
+ }
44
+ @media (forced-colors: active) {
45
+ :global(.glass.glass.glass) {
46
+ border-color: CanvasText;
47
+ background: Canvas;
48
+ color: CanvasText;
49
+ box-shadow: none;
50
+ -webkit-backdrop-filter: none;
51
+ backdrop-filter: none;
52
+ }
53
+ :global(
54
+ .glass.glass.glass:is(:disabled, [aria-disabled='true'], [data-surface-disabled='true'])
55
+ ) {
56
+ color: GrayText;
57
+ opacity: 1;
58
+ }
59
+ }
60
+ </style>
@@ -0,0 +1,26 @@
1
+ export default Glass;
2
+ type Glass = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const Glass: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -4,6 +4,7 @@
4
4
  "cli-theme.svelte",
5
5
  "colors.svelte",
6
6
  "surfaces.svelte",
7
+ "glass.svelte",
7
8
  "fonts.svelte",
8
9
  "styles.svelte",
9
10
  "surface.ts"
@@ -1,7 +1,13 @@
1
1
  <style>
2
+ :global(:root) {
3
+ --font-sans:
4
+ ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
5
+ }
6
+
2
7
  :global(body) {
3
8
  background: var(--color-background);
4
9
  color: var(--color-foreground);
10
+ font-family: var(--font-text, var(--font-sans));
5
11
  }
6
12
 
7
13
  :global(*) {
@@ -1,3 +1,3 @@
1
1
  import type { SurfaceBaseProps } from '../types.js';
2
2
  /** Compose typed surface classes; render Theme once to load their paint recipes. */
3
- export declare const surface: ({ variant, color, shadow, hover }?: SurfaceBaseProps) => string;
3
+ export declare const surface: ({ variant, color, shadow, hover, glass }?: SurfaceBaseProps) => string;
@@ -1,10 +1,11 @@
1
1
  /** Compose typed surface classes; render Theme once to load their paint recipes. */
2
- export const surface = ({ variant = 'neutral', color = 'foreground', shadow, hover } = {}) => [
2
+ export const surface = ({ variant = 'neutral', color = 'foreground', shadow, hover, glass = false } = {}) => [
3
3
  'surface',
4
4
  `surface-${variant}`,
5
5
  `surface-${color}`,
6
6
  shadow && `surface-shadow-${shadow === true ? 'medium' : shadow}`,
7
- hover && `surface-hover-${hover}`
7
+ hover && `surface-hover-${hover}`,
8
+ glass && 'glass'
8
9
  ]
9
10
  .filter(Boolean)
10
11
  .join(' ');
@@ -7,9 +7,12 @@
7
7
  --surface-color: var(--color-foreground, black);
8
8
  --surface-base: var(--color-background, white);
9
9
  --surface-foreground: var(--color-foreground, black);
10
- --surface-strength: 0%;
10
+ --surface-tint: var(--surface-color);
11
+ --surface-soft-strength: 24%;
12
+ --surface-neutral-strength: 2%;
13
+ --surface-strength: var(--surface-neutral-strength);
11
14
  --surface-hover: 0%;
12
- --surface-fill: transparent;
15
+ --surface-fill: color-mix(in srgb, var(--surface-tint) var(--surface-strength), transparent);
13
16
  --surface-border: transparent;
14
17
  --surface-content: var(--surface-color);
15
18
  --surface-neutral-content: color-mix(
@@ -19,16 +22,11 @@
19
22
  );
20
23
  --surface-highlight: 0 0 0 transparent;
21
24
  --surface-shadow: 0 0 0 transparent;
22
- --surface-glow: 0 0 0 transparent;
23
- --surface-glow-size: 0;
24
- --surface-blur: none;
25
25
  box-sizing: border-box;
26
26
  border: 1px solid var(--surface-border);
27
27
  background: var(--surface-fill);
28
28
  color: var(--surface-content);
29
- box-shadow: var(--surface-highlight), var(--surface-shadow), var(--surface-glow);
30
- -webkit-backdrop-filter: var(--surface-blur);
31
- backdrop-filter: var(--surface-blur);
29
+ box-shadow: var(--surface-highlight), var(--surface-shadow);
32
30
  transition:
33
31
  background-color 150ms ease,
34
32
  border-color 150ms ease,
@@ -49,6 +47,8 @@
49
47
  }
50
48
  :global(.surface-background) {
51
49
  --surface-color: var(--color-background, white);
50
+ --surface-tint: var(--surface-foreground);
51
+ --surface-soft-strength: 5%;
52
52
  --surface-content: inherit;
53
53
  --surface-neutral-content: inherit;
54
54
  }
@@ -67,26 +67,14 @@
67
67
  :global(.surface-error) {
68
68
  --surface-color: var(--color-error, red);
69
69
  }
70
- :global(.surface-soft),
71
- :global(.surface-filled) {
72
- --surface-fill: color-mix(
73
- in srgb,
74
- var(--surface-color) var(--surface-strength),
75
- var(--surface-base)
76
- );
77
- --surface-highlight: inset 0 1px 0
78
- color-mix(in srgb, var(--surface-foreground) 16%, transparent);
79
- }
80
70
  :global(.surface-soft) {
81
- --surface-strength: 16%;
71
+ --surface-strength: var(--surface-soft-strength);
82
72
  --surface-fill: color-mix(
83
73
  in srgb,
84
- color-mix(in srgb, var(--surface-color) var(--surface-strength), var(--surface-base)) 85%,
85
- transparent
74
+ var(--surface-tint) var(--surface-strength),
75
+ var(--surface-base)
86
76
  );
87
- --surface-border: color-mix(in srgb, var(--surface-color) 30%, transparent);
88
77
  --surface-content: color-mix(in srgb, var(--surface-color) 80%, var(--surface-foreground));
89
- --surface-blur: blur(0.5rem) saturate(120%);
90
78
  }
91
79
  :global(.surface-filled) {
92
80
  --surface-strength: 100%;
@@ -95,45 +83,35 @@
95
83
  var(--surface-color) var(--surface-strength),
96
84
  var(--surface-foreground)
97
85
  );
98
- --surface-border: color-mix(in srgb, var(--surface-color) 68%, var(--surface-foreground));
99
86
  --surface-content: var(--surface-base);
100
- --surface-highlight: inset 0 1px 0
101
- color-mix(in srgb, var(--surface-foreground) 28%, transparent);
87
+ }
88
+ :global(.surface-background.surface-filled) {
89
+ --surface-fill: color-mix(
90
+ in srgb,
91
+ var(--surface-base) var(--surface-strength),
92
+ var(--surface-foreground)
93
+ );
102
94
  }
103
95
  :global(.surface-background:is(.surface-soft, .surface-filled)) {
104
96
  --surface-content: var(--surface-foreground);
105
97
  }
106
98
  :global(.surface-shadow-small) {
107
- --surface-shadow: 0 2px 6px color-mix(in srgb, var(--surface-foreground) 8%, transparent);
99
+ --surface-shadow: 0 2px 6px color-mix(in srgb, black 8%, transparent);
108
100
  }
109
101
  :global(.surface-shadow-medium) {
110
- --surface-shadow: 0 0.5rem 1.5rem color-mix(in srgb, var(--surface-foreground) 12%, transparent);
102
+ --surface-shadow: 0 0.5rem 1.5rem color-mix(in srgb, black 12%, transparent);
111
103
  }
112
104
  :global(.surface-shadow-large) {
113
- --surface-shadow: 0 1.5rem 4rem color-mix(in srgb, var(--surface-foreground) 20%, transparent);
105
+ --surface-shadow: 0 1.5rem 4rem color-mix(in srgb, black 20%, transparent);
114
106
  }
115
107
  :global(.surface-hover-small) {
116
108
  --surface-hover: 2%;
117
- --surface-glow-size: 0.5rem;
118
109
  }
119
110
  :global(.surface-hover-medium) {
120
111
  --surface-hover: 4%;
121
- --surface-glow-size: 1rem;
122
112
  }
123
113
  :global(.surface-hover-large) {
124
114
  --surface-hover: 8%;
125
- --surface-glow-size: 1.5rem;
126
- }
127
- :global(
128
- .surface:is(.surface-hover-small, .surface-hover-medium, .surface-hover-large):not(
129
- :disabled,
130
- [aria-disabled='true'],
131
- [data-surface-disabled='true']
132
- ):is(:hover, :focus-visible, [data-surface-pressed='true'])
133
- ) {
134
- --surface-glow: 0 0 var(--surface-glow-size)
135
- color-mix(in srgb, var(--surface-color) 10%, transparent);
136
- --surface-border: color-mix(in srgb, var(--surface-color) 40%, transparent);
137
115
  }
138
116
  :global(
139
117
  .surface-soft:is(.surface-hover-small, .surface-hover-medium, .surface-hover-large):not(
@@ -142,7 +120,7 @@
142
120
  [data-surface-disabled='true']
143
121
  ):is(:hover, :focus-visible, [data-surface-pressed='true'])
144
122
  ) {
145
- --surface-strength: calc(16% + var(--surface-hover));
123
+ --surface-strength: calc(var(--surface-soft-strength) + var(--surface-hover));
146
124
  }
147
125
  :global(
148
126
  .surface-filled:is(.surface-hover-small, .surface-hover-medium, .surface-hover-large):not(
@@ -160,7 +138,7 @@
160
138
  [data-surface-disabled='true']
161
139
  ):is(:hover, :focus-visible, [data-surface-pressed='true'])
162
140
  ) {
163
- --surface-fill: color-mix(in srgb, var(--surface-color) var(--surface-hover), transparent);
141
+ --surface-strength: calc(var(--surface-neutral-strength) + var(--surface-hover));
164
142
  --surface-content: var(--surface-neutral-content);
165
143
  }
166
144
  :global(
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import Colors from './colors.svelte';
3
3
  import Surfaces from './surfaces.svelte';
4
+ import Glass from './glass.svelte';
4
5
  import Fonts from './fonts.svelte';
5
6
  import Styles from './styles.svelte';
6
7
  import type { ThemeProps } from './types.js';
@@ -10,6 +11,7 @@
10
11
 
11
12
  <Colors {palette} />
12
13
  <Surfaces />
14
+ <Glass />
13
15
  <Fonts />
14
16
  <Styles />
15
17
 
@@ -10,9 +10,6 @@
10
10
  </button>
11
11
 
12
12
  <style>
13
- * {
14
- transition: all 150ms;
15
- }
16
13
  button {
17
14
  position: relative;
18
15
  z-index: 1;
@@ -21,30 +18,33 @@
21
18
  justify-content: center;
22
19
  min-width: var(--tree-action-size);
23
20
  min-height: var(--tree-action-size);
24
- padding: 0.25rem 0.5rem;
21
+ padding: 0;
25
22
  border: 0;
26
- border-radius: 999px;
23
+ border-radius: 50%;
27
24
  background: transparent;
28
- color: inherit;
25
+ color: var(--tree-action-color, inherit);
29
26
  font: inherit;
30
27
  cursor: pointer;
28
+ transition: background-color 150ms ease;
31
29
  }
32
30
  span {
33
31
  display: inline-flex;
34
- font-size: 1.25em;
32
+ font-size: 1.125em;
33
+ transition: transform 150ms ease;
35
34
  }
36
35
  button[aria-expanded='true'] span {
37
36
  transform: rotate(90deg);
38
37
  }
39
38
  button:not(:disabled):hover {
40
- background: color-mix(in srgb, var(--color-primary) 12%, transparent);
39
+ background: color-mix(in srgb, currentColor 8%, transparent);
41
40
  }
42
41
  button:focus-visible {
43
42
  outline: 2px solid var(--color-primary);
44
43
  outline-offset: -2px;
45
44
  }
46
45
  @media (prefers-reduced-motion: reduce) {
47
- * {
46
+ button,
47
+ span {
48
48
  transition: none;
49
49
  }
50
50
  }
@@ -6,25 +6,29 @@
6
6
  </script>
7
7
 
8
8
  <button {...attributes} type="button" disabled={item.disabled}>
9
- {#if item.icon}<Icon {...item.icon} label={undefined} />{/if}
9
+ {#if item.icon}
10
+ <Icon
11
+ {...item.icon}
12
+ color={attributes['aria-pressed'] === true && !item.disabled ? 'primary' : undefined}
13
+ label={undefined}
14
+ />
15
+ {/if}
10
16
  <span>{item.label}</span>
11
17
  </button>
12
18
 
13
19
  <style>
14
- * {
15
- transition: all 150ms;
16
- }
17
20
  button {
18
- display: inline-flex;
21
+ display: grid;
22
+ grid-template-columns: 1em minmax(0, 1fr);
19
23
  align-items: center;
20
24
  justify-content: start;
21
25
  flex: 1;
22
26
  gap: 0.5rem;
23
27
  min-width: 0;
24
28
  min-height: var(--tree-action-size);
25
- padding: 0.25rem 0.5rem;
29
+ padding: 0.125rem 0.375rem;
26
30
  border: 0;
27
- border-radius: 999px;
31
+ border-radius: 0.375rem;
28
32
  outline: none;
29
33
  background: transparent;
30
34
  color: inherit;
@@ -32,6 +36,10 @@
32
36
  text-align: start;
33
37
  cursor: pointer;
34
38
  }
39
+ span {
40
+ grid-column: 2;
41
+ min-width: 0;
42
+ }
35
43
  button::before {
36
44
  position: absolute;
37
45
  inset: 0;
@@ -46,11 +54,6 @@
46
54
  color: var(--color-muted);
47
55
  cursor: default;
48
56
  }
49
- @media (prefers-reduced-motion: reduce) {
50
- * {
51
- transition: none;
52
- }
53
- }
54
57
  @media (forced-colors: active) {
55
58
  button:disabled {
56
59
  color: GrayText;
@@ -16,17 +16,18 @@
16
16
  justify-content: center;
17
17
  min-width: var(--tree-action-size);
18
18
  min-height: var(--tree-action-size);
19
- padding: 0.25rem 0.5rem;
19
+ padding: 0;
20
20
  border: 0;
21
- border-radius: 999px;
21
+ border-radius: 50%;
22
22
  background: transparent;
23
- color: inherit;
23
+ color: var(--tree-action-color, inherit);
24
24
  font: inherit;
25
+ font-size: 1.125em;
25
26
  cursor: pointer;
26
- transition: all 150ms;
27
+ transition: background-color 150ms ease;
27
28
  }
28
29
  button:not(:disabled):hover {
29
- background: color-mix(in srgb, var(--color-primary) 12%, transparent);
30
+ background: color-mix(in srgb, currentColor 8%, transparent);
30
31
  }
31
32
  button:focus-visible {
32
33
  outline: 2px solid var(--color-primary);