@ghchinoy/lit-audio-ui 0.5.1 → 0.6.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.
Files changed (40) hide show
  1. package/custom-elements.json +134 -60
  2. package/dist/components/atoms/ui-audio-next-button.js +9 -13
  3. package/dist/components/atoms/ui-audio-play-button.js +10 -14
  4. package/dist/components/atoms/ui-audio-player-error.js +10 -14
  5. package/dist/components/atoms/ui-audio-prev-button.js +9 -13
  6. package/dist/components/atoms/ui-audio-progress-slider.js +16 -20
  7. package/dist/components/atoms/ui-audio-time-display.js +15 -19
  8. package/dist/components/atoms/ui-audio-volume-slider.js +17 -21
  9. package/dist/components/atoms/ui-speech-cancel-button.js +5 -5
  10. package/dist/components/atoms/ui-speech-record-button.js +5 -5
  11. package/dist/components/atoms/ui-timed-text.js +14 -18
  12. package/dist/components/atoms/ui-voice-waveform.js +15 -19
  13. package/dist/components/molecules/ui-live-waveform.js +33 -32
  14. package/dist/components/molecules/ui-mic-selector.js +14 -18
  15. package/dist/components/molecules/ui-playlist.js +15 -19
  16. package/dist/components/molecules/ui-scrolling-waveform.js +30 -29
  17. package/dist/components/molecules/ui-spectrum-visualizer.js +23 -25
  18. package/dist/components/molecules/ui-speech-preview.js +16 -20
  19. package/dist/components/molecules/ui-voice-button.js +25 -29
  20. package/dist/components/molecules/ui-voice-picker.js +21 -25
  21. package/dist/components/molecules/ui-voice-pill.js +5 -5
  22. package/dist/components/molecules/ui-waveform.js +46 -36
  23. package/dist/components/organisms/ui-audio-player.js +7 -11
  24. package/dist/components/providers/ui-audio-provider.js +17 -22
  25. package/dist/components/providers/ui-speech-provider.js +13 -17
  26. package/dist/index.js +36 -36
  27. package/dist/node_modules/@chenglou/pretext/dist/analysis.js +456 -0
  28. package/dist/node_modules/@chenglou/pretext/dist/bidi.js +62 -0
  29. package/dist/node_modules/@chenglou/pretext/dist/layout.js +190 -0
  30. package/dist/node_modules/@chenglou/pretext/dist/line-break.js +234 -0
  31. package/dist/node_modules/@chenglou/pretext/dist/measurement.js +106 -0
  32. package/dist/scream-audio-ui.umd.js +45 -42
  33. package/dist/src/components/molecules/ui-waveform.d.ts +7 -1
  34. package/dist/src/components/providers/ui-audio-provider.d.ts +2 -1
  35. package/dist/src/utils/audio-context.d.ts +0 -1
  36. package/dist/src/utils/audio-utils.d.ts +8 -0
  37. package/dist/standalone/scream-audio-ui.standalone.js +2626 -1655
  38. package/dist/tsconfig.tsbuildinfo +1 -1
  39. package/dist/utils/audio-utils.js +27 -16
  40. package/package.json +7 -4
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { LitElement, type PropertyValues } from 'lit';
17
17
  export declare class UiWaveform extends LitElement {
18
+ src?: string;
18
19
  data: number[];
19
20
  peaks?: number[];
20
21
  barWidth: number;
@@ -26,13 +27,18 @@ export declare class UiWaveform extends LitElement {
26
27
  fadeEdges: boolean;
27
28
  fadeWidth: number;
28
29
  height?: number | string;
30
+ overlayText?: string;
31
+ overlayFont: string;
32
+ overlayColor: string;
33
+ private _computedPeaks;
34
+ private _preparedOverlayText;
29
35
  private _canvas;
30
36
  private _container;
31
37
  private _resizeObserver?;
32
38
  static styles: import("lit").CSSResult;
33
39
  render(): import("lit-html").TemplateResult<1>;
34
40
  firstUpdated(): void;
35
- updated(changedProperties: PropertyValues): void;
41
+ updated(changedProperties: PropertyValues): Promise<void>;
36
42
  disconnectedCallback(): void;
37
43
  private _handleResize;
38
44
  private _renderWaveform;
@@ -9,7 +9,6 @@ export declare class UiAudioProvider extends LitElement {
9
9
  src: string;
10
10
  items: PlaylistTrack[];
11
11
  autoAdvance: boolean;
12
- loop: boolean;
13
12
  private _audioEl;
14
13
  private _audioContext?;
15
14
  private _analyserNode?;
@@ -17,6 +16,7 @@ export declare class UiAudioProvider extends LitElement {
17
16
  private _animationFrameId;
18
17
  state: AudioPlayerState;
19
18
  static styles: import("lit").CSSResult;
19
+ clearTextCache(): void;
20
20
  render(): import("lit-html").TemplateResult<1>;
21
21
  willUpdate(changed: Map<string, any>): void;
22
22
  updated(changed: Map<string, any>): void;
@@ -50,6 +50,7 @@ export interface AudioProviderElement extends HTMLElement {
50
50
  next(): void;
51
51
  previous(): void;
52
52
  select(index: number): void;
53
+ clearTextCache(): void;
53
54
  }
54
55
  declare global {
55
56
  interface HTMLElementTagNameMap {
@@ -29,7 +29,6 @@ export interface AudioPlayerState {
29
29
  duration: number;
30
30
  volume: number;
31
31
  muted: boolean;
32
- loop: boolean;
33
32
  error?: string;
34
33
  transcript?: TranscriptWord[];
35
34
  items: PlaylistTrack[];
@@ -75,3 +75,11 @@ export declare function applyCanvasEdgeFade(ctx: CanvasRenderingContext2D, width
75
75
  * @param compact If true, omits leading zeros for minutes if under an hour.
76
76
  */
77
77
  export declare function formatAudioTime(seconds: number): string;
78
+ /**
79
+ * Computes an array of normalized RMS peaks from an audio URL using the Web Audio API.
80
+ *
81
+ * @param audioUrl The URL of the audio file.
82
+ * @param numPeaks The number of peaks to generate.
83
+ * @returns Array of normalized floats between 0.1 and 1.0.
84
+ */
85
+ export declare function computeAudioPeaks(audioUrl: string, numPeaks?: number): Promise<number[]>;