barua-ui 0.2.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.
@@ -0,0 +1,370 @@
1
+ /* ==========================================================================
2
+ Barua UI — Control Center
3
+ iOS/macOS Control Center-style glass tile grid: toggle pills, round
4
+ lens buttons, media tile, chunky sliders. Best over colorful backdrops.
5
+
6
+ <div class="b-cc">
7
+ <div class="b-cc__tile b-cc__tile--2x2"> …pills… </div>
8
+ <div class="b-cc__tile b-cc__tile--round"> icon </div>
9
+
10
+ </div>
11
+ ========================================================================== */
12
+
13
+ @layer components {
14
+ .b-cc {
15
+ --b-cc-tile: light-dark(rgba(250, 250, 253, 0.50), rgba(44, 46, 54, 0.52));
16
+ --b-cc-fill: light-dark(rgba(120, 122, 140, 0.22), rgba(120, 122, 132, 0.38));
17
+ display: grid;
18
+ grid-template-columns: repeat(4, 1fr);
19
+ grid-auto-rows: 4.5rem;
20
+ gap: var(--b-space-2);
21
+ width: min(21rem, 100%);
22
+ padding: var(--b-space-3);
23
+ background: var(--b-material-ultrathin-bg);
24
+ -webkit-backdrop-filter: var(--b-glass-heavy);
25
+ backdrop-filter: var(--b-glass-heavy);
26
+ border: 1px solid var(--b-hairline);
27
+ border-radius: var(--b-radius-2xl);
28
+ box-shadow: var(--b-glass-edge), var(--b-shadow-md);
29
+ user-select: none;
30
+ }
31
+
32
+ /* ---- Tiles --------------------------------------------------------------- */
33
+ .b-cc__tile {
34
+ position: relative;
35
+ display: flex;
36
+ flex-direction: column;
37
+ justify-content: center;
38
+ gap: var(--b-space-2);
39
+ padding: var(--b-space-3);
40
+ background: var(--b-cc-tile);
41
+ -webkit-backdrop-filter: var(--b-glass);
42
+ backdrop-filter: var(--b-glass);
43
+ border: 1px solid light-dark(rgba(255, 255, 255, 0.30), rgba(255, 255, 255, 0.06));
44
+ border-radius: var(--b-radius-xl);
45
+ box-shadow: var(--b-glass-edge);
46
+ overflow: hidden;
47
+ }
48
+ .b-cc__tile--2x2 { grid-column: span 2; grid-row: span 2; }
49
+ .b-cc__tile--2x1 { grid-column: span 2; }
50
+ .b-cc__tile--4x1 {
51
+ grid-column: span 4;
52
+ gap: var(--b-space-1);
53
+ padding-block: var(--b-space-2);
54
+ }
55
+ .b-cc__tile--round {
56
+ grid-column: span 1;
57
+ padding: 0;
58
+ align-items: center;
59
+ border-radius: var(--b-radius-full);
60
+ aspect-ratio: 1;
61
+ place-self: center;
62
+ width: 100%;
63
+ display: grid;
64
+ place-items: center;
65
+ cursor: pointer;
66
+ }
67
+ .b-cc__tile--plain { background: none; border: none; box-shadow: none;
68
+ -webkit-backdrop-filter: none; backdrop-filter: none; }
69
+
70
+ /* ---- Pill row (Wi-Fi / Bluetooth / AirDrop) ------------------------------- */
71
+ .b-cc__pill {
72
+ display: flex;
73
+ align-items: center;
74
+ gap: var(--b-space-2);
75
+ min-height: 0;
76
+ cursor: pointer;
77
+ }
78
+ .b-cc__pill + .b-cc__pill { margin-block-start: var(--b-space-1); }
79
+
80
+ .b-cc__icon {
81
+ display: grid;
82
+ place-items: center;
83
+ width: 2.35rem;
84
+ height: 2.35rem;
85
+ flex: none;
86
+ color: var(--b-text);
87
+ background: var(--b-cc-fill);
88
+ border-radius: 50%;
89
+ border: none;
90
+ cursor: pointer;
91
+ transition: background var(--b-duration-fast) var(--b-ease-standard),
92
+ color var(--b-duration-fast) var(--b-ease-standard),
93
+ scale var(--b-duration-instant);
94
+ }
95
+ .b-cc__icon:active { scale: 0.94; }
96
+ .b-cc__icon svg { width: 1.15rem; height: 1.15rem; }
97
+ .b-cc__icon.is-on { background: var(--b-color-accent); color: #fff; }
98
+ .b-cc__icon.is-on--green { background: var(--b-color-green); color: #fff; }
99
+ .b-cc__icon.is-on--white {
100
+ background: light-dark(#1c1c21, #ffffff);
101
+ color: light-dark(#ffffff, #1c1c21);
102
+ }
103
+
104
+ .b-cc__meta { min-width: 0; }
105
+ .b-cc__label {
106
+ font-size: var(--b-text-footnote);
107
+ font-weight: var(--b-weight-semibold);
108
+ line-height: 1.25;
109
+ white-space: nowrap;
110
+ overflow: hidden;
111
+ text-overflow: ellipsis;
112
+ }
113
+ .b-cc__status {
114
+ font-size: var(--b-text-caption);
115
+ color: var(--b-text-secondary);
116
+ line-height: 1.25;
117
+ }
118
+
119
+ /* ---- Media tile ------------------------------------------------------------ */
120
+ .b-cc__art {
121
+ width: 2.6rem;
122
+ height: 2.6rem;
123
+ border-radius: var(--b-radius-md);
124
+ background: var(--b-cc-fill);
125
+ object-fit: cover;
126
+ flex: none;
127
+ }
128
+ .b-cc__transport {
129
+ display: flex;
130
+ align-items: center;
131
+ justify-content: center;
132
+ gap: var(--b-space-3);
133
+ }
134
+ .b-cc__transport button {
135
+ display: grid;
136
+ place-items: center;
137
+ width: 2rem;
138
+ height: 2rem;
139
+ color: var(--b-text);
140
+ background: none;
141
+ border: none;
142
+ border-radius: 50%;
143
+ cursor: pointer;
144
+ transition: background var(--b-duration-fast);
145
+ }
146
+ .b-cc__transport button:hover { background: var(--b-cc-fill); }
147
+ .b-cc__transport svg { width: 1.2rem; height: 1.2rem; }
148
+
149
+ /* ---- Chunky slider (Display / Sound) ---------------------------------------
150
+ <div class="b-cc__range" style="--v: 60%">
151
+ <i></i>
152
+ <span class="b-cc__range-icon b-cc__range-icon--start">…svg…</span>
153
+ <span class="b-cc__range-icon b-cc__range-icon--end">…svg…</span>
154
+ <input type="range" aria-label="Display brightness">
155
+ </div>
156
+ ------------------------------------------------------------------------------ */
157
+ .b-cc__range {
158
+ position: relative;
159
+ height: 2.1rem;
160
+ border-radius: var(--b-radius-full);
161
+ background: var(--b-cc-fill);
162
+ overflow: hidden;
163
+ box-shadow: inset 0 1px 2px light-dark(rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.25));
164
+ }
165
+ .b-cc__range > i {
166
+ position: absolute;
167
+ inset-block: 0;
168
+ inset-inline-start: 0;
169
+ width: var(--v, 50%);
170
+ background: light-dark(#ffffff, #f5f6fa);
171
+ border-radius: inherit;
172
+ box-shadow: 1px 0 3px rgba(0, 0, 0, 0.12);
173
+ transition: width var(--b-duration-fast) var(--b-ease-standard);
174
+ }
175
+ .b-cc__range-icon {
176
+ position: absolute;
177
+ top: 50%;
178
+ translate: 0 -50%;
179
+ display: inline-flex;
180
+ color: light-dark(rgba(20, 24, 38, 0.55), rgba(235, 235, 245, 0.6));
181
+ pointer-events: none;
182
+ z-index: 1;
183
+ }
184
+ .b-cc__range-icon svg { width: 0.95rem; height: 0.95rem; }
185
+ .b-cc__range-icon--start { inset-inline-start: var(--b-space-2);
186
+ color: light-dark(rgba(20, 24, 38, 0.6), rgba(20, 24, 38, 0.6)); }
187
+ .b-cc__range-icon--end { inset-inline-end: var(--b-space-2); }
188
+ .b-cc__range input[type="range"] {
189
+ position: absolute;
190
+ inset: 0;
191
+ width: 100%;
192
+ height: 100%;
193
+ margin: 0;
194
+ opacity: 0;
195
+ cursor: ew-resize;
196
+ }
197
+
198
+ /* ---- Liquid glass objects ----------------------------------------------------
199
+ Decorative/interactive glass primitives in the Apple Developer "liquid"
200
+ style — lens button, glass toggle, gradient slider capsule.
201
+
202
+ Glass tiers:
203
+ 1. CSS glass (everywhere) — blur + tint + specular edges
204
+ 2. Refraction (Blink) — SVG displacement map in backdrop-filter;
205
+ barua.js injects #b-refract and adds
206
+ `.b-refract` on <html> when supported
207
+ 3. WebGL — deliberately NOT shipped; tier 2 covers
208
+ the optics without a render pipeline
209
+ -------------------------------------------------------------------------------- */
210
+ .b-refract :is(.b-lens, .b-liquid-capsule, .b-liquid-toggle),
211
+ .b-refract .b-liquid-bar > b {
212
+ position: relative;
213
+ /* the ::before does the sampling; avoid double-filtering */
214
+ -webkit-backdrop-filter: none;
215
+ backdrop-filter: none;
216
+ }
217
+ .b-refract :is(.b-lens, .b-liquid-capsule, .b-liquid-toggle)::before,
218
+ .b-refract .b-liquid-bar > b::before {
219
+ content: "";
220
+ position: absolute;
221
+ inset: 0;
222
+ border-radius: inherit;
223
+ -webkit-backdrop-filter: url(#b-refract) blur(2px) saturate(1.4);
224
+ backdrop-filter: url(#b-refract) blur(2px) saturate(1.4);
225
+ pointer-events: none;
226
+ }
227
+ /* Clearer bodies in refraction mode — let the bent backdrop show */
228
+ .b-refract .b-lens {
229
+ background:
230
+ radial-gradient(120% 120% at 28% 18%,
231
+ light-dark(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.14)), transparent 44%),
232
+ radial-gradient(130% 130% at 70% 95%,
233
+ light-dark(rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.06)), transparent 50%),
234
+ light-dark(rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.04));
235
+ }
236
+ .b-refract .b-liquid-capsule {
237
+ background: light-dark(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.03));
238
+ }
239
+ .b-refract .b-liquid-bar > b {
240
+ background:
241
+ radial-gradient(120% 120% at 30% 20%,
242
+ light-dark(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.2)), transparent 48%),
243
+ light-dark(rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.05));
244
+ }
245
+ .b-lens {
246
+ position: relative;
247
+ display: grid;
248
+ place-items: center;
249
+ width: var(--b-lens-size, 4.5rem);
250
+ aspect-ratio: 1;
251
+ color: var(--b-text);
252
+ background:
253
+ radial-gradient(120% 120% at 28% 18%,
254
+ light-dark(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.16)), transparent 46%),
255
+ radial-gradient(130% 130% at 70% 95%,
256
+ light-dark(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.08)), transparent 50%),
257
+ light-dark(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
258
+ -webkit-backdrop-filter: blur(var(--b-blur-xs)) saturate(1.4);
259
+ backdrop-filter: blur(var(--b-blur-xs)) saturate(1.4);
260
+ border: none;
261
+ border-radius: 50%;
262
+ box-shadow:
263
+ inset 0 0 0 1.5px light-dark(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.18)),
264
+ inset 0 -8px 14px light-dark(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.05)),
265
+ inset 0 6px 10px light-dark(rgba(20, 24, 38, 0.05), rgba(0, 0, 0, 0.2)),
266
+ 0 10px 24px light-dark(rgba(20, 24, 38, 0.16), rgba(0, 0, 0, 0.45));
267
+ cursor: pointer;
268
+ transition: scale var(--b-duration-fast) var(--b-ease-bounce);
269
+ }
270
+ .b-lens:hover { scale: 1.05; }
271
+ .b-lens:active { scale: 0.96; }
272
+ .b-lens svg { width: 40%; height: 40%; }
273
+
274
+ .b-liquid-toggle {
275
+ position: relative;
276
+ width: 6.5rem;
277
+ height: 3.4rem;
278
+ padding: 0;
279
+ background: transparent;
280
+ border: none;
281
+ border-radius: var(--b-radius-full);
282
+ box-shadow:
283
+ inset 0 0 0 2px light-dark(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.2)),
284
+ inset 0 -10px 16px light-dark(rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.06)),
285
+ inset 0 8px 12px light-dark(rgba(20, 24, 38, 0.06), rgba(0, 0, 0, 0.22)),
286
+ 0 12px 28px light-dark(rgba(20, 24, 38, 0.18), rgba(0, 0, 0, 0.5));
287
+ -webkit-backdrop-filter: blur(var(--b-blur-xs)) saturate(1.4);
288
+ backdrop-filter: blur(var(--b-blur-xs)) saturate(1.4);
289
+ cursor: pointer;
290
+ }
291
+ .b-liquid-toggle::after {
292
+ content: "";
293
+ position: absolute;
294
+ inset: 0.45rem auto 0.45rem 0.45rem;
295
+ width: calc(50% - 0.45rem);
296
+ border-radius: var(--b-radius-full);
297
+ background:
298
+ radial-gradient(120% 150% at 30% 15%, rgba(255, 255, 255, 0.55), transparent 45%),
299
+ var(--b-liquid-color, var(--b-gray-2));
300
+ box-shadow:
301
+ 0 4px 12px color-mix(in srgb, var(--b-liquid-color, var(--b-gray-2)) 55%, transparent),
302
+ inset 0 -4px 8px rgba(0, 0, 0, 0.18);
303
+ transition: inset var(--b-duration-normal) var(--b-ease-spring),
304
+ background var(--b-duration-normal);
305
+ }
306
+ .b-liquid-toggle[aria-pressed="true"] {
307
+ --b-liquid-color: var(--b-color-green);
308
+ }
309
+ .b-liquid-toggle[aria-pressed="true"]::after {
310
+ inset: 0.45rem 0.45rem 0.45rem auto;
311
+ }
312
+
313
+ /* Hollow glass capsule — the empty pane from Apple's Design hero */
314
+ .b-liquid-capsule {
315
+ display: inline-block;
316
+ width: var(--b-capsule-w, 9rem);
317
+ height: var(--b-capsule-h, 4.5rem);
318
+ border-radius: var(--b-radius-full);
319
+ background: light-dark(rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.04));
320
+ -webkit-backdrop-filter: blur(var(--b-blur-xs)) saturate(1.35);
321
+ backdrop-filter: blur(var(--b-blur-xs)) saturate(1.35);
322
+ box-shadow:
323
+ inset 0 0 0 2px light-dark(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.16)),
324
+ inset 0 -12px 20px light-dark(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.05)),
325
+ inset 0 10px 16px light-dark(rgba(20, 24, 38, 0.05), rgba(0, 0, 0, 0.2)),
326
+ 0 14px 34px light-dark(rgba(20, 24, 38, 0.14), rgba(0, 0, 0, 0.4));
327
+ }
328
+
329
+ .b-liquid-bar {
330
+ position: relative;
331
+ width: var(--b-liquid-bar-w, 14rem);
332
+ height: 2.6rem;
333
+ border-radius: var(--b-radius-full);
334
+ background: var(--b-fill-secondary);
335
+ box-shadow: inset 0 2px 6px light-dark(rgba(20, 24, 38, 0.10), rgba(0, 0, 0, 0.3));
336
+ }
337
+ .b-liquid-bar > i {
338
+ position: absolute;
339
+ inset-block: 0;
340
+ inset-inline-start: 0;
341
+ width: var(--v, 60%);
342
+ border-radius: inherit;
343
+ background: linear-gradient(90deg,
344
+ var(--b-color-accent), var(--b-color-purple) 55%, var(--b-color-pink) 85%, var(--b-color-orange));
345
+ box-shadow: 0 4px 16px color-mix(in srgb, var(--b-color-purple) 40%, transparent);
346
+ }
347
+ .b-liquid-bar--accent > i {
348
+ background: var(--b-color-accent);
349
+ box-shadow: 0 4px 14px color-mix(in srgb, var(--b-color-accent) 45%, transparent);
350
+ }
351
+ .b-liquid-bar > b {
352
+ position: absolute;
353
+ top: 50%;
354
+ inset-inline-start: var(--v, 60%);
355
+ translate: -50% -50%;
356
+ width: 3.4rem;
357
+ aspect-ratio: 1;
358
+ border-radius: 50%;
359
+ background:
360
+ radial-gradient(120% 120% at 30% 20%,
361
+ light-dark(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.25)), transparent 48%),
362
+ light-dark(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08));
363
+ -webkit-backdrop-filter: blur(6px) saturate(1.6);
364
+ backdrop-filter: blur(6px) saturate(1.6);
365
+ box-shadow:
366
+ inset 0 0 0 1.5px light-dark(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.25)),
367
+ inset 0 -6px 10px rgba(255, 255, 255, 0.25),
368
+ 0 10px 22px light-dark(rgba(20, 24, 38, 0.22), rgba(0, 0, 0, 0.5));
369
+ }
370
+ }