targetj 1.0.240 → 1.0.242
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 +27 -5
- package/README.md +108 -68
- package/build/$Dom.js +21 -25
- package/build/AnimationManager.js +40 -45
- package/build/AnimationUtil.js +41 -45
- package/build/App.js +73 -74
- package/build/BaseModel.js +86 -90
- package/build/Bracket.js +7 -21
- package/build/BracketGenerator.js +15 -19
- package/build/ColorUtil.js +3 -8
- package/build/DomInit.js +34 -38
- package/build/Easing.js +3 -8
- package/build/EventListener.js +66 -75
- package/build/LoadingManager.js +34 -38
- package/build/LocationManager.js +52 -56
- package/build/Moves.js +17 -21
- package/build/PageManager.js +64 -68
- package/build/RunScheduler.js +72 -73
- package/build/ScheduleUtil.js +20 -24
- package/build/SearchUtil.js +16 -20
- package/build/TModel.js +159 -99
- package/build/TModelManager.js +37 -41
- package/build/TModelUtil.js +122 -53
- package/build/TUtil.js +16 -20
- package/build/TargetData.js +40 -45
- package/build/TargetExecutor.js +72 -76
- package/build/TargetManager.js +49 -52
- package/build/TargetParser.js +35 -39
- package/build/TargetUtil.js +28 -31
- package/build/Viewport.js +24 -22
- package/build/VisibilityUtil.js +74 -70
- package/build/index.js +20 -225
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/PageManager.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PageManager = void 0;
|
|
7
|
-
var _TUtil = require("./TUtil.js");
|
|
8
|
-
var _App = require("./App.js");
|
|
9
|
-
var _DomInit = require("./DomInit.js");
|
|
10
|
-
var _$Dom = require("./$Dom.js");
|
|
11
1
|
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); }
|
|
12
2
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
13
3
|
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; }
|
|
@@ -20,14 +10,19 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
|
|
|
20
10
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
21
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
12
|
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); }
|
|
13
|
+
import { TUtil } from "./TUtil.js";
|
|
14
|
+
import { tApp, App, getRunScheduler, getLocationManager, getEvents } from "./App.js";
|
|
15
|
+
import { DomInit } from "./DomInit.js";
|
|
16
|
+
import { $Dom } from "./$Dom.js";
|
|
17
|
+
|
|
23
18
|
/**
|
|
24
19
|
* It enables opening new pages and managing history. It alo provide page caching.
|
|
25
20
|
* It is used to provide a single page app experience.
|
|
26
21
|
*/
|
|
27
|
-
var PageManager =
|
|
22
|
+
var PageManager = /*#__PURE__*/function () {
|
|
28
23
|
function PageManager() {
|
|
29
24
|
_classCallCheck(this, PageManager);
|
|
30
|
-
this.lastLink =
|
|
25
|
+
this.lastLink = TUtil.getFullLink(document.URL);
|
|
31
26
|
this.lastCachedLink = undefined;
|
|
32
27
|
this.pageCache = {};
|
|
33
28
|
this.initHistory();
|
|
@@ -35,7 +30,7 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
35
30
|
return _createClass(PageManager, [{
|
|
36
31
|
key: "initHistory",
|
|
37
32
|
value: function initHistory() {
|
|
38
|
-
var link =
|
|
33
|
+
var link = TUtil.getFullLink(document.URL);
|
|
39
34
|
var st = history.state;
|
|
40
35
|
if (!st || !st.link && !st.browserUrl) {
|
|
41
36
|
history.replaceState({
|
|
@@ -47,12 +42,12 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
47
42
|
}, {
|
|
48
43
|
key: "initPage",
|
|
49
44
|
value: function initPage(html) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
|
|
45
|
+
tApp.tRoot.$dom.outerHTML(html);
|
|
46
|
+
tApp.tRoot.$dom = $Dom.query('#tgjs-root') ? new $Dom('#tgjs-root') : new $Dom('body');
|
|
47
|
+
if (tApp.tRoot.$dom.getTagName() !== 'body') {
|
|
48
|
+
tApp.tRoot.$dom.attr('data-tj-no-slot', 'true');
|
|
54
49
|
}
|
|
55
|
-
|
|
50
|
+
DomInit.initPageDoms(tApp.tRoot.$dom);
|
|
56
51
|
}
|
|
57
52
|
}, {
|
|
58
53
|
key: "openPage",
|
|
@@ -71,51 +66,51 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
71
66
|
break;
|
|
72
67
|
}
|
|
73
68
|
_context.next = 4;
|
|
74
|
-
return
|
|
69
|
+
return tApp.stop();
|
|
75
70
|
case 4:
|
|
76
|
-
|
|
71
|
+
getLocationManager().cancelCurrentCalculation();
|
|
77
72
|
_context.next = 7;
|
|
78
|
-
return
|
|
73
|
+
return tApp.reset();
|
|
79
74
|
case 7:
|
|
80
|
-
link =
|
|
75
|
+
link = TUtil.getFullLink(link);
|
|
81
76
|
if (this.pageCache[link]) {
|
|
82
77
|
_context.next = 18;
|
|
83
78
|
break;
|
|
84
79
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
tApp.tRoot.$dom.innerHTML("");
|
|
81
|
+
App.oids = {};
|
|
82
|
+
App.tmodelIdMap = {};
|
|
83
|
+
tApp.tRoot = tApp.tRootFactory();
|
|
89
84
|
this.lastLink = link;
|
|
90
85
|
_context.next = 16;
|
|
91
|
-
return
|
|
86
|
+
return tApp.start();
|
|
92
87
|
case 16:
|
|
93
88
|
_context.next = 34;
|
|
94
89
|
break;
|
|
95
90
|
case 18:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
91
|
+
tApp.tRoot = this.pageCache[link].tRoot;
|
|
92
|
+
App.oids = this.pageCache[link].oids;
|
|
93
|
+
App.tmodelIdMap = this.pageCache[link].tmodelIdMap;
|
|
94
|
+
tApp.tRoot.$dom = $Dom.query('#tgjs-root') ? new $Dom('#tgjs-root') : new $Dom('body');
|
|
95
|
+
tApp.tRoot.$dom.innerHTML(this.pageCache[link].html);
|
|
101
96
|
visibles = Object.values(this.pageCache[link].visibleOidMap);
|
|
102
|
-
newVisibles =
|
|
97
|
+
newVisibles = DomInit.initCacheDoms(visibles);
|
|
103
98
|
visibles.forEach(function (tmodel) {
|
|
104
99
|
tmodel.visibilityStatus = undefined;
|
|
105
100
|
});
|
|
106
|
-
|
|
101
|
+
tApp.manager.activatePendingTargetsAfterDom(visibles, {
|
|
107
102
|
restoredDoneTargets: true
|
|
108
103
|
});
|
|
109
|
-
|
|
104
|
+
tApp.manager.visibleOidMap = _objectSpread({}, this.pageCache[link].visibleOidMap);
|
|
110
105
|
newVisibles.forEach(function (visible) {
|
|
111
|
-
|
|
106
|
+
tApp.manager.visibleOidMap[visible.oid] = visible;
|
|
112
107
|
});
|
|
113
108
|
window.scrollTo(this.pageCache[link].scrollLeft, this.pageCache[link].scrollTop);
|
|
114
109
|
this.lastLink = link;
|
|
115
110
|
_context.next = 33;
|
|
116
|
-
return
|
|
111
|
+
return tApp.start();
|
|
117
112
|
case 33:
|
|
118
|
-
|
|
113
|
+
getRunScheduler().restoreSnapshot(this.pageCache[link].runSnapshot);
|
|
119
114
|
case 34:
|
|
120
115
|
case "end":
|
|
121
116
|
return _context.stop();
|
|
@@ -163,10 +158,10 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
163
158
|
}, {
|
|
164
159
|
key: "onPageClose",
|
|
165
160
|
value: function onPageClose() {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
161
|
+
tApp.resizeLastUpdate = TUtil.now();
|
|
162
|
+
getEvents().resizeRoot();
|
|
163
|
+
tApp.manager.getAvailableDoms().forEach(function (tmodel) {
|
|
164
|
+
getLocationManager().runEventTargets(tmodel, ['onPageClose']);
|
|
170
165
|
});
|
|
171
166
|
}
|
|
172
167
|
}, {
|
|
@@ -181,33 +176,33 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
181
176
|
while (1) switch (_context3.prev = _context3.next) {
|
|
182
177
|
case 0:
|
|
183
178
|
updateHistory = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : true;
|
|
184
|
-
link =
|
|
179
|
+
link = TUtil.getFullLink(link);
|
|
185
180
|
if (!this.lastLink) {
|
|
186
181
|
_context3.next = 14;
|
|
187
182
|
break;
|
|
188
183
|
}
|
|
189
|
-
runSnapshot =
|
|
184
|
+
runSnapshot = getRunScheduler().getSnapshot();
|
|
190
185
|
_context3.next = 6;
|
|
191
|
-
return
|
|
186
|
+
return tApp.stop();
|
|
192
187
|
case 6:
|
|
193
|
-
|
|
188
|
+
getLocationManager().cancelCurrentCalculation();
|
|
194
189
|
this.onPageClose();
|
|
195
|
-
|
|
196
|
-
html =
|
|
190
|
+
tApp.tRoot.$dom = $Dom.query('#tgjs-root') ? new $Dom('#tgjs-root') : new $Dom('body');
|
|
191
|
+
html = tApp.tRoot.$dom.innerHTML();
|
|
197
192
|
this.pageCache[this.lastLink] = {
|
|
198
193
|
link: this.lastLink,
|
|
199
194
|
html: html,
|
|
200
|
-
oids: _objectSpread({},
|
|
201
|
-
tmodelIdMap: _objectSpread({},
|
|
202
|
-
visibleOidMap: _objectSpread({},
|
|
203
|
-
scrollLeft:
|
|
204
|
-
scrollTop:
|
|
205
|
-
tRoot:
|
|
195
|
+
oids: _objectSpread({}, App.oids),
|
|
196
|
+
tmodelIdMap: _objectSpread({}, App.tmodelIdMap),
|
|
197
|
+
visibleOidMap: _objectSpread({}, tApp.manager.visibleOidMap),
|
|
198
|
+
scrollLeft: $Dom.getWindowScrollLeft() || 0,
|
|
199
|
+
scrollTop: $Dom.getWindowScrollTop() || 0,
|
|
200
|
+
tRoot: tApp.tRoot,
|
|
206
201
|
runSnapshot: runSnapshot
|
|
207
202
|
};
|
|
208
203
|
this.lastCachedLink = this.lastLink;
|
|
209
204
|
_context3.next = 14;
|
|
210
|
-
return
|
|
205
|
+
return tApp.reset();
|
|
211
206
|
case 14:
|
|
212
207
|
if (updateHistory) {
|
|
213
208
|
history.pushState({
|
|
@@ -217,7 +212,7 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
217
212
|
_context3.next = 17;
|
|
218
213
|
return this.openPage(link, false);
|
|
219
214
|
case 17:
|
|
220
|
-
|
|
215
|
+
getRunScheduler().schedule(0, "pagemanager-processOpenLink");
|
|
221
216
|
case 18:
|
|
222
217
|
case "end":
|
|
223
218
|
return _context3.stop();
|
|
@@ -232,17 +227,17 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
232
227
|
}, {
|
|
233
228
|
key: "updateBrowserUrl",
|
|
234
229
|
value: function updateBrowserUrl(link, updateHistory) {
|
|
235
|
-
|
|
230
|
+
tApp.tRoot.$dom = $Dom.query('#tgjs-root') ? new $Dom('#tgjs-root') : new $Dom('body');
|
|
236
231
|
this.pageCache[document.URL] = {
|
|
237
232
|
link: document.URL,
|
|
238
|
-
html:
|
|
239
|
-
oids: _objectSpread({},
|
|
240
|
-
tmodelIdMap: _objectSpread({},
|
|
241
|
-
visibleOidMap: _objectSpread({},
|
|
242
|
-
scrollLeft:
|
|
243
|
-
scrollTop:
|
|
244
|
-
tRoot:
|
|
245
|
-
runSnapshot:
|
|
233
|
+
html: tApp.tRoot.$dom.innerHTML(),
|
|
234
|
+
oids: _objectSpread({}, App.oids),
|
|
235
|
+
tmodelIdMap: _objectSpread({}, App.tmodelIdMap),
|
|
236
|
+
visibleOidMap: _objectSpread({}, tApp.manager.visibleOidMap),
|
|
237
|
+
scrollLeft: $Dom.getWindowScrollLeft() || 0,
|
|
238
|
+
scrollTop: $Dom.getWindowScrollTop() || 0,
|
|
239
|
+
tRoot: tApp.tRoot,
|
|
240
|
+
runSnapshot: getRunScheduler().getSnapshot()
|
|
246
241
|
};
|
|
247
242
|
if (updateHistory) {
|
|
248
243
|
history.pushState({
|
|
@@ -253,7 +248,7 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
253
248
|
browserUrl: link
|
|
254
249
|
}, "", link);
|
|
255
250
|
}
|
|
256
|
-
|
|
251
|
+
getRunScheduler().schedule(0, "pagemanager-processUpdateBrowserUrl");
|
|
257
252
|
}
|
|
258
253
|
}, {
|
|
259
254
|
key: "back",
|
|
@@ -267,7 +262,7 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
267
262
|
if (!link) {
|
|
268
263
|
return undefined;
|
|
269
264
|
}
|
|
270
|
-
link =
|
|
265
|
+
link = TUtil.getFullLink(link);
|
|
271
266
|
return this.pageCache[link];
|
|
272
267
|
}
|
|
273
268
|
}, {
|
|
@@ -279,4 +274,5 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
|
|
|
279
274
|
return page === null || page === void 0 || (_page$tmodelIdMap = page.tmodelIdMap) === null || _page$tmodelIdMap === void 0 ? void 0 : _page$tmodelIdMap[id];
|
|
280
275
|
}
|
|
281
276
|
}]);
|
|
282
|
-
}();
|
|
277
|
+
}();
|
|
278
|
+
export { PageManager };
|
package/build/RunScheduler.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.RunScheduler = void 0;
|
|
7
|
-
var _TUtil = require("./TUtil.js");
|
|
8
|
-
var _App = require("./App.js");
|
|
9
1
|
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
2
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
11
3
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
@@ -16,13 +8,16 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
|
|
|
16
8
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
17
9
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
18
10
|
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); }
|
|
11
|
+
import { TUtil } from "./TUtil.js";
|
|
12
|
+
import { tApp, getEvents, getManager, getLocationManager, tRoot } from "./App.js";
|
|
13
|
+
|
|
19
14
|
/**
|
|
20
15
|
* It is responsible for scheduling and managing the execution of TargetJ process cycle.
|
|
21
16
|
* It tracks execution timing and maintains statistics for each cycle.
|
|
22
17
|
*/
|
|
23
18
|
|
|
24
19
|
var FRAME_BUDGET_MS = 20;
|
|
25
|
-
var RunScheduler =
|
|
20
|
+
var RunScheduler = /*#__PURE__*/function () {
|
|
26
21
|
function RunScheduler() {
|
|
27
22
|
_classCallCheck(this, RunScheduler);
|
|
28
23
|
this.nextRuns = [];
|
|
@@ -81,7 +76,7 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
81
76
|
key: "scheduleOnlyIfEarlier",
|
|
82
77
|
value: function scheduleOnlyIfEarlier(delay, runId) {
|
|
83
78
|
var _this$runStartTime;
|
|
84
|
-
var base = this.runningFlag ? (_this$runStartTime = this.runStartTime) !== null && _this$runStartTime !== void 0 ? _this$runStartTime :
|
|
79
|
+
var base = this.runningFlag ? (_this$runStartTime = this.runStartTime) !== null && _this$runStartTime !== void 0 ? _this$runStartTime : TUtil.now() : TUtil.now();
|
|
85
80
|
var runTime = base + (delay !== null && delay !== void 0 ? delay : 0);
|
|
86
81
|
if (this.delayProcess && runTime >= this.delayProcess.runTime) {
|
|
87
82
|
return;
|
|
@@ -91,22 +86,22 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
91
86
|
}, {
|
|
92
87
|
key: "schedule",
|
|
93
88
|
value: function schedule(delay, runId) {
|
|
94
|
-
if (!
|
|
89
|
+
if (!tApp.isRunning() || this.resetting) {
|
|
95
90
|
return;
|
|
96
91
|
}
|
|
97
|
-
var effectiveDelay =
|
|
98
|
-
var insertTime =
|
|
92
|
+
var effectiveDelay = tApp.throttle === 0 ? delay !== null && delay !== void 0 ? delay : 0 : tApp.throttle;
|
|
93
|
+
var insertTime = TUtil.now();
|
|
99
94
|
this.delayRun(effectiveDelay, runId, insertTime);
|
|
100
95
|
}
|
|
101
96
|
}, {
|
|
102
97
|
key: "run",
|
|
103
98
|
value: function () {
|
|
104
99
|
var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(delay, runId) {
|
|
105
|
-
var handedOff;
|
|
100
|
+
var handedOff, _this$delayProcess;
|
|
106
101
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
107
102
|
while (1) switch (_context2.prev = _context2.next) {
|
|
108
103
|
case 0:
|
|
109
|
-
if (!(!
|
|
104
|
+
if (!(!tApp.isRunning() || this.resetting)) {
|
|
110
105
|
_context2.next = 2;
|
|
111
106
|
break;
|
|
112
107
|
}
|
|
@@ -124,53 +119,56 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
124
119
|
this.rerunId = '';
|
|
125
120
|
this.runId = runId;
|
|
126
121
|
this.runningFlag = true;
|
|
127
|
-
this.runStartTime =
|
|
122
|
+
this.runStartTime = TUtil.now();
|
|
128
123
|
handedOff = false;
|
|
129
|
-
|
|
124
|
+
if (tApp.debugLevel === 1) {
|
|
125
|
+
TUtil.log(true)("Request from: ".concat(runId, " delay: ").concat(delay, " runningStep:").concat(this.runningStep, " dom:").concat(this.domProcessing, " runs:").concat(this.nextRuns.length, " D:").concat((_this$delayProcess = this.delayProcess) === null || _this$delayProcess === void 0 ? void 0 : _this$delayProcess.delay, " events:").concat(getEvents().eventQueue.length));
|
|
126
|
+
}
|
|
127
|
+
_context2.prev = 11;
|
|
130
128
|
if (!(this.phase === 0)) {
|
|
131
|
-
_context2.next =
|
|
129
|
+
_context2.next = 18;
|
|
132
130
|
break;
|
|
133
131
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
_context2.next =
|
|
137
|
-
return
|
|
138
|
-
case 16:
|
|
139
|
-
this.phase = 1;
|
|
132
|
+
getEvents().captureEvents();
|
|
133
|
+
tApp.targetManager.applyTargetValues(tRoot());
|
|
134
|
+
_context2.next = 17;
|
|
135
|
+
return getLocationManager().calculateAll();
|
|
140
136
|
case 17:
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
this.phase = 1;
|
|
138
|
+
case 18:
|
|
139
|
+
if (!(TUtil.now() - this.runStartTime > FRAME_BUDGET_MS)) {
|
|
140
|
+
_context2.next = 22;
|
|
143
141
|
break;
|
|
144
142
|
}
|
|
145
143
|
handedOff = true;
|
|
146
144
|
this.requestNextSlice(runId);
|
|
147
145
|
return _context2.abrupt("return");
|
|
148
|
-
case
|
|
146
|
+
case 22:
|
|
149
147
|
if (this.phase === 1) {
|
|
150
|
-
this.runningStep =
|
|
148
|
+
this.runningStep = tApp.manager.analyze();
|
|
151
149
|
this.phase = 2;
|
|
152
150
|
}
|
|
153
|
-
if (!(
|
|
154
|
-
_context2.next =
|
|
151
|
+
if (!(TUtil.now() - this.runStartTime > FRAME_BUDGET_MS)) {
|
|
152
|
+
_context2.next = 27;
|
|
155
153
|
break;
|
|
156
154
|
}
|
|
157
155
|
handedOff = true;
|
|
158
156
|
this.requestNextSlice(runId);
|
|
159
157
|
return _context2.abrupt("return");
|
|
160
|
-
case
|
|
158
|
+
case 27:
|
|
161
159
|
if (this.phase === 2) {
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
getLocationManager().calculateActivated();
|
|
161
|
+
tApp.events.resetEventsOnTimeout();
|
|
164
162
|
this.phase = 3;
|
|
165
163
|
}
|
|
166
|
-
if (!(
|
|
167
|
-
_context2.next =
|
|
164
|
+
if (!(TUtil.now() - this.runStartTime > FRAME_BUDGET_MS)) {
|
|
165
|
+
_context2.next = 32;
|
|
168
166
|
break;
|
|
169
167
|
}
|
|
170
168
|
handedOff = true;
|
|
171
169
|
this.requestNextSlice(runId);
|
|
172
170
|
return _context2.abrupt("return");
|
|
173
|
-
case
|
|
171
|
+
case 32:
|
|
174
172
|
if (this.phase === 3) {
|
|
175
173
|
if (this.runningStep >= 0) {
|
|
176
174
|
if (this.domProcessing === 0) {
|
|
@@ -182,28 +180,28 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
182
180
|
}
|
|
183
181
|
this.phase = 4;
|
|
184
182
|
}
|
|
185
|
-
this.runDuration =
|
|
183
|
+
this.runDuration = TUtil.now() - this.runStartTime;
|
|
186
184
|
if (this.domProcessing === 0) {
|
|
187
185
|
this.needsRerun();
|
|
188
186
|
}
|
|
189
|
-
_context2.next =
|
|
187
|
+
_context2.next = 41;
|
|
190
188
|
break;
|
|
191
|
-
case
|
|
192
|
-
_context2.prev =
|
|
193
|
-
_context2.t0 = _context2["catch"](
|
|
189
|
+
case 37:
|
|
190
|
+
_context2.prev = 37;
|
|
191
|
+
_context2.t0 = _context2["catch"](11);
|
|
194
192
|
this.phase = 0;
|
|
195
193
|
throw _context2.t0;
|
|
196
|
-
case
|
|
197
|
-
_context2.prev =
|
|
194
|
+
case 41:
|
|
195
|
+
_context2.prev = 41;
|
|
198
196
|
if (!handedOff && this.domProcessing === 0) {
|
|
199
197
|
this.runningFlag = false;
|
|
200
198
|
}
|
|
201
|
-
return _context2.finish(
|
|
202
|
-
case
|
|
199
|
+
return _context2.finish(41);
|
|
200
|
+
case 44:
|
|
203
201
|
case "end":
|
|
204
202
|
return _context2.stop();
|
|
205
203
|
}
|
|
206
|
-
}, _callee2, this, [[
|
|
204
|
+
}, _callee2, this, [[11, 37, 41, 44]]);
|
|
207
205
|
}));
|
|
208
206
|
function run(_x, _x2) {
|
|
209
207
|
return _run.apply(this, arguments);
|
|
@@ -233,15 +231,15 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
233
231
|
var id = this.rerunId;
|
|
234
232
|
this.rerunId = '';
|
|
235
233
|
this.schedule(0, "rerun-".concat(id));
|
|
236
|
-
} else if (
|
|
237
|
-
this.schedule(0, "events-".concat(
|
|
234
|
+
} else if (getEvents().eventQueue.length > 0) {
|
|
235
|
+
this.schedule(0, "events-".concat(getEvents().eventQueue.length));
|
|
238
236
|
} else {
|
|
239
|
-
var newDelay = this.nextRuns.length > 0 ? this.nextRuns[0].delay - (
|
|
240
|
-
if (newDelay === undefined ||
|
|
241
|
-
if (
|
|
237
|
+
var newDelay = this.nextRuns.length > 0 ? this.nextRuns[0].delay - (TUtil.now() - this.nextRuns[0].insertTime) : undefined;
|
|
238
|
+
if (newDelay === undefined || getManager().lists.activeTModels.length > 0 || getManager().lists.updatingTModels.length > 0 || getManager().lists.restyle.length > 0 || getManager().lists.reasyncStyle.length > 0 || getEvents().eventQueue.length > 0 || getLocationManager().activatedList.length > 0) {
|
|
239
|
+
if (getManager().lists.updatingTModels.length > 0) {
|
|
242
240
|
this.schedule(1, "getManager-needsRerun-updatingTModels");
|
|
243
|
-
} else if (
|
|
244
|
-
var activeTModel =
|
|
241
|
+
} else if (getManager().lists.activeTModels.length > 0) {
|
|
242
|
+
var activeTModel = getManager().lists.activeTModels.find(function (tmodel) {
|
|
245
243
|
return tmodel.targetExecutionCount === 0 || tmodel.activeTargetList.filter(function (target) {
|
|
246
244
|
return !tmodel.isScheduledPending(target);
|
|
247
245
|
}).some(function (target) {
|
|
@@ -249,8 +247,8 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
249
247
|
});
|
|
250
248
|
});
|
|
251
249
|
if (activeTModel) {
|
|
252
|
-
var delay = !this.activeStartTime ||
|
|
253
|
-
this.activeStartTime =
|
|
250
|
+
var delay = !this.activeStartTime || TUtil.now() - this.activeStartTime > 15 ? 1 : 15;
|
|
251
|
+
this.activeStartTime = TUtil.now();
|
|
254
252
|
this.schedule(delay, "getManager-needsRerun-".concat(activeTModel.oid, "-").concat(activeTModel.activeTargetList));
|
|
255
253
|
}
|
|
256
254
|
}
|
|
@@ -272,7 +270,7 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
272
270
|
}).map(function (step) {
|
|
273
271
|
return Promise.resolve().then(step);
|
|
274
272
|
})).then(function () {
|
|
275
|
-
if (
|
|
273
|
+
if (getManager().lists.restyle.length) {
|
|
276
274
|
_this2.domFixStyles();
|
|
277
275
|
return;
|
|
278
276
|
}
|
|
@@ -290,7 +288,7 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
290
288
|
this.domProcessing = 2;
|
|
291
289
|
requestAnimationFrame(function () {
|
|
292
290
|
try {
|
|
293
|
-
|
|
291
|
+
getManager().fixStyles();
|
|
294
292
|
} finally {
|
|
295
293
|
_this3.domProcessing = 0;
|
|
296
294
|
_this3.needsRerun();
|
|
@@ -300,8 +298,8 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
300
298
|
}, {
|
|
301
299
|
key: "clearDelayProcess",
|
|
302
300
|
value: function clearDelayProcess() {
|
|
303
|
-
var _this$
|
|
304
|
-
if ((_this$
|
|
301
|
+
var _this$delayProcess2;
|
|
302
|
+
if ((_this$delayProcess2 = this.delayProcess) !== null && _this$delayProcess2 !== void 0 && _this$delayProcess2.timeoutId) {
|
|
305
303
|
clearTimeout(this.delayProcess.timeoutId);
|
|
306
304
|
this.delayProcess.timeoutId = undefined;
|
|
307
305
|
}
|
|
@@ -363,8 +361,8 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
363
361
|
var nextRunTime = nextRun.insertTime + nextRun.delay;
|
|
364
362
|
if (nextRunTime < this.delayProcess.runTime) {
|
|
365
363
|
clearTimeout(this.delayProcess.timeoutId);
|
|
366
|
-
var remaining = Math.max(0, this.delayProcess.runTime -
|
|
367
|
-
this.insertRun(this.delayProcess.runId,
|
|
364
|
+
var remaining = Math.max(0, this.delayProcess.runTime - TUtil.now());
|
|
365
|
+
this.insertRun(this.delayProcess.runId, TUtil.now(), remaining);
|
|
368
366
|
this.delayProcess = undefined;
|
|
369
367
|
} else {
|
|
370
368
|
return;
|
|
@@ -376,7 +374,7 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
376
374
|
var runToExecute = null;
|
|
377
375
|
while (this.nextRuns.length > 0) {
|
|
378
376
|
var _nextRun = this.nextRuns.shift();
|
|
379
|
-
var now =
|
|
377
|
+
var now = TUtil.now();
|
|
380
378
|
var newDelay = _nextRun.delay - (now - _nextRun.insertTime);
|
|
381
379
|
if (newDelay <= 0) {
|
|
382
380
|
runToExecute = _nextRun;
|
|
@@ -386,10 +384,10 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
386
384
|
}
|
|
387
385
|
}
|
|
388
386
|
if (runToExecute) {
|
|
389
|
-
this.setDelayProcess(runToExecute.runId, runToExecute.insertTime, runToExecute.delay,
|
|
387
|
+
this.setDelayProcess(runToExecute.runId, runToExecute.insertTime, runToExecute.delay, TUtil.now(), 0);
|
|
390
388
|
} else if (this.nextRuns.length > 0) {
|
|
391
389
|
var nextValidRun = this.nextRuns[0];
|
|
392
|
-
var _now =
|
|
390
|
+
var _now = TUtil.now();
|
|
393
391
|
var _newDelay = Math.max(0, nextValidRun.delay - (_now - nextValidRun.insertTime));
|
|
394
392
|
this.setDelayProcess(nextValidRun.runId, nextValidRun.insertTime, nextValidRun.delay, _now + _newDelay, _newDelay);
|
|
395
393
|
} else {
|
|
@@ -444,13 +442,13 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
444
442
|
}, {
|
|
445
443
|
key: "getSnapshot",
|
|
446
444
|
value: function getSnapshot() {
|
|
447
|
-
var now =
|
|
445
|
+
var now = TUtil.now();
|
|
448
446
|
var runs = [];
|
|
449
447
|
var addRun = function addRun(run) {
|
|
450
448
|
if (!run) {
|
|
451
449
|
return;
|
|
452
450
|
}
|
|
453
|
-
var runTime =
|
|
451
|
+
var runTime = TUtil.isDefined(run.runTime) ? run.runTime : run.insertTime + run.delay;
|
|
454
452
|
runs.push({
|
|
455
453
|
runId: run.runId,
|
|
456
454
|
delay: Math.max(0, runTime - now)
|
|
@@ -490,15 +488,16 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
|
|
|
490
488
|
}]);
|
|
491
489
|
}();
|
|
492
490
|
_defineProperty(RunScheduler, "domSteps", [function () {
|
|
493
|
-
return
|
|
491
|
+
return getManager().createDoms();
|
|
494
492
|
}, function () {
|
|
495
|
-
return
|
|
493
|
+
return getManager().reattachTModels();
|
|
496
494
|
}, function () {
|
|
497
|
-
return
|
|
495
|
+
return getManager().relocateTModels();
|
|
498
496
|
}, function () {
|
|
499
|
-
return
|
|
497
|
+
return getManager().renderTModels();
|
|
500
498
|
}, function () {
|
|
501
|
-
return
|
|
499
|
+
return getManager().fixAsyncStyles();
|
|
502
500
|
}, function () {
|
|
503
|
-
return
|
|
504
|
-
}]);
|
|
501
|
+
return getManager().deleteDoms();
|
|
502
|
+
}]);
|
|
503
|
+
export { RunScheduler };
|