vscroll 1.4.3 → 1.5.1

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 (93) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +105 -58
  3. package/dist/bundles/vscroll.esm5.js +204 -176
  4. package/dist/bundles/vscroll.esm5.js.map +1 -1
  5. package/dist/bundles/vscroll.esm5.min.js +2 -2
  6. package/dist/bundles/vscroll.esm5.min.js.map +1 -1
  7. package/dist/bundles/vscroll.esm6.js +122 -112
  8. package/dist/bundles/vscroll.esm6.js.map +1 -1
  9. package/dist/bundles/vscroll.esm6.min.js +2 -2
  10. package/dist/bundles/vscroll.esm6.min.js.map +1 -1
  11. package/dist/bundles/vscroll.umd.js +205 -177
  12. package/dist/bundles/vscroll.umd.js.map +1 -1
  13. package/dist/bundles/vscroll.umd.min.js +2 -2
  14. package/dist/bundles/vscroll.umd.min.js.map +1 -1
  15. package/dist/esm2015/classes/buffer.js +2 -6
  16. package/dist/esm2015/classes/buffer.js.map +1 -1
  17. package/dist/esm2015/classes/domRoutines.js +93 -69
  18. package/dist/esm2015/classes/domRoutines.js.map +1 -1
  19. package/dist/esm2015/classes/logger.js +2 -2
  20. package/dist/esm2015/classes/logger.js.map +1 -1
  21. package/dist/esm2015/classes/paddings.js +5 -5
  22. package/dist/esm2015/classes/paddings.js.map +1 -1
  23. package/dist/esm2015/classes/viewport.js +9 -21
  24. package/dist/esm2015/classes/viewport.js.map +1 -1
  25. package/dist/esm2015/index.js.map +1 -1
  26. package/dist/esm2015/interfaces/index.js.map +1 -1
  27. package/dist/esm2015/interfaces/routines.js +2 -0
  28. package/dist/esm2015/interfaces/routines.js.map +1 -0
  29. package/dist/esm2015/interfaces/workflow.js.map +1 -1
  30. package/dist/esm2015/scroller.js +4 -4
  31. package/dist/esm2015/scroller.js.map +1 -1
  32. package/dist/esm2015/version.js +1 -1
  33. package/dist/esm2015/version.js.map +1 -1
  34. package/dist/esm2015/workflow.js +6 -4
  35. package/dist/esm2015/workflow.js.map +1 -1
  36. package/dist/esm5/classes/adapter.js +4 -4
  37. package/dist/esm5/classes/adapter.js.map +1 -1
  38. package/dist/esm5/classes/buffer/cache.js +1 -1
  39. package/dist/esm5/classes/buffer/cache.js.map +1 -1
  40. package/dist/esm5/classes/buffer/checkCall.js +4 -4
  41. package/dist/esm5/classes/buffer/checkCall.js.map +1 -1
  42. package/dist/esm5/classes/buffer.js +5 -9
  43. package/dist/esm5/classes/buffer.js.map +1 -1
  44. package/dist/esm5/classes/domRoutines.js +107 -69
  45. package/dist/esm5/classes/domRoutines.js.map +1 -1
  46. package/dist/esm5/classes/logger.js +21 -21
  47. package/dist/esm5/classes/logger.js.map +1 -1
  48. package/dist/esm5/classes/paddings.js +5 -5
  49. package/dist/esm5/classes/paddings.js.map +1 -1
  50. package/dist/esm5/classes/state/cycle.js +2 -2
  51. package/dist/esm5/classes/state/cycle.js.map +1 -1
  52. package/dist/esm5/classes/viewport.js +10 -22
  53. package/dist/esm5/classes/viewport.js.map +1 -1
  54. package/dist/esm5/index.js.map +1 -1
  55. package/dist/esm5/inputs/validation.js +4 -4
  56. package/dist/esm5/inputs/validation.js.map +1 -1
  57. package/dist/esm5/interfaces/index.js.map +1 -1
  58. package/dist/esm5/interfaces/routines.js +2 -0
  59. package/dist/esm5/interfaces/routines.js.map +1 -0
  60. package/dist/esm5/interfaces/workflow.js.map +1 -1
  61. package/dist/esm5/processes/adapter/remove.js +1 -1
  62. package/dist/esm5/processes/adapter/remove.js.map +1 -1
  63. package/dist/esm5/processes/adjust.js +5 -5
  64. package/dist/esm5/processes/adjust.js.map +1 -1
  65. package/dist/esm5/processes/clip.js +5 -5
  66. package/dist/esm5/processes/clip.js.map +1 -1
  67. package/dist/esm5/processes/fetch.js +2 -2
  68. package/dist/esm5/processes/fetch.js.map +1 -1
  69. package/dist/esm5/processes/misc/base.js +1 -1
  70. package/dist/esm5/processes/misc/base.js.map +1 -1
  71. package/dist/esm5/processes/preClip.js +2 -2
  72. package/dist/esm5/processes/preClip.js.map +1 -1
  73. package/dist/esm5/processes/preFetch.js +5 -5
  74. package/dist/esm5/processes/preFetch.js.map +1 -1
  75. package/dist/esm5/processes/scroll.js +2 -2
  76. package/dist/esm5/processes/scroll.js.map +1 -1
  77. package/dist/esm5/scroller.js +5 -5
  78. package/dist/esm5/scroller.js.map +1 -1
  79. package/dist/esm5/version.js +1 -1
  80. package/dist/esm5/version.js.map +1 -1
  81. package/dist/esm5/workflow.js +12 -6
  82. package/dist/esm5/workflow.js.map +1 -1
  83. package/dist/typings/classes/domRoutines.d.ts +21 -19
  84. package/dist/typings/classes/logger.d.ts +1 -1
  85. package/dist/typings/classes/paddings.d.ts +2 -2
  86. package/dist/typings/classes/viewport.d.ts +1 -4
  87. package/dist/typings/index.d.ts +2 -2
  88. package/dist/typings/interfaces/index.d.ts +2 -1
  89. package/dist/typings/interfaces/routines.d.ts +157 -0
  90. package/dist/typings/interfaces/workflow.d.ts +3 -0
  91. package/dist/typings/scroller.d.ts +1 -1
  92. package/dist/typings/workflow.d.ts +1 -1
  93. package/package.json +18 -17
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * vscroll (https://github.com/dhilt/vscroll) UMD
3
- * Version: 1.4.3 (2021-11-30T02:54:04.845Z)
3
+ * Version: 1.5.1 (2022-09-02T19:54:24.771Z)
4
4
  * Author: Denis Hilt
5
5
  * License: MIT
6
6
  */
@@ -94,7 +94,7 @@
94
94
 
95
95
  /**
96
96
  * vscroll (https://github.com/dhilt/vscroll) FESM5
97
- * Version: 1.4.3 (2021-11-30T02:54:00.541Z)
97
+ * Version: 1.5.1 (2022-09-02T19:54:19.461Z)
98
98
  * Author: Denis Hilt
99
99
  * License: MIT
100
100
  */
@@ -435,7 +435,7 @@
435
435
 
436
436
  var core = {
437
437
  name: 'vscroll',
438
- version: '1.4.3'
438
+ version: '1.5.1'
439
439
  };
440
440
 
441
441
  var instanceCount$1 = 0;
@@ -544,7 +544,7 @@
544
544
  ValidatorType["enum"] = "must belong to {arg1} list";
545
545
  })(ValidatorType || (ValidatorType = {}));
