@souscheflabs/reanimated-flashlist 0.5.0 → 0.5.1

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 (57) hide show
  1. package/lib/AnimatedFlashList.d.ts.map +1 -1
  2. package/lib/AnimatedFlashList.js +1 -0
  3. package/lib/hooks/drag/useDragGesture.d.ts.map +1 -1
  4. package/lib/hooks/drag/useDragGesture.js +5 -6
  5. package/lib/hooks/drag/useDragOverlay.d.ts.map +1 -1
  6. package/lib/hooks/drag/useDragOverlay.js +9 -1
  7. package/lib/hooks/drag/useDropCompensation.d.ts.map +1 -1
  8. package/lib/hooks/drag/useDropCompensation.js +2 -3
  9. package/lib/index.d.ts +22 -0
  10. package/lib/index.d.ts.map +1 -1
  11. package/lib/index.js +25 -1
  12. package/lib/performance/hooks/index.d.ts +11 -0
  13. package/lib/performance/hooks/index.d.ts.map +1 -0
  14. package/lib/performance/hooks/index.js +17 -0
  15. package/lib/performance/hooks/useBenchmarkComparison.d.ts +45 -0
  16. package/lib/performance/hooks/useBenchmarkComparison.d.ts.map +1 -0
  17. package/lib/performance/hooks/useBenchmarkComparison.js +155 -0
  18. package/lib/performance/hooks/useFPSMonitor.d.ts +27 -0
  19. package/lib/performance/hooks/useFPSMonitor.d.ts.map +1 -0
  20. package/lib/performance/hooks/useFPSMonitor.js +230 -0
  21. package/lib/performance/hooks/useMemoryMonitor.d.ts +25 -0
  22. package/lib/performance/hooks/useMemoryMonitor.d.ts.map +1 -0
  23. package/lib/performance/hooks/useMemoryMonitor.js +148 -0
  24. package/lib/performance/hooks/useRenderProfiler.d.ts +40 -0
  25. package/lib/performance/hooks/useRenderProfiler.d.ts.map +1 -0
  26. package/lib/performance/hooks/useRenderProfiler.js +120 -0
  27. package/lib/performance/index.d.ts +46 -0
  28. package/lib/performance/index.d.ts.map +1 -0
  29. package/lib/performance/index.js +71 -0
  30. package/lib/performance/types.d.ts +259 -0
  31. package/lib/performance/types.d.ts.map +1 -0
  32. package/lib/performance/types.js +80 -0
  33. package/lib/performance/utils/compareResults.d.ts +25 -0
  34. package/lib/performance/utils/compareResults.d.ts.map +1 -0
  35. package/lib/performance/utils/compareResults.js +149 -0
  36. package/lib/performance/utils/index.d.ts +6 -0
  37. package/lib/performance/utils/index.d.ts.map +1 -0
  38. package/lib/performance/utils/index.js +19 -0
  39. package/lib/performance/utils/loadBaseline.d.ts +62 -0
  40. package/lib/performance/utils/loadBaseline.d.ts.map +1 -0
  41. package/lib/performance/utils/loadBaseline.js +159 -0
  42. package/package.json +1 -1
  43. package/src/AnimatedFlashList.tsx +1 -0
  44. package/src/hooks/drag/useDragGesture.ts +5 -6
  45. package/src/hooks/drag/useDragOverlay.ts +12 -0
  46. package/src/hooks/drag/useDropCompensation.ts +2 -4
  47. package/src/index.ts +42 -0
  48. package/src/performance/hooks/index.ts +15 -0
  49. package/src/performance/hooks/useBenchmarkComparison.ts +220 -0
  50. package/src/performance/hooks/useFPSMonitor.ts +291 -0
  51. package/src/performance/hooks/useMemoryMonitor.ts +191 -0
  52. package/src/performance/hooks/useRenderProfiler.ts +122 -0
  53. package/src/performance/index.ts +95 -0
  54. package/src/performance/types.ts +329 -0
  55. package/src/performance/utils/compareResults.ts +266 -0
  56. package/src/performance/utils/index.ts +20 -0
  57. package/src/performance/utils/loadBaseline.ts +194 -0
