vscroll 1.6.1 → 1.6.2

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Denis Hilt (https://github.com/dhilt)
3
+ Copyright (c) 2024 Denis Hilt (https://github.com/dhilt)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -73,7 +73,7 @@ interface WorkflowParams<ItemData> {
73
73
  }
74
74
  ```
75
75
 
76
- This is a TypeScript definition, but speaking of JavaScript, an argument object must contain 4 fields described below.
76
+ This is a TypeScript definition, but speaking of JavaScript, an argument object must contain 4 mandatory and 1 optional fields described below.
77
77
 
78
78
  ### 1. Consumer
79
79
 
@@ -176,13 +176,14 @@ Each item (in both `newItems` and `oldItems` lists) is an instance of the [Item
176
176
 
177
177
  `Run` callback is the most complex and environment-specific part of the `vscroll` API, which is fully depends on the environment for which the consumer is being created. Framework specific consumer should rely on internal mechanism of the framework to provide runtime DOM modifications.
178
178
 
179
- There are some requirements on how the items should be processed by `run` call:
180
- - after the `run` callback is completed, there must be `newItems.length` elements in the DOM between backward and forward padding elements;
181
- - old items that are not in the new item list should be removed from DOM; use `oldItems[].element` references for this purpose;
182
- - old items that are in the list should not be removed and recreated, as it may lead to an unwanted shift of the scroll position; just don't touch them;
183
- - new items elements should be rendered in accordance with `newItems[].$index` comparable to `$index` of elements that remain: `$index` must increase continuously and the directions of increase must persist across the `run` calls; Scroller maintains `$index` internally, so you only need to properly inject a set of `newItems[].element` into the DOM;
184
- - new elements should be rendered but not visible, and this should be achieved by "fixed" positioning and "left"/"top" coordinates placing the item element out of view; the Workflow will take care of visibility after calculations; an additional attribute `newItems[].invisible` can be used to determine if a given element should be hidden; this requirement can be changed by the `Routines` class setting, see below;
185
- - new items elements should have "data-sid" attribute, which value should reflect `newItems[].$index`.
179
+ There are some requirements on how the items should be processed by `run` call.
180
+
181
+ - After the `run` callback is completed, there must be `newItems.length` elements in the DOM between backward and forward padding elements.
182
+ - Old items that are not in the new items list should be removed from DOM. Use `oldItems[].element` references for this purpose.
183
+ - Old items that are in the new items list should not be removed and recreated, as this may result in unwanted scroll position shifts. Just don't touch them.
184
+ - New items elements should be rendered in the correct order. Specifically, in accordance with `newItems[].$index` comparable to `$index` of elements that remain: `$index` must increase continuously and the directions of increase must persist across the `run` calls. The scroller maintains `$index` internally, so you only need to properly inject a set of `newItems[].element` into the DOM.
185
+ - New elements should be rendered without being visible, and this should be achieved by "fixed" positioning and "left"/"top" coordinates that take the item element out of view. The Workflow will take care of visibility after calculations. An additional `newItems[].invisible` attribute can be used to determine whether a given element should be hidden. This requirement can be changed by the `Routines` class setting (see below).
186
+ - New items elements should have a "data-sid" attribute whose value should reflect `newItems[].$index`.
186
187
 
187
188
  ### 5. Routines
188
189
 
@@ -194,7 +195,7 @@ import { Routines, Workflow } from 'vscroll';
194
195
  class CustomRoutines extends Routines { ... }
195
196
 
196
197
  new Workflow({
197
- // consumer, element, datasource, run,
198
+ consumer, element, datasource, run, // required params
198
199
  Routines: CustomRoutines
199
200
  })
200
201
  ```
@@ -213,9 +214,9 @@ If we have a table layout case where we need to specify the offset of the table
213
214
 
214
215
  ```js
215
216
  new Workflow({
216
- // consumer, element, datasource, run,
217
+ consumer, element, datasource, run, // required params
217
218
  Routines: class extends Routines {
218
- getOffset(element) {
219
+ getOffset() {
219
220
  return document.querySelector('#viewport thead')?.offsetHeight || 0;
220
221
  }
221
222
  }
@@ -292,4 +293,4 @@ VScroll will receive its own Adapter API documentation later, but for now please
292
293
 
293
294
  __________
294
295
 
295
- 2023 &copy; [Denis Hilt](https://github.com/dhilt)
296
+ 2024 &copy; [Denis Hilt](https://github.com/dhilt)
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * vscroll (https://github.com/dhilt/vscroll) FESM5
3
- * Version: 1.6.1 (2024-03-03T11:48:52.952Z)
3
+ * Version: 1.6.2 (2024-05-23T11:50:23.145Z)
4
4
  * Author: Denis Hilt
5
5
  * License: MIT
6
6
  */
@@ -377,7 +377,7 @@ var reactiveConfigStorage = new Map();
377
377
 
378
378
  var core = {
379
379
  name: 'vscroll',
380
- version: '1.6.1'
380
+ version: '1.6.2'
381
381
  };
382
382
 
383
383
  var getBox = function (id) {