@djangocfg/ui-nextjs 2.1.90 → 2.1.91

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 (161) hide show
  1. package/README.md +6 -15
  2. package/package.json +6 -25
  3. package/src/blocks/SplitHero/SplitHeroMedia.tsx +1 -1
  4. package/src/components/index.ts +0 -40
  5. package/src/hooks/index.ts +0 -6
  6. package/src/index.ts +2 -11
  7. package/src/components/button-download.tsx +0 -277
  8. package/src/components/markdown/MarkdownMessage.tsx +0 -340
  9. package/src/components/markdown/index.ts +0 -5
  10. package/src/components/menubar.tsx +0 -275
  11. package/src/components/multi-select-pro/async.tsx +0 -598
  12. package/src/components/multi-select-pro/helpers.tsx +0 -84
  13. package/src/components/multi-select-pro/index.tsx +0 -612
  14. package/src/components/navigation-menu.tsx +0 -154
  15. package/src/components/otp/index.tsx +0 -197
  16. package/src/components/otp/types.ts +0 -133
  17. package/src/components/otp/use-otp-input.ts +0 -225
  18. package/src/components/phone-input.tsx +0 -277
  19. package/src/components/sonner.tsx +0 -32
  20. package/src/hooks/useLocalStorage.ts +0 -300
  21. package/src/hooks/useSessionStorage.ts +0 -290
  22. package/src/lib/index.ts +0 -5
  23. package/src/lib/logger/index.ts +0 -10
  24. package/src/lib/logger/logStore.ts +0 -122
  25. package/src/lib/logger/logger.ts +0 -175
  26. package/src/lib/logger/types.ts +0 -82
  27. package/src/stores/index.ts +0 -8
  28. package/src/stores/mediaCache.ts +0 -534
  29. package/src/tools/AudioPlayer/README.md +0 -206
  30. package/src/tools/AudioPlayer/components/HybridAudioPlayer.tsx +0 -216
  31. package/src/tools/AudioPlayer/components/HybridSimplePlayer.tsx +0 -280
  32. package/src/tools/AudioPlayer/components/HybridWaveform.tsx +0 -279
  33. package/src/tools/AudioPlayer/components/ReactiveCover/AudioReactiveCover.tsx +0 -149
  34. package/src/tools/AudioPlayer/components/ReactiveCover/effects/GlowEffect.tsx +0 -110
  35. package/src/tools/AudioPlayer/components/ReactiveCover/effects/MeshEffect.tsx +0 -58
  36. package/src/tools/AudioPlayer/components/ReactiveCover/effects/OrbsEffect.tsx +0 -45
  37. package/src/tools/AudioPlayer/components/ReactiveCover/effects/SpotlightEffect.tsx +0 -82
  38. package/src/tools/AudioPlayer/components/ReactiveCover/effects/index.ts +0 -8
  39. package/src/tools/AudioPlayer/components/ReactiveCover/index.ts +0 -6
  40. package/src/tools/AudioPlayer/components/index.ts +0 -22
  41. package/src/tools/AudioPlayer/context/HybridAudioProvider.tsx +0 -158
  42. package/src/tools/AudioPlayer/context/index.ts +0 -16
  43. package/src/tools/AudioPlayer/effects/index.ts +0 -412
  44. package/src/tools/AudioPlayer/hooks/index.ts +0 -35
  45. package/src/tools/AudioPlayer/hooks/useHybridAudio.ts +0 -387
  46. package/src/tools/AudioPlayer/hooks/useHybridAudioAnalysis.ts +0 -95
  47. package/src/tools/AudioPlayer/hooks/useVisualization.tsx +0 -207
  48. package/src/tools/AudioPlayer/index.ts +0 -133
  49. package/src/tools/AudioPlayer/types/effects.ts +0 -73
  50. package/src/tools/AudioPlayer/types/index.ts +0 -27
  51. package/src/tools/AudioPlayer/utils/debug.ts +0 -14
  52. package/src/tools/AudioPlayer/utils/formatTime.ts +0 -10
  53. package/src/tools/AudioPlayer/utils/index.ts +0 -6
  54. package/src/tools/ImageViewer/@refactoring/00-PLAN.md +0 -71
  55. package/src/tools/ImageViewer/@refactoring/01-TYPES.md +0 -121
  56. package/src/tools/ImageViewer/@refactoring/02-UTILS.md +0 -143
  57. package/src/tools/ImageViewer/@refactoring/03-HOOKS.md +0 -261
  58. package/src/tools/ImageViewer/@refactoring/04-COMPONENTS.md +0 -427
  59. package/src/tools/ImageViewer/@refactoring/05-EXECUTION-CHECKLIST.md +0 -126
  60. package/src/tools/ImageViewer/README.md +0 -200
  61. package/src/tools/ImageViewer/components/ImageInfo.tsx +0 -44
  62. package/src/tools/ImageViewer/components/ImageToolbar.tsx +0 -150
  63. package/src/tools/ImageViewer/components/ImageViewer.tsx +0 -241
  64. package/src/tools/ImageViewer/components/index.ts +0 -7
  65. package/src/tools/ImageViewer/hooks/index.ts +0 -9
  66. package/src/tools/ImageViewer/hooks/useImageLoading.ts +0 -204
  67. package/src/tools/ImageViewer/hooks/useImageTransform.ts +0 -101
  68. package/src/tools/ImageViewer/index.ts +0 -60
  69. package/src/tools/ImageViewer/types.ts +0 -81
  70. package/src/tools/ImageViewer/utils/constants.ts +0 -59
  71. package/src/tools/ImageViewer/utils/debug.ts +0 -14
  72. package/src/tools/ImageViewer/utils/index.ts +0 -17
  73. package/src/tools/ImageViewer/utils/lqip.ts +0 -47
  74. package/src/tools/JsonForm/JsonSchemaForm.tsx +0 -197
  75. package/src/tools/JsonForm/examples/BotConfigExample.tsx +0 -249
  76. package/src/tools/JsonForm/examples/RealBotConfigExample.tsx +0 -161
  77. package/src/tools/JsonForm/index.ts +0 -46
  78. package/src/tools/JsonForm/templates/ArrayFieldItemTemplate.tsx +0 -47
  79. package/src/tools/JsonForm/templates/ArrayFieldTemplate.tsx +0 -74
  80. package/src/tools/JsonForm/templates/BaseInputTemplate.tsx +0 -107
  81. package/src/tools/JsonForm/templates/ErrorListTemplate.tsx +0 -35
  82. package/src/tools/JsonForm/templates/FieldTemplate.tsx +0 -62
  83. package/src/tools/JsonForm/templates/ObjectFieldTemplate.tsx +0 -116
  84. package/src/tools/JsonForm/templates/index.ts +0 -12
  85. package/src/tools/JsonForm/types.ts +0 -83
  86. package/src/tools/JsonForm/utils.ts +0 -213
  87. package/src/tools/JsonForm/widgets/CheckboxWidget.tsx +0 -37
  88. package/src/tools/JsonForm/widgets/ColorWidget.tsx +0 -219
  89. package/src/tools/JsonForm/widgets/NumberWidget.tsx +0 -89
  90. package/src/tools/JsonForm/widgets/SelectWidget.tsx +0 -97
  91. package/src/tools/JsonForm/widgets/SliderWidget.tsx +0 -148
  92. package/src/tools/JsonForm/widgets/SwitchWidget.tsx +0 -35
  93. package/src/tools/JsonForm/widgets/TextWidget.tsx +0 -96
  94. package/src/tools/JsonForm/widgets/index.ts +0 -14
  95. package/src/tools/JsonTree/index.tsx +0 -243
  96. package/src/tools/LottiePlayer/LottiePlayer.client.tsx +0 -213
  97. package/src/tools/LottiePlayer/index.tsx +0 -55
  98. package/src/tools/LottiePlayer/types.ts +0 -108
  99. package/src/tools/LottiePlayer/useLottie.ts +0 -164
  100. package/src/tools/Mermaid/Mermaid.client.tsx +0 -82
  101. package/src/tools/Mermaid/components/MermaidCodeViewer.tsx +0 -95
  102. package/src/tools/Mermaid/components/MermaidFullscreenModal.tsx +0 -103
  103. package/src/tools/Mermaid/hooks/index.ts +0 -4
  104. package/src/tools/Mermaid/hooks/useMermaidCleanup.ts +0 -73
  105. package/src/tools/Mermaid/hooks/useMermaidFullscreen.ts +0 -46
  106. package/src/tools/Mermaid/hooks/useMermaidRenderer.ts +0 -226
  107. package/src/tools/Mermaid/hooks/useMermaidValidation.ts +0 -29
  108. package/src/tools/Mermaid/index.tsx +0 -41
  109. package/src/tools/Mermaid/utils/mermaid-helpers.ts +0 -33
  110. package/src/tools/OpenapiViewer/components/EndpointInfo.tsx +0 -149
  111. package/src/tools/OpenapiViewer/components/EndpointsLibrary.tsx +0 -263
  112. package/src/tools/OpenapiViewer/components/PlaygroundLayout.tsx +0 -125
  113. package/src/tools/OpenapiViewer/components/PlaygroundStepper.tsx +0 -100
  114. package/src/tools/OpenapiViewer/components/RequestBuilder.tsx +0 -157
  115. package/src/tools/OpenapiViewer/components/RequestParametersForm.tsx +0 -253
  116. package/src/tools/OpenapiViewer/components/ResponseViewer.tsx +0 -173
  117. package/src/tools/OpenapiViewer/components/VersionSelector.tsx +0 -68
  118. package/src/tools/OpenapiViewer/components/index.ts +0 -14
  119. package/src/tools/OpenapiViewer/constants.ts +0 -39
  120. package/src/tools/OpenapiViewer/context/PlaygroundContext.tsx +0 -337
  121. package/src/tools/OpenapiViewer/hooks/index.ts +0 -8
  122. package/src/tools/OpenapiViewer/hooks/useMobile.ts +0 -10
  123. package/src/tools/OpenapiViewer/hooks/useOpenApiSchema.ts +0 -199
  124. package/src/tools/OpenapiViewer/index.tsx +0 -38
  125. package/src/tools/OpenapiViewer/types.ts +0 -151
  126. package/src/tools/OpenapiViewer/utils/apiKeyManager.ts +0 -149
  127. package/src/tools/OpenapiViewer/utils/formatters.ts +0 -71
  128. package/src/tools/OpenapiViewer/utils/index.ts +0 -9
  129. package/src/tools/OpenapiViewer/utils/versionManager.ts +0 -161
  130. package/src/tools/PrettyCode/PrettyCode.client.tsx +0 -208
  131. package/src/tools/PrettyCode/index.tsx +0 -45
  132. package/src/tools/VideoPlayer/@refactoring/00-PLAN.md +0 -91
  133. package/src/tools/VideoPlayer/@refactoring/01-TYPES.md +0 -284
  134. package/src/tools/VideoPlayer/@refactoring/02-UTILS.md +0 -141
  135. package/src/tools/VideoPlayer/@refactoring/03-HOOKS.md +0 -178
  136. package/src/tools/VideoPlayer/@refactoring/04-COMPONENTS.md +0 -95
  137. package/src/tools/VideoPlayer/@refactoring/05-EXECUTION-CHECKLIST.md +0 -139
  138. package/src/tools/VideoPlayer/README.md +0 -264
  139. package/src/tools/VideoPlayer/components/VideoControls.tsx +0 -138
  140. package/src/tools/VideoPlayer/components/VideoErrorFallback.tsx +0 -174
  141. package/src/tools/VideoPlayer/components/VideoPlayer.tsx +0 -201
  142. package/src/tools/VideoPlayer/components/index.ts +0 -14
  143. package/src/tools/VideoPlayer/context/VideoPlayerContext.tsx +0 -52
  144. package/src/tools/VideoPlayer/context/index.ts +0 -8
  145. package/src/tools/VideoPlayer/hooks/index.ts +0 -12
  146. package/src/tools/VideoPlayer/hooks/useVideoPlayerSettings.ts +0 -70
  147. package/src/tools/VideoPlayer/hooks/useVideoPositionCache.ts +0 -116
  148. package/src/tools/VideoPlayer/index.ts +0 -77
  149. package/src/tools/VideoPlayer/providers/NativeProvider.tsx +0 -284
  150. package/src/tools/VideoPlayer/providers/StreamProvider.tsx +0 -505
  151. package/src/tools/VideoPlayer/providers/VidstackProvider.tsx +0 -400
  152. package/src/tools/VideoPlayer/providers/index.ts +0 -8
  153. package/src/tools/VideoPlayer/types/index.ts +0 -38
  154. package/src/tools/VideoPlayer/types/player.ts +0 -116
  155. package/src/tools/VideoPlayer/types/provider.ts +0 -93
  156. package/src/tools/VideoPlayer/types/sources.ts +0 -97
  157. package/src/tools/VideoPlayer/utils/debug.ts +0 -14
  158. package/src/tools/VideoPlayer/utils/fileSource.ts +0 -78
  159. package/src/tools/VideoPlayer/utils/index.ts +0 -12
  160. package/src/tools/VideoPlayer/utils/resolvers.ts +0 -75
  161. package/src/tools/index.ts +0 -170