546
546
  var getError = function (msg, args) {
547
- return (args || ['']).reduce(function (acc, arg, index) { return acc.replace("{arg" + (index + 1) + "}", arg); }, msg);
547
+ return (args || ['']).reduce(function (acc, arg, index) { return acc.replace("{arg".concat(index + 1, "}"), arg); }, msg);
548
548
  };
549
549
  var getNumber = function (value) {
550
550
  return typeof value === 'number' || (typeof value === 'string' && value !== '')
@@ -709,7 +709,7 @@
709
709
  }
710
710
  var isAnotherPresent = context && Object.prototype.hasOwnProperty.call(context, token);
711
711
  if (isSet && isAnotherPresent) {
712
- errors.push(getError(err, [tokens.join('", "')]) + (" (" + token + " is present)"));
712
+ errors.push(getError(err, [tokens.join('", "')]) + " (".concat(token, " is present)"));
713
713
  break;
714
714
  }
715
715
  if (noOneIsPresent && isAnotherPresent) {
@@ -834,9 +834,9 @@
834
834
  ValidatedData.prototype.setParam = function (token, value) {
835
835
  if (!value.isValid) {
836
836
  value.errors = !value.isSet
837
- ? ["\"" + token + "\" must be set"]
837
+ ? ["\"".concat(token, "\" must be set")]
838
838
  : value.errors.map(function (err) {
839
- return "\"" + token + "\" " + err;
839
+ return "\"".concat(token, "\" ").concat(err);
840
840
  });
841
841
  }
842
842
  this.params[token] = value;
@@ -1424,7 +1424,7 @@
1424
1424
  scroller.workflow.call({
1425
1425
  process: process,
1426
1426
  status: ProcessStatus.error,
1427
- payload: { error: "Wrong argument of the \"" + process + "\" method call" }
1427
+ payload: { error: "Wrong argument of the \"".concat(process, "\" method call") }
1428
1428
  });
1429
1429
  }
1430
1430
  }
@@ -1480,7 +1480,7 @@
1480
1480
  if (!scroll.syntheticFulfill || synthPos === position) {
1481
1481
  scroller.logger.log(function () { return [
1482
1482
  'skipping scroll', position,
1483
- "[" + (scroll.syntheticFulfill ? '' : 'pre-') + "synthetic]"
1483
+ "[".concat(scroll.syntheticFulfill ? '' : 'pre-', "synthetic]")
1484
1484
  ]; });
1485
1485
  return true;
1486
1486
  }
@@ -1502,7 +1502,7 @@
1502
1502
  direction === exports.Direction.backward ? '\u2934' : '\u2935',
1503
1503
  position,
1504
1504
  shouldDelay ? (timeDiff + 'ms') : '0ms',
1505
- shouldDelay ? (alreadyDelayed ? 'delayed' : "/ " + delta + "ms delay") : ''
1505
+ shouldDelay ? (alreadyDelayed ? 'delayed' : "/ ".concat(delta, "ms delay")) : ''
1506
1506
  ]; });
1507
1507
  if (!shouldDelay) {
1508
1508
  if (scroll.scrollTimer) {
@@ -1998,7 +1998,7 @@
1998
1998
  }
1999
1999
  }
2000
2000
  // virtual removal
2001
- scroller.logger.log(function () { return "going to remove " + toRemove.length + " item(s) virtually"; });
2001
+ scroller.logger.log(function () { return "going to remove ".concat(toRemove.length, " item(s) virtually"); });
2002
2002
  buffer.removeVirtually(toRemove, !!increase);
2003
2003
  buffer.checkDefaultSize();
2004
2004
  Remove.shiftFirstVisibleIndex(scroller, toRemove, !!increase);
@@ -2232,8 +2232,8 @@
2232
2232
  startDelta += buffer.getSizeByIndex(index);
2233
2233
  }
2234
2234
  scroller.logger.log(function () { return __spreadArray([
2235
- "start delta is " + startDelta
2236
- ], __read((offset ? [" (+" + offset + " offset)"] : [])), false); });
2235
+ "start delta is ".concat(startDelta)
2236
+ ], __read((offset ? [" (+".concat(offset, " offset)")] : [])), false); });
2237
2237
  return startDelta;
2238
2238
  };
2239
2239
  PreFetch.setFirstIndex = function (scroller) {
@@ -2404,17 +2404,17 @@
2404
2404
  direction_1 = fetch.last.index < buffer.items[0].$index ? exports.Direction.backward : exports.Direction.forward;
2405
2405
  }
2406
2406
  fetch.direction = direction_1;
2407
- scroller.logger.log(function () { return "fetch direction is \"" + direction_1 + "\""; });
2407
+ scroller.logger.log(function () { return "fetch direction is \"".concat(direction_1, "\""); });
2408
2408
  }
2409
2409
  };
