@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
@@ -1,21 +1,17 @@
1
1
  import { audioPlayerContext as e } from "../../utils/audio-context.js";
2
+ import { __decorate as t } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/decorate.js";
2
3
  import "@material/web/icon/icon.js";
3
- import { LitElement as t, css as n, html as r } from "lit";
4
- import { customElement as i, property as a } from "lit/decorators.js";
5
- import { consume as o } from "@lit/context";
4
+ import { LitElement as n, css as r, html as i } from "lit";
5
+ import { customElement as a, property as o } from "lit/decorators.js";
6
+ import { consume as s } from "@lit/context";
6
7
  import "@material/web/iconbutton/icon-button.js";
7
8
  import "@material/web/slider/slider.js";
8
- var s = function(e, t, n, r) {
9
- var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
10
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
11
- else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
12
- return i > 3 && a && Object.defineProperty(t, n, a), a;
13
- }, c = class extends t {
14
- constructor() {
15
- super(...arguments), this.variant = "inline", this._isOpen = !1;
9
+ var c = class extends n {
10
+ constructor(...e) {
11
+ super(...e), this.variant = "inline", this._isOpen = !1;
16
12
  }
17
13
  static {
18
- this.styles = n`
14
+ this.styles = r`
19
15
  :host([variant="popover"]) {
20
16
  display: inline-block;
21
17
  width: auto;
@@ -105,8 +101,8 @@ var s = function(e, t, n, r) {
105
101
  render() {
106
102
  let e = this.playerState?.volume ?? 1, t = this.playerState?.muted ?? !1, n = "volume_up";
107
103
  t || e === 0 ? n = "volume_off" : e < .5 && (n = "volume_down");
108
- let i = t ? "Unmute audio" : "Mute audio";
109
- return this.variant === "popover" ? r`
104
+ let r = t ? "Unmute audio" : "Mute audio";
105
+ return this.variant === "popover" ? i`
110
106
  <div
111
107
  @mouseenter="${() => this._isOpen = !0}"
112
108
  @mouseleave="${() => this._isOpen = !1}"
@@ -115,7 +111,7 @@ var s = function(e, t, n, r) {
115
111
  <md-icon-button
116
112
  @click="${this._toggleMute}"
117
113
  part="button"
118
- aria-label="${i}"
114
+ aria-label="${r}"
119
115
  >
120
116
  <md-icon>${n}</md-icon>
121
117
  </md-icon-button>
@@ -133,11 +129,11 @@ var s = function(e, t, n, r) {
133
129
  </div>
134
130
  </div>
135
131
  </div>
136
- ` : r`
132
+ ` : i`
137
133
  <md-icon-button
138
134
  @click="${this._toggleMute}"
139
135
  part="button"
140
- aria-label="${i}"
136
+ aria-label="${r}"
141
137
  >
142
138
  <md-icon>${n}</md-icon>
143
139
  </md-icon-button>
@@ -161,14 +157,14 @@ var s = function(e, t, n, r) {
161
157
  this.playerState && this.playerState.toggleMute();
162
158
  }
163
159
  };
164
- s([o({
160
+ t([s({
165
161
  context: e,
166
162
  subscribe: !0
167
- }), a({ attribute: !1 })], c.prototype, "playerState", void 0), s([a({
163
+ }), o({ attribute: !1 })], c.prototype, "playerState", void 0), t([o({
168
164
  type: String,
169
165
  reflect: !0
170
- })], c.prototype, "variant", void 0), s([a({
166
+ })], c.prototype, "variant", void 0), t([o({
171
167
  type: Boolean,
172
168
  state: !0
173
- })], c.prototype, "_isOpen", void 0), c = s([i("ui-audio-volume-slider")], c);
169
+ })], c.prototype, "_isOpen", void 0), c = t([a("ui-audio-volume-slider")], c);
174
170
  export { c as UiAudioVolumeSlider };
@@ -1,5 +1,5 @@
1
- import { speechContext as e } from "../../utils/speech-context.js";
2
- import { __decorate as t } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/decorate.js";
1
+ import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/decorate.js";
2
+ import { speechContext as t } from "../../utils/speech-context.js";
3
3
  import "@material/web/icon/icon.js";
4
4
  import { LitElement as n, css as r, html as i } from "lit";
5
5
  import { customElement as a } from "lit/decorators.js";
@@ -40,8 +40,8 @@ var s = class extends n {
40
40
  this._context?.cancel();
41
41
  }
42
42
  };
43
- t([o({
44
- context: e,
43
+ e([o({
44
+ context: t,
45
45
  subscribe: !0
46
- })], s.prototype, "_context", void 0), s = t([a("ui-speech-cancel-button")], s);
46
+ })], s.prototype, "_context", void 0), s = e([a("ui-speech-cancel-button")], s);
47
47
  export { s as UiSpeechCancelButton };
@@ -1,5 +1,5 @@
1
- import { speechContext as e } from "../../utils/speech-context.js";
2
- import { __decorate as t } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/decorate.js";
1
+ import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/decorate.js";
2
+ import { speechContext as t } from "../../utils/speech-context.js";
3
3
  import "@material/web/icon/icon.js";
4
4
  import { LitElement as n, css as r, html as i } from "lit";
5
5
  import { customElement as a, property as o } from "lit/decorators.js";
@@ -77,8 +77,8 @@ var c = class extends n {
77
77
  this._context && (this._context.state === "idle" ? this._context.start() : this._context.state === "recording" && this._context.stop());
78
78
  }
79
79
  };
80
- t([s({
81
- context: e,
80
+ e([s({
81
+ context: t,
82
82
  subscribe: !0
83
- })], c.prototype, "_context", void 0), t([o({ type: String })], c.prototype, "size", void 0), c = t([a("ui-speech-record-button")], c);
83
+ })], c.prototype, "_context", void 0), e([o({ type: String })], c.prototype, "size", void 0), c = e([a("ui-speech-record-button")], c);
84
84
  export { c as UiSpeechRecordButton };
@@ -1,18 +1,14 @@
1
1
  import { audioPlayerContext as e } from "../../utils/audio-context.js";
2
- import { LitElement as t, css as n, html as r } from "lit";
3
- import { customElement as i, property as a } from "lit/decorators.js";
4
- import { consume as o } from "@lit/context";
2
+ import { __decorate as t } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/decorate.js";
3
+ import { LitElement as n, css as r, html as i } from "lit";
4
+ import { customElement as a, property as o } from "lit/decorators.js";
5
+ import { consume as s } from "@lit/context";
5
6
  /**
6
7
  * Copyright 2026 Google LLC
7
8
  */
8
- var s = function(e, t, n, r) {
9
- var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
10
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
11
- else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
12
- return i > 3 && a && Object.defineProperty(t, n, a), a;
13
- }, c = class extends t {
9
+ var c = class extends n {
14
10
  static {
15
- this.styles = n`
11
+ this.styles = r`
16
12
  :host {
17
13
  display: block;
18
14
  font-family: inherit;
@@ -57,9 +53,9 @@ var s = function(e, t, n, r) {
57
53
  }
58
54
  render() {
59
55
  let e = this.playerState?.transcript || [], t = this.playerState?.currentTime || 0;
60
- return r`
56
+ return i`
61
57
  <slot></slot>
62
- ${e.length > 0 ? r`
58
+ ${e.length > 0 ? i`
63
59
  <div class="transcript" part="container">
64
60
  ${e.map((e) => this._renderWord(e, t))}
65
61
  </div>
@@ -67,18 +63,18 @@ var s = function(e, t, n, r) {
67
63
  `;
68
64
  }
69
65
  _renderWord(e, t) {
70
- let n = t >= e.start && t <= e.end, i = t > e.end;
71
- return r`
66
+ let n = t >= e.start && t <= e.end, r = t > e.end;
67
+ return i`
72
68
  <span
73
- class="word ${n ? "active" : ""} ${i ? "past" : ""}"
74
- part="word ${n ? "word-active" : ""} ${i ? "word-past" : ""}"
69
+ class="word ${n ? "active" : ""} ${r ? "past" : ""}"
70
+ part="word ${n ? "word-active" : ""} ${r ? "word-past" : ""}"
75
71
  >${e.text}</span
76
72
  >
77
73
  `;
78
74
  }
79
75
  };
80
- s([o({
76
+ t([s({
81
77
  context: e,
82
78
  subscribe: !0
83
- }), a({ attribute: !1 })], c.prototype, "playerState", void 0), c = s([i("ui-timed-text")], c);
79
+ }), o({ attribute: !1 })], c.prototype, "playerState", void 0), c = t([a("ui-timed-text")], c);
84
80
  export { c as UiTimedText };
@@ -1,22 +1,18 @@
1
- import { speechContext as e } from "../../utils/speech-context.js";
1
+ import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/decorate.js";
2
+ import { speechContext as t } from "../../utils/speech-context.js";
2
3
  import "../molecules/ui-live-waveform.js";
3
- import { LitElement as t, css as n, html as r } from "lit";
4
- import { customElement as i, property as a } from "lit/decorators.js";
5
- import { consume as o } from "@lit/context";
4
+ import { LitElement as n, css as r, html as i } from "lit";
5
+ import { customElement as a, property as o } from "lit/decorators.js";
6
+ import { consume as s } from "@lit/context";
6
7
  /**
7
8
  * Copyright 2026 Google LLC
8
9
  */
9
- var s = function(e, t, n, r) {
10
- var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
11
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
12
- else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
13
- return i > 3 && a && Object.defineProperty(t, n, a), a;
14
- }, c = class extends t {
15
- constructor() {
16
- super(...arguments), this.barWidth = 2, this.barGap = 1, this.barColor = "currentColor", this.height = 20;
10
+ var c = class extends n {
11
+ constructor(...e) {
12
+ super(...e), this.barWidth = 2, this.barGap = 1, this.barColor = "currentColor", this.height = 20;
17
13
  }
18
14
  static {
19
- this.styles = n`
15
+ this.styles = r`
20
16
  :host {
21
17
  display: block;
22
18
  width: 100%;
@@ -24,9 +20,9 @@ var s = function(e, t, n, r) {
24
20
  `;
25
21
  }
26
22
  render() {
27
- if (!this._context) return r``;
23
+ if (!this._context) return i``;
28
24
  let e = this._context.state === "recording", t = this._context.state === "processing" || this._context.state === "connecting";
29
- return e || t ? r`
25
+ return e || t ? i`
30
26
  <ui-live-waveform
31
27
  .active=${e}
32
28
  .processing=${t}
@@ -36,11 +32,11 @@ var s = function(e, t, n, r) {
36
32
  .barColor=${this.barColor}
37
33
  .height=${this.height}
38
34
  ></ui-live-waveform>
39
- ` : r``;
35
+ ` : i``;
40
36
  }
41
37
  };
42
- s([o({
43
- context: e,
38
+ e([s({
39
+ context: t,
44
40
  subscribe: !0
45
- })], c.prototype, "_context", void 0), s([a({ type: Number })], c.prototype, "barWidth", void 0), s([a({ type: Number })], c.prototype, "barGap", void 0), s([a({ type: String })], c.prototype, "barColor", void 0), s([a({ type: Number })], c.prototype, "height", void 0), c = s([i("ui-voice-waveform")], c);
41
+ })], c.prototype, "_context", void 0), e([o({ type: Number })], c.prototype, "barWidth", void 0), e([o({ type: Number })], c.prototype, "barGap", void 0), e([o({ type: String })], c.prototype, "barColor", void 0), e([o({ type: Number })], c.prototype, "height", void 0), c = e([a("ui-voice-waveform")], c);
46
42
  export { c as UiVoiceWaveform };
@@ -1,20 +1,16 @@
1
- import { applyCanvasEdgeFade as e, getNormalizedFrequencyData as t } from "../../utils/audio-utils.js";
2
- import { LitElement as n, css as r, html as i } from "lit";
3
- import { customElement as a, property as o, query as s } from "lit/decorators.js";
1
+ import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/decorate.js";
2
+ import { applyCanvasEdgeFade as t, getNormalizedFrequencyData as n } from "../../utils/audio-utils.js";
3
+ import { LitElement as r, css as i, html as a } from "lit";
4
+ import { customElement as o, property as s, query as c } from "lit/decorators.js";
4
5
  /**
5
6
  * Copyright 2026 Google LLC
6
7
  */
7
- var c = function(e, t, n, r) {
8
- var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
9
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
10
- else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
11
- return i > 3 && a && Object.defineProperty(t, n, a), a;
12
- }, l = class extends n {
13
- constructor() {
14
- super(...arguments), this.active = !1, this.processing = !1, this.barWidth = 3, this.barHeight = 4, this.barGap = 1, this.barRadius = 1.5, this.fadeEdges = !0, this.fadeWidth = 24, this.sensitivity = 1, this.updateRate = 30, this._animationFrameId = 0, this._lastUpdateTime = 0, this._currentBars = [], this._processingTime = 0, this._transitionProgress = 0, this._lastActiveData = [];
8
+ var l = class extends r {
9
+ constructor(...e) {
10
+ super(...e), this.active = !1, this.processing = !1, this.barWidth = 3, this.barHeight = 4, this.barGap = 1, this.barRadius = 1.5, this.fadeEdges = !0, this.fadeWidth = 24, this.sensitivity = 1, this.updateRate = 30, this._animationFrameId = 0, this._lastUpdateTime = 0, this._currentBars = [], this._processingTime = 0, this._transitionProgress = 0, this._lastActiveData = [];
15
11
  }
16
12
  static {
17
- this.styles = r`
13
+ this.styles = i`
18
14
  :host {
19
15
  display: block;
20
16
  width: 100%;
@@ -36,7 +32,7 @@ var c = function(e, t, n, r) {
36
32
  `;
37
33
  }
38
34
  render() {
39
- return i`
35
+ return a`
40
36
  <div class="container" style="height: ${this.height === void 0 ? "100%" : typeof this.height == "number" || !isNaN(Number(this.height)) ? `${this.height}px` : this.height};">
41
37
  <canvas></canvas>
42
38
  </div>
@@ -72,12 +68,12 @@ var c = function(e, t, n, r) {
72
68
  this._animationFrameId = requestAnimationFrame(e);
73
69
  }
74
70
  _updateData(e) {
75
- if (!this._canvas) return;
76
- let n = this._canvas.getBoundingClientRect(), r = Math.floor(n.width / (this.barWidth + this.barGap));
71
+ if (!this._container) return;
72
+ let t = this._container.getBoundingClientRect(), r = Math.floor(t.width / (this.barWidth + this.barGap));
77
73
  if (this.active && this.analyserNode && this._dataArray) {
78
74
  if (e - this._lastUpdateTime > this.updateRate) {
79
75
  this._lastUpdateTime = e;
80
- let n = t(this.analyserNode, this._dataArray), i = Math.floor(n.length * .05), a = Math.floor(n.length * .4), o = n.slice(i, a), s = Math.floor(r / 2), c = Array(r).fill(.05), l = o.length - 1;
76
+ let t = n(this.analyserNode, this._dataArray), i = Math.floor(t.length * .05), a = Math.floor(t.length * .4), o = t.slice(i, a), s = Math.floor(r / 2), c = Array(r).fill(.05), l = o.length - 1;
81
77
  for (let e = 0; e <= s; e++) {
82
78
  let t = e / s, n = o[Math.floor(t * l)] || 0;
83
79
  t > .8 && (n *= 1 - (t - .8) * 5);
@@ -106,26 +102,31 @@ var c = function(e, t, n, r) {
106
102
  }
107
103
  _renderFrame() {
108
104
  if (!this._canvas) return;
109
- let t = this._canvas.getContext("2d");
110
- if (!t) return;
111
- let n = this._canvas.getBoundingClientRect();
112
- t.clearRect(0, 0, n.width, n.height);
113
- let r = getComputedStyle(this), i = this.barColor || "currentColor";
114
- if (i.startsWith("var(")) {
115
- let e = i.match(/var\(([^,)]+)/)?.[1].trim();
105
+ let e = this._canvas.getContext("2d");
106
+ if (!e) return;
107
+ let n = window.devicePixelRatio || 1, r = this._container.getBoundingClientRect();
108
+ if (r.width === 0 || r.height === 0) {
109
+ this._animationFrameId = requestAnimationFrame(() => this._renderFrame());
110
+ return;
111
+ }
112
+ let i = Math.round(r.width * n), a = Math.round(r.height * n);
113
+ this._canvas.width !== i || this._canvas.height !== a ? (this._canvas.width = i, this._canvas.height = a, this._canvas.style.width = `${r.width}px`, this._canvas.style.height = `${r.height}px`, e.scale(n, n)) : e.clearRect(0, 0, r.width, r.height);
114
+ let o = getComputedStyle(this), s = this.barColor || "currentColor";
115
+ if (s.startsWith("var(")) {
116
+ let e = s.match(/var\(([^,)]+)/)?.[1].trim();
116
117
  if (e) {
117
- let t = r.getPropertyValue(e).trim();
118
- t && (i = t);
118
+ let t = o.getPropertyValue(e).trim();
119
+ t && (s = t);
119
120
  }
120
121
  }
121
- (i === "currentColor" || !i) && (i = r.getPropertyValue("--md-sys-color-primary").trim() || "#0066cc");
122
- let a = this.barWidth + this.barGap, o = Math.floor(n.width / a), s = n.height / 2;
123
- for (let e = 0; e < o && e < this._currentBars.length; e++) {
124
- let r = this._currentBars[e] || .05, o = e * a, c = Math.max(this.barHeight, r * n.height * .8), l = s - c / 2;
125
- t.fillStyle = i, t.globalAlpha = .6 + r * .4, this.barRadius > 0 ? (t.beginPath(), t.roundRect(o, l, this.barWidth, c, this.barRadius), t.fill()) : t.fillRect(o, l, this.barWidth, c);
122
+ (s === "currentColor" || !s) && (s = o.getPropertyValue("--md-sys-color-primary").trim() || "#0066cc");
123
+ let c = this.barWidth + this.barGap, l = Math.floor(r.width / c), u = r.height / 2;
124
+ for (let t = 0; t < l && t < this._currentBars.length; t++) {
125
+ let n = this._currentBars[t] || .05, i = t * c, a = Math.max(this.barHeight, n * r.height * .8), o = u - a / 2;
126
+ e.fillStyle = s, e.globalAlpha = .6 + n * .4, this.barRadius > 0 ? (e.beginPath(), e.roundRect(i, o, this.barWidth, a, this.barRadius), e.fill()) : e.fillRect(i, o, this.barWidth, a);
126
127
  }
127
- this.fadeEdges && e(t, n.width, n.height, this.fadeWidth), t.globalAlpha = 1;
128
+ this.fadeEdges && t(e, r.width, r.height, this.fadeWidth), e.globalAlpha = 1;
128
129
  }
129
130
  };
130
- c([o({ type: Boolean })], l.prototype, "active", void 0), c([o({ type: Boolean })], l.prototype, "processing", void 0), c([o({ attribute: !1 })], l.prototype, "analyserNode", void 0), c([o({ type: Number })], l.prototype, "barWidth", void 0), c([o({ type: Number })], l.prototype, "barHeight", void 0), c([o({ type: Number })], l.prototype, "barGap", void 0), c([o({ type: Number })], l.prototype, "barRadius", void 0), c([o({ type: String })], l.prototype, "barColor", void 0), c([o({ type: Boolean })], l.prototype, "fadeEdges", void 0), c([o({ type: Number })], l.prototype, "fadeWidth", void 0), c([o()], l.prototype, "height", void 0), c([o({ type: Number })], l.prototype, "sensitivity", void 0), c([o({ type: Number })], l.prototype, "updateRate", void 0), c([s("canvas")], l.prototype, "_canvas", void 0), c([s(".container")], l.prototype, "_container", void 0), l = c([a("ui-live-waveform")], l);
131
+ e([s({ type: Boolean })], l.prototype, "active", void 0), e([s({ type: Boolean })], l.prototype, "processing", void 0), e([s({ attribute: !1 })], l.prototype, "analyserNode", void 0), e([s({ type: Number })], l.prototype, "barWidth", void 0), e([s({ type: Number })], l.prototype, "barHeight", void 0), e([s({ type: Number })], l.prototype, "barGap", void 0), e([s({ type: Number })], l.prototype, "barRadius", void 0), e([s({ type: String })], l.prototype, "barColor", void 0), e([s({ type: Boolean })], l.prototype, "fadeEdges", void 0), e([s({ type: Number })], l.prototype, "fadeWidth", void 0), e([s()], l.prototype, "height", void 0), e([s({ type: Number })], l.prototype, "sensitivity", void 0), e([s({ type: Number })], l.prototype, "updateRate", void 0), e([c("canvas")], l.prototype, "_canvas", void 0), e([c(".container")], l.prototype, "_container", void 0), l = e([o("ui-live-waveform")], l);
131
132
  export { l as UiLiveWaveform };
@@ -1,7 +1,8 @@
1
+ import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/decorate.js";
1
2
  import "./ui-live-waveform.js";
2
3
  import "@material/web/icon/icon.js";
3
- import { LitElement as e, css as t, html as n } from "lit";
4
- import { customElement as r, property as i, query as a, state as o } from "lit/decorators.js";
4
+ import { LitElement as t, css as n, html as r } from "lit";
5
+ import { customElement as i, property as a, query as o, state as s } from "lit/decorators.js";
5
6
  import "@material/web/menu/menu.js";
6
7
  import "@material/web/menu/menu-item.js";
7
8
  import "@material/web/divider/divider.js";
@@ -22,19 +23,14 @@ import "@material/web/button/filled-tonal-button.js";
22
23
  * See the License for the specific language governing permissions and
23
24
  * limitations under the License.
24
25
  */
25
- var s = function(e, t, n, r) {
26
- var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
27
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
28
- else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
29
- return i > 3 && a && Object.defineProperty(t, n, a), a;
30
- }, c = class extends e {
31
- constructor() {
32
- super(...arguments), this.muted = !1, this.disabled = !1, this._devices = [], this._loading = !0, this._error = null, this._hasPermission = !1, this._isMenuOpen = !1, this._handleDeviceChange = () => {
26
+ var c = class extends t {
27
+ constructor(...e) {
28
+ super(...e), this.muted = !1, this.disabled = !1, this._devices = [], this._loading = !0, this._error = null, this._hasPermission = !1, this._isMenuOpen = !1, this._handleDeviceChange = () => {
33
29
  this._hasPermission ? this._loadDevicesWithPermission() : this._loadDevicesWithoutPermission();
34
30
  };
35
31
  }
36
32
  static {
37
- this.styles = t`
33
+ this.styles = n`
38
34
  :host {
39
35
  display: inline-block;
40
36
  position: relative;
@@ -141,7 +137,7 @@ var s = function(e, t, n, r) {
141
137
  }
142
138
  render() {
143
139
  let e = this._devices.find((e) => e.deviceId === this.value) || this._devices[0] || { label: this._loading ? "Loading..." : "No microphone" };
144
- return n`
140
+ return r`
145
141
  <!-- Anchor Button -->
146
142
  <button
147
143
  id="anchor-button"
@@ -166,22 +162,22 @@ var s = function(e, t, n, r) {
166
162
  @closed=${() => this._isMenuOpen = !1}
167
163
  @opened=${() => this._isMenuOpen = !0}
168
164
  >
169
- ${this._loading ? n`<md-menu-item disabled
165
+ ${this._loading ? r`<md-menu-item disabled
170
166
  ><div slot="headline">Loading devices...</div></md-menu-item
171
- >` : this._error ? n`<md-menu-item disabled
167
+ >` : this._error ? r`<md-menu-item disabled
172
168
  ><div slot="headline" style="color: var(--md-sys-color-error)">
173
169
  ${this._error}
174
170
  </div></md-menu-item
175
- >` : this._devices.map((e) => n`
171
+ >` : this._devices.map((e) => r`
176
172
  <md-menu-item
177
173
  @click=${() => this._selectDevice(e.deviceId)}
178
174
  ?selected=${this.value === e.deviceId || !this.value && this._devices[0]?.deviceId === e.deviceId}
179
175
  >
180
176
  <div slot="headline">${e.label}</div>
181
- ${this.value === e.deviceId || !this.value && this._devices[0]?.deviceId === e.deviceId ? n`<md-icon slot="end">check</md-icon>` : ""}
177
+ ${this.value === e.deviceId || !this.value && this._devices[0]?.deviceId === e.deviceId ? r`<md-icon slot="end">check</md-icon>` : ""}
182
178
  </md-menu-item>
183
179
  `)}
184
- ${this._devices.length > 0 ? n`
180
+ ${this._devices.length > 0 ? r`
185
181
  <md-divider></md-divider>
186
182
  <div class="menu-footer">
187
183
  <md-text-button
@@ -275,5 +271,5 @@ var s = function(e, t, n, r) {
275
271
  this._previewStream &&= (this._previewStream.getTracks().forEach((e) => e.stop()), void 0), this._previewAudioContext && this._previewAudioContext.state !== "closed" && (this._previewAudioContext.close(), this._previewAudioContext = void 0), this._previewAnalyser = void 0;
276
272
  }
277
273
  };
278
- s([i({ type: String })], c.prototype, "value", void 0), s([i({ type: Boolean })], c.prototype, "muted", void 0), s([i({ type: Boolean })], c.prototype, "disabled", void 0), s([o()], c.prototype, "_devices", void 0), s([o()], c.prototype, "_loading", void 0), s([o()], c.prototype, "_error", void 0), s([o()], c.prototype, "_hasPermission", void 0), s([o()], c.prototype, "_isMenuOpen", void 0), s([o()], c.prototype, "_previewAnalyser", void 0), s([a("md-menu")], c.prototype, "_menuEl", void 0), c = s([r("ui-mic-selector")], c);
274
+ e([a({ type: String })], c.prototype, "value", void 0), e([a({ type: Boolean })], c.prototype, "muted", void 0), e([a({ type: Boolean })], c.prototype, "disabled", void 0), e([s()], c.prototype, "_devices", void 0), e([s()], c.prototype, "_loading", void 0), e([s()], c.prototype, "_error", void 0), e([s()], c.prototype, "_hasPermission", void 0), e([s()], c.prototype, "_isMenuOpen", void 0), e([s()], c.prototype, "_previewAnalyser", void 0), e([o("md-menu")], c.prototype, "_menuEl", void 0), c = e([i("ui-mic-selector")], c);
279
275
  export { c as UiMicSelector };
@@ -1,8 +1,9 @@
1
1
  import { audioPlayerContext as e } from "../../utils/audio-context.js";
2
+ import { __decorate as t } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/decorate.js";
2
3
  import "@material/web/icon/icon.js";
3
- import { LitElement as t, css as n, html as r } from "lit";
4
- import { customElement as i, property as a } from "lit/decorators.js";
5
- import { consume as o } from "@lit/context";
4
+ import { LitElement as n, css as r, html as i } from "lit";
5
+ import { customElement as a, property as o } from "lit/decorators.js";
6
+ import { consume as s } from "@lit/context";
6
7
  import "@material/web/list/list.js";
7
8
  import "@material/web/list/list-item.js";
8
9
  /**
@@ -20,17 +21,12 @@ import "@material/web/list/list-item.js";
20
21
  * See the License for the specific language governing permissions and
21
22
  * limitations under the License.
22
23
  */
23
- var s = function(e, t, n, r) {
24
- var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
25
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
26
- else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
27
- return i > 3 && a && Object.defineProperty(t, n, a), a;
28
- }, c = class extends t {
29
- constructor() {
30
- super(...arguments), this.header = "Queue", this.emptyText = "No tracks in queue";
24
+ var c = class extends n {
25
+ constructor(...e) {
26
+ super(...e), this.header = "Queue", this.emptyText = "No tracks in queue";
31
27
  }
32
28
  static {
33
- this.styles = n`
29
+ this.styles = r`
34
30
  :host {
35
31
  display: block;
36
32
  background: var(--md-sys-color-surface-container-low, transparent);
@@ -86,12 +82,12 @@ var s = function(e, t, n, r) {
86
82
  }
87
83
  render() {
88
84
  let e = this.playerState?.items || [], t = this.playerState?.currentIndex ?? -1;
89
- return r`
85
+ return i`
90
86
  <div class="playlist-header">${this.header}</div>
91
87
 
92
- ${e.length === 0 ? r`<div class="empty-state">${this.emptyText}</div>` : r`
88
+ ${e.length === 0 ? i`<div class="empty-state">${this.emptyText}</div>` : i`
93
89
  <md-list>
94
- ${e.map((e, n) => r`
90
+ ${e.map((e, n) => i`
95
91
  <md-list-item
96
92
  ?selected=${n === t}
97
93
  @click=${() => this.playerState?.select(n)}
@@ -102,9 +98,9 @@ var s = function(e, t, n, r) {
102
98
  <div slot="supporting-text">
103
99
  ${e.artist || "Unknown Artist"}
104
100
  </div>
105
- ${n === t ? r`<md-icon slot="start" class="now-playing-icon"
101
+ ${n === t ? i`<md-icon slot="start" class="now-playing-icon"
106
102
  >${this.playerState?.isPlaying ? "graphic_eq" : "play_arrow"}</md-icon
107
- >` : r`<md-icon slot="start">music_note</md-icon>`}
103
+ >` : i`<md-icon slot="start">music_note</md-icon>`}
108
104
  </md-list-item>
109
105
  `)}
110
106
  </md-list>
@@ -112,8 +108,8 @@ var s = function(e, t, n, r) {
112
108
  `;
113
109
  }
114
110
  };
115
- s([o({
111
+ t([s({
116
112
  context: e,
117
113
  subscribe: !0
118
- })], c.prototype, "playerState", void 0), s([a({ type: String })], c.prototype, "header", void 0), s([a({ type: String })], c.prototype, "emptyText", void 0), c = s([i("ui-playlist")], c);
114
+ })], c.prototype, "playerState", void 0), t([o({ type: String })], c.prototype, "header", void 0), t([o({ type: String })], c.prototype, "emptyText", void 0), c = t([a("ui-playlist")], c);
119
115
  export { c as UiPlaylist };
@@ -1,17 +1,13 @@
1
- import { applyCanvasEdgeFade as e } from "../../utils/audio-utils.js";
2
- import { LitElement as t, css as n, html as r } from "lit";
3
- import { customElement as i, property as a, query as o } from "lit/decorators.js";
4
- var s = function(e, t, n, r) {
5
- var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
6
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
7
- else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
8
- return i > 3 && a && Object.defineProperty(t, n, a), a;
9
- }, c = class extends t {
10
- constructor() {
11
- super(...arguments), this.speed = 50, this.barCount = 60, this.barWidth = 4, this.barHeight = 4, this.barGap = 2, this.barRadius = 2, this.fadeEdges = !0, this.fadeWidth = 24, this.align = "center", this.active = !0, this._animationFrameId = 0, this._lastTime = 0, this._bars = [], this._seed = Math.random(), this._dataIndex = 0;
1
+ import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/decorate.js";
2
+ import { applyCanvasEdgeFade as t } from "../../utils/audio-utils.js";
3
+ import { LitElement as n, css as r, html as i } from "lit";
4
+ import { customElement as a, property as o, query as s } from "lit/decorators.js";
5
+ var c = class extends n {
6
+ constructor(...e) {
7
+ super(...e), this.speed = 50, this.barCount = 60, this.barWidth = 4, this.barHeight = 4, this.barGap = 2, this.barRadius = 2, this.fadeEdges = !0, this.fadeWidth = 24, this.align = "center", this.active = !0, this._animationFrameId = 0, this._lastTime = 0, this._bars = [], this._seed = Math.random(), this._dataIndex = 0;
12
8
  }
13
9
  static {
14
- this.styles = n`
10
+ this.styles = r`
15
11
  :host {
16
12
  display: block;
17
13
  width: 100%;
@@ -34,7 +30,7 @@ var s = function(e, t, n, r) {
34
30
  `;
35
31
  }
36
32
  render() {
37
- return r`
33
+ return i`
38
34
  <div class="container" style="height: ${this.height === void 0 ? "100%" : typeof this.height == "number" || !isNaN(Number(this.height)) ? `${this.height}px` : this.height};">
39
35
  <canvas></canvas>
40
36
  </div>
@@ -69,20 +65,25 @@ var s = function(e, t, n, r) {
69
65
  }
70
66
  _startAnimation() {
71
67
  this._lastTime = performance.now();
72
- let t = (n) => {
68
+ let e = (n) => {
73
69
  if (!this._canvas) return;
74
70
  let r = this._canvas.getContext("2d");
75
71
  if (!r) return;
76
72
  let i = this._lastTime ? (n - this._lastTime) / 1e3 : 0;
77
73
  this._lastTime = n;
78
- let a = this._canvas.getBoundingClientRect();
79
- r.clearRect(0, 0, a.width, a.height);
80
- let o = this.barColor;
81
- o ||= getComputedStyle(this).getPropertyValue("--md-sys-color-primary").trim() || "#0066cc";
82
- let s = this.barWidth + this.barGap, c = this.active ? this.speed : 0;
83
- for (let e = 0; e < this._bars.length; e++) this._bars[e].x -= c * i, this.active || (this._bars[e].height += (.05 - this._bars[e].height) * .15);
84
- for (this._bars = this._bars.filter((e) => e.x + this.barWidth > -s); this._bars.length === 0 || this._bars[this._bars.length - 1].x < a.width;) {
85
- let e = this._bars[this._bars.length - 1], t = e ? e.x + s : a.width, n, r = this.peaks && this.peaks.length > 0 ? this.peaks : this.data;
74
+ let a = window.devicePixelRatio || 1, o = this._container.getBoundingClientRect();
75
+ if (o.width === 0 || o.height === 0) {
76
+ this._animationFrameId = requestAnimationFrame(e);
77
+ return;
78
+ }
79
+ let s = Math.round(o.width * a), c = Math.round(o.height * a);
80
+ this._canvas.width !== s || this._canvas.height !== c ? (this._canvas.width = s, this._canvas.height = c, this._canvas.style.width = `${o.width}px`, this._canvas.style.height = `${o.height}px`, r.scale(a, a)) : r.clearRect(0, 0, o.width, o.height);
81
+ let l = this.barColor;
82
+ l ||= getComputedStyle(this).getPropertyValue("--md-sys-color-primary").trim() || "#0066cc";
83
+ let u = this.barWidth + this.barGap, d = this.active ? this.speed : 0;
84
+ for (let e = 0; e < this._bars.length; e++) this._bars[e].x -= d * i, this.active || (this._bars[e].height += (.05 - this._bars[e].height) * .15);
85
+ for (this._bars = this._bars.filter((e) => e.x + this.barWidth > -u); this._bars.length === 0 || this._bars[this._bars.length - 1].x < o.width;) {
86
+ let e = this._bars[this._bars.length - 1], t = e ? e.x + u : o.width, n, r = this.peaks && this.peaks.length > 0 ? this.peaks : this.data;
86
87
  if (r && r.length > 0) n = r[this._dataIndex % r.length] || .1, this._dataIndex = (this._dataIndex + 1) % r.length;
87
88
  else if (this.analyserNode) {
88
89
  (!this._dataArray || this._dataArray.length !== this.analyserNode.frequencyBinCount) && (this._dataArray = new Uint8Array(this.analyserNode.frequencyBinCount)), this.analyserNode.getByteFrequencyData(this._dataArray);
@@ -99,15 +100,15 @@ var s = function(e, t, n, r) {
99
100
  height: n
100
101
  }), this._bars.length > this.barCount * 2) break;
101
102
  }
102
- let l = a.height / 2;
103
- for (let e of this._bars) if (e.x < a.width && e.x + this.barWidth > 0) {
104
- let t = Math.max(this.barHeight, e.height * a.height * .8), n = l - t / 2;
105
- r.fillStyle = o, r.globalAlpha = .6 + e.height * .4, this.barRadius > 0 ? (r.beginPath(), r.roundRect(e.x, n, this.barWidth, t, this.barRadius), r.fill()) : r.fillRect(e.x, n, this.barWidth, t);
103
+ let f = o.height / 2;
104
+ for (let e of this._bars) if (e.x < o.width && e.x + this.barWidth > 0) {
105
+ let t = Math.max(this.barHeight, e.height * o.height * .8), n = f - t / 2;
106
+ r.fillStyle = l, r.globalAlpha = .6 + e.height * .4, this.barRadius > 0 ? (r.beginPath(), r.roundRect(e.x, n, this.barWidth, t, this.barRadius), r.fill()) : r.fillRect(e.x, n, this.barWidth, t);
106
107
  }
107
- r.globalAlpha = 1, this.fadeEdges && this.fadeWidth > 0 && e(r, a.width, a.height, this.fadeWidth), this._animationFrameId = requestAnimationFrame(t);
108
+ r.globalAlpha = 1, this.fadeEdges && this.fadeWidth > 0 && t(r, o.width, o.height, this.fadeWidth), this._animationFrameId = requestAnimationFrame(e);
108
109
  };
109
- this._animationFrameId = requestAnimationFrame(t);
110
+ this._animationFrameId = requestAnimationFrame(e);
110
111
  }
111
112
  };
112
- s([a({ type: Number })], c.prototype, "speed", void 0), s([a({ type: Number })], c.prototype, "barCount", void 0), s([a({ type: Number })], c.prototype, "barWidth", void 0), s([a({ type: Number })], c.prototype, "barHeight", void 0), s([a({ type: Number })], c.prototype, "barGap", void 0), s([a({ type: Number })], c.prototype, "barRadius", void 0), s([a({ type: String })], c.prototype, "barColor", void 0), s([a({ type: Boolean })], c.prototype, "fadeEdges", void 0), s([a({ type: Number })], c.prototype, "fadeWidth", void 0), s([a()], c.prototype, "height", void 0), s([a({ type: String })], c.prototype, "align", void 0), s([a({ type: Array })], c.prototype, "data", void 0), s([a({ type: Array })], c.prototype, "peaks", void 0), s([a({ attribute: !1 })], c.prototype, "analyserNode", void 0), s([a({ type: Boolean })], c.prototype, "active", void 0), s([o("canvas")], c.prototype, "_canvas", void 0), s([o(".container")], c.prototype, "_container", void 0), c = s([i("ui-scrolling-waveform")], c);
113
+ e([o({ type: Number })], c.prototype, "speed", void 0), e([o({ type: Number })], c.prototype, "barCount", void 0), e([o({ type: Number })], c.prototype, "barWidth", void 0), e([o({ type: Number })], c.prototype, "barHeight", void 0), e([o({ type: Number })], c.prototype, "barGap", void 0), e([o({ type: Number })], c.prototype, "barRadius", void 0), e([o({ type: String })], c.prototype, "barColor", void 0), e([o({ type: Boolean })], c.prototype, "fadeEdges", void 0), e([o({ type: Number })], c.prototype, "fadeWidth", void 0), e([o()], c.prototype, "height", void 0), e([o({ type: String })], c.prototype, "align", void 0), e([o({ type: Array })], c.prototype, "data", void 0), e([o({ type: Array })], c.prototype, "peaks", void 0), e([o({ attribute: !1 })], c.prototype, "analyserNode", void 0), e([o({ type: Boolean })], c.prototype, "active", void 0), e([s("canvas")], c.prototype, "_canvas", void 0), e([s(".container")], c.prototype, "_container", void 0), c = e([a("ui-scrolling-waveform")], c);
113
114
  export { c as UiScrollingWaveform };