vscroll 1.5.4 → 1.5.6
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.
- package/dist/bundles/vscroll.esm5.js +19 -15
- package/dist/bundles/vscroll.esm5.js.map +1 -1
- package/dist/bundles/vscroll.esm5.min.js +2 -2
- package/dist/bundles/vscroll.esm5.min.js.map +1 -1
- package/dist/bundles/vscroll.esm6.js +65 -59
- package/dist/bundles/vscroll.esm6.js.map +1 -1
- package/dist/bundles/vscroll.esm6.min.js +2 -2
- package/dist/bundles/vscroll.esm6.min.js.map +1 -1
- package/dist/bundles/vscroll.umd.js +5447 -5438
- package/dist/bundles/vscroll.umd.js.map +1 -1
- package/dist/bundles/vscroll.umd.min.js +2 -2
- package/dist/bundles/vscroll.umd.min.js.map +1 -1
- package/dist/esm2015/classes/adapter.js +19 -19
- package/dist/esm2015/classes/adapter.js.map +1 -1
- package/dist/esm2015/classes/item.js +11 -11
- package/dist/esm2015/classes/item.js.map +1 -1
- package/dist/esm2015/classes/state/clip.js +3 -3
- package/dist/esm2015/classes/state/clip.js.map +1 -1
- package/dist/esm2015/classes/state/cycle.js +9 -9
- package/dist/esm2015/classes/state/cycle.js.map +1 -1
- package/dist/esm2015/classes/state/render.js +3 -3
- package/dist/esm2015/classes/state/render.js.map +1 -1
- package/dist/esm2015/classes/state.js +3 -3
- package/dist/esm2015/classes/state.js.map +1 -1
- package/dist/esm2015/processes/fetch.js +2 -1
- package/dist/esm2015/processes/fetch.js.map +1 -1
- package/dist/esm2015/processes/postFetch.js +3 -2
- package/dist/esm2015/processes/postFetch.js.map +1 -1
- package/dist/esm2015/scroller.js +1 -0
- package/dist/esm2015/scroller.js.map +1 -1
- package/dist/esm2015/version.js +1 -1
- package/dist/esm2015/version.js.map +1 -1
- package/dist/esm2015/workflow.js +9 -6
- package/dist/esm2015/workflow.js.map +1 -1
- package/dist/esm5/classes/datasource.js +1 -3
- package/dist/esm5/classes/datasource.js.map +1 -1
- package/dist/esm5/processes/fetch.js +2 -1
- package/dist/esm5/processes/fetch.js.map +1 -1
- package/dist/esm5/processes/postFetch.js +3 -2
- package/dist/esm5/processes/postFetch.js.map +1 -1
- package/dist/esm5/scroller.js +1 -0
- package/dist/esm5/scroller.js.map +1 -1
- package/dist/esm5/version.js +1 -1
- package/dist/esm5/version.js.map +1 -1
- package/dist/esm5/workflow.js +10 -7
- package/dist/esm5/workflow.js.map +1 -1
- package/dist/typings/classes/adapter/wanted.d.ts +3 -3
- package/dist/typings/classes/adapter.d.ts +1 -1
- package/dist/typings/classes/datasource.d.ts +1 -1
- package/dist/typings/classes/logger.d.ts +1 -1
- package/dist/typings/classes/reactive.d.ts +2 -2
- package/dist/typings/inputs/validation.d.ts +2 -2
- package/dist/typings/interfaces/adapter.d.ts +7 -7
- package/dist/typings/interfaces/datasource.d.ts +6 -6
- package/dist/typings/interfaces/process.d.ts +2 -2
- package/dist/typings/interfaces/routines.d.ts +1 -1
- package/dist/typings/interfaces/validation.d.ts +3 -3
- package/dist/typings/interfaces/workflow.d.ts +2 -2
- package/dist/typings/processes/adapter/append.d.ts +1 -1
- package/dist/typings/processes/fetch.d.ts +1 -1
- package/dist/typings/workflow.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* vscroll (https://github.com/dhilt/vscroll) FESM2015
|
|
3
|
-
* Version: 1.5.
|
|
3
|
+
* Version: 1.5.6 (2023-11-22T18:32:00.656Z)
|
|
4
4
|
* Author: Denis Hilt
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -330,7 +330,7 @@ const reactiveConfigStorage = new Map();
|
|
|
330
330
|
|
|
331
331
|
var core = {
|
|
332
332
|
name: 'vscroll',
|
|
333
|
-
version: '1.5.
|
|
333
|
+
version: '1.5.6'
|
|
334
334
|
};
|
|
335
335
|
|
|
336
336
|
const getBox = (id) => {
|
|
@@ -1472,17 +1472,6 @@ class Reload extends BaseAdapterProcessFactory(AdapterProcess.reload) {
|
|
|
1472
1472
|
}
|
|
1473
1473
|
|
|
1474
1474
|
class Item {
|
|
1475
|
-
constructor($index, data, routines) {
|
|
1476
|
-
this.container = {
|
|
1477
|
-
$index,
|
|
1478
|
-
data
|
|
1479
|
-
};
|
|
1480
|
-
this.nodeId = String($index);
|
|
1481
|
-
this.routines = routines;
|
|
1482
|
-
this.invisible = true;
|
|
1483
|
-
this.toRemove = false;
|
|
1484
|
-
this.toInsert = false;
|
|
1485
|
-
}
|
|
1486
1475
|
get $index() {
|
|
1487
1476
|
return this.container.$index;
|
|
1488
1477
|
}
|
|
@@ -1501,6 +1490,17 @@ class Item {
|
|
|
1501
1490
|
set element(value) {
|
|
1502
1491
|
this.container.element = value;
|
|
1503
1492
|
}
|
|
1493
|
+
constructor($index, data, routines) {
|
|
1494
|
+
this.container = {
|
|
1495
|
+
$index,
|
|
1496
|
+
data
|
|
1497
|
+
};
|
|
1498
|
+
this.nodeId = String($index);
|
|
1499
|
+
this.routines = routines;
|
|
1500
|
+
this.invisible = true;
|
|
1501
|
+
this.toRemove = false;
|
|
1502
|
+
this.toInsert = false;
|
|
1503
|
+
}
|
|
1504
1504
|
dispose() {
|
|
1505
1505
|
delete this.container.element;
|
|
1506
1506
|
}
|
|
@@ -2254,7 +2254,8 @@ class Fetch extends BaseProcessFactory(CommonProcess.fetch) {
|
|
|
2254
2254
|
return getResult;
|
|
2255
2255
|
}
|
|
2256
2256
|
else if (typeof getResult.subscribe === 'function') {
|
|
2257
|
-
|
|
2257
|
+
let sub = void 0;
|
|
2258
|
+
sub = getResult.subscribe(done, fail, () => {
|
|
2258
2259
|
if (sub && typeof sub === 'object' && typeof sub.unsubscribe === 'function') {
|
|
2259
2260
|
sub.unsubscribe();
|
|
2260
2261
|
}
|
|
@@ -2329,8 +2330,9 @@ class PostFetch extends BaseProcessFactory(CommonProcess.postFetch) {
|
|
|
2329
2330
|
// let's treat initial poor fetch as startIndex-bof
|
|
2330
2331
|
fetchIndex = buffer.startIndex;
|
|
2331
2332
|
}
|
|
2332
|
-
else if (fetch.first.index < buffer.minIndex) {
|
|
2333
|
-
|
|
2333
|
+
else if (fetch.first.index < buffer.minIndex) {
|
|
2334
|
+
// normal bof
|
|
2335
|
+
fetchIndex = buffer.firstIndex - items.length;
|
|
2334
2336
|
}
|
|
2335
2337
|
}
|
|
2336
2338
|
fetch.items = items.map((item, index) => new Item(fetchIndex + index, item, scroller.routines));
|
|
@@ -3971,14 +3973,14 @@ class Buffer {
|
|
|
3971
3973
|
}
|
|
3972
3974
|
|
|
3973
3975
|
class InnerLoopModel {
|
|
3976
|
+
get first() {
|
|
3977
|
+
return this.count === 0;
|
|
3978
|
+
}
|
|
3974
3979
|
constructor(total) {
|
|
3975
3980
|
this.total = total;
|
|
3976
3981
|
this.isInitial = false;
|
|
3977
3982
|
this.busy = new Reactive(false);
|
|
3978
3983
|
}
|
|
3979
|
-
get first() {
|
|
3980
|
-
return this.count === 0;
|
|
3981
|
-
}
|
|
3982
3984
|
done() {
|
|
3983
3985
|
this.isInitial = false;
|
|
3984
3986
|
this.count++;
|
|
@@ -3993,6 +3995,12 @@ class InnerLoopModel {
|
|
|
3993
3995
|
}
|
|
3994
3996
|
}
|
|
3995
3997
|
class WorkflowCycleModel {
|
|
3998
|
+
get loopId() {
|
|
3999
|
+
return `${this.instanceIndex}-${this.count}-${this.innerLoop.total}`;
|
|
4000
|
+
}
|
|
4001
|
+
get loopIdNext() {
|
|
4002
|
+
return `${this.instanceIndex}-${this.count}-${this.innerLoop.total + 1}`;
|
|
4003
|
+
}
|
|
3996
4004
|
constructor(instanceIndex, cycle) {
|
|
3997
4005
|
const cycleCount = cycle ? cycle.count : 1;
|
|
3998
4006
|
const loopCount = cycle ? cycle.innerLoop.count : 0;
|
|
@@ -4002,12 +4010,6 @@ class WorkflowCycleModel {
|
|
|
4002
4010
|
this.busy = new Reactive(false);
|
|
4003
4011
|
this.end(cycleCount);
|
|
4004
4012
|
}
|
|
4005
|
-
get loopId() {
|
|
4006
|
-
return `${this.instanceIndex}-${this.count}-${this.innerLoop.total}`;
|
|
4007
|
-
}
|
|
4008
|
-
get loopIdNext() {
|
|
4009
|
-
return `${this.instanceIndex}-${this.count}-${this.innerLoop.total + 1}`;
|
|
4010
|
-
}
|
|
4011
4013
|
start(isInitial, initiator) {
|
|
4012
4014
|
this.isInitial = isInitial;
|
|
4013
4015
|
this.initiator = initiator;
|
|
@@ -4153,13 +4155,13 @@ class FetchModel {
|
|
|
4153
4155
|
}
|
|
4154
4156
|
|
|
4155
4157
|
class ClipModel {
|
|
4158
|
+
get force() {
|
|
4159
|
+
return this.forceForward || this.forceBackward;
|
|
4160
|
+
}
|
|
4156
4161
|
constructor() {
|
|
4157
4162
|
this.callCount = 0;
|
|
4158
4163
|
this.reset();
|
|
4159
4164
|
}
|
|
4160
|
-
get force() {
|
|
4161
|
-
return this.forceForward || this.forceBackward;
|
|
4162
|
-
}
|
|
4163
4165
|
reset(force) {
|
|
4164
4166
|
this.doClip = false;
|
|
4165
4167
|
if (!force) {
|
|
@@ -4170,12 +4172,12 @@ class ClipModel {
|
|
|
4170
4172
|
}
|
|
4171
4173
|
|
|
4172
4174
|
class RenderModel {
|
|
4173
|
-
constructor() {
|
|
4174
|
-
this.reset();
|
|
4175
|
-
}
|
|
4176
4175
|
get noSize() {
|
|
4177
4176
|
return this.sizeBefore === this.sizeAfter;
|
|
4178
4177
|
}
|
|
4178
|
+
constructor() {
|
|
4179
|
+
this.reset();
|
|
4180
|
+
}
|
|
4179
4181
|
reset() {
|
|
4180
4182
|
this.sizeBefore = 0;
|
|
4181
4183
|
this.sizeAfter = 0;
|
|
@@ -4216,6 +4218,9 @@ class ScrollModel {
|
|
|
4216
4218
|
}
|
|
4217
4219
|
|
|
4218
4220
|
class State {
|
|
4221
|
+
get time() {
|
|
4222
|
+
return Number(new Date()) - this.initTime;
|
|
4223
|
+
}
|
|
4219
4224
|
constructor(packageInfo, settings, state) {
|
|
4220
4225
|
this.packageInfo = packageInfo;
|
|
4221
4226
|
this.settings = settings;
|
|
@@ -4226,9 +4231,6 @@ class State {
|
|
|
4226
4231
|
this.render = new RenderModel();
|
|
4227
4232
|
this.scroll = new ScrollModel();
|
|
4228
4233
|
}
|
|
4229
|
-
get time() {
|
|
4230
|
-
return Number(new Date()) - this.initTime;
|
|
4231
|
-
}
|
|
4232
4234
|
startWorkflowCycle(isInitial, initiator) {
|
|
4233
4235
|
this.cycle.start(isInitial, initiator);
|
|
4234
4236
|
}
|
|
@@ -4288,6 +4290,25 @@ const convertRemoveArgs = (options) => {
|
|
|
4288
4290
|
return options;
|
|
4289
4291
|
};
|
|
4290
4292
|
class Adapter {
|
|
4293
|
+
get workflow() {
|
|
4294
|
+
return this.getWorkflow();
|
|
4295
|
+
}
|
|
4296
|
+
get reloadCount() {
|
|
4297
|
+
return this.reloadCounter;
|
|
4298
|
+
}
|
|
4299
|
+
get reloadId() {
|
|
4300
|
+
return this.id + '.' + this.reloadCounter;
|
|
4301
|
+
}
|
|
4302
|
+
getPromisifiedMethod(method, defaultMethod) {
|
|
4303
|
+
return (...args) => this.relax$
|
|
4304
|
+
? new Promise(resolve => {
|
|
4305
|
+
if (this.relax$) {
|
|
4306
|
+
this.relax$.once(value => resolve(value));
|
|
4307
|
+
}
|
|
4308
|
+
method.apply(this, args);
|
|
4309
|
+
})
|
|
4310
|
+
: defaultMethod.apply(this, args);
|
|
4311
|
+
}
|
|
4291
4312
|
constructor(context, getWorkflow, logger) {
|
|
4292
4313
|
this.source = {}; // for Reactive props
|
|
4293
4314
|
this.box = {}; // for Scalars over Reactive props
|
|
@@ -4431,25 +4452,6 @@ class Adapter {
|
|
|
4431
4452
|
this.externalContext = context;
|
|
4432
4453
|
wantedUtils.setBlock(false, contextId);
|
|
4433
4454
|
}
|
|
4434
|
-
get workflow() {
|
|
4435
|
-
return this.getWorkflow();
|
|
4436
|
-
}
|
|
4437
|
-
get reloadCount() {
|
|
4438
|
-
return this.reloadCounter;
|
|
4439
|
-
}
|
|
4440
|
-
get reloadId() {
|
|
4441
|
-
return this.id + '.' + this.reloadCounter;
|
|
4442
|
-
}
|
|
4443
|
-
getPromisifiedMethod(method, defaultMethod) {
|
|
4444
|
-
return (...args) => this.relax$
|
|
4445
|
-
? new Promise(resolve => {
|
|
4446
|
-
if (this.relax$) {
|
|
4447
|
-
this.relax$.once(value => resolve(value));
|
|
4448
|
-
}
|
|
4449
|
-
method.apply(this, args);
|
|
4450
|
-
})
|
|
4451
|
-
: defaultMethod.apply(this, args);
|
|
4452
|
-
}
|
|
4453
4455
|
initialize({ buffer, state, viewport, logger, adapterRun$, getWorkflow }) {
|
|
4454
4456
|
// buffer
|
|
4455
4457
|
Object.defineProperty(this.demand, AdapterPropName.itemsCount, {
|
|
@@ -4777,6 +4779,7 @@ class Scroller {
|
|
|
4777
4779
|
});
|
|
4778
4780
|
}
|
|
4779
4781
|
dispose(forever) {
|
|
4782
|
+
this.logger.log(() => 'disposing scroller' + (forever ? ' (forever)' : ''));
|
|
4780
4783
|
if (forever) { // Adapter is not re-instantiated on reset
|
|
4781
4784
|
this.adapter.dispose();
|
|
4782
4785
|
}
|
|
@@ -5000,6 +5003,7 @@ const runStateMachine = ({ input: { process, status, payload = {} }, methods: {
|
|
|
5000
5003
|
class Workflow {
|
|
5001
5004
|
constructor({ element, datasource, consumer, run, Routines }) {
|
|
5002
5005
|
this.isInitialized = false;
|
|
5006
|
+
this.disposed = false;
|
|
5003
5007
|
this.initTimer = null;
|
|
5004
5008
|
this.adapterRun$ = new Reactive();
|
|
5005
5009
|
this.cyclesDone = 0;
|
|
@@ -5028,12 +5032,6 @@ class Workflow {
|
|
|
5028
5032
|
}
|
|
5029
5033
|
init() {
|
|
5030
5034
|
this.scroller.init(this.adapterRun$);
|
|
5031
|
-
this.isInitialized = true;
|
|
5032
|
-
// run the Workflow
|
|
5033
|
-
this.callWorkflow({
|
|
5034
|
-
process: CommonProcess.init,
|
|
5035
|
-
status: ProcessStatus.start
|
|
5036
|
-
});
|
|
5037
5035
|
// set up scroll event listener
|
|
5038
5036
|
const { routines } = this.scroller;
|
|
5039
5037
|
const onScrollHandler = event => this.callWorkflow({
|
|
@@ -5042,6 +5040,12 @@ class Workflow {
|
|
|
5042
5040
|
payload: { event }
|
|
5043
5041
|
});
|
|
5044
5042
|
this.offScroll = routines.onScroll(onScrollHandler);
|
|
5043
|
+
// run the Workflow
|
|
5044
|
+
this.isInitialized = true;
|
|
5045
|
+
this.callWorkflow({
|
|
5046
|
+
process: CommonProcess.init,
|
|
5047
|
+
status: ProcessStatus.start
|
|
5048
|
+
});
|
|
5045
5049
|
}
|
|
5046
5050
|
changeItems(items) {
|
|
5047
5051
|
this.propagateChanges(items);
|
|
@@ -5138,6 +5142,7 @@ class Workflow {
|
|
|
5138
5142
|
this.finalize();
|
|
5139
5143
|
}
|
|
5140
5144
|
dispose() {
|
|
5145
|
+
this.scroller.logger.log(() => 'disposing workflow');
|
|
5141
5146
|
if (this.initTimer) {
|
|
5142
5147
|
clearTimeout(this.initTimer);
|
|
5143
5148
|
}
|
|
@@ -5147,6 +5152,7 @@ class Workflow {
|
|
|
5147
5152
|
Object.getOwnPropertyNames(this).forEach(prop => {
|
|
5148
5153
|
delete this[prop];
|
|
5149
5154
|
});
|
|
5155
|
+
this.disposed = true;
|
|
5150
5156
|
}
|
|
5151
5157
|
finalize() {
|
|
5152
5158
|
}
|