targetj 1.0.260 → 1.1.0
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 +3 -0
- package/build/AnimationManager.js +1 -1
- package/build/App.js +10 -2
- package/build/BaseModel.js +8 -4
- package/build/Bracket.js +7 -1
- package/build/EventListener.js +10 -1
- package/build/LocationManager.js +137 -46
- package/build/PageManager.js +35 -134
- package/build/ParticleChild.js +575 -0
- package/build/ParticleRenderer.js +249 -68
- package/build/ParticleRuntime.js +898 -283
- package/build/ParticleTModel.js +610 -227
- package/build/ParticleUtil.js +119 -171
- package/build/RunScheduler.js +10 -3
- package/build/StateManager.js +81 -24
- package/build/StateUtil.js +1 -1
- package/build/TModel.js +1 -1
- package/build/TModelManager.js +105 -90
- package/build/TModelUtil.js +11 -8
- package/build/TUtil.js +57 -52
- package/build/TargetData.js +6 -0
- package/build/TargetExecutor.js +11 -3
- package/build/TargetManager.js +34 -21
- package/build/TargetParser.js +21 -2
- package/build/TargetUtil.js +24 -3
- package/build/VisibilityUtil.js +4 -2
- package/build/index.js +1 -0
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/TargetManager.js
CHANGED
|
@@ -249,6 +249,7 @@ var TargetManager = /*#__PURE__*/function () {
|
|
|
249
249
|
}, {
|
|
250
250
|
key: "catchupTargetByElapsed",
|
|
251
251
|
value: function catchupTargetByElapsed(tmodel, key) {
|
|
252
|
+
var _targetValue$valueLis4;
|
|
252
253
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
253
254
|
_ref$fireEnd = _ref.fireEnd,
|
|
254
255
|
fireEnd = _ref$fireEnd === void 0 ? false : _ref$fireEnd;
|
|
@@ -262,17 +263,16 @@ var TargetManager = /*#__PURE__*/function () {
|
|
|
262
263
|
var step = progress.step;
|
|
263
264
|
var valuePointer = progress.valuePointer;
|
|
264
265
|
var cycle = progress.cycle;
|
|
265
|
-
var theValue = tmodel.getTargetValue(key);
|
|
266
|
-
var steps = tmodel.getTargetSteps(key);
|
|
267
266
|
var cycles = tmodel.getTargetCycles(key);
|
|
268
267
|
if (progress.done) {
|
|
269
|
-
var _targetValue$valueLis, _targetValue$valueLis2, _targetValue$valueLis3;
|
|
270
|
-
var finalValue = (_targetValue$valueLis = targetValue.valueList) !== null && _targetValue$valueLis !== void 0 && _targetValue$valueLis.length ? targetValue.valueList[targetValue.valueList.length - 1] :
|
|
268
|
+
var _targetValue$valueLis, _progress$steps, _targetValue$valueLis2, _targetValue$valueLis3;
|
|
269
|
+
var finalValue = (_targetValue$valueLis = targetValue.valueList) !== null && _targetValue$valueLis !== void 0 && _targetValue$valueLis.length ? targetValue.valueList[targetValue.valueList.length - 1] : tmodel.getTargetValue(key);
|
|
271
270
|
tmodel.val(key, finalValue);
|
|
272
271
|
tmodel.setActual(key, finalValue);
|
|
273
272
|
tmodel.addToStyleTargetList(key);
|
|
274
|
-
targetValue.step = steps;
|
|
273
|
+
targetValue.step = (_progress$steps = progress.steps) !== null && _progress$steps !== void 0 ? _progress$steps : tmodel.getTargetSteps(key);
|
|
275
274
|
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;
|
|
275
|
+
targetValue.value = finalValue;
|
|
276
276
|
targetValue.cycle = cycles;
|
|
277
277
|
delete targetValue.catchupAt;
|
|
278
278
|
if (fireEnd) {
|
|
@@ -280,11 +280,23 @@ var TargetManager = /*#__PURE__*/function () {
|
|
|
280
280
|
}
|
|
281
281
|
return {
|
|
282
282
|
done: true,
|
|
283
|
-
step:
|
|
283
|
+
step: targetValue.step,
|
|
284
284
|
cycle: cycles,
|
|
285
285
|
valuePointer: targetValue.valuePointer
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
|
+
if ((_targetValue$valueLis4 = targetValue.valueList) !== null && _targetValue$valueLis4 !== void 0 && _targetValue$valueLis4.length) {
|
|
289
|
+
targetValue.valuePointer = valuePointer;
|
|
290
|
+
targetValue.initialValue = targetValue.valueList[valuePointer - 1];
|
|
291
|
+
targetValue.value = targetValue.valueList[valuePointer];
|
|
292
|
+
targetValue.steps = targetValue.stepList[(valuePointer - 1) % targetValue.stepList.length];
|
|
293
|
+
targetValue.interval = Array.isArray(targetValue.intervalList) ? targetValue.intervalList[(valuePointer - 1) % targetValue.intervalList.length] : targetValue.interval;
|
|
294
|
+
targetValue.easing = targetValue.easingList[(valuePointer - 1) % targetValue.easingList.length];
|
|
295
|
+
}
|
|
296
|
+
targetValue.step = step;
|
|
297
|
+
targetValue.cycle = cycle;
|
|
298
|
+
var theValue = tmodel.getTargetValue(key);
|
|
299
|
+
var steps = tmodel.getTargetSteps(key);
|
|
288
300
|
var initialValue = tmodel.getTargetInitialValue(key);
|
|
289
301
|
if (!TUtil.isDefined(initialValue)) {
|
|
290
302
|
initialValue = this.resolveInitialValue(tmodel, key, theValue);
|
|
@@ -294,9 +306,6 @@ var TargetManager = /*#__PURE__*/function () {
|
|
|
294
306
|
tmodel.val(key, value);
|
|
295
307
|
tmodel.setActual(key, value);
|
|
296
308
|
tmodel.addToStyleTargetList(key);
|
|
297
|
-
targetValue.step = step;
|
|
298
|
-
targetValue.valuePointer = valuePointer;
|
|
299
|
-
targetValue.cycle = cycle;
|
|
300
309
|
return {
|
|
301
310
|
done: false,
|
|
302
311
|
step: step,
|
|
@@ -332,7 +341,7 @@ var TargetManager = /*#__PURE__*/function () {
|
|
|
332
341
|
if (tmodel.canBeAnimated(state.cleanKey)) {
|
|
333
342
|
this.animateActualValue(tmodel, key, targetValue, state, step, valuePointer);
|
|
334
343
|
} else {
|
|
335
|
-
this.updateActualValue(tmodel, key, targetValue, state, step
|
|
344
|
+
this.updateActualValue(tmodel, key, targetValue, state, step);
|
|
336
345
|
}
|
|
337
346
|
}
|
|
338
347
|
}, {
|
|
@@ -385,7 +394,7 @@ var TargetManager = /*#__PURE__*/function () {
|
|
|
385
394
|
}
|
|
386
395
|
}, {
|
|
387
396
|
key: "updateActualValue",
|
|
388
|
-
value: function updateActualValue(tmodel, key, targetValue, state, step
|
|
397
|
+
value: function updateActualValue(tmodel, key, targetValue, state, step) {
|
|
389
398
|
if (step <= state.steps) {
|
|
390
399
|
tmodel.incrementTargetStep(key, state.now, state.lastUpdateTime, state.interval, state.steps);
|
|
391
400
|
var newValue = TModelUtil.easingMorph(tmodel, key, state.initialValue, state.theValue, step, state.steps);
|
|
@@ -398,27 +407,31 @@ var TargetManager = /*#__PURE__*/function () {
|
|
|
398
407
|
return;
|
|
399
408
|
}
|
|
400
409
|
}
|
|
401
|
-
this.finishCurrentSegment(tmodel, key, targetValue, state
|
|
410
|
+
this.finishCurrentSegment(tmodel, key, targetValue, state);
|
|
402
411
|
}
|
|
403
412
|
}, {
|
|
404
413
|
key: "finishCurrentSegment",
|
|
405
|
-
value: function finishCurrentSegment(tmodel, key, targetValue, state
|
|
414
|
+
value: function finishCurrentSegment(tmodel, key, targetValue, state) {
|
|
406
415
|
tmodel.val(key, state.theValue);
|
|
407
416
|
tmodel.setActual(key, state.theValue);
|
|
408
417
|
tmodel.addToStyleTargetList(key);
|
|
409
418
|
targetValue.step = state.steps;
|
|
410
419
|
tmodel.setLastUpdate(key);
|
|
411
420
|
var scheduleTime = 1;
|
|
412
|
-
if (targetValue.valueList
|
|
421
|
+
if (targetValue.valueList) {
|
|
413
422
|
tmodel.incrementValueListPointer(key);
|
|
414
423
|
var nextPointer = tmodel.getValueListPointer(key);
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
424
|
+
if (nextPointer < targetValue.valueList.length) {
|
|
425
|
+
tmodel.resetTargetStep(key);
|
|
426
|
+
targetValue.initialValue = targetValue.value;
|
|
427
|
+
targetValue.value = targetValue.valueList[nextPointer];
|
|
428
|
+
targetValue.steps = targetValue.stepList[(nextPointer - 1) % targetValue.stepList.length];
|
|
429
|
+
targetValue.interval = Array.isArray(targetValue.intervalList) ? targetValue.intervalList[(nextPointer - 1) % targetValue.intervalList.length] : 0;
|
|
430
|
+
targetValue.easing = targetValue.easingList[(nextPointer - 1) % targetValue.easingList.length];
|
|
431
|
+
scheduleTime = state.interval;
|
|
432
|
+
} else {
|
|
433
|
+
this.fireOnEnd(tmodel, key);
|
|
434
|
+
}
|
|
422
435
|
} else {
|
|
423
436
|
this.fireOnEnd(tmodel, key);
|
|
424
437
|
}
|
package/build/TargetParser.js
CHANGED
|
@@ -9,6 +9,7 @@ import { TargetData } from './TargetData.js';
|
|
|
9
9
|
import { TUtil } from './TUtil.js';
|
|
10
10
|
import { TModel } from "./TModel.js";
|
|
11
11
|
import { Easing } from "./Easing.js";
|
|
12
|
+
import { getEvents } from "./App.js";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* It provides helper functions for classify target types
|
|
@@ -114,7 +115,25 @@ var TargetParser = /*#__PURE__*/function () {
|
|
|
114
115
|
}, {
|
|
115
116
|
key: "getInstanceTargetValue",
|
|
116
117
|
value: function getInstanceTargetValue(tmodel, key, target, cycle, lastValue, instance) {
|
|
117
|
-
return
|
|
118
|
+
return TargetParser.runTargetValue(tmodel, target, key, cycle, lastValue, instance);
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "runTargetValue",
|
|
122
|
+
value: function runTargetValue(tmodel, target, key, cycle, lastValue) {
|
|
123
|
+
var instance = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
|
|
124
|
+
var cleanKey = TargetUtil.getTargetName(key);
|
|
125
|
+
var isExternalEvent = TargetData.allEventMap[cleanKey];
|
|
126
|
+
var instanceArgs = TUtil.isDefined(instance) ? [instance] : [];
|
|
127
|
+
if (isExternalEvent) {
|
|
128
|
+
var _target$value;
|
|
129
|
+
return typeof target.value === 'function' ? (_target$value = target.value).call.apply(_target$value, [tmodel].concat(instanceArgs, [getEvents().getCurrentOriginalEvent(), cycle, lastValue])) : TUtil.isDefined(target.value) ? target.value : target;
|
|
130
|
+
} else if (tmodel.val("___".concat(key))) {
|
|
131
|
+
var _target$value2;
|
|
132
|
+
return typeof target.value === 'function' ? (_target$value2 = target.value).call.apply(_target$value2, [tmodel].concat(instanceArgs, [tmodel.val("___".concat(key)), cycle, lastValue])) : TUtil.isDefined(target.value) ? target.value : target;
|
|
133
|
+
} else {
|
|
134
|
+
var _target$value3;
|
|
135
|
+
return typeof target.value === 'function' ? (_target$value3 = target.value).call.apply(_target$value3, [tmodel].concat(instanceArgs, [cycle, lastValue])) : TUtil.isDefined(target.value) ? target.value : target;
|
|
136
|
+
}
|
|
118
137
|
}
|
|
119
138
|
}, {
|
|
120
139
|
key: "isChildrenTarget",
|
|
@@ -273,7 +292,7 @@ var TargetParser = /*#__PURE__*/function () {
|
|
|
273
292
|
|
|
274
293
|
// Plain objects: compute value + params (steps/interval/easing/cycles)
|
|
275
294
|
if (_typeof(target) === "object" && target !== null && Object.getPrototypeOf(target) === Object.prototype) {
|
|
276
|
-
var valueResult =
|
|
295
|
+
var valueResult = TargetParser.runTargetValue(tmodel, target, key, cycle, lastValue, instance);
|
|
277
296
|
if (TargetParser.isPrimitiveArray(valueResult) && (TUtil.isDefined(target.steps) || TUtil.isDefined(target.interval) || TUtil.isDefined(target.easing) || TUtil.isDefined(target.cycles))) {
|
|
278
297
|
value = {
|
|
279
298
|
list: valueResult
|
package/build/TargetUtil.js
CHANGED
|
@@ -572,6 +572,9 @@ var TargetUtil = /*#__PURE__*/function () {
|
|
|
572
572
|
if (tmodel.isTargetImperative(targetName)) {
|
|
573
573
|
continue;
|
|
574
574
|
}
|
|
575
|
+
if (tmodel.isTargetComplete(targetName)) {
|
|
576
|
+
continue;
|
|
577
|
+
}
|
|
575
578
|
if (tmodel.activatedTargets.indexOf(targetName) >= 0) {
|
|
576
579
|
return "activated targets";
|
|
577
580
|
}
|
|
@@ -591,7 +594,7 @@ var TargetUtil = /*#__PURE__*/function () {
|
|
|
591
594
|
value: function isTargetTreeComplete(tmodel, key, completionScopeOverride) {
|
|
592
595
|
var target = tmodel.targets[key];
|
|
593
596
|
if (target) {
|
|
594
|
-
var _target$childAction, _target$childAction2, _target$childAction3;
|
|
597
|
+
var _target$childAction, _target$childAction2, _target$childAction3, _tmodel$particleRunti;
|
|
595
598
|
var completionScope = completionScopeOverride !== null && completionScopeOverride !== void 0 ? completionScopeOverride : target.completionScope;
|
|
596
599
|
var targetType = _typeof(target.value);
|
|
597
600
|
if (TargetData.controlTargetMap[key]) {
|
|
@@ -621,6 +624,9 @@ var TargetUtil = /*#__PURE__*/function () {
|
|
|
621
624
|
if (target.fetchAction && !getLoader().isLoadingSuccessful(tmodel, key)) {
|
|
622
625
|
return 'incomplete loading';
|
|
623
626
|
}
|
|
627
|
+
if ((_tmodel$particleRunti = tmodel.particleRuntime) !== null && _tmodel$particleRunti !== void 0 && _tmodel$particleRunti.hasPending(key, completionScope)) {
|
|
628
|
+
return "pending GPU children";
|
|
629
|
+
}
|
|
624
630
|
}
|
|
625
631
|
return true;
|
|
626
632
|
}
|
|
@@ -635,7 +641,14 @@ var TargetUtil = /*#__PURE__*/function () {
|
|
|
635
641
|
_step2;
|
|
636
642
|
try {
|
|
637
643
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
644
|
+
var _child$visibilityStat;
|
|
638
645
|
var child = _step2.value;
|
|
646
|
+
if (!child) {
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
649
|
+
if (completionScope === "visible" && !child.isLightweightChild && ((_child$visibilityStat = child.visibilityStatus) === null || _child$visibilityStat === void 0 ? void 0 : _child$visibilityStat.isVisible) === undefined) {
|
|
650
|
+
return "visibility not calculated";
|
|
651
|
+
}
|
|
639
652
|
if (TargetUtil.shouldIgnoreChildForCompletion(child, completionScope)) {
|
|
640
653
|
continue;
|
|
641
654
|
}
|
|
@@ -761,8 +774,13 @@ var TargetUtil = /*#__PURE__*/function () {
|
|
|
761
774
|
return true;
|
|
762
775
|
}
|
|
763
776
|
if (completionScope === "visible") {
|
|
764
|
-
|
|
765
|
-
|
|
777
|
+
if (child.visibilityStatus) {
|
|
778
|
+
return child.visibilityStatus.isVisible !== true;
|
|
779
|
+
}
|
|
780
|
+
if (typeof child.isVisible === "function") {
|
|
781
|
+
return child.isVisible() !== true;
|
|
782
|
+
}
|
|
783
|
+
return true;
|
|
766
784
|
}
|
|
767
785
|
return false;
|
|
768
786
|
}
|
|
@@ -925,6 +943,9 @@ var TargetUtil = /*#__PURE__*/function () {
|
|
|
925
943
|
value: function resetTargetChildState(tmodel) {
|
|
926
944
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
927
945
|
var visited = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set();
|
|
946
|
+
if (tmodel.isLightweightChild) {
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
928
949
|
var sig = "".concat(tmodel.oid);
|
|
929
950
|
if (visited.has(sig)) {
|
|
930
951
|
return;
|
package/build/VisibilityUtil.js
CHANGED
|
@@ -68,7 +68,8 @@ var VisibilityUtil = /*#__PURE__*/function () {
|
|
|
68
68
|
tmodel = parent;
|
|
69
69
|
}
|
|
70
70
|
var clip = VisibilityUtil.getScreenViewportRect();
|
|
71
|
-
var
|
|
71
|
+
var verticalOnly = tmodel.type === "BI";
|
|
72
|
+
var isVisible = VisibilityUtil.rectsOverlap(rect, clip, verticalOnly);
|
|
72
73
|
if (!isVisible) {
|
|
73
74
|
return {
|
|
74
75
|
clip: clip,
|
|
@@ -115,7 +116,8 @@ var VisibilityUtil = /*#__PURE__*/function () {
|
|
|
115
116
|
}, {
|
|
116
117
|
key: "rectsOverlap",
|
|
117
118
|
value: function rectsOverlap(a, b) {
|
|
118
|
-
|
|
119
|
+
var verticalOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
120
|
+
return (verticalOnly || a.x <= b.r && a.r >= b.x) && a.y <= b.b && a.b >= b.y;
|
|
119
121
|
}
|
|
120
122
|
}, {
|
|
121
123
|
key: "intersectRects",
|
package/build/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export * from "./VisibilityUtil.js";
|
|
|
20
20
|
export * from "./ScheduleUtil.js";
|
|
21
21
|
export * from "./StateUtil.js";
|
|
22
22
|
export * from "./ParticleTModel.js";
|
|
23
|
+
export * from "./ParticleChild.js";
|
|
23
24
|
export * from "./ParticleRenderer.js";
|
|
24
25
|
export * from "./ParticleRuntime.js";
|
|
25
26
|
export * from "./ParticleUtil.js";
|