2410
2410
  PreFetch.getStatus = function (scroller) {
2411
2411
  var _a = scroller.state, cycle = _a.cycle, fetch = _a.fetch;
2412
2412
  if (cycle.initiator === AdapterProcess.clip) {
2413
- scroller.logger.log(function () { return "going to skip fetch due to \"" + AdapterProcess.clip + "\" process"; });
2413
+ scroller.logger.log(function () { return "going to skip fetch due to \"".concat(AdapterProcess.clip, "\" process"); });
2414
2414
  return ProcessStatus.next;
2415
2415
  }
2416
2416
  if (fetch.shouldFetch) {
2417
- scroller.logger.log(function () { return "going to fetch " + fetch.count + " items started from index " + fetch.index; });
2417
+ scroller.logger.log(function () { return "going to fetch ".concat(fetch.count, " items started from index ").concat(fetch.index); });
2418
2418
  return ProcessStatus.next;
2419
2419
  }
2420
2420
  return ProcessStatus.done;
@@ -2432,8 +2432,8 @@
2432
2432
  var box = {
2433
2433
  success: function (data) {
2434
2434
  scroller.logger.log(function () {
2435
- return "resolved " + data.length + " items " +
2436
- ("(index = " + scroller.state.fetch.index + ", count = " + scroller.state.fetch.count + ")");
2435
+ return "resolved ".concat(data.length, " items ") +
2436
+ "(index = ".concat(scroller.state.fetch.index, ", count = ").concat(scroller.state.fetch.count, ")");
2437
2437
  });
2438
2438
  scroller.state.fetch.newItemsData = data;
2439
2439
  workflow.call({
@@ -2780,7 +2780,7 @@
2780
2780
  fwdSize += viewportSizeDiff;
2781
2781
  }
2782
2782
  scroller.logger.log(function () {
2783
- return inverse ? 'backward' : 'forward' + (" padding will be increased by " + viewportSizeDiff + " to fill the viewport");
2783
+ return inverse ? 'backward' : 'forward' + " padding will be increased by ".concat(viewportSizeDiff, " to fill the viewport");
2784
2784
  });
2785
2785
  }
2786
2786
  backward.size = bwdSize;
@@ -2792,7 +2792,7 @@
2792
2792
  var position = viewport.paddings.backward.size;
2793
2793
  // increase the position to meet the expectation of the first visible item
2794
2794
  if (!isNaN(fetch.firstVisible.index) && !isNaN(buffer.firstIndex)) {
2795
- scroller.logger.log("first index = " + fetch.firstVisible.index + ", delta = " + fetch.firstVisible.delta);
2795
+ scroller.logger.log("first index = ".concat(fetch.firstVisible.index, ", delta = ").concat(fetch.firstVisible.delta));
2796
2796
  var shouldCheckPreSizeExpectation_1 = fetch.shouldCheckPreSizeExpectation(buffer.lastIndex);
2797
2797
  buffer.items.forEach(function (item) {
2798
2798
  // 1) shift of the buffered items before the first visible item
@@ -2814,7 +2814,7 @@
2814
2814
  if (scroll.positionBeforeAsync !== null) {
2815
2815
  var diff = render.positionBefore - scroll.positionBeforeAsync;
2816
2816
  if (diff !== 0) {
2817
- scroller.logger.log("shift position due to fetch-render difference (" + diff + ")");
2817
+ scroller.logger.log("shift position due to fetch-render difference (".concat(diff, ")"));
2818
2818
  position += diff;
2819
2819
  }
2820
2820
  }
@@ -2845,7 +2845,7 @@
2845
2845
  var shift = Math.min(size, diff);
2846
2846
  if (shift) {
2847
2847
  viewport.paddings.forward.size += shift;
2848
- scroller.logger.log("increase fwd padding due to lack of items (" + diff + " -> " + shift + ")");
2848
+ scroller.logger.log("increase fwd padding due to lack of items (".concat(diff, " -> ").concat(shift, ")"));
2849
2849
  }
2850
2850
  };
2851
2851
  Adjust.setPosition = function (scroller, position, done) {
@@ -2862,7 +2862,7 @@
2862
2862
  if (inertiaDiff > 0) {
2863
2863
  position -= inertiaDiff;
2864
2864
  scroll.syntheticPosition = position;
2865
- diffLog = " (-" + inertiaDiff + ")";
2865
+ diffLog = " (-".concat(inertiaDiff, ")");
2866
2866
  }
2867
2867
  scroll.syntheticFulfill = true;
2868
2868
  viewport.scrollPosition = position;
@@ -2896,8 +2896,8 @@
2896
2896
  var firstIndex = fetch.first.indexBuffer;
2897
2897
  var lastIndex = fetch.last.indexBuffer;
2898
2898
  scroller.logger.log(function () {
2899
- return "looking for " + (fetch.direction ? 'anti-' + fetch.direction + ' ' : '') + "items " +
2900
- ("that are out of [" + firstIndex + ".." + lastIndex + "] range");
2899
+ return "looking for ".concat(fetch.direction ? 'anti-' + fetch.direction + ' ' : '', "items ") +
2900
+ "that are out of [".concat(firstIndex, "..").concat(lastIndex, "] range");
2901
2901
  });
2902
2902
  if (PreClip.isBackward(scroller, firstIndex)) {
2903
2903
  PreClip.prepareClipByDirection(scroller, exports.Direction.backward, firstIndex);
@@ -2981,7 +2981,7 @@
2981
2981
  var _a;
2982
2982
  var buffer = scroller.buffer, paddings = scroller.viewport.paddings, clip = scroller.state.clip, logger = scroller.logger;
2983
2983
  var size = (_a = {}, _a[exports.Direction.backward] = 0, _a[exports.Direction.forward] = 0, _a);
2984
- logger.stat("before clip (" + ++clip.callCount + ")");
2984
+ logger.stat("before clip (".concat(++clip.callCount, ")"));
2985
2985
  var itemsToRemove = buffer.items.filter(function (item) {
2986
2986
  if (!item.toRemove) {
2987
2987
  return false;
@@ -3009,10 +3009,10 @@
3009
3009
  });
3010
3010
  return list.length
3011
3011
  ? [
3012
- "clipped " + list.length + " item(s) from Buffer" +
3013
- (size.backward ? ", +" + size.backward + " fwd px" : '') +
3014
- (size.forward ? ", +" + size.forward + " bwd px" : '') +
3015
- (", range: [" + list[0] + ".." + list[list.length - 1] + "]")
3012
+ "clipped ".concat(list.length, " item(s) from Buffer") +
3013
+ (size.backward ? ", +".concat(size.backward, " fwd px") : '') +
3014
+ (size.forward ? ", +".concat(size.forward, " bwd px") : '') +
3015
+ ", range: [".concat(list[0], "..").concat(list[list.length - 1], "]")
3016
3016
  ]
3017
3017
  : 'clipped 0 items from Buffer';
3018
3018
  });
@@ -3038,19 +3038,19 @@
3038
3038
  return arg;
3039
3039
  }
3040
3040
  else if (Array.isArray(arg)) {
3041
- return "[of " + arg.length + "]";
3041
+ return "[of ".concat(arg.length, "]");
3042
3042
  }
3043
3043
  return '{ ' + Object.keys(arg).join(', ') + ' }';
3044
3044
  })
3045
3045
  .join(', ');
3046
- _this.log("adapter: " + methodName + "(" + (params || '') + ")" + (add || ''));
3046
+ _this.log("adapter: ".concat(methodName, "(").concat(params || '', ")").concat(add || ''));
3047
3047
  };
3048
3048
  var settings = scroller.settings;
3049
3049
  this.debug = settings.debug;
3050
3050
  this.immediateLog = settings.immediateLog;
3051
3051
  this.logTime = settings.logTime;
3052
3052
  this.getTime = function () {
3053
- return scroller.state && " // time: " + scroller.state.time;
3053
+ return scroller.state && " // time: ".concat(scroller.state.time);
3054
3054
  };
3055
3055
  this.getStat = function () {
3056
3056
  var buffer = scroller.buffer, viewport = scroller.viewport;
@@ -3062,26 +3062,26 @@
3062
3062
  'fwd_p: ' + viewport.paddings.forward.size + ', ' +
3063
3063
  'default: ' + (buffer.defaultSize || 'no') + ', ' +
3064
3064
  'items: ' + buffer.getVisibleItemsCount() + ', ' +
3065
- 'range: ' + (first && last ? "[" + first.$index + ".." + last.$index + "]" : 'no');
3065
+ 'range: ' + (first && last ? "[".concat(first.$index, "..").concat(last.$index, "]") : 'no');
3066
3066
  };
3067
3067
  this.getFetchRange = function () {
3068
3068
  var _a = scroller.state.fetch, first = _a.first.index, last = _a.last.index;
3069
3069
  return !Number.isNaN(first) && !Number.isNaN(last)
3070
- ? "[" + first + ".." + last + "]"
3070
+ ? "[".concat(first, "..").concat(last, "]")
3071
3071
  : 'no';
3072
3072
  };
3073
3073
  this.getLoopId = function () { return scroller.state.cycle.loopId; };
3074
3074
  this.getLoopIdNext = function () { return scroller.state.cycle.loopIdNext; };
3075
3075
  this.getWorkflowCycleData = function () {
3076
- return settings.instanceIndex + "-" + scroller.state.cycle.count;
3076
+ return "".concat(settings.instanceIndex, "-").concat(scroller.state.cycle.count);
3077
3077
  };
3078
- this.getScrollPosition = function (element) { return scroller.routines.getScrollPosition(element); };
3078
+ this.getScrollPosition = function () { return scroller.routines.getScrollPosition(); };
3079
3079
  this.log(function () {
3080
3080
  return 'vscroll Workflow has been started, ' +
3081
- ("core: " + packageInfo.core.name + " v" + packageInfo.core.version + ", ") +
3082
- ("consumer: " + packageInfo.consumer.name + " v" + packageInfo.consumer.version + ", ") +
3083
- ("scroller instance: " + settings.instanceIndex + ", adapter ") +
3084
- (!adapter ? 'is not instantiated' : "instance: " + adapter.id);
3081
+ "core: ".concat(packageInfo.core.name, " v").concat(packageInfo.core.version, ", ") +
3082
+ "consumer: ".concat(packageInfo.consumer.name, " v").concat(packageInfo.consumer.version, ", ") +
3083
+ "scroller instance: ".concat(settings.instanceIndex, ", adapter ") +
3084
+ (!adapter ? 'is not instantiated' : "instance: ".concat(adapter.id));
3085
3085
  });
3086
3086
  }
3087
3087
  Logger.prototype.object = function (str, obj, stringify) {
@@ -3122,20 +3122,20 @@
3122
3122
  'color: #888; border: dashed #888 0; border-bottom-width: 0px',
3123
3123
  'color: #000; border-width: 0'
3124
3124
  ];
3125
- this.log(function () { return __spreadArray(['%cstat' + (str ? " " + str : '') + ',%c ' + _this.getStat()], __read(logStyles_1), false); });
3125
+ this.log(function () { return __spreadArray(['%cstat' + (str ? " ".concat(str) : '') + ',%c ' + _this.getStat()], __read(logStyles_1), false); });
3126
3126
  }
