@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.
- package/custom-elements.json +134 -60
- package/dist/components/atoms/ui-audio-next-button.js +9 -13
- package/dist/components/atoms/ui-audio-play-button.js +10 -14
- package/dist/components/atoms/ui-audio-player-error.js +10 -14
- package/dist/components/atoms/ui-audio-prev-button.js +9 -13
- package/dist/components/atoms/ui-audio-progress-slider.js +16 -20
- package/dist/components/atoms/ui-audio-time-display.js +15 -19
- package/dist/components/atoms/ui-audio-volume-slider.js +17 -21
- package/dist/components/atoms/ui-speech-cancel-button.js +5 -5
- package/dist/components/atoms/ui-speech-record-button.js +5 -5
- package/dist/components/atoms/ui-timed-text.js +14 -18
- package/dist/components/atoms/ui-voice-waveform.js +15 -19
- package/dist/components/molecules/ui-live-waveform.js +33 -32
- package/dist/components/molecules/ui-mic-selector.js +14 -18
- package/dist/components/molecules/ui-playlist.js +15 -19
- package/dist/components/molecules/ui-scrolling-waveform.js +30 -29
- package/dist/components/molecules/ui-spectrum-visualizer.js +23 -25
- package/dist/components/molecules/ui-speech-preview.js +16 -20
- package/dist/components/molecules/ui-voice-button.js +25 -29
- package/dist/components/molecules/ui-voice-picker.js +21 -25
- package/dist/components/molecules/ui-voice-pill.js +5 -5
- package/dist/components/molecules/ui-waveform.js +46 -36
- package/dist/components/organisms/ui-audio-player.js +7 -11
- package/dist/components/providers/ui-audio-provider.js +17 -22
- package/dist/components/providers/ui-speech-provider.js +13 -17
- package/dist/index.js +36 -36
- package/dist/node_modules/@chenglou/pretext/dist/analysis.js +456 -0
- package/dist/node_modules/@chenglou/pretext/dist/bidi.js +62 -0
- package/dist/node_modules/@chenglou/pretext/dist/layout.js +190 -0
- package/dist/node_modules/@chenglou/pretext/dist/line-break.js +234 -0
- package/dist/node_modules/@chenglou/pretext/dist/measurement.js +106 -0
- package/dist/scream-audio-ui.umd.js +45 -42
- package/dist/src/components/molecules/ui-waveform.d.ts +7 -1
- package/dist/src/components/providers/ui-audio-provider.d.ts +2 -1
- package/dist/src/utils/audio-context.d.ts +0 -1
- package/dist/src/utils/audio-utils.d.ts +8 -0
- package/dist/standalone/scream-audio-ui.standalone.js +2626 -1655
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/audio-utils.js +27 -16
- package/package.json +7 -4
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { audioPlayerContext as e } from "../../utils/audio-context.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}, u = class extends t {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments), this.src = "", this.items = [], this.autoAdvance = !0, this.loop = !1, this._animationFrameId = 0, this.state = {
|
|
2
|
+
import { __decorate as t } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/decorate.js";
|
|
3
|
+
import { clearCache as n } from "../../node_modules/@chenglou/pretext/dist/layout.js";
|
|
4
|
+
import { LitElement as r, css as i, html as a } from "lit";
|
|
5
|
+
import { customElement as o, property as s, query as c, state as l } from "lit/decorators.js";
|
|
6
|
+
import { provide as u } from "@lit/context";
|
|
7
|
+
var d = class extends r {
|
|
8
|
+
constructor(...e) {
|
|
9
|
+
super(...e), this.src = "", this.items = [], this.autoAdvance = !0, this._animationFrameId = 0, this.state = {
|
|
13
10
|
src: "",
|
|
14
11
|
isPlaying: !1,
|
|
15
12
|
isBuffering: !1,
|
|
@@ -17,7 +14,6 @@ var l = function(e, t, n, r) {
|
|
|
17
14
|
duration: 0,
|
|
18
15
|
volume: 1,
|
|
19
16
|
muted: !1,
|
|
20
|
-
loop: !1,
|
|
21
17
|
items: [],
|
|
22
18
|
currentIndex: -1,
|
|
23
19
|
autoAdvance: !0,
|
|
@@ -35,7 +31,7 @@ var l = function(e, t, n, r) {
|
|
|
35
31
|
};
|
|
36
32
|
}
|
|
37
33
|
static {
|
|
38
|
-
this.styles =
|
|
34
|
+
this.styles = i`
|
|
39
35
|
:host {
|
|
40
36
|
display: contents; /* We are completely invisible, just wrapping children */
|
|
41
37
|
}
|
|
@@ -44,12 +40,14 @@ var l = function(e, t, n, r) {
|
|
|
44
40
|
}
|
|
45
41
|
`;
|
|
46
42
|
}
|
|
43
|
+
clearTextCache() {
|
|
44
|
+
n();
|
|
45
|
+
}
|
|
47
46
|
render() {
|
|
48
|
-
return
|
|
47
|
+
return a`
|
|
49
48
|
<audio
|
|
50
49
|
crossorigin="anonymous"
|
|
51
50
|
src="${this.src}"
|
|
52
|
-
?loop="${this.loop}"
|
|
53
51
|
preload="metadata"
|
|
54
52
|
@loadedmetadata="${this._handleLoadedMetadata}"
|
|
55
53
|
@ended="${this._handleEnded}"
|
|
@@ -69,7 +67,7 @@ var l = function(e, t, n, r) {
|
|
|
69
67
|
src: this.src,
|
|
70
68
|
currentTime: 0,
|
|
71
69
|
error: void 0
|
|
72
|
-
}), e.has("items") && (this._updateState({ items: this.items }), this.items.length > 0 && !this.src && this.state.currentIndex === -1 && this.select(0)), e.has("autoAdvance") && this._updateState({ autoAdvance: this.autoAdvance })
|
|
70
|
+
}), e.has("items") && (this._updateState({ items: this.items }), this.items.length > 0 && !this.src && this.state.currentIndex === -1 && this.select(0)), e.has("autoAdvance") && this._updateState({ autoAdvance: this.autoAdvance });
|
|
73
71
|
}
|
|
74
72
|
updated(e) {
|
|
75
73
|
e.has("src") && this._audioEl && (this._audioEl.load(), this.state.isPlaying && setTimeout(() => {
|
|
@@ -147,10 +145,7 @@ var l = function(e, t, n, r) {
|
|
|
147
145
|
this._updateState({ duration: this._audioEl.duration });
|
|
148
146
|
}
|
|
149
147
|
_handleEnded() {
|
|
150
|
-
this.
|
|
151
|
-
bubbles: !0,
|
|
152
|
-
composed: !0
|
|
153
|
-
})), this.autoAdvance && this.items.length > 0 ? this.next() : (this._updateState({
|
|
148
|
+
this.autoAdvance && this.items.length > 0 ? this.next() : (this._updateState({
|
|
154
149
|
isPlaying: !1,
|
|
155
150
|
currentTime: 0
|
|
156
151
|
}), this._audioEl.currentTime = 0);
|
|
@@ -183,5 +178,5 @@ var l = function(e, t, n, r) {
|
|
|
183
178
|
this._animationFrameId = requestAnimationFrame(e);
|
|
184
179
|
}
|
|
185
180
|
};
|
|
186
|
-
|
|
187
|
-
export {
|
|
181
|
+
t([s({ type: String })], d.prototype, "src", void 0), t([s({ type: Array })], d.prototype, "items", void 0), t([s({ type: Boolean })], d.prototype, "autoAdvance", void 0), t([c("audio")], d.prototype, "_audioEl", void 0), t([u({ context: e }), l()], d.prototype, "state", void 0), d = t([o("ui-audio-provider")], d);
|
|
182
|
+
export { d as UiAudioProvider };
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return i > 3 && a && Object.defineProperty(t, n, a), a;
|
|
11
|
-
}, u = class extends n {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments), this._context = {
|
|
1
|
+
import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/decorate.js";
|
|
2
|
+
import { createMockAnalyser as t } from "../../utils/audio-utils.js";
|
|
3
|
+
import { speechContext as n } from "../../utils/speech-context.js";
|
|
4
|
+
import { LitElement as r, css as i, html as a } from "lit";
|
|
5
|
+
import { customElement as o, property as s, state as c } from "lit/decorators.js";
|
|
6
|
+
import { provide as l } from "@lit/context";
|
|
7
|
+
var u = class extends r {
|
|
8
|
+
constructor(...e) {
|
|
9
|
+
super(...e), this._context = {
|
|
14
10
|
state: "idle",
|
|
15
11
|
transcript: "",
|
|
16
12
|
partialTranscript: "",
|
|
@@ -30,7 +26,7 @@ var l = function(e, t, n, r) {
|
|
|
30
26
|
];
|
|
31
27
|
}
|
|
32
28
|
static {
|
|
33
|
-
this.styles =
|
|
29
|
+
this.styles = i`
|
|
34
30
|
:host {
|
|
35
31
|
display: contents;
|
|
36
32
|
}
|
|
@@ -50,7 +46,7 @@ var l = function(e, t, n, r) {
|
|
|
50
46
|
return;
|
|
51
47
|
}
|
|
52
48
|
try {
|
|
53
|
-
if (this._updateContext({ state: "connecting" }), this.simulation) this._analyser =
|
|
49
|
+
if (this._updateContext({ state: "connecting" }), this.simulation) this._analyser = t();
|
|
54
50
|
else {
|
|
55
51
|
let e = { audio: !0 };
|
|
56
52
|
this.deviceId && (e.audio = { deviceId: { exact: this.deviceId } }), this._stream = await navigator.mediaDevices.getUserMedia(e), this._audioCtx ||= new (window.AudioContext || window.webkitAudioContext)();
|
|
@@ -131,8 +127,8 @@ var l = function(e, t, n, r) {
|
|
|
131
127
|
}));
|
|
132
128
|
}
|
|
133
129
|
render() {
|
|
134
|
-
return
|
|
130
|
+
return a`<slot></slot>`;
|
|
135
131
|
}
|
|
136
132
|
};
|
|
137
|
-
|
|
133
|
+
e([l({ context: n }), c()], u.prototype, "_context", void 0), e([s({ type: String })], u.prototype, "state", void 0), e([s({ type: Boolean })], u.prototype, "simulation", void 0), e([s({ type: Boolean })], u.prototype, "manual", void 0), e([s({ type: String })], u.prototype, "transcript", void 0), e([s({ type: String })], u.prototype, "partialTranscript", void 0), e([s({ type: String })], u.prototype, "deviceId", void 0), u = e([o("ui-speech-provider")], u);
|
|
138
134
|
export { u as UiSpeechProvider };
|
package/dist/index.js
CHANGED
|
@@ -2,40 +2,40 @@ import { audioPlayerContext as e } from "./utils/audio-context.js";
|
|
|
2
2
|
import { UiAudioPlayButton as t } from "./components/atoms/ui-audio-play-button.js";
|
|
3
3
|
import { UiAudioNextButton as n } from "./components/atoms/ui-audio-next-button.js";
|
|
4
4
|
import { UiAudioPrevButton as r } from "./components/atoms/ui-audio-prev-button.js";
|
|
5
|
-
import { applyCanvasEdgeFade as i,
|
|
6
|
-
import { UiAudioProgressSlider as
|
|
7
|
-
import { UiAudioTimeDisplay as
|
|
8
|
-
import { UiAudioPlayerError as
|
|
9
|
-
import { UiTimedText as
|
|
10
|
-
import { UiAudioVolumeSlider as
|
|
11
|
-
import { speechContext as
|
|
12
|
-
import { UiSpeechRecordButton as
|
|
13
|
-
import { UiSpeechCancelButton as
|
|
14
|
-
import { UiLiveWaveform as
|
|
15
|
-
import { UiVoiceWaveform as
|
|
16
|
-
import { UiShimmeringText as
|
|
17
|
-
import { UiMessageBubble as
|
|
18
|
-
import { UiTypingDot as
|
|
19
|
-
import { UiWaveform as
|
|
20
|
-
import { UiScrollingWaveform as
|
|
21
|
-
import { UiSpectrumVisualizer as
|
|
22
|
-
import { UiMicSelector as
|
|
23
|
-
import { UiVoicePicker as
|
|
24
|
-
import { UiSpeechPreview as
|
|
25
|
-
import { UiOrb as
|
|
26
|
-
import { UiMovingGradient as
|
|
27
|
-
import { Ui3dFlip as
|
|
28
|
-
import { UiPlaylist as
|
|
29
|
-
import { UiShowcaseCard as
|
|
30
|
-
import { UiVoiceButton as
|
|
31
|
-
import { UiVoicePill as
|
|
32
|
-
import { UiSpeechProvider as
|
|
33
|
-
import { UiConversationBar as
|
|
34
|
-
import { ScreamVoiceButton as
|
|
35
|
-
import { UiTypingIndicator as
|
|
36
|
-
import { UiChatItem as
|
|
37
|
-
import { UiChatList as
|
|
38
|
-
import { UiAudioProvider as
|
|
39
|
-
import { UiAudioPlayer as
|
|
5
|
+
import { applyCanvasEdgeFade as i, computeAudioPeaks as a, createAudioAnalyser as o, createMockAnalyser as s, formatAudioTime as c, generateRandomAudioData as l, getNormalizedFrequencyData as u } from "./utils/audio-utils.js";
|
|
6
|
+
import { UiAudioProgressSlider as d } from "./components/atoms/ui-audio-progress-slider.js";
|
|
7
|
+
import { UiAudioTimeDisplay as f } from "./components/atoms/ui-audio-time-display.js";
|
|
8
|
+
import { UiAudioPlayerError as p } from "./components/atoms/ui-audio-player-error.js";
|
|
9
|
+
import { UiTimedText as m } from "./components/atoms/ui-timed-text.js";
|
|
10
|
+
import { UiAudioVolumeSlider as h } from "./components/atoms/ui-audio-volume-slider.js";
|
|
11
|
+
import { speechContext as g } from "./utils/speech-context.js";
|
|
12
|
+
import { UiSpeechRecordButton as _ } from "./components/atoms/ui-speech-record-button.js";
|
|
13
|
+
import { UiSpeechCancelButton as v } from "./components/atoms/ui-speech-cancel-button.js";
|
|
14
|
+
import { UiLiveWaveform as y } from "./components/molecules/ui-live-waveform.js";
|
|
15
|
+
import { UiVoiceWaveform as b } from "./components/atoms/ui-voice-waveform.js";
|
|
16
|
+
import { UiShimmeringText as x } from "./components/atoms/ui-shimmering-text.js";
|
|
17
|
+
import { UiMessageBubble as S } from "./components/atoms/ui-message-bubble.js";
|
|
18
|
+
import { UiTypingDot as C } from "./components/atoms/ui-typing-dot.js";
|
|
19
|
+
import { UiWaveform as w } from "./components/molecules/ui-waveform.js";
|
|
20
|
+
import { UiScrollingWaveform as T } from "./components/molecules/ui-scrolling-waveform.js";
|
|
21
|
+
import { UiSpectrumVisualizer as E } from "./components/molecules/ui-spectrum-visualizer.js";
|
|
22
|
+
import { UiMicSelector as D } from "./components/molecules/ui-mic-selector.js";
|
|
23
|
+
import { UiVoicePicker as O } from "./components/molecules/ui-voice-picker.js";
|
|
24
|
+
import { UiSpeechPreview as k } from "./components/molecules/ui-speech-preview.js";
|
|
25
|
+
import { UiOrb as A } from "./components/molecules/ui-orb.js";
|
|
26
|
+
import { UiMovingGradient as j } from "./components/molecules/ui-moving-gradient.js";
|
|
27
|
+
import { Ui3dFlip as M } from "./components/molecules/ui-3d-flip.js";
|
|
28
|
+
import { UiPlaylist as N } from "./components/molecules/ui-playlist.js";
|
|
29
|
+
import { UiShowcaseCard as P } from "./components/molecules/ui-showcase-card.js";
|
|
30
|
+
import { UiVoiceButton as F } from "./components/molecules/ui-voice-button.js";
|
|
31
|
+
import { UiVoicePill as I } from "./components/molecules/ui-voice-pill.js";
|
|
32
|
+
import { UiSpeechProvider as L } from "./components/providers/ui-speech-provider.js";
|
|
33
|
+
import { UiConversationBar as R } from "./components/molecules/ui-conversation-bar.js";
|
|
34
|
+
import { ScreamVoiceButton as z } from "./components/molecules/scream-voice-button.js";
|
|
35
|
+
import { UiTypingIndicator as B } from "./components/molecules/ui-typing-indicator.js";
|
|
36
|
+
import { UiChatItem as V } from "./components/molecules/ui-chat-item.js";
|
|
37
|
+
import { UiChatList as H } from "./components/molecules/ui-chat-list.js";
|
|
38
|
+
import { UiAudioProvider as U } from "./components/providers/ui-audio-provider.js";
|
|
39
|
+
import { UiAudioPlayer as W } from "./components/organisms/ui-audio-player.js";
|
|
40
40
|
import "@material/web/icon/icon.js";
|
|
41
|
-
export {
|
|
41
|
+
export { z as ScreamVoiceButton, M as Ui3dFlip, n as UiAudioNextButton, t as UiAudioPlayButton, W as UiAudioPlayer, p as UiAudioPlayerError, r as UiAudioPrevButton, d as UiAudioProgressSlider, U as UiAudioProvider, f as UiAudioTimeDisplay, h as UiAudioVolumeSlider, V as UiChatItem, H as UiChatList, R as UiConversationBar, y as UiLiveWaveform, S as UiMessageBubble, D as UiMicSelector, j as UiMovingGradient, A as UiOrb, N as UiPlaylist, T as UiScrollingWaveform, x as UiShimmeringText, P as UiShowcaseCard, E as UiSpectrumVisualizer, v as UiSpeechCancelButton, k as UiSpeechPreview, L as UiSpeechProvider, _ as UiSpeechRecordButton, m as UiTimedText, C as UiTypingDot, B as UiTypingIndicator, F as UiVoiceButton, O as UiVoicePicker, I as UiVoicePill, b as UiVoiceWaveform, w as UiWaveform, i as applyCanvasEdgeFade, e as audioPlayerContext, a as computeAudioPeaks, o as createAudioAnalyser, s as createMockAnalyser, c as formatAudioTime, l as generateRandomAudioData, u as getNormalizedFrequencyData, g as speechContext };
|