@moontra/moonui-pro 2.20.1 → 2.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/dist/index.d.ts +691 -261
  2. package/dist/index.mjs +7418 -4934
  3. package/package.json +11 -5
  4. package/plugin/index.d.ts +86 -0
  5. package/plugin/index.js +308 -0
  6. package/scripts/postbuild.js +27 -0
  7. package/scripts/postinstall.js +176 -23
  8. package/src/__tests__/use-intersection-observer.test.tsx +0 -216
  9. package/src/__tests__/use-local-storage.test.tsx +0 -174
  10. package/src/__tests__/use-pro-access.test.tsx +0 -183
  11. package/src/components/advanced-chart/advanced-chart.test.tsx +0 -281
  12. package/src/components/advanced-chart/index.tsx +0 -1242
  13. package/src/components/advanced-forms/index.tsx +0 -426
  14. package/src/components/animated-button/index.tsx +0 -385
  15. package/src/components/calendar/event-dialog.tsx +0 -372
  16. package/src/components/calendar/index.tsx +0 -1073
  17. package/src/components/calendar-pro/index.tsx +0 -1697
  18. package/src/components/color-picker/index.tsx +0 -432
  19. package/src/components/credit-card-input/index.tsx +0 -406
  20. package/src/components/dashboard/dashboard-grid.tsx +0 -462
  21. package/src/components/dashboard/demo.tsx +0 -425
  22. package/src/components/dashboard/index.tsx +0 -1046
  23. package/src/components/dashboard/time-range-picker.tsx +0 -336
  24. package/src/components/dashboard/types.ts +0 -222
  25. package/src/components/dashboard/widgets/activity-feed.tsx +0 -344
  26. package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
  27. package/src/components/dashboard/widgets/metric-card.tsx +0 -343
  28. package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
  29. package/src/components/data-table/data-table-column-toggle.tsx +0 -169
  30. package/src/components/data-table/data-table-export.ts +0 -156
  31. package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
  32. package/src/components/data-table/data-table.test.tsx +0 -187
  33. package/src/components/data-table/index.tsx +0 -845
  34. package/src/components/draggable-list/index.tsx +0 -100
  35. package/src/components/enhanced/badge.tsx +0 -191
  36. package/src/components/enhanced/button.tsx +0 -362
  37. package/src/components/enhanced/card.tsx +0 -266
  38. package/src/components/enhanced/dialog.tsx +0 -246
  39. package/src/components/enhanced/index.ts +0 -4
  40. package/src/components/error-boundary/index.tsx +0 -109
  41. package/src/components/file-upload/file-upload.test.tsx +0 -243
  42. package/src/components/file-upload/index.tsx +0 -1660
  43. package/src/components/floating-action-button/index.tsx +0 -206
  44. package/src/components/form-wizard/form-wizard-context.tsx +0 -307
  45. package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
  46. package/src/components/form-wizard/form-wizard-progress.tsx +0 -298
  47. package/src/components/form-wizard/form-wizard-step.tsx +0 -111
  48. package/src/components/form-wizard/index.tsx +0 -102
  49. package/src/components/form-wizard/types.ts +0 -76
  50. package/src/components/gesture-drawer/index.tsx +0 -551
  51. package/src/components/github-stars/github-api.ts +0 -426
  52. package/src/components/github-stars/hooks.ts +0 -516
  53. package/src/components/github-stars/index.tsx +0 -375
  54. package/src/components/github-stars/types.ts +0 -148
  55. package/src/components/github-stars/variants.tsx +0 -513
  56. package/src/components/health-check/index.tsx +0 -439
  57. package/src/components/hover-card-3d/index.tsx +0 -530
  58. package/src/components/index.ts +0 -128
  59. package/src/components/internal/index.ts +0 -78
  60. package/src/components/kanban/add-card-modal.tsx +0 -502
  61. package/src/components/kanban/card-detail-modal.tsx +0 -761
  62. package/src/components/kanban/index.ts +0 -13
  63. package/src/components/kanban/kanban.tsx +0 -1684
  64. package/src/components/kanban/types.ts +0 -168
  65. package/src/components/lazy-component/index.tsx +0 -823
  66. package/src/components/license-error/index.tsx +0 -29
  67. package/src/components/magnetic-button/index.tsx +0 -167
  68. package/src/components/memory-efficient-data/index.tsx +0 -1016
  69. package/src/components/moonui-quiz-form/index.tsx +0 -817
  70. package/src/components/optimized-image/index.tsx +0 -425
  71. package/src/components/performance-debugger/index.tsx +0 -589
  72. package/src/components/performance-monitor/index.tsx +0 -794
  73. package/src/components/phone-number-input/index.tsx +0 -338
  74. package/src/components/pinch-zoom/index.tsx +0 -566
  75. package/src/components/quiz-form/index.tsx +0 -479
  76. package/src/components/rich-text-editor/index-old-backup.tsx +0 -437
  77. package/src/components/rich-text-editor/index.tsx +0 -2324
  78. package/src/components/rich-text-editor/slash-commands-extension.ts +0 -220
  79. package/src/components/rich-text-editor/slash-commands.css +0 -35
  80. package/src/components/rich-text-editor/table-styles.css +0 -65
  81. package/src/components/sidebar/index.tsx +0 -865
  82. package/src/components/spotlight-card/index.tsx +0 -191
  83. package/src/components/swipeable-card/index.tsx +0 -100
  84. package/src/components/timeline/index.tsx +0 -1148
  85. package/src/components/ui/accordion.tsx +0 -73
  86. package/src/components/ui/alert-dialog.tsx +0 -141
  87. package/src/components/ui/alert.tsx +0 -141
  88. package/src/components/ui/aspect-ratio.tsx +0 -245
  89. package/src/components/ui/avatar.tsx +0 -153
  90. package/src/components/ui/badge.tsx +0 -228
  91. package/src/components/ui/breadcrumb.tsx +0 -214
  92. package/src/components/ui/button.tsx +0 -222
  93. package/src/components/ui/calendar.tsx +0 -387
  94. package/src/components/ui/card.tsx +0 -214
  95. package/src/components/ui/checkbox.tsx +0 -259
  96. package/src/components/ui/collapsible.tsx +0 -135
  97. package/src/components/ui/color-picker.tsx +0 -97
  98. package/src/components/ui/command.tsx +0 -225
  99. package/src/components/ui/dialog.tsx +0 -334
  100. package/src/components/ui/dropdown-menu.tsx +0 -218
  101. package/src/components/ui/gesture-drawer.tsx +0 -11
  102. package/src/components/ui/hover-card.tsx +0 -29
  103. package/src/components/ui/index.ts +0 -190
  104. package/src/components/ui/input.tsx +0 -222
  105. package/src/components/ui/label.tsx +0 -29
  106. package/src/components/ui/lightbox.tsx +0 -606
  107. package/src/components/ui/magnetic-button.tsx +0 -129
  108. package/src/components/ui/media-gallery.tsx +0 -612
  109. package/src/components/ui/pagination.tsx +0 -123
  110. package/src/components/ui/popover.tsx +0 -185
  111. package/src/components/ui/progress.tsx +0 -30
  112. package/src/components/ui/radio-group.tsx +0 -257
  113. package/src/components/ui/scroll-area.tsx +0 -47
  114. package/src/components/ui/select.tsx +0 -374
  115. package/src/components/ui/separator.tsx +0 -145
  116. package/src/components/ui/sheet.tsx +0 -139
  117. package/src/components/ui/skeleton.tsx +0 -20
  118. package/src/components/ui/slider.tsx +0 -354
  119. package/src/components/ui/spotlight-card.tsx +0 -119
  120. package/src/components/ui/switch.tsx +0 -86
  121. package/src/components/ui/table.tsx +0 -329
  122. package/src/components/ui/tabs.tsx +0 -198
  123. package/src/components/ui/textarea.tsx +0 -28
  124. package/src/components/ui/toast.tsx +0 -317
  125. package/src/components/ui/toggle.tsx +0 -119
  126. package/src/components/ui/tooltip.tsx +0 -151
  127. package/src/components/virtual-list/index.tsx +0 -668
  128. package/src/hooks/use-chart.ts +0 -205
  129. package/src/hooks/use-data-table.ts +0 -182
  130. package/src/hooks/use-docs-pro-access.ts +0 -13
  131. package/src/hooks/use-license-check.ts +0 -65
  132. package/src/hooks/use-subscription.ts +0 -19
  133. package/src/hooks/use-toast.ts +0 -15
  134. package/src/index.ts +0 -14
  135. package/src/lib/ai-providers.ts +0 -377
  136. package/src/lib/component-metadata.ts +0 -18
  137. package/src/lib/micro-interactions.ts +0 -255
  138. package/src/lib/paddle.ts +0 -17
  139. package/src/lib/utils.ts +0 -6
  140. package/src/patterns/login-form/index.tsx +0 -276
  141. package/src/patterns/login-form/types.ts +0 -67
  142. package/src/setupTests.ts +0 -41
  143. package/src/styles/advanced-chart.css +0 -239
  144. package/src/styles/calendar.css +0 -35
  145. package/src/styles/design-system.css +0 -363
  146. package/src/styles/index.css +0 -85
  147. package/src/styles/tailwind.css +0 -7
  148. package/src/styles/tokens.css +0 -455
  149. package/src/types/moonui.d.ts +0 -22
  150. package/src/types/next-auth.d.ts +0 -21
  151. package/src/use-intersection-observer.tsx +0 -154
  152. package/src/use-local-storage.tsx +0 -71
  153. package/src/use-paddle.ts +0 -138
  154. package/src/use-performance-optimizer.ts +0 -389
  155. package/src/use-pro-access.ts +0 -141
  156. package/src/use-scroll-animation.ts +0 -219
  157. package/src/use-subscription.ts +0 -37
  158. package/src/use-toast.ts +0 -32
  159. package/src/utils/chart-helpers.ts +0 -357
  160. package/src/utils/cn.ts +0 -6
  161. package/src/utils/data-processing.ts +0 -151
  162. package/src/utils/license-validator.tsx +0 -183
