targetj 1.0.240 → 1.0.241
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Export.js +27 -5
- package/build/$Dom.js +21 -25
- package/build/AnimationManager.js +39 -44
- package/build/AnimationUtil.js +41 -45
- package/build/App.js +73 -74
- package/build/BaseModel.js +86 -90
- package/build/Bracket.js +7 -11
- package/build/BracketGenerator.js +15 -19
- package/build/ColorUtil.js +3 -8
- package/build/DomInit.js +34 -38
- package/build/Easing.js +3 -8
- package/build/EventListener.js +63 -67
- package/build/LoadingManager.js +34 -38
- package/build/LocationManager.js +52 -56
- package/build/Moves.js +17 -21
- package/build/PageManager.js +64 -68
- package/build/RunScheduler.js +46 -50
- package/build/ScheduleUtil.js +20 -24
- package/build/SearchUtil.js +16 -20
- package/build/TModel.js +52 -56
- package/build/TModelManager.js +37 -41
- package/build/TModelUtil.js +47 -50
- package/build/TUtil.js +16 -20
- package/build/TargetData.js +35 -40
- package/build/TargetExecutor.js +72 -76
- package/build/TargetManager.js +49 -52
- package/build/TargetParser.js +35 -39
- package/build/TargetUtil.js +25 -29
- package/build/Viewport.js +6 -10
- package/build/VisibilityUtil.js +11 -15
- package/build/index.js +20 -225
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/LoadingManager.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.LoadingManager = void 0;
|
|
7
|
-
var _$Dom = require("./$Dom.js");
|
|
8
|
-
var _TUtil = require("./TUtil.js");
|
|
9
|
-
var _App = require("./App.js");
|
|
10
|
-
var _TargetUtil = require("./TargetUtil.js");
|
|
11
1
|
var _excluded = ["url", "cacheId"];
|
|
12
2
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
13
3
|
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."); }
|
|
@@ -26,10 +16,15 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
|
|
|
26
16
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
27
17
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
28
18
|
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); }
|
|
19
|
+
import { $Dom } from "./$Dom.js";
|
|
20
|
+
import { TUtil } from "./TUtil.js";
|
|
21
|
+
import { getRunScheduler } from "./App.js";
|
|
22
|
+
import { TargetUtil } from "./TargetUtil.js";
|
|
23
|
+
|
|
29
24
|
/**
|
|
30
25
|
* It provides a central place for managing fetching of external APIs and images.
|
|
31
26
|
*/
|
|
32
|
-
var LoadingManager =
|
|
27
|
+
var LoadingManager = /*#__PURE__*/function () {
|
|
33
28
|
function LoadingManager() {
|
|
34
29
|
_classCallCheck(this, LoadingManager);
|
|
35
30
|
this.cacheMap = {};
|
|
@@ -49,13 +44,13 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
49
44
|
}, {
|
|
50
45
|
key: "fetchCommon",
|
|
51
46
|
value: function fetchCommon(fetchId, cacheId, tmodel, fetchMap, fetchFn) {
|
|
52
|
-
|
|
47
|
+
TargetUtil.markFetchAction(tmodel);
|
|
53
48
|
if (!this.isFetched(cacheId)) {
|
|
54
49
|
if (!fetchMap[fetchId]) {
|
|
55
50
|
fetchMap[fetchId] = {
|
|
56
51
|
fetchId: fetchId,
|
|
57
52
|
cacheId: cacheId,
|
|
58
|
-
startTime:
|
|
53
|
+
startTime: TUtil.now(),
|
|
59
54
|
targets: [{
|
|
60
55
|
tmodel: tmodel,
|
|
61
56
|
targetName: tmodel.key
|
|
@@ -68,7 +63,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
68
63
|
fetchMap[fetchId] = {
|
|
69
64
|
fetchId: fetchId,
|
|
70
65
|
cacheId: cacheId,
|
|
71
|
-
startTime:
|
|
66
|
+
startTime: TUtil.now(),
|
|
72
67
|
targets: [{
|
|
73
68
|
tmodel: tmodel,
|
|
74
69
|
targetName: tmodel.key
|
|
@@ -131,7 +126,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
131
126
|
key: "addToTModelKeyMap",
|
|
132
127
|
value: function addToTModelKeyMap(tmodel, targetName, fetchId, cacheId) {
|
|
133
128
|
var key = this.getTModelKey(tmodel, targetName);
|
|
134
|
-
var loadTargetName =
|
|
129
|
+
var loadTargetName = TUtil.getLoadTargetName(targetName);
|
|
135
130
|
var loadingComplete = this.isLoadingComplete(tmodel, targetName);
|
|
136
131
|
if (loadingComplete || !this.tmodelKeyMap[key] || !tmodel.val(loadTargetName)) {
|
|
137
132
|
var _this$tmodelKeyMap, _this$tmodelKeyMap$ke;
|
|
@@ -154,7 +149,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
154
149
|
this.tmodelKeyMap[key].entryCount++;
|
|
155
150
|
tmodel.val(loadTargetName).push(undefined);
|
|
156
151
|
if (cacheId && this.isFetched(cacheId)) {
|
|
157
|
-
this.fetchingAPIMap[fetchId].startTime =
|
|
152
|
+
this.fetchingAPIMap[fetchId].startTime = TUtil.now();
|
|
158
153
|
this.handleSuccess(this.fetchingAPIMap[fetchId], this.cacheMap[cacheId].result);
|
|
159
154
|
}
|
|
160
155
|
}
|
|
@@ -209,9 +204,9 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
209
204
|
if (!modelEntry) {
|
|
210
205
|
return false;
|
|
211
206
|
}
|
|
212
|
-
var loadTargetName =
|
|
207
|
+
var loadTargetName = TUtil.getLoadTargetName(targetName);
|
|
213
208
|
var targetValue = tmodel.val(loadTargetName);
|
|
214
|
-
return Array.isArray(targetValue) &&
|
|
209
|
+
return Array.isArray(targetValue) && TUtil.isDefined(targetValue[modelEntry.activeIndex]) && TUtil.isDefined(targetValue[modelEntry.accessIndex]);
|
|
215
210
|
}
|
|
216
211
|
}, {
|
|
217
212
|
key: "getLoadingItemValue",
|
|
@@ -221,14 +216,14 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
221
216
|
if (!tmodelEntry || tmodelEntry.accessIndex >= tmodelEntry.resultCount) {
|
|
222
217
|
return undefined;
|
|
223
218
|
}
|
|
224
|
-
var loadTargetName =
|
|
219
|
+
var loadTargetName = TUtil.getLoadTargetName(prevTargetName);
|
|
225
220
|
var targetValue = tmodel.val(loadTargetName);
|
|
226
221
|
var result;
|
|
227
222
|
if (targetValue) {
|
|
228
223
|
if (currentTargetName !== null && currentTargetName !== void 0 && currentTargetName.endsWith('$$')) {
|
|
229
224
|
result = targetValue.slice(tmodelEntry.accessIndex, tmodelEntry.resultCount);
|
|
230
225
|
tmodelEntry.accessIndex += result.length;
|
|
231
|
-
} else if (
|
|
226
|
+
} else if (TUtil.isDefined(targetValue[tmodelEntry.accessIndex])) {
|
|
232
227
|
result = targetValue[tmodelEntry.accessIndex];
|
|
233
228
|
tmodelEntry.accessIndex = Math.min(tmodelEntry.accessIndex + 1, tmodelEntry.entryCount);
|
|
234
229
|
}
|
|
@@ -244,7 +239,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
244
239
|
}, {
|
|
245
240
|
key: "getFetchingPeriod",
|
|
246
241
|
value: function getFetchingPeriod(fetchId) {
|
|
247
|
-
return this.fetchingAPIMap[fetchId] ?
|
|
242
|
+
return this.fetchingAPIMap[fetchId] ? TUtil.now() - this.fetchingAPIMap[fetchId].startTime : undefined;
|
|
248
243
|
}
|
|
249
244
|
}, {
|
|
250
245
|
key: "fetchCache",
|
|
@@ -268,7 +263,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
268
263
|
key: "handleSuccess",
|
|
269
264
|
value: function handleSuccess(fetchStatus, result) {
|
|
270
265
|
var _this4 = this;
|
|
271
|
-
var fetchTime =
|
|
266
|
+
var fetchTime = TUtil.now();
|
|
272
267
|
var fetchId = fetchStatus.fetchId,
|
|
273
268
|
cacheId = fetchStatus.cacheId,
|
|
274
269
|
startTime = fetchStatus.startTime,
|
|
@@ -284,7 +279,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
284
279
|
targetName = _ref.targetName;
|
|
285
280
|
var key = _this4.getTModelKey(tmodel, targetName);
|
|
286
281
|
var tmodelEntry = _this4.tmodelKeyMap[key];
|
|
287
|
-
var loadTargetName =
|
|
282
|
+
var loadTargetName = TUtil.getLoadTargetName(targetName);
|
|
288
283
|
if (!tmodelEntry || !tmodelEntry.fetchMap[fetchId]) {
|
|
289
284
|
return;
|
|
290
285
|
}
|
|
@@ -294,7 +289,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
294
289
|
}));
|
|
295
290
|
var targetResults = tmodel.val(loadTargetName);
|
|
296
291
|
if (targetResults) {
|
|
297
|
-
if (!
|
|
292
|
+
if (!TUtil.isDefined(targetResults[fetchEntry.order])) {
|
|
298
293
|
tmodelEntry.resultCount++;
|
|
299
294
|
}
|
|
300
295
|
targetResults[fetchEntry.order] = res.result;
|
|
@@ -303,19 +298,19 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
303
298
|
var newStatus = _this4.calculateTargetStatus(tmodel, targetName);
|
|
304
299
|
tmodel.setTargetStatus(targetName, newStatus);
|
|
305
300
|
tmodel.setLastUpdate(targetName);
|
|
306
|
-
|
|
301
|
+
TargetUtil.shouldActivateNextTarget(tmodel, targetName);
|
|
307
302
|
});
|
|
308
303
|
delete fetchMap[fetchId];
|
|
309
304
|
if (cacheId) {
|
|
310
305
|
this.cacheMap[cacheId] = res;
|
|
311
306
|
}
|
|
312
|
-
|
|
307
|
+
getRunScheduler().schedule(0, "api_success_".concat(fetchId));
|
|
313
308
|
}
|
|
314
309
|
}, {
|
|
315
310
|
key: "handleError",
|
|
316
311
|
value: function handleError(fetchStatus, error) {
|
|
317
312
|
var _this5 = this;
|
|
318
|
-
var fetchTime =
|
|
313
|
+
var fetchTime = TUtil.now();
|
|
319
314
|
var fetchId = fetchStatus.fetchId,
|
|
320
315
|
cacheId = fetchStatus.cacheId,
|
|
321
316
|
startTime = fetchStatus.startTime,
|
|
@@ -326,7 +321,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
326
321
|
targetName = _ref2.targetName;
|
|
327
322
|
var key = _this5.getTModelKey(tmodel, targetName);
|
|
328
323
|
var tmodelEntry = _this5.tmodelKeyMap[key];
|
|
329
|
-
var loadTargetName =
|
|
324
|
+
var loadTargetName = TUtil.getLoadTargetName(targetName);
|
|
330
325
|
if (!tmodelEntry || !tmodelEntry.fetchMap[fetchId]) {
|
|
331
326
|
return;
|
|
332
327
|
}
|
|
@@ -339,7 +334,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
339
334
|
};
|
|
340
335
|
var targetResults = tmodel.val(loadTargetName);
|
|
341
336
|
if (targetResults) {
|
|
342
|
-
if (!
|
|
337
|
+
if (!TUtil.isDefined(targetResults[fetchEntry.order])) {
|
|
343
338
|
tmodelEntry.resultCount++;
|
|
344
339
|
}
|
|
345
340
|
targetResults[fetchEntry.order] = res;
|
|
@@ -350,13 +345,13 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
350
345
|
var newStatus = _this5.calculateTargetStatus(tmodel, targetName);
|
|
351
346
|
tmodel.setTargetStatus(targetName, newStatus);
|
|
352
347
|
tmodel.setLastUpdate(targetName);
|
|
353
|
-
|
|
348
|
+
TargetUtil.shouldActivateNextTarget(tmodel, targetName);
|
|
354
349
|
});
|
|
355
350
|
delete fetchMap[fetchId];
|
|
356
351
|
if (cacheId) {
|
|
357
352
|
delete this.cacheMap[cacheId];
|
|
358
353
|
}
|
|
359
|
-
|
|
354
|
+
getRunScheduler().schedule(0, "api_error_".concat(fetchId));
|
|
360
355
|
}
|
|
361
356
|
}, {
|
|
362
357
|
key: "callOnSuccessHandler",
|
|
@@ -369,10 +364,10 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
369
364
|
onSuccess.call(tmodel, res);
|
|
370
365
|
} else if (Array.isArray(onSuccess)) {
|
|
371
366
|
onSuccess.forEach(function (t) {
|
|
372
|
-
return
|
|
367
|
+
return TargetUtil.activateSingleTarget(tmodel, t);
|
|
373
368
|
});
|
|
374
369
|
} else {
|
|
375
|
-
|
|
370
|
+
TargetUtil.activateSingleTarget(tmodel, onSuccess);
|
|
376
371
|
}
|
|
377
372
|
}
|
|
378
373
|
}
|
|
@@ -387,10 +382,10 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
387
382
|
onError.call(tmodel, tmodel.val(targetName));
|
|
388
383
|
} else if (Array.isArray(onError)) {
|
|
389
384
|
onError.forEach(function (t) {
|
|
390
|
-
return
|
|
385
|
+
return TargetUtil.activateSingleTarget(tmodel, t);
|
|
391
386
|
});
|
|
392
387
|
} else {
|
|
393
|
-
|
|
388
|
+
TargetUtil.activateSingleTarget(tmodel, onError);
|
|
394
389
|
}
|
|
395
390
|
}
|
|
396
391
|
}
|
|
@@ -416,7 +411,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
416
411
|
return q && _typeof(q) === "object" && !Array.isArray(q);
|
|
417
412
|
};
|
|
418
413
|
if (!isPlainObj(query)) {
|
|
419
|
-
|
|
414
|
+
$Dom.ajax(_objectSpread(_objectSpread({}, defaults), {}, {
|
|
420
415
|
data: query
|
|
421
416
|
}));
|
|
422
417
|
return;
|
|
@@ -445,7 +440,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
445
440
|
if (!("data" in final) && Object.keys(dataBag).length) {
|
|
446
441
|
final.data = dataBag;
|
|
447
442
|
}
|
|
448
|
-
|
|
443
|
+
$Dom.ajax(final);
|
|
449
444
|
}
|
|
450
445
|
}, {
|
|
451
446
|
key: "loadImage",
|
|
@@ -466,4 +461,5 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
466
461
|
};
|
|
467
462
|
}
|
|
468
463
|
}]);
|
|
469
|
-
}();
|
|
464
|
+
}();
|
|
465
|
+
export { LoadingManager };
|
package/build/LocationManager.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.LocationManager = void 0;
|
|
7
|
-
var _BracketGenerator = require("./BracketGenerator.js");
|
|
8
|
-
var _TUtil = require("./TUtil.js");
|
|
9
|
-
var _TargetUtil = require("./TargetUtil.js");
|
|
10
|
-
var _TargetData = require("./TargetData.js");
|
|
11
|
-
var _TModelUtil = require("./TModelUtil.js");
|
|
12
|
-
var _ScheduleUtil = require("./ScheduleUtil.js");
|
|
13
|
-
var _AnimationUtil = require("./AnimationUtil.js");
|
|
14
|
-
var _TargetExecutor = require("./TargetExecutor.js");
|
|
15
|
-
var _App = require("./App.js");
|
|
16
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
17
2
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
18
3
|
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."); }
|
|
@@ -32,11 +17,21 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
|
|
|
32
17
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
33
18
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
34
19
|
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); }
|
|
20
|
+
import { BracketGenerator } from "./BracketGenerator.js";
|
|
21
|
+
import { TUtil } from "./TUtil.js";
|
|
22
|
+
import { TargetUtil } from "./TargetUtil.js";
|
|
23
|
+
import { TargetData } from "./TargetData.js";
|
|
24
|
+
import { TModelUtil } from "./TModelUtil.js";
|
|
25
|
+
import { ScheduleUtil } from "./ScheduleUtil.js";
|
|
26
|
+
import { AnimationUtil } from "./AnimationUtil.js";
|
|
27
|
+
import { TargetExecutor } from "./TargetExecutor.js";
|
|
28
|
+
import { getTargetManager, tRoot, getEvents } from "./App.js";
|
|
29
|
+
|
|
35
30
|
/*
|
|
36
31
|
* It calculates the locations and dimensions of all objects and triggers the calculation of all targets.
|
|
37
32
|
* It functions as an integral part of TargetJ process cycle, playing a crucial role."
|
|
38
33
|
*/
|
|
39
|
-
var LocationManager =
|
|
34
|
+
var LocationManager = /*#__PURE__*/function () {
|
|
40
35
|
function LocationManager() {
|
|
41
36
|
_classCallCheck(this, LocationManager);
|
|
42
37
|
this.hasLocationList = [];
|
|
@@ -73,9 +68,9 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
73
68
|
var child = activatedList[i++];
|
|
74
69
|
var activatedTargets = child.activatedTargets.slice(0);
|
|
75
70
|
child.activatedTargets.length = 0;
|
|
76
|
-
|
|
71
|
+
getTargetManager().applyTargetValues(child, activatedTargets);
|
|
77
72
|
if (child.updatingTargetList.length > 0) {
|
|
78
|
-
|
|
73
|
+
getTargetManager().setActualValues(child, child.updatingTargetList);
|
|
79
74
|
}
|
|
80
75
|
if (!this.hasLocationMap[child.oid]) {
|
|
81
76
|
this.addToLocationList(child);
|
|
@@ -108,7 +103,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
108
103
|
this.hasLocationMap = {};
|
|
109
104
|
this.locationListStats = [];
|
|
110
105
|
stack = [{
|
|
111
|
-
container:
|
|
106
|
+
container: tRoot(),
|
|
112
107
|
stage: 'init',
|
|
113
108
|
children: [],
|
|
114
109
|
viewport: undefined,
|
|
@@ -116,7 +111,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
116
111
|
}];
|
|
117
112
|
ctx = {
|
|
118
113
|
budgetMs: budgetMs,
|
|
119
|
-
sliceStart:
|
|
114
|
+
sliceStart: TUtil.now(),
|
|
120
115
|
calcEpoch: calcEpoch
|
|
121
116
|
};
|
|
122
117
|
_context.next = 13;
|
|
@@ -201,14 +196,14 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
201
196
|
child.addToStyleTargetList('width');
|
|
202
197
|
}
|
|
203
198
|
if (child.isInFlow()) {
|
|
204
|
-
if (
|
|
199
|
+
if (TUtil.isNumber(child.val('appendNewLine'))) {
|
|
205
200
|
viewport.appendNewLine();
|
|
206
201
|
} else {
|
|
207
202
|
viewport.nextLocation();
|
|
208
203
|
}
|
|
209
204
|
container.calcContentWidthHeight();
|
|
210
205
|
}
|
|
211
|
-
if (child.hasEventDirty() ||
|
|
206
|
+
if (child.hasEventDirty() || getEvents().getEventType() || getEvents().hasDelta()) {
|
|
212
207
|
_this.checkExternalEvents(child);
|
|
213
208
|
if (child.hasEventDirty()) {
|
|
214
209
|
child.processedEventEpoch = child.eventDirtyEpoch;
|
|
@@ -232,9 +227,9 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
232
227
|
return;
|
|
233
228
|
}
|
|
234
229
|
if (child.isDomIsland()) {
|
|
235
|
-
if (child.originWindowEpoch !==
|
|
230
|
+
if (child.originWindowEpoch !== getEvents().getWindowEpoch() && child.hasDom()) {
|
|
236
231
|
child.calcAbsolutePositionFromDom();
|
|
237
|
-
child.originWindowEpoch =
|
|
232
|
+
child.originWindowEpoch = getEvents().getWindowEpoch();
|
|
238
233
|
}
|
|
239
234
|
}
|
|
240
235
|
viewport.setCurrentChild(child);
|
|
@@ -266,10 +261,10 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
266
261
|
}
|
|
267
262
|
}
|
|
268
263
|
_this.addToLocationList(child);
|
|
269
|
-
if (!
|
|
264
|
+
if (!TModelUtil.isXDefined(child)) {
|
|
270
265
|
child.actualValues.x = child.x;
|
|
271
266
|
}
|
|
272
|
-
if (!
|
|
267
|
+
if (!TModelUtil.isYDefined(child)) {
|
|
273
268
|
child.actualValues.y = child.y;
|
|
274
269
|
}
|
|
275
270
|
if (!child.isDomIsland()) {
|
|
@@ -310,7 +305,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
310
305
|
}
|
|
311
306
|
return _context2.abrupt("return");
|
|
312
307
|
case 7:
|
|
313
|
-
if (!(
|
|
308
|
+
if (!(TUtil.now() - ctx.sliceStart > ctx.budgetMs)) {
|
|
314
309
|
_context2.next = 14;
|
|
315
310
|
break;
|
|
316
311
|
}
|
|
@@ -323,7 +318,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
323
318
|
}
|
|
324
319
|
return _context2.abrupt("return");
|
|
325
320
|
case 12:
|
|
326
|
-
ctx.sliceStart =
|
|
321
|
+
ctx.sliceStart = TUtil.now();
|
|
327
322
|
return _context2.abrupt("continue", 4);
|
|
328
323
|
case 14:
|
|
329
324
|
job = stack[stack.length - 1];
|
|
@@ -400,14 +395,14 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
400
395
|
value: function calcChildren(container) {
|
|
401
396
|
container.getChildren();
|
|
402
397
|
if (container.shouldBeBracketed()) {
|
|
403
|
-
return
|
|
398
|
+
return BracketGenerator.generate(container);
|
|
404
399
|
} else {
|
|
405
400
|
container.lastChildrenUpdate.additions.length = 0;
|
|
406
401
|
container.lastChildrenUpdate.deletions.length = 0;
|
|
407
402
|
}
|
|
408
|
-
if (
|
|
409
|
-
delete
|
|
410
|
-
delete
|
|
403
|
+
if (BracketGenerator.bracketMap[container.oid]) {
|
|
404
|
+
delete BracketGenerator.bracketMap[container.oid];
|
|
405
|
+
delete BracketGenerator.pageMap[container.oid];
|
|
411
406
|
}
|
|
412
407
|
return container.getChildren();
|
|
413
408
|
}
|
|
@@ -429,10 +424,10 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
429
424
|
};
|
|
430
425
|
}
|
|
431
426
|
}
|
|
432
|
-
if (!
|
|
427
|
+
if (!TModelUtil.isXDefined(child)) {
|
|
433
428
|
child.actualValues.x = child.x;
|
|
434
429
|
}
|
|
435
|
-
if (!
|
|
430
|
+
if (!TModelUtil.isYDefined(child)) {
|
|
436
431
|
child.actualValues.y = child.y;
|
|
437
432
|
}
|
|
438
433
|
if (!child.isDomIsland()) {
|
|
@@ -447,7 +442,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
447
442
|
}
|
|
448
443
|
this.calculateVisibility(child);
|
|
449
444
|
if (child.isInFlow()) {
|
|
450
|
-
if (
|
|
445
|
+
if (TUtil.isNumber(child.val('appendNewLine'))) {
|
|
451
446
|
viewport.appendNewLine();
|
|
452
447
|
} else {
|
|
453
448
|
viewport.nextLocation();
|
|
@@ -466,7 +461,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
466
461
|
tmodel.visibilityStatus = {};
|
|
467
462
|
}
|
|
468
463
|
tmodel.visibilityStatus.lastIsVisible = tmodel.visibilityStatus.isVisible;
|
|
469
|
-
if (
|
|
464
|
+
if (TUtil.isDefined(tmodel.targets.isVisible)) {
|
|
470
465
|
if (typeof tmodel.targets.isVisible.value === 'function') {
|
|
471
466
|
nowVisible = tmodel.targets.isVisible.value.call(tmodel);
|
|
472
467
|
} else {
|
|
@@ -488,7 +483,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
488
483
|
if (tmodel.isNowInvisible) {
|
|
489
484
|
this.addToLocationList(tmodel);
|
|
490
485
|
}
|
|
491
|
-
|
|
486
|
+
ScheduleUtil.pauseResumeSchedule(tmodel);
|
|
492
487
|
if (tmodel.type !== 'BI' && tmodel.isVisible() && tmodel.isInFlow() && tmodel.getParent()) {
|
|
493
488
|
tmodel.getParent().visibleChildren.push(tmodel);
|
|
494
489
|
}
|
|
@@ -506,7 +501,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
506
501
|
try {
|
|
507
502
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
508
503
|
var key = _step.value;
|
|
509
|
-
|
|
504
|
+
getTargetManager().applyTargetValue(tmodel, key);
|
|
510
505
|
}
|
|
511
506
|
} catch (err) {
|
|
512
507
|
_iterator.e(err);
|
|
@@ -514,22 +509,22 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
514
509
|
_iterator.f();
|
|
515
510
|
}
|
|
516
511
|
}
|
|
517
|
-
|
|
512
|
+
ScheduleUtil.pauseResumeSchedule(tmodel);
|
|
518
513
|
tmodel.activateChangedPassiveTargets();
|
|
519
|
-
|
|
514
|
+
getTargetManager().applyTargetValues(tmodel);
|
|
520
515
|
if (tmodel.updatingTargetList.length > 0) {
|
|
521
|
-
|
|
516
|
+
getTargetManager().setActualValues(tmodel, tmodel.updatingTargetList);
|
|
522
517
|
}
|
|
523
|
-
if (
|
|
518
|
+
if (TModelUtil.shouldMeasureWidthFromDom(tmodel)) {
|
|
524
519
|
if (tmodel.hasDom()) {
|
|
525
|
-
|
|
520
|
+
TModelUtil.setWidthFromDom(tmodel);
|
|
526
521
|
} else {
|
|
527
522
|
tmodel.markLayoutDirty('width');
|
|
528
523
|
}
|
|
529
524
|
}
|
|
530
|
-
if (
|
|
525
|
+
if (TModelUtil.shouldMeasureHeightFromDom(tmodel)) {
|
|
531
526
|
if (tmodel.hasDom()) {
|
|
532
|
-
|
|
527
|
+
TModelUtil.setHeightFromDom(tmodel);
|
|
533
528
|
} else {
|
|
534
529
|
tmodel.markLayoutDirty('height');
|
|
535
530
|
}
|
|
@@ -544,7 +539,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
544
539
|
var externalEventMap = tmodel.externalEventMap;
|
|
545
540
|
if ((externalEventMap === null || externalEventMap === void 0 ? void 0 : externalEventMap.size) > 0) {
|
|
546
541
|
var eventTargets = [];
|
|
547
|
-
var eventMap =
|
|
542
|
+
var eventMap = TargetData.allEventMap;
|
|
548
543
|
var _iterator2 = _createForOfIteratorHelper(externalEventMap),
|
|
549
544
|
_step2;
|
|
550
545
|
try {
|
|
@@ -567,7 +562,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
567
562
|
key: "checkInternalEvents",
|
|
568
563
|
value: function checkInternalEvents(tmodel) {
|
|
569
564
|
var eventTargets = [];
|
|
570
|
-
var eventMap =
|
|
565
|
+
var eventMap = TargetData.internalEventMap;
|
|
571
566
|
var internalEventMap = tmodel.internalEventMap;
|
|
572
567
|
if ((internalEventMap === null || internalEventMap === void 0 ? void 0 : internalEventMap.size) > 0) {
|
|
573
568
|
var _iterator3 = _createForOfIteratorHelper(internalEventMap),
|
|
@@ -597,18 +592,18 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
597
592
|
if (tmodel.targetValues[targetName]) {
|
|
598
593
|
tmodel.targetValues[targetName].status = '';
|
|
599
594
|
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
595
|
+
TargetExecutor.prepareTarget(tmodel, targetName);
|
|
596
|
+
TargetExecutor.resolveTargetValue(tmodel, targetName);
|
|
597
|
+
TargetExecutor.updateTarget(tmodel, tmodel.targetValues[targetName], targetName, false);
|
|
603
598
|
var result = tmodel.val(targetName);
|
|
604
599
|
if (Array.isArray(result)) {
|
|
605
600
|
result.forEach(function (t) {
|
|
606
|
-
return
|
|
601
|
+
return TargetUtil.activateSingleTarget(tmodel, t);
|
|
607
602
|
});
|
|
608
603
|
} else if (typeof result === 'string') {
|
|
609
|
-
|
|
604
|
+
TargetUtil.activateSingleTarget(tmodel, result);
|
|
610
605
|
}
|
|
611
|
-
|
|
606
|
+
TargetUtil.shouldActivateNextTarget(tmodel, targetName);
|
|
612
607
|
}
|
|
613
608
|
});
|
|
614
609
|
}
|
|
@@ -645,7 +640,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
645
640
|
valuesToSnap.push(tmodel.val('y'));
|
|
646
641
|
}
|
|
647
642
|
if (keysToSnap.length > 0) {
|
|
648
|
-
|
|
643
|
+
AnimationUtil.overrideAnimatedKeyWithSnap(tmodel, keysToSnap, valuesToSnap);
|
|
649
644
|
return;
|
|
650
645
|
}
|
|
651
646
|
}
|
|
@@ -655,7 +650,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
655
650
|
}, {
|
|
656
651
|
key: "addToTransformTargetList",
|
|
657
652
|
value: function addToTransformTargetList(tmodel, key) {
|
|
658
|
-
if (
|
|
653
|
+
if (TModelUtil.getTransformValue(tmodel, key) !== Math.floor(tmodel.tfMap[key])) {
|
|
659
654
|
tmodel.addToStyleTargetList(key);
|
|
660
655
|
}
|
|
661
656
|
}
|
|
@@ -665,4 +660,5 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
665
660
|
return this.activatedMap[tmodel.oid];
|
|
666
661
|
}
|
|
667
662
|
}]);
|
|
668
|
-
}();
|
|
663
|
+
}();
|
|
664
|
+
export { LocationManager };
|
package/build/Moves.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Moves = void 0;
|
|
7
|
-
var _App = require("./App.js");
|
|
8
|
-
var _TUtil = require("./TUtil.js");
|
|
9
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
2
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
3
|
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); } }
|
|
@@ -13,12 +5,15 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
|
|
|
13
5
|
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; }
|
|
14
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
7
|
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); }
|
|
8
|
+
import { getScreenWidth } from "./App.js";
|
|
9
|
+
import { TUtil } from "./TUtil.js";
|
|
10
|
+
|
|
16
11
|
/**
|
|
17
12
|
* It offers utility functions for common movement patterns. They generate
|
|
18
13
|
* a list of numbers that serve as target values, which can be iterated through
|
|
19
14
|
* using the steps, interval, and loop features of targets
|
|
20
15
|
*/
|
|
21
|
-
var Moves =
|
|
16
|
+
var Moves = /*#__PURE__*/function () {
|
|
22
17
|
function Moves() {
|
|
23
18
|
_classCallCheck(this, Moves);
|
|
24
19
|
}
|
|
@@ -29,7 +24,7 @@ var Moves = exports.Moves = /*#__PURE__*/function () {
|
|
|
29
24
|
_ref$yStart = _ref.yStart,
|
|
30
25
|
yStart = _ref$yStart === void 0 ? undefined : _ref$yStart,
|
|
31
26
|
_ref$xStart = _ref.xStart,
|
|
32
|
-
xStart = _ref$xStart === void 0 ?
|
|
27
|
+
xStart = _ref$xStart === void 0 ? getScreenWidth() / 2 : _ref$xStart,
|
|
33
28
|
_ref$widthStart = _ref.widthStart,
|
|
34
29
|
widthStart = _ref$widthStart === void 0 ? 50 : _ref$widthStart,
|
|
35
30
|
_ref$heightStart = _ref.heightStart,
|
|
@@ -43,7 +38,7 @@ var Moves = exports.Moves = /*#__PURE__*/function () {
|
|
|
43
38
|
_ref$rIncrement = _ref.rIncrement,
|
|
44
39
|
rIncrement = _ref$rIncrement === void 0 ? 360 : _ref$rIncrement;
|
|
45
40
|
var bounce = Math.max(10, (to - from) * bFactor);
|
|
46
|
-
var ys =
|
|
41
|
+
var ys = TUtil.isDefined(yStart) ? [yStart, from] : [from];
|
|
47
42
|
var xs = [xStart];
|
|
48
43
|
var widths = [widthStart];
|
|
49
44
|
var heights = [heightStart];
|
|
@@ -110,12 +105,12 @@ var Moves = exports.Moves = /*#__PURE__*/function () {
|
|
|
110
105
|
bFactor = _ref2$bFactor === void 0 ? 0.5 : _ref2$bFactor,
|
|
111
106
|
_ref2$cFactor = _ref2.cFactor,
|
|
112
107
|
cFactor = _ref2$cFactor === void 0 ? 0.7 : _ref2$cFactor;
|
|
113
|
-
from =
|
|
114
|
-
to =
|
|
115
|
-
widthStart =
|
|
116
|
-
heightStart =
|
|
117
|
-
yStart =
|
|
118
|
-
xStart =
|
|
108
|
+
from = TUtil.isDefined(from) ? from : tmodel.getY() - 70;
|
|
109
|
+
to = TUtil.isDefined(to) ? to : tmodel.getY();
|
|
110
|
+
widthStart = TUtil.isDefined(widthStart) ? widthStart : tmodel.getWidth();
|
|
111
|
+
heightStart = TUtil.isDefined(heightStart) ? heightStart : tmodel.getHeight();
|
|
112
|
+
yStart = TUtil.isDefined(yStart) ? yStart : tmodel.getY();
|
|
113
|
+
xStart = TUtil.isDefined(xStart) ? xStart : tmodel.getX();
|
|
119
114
|
var rIncrement = 0;
|
|
120
115
|
var bounce = Moves.bounce(from, to, {
|
|
121
116
|
yStart: yStart,
|
|
@@ -144,9 +139,9 @@ var Moves = exports.Moves = /*#__PURE__*/function () {
|
|
|
144
139
|
cFactor = _ref3$cFactor === void 0 ? 0.3 : _ref3$cFactor,
|
|
145
140
|
_ref3$strength = _ref3.strength,
|
|
146
141
|
strength = _ref3$strength === void 0 ? 20 : _ref3$strength;
|
|
147
|
-
var widthStart =
|
|
148
|
-
var heightStart =
|
|
149
|
-
var resolvedXStart =
|
|
142
|
+
var widthStart = TUtil.isDefined(width) ? width : tmodel.getWidth();
|
|
143
|
+
var heightStart = TUtil.isDefined(height) ? height : tmodel.getHeight();
|
|
144
|
+
var resolvedXStart = TUtil.isDefined(xStart) ? xStart : tmodel.getX();
|
|
150
145
|
var yStart = tmodel.getY();
|
|
151
146
|
var bounce = Moves.bounce(yStart - strength, yStart, {
|
|
152
147
|
xStart: resolvedXStart,
|
|
@@ -202,4 +197,5 @@ var Moves = exports.Moves = /*#__PURE__*/function () {
|
|
|
202
197
|
}
|
|
203
198
|
}]);
|
|
204
199
|
}();
|
|
205
|
-
_defineProperty(Moves, "shakeMap", {});
|
|
200
|
+
_defineProperty(Moves, "shakeMap", {});
|
|
201
|
+
export { Moves };
|