@@ -1 +1 @@
1
- {"version":3,"file":"AnimatedFlashList.d.ts","sourceRoot":"","sources":["../src/AnimatedFlashList.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;AA2Bf,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EAErB,MAAM,SAAS,CAAC;AA65BjB,eAAO,MAAM,iBAAiB,EAAyC,CACrE,CAAC,SAAS,gBAAgB,EAE1B,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG;IACjC,GAAG,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;CAChD,KACE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"AnimatedFlashList.d.ts","sourceRoot":"","sources":["../src/AnimatedFlashList.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;AA2Bf,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EAErB,MAAM,SAAS,CAAC;AA85BjB,eAAO,MAAM,iBAAiB,EAAyC,CACrE,CAAC,SAAS,gBAAgB,EAE1B,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG;IACjC,GAAG,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;CAChD,KACE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC"}
@@ -525,6 +525,7 @@ function AnimatedFlashListInner(props, ref) {
525
525
  }
526
526
  const containerStyle = {
527
527
  flex: 1,
528
+ overflow: 'hidden',
528
529
  };
529
530
  // Forward ref with generic support
530
531
  exports.AnimatedFlashList = (0, react_1.forwardRef)(AnimatedFlashListInner);
@@ -1 +1 @@
1
- {"version":3,"file":"useDragGesture.d.ts","sourceRoot":"","sources":["../../../src/hooks/drag/useDragGesture.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EACV,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,oBAAoB,EAC5B,SAAS,EAAE,uBAAuB,GACjC,oBAAoB,CA+atB"}
1
+ {"version":3,"file":"useDragGesture.d.ts","sourceRoot":"","sources":["../../../src/hooks/drag/useDragGesture.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EACV,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,oBAAoB,EAC5B,SAAS,EAAE,uBAAuB,GACjC,oBAAoB,CA8atB"}
@@ -188,9 +188,9 @@ function useDragGesture(config, callbacks) {
188
188
  lastSignificantY.value = event.translationY;
189
189
  }
190
190
  // Track hovered index
191
- const itemHeight = measuredItemHeight.value > 0
192
- ? measuredItemHeight.value
193
- : dragConfig.itemHeight;
191
+ // Always use config.itemHeight - it includes margins which matches
192
+ // how FlashList positions items. See useDragShift.ts v40.9 comment.
193
+ const itemHeight = dragConfig.itemHeight;
194
194
  const scrollDelta = scrollOffset.value - dragStartScrollOffset.value;
195
195
  const effectiveTranslateY = event.translationY + scrollDelta;
196
196
  const hoverResult = (0, hoverCalculation_1.calculateHoverIndex)({
@@ -216,9 +216,8 @@ function useDragGesture(config, callbacks) {
216
216
  draggedScale.value = (0, react_native_reanimated_1.withSpring)(1, drag_1.SPRING_CONFIGS.DRAG_SCALE);
217
217
  const currentIdx = draggedIndex.value;
218
218
  const total = totalItems.value;
219
- const itemHeight = measuredItemHeight.value > 0
220
- ? measuredItemHeight.value
221
- : dragConfig.itemHeight;
219
+ // Always use config.itemHeight for drop calculation to match FlashList positioning
220
+ const itemHeight = dragConfig.itemHeight;
222
221
  const prevHoveredIndex = hoveredIndex.value;
223
222
  // Use shared drop calculation utility
224
223
  const hoveredIndexAtEnd = prevHoveredIndex >= 0
@@ -1 +1 @@
1
- {"version":3,"file":"useDragOverlay.d.ts","sourceRoot":"","sources":["../../../src/hooks/drag/useDragOverlay.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAGpD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,oCAAoC;IACpC,YAAY,EAAE,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,sBAAsB,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,MAAM,CAAC;CAC9D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,oBAAoB,GAC3B,oBAAoB,CAmFtB"}
1
+ {"version":3,"file":"useDragOverlay.d.ts","sourceRoot":"","sources":["../../../src/hooks/drag/useDragOverlay.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAGpD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,oCAAoC;IACpC,YAAY,EAAE,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,sBAAsB,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,MAAM,CAAC;CAC9D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,oBAAoB,GAC3B,oBAAoB,CA+FtB"}
@@ -23,7 +23,7 @@ const DragStateContext_1 = require("../../contexts/DragStateContext");
23
23
  */
24
24
  function useDragOverlay(config) {
25
25
  const { containerRef } = config;
26
- const { overlayBaseX, overlayBaseY, overlayWidth, overlayHeight, overlayActive, overlayReady, overlayTouchOffset, overlayAbsoluteY, overlayContainerX, overlayContainerY, overlayContainerReady, dragContainerRef, } = (0, DragStateContext_1.useDragState)();
26
+ const { overlayBaseX, overlayBaseY, overlayWidth, overlayHeight, overlayActive, overlayReady, overlayTouchOffset, overlayAbsoluteY, overlayContainerX, overlayContainerY, overlayContainerReady, dragContainerRef, config: dragConfig, } = (0, DragStateContext_1.useDragState)();
27
27
  const measureAndSetupOverlay = (0, react_1.useCallback)((input) => {
28
28
  'worklet';
29
29
  const { absoluteY } = input;
@@ -61,6 +61,13 @@ function useDragOverlay(config) {
61
61
  overlayHeight.value = measured.height;
62
62
  overlayActive.value = true;
63
63
  overlayReady.value = true;
64
+ // DEV: Warn if itemHeight config is smaller than measured content
65
+ // This always indicates misconfiguration since config should include margins
66
+ if (__DEV__ && measured.height > dragConfig.itemHeight) {
67
+ console.warn(`[AnimatedFlashList] itemHeight (${dragConfig.itemHeight}px) is smaller than ` +
68
+ `measured item content (${measured.height.toFixed(0)}px). ` +
69
+ `Configure itemHeight to include margins/gaps for accurate drag positioning.`);
70
+ }
64
71
  return measured.height;
65
72
  }
66
73
  else {
@@ -82,6 +89,7 @@ function useDragOverlay(config) {
82
89
  overlayContainerY,
83
90
  overlayContainerReady,
84
91
  dragContainerRef,
92
+ dragConfig,
85
93
  ]);
86
94
  return { measureAndSetupOverlay };
87
95
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useDropCompensation.d.ts","sourceRoot":"","sources":["../../../src/hooks/drag/useDropCompensation.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,IAAI,CAgF3E"}
1
+ {"version":3,"file":"useDropCompensation.d.ts","sourceRoot":"","sources":["../../../src/hooks/drag/useDropCompensation.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,IAAI,CA8E3E"}
@@ -57,9 +57,8 @@ function useDropCompensation(config) {
57
57
  return;
58
58
  }
59
59
  // Outside active drag/drop, compensate for index change
60
- const itemHeight = measuredItemHeight.value > 0
61
- ? measuredItemHeight.value
62
- : dragConfig.itemHeight;
60
+ // Always use config.itemHeight - matches FlashList positioning (includes margins)
61
+ const itemHeight = dragConfig.itemHeight;
63
62
  const indexDelta = index - prevIndex;
64
63
  const heightDelta = indexDelta * itemHeight;
65
64
  const compensatedY = translateY.value - heightDelta;
package/lib/index.d.ts CHANGED
@@ -53,4 +53,26 @@ export { useDragGesture, useDragShift, useDragAnimatedStyle, useDropCompensation
53
53
  export { DEFAULT_DRAG_CONFIG, createDragConfig, DEFAULT_EXIT_ANIMATION, FAST_EXIT_ANIMATION, DEFAULT_ENTRY_ANIMATION, getExitAnimationConfig, createEntryAnimationConfig, standardEasing, } from './constants';
54
54
  export type { AnimatedListItem, AnimatedFlashListProps, AnimatedFlashListRef, AnimatedFlashListConfig, AnimatedRenderItemInfo, DragHandleProps, DragConfig, UseDragGestureConfig, UseDragGestureCallbacks, UseDragGestureResult, UseDragShiftConfig, UseDragShiftResult, UseDropCompensationConfig, UseDragAnimatedStyleResult, AnimationDirection, ExitAnimationPreset, ExitAnimationConfig, EntryAnimationConfig, PendingEntryAnimation, ExitAnimationTrigger, HapticFeedbackType, } from './types';
55
55
  export type { DragStateContextValue, ListAnimationContextValue, } from './contexts';
56
+ /**
57
+ * Performance monitoring hooks and utilities.
58
+ * @internal These are intended for benchmarking and development purposes.
59
+ * Only available in __DEV__ mode for production builds.
60
+ *
61
+ * @example
62
+ * ```tsx
63
+ * import {
64
+ * useFPSMonitor,
65
+ * useRenderProfiler,
66
+ * useMemoryMonitor,
67
+ * } from '@souscheflabs/reanimated-flashlist';
68
+ *
69
+ * // Use in development/benchmark builds only
70
+ * if (__DEV__) {
71
+ * const fps = useFPSMonitor();
72
+ * fps.start();
73
+ * }
74
+ * ```
75
+ */
76
+ export { useFPSMonitor, useRenderProfiler, useMemoryMonitor, } from './performance';
77
+ export type { FPSMetrics, RenderMetrics, MemoryMetrics, BenchmarkResult, BaselineData, ScenarioMetrics, ComparisonResult, ComparisonDetail, ComparisonThresholds, FPSMonitorConfig, MemoryMonitorConfig, BenchmarkScenario, } from './performance';
56
78
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;;;GAKG;AACH,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EAEnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,YAAY,EAEV,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,eAAe,EAEf,UAAU,EACV,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,0BAA0B,EAE1B,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,qBAAqB,EACrB,yBA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YAAY,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,eAAe,EACf,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,eAAe,CAAC"}
package/lib/index.js CHANGED
@@ -34,7 +34,7 @@
34
34
  * ```
35
35
  */
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.standardEasing = exports.createEntryAnimationConfig = exports.getExitAnimationConfig = exports.DEFAULT_ENTRY_ANIMATION = exports.FAST_EXIT_ANIMATION = exports.DEFAULT_EXIT_ANIMATION = exports.createDragConfig = exports.DEFAULT_DRAG_CONFIG = exports.useListEntryAnimation = exports.useListExitAnimation = exports.useDropCompensation = exports.useDragAnimatedStyle = exports.useDragShift = exports.useDragGesture = exports.useListAnimationOptional = exports.useListAnimation = exports.ListAnimationProvider = exports.useDragState = exports.DragStateProvider = exports.useBenchmark = exports.AnimatedFlashListItem = exports.AnimatedFlashList = void 0;
37
+ exports.useMemoryMonitor = exports.useRenderProfiler = exports.useFPSMonitor = exports.standardEasing = exports.createEntryAnimationConfig = exports.getExitAnimationConfig = exports.DEFAULT_ENTRY_ANIMATION = exports.FAST_EXIT_ANIMATION = exports.DEFAULT_EXIT_ANIMATION = exports.createDragConfig = exports.DEFAULT_DRAG_CONFIG = exports.useListEntryAnimation = exports.useListExitAnimation = exports.useDropCompensation = exports.useDragAnimatedStyle = exports.useDragShift = exports.useDragGesture = exports.useListAnimationOptional = exports.useListAnimation = exports.ListAnimationProvider = exports.useDragState = exports.DragStateProvider = exports.useBenchmark = exports.AnimatedFlashListItem = exports.AnimatedFlashList = void 0;
38
38
  // Main component
39
39
  var AnimatedFlashList_1 = require("./AnimatedFlashList");
40
40
  Object.defineProperty(exports, "AnimatedFlashList", { enumerable: true, get: function () { return AnimatedFlashList_1.AnimatedFlashList; } });
@@ -82,3 +82,27 @@ Object.defineProperty(exports, "DEFAULT_ENTRY_ANIMATION", { enumerable: true, ge
82
82
  Object.defineProperty(exports, "getExitAnimationConfig", { enumerable: true, get: function () { return constants_1.getExitAnimationConfig; } });
83
83
  Object.defineProperty(exports, "createEntryAnimationConfig", { enumerable: true, get: function () { return constants_1.createEntryAnimationConfig; } });
84
84
  Object.defineProperty(exports, "standardEasing", { enumerable: true, get: function () { return constants_1.standardEasing; } });
85
+ /**
86
+ * Performance monitoring hooks and utilities.
87
+ * @internal These are intended for benchmarking and development purposes.
88
+ * Only available in __DEV__ mode for production builds.
89
+ *
90
+ * @example
91
+ * ```tsx
92
+ * import {
93
+ * useFPSMonitor,
94
+ * useRenderProfiler,
95
+ * useMemoryMonitor,
96
+ * } from '@souscheflabs/reanimated-flashlist';
97
+ *
98
+ * // Use in development/benchmark builds only
99
+ * if (__DEV__) {
100
+ * const fps = useFPSMonitor();
101
+ * fps.start();
102
+ * }
103
+ * ```
104
+ */
105
+ var performance_1 = require("./performance");
106
+ Object.defineProperty(exports, "useFPSMonitor", { enumerable: true, get: function () { return performance_1.useFPSMonitor; } });
107
+ Object.defineProperty(exports, "useRenderProfiler", { enumerable: true, get: function () { return performance_1.useRenderProfiler; } });
108
+ Object.defineProperty(exports, "useMemoryMonitor", { enumerable: true, get: function () { return performance_1.useMemoryMonitor; } });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Performance monitoring hooks
3
+ *
4
+ * These hooks provide real-time performance metrics for AnimatedFlashList.
5
+ * They are designed for development and benchmarking purposes.
6
+ */
7
+ export { useFPSMonitor, type UseFPSMonitorResult } from './useFPSMonitor';
8
+ export { useRenderProfiler, type UseRenderProfilerResult } from './useRenderProfiler';
9
+ export { useMemoryMonitor, type UseMemoryMonitorResult } from './useMemoryMonitor';
10
+ export { useBenchmarkComparison, type UseBenchmarkComparisonConfig, type UseBenchmarkComparisonResult, } from './useBenchmarkComparison';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/performance/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EACL,sBAAsB,EACtB,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,GAClC,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * Performance monitoring hooks
4
+ *
5
+ * These hooks provide real-time performance metrics for AnimatedFlashList.
6
+ * They are designed for development and benchmarking purposes.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.useBenchmarkComparison = exports.useMemoryMonitor = exports.useRenderProfiler = exports.useFPSMonitor = void 0;
10
+ var useFPSMonitor_1 = require("./useFPSMonitor");
11
+ Object.defineProperty(exports, "useFPSMonitor", { enumerable: true, get: function () { return useFPSMonitor_1.useFPSMonitor; } });
12
+ var useRenderProfiler_1 = require("./useRenderProfiler");
13
+ Object.defineProperty(exports, "useRenderProfiler", { enumerable: true, get: function () { return useRenderProfiler_1.useRenderProfiler; } });
14
+ var useMemoryMonitor_1 = require("./useMemoryMonitor");
15
+ Object.defineProperty(exports, "useMemoryMonitor", { enumerable: true, get: function () { return useMemoryMonitor_1.useMemoryMonitor; } });
16
+ var useBenchmarkComparison_1 = require("./useBenchmarkComparison");
17
+ Object.defineProperty(exports, "useBenchmarkComparison", { enumerable: true, get: function () { return useBenchmarkComparison_1.useBenchmarkComparison; } });
@@ -0,0 +1,45 @@
1
+ import { useFPSMonitor } from './useFPSMonitor';
2
+ import { useRenderProfiler } from './useRenderProfiler';
3
+ import { useMemoryMonitor } from './useMemoryMonitor';
4
+ import type { BenchmarkResult, ScenarioMetrics, BaselineData, ComparisonResult, BenchmarkScenario } from '../types';
5
+ export interface UseBenchmarkComparisonConfig {
6
+ /** Scenario being tested */
7
+ scenario: BenchmarkScenario | string;
8
+ /** Number of items in the list */
9
+ itemCount: number;
10
+ /** Baseline data for comparison (optional) */
11
+ baseline?: BaselineData | null;
12
+ /** Profiler ID for render tracking */
13
+ profilerId?: string;
14
+ }
15
+ export interface UseBenchmarkComparisonResult {
16
+ /** FPS monitor instance */
17
+ fpsMonitor: ReturnType<typeof useFPSMonitor>;
18
+ /** Render profiler instance */
19
+ renderProfiler: ReturnType<typeof useRenderProfiler>;
20
+ /** Memory monitor instance */
21
+ memoryMonitor: ReturnType<typeof useMemoryMonitor>;
22
+ /** Start all monitoring */
23
+ start: () => void;
24
+ /** Stop all monitoring */
25
+ stop: () => void;
26
+ /** Reset all metrics */
27
+ reset: () => void;
28
+ /** Get combined benchmark result */
29
+ getResult: () => BenchmarkResult;
30
+ /** Get metrics in ScenarioMetrics format */
31
+ getMetrics: () => ScenarioMetrics;
32
+ /** Compare with baseline (if provided) */
33
+ compareWithBaseline: () => ComparisonResult | null;
34
+ /** Compare with vanilla FlashList (if baseline contains comparison data) */
35
+ compareWithVanilla: () => ComparisonResult | null;
36
+ /** Get formatted markdown report */
37
+ getMarkdownReport: () => string | null;
38
+ /** Whether benchmark is currently running */
39
+ isRunning: boolean;
40
+ }
41
+ /**
42
+ * Hook that combines all performance monitors with baseline comparison
43
+ */
44
+ export declare function useBenchmarkComparison(config: UseBenchmarkComparisonConfig): UseBenchmarkComparisonResult;
45
+ //# sourceMappingURL=useBenchmarkComparison.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBenchmarkComparison.d.ts","sourceRoot":"","sources":["../../../src/performance/hooks/useBenchmarkComparison.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gB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@ -0,0 +1,155 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useBenchmarkComparison = useBenchmarkComparison;
4
+ /**
5
+ * Combined benchmark comparison hook
6
+ *
7
+ * Composes FPS, Memory, and Render monitoring into a single hook
8
+ * with baseline comparison capabilities.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * const benchmark = useBenchmarkComparison({
13
+ * scenario: 'scroll',
14
+ * itemCount: 100,
15
+ * baseline: loadedBaselineData,
16
+ * });
17
+ *
18
+ * // Start benchmarking
19
+ * benchmark.start();
20
+ *
21
+ * // After test completes
22
+ * benchmark.stop();
23
+ * const result = benchmark.getResult();
24
+ * const comparison = benchmark.compareWithBaseline();
25
+ * ```
26
+ */
27
+ const react_1 = require("react");
28
+ const useFPSMonitor_1 = require("./useFPSMonitor");
29
+ const useRenderProfiler_1 = require("./useRenderProfiler");
30
+ const useMemoryMonitor_1 = require("./useMemoryMonitor");
31
+ const compareResults_1 = require("../utils/compareResults");
32
+ const loadBaseline_1 = require("../utils/loadBaseline");
33
+ /**
34
+ * Hook that combines all performance monitors with baseline comparison
35
+ */
36
+ function useBenchmarkComparison(config) {
37
+ const { scenario, itemCount, baseline, profilerId = 'benchmark' } = config;
38
+ // Initialize individual monitors
39
+ const fpsMonitor = (0, useFPSMonitor_1.useFPSMonitor)();
40
+ const renderProfiler = (0, useRenderProfiler_1.useRenderProfiler)(profilerId);
41
+ const memoryMonitor = (0, useMemoryMonitor_1.useMemoryMonitor)();
42
+ // Track benchmark timing
43
+ const startTimeRef = (0, react_1.useRef)(0);
44
+ const isRunningRef = (0, react_1.useRef)(false);
45
+ // Start all monitors
46
+ const start = (0, react_1.useCallback)(() => {
47
+ if (isRunningRef.current)
48
+ return;
49
+ isRunningRef.current = true;
50
+ startTimeRef.current = Date.now();
51
+ fpsMonitor.start();
52
+ memoryMonitor.start();
53
+ // Render profiler starts automatically when Profiler component mounts
54
+ }, [fpsMonitor, memoryMonitor]);
55
+ // Stop all monitors
56
+ const stop = (0, react_1.useCallback)(() => {
57
+ if (!isRunningRef.current)
58
+ return;
59
+ isRunningRef.current = false;
60
+ fpsMonitor.stop();
61
+ memoryMonitor.stop();
62
+ }, [fpsMonitor, memoryMonitor]);
63
+ // Reset all monitors
64
+ const reset = (0, react_1.useCallback)(() => {
65
+ fpsMonitor.reset();
66
+ renderProfiler.reset();
67
+ memoryMonitor.reset();
68
+ startTimeRef.current = 0;
69
+ }, [fpsMonitor, renderProfiler, memoryMonitor]);
70
+ // Get metrics in ScenarioMetrics format
71
+ const getMetrics = (0, react_1.useCallback)(() => {
72
+ const fps = fpsMonitor.getSnapshot();
73
+ const render = renderProfiler.getSnapshot();
74
+ const memory = memoryMonitor.getSnapshot();
75
+ return {
76
+ uiFPS: {
77
+ avg: fps.avg,
78
+ min: fps.min,
79
+ max: fps.max,
80
+ jankPercentage: fps.jankPercentage,
81
+ },
82
+ memory: {
83
+ peakMB: memory.peakHeapMB,
84
+ deltaMB: memory.heapDeltaMB,
85
+ },
86
+ render: {
87
+ avgRenderTime: render.avgRenderTime,
88
+ maxRenderTime: render.maxRenderTime,
89
+ slowRenders: render.slowRenders,
90
+ },
91
+ };
92
+ }, [fpsMonitor, renderProfiler, memoryMonitor]);
93
+ // Get combined benchmark result
94
+ const getResult = (0, react_1.useCallback)(() => {
95
+ const fps = fpsMonitor.getSnapshot();
96
+ const render = renderProfiler.getSnapshot();
97
+ const memory = memoryMonitor.getSnapshot();
98
+ const durationMs = startTimeRef.current > 0 ? Date.now() - startTimeRef.current : 0;
99
+ return {
100
+ scenario,
101
+ itemCount,
102
+ durationMs,
103
+ timestamp: Date.now(),
104
+ uiFPS: fps,
105
+ render,
106
+ memory,
107
+ };
108
+ }, [scenario, itemCount, fpsMonitor, renderProfiler, memoryMonitor]);
109
+ // Compare with baseline
110
+ const compareWithBaselineFn = (0, react_1.useCallback)(() => {
111
+ if (!baseline) {
112
+ return null;
113
+ }
114
+ const baselineMetrics = (0, loadBaseline_1.getBaselineMetrics)(baseline, scenario, itemCount);
115
+ if (!baselineMetrics) {
116
+ return null;
117
+ }
118
+ const currentMetrics = getMetrics();
119
+ return (0, compareResults_1.compareWithBaseline)(currentMetrics, baselineMetrics);
120
+ }, [baseline, scenario, itemCount, getMetrics]);
121
+ // Compare with vanilla FlashList
122
+ const compareWithVanillaFn = (0, react_1.useCallback)(() => {
123
+ if (!baseline) {
124
+ return null;
125
+ }
126
+ const vanillaMetrics = (0, loadBaseline_1.getVanillaMetrics)(baseline, scenario, itemCount);
127
+ if (!vanillaMetrics) {
128
+ return null;
129
+ }
130
+ const currentMetrics = getMetrics();
131
+ return (0, compareResults_1.compareWithBaseline)(currentMetrics, vanillaMetrics);
132
+ }, [baseline, scenario, itemCount, getMetrics]);
133
+ // Get formatted markdown report
134
+ const getMarkdownReport = (0, react_1.useCallback)(() => {
135
+ const comparison = compareWithBaselineFn();
136
+ if (!comparison) {
137
+ return null;
138
+ }
139
+ return (0, compareResults_1.formatComparisonAsMarkdown)(comparison, scenario, itemCount);
140
+ }, [compareWithBaselineFn, scenario, itemCount]);
141
+ return {
142
+ fpsMonitor,
143
+ renderProfiler,
144
+ memoryMonitor,
145
+ start,
146
+ stop,
147
+ reset,
148
+ getResult,
149
+ getMetrics,
150
+ compareWithBaseline: compareWithBaselineFn,
151
+ compareWithVanilla: compareWithVanillaFn,
152
+ getMarkdownReport,
153
+ isRunning: isRunningRef.current,
154
+ };
155
+ }
@@ -0,0 +1,27 @@
1
+ import { useSharedValue } from 'react-native-reanimated';
2
+ import type { FPSMetrics, FPSMonitorConfig } from '../types';
3
+ export interface UseFPSMonitorResult {
4
+ /** SharedValue containing current FPS metrics (for UI thread access) */
5
+ metrics: ReturnType<typeof useSharedValue<FPSMetrics>>;
6
+ /** Start FPS monitoring */
7
+ start: () => void;
8
+ /** Stop FPS monitoring */
9
+ stop: () => void;
10
+ /** Reset all metrics */
11
+ reset: () => void;
12
+ /** Get a snapshot of current metrics (JS thread) */
13
+ getSnapshot: () => FPSMetrics;
14
+ /** Whether monitoring is currently active */
15
+ isActive: boolean;
16
+ }
17
+ /**
18
+ * Hook for monitoring FPS on both UI and JS threads
19
+ *
20
+ * Uses:
21
+ * - useFrameCallback for UI thread FPS (Reanimated pattern)
22
+ * - requestAnimationFrame for JS thread FPS
23
+ *
24
+ * @param config - Optional configuration for thresholds and buffer size
25
+ */
26
+ export declare function useFPSMonitor(config?: Partial<FPSMonitorConfig>): UseFPSMonitorResult;
27
+ //# sourceMappingURL=useFPSMonitor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFPSMonitor.d.ts","sourceRoot":"","sources":["../../../src/performance/hooks/useFPSMonitor.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,cAAc,EAAoB,MAAM,yBAAyB,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAuD7D,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,OAAO,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IACvD,2BAA2B;IAC3B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,wBAAwB;IACxB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,oDAAoD;IACpD,WAAW,EAAE,MAAM,UAAU,CAAC;IAC9B,6CAA6C;IAC7C,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,MAAM,GAAE,OAAO,CAAC,gBAAgB,CAAM,GACrC,mBAAmB,CAyLrB"}