@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/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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arraypress/waveform-player",
3
- "version": "1.8.1",
3
+ "version": "1.9.0",
4
4
  "description": "Lightweight, customizable audio player with waveform visualization",
5
5
  "type": "module",
6
6
  "types": "./index.d.ts",
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 instead of shipping divergent
19
- // copies. Attached to the class so it's reachable from the IIFE global too.
20
- WaveformPlayer.utils = {formatTime, extractTitleFromUrl, escapeHtml, isSafeHref};
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