@djangocfg/ui-tools 2.1.402 → 2.1.407

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 (58) hide show
  1. package/README.md +16 -1
  2. package/package.json +11 -9
  3. package/src/tools/AudioPlayer/lazy.tsx +13 -27
  4. package/src/tools/ImageViewer/components/ImageViewer.tsx +10 -2
  5. package/src/tools/JsonForm/JsonSchemaForm.tsx +3 -1
  6. package/src/tools/JsonForm/README.md +12 -2
  7. package/src/tools/JsonForm/widgets/TextareaWidget.tsx +25 -0
  8. package/src/tools/JsonForm/widgets/index.ts +1 -0
  9. package/src/tools/JsonTree/README.md +12 -0
  10. package/src/tools/PrettyCode/README.md +81 -0
  11. package/src/tools/VideoPlayer/README.md +87 -230
  12. package/src/tools/VideoPlayer/VideoPlayer.tsx +82 -0
  13. package/src/tools/VideoPlayer/canvas/canvas-dispatcher.tsx +34 -0
  14. package/src/tools/VideoPlayer/canvas/hls-canvas.tsx +38 -0
  15. package/src/tools/VideoPlayer/canvas/iframe-canvas.tsx +33 -0
  16. package/src/tools/VideoPlayer/canvas/index.ts +12 -0
  17. package/src/tools/VideoPlayer/canvas/jsx.d.ts +54 -0
  18. package/src/tools/VideoPlayer/canvas/native-canvas.tsx +38 -0
  19. package/src/tools/VideoPlayer/canvas/vimeo-canvas.tsx +39 -0
  20. package/src/tools/VideoPlayer/canvas/youtube-canvas.tsx +77 -0
  21. package/src/tools/VideoPlayer/index.ts +51 -65
  22. package/src/tools/VideoPlayer/lazy.tsx +11 -54
  23. package/src/tools/VideoPlayer/parts/controls-bar.tsx +35 -0
  24. package/src/tools/VideoPlayer/parts/fullscreen.tsx +19 -0
  25. package/src/tools/VideoPlayer/parts/index.ts +15 -0
  26. package/src/tools/VideoPlayer/parts/pip.tsx +19 -0
  27. package/src/tools/VideoPlayer/parts/play-button.tsx +19 -0
  28. package/src/tools/VideoPlayer/parts/playback-rate.tsx +31 -0
  29. package/src/tools/VideoPlayer/parts/poster.tsx +3 -0
  30. package/src/tools/VideoPlayer/parts/seek-bar.tsx +26 -0
  31. package/src/tools/VideoPlayer/parts/volume.tsx +32 -0
  32. package/src/tools/VideoPlayer/styles/video-player.css +141 -0
  33. package/src/tools/VideoPlayer/types.ts +82 -0
  34. package/src/tools/VideoPlayer/utils/parse-embed-url.ts +70 -0
  35. package/src/tools/VideoPlayer/utils/vimeo-id.ts +24 -0
  36. package/src/tools/VideoPlayer/utils/youtube-id.ts +64 -0
  37. package/src/tools/index.ts +35 -28
  38. package/src/tools/VideoPlayer/components/VideoControls.tsx +0 -138
  39. package/src/tools/VideoPlayer/components/VideoErrorFallback.tsx +0 -172
  40. package/src/tools/VideoPlayer/components/VideoPlayer.tsx +0 -201
  41. package/src/tools/VideoPlayer/components/index.ts +0 -14
  42. package/src/tools/VideoPlayer/context/VideoPlayerContext.tsx +0 -52
  43. package/src/tools/VideoPlayer/context/index.ts +0 -8
  44. package/src/tools/VideoPlayer/hooks/index.ts +0 -12
  45. package/src/tools/VideoPlayer/hooks/useVideoPlayerSettings.ts +0 -71
  46. package/src/tools/VideoPlayer/hooks/useVideoPositionCache.ts +0 -117
  47. package/src/tools/VideoPlayer/providers/NativeProvider.tsx +0 -284
  48. package/src/tools/VideoPlayer/providers/StreamProvider.tsx +0 -505
  49. package/src/tools/VideoPlayer/providers/VidstackProvider.tsx +0 -397
  50. package/src/tools/VideoPlayer/providers/index.ts +0 -8
  51. package/src/tools/VideoPlayer/types/index.ts +0 -38
  52. package/src/tools/VideoPlayer/types/player.ts +0 -116
  53. package/src/tools/VideoPlayer/types/provider.ts +0 -93
  54. package/src/tools/VideoPlayer/types/sources.ts +0 -97
  55. package/src/tools/VideoPlayer/utils/debug.ts +0 -14
  56. package/src/tools/VideoPlayer/utils/fileSource.ts +0 -78
  57. package/src/tools/VideoPlayer/utils/index.ts +0 -12
  58. package/src/tools/VideoPlayer/utils/resolvers.ts +0 -75
