@aarongustafson/pull-to-refresh 0.0.3 → 0.0.5
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 +4 -0
- package/custom-elements.json +218 -4
- package/package.json +2 -2
- package/pull-to-refresh.js +1 -1
package/README.md
CHANGED
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
A lightweight, customizable Web Component that adds pull-to-refresh functionality to your web applications. Perfect for mobile-first experiences and progressive web apps.
|
|
7
7
|
|
|
8
|
+
## Demo
|
|
9
|
+
|
|
10
|
+
[Live Demo](https://aarongustafson.github.io/pull-to-refresh/demo/) ([Source](./demo/index.html))
|
|
11
|
+
|
|
8
12
|
## Features
|
|
9
13
|
|
|
10
14
|
- **Touch-optimized**: Smooth pull gesture with momentum and feedback
|
package/custom-elements.json
CHANGED
|
@@ -8,11 +8,225 @@
|
|
|
8
8
|
"declarations": [
|
|
9
9
|
{
|
|
10
10
|
"kind": "class",
|
|
11
|
-
"description": "
|
|
11
|
+
"description": "Web component that enables pull-to-refresh functionality.",
|
|
12
12
|
"name": "PullToRefreshElement",
|
|
13
|
-
"members": [
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
"members": [
|
|
14
|
+
{
|
|
15
|
+
"kind": "field",
|
|
16
|
+
"name": "threshold",
|
|
17
|
+
"type": {
|
|
18
|
+
"text": "number"
|
|
19
|
+
},
|
|
20
|
+
"default": "80",
|
|
21
|
+
"description": "Distance in pixels to trigger refresh",
|
|
22
|
+
"attribute": "threshold"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"kind": "field",
|
|
26
|
+
"name": "indicatorText",
|
|
27
|
+
"type": {
|
|
28
|
+
"text": "string"
|
|
29
|
+
},
|
|
30
|
+
"description": "Text shown when pulling down",
|
|
31
|
+
"attribute": "indicator-text"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"kind": "field",
|
|
35
|
+
"name": "releaseText",
|
|
36
|
+
"type": {
|
|
37
|
+
"text": "string"
|
|
38
|
+
},
|
|
39
|
+
"description": "Text shown when ready to release",
|
|
40
|
+
"attribute": "release-text"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"kind": "field",
|
|
44
|
+
"name": "refreshingText",
|
|
45
|
+
"type": {
|
|
46
|
+
"text": "string"
|
|
47
|
+
},
|
|
48
|
+
"description": "Text shown while refreshing",
|
|
49
|
+
"attribute": "refreshing-text"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"kind": "field",
|
|
53
|
+
"name": "disabled",
|
|
54
|
+
"type": {
|
|
55
|
+
"text": "boolean"
|
|
56
|
+
},
|
|
57
|
+
"default": "false",
|
|
58
|
+
"description": "Disables the pull-to-refresh functionality",
|
|
59
|
+
"attribute": "disabled"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"kind": "field",
|
|
63
|
+
"name": "disableSelection",
|
|
64
|
+
"type": {
|
|
65
|
+
"text": "boolean"
|
|
66
|
+
},
|
|
67
|
+
"default": "false",
|
|
68
|
+
"description": "Disables text selection during pull gesture",
|
|
69
|
+
"attribute": "disable-selection"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"kind": "method",
|
|
73
|
+
"name": "registerTranslations",
|
|
74
|
+
"static": true,
|
|
75
|
+
"parameters": [
|
|
76
|
+
{
|
|
77
|
+
"name": "translations",
|
|
78
|
+
"type": {
|
|
79
|
+
"text": "object"
|
|
80
|
+
},
|
|
81
|
+
"description": "Object containing translation strings for different languages"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"description": "Register custom translations for the component"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"kind": "method",
|
|
88
|
+
"name": "triggerRefresh",
|
|
89
|
+
"description": "Manually trigger a refresh action"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"kind": "method",
|
|
93
|
+
"name": "completeRefresh",
|
|
94
|
+
"description": "Complete the refresh action and reset the indicator"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"events": [
|
|
98
|
+
{
|
|
99
|
+
"name": "ptr:pull-start",
|
|
100
|
+
"type": {
|
|
101
|
+
"text": "CustomEvent"
|
|
102
|
+
},
|
|
103
|
+
"description": "Fired when pull gesture starts"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "ptr:pull-move",
|
|
107
|
+
"type": {
|
|
108
|
+
"text": "CustomEvent"
|
|
109
|
+
},
|
|
110
|
+
"description": "Fired during pull gesture, contains { distance } in detail"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "ptr:pull-end",
|
|
114
|
+
"type": {
|
|
115
|
+
"text": "CustomEvent"
|
|
116
|
+
},
|
|
117
|
+
"description": "Fired when pull gesture ends"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "ptr:refresh",
|
|
121
|
+
"type": {
|
|
122
|
+
"text": "CustomEvent"
|
|
123
|
+
},
|
|
124
|
+
"description": "Fired when refresh is triggered"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "ptr:refresh-complete",
|
|
128
|
+
"type": {
|
|
129
|
+
"text": "CustomEvent"
|
|
130
|
+
},
|
|
131
|
+
"description": "Fired when refresh completes"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"attributes": [
|
|
135
|
+
{
|
|
136
|
+
"name": "threshold",
|
|
137
|
+
"type": {
|
|
138
|
+
"text": "number"
|
|
139
|
+
},
|
|
140
|
+
"default": "80",
|
|
141
|
+
"description": "Distance in pixels to trigger refresh",
|
|
142
|
+
"fieldName": "threshold"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "indicator-text",
|
|
146
|
+
"type": {
|
|
147
|
+
"text": "string"
|
|
148
|
+
},
|
|
149
|
+
"description": "Text shown when pulling down (default: localized \"↓ Pull to refresh\")",
|
|
150
|
+
"fieldName": "indicatorText"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "release-text",
|
|
154
|
+
"type": {
|
|
155
|
+
"text": "string"
|
|
156
|
+
},
|
|
157
|
+
"description": "Text shown when ready to release (default: localized \"↻ Release to refresh\")",
|
|
158
|
+
"fieldName": "releaseText"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "refreshing-text",
|
|
162
|
+
"type": {
|
|
163
|
+
"text": "string"
|
|
164
|
+
},
|
|
165
|
+
"description": "Text shown while refreshing (default: localized \"⏳ Refreshing...\")",
|
|
166
|
+
"fieldName": "refreshingText"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "lang",
|
|
170
|
+
"type": {
|
|
171
|
+
"text": "string"
|
|
172
|
+
},
|
|
173
|
+
"description": "Language code for localization (falls back to closest [lang], document lang, or 'en')"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"name": "disabled",
|
|
177
|
+
"type": {
|
|
178
|
+
"text": "boolean"
|
|
179
|
+
},
|
|
180
|
+
"description": "Disables the pull-to-refresh functionality",
|
|
181
|
+
"fieldName": "disabled"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"name": "disable-selection",
|
|
185
|
+
"type": {
|
|
186
|
+
"text": "boolean"
|
|
187
|
+
},
|
|
188
|
+
"description": "Disables text selection during pull gesture",
|
|
189
|
+
"fieldName": "disableSelection"
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
"slots": [
|
|
193
|
+
{
|
|
194
|
+
"name": "",
|
|
195
|
+
"description": "Default slot for content"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"name": "indicator",
|
|
199
|
+
"description": "Optional custom indicator element"
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
"cssParts": [],
|
|
203
|
+
"cssProperties": [
|
|
204
|
+
{
|
|
205
|
+
"name": "--ptr-indicator-height",
|
|
206
|
+
"description": "Height of the indicator area",
|
|
207
|
+
"default": "3.125rem"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"name": "--ptr-indicator-bg",
|
|
211
|
+
"description": "Background color of the indicator",
|
|
212
|
+
"default": "ButtonFace"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"name": "--ptr-indicator-color",
|
|
216
|
+
"description": "Text color of the indicator",
|
|
217
|
+
"default": "ButtonText"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"name": "--ptr-indicator-font-size",
|
|
221
|
+
"description": "Font size of the indicator text",
|
|
222
|
+
"default": "0.875rem"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"name": "--ptr-transition-duration",
|
|
226
|
+
"description": "Duration of indicator transitions",
|
|
227
|
+
"default": "0.2s"
|
|
228
|
+
}
|
|
229
|
+
],
|
|
16
230
|
"superclass": {
|
|
17
231
|
"name": "HTMLElement"
|
|
18
232
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aarongustafson/pull-to-refresh",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "Web component that enables pull-to-refresh functionality.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"html",
|
|
7
7
|
"custom element",
|
package/pull-to-refresh.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import defaultTranslations from './translations.json' with { type: 'json' };
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* PullToRefreshElement -
|
|
4
|
+
* PullToRefreshElement - Web component that enables pull-to-refresh functionality
|
|
5
5
|
*
|
|
6
6
|
* @element pull-to-refresh
|
|
7
7
|
*
|