@arraypress/waveform-sounds 2.0.0 → 2.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.
- package/README.md +44 -2
- package/dist/waveform-sounds-no-autoinit.esm.js +914 -208
- package/dist/waveform-sounds-render.esm.js +274 -82
- package/dist/waveform-sounds.css +92 -17
- package/dist/waveform-sounds.esm.js +917 -210
- package/dist/waveform-sounds.js +913 -210
- package/dist/waveform-sounds.min.css +1 -1
- package/dist/waveform-sounds.min.js +3 -3
- package/package.json +1 -1
- package/src/css/waveform-sounds.css +92 -17
- package/src/js/core/WaveformSounds.ts +540 -120
- package/src/js/core/element.ts +208 -0
- package/src/js/core/engine.ts +9 -3
- package/src/js/core/options.ts +1 -5
- package/src/js/data/bpm.ts +14 -4
- package/src/js/data/keys.ts +156 -0
- package/src/js/data/navigation.ts +51 -11
- package/src/js/data/sounds.ts +73 -36
- package/src/js/data/url-state.ts +39 -12
- package/src/js/dom/colors.ts +28 -1
- package/src/js/dom/draw.ts +16 -3
- package/src/js/dom/menus.ts +2 -3
- package/src/js/dom/rows.ts +38 -15
- package/src/js/entry.ts +13 -3
- package/src/js/index.ts +7 -3
- package/src/js/render/html.ts +0 -2
- package/src/js/render/icons.ts +59 -17
- package/src/js/render/markup.ts +156 -62
- package/src/js/render/options.ts +29 -5
- package/src/js/render/strings.ts +57 -4
- package/src/js/render-entry.ts +1 -1
- package/src/js/shared/utils.ts +4 -4
- package/src/js/types.ts +54 -3
- package/types/core/WaveformSounds.d.ts +41 -11
- package/types/core/WaveformSounds.d.ts.map +1 -1
- package/types/core/element.d.ts +84 -0
- package/types/core/element.d.ts.map +1 -0
- package/types/core/engine.d.ts +8 -3
- package/types/core/engine.d.ts.map +1 -1
- package/types/core/options.d.ts +0 -5
- package/types/core/options.d.ts.map +1 -1
- package/types/data/bpm.d.ts +17 -4
- package/types/data/bpm.d.ts.map +1 -1
- package/types/data/keys.d.ts +88 -0
- package/types/data/keys.d.ts.map +1 -0
- package/types/data/navigation.d.ts +38 -11
- package/types/data/navigation.d.ts.map +1 -1
- package/types/data/sounds.d.ts +33 -17
- package/types/data/sounds.d.ts.map +1 -1
- package/types/data/url-state.d.ts +38 -7
- package/types/data/url-state.d.ts.map +1 -1
- package/types/dom/colors.d.ts +13 -0
- package/types/dom/colors.d.ts.map +1 -1
- package/types/dom/draw.d.ts +5 -3
- package/types/dom/draw.d.ts.map +1 -1
- package/types/dom/menus.d.ts +0 -2
- package/types/dom/menus.d.ts.map +1 -1
- package/types/dom/rows.d.ts +19 -11
- package/types/dom/rows.d.ts.map +1 -1
- package/types/entry.d.ts +10 -4
- package/types/entry.d.ts.map +1 -1
- package/types/index.d.ts +2 -2
- package/types/index.d.ts.map +1 -1
- package/types/render/html.d.ts +0 -2
- package/types/render/html.d.ts.map +1 -1
- package/types/render/icons.d.ts +41 -3
- package/types/render/icons.d.ts.map +1 -1
- package/types/render/markup.d.ts +44 -12
- package/types/render/markup.d.ts.map +1 -1
- package/types/render/options.d.ts +18 -5
- package/types/render/options.d.ts.map +1 -1
- package/types/render/strings.d.ts +22 -4
- package/types/render/strings.d.ts.map +1 -1
- package/types/render-entry.d.ts +1 -1
- package/types/render-entry.d.ts.map +1 -1
- package/types/shared/utils.d.ts +3 -3
- package/types/shared/utils.d.ts.map +1 -1
- package/types/types.d.ts +53 -3
- package/types/types.d.ts.map +1 -1
package/dist/waveform-sounds.css
CHANGED
|
@@ -15,12 +15,21 @@
|
|
|
15
15
|
* canvas can't use CSS, so the runtime resolves them, and re-reads them
|
|
16
16
|
* when the page theme flips).
|
|
17
17
|
*/
|
|
18
|
+
/* <waveform-sounds>: a block, like the <div data-waveform-sounds> form (a
|
|
19
|
+
* custom element is inline by default), and styled as one from the first
|
|
20
|
+
* paint: the container rules below name the tag as well as the class, so
|
|
21
|
+
* server-rendered markup inside it doesn't shift when it upgrades. Before
|
|
22
|
+
* the script defines it, an EMPTY element (a manifest still to load) holds
|
|
23
|
+
* --ws-element-height, if you set one. */
|
|
24
|
+
waveform-sounds { display: block; }
|
|
25
|
+
waveform-sounds:not(:defined):empty { min-height: var(--ws-element-height, 0); }
|
|
26
|
+
|
|
18
27
|
/* THE ONE RULE for the inverted states: an element whose background is
|
|
19
28
|
* `var(--ws-accent)` never sets its own `color` — its CHILDREN take the
|
|
20
29
|
* ink. `--ws-accent` defaults to `currentColor`, which resolves where it's
|
|
21
30
|
* used (even registered with @property: Chrome keeps the keyword), so a
|
|
22
31
|
* button with `color: ink; background: currentColor` paints ink on ink. */
|
|
23
|
-
.waveform-sounds {
|
|
32
|
+
:is(.waveform-sounds, waveform-sounds) {
|
|
24
33
|
--ws-accent: currentColor;
|
|
25
34
|
/* The ink on an inverted fill: the page surface (set by you, or
|
|
26
35
|
* measured by the runtime), else the INVERSE of the text colour — right
|
|
@@ -43,16 +52,27 @@
|
|
|
43
52
|
color: inherit;
|
|
44
53
|
font: inherit;
|
|
45
54
|
}
|
|
46
|
-
/* The inverse above is relative colour: Chrome
|
|
47
|
-
* all newer than the 2.0 floor.
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
/* The inverse above is relative colour FROM currentColor: Chrome 131,
|
|
56
|
+
* Firefox 133, Safari 18, all newer than the 2.0 floor. Chrome 119–130
|
|
57
|
+
* parse relative colour, but not from currentColor, so the guard names it;
|
|
58
|
+
* Firefox 128–132 parse it but resolve currentColor as black (white ink on
|
|
59
|
+
* a light fill), so they are named too: Firefox (-moz-appearance) without
|
|
60
|
+
* a feature of its 133 (letter-spacing in %). Where it's unusable the ink
|
|
61
|
+
* is the surface the runtime measures. Until it has
|
|
62
|
+
* (a server-rendered first paint, or no script — the runtime sets
|
|
63
|
+
* data-ws-initialized as it measures), there is no ink that is right on
|
|
64
|
+
* every page (the system Canvas is white on a dark page that doesn't declare
|
|
65
|
+
* color-scheme), so a pressed control is a TINT with text-colour ink
|
|
66
|
+
* instead of an inversion: readable on any page. */
|
|
67
|
+
@supports (not (color: rgb(from currentColor r g b))) or ((-moz-appearance: none) and (not (letter-spacing: 1%))) {
|
|
68
|
+
:is(.waveform-sounds, waveform-sounds) { --ws-on-accent: var(--ws-surface, Canvas); }
|
|
69
|
+
:is(.waveform-sounds, waveform-sounds):where(:not([data-ws-initialized])) {
|
|
70
|
+
--ws-accent-fill: color-mix(in srgb, currentColor 22%, transparent);
|
|
71
|
+
--ws-on-accent: currentColor;
|
|
72
|
+
}
|
|
53
73
|
}
|
|
54
|
-
.waveform-sounds *, .waveform-sounds *::before, .waveform-sounds *::after { box-sizing: border-box; }
|
|
55
|
-
.waveform-sounds [hidden] { display: none !important; }
|
|
74
|
+
:is(.waveform-sounds, waveform-sounds) *, :is(.waveform-sounds, waveform-sounds) *::before, :is(.waveform-sounds, waveform-sounds) *::after { box-sizing: border-box; }
|
|
75
|
+
:is(.waveform-sounds, waveform-sounds) [hidden] { display: none !important; }
|
|
56
76
|
|
|
57
77
|
.ws-sr {
|
|
58
78
|
position: absolute !important;
|
|
@@ -64,6 +84,10 @@
|
|
|
64
84
|
border: 0;
|
|
65
85
|
}
|
|
66
86
|
.ws-icon { width: 1em; height: 1em; fill: currentColor; flex: none; }
|
|
87
|
+
/* The icons' one definition per list (each icon is a <use> of it): out of
|
|
88
|
+
* the flow, so its empty line box adds no height. Not display: none, which
|
|
89
|
+
* some engines treat as removing what it defines. */
|
|
90
|
+
.ws-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
|
|
67
91
|
|
|
68
92
|
/* ── Controls: shared ────────────────────────────────────────────────── */
|
|
69
93
|
/* The pill-shaped controls share one frame... */
|
|
@@ -99,7 +123,8 @@
|
|
|
99
123
|
color: inherit;
|
|
100
124
|
cursor: text;
|
|
101
125
|
}
|
|
102
|
-
|
|
126
|
+
/* The focus ring is the field's frame, not the bare input inside it. */
|
|
127
|
+
.ws-search:focus-within { border-color: var(--ws-accent); outline: 2px solid var(--ws-accent); outline-offset: 2px; }
|
|
103
128
|
.ws-search-input {
|
|
104
129
|
flex: 1;
|
|
105
130
|
min-width: 0;
|
|
@@ -108,8 +133,8 @@
|
|
|
108
133
|
background: none;
|
|
109
134
|
color: inherit;
|
|
110
135
|
font: inherit;
|
|
111
|
-
outline: none;
|
|
112
136
|
}
|
|
137
|
+
.ws-search-input:focus { outline: none; } /* the frame above carries the ring */
|
|
113
138
|
.ws-search .ws-icon, .ws-search-input::placeholder { color: var(--ws-muted); }
|
|
114
139
|
/* WebKit/Blink's clear button, redrawn in the text colour. The mask stays
|
|
115
140
|
* prefixed: unprefixed `mask` is Chrome/Edge 120+. */
|
|
@@ -172,9 +197,9 @@
|
|
|
172
197
|
color: inherit;
|
|
173
198
|
font: inherit;
|
|
174
199
|
font-size: 0.9em;
|
|
175
|
-
outline: none;
|
|
176
200
|
}
|
|
177
201
|
.ws-menu-search:focus { border-color: var(--ws-accent); }
|
|
202
|
+
.ws-menu-search:focus-visible { outline: 2px solid var(--ws-accent); outline-offset: 1px; }
|
|
178
203
|
.ws-menu-list { list-style: none; margin: 0; padding: 0; max-height: 18rem; overflow-y: auto; outline: none; }
|
|
179
204
|
.ws-menu-option {
|
|
180
205
|
display: flex;
|
|
@@ -198,7 +223,21 @@
|
|
|
198
223
|
.ws-bpm-pop { width: 17rem; padding: 0.85rem 1rem 0.7rem; }
|
|
199
224
|
.ws-bpm-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.6rem; }
|
|
200
225
|
.ws-bpm-readout { font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
201
|
-
.ws-bpm-clear {
|
|
226
|
+
.ws-bpm-clear {
|
|
227
|
+
/* A 24px target (WCAG 2.5.8) without growing the head. */
|
|
228
|
+
display: inline-flex;
|
|
229
|
+
align-items: center;
|
|
230
|
+
justify-content: center;
|
|
231
|
+
min-width: 24px;
|
|
232
|
+
min-height: 24px;
|
|
233
|
+
margin: -2px -0.3rem -2px 0;
|
|
234
|
+
padding: 0 0.3rem;
|
|
235
|
+
border: 0;
|
|
236
|
+
border-radius: 4px;
|
|
237
|
+
color: var(--ws-muted);
|
|
238
|
+
font-size: 0.85em;
|
|
239
|
+
}
|
|
240
|
+
.ws-bpm-clear:focus-visible { outline: 2px solid var(--ws-accent); outline-offset: 0; }
|
|
202
241
|
.ws-bpm-clear:hover { color: inherit; text-decoration: underline; }
|
|
203
242
|
|
|
204
243
|
/* Two native range inputs stacked on one track. The track and the filled
|
|
@@ -331,9 +370,11 @@
|
|
|
331
370
|
/* ── The pressed controls: the accent fill, inverted ink ─────────────── */
|
|
332
371
|
/* After the hovers, so a pressed control keeps its fill under the pointer.
|
|
333
372
|
* The CHILDREN take the ink, never the button (THE ONE RULE, at the top). */
|
|
373
|
+
/* `--ws-accent-fill` is unset, except for a tint before the runtime has
|
|
374
|
+
* measured the surface in engines without relative colour (top of file). */
|
|
334
375
|
.ws-loop[aria-pressed='true'],
|
|
335
|
-
.ws-chip[aria-pressed='true'] { border-color: var(--ws-accent); background: var(--ws-accent); }
|
|
336
|
-
.ws-seg-btn[aria-pressed='true'] { background: var(--ws-accent); }
|
|
376
|
+
.ws-chip[aria-pressed='true'] { border-color: var(--ws-accent); background: var(--ws-accent-fill, var(--ws-accent)); }
|
|
377
|
+
.ws-seg-btn[aria-pressed='true'] { background: var(--ws-accent-fill, var(--ws-accent)); }
|
|
337
378
|
.ws-loop[aria-pressed='true'] > *,
|
|
338
379
|
.ws-seg-btn[aria-pressed='true'] > *,
|
|
339
380
|
.ws-chip[aria-pressed='true'] > * { color: var(--ws-on-accent); }
|
|
@@ -380,7 +421,7 @@
|
|
|
380
421
|
transition: background 0.15s, color 0.15s;
|
|
381
422
|
}
|
|
382
423
|
.ws-row:hover .ws-play { background: color-mix(in srgb, currentColor 12%, transparent); }
|
|
383
|
-
.ws-row.is-current .ws-play { background: var(--ws-accent); }
|
|
424
|
+
.ws-row.is-current .ws-play { background: var(--ws-accent-fill, var(--ws-accent)); }
|
|
384
425
|
.ws-row.is-current .ws-play > * { color: var(--ws-on-accent); }
|
|
385
426
|
.ws-play .ws-icon-pause { display: none; }
|
|
386
427
|
.ws-row.is-playing .ws-play .ws-icon-play { display: none; }
|
|
@@ -452,6 +493,13 @@
|
|
|
452
493
|
.ws-cells > .ws-cell:not(:empty) ~ .ws-cell:not(:empty)::before { content: '·'; margin-right: 0.5rem; opacity: 0.6; }
|
|
453
494
|
.ws-wave { grid-area: wave; margin-top: 0.35rem; min-width: 0; }
|
|
454
495
|
.ws-download { grid-area: dl; align-self: start; }
|
|
496
|
+
/* The menus open from the controls row, never wider than it: anchored
|
|
497
|
+
to their own button, a wide panel (the BPM range) near the end of a
|
|
498
|
+
phone-width row hung off the screen's edge. */
|
|
499
|
+
.ws-controls { position: relative; }
|
|
500
|
+
.ws-menu { position: static; }
|
|
501
|
+
.ws-menu-pop { min-width: min(14rem, 100%); max-width: 100%; }
|
|
502
|
+
.ws-bpm-pop { width: min(17rem, 100%); }
|
|
455
503
|
}
|
|
456
504
|
|
|
457
505
|
/* ── Footer bits ─────────────────────────────────────────────────────── */
|
|
@@ -486,6 +534,33 @@
|
|
|
486
534
|
.ws-menu-option { padding: 0.75rem 0.6rem; }
|
|
487
535
|
}
|
|
488
536
|
|
|
537
|
+
/* Forced colours (Windows High Contrast): the pressed states and the
|
|
538
|
+
* playing row's button are the system Highlight, with their icons in
|
|
539
|
+
* HighlightText (left to the system, the inverted ink vanished into the
|
|
540
|
+
* forced background); the BPM track and thumb are drawn in system colours,
|
|
541
|
+
* and focus is an outline, never only a box-shadow (which is dropped). The
|
|
542
|
+
* canvases follow too: the runtime draws them in CanvasText / Highlight. */
|
|
543
|
+
@media (forced-colors: active) {
|
|
544
|
+
.ws-loop[aria-pressed='true'],
|
|
545
|
+
.ws-chip[aria-pressed='true'],
|
|
546
|
+
.ws-seg-btn[aria-pressed='true'],
|
|
547
|
+
.ws-row.is-current .ws-play {
|
|
548
|
+
forced-color-adjust: none;
|
|
549
|
+
border-color: Highlight;
|
|
550
|
+
background: Highlight;
|
|
551
|
+
color: HighlightText;
|
|
552
|
+
}
|
|
553
|
+
.ws-loop[aria-pressed='true'] > *,
|
|
554
|
+
.ws-seg-btn[aria-pressed='true'] > *,
|
|
555
|
+
.ws-chip[aria-pressed='true'] > *,
|
|
556
|
+
.ws-row.is-current .ws-play > * { color: HighlightText; }
|
|
557
|
+
.ws-range::before, .ws-range::after { forced-color-adjust: none; }
|
|
558
|
+
.ws-range::before { background: GrayText; }
|
|
559
|
+
.ws-range::after { background: Highlight; }
|
|
560
|
+
.ws-range-input:focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
|
|
561
|
+
.ws-menu-option.is-active { outline: 2px solid Highlight; }
|
|
562
|
+
}
|
|
563
|
+
|
|
489
564
|
@media (prefers-reduced-motion: reduce) {
|
|
490
565
|
.ws-row, .ws-chip, .ws-play, .ws-seg-btn, .ws-download, .ws-menu-chevron { transition: none; }
|
|
491
566
|
}
|