targetj 1.0.246 → 1.0.247
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/build/App.js +2 -3
- package/build/EventListener.js +61 -18
- package/build/LoadingManager.js +34 -5
- package/build/PageManager.js +7 -4
- package/build/TModel.js +2 -0
- package/build/TModelManager.js +4 -3
- package/build/TargetUtil.js +0 -1
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/App.js
CHANGED
|
@@ -145,8 +145,6 @@ var AppFn = function AppFn() {
|
|
|
145
145
|
case 0:
|
|
146
146
|
my.manager.getVisibles().forEach(function (tmodel) {
|
|
147
147
|
var _tmodel$allStyleTarge;
|
|
148
|
-
tmodel.tfMap = {};
|
|
149
|
-
tmodel.styleMap = {};
|
|
150
148
|
if ((_tmodel$allStyleTarge = tmodel.allStyleTargetMap) !== null && _tmodel$allStyleTarge !== void 0 && _tmodel$allStyleTarge.size) {
|
|
151
149
|
var _iterator = _createForOfIteratorHelper(tmodel.allStyleTargetMap),
|
|
152
150
|
_step;
|
|
@@ -246,10 +244,11 @@ App.unmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime()
|
|
|
246
244
|
_context4.next = 14;
|
|
247
245
|
return tApp.reset();
|
|
248
246
|
case 14:
|
|
247
|
+
tApp.loader.clearAll();
|
|
249
248
|
App.oids = {};
|
|
250
249
|
App.tmodelIdMap = {};
|
|
251
250
|
tApp = undefined;
|
|
252
|
-
case
|
|
251
|
+
case 18:
|
|
253
252
|
case "end":
|
|
254
253
|
return _context4.stop();
|
|
255
254
|
}
|
package/build/EventListener.js
CHANGED
|
@@ -60,6 +60,7 @@ var EventListener = /*#__PURE__*/function () {
|
|
|
60
60
|
this.currentKey = '';
|
|
61
61
|
this.currentHandlers = {
|
|
62
62
|
touch: null,
|
|
63
|
+
click: null,
|
|
63
64
|
scrollLeft: null,
|
|
64
65
|
scrollTop: null,
|
|
65
66
|
swipe: null,
|
|
@@ -311,20 +312,48 @@ var EventListener = /*#__PURE__*/function () {
|
|
|
311
312
|
if (this.canFindHandlers && !lastEvent.synthetic) {
|
|
312
313
|
this.findEventHandlers(lastEvent);
|
|
313
314
|
}
|
|
314
|
-
if (lastEvent.eventType === 'end'
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
this.currentHandlers.end = this.currentHandlers.start;
|
|
318
|
-
(_this$currentHandlers = this.currentHandlers.end) === null || _this$currentHandlers === void 0 || _this$currentHandlers.markLayoutDirty('end-event');
|
|
319
|
-
this.currentHandlers.start = undefined;
|
|
320
|
-
}
|
|
321
|
-
this.canFindHandlers = true;
|
|
315
|
+
if (lastEvent.eventType === 'end') {
|
|
316
|
+
this.currentHandlers.end = this.currentHandlers.start;
|
|
317
|
+
this.currentHandlers.start = undefined;
|
|
322
318
|
}
|
|
323
319
|
this.currentEventName = lastEvent.eventName;
|
|
324
320
|
this.currentEventType = lastEvent.eventType;
|
|
325
321
|
this.currentEventTModel = lastEvent.tmodel;
|
|
326
322
|
this.currentOriginalEvent = lastEvent.originalEvent;
|
|
327
323
|
this.currentTouch.key = '';
|
|
324
|
+
this.markCapturedEventDirty(lastEvent);
|
|
325
|
+
if (lastEvent.eventType === 'end' || lastEvent.eventType === 'click') {
|
|
326
|
+
this.canFindHandlers = true;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}, {
|
|
330
|
+
key: "markCapturedEventDirty",
|
|
331
|
+
value: function markCapturedEventDirty(lastEvent) {
|
|
332
|
+
var mark = function mark(tmodel, reason) {
|
|
333
|
+
if (!tmodel) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
tmodel.markEventDirty();
|
|
337
|
+
tmodel.markLayoutDirty(reason);
|
|
338
|
+
};
|
|
339
|
+
mark(lastEvent.tmodel, "".concat(lastEvent.eventType, "-event"));
|
|
340
|
+
switch (lastEvent.eventType) {
|
|
341
|
+
case "click":
|
|
342
|
+
mark(this.currentHandlers.click, "click-event");
|
|
343
|
+
break;
|
|
344
|
+
case "start":
|
|
345
|
+
mark(this.currentHandlers.start, "start-event");
|
|
346
|
+
break;
|
|
347
|
+
case "end":
|
|
348
|
+
mark(this.currentHandlers.end, "end-event");
|
|
349
|
+
break;
|
|
350
|
+
case "move":
|
|
351
|
+
mark(this.currentHandlers.swipe, "swipe-event");
|
|
352
|
+
mark(this.currentHandlers.scrollLeft, "scrollleft-event");
|
|
353
|
+
mark(this.currentHandlers.scrollTop, "scrolltop-event");
|
|
354
|
+
mark(this.currentHandlers.pinch, "pinch-event");
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
328
357
|
}
|
|
329
358
|
}, {
|
|
330
359
|
key: "handleDocEvent",
|
|
@@ -342,12 +371,12 @@ var EventListener = /*#__PURE__*/function () {
|
|
|
342
371
|
var _this$lastEvent,
|
|
343
372
|
_tmodel,
|
|
344
373
|
_tmodel2,
|
|
374
|
+
_this$currentHandlers,
|
|
345
375
|
_this$currentHandlers2,
|
|
346
376
|
_this$currentHandlers3,
|
|
347
377
|
_this$currentHandlers4,
|
|
348
|
-
_this$
|
|
378
|
+
_this$currentHandlers6,
|
|
349
379
|
_this$currentHandlers7,
|
|
350
|
-
_this$currentHandlers8,
|
|
351
380
|
_this7 = this,
|
|
352
381
|
_tmodel3;
|
|
353
382
|
if (!event) {
|
|
@@ -435,8 +464,8 @@ var EventListener = /*#__PURE__*/function () {
|
|
|
435
464
|
this.currentHandlers.start = tmodel;
|
|
436
465
|
this.findEventHandlers(newEvent);
|
|
437
466
|
this.canFindHandlers = false;
|
|
438
|
-
this.swipeStartX = this.start0.x - ((_this$
|
|
439
|
-
this.swipeStartY = this.start0.y - ((_this$
|
|
467
|
+
this.swipeStartX = this.start0.x - ((_this$currentHandlers = (_this$currentHandlers2 = this.currentHandlers.swipe) === null || _this$currentHandlers2 === void 0 ? void 0 : _this$currentHandlers2.getX()) !== null && _this$currentHandlers !== void 0 ? _this$currentHandlers : 0);
|
|
468
|
+
this.swipeStartY = this.start0.y - ((_this$currentHandlers3 = (_this$currentHandlers4 = this.currentHandlers.swipe) === null || _this$currentHandlers4 === void 0 ? void 0 : _this$currentHandlers4.getY()) !== null && _this$currentHandlers3 !== void 0 ? _this$currentHandlers3 : 0);
|
|
440
469
|
event.stopPropagation();
|
|
441
470
|
this.detachDocumentEvents('documentDragEvents');
|
|
442
471
|
this.attachDocumentEvents('documentDragEvents');
|
|
@@ -451,12 +480,12 @@ var EventListener = /*#__PURE__*/function () {
|
|
|
451
480
|
event.preventDefault();
|
|
452
481
|
}
|
|
453
482
|
if (this.touchCount > 0) {
|
|
454
|
-
var _this$
|
|
483
|
+
var _this$currentHandlers5;
|
|
455
484
|
this.scrollEndTimeStamp.x = 0;
|
|
456
485
|
this.scrollEndTimeStamp.y = 0;
|
|
457
486
|
this.move(event);
|
|
458
487
|
event.stopPropagation();
|
|
459
|
-
(_this$
|
|
488
|
+
(_this$currentHandlers5 = this.currentHandlers.swipe) === null || _this$currentHandlers5 === void 0 || _this$currentHandlers5.markLayoutDirty('swipe-event');
|
|
460
489
|
} else if (this.isCurrentSource('wheel')) {
|
|
461
490
|
this.clearTouch();
|
|
462
491
|
}
|
|
@@ -482,8 +511,6 @@ var EventListener = /*#__PURE__*/function () {
|
|
|
482
511
|
var clickHandler = SearchUtil.findFirstClickHandler(tmodel);
|
|
483
512
|
var canAcceptClick = !this.start0 || clickHandler === this.currentHandlers.click && (clickHandler !== this.currentHandlers.swipe || this.getSwipeDistance() < 5);
|
|
484
513
|
if (clickHandler && canAcceptClick) {
|
|
485
|
-
clickHandler.markEventDirty();
|
|
486
|
-
clickHandler.markLayoutDirty('event');
|
|
487
514
|
this.eventQueue.length = 0;
|
|
488
515
|
this.eventQueue.push({
|
|
489
516
|
eventName: eventName,
|
|
@@ -533,11 +560,11 @@ var EventListener = /*#__PURE__*/function () {
|
|
|
533
560
|
break;
|
|
534
561
|
case 'key':
|
|
535
562
|
this.currentTouch.key = event.which || event.keyCode;
|
|
536
|
-
(_this$
|
|
563
|
+
(_this$currentHandlers6 = this.currentHandlers.focus) === null || _this$currentHandlers6 === void 0 || _this$currentHandlers6.markLayoutDirty('key-event');
|
|
537
564
|
break;
|
|
538
565
|
case 'keydown':
|
|
539
566
|
this.currentTouch.key = event.which || event.keyCode;
|
|
540
|
-
(_this$
|
|
567
|
+
(_this$currentHandlers7 = this.currentHandlers.focus) === null || _this$currentHandlers7 === void 0 || _this$currentHandlers7.markLayoutDirty('keydown-event');
|
|
541
568
|
break;
|
|
542
569
|
case 'resize':
|
|
543
570
|
this.windowEpoch++;
|
|
@@ -699,6 +726,22 @@ var EventListener = /*#__PURE__*/function () {
|
|
|
699
726
|
this.windowScrollEndTimer = 0;
|
|
700
727
|
this.scrollEndTimeStamp.x = 0;
|
|
701
728
|
this.scrollEndTimeStamp.y = 0;
|
|
729
|
+
this.currentHandlers = {
|
|
730
|
+
touch: null,
|
|
731
|
+
click: null,
|
|
732
|
+
scrollLeft: null,
|
|
733
|
+
scrollTop: null,
|
|
734
|
+
swipe: null,
|
|
735
|
+
pinch: null,
|
|
736
|
+
focus: null,
|
|
737
|
+
justFocused: null,
|
|
738
|
+
blur: null,
|
|
739
|
+
leave: null,
|
|
740
|
+
enter: null,
|
|
741
|
+
start: null,
|
|
742
|
+
end: null,
|
|
743
|
+
hover: null
|
|
744
|
+
};
|
|
702
745
|
}
|
|
703
746
|
}, {
|
|
704
747
|
key: "deltaX",
|
package/build/LoadingManager.js
CHANGED
|
@@ -31,20 +31,48 @@ var LoadingManager = /*#__PURE__*/function () {
|
|
|
31
31
|
this.tmodelKeyMap = {};
|
|
32
32
|
this.fetchingAPIMap = {};
|
|
33
33
|
this.fetchingImageMap = {};
|
|
34
|
+
this.targetPageKeyMap = new WeakMap();
|
|
34
35
|
this.fetchSeq = 0;
|
|
35
36
|
}
|
|
36
37
|
return _createClass(LoadingManager, [{
|
|
37
38
|
key: "clear",
|
|
38
39
|
value: function clear() {
|
|
40
|
+
this.fetchingAPIMap = {};
|
|
41
|
+
this.fetchingImageMap = {};
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "clearAll",
|
|
45
|
+
value: function clearAll() {
|
|
46
|
+
this.cacheMap = {};
|
|
39
47
|
this.tmodelKeyMap = {};
|
|
40
48
|
this.fetchingAPIMap = {};
|
|
41
49
|
this.fetchingImageMap = {};
|
|
50
|
+
this.targetPageKeyMap = new WeakMap();
|
|
42
51
|
this.fetchSeq = 0;
|
|
43
52
|
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "setTargetPageKey",
|
|
55
|
+
value: function setTargetPageKey(tmodel, targetName, pageKey) {
|
|
56
|
+
var map = this.targetPageKeyMap.get(tmodel);
|
|
57
|
+
if (!map) {
|
|
58
|
+
map = new Map();
|
|
59
|
+
this.targetPageKeyMap.set(tmodel, map);
|
|
60
|
+
}
|
|
61
|
+
map.set(targetName, pageKey);
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "getTargetPageKey",
|
|
65
|
+
value: function getTargetPageKey(tmodel, targetName) {
|
|
66
|
+
var _this$targetPageKeyMa, _this$targetPageKeyMa2;
|
|
67
|
+
return (_this$targetPageKeyMa = (_this$targetPageKeyMa2 = this.targetPageKeyMap.get(tmodel)) === null || _this$targetPageKeyMa2 === void 0 ? void 0 : _this$targetPageKeyMa2.get(targetName)) !== null && _this$targetPageKeyMa !== void 0 ? _this$targetPageKeyMa : document.URL;
|
|
68
|
+
}
|
|
44
69
|
}, {
|
|
45
70
|
key: "fetchCommon",
|
|
46
71
|
value: function fetchCommon(fetchId, cacheId, tmodel, fetchMap, fetchFn) {
|
|
47
72
|
TargetUtil.markFetchAction(tmodel);
|
|
73
|
+
var pageKey = document.URL;
|
|
74
|
+
var targetName = tmodel.key;
|
|
75
|
+
this.setTargetPageKey(tmodel, targetName, pageKey);
|
|
48
76
|
if (!this.isFetched(cacheId)) {
|
|
49
77
|
if (!fetchMap[fetchId]) {
|
|
50
78
|
fetchMap[fetchId] = {
|
|
@@ -71,7 +99,7 @@ var LoadingManager = /*#__PURE__*/function () {
|
|
|
71
99
|
fetchMap: fetchMap
|
|
72
100
|
};
|
|
73
101
|
}
|
|
74
|
-
this.addToTModelKeyMap(tmodel, tmodel.key, fetchId, cacheId);
|
|
102
|
+
this.addToTModelKeyMap(tmodel, tmodel.key, fetchId, cacheId, fetchMap);
|
|
75
103
|
return fetchId;
|
|
76
104
|
}
|
|
77
105
|
}, {
|
|
@@ -120,11 +148,12 @@ var LoadingManager = /*#__PURE__*/function () {
|
|
|
120
148
|
}, {
|
|
121
149
|
key: "getTModelKey",
|
|
122
150
|
value: function getTModelKey(tmodel, targetName) {
|
|
123
|
-
|
|
151
|
+
var pageKey = this.getTargetPageKey(tmodel, targetName);
|
|
152
|
+
return "".concat(pageKey, "_").concat(tmodel.oid, "_").concat(targetName);
|
|
124
153
|
}
|
|
125
154
|
}, {
|
|
126
155
|
key: "addToTModelKeyMap",
|
|
127
|
-
value: function addToTModelKeyMap(tmodel, targetName, fetchId, cacheId) {
|
|
156
|
+
value: function addToTModelKeyMap(tmodel, targetName, fetchId, cacheId, fetchMap) {
|
|
128
157
|
var key = this.getTModelKey(tmodel, targetName);
|
|
129
158
|
var loadTargetName = TUtil.getLoadTargetName(targetName);
|
|
130
159
|
var loadingComplete = this.isLoadingComplete(tmodel, targetName);
|
|
@@ -149,8 +178,8 @@ var LoadingManager = /*#__PURE__*/function () {
|
|
|
149
178
|
this.tmodelKeyMap[key].entryCount++;
|
|
150
179
|
tmodel.val(loadTargetName).push(undefined);
|
|
151
180
|
if (cacheId && this.isFetched(cacheId)) {
|
|
152
|
-
|
|
153
|
-
this.handleSuccess(
|
|
181
|
+
fetchMap[fetchId].startTime = TUtil.now();
|
|
182
|
+
this.handleSuccess(fetchMap[fetchId], this.cacheMap[cacheId].result);
|
|
154
183
|
}
|
|
155
184
|
}
|
|
156
185
|
}, {
|
package/build/PageManager.js
CHANGED
|
@@ -85,7 +85,7 @@ var PageManager = /*#__PURE__*/function () {
|
|
|
85
85
|
_context.next = 16;
|
|
86
86
|
return tApp.start();
|
|
87
87
|
case 16:
|
|
88
|
-
_context.next =
|
|
88
|
+
_context.next = 35;
|
|
89
89
|
break;
|
|
90
90
|
case 18:
|
|
91
91
|
tApp.tRoot = this.pageCache[link].tRoot;
|
|
@@ -101,17 +101,20 @@ var PageManager = /*#__PURE__*/function () {
|
|
|
101
101
|
tApp.manager.activatePendingTargetsAfterDom(visibles, {
|
|
102
102
|
restoredDoneTargets: true
|
|
103
103
|
});
|
|
104
|
+
tApp.manager.activatePendingTargetsAfterDom(newVisibles, {
|
|
105
|
+
restoredDoneTargets: true
|
|
106
|
+
});
|
|
104
107
|
tApp.manager.visibleOidMap = _objectSpread({}, this.pageCache[link].visibleOidMap);
|
|
105
108
|
newVisibles.forEach(function (visible) {
|
|
106
109
|
tApp.manager.visibleOidMap[visible.oid] = visible;
|
|
107
110
|
});
|
|
108
111
|
window.scrollTo(this.pageCache[link].scrollLeft, this.pageCache[link].scrollTop);
|
|
109
112
|
this.lastLink = link;
|
|
110
|
-
_context.next =
|
|
113
|
+
_context.next = 34;
|
|
111
114
|
return tApp.start();
|
|
112
|
-
case 33:
|
|
113
|
-
getRunScheduler().restoreSnapshot(this.pageCache[link].runSnapshot);
|
|
114
115
|
case 34:
|
|
116
|
+
getRunScheduler().restoreSnapshot(this.pageCache[link].runSnapshot);
|
|
117
|
+
case 35:
|
|
115
118
|
case "end":
|
|
116
119
|
return _context.stop();
|
|
117
120
|
}
|
package/build/TModel.js
CHANGED
|
@@ -590,6 +590,8 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
590
590
|
targets: this.originalTargetNames
|
|
591
591
|
}, {
|
|
592
592
|
activeTargetList: this.activeTargetList
|
|
593
|
+
}, {
|
|
594
|
+
activatedTargets: this.activatedTargets
|
|
593
595
|
}, {
|
|
594
596
|
updatingTargetList: this.updatingTargetList
|
|
595
597
|
}, {
|
package/build/TModelManager.js
CHANGED
|
@@ -505,7 +505,7 @@ var TModelManager = /*#__PURE__*/function () {
|
|
|
505
505
|
value: function activatePendingTargetsAfterDom(tmodels) {
|
|
506
506
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
507
507
|
_ref$restoredDoneTarg = _ref.restoredDoneTargets,
|
|
508
|
-
restoredDoneTargets = _ref$restoredDoneTarg === void 0 ?
|
|
508
|
+
restoredDoneTargets = _ref$restoredDoneTarg === void 0 ? true : _ref$restoredDoneTarg;
|
|
509
509
|
var _iterator8 = _createForOfIteratorHelper(tmodels),
|
|
510
510
|
_step8;
|
|
511
511
|
try {
|
|
@@ -522,19 +522,20 @@ var TModelManager = /*#__PURE__*/function () {
|
|
|
522
522
|
tmodel.noDomUpdatingTargets = undefined;
|
|
523
523
|
}
|
|
524
524
|
var pending = tmodel.pendingTargets;
|
|
525
|
+
var visited = new Set();
|
|
525
526
|
if (pending) {
|
|
526
527
|
for (var _i2 = 0, _arr2 = _toConsumableArray(pending); _i2 < _arr2.length; _i2++) {
|
|
527
528
|
var key = _arr2[_i2];
|
|
529
|
+
visited.add(key);
|
|
528
530
|
TargetUtil.cleanupTarget(tmodel, key);
|
|
529
531
|
TargetUtil.shouldActivateNextTarget(tmodel, key);
|
|
530
532
|
}
|
|
531
|
-
tmodel.pendingTargets = undefined;
|
|
532
533
|
}
|
|
533
534
|
if (restoredDoneTargets) {
|
|
534
535
|
for (var _i3 = 0, _Object$keys = Object.keys(tmodel.targetValues); _i3 < _Object$keys.length; _i3++) {
|
|
535
536
|
var _key = _Object$keys[_i3];
|
|
536
537
|
var targetValue = tmodel.targetValues[_key];
|
|
537
|
-
if (targetValue.status !== 'done') {
|
|
538
|
+
if (targetValue.status !== 'done' || visited.has(_key)) {
|
|
538
539
|
continue;
|
|
539
540
|
}
|
|
540
541
|
if (tmodel.isTargetInLoop(_key) || tmodel.isTargetPassiveLoop(_key)) {
|
package/build/TargetUtil.js
CHANGED
|
@@ -217,7 +217,6 @@ var TargetUtil = /*#__PURE__*/function () {
|
|
|
217
217
|
}
|
|
218
218
|
} else if (isEndTrigger) {
|
|
219
219
|
if (prevOk === true) {
|
|
220
|
-
tmodel.removeFromActiveTargets(nextTarget);
|
|
221
220
|
TargetUtil.activateTarget(tmodel, nextTarget);
|
|
222
221
|
nextTargetActivated = true;
|
|
223
222
|
TargetUtil.clearPendingTargetsForNextTarget(tmodel, nextTarget);
|