35 lines
1.0 KiB
Plaintext
35 lines
1.0 KiB
Plaintext
"use strict";
|
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
function createLazyMeasurementsView(count, flat, getItemKey) {
|
|
const cache = new Array(count);
|
|
return new Proxy(cache, {
|
|
get(target, prop, receiver) {
|
|
if (typeof prop === "string") {
|
|
const c = prop.charCodeAt(0);
|
|
if (c >= 48 && c <= 57) {
|
|
const i = +prop;
|
|
if (Number.isInteger(i) && i >= 0 && i < count) {
|
|
let v = target[i];
|
|
if (!v) {
|
|
const s = flat[i * 2];
|
|
v = target[i] = {
|
|
index: i,
|
|
key: getItemKey(i),
|
|
start: s,
|
|
size: flat[i * 2 + 1],
|
|
end: s + flat[i * 2 + 1],
|
|
lane: 0
|
|
};
|
|
}
|
|
return v;
|
|
}
|
|
}
|
|
if (prop === "length") return count;
|
|
}
|
|
return Reflect.get(target, prop, receiver);
|
|
}
|
|
});
|
|
}
|
|
exports.createLazyMeasurementsView = createLazyMeasurementsView;
|
|
//# sourceMappingURL=lazy-measurements.cjs.map
|