Skip to content

Commit a5035b4

Browse files
committed
2024, node 18, demo version
1 parent d775f41 commit a5035b4

File tree

5 files changed

+25
-20
lines changed

5 files changed

+25
-20
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ on:
55
branches:
66
- "**"
77
pull_request:
8-
branches: [ main ]
8+
branches: [main]
99
workflow_dispatch:
1010
inputs:
1111
cause:
12-
description: 'Reason'
12+
description: "Reason"
1313
required: true
14-
default: 'Manual triggering'
14+
default: "Manual triggering"
1515

1616
jobs:
1717
build:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
21-
node-version: [16.x]
21+
node-version: [18.x]
2222
steps:
2323
- name: Dispatched?
2424
if: ${{ github.event_name == 'workflow_dispatch' }}
@@ -27,10 +27,10 @@ jobs:
2727
echo "Build reason: ${{ github.event.inputs.cause }}"
2828
2929
- name: Checkout
30-
uses: actions/checkout@v2
30+
uses: actions/checkout@v3
3131

3232
- name: Use Node.js ${{ matrix.node-version }}
33-
uses: actions/setup-node@v1
33+
uses: actions/setup-node@v3
3434
with:
3535
node-version: ${{ matrix.node-version }}
3636

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Denis Hilt (https://github.com/dhilt)
3+
Copyright (c) 2024 Denis Hilt (https://github.com/dhilt)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ interface WorkflowParams<ItemData> {
7373
}
7474
```
7575

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.
7777

7878
### 1. Consumer
7979

@@ -176,13 +176,14 @@ Each item (in both `newItems` and `oldItems` lists) is an instance of the [Item
176176

177177
`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.
178178

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`.
186187

187188
### 5. Routines
188189

@@ -194,7 +195,7 @@ import { Routines, Workflow } from 'vscroll';
194195
class CustomRoutines extends Routines { ... }
195196

196197
new Workflow({
197-
// consumer, element, datasource, run,
198+
consumer, element, datasource, run, // required params
198199
Routines: CustomRoutines
199200
})
200201
```
@@ -213,9 +214,9 @@ If we have a table layout case where we need to specify the offset of the table
213214

214215
```js
215216
new Workflow({
216-
// consumer, element, datasource, run,
217+
consumer, element, datasource, run, // required params
217218
Routines: class extends Routines {
218-
getOffset(element) {
219+
getOffset() {
219220
return document.querySelector('#viewport thead')?.offsetHeight || 0;
220221
}
221222
}
@@ -292,4 +293,4 @@ VScroll will receive its own Adapter API documentation later, but for now please
292293
293294
__________
294295
295-
2023 &copy; [Denis Hilt](https://github.com/dhilt)
296+
2024 &copy; [Denis Hilt](https://github.com/dhilt)

demo/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ <h2 id="project_tagline">
3030
</div>
3131
</div>
3232
<div class="column">
33+
<p id="vscroll-core-version"> </p>
3334
<p>
3435
This is a minimal working demo of a virtual scroll list
3536
rendering an unlimited data in runtime.
@@ -46,7 +47,7 @@ <h2 id="project_tagline">
4647
</div>
4748
<div id="footer_wrap" class="outer">
4849
<footer class="inner">
49-
<p class="copyright">2023 © <a href="https://github.com/dhilt">Denis Hilt</a></p>
50+
<p class="copyright">2024 © <a href="https://github.com/dhilt">Denis Hilt</a></p>
5051
</footer>
5152
</div>
5253
<script src="./index.js"></script>

demo/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,6 @@ const createItemElement = item => {
7171

7272
// run the VScroll Workflow
7373
new VScroll.Workflow(workflowParams);
74+
75+
const versionElt = document.getElementById(`vscroll-core-version`);
76+
versionElt.innerHTML = `Package version: ${VScroll.packageInfo.name} v${VScroll.packageInfo.version}.`;

0 commit comments

Comments
 (0)