@moontra/moonui-pro 2.8.5 → 2.8.7

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/dist/index.d.ts CHANGED
@@ -1055,6 +1055,14 @@ interface KanbanProps {
1055
1055
  }
1056
1056
  declare function Kanban({ columns, onCardMove, onCardClick, onCardEdit, onCardDelete, onAddCard, onAddColumn, className, showAddColumn, showCardDetails, disabled }: KanbanProps): react_jsx_runtime.JSX.Element;
1057
1057
 
1058
+ interface AIConfig {
1059
+ provider?: 'openai' | 'claude' | 'gemini' | 'cohere';
1060
+ apiKey?: string;
1061
+ model?: string;
1062
+ temperature?: number;
1063
+ maxTokens?: number;
1064
+ endpoint?: string;
1065
+ }
1058
1066
  interface RichTextEditorProps {
1059
1067
  value?: string;
1060
1068
  onChange?: (value: string) => void;
@@ -1077,15 +1085,10 @@ interface RichTextEditorProps {
1077
1085
  color?: boolean;
1078
1086
  ai?: boolean;
1079
1087
  };
1080
- aiConfig?: {
1081
- provider?: 'openai' | 'claude' | 'gemini' | 'cohere';
1082
- apiKey?: string;
1083
- model?: string;
1084
- temperature?: number;
1085
- maxTokens?: number;
1086
- };
1088
+ aiConfig?: AIConfig;
1089
+ persistAISettings?: boolean;
1087
1090
  }
1088
- declare function RichTextEditor({ placeholder, className, height, features, aiConfig, }: RichTextEditorProps): react_jsx_runtime.JSX.Element | null;
1091
+ declare function RichTextEditor({ placeholder, className, height, features, aiConfig, persistAISettings, }: RichTextEditorProps): react_jsx_runtime.JSX.Element | null;
1089
1092
 
1090
1093
  interface MemoryConfig {
1091
1094
  chunkSize?: number;
@@ -2366,4 +2369,4 @@ declare namespace index {
2366
2369
  };
2367
2370
  }
2368
2371
 
