@shopify/flash-list 2.0.0-alpha.9 → 2.0.0-rc.10

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 (209) hide show
  1. package/README.md +37 -97
  2. package/android/src/main/kotlin/com/shopify/reactnative/flash_list/BlankAreaEvent.kt +2 -2
  3. package/dist/AnimatedFlashList.d.ts.map +1 -1
  4. package/dist/AnimatedFlashList.js +3 -3
  5. package/dist/AnimatedFlashList.js.map +1 -1
  6. package/dist/FlashList.d.ts +9 -0
  7. package/dist/FlashList.d.ts.map +1 -1
  8. package/dist/FlashList.js +20 -0
  9. package/dist/FlashList.js.map +1 -1
  10. package/dist/FlashListProps.d.ts +30 -10
  11. package/dist/FlashListProps.d.ts.map +1 -1
  12. package/dist/FlashListProps.js.map +1 -1
  13. package/dist/FlashListRef.d.ts +305 -0
  14. package/dist/FlashListRef.d.ts.map +1 -0
  15. package/dist/FlashListRef.js +3 -0
  16. package/dist/FlashListRef.js.map +1 -0
  17. package/dist/MasonryFlashList.js.map +1 -1
  18. package/dist/__tests__/RecyclerView.test.js +72 -28
  19. package/dist/__tests__/RecyclerView.test.js.map +1 -1
  20. package/dist/__tests__/RenderStackManager.test.d.ts +2 -0
  21. package/dist/__tests__/RenderStackManager.test.d.ts.map +1 -0
  22. package/dist/__tests__/RenderStackManager.test.js +485 -0
  23. package/dist/__tests__/RenderStackManager.test.js.map +1 -0
  24. package/dist/__tests__/helpers/createLayoutManager.d.ts.map +1 -1
  25. package/dist/__tests__/helpers/createLayoutManager.js +3 -4
  26. package/dist/__tests__/helpers/createLayoutManager.js.map +1 -1
  27. package/dist/__tests__/useUnmountAwareCallbacks.test.js +1 -1
  28. package/dist/__tests__/useUnmountAwareCallbacks.test.js.map +1 -1
  29. package/dist/benchmark/useBenchmark.js +0 -25
  30. package/dist/benchmark/useBenchmark.js.map +1 -1
  31. package/dist/benchmark/useFlatListBenchmark.js +8 -7
  32. package/dist/benchmark/useFlatListBenchmark.js.map +1 -1
  33. package/dist/index.d.ts +2 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +2 -2
  36. package/dist/index.js.map +1 -1
  37. package/dist/native/config/PlatformHelper.android.d.ts +1 -0
  38. package/dist/native/config/PlatformHelper.android.d.ts.map +1 -1
  39. package/dist/native/config/PlatformHelper.android.js +1 -0
  40. package/dist/native/config/PlatformHelper.android.js.map +1 -1
  41. package/dist/native/config/PlatformHelper.d.ts +1 -0
  42. package/dist/native/config/PlatformHelper.d.ts.map +1 -1
  43. package/dist/native/config/PlatformHelper.ios.d.ts +1 -0
  44. package/dist/native/config/PlatformHelper.ios.d.ts.map +1 -1
  45. package/dist/native/config/PlatformHelper.ios.js +1 -0
  46. package/dist/native/config/PlatformHelper.ios.js.map +1 -1
  47. package/dist/native/config/PlatformHelper.js +1 -0
  48. package/dist/native/config/PlatformHelper.js.map +1 -1
  49. package/dist/native/config/PlatformHelper.web.d.ts +1 -0
  50. package/dist/native/config/PlatformHelper.web.d.ts.map +1 -1
  51. package/dist/native/config/PlatformHelper.web.js +1 -0
  52. package/dist/native/config/PlatformHelper.web.js.map +1 -1
  53. package/dist/recyclerview/RecyclerView.d.ts +2 -1
  54. package/dist/recyclerview/RecyclerView.d.ts.map +1 -1
  55. package/dist/recyclerview/RecyclerView.js +104 -57
  56. package/dist/recyclerview/RecyclerView.js.map +1 -1
  57. package/dist/recyclerview/RecyclerViewContextProvider.d.ts +41 -6
  58. package/dist/recyclerview/RecyclerViewContextProvider.d.ts.map +1 -1
  59. package/dist/recyclerview/RecyclerViewContextProvider.js +4 -0
  60. package/dist/recyclerview/RecyclerViewContextProvider.js.map +1 -1
  61. package/dist/recyclerview/RecyclerViewManager.d.ts +24 -7
  62. package/dist/recyclerview/RecyclerViewManager.d.ts.map +1 -1
  63. package/dist/recyclerview/RecyclerViewManager.js +119 -113
  64. package/dist/recyclerview/RecyclerViewManager.js.map +1 -1
  65. package/dist/recyclerview/RenderStackManager.d.ts +86 -0
  66. package/dist/recyclerview/RenderStackManager.d.ts.map +1 -0
  67. package/dist/recyclerview/RenderStackManager.js +343 -0
  68. package/dist/recyclerview/RenderStackManager.js.map +1 -0
  69. package/dist/recyclerview/ViewHolder.d.ts.map +1 -1
  70. package/dist/recyclerview/ViewHolder.js +5 -3
  71. package/dist/recyclerview/ViewHolder.js.map +1 -1
  72. package/dist/recyclerview/ViewHolderCollection.d.ts +9 -3
  73. package/dist/recyclerview/ViewHolderCollection.d.ts.map +1 -1
  74. package/dist/recyclerview/ViewHolderCollection.js +26 -9
  75. package/dist/recyclerview/ViewHolderCollection.js.map +1 -1
  76. package/dist/recyclerview/components/ScrollAnchor.d.ts +2 -2
  77. package/dist/recyclerview/components/ScrollAnchor.d.ts.map +1 -1
  78. package/dist/recyclerview/components/ScrollAnchor.js +9 -5
  79. package/dist/recyclerview/components/ScrollAnchor.js.map +1 -1
  80. package/dist/recyclerview/components/StickyHeaders.d.ts +1 -1
  81. package/dist/recyclerview/components/StickyHeaders.d.ts.map +1 -1
  82. package/dist/recyclerview/components/StickyHeaders.js +40 -33
  83. package/dist/recyclerview/components/StickyHeaders.js.map +1 -1
  84. package/dist/recyclerview/helpers/EngagedIndicesTracker.d.ts +45 -1
  85. package/dist/recyclerview/helpers/EngagedIndicesTracker.d.ts.map +1 -1
  86. package/dist/recyclerview/helpers/EngagedIndicesTracker.js +77 -20
  87. package/dist/recyclerview/helpers/EngagedIndicesTracker.js.map +1 -1
  88. package/dist/recyclerview/helpers/RenderTimeTracker.d.ts +11 -0
  89. package/dist/recyclerview/helpers/RenderTimeTracker.d.ts.map +1 -0
  90. package/dist/recyclerview/helpers/RenderTimeTracker.js +42 -0
  91. package/dist/recyclerview/helpers/RenderTimeTracker.js.map +1 -0
  92. package/dist/recyclerview/helpers/VelocityTracker.d.ts +29 -0
  93. package/dist/recyclerview/helpers/VelocityTracker.d.ts.map +1 -0
  94. package/dist/recyclerview/helpers/VelocityTracker.js +70 -0
  95. package/dist/recyclerview/helpers/VelocityTracker.js.map +1 -0
  96. package/dist/recyclerview/hooks/useBoundDetection.d.ts +1 -2
  97. package/dist/recyclerview/hooks/useBoundDetection.d.ts.map +1 -1
  98. package/dist/recyclerview/hooks/useBoundDetection.js +56 -22
  99. package/dist/recyclerview/hooks/useBoundDetection.js.map +1 -1
  100. package/dist/recyclerview/hooks/useLayoutState.d.ts +3 -1
  101. package/dist/recyclerview/hooks/useLayoutState.d.ts.map +1 -1
  102. package/dist/recyclerview/hooks/useLayoutState.js +5 -3
  103. package/dist/recyclerview/hooks/useLayoutState.js.map +1 -1
  104. package/dist/recyclerview/hooks/useMappingHelper.d.ts +1 -1
  105. package/dist/recyclerview/hooks/useMappingHelper.d.ts.map +1 -1
  106. package/dist/recyclerview/hooks/useMappingHelper.js +1 -1
  107. package/dist/recyclerview/hooks/useMappingHelper.js.map +1 -1
  108. package/dist/recyclerview/hooks/useOnLoad.d.ts.map +1 -1
  109. package/dist/recyclerview/hooks/useOnLoad.js +4 -6
  110. package/dist/recyclerview/hooks/useOnLoad.js.map +1 -1
  111. package/dist/recyclerview/hooks/useRecyclerViewController.d.ts +5 -49
  112. package/dist/recyclerview/hooks/useRecyclerViewController.d.ts.map +1 -1
  113. package/dist/recyclerview/hooks/useRecyclerViewController.js +315 -204
  114. package/dist/recyclerview/hooks/useRecyclerViewController.js.map +1 -1
  115. package/dist/recyclerview/hooks/useRecyclerViewManager.d.ts +2 -0
  116. package/dist/recyclerview/hooks/useRecyclerViewManager.d.ts.map +1 -1
  117. package/dist/recyclerview/hooks/useRecyclerViewManager.js +11 -1
  118. package/dist/recyclerview/hooks/useRecyclerViewManager.js.map +1 -1
  119. package/dist/recyclerview/hooks/useRecyclingState.d.ts +4 -2
  120. package/dist/recyclerview/hooks/useRecyclingState.d.ts.map +1 -1
  121. package/dist/recyclerview/hooks/useRecyclingState.js +2 -2
  122. package/dist/recyclerview/hooks/useRecyclingState.js.map +1 -1
  123. package/dist/recyclerview/hooks/useSecondaryProps.js +1 -1
  124. package/dist/recyclerview/hooks/useUnmountAwareCallbacks.d.ts +10 -3
  125. package/dist/recyclerview/hooks/useUnmountAwareCallbacks.d.ts.map +1 -1
  126. package/dist/recyclerview/hooks/useUnmountAwareCallbacks.js +33 -4
  127. package/dist/recyclerview/hooks/useUnmountAwareCallbacks.js.map +1 -1
  128. package/dist/recyclerview/hooks/useUnmountFlag.d.ts.map +1 -1
  129. package/dist/recyclerview/hooks/useUnmountFlag.js +1 -0
  130. package/dist/recyclerview/hooks/useUnmountFlag.js.map +1 -1
  131. package/dist/recyclerview/layout-managers/GridLayoutManager.d.ts +18 -4
  132. package/dist/recyclerview/layout-managers/GridLayoutManager.d.ts.map +1 -1
  133. package/dist/recyclerview/layout-managers/GridLayoutManager.js +60 -21
  134. package/dist/recyclerview/layout-managers/GridLayoutManager.js.map +1 -1
  135. package/dist/recyclerview/layout-managers/LayoutManager.d.ts +35 -21
  136. package/dist/recyclerview/layout-managers/LayoutManager.d.ts.map +1 -1
  137. package/dist/recyclerview/layout-managers/LayoutManager.js +92 -28
  138. package/dist/recyclerview/layout-managers/LayoutManager.js.map +1 -1
  139. package/dist/recyclerview/layout-managers/MasonryLayoutManager.d.ts +9 -1
  140. package/dist/recyclerview/layout-managers/MasonryLayoutManager.d.ts.map +1 -1
  141. package/dist/recyclerview/layout-managers/MasonryLayoutManager.js +28 -12
  142. package/dist/recyclerview/layout-managers/MasonryLayoutManager.js.map +1 -1
  143. package/dist/recyclerview/utils/measureLayout.web.d.ts.map +1 -1
  144. package/dist/recyclerview/utils/measureLayout.web.js +1 -3
  145. package/dist/recyclerview/utils/measureLayout.web.js.map +1 -1
  146. package/dist/tsconfig.tsbuildinfo +1 -1
  147. package/dist/viewability/ViewToken.d.ts +2 -2
  148. package/dist/viewability/ViewToken.d.ts.map +1 -1
  149. package/dist/viewability/ViewabilityHelper.js +1 -1
  150. package/dist/viewability/ViewabilityHelper.js.map +1 -1
  151. package/dist/viewability/ViewabilityManager.d.ts.map +1 -1
  152. package/dist/viewability/ViewabilityManager.js +11 -5
  153. package/dist/viewability/ViewabilityManager.js.map +1 -1
  154. package/jestSetup.js +30 -11
  155. package/package.json +2 -1
  156. package/src/AnimatedFlashList.ts +3 -2
  157. package/src/FlashList.tsx +24 -0
  158. package/src/FlashListProps.ts +41 -10
  159. package/src/FlashListRef.ts +320 -0
  160. package/src/MasonryFlashList.tsx +2 -2
  161. package/src/__tests__/RecyclerView.test.tsx +106 -31
  162. package/src/__tests__/RenderStackManager.test.ts +574 -0
  163. package/src/__tests__/helpers/createLayoutManager.ts +2 -3
  164. package/src/__tests__/useUnmountAwareCallbacks.test.tsx +12 -12
  165. package/src/benchmark/useBenchmark.ts +0 -37
  166. package/src/benchmark/useFlatListBenchmark.ts +2 -2
  167. package/src/index.ts +2 -1
  168. package/src/native/config/PlatformHelper.android.ts +1 -0
  169. package/src/native/config/PlatformHelper.ios.ts +1 -0
  170. package/src/native/config/PlatformHelper.ts +1 -0
  171. package/src/native/config/PlatformHelper.web.ts +1 -0
  172. package/src/recyclerview/RecyclerView.tsx +139 -75
  173. package/src/recyclerview/RecyclerViewContextProvider.ts +52 -7
  174. package/src/recyclerview/RecyclerViewManager.ts +135 -98
  175. package/src/recyclerview/RenderStackManager.ts +317 -0
  176. package/src/recyclerview/ViewHolder.tsx +5 -3
  177. package/src/recyclerview/ViewHolderCollection.tsx +42 -14
  178. package/src/recyclerview/components/ScrollAnchor.tsx +21 -9
  179. package/src/recyclerview/components/StickyHeaders.tsx +63 -45
  180. package/src/recyclerview/helpers/EngagedIndicesTracker.ts +118 -23
  181. package/src/recyclerview/helpers/RenderTimeTracker.ts +42 -0
  182. package/src/recyclerview/helpers/VelocityTracker.ts +77 -0
  183. package/src/recyclerview/hooks/useBoundDetection.ts +72 -23
  184. package/src/recyclerview/hooks/useLayoutState.ts +15 -6
  185. package/src/recyclerview/hooks/useMappingHelper.ts +1 -1
  186. package/src/recyclerview/hooks/useOnLoad.ts +4 -6
  187. package/src/recyclerview/hooks/useRecyclerViewController.tsx +364 -254
  188. package/src/recyclerview/hooks/useRecyclerViewManager.ts +13 -1
  189. package/src/recyclerview/hooks/useRecyclingState.ts +11 -7
  190. package/src/recyclerview/hooks/useSecondaryProps.tsx +1 -1
  191. package/src/recyclerview/hooks/useUnmountAwareCallbacks.ts +39 -3
  192. package/src/recyclerview/hooks/useUnmountFlag.ts +1 -0
  193. package/src/recyclerview/layout-managers/GridLayoutManager.ts +67 -23
  194. package/src/recyclerview/layout-managers/LayoutManager.ts +110 -41
  195. package/src/recyclerview/layout-managers/MasonryLayoutManager.ts +30 -8
  196. package/src/recyclerview/utils/measureLayout.web.ts +1 -3
  197. package/src/viewability/ViewToken.ts +2 -2
  198. package/src/viewability/ViewabilityHelper.ts +1 -1
  199. package/src/viewability/ViewabilityManager.ts +16 -9
  200. package/dist/__tests__/RecycleKeyManager.test.d.ts +0 -2
  201. package/dist/__tests__/RecycleKeyManager.test.d.ts.map +0 -1
  202. package/dist/__tests__/RecycleKeyManager.test.js +0 -210
  203. package/dist/__tests__/RecycleKeyManager.test.js.map +0 -1
  204. package/dist/recyclerview/RecycleKeyManager.d.ts +0 -82
  205. package/dist/recyclerview/RecycleKeyManager.d.ts.map +0 -1
  206. package/dist/recyclerview/RecycleKeyManager.js +0 -135
  207. package/dist/recyclerview/RecycleKeyManager.js.map +0 -1
  208. package/src/__tests__/RecycleKeyManager.test.ts +0 -254
  209. package/src/recyclerview/RecycleKeyManager.ts +0 -185
