@aarongustafson/pull-to-refresh 1.0.0 → 1.0.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.
- package/README.md +5 -0
- package/package.json +3 -2
- package/pull-to-refresh.js +0 -29
package/README.md
CHANGED
|
@@ -9,6 +9,11 @@ A lightweight, customizable Web Component that adds pull-to-refresh functionalit
|
|
|
9
9
|
|
|
10
10
|
[Live Demo](https://aarongustafson.github.io/pull-to-refresh/demo/) ([Source](./demo/index.html))
|
|
11
11
|
|
|
12
|
+
### Additional Demos
|
|
13
|
+
|
|
14
|
+
- [esm.sh CDN](https://aarongustafson.github.io/pull-to-refresh/demo/esm.html) ([Source](./demo/esm.html)) - Loading from esm.sh
|
|
15
|
+
- [unpkg CDN](https://aarongustafson.github.io/pull-to-refresh/demo/unpkg.html) ([Source](./demo/unpkg.html)) - Loading from unpkg
|
|
16
|
+
|
|
12
17
|
## Features
|
|
13
18
|
|
|
14
19
|
- **Touch-optimized**: Smooth pull gesture with momentum and feedback
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aarongustafson/pull-to-refresh",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Web component that enables pull-to-refresh functionality.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"html",
|
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
"lint:eslint": "eslint .",
|
|
57
57
|
"format:eslint": "eslint . --fix",
|
|
58
58
|
"lint:prettier": "prettier \"**/*.js\" --check --ignore-path .gitignore",
|
|
59
|
-
"format:prettier": "prettier \"**/*.js\" --write --ignore-path .gitignore"
|
|
59
|
+
"format:prettier": "prettier \"**/*.js\" --write --ignore-path .gitignore",
|
|
60
|
+
"version": "node scripts/update-demo-versions.js && git add demo/esm.html"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
63
|
"@open-wc/eslint-config": "^13.0.0",
|
package/pull-to-refresh.js
CHANGED
|
@@ -199,28 +199,14 @@ export class PullToRefreshElement extends HTMLElement {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
handleStart(e) {
|
|
202
|
-
console.log('[PTR] handleStart', {
|
|
203
|
-
type: e.type,
|
|
204
|
-
pointerId: e.pointerId,
|
|
205
|
-
pointerType: e.pointerType,
|
|
206
|
-
clientY: e.clientY,
|
|
207
|
-
target: e.target,
|
|
208
|
-
});
|
|
209
202
|
if (
|
|
210
203
|
this._container.scrollTop === 0 &&
|
|
211
204
|
!this.isRefreshing &&
|
|
212
205
|
!this.disabled
|
|
213
206
|
) {
|
|
214
|
-
console.log('[PTR] Starting pull (pending direction confirmation)');
|
|
215
207
|
this.isPulling = true;
|
|
216
208
|
this.isPullingConfirmed = false;
|
|
217
209
|
this.startY = e.clientY;
|
|
218
|
-
} else {
|
|
219
|
-
console.log('[PTR] Not starting pull', {
|
|
220
|
-
scrollTop: this._container.scrollTop,
|
|
221
|
-
isRefreshing: this.isRefreshing,
|
|
222
|
-
disabled: this.disabled,
|
|
223
|
-
});
|
|
224
210
|
}
|
|
225
211
|
}
|
|
226
212
|
|
|
@@ -229,25 +215,16 @@ export class PullToRefreshElement extends HTMLElement {
|
|
|
229
215
|
|
|
230
216
|
const deltaY = e.clientY - this.startY;
|
|
231
217
|
|
|
232
|
-
console.log('[PTR] handleMove', {
|
|
233
|
-
clientY: e.clientY,
|
|
234
|
-
startY: this.startY,
|
|
235
|
-
delta: deltaY,
|
|
236
|
-
isPullingConfirmed: this.isPullingConfirmed,
|
|
237
|
-
});
|
|
238
|
-
|
|
239
218
|
// If direction not yet confirmed, check if user is pulling down
|
|
240
219
|
if (!this.isPullingConfirmed) {
|
|
241
220
|
// Need some movement to determine direction (at least 5px)
|
|
242
221
|
if (Math.abs(deltaY) > 5) {
|
|
243
222
|
if (deltaY < 0) {
|
|
244
223
|
// Upward pull - cancel the gesture
|
|
245
|
-
console.log('[PTR] Upward pull detected, canceling');
|
|
246
224
|
this.isPulling = false;
|
|
247
225
|
return;
|
|
248
226
|
} else {
|
|
249
227
|
// Downward pull - confirm and proceed
|
|
250
|
-
console.log('[PTR] Downward pull confirmed');
|
|
251
228
|
this.isPullingConfirmed = true;
|
|
252
229
|
|
|
253
230
|
// Prevent text selection during pull if disable-selection is set
|
|
@@ -300,11 +277,6 @@ export class PullToRefreshElement extends HTMLElement {
|
|
|
300
277
|
}
|
|
301
278
|
|
|
302
279
|
handleEnd() {
|
|
303
|
-
console.log('[PTR] handleEnd', {
|
|
304
|
-
isPulling: this.isPulling,
|
|
305
|
-
currentY: this.currentY,
|
|
306
|
-
threshold: this.threshold,
|
|
307
|
-
});
|
|
308
280
|
if (!this.isPulling) return;
|
|
309
281
|
|
|
310
282
|
this.isPulling = false;
|
|
@@ -337,7 +309,6 @@ export class PullToRefreshElement extends HTMLElement {
|
|
|
337
309
|
}
|
|
338
310
|
|
|
339
311
|
async triggerRefresh() {
|
|
340
|
-
console.log('[PTR] triggerRefresh called');
|
|
341
312
|
this.isRefreshing = true;
|
|
342
313
|
this._indicator.textContent = this.refreshingText;
|
|
343
314
|
this._indicator.classList.add('active');
|