react-native-nitro-list 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -44
- package/ios/HybridNitroList.swift +12 -14
- package/lib/commonjs/cell/CellKeyGenerator.js +21 -0
- package/lib/commonjs/cell/CellKeyGenerator.js.map +1 -0
- package/lib/commonjs/cell/CellRecycler.js +48 -40
- package/lib/commonjs/cell/CellRecycler.js.map +1 -1
- package/lib/commonjs/cell/createCell.js +21 -0
- package/lib/commonjs/cell/createCell.js.map +1 -0
- package/lib/commonjs/cell/index.js +20 -0
- package/lib/commonjs/cell/index.js.map +1 -0
- package/lib/commonjs/getVisibleIndices.js.map +1 -1
- package/lib/commonjs/hooks/usePersistentCallback.js +36 -0
- package/lib/commonjs/hooks/usePersistentCallback.js.map +1 -0
- package/lib/commonjs/index.js +31 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/layout/MutableLinearLayout.js +78 -39
- package/lib/commonjs/layout/MutableLinearLayout.js.map +1 -1
- package/lib/commonjs/layout/constants/layoutDefaults.js +19 -0
- package/lib/commonjs/layout/constants/layoutDefaults.js.map +1 -0
- package/lib/commonjs/layout/index.js +0 -18
- package/lib/commonjs/layout/index.js.map +1 -1
- package/lib/commonjs/native/NitroListView.js +20 -0
- package/lib/commonjs/native/NitroListView.js.map +1 -0
- package/lib/commonjs/recycler/CellPool.js +33 -0
- package/lib/commonjs/recycler/CellPool.js.map +1 -0
- package/lib/commonjs/recycler/NitroList.js +223 -0
- package/lib/commonjs/recycler/NitroList.js.map +1 -0
- package/lib/commonjs/scroll/useScrollVelocity.js +20 -0
- package/lib/commonjs/scroll/useScrollVelocity.js.map +1 -0
- package/lib/commonjs/{native/NitroList.types.js → specs/NitroList.nitro.js} +1 -1
- package/lib/commonjs/{layout/LayoutProvider.js.map → specs/NitroList.nitro.js.map} +1 -1
- package/lib/commonjs/types/Axis.js +2 -0
- package/lib/{module/layout/LayoutProvider.js.map → commonjs/types/Axis.js.map} +1 -1
- package/lib/commonjs/types/CellKey.js +2 -0
- package/lib/commonjs/{layout/LayoutRectangle.js.map → types/CellKey.js.map} +1 -1
- package/lib/commonjs/types/CellType.js +27 -0
- package/lib/commonjs/types/CellType.js.map +1 -0
- package/lib/commonjs/types/VisibleRange.js +2 -0
- package/lib/commonjs/{native/NitroList.types.js.map → types/VisibleRange.js.map} +1 -1
- package/lib/commonjs/{RecyclerList.types.js → types/VisibleRangeInput.js} +1 -1
- package/lib/commonjs/types/VisibleRangeInput.js.map +1 -0
- package/lib/commonjs/types/index.js +13 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/types/layout/LayoutRect.js +2 -0
- package/lib/commonjs/types/layout/LayoutRect.js.map +1 -0
- package/lib/commonjs/{specs/nitro-layout-engine.nitro.js → types/layout/LinearLayoutInput.js} +1 -1
- package/lib/commonjs/types/layout/LinearLayoutInput.js.map +1 -0
- package/lib/commonjs/types/layout/MainAxisPadding.js +26 -0
- package/lib/commonjs/types/layout/MainAxisPadding.js.map +1 -0
- package/lib/commonjs/types/layout/index.js +2 -0
- package/lib/commonjs/types/layout/index.js.map +1 -0
- package/lib/commonjs/types/recycler/CellPool.js +42 -0
- package/lib/commonjs/types/recycler/CellPool.js.map +1 -0
- package/lib/commonjs/{layout/LayoutProvider.js → types/recycler/NitroListProps.js} +1 -1
- package/lib/commonjs/types/recycler/NitroListProps.js.map +1 -0
- package/lib/commonjs/types/recycler/RecyclerCell.js +6 -0
- package/lib/commonjs/types/recycler/RecyclerCell.js.map +1 -0
- package/lib/commonjs/types/recycler/RecyclerItemRenderer.js +6 -0
- package/lib/commonjs/types/recycler/RecyclerItemRenderer.js.map +1 -0
- package/lib/commonjs/types/recycler/index.js +2 -0
- package/lib/commonjs/types/recycler/index.js.map +1 -0
- package/lib/commonjs/types/scroll/ScrollMetrics.js +6 -0
- package/lib/commonjs/types/scroll/ScrollMetrics.js.map +1 -0
- package/lib/commonjs/types/scroll/index.js +2 -0
- package/lib/commonjs/types/scroll/index.js.map +1 -0
- package/lib/commonjs/windowing/computeVisibleItemRange.js +61 -0
- package/lib/commonjs/windowing/computeVisibleItemRange.js.map +1 -0
- package/lib/commonjs/windowing/index.js +3 -3
- package/lib/commonjs/windowing/index.js.map +1 -1
- package/lib/module/cell/CellKeyGenerator.js +16 -0
- package/lib/module/cell/CellKeyGenerator.js.map +1 -0
- package/lib/module/cell/CellRecycler.js +48 -39
- package/lib/module/cell/CellRecycler.js.map +1 -1
- package/lib/module/cell/createCell.js +17 -0
- package/lib/module/cell/createCell.js.map +1 -0
- package/lib/module/cell/index.js +7 -0
- package/lib/module/cell/index.js.map +1 -0
- package/lib/module/getVisibleIndices.js.map +1 -1
- package/lib/module/hooks/usePersistentCallback.js +33 -0
- package/lib/module/hooks/usePersistentCallback.js.map +1 -0
- package/lib/module/index.js +5 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/layout/MutableLinearLayout.js +78 -38
- package/lib/module/layout/MutableLinearLayout.js.map +1 -1
- package/lib/module/layout/constants/layoutDefaults.js +15 -0
- package/lib/module/layout/constants/layoutDefaults.js.map +1 -0
- package/lib/module/layout/index.js +0 -3
- package/lib/module/layout/index.js.map +1 -1
- package/lib/module/native/NitroListView.js +17 -0
- package/lib/module/native/NitroListView.js.map +1 -0
- package/lib/module/recycler/CellPool.js +28 -0
- package/lib/module/recycler/CellPool.js.map +1 -0
- package/lib/module/recycler/NitroList.js +220 -0
- package/lib/module/recycler/NitroList.js.map +1 -0
- package/lib/module/scroll/useScrollVelocity.js +16 -0
- package/lib/module/scroll/useScrollVelocity.js.map +1 -0
- package/lib/module/specs/NitroList.nitro.js +4 -0
- package/lib/module/specs/NitroList.nitro.js.map +1 -0
- package/lib/module/types/Axis.js +2 -0
- package/lib/module/types/Axis.js.map +1 -0
- package/lib/module/types/CellKey.js +2 -0
- package/lib/module/types/CellKey.js.map +1 -0
- package/lib/module/types/CellType.js +22 -0
- package/lib/module/types/CellType.js.map +1 -0
- package/lib/module/types/VisibleRange.js +2 -0
- package/lib/module/types/VisibleRange.js.map +1 -0
- package/lib/module/types/VisibleRangeInput.js +4 -0
- package/lib/module/types/VisibleRangeInput.js.map +1 -0
- package/lib/module/types/index.js +4 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/layout/LayoutRect.js +2 -0
- package/lib/module/types/layout/LayoutRect.js.map +1 -0
- package/lib/module/types/layout/LinearLayoutInput.js +4 -0
- package/lib/module/types/layout/LinearLayoutInput.js.map +1 -0
- package/lib/module/types/layout/MainAxisPadding.js +22 -0
- package/lib/module/types/layout/MainAxisPadding.js.map +1 -0
- package/lib/module/types/layout/index.js +2 -0
- package/lib/module/types/layout/index.js.map +1 -0
- package/lib/module/types/recycler/CellPool.js +37 -0
- package/lib/module/types/recycler/CellPool.js.map +1 -0
- package/lib/module/types/recycler/NitroListProps.js +4 -0
- package/lib/module/types/recycler/NitroListProps.js.map +1 -0
- package/lib/module/types/recycler/RecyclerCell.js +4 -0
- package/lib/module/types/recycler/RecyclerCell.js.map +1 -0
- package/lib/module/types/recycler/RecyclerItemRenderer.js +4 -0
- package/lib/module/types/recycler/RecyclerItemRenderer.js.map +1 -0
- package/lib/module/types/recycler/index.js +2 -0
- package/lib/module/types/recycler/index.js.map +1 -0
- package/lib/module/types/scroll/ScrollMetrics.js +4 -0
- package/lib/module/types/scroll/ScrollMetrics.js.map +1 -0
- package/lib/module/types/scroll/index.js +2 -0
- package/lib/module/types/scroll/index.js.map +1 -0
- package/lib/module/windowing/computeVisibleItemRange.js +57 -0
- package/lib/module/windowing/computeVisibleItemRange.js.map +1 -0
- package/lib/module/windowing/index.js +1 -1
- package/lib/module/windowing/index.js.map +1 -1
- package/lib/typescript/src/cell/Cell.d.ts +13 -4
- package/lib/typescript/src/cell/Cell.d.ts.map +1 -1
- package/lib/typescript/src/cell/CellKeyGenerator.d.ts +11 -0
- package/lib/typescript/src/cell/CellKeyGenerator.d.ts.map +1 -0
- package/lib/typescript/src/cell/CellRecycler.d.ts +19 -11
- package/lib/typescript/src/cell/CellRecycler.d.ts.map +1 -1
- package/lib/typescript/src/cell/createCell.d.ts +7 -0
- package/lib/typescript/src/cell/createCell.d.ts.map +1 -0
- package/lib/typescript/src/cell/index.d.ts +4 -0
- package/lib/typescript/src/cell/index.d.ts.map +1 -0
- package/lib/typescript/src/getVisibleIndices.d.ts +2 -2
- package/lib/typescript/src/getVisibleIndices.d.ts.map +1 -1
- package/lib/typescript/src/hooks/usePersistentCallback.d.ts +16 -0
- package/lib/typescript/src/hooks/usePersistentCallback.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/layout/MutableLinearLayout.d.ts +45 -13
- package/lib/typescript/src/layout/MutableLinearLayout.d.ts.map +1 -1
- package/lib/typescript/src/layout/constants/layoutDefaults.d.ts +13 -0
- package/lib/typescript/src/layout/constants/layoutDefaults.d.ts.map +1 -0
- package/lib/typescript/src/layout/index.d.ts +1 -4
- package/lib/typescript/src/layout/index.d.ts.map +1 -1
- package/lib/typescript/src/native/NitroListView.d.ts +20 -0
- package/lib/typescript/src/native/NitroListView.d.ts.map +1 -0
- package/lib/typescript/src/recycler/CellPool.d.ts +11 -0
- package/lib/typescript/src/recycler/CellPool.d.ts.map +1 -0
- package/lib/typescript/src/recycler/NitroList.d.ts +4 -0
- package/lib/typescript/src/recycler/NitroList.d.ts.map +1 -0
- package/lib/typescript/src/scroll/useScrollVelocity.d.ts +2 -0
- package/lib/typescript/src/scroll/useScrollVelocity.d.ts.map +1 -0
- package/lib/typescript/src/specs/NitroList.nitro.d.ts +26 -0
- package/lib/typescript/src/specs/NitroList.nitro.d.ts.map +1 -0
- package/lib/typescript/src/types/Axis.d.ts +11 -0
- package/lib/typescript/src/types/Axis.d.ts.map +1 -0
- package/lib/typescript/src/types/CellKey.d.ts +2 -0
- package/lib/typescript/src/types/CellKey.d.ts.map +1 -0
- package/lib/typescript/src/types/CellType.d.ts +22 -0
- package/lib/typescript/src/types/CellType.d.ts.map +1 -0
- package/lib/typescript/src/types/VisibleRange.d.ts +10 -0
- package/lib/typescript/src/types/VisibleRange.d.ts.map +1 -0
- package/lib/typescript/src/types/VisibleRangeInput.d.ts +35 -0
- package/lib/typescript/src/types/VisibleRangeInput.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +8 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/lib/typescript/src/types/layout/LayoutRect.d.ts +15 -0
- package/lib/typescript/src/types/layout/LayoutRect.d.ts.map +1 -0
- package/lib/typescript/src/types/layout/LinearLayoutInput.d.ts +10 -0
- package/lib/typescript/src/types/layout/LinearLayoutInput.d.ts.map +1 -0
- package/lib/typescript/src/types/layout/MainAxisPadding.d.ts +20 -0
- package/lib/typescript/src/types/layout/MainAxisPadding.d.ts.map +1 -0
- package/lib/typescript/src/types/layout/index.d.ts +4 -0
- package/lib/typescript/src/types/layout/index.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/CellPool.d.ts +16 -0
- package/lib/typescript/src/types/recycler/CellPool.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/NitroListProps.d.ts +66 -0
- package/lib/typescript/src/types/recycler/NitroListProps.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/RecyclerCell.d.ts +12 -0
- package/lib/typescript/src/types/recycler/RecyclerCell.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/RecyclerItemRenderer.d.ts +12 -0
- package/lib/typescript/src/types/recycler/RecyclerItemRenderer.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/index.d.ts +4 -0
- package/lib/typescript/src/types/recycler/index.d.ts.map +1 -0
- package/lib/typescript/src/types/scroll/ScrollMetrics.d.ts +15 -0
- package/lib/typescript/src/types/scroll/ScrollMetrics.d.ts.map +1 -0
- package/lib/typescript/src/types/scroll/index.d.ts +2 -0
- package/lib/typescript/src/types/scroll/index.d.ts.map +1 -0
- package/lib/typescript/src/windowing/computeVisibleItemRange.d.ts +19 -0
- package/lib/typescript/src/windowing/computeVisibleItemRange.d.ts.map +1 -0
- package/lib/typescript/src/windowing/index.d.ts +1 -1
- package/lib/typescript/src/windowing/index.d.ts.map +1 -1
- package/nitro.json +5 -5
- package/nitrogen/generated/android/NitroList+autolinking.cmake +2 -2
- package/nitrogen/generated/android/NitroListOnLoad.cpp +2 -2
- package/nitrogen/generated/android/c++/{JHybridNitroLayoutEngineSpec.cpp → JHybridNitroListSpec.cpp} +15 -15
- package/nitrogen/generated/android/c++/{JHybridNitroLayoutEngineSpec.hpp → JHybridNitroListSpec.hpp} +11 -11
- package/nitrogen/generated/android/c++/{JLayoutRectangle.hpp → JItemLayout.hpp} +10 -10
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/{HybridNitroLayoutEngineSpec.kt → HybridNitroListSpec.kt} +7 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/{LayoutRectangle.kt → ItemLayout.kt} +5 -5
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.cpp +9 -9
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.hpp +27 -27
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Umbrella.hpp +8 -8
- package/nitrogen/generated/ios/c++/{HybridNitroLayoutEngineSpecSwift.cpp → HybridNitroListSpecSwift.cpp} +2 -2
- package/nitrogen/generated/ios/c++/{HybridNitroLayoutEngineSpecSwift.hpp → HybridNitroListSpecSwift.hpp} +16 -16
- package/nitrogen/generated/ios/swift/HybridNitroListSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/{HybridNitroLayoutEngineSpec_cxx.swift → HybridNitroListSpec_cxx.swift} +23 -23
- package/nitrogen/generated/ios/swift/{LayoutRectangle.swift → ItemLayout.swift} +5 -5
- package/nitrogen/generated/shared/c++/{HybridNitroLayoutEngineSpec.cpp → HybridNitroListSpec.cpp} +4 -4
- package/nitrogen/generated/shared/c++/{HybridNitroLayoutEngineSpec.hpp → HybridNitroListSpec.hpp} +13 -13
- package/nitrogen/generated/shared/c++/{LayoutRectangle.hpp → ItemLayout.hpp} +11 -11
- package/package.json +5 -5
- package/src/cell/Cell.ts +13 -4
- package/src/cell/CellKeyGenerator.ts +17 -0
- package/src/cell/CellRecycler.ts +53 -43
- package/src/cell/createCell.ts +15 -0
- package/src/cell/index.ts +5 -0
- package/src/getVisibleIndices.ts +4 -2
- package/src/hooks/usePersistentCallback.ts +37 -0
- package/src/index.ts +7 -2
- package/src/layout/MutableLinearLayout.ts +91 -58
- package/src/layout/constants/layoutDefaults.ts +12 -0
- package/src/layout/index.ts +1 -4
- package/src/native/NitroListView.ts +22 -0
- package/src/recycler/CellPool.ts +33 -0
- package/src/recycler/NitroList.tsx +317 -0
- package/src/scroll/useScrollVelocity.ts +16 -0
- package/src/specs/NitroList.nitro.ts +29 -0
- package/src/types/Axis.ts +10 -0
- package/src/types/CellKey.ts +2 -0
- package/src/types/CellType.ts +9 -0
- package/src/types/VisibleRange.ts +9 -0
- package/src/types/VisibleRangeInput.ts +39 -0
- package/src/types/index.ts +15 -0
- package/src/types/layout/LayoutRect.ts +14 -0
- package/src/types/layout/LinearLayoutInput.ts +12 -0
- package/src/types/layout/MainAxisPadding.ts +23 -0
- package/src/types/layout/index.ts +3 -0
- package/src/types/recycler/CellPool.ts +45 -0
- package/src/types/recycler/NitroListProps.ts +74 -0
- package/src/types/recycler/RecyclerCell.ts +12 -0
- package/src/types/recycler/RecyclerItemRenderer.ts +12 -0
- package/src/types/recycler/index.ts +3 -0
- package/src/types/scroll/ScrollMetrics.ts +18 -0
- package/src/types/scroll/index.ts +1 -0
- package/src/windowing/computeVisibleItemRange.ts +82 -0
- package/src/windowing/index.ts +1 -1
- package/lib/commonjs/NitroList.js +0 -9
- package/lib/commonjs/NitroList.js.map +0 -1
- package/lib/commonjs/RecyclerList.internal.js +0 -25
- package/lib/commonjs/RecyclerList.internal.js.map +0 -1
- package/lib/commonjs/RecyclerList.js +0 -171
- package/lib/commonjs/RecyclerList.js.map +0 -1
- package/lib/commonjs/RecyclerList.types.js.map +0 -1
- package/lib/commonjs/cell/StableKey.js +0 -10
- package/lib/commonjs/cell/StableKey.js.map +0 -1
- package/lib/commonjs/hooks/useCellRenderer.js +0 -62
- package/lib/commonjs/hooks/useCellRenderer.js.map +0 -1
- package/lib/commonjs/hooks/useStableCallback.js +0 -13
- package/lib/commonjs/hooks/useStableCallback.js.map +0 -1
- package/lib/commonjs/layout/EstimatedLayoutProvider.js +0 -30
- package/lib/commonjs/layout/EstimatedLayoutProvider.js.map +0 -1
- package/lib/commonjs/layout/LayoutEngine.js +0 -21
- package/lib/commonjs/layout/LayoutEngine.js.map +0 -1
- package/lib/commonjs/layout/LayoutRectangle.js +0 -2
- package/lib/commonjs/native/NitroLayoutEngine.js +0 -9
- package/lib/commonjs/native/NitroLayoutEngine.js.map +0 -1
- package/lib/commonjs/native/NitroRecyclerView.js +0 -9
- package/lib/commonjs/native/NitroRecyclerView.js.map +0 -1
- package/lib/commonjs/specs/nitro-layout-engine.nitro.js.map +0 -1
- package/lib/commonjs/viewability/ViewabilityHelper.js +0 -121
- package/lib/commonjs/viewability/ViewabilityHelper.js.map +0 -1
- package/lib/commonjs/windowing/findVisibleIndexRange.js +0 -48
- package/lib/commonjs/windowing/findVisibleIndexRange.js.map +0 -1
- package/lib/module/NitroList.js +0 -5
- package/lib/module/NitroList.js.map +0 -1
- package/lib/module/RecyclerList.internal.js +0 -22
- package/lib/module/RecyclerList.internal.js.map +0 -1
- package/lib/module/RecyclerList.js +0 -166
- package/lib/module/RecyclerList.js.map +0 -1
- package/lib/module/RecyclerList.types.js +0 -4
- package/lib/module/RecyclerList.types.js.map +0 -1
- package/lib/module/cell/StableKey.js +0 -6
- package/lib/module/cell/StableKey.js.map +0 -1
- package/lib/module/hooks/useCellRenderer.js +0 -58
- package/lib/module/hooks/useCellRenderer.js.map +0 -1
- package/lib/module/hooks/useStableCallback.js +0 -9
- package/lib/module/hooks/useStableCallback.js.map +0 -1
- package/lib/module/layout/EstimatedLayoutProvider.js +0 -25
- package/lib/module/layout/EstimatedLayoutProvider.js.map +0 -1
- package/lib/module/layout/LayoutEngine.js +0 -17
- package/lib/module/layout/LayoutEngine.js.map +0 -1
- package/lib/module/layout/LayoutProvider.js +0 -4
- package/lib/module/layout/LayoutRectangle.js +0 -2
- package/lib/module/layout/LayoutRectangle.js.map +0 -1
- package/lib/module/native/NitroLayoutEngine.js +0 -5
- package/lib/module/native/NitroLayoutEngine.js.map +0 -1
- package/lib/module/native/NitroList.types.js +0 -4
- package/lib/module/native/NitroList.types.js.map +0 -1
- package/lib/module/native/NitroRecyclerView.js +0 -5
- package/lib/module/native/NitroRecyclerView.js.map +0 -1
- package/lib/module/specs/nitro-layout-engine.nitro.js +0 -4
- package/lib/module/specs/nitro-layout-engine.nitro.js.map +0 -1
- package/lib/module/viewability/ViewabilityHelper.js +0 -116
- package/lib/module/viewability/ViewabilityHelper.js.map +0 -1
- package/lib/module/windowing/findVisibleIndexRange.js +0 -44
- package/lib/module/windowing/findVisibleIndexRange.js.map +0 -1
- package/lib/typescript/src/NitroList.d.ts +0 -5
- package/lib/typescript/src/NitroList.d.ts.map +0 -1
- package/lib/typescript/src/RecyclerList.d.ts +0 -26
- package/lib/typescript/src/RecyclerList.d.ts.map +0 -1
- package/lib/typescript/src/RecyclerList.internal.d.ts +0 -9
- package/lib/typescript/src/RecyclerList.internal.d.ts.map +0 -1
- package/lib/typescript/src/RecyclerList.types.d.ts +0 -18
- package/lib/typescript/src/RecyclerList.types.d.ts.map +0 -1
- package/lib/typescript/src/__tests__/windowing/findVisibleIndexRange.test.d.ts +0 -2
- package/lib/typescript/src/__tests__/windowing/findVisibleIndexRange.test.d.ts.map +0 -1
- package/lib/typescript/src/cell/StableKey.d.ts +0 -2
- package/lib/typescript/src/cell/StableKey.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useCellRenderer.d.ts +0 -19
- package/lib/typescript/src/hooks/useCellRenderer.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useStableCallback.d.ts +0 -2
- package/lib/typescript/src/hooks/useStableCallback.d.ts.map +0 -1
- package/lib/typescript/src/layout/EstimatedLayoutProvider.d.ts +0 -15
- package/lib/typescript/src/layout/EstimatedLayoutProvider.d.ts.map +0 -1
- package/lib/typescript/src/layout/LayoutEngine.d.ts +0 -10
- package/lib/typescript/src/layout/LayoutEngine.d.ts.map +0 -1
- package/lib/typescript/src/layout/LayoutProvider.d.ts +0 -16
- package/lib/typescript/src/layout/LayoutProvider.d.ts.map +0 -1
- package/lib/typescript/src/layout/LayoutRectangle.d.ts +0 -11
- package/lib/typescript/src/layout/LayoutRectangle.d.ts.map +0 -1
- package/lib/typescript/src/native/NitroLayoutEngine.d.ts +0 -3
- package/lib/typescript/src/native/NitroLayoutEngine.d.ts.map +0 -1
- package/lib/typescript/src/native/NitroList.types.d.ts +0 -9
- package/lib/typescript/src/native/NitroList.types.d.ts.map +0 -1
- package/lib/typescript/src/native/NitroRecyclerView.d.ts +0 -5
- package/lib/typescript/src/native/NitroRecyclerView.d.ts.map +0 -1
- package/lib/typescript/src/specs/nitro-layout-engine.nitro.d.ts +0 -14
- package/lib/typescript/src/specs/nitro-layout-engine.nitro.d.ts.map +0 -1
- package/lib/typescript/src/viewability/ViewabilityHelper.d.ts +0 -50
- package/lib/typescript/src/viewability/ViewabilityHelper.d.ts.map +0 -1
- package/lib/typescript/src/windowing/findVisibleIndexRange.d.ts +0 -11
- package/lib/typescript/src/windowing/findVisibleIndexRange.d.ts.map +0 -1
- package/nitrogen/generated/ios/swift/HybridNitroLayoutEngineSpec.swift +0 -56
- package/src/NitroList.ts +0 -8
- package/src/RecyclerList.internal.ts +0 -38
- package/src/RecyclerList.tsx +0 -252
- package/src/RecyclerList.types.ts +0 -24
- package/src/__tests__/windowing/findVisibleIndexRange.test.ts +0 -55
- package/src/cell/StableKey.ts +0 -6
- package/src/hooks/useCellRenderer.ts +0 -86
- package/src/hooks/useStableCallback.ts +0 -13
- package/src/layout/EstimatedLayoutProvider.ts +0 -35
- package/src/layout/LayoutEngine.ts +0 -21
- package/src/layout/LayoutProvider.ts +0 -17
- package/src/layout/LayoutRectangle.ts +0 -10
- package/src/native/NitroLayoutEngine.ts +0 -7
- package/src/native/NitroList.types.ts +0 -12
- package/src/native/NitroRecyclerView.ts +0 -8
- package/src/specs/nitro-layout-engine.nitro.ts +0 -17
- package/src/viewability/ViewabilityHelper.ts +0 -130
- package/src/windowing/findVisibleIndexRange.ts +0 -60
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useRef, useEffect, useState } from 'react';
|
|
4
|
+
import { ScrollView, View, StyleSheet } from 'react-native';
|
|
5
|
+
import { MutableLinearLayout } from '../layout/MutableLinearLayout';
|
|
6
|
+
import { computeVisibleItemRange } from '../windowing';
|
|
7
|
+
import { CellPool } from './CellPool';
|
|
8
|
+
|
|
9
|
+
/* ========================================================= */
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
const DEFAULT_VIEWPORT_SIZE = 800;
|
|
12
|
+
const DEFAULT_ITEM_SIZE = 60;
|
|
13
|
+
const SCROLL_EVENT_THROTTLE = 16;
|
|
14
|
+
|
|
15
|
+
/* ========================================================= */
|
|
16
|
+
/* Internal (mutable) cell */
|
|
17
|
+
/* ========================================================= */
|
|
18
|
+
|
|
19
|
+
/* ========================================================= */
|
|
20
|
+
/* NitroList */
|
|
21
|
+
/* ========================================================= */
|
|
22
|
+
|
|
23
|
+
export default function NitroList(props) {
|
|
24
|
+
const {
|
|
25
|
+
data,
|
|
26
|
+
renderItem,
|
|
27
|
+
getCellType,
|
|
28
|
+
scrollDirection = 'vertical',
|
|
29
|
+
bufferRatio = 1.3,
|
|
30
|
+
containerCrossAxisSize,
|
|
31
|
+
itemMainAxisSizes,
|
|
32
|
+
padding = {
|
|
33
|
+
start: 0,
|
|
34
|
+
end: 0
|
|
35
|
+
},
|
|
36
|
+
itemSpacing
|
|
37
|
+
} = props;
|
|
38
|
+
const isVertical = scrollDirection === 'vertical';
|
|
39
|
+
const [, forceRender] = useState(0);
|
|
40
|
+
const DEBUG = true;
|
|
41
|
+
|
|
42
|
+
/* ======================================================= */
|
|
43
|
+
/* Layout engine (recomputed when signature changes) */
|
|
44
|
+
/* ======================================================= */
|
|
45
|
+
|
|
46
|
+
const layoutEngineRef = useRef(null);
|
|
47
|
+
const layoutSignatureRef = useRef('');
|
|
48
|
+
const layoutSignature = [scrollDirection, containerCrossAxisSize, data.length, itemMainAxisSizes, padding.start, padding.end, itemSpacing ?? 'none'].join('|');
|
|
49
|
+
if (layoutEngineRef.current === null || layoutSignatureRef.current !== layoutSignature) {
|
|
50
|
+
const engine = new MutableLinearLayout(scrollDirection);
|
|
51
|
+
engine.compute({
|
|
52
|
+
crossAxisSize: containerCrossAxisSize,
|
|
53
|
+
itemMainAxisSizes,
|
|
54
|
+
padding,
|
|
55
|
+
itemSpacing
|
|
56
|
+
});
|
|
57
|
+
layoutEngineRef.current = engine;
|
|
58
|
+
layoutSignatureRef.current = layoutSignature;
|
|
59
|
+
}
|
|
60
|
+
const layouts = layoutEngineRef.current.getLayouts();
|
|
61
|
+
const contentSize = layoutEngineRef.current.getContentSize();
|
|
62
|
+
|
|
63
|
+
/* ======================================================= */
|
|
64
|
+
/* Scroll metrics */
|
|
65
|
+
/* ======================================================= */
|
|
66
|
+
|
|
67
|
+
const scrollOffsetRef = useRef(0);
|
|
68
|
+
const viewportSizeRef = useRef(DEFAULT_VIEWPORT_SIZE);
|
|
69
|
+
|
|
70
|
+
/* ======================================================= */
|
|
71
|
+
/* Cell pool */
|
|
72
|
+
/* ======================================================= */
|
|
73
|
+
|
|
74
|
+
const cellPoolRef = useRef(new CellPool());
|
|
75
|
+
const activeCellsRef = useRef([]);
|
|
76
|
+
const nextKeyRef = useRef(0);
|
|
77
|
+
const createCell = type => ({
|
|
78
|
+
key: nextKeyRef.current++,
|
|
79
|
+
type,
|
|
80
|
+
index: -1,
|
|
81
|
+
active: false
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
/* ======================================================= */
|
|
85
|
+
/* Visible window coordination */
|
|
86
|
+
/* ======================================================= */
|
|
87
|
+
|
|
88
|
+
const updateVisibleCells = () => {
|
|
89
|
+
const range = computeVisibleItemRange({
|
|
90
|
+
layouts,
|
|
91
|
+
offset: scrollOffsetRef.current,
|
|
92
|
+
viewportSize: viewportSizeRef.current,
|
|
93
|
+
buffer: viewportSizeRef.current * bufferRatio,
|
|
94
|
+
isVertical
|
|
95
|
+
});
|
|
96
|
+
if (range === null) return;
|
|
97
|
+
if (DEBUG) {
|
|
98
|
+
console.log('[NitroList] range:', range.startIndex, range.endIndex);
|
|
99
|
+
}
|
|
100
|
+
const active = activeCellsRef.current;
|
|
101
|
+
|
|
102
|
+
// 1. Mark all inactive
|
|
103
|
+
for (const cell of active) {
|
|
104
|
+
cell.active = false;
|
|
105
|
+
}
|
|
106
|
+
let writeIndex = 0;
|
|
107
|
+
|
|
108
|
+
// 2. Activate visible range
|
|
109
|
+
for (let index = range.startIndex; index <= range.endIndex; index++) {
|
|
110
|
+
const item = data[index];
|
|
111
|
+
if (item === undefined) continue;
|
|
112
|
+
const type = getCellType(item, index);
|
|
113
|
+
|
|
114
|
+
// Seed pool once per type
|
|
115
|
+
if (!cellPoolRef.current.hasType(type)) {
|
|
116
|
+
const maxCells = Math.ceil(viewportSizeRef.current / DEFAULT_ITEM_SIZE * bufferRatio) + 2;
|
|
117
|
+
cellPoolRef.current.registerType(type, maxCells);
|
|
118
|
+
for (let i = 0; i < maxCells; i++) {
|
|
119
|
+
cellPoolRef.current.release(createCell(type));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
let cell = cellPoolRef.current.acquire(type);
|
|
123
|
+
if (cell === null) {
|
|
124
|
+
const reusable = active.find(c => !c.active && c.type === type);
|
|
125
|
+
cell = reusable ?? createCell(type);
|
|
126
|
+
}
|
|
127
|
+
cell.index = index;
|
|
128
|
+
cell.active = true;
|
|
129
|
+
active[writeIndex++] = cell;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// 3. Recycle unused cells
|
|
133
|
+
for (let i = writeIndex; i < active.length; i++) {
|
|
134
|
+
const cell = active[i];
|
|
135
|
+
if (cell === undefined) continue;
|
|
136
|
+
cell.index = -1;
|
|
137
|
+
cell.active = false;
|
|
138
|
+
cellPoolRef.current.release(cell);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// 4. Compact once
|
|
142
|
+
if (active.length !== writeIndex) {
|
|
143
|
+
active.length = writeIndex;
|
|
144
|
+
forceRender(v => v + 1);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/* ======================================================= */
|
|
149
|
+
/* Handlers */
|
|
150
|
+
/* ======================================================= */
|
|
151
|
+
|
|
152
|
+
const onScroll = e => {
|
|
153
|
+
scrollOffsetRef.current = isVertical ? e.nativeEvent.contentOffset.y : e.nativeEvent.contentOffset.x;
|
|
154
|
+
updateVisibleCells();
|
|
155
|
+
};
|
|
156
|
+
const onLayout = e => {
|
|
157
|
+
viewportSizeRef.current = isVertical ? e.nativeEvent.layout.height : e.nativeEvent.layout.width;
|
|
158
|
+
updateVisibleCells();
|
|
159
|
+
};
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
updateVisibleCells();
|
|
162
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
163
|
+
}, []);
|
|
164
|
+
if (DEBUG) {
|
|
165
|
+
console.log('[NitroList] layouts:', layouts.length);
|
|
166
|
+
console.log('[NitroList] contentSize:', contentSize);
|
|
167
|
+
console.log('[NitroList] data.length:', data.length);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* ======================================================= */
|
|
171
|
+
/* Render */
|
|
172
|
+
/* ======================================================= */
|
|
173
|
+
|
|
174
|
+
return /*#__PURE__*/_jsx(ScrollView, {
|
|
175
|
+
onScroll: onScroll,
|
|
176
|
+
onLayout: onLayout,
|
|
177
|
+
horizontal: !isVertical,
|
|
178
|
+
scrollEventThrottle: SCROLL_EVENT_THROTTLE,
|
|
179
|
+
removeClippedSubviews: true,
|
|
180
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
181
|
+
style: isVertical ? {
|
|
182
|
+
height: contentSize
|
|
183
|
+
} : {
|
|
184
|
+
width: contentSize
|
|
185
|
+
},
|
|
186
|
+
children: activeCellsRef.current.map(cell => {
|
|
187
|
+
const layout = layouts[cell.index];
|
|
188
|
+
const item = data[cell.index];
|
|
189
|
+
if (layout === undefined || item === undefined) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
return /*#__PURE__*/_jsx(View, {
|
|
193
|
+
style: [styles.cell, isVertical ? {
|
|
194
|
+
top: layout.y,
|
|
195
|
+
height: layout.height,
|
|
196
|
+
width: layout.width
|
|
197
|
+
} : {
|
|
198
|
+
left: layout.x,
|
|
199
|
+
width: layout.width,
|
|
200
|
+
height: layout.height
|
|
201
|
+
}],
|
|
202
|
+
children: renderItem({
|
|
203
|
+
item,
|
|
204
|
+
index: cell.index,
|
|
205
|
+
cell
|
|
206
|
+
})
|
|
207
|
+
}, cell.key);
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* ========================================================= */
|
|
214
|
+
|
|
215
|
+
const styles = StyleSheet.create({
|
|
216
|
+
cell: {
|
|
217
|
+
position: 'absolute'
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
//# sourceMappingURL=NitroList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useRef","useEffect","useState","ScrollView","View","StyleSheet","MutableLinearLayout","computeVisibleItemRange","CellPool","jsx","_jsx","DEFAULT_VIEWPORT_SIZE","DEFAULT_ITEM_SIZE","SCROLL_EVENT_THROTTLE","NitroList","props","data","renderItem","getCellType","scrollDirection","bufferRatio","containerCrossAxisSize","itemMainAxisSizes","padding","start","end","itemSpacing","isVertical","forceRender","DEBUG","layoutEngineRef","layoutSignatureRef","layoutSignature","length","join","current","engine","compute","crossAxisSize","layouts","getLayouts","contentSize","getContentSize","scrollOffsetRef","viewportSizeRef","cellPoolRef","activeCellsRef","nextKeyRef","createCell","type","key","index","active","updateVisibleCells","range","offset","viewportSize","buffer","console","log","startIndex","endIndex","cell","writeIndex","item","undefined","hasType","maxCells","Math","ceil","registerType","i","release","acquire","reusable","find","c","v","onScroll","e","nativeEvent","contentOffset","y","x","onLayout","layout","height","width","horizontal","scrollEventThrottle","removeClippedSubviews","children","style","map","styles","top","left","create","position"],"sourceRoot":"../../../src","sources":["recycler/NitroList.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC1D,SACEC,UAAU,EACVC,IAAI,EACJC,UAAU,QAIL,cAAc;AAOrB,SAASC,mBAAmB,QAAQ,+BAA+B;AACnE,SAASC,uBAAuB,QAAQ,cAAc;AACtD,SAASC,QAAQ,QAAQ,YAAY;;AAErC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEA,MAAMC,qBAAqB,GAAG,GAAG;AACjC,MAAMC,iBAAiB,GAAG,EAAE;AAC5B,MAAMC,qBAAqB,GAAG,EAAE;;AAEhC;AACA;AACA;;AAMA;AACA;AACA;;AAEA,eAAe,SAASC,SAASA,CAC/BC,KAAwB,EACJ;EACpB,MAAM;IACJC,IAAI;IACJC,UAAU;IACVC,WAAW;IACXC,eAAe,GAAG,UAAU;IAC5BC,WAAW,GAAG,GAAG;IACjBC,sBAAsB;IACtBC,iBAAiB;IACjBC,OAAO,GAAG;MAAEC,KAAK,EAAE,CAAC;MAAEC,GAAG,EAAE;IAAE,CAAC;IAC9BC;EACF,CAAC,GAAGX,KAAK;EAET,MAAMY,UAAU,GAAGR,eAAe,KAAK,UAAU;EACjD,MAAM,GAAGS,WAAW,CAAC,GAAG1B,QAAQ,CAAC,CAAC,CAA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C,OAAO,CAACuB,IAAI,CAACX,KAAK,CAAC;QAClC,MAAMa,IAAI,GAAGhD,IAAI,CAAC8C,IAAI,CAACX,KAAK,CAAC;QAE7B,IAAIkC,MAAM,KAAKpB,SAAS,IAAID,IAAI,KAAKC,SAAS,EAAE;UAC9C,OAAO,IAAI;QACb;QAEA,oBACEvD,IAAA,CAACN,IAAI;UAEHwF,KAAK,EAAE,CACLE,MAAM,CAAChC,IAAI,EACXnC,UAAU,GACN;YACEoE,GAAG,EAAEV,MAAM,CAACH,CAAC;YACbI,MAAM,EAAED,MAAM,CAACC,MAAM;YACrBC,KAAK,EAAEF,MAAM,CAACE;UAChB,CAAC,GACD;YACES,IAAI,EAAEX,MAAM,CAACF,CAAC;YACdI,KAAK,EAAEF,MAAM,CAACE,KAAK;YACnBD,MAAM,EAAED,MAAM,CAACC;UACjB,CAAC,CACL;UAAAK,QAAA,EAED1E,UAAU,CAAC;YACV+C,IAAI;YACJb,KAAK,EAAEW,IAAI,CAACX,KAAK;YACjBW;UACF,CAAC;QAAC,GApBGA,IAAI,CAACZ,GAqBN,CAAC;MAEX,CAAC;IAAC,CACE;EAAC,CACG,CAAC;AAEjB;;AAEA;;AAEA,MAAM4C,MAAM,GAAGzF,UAAU,CAAC4F,MAAM,CAAC;EAC/BnC,IAAI,EAAE;IACJoC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function createScrollVelocityTracker() {
|
|
4
|
+
let lastOffset = 0;
|
|
5
|
+
let lastTime = Date.now();
|
|
6
|
+
return function getVelocity(offset) {
|
|
7
|
+
const now = Date.now();
|
|
8
|
+
const dt = now - lastTime;
|
|
9
|
+
const dy = Math.abs(offset - lastOffset);
|
|
10
|
+
lastOffset = offset;
|
|
11
|
+
lastTime = now;
|
|
12
|
+
if (dt === 0) return 0;
|
|
13
|
+
return dy / dt; // px per ms
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=useScrollVelocity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createScrollVelocityTracker","lastOffset","lastTime","Date","now","getVelocity","offset","dt","dy","Math","abs"],"sourceRoot":"../../../src","sources":["scroll/useScrollVelocity.ts"],"mappings":";;AAAA,OAAO,SAASA,2BAA2BA,CAAA,EAAG;EAC5C,IAAIC,UAAU,GAAG,CAAC;EAClB,IAAIC,QAAQ,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;EAEzB,OAAO,SAASC,WAAWA,CAACC,MAAc,EAAU;IAClD,MAAMF,GAAG,GAAGD,IAAI,CAACC,GAAG,CAAC,CAAC;IACtB,MAAMG,EAAE,GAAGH,GAAG,GAAGF,QAAQ;IACzB,MAAMM,EAAE,GAAGC,IAAI,CAACC,GAAG,CAACJ,MAAM,GAAGL,UAAU,CAAC;IAExCA,UAAU,GAAGK,MAAM;IACnBJ,QAAQ,GAAGE,GAAG;IAEd,IAAIG,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IACtB,OAAOC,EAAE,GAAGD,EAAE,EAAC;EACjB,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/NitroList.nitro.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/Axis.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/CellKey.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Logical cell type.
|
|
5
|
+
*
|
|
6
|
+
* Used to group compatible cells for recycling.
|
|
7
|
+
*
|
|
8
|
+
* Cross-platform equivalent:
|
|
9
|
+
* - Android: viewType
|
|
10
|
+
* - iOS: reuseIdentifier
|
|
11
|
+
*
|
|
12
|
+
* NOTE:
|
|
13
|
+
* This is a branded type to prevent accidental mixing
|
|
14
|
+
* with keys, indexes, or other strings/numbers.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Helper to create a CellType safely.
|
|
19
|
+
* Keeps ergonomics simple for users.
|
|
20
|
+
*/
|
|
21
|
+
export const createCellType = value => value;
|
|
22
|
+
//# sourceMappingURL=CellType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createCellType","value"],"sourceRoot":"../../../src","sources":["types/CellType.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA,OAAO,MAAMA,cAAc,GACzBC,KAAa,IACAA,KAAiB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/VisibleRange.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/VisibleRangeInput.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ZERO_MAIN_AXIS_PADDING"],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":";;AAKA,SACEA,sBAAsB,QACjB,0BAA0B","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["types/layout/LayoutRect.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["types/layout/LinearLayoutInput.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Padding applied along the main scroll axis.
|
|
5
|
+
*
|
|
6
|
+
* This is a layout-level concept (not visual styling).
|
|
7
|
+
*
|
|
8
|
+
* - vertical → top / bottom
|
|
9
|
+
* - horizontal → left / right
|
|
10
|
+
*
|
|
11
|
+
* Uses start/end to remain RTL-safe and platform-neutral.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Shared zero-padding constant.
|
|
16
|
+
* Safe to reuse across layouts.
|
|
17
|
+
*/
|
|
18
|
+
export const ZERO_MAIN_AXIS_PADDING = {
|
|
19
|
+
start: 0,
|
|
20
|
+
end: 0
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=MainAxisPadding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ZERO_MAIN_AXIS_PADDING","start","end"],"sourceRoot":"../../../../src","sources":["types/layout/MainAxisPadding.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA,OAAO,MAAMA,sBAAuC,GAAG;EACrDC,KAAK,EAAE,CAAC;EACRC,GAAG,EAAE;AACP,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["types/layout/index.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Owns recycled physical cells.
|
|
5
|
+
* Enforces hard caps.
|
|
6
|
+
*/
|
|
7
|
+
export class CellPool {
|
|
8
|
+
pools = new Map();
|
|
9
|
+
maxPerType = new Map();
|
|
10
|
+
hasType(type) {
|
|
11
|
+
return this.pools.has(type);
|
|
12
|
+
}
|
|
13
|
+
registerType(type, maxCount) {
|
|
14
|
+
if (this.pools.has(type)) return;
|
|
15
|
+
this.pools.set(type, []);
|
|
16
|
+
this.maxPerType.set(type, maxCount);
|
|
17
|
+
}
|
|
18
|
+
acquire(type) {
|
|
19
|
+
const bucket = this.pools.get(type);
|
|
20
|
+
if (!bucket || bucket.length === 0) return null;
|
|
21
|
+
return bucket.pop() ?? null;
|
|
22
|
+
}
|
|
23
|
+
release(cell) {
|
|
24
|
+
const bucket = this.pools.get(cell.type);
|
|
25
|
+
const max = this.maxPerType.get(cell.type);
|
|
26
|
+
if (!bucket || max === undefined) return;
|
|
27
|
+
cell.index = -1;
|
|
28
|
+
if (bucket.length >= max) return;
|
|
29
|
+
bucket.push(cell);
|
|
30
|
+
}
|
|
31
|
+
clear() {
|
|
32
|
+
for (const bucket of this.pools.values()) {
|
|
33
|
+
bucket.length = 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=CellPool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CellPool","pools","Map","maxPerType","hasType","type","has","registerType","maxCount","set","acquire","bucket","get","length","pop","release","cell","max","undefined","index","push","clear","values"],"sourceRoot":"../../../../src","sources":["types/recycler/CellPool.ts"],"mappings":";;AAIA;AACA;AACA;AACA;AACA,OAAO,MAAMA,QAAQ,CAAyB;EAC3BC,KAAK,GAAG,IAAIC,GAAG,CAAgB,CAAC;EAChCC,UAAU,GAAG,IAAID,GAAG,CAAmB,CAAC;EAEzDE,OAAOA,CAACC,IAAc,EAAW;IAC/B,OAAO,IAAI,CAACJ,KAAK,CAACK,GAAG,CAACD,IAAI,CAAC;EAC7B;EAEAE,YAAYA,CAACF,IAAc,EAAEG,QAAgB,EAAQ;IACnD,IAAI,IAAI,CAACP,KAAK,CAACK,GAAG,CAACD,IAAI,CAAC,EAAE;IAC1B,IAAI,CAACJ,KAAK,CAACQ,GAAG,CAACJ,IAAI,EAAE,EAAE,CAAC;IACxB,IAAI,CAACF,UAAU,CAACM,GAAG,CAACJ,IAAI,EAAEG,QAAQ,CAAC;EACrC;EAEAE,OAAOA,CAACL,IAAc,EAAY;IAChC,MAAMM,MAAM,GAAG,IAAI,CAACV,KAAK,CAACW,GAAG,CAACP,IAAI,CAAC;IACnC,IAAI,CAACM,MAAM,IAAIA,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;IAC/C,OAAOF,MAAM,CAACG,GAAG,CAAC,CAAC,IAAI,IAAI;EAC7B;EAEAC,OAAOA,CAACC,IAAO,EAAQ;IACrB,MAAML,MAAM,GAAG,IAAI,CAACV,KAAK,CAACW,GAAG,CAACI,IAAI,CAACX,IAAI,CAAC;IACxC,MAAMY,GAAG,GAAG,IAAI,CAACd,UAAU,CAACS,GAAG,CAACI,IAAI,CAACX,IAAI,CAAC;IAC1C,IAAI,CAACM,MAAM,IAAIM,GAAG,KAAKC,SAAS,EAAE;IAElCF,IAAI,CAACG,KAAK,GAAG,CAAC,CAAC;IACf,IAAIR,MAAM,CAACE,MAAM,IAAII,GAAG,EAAE;IAE1BN,MAAM,CAACS,IAAI,CAACJ,IAAI,CAAC;EACnB;EAEAK,KAAKA,CAAA,EAAS;IACZ,KAAK,MAAMV,MAAM,IAAI,IAAI,CAACV,KAAK,CAACqB,MAAM,CAAC,CAAC,EAAE;MACxCX,MAAM,CAACE,MAAM,GAAG,CAAC;IACnB;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["types/recycler/NitroListProps.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["types/recycler/RecyclerCell.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["types/recycler/RecyclerItemRenderer.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["types/recycler/index.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["types/scroll/ScrollMetrics.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["types/scroll/index.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Computes visible item range using binary search + forward scan.
|
|
5
|
+
* Type-safe and defensive against invalid indices.
|
|
6
|
+
*/
|
|
7
|
+
export function computeVisibleItemRange(input) {
|
|
8
|
+
const {
|
|
9
|
+
layouts,
|
|
10
|
+
offset,
|
|
11
|
+
viewportSize,
|
|
12
|
+
buffer,
|
|
13
|
+
isVertical
|
|
14
|
+
} = input;
|
|
15
|
+
const count = layouts.length;
|
|
16
|
+
if (count === 0) return null;
|
|
17
|
+
const windowStart = Math.max(0, offset - buffer);
|
|
18
|
+
const windowEnd = offset + viewportSize + buffer;
|
|
19
|
+
|
|
20
|
+
// ------------------------------
|
|
21
|
+
// Binary search: first visible
|
|
22
|
+
// ------------------------------
|
|
23
|
+
let low = 0;
|
|
24
|
+
let high = count - 1;
|
|
25
|
+
let first = count;
|
|
26
|
+
while (low <= high) {
|
|
27
|
+
const mid = low + high >>> 1;
|
|
28
|
+
const rect = layouts[mid];
|
|
29
|
+
if (!rect) break;
|
|
30
|
+
const start = isVertical ? rect.y : rect.x;
|
|
31
|
+
const size = isVertical ? rect.height : rect.width;
|
|
32
|
+
if (start + size >= windowStart) {
|
|
33
|
+
first = mid;
|
|
34
|
+
high = mid - 1;
|
|
35
|
+
} else {
|
|
36
|
+
low = mid + 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (first === count) return null;
|
|
40
|
+
|
|
41
|
+
// ------------------------------
|
|
42
|
+
// Linear scan: last visible
|
|
43
|
+
// ------------------------------
|
|
44
|
+
let last = first;
|
|
45
|
+
for (let i = first + 1; i < count; i++) {
|
|
46
|
+
const rect = layouts[i];
|
|
47
|
+
if (!rect) break;
|
|
48
|
+
const start = isVertical ? rect.y : rect.x;
|
|
49
|
+
if (start > windowEnd) break;
|
|
50
|
+
last = i;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
startIndex: first,
|
|
54
|
+
endIndex: last
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=computeVisibleItemRange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["computeVisibleItemRange","input","layouts","offset","viewportSize","buffer","isVertical","count","length","windowStart","Math","max","windowEnd","low","high","first","mid","rect","start","y","x","size","height","width","last","i","startIndex","endIndex"],"sourceRoot":"../../../src","sources":["windowing/computeVisibleItemRange.ts"],"mappings":";;AAgBA;AACA;AACA;AACA;AACA,OAAO,SAASA,uBAAuBA,CACrCC,KAAY,EACS;EACrB,MAAM;IACJC,OAAO;IACPC,MAAM;IACNC,YAAY;IACZC,MAAM;IACNC;EACF,CAAC,GAAGL,KAAK;EAET,MAAMM,KAAK,GAAGL,OAAO,CAACM,MAAM;EAC5B,IAAID,KAAK,KAAK,CAAC,EAAE,OAAO,IAAI;EAE5B,MAAME,WAAW,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAER,MAAM,GAAGE,MAAM,CAAC;EAChD,MAAMO,SAAS,GAAGT,MAAM,GAAGC,YAAY,GAAGC,MAAM;;EAEhD;EACA;EACA;EACA,IAAIQ,GAAG,GAAG,CAAC;EACX,IAAIC,IAAI,GAAGP,KAAK,GAAG,CAAC;EACpB,IAAIQ,KAAK,GAAGR,KAAK;EAEjB,OAAOM,GAAG,IAAIC,IAAI,EAAE;IAClB,MAAME,GAAG,GAAIH,GAAG,GAAGC,IAAI,KAAM,CAAC;IAC9B,MAAMG,IAAI,GAAGf,OAAO,CAACc,GAAG,CAAC;IACzB,IAAI,CAACC,IAAI,EAAE;IAEX,MAAMC,KAAK,GAAGZ,UAAU,GAAGW,IAAI,CAACE,CAAC,GAAGF,IAAI,CAACG,CAAC;IAC1C,MAAMC,IAAI,GAAGf,UAAU,GAAGW,IAAI,CAACK,MAAM,GAAGL,IAAI,CAACM,KAAK;IAElD,IAAIL,KAAK,GAAGG,IAAI,IAAIZ,WAAW,EAAE;MAC/BM,KAAK,GAAGC,GAAG;MACXF,IAAI,GAAGE,GAAG,GAAG,CAAC;IAChB,CAAC,MAAM;MACLH,GAAG,GAAGG,GAAG,GAAG,CAAC;IACf;EACF;EAEA,IAAID,KAAK,KAAKR,KAAK,EAAE,OAAO,IAAI;;EAEhC;EACA;EACA;EACA,IAAIiB,IAAI,GAAGT,KAAK;EAEhB,KAAK,IAAIU,CAAC,GAAGV,KAAK,GAAG,CAAC,EAAEU,CAAC,GAAGlB,KAAK,EAAEkB,CAAC,EAAE,EAAE;IACtC,MAAMR,IAAI,GAAGf,OAAO,CAACuB,CAAC,CAAC;IACvB,IAAI,CAACR,IAAI,EAAE;IAEX,MAAMC,KAAK,GAAGZ,UAAU,GAAGW,IAAI,CAACE,CAAC,GAAGF,IAAI,CAACG,CAAC;IAC1C,IAAIF,KAAK,GAAGN,SAAS,EAAE;IAEvBY,IAAI,GAAGC,CAAC;EACV;EAEA,OAAO;IACLC,UAAU,EAAEX,KAAK;IACjBY,QAAQ,EAAEH;EACZ,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useScrollMetrics","computeVisibleItemRange"],"sourceRoot":"../../../src","sources":["windowing/index.ts"],"mappings":";;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,uBAAuB,QAAQ,2BAA2B","ignoreList":[]}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Physical reusable cell.
|
|
3
|
-
*
|
|
3
|
+
* Represents a single mounted view instance.
|
|
4
4
|
*/
|
|
5
5
|
export interface Cell {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Stable physical identity.
|
|
8
|
+
* Used as React key. NEVER changes.
|
|
9
|
+
*/
|
|
7
10
|
readonly key: string;
|
|
8
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Logical data index currently bound.
|
|
13
|
+
* Changes as the cell is recycled.
|
|
14
|
+
*/
|
|
9
15
|
index: number;
|
|
10
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Compatibility type (row, header, etc).
|
|
18
|
+
* Determines reuse eligibility.
|
|
19
|
+
*/
|
|
11
20
|
readonly type: string;
|
|
12
21
|
}
|
|
13
22
|
//# sourceMappingURL=Cell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../../src/cell/Cell.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,IAAI;IACnB
|
|
1
|
+
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../../src/cell/Cell.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,IAAI;IACnB;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IAEpB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CellKey } from '../types/CellKey';
|
|
2
|
+
/**
|
|
3
|
+
* Monotonic key generator for physical cell instances.
|
|
4
|
+
* Guarantees stable keys across the lifetime of the list.
|
|
5
|
+
*/
|
|
6
|
+
export declare class CellKeyGenerator {
|
|
7
|
+
private nextId;
|
|
8
|
+
next(): CellKey;
|
|
9
|
+
reset(): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=CellKeyGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CellKeyGenerator.d.ts","sourceRoot":"","sources":["../../../../src/cell/CellKeyGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAI;IAElB,IAAI,IAAI,OAAO;IAIf,KAAK,IAAI,IAAI;CAGd"}
|