@arraypress/waveform-player 1.8.1 → 1.10.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/dist/waveform-player.cjs +12 -2
- package/dist/waveform-player.cjs.map +2 -2
- package/dist/waveform-player.css +1 -1
- package/dist/waveform-player.esm.js +7 -7
- package/dist/waveform-player.esm.js.map +3 -3
- package/dist/waveform-player.js +12 -2
- package/dist/waveform-player.min.js +7 -7
- package/dist/waveform-player.min.js.map +3 -3
- package/index.d.ts +12 -0
- package/package.json +1 -1
- package/src/css/waveform-player.css +25 -4
- package/src/js/core.js +8 -1
- package/src/js/index.js +7 -4
- package/src/js/themes.js +5 -0
- package/src/js/utils.js +1 -0
package/dist/waveform-player.cjs
CHANGED
|
@@ -85,6 +85,7 @@ function parseDataAttributes(element) {
|
|
|
85
85
|
setNum("barSpacing");
|
|
86
86
|
setNum("barRadius");
|
|
87
87
|
if (element.dataset.buttonAlign) options.buttonAlign = element.dataset.buttonAlign;
|
|
88
|
+
if (element.dataset.layout) options.layout = element.dataset.layout;
|
|
88
89
|
if (element.dataset.colorPreset) options.colorPreset = element.dataset.colorPreset;
|
|
89
90
|
if (element.dataset.waveformColor) options.waveformColor = parseColorValue(element.dataset.waveformColor);
|
|
90
91
|
if (element.dataset.progressColor) options.progressColor = parseColorValue(element.dataset.progressColor);
|
|
@@ -696,6 +697,11 @@ var DEFAULT_OPTIONS = {
|
|
|
696
697
|
playbackRates: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2],
|
|
697
698
|
// Layout Options
|
|
698
699
|
buttonAlign: "auto",
|
|
700
|
+
// Player layout. 'default' = play button + waveform with a left-aligned
|
|
701
|
+
// info row below. 'preview' = compact: the title is centered under the
|
|
702
|
+
// waveform and the meta row (time / speed / BPM) is trimmed — ideal for
|
|
703
|
+
// sample-pack sample previews and dense grids.
|
|
704
|
+
layout: "default",
|
|
699
705
|
// Default waveform style
|
|
700
706
|
waveformStyle: "mirror",
|
|
701
707
|
barWidth: 2,
|
|
@@ -914,6 +920,10 @@ var WaveformPlayer = class _WaveformPlayer {
|
|
|
914
920
|
buttonAlign = "center";
|
|
915
921
|
}
|
|
916
922
|
}
|
|
923
|
+
const isPreview = this.options.layout === "preview";
|
|
924
|
+
if (isPreview) {
|
|
925
|
+
this.container.classList.add("waveform-layout-preview");
|
|
926
|
+
}
|
|
917
927
|
const buttonHTML = this.options.showControls ? `
|
|
918
928
|
<button class="waveform-btn" aria-label="Play/Pause" style="
|
|
919
929
|
border-color: ${this.options.buttonColor};
|
|
@@ -938,7 +948,7 @@ var WaveformPlayer = class _WaveformPlayer {
|
|
|
938
948
|
<span class="waveform-title" style="color: ${this.options.textColor};"></span>
|
|
939
949
|
${this.options.subtitle ? `<span class="waveform-subtitle" style="color: ${this.options.textSecondaryColor};">${this.options.subtitle}</span>` : ""}
|
|
940
950
|
</div>
|
|
941
|
-
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
951
|
+
<div class="waveform-meta" style="display: flex; align-items: center; gap: 1rem;">
|
|
942
952
|
${this.options.showBPM ? `
|
|
943
953
|
<span class="waveform-bpm" style="color: ${this.options.textSecondaryColor}; display: none;">
|
|
944
954
|
<span class="bpm-value">--</span> BPM
|
|
@@ -2179,7 +2189,7 @@ var WaveformPlayer = class _WaveformPlayer {
|
|
|
2179
2189
|
};
|
|
2180
2190
|
|
|
2181
2191
|
// src/js/index.js
|
|
2182
|
-
WaveformPlayer.utils = { formatTime, extractTitleFromUrl, escapeHtml, isSafeHref };
|
|
2192
|
+
WaveformPlayer.utils = { formatTime, extractTitleFromUrl, escapeHtml, isSafeHref, parseDataAttributes };
|
|
2183
2193
|
var isBrowser = () => typeof window !== "undefined" && typeof document !== "undefined";
|
|
2184
2194
|
function autoInit() {
|
|
2185
2195
|
if (!isBrowser()) return;
|