targetj 1.0.125 → 1.0.128

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/README.md CHANGED
@@ -4,6 +4,8 @@ Welcome to TargetJ, a powerful JavaScript UI framework and library that you migh
4
4
 
5
5
  TargetJ distinguishes itself by introducing a novel concept known as 'targets,' which forms its core. Targets give methods and variable assignments life cycles and the autonomy to operate independently, with various callbacks to adapt to changes, mimicking the behavior of living cells. This opens a new paradigm in programming.
6
6
 
7
+ ⭐ We appreciate your star, it helps!
8
+
7
9
  ### Installation
8
10
 
9
11
  To install TargetJ, run the following command in your terminal:
package/build/$Dom.js CHANGED
@@ -199,6 +199,11 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
199
199
  this.append$Dom($dom);
200
200
  }
201
201
  }
202
+ }, {
203
+ key: "relocate",
204
+ value: function relocate(tmodel, orderIndex) {
205
+ this.element.insertBefore(tmodel.$dom.element, this.element.children[orderIndex]);
206
+ }
202
207
  }, {
203
208
  key: "appendTModel$Dom",
204
209
  value: function appendTModel$Dom(tmodel) {
@@ -248,7 +248,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
248
248
  _this2.removeFromUpdatingTargets(key);
249
249
  _this2.processNewTarget(key);
250
250
  });
251
- (0, _App.getRunScheduler)().schedule(10, 'addTargets-' + this.oid);
251
+ (0, _App.getRunScheduler)().schedule(1, 'addTargets-' + this.oid);
252
252
  }
253
253
  }, {
254
254
  key: "getTargetStepPercent",
@@ -688,7 +688,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
688
688
  delete this.targetValues[key];
689
689
  this.addToActiveTargets(key);
690
690
  this.removeFromUpdatingTargets(key);
691
- (0, _App.getRunScheduler)().schedule(10, 'deleteTargetValue-' + this.oid + "-" + key);
691
+ (0, _App.getRunScheduler)().schedule(1, 'deleteTargetValue-' + this.oid + "-" + key);
692
692
  }