2369
- export { MoonUIAccordionPro as Accordion, MoonUIAccordionContentPro as AccordionContent, MoonUIAccordionItemPro as AccordionItem, MoonUIAccordionTriggerPro as AccordionTrigger, ActivityItem, Calendar as AdvancedCalendar, AdvancedChart, AdvancedFormField, AdvancedForms, AdvancedFormsProps, MoonUIAlertPro as Alert, MoonUIAlertDescriptionPro as AlertDescription, MoonUIAlertTitlePro as AlertTitle, AnimatedButton, AnimatedButtonProps, MoonUIAspectRatioPro as AspectRatio, MoonUIAvatarPro as Avatar, MoonUIAvatarFallbackPro as AvatarFallback, MoonUIAvatarImagePro as AvatarImage, MoonUIBadgePro as Badge, MoonUIBreadcrumbPro as Breadcrumb, MoonUIBreadcrumbEllipsisPro as BreadcrumbEllipsis, MoonUIBreadcrumbItemPro as BreadcrumbItem, MoonUIBreadcrumbLinkPro as BreadcrumbLink, MoonUIBreadcrumbListPro as BreadcrumbList, MoonUIBreadcrumbPagePro as BreadcrumbPage, MoonUIBreadcrumbSeparatorPro as BreadcrumbSeparator, BulkAction, MoonUIButtonPro as Button, Calendar$1 as Calendar, MoonUICardPro as Card, MoonUICardContentPro as CardContent, MoonUICardDescriptionPro as CardDescription, MoonUICardFooterPro as CardFooter, MoonUICardHeaderPro as CardHeader, MoonUICardTitlePro as CardTitle, ChartData, ChartType, MoonUICheckboxPro as Checkbox, MoonUICollapsiblePro as Collapsible, MoonUICollapsibleContentPro as CollapsibleContent, MoonUICollapsibleTriggerPro as CollapsibleTrigger, MoonUIColorPickerPro as ColorPicker, MoonUICommandPro as Command, MoonUICommandDialogPro as CommandDialog, MoonUICommandEmptyPro as CommandEmpty, MoonUICommandGroupPro as CommandGroup, MoonUICommandInputPro as CommandInput, MoonUICommandItemPro as CommandItem, MoonUICommandListPro as CommandList, MoonUICommandSeparatorPro as CommandSeparator, MoonUICommandShortcutPro as CommandShortcut, ComparisonData, CreditCardInputProps, Dashboard, DataTable, MoonUIDialogPro as Dialog, MoonUIDialogClosePro as DialogClose, MoonUIDialogContentPro as DialogContent, MoonUIDialogDescriptionPro as DialogDescription, MoonUIDialogFooterPro as DialogFooter, MoonUIDialogHeaderPro as DialogHeader, MoonUIDialogTitlePro as DialogTitle, MoonUIDialogTriggerPro as DialogTrigger, DraggableList, DraggableListProps, MoonUIDropdownMenuPro as DropdownMenu, MoonUIDropdownMenuCheckboxItemPro as DropdownMenuCheckboxItem, MoonUIDropdownMenuContentPro as DropdownMenuContent, MoonUIDropdownMenuGroupPro as DropdownMenuGroup, MoonUIDropdownMenuItemPro as DropdownMenuItem, MoonUIDropdownMenuLabelPro as DropdownMenuLabel, MoonUIDropdownMenuPortalPro as DropdownMenuPortal, MoonUIDropdownMenuRadioGroupPro as DropdownMenuRadioGroup, MoonUIDropdownMenuRadioItemPro as DropdownMenuRadioItem, MoonUIDropdownMenuSeparatorPro as DropdownMenuSeparator, MoonUIDropdownMenuShortcutPro as DropdownMenuShortcut, MoonUIDropdownMenuSubPro as DropdownMenuSub, MoonUIDropdownMenuSubContentPro as DropdownMenuSubContent, MoonUIDropdownMenuSubTriggerPro as DropdownMenuSubTrigger, MoonUIDropdownMenuTriggerPro as DropdownMenuTrigger, index as Enhanced, ErrorBoundary, ExportFormat, FileUpload, FilterCondition, FilterOperator, FloatingActionButton, FloatingActionButtonProps, FormWizardNavigation, FormWizardProgress, FormWizardProps, FormWizardStep, GitHubRepository, GitHubStars, GitHubStarsProps, HealthCheck, HealthCheckEndpoint, HealthCheckProps, HealthCheckResult, HoverCard, HoverCard3D, HoverCard3DProps, HoverCardContent, HoverCardTrigger, MoonUIInputPro as Input, Kanban, MoonUILabelPro as Label, LazyComponent, LazyImage, LazyImageProps, LazyList, LazyListProps, MagneticButton, MagneticButtonProps, MemoryAnalytics, MemoryAnalyticsProps, MemoryConfig, MemoryEfficientData, MemoryEfficientDataProps, MemoryStats, MetricData, MoonUIAccordionContentPro, MoonUIAccordionItemPro, MoonUIAccordionPro, MoonUIAccordionTriggerPro, MoonUIAlertDescriptionPro, MoonUIAlertPro, MoonUIAlertTitlePro, MoonUIAspectRatioPro, MoonUIAvatarFallbackPro, MoonUIAvatarImagePro, MoonUIAvatarPro, MoonUIBadgePro, MoonUIBreadcrumbEllipsisPro, MoonUIBreadcrumbItemPro, MoonUIBreadcrumbLinkPro, MoonUIBreadcrumbListPro, MoonUIBreadcrumbPagePro, MoonUIBreadcrumbPro, MoonUIBreadcrumbSeparatorPro, MoonUIButtonPro, MoonUICardContentPro, MoonUICardDescriptionPro, MoonUICardFooterPro, MoonUICardHeaderPro, MoonUICardPro, MoonUICardTitlePro, MoonUICheckboxPro, MoonUICollapsibleContentPro, MoonUICollapsiblePro, MoonUICollapsibleTriggerPro, MoonUIColorPickerPro, MoonUICommandDialogPro, MoonUICommandEmptyPro, MoonUICommandGroupPro, MoonUICommandInputPro, MoonUICommandItemPro, MoonUICommandListPro, MoonUICommandPro, MoonUICommandSeparatorPro, MoonUICommandShortcutPro, MoonUICreditCardInputPro, MoonUIDialogClosePro, MoonUIDialogContentPro, MoonUIDialogDescriptionPro, MoonUIDialogFooterPro, MoonUIDialogHeaderPro, MoonUIDialogPro, MoonUIDialogTitlePro, MoonUIDialogTriggerPro, MoonUIDropdownMenuCheckboxItemPro, MoonUIDropdownMenuContentPro, MoonUIDropdownMenuGroupPro, MoonUIDropdownMenuItemPro, MoonUIDropdownMenuLabelPro, MoonUIDropdownMenuPortalPro, MoonUIDropdownMenuPro, MoonUIDropdownMenuRadioGroupPro, MoonUIDropdownMenuRadioItemPro, MoonUIDropdownMenuSeparatorPro, MoonUIDropdownMenuShortcutPro, MoonUIDropdownMenuSubContentPro, MoonUIDropdownMenuSubPro, MoonUIDropdownMenuSubTriggerPro, MoonUIDropdownMenuTriggerPro, MoonUIFormWizardPro, MoonUIInputPro, MoonUILabelPro, MoonUIPaginationContentPro, MoonUIPaginationEllipsisPro, MoonUIPaginationItemPro, MoonUIPaginationLinkPro, MoonUIPaginationNextPro, MoonUIPaginationPreviousPro, MoonUIPaginationPro, MoonUIPhoneNumberInputPro, MoonUIPopoverContentPro, MoonUIPopoverPro, MoonUIPopoverTriggerPro, MoonUIProgressPro, Question as MoonUIQuestion, QuestionType as MoonUIQuestionType, MoonUIQuizFormPro, MoonUIQuizFormProProps, QuizResult as MoonUIQuizResult, QuizSettings as MoonUIQuizSettings, MoonUIRadioGroupContextPro, MoonUIRadioGroupItemPro, MoonUIRadioGroupPro, MoonUIRadioItemWithLabelPro, MoonUIRadioLabelPro, MoonUISelectContentPro, MoonUISelectGroupPro, MoonUISelectItemPro, MoonUISelectLabelPro, MoonUISelectPro, MoonUISelectSeparatorPro, MoonUISelectTriggerPro, MoonUISelectValuePro, MoonUISeparatorPro, MoonUISkeletonPro, MoonUISliderPro, MoonUISwitchPro, MoonUITableBodyPro, MoonUITableCaptionPro, MoonUITableCellPro, MoonUITableFooterPro, MoonUITableHeadPro, MoonUITableHeaderPro, MoonUITablePro, MoonUITableRowPro, MoonUITabsContentPro, MoonUITabsListPro, MoonUITabsPro, MoonUITabsTriggerPro, MoonUITextareaPro, MoonUIToastPro, MoonUITogglePro, MoonUITooltipContentPro, MoonUITooltipPro, MoonUITooltipProviderPro, MoonUITooltipTriggerPro, UserAnswer as MoonUIUserAnswer, MoonUIalertVariantsPro, MoonUIaspectRatioVariantsPro, MoonUIbreadcrumbVariantsPro, MoonUIcollapsibleContentVariantsPro, MoonUIcollapsibleTriggerVariantsPro, MoonUIcommandVariantsPro, MoonUIradioGroupItemVariantsPro, MoonUItableVariantsPro, MoonUItoggleVariantsPro, OptimizedImage, OptimizedImageProps, MoonUIPaginationPro as Pagination, MoonUIPaginationContentPro as PaginationContent, MoonUIPaginationEllipsisPro as PaginationEllipsis, MoonUIPaginationItemPro as PaginationItem, MoonUIPaginationLinkPro as PaginationLink, MoonUIPaginationNextPro as PaginationNext, MoonUIPaginationPreviousPro as PaginationPrevious, PerformanceAlert, PerformanceDebugger, PerformanceDebuggerProps, PerformanceEntry, PerformanceMetric, PerformanceMetrics, PerformanceMonitor, PerformanceMonitorProps, PhoneNumberInputProps, PinchZoom, MoonUIPopoverPro as Popover, MoonUIPopoverContentPro as PopoverContent, MoonUIPopoverTriggerPro as PopoverTrigger, MoonUIProgressPro as Progress, ProgressData, QuestionType$1 as QuestionType, QuizAnswer, QuizFormProps, QuizQuestion, QuizResult$1 as QuizResult, MoonUIRadioGroupPro as RadioGroup, MoonUIRadioGroupContextPro as RadioGroupContext, MoonUIRadioGroupItemPro as RadioGroupItem, MoonUIRadioItemWithLabelPro as RadioItemWithLabel, MoonUIRadioLabelPro as RadioLabel, RichTextEditor, ScrollArea, ScrollBar, MoonUISelectPro as Select, MoonUISelectContentPro as SelectContent, MoonUISelectGroupPro as SelectGroup, MoonUISelectItemPro as SelectItem, MoonUISelectLabelPro as SelectLabel, MoonUISelectSeparatorPro as SelectSeparator, MoonUISelectTriggerPro as SelectTrigger, MoonUISelectValuePro as SelectValue, SelectableVirtualList, SelectableVirtualListProps, MoonUISeparatorPro as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarConfig, SidebarItem, SidebarSection, SidebarState, MoonUISkeletonPro as Skeleton, MoonUISliderPro as Slider, SpotlightCard, SpotlightCardProps, SwipeableCard, MoonUISwitchPro as Switch, MoonUITablePro as Table, MoonUITableBodyPro as TableBody, MoonUITableCaptionPro as TableCaption, MoonUITableCellPro as TableCell, MoonUITableFooterPro as TableFooter, MoonUITableHeadPro as TableHead, MoonUITableHeaderPro as TableHeader, MoonUITableRowPro as TableRow, MoonUITabsPro as Tabs, MoonUITabsContentPro as TabsContent, MoonUITabsListPro as TabsList, MoonUITabsTriggerPro as TabsTrigger, MoonUITextareaPro as Textarea, Timeline, MoonUIToastPro as Toast, MoonUITogglePro as Toggle, MoonUITooltipPro as Tooltip, MoonUITooltipContentPro as TooltipContent, MoonUITooltipProviderPro as TooltipProvider, MoonUITooltipTriggerPro as TooltipTrigger, VirtualList, VirtualListProps, Widget, WizardStep, WizardStepContentProps, MoonUIalertVariantsPro as alertVariants, animatedButtonVariants, MoonUIaspectRatioVariantsPro as aspectRatioVariants, moonUIBadgeVariantsPro as badgeVariants, MoonUIbreadcrumbVariantsPro as breadcrumbVariants, moonUIButtonProVariants as buttonVariants, cn, MoonUIcollapsibleContentVariantsPro as collapsibleContentVariants, MoonUIcollapsibleTriggerVariantsPro as collapsibleTriggerVariants, MoonUIcommandVariantsPro as commandVariants, getExpandableColumn, moonUIBadgeVariantsPro, moonUIButtonProVariants, moonUISeparatorVariantsPro, countries as phoneCountries, MoonUIradioGroupItemVariantsPro as radioGroupItemVariants, moonUISeparatorVariantsPro as separatorVariants, MoonUItableVariantsPro as tableVariants, MoonUItoggleVariantsPro as toggleVariants, useExpandableRows, useFormWizard, useStreamingData, useVirtualList };
2372
+ export { AIConfig, MoonUIAccordionPro as Accordion, MoonUIAccordionContentPro as AccordionContent, MoonUIAccordionItemPro as AccordionItem, MoonUIAccordionTriggerPro as AccordionTrigger, ActivityItem, Calendar as AdvancedCalendar, AdvancedChart, AdvancedFormField, AdvancedForms, AdvancedFormsProps, MoonUIAlertPro as Alert, MoonUIAlertDescriptionPro as AlertDescription, MoonUIAlertTitlePro as AlertTitle, AnimatedButton, AnimatedButtonProps, MoonUIAspectRatioPro as AspectRatio, MoonUIAvatarPro as Avatar, MoonUIAvatarFallbackPro as AvatarFallback, MoonUIAvatarImagePro as AvatarImage, MoonUIBadgePro as Badge, MoonUIBreadcrumbPro as Breadcrumb, MoonUIBreadcrumbEllipsisPro as BreadcrumbEllipsis, MoonUIBreadcrumbItemPro as BreadcrumbItem, MoonUIBreadcrumbLinkPro as BreadcrumbLink, MoonUIBreadcrumbListPro as BreadcrumbList, MoonUIBreadcrumbPagePro as BreadcrumbPage, MoonUIBreadcrumbSeparatorPro as BreadcrumbSeparator, BulkAction, MoonUIButtonPro as Button, Calendar$1 as Calendar, MoonUICardPro as Card, MoonUICardContentPro as CardContent, MoonUICardDescriptionPro as CardDescription, MoonUICardFooterPro as CardFooter, MoonUICardHeaderPro as CardHeader, MoonUICardTitlePro as CardTitle, ChartData, ChartType, MoonUICheckboxPro as Checkbox, MoonUICollapsiblePro as Collapsible, MoonUICollapsibleContentPro as CollapsibleContent, MoonUICollapsibleTriggerPro as CollapsibleTrigger, MoonUIColorPickerPro as ColorPicker, MoonUICommandPro as Command, MoonUICommandDialogPro as CommandDialog, MoonUICommandEmptyPro as CommandEmpty, MoonUICommandGroupPro as CommandGroup, MoonUICommandInputPro as CommandInput, MoonUICommandItemPro as CommandItem, MoonUICommandListPro as CommandList, MoonUICommandSeparatorPro as CommandSeparator, MoonUICommandShortcutPro as CommandShortcut, ComparisonData, CreditCardInputProps, Dashboard, DataTable, MoonUIDialogPro as Dialog, MoonUIDialogClosePro as DialogClose, MoonUIDialogContentPro as DialogContent, MoonUIDialogDescriptionPro as DialogDescription, MoonUIDialogFooterPro as DialogFooter, MoonUIDialogHeaderPro as DialogHeader, MoonUIDialogTitlePro as DialogTitle, MoonUIDialogTriggerPro as DialogTrigger, DraggableList, DraggableListProps, MoonUIDropdownMenuPro as DropdownMenu, MoonUIDropdownMenuCheckboxItemPro as DropdownMenuCheckboxItem, MoonUIDropdownMenuContentPro as DropdownMenuContent, MoonUIDropdownMenuGroupPro as DropdownMenuGroup, MoonUIDropdownMenuItemPro as DropdownMenuItem, MoonUIDropdownMenuLabelPro as DropdownMenuLabel, MoonUIDropdownMenuPortalPro as DropdownMenuPortal, MoonUIDropdownMenuRadioGroupPro as DropdownMenuRadioGroup, MoonUIDropdownMenuRadioItemPro as DropdownMenuRadioItem, MoonUIDropdownMenuSeparatorPro as DropdownMenuSeparator, MoonUIDropdownMenuShortcutPro as DropdownMenuShortcut, MoonUIDropdownMenuSubPro as DropdownMenuSub, MoonUIDropdownMenuSubContentPro as DropdownMenuSubContent, MoonUIDropdownMenuSubTriggerPro as DropdownMenuSubTrigger, MoonUIDropdownMenuTriggerPro as DropdownMenuTrigger, index as Enhanced, ErrorBoundary, ExportFormat, FileUpload, FilterCondition, FilterOperator, FloatingActionButton, FloatingActionButtonProps, FormWizardNavigation, FormWizardProgress, FormWizardProps, FormWizardStep, GitHubRepository, GitHubStars, GitHubStarsProps, HealthCheck, HealthCheckEndpoint, HealthCheckProps, HealthCheckResult, HoverCard, HoverCard3D, HoverCard3DProps, HoverCardContent, HoverCardTrigger, MoonUIInputPro as Input, Kanban, MoonUILabelPro as Label, LazyComponent, LazyImage, LazyImageProps, LazyList, LazyListProps, MagneticButton, MagneticButtonProps, MemoryAnalytics, MemoryAnalyticsProps, MemoryConfig, MemoryEfficientData, MemoryEfficientDataProps, MemoryStats, MetricData, MoonUIAccordionContentPro, MoonUIAccordionItemPro, MoonUIAccordionPro, MoonUIAccordionTriggerPro, MoonUIAlertDescriptionPro, MoonUIAlertPro, MoonUIAlertTitlePro, MoonUIAspectRatioPro, MoonUIAvatarFallbackPro, MoonUIAvatarImagePro, MoonUIAvatarPro, MoonUIBadgePro, MoonUIBreadcrumbEllipsisPro, MoonUIBreadcrumbItemPro, MoonUIBreadcrumbLinkPro, MoonUIBreadcrumbListPro, MoonUIBreadcrumbPagePro, MoonUIBreadcrumbPro, MoonUIBreadcrumbSeparatorPro, MoonUIButtonPro, MoonUICardContentPro, MoonUICardDescriptionPro, MoonUICardFooterPro, MoonUICardHeaderPro, MoonUICardPro, MoonUICardTitlePro, MoonUICheckboxPro, MoonUICollapsibleContentPro, MoonUICollapsiblePro, MoonUICollapsibleTriggerPro, MoonUIColorPickerPro, MoonUICommandDialogPro, MoonUICommandEmptyPro, MoonUICommandGroupPro, MoonUICommandInputPro, MoonUICommandItemPro, MoonUICommandListPro, MoonUICommandPro, MoonUICommandSeparatorPro, MoonUICommandShortcutPro, MoonUICreditCardInputPro, MoonUIDialogClosePro, MoonUIDialogContentPro, MoonUIDialogDescriptionPro, MoonUIDialogFooterPro, MoonUIDialogHeaderPro, MoonUIDialogPro, MoonUIDialogTitlePro, MoonUIDialogTriggerPro, MoonUIDropdownMenuCheckboxItemPro, MoonUIDropdownMenuContentPro, MoonUIDropdownMenuGroupPro, MoonUIDropdownMenuItemPro, MoonUIDropdownMenuLabelPro, MoonUIDropdownMenuPortalPro, MoonUIDropdownMenuPro, MoonUIDropdownMenuRadioGroupPro, MoonUIDropdownMenuRadioItemPro, MoonUIDropdownMenuSeparatorPro, MoonUIDropdownMenuShortcutPro, MoonUIDropdownMenuSubContentPro, MoonUIDropdownMenuSubPro, MoonUIDropdownMenuSubTriggerPro, MoonUIDropdownMenuTriggerPro, MoonUIFormWizardPro, MoonUIInputPro, MoonUILabelPro, MoonUIPaginationContentPro, MoonUIPaginationEllipsisPro, MoonUIPaginationItemPro, MoonUIPaginationLinkPro, MoonUIPaginationNextPro, MoonUIPaginationPreviousPro, MoonUIPaginationPro, MoonUIPhoneNumberInputPro, MoonUIPopoverContentPro, MoonUIPopoverPro, MoonUIPopoverTriggerPro, MoonUIProgressPro, Question as MoonUIQuestion, QuestionType as MoonUIQuestionType, MoonUIQuizFormPro, MoonUIQuizFormProProps, QuizResult as MoonUIQuizResult, QuizSettings as MoonUIQuizSettings, MoonUIRadioGroupContextPro, MoonUIRadioGroupItemPro, MoonUIRadioGroupPro, MoonUIRadioItemWithLabelPro, MoonUIRadioLabelPro, MoonUISelectContentPro, MoonUISelectGroupPro, MoonUISelectItemPro, MoonUISelectLabelPro, MoonUISelectPro, MoonUISelectSeparatorPro, MoonUISelectTriggerPro, MoonUISelectValuePro, MoonUISeparatorPro, MoonUISkeletonPro, MoonUISliderPro, MoonUISwitchPro, MoonUITableBodyPro, MoonUITableCaptionPro, MoonUITableCellPro, MoonUITableFooterPro, MoonUITableHeadPro, MoonUITableHeaderPro, MoonUITablePro, MoonUITableRowPro, MoonUITabsContentPro, MoonUITabsListPro, MoonUITabsPro, MoonUITabsTriggerPro, MoonUITextareaPro, MoonUIToastPro, MoonUITogglePro, MoonUITooltipContentPro, MoonUITooltipPro, MoonUITooltipProviderPro, MoonUITooltipTriggerPro, UserAnswer as MoonUIUserAnswer, MoonUIalertVariantsPro, MoonUIaspectRatioVariantsPro, MoonUIbreadcrumbVariantsPro, MoonUIcollapsibleContentVariantsPro, MoonUIcollapsibleTriggerVariantsPro, MoonUIcommandVariantsPro, MoonUIradioGroupItemVariantsPro, MoonUItableVariantsPro, MoonUItoggleVariantsPro, OptimizedImage, OptimizedImageProps, MoonUIPaginationPro as Pagination, MoonUIPaginationContentPro as PaginationContent, MoonUIPaginationEllipsisPro as PaginationEllipsis, MoonUIPaginationItemPro as PaginationItem, MoonUIPaginationLinkPro as PaginationLink, MoonUIPaginationNextPro as PaginationNext, MoonUIPaginationPreviousPro as PaginationPrevious, PerformanceAlert, PerformanceDebugger, PerformanceDebuggerProps, PerformanceEntry, PerformanceMetric, PerformanceMetrics, PerformanceMonitor, PerformanceMonitorProps, PhoneNumberInputProps, PinchZoom, MoonUIPopoverPro as Popover, MoonUIPopoverContentPro as PopoverContent, MoonUIPopoverTriggerPro as PopoverTrigger, MoonUIProgressPro as Progress, ProgressData, QuestionType$1 as QuestionType, QuizAnswer, QuizFormProps, QuizQuestion, QuizResult$1 as QuizResult, MoonUIRadioGroupPro as RadioGroup, MoonUIRadioGroupContextPro as RadioGroupContext, MoonUIRadioGroupItemPro as RadioGroupItem, MoonUIRadioItemWithLabelPro as RadioItemWithLabel, MoonUIRadioLabelPro as RadioLabel, RichTextEditor, ScrollArea, ScrollBar, MoonUISelectPro as Select, MoonUISelectContentPro as SelectContent, MoonUISelectGroupPro as SelectGroup, MoonUISelectItemPro as SelectItem, MoonUISelectLabelPro as SelectLabel, MoonUISelectSeparatorPro as SelectSeparator, MoonUISelectTriggerPro as SelectTrigger, MoonUISelectValuePro as SelectValue, SelectableVirtualList, SelectableVirtualListProps, MoonUISeparatorPro as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarConfig, SidebarItem, SidebarSection, SidebarState, MoonUISkeletonPro as Skeleton, MoonUISliderPro as Slider, SpotlightCard, SpotlightCardProps, SwipeableCard, MoonUISwitchPro as Switch, MoonUITablePro as Table, MoonUITableBodyPro as TableBody, MoonUITableCaptionPro as TableCaption, MoonUITableCellPro as TableCell, MoonUITableFooterPro as TableFooter, MoonUITableHeadPro as TableHead, MoonUITableHeaderPro as TableHeader, MoonUITableRowPro as TableRow, MoonUITabsPro as Tabs, MoonUITabsContentPro as TabsContent, MoonUITabsListPro as TabsList, MoonUITabsTriggerPro as TabsTrigger, MoonUITextareaPro as Textarea, Timeline, MoonUIToastPro as Toast, MoonUITogglePro as Toggle, MoonUITooltipPro as Tooltip, MoonUITooltipContentPro as TooltipContent, MoonUITooltipProviderPro as TooltipProvider, MoonUITooltipTriggerPro as TooltipTrigger, VirtualList, VirtualListProps, Widget, WizardStep, WizardStepContentProps, MoonUIalertVariantsPro as alertVariants, animatedButtonVariants, MoonUIaspectRatioVariantsPro as aspectRatioVariants, moonUIBadgeVariantsPro as badgeVariants, MoonUIbreadcrumbVariantsPro as breadcrumbVariants, moonUIButtonProVariants as buttonVariants, cn, MoonUIcollapsibleContentVariantsPro as collapsibleContentVariants, MoonUIcollapsibleTriggerVariantsPro as collapsibleTriggerVariants, MoonUIcommandVariantsPro as commandVariants, getExpandableColumn, moonUIBadgeVariantsPro, moonUIButtonProVariants, moonUISeparatorVariantsPro, countries as phoneCountries, MoonUIradioGroupItemVariantsPro as radioGroupItemVariants, moonUISeparatorVariantsPro as separatorVariants, MoonUItableVariantsPro as tableVariants, MoonUItoggleVariantsPro as toggleVariants, useExpandableRows, useFormWizard, useStreamingData, useVirtualList };
package/dist/index.mjs CHANGED
@@ -49963,25 +49963,25 @@ var GeminiProvider = class {
49963
49963
  return this.callGeminiAPI(prompt);
49964
49964
  }
