@af-utils/virtual-react
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -1,4 +0,4 @@ | ||
export declare const raw = 5592; | ||
export declare const min = 2380; | ||
export declare const minGz = 1164; | ||
export declare const minBrotli = 1040; | ||
export declare const raw = 5570; | ||
export declare const min = 2361; | ||
export declare const minGz = 1149; | ||
export declare const minBrotli = 1017; |
@@ -1,4 +0,4 @@ | ||
export const raw = 5592; | ||
export const min = 2380; | ||
export const minGz = 1164; | ||
export const minBrotli = 1040; | ||
export const raw = 5570; | ||
export const min = 2361; | ||
export const minGz = 1149; | ||
export const minBrotli = 1017; |
@@ -11,6 +11,6 @@ /** | ||
import type { ReactNode } from 'react'; | ||
import type { ScrollElement } from '@af-utils/virtual-core'; | ||
import { VirtualScroller } from '@af-utils/virtual-core'; | ||
import { VirtualScrollerEvent } from '@af-utils/virtual-core'; | ||
import { VirtualScrollerInitialParams } from '@af-utils/virtual-core'; | ||
import type { VirtualScrollerScrollElement } from '@af-utils/virtual-core'; | ||
@@ -87,3 +87,3 @@ /** | ||
children: () => ReactNode; | ||
events?: readonly VirtualScrollerEvent[] | VirtualScrollerEvent[]; | ||
events: readonly VirtualScrollerEvent[] | VirtualScrollerEvent[]; | ||
} | ||
@@ -97,3 +97,3 @@ | ||
*/ | ||
export declare const useComponentSubscription: (model: VirtualScroller, events?: readonly VirtualScrollerEvent[] | VirtualScrollerEvent[]) => void; | ||
export declare const useComponentSubscription: (model: VirtualScroller, events: readonly VirtualScrollerEvent[] | VirtualScrollerEvent[]) => void; | ||
@@ -108,3 +108,3 @@ /** | ||
*/ | ||
export declare const useScroller: (model: VirtualScroller, scroller: ScrollElement | null) => void; | ||
export declare const useScroller: (model: VirtualScroller, scroller: VirtualScrollerScrollElement | null) => void; | ||
@@ -111,0 +111,0 @@ /** |
@@ -5,5 +5,5 @@ import { jsxs as t, jsx as e } from "react/jsx-runtime"; | ||
import { VirtualScrollerEvent as c, _ALL_EVENTS as a, VirtualScroller as h } from "@af-utils/virtual-core"; | ||
import { VirtualScrollerEvent as c, VirtualScroller as a } from "@af-utils/virtual-core"; | ||
import { useSyncExternalStore as f } from "use-sync-external-store/shim"; | ||
import { useSyncExternalStore as h } from "use-sync-external-store/shim"; | ||
@@ -15,11 +15,11 @@ /** | ||
* @param cb - callback, returning ONLY ONE react element | ||
*/ const d = (t, e) => { | ||
*/ const f = (t, e) => { | ||
const o = []; | ||
for (let r = t.from, n = t.to; n > r; r++) o.push(e(r)); | ||
return o; | ||
}, u = (t, e) => { | ||
}, d = (t, e) => { | ||
const o = []; | ||
for (let r = t.from, n = t.to, i = t.getOffset(r); n > r; r++, i += t.getSize(r)) o.push(e(r, i)); | ||
return o; | ||
}, m = { | ||
}, u = { | ||
position: "relative", | ||
@@ -30,9 +30,9 @@ overflow: "hidden", | ||
zIndex: -1 | ||
}, m = { | ||
...u, | ||
height: "100%" | ||
}, p = { | ||
...m, | ||
height: "100%" | ||
...u, | ||
width: "100%" | ||
}, S = { | ||
...m, | ||
width: "100%" | ||
}, g = { | ||
position: "absolute", | ||
@@ -43,11 +43,11 @@ contain: "strict", | ||
left: 0 | ||
}, v = { | ||
...g, | ||
}, g = { | ||
...S, | ||
display: "flex", | ||
height: "100%" | ||
}, y = { | ||
...g, | ||
}, v = { | ||
...S, | ||
display: "block", | ||
width: "100%" | ||
}, x = t => { | ||
}, y = t => { | ||
const [e, n] = o(null), [i, s] = o(null); | ||
@@ -62,3 +62,3 @@ return r((() => { | ||
}), [ c.RANGE, c.SIZES ]); | ||
return Object.assign(e.style, t.horizontal ? p : S), Object.assign(i.style, t.horizontal ? v : y), | ||
return Object.assign(e.style, t.horizontal ? m : p), Object.assign(i.style, t.horizontal ? g : v), | ||
() => { | ||
@@ -80,3 +80,3 @@ o(), r(); | ||
* @param cb - callback, returning ONLY ONE react element | ||
*/ function z(t) { | ||
*/ function x(t) { | ||
switch (t) { | ||
@@ -100,7 +100,7 @@ case c.RANGE: | ||
* Usually {@link Subscription} is a better alternative | ||
*/ const w = (t, e = a) => { | ||
const [o, r] = n((() => [ o => t.on(o, e), () => e.map(z, t).join() ]), [ t, e ]); | ||
f(o, r, r); | ||
}, E = t => (w(t.model, t.events), t.children()), I = ({model: o, children: r, itemData: n, component: s, header: l = null, footer: a = null, getKey: h = (t => t), tabIndex: f = -1, style: u, ...m}) => { | ||
const p = s || "div", [S, g] = x(o); | ||
*/ const z = (t, e) => { | ||
const [o, r] = n((() => [ o => t.on(o, e), () => e.map(x, t).join() ]), [ t, e ]); | ||
h(o, r, r); | ||
}, w = t => (z(t.model, t.events), t.children()), E = ({model: o, children: r, itemData: n, component: s, header: l = null, footer: a = null, getKey: h = (t => t), tabIndex: d = -1, style: u, ...m}) => { | ||
const p = s || "div", [S, g] = y(o); | ||
return t(p, { | ||
@@ -114,3 +114,3 @@ ...m, | ||
ref: i((t => o.setScroller(t)), [ o ]), | ||
tabIndex: f, | ||
tabIndex: d, | ||
children: [ l, e("div", { | ||
@@ -120,6 +120,6 @@ ref: S, | ||
ref: g, | ||
children: e(E, { | ||
children: e(w, { | ||
model: o, | ||
events: [ c.RANGE ], | ||
children: () => d(o, (t => e(r, { | ||
children: () => f(o, (t => e(r, { | ||
model: o, | ||
@@ -133,3 +133,3 @@ i: t, | ||
}); | ||
}, O = process.env.__IS_SERVER__ ? s : r, R = (t, e) => O((() => (t.setScroller(e), | ||
}, I = process.env.__IS_SERVER__ ? s : r, O = (t, e) => I((() => (t.setScroller(e), | ||
() => t.setScroller(null))), [ t, e ]) | ||
@@ -147,3 +147,3 @@ /** | ||
* @param callBack - callback to be called | ||
*/ , _ = (t, e, o) => s((() => { | ||
*/ , R = (t, e, o) => s((() => { | ||
if (o) return o(), t.on(o, e); | ||
@@ -159,3 +159,3 @@ }), [ t, o, e ]) | ||
* @returns same {@link @af-utils/virtual-core#VirtualScroller} instance | ||
*/ , b = t => l().current ||= new h(t) | ||
*/ , _ = t => l().current ||= new a(t) | ||
/** | ||
@@ -167,5 +167,5 @@ * @public | ||
* @returns same {@link @af-utils/virtual-core#VirtualScroller} instance | ||
*/ , j = t => { | ||
const e = b(t); | ||
return O((() => e.set(t))), e; | ||
*/ , b = t => { | ||
const e = _(t); | ||
return I((() => e.set(t))), e; | ||
}; | ||
@@ -179,3 +179,3 @@ | ||
* Allows to optimize performance. | ||
*/ export { I as List, E as Subscription, d as mapVisibleRange, u as mapVisibleRangeWithOffset, w as useComponentSubscription, R as useScroller, _ as useSubscription, x as useSyncedStyles, j as useVirtual, b as useVirtualModel }; | ||
*/ export { E as List, w as Subscription, f as mapVisibleRange, d as mapVisibleRangeWithOffset, z as useComponentSubscription, O as useScroller, R as useSubscription, y as useSyncedStyles, b as useVirtual, _ as useVirtualModel }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@af-utils/virtual-react", | ||
"private": false, | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "React components and hooks for rendering large scrollable data", | ||
@@ -52,3 +52,3 @@ "repository": "https://github.com/nowaalex/af-utils.git", | ||
"dependencies": { | ||
"@af-utils/virtual-core": "0.0.8" | ||
"@af-utils/virtual-core": "0.0.9" | ||
}, | ||
@@ -55,0 +55,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29469
+ Added@af-utils/virtual-core@0.0.9(transitive)
- Removed@af-utils/virtual-core@0.0.8(transitive)
Updated@af-utils/virtual-core@0.0.9