693
693
  }, {
694
694
  key: "resetImperative",
@@ -730,7 +730,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
730
730
  }, {
731
731
  key: "manageChildTargetExecution",
732
732
  value: function manageChildTargetExecution(child, shouldCalculateChildTargets) {
733
- return shouldCalculateChildTargets || this.shouldCalculateChildTargets() || child.hasChildren() || child.addedChildren.count > 0 || child.targetExecutionCount === 0;
733
+ return shouldCalculateChildTargets || this.shouldCalculateChildTargets() || child.hasChildren() || child.addedChildren.length > 0 || child.targetExecutionCount === 0;
734
734
  }
735
735
  }, {
736
736
  key: "shouldCalculateChildTargets",
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.BracketGenerator = void 0;
7
7
  var _Bracket = require("./Bracket.js");
8
- var _TUtil = require("./TUtil.js");
9
8
  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
9
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
11
10
  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."); }
@@ -35,29 +34,41 @@ var BracketGenerator = exports.BracketGenerator = /*#__PURE__*/function () {
35
34
  value: function generate(page) {
36
35
  var regenerate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
37
36
  var brackets = BracketGenerator.bracketMap[page.oid];
38
- if (!brackets || brackets.allChildren !== page.allChildren || regenerate) {
39
- BracketGenerator.bracketMap[page.oid] = {
40
- brackets: BracketGenerator.buildTreeBottomUp(page, page.getChildren()),
41
- updateCount: 0,
42
- allChildren: page.allChildren
43
- };
44
- } else if (page.lastChildrenUpdate.deletions.length > 0) {
45
- BracketGenerator.updateTreeOnDeletions(page.lastChildrenUpdate.deletions);
46
- } else if (page.lastChildrenUpdate.additions.length > 0) {
47
- BracketGenerator.updateTreeOnAdditions(page, page.lastChildrenUpdate.additions);
37
+ if (!brackets || regenerate) {
38
+ BracketGenerator.bracketMap[page.oid] = BracketGenerator.buildTreeBottomUp(page, page.getChildren());
39
+ } else {
40
+ if (page.lastChildrenUpdate.deletions.length > 0) {
41
+ BracketGenerator.updateTreeOnDeletions(page, page.lastChildrenUpdate.deletions);
42
+ BracketGenerator.reindexTree(page);
43
+ }
44
+ if (page.lastChildrenUpdate.additions.length > 0) {
45
+ BracketGenerator.updateTreeOnAdditions(page, page.lastChildrenUpdate.additions);
46
+ }
47
+ if (page.lastChildrenUpdate.deletions.length > 0 || page.lastChildrenUpdate.additions.length > 0) {
48
+ BracketGenerator.reindexTree(page);
49
+ }
48
50
  }
49
51
  page.lastChildrenUpdate.additions.length = 0;
50
52
  page.lastChildrenUpdate.deletions.length = 0;
51
- return BracketGenerator.bracketMap[page.oid].brackets;
53
+ return BracketGenerator.bracketMap[page.oid];
52
54
  }
53
55
  }, {
54
56
  key: "updateTreeOnDeletions",
55
- value: function updateTreeOnDeletions(deletions) {
57
+ value: function updateTreeOnDeletions(page, deletions) {
56
58
  function deleteChildRecursively(parent, child) {
57
- if (parent) {
58
- var index = parent.allChildren.indexOf(child);
59
+ if (!parent) {
60
+ return;
61
+ }
62
+ if (child instanceof _Bracket.Bracket && child.parent === child.realParent) {
63
+ var topBrackets = BracketGenerator.bracketMap[page.oid];
64
+ var index = topBrackets.indexOf(child);
59
65
  if (index >= 0) {
60
- parent.allChildren.splice(index, 1);
66
+ topBrackets.splice(index, 1);
67
+ }
68
+ } else {
69
+ var _index = parent.allChildren.indexOf(child);
70
+ if (_index >= 0) {
71
+ parent.allChildren.splice(_index, 1);
61
72
  if (parent.allChildren.length === 0) {
62
73
  deleteChildRecursively(parent.parent, parent);
63
74
  }
@@ -68,169 +79,195 @@ var BracketGenerator = exports.BracketGenerator = /*#__PURE__*/function () {
68
79
  return deleteChildRecursively(child.bracket, child);
69
80
  });
70
81
  }
82
+ }, {
83
+ key: "reindexTree",
84
+ value: function reindexTree(page) {
85
+ var topBrackets = BracketGenerator.bracketMap[page.oid];
86
+ function reindexBracket(bracket, currentIndex) {
87
+ if (bracket.allChildren.length === 0) {
88
+ // Empty bracket; startIndex and endIndex remain as is
89
+ return currentIndex;
90
+ }
91
+ var containsBrackets = bracket.allChildren[0] instanceof _Bracket.Bracket;
92
+ if (containsBrackets) {
93
+ bracket.startIndex = currentIndex;
94
+ var _iterator = _createForOfIteratorHelper(bracket.allChildren),
95
+ _step;
96
+ try {
97
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
98
+ var child = _step.value;
99
+ currentIndex = reindexBracket(child, currentIndex);
100
+ }
101
+ } catch (err) {
102
+ _iterator.e(err);
103
+ } finally {
104
+ _iterator.f();
105
+ }
106
+ bracket.endIndex = currentIndex;
107
+ } else {
108
+ bracket.startIndex = currentIndex;
109
+ currentIndex += bracket.allChildren.length;
110
+ bracket.endIndex = currentIndex;
111
+ }
112
+ return currentIndex;
113
+ }
114
+ var currentIndex = 0;
115
+ var _iterator2 = _createForOfIteratorHelper(topBrackets),
116
+ _step2;
117
+ try {
118
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
119
+ var topBracket = _step2.value;
120
+ currentIndex = reindexBracket(topBracket, currentIndex);
121
+ }
122
+ } catch (err) {
123
+ _iterator2.e(err);
124
+ } finally {
125
+ _iterator2.f();
126
+ }
127
+ }
71
128
  }, {
72
129
  key: "updateTreeOnAdditions",
73
- value: function updateTreeOnAdditions(page) {
74
- var additions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
75
- var list = page.getChildren();
76
- var affectedIndices = new Set();
130
+ value: function updateTreeOnAdditions(page, additions) {
77
131
  var bracketSize = page.getBracketThreshold();
78
132
  additions.forEach(function (_ref) {
79
133
  var index = _ref.index,
80
- segment = _ref.segment;
81
- segment.forEach(function (_, i) {
82
- return affectedIndices.add(index + i);
83
- }); // eslint-disable-line no-unused-vars
84
- });
85
- var sortedIndices = Array.from(affectedIndices).sort(function (a, b) {
86
- return a - b;
87
- });
88
- var start = null;
89
- var end = null;
90
- sortedIndices.forEach(function (index) {
91
- var bracketStart = Math.floor(index / bracketSize) * bracketSize;
92
- var bracketEnd = Math.min(list.length, bracketStart + bracketSize);
93
- if (start === null) {
94
- start = bracketStart;
95
- end = bracketEnd;
96
- } else if (bracketStart <= end + 1) {
97
- end = Math.max(end, bracketEnd);
134
+ child = _ref.child;
135
+ var targetBracket = BracketGenerator.findOrCreateBracket(page, index);
136
+ if (targetBracket.allChildren.length) {
137
+ var newIndex = index - targetBracket.startIndex;
138
+ targetBracket.allChildren.splice(newIndex, 0, child);
98
139
  } else {
99
- BracketGenerator.updateSegmentInTree(page, list, start, end);
100
- start = bracketStart;
101
- end = bracketEnd;
140
+ targetBracket.allChildren.push(child);
141
+ }
142
+ child.bracket = targetBracket;
143
+ var bracket = targetBracket;
144
+ while (bracket instanceof _Bracket.Bracket) {
145
+ bracket.startIndex = Math.min(bracket.startIndex, index);
146
+ bracket.endIndex = Math.max(bracket.endIndex, index + 1);
147
+ bracket = bracket.getParent();
148
+ }
149
+ if (targetBracket.allChildren.length > bracketSize) {
150
+ BracketGenerator.splitBracket(page, targetBracket);
102
151
  }
103
152
  });
104
- if (start !== null && end !== null) {
105
- BracketGenerator.updateSegmentInTree(page, list, start, end);
106
- }
107
153
  }
108
154
  }, {
109
- key: "updateSegmentInTree",
110
- value: function updateSegmentInTree(page, list, start, end) {
111
- var _currentLevel;
112
- var topBrackets = BracketGenerator.bracketMap[page.oid].brackets;
113
- var updatedSegment = BracketGenerator.buildTreeBottomUp(page, list.slice(start, end));
155
+ key: "splitBracket",
156
+ value: function splitBracket(page, bracket) {
157
+ var list = bracket.allChildren;
114
158
  var bracketSize = page.getBracketThreshold();
115
- var currentLevel = topBrackets;
116
- var segmentParent = undefined;
117
- while (true) {
118
- var nextLevel = null;
119
- var _iterator = _createForOfIteratorHelper(currentLevel),
120
- _step;
121
- try {
122
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
123
- var bracket = _step.value;
124
- if (!(bracket.getFirstChild() instanceof _Bracket.Bracket)) {
125
- break;
126
- }
127
- var startIndex = bracket.startIndex;
128
- var endIndex = Math.ceil(bracket.endIndex / bracketSize) * bracketSize;
129
- if (startIndex <= start && endIndex >= end) {
130
- nextLevel = bracket.getChildren();
131
- segmentParent = bracket;
132
- break;
159
+ var chunks = [];
160
+ var startIndex = bracket.startIndex;
161
+ for (var i = 0; i < list.length; i += bracketSize) {
162
+ var chunk = list.slice(i, i + bracketSize);
163
+ var endIndex = startIndex + chunk.length;
164
+ var newBracket = BracketGenerator.createBracket(page, startIndex, endIndex, chunk);
165
+ newBracket.parent = bracket.parent;
166
+ startIndex = newBracket.endIndex;
167
+ chunks.push(newBracket);
168
+ }
169
+ if (bracket.parent !== bracket.realParent) {
170
+ var index = bracket.parent.allChildren.indexOf(bracket);
171
+ if (index >= 0) {
172
+ var _bracket$parent$allCh;
173
+ (_bracket$parent$allCh = bracket.parent.allChildren).splice.apply(_bracket$parent$allCh, [index, 1].concat(chunks));
174
+ }
175
+ if (bracket.parent.allChildren.length >= bracketSize) {
176
+ var rebuiltChildren = BracketGenerator.buildTreeBottomUp(page, bracket.parent.allChildren);
177
+ bracket.parent.allChildren = rebuiltChildren;
178
+
179
+ // Update grandparent relationships
180
+ if (bracket.parent.parent) {
181
+ var parentIndex = bracket.parent.parent.allChildren.indexOf(bracket.parent);
182
+ if (parentIndex >= 0) {
183
+ var _bracket$parent$paren;
184
+ (_bracket$parent$paren = bracket.parent.parent.allChildren).splice.apply(_bracket$parent$paren, [parentIndex, 1].concat(_toConsumableArray(rebuiltChildren)));
133
185
  }
134
186
  }
135
- } catch (err) {
136
- _iterator.e(err);
137
- } finally {
138
- _iterator.f();
139
187
  }
140
- if (!nextLevel) {
141
- break;
188
+ } else {
189
+ var topBrackets = BracketGenerator.bracketMap[page.oid];
190
+ var _index2 = topBrackets.indexOf(bracket);
191
+ if (_index2 >= 0) {
192
+ topBrackets.splice.apply(topBrackets, [_index2, 1].concat(chunks));
193
+ }
194
+ if (topBrackets.length > page.getBracketThreshold()) {
195
+ BracketGenerator.bracketMap[page.oid] = BracketGenerator.buildTreeBottomUp(page, topBrackets);
142
196
  }
143
- currentLevel = nextLevel;
144
- }
145
- var mergeIndex = 0;
146
- while (mergeIndex < currentLevel.length && currentLevel[mergeIndex].endIndex <= start) {
147
- mergeIndex++;
148
- }
149
- var replaceCount = 0;
150
- while (mergeIndex + replaceCount < currentLevel.length && currentLevel[mergeIndex + replaceCount].startIndex <= end) {
151
- replaceCount++;
152
197
  }
153
- var indexOffset = currentLevel.length > mergeIndex ? currentLevel[mergeIndex].startIndex : currentLevel.length > 0 ? currentLevel[currentLevel.length - 1].endIndex : 0;
154
- (_currentLevel = currentLevel).splice.apply(_currentLevel, [mergeIndex, replaceCount].concat(_toConsumableArray(updatedSegment)));
155
- if (segmentParent) {
156
- var _iterator2 = _createForOfIteratorHelper(updatedSegment),
157
- _step2;
158
- try {
159
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
160
- var _bracket = _step2.value;
161
- _bracket.parent = segmentParent;
198
+ }
199
+ }, {
200
+ key: "findOrCreateBracket",
201
+ value: function findOrCreateBracket(page, index) {
202
+ var brackets = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : BracketGenerator.bracketMap[page.oid];
203
+ var _iterator3 = _createForOfIteratorHelper(brackets),
204
+ _step3;
205
+ try {
206
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
207
+ var bracket = _step3.value;
208
+ if (bracket.startIndex <= index && bracket.endIndex >= index) {
209
+ if (bracket.getFirstChild() instanceof _Bracket.Bracket) {
210
+ return BracketGenerator.findOrCreateBracket(page, index, bracket.allChildren);
211
+ }
212
+ return bracket;
162
213
  }
163
- } catch (err) {
164
- _iterator2.e(err);
165
- } finally {
166
- _iterator2.f();
167
214
  }
215
+ } catch (err) {
216
+ _iterator3.e(err);
217
+ } finally {
218
+ _iterator3.f();
168
219
  }
169
- BracketGenerator.reindexSegment(updatedSegment, indexOffset);
170
- BracketGenerator.bracketMap[page.oid].updateCount++;
171
- if (currentLevel.length > bracketSize) {
172
- BracketGenerator.bracketMap[page.oid].brackets = BracketGenerator.buildTreeBottomUp(page, currentLevel);
220
+ var newBracket = BracketGenerator.createBracket(page, index, index);
221
+ brackets.push(newBracket);
222
+ if (brackets.length > page.getBracketThreshold()) {
223
+ var topBrackets = BracketGenerator.buildTreeBottomUp(page, brackets);
224
+ BracketGenerator.bracketMap[page.oid].brackets = topBrackets;
173
225
  }
226
+ return newBracket;
174
227
  }
175
228
  }, {
176
229
  key: "buildTreeBottomUp",
177
230
  value: function buildTreeBottomUp(page, list) {
178
231
  var length = list.length;
179
- var bracketSize = page.getBracketThreshold() - 1;
232
+ var bracketSize = page.getBracketThreshold();
180
233
  var brackets = [];
181
- var from = 0;
182
- for (var i = 0; i < length; i++) {
183
- var size = i - from;
184
- if (size === bracketSize || i === length - 1) {
185
- brackets.push(BracketGenerator.createBracket(page, list, from, i + 1));
186
- from = i + 1;
234
+ var _loop = function _loop() {
235
+ var chunk = list.slice(i, i + bracketSize);
236
+ var containsBrackets = chunk[0] instanceof _Bracket.Bracket;
237
+ var startIndex = containsBrackets ? chunk[0].startIndex : i;
238
+ var endIndex = containsBrackets ? chunk[chunk.length - 1].endIndex : i + chunk.length;
239
+ var bracket = BracketGenerator.createBracket(page, startIndex, endIndex, chunk);
240
+ if (containsBrackets) {
241
+ chunk.forEach(function (child) {
242
+ child.parent = bracket;
243
+ });
187
244
  }
245
+ brackets.push(bracket);
246
+ };
247
+ for (var i = 0; i < length; i += bracketSize) {
248
+ _loop();
188
249
  }
189
250
  return brackets.length > bracketSize ? BracketGenerator.buildTreeBottomUp(page, brackets) : brackets;
190
251
  }
191
252
  }, {
192
253
  key: "createBracket",
193
- value: function createBracket(page, list, startIndex, endIndex) {
254
+ value: function createBracket(page, startIndex, endIndex, list) {
194
255
  var bracket = new _Bracket.Bracket(page);
195
- bracket.allChildren = list.slice(startIndex, endIndex);
196
- bracket.startIndex = bracket.allChildren[0] instanceof _Bracket.Bracket ? bracket.allChildren[0].startIndex : startIndex;
197
- bracket.endIndex = bracket.allChildren[bracket.allChildren.length - 1] instanceof _Bracket.Bracket ? bracket.allChildren[bracket.allChildren.length - 1].endIndex : endIndex;
198
- bracket.allChildren.forEach(function (t) {
199
- if (t instanceof _Bracket.Bracket) {
200
- t.realParent = page;
201
- t.parent = bracket;
256
+ bracket.realParent = page;
257
+ bracket.allChildren = list || bracket.allChildren;
258
+ bracket.startIndex = startIndex;
259
+ bracket.endIndex = endIndex;
260
+ bracket.allChildren.forEach(function (child) {
261
+ if (child instanceof _Bracket.Bracket) {
262
+ child.realParent = page;
263
+ child.parent = bracket;
202
264
  } else {
203
- t.bracket = bracket;
265
+ child.bracket = bracket;
204
266
  }
205
267
  });
206
- bracket.realParent = page;
207
268
  BracketGenerator.all[bracket.oid] = bracket;
208
269
  return bracket;
209
270
  }
210
- }, {
211
- key: "reindexSegment",
212
- value: function reindexSegment(segment, indexOffset) {
213
- var queue = segment.slice(0); // Start with the root node in the queue
214
- var last = queue[queue.length - 1];
215
- while (queue.length > 0) {
216
- var bracket = queue.shift(); // Dequeue the first node
217
-
218
- bracket.startIndex += indexOffset;
219
- bracket.endIndex += indexOffset;
220
- if (bracket instanceof _Bracket.Bracket) {
221
- bracket.getChildren().forEach(function (child) {
222
- if (_TUtil.TUtil.isDefined(child.startIndex) && _TUtil.TUtil.isDefined(child.endIndex)) {
223
- queue.push(child);
224
- }
225
- });
226
- }
227
- }
228
- var parent = last.getParent();
229
- while (parent) {
230
- parent.endIndex = Math.max(parent.endIndex, last.endIndex);
231
- parent = parent.getParent();
232
- }
233
- }
234
271
  }]);
235
272
  }();
236
273
  _defineProperty(BracketGenerator, "bracketMap", {});
@@ -311,26 +311,32 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
311
311
  }, {
312
312
  key: "resetEventsOnTimeout",
313
313
  value: function resetEventsOnTimeout() {
314
- if (this.touchTimeStamp > 0 && this.touchCount === 0 && (this.currentTouch.deltaY || this.currentTouch.deltaX || this.currentTouch.pinchDelta)) {
315
- var diff = _TUtil.TUtil.now() - this.touchTimeStamp;
316
- (0, _App.getRunScheduler)().schedule(10, "scroll decay ");
314
+ if (this.currentTouch.deltaY || this.currentTouch.deltaX || this.currentTouch.pinchDelta) {
315
+ var diff = this.touchTimeStamp - _TUtil.TUtil.now();
317
316
  if (diff > 100) {
318
- this.currentTouch.deltaY *= 0.9;
319
- this.currentTouch.deltaX *= 0.9;
320
- this.currentTouch.pinchDelta *= 0.9;
321
- if (Math.abs(this.currentTouch.deltaY) < 1) {
317
+ this.currentTouch.deltaY *= 0.95;
318
+ this.currentTouch.deltaX *= 0.95;
319
+ this.currentTouch.pinchDelta *= 0.95;
320
+ if (Math.abs(this.currentTouch.deltaY) < 0.1) {
322
321
  this.currentTouch.deltaY = 0;
323
322
  }
324
- if (Math.abs(this.currentTouch.deltaX) < 1) {
323
+ if (Math.abs(this.currentTouch.deltaX) < 0.1) {
325
324
  this.currentTouch.deltaX = 0;
326
325
  }
327
- if (Math.abs(this.currentTouch.pinchDelta) < 1) {
326
+ if (Math.abs(this.currentTouch.pinchDelta) < 0.1) {
328
327
  this.currentTouch.pinchDelta = 0;
329
328
  }
330
329
  if (this.currentTouch.deltaX === 0 && this.currentTouch.deltaY === 0 && this.currentTouch.pinchDelta === 0) {
331
330
  this.touchTimeStamp = 0;
332
331
  }
333
332
  }
333
+ if (diff <= 0 || this.touchTimeStamp === 0) {
334
+ this.currentTouch.deltaY = 0;
335
+ this.currentTouch.deltaX = 0;
336
+ this.currentTouch.pinchDelta = 0;
337
+ this.touchTimeStamp = 0;
338
+ }
339
+ (0, _App.getRunScheduler)().schedule(10, "scroll decay");
334
340
  }
335
341
  }
336
342
  }, {
@@ -475,7 +481,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
475
481
  event.preventDefault();
476
482
  }
477
483
  if (this.touchCount > 0) {
478
- this.touchTimeStamp = Math.max(now, this.touchTimeStamp);
484
+ this.touchTimeStamp = now + 10;
479
485
  this.move(event);
480
486
  event.stopPropagation();
481
487
  } else if (this.isCurrentSource('wheel')) {
@@ -516,7 +522,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
516
522
  if (this.preventDefault(tmodel, eventName)) {
517
523
  event.preventDefault();
518
524
  }
519
- this.touchTimeStamp = Math.max(now, this.touchTimeStamp);
525
+ this.touchTimeStamp = now + 500;
520
526
  this.wheel(event);
521
527
  break;
522
528
  case 'key':
@@ -853,23 +859,29 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
853
859
  if (this.touchCount <= 1 && this.start0) {
854
860
  var deltaX = 0,
855
861
  deltaY = 0,
856
- period = 1;
862
+ period = 0,
863
+ startPeriod = 0;
857
864
  if (_TUtil.TUtil.isDefined(this.end0)) {
858
865
  deltaX = this.start0.originalX - this.end0.x;
859
866
  deltaY = this.start0.originalY - this.end0.y;
860
- period = this.end0.timeStamp - this.start0.timeStamp;
867
+ startPeriod = _TUtil.TUtil.now() - this.start0.timeStamp;
868
+ period = startPeriod < 250 ? _TUtil.TUtil.now() - this.start0.timeStamp : 0;
861
869
  }
862
870
  var momentum;
863
- if (this.currentTouch.orientation === "horizontal" && Math.abs(deltaX) > 0) {
871
+ if (this.currentTouch.orientation === "horizontal" && Math.abs(deltaX) > 0 && period > 0) {
864
872
  momentum = _TUtil.TUtil.momentum(0, deltaX, period);
865
- this.currentTouch.deltaX = momentum.distance;
866
- this.currentTouch.manualMomentumFlag = true;
867
- this.touchTimeStamp = _TUtil.TUtil.now() + momentum.duration;
868
- } else if (this.currentTouch.orientation === "vertical" && Math.abs(deltaY) > 0) {
873
+ this.touchTimeStamp = this.end0.timeStamp + momentum.duration;
874
+ if (this.touchTimeStamp - _TUtil.TUtil.now() > 0) {
875
+ this.currentTouch.deltaX = momentum.distance;
876
+ this.currentTouch.manualMomentumFlag = true;
877
+ }
878
+ } else if (this.currentTouch.orientation === "vertical" && Math.abs(deltaY) > 0 && period > 0) {
869
879
  momentum = _TUtil.TUtil.momentum(0, deltaY, period);
870
- this.currentTouch.deltaY = momentum.distance;
871
- this.currentTouch.manualMomentumFlag = true;
872
- this.touchTimeStamp = _TUtil.TUtil.now() + momentum.duration;
880
+ this.touchTimeStamp = this.end0.timeStamp + momentum.duration;
881
+ if (this.touchTimeStamp - _TUtil.TUtil.now() > 0) {
882
+ this.currentTouch.deltaY = momentum.distance;
883
+ this.currentTouch.manualMomentumFlag = true;
884
+ }
873
885
  }
874
886
  }
875
887
  }
@@ -103,8 +103,12 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
103
103
  }, {
104
104
  key: "getChildren",
105
105
  value: function getChildren(container) {
106
+ container.getChildren();
106
107
  if (container.shouldBeBracketed()) {
107
108
  return _BracketGenerator.BracketGenerator.generate(container);
109
+ } else {
110
+ container.lastChildrenUpdate.additions.length = 0;
111
+ container.lastChildrenUpdate.deletions.length = 0;
108
112
  }
109
113
  if (_BracketGenerator.BracketGenerator.bracketMap[container.oid]) {
110
114
  delete _BracketGenerator.BracketGenerator.bracketMap[container.oid];
@@ -128,11 +128,15 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
128
128
  this.runningFlag = false;
129
129
  if (this.rerunId) {
130
130
  this.schedule(1, "rerun-".concat(this.rerunId));
131
- } else if (!this.delayProcess || this.delayProcess.delay > 15) {
132
- if ((0, _App.getEvents)().eventQueue.length > 0) {
133
- this.schedule(15, "events-".concat((0, _App.getEvents)().eventQueue.length));
134
- } else if (_TargetExecutor.TargetExecutor.needsRerun) {
135
- this.schedule(15, 'targetExecutor-needsRerun');
131
+ } else {
132
+ var newDelay = this.nextRuns.length > 0 ? this.nextRuns[0].delay - (_TUtil.TUtil.now() - this.nextRuns[0].insertTime) : 15;
133
+ if (newDelay >= 15) {
134
+ if ((0, _App.getEvents)().eventQueue.length > 0) {
135
+ this.schedule(15, "events-".concat((0, _App.getEvents)().eventQueue.length));
136
+ } else if (_TargetExecutor.TargetExecutor.needsRerun) {
137
+ _TargetExecutor.TargetExecutor.needsRerun = false;
138
+ this.schedule(15, 'targetExecutor-needsRerun');
139
+ }
136
140
  }
137
141
  }
138
142
  }
@@ -146,7 +150,7 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
146
150
  value: function domOperations(runningStep) {
147
151
  var _this = this;
148
152
  this.domProcessing = 1;
149
- if (runningStep === 5) {
153
+ if (runningStep === 10) {
150
154
  this.domFixStyles();
151
155
  } else {
152
156
  Promise.all(RunScheduler.steps.filter(function (_, index) {
@@ -215,7 +219,7 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
215
219
  }, {
216
220
  key: "delayRun",
217
221
  value: function delayRun(delay, runId) {
218
- var insertTime = _TUtil.TUtil.now();
222
+ var insertTime = this.runStartTime;
219
223
  var runTime = insertTime + delay;
220
224
  if (!this.delayProcess) {
221
225
  this.setDelayProcess(runId, insertTime, runTime, delay);
@@ -257,6 +261,8 @@ _defineProperty(RunScheduler, "steps", [function () {
257
261
  return (0, _App.getManager)().createDoms();
258
262
  }, function () {
259
263
  return (0, _App.getManager)().reattachTModels();
264
+ }, function () {
265
+ return (0, _App.getManager)().relocateTModels();
260
266
  }, function () {
261
267
  return (0, _App.getManager)().renderTModels();
262
268
  }, function () {
package/build/TModel.js CHANGED
@@ -10,14 +10,7 @@ var _App = require("./App.js");
10
10
  var _Viewport = require("./Viewport.js");
11
11
  var _TUtil = require("./TUtil.js");
12
12
  var _SearchUtil = require("./SearchUtil.js");
13
- var _TModelUtil = require("./TModelUtil.js");
14
13
  var _TargetUtil = require("./TargetUtil.js");
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 _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 _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
19
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
20
- 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; }
21
14
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
22
15
  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
16
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -39,10 +32,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
39
32
  var _this;
40
33
  _classCallCheck(this, TModel);
41
34
  _this = _callSuper(this, TModel, [type, targets]);
42
- _this.addedChildren = {
43
- count: 0,
44
- list: []
45
- };
35
+ _this.addedChildren = [];
46
36
  _this.deletedChildren = [];
47
37
  _this.lastChildrenUpdate = {
48
38
  additions: [],
@@ -119,9 +109,12 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
119
109
  }, {
120
110
  key: "addChild",
121
111
  value: function addChild(child) {
122
- var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.addedChildren.count + this.allChildren.length;
123
- this.addedChildren.count++;
124
- _TModelUtil.TModelUtil.addItem(this.addedChildren.list, child, index);
112
+ var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.addedChildren.length + this.allChildren.length;
113
+ this.addedChildren.push({
114
+ index: index,
115
+ originalIndex: index,
116
+ child: child
117
+ });
125
118
  (0, _App.getRunScheduler)().schedule(1, 'addChild-' + this.oid + "-" + child.oid);
126
119
  return this;
127
120
  }
@@ -136,23 +129,19 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
136
129
  }
137
130
  }, {
138
131
  key: "moveChild",
139
- value: function moveChild(child, newIndex) {
140
- var _this$addedChildren$l;
132
+ value: function moveChild(child, index) {
141
133
  var currentIndex = this.allChildren.indexOf(child);
142
- if (currentIndex === newIndex) {
143
- return this;
144
- }
145
134
  this.deletedChildren.push(child);
146
- this.addedChildren.count++;
147
- var segment = [{
148
- index: newIndex,
149
- segment: [child]
150
- }];
151
- (_this$addedChildren$l = this.addedChildren.list).push.apply(_this$addedChildren$l, segment);
152
- this.addedChildren.list.sort(function (a, b) {
153
- return a.index - b.index;
135
+ this.addedChildren.push({
136
+ index: currentIndex < index ? index - 1 : index,
137
+ originalIndex: index,
138
+ child: child
154
139
  });
155
- (0, _App.getRunScheduler)().schedule(1, 'removeChild-' + this.oid + "-" + child.oid);
140
+ if (child.hasDom() && child.requiresDomRelocation()) {
141
+ child.domOrderIndex = index;
142
+ child.activate();
143
+ }
144
+ (0, _App.getRunScheduler)().schedule(1, 'moveChild-' + this.oid + "-" + child.oid);
156
145
  return this;
157
146
  }
158
147
  }, {
@@ -169,27 +158,29 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
169
158
  });
170
159
  this.deletedChildren.length = 0;
171
160
  }
172
- if (this.addedChildren.count > 0) {
173
- this.addedChildren.list.forEach(function (_ref) {
161
+ if (this.addedChildren.length > 0) {
162
+ this.addedChildren.sort(function (a, b) {
163
+ return a.index - b.index;
164
+ });
165
+ this.addedChildren.forEach(function (_ref) {
174
166
  var index = _ref.index,
175
- segment = _ref.segment;
176
- segment.forEach(function (t) {
177
- t.parent = _this2;
178
- if (!_TUtil.TUtil.isDefined(t.val('canDeleteDom')) && _this2.val('canDeleteDom') === false) {
179
- t.val('canDeleteDom', false);
180
- }
181
- });
167
+ originalIndex = _ref.originalIndex,
168
+ child = _ref.child;
169
+ child.parent = _this2;
170
+ if (!_TUtil.TUtil.isDefined(child.val('canDeleteDom')) && _this2.val('canDeleteDom') === false) {
171
+ child.val('canDeleteDom', false);
172
+ }
182
173
  if (index >= _this2.allChildren.length) {
183
- var _this2$allChildren;
184
- (_this2$allChildren = _this2.allChildren).push.apply(_this2$allChildren, _toConsumableArray(segment));
174
+ _this2.allChildren.push(child);
185
175
  } else {
186
- var _this2$allChildren2;
187
- (_this2$allChildren2 = _this2.allChildren).splice.apply(_this2$allChildren2, [index, 0].concat(_toConsumableArray(segment)));
176
+ _this2.allChildren.splice(index, 0, child);
188
177
  }
178
+ _this2.lastChildrenUpdate.additions.push({
179
+ index: originalIndex,
180
+ child: child
181
+ });
189
182
  });
190
- this.lastChildrenUpdate.additions = this.lastChildrenUpdate.additions.concat(this.addedChildren.list);
191
- this.addedChildren.list.length = 0;
192
- this.addedChildren.count = 0;
183
+ this.addedChildren.length = 0;
193
184
  }
194
185
  return this.allChildren;
195
186
  }
@@ -217,60 +208,60 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
217
208
  if (_TUtil.TUtil.isDefined(this.val('calculateChildren'))) {
218
209
  return this.val('calculateChildren');
219
210
  }
220
- var result = this.isIncluded() && (this.isVisible() || this.currentStatus === 'new') && (this.hasChildren() || this.addedChildren.count > 0 || this.getContentHeight() > 0);
211
+ var result = this.isIncluded() && (this.isVisible() || this.currentStatus === 'new') && (this.hasChildren() || this.addedChildren.length > 0 || this.getContentHeight() > 0);
221
212
  this.currentStatus = undefined;
222
213
  return result;
223
214
  }
224
215
  }, {
225
216
  key: "getFirstChild",
226
217
  value: function getFirstChild() {
227
- return this.hasChildren() ? this.getChildren()[0] : undefined;
218
+ return this.allChildren[0];
228
219
  }
229
220
  }, {
230
221
  key: "hasChildren",
231
222
  value: function hasChildren() {
232
- return this.getChildren().length > 0;
223
+ return this.allChildren.length > 0;
233
224
  }
234
225
  }, {
235
226
  key: "findChildren",
236
227
  value: function findChildren(type) {
237
- return this.getChildren().filter(function (child) {
228
+ return this.allChildren.filter(function (child) {
238
229
  return child.type === type;
239
230
  });
240
231
  }
241
232
  }, {
242
233
  key: "getLastChild",
243
234
  value: function getLastChild() {
244
- return this.hasChildren() ? this.getChildren()[this.getChildren().length - 1] : undefined;
235
+ return this.allChildren[this.allChildren.length - 1];
245
236
  }
246
237
  }, {
247
238
  key: "getChild",
248
239
  value: function getChild(index) {
249
- return this.hasChildren() ? this.getChildren()[index] : undefined;
240
+ return this.allChildren[index];
250
241
  }
251
242
  }, {
252
243
  key: "getChildIndex",
253
244
  value: function getChildIndex(child) {
254
- return this.getChildren().indexOf(child);
245
+ return this.allChildren.indexOf(child);
255
246
  }
256
247
  }, {
257
248
  key: "getChildrenOids",
258
249
  value: function getChildrenOids() {
259
- return this.getChildren().map(function (o) {
250
+ return this.allChildren.map(function (o) {
260
251
  return o.oid;
261
252
  }).join(" ");
262
253
  }
263
254
  }, {
264
255
  key: "findChild",
265
256
  value: function findChild(type) {
266
- return this.getChildren().find(function (child) {
257
+ return this.allChildren.find(function (child) {
267
258
  return child.type === type;
268
259
  });
269
260
  }
270
261
  }, {
271
262
  key: "findLastChild",
272
263
  value: function findLastChild(type) {
273
- return this.getChildren().findLast(function (child) {
264
+ return this.allChildren.findLast(function (child) {
274
265
  return child.type === type;
275
266
  });
276
267
  }
@@ -531,6 +522,11 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
531
522
  value: function canHaveDom() {
532
523
  return this.val('canHaveDom');
533
524
  }
525
+ }, {
526
+ key: "requiresDomRelocation",
527
+ value: function requiresDomRelocation() {
528
+ return _TUtil.TUtil.isDefined(this.val('requiresDomRelocation')) ? this.val('requiresDomRelocation') : !_TUtil.TUtil.isDefined(this.transformMap.x) && !_TUtil.TUtil.isDefined(this.transformMap.y);
529
+ }
534
530
  }, {
535
531
  key: "getBaseElement",
536
532
  value: function getBaseElement() {
@@ -42,6 +42,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
42
42
  restyle: [],
43
43
  reasyncStyle: [],
44
44
  reattach: [],
45
+ relocation: [],
45
46
  invisibleDom: [],
46
47
  noDom: [],
47
48
  updatingTModels: [],
@@ -62,6 +63,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
62
63
  this.lists.restyle.length = 0;
63
64
  this.lists.reasyncStyle.length = 0;
64
65
  this.lists.reattach.length = 0;
66
+ this.lists.relocation.length = 0;
65
67
  this.lists.noDom.length = 0;
66
68
  this.lists.updatingTModels.length = 0;
67
69
  this.lists.updatingTargets.length = 0;
@@ -99,6 +101,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
99
101
  this.needsRerender(tmodel);
100
102
  this.needsRestyle(tmodel);
101
103
  this.needsReattach(tmodel);
104
+ this.needsRelocation(tmodel);
102
105
  if (tmodel.updatingTargetList.length > 0) {
103
106
  this.lists.updatingTModels.push(tmodel);
104
107
  this.lists.updatingTargets = [].concat(_toConsumableArray(this.lists.updatingTargets), _toConsumableArray(tmodel.updatingTargetList));
@@ -126,7 +129,16 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
126
129
  return tmodel !== null && tmodel.hasDom() && tmodel.canDeleteDom();
127
130
  });
128
131
  (_this$lists$invisible = this.lists.invisibleDom).push.apply(_this$lists$invisible, _toConsumableArray(lastVisible));
129
- return this.lists.noDom.length > 0 ? 0 : this.lists.reattach.length > 0 ? 1 : this.lists.rerender.length > 0 ? 2 : this.lists.reasyncStyle.length > 0 ? 3 : this.lists.invisibleDom.length > 0 ? 4 : this.lists.restyle.length > 0 ? 5 : -1;
132
+ return this.lists.noDom.length > 0 ? 0 : this.lists.reattach.length > 0 ? 1 : this.lists.relocation.length > 0 ? 2 : this.lists.rerender.length > 0 ? 3 : this.lists.reasyncStyle.length > 0 ? 4 : this.lists.invisibleDom.length > 0 ? 5 : this.lists.restyle.length > 0 ? 10 : -1;
133
+ }
134
+ }, {
135
+ key: "needsRelocation",
136
+ value: function needsRelocation(tmodel) {
137
+ if (tmodel.hasDom() && _TUtil.TUtil.isDefined(tmodel.domOrderIndex)) {
138
+ this.lists.relocation.push(tmodel);
139
+ return true;
140
+ }
141
+ return false;
130
142
  }
131
143
  }, {
132
144
  key: "needsRerender",
@@ -202,14 +214,34 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
202
214
  }
203
215
  }
204
216
  }, {
205
- key: "deleteDoms",
206
- value: function deleteDoms() {
207
- var _iterator4 = _createForOfIteratorHelper(this.lists.invisibleDom),
217
+ key: "relocateTModels",
218
+ value: function relocateTModels() {
219
+ this.lists.relocation.sort(function (a, b) {
220
+ return b.domOrderIndex - a.domOrderIndex;
221
+ });
222
+ var _iterator4 = _createForOfIteratorHelper(this.lists.relocation),
208
223
  _step4;
209
224
  try {
210
225
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
211
- var _tmodel$$dom4;
212
226
  var tmodel = _step4.value;
227
+ tmodel.getDomParent().$dom.relocate(tmodel, tmodel.domOrderIndex);
228
+ tmodel.domOrderIndex = undefined;
229
+ }
230
+ } catch (err) {
231
+ _iterator4.e(err);
232
+ } finally {
233
+ _iterator4.f();
234
+ }
235
+ }
236
+ }, {
237
+ key: "deleteDoms",
238
+ value: function deleteDoms() {
239
+ var _iterator5 = _createForOfIteratorHelper(this.lists.invisibleDom),
240
+ _step5;
241
+ try {
242
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
243
+ var _tmodel$$dom4;
244
+ var tmodel = _step5.value;
213
245
  tmodel.styleMap = {};
214
246
  tmodel.transformMap = {};
215
247
  tmodel.val('isVisible', false);
@@ -217,46 +249,46 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
217
249
  tmodel.$dom = null;
218
250
  }
219
251
  } catch (err) {
220
- _iterator4.e(err);
252
+ _iterator5.e(err);
221
253
  } finally {
222
- _iterator4.f();
254
+ _iterator5.f();
223
255
  }
224
256
  this.lists.invisibleDom.length = 0;
225
257
  }
226
258
  }, {
227
259
  key: "fixStyles",
228
260
  value: function fixStyles() {
229
- var _iterator5 = _createForOfIteratorHelper(this.lists.restyle),
230
- _step5;
261
+ var _iterator6 = _createForOfIteratorHelper(this.lists.restyle),
262
+ _step6;
231
263
  try {
232
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
233
- var tmodel = _step5.value;
264
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
265
+ var tmodel = _step6.value;
234
266
  if (tmodel.hasDom()) {
235
267
  _TModelUtil.TModelUtil.fixStyle(tmodel);
236
268
  }
237
269
  }
238
270
  } catch (err) {
239
- _iterator5.e(err);
271
+ _iterator6.e(err);
240
272
  } finally {
241
- _iterator5.f();
273
+ _iterator6.f();
242
274
  }
243
275
  }
244
276
  }, {
245
277
  key: "fixAsyncStyles",
246
278
  value: function fixAsyncStyles() {
247
- var _iterator6 = _createForOfIteratorHelper(this.lists.reasyncStyle),
248
- _step6;
279
+ var _iterator7 = _createForOfIteratorHelper(this.lists.reasyncStyle),
280
+ _step7;
249
281
  try {
250
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
251
- var tmodel = _step6.value;
282
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
283
+ var tmodel = _step7.value;
252
284
  if (tmodel.hasDom()) {
253
285
  _TModelUtil.TModelUtil.fixAsyncStyle(tmodel);
254
286
  }
255
287
  }
256
288
  } catch (err) {
257
- _iterator6.e(err);
289
+ _iterator7.e(err);
258
290
  } finally {
259
- _iterator6.f();
291
+ _iterator7.f();
260
292
  }
261
293
  }
262
294
  }, {
@@ -282,11 +314,11 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
282
314
  this.lists.noDom.sort(function (a, b) {
283
315
  return a.getUIDepth() < b.getUIDepth() ? -1 : 1;
284
316
  });
285
- var _iterator7 = _createForOfIteratorHelper(this.lists.noDom),
286
- _step7;
317
+ var _iterator8 = _createForOfIteratorHelper(this.lists.noDom),
318
+ _step8;
287
319
  try {
288
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
289
- var _tmodel = _step7.value;
320
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
321
+ var _tmodel = _step8.value;
290
322
  var $dom = void 0;
291
323
  if (_$Dom.$Dom.query("#".concat(_tmodel.oid))) {
292
324
  $dom = new _$Dom.$Dom("#".concat(_tmodel.oid));
@@ -297,9 +329,9 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
297
329
  }
298
330
  }
299
331
  } catch (err) {
300
- _iterator7.e(err);
332
+ _iterator8.e(err);
301
333
  } finally {
302
- _iterator7.f();
334
+ _iterator8.f();
303
335
  }
304
336
  for (var _i = 0, _needsDom = needsDom; _i < _needsDom.length; _i++) {
305
337
  var _tmodel$getDomHolder;
@@ -22,45 +22,6 @@ var TModelUtil = exports.TModelUtil = /*#__PURE__*/function () {
22
22
  _classCallCheck(this, TModelUtil);
23
23
  }
24
24
  return _createClass(TModelUtil, null, [{
25
- key: "addItem",
26
- value: function addItem(list, child, index) {
27
- var merged = false;
28
- for (var i = 0; i < list.length; i++) {
29
- var entry = list[i];
30
- var startIndex = entry.index;
31
- var endIndex = entry.index + entry.segment.length - 1;
32
- if (index === endIndex + 1) {
33
- entry.segment.push(child);
34
- merged = true;
35
- } else if (index >= startIndex && index <= endIndex) {
36
- entry.segment.splice(index - startIndex, 0, child);
37
- merged = true;
38
- } else if (index === startIndex - 1) {
39
- entry.segment.unshift(child);
40
- entry.index = index;
41
- merged = true;
42
- }
43
- if (merged) {
44
- var _endIndex = entry.index + entry.segment.length - 1;
45
- if (i + 1 < list.length && _endIndex === list[i + 1].index) {
46
- var nextEntry = list[i + 1];
47
- entry.segment = entry.segment.concat(nextEntry.segment);
48
- list.splice(i + 1, 1);
49
- }
50
- break;
51
- }
52
- }
53
- if (!merged) {
54
- list.push({
55
- index: index,
56
- segment: [child]
57
- });
58
- list.sort(function (a, b) {
59
- return a.index - b.index;
60
- });
61
- }
62
- }
63
- }, {
64
25
  key: "defaultActualValues",
65
26
  value: function defaultActualValues() {
66
27
  return {
package/build/TUtil.js CHANGED
@@ -128,14 +128,14 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
128
128
  var maxDistance = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 100;
129
129
  var distance = current - past;
130
130
  var speed = time < 10 ? Math.abs(distance) / 10 : Math.abs(distance) / time;
131
- var duration = Math.min(speed / deceleration, 300);
131
+ var duration = speed / deceleration;
132
132
  var momentumDistance = Math.pow(speed, 2) / (2 * deceleration);
133
133
  if (momentumDistance > maxDistance) {
134
134
  momentumDistance = maxDistance;
135
135
  }
136
136
  var adjustedDistance = distance > 0 ? distance + momentumDistance : distance - momentumDistance;
137
137
  return {
138
- distance: Math.round(adjustedDistance) / 20,
138
+ distance: Math.round(adjustedDistance) / 5,
139
139
  duration: Math.round(duration),
140
140
  momentumDistance: momentumDistance
141
141
  };
@@ -221,7 +221,8 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
221
221
  var g = _step2.value;
222
222
  var gtab = g.isVisible() ? tab + '| ' : tab + 'x ';
223
223
  if (g.type === 'BI') {
224
- console.log("".concat(gtab).concat(g.oid, " v:").concat(g.isVisible(), " x:").concat(Math.floor(g.getX()), " y:").concat(Math.floor(g.getY()), ", absY:").concat(Math.floor(g.absY), " yy:").concat(Math.floor(g.absY + g.getDomParent().absY), " w:").concat(Math.floor(g.getWidth()), " h:").concat(Math.floor(g.getHeight()), " hc:").concat(Math.floor(g.getContentHeight())));
224
+ console.log("".concat(gtab).concat(g.oid, " ").concat(g.startIndex, "-").concat(g.endIndex));
225
+ //console.log(`${gtab}${g.oid} v:${g.isVisible()} x:${Math.floor(g.getX())} y:${Math.floor(g.getY())}, absY:${Math.floor(g.absY)} yy:${Math.floor(g.absY + g.getDomParent().absY)} w:${Math.floor(g.getWidth())} h:${Math.floor(g.getHeight())} hc:${Math.floor(g.getContentHeight())}`);
225
226
  } else {
226
227
  console.log("".concat(gtab).concat(g.oid, " v:").concat(g.isVisible(), " x:").concat(Math.floor(g.getX()), " y:").concat(Math.floor(g.getY()), " absY:").concat(Math.floor(g.absY), " yy:").concat(Math.floor(g.absY + g.getDomParent().absY), " w:").concat(Math.floor(g.getWidth()), " h:").concat(Math.floor(g.getHeight()), " hc:").concat(Math.floor(g.getContentHeight())));
227
228
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "targetj",
3
- "version": "1.0.125",
3
+ "version": "1.0.128",
4
4
  "keywords": [
5
5
  "targetj"
6
6
  ],