@@ -1,97 +0,0 @@
1
- /**
2
- * Video source type definitions
3
- */
4
-
5
- // =============================================================================
6
- // Source Types - Different ways to provide video content
7
- // =============================================================================
8
-
9
- /** Simple URL source (mp4, webm, etc.) */
10
- export interface UrlSource {
11
- type: 'url';
12
- url: string;
13
- title?: string;
14
- poster?: string;
15
- }
16
-
17
- /** YouTube embed source */
18
- export interface YouTubeSource {
19
- type: 'youtube';
20
- /** YouTube video ID (11 characters) */
21
- id: string;
22
- title?: string;
23
- poster?: string;
24
- }
25
-
26
- /** Vimeo embed source */
27
- export interface VimeoSource {
28
- type: 'vimeo';
29
- /** Vimeo video ID */
30
- id: string;
31
- title?: string;
32
- poster?: string;
33
- }
34
-
35
- /** HLS streaming source */
36
- export interface HLSSource {
37
- type: 'hls';
38
- /** URL to .m3u8 manifest */
39
- url: string;
40
- title?: string;
41
- poster?: string;
42
- }
43
-
44
- /** DASH streaming source */
45
- export interface DASHSource {
46
- type: 'dash';
47
- /** URL to .mpd manifest */
48
- url: string;
49
- title?: string;
50
- poster?: string;
51
- }
52
-
53
- /** HTTP Range streaming source (for large files with auth) */
54
- export interface StreamSource {
55
- type: 'stream';
56
- /** Session ID for authorization */
57
- sessionId: string;
58
- /** File path on server */
59
- path: string;
60
- /** Function to generate stream URL */
61
- getStreamUrl: (sessionId: string, path: string) => string;
62
- /** MIME type for the video */
63
- mimeType?: string;
64
- title?: string;
65
- poster?: string;
66
- }
67
-
68
- /** Binary data source (ArrayBuffer) */
69
- export interface BlobSource {
70
- type: 'blob';
71
- /** Video data as ArrayBuffer */
72
- data: ArrayBuffer;
73
- /** MIME type (default: video/mp4) */
74
- mimeType?: string;
75
- title?: string;
76
- poster?: string;
77
- }
78
-
79
- /** Base64 data URL source */
80
- export interface DataUrlSource {
81
- type: 'data-url';
82
- /** Base64 encoded data URL */
83
- data: string;
84
- title?: string;
85
- poster?: string;
86
- }
87
-
88
- /** Union of all source types */
89
- export type VideoSourceUnion =
90
- | UrlSource
91
- | YouTubeSource
92
- | VimeoSource
93
- | HLSSource
94
- | DASHSource
95
- | StreamSource
96
- | BlobSource
97
- | DataUrlSource;
@@ -1,14 +0,0 @@
1
- 'use client';
2
-
3
- /**
4
- * VideoPlayer 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 '@djangocfg/ui-core/lib';
11
-
12
- export const videoDebug = createMediaLogger('VideoPlayer');
13
-
14
- export default videoDebug;
@@ -1,78 +0,0 @@
1
- /**
2
- * File source resolution utilities
3
- */
4
-
5
- import type { VideoSourceUnion, ResolveFileSourceOptions } from '../types';
6
-
7
- /**
8
- * Resolve file content to VideoSourceUnion
9
- * Useful for FileWorkspace/file manager integrations
10
- *
11
- * @example
12
- * const source = resolveFileSource({
13
- * content: file.content,
14
- * path: file.path,
15
- * mimeType: file.mimeType,
16
- * sessionId: sessionId,
17
- * loadMethod: file.loadMethod,
18
- * getStreamUrl: terminalClient.terminal_media.streamStreamRetrieveUrl
19
- * });
20
- *
21
- * <VideoPlayer source={source} />
22
- */
23
- export function resolveFileSource(options: ResolveFileSourceOptions): VideoSourceUnion | null {
24
- const {
25
- content,
26
- path,
27
- mimeType,
28
- sessionId,
29
- loadMethod,
30
- getStreamUrl,
31
- title,
32
- poster,
33
- } = options;
34
-
35
- const contentSize = content
36
- ? typeof content === 'string'
37
- ? content.length
38
- : content.byteLength
39
- : 0;
40
- const hasContent = contentSize > 0;
41
-
42
- // Priority 1: HTTP Range streaming for large files
43
- if (loadMethod === 'http_stream' && !hasContent && sessionId && getStreamUrl) {
44
- return {
45
- type: 'stream',
46
- sessionId,
47
- path,
48
- getStreamUrl,
49
- mimeType,
50
- title,
51
- poster,
52
- };
53
- }
54
-
55
- // Priority 2: Data URL (base64 string)
56
- if (typeof content === 'string' && hasContent) {
57
- return {
58
- type: 'data-url',
59
- data: content,
60
- title,
61
- poster,
62
- };
63
- }
64
-
65
- // Priority 3: ArrayBuffer → Blob
66
- if (content instanceof ArrayBuffer && hasContent) {
67
- return {
68
- type: 'blob',
69
- data: content,
70
- mimeType: mimeType || 'video/mp4',
71
- title,
72
- poster,
73
- };
74
- }
75
-
76
- // No valid content
77
- return null;
78
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * VideoPlayer utilities - Public API
3
- */
4
-
5
- export {
6
- resolvePlayerMode,
7
- isSimpleStreamSource,
8
- resolveStreamSource,
9
- } from './resolvers';
10
-
11
- export { resolveFileSource } from './fileSource';
12
- export { videoDebug } from './debug';
@@ -1,75 +0,0 @@
1
- /**
2
- * Video source and player mode resolvers
3
- */
4
-
5
- import type { VideoSourceUnion, PlayerMode, SimpleStreamSource, StreamSource, VideoPlayerContextValue } from '../types';
6
-
7
- /**
8
- * Determine which provider to use based on source type
9
- */
10
- export function resolvePlayerMode(
11
- source: VideoSourceUnion,
12
- mode: PlayerMode = 'auto'
13
- ): 'vidstack' | 'native' | 'streaming' {
14
- if (mode !== 'auto') {
15
- return mode;
16
- }
17
-
18
- switch (source.type) {
19
- case 'youtube':
20
- case 'vimeo':
21
- case 'hls':
22
- case 'dash':
23
- return 'vidstack';
24
-
25
- case 'stream':
26
- case 'blob':
27
- return 'streaming';
28
-
29
- case 'data-url':
30
- case 'url':
31
- default:
32
- return 'native';
33
- }
34
- }
35
-
36
- /**
37
- * Check if source is a simplified stream source (without getStreamUrl)
38
- */
39
- export function isSimpleStreamSource(
40
- source: VideoSourceUnion | SimpleStreamSource | undefined | null
41
- ): source is SimpleStreamSource {
42
- return source != null && source.type === 'stream' && !('getStreamUrl' in source);
43
- }
44
-
45
- /**
46
- * Resolve simplified stream source to full stream source using context
47
- */
48
- export function resolveStreamSource(
49
- source: SimpleStreamSource,
50
- context: VideoPlayerContextValue | null
51
- ): StreamSource | null {
52
- if (!context?.getStreamUrl) {
53
- console.warn(
54
- 'VideoPlayer: Stream source requires getStreamUrl. ' +
55
- 'Either provide it in source or wrap with VideoPlayerProvider.'
56
- );
57
- return null;
58
- }
59
-
60
- const sessionId = source.sessionId || context.sessionId;
61
- if (!sessionId) {
62
- console.warn('VideoPlayer: Stream source requires sessionId.');
63
- return null;
64
- }
65
-
66
- return {
67
- type: 'stream',
68
- sessionId,
69
- path: source.path,
70
- getStreamUrl: context.getStreamUrl,
71
- mimeType: source.mimeType,
72
- title: source.title,
73
- poster: source.poster,
74
- };
75
- }