@moontra/moonui-pro 2.20.1 → 2.20.2

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 (76) hide show
  1. package/dist/index.d.ts +691 -261
  2. package/dist/index.mjs +7418 -4934
  3. package/package.json +4 -3
  4. package/scripts/postbuild.js +27 -0
  5. package/src/components/advanced-chart/index.tsx +5 -1
  6. package/src/components/advanced-forms/index.tsx +175 -16
  7. package/src/components/calendar/event-dialog.tsx +18 -13
  8. package/src/components/calendar/index.tsx +197 -50
  9. package/src/components/dashboard/dashboard-grid.tsx +21 -3
  10. package/src/components/dashboard/types.ts +3 -0
  11. package/src/components/dashboard/widgets/activity-feed.tsx +6 -1
  12. package/src/components/dashboard/widgets/comparison-widget.tsx +177 -0
  13. package/src/components/dashboard/widgets/index.ts +5 -0
  14. package/src/components/dashboard/widgets/metric-card.tsx +21 -1
  15. package/src/components/dashboard/widgets/progress-widget.tsx +113 -0
  16. package/src/components/error-boundary/index.tsx +160 -37
  17. package/src/components/form-wizard/form-wizard-context.tsx +54 -26
  18. package/src/components/form-wizard/form-wizard-progress.tsx +33 -2
  19. package/src/components/form-wizard/types.ts +2 -1
  20. package/src/components/github-stars/hooks.ts +1 -0
  21. package/src/components/github-stars/variants.tsx +3 -1
  22. package/src/components/health-check/index.tsx +14 -14
  23. package/src/components/hover-card-3d/index.tsx +2 -3
  24. package/src/components/index.ts +5 -3
  25. package/src/components/kanban/kanban.tsx +23 -18
  26. package/src/components/license-error/index.tsx +2 -0
  27. package/src/components/magnetic-button/index.tsx +56 -7
  28. package/src/components/memory-efficient-data/index.tsx +117 -115
  29. package/src/components/navbar/index.tsx +781 -0
  30. package/src/components/performance-debugger/index.tsx +62 -38
  31. package/src/components/performance-monitor/index.tsx +47 -33
  32. package/src/components/phone-number-input/index.tsx +32 -27
  33. package/src/components/phone-number-input/phone-number-input-simple.tsx +167 -0
  34. package/src/components/rich-text-editor/index.tsx +26 -28
  35. package/src/components/rich-text-editor/slash-commands-extension.ts +15 -5
  36. package/src/components/sidebar/index.tsx +32 -13
  37. package/src/components/timeline/index.tsx +84 -49
  38. package/src/components/ui/accordion.tsx +550 -42
  39. package/src/components/ui/avatar.tsx +2 -0
  40. package/src/components/ui/badge.tsx +2 -0
  41. package/src/components/ui/breadcrumb.tsx +2 -0
  42. package/src/components/ui/button.tsx +39 -33
  43. package/src/components/ui/card.tsx +2 -0
  44. package/src/components/ui/collapsible.tsx +546 -50
  45. package/src/components/ui/command.tsx +790 -67
  46. package/src/components/ui/dialog.tsx +510 -92
  47. package/src/components/ui/dropdown-menu.tsx +540 -52
  48. package/src/components/ui/index.ts +37 -5
  49. package/src/components/ui/input.tsx +2 -0
  50. package/src/components/ui/magnetic-button.tsx +1 -1
  51. package/src/components/ui/media-gallery.tsx +1 -2
  52. package/src/components/ui/navigation-menu.tsx +130 -0
  53. package/src/components/ui/pagination.tsx +2 -0
  54. package/src/components/ui/select.tsx +6 -2
  55. package/src/components/ui/spotlight-card.tsx +1 -1
  56. package/src/components/ui/table.tsx +2 -0
  57. package/src/components/ui/tabs-pro.tsx +542 -0
  58. package/src/components/ui/tabs.tsx +23 -167
  59. package/src/components/ui/toggle.tsx +12 -12
  60. package/src/index.ts +11 -3
  61. package/src/styles/index.css +596 -0
  62. package/src/use-performance-optimizer.ts +1 -1
  63. package/src/utils/chart-helpers.ts +1 -1
  64. package/src/__tests__/use-intersection-observer.test.tsx +0 -216
  65. package/src/__tests__/use-local-storage.test.tsx +0 -174
  66. package/src/__tests__/use-pro-access.test.tsx +0 -183
  67. package/src/components/advanced-chart/advanced-chart.test.tsx +0 -281
  68. package/src/components/data-table/data-table.test.tsx +0 -187
  69. package/src/components/enhanced/badge.tsx +0 -191
  70. package/src/components/enhanced/button.tsx +0 -362
  71. package/src/components/enhanced/card.tsx +0 -266
  72. package/src/components/enhanced/dialog.tsx +0 -246
  73. package/src/components/enhanced/index.ts +0 -4
  74. package/src/components/file-upload/file-upload.test.tsx +0 -243
  75. package/src/components/rich-text-editor/index-old-backup.tsx +0 -437
  76. package/src/types/moonui.d.ts +0 -22
