@testgorilla/tgo-ui 9.3.3 → 10.1.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/fesm2022/testgorilla-tgo-ui-components-accordion.mjs +8 -8
- package/fesm2022/testgorilla-tgo-ui-components-accordion.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-ai-audio-circle.mjs +15 -15
- package/fesm2022/testgorilla-tgo-ui-components-ai-audio-circle.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-ai-caveat.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-ai-feedback.mjs +23 -23
- package/fesm2022/testgorilla-tgo-ui-components-ai-feedback.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-alert-banner.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-audio-waveform.mjs +23 -23
- package/fesm2022/testgorilla-tgo-ui-components-audio-waveform.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-autocomplete-v2.mjs +84 -84
- package/fesm2022/testgorilla-tgo-ui-components-autocomplete-v2.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-autocomplete.mjs +21 -21
- package/fesm2022/testgorilla-tgo-ui-components-autocomplete.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-avatar.mjs +10 -10
- package/fesm2022/testgorilla-tgo-ui-components-badge.mjs +10 -10
- package/fesm2022/testgorilla-tgo-ui-components-badge.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-breadcrumb.mjs +20 -20
- package/fesm2022/testgorilla-tgo-ui-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-button.mjs +8 -8
- package/fesm2022/testgorilla-tgo-ui-components-card.mjs +8 -8
- package/fesm2022/testgorilla-tgo-ui-components-card.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-checkbox.mjs +12 -12
- package/fesm2022/testgorilla-tgo-ui-components-checkbox.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-checklist.mjs +15 -15
- package/fesm2022/testgorilla-tgo-ui-components-checklist.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-core.mjs +44 -44
- package/fesm2022/testgorilla-tgo-ui-components-core.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-datepicker.mjs +20 -20
- package/fesm2022/testgorilla-tgo-ui-components-datepicker.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-dialog.mjs +25 -25
- package/fesm2022/testgorilla-tgo-ui-components-dialog.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-divider.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-donut-chart.mjs +10 -10
- package/fesm2022/testgorilla-tgo-ui-components-donut-chart.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-dropdown.mjs +11 -11
- package/fesm2022/testgorilla-tgo-ui-components-dropdown.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-elevation-shadow.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-empty-state.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-field.mjs +14 -14
- package/fesm2022/testgorilla-tgo-ui-components-field.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-file-upload.mjs +10 -10
- package/fesm2022/testgorilla-tgo-ui-components-filter-button.mjs +20 -20
- package/fesm2022/testgorilla-tgo-ui-components-filter-button.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-gaussian-chart.mjs +8 -8
- package/fesm2022/testgorilla-tgo-ui-components-gaussian-chart.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-icon-label.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-icon.mjs +23 -15
- package/fesm2022/testgorilla-tgo-ui-components-icon.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-infinite-scroll-table.mjs +369 -0
- package/fesm2022/testgorilla-tgo-ui-components-infinite-scroll-table.mjs.map +1 -0
- package/fesm2022/testgorilla-tgo-ui-components-inline-field.mjs +33 -33
- package/fesm2022/testgorilla-tgo-ui-components-inline-field.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-logo.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-media-card.mjs +3 -3
- package/fesm2022/testgorilla-tgo-ui-components-media-dialog.mjs +3 -3
- package/fesm2022/testgorilla-tgo-ui-components-multi-input.mjs +23 -23
- package/fesm2022/testgorilla-tgo-ui-components-multi-input.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-navbar.mjs +14 -14
- package/fesm2022/testgorilla-tgo-ui-components-navbar.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-overflow-menu.mjs +10 -10
- package/fesm2022/testgorilla-tgo-ui-components-overflow-menu.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-page-header.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-paginator.mjs +8 -8
- package/fesm2022/testgorilla-tgo-ui-components-password-criteria.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-password-strength.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-phone-input.mjs +12 -12
- package/fesm2022/testgorilla-tgo-ui-components-phone-input.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-popover.mjs +15 -15
- package/fesm2022/testgorilla-tgo-ui-components-popover.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-progress-bar.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-prompt.mjs +42 -42
- package/fesm2022/testgorilla-tgo-ui-components-prompt.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-radial-progress.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-radio-button.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-rating.mjs +10 -10
- package/fesm2022/testgorilla-tgo-ui-components-scale-table.mjs +8 -8
- package/fesm2022/testgorilla-tgo-ui-components-scale-table.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-scale.mjs +8 -8
- package/fesm2022/testgorilla-tgo-ui-components-scale.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-segmented-bar.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-segmented-button.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-segmented-toggle.mjs +17 -17
- package/fesm2022/testgorilla-tgo-ui-components-segmented-toggle.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-selectable-card.mjs +14 -14
- package/fesm2022/testgorilla-tgo-ui-components-selectable-card.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-side-navigation.mjs +31 -31
- package/fesm2022/testgorilla-tgo-ui-components-side-navigation.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-side-panel.mjs +12 -12
- package/fesm2022/testgorilla-tgo-ui-components-side-panel.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-side-sheet.mjs +12 -12
- package/fesm2022/testgorilla-tgo-ui-components-side-sheet.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-skeleton.mjs +3 -3
- package/fesm2022/testgorilla-tgo-ui-components-slider.mjs +12 -12
- package/fesm2022/testgorilla-tgo-ui-components-slider.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-snackbar.mjs +10 -10
- package/fesm2022/testgorilla-tgo-ui-components-spider-chart.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-spinner.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-stepper.mjs +21 -21
- package/fesm2022/testgorilla-tgo-ui-components-stepper.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-table.mjs +11 -11
- package/fesm2022/testgorilla-tgo-ui-components-tabs.mjs +25 -25
- package/fesm2022/testgorilla-tgo-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-tag.mjs +26 -26
- package/fesm2022/testgorilla-tgo-ui-components-tag.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-toggle.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-tooltip.mjs +10 -10
- package/fesm2022/testgorilla-tgo-ui-components-universal-skills.mjs +17 -17
- package/fesm2022/testgorilla-tgo-ui-components-validation-error.mjs +7 -7
- package/fesm2022/testgorilla-tgo-ui-components-write-with-ai.mjs +40 -40
- package/fesm2022/testgorilla-tgo-ui-components-write-with-ai.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui.mjs +7 -7
- package/mcp/catalog.json +1 -1
- package/package.json +96 -101
- package/projects/tgo-canopy-ui/assets/icons/rebrand/Grid-list-view-filled.svg +3 -0
- package/projects/tgo-canopy-ui/assets/icons/rebrand/Grid-list-view-in-line.svg +3 -0
- package/projects/tgo-canopy-ui/assets/icons/rebrand/Table-view-filled.svg +3 -0
- package/projects/tgo-canopy-ui/assets/icons/rebrand/Table-view-in-line.svg +3 -0
- package/{components/icon/index.d.ts → types/testgorilla-tgo-ui-components-icon.d.ts} +1 -1
- package/types/testgorilla-tgo-ui-components-infinite-scroll-table.d.ts +225 -0
- package/{components/inline-field/index.d.ts → types/testgorilla-tgo-ui-components-inline-field.d.ts} +8 -7
- package/{components/side-sheet/index.d.ts → types/testgorilla-tgo-ui-components-side-sheet.d.ts} +1 -1
- /package/{components/accordion/index.d.ts → types/testgorilla-tgo-ui-components-accordion.d.ts} +0 -0
- /package/{components/ai-audio-circle/index.d.ts → types/testgorilla-tgo-ui-components-ai-audio-circle.d.ts} +0 -0
- /package/{components/ai-caveat/index.d.ts → types/testgorilla-tgo-ui-components-ai-caveat.d.ts} +0 -0
- /package/{components/ai-feedback/index.d.ts → types/testgorilla-tgo-ui-components-ai-feedback.d.ts} +0 -0
- /package/{components/alert-banner/index.d.ts → types/testgorilla-tgo-ui-components-alert-banner.d.ts} +0 -0
- /package/{components/audio-waveform/index.d.ts → types/testgorilla-tgo-ui-components-audio-waveform.d.ts} +0 -0
- /package/{components/autocomplete-v2/index.d.ts → types/testgorilla-tgo-ui-components-autocomplete-v2.d.ts} +0 -0
- /package/{components/autocomplete/index.d.ts → types/testgorilla-tgo-ui-components-autocomplete.d.ts} +0 -0
- /package/{components/avatar/index.d.ts → types/testgorilla-tgo-ui-components-avatar.d.ts} +0 -0
- /package/{components/badge/index.d.ts → types/testgorilla-tgo-ui-components-badge.d.ts} +0 -0
- /package/{components/breadcrumb/index.d.ts → types/testgorilla-tgo-ui-components-breadcrumb.d.ts} +0 -0
- /package/{components/button/index.d.ts → types/testgorilla-tgo-ui-components-button.d.ts} +0 -0
- /package/{components/card/index.d.ts → types/testgorilla-tgo-ui-components-card.d.ts} +0 -0
- /package/{components/checkbox/index.d.ts → types/testgorilla-tgo-ui-components-checkbox.d.ts} +0 -0
- /package/{components/checklist/index.d.ts → types/testgorilla-tgo-ui-components-checklist.d.ts} +0 -0
- /package/{components/core/index.d.ts → types/testgorilla-tgo-ui-components-core.d.ts} +0 -0
- /package/{components/datepicker/index.d.ts → types/testgorilla-tgo-ui-components-datepicker.d.ts} +0 -0
- /package/{components/dialog/index.d.ts → types/testgorilla-tgo-ui-components-dialog.d.ts} +0 -0
- /package/{components/divider/index.d.ts → types/testgorilla-tgo-ui-components-divider.d.ts} +0 -0
- /package/{components/donut-chart/index.d.ts → types/testgorilla-tgo-ui-components-donut-chart.d.ts} +0 -0
- /package/{components/dropdown/index.d.ts → types/testgorilla-tgo-ui-components-dropdown.d.ts} +0 -0
- /package/{components/elevation-shadow/index.d.ts → types/testgorilla-tgo-ui-components-elevation-shadow.d.ts} +0 -0
- /package/{components/empty-state/index.d.ts → types/testgorilla-tgo-ui-components-empty-state.d.ts} +0 -0
- /package/{components/field/index.d.ts → types/testgorilla-tgo-ui-components-field.d.ts} +0 -0
- /package/{components/file-upload/index.d.ts → types/testgorilla-tgo-ui-components-file-upload.d.ts} +0 -0
- /package/{components/filter-button/index.d.ts → types/testgorilla-tgo-ui-components-filter-button.d.ts} +0 -0
- /package/{components/gaussian-chart/index.d.ts → types/testgorilla-tgo-ui-components-gaussian-chart.d.ts} +0 -0
- /package/{components/icon-label/index.d.ts → types/testgorilla-tgo-ui-components-icon-label.d.ts} +0 -0
- /package/{components/logo/index.d.ts → types/testgorilla-tgo-ui-components-logo.d.ts} +0 -0
- /package/{components/media-card/index.d.ts → types/testgorilla-tgo-ui-components-media-card.d.ts} +0 -0
- /package/{components/media-dialog/index.d.ts → types/testgorilla-tgo-ui-components-media-dialog.d.ts} +0 -0
- /package/{components/multi-input/index.d.ts → types/testgorilla-tgo-ui-components-multi-input.d.ts} +0 -0
- /package/{components/navbar/index.d.ts → types/testgorilla-tgo-ui-components-navbar.d.ts} +0 -0
- /package/{components/overflow-menu/index.d.ts → types/testgorilla-tgo-ui-components-overflow-menu.d.ts} +0 -0
- /package/{components/page-header/index.d.ts → types/testgorilla-tgo-ui-components-page-header.d.ts} +0 -0
- /package/{components/paginator/index.d.ts → types/testgorilla-tgo-ui-components-paginator.d.ts} +0 -0
- /package/{components/password-criteria/index.d.ts → types/testgorilla-tgo-ui-components-password-criteria.d.ts} +0 -0
- /package/{components/password-strength/index.d.ts → types/testgorilla-tgo-ui-components-password-strength.d.ts} +0 -0
- /package/{components/phone-input/index.d.ts → types/testgorilla-tgo-ui-components-phone-input.d.ts} +0 -0
- /package/{components/popover/index.d.ts → types/testgorilla-tgo-ui-components-popover.d.ts} +0 -0
- /package/{components/progress-bar/index.d.ts → types/testgorilla-tgo-ui-components-progress-bar.d.ts} +0 -0
- /package/{components/prompt/index.d.ts → types/testgorilla-tgo-ui-components-prompt.d.ts} +0 -0
- /package/{components/radial-progress/index.d.ts → types/testgorilla-tgo-ui-components-radial-progress.d.ts} +0 -0
- /package/{components/radio-button/index.d.ts → types/testgorilla-tgo-ui-components-radio-button.d.ts} +0 -0
- /package/{components/rating/index.d.ts → types/testgorilla-tgo-ui-components-rating.d.ts} +0 -0
- /package/{components/scale-table/index.d.ts → types/testgorilla-tgo-ui-components-scale-table.d.ts} +0 -0
- /package/{components/scale/index.d.ts → types/testgorilla-tgo-ui-components-scale.d.ts} +0 -0
- /package/{components/segmented-bar/index.d.ts → types/testgorilla-tgo-ui-components-segmented-bar.d.ts} +0 -0
- /package/{components/segmented-button/index.d.ts → types/testgorilla-tgo-ui-components-segmented-button.d.ts} +0 -0
- /package/{components/segmented-toggle/index.d.ts → types/testgorilla-tgo-ui-components-segmented-toggle.d.ts} +0 -0
- /package/{components/selectable-card/index.d.ts → types/testgorilla-tgo-ui-components-selectable-card.d.ts} +0 -0
- /package/{components/side-navigation/index.d.ts → types/testgorilla-tgo-ui-components-side-navigation.d.ts} +0 -0
- /package/{components/side-panel/index.d.ts → types/testgorilla-tgo-ui-components-side-panel.d.ts} +0 -0
- /package/{components/skeleton/index.d.ts → types/testgorilla-tgo-ui-components-skeleton.d.ts} +0 -0
- /package/{components/slider/index.d.ts → types/testgorilla-tgo-ui-components-slider.d.ts} +0 -0
- /package/{components/snackbar/index.d.ts → types/testgorilla-tgo-ui-components-snackbar.d.ts} +0 -0
- /package/{components/spider-chart/index.d.ts → types/testgorilla-tgo-ui-components-spider-chart.d.ts} +0 -0
- /package/{components/spinner/index.d.ts → types/testgorilla-tgo-ui-components-spinner.d.ts} +0 -0
- /package/{components/stepper/index.d.ts → types/testgorilla-tgo-ui-components-stepper.d.ts} +0 -0
- /package/{components/table/index.d.ts → types/testgorilla-tgo-ui-components-table.d.ts} +0 -0
- /package/{components/tabs/index.d.ts → types/testgorilla-tgo-ui-components-tabs.d.ts} +0 -0
- /package/{components/tag/index.d.ts → types/testgorilla-tgo-ui-components-tag.d.ts} +0 -0
- /package/{components/toggle/index.d.ts → types/testgorilla-tgo-ui-components-toggle.d.ts} +0 -0
- /package/{components/tooltip/index.d.ts → types/testgorilla-tgo-ui-components-tooltip.d.ts} +0 -0
- /package/{components/universal-skills/index.d.ts → types/testgorilla-tgo-ui-components-universal-skills.d.ts} +0 -0
- /package/{components/validation-error/index.d.ts → types/testgorilla-tgo-ui-components-validation-error.d.ts} +0 -0
- /package/{components/write-with-ai/index.d.ts → types/testgorilla-tgo-ui-components-write-with-ai.d.ts} +0 -0
- /package/{index.d.ts → types/testgorilla-tgo-ui.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testgorilla-tgo-ui-components-audio-waveform.mjs","sources":["../../../components/audio-waveform/audio-waveform.model.ts","../../../components/audio-waveform/audio-waveform.service.ts","../../../components/audio-waveform/audio-waveform.component.ts","../../../components/audio-waveform/audio-waveform.component.html","../../../components/audio-waveform/audio-waveform.module.ts","../../../components/audio-waveform/testgorilla-tgo-ui-components-audio-waveform.ts"],"sourcesContent":["export interface AudioWaveformConfig {\n barCount: number;\n smoothing: number;\n fftSize: number;\n}\n\nexport const DEFAULT_AUDIO_WAVEFORM_CONFIG: AudioWaveformConfig = {\n barCount: 5,\n smoothing: 0.55,\n fftSize: 256,\n};\n\n/** Per-bar colors for the 5-bar waveform (left to right) */\nexport const AUDIO_WAVEFORM_BAR_COLORS: string[] = ['#C065D0', '#A86FDA', '#9078E3', '#7882EC', '#6889F3'];\n","import { Injectable, OnDestroy, signal } from '@angular/core';\n\nimport { DEFAULT_AUDIO_WAVEFORM_CONFIG } from './audio-waveform.model';\n\n@Injectable({ providedIn: 'root' })\nexport class AudioWaveformService implements OnDestroy {\n private ctx: AudioContext | null = null;\n private analyser: AnalyserNode | null = null;\n private source: MediaStreamAudioSourceNode | null = null;\n private stream: MediaStream | null = null;\n private raf: number | null = null;\n\n readonly bars = signal<number[]>([]);\n readonly active = signal<boolean>(false);\n\n async start(\n barCount = DEFAULT_AUDIO_WAVEFORM_CONFIG.barCount,\n smoothing = DEFAULT_AUDIO_WAVEFORM_CONFIG.smoothing\n ): Promise<void> {\n if (this.active()) {\n return;\n }\n\n try {\n this.stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n this.ctx = new AudioContext();\n this.analyser = this.ctx.createAnalyser();\n this.analyser.fftSize = DEFAULT_AUDIO_WAVEFORM_CONFIG.fftSize;\n this.analyser.smoothingTimeConstant = smoothing;\n this.source = this.ctx.createMediaStreamSource(this.stream);\n this.source.connect(this.analyser);\n this.active.set(true);\n\n const data = new Uint8Array(this.analyser.frequencyBinCount);\n // Focus on the lower ~60% of bins where speech energy concentrates\n const speechBinCount = Math.max(1, Math.floor(data.length * 0.6));\n\n const analyserRef = this.analyser;\n const tick = (): void => {\n analyserRef.getByteFrequencyData(data);\n\n // RMS (root mean square) of speech-range bins — represents perceived loudness,\n // unlike peak which saturates on any single spike\n let sumSq = 0;\n for (let i = 0; i < speechBinCount; i++) {\n const v = data[i] / 255;\n sumSq += v * v;\n }\n const rms = Math.sqrt(sumSq / speechBinCount);\n\n // Power curve keeps quiet→loud variation visible. Gain multiplier ensures\n // loud speech reaches full bar height. Clamped to [0, 1].\n const amplitude = Math.min(1, Math.pow(rms, 0.55) * 1.5);\n\n const values = this.createSymmetricBars(barCount, amplitude);\n this.bars.set(values);\n this.raf = requestAnimationFrame(tick);\n };\n tick();\n } catch (e) {\n console.error('[AudioWaveform] Mic access denied:', e);\n }\n }\n\n stop(): void {\n if (this.raf !== null) {\n cancelAnimationFrame(this.raf);\n }\n this.source?.disconnect();\n this.analyser?.disconnect();\n this.stream?.getTracks().forEach(t => t.stop());\n if (this.ctx && this.ctx.state !== 'closed') {\n void this.ctx.close();\n }\n this.ctx = null;\n this.analyser = null;\n this.source = null;\n this.stream = null;\n this.raf = null;\n this.active.set(false);\n this.bars.set([]);\n }\n\n ngOnDestroy(): void {\n this.stop();\n }\n\n /**\n * Creates a symmetric bar distribution where middle bars are highest.\n * Uses a bell-curve-like pattern centered at the middle bar.\n */\n private createSymmetricBars(barCount: number, amplitude: number): number[] {\n const center = (barCount - 1) / 2;\n const maxDistance = center;\n\n return Array.from({ length: barCount }, (_, i) => {\n const distance = Math.abs(i - center);\n // Weight decreases as distance from center increases\n // Using a quadratic falloff for smoother appearance\n const weight = 1 - (distance / maxDistance) * 0.65;\n return amplitude * weight;\n });\n }\n}\n","import { Component, ChangeDetectionStrategy, OnDestroy, computed, effect, inject, input } from '@angular/core';\n\nimport { DEFAULT_AUDIO_WAVEFORM_CONFIG, AUDIO_WAVEFORM_BAR_COLORS } from './audio-waveform.model';\nimport { AudioWaveformService } from './audio-waveform.service';\n\n@Component({\n selector: 'ui-audio-waveform',\n templateUrl: './audio-waveform.component.html',\n styleUrls: ['./audio-waveform.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [],\n})\nexport class AudioWaveformComponent implements OnDestroy {\n private readonly waveformService = inject(AudioWaveformService);\n\n readonly barCount = DEFAULT_AUDIO_WAVEFORM_CONFIG.barCount;\n readonly width = input<number>(40);\n readonly height = input<number>(22);\n readonly gap = input<number>(3);\n readonly minScale = input<number>(0.08);\n readonly smoothing = input<number>(DEFAULT_AUDIO_WAVEFORM_CONFIG.smoothing);\n\n /**\n * When provided, the component operates in controlled mode —\n * it renders externally-supplied bar values instead of managing the mic itself.\n */\n readonly bars = input<number[] | null>(null);\n\n /** Mirror of `bars` for controlled mode; required when `bars` is set. */\n readonly active = input<boolean | null>(null);\n\n readonly controlled = computed(() => this.active() !== null);\n\n readonly effectiveBars = computed(() => {\n if (this.controlled()) {\n return this.bars() ?? [];\n }\n return this.waveformService.bars();\n });\n\n readonly effectiveActive = computed(() => {\n if (this.controlled()) {\n return this.active() ?? false;\n }\n return this.waveformService.active();\n });\n\n readonly barWidth = computed(() => {\n const count = this.barCount;\n return (this.width() - this.gap() * (count - 1)) / count;\n });\n\n constructor() {\n effect(() => {\n if (!this.controlled()) {\n void this.waveformService.start(this.barCount, this.smoothing());\n }\n });\n }\n\n barHeight(value: number): number {\n const h = this.height();\n const min = this.minScale();\n return h * (min + value * (1 - min));\n }\n\n barRadius(): number {\n return this.barWidth() / 2;\n }\n\n barValue(index: number): number {\n const bars = this.effectiveBars();\n return bars[index] ?? 0;\n }\n\n barColor(index: number): string {\n return AUDIO_WAVEFORM_BAR_COLORS[index] ?? AUDIO_WAVEFORM_BAR_COLORS[0];\n }\n\n /** Returns the x-offset for a bar so the shared CSS gradient aligns correctly. */\n barOffset(index: number): number {\n return (this.barWidth() + this.gap()) * index;\n }\n\n ngOnDestroy(): void {\n if (!this.controlled()) {\n this.waveformService.stop();\n }\n }\n}\n","<div\n class=\"waveform\"\n [style.width.px]=\"width()\"\n [style.height.px]=\"height()\"\n [style.gap.px]=\"gap()\"\n role=\"img\"\n [attr.aria-label]=\"effectiveActive() ? 'Audio waveform active' : 'Audio waveform inactive'\"\n>\n @for (item of effectiveBars(); track $index) {\n <div\n class=\"waveform-bar\"\n [style.width.px]=\"barWidth()\"\n [style.height.px]=\"barHeight(barValue($index))\"\n [style.border-radius.px]=\"barRadius()\"\n [style.background-color]=\"barColor($index)\"\n ></div>\n }\n</div>\n","import { NgModule } from '@angular/core';\n\nimport { AudioWaveformComponent } from './audio-waveform.component';\n\n@NgModule({\n imports: [AudioWaveformComponent],\n exports: [AudioWaveformComponent],\n})\nexport class AudioWaveformModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAMO,MAAM,6BAA6B,GAAwB;AAChE,IAAA,QAAQ,EAAE,CAAC;AACX,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,OAAO,EAAE,GAAG;;AAGd;AACO,MAAM,yBAAyB,GAAa,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;;MCR5F,oBAAoB,CAAA;AADjC,IAAA,WAAA,GAAA;QAEU,IAAA,CAAA,GAAG,GAAwB,IAAI;QAC/B,IAAA,CAAA,QAAQ,GAAwB,IAAI;QACpC,IAAA,CAAA,MAAM,GAAsC,IAAI;QAChD,IAAA,CAAA,MAAM,GAAuB,IAAI;QACjC,IAAA,CAAA,GAAG,GAAkB,IAAI;AAExB,QAAA,IAAA,CAAA,IAAI,GAAG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AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"testgorilla-tgo-ui-components-audio-waveform.mjs","sources":["../../../components/audio-waveform/audio-waveform.model.ts","../../../components/audio-waveform/audio-waveform.service.ts","../../../components/audio-waveform/audio-waveform.component.ts","../../../components/audio-waveform/audio-waveform.component.html","../../../components/audio-waveform/audio-waveform.module.ts","../../../components/audio-waveform/testgorilla-tgo-ui-components-audio-waveform.ts"],"sourcesContent":["export interface AudioWaveformConfig {\n barCount: number;\n smoothing: number;\n fftSize: number;\n}\n\nexport const DEFAULT_AUDIO_WAVEFORM_CONFIG: AudioWaveformConfig = {\n barCount: 5,\n smoothing: 0.55,\n fftSize: 256,\n};\n\n/** Per-bar colors for the 5-bar waveform (left to right) */\nexport const AUDIO_WAVEFORM_BAR_COLORS: string[] = ['#C065D0', '#A86FDA', '#9078E3', '#7882EC', '#6889F3'];\n","import { Injectable, OnDestroy, signal } from '@angular/core';\n\nimport { DEFAULT_AUDIO_WAVEFORM_CONFIG } from './audio-waveform.model';\n\n@Injectable({ providedIn: 'root' })\nexport class AudioWaveformService implements OnDestroy {\n private ctx: AudioContext | null = null;\n private analyser: AnalyserNode | null = null;\n private source: MediaStreamAudioSourceNode | null = null;\n private stream: MediaStream | null = null;\n private raf: number | null = null;\n\n readonly bars = signal<number[]>([]);\n readonly active = signal<boolean>(false);\n\n async start(\n barCount = DEFAULT_AUDIO_WAVEFORM_CONFIG.barCount,\n smoothing = DEFAULT_AUDIO_WAVEFORM_CONFIG.smoothing\n ): Promise<void> {\n if (this.active()) {\n return;\n }\n\n try {\n this.stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n this.ctx = new AudioContext();\n this.analyser = this.ctx.createAnalyser();\n this.analyser.fftSize = DEFAULT_AUDIO_WAVEFORM_CONFIG.fftSize;\n this.analyser.smoothingTimeConstant = smoothing;\n this.source = this.ctx.createMediaStreamSource(this.stream);\n this.source.connect(this.analyser);\n this.active.set(true);\n\n const data = new Uint8Array(this.analyser.frequencyBinCount);\n // Focus on the lower ~60% of bins where speech energy concentrates\n const speechBinCount = Math.max(1, Math.floor(data.length * 0.6));\n\n const analyserRef = this.analyser;\n const tick = (): void => {\n analyserRef.getByteFrequencyData(data);\n\n // RMS (root mean square) of speech-range bins — represents perceived loudness,\n // unlike peak which saturates on any single spike\n let sumSq = 0;\n for (let i = 0; i < speechBinCount; i++) {\n const v = data[i] / 255;\n sumSq += v * v;\n }\n const rms = Math.sqrt(sumSq / speechBinCount);\n\n // Power curve keeps quiet→loud variation visible. Gain multiplier ensures\n // loud speech reaches full bar height. Clamped to [0, 1].\n const amplitude = Math.min(1, Math.pow(rms, 0.55) * 1.5);\n\n const values = this.createSymmetricBars(barCount, amplitude);\n this.bars.set(values);\n this.raf = requestAnimationFrame(tick);\n };\n tick();\n } catch (e) {\n console.error('[AudioWaveform] Mic access denied:', e);\n }\n }\n\n stop(): void {\n if (this.raf !== null) {\n cancelAnimationFrame(this.raf);\n }\n this.source?.disconnect();\n this.analyser?.disconnect();\n this.stream?.getTracks().forEach(t => t.stop());\n if (this.ctx && this.ctx.state !== 'closed') {\n void this.ctx.close();\n }\n this.ctx = null;\n this.analyser = null;\n this.source = null;\n this.stream = null;\n this.raf = null;\n this.active.set(false);\n this.bars.set([]);\n }\n\n ngOnDestroy(): void {\n this.stop();\n }\n\n /**\n * Creates a symmetric bar distribution where middle bars are highest.\n * Uses a bell-curve-like pattern centered at the middle bar.\n */\n private createSymmetricBars(barCount: number, amplitude: number): number[] {\n const center = (barCount - 1) / 2;\n const maxDistance = center;\n\n return Array.from({ length: barCount }, (_, i) => {\n const distance = Math.abs(i - center);\n // Weight decreases as distance from center increases\n // Using a quadratic falloff for smoother appearance\n const weight = 1 - (distance / maxDistance) * 0.65;\n return amplitude * weight;\n });\n }\n}\n","import { Component, ChangeDetectionStrategy, OnDestroy, computed, effect, inject, input } from '@angular/core';\n\nimport { DEFAULT_AUDIO_WAVEFORM_CONFIG, AUDIO_WAVEFORM_BAR_COLORS } from './audio-waveform.model';\nimport { AudioWaveformService } from './audio-waveform.service';\n\n@Component({\n selector: 'ui-audio-waveform',\n templateUrl: './audio-waveform.component.html',\n styleUrls: ['./audio-waveform.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [],\n})\nexport class AudioWaveformComponent implements OnDestroy {\n private readonly waveformService = inject(AudioWaveformService);\n\n readonly barCount = DEFAULT_AUDIO_WAVEFORM_CONFIG.barCount;\n readonly width = input<number>(40);\n readonly height = input<number>(22);\n readonly gap = input<number>(3);\n readonly minScale = input<number>(0.08);\n readonly smoothing = input<number>(DEFAULT_AUDIO_WAVEFORM_CONFIG.smoothing);\n\n /**\n * When provided, the component operates in controlled mode —\n * it renders externally-supplied bar values instead of managing the mic itself.\n */\n readonly bars = input<number[] | null>(null);\n\n /** Mirror of `bars` for controlled mode; required when `bars` is set. */\n readonly active = input<boolean | null>(null);\n\n readonly controlled = computed(() => this.active() !== null);\n\n readonly effectiveBars = computed(() => {\n if (this.controlled()) {\n return this.bars() ?? [];\n }\n return this.waveformService.bars();\n });\n\n readonly effectiveActive = computed(() => {\n if (this.controlled()) {\n return this.active() ?? false;\n }\n return this.waveformService.active();\n });\n\n readonly barWidth = computed(() => {\n const count = this.barCount;\n return (this.width() - this.gap() * (count - 1)) / count;\n });\n\n constructor() {\n effect(() => {\n if (!this.controlled()) {\n void this.waveformService.start(this.barCount, this.smoothing());\n }\n });\n }\n\n barHeight(value: number): number {\n const h = this.height();\n const min = this.minScale();\n return h * (min + value * (1 - min));\n }\n\n barRadius(): number {\n return this.barWidth() / 2;\n }\n\n barValue(index: number): number {\n const bars = this.effectiveBars();\n return bars[index] ?? 0;\n }\n\n barColor(index: number): string {\n return AUDIO_WAVEFORM_BAR_COLORS[index] ?? AUDIO_WAVEFORM_BAR_COLORS[0];\n }\n\n /** Returns the x-offset for a bar so the shared CSS gradient aligns correctly. */\n barOffset(index: number): number {\n return (this.barWidth() + this.gap()) * index;\n }\n\n ngOnDestroy(): void {\n if (!this.controlled()) {\n this.waveformService.stop();\n }\n }\n}\n","<div\n class=\"waveform\"\n [style.width.px]=\"width()\"\n [style.height.px]=\"height()\"\n [style.gap.px]=\"gap()\"\n role=\"img\"\n [attr.aria-label]=\"effectiveActive() ? 'Audio waveform active' : 'Audio waveform inactive'\"\n>\n @for (item of effectiveBars(); track $index) {\n <div\n class=\"waveform-bar\"\n [style.width.px]=\"barWidth()\"\n [style.height.px]=\"barHeight(barValue($index))\"\n [style.border-radius.px]=\"barRadius()\"\n [style.background-color]=\"barColor($index)\"\n ></div>\n }\n</div>\n","import { NgModule } from '@angular/core';\n\nimport { AudioWaveformComponent } from './audio-waveform.component';\n\n@NgModule({\n imports: [AudioWaveformComponent],\n exports: [AudioWaveformComponent],\n})\nexport class AudioWaveformModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAMO,MAAM,6BAA6B,GAAwB;AAChE,IAAA,QAAQ,EAAE,CAAC;AACX,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,OAAO,EAAE,GAAG;;AAGd;AACO,MAAM,yBAAyB,GAAa,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;;MCR5F,oBAAoB,CAAA;AADjC,IAAA,WAAA,GAAA;QAEU,IAAA,CAAA,GAAG,GAAwB,IAAI;QAC/B,IAAA,CAAA,QAAQ,GAAwB,IAAI;QACpC,IAAA,CAAA,MAAM,GAAsC,IAAI;QAChD,IAAA,CAAA,MAAM,GAAuB,IAAI;QACjC,IAAA,CAAA,GAAG,GAAkB,IAAI;AAExB,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAW,EAAE,2EAAC;AAC3B,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAU,KAAK,6EAAC;AA0FzC,IAAA;AAxFC,IAAA,MAAM,KAAK,CACT,QAAQ,GAAG,6BAA6B,CAAC,QAAQ,EACjD,SAAS,GAAG,6BAA6B,CAAC,SAAS,E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