49965
49965
  async rewrite(text) {
49966
- const prompt = `Rewrite the following text to make it clearer and more engaging while maintaining the same meaning. Only return the rewritten text, nothing else:
49966
+ const prompt = `Rewrite the following text to make it clearer and more engaging while maintaining the same meaning. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the rewritten text, nothing else:
49967
49967
 
49968
49968
  ${text}`;
49969
49969
  return this.callGeminiAPI(prompt);
49970
49970
  }
49971
49971
  async expand(text) {
49972
- const prompt = `Expand the following text with more details, examples, and explanations. Only return the expanded text, nothing else:
49972
+ const prompt = `Expand the following text with more details, examples, and explanations. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the expanded text, nothing else:
49973
49973
 
49974
49974
  ${text}`;
49975
49975
  return this.callGeminiAPI(prompt);
49976
49976
  }
49977
49977
  async summarize(text) {
49978
- const prompt = `Summarize the following text concisely while keeping the main points. Only return the summary, nothing else:
49978
+ const prompt = `Summarize the following text concisely while keeping the main points. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the summary, nothing else:
49979
49979
 
49980
49980
  ${text}`;
49981
49981
  return this.callGeminiAPI(prompt);
49982
49982
  }
49983
49983
  async fixGrammar(text) {
49984
- const prompt = `Fix any grammar and spelling errors in the following text. Only return the corrected text, nothing else:
49984
+ const prompt = `Fix any grammar and spelling errors in the following text. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the corrected text, nothing else:
49985
49985
 
49986
49986
  ${text}`;
49987
49987
  return this.callGeminiAPI(prompt);
@@ -50000,31 +50000,31 @@ ${text}`;
50000
50000
  formal: "formal and academic"
50001
50001
  };
50002
50002
  const toneDesc = toneDescriptions[tone] || tone;
50003
- const prompt = `Rewrite the following text in a ${toneDesc} tone. Only return the rewritten text, nothing else:
50003
+ const prompt = `Rewrite the following text in a ${toneDesc} tone. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the rewritten text, nothing else:
50004
50004
 
50005
50005
  ${text}`;
50006
50006
  return this.callGeminiAPI(prompt);
50007
50007
  }
