@moontra/moonui-pro 2.18.5 → 2.18.6
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
|
@@ -61469,7 +61469,7 @@ async function fetchUserRepositories(username, token, options) {
|
|
|
61469
61469
|
data: repos,
|
|
61470
61470
|
timestamp: Date.now(),
|
|
61471
61471
|
expiresAt: Date.now() + getCacheDuration(3e5)
|
|
61472
|
-
//
|
|
61472
|
+
// 30 minutes in docs mode
|
|
61473
61473
|
});
|
|
61474
61474
|
return repos;
|
|
61475
61475
|
}
|
|
@@ -61485,7 +61485,7 @@ async function fetchRepository(owner, repo, token) {
|
|
|
61485
61485
|
data: repository,
|
|
61486
61486
|
timestamp: Date.now(),
|
|
61487
61487
|
expiresAt: Date.now() + getCacheDuration(3e5)
|
|
61488
|
-
//
|
|
61488
|
+
// 30 minutes in docs mode
|
|
61489
61489
|
});
|
|
61490
61490
|
return repository;
|
|
61491
61491
|
}
|
|
@@ -61509,7 +61509,7 @@ async function fetchContributorsCount(owner, repo, token) {
|
|
|
61509
61509
|
data: count4,
|
|
61510
61510
|
timestamp: Date.now(),
|
|
61511
61511
|
expiresAt: Date.now() + getCacheDuration(36e5)
|
|
61512
|
-
//
|
|
61512
|
+
// 30 minutes in docs mode
|
|
61513
61513
|
});
|
|
61514
61514
|
return count4;
|
|
61515
61515
|
}
|
|
@@ -61520,7 +61520,7 @@ async function fetchContributorsCount(owner, repo, token) {
|
|
|
61520
61520
|
data: count3,
|
|
61521
61521
|
timestamp: Date.now(),
|
|
61522
61522
|
expiresAt: Date.now() + getCacheDuration(36e5)
|
|
61523
|
-
//
|
|
61523
|
+
// 30 minutes in docs mode
|
|
61524
61524
|
});
|
|
61525
61525
|
return count3;
|
|
61526
61526
|
} catch (error) {
|
|
@@ -61879,12 +61879,12 @@ function useGitHubData({
|
|
|
61879
61879
|
username,
|
|
61880
61880
|
repository,
|
|
61881
61881
|
repositories?.join(","),
|
|
61882
|
-
//
|
|
61882
|
+
// Convert array to string to keep reference stable
|
|
61883
61883
|
token,
|
|
61884
61884
|
sortBy,
|
|
61885
61885
|
maxItems,
|
|
61886
61886
|
checkMilestones,
|
|
61887
|
-
//
|
|
61887
|
+
// Now stable
|
|
61888
61888
|
onDataUpdate,
|
|
61889
61889
|
onError,
|
|
61890
61890
|
isDocsMode2,
|
|
@@ -62594,7 +62594,7 @@ var GitHubStarsInternal = ({
|
|
|
62594
62594
|
docsMode: isDocsMode2,
|
|
62595
62595
|
// Docs mode flag'ini gönder
|
|
62596
62596
|
mockDataFallback: true,
|
|
62597
|
-
//
|
|
62597
|
+
// Use mock data in docs mode
|
|
62598
62598
|
forceMockData: useMockData
|
|
62599
62599
|
// Force mock data if true
|
|
62600
62600
|
});
|
|
@@ -62751,7 +62751,7 @@ var GitHubStarsInternal = ({
|
|
|
62751
62751
|
" requests remaining.",
|
|
62752
62752
|
token ? "" : " Consider adding a GitHub token for higher limits."
|
|
62753
62753
|
] }) }),
|
|
62754
|
-
isDocsMode2 && true && /* @__PURE__ */ jsx("div", { className: "mt-2 text-xs text-muted-foreground text-center", children: "\u{1F4DA} Docs Mode: API
|
|
62754
|
+
isDocsMode2 && true && /* @__PURE__ */ jsx("div", { className: "mt-2 text-xs text-muted-foreground text-center", children: "\u{1F4DA} Docs Mode: API requests optimized" })
|
|
62755
62755
|
]
|
|
62756
62756
|
}
|
|
62757
62757
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.6",
|
|
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",
|
|
@@ -12,8 +12,8 @@ const isDocsMode = () => {
|
|
|
12
12
|
|
|
13
13
|
// Get cache duration based on mode
|
|
14
14
|
const getCacheDuration = (defaultDuration: number) => {
|
|
15
|
-
//
|
|
16
|
-
return isDocsMode() ? 1800000 : defaultDuration // 30
|
|
15
|
+
// Increase cache duration to 30 minutes in docs mode
|
|
16
|
+
return isDocsMode() ? 1800000 : defaultDuration // 30 minutes : default
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// Language colors
|
|
@@ -134,7 +134,7 @@ export async function fetchUserRepositories(
|
|
|
134
134
|
cache.set(cacheKey, {
|
|
135
135
|
data: repos,
|
|
136
136
|
timestamp: Date.now(),
|
|
137
|
-
expiresAt: Date.now() + getCacheDuration(300000), //
|
|
137
|
+
expiresAt: Date.now() + getCacheDuration(300000), // 30 minutes in docs mode
|
|
138
138
|
})
|
|
139
139
|
|
|
140
140
|
return repos
|
|
@@ -159,7 +159,7 @@ export async function fetchRepository(
|
|
|
159
159
|
cache.set(cacheKey, {
|
|
160
160
|
data: repository,
|
|
161
161
|
timestamp: Date.now(),
|
|
162
|
-
expiresAt: Date.now() + getCacheDuration(300000), //
|
|
162
|
+
expiresAt: Date.now() + getCacheDuration(300000), // 30 minutes in docs mode
|
|
163
163
|
})
|
|
164
164
|
|
|
165
165
|
return repository
|
|
@@ -193,7 +193,7 @@ export async function fetchContributorsCount(
|
|
|
193
193
|
cache.set(cacheKey, {
|
|
194
194
|
data: count,
|
|
195
195
|
timestamp: Date.now(),
|
|
196
|
-
expiresAt: Date.now() + getCacheDuration(3600000), //
|
|
196
|
+
expiresAt: Date.now() + getCacheDuration(3600000), // 30 minutes in docs mode
|
|
197
197
|
})
|
|
198
198
|
return count
|
|
199
199
|
}
|
|
@@ -206,7 +206,7 @@ export async function fetchContributorsCount(
|
|
|
206
206
|
cache.set(cacheKey, {
|
|
207
207
|
data: count,
|
|
208
208
|
timestamp: Date.now(),
|
|
209
|
-
expiresAt: Date.now() + getCacheDuration(3600000), //
|
|
209
|
+
expiresAt: Date.now() + getCacheDuration(3600000), // 30 minutes in docs mode
|
|
210
210
|
})
|
|
211
211
|
|
|
212
212
|
return count
|
|
@@ -246,7 +246,7 @@ export async function fetchStarHistory(
|
|
|
246
246
|
cache.set(cacheKey, {
|
|
247
247
|
data: history,
|
|
248
248
|
timestamp: Date.now(),
|
|
249
|
-
expiresAt: Date.now() + getCacheDuration(3600000), //
|
|
249
|
+
expiresAt: Date.now() + getCacheDuration(3600000), // 30 minutes in docs mode
|
|
250
250
|
})
|
|
251
251
|
|
|
252
252
|
return history
|
|
@@ -29,7 +29,7 @@ interface UseGitHubDataOptions {
|
|
|
29
29
|
onDataUpdate?: (stats: GitHubStats) => void
|
|
30
30
|
onMilestoneReached?: (milestone: Milestone) => void
|
|
31
31
|
milestones?: number[]
|
|
32
|
-
//
|
|
32
|
+
// For docs mode optimizations
|
|
33
33
|
docsMode?: boolean
|
|
34
34
|
mockDataFallback?: boolean
|
|
35
35
|
forceMockData?: boolean // Force mock data instead of API
|
|
@@ -52,12 +52,12 @@ export function useGitHubData({
|
|
|
52
52
|
mockDataFallback = true,
|
|
53
53
|
forceMockData = false,
|
|
54
54
|
}: UseGitHubDataOptions) {
|
|
55
|
-
// Docs mode
|
|
55
|
+
// Docs mode detection
|
|
56
56
|
const isDocsMode = docsMode || (typeof window !== "undefined" &&
|
|
57
57
|
(window.location.pathname.includes("/docs/") ||
|
|
58
58
|
window.location.pathname.includes("/components/")))
|
|
59
59
|
|
|
60
|
-
//
|
|
60
|
+
// Disable autoRefresh in docs mode
|
|
61
61
|
const effectiveAutoRefresh = isDocsMode ? false : autoRefresh
|
|
62
62
|
const [repos, setRepos] = useState<GitHubRepository[]>([])
|
|
63
63
|
const [stats, setStats] = useState<GitHubStats | null>(null)
|
|
@@ -69,11 +69,11 @@ export function useGitHubData({
|
|
|
69
69
|
const refreshTimeoutRef = useRef<NodeJS.Timeout>()
|
|
70
70
|
const previousStarsRef = useRef<Map<string, number>>(new Map())
|
|
71
71
|
const errorCountRef = useRef<number>(0) // Hata sayısını takip et
|
|
72
|
-
const maxErrorCount = isDocsMode ? 1 : 2 //
|
|
72
|
+
const maxErrorCount = isDocsMode ? 1 : 2 // Fewer retries in docs mode
|
|
73
73
|
const hasInitialFetchedRef = useRef(false) // İlk fetch yapıldı mı?
|
|
74
74
|
const docsDataCacheRef = useRef<GitHubRepository[] | null>(null) // Docs mode cache
|
|
75
75
|
|
|
76
|
-
// checkMilestones
|
|
76
|
+
// Store checkMilestones function as ref - this way it won't be recreated on every render
|
|
77
77
|
const milestonesRef = useRef(milestones)
|
|
78
78
|
const onMilestoneReachedRef = useRef(onMilestoneReached)
|
|
79
79
|
|
|
@@ -135,7 +135,7 @@ export function useGitHubData({
|
|
|
135
135
|
if (errorCountRef.current >= maxErrorCount) {
|
|
136
136
|
console.warn("Maximum error count reached. Stopping requests.")
|
|
137
137
|
|
|
138
|
-
//
|
|
138
|
+
// Show mock data if in docs mode and mockDataFallback is active
|
|
139
139
|
if (isDocsMode && mockDataFallback) {
|
|
140
140
|
const mockData = getMockGitHubData(username, repository, repositories)
|
|
141
141
|
setRepos(mockData)
|
|
@@ -150,7 +150,7 @@ export function useGitHubData({
|
|
|
150
150
|
return
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
//
|
|
153
|
+
// Don't make requests if required info is missing
|
|
154
154
|
const hasValidInput =
|
|
155
155
|
(username && repository) || // Tek repository modu
|
|
156
156
|
(username && repositories && repositories.length > 0) || // Çoklu repository modu
|
|
@@ -269,10 +269,10 @@ export function useGitHubData({
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
setLastUpdated(new Date())
|
|
272
|
-
//
|
|
272
|
+
// Reset error counter on success
|
|
273
273
|
errorCountRef.current = 0
|
|
274
274
|
|
|
275
|
-
//
|
|
275
|
+
// Cache successful data in docs mode
|
|
276
276
|
if (isDocsMode) {
|
|
277
277
|
hasInitialFetchedRef.current = true
|
|
278
278
|
docsDataCacheRef.current = enhancedRepos
|
|
@@ -285,7 +285,7 @@ export function useGitHubData({
|
|
|
285
285
|
errorCountRef.current += 1
|
|
286
286
|
console.error(`GitHub API error (${errorCountRef.current}/${maxErrorCount}):`, errorMessage)
|
|
287
287
|
|
|
288
|
-
//
|
|
288
|
+
// Show mock data if in docs mode and mockDataFallback is active
|
|
289
289
|
if (isDocsMode && mockDataFallback && !hasInitialFetchedRef.current) {
|
|
290
290
|
console.warn("[Docs Mode] API failed, using mock data")
|
|
291
291
|
const mockData = getMockGitHubData(username, repository, repositories)
|
|
@@ -304,11 +304,11 @@ export function useGitHubData({
|
|
|
304
304
|
}, [
|
|
305
305
|
username,
|
|
306
306
|
repository,
|
|
307
|
-
repositories?.join(','), //
|
|
307
|
+
repositories?.join(','), // Convert array to string to keep reference stable
|
|
308
308
|
token,
|
|
309
309
|
sortBy,
|
|
310
310
|
maxItems,
|
|
311
|
-
checkMilestones, //
|
|
311
|
+
checkMilestones, // Now stable
|
|
312
312
|
onDataUpdate,
|
|
313
313
|
onError,
|
|
314
314
|
isDocsMode,
|
|
@@ -318,7 +318,7 @@ export function useGitHubData({
|
|
|
318
318
|
|
|
319
319
|
// Initial fetch
|
|
320
320
|
useEffect(() => {
|
|
321
|
-
//
|
|
321
|
+
// Only fetch if there's valid input
|
|
322
322
|
const hasValidInput =
|
|
323
323
|
(username && repository) ||
|
|
324
324
|
(username && repositories && repositories.length > 0) ||
|
|
@@ -334,7 +334,7 @@ export function useGitHubData({
|
|
|
334
334
|
|
|
335
335
|
// Auto-refresh
|
|
336
336
|
useEffect(() => {
|
|
337
|
-
//
|
|
337
|
+
// Completely disable auto-refresh in docs mode
|
|
338
338
|
if (!effectiveAutoRefresh) return
|
|
339
339
|
|
|
340
340
|
const scheduleRefresh = () => {
|
|
@@ -354,7 +354,7 @@ export function useGitHubData({
|
|
|
354
354
|
}, [effectiveAutoRefresh, refreshInterval, fetchData])
|
|
355
355
|
|
|
356
356
|
const refresh = useCallback(() => {
|
|
357
|
-
//
|
|
357
|
+
// Limit refresh in docs mode
|
|
358
358
|
if (isDocsMode && hasInitialFetchedRef.current) {
|
|
359
359
|
console.warn("[Docs Mode] Refresh disabled after initial fetch")
|
|
360
360
|
return Promise.resolve()
|
|
@@ -74,10 +74,10 @@ const GitHubStarsInternal: React.FC<GitHubStarsProps> = ({
|
|
|
74
74
|
(window.location.pathname.includes("/docs/") ||
|
|
75
75
|
window.location.pathname.includes("/components/"))
|
|
76
76
|
|
|
77
|
-
//
|
|
77
|
+
// Override some features in docs mode
|
|
78
78
|
const effectiveAutoRefresh = isDocsMode ? false : autoRefresh
|
|
79
79
|
const effectiveNotifications = isDocsMode ? false : enableNotifications
|
|
80
|
-
const effectiveRefreshInterval = isDocsMode ? 3600000 : refreshInterval //
|
|
80
|
+
const effectiveRefreshInterval = isDocsMode ? 3600000 : refreshInterval // 1 hour in docs mode
|
|
81
81
|
const { notify } = useGitHubNotifications(effectiveNotifications)
|
|
82
82
|
|
|
83
83
|
// onMilestoneReached callback'ini memoize et
|
|
@@ -123,7 +123,7 @@ const GitHubStarsInternal: React.FC<GitHubStarsProps> = ({
|
|
|
123
123
|
onMilestoneReached: handleMilestoneReached,
|
|
124
124
|
milestones,
|
|
125
125
|
docsMode: isDocsMode, // Docs mode flag'ini gönder
|
|
126
|
-
mockDataFallback: true, //
|
|
126
|
+
mockDataFallback: true, // Use mock data in docs mode
|
|
127
127
|
forceMockData: useMockData, // Force mock data if true
|
|
128
128
|
})
|
|
129
129
|
|
|
@@ -317,7 +317,7 @@ const GitHubStarsInternal: React.FC<GitHubStarsProps> = ({
|
|
|
317
317
|
>
|
|
318
318
|
{renderVariant()}
|
|
319
319
|
|
|
320
|
-
{/* Rate limit warning -
|
|
320
|
+
{/* Rate limit warning - Don't show in docs mode */}
|
|
321
321
|
{!isDocsMode && rateLimitInfo && rateLimitInfo.remaining < 10 && (
|
|
322
322
|
<div className="mt-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 rounded-md text-sm">
|
|
323
323
|
<p className="text-yellow-800 dark:text-yellow-200">
|
|
@@ -327,10 +327,10 @@ const GitHubStarsInternal: React.FC<GitHubStarsProps> = ({
|
|
|
327
327
|
</div>
|
|
328
328
|
)}
|
|
329
329
|
|
|
330
|
-
{/* Docs mode indicator -
|
|
330
|
+
{/* Docs mode indicator - only show in development mode */}
|
|
331
331
|
{isDocsMode && process.env.NODE_ENV === "development" && (
|
|
332
332
|
<div className="mt-2 text-xs text-muted-foreground text-center">
|
|
333
|
-
📚 Docs Mode: API
|
|
333
|
+
📚 Docs Mode: API requests optimized
|
|
334
334
|
</div>
|
|
335
335
|
)}
|
|
336
336
|
</motion.div>
|