@djangocfg/ui-tools 2.1.404 → 2.1.408
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/README.md +9 -11
- package/dist/file-icon/index.cjs +449 -61
- package/dist/file-icon/index.cjs.map +1 -1
- package/dist/file-icon/index.d.cts +56 -18
- package/dist/file-icon/index.d.ts +56 -18
- package/dist/file-icon/index.mjs +448 -62
- package/dist/file-icon/index.mjs.map +1 -1
- package/dist/tree/index.cjs +49 -22
- package/dist/tree/index.cjs.map +1 -1
- package/dist/tree/index.d.cts +9 -3
- package/dist/tree/index.d.ts +9 -3
- package/dist/tree/index.mjs +49 -22
- package/dist/tree/index.mjs.map +1 -1
- package/dist/{types-B_zhyAqR.d.cts → types-eEu8SeiQ.d.cts} +4 -0
- package/dist/{types-B_zhyAqR.d.ts → types-eEu8SeiQ.d.ts} +4 -0
- package/package.json +13 -16
- package/src/components/FloatingToolbar/index.tsx +37 -3
- package/src/lib/page-snapshot/__tests__/capture-integration.test.ts +85 -0
- package/src/lib/page-snapshot/__tests__/engine.test.ts +36 -0
- package/src/lib/page-snapshot/__tests__/redaction-integration.test.ts +99 -0
- package/src/lib/page-snapshot/__tests__/tokens.test.ts +17 -0
- package/src/lib/page-snapshot/capture/__tests__/budget.test.ts +49 -0
- package/src/lib/page-snapshot/capture/__tests__/chrome-filter.test.ts +47 -0
- package/src/lib/page-snapshot/capture/__tests__/fold.test.ts +66 -0
- package/src/lib/page-snapshot/capture/__tests__/scope.test.ts +74 -0
- package/src/lib/page-snapshot/capture/__tests__/walk.test.ts +129 -0
- package/src/lib/page-snapshot/capture/accessible-name.ts +73 -0
- package/src/lib/page-snapshot/capture/budget.ts +95 -0
- package/src/lib/page-snapshot/capture/chrome-filter.ts +81 -0
- package/src/lib/page-snapshot/capture/classify.ts +111 -0
- package/src/lib/page-snapshot/capture/dom-utils.ts +111 -0
- package/src/lib/page-snapshot/capture/fold.ts +96 -0
- package/src/lib/page-snapshot/capture/scope.ts +169 -0
- package/src/lib/page-snapshot/capture/walk.ts +250 -0
- package/src/lib/page-snapshot/cst/__tests__/serialize.test.ts +50 -0
- package/src/lib/page-snapshot/cst/directives.ts +47 -0
- package/src/lib/page-snapshot/cst/payload.ts +50 -0
- package/src/lib/page-snapshot/cst/serialize.ts +84 -0
- package/src/lib/page-snapshot/cst/types.ts +115 -0
- package/src/lib/page-snapshot/engine.ts +176 -0
- package/src/lib/page-snapshot/index.ts +93 -0
- package/src/lib/page-snapshot/react/PageSnapshotChip.tsx +72 -0
- package/src/lib/page-snapshot/react/PageSnapshotPreview.tsx +78 -0
- package/src/lib/page-snapshot/react/__tests__/PageSnapshotChip.test.tsx +54 -0
- package/src/lib/page-snapshot/react/__tests__/provider.test.tsx +103 -0
- package/src/lib/page-snapshot/react/__tests__/use-page-snapshot-toggle.test.tsx +62 -0
- package/src/lib/page-snapshot/react/provider.tsx +162 -0
- package/src/lib/page-snapshot/react/use-page-snapshot-toggle.ts +47 -0
- package/src/lib/page-snapshot/react/use-page-snapshot.ts +67 -0
- package/src/lib/page-snapshot/redaction/__tests__/audit.test.ts +25 -0
- package/src/lib/page-snapshot/redaction/__tests__/heuristics.test.ts +73 -0
- package/src/lib/page-snapshot/redaction/__tests__/luhn.test.ts +26 -0
- package/src/lib/page-snapshot/redaction/__tests__/patterns.test.ts +60 -0
- package/src/lib/page-snapshot/redaction/audit.ts +58 -0
- package/src/lib/page-snapshot/redaction/heuristics.ts +75 -0
- package/src/lib/page-snapshot/redaction/index.ts +75 -0
- package/src/lib/page-snapshot/redaction/luhn.ts +25 -0
- package/src/lib/page-snapshot/redaction/patterns.ts +111 -0
- package/src/lib/page-snapshot/refs/__tests__/registry.test.ts +24 -0
- package/src/lib/page-snapshot/refs/registry.ts +46 -0
- package/src/lib/page-snapshot/staleness/__tests__/hash.test.ts +34 -0
- package/src/lib/page-snapshot/staleness/hash.ts +20 -0
- package/src/lib/page-snapshot/tokens.ts +15 -0
- package/src/tools/AudioPlayer/context/PlayerProvider.tsx +13 -14
- package/src/tools/AudioPlayer/hooks/useAudioElementEvents.ts +55 -6
- package/src/tools/AudioPlayer/lazy.tsx +13 -27
- package/src/tools/AudioPlayer/parts/Meta/TimeDisplay.tsx +2 -5
- package/src/tools/Chat/README.md +267 -39
- package/src/tools/Chat/composer/Composer.tsx +471 -0
- package/src/tools/Chat/composer/ComposerActionBar.tsx +65 -0
- package/src/tools/Chat/composer/ComposerBanner.tsx +128 -0
- package/src/tools/Chat/composer/ComposerButton.tsx +64 -0
- package/src/tools/Chat/composer/ComposerFooter.tsx +90 -0
- package/src/tools/Chat/composer/ComposerMenuButton.tsx +62 -0
- package/src/tools/Chat/composer/ComposerModelPicker.tsx +104 -0
- package/src/tools/Chat/composer/ComposerRichTextarea.tsx +88 -0
- package/src/tools/Chat/composer/ComposerToolPill.tsx +95 -0
- package/src/tools/Chat/composer/index.ts +45 -0
- package/src/tools/Chat/composer/size-context.tsx +26 -0
- package/src/tools/Chat/composer/types.ts +143 -0
- package/src/tools/Chat/composer/useComposerActions.tsx +164 -0
- package/src/tools/Chat/context/ChatProvider.tsx +54 -3
- package/src/tools/Chat/core/__tests__/metadata.test.ts +69 -0
- package/src/tools/Chat/core/index.ts +23 -1
- package/src/tools/Chat/core/markdown.ts +1 -1
- package/src/tools/Chat/core/metadata.ts +47 -0
- package/src/tools/Chat/core/payload-dispatch.ts +1 -1
- package/src/tools/Chat/core/transport/http.ts +71 -32
- package/src/tools/Chat/core/transport/sse.ts +18 -10
- package/src/tools/Chat/highlight/HighlightOverlay.tsx +101 -0
- package/src/tools/Chat/highlight/README.md +103 -0
- package/src/tools/Chat/highlight/SpotlightCanvas.tsx +153 -0
- package/src/tools/Chat/highlight/__tests__/HighlightOverlay.test.tsx +112 -0
- package/src/tools/Chat/highlight/__tests__/resolveRef.test.ts +55 -0
- package/src/tools/Chat/highlight/index.ts +21 -0
- package/src/tools/Chat/highlight/resolveRef.ts +42 -0
- package/src/tools/Chat/highlight/types.ts +49 -0
- package/src/tools/Chat/highlight/useHighlightTargets.ts +128 -0
- package/src/tools/Chat/hooks/index.ts +0 -5
- package/src/tools/Chat/hooks/useAutoFocusOnStreamEnd.ts +28 -47
- package/src/tools/Chat/hooks/useChat.ts +47 -14
- package/src/tools/Chat/hooks/useChatComposer.ts +2 -2
- package/src/tools/Chat/hooks/useChatLayout.ts +1 -1
- package/src/tools/Chat/hooks/useStreamEndFocus.ts +54 -0
- package/src/tools/Chat/index.ts +25 -219
- package/src/tools/Chat/launcher/ChatDock.tsx +1 -1
- package/src/tools/Chat/launcher/ChatLauncher.tsx +1 -1
- package/src/tools/Chat/launcher/{ChatHeader.tsx → header/ChatHeader.tsx} +24 -11
- package/src/tools/Chat/launcher/{ChatHeaderActionButton.tsx → header/ChatHeaderActionButton.tsx} +34 -3
- package/src/tools/Chat/launcher/{ChatHeaderLanguageButton.tsx → header/ChatHeaderLanguageButton.tsx} +2 -2
- package/src/tools/Chat/launcher/{ChatHeaderModeToggle.tsx → header/ChatHeaderModeToggle.tsx} +1 -1
- package/src/tools/Chat/launcher/{ChatHeaderResetButton.tsx → header/ChatHeaderResetButton.tsx} +2 -1
- package/src/tools/Chat/launcher/{HeaderSlots.tsx → header/HeaderSlots.tsx} +3 -3
- package/src/tools/Chat/launcher/header/index.ts +26 -0
- package/src/tools/Chat/launcher/index.ts +3 -10
- package/src/tools/Chat/lazy.tsx +38 -284
- package/src/tools/Chat/{components → messages}/MessageBubble.tsx +58 -5
- package/src/tools/Chat/{components → messages}/MessageList.tsx +8 -25
- package/src/tools/Chat/messages/blocks/MessageBlocks.tsx +131 -0
- package/src/tools/Chat/messages/blocks/builtin.tsx +91 -0
- package/src/tools/Chat/messages/blocks/index.ts +12 -0
- package/src/tools/Chat/messages/blocks/registry.tsx +42 -0
- package/src/tools/Chat/messages/blocks/renderers/AudioBlock.tsx +20 -0
- package/src/tools/Chat/messages/blocks/renderers/CodeBlock.tsx +19 -0
- package/src/tools/Chat/messages/blocks/renderers/GalleryBlock.tsx +26 -0
- package/src/tools/Chat/messages/blocks/renderers/ImageBlock.tsx +27 -0
- package/src/tools/Chat/messages/blocks/renderers/JsonBlock.tsx +12 -0
- package/src/tools/Chat/messages/blocks/renderers/LottieBlock.tsx +11 -0
- package/src/tools/Chat/messages/blocks/renderers/MapBlock.tsx +36 -0
- package/src/tools/Chat/messages/blocks/renderers/MermaidBlock.tsx +11 -0
- package/src/tools/Chat/messages/blocks/renderers/VideoBlock.tsx +24 -0
- package/src/tools/Chat/messages/blocks/renderers/types.ts +8 -0
- package/src/tools/Chat/{components → messages}/index.ts +11 -5
- package/src/tools/Chat/public.ts +212 -0
- package/src/tools/Chat/shell/ChatRoot.tsx +326 -0
- package/src/tools/Chat/{components → shell}/EmptyState.tsx +4 -2
- package/src/tools/Chat/shell/index.ts +15 -0
- package/src/tools/Chat/types/block.ts +120 -0
- package/src/tools/Chat/types/config.ts +0 -5
- package/src/tools/Chat/types/index.ts +17 -0
- package/src/tools/Chat/types/message.ts +3 -0
- package/src/tools/Chat/utils/index.ts +4 -0
- package/src/tools/CodeEditor/README.md +4 -6
- package/src/tools/CodeEditor/components/DiffEditor.tsx +48 -13
- package/src/tools/CodeEditor/components/Editor.tsx +96 -44
- package/src/tools/CodeEditor/context/EditorProvider.tsx +34 -17
- package/src/tools/CodeEditor/hooks/useEditorTheme.ts +92 -99
- package/src/tools/CodeEditor/hooks/useMonaco.ts +37 -22
- package/src/tools/CodeEditor/lazy.tsx +6 -0
- package/src/tools/CodeEditor/lib/index.ts +1 -1
- package/src/tools/CodeEditor/lib/themes.ts +3 -39
- package/src/tools/CronScheduler/CronScheduler.client.tsx +230 -61
- package/src/tools/CronScheduler/components/CustomInput.tsx +21 -4
- package/src/tools/CronScheduler/components/DayChips.tsx +13 -11
- package/src/tools/CronScheduler/components/MonthDayGrid.tsx +4 -4
- package/src/tools/CronScheduler/components/SchedulePreview.tsx +7 -3
- package/src/tools/CronScheduler/components/TimeSelector.tsx +1 -1
- package/src/tools/CronScheduler/index.tsx +1 -1
- package/src/tools/CronScheduler/types/index.ts +8 -3
- package/src/tools/CronScheduler/utils/cron-humanize.ts +61 -16
- package/src/tools/CronScheduler/utils/cron-parser.ts +13 -4
- package/src/tools/FileIcon/FileIcon.tsx +24 -39
- package/src/tools/FileIcon/get-file-icon.ts +73 -0
- package/src/tools/FileIcon/icons/icon-data.ts +399 -0
- package/src/tools/FileIcon/index.ts +4 -0
- package/src/tools/FileIcon/loader.ts +17 -35
- package/src/tools/FileIcon/specialFolders.ts +18 -0
- package/src/tools/Gallery/components/lightbox/GalleryLightbox.tsx +112 -35
- package/src/tools/Gallery/components/media/GalleryVideo.tsx +21 -2
- package/src/tools/Gallery/components/preview/GalleryCarousel.tsx +11 -1
- package/src/tools/Gallery/hooks/usePreloadImages.ts +54 -7
- package/src/tools/ImageViewer/components/ImageInfo.tsx +12 -1
- package/src/tools/ImageViewer/components/ImageToolbar.tsx +51 -43
- package/src/tools/ImageViewer/components/ImageViewer.tsx +106 -26
- package/src/tools/ImageViewer/hooks/useImageLoading.ts +13 -0
- package/src/tools/ImageViewer/utils/constants.ts +3 -0
- package/src/tools/ImageViewer/utils/index.ts +1 -0
- package/src/tools/JsonForm/JsonSchemaForm.tsx +4 -1
- package/src/tools/JsonForm/templates/ArrayFieldTemplate.tsx +5 -3
- package/src/tools/JsonForm/templates/BaseInputTemplate.tsx +7 -4
- package/src/tools/JsonForm/templates/ErrorListTemplate.tsx +3 -1
- package/src/tools/JsonForm/templates/ObjectFieldTemplate.tsx +23 -3
- package/src/tools/JsonForm/widgets/ColorWidget.tsx +20 -12
- package/src/tools/JsonForm/widgets/NumberWidget.tsx +14 -9
- package/src/tools/JsonForm/widgets/RadioWidget.tsx +78 -0
- package/src/tools/JsonForm/widgets/SelectWidget.tsx +1 -0
- package/src/tools/JsonForm/widgets/SliderWidget.tsx +7 -4
- package/src/tools/JsonForm/widgets/TextWidget.tsx +41 -17
- package/src/tools/JsonForm/widgets/index.ts +1 -0
- package/src/tools/JsonTree/components/JsonContent.tsx +115 -40
- package/src/tools/LottiePlayer/LottiePlayer.client.tsx +177 -72
- package/src/tools/LottiePlayer/index.tsx +14 -4
- package/src/tools/LottiePlayer/lazy.tsx +11 -3
- package/src/tools/LottiePlayer/types.ts +31 -1
- package/src/tools/LottiePlayer/useLottie.ts +32 -9
- package/src/tools/LottiePlayer/usePrefersReducedMotion.ts +46 -0
- package/src/tools/Map/components/LayerSwitcher.tsx +54 -21
- package/src/tools/Map/components/MapCluster.tsx +28 -21
- package/src/tools/Map/components/MapContainer.tsx +11 -4
- package/src/tools/Map/components/MapLegend.tsx +46 -15
- package/src/tools/Map/components/MapMarker.tsx +31 -2
- package/src/tools/Map/hooks/useMapEvents.ts +64 -105
- package/src/tools/MarkdownEditor/MarkdownEditor.tsx +61 -6
- package/src/tools/MarkdownEditor/MentionList.tsx +37 -4
- package/src/tools/MarkdownEditor/createMentionSuggestion.ts +11 -0
- package/src/tools/MarkdownEditor/lazy.tsx +32 -7
- package/src/tools/MarkdownEditor/styles.css +13 -0
- package/src/tools/MarkdownMessage/CodeBlock.tsx +40 -17
- package/src/tools/MarkdownMessage/MarkdownMessage.tsx +26 -6
- package/src/tools/MarkdownMessage/components.tsx +22 -9
- package/src/tools/MarkdownMessage/types.ts +24 -1
- package/src/tools/Mermaid/Mermaid.client.tsx +27 -5
- package/src/tools/Mermaid/components/MermaidErrorPanel.tsx +31 -0
- package/src/tools/Mermaid/components/MermaidFullscreenModal.tsx +14 -17
- package/src/tools/Mermaid/hooks/useMermaidRenderer.ts +264 -168
- package/src/tools/Mermaid/hooks/useMermaidValidation.ts +76 -10
- package/src/tools/Mermaid/index.tsx +6 -0
- package/src/tools/Mermaid/utils/mermaid-helpers.ts +141 -18
- package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/SchemaFields/FieldRow.tsx +11 -1
- package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/SchemaFields/buildTree.ts +49 -20
- package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/index.tsx +7 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/grouping.ts +7 -4
- package/src/tools/OpenapiViewer/constants.ts +3 -0
- package/src/tools/OpenapiViewer/hooks/useOpenApiSchema.ts +73 -11
- package/src/tools/OpenapiViewer/utils/schemaExport.ts +26 -6
- package/src/tools/PrettyCode/PrettyCode.client.tsx +23 -16
- package/src/tools/PrettyCode/lazy.tsx +1 -1
- package/src/tools/SpeechRecognition/README.md +1 -1
- package/src/tools/SpeechRecognition/__tests__/language.test.ts +9 -3
- package/src/tools/SpeechRecognition/components/RecordingPulse.tsx +59 -0
- package/src/tools/SpeechRecognition/components/index.ts +2 -0
- package/src/tools/SpeechRecognition/core/engine/external.ts +24 -7
- package/src/tools/SpeechRecognition/core/language.ts +23 -6
- package/src/tools/SpeechRecognition/hooks/usePushToTalk.ts +36 -5
- package/src/tools/SpeechRecognition/hooks/useSpeechRecognition.ts +18 -11
- package/src/tools/SpeechRecognition/widgets/VoiceComposerSlot.tsx +94 -26
- package/src/tools/SpeechRecognition/widgets/index.ts +1 -1
- package/src/tools/Tree/README.md +4 -8
- package/src/tools/Tree/TreeRoot.tsx +22 -10
- package/src/tools/Tree/components/TreeContent.tsx +24 -4
- package/src/tools/Tree/components/TreeLabel.tsx +8 -2
- package/src/tools/Tree/components/TreeRow.tsx +16 -6
- package/src/tools/Tree/data/flatten.ts +10 -4
- package/src/tools/Tree/types.ts +4 -0
- package/src/tools/Uploader/components/UploadAddButton.tsx +29 -6
- package/src/tools/Uploader/components/UploadDropzone.tsx +63 -7
- package/src/tools/Uploader/components/UploadPageDropOverlay.tsx +19 -5
- package/src/tools/Uploader/components/UploadPreviewItem.tsx +47 -17
- package/src/tools/Uploader/components/UploadPreviewList.tsx +24 -12
- package/src/tools/Uploader/utils/formatters.ts +8 -3
- package/src/tools/VideoPlayer/README.md +87 -230
- package/src/tools/VideoPlayer/VideoPlayer.tsx +82 -0
- package/src/tools/VideoPlayer/canvas/canvas-dispatcher.tsx +34 -0
- package/src/tools/VideoPlayer/canvas/hls-canvas.tsx +39 -0
- package/src/tools/VideoPlayer/canvas/iframe-canvas.tsx +33 -0
- package/src/tools/VideoPlayer/canvas/index.ts +12 -0
- package/src/tools/VideoPlayer/canvas/jsx-augmentation.ts +47 -0
- package/src/tools/VideoPlayer/canvas/native-canvas.tsx +38 -0
- package/src/tools/VideoPlayer/canvas/vimeo-canvas.tsx +40 -0
- package/src/tools/VideoPlayer/canvas/youtube-canvas.tsx +78 -0
- package/src/tools/VideoPlayer/index.ts +51 -65
- package/src/tools/VideoPlayer/lazy.tsx +11 -54
- package/src/tools/VideoPlayer/parts/controls-bar.tsx +35 -0
- package/src/tools/VideoPlayer/parts/fullscreen.tsx +19 -0
- package/src/tools/VideoPlayer/parts/index.ts +15 -0
- package/src/tools/VideoPlayer/parts/pip.tsx +19 -0
- package/src/tools/VideoPlayer/parts/play-button.tsx +19 -0
- package/src/tools/VideoPlayer/parts/playback-rate.tsx +31 -0
- package/src/tools/VideoPlayer/parts/poster.tsx +3 -0
- package/src/tools/VideoPlayer/parts/seek-bar.tsx +26 -0
- package/src/tools/VideoPlayer/parts/volume.tsx +32 -0
- package/src/tools/VideoPlayer/styles/video-player.css +141 -0
- package/src/tools/VideoPlayer/types.ts +82 -0
- package/src/tools/VideoPlayer/utils/parse-embed-url.ts +70 -0
- package/src/tools/VideoPlayer/utils/vimeo-id.ts +24 -0
- package/src/tools/VideoPlayer/utils/youtube-id.ts +64 -0
- package/src/tools/index.ts +37 -29
- package/src/tools/Chat/components/AudioToggle.tsx +0 -78
- package/src/tools/Chat/components/ChatRoot.tsx +0 -305
- package/src/tools/Chat/components/Composer.tsx +0 -216
- package/src/tools/Chat/hooks/useChatScroll.ts +0 -145
- package/src/tools/Chat/types.ts +0 -9
- package/src/tools/JsonTree/components/JsonToolbar.tsx +0 -95
- package/src/tools/JsonTree/hooks/useElementCorner.ts +0 -84
- package/src/tools/JsonTree/hooks/useNavbarHeight.ts +0 -83
- package/src/tools/OpenapiViewer/components/DocsLayout/schemaFields.ts +0 -121
- package/src/tools/Tour/README.md +0 -373
- package/src/tools/Tour/components/Tour.tsx +0 -12
- package/src/tools/Tour/components/TourContent.tsx +0 -171
- package/src/tools/Tour/components/TourNavigation.tsx +0 -77
- package/src/tools/Tour/components/TourProgress.tsx +0 -88
- package/src/tools/Tour/components/TourSpotlight.tsx +0 -199
- package/src/tools/Tour/components/index.ts +0 -5
- package/src/tools/Tour/context/TourContext.ts +0 -19
- package/src/tools/Tour/context/TourProvider.tsx +0 -292
- package/src/tools/Tour/context/index.ts +0 -2
- package/src/tools/Tour/hooks/index.ts +0 -3
- package/src/tools/Tour/hooks/useKeyboardNavigation.ts +0 -59
- package/src/tools/Tour/hooks/useStepTarget.ts +0 -121
- package/src/tools/Tour/hooks/useTour.ts +0 -42
- package/src/tools/Tour/index.ts +0 -38
- package/src/tools/Tour/types/index.ts +0 -224
- package/src/tools/Tour/utils/dom.ts +0 -98
- package/src/tools/Tour/utils/index.ts +0 -3
- package/src/tools/Tour/utils/logger.ts +0 -3
- package/src/tools/Tour/utils/scrollIntoView.ts +0 -24
- package/src/tools/VideoPlayer/components/VideoControls.tsx +0 -138
- package/src/tools/VideoPlayer/components/VideoErrorFallback.tsx +0 -172
- package/src/tools/VideoPlayer/components/VideoPlayer.tsx +0 -201
- package/src/tools/VideoPlayer/components/index.ts +0 -14
- package/src/tools/VideoPlayer/context/VideoPlayerContext.tsx +0 -52
- package/src/tools/VideoPlayer/context/index.ts +0 -8
- package/src/tools/VideoPlayer/hooks/index.ts +0 -12
- package/src/tools/VideoPlayer/hooks/useVideoPlayerSettings.ts +0 -71
- package/src/tools/VideoPlayer/hooks/useVideoPositionCache.ts +0 -117
- package/src/tools/VideoPlayer/providers/NativeProvider.tsx +0 -284
- package/src/tools/VideoPlayer/providers/StreamProvider.tsx +0 -505
- package/src/tools/VideoPlayer/providers/VidstackProvider.tsx +0 -397
- package/src/tools/VideoPlayer/providers/index.ts +0 -8
- package/src/tools/VideoPlayer/types/index.ts +0 -38
- package/src/tools/VideoPlayer/types/player.ts +0 -116
- package/src/tools/VideoPlayer/types/provider.ts +0 -93
- package/src/tools/VideoPlayer/types/sources.ts +0 -97
- package/src/tools/VideoPlayer/utils/debug.ts +0 -14
- package/src/tools/VideoPlayer/utils/fileSource.ts +0 -78
- package/src/tools/VideoPlayer/utils/index.ts +0 -12
- package/src/tools/VideoPlayer/utils/resolvers.ts +0 -75
- /package/src/tools/Chat/{config.ts → constants.ts} +0 -0
- /package/src/tools/Chat/launcher/{ChatHeaderAudioToggle.tsx → header/ChatHeaderAudioToggle.tsx} +0 -0
- /package/src/tools/Chat/{components → messages}/Attachments.tsx +0 -0
- /package/src/tools/Chat/{components → messages}/JumpToLatest.tsx +0 -0
- /package/src/tools/Chat/{components → messages}/MessageActions.tsx +0 -0
- /package/src/tools/Chat/{components → messages}/Sources.tsx +0 -0
- /package/src/tools/Chat/{components → messages}/StreamingIndicator.tsx +0 -0
- /package/src/tools/Chat/{components → messages}/ToolCalls.tsx +0 -0
- /package/src/tools/Chat/{components → shell}/ErrorBanner.tsx +0 -0
|
@@ -1,505 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* StreamProvider - HTTP Range streaming and Blob video player
|
|
3
|
-
* Supports:
|
|
4
|
-
* - HTTP Range requests with authorization (for large files)
|
|
5
|
-
* - Blob/ArrayBuffer sources
|
|
6
|
-
* - Data URL sources
|
|
7
|
-
* - Fill parent container mode
|
|
8
|
-
* - Custom error fallback
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
'use client';
|
|
12
|
-
|
|
13
|
-
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
14
|
-
|
|
15
|
-
import { cn } from '@djangocfg/ui-core/lib';
|
|
16
|
-
import { Preloader, AspectRatio } from '@djangocfg/ui-core';
|
|
17
|
-
import { useMediaCacheStore, generateContentKey } from '../../../stores/mediaCache';
|
|
18
|
-
import { useVideoPlayerSettings } from '../hooks/useVideoPlayerSettings';
|
|
19
|
-
|
|
20
|
-
import type { StreamProviderProps, VideoPlayerRef, StreamSource, BlobSource, DataUrlSource, ErrorFallbackProps } from '../types';
|
|
21
|
-
import { videoDebug } from '../utils/debug';
|
|
22
|
-
|
|
23
|
-
/** Default error fallback UI */
|
|
24
|
-
function DefaultErrorFallback({ error }: ErrorFallbackProps) {
|
|
25
|
-
return (
|
|
26
|
-
<div className="absolute inset-0 flex flex-col items-center justify-center gap-4 text-white">
|
|
27
|
-
<svg
|
|
28
|
-
className="w-16 h-16 text-muted-foreground"
|
|
29
|
-
fill="none"
|
|
30
|
-
stroke="currentColor"
|
|
31
|
-
viewBox="0 0 24 24"
|
|
32
|
-
>
|
|
33
|
-
<path
|
|
34
|
-
strokeLinecap="round"
|
|
35
|
-
strokeLinejoin="round"
|
|
36
|
-
strokeWidth={2}
|
|
37
|
-
d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"
|
|
38
|
-
/>
|
|
39
|
-
</svg>
|
|
40
|
-
<p className="text-lg">{error || 'Video cannot be previewed'}</p>
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const StreamProvider = forwardRef<VideoPlayerRef, StreamProviderProps>(
|
|
46
|
-
(
|
|
47
|
-
{
|
|
48
|
-
source,
|
|
49
|
-
aspectRatio = 16 / 9,
|
|
50
|
-
autoPlay = false,
|
|
51
|
-
muted = false,
|
|
52
|
-
loop = false,
|
|
53
|
-
playsInline = true,
|
|
54
|
-
preload = 'metadata',
|
|
55
|
-
controls = true,
|
|
56
|
-
disableContextMenu = false,
|
|
57
|
-
showPreloader = true,
|
|
58
|
-
preloaderTimeout = 10000,
|
|
59
|
-
className,
|
|
60
|
-
videoClassName,
|
|
61
|
-
errorFallback,
|
|
62
|
-
onPlay,
|
|
63
|
-
onPause,
|
|
64
|
-
onEnded,
|
|
65
|
-
onError,
|
|
66
|
-
onLoadStart,
|
|
67
|
-
onCanPlay,
|
|
68
|
-
onTimeUpdate,
|
|
69
|
-
onBufferProgress,
|
|
70
|
-
},
|
|
71
|
-
ref
|
|
72
|
-
) => {
|
|
73
|
-
const [videoUrl, setVideoUrl] = useState<string | null>(null);
|
|
74
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
75
|
-
const [hasError, setHasError] = useState(false);
|
|
76
|
-
const [errorMessage, setErrorMessage] = useState<string>('Video cannot be previewed');
|
|
77
|
-
const videoRef = useRef<HTMLVideoElement>(null);
|
|
78
|
-
const contentKeyRef = useRef<string | null>(null);
|
|
79
|
-
const lastSavedTimeRef = useRef<number>(0);
|
|
80
|
-
|
|
81
|
-
// Get stable function references from store (not from hook to avoid re-renders)
|
|
82
|
-
const getOrCreateBlobUrl = useMediaCacheStore.getState().getOrCreateBlobUrl;
|
|
83
|
-
const releaseBlobUrl = useMediaCacheStore.getState().releaseBlobUrl;
|
|
84
|
-
const getOrCreateStreamUrl = useMediaCacheStore.getState().getOrCreateStreamUrl;
|
|
85
|
-
const saveVideoPosition = useMediaCacheStore.getState().saveVideoPosition;
|
|
86
|
-
const getVideoPosition = useMediaCacheStore.getState().getVideoPosition;
|
|
87
|
-
|
|
88
|
-
// Persisted player settings
|
|
89
|
-
const { settings: savedSettings, updateVolume } = useVideoPlayerSettings();
|
|
90
|
-
|
|
91
|
-
// Retry function for error fallback
|
|
92
|
-
// Regenerates URL for stream sources to get fresh token/session
|
|
93
|
-
const retry = useCallback(() => {
|
|
94
|
-
setHasError(false);
|
|
95
|
-
setIsLoading(true);
|
|
96
|
-
|
|
97
|
-
// For stream sources, regenerate URL bypassing cache
|
|
98
|
-
if (source.type === 'stream') {
|
|
99
|
-
const streamSource = source as StreamSource;
|
|
100
|
-
const freshUrl = streamSource.getStreamUrl(streamSource.sessionId, streamSource.path);
|
|
101
|
-
setVideoUrl(freshUrl);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// For other sources, just reload
|
|
106
|
-
const video = videoRef.current;
|
|
107
|
-
if (video && videoUrl) {
|
|
108
|
-
video.load();
|
|
109
|
-
}
|
|
110
|
-
}, [source, videoUrl]);
|
|
111
|
-
|
|
112
|
-
// Expose video element methods via ref
|
|
113
|
-
useImperativeHandle(
|
|
114
|
-
ref,
|
|
115
|
-
() => ({
|
|
116
|
-
play: () => videoRef.current?.play(),
|
|
117
|
-
pause: () => videoRef.current?.pause(),
|
|
118
|
-
togglePlay: () => {
|
|
119
|
-
const video = videoRef.current;
|
|
120
|
-
if (video) {
|
|
121
|
-
video.paused ? video.play() : video.pause();
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
seekTo: (time: number) => {
|
|
125
|
-
if (videoRef.current) videoRef.current.currentTime = time;
|
|
126
|
-
},
|
|
127
|
-
setVolume: (volume: number) => {
|
|
128
|
-
if (videoRef.current) videoRef.current.volume = Math.max(0, Math.min(1, volume));
|
|
129
|
-
},
|
|
130
|
-
toggleMute: () => {
|
|
131
|
-
if (videoRef.current) videoRef.current.muted = !videoRef.current.muted;
|
|
132
|
-
},
|
|
133
|
-
enterFullscreen: () => videoRef.current?.requestFullscreen(),
|
|
134
|
-
exitFullscreen: () => document.exitFullscreen(),
|
|
135
|
-
get currentTime() {
|
|
136
|
-
return videoRef.current?.currentTime ?? 0;
|
|
137
|
-
},
|
|
138
|
-
get duration() {
|
|
139
|
-
return videoRef.current?.duration ?? 0;
|
|
140
|
-
},
|
|
141
|
-
get paused() {
|
|
142
|
-
return videoRef.current?.paused ?? true;
|
|
143
|
-
},
|
|
144
|
-
}),
|
|
145
|
-
[]
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
// Track unmount for cleanup
|
|
149
|
-
const isMountedRef = useRef(true);
|
|
150
|
-
useEffect(() => {
|
|
151
|
-
isMountedRef.current = true;
|
|
152
|
-
return () => {
|
|
153
|
-
isMountedRef.current = false;
|
|
154
|
-
// Release blob URL only on actual unmount
|
|
155
|
-
if (contentKeyRef.current) {
|
|
156
|
-
useMediaCacheStore.getState().releaseBlobUrl(contentKeyRef.current);
|
|
157
|
-
contentKeyRef.current = null;
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
}, []);
|
|
161
|
-
|
|
162
|
-
// Create video URL based on source type with caching
|
|
163
|
-
useEffect(() => {
|
|
164
|
-
// Release previous blob URL if source changed
|
|
165
|
-
if (contentKeyRef.current) {
|
|
166
|
-
const newKey = source.type === 'blob'
|
|
167
|
-
? generateContentKey((source as BlobSource).data)
|
|
168
|
-
: null;
|
|
169
|
-
if (newKey !== contentKeyRef.current) {
|
|
170
|
-
releaseBlobUrl(contentKeyRef.current);
|
|
171
|
-
contentKeyRef.current = null;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
setHasError(false);
|
|
176
|
-
setIsLoading(true);
|
|
177
|
-
|
|
178
|
-
switch (source.type) {
|
|
179
|
-
case 'stream': {
|
|
180
|
-
const streamSource = source as StreamSource;
|
|
181
|
-
// Use cached stream URL
|
|
182
|
-
const url = getOrCreateStreamUrl(
|
|
183
|
-
streamSource.sessionId,
|
|
184
|
-
streamSource.path,
|
|
185
|
-
streamSource.getStreamUrl
|
|
186
|
-
);
|
|
187
|
-
videoDebug.load(url, 'stream');
|
|
188
|
-
setVideoUrl(url);
|
|
189
|
-
break;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
case 'blob': {
|
|
193
|
-
const blobSource = source as BlobSource;
|
|
194
|
-
// Generate content key for caching
|
|
195
|
-
const contentKey = generateContentKey(blobSource.data);
|
|
196
|
-
contentKeyRef.current = contentKey;
|
|
197
|
-
// Use cached blob URL
|
|
198
|
-
const url = getOrCreateBlobUrl(
|
|
199
|
-
contentKey,
|
|
200
|
-
blobSource.data,
|
|
201
|
-
blobSource.mimeType || 'video/mp4'
|
|
202
|
-
);
|
|
203
|
-
videoDebug.load(url, 'blob');
|
|
204
|
-
setVideoUrl(url);
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
case 'data-url': {
|
|
209
|
-
const dataUrlSource = source as DataUrlSource;
|
|
210
|
-
videoDebug.load(dataUrlSource.data.slice(0, 50) + '...', 'data-url');
|
|
211
|
-
setVideoUrl(dataUrlSource.data);
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
default:
|
|
216
|
-
videoDebug.error('Invalid video source type', { type: (source as { type: string }).type });
|
|
217
|
-
setVideoUrl(null);
|
|
218
|
-
setHasError(true);
|
|
219
|
-
setErrorMessage('Invalid video source');
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// No cleanup here - cleanup happens in unmount effect above
|
|
223
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
224
|
-
}, [source]);
|
|
225
|
-
|
|
226
|
-
// Get source key for position caching
|
|
227
|
-
const getSourceKey = useCallback(() => {
|
|
228
|
-
switch (source.type) {
|
|
229
|
-
case 'stream':
|
|
230
|
-
return `stream:${(source as StreamSource).sessionId}:${(source as StreamSource).path}`;
|
|
231
|
-
case 'blob':
|
|
232
|
-
return contentKeyRef.current ? `blob:${contentKeyRef.current}` : null;
|
|
233
|
-
case 'data-url':
|
|
234
|
-
return `data:${(source as DataUrlSource).data.slice(0, 50)}`;
|
|
235
|
-
default:
|
|
236
|
-
return null;
|
|
237
|
-
}
|
|
238
|
-
}, [source]);
|
|
239
|
-
|
|
240
|
-
// Restore cached playback position and settings when video is ready
|
|
241
|
-
const handleCanPlay = useCallback(() => {
|
|
242
|
-
const video = videoRef.current;
|
|
243
|
-
if (video) {
|
|
244
|
-
videoDebug.state('canplay', { duration: video.duration, buffered: video.buffered.length });
|
|
245
|
-
videoDebug.buffer(video.buffered, video.duration);
|
|
246
|
-
|
|
247
|
-
// Apply saved volume (user preference)
|
|
248
|
-
video.volume = savedSettings.volume;
|
|
249
|
-
}
|
|
250
|
-
setIsLoading(false);
|
|
251
|
-
|
|
252
|
-
// Restore position from cache
|
|
253
|
-
const sourceKey = getSourceKey();
|
|
254
|
-
if (sourceKey && video) {
|
|
255
|
-
const cachedPosition = getVideoPosition(sourceKey);
|
|
256
|
-
if (cachedPosition && cachedPosition > 0) {
|
|
257
|
-
const duration = video.duration;
|
|
258
|
-
// Only restore if position is valid (not at the end)
|
|
259
|
-
if (cachedPosition < duration - 1) {
|
|
260
|
-
videoDebug.debug(`Restoring position: ${cachedPosition}s`);
|
|
261
|
-
video.currentTime = cachedPosition;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
onCanPlay?.();
|
|
267
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
268
|
-
}, [getSourceKey, onCanPlay, savedSettings.volume]);
|
|
269
|
-
|
|
270
|
-
// Save playback position periodically
|
|
271
|
-
const handleTimeUpdate = useCallback(() => {
|
|
272
|
-
const video = videoRef.current;
|
|
273
|
-
if (!video) return;
|
|
274
|
-
|
|
275
|
-
// Save position every 5 seconds
|
|
276
|
-
const sourceKey = getSourceKey();
|
|
277
|
-
if (sourceKey && video.currentTime > 0) {
|
|
278
|
-
const timeSinceLastSave = video.currentTime - lastSavedTimeRef.current;
|
|
279
|
-
if (timeSinceLastSave >= 5 || timeSinceLastSave < 0) {
|
|
280
|
-
saveVideoPosition(sourceKey, video.currentTime);
|
|
281
|
-
lastSavedTimeRef.current = video.currentTime;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
onTimeUpdate?.(video.currentTime, video.duration);
|
|
286
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
287
|
-
}, [getSourceKey, onTimeUpdate]);
|
|
288
|
-
|
|
289
|
-
// Save position on pause
|
|
290
|
-
const handlePause = useCallback(() => {
|
|
291
|
-
const video = videoRef.current;
|
|
292
|
-
const sourceKey = getSourceKey();
|
|
293
|
-
if (sourceKey && video && video.currentTime > 0) {
|
|
294
|
-
saveVideoPosition(sourceKey, video.currentTime);
|
|
295
|
-
lastSavedTimeRef.current = video.currentTime;
|
|
296
|
-
}
|
|
297
|
-
onPause?.();
|
|
298
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
299
|
-
}, [getSourceKey, onPause]);
|
|
300
|
-
|
|
301
|
-
// Handle buffer progress
|
|
302
|
-
const handleProgress = useCallback(() => {
|
|
303
|
-
const video = videoRef.current;
|
|
304
|
-
if (!video || !onBufferProgress) return;
|
|
305
|
-
|
|
306
|
-
// Get the buffered time ranges
|
|
307
|
-
if (video.buffered.length > 0) {
|
|
308
|
-
// Get the end of the last buffered range
|
|
309
|
-
const bufferedEnd = video.buffered.end(video.buffered.length - 1);
|
|
310
|
-
const duration = video.duration;
|
|
311
|
-
|
|
312
|
-
if (duration > 0 && !isNaN(bufferedEnd)) {
|
|
313
|
-
onBufferProgress(bufferedEnd, duration);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}, [onBufferProgress]);
|
|
317
|
-
|
|
318
|
-
// Preloader timeout
|
|
319
|
-
useEffect(() => {
|
|
320
|
-
if (!showPreloader || !isLoading) return;
|
|
321
|
-
|
|
322
|
-
const timeout = setTimeout(() => {
|
|
323
|
-
setIsLoading(false);
|
|
324
|
-
}, preloaderTimeout);
|
|
325
|
-
|
|
326
|
-
return () => clearTimeout(timeout);
|
|
327
|
-
}, [showPreloader, isLoading, preloaderTimeout]);
|
|
328
|
-
|
|
329
|
-
const handleContextMenu = (e: React.MouseEvent) => {
|
|
330
|
-
if (disableContextMenu) {
|
|
331
|
-
e.preventDefault();
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
const handleLoadedData = () => {
|
|
336
|
-
setIsLoading(false);
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
const handleError = () => {
|
|
340
|
-
const video = videoRef.current;
|
|
341
|
-
if (video) {
|
|
342
|
-
videoDebug.error('Video error', { code: video.error?.code, message: video.error?.message });
|
|
343
|
-
}
|
|
344
|
-
setIsLoading(false);
|
|
345
|
-
setHasError(true);
|
|
346
|
-
setErrorMessage('Failed to load video');
|
|
347
|
-
onError?.('Video playback error');
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
// Debug: Log video events
|
|
351
|
-
useEffect(() => {
|
|
352
|
-
const video = videoRef.current;
|
|
353
|
-
if (!video) return;
|
|
354
|
-
|
|
355
|
-
const handleLoadedMetadata = () => {
|
|
356
|
-
videoDebug.state('loadedmetadata', { duration: video.duration });
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
const handleSeeking = () => {
|
|
360
|
-
videoDebug.event('seeking', { currentTime: video.currentTime });
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
const handleSeeked = () => {
|
|
364
|
-
videoDebug.event('seeked', { currentTime: video.currentTime });
|
|
365
|
-
videoDebug.buffer(video.buffered, video.duration);
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
const handleWaiting = () => {
|
|
369
|
-
videoDebug.warn('WAITING - buffering...');
|
|
370
|
-
videoDebug.buffer(video.buffered, video.duration);
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
const handleStalled = () => {
|
|
374
|
-
videoDebug.warn('STALLED - network issue');
|
|
375
|
-
videoDebug.buffer(video.buffered, video.duration);
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
video.addEventListener('loadedmetadata', handleLoadedMetadata);
|
|
379
|
-
video.addEventListener('seeking', handleSeeking);
|
|
380
|
-
video.addEventListener('seeked', handleSeeked);
|
|
381
|
-
video.addEventListener('waiting', handleWaiting);
|
|
382
|
-
video.addEventListener('stalled', handleStalled);
|
|
383
|
-
|
|
384
|
-
return () => {
|
|
385
|
-
video.removeEventListener('loadedmetadata', handleLoadedMetadata);
|
|
386
|
-
video.removeEventListener('seeking', handleSeeking);
|
|
387
|
-
video.removeEventListener('seeked', handleSeeked);
|
|
388
|
-
video.removeEventListener('waiting', handleWaiting);
|
|
389
|
-
video.removeEventListener('stalled', handleStalled);
|
|
390
|
-
};
|
|
391
|
-
}, [videoUrl]);
|
|
392
|
-
|
|
393
|
-
// Persist volume when user changes it via native controls
|
|
394
|
-
useEffect(() => {
|
|
395
|
-
const video = videoRef.current;
|
|
396
|
-
if (!video) return;
|
|
397
|
-
|
|
398
|
-
const handleVolumeChange = () => {
|
|
399
|
-
updateVolume(video.volume);
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
video.addEventListener('volumechange', handleVolumeChange);
|
|
403
|
-
return () => video.removeEventListener('volumechange', handleVolumeChange);
|
|
404
|
-
}, [videoUrl, updateVolume]);
|
|
405
|
-
|
|
406
|
-
// Determine if we should use AspectRatio wrapper or fill mode
|
|
407
|
-
const isFillMode = aspectRatio === 'fill';
|
|
408
|
-
const computedAspectRatio = aspectRatio === 'auto' || aspectRatio === 'fill' ? undefined : aspectRatio;
|
|
409
|
-
|
|
410
|
-
// Render error fallback
|
|
411
|
-
const renderErrorFallback = () => {
|
|
412
|
-
const fallbackProps: ErrorFallbackProps = { error: errorMessage, retry };
|
|
413
|
-
|
|
414
|
-
if (typeof errorFallback === 'function') {
|
|
415
|
-
return errorFallback(fallbackProps);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
if (errorFallback) {
|
|
419
|
-
return errorFallback;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
return <DefaultErrorFallback {...fallbackProps} />;
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
// Error state
|
|
426
|
-
if (!videoUrl || hasError) {
|
|
427
|
-
if (isFillMode) {
|
|
428
|
-
return (
|
|
429
|
-
<div className={cn('relative w-full h-full overflow-hidden bg-black', className)}>
|
|
430
|
-
{renderErrorFallback()}
|
|
431
|
-
</div>
|
|
432
|
-
);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
return (
|
|
436
|
-
<div className={cn('relative overflow-hidden bg-black', className)}>
|
|
437
|
-
<AspectRatio ratio={computedAspectRatio}>
|
|
438
|
-
{renderErrorFallback()}
|
|
439
|
-
</AspectRatio>
|
|
440
|
-
</div>
|
|
441
|
-
);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
// Video content
|
|
445
|
-
const videoContent = (
|
|
446
|
-
<>
|
|
447
|
-
{/* Loading indicator */}
|
|
448
|
-
{showPreloader && isLoading && (
|
|
449
|
-
<div className="absolute inset-0 flex items-center justify-center bg-black/50 z-10">
|
|
450
|
-
<Preloader size="lg" spinnerClassName="text-white" />
|
|
451
|
-
</div>
|
|
452
|
-
)}
|
|
453
|
-
|
|
454
|
-
{/* Video element */}
|
|
455
|
-
<video
|
|
456
|
-
ref={videoRef}
|
|
457
|
-
src={videoUrl}
|
|
458
|
-
className={cn(
|
|
459
|
-
'w-full h-full object-contain',
|
|
460
|
-
isLoading && 'opacity-0',
|
|
461
|
-
videoClassName
|
|
462
|
-
)}
|
|
463
|
-
autoPlay={autoPlay}
|
|
464
|
-
muted={muted}
|
|
465
|
-
loop={loop}
|
|
466
|
-
playsInline={playsInline}
|
|
467
|
-
preload={preload}
|
|
468
|
-
controls={controls}
|
|
469
|
-
crossOrigin="anonymous"
|
|
470
|
-
poster={source.poster}
|
|
471
|
-
onContextMenu={handleContextMenu}
|
|
472
|
-
onLoadStart={onLoadStart}
|
|
473
|
-
onCanPlay={handleCanPlay}
|
|
474
|
-
onLoadedData={handleLoadedData}
|
|
475
|
-
onPlay={onPlay}
|
|
476
|
-
onPause={handlePause}
|
|
477
|
-
onEnded={onEnded}
|
|
478
|
-
onError={handleError}
|
|
479
|
-
onTimeUpdate={handleTimeUpdate}
|
|
480
|
-
onProgress={handleProgress}
|
|
481
|
-
/>
|
|
482
|
-
</>
|
|
483
|
-
);
|
|
484
|
-
|
|
485
|
-
// Fill mode - no AspectRatio wrapper
|
|
486
|
-
if (isFillMode) {
|
|
487
|
-
return (
|
|
488
|
-
<div className={cn('relative w-full h-full overflow-hidden bg-black', className)}>
|
|
489
|
-
{videoContent}
|
|
490
|
-
</div>
|
|
491
|
-
);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
// Normal mode with AspectRatio
|
|
495
|
-
return (
|
|
496
|
-
<div className={cn('relative overflow-hidden bg-black', className)}>
|
|
497
|
-
<AspectRatio ratio={computedAspectRatio}>
|
|
498
|
-
{videoContent}
|
|
499
|
-
</AspectRatio>
|
|
500
|
-
</div>
|
|
501
|
-
);
|
|
502
|
-
}
|
|
503
|
-
);
|
|
504
|
-
|
|
505
|
-
StreamProvider.displayName = 'StreamProvider';
|