@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.
Files changed (336) hide show
  1. package/README.md +9 -11
  2. package/dist/file-icon/index.cjs +449 -61
  3. package/dist/file-icon/index.cjs.map +1 -1
  4. package/dist/file-icon/index.d.cts +56 -18
  5. package/dist/file-icon/index.d.ts +56 -18
  6. package/dist/file-icon/index.mjs +448 -62
  7. package/dist/file-icon/index.mjs.map +1 -1
  8. package/dist/tree/index.cjs +49 -22
  9. package/dist/tree/index.cjs.map +1 -1
  10. package/dist/tree/index.d.cts +9 -3
  11. package/dist/tree/index.d.ts +9 -3
  12. package/dist/tree/index.mjs +49 -22
  13. package/dist/tree/index.mjs.map +1 -1
  14. package/dist/{types-B_zhyAqR.d.cts → types-eEu8SeiQ.d.cts} +4 -0
  15. package/dist/{types-B_zhyAqR.d.ts → types-eEu8SeiQ.d.ts} +4 -0
  16. package/package.json +13 -16
  17. package/src/components/FloatingToolbar/index.tsx +37 -3
  18. package/src/lib/page-snapshot/__tests__/capture-integration.test.ts +85 -0
  19. package/src/lib/page-snapshot/__tests__/engine.test.ts +36 -0
  20. package/src/lib/page-snapshot/__tests__/redaction-integration.test.ts +99 -0
  21. package/src/lib/page-snapshot/__tests__/tokens.test.ts +17 -0
  22. package/src/lib/page-snapshot/capture/__tests__/budget.test.ts +49 -0
  23. package/src/lib/page-snapshot/capture/__tests__/chrome-filter.test.ts +47 -0
  24. package/src/lib/page-snapshot/capture/__tests__/fold.test.ts +66 -0
  25. package/src/lib/page-snapshot/capture/__tests__/scope.test.ts +74 -0
  26. package/src/lib/page-snapshot/capture/__tests__/walk.test.ts +129 -0
  27. package/src/lib/page-snapshot/capture/accessible-name.ts +73 -0
  28. package/src/lib/page-snapshot/capture/budget.ts +95 -0
  29. package/src/lib/page-snapshot/capture/chrome-filter.ts +81 -0
  30. package/src/lib/page-snapshot/capture/classify.ts +111 -0
  31. package/src/lib/page-snapshot/capture/dom-utils.ts +111 -0
  32. package/src/lib/page-snapshot/capture/fold.ts +96 -0
  33. package/src/lib/page-snapshot/capture/scope.ts +169 -0
  34. package/src/lib/page-snapshot/capture/walk.ts +250 -0
  35. package/src/lib/page-snapshot/cst/__tests__/serialize.test.ts +50 -0
  36. package/src/lib/page-snapshot/cst/directives.ts +47 -0
  37. package/src/lib/page-snapshot/cst/payload.ts +50 -0
  38. package/src/lib/page-snapshot/cst/serialize.ts +84 -0
  39. package/src/lib/page-snapshot/cst/types.ts +115 -0
  40. package/src/lib/page-snapshot/engine.ts +176 -0
  41. package/src/lib/page-snapshot/index.ts +93 -0
  42. package/src/lib/page-snapshot/react/PageSnapshotChip.tsx +72 -0
  43. package/src/lib/page-snapshot/react/PageSnapshotPreview.tsx +78 -0
  44. package/src/lib/page-snapshot/react/__tests__/PageSnapshotChip.test.tsx +54 -0
  45. package/src/lib/page-snapshot/react/__tests__/provider.test.tsx +103 -0
  46. package/src/lib/page-snapshot/react/__tests__/use-page-snapshot-toggle.test.tsx +62 -0
  47. package/src/lib/page-snapshot/react/provider.tsx +162 -0
  48. package/src/lib/page-snapshot/react/use-page-snapshot-toggle.ts +47 -0
  49. package/src/lib/page-snapshot/react/use-page-snapshot.ts +67 -0
  50. package/src/lib/page-snapshot/redaction/__tests__/audit.test.ts +25 -0
  51. package/src/lib/page-snapshot/redaction/__tests__/heuristics.test.ts +73 -0
  52. package/src/lib/page-snapshot/redaction/__tests__/luhn.test.ts +26 -0
  53. package/src/lib/page-snapshot/redaction/__tests__/patterns.test.ts +60 -0
  54. package/src/lib/page-snapshot/redaction/audit.ts +58 -0
  55. package/src/lib/page-snapshot/redaction/heuristics.ts +75 -0
  56. package/src/lib/page-snapshot/redaction/index.ts +75 -0
  57. package/src/lib/page-snapshot/redaction/luhn.ts +25 -0
  58. package/src/lib/page-snapshot/redaction/patterns.ts +111 -0
  59. package/src/lib/page-snapshot/refs/__tests__/registry.test.ts +24 -0
  60. package/src/lib/page-snapshot/refs/registry.ts +46 -0
  61. package/src/lib/page-snapshot/staleness/__tests__/hash.test.ts +34 -0
  62. package/src/lib/page-snapshot/staleness/hash.ts +20 -0
  63. package/src/lib/page-snapshot/tokens.ts +15 -0
  64. package/src/tools/AudioPlayer/context/PlayerProvider.tsx +13 -14
  65. package/src/tools/AudioPlayer/hooks/useAudioElementEvents.ts +55 -6
  66. package/src/tools/AudioPlayer/lazy.tsx +13 -27
  67. package/src/tools/AudioPlayer/parts/Meta/TimeDisplay.tsx +2 -5
  68. package/src/tools/Chat/README.md +267 -39
  69. package/src/tools/Chat/composer/Composer.tsx +471 -0
  70. package/src/tools/Chat/composer/ComposerActionBar.tsx +65 -0
  71. package/src/tools/Chat/composer/ComposerBanner.tsx +128 -0
  72. package/src/tools/Chat/composer/ComposerButton.tsx +64 -0
  73. package/src/tools/Chat/composer/ComposerFooter.tsx +90 -0
  74. package/src/tools/Chat/composer/ComposerMenuButton.tsx +62 -0
  75. package/src/tools/Chat/composer/ComposerModelPicker.tsx +104 -0
  76. package/src/tools/Chat/composer/ComposerRichTextarea.tsx +88 -0
  77. package/src/tools/Chat/composer/ComposerToolPill.tsx +95 -0
  78. package/src/tools/Chat/composer/index.ts +45 -0
  79. package/src/tools/Chat/composer/size-context.tsx +26 -0
  80. package/src/tools/Chat/composer/types.ts +143 -0
  81. package/src/tools/Chat/composer/useComposerActions.tsx +164 -0
  82. package/src/tools/Chat/context/ChatProvider.tsx +54 -3
  83. package/src/tools/Chat/core/__tests__/metadata.test.ts +69 -0
  84. package/src/tools/Chat/core/index.ts +23 -1
  85. package/src/tools/Chat/core/markdown.ts +1 -1
  86. package/src/tools/Chat/core/metadata.ts +47 -0
  87. package/src/tools/Chat/core/payload-dispatch.ts +1 -1
  88. package/src/tools/Chat/core/transport/http.ts +71 -32
  89. package/src/tools/Chat/core/transport/sse.ts +18 -10
  90. package/src/tools/Chat/highlight/HighlightOverlay.tsx +101 -0
  91. package/src/tools/Chat/highlight/README.md +103 -0
  92. package/src/tools/Chat/highlight/SpotlightCanvas.tsx +153 -0
  93. package/src/tools/Chat/highlight/__tests__/HighlightOverlay.test.tsx +112 -0
  94. package/src/tools/Chat/highlight/__tests__/resolveRef.test.ts +55 -0
  95. package/src/tools/Chat/highlight/index.ts +21 -0
  96. package/src/tools/Chat/highlight/resolveRef.ts +42 -0
  97. package/src/tools/Chat/highlight/types.ts +49 -0
  98. package/src/tools/Chat/highlight/useHighlightTargets.ts +128 -0
  99. package/src/tools/Chat/hooks/index.ts +0 -5
  100. package/src/tools/Chat/hooks/useAutoFocusOnStreamEnd.ts +28 -47
  101. package/src/tools/Chat/hooks/useChat.ts +47 -14
  102. package/src/tools/Chat/hooks/useChatComposer.ts +2 -2
  103. package/src/tools/Chat/hooks/useChatLayout.ts +1 -1
  104. package/src/tools/Chat/hooks/useStreamEndFocus.ts +54 -0
  105. package/src/tools/Chat/index.ts +25 -219
  106. package/src/tools/Chat/launcher/ChatDock.tsx +1 -1
  107. package/src/tools/Chat/launcher/ChatLauncher.tsx +1 -1
  108. package/src/tools/Chat/launcher/{ChatHeader.tsx → header/ChatHeader.tsx} +24 -11
  109. package/src/tools/Chat/launcher/{ChatHeaderActionButton.tsx → header/ChatHeaderActionButton.tsx} +34 -3
  110. package/src/tools/Chat/launcher/{ChatHeaderLanguageButton.tsx → header/ChatHeaderLanguageButton.tsx} +2 -2
  111. package/src/tools/Chat/launcher/{ChatHeaderModeToggle.tsx → header/ChatHeaderModeToggle.tsx} +1 -1
  112. package/src/tools/Chat/launcher/{ChatHeaderResetButton.tsx → header/ChatHeaderResetButton.tsx} +2 -1
  113. package/src/tools/Chat/launcher/{HeaderSlots.tsx → header/HeaderSlots.tsx} +3 -3
  114. package/src/tools/Chat/launcher/header/index.ts +26 -0
  115. package/src/tools/Chat/launcher/index.ts +3 -10
  116. package/src/tools/Chat/lazy.tsx +38 -284
  117. package/src/tools/Chat/{components → messages}/MessageBubble.tsx +58 -5
  118. package/src/tools/Chat/{components → messages}/MessageList.tsx +8 -25
  119. package/src/tools/Chat/messages/blocks/MessageBlocks.tsx +131 -0
  120. package/src/tools/Chat/messages/blocks/builtin.tsx +91 -0
  121. package/src/tools/Chat/messages/blocks/index.ts +12 -0
  122. package/src/tools/Chat/messages/blocks/registry.tsx +42 -0
  123. package/src/tools/Chat/messages/blocks/renderers/AudioBlock.tsx +20 -0
  124. package/src/tools/Chat/messages/blocks/renderers/CodeBlock.tsx +19 -0
  125. package/src/tools/Chat/messages/blocks/renderers/GalleryBlock.tsx +26 -0
  126. package/src/tools/Chat/messages/blocks/renderers/ImageBlock.tsx +27 -0
  127. package/src/tools/Chat/messages/blocks/renderers/JsonBlock.tsx +12 -0
  128. package/src/tools/Chat/messages/blocks/renderers/LottieBlock.tsx +11 -0
  129. package/src/tools/Chat/messages/blocks/renderers/MapBlock.tsx +36 -0
  130. package/src/tools/Chat/messages/blocks/renderers/MermaidBlock.tsx +11 -0
  131. package/src/tools/Chat/messages/blocks/renderers/VideoBlock.tsx +24 -0
  132. package/src/tools/Chat/messages/blocks/renderers/types.ts +8 -0
  133. package/src/tools/Chat/{components → messages}/index.ts +11 -5
  134. package/src/tools/Chat/public.ts +212 -0
  135. package/src/tools/Chat/shell/ChatRoot.tsx +326 -0
  136. package/src/tools/Chat/{components → shell}/EmptyState.tsx +4 -2
  137. package/src/tools/Chat/shell/index.ts +15 -0
  138. package/src/tools/Chat/types/block.ts +120 -0
  139. package/src/tools/Chat/types/config.ts +0 -5
  140. package/src/tools/Chat/types/index.ts +17 -0
  141. package/src/tools/Chat/types/message.ts +3 -0
  142. package/src/tools/Chat/utils/index.ts +4 -0
  143. package/src/tools/CodeEditor/README.md +4 -6
  144. package/src/tools/CodeEditor/components/DiffEditor.tsx +48 -13
  145. package/src/tools/CodeEditor/components/Editor.tsx +96 -44
  146. package/src/tools/CodeEditor/context/EditorProvider.tsx +34 -17
  147. package/src/tools/CodeEditor/hooks/useEditorTheme.ts +92 -99
  148. package/src/tools/CodeEditor/hooks/useMonaco.ts +37 -22
  149. package/src/tools/CodeEditor/lazy.tsx +6 -0
  150. package/src/tools/CodeEditor/lib/index.ts +1 -1
  151. package/src/tools/CodeEditor/lib/themes.ts +3 -39
  152. package/src/tools/CronScheduler/CronScheduler.client.tsx +230 -61
  153. package/src/tools/CronScheduler/components/CustomInput.tsx +21 -4
  154. package/src/tools/CronScheduler/components/DayChips.tsx +13 -11
  155. package/src/tools/CronScheduler/components/MonthDayGrid.tsx +4 -4
  156. package/src/tools/CronScheduler/components/SchedulePreview.tsx +7 -3
  157. package/src/tools/CronScheduler/components/TimeSelector.tsx +1 -1
  158. package/src/tools/CronScheduler/index.tsx +1 -1
  159. package/src/tools/CronScheduler/types/index.ts +8 -3
  160. package/src/tools/CronScheduler/utils/cron-humanize.ts +61 -16
  161. package/src/tools/CronScheduler/utils/cron-parser.ts +13 -4
  162. package/src/tools/FileIcon/FileIcon.tsx +24 -39
  163. package/src/tools/FileIcon/get-file-icon.ts +73 -0
  164. package/src/tools/FileIcon/icons/icon-data.ts +399 -0
  165. package/src/tools/FileIcon/index.ts +4 -0
  166. package/src/tools/FileIcon/loader.ts +17 -35
  167. package/src/tools/FileIcon/specialFolders.ts +18 -0
  168. package/src/tools/Gallery/components/lightbox/GalleryLightbox.tsx +112 -35
  169. package/src/tools/Gallery/components/media/GalleryVideo.tsx +21 -2
  170. package/src/tools/Gallery/components/preview/GalleryCarousel.tsx +11 -1
  171. package/src/tools/Gallery/hooks/usePreloadImages.ts +54 -7
  172. package/src/tools/ImageViewer/components/ImageInfo.tsx +12 -1
  173. package/src/tools/ImageViewer/components/ImageToolbar.tsx +51 -43
  174. package/src/tools/ImageViewer/components/ImageViewer.tsx +106 -26
  175. package/src/tools/ImageViewer/hooks/useImageLoading.ts +13 -0
  176. package/src/tools/ImageViewer/utils/constants.ts +3 -0
  177. package/src/tools/ImageViewer/utils/index.ts +1 -0
  178. package/src/tools/JsonForm/JsonSchemaForm.tsx +4 -1
  179. package/src/tools/JsonForm/templates/ArrayFieldTemplate.tsx +5 -3
  180. package/src/tools/JsonForm/templates/BaseInputTemplate.tsx +7 -4
  181. package/src/tools/JsonForm/templates/ErrorListTemplate.tsx +3 -1
  182. package/src/tools/JsonForm/templates/ObjectFieldTemplate.tsx +23 -3
  183. package/src/tools/JsonForm/widgets/ColorWidget.tsx +20 -12
  184. package/src/tools/JsonForm/widgets/NumberWidget.tsx +14 -9
  185. package/src/tools/JsonForm/widgets/RadioWidget.tsx +78 -0
  186. package/src/tools/JsonForm/widgets/SelectWidget.tsx +1 -0
  187. package/src/tools/JsonForm/widgets/SliderWidget.tsx +7 -4
  188. package/src/tools/JsonForm/widgets/TextWidget.tsx +41 -17
  189. package/src/tools/JsonForm/widgets/index.ts +1 -0
  190. package/src/tools/JsonTree/components/JsonContent.tsx +115 -40
  191. package/src/tools/LottiePlayer/LottiePlayer.client.tsx +177 -72
  192. package/src/tools/LottiePlayer/index.tsx +14 -4
  193. package/src/tools/LottiePlayer/lazy.tsx +11 -3
  194. package/src/tools/LottiePlayer/types.ts +31 -1
  195. package/src/tools/LottiePlayer/useLottie.ts +32 -9
  196. package/src/tools/LottiePlayer/usePrefersReducedMotion.ts +46 -0
  197. package/src/tools/Map/components/LayerSwitcher.tsx +54 -21
  198. package/src/tools/Map/components/MapCluster.tsx +28 -21
  199. package/src/tools/Map/components/MapContainer.tsx +11 -4
  200. package/src/tools/Map/components/MapLegend.tsx +46 -15
  201. package/src/tools/Map/components/MapMarker.tsx +31 -2
  202. package/src/tools/Map/hooks/useMapEvents.ts +64 -105
  203. package/src/tools/MarkdownEditor/MarkdownEditor.tsx +61 -6
  204. package/src/tools/MarkdownEditor/MentionList.tsx +37 -4
  205. package/src/tools/MarkdownEditor/createMentionSuggestion.ts +11 -0
  206. package/src/tools/MarkdownEditor/lazy.tsx +32 -7
  207. package/src/tools/MarkdownEditor/styles.css +13 -0
  208. package/src/tools/MarkdownMessage/CodeBlock.tsx +40 -17
  209. package/src/tools/MarkdownMessage/MarkdownMessage.tsx +26 -6
  210. package/src/tools/MarkdownMessage/components.tsx +22 -9
  211. package/src/tools/MarkdownMessage/types.ts +24 -1
  212. package/src/tools/Mermaid/Mermaid.client.tsx +27 -5
  213. package/src/tools/Mermaid/components/MermaidErrorPanel.tsx +31 -0
  214. package/src/tools/Mermaid/components/MermaidFullscreenModal.tsx +14 -17
  215. package/src/tools/Mermaid/hooks/useMermaidRenderer.ts +264 -168
  216. package/src/tools/Mermaid/hooks/useMermaidValidation.ts +76 -10
  217. package/src/tools/Mermaid/index.tsx +6 -0
  218. package/src/tools/Mermaid/utils/mermaid-helpers.ts +141 -18
  219. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/SchemaFields/FieldRow.tsx +11 -1
  220. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/SchemaFields/buildTree.ts +49 -20
  221. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/index.tsx +7 -0
  222. package/src/tools/OpenapiViewer/components/DocsLayout/grouping.ts +7 -4
  223. package/src/tools/OpenapiViewer/constants.ts +3 -0
  224. package/src/tools/OpenapiViewer/hooks/useOpenApiSchema.ts +73 -11
  225. package/src/tools/OpenapiViewer/utils/schemaExport.ts +26 -6
  226. package/src/tools/PrettyCode/PrettyCode.client.tsx +23 -16
  227. package/src/tools/PrettyCode/lazy.tsx +1 -1
  228. package/src/tools/SpeechRecognition/README.md +1 -1
  229. package/src/tools/SpeechRecognition/__tests__/language.test.ts +9 -3
  230. package/src/tools/SpeechRecognition/components/RecordingPulse.tsx +59 -0
  231. package/src/tools/SpeechRecognition/components/index.ts +2 -0
  232. package/src/tools/SpeechRecognition/core/engine/external.ts +24 -7
  233. package/src/tools/SpeechRecognition/core/language.ts +23 -6
  234. package/src/tools/SpeechRecognition/hooks/usePushToTalk.ts +36 -5
  235. package/src/tools/SpeechRecognition/hooks/useSpeechRecognition.ts +18 -11
  236. package/src/tools/SpeechRecognition/widgets/VoiceComposerSlot.tsx +94 -26
  237. package/src/tools/SpeechRecognition/widgets/index.ts +1 -1
  238. package/src/tools/Tree/README.md +4 -8
  239. package/src/tools/Tree/TreeRoot.tsx +22 -10
  240. package/src/tools/Tree/components/TreeContent.tsx +24 -4
  241. package/src/tools/Tree/components/TreeLabel.tsx +8 -2
  242. package/src/tools/Tree/components/TreeRow.tsx +16 -6
  243. package/src/tools/Tree/data/flatten.ts +10 -4
  244. package/src/tools/Tree/types.ts +4 -0
  245. package/src/tools/Uploader/components/UploadAddButton.tsx +29 -6
  246. package/src/tools/Uploader/components/UploadDropzone.tsx +63 -7
  247. package/src/tools/Uploader/components/UploadPageDropOverlay.tsx +19 -5
  248. package/src/tools/Uploader/components/UploadPreviewItem.tsx +47 -17
  249. package/src/tools/Uploader/components/UploadPreviewList.tsx +24 -12
  250. package/src/tools/Uploader/utils/formatters.ts +8 -3
  251. package/src/tools/VideoPlayer/README.md +87 -230
  252. package/src/tools/VideoPlayer/VideoPlayer.tsx +82 -0
  253. package/src/tools/VideoPlayer/canvas/canvas-dispatcher.tsx +34 -0
  254. package/src/tools/VideoPlayer/canvas/hls-canvas.tsx +39 -0
  255. package/src/tools/VideoPlayer/canvas/iframe-canvas.tsx +33 -0
  256. package/src/tools/VideoPlayer/canvas/index.ts +12 -0
  257. package/src/tools/VideoPlayer/canvas/jsx-augmentation.ts +47 -0
  258. package/src/tools/VideoPlayer/canvas/native-canvas.tsx +38 -0
  259. package/src/tools/VideoPlayer/canvas/vimeo-canvas.tsx +40 -0
  260. package/src/tools/VideoPlayer/canvas/youtube-canvas.tsx +78 -0
  261. package/src/tools/VideoPlayer/index.ts +51 -65
  262. package/src/tools/VideoPlayer/lazy.tsx +11 -54
  263. package/src/tools/VideoPlayer/parts/controls-bar.tsx +35 -0
  264. package/src/tools/VideoPlayer/parts/fullscreen.tsx +19 -0
  265. package/src/tools/VideoPlayer/parts/index.ts +15 -0
  266. package/src/tools/VideoPlayer/parts/pip.tsx +19 -0
  267. package/src/tools/VideoPlayer/parts/play-button.tsx +19 -0
  268. package/src/tools/VideoPlayer/parts/playback-rate.tsx +31 -0
  269. package/src/tools/VideoPlayer/parts/poster.tsx +3 -0
  270. package/src/tools/VideoPlayer/parts/seek-bar.tsx +26 -0
  271. package/src/tools/VideoPlayer/parts/volume.tsx +32 -0
  272. package/src/tools/VideoPlayer/styles/video-player.css +141 -0
  273. package/src/tools/VideoPlayer/types.ts +82 -0
  274. package/src/tools/VideoPlayer/utils/parse-embed-url.ts +70 -0
  275. package/src/tools/VideoPlayer/utils/vimeo-id.ts +24 -0
  276. package/src/tools/VideoPlayer/utils/youtube-id.ts +64 -0
  277. package/src/tools/index.ts +37 -29
  278. package/src/tools/Chat/components/AudioToggle.tsx +0 -78
  279. package/src/tools/Chat/components/ChatRoot.tsx +0 -305
  280. package/src/tools/Chat/components/Composer.tsx +0 -216
  281. package/src/tools/Chat/hooks/useChatScroll.ts +0 -145
  282. package/src/tools/Chat/types.ts +0 -9
  283. package/src/tools/JsonTree/components/JsonToolbar.tsx +0 -95
  284. package/src/tools/JsonTree/hooks/useElementCorner.ts +0 -84
  285. package/src/tools/JsonTree/hooks/useNavbarHeight.ts +0 -83
  286. package/src/tools/OpenapiViewer/components/DocsLayout/schemaFields.ts +0 -121
  287. package/src/tools/Tour/README.md +0 -373
  288. package/src/tools/Tour/components/Tour.tsx +0 -12
  289. package/src/tools/Tour/components/TourContent.tsx +0 -171
  290. package/src/tools/Tour/components/TourNavigation.tsx +0 -77
  291. package/src/tools/Tour/components/TourProgress.tsx +0 -88
  292. package/src/tools/Tour/components/TourSpotlight.tsx +0 -199
  293. package/src/tools/Tour/components/index.ts +0 -5
  294. package/src/tools/Tour/context/TourContext.ts +0 -19
  295. package/src/tools/Tour/context/TourProvider.tsx +0 -292
  296. package/src/tools/Tour/context/index.ts +0 -2
  297. package/src/tools/Tour/hooks/index.ts +0 -3
  298. package/src/tools/Tour/hooks/useKeyboardNavigation.ts +0 -59
  299. package/src/tools/Tour/hooks/useStepTarget.ts +0 -121
  300. package/src/tools/Tour/hooks/useTour.ts +0 -42
  301. package/src/tools/Tour/index.ts +0 -38
  302. package/src/tools/Tour/types/index.ts +0 -224
  303. package/src/tools/Tour/utils/dom.ts +0 -98
  304. package/src/tools/Tour/utils/index.ts +0 -3
  305. package/src/tools/Tour/utils/logger.ts +0 -3
  306. package/src/tools/Tour/utils/scrollIntoView.ts +0 -24
  307. package/src/tools/VideoPlayer/components/VideoControls.tsx +0 -138
  308. package/src/tools/VideoPlayer/components/VideoErrorFallback.tsx +0 -172
  309. package/src/tools/VideoPlayer/components/VideoPlayer.tsx +0 -201
  310. package/src/tools/VideoPlayer/components/index.ts +0 -14
  311. package/src/tools/VideoPlayer/context/VideoPlayerContext.tsx +0 -52
  312. package/src/tools/VideoPlayer/context/index.ts +0 -8
  313. package/src/tools/VideoPlayer/hooks/index.ts +0 -12
  314. package/src/tools/VideoPlayer/hooks/useVideoPlayerSettings.ts +0 -71
  315. package/src/tools/VideoPlayer/hooks/useVideoPositionCache.ts +0 -117
  316. package/src/tools/VideoPlayer/providers/NativeProvider.tsx +0 -284
  317. package/src/tools/VideoPlayer/providers/StreamProvider.tsx +0 -505
  318. package/src/tools/VideoPlayer/providers/VidstackProvider.tsx +0 -397
  319. package/src/tools/VideoPlayer/providers/index.ts +0 -8
  320. package/src/tools/VideoPlayer/types/index.ts +0 -38
  321. package/src/tools/VideoPlayer/types/player.ts +0 -116
  322. package/src/tools/VideoPlayer/types/provider.ts +0 -93
  323. package/src/tools/VideoPlayer/types/sources.ts +0 -97
  324. package/src/tools/VideoPlayer/utils/debug.ts +0 -14
  325. package/src/tools/VideoPlayer/utils/fileSource.ts +0 -78
  326. package/src/tools/VideoPlayer/utils/index.ts +0 -12
  327. package/src/tools/VideoPlayer/utils/resolvers.ts +0 -75
  328. /package/src/tools/Chat/{config.ts → constants.ts} +0 -0
  329. /package/src/tools/Chat/launcher/{ChatHeaderAudioToggle.tsx → header/ChatHeaderAudioToggle.tsx} +0 -0
  330. /package/src/tools/Chat/{components → messages}/Attachments.tsx +0 -0
  331. /package/src/tools/Chat/{components → messages}/JumpToLatest.tsx +0 -0
  332. /package/src/tools/Chat/{components → messages}/MessageActions.tsx +0 -0
  333. /package/src/tools/Chat/{components → messages}/Sources.tsx +0 -0
  334. /package/src/tools/Chat/{components → messages}/StreamingIndicator.tsx +0 -0
  335. /package/src/tools/Chat/{components → messages}/ToolCalls.tsx +0 -0
  336. /package/src/tools/Chat/{components → shell}/ErrorBanner.tsx +0 -0
