Skip to content

Commit

Permalink
fix: grid snapshot types are correctly exported
Browse files Browse the repository at this point in the history
  • Loading branch information
petyosi committed Jul 24, 2023
1 parent 16b418b commit 5b8d062
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ examples/__examples.html
.parcel-cache
.docusaurus
/docs/api
react-virtuoso-0.0.0-development.tgz
18 changes: 17 additions & 1 deletion src/component-interfaces/VirtuosoGrid.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { GridStateSnapshot } from '../gridSystem'
import type {
GridComponents,
GridComputeItemKey,
Expand All @@ -10,6 +9,23 @@ import type {
} from '../interfaces'
import { LogLevel } from '../loggerSystem'

export interface Gap {
row: number
column: number
}

export interface ElementDimensions {
width: number
height: number
}

export interface GridStateSnapshot {
viewport: ElementDimensions
item: ElementDimensions
gap: Gap
scrollTop: number
}

export interface VirtuosoGridProps<D, C = unknown> extends GridRootProps {
/**
* The total amount of items to be rendered.
Expand Down
18 changes: 1 addition & 17 deletions src/gridSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,10 @@ import { loggerSystem } from './loggerSystem'
import { windowScrollerSystem } from './windowScrollerSystem'
import { getInitialTopMostItemIndexNumber } from './initialTopMostItemIndexSystem'
import { skipFrames } from './utils/skipFrames'
import { ElementDimensions, Gap, GridStateSnapshot } from './component-interfaces/VirtuosoGrid'

export type Data = unknown[] | null

export interface Gap {
row: number
column: number
}

export interface ElementDimensions {
width: number
height: number
}

export interface GridLayout {
top: number
bottom: number
Expand Down Expand Up @@ -80,13 +71,6 @@ function dimensionComparator(prev: ElementDimensions, next: ElementDimensions) {
return prev && prev.width === next.width && prev.height === next.height
}

export interface GridStateSnapshot {
viewport: ElementDimensions
item: ElementDimensions
gap: Gap
scrollTop: number
}

export const gridSystem = /*#__PURE__*/ u.system(
([
{ overscan, visibleRange, listBoundary },
Expand Down

0 comments on commit 5b8d062

Please sign in to comment.