Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vscroll

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscroll - npm Package Compare versions

Comparing version 1.3.4 to 1.4.0-alpha

dist/esm2015/classes/buffer/checkCall.js

21

dist/esm2015/classes/buffer.js
import { Cache } from './buffer/cache';
import { CheckBufferCall } from './buffer/checkCall';
import { Reactive } from './reactive';

@@ -12,2 +13,3 @@ import { Direction } from '../inputs/index';

this.cache = new Cache(settings, logger);
this.checkCall = new CheckBufferCall(this, logger);
this.startIndexUser = settings.startIndex;

@@ -181,2 +183,21 @@ this.minIndexUser = settings.minIndex;

}
insertVirtually(items, index, direction, fixRight) {
if (!this.checkCall.insert(items, index, direction)) {
return false;
}
let shift = 0;
if (index <= this.firstIndex && !fixRight) {
shift = items.length;
}
else if (index >= this.lastIndex && fixRight) {
shift = -items.length;
}
if (shift) {
this.items.forEach(item => item.updateIndex(item.$index + shift));
this.cache.insertItems(items, index, direction, fixRight);
this.items = [...this.items];
}
this.shiftExtremum(items.length, fixRight);
return true;
}
removeVirtually(indexes, fixRight) {

@@ -183,0 +204,0 @@ const length = this.items.length;

76

dist/esm2015/classes/buffer/cache.js
import { DefaultSize } from './defaultSize';
import { Direction } from '../../inputs/index';
export class ItemCache {
constructor(item, saveData) {
this.$index = item.$index;
this.nodeId = item.nodeId;
this.data = saveData ? item.data : null;

@@ -11,3 +11,2 @@ this.size = item.size;

this.$index = value;
this.nodeId = String(value);
}

@@ -43,3 +42,3 @@ }

const item = this.get(index);
return item ? item.size : this.defaultSize.get();
return item && item.size || this.defaultSize.get();
}

