@vuu-ui/vuu-utils 0.5.2 → 0.5.4

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.
Files changed (2) hide show
  1. package/cjs/index.js +9 -13
  2. package/package.json +1 -1
package/cjs/index.js CHANGED
@@ -194,8 +194,6 @@ function resetRange({ from, to, bufferSize = 0 }) {
194
194
  };
195
195
  }
196
196
  var WindowRange = class {
197
- from;
198
- to;
199
197
  constructor(from, to) {
200
198
  this.from = from;
201
199
  this.to = to;
@@ -215,20 +213,18 @@ var WindowRange = class {
215
213
  var { KEY } = metadataKeys;
216
214
  var log = (message) => console.log(`%c[DataWindow] ${message}`, "color: purple;font-weight: bold;");
217
215
  var DataWindow = class {
218
- range;
219
- data;
220
- rowCount = 0;
221
216
  constructor({ from, to }) {
217
+ this.rowCount = 0;
218
+ this.setRowCount = (rowCount) => {
219
+ if (rowCount < this.data.length) {
220
+ this.data.length = rowCount;
221
+ }
222
+ this.rowCount = rowCount;
223
+ };
222
224
  log(`constructor ${from} - ${to}`);
223
225
  this.range = new WindowRange(from, to);
224
226
  this.data = new Array(to - from);
225
227
  }
226
- setRowCount = (rowCount) => {
227
- if (rowCount < this.data.length) {
228
- this.data.length = rowCount;
229
- }
230
- this.rowCount = rowCount;
231
- };
232
228
  add(data) {
233
229
  const [index] = data;
234
230
  if (this.isWithinRange(index)) {
@@ -273,9 +269,10 @@ var DataWindow = class {
273
269
  return this.data[start] !== void 0 && this.data[end] !== void 0;
274
270
  }
275
271
  getData(from, to) {
272
+ var _a;
276
273
  const { from: clientFrom, to: clientTo } = this.range;
277
274
  const startOffset = Math.max(0, from - clientFrom);
278
- const endOffset = Math.min(to - clientFrom, this.rowCount ?? to);
275
+ const endOffset = Math.min(to - clientFrom, (_a = this.rowCount) != null ? _a : to);
279
276
  return this.data.slice(startOffset, endOffset);
280
277
  }
281
278
  };
@@ -333,7 +330,6 @@ function isOnlyListener(listeners) {
333
330
  return !Array.isArray(listeners);
334
331
  }
335
332
  var EventEmitter = class {
336
- _events;
337
333
  constructor() {
338
334
  this._events = {};
339
335
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuu-ui/vuu-utils",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "author": "heswell",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {