@djangocfg/ui-nextjs 2.1.65 → 2.1.66
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 +9 -6
- package/src/blocks/SplitHero/SplitHeroMedia.tsx +2 -1
- package/src/tools/AudioPlayer/AudioEqualizer.tsx +235 -0
- package/src/tools/AudioPlayer/AudioPlayer.tsx +223 -0
- package/src/tools/AudioPlayer/AudioReactiveCover.tsx +389 -0
- package/src/tools/AudioPlayer/AudioShortcutsPopover.tsx +95 -0
- package/src/tools/AudioPlayer/README.md +301 -0
- package/src/tools/AudioPlayer/SimpleAudioPlayer.tsx +275 -0
- package/src/tools/AudioPlayer/VisualizationToggle.tsx +68 -0
- package/src/tools/AudioPlayer/context.tsx +426 -0
- package/src/tools/AudioPlayer/effects/index.ts +412 -0
- package/src/tools/AudioPlayer/index.ts +84 -0
- package/src/tools/AudioPlayer/types.ts +162 -0
- package/src/tools/AudioPlayer/useAudioHotkeys.ts +142 -0
- package/src/tools/AudioPlayer/useAudioVisualization.tsx +195 -0
- package/src/tools/ImageViewer/ImageViewer.tsx +416 -0
- package/src/tools/ImageViewer/README.md +161 -0
- package/src/tools/ImageViewer/index.ts +16 -0
- package/src/tools/VideoPlayer/README.md +196 -187
- package/src/tools/VideoPlayer/VideoErrorFallback.tsx +174 -0
- package/src/tools/VideoPlayer/VideoPlayer.tsx +189 -218
- package/src/tools/VideoPlayer/VideoPlayerContext.tsx +125 -0
- package/src/tools/VideoPlayer/index.ts +59 -7
- package/src/tools/VideoPlayer/providers/NativeProvider.tsx +206 -0
- package/src/tools/VideoPlayer/providers/StreamProvider.tsx +311 -0
- package/src/tools/VideoPlayer/providers/VidstackProvider.tsx +254 -0
- package/src/tools/VideoPlayer/providers/index.ts +8 -0
- package/src/tools/VideoPlayer/types.ts +320 -71
- package/src/tools/index.ts +82 -4
- package/src/tools/VideoPlayer/NativePlayer.tsx +0 -141
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audio Reactive Effects - Common utilities and types
|
|
3
|
+
*
|
|
4
|
+
* Provides reusable effect calculations and configurations
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// =============================================================================
|
|
8
|
+
// TYPES
|
|
9
|
+
// =============================================================================
|
|
10
|
+
|
|
11
|
+
export type EffectVariant = 'glow' | 'orbs' | 'spotlight' | 'mesh';
|
|
12
|
+
export type EffectIntensity = 'subtle' | 'medium' | 'strong';
|
|
13
|
+
export type EffectColorScheme = 'primary' | 'vibrant' | 'cool' | 'warm';
|
|
14
|
+
|
|
15
|
+
export interface AudioLevels {
|
|
16
|
+
bass: number;
|
|
17
|
+
mid: number;
|
|
18
|
+
high: number;
|
|
19
|
+
overall: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface EffectConfig {
|
|
23
|
+
opacity: number;
|
|
24
|
+
scale: number;
|
|
25
|
+
blur: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface EffectColors {
|
|
29
|
+
colors: string[];
|
|
30
|
+
hueShift: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface EffectLayer {
|
|
34
|
+
inset: number;
|
|
35
|
+
opacity: number;
|
|
36
|
+
scale: number;
|
|
37
|
+
background: string;
|
|
38
|
+
blur: string;
|
|
39
|
+
animation?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// =============================================================================
|
|
43
|
+
// CONSTANTS
|
|
44
|
+
// =============================================================================
|
|
45
|
+
|
|
46
|
+
export const INTENSITY_CONFIG: Record<EffectIntensity, EffectConfig> = {
|
|
47
|
+
subtle: { opacity: 0.3, scale: 0.02, blur: 'blur-2xl' },
|
|
48
|
+
medium: { opacity: 0.5, scale: 0.04, blur: 'blur-xl' },
|
|
49
|
+
strong: { opacity: 0.7, scale: 0.06, blur: 'blur-lg' },
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const COLOR_SCHEMES: Record<EffectColorScheme, string[]> = {
|
|
53
|
+
primary: ['217 91% 60%'],
|
|
54
|
+
vibrant: ['217 91% 60%', '142 76% 36%', '262 83% 58%', '25 95% 53%'],
|
|
55
|
+
cool: ['217 91% 60%', '262 83% 58%', '199 89% 48%'],
|
|
56
|
+
warm: ['25 95% 53%', '0 84% 60%', '38 92% 50%'],
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// Default multi-color palette when single color provided
|
|
60
|
+
const DEFAULT_GLOW_COLORS = [
|
|
61
|
+
'217 91% 60%', // Blue
|
|
62
|
+
'262 83% 58%', // Purple
|
|
63
|
+
'330 81% 60%', // Pink
|
|
64
|
+
'25 95% 53%', // Orange
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
// =============================================================================
|
|
68
|
+
// UTILITIES
|
|
69
|
+
// =============================================================================
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Get effect configuration from intensity setting
|
|
73
|
+
*/
|
|
74
|
+
export function getEffectConfig(intensity: EffectIntensity): EffectConfig {
|
|
75
|
+
return INTENSITY_CONFIG[intensity];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Get color array from color scheme
|
|
80
|
+
*/
|
|
81
|
+
export function getColors(colorScheme: EffectColorScheme): string[] {
|
|
82
|
+
return COLOR_SCHEMES[colorScheme];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Prepare colors with hue shift based on audio levels
|
|
87
|
+
*/
|
|
88
|
+
export function prepareEffectColors(
|
|
89
|
+
colorScheme: EffectColorScheme,
|
|
90
|
+
levels: AudioLevels
|
|
91
|
+
): EffectColors {
|
|
92
|
+
const baseColors = COLOR_SCHEMES[colorScheme];
|
|
93
|
+
const colors = baseColors.length > 1 ? baseColors : DEFAULT_GLOW_COLORS;
|
|
94
|
+
const hueShift = Math.floor(
|
|
95
|
+
(levels.bass * 30) + (levels.mid * 20) + (levels.high * 10)
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
return { colors, hueShift };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Calculate glow layer properties
|
|
103
|
+
*/
|
|
104
|
+
export function calculateGlowLayers(
|
|
105
|
+
levels: AudioLevels,
|
|
106
|
+
config: EffectConfig,
|
|
107
|
+
colors: string[]
|
|
108
|
+
): EffectLayer[] {
|
|
109
|
+
const { bass, mid, high } = levels;
|
|
110
|
+
|
|
111
|
+
return [
|
|
112
|
+
// Layer 1: Bass glow - bottom
|
|
113
|
+
{
|
|
114
|
+
inset: 60 + bass * 90,
|
|
115
|
+
opacity: 1,
|
|
116
|
+
scale: 1 + bass * 0.5,
|
|
117
|
+
background: `radial-gradient(ellipse 80% 60% at 50% 100%, hsl(${colors[0]} / ${0.4 + bass * 0.4}) 0%, transparent 70%)`,
|
|
118
|
+
blur: 'blur-3xl',
|
|
119
|
+
},
|
|
120
|
+
// Layer 2: Mid glow - top
|
|
121
|
+
{
|
|
122
|
+
inset: 45 + mid * 75,
|
|
123
|
+
opacity: 1,
|
|
124
|
+
scale: 1 + mid * 0.4,
|
|
125
|
+
background: `radial-gradient(ellipse 70% 50% at 50% 0%, hsl(${colors[1] || colors[0]} / ${0.3 + mid * 0.5}) 0%, transparent 70%)`,
|
|
126
|
+
blur: 'blur-2xl',
|
|
127
|
+
},
|
|
128
|
+
// Layer 3: High glow - left
|
|
129
|
+
{
|
|
130
|
+
inset: 30 + high * 60,
|
|
131
|
+
opacity: 1,
|
|
132
|
+
scale: 1 + high * 0.3,
|
|
133
|
+
background: `radial-gradient(ellipse 50% 80% at 0% 50%, hsl(${colors[2] || colors[0]} / ${0.3 + high * 0.4}) 0%, transparent 60%)`,
|
|
134
|
+
blur: 'blur-2xl',
|
|
135
|
+
},
|
|
136
|
+
// Layer 4: High glow - right
|
|
137
|
+
{
|
|
138
|
+
inset: 30 + high * 60,
|
|
139
|
+
opacity: 1,
|
|
140
|
+
scale: 1 + high * 0.3,
|
|
141
|
+
background: `radial-gradient(ellipse 50% 80% at 100% 50%, hsl(${colors[3] || colors[0]} / ${0.3 + high * 0.4}) 0%, transparent 60%)`,
|
|
142
|
+
blur: 'blur-2xl',
|
|
143
|
+
},
|
|
144
|
+
// Layer 5: Center pulsing glow
|
|
145
|
+
{
|
|
146
|
+
inset: 24 + bass * 45,
|
|
147
|
+
opacity: 1,
|
|
148
|
+
scale: 1 + bass * 0.2,
|
|
149
|
+
background: `radial-gradient(circle at 50% 50%, hsl(${colors[0]} / ${0.2 + bass * 0.3}) 0%, hsl(${colors[1] || colors[0]} / ${0.1 + mid * 0.2}) 40%, transparent 70%)`,
|
|
150
|
+
blur: 'blur-xl',
|
|
151
|
+
animation: 'glow-breathe 2s ease-in-out infinite',
|
|
152
|
+
},
|
|
153
|
+
];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Calculate orb positions and properties - highly reactive
|
|
158
|
+
*/
|
|
159
|
+
export function calculateOrbs(
|
|
160
|
+
levels: AudioLevels,
|
|
161
|
+
config: EffectConfig,
|
|
162
|
+
colors: string[],
|
|
163
|
+
baseSize: number = 50
|
|
164
|
+
) {
|
|
165
|
+
const { bass, mid, high, overall } = levels;
|
|
166
|
+
const size = baseSize * 3;
|
|
167
|
+
|
|
168
|
+
// Dynamic position offsets
|
|
169
|
+
const bassMove = bass * 30;
|
|
170
|
+
const midMove = mid * 25;
|
|
171
|
+
const highMove = high * 20;
|
|
172
|
+
|
|
173
|
+
return [
|
|
174
|
+
// Bass orb - top left, big pulses
|
|
175
|
+
{
|
|
176
|
+
x: -40 + bassMove,
|
|
177
|
+
y: -40 - bassMove * 0.5,
|
|
178
|
+
size: size * (1 + bass * 1.2),
|
|
179
|
+
color: colors[0],
|
|
180
|
+
opacity: 0.5 + bass * 0.5,
|
|
181
|
+
scale: 1 + bass * 0.6,
|
|
182
|
+
},
|
|
183
|
+
// Mid orb - top right
|
|
184
|
+
{
|
|
185
|
+
x: 130 - midMove * 0.5,
|
|
186
|
+
y: -30 + midMove,
|
|
187
|
+
size: size * (0.9 + mid * 1.0),
|
|
188
|
+
color: colors[1] || colors[0],
|
|
189
|
+
opacity: 0.5 + mid * 0.5,
|
|
190
|
+
scale: 1 + mid * 0.5,
|
|
191
|
+
},
|
|
192
|
+
// High orb - bottom right
|
|
193
|
+
{
|
|
194
|
+
x: 140 + highMove * 0.3,
|
|
195
|
+
y: 120 - highMove,
|
|
196
|
+
size: size * (0.8 + high * 0.8),
|
|
197
|
+
color: colors[2] || colors[0],
|
|
198
|
+
opacity: 0.4 + high * 0.6,
|
|
199
|
+
scale: 1 + high * 0.45,
|
|
200
|
+
},
|
|
201
|
+
// Mid orb 2 - bottom left
|
|
202
|
+
{
|
|
203
|
+
x: -30 - midMove * 0.4,
|
|
204
|
+
y: 130 + midMove * 0.3,
|
|
205
|
+
size: size * (0.9 + mid * 0.9),
|
|
206
|
+
color: colors[3] || colors[0],
|
|
207
|
+
opacity: 0.45 + mid * 0.55,
|
|
208
|
+
scale: 1 + mid * 0.5,
|
|
209
|
+
},
|
|
210
|
+
// Center overall orb
|
|
211
|
+
{
|
|
212
|
+
x: 50,
|
|
213
|
+
y: 50,
|
|
214
|
+
size: size * (0.6 + overall * 1.5),
|
|
215
|
+
color: colors[0],
|
|
216
|
+
opacity: 0.3 + overall * 0.5,
|
|
217
|
+
scale: 1 + overall * 0.7,
|
|
218
|
+
},
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Calculate mesh gradient positions - dynamic and reactive
|
|
224
|
+
*/
|
|
225
|
+
export function calculateMeshGradients(
|
|
226
|
+
levels: AudioLevels,
|
|
227
|
+
config: EffectConfig,
|
|
228
|
+
colors: string[]
|
|
229
|
+
) {
|
|
230
|
+
const { bass, mid, high, overall } = levels;
|
|
231
|
+
|
|
232
|
+
// More aggressive offsets for visible movement
|
|
233
|
+
const bassOffset = bass * 40;
|
|
234
|
+
const midOffset = mid * 30;
|
|
235
|
+
const highOffset = high * 25;
|
|
236
|
+
|
|
237
|
+
return [
|
|
238
|
+
// Large bass blob - top right, pulses hard
|
|
239
|
+
{
|
|
240
|
+
width: `${200 + bass * 150}%`,
|
|
241
|
+
height: `${200 + bass * 150}%`,
|
|
242
|
+
top: `${-80 + bassOffset}%`,
|
|
243
|
+
right: `${-80 - bassOffset}%`,
|
|
244
|
+
color: colors[0],
|
|
245
|
+
opacity: 0.4 + bass * 0.6,
|
|
246
|
+
scale: 1 + bass * 0.5,
|
|
247
|
+
rotation: bass * 45,
|
|
248
|
+
blur: 'blur-2xl',
|
|
249
|
+
},
|
|
250
|
+
// Mid blob - bottom left
|
|
251
|
+
{
|
|
252
|
+
width: `${180 + mid * 120}%`,
|
|
253
|
+
height: `${180 + mid * 120}%`,
|
|
254
|
+
bottom: `${-60 + midOffset}%`,
|
|
255
|
+
left: `${-60 - midOffset}%`,
|
|
256
|
+
color: colors[1] || colors[0],
|
|
257
|
+
opacity: 0.4 + mid * 0.6,
|
|
258
|
+
scale: 1 + mid * 0.4,
|
|
259
|
+
rotation: -mid * 40,
|
|
260
|
+
blur: 'blur-2xl',
|
|
261
|
+
},
|
|
262
|
+
// High blob - bottom right
|
|
263
|
+
{
|
|
264
|
+
width: `${140 + high * 100}%`,
|
|
265
|
+
height: `${140 + high * 100}%`,
|
|
266
|
+
top: `${70 - highOffset}%`,
|
|
267
|
+
right: `${-50 + highOffset}%`,
|
|
268
|
+
color: colors[2] || colors[0],
|
|
269
|
+
opacity: 0.35 + high * 0.65,
|
|
270
|
+
scale: 1 + high * 0.35,
|
|
271
|
+
rotation: high * 35,
|
|
272
|
+
blur: 'blur-xl',
|
|
273
|
+
},
|
|
274
|
+
// Extra bass reactive blob - top left
|
|
275
|
+
{
|
|
276
|
+
width: `${160 + bass * 140}%`,
|
|
277
|
+
height: `${160 + bass * 140}%`,
|
|
278
|
+
top: `${-60 - bassOffset * 0.8}%`,
|
|
279
|
+
left: `${-60 + bassOffset * 0.8}%`,
|
|
280
|
+
color: colors[3] || colors[1] || colors[0],
|
|
281
|
+
opacity: 0.35 + bass * 0.65,
|
|
282
|
+
scale: 1 + bass * 0.55,
|
|
283
|
+
rotation: -bass * 50,
|
|
284
|
+
blur: 'blur-2xl',
|
|
285
|
+
},
|
|
286
|
+
// Center glow - pulses with overall
|
|
287
|
+
{
|
|
288
|
+
width: `${80 + overall * 150}%`,
|
|
289
|
+
height: `${80 + overall * 150}%`,
|
|
290
|
+
top: '50%',
|
|
291
|
+
left: '50%',
|
|
292
|
+
color: colors[0],
|
|
293
|
+
opacity: 0.3 + overall * 0.5,
|
|
294
|
+
scale: 1 + overall * 0.4,
|
|
295
|
+
rotation: 0,
|
|
296
|
+
isCenter: true,
|
|
297
|
+
blur: 'blur-3xl',
|
|
298
|
+
},
|
|
299
|
+
];
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Calculate spotlight effect properties - highly reactive
|
|
304
|
+
*/
|
|
305
|
+
export function calculateSpotlight(
|
|
306
|
+
levels: AudioLevels,
|
|
307
|
+
config: EffectConfig,
|
|
308
|
+
colors: string[],
|
|
309
|
+
rotation: number
|
|
310
|
+
) {
|
|
311
|
+
const { bass, mid, high, overall } = levels;
|
|
312
|
+
|
|
313
|
+
return {
|
|
314
|
+
// Rotation speed increases with mid frequencies
|
|
315
|
+
rotation: rotation + mid * 180,
|
|
316
|
+
// Border expands with bass
|
|
317
|
+
inset: 12 + bass * 30,
|
|
318
|
+
// Color intensities react to different frequencies
|
|
319
|
+
colors: colors.map((c, i) => ({
|
|
320
|
+
color: c,
|
|
321
|
+
opacity: i === 0
|
|
322
|
+
? 0.3 + bass * 0.7
|
|
323
|
+
: i === 1
|
|
324
|
+
? 0.3 + mid * 0.7
|
|
325
|
+
: 0.3 + high * 0.7,
|
|
326
|
+
})),
|
|
327
|
+
// Pulse glow - big and reactive
|
|
328
|
+
pulseInset: 24 + bass * 50,
|
|
329
|
+
pulseOpacity: 0.3 + bass * 0.7,
|
|
330
|
+
pulseScale: 1 + bass * 0.4,
|
|
331
|
+
// Extra glow ring
|
|
332
|
+
ringOpacity: 0.2 + overall * 0.6,
|
|
333
|
+
ringScale: 1 + overall * 0.3,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* CSS for effect animations - can be injected once
|
|
339
|
+
*/
|
|
340
|
+
export const EFFECT_ANIMATIONS = `
|
|
341
|
+
@keyframes spotlight-spin {
|
|
342
|
+
0% { transform: rotate(0deg); }
|
|
343
|
+
100% { transform: rotate(360deg); }
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
@keyframes orb-float-1 {
|
|
347
|
+
0%, 100% { transform: translate(-50%, -50%) translateY(0); }
|
|
348
|
+
50% { transform: translate(-50%, -50%) translateY(-15px); }
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
@keyframes orb-float-2 {
|
|
352
|
+
0%, 100% { transform: translate(-50%, -50%) translateX(0); }
|
|
353
|
+
50% { transform: translate(-50%, -50%) translateX(15px); }
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
@keyframes orb-float-3 {
|
|
357
|
+
0%, 100% { transform: translate(-50%, -50%) translate(0, 0); }
|
|
358
|
+
33% { transform: translate(-50%, -50%) translate(10px, -10px); }
|
|
359
|
+
66% { transform: translate(-50%, -50%) translate(-10px, 10px); }
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
@keyframes orb-float-4 {
|
|
363
|
+
0%, 100% { transform: translate(-50%, -50%) translate(0, 0); }
|
|
364
|
+
50% { transform: translate(-50%, -50%) translate(-15px, -10px); }
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
@keyframes mesh-float-1 {
|
|
368
|
+
0%, 100% { transform: translate(0, 0) scale(1); }
|
|
369
|
+
25% { transform: translate(-5%, 10%) scale(1.05); }
|
|
370
|
+
50% { transform: translate(5%, 5%) scale(0.95); }
|
|
371
|
+
75% { transform: translate(-3%, -5%) scale(1.02); }
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
@keyframes mesh-float-2 {
|
|
375
|
+
0%, 100% { transform: translate(0, 0) scale(1); }
|
|
376
|
+
33% { transform: translate(8%, -8%) scale(1.08); }
|
|
377
|
+
66% { transform: translate(-6%, 6%) scale(0.92); }
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
@keyframes mesh-float-3 {
|
|
381
|
+
0%, 100% { transform: translate(0, 0) scale(1); }
|
|
382
|
+
50% { transform: translate(10%, 10%) scale(1.1); }
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
@keyframes mesh-float-4 {
|
|
386
|
+
0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
|
|
387
|
+
25% { transform: translate(10%, -5%) scale(1.1) rotate(5deg); }
|
|
388
|
+
50% { transform: translate(-5%, 10%) scale(0.95) rotate(-5deg); }
|
|
389
|
+
75% { transform: translate(-10%, -10%) scale(1.05) rotate(3deg); }
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
@keyframes mesh-pulse {
|
|
393
|
+
0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.3; }
|
|
394
|
+
50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.5; }
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
@keyframes glow-breathe {
|
|
398
|
+
0%, 100% { opacity: 0.6; transform: scale(1); }
|
|
399
|
+
50% { opacity: 1; transform: scale(1.05); }
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
@keyframes glow-rotate {
|
|
403
|
+
0% { transform: rotate(0deg); }
|
|
404
|
+
100% { transform: rotate(360deg); }
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
@keyframes sparkle-move {
|
|
408
|
+
0% { opacity: 0; transform: scale(0.8); }
|
|
409
|
+
50% { opacity: 1; }
|
|
410
|
+
100% { opacity: 0; transform: scale(1.2); }
|
|
411
|
+
}
|
|
412
|
+
`;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AudioPlayer - Audio playback with waveform visualization
|
|
3
|
+
*
|
|
4
|
+
* Built on WaveSurfer.js with audio-reactive effects
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Simple wrapper (recommended for most use cases)
|
|
8
|
+
export { SimpleAudioPlayer } from './SimpleAudioPlayer';
|
|
9
|
+
export type { SimpleAudioPlayerProps } from './SimpleAudioPlayer';
|
|
10
|
+
|
|
11
|
+
// Core components (for advanced usage)
|
|
12
|
+
export { AudioPlayer } from './AudioPlayer';
|
|
13
|
+
export { AudioEqualizer } from './AudioEqualizer';
|
|
14
|
+
export { AudioReactiveCover } from './AudioReactiveCover';
|
|
15
|
+
export { AudioShortcutsPopover } from './AudioShortcutsPopover';
|
|
16
|
+
export { VisualizationToggle } from './VisualizationToggle';
|
|
17
|
+
|
|
18
|
+
// Context and hooks
|
|
19
|
+
export {
|
|
20
|
+
AudioProvider,
|
|
21
|
+
useAudio,
|
|
22
|
+
useAudioControls,
|
|
23
|
+
useAudioState,
|
|
24
|
+
useAudioElement,
|
|
25
|
+
} from './context';
|
|
26
|
+
|
|
27
|
+
export { useAudioHotkeys, AUDIO_SHORTCUTS } from './useAudioHotkeys';
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
useAudioVisualization,
|
|
31
|
+
VisualizationProvider,
|
|
32
|
+
VARIANT_INFO,
|
|
33
|
+
INTENSITY_INFO,
|
|
34
|
+
COLOR_SCHEME_INFO,
|
|
35
|
+
} from './useAudioVisualization';
|
|
36
|
+
|
|
37
|
+
// Effects utilities
|
|
38
|
+
export {
|
|
39
|
+
type EffectVariant,
|
|
40
|
+
type EffectIntensity,
|
|
41
|
+
type EffectColorScheme,
|
|
42
|
+
type AudioLevels,
|
|
43
|
+
type EffectConfig,
|
|
44
|
+
type EffectColors,
|
|
45
|
+
type EffectLayer,
|
|
46
|
+
INTENSITY_CONFIG,
|
|
47
|
+
COLOR_SCHEMES,
|
|
48
|
+
getEffectConfig,
|
|
49
|
+
getColors,
|
|
50
|
+
prepareEffectColors,
|
|
51
|
+
calculateGlowLayers,
|
|
52
|
+
calculateOrbs,
|
|
53
|
+
calculateMeshGradients,
|
|
54
|
+
calculateSpotlight,
|
|
55
|
+
EFFECT_ANIMATIONS,
|
|
56
|
+
} from './effects';
|
|
57
|
+
|
|
58
|
+
// Types
|
|
59
|
+
export type {
|
|
60
|
+
AudioSource,
|
|
61
|
+
PlaybackStatus,
|
|
62
|
+
WaveformOptions,
|
|
63
|
+
EqualizerOptions,
|
|
64
|
+
AudioContextState,
|
|
65
|
+
AudioPlayerProps,
|
|
66
|
+
AudioEqualizerProps,
|
|
67
|
+
AudioReactiveCoverProps,
|
|
68
|
+
AudioViewerProps,
|
|
69
|
+
} from './types';
|
|
70
|
+
|
|
71
|
+
export type {
|
|
72
|
+
VisualizationSettings,
|
|
73
|
+
VisualizationVariant,
|
|
74
|
+
VisualizationIntensity,
|
|
75
|
+
VisualizationColorScheme,
|
|
76
|
+
UseAudioVisualizationReturn,
|
|
77
|
+
VisualizationProviderProps,
|
|
78
|
+
} from './useAudioVisualization';
|
|
79
|
+
|
|
80
|
+
export type {
|
|
81
|
+
AudioHotkeyOptions,
|
|
82
|
+
ShortcutItem,
|
|
83
|
+
ShortcutGroup,
|
|
84
|
+
} from './useAudioHotkeys';
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type WaveSurfer from 'wavesurfer.js';
|
|
3
|
+
import type { AudioLevels } from './effects';
|
|
4
|
+
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// AUDIO SOURCE
|
|
7
|
+
// =============================================================================
|
|
8
|
+
|
|
9
|
+
export interface AudioSource {
|
|
10
|
+
uri: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// =============================================================================
|
|
14
|
+
// PLAYBACK STATE
|
|
15
|
+
// =============================================================================
|
|
16
|
+
|
|
17
|
+
export interface PlaybackStatus {
|
|
18
|
+
isLoaded: boolean;
|
|
19
|
+
isPlaying: boolean;
|
|
20
|
+
duration: number;
|
|
21
|
+
currentTime: number;
|
|
22
|
+
volume: number;
|
|
23
|
+
isMuted: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// =============================================================================
|
|
27
|
+
// WAVEFORM OPTIONS
|
|
28
|
+
// =============================================================================
|
|
29
|
+
|
|
30
|
+
export interface WaveformOptions {
|
|
31
|
+
waveColor?: string;
|
|
32
|
+
progressColor?: string;
|
|
33
|
+
height?: number;
|
|
34
|
+
barWidth?: number;
|
|
35
|
+
barRadius?: number;
|
|
36
|
+
barGap?: number;
|
|
37
|
+
cursorWidth?: number;
|
|
38
|
+
cursorColor?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// =============================================================================
|
|
42
|
+
// EQUALIZER OPTIONS
|
|
43
|
+
// =============================================================================
|
|
44
|
+
|
|
45
|
+
export interface EqualizerOptions {
|
|
46
|
+
barCount?: number;
|
|
47
|
+
height?: number;
|
|
48
|
+
gap?: number;
|
|
49
|
+
showPeaks?: boolean;
|
|
50
|
+
barColor?: string;
|
|
51
|
+
peakColor?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// =============================================================================
|
|
55
|
+
// AUDIO CONTEXT STATE
|
|
56
|
+
// =============================================================================
|
|
57
|
+
|
|
58
|
+
export interface AudioContextState {
|
|
59
|
+
// Core instances
|
|
60
|
+
wavesurfer: WaveSurfer | null;
|
|
61
|
+
audioElement: HTMLMediaElement | null;
|
|
62
|
+
|
|
63
|
+
// Playback state
|
|
64
|
+
isReady: boolean;
|
|
65
|
+
isPlaying: boolean;
|
|
66
|
+
currentTime: number;
|
|
67
|
+
duration: number;
|
|
68
|
+
volume: number;
|
|
69
|
+
isMuted: boolean;
|
|
70
|
+
|
|
71
|
+
// Audio analysis (for reactive effects)
|
|
72
|
+
audioLevels: AudioLevels;
|
|
73
|
+
|
|
74
|
+
// Actions
|
|
75
|
+
play: () => Promise<void>;
|
|
76
|
+
pause: () => void;
|
|
77
|
+
togglePlay: () => void;
|
|
78
|
+
seek: (time: number) => void;
|
|
79
|
+
seekTo: (progress: number) => void;
|
|
80
|
+
skip: (seconds: number) => void;
|
|
81
|
+
setVolume: (volume: number) => void;
|
|
82
|
+
toggleMute: () => void;
|
|
83
|
+
restart: () => void;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// =============================================================================
|
|
87
|
+
// COMPONENT PROPS
|
|
88
|
+
// =============================================================================
|
|
89
|
+
|
|
90
|
+
export interface AudioPlayerProps {
|
|
91
|
+
/** Show playback controls */
|
|
92
|
+
showControls?: boolean;
|
|
93
|
+
/** Show waveform visualization */
|
|
94
|
+
showWaveform?: boolean;
|
|
95
|
+
/** Show equalizer animation */
|
|
96
|
+
showEqualizer?: boolean;
|
|
97
|
+
/** Show timer (position/duration) */
|
|
98
|
+
showTimer?: boolean;
|
|
99
|
+
/** Show volume control */
|
|
100
|
+
showVolume?: boolean;
|
|
101
|
+
/** WaveSurfer options override */
|
|
102
|
+
waveformOptions?: WaveformOptions;
|
|
103
|
+
/** Equalizer options */
|
|
104
|
+
equalizerOptions?: EqualizerOptions;
|
|
105
|
+
/** Additional class name */
|
|
106
|
+
className?: string;
|
|
107
|
+
/** Additional styles */
|
|
108
|
+
style?: CSSProperties;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface AudioEqualizerProps {
|
|
112
|
+
/** Number of frequency bars */
|
|
113
|
+
barCount?: number;
|
|
114
|
+
/** Height of the equalizer in pixels */
|
|
115
|
+
height?: number;
|
|
116
|
+
/** Gap between bars in pixels */
|
|
117
|
+
gap?: number;
|
|
118
|
+
/** Show peak indicators */
|
|
119
|
+
showPeaks?: boolean;
|
|
120
|
+
/** Bar color (CSS color) */
|
|
121
|
+
barColor?: string;
|
|
122
|
+
/** Peak indicator color */
|
|
123
|
+
peakColor?: string;
|
|
124
|
+
/** Additional class name */
|
|
125
|
+
className?: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface AudioReactiveCoverProps {
|
|
129
|
+
/** Visual variant */
|
|
130
|
+
variant?: 'glow' | 'orbs' | 'spotlight' | 'mesh';
|
|
131
|
+
/** Intensity of effects */
|
|
132
|
+
intensity?: 'subtle' | 'medium' | 'strong';
|
|
133
|
+
/** Color scheme */
|
|
134
|
+
colorScheme?: 'primary' | 'vibrant' | 'cool' | 'warm';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface AudioViewerProps {
|
|
138
|
+
/** Audio source URL */
|
|
139
|
+
source: AudioSource;
|
|
140
|
+
/** Auto-play when loaded */
|
|
141
|
+
autoPlay?: boolean;
|
|
142
|
+
/** Show playback controls */
|
|
143
|
+
showControls?: boolean;
|
|
144
|
+
/** Show waveform visualization */
|
|
145
|
+
showWaveform?: boolean;
|
|
146
|
+
/** Show equalizer animation */
|
|
147
|
+
showEqualizer?: boolean;
|
|
148
|
+
/** Show timer */
|
|
149
|
+
showTimer?: boolean;
|
|
150
|
+
/** Show volume control */
|
|
151
|
+
showVolume?: boolean;
|
|
152
|
+
/** Waveform options */
|
|
153
|
+
waveformOptions?: WaveformOptions;
|
|
154
|
+
/** Equalizer options */
|
|
155
|
+
equalizerOptions?: EqualizerOptions;
|
|
156
|
+
/** Callback on playback status change */
|
|
157
|
+
onPlaybackStatusUpdate?: (status: PlaybackStatus) => void;
|
|
158
|
+
/** Additional class name */
|
|
159
|
+
className?: string;
|
|
160
|
+
/** Additional styles */
|
|
161
|
+
style?: CSSProperties;
|
|
162
|
+
}
|