50008
50008
  async continueWriting(text) {
50009
- const prompt = `Continue writing from where this text ends. Only return the continuation, nothing else:
50009
+ const prompt = `Continue writing from where this text ends. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the continuation, nothing else:
50010
50010
 
50011
50011
  ${text}`;
50012
50012
  return this.callGeminiAPI(prompt);
50013
50013
  }
50014
50014
  async improveWriting(text) {
50015
- const prompt = `Improve the following text by making it more compelling, clear, and well-structured. Only return the improved text, nothing else:
50015
+ const prompt = `Improve the following text by making it more compelling, clear, and well-structured. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the improved text, nothing else:
50016
50016
 
50017
50017
  ${text}`;
50018
50018
  return this.callGeminiAPI(prompt);
50019
50019
  }
50020
50020
  async generateIdeas(text) {
50021
- const prompt = `Generate creative ideas and suggestions based on this topic. Format as a bullet list:
50021
+ const prompt = `Generate creative ideas and suggestions based on this topic. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Format as a bullet list:
50022
50022
 
50023
50023
  ${text}`;
50024
50024
  return this.callGeminiAPI(prompt);
50025
50025
  }
50026
50026
  async complete(text) {
50027
- const prompt = `Complete this text naturally. Only return the completion, nothing else:
50027
+ const prompt = `Complete this text naturally. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the completion, nothing else:
50028
50028
 
50029
50029
  ${text}`;
50030
50030
  return this.callGeminiAPI(prompt);
@@ -50067,29 +50067,29 @@ var OpenAIProvider = class {
50067
50067
  }
50068
50068
  }
50069
50069
  async generateText(prompt) {
50070
- return this.callOpenAI("You are a helpful writing assistant.", prompt);
50070
+ return this.callOpenAI("You are a helpful writing assistant. Always respond in the same language as the input text.", prompt);
50071
50071
  }
50072
50072
  async rewrite(text) {
50073
50073
  return this.callOpenAI(
50074
- "You are a professional editor. Rewrite text to be clearer and more engaging.",
50074
+ "You are a professional editor. Rewrite text to be clearer and more engaging. Always respond in the same language as the input text.",
50075
50075
  text
50076
50076
  );
50077
50077
  }
50078
50078
  async expand(text) {
50079
50079
  return this.callOpenAI(
50080
- "You are a content writer. Expand the given text with more details and examples.",
50080
+ "You are a content writer. Expand the given text with more details and examples. Always respond in the same language as the input text.",
50081
50081
  text
50082
50082
  );
50083
50083
  }
50084
50084
  async summarize(text) {
50085
50085
  return this.callOpenAI(
50086
- "You are a summarization expert. Create concise summaries.",
50086
+ "You are a summarization expert. Create concise summaries. Always respond in the same language as the input text.",
50087
50087
  text
50088
50088
  );
50089
50089
  }
50090
50090
  async fixGrammar(text) {
50091
50091
  return this.callOpenAI(
50092
- "You are a grammar expert. Fix all grammar and spelling errors.",
50092
+ "You are a grammar expert. Fix all grammar and spelling errors. Always respond in the same language as the input text.",
50093
50093
  text
50094
50094
  );
50095
50095
  }
@@ -50101,31 +50101,31 @@ var OpenAIProvider = class {
50101
50101
  }
50102
50102
  async changeTone(text, tone) {
50103
50103
  return this.callOpenAI(
50104
- `You are a writing expert. Rewrite the text in a ${tone} tone.`,
50104
+ `You are a writing expert. Rewrite the text in a ${tone} tone. Always respond in the same language as the input text.`,
50105
50105
  text
50106
50106
  );
50107
50107
  }
50108
50108
  async continueWriting(text) {
50109
50109
  return this.callOpenAI(
50110
- "You are a creative writer. Continue writing from where the text ends.",
50110
+ "You are a creative writer. Continue writing from where the text ends. Always respond in the same language as the input text.",
50111
50111
  text
50112
50112
  );
50113
50113
  }
50114
50114
  async improveWriting(text) {
50115
50115
  return this.callOpenAI(
50116
- "You are a professional editor. Improve the text quality.",
50116
+ "You are a professional editor. Improve the text quality. Always respond in the same language as the input text.",
50117
50117
  text
50118
50118
  );
50119
50119
  }
50120
50120
  async generateIdeas(text) {
50121
50121
  return this.callOpenAI(
50122
- "You are a creative consultant. Generate ideas based on the topic.",
50122
+ "You are a creative consultant. Generate ideas based on the topic. Always respond in the same language as the input text.",
50123
50123
  text
50124
50124
  );
50125
50125
  }
50126
50126
  async complete(text) {
50127
50127
  return this.callOpenAI(
50128
- "You are a writing assistant. Complete the text naturally.",
50128
+ "You are a writing assistant. Complete the text naturally. Always respond in the same language as the input text.",
50129
50129
  text
50130
50130
  );
50131
50131
  }
@@ -50164,25 +50164,27 @@ var ClaudeProvider = class {
50164
50164
  }
50165
50165
  }
50166
50166
  async generateText(prompt) {
50167
- return this.callClaude(prompt);
50167
+ return this.callClaude(`${prompt}
50168
+
50169
+ IMPORTANT: Respond in the SAME LANGUAGE as the input text.`);
50168
50170
  }
50169
50171
  async rewrite(text) {
50170
- return this.callClaude(`Rewrite this text to be clearer and more engaging:
50172
+ return this.callClaude(`Rewrite this text to be clearer and more engaging. IMPORTANT: Respond in the SAME LANGUAGE as the input text:
50171
50173
 
50172
50174
  ${text}`);
50173
50175
  }
50174
50176
  async expand(text) {
50175
- return this.callClaude(`Expand this text with more details:
50177
+ return this.callClaude(`Expand this text with more details. IMPORTANT: Respond in the SAME LANGUAGE as the input text:
50176
50178
 
50177
50179
  ${text}`);
50178
50180
  }
50179
50181
  async summarize(text) {
50180
- return this.callClaude(`Summarize this text concisely:
50182
+ return this.callClaude(`Summarize this text concisely. IMPORTANT: Respond in the SAME LANGUAGE as the input text:
50181
50183
 
50182
50184
  ${text}`);
50183
50185
  }
50184
50186
  async fixGrammar(text) {
50185
- return this.callClaude(`Fix grammar and spelling errors in:
50187
+ return this.callClaude(`Fix grammar and spelling errors. IMPORTANT: Respond in the SAME LANGUAGE as the input text:
50186
50188
 
50187
50189
  ${text}`);
50188
50190
  }
@@ -50192,27 +50194,27 @@ ${text}`);
50192
50194
  ${text}`);
50193
50195
  }