@@ -70,8 +69,8 @@ getDefaultSize() {

}
if (itemCache.size !== item.size) { // size changes
if (!isNaN(itemCache.size)) {
this.defaultSize.setExisted(itemCache, item);
if (itemCache.size !== item.size) {
if (itemCache.size) {
this.defaultSize.setExisted(itemCache.size, item.size);
}
else {
this.defaultSize.setNew(item);
this.defaultSize.setNew(item.size);
}

@@ -84,3 +83,3 @@ itemCache.size = item.size;

this.items.set(item.$index, itemCache);
this.defaultSize.setNew(itemCache);
this.defaultSize.setNew(item.size);
}

@@ -96,2 +95,57 @@ if (item.$index < this.minIndex) {

/**
* Inserts items to Set, shifts $indexes of items that remain.
* Replaces current Set with a new one with new regular $indexes.
* Maintains min/max indexes.
*
* @param {Data[]} toInsert List of non-indexed items to be inserted.
* @param {number} index The index before/after which the insertion is performed.
* @param {Direction} direction Determines the direction of insertion.
* @param {boolean} fixRight Defines indexes shifting strategy.
* If false, indexes that are greater than the inserted ones are increased.
* If true, indexes that are less than than the inserted ones are decreased.
*/
insertItems(toInsert, index, direction, fixRight) {
const items = new Map();
const length = toInsert.length;
let min = Infinity, max = -Infinity;
const set = (item) => {
items.set(item.$index, item);
min = item.$index < min ? item.$index : min;
max = item.$index > max ? item.$index : max;
};
this.items.forEach(item => {
let shift = 0;
if (direction === Direction.backward) {
if (item.$index < index && fixRight) {
shift = -length;
}
else if (item.$index >= index && !fixRight) {
shift = length;
}
}
else if (direction === Direction.forward) {
if (item.$index <= index && fixRight) {
shift = -length;
}
else if (item.$index > index && !fixRight) {
shift = length;
}
}
if (shift) {
item.changeIndex(item.$index + shift);
}
set(item);
});
if (this.saveData) { // persist data with no sizes
toInsert.forEach((data, i) => {
const $index = index + i - (fixRight ? length : 0) + (direction === Direction.forward ? 1 : 0);
const item = new ItemCache({ $index, data }, this.saveData);
set(item);
});
}
this.items = items;
this.minIndex = min;
this.maxIndex = max;
}
/**
* Removes items from Set, shifts $indexes of items that remain.

@@ -111,4 +165,4 @@ * Replaces current Set with a new one with new regular $indexes.

if (toRemove.some(index => index === item.$index)) {
if (!isNaN(item.size)) {
this.defaultSize.setRemoved(item);
if (item.size) {
this.defaultSize.setRemoved(item.size);
}

@@ -173,3 +227,3 @@ return;

.filter(item => item.toRemove)
.forEach(item => this.defaultSize.setRemoved(item));
.forEach(item => this.defaultSize.setRemoved(item.size));
this.minIndex += leftDiff;

@@ -176,0 +230,0 @@ this.maxIndex += rightDiff;

20

dist/esm2015/classes/buffer/defaultSize.js

@@ -104,27 +104,23 @@ import { SizeStrategy } from '../../inputs/index';

}
setExisted(oldItem, newItem) {
setExisted(oldSize, newSize) {
if (this.sizeStrategy !== SizeStrategy.Constant) {
this.recalculation.oldItems.push({
size: oldItem.size,
newSize: newItem.size
size: oldSize,
newSize
});
}
}
setNew(newItem) {
setNew(size) {
if (this.sizeStrategy !== SizeStrategy.Constant) {
this.recalculation.newItems.push({
size: newItem.size
});
this.recalculation.newItems.push({ size });
}
else {
if (!this.constantSize) {
this.constantSize = newItem.size;
this.constantSize = size;
}
}
}
setRemoved(oldItem) {
setRemoved(size) {
if (this.sizeStrategy !== SizeStrategy.Constant) {
this.recalculation.removed.push({
size: oldItem.size
});
this.recalculation.removed.push({ size });
}

@@ -131,0 +127,0 @@ }

@@ -55,3 +55,3 @@ import { CommonProcess, AdapterProcess, ProcessStatus as Status } from '../processes/index';

`consumer: ${packageInfo.consumer.name} v${packageInfo.consumer.version}, ` +
`workflow instance: ${settings.instanceIndex}, adapter ` +
`scroller instance: ${settings.instanceIndex}, adapter ` +
(!adapter ? 'is not instantiated' : `instance: ${adapter.id}`));

@@ -58,0 +58,0 @@ }

@@ -123,7 +123,2 @@ import { Direction } from '../../inputs/index';

}
remove() {
this.startSimulate([]);
this.doRemove = true;
// firstVisibleIndex & delta should be set inside process
}
update(index, delta, items, itemsToRemove) {

@@ -130,0 +125,0 @@ this.startSimulate(items);

@@ -107,2 +107,4 @@ import { VALIDATORS } from './validation';

AdapterInsertParams["after"] = "after";
AdapterInsertParams["beforeIndex"] = "beforeIndex";
AdapterInsertParams["afterIndex"] = "afterIndex";
AdapterInsertParams["decrease"] = "decrease";

@@ -116,7 +118,21 @@ })(AdapterInsertParams || (AdapterInsertParams = {}));

[AdapterInsertParams.before]: {
validators: [FUNC_WITH_X_ARGUMENTS(1), ONE_OF_MUST([AdapterInsertParams.after])]
validators: [FUNC_WITH_X_ARGUMENTS(1), ONE_OF_MUST([
AdapterInsertParams.after, AdapterInsertParams.beforeIndex, AdapterInsertParams.afterIndex
])]
},
[AdapterInsertParams.after]: {
validators: [FUNC_WITH_X_ARGUMENTS(1), ONE_OF_MUST([AdapterInsertParams.before])]
validators: [FUNC_WITH_X_ARGUMENTS(1), ONE_OF_MUST([
AdapterInsertParams.before, AdapterInsertParams.beforeIndex, AdapterInsertParams.afterIndex
])]
},
[AdapterInsertParams.beforeIndex]: {
validators: [INTEGER, ONE_OF_MUST([
AdapterInsertParams.before, AdapterInsertParams.after, AdapterInsertParams.afterIndex
])]
},
[AdapterInsertParams.afterIndex]: {
validators: [INTEGER, ONE_OF_MUST([
AdapterInsertParams.before, AdapterInsertParams.after, AdapterInsertParams.beforeIndex
])]
},
[AdapterInsertParams.decrease]: {

@@ -123,0 +139,0 @@ validators: [BOOLEAN],

@@ -113,4 +113,7 @@ export var ValidatorType;

const type = typeof value[0];
if (value.some((v) => typeof v !== type)) {
errors.push(getError(ValidatorType.itemList, ['of items of the same type']));
for (let i = value.length - 1; i >= 0; i--) {
if (typeof value[i] !== type) {
errors.push(getError(ValidatorType.itemList, ['of items of the same type']));
break;
}
}

@@ -117,0 +120,0 @@ }

import Update from './update';
import { BaseAdapterProcessFactory, AdapterProcess, ProcessStatus } from '../misc/index';
import { Direction } from '../../inputs/index';
export default class Insert extends BaseAdapterProcessFactory(AdapterProcess.insert) {

@@ -16,7 +17,17 @@ static run(scroller, options) {

static doInsert(scroller, params) {
const { before, after, items, decrease } = params;
const method = (before || after);
const found = scroller.buffer.items.find(item => method(item.get()));
if (!Insert.insertInBuffer(scroller, params)) {
if (!Insert.insertVirtually(scroller, params)) {
return false;
}
}
return true;
}
static insertInBuffer(scroller, params) {
const { before, after, beforeIndex, afterIndex, items, decrease } = params;
const index = Number.isInteger(beforeIndex) ? beforeIndex : (Number.isInteger(afterIndex) ? afterIndex : NaN);
const isBackward = Number.isInteger(beforeIndex) || before;
const method = before || after;
const found = scroller.buffer.items.find(item => (method && method(item.get())) || (Number.isInteger(index) && index === item.$index));
if (!found) {
scroller.logger.log('no item to insert found');
scroller.logger.log('no item to insert in buffer');
return false;

@@ -28,3 +39,3 @@ }

if (indexToInsert === $index) {
return before ? [...items, data] : [data, ...items];
return isBackward ? [...items, data] : [data, ...items];
}

@@ -37,3 +48,31 @@ return true;

}
static insertVirtually(scroller, params) {
const { beforeIndex, afterIndex, items, decrease } = params;
const { buffer, state: { fetch }, viewport } = scroller;
const direction = Number.isInteger(beforeIndex) ? Direction.backward : Direction.forward;
const index = (direction === Direction.backward ? beforeIndex : afterIndex);
if (isNaN(fetch.firstVisible.index)) { // if in-buffer insertion did not set firstVisible
const { index, diff } = viewport.getEdgeVisibleItem(buffer.items, Direction.backward);
fetch.firstVisible.index = index;
if (!isNaN(index)) {
fetch.firstVisible.delta = -buffer.getSizeByIndex(index) + diff;
}
}
if (!buffer.insertVirtually(items, index, direction, !!decrease)) {
return false;
}
const { firstVisible } = scroller.state.fetch;
if (!isNaN(firstVisible.index)) {
let shift = 0;
if (index < firstVisible.index && !decrease) {
shift = items.length;
}
else if (index > firstVisible.index && decrease) {
shift = -items.length;
}
firstVisible.index += shift;
}
return true;
}
}
//# sourceMappingURL=insert.js.map

@@ -37,5 +37,2 @@ import Update from './update';

}
if (!isNaN(fetch.firstVisible.index)) {
fetch.remove();
}
scroller.logger.stat('after remove');

@@ -42,0 +39,0 @@ return true;

export default {
name: 'vscroll',
version: '1.3.4'
version: '1.4.0-alpha'
};
//# sourceMappingURL=version.js.map
import { __read, __spreadArray } from "tslib";
import { Cache } from './buffer/cache';
import { CheckBufferCall } from './buffer/checkCall';
import { Reactive } from './reactive';

@@ -13,2 +14,3 @@ import { Direction } from '../inputs/index';

this.cache = new Cache(settings, logger);
this.checkCall = new CheckBufferCall(this, logger);
this.startIndexUser = settings.startIndex;

@@ -233,2 +235,21 @@ this.minIndexUser = settings.minIndex;

};
Buffer.prototype.insertVirtually = function (items, index, direction, fixRight) {
if (!this.checkCall.insert(items, index, direction)) {
return false;
}
var shift = 0;
if (index <= this.firstIndex && !fixRight) {
shift = items.length;
}
else if (index >= this.lastIndex && fixRight) {
shift = -items.length;
}
if (shift) {
this.items.forEach(function (item) { return item.updateIndex(item.$index + shift); });
this.cache.insertItems(items, index, direction, fixRight);
this.items = __spreadArray([], __read(this.items));
}
this.shiftExtremum(items.length, fixRight);
return true;
};
Buffer.prototype.removeVirtually = function (indexes, fixRight) {

@@ -235,0 +256,0 @@ var length = this.items.length;

import { DefaultSize } from './defaultSize';
import { Direction } from '../../inputs/index';
var ItemCache = /** @class */ (function () {
function ItemCache(item, saveData) {
this.$index = item.$index;
this.nodeId = item.nodeId;
this.data = saveData ? item.data : null;

@@ -11,3 +11,2 @@ this.size = item.size;

this.$index = value;
this.nodeId = String(value);
};

@@ -50,3 +49,3 @@ return ItemCache;

var item = this.get(index);
return item ? item.size : this.defaultSize.get();
return item && item.size || this.defaultSize.get();
};

@@ -78,8 +77,8 @@ Cache.prototype.getDefaultSize = function () {

}
if (itemCache.size !== item.size) { // size changes
if (!isNaN(itemCache.size)) {
this.defaultSize.setExisted(itemCache, item);
if (itemCache.size !== item.size) {
if (itemCache.size) {
this.defaultSize.setExisted(itemCache.size, item.size);
}
else {
this.defaultSize.setNew(item);
this.defaultSize.setNew(item.size);
}

@@ -92,3 +91,3 @@ itemCache.size = item.size;

this.items.set(item.$index, itemCache);
this.defaultSize.setNew(itemCache);
this.defaultSize.setNew(item.size);
}

@@ -104,2 +103,58 @@ if (item.$index < this.minIndex) {

/**
* Inserts items to Set, shifts $indexes of items that remain.
* Replaces current Set with a new one with new regular $indexes.
* Maintains min/max indexes.
*
* @param {Data[]} toInsert List of non-indexed items to be inserted.
* @param {number} index The index before/after which the insertion is performed.
* @param {Direction} direction Determines the direction of insertion.
* @param {boolean} fixRight Defines indexes shifting strategy.
* If false, indexes that are greater than the inserted ones are increased.
* If true, indexes that are less than than the inserted ones are decreased.
*/
Cache.prototype.insertItems = function (toInsert, index, direction, fixRight) {
var _this = this;
var items = new Map();
var length = toInsert.length;
var min = Infinity, max = -Infinity;
var set = function (item) {
items.set(item.$index, item);
min = item.$index < min ? item.$index : min;
max = item.$index > max ? item.$index : max;
};
this.items.forEach(function (item) {
var shift = 0;
if (direction === Direction.backward) {
if (item.$index < index && fixRight) {
shift = -length;
}
else if (item.$index >= index && !fixRight) {
shift = length;
}
}
else if (direction === Direction.forward) {
if (item.$index <= index && fixRight) {
shift = -length;
}
else if (item.$index > index && !fixRight) {
shift = length;
}
}
if (shift) {
item.changeIndex(item.$index + shift);
}
set(item);
});
if (this.saveData) { // persist data with no sizes
toInsert.forEach(function (data, i) {
var $index = index + i - (fixRight ? length : 0) + (direction === Direction.forward ? 1 : 0);
var item = new ItemCache({ $index: $index, data: data }, _this.saveData);
set(item);
});
}
this.items = items;
this.minIndex = min;
this.maxIndex = max;
};
/**
* Removes items from Set, shifts $indexes of items that remain.

@@ -120,4 +175,4 @@ * Replaces current Set with a new one with new regular $indexes.

if (toRemove.some(function (index) { return index === item.$index; })) {
if (!isNaN(item.size)) {
_this.defaultSize.setRemoved(item);
if (item.size) {
_this.defaultSize.setRemoved(item.size);
}

@@ -184,3 +239,3 @@ return;

.filter(function (item) { return item.toRemove; })
.forEach(function (item) { return _this.defaultSize.setRemoved(item); });
.forEach(function (item) { return _this.defaultSize.setRemoved(item.size); });
this.minIndex += leftDiff;

@@ -187,0 +242,0 @@ this.maxIndex += rightDiff;

@@ -120,27 +120,23 @@ import { __read, __spreadArray } from "tslib";

};
DefaultSize.prototype.setExisted = function (oldItem, newItem) {
DefaultSize.prototype.setExisted = function (oldSize, newSize) {
if (this.sizeStrategy !== SizeStrategy.Constant) {
this.recalculation.oldItems.push({
size: oldItem.size,
newSize: newItem.size
size: oldSize,
newSize: newSize
});
}
};
DefaultSize.prototype.setNew = function (newItem) {
DefaultSize.prototype.setNew = function (size) {
if (this.sizeStrategy !== SizeStrategy.Constant) {
this.recalculation.newItems.push({
size: newItem.size
});
this.recalculation.newItems.push({ size: size });
}
else {
if (!this.constantSize) {
this.constantSize = newItem.size;
this.constantSize = size;
}
}
};
DefaultSize.prototype.setRemoved = function (oldItem) {
DefaultSize.prototype.setRemoved = function (size) {
if (this.sizeStrategy !== SizeStrategy.Constant) {
this.recalculation.removed.push({
size: oldItem.size
});
this.recalculation.removed.push({ size: size });
}

@@ -147,0 +143,0 @@ };

@@ -62,3 +62,3 @@ import { __read, __spreadArray } from "tslib";

("consumer: " + packageInfo.consumer.name + " v" + packageInfo.consumer.version + ", ") +
("workflow instance: " + settings.instanceIndex + ", adapter ") +
("scroller instance: " + settings.instanceIndex + ", adapter ") +
(!adapter ? 'is not instantiated' : "instance: " + adapter.id);

@@ -65,0 +65,0 @@ });

@@ -147,7 +147,2 @@ import { Direction } from '../../inputs/index';

};
FetchModel.prototype.remove = function () {
this.startSimulate([]);
this.doRemove = true;
// firstVisibleIndex & delta should be set inside process
};
FetchModel.prototype.update = function (index, delta, items, itemsToRemove) {

@@ -154,0 +149,0 @@ this.startSimulate(items);

@@ -108,2 +108,4 @@ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;

AdapterInsertParams["after"] = "after";
AdapterInsertParams["beforeIndex"] = "beforeIndex";
AdapterInsertParams["afterIndex"] = "afterIndex";
AdapterInsertParams["decrease"] = "decrease";

@@ -117,7 +119,21 @@ })(AdapterInsertParams || (AdapterInsertParams = {}));

_g[AdapterInsertParams.before] = {
validators: [FUNC_WITH_X_ARGUMENTS(1), ONE_OF_MUST([AdapterInsertParams.after])]
validators: [FUNC_WITH_X_ARGUMENTS(1), ONE_OF_MUST([
AdapterInsertParams.after, AdapterInsertParams.beforeIndex, AdapterInsertParams.afterIndex
])]
},
_g[AdapterInsertParams.after] = {
validators: [FUNC_WITH_X_ARGUMENTS(1), ONE_OF_MUST([AdapterInsertParams.before])]
validators: [FUNC_WITH_X_ARGUMENTS(1), ONE_OF_MUST([
AdapterInsertParams.before, AdapterInsertParams.beforeIndex, AdapterInsertParams.afterIndex
])]
},
_g[AdapterInsertParams.beforeIndex] = {
validators: [INTEGER, ONE_OF_MUST([
AdapterInsertParams.before, AdapterInsertParams.after, AdapterInsertParams.afterIndex
])]
},
_g[AdapterInsertParams.afterIndex] = {
validators: [INTEGER, ONE_OF_MUST([
AdapterInsertParams.before, AdapterInsertParams.after, AdapterInsertParams.beforeIndex
])]
},
_g[AdapterInsertParams.decrease] = {

@@ -124,0 +140,0 @@ validators: [BOOLEAN],

@@ -117,5 +117,8 @@ import { __read, __spreadArray, __values } from "tslib";

else if (value.length > 1) {
var type_1 = typeof value[0];
if (value.some(function (v) { return typeof v !== type_1; })) {
errors.push(getError(ValidatorType.itemList, ['of items of the same type']));
var type = typeof value[0];
for (var i = value.length - 1; i >= 0; i--) {
if (typeof value[i] !== type) {
errors.push(getError(ValidatorType.itemList, ['of items of the same type']));
break;
}
}

@@ -122,0 +125,0 @@ }

import { __extends, __read, __spreadArray } from "tslib";
import Update from './update';
import { BaseAdapterProcessFactory, AdapterProcess, ProcessStatus } from '../misc/index';
import { Direction } from '../../inputs/index';
var Insert = /** @class */ (function (_super) {

@@ -21,7 +22,19 @@ __extends(Insert, _super);

Insert.doInsert = function (scroller, params) {
var before = params.before, after = params.after, items = params.items, decrease = params.decrease;
var method = (before || after);
var found = scroller.buffer.items.find(function (item) { return method(item.get()); });
if (!Insert.insertInBuffer(scroller, params)) {
if (!Insert.insertVirtually(scroller, params)) {
return false;
}
}
return true;
};
Insert.insertInBuffer = function (scroller, params) {
var before = params.before, after = params.after, beforeIndex = params.beforeIndex, afterIndex = params.afterIndex, items = params.items, decrease = params.decrease;
var index = Number.isInteger(beforeIndex) ? beforeIndex : (Number.isInteger(afterIndex) ? afterIndex : NaN);
var isBackward = Number.isInteger(beforeIndex) || before;
var method = before || after;
var found = scroller.buffer.items.find(function (item) {
return (method && method(item.get())) || (Number.isInteger(index) && index === item.$index);
});
if (!found) {
scroller.logger.log('no item to insert found');
scroller.logger.log('no item to insert in buffer');
return false;

@@ -34,3 +47,3 @@ }

if (indexToInsert === $index) {
return before ? __spreadArray(__spreadArray([], __read(items)), [data]) : __spreadArray([data], __read(items));
return isBackward ? __spreadArray(__spreadArray([], __read(items)), [data]) : __spreadArray([data], __read(items));
}

@@ -43,2 +56,30 @@ return true;

};
Insert.insertVirtually = function (scroller, params) {
var beforeIndex = params.beforeIndex, afterIndex = params.afterIndex, items = params.items, decrease = params.decrease;
var buffer = scroller.buffer, fetch = scroller.state.fetch, viewport = scroller.viewport;
var direction = Number.isInteger(beforeIndex) ? Direction.backward : Direction.forward;
var index = (direction === Direction.backward ? beforeIndex : afterIndex);
if (isNaN(fetch.firstVisible.index)) { // if in-buffer insertion did not set firstVisible
var _a = viewport.getEdgeVisibleItem(buffer.items, Direction.backward), index_1 = _a.index, diff = _a.diff;
fetch.firstVisible.index = index_1;
if (!isNaN(index_1)) {
fetch.firstVisible.delta = -buffer.getSizeByIndex(index_1) + diff;
}
}
if (!buffer.insertVirtually(items, index, direction, !!decrease)) {
return false;
}
var firstVisible = scroller.state.fetch.firstVisible;
if (!isNaN(firstVisible.index)) {
var shift = 0;
if (index < firstVisible.index && !decrease) {
shift = items.length;
}
else if (index > firstVisible.index && decrease) {
shift = -items.length;
}
firstVisible.index += shift;
}
return true;
};
return Insert;

@@ -45,0 +86,0 @@ }(BaseAdapterProcessFactory(AdapterProcess.insert)));

@@ -44,5 +44,2 @@ import { __extends, __read, __spreadArray } from "tslib";

}
if (!isNaN(fetch.firstVisible.index)) {
fetch.remove();
}
scroller.logger.stat('after remove');

@@ -49,0 +46,0 @@ return true;

export default {
name: 'vscroll',
version: '1.3.4'
version: '1.4.0-alpha'
};
//# sourceMappingURL=version.js.map

@@ -20,2 +20,3 @@ import { Item } from './item';

private cache;
private checkCall;
private readonly logger;

@@ -49,2 +50,3 @@ constructor(settings: Settings<Data>, onDataChanged: OnDataChanged<Data>, logger: Logger);

prependVirtually(count: number, fixRight: boolean): void;
insertVirtually(items: Data[], index: number, direction: Direction, fixRight: boolean): boolean;
removeVirtually(indexes: number[], fixRight: boolean): void;

@@ -51,0 +53,0 @@ updateItems(predicate: BufferUpdater<Data>, generator: (index: number, data: Data) => Item<Data>, indexToTrack: number, fixRight: boolean): {

import { Item } from '../item';
import { Settings } from '../settings';
import { Logger } from '../logger';
import { SizeStrategy } from '../../inputs/index';
import { SizeStrategy, Direction } from '../../inputs/index';
interface ItemToCache<Data> {
$index: number;
data: Data;
size?: number;
}
interface ItemUpdate {

@@ -12,7 +17,6 @@ $index: number;

$index: number;
nodeId: string;
data: Data | null;
size: number;
size?: number;
position: number;
constructor(item: Item<Data>, saveData: boolean);
constructor(item: ItemToCache<Data>, saveData: boolean);
changeIndex(value: number): void;

@@ -47,2 +51,15 @@ }

/**
* Inserts items to Set, shifts $indexes of items that remain.
* Replaces current Set with a new one with new regular $indexes.
* Maintains min/max indexes.
*
* @param {Data[]} toInsert List of non-indexed items to be inserted.
* @param {number} index The index before/after which the insertion is performed.
* @param {Direction} direction Determines the direction of insertion.
* @param {boolean} fixRight Defines indexes shifting strategy.
* If false, indexes that are greater than the inserted ones are increased.
* If true, indexes that are less than than the inserted ones are decreased.
*/
insertItems(toInsert: Data[], index: number, direction: Direction, fixRight: boolean): void;
/**
* Removes items from Set, shifts $indexes of items that remain.

@@ -49,0 +66,0 @@ * Replaces current Set with a new one with new regular $indexes.

@@ -28,6 +28,6 @@ import { SizeStrategy } from '../../inputs/index';

recalculate(cacheSize: number): boolean;
setExisted(oldItem: ItemSize, newItem: ItemSize): void;
setNew(newItem: ItemSize): void;
setRemoved(oldItem: ItemSize): void;
setExisted(oldSize: number, newSize: number): void;
setNew(size: number): void;
setRemoved(size: number): void;
}
export {};

@@ -62,5 +62,4 @@ import { Item } from '../item';

check(items: Item[]): void;
remove(): void;
update(index: number, delta: number, items: Item[], itemsToRemove: Item[]): void;
}
export {};

@@ -84,2 +84,4 @@ import { AdapterPropName, AdapterPropType } from '../classes/adapter/props';

after?: ItemsPredicate<Data>;
beforeIndex?: number;
afterIndex?: number;
decrease?: boolean;

@@ -86,0 +88,0 @@ }

@@ -7,3 +7,5 @@ import { Scroller } from '../../scroller';

static doInsert(scroller: Scroller, params: AdapterInsertOptions): boolean;
static insertInBuffer(scroller: Scroller, params: AdapterInsertOptions): boolean;
static insertVirtually(scroller: Scroller, params: AdapterInsertOptions): boolean;
}
export {};
{
"name": "vscroll",
"version": "1.3.4",
"version": "1.4.0-alpha",
"description": "Virtual scroll engine",

@@ -5,0 +5,0 @@ "main": "dist/bundles/vscroll.umd.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc