targetj 1.0.218 → 1.0.220

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
@@ -40,11 +40,11 @@ This creates a blue box that grows, then turns red, and then logs "Hello World"
40
40
  import { App } from "targetj";
41
41
 
42
42
  App({
43
- backgroundColor: 'blue',
44
- height: 100,
45
- width: { value: [100, 200], steps: 100 }, // 1. Animate width in 100 steps using the default 8 ms interval per step.
46
- backgroundColor$$: { value: 'red', steps: 100 }, // 2. Wait ($$) then turn red in 100 steps
47
- done$$() { console.log("Hello World!"); } // 3. Wait ($$) then log
43
+ backgroundColor: 'blue', // Starts immediately
44
+ width: { value: [100, 200], steps: 100 }, // Starts immediately: animate width from 100px to 200px in 100 steps with 8 ms interval per step.
45
+ height: { value: [100, 200], steps: 100 }, // Starts immediately: animate height.
46
+ backgroundColor$$: { value: 'red', steps: 100 }, // Wait ($$) for width/height to finish
47
+ done$$() { console.log("Hello World!"); } // 3. Waits ($$) for the background color
48
48
  }).mount("#app");
49
49
  ```
50
50
 
@@ -170,7 +170,7 @@ App({
170
170
 
171
171
  ### Summary
172
172
 
173
- Instead of wiring callbacks and effects, you write a sequence of targets. All targets execute automatically in the order they are written. `$$` defers execution until all prior sibling steps finish. Animations, API calls, event handling, and child creation are all treated as the same kind of thing: targets. Complex asynchronous flows are expressed by organizing work into parent and child targets. In addition, targets also provide built-in capabilities such as `onComplete` callback, enabledOn, looping with delays, and more as explained below.
173
+ Each target has its own state and lifecycle. Targets execute automatically in the order they are written. `$$` defers execution until all prior sibling targets (including their children) are fully complete. Animations, API calls, event handling, and child creation are all treated uniformly as targets. Complex asynchronous flows can be structured by organizing work into parent and child targets. In addition, targets provide built-in capabilities such as `onComplete` callbacks, `enabledOn`, looping with delays, and more. This also makes the code more compact, as it avoids using extra variables to track progress and reduces the need for loops and conditional statements.
174
174
 
175
175
  ---
176
176
 
package/build/$Dom.js CHANGED
@@ -496,9 +496,9 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
496
496
  }
497
497
  }, {
498
498
  key: "detachEvent",
499
- value: function detachEvent(type, fn) {
499
+ value: function detachEvent(type, fn, capture) {
500
500
  if (this.element.removeEventListener) {
501
- this.element.removeEventListener(type, fn, false);
501
+ this.element.removeEventListener(type, fn, capture);
502
502
  } else if (this.element.detachEvent) {
503
503
  this.element.detachEvent("on".concat(type), fn);
504
504
  } else {
package/build/App.js CHANGED
@@ -93,9 +93,6 @@ var AppFn = function AppFn() {
93
93
  return tmodel;
94
94
  };
95
95
  my.tRoot = my.tRootFactory();
96
- window.history.pushState({
97
- link: document.URL
98
- }, "", document.URL);
99
96
  return my;
100
97
  };
101
98
  my.start = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -177,8 +174,9 @@ var AppFn = function AppFn() {
177
174
  case 3:
178
175
  my.manager.clearAll();
179
176
  my.locationManager.clear();
177
+ my.loader.clear();
180
178
  _SearchUtil.SearchUtil.clear();
181
- case 6:
179
+ case 7:
182
180
  case "end":
183
181
  return _context3.stop();
184
182
  }
@@ -212,6 +210,51 @@ App.mount = function (child, elemTarget) {
212
210
  }
213
211
  return tmodel;
214
212
  };
213
+ App.unmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
214
+ var root, children;
215
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
216
+ while (1) switch (_context4.prev = _context4.next) {
217
+ case 0:
218
+ if (tApp) {
219
+ _context4.next = 2;
220
+ break;
221
+ }
222
+ return _context4.abrupt("return");
223
+ case 2:
224
+ _context4.next = 4;
225
+ return tApp.stop();
226
+ case 4:
227
+ root = tApp.tRoot;
228
+ children = root.getChildren();
229
+ children.forEach(function (child) {
230
+ var _child$$dom2;
231
+ if (child.val('sourceDom')) {
232
+ var _child$$dom;
233
+ _DomInit.DomInit.restoreDomState((_child$$dom = child.$dom) === null || _child$$dom === void 0 ? void 0 : _child$$dom.element, child.domState);
234
+ return;
235
+ }
236
+ if ((_child$$dom2 = child.$dom) !== null && _child$$dom2 !== void 0 && _child$$dom2.attr('tgjs')) {
237
+ root.$dom.removeElement(child.$dom.element);
238
+ }
239
+ });
240
+ root.allChildrenList = [];
241
+ root.allChildrenMap = {};
242
+ root.clearUpdatingChildren();
243
+ root.clearActiveChildren();
244
+ root.clearAnimatingChildren();
245
+ _context4.next = 14;
246
+ return tApp.reset();
247
+ case 14:
248
+ App.oids = {};
249
+ App.tmodelIdMap = {};
250
+ queuedAppCalls.length = 0;
251
+ exports.tApp = tApp = undefined;
252
+ case 18:
253
+ case "end":
254
+ return _context4.stop();
255
+ }
256
+ }, _callee4);
257
+ }));
215
258
  App.oids = {};
216
259
  App.tmodelIdMap = {};
217
260
  App.getOid = function (type) {
@@ -428,7 +428,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
428
428
  }, {
429
429
  key: "addTargets",
430
430
  value: function addTargets(targets) {
431
- var _this2 = this;
431
+ var _this2 = this,
432
+ _getRunScheduler;
432
433
  Object.keys(targets).forEach(function (key) {
433
434
  _this2.targets[key] = targets[key];
434
435
  _this2.removeFromUpdatingTargets(key);
@@ -441,7 +442,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
441
442
  if (this.hasDom()) {
442
443
  (0, _App.getEvents)().attachEvents([this]);
443
444
  }
444
- (0, _App.getRunScheduler)().schedule(1, 'addTargets-' + this.oid);
445
+ (_getRunScheduler = (0, _App.getRunScheduler)()) === null || _getRunScheduler === void 0 || _getRunScheduler.schedule(1, 'addTargets-' + this.oid);
445
446
  }
446
447
  }, {
447
448
  key: "getTargetStepPercent",
package/build/DomInit.js CHANGED
@@ -9,6 +9,10 @@ var _TUtil = require("./TUtil.js");
9
9
  var _App = require("./App.js");
10
10
  var _TargetData = require("./TargetData.js");
11
11
  var _TModelUtil = require("./TModelUtil.js");
12
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
13
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
12
16
  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); }
13
17
  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; }
14
18
  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; }
@@ -72,6 +76,7 @@ var DomInit = exports.DomInit = /*#__PURE__*/function () {
72
76
  if (elemTarget !== undefined) {
73
77
  var $dom = _TModelUtil.TModelUtil.normalizeDomHolder(elemTarget);
74
78
  if ($dom) {
79
+ tmodel.domState = DomInit.snapshotDomState($dom.element);
75
80
  tmodel.targets.$dom = $dom;
76
81
  tmodel.val('$dom', $dom);
77
82
  var tag = $dom.getTagName().toLowerCase();
@@ -80,6 +85,7 @@ var DomInit = exports.DomInit = /*#__PURE__*/function () {
80
85
  patch.element = tag;
81
86
  }
82
87
  patch.position = $dom.getStyleValue('position') || 'relative';
88
+ patch.sourceDom = true;
83
89
  patch.domIsland = true;
84
90
  if (!_TUtil.TUtil.isDefined(tmodel.targets.reuseDomDefinition)) {
85
91
  patch.reuseDomDefinition = true;
@@ -281,5 +287,55 @@ var DomInit = exports.DomInit = /*#__PURE__*/function () {
281
287
  } catch (_unused3) {}
282
288
  return rawValue;
283
289
  }
290
+ }, {
291
+ key: "snapshotDomState",
292
+ value: function snapshotDomState(element) {
293
+ if (!element || element.nodeType !== 1) {
294
+ return;
295
+ }
296
+ var attrs = {};
297
+ for (var _i2 = 0, _Array$from = Array.from(element.attributes); _i2 < _Array$from.length; _i2++) {
298
+ var _Array$from$_i = _Array$from[_i2],
299
+ name = _Array$from$_i.name,
300
+ value = _Array$from$_i.value;
301
+ attrs[name] = value;
302
+ }
303
+ var styleAttr = element.getAttribute("style");
304
+ var html = element.innerHTML;
305
+ return {
306
+ attrs: attrs,
307
+ styleAttr: styleAttr,
308
+ html: html
309
+ };
310
+ }
311
+ }, {
312
+ key: "restoreDomState",
313
+ value: function restoreDomState(element, domState) {
314
+ if (!element || element.nodeType !== 1 || !domState) {
315
+ return;
316
+ }
317
+ var originalAttrs = domState.attrs,
318
+ originalStyleAttr = domState.styleAttr;
319
+ for (var _i3 = 0, _Array$from2 = Array.from(element.attributes); _i3 < _Array$from2.length; _i3++) {
320
+ var name = _Array$from2[_i3].name;
321
+ if (!(name in originalAttrs)) {
322
+ element.removeAttribute(name);
323
+ }
324
+ }
325
+ for (var _i4 = 0, _Object$entries = Object.entries(originalAttrs); _i4 < _Object$entries.length; _i4++) {
326
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i4], 2),
327
+ _name = _Object$entries$_i[0],
328
+ value = _Object$entries$_i[1];
329
+ if (element.getAttribute(_name) !== value) {
330
+ element.setAttribute(_name, value);
331
+ }
332
+ }
333
+ if (!originalStyleAttr) {
334
+ element.removeAttribute("style");
335
+ } else {
336
+ element.setAttribute("style", originalStyleAttr);
337
+ }
338
+ element.innerHTML = domState.html;
339
+ }
284
340
  }]);
285
341
  }();
@@ -84,6 +84,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
84
84
  this.windowScrollX = window.scrollX | 0;
85
85
  this.windowScrollY = window.scrollY | 0;
86
86
  this.windowEpoch = 0;
87
+ this.eventEpoch = 0;
87
88
  Object.values(_TargetData.TargetData.events).forEach(function (group) {
88
89
  Object.assign(_this.allEvents, group);
89
90
  });
@@ -110,18 +111,22 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
110
111
  }
111
112
  }, {
112
113
  key: "detachDocumentEvents",
113
- value: function detachDocumentEvents() {
114
+ value: function detachDocumentEvents(groupName) {
114
115
  var _this4 = this;
115
- Object.keys(_TargetData.TargetData.events.documentEvents).forEach(function (key) {
116
- _this4.$document.detachEvent(key, _this4.bindedParentHandleEvent);
116
+ var group = _TargetData.TargetData.events[groupName];
117
+ Object.keys(group).forEach(function (type) {
118
+ var spec = group[type];
119
+ _this4.$document.detachEvent(type, _this4.bindedParentHandleEvent, spec.capture);
117
120
  });
118
121
  }
119
122
  }, {
120
123
  key: "attachDocumentEvents",
121
- value: function attachDocumentEvents() {
124
+ value: function attachDocumentEvents(groupName) {
122
125
  var _this5 = this;
123
- Object.keys(_TargetData.TargetData.events.documentEvents).forEach(function (key) {
124
- _this5.$document.addEvent(key, _this5.bindedParentHandleEvent);
126
+ var group = _TargetData.TargetData.events[groupName];
127
+ Object.keys(group).forEach(function (type) {
128
+ var spec = group[type];
129
+ _this5.$document.addEvent(type, _this5.bindedParentHandleEvent, spec.capture, spec.passive);
125
130
  });
126
131
  }
127
132
  }, {
@@ -169,7 +174,11 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
169
174
  if (!eventMap) {
170
175
  return undefined;
171
176
  }
177
+ var hasPointer = typeof window !== 'undefined' && !!window.PointerEvent;
172
178
  Object.keys(eventMap).forEach(function (key) {
179
+ if (hasPointer && key.startsWith('mouse')) {
180
+ return;
181
+ }
173
182
  var eventSpec = eventMap[key];
174
183
  var isWindow = !!eventSpec.windowEvent;
175
184
  var $dom = isWindow ? _App.tApp.$window : tmodel.hasDom() ? tmodel.$dom : null;
@@ -181,12 +190,13 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
181
190
  var attachedKey = "".concat(tmodel.oid, " ").concat(key, " ").concat(isWindow ? 'win' : 'dom');
182
191
  var alreadyAttached = _this6.attachedEventMap[attachedKey] && _this6.attachedEventMap[attachedKey].$dom === $dom;
183
192
  if (force || !alreadyMarked || !alreadyAttached) {
184
- $dom.detachEvent(key, _this6.bindedHandleEvent);
193
+ $dom.detachEvent(key, _this6.bindedHandleEvent, eventSpec.capture);
185
194
  $dom.addEvent(key, _this6.bindedHandleEvent, eventSpec.capture, eventSpec.passive);
186
195
  _this6.eventTargetMap[attachMarkerKey] = $dom;
187
196
  _this6.attachedEventMap[attachedKey] = {
188
197
  $dom: $dom,
189
- event: key
198
+ event: key,
199
+ capture: !!eventSpec.capture
190
200
  };
191
201
  }
192
202
  });
@@ -195,16 +205,16 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
195
205
  }, {
196
206
  key: "detachAll",
197
207
  value: function detachAll() {
198
- var _this7 = this;
199
- var eventKeys = Object.keys(this.attachedEventMap);
200
- eventKeys.forEach(function (eventKey) {
201
- var _this7$attachedEventM = _this7.attachedEventMap[eventKey],
202
- $dom = _this7$attachedEventM.$dom,
203
- event = _this7$attachedEventM.event;
208
+ for (var _i = 0, _Object$keys = Object.keys(this.attachedEventMap); _i < _Object$keys.length; _i++) {
209
+ var k = _Object$keys[_i];
210
+ var _this$attachedEventMa = this.attachedEventMap[k],
211
+ $dom = _this$attachedEventMa.$dom,
212
+ event = _this$attachedEventMa.event,
213
+ capture = _this$attachedEventMa.capture;
204
214
  if ($dom.exists()) {
205
- $dom.detachEvent(event, _this7.bindedHandleEvent);
215
+ $dom.detachEvent(event, this.bindedHandleEvent, capture);
206
216
  }
207
- });
217
+ }
208
218
  this.attachedEventMap = {};
209
219
  this.eventTargetMap = {};
210
220
  }
@@ -322,7 +332,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
322
332
  }, {
323
333
  key: "handleEvent",
324
334
  value: function handleEvent(event, isDocEvent, isWindowEvent) {
325
- var _tmodel, _this$lastEvent, _this$currentHandlers2, _this$currentHandlers3, _this$currentHandlers4, _this$currentHandlers5, _this$currentHandlers7, _this$currentHandlers8;
335
+ var _this$lastEvent, _tmodel, _tmodel2, _this$currentHandlers2, _this$currentHandlers3, _this$currentHandlers4, _this$currentHandlers5, _this$currentHandlers7, _this$currentHandlers8;
326
336
  if (!event) {
327
337
  return;
328
338
  }
@@ -344,7 +354,6 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
344
354
  } else {
345
355
  tmodel = this.getTModelFromEvent(event);
346
356
  }
347
- (_tmodel = tmodel) === null || _tmodel === void 0 || _tmodel.markLayoutDirty('event');
348
357
  var newEvent = {
349
358
  eventName: eventName,
350
359
  eventItem: eventItem,
@@ -359,7 +368,8 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
359
368
  lastEventItem = _this$lastEvent2.eventItem,
360
369
  lastTimeStamp = _this$lastEvent2.timeStamp;
361
370
  var rate = now - lastTimeStamp;
362
- if (inputType && lastEventItem.inputType && lastEventItem.inputType !== inputType && eventOrder > lastEventItem.order) {
371
+ var isTerminal = eventType === 'end' || eventType === 'cancel' || eventType === 'start';
372
+ if (!isTerminal && inputType && lastEventItem.inputType && lastEventItem.inputType !== inputType && eventOrder > lastEventItem.order) {
363
373
  return;
364
374
  }
365
375
  if (this.eventQueue.length > EventListener.MAX_EVENT_QUEUE_SIZE && rateLimit > 0 && rate < rateLimit) {
@@ -381,6 +391,9 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
381
391
  }
382
392
  }
383
393
  }
394
+ this.eventEpoch++;
395
+ (_tmodel = tmodel) === null || _tmodel === void 0 || _tmodel.markEventDirty();
396
+ (_tmodel2 = tmodel) === null || _tmodel2 === void 0 || _tmodel2.markLayoutDirty('event');
384
397
  this.lastEvent = newEvent;
385
398
  if (queue) {
386
399
  this.eventQueue.push(this.lastEvent);
@@ -392,6 +405,8 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
392
405
  this.clearStart();
393
406
  this.clearEnd();
394
407
  this.clearTouch();
408
+ this.eventQueue.length = 0;
409
+ this.eventQueue.push(this.lastEvent);
395
410
  this.touchCount = this.countTouches(event) || 1;
396
411
  if (this.preventDefault(tmodel, eventName) && event.cancelable) {
397
412
  event.preventDefault();
@@ -406,8 +421,8 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
406
421
  this.swipeStartX = this.start0.x - ((_this$currentHandlers2 = (_this$currentHandlers3 = this.currentHandlers.swipe) === null || _this$currentHandlers3 === void 0 ? void 0 : _this$currentHandlers3.getX()) !== null && _this$currentHandlers2 !== void 0 ? _this$currentHandlers2 : 0);
407
422
  this.swipeStartY = this.start0.y - ((_this$currentHandlers4 = (_this$currentHandlers5 = this.currentHandlers.swipe) === null || _this$currentHandlers5 === void 0 ? void 0 : _this$currentHandlers5.getY()) !== null && _this$currentHandlers4 !== void 0 ? _this$currentHandlers4 : 0);
408
423
  event.stopPropagation();
409
- this.detachDocumentEvents();
410
- this.attachDocumentEvents();
424
+ this.detachDocumentEvents('documentDragEvents');
425
+ this.attachDocumentEvents('documentDragEvents');
411
426
  break;
412
427
  case 'mousemove':
413
428
  case 'touchmove':
@@ -431,7 +446,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
431
446
  }
432
447
  case 'mouseup':
433
448
  case 'touchend':
434
- this.detachDocumentEvents();
449
+ this.detachDocumentEvents('documentDragEvents');
435
450
  if (this.preventDefault(tmodel, eventName) && event.cancelable) {
436
451
  event.preventDefault();
437
452
  }
@@ -475,7 +490,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
475
490
  break;
476
491
  case 'mouseleave':
477
492
  if (isDocEvent && this.touchCount > 0) {
478
- this.detachDocumentEvents();
493
+ this.detachDocumentEvents('documentDragEvents');
479
494
  touch = this.getTouch(event);
480
495
  this.cursor.x = touch.x;
481
496
  this.cursor.y = touch.y;
@@ -485,6 +500,16 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
485
500
  event.stopPropagation();
486
501
  }
487
502
  break;
503
+ case 'mousecancel':
504
+ case 'touchcancel':
505
+ this.canFindHandlers = true;
506
+ this.detachDocumentEvents('documentDragEvents');
507
+ this.clearStart();
508
+ this.clearEnd();
509
+ this.clearTouch();
510
+ this.touchCount = 0;
511
+ event.stopPropagation();
512
+ break;
488
513
  case 'key':
489
514
  this.currentTouch.key = event.which || event.keyCode;
490
515
  (_this$currentHandlers7 = this.currentHandlers.focus) === null || _this$currentHandlers7 === void 0 || _this$currentHandlers7.markLayoutDirty('key-event');
@@ -496,7 +521,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
496
521
  case 'resize':
497
522
  this.windowEpoch++;
498
523
  this.resizeRoot();
499
- _App.tApp.manager.getVisibles().forEach(function (t) {
524
+ (0, _App.getManager)().getVisibles().forEach(function (t) {
500
525
  if (t.targets['onResize']) {
501
526
  t.markLayoutDirty('resize-event');
502
527
  }
@@ -541,11 +566,11 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
541
566
  }
542
567
  if (!oid || !_App.tApp.manager.visibleOidMap[oid]) {
543
568
  oid = el === null || el === void 0 ? void 0 : el.id;
544
- if (!oid || !_App.tApp.manager.visibleOidMap[oid]) {
569
+ if (!oid || !(0, _App.getManager)().visibleOidMap[oid]) {
545
570
  oid = _$Dom.$Dom.findNearestParentWithId(event.target);
546
571
  }
547
572
  }
548
- return _App.tApp.manager.visibleOidMap[oid];
573
+ return (0, _App.getManager)().visibleOidMap[oid];
549
574
  }
550
575
  }, {
551
576
  key: "clearStart",
@@ -236,7 +236,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
236
236
  tmodelEntry.accessIndex += result.length;
237
237
  } else if (_TUtil.TUtil.isDefined(targetValue[tmodelEntry.accessIndex])) {
238
238
  result = targetValue[tmodelEntry.accessIndex];
239
- tmodelEntry.accessIndex++;
239
+ tmodelEntry.accessIndex = Math.min(tmodelEntry.accessIndex + 1, tmodelEntry.entryCount - 1);
240
240
  }
241
241
  }
242
242
  return result;
@@ -17,12 +17,12 @@ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLim
17
17
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
18
18
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
19
19
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
20
- 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; }
21
- 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; }
22
- 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; }
23
20
  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; } } }; }
24
21
  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; } }
25
22
  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; }
23
+ 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; }
24
+ 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; }
25
+ 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; }
26
26
  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; }
27
27
  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); }
28
28
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
@@ -154,24 +154,9 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
154
154
  while (1) switch (_context2.prev = _context2.next) {
155
155
  case 0:
156
156
  processAfterAllChildren = function processAfterAllChildren(job) {
157
- var container = job.container,
158
- children = job.children;
157
+ var container = job.container;
159
158
  container.adjustViewport();
160
159
  container.calcContentWidthHeight();
161
- if ((0, _App.getEvents)().getEventType() || (0, _App.getEvents)().hasDelta()) {
162
- var _iterator = _createForOfIteratorHelper(children),
163
- _step;
164
- try {
165
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
166
- var child = _step.value;
167
- _this.checkExternalEvents(child);
168
- }
169
- } catch (err) {
170
- _iterator.e(err);
171
- } finally {
172
- _iterator.f();
173
- }
174
- }
175
160
  };
176
161
  resetDirtyLayout = function resetDirtyLayout(job) {
177
162
  var children = job.children,
@@ -213,6 +198,12 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
213
198
  }
214
199
  container.calcContentWidthHeight();
215
200
  }
201
+ if (child.hasEventDirty() || (0, _App.getEvents)().getEventType() || (0, _App.getEvents)().hasDelta()) {
202
+ _this.checkExternalEvents(child);
203
+ if (child.hasEventDirty()) {
204
+ child.processedEventEpoch = child.eventDirtyEpoch;
205
+ }
206
+ }
216
207
  }
217
208
  job.index++;
218
209
  if (job.index < job.children.length) {
@@ -339,7 +330,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
339
330
  container.backupDirtyLayout = _objectSpread({}, container.dirtyLayout);
340
331
  }
341
332
  container.visibleChildren.length = 0;
342
- job.children = allChildrenList;
333
+ job.children = allChildrenList.slice(0);
343
334
  job.index = 0;
344
335
  job.viewport = container.createViewport();
345
336
  job.stage = 'child';
@@ -358,7 +349,9 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
358
349
  stack.pop();
359
350
  return _context2.abrupt("continue", 4);
360
351
  case 18:
361
- processChild(job);
352
+ if (job.stage === 'child') {
353
+ processChild(job);
354
+ }
362
355
  _context2.next = 4;
363
356
  break;
364
357
  case 21:
@@ -501,17 +494,17 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
501
494
  while (tmodel.activatedTargets.length && guard++ < 50) {
502
495
  var batch = tmodel.activatedTargets.slice(0);
503
496
  tmodel.activatedTargets.length = 0;
504
- var _iterator2 = _createForOfIteratorHelper(batch),
505
- _step2;
497
+ var _iterator = _createForOfIteratorHelper(batch),
498
+ _step;
506
499
  try {
507
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
508
- var key = _step2.value;
500
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
501
+ var key = _step.value;
509
502
  (0, _App.getTargetManager)().applyTargetValue(tmodel, key);
510
503
  }
511
504
  } catch (err) {
512
- _iterator2.e(err);
505
+ _iterator.e(err);
513
506
  } finally {
514
- _iterator2.f();
507
+ _iterator.f();
515
508
  }
516
509
  }
517
510
  (0, _App.getTargetManager)().applyTargetValues(tmodel);
@@ -550,11 +543,11 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
550
543
  var list = _this3.resumePausedList.slice();
551
544
  _this3.resumePausedList.length = 0;
552
545
  _this3.resumePausedMap = {};
553
- var _iterator3 = _createForOfIteratorHelper(list),
554
- _step3;
546
+ var _iterator2 = _createForOfIteratorHelper(list),
547
+ _step2;
555
548
  try {
556
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
557
- var tmodel = _step3.value;
549
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
550
+ var tmodel = _step2.value;
558
551
  var batch = tmodel.pausedBatch;
559
552
  if (!batch || !tmodel.hasDom()) {
560
553
  continue;
@@ -566,9 +559,9 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
566
559
  }
567
560
  }
568
561
  } catch (err) {
569
- _iterator3.e(err);
562
+ _iterator2.e(err);
570
563
  } finally {
571
- _iterator3.f();
564
+ _iterator2.f();
572
565
  }
573
566
  });
574
567
  });
@@ -580,20 +573,20 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
580
573
  if ((externalEventMap === null || externalEventMap === void 0 ? void 0 : externalEventMap.size) > 0) {
581
574
  var eventTargets = [];
582
575
  var eventMap = _TargetData.TargetData.allEventMap;
583
- var _iterator4 = _createForOfIteratorHelper(externalEventMap),
584
- _step4;
576
+ var _iterator3 = _createForOfIteratorHelper(externalEventMap),
577
+ _step3;
585
578
  try {
586
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
587
- var _step4$value = _slicedToArray(_step4.value, 1),
588
- targetName = _step4$value[0];
579
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
580
+ var _step3$value = _slicedToArray(_step3.value, 1),
581
+ targetName = _step3$value[0];
589
582
  if (eventMap[targetName](tmodel)) {
590
583
  eventTargets.push(tmodel.allTargetMap[targetName]);
591
584
  }
592
585
  }
593
586
  } catch (err) {
594
- _iterator4.e(err);
587
+ _iterator3.e(err);
595
588
  } finally {
596
- _iterator4.f();
589
+ _iterator3.f();
597
590
  }
598
591
  this.runEventTargets(tmodel, eventTargets);
599
592
  }
@@ -605,20 +598,20 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
605
598
  var eventMap = _TargetData.TargetData.internalEventMap;
606
599
  var internalEventMap = tmodel.internalEventMap;
607
600
  if ((internalEventMap === null || internalEventMap === void 0 ? void 0 : internalEventMap.size) > 0) {
608
- var _iterator5 = _createForOfIteratorHelper(internalEventMap),
609
- _step5;
601
+ var _iterator4 = _createForOfIteratorHelper(internalEventMap),
602
+ _step4;
610
603
  try {
611
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
612
- var _step5$value = _slicedToArray(_step5.value, 1),
613
- targetName = _step5$value[0];
604
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
605
+ var _step4$value = _slicedToArray(_step4.value, 1),
606
+ targetName = _step4$value[0];
614
607
  if (eventMap[targetName](tmodel)) {
615
608
  eventTargets.push(tmodel.allTargetMap[targetName]);
616
609
  }
617
610
  }
618
611
  } catch (err) {
619
- _iterator5.e(err);
612
+ _iterator4.e(err);
620
613
  } finally {
621
- _iterator5.f();
614
+ _iterator4.f();
622
615
  }
623
616
  }
624
617
  this.runEventTargets(tmodel, eventTargets);