3127
3127
  };
3128
3128
  Logger.prototype.fetch = function (str) {
3129
3129
  var _this = this;
3130
3130
  if (this.debug) {
3131
- var _text_1 = 'fetch interval' + (str ? " " + str : '');
3131
+ var _text_1 = 'fetch interval' + (str ? " ".concat(str) : '');
3132
3132
  var logStyles_2 = ['color: #888', 'color: #000'];
3133
- this.log(function () { return __spreadArray(["%c" + _text_1 + ": %c" + _this.getFetchRange()], __read(logStyles_2), false); });
3133
+ this.log(function () { return __spreadArray(["%c".concat(_text_1, ": %c").concat(_this.getFetchRange())], __read(logStyles_2), false); });
3134
3134
  }
3135
3135
  };
3136
3136
  Logger.prototype.prepareForLog = function (data) {
3137
3137
  return data instanceof Event && data.target
3138
- ? this.getScrollPosition(data.target)
3138
+ ? this.getScrollPosition()
3139
3139
  : data;
3140
3140
  };
3141
3141
  Logger.prototype.logProcess = function (data) {
@@ -3146,13 +3146,13 @@
3146
3146
  // inner loop start-end log
3147
3147
  var loopLog = [];
3148
3148
  if (process === CommonProcess.init && status === ProcessStatus.next) {
3149
- loopLog.push("%c---=== loop " + this.getLoopIdNext() + " start");
3149
+ loopLog.push("%c---=== loop ".concat(this.getLoopIdNext(), " start"));
3150
3150
  }
3151
3151
  else if (process === CommonProcess.end) {
3152
- loopLog.push("%c---=== loop " + this.getLoopId() + " done");
3152
+ loopLog.push("%c---=== loop ".concat(this.getLoopId(), " done"));
3153
3153
  var parent_1 = payload && payload.process;
3154
3154
  if (status === ProcessStatus.next && (parent_1 !== AdapterProcess.reset && parent_1 !== AdapterProcess.reload)) {
3155
- loopLog[0] += ", loop " + this.getLoopIdNext() + " start";
3155
+ loopLog[0] += ", loop ".concat(this.getLoopIdNext(), " start");
3156
3156
  }
3157
3157
  }
3158
3158
  if (loopLog.length) {
@@ -3163,14 +3163,14 @@
3163
3163
  if (start === void 0) { start = true; }
3164
3164
  var logData = this.getWorkflowCycleData();
3165
3165
  var border = start ? '1px 0 0 1px' : '0 0 1px 1px';
3166
- var logStyles = "color: #0000aa; border: solid #555 1px; border-width: " + border + "; margin-left: -2px";
3167
- this.log(function () { return ["%c ~~~ WF Cycle " + logData + " " + (start ? 'STARTED' : 'FINALIZED') + " ~~~ ", logStyles]; });
3166
+ var logStyles = "color: #0000aa; border: solid #555 1px; border-width: ".concat(border, "; margin-left: -2px");
3167
+ this.log(function () { return ["%c ~~~ WF Cycle ".concat(logData, " ").concat(start ? 'STARTED' : 'FINALIZED', " ~~~ "), logStyles]; });
3168
3168
  };
3169
3169
  Logger.prototype.logError = function (str) {
3170
3170
  var _this = this;
3171
3171
  if (this.debug) {
3172
3172
  var logStyles_3 = ['color: #a00;', 'color: #000'];
3173
- this.log(function () { return __spreadArray(['error:%c' + (str ? " " + str : '') + ("%c (loop " + _this.getLoopIdNext() + ")")], __read(logStyles_3), false); });
3173
+ this.log(function () { return __spreadArray(['error:%c' + (str ? " ".concat(str) : '') + "%c (loop ".concat(_this.getLoopIdNext(), ")")], __read(logStyles_3), false); });
3174
3174
  }
3175
3175
  };
3176
3176
  Logger.prototype.log = function () {
@@ -3230,64 +3230,85 @@
3230
3230
  }());
3231
3231
 
