targetj 1.0.254 → 1.0.256
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/build/$Dom.js +28 -31
- package/build/TargetUtil.js +21 -8
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/$Dom.js
CHANGED
|
@@ -133,10 +133,15 @@ var $Dom = /*#__PURE__*/function () {
|
|
|
133
133
|
}
|
|
134
134
|
return slot;
|
|
135
135
|
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "isManagedChildNode",
|
|
138
|
+
value: function isManagedChildNode(node) {
|
|
139
|
+
return (node === null || node === void 0 ? void 0 : node.nodeType) === 1 && node.getAttribute("tgjs") === "true";
|
|
140
|
+
}
|
|
136
141
|
}, {
|
|
137
142
|
key: "enableSlotMode",
|
|
138
143
|
value: function enableSlotMode() {
|
|
139
|
-
var _this
|
|
144
|
+
var _this = this;
|
|
140
145
|
if (this.slotModeEnabled) {
|
|
141
146
|
return;
|
|
142
147
|
}
|
|
@@ -144,32 +149,24 @@ var $Dom = /*#__PURE__*/function () {
|
|
|
144
149
|
this.slotModeEnabled = true;
|
|
145
150
|
return;
|
|
146
151
|
}
|
|
147
|
-
var
|
|
148
|
-
if (
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
var slot = this.findContentSlot();
|
|
153
|
+
if (!slot) {
|
|
154
|
+
var existingNodes = Array.from(this.element.childNodes);
|
|
155
|
+
slot = document.createElement("div");
|
|
156
|
+
slot.setAttribute("data-tj-slot", "content");
|
|
157
|
+
this.element.insertBefore(slot, this.element.firstChild);
|
|
158
|
+
for (var _i = 0, _existingNodes = existingNodes; _i < _existingNodes.length; _i++) {
|
|
159
|
+
var node = _existingNodes[_i];
|
|
160
|
+
if (!this.isManagedChildNode(node)) {
|
|
161
|
+
slot.appendChild(node);
|
|
162
|
+
}
|
|
151
163
|
}
|
|
152
|
-
this.contentSlot = existingSlot;
|
|
153
|
-
this.slotModeEnabled = true;
|
|
154
|
-
this.hasRealChildren = Array.from(this.element.childNodes).some(function (node) {
|
|
155
|
-
return node !== existingSlot;
|
|
156
|
-
});
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
if (!((_this$element4 = this.element) !== null && _this$element4 !== void 0 && _this$element4.firstChild)) {
|
|
160
|
-
this.slotModeEnabled = true;
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
var existingNodes = Array.from(this.element.childNodes);
|
|
164
|
-
var slot = document.createElement("div");
|
|
165
|
-
slot.setAttribute("data-tj-slot", "content");
|
|
166
|
-
this.element.insertBefore(slot, this.element.firstChild);
|
|
167
|
-
for (var _i = 0, _existingNodes = existingNodes; _i < _existingNodes.length; _i++) {
|
|
168
|
-
var node = _existingNodes[_i];
|
|
169
|
-
slot.appendChild(node);
|
|
170
164
|
}
|
|
171
165
|
this.contentSlot = slot;
|
|
172
166
|
this.slotModeEnabled = true;
|
|
167
|
+
this.hasRealChildren = Array.from(this.element.children).some(function (child) {
|
|
168
|
+
return child !== slot && _this.isManagedChildNode(child);
|
|
169
|
+
});
|
|
173
170
|
}
|
|
174
171
|
}, {
|
|
175
172
|
key: "ensureSlotMode",
|
|
@@ -201,8 +198,8 @@ var $Dom = /*#__PURE__*/function () {
|
|
|
201
198
|
}, {
|
|
202
199
|
key: "getTagName",
|
|
203
200
|
value: function getTagName() {
|
|
204
|
-
var _this$
|
|
205
|
-
return (_this$
|
|
201
|
+
var _this$element4;
|
|
202
|
+
return (_this$element4 = this.element) === null || _this$element4 === void 0 || (_this$element4 = _this$element4.tagName) === null || _this$element4 === void 0 ? void 0 : _this$element4.toLowerCase();
|
|
206
203
|
}
|
|
207
204
|
}, {
|
|
208
205
|
key: "setSelector",
|
|
@@ -291,9 +288,9 @@ var $Dom = /*#__PURE__*/function () {
|
|
|
291
288
|
}, {
|
|
292
289
|
key: "setStyleByMap",
|
|
293
290
|
value: function setStyleByMap(attrMap) {
|
|
294
|
-
var
|
|
291
|
+
var _this2 = this;
|
|
295
292
|
Object.keys(attrMap).forEach(function (key) {
|
|
296
|
-
|
|
293
|
+
_this2.style(key, attrMap[key]);
|
|
297
294
|
});
|
|
298
295
|
}
|
|
299
296
|
}, {
|
|
@@ -578,14 +575,14 @@ var $Dom = /*#__PURE__*/function () {
|
|
|
578
575
|
}, {
|
|
579
576
|
key: "getScrollTop",
|
|
580
577
|
value: function getScrollTop() {
|
|
581
|
-
var _this$element$scrollT, _this$
|
|
582
|
-
return (_this$element$scrollT = (_this$
|
|
578
|
+
var _this$element$scrollT, _this$element5;
|
|
579
|
+
return (_this$element$scrollT = (_this$element5 = this.element) === null || _this$element5 === void 0 ? void 0 : _this$element5.scrollTop) !== null && _this$element$scrollT !== void 0 ? _this$element$scrollT : 0;
|
|
583
580
|
}
|
|
584
581
|
}, {
|
|
585
582
|
key: "getScrollLeft",
|
|
586
583
|
value: function getScrollLeft() {
|
|
587
|
-
var _this$element$scrollL, _this$
|
|
588
|
-
return (_this$element$scrollL = (_this$
|
|
584
|
+
var _this$element$scrollL, _this$element6;
|
|
585
|
+
return (_this$element$scrollL = (_this$element6 = this.element) === null || _this$element6 === void 0 ? void 0 : _this$element6.scrollLeft) !== null && _this$element$scrollL !== void 0 ? _this$element$scrollL : 0;
|
|
589
586
|
}
|
|
590
587
|
}], [{
|
|
591
588
|
key: "createTemplate",
|
package/build/TargetUtil.js
CHANGED
|
@@ -239,7 +239,7 @@ var TargetUtil = /*#__PURE__*/function () {
|
|
|
239
239
|
if (!isEndTrigger) {
|
|
240
240
|
targetValue.nextTargetUpdateCount = targetValue.updateCount;
|
|
241
241
|
} else {
|
|
242
|
-
TargetUtil.
|
|
242
|
+
TargetUtil.snapshotTriggeredByCompleteCounts(tmodel, nextTarget);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
var caughtUp = false;
|
|
@@ -395,12 +395,25 @@ var TargetUtil = /*#__PURE__*/function () {
|
|
|
395
395
|
return (_tmodel$targetValues$2 = (_tmodel$targetValues$3 = tmodel.targetValues[nextTarget]) === null || _tmodel$targetValues$3 === void 0 || (_tmodel$targetValues$3 = _tmodel$targetValues$3.triggeredByCompleteCountMap) === null || _tmodel$targetValues$3 === void 0 ? void 0 : _tmodel$targetValues$3.get(key)) !== null && _tmodel$targetValues$2 !== void 0 ? _tmodel$targetValues$2 : 0;
|
|
396
396
|
}
|
|
397
397
|
}, {
|
|
398
|
-
key: "
|
|
399
|
-
value: function
|
|
398
|
+
key: "snapshotTriggeredByCompleteCounts",
|
|
399
|
+
value: function snapshotTriggeredByCompleteCounts(tmodel, nextTarget) {
|
|
400
400
|
var _tmodel$targetValues;
|
|
401
401
|
var nextTargetValue = (_tmodel$targetValues = tmodel.targetValues)[nextTarget] || (_tmodel$targetValues[nextTarget] = TargetUtil.emptyValue());
|
|
402
|
-
var
|
|
403
|
-
|
|
402
|
+
var map = nextTargetValue.triggeredByCompleteCountMap || (nextTargetValue.triggeredByCompleteCountMap = new Map());
|
|
403
|
+
var nextIndex = tmodel.functionTargetNames.indexOf(nextTarget);
|
|
404
|
+
if (nextIndex < 0) {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
for (var i = 0; i < nextIndex; i++) {
|
|
408
|
+
var _tmodel$targetValues$4, _tmodel$targetValues$5;
|
|
409
|
+
var previousKey = tmodel.functionTargetNames[i];
|
|
410
|
+
var previousTarget = tmodel.targets[previousKey];
|
|
411
|
+
if ((previousTarget === null || previousTarget === void 0 ? void 0 : previousTarget.activateNextTarget) !== nextTarget) {
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
var completeCount = (_tmodel$targetValues$4 = (_tmodel$targetValues$5 = tmodel.targetValues[previousKey]) === null || _tmodel$targetValues$5 === void 0 ? void 0 : _tmodel$targetValues$5.completeCount) !== null && _tmodel$targetValues$4 !== void 0 ? _tmodel$targetValues$4 : 0;
|
|
415
|
+
map.set(previousKey, completeCount);
|
|
416
|
+
}
|
|
404
417
|
}
|
|
405
418
|
}, {
|
|
406
419
|
key: "activateTargetOnce",
|
|
@@ -836,9 +849,9 @@ var TargetUtil = /*#__PURE__*/function () {
|
|
|
836
849
|
value: function getOriginalNames(tmodel, key) {
|
|
837
850
|
var originalTModel, originalTargetName;
|
|
838
851
|
if (tmodel.isTargetImperative(key)) {
|
|
839
|
-
var _tmodel$targetValues$
|
|
840
|
-
originalTModel = (_tmodel$targetValues$
|
|
841
|
-
originalTargetName = (_tmodel$targetValues$
|
|
852
|
+
var _tmodel$targetValues$6, _tmodel$targetValues$7;
|
|
853
|
+
originalTModel = (_tmodel$targetValues$6 = tmodel.targetValues[key]) === null || _tmodel$targetValues$6 === void 0 ? void 0 : _tmodel$targetValues$6.originalTModel;
|
|
854
|
+
originalTargetName = (_tmodel$targetValues$7 = tmodel.targetValues[key]) === null || _tmodel$targetValues$7 === void 0 ? void 0 : _tmodel$targetValues$7.originalTargetName;
|
|
842
855
|
} else {
|
|
843
856
|
var _tmodel$targets$key4, _tmodel$targets$key5;
|
|
844
857
|
originalTModel = (_tmodel$targets$key4 = tmodel.targets[key]) === null || _tmodel$targets$key4 === void 0 ? void 0 : _tmodel$targets$key4.originalTModel;
|