@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
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSX intrinsic-element declarations for the custom-element wrappers
|
|
3
|
+
* shipped by `youtube-video-element`, `vimeo-video-element`,
|
|
4
|
+
* `hls-video-element`.
|
|
5
|
+
*
|
|
6
|
+
* This is a real module (not an ambient `.d.ts`) so that it is reliably
|
|
7
|
+
* pulled into the type graph when imported as a side effect. Ambient
|
|
8
|
+
* `.d.ts` files are only loaded when they fall inside a project's
|
|
9
|
+
* `include` — consumers (e.g. the Storybook tsconfig) only `include`
|
|
10
|
+
* their own `stories/`, so a bare `.d.ts` here was silently skipped.
|
|
11
|
+
*
|
|
12
|
+
* media-chrome relies on `slot="media"` to attach a media element to
|
|
13
|
+
* its `<MediaController>`. We declare the bare prop surface we use:
|
|
14
|
+
* `src`, `slot`, `autoplay`, `muted`, `loop`, `playsinline`,
|
|
15
|
+
* `crossorigin`, `preload`, `poster`. All three elements are
|
|
16
|
+
* `HTMLElement` subclasses with `HTMLVideoElement`-shaped APIs, so
|
|
17
|
+
* their JSX props are typed as a partial of `VideoHTMLAttributes`.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import type { DetailedHTMLProps, HTMLAttributes, VideoHTMLAttributes } from 'react';
|
|
21
|
+
|
|
22
|
+
type VideoLikeElement = DetailedHTMLProps<
|
|
23
|
+
VideoHTMLAttributes<HTMLElement> & HTMLAttributes<HTMLElement>,
|
|
24
|
+
HTMLElement
|
|
25
|
+
>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* `youtube-video-element` accepts a `config` property — an object merged
|
|
29
|
+
* into the YouTube IFrame `playerVars` (JSON-serialized into a
|
|
30
|
+
* `data-config` attribute internally). Used to suppress native chrome.
|
|
31
|
+
*/
|
|
32
|
+
type YouTubeVideoElement = VideoLikeElement & {
|
|
33
|
+
config?: Record<string, string | number | boolean>;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
declare module 'react' {
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
38
|
+
namespace JSX {
|
|
39
|
+
interface IntrinsicElements {
|
|
40
|
+
'youtube-video': YouTubeVideoElement;
|
|
41
|
+
'vimeo-video': VideoLikeElement;
|
|
42
|
+
'hls-video': VideoLikeElement;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Native `<video slot="media">` for direct MP4 / WebM / blob / data URLs.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { MediaPosterImage } from 'media-chrome/react';
|
|
8
|
+
import type { UrlSource, VideoPlayerSettings } from '../types';
|
|
9
|
+
|
|
10
|
+
export interface NativeCanvasProps extends VideoPlayerSettings {
|
|
11
|
+
readonly source: UrlSource;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function NativeCanvas({
|
|
15
|
+
source,
|
|
16
|
+
autoPlay,
|
|
17
|
+
muted,
|
|
18
|
+
loop,
|
|
19
|
+
playsInline = true,
|
|
20
|
+
crossOrigin = 'anonymous',
|
|
21
|
+
preload = 'metadata',
|
|
22
|
+
}: NativeCanvasProps) {
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<video
|
|
26
|
+
slot="media"
|
|
27
|
+
src={source.url}
|
|
28
|
+
muted={muted}
|
|
29
|
+
loop={loop}
|
|
30
|
+
autoPlay={autoPlay}
|
|
31
|
+
playsInline={playsInline}
|
|
32
|
+
crossOrigin={crossOrigin}
|
|
33
|
+
preload={preload}
|
|
34
|
+
/>
|
|
35
|
+
{source.poster && <MediaPosterImage slot="poster" src={source.poster} />}
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `<vimeo-video slot="media">` — Vimeo Player API wrapper as a custom
|
|
5
|
+
* element via `vimeo-video-element`. Same media-chrome integration story
|
|
6
|
+
* as the YouTube canvas.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import 'vimeo-video-element';
|
|
10
|
+
import './jsx-augmentation';
|
|
11
|
+
import { MediaPosterImage } from 'media-chrome/react';
|
|
12
|
+
import type { VimeoSource, VideoPlayerSettings } from '../types';
|
|
13
|
+
|
|
14
|
+
export interface VimeoCanvasProps extends VideoPlayerSettings {
|
|
15
|
+
readonly source: VimeoSource;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function VimeoCanvas({
|
|
19
|
+
source,
|
|
20
|
+
autoPlay,
|
|
21
|
+
muted,
|
|
22
|
+
loop,
|
|
23
|
+
}: VimeoCanvasProps) {
|
|
24
|
+
const base = `https://vimeo.com/${source.videoId}`;
|
|
25
|
+
const src = source.startTime ? `${base}#t=${source.startTime}s` : base;
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
<vimeo-video
|
|
30
|
+
slot="media"
|
|
31
|
+
src={src}
|
|
32
|
+
{...(muted && { muted: true })}
|
|
33
|
+
{...(autoPlay && { autoplay: true })}
|
|
34
|
+
{...(loop && { loop: true })}
|
|
35
|
+
playsInline
|
|
36
|
+
/>
|
|
37
|
+
{source.poster && <MediaPosterImage slot="poster" src={source.poster} />}
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `<youtube-video slot="media">` — registers the custom element via
|
|
5
|
+
* `youtube-video-element` side-effect import. The element wraps the
|
|
6
|
+
* YouTube IFrame API and exposes an `HTMLVideoElement`-shaped surface
|
|
7
|
+
* that media-chrome's `<MediaController>` drives.
|
|
8
|
+
*
|
|
9
|
+
* `youtube-video-element` already defaults the embed to `controls=0`,
|
|
10
|
+
* `rel=0`, `iv_load_policy=3`, `modestbranding=1`. We extend that via
|
|
11
|
+
* the `config` prop (serialized into `data-config`, merged into the
|
|
12
|
+
* IFrame `playerVars`) to also suppress YouTube's keyboard handling
|
|
13
|
+
* (`disablekb=1` — our controls own keyboard) and the in-player
|
|
14
|
+
* close-captions toggle the element turns on by default.
|
|
15
|
+
*
|
|
16
|
+
* NOTE: YouTube's ToS forbids fully hiding its branding — a small logo
|
|
17
|
+
* and the pause-screen overlay remain by design. `modestbranding=1` is
|
|
18
|
+
* the maximum allowed suppression.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import 'youtube-video-element';
|
|
22
|
+
import './jsx-augmentation';
|
|
23
|
+
import { MediaPosterImage } from 'media-chrome/react';
|
|
24
|
+
import type { YouTubeSource, VideoPlayerSettings } from '../types';
|
|
25
|
+
|
|
26
|
+
export interface YouTubeCanvasProps extends VideoPlayerSettings {
|
|
27
|
+
readonly source: YouTubeSource;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Extra YouTube IFrame `playerVars` merged on top of the element
|
|
32
|
+
* defaults. Keep keys YouTube-documented:
|
|
33
|
+
* https://developers.google.com/youtube/player_parameters
|
|
34
|
+
*/
|
|
35
|
+
const YT_PLAYER_VARS = {
|
|
36
|
+
// We render our own media-chrome control bar — hide YouTube's.
|
|
37
|
+
controls: 0,
|
|
38
|
+
// Our keyboard shortcuts own the player; disable YouTube's.
|
|
39
|
+
disablekb: 1,
|
|
40
|
+
// Minimise the YouTube logo chrome (max suppression allowed by ToS).
|
|
41
|
+
modestbranding: 1,
|
|
42
|
+
// Do not surface "More videos" / related-channel end-screen suggestions.
|
|
43
|
+
rel: 0,
|
|
44
|
+
// Hide video annotations.
|
|
45
|
+
iv_load_policy: 3,
|
|
46
|
+
// Keep playback inline on iOS instead of forcing native fullscreen.
|
|
47
|
+
playsinline: 1,
|
|
48
|
+
// Don't auto-load closed captions.
|
|
49
|
+
cc_load_policy: 0,
|
|
50
|
+
} as const;
|
|
51
|
+
|
|
52
|
+
export function YouTubeCanvas({
|
|
53
|
+
source,
|
|
54
|
+
autoPlay,
|
|
55
|
+
muted,
|
|
56
|
+
loop,
|
|
57
|
+
}: YouTubeCanvasProps) {
|
|
58
|
+
const params = new URLSearchParams();
|
|
59
|
+
params.set('v', source.videoId);
|
|
60
|
+
if (source.startTime) params.set('t', `${source.startTime}s`);
|
|
61
|
+
if (source.playlistId) params.set('list', source.playlistId);
|
|
62
|
+
const src = `https://www.youtube.com/watch?${params.toString()}`;
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<>
|
|
66
|
+
<youtube-video
|
|
67
|
+
slot="media"
|
|
68
|
+
src={src}
|
|
69
|
+
config={YT_PLAYER_VARS}
|
|
70
|
+
{...(muted && { muted: true })}
|
|
71
|
+
{...(autoPlay && { autoplay: true })}
|
|
72
|
+
{...(loop && { loop: true })}
|
|
73
|
+
playsInline
|
|
74
|
+
/>
|
|
75
|
+
{source.poster && <MediaPosterImage slot="poster" src={source.poster} />}
|
|
76
|
+
</>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -1,77 +1,63 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* VideoPlayer
|
|
3
|
-
*
|
|
2
|
+
* VideoPlayer — full public surface.
|
|
3
|
+
*
|
|
4
|
+
* Prefer importing through the subpath entry:
|
|
5
|
+
* `import { VideoPlayer } from '@djangocfg/ui-tools/video-player'`
|
|
6
|
+
*
|
|
7
|
+
* which routes through `lazy.tsx`. This `index.ts` is the underlying barrel.
|
|
4
8
|
*/
|
|
5
9
|
|
|
6
|
-
|
|
7
|
-
export { VideoPlayer } from './components';
|
|
10
|
+
export { VideoPlayer } from './VideoPlayer';
|
|
8
11
|
|
|
9
|
-
// Controls (can be used standalone with Vidstack)
|
|
10
|
-
export { VideoControls } from './components';
|
|
11
|
-
|
|
12
|
-
// Error Fallback
|
|
13
|
-
export {
|
|
14
|
-
VideoErrorFallback,
|
|
15
|
-
createVideoErrorFallback,
|
|
16
|
-
} from './components';
|
|
17
12
|
export type {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
VideoPlayerProps,
|
|
14
|
+
VideoPlayerSettings,
|
|
15
|
+
VideoSource,
|
|
16
|
+
UrlSource,
|
|
17
|
+
YouTubeSource,
|
|
18
|
+
VimeoSource,
|
|
19
|
+
HlsSource,
|
|
20
|
+
IframeSource,
|
|
21
|
+
AspectRatioValue,
|
|
22
|
+
} from './types';
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
+
export { parseEmbedUrl } from './utils/parse-embed-url';
|
|
25
|
+
export { extractYouTubeId, parseYouTubeStartTime } from './utils/youtube-id';
|
|
26
|
+
export { extractVimeoId } from './utils/vimeo-id';
|
|
24
27
|
|
|
25
|
-
// Context (for streaming configuration)
|
|
26
28
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
CanvasDispatcher,
|
|
30
|
+
NativeCanvas,
|
|
31
|
+
YouTubeCanvas,
|
|
32
|
+
VimeoCanvas,
|
|
33
|
+
HlsCanvas,
|
|
34
|
+
IframeCanvas,
|
|
35
|
+
} from './canvas';
|
|
33
36
|
export type {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
CanvasDispatcherProps,
|
|
38
|
+
NativeCanvasProps,
|
|
39
|
+
YouTubeCanvasProps,
|
|
40
|
+
VimeoCanvasProps,
|
|
41
|
+
HlsCanvasProps,
|
|
42
|
+
IframeCanvasProps,
|
|
43
|
+
} from './canvas';
|
|
37
44
|
|
|
38
|
-
// Utils
|
|
39
45
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
PlayButton,
|
|
47
|
+
SeekBar,
|
|
48
|
+
Volume,
|
|
49
|
+
Fullscreen,
|
|
50
|
+
Pip,
|
|
51
|
+
PlaybackRate,
|
|
52
|
+
ControlsBar,
|
|
53
|
+
Poster,
|
|
54
|
+
} from './parts';
|
|
47
55
|
export type {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
BlobSource,
|
|
57
|
-
DataUrlSource,
|
|
58
|
-
// Player types
|
|
59
|
-
PlayerMode,
|
|
60
|
-
AspectRatioValue,
|
|
61
|
-
VideoPlayerProps,
|
|
62
|
-
VideoPlayerRef,
|
|
63
|
-
ErrorFallbackProps,
|
|
64
|
-
// Provider props (internal)
|
|
65
|
-
VidstackProviderProps,
|
|
66
|
-
NativeProviderProps,
|
|
67
|
-
StreamProviderProps,
|
|
68
|
-
// Common types
|
|
69
|
-
CommonPlayerSettings,
|
|
70
|
-
CommonPlayerEvents,
|
|
71
|
-
// File source helper types
|
|
72
|
-
ResolveFileSourceOptions,
|
|
73
|
-
// Context types
|
|
74
|
-
VideoPlayerContextValue,
|
|
75
|
-
VideoPlayerProviderProps,
|
|
76
|
-
SimpleStreamSource,
|
|
77
|
-
} from './types';
|
|
56
|
+
PlayButtonProps,
|
|
57
|
+
SeekBarProps,
|
|
58
|
+
VolumeProps,
|
|
59
|
+
FullscreenProps,
|
|
60
|
+
PipProps,
|
|
61
|
+
PlaybackRateProps,
|
|
62
|
+
ControlsBarProps,
|
|
63
|
+
} from './parts';
|
|
@@ -1,63 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Subpath entry: `@djangocfg/ui-tools/video-player`.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Built on `media-chrome` web components — the React layer is ~3 KB of
|
|
7
|
+
* thin wrappers, and provider engines (`youtube-video-element`,
|
|
8
|
+
* `vimeo-video-element`, `hls-video-element`) are imported only by the
|
|
9
|
+
* matching canvas file, so unused engines are tree-shaken.
|
|
8
10
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
+
* `LazyVideoPlayer` is preserved as a synchronous alias for back-compat
|
|
12
|
+
* with existing consumers (e.g. cmdop desktop's document-preview).
|
|
11
13
|
*/
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
import type { VideoPlayerProps } from './types';
|
|
15
|
+
export * from './index';
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
// Re-export types
|
|
18
|
-
// ============================================================================
|
|
17
|
+
import { VideoPlayer } from './VideoPlayer';
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// ============================================================================
|
|
23
|
-
// Video Loading Fallback
|
|
24
|
-
// ============================================================================
|
|
25
|
-
|
|
26
|
-
function VideoLoadingFallback() {
|
|
27
|
-
return (
|
|
28
|
-
<div className="flex items-center justify-center bg-black/90 rounded-lg aspect-video">
|
|
29
|
-
<div className="flex flex-col items-center gap-2">
|
|
30
|
-
<div className="relative">
|
|
31
|
-
<div className="h-10 w-10 animate-spin rounded-full border-4 border-white/20 border-t-white" />
|
|
32
|
-
<div className="absolute inset-0 flex items-center justify-center">
|
|
33
|
-
<svg
|
|
34
|
-
className="h-5 w-5 text-white/60"
|
|
35
|
-
fill="currentColor"
|
|
36
|
-
viewBox="0 0 24 24"
|
|
37
|
-
>
|
|
38
|
-
<path d="M8 5v14l11-7z" />
|
|
39
|
-
</svg>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
<span className="text-sm text-white/60">Loading video player...</span>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// ============================================================================
|
|
49
|
-
// Lazy Component
|
|
50
|
-
// ============================================================================
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* LazyVideoPlayer - Lazy-loaded professional video player
|
|
54
|
-
*
|
|
55
|
-
* Automatically shows loading state while Vidstack loads (~150KB)
|
|
56
|
-
*/
|
|
57
|
-
export const LazyVideoPlayer = createLazyComponent<VideoPlayerProps>(
|
|
58
|
-
() => import('./components').then((mod) => ({ default: mod.VideoPlayer })),
|
|
59
|
-
{
|
|
60
|
-
displayName: 'LazyVideoPlayer',
|
|
61
|
-
fallback: <VideoLoadingFallback />,
|
|
62
|
-
}
|
|
63
|
-
);
|
|
19
|
+
/** @deprecated Use `VideoPlayer` directly — no lazy boundary is needed. */
|
|
20
|
+
export const LazyVideoPlayer = VideoPlayer;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { MediaControlBar } from 'media-chrome/react';
|
|
4
|
+
import { cn } from '@djangocfg/ui-core/lib';
|
|
5
|
+
import type { ComponentProps } from 'react';
|
|
6
|
+
|
|
7
|
+
export type ControlsBarProps = ComponentProps<typeof MediaControlBar>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Control bar pinned to the bottom over a bottom-up black scrim so the
|
|
11
|
+
* controls stay legible on any video frame. Colours read on-black
|
|
12
|
+
* regardless of theme — the video canvas is always a black surface.
|
|
13
|
+
*
|
|
14
|
+
* The bar participates in media-chrome's `autohide`: when the
|
|
15
|
+
* `<MediaController>` adds the `mediacontrolshidden` user-inactive
|
|
16
|
+
* state, we fade the whole bar (controls + scrim) out together.
|
|
17
|
+
*/
|
|
18
|
+
export function ControlsBar({ className, children, ...props }: ControlsBarProps) {
|
|
19
|
+
return (
|
|
20
|
+
<MediaControlBar
|
|
21
|
+
{...props}
|
|
22
|
+
className={cn(
|
|
23
|
+
// Layout — extra top padding gives the scrim room to fade in.
|
|
24
|
+
'video-player__control-bar',
|
|
25
|
+
'absolute inset-x-0 bottom-0 flex items-center gap-1 px-2 pb-1.5 pt-8',
|
|
26
|
+
// Bottom-up scrim so controls read over any frame.
|
|
27
|
+
'bg-gradient-to-t from-black/75 via-black/40 to-transparent',
|
|
28
|
+
'text-foreground',
|
|
29
|
+
className,
|
|
30
|
+
)}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</MediaControlBar>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { MediaFullscreenButton } from 'media-chrome/react';
|
|
4
|
+
import { cn } from '@djangocfg/ui-core/lib';
|
|
5
|
+
import type { ComponentProps } from 'react';
|
|
6
|
+
|
|
7
|
+
export type FullscreenProps = ComponentProps<typeof MediaFullscreenButton>;
|
|
8
|
+
|
|
9
|
+
export function Fullscreen({ className, ...props }: FullscreenProps) {
|
|
10
|
+
return (
|
|
11
|
+
<MediaFullscreenButton
|
|
12
|
+
{...props}
|
|
13
|
+
className={cn(
|
|
14
|
+
'media-control-square video-player__control h-8 w-8',
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { PlayButton } from './play-button';
|
|
2
|
+
export type { PlayButtonProps } from './play-button';
|
|
3
|
+
export { SeekBar } from './seek-bar';
|
|
4
|
+
export type { SeekBarProps } from './seek-bar';
|
|
5
|
+
export { Volume } from './volume';
|
|
6
|
+
export type { VolumeProps } from './volume';
|
|
7
|
+
export { Fullscreen } from './fullscreen';
|
|
8
|
+
export type { FullscreenProps } from './fullscreen';
|
|
9
|
+
export { Pip } from './pip';
|
|
10
|
+
export type { PipProps } from './pip';
|
|
11
|
+
export { PlaybackRate } from './playback-rate';
|
|
12
|
+
export type { PlaybackRateProps } from './playback-rate';
|
|
13
|
+
export { ControlsBar } from './controls-bar';
|
|
14
|
+
export type { ControlsBarProps } from './controls-bar';
|
|
15
|
+
export { Poster } from './poster';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { MediaPipButton } from 'media-chrome/react';
|
|
4
|
+
import { cn } from '@djangocfg/ui-core/lib';
|
|
5
|
+
import type { ComponentProps } from 'react';
|
|
6
|
+
|
|
7
|
+
export type PipProps = ComponentProps<typeof MediaPipButton>;
|
|
8
|
+
|
|
9
|
+
export function Pip({ className, ...props }: PipProps) {
|
|
10
|
+
return (
|
|
11
|
+
<MediaPipButton
|
|
12
|
+
{...props}
|
|
13
|
+
className={cn(
|
|
14
|
+
'media-control-square video-player__control h-8 w-8',
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { MediaPlayButton } from 'media-chrome/react';
|
|
4
|
+
import { cn } from '@djangocfg/ui-core/lib';
|
|
5
|
+
import type { ComponentProps } from 'react';
|
|
6
|
+
|
|
7
|
+
export type PlayButtonProps = ComponentProps<typeof MediaPlayButton>;
|
|
8
|
+
|
|
9
|
+
export function PlayButton({ className, ...props }: PlayButtonProps) {
|
|
10
|
+
return (
|
|
11
|
+
<MediaPlayButton
|
|
12
|
+
{...props}
|
|
13
|
+
className={cn(
|
|
14
|
+
'media-control-square video-player__control h-8 w-8',
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { MediaPlaybackRateButton } from 'media-chrome/react';
|
|
4
|
+
import { cn } from '@djangocfg/ui-core/lib';
|
|
5
|
+
import type { ComponentProps } from 'react';
|
|
6
|
+
|
|
7
|
+
export type PlaybackRateProps = Omit<
|
|
8
|
+
ComponentProps<typeof MediaPlaybackRateButton>,
|
|
9
|
+
'rates'
|
|
10
|
+
> & {
|
|
11
|
+
/** Space-separated list, e.g. `'0.5 1 1.5 2'`, or an array of numbers. */
|
|
12
|
+
readonly rates?: string | readonly number[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const DEFAULT_RATES: readonly number[] = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
|
16
|
+
|
|
17
|
+
export function PlaybackRate({ className, rates, ...props }: PlaybackRateProps) {
|
|
18
|
+
const value = rates ?? DEFAULT_RATES;
|
|
19
|
+
return (
|
|
20
|
+
<MediaPlaybackRateButton
|
|
21
|
+
{...props}
|
|
22
|
+
// media-chrome's setter accepts `string | ArrayLike<number>` — the
|
|
23
|
+
// React typing pulls from the getter only, which is narrower.
|
|
24
|
+
rates={value as unknown as ArrayLike<number>}
|
|
25
|
+
className={cn(
|
|
26
|
+
'video-player__control h-8 px-2 text-xs tabular-nums',
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { MediaTimeRange, MediaTimeDisplay } from 'media-chrome/react';
|
|
4
|
+
import { cn } from '@djangocfg/ui-core/lib';
|
|
5
|
+
import type { ComponentProps } from 'react';
|
|
6
|
+
|
|
7
|
+
export type SeekBarProps = ComponentProps<typeof MediaTimeRange> & {
|
|
8
|
+
readonly showTime?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function SeekBar({ className, showTime = true, ...props }: SeekBarProps) {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<MediaTimeRange
|
|
15
|
+
{...props}
|
|
16
|
+
className={cn('h-8 flex-1', className)}
|
|
17
|
+
/>
|
|
18
|
+
{showTime && (
|
|
19
|
+
<MediaTimeDisplay
|
|
20
|
+
showDuration
|
|
21
|
+
className="video-player__time px-2 text-xs tabular-nums"
|
|
22
|
+
/>
|
|
23
|
+
)}
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { MediaMuteButton, MediaVolumeRange } from 'media-chrome/react';
|
|
4
|
+
import { cn } from '@djangocfg/ui-core/lib';
|
|
5
|
+
import type { ComponentProps } from 'react';
|
|
6
|
+
|
|
7
|
+
export interface VolumeProps {
|
|
8
|
+
readonly className?: string;
|
|
9
|
+
readonly iconOnly?: boolean;
|
|
10
|
+
readonly muteProps?: ComponentProps<typeof MediaMuteButton>;
|
|
11
|
+
readonly rangeProps?: ComponentProps<typeof MediaVolumeRange>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function Volume({ className, iconOnly, muteProps, rangeProps }: VolumeProps) {
|
|
15
|
+
return (
|
|
16
|
+
<div className={cn('flex items-center', className)}>
|
|
17
|
+
<MediaMuteButton
|
|
18
|
+
{...muteProps}
|
|
19
|
+
className={cn(
|
|
20
|
+
'media-control-square video-player__control h-8 w-8',
|
|
21
|
+
muteProps?.className,
|
|
22
|
+
)}
|
|
23
|
+
/>
|
|
24
|
+
{!iconOnly && (
|
|
25
|
+
<MediaVolumeRange
|
|
26
|
+
{...rangeProps}
|
|
27
|
+
className={cn('h-8 w-20', rangeProps?.className)}
|
|
28
|
+
/>
|
|
29
|
+
)}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|