@@ -1,172 +0,0 @@
1
- /**
2
- * VideoErrorFallback - Pre-built error fallback with download button
3
- * For use with VideoPlayer errorFallback prop
4
- */
5
-
6
- 'use client';
7
-
8
- import React from 'react';
9
- import { FileVideo, RefreshCw } from 'lucide-react';
10
-
11
- import { cn, Button, DownloadButton } from '../../_shared';
12
-
13
- import type { ErrorFallbackProps } from '../types';
14
-
15
- // ============================================================================
16
- // Types
17
- // ============================================================================
18
-
19
- export interface VideoErrorFallbackProps extends ErrorFallbackProps {
20
- /** URL for download button (if provided, shows download button) */
21
- downloadUrl?: string;
22
- /** Filename for download */
23
- downloadFilename?: string;
24
- /** File size to display */
25
- fileSize?: string;
26
- /** Show retry button */
27
- showRetry?: boolean;
28
- /** Custom className */
29
- className?: string;
30
- /** Custom icon */
31
- icon?: React.ReactNode;
32
- /** Custom title (defaults to error message) */
33
- title?: string;
34
- /** Custom description */
35
- description?: string;
36
- }
37
-
38
- // ============================================================================
39
- // Component
40
- // ============================================================================
41
-
42
- /**
43
- * Pre-built error fallback component for VideoPlayer
44
- *
45
- * @example
46
- * // Basic usage
47
- * <VideoPlayer
48
- * source={source}
49
- * errorFallback={(props) => (
50
- * <VideoErrorFallback
51
- * {...props}
52
- * downloadUrl={getDownloadUrl()}
53
- * downloadFilename="video.mp4"
54
- * />
55
- * )}
56
- * />
57
- *
58
- * @example
59
- * // With file size
60
- * <VideoErrorFallback
61
- * error="Failed to load video"
62
- * downloadUrl="/api/download/video.mp4"
63
- * fileSize="125 MB"
64
- * showRetry
65
- * retry={() => reloadVideo()}
66
- * />
67
- */
68
- export function VideoErrorFallback({
69
- error,
70
- retry,
71
- downloadUrl,
72
- downloadFilename,
73
- fileSize,
74
- showRetry = true,
75
- className,
76
- icon,
77
- title,
78
- description,
79
- }: VideoErrorFallbackProps) {
80
- const displayTitle = title || error || 'Video cannot be previewed';
81
-
82
- return (
83
- <div
84
- className={cn(
85
- 'absolute inset-0 flex flex-col items-center justify-center gap-4 bg-black/90 text-white p-6',
86
- className
87
- )}
88
- >
89
- {/* Icon */}
90
- {icon || <FileVideo className="w-16 h-16 text-muted-foreground" />}
91
-
92
- {/* Title */}
93
- <p className="text-lg font-medium text-center">{displayTitle}</p>
94
-
95
- {/* Description / File size */}
96
- {(description || fileSize) && (
97
- <p className="text-sm text-muted-foreground text-center">
98
- {description || fileSize}
99
- </p>
100
- )}
101
-
102
- {/* Actions */}
103
- <div className="flex items-center gap-3 mt-2">
104
- {/* Retry button */}
105
- {showRetry && retry && (
106
- <Button
107
- variant="outline"
108
- size="sm"
109
- onClick={retry}
110
- className="gap-2"
111
- >
112
- <RefreshCw className="w-4 h-4" />
113
- Retry
114
- </Button>
115
- )}
116
-
117
- {/* Download button */}
118
- {downloadUrl && (
119
- <DownloadButton
120
- url={downloadUrl}
121
- filename={downloadFilename}
122
- variant="default"
123
- size="sm"
124
- >
125
- Download to view
126
- </DownloadButton>
127
- )}
128
- </div>
129
- </div>
130
- );
131
- }
132
-
133
- // ============================================================================
134
- // Factory for common use cases
135
- // ============================================================================
136
-
137
- export interface CreateVideoErrorFallbackOptions {
138
- /** Function to get download URL from source */
139
- getDownloadUrl?: (source: unknown) => string | undefined;
140
- /** Function to get filename from source */
141
- getFilename?: (source: unknown) => string | undefined;
142
- /** Function to get file size from source */
143
- getFileSize?: (source: unknown) => string | undefined;
144
- /** Show retry button */
145
- showRetry?: boolean;
146
- }
147
-
148
- /**
149
- * Factory to create error fallback function for VideoPlayer
150
- *
151
- * @example
152
- * const errorFallback = createVideoErrorFallback({
153
- * getDownloadUrl: (source) => source.downloadUrl,
154
- * getFilename: (source) => source.filename,
155
- * showRetry: true,
156
- * });
157
- *
158
- * <VideoPlayer source={source} errorFallback={errorFallback} />
159
- */
160
- export function createVideoErrorFallback(
161
- options: CreateVideoErrorFallbackOptions
162
- ): (props: ErrorFallbackProps, source?: unknown) => React.ReactNode {
163
- return (props: ErrorFallbackProps, source?: unknown) => (
164
- <VideoErrorFallback
165
- {...props}
166
- downloadUrl={options.getDownloadUrl?.(source)}
167
- downloadFilename={options.getFilename?.(source)}
168
- fileSize={options.getFileSize?.(source)}
169
- showRetry={options.showRetry}
170
- />
171
- );
172
- }
@@ -1,201 +0,0 @@
1
- /**
2
- * VideoPlayer - Unified Video Player Component
3
- *
4
- * Supports multiple modes:
5
- * - vidstack: Full-featured player (YouTube, Vimeo, HLS, DASH)
6
- * - native: Lightweight HTML5 player
7
- * - streaming: HTTP Range streaming with auth / Blob sources
8
- *
9
- * @example
10
- * // YouTube video
11
- * <VideoPlayer source={{ type: 'youtube', id: 'dQw4w9WgXcQ' }} />
12
- *
13
- * @example
14
- * // HLS stream
15
- * <VideoPlayer source={{ type: 'hls', url: 'https://example.com/video.m3u8' }} />
16
- *
17
- * @example
18
- * // HTTP Range streaming with auth (full source)
19
- * <VideoPlayer
20
- * source={{
21
- * type: 'stream',
22
- * sessionId: 'abc123',
23
- * path: '/videos/movie.mp4',
24
- * getStreamUrl: (id, path) => `/api/stream/${id}?path=${path}&token=${token}`
25
- * }}
26
- * />
27
- *
28
- * @example
29
- * // HTTP Range streaming (simplified, using VideoPlayerProvider context)
30
- * <VideoPlayerProvider sessionId={sessionId} getStreamUrl={getStreamUrl}>
31
- * <VideoPlayer source={{ type: 'stream', path: '/videos/movie.mp4' }} />
32
- * </VideoPlayerProvider>
33
- *
34
- * @example
35
- * // Blob/ArrayBuffer
36
- * <VideoPlayer source={{ type: 'blob', data: arrayBuffer, mimeType: 'video/mp4' }} />
37
- */
38
-
39
- 'use client';
40
-
41
- import React, { forwardRef, useMemo } from 'react';
42
-
43
- import { VidstackProvider, NativeProvider, StreamProvider } from '../providers';
44
- import { useVideoPlayerContext } from '../context';
45
- import { resolvePlayerMode, isSimpleStreamSource, resolveStreamSource } from '../utils';
46
-
47
- import type { VideoPlayerProps, VideoPlayerRef, VideoSourceUnion, VidstackProviderProps, NativeProviderProps, StreamProviderProps, SimpleStreamSource } from '../types';
48
-
49
- export const VideoPlayer = forwardRef<VideoPlayerRef, VideoPlayerProps & { source: VideoSourceUnion | SimpleStreamSource }>(
50
- (
51
- {
52
- source: rawSource,
53
- mode = 'auto',
54
- aspectRatio = 16 / 9,
55
- autoPlay = false,
56
- muted = false,
57
- loop = false,
58
- playsInline = true,
59
- controls = true,
60
- preload = 'metadata',
61
- theme = 'default',
62
- showInfo = false,
63
- className,
64
- videoClassName,
65
- disableContextMenu = false,
66
- showPreloader = true,
67
- preloaderTimeout = 5000,
68
- errorFallback,
69
- onPlay,
70
- onPause,
71
- onEnded,
72
- onError,
73
- onLoadStart,
74
- onCanPlay,
75
- onTimeUpdate,
76
- },
77
- ref
78
- ) => {
79
- // Get context for simplified stream sources
80
- const context = useVideoPlayerContext();
81
-
82
- // Resolve simplified stream source to full source using context
83
- const source = useMemo(() => {
84
- if (isSimpleStreamSource(rawSource)) {
85
- const resolved = resolveStreamSource(rawSource, context);
86
- if (!resolved) {
87
- // Return a special error source that will trigger error fallback
88
- return null;
89
- }
90
- return resolved;
91
- }
92
- return rawSource;
93
- }, [rawSource, context]);
94
-
95
- // Handle unresolved source
96
- if (!source) {
97
- // Render error state
98
- const errorMessage = 'Stream source requires VideoPlayerProvider with getStreamUrl and sessionId';
99
-
100
- if (typeof errorFallback === 'function') {
101
- return (
102
- <div className={className} style={{ aspectRatio: aspectRatio === 'fill' ? undefined : aspectRatio }}>
103
- {errorFallback({ error: errorMessage })}
104
- </div>
105
- );
106
- }
107
-
108
- if (errorFallback) {
109
- return (
110
- <div className={className} style={{ aspectRatio: aspectRatio === 'fill' ? undefined : aspectRatio }}>
111
- {errorFallback}
112
- </div>
113
- );
114
- }
115
-
116
- // Default error UI
117
- return (
118
- <div
119
- className={className}
120
- style={{
121
- aspectRatio: aspectRatio === 'fill' ? undefined : aspectRatio,
122
- display: 'flex',
123
- alignItems: 'center',
124
- justifyContent: 'center',
125
- backgroundColor: 'black',
126
- color: 'white',
127
- }}
128
- >
129
- <p>{errorMessage}</p>
130
- </div>
131
- );
132
- }
133
-
134
- // Determine which provider to use
135
- const resolvedMode = resolvePlayerMode(source, mode);
136
-
137
- // Common props for all providers
138
- const commonProps = {
139
- aspectRatio,
140
- autoPlay,
141
- muted,
142
- loop,
143
- playsInline,
144
- controls,
145
- preload,
146
- className,
147
- onPlay,
148
- onPause,
149
- onEnded,
150
- onError,
151
- onLoadStart,
152
- onCanPlay,
153
- onTimeUpdate,
154
- };
155
-
156
- // Render appropriate provider
157
- switch (resolvedMode) {
158
- case 'vidstack':
159
- return (
160
- <VidstackProvider
161
- ref={ref}
162
- source={source as VidstackProviderProps['source']}
163
- theme={theme}
164
- showInfo={showInfo}
165
- errorFallback={errorFallback}
166
- {...commonProps}
167
- />
168
- );
169
-
170
- case 'streaming':
171
- return (
172
- <StreamProvider
173
- ref={ref}
174
- source={source as StreamProviderProps['source']}
175
- videoClassName={videoClassName}
176
- disableContextMenu={disableContextMenu}
177
- showPreloader={showPreloader}
178
- preloaderTimeout={preloaderTimeout}
179
- errorFallback={errorFallback}
180
- {...commonProps}
181
- />
182
- );
183
-
184
- case 'native':
185
- default:
186
- return (
187
- <NativeProvider
188
- ref={ref}
189
- source={source as NativeProviderProps['source']}
190
- videoClassName={videoClassName}
191
- disableContextMenu={disableContextMenu}
192
- showPreloader={showPreloader}
193
- preloaderTimeout={preloaderTimeout}
194
- {...commonProps}
195
- />
196
- );
197
- }
198
- }
199
- );
200
-
201
- VideoPlayer.displayName = 'VideoPlayer';
@@ -1,14 +0,0 @@
1
- /**
2
- * VideoPlayer components - Public API
3
- */
4
-
5
- export { VideoPlayer } from './VideoPlayer';
6
- export { VideoControls } from './VideoControls';
7
- export {
8
- VideoErrorFallback,
9
- createVideoErrorFallback,
10
- } from './VideoErrorFallback';
11
- export type {
12
- VideoErrorFallbackProps,
13
- CreateVideoErrorFallbackOptions,
14
- } from './VideoErrorFallback';
@@ -1,52 +0,0 @@
1
- /**
2
- * VideoPlayerContext - Context for streaming configuration
3
- * Simplifies streaming API by providing getStreamUrl globally
4
- */
5
-
6
- 'use client';
7
-
8
- import React, { createContext, useContext, useMemo } from 'react';
9
-
10
- import type { VideoPlayerContextValue, VideoPlayerProviderProps } from '../types';
11
-
12
- // =============================================================================
13
- // Context
14
- // =============================================================================
15
-
16
- const VideoPlayerContext = createContext<VideoPlayerContextValue | null>(null);
17
-
18
- /**
19
- * Provider for VideoPlayer streaming configuration
20
- *
21
- * @example
22
- * // In your app layout or FileWorkspace
23
- * <VideoPlayerProvider
24
- * sessionId={sessionId}
25
- * getStreamUrl={terminalClient.terminal_media.streamStreamRetrieveUrl}
26
- * >
27
- * <VideoPlayer source={{ type: 'stream', path: '/video.mp4' }} />
28
- * </VideoPlayerProvider>
29
- */
30
- export function VideoPlayerProvider({
31
- children,
32
- getStreamUrl,
33
- sessionId,
34
- }: VideoPlayerProviderProps) {
35
- const value = useMemo(
36
- () => ({ getStreamUrl, sessionId }),
37
- [getStreamUrl, sessionId]
38
- );
39
-
40
- return (
41
- <VideoPlayerContext.Provider value={value}>
42
- {children}
43
- </VideoPlayerContext.Provider>
44
- );
45
- }
46
-
47
- /**
48
- * Hook to access VideoPlayer context
49
- */
50
- export function useVideoPlayerContext(): VideoPlayerContextValue | null {
51
- return useContext(VideoPlayerContext);
52
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * VideoPlayer context - Public API
3
- */
4
-
5
- export {
6
- VideoPlayerProvider,
7
- useVideoPlayerContext,
8
- } from './VideoPlayerContext';
@@ -1,12 +0,0 @@
1
- /**
2
- * VideoPlayer hooks - Public API
3
- */
4
-
5
- export { useVideoPositionCache } from './useVideoPositionCache';
6
- export type {
7
- UseVideoPositionCacheOptions,
8
- UseVideoPositionCacheReturn,
9
- } from './useVideoPositionCache';
10
-
11
- export { useVideoPlayerSettings } from './useVideoPlayerSettings';
12
- export type { VideoPlayerSettingsReturn } from './useVideoPlayerSettings';
@@ -1,71 +0,0 @@
1
- 'use client';
2
-
3
- /**
4
- * useVideoPlayerSettings - Hook for persisted video player settings
5
- *
6
- * Provides volume and loop settings that persist in localStorage.
7
- * Use this hook in video player providers to apply saved settings.
8
- *
9
- * @example
10
- * const { settings, updateVolume, updateLoop } = useVideoPlayerSettings();
11
- *
12
- * // Apply to video element
13
- * videoRef.current.volume = settings.volume;
14
- * videoRef.current.loop = settings.isLooping;
15
- *
16
- * // Save when user changes
17
- * const handleVolumeChange = (vol: number) => {
18
- * videoRef.current.volume = vol;
19
- * updateVolume(vol);
20
- * };
21
- */
22
-
23
- import { useCallback } from 'react';
24
-
25
- import { useVideoPlayerSettings as useSettings } from '../../../stores/mediaCache';
26
-
27
- export interface VideoPlayerSettingsReturn {
28
- /** Current settings */
29
- settings: {
30
- volume: number;
31
- isLooping: boolean;
32
- };
33
- /** Update volume (0-1) */
34
- updateVolume: (volume: number) => void;
35
- /** Update loop setting */
36
- updateLoop: (isLooping: boolean) => void;
37
- /** Update multiple settings at once */
38
- updateSettings: (settings: { volume?: number; isLooping?: boolean }) => void;
39
- }
40
-
41
- export function useVideoPlayerSettings(): VideoPlayerSettingsReturn {
42
- const { settings, saveSettings } = useSettings();
43
-
44
- const updateVolume = useCallback(
45
- (volume: number) => {
46
- saveSettings({ volume: Math.max(0, Math.min(1, volume)) });
47
- },
48
- [saveSettings]
49
- );
50
-
51
- const updateLoop = useCallback(
52
- (isLooping: boolean) => {
53
- saveSettings({ isLooping });
54
- },
55
- [saveSettings]
56
- );
57
-
58
- const updateSettings = useCallback(
59
- (newSettings: { volume?: number; isLooping?: boolean }) => {
60
- saveSettings(newSettings);
61
- },
62
- [saveSettings]
63
- );
64
-
65
- return {
66
- settings,
67
- updateVolume,
68
- updateLoop,
69
- updateSettings,
70
- };
71
- }
@@ -1,117 +0,0 @@
1
- 'use client';
2
-
3
- /**
4
- * useVideoPositionCache - Manages video playback position caching
5
- *
6
- * Saves position periodically during playback and restores on load.
7
- */
8
-
9
- import { useCallback, useEffect, useRef } from 'react';
10
-
11
- import { useMediaCacheStore } from '../../../stores/mediaCache';
12
-
13
- // =============================================================================
14
- // TYPES
15
- // =============================================================================
16
-
17
- export interface UseVideoPositionCacheOptions {
18
- /** Unique key for caching (e.g., video URL or stream key) */
19
- cacheKey: string | null;
20
- /** Current playback time in seconds */
21
- currentTime: number;
22
- /** Video duration in seconds */
23
- duration: number;
24
- /** Whether video is currently playing */
25
- isPlaying: boolean;
26
- /** Whether video is ready to play */
27
- isReady: boolean;
28
- /** Callback to seek to a specific time */
29
- onSeek: (time: number) => void;
30
- }
31
-
32
- export interface UseVideoPositionCacheReturn {
33
- /** Manually save current position */
34
- savePosition: () => void;
35
- /** Clear saved position */
36
- clearPosition: () => void;
37
- }
38
-
39
- // =============================================================================
40
- // CONSTANTS
41
- // =============================================================================
42
-
43
- /** Save interval in seconds */
44
- const SAVE_INTERVAL = 5;
45
-
46
- /** Minimum offset from end to restore (avoid restoring at the very end) */
47
- const END_BUFFER = 1;
48
-
49
- // =============================================================================
50
- // HOOK
51
- // =============================================================================
52
-
53
- export function useVideoPositionCache(
54
- options: UseVideoPositionCacheOptions
55
- ): UseVideoPositionCacheReturn {
56
- const { cacheKey, currentTime, duration, isPlaying, isReady, onSeek } = options;
57
-
58
- // Get stable function references from store
59
- const saveVideoPosition = useMediaCacheStore.getState().saveVideoPosition;
60
- const getVideoPosition = useMediaCacheStore.getState().getVideoPosition;
61
-
62
- const lastSavedTimeRef = useRef<number>(0);
63
- const hasRestoredRef = useRef<boolean>(false);
64
-
65
- // Restore position when ready
66
- useEffect(() => {
67
- if (!isReady || !cacheKey || hasRestoredRef.current) return;
68
-
69
- const savedPosition = getVideoPosition(cacheKey);
70
- if (savedPosition && savedPosition > 0 && duration > 0) {
71
- // Only restore if position is valid (not at the end)
72
- if (savedPosition < duration - END_BUFFER) {
73
- onSeek(savedPosition);
74
- }
75
- }
76
- hasRestoredRef.current = true;
77
- // eslint-disable-next-line react-hooks/exhaustive-deps
78
- }, [isReady, cacheKey, duration, onSeek]);
79
-
80
- // Reset restored flag when cache key changes
81
- useEffect(() => {
82
- hasRestoredRef.current = false;
83
- lastSavedTimeRef.current = 0;
84
- }, [cacheKey]);
85
-
86
- // Save position periodically during playback
87
- useEffect(() => {
88
- if (!cacheKey || !isPlaying || currentTime <= 0) return;
89
-
90
- const timeSinceLastSave = currentTime - lastSavedTimeRef.current;
91
- if (timeSinceLastSave >= SAVE_INTERVAL || timeSinceLastSave < 0) {
92
- saveVideoPosition(cacheKey, currentTime);
93
- lastSavedTimeRef.current = currentTime;
94
- }
95
- // eslint-disable-next-line react-hooks/exhaustive-deps
96
- }, [cacheKey, isPlaying, currentTime]);
97
-
98
- const savePosition = useCallback(() => {
99
- if (cacheKey && currentTime > 0) {
100
- saveVideoPosition(cacheKey, currentTime);
101
- lastSavedTimeRef.current = currentTime;
102
- }
103
- // eslint-disable-next-line react-hooks/exhaustive-deps
104
- }, [cacheKey, currentTime]);
105
-
106
- const clearPosition = useCallback(() => {
107
- if (cacheKey) {
108
- saveVideoPosition(cacheKey, 0);
109
- }
110
- // eslint-disable-next-line react-hooks/exhaustive-deps
111
- }, [cacheKey]);
112
-
113
- return {
114
- savePosition,
115
- clearPosition,
116
- };
117
- }