targetj 1.0.238 → 1.0.239
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 +5 -1
- package/build/AnimationManager.js +340 -298
- package/build/AnimationUtil.js +556 -8
- package/build/BaseModel.js +176 -88
- package/build/Bracket.js +0 -3
- package/build/LocationManager.js +34 -136
- package/build/PageManager.js +29 -7
- package/build/RunScheduler.js +1 -3
- package/build/ScheduleUtil.js +181 -0
- package/build/TModel.js +12 -7
- package/build/TModelManager.js +72 -18
- package/build/TUtil.js +141 -52
- package/build/TargetExecutor.js +50 -10
- package/build/TargetManager.js +160 -132
- package/build/TargetUtil.js +86 -13
- package/build/VisibilityUtil.js +1 -1
- package/build/index.js +11 -0
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/TargetManager.js
CHANGED
|
@@ -10,7 +10,7 @@ var _TUtil = require("./TUtil.js");
|
|
|
10
10
|
var _TargetUtil = require("./TargetUtil.js");
|
|
11
11
|
var _TModelUtil = require("./TModelUtil.js");
|
|
12
12
|
var _SearchUtil = require("./SearchUtil.js");
|
|
13
|
-
var
|
|
13
|
+
var _ScheduleUtil = require("./ScheduleUtil.js");
|
|
14
14
|
var _AnimationUtil = require("./AnimationUtil.js");
|
|
15
15
|
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); }
|
|
16
16
|
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; } } }; }
|
|
@@ -56,6 +56,9 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
|
|
|
56
56
|
tmodel.removeFromActiveTargets(key);
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
+
if (_ScheduleUtil.ScheduleUtil.shouldPauseTarget(tmodel, key)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
59
62
|
if (tmodel.isExecuted(key) && tmodel.hasUpdatingImperativeTargets(key)) {
|
|
60
63
|
return;
|
|
61
64
|
}
|
|
@@ -63,7 +66,7 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
|
|
|
63
66
|
if (tmodel.isScheduledPending(key)) {
|
|
64
67
|
return;
|
|
65
68
|
}
|
|
66
|
-
var schedulePeriod =
|
|
69
|
+
var schedulePeriod = _ScheduleUtil.ScheduleUtil.scheduleExecution(tmodel, key);
|
|
67
70
|
if (schedulePeriod > 0) {
|
|
68
71
|
(0, _App.getRunScheduler)().schedule(schedulePeriod, "targetSchedule__".concat(tmodel.oid));
|
|
69
72
|
return;
|
|
@@ -95,7 +98,10 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
|
|
|
95
98
|
try {
|
|
96
99
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
97
100
|
var key = _step2.value;
|
|
98
|
-
|
|
101
|
+
if (_ScheduleUtil.ScheduleUtil.shouldPauseTarget(tmodel, key)) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
schedulePeriod = _ScheduleUtil.ScheduleUtil.scheduleExecution(tmodel, key);
|
|
99
105
|
if (schedulePeriod > 0) {
|
|
100
106
|
(0, _App.getRunScheduler)().schedule(schedulePeriod, "setActualValues-".concat(tmodel.oid));
|
|
101
107
|
} else {
|
|
@@ -184,7 +190,7 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
|
|
|
184
190
|
originalTModel = this.findOriginalTModel(tmodel, originalTargetName);
|
|
185
191
|
originalTarget = originalTModel ? originalTModel.targets[originalTargetName] : null;
|
|
186
192
|
}
|
|
187
|
-
var newStatus = this.calculateTargetStatus(tmodel,
|
|
193
|
+
var newStatus = this.calculateTargetStatus(tmodel, key);
|
|
188
194
|
tmodel.setTargetStatus(key, newStatus);
|
|
189
195
|
if (tmodel.isTargetImperative(key)) {
|
|
190
196
|
var capKey = _TargetUtil.TargetUtil.getTargetName(_TUtil.TUtil.capitalizeFirstLetter(key));
|
|
@@ -199,6 +205,7 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
|
|
|
199
205
|
tmodel.incrementTargetCycle(key);
|
|
200
206
|
tmodel.resetTargetStep(key);
|
|
201
207
|
tmodel.resetTargetInitialValue(key);
|
|
208
|
+
delete targetValue.valuePointer;
|
|
202
209
|
}
|
|
203
210
|
} else {
|
|
204
211
|
var _tmodel$targets$key;
|
|
@@ -207,6 +214,7 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
|
|
|
207
214
|
tmodel.resetTargetStep(key);
|
|
208
215
|
tmodel.resetTargetInitialValue(key);
|
|
209
216
|
tmodel.resetTargetExecutionFlag(key);
|
|
217
|
+
delete targetValue.valuePointer;
|
|
210
218
|
_TargetExecutor.TargetExecutor.executeDeclarativeTarget(tmodel, key);
|
|
211
219
|
}
|
|
212
220
|
if (typeof ((_tmodel$targets$key = tmodel.targets[key]) === null || _tmodel$targets$key === void 0 ? void 0 : _tmodel$targets$key.onStepsEnd) === "function") {
|
|
@@ -218,7 +226,11 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
|
|
|
218
226
|
}
|
|
219
227
|
}, {
|
|
220
228
|
key: "calculateTargetStatus",
|
|
221
|
-
value: function calculateTargetStatus(tmodel,
|
|
229
|
+
value: function calculateTargetStatus(tmodel, key) {
|
|
230
|
+
var targetValue = tmodel.targetValues[key];
|
|
231
|
+
if (!targetValue) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
222
234
|
var valuePointer = tmodel.getValueListPointer(key);
|
|
223
235
|
var cycle = tmodel.getTargetCycle(key);
|
|
224
236
|
var cycles = tmodel.getTargetCycles(key);
|
|
@@ -233,166 +245,182 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
|
|
|
233
245
|
}
|
|
234
246
|
}
|
|
235
247
|
}, {
|
|
236
|
-
key: "
|
|
237
|
-
value: function
|
|
238
|
-
var
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
var
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
248
|
+
key: "catchupTargetByElapsed",
|
|
249
|
+
value: function catchupTargetByElapsed(tmodel, key) {
|
|
250
|
+
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
251
|
+
_ref$fireEnd = _ref.fireEnd,
|
|
252
|
+
fireEnd = _ref$fireEnd === void 0 ? false : _ref$fireEnd;
|
|
253
|
+
var targetValue = tmodel.targetValues[key];
|
|
254
|
+
if (!targetValue) {
|
|
255
|
+
return {
|
|
256
|
+
done: false
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
var progress = _TUtil.TUtil.advanceTargetByElapsed(tmodel, key);
|
|
260
|
+
var step = progress.step;
|
|
261
|
+
var valuePointer = progress.valuePointer;
|
|
262
|
+
var cycle = progress.cycle;
|
|
263
|
+
var theValue = tmodel.getTargetValue(key);
|
|
264
|
+
var steps = tmodel.getTargetSteps(key);
|
|
265
|
+
var cycles = tmodel.getTargetCycles(key);
|
|
266
|
+
if (progress.done) {
|
|
267
|
+
var _targetValue$valueLis, _targetValue$valueLis2, _targetValue$valueLis3;
|
|
268
|
+
var finalValue = (_targetValue$valueLis = targetValue.valueList) !== null && _targetValue$valueLis !== void 0 && _targetValue$valueLis.length ? targetValue.valueList[targetValue.valueList.length - 1] : theValue;
|
|
269
|
+
tmodel.val(key, finalValue);
|
|
270
|
+
tmodel.setActual(key, finalValue);
|
|
271
|
+
tmodel.addToStyleTargetList(key);
|
|
272
|
+
targetValue.step = steps;
|
|
273
|
+
targetValue.valuePointer = (_targetValue$valueLis2 = (_targetValue$valueLis3 = targetValue.valueList) === null || _targetValue$valueLis3 === void 0 ? void 0 : _targetValue$valueLis3.length) !== null && _targetValue$valueLis2 !== void 0 ? _targetValue$valueLis2 : valuePointer;
|
|
274
|
+
targetValue.value = finalValue;
|
|
275
|
+
targetValue.cycle = cycles;
|
|
276
|
+
delete targetValue.catchupAt;
|
|
277
|
+
if (fireEnd) {
|
|
278
|
+
this.fireOnEnd(tmodel, key);
|
|
254
279
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
280
|
+
return {
|
|
281
|
+
done: true,
|
|
282
|
+
step: steps,
|
|
283
|
+
cycle: cycles,
|
|
284
|
+
valuePointer: targetValue.valuePointer
|
|
260
285
|
};
|
|
261
|
-
|
|
262
|
-
|
|
286
|
+
}
|
|
287
|
+
var initialValue = tmodel.getTargetInitialValue(key);
|
|
288
|
+
if (!_TUtil.TUtil.isDefined(initialValue)) {
|
|
289
|
+
initialValue = this.resolveInitialValue(tmodel, key, theValue);
|
|
290
|
+
tmodel.setTargetInitialValue(key, initialValue);
|
|
291
|
+
}
|
|
292
|
+
var value = step > 0 ? _TModelUtil.TModelUtil.easingMorph(tmodel, key, initialValue, theValue, step, steps) : initialValue;
|
|
293
|
+
tmodel.val(key, value);
|
|
294
|
+
tmodel.setActual(key, value);
|
|
295
|
+
tmodel.addToStyleTargetList(key);
|
|
296
|
+
targetValue.step = step;
|
|
297
|
+
targetValue.valuePointer = valuePointer;
|
|
298
|
+
targetValue.cycle = cycle;
|
|
299
|
+
return {
|
|
300
|
+
done: false,
|
|
301
|
+
step: step,
|
|
302
|
+
cycle: cycle,
|
|
303
|
+
valuePointer: valuePointer
|
|
263
304
|
};
|
|
264
|
-
var keyDuration = 0;
|
|
265
|
-
if (targetValue.valueList && targetValue.valueList.length) {
|
|
266
|
-
var valueList = targetValue.valueList;
|
|
267
|
-
var stepList = targetValue.stepList || [1];
|
|
268
|
-
var intervalList = targetValue.intervalList;
|
|
269
|
-
var step = targetValue.step;
|
|
270
|
-
if (!skipStartFrame) {
|
|
271
|
-
var frame = getFrameAtTime(0);
|
|
272
|
-
if (isTransform) {
|
|
273
|
-
frame.tfMap[cleanKey] = step > 0 && _TUtil.TUtil.isDefined(tmodel.val(key)) ? tmodel.val(key) : valueList[0];
|
|
274
|
-
tmodel.val(key, frame.tfMap[cleanKey]);
|
|
275
|
-
} else {
|
|
276
|
-
frame.styleMap[cleanKey] = valueList[0];
|
|
277
|
-
tmodel.val(key, frame.styleMap[cleanKey]);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
for (var i = 1; i < valueList.length; i++) {
|
|
281
|
-
var stepValue = stepList[(i - 1) % stepList.length];
|
|
282
|
-
var intervalValue = intervalList[(i - 1) % intervalList.length];
|
|
283
|
-
var duration = stepValue * intervalValue;
|
|
284
|
-
keyDuration += duration;
|
|
285
|
-
var _frame2 = getFrameAtTime(keyDuration);
|
|
286
|
-
if (isTransform) {
|
|
287
|
-
_frame2.tfMap[cleanKey] = valueList[i];
|
|
288
|
-
} else {
|
|
289
|
-
_frame2.styleMap[cleanKey] = valueList[i];
|
|
290
|
-
}
|
|
291
|
-
_frame2.keyMeta.set(cleanKey, {
|
|
292
|
-
steps: stepValue,
|
|
293
|
-
interval: intervalValue
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
targetValue.valuePointer = valueList.length;
|
|
297
|
-
} else {
|
|
298
|
-
interval = interval || 8;
|
|
299
|
-
keyDuration = steps * interval;
|
|
300
|
-
if (!skipStartFrame) {
|
|
301
|
-
var frame0 = getFrameAtTime(0);
|
|
302
|
-
if (isTransform) {
|
|
303
|
-
frame0.tfMap[cleanKey] = from;
|
|
304
|
-
} else {
|
|
305
|
-
frame0.styleMap[cleanKey] = from;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
var frame1 = getFrameAtTime(keyDuration);
|
|
309
|
-
if (isTransform) {
|
|
310
|
-
frame1.tfMap[cleanKey] = to;
|
|
311
|
-
} else {
|
|
312
|
-
frame1.styleMap[cleanKey] = to;
|
|
313
|
-
}
|
|
314
|
-
tmodel.val(key, from);
|
|
315
|
-
frame1.keyMeta.set(cleanKey, {
|
|
316
|
-
steps: steps,
|
|
317
|
-
interval: interval
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
if (tmodel.getTargetEasing(key)) {
|
|
321
|
-
batch.easing = tmodel.getTargetEasing(key);
|
|
322
|
-
}
|
|
323
|
-
batch.totalDuration = Math.max(0, batch.totalDuration, timeShift + keyDuration);
|
|
324
|
-
((_batch$keyMap = batch.keyMap)[cleanKey] || (_batch$keyMap[cleanKey] = new Set())).add(key);
|
|
325
|
-
tmodel.removeFromUpdatingTargets(key);
|
|
326
|
-
return keyDuration;
|
|
327
305
|
}
|
|
328
306
|
}, {
|
|
329
307
|
key: "setActualValue",
|
|
330
308
|
value: function setActualValue(tmodel, key) {
|
|
309
|
+
var _catchup$step, _catchup$valuePointer;
|
|
331
310
|
var targetValue = tmodel.targetValues[key];
|
|
332
311
|
if (!targetValue) {
|
|
333
312
|
return;
|
|
334
313
|
}
|
|
335
|
-
if (!
|
|
336
|
-
(0, _App.getRunScheduler)().schedule(15, "setActualValue-postpone-".concat(tmodel.oid, "}"));
|
|
314
|
+
if (!this.canUpdateTarget(tmodel, key)) {
|
|
337
315
|
return;
|
|
338
316
|
}
|
|
339
|
-
var
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
var cycle = tmodel.getTargetCycle(key);
|
|
344
|
-
var valuePointer = tmodel.getValueListPointer(key);
|
|
345
|
-
var interval = tmodel.getTargetInterval(key);
|
|
346
|
-
var initialValue = tmodel.getTargetInitialValue(key);
|
|
347
|
-
var lastUpdateTime = tmodel.getLastUpdate(key);
|
|
348
|
-
var now = _TUtil.TUtil.now();
|
|
349
|
-
if (!_TUtil.TUtil.isDefined(initialValue)) {
|
|
350
|
-
initialValue = _TUtil.TUtil.isDefined(tmodel.val(key)) ? tmodel.val(key) : typeof theValue === 'number' ? 0 : undefined;
|
|
351
|
-
tmodel.setTargetInitialValue(key, initialValue);
|
|
317
|
+
var state = this.getTargetUpdateState(tmodel, key);
|
|
318
|
+
if (!_TUtil.TUtil.isDefined(state.initialValue)) {
|
|
319
|
+
state.initialValue = this.resolveInitialValue(tmodel, key, state.theValue);
|
|
320
|
+
tmodel.setTargetInitialValue(key, state.initialValue);
|
|
352
321
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
this.handleWebAnimationAPI(tmodel, cleanKey, key, targetValue, initialValue, theValue, steps, interval, c * cycleDuration, true);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
322
|
+
var catchup = this.catchupTargetByElapsed(tmodel, key, {
|
|
323
|
+
fireEnd: true
|
|
324
|
+
});
|
|
325
|
+
if (catchup.done) {
|
|
326
|
+
(0, _App.getRunScheduler)().scheduleOnlyIfEarlier(1, "".concat(tmodel.oid, "---").concat(key, "-catchup-finished"));
|
|
361
327
|
return;
|
|
362
328
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
329
|
+
var step = (_catchup$step = catchup.step) !== null && _catchup$step !== void 0 ? _catchup$step : 0;
|
|
330
|
+
var valuePointer = (_catchup$valuePointer = catchup.valuePointer) !== null && _catchup$valuePointer !== void 0 ? _catchup$valuePointer : tmodel.getValueListPointer(key);
|
|
331
|
+
if (tmodel.canBeAnimated(state.cleanKey)) {
|
|
332
|
+
this.animateActualValue(tmodel, key, targetValue, state, step, valuePointer);
|
|
333
|
+
} else {
|
|
334
|
+
this.updateActualValue(tmodel, key, targetValue, state, step, valuePointer);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}, {
|
|
338
|
+
key: "canUpdateTarget",
|
|
339
|
+
value: function canUpdateTarget(tmodel, key) {
|
|
340
|
+
if (!tmodel.isTargetImperative(key) && !tmodel.isTargetEnabled(key)) {
|
|
341
|
+
(0, _App.getRunScheduler)().schedule(15, "setActualValue-postpone-".concat(tmodel.oid));
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
}, {
|
|
347
|
+
key: "getTargetUpdateState",
|
|
348
|
+
value: function getTargetUpdateState(tmodel, key) {
|
|
349
|
+
return {
|
|
350
|
+
theValue: tmodel.getTargetValue(key),
|
|
351
|
+
cleanKey: _TargetUtil.TargetUtil.getTargetName(key),
|
|
352
|
+
steps: tmodel.getTargetSteps(key),
|
|
353
|
+
cycle: tmodel.getTargetCycle(key),
|
|
354
|
+
interval: tmodel.getTargetInterval(key),
|
|
355
|
+
initialValue: tmodel.getTargetInitialValue(key),
|
|
356
|
+
lastUpdateTime: tmodel.getLastUpdate(key),
|
|
357
|
+
now: _TUtil.TUtil.now()
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
}, {
|
|
361
|
+
key: "resolveInitialValue",
|
|
362
|
+
value: function resolveInitialValue(tmodel, key, theValue) {
|
|
363
|
+
if (_TUtil.TUtil.isDefined(tmodel.val(key))) {
|
|
364
|
+
return tmodel.val(key);
|
|
365
|
+
}
|
|
366
|
+
if (typeof theValue === 'number') {
|
|
367
|
+
return 0;
|
|
368
|
+
}
|
|
369
|
+
return undefined;
|
|
370
|
+
}
|
|
371
|
+
}, {
|
|
372
|
+
key: "animateActualValue",
|
|
373
|
+
value: function animateActualValue(tmodel, key, targetValue, state, step, valuePointer) {
|
|
374
|
+
if (!tmodel.hasDom()) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
var newValue = step > 0 ? _TModelUtil.TModelUtil.easingMorph(tmodel, key, state.initialValue, state.theValue, step, state.steps) : state.initialValue;
|
|
378
|
+
var cycles = tmodel.isTargetImperative(key) ? tmodel.getTargetCycles(key) : 0;
|
|
379
|
+
var cycleDuration = _AnimationUtil.AnimationUtil.handleWebAnimationAPI(tmodel, state.cleanKey, key, targetValue, newValue, state.theValue, valuePointer, step, state.steps, state.interval, 0, false, true);
|
|
380
|
+
for (var c = 1; c < cycles; c++) {
|
|
381
|
+
_AnimationUtil.AnimationUtil.handleWebAnimationAPI(tmodel, state.cleanKey, key, targetValue, newValue, state.theValue, valuePointer, step, state.steps, state.interval, c * cycleDuration, true, false);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}, {
|
|
385
|
+
key: "updateActualValue",
|
|
386
|
+
value: function updateActualValue(tmodel, key, targetValue, state, step, valuePointer) {
|
|
387
|
+
if (step <= state.steps) {
|
|
388
|
+
tmodel.incrementTargetStep(key, state.now, state.lastUpdateTime, state.interval, state.steps);
|
|
389
|
+
var newValue = _TModelUtil.TModelUtil.easingMorph(tmodel, key, state.initialValue, state.theValue, step, state.steps);
|
|
366
390
|
tmodel.val(key, newValue);
|
|
367
391
|
tmodel.setActual(key, newValue);
|
|
368
392
|
tmodel.addToStyleTargetList(key);
|
|
369
393
|
this.fireOnStep(tmodel, key, step);
|
|
370
|
-
if (tmodel.getTargetStep(key) < steps) {
|
|
371
|
-
(0, _App.getRunScheduler)().scheduleOnlyIfEarlier(interval, "".concat(tmodel.oid, "---").concat(key, "-").concat(step, "/").concat(steps, "-").concat(cycle, "-").concat(interval));
|
|
394
|
+
if (tmodel.getTargetStep(key) < state.steps) {
|
|
395
|
+
(0, _App.getRunScheduler)().scheduleOnlyIfEarlier(state.interval, "".concat(tmodel.oid, "---").concat(key, "-").concat(step, "/").concat(state.steps, "-").concat(state.cycle, "-").concat(state.interval));
|
|
372
396
|
return;
|
|
373
397
|
}
|
|
374
398
|
}
|
|
375
|
-
|
|
376
|
-
|
|
399
|
+
this.finishCurrentSegment(tmodel, key, targetValue, state, valuePointer);
|
|
400
|
+
}
|
|
401
|
+
}, {
|
|
402
|
+
key: "finishCurrentSegment",
|
|
403
|
+
value: function finishCurrentSegment(tmodel, key, targetValue, state, valuePointer) {
|
|
404
|
+
tmodel.val(key, state.theValue);
|
|
405
|
+
tmodel.setActual(key, state.theValue);
|
|
377
406
|
tmodel.addToStyleTargetList(key);
|
|
378
|
-
targetValue.step = steps;
|
|
407
|
+
targetValue.step = state.steps;
|
|
379
408
|
tmodel.setLastUpdate(key);
|
|
380
|
-
step = steps;
|
|
381
409
|
var scheduleTime = 1;
|
|
382
410
|
if (targetValue.valueList && valuePointer < targetValue.valueList.length) {
|
|
383
411
|
tmodel.incrementValueListPointer(key);
|
|
384
|
-
|
|
412
|
+
var nextPointer = tmodel.getValueListPointer(key);
|
|
385
413
|
tmodel.resetTargetStep(key);
|
|
386
414
|
targetValue.initialValue = targetValue.value;
|
|
387
|
-
targetValue.value = targetValue.valueList[
|
|
388
|
-
targetValue.steps = targetValue.stepList[(
|
|
389
|
-
targetValue.interval = Array.isArray(targetValue.intervalList) ? targetValue.intervalList[(
|
|
390
|
-
targetValue.easing = targetValue.easingList[(
|
|
391
|
-
scheduleTime = interval;
|
|
415
|
+
targetValue.value = targetValue.valueList[nextPointer];
|
|
416
|
+
targetValue.steps = targetValue.stepList[(nextPointer - 1) % targetValue.stepList.length];
|
|
417
|
+
targetValue.interval = Array.isArray(targetValue.intervalList) ? targetValue.intervalList[(nextPointer - 1) % targetValue.intervalList.length] : 0;
|
|
418
|
+
targetValue.easing = targetValue.easingList[(nextPointer - 1) % targetValue.easingList.length];
|
|
419
|
+
scheduleTime = state.interval;
|
|
392
420
|
} else {
|
|
393
421
|
this.fireOnEnd(tmodel, key);
|
|
394
422
|
}
|
|
395
|
-
(0, _App.getRunScheduler)().scheduleOnlyIfEarlier(scheduleTime, "".concat(tmodel.oid, "---").concat(key, "-").concat(
|
|
423
|
+
(0, _App.getRunScheduler)().scheduleOnlyIfEarlier(scheduleTime, "".concat(tmodel.oid, "---").concat(key, "-").concat(state.steps, "/").concat(state.steps, "-").concat(state.cycle, "-").concat(scheduleTime));
|
|
396
424
|
}
|
|
397
425
|
}]);
|
|
398
426
|
}();
|
package/build/TargetUtil.js
CHANGED
|
@@ -46,6 +46,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
46
46
|
completeCount: 0,
|
|
47
47
|
completeTime: 0,
|
|
48
48
|
executionCount: 0,
|
|
49
|
+
visibleCompleteCount: 0,
|
|
49
50
|
status: '',
|
|
50
51
|
executionFlag: false,
|
|
51
52
|
isImperative: false,
|
|
@@ -301,6 +302,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
301
302
|
}, {
|
|
302
303
|
key: "cleanupTarget",
|
|
303
304
|
value: function cleanupTarget(tmodel, key) {
|
|
305
|
+
TargetUtil.cleanupVisibleComplete(tmodel, key);
|
|
304
306
|
if (tmodel.isTargetComplete(key) || !TargetUtil.isTargetFullyCompleted(tmodel, key)) {
|
|
305
307
|
return false;
|
|
306
308
|
}
|
|
@@ -321,6 +323,36 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
321
323
|
TargetUtil.bubbleInvokerCompletion(tmodel, key);
|
|
322
324
|
return true;
|
|
323
325
|
}
|
|
326
|
+
}, {
|
|
327
|
+
key: "cleanupVisibleComplete",
|
|
328
|
+
value: function cleanupVisibleComplete(tmodel, key) {
|
|
329
|
+
var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : tmodel.targets[key];
|
|
330
|
+
if (!target || typeof target.onVisibleComplete !== "function") {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
var targetValue = tmodel.targetValues[key];
|
|
334
|
+
if (!targetValue) {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
if (TargetUtil.isTargetTreeComplete(tmodel, key, 'visible') !== true) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
var signature = TargetUtil.getVisibleCompletionSignature(tmodel);
|
|
341
|
+
if (targetValue.visibleCompleteSignature === signature) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
targetValue.visibleCompleteSignature = signature;
|
|
345
|
+
target.onVisibleComplete.call(tmodel);
|
|
346
|
+
tmodel.setTargetMethodName(key, "onVisibleComplete");
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
}, {
|
|
350
|
+
key: "getVisibleCompletionSignature",
|
|
351
|
+
value: function getVisibleCompletionSignature(tmodel) {
|
|
352
|
+
return tmodel.visibleChildren.map(function (child) {
|
|
353
|
+
return child.oid;
|
|
354
|
+
}).sort().join('|');
|
|
355
|
+
}
|
|
324
356
|
}, {
|
|
325
357
|
key: "bubbleInvokerCompletion",
|
|
326
358
|
value: function bubbleInvokerCompletion(tmodel, key) {
|
|
@@ -377,12 +409,17 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
377
409
|
}, {
|
|
378
410
|
key: "isTModelComplete",
|
|
379
411
|
value: function isTModelComplete(tmodel) {
|
|
380
|
-
var _state$
|
|
381
|
-
|
|
382
|
-
return false;
|
|
383
|
-
}
|
|
412
|
+
var _state$updatingTarget2, _state$activeTargetLi2, _state$activatedTarge2, _state$lastChildrenUp3, _state$lastChildrenUp4;
|
|
413
|
+
var completionScope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "all";
|
|
384
414
|
var state = tmodel.state();
|
|
385
|
-
|
|
415
|
+
if (completionScope === "visible") {
|
|
416
|
+
var _state$updatingTarget, _state$activeTargetLi, _state$activatedTarge, _state$lastChildrenUp, _state$lastChildrenUp2;
|
|
417
|
+
if (TargetUtil.shouldIgnoreChildForCompletion(tmodel, "visible")) {
|
|
418
|
+
return true;
|
|
419
|
+
}
|
|
420
|
+
return !((_state$updatingTarget = state.updatingTargetList) !== null && _state$updatingTarget !== void 0 && _state$updatingTarget.length) && !((_state$activeTargetLi = state.activeTargetList) !== null && _state$activeTargetLi !== void 0 && _state$activeTargetLi.length) && !((_state$activatedTarge = state.activatedTargets) !== null && _state$activatedTarge !== void 0 && _state$activatedTarge.length) && !tmodel.hasAnimatingTargets() && TargetUtil.isFetchingComplete(tmodel) && TargetUtil.getUpdatingChildren(tmodel, undefined, "visible").size === 0 && TargetUtil.getActiveChildren(tmodel, "visible").size === 0 && !((_state$lastChildrenUp = state.lastChildrenUpdate) !== null && _state$lastChildrenUp !== void 0 && (_state$lastChildrenUp = _state$lastChildrenUp.deletions) !== null && _state$lastChildrenUp !== void 0 && _state$lastChildrenUp.length) && !((_state$lastChildrenUp2 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp2 !== void 0 && (_state$lastChildrenUp2 = _state$lastChildrenUp2.additions) !== null && _state$lastChildrenUp2 !== void 0 && _state$lastChildrenUp2.length) && !tmodel.noDomUpdatingTargets && !tmodel.pendingTargets && !(0, _App.getManager)().needsReattach(tmodel);
|
|
421
|
+
}
|
|
422
|
+
return !((_state$updatingTarget2 = state.updatingTargetList) !== null && _state$updatingTarget2 !== void 0 && _state$updatingTarget2.length) && !((_state$activeTargetLi2 = state.activeTargetList) !== null && _state$activeTargetLi2 !== void 0 && _state$activeTargetLi2.length) && !((_state$activatedTarge2 = state.activatedTargets) !== null && _state$activatedTarge2 !== void 0 && _state$activatedTarge2.length) && !tmodel.hasAnimatingTargets() && TargetUtil.isFetchingComplete(tmodel) && !tmodel.hasAnimatingChildren() && !tmodel.hasUpdatingChildren() && !tmodel.hasActiveChildren() && !((_state$lastChildrenUp3 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp3 !== void 0 && (_state$lastChildrenUp3 = _state$lastChildrenUp3.deletions) !== null && _state$lastChildrenUp3 !== void 0 && _state$lastChildrenUp3.length) && !((_state$lastChildrenUp4 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp4 !== void 0 && (_state$lastChildrenUp4 = _state$lastChildrenUp4.additions) !== null && _state$lastChildrenUp4 !== void 0 && _state$lastChildrenUp4.length) && !tmodel.noDomUpdatingTargets && !tmodel.pendingTargets && !(0, _App.getManager)().needsReattach(tmodel);
|
|
386
423
|
}
|
|
387
424
|
}, {
|
|
388
425
|
key: "isFetchingComplete",
|
|
@@ -447,10 +484,11 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
447
484
|
}
|
|
448
485
|
}, {
|
|
449
486
|
key: "isTargetTreeComplete",
|
|
450
|
-
value: function isTargetTreeComplete(tmodel, key) {
|
|
487
|
+
value: function isTargetTreeComplete(tmodel, key, completionScopeOverride) {
|
|
451
488
|
var target = tmodel.targets[key];
|
|
452
489
|
if (target) {
|
|
453
490
|
var _target$childAction, _target$childAction2, _target$childAction3;
|
|
491
|
+
var completionScope = completionScopeOverride !== null && completionScopeOverride !== void 0 ? completionScopeOverride : target.completionScope;
|
|
454
492
|
var targetType = _typeof(target.value);
|
|
455
493
|
if (_TargetData.TargetData.controlTargetMap[key]) {
|
|
456
494
|
return true;
|
|
@@ -467,13 +505,13 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
467
505
|
if (!tmodel.isTargetComplete(key) && !tmodel.isTargetDone(key)) {
|
|
468
506
|
return 'not done';
|
|
469
507
|
}
|
|
470
|
-
if (((_target$childAction = target.childAction) === null || _target$childAction === void 0 ? void 0 : _target$childAction.length) > 0 && TargetUtil.getUpdatingChildren(tmodel, key,
|
|
508
|
+
if (((_target$childAction = target.childAction) === null || _target$childAction === void 0 ? void 0 : _target$childAction.length) > 0 && TargetUtil.getUpdatingChildren(tmodel, key, completionScope).size > 0) {
|
|
471
509
|
return 'updating children';
|
|
472
510
|
}
|
|
473
|
-
if (((_target$childAction2 = target.childAction) === null || _target$childAction2 === void 0 ? void 0 : _target$childAction2.length) > 0 && TargetUtil.getActiveChildren(tmodel,
|
|
511
|
+
if (((_target$childAction2 = target.childAction) === null || _target$childAction2 === void 0 ? void 0 : _target$childAction2.length) > 0 && TargetUtil.getActiveChildren(tmodel, completionScope).size > 0) {
|
|
474
512
|
return 'active children';
|
|
475
513
|
}
|
|
476
|
-
if (((_target$childAction3 = target.childAction) === null || _target$childAction3 === void 0 ? void 0 : _target$childAction3.length) > 0 && TargetUtil.areTargetChildrenComplete(target.childAction,
|
|
514
|
+
if (((_target$childAction3 = target.childAction) === null || _target$childAction3 === void 0 ? void 0 : _target$childAction3.length) > 0 && TargetUtil.areTargetChildrenComplete(target.childAction, completionScope) !== true) {
|
|
477
515
|
return 'incomplete children';
|
|
478
516
|
}
|
|
479
517
|
if (target.fetchAction && !(0, _App.getLoader)().isLoadingSuccessful(tmodel, key)) {
|
|
@@ -497,12 +535,13 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
497
535
|
if (TargetUtil.shouldIgnoreChildForCompletion(child, completionScope)) {
|
|
498
536
|
continue;
|
|
499
537
|
}
|
|
500
|
-
if (child.exists() && !TargetUtil.isTModelComplete(child)) {
|
|
538
|
+
if (child.exists() && !TargetUtil.isTModelComplete(child, completionScope)) {
|
|
501
539
|
return child.oid;
|
|
502
540
|
}
|
|
503
541
|
if (child.hasChildren()) {
|
|
504
|
-
|
|
505
|
-
|
|
542
|
+
var result = TargetUtil.areTargetChildrenComplete(child.getChildren(), completionScope);
|
|
543
|
+
if (result !== true) {
|
|
544
|
+
return result;
|
|
506
545
|
}
|
|
507
546
|
}
|
|
508
547
|
}
|
|
@@ -559,6 +598,32 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
559
598
|
});
|
|
560
599
|
return childrenMap;
|
|
561
600
|
}
|
|
601
|
+
}, {
|
|
602
|
+
key: "hasVisibleActiveChild",
|
|
603
|
+
value: function hasVisibleActiveChild(tmodel) {
|
|
604
|
+
var _tmodel$activeTargetL, _tmodel$getChildren, _tmodel$getChildren2;
|
|
605
|
+
if (TargetUtil.shouldIgnoreChildForCompletion(tmodel, "visible")) {
|
|
606
|
+
return false;
|
|
607
|
+
}
|
|
608
|
+
if (((_tmodel$activeTargetL = tmodel.activeTargetList) === null || _tmodel$activeTargetL === void 0 ? void 0 : _tmodel$activeTargetL.length) > 0) {
|
|
609
|
+
return true;
|
|
610
|
+
}
|
|
611
|
+
var _iterator4 = _createForOfIteratorHelper((_tmodel$getChildren = (_tmodel$getChildren2 = tmodel.getChildren) === null || _tmodel$getChildren2 === void 0 ? void 0 : _tmodel$getChildren2.call(tmodel)) !== null && _tmodel$getChildren !== void 0 ? _tmodel$getChildren : []),
|
|
612
|
+
_step4;
|
|
613
|
+
try {
|
|
614
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
615
|
+
var child = _step4.value;
|
|
616
|
+
if (TargetUtil.hasVisibleActiveChild(child)) {
|
|
617
|
+
return true;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
} catch (err) {
|
|
621
|
+
_iterator4.e(err);
|
|
622
|
+
} finally {
|
|
623
|
+
_iterator4.f();
|
|
624
|
+
}
|
|
625
|
+
return false;
|
|
626
|
+
}
|
|
562
627
|
}, {
|
|
563
628
|
key: "getActiveChildren",
|
|
564
629
|
value: function getActiveChildren(tmodel) {
|
|
@@ -567,6 +632,12 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
567
632
|
var childrenMap = new Map();
|
|
568
633
|
var children = _toConsumableArray((_tmodel$activeChildre = (_tmodel$activeChildre2 = tmodel.activeChildrenMap) === null || _tmodel$activeChildre2 === void 0 ? void 0 : _tmodel$activeChildre2.values()) !== null && _tmodel$activeChildre !== void 0 ? _tmodel$activeChildre : []);
|
|
569
634
|
children.forEach(function (child) {
|
|
635
|
+
if (completionScope === "visible") {
|
|
636
|
+
if (TargetUtil.hasVisibleActiveChild(child)) {
|
|
637
|
+
childrenMap.set(child.oid, child);
|
|
638
|
+
}
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
570
641
|
if (TargetUtil.shouldIgnoreChildForCompletion(child, completionScope)) {
|
|
571
642
|
return;
|
|
572
643
|
}
|
|
@@ -586,7 +657,8 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
586
657
|
return true;
|
|
587
658
|
}
|
|
588
659
|
if (completionScope === "visible") {
|
|
589
|
-
|
|
660
|
+
var _child$visibilityStat;
|
|
661
|
+
return ((_child$visibilityStat = child.visibilityStatus) === null || _child$visibilityStat === void 0 ? void 0 : _child$visibilityStat.isVisible) !== true;
|
|
590
662
|
}
|
|
591
663
|
return false;
|
|
592
664
|
}
|
|
@@ -800,6 +872,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
800
872
|
targetValue.triggeredByCompleteCount = 0;
|
|
801
873
|
targetValue.resetFlag = true;
|
|
802
874
|
targetValue.nextTargetUpdateCount = 0;
|
|
875
|
+
targetValue.visibleCompleteSignature = undefined;
|
|
803
876
|
targetValue.status = '';
|
|
804
877
|
}
|
|
805
878
|
tmodel.cancelAnimation();
|
package/build/VisibilityUtil.js
CHANGED
|
@@ -45,7 +45,7 @@ var VisibilityUtil = exports.VisibilityUtil = /*#__PURE__*/function () {
|
|
|
45
45
|
status.right = x - visibilityMargin <= clip.r;
|
|
46
46
|
status.left = x + width + visibilityMargin >= clip.x;
|
|
47
47
|
status.bottom = y - child.getTopMargin() - visibilityMargin <= clip.b;
|
|
48
|
-
status.top = y + height + visibilityMargin >= clip.y;
|
|
48
|
+
status.top = y + height + child.getBottomMargin() + visibilityMargin >= clip.y;
|
|
49
49
|
status.clipX = clip.x;
|
|
50
50
|
status.clipY = clip.y;
|
|
51
51
|
status.clipR = clip.r;
|
package/build/index.js
CHANGED
|
@@ -211,4 +211,15 @@ Object.keys(_VisibilityUtil).forEach(function (key) {
|
|
|
211
211
|
return _VisibilityUtil[key];
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
|
+
});
|
|
215
|
+
var _ScheduleUtil = require("./ScheduleUtil.js");
|
|
216
|
+
Object.keys(_ScheduleUtil).forEach(function (key) {
|
|
217
|
+
if (key === "default" || key === "__esModule") return;
|
|
218
|
+
if (key in exports && exports[key] === _ScheduleUtil[key]) return;
|
|
219
|
+
Object.defineProperty(exports, key, {
|
|
220
|
+
enumerable: true,
|
|
221
|
+
get: function get() {
|
|
222
|
+
return _ScheduleUtil[key];
|
|
223
|
+
}
|
|
224
|
+
});
|
|
214
225
|
});
|