@arraypress/waveform-player 1.8.1 → 1.9.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 +1 -1
- package/dist/waveform-player.cjs.map +2 -2
- package/dist/waveform-player.esm.js +2 -2
- package/dist/waveform-player.esm.js.map +3 -3
- package/dist/waveform-player.js +1 -1
- package/dist/waveform-player.min.js +2 -2
- package/dist/waveform-player.min.js.map +3 -3
- package/index.d.ts +6 -0
- package/package.json +1 -1
- package/src/js/index.js +7 -4
package/index.d.ts
CHANGED
|
@@ -329,6 +329,12 @@ export declare class WaveformPlayer {
|
|
|
329
329
|
escapeHtml(str: unknown): string;
|
|
330
330
|
/** Whether a URL uses a safe (`http`/`https`/relative) scheme. */
|
|
331
331
|
isSafeHref(url: string): boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Parse every recognised `data-*` attribute off an element into a
|
|
334
|
+
* sparse options object (the player's full declarative contract).
|
|
335
|
+
* Lets wrappers inherit the complete option surface without drifting.
|
|
336
|
+
*/
|
|
337
|
+
parseDataAttributes(element: HTMLElement): Partial<WaveformPlayerOptions>;
|
|
332
338
|
};
|
|
333
339
|
}
|
|
334
340
|
|
package/package.json
CHANGED
package/src/js/index.js
CHANGED
|
@@ -12,12 +12,15 @@
|
|
|
12
12
|
|
|
13
13
|
// Import the main class
|
|
14
14
|
import {WaveformPlayer} from './core.js';
|
|
15
|
-
import {formatTime, extractTitleFromUrl, escapeHtml, isSafeHref} from './utils.js';
|
|
15
|
+
import {formatTime, extractTitleFromUrl, escapeHtml, isSafeHref, parseDataAttributes} from './utils.js';
|
|
16
16
|
|
|
17
17
|
// Expose a small set of pure helpers as a single source of truth so consumers
|
|
18
|
-
// (e.g. @arraypress/waveform-bar) can reuse them
|
|
19
|
-
//
|
|
20
|
-
|
|
18
|
+
// (e.g. @arraypress/waveform-bar, @arraypress/waveform-playlist) can reuse them
|
|
19
|
+
// instead of shipping divergent copies. `parseDataAttributes` lets wrappers read
|
|
20
|
+
// the player's full `data-*` option surface off a host element without
|
|
21
|
+
// re-implementing (and drifting from) the contract. Attached to the class so
|
|
22
|
+
// it's reachable from the IIFE global too.
|
|
23
|
+
WaveformPlayer.utils = {formatTime, extractTitleFromUrl, escapeHtml, isSafeHref, parseDataAttributes};
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* Whether we're running in a browser (vs. SSR / Node), where `window` and
|