@@ -19,10 +19,13 @@ export class RVMasonryLayoutManagerImpl extends RVLayoutManager {
19
19
  /** Current column index for sequential placement */
20
20
  private currentColumn = 0;
21
21
 
22
+ /** If there's a span change for masonry layout, we need to recompute all the widths */
23
+ private fullRelayoutRequired = false;
24
+
22
25
  constructor(params: LayoutParams, previousLayoutManager?: RVLayoutManager) {
23
26
  super(params, previousLayoutManager);
24
27
  this.boundedSize = params.windowSize.width;
25
- this.optimizeItemArrangement = params.optimizeItemArrangement ?? false;
28
+ this.optimizeItemArrangement = params.optimizeItemArrangement;
26
29
  this.columnHeights = this.columnHeights ?? Array(this.maxColumns).fill(0);
27
30
  }
28
31
 
@@ -44,10 +47,7 @@ export class RVMasonryLayoutManagerImpl extends RVLayoutManager {
44
47
  // console.log("-----> recomputeLayouts");
45
48
 
46
49
  // update all widths
47
- for (let i = 0; i < this.layouts.length; i++) {
48
- this.layouts[i].width = this.getWidth(i);
49
- this.layouts[i].minHeight = undefined;
50
- }
50
+ this.updateAllWidths();
51
51
  this.recomputeLayouts(0, this.layouts.length - 1);
52
52
  this.requiresRepaint = true;
53
53
  }
@@ -69,6 +69,13 @@ export class RVMasonryLayoutManagerImpl extends RVLayoutManager {
69
69
  layout.isWidthMeasured = true;
70
70
  this.layouts[index] = layout;
71
71
  }
72
+
73
+ // TODO: Can be optimized
74
+ if (this.fullRelayoutRequired) {
75
+ this.updateAllWidths();
76
+ this.fullRelayoutRequired = false;
77
+ return 0;
78
+ }
72
79
  }