@@ -1,426 +0,0 @@
1
- import { GitHubRepository, GitHubStats, GitHubActivity, LanguageStats, RateLimitInfo, StarHistory } from "./types"
2
-
3
- // Cache management
4
- const cache = new Map<string, { data: any; timestamp: number; expiresAt: number }>()
5
-
6
- // Docs mode detection
7
- const isDocsMode = () => {
8
- return typeof window !== "undefined" &&
9
- (window.location.pathname.includes("/docs/") ||
10
- window.location.pathname.includes("/components/"))
11
- }
12
-
13
- // Get cache duration based on mode
14
- const getCacheDuration = (defaultDuration: number) => {
15
- // Increase cache duration to 30 minutes in docs mode
16
- return isDocsMode() ? 1800000 : defaultDuration // 30 minutes : default
17
- }
18
-
19
- // Language colors
20
- export const LANGUAGE_COLORS: Record<string, string> = {
21
- JavaScript: "#f7df1e",
22
- TypeScript: "#3178c6",
23
- Python: "#3776ab",
24
- Java: "#ed8b00",
25
- "C++": "#00599c",
26
- "C#": "#239120",
27
- Go: "#00add8",
28
- Rust: "#000000",
29
- Swift: "#fa7343",
30
- Kotlin: "#7f52ff",
31
- PHP: "#777bb4",
32
- Ruby: "#cc342d",
33
- HTML: "#e34f26",
34
- CSS: "#1572b6",
35
- Vue: "#4fc08d",
36
- React: "#61dafb",
37
- Shell: "#89e051",
38
- Dart: "#0175c2",
39
- Elixir: "#6e4a7e",
40
- Scala: "#c22d40",
41
- R: "#198ce7",
42
- Julia: "#9558b2",
43
- Lua: "#000080",
44
- Perl: "#39457e",
45
- Haskell: "#5e5086",
46
- Clojure: "#db5855",
47
- Erlang: "#b83998",
48
- Objective_C: "#438eff",
49
- // Add more as needed
50
- }
51
-
52
- // API base URL
53
- const API_BASE = "https://api.github.com"
54
-
55
- // Helper to make authenticated requests
56
- async function githubFetch(url: string, token?: string): Promise<Response> {
57
- const headers: HeadersInit = {
58
- Accept: "application/vnd.github.v3+json",
59
- }
60
-
61
- if (token) {
62
- headers.Authorization = `token ${token}`
63
- }
64
-
65
- const response = await fetch(url, { headers })
66
-
67
- if (response.status === 403 && response.headers.get("X-RateLimit-Remaining") === "0") {
68
- const resetTime = parseInt(response.headers.get("X-RateLimit-Reset") || "0") * 1000
69
- const resetDate = new Date(resetTime)
70
- throw new Error(`GitHub API rate limit exceeded. Resets at ${resetDate.toLocaleTimeString()}`)
71
- }
72
-
73
- if (!response.ok) {
74
- throw new Error(`GitHub API error: ${response.status} ${response.statusText}`)
75
- }
76
-
77
- return response
78
- }
79
-
80
- // Get rate limit info
81
- export async function getRateLimitInfo(token?: string): Promise<RateLimitInfo> {
82
- const cacheKey = `rate-limit-${token || "public"}`
83
- const cached = cache.get(cacheKey)
84
-
85
- if (cached && cached.expiresAt > Date.now()) {
86
- return cached.data
87
- }
88
-
89
- const response = await githubFetch(`${API_BASE}/rate_limit`, token)
90
- const data = await response.json()
91
-
92
- const rateLimitInfo: RateLimitInfo = {
93
- limit: data.rate.limit,
94
- remaining: data.rate.remaining,
95
- reset: data.rate.reset * 1000,
96
- used: data.rate.used,
97
- }
98
-
99
- cache.set(cacheKey, {
100
- data: rateLimitInfo,
101
- timestamp: Date.now(),
102
- expiresAt: Date.now() + getCacheDuration(60000), // Docs modunda daha uzun cache
103
- })
104
-
105
- return rateLimitInfo
106
- }
107
-
108
- // Fetch user repositories
109
- export async function fetchUserRepositories(
110
- username: string,
111
- token?: string,
112
- options?: {
113
- sort?: string
114
- per_page?: number
115
- page?: number
116
- }
117
- ): Promise<GitHubRepository[]> {
118
- const params = new URLSearchParams({
119
- sort: options?.sort || "updated",
120
- per_page: String(options?.per_page || 100),
121
- page: String(options?.page || 1),
122
- })
123
-
124
- const cacheKey = `repos-${username}-${params.toString()}`
125
- const cached = cache.get(cacheKey)
126
-
127
- if (cached && cached.expiresAt > Date.now()) {
128
- return cached.data
129
- }
130
-
131
- const response = await githubFetch(`${API_BASE}/users/${username}/repos?${params}`, token)
132
- const repos = await response.json()
133
-
134
- cache.set(cacheKey, {
135
- data: repos,
136
- timestamp: Date.now(),
137
- expiresAt: Date.now() + getCacheDuration(300000), // 30 minutes in docs mode
138
- })
139
-
140
- return repos
141
- }
142
-
143
- // Fetch single repository
144
- export async function fetchRepository(
145
- owner: string,
146
- repo: string,
147
- token?: string
148
- ): Promise<GitHubRepository> {
149
- const cacheKey = `repo-${owner}-${repo}`
150
- const cached = cache.get(cacheKey)
151
-
152
- if (cached && cached.expiresAt > Date.now()) {
153
- return cached.data
154
- }
155
-
156
- const response = await githubFetch(`${API_BASE}/repos/${owner}/${repo}`, token)
157
- const repository = await response.json()
158
-
159
- cache.set(cacheKey, {
160
- data: repository,
161
- timestamp: Date.now(),
162
- expiresAt: Date.now() + getCacheDuration(300000), // 30 minutes in docs mode
163
- })
164
-
165
- return repository
166
- }
167
-
168
- // Fetch repository contributors count
169
- export async function fetchContributorsCount(
170
- owner: string,
171
- repo: string,
172
- token?: string
173
- ): Promise<number> {
174
- const cacheKey = `contributors-${owner}-${repo}`
175
- const cached = cache.get(cacheKey)
176
-
177
- if (cached && cached.expiresAt > Date.now()) {
178
- return cached.data
179
- }
180
-
181
- try {
182
- const response = await githubFetch(
183
- `${API_BASE}/repos/${owner}/${repo}/contributors?per_page=1&anon=true`,
184
- token
185
- )
186
-
187
- // Get total count from Link header
188
- const linkHeader = response.headers.get("Link")
189
- if (linkHeader) {
190
- const match = linkHeader.match(/page=(\d+)>; rel="last"/)
191
- if (match) {
192
- const count = parseInt(match[1])
193
- cache.set(cacheKey, {
194
- data: count,
195
- timestamp: Date.now(),
196
- expiresAt: Date.now() + getCacheDuration(3600000), // 30 minutes in docs mode
197
- })
198
- return count
199
- }
200
- }
201
-
202
- // If no pagination, count the results
203
- const contributors = await response.json()
204
- const count = contributors.length
205
-
206
- cache.set(cacheKey, {
207
- data: count,
208
- timestamp: Date.now(),
209
- expiresAt: Date.now() + getCacheDuration(3600000), // 30 minutes in docs mode
210
- })
211
-
212
- return count
213
- } catch (error) {
214
- console.error("Failed to fetch contributors:", error)
215
- return 0
216
- }
217
- }
218
-
219
- // Fetch repository star history (limited without token)
220
- export async function fetchStarHistory(
221
- owner: string,
222
- repo: string,
223
- token?: string
224
- ): Promise<StarHistory[]> {
225
- const cacheKey = `star-history-${owner}-${repo}`
226
- const cached = cache.get(cacheKey)
227
-
228
- if (cached && cached.expiresAt > Date.now()) {
229
- return cached.data
230
- }
231
-
232
- try {
233
- // This is a simplified version - for full star history you'd need
234
- // to use the stargazers API with Accept: application/vnd.github.v3.star+json
235
- // header and paginate through all results
236
- const response = await githubFetch(`${API_BASE}/repos/${owner}/${repo}`, token)
237
- const repoData = await response.json()
238
-
239
- // For now, return current count as single data point
240
- const history: StarHistory[] = [{
241
- date: new Date().toISOString(),
242
- count: repoData.stargazers_count,
243
- repository: repoData.full_name,
244
- }]
245
-
246
- cache.set(cacheKey, {
247
- data: history,
248
- timestamp: Date.now(),
249
- expiresAt: Date.now() + getCacheDuration(3600000), // 30 minutes in docs mode
250
- })
251
-
252
- return history
253
- } catch (error) {
254
- console.error("Failed to fetch star history:", error)
255
- return []
256
- }
257
- }
258
-
259
- // Calculate repository statistics
260
- export function calculateStats(repositories: GitHubRepository[]): GitHubStats {
261
- const totalStars = repositories.reduce((sum, repo) => sum + repo.stargazers_count, 0)
262
- const totalForks = repositories.reduce((sum, repo) => sum + repo.forks_count, 0)
263
- const totalWatchers = repositories.reduce((sum, repo) => sum + repo.watchers_count, 0)
264
- const totalIssues = repositories.reduce((sum, repo) => sum + repo.open_issues_count, 0)
265
-
266
- const avgStarsPerRepo = repositories.length > 0 ? totalStars / repositories.length : 0
267
-
268
- const mostStarredRepo = repositories.reduce((max, repo) =>
269
- repo.stargazers_count > (max?.stargazers_count || 0) ? repo : max
270
- , null as GitHubRepository | null)
271
-
272
- // Calculate language statistics
273
- const languageMap = new Map<string, number>()
274
- repositories.forEach(repo => {
275
- if (repo.language) {
276
- languageMap.set(repo.language, (languageMap.get(repo.language) || 0) + 1)
277
- }
278
- })
279
-
280
- const totalRepos = repositories.length
281
- const languages: LanguageStats[] = Array.from(languageMap.entries())
282
- .map(([language, count]) => ({
283
- language,
284
- count,
285
- percentage: (count / totalRepos) * 100,
286
- color: LANGUAGE_COLORS[language] || "#6b7280",
287
- }))
288
- .sort((a, b) => b.count - a.count)
289
-
290
- // Generate recent activity (mock for now)
291
- const recentActivity: GitHubActivity[] = repositories
292
- .slice(0, 5)
293
- .map(repo => ({
294
- type: "star" as const,
295
- repository: repo.full_name,
296
- timestamp: repo.updated_at,
297
- description: `Repository updated`,
298
- }))
299
-
300
- return {
301
- totalStars,
302
- totalForks,
303
- totalWatchers,
304
- totalIssues,
305
- avgStarsPerRepo,
306
- mostStarredRepo,
307
- recentActivity,
308
- languages,
309
- }
310
- }
311
-
312
- // Format numbers for display
313
- export function formatNumber(num: number): string {
314
- if (num >= 1000000) {
315
- return (num / 1000000).toFixed(1) + "M"
316
- }
317
- if (num >= 1000) {
318
- return (num / 1000).toFixed(1) + "k"
319
- }
320
- return num.toString()
321
- }
322
-
323
- // Format date for display
324
- export function formatDate(dateString: string): string {
325
- const date = new Date(dateString)
326
- const now = new Date()
327
- const diffMs = now.getTime() - date.getTime()
328
- const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24))
329
-
330
- if (diffDays === 0) {
331
- const diffHours = Math.floor(diffMs / (1000 * 60 * 60))
332
- if (diffHours === 0) {
333
- const diffMinutes = Math.floor(diffMs / (1000 * 60))
334
- return `${diffMinutes} minutes ago`
335
- }
336
- return `${diffHours} hours ago`
337
- }
338
-
339
- if (diffDays === 1) return "yesterday"
340
- if (diffDays < 7) return `${diffDays} days ago`
341
- if (diffDays < 30) return `${Math.floor(diffDays / 7)} weeks ago`
342
- if (diffDays < 365) return `${Math.floor(diffDays / 30)} months ago`
343
-
344
- return date.toLocaleDateString("en-US", {
345
- year: "numeric",
346
- month: "short",
347
- day: "numeric",
348
- })
349
- }
350
-
351
- // Clear cache
352
- export function clearCache(pattern?: string): void {
353
- if (pattern) {
354
- for (const key of cache.keys()) {
355
- if (key.includes(pattern)) {
356
- cache.delete(key)
357
- }
358
- }
359
- } else {
360
- cache.clear()
361
- }
362
- }
363
-
364
- // Export data as JSON
365
- export function exportData(data: any, filename: string): void {
366
- const jsonString = JSON.stringify(data, null, 2)
367
- const blob = new Blob([jsonString], { type: "application/json" })
368
- const url = URL.createObjectURL(blob)
369
-
370
- const link = document.createElement("a")
371
- link.href = url
372
- link.download = filename
373
- document.body.appendChild(link)
374
- link.click()
375
- document.body.removeChild(link)
376
-
377
- URL.revokeObjectURL(url)
378
- }
379
-
380
- // Export data as CSV
381
- export function exportAsCSV(repositories: GitHubRepository[], filename: string): void {
382
- const headers = [
383
- "Name",
384
- "Owner",
385
- "Stars",
386
- "Forks",
387
- "Watchers",
388
- "Issues",
389
- "Language",
390
- "Description",
391
- "URL",
392
- "Created",
393
- "Updated",
394
- ]
395
-
396
- const rows = repositories.map(repo => [
397
- repo.name,
398
- repo.owner.login,
399
- repo.stargazers_count,
400
- repo.forks_count,
401
- repo.watchers_count,
402
- repo.open_issues_count,
403
- repo.language || "",
404
- repo.description || "",
405
- repo.html_url,
406
- new Date(repo.created_at).toLocaleDateString(),
407
- new Date(repo.updated_at).toLocaleDateString(),
408
- ])
409
-
410
- const csvContent = [
411
- headers.join(","),
412
- ...rows.map(row => row.map(cell => `"${cell}"`).join(",")),
413
- ].join("\n")
414
-
415
- const blob = new Blob([csvContent], { type: "text/csv" })
416
- const url = URL.createObjectURL(blob)
417
-
418
- const link = document.createElement("a")
419
- link.href = url
420
- link.download = filename
421
- document.body.appendChild(link)
422
- link.click()
423
- document.body.removeChild(link)
424
-
425
- URL.revokeObjectURL(url)
426
- }