@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/index.d.ts
CHANGED
|
@@ -133,6 +133,12 @@ export interface WaveformPlayerOptions {
|
|
|
133
133
|
* @default 'default'
|
|
134
134
|
*/
|
|
135
135
|
layout?: 'default' | 'preview';
|
|
136
|
+
/**
|
|
137
|
+
* Play/pause button style. `'minimal'` renders a bare glyph with no circle —
|
|
138
|
+
* the look sample-pack and beat stores use in preview grids.
|
|
139
|
+
* @default 'circle'
|
|
140
|
+
*/
|
|
141
|
+
buttonStyle?: 'circle' | 'minimal';
|
|
136
142
|
/** Show transport controls. @default true */
|
|
137
143
|
showControls?: boolean;
|
|
138
144
|
/** Show the info (title/subtitle) block. @default true */
|
package/package.json
CHANGED
|
@@ -51,6 +51,28 @@
|
|
|
51
51
|
transform: scale(1.05);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/* Minimal button style — a bare play/pause glyph with no circle. Set via
|
|
55
|
+
`buttonStyle: 'minimal'` / data-button-style="minimal". Ideal for sample-pack
|
|
56
|
+
and beat-store preview grids. */
|
|
57
|
+
.waveform-btn-minimal {
|
|
58
|
+
width: auto;
|
|
59
|
+
height: auto;
|
|
60
|
+
min-width: 0;
|
|
61
|
+
border: none;
|
|
62
|
+
border-radius: 0;
|
|
63
|
+
opacity: 0.7;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.waveform-btn-minimal:hover:not(:disabled) {
|
|
67
|
+
opacity: 1;
|
|
68
|
+
transform: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.waveform-btn-minimal svg {
|
|
72
|
+
width: 22px;
|
|
73
|
+
height: 22px;
|
|
74
|
+
}
|
|
75
|
+
|
|
54
76
|
.waveform-btn:disabled {
|
|
55
77
|
cursor: not-allowed;
|
|
56
78
|
opacity: 0.3;
|
package/src/js/core.js
CHANGED
|
@@ -233,7 +233,7 @@ export class WaveformPlayer {
|
|
|
233
233
|
|
|
234
234
|
// Build play button HTML (conditional)
|
|
235
235
|
const buttonHTML = this.options.showControls ? `
|
|
236
|
-
<button class="waveform-btn" aria-label="Play/Pause" style="
|
|
236
|
+
<button class="waveform-btn${this.options.buttonStyle === 'minimal' ? ' waveform-btn-minimal' : ''}" aria-label="Play/Pause" style="
|
|
237
237
|
border-color: ${this.options.buttonColor};
|
|
238
238
|
color: ${this.options.buttonColor};
|
|
239
239
|
">
|
package/src/js/themes.js
CHANGED
|
@@ -151,8 +151,11 @@ export function getColorPreset(presetName) {
|
|
|
151
151
|
export const DEFAULT_OPTIONS = {
|
|
152
152
|
// Core settings
|
|
153
153
|
url: '',
|
|
154
|
-
height:
|
|
155
|
-
|
|
154
|
+
height: 64,
|
|
155
|
+
// Source peak resolution. The drawer resamples these to fit
|
|
156
|
+
// canvasWidth / (barWidth + barSpacing) bars, so this is fidelity headroom,
|
|
157
|
+
// not the visible bar count.
|
|
158
|
+
samples: 256,
|
|
156
159
|
preload: 'metadata',
|
|
157
160
|
|
|
158
161
|
// Audio mode — 'self' = player owns the <audio> element (default, current
|
|
@@ -174,13 +177,17 @@ export const DEFAULT_OPTIONS = {
|
|
|
174
177
|
// waveform and the meta row (time / speed / BPM) is trimmed — ideal for
|
|
175
178
|
// sample-pack sample previews and dense grids.
|
|
176
179
|
layout: 'default',
|
|
180
|
+
// Play/pause button style. 'circle' = bordered circle (default).
|
|
181
|
+
// 'minimal' = a bare play/pause glyph with no circle — the look sample-pack
|
|
182
|
+
// and beat stores use in their preview grids.
|
|
183
|
+
buttonStyle: 'circle',
|
|
177
184
|
|
|
178
185
|
// Default waveform style
|
|
179
186
|
waveformStyle: 'mirror',
|
|
180
187
|
barWidth: 2,
|
|
181
188
|
barSpacing: 0,
|
|
182
|
-
// Rounded bar caps (px). 0 = square (default). Applies to bars/mirror.
|
|
183
|
-
barRadius:
|
|
189
|
+
// Rounded bar caps (px). 0 = square; 1 = soft caps (default). Applies to bars/mirror.
|
|
190
|
+
barRadius: 1,
|
|
184
191
|
|
|
185
192
|
// Color preset: null = auto-detect, 'dark' = force dark, 'light' = force light
|
|
186
193
|
colorPreset: null,
|
|
@@ -250,7 +257,7 @@ export const DEFAULT_OPTIONS = {
|
|
|
250
257
|
*/
|
|
251
258
|
export const STYLE_DEFAULTS = {
|
|
252
259
|
bars: {barWidth: 3, barSpacing: 1},
|
|
253
|
-
mirror: {barWidth: 2, barSpacing:
|
|
260
|
+
mirror: {barWidth: 2, barSpacing: 2},
|
|
254
261
|
line: {barWidth: 2, barSpacing: 0},
|
|
255
262
|
blocks: {barWidth: 4, barSpacing: 2},
|
|
256
263
|
dots: {barWidth: 3, barSpacing: 3},
|
package/src/js/utils.js
CHANGED
|
@@ -138,6 +138,7 @@ export function parseDataAttributes(element) {
|
|
|
138
138
|
setNum('barRadius');
|
|
139
139
|
if (element.dataset.buttonAlign) options.buttonAlign = element.dataset.buttonAlign;
|
|
140
140
|
if (element.dataset.layout) options.layout = element.dataset.layout;
|
|
141
|
+
if (element.dataset.buttonStyle) options.buttonStyle = element.dataset.buttonStyle;
|
|
141
142
|
|
|
142
143
|
// Color preset
|
|
143
144
|
if (element.dataset.colorPreset) options.colorPreset = element.dataset.colorPreset;
|