73
80
 
74
81
  /**
@@ -87,6 +94,14 @@ export class RVMasonryLayoutManagerImpl extends RVLayoutManager {
87
94
  layout.enforcedWidth = true;
88
95
  }
89
96
 
97
+ /**
98
+ * Handles span change for an item.
99
+ * @param index Index of the item
100
+ */
101
+ handleSpanChange(index: number) {
102
+ this.fullRelayoutRequired = true;
103
+ }
104
+
90
105
  /**
91
106
  * Returns the total size of the layout area.
92
107
  * @returns RVDimension containing width and height of the layout
@@ -124,7 +139,8 @@ export class RVMasonryLayoutManagerImpl extends RVLayoutManager {
124
139
 
125
140
  for (let i = startIndex; i < itemCount; i++) {
126
141
  const layout = this.getLayout(i);
127
- const span = this.getSpanSizeInfo(i).span ?? 1;
142
+ // Skip tracking span because we're not changing widths
143
+ const span = this.getSpan(i, true);
128
144
 
129
145
  if (this.optimizeItemArrangement) {
130
146
  if (span === 1) {
@@ -147,8 +163,14 @@ export class RVMasonryLayoutManagerImpl extends RVLayoutManager {
147
163
  * @returns Width of the item
148
164
  */
149
165
  private getWidth(index: number): number {
150
- const span = this.getSpanSizeInfo(index).span ?? 1;
151
- return (this.boundedSize / this.maxColumns) * span;
166
+ return (this.boundedSize / this.maxColumns) * this.getSpan(index);
167
+ }
168
+
169
+ private updateAllWidths() {
170
+ for (let i = 0; i < this.layouts.length; i++) {
171
+ this.layouts[i].width = this.getWidth(i);
172
+ this.layouts[i].minHeight = undefined;
173
+ }
152
174
  }
