taggedjs 2.4.10 → 2.4.14
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/bundle.js +918 -543
- package/bundle.js.map +1 -1
- package/js/Clones.type.d.ts +4 -1
- package/js/Clones.type.js +1 -1
- package/js/Clones.type.js.map +1 -1
- package/js/Tag.class.d.ts +8 -10
- package/js/Tag.class.js +131 -71
- package/js/Tag.class.js.map +1 -1
- package/js/Tag.utils.d.ts +5 -5
- package/js/Tag.utils.js +1 -1
- package/js/Tag.utils.js.map +1 -1
- package/js/TemplaterResult.class.d.ts +9 -3
- package/js/TemplaterResult.class.js +19 -18
- package/js/TemplaterResult.class.js.map +1 -1
- package/js/alterProps.function.d.ts +2 -0
- package/js/alterProps.function.js +18 -13
- package/js/alterProps.function.js.map +1 -1
- package/js/checkDestroyPrevious.function.d.ts +3 -1
- package/js/checkDestroyPrevious.function.js +33 -11
- package/js/checkDestroyPrevious.function.js.map +1 -1
- package/js/destroyTag.function.js +4 -5
- package/js/destroyTag.function.js.map +1 -1
- package/js/getCallback.js +1 -2
- package/js/getCallback.js.map +1 -1
- package/js/hasTagSupportChanged.function.js +0 -4
- package/js/hasTagSupportChanged.function.js.map +1 -1
- package/js/index.d.ts +1 -2
- package/js/index.js +1 -2
- package/js/index.js.map +1 -1
- package/js/insertAfter.function.d.ts +2 -0
- package/js/insertAfter.function.js +6 -0
- package/js/insertAfter.function.js.map +1 -0
- package/js/interpolateElement.d.ts +3 -2
- package/js/interpolateElement.js +3 -2
- package/js/interpolateElement.js.map +1 -1
- package/js/interpolateTemplate.d.ts +2 -3
- package/js/interpolateTemplate.js +6 -24
- package/js/interpolateTemplate.js.map +1 -1
- package/js/interpolations.js +2 -1
- package/js/interpolations.js.map +1 -1
- package/js/isInstance.d.ts +2 -2
- package/js/isInstance.js.map +1 -1
- package/js/onInit.js +5 -3
- package/js/onInit.js.map +1 -1
- package/js/processAttribute.function.d.ts +1 -0
- package/js/processAttribute.function.js +3 -3
- package/js/processAttribute.function.js.map +1 -1
- package/js/processNewValue.function.js +1 -1
- package/js/processNewValue.function.js.map +1 -1
- package/js/processRegularValue.function.d.ts +2 -2
- package/js/processRegularValue.function.js +7 -6
- package/js/processRegularValue.function.js.map +1 -1
- package/js/processSubjectComponent.function.d.ts +4 -3
- package/js/processSubjectComponent.function.js +30 -22
- package/js/processSubjectComponent.function.js.map +1 -1
- package/js/processSubjectValue.function.d.ts +6 -10
- package/js/processSubjectValue.function.js +6 -54
- package/js/processSubjectValue.function.js.map +1 -1
- package/js/processTag.function.d.ts +7 -0
- package/js/processTag.function.js +59 -0
- package/js/processTag.function.js.map +1 -0
- package/js/processTagArray.d.ts +7 -5
- package/js/processTagArray.js +55 -18
- package/js/processTagArray.js.map +1 -1
- package/js/processTagResult.function.d.ts +1 -1
- package/js/processTagResult.function.js +26 -32
- package/js/processTagResult.function.js.map +1 -1
- package/js/render.d.ts +2 -1
- package/js/render.js.map +1 -1
- package/js/renderExistingTag.function.js +7 -16
- package/js/renderExistingTag.function.js.map +1 -1
- package/js/renderTagSupport.function.js +4 -12
- package/js/renderTagSupport.function.js.map +1 -1
- package/js/subject/Subject.class.d.ts +24 -0
- package/js/subject/Subject.class.js +103 -0
- package/js/subject/Subject.class.js.map +1 -0
- package/js/subject/Subject.utils.d.ts +27 -0
- package/js/subject/Subject.utils.js +4 -0
- package/js/subject/Subject.utils.js.map +1 -0
- package/js/subject/ValueSubject.d.ts +9 -0
- package/js/subject/ValueSubject.js +15 -0
- package/js/subject/ValueSubject.js.map +1 -0
- package/js/subject/combineLatest.function.d.ts +2 -0
- package/js/subject/combineLatest.function.js +24 -0
- package/js/subject/combineLatest.function.js.map +1 -0
- package/js/subject/index.d.ts +4 -0
- package/js/subject/index.js +5 -0
- package/js/subject/index.js.map +1 -0
- package/js/subject/will.functions.d.ts +8 -0
- package/js/subject/will.functions.js +32 -0
- package/js/subject/will.functions.js.map +1 -0
- package/js/tag.d.ts +1 -1
- package/js/tag.js +3 -5
- package/js/tag.js.map +1 -1
- package/js/tagElement.js +1 -1
- package/js/tagElement.js.map +1 -1
- package/js/updateBeforeTemplate.function.d.ts +3 -0
- package/js/updateBeforeTemplate.function.js +16 -0
- package/js/updateBeforeTemplate.function.js.map +1 -0
- package/js/updateExistingTagComponent.function.d.ts +2 -1
- package/js/updateExistingTagComponent.function.js +64 -43
- package/js/updateExistingTagComponent.function.js.map +1 -1
- package/js/updateExistingValue.function.d.ts +3 -2
- package/js/updateExistingValue.function.js +50 -22
- package/js/updateExistingValue.function.js.map +1 -1
- package/package.json +1 -2
- /package/js/{errors.d.ts → Errors.d.ts} +0 -0
- /package/js/{errors.js → Errors.js} +0 -0
- /package/js/{errors.js.map → Errors.js.map} +0 -0
package/bundle.js
CHANGED
|
@@ -1,73 +1,28 @@
|
|
|
1
1
|
/******/ var __webpack_modules__ = ({
|
|
2
2
|
|
|
3
|
-
/***/ "./ts/
|
|
4
|
-
|
|
5
|
-
!*** ./ts/
|
|
6
|
-
|
|
3
|
+
/***/ "./ts/Clones.type.ts":
|
|
4
|
+
/*!***************************!*\
|
|
5
|
+
!*** ./ts/Clones.type.ts ***!
|
|
6
|
+
\***************************/
|
|
7
7
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
8
|
|
|
9
9
|
__webpack_require__.r(__webpack_exports__);
|
|
10
|
-
|
|
10
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11
|
+
/* harmony export */ isRemoveTemplates: () => (/* binding */ isRemoveTemplates)
|
|
12
|
+
/* harmony export */ });
|
|
13
|
+
const isRemoveTemplates = true;
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
/***/ }),
|
|
14
17
|
|
|
15
|
-
/***/ "./ts/
|
|
16
|
-
|
|
17
|
-
!*** ./ts/
|
|
18
|
-
|
|
18
|
+
/***/ "./ts/ElementTargetEvent.interface.ts":
|
|
19
|
+
/*!********************************************!*\
|
|
20
|
+
!*** ./ts/ElementTargetEvent.interface.ts ***!
|
|
21
|
+
\********************************************/
|
|
19
22
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20
23
|
|
|
21
24
|
__webpack_require__.r(__webpack_exports__);
|
|
22
|
-
|
|
23
|
-
/* harmony export */ Subject: () => (/* binding */ Subject)
|
|
24
|
-
/* harmony export */ });
|
|
25
|
-
class Subject {
|
|
26
|
-
value;
|
|
27
|
-
isSubject = true;
|
|
28
|
-
subscribers = [];
|
|
29
|
-
// unsubcount = 0 // 🔬 testing
|
|
30
|
-
constructor(value) {
|
|
31
|
-
this.value = value;
|
|
32
|
-
}
|
|
33
|
-
subscribe(callback) {
|
|
34
|
-
this.subscribers.push(callback);
|
|
35
|
-
SubjectClass.globalSubs.push(callback); // 🔬 testing
|
|
36
|
-
const countSubject = SubjectClass.globalSubCount$;
|
|
37
|
-
SubjectClass.globalSubCount$.set(countSubject.value + 1);
|
|
38
|
-
const unsubscribe = () => {
|
|
39
|
-
unsubscribe.unsubscribe();
|
|
40
|
-
};
|
|
41
|
-
// Return a function to unsubscribe from the BehaviorSubject
|
|
42
|
-
unsubscribe.unsubscribe = () => {
|
|
43
|
-
removeSubFromArray(this.subscribers, callback);
|
|
44
|
-
removeSubFromArray(SubjectClass.globalSubs, callback); // 🔬 testing
|
|
45
|
-
SubjectClass.globalSubCount$.set(countSubject.value - 1);
|
|
46
|
-
// any double unsubscribes will be ignored
|
|
47
|
-
unsubscribe.unsubscribe = () => undefined;
|
|
48
|
-
};
|
|
49
|
-
return unsubscribe;
|
|
50
|
-
}
|
|
51
|
-
set(value) {
|
|
52
|
-
this.value = value;
|
|
53
|
-
// Notify all subscribers with the new value
|
|
54
|
-
this.subscribers.forEach((callback) => {
|
|
55
|
-
callback.value = value;
|
|
56
|
-
callback(value);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
next = this.set;
|
|
60
|
-
}
|
|
61
|
-
function removeSubFromArray(subscribers, callback) {
|
|
62
|
-
const index = subscribers.indexOf(callback);
|
|
63
|
-
if (index !== -1) {
|
|
64
|
-
subscribers.splice(index, 1);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const SubjectClass = Subject;
|
|
68
|
-
SubjectClass.globalSubs = []; // 🔬 for testing
|
|
69
|
-
SubjectClass.globalSubCount$ = new Subject(); // for ease of debugging
|
|
70
|
-
SubjectClass.globalSubCount$.set(0);
|
|
25
|
+
|
|
71
26
|
|
|
72
27
|
|
|
73
28
|
/***/ }),
|
|
@@ -80,7 +35,6 @@ SubjectClass.globalSubCount$.set(0);
|
|
|
80
35
|
|
|
81
36
|
__webpack_require__.r(__webpack_exports__);
|
|
82
37
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
83
|
-
/* harmony export */ ArrayValueNeverSet: () => (/* binding */ ArrayValueNeverSet),
|
|
84
38
|
/* harmony export */ Tag: () => (/* binding */ Tag),
|
|
85
39
|
/* harmony export */ escapeSearch: () => (/* binding */ escapeSearch),
|
|
86
40
|
/* harmony export */ escapeVariable: () => (/* binding */ escapeVariable),
|
|
@@ -94,6 +48,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
94
48
|
/* harmony import */ var _processNewValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./processNewValue.function */ "./ts/processNewValue.function.ts");
|
|
95
49
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
96
50
|
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
51
|
+
/* harmony import */ var _Clones_type__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Clones.type */ "./ts/Clones.type.ts");
|
|
52
|
+
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./checkDestroyPrevious.function */ "./ts/checkDestroyPrevious.function.ts");
|
|
53
|
+
/* harmony import */ var _insertAfter_function__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./insertAfter.function */ "./ts/insertAfter.function.ts");
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
97
57
|
|
|
98
58
|
|
|
99
59
|
|
|
@@ -106,16 +66,13 @@ const variablePrefix = '__tagvar';
|
|
|
106
66
|
const escapeVariable = '--' + variablePrefix + '--';
|
|
107
67
|
const prefixSearch = new RegExp(variablePrefix, 'g');
|
|
108
68
|
const escapeSearch = new RegExp(escapeVariable, 'g');
|
|
109
|
-
class ArrayValueNeverSet {
|
|
110
|
-
isArrayValueNeverSet = true;
|
|
111
|
-
}
|
|
112
69
|
class Tag {
|
|
113
70
|
strings;
|
|
114
71
|
values;
|
|
72
|
+
version = 0;
|
|
115
73
|
isTag = true;
|
|
116
74
|
hasLiveElements = false;
|
|
117
75
|
clones = []; // elements on document. Needed at destroy process to know what to destroy
|
|
118
|
-
cloneSubs = []; // subscriptions created by clones
|
|
119
76
|
childTags = []; // tags on me
|
|
120
77
|
tagSupport;
|
|
121
78
|
lastTemplateString = undefined; // used to compare templates for updates
|
|
@@ -123,15 +80,15 @@ class Tag {
|
|
|
123
80
|
ownerTag;
|
|
124
81
|
// insertBefore?: Element
|
|
125
82
|
appElement; // only seen on this.getAppElement().appElement
|
|
126
|
-
// present only when an array. Populated by
|
|
127
|
-
|
|
83
|
+
// present only when an array. Populated by Tag.key()
|
|
84
|
+
memory = {};
|
|
128
85
|
constructor(strings, values) {
|
|
129
86
|
this.strings = strings;
|
|
130
87
|
this.values = values;
|
|
131
88
|
}
|
|
132
89
|
/** Used for array, such as array.map(), calls aka array.map(x => html``.key(x)) */
|
|
133
90
|
key(arrayValue) {
|
|
134
|
-
this.arrayValue = arrayValue;
|
|
91
|
+
this.memory.arrayValue = arrayValue;
|
|
135
92
|
return this;
|
|
136
93
|
}
|
|
137
94
|
destroy(options = {
|
|
@@ -145,6 +102,18 @@ class Tag {
|
|
|
145
102
|
const global = tagSupport.templater.global;
|
|
146
103
|
// removing is considered rendering. Prevents after event processing of this tag even tho possibly deleted
|
|
147
104
|
// ++this.tagSupport.templater.global.renderCount
|
|
105
|
+
const subject = tagSupport.subject;
|
|
106
|
+
// put back down the template tag
|
|
107
|
+
const insertBefore = global.insertBefore;
|
|
108
|
+
if (_Clones_type__WEBPACK_IMPORTED_MODULE_8__.isRemoveTemplates) {
|
|
109
|
+
const placeholder = global.placeholderElm;
|
|
110
|
+
if (placeholder && !('arrayValue' in this.memory)) {
|
|
111
|
+
if (!options.byParent) {
|
|
112
|
+
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_9__.restoreTagMarker)(this, insertBefore);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
delete global.placeholderElm;
|
|
148
117
|
// the isComponent check maybe able to be removed
|
|
149
118
|
const isComponent = tagSupport ? true : false;
|
|
150
119
|
if (isComponent) {
|
|
@@ -152,7 +121,6 @@ class Tag {
|
|
|
152
121
|
}
|
|
153
122
|
const childTags = options.byParent ? [] : getChildTagsToDestroy(this.childTags);
|
|
154
123
|
// signify that no further event rendering should take place by making logic think a render occurred during event
|
|
155
|
-
// childTags.forEach(child => ++child.tagSupport.templater.global.renderCount)
|
|
156
124
|
// signify immediately child has been deleted (looked for during event processing)
|
|
157
125
|
childTags.forEach(child => {
|
|
158
126
|
const subGlobal = child.tagSupport.templater.global;
|
|
@@ -163,7 +131,7 @@ class Tag {
|
|
|
163
131
|
delete global.newest;
|
|
164
132
|
global.deleted = true;
|
|
165
133
|
this.hasLiveElements = false;
|
|
166
|
-
delete
|
|
134
|
+
delete subject.tag;
|
|
167
135
|
this.destroySubscriptions();
|
|
168
136
|
let mainPromise;
|
|
169
137
|
if (this.ownerTag) {
|
|
@@ -191,8 +159,9 @@ class Tag {
|
|
|
191
159
|
return mainPromise.then(() => options.stagger);
|
|
192
160
|
}
|
|
193
161
|
destroySubscriptions() {
|
|
194
|
-
this.
|
|
195
|
-
|
|
162
|
+
const global = this.tagSupport.templater.global;
|
|
163
|
+
global.subscriptions.forEach(cloneSub => cloneSub.unsubscribe());
|
|
164
|
+
global.subscriptions.length = 0;
|
|
196
165
|
}
|
|
197
166
|
destroyClones({ stagger } = {
|
|
198
167
|
stagger: 0,
|
|
@@ -205,6 +174,7 @@ class Tag {
|
|
|
205
174
|
}
|
|
206
175
|
return { stagger };
|
|
207
176
|
}
|
|
177
|
+
/** Reviews elements for the presences of ondestroy */
|
|
208
178
|
checkCloneRemoval(clone, stagger) {
|
|
209
179
|
let promise;
|
|
210
180
|
const customElm = clone;
|
|
@@ -248,31 +218,6 @@ class Tag {
|
|
|
248
218
|
}
|
|
249
219
|
isLikeTag(tag) {
|
|
250
220
|
return (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_7__.isLikeTags)(this, tag);
|
|
251
|
-
const { string } = tag.getTemplate();
|
|
252
|
-
// TODO: most likely remove?
|
|
253
|
-
if (!this.lastTemplateString) {
|
|
254
|
-
throw new Error('no template here');
|
|
255
|
-
}
|
|
256
|
-
const stringMatched = string === this.lastTemplateString;
|
|
257
|
-
if (!stringMatched || tag.values.length !== this.values.length) {
|
|
258
|
-
return false;
|
|
259
|
-
}
|
|
260
|
-
const allVarsMatch = tag.values.every((value, index) => {
|
|
261
|
-
const compareTo = this.values[index];
|
|
262
|
-
const isFunctions = value instanceof Function && compareTo instanceof Function;
|
|
263
|
-
if (isFunctions) {
|
|
264
|
-
const stringMatch = value.toString() === compareTo.toString();
|
|
265
|
-
if (stringMatch) {
|
|
266
|
-
return true;
|
|
267
|
-
}
|
|
268
|
-
return false;
|
|
269
|
-
}
|
|
270
|
-
return true;
|
|
271
|
-
});
|
|
272
|
-
if (allVarsMatch) {
|
|
273
|
-
return true;
|
|
274
|
-
}
|
|
275
|
-
return false;
|
|
276
221
|
}
|
|
277
222
|
updateByTag(tag) {
|
|
278
223
|
if (!this.tagSupport.templater.global.oldest) {
|
|
@@ -334,31 +279,40 @@ class Tag {
|
|
|
334
279
|
}
|
|
335
280
|
this.buildBeforeElement(insertBefore, {
|
|
336
281
|
forceElement: true,
|
|
337
|
-
counts: { added: 0, removed: 0 },
|
|
282
|
+
counts: { added: 0, removed: 0 },
|
|
338
283
|
});
|
|
339
284
|
}
|
|
340
285
|
buildBeforeElement(insertBefore, options = {
|
|
341
286
|
forceElement: false,
|
|
342
287
|
counts: { added: 0, removed: 0 },
|
|
343
|
-
test: false
|
|
344
288
|
}) {
|
|
345
|
-
|
|
346
|
-
|
|
289
|
+
const subject = this.tagSupport.subject;
|
|
290
|
+
const thisTemplater = this.tagSupport.templater;
|
|
291
|
+
const global = thisTemplater.global;
|
|
292
|
+
if (_Clones_type__WEBPACK_IMPORTED_MODULE_8__.isRemoveTemplates) {
|
|
293
|
+
const placeholderElm = global.placeholderElm;
|
|
294
|
+
if (placeholderElm) {
|
|
295
|
+
const parentNode = placeholderElm.parentNode;
|
|
296
|
+
parentNode.insertBefore(insertBefore, placeholderElm);
|
|
297
|
+
// ??? - removed as we don't steal clones anymore
|
|
298
|
+
// this.clones.push( placeholderElm ) // put back on chopping block
|
|
299
|
+
delete global.placeholderElm;
|
|
300
|
+
}
|
|
347
301
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
302
|
+
const trueInsertBefore = insertBefore;
|
|
303
|
+
global.oldest = this;
|
|
304
|
+
global.newest = this;
|
|
305
|
+
subject.tag = this;
|
|
351
306
|
this.hasLiveElements = true;
|
|
352
307
|
// remove old clones
|
|
353
308
|
if (this.clones.length) {
|
|
354
309
|
this.clones.forEach(clone => this.checkCloneRemoval(clone, 0));
|
|
355
310
|
}
|
|
356
|
-
|
|
357
|
-
this.tagSupport.templater.global.insertBefore = insertBefore;
|
|
311
|
+
global.insertBefore = insertBefore;
|
|
358
312
|
// const context = this.tagSupport.memory.context // this.update()
|
|
359
313
|
const context = this.update();
|
|
360
314
|
const template = this.getTemplate();
|
|
361
|
-
if (!
|
|
315
|
+
if (!trueInsertBefore.parentNode) {
|
|
362
316
|
throw new Error('no parent before building tag');
|
|
363
317
|
}
|
|
364
318
|
const elementContainer = document.createElement('div');
|
|
@@ -370,38 +324,99 @@ class Tag {
|
|
|
370
324
|
{
|
|
371
325
|
forceElement: options.forceElement,
|
|
372
326
|
counts: options.counts
|
|
373
|
-
}
|
|
374
|
-
if (!
|
|
327
|
+
});
|
|
328
|
+
if (!trueInsertBefore.parentNode) {
|
|
375
329
|
throw new Error('no parent building tag');
|
|
376
330
|
}
|
|
377
|
-
afterInterpolateElement(elementContainer,
|
|
331
|
+
afterInterpolateElement(elementContainer, trueInsertBefore, // insertBefore (will be removed)
|
|
332
|
+
this, // ownerTag
|
|
378
333
|
context, options);
|
|
379
|
-
// this.clones.push(...clones)
|
|
380
334
|
// Any tag components that were found should be processed AFTER the owner processes its elements. Avoid double processing of elements attributes like (oninit)=${}
|
|
381
335
|
let isForceElement = options.forceElement;
|
|
382
336
|
tagComponents.forEach(tagComponent => {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
if (!insertBefore.parentNode) {
|
|
337
|
+
const tagSupport = tagComponent.ownerTag.tagSupport;
|
|
338
|
+
const tagGlobal = tagSupport.templater.global;
|
|
339
|
+
const placeholderElm = tagGlobal.placeholderElm; // global.placeholderElm
|
|
340
|
+
if (!placeholderElm && !insertBefore.parentNode) {
|
|
387
341
|
throw new Error('no parent building tag components');
|
|
388
342
|
}
|
|
389
|
-
|
|
390
|
-
//
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
343
|
+
const before = tagComponent.insertBefore; // insertBefore (will be removed)
|
|
344
|
+
(0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_3__.subscribeToTemplate)(before, // tagComponent.insertBefore,
|
|
345
|
+
tagComponent.subject, tagComponent.ownerTag, options.counts, { isForceElement });
|
|
346
|
+
const clones = afterInterpolateElement(elementContainer, before, // (will be removed)
|
|
347
|
+
tagComponent.ownerTag, // this, // ownerTag
|
|
348
|
+
context, options);
|
|
349
|
+
if (placeholderElm && !placeholderElm?.parentNode) {
|
|
350
|
+
const clone = clones[this.clones.length - 1];
|
|
351
|
+
if (clone) {
|
|
352
|
+
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_9__.restoreTagMarker)(tagComponent.ownerTag, clone);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
if (placeholderElm) {
|
|
356
|
+
if (placeholderElm.parentNode) {
|
|
357
|
+
if (!global.placeholderElm) {
|
|
358
|
+
global.placeholderElm = placeholderElm;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (this.clones.length) {
|
|
362
|
+
if (insertBefore.parentNode) {
|
|
363
|
+
global.placeholderElm = insertBefore.previousSibling;
|
|
364
|
+
const parentNode = insertBefore.parentNode;
|
|
365
|
+
parentNode.removeChild(insertBefore);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
394
368
|
}
|
|
395
|
-
*/
|
|
396
369
|
});
|
|
370
|
+
if (!global.placeholderElm) {
|
|
371
|
+
// const clone = getLastCloneFromTags(this)
|
|
372
|
+
// const clone = (insertBefore as Element).previousElementSibling as Element
|
|
373
|
+
const clone = insertBefore.previousSibling;
|
|
374
|
+
if (clone) {
|
|
375
|
+
const parentNode = insertBefore.parentNode;
|
|
376
|
+
global.placeholderElm = clone;
|
|
377
|
+
parentNode.removeChild(insertBefore);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
397
380
|
}
|
|
398
381
|
}
|
|
399
|
-
function afterInterpolateElement(container, insertBefore,
|
|
382
|
+
function afterInterpolateElement(container, insertBefore, tag,
|
|
400
383
|
// preClones: Clones,
|
|
401
384
|
context, options) {
|
|
402
385
|
const clones = (0,_render__WEBPACK_IMPORTED_MODULE_1__.buildClones)(container, insertBefore);
|
|
403
|
-
|
|
404
|
-
|
|
386
|
+
if (!clones.length) {
|
|
387
|
+
return clones;
|
|
388
|
+
}
|
|
389
|
+
const ownerSupport = tag.tagSupport;
|
|
390
|
+
const ownerGlobal = ownerSupport.templater.global;
|
|
391
|
+
const hadBefore = _Clones_type__WEBPACK_IMPORTED_MODULE_8__.isRemoveTemplates && ownerGlobal.placeholderElm;
|
|
392
|
+
const parentNode = hadBefore ? ownerGlobal.placeholderElm?.parentNode : insertBefore.parentNode;
|
|
393
|
+
// we could now be processing same tag but more after components being rendered
|
|
394
|
+
if (hadBefore) {
|
|
395
|
+
// 0 put the template back down
|
|
396
|
+
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_10__.insertAfter)(insertBefore, hadBefore);
|
|
397
|
+
// ??? - removed as need for arrays
|
|
398
|
+
delete ownerGlobal.placeholderElm;
|
|
399
|
+
}
|
|
400
|
+
clones.forEach(clone => (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_3__.afterElmBuild)(clone, options, context, tag));
|
|
401
|
+
let hasPopClone;
|
|
402
|
+
if (_Clones_type__WEBPACK_IMPORTED_MODULE_8__.isRemoveTemplates) {
|
|
403
|
+
const clone = insertBefore.previousSibling; // clones[clones.length - 1]
|
|
404
|
+
if (clone) {
|
|
405
|
+
const isTemplate = clone.tagName === 'TEMPLATE' && clone.hasAttribute('interpolate');
|
|
406
|
+
if (!isTemplate) {
|
|
407
|
+
hasPopClone = ownerGlobal.placeholderElm = clone; // insertBefore
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
if (clones.find(x => x === insertBefore)) {
|
|
412
|
+
throw new Error('adding marker to owner in tag class');
|
|
413
|
+
}
|
|
414
|
+
tag.clones.push(...clones);
|
|
415
|
+
if (_Clones_type__WEBPACK_IMPORTED_MODULE_8__.isRemoveTemplates) {
|
|
416
|
+
if (hasPopClone) { // || hadBefore
|
|
417
|
+
parentNode.removeChild(insertBefore); // belongs to another tag
|
|
418
|
+
}
|
|
419
|
+
}
|
|
405
420
|
return clones;
|
|
406
421
|
}
|
|
407
422
|
function getChildTagsToDestroy(childTags, allTags = []) {
|
|
@@ -421,14 +436,16 @@ function updateContextItem(context, variableName, value) {
|
|
|
421
436
|
const subject = context[variableName];
|
|
422
437
|
const tag = subject.tag;
|
|
423
438
|
if (tag) {
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
const
|
|
431
|
-
|
|
439
|
+
const oldTemp = tag.tagSupport.templater;
|
|
440
|
+
const oldWrap = oldTemp.wrapper; // tag versus component
|
|
441
|
+
if (value.global !== oldTemp.global) {
|
|
442
|
+
if (oldWrap && (0,_isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagComponent)(value)) {
|
|
443
|
+
const oldValueFn = oldWrap.original;
|
|
444
|
+
const newValueFn = value.wrapper?.original;
|
|
445
|
+
const fnMatched = oldValueFn === newValueFn;
|
|
446
|
+
if (fnMatched) {
|
|
447
|
+
value.global = oldTemp.global;
|
|
448
|
+
}
|
|
432
449
|
}
|
|
433
450
|
}
|
|
434
451
|
}
|
|
@@ -554,7 +571,8 @@ class TemplaterResult {
|
|
|
554
571
|
providers: [],
|
|
555
572
|
/** Indicator of re-rending. Saves from double rending something already rendered */
|
|
556
573
|
renderCount: 0,
|
|
557
|
-
deleted: false
|
|
574
|
+
deleted: false,
|
|
575
|
+
subscriptions: []
|
|
558
576
|
};
|
|
559
577
|
tagSupport;
|
|
560
578
|
constructor(props, children) {
|
|
@@ -570,16 +588,10 @@ class TemplaterResult {
|
|
|
570
588
|
}
|
|
571
589
|
function renderWithSupport(tagSupport, existingTag, subject, ownerTag) {
|
|
572
590
|
const wrapTagSupport = tagSupport; // this.tagSupport
|
|
573
|
-
// const wrapTagSupport = existingTag?.tagSupport.templater.global.newest?.tagSupport || tagSupport
|
|
574
|
-
// this.tagSupport = wrapTagSupport
|
|
575
591
|
/* BEFORE RENDER */
|
|
576
|
-
// signify to other operations that a rendering has occurred so they do not need to render again
|
|
577
|
-
// ++wrapTagSupport.memory.renderCount
|
|
578
592
|
const runtimeOwnerTag = existingTag?.ownerTag || ownerTag;
|
|
579
593
|
if (existingTag) {
|
|
580
|
-
// wrapTagSupport.templater.props = existingTag.tagSupport.templater.global.newest?.tagSupport.templater.props || wrapTagSupport.templater.props
|
|
581
594
|
wrapTagSupport.memory.state.newest = [...existingTag.tagSupport.memory.state.newest];
|
|
582
|
-
// ??? - new
|
|
583
595
|
wrapTagSupport.templater.global = existingTag.tagSupport.templater.global;
|
|
584
596
|
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runBeforeRedraw)(wrapTagSupport, existingTag);
|
|
585
597
|
}
|
|
@@ -595,55 +607,32 @@ function renderWithSupport(tagSupport, existingTag, subject, ownerTag) {
|
|
|
595
607
|
}
|
|
596
608
|
/* END: BEFORE RENDER */
|
|
597
609
|
const templater = wrapTagSupport.templater;
|
|
610
|
+
// NEW TAG CREATED HERE
|
|
598
611
|
const retag = templater.wrapper(wrapTagSupport, subject);
|
|
599
612
|
/* AFTER */
|
|
600
613
|
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runAfterRender)(wrapTagSupport, retag);
|
|
601
614
|
const isLikeTag = !existingTag || (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__.isLikeTags)(existingTag, retag);
|
|
602
615
|
if (!isLikeTag) {
|
|
603
|
-
(
|
|
604
|
-
delete templater.global.oldest;
|
|
605
|
-
delete templater.global.newest;
|
|
606
|
-
delete subject.tag;
|
|
607
|
-
templater.global.insertBefore = existingTag.tagSupport.templater.global.insertBefore;
|
|
616
|
+
destroyUnlikeTags(existingTag, templater, subject);
|
|
608
617
|
}
|
|
609
618
|
retag.ownerTag = runtimeOwnerTag;
|
|
610
619
|
wrapTagSupport.templater.global.newest = retag;
|
|
611
|
-
if (wrapTagSupport.templater.global.oldest && !wrapTagSupport.templater.global.oldest.hasLiveElements) {
|
|
612
|
-
throw new Error('56513540');
|
|
613
|
-
}
|
|
614
|
-
if (wrapTagSupport.templater.global.oldest && !wrapTagSupport.templater.global.oldest.hasLiveElements) {
|
|
615
|
-
throw new Error('5555 - 10');
|
|
616
|
-
}
|
|
617
620
|
return retag;
|
|
618
621
|
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
/* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Subject */ "./ts/Subject.ts");
|
|
634
|
-
|
|
635
|
-
class ValueSubject extends _Subject__WEBPACK_IMPORTED_MODULE_0__.Subject {
|
|
636
|
-
value;
|
|
637
|
-
constructor(value) {
|
|
638
|
-
super(value);
|
|
639
|
-
this.value = value;
|
|
640
|
-
}
|
|
641
|
-
subscribe(callback) {
|
|
642
|
-
const unsubscribe = super.subscribe(callback);
|
|
643
|
-
// Call the callback immediately with the current value
|
|
644
|
-
callback(this.value);
|
|
645
|
-
return unsubscribe;
|
|
646
|
-
}
|
|
622
|
+
function destroyUnlikeTags(existingTag, // old
|
|
623
|
+
templater, // new
|
|
624
|
+
subject) {
|
|
625
|
+
const oldGlobal = existingTag.tagSupport.templater.global;
|
|
626
|
+
const insertBefore = oldGlobal.insertBefore;
|
|
627
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_3__.destroyTagMemory)(existingTag, subject);
|
|
628
|
+
// ??? - new so that when a tag is destroy the unlike does not carry the destroy signifier
|
|
629
|
+
templater.global = { ...templater.global }; // break memory references
|
|
630
|
+
const global = templater.global;
|
|
631
|
+
global.insertBefore = insertBefore;
|
|
632
|
+
global.deleted = false;
|
|
633
|
+
delete global.oldest;
|
|
634
|
+
delete global.newest;
|
|
635
|
+
delete subject.tag;
|
|
647
636
|
}
|
|
648
637
|
|
|
649
638
|
|
|
@@ -657,7 +646,8 @@ class ValueSubject extends _Subject__WEBPACK_IMPORTED_MODULE_0__.Subject {
|
|
|
657
646
|
|
|
658
647
|
__webpack_require__.r(__webpack_exports__);
|
|
659
648
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
660
|
-
/* harmony export */ alterProps: () => (/* binding */ alterProps)
|
|
649
|
+
/* harmony export */ alterProps: () => (/* binding */ alterProps),
|
|
650
|
+
/* harmony export */ callbackPropOwner: () => (/* binding */ callbackPropOwner)
|
|
661
651
|
/* harmony export */ });
|
|
662
652
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
663
653
|
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
@@ -666,18 +656,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
666
656
|
/* Used to rewrite props that are functions. When they are called it should cause parent rendering */
|
|
667
657
|
function alterProps(props, templater, ownerSupport) {
|
|
668
658
|
function callback(toCall, callWith) {
|
|
669
|
-
|
|
670
|
-
const callbackResult = toCall(...callWith);
|
|
671
|
-
if (templater.global.renderCount > renderCount) {
|
|
672
|
-
throw new Error('already rendered');
|
|
673
|
-
}
|
|
674
|
-
const lastestOwner = ownerSupport.templater.global.newest;
|
|
675
|
-
const newOwner = (0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(lastestOwner.tagSupport, // ??? newestOwner.tagSupport, // ??? ownerSupport,
|
|
676
|
-
true);
|
|
677
|
-
if (newOwner.tagSupport.templater.global.newest != newOwner) {
|
|
678
|
-
throw new Error('newest assignment issue?');
|
|
679
|
-
}
|
|
680
|
-
return callbackResult;
|
|
659
|
+
return callbackPropOwner(toCall, callWith, templater, ownerSupport);
|
|
681
660
|
}
|
|
682
661
|
const isPropTag = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagInstance)(props);
|
|
683
662
|
const watchProps = isPropTag ? 0 : props;
|
|
@@ -698,14 +677,30 @@ function resetFunctionProps(props, callback) {
|
|
|
698
677
|
return; // already previously converted
|
|
699
678
|
}
|
|
700
679
|
newProps[name] = (...args) => {
|
|
701
|
-
return
|
|
680
|
+
return newProps[name].toCall(...args); // what gets called can switch over parent state changes
|
|
702
681
|
};
|
|
682
|
+
// Currently, call self but over parent state changes, I may need to call a newer parent tag owner
|
|
683
|
+
newProps[name].toCall = (...args) => callback(value, args);
|
|
703
684
|
newProps[name].original = value;
|
|
704
685
|
return;
|
|
705
686
|
}
|
|
706
687
|
});
|
|
707
688
|
return newProps;
|
|
708
689
|
}
|
|
690
|
+
function callbackPropOwner(toCall, callWith, templater, // only used to prevent rendering double
|
|
691
|
+
ownerSupport) {
|
|
692
|
+
const renderCount = templater.global.renderCount;
|
|
693
|
+
const callbackResult = toCall(...callWith);
|
|
694
|
+
if (templater.global.renderCount > renderCount) {
|
|
695
|
+
throw new Error('already rendered');
|
|
696
|
+
}
|
|
697
|
+
const lastestOwner = ownerSupport.templater.global.newest;
|
|
698
|
+
const newOwner = (0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(lastestOwner.tagSupport, true);
|
|
699
|
+
if (newOwner.tagSupport.templater.global.newest != newOwner) {
|
|
700
|
+
throw new Error('newest assignment issue?');
|
|
701
|
+
}
|
|
702
|
+
return callbackResult;
|
|
703
|
+
}
|
|
709
704
|
|
|
710
705
|
|
|
711
706
|
/***/ }),
|
|
@@ -778,23 +773,31 @@ function runTagCallback(value, tag, bindTo, args) {
|
|
|
778
773
|
__webpack_require__.r(__webpack_exports__);
|
|
779
774
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
780
775
|
/* harmony export */ checkDestroyPrevious: () => (/* binding */ checkDestroyPrevious),
|
|
781
|
-
/* harmony export */ destroyArrayTag: () => (/* binding */ destroyArrayTag)
|
|
776
|
+
/* harmony export */ destroyArrayTag: () => (/* binding */ destroyArrayTag),
|
|
777
|
+
/* harmony export */ restoreTagMarker: () => (/* binding */ restoreTagMarker)
|
|
782
778
|
/* harmony export */ });
|
|
783
779
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
784
780
|
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
785
781
|
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
782
|
+
/* harmony import */ var _Clones_type__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Clones.type */ "./ts/Clones.type.ts");
|
|
783
|
+
/* harmony import */ var _insertAfter_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./insertAfter.function */ "./ts/insertAfter.function.ts");
|
|
784
|
+
|
|
785
|
+
|
|
786
786
|
|
|
787
787
|
|
|
788
788
|
|
|
789
789
|
function checkDestroyPrevious(subject, // existing.value is the old value
|
|
790
|
-
newValue) {
|
|
791
|
-
const
|
|
792
|
-
const wasArray =
|
|
790
|
+
newValue, insertBefore) {
|
|
791
|
+
const arraySubject = subject;
|
|
792
|
+
const wasArray = arraySubject.lastArray;
|
|
793
793
|
// no longer an array
|
|
794
794
|
if (wasArray && !(0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagArray)(newValue)) {
|
|
795
|
+
const placeholderElm = arraySubject.placeholderElm;
|
|
796
|
+
delete arraySubject.lastArray;
|
|
797
|
+
delete arraySubject.placeholderElm;
|
|
798
|
+
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_4__.insertAfter)(insertBefore, placeholderElm);
|
|
795
799
|
wasArray.forEach(({ tag }) => destroyArrayTag(tag, { added: 0, removed: 0 }));
|
|
796
|
-
|
|
797
|
-
return 1;
|
|
800
|
+
return 'array';
|
|
798
801
|
}
|
|
799
802
|
const tagSubject = subject;
|
|
800
803
|
const existingTag = tagSubject.tag;
|
|
@@ -804,7 +807,12 @@ newValue) {
|
|
|
804
807
|
const isSubjectTag = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagInstance)(subject.value);
|
|
805
808
|
if (isSubjectTag && isValueTag) {
|
|
806
809
|
const newTag = newValue;
|
|
810
|
+
// its a different tag now
|
|
807
811
|
if (!(0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_1__.isLikeTags)(newTag, existingTag)) {
|
|
812
|
+
// put template back down
|
|
813
|
+
if (_Clones_type__WEBPACK_IMPORTED_MODULE_3__.isRemoveTemplates) {
|
|
814
|
+
restoreTagMarker(existingTag, insertBefore);
|
|
815
|
+
}
|
|
808
816
|
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(existingTag, tagSubject);
|
|
809
817
|
return 2;
|
|
810
818
|
}
|
|
@@ -814,16 +822,20 @@ newValue) {
|
|
|
814
822
|
if (isValueTagComponent) {
|
|
815
823
|
return false; // its still a tag component
|
|
816
824
|
}
|
|
825
|
+
// put template back down
|
|
826
|
+
if (_Clones_type__WEBPACK_IMPORTED_MODULE_3__.isRemoveTemplates) {
|
|
827
|
+
restoreTagMarker(existingTag, insertBefore);
|
|
828
|
+
}
|
|
817
829
|
// destroy old component, value is not a component
|
|
818
830
|
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(existingTag, tagSubject);
|
|
819
|
-
return
|
|
831
|
+
return 'different-tag';
|
|
820
832
|
}
|
|
821
833
|
const displaySubject = subject;
|
|
822
834
|
const hasLastValue = 'lastValue' in displaySubject;
|
|
823
835
|
const lastValue = displaySubject.lastValue; // TODO: we maybe able to use displaySubject.value and remove concept of lastValue
|
|
824
836
|
// was simple value but now something bigger
|
|
825
837
|
if (hasLastValue && lastValue !== newValue) {
|
|
826
|
-
destroySimpleValue(
|
|
838
|
+
destroySimpleValue(insertBefore, displaySubject);
|
|
827
839
|
return 4;
|
|
828
840
|
}
|
|
829
841
|
return false;
|
|
@@ -834,15 +846,23 @@ function destroyArrayTag(tag, counts) {
|
|
|
834
846
|
stagger: counts.removed++,
|
|
835
847
|
});
|
|
836
848
|
}
|
|
837
|
-
function destroySimpleValue(
|
|
849
|
+
function destroySimpleValue(insertBefore, // always a template tag
|
|
850
|
+
subject) {
|
|
838
851
|
const clone = subject.clone;
|
|
839
852
|
const parent = clone.parentNode;
|
|
840
|
-
// put the template back down
|
|
841
|
-
parent.insertBefore(
|
|
853
|
+
// 1 put the template back down
|
|
854
|
+
parent.insertBefore(insertBefore, clone);
|
|
842
855
|
parent.removeChild(clone);
|
|
843
856
|
delete subject.clone;
|
|
844
857
|
delete subject.lastValue;
|
|
845
|
-
|
|
858
|
+
}
|
|
859
|
+
function restoreTagMarker(existingTag, insertBefore) {
|
|
860
|
+
const global = existingTag.tagSupport.templater.global;
|
|
861
|
+
const placeholderElm = global.placeholderElm;
|
|
862
|
+
if (placeholderElm) {
|
|
863
|
+
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_4__.insertAfter)(insertBefore, placeholderElm);
|
|
864
|
+
// delete global.placeholderElm
|
|
865
|
+
}
|
|
846
866
|
}
|
|
847
867
|
|
|
848
868
|
|
|
@@ -970,17 +990,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
970
990
|
/* harmony export */ });
|
|
971
991
|
function destroyTagMemory(tag, subject) {
|
|
972
992
|
const oldTagSupport = tag.tagSupport;
|
|
973
|
-
if (subject !=
|
|
993
|
+
if (subject != oldTagSupport.subject) {
|
|
974
994
|
throw new Error('fff - subjects do not match');
|
|
975
995
|
}
|
|
976
996
|
delete subject.tag;
|
|
977
|
-
delete
|
|
997
|
+
delete oldTagSupport.subject.tag; // TODO: this line maybe not needed
|
|
978
998
|
// must destroy oldest which is tag with elements on stage
|
|
979
|
-
const oldest =
|
|
999
|
+
const oldest = oldTagSupport.templater.global.oldest;
|
|
980
1000
|
oldest.destroy();
|
|
981
1001
|
destroyTagSupportPast(oldTagSupport);
|
|
982
|
-
|
|
983
|
-
tag.tagSupport.templater.global.context = {};
|
|
1002
|
+
oldTagSupport.templater.global.context = {};
|
|
984
1003
|
}
|
|
985
1004
|
function destroyTagSupportPast(oldTagSupport) {
|
|
986
1005
|
delete oldTagSupport.templater.global.oldest;
|
|
@@ -1104,7 +1123,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1104
1123
|
|
|
1105
1124
|
|
|
1106
1125
|
let innerCallback = (callback) => () => {
|
|
1107
|
-
throw new Error('
|
|
1126
|
+
throw new Error('Callback function was called immediately in sync and must instead be call async');
|
|
1108
1127
|
};
|
|
1109
1128
|
const getCallback = () => innerCallback;
|
|
1110
1129
|
const originalGetter = innerCallback; // getCallback
|
|
@@ -1142,7 +1161,6 @@ function triggerStateUpdate(tagSupport, callback, oldState, ...args) {
|
|
|
1142
1161
|
// send the oldest state changes into the newest
|
|
1143
1162
|
updateState(oldState, newest);
|
|
1144
1163
|
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
1145
|
-
// TODO: turn back on below
|
|
1146
1164
|
if (promise instanceof Promise) {
|
|
1147
1165
|
promise.finally(() => {
|
|
1148
1166
|
// send the oldest state changes into the newest
|
|
@@ -1211,9 +1229,6 @@ pastCloneProps) {
|
|
|
1211
1229
|
castedProps = { ...props };
|
|
1212
1230
|
castedPastProps = { ...(pastCloneProps || {}) };
|
|
1213
1231
|
const allFunctionsMatch = Object.entries(castedProps).every(([key, value]) => {
|
|
1214
|
-
/*if(!(key in (castedPastProps as any))) {
|
|
1215
|
-
return false
|
|
1216
|
-
}*/
|
|
1217
1232
|
let compare = castedPastProps[key];
|
|
1218
1233
|
if (!(value instanceof Function)) {
|
|
1219
1234
|
return 4; // this will be checked in deepEqual
|
|
@@ -1240,7 +1255,6 @@ pastCloneProps) {
|
|
|
1240
1255
|
return 6; // a change has been detected by function comparisons
|
|
1241
1256
|
}
|
|
1242
1257
|
}
|
|
1243
|
-
// ???
|
|
1244
1258
|
const isEqual = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(castedPastProps, castedProps);
|
|
1245
1259
|
return isEqual ? false : 7; // if equal then no changes
|
|
1246
1260
|
}
|
|
@@ -1306,6 +1320,25 @@ function inputAttribute(name, value, element) {
|
|
|
1306
1320
|
}
|
|
1307
1321
|
|
|
1308
1322
|
|
|
1323
|
+
/***/ }),
|
|
1324
|
+
|
|
1325
|
+
/***/ "./ts/insertAfter.function.ts":
|
|
1326
|
+
/*!************************************!*\
|
|
1327
|
+
!*** ./ts/insertAfter.function.ts ***!
|
|
1328
|
+
\************************************/
|
|
1329
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1330
|
+
|
|
1331
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1332
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1333
|
+
/* harmony export */ insertAfter: () => (/* binding */ insertAfter)
|
|
1334
|
+
/* harmony export */ });
|
|
1335
|
+
// Function to insert element after reference element
|
|
1336
|
+
function insertAfter(newNode, referenceNode) {
|
|
1337
|
+
const parentNode = referenceNode.parentNode;
|
|
1338
|
+
parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
|
|
1309
1342
|
/***/ }),
|
|
1310
1343
|
|
|
1311
1344
|
/***/ "./ts/interpolateAttributes.ts":
|
|
@@ -1418,8 +1451,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1418
1451
|
|
|
1419
1452
|
|
|
1420
1453
|
/** Review elements within an element */
|
|
1421
|
-
function interpolateElement(container,
|
|
1422
|
-
|
|
1454
|
+
function interpolateElement(container, // element containing innerHTML to review interpolations
|
|
1455
|
+
context, // variables used to evaluate
|
|
1456
|
+
interpolatedTemplates, tagOwner, options) {
|
|
1423
1457
|
const clones = [];
|
|
1424
1458
|
const tagComponents = [];
|
|
1425
1459
|
const result = interpolatedTemplates.interpolation;
|
|
@@ -1461,8 +1495,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1461
1495
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1462
1496
|
/* harmony export */ afterElmBuild: () => (/* binding */ afterElmBuild),
|
|
1463
1497
|
/* harmony export */ interpolateTemplate: () => (/* binding */ interpolateTemplate),
|
|
1464
|
-
/* harmony export */ subscribeToTemplate: () => (/* binding */ subscribeToTemplate)
|
|
1465
|
-
/* harmony export */ updateBetweenTemplates: () => (/* binding */ updateBetweenTemplates)
|
|
1498
|
+
/* harmony export */ subscribeToTemplate: () => (/* binding */ subscribeToTemplate)
|
|
1466
1499
|
/* harmony export */ });
|
|
1467
1500
|
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Tag.class */ "./ts/Tag.class.ts");
|
|
1468
1501
|
/* harmony import */ var _elementInitCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./elementInitCheck */ "./ts/elementInitCheck.ts");
|
|
@@ -1513,10 +1546,12 @@ function subscribeToTemplate(insertBefore, subject, ownerTag, counts, // used fo
|
|
|
1513
1546
|
let called = false;
|
|
1514
1547
|
const callback = (value) => {
|
|
1515
1548
|
// const orgInsert = insertBefore
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1549
|
+
/*
|
|
1550
|
+
const clone = (subject as DisplaySubject).clone
|
|
1551
|
+
if(clone && clone.parentNode) {
|
|
1552
|
+
insertBefore = clone
|
|
1519
1553
|
}
|
|
1554
|
+
*/
|
|
1520
1555
|
if (called) {
|
|
1521
1556
|
(0,_updateExistingValue_function__WEBPACK_IMPORTED_MODULE_5__.updateExistingValue)(subject, value, ownerTag, insertBefore);
|
|
1522
1557
|
return;
|
|
@@ -1534,21 +1569,7 @@ function subscribeToTemplate(insertBefore, subject, ownerTag, counts, // used fo
|
|
|
1534
1569
|
called = true;
|
|
1535
1570
|
};
|
|
1536
1571
|
const sub = subject.subscribe(callback);
|
|
1537
|
-
ownerTag.
|
|
1538
|
-
}
|
|
1539
|
-
// Function to update the value of x
|
|
1540
|
-
function updateBetweenTemplates(value, lastFirstChild) {
|
|
1541
|
-
const parent = lastFirstChild.parentNode;
|
|
1542
|
-
// mimic React skipping to display EXCEPT for true does display on page
|
|
1543
|
-
if (value === undefined || value === false || value === null) { // || value === true
|
|
1544
|
-
value = '';
|
|
1545
|
-
}
|
|
1546
|
-
// Insert the new value (never use innerHTML here)
|
|
1547
|
-
const textNode = document.createTextNode(value); // never innerHTML
|
|
1548
|
-
parent.insertBefore(textNode, lastFirstChild);
|
|
1549
|
-
/* remove existing nodes */
|
|
1550
|
-
parent.removeChild(lastFirstChild);
|
|
1551
|
-
return textNode;
|
|
1572
|
+
ownerTag.tagSupport.templater.global.subscriptions.push(sub);
|
|
1552
1573
|
}
|
|
1553
1574
|
function afterElmBuild(elm, options, context, ownerTag) {
|
|
1554
1575
|
if (!elm.getAttribute) {
|
|
@@ -1561,12 +1582,6 @@ function afterElmBuild(elm, options, context, ownerTag) {
|
|
|
1561
1582
|
let diff = options.counts.added;
|
|
1562
1583
|
diff = (0,_elementInitCheck__WEBPACK_IMPORTED_MODULE_1__.elementInitCheck)(elm, options.counts) - diff;
|
|
1563
1584
|
if (elm.children) {
|
|
1564
|
-
/*
|
|
1565
|
-
const subCounts = {
|
|
1566
|
-
added: options.counts.added, // - diff,
|
|
1567
|
-
removed: options.counts.removed,
|
|
1568
|
-
}
|
|
1569
|
-
*/
|
|
1570
1585
|
new Array(...elm.children).forEach((child, index) => {
|
|
1571
1586
|
const subOptions = {
|
|
1572
1587
|
...options,
|
|
@@ -1603,8 +1618,9 @@ function interpolateToTemplates(template) {
|
|
|
1603
1618
|
}
|
|
1604
1619
|
const noBraces = expression.substring(1, expression.length - 1);
|
|
1605
1620
|
const id = noBraces;
|
|
1621
|
+
const name = 'template-' + template.length;
|
|
1606
1622
|
keys.push(id);
|
|
1607
|
-
return `<template interpolate end id="${id}"></template>`;
|
|
1623
|
+
return `<template interpolate end id="${id}" name="${name}"></template>`;
|
|
1608
1624
|
});
|
|
1609
1625
|
return { string, keys };
|
|
1610
1626
|
}
|
|
@@ -1728,11 +1744,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1728
1744
|
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
1729
1745
|
|
|
1730
1746
|
function setCurrentTagSupport(support) {
|
|
1731
|
-
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.
|
|
1747
|
+
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentTemplater = support.templater;
|
|
1732
1748
|
}
|
|
1733
1749
|
function onInit(callback) {
|
|
1734
|
-
|
|
1735
|
-
|
|
1750
|
+
const templater = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentTemplater;
|
|
1751
|
+
if (!templater.global.init) {
|
|
1752
|
+
;
|
|
1753
|
+
templater.global.init = callback;
|
|
1736
1754
|
callback(); // fire init
|
|
1737
1755
|
}
|
|
1738
1756
|
}
|
|
@@ -1777,7 +1795,7 @@ function processAttribute(attrName, value, child, scope, ownerTag, howToSet) {
|
|
|
1777
1795
|
processNameOnlyAttr(value, lastValue, child, ownerTag, howToSet);
|
|
1778
1796
|
lastValue = value;
|
|
1779
1797
|
});
|
|
1780
|
-
ownerTag.
|
|
1798
|
+
ownerTag.tagSupport.templater.global.subscriptions.push(sub); // this is where unsubscribe is picked up
|
|
1781
1799
|
child.removeAttribute(attrName);
|
|
1782
1800
|
return;
|
|
1783
1801
|
}
|
|
@@ -1841,7 +1859,7 @@ function processNameValueAttr(attrName, result, child, ownerTag, howToSet) {
|
|
|
1841
1859
|
// 🗞️ Subscribe. Above callback called immediately since its a ValueSubject()
|
|
1842
1860
|
const sub = result.subscribe(callback);
|
|
1843
1861
|
// Record subscription for later unsubscribe when element destroyed
|
|
1844
|
-
ownerTag.
|
|
1862
|
+
ownerTag.tagSupport.templater.global.subscriptions.push(sub);
|
|
1845
1863
|
return;
|
|
1846
1864
|
}
|
|
1847
1865
|
howToSet(child, attrName, result);
|
|
@@ -1866,7 +1884,7 @@ function processAttributeSubjectValue(newAttrValue, child, attrName, isSpecial,
|
|
|
1866
1884
|
howToSet(child, attrName, newAttrValue);
|
|
1867
1885
|
return;
|
|
1868
1886
|
}
|
|
1869
|
-
const isDeadValue =
|
|
1887
|
+
const isDeadValue = [undefined, false, null].includes(newAttrValue);
|
|
1870
1888
|
if (isDeadValue) {
|
|
1871
1889
|
child.removeAttribute(attrName);
|
|
1872
1890
|
return;
|
|
@@ -1892,18 +1910,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1892
1910
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1893
1911
|
/* harmony export */ processNewValue: () => (/* binding */ processNewValue)
|
|
1894
1912
|
/* harmony export */ });
|
|
1895
|
-
/* harmony import */ var
|
|
1913
|
+
/* harmony import */ var _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subject/ValueSubject */ "./ts/subject/ValueSubject.ts");
|
|
1896
1914
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
1897
1915
|
|
|
1898
1916
|
|
|
1899
1917
|
function processNewValue(hasValue, value, ownerTag) {
|
|
1900
1918
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value)) {
|
|
1901
|
-
const tagSubject = new
|
|
1919
|
+
const tagSubject = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1902
1920
|
return tagSubject;
|
|
1903
1921
|
}
|
|
1904
1922
|
if (value instanceof Function) {
|
|
1905
1923
|
// return getSubjectFunction(value, ownerTag)
|
|
1906
|
-
return new
|
|
1924
|
+
return new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1907
1925
|
}
|
|
1908
1926
|
if (!hasValue) {
|
|
1909
1927
|
return; // more strings than values, stop here
|
|
@@ -1913,12 +1931,12 @@ function processNewValue(hasValue, value, ownerTag) {
|
|
|
1913
1931
|
if (ownerTag.childTags.find(x => x === value)) {
|
|
1914
1932
|
throw new Error('about to reattach tag already present - 2');
|
|
1915
1933
|
}
|
|
1916
|
-
return new
|
|
1934
|
+
return new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1917
1935
|
}
|
|
1918
1936
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isSubjectInstance)(value)) {
|
|
1919
1937
|
return value; // its already a value subject
|
|
1920
1938
|
}
|
|
1921
|
-
return new
|
|
1939
|
+
return new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1922
1940
|
}
|
|
1923
1941
|
|
|
1924
1942
|
|
|
@@ -1934,18 +1952,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1934
1952
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1935
1953
|
/* harmony export */ processRegularValue: () => (/* binding */ processRegularValue)
|
|
1936
1954
|
/* harmony export */ });
|
|
1937
|
-
/* harmony import */ var
|
|
1955
|
+
/* harmony import */ var _updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./updateBeforeTemplate.function */ "./ts/updateBeforeTemplate.function.ts");
|
|
1938
1956
|
|
|
1939
1957
|
function processRegularValue(value, subject, // could be tag via subject.tag
|
|
1940
|
-
|
|
1941
|
-
subject.
|
|
1942
|
-
const before = subject.clone ||
|
|
1943
|
-
|
|
1958
|
+
insertBefore) {
|
|
1959
|
+
subject.insertBefore = insertBefore;
|
|
1960
|
+
const before = subject.clone || insertBefore; // Either the template is on the doc OR its the first element we last put on doc
|
|
1961
|
+
// matches but also was defined at some point
|
|
1962
|
+
if (subject.lastValue === value && 'lastValue' in subject) {
|
|
1944
1963
|
return; // no need to update display, its the same
|
|
1945
1964
|
}
|
|
1946
1965
|
subject.lastValue = value;
|
|
1947
1966
|
// Processing of regular values
|
|
1948
|
-
const clone = (0,
|
|
1967
|
+
const clone = (0,_updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__.updateBeforeTemplate)(value, before);
|
|
1949
1968
|
subject.clone = clone; // remember single element put down, for future updates
|
|
1950
1969
|
}
|
|
1951
1970
|
|
|
@@ -1970,46 +1989,54 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1970
1989
|
|
|
1971
1990
|
|
|
1972
1991
|
|
|
1973
|
-
function processSubjectComponent(templater, subject,
|
|
1992
|
+
function processSubjectComponent(templater, subject, insertBefore, ownerTag, options) {
|
|
1974
1993
|
// Check if function component is wrapped in a tag() call
|
|
1975
1994
|
// TODO: This below check not needed in production mode
|
|
1976
1995
|
if (templater.tagged !== true) {
|
|
1977
|
-
|
|
1996
|
+
const original = templater.wrapper.original;
|
|
1997
|
+
let name = original.name || original.constructor?.name;
|
|
1978
1998
|
if (name === 'Function') {
|
|
1979
1999
|
name = undefined;
|
|
1980
2000
|
}
|
|
1981
|
-
const label = name ||
|
|
2001
|
+
const label = name || original.toString().substring(0, 120);
|
|
1982
2002
|
const error = new Error(`Not a tag component. Wrap your function with tag(). Example tag(props => html\`\`) on component:\n\n${label}\n\n`);
|
|
1983
2003
|
throw error;
|
|
1984
2004
|
}
|
|
1985
|
-
|
|
1986
|
-
templater.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__.TagSupport(ownerTag.tagSupport, templater, subject);
|
|
1987
|
-
}
|
|
2005
|
+
templater.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__.TagSupport(ownerTag.tagSupport, templater, subject);
|
|
1988
2006
|
// templater.oldest = subject.tag?.tagSupport.oldest || templater.oldest
|
|
1989
|
-
templater.global.insertBefore =
|
|
2007
|
+
templater.global.insertBefore = insertBefore;
|
|
1990
2008
|
let retag = subject.tag;
|
|
1991
2009
|
const providers = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
1992
2010
|
providers.ownerTag = ownerTag;
|
|
1993
2011
|
const isRedraw = !retag || options.forceElement;
|
|
1994
2012
|
if (isRedraw) {
|
|
1995
|
-
|
|
1996
|
-
retag = (0,_TemplaterResult_class__WEBPACK_IMPORTED_MODULE_0__.renderWithSupport)(templater.tagSupport, subject.tag, subject, ownerTag);
|
|
1997
|
-
if (retag.tagSupport.templater.global.newest != retag) {
|
|
1998
|
-
throw new Error('mismatch result newest');
|
|
1999
|
-
}
|
|
2000
|
-
templater.global.newest = retag;
|
|
2001
|
-
if (ownerTag.clones.length > preClones.length) {
|
|
2002
|
-
const myClones = ownerTag.clones.filter(fClone => !preClones.find(clone => clone === fClone));
|
|
2003
|
-
retag.clones.push(...myClones);
|
|
2004
|
-
}
|
|
2005
|
-
if (ownerTag.childTags.find(x => x === retag)) {
|
|
2006
|
-
throw new Error('about to reattach tag already present');
|
|
2007
|
-
}
|
|
2008
|
-
ownerTag.childTags.push(retag);
|
|
2013
|
+
retag = redrawSubjectComponent(templater, subject, retag, ownerTag, insertBefore);
|
|
2009
2014
|
}
|
|
2010
2015
|
(0,_processTagResult_function__WEBPACK_IMPORTED_MODULE_2__.processTagResult)(retag, subject, // The element set here will be removed from document. Also result.tag will be added in here
|
|
2011
|
-
|
|
2016
|
+
insertBefore, // <template end interpolate /> (will be removed)
|
|
2012
2017
|
options);
|
|
2018
|
+
return retag;
|
|
2019
|
+
}
|
|
2020
|
+
function redrawSubjectComponent(templater, subject, retag, ownerTag, insertBefore) {
|
|
2021
|
+
const preClones = ownerTag.clones.map(clone => clone);
|
|
2022
|
+
retag = (0,_TemplaterResult_class__WEBPACK_IMPORTED_MODULE_0__.renderWithSupport)(templater.tagSupport, subject.tag, // existing tag
|
|
2023
|
+
subject, ownerTag);
|
|
2024
|
+
if (retag.tagSupport.templater.global.newest != retag) {
|
|
2025
|
+
throw new Error('mismatch result newest');
|
|
2026
|
+
}
|
|
2027
|
+
templater.global.newest = retag;
|
|
2028
|
+
if (ownerTag.clones.length > preClones.length) {
|
|
2029
|
+
const myClones = ownerTag.clones.filter(fClone => !preClones.find(clone => clone === fClone));
|
|
2030
|
+
retag.clones.push(...myClones);
|
|
2031
|
+
if (myClones.find(x => x === insertBefore)) {
|
|
2032
|
+
throw new Error('way back here we add marker');
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
if (ownerTag.childTags.find(x => x === retag)) {
|
|
2036
|
+
throw new Error('about to reattach tag already present');
|
|
2037
|
+
}
|
|
2038
|
+
ownerTag.childTags.push(retag);
|
|
2039
|
+
return retag;
|
|
2013
2040
|
}
|
|
2014
2041
|
|
|
2015
2042
|
|
|
@@ -2023,17 +2050,13 @@ function processSubjectComponent(templater, subject, template, ownerTag, options
|
|
|
2023
2050
|
|
|
2024
2051
|
__webpack_require__.r(__webpack_exports__);
|
|
2025
2052
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2026
|
-
/* harmony export */
|
|
2027
|
-
/* harmony export */ processSubjectValue: () => (/* binding */ processSubjectValue),
|
|
2028
|
-
/* harmony export */ processTag: () => (/* binding */ processTag)
|
|
2053
|
+
/* harmony export */ processSubjectValue: () => (/* binding */ processSubjectValue)
|
|
2029
2054
|
/* harmony export */ });
|
|
2030
2055
|
/* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/processSubjectComponent.function.ts");
|
|
2031
2056
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
2032
2057
|
/* harmony import */ var _processTagArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./processTagArray */ "./ts/processTagArray.ts");
|
|
2033
|
-
/* harmony import */ var
|
|
2034
|
-
/* harmony import */ var
|
|
2035
|
-
/* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/processRegularValue.function.ts");
|
|
2036
|
-
|
|
2058
|
+
/* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/processRegularValue.function.ts");
|
|
2059
|
+
/* harmony import */ var _processTag_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./processTag.function */ "./ts/processTag.function.ts");
|
|
2037
2060
|
|
|
2038
2061
|
|
|
2039
2062
|
|
|
@@ -2059,29 +2082,49 @@ function getValueType(value) {
|
|
|
2059
2082
|
return ValueTypes.value;
|
|
2060
2083
|
}
|
|
2061
2084
|
function processSubjectValue(value, subject, // could be tag via result.tag
|
|
2062
|
-
|
|
2085
|
+
insertBefore, // <template end interpolate /> (will be removed)
|
|
2063
2086
|
ownerTag, // owner
|
|
2064
2087
|
options) {
|
|
2065
2088
|
const valueType = getValueType(value);
|
|
2066
2089
|
switch (valueType) {
|
|
2067
2090
|
case ValueTypes.tag:
|
|
2068
|
-
processTag(value, subject,
|
|
2091
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_4__.processTag)(value, subject, insertBefore, ownerTag);
|
|
2069
2092
|
return;
|
|
2070
2093
|
case ValueTypes.tagArray:
|
|
2071
|
-
return (0,_processTagArray__WEBPACK_IMPORTED_MODULE_2__.processTagArray)(subject, value,
|
|
2094
|
+
return (0,_processTagArray__WEBPACK_IMPORTED_MODULE_2__.processTagArray)(subject, value, insertBefore, ownerTag, options);
|
|
2072
2095
|
case ValueTypes.tagComponent:
|
|
2073
|
-
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__.processSubjectComponent)(value, subject,
|
|
2096
|
+
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__.processSubjectComponent)(value, subject, insertBefore, ownerTag, options);
|
|
2074
2097
|
return;
|
|
2075
2098
|
}
|
|
2076
|
-
(0,
|
|
2099
|
+
(0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_3__.processRegularValue)(value, subject, insertBefore);
|
|
2077
2100
|
}
|
|
2101
|
+
|
|
2102
|
+
|
|
2103
|
+
/***/ }),
|
|
2104
|
+
|
|
2105
|
+
/***/ "./ts/processTag.function.ts":
|
|
2106
|
+
/*!***********************************!*\
|
|
2107
|
+
!*** ./ts/processTag.function.ts ***!
|
|
2108
|
+
\***********************************/
|
|
2109
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2110
|
+
|
|
2111
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2112
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2113
|
+
/* harmony export */ applyFakeTemplater: () => (/* binding */ applyFakeTemplater),
|
|
2114
|
+
/* harmony export */ processTag: () => (/* binding */ processTag)
|
|
2115
|
+
/* harmony export */ });
|
|
2116
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
2117
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
2118
|
+
/* harmony import */ var _subject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./subject */ "./ts/subject/index.ts");
|
|
2119
|
+
|
|
2120
|
+
|
|
2121
|
+
|
|
2078
2122
|
/** Could be a regular tag or a component. Both are Tag.class */
|
|
2079
2123
|
function processTag(tag, subject, // could be tag via result.tag
|
|
2080
|
-
insertBefore,
|
|
2081
|
-
ownerTag) {
|
|
2124
|
+
insertBefore, ownerTag) {
|
|
2082
2125
|
// first time seeing this tag?
|
|
2083
2126
|
if (!tag.tagSupport) {
|
|
2084
|
-
if (!(0,
|
|
2127
|
+
if (!(0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagInstance)(tag)) {
|
|
2085
2128
|
throw new Error('issue non-tag here');
|
|
2086
2129
|
}
|
|
2087
2130
|
applyFakeTemplater(tag, ownerTag, subject);
|
|
@@ -2091,10 +2134,12 @@ ownerTag) {
|
|
|
2091
2134
|
ownerTag.childTags.push(tag);
|
|
2092
2135
|
}
|
|
2093
2136
|
tag.ownerTag = ownerTag;
|
|
2094
|
-
|
|
2137
|
+
if (insertBefore.tagName !== 'TEMPLATE') {
|
|
2138
|
+
throw new Error(`;;;; - ${insertBefore.nodeName}`);
|
|
2139
|
+
}
|
|
2095
2140
|
tag.buildBeforeElement(insertBefore, {
|
|
2096
2141
|
counts: { added: 0, removed: 0 },
|
|
2097
|
-
forceElement: true,
|
|
2142
|
+
forceElement: true,
|
|
2098
2143
|
});
|
|
2099
2144
|
}
|
|
2100
2145
|
function applyFakeTemplater(tag, ownerTag, subject) {
|
|
@@ -2102,7 +2147,7 @@ function applyFakeTemplater(tag, ownerTag, subject) {
|
|
|
2102
2147
|
throw new Error('no owner error');
|
|
2103
2148
|
}
|
|
2104
2149
|
const fakeTemplater = getFakeTemplater();
|
|
2105
|
-
tag.tagSupport = new
|
|
2150
|
+
tag.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_1__.TagSupport(ownerTag.tagSupport, fakeTemplater, // the template is provided via html`` call
|
|
2106
2151
|
subject);
|
|
2107
2152
|
fakeTemplater.global.oldest = tag;
|
|
2108
2153
|
fakeTemplater.global.newest = tag;
|
|
@@ -2116,10 +2161,17 @@ function getFakeTemplater() {
|
|
|
2116
2161
|
renderCount: 0,
|
|
2117
2162
|
providers: [],
|
|
2118
2163
|
context: {},
|
|
2164
|
+
subscriptions: [],
|
|
2165
|
+
deleted: false,
|
|
2166
|
+
newestTemplater: {},
|
|
2119
2167
|
},
|
|
2120
|
-
children: new
|
|
2168
|
+
children: new _subject__WEBPACK_IMPORTED_MODULE_2__.ValueSubject([]), // no children
|
|
2121
2169
|
props: {},
|
|
2122
2170
|
isTag: true,
|
|
2171
|
+
isTemplater: false,
|
|
2172
|
+
tagged: false,
|
|
2173
|
+
wrapper: (() => undefined),
|
|
2174
|
+
tagSupport: {},
|
|
2123
2175
|
};
|
|
2124
2176
|
}
|
|
2125
2177
|
|
|
@@ -2136,20 +2188,32 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2136
2188
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2137
2189
|
/* harmony export */ processTagArray: () => (/* binding */ processTagArray)
|
|
2138
2190
|
/* harmony export */ });
|
|
2139
|
-
/* harmony import */ var
|
|
2191
|
+
/* harmony import */ var _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subject/ValueSubject */ "./ts/subject/ValueSubject.ts");
|
|
2140
2192
|
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors */ "./ts/errors.ts");
|
|
2141
2193
|
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./checkDestroyPrevious.function */ "./ts/checkDestroyPrevious.function.ts");
|
|
2142
|
-
/* harmony import */ var
|
|
2194
|
+
/* harmony import */ var _processTag_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processTag.function */ "./ts/processTag.function.ts");
|
|
2195
|
+
/* harmony import */ var _insertAfter_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./insertAfter.function */ "./ts/insertAfter.function.ts");
|
|
2196
|
+
|
|
2143
2197
|
|
|
2144
2198
|
|
|
2145
2199
|
|
|
2146
2200
|
|
|
2147
2201
|
function processTagArray(subject, value, // arry of Tag classes
|
|
2148
|
-
|
|
2202
|
+
insertBefore, // <template end interpolate />
|
|
2149
2203
|
ownerTag, options) {
|
|
2150
2204
|
const clones = ownerTag.clones; // []
|
|
2151
2205
|
let lastArray = subject.lastArray = subject.lastArray || [];
|
|
2152
|
-
subject.
|
|
2206
|
+
if (subject.placeholderElm) {
|
|
2207
|
+
const parentPlaceholder = subject.parentAsPlaceholder;
|
|
2208
|
+
if (parentPlaceholder) {
|
|
2209
|
+
parentPlaceholder.appendChild(insertBefore);
|
|
2210
|
+
delete subject.placeholderElm;
|
|
2211
|
+
}
|
|
2212
|
+
else {
|
|
2213
|
+
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_4__.insertAfter)(insertBefore, subject.placeholderElm);
|
|
2214
|
+
}
|
|
2215
|
+
delete subject.placeholderElm;
|
|
2216
|
+
}
|
|
2153
2217
|
let removed = 0;
|
|
2154
2218
|
/** 🗑️ remove previous items first */
|
|
2155
2219
|
lastArray = subject.lastArray = subject.lastArray.filter((item, index) => {
|
|
@@ -2157,8 +2221,9 @@ ownerTag, options) {
|
|
|
2157
2221
|
const at = index - removed;
|
|
2158
2222
|
const lessLength = newLength < at;
|
|
2159
2223
|
const subTag = value[index - removed];
|
|
2160
|
-
const subArrayValue = subTag?.arrayValue;
|
|
2161
|
-
const
|
|
2224
|
+
const subArrayValue = subTag?.memory.arrayValue;
|
|
2225
|
+
const tag = item.tag;
|
|
2226
|
+
const destroyItem = lessLength || !areLikeValues(subArrayValue, tag.memory.arrayValue);
|
|
2162
2227
|
if (destroyItem) {
|
|
2163
2228
|
const last = lastArray[index];
|
|
2164
2229
|
const tag = last.tag;
|
|
@@ -2171,19 +2236,19 @@ ownerTag, options) {
|
|
|
2171
2236
|
return true;
|
|
2172
2237
|
});
|
|
2173
2238
|
// const masterBefore = template || (template as any).clone
|
|
2174
|
-
const before =
|
|
2239
|
+
const before = insertBefore; // || (subject.value as any).insertBefore || (insertBefore as any).clone
|
|
2175
2240
|
value.forEach((subTag, index) => {
|
|
2176
2241
|
const previous = lastArray[index];
|
|
2177
2242
|
const previousSupport = previous?.tag.tagSupport;
|
|
2178
|
-
const fakeSubject = new
|
|
2179
|
-
(0,
|
|
2243
|
+
const fakeSubject = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject({});
|
|
2244
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_3__.applyFakeTemplater)(subTag, ownerTag, fakeSubject);
|
|
2180
2245
|
if (previousSupport) {
|
|
2181
2246
|
subTag.tagSupport.templater.global = previousSupport.templater.global;
|
|
2182
2247
|
previousSupport.templater.global.newest = subTag;
|
|
2183
2248
|
}
|
|
2184
2249
|
// check for html``.key()
|
|
2185
|
-
const
|
|
2186
|
-
if (
|
|
2250
|
+
const keySet = 'arrayValue' in subTag.memory;
|
|
2251
|
+
if (!keySet) {
|
|
2187
2252
|
const details = {
|
|
2188
2253
|
template: subTag.getTemplate().string,
|
|
2189
2254
|
array: value,
|
|
@@ -2196,23 +2261,46 @@ ownerTag, options) {
|
|
|
2196
2261
|
}
|
|
2197
2262
|
const couldBeSame = lastArray.length > index;
|
|
2198
2263
|
if (couldBeSame) {
|
|
2199
|
-
const
|
|
2264
|
+
const prevSupport = previous.tag.tagSupport;
|
|
2265
|
+
const prevGlobal = prevSupport.templater.global;
|
|
2266
|
+
const isSame = areLikeValues(previous.tag.memory.arrayValue, subTag.memory.arrayValue);
|
|
2200
2267
|
if (isSame) {
|
|
2201
|
-
subTag.tagSupport = subTag.tagSupport ||
|
|
2202
|
-
const oldest =
|
|
2268
|
+
subTag.tagSupport = subTag.tagSupport || prevSupport;
|
|
2269
|
+
const oldest = prevGlobal.oldest;
|
|
2203
2270
|
oldest.updateByTag(subTag);
|
|
2204
2271
|
return [];
|
|
2205
2272
|
}
|
|
2206
|
-
|
|
2273
|
+
// TODO: should not get here?
|
|
2274
|
+
processAddTagArrayItem(before, subTag, index, options, lastArray);
|
|
2207
2275
|
throw new Error('item should be back');
|
|
2208
2276
|
// return [] // removed: item should have been previously deleted and will be added back
|
|
2209
2277
|
}
|
|
2210
|
-
processAddTagArrayItem(before, subTag, index, options, lastArray
|
|
2278
|
+
processAddTagArrayItem(before, subTag, index, options, lastArray);
|
|
2211
2279
|
ownerTag.childTags.push(subTag);
|
|
2212
2280
|
});
|
|
2281
|
+
if (value.length) {
|
|
2282
|
+
const lastClone = insertBefore.previousSibling;
|
|
2283
|
+
setPlaceholderElm(lastClone, insertBefore, subject);
|
|
2284
|
+
}
|
|
2285
|
+
else {
|
|
2286
|
+
const placeholderElm = insertBefore.previousSibling;
|
|
2287
|
+
if (placeholderElm) {
|
|
2288
|
+
setPlaceholderElm(placeholderElm, insertBefore, subject);
|
|
2289
|
+
}
|
|
2290
|
+
else {
|
|
2291
|
+
const parentNode = insertBefore.parentNode;
|
|
2292
|
+
setPlaceholderElm(parentNode, insertBefore, subject);
|
|
2293
|
+
subject.parentAsPlaceholder = parentNode;
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2213
2296
|
return clones;
|
|
2214
2297
|
}
|
|
2215
|
-
function
|
|
2298
|
+
function setPlaceholderElm(lastClone, insertBefore, subject) {
|
|
2299
|
+
subject.placeholderElm = lastClone;
|
|
2300
|
+
const parentNode = insertBefore.parentNode;
|
|
2301
|
+
parentNode.removeChild(insertBefore);
|
|
2302
|
+
}
|
|
2303
|
+
function processAddTagArrayItem(before, subTag, index, options, lastArray) {
|
|
2216
2304
|
const lastValue = {
|
|
2217
2305
|
tag: subTag, index
|
|
2218
2306
|
};
|
|
@@ -2222,11 +2310,13 @@ function processAddTagArrayItem(before, subTag, index, options, lastArray, test)
|
|
|
2222
2310
|
added: options.counts.added + index,
|
|
2223
2311
|
removed: options.counts.removed,
|
|
2224
2312
|
};
|
|
2225
|
-
|
|
2226
|
-
if (!lastFirstChild.parentNode) {
|
|
2313
|
+
if (!before.parentNode) {
|
|
2227
2314
|
throw new Error('issue adding array item');
|
|
2228
2315
|
}
|
|
2229
|
-
|
|
2316
|
+
const newTempElm = document.createElement('template');
|
|
2317
|
+
before.parentNode.insertBefore(newTempElm, before);
|
|
2318
|
+
subTag.buildBeforeElement(newTempElm, // before,
|
|
2319
|
+
{ counts, forceElement: options.forceElement });
|
|
2230
2320
|
}
|
|
2231
2321
|
/** compare two values. If both values are arrays then the items will be compared */
|
|
2232
2322
|
function areLikeValues(valueA, valueB) {
|
|
@@ -2254,8 +2344,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2254
2344
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2255
2345
|
/* harmony export */ processTagResult: () => (/* binding */ processTagResult)
|
|
2256
2346
|
/* harmony export */ });
|
|
2257
|
-
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
2258
|
-
|
|
2259
2347
|
function processTagResult(tag, subject, // used for recording past and current value
|
|
2260
2348
|
insertBefore, // <template end interpolate />
|
|
2261
2349
|
{ counts, forceElement, }) {
|
|
@@ -2267,43 +2355,38 @@ insertBefore, // <template end interpolate />
|
|
|
2267
2355
|
const existingTag = subjectTag.tag;
|
|
2268
2356
|
const previousTag = existingTag?.tagSupport.templater.global.oldest || undefined; // || tag.tagSupport.oldest // subjectTag.tag
|
|
2269
2357
|
const justUpdate = previousTag; // && !forceElement
|
|
2270
|
-
if (previousTag) {
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
const newTag = subject(previousTag.tagSupport);
|
|
2278
|
-
previousTag.updateByTag(newTag);
|
|
2279
|
-
if (!newTag.tagSupport.templater.global.oldest) {
|
|
2280
|
-
throw new Error('maybe 0');
|
|
2281
|
-
}
|
|
2282
|
-
subjectTag.tag = newTag;
|
|
2283
|
-
if (!newTag.hasLiveElements) {
|
|
2284
|
-
throw new Error('44444 - 2');
|
|
2285
|
-
}
|
|
2286
|
-
return;
|
|
2287
|
-
}
|
|
2288
|
-
previousTag.updateByTag(tag);
|
|
2289
|
-
if (!tag.tagSupport.templater.global.oldest) {
|
|
2290
|
-
throw new Error('maybe 1');
|
|
2291
|
-
}
|
|
2292
|
-
subjectTag.tag = tag;
|
|
2293
|
-
if (!tag.hasLiveElements) {
|
|
2294
|
-
throw new Error('44444 - 3');
|
|
2295
|
-
}
|
|
2296
|
-
return;
|
|
2297
|
-
}
|
|
2298
|
-
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_0__.destroyTagMemory)(previousTag, subject);
|
|
2299
|
-
throw new Error('585 - think we never get here');
|
|
2358
|
+
if (previousTag && justUpdate) {
|
|
2359
|
+
/*
|
|
2360
|
+
const areLike = previousTag.isLikeTag(tag)
|
|
2361
|
+
|
|
2362
|
+
// are we just updating an if we already had?
|
|
2363
|
+
if(areLike) {
|
|
2364
|
+
return processTagResultUpdate(tag, subjectTag, previousTag)
|
|
2300
2365
|
}
|
|
2366
|
+
*/
|
|
2367
|
+
return processTagResultUpdate(tag, subjectTag, previousTag);
|
|
2368
|
+
}
|
|
2369
|
+
if (insertBefore.nodeName !== 'TEMPLATE') {
|
|
2370
|
+
throw new Error(';;;;');
|
|
2301
2371
|
}
|
|
2302
2372
|
tag.buildBeforeElement(insertBefore, {
|
|
2303
2373
|
counts,
|
|
2304
|
-
forceElement,
|
|
2374
|
+
forceElement,
|
|
2305
2375
|
});
|
|
2306
2376
|
}
|
|
2377
|
+
function processTagResultUpdate(tag, subject, // used for recording past and current value
|
|
2378
|
+
previousTag) {
|
|
2379
|
+
// components
|
|
2380
|
+
if (subject instanceof Function) {
|
|
2381
|
+
const newTag = subject(previousTag.tagSupport);
|
|
2382
|
+
previousTag.updateByTag(newTag);
|
|
2383
|
+
subject.tag = newTag;
|
|
2384
|
+
return;
|
|
2385
|
+
}
|
|
2386
|
+
previousTag.updateByTag(tag);
|
|
2387
|
+
subject.tag = tag;
|
|
2388
|
+
return;
|
|
2389
|
+
}
|
|
2307
2390
|
|
|
2308
2391
|
|
|
2309
2392
|
/***/ }),
|
|
@@ -2467,38 +2550,6 @@ function run(tagSupport, ownerTag) {
|
|
|
2467
2550
|
}
|
|
2468
2551
|
|
|
2469
2552
|
|
|
2470
|
-
/***/ }),
|
|
2471
|
-
|
|
2472
|
-
/***/ "./ts/redrawTag.function.ts":
|
|
2473
|
-
/*!**********************************!*\
|
|
2474
|
-
!*** ./ts/redrawTag.function.ts ***!
|
|
2475
|
-
\**********************************/
|
|
2476
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2477
|
-
|
|
2478
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2479
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2480
|
-
/* harmony export */ redrawTag: () => (/* binding */ redrawTag)
|
|
2481
|
-
/* harmony export */ });
|
|
2482
|
-
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
2483
|
-
|
|
2484
|
-
/** for components */
|
|
2485
|
-
function redrawTag(subject, templater, ownerTag) {
|
|
2486
|
-
const existingTag = subject.tag || templater.global.newest || templater.global.oldest;
|
|
2487
|
-
if (!templater.global.oldest) {
|
|
2488
|
-
throw new Error('issue before event redraw');
|
|
2489
|
-
}
|
|
2490
|
-
const tagSupport = templater.tagSupport; // || existingTag?.tagSupport
|
|
2491
|
-
if (!templater.tagSupport) {
|
|
2492
|
-
throw new Error('need tag support');
|
|
2493
|
-
}
|
|
2494
|
-
if (!tagSupport.templater.global.oldest) {
|
|
2495
|
-
throw new Error('33333');
|
|
2496
|
-
}
|
|
2497
|
-
let retag = (0,_TemplaterResult_class__WEBPACK_IMPORTED_MODULE_0__.renderWithSupport)(tagSupport, existingTag, subject, ownerTag);
|
|
2498
|
-
return retag;
|
|
2499
|
-
}
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
2553
|
/***/ }),
|
|
2503
2554
|
|
|
2504
2555
|
/***/ "./ts/render.ts":
|
|
@@ -2542,19 +2593,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2542
2593
|
/* harmony export */ renderExistingTag: () => (/* binding */ renderExistingTag)
|
|
2543
2594
|
/* harmony export */ });
|
|
2544
2595
|
/* harmony import */ var _provider_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./provider.utils */ "./ts/provider.utils.ts");
|
|
2545
|
-
/* harmony import */ var
|
|
2546
|
-
/* harmony import */ var
|
|
2596
|
+
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
2597
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
2547
2598
|
|
|
2548
2599
|
|
|
2549
2600
|
|
|
2550
2601
|
/** Returns true when rendering owner is not needed. Returns false when rendering owner should occur */
|
|
2551
2602
|
function renderExistingTag(oldestTag, // existing tag already there
|
|
2552
2603
|
newTemplater, tagSupport, subject) {
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
}
|
|
2604
|
+
const tag = subject.tag;
|
|
2605
|
+
newTemplater.global = tag.tagSupport.templater.global;
|
|
2556
2606
|
if (!oldestTag.hasLiveElements) {
|
|
2557
|
-
throw new Error('1080');
|
|
2607
|
+
throw new Error('1080 - should have live elements');
|
|
2558
2608
|
}
|
|
2559
2609
|
const preRenderCount = tagSupport.templater.global.renderCount;
|
|
2560
2610
|
(0,_provider_utils__WEBPACK_IMPORTED_MODULE_0__.providersChangeCheck)(oldestTag);
|
|
@@ -2565,20 +2615,12 @@ newTemplater, tagSupport, subject) {
|
|
|
2565
2615
|
return latestTag;
|
|
2566
2616
|
}
|
|
2567
2617
|
const oldTemplater = tagSupport.templater || newTemplater;
|
|
2568
|
-
const
|
|
2618
|
+
const toRedrawTag = subject.tag || oldTemplater.global.newest || oldTemplater.global.oldest; // hmmmmmm, why not newest?
|
|
2619
|
+
const redraw = (0,_TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__.renderWithSupport)(newTemplater.tagSupport, toRedrawTag, subject, oldestTag.ownerTag);
|
|
2569
2620
|
const oldest = tagSupport.templater.global.oldest || oldestTag;
|
|
2570
2621
|
redraw.tagSupport.templater.global.oldest = oldest;
|
|
2571
|
-
if (
|
|
2572
|
-
|
|
2573
|
-
}
|
|
2574
|
-
if (!redraw.tagSupport.templater.global.oldest) {
|
|
2575
|
-
throw new Error('8888888 - 0');
|
|
2576
|
-
}
|
|
2577
|
-
if (!oldTemplater.global.oldest) {
|
|
2578
|
-
throw new Error('8888888');
|
|
2579
|
-
}
|
|
2580
|
-
// ??? - add to ensure setProps causes lower redraw
|
|
2581
|
-
if ((0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_1__.isLikeTags)(latestTag, redraw)) {
|
|
2622
|
+
if ((0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__.isLikeTags)(latestTag, redraw)) {
|
|
2623
|
+
subject.tag = redraw;
|
|
2582
2624
|
oldest.updateByTag(redraw);
|
|
2583
2625
|
}
|
|
2584
2626
|
return redraw;
|
|
@@ -2619,7 +2661,8 @@ function renderTagSupport(tagSupport, renderUp) {
|
|
|
2619
2661
|
const newest = subjectTag?.tagSupport.templater.global.newest;
|
|
2620
2662
|
let ownerTag;
|
|
2621
2663
|
let selfPropChange = false;
|
|
2622
|
-
|
|
2664
|
+
const shouldRenderUp = renderUp && newest;
|
|
2665
|
+
if (shouldRenderUp) {
|
|
2623
2666
|
ownerTag = newest.ownerTag;
|
|
2624
2667
|
if (ownerTag) {
|
|
2625
2668
|
const nowProps = templater.props;
|
|
@@ -2632,17 +2675,8 @@ function renderTagSupport(tagSupport, renderUp) {
|
|
|
2632
2675
|
throw new Error('already causing trouble');
|
|
2633
2676
|
}
|
|
2634
2677
|
const tag = (0,_renderExistingTag_function__WEBPACK_IMPORTED_MODULE_2__.renderExistingTag)(templater.global.oldest, templater, useTagSupport, subject);
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
if(exit.remit) {
|
|
2639
|
-
return tag
|
|
2640
|
-
}
|
|
2641
|
-
*/
|
|
2642
|
-
// Have owner re-render
|
|
2643
|
-
// ??? - recently removed. As causes some sort of owner newest disconnect during prop testing
|
|
2644
|
-
// ??? - restored with condition - must render parent if I modified my props
|
|
2645
|
-
if (ownerTag && selfPropChange) {
|
|
2678
|
+
const renderOwner = ownerTag && selfPropChange;
|
|
2679
|
+
if (renderOwner) {
|
|
2646
2680
|
const ownerTagSupport = ownerTag.tagSupport;
|
|
2647
2681
|
renderTagSupport(ownerTagSupport, true);
|
|
2648
2682
|
return tag;
|
|
@@ -2950,6 +2984,263 @@ setUse.tagUse = tagUse;
|
|
|
2950
2984
|
setUse.memory = {};
|
|
2951
2985
|
|
|
2952
2986
|
|
|
2987
|
+
/***/ }),
|
|
2988
|
+
|
|
2989
|
+
/***/ "./ts/subject/Subject.class.ts":
|
|
2990
|
+
/*!*************************************!*\
|
|
2991
|
+
!*** ./ts/subject/Subject.class.ts ***!
|
|
2992
|
+
\*************************************/
|
|
2993
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2994
|
+
|
|
2995
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2996
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2997
|
+
/* harmony export */ Subject: () => (/* binding */ Subject)
|
|
2998
|
+
/* harmony export */ });
|
|
2999
|
+
class Subject {
|
|
3000
|
+
value;
|
|
3001
|
+
methods = [];
|
|
3002
|
+
isSubject = true;
|
|
3003
|
+
subscribers = [];
|
|
3004
|
+
subscribeWith;
|
|
3005
|
+
// unsubcount = 0 // 🔬 testing
|
|
3006
|
+
constructor(value) {
|
|
3007
|
+
this.value = value;
|
|
3008
|
+
}
|
|
3009
|
+
subscribe(callback) {
|
|
3010
|
+
// are we within a pipe?
|
|
3011
|
+
const subscribeWith = this.subscribeWith;
|
|
3012
|
+
if (subscribeWith) {
|
|
3013
|
+
// are we in a pipe?
|
|
3014
|
+
if (this.methods.length) {
|
|
3015
|
+
const orgCallback = callback;
|
|
3016
|
+
callback = (value, subscription) => {
|
|
3017
|
+
runPipedMethods(value, subscription, this.methods, lastValue => orgCallback(lastValue, subscription));
|
|
3018
|
+
};
|
|
3019
|
+
}
|
|
3020
|
+
return subscribeWith(callback);
|
|
3021
|
+
}
|
|
3022
|
+
this.subscribers.push(callback);
|
|
3023
|
+
SubjectClass.globalSubs.push(callback); // 🔬 testing
|
|
3024
|
+
const subscription = getSubscription(this, callback);
|
|
3025
|
+
return subscription;
|
|
3026
|
+
}
|
|
3027
|
+
set(value) {
|
|
3028
|
+
this.value = value;
|
|
3029
|
+
// Notify all subscribers with the new value
|
|
3030
|
+
this.subscribers.forEach((callback) => {
|
|
3031
|
+
callback.value = value;
|
|
3032
|
+
callback(value);
|
|
3033
|
+
});
|
|
3034
|
+
}
|
|
3035
|
+
next = this.set;
|
|
3036
|
+
toPromise() {
|
|
3037
|
+
return new Promise((res, rej) => {
|
|
3038
|
+
const subscription = this.subscribe(x => {
|
|
3039
|
+
subscription.unsubscribe();
|
|
3040
|
+
res(x);
|
|
3041
|
+
});
|
|
3042
|
+
});
|
|
3043
|
+
}
|
|
3044
|
+
pipe(...operations) {
|
|
3045
|
+
const subject = new Subject();
|
|
3046
|
+
subject.methods = operations;
|
|
3047
|
+
subject.subscribeWith = (x) => this.subscribe(x);
|
|
3048
|
+
return subject;
|
|
3049
|
+
}
|
|
3050
|
+
}
|
|
3051
|
+
function removeSubFromArray(subscribers, callback) {
|
|
3052
|
+
const index = subscribers.indexOf(callback);
|
|
3053
|
+
if (index !== -1) {
|
|
3054
|
+
subscribers.splice(index, 1);
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
const SubjectClass = Subject;
|
|
3058
|
+
SubjectClass.globalSubs = []; // 🔬 for testing
|
|
3059
|
+
SubjectClass.globalSubCount$ = new Subject(); // for ease of debugging
|
|
3060
|
+
SubjectClass.globalSubCount$.set(0);
|
|
3061
|
+
function getSubscription(subject, callback) {
|
|
3062
|
+
const countSubject = SubjectClass.globalSubCount$;
|
|
3063
|
+
SubjectClass.globalSubCount$.set(countSubject.value + 1);
|
|
3064
|
+
const subscription = () => {
|
|
3065
|
+
subscription.unsubscribe();
|
|
3066
|
+
};
|
|
3067
|
+
subscription.subscriptions = [];
|
|
3068
|
+
// Return a function to unsubscribe from the BehaviorSubject
|
|
3069
|
+
subscription.unsubscribe = () => {
|
|
3070
|
+
removeSubFromArray(subject.subscribers, callback); // each will be called when update comes in
|
|
3071
|
+
removeSubFromArray(SubjectClass.globalSubs, callback); // 🔬 testing
|
|
3072
|
+
SubjectClass.globalSubCount$.set(countSubject.value - 1);
|
|
3073
|
+
// any double unsubscribes will be ignored
|
|
3074
|
+
subscription.unsubscribe = () => subscription;
|
|
3075
|
+
// unsubscribe from any combined subjects
|
|
3076
|
+
subscription.subscriptions.forEach(subscription => subscription.unsubscribe());
|
|
3077
|
+
return subscription;
|
|
3078
|
+
};
|
|
3079
|
+
subscription.add = (sub) => {
|
|
3080
|
+
subscription.subscriptions.push(sub);
|
|
3081
|
+
return subscription;
|
|
3082
|
+
};
|
|
3083
|
+
return subscription;
|
|
3084
|
+
}
|
|
3085
|
+
function runPipedMethods(value, subscription, methods, onComplete) {
|
|
3086
|
+
const cloneMethods = [...methods];
|
|
3087
|
+
const firstMethod = cloneMethods.shift();
|
|
3088
|
+
const next = (newValue) => {
|
|
3089
|
+
if (cloneMethods.length) {
|
|
3090
|
+
return runPipedMethods(newValue, subscription, cloneMethods, onComplete);
|
|
3091
|
+
}
|
|
3092
|
+
onComplete(newValue);
|
|
3093
|
+
// return newValue = next
|
|
3094
|
+
};
|
|
3095
|
+
let handler = next;
|
|
3096
|
+
const setHandler = (x) => handler = x;
|
|
3097
|
+
const pipeUtils = { setHandler, next };
|
|
3098
|
+
const methodResponse = firstMethod(value, pipeUtils);
|
|
3099
|
+
handler(methodResponse);
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
|
|
3103
|
+
/***/ }),
|
|
3104
|
+
|
|
3105
|
+
/***/ "./ts/subject/ValueSubject.ts":
|
|
3106
|
+
/*!************************************!*\
|
|
3107
|
+
!*** ./ts/subject/ValueSubject.ts ***!
|
|
3108
|
+
\************************************/
|
|
3109
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3110
|
+
|
|
3111
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3112
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3113
|
+
/* harmony export */ ValueSubject: () => (/* binding */ ValueSubject)
|
|
3114
|
+
/* harmony export */ });
|
|
3115
|
+
/* harmony import */ var _Subject_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Subject.class */ "./ts/subject/Subject.class.ts");
|
|
3116
|
+
|
|
3117
|
+
class ValueSubject extends _Subject_class__WEBPACK_IMPORTED_MODULE_0__.Subject {
|
|
3118
|
+
value;
|
|
3119
|
+
constructor(value) {
|
|
3120
|
+
super(value);
|
|
3121
|
+
this.value = value;
|
|
3122
|
+
}
|
|
3123
|
+
subscribe(callback) {
|
|
3124
|
+
const subscription = super.subscribe(callback);
|
|
3125
|
+
// Call the callback immediately with the current value
|
|
3126
|
+
callback(this.value, subscription);
|
|
3127
|
+
return subscription;
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
|
|
3131
|
+
|
|
3132
|
+
/***/ }),
|
|
3133
|
+
|
|
3134
|
+
/***/ "./ts/subject/combineLatest.function.ts":
|
|
3135
|
+
/*!**********************************************!*\
|
|
3136
|
+
!*** ./ts/subject/combineLatest.function.ts ***!
|
|
3137
|
+
\**********************************************/
|
|
3138
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3139
|
+
|
|
3140
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3141
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3142
|
+
/* harmony export */ combineLatest: () => (/* binding */ combineLatest)
|
|
3143
|
+
/* harmony export */ });
|
|
3144
|
+
/* harmony import */ var _Subject_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Subject.class */ "./ts/subject/Subject.class.ts");
|
|
3145
|
+
|
|
3146
|
+
function combineLatest(subjects) {
|
|
3147
|
+
const output = new _Subject_class__WEBPACK_IMPORTED_MODULE_0__.Subject();
|
|
3148
|
+
const subscribe = (callback) => {
|
|
3149
|
+
const valuesSeen = [];
|
|
3150
|
+
const values = [];
|
|
3151
|
+
const setValue = (x, index) => {
|
|
3152
|
+
valuesSeen[index] = true;
|
|
3153
|
+
values[index] = x;
|
|
3154
|
+
if (valuesSeen.length === subjects.length && valuesSeen.every(x => x)) {
|
|
3155
|
+
callback(values, subscription);
|
|
3156
|
+
}
|
|
3157
|
+
};
|
|
3158
|
+
const clones = [...subjects];
|
|
3159
|
+
const firstSub = clones.shift();
|
|
3160
|
+
const subscription = firstSub.subscribe(x => setValue(x, 0));
|
|
3161
|
+
const subscriptions = clones.map((subject, index) => subject.subscribe(x => setValue(x, index + 1)));
|
|
3162
|
+
subscription.subscriptions = subscriptions;
|
|
3163
|
+
return subscription;
|
|
3164
|
+
};
|
|
3165
|
+
output.subscribeWith = subscribe;
|
|
3166
|
+
return output;
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
|
|
3170
|
+
/***/ }),
|
|
3171
|
+
|
|
3172
|
+
/***/ "./ts/subject/index.ts":
|
|
3173
|
+
/*!*****************************!*\
|
|
3174
|
+
!*** ./ts/subject/index.ts ***!
|
|
3175
|
+
\*****************************/
|
|
3176
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3177
|
+
|
|
3178
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3179
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3180
|
+
/* harmony export */ Subject: () => (/* reexport safe */ _Subject_class__WEBPACK_IMPORTED_MODULE_0__.Subject),
|
|
3181
|
+
/* harmony export */ ValueSubject: () => (/* reexport safe */ _ValueSubject__WEBPACK_IMPORTED_MODULE_1__.ValueSubject),
|
|
3182
|
+
/* harmony export */ combineLatest: () => (/* reexport safe */ _combineLatest_function__WEBPACK_IMPORTED_MODULE_2__.combineLatest),
|
|
3183
|
+
/* harmony export */ willCallback: () => (/* reexport safe */ _will_functions__WEBPACK_IMPORTED_MODULE_3__.willCallback),
|
|
3184
|
+
/* harmony export */ willPromise: () => (/* reexport safe */ _will_functions__WEBPACK_IMPORTED_MODULE_3__.willPromise),
|
|
3185
|
+
/* harmony export */ willSubscribe: () => (/* reexport safe */ _will_functions__WEBPACK_IMPORTED_MODULE_3__.willSubscribe)
|
|
3186
|
+
/* harmony export */ });
|
|
3187
|
+
/* harmony import */ var _Subject_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Subject.class */ "./ts/subject/Subject.class.ts");
|
|
3188
|
+
/* harmony import */ var _ValueSubject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ValueSubject */ "./ts/subject/ValueSubject.ts");
|
|
3189
|
+
/* harmony import */ var _combineLatest_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./combineLatest.function */ "./ts/subject/combineLatest.function.ts");
|
|
3190
|
+
/* harmony import */ var _will_functions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./will.functions */ "./ts/subject/will.functions.ts");
|
|
3191
|
+
|
|
3192
|
+
|
|
3193
|
+
|
|
3194
|
+
|
|
3195
|
+
|
|
3196
|
+
|
|
3197
|
+
/***/ }),
|
|
3198
|
+
|
|
3199
|
+
/***/ "./ts/subject/will.functions.ts":
|
|
3200
|
+
/*!**************************************!*\
|
|
3201
|
+
!*** ./ts/subject/will.functions.ts ***!
|
|
3202
|
+
\**************************************/
|
|
3203
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3204
|
+
|
|
3205
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3206
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3207
|
+
/* harmony export */ willCallback: () => (/* binding */ willCallback),
|
|
3208
|
+
/* harmony export */ willPromise: () => (/* binding */ willPromise),
|
|
3209
|
+
/* harmony export */ willSubscribe: () => (/* binding */ willSubscribe)
|
|
3210
|
+
/* harmony export */ });
|
|
3211
|
+
function willCallback(callback) {
|
|
3212
|
+
return ((lastValue, utils) => {
|
|
3213
|
+
utils.setHandler(() => {
|
|
3214
|
+
return undefined;
|
|
3215
|
+
});
|
|
3216
|
+
callback(lastValue, utils.next);
|
|
3217
|
+
});
|
|
3218
|
+
}
|
|
3219
|
+
/** .pipe( promise((x) => Promise.resolve(44)) ) */
|
|
3220
|
+
function willPromise(callback) {
|
|
3221
|
+
return ((lastValue, utils) => {
|
|
3222
|
+
utils.setHandler(() => {
|
|
3223
|
+
return undefined;
|
|
3224
|
+
}); // do nothing on initial return
|
|
3225
|
+
const result = callback(lastValue);
|
|
3226
|
+
result.then(x => utils.next(x));
|
|
3227
|
+
});
|
|
3228
|
+
}
|
|
3229
|
+
/** .pipe( willSubscribe((x) => new ValueSubject(44)) ) */
|
|
3230
|
+
const willSubscribe = (callback) => {
|
|
3231
|
+
return ((lastValue, utils) => {
|
|
3232
|
+
utils.setHandler(() => {
|
|
3233
|
+
return undefined;
|
|
3234
|
+
}); // do nothing on initial return
|
|
3235
|
+
const result = callback(lastValue);
|
|
3236
|
+
const subscription = result.subscribe(x => {
|
|
3237
|
+
subscription.unsubscribe();
|
|
3238
|
+
utils.next(x);
|
|
3239
|
+
});
|
|
3240
|
+
});
|
|
3241
|
+
};
|
|
3242
|
+
|
|
3243
|
+
|
|
2953
3244
|
/***/ }),
|
|
2954
3245
|
|
|
2955
3246
|
/***/ "./ts/tag.ts":
|
|
@@ -2966,11 +3257,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2966
3257
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
2967
3258
|
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
2968
3259
|
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
2969
|
-
/* harmony import */ var
|
|
2970
|
-
/* harmony import */ var
|
|
2971
|
-
/* harmony import */ var
|
|
2972
|
-
/* harmony import */ var
|
|
2973
|
-
/* harmony import */ var
|
|
3260
|
+
/* harmony import */ var _bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bindSubjectCallback.function */ "./ts/bindSubjectCallback.function.ts");
|
|
3261
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
3262
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3263
|
+
/* harmony import */ var _alterProps_function__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./alterProps.function */ "./ts/alterProps.function.ts");
|
|
3264
|
+
/* harmony import */ var _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./subject/ValueSubject */ "./ts/subject/ValueSubject.ts");
|
|
2974
3265
|
|
|
2975
3266
|
|
|
2976
3267
|
|
|
@@ -3011,15 +3302,15 @@ function kidsToTagArraySubject(children) {
|
|
|
3011
3302
|
}
|
|
3012
3303
|
const kidArray = children;
|
|
3013
3304
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagArray)(kidArray)) {
|
|
3014
|
-
return { childSubject: new
|
|
3305
|
+
return { childSubject: new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_7__.ValueSubject(children), madeSubject: true };
|
|
3015
3306
|
}
|
|
3016
3307
|
const kid = children;
|
|
3017
3308
|
if (kid) {
|
|
3018
|
-
kid.arrayValue = 0;
|
|
3019
|
-
return { childSubject: new
|
|
3309
|
+
kid.memory.arrayValue = 0;
|
|
3310
|
+
return { childSubject: new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_7__.ValueSubject([kid]), madeSubject: true };
|
|
3020
3311
|
}
|
|
3021
3312
|
return {
|
|
3022
|
-
childSubject: new
|
|
3313
|
+
childSubject: new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_7__.ValueSubject([]),
|
|
3023
3314
|
madeSubject: true
|
|
3024
3315
|
};
|
|
3025
3316
|
}
|
|
@@ -3050,9 +3341,7 @@ function getTagWrap(templater, madeSubject) {
|
|
|
3050
3341
|
if (oldest && !oldest.hasLiveElements) {
|
|
3051
3342
|
throw new Error('issue already 22');
|
|
3052
3343
|
}
|
|
3053
|
-
// ???
|
|
3054
3344
|
let props = templater.props;
|
|
3055
|
-
// let props = oldTagSetup.propsConfig.latest
|
|
3056
3345
|
const ownerTagSupport = oldTagSetup.ownerTagSupport;
|
|
3057
3346
|
const oldTemplater = ownerTagSupport?.templater;
|
|
3058
3347
|
const oldLatest = oldTemplater?.global.newest;
|
|
@@ -3060,12 +3349,12 @@ function getTagWrap(templater, madeSubject) {
|
|
|
3060
3349
|
if (oldLatest && !newestOwnerTemplater) {
|
|
3061
3350
|
throw new Error('what to do here?');
|
|
3062
3351
|
}
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
const clonedProps = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_5__.deepClone)(props); // castedProps
|
|
3352
|
+
let castedProps = (0,_alterProps_function__WEBPACK_IMPORTED_MODULE_6__.alterProps)(props, newestOwnerTemplater, oldTagSetup.ownerTagSupport);
|
|
3353
|
+
const clonedProps = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_4__.deepClone)(props); // castedProps
|
|
3066
3354
|
// CALL ORIGINAL COMPONENT FUNCTION
|
|
3067
3355
|
const tag = originalFunction(castedProps, childSubject);
|
|
3068
|
-
tag.
|
|
3356
|
+
tag.version = global.renderCount;
|
|
3357
|
+
tag.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_5__.TagSupport(oldTagSetup.ownerTagSupport, templater, subject);
|
|
3069
3358
|
tag.tagSupport.propsConfig = {
|
|
3070
3359
|
latest: props, // castedProps
|
|
3071
3360
|
latestCloned: clonedProps,
|
|
@@ -3086,7 +3375,7 @@ function getTagWrap(templater, madeSubject) {
|
|
|
3086
3375
|
// all functions need to report to me
|
|
3087
3376
|
kid.values[index] = function (...args) {
|
|
3088
3377
|
const ownerTag = tag.ownerTag;
|
|
3089
|
-
(0,
|
|
3378
|
+
(0,_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_3__.runTagCallback)(value, // callback
|
|
3090
3379
|
ownerTag, this, // bindTo
|
|
3091
3380
|
args);
|
|
3092
3381
|
};
|
|
@@ -3115,7 +3404,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3115
3404
|
/* harmony export */ });
|
|
3116
3405
|
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3117
3406
|
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
3118
|
-
/* harmony import */ var
|
|
3407
|
+
/* harmony import */ var _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./subject/ValueSubject */ "./ts/subject/ValueSubject.ts");
|
|
3119
3408
|
|
|
3120
3409
|
|
|
3121
3410
|
|
|
@@ -3153,7 +3442,7 @@ element, props) {
|
|
|
3153
3442
|
return { tag, tags: app.original.tags };
|
|
3154
3443
|
}
|
|
3155
3444
|
function applyTagUpdater(wrapper) {
|
|
3156
|
-
const subject = new
|
|
3445
|
+
const subject = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_2__.ValueSubject({});
|
|
3157
3446
|
const tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__.BaseTagSupport(wrapper, subject);
|
|
3158
3447
|
wrapper.tagSupport = tagSupport;
|
|
3159
3448
|
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_1__.runBeforeRender)(tagSupport, undefined);
|
|
@@ -3202,6 +3491,35 @@ function runBeforeDestroy(tagSupport, tag) {
|
|
|
3202
3491
|
}
|
|
3203
3492
|
|
|
3204
3493
|
|
|
3494
|
+
/***/ }),
|
|
3495
|
+
|
|
3496
|
+
/***/ "./ts/updateBeforeTemplate.function.ts":
|
|
3497
|
+
/*!*********************************************!*\
|
|
3498
|
+
!*** ./ts/updateBeforeTemplate.function.ts ***!
|
|
3499
|
+
\*********************************************/
|
|
3500
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3501
|
+
|
|
3502
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3503
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3504
|
+
/* harmony export */ updateBeforeTemplate: () => (/* binding */ updateBeforeTemplate)
|
|
3505
|
+
/* harmony export */ });
|
|
3506
|
+
// Function to update the value of x
|
|
3507
|
+
function updateBeforeTemplate(value, lastFirstChild) {
|
|
3508
|
+
const parent = lastFirstChild.parentNode;
|
|
3509
|
+
let castedValue = value;
|
|
3510
|
+
// mimic React skipping to display EXCEPT for true does display on page
|
|
3511
|
+
if ([undefined, false, null].includes(value)) { // || value === true
|
|
3512
|
+
castedValue = '';
|
|
3513
|
+
}
|
|
3514
|
+
// Insert the new value (never use innerHTML here)
|
|
3515
|
+
const textNode = document.createTextNode(castedValue); // never innerHTML
|
|
3516
|
+
parent.insertBefore(textNode, lastFirstChild);
|
|
3517
|
+
/* remove existing nodes */
|
|
3518
|
+
parent.removeChild(lastFirstChild);
|
|
3519
|
+
return textNode;
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3522
|
+
|
|
3205
3523
|
/***/ }),
|
|
3206
3524
|
|
|
3207
3525
|
/***/ "./ts/updateExistingTagComponent.function.ts":
|
|
@@ -3215,28 +3533,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3215
3533
|
/* harmony export */ updateExistingTagComponent: () => (/* binding */ updateExistingTagComponent)
|
|
3216
3534
|
/* harmony export */ });
|
|
3217
3535
|
/* harmony import */ var _hasTagSupportChanged_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hasTagSupportChanged.function */ "./ts/hasTagSupportChanged.function.ts");
|
|
3218
|
-
/* harmony import */ var
|
|
3219
|
-
/* harmony import */ var
|
|
3220
|
-
/* harmony import */ var
|
|
3221
|
-
/* harmony import */ var
|
|
3536
|
+
/* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/processSubjectComponent.function.ts");
|
|
3537
|
+
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
3538
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
3539
|
+
/* harmony import */ var _alterProps_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./alterProps.function */ "./ts/alterProps.function.ts");
|
|
3222
3540
|
|
|
3223
3541
|
|
|
3224
3542
|
|
|
3225
3543
|
|
|
3226
3544
|
|
|
3227
|
-
function updateExistingTagComponent(ownerTag,
|
|
3545
|
+
function updateExistingTagComponent(ownerTag, templater, subject, insertBefore) {
|
|
3228
3546
|
let existingTag = subject.tag;
|
|
3229
|
-
/*
|
|
3230
|
-
if(existingTag && !existingTag.hasLiveElements) {
|
|
3231
|
-
throw new Error('issue already began')
|
|
3232
|
-
}
|
|
3233
|
-
*/
|
|
3234
3547
|
const oldWrapper = existingTag.tagSupport.templater.wrapper;
|
|
3235
|
-
const newWrapper =
|
|
3548
|
+
const newWrapper = templater.wrapper;
|
|
3236
3549
|
let isSameTag = false;
|
|
3237
|
-
if (tempResult.global.oldest && !tempResult.global.oldest.hasLiveElements) {
|
|
3238
|
-
throw new Error('88893434');
|
|
3239
|
-
}
|
|
3240
3550
|
if (oldWrapper && newWrapper) {
|
|
3241
3551
|
const oldFunction = oldWrapper.original;
|
|
3242
3552
|
const newFunction = newWrapper.original;
|
|
@@ -3246,42 +3556,58 @@ function updateExistingTagComponent(ownerTag, tempResult, subject, insertBefore)
|
|
|
3246
3556
|
const oldGlobal = oldTagSupport.templater.global;
|
|
3247
3557
|
const globalInsert = oldGlobal.insertBefore;
|
|
3248
3558
|
const oldInsertBefore = globalInsert?.parentNode ? globalInsert : insertBefore;
|
|
3249
|
-
|
|
3250
|
-
|
|
3559
|
+
// const placeholderElm = ownerTag.tagSupport.templater.global.placeholderElm
|
|
3560
|
+
const placeholderElm = oldGlobal.placeholderElm;
|
|
3561
|
+
if (placeholderElm) {
|
|
3562
|
+
if (!placeholderElm.parentNode) {
|
|
3563
|
+
throw new Error('stop here no subject parent node update existing tag');
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3566
|
+
else if (!oldInsertBefore.parentNode) {
|
|
3567
|
+
//throw new Error('stop here no parent node update existing tag')
|
|
3251
3568
|
}
|
|
3252
3569
|
if (!isSameTag) {
|
|
3253
|
-
(0,
|
|
3254
|
-
(0,
|
|
3570
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(oldTagSupport.templater.global.oldest, subject);
|
|
3571
|
+
return (0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_1__.processSubjectComponent)(templater, subject,
|
|
3572
|
+
// ??? - newly changed
|
|
3573
|
+
insertBefore, // oldInsertBefore,
|
|
3574
|
+
ownerTag, {
|
|
3255
3575
|
forceElement: false,
|
|
3256
3576
|
counts: { added: 0, removed: 0 },
|
|
3257
3577
|
});
|
|
3258
|
-
return;
|
|
3259
3578
|
}
|
|
3260
3579
|
else {
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
}
|
|
3264
|
-
const newTagSupport = tempResult.tagSupport;
|
|
3265
|
-
const hasChanged = (0,_hasTagSupportChanged_function__WEBPACK_IMPORTED_MODULE_0__.hasTagSupportChanged)(oldTagSupport, newTagSupport, tempResult);
|
|
3580
|
+
const newTagSupport = templater.tagSupport;
|
|
3581
|
+
const hasChanged = (0,_hasTagSupportChanged_function__WEBPACK_IMPORTED_MODULE_0__.hasTagSupportChanged)(oldTagSupport, newTagSupport, templater);
|
|
3266
3582
|
if (!hasChanged) {
|
|
3267
|
-
|
|
3583
|
+
// if the new props are an object then implicitly since no change, the old props are an object
|
|
3584
|
+
const newProps = templater.props;
|
|
3585
|
+
if (newProps && typeof (newProps) === 'object') {
|
|
3586
|
+
// const newestTag = oldTagSupport.templater.global.newest
|
|
3587
|
+
// const oldProps = existingTag.tagSupport.propsConfig.latestCloned as Record<string,any> // newestTag.props as Record<string, any>
|
|
3588
|
+
syncFunctionProps(templater, existingTag, ownerTag, newProps);
|
|
3589
|
+
}
|
|
3590
|
+
return existingTag; // its the same tag component
|
|
3268
3591
|
}
|
|
3269
3592
|
}
|
|
3270
|
-
const oldestTag =
|
|
3271
|
-
const previous =
|
|
3593
|
+
const oldestTag = templater.global.oldest; // oldTagSupport.oldest as Tag // existingTag
|
|
3594
|
+
const previous = templater.global.newest;
|
|
3272
3595
|
if (!previous || !oldestTag) {
|
|
3273
3596
|
throw new Error('how no previous or oldest nor newest?');
|
|
3274
3597
|
}
|
|
3275
|
-
const newTag = (0,
|
|
3598
|
+
const newTag = (0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_3__.renderTagSupport)(templater.tagSupport, false);
|
|
3276
3599
|
existingTag = subject.tag;
|
|
3277
3600
|
const newOldest = newTag.tagSupport.templater.global.oldest;
|
|
3278
3601
|
const hasOldest = newOldest ? true : false;
|
|
3279
3602
|
if (!hasOldest) {
|
|
3280
|
-
return buildNewTag(newTag,
|
|
3603
|
+
return buildNewTag(newTag,
|
|
3604
|
+
// ??? newly changed
|
|
3605
|
+
insertBefore, // oldInsertBefore,
|
|
3606
|
+
oldTagSupport, subject);
|
|
3281
3607
|
}
|
|
3282
|
-
if (newOldest &&
|
|
3608
|
+
if (newOldest && templater.children.value.length) {
|
|
3283
3609
|
const oldKidsSub = newOldest.tagSupport.templater.children;
|
|
3284
|
-
oldKidsSub.set(
|
|
3610
|
+
oldKidsSub.set(templater.children.value);
|
|
3285
3611
|
}
|
|
3286
3612
|
// const newTag = tempResult.newest as Tag
|
|
3287
3613
|
if (previous && !oldestTag) {
|
|
@@ -3298,28 +3624,22 @@ function updateExistingTagComponent(ownerTag, tempResult, subject, insertBefore)
|
|
|
3298
3624
|
throw new Error('maybe 6');
|
|
3299
3625
|
}
|
|
3300
3626
|
subject.tag = newTag;
|
|
3301
|
-
/*
|
|
3302
|
-
if(!newTag.hasLiveElements) {
|
|
3303
|
-
throw new Error('44444 - 6')
|
|
3304
|
-
}
|
|
3305
|
-
*/
|
|
3306
3627
|
oldestTag.updateByTag(newTag); // the oldest tag has element references
|
|
3628
|
+
return newTag;
|
|
3307
3629
|
}
|
|
3308
3630
|
else {
|
|
3309
3631
|
// Although function looked the same it returned a different html result
|
|
3310
3632
|
if (isSameTag && existingTag) {
|
|
3311
|
-
(0,
|
|
3633
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(existingTag, subject);
|
|
3312
3634
|
newTag.tagSupport.templater.global.context = {}; // do not share previous outputs
|
|
3313
3635
|
}
|
|
3314
3636
|
oldest = undefined;
|
|
3315
|
-
// ??? - new remove
|
|
3316
|
-
// subject.tag = newTag
|
|
3317
3637
|
}
|
|
3318
3638
|
if (!oldest) {
|
|
3319
3639
|
buildNewTag(newTag, oldTagSupport.templater.global.insertBefore, oldTagSupport, subject);
|
|
3320
3640
|
}
|
|
3321
3641
|
oldTagSupport.templater.global.newest = newTag;
|
|
3322
|
-
return;
|
|
3642
|
+
return newTag;
|
|
3323
3643
|
}
|
|
3324
3644
|
function checkStateChanged(state) {
|
|
3325
3645
|
return !state.newest.every(state => {
|
|
@@ -3335,20 +3655,39 @@ function checkStateChanged(state) {
|
|
|
3335
3655
|
function buildNewTag(newTag, oldInsertBefore, oldTagSupport, subject) {
|
|
3336
3656
|
newTag.buildBeforeElement(oldInsertBefore, {
|
|
3337
3657
|
forceElement: true,
|
|
3338
|
-
counts: { added: 0, removed: 0 },
|
|
3658
|
+
counts: { added: 0, removed: 0 },
|
|
3339
3659
|
});
|
|
3340
3660
|
newTag.tagSupport.templater.global.oldest = newTag;
|
|
3341
3661
|
newTag.tagSupport.templater.global.newest = newTag;
|
|
3342
3662
|
oldTagSupport.templater.global.oldest = newTag;
|
|
3343
3663
|
oldTagSupport.templater.global.newest = newTag;
|
|
3344
|
-
if (!newTag.tagSupport.templater.global.oldest) {
|
|
3345
|
-
throw new Error('maybe 5');
|
|
3346
|
-
}
|
|
3347
3664
|
subject.tag = newTag;
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3665
|
+
return newTag;
|
|
3666
|
+
}
|
|
3667
|
+
function syncFunctionProps(templater, existingTag, ownerTag, newProps) {
|
|
3668
|
+
existingTag = existingTag.tagSupport.templater.global.newest;
|
|
3669
|
+
// const templater = existingTag.tagSupport.templater
|
|
3670
|
+
const priorProps = existingTag.tagSupport.propsConfig.latestCloned;
|
|
3671
|
+
const oldLatest = ownerTag.tagSupport.templater.global.newest;
|
|
3672
|
+
const ownerSupport = oldLatest.tagSupport;
|
|
3673
|
+
Object.entries(priorProps).forEach(([name, value]) => {
|
|
3674
|
+
if (!(value instanceof Function)) {
|
|
3675
|
+
return;
|
|
3676
|
+
}
|
|
3677
|
+
const newOriginal = value.original;
|
|
3678
|
+
// TODO: The code below maybe irrelevant
|
|
3679
|
+
const newCallback = newProps[name];
|
|
3680
|
+
const original = newCallback.original;
|
|
3681
|
+
if (original) {
|
|
3682
|
+
return; // already previously converted
|
|
3683
|
+
}
|
|
3684
|
+
// Currently, call self but over parent state changes, I may need to call a newer parent tag owner
|
|
3685
|
+
priorProps[name].toCall = (...args) => {
|
|
3686
|
+
return (0,_alterProps_function__WEBPACK_IMPORTED_MODULE_4__.callbackPropOwner)(newCallback, // value, // newOriginal,
|
|
3687
|
+
args, templater, ownerSupport);
|
|
3688
|
+
};
|
|
3689
|
+
return;
|
|
3690
|
+
});
|
|
3352
3691
|
}
|
|
3353
3692
|
|
|
3354
3693
|
|
|
@@ -3364,8 +3703,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3364
3703
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3365
3704
|
/* harmony export */ updateExistingValue: () => (/* binding */ updateExistingValue)
|
|
3366
3705
|
/* harmony export */ });
|
|
3367
|
-
/* harmony import */ var
|
|
3368
|
-
/* harmony import */ var
|
|
3706
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3707
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
3369
3708
|
/* harmony import */ var _processTagArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./processTagArray */ "./ts/processTagArray.ts");
|
|
3370
3709
|
/* harmony import */ var _updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./updateExistingTagComponent.function */ "./ts/updateExistingTagComponent.function.ts");
|
|
3371
3710
|
/* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/processRegularValue.function.ts");
|
|
@@ -3373,6 +3712,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3373
3712
|
/* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/processSubjectComponent.function.ts");
|
|
3374
3713
|
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
3375
3714
|
/* harmony import */ var _bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./bindSubjectCallback.function */ "./ts/bindSubjectCallback.function.ts");
|
|
3715
|
+
/* harmony import */ var _processTag_function__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./processTag.function */ "./ts/processTag.function.ts");
|
|
3716
|
+
/* harmony import */ var _insertAfter_function__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./insertAfter.function */ "./ts/insertAfter.function.ts");
|
|
3717
|
+
|
|
3718
|
+
|
|
3376
3719
|
|
|
3377
3720
|
|
|
3378
3721
|
|
|
@@ -3383,34 +3726,51 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3383
3726
|
|
|
3384
3727
|
|
|
3385
3728
|
function updateExistingValue(subject, value, ownerTag, insertBefore) {
|
|
3386
|
-
const
|
|
3387
|
-
const isComponent = (0,
|
|
3388
|
-
const
|
|
3389
|
-
(
|
|
3729
|
+
const subjectTag = subject;
|
|
3730
|
+
const isComponent = (0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value);
|
|
3731
|
+
// const global = subjectTag.tag?.tagSupport.templater.global
|
|
3732
|
+
// const placeholderElm = global?.placeholderElm || global?.insertBefore || (subject as DisplaySubject).insertBefore
|
|
3733
|
+
// const oldInsertBefore = placeholderElm || (subject as DisplaySubject).clone
|
|
3734
|
+
const destroyType = (0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_5__.checkDestroyPrevious)(subject, value, insertBefore);
|
|
3390
3735
|
// handle already seen tag components
|
|
3391
3736
|
if (isComponent) {
|
|
3392
3737
|
const templater = value;
|
|
3393
3738
|
// When was something before component
|
|
3394
|
-
if (!
|
|
3395
|
-
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_6__.processSubjectComponent)(templater,
|
|
3739
|
+
if (!subjectTag.tag) {
|
|
3740
|
+
const tag = (0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_6__.processSubjectComponent)(templater, subjectTag, insertBefore, // oldInsertBefore as InsertBefore,
|
|
3741
|
+
ownerTag, {
|
|
3396
3742
|
forceElement: true,
|
|
3397
3743
|
counts: { added: 0, removed: 0 },
|
|
3398
3744
|
});
|
|
3399
|
-
return
|
|
3745
|
+
return subjectTag;
|
|
3746
|
+
}
|
|
3747
|
+
// ??? - new put back down template tag before redraw
|
|
3748
|
+
const placeholderElm = subjectTag.tag.tagSupport.templater.global.placeholderElm;
|
|
3749
|
+
if (placeholderElm) {
|
|
3750
|
+
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_10__.insertAfter)(insertBefore, placeholderElm);
|
|
3751
|
+
delete subjectTag.tag.tagSupport.templater.global.placeholderElm;
|
|
3752
|
+
}
|
|
3753
|
+
templater.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__.TagSupport(
|
|
3754
|
+
// subjectTag.tag.tagSupport.ownerTagSupport,
|
|
3755
|
+
ownerTag.tagSupport, templater, subjectTag);
|
|
3756
|
+
const tag = (0,_updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_3__.updateExistingTagComponent)(ownerTag, templater, // latest value
|
|
3757
|
+
subjectTag, insertBefore);
|
|
3758
|
+
if (insertBefore.parentNode) {
|
|
3759
|
+
tag.tagSupport.templater.global.placeholderElm = insertBefore.previousSibling;
|
|
3760
|
+
insertBefore.parentNode.removeChild(insertBefore);
|
|
3400
3761
|
}
|
|
3401
|
-
|
|
3402
|
-
subjectSubTag, insertBefore);
|
|
3403
|
-
return subjectSubTag;
|
|
3762
|
+
return subjectTag;
|
|
3404
3763
|
}
|
|
3405
3764
|
// was component but no longer
|
|
3406
|
-
const
|
|
3407
|
-
if (
|
|
3408
|
-
handleStillTag(
|
|
3409
|
-
return
|
|
3765
|
+
const tag = subjectTag.tag;
|
|
3766
|
+
if (tag) {
|
|
3767
|
+
handleStillTag(tag, subject, value, ownerTag);
|
|
3768
|
+
return subjectTag;
|
|
3410
3769
|
}
|
|
3411
3770
|
// its another tag array
|
|
3412
|
-
if ((0,
|
|
3413
|
-
(0,_processTagArray__WEBPACK_IMPORTED_MODULE_2__.processTagArray)(subject, value,
|
|
3771
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagArray)(value)) {
|
|
3772
|
+
(0,_processTagArray__WEBPACK_IMPORTED_MODULE_2__.processTagArray)(subject, value, insertBefore, // oldInsertBefore as InsertBefore,
|
|
3773
|
+
ownerTag, { counts: {
|
|
3414
3774
|
added: 0,
|
|
3415
3775
|
removed: 0,
|
|
3416
3776
|
} });
|
|
@@ -3423,18 +3783,23 @@ function updateExistingValue(subject, value, ownerTag, insertBefore) {
|
|
|
3423
3783
|
subject.set(bound);
|
|
3424
3784
|
return subject;
|
|
3425
3785
|
}
|
|
3426
|
-
if ((0,
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3786
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagInstance)(value)) {
|
|
3787
|
+
if (insertBefore.tagName !== 'TEMPLATE') {
|
|
3788
|
+
throw new Error(`expected template - ${insertBefore.nodeName}`);
|
|
3789
|
+
}
|
|
3790
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_9__.processTag)(value, subjectTag, insertBefore, ownerTag);
|
|
3791
|
+
return subjectTag;
|
|
3430
3792
|
}
|
|
3431
3793
|
// we have been given a subject
|
|
3432
|
-
if ((0,
|
|
3794
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isSubjectInstance)(value)) {
|
|
3433
3795
|
return value;
|
|
3434
3796
|
}
|
|
3435
3797
|
// This will cause all other values to render
|
|
3436
|
-
(0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_4__.processRegularValue)(value, subject,
|
|
3437
|
-
|
|
3798
|
+
(0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_4__.processRegularValue)(value, subject,
|
|
3799
|
+
// ??? - changed to insertBefore for tag switching with template removal
|
|
3800
|
+
insertBefore // oldInsertBefore as InsertBefore,
|
|
3801
|
+
);
|
|
3802
|
+
return subjectTag;
|
|
3438
3803
|
}
|
|
3439
3804
|
function handleStillTag(existingTag, subject, value, ownerTag) {
|
|
3440
3805
|
// TODO: We shouldn't need both of these
|
|
@@ -3442,16 +3807,20 @@ function handleStillTag(existingTag, subject, value, ownerTag) {
|
|
|
3442
3807
|
const isSameTag2 = value && value.getTemplate && existingTag.isLikeTag(value);
|
|
3443
3808
|
const tag = value;
|
|
3444
3809
|
if (!tag.tagSupport) {
|
|
3445
|
-
(0,
|
|
3810
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_9__.applyFakeTemplater)(tag, ownerTag, subject);
|
|
3446
3811
|
}
|
|
3447
3812
|
if (isSameTag) {
|
|
3448
3813
|
existingTag.updateByTag(tag);
|
|
3449
3814
|
return;
|
|
3450
3815
|
}
|
|
3451
3816
|
if (isSameTag || isSameTag2) {
|
|
3452
|
-
|
|
3817
|
+
const subjectTag = subject;
|
|
3818
|
+
const global = existingTag.tagSupport.templater.global;
|
|
3819
|
+
delete global.placeholderElm;
|
|
3820
|
+
const insertBefore = global.insertBefore;
|
|
3821
|
+
return (0,_processTag_function__WEBPACK_IMPORTED_MODULE_9__.processTag)(value, subjectTag, insertBefore, ownerTag);
|
|
3453
3822
|
}
|
|
3454
|
-
return (0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_4__.processRegularValue)(value, subject, subject.
|
|
3823
|
+
return (0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_4__.processRegularValue)(value, subject, subject.insertBefore);
|
|
3455
3824
|
}
|
|
3456
3825
|
|
|
3457
3826
|
|
|
@@ -3556,56 +3925,59 @@ var __webpack_exports__ = {};
|
|
|
3556
3925
|
__webpack_require__.r(__webpack_exports__);
|
|
3557
3926
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3558
3927
|
/* harmony export */ ArrayNoKeyError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_4__.ArrayNoKeyError),
|
|
3559
|
-
/* harmony export */ BaseTagSupport: () => (/* reexport safe */
|
|
3928
|
+
/* harmony export */ BaseTagSupport: () => (/* reexport safe */ _TagSupport_class__WEBPACK_IMPORTED_MODULE_8__.BaseTagSupport),
|
|
3560
3929
|
/* harmony export */ StateMismatchError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_4__.StateMismatchError),
|
|
3561
|
-
/* harmony export */ Subject: () => (/* reexport safe */
|
|
3562
|
-
/* harmony export */ Tag: () => (/* reexport safe */
|
|
3930
|
+
/* harmony export */ Subject: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.Subject),
|
|
3931
|
+
/* harmony export */ Tag: () => (/* reexport safe */ _Tag_class__WEBPACK_IMPORTED_MODULE_10__.Tag),
|
|
3563
3932
|
/* harmony export */ TagError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_4__.TagError),
|
|
3564
|
-
/* harmony export */ TagSupport: () => (/* reexport safe */
|
|
3565
|
-
/* harmony export */ ValueSubject: () => (/* reexport safe */
|
|
3566
|
-
/* harmony export */
|
|
3933
|
+
/* harmony export */ TagSupport: () => (/* reexport safe */ _TagSupport_class__WEBPACK_IMPORTED_MODULE_8__.TagSupport),
|
|
3934
|
+
/* harmony export */ ValueSubject: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.ValueSubject),
|
|
3935
|
+
/* harmony export */ combineLatest: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.combineLatest),
|
|
3936
|
+
/* harmony export */ getCallback: () => (/* reexport safe */ _getCallback__WEBPACK_IMPORTED_MODULE_19__.getCallback),
|
|
3567
3937
|
/* harmony export */ hmr: () => (/* binding */ hmr),
|
|
3568
3938
|
/* harmony export */ html: () => (/* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_3__.html),
|
|
3569
|
-
/* harmony export */ interpolateElement: () => (/* reexport safe */
|
|
3570
|
-
/* harmony export */ interpolateString: () => (/* reexport safe */
|
|
3939
|
+
/* harmony export */ interpolateElement: () => (/* reexport safe */ _interpolateElement__WEBPACK_IMPORTED_MODULE_9__.interpolateElement),
|
|
3940
|
+
/* harmony export */ interpolateString: () => (/* reexport safe */ _interpolateElement__WEBPACK_IMPORTED_MODULE_9__.interpolateString),
|
|
3571
3941
|
/* harmony export */ isSubjectInstance: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isSubjectInstance),
|
|
3572
3942
|
/* harmony export */ isTagArray: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagArray),
|
|
3573
3943
|
/* harmony export */ isTagComponent: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagComponent),
|
|
3574
3944
|
/* harmony export */ isTagInstance: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagInstance),
|
|
3575
|
-
/* harmony export */ onDestroy: () => (/* reexport safe */
|
|
3576
|
-
/* harmony export */ onInit: () => (/* reexport safe */
|
|
3577
|
-
/* harmony export */ providers: () => (/* reexport safe */
|
|
3578
|
-
/* harmony export */ runBeforeRender: () => (/* reexport safe */
|
|
3579
|
-
/* harmony export */ set: () => (/* reexport safe */
|
|
3580
|
-
/* harmony export */ setLet: () => (/* reexport safe */
|
|
3581
|
-
/* harmony export */ setProp: () => (/* reexport safe */
|
|
3582
|
-
/* harmony export */ setUse: () => (/* reexport safe */
|
|
3945
|
+
/* harmony export */ onDestroy: () => (/* reexport safe */ _onDestroy__WEBPACK_IMPORTED_MODULE_18__.onDestroy),
|
|
3946
|
+
/* harmony export */ onInit: () => (/* reexport safe */ _onInit__WEBPACK_IMPORTED_MODULE_17__.onInit),
|
|
3947
|
+
/* harmony export */ providers: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_13__.providers),
|
|
3948
|
+
/* harmony export */ runBeforeRender: () => (/* reexport safe */ _tagRunner__WEBPACK_IMPORTED_MODULE_11__.runBeforeRender),
|
|
3949
|
+
/* harmony export */ set: () => (/* reexport safe */ _set_function__WEBPACK_IMPORTED_MODULE_14__.set),
|
|
3950
|
+
/* harmony export */ setLet: () => (/* reexport safe */ _setLet_function__WEBPACK_IMPORTED_MODULE_15__.setLet),
|
|
3951
|
+
/* harmony export */ setProp: () => (/* reexport safe */ _setProp_function__WEBPACK_IMPORTED_MODULE_16__.setProp),
|
|
3952
|
+
/* harmony export */ setUse: () => (/* reexport safe */ _setUse_function__WEBPACK_IMPORTED_MODULE_12__.setUse),
|
|
3583
3953
|
/* harmony export */ tag: () => (/* reexport safe */ _tag__WEBPACK_IMPORTED_MODULE_2__.tag),
|
|
3584
3954
|
/* harmony export */ tagElement: () => (/* reexport safe */ _tagElement__WEBPACK_IMPORTED_MODULE_0__.tagElement),
|
|
3585
3955
|
/* harmony export */ tags: () => (/* reexport safe */ _tag__WEBPACK_IMPORTED_MODULE_2__.tags),
|
|
3586
|
-
/* harmony export */ watch: () => (/* reexport safe */
|
|
3956
|
+
/* harmony export */ watch: () => (/* reexport safe */ _watch_function__WEBPACK_IMPORTED_MODULE_7__.watch),
|
|
3957
|
+
/* harmony export */ willCallback: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.willCallback),
|
|
3958
|
+
/* harmony export */ willPromise: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.willPromise),
|
|
3959
|
+
/* harmony export */ willSubscribe: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.willSubscribe)
|
|
3587
3960
|
/* harmony export */ });
|
|
3588
3961
|
/* harmony import */ var _tagElement__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tagElement */ "./ts/tagElement.ts");
|
|
3589
3962
|
/* harmony import */ var _ElementTargetEvent_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ElementTargetEvent.interface */ "./ts/ElementTargetEvent.interface.ts");
|
|
3590
3963
|
/* harmony import */ var _tag__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./tag */ "./ts/tag.ts");
|
|
3591
3964
|
/* harmony import */ var _html__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./html */ "./ts/html.ts");
|
|
3592
3965
|
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./errors */ "./ts/errors.ts");
|
|
3593
|
-
/* harmony import */ var
|
|
3966
|
+
/* harmony import */ var _subject_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./subject/index */ "./ts/subject/index.ts");
|
|
3594
3967
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
3595
|
-
/* harmony import */ var
|
|
3596
|
-
/* harmony import */ var
|
|
3597
|
-
/* harmony import */ var
|
|
3598
|
-
/* harmony import */ var
|
|
3599
|
-
/* harmony import */ var
|
|
3600
|
-
/* harmony import */ var
|
|
3601
|
-
/* harmony import */ var
|
|
3602
|
-
/* harmony import */ var
|
|
3603
|
-
/* harmony import */ var
|
|
3604
|
-
/* harmony import */ var
|
|
3605
|
-
/* harmony import */ var
|
|
3606
|
-
/* harmony import */ var
|
|
3607
|
-
/* harmony import */ var
|
|
3608
|
-
/* harmony import */ var _getCallback__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./getCallback */ "./ts/getCallback.ts");
|
|
3968
|
+
/* harmony import */ var _watch_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./watch.function */ "./ts/watch.function.ts");
|
|
3969
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3970
|
+
/* harmony import */ var _interpolateElement__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./interpolateElement */ "./ts/interpolateElement.ts");
|
|
3971
|
+
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Tag.class */ "./ts/Tag.class.ts");
|
|
3972
|
+
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
3973
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
3974
|
+
/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./providers */ "./ts/providers.ts");
|
|
3975
|
+
/* harmony import */ var _set_function__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./set.function */ "./ts/set.function.ts");
|
|
3976
|
+
/* harmony import */ var _setLet_function__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./setLet.function */ "./ts/setLet.function.ts");
|
|
3977
|
+
/* harmony import */ var _setProp_function__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./setProp.function */ "./ts/setProp.function.ts");
|
|
3978
|
+
/* harmony import */ var _onInit__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./onInit */ "./ts/onInit.ts");
|
|
3979
|
+
/* harmony import */ var _onDestroy__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./onDestroy */ "./ts/onDestroy.ts");
|
|
3980
|
+
/* harmony import */ var _getCallback__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./getCallback */ "./ts/getCallback.ts");
|
|
3609
3981
|
// import { redrawTag } from "./redrawTag.function"
|
|
3610
3982
|
|
|
3611
3983
|
|
|
@@ -3616,7 +3988,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3616
3988
|
|
|
3617
3989
|
|
|
3618
3990
|
|
|
3619
|
-
|
|
3620
3991
|
// export * from "./redrawTag.function"
|
|
3621
3992
|
|
|
3622
3993
|
// TODO: export *
|
|
@@ -3649,6 +4020,7 @@ var __webpack_exports__Tag = __webpack_exports__.Tag;
|
|
|
3649
4020
|
var __webpack_exports__TagError = __webpack_exports__.TagError;
|
|
3650
4021
|
var __webpack_exports__TagSupport = __webpack_exports__.TagSupport;
|
|
3651
4022
|
var __webpack_exports__ValueSubject = __webpack_exports__.ValueSubject;
|
|
4023
|
+
var __webpack_exports__combineLatest = __webpack_exports__.combineLatest;
|
|
3652
4024
|
var __webpack_exports__getCallback = __webpack_exports__.getCallback;
|
|
3653
4025
|
var __webpack_exports__hmr = __webpack_exports__.hmr;
|
|
3654
4026
|
var __webpack_exports__html = __webpack_exports__.html;
|
|
@@ -3670,6 +4042,9 @@ var __webpack_exports__tag = __webpack_exports__.tag;
|
|
|
3670
4042
|
var __webpack_exports__tagElement = __webpack_exports__.tagElement;
|
|
3671
4043
|
var __webpack_exports__tags = __webpack_exports__.tags;
|
|
3672
4044
|
var __webpack_exports__watch = __webpack_exports__.watch;
|
|
3673
|
-
|
|
4045
|
+
var __webpack_exports__willCallback = __webpack_exports__.willCallback;
|
|
4046
|
+
var __webpack_exports__willPromise = __webpack_exports__.willPromise;
|
|
4047
|
+
var __webpack_exports__willSubscribe = __webpack_exports__.willSubscribe;
|
|
4048
|
+
export { __webpack_exports__ArrayNoKeyError as ArrayNoKeyError, __webpack_exports__BaseTagSupport as BaseTagSupport, __webpack_exports__StateMismatchError as StateMismatchError, __webpack_exports__Subject as Subject, __webpack_exports__Tag as Tag, __webpack_exports__TagError as TagError, __webpack_exports__TagSupport as TagSupport, __webpack_exports__ValueSubject as ValueSubject, __webpack_exports__combineLatest as combineLatest, __webpack_exports__getCallback as getCallback, __webpack_exports__hmr as hmr, __webpack_exports__html as html, __webpack_exports__interpolateElement as interpolateElement, __webpack_exports__interpolateString as interpolateString, __webpack_exports__isSubjectInstance as isSubjectInstance, __webpack_exports__isTagArray as isTagArray, __webpack_exports__isTagComponent as isTagComponent, __webpack_exports__isTagInstance as isTagInstance, __webpack_exports__onDestroy as onDestroy, __webpack_exports__onInit as onInit, __webpack_exports__providers as providers, __webpack_exports__runBeforeRender as runBeforeRender, __webpack_exports__set as set, __webpack_exports__setLet as setLet, __webpack_exports__setProp as setProp, __webpack_exports__setUse as setUse, __webpack_exports__tag as tag, __webpack_exports__tagElement as tagElement, __webpack_exports__tags as tags, __webpack_exports__watch as watch, __webpack_exports__willCallback as willCallback, __webpack_exports__willPromise as willPromise, __webpack_exports__willSubscribe as willSubscribe };
|
|
3674
4049
|
|
|
3675
4050
|
//# sourceMappingURL=bundle.js.map
|