targetj 1.0.260 → 1.1.1
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 +221 -153
- package/build/AnimationUtil.js +0 -1
- package/build/App.js +82 -34
- package/build/BaseModel.js +51 -15
- package/build/Bracket.js +7 -1
- package/build/Easing.js +5 -0
- package/build/EventListener.js +37 -8
- package/build/HtmlToCanvas.js +411 -0
- package/build/LocationManager.js +167 -46
- package/build/PageManager.js +67 -115
- package/build/ParticleChild.js +576 -0
- package/build/ParticleExplode.js +360 -0
- package/build/ParticleRenderer.js +821 -159
- package/build/ParticleRuntime.js +1529 -381
- package/build/ParticleTModel.js +864 -293
- package/build/ParticleUtil.js +120 -172
- package/build/RunScheduler.js +23 -11
- package/build/StateManager.js +206 -57
- package/build/StateUtil.js +141 -82
- package/build/TModel.js +172 -73
- package/build/TModelManager.js +155 -132
- package/build/TModelUtil.js +232 -142
- package/build/TUtil.js +55 -50
- package/build/TargetData.js +26 -12
- package/build/TargetExecutor.js +48 -17
- package/build/TargetManager.js +47 -39
- package/build/TargetParser.js +57 -4
- package/build/TargetUtil.js +211 -129
- 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/TUtil.js
CHANGED
|
@@ -11,9 +11,8 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
|
|
|
11
11
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
12
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
13
13
|
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); }
|
|
14
|
-
import { getLocationManager, tRoot
|
|
14
|
+
import { getLocationManager, tRoot } from "./App.js";
|
|
15
15
|
import { TargetUtil } from "./TargetUtil.js";
|
|
16
|
-
import { TargetData } from "./TargetData.js";
|
|
17
16
|
import { TModel } from "./TModel.js";
|
|
18
17
|
|
|
19
18
|
/**
|
|
@@ -99,6 +98,11 @@ var TUtil = /*#__PURE__*/function () {
|
|
|
99
98
|
value: function isDefined(obj) {
|
|
100
99
|
return typeof obj !== "undefined" && obj !== null;
|
|
101
100
|
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "hasProperty",
|
|
103
|
+
value: function hasProperty(obj, key) {
|
|
104
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
105
|
+
}
|
|
102
106
|
}, {
|
|
103
107
|
key: "isNumber",
|
|
104
108
|
value: function isNumber(num) {
|
|
@@ -234,24 +238,6 @@ var TUtil = /*#__PURE__*/function () {
|
|
|
234
238
|
}
|
|
235
239
|
return false;
|
|
236
240
|
}
|
|
237
|
-
}, {
|
|
238
|
-
key: "runTargetValue",
|
|
239
|
-
value: function runTargetValue(tmodel, target, key, cycle, lastValue) {
|
|
240
|
-
var instance = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
|
|
241
|
-
var cleanKey = TargetUtil.getTargetName(key);
|
|
242
|
-
var isExternalEvent = TargetData.allEventMap[cleanKey];
|
|
243
|
-
var instanceArgs = TUtil.isDefined(instance) ? [instance] : [];
|
|
244
|
-
if (isExternalEvent) {
|
|
245
|
-
var _target$value;
|
|
246
|
-
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;
|
|
247
|
-
} else if (tmodel.val("___".concat(key))) {
|
|
248
|
-
var _target$value2;
|
|
249
|
-
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;
|
|
250
|
-
} else {
|
|
251
|
-
var _target$value3;
|
|
252
|
-
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;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
241
|
}, {
|
|
256
242
|
key: "mergeTargets",
|
|
257
243
|
value: function mergeTargets(tmodel1, tmodel2) {
|
|
@@ -336,21 +322,24 @@ var TUtil = /*#__PURE__*/function () {
|
|
|
336
322
|
done: false
|
|
337
323
|
};
|
|
338
324
|
}
|
|
339
|
-
if (!targetValue.catchupAt) {
|
|
325
|
+
if (!TUtil.isDefined(targetValue.catchupAt)) {
|
|
340
326
|
var _targetValue$valueLis;
|
|
327
|
+
var step = tmodel.getTargetStep(key);
|
|
328
|
+
var valuePointer = (_targetValue$valueLis = targetValue.valueList) !== null && _targetValue$valueLis !== void 0 && _targetValue$valueLis.length ? tmodel.getValueListPointer(key) : 0;
|
|
341
329
|
return {
|
|
342
|
-
step:
|
|
330
|
+
step: step,
|
|
343
331
|
cycle: tmodel.getTargetCycle(key),
|
|
344
|
-
valuePointer:
|
|
345
|
-
done:
|
|
332
|
+
valuePointer: valuePointer,
|
|
333
|
+
done: !TargetUtil.isTargetUpdating(tmodel, key)
|
|
346
334
|
};
|
|
347
335
|
}
|
|
348
|
-
var
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
336
|
+
var now = TUtil.now();
|
|
337
|
+
var elapsedMs = now - targetValue.catchupAt;
|
|
338
|
+
var progress = (_targetValue$valueLis2 = targetValue.valueList) !== null && _targetValue$valueLis2 !== void 0 && _targetValue$valueLis2.length ? TUtil.advanceValueListTargetByElapsed(tmodel, key, elapsedMs) : TUtil.advanceSimpleTargetByElapsed(tmodel, key, elapsedMs);
|
|
339
|
+
if (!progress.done) {
|
|
340
|
+
targetValue.catchupAt = now - progress.remainingMs;
|
|
353
341
|
}
|
|
342
|
+
return progress;
|
|
354
343
|
}
|
|
355
344
|
}, {
|
|
356
345
|
key: "advanceSimpleTargetByElapsed",
|
|
@@ -360,15 +349,16 @@ var TUtil = /*#__PURE__*/function () {
|
|
|
360
349
|
var cycles = tmodel.getTargetCycles(key);
|
|
361
350
|
var step = tmodel.getTargetStep(key);
|
|
362
351
|
var cycle = tmodel.getTargetCycle(key);
|
|
352
|
+
var remainingMs = elapsedMs;
|
|
363
353
|
if (steps <= 0) {
|
|
364
354
|
return {
|
|
365
355
|
step: steps,
|
|
366
356
|
valuePointer: 0,
|
|
367
357
|
cycle: cycles,
|
|
368
|
-
done: true
|
|
358
|
+
done: true,
|
|
359
|
+
remainingMs: 0
|
|
369
360
|
};
|
|
370
361
|
}
|
|
371
|
-
var remainingMs = elapsedMs;
|
|
372
362
|
while (remainingMs > 0 && cycle < cycles) {
|
|
373
363
|
var remainingSteps = Math.max(steps - step, 0);
|
|
374
364
|
var remainingSegmentMs = remainingSteps * interval;
|
|
@@ -380,7 +370,8 @@ var TUtil = /*#__PURE__*/function () {
|
|
|
380
370
|
step: steps,
|
|
381
371
|
valuePointer: 0,
|
|
382
372
|
cycle: cycles,
|
|
383
|
-
done: true
|
|
373
|
+
done: true,
|
|
374
|
+
remainingMs: remainingMs
|
|
384
375
|
};
|
|
385
376
|
}
|
|
386
377
|
step = 0;
|
|
@@ -388,12 +379,14 @@ var TUtil = /*#__PURE__*/function () {
|
|
|
388
379
|
}
|
|
389
380
|
var advancedSteps = TUtil.limit(Math.floor(remainingMs / interval), 0, remainingSteps);
|
|
390
381
|
step += advancedSteps;
|
|
382
|
+
remainingMs -= advancedSteps * interval;
|
|
391
383
|
return {
|
|
392
384
|
step: step,
|
|
393
385
|
steps: steps,
|
|
394
386
|
valuePointer: 0,
|
|
395
387
|
cycle: cycle,
|
|
396
|
-
done: false
|
|
388
|
+
done: false,
|
|
389
|
+
remainingMs: remainingMs
|
|
397
390
|
};
|
|
398
391
|
}
|
|
399
392
|
return {
|
|
@@ -401,7 +394,8 @@ var TUtil = /*#__PURE__*/function () {
|
|
|
401
394
|
steps: steps,
|
|
402
395
|
valuePointer: 0,
|
|
403
396
|
cycle: cycle,
|
|
404
|
-
done: cycle >= cycles
|
|
397
|
+
done: cycle >= cycles,
|
|
398
|
+
remainingMs: remainingMs
|
|
405
399
|
};
|
|
406
400
|
}
|
|
407
401
|
}, {
|
|
@@ -416,7 +410,7 @@ var TUtil = /*#__PURE__*/function () {
|
|
|
416
410
|
var valuePointer = tmodel.getValueListPointer(key);
|
|
417
411
|
var step = tmodel.getTargetStep(key);
|
|
418
412
|
var remainingMs = elapsedMs;
|
|
419
|
-
while (
|
|
413
|
+
while (cycle < cycles) {
|
|
420
414
|
while (remainingMs > 0 && valuePointer < valueList.length) {
|
|
421
415
|
var segmentSteps = stepList[(valuePointer - 1) % stepList.length];
|
|
422
416
|
var interval = intervalList[(valuePointer - 1) % intervalList.length] || 8;
|
|
@@ -431,29 +425,39 @@ var TUtil = /*#__PURE__*/function () {
|
|
|
431
425
|
}
|
|
432
426
|
var advancedSteps = TUtil.limit(Math.floor(remainingMs / interval), 0, remainingSteps);
|
|
433
427
|
step += advancedSteps;
|
|
428
|
+
remainingMs -= advancedSteps * interval;
|
|
434
429
|
return {
|
|
435
430
|
step: step,
|
|
436
431
|
steps: segmentSteps,
|
|
437
432
|
valuePointer: valuePointer,
|
|
438
433
|
cycle: cycle,
|
|
439
|
-
done: false
|
|
434
|
+
done: false,
|
|
435
|
+
remainingMs: remainingMs
|
|
440
436
|
};
|
|
441
437
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
438
|
+
if (valuePointer >= valueList.length) {
|
|
439
|
+
cycle++;
|
|
440
|
+
if (cycle >= cycles) {
|
|
441
|
+
var finalPointer = valueList.length;
|
|
442
|
+
var finalStepIndex = Math.max(0, valueList.length - 2);
|
|
443
|
+
var finalSteps = stepList[finalStepIndex % stepList.length];
|
|
444
|
+
return {
|
|
445
|
+
step: finalSteps,
|
|
446
|
+
steps: finalSteps,
|
|
447
|
+
valuePointer: finalPointer,
|
|
448
|
+
cycle: cycles,
|
|
449
|
+
done: true,
|
|
450
|
+
remainingMs: remainingMs
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
valuePointer = 1;
|
|
454
|
+
step = 0;
|
|
455
|
+
if (remainingMs <= 0) {
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
continue;
|
|
454
459
|
}
|
|
455
|
-
|
|
456
|
-
step = 0;
|
|
460
|
+
break;
|
|
457
461
|
}
|
|
458
462
|
var currentSteps = stepList[(valuePointer - 1) % stepList.length];
|
|
459
463
|
return {
|
|
@@ -461,6 +465,7 @@ var TUtil = /*#__PURE__*/function () {
|
|
|
461
465
|
steps: currentSteps,
|
|
462
466
|
valuePointer: valuePointer,
|
|
463
467
|
cycle: cycle,
|
|
468
|
+
remainingMs: remainingMs,
|
|
464
469
|
done: cycle >= cycles
|
|
465
470
|
};
|
|
466
471
|
}
|
package/build/TargetData.js
CHANGED
|
@@ -41,8 +41,7 @@ var TargetData = /*#__PURE__*/function () {
|
|
|
41
41
|
isIncluded: true,
|
|
42
42
|
bracketThreshold: 40,
|
|
43
43
|
bracketSize: 2,
|
|
44
|
-
preventDefault: undefined
|
|
45
|
-
canDeleteDom: undefined
|
|
44
|
+
preventDefault: undefined
|
|
46
45
|
};
|
|
47
46
|
}
|
|
48
47
|
}, {
|
|
@@ -68,9 +67,21 @@ var TargetData = /*#__PURE__*/function () {
|
|
|
68
67
|
value: function isTransformKey(key) {
|
|
69
68
|
return !!TargetData.transformMap[key];
|
|
70
69
|
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "affectsVisibility",
|
|
72
|
+
value: function affectsVisibility(key) {
|
|
73
|
+
key = TargetUtil.getTargetName(key);
|
|
74
|
+
return ["x", "y", "width", "height", "dim"].includes(TargetUtil.getTargetName(key));
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
key: "requiresDom",
|
|
78
|
+
value: function requiresDom(targetName) {
|
|
79
|
+
return TargetData.onDomTargets.has(targetName);
|
|
80
|
+
}
|
|
71
81
|
}]);
|
|
72
82
|
}();
|
|
73
83
|
_TargetData = TargetData;
|
|
84
|
+
_defineProperty(TargetData, "onDomTargets", new Set(["explodeChildren"]));
|
|
74
85
|
_defineProperty(TargetData, "transformOrder", {
|
|
75
86
|
perspective: 0,
|
|
76
87
|
translateX: 1,
|
|
@@ -189,6 +200,7 @@ _defineProperty(TargetData, "asyncStyleTargetMap", {
|
|
|
189
200
|
alignItems: true,
|
|
190
201
|
display: true,
|
|
191
202
|
cursor: true,
|
|
203
|
+
pointerEvents: true,
|
|
192
204
|
fontFamily: true,
|
|
193
205
|
overflow: true,
|
|
194
206
|
overflowX: true,
|
|
@@ -199,11 +211,14 @@ _defineProperty(TargetData, "asyncStyleTargetMap", {
|
|
|
199
211
|
willChange: true,
|
|
200
212
|
backgroundImage: true,
|
|
201
213
|
backgroundSize: true,
|
|
214
|
+
backgroundPosition: true,
|
|
215
|
+
backgroundRepeat: true,
|
|
202
216
|
flexWrap: true,
|
|
203
217
|
userSelect: true,
|
|
204
218
|
outline: true,
|
|
205
219
|
backfaceVisibility: true,
|
|
206
|
-
filter: true
|
|
220
|
+
filter: true,
|
|
221
|
+
whiteSpace: true
|
|
207
222
|
});
|
|
208
223
|
_defineProperty(TargetData, "scaleMap", {
|
|
209
224
|
scale: true,
|
|
@@ -257,8 +272,7 @@ _defineProperty(TargetData, "mustExecuteTargets", {
|
|
|
257
272
|
widthFromDom: true,
|
|
258
273
|
fetch: true,
|
|
259
274
|
fetchImage: true,
|
|
260
|
-
isVisible: true
|
|
261
|
-
canDeleteDom: true
|
|
275
|
+
isVisible: true
|
|
262
276
|
});
|
|
263
277
|
_defineProperty(TargetData, "ignoreRerun", {
|
|
264
278
|
isVisible: true
|
|
@@ -298,8 +312,7 @@ _defineProperty(TargetData, "controlTargetMap", {
|
|
|
298
312
|
styling: true,
|
|
299
313
|
reuseDomDefinition: true,
|
|
300
314
|
useWindowFrame: true,
|
|
301
|
-
|
|
302
|
-
onDomEvent: true,
|
|
315
|
+
onDomReady: true,
|
|
303
316
|
canHaveDom: true
|
|
304
317
|
});
|
|
305
318
|
_defineProperty(TargetData, "events", {
|
|
@@ -731,6 +744,8 @@ _defineProperty(TargetData, "attributesToTargets", {
|
|
|
731
744
|
backgroundcolor: 'backgroundColor',
|
|
732
745
|
backgroundimage: 'backgroundImage',
|
|
733
746
|
backgroundsize: 'backgroundSize',
|
|
747
|
+
backgroundposition: 'backgroundPosition',
|
|
748
|
+
backgroundrepeat: 'backgroundRepeat',
|
|
734
749
|
bordertop: 'borderTop',
|
|
735
750
|
borderleft: 'borderLeft',
|
|
736
751
|
borderright: 'borderRight',
|
|
@@ -773,7 +788,9 @@ _defineProperty(TargetData, "attributesToTargets", {
|
|
|
773
788
|
ariacurrent: 'ariaCurrent',
|
|
774
789
|
ariapressed: 'ariaPressed',
|
|
775
790
|
tabindex: 'tabIndex',
|
|
776
|
-
backfacevisibility: 'backfaceVisibility'
|
|
791
|
+
backfacevisibility: 'backfaceVisibility',
|
|
792
|
+
whitespace: 'whiteSpace',
|
|
793
|
+
pointerevents: 'pointerEvents'
|
|
777
794
|
});
|
|
778
795
|
_defineProperty(TargetData, "targetToEventsMapping", {
|
|
779
796
|
onStart: ['touchStart', 'mouseStart'],
|
|
@@ -805,9 +822,6 @@ _defineProperty(TargetData, "targetToEventsMapping", {
|
|
|
805
822
|
onSubmit: ['submitEvents']
|
|
806
823
|
});
|
|
807
824
|
_defineProperty(TargetData, "internalEventMap", {
|
|
808
|
-
onDomEvent: function onDomEvent(tmodel) {
|
|
809
|
-
return tmodel.hasDomNow;
|
|
810
|
-
},
|
|
811
825
|
onVisible: function onVisible(tmodel) {
|
|
812
826
|
return tmodel.isNowVisible;
|
|
813
827
|
},
|
|
@@ -923,6 +937,6 @@ _defineProperty(TargetData, "lifecyclePatterns", {
|
|
|
923
937
|
});
|
|
924
938
|
_defineProperty(TargetData, "eventSet", new Set([].concat(_toConsumableArray(Object.keys(_TargetData.allEventMap)), _toConsumableArray(Object.keys(_TargetData.internalEventMap)))));
|
|
925
939
|
_defineProperty(TargetData, "styleSet", new Set([].concat(_toConsumableArray(Object.keys(_TargetData.styleTargetMap)), _toConsumableArray(Object.keys(_TargetData.asyncStyleTargetMap)), _toConsumableArray(Object.keys(_TargetData.attributeTargetMap)))));
|
|
926
|
-
_defineProperty(TargetData, "reservedKeywordSet", new Set([].concat(_toConsumableArray(_TargetData.styleSet), _toConsumableArray(Object.keys(_TargetData.defaultActualValues())), _toConsumableArray(Object.keys(_TargetData.allEventMap)), _toConsumableArray(Object.keys(_TargetData.internalEventMap)), _toConsumableArray(Object.keys(_TargetData.mustExecuteTargets)), ['children', 'addChildren', '
|
|
940
|
+
_defineProperty(TargetData, "reservedKeywordSet", new Set([].concat(_toConsumableArray(_TargetData.styleSet), _toConsumableArray(Object.keys(_TargetData.defaultActualValues())), _toConsumableArray(Object.keys(_TargetData.allEventMap)), _toConsumableArray(Object.keys(_TargetData.internalEventMap)), _toConsumableArray(Object.keys(_TargetData.mustExecuteTargets)), ['children', 'addChildren', 'explodeChildren', 'html', 'isInFlow', 'domHolder', 'domParent', 'gap', 'widthFromDom', 'heightFromDom', 'preventDefault', 'textOnly', 'styling', '$dom', 'defaultStyling', 'reuseDomDefinition', 'canHaveDom', 'excludeXYCalc', 'excludeX', 'excludeY', 'containerOverflowMode', 'itemOverflowMode', 'baseElement', 'element', 'otype', 'calculateChildren', 'domIsland', 'bracketThreshold', 'bracketSize', 'shouldBeBracketed', 'sourceDom'])));
|
|
927
941
|
_defineProperty(TargetData, "activationKeywordSet", new Set(['originalTModel', 'originalTargetName', 'activateNextTarget']));
|
|
928
942
|
export { TargetData };
|
package/build/TargetExecutor.js
CHANGED
|
@@ -160,8 +160,12 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
160
160
|
TargetExecutor.assignSingleTarget(targetValue, value, undefined, steps, cycles, interval, easing);
|
|
161
161
|
}
|
|
162
162
|
if (targetValue) {
|
|
163
|
+
var _tmodel$noDomUpdating;
|
|
163
164
|
TargetExecutor.resetImperativeProgress(targetValue);
|
|
164
165
|
TargetExecutor.assignTargetOptions(targetValue, options);
|
|
166
|
+
if (targetValue.steps > 0 && (_tmodel$noDomUpdating = tmodel.noDomUpdatingTargets) !== null && _tmodel$noDomUpdating !== void 0 && _tmodel$noDomUpdating.has(key)) {
|
|
167
|
+
targetValue.catchupAt = TUtil.now();
|
|
168
|
+
}
|
|
165
169
|
TargetExecutor.updateTarget(tmodel, targetValue, key, true, snapUpdates);
|
|
166
170
|
if (tmodel.isTargetDone(key)) {
|
|
167
171
|
TargetUtil.shouldActivateNextTarget(tmodel, key);
|
|
@@ -191,7 +195,6 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
191
195
|
}, {
|
|
192
196
|
key: "calculateTargetStatus",
|
|
193
197
|
value: function calculateTargetStatus(tmodel, targetValue, key) {
|
|
194
|
-
var _tmodel$targets$key;
|
|
195
198
|
var valuePointer = tmodel.getValueListPointer(key);
|
|
196
199
|
var cycle = tmodel.getTargetCycle(key);
|
|
197
200
|
var cycles = tmodel.getTargetCycles(key);
|
|
@@ -205,7 +208,7 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
205
208
|
return 'updating';
|
|
206
209
|
} else if (tmodel.isTargetInLoop(key) || cycle < cycles - 1) {
|
|
207
210
|
return 'active';
|
|
208
|
-
} else if ((
|
|
211
|
+
} else if (TargetUtil.hasFetchAction(tmodel, key) && !getLoader().isLoadingSuccessful(tmodel, key)) {
|
|
209
212
|
return 'fetching';
|
|
210
213
|
} else {
|
|
211
214
|
return 'done';
|
|
@@ -252,7 +255,7 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
252
255
|
}, {
|
|
253
256
|
key: "snapActualToTarget",
|
|
254
257
|
value: function snapActualToTarget(tmodel, key, snapUpdates) {
|
|
255
|
-
var _tmodel$animatingMap2;
|
|
258
|
+
var _tmodel$animatingMap$, _tmodel$animatingMap2;
|
|
256
259
|
var targetValue = tmodel.targetValues[key];
|
|
257
260
|
var newValue;
|
|
258
261
|
if (Array.isArray(targetValue.valueList)) {
|
|
@@ -264,7 +267,11 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
264
267
|
newValue = typeof value === 'function' ? value.call(tmodel) : value;
|
|
265
268
|
}
|
|
266
269
|
var valueChanged = tmodel.val(key) !== newValue;
|
|
267
|
-
var
|
|
270
|
+
var cleanKey = TargetUtil.getTargetName(key);
|
|
271
|
+
var animatedKey = _toConsumableArray((_tmodel$animatingMap$ = (_tmodel$animatingMap2 = tmodel.animatingMap) === null || _tmodel$animatingMap2 === void 0 ? void 0 : _tmodel$animatingMap2.keys()) !== null && _tmodel$animatingMap$ !== void 0 ? _tmodel$animatingMap$ : []).find(function (animatedKey) {
|
|
272
|
+
return TargetUtil.getTargetName(animatedKey) === cleanKey;
|
|
273
|
+
});
|
|
274
|
+
var isAnimating = !!animatedKey;
|
|
268
275
|
if (!valueChanged && !isAnimating) {
|
|
269
276
|
return;
|
|
270
277
|
}
|
|
@@ -273,7 +280,7 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
273
280
|
tmodel.setActual(key, newValue);
|
|
274
281
|
TUtil.handleValueChange(tmodel, key);
|
|
275
282
|
}
|
|
276
|
-
if (!tmodel.hasValidAnimation() || !tmodel.canBeAnimated(key)) {
|
|
283
|
+
if (!isAnimating || !tmodel.hasValidAnimation() || !tmodel.canBeAnimated(key)) {
|
|
277
284
|
targetValue.snapAnimation = false;
|
|
278
285
|
return;
|
|
279
286
|
}
|
|
@@ -317,12 +324,16 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
317
324
|
}
|
|
318
325
|
var targetInitial = !tmodel.targetValues[key] && TUtil.isDefined(tmodel.targets[key].initialValue) ? tmodel.targets[key].initialValue : undefined;
|
|
319
326
|
var target = tmodel.targets[key];
|
|
320
|
-
var
|
|
327
|
+
var isExplodeChildren = TargetParser.isExplodeChildrenTarget(key);
|
|
328
|
+
var hasInstances = !isExplodeChildren && target && _typeof(target) === "object" && TUtil.isDefined(target.instances);
|
|
321
329
|
var instances = hasInstances ? TargetParser.getTargetInstances(tmodel, key, target, cycle) : 1;
|
|
330
|
+
var valueTarget = isExplodeChildren && typeof (target === null || target === void 0 ? void 0 : target.value) === "function" ? _objectSpread(_objectSpread({}, target), {}, {
|
|
331
|
+
value: {}
|
|
332
|
+
}) : target;
|
|
322
333
|
var valueArray;
|
|
323
334
|
if (hasInstances) {
|
|
324
335
|
var values = new Array(instances);
|
|
325
|
-
valueArray = TargetParser.getValueStepsCycles(tmodel, key,
|
|
336
|
+
valueArray = TargetParser.getValueStepsCycles(tmodel, key, valueTarget, cycle, 0);
|
|
326
337
|
values[0] = valueArray[0];
|
|
327
338
|
valueArray[0] = values;
|
|
328
339
|
var lastValues = tmodel.val(key);
|
|
@@ -331,7 +342,7 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
331
342
|
values[instance] = TargetParser.getInstanceTargetValue(tmodel, key, target, cycle, lastValue, instance);
|
|
332
343
|
}
|
|
333
344
|
} else {
|
|
334
|
-
valueArray = TargetParser.getValueStepsCycles(tmodel, key,
|
|
345
|
+
valueArray = TargetParser.getValueStepsCycles(tmodel, key, valueTarget, cycle);
|
|
335
346
|
}
|
|
336
347
|
var newValue = valueArray[0];
|
|
337
348
|
var newSteps = valueArray[1] || 0;
|
|
@@ -350,14 +361,32 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
350
361
|
interval: newInterval,
|
|
351
362
|
easing: easing
|
|
352
363
|
})) {
|
|
353
|
-
var _options$
|
|
364
|
+
var _options$cycles, _options$interval, _options$easing;
|
|
354
365
|
var options = specialTarget === true ? {} : specialTarget;
|
|
355
|
-
TargetExecutor.assignSingleTarget(targetValue, newValue, undefined,
|
|
366
|
+
TargetExecutor.assignSingleTarget(targetValue, newValue, undefined, 0, (_options$cycles = options.cycles) !== null && _options$cycles !== void 0 ? _options$cycles : newCycles, (_options$interval = options.interval) !== null && _options$interval !== void 0 ? _options$interval : newInterval, (_options$easing = options.easing) !== null && _options$easing !== void 0 ? _options$easing : easing);
|
|
356
367
|
} else if (TargetParser.isChildTarget(key, newValue)) {
|
|
357
368
|
tmodel.addChild(newValue);
|
|
358
369
|
TargetExecutor.assignSingleTarget(targetValue, newValue, undefined, 0, newCycles, newInterval, easing);
|
|
370
|
+
} else if (TargetParser.isExplodeChildrenTarget(key)) {
|
|
371
|
+
var _target$renderer, _options$steps, _options$cycles2, _options$interval2, _options$easing2;
|
|
372
|
+
var definition = typeof (target === null || target === void 0 ? void 0 : target.value) === "function" ? {} : TargetParser.getExplodeChildrenDefinition(newValue === target ? undefined : newValue);
|
|
373
|
+
if (typeof tmodel.createExplodeChildren !== "function") {
|
|
374
|
+
throw new Error("explodeChildren requires a createExplodeChildren() implementation on the TModel.");
|
|
375
|
+
}
|
|
376
|
+
var result = tmodel.createExplodeChildren(key, definition, {
|
|
377
|
+
renderer: (_target$renderer = target === null || target === void 0 ? void 0 : target.renderer) !== null && _target$renderer !== void 0 ? _target$renderer : "gpu",
|
|
378
|
+
steps: newSteps,
|
|
379
|
+
cycles: newCycles,
|
|
380
|
+
interval: newInterval,
|
|
381
|
+
easing: easing
|
|
382
|
+
});
|
|
383
|
+
if (result === false) {
|
|
384
|
+
throw new Error("explodeChildren could not create its fragment children.");
|
|
385
|
+
}
|
|
386
|
+
var _options = result && _typeof(result) === "object" ? result : {};
|
|
387
|
+
TargetExecutor.assignSingleTarget(targetValue, definition, undefined, (_options$steps = _options.steps) !== null && _options$steps !== void 0 ? _options$steps : 0, (_options$cycles2 = _options.cycles) !== null && _options$cycles2 !== void 0 ? _options$cycles2 : newCycles, (_options$interval2 = _options.interval) !== null && _options$interval2 !== void 0 ? _options$interval2 : newInterval, (_options$easing2 = _options.easing) !== null && _options$easing2 !== void 0 ? _options$easing2 : easing);
|
|
359
388
|
} else if (TargetParser.isChildrenTarget(key, newValue)) {
|
|
360
|
-
var
|
|
389
|
+
var _options2$steps, _options2$cycles, _options2$interval, _options2$easing;
|
|
361
390
|
var _values = Array.isArray(newValue) ? newValue : newValue ? [newValue] : [];
|
|
362
391
|
_values.forEach(function (child) {
|
|
363
392
|
var addedChildrenCount = tmodel.addedChildren.length;
|
|
@@ -367,14 +396,14 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
367
396
|
TargetUtil.markAddChild(tmodel, TargetUtil.currentTargetName, addedChild);
|
|
368
397
|
}
|
|
369
398
|
});
|
|
370
|
-
var
|
|
399
|
+
var _result = tmodel.finalizeChildrenTarget(key, {
|
|
371
400
|
steps: newSteps,
|
|
372
401
|
cycles: newCycles,
|
|
373
402
|
interval: newInterval,
|
|
374
403
|
easing: easing
|
|
375
404
|
});
|
|
376
|
-
var
|
|
377
|
-
TargetExecutor.assignSingleTarget(targetValue, newValue, undefined, (
|
|
405
|
+
var _options2 = _result && _typeof(_result) === "object" ? _result : {};
|
|
406
|
+
TargetExecutor.assignSingleTarget(targetValue, newValue, undefined, (_options2$steps = _options2.steps) !== null && _options2$steps !== void 0 ? _options2$steps : 0, (_options2$cycles = _options2.cycles) !== null && _options2$cycles !== void 0 ? _options2$cycles : newCycles, (_options2$interval = _options2.interval) !== null && _options2$interval !== void 0 ? _options2$interval : newInterval, (_options2$easing = _options2.easing) !== null && _options2$easing !== void 0 ? _options2$easing : easing);
|
|
378
407
|
} else if (TargetParser.isChildObjectTarget(key, tmodel.targets[key])) {
|
|
379
408
|
var child = TargetExecutor.createTModel(key, tmodel.targets[key]);
|
|
380
409
|
tmodel.addChild(child);
|
|
@@ -385,7 +414,7 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
385
414
|
}));
|
|
386
415
|
TargetExecutor.assignSingleTarget(targetValue, filteredValue, undefined, 0, newCycles, newInterval, easing);
|
|
387
416
|
} else if (_typeof(newValue) === 'object' && newValue.asChild === true) {
|
|
388
|
-
var _child =
|
|
417
|
+
var _child = TargetExecutor.createTModel(key, newValue);
|
|
389
418
|
tmodel.addChild(_child);
|
|
390
419
|
TargetExecutor.assignSingleTarget(targetValue, newValue, undefined, 0, newCycles, newInterval, easing);
|
|
391
420
|
} else if (TargetParser.isFetchTarget(key, newValue)) {
|
|
@@ -397,8 +426,8 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
397
426
|
} else if (TargetParser.isListTarget(newValue)) {
|
|
398
427
|
TargetExecutor.assignListTarget(tmodel, key, targetValue, newValue.list, newValue.list[0], newSteps, newInterval, easing, newCycles);
|
|
399
428
|
} else {
|
|
400
|
-
var _tmodel$targets$key$d, _tmodel$targets$
|
|
401
|
-
if (newSteps > 0 && !TUtil.areEqual(tmodel.val(key), newValue, (_tmodel$targets$key$d = (_tmodel$targets$
|
|
429
|
+
var _tmodel$targets$key$d, _tmodel$targets$key;
|
|
430
|
+
if (newSteps > 0 && !TUtil.areEqual(tmodel.val(key), newValue, (_tmodel$targets$key$d = (_tmodel$targets$key = tmodel.targets[key]) === null || _tmodel$targets$key === void 0 ? void 0 : _tmodel$targets$key.deepEquality) !== null && _tmodel$targets$key$d !== void 0 ? _tmodel$targets$key$d : false)) {
|
|
402
431
|
tmodel.resetTargetStep(key);
|
|
403
432
|
}
|
|
404
433
|
TargetExecutor.assignSingleTarget(targetValue, newValue, targetInitial, newSteps, newCycles, newInterval, easing);
|
|
@@ -407,6 +436,8 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
407
436
|
}, {
|
|
408
437
|
key: "createTModel",
|
|
409
438
|
value: function createTModel(key, targets) {
|
|
439
|
+
var _key;
|
|
440
|
+
key = (_key = key) === null || _key === void 0 ? void 0 : _key.replace(/\${1,2}$/, '');
|
|
410
441
|
return TModelFactory.create(key, targets, function (type, targets) {
|
|
411
442
|
return new TModel(type, targets);
|
|
412
443
|
});
|