153
175
 
154
176
  /**
@@ -12,15 +12,13 @@ function getScrollOffsets(element: Element, stopAt: Element) {
12
12
  let scrollX = 0;
13
13
  let scrollY = 0;
14
14
  let currentElement: Element | null = element;
15
- let depth = 0;
16
15
 
17
16
  // Only check up to 3 parent elements
18
- while (currentElement && currentElement !== stopAt && depth < 3) {
17
+ while (currentElement && currentElement !== stopAt) {
19
18
  const htmlElement = currentElement as HTMLElement;
20
19
  scrollX += htmlElement.scrollLeft ?? 0;
21
20
  scrollY += htmlElement.scrollTop ?? 0;
22
21
  currentElement = currentElement.parentElement;
23
- depth++;
24
22
  }
25
23
 
26
24
  return { scrollX, scrollY };
@@ -1,5 +1,5 @@
1
- export default interface ViewToken {
2
- item: any; // TODO: fix this type
1
+ export default interface ViewToken<T> {
2
+ item: T;
3
3
  key: string;
4
4
  index: number | null;
5
5
  isViewable: boolean;
@@ -89,8 +89,8 @@ class ViewabilityHelper {
89
89
  const timeoutId = setTimeout(() => {
90
90
  this.timers.delete(timeoutId);
91
91
  this.checkViewableIndicesChanges(newViewableIndices);
92
- this.timers.add(timeoutId);
93
92
  }, minimumViewTime);
93
+ this.timers.add(timeoutId);
94
94
  } else {
95
95
  this.checkViewableIndicesChanges(newViewableIndices);
96
96
  }
@@ -22,17 +22,21 @@ export default class ViewabilityManager<T> {
22
22
  this.viewabilityHelpers.push(
23
23
  this.createViewabilityHelper(
24
24
  flashListRef.props.viewabilityConfig,
25
- flashListRef.props.onViewableItemsChanged
25
+ (info) => {
26
+ flashListRef.props.onViewableItemsChanged?.(info);
27
+ }
26
28
  )
27
29
  );
28
30
  }
29
31
  (flashListRef.props.viewabilityConfigCallbackPairs ?? []).forEach(
30
- (pair) => {
32
+ (pair, index) => {
31
33
  this.viewabilityHelpers.push(
32
- this.createViewabilityHelper(
33
- pair.viewabilityConfig,
34
- pair.onViewableItemsChanged
35
- )
34
+ this.createViewabilityHelper(pair.viewabilityConfig, (info) => {
35
+ const callback =
36
+ flashListRef.props.viewabilityConfigCallbackPairs?.[index]
37
+ ?.onViewableItemsChanged;
38
+ callback?.(info);
39
+ })
36
40
  );
37
41
  }
38
42
  );
@@ -102,15 +106,18 @@ export default class ViewabilityManager<T> {
102
106
  private createViewabilityHelper = (
103
107
  viewabilityConfig: ViewabilityConfig | null | undefined,
104
108
  onViewableItemsChanged:
105
- | ((info: { viewableItems: ViewToken[]; changed: ViewToken[] }) => void)
109
+ | ((info: {
110
+ viewableItems: ViewToken<T>[];
111
+ changed: ViewToken<T>[];
112
+ }) => void)
106
113
  | null
107
114
  | undefined
108
115
  ) => {
109
- const mapViewToken: (index: number, isViewable: boolean) => ViewToken = (
116
+ const mapViewToken: (index: number, isViewable: boolean) => ViewToken<T> = (
110
117
  index: number,
111
118
  isViewable: boolean
112
119
  ) => {
113
- const item = this.flashListRef.props.data?.[index];
120
+ const item = this.flashListRef.props.data![index];
114
121
  const key =
115
122
  item === undefined || this.flashListRef.props.keyExtractor === undefined
116
123
  ? index.toString()
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=RecycleKeyManager.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RecycleKeyManager.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/RecycleKeyManager.test.ts"],"names":[],"mappings":""}
@@ -1,210 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var RecycleKeyManager_1 = require("../recyclerview/RecycleKeyManager");
4
- describe("RecycleKeyManagerImpl", function () {
5
- var keyManager;
6
- beforeEach(function () {
7
- // Initialize a new manager before each test
8
- keyManager = new RecycleKeyManager_1.RecycleKeyManagerImpl();
9
- });
10
- describe("constructor", function () {
11
- it("should initialize with default maxItems", function () {
12
- // Test default maxItems value (implicitly tested via other methods)
13
- // We can potentially expose maxItems for testing or test its effect
14
- expect(keyManager).toBeDefined(); // Basic check
15
- });
16
- it("should initialize with specified maxItems", function () {
17
- var specificMaxItems = 10;
18
- keyManager = new RecycleKeyManager_1.RecycleKeyManagerImpl(specificMaxItems);
19
- // Test the effect of maxItems limit later in getKey tests
20
- expect(keyManager).toBeDefined(); // Basic check
21
- });
22
- });
23
- describe("getKey", function () {
24
- it("should generate a new key for a new item type without stableId", function () {
25
- var key = keyManager.getKey("typeA", "item1");
26
- expect(key).toBeDefined();
27
- expect(typeof key).toBe("string");
28
- expect(keyManager.hasKeyInPool(key)).toBe(false);
29
- });
30
- it("should generate a different key for a different item type", function () {
31
- var keyA = keyManager.getKey("typeA", "item1");
32
- var keyB = keyManager.getKey("typeB", "item2");
33
- expect(keyA).not.toEqual(keyB);
34
- expect(keyManager.hasKeyInPool(keyA)).toBe(false);
35
- expect(keyManager.hasKeyInPool(keyB)).toBe(false);
36
- });
37
- it("should generate sequential keys when pool is empty", function () {
38
- var key1 = keyManager.getKey("typeA", "item1");
39
- var key2 = keyManager.getKey("typeA", "item2");
40
- expect(parseInt(key2, 10)).toBe(parseInt(key1, 10) + 1);
41
- });
42
- it("should return the existing key for a known stableId", function () {
43
- var stableId = "stable1";
44
- var key1 = keyManager.getKey("typeA", stableId);
45
- var key2 = keyManager.getKey("typeA", stableId);
46
- var key3 = keyManager.getKey("typeB", stableId); // Different type, same stableId
47
- expect(key2).toEqual(key1);
48
- expect(key3).toEqual(key1); // Should still return the key associated with the stableId
49
- expect(keyManager.hasKeyInPool(key1)).toBe(false);
50
- });
51
- it("should reuse a key from the pool for the same item type", function () {
52
- var key1 = keyManager.getKey("typeA", "item1");
53
- keyManager.recycleKey(key1);
54
- var key2 = keyManager.getKey("typeA", "item2");
55
- expect(key2).toEqual(key1); // Should reuse the recycled key
56
- expect(keyManager.hasKeyInPool(key1)).toBe(false);
57
- });
58
- it("should reuse the specified currentKey if it exists in the pool", function () {
59
- var key1 = keyManager.getKey("typeA", "item1");
60
- var key2 = keyManager.getKey("typeA", "item2");
61
- keyManager.recycleKey(key1);
62
- keyManager.recycleKey(key2);
63
- var reusedKey = keyManager.getKey("typeA", "item3", key1);
64
- expect(reusedKey).toEqual(key1);
65
- expect(keyManager.hasKeyInPool(key1)).toBe(false);
66
- // key2 should still be in the pool
67
- expect(keyManager.hasKeyInPool(key2)).toBe(true);
68
- });
69
- it("should reuse any key from the pool if currentKey does not exist", function () {
70
- var key1 = keyManager.getKey("typeA", "item1");
71
- var key2 = keyManager.getKey("typeA", "item2");
72
- keyManager.recycleKey(key1);
73
- keyManager.recycleKey(key2);
74
- var nonExistentKey = "nonExistentKey";
75
- var reusedKey = keyManager.getKey("typeA", "item3", nonExistentKey);
76
- // It should have reused either key1 or key2
77
- expect([key1, key2]).toContain(reusedKey);
78
- expect(keyManager.hasKeyInPool(reusedKey)).toBe(false);
79
- });
80
- it("should prioritize stableId over pool reuse", function () {
81
- var stableId = "stable1";
82
- var key1 = keyManager.getKey("typeA", stableId); // Assign key1 to stable1
83
- var key2 = keyManager.getKey("typeA", "item2");
84
- keyManager.recycleKey(key2); // Put key2 in the pool
85
- // Request key for stable1 again
86
- var key3 = keyManager.getKey("typeA", stableId);
87
- expect(key3).toEqual(key1); // Should return key1 associated with stableId
88
- expect(keyManager.hasKeyInPool(key1)).toBe(false);
89
- // key2 should still be in the pool
90
- expect(keyManager.hasKeyInPool(key2)).toBe(true);
91
- });
92
- it("should assign stableId to a reused key", function () {
93
- var key1 = keyManager.getKey("typeA", "item1");
94
- keyManager.recycleKey(key1);
95
- var stableId = "stableReuse";
96
- var reusedKey = keyManager.getKey("typeA", stableId); // Reuse key1 and assign stableId
97
- expect(reusedKey).toEqual(key1);
98
- // Verify stableId mapping
99
- var keyForStableId = keyManager.getKey("typeA", stableId);
100
- expect(keyForStableId).toEqual(key1);
101
- });
102
- it("should handle ensurePoolSize when maxItems is exceeded", function () {
103
- var maxItems = 2;
104
- keyManager = new RecycleKeyManager_1.RecycleKeyManagerImpl(maxItems);
105
- var key1 = keyManager.getKey("typeA", "item1"); // Active: {key1}
106
- var key2 = keyManager.getKey("typeA", "item2"); // Active: {key1, key2}
107
- expect(keyManager.hasKeyInPool(key1)).toBe(false);
108
- expect(keyManager.hasKeyInPool(key2)).toBe(false);
109
- // This should trigger ensurePoolSize and recycle key1 (oldest)
110
- var key3 = keyManager.getKey("typeA", "item3"); // Active: {key2, key3}
111
- expect(keyManager.hasKeyInPool(key1)).toBe(true); // key1 should be recycled
112
- expect(keyManager.hasKeyInPool(key2)).toBe(false);
113
- expect(keyManager.hasKeyInPool(key3)).toBe(false);
114
- // This should trigger ensurePoolSize and recycle key2
115
- var key4 = keyManager.getKey("typeA", "item4"); // Active: {key3, key4}
116
- expect(keyManager.hasKeyInPool(key2)).toBe(true); // key2 should be recycled
117
- expect(keyManager.hasKeyInPool(key3)).toBe(false);
118
- expect(keyManager.hasKeyInPool(key4)).toBe(false);
119
- });
120
- });
121
- describe("recycleKey", function () {
122
- it("should add the key back to the correct pool", function () {
123
- var keyA = keyManager.getKey("typeA", "item1");
124
- var keyB = keyManager.getKey("typeB", "item2");
125
- expect(keyManager.hasKeyInPool(keyA)).toBe(false);
126
- expect(keyManager.hasKeyInPool(keyB)).toBe(false);
127
- keyManager.recycleKey(keyA);
128
- expect(keyManager.hasKeyInPool(keyA)).toBe(true);
129
- expect(keyManager.hasKeyInPool(keyB)).toBe(false); // keyB should remain active
130
- // Verify reuse from correct pool
131
- var reusedKeyA = keyManager.getKey("typeA", "item3");
132
- expect(reusedKeyA).toEqual(keyA);
133
- });
134
- it("should do nothing if the key does not exist or is already recycled", function () {
135
- var key = keyManager.getKey("typeA", "item1");
136
- keyManager.recycleKey(key); // Recycle it once
137
- // Get current state (how many keys active, how many in pool)
138
- // We need internal access or specific methods to check pool size directly.
139
- // Let's assume internal state is correct after first recycle.
140
- keyManager.recycleKey(key); // Try recycling again
141
- keyManager.recycleKey("nonExistentKey"); // Try recycling non-existent key
142
- // Verify state hasn't changed unexpectedly
143
- expect(keyManager.hasKeyInPool(key)).toBe(true); // Still in pool
144
- var newKey = keyManager.getKey("typeA", "item2");
145
- expect(newKey).toEqual(key); // Should still reuse the original key
146
- });
147
- });
148
- describe("hasKeyInPool", function () {
149
- it("should return false for an active key", function () {
150
- var key = keyManager.getKey("typeA", "item1");
151
- expect(keyManager.hasKeyInPool(key)).toBe(false);
152
- });
153
- it("should return true for a recycled key", function () {
154
- var key = keyManager.getKey("typeA", "item1");
155
- keyManager.recycleKey(key);
156
- expect(keyManager.hasKeyInPool(key)).toBe(true);
157
- });
158
- it("should return true for a key that was never generated", function () {
159
- expect(keyManager.hasKeyInPool("nonExistentKey")).toBe(true);
160
- });
161
- });
162
- describe("clearPool", function () {
163
- it("should clear all keys from all pools", function () {
164
- var keyA1 = keyManager.getKey("typeA", "item1");
165
- var keyA2 = keyManager.getKey("typeA", "item2");
166
- var keyB1 = keyManager.getKey("typeB", "item3");
167
- keyManager.recycleKey(keyA1);
168
- keyManager.recycleKey(keyB1);
169
- expect(keyManager.hasKeyInPool(keyA1)).toBe(true);
170
- expect(keyManager.hasKeyInPool(keyA2)).toBe(false); // Still active
171
- expect(keyManager.hasKeyInPool(keyB1)).toBe(true);
172
- keyManager.clearPool();
173
- expect(keyManager.hasKeyInPool(keyA1)).toBe(true); // Still not active
174
- expect(keyManager.hasKeyInPool(keyB1)).toBe(true); // Still not active
175
- expect(keyManager.hasKeyInPool(keyA2)).toBe(false); // Active keys remain
176
- // Getting new keys should generate new ones, not reuse cleared ones
177
- var newKeyA = keyManager.getKey("typeA", "item4");
178
- var newKeyB = keyManager.getKey("typeB", "item5");
179
- expect(newKeyA).not.toEqual(keyA1);
180
- expect(newKeyB).not.toEqual(keyB1);
181
- // Depending on implementation, newKeyA might be keyA1 if keyCounter wasn't reset
182
- // Check if key reuse happens after clearPool -> it shouldn't reuse from the *pool*
183
- var keyA3 = keyManager.getKey("typeA", "item5"); // Generate another A key
184
- keyManager.recycleKey(keyA3); // Recycle it
185
- keyManager.clearPool(); // Clear pools again
186
- keyManager.getKey("typeA", "item6"); // Get a new key
187
- expect(keyManager.hasKeyInPool(keyA3)).toBe(true); // keyA3 is not active
188
- // keyA4 should be newly generated, not reused from the cleared pool
189
- // Note: Due to sequential key generation, it *might* match a previous key numerically
190
- // but the crucial part is it wasn't reused *from the pool*.
191
- });
192
- it("should not affect active keys or stableId mappings", function () {
193
- var stableId = "stableClear";
194
- var keyA = keyManager.getKey("typeA", stableId);
195
- var keyB = keyManager.getKey("typeB", "item2");
196
- keyManager.recycleKey(keyB); // Put keyB in pool
197
- expect(keyManager.hasKeyInPool(keyA)).toBe(false);
198
- expect(keyManager.hasKeyInPool(keyB)).toBe(true);
199
- expect(keyManager.getKey("typeA", stableId)).toEqual(keyA); // Check stableId mapping
200
- keyManager.clearPool();
201
- expect(keyManager.hasKeyInPool(keyA)).toBe(false); // keyA still active
202
- expect(keyManager.hasKeyInPool(keyB)).toBe(true); // keyB still considered "in pool" (i.e., not active)
203
- expect(keyManager.getKey("typeA", stableId)).toEqual(keyA); // StableId mapping persists
204
- // Trying to get a key of type B should generate a new one
205
- var newKeyB = keyManager.getKey("typeB", "item3");
206
- expect(newKeyB).not.toEqual(keyB); // Because pool was cleared
207
- });
208
- });
209
- });
210
- //# sourceMappingURL=RecycleKeyManager.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RecycleKeyManager.test.js","sourceRoot":"","sources":["../../src/__tests__/RecycleKeyManager.test.ts"],"names":[],"mappings":";;AAAA,uEAA0E;AAE1E,QAAQ,CAAC,uBAAuB,EAAE;IAChC,IAAI,UAAiC,CAAC;IAEtC,UAAU,CAAC;QACT,4CAA4C;QAC5C,UAAU,GAAG,IAAI,yCAAqB,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,aAAa,EAAE;QACtB,EAAE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AAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAClD,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjD,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,yBAAyB;YAErF,UAAU,CAAC,SAAS,EAAE,CAAC;YAEvB,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,oBAAoB;YACvE,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,qDAAqD;YACvG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,4BAA4B;YAExF,0DAA0D;YAC1D,IAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACpD,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,2BAA2B;QAChE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,82 +0,0 @@
1
- export interface RecycleKeyManager {
2
- /**
3
- * Retrieves a unique key for an item type, maintaining a separate pool for each type.
4
- * If a stableId is provided and exists, returns the associated key.
5
- * Otherwise, generates a new key or reuses one from the pool.
6
- * @param itemType - The type/category of the item (e.g., 'header', 'product', 'footer')
7
- * @param stableId - Optional unique identifier for stable item tracking
8
- * @param currentKey - Optional current key to maintain if it exists in the pool
9
- * @returns A unique key for the item
10
- */
11
- getKey: (itemType: string, stableId: string, currentKey?: string) => string;
12
- /**
13
- * Recycles a key back into its item type's pool when the associated view is no longer visible.
14
- * This allows the key to be reused for new items of the same type.
15
- * @param key - The key to be recycled back into the pool
16
- */
17
- recycleKey: (key: string) => void;
18
- /**
19
- * Checks if a key is currently available in the recycling pool (not in use).
20
- * @param key - The key to check
21
- * @returns True if the key is available in the pool, false otherwise
22
- */
23
- hasKeyInPool: (key: string) => boolean;
24
- /**
25
- * Clears all recycled keys from the pool, resetting the recycling system.
26
- * This is useful when the list needs to be completely reset.
27
- */
28
- clearPool: () => void;
29
- }
30
- export declare class RecycleKeyManagerImpl implements RecycleKeyManager {
31
- private maxItems;
32
- private keyPools;
33
- private keyMap;
34
- private stableIdMap;
35
- private keyCounter;
36
- /**
37
- * Creates a new RecycleKeyManager with a specified maximum number of items.
38
- * @param maxItems - Maximum number of unique keys that can be active simultaneously.
39
- * Defaults to Number.MAX_SAFE_INTEGER if not specified.
40
- */
41
- constructor(maxItems?: number);
42
- /**
43
- * Gets a key for the specified item type, prioritizing stable ID associations.
44
- * If a stable ID exists, returns its associated key. Otherwise, either reuses
45
- * a key from the pool or generates a new one.
46
- * @param itemType - The type/category of the item
47
- * @param stableId - Optional unique identifier for stable item tracking
48
- * @param currentKey - Optional current key to maintain if it exists in the pool
49
- * @returns A unique key for the item
50
- */
51
- getKey(itemType: string, stableId: string, currentKey?: string): string;
52
- /**
53
- * Recycles a key by adding it back to its item type's pool and cleaning up
54
- * associated mappings. This should be called when a view is no longer visible.
55
- * @param key - The key to be recycled
56
- */
57
- recycleKey(key: string): void;
58
- /**
59
- * Checks if a key is currently available in the recycling pool.
60
- * @param key - The key to check
61
- * @returns True if the key is available in the pool, false otherwise
62
- */
63
- hasKeyInPool(key: string): boolean;
64
- /**
65
- * Clears all recycled keys from the pool, effectively resetting the recycling system.
66
- * This operation does not affect currently active keys.
67
- */
68
- clearPool(): void;
69
- /**
70
- * Generates a unique sequential key using an internal counter.
71
- * @returns A unique key as a string
72
- */
73
- private generateKey;
74
- /**
75
- * Ensures the total number of active keys doesn't exceed the maximum limit.
76
- * If the limit is exceeded, recycles the oldest keys until within bounds.
77
- * Note: This operation may impact performance when dealing with large lists.
78
- * TODO: Check performance impact of this
79
- */
80
- private ensurePoolSize;
81
- }
82
- //# sourceMappingURL=RecycleKeyManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RecycleKeyManager.d.ts","sourceRoot":"","sources":["../../src/recyclerview/RecycleKeyManager.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;OAQG;IACH,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAE5E;;;;OAIG;IACH,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC;;;;OAIG;IACH,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAEvC;;;OAGG;IACH,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,qBAAa,qBAAsB,YAAW,iBAAiB;IAE7D,OAAO,CAAC,QAAQ,CAAS;IAGzB,OAAO,CAAC,QAAQ,CAA2B;IAG3C,OAAO,CAAC,MAAM,CAAuD;IAGrE,OAAO,CAAC,WAAW,CAAsB;IAGzC,OAAO,CAAC,UAAU,CAAS;IAE3B;;;;OAIG;gBACS,QAAQ,GAAE,MAAgC;IAQtD;;;;;;;;OAQG;IACI,MAAM,CACX,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM;IAsCT;;;;OAIG;IACI,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAwBpC;;;;OAIG;IACI,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzC;;;OAGG;IACI,SAAS;IAIhB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAInB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;CAWvB"}
@@ -1,135 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RecycleKeyManagerImpl = void 0;
4
- var tslib_1 = require("tslib");
5
- var RecycleKeyManagerImpl = /** @class */ (function () {
6
- /**
7
- * Creates a new RecycleKeyManager with a specified maximum number of items.
8
- * @param maxItems - Maximum number of unique keys that can be active simultaneously.
9
- * Defaults to Number.MAX_SAFE_INTEGER if not specified.
10
- */
11
- function RecycleKeyManagerImpl(maxItems) {
12
- if (maxItems === void 0) { maxItems = Number.MAX_SAFE_INTEGER; }
13
- this.maxItems = maxItems;
14
- this.keyPools = new Map();
15
- this.keyMap = new Map();
16
- this.stableIdMap = new Map();
17
- this.keyCounter = 0;
18
- }
19
- /**
20
- * Gets a key for the specified item type, prioritizing stable ID associations.
21
- * If a stable ID exists, returns its associated key. Otherwise, either reuses
22
- * a key from the pool or generates a new one.
23
- * @param itemType - The type/category of the item
24
- * @param stableId - Optional unique identifier for stable item tracking
25
- * @param currentKey - Optional current key to maintain if it exists in the pool
26
- * @returns A unique key for the item
27
- */
28
- RecycleKeyManagerImpl.prototype.getKey = function (itemType, stableId, currentKey) {
29
- // Return existing key if stableId is already mapped
30
- if (stableId && this.stableIdMap.has(stableId)) {
31
- return this.stableIdMap.get(stableId);
32
- }
33
- // Get or create the pool for this item type
34
- var pool = this.keyPools.get(itemType);
35
- if (!pool) {
36
- pool = new Set();
37
- this.keyPools.set(itemType, pool);
38
- }
39
- var key;
40
- // Reuse existing key from pool if available
41
- if (pool.size > 0) {
42
- key =
43
- currentKey && pool.has(currentKey)
44
- ? currentKey
45
- : pool.values().next().value;
46
- pool.delete(key);
47
- }
48
- else {
49
- // Generate new key if pool is empty
50
- key = this.generateKey();
51
- }
52
- // Update mappings with new key information
53
- this.keyMap.set(key, { itemType: itemType, stableId: stableId });
54
- if (stableId) {
55
- this.stableIdMap.set(stableId, key);
56
- }
57
- // Ensure we don't exceed the maximum number of active keys
58
- this.ensurePoolSize();
59
- return key;
60
- };
61
- /**
62
- * Recycles a key by adding it back to its item type's pool and cleaning up
63
- * associated mappings. This should be called when a view is no longer visible.
64
- * @param key - The key to be recycled
65
- */
66
- RecycleKeyManagerImpl.prototype.recycleKey = function (key) {
67
- var keyInfo = this.keyMap.get(key);
68
- if (!keyInfo) {
69
- return;
70
- }
71
- var itemType = keyInfo.itemType, stableId = keyInfo.stableId;
72
- // Clean up stable ID mapping if it exists
73
- if (stableId) {
74
- this.stableIdMap.delete(stableId);
75
- }
76
- // Add key back to its type's pool
77
- var pool = this.keyPools.get(itemType);
78
- if (!pool) {
79
- pool = new Set();
80
- this.keyPools.set(itemType, pool);
81
- }
82
- pool.add(key);
83
- this.keyMap.delete(key);
84
- };
85
- /**
86
- * Checks if a key is currently available in the recycling pool.
87
- * @param key - The key to check
88
- * @returns True if the key is available in the pool, false otherwise
89
- */
90
- RecycleKeyManagerImpl.prototype.hasKeyInPool = function (key) {
91
- return !this.keyMap.has(key);
92
- };
93
- /**
94
- * Clears all recycled keys from the pool, effectively resetting the recycling system.
95
- * This operation does not affect currently active keys.
96
- */
97
- RecycleKeyManagerImpl.prototype.clearPool = function () {
98
- this.keyPools.clear();
99
- };
100
- /**
101
- * Generates a unique sequential key using an internal counter.
102
- * @returns A unique key as a string
103
- */
104
- RecycleKeyManagerImpl.prototype.generateKey = function () {
105
- return (this.keyCounter++).toString();
106
- };
107
- /**
108
- * Ensures the total number of active keys doesn't exceed the maximum limit.
109
- * If the limit is exceeded, recycles the oldest keys until within bounds.
110
- * Note: This operation may impact performance when dealing with large lists.
111
- * TODO: Check performance impact of this
112
- */
113
- RecycleKeyManagerImpl.prototype.ensurePoolSize = function () {
114
- var e_1, _a;
115
- if (this.keyMap.size <= this.maxItems)
116
- return;
117
- var keysToRecycle = Array.from(this.keyMap.keys()).slice(0, this.keyMap.size - this.maxItems);
118
- try {
119
- for (var keysToRecycle_1 = tslib_1.__values(keysToRecycle), keysToRecycle_1_1 = keysToRecycle_1.next(); !keysToRecycle_1_1.done; keysToRecycle_1_1 = keysToRecycle_1.next()) {
120
- var key = keysToRecycle_1_1.value;
121
- this.recycleKey(key);
122
- }
123
- }
124
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
125
- finally {
126
- try {
127
- if (keysToRecycle_1_1 && !keysToRecycle_1_1.done && (_a = keysToRecycle_1.return)) _a.call(keysToRecycle_1);
128
- }
129
- finally { if (e_1) throw e_1.error; }
130
- }
131
- };
132
- return RecycleKeyManagerImpl;
133
- }());
134
- exports.RecycleKeyManagerImpl = RecycleKeyManagerImpl;
135
- //# sourceMappingURL=RecycleKeyManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RecycleKeyManager.js","sourceRoot":"","sources":["../../src/recyclerview/RecycleKeyManager.ts"],"names":[],"mappings":";;;;AAiCA;IAgBE;;;;OAIG;IACH,+BAAY,QAA0C;QAA1C,yBAAA,EAAA,WAAmB,MAAM,CAAC,gBAAgB;QACpD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;IACtB,CAAC;IAED;;;;;;;;OAQG;IACI,sCAAM,GAAb,UACE,QAAgB,EAChB,QAAgB,EAChB,UAAmB;QAEnB,oDAAoD;QACpD,IAAI,QAAQ,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/C,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;QACzC,CAAC;QAED,4CAA4C;QAC5C,IAAI,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAA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