react-native-nitro-list 0.0.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +250 -16
- package/android/build.gradle +5 -4
- package/android/src/main/java/com/nitrolist/HybridNitroRecyclerView.kt +26 -0
- package/android/src/main/java/com/nitrolist/HybridNitroRecyclerViewManager.kt +29 -0
- package/android/src/main/java/com/nitrolist/NitroListPackage.kt +13 -24
- package/android/src/main/java/com/nitrolist/NitroRecyclerAdapter.kt +32 -0
- package/android/src/main/java/com/nitrolist/NitroRecyclerViewHolder.kt +8 -0
- package/ios/HybridNitroList.swift +28 -15
- package/lib/commonjs/NitroList.js +9 -0
- package/lib/commonjs/NitroList.js.map +1 -0
- package/lib/commonjs/ReusableView.js +2 -0
- package/lib/commonjs/ReusableView.js.map +1 -0
- package/lib/commonjs/cell/Cell.js +2 -0
- package/lib/{module/specs/nitro-list.nitro.js.map → commonjs/cell/Cell.js.map} +1 -1
- package/lib/commonjs/cell/CellKeyGenerator.js +21 -0
- package/lib/commonjs/cell/CellKeyGenerator.js.map +1 -0
- package/lib/commonjs/cell/CellRecycler.js +70 -0
- package/lib/commonjs/cell/CellRecycler.js.map +1 -0
- 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/debug/useDebugOverlay.js +15 -0
- package/lib/commonjs/debug/useDebugOverlay.js.map +1 -0
- package/lib/commonjs/getVisibleIndices.js +38 -0
- package/lib/commonjs/getVisibleIndices.js.map +1 -0
- package/lib/commonjs/hooks/usePersistentCallback.js +36 -0
- package/lib/commonjs/hooks/usePersistentCallback.js.map +1 -0
- package/lib/commonjs/index.js +7 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/layout/MutableLinearLayout.js +104 -0
- package/lib/commonjs/layout/MutableLinearLayout.js.map +1 -0
- 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 +2 -0
- package/lib/commonjs/{specs/nitro-list.nitro.js.map → layout/index.js.map} +1 -1
- package/lib/commonjs/measurement/MeasureLayout.js +20 -0
- package/lib/commonjs/measurement/MeasureLayout.js.map +1 -0
- package/lib/commonjs/measurement/useItemMeasurement.js +28 -0
- package/lib/commonjs/measurement/useItemMeasurement.js.map +1 -0
- package/lib/commonjs/native/NitroLayoutEngine.js +9 -0
- package/lib/commonjs/native/NitroLayoutEngine.js.map +1 -0
- package/lib/commonjs/{specs/nitro-list.nitro.js → native/NitroList.types.js} +1 -1
- package/lib/commonjs/native/NitroList.types.js.map +1 -0
- package/lib/commonjs/native/NitroRecyclerView.js +9 -0
- package/lib/commonjs/native/NitroRecyclerView.js.map +1 -0
- package/lib/commonjs/prefetch/PrefetchHelper.js +39 -0
- package/lib/commonjs/prefetch/PrefetchHelper.js.map +1 -0
- package/lib/commonjs/recycler/CellPool.js +46 -0
- package/lib/commonjs/recycler/CellPool.js.map +1 -0
- package/lib/commonjs/recycler/RecyclerList.js +224 -0
- package/lib/commonjs/recycler/RecyclerList.js.map +1 -0
- package/lib/commonjs/specs/nitro-layout-engine.nitro.js +6 -0
- package/lib/commonjs/specs/nitro-layout-engine.nitro.js.map +1 -0
- package/lib/commonjs/types/Axis.js +2 -0
- package/lib/commonjs/types/Axis.js.map +1 -0
- package/lib/commonjs/types/CellKey.js +2 -0
- package/lib/commonjs/types/CellKey.js.map +1 -0
- package/lib/commonjs/types/CellType.js +2 -0
- package/lib/commonjs/types/CellType.js.map +1 -0
- package/lib/commonjs/types/VisibleRange.js +2 -0
- package/lib/commonjs/types/VisibleRange.js.map +1 -0
- package/lib/commonjs/types/VisibleRangeInput.js +6 -0
- 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/types/layout/LinearLayoutInput.js +6 -0
- 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/RecyclerCellInstance.js +6 -0
- package/lib/commonjs/types/recycler/RecyclerCellInstance.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/RecyclerListProps.js +6 -0
- package/lib/commonjs/types/recycler/RecyclerListProps.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/utils/arrayEqual.js +15 -0
- package/lib/commonjs/utils/arrayEqual.js.map +1 -0
- package/lib/commonjs/utils/assertNever.js +10 -0
- package/lib/commonjs/utils/assertNever.js.map +1 -0
- package/lib/commonjs/utils/clamp.js +10 -0
- package/lib/commonjs/utils/clamp.js.map +1 -0
- package/lib/commonjs/utils/devAssert.js +12 -0
- package/lib/commonjs/utils/devAssert.js.map +1 -0
- package/lib/commonjs/utils/invariant.js +12 -0
- package/lib/commonjs/utils/invariant.js.map +1 -0
- package/lib/commonjs/utils/isDefined.js +10 -0
- package/lib/commonjs/utils/isDefined.js.map +1 -0
- package/lib/commonjs/utils/isNumber.js +10 -0
- package/lib/commonjs/utils/isNumber.js.map +1 -0
- package/lib/commonjs/utils/noop.js +10 -0
- package/lib/commonjs/utils/noop.js.map +1 -0
- package/lib/commonjs/utils/shallowEqual.js +22 -0
- package/lib/commonjs/utils/shallowEqual.js.map +1 -0
- package/lib/commonjs/utils/throttle.js +17 -0
- package/lib/commonjs/utils/throttle.js.map +1 -0
- package/lib/commonjs/windowing/ScrollMetrics.js +2 -0
- package/lib/commonjs/windowing/ScrollMetrics.js.map +1 -0
- package/lib/commonjs/windowing/computeVisibleItemRange.js +71 -0
- package/lib/commonjs/windowing/computeVisibleItemRange.js.map +1 -0
- package/lib/commonjs/windowing/index.js +20 -0
- package/lib/commonjs/windowing/index.js.map +1 -0
- package/lib/commonjs/windowing/useScrollMetrics.js +39 -0
- package/lib/commonjs/windowing/useScrollMetrics.js.map +1 -0
- package/lib/module/NitroList.js +5 -0
- package/lib/module/NitroList.js.map +1 -0
- package/lib/module/ReusableView.js +2 -0
- package/lib/module/ReusableView.js.map +1 -0
- package/lib/module/cell/Cell.js +2 -0
- package/lib/module/cell/Cell.js.map +1 -0
- package/lib/module/cell/CellKeyGenerator.js +16 -0
- package/lib/module/cell/CellKeyGenerator.js.map +1 -0
- package/lib/module/cell/CellRecycler.js +66 -0
- package/lib/module/cell/CellRecycler.js.map +1 -0
- 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/debug/useDebugOverlay.js +11 -0
- package/lib/module/debug/useDebugOverlay.js.map +1 -0
- package/lib/module/getVisibleIndices.js +34 -0
- package/lib/module/getVisibleIndices.js.map +1 -0
- package/lib/module/hooks/usePersistentCallback.js +33 -0
- package/lib/module/hooks/usePersistentCallback.js.map +1 -0
- package/lib/module/index.js +1 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/layout/MutableLinearLayout.js +100 -0
- package/lib/module/layout/MutableLinearLayout.js.map +1 -0
- 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 +2 -0
- package/lib/module/layout/index.js.map +1 -0
- package/lib/module/measurement/MeasureLayout.js +16 -0
- package/lib/module/measurement/MeasureLayout.js.map +1 -0
- package/lib/module/measurement/useItemMeasurement.js +24 -0
- package/lib/module/measurement/useItemMeasurement.js.map +1 -0
- package/lib/module/native/NitroLayoutEngine.js +5 -0
- package/lib/module/native/NitroLayoutEngine.js.map +1 -0
- package/lib/module/native/NitroList.types.js +4 -0
- package/lib/module/native/NitroList.types.js.map +1 -0
- package/lib/module/native/NitroRecyclerView.js +5 -0
- package/lib/module/native/NitroRecyclerView.js.map +1 -0
- package/lib/module/prefetch/PrefetchHelper.js +34 -0
- package/lib/module/prefetch/PrefetchHelper.js.map +1 -0
- package/lib/module/recycler/CellPool.js +41 -0
- package/lib/module/recycler/CellPool.js.map +1 -0
- package/lib/module/recycler/RecyclerList.js +221 -0
- package/lib/module/recycler/RecyclerList.js.map +1 -0
- package/lib/module/specs/nitro-layout-engine.nitro.js +4 -0
- package/lib/module/specs/nitro-layout-engine.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 +2 -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/RecyclerCellInstance.js +4 -0
- package/lib/module/types/recycler/RecyclerCellInstance.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/RecyclerListProps.js +4 -0
- package/lib/module/types/recycler/RecyclerListProps.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/utils/arrayEqual.js +11 -0
- package/lib/module/utils/arrayEqual.js.map +1 -0
- package/lib/module/utils/assertNever.js +6 -0
- package/lib/module/utils/assertNever.js.map +1 -0
- package/lib/module/utils/clamp.js +6 -0
- package/lib/module/utils/clamp.js.map +1 -0
- package/lib/module/utils/devAssert.js +8 -0
- package/lib/module/utils/devAssert.js.map +1 -0
- package/lib/module/utils/invariant.js +8 -0
- package/lib/module/utils/invariant.js.map +1 -0
- package/lib/module/utils/isDefined.js +6 -0
- package/lib/module/utils/isDefined.js.map +1 -0
- package/lib/module/utils/isNumber.js +6 -0
- package/lib/module/utils/isNumber.js.map +1 -0
- package/lib/module/utils/noop.js +6 -0
- package/lib/module/utils/noop.js.map +1 -0
- package/lib/module/utils/shallowEqual.js +18 -0
- package/lib/module/utils/shallowEqual.js.map +1 -0
- package/lib/module/utils/throttle.js +13 -0
- package/lib/module/utils/throttle.js.map +1 -0
- package/lib/module/windowing/ScrollMetrics.js +2 -0
- package/lib/module/windowing/ScrollMetrics.js.map +1 -0
- package/lib/module/windowing/computeVisibleItemRange.js +67 -0
- package/lib/module/windowing/computeVisibleItemRange.js.map +1 -0
- package/lib/module/windowing/index.js +5 -0
- package/lib/module/windowing/index.js.map +1 -0
- package/lib/module/windowing/useScrollMetrics.js +35 -0
- package/lib/module/windowing/useScrollMetrics.js.map +1 -0
- package/lib/typescript/src/NitroList.d.ts +5 -0
- package/lib/typescript/src/NitroList.d.ts.map +1 -0
- package/lib/typescript/src/ReusableView.d.ts +9 -0
- package/lib/typescript/src/ReusableView.d.ts.map +1 -0
- package/lib/typescript/src/cell/Cell.d.ts +22 -0
- package/lib/typescript/src/cell/Cell.d.ts.map +1 -0
- 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 +27 -0
- package/lib/typescript/src/cell/CellRecycler.d.ts.map +1 -0
- 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/debug/useDebugOverlay.d.ts +2 -0
- package/lib/typescript/src/debug/useDebugOverlay.d.ts.map +1 -0
- package/lib/typescript/src/getVisibleIndices.d.ts +8 -0
- package/lib/typescript/src/getVisibleIndices.d.ts.map +1 -0
- 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 +1 -4
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/layout/MutableLinearLayout.d.ts +54 -0
- package/lib/typescript/src/layout/MutableLinearLayout.d.ts.map +1 -0
- 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 +2 -0
- package/lib/typescript/src/layout/index.d.ts.map +1 -0
- package/lib/typescript/src/measurement/MeasureLayout.d.ts +10 -0
- package/lib/typescript/src/measurement/MeasureLayout.d.ts.map +1 -0
- package/lib/typescript/src/measurement/useItemMeasurement.d.ts +11 -0
- package/lib/typescript/src/measurement/useItemMeasurement.d.ts.map +1 -0
- package/lib/typescript/src/native/NitroLayoutEngine.d.ts +3 -0
- package/lib/typescript/src/native/NitroLayoutEngine.d.ts.map +1 -0
- package/lib/typescript/src/native/NitroList.types.d.ts +9 -0
- package/lib/typescript/src/native/NitroList.types.d.ts.map +1 -0
- package/lib/typescript/src/native/NitroRecyclerView.d.ts +5 -0
- package/lib/typescript/src/native/NitroRecyclerView.d.ts.map +1 -0
- package/lib/typescript/src/prefetch/PrefetchHelper.d.ts +17 -0
- package/lib/typescript/src/prefetch/PrefetchHelper.d.ts.map +1 -0
- package/lib/typescript/src/recycler/CellPool.d.ts +14 -0
- package/lib/typescript/src/recycler/CellPool.d.ts.map +1 -0
- package/lib/typescript/src/recycler/RecyclerList.d.ts +4 -0
- package/lib/typescript/src/recycler/RecyclerList.d.ts.map +1 -0
- package/lib/typescript/src/specs/nitro-layout-engine.nitro.d.ts +14 -0
- package/lib/typescript/src/specs/nitro-layout-engine.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 +10 -0
- package/lib/typescript/src/types/CellKey.d.ts.map +1 -0
- package/lib/typescript/src/types/CellType.d.ts +11 -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/RecyclerCellInstance.d.ts +37 -0
- package/lib/typescript/src/types/recycler/RecyclerCellInstance.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/RecyclerItemRenderer.d.ts +8 -0
- package/lib/typescript/src/types/recycler/RecyclerItemRenderer.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/RecyclerListProps.d.ts +66 -0
- package/lib/typescript/src/types/recycler/RecyclerListProps.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/utils/arrayEqual.d.ts +2 -0
- package/lib/typescript/src/utils/arrayEqual.d.ts.map +1 -0
- package/lib/typescript/src/utils/assertNever.d.ts +2 -0
- package/lib/typescript/src/utils/assertNever.d.ts.map +1 -0
- package/lib/typescript/src/utils/clamp.d.ts +2 -0
- package/lib/typescript/src/utils/clamp.d.ts.map +1 -0
- package/lib/typescript/src/utils/devAssert.d.ts +2 -0
- package/lib/typescript/src/utils/devAssert.d.ts.map +1 -0
- package/lib/typescript/src/utils/invariant.d.ts +2 -0
- package/lib/typescript/src/utils/invariant.d.ts.map +1 -0
- package/lib/typescript/src/utils/isDefined.d.ts +2 -0
- package/lib/typescript/src/utils/isDefined.d.ts.map +1 -0
- package/lib/typescript/src/utils/isNumber.d.ts +2 -0
- package/lib/typescript/src/utils/isNumber.d.ts.map +1 -0
- package/lib/typescript/src/utils/noop.d.ts +2 -0
- package/lib/typescript/src/utils/noop.d.ts.map +1 -0
- package/lib/typescript/src/utils/shallowEqual.d.ts +2 -0
- package/lib/typescript/src/utils/shallowEqual.d.ts.map +1 -0
- package/lib/typescript/src/utils/throttle.d.ts +2 -0
- package/lib/typescript/src/utils/throttle.d.ts.map +1 -0
- package/lib/typescript/src/windowing/ScrollMetrics.d.ts +11 -0
- package/lib/typescript/src/windowing/ScrollMetrics.d.ts.map +1 -0
- package/lib/typescript/src/windowing/computeVisibleItemRange.d.ts +15 -0
- package/lib/typescript/src/windowing/computeVisibleItemRange.d.ts.map +1 -0
- package/lib/typescript/src/windowing/index.d.ts +4 -0
- package/lib/typescript/src/windowing/index.d.ts.map +1 -0
- package/lib/typescript/src/windowing/useScrollMetrics.d.ts +14 -0
- package/lib/typescript/src/windowing/useScrollMetrics.d.ts.map +1 -0
- package/nitro.json +20 -13
- package/nitrogen/generated/android/NitroList+autolinking.cmake +2 -4
- package/nitrogen/generated/android/NitroListOnLoad.cpp +3 -13
- package/nitrogen/generated/android/c++/JHybridNitroLayoutEngineSpec.cpp +69 -0
- package/nitrogen/generated/android/c++/{JHybridNitroListSpec.hpp → JHybridNitroLayoutEngineSpec.hpp} +12 -13
- package/nitrogen/generated/android/c++/JLayoutRect.hpp +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/{HybridNitroListSpec.kt → HybridNitroLayoutEngineSpec.kt} +11 -13
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/LayoutRect.kt +47 -0
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.cpp +9 -9
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.hpp +50 -13
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Umbrella.hpp +11 -5
- package/nitrogen/generated/ios/c++/{HybridNitroListSpecSwift.cpp → HybridNitroLayoutEngineSpecSwift.cpp} +2 -2
- package/nitrogen/generated/ios/c++/HybridNitroLayoutEngineSpecSwift.hpp +78 -0
- package/nitrogen/generated/ios/swift/HybridNitroLayoutEngineSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/{HybridNitroListSpec_cxx.swift → HybridNitroLayoutEngineSpec_cxx.swift} +35 -38
- package/nitrogen/generated/ios/swift/LayoutRect.swift +45 -0
- package/nitrogen/generated/shared/c++/{HybridNitroListSpec.cpp → HybridNitroLayoutEngineSpec.cpp} +4 -5
- package/nitrogen/generated/shared/c++/{HybridNitroListSpec.hpp → HybridNitroLayoutEngineSpec.hpp} +15 -14
- package/nitrogen/generated/shared/c++/LayoutRect.hpp +95 -0
- package/package.json +12 -4
- package/src/NitroList.ts +8 -0
- package/src/ReusableView.ts +12 -0
- package/src/cell/Cell.ts +23 -0
- package/src/cell/CellKeyGenerator.ts +17 -0
- package/src/cell/CellRecycler.ts +76 -0
- package/src/cell/createCell.ts +15 -0
- package/src/cell/index.ts +5 -0
- package/src/debug/useDebugOverlay.ts +14 -0
- package/src/getVisibleIndices.ts +55 -0
- package/src/hooks/usePersistentCallback.ts +37 -0
- package/src/index.ts +1 -14
- package/src/layout/MutableLinearLayout.ts +112 -0
- package/src/layout/constants/layoutDefaults.ts +12 -0
- package/src/layout/index.ts +1 -0
- package/src/measurement/MeasureLayout.ts +20 -0
- package/src/measurement/useItemMeasurement.ts +32 -0
- package/src/native/NitroLayoutEngine.ts +7 -0
- package/src/native/NitroList.types.ts +13 -0
- package/src/native/NitroRecyclerView.ts +8 -0
- package/src/prefetch/PrefetchHelper.ts +47 -0
- package/src/recycler/CellPool.ts +47 -0
- package/src/recycler/RecyclerList.tsx +304 -0
- package/src/specs/nitro-layout-engine.nitro.ts +17 -0
- package/src/types/Axis.ts +10 -0
- package/src/types/CellKey.ts +9 -0
- package/src/types/CellType.ts +10 -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/RecyclerCellInstance.ts +40 -0
- package/src/types/recycler/RecyclerItemRenderer.ts +8 -0
- package/src/types/recycler/RecyclerListProps.ts +74 -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/utils/arrayEqual.ts +13 -0
- package/src/utils/assertNever.ts +3 -0
- package/src/utils/clamp.ts +7 -0
- package/src/utils/devAssert.ts +8 -0
- package/src/utils/invariant.ts +8 -0
- package/src/utils/isDefined.ts +5 -0
- package/src/utils/isNumber.ts +3 -0
- package/src/utils/noop.ts +3 -0
- package/src/utils/shallowEqual.ts +34 -0
- package/src/utils/throttle.ts +13 -0
- package/src/windowing/ScrollMetrics.ts +11 -0
- package/src/windowing/computeVisibleItemRange.ts +78 -0
- package/src/windowing/index.ts +3 -0
- package/src/windowing/useScrollMetrics.ts +56 -0
- package/android/src/main/java/com/nitrolist/HybridNitroList.kt +0 -27
- package/lib/module/specs/nitro-list.nitro.js +0 -4
- package/lib/typescript/src/specs/nitro-list.nitro.d.ts +0 -11
- package/lib/typescript/src/specs/nitro-list.nitro.d.ts.map +0 -1
- package/nitrogen/generated/android/c++/JHybridNitroListSpec.cpp +0 -56
- package/nitrogen/generated/android/c++/views/JHybridNitroListStateUpdater.cpp +0 -56
- package/nitrogen/generated/android/c++/views/JHybridNitroListStateUpdater.hpp +0 -49
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/views/HybridNitroListManager.kt +0 -50
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/views/HybridNitroListStateUpdater.kt +0 -23
- package/nitrogen/generated/ios/NitroListAutolinking.mm +0 -33
- package/nitrogen/generated/ios/NitroListAutolinking.swift +0 -25
- package/nitrogen/generated/ios/c++/HybridNitroListSpecSwift.hpp +0 -74
- package/nitrogen/generated/ios/c++/views/HybridNitroListComponent.mm +0 -96
- package/nitrogen/generated/ios/swift/HybridNitroListSpec.swift +0 -56
- package/nitrogen/generated/shared/c++/views/HybridNitroListComponent.cpp +0 -88
- package/nitrogen/generated/shared/c++/views/HybridNitroListComponent.hpp +0 -107
- package/nitrogen/generated/shared/json/NitroListConfig.json +0 -10
- package/src/specs/nitro-list.nitro.ts +0 -13
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LayoutRect } from './layout/LayoutRect';
|
|
2
|
+
/**
|
|
3
|
+
* Input required to compute the visible item range.
|
|
4
|
+
*
|
|
5
|
+
* Pure contract:
|
|
6
|
+
* - No logic
|
|
7
|
+
* - No platform assumptions
|
|
8
|
+
* - Safe to share with native / tests
|
|
9
|
+
*/
|
|
10
|
+
export interface VisibleRangeInput {
|
|
11
|
+
/**
|
|
12
|
+
* Ordered, monotonic layouts along the main axis.
|
|
13
|
+
* Required for binary search correctness.
|
|
14
|
+
*/
|
|
15
|
+
readonly layouts: readonly LayoutRect[];
|
|
16
|
+
/**
|
|
17
|
+
* Scroll offset along the main axis.
|
|
18
|
+
*/
|
|
19
|
+
readonly offset: number;
|
|
20
|
+
/**
|
|
21
|
+
* Viewport size along the main axis.
|
|
22
|
+
*/
|
|
23
|
+
readonly viewportSize: number;
|
|
24
|
+
/**
|
|
25
|
+
* Extra buffer before and after the viewport.
|
|
26
|
+
*/
|
|
27
|
+
readonly buffer: number;
|
|
28
|
+
/**
|
|
29
|
+
* Axis selector.
|
|
30
|
+
* true → vertical
|
|
31
|
+
* false → horizontal
|
|
32
|
+
*/
|
|
33
|
+
readonly isVertical: boolean;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=VisibleRangeInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisibleRangeInput.d.ts","sourceRoot":"","sources":["../../../../src/types/VisibleRangeInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAA;IAEvC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IAEvB;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAE7B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IAEvB;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;CAC7B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { Axis } from './Axis';
|
|
2
|
+
export type { MainAxisPadding, } from './layout/MainAxisPadding';
|
|
3
|
+
export { ZERO_MAIN_AXIS_PADDING, } from './layout/MainAxisPadding';
|
|
4
|
+
export type { LayoutRect } from './layout/LayoutRect';
|
|
5
|
+
export type { VisibleRange } from './VisibleRange';
|
|
6
|
+
export type { CellKey } from './CellKey';
|
|
7
|
+
export type { CellType } from './CellType';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAElC,YAAY,EACV,eAAe,GAChB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,sBAAsB,GACvB,MAAM,0BAA0B,CAAA;AAEjC,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACxC,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute layout rectangle.
|
|
3
|
+
*
|
|
4
|
+
* Cross-platform equivalent of:
|
|
5
|
+
* - Flutter: Rect
|
|
6
|
+
* - Android: Rect
|
|
7
|
+
* - iOS: CGRect
|
|
8
|
+
*/
|
|
9
|
+
export interface LayoutRect {
|
|
10
|
+
readonly x: number;
|
|
11
|
+
readonly y: number;
|
|
12
|
+
readonly width: number;
|
|
13
|
+
readonly height: number;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=LayoutRect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutRect.d.ts","sourceRoot":"","sources":["../../../../../src/types/layout/LayoutRect.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MainAxisPadding } from './MainAxisPadding';
|
|
2
|
+
export interface LinearLayoutInput {
|
|
3
|
+
readonly crossAxisSize: number;
|
|
4
|
+
readonly itemMainAxisSizes: readonly number[];
|
|
5
|
+
/** Padding before/after content (main axis) */
|
|
6
|
+
readonly padding: MainAxisPadding;
|
|
7
|
+
/** Space BETWEEN items (main axis) */
|
|
8
|
+
readonly itemSpacing?: number;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=LinearLayoutInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinearLayoutInput.d.ts","sourceRoot":"","sources":["../../../../../src/types/layout/LinearLayoutInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAA;IAE7C,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;IAEjC,sCAAsC;IACtC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Padding applied along the main scroll axis.
|
|
3
|
+
*
|
|
4
|
+
* This is a layout-level concept (not visual styling).
|
|
5
|
+
*
|
|
6
|
+
* - vertical → top / bottom
|
|
7
|
+
* - horizontal → left / right
|
|
8
|
+
*
|
|
9
|
+
* Uses start/end to remain RTL-safe and platform-neutral.
|
|
10
|
+
*/
|
|
11
|
+
export interface MainAxisPadding {
|
|
12
|
+
readonly start: number;
|
|
13
|
+
readonly end: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Shared zero-padding constant.
|
|
17
|
+
* Safe to reuse across layouts.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ZERO_MAIN_AXIS_PADDING: MainAxisPadding;
|
|
20
|
+
//# sourceMappingURL=MainAxisPadding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MainAxisPadding.d.ts","sourceRoot":"","sources":["../../../../../src/types/layout/MainAxisPadding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,eAGpC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/types/layout/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CellKey } from "../CellKey";
|
|
2
|
+
import type { CellType } from "../CellType";
|
|
3
|
+
/**
|
|
4
|
+
* Physical reusable cell instance.
|
|
5
|
+
*
|
|
6
|
+
* Represents a single mounted view that can be rebound
|
|
7
|
+
* to different data items as scrolling occurs.
|
|
8
|
+
*
|
|
9
|
+
* Cross-platform equivalent:
|
|
10
|
+
* - Flutter: Element / RenderObject
|
|
11
|
+
* - Android: ViewHolder
|
|
12
|
+
* - iOS: UICollectionViewCell
|
|
13
|
+
*/
|
|
14
|
+
export interface RecyclerCellInstance {
|
|
15
|
+
/**
|
|
16
|
+
* Stable physical identity.
|
|
17
|
+
*
|
|
18
|
+
* Used as React key.
|
|
19
|
+
* MUST remain constant for the lifetime of the instance.
|
|
20
|
+
*/
|
|
21
|
+
readonly key: CellKey;
|
|
22
|
+
/**
|
|
23
|
+
* Logical data index currently bound to this instance.
|
|
24
|
+
*
|
|
25
|
+
* This value changes as the cell is recycled.
|
|
26
|
+
* - -1 may be used to indicate "unbound".
|
|
27
|
+
*/
|
|
28
|
+
index: number;
|
|
29
|
+
/**
|
|
30
|
+
* Logical compatibility type.
|
|
31
|
+
*
|
|
32
|
+
* Determines which instances can be reused together.
|
|
33
|
+
* Instances with different types MUST NOT be reused.
|
|
34
|
+
*/
|
|
35
|
+
readonly type: CellType;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=RecyclerCellInstance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecyclerCellInstance.d.ts","sourceRoot":"","sources":["../../../../../src/types/recycler/RecyclerCellInstance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAG3C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;IAErB;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CACxB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { RecyclerCellInstance } from './RecyclerCellInstance';
|
|
3
|
+
export type RecyclerItemRenderer<T> = (params: {
|
|
4
|
+
item: T;
|
|
5
|
+
index: number;
|
|
6
|
+
cell: RecyclerCellInstance;
|
|
7
|
+
}) => ReactNode;
|
|
8
|
+
//# sourceMappingURL=RecyclerItemRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecyclerItemRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/types/recycler/RecyclerItemRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAElE,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE;IAC7C,IAAI,EAAE,CAAC,CAAA;IACP,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,oBAAoB,CAAA;CAC3B,KAAK,SAAS,CAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Axis } from '../Axis';
|
|
2
|
+
import type { CellType } from '../CellType';
|
|
3
|
+
import type { MainAxisPadding } from '../layout';
|
|
4
|
+
import type { RecyclerItemRenderer } from './RecyclerItemRenderer';
|
|
5
|
+
/**
|
|
6
|
+
* Public props for RecyclerList.
|
|
7
|
+
*
|
|
8
|
+
* Generic, data-driven, layout-deterministic API.
|
|
9
|
+
* This surface is intentionally minimal and stable.
|
|
10
|
+
*/
|
|
11
|
+
export interface RecyclerListProps<T> {
|
|
12
|
+
/**
|
|
13
|
+
* Scroll direction.
|
|
14
|
+
* Defaults to 'vertical'.
|
|
15
|
+
*/
|
|
16
|
+
readonly scrollDirection?: Axis;
|
|
17
|
+
/**
|
|
18
|
+
* Cross-axis size.
|
|
19
|
+
* - vertical → width
|
|
20
|
+
* - horizontal → height
|
|
21
|
+
*
|
|
22
|
+
* Required for deterministic layout.
|
|
23
|
+
*/
|
|
24
|
+
readonly containerCrossAxisSize: number;
|
|
25
|
+
/**
|
|
26
|
+
* Data source.
|
|
27
|
+
* Length is the single source of truth for item count.
|
|
28
|
+
*/
|
|
29
|
+
readonly data: readonly T[];
|
|
30
|
+
/**
|
|
31
|
+
* Item sizes along the main axis.
|
|
32
|
+
* Must match data length.
|
|
33
|
+
*
|
|
34
|
+
* - vertical → heights
|
|
35
|
+
* - horizontal → widths
|
|
36
|
+
*/
|
|
37
|
+
readonly itemMainAxisSizes: readonly number[];
|
|
38
|
+
/**
|
|
39
|
+
* Padding before and after content along the main axis.
|
|
40
|
+
*
|
|
41
|
+
* Defaults are applied internally by the layout engine.
|
|
42
|
+
*/
|
|
43
|
+
readonly padding?: MainAxisPadding;
|
|
44
|
+
/**
|
|
45
|
+
* Space BETWEEN items along the main axis.
|
|
46
|
+
*
|
|
47
|
+
* Defaults are applied internally by the layout engine.
|
|
48
|
+
*/
|
|
49
|
+
readonly itemSpacing?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Extra render buffer as a ratio of viewport size.
|
|
52
|
+
* Used for overscan / pre-rendering.
|
|
53
|
+
*/
|
|
54
|
+
readonly bufferRatio?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Logical cell type resolver.
|
|
57
|
+
* Determines recycling compatibility.
|
|
58
|
+
*/
|
|
59
|
+
readonly getCellType: (item: T, index: number) => CellType;
|
|
60
|
+
/**
|
|
61
|
+
* Item renderer.
|
|
62
|
+
* Receives stable cell identity and data.
|
|
63
|
+
*/
|
|
64
|
+
readonly renderItem: RecyclerItemRenderer<T>;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=RecyclerListProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecyclerListProps.d.ts","sourceRoot":"","sources":["../../../../../src/types/recycler/RecyclerListProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAElE;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;IAE/B;;;;;;OAMG;IACH,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAA;IAEvC;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,CAAA;IAE3B;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAA;IAE7C;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAA;IAElC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAE7B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAE7B;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,QAAQ,CAAA;IAE1D;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAA;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/types/recycler/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAClE,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Axis } from "../Axis";
|
|
2
|
+
/**
|
|
3
|
+
* Scroll state snapshot.
|
|
4
|
+
*
|
|
5
|
+
* Pure data — no platform or React coupling.
|
|
6
|
+
*/
|
|
7
|
+
export interface ScrollMetrics {
|
|
8
|
+
/** Scroll axis */
|
|
9
|
+
readonly axis: Axis;
|
|
10
|
+
/** Offset along the main axis */
|
|
11
|
+
readonly offset: number;
|
|
12
|
+
/** Viewport size along the main axis */
|
|
13
|
+
readonly viewportSize: number;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ScrollMetrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollMetrics.d.ts","sourceRoot":"","sources":["../../../../../src/types/scroll/ScrollMetrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAGnC;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kBAAkB;IAClB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IAEnB,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IAEvB,wCAAwC;IACxC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/types/scroll/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrayEqual.d.ts","sourceRoot":"","sources":["../../../../src/utils/arrayEqual.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,CAAC,EAC1B,CAAC,EAAE,SAAS,CAAC,EAAE,EACf,CAAC,EAAE,SAAS,CAAC,EAAE,GACd,OAAO,CAST"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertNever.d.ts","sourceRoot":"","sources":["../../../../src/utils/assertNever.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK,CAE3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clamp.d.ts","sourceRoot":"","sources":["../../../../src/utils/clamp.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CACnB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,MAAM,CAER"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devAssert.d.ts","sourceRoot":"","sources":["../../../../src/utils/devAssert.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CACvB,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,MAAM,GACd,IAAI,CAIN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariant.d.ts","sourceRoot":"","sources":["../../../../src/utils/invariant.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CACvB,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,CAInB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isDefined.d.ts","sourceRoot":"","sources":["../../../../src/utils/isDefined.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,CAAC,EACzB,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,IAAI,GAC1B,KAAK,IAAI,CAAC,CAEZ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isNumber.d.ts","sourceRoot":"","sources":["../../../../src/utils/isNumber.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop.d.ts","sourceRoot":"","sources":["../../../../src/utils/noop.ts"],"names":[],"mappings":"AAAA,wBAAgB,IAAI,IAAI,IAAI,CAE3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shallowEqual.d.ts","sourceRoot":"","sources":["../../../../src/utils/shallowEqual.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAC1B,CAAC,EAAE,OAAO,EACV,CAAC,EAAE,OAAO,GACT,OAAO,CA8BT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../../../src/utils/throttle.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,EAC3D,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,MAAM,GACT,CAAC,CASH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollMetrics.d.ts","sourceRoot":"","sources":["../../../../src/windowing/ScrollMetrics.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAA;IAEf,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAA;CACf"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { VisibleRange } from '../types/VisibleRange';
|
|
2
|
+
import type { VisibleRangeInput } from '../types/VisibleRangeInput';
|
|
3
|
+
/**
|
|
4
|
+
* Computes the visible item index range using binary search.
|
|
5
|
+
*
|
|
6
|
+
* Responsibilities:
|
|
7
|
+
* - Determine which items intersect the visible window
|
|
8
|
+
* - Stay independent of rendering and recycling
|
|
9
|
+
*
|
|
10
|
+
* Performance:
|
|
11
|
+
* - O(log n) to locate the first visible item
|
|
12
|
+
* - O(k) to expand to the last visible item (k = visible count)
|
|
13
|
+
*/
|
|
14
|
+
export declare function computeVisibleItemRange(input: VisibleRangeInput): VisibleRange | null;
|
|
15
|
+
//# sourceMappingURL=computeVisibleItemRange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeVisibleItemRange.d.ts","sourceRoot":"","sources":["../../../../src/windowing/computeVisibleItemRange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAEnE;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,iBAAiB,GACvB,YAAY,GAAG,IAAI,CA6DrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/windowing/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent } from 'react-native';
|
|
2
|
+
import type { ScrollMetrics } from './ScrollMetrics';
|
|
3
|
+
/**
|
|
4
|
+
* Scroll metrics hook.
|
|
5
|
+
* Provides stable scroll snapshot + handlers.
|
|
6
|
+
*
|
|
7
|
+
* FlashList equivalent: useScrollMetrics
|
|
8
|
+
*/
|
|
9
|
+
export declare function useScrollMetrics(): {
|
|
10
|
+
metrics: ScrollMetrics;
|
|
11
|
+
onScroll: (e: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
12
|
+
onLayout: (e: LayoutChangeEvent) => void;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useScrollMetrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollMetrics.d.ts","sourceRoot":"","sources":["../../../../src/windowing/useScrollMetrics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI;IAClC,OAAO,EAAE,aAAa,CAAA;IACtB,QAAQ,EAAE,CAAC,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC9D,QAAQ,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAA;CACzC,CAqCA"}
|
package/nitro.json
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://nitro.margelo.com/nitro.schema.json",
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
|
|
4
|
+
"cxxNamespace": ["nitrolist"],
|
|
5
|
+
|
|
6
6
|
"ios": {
|
|
7
7
|
"iosModuleName": "NitroList"
|
|
8
8
|
},
|
|
9
|
+
|
|
9
10
|
"android": {
|
|
10
|
-
"androidNamespace": [
|
|
11
|
-
"nitrolist"
|
|
12
|
-
],
|
|
11
|
+
"androidNamespace": ["nitrolist"],
|
|
13
12
|
"androidCxxLibName": "NitroList"
|
|
14
13
|
},
|
|
14
|
+
|
|
15
15
|
"autolinking": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
16
|
+
"views": {
|
|
17
|
+
"NitroListView": {
|
|
18
|
+
"swift": "HybridNitroList",
|
|
19
|
+
"kotlin": "HybridNitroList"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"objects": {
|
|
23
|
+
"NitroLayoutEngine": {
|
|
24
|
+
"swift": "HybridNitroLayoutEngine",
|
|
25
|
+
"kotlin": "HybridNitroLayoutEngine"
|
|
26
|
+
}
|
|
19
27
|
}
|
|
20
28
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
29
|
+
|
|
30
|
+
"ignorePaths": ["**/node_modules"]
|
|
31
|
+
}
|
|
@@ -33,11 +33,9 @@ target_sources(
|
|
|
33
33
|
# Autolinking Setup
|
|
34
34
|
../nitrogen/generated/android/NitroListOnLoad.cpp
|
|
35
35
|
# Shared Nitrogen C++ sources
|
|
36
|
-
../nitrogen/generated/shared/c++/
|
|
37
|
-
../nitrogen/generated/shared/c++/views/HybridNitroListComponent.cpp
|
|
36
|
+
../nitrogen/generated/shared/c++/HybridNitroLayoutEngineSpec.cpp
|
|
38
37
|
# Android-specific Nitrogen C++ sources
|
|
39
|
-
../nitrogen/generated/android/c++/
|
|
40
|
-
../nitrogen/generated/android/c++/views/JHybridNitroListStateUpdater.cpp
|
|
38
|
+
../nitrogen/generated/android/c++/JHybridNitroLayoutEngineSpec.cpp
|
|
41
39
|
)
|
|
42
40
|
|
|
43
41
|
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
#include <fbjni/fbjni.h>
|
|
16
16
|
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
17
|
|
|
18
|
-
#include "
|
|
19
|
-
#include "views/JHybridNitroListStateUpdater.hpp"
|
|
20
|
-
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
18
|
+
#include "JHybridNitroLayoutEngineSpec.hpp"
|
|
21
19
|
|
|
22
20
|
namespace margelo::nitro::nitrolist {
|
|
23
21
|
|
|
@@ -28,18 +26,10 @@ int initialize(JavaVM* vm) {
|
|
|
28
26
|
|
|
29
27
|
return facebook::jni::initialize(vm, [] {
|
|
30
28
|
// Register native JNI methods
|
|
31
|
-
margelo::nitro::nitrolist::
|
|
32
|
-
margelo::nitro::nitrolist::views::JHybridNitroListStateUpdater::registerNatives();
|
|
29
|
+
margelo::nitro::nitrolist::JHybridNitroLayoutEngineSpec::registerNatives();
|
|
33
30
|
|
|
34
31
|
// Register Nitro Hybrid Objects
|
|
35
|
-
|
|
36
|
-
"NitroList",
|
|
37
|
-
[]() -> std::shared_ptr<HybridObject> {
|
|
38
|
-
static DefaultConstructableObject<JHybridNitroListSpec::javaobject> object("com/nitrolist/HybridNitroList");
|
|
39
|
-
auto instance = object.create();
|
|
40
|
-
return instance->cthis()->shared();
|
|
41
|
-
}
|
|
42
|
-
);
|
|
32
|
+
|
|
43
33
|
});
|
|
44
34
|
}
|
|
45
35
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridNitroLayoutEngineSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "JHybridNitroLayoutEngineSpec.hpp"
|
|
9
|
+
|
|
10
|
+
// Forward declaration of `LayoutRect` to properly resolve imports.
|
|
11
|
+
namespace margelo::nitro::nitrolist { struct LayoutRect; }
|
|
12
|
+
|
|
13
|
+
#include "LayoutRect.hpp"
|
|
14
|
+
#include <vector>
|
|
15
|
+
#include "JLayoutRect.hpp"
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::nitrolist {
|
|
18
|
+
|
|
19
|
+
jni::local_ref<JHybridNitroLayoutEngineSpec::jhybriddata> JHybridNitroLayoutEngineSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
20
|
+
return makeCxxInstance(jThis);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void JHybridNitroLayoutEngineSpec::registerNatives() {
|
|
24
|
+
registerHybrid({
|
|
25
|
+
makeNativeMethod("initHybrid", JHybridNitroLayoutEngineSpec::initHybrid),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
size_t JHybridNitroLayoutEngineSpec::getExternalMemorySize() noexcept {
|
|
30
|
+
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
31
|
+
return method(_javaPart);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void JHybridNitroLayoutEngineSpec::dispose() noexcept {
|
|
35
|
+
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
36
|
+
method(_javaPart);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
std::string JHybridNitroLayoutEngineSpec::toString() {
|
|
40
|
+
static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
|
|
41
|
+
auto javaString = method(_javaPart);
|
|
42
|
+
return javaString->toStdString();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Properties
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// Methods
|
|
49
|
+
std::vector<LayoutRect> JHybridNitroLayoutEngineSpec::computeLayout(double containerWidth, const std::vector<double>& itemHeights) {
|
|
50
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<JLayoutRect>>(double /* containerWidth */, jni::alias_ref<jni::JArrayDouble> /* itemHeights */)>("computeLayout");
|
|
51
|
+
auto __result = method(_javaPart, containerWidth, [&]() {
|
|
52
|
+
size_t __size = itemHeights.size();
|
|
53
|
+
jni::local_ref<jni::JArrayDouble> __array = jni::JArrayDouble::newArray(__size);
|
|
54
|
+
__array->setRegion(0, __size, itemHeights.data());
|
|
55
|
+
return __array;
|
|
56
|
+
}());
|
|
57
|
+
return [&]() {
|
|
58
|
+
size_t __size = __result->size();
|
|
59
|
+
std::vector<LayoutRect> __vector;
|
|
60
|
+
__vector.reserve(__size);
|
|
61
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
62
|
+
auto __element = __result->getElement(__i);
|
|
63
|
+
__vector.push_back(__element->toCpp());
|
|
64
|
+
}
|
|
65
|
+
return __vector;
|
|
66
|
+
}();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
} // namespace margelo::nitro::nitrolist
|