@moontra/moonui-pro 2.18.4 → 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
- // Docs modunda 30 dakika
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
- // Docs modunda 30 dakika
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
- // Docs modunda 30 dakika
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
- // Docs modunda 30 dakika
61523
+ // 30 minutes in docs mode
61524
61524
  });
61525
61525
  return count3;
61526
61526
  } catch (error) {
@@ -61684,7 +61684,8 @@ function useGitHubData({
61684
61684
  onMilestoneReached,
61685
61685
  milestones = [10, 50, 100, 500, 1e3, 5e3, 1e4],
61686
61686
  docsMode = false,
61687
- mockDataFallback = true
61687
+ mockDataFallback = true,
61688
+ forceMockData = false
61688
61689
  }) {
61689
61690
  const isDocsMode2 = docsMode || typeof window !== "undefined" && (window.location.pathname.includes("/docs/") || window.location.pathname.includes("/components/"));
61690
61691
  const effectiveAutoRefresh = isDocsMode2 ? false : autoRefresh;
@@ -61728,6 +61729,16 @@ function useGitHubData({
61728
61729
  });
61729
61730
  }, []);
61730
61731
  const fetchData = useCallback(async () => {
61732
+ if (forceMockData) {
61733
+ console.log("[Mock Mode] Using mock data");
61734
+ const mockData = getMockGitHubData(username, repository, repositories);
61735
+ setRepos(mockData);
61736
+ const calculatedStats = calculateStats(mockData);
61737
+ setStats(calculatedStats);
61738
+ setError(null);
61739
+ setLoading(false);
61740
+ return;
61741
+ }
61731
61742
  if (isDocsMode2 && hasInitialFetchedRef.current && docsDataCacheRef.current) {
61732
61743
  console.log("[Docs Mode] Returning cached data, skipping API request");
61733
61744
  setRepos(docsDataCacheRef.current);
@@ -61868,16 +61879,17 @@ function useGitHubData({
61868
61879
  username,
61869
61880
  repository,
61870
61881
  repositories?.join(","),
61871
- // Array'i string'e çevir ki referans değişmesin
61882
+ // Convert array to string to keep reference stable
61872
61883
  token,
61873
61884
  sortBy,
61874
61885
  maxItems,
61875
61886
  checkMilestones,
61876
- // Artık stable
61887
+ // Now stable
61877
61888
  onDataUpdate,
61878
61889
  onError,
61879
61890
  isDocsMode2,
61880
- mockDataFallback
61891
+ mockDataFallback,
61892
+ forceMockData
61881
61893
  ]);
61882
61894
  useEffect(() => {
61883
61895
  const hasValidInput = username && repository || username && repositories && repositories.length > 0 || repositories && repositories.length > 0 && repositories.every((r2) => r2.includes("/")) || username;
@@ -62498,6 +62510,7 @@ var GitHubStarsInternal = ({
62498
62510
  repository,
62499
62511
  repositories,
62500
62512
  token,
62513
+ useMockData = false,
62501
62514
  variant = "card",
62502
62515
  layout = "grid",
62503
62516
  showDescription = true,
@@ -62534,6 +62547,10 @@ var GitHubStarsInternal = ({
62534
62547
  size: size4 = "md",
62535
62548
  customColors
62536
62549
  }) => {
62550
+ const hasValidProps = useMockData || username || repositories && repositories.length > 0;
62551
+ if (!useMockData && !hasValidProps) {
62552
+ return null;
62553
+ }
62537
62554
  const isDocsMode2 = typeof window !== "undefined" && (window.location.pathname.includes("/docs/") || window.location.pathname.includes("/components/"));
62538
62555
  const effectiveAutoRefresh = isDocsMode2 ? false : autoRefresh;
62539
62556
  const effectiveNotifications = isDocsMode2 ? false : enableNotifications;
@@ -62576,8 +62593,10 @@ var GitHubStarsInternal = ({
62576
62593
  milestones,
62577
62594
  docsMode: isDocsMode2,
62578
62595
  // Docs mode flag'ini gönder
62579
- mockDataFallback: true
62580
- // Docs modunda mock data kullan
62596
+ mockDataFallback: true,
62597
+ // Use mock data in docs mode
62598
+ forceMockData: useMockData
62599
+ // Force mock data if true
62581
62600
  });
62582
62601
  const handleExport = t__default.useCallback((format7) => {
62583
62602
  if (!enableExport)
@@ -62732,7 +62751,7 @@ var GitHubStarsInternal = ({
62732
62751
  " requests remaining.",
62733
62752
  token ? "" : " Consider adding a GitHub token for higher limits."
62734
62753
  ] }) }),
62735
- isDocsMode2 && true && /* @__PURE__ */ jsx("div", { className: "mt-2 text-xs text-muted-foreground text-center", children: "\u{1F4DA} Docs Mode: API istekleri optimize edildi" })
62754
+ isDocsMode2 && true && /* @__PURE__ */ jsx("div", { className: "mt-2 text-xs text-muted-foreground text-center", children: "\u{1F4DA} Docs Mode: API requests optimized" })
62736
62755
  ]
62737
62756
  }
62738
62757
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.18.4",
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
- // Docs modunda cache süresini 30 dakikaya çıkar
16
- return isDocsMode() ? 1800000 : defaultDuration // 30 dakika : default
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), // Docs modunda 30 dakika
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), // Docs modunda 30 dakika
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), // Docs modunda 30 dakika
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), // Docs modunda 30 dakika
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), // Docs modunda 30 dakika
249
+ expiresAt: Date.now() + getCacheDuration(3600000), // 30 minutes in docs mode
250
250
  })
