targetj 1.0.74 → 1.0.76

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.
Files changed (44) hide show
  1. package/babel.config.json +17 -0
  2. package/build/$Dom.js +424 -0
  3. package/build/App.js +187 -0
  4. package/build/Bracket.js +157 -0
  5. package/build/BracketGenerator.js +86 -0
  6. package/build/Browser.js +105 -0
  7. package/build/ColorUtil.js +182 -0
  8. package/build/Dim.js +31 -0
  9. package/build/Easing.js +59 -0
  10. package/build/EventListener.js +664 -0
  11. package/build/LoadingManager.js +366 -0
  12. package/build/LocationManager.js +211 -0
  13. package/build/Moves.js +71 -0
  14. package/build/PageManager.js +113 -0
  15. package/build/SearchUtil.js +196 -0
  16. package/build/TModel.js +1000 -0
  17. package/build/TModelManager.js +605 -0
  18. package/build/TUtil.js +188 -0
  19. package/build/TargetExecutor.js +117 -0
  20. package/build/TargetManager.js +197 -0
  21. package/build/TargetUtil.js +299 -0
  22. package/build/Viewport.js +163 -0
  23. package/package.json +11 -4
  24. package/webpack.config.js +14 -1
  25. package/src/$Dom.js +0 -380
  26. package/src/App.js +0 -224
  27. package/src/Bracket.js +0 -212
  28. package/src/Browser.js +0 -122
  29. package/src/ColorUtil.js +0 -166
  30. package/src/Dim.js +0 -21
  31. package/src/Easing.js +0 -41
  32. package/src/EventListener.js +0 -570
  33. package/src/LoadingManager.js +0 -368
  34. package/src/LocationManager.js +0 -236
  35. package/src/Moves.js +0 -59
  36. package/src/PageManager.js +0 -87
  37. package/src/SearchUtil.js +0 -210
  38. package/src/TModel.js +0 -937
  39. package/src/TModelManager.js +0 -575
  40. package/src/TUtil.js +0 -162
  41. package/src/TargetExecutor.js +0 -113
  42. package/src/TargetManager.js +0 -191
  43. package/src/TargetUtil.js +0 -307
  44. package/src/Viewport.js +0 -180
