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/TModel.js
CHANGED
|
@@ -448,7 +448,7 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
448
448
|
var hasDirtyEvent = this.hasEventDirty();
|
|
449
449
|
var hasDom = this.hasDom();
|
|
450
450
|
var visible = this.isVisible();
|
|
451
|
-
var result = this.currentStatus === 'active' || hasDirtyLayout || visible && hasDirtyEvent || this.isNowVisible || hasDom && hasDirtyEvent;
|
|
451
|
+
var result = this.currentStatus === 'active' || this.visibilityDirty || hasDirtyLayout || visible && hasDirtyEvent || this.isNowVisible || hasDom && hasDirtyEvent;
|
|
452
452
|
this.currentStatus = undefined;
|
|
453
453
|
return result;
|
|
454
454
|
}
|
package/build/TModelManager.js
CHANGED
|
@@ -20,6 +20,7 @@ import { getLocationManager, getEvents, getTargetManager, tRoot } from "./App.js
|
|
|
20
20
|
import { TModelUtil } from "./TModelUtil.js";
|
|
21
21
|
import { TargetUtil } from "./TargetUtil.js";
|
|
22
22
|
import { AnimationUtil } from "./AnimationUtil.js";
|
|
23
|
+
import { TargetData } from "./TargetData.js";
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* It analyzes all objects and based on their needs, creates or removes DOM elements, restyles objects, and rerenders them.
|
|
@@ -44,6 +45,7 @@ var TModelManager = /*#__PURE__*/function () {
|
|
|
44
45
|
noDom: [],
|
|
45
46
|
updatingTModels: [],
|
|
46
47
|
activeTModels: [],
|
|
48
|
+
noDomVisibilityTModels: [],
|
|
47
49
|
updatingTargets: [],
|
|
48
50
|
activeTargets: []
|
|
49
51
|
};
|
|
@@ -66,6 +68,7 @@ var TModelManager = /*#__PURE__*/function () {
|
|
|
66
68
|
this.lists.noDom.length = 0;
|
|
67
69
|
this.lists.updatingTModels.length = 0;
|
|
68
70
|
this.lists.activeTModels.length = 0;
|
|
71
|
+
this.lists.noDomVisibilityTModels.length = 0;
|
|
69
72
|
this.lists.updatingTargets.length = 0;
|
|
70
73
|
this.lists.activeTargets.length = 0;
|
|
71
74
|
this.targetMethodMap = {};
|
|
@@ -92,104 +95,116 @@ var TModelManager = /*#__PURE__*/function () {
|
|
|
92
95
|
var _iterator = _createForOfIteratorHelper(getLocationManager().hasLocationList),
|
|
93
96
|
_step;
|
|
94
97
|
try {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
lastVisibleMap[tmodel.oid] = undefined;
|
|
106
|
-
lastPreservedMap[tmodel.oid] = undefined;
|
|
107
|
-
if (!tmodel.exists()) {
|
|
108
|
-
if (tmodel.hasDom()) {
|
|
109
|
-
this.addToDeletedDom(tmodel);
|
|
110
|
-
}
|
|
111
|
-
delete this.visibleOidMap[tmodel.oid];
|
|
112
|
-
delete this.preservedDomMap[tmodel.oid];
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
var visible = tmodel.isVisible();
|
|
116
|
-
if (visible && tmodel.isIncluded()) {
|
|
117
|
-
this.visibleOidMap[tmodel.oid] = tmodel;
|
|
118
|
-
delete this.preservedDomMap[tmodel.oid];
|
|
119
|
-
this.lists.visible.push(tmodel);
|
|
120
|
-
} else {
|
|
121
|
-
delete this.visibleOidMap[tmodel.oid];
|
|
122
|
-
}
|
|
123
|
-
var preserveDom = this.shouldPreserveDom(tmodel);
|
|
124
|
-
if (!visible && preserveDom && tmodel.hasDom()) {
|
|
125
|
-
this.preservedDomMap[tmodel.oid] = tmodel;
|
|
126
|
-
} else {
|
|
127
|
-
delete this.preservedDomMap[tmodel.oid];
|
|
128
|
-
}
|
|
129
|
-
if (tmodel.hasDom()) {
|
|
130
|
-
if (!tmodel.canHaveDom() || !tmodel.isIncluded() || tmodel.canDeleteDom() && !visible && !preserveDom) {
|
|
131
|
-
this.addToDeletedDom(tmodel);
|
|
132
|
-
tmodel.getChildren().forEach(function (child) {
|
|
133
|
-
if (child.isLightweightChild) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
if (!child.managesOwnScroll()) {
|
|
137
|
-
_this.addToRecursiveDeletedDom(child);
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
if (visible || tmodel.isActivated()) {
|
|
143
|
-
var _state$updatingTarget, _state$activeTargetLi;
|
|
144
|
-
var state = tmodel.state();
|
|
145
|
-
if (((_state$updatingTarget = state.updatingTargetList) === null || _state$updatingTarget === void 0 ? void 0 : _state$updatingTarget.length) > 0 || tmodel.hasAnimatingTargets()) {
|
|
146
|
-
this.lists.updatingTModels.push(tmodel);
|
|
147
|
-
this.lists.updatingTargets = [].concat(_toConsumableArray(this.lists.updatingTargets), _toConsumableArray(state.updatingTargetList));
|
|
98
|
+
var _loop = function _loop() {
|
|
99
|
+
var _tmodel$noDomUpdating;
|
|
100
|
+
var tmodel = _step.value;
|
|
101
|
+
if (tmodel.isLightweightChild) {
|
|
102
|
+
delete lastVisibleMap[tmodel.oid];
|
|
103
|
+
delete lastPreservedMap[tmodel.oid];
|
|
104
|
+
delete _this.visibleOidMap[tmodel.oid];
|
|
105
|
+
delete _this.preservedDomMap[tmodel.oid];
|
|
106
|
+
_this.domPolicyMap.delete(tmodel.oid);
|
|
107
|
+
return 0; // continue
|
|
148
108
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
109
|
+
lastVisibleMap[tmodel.oid] = undefined;
|
|
110
|
+
lastPreservedMap[tmodel.oid] = undefined;
|
|
111
|
+
if (!tmodel.exists()) {
|
|
112
|
+
if (tmodel.hasDom()) {
|
|
113
|
+
_this.addToDeletedDom(tmodel);
|
|
114
|
+
}
|
|
115
|
+
delete _this.visibleOidMap[tmodel.oid];
|
|
116
|
+
delete _this.preservedDomMap[tmodel.oid];
|
|
117
|
+
return 0; // continue
|
|
157
118
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
119
|
+
var visible = tmodel.isVisible();
|
|
120
|
+
if (!visible && (_tmodel$noDomUpdating = tmodel.noDomUpdatingTargets) !== null && _tmodel$noDomUpdating !== void 0 && _tmodel$noDomUpdating.size && _toConsumableArray(tmodel.noDomUpdatingTargets).some(function (key) {
|
|
121
|
+
var targetValue = tmodel.targetValues[key];
|
|
122
|
+
return TargetData.affectsVisibility(key) && (targetValue === null || targetValue === void 0 ? void 0 : targetValue.catchupAt) !== undefined;
|
|
123
|
+
})) {
|
|
124
|
+
_this.lists.noDomVisibilityTModels.push(tmodel);
|
|
162
125
|
}
|
|
163
|
-
if (
|
|
164
|
-
|
|
126
|
+
if (visible && tmodel.isIncluded()) {
|
|
127
|
+
_this.visibleOidMap[tmodel.oid] = tmodel;
|
|
128
|
+
delete _this.preservedDomMap[tmodel.oid];
|
|
129
|
+
_this.lists.visible.push(tmodel);
|
|
130
|
+
} else {
|
|
131
|
+
delete _this.visibleOidMap[tmodel.oid];
|
|
165
132
|
}
|
|
166
|
-
|
|
167
|
-
|
|
133
|
+
var preserveDom = _this.shouldPreserveDom(tmodel);
|
|
134
|
+
if (!visible && preserveDom && tmodel.hasDom()) {
|
|
135
|
+
_this.preservedDomMap[tmodel.oid] = tmodel;
|
|
136
|
+
} else {
|
|
137
|
+
delete _this.preservedDomMap[tmodel.oid];
|
|
168
138
|
}
|
|
169
|
-
if (
|
|
170
|
-
|
|
139
|
+
if (tmodel.hasDom()) {
|
|
140
|
+
if (!tmodel.canHaveDom() || !tmodel.isIncluded() || tmodel.canDeleteDom() && !visible && !preserveDom) {
|
|
141
|
+
_this.addToDeletedDom(tmodel);
|
|
142
|
+
tmodel.getChildren().forEach(function (child) {
|
|
143
|
+
if (child.isLightweightChild) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (!child.managesOwnScroll()) {
|
|
147
|
+
_this.addToRecursiveDeletedDom(child);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
171
151
|
}
|
|
172
|
-
if (
|
|
173
|
-
|
|
152
|
+
if (visible || tmodel.isActivated()) {
|
|
153
|
+
var _state$updatingTarget, _state$activeTargetLi;
|
|
154
|
+
var state = tmodel.state();
|
|
155
|
+
if (((_state$updatingTarget = state.updatingTargetList) === null || _state$updatingTarget === void 0 ? void 0 : _state$updatingTarget.length) > 0 || tmodel.hasAnimatingTargets()) {
|
|
156
|
+
_this.lists.updatingTModels.push(tmodel);
|
|
157
|
+
_this.lists.updatingTargets = [].concat(_toConsumableArray(_this.lists.updatingTargets), _toConsumableArray(state.updatingTargetList));
|
|
158
|
+
}
|
|
159
|
+
if (((_state$activeTargetLi = state.activeTargetList) === null || _state$activeTargetLi === void 0 ? void 0 : _state$activeTargetLi.length) > 0) {
|
|
160
|
+
_this.lists.activeTModels.push(tmodel);
|
|
161
|
+
_this.lists.activeTargets = [].concat(_toConsumableArray(_this.lists.activeTargets), _toConsumableArray(state.activeTargetList));
|
|
162
|
+
}
|
|
174
163
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
164
|
+
if (preserveDom && !visible && !tmodel.isActivated()) {
|
|
165
|
+
if (_this.needsRestyle(tmodel)) {
|
|
166
|
+
_this.lists.restyle.push(tmodel);
|
|
167
|
+
}
|
|
179
168
|
}
|
|
180
|
-
if (tmodel.isActivated()) {
|
|
181
|
-
|
|
169
|
+
if (visible || tmodel.isActivated()) {
|
|
170
|
+
if (_this.needsRerender(tmodel)) {
|
|
171
|
+
_this.lists.rerender.push(tmodel);
|
|
172
|
+
}
|
|
173
|
+
if (_this.needsRestyle(tmodel)) {
|
|
174
|
+
_this.lists.restyle.push(tmodel);
|
|
175
|
+
}
|
|
176
|
+
if (_this.needsReasyncStyle(tmodel)) {
|
|
177
|
+
_this.lists.reasyncStyle.push(tmodel);
|
|
178
|
+
}
|
|
179
|
+
if (_this.needsReattach(tmodel)) {
|
|
180
|
+
_this.lists.reattach.push(tmodel);
|
|
181
|
+
}
|
|
182
|
+
if (_this.needsRelocation(tmodel)) {
|
|
183
|
+
_this.lists.relocation.push(tmodel);
|
|
184
|
+
}
|
|
185
|
+
var _state = tmodel.state();
|
|
186
|
+
if (_state.targetMethodMap && Object.keys(_state.targetMethodMap).length > 0) {
|
|
187
|
+
_this.targetMethodMap[tmodel.oid] = _objectSpread({}, _state.targetMethodMap);
|
|
188
|
+
_state.targetMethodMap = {};
|
|
189
|
+
}
|
|
190
|
+
if (tmodel.isActivated()) {
|
|
191
|
+
activated.push(tmodel);
|
|
192
|
+
}
|
|
182
193
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
194
|
+
if (_this.shouldCreateDom(tmodel, visible) && !_this.noDomMap[tmodel.oid]) {
|
|
195
|
+
var _tmodel$getDomHolder, _tmodel$getDomParent;
|
|
196
|
+
if ((_tmodel$getDomHolder = tmodel.getDomHolder()) !== null && _tmodel$getDomHolder !== void 0 && _tmodel$getDomHolder.exists() || _this.noDomMap[(_tmodel$getDomParent = tmodel.getDomParent()) === null || _tmodel$getDomParent === void 0 ? void 0 : _tmodel$getDomParent.oid]) {
|
|
197
|
+
_this.lists.noDom.push(tmodel);
|
|
198
|
+
_this.noDomMap[tmodel.oid] = true;
|
|
199
|
+
} else {
|
|
200
|
+
tmodel.markLayoutDirty('noDomHolder');
|
|
201
|
+
}
|
|
191
202
|
}
|
|
192
|
-
}
|
|
203
|
+
},
|
|
204
|
+
_ret;
|
|
205
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
206
|
+
_ret = _loop();
|
|
207
|
+
if (_ret === 0) continue;
|
|
193
208
|
}
|
|
194
209
|
} catch (err) {
|
|
195
210
|
_iterator.e(err);
|
|
@@ -637,8 +652,8 @@ var TModelManager = /*#__PURE__*/function () {
|
|
|
637
652
|
}, {
|
|
638
653
|
key: "catchupNoDomTargetsBeforeStyle",
|
|
639
654
|
value: function catchupNoDomTargetsBeforeStyle(tmodel) {
|
|
640
|
-
var _tmodel$
|
|
641
|
-
if (!((_tmodel$
|
|
655
|
+
var _tmodel$noDomUpdating2;
|
|
656
|
+
if (!((_tmodel$noDomUpdating2 = tmodel.noDomUpdatingTargets) !== null && _tmodel$noDomUpdating2 !== void 0 && _tmodel$noDomUpdating2.size)) {
|
|
642
657
|
return;
|
|
643
658
|
}
|
|
644
659
|
for (var _i4 = 0, _arr3 = _toConsumableArray(tmodel.noDomUpdatingTargets); _i4 < _arr3.length; _i4++) {
|
package/build/TModelUtil.js
CHANGED
|
@@ -147,8 +147,8 @@ var TModelUtil = /*#__PURE__*/function () {
|
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
149
|
}, {
|
|
150
|
-
key: "
|
|
151
|
-
value: function
|
|
150
|
+
key: "restoreMountedDom",
|
|
151
|
+
value: function restoreMountedDom($root, domState) {
|
|
152
152
|
if (!($root !== null && $root !== void 0 && $root.getElement()) || !domState) {
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
@@ -157,22 +157,25 @@ var TModelUtil = /*#__PURE__*/function () {
|
|
|
157
157
|
_step;
|
|
158
158
|
try {
|
|
159
159
|
var _loop = function _loop() {
|
|
160
|
+
var _element$tagName2;
|
|
160
161
|
var state = _step.value;
|
|
161
162
|
var element = elements[state.index];
|
|
162
163
|
if (!element) {
|
|
163
164
|
return 1; // continue
|
|
164
165
|
}
|
|
165
|
-
|
|
166
|
+
var tagName = (_element$tagName2 = element.tagName) === null || _element$tagName2 === void 0 ? void 0 : _element$tagName2.toLowerCase();
|
|
167
|
+
if (state.kind === "input" && tagName === "input") {
|
|
166
168
|
element.value = state.value;
|
|
167
169
|
element.checked = state.checked;
|
|
168
170
|
element.indeterminate = state.indeterminate;
|
|
169
|
-
} else if (state.kind === "textarea") {
|
|
171
|
+
} else if (state.kind === "textarea" && tagName === "textarea") {
|
|
170
172
|
element.value = state.value;
|
|
171
|
-
} else if (state.kind === "select") {
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
} else if (state.kind === "select" && tagName === "select") {
|
|
174
|
+
Array.from(element.options).forEach(function (option, index) {
|
|
175
|
+
var _state$selected;
|
|
176
|
+
option.selected = ((_state$selected = state.selected) === null || _state$selected === void 0 ? void 0 : _state$selected[index]) === true;
|
|
174
177
|
});
|
|
175
|
-
} else if (state.kind === "details") {
|
|
178
|
+
} else if (state.kind === "details" && tagName === "details") {
|
|
176
179
|
element.open = state.open;
|
|
177
180
|
}
|
|
178
181
|
};
|
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) {
|
|
@@ -326,7 +312,7 @@ var TUtil = /*#__PURE__*/function () {
|
|
|
326
312
|
}, {
|
|
327
313
|
key: "advanceTargetByElapsed",
|
|
328
314
|
value: function advanceTargetByElapsed(tmodel, key) {
|
|
329
|
-
var _targetValue$
|
|
315
|
+
var _targetValue$valueLis3;
|
|
330
316
|
var targetValue = tmodel.targetValues[key];
|
|
331
317
|
if (!targetValue) {
|
|
332
318
|
return {
|
|
@@ -336,21 +322,24 @@ var TUtil = /*#__PURE__*/function () {
|
|
|
336
322
|
done: false
|
|
337
323
|
};
|
|
338
324
|
}
|
|
339
|
-
if (!targetValue.catchupAt) {
|
|
340
|
-
var _targetValue$valueLis;
|
|
325
|
+
if (!TUtil.isDefined(targetValue.catchupAt)) {
|
|
326
|
+
var _targetValue$valueLis, _targetValue$valueLis2;
|
|
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: (_targetValue$valueLis2 = targetValue.valueList) !== null && _targetValue$valueLis2 !== void 0 && _targetValue$valueLis2.length ? valuePointer >= targetValue.valueList.length : false
|
|
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$valueLis3 = targetValue.valueList) !== null && _targetValue$valueLis3 !== void 0 && _targetValue$valueLis3.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
|
@@ -68,6 +68,12 @@ var TargetData = /*#__PURE__*/function () {
|
|
|
68
68
|
value: function isTransformKey(key) {
|
|
69
69
|
return !!TargetData.transformMap[key];
|
|
70
70
|
}
|
|
71
|
+
}, {
|
|
72
|
+
key: "affectsVisibility",
|
|
73
|
+
value: function affectsVisibility(key) {
|
|
74
|
+
key = TargetUtil.getTargetName(key);
|
|
75
|
+
return ["x", "y", "width", "height", "dim"].includes(TargetUtil.getTargetName(key));
|
|
76
|
+
}
|
|
71
77
|
}]);
|
|
72
78
|
}();
|
|
73
79
|
_TargetData = 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);
|
|
@@ -252,7 +256,7 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
252
256
|
}, {
|
|
253
257
|
key: "snapActualToTarget",
|
|
254
258
|
value: function snapActualToTarget(tmodel, key, snapUpdates) {
|
|
255
|
-
var _tmodel$animatingMap2;
|
|
259
|
+
var _tmodel$animatingMap$, _tmodel$animatingMap2;
|
|
256
260
|
var targetValue = tmodel.targetValues[key];
|
|
257
261
|
var newValue;
|
|
258
262
|
if (Array.isArray(targetValue.valueList)) {
|
|
@@ -264,7 +268,11 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
264
268
|
newValue = typeof value === 'function' ? value.call(tmodel) : value;
|
|
265
269
|
}
|
|
266
270
|
var valueChanged = tmodel.val(key) !== newValue;
|
|
267
|
-
var
|
|
271
|
+
var cleanKey = TargetUtil.getTargetName(key);
|
|
272
|
+
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) {
|
|
273
|
+
return TargetUtil.getTargetName(animatedKey) === cleanKey;
|
|
274
|
+
});
|
|
275
|
+
var isAnimating = !!animatedKey;
|
|
268
276
|
if (!valueChanged && !isAnimating) {
|
|
269
277
|
return;
|
|
270
278
|
}
|
|
@@ -273,7 +281,7 @@ var TargetExecutor = /*#__PURE__*/function () {
|
|
|
273
281
|
tmodel.setActual(key, newValue);
|
|
274
282
|
TUtil.handleValueChange(tmodel, key);
|
|
275
283
|
}
|
|
276
|
-
if (!tmodel.hasValidAnimation() || !tmodel.canBeAnimated(key)) {
|
|
284
|
+
if (!isAnimating || !tmodel.hasValidAnimation() || !tmodel.canBeAnimated(key)) {
|
|
277
285
|
targetValue.snapAnimation = false;
|
|
278
286
|
return;
|
|
279
287
|
}
|