251
251
 
252
252
  return history
@@ -29,9 +29,10 @@ interface UseGitHubDataOptions {
29
29
  onDataUpdate?: (stats: GitHubStats) => void
30
30
  onMilestoneReached?: (milestone: Milestone) => void
31
31
  milestones?: number[]
32
- // Docs mode optimizasyonları için
32
+ // For docs mode optimizations
33
33
  docsMode?: boolean
34
34
  mockDataFallback?: boolean
35
+ forceMockData?: boolean // Force mock data instead of API
35
36
  }
36
37
 
37
38
  export function useGitHubData({
@@ -49,13 +50,14 @@ export function useGitHubData({
49
50
  milestones = [10, 50, 100, 500, 1000, 5000, 10000],
50
51
  docsMode = false,
51
52
  mockDataFallback = true,
53
+ forceMockData = false,
52
54
  }: UseGitHubDataOptions) {
53
- // Docs mode tespiti
55
+ // Docs mode detection
54
56
  const isDocsMode = docsMode || (typeof window !== "undefined" &&
55
57
  (window.location.pathname.includes("/docs/") ||
56
58
  window.location.pathname.includes("/components/")))
57
59
 
58
- // Docs modunda autoRefresh'i devre dışı bırak
60
+ // Disable autoRefresh in docs mode
59
61
  const effectiveAutoRefresh = isDocsMode ? false : autoRefresh
60
62
  const [repos, setRepos] = useState<GitHubRepository[]>([])
61
63
  const [stats, setStats] = useState<GitHubStats | null>(null)
@@ -67,11 +69,11 @@ export function useGitHubData({
67
69
  const refreshTimeoutRef = useRef<NodeJS.Timeout>()
68
70
  const previousStarsRef = useRef<Map<string, number>>(new Map())
69
71
  const errorCountRef = useRef<number>(0) // Hata sayısını takip et
70
- const maxErrorCount = isDocsMode ? 1 : 2 // Docs modunda daha az deneme
72
+ const maxErrorCount = isDocsMode ? 1 : 2 // Fewer retries in docs mode
71
73
  const hasInitialFetchedRef = useRef(false) // İlk fetch yapıldı mı?
72
74
  const docsDataCacheRef = useRef<GitHubRepository[] | null>(null) // Docs mode cache
73
75
 
74
- // checkMilestones fonksiyonunu ref olarak sakla - bu şekilde her render'da yeniden oluşturulmaz
76
+ // Store checkMilestones function as ref - this way it won't be recreated on every render
75
77
  const milestonesRef = useRef(milestones)
76
78
  const onMilestoneReachedRef = useRef(onMilestoneReached)
77
79
 
@@ -107,6 +109,18 @@ export function useGitHubData({
107
109
  }, []) // Boş dependency array - fonksiyon asla yeniden oluşturulmaz
108
110
 
109
111
  const fetchData = useCallback(async () => {
112
+ // If forceMockData is true, always return mock data
113
+ if (forceMockData) {
114
+ console.log("[Mock Mode] Using mock data")
115
+ const mockData = getMockGitHubData(username, repository, repositories)
116
+ setRepos(mockData)
117
+ const calculatedStats = calculateStats(mockData)
118
+ setStats(calculatedStats)
119
+ setError(null)
120
+ setLoading(false)
121
+ return
122
+ }
123
+
110
124
  // Docs modunda ve daha önce fetch yapıldıysa, cache'den döndür
111
125
  if (isDocsMode && hasInitialFetchedRef.current && docsDataCacheRef.current) {
112
126
  console.log("[Docs Mode] Returning cached data, skipping API request")
@@ -121,7 +135,7 @@ export function useGitHubData({
121
135
  if (errorCountRef.current >= maxErrorCount) {
122
136
  console.warn("Maximum error count reached. Stopping requests.")
123
137
 
124
- // Docs modunda ve mockDataFallback aktifse mock data göster
138
+ // Show mock data if in docs mode and mockDataFallback is active
125
139
  if (isDocsMode && mockDataFallback) {
126
140
  const mockData = getMockGitHubData(username, repository, repositories)
127
141
  setRepos(mockData)
@@ -136,7 +150,7 @@ export function useGitHubData({
136
150
  return
137
151
  }
138
152
 
139
- // Gerekli bilgiler yoksa istek yapma
153
+ // Don't make requests if required info is missing
140
154
  const hasValidInput =
141
155
  (username && repository) || // Tek repository modu
142
156
  (username && repositories && repositories.length > 0) || // Çoklu repository modu
@@ -255,10 +269,10 @@ export function useGitHubData({
255
269
  }
256
270
 
257
271
  setLastUpdated(new Date())
258
- // Başarılı olduğunda hata sayacını sıfırla
272
+ // Reset error counter on success
259
273
  errorCountRef.current = 0
260
274
 
261
- // Docs modunda başarılı veriyi cache'le
275
+ // Cache successful data in docs mode
262
276
  if (isDocsMode) {
263
277
  hasInitialFetchedRef.current = true
264
278
  docsDataCacheRef.current = enhancedRepos
@@ -271,7 +285,7 @@ export function useGitHubData({
271
285
  errorCountRef.current += 1
272
286
  console.error(`GitHub API error (${errorCountRef.current}/${maxErrorCount}):`, errorMessage)
273
287
 
274
- // Docs modunda ve mockDataFallback aktifse mock data göster
288
+ // Show mock data if in docs mode and mockDataFallback is active
275
289
  if (isDocsMode && mockDataFallback && !hasInitialFetchedRef.current) {
276
290
  console.warn("[Docs Mode] API failed, using mock data")
277
291
  const mockData = getMockGitHubData(username, repository, repositories)
@@ -290,20 +304,21 @@ export function useGitHubData({
290
304
  }, [
291
305
  username,
292
306
  repository,
293
- repositories?.join(','), // Array'i string'e çevir ki referans değişmesin
307
+ repositories?.join(','), // Convert array to string to keep reference stable
294
308
  token,
295
309
  sortBy,
296
310
  maxItems,
297
- checkMilestones, // Artık stable
311
+ checkMilestones, // Now stable
298
312
  onDataUpdate,
299
313
  onError,
300
314
  isDocsMode,
301
315
  mockDataFallback,
316
+ forceMockData,
302
317
  ])
303
318
 
304
319
  // Initial fetch
305
320
  useEffect(() => {
306
- // Sadece geçerli input varsa fetch yap
321
+ // Only fetch if there's valid input
307
322
  const hasValidInput =
308
323
  (username && repository) ||
309
324
  (username && repositories && repositories.length > 0) ||
@@ -319,7 +334,7 @@ export function useGitHubData({
319
334
 
320
335
  // Auto-refresh
321
336
  useEffect(() => {
322
- // Docs modunda auto-refresh'i tamamen devre dışı bırak
337
+ // Completely disable auto-refresh in docs mode
323
338
  if (!effectiveAutoRefresh) return
324
339
 
325
340
  const scheduleRefresh = () => {
@@ -339,7 +354,7 @@ export function useGitHubData({
339
354
  }, [effectiveAutoRefresh, refreshInterval, fetchData])
340
355
 
341
356
  const refresh = useCallback(() => {
342
- // Docs modunda refresh'i sınırla
357
+ // Limit refresh in docs mode
343
358
  if (isDocsMode && hasInitialFetchedRef.current) {
344
359
  console.warn("[Docs Mode] Refresh disabled after initial fetch")
345
360
  return Promise.resolve()
@@ -24,6 +24,7 @@ const GitHubStarsInternal: React.FC<GitHubStarsProps> = ({
24
24
  repository,
25
25
  repositories,
26
26
  token,
27
+ useMockData = false,
27
28
  variant = "card",
28
29
  layout = "grid",
29
30
  showDescription = true,
@@ -61,14 +62,22 @@ const GitHubStarsInternal: React.FC<GitHubStarsProps> = ({
61
62
  customColors,
62
63
  }) => {
63
64
  // Docs mode tespiti
65
+ // Check if component has valid props to render
66
+ const hasValidProps = useMockData || username || (repositories && repositories.length > 0)
67
+
68
+ // If useMockData is false and no valid data props, don't render
69
+ if (!useMockData && !hasValidProps) {
70
+ return null
71
+ }
72
+
64
73
  const isDocsMode = typeof window !== "undefined" &&
65
74
  (window.location.pathname.includes("/docs/") ||
66
75
  window.location.pathname.includes("/components/"))
67
76
 
68
- // Docs modunda bazı özellikleri override et
77
+ // Override some features in docs mode
69
78
  const effectiveAutoRefresh = isDocsMode ? false : autoRefresh
70
79
  const effectiveNotifications = isDocsMode ? false : enableNotifications
71
- const effectiveRefreshInterval = isDocsMode ? 3600000 : refreshInterval // Docs modunda 1 saat
80
+ const effectiveRefreshInterval = isDocsMode ? 3600000 : refreshInterval // 1 hour in docs mode
72
81
  const { notify } = useGitHubNotifications(effectiveNotifications)
73
82
 
74
83
  // onMilestoneReached callback'ini memoize et
@@ -114,7 +123,8 @@ const GitHubStarsInternal: React.FC<GitHubStarsProps> = ({
114
123
  onMilestoneReached: handleMilestoneReached,
115
124
  milestones,
116
125
  docsMode: isDocsMode, // Docs mode flag'ini gönder
117
- mockDataFallback: true, // Docs modunda mock data kullan
126
+ mockDataFallback: true, // Use mock data in docs mode
127
+ forceMockData: useMockData, // Force mock data if true
118
128
  })
119
129
 
120
130
  const handleExport = React.useCallback((format: "json" | "csv") => {
@@ -307,7 +317,7 @@ const GitHubStarsInternal: React.FC<GitHubStarsProps> = ({
307
317
  >
308
318
  {renderVariant()}
309
319
 
310
- {/* Rate limit warning - Docs modunda gösterme */}
320
+ {/* Rate limit warning - Don't show in docs mode */}
311
321
  {!isDocsMode && rateLimitInfo && rateLimitInfo.remaining < 10 && (
312
322
  <div className="mt-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 rounded-md text-sm">
313
323
  <p className="text-yellow-800 dark:text-yellow-200">
@@ -317,10 +327,10 @@ const GitHubStarsInternal: React.FC<GitHubStarsProps> = ({
317
327
  </div>
318
328
  )}
319
329
 
320
- {/* Docs mode indicator - sadece development modunda göster */}
330
+ {/* Docs mode indicator - only show in development mode */}
321
331
  {isDocsMode && process.env.NODE_ENV === "development" && (
322
332
  <div className="mt-2 text-xs text-muted-foreground text-center">
323
- 📚 Docs Mode: API istekleri optimize edildi
333
+ 📚 Docs Mode: API requests optimized
324
334
  </div>
325
335
  )}
326
336
  </motion.div>
@@ -83,6 +83,7 @@ export interface GitHubStarsProps {
83
83
  repository?: string // For single repo mode
84
84
  repositories?: string[] // For multiple repos
85
85
  token?: string // GitHub token for higher rate limits
86
+ useMockData?: boolean // Force mock data instead of API requests
86
87
 
87
88
  // Display options
88
89
  variant?: DisplayVariant