@@ -0,0 +1,605 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TModelManager = void 0;
7
+ var _$Dom = require("./$Dom.js");
8
+ var _Browser = require("./Browser.js");
9
+ var _TUtil = require("./TUtil.js");
10
+ var _App = require("./App.js");
11
+ 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
+ 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; }
13
+ 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; }
14
+ 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; }
15
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
16
+ 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."); }
17
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
18
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
19
+ 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; } } }; }
20
+ 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; } }
21
+ 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; }
22
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
23
+ 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); } }
24
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
25
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
26
+ 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); }
27
+ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
28
+ function TModelManager() {
29
+ _classCallCheck(this, TModelManager);
30
+ this.init();
31
+ }
32
+ return _createClass(TModelManager, [{
33
+ key: "init",
34
+ value: function init() {
35
+ this.lists = {
36
+ visible: [],
37
+ rerender: [],
38
+ restyle: [],
39
+ reattach: [],
40
+ invisibleDom: [],
41
+ deletedTModel: [],
42
+ visibleNoDom: [],
43
+ updatingTModels: [],
44
+ updatingTargets: [],
45
+ activeTargets: []
46
+ };
47
+ this.visibleTypeMap = {};
48
+ this.visibleOidMap = {};
49
+ this.targetMethodMap = {};
50
+ this.doneTargets = [];
51
+ this.nextRuns = [];
52
+ this.runningStep = 0;
53
+ this.runningFlag = false;
54
+ this.rerunOid = '';
55
+ this.cycleStats = {
56
+ duration: 0,
57
+ count: 0,
58
+ totalDuration: 0,
59
+ average: 0
60
+ };
61
+ }
62
+ }, {
63
+ key: "resetRuns",
64
+ value: function resetRuns() {
65
+ this.nextRuns = [];
66
+ this.runningStep = 0;
67
+ this.runningFlag = false;
68
+ this.rerunOid = '';
69
+ }
70
+ }, {
71
+ key: "resetCycle",
72
+ value: function resetCycle() {
73
+ this.cycleStats.duration = 0;
74
+ this.cycleStats.count = 0;
75
+ this.cycleStats.totalDuration = 0;
76
+ this.cycleStats.average = 0;
77
+ }
78
+ }, {
79
+ key: "clear",
80
+ value: function clear() {
81
+ this.lists.visible.length = 0;
82
+ this.lists.rerender.length = 0;
83
+ this.lists.restyle.length = 0;
84
+ this.lists.reattach.length = 0;
85
+ this.lists.visibleNoDom.length = 0;
86
+ this.lists.updatingTModels.length = 0;
87
+ this.lists.updatingTargets.length = 0;
88
+ this.lists.activeTargets.length = 0;
89
+ this.visibleTypeMap = {};
90
+ this.visibleOidMap = {};
91
+ this.targetMethodMap = {};
92
+ }
93
+ }, {
94
+ key: "visibles",
95
+ value: function visibles(type) {
96
+ return this.lists.visible.filter(function (tmodel) {
97
+ return tmodel.type === type || !type;
98
+ }).map(function (tmodel) {
99
+ return tmodel.oid;
100
+ });
101
+ }
102
+ }, {
103
+ key: "findVisible",
104
+ value: function findVisible(type) {
105
+ return this.lists.visible.find(function (tmodel) {
106
+ return tmodel.type === type;
107
+ });
108
+ }
109
+ }, {
110
+ key: "findLastVisible",
111
+ value: function findLastVisible(type) {
112
+ return this.lists.visible.reverse().find(function (tmodel) {
113
+ return tmodel.type === type;
114
+ });
115
+ }
116
+ }, {
117
+ key: "analyze",
118
+ value: function analyze() {
119
+ var lastVisibleMap = _TUtil.TUtil.list2map(this.lists.visible);
120
+ this.clear();
121
+ var _iterator = _createForOfIteratorHelper(_App.tApp.locationManager.hasLocationList),
122
+ _step;
123
+ try {
124
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
125
+ var tmodel = _step.value;
126
+ var visible = tmodel.isVisible();
127
+ if (tmodel.isMarkedDeleted() && !this.lists.deletedTModel.includes(tmodel)) {
128
+ this.lists.deletedTModel = [].concat(_toConsumableArray(this.lists.deletedTModel), [tmodel], _toConsumableArray(_TUtil.TUtil.getDeepList(tmodel)));
129
+ lastVisibleMap[tmodel.oid] = null;
130
+ } else if (visible) {
131
+ lastVisibleMap[tmodel.oid] = null;
132
+ if (tmodel.hasDom() && !tmodel.canHaveDom() && !this.lists.invisibleDom.includes(tmodel)) {
133
+ this.lists.invisibleDom.push(tmodel);
134
+ }
135
+ this.lists.visible.push(tmodel);
136
+ this.needsRerender(tmodel);
137
+ this.needsRestyle(tmodel);
138
+ this.needsReattach(tmodel);
139
+ if (tmodel.updatingTargetList.length > 0) {
140
+ this.lists.updatingTModels.push(tmodel);
141
+ this.lists.updatingTargets = [].concat(_toConsumableArray(this.lists.updatingTargets), _toConsumableArray(tmodel.updatingTargetList));
142
+ }
143
+ var activeTargets = Object.keys(tmodel.activeTargetMap);
144
+ if (activeTargets.length > 0) {
145
+ this.lists.activeTargets = [].concat(_toConsumableArray(this.lists.activeTargets), ["'".concat(tmodel.oid, "'")], activeTargets);
146
+ }
147
+ if (Object.keys(tmodel.targetMethodMap).length > 0) {
148
+ this.targetMethodMap[tmodel.oid] = _objectSpread({}, tmodel.targetMethodMap);
149
+ }
150
+ this.visibleOidMap[tmodel.oid] = tmodel;
151
+ if (!this.visibleTypeMap[tmodel.type]) {
152
+ this.visibleTypeMap[tmodel.type] = [];
153
+ }
154
+ this.visibleTypeMap[tmodel.type].push(tmodel);
155
+ if (tmodel.canHaveDom() && !tmodel.hasDom() && tmodel.getDomHolder() && tmodel.getDomHolder().exists() && !this.lists.visibleNoDom.includes(tmodel)) {
156
+ this.lists.visibleNoDom.push(tmodel);
157
+ }
158
+ }
159
+ }
160
+ } catch (err) {
161
+ _iterator.e(err);
162
+ } finally {
163
+ _iterator.f();
164
+ }
165
+ var lastVisible = Object.values(lastVisibleMap).filter(function (tmodel) {
166
+ return tmodel !== null && tmodel.hasDom() && tmodel.isDomDeletable();
167
+ });
168
+ lastVisible.forEach(function (tmodel) {
169
+ _App.tApp.manager.lists.invisibleDom.push(tmodel);
170
+ });
171
+ }
172
+ }, {
173
+ key: "needsRerender",
174
+ value: function needsRerender(tmodel) {
175
+ if (tmodel.hasDom() && _TUtil.TUtil.isDefined(tmodel.getHtml()) && (tmodel.$dom.html() !== tmodel.getHtml() || tmodel.$dom.textOnly !== tmodel.isTextOnly())) {
176
+ this.lists.rerender.push(tmodel);
177
+ return true;
178
+ }
179
+ return false;
180
+ }
181
+ }, {
182
+ key: "needsRestyle",
183
+ value: function needsRestyle(tmodel) {
184
+ if (tmodel.hasDom() && tmodel.styleTargetList.length > 0) {
185
+ this.lists.restyle.push(tmodel);
186
+ return true;
187
+ }
188
+ return false;
189
+ }
190
+ }, {
191
+ key: "needsReattach",
192
+ value: function needsReattach(tmodel) {
193
+ if (tmodel.hasDom() && tmodel.hasDomHolderChanged()) {
194
+ this.lists.reattach.push(tmodel);
195
+ return true;
196
+ }
197
+ return false;
198
+ }
199
+ }, {
200
+ key: "renderTModels",
201
+ value: function renderTModels() {
202
+ var _iterator2 = _createForOfIteratorHelper(this.lists.rerender),
203
+ _step2;
204
+ try {
205
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
206
+ var tmodel = _step2.value;
207
+ tmodel.isTextOnly() ? tmodel.$dom.text(tmodel.getHtml()) : tmodel.$dom.html(tmodel.getHtml());
208
+ tmodel.setActualValueLastUpdate('html');
209
+ tmodel.domHeight = undefined;
210
+ tmodel.domWidth = undefined;
211
+ }
212
+ } catch (err) {
213
+ _iterator2.e(err);
214
+ } finally {
215
+ _iterator2.f();
216
+ }
217
+ }
218
+ }, {
219
+ key: "reattachTModels",
220
+ value: function reattachTModels() {
221
+ var _iterator3 = _createForOfIteratorHelper(this.lists.reattach),
222
+ _step3;
223
+ try {
224
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
225
+ var tmodel = _step3.value;
226
+ tmodel.$dom.detach();
227
+ tmodel.getDomHolder().appendTModel$Dom(tmodel);
228
+ }
229
+ } catch (err) {
230
+ _iterator3.e(err);
231
+ } finally {
232
+ _iterator3.f();
233
+ }
234
+ }
235
+ }, {
236
+ key: "deleteDoms",
237
+ value: function deleteDoms() {
238
+ var _iterator4 = _createForOfIteratorHelper(this.lists.invisibleDom),
239
+ _step4;
240
+ try {
241
+ var _loop = function _loop() {
242
+ var tmodel = _step4.value;
243
+ tmodel.domValues = {};
244
+ var activateTargets = [].concat(tmodel.targets['onInvisibleEvent'], tmodel.targets['onResize']);
245
+ activateTargets === null || activateTargets === void 0 || activateTargets.forEach(function (key) {
246
+ if (tmodel.targets[key] && tmodel.isTargetComplete(key)) {
247
+ tmodel.activateTarget(key);
248
+ }
249
+ });
250
+ tmodel.$dom.detach();
251
+ tmodel.$dom = null;
252
+ };
253
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
254
+ _loop();
255
+ }
256
+ } catch (err) {
257
+ _iterator4.e(err);
258
+ } finally {
259
+ _iterator4.f();
260
+ }
261
+ var _iterator5 = _createForOfIteratorHelper(this.lists.deletedTModel),
262
+ _step5;
263
+ try {
264
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
265
+ var tmodel = _step5.value;
266
+ this.removeTModel(tmodel);
267
+ }
268
+ } catch (err) {
269
+ _iterator5.e(err);
270
+ } finally {
271
+ _iterator5.f();
272
+ }
273
+ var rerun = this.lists.invisibleDom.length > 0 || this.lists.deletedTModel.length > 0;
274
+ this.lists.invisibleDom.length = 0;
275
+ this.lists.deletedTModel.length = 0;
276
+ if (rerun) {
277
+ this.scheduleRun(0, "deleteDoms");
278
+ }
279
+ }
280
+ }, {
281
+ key: "removeTModel",
282
+ value: function removeTModel(tmodel) {
283
+ tmodel.markAsDeleted();
284
+ var parent = tmodel.getParent();
285
+ if (parent && parent.hasChildren()) {
286
+ parent.removeFromUpdatingChildren(tmodel);
287
+ var childIndex = parent.val('children').indexOf(tmodel);
288
+ if (childIndex >= 0) {
289
+ parent.val('children').splice(childIndex, 1);
290
+ parent.setActualValueLastUpdate('children');
291
+ }
292
+ childIndex = parent.val('addedChildren').indexOf(tmodel);
293
+ if (childIndex >= 0) {
294
+ parent.val('addedChildren').splice(childIndex, 1);
295
+ parent.setActualValueLastUpdate('addedChildren');
296
+ }
297
+ parent.setActualValueLastUpdate('allChildren');
298
+ }
299
+ if (tmodel.$dom) {
300
+ tmodel.$dom.detach();
301
+ tmodel.$dom = null;
302
+ }
303
+ }
304
+ }, {
305
+ key: "fixStyles",
306
+ value: function fixStyles() {
307
+ var _iterator6 = _createForOfIteratorHelper(this.lists.restyle),
308
+ _step6;
309
+ try {
310
+ var _loop2 = function _loop2() {
311
+ var tmodel = _step6.value;
312
+ tmodel.styleTargetList.forEach(function (key) {
313
+ switch (key) {
314
+ case 'transform':
315
+ {
316
+ var x = Math.floor(tmodel.getX());
317
+ var y = Math.floor(tmodel.getY());
318
+ var rotate = Math.floor(tmodel.getRotate());
319
+ var scale = _TUtil.TUtil.formatNum(tmodel.getScale(), 2);
320
+ if (tmodel.domValues.x !== x || tmodel.domValues.y !== y || tmodel.domValues.rotate !== rotate || tmodel.domValues.scale !== scale) {
321
+ tmodel.$dom.transform(x, y, rotate, scale);
322
+ tmodel.domValues.y = y;
323
+ tmodel.domValues.x = x;
324
+ tmodel.domValues.rotate = rotate;
325
+ tmodel.domValues.scale = scale;
326
+ }
327
+ break;
328
+ }
329
+ case 'dim':
330
+ {
331
+ var width = Math.floor(tmodel.getWidth());
332
+ var height = Math.floor(tmodel.getHeight());
333
+ if (tmodel.$dom.width() !== width || tmodel.$dom.height() !== height) {
334
+ tmodel.$dom.width(width);
335
+ tmodel.$dom.height(height);
336
+ }
337
+ break;
338
+ }
339
+ case 'style':
340
+ {
341
+ var style = tmodel.getStyle();
342
+ if (_TUtil.TUtil.isDefined(style) && tmodel.domValues.style !== style) {
343
+ tmodel.$dom.setStyleByMap(tmodel.getStyle());
344
+ tmodel.domValues.style = style;
345
+ }
346
+ break;
347
+ }
348
+ case 'css':
349
+ {
350
+ var css = tmodel.getCss();
351
+ if (tmodel.$dom.css() !== css) {
352
+ tmodel.$dom.css(css);
353
+ }
354
+ break;
355
+ }
356
+ case 'borderRadius':
357
+ case 'padding':
358
+ case 'lineHeight':
359
+ case 'fontSize':
360
+ {
361
+ if (_TUtil.TUtil.isDefined(tmodel.val(key)) && tmodel.domValues[key] !== tmodel.val(key)) {
362
+ tmodel.$dom.style(key, _TUtil.TUtil.isNumber(tmodel.val(key)) ? "".concat(tmodel.val(key), "px") : tmodel.val(key));
363
+ tmodel.domValues[key] = tmodel.val(key);
364
+ }
365
+ break;
366
+ }
367
+ default:
368
+ if (_TUtil.TUtil.isDefined(tmodel.val(key)) && tmodel.domValues[key] !== tmodel.val(key)) {
369
+ tmodel.$dom.style(key, tmodel.val(key));
370
+ tmodel.domValues[key] = tmodel.val(key);
371
+ }
372
+ }
373
+ });
374
+ tmodel.styleTargetMap = {};
375
+ tmodel.styleTargetList.length = 0;
376
+ };
377
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
378
+ _loop2();
379
+ }
380
+ } catch (err) {
381
+ _iterator6.e(err);
382
+ } finally {
383
+ _iterator6.f();
384
+ }
385
+ }
386
+ }, {
387
+ key: "completeDoneTModels",
388
+ value: function completeDoneTModels() {
389
+ _App.tApp.manager.doneTargets.forEach(function (target) {
390
+ var tmodel = target.tmodel;
391
+ var key = target.key;
392
+ if (tmodel.isTargetDone(key)) {
393
+ tmodel.setTargetComplete(key);
394
+ tmodel.removeFromActiveTargets(tmodel);
395
+ tmodel.removeFromUpdatingTargets(tmodel);
396
+ }
397
+ });
398
+ }
399
+ }, {
400
+ key: "createDoms",
401
+ value: function createDoms() {
402
+ var contentList = [];
403
+ var needsDom = [];
404
+ this.lists.visibleNoDom.sort(function (a, b) {
405
+ if (a.hasChildren() && b.hasChildren()) {
406
+ return a.getUIDepth() < b.getUIDepth() ? -1 : 1;
407
+ } else {
408
+ return a.hasChildren() ? -1 : 1;
409
+ }
410
+ });
411
+ var _iterator7 = _createForOfIteratorHelper(this.lists.visibleNoDom),
412
+ _step7;
413
+ try {
414
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
415
+ var tmodel = _step7.value;
416
+ var $dom = void 0;
417
+ if (_$Dom.$Dom.query("#".concat(tmodel.oid))) {
418
+ $dom = new _$Dom.$Dom("#".concat(tmodel.oid));
419
+ tmodel.$dom = $dom;
420
+ } else {
421
+ needsDom.push(tmodel);
422
+ }
423
+ }
424
+ } catch (err) {
425
+ _iterator7.e(err);
426
+ } finally {
427
+ _iterator7.f();
428
+ }
429
+ var _loop3 = function _loop3() {
430
+ var tmodel = _needsDom[_i];
431
+ var x = Math.floor(tmodel.getX());
432
+ var y = Math.floor(tmodel.getY());
433
+ var rotate = Math.floor(tmodel.getRotate());
434
+ var scale = _TUtil.TUtil.formatNum(tmodel.getScale(), 2);
435
+ var width = Math.floor(tmodel.getWidth());
436
+ var height = Math.floor(tmodel.getHeight());
437
+ var zIndex = Math.floor(tmodel.getZIndex());
438
+ var opacity = tmodel.getOpacity() ? tmodel.getOpacity().toFixed(2) : 0;
439
+ var style = {
440
+ position: 'absolute',
441
+ top: 0,
442
+ left: 0,
443
+ transform: [x, y, rotate, scale],
444
+ width: "".concat(width, "px"),
445
+ height: "".concat(height, "px"),
446
+ opacity: opacity,
447
+ zIndex: zIndex
448
+ };
449
+ ['fontSize', 'borderRadius', 'padding', 'lineHeight'].forEach(function (prop) {
450
+ var value = tmodel.val(prop);
451
+ if (value) {
452
+ style[prop] = _TUtil.TUtil.isNumber(value) ? "".concat(value, "px") : value;
453
+ }
454
+ });
455
+ ['backgroundColor', 'background', 'color'].forEach(function (prop) {
456
+ var value = tmodel.val(prop);
457
+ if (value) {
458
+ style[prop] = value;
459
+ }
460
+ });
461
+ Object.assign(style, tmodel.getStyle());
462
+ var $dom = new _$Dom.$Dom();
463
+ $dom.create('div');
464
+ $dom.setSelector("#".concat(tmodel.oid));
465
+ $dom.setId(tmodel.oid);
466
+ $dom.css(tmodel.getCss());
467
+ $dom.setStyleByMap(style);
468
+ tmodel.domValues = {
469
+ x: x,
470
+ y: y,
471
+ rotate: rotate,
472
+ scale: scale,
473
+ style: style
474
+ };
475
+ tmodel.$dom = $dom;
476
+ var contentItem = contentList.find(function (item) {
477
+ return item.domHolder === tmodel.getDomHolder();
478
+ });
479
+ if (contentItem) {
480
+ contentItem.tmodels.push(tmodel);
481
+ } else {
482
+ contentList.push({
483
+ domHolder: tmodel.getDomHolder(),
484
+ tmodels: [tmodel]
485
+ });
486
+ }
487
+ };
488
+ for (var _i = 0, _needsDom = needsDom; _i < _needsDom.length; _i++) {
489
+ _loop3();
490
+ }
491
+ contentList.map(function (content) {
492
+ content.tmodels.map(function (tmodel) {
493
+ content.domHolder.appendTModel$Dom(tmodel);
494
+ });
495
+ });
496
+ if (contentList.length) {
497
+ _App.tApp.manager.scheduleRun(1, "createDom");
498
+ }
499
+ }
500
+ }, {
501
+ key: "scheduleRun",
502
+ value: function scheduleRun(delay, oid) {
503
+ if (delay < 1 && _App.tApp.throttle === 0) {
504
+ _App.tApp.manager.run(oid, delay);
505
+ } else {
506
+ var nextRun = _Browser.browser.delay(function () {
507
+ _App.tApp.manager.run(oid, delay);
508
+ }, oid, _App.tApp.throttle === 0 ? delay || 0 : _App.tApp.throttle);
509
+ var lastRun = this.nextRuns.length > 0 ? this.nextRuns[this.nextRuns.length - 1] : null;
510
+ if (nextRun && (!lastRun || nextRun.delay > lastRun.delay)) {
511
+ this.nextRuns.push(nextRun);
512
+ } else if (nextRun && lastRun && nextRun.delay <= lastRun.delay && _App.tApp.manager.runningFlag) {
513
+ _App.tApp.manager.rerunOid = oid;
514
+ }
515
+ }
516
+ }
517
+ }, {
518
+ key: "run",
519
+ value: function run(oid, delay) {
520
+ if (!_App.tApp.isRunning()) {
521
+ this.getNextRun();
522
+ return;
523
+ }
524
+ if (_App.tApp.manager.runningFlag) {
525
+ _App.tApp.manager.rerunOid = oid;
526
+ return;
527
+ }
528
+ _App.tApp.manager.runningFlag = true;
529
+ window.requestAnimationFrame(function () {
530
+ var startStep = _App.tApp.manager.runningStep;
531
+ var startTime = _Browser.browser.now();
532
+ while (_Browser.browser.now() - startTime < 25 && _App.tApp.manager.runningStep < 7 && _App.tApp.isRunning()) {
533
+ switch (_App.tApp.manager.runningStep) {
534
+ case 0:
535
+ _App.tApp.events.captureEvents();
536
+ if (_App.tApp.manager.doneTargets.length > 0) {
537
+ _App.tApp.manager.completeDoneTModels();
538
+ _App.tApp.manager.doneTargets.length = 0;
539
+ }
540
+ _App.tApp.locationManager.calculateTargets(_App.tApp.tRoot);
541
+ _App.tApp.locationManager.calculateAll();
542
+ _App.tApp.events.resetEventsOnTimeout();
543
+ break;
544
+ case 1:
545
+ _App.tApp.manager.analyze();
546
+ break;
547
+ case 2:
548
+ _App.tApp.manager.createDoms();
549
+ break;
550
+ case 3:
551
+ _App.tApp.manager.renderTModels();
552
+ _App.tApp.manager.reattachTModels();
553
+ break;
554
+ case 4:
555
+ _App.tApp.manager.fixStyles();
556
+ break;
557
+ case 5:
558
+ _App.tApp.manager.deleteDoms();
559
+ break;
560
+ case 6:
561
+ _App.tApp.loader.singleLoad();
562
+ _App.tApp.loader.groupLoad();
563
+ _App.tApp.loader.imgLoad();
564
+ break;
565
+ }
566
+ _App.tApp.manager.runningStep++;
567
+ }
568
+ var cycleDuration = _Browser.browser.now() - startTime;
569
+ _App.tApp.manager.cycleStats.duration = startStep === 0 ? cycleDuration : _App.tApp.manager.cycleStats.duration + cycleDuration;
570
+ if (_App.tApp.debugLevel > 0) {
571
+ _Browser.browser.log(_App.tApp.debugLevel > 0 && _App.tApp.manager.cycleStats.duration > 10)("it took: ".concat(_App.tApp.manager.cycleStats.duration, ", ").concat(oid));
572
+ _Browser.browser.log(_App.tApp.debugLevel > 0 && _App.tApp.manager.cycleStats.duration > 10)("count: ".concat(_App.tApp.locationManager.locationCount));
573
+ _Browser.browser.log(_App.tApp.debugLevel > 1)("request from: ".concat(oid, " delay: ").concat(delay));
574
+ }
575
+ _App.tApp.manager.runningFlag = false;
576
+ if (_App.tApp.manager.runningStep !== 7) {
577
+ _App.tApp.manager.run("rendering: ".concat(oid, " ").concat(_App.tApp.manager.runningStep));
578
+ } else {
579
+ _App.tApp.manager.cycleStats.count++;
580
+ _App.tApp.manager.cycleStats.totalDuration += _App.tApp.manager.cycleStats.duration;
581
+ _App.tApp.manager.cycleStats.average = _App.tApp.manager.cycleStats.totalDuration / _App.tApp.manager.cycleStats.count;
582
+ if (_App.tApp.manager.rerunOid) {
583
+ _App.tApp.manager.runningStep = 0;
584
+ var rerunOid = _App.tApp.manager.rerunOid;
585
+ _App.tApp.manager.rerunOid = '';
586
+ _App.tApp.manager.run(rerunOid);
587
+ } else {
588
+ _App.tApp.manager.runningStep = 0;
589
+ _App.tApp.manager.getNextRun();
590
+ }
591
+ }
592
+ });
593
+ }
594
+ }, {
595
+ key: "getNextRun",
596
+ value: function getNextRun() {
597
+ if (this.nextRuns.length > 0 && _App.tApp.isRunning()) {
598
+ var nextRun = this.nextRuns.pop();
599
+ if (nextRun) {
600
+ _App.tApp.manager.scheduleRun(nextRun.timeStamp - _Browser.browser.now(), nextRun.oid);
601
+ }
602
+ }
603
+ }
604
+ }]);
605
+ }();