targetj 1.0.238 → 1.0.239
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/Export.js +5 -1
- package/build/AnimationManager.js +340 -298
- package/build/AnimationUtil.js +556 -8
- package/build/BaseModel.js +176 -88
- package/build/Bracket.js +0 -3
- package/build/LocationManager.js +34 -136
- package/build/PageManager.js +29 -7
- package/build/RunScheduler.js +1 -3
- package/build/ScheduleUtil.js +181 -0
- package/build/TModel.js +12 -7
- package/build/TModelManager.js +72 -18
- package/build/TUtil.js +141 -52
- package/build/TargetExecutor.js +50 -10
- package/build/TargetManager.js +160 -132
- package/build/TargetUtil.js +86 -13
- package/build/VisibilityUtil.js +1 -1
- package/build/index.js +11 -0
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/LocationManager.js
CHANGED
|
@@ -9,6 +9,7 @@ var _TUtil = require("./TUtil.js");
|
|
|
9
9
|
var _TargetUtil = require("./TargetUtil.js");
|
|
10
10
|
var _TargetData = require("./TargetData.js");
|
|
11
11
|
var _TModelUtil = require("./TModelUtil.js");
|
|
12
|
+
var _ScheduleUtil = require("./ScheduleUtil.js");
|
|
12
13
|
var _AnimationUtil = require("./AnimationUtil.js");
|
|
13
14
|
var _TargetExecutor = require("./TargetExecutor.js");
|
|
14
15
|
var _App = require("./App.js");
|
|
@@ -18,11 +19,7 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructur
|
|
|
18
19
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
19
20
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
20
21
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
21
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
22
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
23
22
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
24
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
25
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
26
23
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
27
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
25
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -52,9 +49,6 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
52
49
|
this.activatedMap = {};
|
|
53
50
|
this.calcBusy = false;
|
|
54
51
|
this.calcQueued = false;
|
|
55
|
-
this.resumePausedList = [];
|
|
56
|
-
this.resumePausedMap = {};
|
|
57
|
-
this.resumeScheduled = false;
|
|
58
52
|
this.calcEpoch = 0;
|
|
59
53
|
}
|
|
60
54
|
return _createClass(LocationManager, [{
|
|
@@ -67,9 +61,6 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
67
61
|
this.domIslandSet.clear();
|
|
68
62
|
this.calcBusy = false;
|
|
69
63
|
this.calcQueued = false;
|
|
70
|
-
this.resumePausedList = [];
|
|
71
|
-
this.resumePausedMap = {};
|
|
72
|
-
this.resumeScheduled = false;
|
|
73
64
|
}
|
|
74
65
|
}, {
|
|
75
66
|
key: "calculateActivated",
|
|
@@ -138,15 +129,14 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
138
129
|
return _context.abrupt("return");
|
|
139
130
|
case 15:
|
|
140
131
|
this.processAfterStack();
|
|
141
|
-
this.scheduleResumePaused();
|
|
142
132
|
this.calcBusy = false;
|
|
143
133
|
if (!this.calcQueued) {
|
|
144
|
-
_context.next =
|
|
134
|
+
_context.next = 20;
|
|
145
135
|
break;
|
|
146
136
|
}
|
|
147
137
|
this.calcQueued = false;
|
|
148
138
|
return _context.abrupt("return", this.calculateAll(budgetMs));
|
|
149
|
-
case
|
|
139
|
+
case 20:
|
|
150
140
|
case "end":
|
|
151
141
|
return _context.stop();
|
|
152
142
|
}
|
|
@@ -183,7 +173,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
183
173
|
index = job.index;
|
|
184
174
|
var child = children[index];
|
|
185
175
|
if (child) {
|
|
186
|
-
if (child.getDirtyLayout() &&
|
|
176
|
+
if (child.getDirtyLayout() && child.isComplete() && !child.hasChildren()) {
|
|
187
177
|
child.removeLayoutDirty(child, child.dirtyLayout.oids ? Object.keys(child.dirtyLayout.oids) : undefined);
|
|
188
178
|
}
|
|
189
179
|
}
|
|
@@ -260,16 +250,13 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
260
250
|
if (viewport.isOverflow()) {
|
|
261
251
|
viewport.overflow();
|
|
262
252
|
viewport.setLocation();
|
|
253
|
+
child.markLayoutDirty('overflow');
|
|
263
254
|
}
|
|
264
255
|
var prevX = child.actualValues.x;
|
|
265
256
|
var prevY = child.actualValues.y;
|
|
266
|
-
var prevWidth = child.getMinWidth();
|
|
267
257
|
if (child.isIncluded()) {
|
|
268
258
|
_this.calculateTargets(child);
|
|
269
259
|
}
|
|
270
|
-
if (prevWidth !== child.getMinWidth() && viewport.isOverflow()) {
|
|
271
|
-
child.markLayoutDirty('overflow');
|
|
272
|
-
}
|
|
273
260
|
if (child.isIncluded()) {
|
|
274
261
|
if (child.targets['onVisibleChildrenChange'] && !_this.visibleChildrenLengthMap[child.oid]) {
|
|
275
262
|
_this.visibleChildrenLengthMap[child.oid] = {
|
|
@@ -432,6 +419,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
432
419
|
if (viewport.isOverflow()) {
|
|
433
420
|
viewport.overflow();
|
|
434
421
|
viewport.setLocation();
|
|
422
|
+
child.markLayoutDirty('overflow');
|
|
435
423
|
}
|
|
436
424
|
if (child.isIncluded()) {
|
|
437
425
|
if (child.targets['onVisibleChildrenChange'] && !this.visibleChildrenLengthMap[child.oid]) {
|
|
@@ -499,88 +487,35 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
499
487
|
}
|
|
500
488
|
if (tmodel.isNowInvisible) {
|
|
501
489
|
this.addToLocationList(tmodel);
|
|
502
|
-
this.pauseSchedules(tmodel);
|
|
503
490
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
tmodel.addToParentVisibleChildren();
|
|
508
|
-
}
|
|
509
|
-
}, {
|
|
510
|
-
key: "pauseSchedules",
|
|
511
|
-
value: function pauseSchedules(tmodel) {
|
|
512
|
-
if (tmodel.type === 'BI') {
|
|
513
|
-
return;
|
|
514
|
-
}
|
|
515
|
-
var keys = new Set([].concat(_toConsumableArray(tmodel.activeTargetList), _toConsumableArray(tmodel.updatingTargetList)));
|
|
516
|
-
var _iterator = _createForOfIteratorHelper(keys),
|
|
517
|
-
_step;
|
|
518
|
-
try {
|
|
519
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
520
|
-
var key = _step.value;
|
|
521
|
-
var target = tmodel.targets[key];
|
|
522
|
-
if (_TUtil.TUtil.isDefined(tmodel.getScheduleTimeStamp(key)) && (target === null || target === void 0 ? void 0 : target.pauseOn) === 'hidden') {
|
|
523
|
-
_TUtil.TUtil.pauseSchedule(tmodel, key);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
} catch (err) {
|
|
527
|
-
_iterator.e(err);
|
|
528
|
-
} finally {
|
|
529
|
-
_iterator.f();
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
}, {
|
|
533
|
-
key: "resumeSchedules",
|
|
534
|
-
value: function resumeSchedules(tmodel) {
|
|
535
|
-
if (tmodel.type === 'BI') {
|
|
536
|
-
return;
|
|
537
|
-
}
|
|
538
|
-
var keys = new Set([].concat(_toConsumableArray(tmodel.activeTargetList), _toConsumableArray(tmodel.updatingTargetList)));
|
|
539
|
-
var _iterator2 = _createForOfIteratorHelper(keys),
|
|
540
|
-
_step2;
|
|
541
|
-
try {
|
|
542
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
543
|
-
var key = _step2.value;
|
|
544
|
-
var target = tmodel.targets[key];
|
|
545
|
-
var remaining = tmodel.getScheduleRemainingTime(key);
|
|
546
|
-
if (_TUtil.TUtil.isDefined(remaining) && (target === null || target === void 0 ? void 0 : target.pauseOn) === 'hidden') {
|
|
547
|
-
_TUtil.TUtil.resumeSchedule(tmodel, key);
|
|
548
|
-
(0, _App.getRunScheduler)().schedule(remaining, 'resume-' + tmodel.oid + '-' + key);
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
} catch (err) {
|
|
552
|
-
_iterator2.e(err);
|
|
553
|
-
} finally {
|
|
554
|
-
_iterator2.f();
|
|
491
|
+
_ScheduleUtil.ScheduleUtil.pauseResumeSchedule(tmodel);
|
|
492
|
+
if (tmodel.type !== 'BI' && tmodel.isVisible() && tmodel.isInFlow() && tmodel.getParent()) {
|
|
493
|
+
tmodel.getParent().visibleChildren.push(tmodel);
|
|
555
494
|
}
|
|
556
495
|
}
|
|
557
496
|
}, {
|
|
558
497
|
key: "calculateTargets",
|
|
559
498
|
value: function calculateTargets(tmodel) {
|
|
560
|
-
if (tmodel.hasDom() && tmodel.pausedBatch) {
|
|
561
|
-
if (!this.resumePausedMap[tmodel.oid]) {
|
|
562
|
-
this.resumePausedMap[tmodel.oid] = true;
|
|
563
|
-
this.resumePausedList.push(tmodel);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
499
|
this.checkInternalEvents(tmodel);
|
|
567
500
|
var guard = 0;
|
|
568
501
|
while (tmodel.activatedTargets.length && guard++ < 50) {
|
|
569
502
|
var batch = tmodel.activatedTargets.slice(0);
|
|
570
503
|
tmodel.activatedTargets.length = 0;
|
|
571
|
-
var
|
|
572
|
-
|
|
504
|
+
var _iterator = _createForOfIteratorHelper(batch),
|
|
505
|
+
_step;
|
|
573
506
|
try {
|
|
574
|
-
for (
|
|
575
|
-
var key =
|
|
507
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
508
|
+
var key = _step.value;
|
|
576
509
|
(0, _App.getTargetManager)().applyTargetValue(tmodel, key);
|
|
577
510
|
}
|
|
578
511
|
} catch (err) {
|
|
579
|
-
|
|
512
|
+
_iterator.e(err);
|
|
580
513
|
} finally {
|
|
581
|
-
|
|
514
|
+
_iterator.f();
|
|
582
515
|
}
|
|
583
516
|
}
|
|
517
|
+
_ScheduleUtil.ScheduleUtil.pauseResumeSchedule(tmodel);
|
|
518
|
+
tmodel.activateChangedPassiveTargets();
|
|
584
519
|
(0, _App.getTargetManager)().applyTargetValues(tmodel);
|
|
585
520
|
if (tmodel.updatingTargetList.length > 0) {
|
|
586
521
|
(0, _App.getTargetManager)().setActualValues(tmodel, tmodel.updatingTargetList);
|
|
@@ -603,43 +538,6 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
603
538
|
tmodel.hasDomNow = false;
|
|
604
539
|
tmodel.targetExecutionCount++;
|
|
605
540
|
}
|
|
606
|
-
}, {
|
|
607
|
-
key: "scheduleResumePaused",
|
|
608
|
-
value: function scheduleResumePaused() {
|
|
609
|
-
var _this2 = this;
|
|
610
|
-
if (this.resumeScheduled || !this.resumePausedList.length) {
|
|
611
|
-
return;
|
|
612
|
-
}
|
|
613
|
-
this.resumeScheduled = true;
|
|
614
|
-
requestAnimationFrame(function () {
|
|
615
|
-
requestAnimationFrame(function () {
|
|
616
|
-
_this2.resumeScheduled = false;
|
|
617
|
-
var list = _this2.resumePausedList.slice();
|
|
618
|
-
_this2.resumePausedList.length = 0;
|
|
619
|
-
_this2.resumePausedMap = {};
|
|
620
|
-
var _iterator4 = _createForOfIteratorHelper(list),
|
|
621
|
-
_step4;
|
|
622
|
-
try {
|
|
623
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
624
|
-
var tmodel = _step4.value;
|
|
625
|
-
var batch = tmodel.pausedBatch;
|
|
626
|
-
if (!batch || !tmodel.hasDom()) {
|
|
627
|
-
continue;
|
|
628
|
-
}
|
|
629
|
-
var el = tmodel.$dom.getElement();
|
|
630
|
-
if (el && el.isConnected && document.visibilityState === 'visible') {
|
|
631
|
-
(0, _App.getAnimationManager)().animate(tmodel, batch, _AnimationUtil.AnimationUtil.getAnimationHooks());
|
|
632
|
-
tmodel.pausedBatch = undefined;
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
} catch (err) {
|
|
636
|
-
_iterator4.e(err);
|
|
637
|
-
} finally {
|
|
638
|
-
_iterator4.f();
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
541
|
}, {
|
|
644
542
|
key: "checkExternalEvents",
|
|
645
543
|
value: function checkExternalEvents(tmodel) {
|
|
@@ -647,20 +545,20 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
647
545
|
if ((externalEventMap === null || externalEventMap === void 0 ? void 0 : externalEventMap.size) > 0) {
|
|
648
546
|
var eventTargets = [];
|
|
649
547
|
var eventMap = _TargetData.TargetData.allEventMap;
|
|
650
|
-
var
|
|
651
|
-
|
|
548
|
+
var _iterator2 = _createForOfIteratorHelper(externalEventMap),
|
|
549
|
+
_step2;
|
|
652
550
|
try {
|
|
653
|
-
for (
|
|
654
|
-
var
|
|
655
|
-
targetName =
|
|
551
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
552
|
+
var _step2$value = _slicedToArray(_step2.value, 1),
|
|
553
|
+
targetName = _step2$value[0];
|
|
656
554
|
if (eventMap[targetName](tmodel)) {
|
|
657
555
|
eventTargets.push(tmodel.allTargetMap[targetName]);
|
|
658
556
|
}
|
|
659
557
|
}
|
|
660
558
|
} catch (err) {
|
|
661
|
-
|
|
559
|
+
_iterator2.e(err);
|
|
662
560
|
} finally {
|
|
663
|
-
|
|
561
|
+
_iterator2.f();
|
|
664
562
|
}
|
|
665
563
|
this.runEventTargets(tmodel, eventTargets);
|
|
666
564
|
}
|
|
@@ -672,20 +570,20 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
672
570
|
var eventMap = _TargetData.TargetData.internalEventMap;
|
|
673
571
|
var internalEventMap = tmodel.internalEventMap;
|
|
674
572
|
if ((internalEventMap === null || internalEventMap === void 0 ? void 0 : internalEventMap.size) > 0) {
|
|
675
|
-
var
|
|
676
|
-
|
|
573
|
+
var _iterator3 = _createForOfIteratorHelper(internalEventMap),
|
|
574
|
+
_step3;
|
|
677
575
|
try {
|
|
678
|
-
for (
|
|
679
|
-
var
|
|
680
|
-
targetName =
|
|
576
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
577
|
+
var _step3$value = _slicedToArray(_step3.value, 1),
|
|
578
|
+
targetName = _step3$value[0];
|
|
681
579
|
if (eventMap[targetName](tmodel)) {
|
|
682
580
|
eventTargets.push(tmodel.allTargetMap[targetName]);
|
|
683
581
|
}
|
|
684
582
|
}
|
|
685
583
|
} catch (err) {
|
|
686
|
-
|
|
584
|
+
_iterator3.e(err);
|
|
687
585
|
} finally {
|
|
688
|
-
|
|
586
|
+
_iterator3.f();
|
|
689
587
|
}
|
|
690
588
|
}
|
|
691
589
|
this.runEventTargets(tmodel, eventTargets);
|
|
@@ -732,17 +630,17 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
732
630
|
}
|
|
733
631
|
}, {
|
|
734
632
|
key: "fixLocation",
|
|
735
|
-
value: function fixLocation(tmodel, prevX, prevY
|
|
633
|
+
value: function fixLocation(tmodel, prevX, prevY) {
|
|
736
634
|
if (tmodel.hasValidAnimation()) {
|
|
737
635
|
var keysToSnap = [];
|
|
738
636
|
var valuesToSnap = [];
|
|
739
637
|
var xChanged = tmodel.actualValues.x !== prevX;
|
|
740
638
|
var yChanged = tmodel.actualValues.y !== prevY;
|
|
741
|
-
if (xChanged &&
|
|
639
|
+
if (xChanged && tmodel.getTargetStatus(tmodel.allTargetMap['x']) !== 'updating') {
|
|
742
640
|
keysToSnap.push('x');
|
|
743
641
|
valuesToSnap.push(tmodel.val('x'));
|
|
744
642
|
}
|
|
745
|
-
if (yChanged &&
|
|
643
|
+
if (yChanged && tmodel.getTargetStatus(tmodel.allTargetMap['y']) !== 'updating') {
|
|
746
644
|
keysToSnap.push('y');
|
|
747
645
|
valuesToSnap.push(tmodel.val('y'));
|
|
748
646
|
}
|
package/build/PageManager.js
CHANGED
|
@@ -28,6 +28,7 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
28
28
|
function PageManager() {
|
|
29
29
|
_classCallCheck(this, PageManager);
|
|
30
30
|
this.lastLink = _TUtil.TUtil.getFullLink(document.URL);
|
|
31
|
+
this.lastCachedLink = undefined;
|
|
31
32
|
this.pageCache = {};
|
|
32
33
|
this.initHistory();
|
|
33
34
|
}
|
|
@@ -102,7 +103,9 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
102
103
|
visibles.forEach(function (tmodel) {
|
|
103
104
|
tmodel.visibilityStatus = undefined;
|
|
104
105
|
});
|
|
105
|
-
_App.tApp.manager.activatePendingTargetsAfterDom(visibles
|
|
106
|
+
_App.tApp.manager.activatePendingTargetsAfterDom(visibles, {
|
|
107
|
+
restoredDoneTargets: true
|
|
108
|
+
});
|
|
106
109
|
_App.tApp.manager.visibleOidMap = _objectSpread({}, this.pageCache[link].visibleOidMap);
|
|
107
110
|
newVisibles.forEach(function (visible) {
|
|
108
111
|
_App.tApp.manager.visibleOidMap[visible.oid] = visible;
|
|
@@ -180,7 +183,7 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
180
183
|
updateHistory = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : true;
|
|
181
184
|
link = _TUtil.TUtil.getFullLink(link);
|
|
182
185
|
if (!this.lastLink) {
|
|
183
|
-
_context3.next =
|
|
186
|
+
_context3.next = 14;
|
|
184
187
|
break;
|
|
185
188
|
}
|
|
186
189
|
runSnapshot = (0, _App.getRunScheduler)().getSnapshot();
|
|
@@ -202,19 +205,20 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
202
205
|
tRoot: _App.tApp.tRoot,
|
|
203
206
|
runSnapshot: runSnapshot
|
|
204
207
|
};
|
|
205
|
-
|
|
208
|
+
this.lastCachedLink = this.lastLink;
|
|
209
|
+
_context3.next = 14;
|
|
206
210
|
return _App.tApp.reset();
|
|
207
|
-
case
|
|
211
|
+
case 14:
|
|
208
212
|
if (updateHistory) {
|
|
209
213
|
history.pushState({
|
|
210
214
|
link: link
|
|
211
215
|
}, "", link);
|
|
212
216
|
}
|
|
213
|
-
_context3.next =
|
|
217
|
+
_context3.next = 17;
|
|
214
218
|
return this.openPage(link, false);
|
|
215
|
-
case 16:
|
|
216
|
-
(0, _App.getRunScheduler)().schedule(0, "pagemanager-processOpenLink");
|
|
217
219
|
case 17:
|
|
220
|
+
(0, _App.getRunScheduler)().schedule(0, "pagemanager-processOpenLink");
|
|
221
|
+
case 18:
|
|
218
222
|
case "end":
|
|
219
223
|
return _context3.stop();
|
|
220
224
|
}
|
|
@@ -256,5 +260,23 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
256
260
|
value: function back() {
|
|
257
261
|
return history.back();
|
|
258
262
|
}
|
|
263
|
+
}, {
|
|
264
|
+
key: "getCachedPage",
|
|
265
|
+
value: function getCachedPage() {
|
|
266
|
+
var link = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.lastCachedLink;
|
|
267
|
+
if (!link) {
|
|
268
|
+
return undefined;
|
|
269
|
+
}
|
|
270
|
+
link = _TUtil.TUtil.getFullLink(link);
|
|
271
|
+
return this.pageCache[link];
|
|
272
|
+
}
|
|
273
|
+
}, {
|
|
274
|
+
key: "getCachedTModel",
|
|
275
|
+
value: function getCachedTModel(id) {
|
|
276
|
+
var _page$tmodelIdMap;
|
|
277
|
+
var link = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.lastCachedLink;
|
|
278
|
+
var page = this.getCachedPage(link);
|
|
279
|
+
return page === null || page === void 0 || (_page$tmodelIdMap = page.tmodelIdMap) === null || _page$tmodelIdMap === void 0 ? void 0 : _page$tmodelIdMap[id];
|
|
280
|
+
}
|
|
259
281
|
}]);
|
|
260
282
|
}();
|
package/build/RunScheduler.js
CHANGED
|
@@ -238,9 +238,7 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
238
238
|
} else {
|
|
239
239
|
var newDelay = this.nextRuns.length > 0 ? this.nextRuns[0].delay - (_TUtil.TUtil.now() - this.nextRuns[0].insertTime) : undefined;
|
|
240
240
|
if (newDelay === undefined || (0, _App.getManager)().lists.activeTModels.length > 0 || (0, _App.getManager)().lists.updatingTModels.length > 0 || (0, _App.getManager)().lists.restyle.length > 0 || (0, _App.getManager)().lists.reasyncStyle.length > 0 || (0, _App.getEvents)().eventQueue.length > 0 || (0, _App.getLocationManager)().activatedList.length > 0) {
|
|
241
|
-
if ((0, _App.
|
|
242
|
-
this.schedule(1, "getManager-locationManager-activatedList");
|
|
243
|
-
} else if ((0, _App.getManager)().lists.updatingTModels.length > 0) {
|
|
241
|
+
if ((0, _App.getManager)().lists.updatingTModels.length > 0) {
|
|
244
242
|
this.schedule(1, "getManager-needsRerun-updatingTModels");
|
|
245
243
|
} else if ((0, _App.getManager)().lists.activeTModels.length > 0) {
|
|
246
244
|
var activeTModel = (0, _App.getManager)().lists.activeTModels.find(function (tmodel) {
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ScheduleUtil = void 0;
|
|
7
|
+
var _TUtil = require("./TUtil.js");
|
|
8
|
+
var _App = require("./App.js");
|
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
11
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
12
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
14
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
15
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
16
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
18
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
19
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
20
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
21
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
22
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
23
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
25
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* It provides a variety of helping functions for scheduling target execution
|
|
29
|
+
*/
|
|
30
|
+
var ScheduleUtil = exports.ScheduleUtil = /*#__PURE__*/function () {
|
|
31
|
+
function ScheduleUtil() {
|
|
32
|
+
_classCallCheck(this, ScheduleUtil);
|
|
33
|
+
}
|
|
34
|
+
return _createClass(ScheduleUtil, null, [{
|
|
35
|
+
key: "scheduleExecution",
|
|
36
|
+
value: function scheduleExecution(tmodel, key) {
|
|
37
|
+
var interval = tmodel.getTargetInterval(key);
|
|
38
|
+
var now = _TUtil.TUtil.now();
|
|
39
|
+
if (interval <= 0) {
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
if (tmodel.isTargetImperative(key) && tmodel.getTargetStep(key) === 0) {
|
|
43
|
+
tmodel.setScheduleTimeStamp(key, now);
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
var remaining = tmodel.getScheduleRemainingTime(key);
|
|
47
|
+
if (_TUtil.TUtil.isDefined(remaining)) {
|
|
48
|
+
tmodel.setScheduleTimeStamp(key, now - Math.max(interval - remaining, 0));
|
|
49
|
+
tmodel.resetScheduleRemainingTime(key);
|
|
50
|
+
return remaining;
|
|
51
|
+
}
|
|
52
|
+
var lastScheduledTime = tmodel.getScheduleTimeStamp(key);
|
|
53
|
+
if (_TUtil.TUtil.isDefined(lastScheduledTime)) {
|
|
54
|
+
var elapsed = now - lastScheduledTime;
|
|
55
|
+
return Math.max(interval - elapsed, 0);
|
|
56
|
+
}
|
|
57
|
+
tmodel.setScheduleTimeStamp(key, now);
|
|
58
|
+
return interval;
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "getSchedulingKeys",
|
|
62
|
+
value: function getSchedulingKeys(tmodel) {
|
|
63
|
+
var keys = [];
|
|
64
|
+
for (var _i = 0, _Object$entries = Object.entries(tmodel.targetValues); _i < _Object$entries.length; _i++) {
|
|
65
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
66
|
+
key = _Object$entries$_i[0],
|
|
67
|
+
targetValue = _Object$entries$_i[1];
|
|
68
|
+
if (_TUtil.TUtil.isDefined(targetValue.scheduleTimeStamp) || _TUtil.TUtil.isDefined(targetValue.scheduleRemainingTime)) {
|
|
69
|
+
keys.push(key);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return keys;
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "pauseResumeSchedule",
|
|
76
|
+
value: function pauseResumeSchedule(tmodel) {
|
|
77
|
+
var _tmodel$animatingMap$, _tmodel$animatingMap;
|
|
78
|
+
if (tmodel.type === 'BI') {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
var schedulingKeys = ScheduleUtil.getSchedulingKeys(tmodel);
|
|
82
|
+
if (!schedulingKeys.length && !tmodel.animatingMap) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
var animatingKeys = new Set((_tmodel$animatingMap$ = (_tmodel$animatingMap = tmodel.animatingMap) === null || _tmodel$animatingMap === void 0 ? void 0 : _tmodel$animatingMap.keys()) !== null && _tmodel$animatingMap$ !== void 0 ? _tmodel$animatingMap$ : []);
|
|
86
|
+
var keys = new Set([].concat(_toConsumableArray(schedulingKeys), _toConsumableArray(animatingKeys)));
|
|
87
|
+
if (!keys.size) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
var animationsToPause = new Set();
|
|
91
|
+
var _iterator = _createForOfIteratorHelper(keys),
|
|
92
|
+
_step;
|
|
93
|
+
try {
|
|
94
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
95
|
+
var key = _step.value;
|
|
96
|
+
var shouldPause = ScheduleUtil.shouldPauseTarget(tmodel, key);
|
|
97
|
+
if (shouldPause) {
|
|
98
|
+
var _tmodel$animatingMap2;
|
|
99
|
+
if (_TUtil.TUtil.isDefined(tmodel.getScheduleTimeStamp(key))) {
|
|
100
|
+
ScheduleUtil.pauseSchedule(tmodel, key);
|
|
101
|
+
}
|
|
102
|
+
if ((_tmodel$animatingMap2 = tmodel.animatingMap) !== null && _tmodel$animatingMap2 !== void 0 && _tmodel$animatingMap2.has(key)) {
|
|
103
|
+
animationsToPause.add(key);
|
|
104
|
+
}
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
var remaining = tmodel.getScheduleRemainingTime(key);
|
|
108
|
+
if (_TUtil.TUtil.isDefined(remaining)) {
|
|
109
|
+
ScheduleUtil.resumeSchedule(tmodel, key);
|
|
110
|
+
tmodel.addTargetToStatusList(key);
|
|
111
|
+
(0, _App.getRunScheduler)().scheduleOnlyIfEarlier(remaining, "resume-".concat(tmodel.oid, "-").concat(key));
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (_TUtil.TUtil.isDefined(tmodel.getScheduleTimeStamp(key))) {
|
|
115
|
+
var delay = ScheduleUtil.scheduleExecution(tmodel, key);
|
|
116
|
+
tmodel.addTargetToStatusList(key);
|
|
117
|
+
(0, _App.getRunScheduler)().scheduleOnlyIfEarlier(delay, "resume-".concat(tmodel.oid, "-").concat(key));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
} catch (err) {
|
|
121
|
+
_iterator.e(err);
|
|
122
|
+
} finally {
|
|
123
|
+
_iterator.f();
|
|
124
|
+
}
|
|
125
|
+
if (animationsToPause.size) {
|
|
126
|
+
(0, _App.getAnimationManager)().pauseAnimations(tmodel, animationsToPause);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
key: "pauseSchedule",
|
|
131
|
+
value: function pauseSchedule(tmodel, key) {
|
|
132
|
+
var interval = tmodel.getTargetInterval(key);
|
|
133
|
+
var lastScheduledTime = tmodel.getScheduleTimeStamp(key);
|
|
134
|
+
if (interval <= 0 || !_TUtil.TUtil.isDefined(lastScheduledTime)) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
var now = _TUtil.TUtil.now();
|
|
138
|
+
var elapsed = now - lastScheduledTime;
|
|
139
|
+
var remaining = Math.max(interval - elapsed, 0);
|
|
140
|
+
tmodel.setScheduleRemainingTime(key, remaining);
|
|
141
|
+
tmodel.resetScheduleTimeStamp(key);
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
key: "resumeSchedule",
|
|
145
|
+
value: function resumeSchedule(tmodel, key) {
|
|
146
|
+
var remaining = tmodel.getScheduleRemainingTime(key);
|
|
147
|
+
if (!_TUtil.TUtil.isDefined(remaining)) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
var now = _TUtil.TUtil.now();
|
|
151
|
+
var interval = tmodel.getTargetInterval(key);
|
|
152
|
+
tmodel.setScheduleTimeStamp(key, now - Math.max(interval - remaining, 0));
|
|
153
|
+
tmodel.resetScheduleRemainingTime(key);
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
key: "shouldPauseTarget",
|
|
157
|
+
value: function shouldPauseTarget(tmodel, key) {
|
|
158
|
+
if (!tmodel.isExecuted(key)) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
var t = tmodel.isTargetImperative(key) ? tmodel.targetValues[key] : tmodel.targets[key];
|
|
162
|
+
var pauseOn = t === null || t === void 0 ? void 0 : t.pauseOn;
|
|
163
|
+
if (pauseOn === undefined || pauseOn === false) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
if (pauseOn === true) {
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
if (typeof pauseOn === 'function') {
|
|
170
|
+
return !!pauseOn.call(tmodel, key);
|
|
171
|
+
}
|
|
172
|
+
if (pauseOn === 'hidden') {
|
|
173
|
+
return !tmodel.isVisible();
|
|
174
|
+
}
|
|
175
|
+
if (pauseOn === 'noDom') {
|
|
176
|
+
return !tmodel.hasDom();
|
|
177
|
+
}
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
}]);
|
|
181
|
+
}();
|
package/build/TModel.js
CHANGED
|
@@ -338,13 +338,6 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
338
338
|
parent.getChildren();
|
|
339
339
|
return parent.allChildrenMap[this.oid] === this;
|
|
340
340
|
}
|
|
341
|
-
}, {
|
|
342
|
-
key: "addToParentVisibleChildren",
|
|
343
|
-
value: function addToParentVisibleChildren() {
|
|
344
|
-
if (this.isVisible() && this.isInFlow() && this.getParent()) {
|
|
345
|
-
this.getParent().visibleChildren.push(this);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
341
|
}, {
|
|
349
342
|
key: "markEventDirty",
|
|
350
343
|
value: function markEventDirty() {
|
|
@@ -600,10 +593,22 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
600
593
|
width: this.getWidth()
|
|
601
594
|
}, {
|
|
602
595
|
height: this.getHeight()
|
|
596
|
+
}, {
|
|
597
|
+
targets: this.originalTargetNames
|
|
603
598
|
}, {
|
|
604
599
|
activeTargetList: this.activeTargetList
|
|
605
600
|
}, {
|
|
606
601
|
updatingTargetList: this.updatingTargetList
|
|
602
|
+
}, {
|
|
603
|
+
animatingMap: _toConsumableArray(this.animatingMap ? _toConsumableArray(this.animatingMap.keys()) : [])
|
|
604
|
+
}, {
|
|
605
|
+
noDomUpdatingTargets: _toConsumableArray(this.noDomUpdatingTargets ? _toConsumableArray(this.noDomUpdatingTargets) : [])
|
|
606
|
+
}, {
|
|
607
|
+
pendingTargets: _toConsumableArray(this.pendingTargets ? _toConsumableArray(this.pendingTargets) : [])
|
|
608
|
+
}, {
|
|
609
|
+
styleTargetMap: _toConsumableArray(this.styleTargetMap ? _toConsumableArray(this.styleTargetMap.keys()) : [])
|
|
610
|
+
}, {
|
|
611
|
+
passiveTargetList: this.passiveTargetList
|
|
607
612
|
}, {
|
|
608
613
|
updatingChildren: this.updatingChildrenMap ? _toConsumableArray(this.updatingChildrenMap.keys()) : []
|
|
609
614
|
}, {
|