@@ -1,207 +0,0 @@
1
- 'use client';
2
-
3
- /**
4
- * useVisualization - Hook for managing audio visualization settings
5
- *
6
- * Persists settings in localStorage for user preferences
7
- * Uses React Context for shared state between components
8
- */
9
-
10
- import { createContext, useContext, useCallback, useMemo, type ReactNode } from 'react';
11
- import { useLocalStorage } from '@djangocfg/ui-nextjs';
12
-
13
- // =============================================================================
14
- // TYPES
15
- // =============================================================================
16
-
17
- export type VisualizationVariant = 'glow' | 'orbs' | 'spotlight' | 'mesh' | 'none';
18
- export type VisualizationIntensity = 'subtle' | 'medium' | 'strong';
19
- export type VisualizationColorScheme = 'primary' | 'vibrant' | 'cool' | 'warm';
20
-
21
- export interface VisualizationSettings {
22
- /** Enable reactive cover animation */
23
- enabled: boolean;
24
- /** Visual effect variant */
25
- variant: VisualizationVariant;
26
- /** Effect intensity */
27
- intensity: VisualizationIntensity;
28
- /** Color scheme */
29
- colorScheme: VisualizationColorScheme;
30
- /** Playback volume (0-1) */
31
- volume: number;
32
- /** Loop playback */
33
- isLooping: boolean;
34
- }
35
-
36
- export interface UseVisualizationReturn {
37
- /** Current settings */
38
- settings: VisualizationSettings;
39
- /** Toggle visualization on/off */
40
- toggle: () => void;
41
- /** Set specific setting */
42
- setSetting: <K extends keyof VisualizationSettings>(
43
- key: K,
44
- value: VisualizationSettings[K]
45
- ) => void;
46
- /** Cycle to next variant */
47
- nextVariant: () => void;
48
- /** Cycle to next intensity */
49
- nextIntensity: () => void;
50
- /** Cycle to next color scheme */
51
- nextColorScheme: () => void;
52
- /** Reset to defaults */
53
- reset: () => void;
54
- }
55
-
56
- // Backward compatibility alias
57
- export type UseAudioVisualizationReturn = UseVisualizationReturn;
58
-
59
- // =============================================================================
60
- // CONSTANTS
61
- // =============================================================================
62
-
63
- const STORAGE_KEY = 'audio-player-settings';
64
-
65
- const DEFAULT_SETTINGS: VisualizationSettings = {
66
- enabled: true,
67
- variant: 'spotlight',
68
- intensity: 'medium',
69
- colorScheme: 'primary',
70
- volume: 1,
71
- isLooping: false,
72
- };
73
-
74
- const VARIANTS: VisualizationVariant[] = ['spotlight', 'glow', 'orbs', 'mesh', 'none'];
75
- const INTENSITIES: VisualizationIntensity[] = ['subtle', 'medium', 'strong'];
76
- const COLOR_SCHEMES: VisualizationColorScheme[] = ['primary', 'vibrant', 'cool', 'warm'];
77
-
78
- // =============================================================================
79
- // CONTEXT
80
- // =============================================================================
81
-
82
- const VisualizationContext = createContext<UseVisualizationReturn | null>(null);
83
-
84
- // =============================================================================
85
- // PROVIDER
86
- // =============================================================================
87
-
88
- export interface VisualizationProviderProps {
89
- children: ReactNode;
90
- }
91
-
92
- export function VisualizationProvider({ children }: VisualizationProviderProps) {
93
- const value = useVisualizationState();
94
- return (
95
- <VisualizationContext.Provider value={value}>
96
- {children}
97
- </VisualizationContext.Provider>
98
- );
99
- }
100
-
101
- // =============================================================================
102
- // INTERNAL HOOK (creates the actual state)
103
- // =============================================================================
104
-
105
- function useVisualizationState(): UseVisualizationReturn {
106
- const [settings, setSettings] = useLocalStorage<VisualizationSettings>(
107
- STORAGE_KEY,
108
- DEFAULT_SETTINGS
109
- );
110
-
111
- const toggle = useCallback(() => {
112
- setSettings((prev) => ({ ...prev, enabled: !prev.enabled }));
113
- }, [setSettings]);
114
-
115
- const setSetting = useCallback(
116
- <K extends keyof VisualizationSettings>(
117
- key: K,
118
- value: VisualizationSettings[K]
119
- ) => {
120
- setSettings((prev) => ({ ...prev, [key]: value }));
121
- },
122
- [setSettings]
123
- );
124
-
125
- const nextVariant = useCallback(() => {
126
- setSettings((prev) => {
127
- const currentIndex = VARIANTS.indexOf(prev.variant);
128
- const nextIndex = (currentIndex + 1) % VARIANTS.length;
129
- return { ...prev, variant: VARIANTS[nextIndex] };
130
- });
131
- }, [setSettings]);
132
-
133
- const nextIntensity = useCallback(() => {
134
- setSettings((prev) => {
135
- const currentIndex = INTENSITIES.indexOf(prev.intensity);
136
- const nextIndex = (currentIndex + 1) % INTENSITIES.length;
137
- return { ...prev, intensity: INTENSITIES[nextIndex] };
138
- });
139
- }, [setSettings]);
140
-
141
- const nextColorScheme = useCallback(() => {
142
- setSettings((prev) => {
143
- const currentIndex = COLOR_SCHEMES.indexOf(prev.colorScheme);
144
- const nextIndex = (currentIndex + 1) % COLOR_SCHEMES.length;
145
- return { ...prev, colorScheme: COLOR_SCHEMES[nextIndex] };
146
- });
147
- }, [setSettings]);
148
-
149
- const reset = useCallback(() => {
150
- setSettings(DEFAULT_SETTINGS);
151
- }, [setSettings]);
152
-
153
- return useMemo(
154
- () => ({
155
- settings,
156
- toggle,
157
- setSetting,
158
- nextVariant,
159
- nextIntensity,
160
- nextColorScheme,
161
- reset,
162
- }),
163
- [settings, toggle, setSetting, nextVariant, nextIntensity, nextColorScheme, reset]
164
- );
165
- }
166
-
167
- // =============================================================================
168
- // HOOK (uses context when available)
169
- // =============================================================================
170
-
171
- export function useVisualization(): UseVisualizationReturn {
172
- const context = useContext(VisualizationContext);
173
-
174
- // Always call the fallback hooks (React hooks rules require consistent calls)
175
- const fallbackState = useVisualizationState();
176
-
177
- // If inside a provider, use shared context; otherwise use fallback
178
- return context ?? fallbackState;
179
- }
180
-
181
- // Backward compatibility alias
182
- export const useAudioVisualization = useVisualization;
183
-
184
- // =============================================================================
185
- // VARIANT INFO
186
- // =============================================================================
187
-
188
- export const VARIANT_INFO: Record<VisualizationVariant, { label: string; icon: string }> = {
189
- spotlight: { label: 'Spotlight', icon: '💫' },
190
- glow: { label: 'Glow', icon: '✨' },
191
- orbs: { label: 'Orbs', icon: '🔮' },
192
- mesh: { label: 'Mesh', icon: '🌈' },
193
- none: { label: 'Off', icon: '⭕' },
194
- };
195
-
196
- export const INTENSITY_INFO: Record<VisualizationIntensity, { label: string }> = {
197
- subtle: { label: 'Subtle' },
198
- medium: { label: 'Medium' },
199
- strong: { label: 'Strong' },
200
- };
201
-
202
- export const COLOR_SCHEME_INFO: Record<VisualizationColorScheme, { label: string; preview: string }> = {
203
- primary: { label: 'Primary', preview: '🔵' },
204
- vibrant: { label: 'Vibrant', preview: '🌈' },
205
- cool: { label: 'Cool', preview: '💙' },
206
- warm: { label: 'Warm', preview: '🔥' },
207
- };
@@ -1,133 +0,0 @@
1
- /**
2
- * AudioPlayer - Complete audio playback solution with reactive visualizations
3
- *
4
- * Uses HTML5 audio for playback + Web Audio API for visualization.
5
- * No crackling, native streaming support.
6
- *
7
- * @example
8
- * // Simple usage
9
- * import { HybridSimplePlayer } from '@djangocfg/ui-nextjs';
10
- * <HybridSimplePlayer src="/audio.mp3" title="Track Title" />
11
- *
12
- * @example
13
- * // Custom setup with context
14
- * import { HybridAudioProvider, HybridAudioPlayer } from '@djangocfg/ui-nextjs';
15
- * <HybridAudioProvider src={audioUrl}>
16
- * <HybridAudioPlayer showWaveform showControls />
17
- * </HybridAudioProvider>
18
- */
19
-
20
- // =============================================================================
21
- // COMPONENTS
22
- // =============================================================================
23
-
24
- export {
25
- HybridAudioPlayer,
26
- HybridSimplePlayer,
27
- HybridWaveform,
28
- AudioReactiveCover,
29
- // Effect components (for custom implementations)
30
- GlowEffect,
31
- OrbsEffect,
32
- SpotlightEffect,
33
- MeshEffect,
34
- } from './components';
35
-
36
- export type {
37
- HybridAudioPlayerProps,
38
- HybridSimplePlayerProps,
39
- HybridWaveformProps,
40
- AudioReactiveCoverProps,
41
- GlowEffectData,
42
- } from './components';
43
-
44
- // =============================================================================
45
- // CONTEXT
46
- // =============================================================================
47
-
48
- export {
49
- HybridAudioProvider,
50
- useHybridAudioContext,
51
- useHybridAudioState,
52
- useHybridAudioControls,
53
- useHybridAudioLevels,
54
- useHybridWebAudio,
55
- } from './context';
56
-
57
- export type {
58
- HybridAudioContextValue,
59
- HybridAudioProviderProps,
60
- } from './context';
61
-
62
- // =============================================================================
63
- // HOOKS
64
- // =============================================================================
65
-
66
- export {
67
- // Core hooks
68
- useHybridAudio,
69
- useHybridAudioAnalysis,
70
- // Visualization settings
71
- useVisualization,
72
- useAudioVisualization,
73
- VisualizationProvider,
74
- VARIANT_INFO,
75
- INTENSITY_INFO,
76
- COLOR_SCHEME_INFO,
77
- } from './hooks';
78
-
79
- export type {
80
- UseHybridAudioOptions,
81
- HybridAudioState,
82
- HybridAudioControls,
83
- HybridWebAudioAPI,
84
- UseHybridAudioReturn,
85
- VisualizationSettings,
86
- VisualizationVariant,
87
- VisualizationIntensity,
88
- VisualizationColorScheme,
89
- UseVisualizationReturn,
90
- UseAudioVisualizationReturn,
91
- VisualizationProviderProps,
92
- } from './hooks';
93
-
94
- // =============================================================================
95
- // TYPES
96
- // =============================================================================
97
-
98
- export type { EqualizerOptions } from './types';
99
-
100
- // =============================================================================
101
- // EFFECTS
102
- // =============================================================================
103
-
104
- export {
105
- // Utilities
106
- getEffectConfig,
107
- getColors,
108
- prepareEffectColors,
109
- calculateGlowLayers,
110
- calculateOrbs,
111
- calculateMeshGradients,
112
- calculateSpotlight,
113
- // Constants
114
- INTENSITY_CONFIG,
115
- COLOR_SCHEMES,
116
- EFFECT_ANIMATIONS,
117
- } from './effects';
118
-
119
- export type {
120
- EffectVariant,
121
- EffectIntensity,
122
- EffectColorScheme,
123
- AudioLevels,
124
- EffectConfig,
125
- EffectColors,
126
- EffectLayer,
127
- } from './effects';
128
-
129
- // =============================================================================
130
- // UTILITIES
131
- // =============================================================================
132
-
133
- export { formatTime } from './utils';
@@ -1,73 +0,0 @@
1
- /**
2
- * Effect-related types for audio-reactive visualizations
3
- */
4
-
5
- // =============================================================================
6
- // EFFECT TYPES
7
- // =============================================================================
8
-
9
- export type EffectVariant = 'glow' | 'orbs' | 'spotlight' | 'mesh';
10
- export type EffectIntensity = 'subtle' | 'medium' | 'strong';
11
- export type EffectColorScheme = 'primary' | 'vibrant' | 'cool' | 'warm';
12
-
13
- export interface AudioLevels {
14
- bass: number;
15
- mid: number;
16
- high: number;
17
- overall: number;
18
- }
19
-
20
- export interface EffectConfig {
21
- opacity: number;
22
- scale: number;
23
- blur: string;
24
- }
25
-
26
- export interface EffectColors {
27
- colors: string[];
28
- hueShift: number;
29
- }
30
-
31
- export interface EffectLayer {
32
- inset: number;
33
- opacity: number;
34
- scale: number;
35
- background: string;
36
- blur: string;
37
- animation?: string;
38
- }
39
-
40
- export interface Orb {
41
- x: number;
42
- y: number;
43
- size: number;
44
- color: string;
45
- opacity: number;
46
- scale: number;
47
- }
48
-
49
- export interface MeshGradient {
50
- width: string;
51
- height: string;
52
- top?: string;
53
- bottom?: string;
54
- left?: string;
55
- right?: string;
56
- color: string;
57
- opacity: number;
58
- scale: number;
59
- rotation: number;
60
- blur: string;
61
- isCenter?: boolean;
62
- }
63
-
64
- export interface SpotlightData {
65
- rotation: number;
66
- inset: number;
67
- colors: Array<{ color: string; opacity: number }>;
68
- pulseInset: number;
69
- pulseOpacity: number;
70
- pulseScale: number;
71
- ringOpacity: number;
72
- ringScale: number;
73
- }
@@ -1,27 +0,0 @@
1
- /**
2
- * AudioPlayer types
3
- */
4
-
5
- // Equalizer options
6
- export interface EqualizerOptions {
7
- barCount?: number;
8
- height?: number;
9
- gap?: number;
10
- showPeaks?: boolean;
11
- barColor?: string;
12
- peakColor?: string;
13
- }
14
-
15
- // Effect types
16
- export type {
17
- EffectVariant,
18
- EffectIntensity,
19
- EffectColorScheme,
20
- AudioLevels,
21
- EffectConfig,
22
- EffectColors,
23
- EffectLayer,
24
- Orb,
25
- MeshGradient,
26
- SpotlightData,
27
- } from './effects';
@@ -1,14 +0,0 @@
1
- 'use client';
2
-
3
- /**
4
- * AudioPlayer Debug Logger
5
- *
6
- * Uses universal logger with media-specific helpers.
7
- * Logs go to both console (dev) and zustand store (for Console panel).
8
- */
9
-
10
- import { createMediaLogger } from '../../../lib/logger';
11
-
12
- export const audioDebug = createMediaLogger('AudioPlayer');
13
-
14
- export default audioDebug;
@@ -1,10 +0,0 @@
1
- /**
2
- * formatTime - Format seconds to mm:ss string
3
- */
4
-
5
- export function formatTime(seconds: number): string {
6
- if (!seconds || !isFinite(seconds) || seconds < 0) return '0:00';
7
- const mins = Math.floor(seconds / 60);
8
- const secs = Math.floor(seconds % 60);
9
- return `${mins}:${secs.toString().padStart(2, '0')}`;
10
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * AudioPlayer utilities - Public API
3
- */
4
-
5
- export { formatTime } from './formatTime';
6
- export { audioDebug } from './debug';
@@ -1,71 +0,0 @@
1
- # ImageViewer Refactoring Plan
2
-
3
- ## Overview
4
-
5
- Decompose the monolithic 589-line `ImageViewer.tsx` into a well-organized module structure similar to AudioPlayer.
6
-
7
- ## Current Structure (Before)
8
-
9
- ```
10
- ImageViewer/
11
- ├── ImageViewer.tsx (589 lines) - Everything in one file
12
- ├── index.ts (16 lines)
13
- └── README.md
14
- ```
15
-
16
- **Issues:**
17
- - Single 589-line file with mixed concerns
18
- - 2 sub-components inline (ImageToolbar, ImageInfo)
19
- - 1 utility function inline (createLQIP)
20
- - 8 separate useState calls
21
- - Types defined inline
22
- - Constants hardcoded
23
-
24
- ## Target Structure (After)
25
-
26
- ```
27
- ImageViewer/
28
- ├── index.ts # Public API
29
- ├── README.md # Documentation
30
- ├── components/
31
- │ ├── index.ts
32
- │ ├── ImageViewer.tsx # Main component (~150 lines)
33
- │ ├── ImageToolbar.tsx # Toolbar with zoom/rotate/flip (~130 lines)
34
- │ └── ImageInfo.tsx # Dimensions display (~35 lines)
35
- ├── hooks/
36
- │ ├── index.ts
37
- │ ├── useImageTransform.ts # Rotation/flip state management
38
- │ └── useImageLoading.ts # LQIP and loading state
39
- ├── utils/
40
- │ ├── index.ts
41
- │ ├── lqip.ts # LQIP generator utility
42
- │ └── constants.ts # Zoom presets, size limits
43
- └── types.ts # All type definitions
44
- ```
45
-
46
- ## Benefits
47
-
48
- 1. **Separation of Concerns** - Each file has single responsibility
49
- 2. **Testability** - Hooks and utils can be unit tested independently
50
- 3. **Reusability** - Components can be used standalone
51
- 4. **Maintainability** - Easier to find and modify specific functionality
52
- 5. **Code Organization** - Consistent with AudioPlayer structure
53
-
54
- ## Execution Phases
55
-
56
- | Phase | Description | Files |
57
- |-------|-------------|-------|
58
- | 1 | Create folder structure | components/, hooks/, utils/ |
59
- | 2 | Extract types | types.ts |
60
- | 3 | Extract constants and utilities | utils/constants.ts, utils/lqip.ts |
61
- | 4 | Extract hooks | hooks/useImageTransform.ts, hooks/useImageLoading.ts |
62
- | 5 | Split components | ImageToolbar.tsx, ImageInfo.tsx |
63
- | 6 | Refactor main component | ImageViewer.tsx (simplified) |
64
- | 7 | Update exports | index.ts, components/index.ts, hooks/index.ts |
65
- | 8 | Cleanup and verify | Delete old file, run pnpm check |
66
-
67
- ## Risk Assessment
68
-
69
- - **Low Risk**: Pure extraction with no logic changes
70
- - **Testing**: Run `pnpm check` after each phase
71
- - **Rollback**: Keep old file until verification complete
@@ -1,121 +0,0 @@
1
- # Phase 1: Types Extraction
2
-
3
- ## Goal
4
-
5
- Extract all type definitions from ImageViewer.tsx into a dedicated types.ts file.
6
-
7
- ## Types to Extract
8
-
9
- ### ImageFile (Props)
10
- ```typescript
11
- export interface ImageFile {
12
- /** Display name for the image */
13
- name: string;
14
- /** File path used for change detection and caching */
15
- path: string;
16
- /** Optional MIME type */
17
- mimeType?: string;
18
- }
19
- ```
20
-
21
- ### ImageViewerProps (Props)
22
- ```typescript
23
- export interface ImageViewerProps {
24
- /** Image file metadata */
25
- file: ImageFile;
26
- /** Image content as string or ArrayBuffer */
27
- content: string | ArrayBuffer;
28
- /** Whether viewer is inside a dialog (hides expand button) */
29
- inDialog?: boolean;
30
- }
31
- ```
32
-
33
- ### ImageTransform (State)
34
- ```typescript
35
- export interface ImageTransform {
36
- /** Rotation angle: 0, 90, 180, or 270 degrees */
37
- rotation: number;
38
- /** Horizontal flip state */
39
- flipH: boolean;
40
- /** Vertical flip state */
41
- flipV: boolean;
42
- }
43
- ```
44
-
45
- ### ZoomPreset (UI)
46
- ```typescript
47
- export interface ZoomPreset {
48
- /** Zoom level (1 = 100%) */
49
- value: number;
50
- /** Display label (e.g., "100%") */
51
- label: string;
52
- }
53
- ```
54
-
55
- ### ImageToolbarProps (Internal)
56
- ```typescript
57
- export interface ImageToolbarProps {
58
- /** Current zoom scale */
59
- scale: number;
60
- /** Expand to fullscreen callback */
61
- onExpand: () => void;
62
- /** Rotate image callback */
63
- onRotate: () => void;
64
- /** Flip horizontal callback */
65
- onFlipH: () => void;
66
- /** Flip vertical callback */
67
- onFlipV: () => void;
68
- /** Whether horizontal flip is active */
69
- flipH: boolean;
70
- /** Whether vertical flip is active */
71
- flipV: boolean;
72
- /** Whether inside dialog (hides expand) */
73
- inDialog?: boolean;
74
- }
75
- ```
76
-
77
- ### ImageInfoProps (Internal)
78
- ```typescript
79
- export interface ImageInfoProps {
80
- /** Blob URL source of the image */
81
- src: string;
82
- /** Content key for cache lookup */
83
- contentKey: string;
84
- }
85
- ```
86
-
87
- ## File Structure
88
-
89
- ```typescript
90
- // types.ts
91
-
92
- /**
93
- * ImageViewer type definitions
94
- */
95
-
96
- // =============================================================================
97
- // FILE TYPES
98
- // =============================================================================
99
-
100
- export interface ImageFile { ... }
101
-
102
- // =============================================================================
103
- // COMPONENT PROPS
104
- // =============================================================================
105
-
106
- export interface ImageViewerProps { ... }
107
- export interface ImageToolbarProps { ... }
108
- export interface ImageInfoProps { ... }
109
-
110
- // =============================================================================
111
- // STATE TYPES
112
- // =============================================================================
113
-
114
- export interface ImageTransform { ... }
115
-
116
- // =============================================================================
117
- // UI TYPES
118
- // =============================================================================
119
-
120
- export interface ZoomPreset { ... }
121
- ```