@moontra/moonui-pro 2.8.7 → 2.8.8

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.mjs CHANGED
@@ -50403,7 +50403,7 @@ function RichTextEditor({
50403
50403
  ] }) }) });
50404
50404
  }
50405
50405
  const [aiSettings, setAiSettings] = useState(() => {
50406
- if (persistAISettings) {
50406
+ if (persistAISettings && typeof window !== "undefined") {
50407
50407
  try {
50408
50408
  const stored = localStorage.getItem("moonui-ai-settings");
50409
50409
  if (stored) {
@@ -51485,11 +51485,15 @@ function RichTextEditor({
51485
51485
  gemini: "gemini-2.0-flash",
51486
51486
  cohere: "command"
51487
51487
  };
51488
- setAiSettings({
51488
+ const newSettings = {
51489
51489
  ...aiSettings,
51490
51490
  provider: value,
51491
51491
  model: defaultModels[value] || "gpt-3.5-turbo"
51492
- });
51492
+ };
51493
+ setAiSettings(newSettings);
51494
+ if (persistAISettings) {
51495
+ localStorage.setItem("moonui-ai-settings", JSON.stringify(newSettings));
51496
+ }
51493
51497
  },
51494
51498
  children: [
51495
51499
  /* @__PURE__ */ jsx(MoonUISelectTriggerPro, { children: /* @__PURE__ */ jsx(MoonUISelectValuePro, {}) }),
@@ -51511,7 +51515,10 @@ function RichTextEditor({
51511
51515
  id: "apiKey",
51512
51516
  type: "password",
51513
51517
  value: aiSettings.apiKey,
51514
- onChange: (e) => setAiSettings({ ...aiSettings, apiKey: e.target.value }),
51518
+ onChange: (e) => {
51519
+ const newSettings = { ...aiSettings, apiKey: e.target.value };
51520
+ setAiSettings(newSettings);
51521
+ },
51515
51522
  placeholder: "sk-..."
51516
51523
  }
51517
51524
  )
@@ -51522,7 +51529,10 @@ function RichTextEditor({
51522
51529
  MoonUISelectPro,
51523
51530
  {
51524
51531
  value: aiSettings.model,
51525
- onValueChange: (value) => setAiSettings({ ...aiSettings, model: value }),
51532
+ onValueChange: (value) => {
51533
+ const newSettings = { ...aiSettings, model: value };
51534
+ setAiSettings(newSettings);
51535
+ },
51526
51536
  children: [
51527
51537
  /* @__PURE__ */ jsx(MoonUISelectTriggerPro, { children: /* @__PURE__ */ jsx(MoonUISelectValuePro, {}) }),
51528
51538
  /* @__PURE__ */ jsxs(MoonUISelectContentPro, { children: [
@@ -51561,7 +51571,10 @@ function RichTextEditor({
51561
51571
  max: "2",
51562
51572
  step: "0.1",
51563
51573
  value: aiSettings.temperature,
51564
- onChange: (e) => setAiSettings({ ...aiSettings, temperature: parseFloat(e.target.value) })
51574
+ onChange: (e) => {
51575
+ const newSettings = { ...aiSettings, temperature: parseFloat(e.target.value) };
51576
+ setAiSettings(newSettings);
51577
+ }
51565
51578
  }
51566
51579
  )
51567
51580
  ] }),
@@ -51575,7 +51588,10 @@ function RichTextEditor({
51575
51588
  min: "1",
51576
51589
  max: "4000",
51577
51590
  value: aiSettings.maxTokens,
51578
- onChange: (e) => setAiSettings({ ...aiSettings, maxTokens: parseInt(e.target.value) })
51591
+ onChange: (e) => {
51592
+ const newSettings = { ...aiSettings, maxTokens: parseInt(e.target.value) };
51593
+ setAiSettings(newSettings);
51594
+ }
51579
51595
  }
51580
51596
  )
51581
51597
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.8.7",
3
+ "version": "2.8.8",
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",
@@ -111,11 +111,11 @@ import { createAIProvider, type AIProvider as AIProviderInterface } from '../../
111
111
  type AIProvider = 'openai' | 'anthropic' | 'gemini' | 'claude' | 'cohere'
112
112
 
113
113
  interface AISettingsType {
114
- provider: AIProvider
115
- apiKey?: string
116
- model?: string
117
- temperature?: number
118
- maxTokens?: number
114
+ provider: 'openai' | 'claude' | 'gemini' | 'cohere'
115
+ apiKey: string
116
+ model: string
117
+ temperature: number
118
+ maxTokens: number
119
119
  }
120
120
 
121
121
  // Supported languages for translation
@@ -345,14 +345,14 @@ export function RichTextEditor({
345
345
 
346
346
  const [aiSettings, setAiSettings] = useState<AISettingsType>(() => {
347
347
  // Öncelik sırası: Props > LocalStorage > Varsayılan
348
- if (persistAISettings) {
348
+ if (persistAISettings && typeof window !== 'undefined') {
349
349
  try {
350
350
  const stored = localStorage.getItem('moonui-ai-settings');
351
351
  if (stored) {
352
352
  const parsed = JSON.parse(stored);
353
353
  // Props'tan gelen değerler her zaman öncelikli
354
354
  return {
355
- provider: aiConfig.provider || parsed.provider || 'openai',
355
+ provider: (aiConfig.provider || parsed.provider || 'openai') as 'openai' | 'claude' | 'gemini' | 'cohere',
356
356
  apiKey: aiConfig.apiKey || parsed.apiKey || '',
357
357
  model: aiConfig.model || parsed.model || 'gpt-3.5-turbo',
358
358
  temperature: aiConfig.temperature ?? parsed.temperature ?? 0.7,
@@ -366,7 +366,7 @@ export function RichTextEditor({
366
366
 
367
367
  // LocalStorage yoksa veya persist kapalıysa props/varsayılan değerleri kullan
368
368
  return {
369
- provider: aiConfig.provider || 'openai',
369
+ provider: (aiConfig.provider || 'openai') as 'openai' | 'claude' | 'gemini' | 'cohere',
370
370
  apiKey: aiConfig.apiKey || '',
371
371
  model: aiConfig.model || 'gpt-3.5-turbo',
372
372
  temperature: aiConfig.temperature ?? 0.7,
@@ -1512,11 +1512,16 @@ export function RichTextEditor({
1512
1512
  gemini: 'gemini-2.0-flash',
1513
1513
  cohere: 'command'
1514
1514
  };
1515
- setAiSettings({
1515
+ const newSettings = {
1516
1516
  ...aiSettings,
1517
1517
  provider: value,
1518
1518
  model: defaultModels[value] || 'gpt-3.5-turbo'
1519
- });
1519
+ };
1520
+ setAiSettings(newSettings);
1521
+ // LocalStorage'a hemen kaydet
1522
+ if (persistAISettings) {
1523
+ localStorage.setItem('moonui-ai-settings', JSON.stringify(newSettings));
1524
+ }
1520
1525
  }}
1521
1526
  >
1522
1527
  <SelectTrigger>
@@ -1536,7 +1541,10 @@ export function RichTextEditor({
1536
1541
  id="apiKey"
1537
1542
  type="password"
1538
1543
  value={aiSettings.apiKey}
1539
- onChange={(e) => setAiSettings({ ...aiSettings, apiKey: e.target.value })}
1544
+ onChange={(e) => {
1545
+ const newSettings = { ...aiSettings, apiKey: e.target.value };
1546
+ setAiSettings(newSettings);
1547
+ }}
1540
1548
  placeholder="sk-..."
1541
1549
  />
1542
1550
  </div>
@@ -1544,7 +1552,10 @@ export function RichTextEditor({
1544
1552
  <Label htmlFor="model">Model</Label>
1545
1553
  <Select
1546
1554
  value={aiSettings.model}
1547
- onValueChange={(value) => setAiSettings({ ...aiSettings, model: value })}
1555
+ onValueChange={(value) => {
1556
+ const newSettings = { ...aiSettings, model: value };
1557
+ setAiSettings(newSettings);
1558
+ }}
1548
1559
  >
1549
1560
  <SelectTrigger>
1550
1561
  <SelectValue />
@@ -1589,7 +1600,10 @@ export function RichTextEditor({
1589
1600
  max="2"
1590
1601
  step="0.1"
1591
1602
  value={aiSettings.temperature}
1592
- onChange={(e) => setAiSettings({ ...aiSettings, temperature: parseFloat(e.target.value) })}
1603
+ onChange={(e) => {
1604
+ const newSettings = { ...aiSettings, temperature: parseFloat(e.target.value) };
1605
+ setAiSettings(newSettings);
1606
+ }}
1593
1607
  />
1594
1608
  </div>
1595
1609
  <div className="grid gap-2">
@@ -1600,7 +1614,10 @@ export function RichTextEditor({
1600
1614
  min="1"
1601
1615
  max="4000"
1602
1616
  value={aiSettings.maxTokens}
1603
- onChange={(e) => setAiSettings({ ...aiSettings, maxTokens: parseInt(e.target.value) })}
1617
+ onChange={(e) => {
1618
+ const newSettings = { ...aiSettings, maxTokens: parseInt(e.target.value) };
1619
+ setAiSettings(newSettings);
1620
+ }}
1604
1621
  />
1605
1622
  </div>
1606
1623
  </div>