@admin-layout/tailwind-ui 12.2.4-alpha.6 → 12.2.4-alpha.61
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/lib/components/AIToolbar/components/AIToolBar.d.ts +22 -0
- package/lib/components/AIToolbar/components/AIToolBar.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/AIToolBar.js +87 -0
- package/lib/components/AIToolbar/components/AIToolBar.js.map +1 -0
- package/lib/components/AIToolbar/components/AIToolbarPrimitives.d.ts +14 -0
- package/lib/components/AIToolbar/components/AIToolbarPrimitives.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/AIToolbarPrimitives.js +60 -0
- package/lib/components/AIToolbar/components/AIToolbarPrimitives.js.map +1 -0
- package/lib/components/AIToolbar/components/CustomCursor.d.ts +2 -0
- package/lib/components/AIToolbar/components/CustomCursor.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/CustomCursor.js +66 -0
- package/lib/components/AIToolbar/components/CustomCursor.js.map +1 -0
- package/lib/components/AIToolbar/components/DragButton.d.ts +9 -0
- package/lib/components/AIToolbar/components/DragButton.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/DragButton.js +57 -0
- package/lib/components/AIToolbar/components/DragButton.js.map +1 -0
- package/lib/components/AIToolbar/components/Markdown/copy-button.d.ts +7 -0
- package/lib/components/AIToolbar/components/Markdown/copy-button.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/Markdown/copy-button.js +30 -0
- package/lib/components/AIToolbar/components/Markdown/copy-button.js.map +1 -0
- package/lib/components/AIToolbar/components/Markdown/index.d.ts +7 -0
- package/lib/components/AIToolbar/components/Markdown/index.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/Markdown/index.js +46 -0
- package/lib/components/AIToolbar/components/Markdown/index.js.map +1 -0
- package/lib/components/AIToolbar/components/completion/AssistantAvatar.d.ts +24 -0
- package/lib/components/AIToolbar/components/completion/AssistantAvatar.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/completion/AssistantAvatar.js +48 -0
- package/lib/components/AIToolbar/components/completion/AssistantAvatar.js.map +1 -0
- package/lib/components/AIToolbar/components/completion/AssistantMessageActions.d.ts +28 -0
- package/lib/components/AIToolbar/components/completion/AssistantMessageActions.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/completion/AssistantMessageActions.js +209 -0
- package/lib/components/AIToolbar/components/completion/AssistantMessageActions.js.map +1 -0
- package/lib/components/AIToolbar/components/completion/AssistantSenderBadge.d.ts +15 -0
- package/lib/components/AIToolbar/components/completion/AssistantSenderBadge.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/completion/Audio.d.ts +5 -0
- package/lib/components/AIToolbar/components/completion/Audio.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/completion/Audio.js +67 -0
- package/lib/components/AIToolbar/components/completion/Audio.js.map +1 -0
- package/lib/components/AIToolbar/components/completion/AutoSpeechVad.d.ts +11 -0
- package/lib/components/AIToolbar/components/completion/AutoSpeechVad.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/completion/AutoSpeechVad.js +66 -0
- package/lib/components/AIToolbar/components/completion/AutoSpeechVad.js.map +1 -0
- package/lib/components/AIToolbar/components/completion/CharacterPicker.d.ts +5 -0
- package/lib/components/AIToolbar/components/completion/CharacterPicker.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/completion/CharacterPicker.js +93 -0
- package/lib/components/AIToolbar/components/completion/CharacterPicker.js.map +1 -0
- package/lib/components/AIToolbar/components/completion/Files.d.ts +7 -0
- package/lib/components/AIToolbar/components/completion/Files.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/completion/Files.js +136 -0
- package/lib/components/AIToolbar/components/completion/Files.js.map +1 -0
- package/lib/components/AIToolbar/components/completion/Input.d.ts +6 -0
- package/lib/components/AIToolbar/components/completion/Input.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/completion/Input.js +287 -0
- package/lib/components/AIToolbar/components/completion/Input.js.map +1 -0
- package/lib/components/AIToolbar/components/completion/MessageHistory.d.ts +11 -0
- package/lib/components/AIToolbar/components/completion/MessageHistory.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/completion/MessageHistory.js +131 -0
- package/lib/components/AIToolbar/components/completion/MessageHistory.js.map +1 -0
- package/lib/components/AIToolbar/components/completion/Screenshot.d.ts +7 -0
- package/lib/components/AIToolbar/components/completion/Screenshot.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/completion/Screenshot.js +30 -0
- package/lib/components/AIToolbar/components/completion/Screenshot.js.map +1 -0
- package/lib/components/AIToolbar/components/completion/index.d.ts +13 -0
- package/lib/components/AIToolbar/components/completion/index.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/completion/index.js +25 -0
- package/lib/components/AIToolbar/components/completion/index.js.map +1 -0
- package/lib/components/AIToolbar/components/index.d.ts +17 -0
- package/lib/components/AIToolbar/components/index.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/Header.d.ts +14 -0
- package/lib/components/AIToolbar/components/speech/Header.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/Header.js +82 -0
- package/lib/components/AIToolbar/components/speech/Header.js.map +1 -0
- package/lib/components/AIToolbar/components/speech/ModeSwitcher.d.ts +8 -0
- package/lib/components/AIToolbar/components/speech/ModeSwitcher.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/ModeSwitcher.js +44 -0
- package/lib/components/AIToolbar/components/speech/ModeSwitcher.js.map +1 -0
- package/lib/components/AIToolbar/components/speech/PermissionFlow.d.ts +13 -0
- package/lib/components/AIToolbar/components/speech/PermissionFlow.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/PermissionFlow.js +168 -0
- package/lib/components/AIToolbar/components/speech/PermissionFlow.js.map +1 -0
- package/lib/components/AIToolbar/components/speech/QuickActions.d.ts +13 -0
- package/lib/components/AIToolbar/components/speech/QuickActions.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/QuickActions.js +100 -0
- package/lib/components/AIToolbar/components/speech/QuickActions.js.map +1 -0
- package/lib/components/AIToolbar/components/speech/RecordingPanel.d.ts +14 -0
- package/lib/components/AIToolbar/components/speech/RecordingPanel.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/RecordingPanel.js +101 -0
- package/lib/components/AIToolbar/components/speech/RecordingPanel.js.map +1 -0
- package/lib/components/AIToolbar/components/speech/ResultsSection.d.ts +12 -0
- package/lib/components/AIToolbar/components/speech/ResultsSection.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/ResultsSection.js +142 -0
- package/lib/components/AIToolbar/components/speech/ResultsSection.js.map +1 -0
- package/lib/components/AIToolbar/components/speech/SettingsPanel.d.ts +14 -0
- package/lib/components/AIToolbar/components/speech/SettingsPanel.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/SettingsPanel.js +293 -0
- package/lib/components/AIToolbar/components/speech/SettingsPanel.js.map +1 -0
- package/lib/components/AIToolbar/components/speech/StatusIndicator.d.ts +10 -0
- package/lib/components/AIToolbar/components/speech/StatusIndicator.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/StatusIndicator.js +48 -0
- package/lib/components/AIToolbar/components/speech/StatusIndicator.js.map +1 -0
- package/lib/components/AIToolbar/components/speech/Warning.d.ts +6 -0
- package/lib/components/AIToolbar/components/speech/Warning.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/Warning.js +154 -0
- package/lib/components/AIToolbar/components/speech/Warning.js.map +1 -0
- package/lib/components/AIToolbar/components/speech/audio-visualizer.d.ts +7 -0
- package/lib/components/AIToolbar/components/speech/audio-visualizer.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/audio-visualizer.js +194 -0
- package/lib/components/AIToolbar/components/speech/audio-visualizer.js.map +1 -0
- package/lib/components/AIToolbar/components/speech/floatArrayToWav.d.ts +2 -0
- package/lib/components/AIToolbar/components/speech/floatArrayToWav.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/floatArrayToWav.js +32 -0
- package/lib/components/AIToolbar/components/speech/floatArrayToWav.js.map +1 -0
- package/lib/components/AIToolbar/components/speech/index.d.ts +4 -0
- package/lib/components/AIToolbar/components/speech/index.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/index.js +300 -0
- package/lib/components/AIToolbar/components/speech/index.js.map +1 -0
- package/lib/components/AIToolbar/components/speech/promptTemplates.d.ts +12 -0
- package/lib/components/AIToolbar/components/speech/promptTemplates.d.ts.map +1 -0
- package/lib/components/AIToolbar/components/speech/promptTemplates.js +114 -0
- package/lib/components/AIToolbar/components/speech/promptTemplates.js.map +1 -0
- package/lib/components/AIToolbar/components/types.d.ts +194 -0
- package/lib/components/AIToolbar/components/types.d.ts.map +1 -0
- package/lib/components/AIToolbar/hooks/marketplaceCharactersRegistry.d.ts +13 -0
- package/lib/components/AIToolbar/hooks/marketplaceCharactersRegistry.d.ts.map +1 -0
- package/lib/components/AIToolbar/hooks/marketplaceCharactersRegistry.js +6 -0
- package/lib/components/AIToolbar/hooks/marketplaceCharactersRegistry.js.map +1 -0
- package/lib/components/AIToolbar/hooks/useActiveCharacter.d.ts +52 -0
- package/lib/components/AIToolbar/hooks/useActiveCharacter.d.ts.map +1 -0
- package/lib/components/AIToolbar/hooks/useActiveCharacter.js +360 -0
- package/lib/components/AIToolbar/hooks/useActiveCharacter.js.map +1 -0
- package/lib/components/AIToolbar/hooks/useCharacterSprite.d.ts +14 -0
- package/lib/components/AIToolbar/hooks/useCharacterSprite.d.ts.map +1 -0
- package/lib/components/AIToolbar/hooks/useCharacterSprite.js +103 -0
- package/lib/components/AIToolbar/hooks/useCharacterSprite.js.map +1 -0
- package/lib/components/AIToolbar/hooks/useChatBackgroundImage.d.ts +10 -0
- package/lib/components/AIToolbar/hooks/useChatBackgroundImage.d.ts.map +1 -0
- package/lib/components/AIToolbar/hooks/useChatBackgroundImage.js +126 -0
- package/lib/components/AIToolbar/hooks/useChatBackgroundImage.js.map +1 -0
- package/lib/components/AIToolbar/index.d.ts +7 -0
- package/lib/components/AIToolbar/index.d.ts.map +1 -0
- package/lib/components/AIToolbar/utils/emotionClassifier.d.ts +19 -0
- package/lib/components/AIToolbar/utils/emotionClassifier.d.ts.map +1 -0
- package/lib/components/AIToolbar/utils/emotionClassifier.js +142 -0
- package/lib/components/AIToolbar/utils/emotionClassifier.js.map +1 -0
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/Button.d.ts.map +1 -1
- package/lib/components/Button/Button.js +7 -6
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/DatePicker/DatePicker.js +158 -140
- package/lib/components/DatePicker/DatePicker.js.map +1 -1
- package/lib/components/Dialog/Dialog.d.ts +20 -0
- package/lib/components/Dialog/Dialog.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.js +111 -0
- package/lib/components/Dialog/Dialog.js.map +1 -0
- package/lib/components/Dialog/index.d.ts +3 -0
- package/lib/components/Dialog/index.d.ts.map +1 -0
- package/lib/components/ErrorHandlers/ApplicationErrorHandler.d.ts +1 -2
- package/lib/components/ErrorHandlers/ApplicationErrorHandler.d.ts.map +1 -1
- package/lib/components/ErrorHandlers/ApplicationErrorHandler.js +2 -2
- package/lib/components/ErrorHandlers/ErrorBoundary.d.ts +1 -2
- package/lib/components/ErrorHandlers/ErrorBoundary.d.ts.map +1 -1
- package/lib/components/ErrorHandlers/ErrorBoundary.js +35 -28
- package/lib/components/ErrorHandlers/ErrorBoundary.js.map +1 -1
- package/lib/components/ErrorHandlers/LayoutErrorBoundary.d.ts +1 -2
- package/lib/components/ErrorHandlers/LayoutErrorBoundary.d.ts.map +1 -1
- package/lib/components/ErrorHandlers/LayoutErrorBoundary.js +20 -15
- package/lib/components/ErrorHandlers/LayoutErrorBoundary.js.map +1 -1
- package/lib/components/ErrorHandlers/RemixErrorBoundary.d.ts +4 -2
- package/lib/components/ErrorHandlers/RemixErrorBoundary.d.ts.map +1 -1
- package/lib/components/ErrorHandlers/RemixErrorBoundary.js +222 -100
- package/lib/components/ErrorHandlers/RemixErrorBoundary.js.map +1 -1
- package/lib/components/ErrorHandlers/SPAErrorBoundary.d.ts +4 -2
- package/lib/components/ErrorHandlers/SPAErrorBoundary.d.ts.map +1 -1
- package/lib/components/ErrorHandlers/SPAErrorBoundary.js +247 -82
- package/lib/components/ErrorHandlers/SPAErrorBoundary.js.map +1 -1
- package/lib/components/ErrorPages/403.d.ts +1 -2
- package/lib/components/ErrorPages/403.d.ts.map +1 -1
- package/lib/components/ErrorPages/403.js +26 -18
- package/lib/components/ErrorPages/403.js.map +1 -1
- package/lib/components/ErrorPages/404.d.ts +1 -2
- package/lib/components/ErrorPages/404.d.ts.map +1 -1
- package/lib/components/ErrorPages/404.js +26 -18
- package/lib/components/ErrorPages/404.js.map +1 -1
- package/lib/components/ErrorPages/500.d.ts +1 -2
- package/lib/components/ErrorPages/500.d.ts.map +1 -1
- package/lib/components/ErrorPages/500.js +26 -18
- package/lib/components/ErrorPages/500.js.map +1 -1
- package/lib/components/InputToolBar/InputToolBar.d.ts +8 -0
- package/lib/components/InputToolBar/InputToolBar.d.ts.map +1 -0
- package/lib/components/InputToolBar/InputToolBar.js +469 -0
- package/lib/components/InputToolBar/InputToolBar.js.map +1 -0
- package/lib/components/InputToolBar/defaults.d.ts +15 -0
- package/lib/components/InputToolBar/defaults.d.ts.map +1 -0
- package/lib/components/InputToolBar/defaults.js +59 -0
- package/lib/components/InputToolBar/defaults.js.map +1 -0
- package/lib/components/InputToolBar/index.d.ts +5 -0
- package/lib/components/InputToolBar/index.d.ts.map +1 -0
- package/lib/components/InputToolBar/types.d.ts +153 -0
- package/lib/components/InputToolBar/types.d.ts.map +1 -0
- package/lib/components/LanguageMenuDropdown/LanguageMenuDropdown.d.ts +1 -2
- package/lib/components/LanguageMenuDropdown/LanguageMenuDropdown.d.ts.map +1 -1
- package/lib/components/LanguageMenuDropdown/LanguageMenuDropdown.js +24 -19
- package/lib/components/LanguageMenuDropdown/LanguageMenuDropdown.js.map +1 -1
- package/lib/components/Markdown/MarkdownBreadcrumbs.d.ts +13 -0
- package/lib/components/Markdown/MarkdownBreadcrumbs.d.ts.map +1 -0
- package/lib/components/Markdown/MarkdownBreadcrumbs.js +34 -0
- package/lib/components/Markdown/MarkdownBreadcrumbs.js.map +1 -0
- package/lib/components/Markdown/MarkdownCopyButton.d.ts +10 -0
- package/lib/components/Markdown/MarkdownCopyButton.d.ts.map +1 -0
- package/lib/components/Markdown/MarkdownCopyButton.js +229 -0
- package/lib/components/Markdown/MarkdownCopyButton.js.map +1 -0
- package/lib/components/Markdown/MarkdownHeader.d.ts +13 -0
- package/lib/components/Markdown/MarkdownHeader.d.ts.map +1 -0
- package/lib/components/Markdown/MarkdownHeader.js +44 -0
- package/lib/components/Markdown/MarkdownHeader.js.map +1 -0
- package/lib/components/Markdown/MarkdownNavigation.d.ts +15 -0
- package/lib/components/Markdown/MarkdownNavigation.d.ts.map +1 -0
- package/lib/components/Markdown/MarkdownNavigation.js +38 -0
- package/lib/components/Markdown/MarkdownNavigation.js.map +1 -0
- package/lib/components/Markdown/MarkdownPage.d.ts +41 -0
- package/lib/components/Markdown/MarkdownPage.d.ts.map +1 -0
- package/lib/components/Markdown/MarkdownPage.js +238 -0
- package/lib/components/Markdown/MarkdownPage.js.map +1 -0
- package/lib/components/Markdown/MarkdownTableOfContents.d.ts +15 -0
- package/lib/components/Markdown/MarkdownTableOfContents.d.ts.map +1 -0
- package/lib/components/Markdown/MarkdownTableOfContents.js +57 -0
- package/lib/components/Markdown/MarkdownTableOfContents.js.map +1 -0
- package/lib/components/Markdown/index.d.ts +7 -0
- package/lib/components/Markdown/index.d.ts.map +1 -0
- package/lib/components/OTP/OTPInput.js +32 -30
- package/lib/components/OTP/OTPInput.js.map +1 -1
- package/lib/components/OTP/OTPVerification.js +75 -55
- package/lib/components/OTP/OTPVerification.js.map +1 -1
- package/lib/components/OTP/SingleInput.js +2 -2
- package/lib/components/OTP/SingleInput.js.map +1 -1
- package/lib/components/PageContainer/PageContainer.js +29 -22
- package/lib/components/PageContainer/PageContainer.js.map +1 -1
- package/lib/components/PageLoading/index.js +8 -7
- package/lib/components/PageLoading/index.js.map +1 -1
- package/lib/components/RJSFPreview/PreviewAsyncDropdown.d.ts +1 -2
- package/lib/components/RJSFPreview/PreviewAsyncDropdown.d.ts.map +1 -1
- package/lib/components/ReactTable/Table.d.ts +1 -2
- package/lib/components/ReactTable/Table.d.ts.map +1 -1
- package/lib/components/ReactTable/Table.js +92 -71
- package/lib/components/ReactTable/Table.js.map +1 -1
- package/lib/components/ReactTable/TableFilters.d.ts +2 -3
- package/lib/components/ReactTable/TableFilters.d.ts.map +1 -1
- package/lib/components/ReactTable/TableFilters.js +40 -34
- package/lib/components/ReactTable/TableFilters.js.map +1 -1
- package/lib/components/Search/SearchInput.d.ts +1 -2
- package/lib/components/Search/SearchInput.d.ts.map +1 -1
- package/lib/components/Search/SearchInput.js +14 -13
- package/lib/components/Search/SearchInput.js.map +1 -1
- package/lib/components/Select/Select.d.ts +6 -6
- package/lib/components/Select/Select.d.ts.map +1 -1
- package/lib/components/Select/Select.js +60 -45
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Spin/index.js +14 -11
- package/lib/components/Spin/index.js.map +1 -1
- package/lib/components/ThemeProvider/ThemeProvider.d.ts +1 -1
- package/lib/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/lib/components/ThemeProvider/ThemeProvider.js +29 -17
- package/lib/components/ThemeProvider/ThemeProvider.js.map +1 -1
- package/lib/components/ThemeProvider/ThemeToggle.js +28 -25
- package/lib/components/ThemeProvider/ThemeToggle.js.map +1 -1
- package/lib/components/ThemeProvider/types.d.ts +3 -3
- package/lib/components/ThemeProvider/types.d.ts.map +1 -1
- package/lib/components/YantraIcon.d.ts +6 -0
- package/lib/components/YantraIcon.d.ts.map +1 -0
- package/lib/components/YantraIcon.js +32 -0
- package/lib/components/YantraIcon.js.map +1 -0
- package/lib/components/index.d.ts +6 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/hooks/activeCharacterPreference.d.ts +24 -0
- package/lib/hooks/activeCharacterPreference.d.ts.map +1 -0
- package/lib/hooks/activeCharacterPreference.js +64 -0
- package/lib/hooks/activeCharacterPreference.js.map +1 -0
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/useToast.d.ts +1 -1
- package/lib/hooks/useToast.d.ts.map +1 -1
- package/lib/hooks/useToast.js +46 -37
- package/lib/hooks/useToast.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/shardui/accordion.js +20 -16
- package/lib/shardui/accordion.js.map +1 -1
- package/lib/shardui/alert-dialog.d.ts +2 -2
- package/lib/shardui/alert-dialog.js +15 -13
- package/lib/shardui/alert-dialog.js.map +1 -1
- package/lib/shardui/alert.js +4 -4
- package/lib/shardui/alert.js.map +1 -1
- package/lib/shardui/avatar.js +4 -4
- package/lib/shardui/avatar.js.map +1 -1
- package/lib/shardui/badge.d.ts +1 -1
- package/lib/shardui/badge.d.ts.map +1 -1
- package/lib/shardui/badge.js +2 -2
- package/lib/shardui/badge.js.map +1 -1
- package/lib/shardui/breadcrumb.d.ts +2 -2
- package/lib/shardui/breadcrumb.js +19 -16
- package/lib/shardui/breadcrumb.js.map +1 -1
- package/lib/shardui/button.js +2 -2
- package/lib/shardui/button.js.map +1 -1
- package/lib/shardui/calendar.d.ts +1 -1
- package/lib/shardui/calendar.d.ts.map +1 -1
- package/lib/shardui/calendar.js +4 -4
- package/lib/shardui/card.js +7 -7
- package/lib/shardui/card.js.map +1 -1
- package/lib/shardui/carousel.js +40 -33
- package/lib/shardui/carousel.js.map +1 -1
- package/lib/shardui/chart.d.ts +1 -1
- package/lib/shardui/chart.d.ts.map +1 -1
- package/lib/shardui/chart.js +81 -66
- package/lib/shardui/chart.js.map +1 -1
- package/lib/shardui/checkbox.js +10 -8
- package/lib/shardui/checkbox.js.map +1 -1
- package/lib/shardui/command.d.ts +2 -2
- package/lib/shardui/command.d.ts.map +1 -1
- package/lib/shardui/command.js +28 -24
- package/lib/shardui/command.js.map +1 -1
- package/lib/shardui/context-menu.d.ts +1 -1
- package/lib/shardui/context-menu.js +41 -30
- package/lib/shardui/context-menu.js.map +1 -1
- package/lib/shardui/dialog.d.ts +2 -2
- package/lib/shardui/dialog.js +22 -17
- package/lib/shardui/dialog.js.map +1 -1
- package/lib/shardui/drawer.d.ts +3 -3
- package/lib/shardui/drawer.js +17 -14
- package/lib/shardui/drawer.js.map +1 -1
- package/lib/shardui/dropdown-menu.d.ts +1 -1
- package/lib/shardui/dropdown-menu.js +42 -31
- package/lib/shardui/dropdown-menu.js.map +1 -1
- package/lib/shardui/form.d.ts +1 -1
- package/lib/shardui/form.d.ts.map +1 -1
- package/lib/shardui/form.js +22 -19
- package/lib/shardui/form.js.map +1 -1
- package/lib/shardui/hover-card.js +2 -2
- package/lib/shardui/hover-card.js.map +1 -1
- package/lib/shardui/input-otp.js +16 -13
- package/lib/shardui/input-otp.js.map +1 -1
- package/lib/shardui/input.js +2 -2
- package/lib/shardui/input.js.map +1 -1
- package/lib/shardui/label.js +2 -2
- package/lib/shardui/label.js.map +1 -1
- package/lib/shardui/menubar.d.ts +1 -1
- package/lib/shardui/menubar.js +46 -35
- package/lib/shardui/menubar.js.map +1 -1
- package/lib/shardui/navigation-menu.js +28 -24
- package/lib/shardui/navigation-menu.js.map +1 -1
- package/lib/shardui/pagination.d.ts +5 -5
- package/lib/shardui/pagination.js +30 -22
- package/lib/shardui/pagination.js.map +1 -1
- package/lib/shardui/popover.js +10 -8
- package/lib/shardui/popover.js.map +1 -1
- package/lib/shardui/progress.js +10 -9
- package/lib/shardui/progress.js.map +1 -1
- package/lib/shardui/radio-group.js +11 -9
- package/lib/shardui/radio-group.js.map +1 -1
- package/lib/shardui/resizable.d.ts +3 -3
- package/lib/shardui/resizable.d.ts.map +1 -1
- package/lib/shardui/resizable.js +11 -9
- package/lib/shardui/resizable.js.map +1 -1
- package/lib/shardui/scroll-area.js +14 -11
- package/lib/shardui/scroll-area.js.map +1 -1
- package/lib/shardui/select.js +49 -35
- package/lib/shardui/select.js.map +1 -1
- package/lib/shardui/separator.js +2 -2
- package/lib/shardui/separator.js.map +1 -1
- package/lib/shardui/sheet.d.ts +2 -2
- package/lib/shardui/sheet.js +24 -19
- package/lib/shardui/sheet.js.map +1 -1
- package/lib/shardui/sidebar.js +104 -88
- package/lib/shardui/sidebar.js.map +1 -1
- package/lib/shardui/skeleton.d.ts +1 -1
- package/lib/shardui/skeleton.d.ts.map +1 -1
- package/lib/shardui/skeleton.js +2 -2
- package/lib/shardui/skeleton.js.map +1 -1
- package/lib/shardui/slider.js +12 -10
- package/lib/shardui/slider.js.map +1 -1
- package/lib/shardui/sonner.d.ts +1 -1
- package/lib/shardui/sonner.d.ts.map +1 -1
- package/lib/shardui/sonner.js +2 -2
- package/lib/shardui/sonner.js.map +1 -1
- package/lib/shardui/switch.js +7 -6
- package/lib/shardui/switch.js.map +1 -1
- package/lib/shardui/table.js +16 -15
- package/lib/shardui/table.js.map +1 -1
- package/lib/shardui/tabs.js +4 -4
- package/lib/shardui/tabs.js.map +1 -1
- package/lib/shardui/textarea.js +2 -2
- package/lib/shardui/textarea.js.map +1 -1
- package/lib/shardui/toast.js +12 -11
- package/lib/shardui/toast.js.map +1 -1
- package/lib/shardui/toaster.d.ts +1 -2
- package/lib/shardui/toaster.d.ts.map +1 -1
- package/lib/shardui/toaster.js +21 -14
- package/lib/shardui/toaster.js.map +1 -1
- package/lib/shardui/toggle-group.js +15 -12
- package/lib/shardui/toggle-group.js.map +1 -1
- package/lib/shardui/toggle.js +2 -2
- package/lib/shardui/toggle.js.map +1 -1
- package/lib/shardui/tooltip.js +2 -2
- package/lib/shardui/tooltip.js.map +1 -1
- package/package.json +9 -3
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Dispatched when {@link setMarketplaceCharacters} updates the overlay list. */
|
|
2
|
+
const MARKETPLACE_CHARACTERS_CHANGED_EVENT = 'yantra:marketplace-characters-changed';
|
|
3
|
+
let marketplaceOverlay = [];
|
|
4
|
+
function getMarketplaceCharactersSnapshot() {
|
|
5
|
+
return marketplaceOverlay;
|
|
6
|
+
}export{MARKETPLACE_CHARACTERS_CHANGED_EVENT,getMarketplaceCharactersSnapshot};//# sourceMappingURL=marketplaceCharactersRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketplaceCharactersRegistry.js","sources":["../../../../src/components/AIToolbar/hooks/marketplaceCharactersRegistry.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACY,0CAA4B,GAAA;IACpC,kBAAa,GAAA,EAAA;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface ActiveCharacter {
|
|
2
|
+
/** Manifest `name` (or filesystem stem) — e.g. "Seraphina". */
|
|
3
|
+
name: string;
|
|
4
|
+
/** PNG card filename without extension — used to fetch avatar / sprites. */
|
|
5
|
+
fileName?: string;
|
|
6
|
+
/** Pre-baked `data:` URL for the avatar PNG, or null if not yet loaded. */
|
|
7
|
+
avatarSrc: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface CharacterListEntry {
|
|
10
|
+
name: string;
|
|
11
|
+
fileName?: string;
|
|
12
|
+
avatarSrc: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface CharacterPicker {
|
|
15
|
+
/** All installed characters with resolved avatars. */
|
|
16
|
+
characters: CharacterListEntry[];
|
|
17
|
+
/** Currently active character name, or null if none picked / none installed. */
|
|
18
|
+
activeName: string | null;
|
|
19
|
+
/** Switch the active character by name. Pass null to clear (revert to first). */
|
|
20
|
+
setActive: (name: string | null) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Marketplace character entry — produced from `contributes.uiLayout` rows
|
|
24
|
+
* under `marketplace.characters.*`. Fed in from yantra-app via
|
|
25
|
+
* `setMarketplaceCharacters` so this package stays free of GraphQL deps.
|
|
26
|
+
*/
|
|
27
|
+
export interface MarketplaceCharacterEntry {
|
|
28
|
+
name: string;
|
|
29
|
+
fileName?: string;
|
|
30
|
+
extensionId?: string;
|
|
31
|
+
extensionSlug?: string;
|
|
32
|
+
/** Optional pre-resolved data URL (e.g. CDN avatar). Filesystem install will override. */
|
|
33
|
+
avatarSrc?: string | null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Publish the current list of marketplace-contributed characters. Called by
|
|
37
|
+
* yantra-app after `useSettingsLoader({ configKey: 'marketplace.characters' })`
|
|
38
|
+
* resolves. Triggers a re-render of any active character hook.
|
|
39
|
+
*/
|
|
40
|
+
export declare function setMarketplaceCharacters(entries: MarketplaceCharacterEntry[]): void;
|
|
41
|
+
/**
|
|
42
|
+
* Return the active character (name + avatar) or null when none is installed
|
|
43
|
+
* / we're not running under Tauri. Selection follows `pickActiveMerged` (file_name
|
|
44
|
+
* pref, then name pref) and stays in sync with `useCharacterPicker` / desktop settings.
|
|
45
|
+
*/
|
|
46
|
+
export declare function useActiveCharacter(): ActiveCharacter | null;
|
|
47
|
+
/**
|
|
48
|
+
* Enumerate installed characters and switch the active one. Empty list and
|
|
49
|
+
* `activeName === null` outside Tauri / when nothing is installed.
|
|
50
|
+
*/
|
|
51
|
+
export declare function useCharacterPicker(): CharacterPicker;
|
|
52
|
+
//# sourceMappingURL=useActiveCharacter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActiveCharacter.d.ts","sourceRoot":"","sources":["../../../../src/components/AIToolbar/hooks/useActiveCharacter.ts"],"names":[],"mappings":"AAyCA,MAAM,WAAW,eAAe;IAC5B,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC5B,sDAAsD;IACtD,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,gFAAgF;IAChF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iFAAiF;IACjF,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC5C;AASD;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0FAA0F;IAC1F,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAiCD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,EAAE,GAAG,IAAI,CASnF;AAkMD;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,GAAG,IAAI,CAqC3D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAmFpD"}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import*as React from'react';import {setPreferredActiveCharacterFileName,ACTIVE_CHARACTER_CHANGE_EVENT,readPreferredActiveCharacterFileName,ACTIVE_CHARACTER_FILE_NAME_STORAGE_KEY}from'../../../hooks/activeCharacterPreference.js';import {clearCharacterSpriteCache}from'./useCharacterSprite.js';import {MARKETPLACE_CHARACTERS_CHANGED_EVENT,getMarketplaceCharactersSnapshot}from'./marketplaceCharactersRegistry.js';// Active-character lookup for the AIToolbar.
|
|
2
|
+
//
|
|
3
|
+
// Surfaces the currently-selected character (name + avatar data URL) so the
|
|
4
|
+
// completion popover and message history can show "Seraphina" with her avatar
|
|
5
|
+
// instead of a generic "AI" label. Backed by the desktop Tauri commands
|
|
6
|
+
// `character_list` and `character_get_avatar` (see
|
|
7
|
+
// `yantra-app/portable-devices/desktop/src-tauri/src/features/character_feature/`).
|
|
8
|
+
//
|
|
9
|
+
// Degrades gracefully:
|
|
10
|
+
// - Outside Tauri (regular browser, SSR): returns null synchronously.
|
|
11
|
+
// - Tauri without any character-contributing extension installed: returns null.
|
|
12
|
+
// - Tauri with an extension but no avatar: returns name-only (avatarSrc = null).
|
|
13
|
+
//
|
|
14
|
+
// Re-fetches on the `yantra:character-refresh` Tauri event + the
|
|
15
|
+
// `yantra:extensions-changed` window event (marketplace install/uninstall), and
|
|
16
|
+
// re-resolves when either persisted preference changes:
|
|
17
|
+
// - `yantra:active-character-name` (name-based — CharacterPicker / toolbar), and/or
|
|
18
|
+
// - `yantra:active-character:file-name` + `yantra:active-character-change` (file_name
|
|
19
|
+
// + cross-webview emit — desktop settings / `activeCharacterPreference.ts`).
|
|
20
|
+
//
|
|
21
|
+
// When multiple characters are installed, resolution order is: **file_name**
|
|
22
|
+
// preference first (so the dashboard bar and main app stay aligned), then
|
|
23
|
+
// **name** preference (`yantra:active-character-name`), then `character_list[0]`.
|
|
24
|
+
// Use `useCharacterPicker` to enumerate and switch by name (it also syncs
|
|
25
|
+
// the file_name preference + Tauri fan-out).
|
|
26
|
+
// constants
|
|
27
|
+
const CHARACTER_REFRESH_EVENT = 'yantra:character-refresh';
|
|
28
|
+
/**
|
|
29
|
+
* Window event dispatched by `yantra-app/portable-devices/desktop/src/utils/marketplaceInstall.ts`
|
|
30
|
+
* after the marketplace install / uninstall path triggers `character_refresh`.
|
|
31
|
+
* Listening here lets the avatar swap in without an app restart.
|
|
32
|
+
*/
|
|
33
|
+
const EXTENSIONS_CHANGED_EVENT = 'yantra:extensions-changed';
|
|
34
|
+
/** Window event dispatched by `useCharacterPicker().setActive(...)` to notify subscribers. */
|
|
35
|
+
const ACTIVE_CHARACTER_CHANGED_EVENT = 'yantra:active-character-changed';
|
|
36
|
+
const ACTIVE_CHARACTER_STORAGE_KEY = 'yantra:active-character-name';
|
|
37
|
+
/** Manifest contribution keys that should retrigger a character reload. */
|
|
38
|
+
const CHARACTER_CONTRIBUTIONS = ['characters', 'uiLayout'];
|
|
39
|
+
// marketplace registry (populated by yantra-app via setMarketplaceCharacters)
|
|
40
|
+
let marketplaceRegistry = [];
|
|
41
|
+
const marketplaceSubscribers = new Set();
|
|
42
|
+
function subscribeMarketplace(cb) {
|
|
43
|
+
marketplaceSubscribers.add(cb);
|
|
44
|
+
return () => marketplaceSubscribers.delete(cb);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Publish the current list of marketplace-contributed characters. Called by
|
|
48
|
+
* yantra-app after `useSettingsLoader({ configKey: 'marketplace.characters' })`
|
|
49
|
+
* resolves. Triggers a re-render of any active character hook.
|
|
50
|
+
*/
|
|
51
|
+
function setMarketplaceCharacters(entries) {
|
|
52
|
+
marketplaceRegistry = Array.isArray(entries) ? entries : [];
|
|
53
|
+
marketplaceSubscribers.forEach(cb => {
|
|
54
|
+
try {
|
|
55
|
+
cb();
|
|
56
|
+
} catch {
|
|
57
|
+
// ignore subscriber errors
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function getMarketplaceCharacters() {
|
|
62
|
+
return marketplaceRegistry;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Merge marketplace entries into the filesystem list. Filesystem wins on
|
|
66
|
+
* name conflicts (real avatar > stub), so the marketplace entry is dropped.
|
|
67
|
+
*/
|
|
68
|
+
function mergeWithMarketplace(filesystem, marketplace) {
|
|
69
|
+
if (marketplace.length === 0) return filesystem;
|
|
70
|
+
const seen = new Set(filesystem.map(c => c.name));
|
|
71
|
+
const extras = [];
|
|
72
|
+
for (const m of marketplace) {
|
|
73
|
+
if (!m.name || seen.has(m.name)) continue;
|
|
74
|
+
seen.add(m.name);
|
|
75
|
+
extras.push({
|
|
76
|
+
name: m.name,
|
|
77
|
+
file_name: m.fileName,
|
|
78
|
+
source: 'marketplace'
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return extras.length ? [...filesystem, ...extras] : filesystem;
|
|
82
|
+
}
|
|
83
|
+
// helpers
|
|
84
|
+
function isTauri() {
|
|
85
|
+
if (typeof window === 'undefined') return false;
|
|
86
|
+
const w = window;
|
|
87
|
+
return Boolean(w.__TAURI_INTERNALS__ ?? w.__TAURI__);
|
|
88
|
+
}
|
|
89
|
+
async function safeInvoke(cmd, args) {
|
|
90
|
+
if (!isTauri()) return null;
|
|
91
|
+
try {
|
|
92
|
+
// @ts-ignore — optional dynamic import, present as a peer dep in Tauri builds.
|
|
93
|
+
const mod = await import('@tauri-apps/api/core');
|
|
94
|
+
return await mod.invoke(cmd, args);
|
|
95
|
+
} catch {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async function safeListen(event, cb) {
|
|
100
|
+
if (!isTauri()) return () => {};
|
|
101
|
+
try {
|
|
102
|
+
// @ts-ignore — see safeInvoke note.
|
|
103
|
+
const mod = await import('@tauri-apps/api/event');
|
|
104
|
+
const unlisten = await mod.listen(event, e => cb(e.payload));
|
|
105
|
+
return unlisten;
|
|
106
|
+
} catch {
|
|
107
|
+
return () => {};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function readStoredActiveName() {
|
|
111
|
+
if (typeof window === 'undefined') return null;
|
|
112
|
+
try {
|
|
113
|
+
return window.localStorage.getItem(ACTIVE_CHARACTER_STORAGE_KEY);
|
|
114
|
+
} catch {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Decide whether an `extensions-changed` event is relevant to characters.
|
|
120
|
+
* Detail with no `contributes` array is treated as relevant (defensive
|
|
121
|
+
* reload) so we never miss a real change.
|
|
122
|
+
*/
|
|
123
|
+
function isCharacterRelevant(event) {
|
|
124
|
+
const detail = event.detail;
|
|
125
|
+
if (!detail || !Array.isArray(detail.contributes)) return true;
|
|
126
|
+
return detail.contributes.some(c => CHARACTER_CONTRIBUTIONS.includes(c));
|
|
127
|
+
}
|
|
128
|
+
function writeStoredActiveName(name) {
|
|
129
|
+
if (typeof window === 'undefined') return;
|
|
130
|
+
try {
|
|
131
|
+
if (name == null) window.localStorage.removeItem(ACTIVE_CHARACTER_STORAGE_KEY);else window.localStorage.setItem(ACTIVE_CHARACTER_STORAGE_KEY, name);
|
|
132
|
+
} catch {
|
|
133
|
+
// ignore quota / privacy-mode errors
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
async function fetchAvatarSrc(fileName) {
|
|
137
|
+
if (!fileName) return null;
|
|
138
|
+
const dto = await safeInvoke('character_get_avatar', {
|
|
139
|
+
fileName
|
|
140
|
+
});
|
|
141
|
+
if (!dto || !dto.base64 || dto.base64.length <= 100) return null;
|
|
142
|
+
return `data:${dto.mime_type || 'image/png'};base64,${dto.base64}`;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Choose the active row: **file_name** preference (desktop settings / cross-webview),
|
|
146
|
+
* else **name** preference (toolbar picker), else first in list.
|
|
147
|
+
*/
|
|
148
|
+
function pickActiveMerged(list) {
|
|
149
|
+
if (list.length === 0) return null;
|
|
150
|
+
const filePref = readPreferredActiveCharacterFileName();
|
|
151
|
+
if (filePref) {
|
|
152
|
+
const byFile = list.find(c => c.file_name === filePref);
|
|
153
|
+
if (byFile) return byFile;
|
|
154
|
+
}
|
|
155
|
+
const desiredName = readStoredActiveName();
|
|
156
|
+
if (desiredName) {
|
|
157
|
+
const byName = list.find(c => c.name === desiredName);
|
|
158
|
+
if (byName) return byName;
|
|
159
|
+
}
|
|
160
|
+
// No explicit selection: prefer an extension-contributed character over
|
|
161
|
+
// user-root cards so a freshly-installed extension (e.g. Seraphina) wins
|
|
162
|
+
// by default instead of dev/test residue sitting in the user data dir.
|
|
163
|
+
const extensionPick = list.find(c => c.source === 'extension');
|
|
164
|
+
if (extensionPick) return extensionPick;
|
|
165
|
+
return list[0];
|
|
166
|
+
}
|
|
167
|
+
/** Subscribe to both preference schemes + cross-webview Tauri event; bump resets derived selection. */
|
|
168
|
+
function usePreferenceSyncBump() {
|
|
169
|
+
const [bump, setBump] = React.useState(0);
|
|
170
|
+
const bumpFn = React.useCallback(() => {
|
|
171
|
+
setBump(n => n + 1);
|
|
172
|
+
}, []);
|
|
173
|
+
return [bump, bumpFn];
|
|
174
|
+
}
|
|
175
|
+
function useCharacterPreferenceListeners(reload, bump) {
|
|
176
|
+
React.useEffect(() => {
|
|
177
|
+
let unlistenChar = null;
|
|
178
|
+
let unlistenFilePref = null;
|
|
179
|
+
let cancelled = false;
|
|
180
|
+
safeListen(CHARACTER_REFRESH_EVENT, () => {
|
|
181
|
+
clearCharacterSpriteCache();
|
|
182
|
+
void reload();
|
|
183
|
+
bump();
|
|
184
|
+
}).then(fn => {
|
|
185
|
+
if (cancelled) fn();else unlistenChar = fn;
|
|
186
|
+
});
|
|
187
|
+
safeListen(ACTIVE_CHARACTER_CHANGE_EVENT, () => {
|
|
188
|
+
clearCharacterSpriteCache();
|
|
189
|
+
bump();
|
|
190
|
+
}).then(fn => {
|
|
191
|
+
if (cancelled) fn();else unlistenFilePref = fn;
|
|
192
|
+
});
|
|
193
|
+
function onExtensionsChanged(e) {
|
|
194
|
+
if (!isCharacterRelevant(e)) return;
|
|
195
|
+
clearCharacterSpriteCache();
|
|
196
|
+
void reload();
|
|
197
|
+
bump();
|
|
198
|
+
}
|
|
199
|
+
function onActiveChanged() {
|
|
200
|
+
clearCharacterSpriteCache();
|
|
201
|
+
bump();
|
|
202
|
+
}
|
|
203
|
+
function onFilePrefLocal(e) {
|
|
204
|
+
clearCharacterSpriteCache();
|
|
205
|
+
bump();
|
|
206
|
+
}
|
|
207
|
+
function onStorageKey(ev) {
|
|
208
|
+
if (ev.key !== ACTIVE_CHARACTER_STORAGE_KEY && ev.key !== ACTIVE_CHARACTER_FILE_NAME_STORAGE_KEY && ev.key != null) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
clearCharacterSpriteCache();
|
|
212
|
+
bump();
|
|
213
|
+
}
|
|
214
|
+
if (typeof window !== 'undefined') {
|
|
215
|
+
window.addEventListener(EXTENSIONS_CHANGED_EVENT, onExtensionsChanged);
|
|
216
|
+
window.addEventListener(ACTIVE_CHARACTER_CHANGED_EVENT, onActiveChanged);
|
|
217
|
+
window.addEventListener(ACTIVE_CHARACTER_CHANGE_EVENT, onFilePrefLocal);
|
|
218
|
+
window.addEventListener('storage', onStorageKey);
|
|
219
|
+
}
|
|
220
|
+
return () => {
|
|
221
|
+
cancelled = true;
|
|
222
|
+
if (unlistenChar) unlistenChar();
|
|
223
|
+
if (unlistenFilePref) unlistenFilePref();
|
|
224
|
+
if (typeof window !== 'undefined') {
|
|
225
|
+
window.removeEventListener(EXTENSIONS_CHANGED_EVENT, onExtensionsChanged);
|
|
226
|
+
window.removeEventListener(ACTIVE_CHARACTER_CHANGED_EVENT, onActiveChanged);
|
|
227
|
+
window.removeEventListener(ACTIVE_CHARACTER_CHANGE_EVENT, onFilePrefLocal);
|
|
228
|
+
window.removeEventListener('storage', onStorageKey);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}, [reload, bump]);
|
|
232
|
+
}
|
|
233
|
+
// main API
|
|
234
|
+
/**
|
|
235
|
+
* Return the active character (name + avatar) or null when none is installed
|
|
236
|
+
* / we're not running under Tauri. Selection follows `pickActiveMerged` (file_name
|
|
237
|
+
* pref, then name pref) and stays in sync with `useCharacterPicker` / desktop settings.
|
|
238
|
+
*/
|
|
239
|
+
function useActiveCharacter() {
|
|
240
|
+
const [list, setList] = React.useState([]);
|
|
241
|
+
const [avatarSrc, setAvatarSrc] = React.useState(null);
|
|
242
|
+
const [bump, bumpFn] = usePreferenceSyncBump();
|
|
243
|
+
const reload = React.useCallback(async () => {
|
|
244
|
+
const next = await safeInvoke('character_list', {
|
|
245
|
+
shallow: false
|
|
246
|
+
});
|
|
247
|
+
setList(mergeWithMarketplace(next ?? [], getMarketplaceCharacters()));
|
|
248
|
+
}, []);
|
|
249
|
+
React.useEffect(() => {
|
|
250
|
+
void reload();
|
|
251
|
+
return subscribeMarketplace(() => {
|
|
252
|
+
void reload();
|
|
253
|
+
});
|
|
254
|
+
}, [reload]);
|
|
255
|
+
useCharacterPreferenceListeners(reload, bumpFn);
|
|
256
|
+
const active = React.useMemo(() => pickActiveMerged(list), [list, bump]);
|
|
257
|
+
React.useEffect(() => {
|
|
258
|
+
if (!active?.file_name) {
|
|
259
|
+
setAvatarSrc(null);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
let alive = true;
|
|
263
|
+
fetchAvatarSrc(active.file_name).then(src => {
|
|
264
|
+
if (alive) setAvatarSrc(src);
|
|
265
|
+
});
|
|
266
|
+
return () => {
|
|
267
|
+
alive = false;
|
|
268
|
+
};
|
|
269
|
+
}, [active?.file_name]);
|
|
270
|
+
if (!active) return null;
|
|
271
|
+
return {
|
|
272
|
+
name: active.name,
|
|
273
|
+
fileName: active.file_name,
|
|
274
|
+
avatarSrc
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Enumerate installed characters and switch the active one. Empty list and
|
|
279
|
+
* `activeName === null` outside Tauri / when nothing is installed.
|
|
280
|
+
*/
|
|
281
|
+
function useCharacterPicker() {
|
|
282
|
+
const [list, setList] = React.useState([]);
|
|
283
|
+
const [avatars, setAvatars] = React.useState({});
|
|
284
|
+
const [bump, bumpFn] = usePreferenceSyncBump();
|
|
285
|
+
const [marketplaceBump, setMarketplaceBump] = React.useState(0);
|
|
286
|
+
React.useEffect(() => {
|
|
287
|
+
if (typeof window === 'undefined') return;
|
|
288
|
+
const onMk = () => setMarketplaceBump(n => n + 1);
|
|
289
|
+
window.addEventListener(MARKETPLACE_CHARACTERS_CHANGED_EVENT, onMk);
|
|
290
|
+
return () => window.removeEventListener(MARKETPLACE_CHARACTERS_CHANGED_EVENT, onMk);
|
|
291
|
+
}, []);
|
|
292
|
+
const reload = React.useCallback(async () => {
|
|
293
|
+
const next = await safeInvoke('character_list', {
|
|
294
|
+
shallow: false
|
|
295
|
+
});
|
|
296
|
+
setList(mergeWithMarketplace(next ?? [], getMarketplaceCharacters()));
|
|
297
|
+
}, []);
|
|
298
|
+
React.useEffect(() => {
|
|
299
|
+
void reload();
|
|
300
|
+
return subscribeMarketplace(() => {
|
|
301
|
+
void reload();
|
|
302
|
+
});
|
|
303
|
+
}, [reload]);
|
|
304
|
+
useCharacterPreferenceListeners(reload, bumpFn);
|
|
305
|
+
const activeName = React.useMemo(() => pickActiveMerged(list)?.name ?? null, [list, bump, marketplaceBump]);
|
|
306
|
+
// Resolve avatars for every character in the list (cached by file_name).
|
|
307
|
+
React.useEffect(() => {
|
|
308
|
+
let alive = true;
|
|
309
|
+
async function loadAll() {
|
|
310
|
+
const pending = list.filter(c => c.file_name && !(c.file_name in avatars));
|
|
311
|
+
if (pending.length === 0) return;
|
|
312
|
+
const entries = await Promise.all(pending.map(async c => [c.file_name, await fetchAvatarSrc(c.file_name)]));
|
|
313
|
+
if (!alive) return;
|
|
314
|
+
setAvatars(prev => {
|
|
315
|
+
const next = {
|
|
316
|
+
...prev
|
|
317
|
+
};
|
|
318
|
+
for (const [key, src] of entries) next[key] = src;
|
|
319
|
+
return next;
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
void loadAll();
|
|
323
|
+
return () => {
|
|
324
|
+
alive = false;
|
|
325
|
+
};
|
|
326
|
+
}, [list, avatars]);
|
|
327
|
+
const characters = React.useMemo(() => {
|
|
328
|
+
const installed = list.map(c => ({
|
|
329
|
+
name: c.name,
|
|
330
|
+
fileName: c.file_name,
|
|
331
|
+
avatarSrc: c.file_name ? avatars[c.file_name] ?? null : null
|
|
332
|
+
}));
|
|
333
|
+
const seen = new Set(installed.map(c => c.name));
|
|
334
|
+
const extras = getMarketplaceCharactersSnapshot().filter(m => !seen.has(m.name)).map(m => ({
|
|
335
|
+
name: m.name,
|
|
336
|
+
fileName: m.fileName,
|
|
337
|
+
avatarSrc: m.avatarSrc ?? null
|
|
338
|
+
}));
|
|
339
|
+
return [...installed, ...extras];
|
|
340
|
+
}, [list, avatars, marketplaceBump]);
|
|
341
|
+
const setActive = React.useCallback(name => {
|
|
342
|
+
writeStoredActiveName(name);
|
|
343
|
+
const row = name ? list.find(c => c.name === name) : null;
|
|
344
|
+
void setPreferredActiveCharacterFileName(row?.file_name ?? null);
|
|
345
|
+
clearCharacterSpriteCache();
|
|
346
|
+
bumpFn();
|
|
347
|
+
if (typeof window !== 'undefined') {
|
|
348
|
+
window.dispatchEvent(new CustomEvent(ACTIVE_CHARACTER_CHANGED_EVENT, {
|
|
349
|
+
detail: {
|
|
350
|
+
name
|
|
351
|
+
}
|
|
352
|
+
}));
|
|
353
|
+
}
|
|
354
|
+
}, [list, bumpFn]);
|
|
355
|
+
return {
|
|
356
|
+
characters,
|
|
357
|
+
activeName,
|
|
358
|
+
setActive
|
|
359
|
+
};
|
|
360
|
+
}export{setMarketplaceCharacters,useActiveCharacter,useCharacterPicker};//# sourceMappingURL=useActiveCharacter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActiveCharacter.js","sources":["../../../../src/components/AIToolbar/hooks/useActiveCharacter.ts"],"sourcesContent":[null],"names":[],"mappings":"2ZAyCA;;;;;;AAMI;AACH;AAED;;;AAGI;AACH;AAED;;;;AAII;;;AAGH;AASD;;;;;MASI,uBAAuB,GAAA,0BAAA;;AAEvB;AACH;AAiCD;;;;AAIG,MAAA,8BAAA,GAAA,iCAAA;AACH,MAAA,4BAAgB,GAAA;AA2MhB;;;;AAIG,MAAA,sBAAA,GAAA,IAAA,GAAA,EAAA;AACH,SAAA,oBAAgB,CAAA,EAAA,EAAA;AAuChB,EAAA,sBAAA,CAAA,GAAA,CAAA,EAAA,CAAA;;;AAGG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the data URL for `(characterFileName, label)` or `null` while the
|
|
3
|
+
* sprite is loading / when running outside Tauri / when no character is set.
|
|
4
|
+
*
|
|
5
|
+
* Re-evaluates whenever either input changes. Cached results resolve in the
|
|
6
|
+
* same render (no transient `null`).
|
|
7
|
+
*/
|
|
8
|
+
export declare function useCharacterSprite(characterFileName: string | null | undefined, label: string | null | undefined): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Clears the sprite cache. Call after `character_refresh` so newly-installed
|
|
11
|
+
* sprite packs aren't shadowed by stale data URLs.
|
|
12
|
+
*/
|
|
13
|
+
export declare function clearCharacterSpriteCache(): void;
|
|
14
|
+
//# sourceMappingURL=useCharacterSprite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCharacterSprite.d.ts","sourceRoot":"","sources":["../../../../src/components/AIToolbar/hooks/useCharacterSprite.ts"],"names":[],"mappings":"AAqFA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAC9B,iBAAiB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC5C,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACjC,MAAM,GAAG,IAAI,CAoBf;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAGhD"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import*as React from'react';// Expression-sprite lookup for assistant message bubbles.
|
|
2
|
+
//
|
|
3
|
+
// Resolves `(characterFileName, label)` → `data:image/png;base64,...` via the
|
|
4
|
+
// Tauri command `character_get_expression`, with a module-level cache so the
|
|
5
|
+
// same sprite is fetched at most once per session even when many messages map
|
|
6
|
+
// to the same emotion.
|
|
7
|
+
//
|
|
8
|
+
// The Rust side (`character_get_expression`) already implements graceful
|
|
9
|
+
// fallback through `neutral`/`joy`/avatar when the requested label is missing,
|
|
10
|
+
// so callers can pass any of the 28 GoEmotions labels without first checking
|
|
11
|
+
// which sprites the character actually ships.
|
|
12
|
+
//
|
|
13
|
+
// Degrades to `null` outside Tauri / when no character file_name is provided.
|
|
14
|
+
function isTauri() {
|
|
15
|
+
if (typeof window === 'undefined') return false;
|
|
16
|
+
const w = window;
|
|
17
|
+
return Boolean(w.__TAURI_INTERNALS__ ?? w.__TAURI__);
|
|
18
|
+
}
|
|
19
|
+
async function safeInvoke(cmd, args) {
|
|
20
|
+
if (!isTauri()) return null;
|
|
21
|
+
try {
|
|
22
|
+
// @ts-ignore — optional dynamic import, present as a peer dep in Tauri builds.
|
|
23
|
+
const mod = await import('@tauri-apps/api/core');
|
|
24
|
+
return await mod.invoke(cmd, args);
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Two layered caches keyed by `${fileName}::${label}`:
|
|
30
|
+
//
|
|
31
|
+
// - `urlCache` resolves synchronously on subsequent calls (no re-render flicker).
|
|
32
|
+
// - `pendingCache` deduplicates concurrent fetches for the same key when
|
|
33
|
+
// several messages on screen happen to share the same emotion.
|
|
34
|
+
const urlCache = new Map();
|
|
35
|
+
const pendingCache = new Map();
|
|
36
|
+
function cacheKey(fileName, label) {
|
|
37
|
+
return `${fileName}::${label}`;
|
|
38
|
+
}
|
|
39
|
+
async function fetchSprite(fileName, label) {
|
|
40
|
+
const key = cacheKey(fileName, label);
|
|
41
|
+
const cached = urlCache.get(key);
|
|
42
|
+
if (cached !== undefined) return cached;
|
|
43
|
+
const pending = pendingCache.get(key);
|
|
44
|
+
if (pending) return pending;
|
|
45
|
+
const promise = (async () => {
|
|
46
|
+
const dto = await safeInvoke('character_get_expression', {
|
|
47
|
+
fileName,
|
|
48
|
+
label
|
|
49
|
+
});
|
|
50
|
+
if (!dto || !dto.base64 || dto.base64.length < 100) {
|
|
51
|
+
urlCache.set(key, '');
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const url = `data:${dto.mime_type || 'image/png'};base64,${dto.base64}`;
|
|
55
|
+
urlCache.set(key, url);
|
|
56
|
+
// If Rust fell back to a different label (sprite missing), also cache
|
|
57
|
+
// the resolved label so a subsequent call for it short-circuits.
|
|
58
|
+
if (dto.label && dto.label !== label) {
|
|
59
|
+
urlCache.set(cacheKey(fileName, dto.label), url);
|
|
60
|
+
}
|
|
61
|
+
return url;
|
|
62
|
+
})();
|
|
63
|
+
pendingCache.set(key, promise);
|
|
64
|
+
try {
|
|
65
|
+
return await promise;
|
|
66
|
+
} finally {
|
|
67
|
+
pendingCache.delete(key);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Returns the data URL for `(characterFileName, label)` or `null` while the
|
|
72
|
+
* sprite is loading / when running outside Tauri / when no character is set.
|
|
73
|
+
*
|
|
74
|
+
* Re-evaluates whenever either input changes. Cached results resolve in the
|
|
75
|
+
* same render (no transient `null`).
|
|
76
|
+
*/
|
|
77
|
+
function useCharacterSprite(characterFileName, label) {
|
|
78
|
+
const key = characterFileName && label ? cacheKey(characterFileName, label) : null;
|
|
79
|
+
const cachedInitial = key ? urlCache.get(key) ?? null : null;
|
|
80
|
+
const [src, setSrc] = React.useState(cachedInitial && cachedInitial !== '' ? cachedInitial : null);
|
|
81
|
+
React.useEffect(() => {
|
|
82
|
+
if (!characterFileName || !label) {
|
|
83
|
+
setSrc(null);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
let alive = true;
|
|
87
|
+
fetchSprite(characterFileName, label).then(url => {
|
|
88
|
+
if (alive) setSrc(url);
|
|
89
|
+
});
|
|
90
|
+
return () => {
|
|
91
|
+
alive = false;
|
|
92
|
+
};
|
|
93
|
+
}, [characterFileName, label]);
|
|
94
|
+
return src;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Clears the sprite cache. Call after `character_refresh` so newly-installed
|
|
98
|
+
* sprite packs aren't shadowed by stale data URLs.
|
|
99
|
+
*/
|
|
100
|
+
function clearCharacterSpriteCache() {
|
|
101
|
+
urlCache.clear();
|
|
102
|
+
pendingCache.clear();
|
|
103
|
+
}export{clearCharacterSpriteCache,useCharacterSprite};//# sourceMappingURL=useCharacterSprite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCharacterSprite.js","sources":["../../../../src/components/AIToolbar/hooks/useCharacterSprite.ts"],"sourcesContent":[null],"names":[],"mappings":"4BAqFA;;;;;;AAMG;AACH;AAyBA;;;AAGG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the current chat-background image as a `data:` URL, or `null` when
|
|
3
|
+
* no wallpaper is selected / we are not running under Tauri.
|
|
4
|
+
*
|
|
5
|
+
* Re-fetches whenever the user picks a different wallpaper, regardless of
|
|
6
|
+
* which webview the picker lives in.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useChatBackgroundImage(): string | null;
|
|
9
|
+
export default useChatBackgroundImage;
|
|
10
|
+
//# sourceMappingURL=useChatBackgroundImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChatBackgroundImage.d.ts","sourceRoot":"","sources":["../../../../src/components/AIToolbar/hooks/useChatBackgroundImage.ts"],"names":[],"mappings":"AA4EA;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,IAAI,CA+DtD;AAED,eAAe,sBAAsB,CAAC"}
|