@moontra/moonui-pro 2.20.2 → 2.20.4
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/package.json +8 -3
- package/plugin/index.d.ts +86 -0
- package/plugin/index.js +308 -0
- package/scripts/postinstall.js +191 -23
- package/src/components/advanced-chart/index.tsx +0 -1246
- package/src/components/advanced-forms/index.tsx +0 -585
- package/src/components/animated-button/index.tsx +0 -385
- package/src/components/calendar/event-dialog.tsx +0 -377
- package/src/components/calendar/index.tsx +0 -1220
- package/src/components/calendar-pro/index.tsx +0 -1697
- package/src/components/color-picker/index.tsx +0 -432
- package/src/components/credit-card-input/index.tsx +0 -406
- package/src/components/dashboard/dashboard-grid.tsx +0 -480
- package/src/components/dashboard/demo.tsx +0 -425
- package/src/components/dashboard/index.tsx +0 -1046
- package/src/components/dashboard/time-range-picker.tsx +0 -336
- package/src/components/dashboard/types.ts +0 -225
- package/src/components/dashboard/widgets/activity-feed.tsx +0 -349
- package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
- package/src/components/dashboard/widgets/comparison-widget.tsx +0 -177
- package/src/components/dashboard/widgets/index.ts +0 -5
- package/src/components/dashboard/widgets/metric-card.tsx +0 -363
- package/src/components/dashboard/widgets/progress-widget.tsx +0 -113
- package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
- package/src/components/data-table/data-table-column-toggle.tsx +0 -169
- package/src/components/data-table/data-table-export.ts +0 -156
- package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
- package/src/components/data-table/index.tsx +0 -845
- package/src/components/draggable-list/index.tsx +0 -100
- package/src/components/error-boundary/index.tsx +0 -232
- package/src/components/file-upload/index.tsx +0 -1660
- package/src/components/floating-action-button/index.tsx +0 -206
- package/src/components/form-wizard/form-wizard-context.tsx +0 -335
- package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
- package/src/components/form-wizard/form-wizard-progress.tsx +0 -329
- package/src/components/form-wizard/form-wizard-step.tsx +0 -111
- package/src/components/form-wizard/index.tsx +0 -102
- package/src/components/form-wizard/types.ts +0 -77
- package/src/components/gesture-drawer/index.tsx +0 -551
- package/src/components/github-stars/github-api.ts +0 -426
- package/src/components/github-stars/hooks.ts +0 -517
- package/src/components/github-stars/index.tsx +0 -375
- package/src/components/github-stars/types.ts +0 -148
- package/src/components/github-stars/variants.tsx +0 -515
- package/src/components/health-check/index.tsx +0 -439
- package/src/components/hover-card-3d/index.tsx +0 -529
- package/src/components/index.ts +0 -130
- package/src/components/internal/index.ts +0 -78
- package/src/components/kanban/add-card-modal.tsx +0 -502
- package/src/components/kanban/card-detail-modal.tsx +0 -761
- package/src/components/kanban/index.ts +0 -13
- package/src/components/kanban/kanban.tsx +0 -1689
- package/src/components/kanban/types.ts +0 -168
- package/src/components/lazy-component/index.tsx +0 -823
- package/src/components/license-error/index.tsx +0 -31
- package/src/components/magnetic-button/index.tsx +0 -216
- package/src/components/memory-efficient-data/index.tsx +0 -1018
- package/src/components/moonui-quiz-form/index.tsx +0 -817
- package/src/components/navbar/index.tsx +0 -781
- package/src/components/optimized-image/index.tsx +0 -425
- package/src/components/performance-debugger/index.tsx +0 -613
- package/src/components/performance-monitor/index.tsx +0 -808
- package/src/components/phone-number-input/index.tsx +0 -343
- package/src/components/phone-number-input/phone-number-input-simple.tsx +0 -167
- package/src/components/pinch-zoom/index.tsx +0 -566
- package/src/components/quiz-form/index.tsx +0 -479
- package/src/components/rich-text-editor/index.tsx +0 -2322
- package/src/components/rich-text-editor/slash-commands-extension.ts +0 -230
- package/src/components/rich-text-editor/slash-commands.css +0 -35
- package/src/components/rich-text-editor/table-styles.css +0 -65
- package/src/components/sidebar/index.tsx +0 -884
- package/src/components/spotlight-card/index.tsx +0 -191
- package/src/components/swipeable-card/index.tsx +0 -100
- package/src/components/timeline/index.tsx +0 -1183
- package/src/components/ui/accordion.tsx +0 -581
- package/src/components/ui/alert-dialog.tsx +0 -141
- package/src/components/ui/alert.tsx +0 -141
- package/src/components/ui/aspect-ratio.tsx +0 -245
- package/src/components/ui/avatar.tsx +0 -155
- package/src/components/ui/badge.tsx +0 -230
- package/src/components/ui/breadcrumb.tsx +0 -216
- package/src/components/ui/button.tsx +0 -228
- package/src/components/ui/calendar.tsx +0 -387
- package/src/components/ui/card.tsx +0 -216
- package/src/components/ui/checkbox.tsx +0 -259
- package/src/components/ui/collapsible.tsx +0 -631
- package/src/components/ui/color-picker.tsx +0 -97
- package/src/components/ui/command.tsx +0 -948
- package/src/components/ui/dialog.tsx +0 -752
- package/src/components/ui/dropdown-menu.tsx +0 -706
- package/src/components/ui/gesture-drawer.tsx +0 -11
- package/src/components/ui/hover-card.tsx +0 -29
- package/src/components/ui/index.ts +0 -222
- package/src/components/ui/input.tsx +0 -224
- package/src/components/ui/label.tsx +0 -29
- package/src/components/ui/lightbox.tsx +0 -606
- package/src/components/ui/magnetic-button.tsx +0 -129
- package/src/components/ui/media-gallery.tsx +0 -611
- package/src/components/ui/navigation-menu.tsx +0 -130
- package/src/components/ui/pagination.tsx +0 -125
- package/src/components/ui/popover.tsx +0 -185
- package/src/components/ui/progress.tsx +0 -30
- package/src/components/ui/radio-group.tsx +0 -257
- package/src/components/ui/scroll-area.tsx +0 -47
- package/src/components/ui/select.tsx +0 -378
- package/src/components/ui/separator.tsx +0 -145
- package/src/components/ui/sheet.tsx +0 -139
- package/src/components/ui/skeleton.tsx +0 -20
- package/src/components/ui/slider.tsx +0 -354
- package/src/components/ui/spotlight-card.tsx +0 -119
- package/src/components/ui/switch.tsx +0 -86
- package/src/components/ui/table.tsx +0 -331
- package/src/components/ui/tabs-pro.tsx +0 -542
- package/src/components/ui/tabs.tsx +0 -54
- package/src/components/ui/textarea.tsx +0 -28
- package/src/components/ui/toast.tsx +0 -317
- package/src/components/ui/toggle.tsx +0 -119
- package/src/components/ui/tooltip.tsx +0 -151
- package/src/components/virtual-list/index.tsx +0 -668
- package/src/hooks/use-chart.ts +0 -205
- package/src/hooks/use-data-table.ts +0 -182
- package/src/hooks/use-docs-pro-access.ts +0 -13
- package/src/hooks/use-license-check.ts +0 -65
- package/src/hooks/use-subscription.ts +0 -19
- package/src/hooks/use-toast.ts +0 -15
- package/src/index.ts +0 -22
- package/src/lib/ai-providers.ts +0 -377
- package/src/lib/component-metadata.ts +0 -18
- package/src/lib/micro-interactions.ts +0 -255
- package/src/lib/paddle.ts +0 -17
- package/src/lib/utils.ts +0 -6
- package/src/patterns/login-form/index.tsx +0 -276
- package/src/patterns/login-form/types.ts +0 -67
- package/src/setupTests.ts +0 -41
- package/src/styles/advanced-chart.css +0 -239
- package/src/styles/calendar.css +0 -35
- package/src/styles/design-system.css +0 -363
- package/src/styles/index.css +0 -681
- package/src/styles/tailwind.css +0 -7
- package/src/styles/tokens.css +0 -455
- package/src/types/next-auth.d.ts +0 -21
- package/src/use-intersection-observer.tsx +0 -154
- package/src/use-local-storage.tsx +0 -71
- package/src/use-paddle.ts +0 -138
- package/src/use-performance-optimizer.ts +0 -389
- package/src/use-pro-access.ts +0 -141
- package/src/use-scroll-animation.ts +0 -219
- package/src/use-subscription.ts +0 -37
- package/src/use-toast.ts +0 -32
- package/src/utils/chart-helpers.ts +0 -357
- package/src/utils/cn.ts +0 -6
- package/src/utils/data-processing.ts +0 -151
- package/src/utils/license-validator.tsx +0 -183
package/src/lib/ai-providers.ts
DELETED
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
// AI Provider Interfaces and Implementations
|
|
2
|
-
|
|
3
|
-
export interface AIResponse {
|
|
4
|
-
text: string;
|
|
5
|
-
error?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface AIProvider {
|
|
9
|
-
generateText(prompt: string): Promise<string>;
|
|
10
|
-
rewrite(text: string): Promise<string>;
|
|
11
|
-
expand(text: string): Promise<string>;
|
|
12
|
-
summarize(text: string): Promise<string>;
|
|
13
|
-
fixGrammar(text: string): Promise<string>;
|
|
14
|
-
translate(text: string, targetLang: string): Promise<string>;
|
|
15
|
-
changeTone(text: string, tone: string): Promise<string>;
|
|
16
|
-
continueWriting(text: string): Promise<string>;
|
|
17
|
-
improveWriting(text: string): Promise<string>;
|
|
18
|
-
generateIdeas(text: string): Promise<string>;
|
|
19
|
-
complete(text: string): Promise<string>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface AIProviderConfig {
|
|
23
|
-
apiKey: string;
|
|
24
|
-
model?: string;
|
|
25
|
-
temperature?: number;
|
|
26
|
-
maxTokens?: number;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Gemini Provider Implementation
|
|
30
|
-
export class GeminiProvider implements AIProvider {
|
|
31
|
-
private apiKey: string;
|
|
32
|
-
private model: string;
|
|
33
|
-
private apiUrl = 'https://generativelanguage.googleapis.com/v1beta/models';
|
|
34
|
-
|
|
35
|
-
constructor(config: AIProviderConfig) {
|
|
36
|
-
this.apiKey = config.apiKey;
|
|
37
|
-
// Use gemini-2.0-flash as shown in the curl example
|
|
38
|
-
this.model = config.model || 'gemini-2.0-flash';
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
private async callGeminiAPI(prompt: string): Promise<string> {
|
|
42
|
-
try {
|
|
43
|
-
const response = await fetch(`${this.apiUrl}/${this.model}:generateContent`, {
|
|
44
|
-
method: 'POST',
|
|
45
|
-
headers: {
|
|
46
|
-
'Content-Type': 'application/json',
|
|
47
|
-
'X-goog-api-key': this.apiKey
|
|
48
|
-
},
|
|
49
|
-
body: JSON.stringify({
|
|
50
|
-
contents: [{
|
|
51
|
-
parts: [{
|
|
52
|
-
text: prompt
|
|
53
|
-
}]
|
|
54
|
-
}]
|
|
55
|
-
})
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
if (!response.ok) {
|
|
59
|
-
const errorData = await response.text();
|
|
60
|
-
console.error('Gemini API error response:', errorData);
|
|
61
|
-
throw new Error(`Gemini API error: ${response.status} ${response.statusText} - ${errorData}`);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const data = await response.json();
|
|
65
|
-
|
|
66
|
-
// Check for API errors in response
|
|
67
|
-
if (data.error) {
|
|
68
|
-
throw new Error(`Gemini API error: ${data.error.message || JSON.stringify(data.error)}`);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Check if content was blocked
|
|
72
|
-
if (data.candidates?.[0]?.finishReason === 'SAFETY') {
|
|
73
|
-
throw new Error('Content was blocked by safety filters');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const text = data.candidates?.[0]?.content?.parts?.[0]?.text;
|
|
77
|
-
if (!text) {
|
|
78
|
-
console.error('Gemini API response:', JSON.stringify(data, null, 2));
|
|
79
|
-
throw new Error('No text content in Gemini API response');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return text.trim();
|
|
83
|
-
} catch (error) {
|
|
84
|
-
console.error('Gemini API error details:', error);
|
|
85
|
-
if (error instanceof Error) {
|
|
86
|
-
throw error;
|
|
87
|
-
}
|
|
88
|
-
throw new Error('Unknown error occurred while calling Gemini API');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async generateText(prompt: string): Promise<string> {
|
|
93
|
-
return this.callGeminiAPI(prompt);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
async rewrite(text: string): Promise<string> {
|
|
97
|
-
const prompt = `Rewrite the following text to make it clearer, more engaging, and better structured while maintaining the original meaning. Respond in the same language:\n\n${text}`;
|
|
98
|
-
return this.callGeminiAPI(prompt);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
async expand(text: string): Promise<string> {
|
|
102
|
-
const prompt = `Expand this text with more details, specific examples, explanations, and supporting information while keeping the same structure and tone. Respond in the same language:\n\n${text}`;
|
|
103
|
-
return this.callGeminiAPI(prompt);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async summarize(text: string): Promise<string> {
|
|
107
|
-
const prompt = `Create a comprehensive summary that captures all key points, main arguments, important details, and significant examples from the text. The summary should be thorough enough to understand the core message. Respond in the same language:\n\n${text}`;
|
|
108
|
-
return this.callGeminiAPI(prompt);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
async fixGrammar(text: string): Promise<string> {
|
|
112
|
-
const prompt = `Fix grammar and spelling errors. Respond in the same language:\n\n${text}`;
|
|
113
|
-
return this.callGeminiAPI(prompt);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
async translate(text: string, targetLang: string): Promise<string> {
|
|
117
|
-
const prompt = `Translate to ${targetLang}:\n\n${text}`;
|
|
118
|
-
return this.callGeminiAPI(prompt);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
async changeTone(text: string, tone: string): Promise<string> {
|
|
122
|
-
const toneDescriptions: Record<string, string> = {
|
|
123
|
-
professional: 'professional and business-appropriate',
|
|
124
|
-
casual: 'casual and conversational',
|
|
125
|
-
friendly: 'warm and friendly',
|
|
126
|
-
formal: 'formal and academic'
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const toneDesc = toneDescriptions[tone] || tone;
|
|
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
|
-
return this.callGeminiAPI(prompt);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
async continueWriting(text: string): Promise<string> {
|
|
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
|
-
return this.callGeminiAPI(prompt);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
async improveWriting(text: string): Promise<string> {
|
|
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
|
-
return this.callGeminiAPI(prompt);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
async generateIdeas(text: string): Promise<string> {
|
|
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
|
-
return this.callGeminiAPI(prompt);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
async complete(text: string): Promise<string> {
|
|
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
|
-
return this.callGeminiAPI(prompt);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// OpenAI Provider Implementation
|
|
156
|
-
export class OpenAIProvider implements AIProvider {
|
|
157
|
-
private apiKey: string;
|
|
158
|
-
private model: string;
|
|
159
|
-
private temperature: number;
|
|
160
|
-
private maxTokens: number;
|
|
161
|
-
private apiUrl = 'https://api.openai.com/v1/chat/completions';
|
|
162
|
-
|
|
163
|
-
constructor(config: AIProviderConfig) {
|
|
164
|
-
this.apiKey = config.apiKey;
|
|
165
|
-
this.model = config.model || 'gpt-3.5-turbo';
|
|
166
|
-
this.temperature = config.temperature || 0.7;
|
|
167
|
-
this.maxTokens = config.maxTokens || 1000;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
private async callOpenAI(systemPrompt: string, userPrompt: string): Promise<string> {
|
|
171
|
-
try {
|
|
172
|
-
const response = await fetch(this.apiUrl, {
|
|
173
|
-
method: 'POST',
|
|
174
|
-
headers: {
|
|
175
|
-
'Content-Type': 'application/json',
|
|
176
|
-
'Authorization': `Bearer ${this.apiKey}`
|
|
177
|
-
},
|
|
178
|
-
body: JSON.stringify({
|
|
179
|
-
model: this.model,
|
|
180
|
-
messages: [
|
|
181
|
-
{ role: 'system', content: systemPrompt },
|
|
182
|
-
{ role: 'user', content: userPrompt }
|
|
183
|
-
],
|
|
184
|
-
temperature: this.temperature,
|
|
185
|
-
max_tokens: this.maxTokens
|
|
186
|
-
})
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
if (!response.ok) {
|
|
190
|
-
throw new Error(`OpenAI API error: ${response.statusText}`);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const data = await response.json();
|
|
194
|
-
return data.choices?.[0]?.message?.content || '';
|
|
195
|
-
} catch (error) {
|
|
196
|
-
console.error('OpenAI API error:', error);
|
|
197
|
-
throw error;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
async generateText(prompt: string): Promise<string> {
|
|
202
|
-
return this.callOpenAI('You are a helpful writing assistant. Always respond in the same language as the input text.', prompt);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
async rewrite(text: string): Promise<string> {
|
|
206
|
-
return this.callOpenAI(
|
|
207
|
-
'Rewrite the text to be clearer, more engaging, and better structured while maintaining the original meaning. Respond in the same language as the input.',
|
|
208
|
-
text
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
async expand(text: string): Promise<string> {
|
|
213
|
-
return this.callOpenAI(
|
|
214
|
-
'Expand the text with more details, specific examples, explanations, and supporting information while keeping the same structure and tone. Respond in the same language as the input.',
|
|
215
|
-
text
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
async summarize(text: string): Promise<string> {
|
|
220
|
-
return this.callOpenAI(
|
|
221
|
-
'Create a comprehensive summary that captures all key points, main arguments, important details, and significant examples. The summary should be thorough enough to understand the core message. Respond in the same language as the input.',
|
|
222
|
-
text
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
async fixGrammar(text: string): Promise<string> {
|
|
227
|
-
return this.callOpenAI(
|
|
228
|
-
'You are a grammar expert. Fix all grammar and spelling errors. Always respond in the same language as the input text.',
|
|
229
|
-
text
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
async translate(text: string, targetLang: string): Promise<string> {
|
|
234
|
-
return this.callOpenAI(
|
|
235
|
-
`You are a professional translator. Translate to ${targetLang}.`,
|
|
236
|
-
text
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
async changeTone(text: string, tone: string): Promise<string> {
|
|
241
|
-
return this.callOpenAI(
|
|
242
|
-
`You are a writing expert. Rewrite the text in a ${tone} tone. Always respond in the same language as the input text.`,
|
|
243
|
-
text
|
|
244
|
-
);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
async continueWriting(text: string): Promise<string> {
|
|
248
|
-
return this.callOpenAI(
|
|
249
|
-
'You are a creative writer. Continue writing from where the text ends. Always respond in the same language as the input text.',
|
|
250
|
-
text
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
async improveWriting(text: string): Promise<string> {
|
|
255
|
-
return this.callOpenAI(
|
|
256
|
-
'You are a professional editor. Improve the text quality. Always respond in the same language as the input text.',
|
|
257
|
-
text
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
async generateIdeas(text: string): Promise<string> {
|
|
262
|
-
return this.callOpenAI(
|
|
263
|
-
'You are a creative consultant. Generate ideas based on the topic. Always respond in the same language as the input text.',
|
|
264
|
-
text
|
|
265
|
-
);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
async complete(text: string): Promise<string> {
|
|
269
|
-
return this.callOpenAI(
|
|
270
|
-
'You are a writing assistant. Complete the text naturally. Always respond in the same language as the input text.',
|
|
271
|
-
text
|
|
272
|
-
);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// Claude Provider Implementation
|
|
277
|
-
export class ClaudeProvider implements AIProvider {
|
|
278
|
-
private apiKey: string;
|
|
279
|
-
private model: string;
|
|
280
|
-
private apiUrl = 'https://api.anthropic.com/v1/messages';
|
|
281
|
-
|
|
282
|
-
constructor(config: AIProviderConfig) {
|
|
283
|
-
this.apiKey = config.apiKey;
|
|
284
|
-
this.model = config.model || 'claude-3-sonnet-20240229';
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
private async callClaude(prompt: string): Promise<string> {
|
|
288
|
-
try {
|
|
289
|
-
const response = await fetch(this.apiUrl, {
|
|
290
|
-
method: 'POST',
|
|
291
|
-
headers: {
|
|
292
|
-
'Content-Type': 'application/json',
|
|
293
|
-
'x-api-key': this.apiKey,
|
|
294
|
-
'anthropic-version': '2023-06-01'
|
|
295
|
-
},
|
|
296
|
-
body: JSON.stringify({
|
|
297
|
-
model: this.model,
|
|
298
|
-
max_tokens: 1000,
|
|
299
|
-
messages: [
|
|
300
|
-
{ role: 'user', content: prompt }
|
|
301
|
-
]
|
|
302
|
-
})
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
if (!response.ok) {
|
|
306
|
-
throw new Error(`Claude API error: ${response.statusText}`);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
const data = await response.json();
|
|
310
|
-
return data.content?.[0]?.text || '';
|
|
311
|
-
} catch (error) {
|
|
312
|
-
console.error('Claude API error:', error);
|
|
313
|
-
throw error;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
async generateText(prompt: string): Promise<string> {
|
|
318
|
-
return this.callClaude(`${prompt}\n\nIMPORTANT: Respond in the SAME LANGUAGE as the input text.`);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
async rewrite(text: string): Promise<string> {
|
|
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
|
-
}
|
|
324
|
-
|
|
325
|
-
async expand(text: string): Promise<string> {
|
|
326
|
-
return this.callClaude(`Expand this text with more details, specific examples, explanations, and supporting information while keeping the same structure and tone. Respond in the same language as the input:\n\n${text}`);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
async summarize(text: string): Promise<string> {
|
|
330
|
-
return this.callClaude(`Create a comprehensive summary that captures all key points, main arguments, important details, and significant examples. The summary should be thorough enough to understand the core message. Respond in the same language as the input:\n\n${text}`);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
async fixGrammar(text: string): Promise<string> {
|
|
334
|
-
return this.callClaude(`Fix grammar and spelling errors. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
async translate(text: string, targetLang: string): Promise<string> {
|
|
338
|
-
return this.callClaude(`Translate to ${targetLang}:\n\n${text}`);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
async changeTone(text: string, tone: string): Promise<string> {
|
|
342
|
-
return this.callClaude(`Rewrite in a ${tone} tone. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
async continueWriting(text: string): Promise<string> {
|
|
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
|
-
}
|
|
348
|
-
|
|
349
|
-
async improveWriting(text: string): Promise<string> {
|
|
350
|
-
return this.callClaude(`Improve this text. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
async generateIdeas(text: string): Promise<string> {
|
|
354
|
-
return this.callClaude(`Generate ideas for this topic. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
async complete(text: string): Promise<string> {
|
|
358
|
-
return this.callClaude(`Complete this text naturally. IMPORTANT: Respond in the SAME LANGUAGE as the input text:\n\n${text}`);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// Factory function to create AI provider instances
|
|
363
|
-
export function createAIProvider(
|
|
364
|
-
provider: 'openai' | 'gemini' | 'claude',
|
|
365
|
-
config: AIProviderConfig
|
|
366
|
-
): AIProvider {
|
|
367
|
-
switch (provider) {
|
|
368
|
-
case 'gemini':
|
|
369
|
-
return new GeminiProvider(config);
|
|
370
|
-
case 'openai':
|
|
371
|
-
return new OpenAIProvider(config);
|
|
372
|
-
case 'claude':
|
|
373
|
-
return new ClaudeProvider(config);
|
|
374
|
-
default:
|
|
375
|
-
throw new Error(`Unsupported AI provider: ${provider}`);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface ComponentMetadata {
|
|
2
|
-
name: string
|
|
3
|
-
category: string
|
|
4
|
-
isPro: boolean
|
|
5
|
-
path: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const componentsMetadata: Record<string, ComponentMetadata> = {
|
|
9
|
-
'button': { name: 'Button', category: 'ui', isPro: false, path: 'button' },
|
|
10
|
-
'enhanced-button': { name: 'Enhanced Button', category: 'enhanced', isPro: true, path: 'enhanced/button' },
|
|
11
|
-
'data-table': { name: 'Data Table', category: 'data', isPro: true, path: 'data-table' },
|
|
12
|
-
'calendar-pro': { name: 'Calendar Pro', category: 'data', isPro: true, path: 'calendar-pro' },
|
|
13
|
-
// Add more components as needed
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function getComponentMetadata(componentName: string): ComponentMetadata | undefined {
|
|
17
|
-
return componentsMetadata[componentName]
|
|
18
|
-
}
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
// MoonUI Micro-interactions System
|
|
2
|
-
// Provides consistent hover, focus, and active states across all components
|
|
3
|
-
|
|
4
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Micro-interaction variants for consistent component behavior
|
|
8
|
-
*/
|
|
9
|
-
export const microInteractionVariants = cva("", {
|
|
10
|
-
variants: {
|
|
11
|
-
hover: {
|
|
12
|
-
lift: [
|
|
13
|
-
"transition-all duration-200 ease-out",
|
|
14
|
-
"hover:-translate-y-0.5",
|
|
15
|
-
"hover:shadow-md",
|
|
16
|
-
],
|
|
17
|
-
glow: [
|
|
18
|
-
"transition-all duration-300 ease-out",
|
|
19
|
-
"hover:shadow-lg",
|
|
20
|
-
"hover:shadow-primary/20",
|
|
21
|
-
],
|
|
22
|
-
scale: [
|
|
23
|
-
"transition-transform duration-200 ease-out",
|
|
24
|
-
"hover:scale-105",
|
|
25
|
-
"active:scale-95",
|
|
26
|
-
],
|
|
27
|
-
brightness: [
|
|
28
|
-
"transition-all duration-200 ease-out",
|
|
29
|
-
"hover:brightness-110",
|
|
30
|
-
"active:brightness-95",
|
|
31
|
-
],
|
|
32
|
-
border: [
|
|
33
|
-
"transition-all duration-200 ease-out",
|
|
34
|
-
"hover:border-primary/50",
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
focus: {
|
|
38
|
-
ring: [
|
|
39
|
-
"focus:outline-none",
|
|
40
|
-
"focus-visible:ring-2",
|
|
41
|
-
"focus-visible:ring-primary/50",
|
|
42
|
-
"focus-visible:ring-offset-2",
|
|
43
|
-
],
|
|
44
|
-
glow: [
|
|
45
|
-
"focus:outline-none",
|
|
46
|
-
"focus-visible:shadow-lg",
|
|
47
|
-
"focus-visible:shadow-primary/30",
|
|
48
|
-
],
|
|
49
|
-
border: [
|
|
50
|
-
"focus:outline-none",
|
|
51
|
-
"focus-visible:border-primary",
|
|
52
|
-
"focus-visible:border-2",
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
active: {
|
|
56
|
-
scale: [
|
|
57
|
-
"active:scale-95",
|
|
58
|
-
"transition-transform duration-100",
|
|
59
|
-
],
|
|
60
|
-
darken: [
|
|
61
|
-
"active:brightness-90",
|
|
62
|
-
"transition-all duration-100",
|
|
63
|
-
],
|
|
64
|
-
depress: [
|
|
65
|
-
"active:translate-y-0.5",
|
|
66
|
-
"active:shadow-sm",
|
|
67
|
-
"transition-all duration-100",
|
|
68
|
-
],
|
|
69
|
-
},
|
|
70
|
-
cursor: {
|
|
71
|
-
pointer: "cursor-pointer",
|
|
72
|
-
grab: "cursor-grab active:cursor-grabbing",
|
|
73
|
-
text: "cursor-text",
|
|
74
|
-
wait: "cursor-wait",
|
|
75
|
-
help: "cursor-help",
|
|
76
|
-
notAllowed: "cursor-not-allowed",
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
defaultVariants: {
|
|
80
|
-
hover: "lift",
|
|
81
|
-
focus: "ring",
|
|
82
|
-
active: "scale",
|
|
83
|
-
cursor: "pointer",
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Spring animation configurations
|
|
89
|
-
*/
|
|
90
|
-
export const springAnimations = {
|
|
91
|
-
// Smooth spring for general use
|
|
92
|
-
smooth: {
|
|
93
|
-
type: "spring",
|
|
94
|
-
stiffness: 260,
|
|
95
|
-
damping: 20,
|
|
96
|
-
},
|
|
97
|
-
// Bouncy spring for playful interactions
|
|
98
|
-
bouncy: {
|
|
99
|
-
type: "spring",
|
|
100
|
-
stiffness: 300,
|
|
101
|
-
damping: 15,
|
|
102
|
-
},
|
|
103
|
-
// Stiff spring for quick responses
|
|
104
|
-
stiff: {
|
|
105
|
-
type: "spring",
|
|
106
|
-
stiffness: 400,
|
|
107
|
-
damping: 25,
|
|
108
|
-
},
|
|
109
|
-
// Gentle spring for subtle movements
|
|
110
|
-
gentle: {
|
|
111
|
-
type: "spring",
|
|
112
|
-
stiffness: 150,
|
|
113
|
-
damping: 15,
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Hover animation presets
|
|
119
|
-
*/
|
|
120
|
-
export const hoverAnimations = {
|
|
121
|
-
lift: {
|
|
122
|
-
y: -2,
|
|
123
|
-
transition: springAnimations.smooth,
|
|
124
|
-
},
|
|
125
|
-
scale: {
|
|
126
|
-
scale: 1.05,
|
|
127
|
-
transition: springAnimations.smooth,
|
|
128
|
-
},
|
|
129
|
-
glow: {
|
|
130
|
-
boxShadow: "0 0 20px rgba(var(--primary), 0.3)",
|
|
131
|
-
transition: springAnimations.smooth,
|
|
132
|
-
},
|
|
133
|
-
rotate: {
|
|
134
|
-
rotate: 2,
|
|
135
|
-
transition: springAnimations.bouncy,
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Tap/Click animation presets
|
|
141
|
-
*/
|
|
142
|
-
export const tapAnimations = {
|
|
143
|
-
scale: {
|
|
144
|
-
scale: 0.95,
|
|
145
|
-
transition: { duration: 0.1 },
|
|
146
|
-
},
|
|
147
|
-
depress: {
|
|
148
|
-
y: 1,
|
|
149
|
-
transition: { duration: 0.1 },
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Focus animation presets
|
|
155
|
-
*/
|
|
156
|
-
export const focusAnimations = {
|
|
157
|
-
ring: {
|
|
158
|
-
boxShadow: "0 0 0 2px var(--background), 0 0 0 4px var(--primary)",
|
|
159
|
-
transition: springAnimations.smooth,
|
|
160
|
-
},
|
|
161
|
-
glow: {
|
|
162
|
-
boxShadow: "0 0 0 3px rgba(var(--primary), 0.3)",
|
|
163
|
-
transition: springAnimations.smooth,
|
|
164
|
-
},
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Stagger animation for lists
|
|
169
|
-
*/
|
|
170
|
-
export const staggerAnimation = {
|
|
171
|
-
container: {
|
|
172
|
-
hidden: { opacity: 0 },
|
|
173
|
-
show: {
|
|
174
|
-
opacity: 1,
|
|
175
|
-
transition: {
|
|
176
|
-
staggerChildren: 0.05,
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
item: {
|
|
181
|
-
hidden: { opacity: 0, y: 20 },
|
|
182
|
-
show: {
|
|
183
|
-
opacity: 1,
|
|
184
|
-
y: 0,
|
|
185
|
-
transition: springAnimations.smooth,
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Page transition animations
|
|
192
|
-
*/
|
|
193
|
-
export const pageTransitions = {
|
|
194
|
-
fadeIn: {
|
|
195
|
-
initial: { opacity: 0 },
|
|
196
|
-
animate: { opacity: 1 },
|
|
197
|
-
exit: { opacity: 0 },
|
|
198
|
-
transition: { duration: 0.3 },
|
|
199
|
-
},
|
|
200
|
-
slideUp: {
|
|
201
|
-
initial: { opacity: 0, y: 20 },
|
|
202
|
-
animate: { opacity: 1, y: 0 },
|
|
203
|
-
exit: { opacity: 0, y: -20 },
|
|
204
|
-
transition: springAnimations.smooth,
|
|
205
|
-
},
|
|
206
|
-
slideRight: {
|
|
207
|
-
initial: { opacity: 0, x: -20 },
|
|
208
|
-
animate: { opacity: 1, x: 0 },
|
|
209
|
-
exit: { opacity: 0, x: 20 },
|
|
210
|
-
transition: springAnimations.smooth,
|
|
211
|
-
},
|
|
212
|
-
scale: {
|
|
213
|
-
initial: { opacity: 0, scale: 0.95 },
|
|
214
|
-
animate: { opacity: 1, scale: 1 },
|
|
215
|
-
exit: { opacity: 0, scale: 1.05 },
|
|
216
|
-
transition: springAnimations.smooth,
|
|
217
|
-
},
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Skeleton loading animation
|
|
222
|
-
*/
|
|
223
|
-
export const skeletonAnimation = {
|
|
224
|
-
initial: { opacity: 0.5 },
|
|
225
|
-
animate: {
|
|
226
|
-
opacity: [0.5, 0.8, 0.5],
|
|
227
|
-
transition: {
|
|
228
|
-
duration: 1.5,
|
|
229
|
-
repeat: Infinity,
|
|
230
|
-
ease: "easeInOut",
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Tooltip animation
|
|
237
|
-
*/
|
|
238
|
-
export const tooltipAnimation = {
|
|
239
|
-
initial: { opacity: 0, scale: 0.95 },
|
|
240
|
-
animate: { opacity: 1, scale: 1 },
|
|
241
|
-
exit: { opacity: 0, scale: 0.95 },
|
|
242
|
-
transition: { duration: 0.15 },
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Notification animation
|
|
247
|
-
*/
|
|
248
|
-
export const notificationAnimation = {
|
|
249
|
-
initial: { opacity: 0, y: -20, scale: 0.95 },
|
|
250
|
-
animate: { opacity: 1, y: 0, scale: 1 },
|
|
251
|
-
exit: { opacity: 0, scale: 0.95, transition: { duration: 0.15 } },
|
|
252
|
-
transition: springAnimations.bouncy,
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
export type MicroInteractionProps = VariantProps<typeof microInteractionVariants>;
|
package/src/lib/paddle.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface PaddleEnvironment {
|
|
2
|
-
vendor: number
|
|
3
|
-
environment: 'production' | 'sandbox'
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface PaddleCheckout {
|
|
7
|
-
Items: Array<{
|
|
8
|
-
price_id: string
|
|
9
|
-
quantity: number
|
|
10
|
-
}>
|
|
11
|
-
custom_data?: Record<string, any>
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const paddleConfig: PaddleEnvironment = {
|
|
15
|
-
vendor: parseInt(process.env.NEXT_PUBLIC_PADDLE_VENDOR_ID || '0'),
|
|
16
|
-
environment: (process.env.NEXT_PUBLIC_PADDLE_ENVIRONMENT || 'sandbox') as 'production' | 'sandbox'
|
|
17
|
-
}
|