50194
50196
  async changeTone(text, tone) {
50195
- return this.callClaude(`Rewrite in a ${tone} tone:
50197
+ return this.callClaude(`Rewrite in a ${tone} tone. IMPORTANT: Respond in the SAME LANGUAGE as the input text:
50196
50198
 
50197
50199
  ${text}`);
50198
50200
  }
50199
50201
  async continueWriting(text) {
50200
- return this.callClaude(`Continue writing from:
50202
+ return this.callClaude(`Continue writing from where this text ends. IMPORTANT: Respond in the SAME LANGUAGE as the input text:
50201
50203
 
50202
50204
  ${text}`);
50203
50205
  }
50204
50206
  async improveWriting(text) {
50205
- return this.callClaude(`Improve this text:
50207
+ return this.callClaude(`Improve this text. IMPORTANT: Respond in the SAME LANGUAGE as the input text:
50206
50208
 
50207
50209
  ${text}`);
50208
50210
  }
50209
50211
  async generateIdeas(text) {
50210
- return this.callClaude(`Generate ideas for:
50212
+ return this.callClaude(`Generate ideas for this topic. IMPORTANT: Respond in the SAME LANGUAGE as the input text:
50211
50213
 
50212
50214
  ${text}`);
50213
50215
  }
50214
50216
  async complete(text) {
50215
- return this.callClaude(`Complete:
50217
+ return this.callClaude(`Complete this text naturally. IMPORTANT: Respond in the SAME LANGUAGE as the input text:
50216
50218
 
50217
50219
  ${text}`);
50218
50220
  }
@@ -50236,6 +50238,22 @@ styleInject(".slash-commands-menu {\n border-radius: var(--radius);\n border-w
50236
50238
  // src/components/rich-text-editor/table-styles.css
50237
50239
  styleInject('.ProseMirror table {\n border-collapse: collapse;\n margin: 0;\n overflow: hidden;\n table-layout: fixed;\n width: 100%;\n border: 1px solid #d1d5db;\n}\n.ProseMirror table td,\n.ProseMirror table th {\n border: 1px solid #d1d5db;\n box-sizing: border-box;\n min-width: 1em;\n padding: 6px 8px;\n position: relative;\n vertical-align: top;\n}\n.ProseMirror table th {\n background-color: #f9fafb;\n font-weight: 600;\n text-align: left;\n}\n.ProseMirror table .selectedCell:after {\n background-color: rgba(59, 130, 246, 0.1);\n content: "";\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n pointer-events: none;\n position: absolute;\n z-index: 2;\n}\n.ProseMirror table .column-resize-handle {\n background-color: #3b82f6;\n bottom: -2px;\n position: absolute;\n right: -2px;\n top: 0;\n width: 4px;\n pointer-events: none;\n}\n.dark .ProseMirror table {\n border: 1px solid #374151;\n}\n.dark .ProseMirror table td,\n.dark .ProseMirror table th {\n border: 1px solid #374151;\n}\n.dark .ProseMirror table th {\n background-color: #111827;\n}\n.dark .ProseMirror table .selectedCell:after {\n background-color: rgba(59, 130, 246, 0.2);\n}\n');
50238
50240
  var lowlight = createLowlight(grammars);
50241
+ var SUPPORTED_LANGUAGES = [
50242
+ { code: "en", name: "English", nativeName: "English" },
50243
+ { code: "tr", name: "Turkish", nativeName: "T\xFCrk\xE7e" },
50244
+ { code: "es", name: "Spanish", nativeName: "Espa\xF1ol" },
50245
+ { code: "fr", name: "French", nativeName: "Fran\xE7ais" },
50246
+ { code: "de", name: "German", nativeName: "Deutsch" },
50247
+ { code: "it", name: "Italian", nativeName: "Italiano" },
50248
+ { code: "pt", name: "Portuguese", nativeName: "Portugu\xEAs" },
50249
+ { code: "ru", name: "Russian", nativeName: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439" },
50250
+ { code: "zh", name: "Chinese", nativeName: "\u4E2D\u6587" },
50251
+ { code: "ja", name: "Japanese", nativeName: "\u65E5\u672C\u8A9E" },
50252
+ { code: "ko", name: "Korean", nativeName: "\uD55C\uAD6D\uC5B4" },
50253
+ { code: "ar", name: "Arabic", nativeName: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629" },
50254
+ { code: "hi", name: "Hindi", nativeName: "\u0939\u093F\u0928\u094D\u0926\u0940" },
50255
+ { code: "nl", name: "Dutch", nativeName: "Nederlands" }
50256
+ ];
50239
50257
  var getAIProvider = (settings) => {
50240
50258
  if (!settings.apiKey)
50241
50259
  return null;
@@ -50367,7 +50385,8 @@ function RichTextEditor({
50367
50385
  model: "gpt-3.5-turbo",
50368
50386
  temperature: 0.7,
50369
50387
  maxTokens: 1e3
50370
- }
50388
+ },
50389
+ persistAISettings = true
50371
50390
  }) {
50372
50391
  const { hasProAccess, isLoading } = useSubscription();
50373
50392
  if (!isLoading && !hasProAccess) {
@@ -50383,12 +50402,31 @@ function RichTextEditor({
50383
50402
  ] })
50384
50403
  ] }) }) });
50385
50404
  }
50386
- const [aiSettings, setAiSettings] = useState({
50387
- provider: aiConfig.provider || "openai",
50388
- apiKey: aiConfig.apiKey || "",
50389
- model: aiConfig.model || "gpt-4",
50390
- temperature: aiConfig.temperature || 0.7,
50391
- maxTokens: aiConfig.maxTokens || 1e3
50405
+ const [aiSettings, setAiSettings] = useState(() => {
50406
+ if (persistAISettings) {
50407
+ try {
50408
+ const stored = localStorage.getItem("moonui-ai-settings");
50409
+ if (stored) {
50410
+ const parsed = JSON.parse(stored);
50411
+ return {
50412
+ provider: aiConfig.provider || parsed.provider || "openai",
50413
+ apiKey: aiConfig.apiKey || parsed.apiKey || "",
50414
+ model: aiConfig.model || parsed.model || "gpt-3.5-turbo",
50415
+ temperature: aiConfig.temperature ?? parsed.temperature ?? 0.7,
50416
+ maxTokens: aiConfig.maxTokens ?? parsed.maxTokens ?? 1e3
50417
+ };
50418
+ }
50419
+ } catch (e) {
50420
+ console.error("Failed to load AI settings from localStorage:", e);
50421
+ }
50422
+ }
50423
+ return {
50424
+ provider: aiConfig.provider || "openai",
50425
+ apiKey: aiConfig.apiKey || "",
50426
+ model: aiConfig.model || "gpt-3.5-turbo",
50427
+ temperature: aiConfig.temperature ?? 0.7,
50428
+ maxTokens: aiConfig.maxTokens ?? 1e3
50429
+ };
50392
50430
  });
50393
50431
  const [isAiSettingsOpen, setIsAiSettingsOpen] = useState(false);
50394
50432
  const [isProcessing, setIsProcessing] = useState(false);
@@ -50396,6 +50434,12 @@ function RichTextEditor({
50396
50434
  const [sourceContent, setSourceContent] = useState("");
50397
50435
  const [currentTextColor, setCurrentTextColor] = useState("#000000");
50398
50436
  const [currentBgColor, setCurrentBgColor] = useState("#ffffff");
50437
+ const [lastTranslateLanguage, setLastTranslateLanguage] = useState(() => {
50438
+ if (typeof window !== "undefined") {
50439
+ return localStorage.getItem("moonui-last-translate-language") || "en";
50440
+ }
50441
+ return "en";
50442
+ });
50399
50443
  const slashCommands = [
50400
50444
  {
50401
50445
  id: "rewrite",
@@ -50584,7 +50628,7 @@ function RichTextEditor({
50584
50628
  },
50585
50629
  immediatelyRender: false
50586
50630
  });
50587
- const callAI = async (action, text) => {
50631
+ const callAI = async (action, text, targetLanguage) => {
50588
50632
  if (!aiSettings.apiKey) {
50589
50633
  toast({
50590
50634
  title: "API Key Required",
@@ -50615,7 +50659,7 @@ function RichTextEditor({
50615
50659
  response = await provider.fixGrammar(text);
50616
50660
  break;
50617
50661
  case "translate":
50618
- response = await provider.translate(text, "Turkish");
50662
+ response = await provider.translate(text, targetLanguage || "English");
50619
50663
  break;
50620
50664
  case "tone_professional":
50621
50665
  response = await provider.changeTone(text, "professional");
@@ -50653,7 +50697,7 @@ function RichTextEditor({
50653
50697
  setIsProcessing(false);
50654
50698
  }
50655
50699
  };
50656
- const handleAIAction = async (action) => {
50700
+ const handleAIAction = async (action, targetLanguage) => {
50657
50701
  if (!editor)
50658
50702
  return;
50659
50703
  const selection = editor.state.selection;
@@ -50668,11 +50712,11 @@ function RichTextEditor({
50668
50712
  }
50669
50713
  const processingToast = toast({
50670
50714
  title: "Processing with AI...",
50671
- description: getActionDescription(action),
50715
+ description: getActionDescription(action, targetLanguage),
50672
50716
  duration: 6e4
50673
50717
  // Long duration
50674
50718
  });
50675
- const result = await callAI(action, selectedText || editor.getText());
50719
+ const result = await callAI(action, selectedText || editor.getText(), targetLanguage);
50676
50720
  processingToast.dismiss();
50677
50721
  if (result) {
50678
50722
  if (selectedText) {
@@ -50686,14 +50730,14 @@ function RichTextEditor({
50686
50730
  });
50687
50731
  }
50688
50732
  };
50689
- const getActionDescription = (action) => {
50733
+ const getActionDescription = (action, targetLanguage) => {
50690
50734
  const descriptions = {
50691
50735
  rewrite: "Rewriting your text...",
50692
50736
  improve: "Improving your writing...",
50693
50737
  expand: "Expanding your text...",
50694
50738
  summarize: "Creating a summary...",
50695
50739
  fix: "Fixing grammar and spelling...",
50696
- translate: "Translating to Turkish...",
50740
+ translate: targetLanguage ? `Translating to ${SUPPORTED_LANGUAGES.find((l) => l.name === targetLanguage)?.nativeName || targetLanguage}...` : "Translating...",
50697
50741
  tone_professional: "Making text professional...",
50698
50742
  tone_casual: "Making text casual...",
50699
50743
  tone_friendly: "Making text friendly...",
@@ -51357,17 +51401,30 @@ function RichTextEditor({
51357
51401
  ]
51358
51402
  }
51359
51403
  ),
51360
- /* @__PURE__ */ jsxs(
51361
- MoonUIDropdownMenuItemPro,
51362
- {
51363
- onClick: () => handleAIAction("translate"),
51364
- disabled: isProcessing,
51365
- children: [
51366
- /* @__PURE__ */ jsx(Languages, { className: "w-4 h-4 mr-2" }),
51367
- "Translate to Turkish"
51368
- ]
51369
- }
51370
- ),
51404
+ /* @__PURE__ */ jsxs(MoonUIDropdownMenuSubPro, { children: [
51405
+ /* @__PURE__ */ jsxs(MoonUIDropdownMenuSubTriggerPro, { disabled: isProcessing, children: [
51406
+ /* @__PURE__ */ jsx(Languages, { className: "w-4 h-4 mr-2" }),
51407
+ "Translate",
51408
+ lastTranslateLanguage && /* @__PURE__ */ jsx("span", { className: "ml-auto text-xs text-muted-foreground", children: SUPPORTED_LANGUAGES.find((l) => l.code === lastTranslateLanguage)?.nativeName || "English" })
51409
+ ] }),
51410
+ /* @__PURE__ */ jsx(MoonUIDropdownMenuSubContentPro, { className: "w-56", children: SUPPORTED_LANGUAGES.map((language) => /* @__PURE__ */ jsxs(
51411
+ MoonUIDropdownMenuItemPro,
51412
+ {
51413
+ onClick: () => {
51414
+ setLastTranslateLanguage(language.code);
51415
+ localStorage.setItem("moonui-last-translate-language", language.code);
51416
+ handleAIAction("translate", language.name);
51417
+ },
51418
+ disabled: isProcessing,
51419
+ children: [
51420
+ /* @__PURE__ */ jsx("span", { className: "text-sm", children: language.nativeName }),
51421
+ /* @__PURE__ */ jsx("span", { className: "ml-auto text-xs text-muted-foreground", children: language.name }),
51422
+ lastTranslateLanguage === language.code && /* @__PURE__ */ jsx(Check, { className: "w-4 h-4 ml-2 text-primary" })
51423
+ ]
51424
+ },
51425
+ language.code
51426
+ )) })
51427
+ ] }),
51371
51428
  /* @__PURE__ */ jsxs(
51372
51429
  MoonUIDropdownMenuItemPro,
51373
51430
  {
@@ -51524,13 +51581,61 @@ function RichTextEditor({
51524
51581
  ] })
51525
51582
  ] })
51526
51583
  ] }),
51527
- /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(MoonUIButtonPro, { onClick: () => {
51528
- setIsAiSettingsOpen(false);
51529
- toast({
51530
- title: "Settings saved",
51531
- description: "Your AI settings have been updated."
51532
- });
51533
- }, children: "Save Settings" }) })
51584
+ persistAISettings && /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
51585
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start space-x-2", children: [
51586
+ /* @__PURE__ */ jsx(
51587
+ MoonUICheckboxPro,
51588
+ {
51589
+ id: "rememberSettings",
51590
+ defaultChecked: true,
51591
+ onCheckedChange: (checked) => {
51592
+ if (!checked) {
51593
+ localStorage.removeItem("moonui-ai-settings");
51594
+ }
51595
+ }
51596
+ }
51597
+ ),
51598
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-1.5 leading-none", children: [
51599
+ /* @__PURE__ */ jsx(
51600
+ MoonUILabelPro,
51601
+ {
51602
+ htmlFor: "rememberSettings",
51603
+ className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
51604
+ children: "Remember my settings"
51605
+ }
51606
+ ),
51607
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Save settings locally for future sessions" })
51608
+ ] })
51609
+ ] }),
51610
+ aiSettings.apiKey && /* @__PURE__ */ jsx("div", { className: "rounded-md bg-yellow-50 dark:bg-yellow-900/10 p-3", children: /* @__PURE__ */ jsxs("div", { className: "flex", children: [
51611
+ /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx(Settings, { className: "h-4 w-4 text-yellow-400" }) }),
51612
+ /* @__PURE__ */ jsx("div", { className: "ml-3", children: /* @__PURE__ */ jsxs("p", { className: "text-xs text-yellow-800 dark:text-yellow-200", children: [
51613
+ /* @__PURE__ */ jsx("strong", { children: "Security Notice:" }),
51614
+ " API keys will be stored in your browser's local storage. For production use, consider using a server-side proxy."
51615
+ ] }) })
51616
+ ] }) })
51617
+ ] }),
51618
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
51619
+ /* @__PURE__ */ jsx(
51620
+ MoonUIButtonPro,
51621
+ {
51622
+ variant: "outline",
51623
+ onClick: () => setIsAiSettingsOpen(false),
51624
+ children: "Cancel"
51625
+ }
51626
+ ),
51627
+ /* @__PURE__ */ jsx(MoonUIButtonPro, { onClick: () => {
51628
+ if (persistAISettings) {
51629
+ const toStore = { ...aiSettings };
51630
+ localStorage.setItem("moonui-ai-settings", JSON.stringify(toStore));
51631
+ }
51632
+ setIsAiSettingsOpen(false);
51633
+ toast({
51634
+ title: "Settings saved",
51635
+ description: "Your AI settings have been updated."
51636
+ });
51637
+ }, children: "Save Settings" })
51638
+ ] })
51534
51639
  ] })
51535
51640
  ] })
51536
51641
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.8.5",
3
+ "version": "2.8.7",
4
4
  "description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -83,6 +83,9 @@ import {
83
83
  DropdownMenuItem,
84
84
  DropdownMenuSeparator,
85
85
  DropdownMenuTrigger,
86
+ DropdownMenuSub,
87
+ DropdownMenuSubContent,
88
+ DropdownMenuSubTrigger,
86
89
  } from '../ui/dropdown-menu';
87
90
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip';
88
91
  import {
@@ -101,6 +104,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';
101
104
  import { MoonUIColorPickerPro as ColorPicker } from '../ui/color-picker';
102
105
  import { Slider } from '../ui/slider';
103
106
  import { toast } from '../ui/toast';
107
+ import { Checkbox } from '../ui/checkbox';
104
108
  import { createAIProvider, type AIProvider as AIProviderInterface } from '../../lib/ai-providers';
105
109
 
106
110
  // Type definitions for AI functionality
@@ -114,6 +118,24 @@ interface AISettingsType {
114
118
  maxTokens?: number
115
119
  }
116
120
 
121
+ // Supported languages for translation
122
+ const SUPPORTED_LANGUAGES = [
123
+ { code: 'en', name: 'English', nativeName: 'English' },
124
+ { code: 'tr', name: 'Turkish', nativeName: 'Türkçe' },
125
+ { code: 'es', name: 'Spanish', nativeName: 'Español' },
126
+ { code: 'fr', name: 'French', nativeName: 'Français' },
127
+ { code: 'de', name: 'German', nativeName: 'Deutsch' },
128
+ { code: 'it', name: 'Italian', nativeName: 'Italiano' },
129
+ { code: 'pt', name: 'Portuguese', nativeName: 'Português' },
130
+ { code: 'ru', name: 'Russian', nativeName: 'Русский' },
131
+ { code: 'zh', name: 'Chinese', nativeName: '中文' },
132
+ { code: 'ja', name: 'Japanese', nativeName: '日本語' },
133
+ { code: 'ko', name: 'Korean', nativeName: '한국어' },
134
+ { code: 'ar', name: 'Arabic', nativeName: 'العربية' },
135
+ { code: 'hi', name: 'Hindi', nativeName: 'हिन्दी' },
136
+ { code: 'nl', name: 'Dutch', nativeName: 'Nederlands' },
137
+ ];
138
+
117
139
  interface SlashCommand {
118
140
  id?: string
119
141
  title?: string
@@ -153,6 +175,15 @@ const getAIProvider = (settings: AISettingsType): AIProviderInterface | null =>
153
175
  import './slash-commands.css';
154
176
  import './table-styles.css';
155
177
 
178
+ export interface AIConfig {
179
+ provider?: 'openai' | 'claude' | 'gemini' | 'cohere';
180
+ apiKey?: string;
181
+ model?: string;
182
+ temperature?: number;
183
+ maxTokens?: number;
184
+ endpoint?: string; // For server-side proxy
185
+ }
186
+
156
187
  interface RichTextEditorProps {
157
188
  value?: string;
158
189
  onChange?: (value: string) => void;
@@ -175,13 +206,8 @@ interface RichTextEditorProps {
175
206
  color?: boolean;
176
207
  ai?: boolean;
177
208
  };
178
- aiConfig?: {
179
- provider?: 'openai' | 'claude' | 'gemini' | 'cohere';
180
- apiKey?: string;
181
- model?: string;
182
- temperature?: number;
183
- maxTokens?: number;
184
- };
209
+ aiConfig?: AIConfig;
210
+ persistAISettings?: boolean;
185
211
  }
186
212
 
187
213
 
@@ -281,6 +307,7 @@ export function RichTextEditor({
281
307
  temperature: 0.7,
282
308
  maxTokens: 1000,
283
309
  },
310
+ persistAISettings = true,
284
311
  }: RichTextEditorProps) {
285
312
  // Pro access kontrolü
286
313
  const { hasProAccess, isLoading } = useSubscription();
@@ -316,12 +343,35 @@ export function RichTextEditor({
316
343
  );
317
344
  }
318
345
 
319
- const [aiSettings, setAiSettings] = useState<AISettingsType>({
320
- provider: aiConfig.provider || 'openai',
321
- apiKey: aiConfig.apiKey || '',
322
- model: aiConfig.model || 'gpt-4',
323
- temperature: aiConfig.temperature || 0.7,
324
- maxTokens: aiConfig.maxTokens || 1000,
346
+ const [aiSettings, setAiSettings] = useState<AISettingsType>(() => {
347
+ // Öncelik sırası: Props > LocalStorage > Varsayılan
348
+ if (persistAISettings) {
349
+ try {
350
+ const stored = localStorage.getItem('moonui-ai-settings');
351
+ if (stored) {
352
+ const parsed = JSON.parse(stored);
353
+ // Props'tan gelen değerler her zaman öncelikli
354
+ return {
355
+ provider: aiConfig.provider || parsed.provider || 'openai',
356
+ apiKey: aiConfig.apiKey || parsed.apiKey || '',
357
+ model: aiConfig.model || parsed.model || 'gpt-3.5-turbo',
358
+ temperature: aiConfig.temperature ?? parsed.temperature ?? 0.7,
359
+ maxTokens: aiConfig.maxTokens ?? parsed.maxTokens ?? 1000,
360
+ };
361
+ }
362
+ } catch (e) {
363
+ console.error('Failed to load AI settings from localStorage:', e);
364
+ }
365
+ }
366
+
367
+ // LocalStorage yoksa veya persist kapalıysa props/varsayılan değerleri kullan
368
+ return {
369
+ provider: aiConfig.provider || 'openai',
370
+ apiKey: aiConfig.apiKey || '',
371
+ model: aiConfig.model || 'gpt-3.5-turbo',
372
+ temperature: aiConfig.temperature ?? 0.7,
373
+ maxTokens: aiConfig.maxTokens ?? 1000,
374
+ };
325
375
  });
326
376
  const [isAiSettingsOpen, setIsAiSettingsOpen] = useState(false);
327
377
  const [isProcessing, setIsProcessing] = useState(false);
@@ -329,6 +379,13 @@ export function RichTextEditor({
329
379
  const [sourceContent, setSourceContent] = useState('');
330
380
  const [currentTextColor, setCurrentTextColor] = useState('#000000');
331
381
  const [currentBgColor, setCurrentBgColor] = useState('#ffffff');
382
+ const [lastTranslateLanguage, setLastTranslateLanguage] = useState<string>(() => {
383
+ // Son kullanılan dili localStorage'dan al
384
+ if (typeof window !== 'undefined') {
385
+ return localStorage.getItem('moonui-last-translate-language') || 'en';
386
+ }
387
+ return 'en';
388
+ });
332
389
 
333
390
  // Slash commands tanımları
334
391
  const slashCommands: SlashCommand[] = [
@@ -522,7 +579,7 @@ export function RichTextEditor({
522
579
  });
523
580
 
524
581
  // AI işlevleri
525
- const callAI = async (action: string, text: string) => {
582
+ const callAI = async (action: string, text: string, targetLanguage?: string) => {
526
583
  if (!aiSettings.apiKey) {
527
584
  toast({
528
585
  title: "API Key Required",
@@ -556,7 +613,7 @@ export function RichTextEditor({
556
613
  response = await provider.fixGrammar(text);
557
614
  break;
558
615
  case 'translate':
559
- response = await provider.translate(text, 'Turkish');
616
+ response = await provider.translate(text, targetLanguage || 'English');
560
617
  break;
561
618
  case 'tone_professional':
562
619
  response = await provider.changeTone(text, 'professional');
@@ -596,7 +653,7 @@ export function RichTextEditor({
596
653
  }
597
654
  };
598
655
 
599
- const handleAIAction = async (action: string) => {
656
+ const handleAIAction = async (action: string, targetLanguage?: string) => {
600
657
  if (!editor) return;
601
658
 
602
659
  const selection = editor.state.selection;
@@ -614,11 +671,11 @@ export function RichTextEditor({
614
671
  // Show processing toast
615
672
  const processingToast = toast({
616
673
  title: "Processing with AI...",
617
- description: getActionDescription(action),
674
+ description: getActionDescription(action, targetLanguage),
618
675
  duration: 60000, // Long duration
619
676
  });
620
677
 
621
- const result = await callAI(action, selectedText || editor.getText());
678
+ const result = await callAI(action, selectedText || editor.getText(), targetLanguage);
622
679
 
623
680
  // Dismiss processing toast
624
681
  processingToast.dismiss();
@@ -638,14 +695,14 @@ export function RichTextEditor({
638
695
  }
639
696
  };
640
697
 
641
- const getActionDescription = (action: string): string => {
698
+ const getActionDescription = (action: string, targetLanguage?: string): string => {
642
699
  const descriptions: Record<string, string> = {
643
700
  rewrite: "Rewriting your text...",
644
701
  improve: "Improving your writing...",
645
702
  expand: "Expanding your text...",
646
703
  summarize: "Creating a summary...",
647
704
  fix: "Fixing grammar and spelling...",
648
- translate: "Translating to Turkish...",
705
+ translate: targetLanguage ? `Translating to ${SUPPORTED_LANGUAGES.find(l => l.name === targetLanguage)?.nativeName || targetLanguage}...` : "Translating...",
649
706
  tone_professional: "Making text professional...",
650
707
  tone_casual: "Making text casual...",
651
708
  tone_friendly: "Making text friendly...",
@@ -1358,13 +1415,38 @@ export function RichTextEditor({
1358
1415
  Fix Grammar & Spelling
1359
1416
  <span className="ml-auto text-xs text-muted-foreground">F7</span>
1360
1417
  </DropdownMenuItem>
1361
- <DropdownMenuItem
1362
- onClick={() => handleAIAction('translate')}
1363
- disabled={isProcessing}
1364
- >
1365
- <Languages className="w-4 h-4 mr-2" />
1366
- Translate to Turkish
1367
- </DropdownMenuItem>
1418
+ <DropdownMenuSub>
1419
+ <DropdownMenuSubTrigger disabled={isProcessing}>
1420
+ <Languages className="w-4 h-4 mr-2" />
1421
+ Translate
1422
+ {lastTranslateLanguage && (
1423
+ <span className="ml-auto text-xs text-muted-foreground">
1424
+ {SUPPORTED_LANGUAGES.find(l => l.code === lastTranslateLanguage)?.nativeName || 'English'}
1425
+ </span>
1426
+ )}
1427
+ </DropdownMenuSubTrigger>
1428
+ <DropdownMenuSubContent className="w-56">
1429
+ {SUPPORTED_LANGUAGES.map((language) => (
1430
+ <DropdownMenuItem
1431
+ key={language.code}
1432
+ onClick={() => {
1433
+ // Dili kaydet
1434
+ setLastTranslateLanguage(language.code);
1435
+ localStorage.setItem('moonui-last-translate-language', language.code);
1436
+ // Çeviriyi yap
1437
+ handleAIAction('translate', language.name);
1438
+ }}
1439
+ disabled={isProcessing}
1440
+ >
1441
+ <span className="text-sm">{language.nativeName}</span>
1442
+ <span className="ml-auto text-xs text-muted-foreground">{language.name}</span>
1443
+ {lastTranslateLanguage === language.code && (
1444
+ <Check className="w-4 h-4 ml-2 text-primary" />
1445
+ )}
1446
+ </DropdownMenuItem>
1447
+ ))}
1448
+ </DropdownMenuSubContent>
1449
+ </DropdownMenuSub>
1368
1450
  <DropdownMenuItem
1369
1451
  onClick={() => handleAIAction('ideas')}
1370
1452
  disabled={isProcessing}
@@ -1523,8 +1605,64 @@ export function RichTextEditor({
1523
1605
  </div>
1524
1606
  </div>
1525
1607
  </div>
1526
- <div className="flex justify-end">
1608
+ {persistAISettings && (
1609
+ <div className="space-y-4">
1610
+ <div className="flex items-start space-x-2">
1611
+ <Checkbox
1612
+ id="rememberSettings"
1613
+ defaultChecked
1614
+ onCheckedChange={(checked) => {
1615
+ if (!checked) {
1616
+ localStorage.removeItem('moonui-ai-settings');
1617
+ }
1618
+ }}
1619
+ />
1620
+ <div className="grid gap-1.5 leading-none">
1621
+ <Label
1622
+ htmlFor="rememberSettings"
1623
+ className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
1624
+ >
1625
+ Remember my settings
1626
+ </Label>
1627
+ <p className="text-xs text-muted-foreground">
1628
+ Save settings locally for future sessions
1629
+ </p>
1630
+ </div>
1631
+ </div>
1632
+
1633
+ {aiSettings.apiKey && (
1634
+ <div className="rounded-md bg-yellow-50 dark:bg-yellow-900/10 p-3">
1635
+ <div className="flex">
1636
+ <div className="flex-shrink-0">
1637
+ <Settings className="h-4 w-4 text-yellow-400" />
1638
+ </div>
1639
+ <div className="ml-3">
1640
+ <p className="text-xs text-yellow-800 dark:text-yellow-200">
1641
+ <strong>Security Notice:</strong> API keys will be stored in your browser's local storage.
1642
+ For production use, consider using a server-side proxy.
1643
+ </p>
1644
+ </div>
1645
+ </div>
1646
+ </div>
1647
+ )}
1648
+ </div>
1649
+ )}
1650
+
1651
+ <div className="flex justify-end gap-2">
1652
+ <Button
1653
+ variant="outline"
1654
+ onClick={() => setIsAiSettingsOpen(false)}
1655
+ >
1656
+ Cancel
1657
+ </Button>
1527
1658
  <Button onClick={() => {
1659
+ // LocalStorage'a kaydet
1660
+ if (persistAISettings) {
1661
+ const toStore = { ...aiSettings };
1662
+ // Güvenlik için API key'i opsiyonel olarak kaydet
1663
+ localStorage.setItem('moonui-ai-settings', JSON.stringify(toStore));
1664
+ }
1665
+
1528
1666
  setIsAiSettingsOpen(false);
1529
1667
  toast({
1530
1668
  title: "Settings saved",
@@ -94,22 +94,22 @@ export class GeminiProvider implements AIProvider {
94
94
  }
95
95
 
96
96
  async rewrite(text: string): Promise<string> {
97
- const prompt = `Rewrite the following text to make it clearer and more engaging while maintaining the same meaning. Only return the rewritten text, nothing else:\n\n${text}`;
97
+ const prompt = `Rewrite the following text to make it clearer and more engaging while maintaining the same meaning. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the rewritten text, nothing else:\n\n${text}`;
98
98
  return this.callGeminiAPI(prompt);
99
99
  }
100
100
 
101
101
  async expand(text: string): Promise<string> {
102
- const prompt = `Expand the following text with more details, examples, and explanations. Only return the expanded text, nothing else:\n\n${text}`;
102
+ const prompt = `Expand the following text with more details, examples, and explanations. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the expanded text, nothing else:\n\n${text}`;
103
103
  return this.callGeminiAPI(prompt);
104
104
  }
105
105
 
106
106
  async summarize(text: string): Promise<string> {
107
- const prompt = `Summarize the following text concisely while keeping the main points. Only return the summary, nothing else:\n\n${text}`;
107
+ const prompt = `Summarize the following text concisely while keeping the main points. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the summary, nothing else:\n\n${text}`;
108
108
  return this.callGeminiAPI(prompt);
109
109
  }
110
110
 
111
111
  async fixGrammar(text: string): Promise<string> {
112
- const prompt = `Fix any grammar and spelling errors in the following text. Only return the corrected text, nothing else:\n\n${text}`;
112
+ const prompt = `Fix any grammar and spelling errors in the following text. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the corrected text, nothing else:\n\n${text}`;
113
113
  return this.callGeminiAPI(prompt);
114
114
  }
115
115
 
@@ -127,27 +127,27 @@ export class GeminiProvider implements AIProvider {
127
127
  };
128
128
 
129
129
  const toneDesc = toneDescriptions[tone] || tone;
130
- const prompt = `Rewrite the following text in a ${toneDesc} tone. Only return the rewritten text, nothing else:\n\n${text}`;
130
+ const prompt = `Rewrite the following text in a ${toneDesc} tone. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the rewritten text, nothing else:\n\n${text}`;
131
131
  return this.callGeminiAPI(prompt);
132
132
  }
133
133
 
134
134
  async continueWriting(text: string): Promise<string> {
135
- const prompt = `Continue writing from where this text ends. Only return the continuation, nothing else:\n\n${text}`;
135
+ const prompt = `Continue writing from where this text ends. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the continuation, nothing else:\n\n${text}`;
136
136
  return this.callGeminiAPI(prompt);
137
137
  }
138
138
 
139
139
  async improveWriting(text: string): Promise<string> {
140
- const prompt = `Improve the following text by making it more compelling, clear, and well-structured. Only return the improved text, nothing else:\n\n${text}`;
140
+ const prompt = `Improve the following text by making it more compelling, clear, and well-structured. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the improved text, nothing else:\n\n${text}`;
141
141
  return this.callGeminiAPI(prompt);
142
142
  }
143
143
 
144
144
  async generateIdeas(text: string): Promise<string> {
145
- const prompt = `Generate creative ideas and suggestions based on this topic. Format as a bullet list:\n\n${text}`;
145
+ const prompt = `Generate creative ideas and suggestions based on this topic. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Format as a bullet list:\n\n${text}`;
146
146
  return this.callGeminiAPI(prompt);
147
147
  }
148
148
 
149
149
  async complete(text: string): Promise<string> {
150
- const prompt = `Complete this text naturally. Only return the completion, nothing else:\n\n${text}`;
150
+ const prompt = `Complete this text naturally. IMPORTANT: Respond in the SAME LANGUAGE as the input text. Only return the completion, nothing else:\n\n${text}`;
151
151
  return this.callGeminiAPI(prompt);
152
152
  }
153
153
  }
@@ -199,33 +199,33 @@ export class OpenAIProvider implements AIProvider {
199
199
  }
200
200
 
201
201
  async generateText(prompt: string): Promise<string> {
202
- return this.callOpenAI('You are a helpful writing assistant.', prompt);
202
+ return this.callOpenAI('You are a helpful writing assistant. Always respond in the same language as the input text.', prompt);
203
203
  }
204
204
 
205
205
  async rewrite(text: string): Promise<string> {
206
206
  return this.callOpenAI(
207
- 'You are a professional editor. Rewrite text to be clearer and more engaging.',
207
+ 'You are a professional editor. Rewrite text to be clearer and more engaging. Always respond in the same language as the input text.',
208
208
  text
209
209
  );
210
210
  }
211
211
 
212
212
  async expand(text: string): Promise<string> {
213
213
  return this.callOpenAI(
214
- 'You are a content writer. Expand the given text with more details and examples.',
214
+ 'You are a content writer. Expand the given text with more details and examples. Always respond in the same language as the input text.',
215
215
  text
216
216
  );
217
217
  }
218
218
 
219
219
  async summarize(text: string): Promise<string> {
220
220
  return this.callOpenAI(
221
- 'You are a summarization expert. Create concise summaries.',
221
+ 'You are a summarization expert. Create concise summaries. Always respond in the same language as the input text.',
222
222
  text
223
223
  );
224
224
  }
225
225
 
226
226
  async fixGrammar(text: string): Promise<string> {
227
227
  return this.callOpenAI(
228
- 'You are a grammar expert. Fix all grammar and spelling errors.',
228
+ 'You are a grammar expert. Fix all grammar and spelling errors. Always respond in the same language as the input text.',
229
229
  text
230
230
  );
231
231
  }
@@ -239,35 +239,35 @@ export class OpenAIProvider implements AIProvider {
239
239
 
240
240
  async changeTone(text: string, tone: string): Promise<string> {
241
241
  return this.callOpenAI(
242
- `You are a writing expert. Rewrite the text in a ${tone} tone.`,
242
+ `You are a writing expert. Rewrite the text in a ${tone} tone. Always respond in the same language as the input text.`,
243
243
  text
244
244
  );
245
245
  }
246
246
 
247
247
  async continueWriting(text: string): Promise<string> {
248
248
  return this.callOpenAI(
249
- 'You are a creative writer. Continue writing from where the text ends.',
249
+ 'You are a creative writer. Continue writing from where the text ends. Always respond in the same language as the input text.',
250
250
  text
251
251
  );
252
252
  }
253
253
 
254
254
  async improveWriting(text: string): Promise<string> {
255
255
  return this.callOpenAI(
256
- 'You are a professional editor. Improve the text quality.',
256
+ 'You are a professional editor. Improve the text quality. Always respond in the same language as the input text.',
257
257
  text
258
258
  );
259
259
  }
260
260
 
261
261
  async generateIdeas(text: string): Promise<string> {
262
262
  return this.callOpenAI(
263
- 'You are a creative consultant. Generate ideas based on the topic.',
263
+ 'You are a creative consultant. Generate ideas based on the topic. Always respond in the same language as the input text.',
264
264
  text
265
265
  );
266
266
  }
267
267
 
268
268
  async complete(text: string): Promise<string> {
269
269
  return this.callOpenAI(
270
- 'You are a writing assistant. Complete the text naturally.',
270
+ 'You are a writing assistant. Complete the text naturally. Always respond in the same language as the input text.',
271
271
  text
272
272
  );
273
273
  }
@@ -315,23 +315,23 @@ export class ClaudeProvider implements AIProvider {
315
315
  }
316
316
 
317
317
  async generateText(prompt: string): Promise<string> {
318
- return this.callClaude(prompt);
318
+ return this.callClaude(`${prompt}\n\nIMPORTANT: Respond in the SAME LANGUAGE as the input text.`);
319
319
  }
320
320
 
321
321
  async rewrite(text: string): Promise<string> {
322
- return this.callClaude(`Rewrite this text to be clearer and more engaging:\n\n${text}`);
322
+ return this.callClaude(`Rewrite this text to be clearer and more engaging. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
323
323
  }
324
324
 
325
325
  async expand(text: string): Promise<string> {
326
- return this.callClaude(`Expand this text with more details:\n\n${text}`);
326
+ return this.callClaude(`Expand this text with more details. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
327
327
  }
328
328
 
329
329
  async summarize(text: string): Promise<string> {
330
- return this.callClaude(`Summarize this text concisely:\n\n${text}`);
330
+ return this.callClaude(`Summarize this text concisely. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
331
331
  }
332
332
 
333
333
  async fixGrammar(text: string): Promise<string> {
334
- return this.callClaude(`Fix grammar and spelling errors in:\n\n${text}`);
334
+ return this.callClaude(`Fix grammar and spelling errors. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
335
335
  }
336
336
 
337
337
  async translate(text: string, targetLang: string): Promise<string> {
@@ -339,23 +339,23 @@ export class ClaudeProvider implements AIProvider {
339
339
  }
340
340
 
341
341
  async changeTone(text: string, tone: string): Promise<string> {
342
- return this.callClaude(`Rewrite in a ${tone} tone:\n\n${text}`);
342
+ return this.callClaude(`Rewrite in a ${tone} tone. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
343
343
  }
344
344
 
345
345
  async continueWriting(text: string): Promise<string> {
346
- return this.callClaude(`Continue writing from:\n\n${text}`);
346
+ return this.callClaude(`Continue writing from where this text ends. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
347
347
  }
348
348
 
349
349
  async improveWriting(text: string): Promise<string> {
350
- return this.callClaude(`Improve this text:\n\n${text}`);
350
+ return this.callClaude(`Improve this text. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
351
351
  }
352
352
 
353
353
  async generateIdeas(text: string): Promise<string> {
354
- return this.callClaude(`Generate ideas for:\n\n${text}`);
354
+ return this.callClaude(`Generate ideas for this topic. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
355
355
  }
356
356
 
357
357
  async complete(text: string): Promise<string> {
358
- return this.callClaude(`Complete:\n\n${text}`);
358
+ return this.callClaude(`Complete this text naturally. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
359
359
  }
360
360
  }
361
361