3232
3232
  var Routines = /** @class */ (function () {
3233
- function Routines(settings) {
3234
- this.horizontal = settings.horizontal;
3235
- this.window = settings.windowViewport;
3236
- this.viewport = settings.viewport;
3233
+ function Routines(element, settings, CustomRoutines) {
3234
+ var _this = this;
3235
+ this.element = element;
3236
+ this.settings = {
3237
+ viewport: settings.viewport,
3238
+ horizontal: settings.horizontal,
3239
+ window: settings.windowViewport
3240
+ };
3241
+ // provide custom overrides for IRoutines methods
3242
+ if (CustomRoutines) {
3243
+ var self_1 = this;
3244
+ var routines_1 = new CustomRoutines(element, this.settings);
3245
+ Object.getOwnPropertyNames(Object.getPrototypeOf(routines_1))
3246
+ .filter(function (method) {
3247
+ return method !== 'constructor' &&
3248
+ typeof routines_1[method] === 'function' &&
3249
+ typeof self_1[method] === 'function';
3250
+ })
3251
+ .forEach(function (method) {
3252
+ return self_1[method] = function () {
3253
+ var args = [];
3254
+ for (var _i = 0; _i < arguments.length; _i++) {
3255
+ args[_i] = arguments[_i];
3256
+ }
3257
+ return routines_1[method].apply(_this, args);
3258
+ };
3259
+ });
3260
+ }
3261
+ // initialization
3262
+ this.viewport = this.getViewportElement();
3263
+ this.onInit(settings);
3237
3264
  }
3238
3265
  Routines.prototype.checkElement = function (element) {
3239
3266
  if (!element) {
3240
3267
  throw new Error('HTML element is not defined');
3241
3268
  }
3242
3269
  };
3243
- Routines.prototype.getHostElement = function (element) {
3244
- if (this.window) {
3270
+ Routines.prototype.getViewportElement = function () {
3271
+ if (this.settings.window) {
3245
3272
  return document.documentElement;
3246
3273
  }
3247
- if (this.viewport) {
3248
- return this.viewport;
3274
+ if (this.settings.viewport) {
3275
+ return this.settings.viewport;
3249
3276
  }
3250
- this.checkElement(element);
3251
- var parent = element.parentElement;
3277
+ this.checkElement(this.element);
3278
+ var parent = this.element.parentElement;
3252
3279
  this.checkElement(parent);
3253
3280
  return parent;
3254
3281
  };
3255
- Routines.prototype.getScrollEventReceiver = function (element) {
3256
- if (this.window) {
3257
- return window;
3282
+ Routines.prototype.onInit = function (settings) {
3283
+ if (settings.windowViewport) {
3284
+ if ('scrollRestoration' in history) {
3285
+ history.scrollRestoration = 'manual';
3286
+ }
3258
3287
  }
3259
- return this.getHostElement(element);
3260
- };
3261
- Routines.prototype.setupScrollRestoration = function () {
3262
- if ('scrollRestoration' in history) {
3263
- history.scrollRestoration = 'manual';
3288
+ if (settings.dismissOverflowAnchor) {
3289
+ this.viewport.style.overflowAnchor = 'none';
3264
3290
  }
3265
3291
  };
3266
- Routines.prototype.dismissOverflowAnchor = function (element) {
3267
- this.checkElement(element);
3268
- element.style.overflowAnchor = 'none';
3269
- };
3270
3292
  Routines.prototype.findElementBySelector = function (element, selector) {
3271
3293
  this.checkElement(element);
3272
3294
  return element.querySelector(selector);
3273
3295
  };
3274
- Routines.prototype.findPaddingElement = function (element, direction) {
3275
- return this.findElementBySelector(element, "[data-padding-" + direction + "]");
3296
+ Routines.prototype.findPaddingElement = function (direction) {
3297
+ return this.findElementBySelector(this.element, "[data-padding-".concat(direction, "]"));
3276
3298
  };
3277
- Routines.prototype.findItemElement = function (element, id) {
3278
- return this.findElementBySelector(element, "[data-sid=\"" + id + "\"]");
3299
+ Routines.prototype.findItemElement = function (id) {
3300
+ return this.findElementBySelector(this.element, "[data-sid=\"".concat(id, "\"]"));
3279
3301
  };
3280
- Routines.prototype.getScrollPosition = function (element) {
3281
- if (this.window) {
3282
- return window.pageYOffset;
3302
+ Routines.prototype.getScrollPosition = function () {
3303
+ if (this.settings.window) {
3304
+ return this.settings.horizontal ? window.pageXOffset : window.pageYOffset;
3283
3305
  }
3284
- this.checkElement(element);
3285
- return element[this.horizontal ? 'scrollLeft' : 'scrollTop'];
3306
+ return this.viewport[this.settings.horizontal ? 'scrollLeft' : 'scrollTop'];
3286
3307
  };
3287
- Routines.prototype.setScrollPosition = function (element, value) {
3308
+ Routines.prototype.setScrollPosition = function (value) {
3288
3309
  value = Math.max(0, value);
3289
- if (this.window) {
3290
- if (this.horizontal) {
3310
+ if (this.settings.window) {
3311
+ if (this.settings.horizontal) {
3291
3312
  window.scrollTo(value, window.scrollY);
3292
3313
  }
3293
3314
  else {
@@ -3295,49 +3316,62 @@
3295
3316
  }
3296
3317
  return;
3297
3318
  }
3298
- this.checkElement(element);
3299
- element[this.horizontal ? 'scrollLeft' : 'scrollTop'] = value;
3319
+ this.viewport[this.settings.horizontal ? 'scrollLeft' : 'scrollTop'] = value;
3300
3320
  };
3301
- Routines.prototype.getParams = function (element, doNotBind) {
3321
+ Routines.prototype.getElementParams = function (element) {
3302
3322
  this.checkElement(element);
3303
- if (this.window && doNotBind) {
3304
- var clientWidth = element.clientWidth, clientHeight = element.clientHeight, clientLeft = element.clientLeft, clientTop = element.clientTop;
3305
- return {
3306
- 'height': clientHeight,
3307
- 'width': clientWidth,
3308
- 'top': clientTop,
3309
- 'bottom': clientTop + clientHeight,
3310
- 'left': clientLeft,
3311
- 'right': clientLeft + clientWidth,
3312
- 'x': clientLeft,
3313
- 'y': clientTop,
3314
- 'toJSON': function () { return null; },
3315
- };
3316
- }
3317
3323
  return element.getBoundingClientRect();
3318
3324
  };
3319
- Routines.prototype.getSize = function (element, doNotBind) {
3320
- return this.getParams(element, doNotBind)[this.horizontal ? 'width' : 'height'];
3325
+ Routines.prototype.getWindowParams = function () {
3326
+ var _a = this.viewport, clientWidth = _a.clientWidth, clientHeight = _a.clientHeight, clientLeft = _a.clientLeft, clientTop = _a.clientTop;
3327
+ return {
3328
+ 'height': clientHeight,
3329
+ 'width': clientWidth,
3330
+ 'top': clientTop,
3331
+ 'bottom': clientTop + clientHeight,
3332
+ 'left': clientLeft,
3333
+ 'right': clientLeft + clientWidth,
3334
+ 'x': clientLeft,
3335
+ 'y': clientTop,
3336
+ 'toJSON': function () { return null; },
3337
+ };
3338
+ };
3339
+ Routines.prototype.getSize = function (element) {
3340
+ return this.getElementParams(element)[this.settings.horizontal ? 'width' : 'height'];
3341
+ };
3342
+ Routines.prototype.getScrollerSize = function () {
3343
+ return this.getElementParams(this.element)[this.settings.horizontal ? 'width' : 'height'];
3344
+ };
3345
+ Routines.prototype.getViewportSize = function () {
3346
+ if (this.settings.window) {
3347
+ return this.getWindowParams()[this.settings.horizontal ? 'width' : 'height'];
3348
+ }
3349
+ return this.getSize(this.viewport);
3321
3350
  };
3322
3351
  Routines.prototype.getSizeStyle = function (element) {
3323
3352
  this.checkElement(element);
3324
- var size = element.style[this.horizontal ? 'width' : 'height'];
3353
+ var size = element.style[this.settings.horizontal ? 'width' : 'height'];
3325
3354
  return parseFloat(size) || 0;
3326
3355
  };
3327
3356
  Routines.prototype.setSizeStyle = function (element, value) {
3328
3357
  this.checkElement(element);
3329
3358
  value = Math.max(0, Math.round(value));
3330
- element.style[this.horizontal ? 'width' : 'height'] = value + "px";
3359
+ element.style[this.settings.horizontal ? 'width' : 'height'] = "".concat(value, "px");
3331
3360
  };
3332
- Routines.prototype.getEdge = function (element, direction, doNotBind) {
3333
- var params = this.getParams(element, doNotBind);
3361
+ Routines.prototype.getEdge = function (element, direction) {
3362
+ var horizontal = this.settings.horizontal;
3363
+ var params = this.getElementParams(element);
3334
3364
  var isFwd = direction === exports.Direction.forward;
3335
- return params[isFwd ? (this.horizontal ? 'right' : 'bottom') : (this.horizontal ? 'left' : 'top')];
3365
+ return params[isFwd ? (horizontal ? 'right' : 'bottom') : (horizontal ? 'left' : 'top')];
3336
3366
  };
3337
- Routines.prototype.getEdge2 = function (element, direction, relativeElement, opposite) {
3338
- // vertical only ?
3339
- return element.offsetTop - (relativeElement ? relativeElement.scrollTop : 0) +
3340
- (direction === (!opposite ? exports.Direction.forward : exports.Direction.backward) ? this.getSize(element) : 0);
3367
+ Routines.prototype.getViewportEdge = function (direction) {
3368
+ var _a = this.settings, window = _a.window, horizontal = _a.horizontal;
3369
+ if (window) {
3370
+ var params = this.getWindowParams();
3371
+ var isFwd = direction === exports.Direction.forward;
3372
+ return params[isFwd ? (horizontal ? 'right' : 'bottom') : (horizontal ? 'left' : 'top')];
3373
+ }
3374
+ return this.getEdge(this.viewport, direction);
3341
3375
  };
3342
3376
  Routines.prototype.makeElementVisible = function (element) {
3343
3377
  this.checkElement(element);
@@ -3349,9 +3383,12 @@
3349
3383
  this.checkElement(element);
3350
3384
  element.style.display = 'none';
3351
3385
  };
3352
- Routines.prototype.getOffset = function (element) {
3353
- this.checkElement(element);
3354
- return (this.horizontal ? element.offsetLeft : element.offsetTop) || 0;
3386
+ Routines.prototype.getOffset = function () {
3387
+ var _this = this;
3388
+ var get = function (element) {
3389
+ return (_this.settings.horizontal ? element.offsetLeft : element.offsetTop) || 0;
3390
+ };
3391
+ return get(this.element) - (!this.settings.window ? get(this.viewport) : 0);
3355
3392
  };
3356
3393
  Routines.prototype.scrollTo = function (element, argument) {
3357
3394
  this.checkElement(element);
@@ -3365,16 +3402,17 @@
3365
3402
  var animationFrameId = requestAnimationFrame(function () { return cb(); });
3366
3403
  return function () { return cancelAnimationFrame(animationFrameId); };
3367
3404
  };
3368
- Routines.prototype.onScroll = function (element, handler) {
3369
- element.addEventListener('scroll', handler);
3370
- return function () { return element.removeEventListener('scroll', handler); };
3405
+ Routines.prototype.onScroll = function (handler) {
3406
+ var eventReceiver = this.settings.window ? window : this.viewport;
3407
+ eventReceiver.addEventListener('scroll', handler);
3408
+ return function () { return eventReceiver.removeEventListener('scroll', handler); };
3371
3409
  };
3372
3410
  return Routines;
3373
3411
  }());
3374
3412
 
3375
3413
  var Padding = /** @class */ (function () {
3376
- function Padding(element, direction, routines) {
3377
- var found = routines.findPaddingElement(element, direction);
3414
+ function Padding(direction, routines) {
3415
+ var found = routines.findPaddingElement(direction);
3378
3416
  routines.checkElement(found);
3379
3417
  this.element = found;
3380
3418
  this.direction = direction;
@@ -3396,10 +3434,10 @@
3396
3434
  return Padding;
3397
3435
  }());
3398
3436
  var Paddings = /** @class */ (function () {
3399
- function Paddings(element, routines, settings) {
3437
+ function Paddings(routines, settings) {
3400
3438
  this.settings = settings;
3401
- this.forward = new Padding(element, exports.Direction.forward, routines);
3402
- this.backward = new Padding(element, exports.Direction.backward, routines);
3439
+ this.forward = new Padding(exports.Direction.forward, routines);
3440
+ this.backward = new Padding(exports.Direction.backward, routines);
3403
3441
  }
3404
3442
  Paddings.prototype.byDirection = function (direction, opposite) {
3405
3443
  return direction === exports.Direction.backward
@@ -3451,21 +3489,12 @@
3451
3489
  }());
3452
3490
 
3453
3491
  var Viewport = /** @class */ (function () {
3454
- function Viewport(element, settings, routines, state, logger) {
3455
- this.element = element;
3492
+ function Viewport(settings, routines, state, logger) {
3456
3493
  this.settings = settings;
3457
3494
  this.routines = routines;
3458
3495
  this.state = state;
3459
3496
  this.logger = logger;
3460
- this.hostElement = this.routines.getHostElement(this.element);
3461
- this.scrollEventReceiver = this.routines.getScrollEventReceiver(this.element);
3462
- if (settings.windowViewport) {
3463
- this.routines.setupScrollRestoration();
3464
- }
3465
- if (settings.dismissOverflowAnchor) {
3466
- this.routines.dismissOverflowAnchor(this.hostElement);
3467
- }
3468
- this.paddings = new Paddings(this.element, this.routines, settings);
3497
+ this.paddings = new Paddings(this.routines, settings);
3469
3498
  }
3470
3499
  Viewport.prototype.reset = function (startIndex) {
3471
3500
  this.setOffset();
@@ -3479,16 +3508,16 @@
3479
3508
  this.logger.log(function () { return ['setting scroll position at', value, '[cancelled]']; });
3480
3509
  return value;
3481
3510
  }
3482
- this.routines.setScrollPosition(this.hostElement, value);
3511
+ this.routines.setScrollPosition(value);
3483
3512
  var position = this.scrollPosition;
3484
3513
  this.logger.log(function () { return __spreadArray([
3485
3514
  'setting scroll position at', position
3486
- ], __read((position !== value ? ["(" + value + ")"] : [])), false); });
3515
+ ], __read((position !== value ? ["(".concat(value, ")")] : [])), false); });
3487
3516
  return position;
3488
3517
  };
3489
3518
  Object.defineProperty(Viewport.prototype, "scrollPosition", {
3490
3519
  get: function () {
3491
- return this.routines.getScrollPosition(this.hostElement);
3520
+ return this.routines.getScrollPosition();
3492
3521
  },
3493
3522
  set: function (value) {
3494
3523
  this.setPosition(value);
@@ -3497,10 +3526,10 @@
3497
3526
  configurable: true
3498
3527
  });
3499
3528
  Viewport.prototype.getSize = function () {
3500
- return this.routines.getSize(this.hostElement, true);
3529
+ return this.routines.getViewportSize();
3501
3530
  };
3502
3531
  Viewport.prototype.getScrollableSize = function () {
3503
- return this.routines.getSize(this.element);
3532
+ return this.routines.getScrollerSize();
3504
3533
  };
3505
3534
  Viewport.prototype.getMaxScrollPosition = function () {
3506
3535
  return this.getScrollableSize() - this.getSize();
@@ -3509,16 +3538,13 @@
3509
3538
  return this.getSize() * this.settings.padding;
3510
3539
  };
3511
3540
  Viewport.prototype.getEdge = function (direction) {
3512
- return this.routines.getEdge(this.hostElement, direction, true);
3541
+ return this.routines.getViewportEdge(direction);
3513
3542
  };
3514
3543
  Viewport.prototype.setOffset = function () {
3515
- this.offset = this.routines.getOffset(this.element);
3516
- if (!this.settings.windowViewport) {
3517
- this.offset -= this.routines.getOffset(this.hostElement);
3518
- }
3544
+ this.offset = this.routines.getOffset();
3519
3545
  };
3520
3546
  Viewport.prototype.findItemElementById = function (id) {
3521
- return this.routines.findItemElement(this.element, id);
3547
+ return this.routines.findItemElement(id);
3522
3548
  };
3523
3549
  Viewport.prototype.getEdgeVisibleItem = function (items, direction) {
3524
3550
  var bwd = direction === exports.Direction.backward;
@@ -3732,7 +3758,7 @@
3732
3758
  Cache.prototype.recalculateDefaultSize = function () {
3733
3759
  var _this = this;
3734
3760
  if (this.defaultSize.recalculate(this.size)) {
3735
- this.logger.log(function () { return "default size has been updated: " + _this.defaultSize.get(); });
3761
+ this.logger.log(function () { return "default size has been updated: ".concat(_this.defaultSize.get()); });
3736
3762
  return true;
3737
3763
  }
3738
3764
  return false;
@@ -3951,7 +3977,7 @@
3951
3977
  this.logger.log('no items to fill the buffer; wrong indexes');
3952
3978
  return false;
3953
3979
  }
3954
- this.logger.log(function () { return "going to fill the buffer with " + items.length + " item(s)"; });
3980
+ this.logger.log(function () { return "going to fill the buffer with ".concat(items.length, " item(s)"); });
3955
3981
  return true;
3956
3982
  };
3957
3983
  CheckBufferCall.prototype.insertInBuffer = function (predicate, before, after) {
@@ -3975,18 +4001,18 @@
3975
4001
  if (index < finiteAbsMinIndex || index > finiteAbsMaxIndex) {
3976
4002
  this.logger.log(function () {
3977
4003
  return 'no items to insert virtually; ' +
3978
- ("selected index (" + index + ") does not match virtual area [" + finiteAbsMinIndex + ".." + finiteAbsMaxIndex + "]");
4004
+ "selected index (".concat(index, ") does not match virtual area [").concat(finiteAbsMinIndex, "..").concat(finiteAbsMaxIndex, "]");
3979
4005
  });
3980
4006
  return false;
3981
4007
  }
3982
4008
  var before = direction === exports.Direction.backward;
3983
4009
  if (!(index < firstIndex + (before ? 1 : 0) || index > lastIndex - (before ? 0 : 1))) {
3984
4010
  this.logger.log(function () {
3985
- return "no items to insert virtually; selected index (" + index + ") belongs Buffer [" + firstIndex + ".." + lastIndex + "]";
4011
+ return "no items to insert virtually; selected index (".concat(index, ") belongs Buffer [").concat(firstIndex, "..").concat(lastIndex, "]");
3986
4012
  });
3987
4013
  return false;
3988
4014
  }
3989
- this.logger.log(function () { return "going to insert " + items.length + " item(s) virtually"; });
4015
+ this.logger.log(function () { return "going to insert ".concat(items.length, " item(s) virtually"); });
3990
4016
  return true;
3991
4017
  };
3992
4018
  return CheckBufferCall;
@@ -4030,15 +4056,15 @@
4030
4056
  var start = this.startIndexUser;
4031
4057
  var index = Number(newStartIndex);
4032
4058
  if (Number.isNaN(index)) {
4033
- this.logger.log(function () { return "fallback startIndex to settings.startIndex (" + start + ")"; });
4059
+ this.logger.log(function () { return "fallback startIndex to settings.startIndex (".concat(start, ")"); });
4034
4060
  index = start;
4035
4061
  }
4036
4062
  if (index < min) {
4037
- this.logger.log(function () { return "setting startIndex to settings.minIndex (" + min + ") because " + index + " < " + min; });
4063
+ this.logger.log(function () { return "setting startIndex to settings.minIndex (".concat(min, ") because ").concat(index, " < ").concat(min); });
4038
4064
  index = min;
4039
4065
  }
4040
4066
  if (index > max) {
4041
- this.logger.log(function () { return "setting startIndex to settings.maxIndex (" + max + ") because " + index + " > " + max; });
4067
+ this.logger.log(function () { return "setting startIndex to settings.maxIndex (".concat(max, ") because ").concat(index, " > ").concat(max); });
4042
4068
  index = max;
4043
4069
  }
4044
4070
  this.startIndex = index;
@@ -4374,15 +4400,11 @@
4374
4400
  };
4375
4401
  Buffer.prototype.getFirstVisibleItem = function () {
4376
4402
  var index = this.getFirstVisibleItemIndex();
4377
- if (index >= 0) {
4378
- return this.items[index];
4379
- }
4403
+ return index >= 0 ? this.items[index] : void 0;
4380
4404
  };
4381
4405
  Buffer.prototype.getLastVisibleItem = function () {
4382
4406
  var index = this.getLastVisibleItemIndex();
4383
- if (index >= 0) {
4384
- return this.items[index];
4385
- }
4407
+ return index >= 0 ? this.items[index] : void 0;
4386
4408
  };
4387
4409
  Buffer.prototype.getEdgeVisibleItem = function (direction, opposite) {
4388
4410
  return direction === (!opposite ? exports.Direction.forward : exports.Direction.backward) ?
@@ -4439,14 +4461,14 @@
4439
4461
  }
4440
4462
  Object.defineProperty(WorkflowCycleModel.prototype, "loopId", {
4441
4463
  get: function () {
4442
- return this.instanceIndex + "-" + this.count + "-" + this.innerLoop.total;
4464
+ return "".concat(this.instanceIndex, "-").concat(this.count, "-").concat(this.innerLoop.total);
4443
4465
  },
4444
4466
  enumerable: false,
4445
4467
  configurable: true
4446
4468
  });
4447
4469
  Object.defineProperty(WorkflowCycleModel.prototype, "loopIdNext", {
4448
4470
  get: function () {
4449
- return this.instanceIndex + "-" + this.count + "-" + (this.innerLoop.total + 1);
4471
+ return "".concat(this.instanceIndex, "-").concat(this.count, "-").concat(this.innerLoop.total + 1);
4450
4472
  },
4451
4473
  enumerable: false,
4452
4474
  configurable: true
@@ -5060,7 +5082,7 @@
5060
5082
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5061
5083
  Adapter.prototype.reset = function (options) {
5062
5084
  this.reloadCounter++;
5063
- this.logger.logAdapterMethod('reset', options, " of " + this.reloadId);
5085
+ this.logger.logAdapterMethod('reset', options, " of ".concat(this.reloadId));
5064
5086
  this.workflow.call({
5065
5087
  process: AdapterProcess.reset,
5066
5088
  status: ProcessStatus.start,
@@ -5070,7 +5092,7 @@
5070
5092
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5071
5093
  Adapter.prototype.reload = function (options) {
5072
5094
  this.reloadCounter++;
5073
- this.logger.logAdapterMethod('reload', options, " of " + this.reloadId);
5095
+ this.logger.logAdapterMethod('reload', options, " of ".concat(this.reloadId));
5074
5096
  this.workflow.call({
5075
5097
  process: AdapterProcess.reload,
5076
5098
  status: ProcessStatus.start,
@@ -5177,7 +5199,7 @@
5177
5199
  });
5178
5200
  }).then(function (immediate) {
5179
5201
  var success = reloadId === _this.reloadId;
5180
- _this.logger.log(function () { return !success ? "relax promise cancelled due to " + reloadId + " != " + _this.reloadId : void 0; });
5202
+ _this.logger.log(function () { return !success ? "relax promise cancelled due to ".concat(reloadId, " != ").concat(_this.reloadId) : void 0; });
5181
5203
  return {
5182
5204
  immediate: immediate,
5183
5205
  success: success,
@@ -5188,7 +5210,7 @@
5188
5210
  Adapter.prototype.relax = function (callback) {
5189
5211
  var _this = this;
5190
5212
  var reloadId = this.reloadId;
5191
- this.logger.logAdapterMethod('relax', callback, " of " + reloadId);
5213
+ this.logger.logAdapterMethod('relax', callback, " of ".concat(reloadId));
5192
5214
  if (!this.init) {
5193
5215
  return Promise.resolve(methodPreResult);
5194
5216
  }
@@ -5210,21 +5232,21 @@
5210
5232
  var instanceCount = 0;
5211
5233
  var Scroller = /** @class */ (function () {
5212
5234
  function Scroller(_a) {
5213
- var datasource = _a.datasource, consumer = _a.consumer, element = _a.element, workflow = _a.workflow, scroller = _a.scroller;
5235
+ var datasource = _a.datasource, consumer = _a.consumer, element = _a.element, workflow = _a.workflow, CustomRoutines = _a.Routines, scroller = _a.scroller;
5214
5236
  var get = validate(datasource, DATASOURCE).params.get;
5215
5237
  if (!get.isValid) {
5216
- throw new Error(INVALID_DATASOURCE_PREFIX + " " + get.errors[0]);
5238
+ throw new Error("".concat(INVALID_DATASOURCE_PREFIX, " ").concat(get.errors[0]));
5217
5239
  }
5218
5240
  var packageInfo = scroller ? scroller.state.packageInfo : { consumer: consumer, core: core };
5219
- element = scroller ? scroller.viewport.element : element;
5241
+ element = scroller ? scroller.routines.element : element;
5220
5242
  workflow = scroller ? scroller.workflow : workflow;
5221
5243
  this.workflow = workflow;
5222
5244
  this.settings = new Settings(datasource.settings, datasource.devSettings, ++instanceCount);
5223
5245
  this.logger = new Logger(this, packageInfo, datasource.adapter);
5224
- this.routines = new Routines(this.settings);
5246
+ this.routines = new Routines(element, this.settings, CustomRoutines);
5225
5247
  this.state = new State(packageInfo, this.settings, scroller ? scroller.state : void 0);
5226
5248
  this.buffer = new Buffer(this.settings, workflow.onDataChanged, this.logger);
5227
- this.viewport = new Viewport(element, this.settings, this.routines, this.state, this.logger);
5249
+ this.viewport = new Viewport(this.settings, this.routines, this.state, this.logger);
5228
5250
  this.logger.object('vscroll settings object', this.settings, true);
5229
5251
  this.initDatasource(datasource, scroller);
5230
5252
  }
@@ -5483,7 +5505,7 @@
5483
5505
  var Workflow = /** @class */ (function () {
5484
5506
  function Workflow(_a) {
5485
5507
  var _this = this;
5486
- var element = _a.element, datasource = _a.datasource, consumer = _a.consumer, run = _a.run;
5508
+ var element = _a.element, datasource = _a.datasource, consumer = _a.consumer, run = _a.run, Routines = _a.Routines;
5487
5509
  this.isInitialized = false;
5488
5510
  this.initTimer = null;
5489
5511
  this.adapterRun$ = new Reactive();
@@ -5498,7 +5520,13 @@
5498
5520
  done: this.done.bind(this),
5499
5521
  onError: this.onError.bind(this)
5500
5522
  };
5501
- this.scroller = new Scroller({ element: element, datasource: datasource, consumer: consumer, workflow: this.getUpdater() });
5523
+ this.scroller = new Scroller({
5524
+ element: element,
5525
+ datasource: datasource,
5526
+ consumer: consumer,
5527
+ workflow: this.getUpdater(),
5528
+ Routines: Routines
5529
+ });
5502
5530
  if (this.scroller.settings.initializeDelay) {
5503
5531
  this.initTimer = setTimeout(function () {
5504
5532
  _this.initTimer = null;
@@ -5519,13 +5547,13 @@
5519
5547
  status: ProcessStatus.start
5520
5548
  });
5521
5549
  // set up scroll event listener
5522
- var _a = this.scroller, scrollEventReceiver = _a.viewport.scrollEventReceiver, routines = _a.routines;
5550
+ var routines = this.scroller.routines;
5523
5551
  var onScrollHandler = function (event) { return _this.callWorkflow({
5524
5552
  process: CommonProcess.scroll,
5525
5553
  status: ProcessStatus.start,
5526
5554
  payload: { event: event }
5527
5555
  }); };
5528
- this.offScroll = routines.onScroll(scrollEventReceiver, onScrollHandler);
5556
+ this.offScroll = routines.onScroll(onScrollHandler);
5529
5557
  };
5530
5558
  Workflow.prototype.changeItems = function (items) {
5531
5559
  this.propagateChanges(items);
@@ -5553,7 +5581,7 @@
5553
5581
  '%cfire%c'
5554
5582
  ], ['color: #cc7777;', 'color: #000000;'], false), [
5555
5583
  process,
5556
- "\"" + status + "\""
5584
+ "\"".concat(status, "\"")
5557
5585
  ], false), __read((payload !== void 0 ? [payload] : [])), false); });
5558
5586
  }
5559
5587
  this.scroller.logger.logProcess(data);
@@ -5609,7 +5637,7 @@
5609
5637
  workflow.call.interrupted = true;
5610
5638
  this.scroller.workflow = this.getUpdater();
5611
5639
  this.interruptionCount++;
5612
- logger_1.log(function () { return "workflow had been interrupted by the " + process + " process (" + _this.interruptionCount + ")"; });
5640
+ logger_1.log(function () { return "workflow had been interrupted by the ".concat(process, " process (").concat(_this.interruptionCount, ")"); });
5613
5641
  }
5614
5642
  if (datasource) { // Scroller re-initialization case
5615
5643
  this.scroller.adapter.relax(function () {