wally-ui 1.14.0 → 1.15.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/package.json +1 -1
- package/playground/showcase/public/sitemap.xml +15 -0
- package/playground/showcase/src/app/app.routes.server.ts +4 -0
- package/playground/showcase/src/app/components/ai/ai-composer/ai-composer.html +11 -2
- package/playground/showcase/src/app/components/ai/ai-composer/ai-composer.ts +13 -3
- package/playground/showcase/src/app/components/audio-waveform/audio-waveform.css +0 -0
- package/playground/showcase/src/app/components/audio-waveform/audio-waveform.html +41 -0
- package/playground/showcase/src/app/components/audio-waveform/audio-waveform.service.spec.ts +16 -0
- package/playground/showcase/src/app/components/audio-waveform/audio-waveform.service.ts +175 -0
- package/playground/showcase/src/app/components/audio-waveform/audio-waveform.spec.ts +23 -0
- package/playground/showcase/src/app/components/audio-waveform/audio-waveform.ts +64 -0
- package/playground/showcase/src/app/components/selection-popover/selection-popover.html +8 -2
- package/playground/showcase/src/app/components/selection-popover/selection-popover.ts +76 -12
- package/playground/showcase/src/app/pages/documentation/components/audio-waveform-docs/audio-waveform-docs.css +1 -0
- package/playground/showcase/src/app/pages/documentation/components/audio-waveform-docs/audio-waveform-docs.examples.ts +146 -0
- package/playground/showcase/src/app/pages/documentation/components/audio-waveform-docs/audio-waveform-docs.html +576 -0
- package/playground/showcase/src/app/pages/documentation/components/audio-waveform-docs/audio-waveform-docs.ts +124 -0
- package/playground/showcase/src/app/pages/documentation/components/components.html +27 -0
- package/playground/showcase/src/app/pages/documentation/components/components.routes.ts +4 -0
- package/playground/showcase/src/app/pages/documentation/components/selection-popover-docs/selection-popover-docs.examples.ts +4 -0
- package/playground/showcase/src/app/pages/documentation/components/selection-popover-docs/selection-popover-docs.html +49 -0
- package/playground/showcase/src/app/pages/documentation/components/selection-popover-docs/selection-popover-docs.ts +1 -0
- package/playground/showcase/src/app/pages/home/home.html +1 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// Audio Waveform documentation code examples
|
|
2
|
+
export const AudioWaveformCodeExamples = {
|
|
3
|
+
// Installation
|
|
4
|
+
installation: `npx wally-ui add audio-waveform`,
|
|
5
|
+
|
|
6
|
+
// Import examples
|
|
7
|
+
import: `import { AudioWaveform } from './components/wally-ui/audio-waveform/audio-waveform';
|
|
8
|
+
import { AudioWaveformService } from './components/wally-ui/audio-waveform/audio-waveform.service';`,
|
|
9
|
+
|
|
10
|
+
componentImport: `@Component({
|
|
11
|
+
selector: 'app-example',
|
|
12
|
+
imports: [AudioWaveform],
|
|
13
|
+
templateUrl: './example.html'
|
|
14
|
+
})`,
|
|
15
|
+
|
|
16
|
+
// Basic usage
|
|
17
|
+
basicUsage: `<wally-audio-waveform
|
|
18
|
+
[isStartRecording]="isRecording()"
|
|
19
|
+
[isStopRecording]="!isRecording()">
|
|
20
|
+
</wally-audio-waveform>`,
|
|
21
|
+
|
|
22
|
+
// With timer
|
|
23
|
+
withTimer: `<wally-audio-waveform
|
|
24
|
+
[isStartRecording]="isRecording()"
|
|
25
|
+
[isStopRecording]="!isRecording()"
|
|
26
|
+
[showTimer]="true">
|
|
27
|
+
</wally-audio-waveform>`,
|
|
28
|
+
|
|
29
|
+
// Complete Example with Controls
|
|
30
|
+
completeExample: `<div class="flex flex-col gap-4">
|
|
31
|
+
<!-- Waveform Visualizer -->
|
|
32
|
+
<wally-audio-waveform
|
|
33
|
+
[isStartRecording]="isRecording()"
|
|
34
|
+
[isStopRecording]="!isRecording()"
|
|
35
|
+
[showTimer]="true">
|
|
36
|
+
</wally-audio-waveform>
|
|
37
|
+
|
|
38
|
+
<!-- Recording Controls -->
|
|
39
|
+
<div class="flex gap-2">
|
|
40
|
+
@if (!isRecording()) {
|
|
41
|
+
<button (click)="startRecording()"
|
|
42
|
+
class="px-4 py-2 bg-red-500 text-white rounded-full">
|
|
43
|
+
Start Recording
|
|
44
|
+
</button>
|
|
45
|
+
} @else {
|
|
46
|
+
<button (click)="stopRecording()"
|
|
47
|
+
class="px-4 py-2 bg-neutral-500 text-white rounded-full">
|
|
48
|
+
Stop Recording
|
|
49
|
+
</button>
|
|
50
|
+
}
|
|
51
|
+
</div>
|
|
52
|
+
</div>`,
|
|
53
|
+
|
|
54
|
+
completeExampleTs: `export class RecordingComponent {
|
|
55
|
+
isRecording = signal(false);
|
|
56
|
+
|
|
57
|
+
startRecording() {
|
|
58
|
+
this.isRecording.set(true);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
stopRecording() {
|
|
62
|
+
this.isRecording.set(false);
|
|
63
|
+
}
|
|
64
|
+
}`,
|
|
65
|
+
|
|
66
|
+
// Service Integration
|
|
67
|
+
serviceIntegration: `// Access the service to get recorded audio
|
|
68
|
+
export class RecordingComponent {
|
|
69
|
+
@ViewChild(AudioWaveform) audioWaveform!: AudioWaveform;
|
|
70
|
+
|
|
71
|
+
downloadRecording() {
|
|
72
|
+
const service = this.audioWaveform.audioWaveformService;
|
|
73
|
+
service.downloadRecording('my-recording.webm');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
getRecordedBlob() {
|
|
77
|
+
const service = this.audioWaveform.audioWaveformService;
|
|
78
|
+
const blob = service.recordedAudioBlob();
|
|
79
|
+
return blob;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
clearRecording() {
|
|
83
|
+
const service = this.audioWaveform.audioWaveformService;
|
|
84
|
+
service.clearRecording();
|
|
85
|
+
}
|
|
86
|
+
}`,
|
|
87
|
+
|
|
88
|
+
// Responsive Configuration
|
|
89
|
+
responsiveConfig: `// Service Configuration (auto-responsive)
|
|
90
|
+
// Mobile (< 768px): 30 bars
|
|
91
|
+
// Desktop (>= 768px): 65 bars
|
|
92
|
+
// Automatically adjusts based on screen width`,
|
|
93
|
+
|
|
94
|
+
// Future: Audio Transcription
|
|
95
|
+
futureTranscription: `// COMING SOON: Audio Transcription
|
|
96
|
+
// The component will support automatic transcription in a future release
|
|
97
|
+
|
|
98
|
+
<wally-audio-waveform
|
|
99
|
+
[isStartRecording]="isRecording()"
|
|
100
|
+
[isStopRecording]="!isRecording()"
|
|
101
|
+
[enableTranscription]="true"
|
|
102
|
+
(transcriptionComplete)="onTranscription($event)">
|
|
103
|
+
</wally-audio-waveform>`,
|
|
104
|
+
|
|
105
|
+
// Web Audio API Concepts
|
|
106
|
+
webAudioConcepts: `// How it works under the hood:
|
|
107
|
+
// 1. getUserMedia() - Request microphone access
|
|
108
|
+
// 2. AudioContext - Process audio in real-time
|
|
109
|
+
// 3. AnalyserNode - FFT analysis (256 samples → 128 frequencies)
|
|
110
|
+
// 4. getByteFrequencyData() - Get frequency values (0-255)
|
|
111
|
+
// 5. Normalize to 0-100% for bar heights
|
|
112
|
+
// 6. requestAnimationFrame - Smooth 60fps animation`,
|
|
113
|
+
|
|
114
|
+
// Properties: Inputs
|
|
115
|
+
propertyIsStartRecording: `isStartRecording: InputSignal<boolean> = input<boolean>(false);`,
|
|
116
|
+
propertyIsStopRecording: `isStopRecording: InputSignal<boolean> = input<boolean>(false);`,
|
|
117
|
+
propertyShowTimer: `showTimer: InputSignal<boolean> = input<boolean>(false);`,
|
|
118
|
+
|
|
119
|
+
// Properties: Service Signals
|
|
120
|
+
servicePropertyIsRecording: `isRecording: WritableSignal<boolean>`,
|
|
121
|
+
servicePropertyAudioData: `audioData: WritableSignal<number[]> // Bar heights (0-100%)`,
|
|
122
|
+
servicePropertyRecordedAudioBlob: `recordedAudioBlob: WritableSignal<Blob | null>`,
|
|
123
|
+
servicePropertyRecordedAudioUrl: `recordedAudioUrl: WritableSignal<string | null>`,
|
|
124
|
+
|
|
125
|
+
// Methods
|
|
126
|
+
methodDownloadRecording: `downloadRecording(filename?: string): void`,
|
|
127
|
+
methodClearRecording: `clearRecording(): void`,
|
|
128
|
+
|
|
129
|
+
// Configuration constants
|
|
130
|
+
configFFTSize: `FFT_SIZE = 256 // Higher = more frequency detail`,
|
|
131
|
+
configBarCount: `BAR_COUNT = 30 (mobile) | 65 (desktop) // Auto-responsive`,
|
|
132
|
+
configSmoothing: `SMOOTHING = 0.8 // 0 (no smoothing) to 1 (max smoothing)`,
|
|
133
|
+
|
|
134
|
+
// Accessibility
|
|
135
|
+
accessibilityExample: `<!-- The component includes built-in accessibility -->
|
|
136
|
+
<!-- Timer updates announced via aria-live region (when showTimer=true) -->
|
|
137
|
+
<!-- Waveform visualizer is decorative (aria-hidden) -->`,
|
|
138
|
+
|
|
139
|
+
// Browser Support
|
|
140
|
+
browserSupport: `// Requires modern browsers with:
|
|
141
|
+
// - Web Audio API
|
|
142
|
+
// - MediaStream API
|
|
143
|
+
// - MediaRecorder API
|
|
144
|
+
//
|
|
145
|
+
// Supported: Chrome 60+, Firefox 55+, Safari 14+, Edge 79+`,
|
|
146
|
+
};
|