@djangocfg/ui-nextjs 2.1.66 → 2.1.67

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 (90) hide show
  1. package/package.json +8 -6
  2. package/src/stores/index.ts +8 -0
  3. package/src/stores/mediaCache.ts +464 -0
  4. package/src/tools/AudioPlayer/@refactoring/00-PLAN.md +148 -0
  5. package/src/tools/AudioPlayer/@refactoring/01-TYPES.md +301 -0
  6. package/src/tools/AudioPlayer/@refactoring/02-HOOKS.md +281 -0
  7. package/src/tools/AudioPlayer/@refactoring/03-CONTEXT.md +328 -0
  8. package/src/tools/AudioPlayer/@refactoring/04-COMPONENTS.md +251 -0
  9. package/src/tools/AudioPlayer/@refactoring/05-EFFECTS.md +427 -0
  10. package/src/tools/AudioPlayer/@refactoring/06-UTILS-AND-INDEX.md +193 -0
  11. package/src/tools/AudioPlayer/@refactoring/07-EXECUTION-CHECKLIST.md +146 -0
  12. package/src/tools/AudioPlayer/README.md +35 -11
  13. package/src/tools/AudioPlayer/{AudioEqualizer.tsx → components/AudioEqualizer.tsx} +29 -64
  14. package/src/tools/AudioPlayer/{AudioPlayer.tsx → components/AudioPlayer.tsx} +22 -14
  15. package/src/tools/AudioPlayer/{AudioShortcutsPopover.tsx → components/AudioShortcutsPopover.tsx} +6 -2
  16. package/src/tools/AudioPlayer/components/ReactiveCover/AudioReactiveCover.tsx +147 -0
  17. package/src/tools/AudioPlayer/components/ReactiveCover/effects/GlowEffect.tsx +110 -0
  18. package/src/tools/AudioPlayer/components/ReactiveCover/effects/MeshEffect.tsx +58 -0
  19. package/src/tools/AudioPlayer/components/ReactiveCover/effects/OrbsEffect.tsx +45 -0
  20. package/src/tools/AudioPlayer/components/ReactiveCover/effects/SpotlightEffect.tsx +82 -0
  21. package/src/tools/AudioPlayer/components/ReactiveCover/effects/index.ts +8 -0
  22. package/src/tools/AudioPlayer/components/ReactiveCover/index.ts +6 -0
  23. package/src/tools/AudioPlayer/{SimpleAudioPlayer.tsx → components/SimpleAudioPlayer.tsx} +12 -7
  24. package/src/tools/AudioPlayer/{VisualizationToggle.tsx → components/VisualizationToggle.tsx} +2 -6
  25. package/src/tools/AudioPlayer/components/index.ts +21 -0
  26. package/src/tools/AudioPlayer/context/AudioProvider.tsx +292 -0
  27. package/src/tools/AudioPlayer/context/index.ts +11 -0
  28. package/src/tools/AudioPlayer/context/selectors.ts +96 -0
  29. package/src/tools/AudioPlayer/hooks/index.ts +29 -0
  30. package/src/tools/AudioPlayer/hooks/useAudioAnalysis.ts +110 -0
  31. package/src/tools/AudioPlayer/{useAudioHotkeys.ts → hooks/useAudioHotkeys.ts} +11 -4
  32. package/src/tools/AudioPlayer/hooks/useSharedWebAudio.ts +106 -0
  33. package/src/tools/AudioPlayer/{useAudioVisualization.tsx → hooks/useVisualization.tsx} +11 -5
  34. package/src/tools/AudioPlayer/index.ts +104 -49
  35. package/src/tools/AudioPlayer/types/audio.ts +107 -0
  36. package/src/tools/AudioPlayer/{types.ts → types/components.ts} +20 -84
  37. package/src/tools/AudioPlayer/types/effects.ts +73 -0
  38. package/src/tools/AudioPlayer/types/index.ts +35 -0
  39. package/src/tools/AudioPlayer/utils/formatTime.ts +10 -0
  40. package/src/tools/AudioPlayer/utils/index.ts +5 -0
  41. package/src/tools/ImageViewer/@refactoring/00-PLAN.md +71 -0
  42. package/src/tools/ImageViewer/@refactoring/01-TYPES.md +121 -0
  43. package/src/tools/ImageViewer/@refactoring/02-UTILS.md +143 -0
  44. package/src/tools/ImageViewer/@refactoring/03-HOOKS.md +261 -0
  45. package/src/tools/ImageViewer/@refactoring/04-COMPONENTS.md +427 -0
  46. package/src/tools/ImageViewer/@refactoring/05-EXECUTION-CHECKLIST.md +126 -0
  47. package/src/tools/ImageViewer/README.md +16 -3
  48. package/src/tools/ImageViewer/components/ImageInfo.tsx +44 -0
  49. package/src/tools/ImageViewer/components/ImageToolbar.tsx +150 -0
  50. package/src/tools/ImageViewer/components/ImageViewer.tsx +235 -0
  51. package/src/tools/ImageViewer/components/index.ts +7 -0
  52. package/src/tools/ImageViewer/hooks/index.ts +9 -0
  53. package/src/tools/ImageViewer/hooks/useImageLoading.ts +153 -0
  54. package/src/tools/ImageViewer/hooks/useImageTransform.ts +101 -0
  55. package/src/tools/ImageViewer/index.ts +47 -3
  56. package/src/tools/ImageViewer/types.ts +75 -0
  57. package/src/tools/ImageViewer/utils/constants.ts +59 -0
  58. package/src/tools/ImageViewer/utils/index.ts +16 -0
  59. package/src/tools/ImageViewer/utils/lqip.ts +47 -0
  60. package/src/tools/VideoPlayer/@refactoring/00-PLAN.md +91 -0
  61. package/src/tools/VideoPlayer/@refactoring/01-TYPES.md +284 -0
  62. package/src/tools/VideoPlayer/@refactoring/02-UTILS.md +141 -0
  63. package/src/tools/VideoPlayer/@refactoring/03-HOOKS.md +178 -0
  64. package/src/tools/VideoPlayer/@refactoring/04-COMPONENTS.md +95 -0
  65. package/src/tools/VideoPlayer/@refactoring/05-EXECUTION-CHECKLIST.md +139 -0
  66. package/src/tools/VideoPlayer/README.md +26 -10
  67. package/src/tools/VideoPlayer/{VideoControls.tsx → components/VideoControls.tsx} +8 -9
  68. package/src/tools/VideoPlayer/{VideoErrorFallback.tsx → components/VideoErrorFallback.tsx} +2 -2
  69. package/src/tools/VideoPlayer/{VideoPlayer.tsx → components/VideoPlayer.tsx} +4 -5
  70. package/src/tools/VideoPlayer/components/index.ts +14 -0
  71. package/src/tools/VideoPlayer/context/VideoPlayerContext.tsx +52 -0
  72. package/src/tools/VideoPlayer/context/index.ts +8 -0
  73. package/src/tools/VideoPlayer/hooks/index.ts +9 -0
  74. package/src/tools/VideoPlayer/hooks/useVideoPositionCache.ts +109 -0
  75. package/src/tools/VideoPlayer/index.ts +29 -20
  76. package/src/tools/VideoPlayer/providers/StreamProvider.tsx +118 -28
  77. package/src/tools/VideoPlayer/providers/VidstackProvider.tsx +89 -11
  78. package/src/tools/VideoPlayer/types/index.ts +38 -0
  79. package/src/tools/VideoPlayer/types/player.ts +116 -0
  80. package/src/tools/VideoPlayer/types/provider.ts +93 -0
  81. package/src/tools/VideoPlayer/types/sources.ts +97 -0
  82. package/src/tools/VideoPlayer/utils/fileSource.ts +78 -0
  83. package/src/tools/VideoPlayer/utils/index.ts +11 -0
  84. package/src/tools/VideoPlayer/utils/resolvers.ts +75 -0
  85. package/src/tools/index.ts +10 -0
  86. package/src/tools/AudioPlayer/AudioReactiveCover.tsx +0 -389
  87. package/src/tools/AudioPlayer/context.tsx +0 -426
  88. package/src/tools/ImageViewer/ImageViewer.tsx +0 -416
  89. package/src/tools/VideoPlayer/VideoPlayerContext.tsx +0 -125
  90. package/src/tools/VideoPlayer/types.ts +0 -367
