@sixbell-telco/sdk 0.5.3 → 0.6.1

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 (134) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +17 -3
  3. package/_index.scss +6 -0
  4. package/components/audio-player/audio-timeline/audio-timeline.component.d.ts +20 -0
  5. package/components/audio-player/button-play/button-play.component.d.ts +23 -0
  6. package/components/audio-player/index.d.ts +5 -0
  7. package/components/audio-player/public-api.d.ts +3 -0
  8. package/components/audio-player/services/audio.service.d.ts +54 -0
  9. package/components/audio-player/src/audio-player.component.d.ts +34 -0
  10. package/components/audio-player/track-info/track-info.component.d.ts +8 -0
  11. package/components/audio-player/volume-control/volume-control.component.d.ts +24 -0
  12. package/components/button/src/button.component.d.ts +2 -1
  13. package/components/icon/heroicons/mini/index.d.ts +5 -0
  14. package/components/icon/heroicons/mini/public-api.d.ts +1 -0
  15. package/components/icon/heroicons/outline/index.d.ts +5 -0
  16. package/components/icon/heroicons/outline/public-api.d.ts +1 -0
  17. package/components/icon/heroicons/solid/index.d.ts +5 -0
  18. package/components/icon/heroicons/solid/public-api.d.ts +1 -0
  19. package/components/icon/ionicons/index.d.ts +5 -0
  20. package/components/icon/ionicons/public-api.d.ts +1 -0
  21. package/components/toast/services/toast.service.d.ts +0 -1
  22. package/components/toast/toasts-container/toasts-container.component.d.ts +0 -1
  23. package/directives/typography/src/typography.directive.d.ts +4 -1
  24. package/esm2022/components/accordion/accordion-item/accordion-item.component.mjs +1 -1
  25. package/esm2022/components/audio-player/audio-timeline/audio-timeline.component.mjs +76 -0
  26. package/esm2022/components/audio-player/button-play/button-play.component.mjs +62 -0
  27. package/esm2022/components/audio-player/public-api.mjs +4 -0
  28. package/esm2022/components/audio-player/services/audio.service.mjs +186 -0
  29. package/esm2022/components/audio-player/sixbell-telco-sdk-components-audio-player.mjs +5 -0
  30. package/esm2022/components/audio-player/src/audio-player.component.mjs +84 -0
  31. package/esm2022/components/audio-player/track-info/track-info.component.mjs +17 -0
  32. package/esm2022/components/audio-player/volume-control/volume-control.component.mjs +83 -0
  33. package/esm2022/components/avatar/src/avatar.component.mjs +1 -1
  34. package/esm2022/components/button/src/button.component.mjs +5 -3
  35. package/esm2022/components/dual-list/src/dual-list.component.mjs +2 -2
  36. package/esm2022/components/file-upload/file-dropzone/src/file-dropzone.component.mjs +2 -2
  37. package/esm2022/components/file-upload/file-uploader/src/file-uploader.component.mjs +1 -1
  38. package/esm2022/components/forms/checkbox/src/checkbox.component.mjs +1 -1
  39. package/esm2022/components/forms/combobox/src/combobox.component.mjs +2 -2
  40. package/esm2022/components/forms/form-error/src/form-error.component.mjs +1 -1
  41. package/esm2022/components/forms/input/src/input.component.mjs +2 -2
  42. package/esm2022/components/forms/radio/src/radio.component.mjs +1 -1
  43. package/esm2022/components/forms/range/src/range.component.mjs +2 -2
  44. package/esm2022/components/forms/select/src/select.component.mjs +1 -1
  45. package/esm2022/components/forms/switch/src/switch.component.mjs +1 -1
  46. package/esm2022/components/forms/textarea/src/textarea.component.mjs +2 -2
  47. package/esm2022/components/forms/toggle/src/toggle.component.mjs +1 -1
  48. package/esm2022/components/icon/heroicons/mini/public-api.mjs +2 -0
  49. package/esm2022/components/icon/heroicons/mini/sixbell-telco-sdk-components-icon-heroicons-mini.mjs +5 -0
  50. package/esm2022/components/icon/heroicons/outline/public-api.mjs +2 -0
  51. package/esm2022/components/icon/heroicons/outline/sixbell-telco-sdk-components-icon-heroicons-outline.mjs +5 -0
  52. package/esm2022/components/icon/heroicons/solid/public-api.mjs +2 -0
  53. package/esm2022/components/icon/heroicons/solid/sixbell-telco-sdk-components-icon-heroicons-solid.mjs +5 -0
  54. package/esm2022/components/icon/ionicons/public-api.mjs +2 -0
  55. package/esm2022/components/icon/ionicons/sixbell-telco-sdk-components-icon-ionicons.mjs +5 -0
  56. package/esm2022/components/modal/modal-title/modal-title.component.mjs +1 -1
  57. package/esm2022/components/paginator/components/pagination-item/pagination-item.component.mjs +1 -1
  58. package/esm2022/components/product-card/src/product-card.component.mjs +2 -2
  59. package/esm2022/components/progress/src/progress.component.mjs +1 -1
  60. package/esm2022/components/table/src/table.component.mjs +3 -3
  61. package/esm2022/components/toast/services/toast.service.mjs +3 -13
  62. package/esm2022/components/toast/toast-message/toast-message.component.mjs +2 -2
  63. package/esm2022/components/toast/toasts-container/toasts-container.component.mjs +3 -11
  64. package/esm2022/components/wizard/wizard-marker/wizard-marker.component.mjs +1 -1
  65. package/esm2022/components/wizard/wizard-step/wizard-step.component.mjs +2 -2
  66. package/esm2022/components/wizard/wizard-wrapper/wizard-wrapper.component.mjs +2 -2
  67. package/esm2022/directives/typography/src/typography.directive.mjs +9 -2
  68. package/esm2022/utils/pipes/time/public-api.mjs +2 -0
  69. package/esm2022/utils/pipes/time/sixbell-telco-sdk-utils-pipes-time.mjs +5 -0
  70. package/esm2022/utils/pipes/time/src/time.pipe.mjs +19 -0
  71. package/fesm2022/sixbell-telco-sdk-components-accordion.mjs +1 -1
  72. package/fesm2022/sixbell-telco-sdk-components-accordion.mjs.map +1 -1
  73. package/fesm2022/sixbell-telco-sdk-components-audio-player.mjs +481 -0
  74. package/fesm2022/sixbell-telco-sdk-components-audio-player.mjs.map +1 -0
  75. package/fesm2022/sixbell-telco-sdk-components-avatar.mjs +1 -1
  76. package/fesm2022/sixbell-telco-sdk-components-avatar.mjs.map +1 -1
  77. package/fesm2022/sixbell-telco-sdk-components-button.mjs +4 -2
  78. package/fesm2022/sixbell-telco-sdk-components-button.mjs.map +1 -1
  79. package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs +1 -1
  80. package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs.map +1 -1
  81. package/fesm2022/sixbell-telco-sdk-components-file-upload-file-dropzone.mjs +1 -1
  82. package/fesm2022/sixbell-telco-sdk-components-file-upload-file-dropzone.mjs.map +1 -1
  83. package/fesm2022/sixbell-telco-sdk-components-file-upload-file-uploader.mjs +1 -1
  84. package/fesm2022/sixbell-telco-sdk-components-file-upload-file-uploader.mjs.map +1 -1
  85. package/fesm2022/sixbell-telco-sdk-components-forms-checkbox.mjs +1 -1
  86. package/fesm2022/sixbell-telco-sdk-components-forms-checkbox.mjs.map +1 -1
  87. package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs +1 -1
  88. package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs.map +1 -1
  89. package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs +1 -1
  90. package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs.map +1 -1
  91. package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs +1 -1
  92. package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs.map +1 -1
  93. package/fesm2022/sixbell-telco-sdk-components-forms-radio.mjs +1 -1
  94. package/fesm2022/sixbell-telco-sdk-components-forms-radio.mjs.map +1 -1
  95. package/fesm2022/sixbell-telco-sdk-components-forms-range.mjs +1 -1
  96. package/fesm2022/sixbell-telco-sdk-components-forms-range.mjs.map +1 -1
  97. package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs +1 -1
  98. package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs.map +1 -1
  99. package/fesm2022/sixbell-telco-sdk-components-forms-switch.mjs +1 -1
  100. package/fesm2022/sixbell-telco-sdk-components-forms-switch.mjs.map +1 -1
  101. package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs +1 -1
  102. package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs.map +1 -1
  103. package/fesm2022/sixbell-telco-sdk-components-forms-toggle.mjs +1 -1
  104. package/fesm2022/sixbell-telco-sdk-components-forms-toggle.mjs.map +1 -1
  105. package/fesm2022/sixbell-telco-sdk-components-icon-heroicons-mini.mjs +6 -0
  106. package/fesm2022/sixbell-telco-sdk-components-icon-heroicons-mini.mjs.map +1 -0
  107. package/fesm2022/sixbell-telco-sdk-components-icon-heroicons-outline.mjs +6 -0
  108. package/fesm2022/sixbell-telco-sdk-components-icon-heroicons-outline.mjs.map +1 -0
  109. package/fesm2022/sixbell-telco-sdk-components-icon-heroicons-solid.mjs +6 -0
  110. package/fesm2022/sixbell-telco-sdk-components-icon-heroicons-solid.mjs.map +1 -0
  111. package/fesm2022/sixbell-telco-sdk-components-icon-ionicons.mjs +6 -0
  112. package/fesm2022/sixbell-telco-sdk-components-icon-ionicons.mjs.map +1 -0
  113. package/fesm2022/sixbell-telco-sdk-components-modal.mjs +1 -1
  114. package/fesm2022/sixbell-telco-sdk-components-modal.mjs.map +1 -1
  115. package/fesm2022/sixbell-telco-sdk-components-paginator.mjs +1 -1
  116. package/fesm2022/sixbell-telco-sdk-components-paginator.mjs.map +1 -1
  117. package/fesm2022/sixbell-telco-sdk-components-product-card.mjs +1 -1
  118. package/fesm2022/sixbell-telco-sdk-components-product-card.mjs.map +1 -1
  119. package/fesm2022/sixbell-telco-sdk-components-progress.mjs +1 -1
  120. package/fesm2022/sixbell-telco-sdk-components-progress.mjs.map +1 -1
  121. package/fesm2022/sixbell-telco-sdk-components-table.mjs +2 -2
  122. package/fesm2022/sixbell-telco-sdk-components-table.mjs.map +1 -1
  123. package/fesm2022/sixbell-telco-sdk-components-toast.mjs +4 -22
  124. package/fesm2022/sixbell-telco-sdk-components-toast.mjs.map +1 -1
  125. package/fesm2022/sixbell-telco-sdk-components-wizard.mjs +3 -3
  126. package/fesm2022/sixbell-telco-sdk-components-wizard.mjs.map +1 -1
  127. package/fesm2022/sixbell-telco-sdk-directives-typography.mjs +8 -1
  128. package/fesm2022/sixbell-telco-sdk-directives-typography.mjs.map +1 -1
  129. package/fesm2022/sixbell-telco-sdk-utils-pipes-time.mjs +26 -0
  130. package/fesm2022/sixbell-telco-sdk-utils-pipes-time.mjs.map +1 -0
  131. package/package.json +104 -65
  132. package/utils/pipes/time/index.d.ts +5 -0
  133. package/utils/pipes/time/public-api.d.ts +1 -0
  134. package/utils/pipes/time/src/time.pipe.d.ts +7 -0
