@arraypress/waveform-sounds 0.1.2 → 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.
- package/README.md +16 -1
- package/dist/waveform-sounds-no-autoinit.cjs +74 -13
- package/dist/waveform-sounds-no-autoinit.esm.js +74 -13
- package/dist/waveform-sounds-render.cjs +40 -5
- package/dist/waveform-sounds-render.esm.js +40 -5
- package/dist/waveform-sounds.cjs +74 -13
- package/dist/waveform-sounds.css +40 -3
- package/dist/waveform-sounds.esm.js +74 -13
- package/dist/waveform-sounds.js +74 -13
- package/dist/waveform-sounds.min.css +1 -1
- package/dist/waveform-sounds.min.js +1 -1
- package/index.d.ts +20 -4
- package/package.json +1 -1
- package/src/css/waveform-sounds.css +40 -3
- package/src/js/core/WaveformSounds.js +22 -5
- package/src/js/data/sounds.js +39 -8
- package/src/js/data/url-state.js +11 -7
- package/src/js/dom/rows.js +1 -1
- package/src/js/render/markup.js +23 -5
- package/src/js/render/options.js +1 -1
- package/src/js/render/strings.js +4 -0
|
@@ -97,6 +97,7 @@ function formatDuration(seconds) {
|
|
|
97
97
|
if (seconds == null || seconds === "") return "";
|
|
98
98
|
const s = Number(seconds);
|
|
99
99
|
if (!Number.isFinite(s) || s < 0) return "";
|
|
100
|
+
if (s > 0 && s < 0.95) return `${Math.max(0.1, Math.round(s * 10) / 10).toFixed(1)}s`;
|
|
100
101
|
const total = Math.round(s);
|
|
101
102
|
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, "0")}`;
|
|
102
103
|
}
|
|
@@ -133,9 +134,14 @@ function normalizeSound(input, index, peakScale = 1) {
|
|
|
133
134
|
tags,
|
|
134
135
|
peaks: decodePeaks(input.peaks, peakScale),
|
|
135
136
|
waveform: input.waveform ? String(input.waveform) : null,
|
|
136
|
-
download: input.download ? String(input.download) : null
|
|
137
|
+
download: input.download ? String(input.download) : null,
|
|
138
|
+
loop: isLoop(input.loop)
|
|
137
139
|
};
|
|
138
140
|
}
|
|
141
|
+
var LOOP_FILTERS = ["loop", "one-shot"];
|
|
142
|
+
function isLoop(value) {
|
|
143
|
+
return value === true || value === 1 || value === "true" || value === "1";
|
|
144
|
+
}
|
|
139
145
|
function parseManifest(manifest) {
|
|
140
146
|
const list = Array.isArray(manifest) ? manifest : Array.isArray(manifest?.sounds) ? manifest.sounds : [];
|
|
141
147
|
const scale = Array.isArray(manifest) ? 1 : Number(manifest?.peakScale) || 1;
|
|
@@ -158,7 +164,7 @@ function normalizeSounds(list, peakScale = 1) {
|
|
|
158
164
|
function facets(sounds) {
|
|
159
165
|
const types = /* @__PURE__ */ new Map();
|
|
160
166
|
const keys = /* @__PURE__ */ new Set();
|
|
161
|
-
let min = Infinity, max = -Infinity, hasDuration = false;
|
|
167
|
+
let min = Infinity, max = -Infinity, hasDuration = false, loops = 0;
|
|
162
168
|
for (const s of sounds) {
|
|
163
169
|
if (s.type) types.set(s.type, (types.get(s.type) || 0) + 1);
|
|
164
170
|
if (s.key) keys.add(s.key);
|
|
@@ -167,17 +173,22 @@ function facets(sounds) {
|
|
|
167
173
|
max = Math.max(max, s.bpm);
|
|
168
174
|
}
|
|
169
175
|
if (s.duration != null) hasDuration = true;
|
|
176
|
+
if (s.loop) loops++;
|
|
170
177
|
}
|
|
171
178
|
return {
|
|
172
179
|
types: [...types].map(([name, count]) => ({ name, count })),
|
|
173
180
|
keys: [...keys].sort((a, b) => keyRank(a) - keyRank(b) || a.localeCompare(b)),
|
|
174
181
|
bpm: min === Infinity ? null : { min, max },
|
|
175
|
-
hasDuration
|
|
182
|
+
hasDuration,
|
|
183
|
+
loops,
|
|
184
|
+
oneShots: sounds.length - loops
|
|
176
185
|
};
|
|
177
186
|
}
|
|
178
187
|
function matches(sound, filter = {}) {
|
|
179
188
|
if (filter.type && sound.type !== filter.type) return false;
|
|
180
189
|
if (filter.key && sound.key !== normalizeKey(filter.key)) return false;
|
|
190
|
+
if (filter.loop === "loop" && !sound.loop) return false;
|
|
191
|
+
if (filter.loop === "one-shot" && sound.loop) return false;
|
|
181
192
|
const lo = Number(filter.bpmMin), hi = Number(filter.bpmMax);
|
|
182
193
|
if (filter.bpmMin != null && filter.bpmMin !== "" && Number.isFinite(lo) || filter.bpmMax != null && filter.bpmMax !== "" && Number.isFinite(hi)) {
|
|
183
194
|
if (sound.bpm == null) return false;
|
|
@@ -582,6 +593,10 @@ var DEFAULT_STRINGS = {
|
|
|
582
593
|
sortKey: "Key",
|
|
583
594
|
sortDuration: "Length",
|
|
584
595
|
loop: "Loop",
|
|
596
|
+
loopFilter: "Loops or one-shots",
|
|
597
|
+
loops: "Loops",
|
|
598
|
+
oneShots: "One-shots",
|
|
599
|
+
isLoop: "Loop",
|
|
585
600
|
play: "Play {title}",
|
|
586
601
|
pause: "Pause {title}",
|
|
587
602
|
seek: "Seek {title}",
|
|
@@ -610,7 +625,7 @@ function countText(shown, total, strings = DEFAULT_STRINGS) {
|
|
|
610
625
|
}
|
|
611
626
|
|
|
612
627
|
// src/js/render/options.js
|
|
613
|
-
var FILTERS = ["type", "key", "bpm"];
|
|
628
|
+
var FILTERS = ["type", "key", "bpm", "loop"];
|
|
614
629
|
var COLUMNS = ["type", "bpm", "key", "duration"];
|
|
615
630
|
var RENDER_DEFAULTS = {
|
|
616
631
|
player: "inline",
|
|
@@ -787,6 +802,7 @@ function toolbarPlan(f, o) {
|
|
|
787
802
|
types: !typed ? null : f.types.length > o.maxTypeChips ? "menu" : "chips",
|
|
788
803
|
key: o.filters.includes("key") && f.keys.length > 1,
|
|
789
804
|
bpm: o.filters.includes("bpm") && f.bpm !== null && f.bpm.max > f.bpm.min,
|
|
805
|
+
loops: o.filters.includes("loop") && f.loops > 0 && f.oneShots > 0,
|
|
790
806
|
sorts: sorts.length > 1 ? sorts : [],
|
|
791
807
|
search: !!o.search,
|
|
792
808
|
loop: !!o.loopToggle,
|
|
@@ -857,6 +873,20 @@ function renderBpmRange(s, range) {
|
|
|
857
873
|
h("span", { class: "ws-bpm-unit", "aria-hidden": "true" }, text(s.bpm))
|
|
858
874
|
);
|
|
859
875
|
}
|
|
876
|
+
function renderLoopFilter(s) {
|
|
877
|
+
const button = (value, label) => h(
|
|
878
|
+
"button",
|
|
879
|
+
{ type: "button", class: "ws-seg-btn", "data-ws-loop-filter": value, "aria-pressed": String(value === "") },
|
|
880
|
+
h("span", {}, text(label))
|
|
881
|
+
);
|
|
882
|
+
return h(
|
|
883
|
+
"div",
|
|
884
|
+
{ class: "ws-seg", role: "group", "aria-label": s.loopFilter },
|
|
885
|
+
button("", s.all),
|
|
886
|
+
button("loop", s.loops),
|
|
887
|
+
button("one-shot", s.oneShots)
|
|
888
|
+
);
|
|
889
|
+
}
|
|
860
890
|
function renderLoopToggle(s) {
|
|
861
891
|
return h("button", { type: "button", class: "ws-loop", "data-ws-loop": true, "aria-pressed": "false" }, ICONS.loop, h("span", {}, text(s.loop)));
|
|
862
892
|
}
|
|
@@ -885,6 +915,7 @@ function renderToolbar(plan, { o, s, f, total, id }) {
|
|
|
885
915
|
options: [{ value: "", label: s.anyKey }, ...f.keys.map((k) => ({ value: k, label: k }))]
|
|
886
916
|
}),
|
|
887
917
|
plan.bpm && renderBpmRange(s, f.bpm),
|
|
918
|
+
plan.loops && renderLoopFilter(s),
|
|
888
919
|
plan.sorts.length > 0 && menu("sort", {
|
|
889
920
|
label: s.sort,
|
|
890
921
|
prefix: s.sortBy,
|
|
@@ -935,10 +966,17 @@ function renderRow(sound, index, o, hidden = false) {
|
|
|
935
966
|
"data-peaks": sound.peaks ? encodePeaks(sound.peaks) : null,
|
|
936
967
|
"data-waveform": sound.waveform,
|
|
937
968
|
"data-download": sound.download,
|
|
969
|
+
"data-loop": sound.loop ? "true" : null,
|
|
938
970
|
hidden
|
|
939
971
|
},
|
|
940
972
|
h("button", { type: "button", class: "ws-play", "aria-pressed": "false", "aria-label": fill(s.play, vars) }, ICONS.play, ICONS.pause),
|
|
941
|
-
h(
|
|
973
|
+
h(
|
|
974
|
+
"span",
|
|
975
|
+
{ class: "ws-cell ws-title" },
|
|
976
|
+
h("span", { class: "ws-title-text" }, text(sound.title)),
|
|
977
|
+
// A loop says so beside its name; a one-shot carries nothing.
|
|
978
|
+
sound.loop && h("span", { class: "ws-loop-mark", title: s.isLoop }, ICONS.loop, h("span", { class: "ws-sr" }, text(s.isLoop)))
|
|
979
|
+
),
|
|
942
980
|
// Wide rows: `display: contents` makes each cell a column. Narrow
|
|
943
981
|
// rows: one line under the title.
|
|
944
982
|
cells.length > 0 && h("span", { class: "ws-cells" }, cells),
|
|
@@ -1003,7 +1041,8 @@ function readRows(list) {
|
|
|
1003
1041
|
tags: d.tags,
|
|
1004
1042
|
peaks: d.peaks,
|
|
1005
1043
|
waveform: d.waveform,
|
|
1006
|
-
download: d.download
|
|
1044
|
+
download: d.download,
|
|
1045
|
+
loop: d.loop
|
|
1007
1046
|
}, sounds.length);
|
|
1008
1047
|
if (!sound) {
|
|
1009
1048
|
row.remove();
|
|
@@ -1061,7 +1100,7 @@ function resolveCssColor(container, value) {
|
|
|
1061
1100
|
function urlKeys(urlState) {
|
|
1062
1101
|
if (!urlState) return null;
|
|
1063
1102
|
const p = typeof urlState === "string" ? `${urlState}-` : "";
|
|
1064
|
-
return { q: `${p}q`, type: `${p}type`, key: `${p}key`, bpm: `${p}bpm`, sort: `${p}sort` };
|
|
1103
|
+
return { q: `${p}q`, type: `${p}type`, key: `${p}key`, bpm: `${p}bpm`, loop: `${p}loop`, sort: `${p}sort` };
|
|
1065
1104
|
}
|
|
1066
1105
|
function parseBpmRange(value) {
|
|
1067
1106
|
const m = String(value ?? "").match(/^(\d*)-(\d*)$/);
|
|
@@ -1083,6 +1122,8 @@ function readUrlState(search, keys, available, sorts) {
|
|
|
1083
1122
|
if (key && available.keys.includes(key)) out.filter.key = key;
|
|
1084
1123
|
const bpm = parseBpmRange(sp.get(keys.bpm));
|
|
1085
1124
|
if (bpm) Object.assign(out.filter, bpm);
|
|
1125
|
+
const loop = sp.get(keys.loop);
|
|
1126
|
+
if (LOOP_FILTERS.includes(loop) && available.loops > 0 && available.oneShots > 0) out.filter.loop = loop;
|
|
1086
1127
|
const sort = sp.get(keys.sort);
|
|
1087
1128
|
if (sort && sorts.includes(sort)) out.sort = sort;
|
|
1088
1129
|
return out;
|
|
@@ -1095,12 +1136,13 @@ function writeUrlState(href, keys, filter, sort, defaultSort) {
|
|
|
1095
1136
|
set(keys.type, filter.type);
|
|
1096
1137
|
set(keys.key, filter.key);
|
|
1097
1138
|
set(keys.bpm, formatBpmRange(filter.bpmMin, filter.bpmMax));
|
|
1139
|
+
set(keys.loop, filter.loop);
|
|
1098
1140
|
set(keys.sort, sort !== defaultSort ? sort : "");
|
|
1099
1141
|
return url.href;
|
|
1100
1142
|
}
|
|
1101
1143
|
|
|
1102
1144
|
// src/js/core/WaveformSounds.js
|
|
1103
|
-
var NO_FILTER = Object.freeze({ query: "", type: "", key: "", bpmMin: "", bpmMax: "" });
|
|
1145
|
+
var NO_FILTER = Object.freeze({ query: "", type: "", key: "", bpmMin: "", bpmMax: "", loop: "" });
|
|
1104
1146
|
var SEARCH_DELAY = 120;
|
|
1105
1147
|
var BPM_DELAY = 200;
|
|
1106
1148
|
var URL_DELAY = 250;
|
|
@@ -1205,7 +1247,8 @@ var WaveformSounds = class _WaveformSounds {
|
|
|
1205
1247
|
more: q("[data-ws-more]"),
|
|
1206
1248
|
engine: q("[data-ws-engine]"),
|
|
1207
1249
|
status: q("[data-ws-status]"),
|
|
1208
|
-
chips: [...this.container.querySelectorAll("[data-ws-type]")]
|
|
1250
|
+
chips: [...this.container.querySelectorAll("[data-ws-type]")],
|
|
1251
|
+
loopFilter: [...this.container.querySelectorAll("[data-ws-loop-filter]")]
|
|
1209
1252
|
};
|
|
1210
1253
|
this.rows = indexRows(this.$.list);
|
|
1211
1254
|
}
|
|
@@ -1254,7 +1297,7 @@ var WaveformSounds = class _WaveformSounds {
|
|
|
1254
1297
|
}
|
|
1255
1298
|
/* ── Input ────────────────────────────────────────────────────────── */
|
|
1256
1299
|
/**
|
|
1257
|
-
* Clicks: type chips, Show more, Clear, Loop, a touch tap on a waveform
|
|
1300
|
+
* Clicks: type chips, loops or one-shots, Show more, Clear, Loop, a touch tap on a waveform
|
|
1258
1301
|
* (seek), and anywhere else on a row (play/pause).
|
|
1259
1302
|
* @private
|
|
1260
1303
|
*/
|
|
@@ -1265,6 +1308,11 @@ var WaveformSounds = class _WaveformSounds {
|
|
|
1265
1308
|
this.setFilter({ type: chip.dataset.wsType });
|
|
1266
1309
|
return;
|
|
1267
1310
|
}
|
|
1311
|
+
const seg = t.closest("[data-ws-loop-filter]");
|
|
1312
|
+
if (seg) {
|
|
1313
|
+
this.setFilter({ loop: seg.dataset.wsLoopFilter });
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1268
1316
|
if (t.closest("[data-ws-more]")) {
|
|
1269
1317
|
this.showMore();
|
|
1270
1318
|
return;
|
|
@@ -1532,6 +1580,7 @@ var WaveformSounds = class _WaveformSounds {
|
|
|
1532
1580
|
if ($.bpmMin && $.bpmMin.value !== String(f.bpmMin)) $.bpmMin.value = f.bpmMin;
|
|
1533
1581
|
if ($.bpmMax && $.bpmMax.value !== String(f.bpmMax)) $.bpmMax.value = f.bpmMax;
|
|
1534
1582
|
$.chips.forEach((c) => c.setAttribute("aria-pressed", String(c.dataset.wsType === (f.type || ""))));
|
|
1583
|
+
$.loopFilter.forEach((b) => b.setAttribute("aria-pressed", String(b.dataset.wsLoopFilter === (f.loop || ""))));
|
|
1535
1584
|
}
|
|
1536
1585
|
/**
|
|
1537
1586
|
* Lay the rows out for the current filter, sort and page: order, hide,
|
|
@@ -1703,7 +1752,9 @@ var WaveformSounds = class _WaveformSounds {
|
|
|
1703
1752
|
return true;
|
|
1704
1753
|
}
|
|
1705
1754
|
/**
|
|
1706
|
-
* Loop the current sound (auditioning a loop is the common case).
|
|
1755
|
+
* Loop the current sound (auditioning a loop is the common case). When
|
|
1756
|
+
* the list marks its loops (`loop: true` on any sound), only those
|
|
1757
|
+
* repeat: a one-shot always plays once.
|
|
1707
1758
|
* @param {boolean} on
|
|
1708
1759
|
*/
|
|
1709
1760
|
setLoop(on) {
|
|
@@ -1716,7 +1767,17 @@ var WaveformSounds = class _WaveformSounds {
|
|
|
1716
1767
|
*/
|
|
1717
1768
|
_setLoop(on) {
|
|
1718
1769
|
this.$?.loop?.setAttribute("aria-pressed", String(on));
|
|
1719
|
-
if (this.engine?.audio) this.engine.audio.loop =
|
|
1770
|
+
if (this.engine?.audio) this.engine.audio.loop = this._repeats();
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Should the current sound repeat? The Loop toggle is on, and either
|
|
1774
|
+
* the list doesn't say which sounds are loops or this one is.
|
|
1775
|
+
* @private
|
|
1776
|
+
*/
|
|
1777
|
+
_repeats() {
|
|
1778
|
+
if (!this.loop) return false;
|
|
1779
|
+
const marksLoops = this.sounds.some((s) => s.loop);
|
|
1780
|
+
return !marksLoops || !!this.sounds[this.currentIndex]?.loop;
|
|
1720
1781
|
}
|
|
1721
1782
|
/**
|
|
1722
1783
|
* Seek a row's sound to `fraction`; a row that isn't current starts
|
|
@@ -1744,7 +1805,7 @@ var WaveformSounds = class _WaveformSounds {
|
|
|
1744
1805
|
* @private
|
|
1745
1806
|
*/
|
|
1746
1807
|
_onEngineLoad() {
|
|
1747
|
-
if (this.engine?.audio) this.engine.audio.loop = this.
|
|
1808
|
+
if (this.engine?.audio) this.engine.audio.loop = this._repeats();
|
|
1748
1809
|
const sound = this.sounds[this.currentIndex];
|
|
1749
1810
|
if (sound && !sound.peaks && this.engine?.waveformData?.length) {
|
|
1750
1811
|
sound.peaks = resample(this.engine.waveformData, 96);
|
package/dist/waveform-sounds.js
CHANGED
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
if (seconds == null || seconds === "") return "";
|
|
99
99
|
const s = Number(seconds);
|
|
100
100
|
if (!Number.isFinite(s) || s < 0) return "";
|
|
101
|
+
if (s > 0 && s < 0.95) return `${Math.max(0.1, Math.round(s * 10) / 10).toFixed(1)}s`;
|
|
101
102
|
const total = Math.round(s);
|
|
102
103
|
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, "0")}`;
|
|
103
104
|
}
|
|
@@ -134,9 +135,14 @@
|
|
|
134
135
|
tags,
|
|
135
136
|
peaks: decodePeaks(input.peaks, peakScale),
|
|
136
137
|
waveform: input.waveform ? String(input.waveform) : null,
|
|
137
|
-
download: input.download ? String(input.download) : null
|
|
138
|
+
download: input.download ? String(input.download) : null,
|
|
139
|
+
loop: isLoop(input.loop)
|
|
138
140
|
};
|
|
139
141
|
}
|
|
142
|
+
var LOOP_FILTERS = ["loop", "one-shot"];
|
|
143
|
+
function isLoop(value) {
|
|
144
|
+
return value === true || value === 1 || value === "true" || value === "1";
|
|
145
|
+
}
|
|
140
146
|
function parseManifest(manifest) {
|
|
141
147
|
const list = Array.isArray(manifest) ? manifest : Array.isArray(manifest?.sounds) ? manifest.sounds : [];
|
|
142
148
|
const scale = Array.isArray(manifest) ? 1 : Number(manifest?.peakScale) || 1;
|
|
@@ -159,7 +165,7 @@
|
|
|
159
165
|
function facets(sounds) {
|
|
160
166
|
const types = /* @__PURE__ */ new Map();
|
|
161
167
|
const keys = /* @__PURE__ */ new Set();
|
|
162
|
-
let min = Infinity, max = -Infinity, hasDuration = false;
|
|
168
|
+
let min = Infinity, max = -Infinity, hasDuration = false, loops = 0;
|
|
163
169
|
for (const s of sounds) {
|
|
164
170
|
if (s.type) types.set(s.type, (types.get(s.type) || 0) + 1);
|
|
165
171
|
if (s.key) keys.add(s.key);
|
|
@@ -168,17 +174,22 @@
|
|
|
168
174
|
max = Math.max(max, s.bpm);
|
|
169
175
|
}
|
|
170
176
|
if (s.duration != null) hasDuration = true;
|
|
177
|
+
if (s.loop) loops++;
|
|
171
178
|
}
|
|
172
179
|
return {
|
|
173
180
|
types: [...types].map(([name, count]) => ({ name, count })),
|
|
174
181
|
keys: [...keys].sort((a, b) => keyRank(a) - keyRank(b) || a.localeCompare(b)),
|
|
175
182
|
bpm: min === Infinity ? null : { min, max },
|
|
176
|
-
hasDuration
|
|
183
|
+
hasDuration,
|
|
184
|
+
loops,
|
|
185
|
+
oneShots: sounds.length - loops
|
|
177
186
|
};
|
|
178
187
|
}
|
|
179
188
|
function matches(sound, filter = {}) {
|
|
180
189
|
if (filter.type && sound.type !== filter.type) return false;
|
|
181
190
|
if (filter.key && sound.key !== normalizeKey(filter.key)) return false;
|
|
191
|
+
if (filter.loop === "loop" && !sound.loop) return false;
|
|
192
|
+
if (filter.loop === "one-shot" && sound.loop) return false;
|
|
182
193
|
const lo = Number(filter.bpmMin), hi = Number(filter.bpmMax);
|
|
183
194
|
if (filter.bpmMin != null && filter.bpmMin !== "" && Number.isFinite(lo) || filter.bpmMax != null && filter.bpmMax !== "" && Number.isFinite(hi)) {
|
|
184
195
|
if (sound.bpm == null) return false;
|
|
@@ -583,6 +594,10 @@
|
|
|
583
594
|
sortKey: "Key",
|
|
584
595
|
sortDuration: "Length",
|
|
585
596
|
loop: "Loop",
|
|
597
|
+
loopFilter: "Loops or one-shots",
|
|
598
|
+
loops: "Loops",
|
|
599
|
+
oneShots: "One-shots",
|
|
600
|
+
isLoop: "Loop",
|
|
586
601
|
play: "Play {title}",
|
|
587
602
|
pause: "Pause {title}",
|
|
588
603
|
seek: "Seek {title}",
|
|
@@ -611,7 +626,7 @@
|
|
|
611
626
|
}
|
|
612
627
|
|
|
613
628
|
// src/js/render/options.js
|
|
614
|
-
var FILTERS = ["type", "key", "bpm"];
|
|
629
|
+
var FILTERS = ["type", "key", "bpm", "loop"];
|
|
615
630
|
var COLUMNS = ["type", "bpm", "key", "duration"];
|
|
616
631
|
var RENDER_DEFAULTS = {
|
|
617
632
|
player: "inline",
|
|
@@ -788,6 +803,7 @@
|
|
|
788
803
|
types: !typed ? null : f.types.length > o.maxTypeChips ? "menu" : "chips",
|
|
789
804
|
key: o.filters.includes("key") && f.keys.length > 1,
|
|
790
805
|
bpm: o.filters.includes("bpm") && f.bpm !== null && f.bpm.max > f.bpm.min,
|
|
806
|
+
loops: o.filters.includes("loop") && f.loops > 0 && f.oneShots > 0,
|
|
791
807
|
sorts: sorts.length > 1 ? sorts : [],
|
|
792
808
|
search: !!o.search,
|
|
793
809
|
loop: !!o.loopToggle,
|
|
@@ -858,6 +874,20 @@
|
|
|
858
874
|
h("span", { class: "ws-bpm-unit", "aria-hidden": "true" }, text(s.bpm))
|
|
859
875
|
);
|
|
860
876
|
}
|
|
877
|
+
function renderLoopFilter(s) {
|
|
878
|
+
const button = (value, label) => h(
|
|
879
|
+
"button",
|
|
880
|
+
{ type: "button", class: "ws-seg-btn", "data-ws-loop-filter": value, "aria-pressed": String(value === "") },
|
|
881
|
+
h("span", {}, text(label))
|
|
882
|
+
);
|
|
883
|
+
return h(
|
|
884
|
+
"div",
|
|
885
|
+
{ class: "ws-seg", role: "group", "aria-label": s.loopFilter },
|
|
886
|
+
button("", s.all),
|
|
887
|
+
button("loop", s.loops),
|
|
888
|
+
button("one-shot", s.oneShots)
|
|
889
|
+
);
|
|
890
|
+
}
|
|
861
891
|
function renderLoopToggle(s) {
|
|
862
892
|
return h("button", { type: "button", class: "ws-loop", "data-ws-loop": true, "aria-pressed": "false" }, ICONS.loop, h("span", {}, text(s.loop)));
|
|
863
893
|
}
|
|
@@ -886,6 +916,7 @@
|
|
|
886
916
|
options: [{ value: "", label: s.anyKey }, ...f.keys.map((k) => ({ value: k, label: k }))]
|
|
887
917
|
}),
|
|
888
918
|
plan.bpm && renderBpmRange(s, f.bpm),
|
|
919
|
+
plan.loops && renderLoopFilter(s),
|
|
889
920
|
plan.sorts.length > 0 && menu("sort", {
|
|
890
921
|
label: s.sort,
|
|
891
922
|
prefix: s.sortBy,
|
|
@@ -936,10 +967,17 @@
|
|
|
936
967
|
"data-peaks": sound.peaks ? encodePeaks(sound.peaks) : null,
|
|
937
968
|
"data-waveform": sound.waveform,
|
|
938
969
|
"data-download": sound.download,
|
|
970
|
+
"data-loop": sound.loop ? "true" : null,
|
|
939
971
|
hidden
|
|
940
972
|
},
|
|
941
973
|
h("button", { type: "button", class: "ws-play", "aria-pressed": "false", "aria-label": fill(s.play, vars) }, ICONS.play, ICONS.pause),
|
|
942
|
-
h(
|
|
974
|
+
h(
|
|
975
|
+
"span",
|
|
976
|
+
{ class: "ws-cell ws-title" },
|
|
977
|
+
h("span", { class: "ws-title-text" }, text(sound.title)),
|
|
978
|
+
// A loop says so beside its name; a one-shot carries nothing.
|
|
979
|
+
sound.loop && h("span", { class: "ws-loop-mark", title: s.isLoop }, ICONS.loop, h("span", { class: "ws-sr" }, text(s.isLoop)))
|
|
980
|
+
),
|
|
943
981
|
// Wide rows: `display: contents` makes each cell a column. Narrow
|
|
944
982
|
// rows: one line under the title.
|
|
945
983
|
cells.length > 0 && h("span", { class: "ws-cells" }, cells),
|
|
@@ -1004,7 +1042,8 @@
|
|
|
1004
1042
|
tags: d.tags,
|
|
1005
1043
|
peaks: d.peaks,
|
|
1006
1044
|
waveform: d.waveform,
|
|
1007
|
-
download: d.download
|
|
1045
|
+
download: d.download,
|
|
1046
|
+
loop: d.loop
|
|
1008
1047
|
}, sounds.length);
|
|
1009
1048
|
if (!sound) {
|
|
1010
1049
|
row.remove();
|
|
@@ -1062,7 +1101,7 @@
|
|
|
1062
1101
|
function urlKeys(urlState) {
|
|
1063
1102
|
if (!urlState) return null;
|
|
1064
1103
|
const p = typeof urlState === "string" ? `${urlState}-` : "";
|
|
1065
|
-
return { q: `${p}q`, type: `${p}type`, key: `${p}key`, bpm: `${p}bpm`, sort: `${p}sort` };
|
|
1104
|
+
return { q: `${p}q`, type: `${p}type`, key: `${p}key`, bpm: `${p}bpm`, loop: `${p}loop`, sort: `${p}sort` };
|
|
1066
1105
|
}
|
|
1067
1106
|
function parseBpmRange(value) {
|
|
1068
1107
|
const m = String(value ?? "").match(/^(\d*)-(\d*)$/);
|
|
@@ -1084,6 +1123,8 @@
|
|
|
1084
1123
|
if (key && available.keys.includes(key)) out.filter.key = key;
|
|
1085
1124
|
const bpm = parseBpmRange(sp.get(keys.bpm));
|
|
1086
1125
|
if (bpm) Object.assign(out.filter, bpm);
|
|
1126
|
+
const loop = sp.get(keys.loop);
|
|
1127
|
+
if (LOOP_FILTERS.includes(loop) && available.loops > 0 && available.oneShots > 0) out.filter.loop = loop;
|
|
1087
1128
|
const sort = sp.get(keys.sort);
|
|
1088
1129
|
if (sort && sorts.includes(sort)) out.sort = sort;
|
|
1089
1130
|
return out;
|
|
@@ -1096,12 +1137,13 @@
|
|
|
1096
1137
|
set(keys.type, filter.type);
|
|
1097
1138
|
set(keys.key, filter.key);
|
|
1098
1139
|
set(keys.bpm, formatBpmRange(filter.bpmMin, filter.bpmMax));
|
|
1140
|
+
set(keys.loop, filter.loop);
|
|
1099
1141
|
set(keys.sort, sort !== defaultSort ? sort : "");
|
|
1100
1142
|
return url.href;
|
|
1101
1143
|
}
|
|
1102
1144
|
|
|
1103
1145
|
// src/js/core/WaveformSounds.js
|
|
1104
|
-
var NO_FILTER = Object.freeze({ query: "", type: "", key: "", bpmMin: "", bpmMax: "" });
|
|
1146
|
+
var NO_FILTER = Object.freeze({ query: "", type: "", key: "", bpmMin: "", bpmMax: "", loop: "" });
|
|
1105
1147
|
var SEARCH_DELAY = 120;
|
|
1106
1148
|
var BPM_DELAY = 200;
|
|
1107
1149
|
var URL_DELAY = 250;
|
|
@@ -1206,7 +1248,8 @@
|
|
|
1206
1248
|
more: q("[data-ws-more]"),
|
|
1207
1249
|
engine: q("[data-ws-engine]"),
|
|
1208
1250
|
status: q("[data-ws-status]"),
|
|
1209
|
-
chips: [...this.container.querySelectorAll("[data-ws-type]")]
|
|
1251
|
+
chips: [...this.container.querySelectorAll("[data-ws-type]")],
|
|
1252
|
+
loopFilter: [...this.container.querySelectorAll("[data-ws-loop-filter]")]
|
|
1210
1253
|
};
|
|
1211
1254
|
this.rows = indexRows(this.$.list);
|
|
1212
1255
|
}
|
|
@@ -1255,7 +1298,7 @@
|
|
|
1255
1298
|
}
|
|
1256
1299
|
/* ── Input ────────────────────────────────────────────────────────── */
|
|
1257
1300
|
/**
|
|
1258
|
-
* Clicks: type chips, Show more, Clear, Loop, a touch tap on a waveform
|
|
1301
|
+
* Clicks: type chips, loops or one-shots, Show more, Clear, Loop, a touch tap on a waveform
|
|
1259
1302
|
* (seek), and anywhere else on a row (play/pause).
|
|
1260
1303
|
* @private
|
|
1261
1304
|
*/
|
|
@@ -1266,6 +1309,11 @@
|
|
|
1266
1309
|
this.setFilter({ type: chip.dataset.wsType });
|
|
1267
1310
|
return;
|
|
1268
1311
|
}
|
|
1312
|
+
const seg = t.closest("[data-ws-loop-filter]");
|
|
1313
|
+
if (seg) {
|
|
1314
|
+
this.setFilter({ loop: seg.dataset.wsLoopFilter });
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1269
1317
|
if (t.closest("[data-ws-more]")) {
|
|
1270
1318
|
this.showMore();
|
|
1271
1319
|
return;
|
|
@@ -1533,6 +1581,7 @@
|
|
|
1533
1581
|
if ($.bpmMin && $.bpmMin.value !== String(f.bpmMin)) $.bpmMin.value = f.bpmMin;
|
|
1534
1582
|
if ($.bpmMax && $.bpmMax.value !== String(f.bpmMax)) $.bpmMax.value = f.bpmMax;
|
|
1535
1583
|
$.chips.forEach((c) => c.setAttribute("aria-pressed", String(c.dataset.wsType === (f.type || ""))));
|
|
1584
|
+
$.loopFilter.forEach((b) => b.setAttribute("aria-pressed", String(b.dataset.wsLoopFilter === (f.loop || ""))));
|
|
1536
1585
|
}
|
|
1537
1586
|
/**
|
|
1538
1587
|
* Lay the rows out for the current filter, sort and page: order, hide,
|
|
@@ -1704,7 +1753,9 @@
|
|
|
1704
1753
|
return true;
|
|
1705
1754
|
}
|
|
1706
1755
|
/**
|
|
1707
|
-
* Loop the current sound (auditioning a loop is the common case).
|
|
1756
|
+
* Loop the current sound (auditioning a loop is the common case). When
|
|
1757
|
+
* the list marks its loops (`loop: true` on any sound), only those
|
|
1758
|
+
* repeat: a one-shot always plays once.
|
|
1708
1759
|
* @param {boolean} on
|
|
1709
1760
|
*/
|
|
1710
1761
|
setLoop(on) {
|
|
@@ -1717,7 +1768,17 @@
|
|
|
1717
1768
|
*/
|
|
1718
1769
|
_setLoop(on) {
|
|
1719
1770
|
this.$?.loop?.setAttribute("aria-pressed", String(on));
|
|
1720
|
-
if (this.engine?.audio) this.engine.audio.loop =
|
|
1771
|
+
if (this.engine?.audio) this.engine.audio.loop = this._repeats();
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* Should the current sound repeat? The Loop toggle is on, and either
|
|
1775
|
+
* the list doesn't say which sounds are loops or this one is.
|
|
1776
|
+
* @private
|
|
1777
|
+
*/
|
|
1778
|
+
_repeats() {
|
|
1779
|
+
if (!this.loop) return false;
|
|
1780
|
+
const marksLoops = this.sounds.some((s) => s.loop);
|
|
1781
|
+
return !marksLoops || !!this.sounds[this.currentIndex]?.loop;
|
|
1721
1782
|
}
|
|
1722
1783
|
/**
|
|
1723
1784
|
* Seek a row's sound to `fraction`; a row that isn't current starts
|
|
@@ -1745,7 +1806,7 @@
|
|
|
1745
1806
|
* @private
|
|
1746
1807
|
*/
|
|
1747
1808
|
_onEngineLoad() {
|
|
1748
|
-
if (this.engine?.audio) this.engine.audio.loop = this.
|
|
1809
|
+
if (this.engine?.audio) this.engine.audio.loop = this._repeats();
|
|
1749
1810
|
const sound = this.sounds[this.currentIndex];
|
|
1750
1811
|
if (sound && !sound.peaks && this.engine?.waveformData?.length) {
|
|
1751
1812
|
sound.peaks = resample(this.engine.waveformData, 96);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.waveform-sounds{--ws-accent: currentColor;--ws-on-accent: var(--ws-surface, rgb(from currentColor calc(255 - r) calc(255 - g) calc(255 - b) ));--ws-muted: color-mix(in srgb, currentColor 62%, transparent);--ws-border: color-mix(in srgb, currentColor 12%, transparent);--ws-hover: color-mix(in srgb, currentColor 5%, transparent);--ws-current: color-mix(in srgb, var(--ws-accent) 7%, transparent);--ws-field: color-mix(in srgb, currentColor 5%, transparent);--ws-wave-color: color-mix(in srgb, currentColor 30%, transparent);--ws-progress-color: var(--ws-accent);--ws-radius: 10px;--ws-control-radius: 999px;--ws-row-height: 3.25rem;--ws-wave-height: 28px;--ws-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;container-type:inline-size;color:inherit;font:inherit}.waveform-sounds *,.waveform-sounds *:before,.waveform-sounds *:after{box-sizing:border-box}.waveform-sounds [hidden]{display:none!important}.ws-sr{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.ws-icon{width:1em;height:1em;fill:currentColor;flex:none}.ws-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem;margin-bottom:1rem}.ws-search{flex:1 1 16rem;display:flex;align-items:center;gap:.6rem;min-width:0;height:2.75rem;padding:0 1rem;border:1px solid var(--ws-border);border-radius:var(--ws-control-radius);background:var(--ws-field);color:inherit;cursor:text}.ws-search:focus-within{border-color:var(--ws-accent)}.ws-search-input{flex:1;min-width:0;height:100%;border:0;background:none;color:inherit;font:inherit;outline:none}.ws-search .ws-icon{color:var(--ws-muted)}.ws-search-input::placeholder{color:var(--ws-muted)}.ws-search-input::-webkit-search-cancel-button,.ws-menu-search::-webkit-search-cancel-button{-webkit-appearance:none;width:.9em;height:.9em;background:currentColor;opacity:.55;cursor:pointer;-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}.ws-controls{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.ws-bpm-range input{height:2.75rem;border:1px solid var(--ws-border);border-radius:var(--ws-control-radius);background:var(--ws-field);color:inherit;font:inherit;font-size:.9em}.ws-menu{position:relative}.ws-menu-btn{display:inline-flex;align-items:center;gap:.45rem;height:2.75rem;max-width:16rem;padding:0 .85rem 0 1rem;border:1px solid var(--ws-border);border-radius:var(--ws-control-radius);background:var(--ws-field);color:inherit;font:inherit;font-size:.9em;cursor:pointer}.ws-menu-btn:hover{background:var(--ws-hover)}.ws-menu-btn[aria-expanded=true]{border-color:var(--ws-accent)}.ws-menu-prefix{color:var(--ws-muted)}.ws-menu-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ws-menu-chevron{font-size:1.1em;color:var(--ws-muted);transition:transform .15s}.ws-menu-btn[aria-expanded=true] .ws-menu-chevron{transform:rotate(180deg)}.ws-menu-pop{position:absolute;top:calc(100% + .4rem);left:0;z-index:20;width:max-content;min-width:max(100%,14rem);max-width:min(22rem,90vw);padding:.35rem;border:1px solid var(--ws-border);border-radius:var(--ws-radius);background:var(--ws-popover-bg, var(--ws-surface, Canvas));box-shadow:0 18px 40px -16px #00000073}.ws-menu--end .ws-menu-pop{left:auto;right:0}.ws-menu-search{display:block;width:100%;height:2.4rem;margin-bottom:.3rem;padding:0 .75rem;border:1px solid var(--ws-border);border-radius:calc(var(--ws-radius) * .7);background:var(--ws-field);color:inherit;font:inherit;font-size:.9em;outline:none}.ws-menu-search:focus{border-color:var(--ws-accent)}.ws-menu-list{list-style:none;margin:0;padding:0;max-height:18rem;overflow-y:auto;outline:none}.ws-menu-option{display:flex;align-items:center;gap:.5rem;padding:.5rem .6rem;border-radius:calc(var(--ws-radius) * .6);font-size:.9em;cursor:pointer}.ws-menu-option:hover,.ws-menu-option.is-active{background:var(--ws-hover)}.ws-menu-option.is-active{outline:1px solid var(--ws-border)}.ws-menu-check{visibility:hidden;flex:none}.ws-menu-option[aria-selected=true]{font-weight:600}.ws-menu-option[aria-selected=true] .ws-menu-check{visibility:visible}.ws-menu-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ws-menu-count{font-family:var(--ws-mono);font-size:.85em;color:var(--ws-muted)}.ws-menu-none{margin:0;padding:.6rem;color:var(--ws-muted);font-size:.9em}.ws-bpm-range{display:inline-flex;align-items:center;gap:.35rem;color:var(--ws-muted);font-size:.9em}.ws-bpm-range input{width:5rem;padding:0 .85rem;-moz-appearance:textfield}.ws-bpm-range input::-webkit-inner-spin-button{display:none}.ws-loop{display:inline-flex;align-items:center;gap:.45rem;height:2.75rem;padding:0 1rem;border:1px solid var(--ws-border);border-radius:var(--ws-control-radius);background:none;color:inherit;font:inherit;font-size:.9em;cursor:pointer}.ws-loop[aria-pressed=true]{border-color:var(--ws-accent);background:var(--ws-accent)}.ws-loop[aria-pressed=true]>*{color:var(--ws-on-accent)}.ws-meta{flex-basis:100%;display:flex;flex-wrap:wrap;align-items:center;gap:.5rem 1rem}.ws-types{display:flex;flex-wrap:wrap;gap:.4rem;flex:1 1 auto;min-width:0}.ws-chip{display:inline-flex;align-items:center;gap:.4rem;height:2.25rem;padding:0 .9rem;border:1px solid var(--ws-border);border-radius:var(--ws-control-radius);background:none;color:inherit;font:inherit;font-size:.88em;cursor:pointer;transition:border-color .15s,background .15s}.ws-chip:hover{background:var(--ws-hover)}.ws-chip[aria-pressed=true]{border-color:var(--ws-accent);background:var(--ws-accent)}.ws-chip[aria-pressed=true]>*{color:var(--ws-on-accent)}.ws-chip-count{font-family:var(--ws-mono);font-size:.85em;opacity:.7}.ws-chip[aria-pressed=true] .ws-chip-count{opacity:1}.ws-count{margin:0 0 0 auto;color:var(--ws-muted);font-size:.88em;font-variant-numeric:tabular-nums}.ws-list{list-style:none;margin:0;padding:0;border-top:1px solid var(--ws-border)}.ws-row{display:flex;align-items:center;gap:1rem;min-height:var(--ws-row-height);padding:.4rem .75rem .4rem .4rem;border-bottom:1px solid var(--ws-border);cursor:pointer;transition:background .12s}.ws-row:hover{background:var(--ws-hover)}.ws-row.is-current{background:var(--ws-current)}.ws-row.is-error .ws-title{text-decoration:line-through;opacity:.6}.ws-play{flex:none;display:grid;place-items:center;width:2.25rem;height:2.25rem;border:0;border-radius:999px;background:var(--ws-field);color:inherit;font-size:.95rem;cursor:pointer;transition:background .15s,color .15s}.ws-row:hover .ws-play{background:color-mix(in srgb,currentColor 12%,transparent)}.ws-row.is-current .ws-play{background:var(--ws-accent)}.ws-row.is-current .ws-play>*{color:var(--ws-on-accent)}.ws-play .ws-icon-pause,.ws-row.is-playing .ws-play .ws-icon-play{display:none}.ws-row.is-playing .ws-play .ws-icon-pause{display:block}.ws-play:focus-visible,.ws-chip:focus-visible,.ws-menu-btn:focus-visible,.ws-loop:focus-visible,.ws-more:focus-visible,.ws-clear:focus-visible,.ws-wave:focus-visible,.ws-download:focus-visible{outline:2px solid var(--ws-accent);outline-offset:2px}.ws-cell{min-width:0;font-size:.9em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ws-title{flex:1.4 1 9rem;font-weight:500}.ws-type{flex:1 1 6rem;color:var(--ws-muted)}.ws-bpm,.ws-key,.ws-duration{flex:none;font-family:var(--ws-mono);font-size:.82em;color:var(--ws-muted);font-variant-numeric:tabular-nums}.ws-bpm{width:3.25ch;text-align:right}.ws-key{width:3.5ch}.ws-duration{width:4.5ch;text-align:right}.ws-wave{flex:2 1 8rem;position:relative;height:var(--ws-wave-height);min-width:6rem;cursor:pointer;touch-action:pan-y;border-radius:4px}.ws-canvas{display:block;width:100%;height:100%}.ws-download{flex:none;display:grid;place-items:center;width:2.25rem;height:2.25rem;border-radius:999px;color:var(--ws-muted);font-size:1.05rem;text-decoration:none;transition:color .15s,background .15s}.ws-download:hover{color:inherit;background:var(--ws-hover)}.ws-cells{display:contents}@container (max-width: 560px){.ws-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"play title dl" "play cells cells" "play wave wave";column-gap:.85rem;row-gap:.2rem;padding:.7rem .5rem}.ws-play{grid-area:play;align-self:center}.ws-title{grid-area:title;white-space:normal;overflow-wrap:anywhere}.ws-cells{grid-area:cells;display:flex;flex-wrap:wrap;align-items:baseline;gap:0 .5rem;min-width:0}.ws-cells>.ws-cell{flex:none;width:auto;text-align:left;font-size:.78em}.ws-cells>.ws-cell:empty{display:none}.ws-cells>.ws-cell+.ws-cell:not(:empty):before{content:"\b7";margin-right:.5rem;opacity:.6}.ws-wave{grid-area:wave;margin-top:.35rem;min-width:0}.ws-download{grid-area:dl;align-self:start}}.ws-empty{margin:1.5rem 0;color:var(--ws-muted)}.ws-clear,.ws-more{border:1px solid var(--ws-border);border-radius:var(--ws-control-radius);background:none;color:inherit;font:inherit;cursor:pointer}.ws-clear{margin-left:.5rem;padding:.35rem .85rem;font-size:.88em}.ws-more{display:block;margin:1.25rem auto 0;padding:.7rem 1.4rem;font-size:.92em}.ws-more:hover,.ws-clear:hover{background:var(--ws-hover)}.ws-engine--strip{position:sticky;bottom:0;margin-top:1rem;padding:.75rem;border:1px solid var(--ws-border);border-radius:var(--ws-radius);background:var(--ws-strip-bg, Canvas);z-index:1}@media(pointer:coarse){.ws-play,.ws-download{width:2.75rem;height:2.75rem}.ws-chip{height:2.5rem}.ws-search-input,.ws-menu-search,.ws-bpm-range input{font-size:16px}.ws-menu-option{padding:.75rem .6rem}}@media(prefers-reduced-motion:reduce){.ws-row,.ws-chip,.ws-play{transition:none}}
|
|
1
|
+
.waveform-sounds{--ws-accent: currentColor;--ws-on-accent: var(--ws-surface, rgb(from currentColor calc(255 - r) calc(255 - g) calc(255 - b) ));--ws-muted: color-mix(in srgb, currentColor 62%, transparent);--ws-border: color-mix(in srgb, currentColor 12%, transparent);--ws-hover: color-mix(in srgb, currentColor 5%, transparent);--ws-current: color-mix(in srgb, var(--ws-accent) 7%, transparent);--ws-field: color-mix(in srgb, currentColor 5%, transparent);--ws-wave-color: color-mix(in srgb, currentColor 30%, transparent);--ws-progress-color: var(--ws-accent);--ws-radius: 10px;--ws-control-radius: 999px;--ws-row-height: 3.25rem;--ws-wave-height: 28px;--ws-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;container-type:inline-size;color:inherit;font:inherit}.waveform-sounds *,.waveform-sounds *:before,.waveform-sounds *:after{box-sizing:border-box}.waveform-sounds [hidden]{display:none!important}.ws-sr{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.ws-icon{width:1em;height:1em;fill:currentColor;flex:none}.ws-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem;margin-bottom:1rem}.ws-search{flex:1 1 16rem;display:flex;align-items:center;gap:.6rem;min-width:0;height:2.75rem;padding:0 1rem;border:1px solid var(--ws-border);border-radius:var(--ws-control-radius);background:var(--ws-field);color:inherit;cursor:text}.ws-search:focus-within{border-color:var(--ws-accent)}.ws-search-input{flex:1;min-width:0;height:100%;border:0;background:none;color:inherit;font:inherit;outline:none}.ws-search .ws-icon{color:var(--ws-muted)}.ws-search-input::placeholder{color:var(--ws-muted)}.ws-search-input::-webkit-search-cancel-button,.ws-menu-search::-webkit-search-cancel-button{-webkit-appearance:none;width:.9em;height:.9em;background:currentColor;opacity:.55;cursor:pointer;-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}.ws-controls{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.ws-bpm-range input{height:2.75rem;border:1px solid var(--ws-border);border-radius:var(--ws-control-radius);background:var(--ws-field);color:inherit;font:inherit;font-size:.9em}.ws-menu{position:relative}.ws-menu-btn{display:inline-flex;align-items:center;gap:.45rem;height:2.75rem;max-width:16rem;padding:0 .85rem 0 1rem;border:1px solid var(--ws-border);border-radius:var(--ws-control-radius);background:var(--ws-field);color:inherit;font:inherit;font-size:.9em;cursor:pointer}.ws-menu-btn:hover{background:var(--ws-hover)}.ws-menu-btn[aria-expanded=true]{border-color:var(--ws-accent)}.ws-menu-prefix{color:var(--ws-muted)}.ws-menu-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ws-menu-chevron{font-size:1.1em;color:var(--ws-muted);transition:transform .15s}.ws-menu-btn[aria-expanded=true] .ws-menu-chevron{transform:rotate(180deg)}.ws-menu-pop{position:absolute;top:calc(100% + .4rem);left:0;z-index:20;width:max-content;min-width:max(100%,14rem);max-width:min(22rem,90vw);padding:.35rem;border:1px solid var(--ws-border);border-radius:var(--ws-radius);background:var(--ws-popover-bg, var(--ws-surface, Canvas));box-shadow:0 18px 40px -16px #00000073}.ws-menu--end .ws-menu-pop{left:auto;right:0}.ws-menu-search{display:block;width:100%;height:2.4rem;margin-bottom:.3rem;padding:0 .75rem;border:1px solid var(--ws-border);border-radius:calc(var(--ws-radius) * .7);background:var(--ws-field);color:inherit;font:inherit;font-size:.9em;outline:none}.ws-menu-search:focus{border-color:var(--ws-accent)}.ws-menu-list{list-style:none;margin:0;padding:0;max-height:18rem;overflow-y:auto;outline:none}.ws-menu-option{display:flex;align-items:center;gap:.5rem;padding:.5rem .6rem;border-radius:calc(var(--ws-radius) * .6);font-size:.9em;cursor:pointer}.ws-menu-option:hover,.ws-menu-option.is-active{background:var(--ws-hover)}.ws-menu-option.is-active{outline:1px solid var(--ws-border)}.ws-menu-check{visibility:hidden;flex:none}.ws-menu-option[aria-selected=true]{font-weight:600}.ws-menu-option[aria-selected=true] .ws-menu-check{visibility:visible}.ws-menu-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ws-menu-count{font-family:var(--ws-mono);font-size:.85em;color:var(--ws-muted)}.ws-menu-none{margin:0;padding:.6rem;color:var(--ws-muted);font-size:.9em}.ws-bpm-range{display:inline-flex;align-items:center;gap:.35rem;color:var(--ws-muted);font-size:.9em}.ws-bpm-range input{width:5rem;padding:0 .85rem;-moz-appearance:textfield}.ws-bpm-range input::-webkit-inner-spin-button{display:none}.ws-loop{display:inline-flex;align-items:center;gap:.45rem;height:2.75rem;padding:0 1rem;border:1px solid var(--ws-border);border-radius:var(--ws-control-radius);background:none;color:inherit;font:inherit;font-size:.9em;cursor:pointer}.ws-loop[aria-pressed=true]{border-color:var(--ws-accent);background:var(--ws-accent)}.ws-loop[aria-pressed=true]>*{color:var(--ws-on-accent)}.ws-seg{display:inline-flex;height:2.75rem;padding:.25rem;gap:.15rem;border:1px solid var(--ws-border);border-radius:var(--ws-control-radius)}.ws-seg-btn{padding:0 .85rem;border:0;border-radius:var(--ws-control-radius);background:none;color:inherit;font:inherit;font-size:.88em;white-space:nowrap;cursor:pointer;transition:background .15s}.ws-seg-btn:hover{background:var(--ws-hover)}.ws-seg-btn[aria-pressed=true]{background:var(--ws-accent)}.ws-seg-btn[aria-pressed=true]>*{color:var(--ws-on-accent)}.ws-meta{flex-basis:100%;display:flex;flex-wrap:wrap;align-items:center;gap:.5rem 1rem}.ws-types{display:flex;flex-wrap:wrap;gap:.4rem;flex:1 1 auto;min-width:0}.ws-chip{display:inline-flex;align-items:center;gap:.4rem;height:2.25rem;padding:0 .9rem;border:1px solid var(--ws-border);border-radius:var(--ws-control-radius);background:none;color:inherit;font:inherit;font-size:.88em;cursor:pointer;transition:border-color .15s,background .15s}.ws-chip:hover{background:var(--ws-hover)}.ws-chip[aria-pressed=true]{border-color:var(--ws-accent);background:var(--ws-accent)}.ws-chip[aria-pressed=true]>*{color:var(--ws-on-accent)}.ws-chip-count{font-family:var(--ws-mono);font-size:.85em;opacity:.7}.ws-chip[aria-pressed=true] .ws-chip-count{opacity:1}.ws-count{margin:0 0 0 auto;color:var(--ws-muted);font-size:.88em;font-variant-numeric:tabular-nums}.ws-list{list-style:none;margin:0;padding:0;border-top:1px solid var(--ws-border)}.ws-row{display:flex;align-items:center;gap:1rem;min-height:var(--ws-row-height);padding:.4rem .75rem .4rem .4rem;border-bottom:1px solid var(--ws-border);cursor:pointer;transition:background .12s}.ws-row:hover{background:var(--ws-hover)}.ws-row.is-current{background:var(--ws-current)}.ws-row.is-error .ws-title{text-decoration:line-through;opacity:.6}.ws-play{flex:none;display:grid;place-items:center;width:2.25rem;height:2.25rem;border:0;border-radius:999px;background:var(--ws-field);color:inherit;font-size:.95rem;cursor:pointer;transition:background .15s,color .15s}.ws-row:hover .ws-play{background:color-mix(in srgb,currentColor 12%,transparent)}.ws-row.is-current .ws-play{background:var(--ws-accent)}.ws-row.is-current .ws-play>*{color:var(--ws-on-accent)}.ws-play .ws-icon-pause,.ws-row.is-playing .ws-play .ws-icon-play{display:none}.ws-row.is-playing .ws-play .ws-icon-pause{display:block}.ws-play:focus-visible,.ws-chip:focus-visible,.ws-menu-btn:focus-visible,.ws-loop:focus-visible,.ws-seg-btn:focus-visible,.ws-more:focus-visible,.ws-clear:focus-visible,.ws-wave:focus-visible,.ws-download:focus-visible{outline:2px solid var(--ws-accent);outline-offset:2px}.ws-cell{min-width:0;font-size:.9em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ws-title{flex:1.4 1 9rem;display:flex;align-items:center;gap:.4rem;font-weight:500}.ws-title-text{min-width:0;overflow:hidden;text-overflow:ellipsis}.ws-loop-mark{flex:none;display:inline-flex;color:var(--ws-muted)}.ws-loop-mark .ws-icon{width:.95em;height:.95em}.ws-type{flex:1 1 6rem;color:var(--ws-muted)}.ws-bpm,.ws-key,.ws-duration{flex:none;font-family:var(--ws-mono);font-size:.82em;color:var(--ws-muted);font-variant-numeric:tabular-nums}.ws-bpm{width:3.25ch;text-align:right}.ws-key{width:3.5ch}.ws-duration{width:4.5ch;text-align:right}.ws-wave{flex:2 1 8rem;position:relative;height:var(--ws-wave-height);min-width:6rem;cursor:pointer;touch-action:pan-y;border-radius:4px}.ws-canvas{display:block;width:100%;height:100%}.ws-download{flex:none;display:grid;place-items:center;width:2.25rem;height:2.25rem;border-radius:999px;color:var(--ws-muted);font-size:1.05rem;text-decoration:none;transition:color .15s,background .15s}.ws-download:hover{color:inherit;background:var(--ws-hover)}.ws-cells{display:contents}@container (max-width: 560px){.ws-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"play title dl" "play cells cells" "play wave wave";column-gap:.85rem;row-gap:.2rem;padding:.7rem .5rem}.ws-play{grid-area:play;align-self:center}.ws-title{grid-area:title;white-space:normal;overflow-wrap:anywhere}.ws-title-text{overflow:visible}.ws-cells{grid-area:cells;display:flex;flex-wrap:wrap;align-items:baseline;gap:0 .5rem;min-width:0}.ws-cells>.ws-cell{flex:none;width:auto;text-align:left;font-size:.78em}.ws-cells>.ws-cell:empty{display:none}.ws-cells>.ws-cell:not(:empty)~.ws-cell:not(:empty):before{content:"\b7";margin-right:.5rem;opacity:.6}.ws-wave{grid-area:wave;margin-top:.35rem;min-width:0}.ws-download{grid-area:dl;align-self:start}}.ws-empty{margin:1.5rem 0;color:var(--ws-muted)}.ws-clear,.ws-more{border:1px solid var(--ws-border);border-radius:var(--ws-control-radius);background:none;color:inherit;font:inherit;cursor:pointer}.ws-clear{margin-left:.5rem;padding:.35rem .85rem;font-size:.88em}.ws-more{display:block;margin:1.25rem auto 0;padding:.7rem 1.4rem;font-size:.92em}.ws-more:hover,.ws-clear:hover{background:var(--ws-hover)}.ws-engine--strip{position:sticky;bottom:0;margin-top:1rem;padding:.75rem;border:1px solid var(--ws-border);border-radius:var(--ws-radius);background:var(--ws-strip-bg, var(--ws-surface, Canvas));z-index:1}@media(pointer:coarse){.ws-play,.ws-download{width:2.75rem;height:2.75rem}.ws-chip{height:2.5rem}.ws-search-input,.ws-menu-search,.ws-bpm-range input{font-size:16px}.ws-menu-option{padding:.75rem .6rem}}@media(prefers-reduced-motion:reduce){.ws-row,.ws-chip,.ws-play{transition:none}}
|