@@ -1,367 +0,0 @@
1
- /**
2
- * VideoPlayer Types - Unified Video Player
3
- * Supports Vidstack, Native HTML5, and HTTP Streaming
4
- */
5
-
6
- import type React from 'react';
7
-
8
- // ============================================================================
9
- // Source Types - Different ways to provide video content
10
- // ============================================================================
11
-
12
- /** Simple URL source (mp4, webm, etc.) */
13
- export interface UrlSource {
14
- type: 'url';
15
- url: string;
16
- title?: string;
17
- poster?: string;
18
- }
19
-
20
- /** YouTube embed source */
21
- export interface YouTubeSource {
22
- type: 'youtube';
23
- /** YouTube video ID (11 characters) */
24
- id: string;
25
- title?: string;
26
- poster?: string;
27
- }
28
-
29
- /** Vimeo embed source */
30
- export interface VimeoSource {
31
- type: 'vimeo';
32
- /** Vimeo video ID */
33
- id: string;
34
- title?: string;
35
- poster?: string;
36
- }
37
-
38
- /** HLS streaming source */
39
- export interface HLSSource {
40
- type: 'hls';
41
- /** URL to .m3u8 manifest */
42
- url: string;
43
- title?: string;
44
- poster?: string;
45
- }
46
-
47
- /** DASH streaming source */
48
- export interface DASHSource {
49
- type: 'dash';
50
- /** URL to .mpd manifest */
51
- url: string;
52
- title?: string;
53
- poster?: string;
54
- }
55
-
56
- /** HTTP Range streaming source (for large files with auth) */
57
- export interface StreamSource {
58
- type: 'stream';
59
- /** Session ID for authorization */
60
- sessionId: string;
61
- /** File path on server */
62
- path: string;
63
- /** Function to generate stream URL */
64
- getStreamUrl: (sessionId: string, path: string) => string;
65
- /** MIME type for the video */
66
- mimeType?: string;
67
- title?: string;
68
- poster?: string;
69
- }
70
-
71
- /** Binary data source (ArrayBuffer) */
72
- export interface BlobSource {
73
- type: 'blob';
74
- /** Video data as ArrayBuffer */
75
- data: ArrayBuffer;
76
- /** MIME type (default: video/mp4) */
77
- mimeType?: string;
78
- title?: string;
79
- poster?: string;
80
- }
81
-
82
- /** Base64 data URL source */
83
- export interface DataUrlSource {
84
- type: 'data-url';
85
- /** Base64 encoded data URL */
86
- data: string;
87
- title?: string;
88
- poster?: string;
89
- }
90
-
91
- /** Union of all source types */
92
- export type VideoSourceUnion =
93
- | UrlSource
94
- | YouTubeSource
95
- | VimeoSource
96
- | HLSSource
97
- | DASHSource
98
- | StreamSource
99
- | BlobSource
100
- | DataUrlSource;
101
-
102
- // ============================================================================
103
- // Player Mode
104
- // ============================================================================
105
-
106
- /** Player mode - determines which provider to use */
107
- export type PlayerMode =
108
- | 'auto' // Auto-select based on source type
109
- | 'vidstack' // Force Vidstack (full-featured)
110
- | 'native' // Force native HTML5 <video>
111
- | 'streaming'; // Force streaming provider
112
-
113
- // ============================================================================
114
- // Player Props
115
- // ============================================================================
116
-
117
- /** Aspect ratio options */
118
- export type AspectRatioValue = number | 'auto' | 'fill';
119
-
120
- /** Common player settings */
121
- export interface CommonPlayerSettings {
122
- /** Auto-play video */
123
- autoPlay?: boolean;
124
- /** Mute video by default */
125
- muted?: boolean;
126
- /** Loop video */
127
- loop?: boolean;
128
- /** Play video inline on mobile */
129
- playsInline?: boolean;
130
- /** Show player controls */
131
- controls?: boolean;
132
- /**
133
- * Aspect ratio:
134
- * - number (e.g. 16/9): Fixed aspect ratio
135
- * - 'auto': Natural video aspect ratio
136
- * - 'fill': Fill parent container (100% width & height)
137
- */
138
- aspectRatio?: AspectRatioValue;
139
- /** Preload strategy */
140
- preload?: 'auto' | 'metadata' | 'none';
141
- }
142
-
143
- /** Common player events */
144
- export interface CommonPlayerEvents {
145
- onPlay?: () => void;
146
- onPause?: () => void;
147
- onEnded?: () => void;
148
- onError?: (error: string) => void;
149
- onLoadStart?: () => void;
150
- onCanPlay?: () => void;
151
- onTimeUpdate?: (currentTime: number, duration: number) => void;
152
- }
153
-
154
- /** Error fallback render props */
155
- export interface ErrorFallbackProps {
156
- error: string;
157
- retry?: () => void;
158
- }
159
-
160
- /** Main VideoPlayer props */
161
- export interface VideoPlayerProps extends CommonPlayerSettings, CommonPlayerEvents {
162
- /** Video source configuration */
163
- source: VideoSourceUnion;
164
- /** Player mode (default: 'auto') */
165
- mode?: PlayerMode;
166
- /** Player theme (Vidstack only) */
167
- theme?: 'default' | 'minimal' | 'modern';
168
- /** Show video info below player */
169
- showInfo?: boolean;
170
- /** Container className */
171
- className?: string;
172
- /** Video element className (native/streaming only) */
173
- videoClassName?: string;
174
- /** Disable right-click context menu */
175
- disableContextMenu?: boolean;
176
- /** Show loading spinner */
177
- showPreloader?: boolean;
178
- /** Preloader timeout in ms */
179
- preloaderTimeout?: number;
180
- /** Custom error fallback UI */
181
- errorFallback?: React.ReactNode | ((props: ErrorFallbackProps) => React.ReactNode);
182
- }
183
-
184
- /** VideoPlayer ref methods */
185
- export interface VideoPlayerRef {
186
- /** Play video */
187
- play: () => Promise<void> | void;
188
- /** Pause video */
189
- pause: () => void;
190
- /** Toggle play/pause */
191
- togglePlay: () => void;
192
- /** Seek to time in seconds */
193
- seekTo: (time: number) => void;
194
- /** Set volume (0-1) */
195
- setVolume: (volume: number) => void;
196
- /** Toggle mute */
197
- toggleMute: () => void;
198
- /** Enter fullscreen */
199
- enterFullscreen: () => void;
200
- /** Exit fullscreen */
201
- exitFullscreen: () => void;
202
- /** Current playback time in seconds */
203
- readonly currentTime: number;
204
- /** Video duration in seconds */
205
- readonly duration: number;
206
- /** Whether video is paused */
207
- readonly paused: boolean;
208
- }
209
-
210
- // ============================================================================
211
- // Provider-specific Props (internal use)
212
- // ============================================================================
213
-
214
- /** Props passed to Vidstack provider */
215
- export interface VidstackProviderProps extends CommonPlayerSettings, CommonPlayerEvents {
216
- source: UrlSource | YouTubeSource | VimeoSource | HLSSource | DASHSource;
217
- theme?: 'default' | 'minimal' | 'modern';
218
- showInfo?: boolean;
219
- className?: string;
220
- errorFallback?: React.ReactNode | ((props: ErrorFallbackProps) => React.ReactNode);
221
- }
222
-
223
- /** Props passed to Native provider */
224
- export interface NativeProviderProps extends CommonPlayerSettings, CommonPlayerEvents {
225
- source: UrlSource | DataUrlSource;
226
- className?: string;
227
- videoClassName?: string;
228
- disableContextMenu?: boolean;
229
- showPreloader?: boolean;
230
- preloaderTimeout?: number;
231
- }
232
-
233
- /** Props passed to Stream provider */
234
- export interface StreamProviderProps extends CommonPlayerSettings, CommonPlayerEvents {
235
- source: StreamSource | BlobSource | DataUrlSource;
236
- className?: string;
237
- videoClassName?: string;
238
- disableContextMenu?: boolean;
239
- showPreloader?: boolean;
240
- preloaderTimeout?: number;
241
- errorFallback?: React.ReactNode | ((props: ErrorFallbackProps) => React.ReactNode);
242
- }
243
-
244
- // ============================================================================
245
- // Helper function to resolve mode
246
- // ============================================================================
247
-
248
- /** Determine which provider to use based on source type */
249
- export function resolvePlayerMode(source: VideoSourceUnion, mode: PlayerMode = 'auto'): 'vidstack' | 'native' | 'streaming' {
250
- if (mode !== 'auto') {
251
- return mode;
252
- }
253
-
254
- switch (source.type) {
255
- case 'youtube':
256
- case 'vimeo':
257
- case 'hls':
258
- case 'dash':
259
- return 'vidstack';
260
-
261
- case 'stream':
262
- case 'blob':
263
- return 'streaming';
264
-
265
- case 'data-url':
266
- case 'url':
267
- default:
268
- return 'native';
269
- }
270
- }
271
-
272
- // ============================================================================
273
- // File Source Helper (for FileWorkspace integration)
274
- // ============================================================================
275
-
276
- /** Options for resolving file source */
277
- export interface ResolveFileSourceOptions {
278
- /** File content - can be data URL string or binary ArrayBuffer */
279
- content: string | ArrayBuffer | null | undefined;
280
- /** File path for streaming */
281
- path: string;
282
- /** MIME type of the file */
283
- mimeType?: string;
284
- /** Session ID for authenticated streaming */
285
- sessionId?: string | null;
286
- /** Load method hint - 'http_stream' enables streaming mode */
287
- loadMethod?: 'http_stream' | 'rpc' | 'unspecified' | 'skip' | string;
288
- /** Function to generate stream URL (required for streaming) */
289
- getStreamUrl?: (sessionId: string, path: string) => string;
290
- /** Optional title */
291
- title?: string;
292
- /** Optional poster */
293
- poster?: string;
294
- }
295
-
296
- /**
297
- * Resolve file content to VideoSourceUnion
298
- * Useful for FileWorkspace/file manager integrations
299
- *
300
- * @example
301
- * const source = resolveFileSource({
302
- * content: file.content,
303
- * path: file.path,
304
- * mimeType: file.mimeType,
305
- * sessionId: sessionId,
306
- * loadMethod: file.loadMethod,
307
- * getStreamUrl: terminalClient.terminal_media.streamStreamRetrieveUrl
308
- * });
309
- *
310
- * <VideoPlayer source={source} />
311
- */
312
- export function resolveFileSource(options: ResolveFileSourceOptions): VideoSourceUnion | null {
313
- const {
314
- content,
315
- path,
316
- mimeType,
317
- sessionId,
318
- loadMethod,
319
- getStreamUrl,
320
- title,
321
- poster,
322
- } = options;
323
-
324
- const contentSize = content
325
- ? typeof content === 'string'
326
- ? content.length
327
- : content.byteLength
328
- : 0;
329
- const hasContent = contentSize > 0;
330
-
331
- // Priority 1: HTTP Range streaming for large files
332
- if (loadMethod === 'http_stream' && !hasContent && sessionId && getStreamUrl) {
333
- return {
334
- type: 'stream',
335
- sessionId,
336
- path,
337
- getStreamUrl,
338
- mimeType,
339
- title,
340
- poster,
341
- };
342
- }
343
-
344
- // Priority 2: Data URL (base64 string)
345
- if (typeof content === 'string' && hasContent) {
346
- return {
347
- type: 'data-url',
348
- data: content,
349
- title,
350
- poster,
351
- };
352
- }
353
-
354
- // Priority 3: ArrayBuffer → Blob
355
- if (content instanceof ArrayBuffer && hasContent) {
356
- return {
357
- type: 'blob',
358
- data: content,
359
- mimeType: mimeType || 'video/mp4',
360
- title,
361
- poster,
362
- };
363
- }
364
-
365
- // No valid content
366
- return null;
367
- }