@@ -0,0 +1,481 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, signal, computed, Injectable, input, output, Component, ChangeDetectionStrategy, viewChild, HostListener, model, effect } from '@angular/core';
4
+ import { matPlayArrow, matPause, matSkipPrevious, matSkipNext } from '@ng-icons/material-icons/baseline';
5
+ import { ButtonComponent } from '@sixbell-telco/sdk/components/button';
6
+ import { IconComponent } from '@sixbell-telco/sdk/components/icon';
7
+ import { heroMusicalNoteMini } from '@sixbell-telco/sdk/components/icon/heroicons/mini';
8
+ import { cn } from '@sixbell-telco/sdk/utils/cn';
9
+ import { HttpClient } from '@angular/common/http';
10
+ import { firstValueFrom } from 'rxjs';
11
+ import { TypographyDirective } from '@sixbell-telco/sdk/directives/typography';
12
+ import { TimePipe } from '@sixbell-telco/sdk/utils/pipes/time';
13
+ import { matVolumeUpOutline, matVolumeDownOutline, matVolumeMuteOutline } from '@ng-icons/material-icons/outline';
14
+
15
+ // audio-player.service.ts
16
+ class AudioPlayerService {
17
+ audio = new Audio();
18
+ http = inject(HttpClient);
19
+ objectUrls = new Map();
20
+ // State signals
21
+ _tracks = signal([]);
22
+ _currentTrackIndex = signal(-1);
23
+ _isPlaying = signal(false);
24
+ _duration = signal(0);
25
+ _currentTime = signal(0);
26
+ _volume = signal(1);
27
+ _isMuted = signal(false);
28
+ _lastVolume = signal(1);
29
+ _isBuffering = signal(false);
30
+ _isInitializing = signal(false);
31
+ _autoPlayNext = signal(false);
32
+ _error = signal(null);
33
+ // Readonly signals
34
+ tracks = this._tracks.asReadonly();
35
+ currentTrackIndex = this._currentTrackIndex.asReadonly();
36
+ isPlaying = this._isPlaying.asReadonly();
37
+ duration = this._duration.asReadonly();
38
+ currentTime = this._currentTime.asReadonly();
39
+ volume = this._volume.asReadonly();
40
+ isMuted = this._isMuted.asReadonly();
41
+ isBuffering = this._isBuffering.asReadonly();
42
+ isInitializing = this._isInitializing.asReadonly();
43
+ currentTrack = computed(() => this.tracks()[this.currentTrackIndex()] || undefined);
44
+ autoPlayNext = this._autoPlayNext.asReadonly();
45
+ error = this._error.asReadonly();
46
+ constructor() {
47
+ this.setupAudioListeners();
48
+ this.restoreVolumeSettings();
49
+ }
50
+ setupAudioListeners() {
51
+ this.audio.addEventListener('loadedmetadata', () => this.updateDuration());
52
+ this.audio.addEventListener('timeupdate', () => this.updateTime());
53
+ this.audio.addEventListener('playing', () => this.setPlaying(true));
54
+ this.audio.addEventListener('pause', () => this.setPlaying(false));
55
+ this.audio.addEventListener('ended', () => this.handleEnded());
56
+ this.audio.addEventListener('waiting', () => this._isBuffering.set(true));
57
+ this.audio.addEventListener('error', (e) => {
58
+ this._error.set(e);
59
+ console.error('Audio error:', e);
60
+ });
61
+ }
62
+ async getAuthenticatedAudioUrl(track) {
63
+ if (!this.objectUrls.has(track.url)) {
64
+ const blob = await firstValueFrom(this.http.get(track.url, {
65
+ responseType: 'blob',
66
+ headers: { Accept: 'audio/mpeg' },
67
+ }));
68
+ this.objectUrls.set(track.url, URL.createObjectURL(blob));
69
+ }
70
+ return this.objectUrls.get(track.url);
71
+ }
72
+ async playTrack(index) {
73
+ if (index < 0 || index >= this.tracks().length)
74
+ return;
75
+ this._isInitializing.set(true);
76
+ this._currentTrackIndex.set(index);
77
+ const track = this.tracks()[index];
78
+ // Get authenticated URL
79
+ const authenticatedUrl = await this.getAuthenticatedAudioUrl(track);
80
+ // Set audio source
81
+ this.audio.src = authenticatedUrl;
82
+ this.audio.load();
83
+ try {
84
+ // Wait for audio to be ready
85
+ await new Promise((resolve, reject) => {
86
+ this.audio.addEventListener('canplay', () => resolve(), { once: true });
87
+ this.audio.addEventListener('error', (e) => reject(e), { once: true });
88
+ });
89
+ await this.audio.play();
90
+ }
91
+ catch (error) {
92
+ console.error('Error playing track:', error);
93
+ this._error.set(error);
94
+ this._isPlaying.set(false);
95
+ }
96
+ finally {
97
+ this._isInitializing.set(false);
98
+ }
99
+ }
100
+ cleanup() {
101
+ this.objectUrls.forEach((url) => URL.revokeObjectURL(url));
102
+ this.objectUrls.clear();
103
+ this.audio.src = ''; // Clear audio source
104
+ }
105
+ async togglePlay() {
106
+ if (!this.checkIfTrackIsLoaded())
107
+ return;
108
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
109
+ this.audio.paused ? await this.audio.play() : this.audio.pause();
110
+ }
111
+ async previous() {
112
+ this.clearCurrentTime();
113
+ const totalTracks = this.tracks().length;
114
+ if (totalTracks === 0)
115
+ return;
116
+ const newIndex = (this.currentTrackIndex() - 1 + totalTracks) % totalTracks;
117
+ await this.playTrack(newIndex);
118
+ }
119
+ async next() {
120
+ this.clearCurrentTime();
121
+ const totalTracks = this.tracks().length;
122
+ if (totalTracks === 0)
123
+ return;
124
+ const newIndex = (this.currentTrackIndex() + 1) % totalTracks;
125
+ await this.playTrack(newIndex);
126
+ }
127
+ setTracks(tracks) {
128
+ this._tracks.set(tracks);
129
+ }
130
+ setCurrentTrackIndex(index) {
131
+ this._currentTrackIndex.set(index);
132
+ }
133
+ setPlaying(playing) {
134
+ this._isPlaying.set(playing);
135
+ this._isBuffering.set(false);
136
+ }
137
+ setAutoPlayNext(autoPlayNext) {
138
+ this._autoPlayNext.set(autoPlayNext);
139
+ }
140
+ setVolume(volume) {
141
+ this._volume.set(volume);
142
+ this.audio.volume = volume;
143
+ if (volume > 0)
144
+ this._lastVolume.set(volume);
145
+ localStorage.setItem('volume', JSON.stringify(this.volume()));
146
+ }
147
+ setMuted(muted) {
148
+ this._isMuted.set(muted);
149
+ if (muted) {
150
+ this._lastVolume.set(this.volume());
151
+ this.setVolume(0);
152
+ }
153
+ else {
154
+ this.setVolume(this._lastVolume());
155
+ }
156
+ localStorage.setItem('isMuted', JSON.stringify(this.isMuted()));
157
+ }
158
+ seekTo(time) {
159
+ this.audio.currentTime = time;
160
+ }
161
+ // Private handlers
162
+ updateDuration() {
163
+ this._duration.set(this.audio.duration);
164
+ this._isInitializing.set(false);
165
+ }
166
+ updateTime() {
167
+ this._currentTime.set(this.audio.currentTime);
168
+ }
169
+ handleEnded() {
170
+ this._isPlaying.set(false);
171
+ if (this._autoPlayNext())
172
+ this.next();
173
+ }
174
+ clearCurrentTime() {
175
+ this.audio.currentTime = 0;
176
+ this._currentTime.set(0);
177
+ }
178
+ restoreVolumeSettings() {
179
+ const volume = localStorage.getItem('volume');
180
+ const isMuted = localStorage.getItem('isMuted');
181
+ if (volume)
182
+ this.setVolume(JSON.parse(volume));
183
+ if (isMuted)
184
+ this.setMuted(JSON.parse(isMuted));
185
+ }
186
+ checkIfTrackIsLoaded() {
187
+ return this.audio.src !== '';
188
+ }
189
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: AudioPlayerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
190
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: AudioPlayerService, providedIn: 'root' });
191
+ }
192
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: AudioPlayerService, decorators: [{
193
+ type: Injectable,
194
+ args: [{ providedIn: 'root' }]
195
+ }], ctorParameters: () => [] });
196
+
197
+ class ButtonPlayComponent {
198
+ audioService = inject(AudioPlayerService);
199
+ isHovered = signal(false);
200
+ trackIndex = input.required();
201
+ onTogglePlay = output();
202
+ iconMusicNote = heroMusicalNoteMini;
203
+ iconPlay = matPlayArrow;
204
+ iconPause = matPause;
205
+ waveBars = [
206
+ { delay: '0.4s', class: 'h-1/5 animate-wave w-[2px] rounded-full bg-current' },
207
+ { delay: '0.3s', class: 'h-3/5 animate-wave w-[2px] rounded-full bg-current' },
208
+ { delay: '0.2s', class: 'h-full animate-wave w-[2px] rounded-full bg-current' },
209
+ { delay: '0.3s', class: 'h-3/5 animate-wave w-[2px] rounded-full bg-current' },
210
+ { delay: '0.4s', class: 'h-1/5 animate-wave w-[2px] rounded-full bg-current' },
211
+ ];
212
+ get ButtonClass() {
213
+ return cn('absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-200', {
214
+ 'opacity-100': (this.audioService.isPlaying() && this.trackIndex() === this.audioService.currentTrackIndex()) || this.isHovered(),
215
+ });
216
+ }
217
+ get WaveBarsClass() {
218
+ return cn('h-6 w-6 opacity-0 absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transition-opacity duration-200', {
219
+ 'opacity-100': this.audioService.isPlaying() && this.trackIndex() === this.audioService.currentTrackIndex() && !this.isHovered(),
220
+ });
221
+ }
222
+ get IconClass() {
223
+ return cn('opacity-0 absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transition-opacity duration-200', {
224
+ 'opacity-100': !this.audioService.isPlaying() || this.trackIndex() !== this.audioService.currentTrackIndex() || this.isHovered(),
225
+ });
226
+ }
227
+ get Icon() {
228
+ return this.audioService.isPlaying() && this.trackIndex() === this.audioService.currentTrackIndex() ? this.iconPause : this.iconPlay;
229
+ }
230
+ handleHover(isHovered) {
231
+ this.isHovered.set(isHovered);
232
+ }
233
+ async handleTogglePlay() {
234
+ if (this.trackIndex() !== undefined && this.trackIndex() !== this.audioService.currentTrackIndex()) {
235
+ await this.audioService.playTrack(this.trackIndex());
236
+ }
237
+ else {
238
+ await this.audioService.togglePlay();
239
+ }
240
+ this.onTogglePlay.emit();
241
+ }
242
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ButtonPlayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
243
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: ButtonPlayComponent, isStandalone: true, selector: "st-button-play", inputs: { trackIndex: { classPropertyName: "trackIndex", publicName: "trackIndex", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { onTogglePlay: "onTogglePlay" }, ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n\n<div\n\tclass=\"relative grid h-10 min-h-10 w-10 min-w-10 place-content-center rounded bg-gradient-to-br from-primary to-primary-content text-white\"\n\t(mouseenter)=\"handleHover(true)\"\n\t(mouseleave)=\"handleHover(false)\"\n>\n\t<st-icon [icon]=\"iconMusicNote\"></st-icon>\n\n\t<div [class]=\"ButtonClass\">\n\t\t<st-button [circle]=\"true\" size=\"sm\" [shadow]=\"true\" variant=\"secondary\" (click)=\"handleTogglePlay()\">\n\t\t\t<div class=\"relative h-full w-full\">\n\t\t\t\t<div [class]=\"WaveBarsClass\">\n\t\t\t\t\t<div class=\"flex h-full w-full items-center justify-between\">\n\t\t\t\t\t\t@for (bar of waveBars; track $index) {\n\t\t\t\t\t\t\t<div [class]=\"bar.class\" [style.--i]=\"bar.delay\"></div>\n\t\t\t\t\t\t}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div [class]=\"IconClass\">\n\t\t\t\t\t<st-icon [icon]=\"Icon\"></st-icon>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</st-button>\n\t</div>\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "classes", "icon"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: ButtonComponent, selector: "st-button", inputs: ["variant", "ghost", "outline", "circle", "square", "glass", "block", "loader", "size", "shadow", "icon", "iconPosition", "type", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
244
+ }
245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ButtonPlayComponent, decorators: [{
246
+ type: Component,
247
+ args: [{ selector: 'st-button-play', standalone: true, imports: [IconComponent, CommonModule, ButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n\n<div\n\tclass=\"relative grid h-10 min-h-10 w-10 min-w-10 place-content-center rounded bg-gradient-to-br from-primary to-primary-content text-white\"\n\t(mouseenter)=\"handleHover(true)\"\n\t(mouseleave)=\"handleHover(false)\"\n>\n\t<st-icon [icon]=\"iconMusicNote\"></st-icon>\n\n\t<div [class]=\"ButtonClass\">\n\t\t<st-button [circle]=\"true\" size=\"sm\" [shadow]=\"true\" variant=\"secondary\" (click)=\"handleTogglePlay()\">\n\t\t\t<div class=\"relative h-full w-full\">\n\t\t\t\t<div [class]=\"WaveBarsClass\">\n\t\t\t\t\t<div class=\"flex h-full w-full items-center justify-between\">\n\t\t\t\t\t\t@for (bar of waveBars; track $index) {\n\t\t\t\t\t\t\t<div [class]=\"bar.class\" [style.--i]=\"bar.delay\"></div>\n\t\t\t\t\t\t}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div [class]=\"IconClass\">\n\t\t\t\t\t<st-icon [icon]=\"Icon\"></st-icon>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</st-button>\n\t</div>\n</div>\n" }]
248
+ }] });
249
+
250
+ class AudioTimelineComponent {
251
+ timeline = viewChild('timeline');
252
+ audioService = inject(AudioPlayerService);
253
+ isDragging = signal(false);
254
+ isHovered = signal(false);
255
+ get timelineClass() {
256
+ return cn('relative h-1 w-full cursor-pointer rounded-full bg-neutral ', { 'h-[6px]': this.isHovered() || this.isDragging() });
257
+ }
258
+ get timelineCircleClass() {
259
+ return cn('transition-opacity duration-200 absolute top-1/2 h-3 w-3 -translate-y-1/2 transform cursor-grab rounded-full bg-tertiary shadow-main', this.isHovered() || this.isDragging() ? 'opacity-100' : 'opacity-0');
260
+ }
261
+ // Handle timeline hover
262
+ handleTimelineHover(isHovered) {
263
+ this.isHovered.set(isHovered);
264
+ }
265
+ // Start dragging
266
+ startDrag(event) {
267
+ event.preventDefault(); // Prevent default behavior
268
+ event.stopPropagation(); // Stop event propagation
269
+ this.isDragging.set(true);
270
+ this.updateProgress(event);
271
+ }
272
+ // Handle dragging
273
+ onDrag(event) {
274
+ if (this.isDragging()) {
275
+ this.updateProgress(event);
276
+ }
277
+ }
278
+ // Stop dragging
279
+ stopDrag() {
280
+ this.isDragging.set(false);
281
+ }
282
+ // Update progress based on mouse/touch position
283
+ updateProgress(event) {
284
+ const timelineRect = this.timeline()?.nativeElement.getBoundingClientRect();
285
+ if (!timelineRect)
286
+ return;
287
+ const clientX = this.getClientX(event);
288
+ const newProgress = Math.max(0, Math.min(1, (clientX - timelineRect.left) / timelineRect.width));
289
+ this.audioService.seekTo(newProgress * this.audioService.duration());
290
+ }
291
+ getClientX(event) {
292
+ return event instanceof MouseEvent ? event.clientX : event.touches[0].clientX;
293
+ }
294
+ seek(event) {
295
+ if (!this.isDragging()) {
296
+ this.updateProgress(event);
297
+ }
298
+ }
299
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: AudioTimelineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
300
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: AudioTimelineComponent, isStandalone: true, selector: "st-timeline", host: { listeners: { "document:mousemove": "onDrag($event)", "document:touchmove": "onDrag($event)", "document:mouseup": "stopDrag()", "document:touchend": "stopDrag()" } }, viewQueries: [{ propertyName: "timeline", first: true, predicate: ["timeline"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n\n<!-- Progress Bar -->\n<div class=\"grid w-full grid-cols-[1fr_5fr_1fr] items-center gap-4\">\n\t<!-- Current Time Display -->\n\t<div class=\"inline-flex min-h-5 select-none items-center justify-end text-tertiary\">\n\t\t@if (!audioService.isInitializing()) {\n\t\t\t@if (audioService.isBuffering()) {\n\t\t\t\t<span class=\"loading loading-ring loading-xs\"></span>\n\t\t\t} @else {\n\t\t\t\t<span typography tyVariant=\"body-sm\">{{ audioService.currentTime() | time }}</span>\n\t\t\t}\n\t\t}\n\t</div>\n\n\t<div [class]=\"timelineClass\" (click)=\"seek($event)\" #timeline (mouseenter)=\"handleTimelineHover(true)\" (mouseleave)=\"handleTimelineHover(false)\">\n\t\t<!-- Progress Bar Background -->\n\t\t<div class=\"absolute h-full rounded-full bg-primary\" [style.width]=\"(audioService.currentTime() / audioService.duration()) * 100 + '%'\"></div>\n\n\t\t<!-- Draggable Circle -->\n\t\t<div\n\t\t\t[style.left]=\"\n\t\t\t\t'calc(' +\n\t\t\t\t(audioService.currentTime() / audioService.duration()) * 100 +\n\t\t\t\t'% - ' +\n\t\t\t\t(audioService.currentTime() / audioService.duration() === 1 ? '6px' : '3px') +\n\t\t\t\t')'\n\t\t\t\"\n\t\t\t[class]=\"timelineCircleClass\"\n\t\t\t#circle\n\t\t\t(mousedown)=\"startDrag($event)\"\n\t\t\t(touchstart)=\"startDrag($event)\"\n\t\t></div>\n\t</div>\n\n\t<!-- Total Time Display -->\n\t<div class=\"inline-flex min-h-5 select-none items-center justify-start text-tertiary\">\n\t\t@if (audioService.isInitializing()) {\n\t\t\t<span class=\"loading loading-ring loading-xs\"></span>\n\t\t} @else {\n\t\t\t<span typography tyVariant=\"body-sm\">{{ audioService.duration() | time }}</span>\n\t\t}\n\t</div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: TimePipe, name: "time" }, { kind: "directive", type: TypographyDirective, selector: "[typography]", inputs: ["tyVariant", "tyColor", "tyFontWeight", "tyTextOverflow"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
301
+ }
302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: AudioTimelineComponent, decorators: [{
303
+ type: Component,
304
+ args: [{ selector: 'st-timeline', standalone: true, imports: [CommonModule, TimePipe, TypographyDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n\n<!-- Progress Bar -->\n<div class=\"grid w-full grid-cols-[1fr_5fr_1fr] items-center gap-4\">\n\t<!-- Current Time Display -->\n\t<div class=\"inline-flex min-h-5 select-none items-center justify-end text-tertiary\">\n\t\t@if (!audioService.isInitializing()) {\n\t\t\t@if (audioService.isBuffering()) {\n\t\t\t\t<span class=\"loading loading-ring loading-xs\"></span>\n\t\t\t} @else {\n\t\t\t\t<span typography tyVariant=\"body-sm\">{{ audioService.currentTime() | time }}</span>\n\t\t\t}\n\t\t}\n\t</div>\n\n\t<div [class]=\"timelineClass\" (click)=\"seek($event)\" #timeline (mouseenter)=\"handleTimelineHover(true)\" (mouseleave)=\"handleTimelineHover(false)\">\n\t\t<!-- Progress Bar Background -->\n\t\t<div class=\"absolute h-full rounded-full bg-primary\" [style.width]=\"(audioService.currentTime() / audioService.duration()) * 100 + '%'\"></div>\n\n\t\t<!-- Draggable Circle -->\n\t\t<div\n\t\t\t[style.left]=\"\n\t\t\t\t'calc(' +\n\t\t\t\t(audioService.currentTime() / audioService.duration()) * 100 +\n\t\t\t\t'% - ' +\n\t\t\t\t(audioService.currentTime() / audioService.duration() === 1 ? '6px' : '3px') +\n\t\t\t\t')'\n\t\t\t\"\n\t\t\t[class]=\"timelineCircleClass\"\n\t\t\t#circle\n\t\t\t(mousedown)=\"startDrag($event)\"\n\t\t\t(touchstart)=\"startDrag($event)\"\n\t\t></div>\n\t</div>\n\n\t<!-- Total Time Display -->\n\t<div class=\"inline-flex min-h-5 select-none items-center justify-start text-tertiary\">\n\t\t@if (audioService.isInitializing()) {\n\t\t\t<span class=\"loading loading-ring loading-xs\"></span>\n\t\t} @else {\n\t\t\t<span typography tyVariant=\"body-sm\">{{ audioService.duration() | time }}</span>\n\t\t}\n\t</div>\n</div>\n" }]
305
+ }], propDecorators: { onDrag: [{
306
+ type: HostListener,
307
+ args: ['document:mousemove', ['$event']]
308
+ }, {
309
+ type: HostListener,
310
+ args: ['document:touchmove', ['$event']]
311
+ }], stopDrag: [{
312
+ type: HostListener,
313
+ args: ['document:mouseup']
314
+ }, {
315
+ type: HostListener,
316
+ args: ['document:touchend']
317
+ }] } });
318
+
319
+ class TrackInfoComponent {
320
+ currentTrack = input();
321
+ iconMusicNote = heroMusicalNoteMini;
322
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TrackInfoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
323
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.12", type: TrackInfoComponent, isStandalone: true, selector: "st-track-info", inputs: { currentTrack: { classPropertyName: "currentTrack", publicName: "currentTrack", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n\n<div class=\"relative flex max-w-80 items-center gap-4 overflow-x-hidden whitespace-nowrap\">\n\t<div class=\"flex items-center gap-3\">\n\t\t<!-- Album/Track Icon -->\n\t\t<div class=\"grid h-12 min-h-12 w-12 min-w-12 place-content-center rounded bg-gradient-to-br from-primary to-primary-content text-white\">\n\t\t\t<st-icon [icon]=\"iconMusicNote\"></st-icon>\n\t\t</div>\n\n\t\t<!-- Track Info -->\n\t\t@let currentTrackVar = this.currentTrack();\n\t\t<div class=\"min-w-0 flex-1\">\n\t\t\t<p typography tyVariant=\"body\" tyFontWeight=\"medium\" tyColor=\"base\">\n\t\t\t\t{{ currentTrackVar?.title ?? 'No title' }}\n\t\t\t</p>\n\t\t\t<p typography tyVariant=\"body-sm\" tyFontWeight=\"normal\" tyColor=\"base\">\n\t\t\t\t{{ currentTrackVar?.description ?? 'No description' }}\n\t\t\t</p>\n\t\t</div>\n\t</div>\n\t<div class=\"pointer-events-none absolute inset-y-0 right-0 w-12 bg-gradient-to-l from-base-200 to-transparent\"></div>\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "classes", "icon"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TypographyDirective, selector: "[typography]", inputs: ["tyVariant", "tyColor", "tyFontWeight", "tyTextOverflow"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
324
+ }
325
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TrackInfoComponent, decorators: [{
326
+ type: Component,
327
+ args: [{ selector: 'st-track-info', standalone: true, imports: [IconComponent, CommonModule, TypographyDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n\n<div class=\"relative flex max-w-80 items-center gap-4 overflow-x-hidden whitespace-nowrap\">\n\t<div class=\"flex items-center gap-3\">\n\t\t<!-- Album/Track Icon -->\n\t\t<div class=\"grid h-12 min-h-12 w-12 min-w-12 place-content-center rounded bg-gradient-to-br from-primary to-primary-content text-white\">\n\t\t\t<st-icon [icon]=\"iconMusicNote\"></st-icon>\n\t\t</div>\n\n\t\t<!-- Track Info -->\n\t\t@let currentTrackVar = this.currentTrack();\n\t\t<div class=\"min-w-0 flex-1\">\n\t\t\t<p typography tyVariant=\"body\" tyFontWeight=\"medium\" tyColor=\"base\">\n\t\t\t\t{{ currentTrackVar?.title ?? 'No title' }}\n\t\t\t</p>\n\t\t\t<p typography tyVariant=\"body-sm\" tyFontWeight=\"normal\" tyColor=\"base\">\n\t\t\t\t{{ currentTrackVar?.description ?? 'No description' }}\n\t\t\t</p>\n\t\t</div>\n\t</div>\n\t<div class=\"pointer-events-none absolute inset-y-0 right-0 w-12 bg-gradient-to-l from-base-200 to-transparent\"></div>\n</div>\n" }]
328
+ }] });
329
+
330
+ class VolumeControlComponent {
331
+ volumeTimeline = viewChild('volumeTimeline');
332
+ audioService = inject(AudioPlayerService);
333
+ isVolumeDragging = signal(false);
334
+ isVolumeHovered = signal(false);
335
+ iconVolumeUp = matVolumeUpOutline;
336
+ iconVolumeDown = matVolumeDownOutline;
337
+ iconVolumeMute = matVolumeMuteOutline;
338
+ get volumeTimelineClass() {
339
+ return cn('relative h-1 w-20 cursor-pointer rounded-full bg-neutral', { 'h-[6px]': this.isVolumeHovered() || this.isVolumeDragging() });
340
+ }
341
+ get volumeTimelineCircleClass() {
342
+ return cn('absolute top-1/2 h-3 w-3 -translate-y-1/2 transform cursor-grab rounded-full bg-tertiary shadow-main transition-opacity duration-200', this.isVolumeHovered() || this.isVolumeDragging() ? 'opacity-100' : 'opacity-0');
343
+ }
344
+ // Handle volume hover
345
+ handleVolumeHover(isHovered) {
346
+ this.isVolumeHovered.set(isHovered);
347
+ }
348
+ // Start volume drag
349
+ startVolumeDrag(event) {
350
+ event.preventDefault(); // Prevent default behavior
351
+ event.stopPropagation(); // Prevent event propagation
352
+ this.isVolumeDragging.set(true);
353
+ this.updateVolume(event);
354
+ }
355
+ // Handle volume drag
356
+ onVolumeDrag(event) {
357
+ if (this.isVolumeDragging()) {
358
+ this.updateVolume(event);
359
+ }
360
+ }
361
+ // Stop volume drag
362
+ stopVolumeDrag() {
363
+ this.isVolumeDragging.set(false);
364
+ }
365
+ getClientX(event) {
366
+ return event instanceof MouseEvent ? event.clientX : event.touches[0].clientX;
367
+ }
368
+ updateVolume(event) {
369
+ const volumeTimelineRect = this.volumeTimeline()?.nativeElement.getBoundingClientRect();
370
+ if (!volumeTimelineRect)
371
+ return;
372
+ const clientX = this.getClientX(event);
373
+ const newVolume = Math.max(0, Math.min(1, (clientX - volumeTimelineRect.left) / volumeTimelineRect.width));
374
+ this.audioService.setVolume(newVolume);
375
+ }
376
+ // Seek volume on click
377
+ seekVolume(event) {
378
+ if (!this.isVolumeDragging()) {
379
+ this.updateVolume(event);
380
+ }
381
+ }
382
+ toggleMute() {
383
+ this.audioService.setMuted(!this.audioService.isMuted());
384
+ }
385
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: VolumeControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
386
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: VolumeControlComponent, isStandalone: true, selector: "st-volume-control", host: { listeners: { "document:mousemove": "onVolumeDrag($event)", "document:touchmove": "onVolumeDrag($event)", "document:mouseup": "stopVolumeDrag()", "document:touchend": "stopVolumeDrag()" } }, viewQueries: [{ propertyName: "volumeTimeline", first: true, predicate: ["volumeTimeline"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n\n<!-- Volume Control -->\n<div class=\"flex items-center justify-end gap-2\">\n\t<!-- Mute/Unmute Button -->\n\t<st-button [ghost]=\"true\" size=\"sm\" [circle]=\"true\" (click)=\"toggleMute()\">\n\t\t@if (audioService.volume() === 0) {\n\t\t\t<st-icon [icon]=\"iconVolumeMute\"></st-icon>\n\t\t} @else if (audioService.volume() > 0.5) {\n\t\t\t<st-icon [icon]=\"iconVolumeUp\"></st-icon>\n\t\t} @else {\n\t\t\t<st-icon [icon]=\"iconVolumeDown\"></st-icon>\n\t\t}\n\t</st-button>\n\n\t<!-- Custom Volume Progress Bar -->\n\t<div\n\t\t[class]=\"volumeTimelineClass\"\n\t\t(click)=\"seekVolume($event)\"\n\t\t#volumeTimeline\n\t\t(mouseenter)=\"handleVolumeHover(true)\"\n\t\t(mouseleave)=\"handleVolumeHover(false)\"\n\t>\n\t\t<!-- Volume Progress Bar Background -->\n\t\t<div class=\"absolute h-full rounded-full bg-primary\" [style.width]=\"audioService.volume() * 100 + '%'\"></div>\n\n\t\t<!-- Draggable Volume Circle -->\n\t\t<div\n\t\t\t[style.left]=\"'calc(' + audioService.volume() * 100 + '% - ' + (audioService.volume() === 1 ? '6px' : '3px') + ')'\"\n\t\t\t[class]=\"volumeTimelineCircleClass\"\n\t\t\t#volumeCircle\n\t\t\t(mousedown)=\"startVolumeDrag($event)\"\n\t\t\t(touchstart)=\"startVolumeDrag($event)\"\n\t\t></div>\n\t</div>\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "classes", "icon"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: ButtonComponent, selector: "st-button", inputs: ["variant", "ghost", "outline", "circle", "square", "glass", "block", "loader", "size", "shadow", "icon", "iconPosition", "type", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
387
+ }
388
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: VolumeControlComponent, decorators: [{
389
+ type: Component,
390
+ args: [{ selector: 'st-volume-control', standalone: true, imports: [IconComponent, CommonModule, ButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n\n<!-- Volume Control -->\n<div class=\"flex items-center justify-end gap-2\">\n\t<!-- Mute/Unmute Button -->\n\t<st-button [ghost]=\"true\" size=\"sm\" [circle]=\"true\" (click)=\"toggleMute()\">\n\t\t@if (audioService.volume() === 0) {\n\t\t\t<st-icon [icon]=\"iconVolumeMute\"></st-icon>\n\t\t} @else if (audioService.volume() > 0.5) {\n\t\t\t<st-icon [icon]=\"iconVolumeUp\"></st-icon>\n\t\t} @else {\n\t\t\t<st-icon [icon]=\"iconVolumeDown\"></st-icon>\n\t\t}\n\t</st-button>\n\n\t<!-- Custom Volume Progress Bar -->\n\t<div\n\t\t[class]=\"volumeTimelineClass\"\n\t\t(click)=\"seekVolume($event)\"\n\t\t#volumeTimeline\n\t\t(mouseenter)=\"handleVolumeHover(true)\"\n\t\t(mouseleave)=\"handleVolumeHover(false)\"\n\t>\n\t\t<!-- Volume Progress Bar Background -->\n\t\t<div class=\"absolute h-full rounded-full bg-primary\" [style.width]=\"audioService.volume() * 100 + '%'\"></div>\n\n\t\t<!-- Draggable Volume Circle -->\n\t\t<div\n\t\t\t[style.left]=\"'calc(' + audioService.volume() * 100 + '% - ' + (audioService.volume() === 1 ? '6px' : '3px') + ')'\"\n\t\t\t[class]=\"volumeTimelineCircleClass\"\n\t\t\t#volumeCircle\n\t\t\t(mousedown)=\"startVolumeDrag($event)\"\n\t\t\t(touchstart)=\"startVolumeDrag($event)\"\n\t\t></div>\n\t</div>\n</div>\n" }]
391
+ }], propDecorators: { onVolumeDrag: [{
392
+ type: HostListener,
393
+ args: ['document:mousemove', ['$event']]
394
+ }, {
395
+ type: HostListener,
396
+ args: ['document:touchmove', ['$event']]
397
+ }], stopVolumeDrag: [{
398
+ type: HostListener,
399
+ args: ['document:mouseup']
400
+ }, {
401
+ type: HostListener,
402
+ args: ['document:touchend']
403
+ }] } });
404
+
405
+ class AudioPlayerComponent {
406
+ variant = input('default');
407
+ opened = input(false);
408
+ trackListTitle = input('Tracks');
409
+ currentTrackIndex = model(-1);
410
+ tracks = input([]);
411
+ showTrackList = input(false);
412
+ iconSkipPrevious = matSkipPrevious;
413
+ iconSkipNext = matSkipNext;
414
+ iconPlay = matPlayArrow;
415
+ iconPause = matPause;
416
+ iconMusicNote = heroMusicalNoteMini;
417
+ shadow = input(false);
418
+ audioPlayerService = inject(AudioPlayerService);
419
+ constructor() {
420
+ // Sync tracks with service
421
+ effect(() => {
422
+ this.audioPlayerService.setTracks(this.tracks());
423
+ }, { allowSignalWrites: true });
424
+ // One-way sync from service to component
425
+ effect(() => {
426
+ this.currentTrackIndex.set(this.audioPlayerService.currentTrackIndex());
427
+ }, { allowSignalWrites: true });
428
+ }
429
+ get playerClass() {
430
+ return cn('grid w-full grid-cols-[2fr_3fr_1fr] items-center gap-4', {
431
+ 'shadow-main': this.shadow(),
432
+ }, {
433
+ 'fixed bottom-0 left-0 bg-base-200 p-4 z-50 border-t border-neutral': this.variant() === 'fixed',
434
+ }, {
435
+ 'animate-fade-in-up animate-steps-modern animate-duration-300': this.opened() && this.variant() === 'fixed',
436
+ }, {
437
+ 'animate-fade-out-down animate-steps-modern animate-duration-300': !this.opened() && this.variant() === 'fixed',
438
+ });
439
+ }
440
+ get currentTrack() {
441
+ const tracks = this.tracks();
442
+ return this.currentTrackIndex() >= 0 && tracks ? tracks[this.currentTrackIndex()] : undefined;
443
+ }
444
+ // Simplify methods to call service
445
+ async playTrack(index) {
446
+ await this.audioPlayerService.playTrack(index);
447
+ }
448
+ async togglePlay() {
449
+ await this.audioPlayerService.togglePlay();
450
+ }
451
+ async previous() {
452
+ await this.audioPlayerService.previous();
453
+ }
454
+ async next() {
455
+ await this.audioPlayerService.next();
456
+ }
457
+ ngOnDestroy() {
458
+ this.audioPlayerService.cleanup();
459
+ }
460
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: AudioPlayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
461
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: AudioPlayerComponent, isStandalone: true, selector: "st-audio-player", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, opened: { classPropertyName: "opened", publicName: "opened", isSignal: true, isRequired: false, transformFunction: null }, trackListTitle: { classPropertyName: "trackListTitle", publicName: "trackListTitle", isSignal: true, isRequired: false, transformFunction: null }, currentTrackIndex: { classPropertyName: "currentTrackIndex", publicName: "currentTrackIndex", isSignal: true, isRequired: false, transformFunction: null }, tracks: { classPropertyName: "tracks", publicName: "tracks", isSignal: true, isRequired: false, transformFunction: null }, showTrackList: { classPropertyName: "showTrackList", publicName: "showTrackList", isSignal: true, isRequired: false, transformFunction: null }, shadow: { classPropertyName: "shadow", publicName: "shadow", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { currentTrackIndex: "currentTrackIndexChange" }, ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n\n<div class=\"flex w-full flex-col gap-4\">\n\t<!-- Track List -->\n\t@if (showTrackList()) {\n\t\t<div class=\"mb-4 rounded-box border border-neutral shadow-sm\">\n\t\t\t<div class=\"p-4\">\n\t\t\t\t<h4 typography tyVariant=\"h4\">{{ trackListTitle() }}</h4>\n\t\t\t\t<div class=\"max-h-[300px] space-y-2 overflow-y-auto\">\n\t\t\t\t\t@for (track of tracks(); track $index; let i = $index) {\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclass=\"flex cursor-pointer items-center gap-2 rounded-btn p-2 hover:bg-base-300\"\n\t\t\t\t\t\t\t[class.bg-base-300]=\"audioPlayerService.currentTrackIndex() === i\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<st-button-play [trackIndex]=\"i\"> </st-button-play>\n\t\t\t\t\t\t\t<div class=\"flex-1\">\n\t\t\t\t\t\t\t\t<div typography tyVariant=\"body\">{{ track.title }}</div>\n\t\t\t\t\t\t\t\t<div typography tyVariant=\"body-sm\">{{ track.description }}</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t}\n\n\t<div [class]=\"playerClass\">\n\t\t<!-- track info -->\n\t\t<st-track-info [currentTrack]=\"currentTrack\"></st-track-info>\n\n\t\t<div class=\"grid items-center\">\n\t\t\t<!-- Controls -->\n\t\t\t<div class=\"flex items-center justify-center gap-2\">\n\t\t\t\t<st-button (click)=\"previous()\" [ghost]=\"true\" [icon]=\"iconSkipPrevious\" [circle]=\"true\" size=\"sm\"> </st-button>\n\n\t\t\t\t<st-button (click)=\"togglePlay()\" [icon]=\"audioPlayerService.isPlaying() ? iconPause : iconPlay\" [circle]=\"true\" size=\"sm\" [shadow]=\"true\">\n\t\t\t\t</st-button>\n\n\t\t\t\t<st-button (click)=\"next()\" [ghost]=\"true\" [icon]=\"iconSkipNext\" [circle]=\"true\" size=\"sm\"> </st-button>\n\t\t\t</div>\n\n\t\t\t<!-- Progress Bar -->\n\t\t\t<st-timeline></st-timeline>\n\t\t</div>\n\n\t\t<!-- Volume Control -->\n\t\t<st-volume-control></st-volume-control>\n\t</div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: ButtonComponent, selector: "st-button", inputs: ["variant", "ghost", "outline", "circle", "square", "glass", "block", "loader", "size", "shadow", "icon", "iconPosition", "type", "disabled"] }, { kind: "directive", type: TypographyDirective, selector: "[typography]", inputs: ["tyVariant", "tyColor", "tyFontWeight", "tyTextOverflow"] }, { kind: "component", type: VolumeControlComponent, selector: "st-volume-control" }, { kind: "component", type: TrackInfoComponent, selector: "st-track-info", inputs: ["currentTrack"] }, { kind: "component", type: AudioTimelineComponent, selector: "st-timeline" }, { kind: "component", type: ButtonPlayComponent, selector: "st-button-play", inputs: ["trackIndex"], outputs: ["onTogglePlay"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
462
+ }
463
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: AudioPlayerComponent, decorators: [{
464
+ type: Component,
465
+ args: [{ selector: 'st-audio-player', standalone: true, imports: [
466
+ CommonModule,
467
+ ButtonComponent,
468
+ TypographyDirective,
469
+ VolumeControlComponent,
470
+ TrackInfoComponent,
471
+ AudioTimelineComponent,
472
+ ButtonPlayComponent,
473
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n\n<div class=\"flex w-full flex-col gap-4\">\n\t<!-- Track List -->\n\t@if (showTrackList()) {\n\t\t<div class=\"mb-4 rounded-box border border-neutral shadow-sm\">\n\t\t\t<div class=\"p-4\">\n\t\t\t\t<h4 typography tyVariant=\"h4\">{{ trackListTitle() }}</h4>\n\t\t\t\t<div class=\"max-h-[300px] space-y-2 overflow-y-auto\">\n\t\t\t\t\t@for (track of tracks(); track $index; let i = $index) {\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclass=\"flex cursor-pointer items-center gap-2 rounded-btn p-2 hover:bg-base-300\"\n\t\t\t\t\t\t\t[class.bg-base-300]=\"audioPlayerService.currentTrackIndex() === i\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<st-button-play [trackIndex]=\"i\"> </st-button-play>\n\t\t\t\t\t\t\t<div class=\"flex-1\">\n\t\t\t\t\t\t\t\t<div typography tyVariant=\"body\">{{ track.title }}</div>\n\t\t\t\t\t\t\t\t<div typography tyVariant=\"body-sm\">{{ track.description }}</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t}\n\n\t<div [class]=\"playerClass\">\n\t\t<!-- track info -->\n\t\t<st-track-info [currentTrack]=\"currentTrack\"></st-track-info>\n\n\t\t<div class=\"grid items-center\">\n\t\t\t<!-- Controls -->\n\t\t\t<div class=\"flex items-center justify-center gap-2\">\n\t\t\t\t<st-button (click)=\"previous()\" [ghost]=\"true\" [icon]=\"iconSkipPrevious\" [circle]=\"true\" size=\"sm\"> </st-button>\n\n\t\t\t\t<st-button (click)=\"togglePlay()\" [icon]=\"audioPlayerService.isPlaying() ? iconPause : iconPlay\" [circle]=\"true\" size=\"sm\" [shadow]=\"true\">\n\t\t\t\t</st-button>\n\n\t\t\t\t<st-button (click)=\"next()\" [ghost]=\"true\" [icon]=\"iconSkipNext\" [circle]=\"true\" size=\"sm\"> </st-button>\n\t\t\t</div>\n\n\t\t\t<!-- Progress Bar -->\n\t\t\t<st-timeline></st-timeline>\n\t\t</div>\n\n\t\t<!-- Volume Control -->\n\t\t<st-volume-control></st-volume-control>\n\t</div>\n</div>\n" }]
474
+ }], ctorParameters: () => [] });
475
+
476
+ /**
477
+ * Generated bundle index. Do not edit.
478
+ */
479
+
480
+ export { AudioPlayerComponent, AudioPlayerService, ButtonPlayComponent };
481
+ //# sourceMappingURL=sixbell-telco-sdk-components-audio-player.mjs.map