@@ -5,7 +5,7 @@ import { motion, AnimatePresence } from 'framer-motion'
5
5
  import { cn } from '../../lib/utils'
6
6
  import { Search, Filter, Download, SortAsc, SortDesc, BarChart3, Cpu, Clock, Zap } from 'lucide-react'
7
7
 
8
- // Memory konfigürasyonu için tip tanımları
8
+ // Type definitions for memory configuration
9
9
  interface MemoryConfig {
10
10
  chunkSize?: number
11
11
  maxMemoryItems?: number
@@ -16,7 +16,7 @@ interface MemoryConfig {
16
16
  streamingMode?: boolean
17
17
  enableAnalytics?: boolean
18
18
  analyticsCallback?: (stats: MemoryStats) => void
19
- // Yeni özellikler
19
+ // New features
20
20
  variableHeight?: boolean
21
21
  preloadStrategy?: 'none' | 'aggressive' | 'smart'
22
22
  performanceTracking?: boolean
@@ -27,7 +27,7 @@ interface MemoryConfig {
27
27
  animations?: boolean
28
28
  }
29
29
 
30
- // Performance metrikleri için tip tanımı
30
+ // Type definition for performance metrics
31
31
  interface MemoryPerformanceMetrics {
32
32
  fps: number
33
33
  renderTime: number
@@ -36,7 +36,7 @@ interface MemoryPerformanceMetrics {
36
36
  lastUpdate: number
37
37
  }
38
38
 
39
- // Search/Sort/Filter için tip tanımları
39
+ // Type definitions for Search/Sort/Filter
40
40
  interface TableFeatures<T> {
41
41
  searchTerm?: string
42
42
  sortConfig?: {
@@ -50,14 +50,14 @@ interface TableFeatures<T> {
50
50
  }>
51
51
  }
52
52
 
53
- // Height measurement için tip tanımı
53
+ // Type definition for height measurement
54
54
  interface ItemHeightInfo {
55
55
  index: number
56
56
  height: number
57
57
  offset: number
58
58
  }
59
59
 
60
- // Memory istatistikleri için tip tanımı
60
+ // Type definition for memory statistics
61
61
  interface MemoryStats {
62
62
  memoryUsage: number
63
63
  itemCount: number
@@ -67,7 +67,7 @@ interface MemoryStats {
67
67
  performance?: MemoryPerformanceMetrics
68
68
  }
69
69
 
70
- // Ana component props
70
+ // Main component props
71
71
  export interface MemoryEfficientDataProps<T = any> {
72
72
  data: T[]
73
73
  config?: MemoryConfig
@@ -75,7 +75,7 @@ export interface MemoryEfficientDataProps<T = any> {
75
75
  height?: number
76
76
  onMemoryUpdate?: (stats: MemoryStats) => void
77
77
  className?: string
78
- // Yeni özellikler
78
+ // New features
79
79
  itemHeight?: number | ((item: T, index: number) => number)
80
80
  onSearch?: (searchTerm: string) => T[]
81
81
  onSort?: (data: T[], key: keyof T, direction: 'asc' | 'desc') => T[]
@@ -127,7 +127,7 @@ class MemoryCache<T> {
127
127
 
128
128
  switch (this.strategy) {
129
129
  case 'lru':
130
- // En eski erişileni sil
130
+ // Delete least recently used
131
131
  let oldestTime = Infinity
132
132
  for (const [key, node] of this.cache) {
133
133
  if (node.timestamp < oldestTime) {
@@ -138,7 +138,7 @@ class MemoryCache<T> {
138
138
  break
139
139
 
140
140
  case 'lfu':
141
- // En az kullanılanı sil
141
+ // Delete least frequently used
142
142
  let minAccess = Infinity
143
143
  for (const [key, node] of this.cache) {
144
144
  if (node.accessCount < minAccess) {
@@ -149,7 +149,7 @@ class MemoryCache<T> {
149
149
  break
150
150
 
151
151
  case 'fifo':
152
- // İlk gireni sil
152
+ // Delete first in
153
153
  keyToDelete = this.cache.keys().next().value || null
154
154
  break
155
155
  }
@@ -184,7 +184,7 @@ class MemoryCache<T> {
184
184
  return total === 0 ? 0 : this.hitCount / total
185
185
  }
186
186
 
187
- // Hit/miss tracking için güncelle
187
+ // Update for hit/miss tracking
188
188
  get(key: string): T[] | null {
189
189
  const node = this.cache.get(key)
190
190
  if (!node) {
@@ -214,7 +214,7 @@ class PerformanceTracker {
214
214
  const renderTime = performance.now() - this.startTime
215
215
  this.renderTimes.push(renderTime)
216
216
 
217
- // Son 60 render time'ı tut
217
+ // Keep last 60 render times
218
218
  if (this.renderTimes.length > 60) {
219
219
  this.renderTimes.shift()
220
220
  }
@@ -226,7 +226,7 @@ class PerformanceTracker {
226
226
  const fps = 1000 / (now - this.lastFrameTime)
227
227
  this.frames.push(fps)
228
228
 
229
- // Son 60 frame'i tut
229
+ // Keep last 60 frames
230
230
  if (this.frames.length > 60) {
231
231
  this.frames.shift()
232
232
  }
@@ -253,12 +253,12 @@ class PerformanceTracker {
253
253
  }
254
254
 
255
255
  private detectMemoryLeaks(): number {
256
- // Basit memory leak detection
256
+ // Simple memory leak detection
257
257
  return this.renderTimes.filter(time => time > 16).length // 16ms = 60fps threshold
258
258
  }
259
259
 
260
260
  private calculateScrollPerformance(): number {
261
- // Scroll performance hesaplama (0-100 score)
261
+ // Calculate scroll performance (0-100 score)
262
262
  const avgFPS = this.frames.length > 0
263
263
  ? this.frames.reduce((a, b) => a + b, 0) / this.frames.length
264
264
  : 60
@@ -318,7 +318,7 @@ class VariableHeightManager {
318
318
  let start = 0
319
319
  let currentOffset = 0
320
320
 
321
- // Scroll position'a kadar olan itemları say
321
+ // Count items up to scroll position
322
322
  while (start < itemCount && currentOffset < scrollTop) {
323
323
  currentOffset += this.getItemHeight(start)
324
324
  start++
@@ -326,7 +326,7 @@ class VariableHeightManager {
326
326
 
327
327
  start = Math.max(0, start - 1)
328
328
 
329
- // Görünür alan boyunca devam et
329
+ // Continue through visible area
330
330
  let end = start
331
331
  const targetOffset = scrollTop + containerHeight
332
332
  currentOffset = this.getOffsetForIndex(start)
@@ -340,22 +340,22 @@ class VariableHeightManager {
340
340
  }
341
341
  }
342
342
 
343
- // Ana Memory Efficient Data Component
344
- export function MemoryEfficientData<T = any>({
343
+ // Main Memory Efficient Data Component
344
+ function MemoryEfficientData<T = any>({
345
345
  data,
346
346
  config = {},
347
347
  renderItem,
348
348
  height = 400,
349
349
  onMemoryUpdate,
350
350
  className,
351
- // Yeni props
351
+ // New props
352
352
  itemHeight = 60,
353
353
  onSearch,
354
354
  onSort,
355
355
  onFilter,
356
356
  onExport,
357
- searchPlaceholder = "Ara...",
358
- emptyStateMessage = "Veri bulunamadı",
357
+ searchPlaceholder = "Search...",
358
+ emptyStateMessage = "No data found",
359
359
  loadingComponent,
360
360
  errorComponent
361
361
  }: MemoryEfficientDataProps<T>) {
@@ -369,7 +369,7 @@ export function MemoryEfficientData<T = any>({
369
369
  streamingMode = false,
370
370
  enableAnalytics = false,
371
371
  analyticsCallback,
372
- // Yeni konfigürasyonlar
372
+ // New configurations
373
373
  variableHeight = false,
374
374
  preloadStrategy = 'smart',
375
375
  performanceTracking = false,
@@ -380,7 +380,7 @@ export function MemoryEfficientData<T = any>({
380
380
  animations = true
381
381
  } = config
382
382
 
383
- // State yönetimi
383
+ // State management
384
384
  const [visibleRange, setVisibleRange] = useState({ start: 0, end: Math.min(chunkSize, data.length) })
385
385
  const [memoryStats, setMemoryStats] = useState<MemoryStats>({
386
386
  memoryUsage: 0,
@@ -392,8 +392,6 @@ export function MemoryEfficientData<T = any>({
392
392
  sortConfig: undefined,
393
393
  filters: []
394
394
  })
395
- const [isLoading, setIsLoading] = useState(false)
396
- const [error, setError] = useState<string | null>(null)
397
395
 
398
396
  // Refs
399
397
  const containerRef = useRef<HTMLDivElement>(null)
@@ -403,13 +401,11 @@ export function MemoryEfficientData<T = any>({
403
401
  const heightManagerRef = useRef(new VariableHeightManager(typeof itemHeight === 'number' ? itemHeight : 60))
404
402
  const itemRefs = useRef<Map<number, HTMLDivElement>>(new Map())
405
403
 
406
- // İşlenmiş data'yı hesapla (search, sort, filter)
404
+ // Calculate processed data (search, sort, filter)
407
405
  const processedData = useMemo(() => {
408
406
  let result = [...data]
409
407
 
410
408
  try {
411
- setIsLoading(true)
412
-
413
409
  // Search functionality
414
410
  if (enableSearch && tableFeatures.searchTerm && onSearch) {
415
411
  result = onSearch(tableFeatures.searchTerm)
@@ -425,17 +421,14 @@ export function MemoryEfficientData<T = any>({
425
421
  result = onSort(result, tableFeatures.sortConfig.key, tableFeatures.sortConfig.direction)
426
422
  }
427
423
 
428
- setError(null)
429
424
  return result
430
425
  } catch (err) {
431
- setError(err instanceof Error ? err.message : 'Veri işlenirken hata oluştu')
426
+ console.error('Error processing data:', err)
432
427
  return data
433
- } finally {
434
- setIsLoading(false)
435
428
  }
436
429
  }, [data, tableFeatures, enableSearch, enableFilter, enableSort, onSearch, onFilter, onSort])
437
430
 
438
- // Visible data'yı memoize et
431
+ // Memoize visible data
439
432
  const visibleData = useMemo(() => {
440
433
  if (performanceTracking) {
441
434
  performanceTrackerRef.current.startRender()
@@ -444,7 +437,7 @@ export function MemoryEfficientData<T = any>({
444
437
  const start = visibleRange.start
445
438
  const end = Math.min(visibleRange.end, processedData.length)
446
439
 
447
- // Cache'den kontrol et
440
+ // Check from cache
448
441
  const cacheKey = `${start}-${end}-${JSON.stringify(tableFeatures)}`
449
442
  const cachedData = cacheRef.current.get(cacheKey)
450
443
 
@@ -455,10 +448,10 @@ export function MemoryEfficientData<T = any>({
455
448
  return cachedData
456
449
  }
457
450
 
458
- // Yeni data slice'ını oluştur
451
+ // Create new data slice
459
452
  const newData = processedData.slice(start, end)
460
453
 
461
- // Cache'e kaydet
454
+ // Save to cache
462
455
  cacheRef.current.set(cacheKey, newData, compression)
463
456
 
464
457
  if (performanceTracking) {
@@ -498,17 +491,17 @@ export function MemoryEfficientData<T = any>({
498
491
  let newStart: number, newEnd: number
499
492
 
500
493
  if (variableHeight) {
501
- // Variable height kullan
494
+ // Use variable height
502
495
  const range = heightManagerRef.current.getVisibleRange(scrollTop, containerHeight, processedData.length)
503
496
  newStart = range.start
504
497
  newEnd = range.end
505
498
  } else {
506
- // Fixed height kullan
499
+ // Use fixed height
507
500
  const itemHeightValue = typeof itemHeight === 'number' ? itemHeight : 60
508
501
  const startIndex = Math.floor(scrollTop / itemHeightValue)
509
502
  const visibleCount = Math.ceil(containerHeight / itemHeightValue)
510
503
 
511
- // Buffer ekle
504
+ // Add buffer
512
505
  const bufferSize = Math.floor(visibleCount * 0.5)
513
506
  newStart = Math.max(0, startIndex - bufferSize)
514
507
  newEnd = Math.min(processedData.length, startIndex + visibleCount + bufferSize)
@@ -520,7 +513,7 @@ export function MemoryEfficientData<T = any>({
520
513
  newStart = Math.max(0, newStart - extraBuffer)
521
514
  newEnd = Math.min(processedData.length, newEnd + extraBuffer)
522
515
  } else if (preloadStrategy === 'smart') {
523
- // Scroll direction'a göre preload
516
+ // Preload based on scroll direction
524
517
  const currentScroll = scrollTop
525
518
  const lastScroll = scrollTimeoutRef.current ? parseInt(scrollTimeoutRef.current as any) : 0
526
519
  const isScrollingDown = currentScroll > lastScroll
@@ -547,22 +540,6 @@ export function MemoryEfficientData<T = any>({
547
540
  setTableFeatures(prev => ({ ...prev, searchTerm }))
548
541
  }, [])
549
542
 
550
- // Sort handler
551
- const handleSort = useCallback((key: keyof T) => {
552
- setTableFeatures(prev => {
553
- const currentDirection = prev.sortConfig?.key === key && prev.sortConfig?.direction === 'asc' ? 'desc' : 'asc'
554
- return {
555
- ...prev,
556
- sortConfig: { key, direction: currentDirection }
557
- }
558
- })
559
- }, [])
560
-
561
- // Filter handler
562
- const handleFilter = useCallback((filters: TableFeatures<T>['filters']) => {
563
- setTableFeatures(prev => ({ ...prev, filters }))
564
- }, [])
565
-
566
543
  // Export handler
567
544
  const handleExport = useCallback((format: 'csv' | 'json' | 'xlsx') => {
568
545
  if (onExport) {
@@ -570,30 +547,39 @@ export function MemoryEfficientData<T = any>({
570
547
  }
571
548
  }, [processedData, onExport])
572
549
 
573
- // Memory statistics'i güncelle
550
+ // Update memory statistics - debounced to prevent excessive updates
574
551
  useEffect(() => {
575
- const cacheStats = cacheRef.current.getStats()
576
- const performanceMetrics = performanceTracking ? performanceTrackerRef.current.getMetrics() : undefined
552
+ if (!enableAnalytics && !onMemoryUpdate) return
577
553
 
578
- const newStats: MemoryStats = {
579
- memoryUsage: cacheStats.memoryUsage,
580
- itemCount: visibleData.length,
581
- cacheHitRate: cacheStats.hitRate,
582
- compressionRatio: compression ? 0.7 : 1.0,
583
- lastCleanup: Date.now(),
584
- performance: performanceMetrics
585
- }
554
+ const updateStats = () => {
555
+ const cacheStats = cacheRef.current.getStats()
556
+ const performanceMetrics = performanceTracking ? performanceTrackerRef.current.getMetrics() : undefined
557
+
558
+ const newStats: MemoryStats = {
559
+ memoryUsage: cacheStats.memoryUsage,
560
+ itemCount: visibleData.length,
561
+ cacheHitRate: cacheStats.hitRate,
562
+ compressionRatio: compression ? 0.7 : 1.0,
563
+ lastCleanup: Date.now(),
564
+ performance: performanceMetrics
565
+ }
586
566
 
587
- setMemoryStats(newStats)
588
-
589
- if (enableAnalytics && analyticsCallback) {
590
- analyticsCallback(newStats)
591
- }
567
+ setMemoryStats(newStats)
568
+
569
+ if (enableAnalytics && analyticsCallback) {
570
+ analyticsCallback(newStats)
571
+ }
592
572
 
593
- if (onMemoryUpdate) {
594
- onMemoryUpdate(newStats)
573
+ if (onMemoryUpdate) {
574
+ onMemoryUpdate(newStats)
575
+ }
595
576
  }
596
- }, [visibleData, enableAnalytics, analyticsCallback, onMemoryUpdate, compression, performanceTracking])
577
+
578
+ // Debounce updates to prevent loops
579
+ const timeoutId = setTimeout(updateStats, 500)
580
+
581
+ return () => clearTimeout(timeoutId)
582
+ }, [visibleData.length, enableAnalytics, performanceTracking, compression]) // Remove callbacks from deps
597
583
 
598
584
  // Auto cleanup effect
599
585
  useEffect(() => {
@@ -602,29 +588,25 @@ export function MemoryEfficientData<T = any>({
602
588
  const cleanupInterval = setInterval(() => {
603
589
  const memoryUsage = (visibleData.length / maxMemoryItems)
604
590
  if (memoryUsage > cleanupThreshold) {
605
- // Basit cleanup - cache'i temizle
591
+ // Simple cleanup - clear cache
606
592
  cacheRef.current.clear()
607
593
  }
608
- }, 5000) // Her 5 saniyede kontrol et
594
+ }, 5000) // Check every 5 seconds
609
595
 
610
596
  return () => clearInterval(cleanupInterval)
611
597
  }, [autoCleanup, cleanupThreshold, maxMemoryItems, visibleData.length])
612
598
 
613
- // Loading ve Error states için render
614
- if (error && errorComponent) {
615
- return errorComponent
599
+ // Render for loading and error states
600
+ if (loadingComponent && data.length === 0) {
601
+ return <>{loadingComponent}</>
616
602
  }
617
603
 
618
- if (isLoading && loadingComponent) {
619
- return loadingComponent
620
- }
621
-
622
- // Total height hesapla
604
+ // Calculate total height
623
605
  const totalHeight = variableHeight
624
606
  ? heightManagerRef.current.getTotalHeight(processedData.length)
625
607
  : processedData.length * (typeof itemHeight === 'number' ? itemHeight : 60)
626
608
 
627
- // Offset hesapla
609
+ // Calculate offset
628
610
  const offsetY = variableHeight
629
611
  ? heightManagerRef.current.getOffsetForIndex(visibleRange.start)
630
612
  : visibleRange.start * (typeof itemHeight === 'number' ? itemHeight : 60)
@@ -655,9 +637,9 @@ export function MemoryEfficientData<T = any>({
655
637
  <div className="flex items-center gap-1">
656
638
  {enableFilter && (
657
639
  <button
658
- onClick={() => {/* Filter modal açılacak */}}
640
+ onClick={() => {/* Filter modal will open */}}
659
641
  className="p-2 hover:bg-muted rounded-md transition-colors"
660
- title="Filtrele"
642
+ title="Filter"
661
643
  >
662
644
  <Filter className="h-4 w-4" />
663
645
  </button>
@@ -668,7 +650,7 @@ export function MemoryEfficientData<T = any>({
668
650
  <button
669
651
  onClick={() => handleExport('csv')}
670
652
  className="p-2 hover:bg-muted rounded-md transition-colors"
671
- title="Dışa Aktar"
653
+ title="Export"
672
654
  >
673
655
  <Download className="h-4 w-4" />
674
656
  </button>
@@ -770,11 +752,10 @@ interface RealTimePerformanceMonitorProps {
770
752
  updateInterval?: number
771
753
  }
772
754
 
773
- export function RealTimePerformanceMonitor({
755
+ function RealTimePerformanceMonitor({
774
756
  memoryStats,
775
757
  className,
776
- showChart = false,
777
- updateInterval = 1000
758
+ showChart = false
778
759
  }: RealTimePerformanceMonitorProps) {
779
760
  const [history, setHistory] = useState<MemoryStats[]>([])
780
761
  const [isActive, setIsActive] = useState(true)
@@ -784,7 +765,7 @@ export function RealTimePerformanceMonitor({
784
765
 
785
766
  setHistory(prev => {
786
767
  const newHistory = [...prev, memoryStats]
787
- // Son 60 entry'yi tut (1 dakika)
768
+ // Keep last 60 entries (1 minute)
788
769
  return newHistory.length > 60 ? newHistory.slice(-60) : newHistory
789
770
  })
790
771
  }, [memoryStats, isActive])
@@ -807,7 +788,7 @@ export function RealTimePerformanceMonitor({
807
788
  return (
808
789
  <div className={cn("p-4 border rounded-lg bg-muted/5", className)}>
809
790
  <div className="text-center text-muted-foreground">
810
- Performance monitoring devre dışı
791
+ Performance monitoring disabled
811
792
  </div>
812
793
  </div>
813
794
  )
@@ -823,7 +804,7 @@ export function RealTimePerformanceMonitor({
823
804
  <div className="flex items-center justify-between">
824
805
  <h3 className="font-semibold flex items-center gap-2">
825
806
  <BarChart3 className="h-4 w-4" />
826
- Gerçek Zamanlı Performans
807
+ Real-time Performance
827
808
  </h3>
828
809
  <button
829
810
  onClick={() => setIsActive(!isActive)}
@@ -834,7 +815,7 @@ export function RealTimePerformanceMonitor({
834
815
  : "bg-muted text-muted-foreground hover:bg-muted/80"
835
816
  )}
836
817
  >
837
- {isActive ? 'Aktif' : 'Durduruldu'}
818
+ {isActive ? 'Active' : 'Paused'}
838
819
  </button>
839
820
  </div>
840
821
 
@@ -852,7 +833,7 @@ export function RealTimePerformanceMonitor({
852
833
 
853
834
  {/* Render Time */}
854
835
  <div className="space-y-1">
855
- <div className="text-xs text-muted-foreground">Render Süresi</div>
836
+ <div className="text-xs text-muted-foreground">Render Time</div>
856
837
  <div className={cn(
857
838
  "text-lg font-mono font-bold",
858
839
  memoryStats.performance ? getPerformanceColor(100 - memoryStats.performance.renderTime, { good: 84, warning: 70 }) : ''
@@ -863,7 +844,7 @@ export function RealTimePerformanceMonitor({
863
844
 
864
845
  {/* Memory Usage */}
865
846
  <div className="space-y-1">
866
- <div className="text-xs text-muted-foreground">Bellek Kullanımı</div>
847
+ <div className="text-xs text-muted-foreground">Memory Usage</div>
867
848
  <div className="text-lg font-mono font-bold">
868
849
  {formatBytes(memoryStats.memoryUsage)}
869
850
  </div>
@@ -908,7 +889,7 @@ export function RealTimePerformanceMonitor({
908
889
  {/* Mini Chart */}
909
890
  {showChart && history.length > 1 && (
910
891
  <div className="pt-2 border-t">
911
- <div className="text-xs text-muted-foreground mb-2">FPS Geçmişi (Son 60 güncelleme)</div>
892
+ <div className="text-xs text-muted-foreground mb-2">FPS History (Last 60 updates)</div>
912
893
  <div className="h-16 flex items-end gap-1">
913
894
  {history.slice(-30).map((stat, index) => {
914
895
  const fps = stat.performance?.fps || 0
@@ -940,7 +921,7 @@ interface MemoryAnalyticsProps {
940
921
  className?: string
941
922
  }
942
923
 
943
- export function MemoryAnalytics({
924
+ function MemoryAnalytics({
944
925
  onStatsUpdate,
945
926
  showRealTime = false,
946
927
  className
@@ -951,21 +932,35 @@ export function MemoryAnalytics({
951
932
  cacheHitRate: 0.95
952
933
  })
953
934
 
954
- // Mock real-time updates for backward compatibility
935
+ // Simulate real-time updates with realistic data
955
936
  useEffect(() => {
956
937
  if (!showRealTime) return
957
938
 
939
+ // Initialize with some realistic base values
940
+ let baseMemory = 10 * 1024 * 1024 // 10MB base
941
+ let currentFPS = 60
942
+ let currentRenderTime = 5
943
+
958
944
  const interval = setInterval(() => {
945
+ // Simulate realistic memory usage growth
946
+ baseMemory += Math.random() * 1024 * 1024 - 500 * 1024 // Fluctuate around base
947
+
948
+ // Simulate FPS variations
949
+ currentFPS = Math.min(60, Math.max(30, currentFPS + (Math.random() - 0.5) * 10))
950
+
951
+ // Simulate render time variations
952
+ currentRenderTime = Math.max(1, Math.min(16, currentRenderTime + (Math.random() - 0.5) * 2))
953
+
959
954
  const newStats: MemoryStats = {
960
- memoryUsage: Math.random() * 50 * 1024 * 1024,
961
- itemCount: Math.floor(Math.random() * 50000),
962
- cacheHitRate: 0.9 + Math.random() * 0.1,
955
+ memoryUsage: Math.max(0, baseMemory),
956
+ itemCount: 50000, // Fixed item count for demo
957
+ cacheHitRate: 0.85 + Math.random() * 0.15, // 85-100% hit rate
963
958
  lastCleanup: Date.now(),
964
959
  performance: {
965
- fps: Math.floor(30 + Math.random() * 30),
966
- renderTime: Math.random() * 16,
967
- memoryLeaks: Math.floor(Math.random() * 3),
968
- scrollPerformance: 70 + Math.random() * 30,
960
+ fps: Math.round(currentFPS),
961
+ renderTime: parseFloat(currentRenderTime.toFixed(2)),
962
+ memoryLeaks: currentRenderTime > 10 ? Math.floor(currentRenderTime / 5) : 0,
963
+ scrollPerformance: Math.round((currentFPS / 60) * 100),
969
964
  lastUpdate: Date.now()
970
965
  } as MemoryPerformanceMetrics
971
966
  }
@@ -983,12 +978,12 @@ export function MemoryAnalytics({
983
978
  }
984
979
 
985
980
  // Utility hook for streaming data
986
- export function useStreamingData<T>(
981
+ function useStreamingData<T>(
987
982
  initialData: T[] = [],
988
- streamingConfig?: { interval?: number; maxItems?: number }
983
+ streamingConfig?: { maxItems?: number }
989
984
  ) {
990
985
  const [data, setData] = useState<T[]>(initialData)
991
- const { interval = 1000, maxItems = 10000 } = streamingConfig || {}
986
+ const { maxItems = 10000 } = streamingConfig || {}
992
987
 
993
988
  const addItem = useCallback((newItem: T) => {
994
989
  setData(prev => {
@@ -1004,7 +999,14 @@ export function useStreamingData<T>(
1004
999
  return { data, addItem, clearData }
1005
1000
  }
1006
1001
 
1007
- // Export types
1002
+ // Export components and types
1003
+ export {
1004
+ MemoryEfficientData,
1005
+ MemoryAnalytics,
1006
+ RealTimePerformanceMonitor,
1007
+ useStreamingData
1008
+ };
1009
+
1008
1010
  export type {
1009
1011
  MemoryConfig,
1010
1012
  MemoryStats,
@@ -1013,4 +1015,4 @@ export type {
1013
1015
  TableFeatures,
1014
1016
  ItemHeightInfo,
1015
1017
  RealTimePerformanceMonitorProps
1016
- }
1018
+ };