@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,284 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NativeProvider - Lightweight native HTML5 video player
|
|
3
|
-
* For demo videos, background videos, autoplay loop muted scenarios
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
'use client';
|
|
7
|
-
|
|
8
|
-
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { cn } from '@djangocfg/ui-core/lib';
|
|
11
|
-
import { Preloader, AspectRatio } from '@djangocfg/ui-core';
|
|
12
|
-
import { useVideoPlayerSettings } from '../hooks/useVideoPlayerSettings';
|
|
13
|
-
|
|
14
|
-
import type { NativeProviderProps, VideoPlayerRef } from '../types';
|
|
15
|
-
import { videoDebug } from '../utils/debug';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Get video URL from source
|
|
19
|
-
*/
|
|
20
|
-
function getVideoUrl(source: NativeProviderProps['source']): string {
|
|
21
|
-
switch (source.type) {
|
|
22
|
-
case 'url':
|
|
23
|
-
return source.url;
|
|
24
|
-
case 'data-url':
|
|
25
|
-
return source.data;
|
|
26
|
-
default:
|
|
27
|
-
return '';
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const NativeProvider = forwardRef<VideoPlayerRef, NativeProviderProps>(
|
|
32
|
-
(
|
|
33
|
-
{
|
|
34
|
-
source,
|
|
35
|
-
aspectRatio = 16 / 9,
|
|
36
|
-
autoPlay = true,
|
|
37
|
-
muted = true,
|
|
38
|
-
loop = true,
|
|
39
|
-
playsInline = true,
|
|
40
|
-
preload = 'auto',
|
|
41
|
-
controls = false,
|
|
42
|
-
disableContextMenu = true,
|
|
43
|
-
showPreloader = true,
|
|
44
|
-
preloaderTimeout = 5000,
|
|
45
|
-
className,
|
|
46
|
-
videoClassName,
|
|
47
|
-
onPlay,
|
|
48
|
-
onPause,
|
|
49
|
-
onEnded,
|
|
50
|
-
onError,
|
|
51
|
-
onLoadStart,
|
|
52
|
-
onCanPlay,
|
|
53
|
-
onTimeUpdate,
|
|
54
|
-
},
|
|
55
|
-
ref
|
|
56
|
-
) => {
|
|
57
|
-
const [isLoading, setIsLoading] = useState(showPreloader);
|
|
58
|
-
const videoRef = useRef<HTMLVideoElement>(null);
|
|
59
|
-
|
|
60
|
-
// Persisted player settings
|
|
61
|
-
const { settings: savedSettings, updateVolume } = useVideoPlayerSettings();
|
|
62
|
-
|
|
63
|
-
const videoUrl = getVideoUrl(source);
|
|
64
|
-
|
|
65
|
-
// Debug: Log video source
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
videoDebug.load(videoUrl, source.type);
|
|
68
|
-
}, [videoUrl, source.type]);
|
|
69
|
-
|
|
70
|
-
// Expose video element methods via ref
|
|
71
|
-
useImperativeHandle(
|
|
72
|
-
ref,
|
|
73
|
-
() => ({
|
|
74
|
-
play: () => videoRef.current?.play(),
|
|
75
|
-
pause: () => videoRef.current?.pause(),
|
|
76
|
-
togglePlay: () => {
|
|
77
|
-
const video = videoRef.current;
|
|
78
|
-
if (video) {
|
|
79
|
-
video.paused ? video.play() : video.pause();
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
seekTo: (time: number) => {
|
|
83
|
-
if (videoRef.current) videoRef.current.currentTime = time;
|
|
84
|
-
},
|
|
85
|
-
setVolume: (volume: number) => {
|
|
86
|
-
if (videoRef.current) videoRef.current.volume = Math.max(0, Math.min(1, volume));
|
|
87
|
-
},
|
|
88
|
-
toggleMute: () => {
|
|
89
|
-
if (videoRef.current) videoRef.current.muted = !videoRef.current.muted;
|
|
90
|
-
},
|
|
91
|
-
enterFullscreen: () => videoRef.current?.requestFullscreen(),
|
|
92
|
-
exitFullscreen: () => document.exitFullscreen(),
|
|
93
|
-
get currentTime() {
|
|
94
|
-
return videoRef.current?.currentTime ?? 0;
|
|
95
|
-
},
|
|
96
|
-
get duration() {
|
|
97
|
-
return videoRef.current?.duration ?? 0;
|
|
98
|
-
},
|
|
99
|
-
get paused() {
|
|
100
|
-
return videoRef.current?.paused ?? true;
|
|
101
|
-
},
|
|
102
|
-
}),
|
|
103
|
-
[]
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
useEffect(() => {
|
|
107
|
-
if (!showPreloader) return;
|
|
108
|
-
|
|
109
|
-
const video = videoRef.current;
|
|
110
|
-
if (!video) return;
|
|
111
|
-
|
|
112
|
-
// Check if video is already loaded
|
|
113
|
-
if (video.readyState >= 3) {
|
|
114
|
-
setIsLoading(false);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const hideLoader = () => setIsLoading(false);
|
|
119
|
-
|
|
120
|
-
video.addEventListener('canplay', hideLoader);
|
|
121
|
-
video.addEventListener('loadeddata', hideLoader);
|
|
122
|
-
video.addEventListener('playing', hideLoader);
|
|
123
|
-
|
|
124
|
-
// Fallback: hide loader after timeout
|
|
125
|
-
const timeout = setTimeout(hideLoader, preloaderTimeout);
|
|
126
|
-
|
|
127
|
-
return () => {
|
|
128
|
-
video.removeEventListener('canplay', hideLoader);
|
|
129
|
-
video.removeEventListener('loadeddata', hideLoader);
|
|
130
|
-
video.removeEventListener('playing', hideLoader);
|
|
131
|
-
clearTimeout(timeout);
|
|
132
|
-
};
|
|
133
|
-
}, [showPreloader, preloaderTimeout]);
|
|
134
|
-
|
|
135
|
-
// Debug: Log video events
|
|
136
|
-
useEffect(() => {
|
|
137
|
-
const video = videoRef.current;
|
|
138
|
-
if (!video) return;
|
|
139
|
-
|
|
140
|
-
const handleLoadedMetadata = () => {
|
|
141
|
-
videoDebug.state('loadedmetadata', { duration: video.duration });
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const handleCanPlayDebug = () => {
|
|
145
|
-
videoDebug.state('canplay', { duration: video.duration, buffered: video.buffered.length });
|
|
146
|
-
videoDebug.buffer(video.buffered, video.duration);
|
|
147
|
-
// Apply saved volume
|
|
148
|
-
video.volume = savedSettings.volume;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const handleSeeking = () => {
|
|
152
|
-
videoDebug.event('seeking', { currentTime: video.currentTime });
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const handleSeeked = () => {
|
|
156
|
-
videoDebug.event('seeked', { currentTime: video.currentTime });
|
|
157
|
-
videoDebug.buffer(video.buffered, video.duration);
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const handleWaiting = () => {
|
|
161
|
-
videoDebug.warn('WAITING - buffering...');
|
|
162
|
-
videoDebug.buffer(video.buffered, video.duration);
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
const handleStalled = () => {
|
|
166
|
-
videoDebug.warn('STALLED - network issue');
|
|
167
|
-
videoDebug.buffer(video.buffered, video.duration);
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
video.addEventListener('loadedmetadata', handleLoadedMetadata);
|
|
171
|
-
video.addEventListener('canplay', handleCanPlayDebug);
|
|
172
|
-
video.addEventListener('seeking', handleSeeking);
|
|
173
|
-
video.addEventListener('seeked', handleSeeked);
|
|
174
|
-
video.addEventListener('waiting', handleWaiting);
|
|
175
|
-
video.addEventListener('stalled', handleStalled);
|
|
176
|
-
|
|
177
|
-
return () => {
|
|
178
|
-
video.removeEventListener('loadedmetadata', handleLoadedMetadata);
|
|
179
|
-
video.removeEventListener('canplay', handleCanPlayDebug);
|
|
180
|
-
video.removeEventListener('seeking', handleSeeking);
|
|
181
|
-
video.removeEventListener('seeked', handleSeeked);
|
|
182
|
-
video.removeEventListener('waiting', handleWaiting);
|
|
183
|
-
video.removeEventListener('stalled', handleStalled);
|
|
184
|
-
};
|
|
185
|
-
}, [savedSettings.volume]);
|
|
186
|
-
|
|
187
|
-
// Persist volume when user changes it via native controls
|
|
188
|
-
useEffect(() => {
|
|
189
|
-
const video = videoRef.current;
|
|
190
|
-
if (!video) return;
|
|
191
|
-
|
|
192
|
-
const handleVolumeChange = () => {
|
|
193
|
-
updateVolume(video.volume);
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
video.addEventListener('volumechange', handleVolumeChange);
|
|
197
|
-
return () => video.removeEventListener('volumechange', handleVolumeChange);
|
|
198
|
-
}, [updateVolume]);
|
|
199
|
-
|
|
200
|
-
const handleContextMenu = (e: React.MouseEvent) => {
|
|
201
|
-
if (disableContextMenu) {
|
|
202
|
-
e.preventDefault();
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
const handleError = (e: React.SyntheticEvent<HTMLVideoElement>) => {
|
|
207
|
-
const video = e.currentTarget;
|
|
208
|
-
const errorMsg = video.error?.message || 'Video playback error';
|
|
209
|
-
videoDebug.error('Video error', { code: video.error?.code, message: errorMsg });
|
|
210
|
-
setIsLoading(false);
|
|
211
|
-
onError?.(errorMsg);
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
const handleTimeUpdate = () => {
|
|
215
|
-
const video = videoRef.current;
|
|
216
|
-
if (video && onTimeUpdate) {
|
|
217
|
-
onTimeUpdate(video.currentTime, video.duration);
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
// Determine if we should use AspectRatio wrapper or fill mode
|
|
222
|
-
const isFillMode = aspectRatio === 'fill';
|
|
223
|
-
const computedAspectRatio = aspectRatio === 'auto' || aspectRatio === 'fill' ? undefined : aspectRatio;
|
|
224
|
-
|
|
225
|
-
// Video content
|
|
226
|
-
const videoContent = (
|
|
227
|
-
<>
|
|
228
|
-
{/* Preloader */}
|
|
229
|
-
{showPreloader && isLoading && (
|
|
230
|
-
<div
|
|
231
|
-
className={cn(
|
|
232
|
-
'absolute inset-0 flex items-center justify-center bg-muted/30 backdrop-blur-sm z-10'
|
|
233
|
-
)}
|
|
234
|
-
>
|
|
235
|
-
<Preloader size="lg" spinnerClassName="text-white" />
|
|
236
|
-
</div>
|
|
237
|
-
)}
|
|
238
|
-
|
|
239
|
-
{/* Video */}
|
|
240
|
-
<video
|
|
241
|
-
ref={videoRef}
|
|
242
|
-
className={cn('w-full h-full object-cover', videoClassName)}
|
|
243
|
-
src={videoUrl}
|
|
244
|
-
autoPlay={autoPlay}
|
|
245
|
-
muted={muted}
|
|
246
|
-
loop={loop}
|
|
247
|
-
playsInline={playsInline}
|
|
248
|
-
preload={preload}
|
|
249
|
-
controls={controls}
|
|
250
|
-
poster={source.poster}
|
|
251
|
-
onContextMenu={handleContextMenu}
|
|
252
|
-
onLoadStart={onLoadStart}
|
|
253
|
-
onCanPlay={onCanPlay}
|
|
254
|
-
onPlay={onPlay}
|
|
255
|
-
onPause={onPause}
|
|
256
|
-
onPlaying={() => setIsLoading(false)}
|
|
257
|
-
onEnded={onEnded}
|
|
258
|
-
onError={handleError}
|
|
259
|
-
onTimeUpdate={handleTimeUpdate}
|
|
260
|
-
/>
|
|
261
|
-
</>
|
|
262
|
-
);
|
|
263
|
-
|
|
264
|
-
// Fill mode - no AspectRatio wrapper
|
|
265
|
-
if (isFillMode) {
|
|
266
|
-
return (
|
|
267
|
-
<div className={cn('relative w-full h-full overflow-hidden', className)}>
|
|
268
|
-
{videoContent}
|
|
269
|
-
</div>
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// Normal mode with AspectRatio
|
|
274
|
-
return (
|
|
275
|
-
<div className={cn('relative overflow-hidden', className)}>
|
|
276
|
-
<AspectRatio ratio={computedAspectRatio}>
|
|
277
|
-
{videoContent}
|
|
278
|
-
</AspectRatio>
|
|
279
|
-
</div>
|
|
280
|
-
);
|
|
281
|
-
}
|
|
282
|
-
);
|
|
283
|
-
|
|
284
|
-
NativeProvider.displayName = 'NativeProvider';
|