@arraypress/waveform-sounds 0.0.0-stage → 0.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.
@@ -0,0 +1,378 @@
1
+ /*
2
+ * @arraypress/waveform-sounds — default styles.
3
+ *
4
+ * Colour-agnostic, like the rest of the family: every default is derived
5
+ * from `currentColor`, and the "on" states (the selected chip, the playing
6
+ * row's button) are INVERTED — text colour as the fill, the page surface
7
+ * as the ink. White on a dark page, black on a light one, no setup.
8
+ *
9
+ * `--ws-surface` is the page background behind the list. The runtime
10
+ * detects it (and re-reads it when the theme flips) unless you set it;
11
+ * set it yourself for server-rendered pages so the first paint is right.
12
+ * Opt into a brand colour with `--ws-accent` + `--ws-on-accent`.
13
+ *
14
+ * The row canvases read `--ws-wave-color` and `--ws-progress-color` (a
15
+ * canvas can't use CSS, so the runtime resolves them, and re-reads them
16
+ * when the page theme flips).
17
+ */
18
+ /* THE ONE RULE for the inverted states: an element whose background is
19
+ * `var(--ws-accent)` never sets its own `color` — its CHILDREN take the
20
+ * ink. `--ws-accent` defaults to `currentColor`, which resolves where it's
21
+ * used (even registered with @property: Chrome keeps the keyword), so a
22
+ * button with `color: ink; background: currentColor` paints ink on ink. */
23
+ .waveform-sounds {
24
+ --ws-accent: currentColor;
25
+ /* The ink on an inverted fill: the page surface (set by you, or
26
+ * measured by the runtime), else the INVERSE of the text colour — right
27
+ * with no script at all (light text → near-black ink, and vice versa). */
28
+ --ws-on-accent: var(--ws-surface, rgb(from currentColor calc(255 - r) calc(255 - g) calc(255 - b)));
29
+ --ws-muted: color-mix(in srgb, currentColor 62%, transparent);
30
+ --ws-border: color-mix(in srgb, currentColor 12%, transparent);
31
+ --ws-hover: color-mix(in srgb, currentColor 5%, transparent);
32
+ --ws-current: color-mix(in srgb, var(--ws-accent) 7%, transparent);
33
+ --ws-field: color-mix(in srgb, currentColor 5%, transparent);
34
+ --ws-wave-color: color-mix(in srgb, currentColor 30%, transparent);
35
+ --ws-progress-color: var(--ws-accent);
36
+ --ws-radius: 10px;
37
+ --ws-control-radius: 999px;
38
+ --ws-row-height: 3.25rem;
39
+ --ws-wave-height: 28px;
40
+ --ws-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
41
+
42
+ container-type: inline-size;
43
+ color: inherit;
44
+ font: inherit;
45
+ }
46
+ .waveform-sounds *, .waveform-sounds *::before, .waveform-sounds *::after { box-sizing: border-box; }
47
+ .waveform-sounds [hidden] { display: none !important; }
48
+
49
+ .ws-sr {
50
+ position: absolute !important;
51
+ width: 1px; height: 1px;
52
+ margin: -1px; padding: 0;
53
+ overflow: hidden;
54
+ clip: rect(0 0 0 0);
55
+ white-space: nowrap;
56
+ border: 0;
57
+ }
58
+ .ws-icon { width: 1em; height: 1em; fill: currentColor; flex: none; }
59
+
60
+ /* ── Toolbar ─────────────────────────────────────────────────────────── */
61
+ .ws-toolbar {
62
+ display: flex;
63
+ flex-wrap: wrap;
64
+ align-items: center;
65
+ gap: 0.75rem;
66
+ margin-bottom: 1rem;
67
+ }
68
+ .ws-search {
69
+ flex: 1 1 16rem;
70
+ display: flex;
71
+ align-items: center;
72
+ gap: 0.6rem;
73
+ min-width: 0;
74
+ height: 2.75rem;
75
+ padding: 0 1rem;
76
+ border: 1px solid var(--ws-border);
77
+ border-radius: var(--ws-control-radius);
78
+ background: var(--ws-field);
79
+ color: inherit;
80
+ cursor: text;
81
+ }
82
+ .ws-search:focus-within { border-color: var(--ws-accent); }
83
+ .ws-search-input {
84
+ flex: 1;
85
+ min-width: 0;
86
+ height: 100%;
87
+ border: 0;
88
+ background: none;
89
+ color: inherit;
90
+ font: inherit;
91
+ outline: none;
92
+ }
93
+ .ws-search .ws-icon { color: var(--ws-muted); }
94
+ .ws-search-input::placeholder { color: var(--ws-muted); }
95
+ .ws-search-input::-webkit-search-cancel-button,
96
+ .ws-menu-search::-webkit-search-cancel-button {
97
+ -webkit-appearance: none;
98
+ width: 0.9em;
99
+ height: 0.9em;
100
+ background: currentColor;
101
+ opacity: 0.55;
102
+ cursor: pointer;
103
+ -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.4 5 5 6.4 10.6 12 5 17.6 6.4 19l5.6-5.6 5.6 5.6 1.4-1.4-5.6-5.6L19 6.4 17.6 5 12 10.6z'/%3E%3C/svg%3E") center / contain no-repeat;
104
+ }
105
+
106
+ .ws-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
107
+ .ws-bpm-range input {
108
+ height: 2.75rem;
109
+ border: 1px solid var(--ws-border);
110
+ border-radius: var(--ws-control-radius);
111
+ background: var(--ws-field);
112
+ color: inherit;
113
+ font: inherit;
114
+ font-size: 0.9em;
115
+ }
116
+
117
+ /* ── Dropdowns (type / key / sort) ──────────────────────────────────── */
118
+ .ws-menu { position: relative; }
119
+ .ws-menu-btn {
120
+ display: inline-flex;
121
+ align-items: center;
122
+ gap: 0.45rem;
123
+ height: 2.75rem;
124
+ max-width: 16rem;
125
+ padding: 0 0.85rem 0 1rem;
126
+ border: 1px solid var(--ws-border);
127
+ border-radius: var(--ws-control-radius);
128
+ background: var(--ws-field);
129
+ color: inherit;
130
+ font: inherit;
131
+ font-size: 0.9em;
132
+ cursor: pointer;
133
+ }
134
+ .ws-menu-btn:hover { background: var(--ws-hover); }
135
+ .ws-menu-btn[aria-expanded='true'] { border-color: var(--ws-accent); }
136
+ .ws-menu-prefix { color: var(--ws-muted); }
137
+ .ws-menu-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
138
+ .ws-menu-chevron { font-size: 1.1em; color: var(--ws-muted); transition: transform 0.15s; }
139
+ .ws-menu-btn[aria-expanded='true'] .ws-menu-chevron { transform: rotate(180deg); }
140
+ .ws-menu-pop {
141
+ position: absolute;
142
+ top: calc(100% + 0.4rem);
143
+ left: 0;
144
+ z-index: 20;
145
+ width: max-content;
146
+ min-width: max(100%, 14rem);
147
+ max-width: min(22rem, 90vw);
148
+ padding: 0.35rem;
149
+ border: 1px solid var(--ws-border);
150
+ border-radius: var(--ws-radius);
151
+ background: var(--ws-popover-bg, var(--ws-surface, Canvas));
152
+ box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.45);
153
+ }
154
+ .ws-menu--end .ws-menu-pop { left: auto; right: 0; }
155
+ .ws-menu-search {
156
+ display: block;
157
+ width: 100%;
158
+ height: 2.4rem;
159
+ margin-bottom: 0.3rem;
160
+ padding: 0 0.75rem;
161
+ border: 1px solid var(--ws-border);
162
+ border-radius: calc(var(--ws-radius) * 0.7);
163
+ background: var(--ws-field);
164
+ color: inherit;
165
+ font: inherit;
166
+ font-size: 0.9em;
167
+ outline: none;
168
+ }
169
+ .ws-menu-search:focus { border-color: var(--ws-accent); }
170
+ .ws-menu-list { list-style: none; margin: 0; padding: 0; max-height: 18rem; overflow-y: auto; outline: none; }
171
+ .ws-menu-option {
172
+ display: flex;
173
+ align-items: center;
174
+ gap: 0.5rem;
175
+ padding: 0.5rem 0.6rem;
176
+ border-radius: calc(var(--ws-radius) * 0.6);
177
+ font-size: 0.9em;
178
+ cursor: pointer;
179
+ }
180
+ .ws-menu-option:hover, .ws-menu-option.is-active { background: var(--ws-hover); }
181
+ .ws-menu-option.is-active { outline: 1px solid var(--ws-border); }
182
+ .ws-menu-check { visibility: hidden; flex: none; }
183
+ .ws-menu-option[aria-selected='true'] { font-weight: 600; }
184
+ .ws-menu-option[aria-selected='true'] .ws-menu-check { visibility: visible; }
185
+ .ws-menu-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
186
+ .ws-menu-count { font-family: var(--ws-mono); font-size: 0.85em; color: var(--ws-muted); }
187
+ .ws-menu-none { margin: 0; padding: 0.6rem; color: var(--ws-muted); font-size: 0.9em; }
188
+ .ws-bpm-range { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--ws-muted); font-size: 0.9em; }
189
+ .ws-bpm-range input { width: 5rem; padding: 0 0.85rem; -moz-appearance: textfield; }
190
+ .ws-bpm-range input::-webkit-inner-spin-button { display: none; }
191
+ .ws-loop {
192
+ display: inline-flex;
193
+ align-items: center;
194
+ gap: 0.45rem;
195
+ height: 2.75rem;
196
+ padding: 0 1rem;
197
+ border: 1px solid var(--ws-border);
198
+ border-radius: var(--ws-control-radius);
199
+ background: none;
200
+ color: inherit;
201
+ font: inherit;
202
+ font-size: 0.9em;
203
+ cursor: pointer;
204
+ }
205
+ .ws-loop[aria-pressed='true'] { border-color: var(--ws-accent); background: var(--ws-accent); }
206
+ .ws-loop[aria-pressed='true'] > * { color: var(--ws-on-accent); }
207
+
208
+ .ws-meta { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
209
+ .ws-types { display: flex; flex-wrap: wrap; gap: 0.4rem; flex: 1 1 auto; min-width: 0; }
210
+ .ws-chip {
211
+ display: inline-flex;
212
+ align-items: center;
213
+ gap: 0.4rem;
214
+ height: 2.25rem;
215
+ padding: 0 0.9rem;
216
+ border: 1px solid var(--ws-border);
217
+ border-radius: var(--ws-control-radius);
218
+ background: none;
219
+ color: inherit;
220
+ font: inherit;
221
+ font-size: 0.88em;
222
+ cursor: pointer;
223
+ transition: border-color 0.15s, background 0.15s;
224
+ }
225
+ .ws-chip:hover { background: var(--ws-hover); }
226
+ .ws-chip[aria-pressed='true'] { border-color: var(--ws-accent); background: var(--ws-accent); }
227
+ .ws-chip[aria-pressed='true'] > * { color: var(--ws-on-accent); }
228
+ .ws-chip-count { font-family: var(--ws-mono); font-size: 0.85em; opacity: 0.7; }
229
+ /* Full ink on the accent: a dimmed count on a saturated fill fails contrast
230
+ * (70% measured 4.04:1 on #ff4f24). */
231
+ .ws-chip[aria-pressed='true'] .ws-chip-count { opacity: 1; }
232
+ .ws-count { margin: 0 0 0 auto; color: var(--ws-muted); font-size: 0.88em; font-variant-numeric: tabular-nums; }
233
+
234
+ /* ── Rows ────────────────────────────────────────────────────────────── */
235
+ .ws-list {
236
+ list-style: none;
237
+ margin: 0;
238
+ padding: 0;
239
+ border-top: 1px solid var(--ws-border);
240
+ }
241
+ .ws-row {
242
+ display: flex;
243
+ align-items: center;
244
+ gap: 1rem;
245
+ min-height: var(--ws-row-height);
246
+ padding: 0.4rem 0.75rem 0.4rem 0.4rem;
247
+ border-bottom: 1px solid var(--ws-border);
248
+ cursor: pointer;
249
+ transition: background 0.12s;
250
+ }
251
+ .ws-row:hover { background: var(--ws-hover); }
252
+ .ws-row.is-current { background: var(--ws-current); }
253
+ .ws-row.is-error .ws-title { text-decoration: line-through; opacity: 0.6; }
254
+
255
+ .ws-play {
256
+ flex: none;
257
+ display: grid;
258
+ place-items: center;
259
+ width: 2.25rem;
260
+ height: 2.25rem;
261
+ border: 0;
262
+ border-radius: 999px;
263
+ background: var(--ws-field);
264
+ color: inherit;
265
+ font-size: 0.95rem;
266
+ cursor: pointer;
267
+ transition: background 0.15s, color 0.15s;
268
+ }
269
+ .ws-row:hover .ws-play { background: color-mix(in srgb, currentColor 12%, transparent); }
270
+ .ws-row.is-current .ws-play { background: var(--ws-accent); }
271
+ .ws-row.is-current .ws-play > * { color: var(--ws-on-accent); }
272
+ .ws-play .ws-icon-pause { display: none; }
273
+ .ws-row.is-playing .ws-play .ws-icon-play { display: none; }
274
+ .ws-row.is-playing .ws-play .ws-icon-pause { display: block; }
275
+ .ws-play:focus-visible,
276
+ .ws-chip:focus-visible,
277
+ .ws-menu-btn:focus-visible,
278
+ .ws-loop:focus-visible,
279
+ .ws-more:focus-visible,
280
+ .ws-clear:focus-visible,
281
+ .ws-wave:focus-visible,
282
+ .ws-download:focus-visible { outline: 2px solid var(--ws-accent); outline-offset: 2px; }
283
+
284
+ .ws-cell { min-width: 0; font-size: 0.9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
285
+ .ws-title { flex: 1.4 1 9rem; font-weight: 500; }
286
+ .ws-type { flex: 1 1 6rem; color: var(--ws-muted); }
287
+ .ws-bpm, .ws-key, .ws-duration { flex: none; font-family: var(--ws-mono); font-size: 0.82em; color: var(--ws-muted); font-variant-numeric: tabular-nums; }
288
+ .ws-bpm { width: 3.25ch; text-align: right; }
289
+ .ws-key { width: 3.5ch; }
290
+ .ws-duration { width: 4.5ch; text-align: right; }
291
+ .ws-wave {
292
+ flex: 2 1 8rem;
293
+ position: relative;
294
+ height: var(--ws-wave-height);
295
+ min-width: 6rem;
296
+ cursor: pointer;
297
+ /* Let a finger that lands on a waveform still scroll the page: touch
298
+ * seeks on a TAP (the runtime handles it on click), not on press. */
299
+ touch-action: pan-y;
300
+ border-radius: 4px;
301
+ }
302
+ .ws-canvas { display: block; width: 100%; height: 100%; }
303
+ .ws-download {
304
+ flex: none;
305
+ display: grid;
306
+ place-items: center;
307
+ width: 2.25rem;
308
+ height: 2.25rem;
309
+ border-radius: 999px;
310
+ color: var(--ws-muted);
311
+ font-size: 1.05rem;
312
+ text-decoration: none;
313
+ transition: color 0.15s, background 0.15s;
314
+ }
315
+ .ws-download:hover { color: inherit; background: var(--ws-hover); }
316
+
317
+ /* The meta cells are columns of the row on wide lists... */
318
+ .ws-cells { display: contents; }
319
+
320
+ /* ...and on narrow ones (a phone, a sidebar) the row is three lines beside
321
+ * the play button: the full title, then "Bass · 128 · Fm · 0:08", then the
322
+ * waveform. A title is never squeezed by the columns. */
323
+ @container (max-width: 560px) {
324
+ .ws-row {
325
+ display: grid;
326
+ grid-template-columns: auto minmax(0, 1fr) auto;
327
+ grid-template-areas: "play title dl" "play cells cells" "play wave wave";
328
+ column-gap: 0.85rem;
329
+ row-gap: 0.2rem;
330
+ padding: 0.7rem 0.5rem;
331
+ }
332
+ .ws-play { grid-area: play; align-self: center; }
333
+ .ws-title { grid-area: title; white-space: normal; overflow-wrap: anywhere; }
334
+ .ws-cells { grid-area: cells; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; min-width: 0; }
335
+ .ws-cells > .ws-cell { flex: none; width: auto; text-align: left; font-size: 0.78em; }
336
+ .ws-cells > .ws-cell:empty { display: none; }
337
+ .ws-cells > .ws-cell + .ws-cell:not(:empty)::before { content: '·'; margin-right: 0.5rem; opacity: 0.6; }
338
+ .ws-wave { grid-area: wave; margin-top: 0.35rem; min-width: 0; }
339
+ .ws-download { grid-area: dl; align-self: start; }
340
+ }
341
+
342
+ /* ── Footer bits ─────────────────────────────────────────────────────── */
343
+ .ws-empty { margin: 1.5rem 0; color: var(--ws-muted); }
344
+ .ws-clear, .ws-more {
345
+ border: 1px solid var(--ws-border);
346
+ border-radius: var(--ws-control-radius);
347
+ background: none;
348
+ color: inherit;
349
+ font: inherit;
350
+ cursor: pointer;
351
+ }
352
+ .ws-clear { margin-left: 0.5rem; padding: 0.35rem 0.85rem; font-size: 0.88em; }
353
+ .ws-more { display: block; margin: 1.25rem auto 0; padding: 0.7rem 1.4rem; font-size: 0.92em; }
354
+ .ws-more:hover, .ws-clear:hover { background: var(--ws-hover); }
355
+
356
+ /* The strip layout: the engine is a full player docked under the list. */
357
+ .ws-engine--strip {
358
+ position: sticky;
359
+ bottom: 0;
360
+ margin-top: 1rem;
361
+ padding: 0.75rem;
362
+ border: 1px solid var(--ws-border);
363
+ border-radius: var(--ws-radius);
364
+ background: var(--ws-strip-bg, Canvas);
365
+ z-index: 1;
366
+ }
367
+
368
+ /* Touch: 44px targets, and 16px inputs (iOS zooms into anything smaller). */
369
+ @media (pointer: coarse) {
370
+ .ws-play, .ws-download { width: 2.75rem; height: 2.75rem; }
371
+ .ws-chip { height: 2.5rem; }
372
+ .ws-search-input, .ws-menu-search, .ws-bpm-range input { font-size: 16px; }
373
+ .ws-menu-option { padding: 0.75rem 0.6rem; }
374
+ }
375
+
376
+ @media (prefers-reduced-motion: reduce) {
377
+ .ws-row, .ws-chip, .ws-play { transition: none; }
378
+ }