@arraypress/waveform-player 1.10.0 → 1.11.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 +14 -6
- package/dist/waveform-player.cjs.map +2 -2
- package/dist/waveform-player.css +1 -1
- package/dist/waveform-player.esm.js +4 -4
- package/dist/waveform-player.esm.js.map +3 -3
- package/dist/waveform-player.js +14 -6
- package/dist/waveform-player.min.js +4 -4
- package/dist/waveform-player.min.js.map +3 -3
- package/index.d.ts +6 -0
- package/package.json +1 -1
- package/src/css/waveform-player.css +22 -0
- package/src/js/core.js +1 -1
- package/src/js/themes.js +12 -5
- package/src/js/utils.js +1 -0
package/dist/waveform-player.cjs
CHANGED
|
@@ -86,6 +86,7 @@ function parseDataAttributes(element) {
|
|
|
86
86
|
setNum("barRadius");
|
|
87
87
|
if (element.dataset.buttonAlign) options.buttonAlign = element.dataset.buttonAlign;
|
|
88
88
|
if (element.dataset.layout) options.layout = element.dataset.layout;
|
|
89
|
+
if (element.dataset.buttonStyle) options.buttonStyle = element.dataset.buttonStyle;
|
|
89
90
|
if (element.dataset.colorPreset) options.colorPreset = element.dataset.colorPreset;
|
|
90
91
|
if (element.dataset.waveformColor) options.waveformColor = parseColorValue(element.dataset.waveformColor);
|
|
91
92
|
if (element.dataset.progressColor) options.progressColor = parseColorValue(element.dataset.progressColor);
|
|
@@ -682,8 +683,11 @@ function getColorPreset(presetName) {
|
|
|
682
683
|
var DEFAULT_OPTIONS = {
|
|
683
684
|
// Core settings
|
|
684
685
|
url: "",
|
|
685
|
-
height:
|
|
686
|
-
|
|
686
|
+
height: 64,
|
|
687
|
+
// Source peak resolution. The drawer resamples these to fit
|
|
688
|
+
// canvasWidth / (barWidth + barSpacing) bars, so this is fidelity headroom,
|
|
689
|
+
// not the visible bar count.
|
|
690
|
+
samples: 256,
|
|
687
691
|
preload: "metadata",
|
|
688
692
|
// Audio mode — 'self' = player owns the <audio> element (default, current
|
|
689
693
|
// behavior). 'external' = player is a visualization-only surface; no audio
|
|
@@ -702,12 +706,16 @@ var DEFAULT_OPTIONS = {
|
|
|
702
706
|
// waveform and the meta row (time / speed / BPM) is trimmed — ideal for
|
|
703
707
|
// sample-pack sample previews and dense grids.
|
|
704
708
|
layout: "default",
|
|
709
|
+
// Play/pause button style. 'circle' = bordered circle (default).
|
|
710
|
+
// 'minimal' = a bare play/pause glyph with no circle — the look sample-pack
|
|
711
|
+
// and beat stores use in their preview grids.
|
|
712
|
+
buttonStyle: "circle",
|
|
705
713
|
// Default waveform style
|
|
706
714
|
waveformStyle: "mirror",
|
|
707
715
|
barWidth: 2,
|
|
708
716
|
barSpacing: 0,
|
|
709
|
-
// Rounded bar caps (px). 0 = square (default). Applies to bars/mirror.
|
|
710
|
-
barRadius:
|
|
717
|
+
// Rounded bar caps (px). 0 = square; 1 = soft caps (default). Applies to bars/mirror.
|
|
718
|
+
barRadius: 1,
|
|
711
719
|
// Color preset: null = auto-detect, 'dark' = force dark, 'light' = force light
|
|
712
720
|
colorPreset: null,
|
|
713
721
|
// Individual color overrides (null means use preset)
|
|
@@ -758,7 +766,7 @@ var DEFAULT_OPTIONS = {
|
|
|
758
766
|
};
|
|
759
767
|
var STYLE_DEFAULTS = {
|
|
760
768
|
bars: { barWidth: 3, barSpacing: 1 },
|
|
761
|
-
mirror: { barWidth: 2, barSpacing:
|
|
769
|
+
mirror: { barWidth: 2, barSpacing: 2 },
|
|
762
770
|
line: { barWidth: 2, barSpacing: 0 },
|
|
763
771
|
blocks: { barWidth: 4, barSpacing: 2 },
|
|
764
772
|
dots: { barWidth: 3, barSpacing: 3 },
|
|
@@ -925,7 +933,7 @@ var WaveformPlayer = class _WaveformPlayer {
|
|
|
925
933
|
this.container.classList.add("waveform-layout-preview");
|
|
926
934
|
}
|
|
927
935
|
const buttonHTML = this.options.showControls ? `
|
|
928
|
-
<button class="waveform-btn" aria-label="Play/Pause" style="
|
|
936
|
+
<button class="waveform-btn${this.options.buttonStyle === "minimal" ? " waveform-btn-minimal" : ""}" aria-label="Play/Pause" style="
|
|
929
937
|
border-color: ${this.options.buttonColor};
|
|
930
938
|
color: ${this.options.buttonColor};
|
|
931
939
|
">
|