@talex-touch/tuffex-wc 0.0.0-stage → 0.1.0
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 +373 -0
- package/README.md +47 -2
- package/dist/chunks/TxImageGeneration.js +28478 -0
- package/dist/chunks/base-a.js +1223 -0
- package/dist/chunks/base-b.js +1648 -0
- package/dist/chunks/core.esm.js +2327 -0
- package/dist/chunks/glyphs-ai-1.js +33 -0
- package/dist/chunks/glyphs-ai-2.js +55 -0
- package/dist/chunks/glyphs-brand-1.js +23 -0
- package/dist/chunks/glyphs-brand-2.js +33 -0
- package/dist/chunks/glyphs-brand-3.js +40 -0
- package/dist/chunks/glyphs-icon-1.js +144 -0
- package/dist/chunks/glyphs-icon-2.js +124 -0
- package/dist/chunks/pinyin.js +4 -0
- package/dist/chunks/pull-down.esm.js +336 -0
- package/dist/chunks/pull-up.esm.js +234 -0
- package/dist/chunks/scroll-bar.esm.js +768 -0
- package/dist/chunks/tier-a.js +426 -0
- package/dist/chunks/tier-b.js +897 -0
- package/dist/chunks/tier-c.js +72 -0
- package/dist/chunks/tuffex-data.js +9757 -0
- package/dist/chunks/tuffex-extras.js +11692 -0
- package/dist/chunks/tuffex-media.js +13475 -0
- package/dist/chunks/tuffex-shared.js +17671 -0
- package/dist/chunks/vue-export-helper.js +10 -0
- package/dist/chunks/wc-runtime.js +922 -0
- package/dist/elements/base-a.d.ts +145 -0
- package/dist/elements/base-b.d.ts +129 -0
- package/dist/elements/index.d.ts +22 -0
- package/dist/elements/tier-a.d.ts +55 -0
- package/dist/elements/tier-b.d.ts +58 -0
- package/dist/elements/tier-c.d.ts +7 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +320 -0
- package/dist/manifest.d.ts +19 -0
- package/dist/manifest.js +1377 -0
- package/dist/runtime/coerce.d.ts +38 -0
- package/dist/runtime/events.d.ts +17 -0
- package/dist/runtime/factory.d.ts +129 -0
- package/dist/runtime/styles.d.ts +20 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +1861 -0
- package/package.json +75 -3
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
var inBrowser = typeof window !== "undefined";
|
|
2
|
+
var ua = inBrowser && navigator.userAgent.toLowerCase();
|
|
3
|
+
ua && ua.indexOf("android") > 0;
|
|
4
|
+
(function() {
|
|
5
|
+
if (typeof ua === "string") {
|
|
6
|
+
var regex = /os (\d\d?_\d(_\d)?)/;
|
|
7
|
+
var matches = regex.exec(ua);
|
|
8
|
+
if (!matches)
|
|
9
|
+
return false;
|
|
10
|
+
var parts = matches[1].split("_").map(function(item) {
|
|
11
|
+
return parseInt(item, 10);
|
|
12
|
+
});
|
|
13
|
+
return !!(parts[0] === 13 && parts[1] >= 4);
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
})();
|
|
17
|
+
var supportsPassive = false;
|
|
18
|
+
if (inBrowser) {
|
|
19
|
+
var EventName = "test-passive";
|
|
20
|
+
try {
|
|
21
|
+
var opts = {};
|
|
22
|
+
Object.defineProperty(opts, "passive", {
|
|
23
|
+
get: function() {
|
|
24
|
+
supportsPassive = true;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
window.addEventListener(EventName, function() {
|
|
28
|
+
}, opts);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
var extend = function(target, source) {
|
|
33
|
+
for (var key in source) {
|
|
34
|
+
target[key] = source[key];
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
var elementStyle = inBrowser && document.createElement("div").style;
|
|
39
|
+
var vendor = (function() {
|
|
40
|
+
if (!inBrowser) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
var transformNames = [
|
|
44
|
+
{
|
|
45
|
+
key: "standard",
|
|
46
|
+
value: "transform"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: "webkit",
|
|
50
|
+
value: "webkitTransform"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: "Moz",
|
|
54
|
+
value: "MozTransform"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
key: "O",
|
|
58
|
+
value: "OTransform"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
key: "ms",
|
|
62
|
+
value: "msTransform"
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
for (var _i = 0, transformNames_1 = transformNames; _i < transformNames_1.length; _i++) {
|
|
66
|
+
var obj = transformNames_1[_i];
|
|
67
|
+
if (elementStyle[obj.value] !== void 0) {
|
|
68
|
+
return obj.key;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
})();
|
|
73
|
+
function prefixStyle(style) {
|
|
74
|
+
if (vendor === false) {
|
|
75
|
+
return style;
|
|
76
|
+
}
|
|
77
|
+
if (vendor === "standard") {
|
|
78
|
+
if (style === "transitionEnd") {
|
|
79
|
+
return "transitionend";
|
|
80
|
+
}
|
|
81
|
+
return style;
|
|
82
|
+
}
|
|
83
|
+
return vendor + style.charAt(0).toUpperCase() + style.substr(1);
|
|
84
|
+
}
|
|
85
|
+
vendor && vendor !== "standard" ? "-" + vendor.toLowerCase() + "-" : "";
|
|
86
|
+
prefixStyle("transform");
|
|
87
|
+
prefixStyle("transition");
|
|
88
|
+
inBrowser && prefixStyle("perspective") in elementStyle;
|
|
89
|
+
({
|
|
90
|
+
transitionTimingFunction: prefixStyle("transitionTimingFunction"),
|
|
91
|
+
transitionDuration: prefixStyle("transitionDuration"),
|
|
92
|
+
transitionDelay: prefixStyle("transitionDelay"),
|
|
93
|
+
transformOrigin: prefixStyle("transformOrigin"),
|
|
94
|
+
transitionEnd: prefixStyle("transitionEnd"),
|
|
95
|
+
transitionProperty: prefixStyle("transitionProperty")
|
|
96
|
+
});
|
|
97
|
+
var ease = {
|
|
98
|
+
// easeOutQuart
|
|
99
|
+
bounce: {
|
|
100
|
+
style: "cubic-bezier(0.165, 0.84, 0.44, 1)",
|
|
101
|
+
fn: function(t) {
|
|
102
|
+
return 1 - --t * t * t * t;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var sourcePrefix = "plugins.pullDownRefresh";
|
|
107
|
+
var propertiesMap = [
|
|
108
|
+
{
|
|
109
|
+
key: "finishPullDown",
|
|
110
|
+
name: "finishPullDown"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
key: "openPullDown",
|
|
114
|
+
name: "openPullDown"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
key: "closePullDown",
|
|
118
|
+
name: "closePullDown"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
key: "autoPullDownRefresh",
|
|
122
|
+
name: "autoPullDownRefresh"
|
|
123
|
+
}
|
|
124
|
+
];
|
|
125
|
+
var propertiesConfig = propertiesMap.map(function(item) {
|
|
126
|
+
return {
|
|
127
|
+
key: item.key,
|
|
128
|
+
sourceKey: sourcePrefix + "." + item.name
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
var PULLING_DOWN_EVENT = "pullingDown";
|
|
132
|
+
var ENTER_THRESHOLD_EVENT = "enterThreshold";
|
|
133
|
+
var LEAVE_THRESHOLD_EVENT = "leaveThreshold";
|
|
134
|
+
var PullDown = (
|
|
135
|
+
/** @class */
|
|
136
|
+
(function() {
|
|
137
|
+
function PullDown2(scroll) {
|
|
138
|
+
this.scroll = scroll;
|
|
139
|
+
this.pulling = 0;
|
|
140
|
+
this.thresholdBoundary = 0;
|
|
141
|
+
this.init();
|
|
142
|
+
}
|
|
143
|
+
PullDown2.prototype.setPulling = function(status) {
|
|
144
|
+
this.pulling = status;
|
|
145
|
+
};
|
|
146
|
+
PullDown2.prototype.setThresholdBoundary = function(boundary) {
|
|
147
|
+
this.thresholdBoundary = boundary;
|
|
148
|
+
};
|
|
149
|
+
PullDown2.prototype.init = function() {
|
|
150
|
+
this.handleBScroll();
|
|
151
|
+
this.handleOptions(this.scroll.options.pullDownRefresh);
|
|
152
|
+
this.handleHooks();
|
|
153
|
+
this.watch();
|
|
154
|
+
};
|
|
155
|
+
PullDown2.prototype.handleBScroll = function() {
|
|
156
|
+
this.scroll.registerType([
|
|
157
|
+
PULLING_DOWN_EVENT,
|
|
158
|
+
ENTER_THRESHOLD_EVENT,
|
|
159
|
+
LEAVE_THRESHOLD_EVENT
|
|
160
|
+
]);
|
|
161
|
+
this.scroll.proxy(propertiesConfig);
|
|
162
|
+
};
|
|
163
|
+
PullDown2.prototype.handleOptions = function(userOptions) {
|
|
164
|
+
if (userOptions === void 0) {
|
|
165
|
+
userOptions = {};
|
|
166
|
+
}
|
|
167
|
+
userOptions = userOptions === true ? {} : userOptions;
|
|
168
|
+
var defaultOptions = {
|
|
169
|
+
threshold: 90,
|
|
170
|
+
stop: 40
|
|
171
|
+
};
|
|
172
|
+
this.options = extend(defaultOptions, userOptions);
|
|
173
|
+
this.scroll.options.probeType = 3;
|
|
174
|
+
};
|
|
175
|
+
PullDown2.prototype.handleHooks = function() {
|
|
176
|
+
var _this = this;
|
|
177
|
+
this.hooksFn = [];
|
|
178
|
+
var scroller = this.scroll.scroller;
|
|
179
|
+
var scrollBehaviorY = scroller.scrollBehaviorY;
|
|
180
|
+
this.currentMinScrollY = this.cachedOriginanMinScrollY = scrollBehaviorY.minScrollPos;
|
|
181
|
+
this.registerHooks(this.scroll.hooks, this.scroll.hooks.eventTypes.contentChanged, function() {
|
|
182
|
+
_this.finishPullDown();
|
|
183
|
+
});
|
|
184
|
+
this.registerHooks(scrollBehaviorY.hooks, scrollBehaviorY.hooks.eventTypes.computeBoundary, function(boundary) {
|
|
185
|
+
if (boundary.maxScrollPos > 0) {
|
|
186
|
+
boundary.maxScrollPos = -1;
|
|
187
|
+
}
|
|
188
|
+
boundary.minScrollPos = _this.currentMinScrollY;
|
|
189
|
+
});
|
|
190
|
+
if (this.hasMouseWheelPlugin()) {
|
|
191
|
+
this.registerHooks(this.scroll, this.scroll.eventTypes.alterOptions, function(mouseWheelOptions) {
|
|
192
|
+
var SANE_DISCRETE_TIME = 300;
|
|
193
|
+
var SANE_EASE_TIME = 350;
|
|
194
|
+
mouseWheelOptions.discreteTime = SANE_DISCRETE_TIME;
|
|
195
|
+
mouseWheelOptions.easeTime = SANE_EASE_TIME;
|
|
196
|
+
});
|
|
197
|
+
this.registerHooks(this.scroll, this.scroll.eventTypes.mousewheelEnd, function() {
|
|
198
|
+
scroller.hooks.trigger(scroller.hooks.eventTypes.end);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
PullDown2.prototype.registerHooks = function(hooks, name, handler) {
|
|
203
|
+
hooks.on(name, handler, this);
|
|
204
|
+
this.hooksFn.push([hooks, name, handler]);
|
|
205
|
+
};
|
|
206
|
+
PullDown2.prototype.hasMouseWheelPlugin = function() {
|
|
207
|
+
return !!this.scroll.eventTypes.alterOptions;
|
|
208
|
+
};
|
|
209
|
+
PullDown2.prototype.watch = function() {
|
|
210
|
+
var scroller = this.scroll.scroller;
|
|
211
|
+
this.watching = true;
|
|
212
|
+
this.registerHooks(scroller.hooks, scroller.hooks.eventTypes.end, this.checkPullDown);
|
|
213
|
+
this.registerHooks(this.scroll, this.scroll.eventTypes.scrollStart, this.resetStateBeforeScrollStart);
|
|
214
|
+
this.registerHooks(this.scroll, this.scroll.eventTypes.scroll, this.checkLocationOfThresholdBoundary);
|
|
215
|
+
if (this.hasMouseWheelPlugin()) {
|
|
216
|
+
this.registerHooks(this.scroll, this.scroll.eventTypes.mousewheelStart, this.resetStateBeforeScrollStart);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
PullDown2.prototype.resetStateBeforeScrollStart = function() {
|
|
220
|
+
if (!this.isFetchingStatus()) {
|
|
221
|
+
this.setPulling(
|
|
222
|
+
1
|
|
223
|
+
/* MOVING */
|
|
224
|
+
);
|
|
225
|
+
this.setThresholdBoundary(
|
|
226
|
+
0
|
|
227
|
+
/* DEFAULT */
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
PullDown2.prototype.checkLocationOfThresholdBoundary = function() {
|
|
232
|
+
if (this.pulling === 1) {
|
|
233
|
+
var scroll_1 = this.scroll;
|
|
234
|
+
var enteredThresholdBoundary = this.thresholdBoundary !== 1 && this.locateInsideThresholdBoundary();
|
|
235
|
+
var leftThresholdBoundary = this.thresholdBoundary !== 2 && !this.locateInsideThresholdBoundary();
|
|
236
|
+
if (enteredThresholdBoundary) {
|
|
237
|
+
this.setThresholdBoundary(
|
|
238
|
+
1
|
|
239
|
+
/* INSIDE */
|
|
240
|
+
);
|
|
241
|
+
scroll_1.trigger(ENTER_THRESHOLD_EVENT);
|
|
242
|
+
}
|
|
243
|
+
if (leftThresholdBoundary) {
|
|
244
|
+
this.setThresholdBoundary(
|
|
245
|
+
2
|
|
246
|
+
/* OUTSIDE */
|
|
247
|
+
);
|
|
248
|
+
scroll_1.trigger(LEAVE_THRESHOLD_EVENT);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
PullDown2.prototype.locateInsideThresholdBoundary = function() {
|
|
253
|
+
return this.scroll.y <= this.options.threshold;
|
|
254
|
+
};
|
|
255
|
+
PullDown2.prototype.unwatch = function() {
|
|
256
|
+
var scroll = this.scroll;
|
|
257
|
+
var scroller = scroll.scroller;
|
|
258
|
+
this.watching = false;
|
|
259
|
+
scroller.hooks.off(scroller.hooks.eventTypes.end, this.checkPullDown);
|
|
260
|
+
scroll.off(scroll.eventTypes.scrollStart, this.resetStateBeforeScrollStart);
|
|
261
|
+
scroll.off(scroll.eventTypes.scroll, this.checkLocationOfThresholdBoundary);
|
|
262
|
+
if (this.hasMouseWheelPlugin()) {
|
|
263
|
+
scroll.off(scroll.eventTypes.mousewheelStart, this.resetStateBeforeScrollStart);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
PullDown2.prototype.checkPullDown = function() {
|
|
267
|
+
var _a = this.options, threshold = _a.threshold, stop = _a.stop;
|
|
268
|
+
if (this.scroll.y < threshold) {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
if (this.pulling === 1) {
|
|
272
|
+
this.modifyBehaviorYBoundary(stop);
|
|
273
|
+
this.setPulling(
|
|
274
|
+
2
|
|
275
|
+
/* FETCHING */
|
|
276
|
+
);
|
|
277
|
+
this.scroll.trigger(PULLING_DOWN_EVENT);
|
|
278
|
+
}
|
|
279
|
+
this.scroll.scrollTo(this.scroll.x, stop, this.scroll.options.bounceTime, ease.bounce);
|
|
280
|
+
return this.isFetchingStatus();
|
|
281
|
+
};
|
|
282
|
+
PullDown2.prototype.isFetchingStatus = function() {
|
|
283
|
+
return this.pulling === 2;
|
|
284
|
+
};
|
|
285
|
+
PullDown2.prototype.modifyBehaviorYBoundary = function(stopDistance) {
|
|
286
|
+
var scrollBehaviorY = this.scroll.scroller.scrollBehaviorY;
|
|
287
|
+
this.cachedOriginanMinScrollY = scrollBehaviorY.minScrollPos;
|
|
288
|
+
this.currentMinScrollY = stopDistance;
|
|
289
|
+
scrollBehaviorY.computeBoundary();
|
|
290
|
+
};
|
|
291
|
+
PullDown2.prototype.finishPullDown = function() {
|
|
292
|
+
if (this.isFetchingStatus()) {
|
|
293
|
+
var scrollBehaviorY = this.scroll.scroller.scrollBehaviorY;
|
|
294
|
+
this.currentMinScrollY = this.cachedOriginanMinScrollY;
|
|
295
|
+
scrollBehaviorY.computeBoundary();
|
|
296
|
+
this.setPulling(
|
|
297
|
+
0
|
|
298
|
+
/* DEFAULT */
|
|
299
|
+
);
|
|
300
|
+
this.scroll.resetPosition(this.scroll.options.bounceTime, ease.bounce);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
PullDown2.prototype.openPullDown = function(config) {
|
|
304
|
+
if (config === void 0) {
|
|
305
|
+
config = {};
|
|
306
|
+
}
|
|
307
|
+
this.handleOptions(config);
|
|
308
|
+
if (!this.watching) {
|
|
309
|
+
this.watch();
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
PullDown2.prototype.closePullDown = function() {
|
|
313
|
+
this.unwatch();
|
|
314
|
+
};
|
|
315
|
+
PullDown2.prototype.autoPullDownRefresh = function() {
|
|
316
|
+
var _a = this.options, threshold = _a.threshold, stop = _a.stop;
|
|
317
|
+
if (this.isFetchingStatus() || !this.watching) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
this.modifyBehaviorYBoundary(stop);
|
|
321
|
+
this.scroll.trigger(this.scroll.eventTypes.scrollStart);
|
|
322
|
+
this.scroll.scrollTo(this.scroll.x, threshold);
|
|
323
|
+
this.setPulling(
|
|
324
|
+
2
|
|
325
|
+
/* FETCHING */
|
|
326
|
+
);
|
|
327
|
+
this.scroll.trigger(PULLING_DOWN_EVENT);
|
|
328
|
+
this.scroll.scrollTo(this.scroll.x, stop, this.scroll.options.bounceTime, ease.bounce);
|
|
329
|
+
};
|
|
330
|
+
PullDown2.pluginName = "pullDownRefresh";
|
|
331
|
+
return PullDown2;
|
|
332
|
+
})()
|
|
333
|
+
);
|
|
334
|
+
export {
|
|
335
|
+
PullDown as default
|
|
336
|
+
};
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
var inBrowser = typeof window !== "undefined";
|
|
2
|
+
var ua = inBrowser && navigator.userAgent.toLowerCase();
|
|
3
|
+
ua && ua.indexOf("android") > 0;
|
|
4
|
+
(function() {
|
|
5
|
+
if (typeof ua === "string") {
|
|
6
|
+
var regex = /os (\d\d?_\d(_\d)?)/;
|
|
7
|
+
var matches = regex.exec(ua);
|
|
8
|
+
if (!matches)
|
|
9
|
+
return false;
|
|
10
|
+
var parts = matches[1].split("_").map(function(item) {
|
|
11
|
+
return parseInt(item, 10);
|
|
12
|
+
});
|
|
13
|
+
return !!(parts[0] === 13 && parts[1] >= 4);
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
})();
|
|
17
|
+
var supportsPassive = false;
|
|
18
|
+
if (inBrowser) {
|
|
19
|
+
var EventName = "test-passive";
|
|
20
|
+
try {
|
|
21
|
+
var opts = {};
|
|
22
|
+
Object.defineProperty(opts, "passive", {
|
|
23
|
+
get: function() {
|
|
24
|
+
supportsPassive = true;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
window.addEventListener(EventName, function() {
|
|
28
|
+
}, opts);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
var extend = function(target, source) {
|
|
33
|
+
for (var key in source) {
|
|
34
|
+
target[key] = source[key];
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
var elementStyle = inBrowser && document.createElement("div").style;
|
|
39
|
+
var vendor = (function() {
|
|
40
|
+
if (!inBrowser) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
var transformNames = [
|
|
44
|
+
{
|
|
45
|
+
key: "standard",
|
|
46
|
+
value: "transform"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: "webkit",
|
|
50
|
+
value: "webkitTransform"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: "Moz",
|
|
54
|
+
value: "MozTransform"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
key: "O",
|
|
58
|
+
value: "OTransform"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
key: "ms",
|
|
62
|
+
value: "msTransform"
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
for (var _i = 0, transformNames_1 = transformNames; _i < transformNames_1.length; _i++) {
|
|
66
|
+
var obj = transformNames_1[_i];
|
|
67
|
+
if (elementStyle[obj.value] !== void 0) {
|
|
68
|
+
return obj.key;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
})();
|
|
73
|
+
function prefixStyle(style) {
|
|
74
|
+
if (vendor === false) {
|
|
75
|
+
return style;
|
|
76
|
+
}
|
|
77
|
+
if (vendor === "standard") {
|
|
78
|
+
if (style === "transitionEnd") {
|
|
79
|
+
return "transitionend";
|
|
80
|
+
}
|
|
81
|
+
return style;
|
|
82
|
+
}
|
|
83
|
+
return vendor + style.charAt(0).toUpperCase() + style.substr(1);
|
|
84
|
+
}
|
|
85
|
+
vendor && vendor !== "standard" ? "-" + vendor.toLowerCase() + "-" : "";
|
|
86
|
+
prefixStyle("transform");
|
|
87
|
+
prefixStyle("transition");
|
|
88
|
+
inBrowser && prefixStyle("perspective") in elementStyle;
|
|
89
|
+
({
|
|
90
|
+
transitionTimingFunction: prefixStyle("transitionTimingFunction"),
|
|
91
|
+
transitionDuration: prefixStyle("transitionDuration"),
|
|
92
|
+
transitionDelay: prefixStyle("transitionDelay"),
|
|
93
|
+
transformOrigin: prefixStyle("transformOrigin"),
|
|
94
|
+
transitionEnd: prefixStyle("transitionEnd"),
|
|
95
|
+
transitionProperty: prefixStyle("transitionProperty")
|
|
96
|
+
});
|
|
97
|
+
var sourcePrefix = "plugins.pullUpLoad";
|
|
98
|
+
var propertiesMap = [
|
|
99
|
+
{
|
|
100
|
+
key: "finishPullUp",
|
|
101
|
+
name: "finishPullUp"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
key: "openPullUp",
|
|
105
|
+
name: "openPullUp"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
key: "closePullUp",
|
|
109
|
+
name: "closePullUp"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
key: "autoPullUpLoad",
|
|
113
|
+
name: "autoPullUpLoad"
|
|
114
|
+
}
|
|
115
|
+
];
|
|
116
|
+
var propertiesConfig = propertiesMap.map(function(item) {
|
|
117
|
+
return {
|
|
118
|
+
key: item.key,
|
|
119
|
+
sourceKey: sourcePrefix + "." + item.name
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
var PULL_UP_HOOKS_NAME = "pullingUp";
|
|
123
|
+
var PullUp = (
|
|
124
|
+
/** @class */
|
|
125
|
+
(function() {
|
|
126
|
+
function PullUp2(scroll) {
|
|
127
|
+
this.scroll = scroll;
|
|
128
|
+
this.pulling = false;
|
|
129
|
+
this.watching = false;
|
|
130
|
+
this.init();
|
|
131
|
+
}
|
|
132
|
+
PullUp2.prototype.init = function() {
|
|
133
|
+
this.handleBScroll();
|
|
134
|
+
this.handleOptions(this.scroll.options.pullUpLoad);
|
|
135
|
+
this.handleHooks();
|
|
136
|
+
this.watch();
|
|
137
|
+
};
|
|
138
|
+
PullUp2.prototype.handleBScroll = function() {
|
|
139
|
+
this.scroll.registerType([PULL_UP_HOOKS_NAME]);
|
|
140
|
+
this.scroll.proxy(propertiesConfig);
|
|
141
|
+
};
|
|
142
|
+
PullUp2.prototype.handleOptions = function(userOptions) {
|
|
143
|
+
if (userOptions === void 0) {
|
|
144
|
+
userOptions = {};
|
|
145
|
+
}
|
|
146
|
+
userOptions = userOptions === true ? {} : userOptions;
|
|
147
|
+
var defaultOptions = {
|
|
148
|
+
threshold: 0
|
|
149
|
+
};
|
|
150
|
+
this.options = extend(defaultOptions, userOptions);
|
|
151
|
+
this.scroll.options.probeType = 3;
|
|
152
|
+
};
|
|
153
|
+
PullUp2.prototype.handleHooks = function() {
|
|
154
|
+
var _this = this;
|
|
155
|
+
this.hooksFn = [];
|
|
156
|
+
var scrollBehaviorY = this.scroll.scroller.scrollBehaviorY;
|
|
157
|
+
this.registerHooks(this.scroll.hooks, this.scroll.hooks.eventTypes.contentChanged, function() {
|
|
158
|
+
_this.finishPullUp();
|
|
159
|
+
});
|
|
160
|
+
this.registerHooks(scrollBehaviorY.hooks, scrollBehaviorY.hooks.eventTypes.computeBoundary, function(boundary) {
|
|
161
|
+
if (boundary.maxScrollPos > 0) {
|
|
162
|
+
boundary.maxScrollPos = -1;
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
PullUp2.prototype.registerHooks = function(hooks, name, handler) {
|
|
167
|
+
hooks.on(name, handler, this);
|
|
168
|
+
this.hooksFn.push([hooks, name, handler]);
|
|
169
|
+
};
|
|
170
|
+
PullUp2.prototype.watch = function() {
|
|
171
|
+
if (this.watching) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
this.watching = true;
|
|
175
|
+
this.registerHooks(this.scroll, this.scroll.eventTypes.scroll, this.checkPullUp);
|
|
176
|
+
};
|
|
177
|
+
PullUp2.prototype.unwatch = function() {
|
|
178
|
+
this.watching = false;
|
|
179
|
+
this.scroll.off(this.scroll.eventTypes.scroll, this.checkPullUp);
|
|
180
|
+
};
|
|
181
|
+
PullUp2.prototype.checkPullUp = function(pos) {
|
|
182
|
+
var _this = this;
|
|
183
|
+
var threshold = this.options.threshold;
|
|
184
|
+
if (this.scroll.movingDirectionY === 1 && pos.y <= this.scroll.maxScrollY + threshold) {
|
|
185
|
+
this.pulling = true;
|
|
186
|
+
this.scroll.once(this.scroll.eventTypes.scrollEnd, function() {
|
|
187
|
+
_this.pulling = false;
|
|
188
|
+
});
|
|
189
|
+
this.unwatch();
|
|
190
|
+
this.scroll.trigger(PULL_UP_HOOKS_NAME);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
PullUp2.prototype.finishPullUp = function() {
|
|
194
|
+
var _this = this;
|
|
195
|
+
this.scroll.scroller.scrollBehaviorY.setMovingDirection(
|
|
196
|
+
0
|
|
197
|
+
/* Default */
|
|
198
|
+
);
|
|
199
|
+
if (this.pulling) {
|
|
200
|
+
this.scroll.once(this.scroll.eventTypes.scrollEnd, function() {
|
|
201
|
+
_this.watch();
|
|
202
|
+
});
|
|
203
|
+
} else {
|
|
204
|
+
this.watch();
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
PullUp2.prototype.openPullUp = function(config) {
|
|
208
|
+
if (config === void 0) {
|
|
209
|
+
config = {};
|
|
210
|
+
}
|
|
211
|
+
this.handleOptions(config);
|
|
212
|
+
this.watch();
|
|
213
|
+
};
|
|
214
|
+
PullUp2.prototype.closePullUp = function() {
|
|
215
|
+
this.unwatch();
|
|
216
|
+
};
|
|
217
|
+
PullUp2.prototype.autoPullUpLoad = function() {
|
|
218
|
+
var threshold = this.options.threshold;
|
|
219
|
+
var scrollBehaviorY = this.scroll.scroller.scrollBehaviorY;
|
|
220
|
+
if (this.pulling || !this.watching) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
var NEGATIVE_VALUE = -1;
|
|
224
|
+
var outOfBoundaryPos = scrollBehaviorY.maxScrollPos + threshold + NEGATIVE_VALUE;
|
|
225
|
+
this.scroll.scroller.scrollBehaviorY.setMovingDirection(NEGATIVE_VALUE);
|
|
226
|
+
this.scroll.scrollTo(this.scroll.x, outOfBoundaryPos, this.scroll.options.bounceTime);
|
|
227
|
+
};
|
|
228
|
+
PullUp2.pluginName = "pullUpLoad";
|
|
229
|
+
return PullUp2;
|
|
230
|
+
})()
|
|
231
|
+
);
|
|
232
|
+
export {
|
|
233
|
+
PullUp as default
|
|
234
|
+
};
|