@arraypress/waveform-player 1.17.0 → 1.19.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 +15 -250
- package/dist/waveform-player.cjs +148 -107
- package/dist/waveform-player.cjs.map +2 -2
- package/dist/waveform-player.css +1 -1
- package/dist/waveform-player.esm.js +12 -16
- package/dist/waveform-player.esm.js.map +3 -3
- package/dist/waveform-player.js +148 -107
- package/dist/waveform-player.min.js +12 -16
- package/dist/waveform-player.min.js.map +3 -3
- package/index.d.ts +12 -11
- package/package.json +1 -1
- package/src/css/waveform-player.css +21 -3
- package/src/js/core.js +120 -62
- package/src/js/drawing.js +43 -23
- package/src/js/themes.js +19 -23
- package/src/js/utils.js +2 -7
package/src/js/themes.js
CHANGED
|
@@ -93,23 +93,11 @@ export function detectColorScheme() {
|
|
|
93
93
|
export const COLOR_PRESETS = {
|
|
94
94
|
dark: {
|
|
95
95
|
waveformColor: 'rgba(255, 255, 255, 0.3)',
|
|
96
|
-
progressColor: 'rgba(255, 255, 255, 0.9)'
|
|
97
|
-
buttonColor: 'rgba(255, 255, 255, 0.9)',
|
|
98
|
-
buttonHoverColor: 'rgba(255, 255, 255, 1)',
|
|
99
|
-
textColor: '#ffffff',
|
|
100
|
-
textSecondaryColor: 'rgba(255, 255, 255, 0.6)',
|
|
101
|
-
backgroundColor: 'rgba(255, 255, 255, 0.03)',
|
|
102
|
-
borderColor: 'rgba(255, 255, 255, 0.1)'
|
|
96
|
+
progressColor: 'rgba(255, 255, 255, 0.9)'
|
|
103
97
|
},
|
|
104
98
|
light: {
|
|
105
99
|
waveformColor: 'rgba(0, 0, 0, 0.2)',
|
|
106
|
-
progressColor: 'rgba(0, 0, 0, 0.8)'
|
|
107
|
-
buttonColor: 'rgba(0, 0, 0, 0.8)',
|
|
108
|
-
buttonHoverColor: 'rgba(0, 0, 0, 0.9)',
|
|
109
|
-
textColor: '#333333',
|
|
110
|
-
textSecondaryColor: 'rgba(0, 0, 0, 0.6)',
|
|
111
|
-
backgroundColor: 'rgba(0, 0, 0, 0.02)',
|
|
112
|
-
borderColor: 'rgba(0, 0, 0, 0.1)'
|
|
100
|
+
progressColor: 'rgba(0, 0, 0, 0.8)'
|
|
113
101
|
}
|
|
114
102
|
};
|
|
115
103
|
|
|
@@ -196,18 +184,20 @@ export const DEFAULT_OPTIONS = {
|
|
|
196
184
|
// Rounded bar caps (px). 0 = square; 1 = soft caps (default). Applies to bars/mirror.
|
|
197
185
|
barRadius: 1,
|
|
198
186
|
|
|
187
|
+
// Gradient axis when waveformColor/progressColor is an array of stops:
|
|
188
|
+
// 'vertical' (top->bottom canvas gradient), 'horizontal' (hue sweep across the
|
|
189
|
+
// waveform) or 'diagonal'. Ignored for single colours.
|
|
190
|
+
waveformGradient: 'vertical',
|
|
191
|
+
|
|
199
192
|
// Color preset: null = auto-detect, 'dark' = force dark, 'light' = force light
|
|
200
193
|
colorPreset: null,
|
|
201
194
|
|
|
202
|
-
//
|
|
195
|
+
// Canvas colours (null = inherit the resolved preset; arrays = gradient
|
|
196
|
+
// stops, see waveformGradient). The DOM chrome (button, title, meta) is
|
|
197
|
+
// themed via CSS variables (--wfp-button-color / --wfp-text-color /
|
|
198
|
+
// --wfp-text-secondary-color), not JS options.
|
|
203
199
|
waveformColor: null,
|
|
204
200
|
progressColor: null,
|
|
205
|
-
buttonColor: null,
|
|
206
|
-
buttonHoverColor: null,
|
|
207
|
-
textColor: null,
|
|
208
|
-
textSecondaryColor: null,
|
|
209
|
-
backgroundColor: null,
|
|
210
|
-
borderColor: null,
|
|
211
201
|
|
|
212
202
|
// Features
|
|
213
203
|
autoplay: false,
|
|
@@ -241,7 +231,7 @@ export const DEFAULT_OPTIONS = {
|
|
|
241
231
|
|
|
242
232
|
// Content
|
|
243
233
|
title: null,
|
|
244
|
-
|
|
234
|
+
artist: null,
|
|
245
235
|
artwork: null,
|
|
246
236
|
album: '',
|
|
247
237
|
|
|
@@ -258,7 +248,13 @@ export const DEFAULT_OPTIONS = {
|
|
|
258
248
|
onPause: null,
|
|
259
249
|
onEnd: null,
|
|
260
250
|
onError: null,
|
|
261
|
-
onTimeUpdate: null
|
|
251
|
+
onTimeUpdate: null,
|
|
252
|
+
|
|
253
|
+
// Optional queue navigation — when set, the player registers Media Session
|
|
254
|
+
// nexttrack/previoustrack handlers (lock-screen skip buttons). Called with
|
|
255
|
+
// the player instance; wired by waveform-bar / -playlist.
|
|
256
|
+
onNextTrack: null,
|
|
257
|
+
onPreviousTrack: null
|
|
262
258
|
};
|
|
263
259
|
|
|
264
260
|
/**
|
package/src/js/utils.js
CHANGED
|
@@ -157,6 +157,7 @@ export function parseDataAttributes(element) {
|
|
|
157
157
|
// `data-waveform-style`; the canonical long form wins if both are set.
|
|
158
158
|
if (element.dataset.style) options.waveformStyle = element.dataset.style;
|
|
159
159
|
if (element.dataset.waveformStyle) options.waveformStyle = element.dataset.waveformStyle;
|
|
160
|
+
if (element.dataset.waveformGradient) options.waveformGradient = element.dataset.waveformGradient;
|
|
160
161
|
setNum('barWidth');
|
|
161
162
|
setNum('barSpacing');
|
|
162
163
|
setNum('barRadius');
|
|
@@ -176,12 +177,6 @@ export function parseDataAttributes(element) {
|
|
|
176
177
|
// Individual color customization
|
|
177
178
|
if (element.dataset.waveformColor) options.waveformColor = parseColorValue(element.dataset.waveformColor);
|
|
178
179
|
if (element.dataset.progressColor) options.progressColor = parseColorValue(element.dataset.progressColor);
|
|
179
|
-
if (element.dataset.buttonColor) options.buttonColor = element.dataset.buttonColor;
|
|
180
|
-
if (element.dataset.buttonHoverColor) options.buttonHoverColor = element.dataset.buttonHoverColor;
|
|
181
|
-
if (element.dataset.textColor) options.textColor = element.dataset.textColor;
|
|
182
|
-
if (element.dataset.textSecondaryColor) options.textSecondaryColor = element.dataset.textSecondaryColor;
|
|
183
|
-
if (element.dataset.backgroundColor) options.backgroundColor = element.dataset.backgroundColor;
|
|
184
|
-
if (element.dataset.borderColor) options.borderColor = element.dataset.borderColor;
|
|
185
180
|
|
|
186
181
|
// Legacy support for old attribute names
|
|
187
182
|
if (element.dataset.color) options.waveformColor = element.dataset.color;
|
|
@@ -201,7 +196,7 @@ export function parseDataAttributes(element) {
|
|
|
201
196
|
|
|
202
197
|
// Content and metadata
|
|
203
198
|
if (element.dataset.title) options.title = element.dataset.title;
|
|
204
|
-
if (element.dataset.
|
|
199
|
+
if (element.dataset.artist) options.artist = element.dataset.artist;
|
|
205
200
|
if (element.dataset.album) options.album = element.dataset.album;
|
|
206
201
|
if (element.dataset.artwork) options.artwork = element.dataset.artwork;
|
|
207
202
|
|