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
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "computeVisibleItemRange", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _computeVisibleItemRange.computeVisibleItemRange;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "useScrollMetrics", {
|
|
@@ -15,6 +15,6 @@ Object.defineProperty(exports, "useScrollMetrics", {
|
|
|
15
15
|
return _useScrollMetrics.useScrollMetrics;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
var _findVisibleIndexRange = require("./findVisibleIndexRange");
|
|
19
18
|
var _useScrollMetrics = require("./useScrollMetrics");
|
|
19
|
+
var _computeVisibleItemRange = require("./computeVisibleItemRange");
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_useScrollMetrics","require","_computeVisibleItemRange"],"sourceRoot":"../../../src","sources":["windowing/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Monotonic key generator for physical cell instances.
|
|
5
|
+
* Guarantees stable keys across the lifetime of the list.
|
|
6
|
+
*/
|
|
7
|
+
export class CellKeyGenerator {
|
|
8
|
+
nextId = 0;
|
|
9
|
+
next() {
|
|
10
|
+
return this.nextId++;
|
|
11
|
+
}
|
|
12
|
+
reset() {
|
|
13
|
+
this.nextId = 0;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=CellKeyGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CellKeyGenerator","nextId","next","reset"],"sourceRoot":"../../../src","sources":["cell/CellKeyGenerator.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,gBAAgB,CAAC;EACpBC,MAAM,GAAG,CAAC;EAElBC,IAAIA,CAAA,EAAY;IACd,OAAO,IAAI,CAACD,MAAM,EAAE;EACtB;EAEAE,KAAKA,CAAA,EAAS;IACZ,IAAI,CAACF,MAAM,GAAG,CAAC;EACjB;AACF","ignoreList":[]}
|
|
@@ -1,57 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { createCell } from './createCell';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* FlashList equivalent: CellRecycler
|
|
6
|
+
* Manages physical cell reuse.
|
|
7
|
+
* Imperative and stateful by design.
|
|
8
|
+
* This is NOT React code.
|
|
10
9
|
*/
|
|
11
10
|
export class CellRecycler {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Active cells mapped by logical index.
|
|
13
|
+
*/
|
|
14
|
+
indexToCell = new Map();
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Pool of detached reusable cells.
|
|
18
|
+
*/
|
|
19
|
+
recycledCells = [];
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
|
-
* Reconcile
|
|
19
|
-
*
|
|
22
|
+
* Reconcile a contiguous visible index range
|
|
23
|
+
* into a stable list of physical cells.
|
|
24
|
+
*
|
|
25
|
+
* HOT PATH:
|
|
26
|
+
* - No index arrays
|
|
27
|
+
* - Minimal allocations
|
|
28
|
+
* - Deterministic
|
|
20
29
|
*/
|
|
21
|
-
|
|
22
|
-
const
|
|
30
|
+
reconcileRange(startIndex, endIndex, resolveCellType) {
|
|
31
|
+
const nextActive = [];
|
|
23
32
|
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
|
|
33
|
+
// Track which current indices are no longer visible
|
|
34
|
+
const unusedIndices = new Set(this.indexToCell.keys());
|
|
35
|
+
for (let index = startIndex; index <= endIndex; index++) {
|
|
36
|
+
unusedIndices.delete(index);
|
|
37
|
+
let cell = this.indexToCell.get(index);
|
|
38
|
+
if (cell) {
|
|
39
|
+
// Existing assignment — reuse
|
|
40
|
+
nextActive.push(cell);
|
|
41
|
+
continue;
|
|
31
42
|
}
|
|
32
|
-
const
|
|
33
|
-
if (pool.length < MAX_CELLS) pool.push(cell);
|
|
34
|
-
this.reusableCellsByType.set(cell.type, pool);
|
|
35
|
-
}
|
|
43
|
+
const type = resolveCellType(index);
|
|
36
44
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (!cell) {
|
|
44
|
-
cell = {
|
|
45
|
-
key: `cell-${this.nextCellId++}`,
|
|
46
|
-
type,
|
|
47
|
-
index
|
|
48
|
-
};
|
|
45
|
+
// Try to reuse a recycled cell of same type
|
|
46
|
+
const recycledIdx = this.recycledCells.findIndex(c => c.type === type);
|
|
47
|
+
if (recycledIdx !== -1) {
|
|
48
|
+
cell = this.recycledCells.splice(recycledIdx, 1)[0];
|
|
49
|
+
} else {
|
|
50
|
+
cell = createCell(type);
|
|
49
51
|
}
|
|
50
52
|
cell.index = index;
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
+
this.indexToCell.set(index, cell);
|
|
54
|
+
nextActive.push(cell);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Recycle cells that left the visible window
|
|
58
|
+
for (const index of unusedIndices) {
|
|
59
|
+
const cell = this.indexToCell.get(index);
|
|
60
|
+
this.indexToCell.delete(index);
|
|
61
|
+
this.recycledCells.push(cell);
|
|
53
62
|
}
|
|
54
|
-
return
|
|
63
|
+
return nextActive;
|
|
55
64
|
}
|
|
56
65
|
}
|
|
57
66
|
//# sourceMappingURL=CellRecycler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["createCell","CellRecycler","indexToCell","Map","recycledCells","reconcileRange","startIndex","endIndex","resolveCellType","nextActive","unusedIndices","Set","keys","index","delete","cell","get","push","type","recycledIdx","findIndex","c","splice","set"],"sourceRoot":"../../../src","sources":["cell/CellRecycler.ts"],"mappings":";;AACA,SAASA,UAAU,QAAQ,cAAc;;AAEzC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,CAAC;EACxB;AACF;AACA;EACmBC,WAAW,GAAG,IAAIC,GAAG,CAAe,CAAC;;EAEtD;AACF;AACA;EACmBC,aAAa,GAAW,EAAE;;EAE3C;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,cAAcA,CACZC,UAAkB,EAClBC,QAAgB,EAChBC,eAA0C,EACzB;IACjB,MAAMC,UAAkB,GAAG,EAAE;;IAE7B;IACA,MAAMC,aAAa,GAAG,IAAIC,GAAG,CAAC,IAAI,CAACT,WAAW,CAACU,IAAI,CAAC,CAAC,CAAC;IAEtD,KAAK,IAAIC,KAAK,GAAGP,UAAU,EAAEO,KAAK,IAAIN,QAAQ,EAAEM,KAAK,EAAE,EAAE;MACvDH,aAAa,CAACI,MAAM,CAACD,KAAK,CAAC;MAE3B,IAAIE,IAAI,GAAG,IAAI,CAACb,WAAW,CAACc,GAAG,CAACH,KAAK,CAAC;MACtC,IAAIE,IAAI,EAAE;QACR;QACAN,UAAU,CAACQ,IAAI,CAACF,IAAI,CAAC;QACrB;MACF;MAEA,MAAMG,IAAI,GAAGV,eAAe,CAACK,KAAK,CAAC;;MAEnC;MACA,MAAMM,WAAW,GAAG,IAAI,CAACf,aAAa,CAACgB,SAAS,CAC9CC,CAAC,IAAIA,CAAC,CAACH,IAAI,KAAKA,IAClB,CAAC;MAED,IAAIC,WAAW,KAAK,CAAC,CAAC,EAAE;QACtBJ,IAAI,GAAG,IAAI,CAACX,aAAa,CAACkB,MAAM,CAACH,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE;MACtD,CAAC,MAAM;QACLJ,IAAI,GAAGf,UAAU,CAACkB,IAAI,CAAC;MACzB;MAEAH,IAAI,CAACF,KAAK,GAAGA,KAAK;MAClB,IAAI,CAACX,WAAW,CAACqB,GAAG,CAACV,KAAK,EAAEE,IAAI,CAAC;MACjCN,UAAU,CAACQ,IAAI,CAACF,IAAI,CAAC;IACvB;;IAEA;IACA,KAAK,MAAMF,KAAK,IAAIH,aAAa,EAAE;MACjC,MAAMK,IAAI,GAAG,IAAI,CAACb,WAAW,CAACc,GAAG,CAACH,KAAK,CAAE;MACzC,IAAI,CAACX,WAAW,CAACY,MAAM,CAACD,KAAK,CAAC;MAC9B,IAAI,CAACT,aAAa,CAACa,IAAI,CAACF,IAAI,CAAC;IAC/B;IAEA,OAAON,UAAU;EACnB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
let nextCellId = 0;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new physical cell with a stable identity.
|
|
7
|
+
* The key is generated ONCE and never changes.
|
|
8
|
+
*/
|
|
9
|
+
export function createCell(type) {
|
|
10
|
+
return {
|
|
11
|
+
key: `cell-${nextCellId++}`,
|
|
12
|
+
// stable physical identity
|
|
13
|
+
type,
|
|
14
|
+
index: -1 // assigned by recycler
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=createCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["nextCellId","createCell","type","key","index"],"sourceRoot":"../../../src","sources":["cell/createCell.ts"],"mappings":";;AAEA,IAAIA,UAAU,GAAG,CAAC;;AAElB;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAACC,IAAY,EAAQ;EAC7C,OAAO;IACLC,GAAG,EAAE,QAAQH,UAAU,EAAE,EAAE;IAAE;IAC7BE,IAAI;IACJE,KAAK,EAAE,CAAC,CAAC,CAAmB;EAC9B,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CellRecycler","createCell"],"sourceRoot":"../../../src","sources":["cell/index.ts"],"mappings":";;AAAA;;AAGA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,UAAU,QAAQ,cAAc","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getVisibleRange","layouts","metrics","bufferPx","length","height","startY","Math","max","offsetY","endY","low","high","first","mid","rect","y","visible","i","push"],"sourceRoot":"../../src","sources":["getVisibleIndices.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["getVisibleRange","layouts","metrics","bufferPx","length","height","startY","Math","max","offsetY","endY","low","high","first","mid","rect","y","visible","i","push"],"sourceRoot":"../../src","sources":["getVisibleIndices.ts"],"mappings":";;AAKA;AACA;AACA;AACA;AACA,OAAO,SAASA,eAAeA,CAC7BC,OAA8B,EAC9BC,OAAsB,EACtBC,QAAgB,EACG;EACnB,IACEF,OAAO,CAACG,MAAM,KAAK,CAAC,IACpBF,OAAO,CAACG,MAAM,IAAI,CAAC,EACnB;IACA,OAAO,EAAE;EACX;EAEA,MAAMC,MAAM,GAAGC,IAAI,CAACC,GAAG,CACrB,CAAC,EACDN,OAAO,CAACO,OAAO,GAAGN,QACpB,CAAC;EAED,MAAMO,IAAI,GACRR,OAAO,CAACO,OAAO,GAAGP,OAAO,CAACG,MAAM,GAAGF,QAAQ;EAE7C,IAAIQ,GAAG,GAAG,CAAC;EACX,IAAIC,IAAI,GAAGX,OAAO,CAACG,MAAM,GAAG,CAAC;EAC7B,IAAIS,KAAK,GAAGZ,OAAO,CAACG,MAAM;EAE1B,OAAOO,GAAG,IAAIC,IAAI,EAAE;IAClB,MAAME,GAAG,GAAIH,GAAG,GAAGC,IAAI,IAAK,CAAC;IAC7B,MAAMG,IAAI,GAAGd,OAAO,CAACa,GAAG,CAAE;IAE1B,IAAIC,IAAI,CAACC,CAAC,GAAGD,IAAI,CAACV,MAAM,IAAIC,MAAM,EAAE;MAClCO,KAAK,GAAGC,GAAG;MACXF,IAAI,GAAGE,GAAG,GAAG,CAAC;IAChB,CAAC,MAAM;MACLH,GAAG,GAAGG,GAAG,GAAG,CAAC;IACf;EACF;EAEA,MAAMG,OAAiB,GAAG,EAAE;EAE5B,KAAK,IAAIC,CAAC,GAAGL,KAAK,EAAEK,CAAC,GAAGjB,OAAO,CAACG,MAAM,EAAEc,CAAC,EAAE,EAAE;IAC3C,MAAMH,IAAI,GAAGd,OAAO,CAACiB,CAAC,CAAE;IACxB,IAAIH,IAAI,CAACC,CAAC,GAAGN,IAAI,EAAE;IACnBO,OAAO,CAACE,IAAI,CAACD,CAAC,CAAC;EACjB;EAEA,OAAOD,OAAO;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useRef, useCallback } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns a function whose identity is stable across renders,
|
|
7
|
+
* but always invokes the latest provided implementation.
|
|
8
|
+
*
|
|
9
|
+
* Invariants:
|
|
10
|
+
* - Function reference NEVER changes
|
|
11
|
+
* - Logic is ALWAYS up to date
|
|
12
|
+
*
|
|
13
|
+
* This is critical for long-lived systems such as:
|
|
14
|
+
* - Recyclers
|
|
15
|
+
* - Effects
|
|
16
|
+
* - Native bridges
|
|
17
|
+
* - Event pipelines
|
|
18
|
+
*/
|
|
19
|
+
export function usePersistentCallback(fn) {
|
|
20
|
+
/**
|
|
21
|
+
* Holds the latest implementation.
|
|
22
|
+
* Updating this does NOT trigger re-renders.
|
|
23
|
+
*/
|
|
24
|
+
const fnRef = useRef(fn);
|
|
25
|
+
fnRef.current = fn;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Stable wrapper that forwards calls
|
|
29
|
+
* to the latest implementation.
|
|
30
|
+
*/
|
|
31
|
+
return useCallback((...args) => fnRef.current(...args), []);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=usePersistentCallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRef","useCallback","usePersistentCallback","fn","fnRef","current","args"],"sourceRoot":"../../../src","sources":["hooks/usePersistentCallback.ts"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,WAAW,QAAQ,OAAO;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAEnCC,EAAK,EAAK;EAEV;AACF;AACA;AACA;EACE,MAAMC,KAAK,GAAGJ,MAAM,CAACG,EAAE,CAAC;EACxBC,KAAK,CAACC,OAAO,GAAGF,EAAE;;EAElB;AACF;AACA;AACA;EACE,OAAOF,WAAW,CACf,CAAC,GAAGK,IAAa,KAChBF,KAAK,CAACC,OAAO,CAAC,GAAGC,IAAI,CAAC,EACxB,EACF,CAAC;AACH","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// Export the Native View
|
|
4
|
+
export * from './native/NitroListView';
|
|
5
|
+
// Export the JSI Specs
|
|
6
|
+
export * from './specs/NitroList.nitro';
|
|
7
|
+
export { default as NitroList } from './recycler/NitroList';
|
|
4
8
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["default","NitroList"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AACA;AACA,cAAc,wBAAwB;AACtC;AACA,cAAc,yBAAyB;AAEvC,SAASA,OAAO,IAAIC,SAAS,QAAQ,sBAAsB","ignoreList":[]}
|
|
@@ -1,60 +1,100 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* INTERNAL mutable layout record.
|
|
5
|
-
* This is intentionally mutable and never exposed publicly.
|
|
6
|
-
*/
|
|
3
|
+
import { DEFAULT_ITEM_SPACING } from './constants/layoutDefaults';
|
|
7
4
|
|
|
8
5
|
/**
|
|
9
|
-
* Mutable linear layout
|
|
10
|
-
*
|
|
6
|
+
* Mutable, deterministic linear layout engine.
|
|
7
|
+
*
|
|
8
|
+
* Responsibilities:
|
|
9
|
+
* - Compute absolute item geometry
|
|
10
|
+
* - Own layout truth (no React, no scroll state)
|
|
11
|
+
* - Guarantee monotonic ordering along the main axis
|
|
12
|
+
*
|
|
13
|
+
* Cross-platform equivalents:
|
|
14
|
+
* - Flutter: RenderSliver / SliverList
|
|
15
|
+
* - Android: LinearLayoutManager
|
|
16
|
+
* - iOS: UICollectionViewFlowLayout (linear)
|
|
11
17
|
*/
|
|
12
18
|
export class MutableLinearLayout {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
/** Absolute item layouts in index order */
|
|
20
|
+
layouts = [];
|
|
21
|
+
|
|
22
|
+
/** Total scrollable size along main axis */
|
|
23
|
+
contentSize = 0;
|
|
24
|
+
constructor(axis) {
|
|
25
|
+
this.isVertical = axis === 'vertical';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Computes layout synchronously from input.
|
|
30
|
+
*
|
|
31
|
+
* This method is intentionally parameter-object based
|
|
32
|
+
* to allow future extension without breaking API.
|
|
33
|
+
*
|
|
34
|
+
* Invariants:
|
|
35
|
+
* - Layouts are monotonic along main axis
|
|
36
|
+
* - No gaps except explicit spacing
|
|
37
|
+
* - Deterministic for identical inputs
|
|
38
|
+
*/
|
|
39
|
+
compute(input) {
|
|
40
|
+
const {
|
|
41
|
+
crossAxisSize,
|
|
42
|
+
itemMainAxisSizes,
|
|
43
|
+
padding,
|
|
44
|
+
itemSpacing = DEFAULT_ITEM_SPACING
|
|
45
|
+
} = input;
|
|
46
|
+
const itemCount = itemMainAxisSizes.length;
|
|
47
|
+
const layouts = new Array(itemCount);
|
|
48
|
+
let cursor = padding.start;
|
|
49
|
+
for (let i = 0; i < itemCount; i++) {
|
|
50
|
+
const mainAxisSize = itemMainAxisSizes[i];
|
|
51
|
+
layouts[i] = this.isVertical ? {
|
|
18
52
|
x: 0,
|
|
19
|
-
y,
|
|
20
|
-
width,
|
|
21
|
-
height
|
|
22
|
-
}
|
|
23
|
-
|
|
53
|
+
y: cursor,
|
|
54
|
+
width: crossAxisSize,
|
|
55
|
+
height: mainAxisSize
|
|
56
|
+
} : {
|
|
57
|
+
x: cursor,
|
|
58
|
+
y: 0,
|
|
59
|
+
width: mainAxisSize,
|
|
60
|
+
height: crossAxisSize
|
|
61
|
+
};
|
|
62
|
+
cursor += mainAxisSize;
|
|
63
|
+
|
|
64
|
+
// Space BETWEEN items, not after the last
|
|
65
|
+
if (i < itemCount - 1) {
|
|
66
|
+
cursor += itemSpacing;
|
|
67
|
+
}
|
|
24
68
|
}
|
|
25
|
-
this.
|
|
69
|
+
this.layouts = layouts;
|
|
70
|
+
this.contentSize = cursor + padding.end;
|
|
26
71
|
}
|
|
27
72
|
|
|
28
73
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
74
|
+
* Returns computed item layouts.
|
|
75
|
+
*
|
|
76
|
+
* Order is guaranteed monotonic along the main axis,
|
|
77
|
+
* which is required for binary-search-based windowing.
|
|
31
78
|
*/
|
|
32
79
|
getLayouts() {
|
|
33
80
|
return this.layouts;
|
|
34
81
|
}
|
|
35
|
-
|
|
36
|
-
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Returns total scrollable size along the main axis,
|
|
85
|
+
* including padding and inter-item spacing.
|
|
86
|
+
*/
|
|
87
|
+
getContentSize() {
|
|
88
|
+
return this.contentSize;
|
|
37
89
|
}
|
|
38
90
|
|
|
39
91
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
92
|
+
* Clears internal layout state.
|
|
93
|
+
* Call on severe invalidation or teardown.
|
|
42
94
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const delta = newHeight - layout.height;
|
|
47
|
-
if (delta === 0) return false;
|
|
48
|
-
|
|
49
|
-
// Update this item
|
|
50
|
-
layout.height = newHeight;
|
|
51
|
-
|
|
52
|
-
// Shift all items after this index
|
|
53
|
-
for (let i = index + 1; i < this.layouts.length; i++) {
|
|
54
|
-
this.layouts[i].y += delta;
|
|
55
|
-
}
|
|
56
|
-
this.totalHeight += delta;
|
|
57
|
-
return true;
|
|
95
|
+
reset() {
|
|
96
|
+
this.layouts = [];
|
|
97
|
+
this.contentSize = 0;
|
|
58
98
|
}
|
|
59
99
|
}
|
|
60
100
|
//# sourceMappingURL=MutableLinearLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MutableLinearLayout","
|
|
1
|
+
{"version":3,"names":["DEFAULT_ITEM_SPACING","MutableLinearLayout","layouts","contentSize","constructor","axis","isVertical","compute","input","crossAxisSize","itemMainAxisSizes","padding","itemSpacing","itemCount","length","Array","cursor","start","i","mainAxisSize","x","y","width","height","end","getLayouts","getContentSize","reset"],"sourceRoot":"../../../src","sources":["layout/MutableLinearLayout.ts"],"mappings":";;AAGA,SAASA,oBAAoB,QAAQ,4BAA4B;;AAGjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,CAAC;EAG/B;EACQC,OAAO,GAAiB,EAAE;;EAElC;EACQC,WAAW,GAAG,CAAC;EAEvBC,WAAWA,CAACC,IAAU,EAAE;IACtB,IAAI,CAACC,UAAU,GAAGD,IAAI,KAAK,UAAU;EACvC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,OAAOA,CAACC,KAAwB,EAAQ;IACtC,MAAM;MACJC,aAAa;MACbC,iBAAiB;MACjBC,OAAO;MACPC,WAAW,GAAGZ;IAChB,CAAC,GAAGQ,KAAK;IAET,MAAMK,SAAS,GAAGH,iBAAiB,CAACI,MAAM;IAC1C,MAAMZ,OAAqB,GAAG,IAAIa,KAAK,CAACF,SAAS,CAAC;IAElD,IAAIG,MAAM,GAAGL,OAAO,CAACM,KAAK;IAE1B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,SAAS,EAAEK,CAAC,EAAE,EAAE;MAClC,MAAMC,YAAY,GAAGT,iBAAiB,CAACQ,CAAC,CAAE;MAE1ChB,OAAO,CAACgB,CAAC,CAAC,GAAG,IAAI,CAACZ,UAAU,GACxB;QACEc,CAAC,EAAE,CAAC;QACJC,CAAC,EAAEL,MAAM;QACTM,KAAK,EAAEb,aAAa;QACpBc,MAAM,EAAEJ;MACV,CAAC,GACD;QACEC,CAAC,EAAEJ,MAAM;QACTK,CAAC,EAAE,CAAC;QACJC,KAAK,EAAEH,YAAY;QACnBI,MAAM,EAAEd;MACV,CAAC;MAELO,MAAM,IAAIG,YAAY;;MAEtB;MACA,IAAID,CAAC,GAAGL,SAAS,GAAG,CAAC,EAAE;QACrBG,MAAM,IAAIJ,WAAW;MACvB;IACF;IAEA,IAAI,CAACV,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,WAAW,GAAGa,MAAM,GAAGL,OAAO,CAACa,GAAG;EACzC;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEC,UAAUA,CAAA,EAA0B;IAClC,OAAO,IAAI,CAACvB,OAAO;EACrB;;EAEA;AACF;AACA;AACA;EACEwB,cAAcA,CAAA,EAAW;IACvB,OAAO,IAAI,CAACvB,WAAW;EACzB;;EAEA;AACF;AACA;AACA;EACEwB,KAAKA,CAAA,EAAS;IACZ,IAAI,CAACzB,OAAO,GAAG,EAAE;IACjB,IAAI,CAACC,WAAW,GAAG,CAAC;EACtB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default spacing between items along the main axis.
|
|
5
|
+
*
|
|
6
|
+
* This value is used by layout engines when no explicit
|
|
7
|
+
* itemSpacing is provided.
|
|
8
|
+
*
|
|
9
|
+
* Mirrors:
|
|
10
|
+
* - Android RecyclerView ItemDecoration (typical 8–16dp)
|
|
11
|
+
* - iOS UICollectionViewFlowLayout minimumLineSpacing
|
|
12
|
+
* - Flutter SliverList spacing conventions
|
|
13
|
+
*/
|
|
14
|
+
export const DEFAULT_ITEM_SPACING = 12;
|
|
15
|
+
//# sourceMappingURL=layoutDefaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEFAULT_ITEM_SPACING"],"sourceRoot":"../../../../src","sources":["layout/constants/layoutDefaults.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,GAAG,EAAE","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["layout/index.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { requireNativeComponent } from 'react-native';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Props for the NitroListView.
|
|
7
|
+
* * We extend ViewProps so that developers can use standard styles
|
|
8
|
+
* like 'flex: 1' or 'backgroundColor' on the list.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The Native Component that maps to the physical view in Swift/Kotlin.
|
|
13
|
+
* * 'NitroListView' is the "Secret Handshake" name. It must match
|
|
14
|
+
* the name exported by your Native ViewManagers.
|
|
15
|
+
*/
|
|
16
|
+
export const NitroListView = requireNativeComponent('NitroListView');
|
|
17
|
+
//# sourceMappingURL=NitroListView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["requireNativeComponent","NitroListView"],"sourceRoot":"../../../src","sources":["native/NitroListView.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAwB,cAAc;;AAErE;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GACxBD,sBAAsB,CAAqB,eAAe,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export class CellPool {
|
|
4
|
+
pools = new Map();
|
|
5
|
+
maxPerType = new Map();
|
|
6
|
+
hasType(type) {
|
|
7
|
+
return this.pools.has(type);
|
|
8
|
+
}
|
|
9
|
+
registerType(type, maxCount) {
|
|
10
|
+
if (this.pools.has(type)) return;
|
|
11
|
+
this.pools.set(type, []);
|
|
12
|
+
this.maxPerType.set(type, maxCount);
|
|
13
|
+
}
|
|
14
|
+
acquire(type) {
|
|
15
|
+
const bucket = this.pools.get(type);
|
|
16
|
+
if (!bucket || bucket.length === 0) return null;
|
|
17
|
+
return bucket.pop() ?? null;
|
|
18
|
+
}
|
|
19
|
+
release(cell) {
|
|
20
|
+
const bucket = this.pools.get(cell.type);
|
|
21
|
+
const max = this.maxPerType.get(cell.type);
|
|
22
|
+
if (!bucket || max === undefined) return;
|
|
23
|
+
cell.index = -1;
|
|
24
|
+
if (bucket.length >= max) return;
|
|
25
|
+
bucket.push(cell);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# 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"],"sourceRoot":"../../../src","sources":["recycler/CellPool.ts"],"mappings":";;AAGA,OAAO,MAAMA,QAAQ,CAA8B;EAChCC,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;IAC1BN,MAAM,CAACS,IAAI,CAACJ,IAAI,CAAC;EACnB;AACF","ignoreList":[]}
|