taggedjs 2.4.2 → 2.4.12
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 +3612 -0
- package/bundle.js.map +1 -0
- package/index.js +1 -1
- package/js/Subject.d.ts +3 -4
- package/js/Subject.js +4 -4
- package/js/Subject.js.map +1 -1
- package/js/Tag.class.d.ts +25 -17
- package/js/Tag.class.js +208 -78
- package/js/Tag.class.js.map +1 -1
- package/js/Tag.utils.d.ts +13 -13
- package/js/Tag.utils.js +2 -18
- package/js/Tag.utils.js.map +1 -1
- package/js/TagSupport.class.d.ts +15 -14
- package/js/TagSupport.class.js +24 -46
- package/js/TagSupport.class.js.map +1 -1
- package/js/TemplaterResult.class.d.ts +36 -0
- package/js/TemplaterResult.class.js +73 -0
- package/js/TemplaterResult.class.js.map +1 -0
- package/js/ValueSubject.d.ts +4 -2
- package/js/ValueSubject.js +1 -1
- package/js/ValueSubject.js.map +1 -1
- package/js/alterProps.function.d.ts +4 -0
- package/js/alterProps.function.js +45 -0
- package/js/alterProps.function.js.map +1 -0
- package/js/bindSubjectCallback.function 9.27.33/342/200/257AM.js" +32 -0
- package/js/bindSubjectCallback.function.d 9.27.33/342/200/257AM.ts" +8 -0
- package/js/bindSubjectCallback.function.d.ts +3 -4
- package/js/bindSubjectCallback.function.js +20 -8
- package/js/bindSubjectCallback.function.js.map +1 -1
- package/js/checkDestroyPrevious.function.d.ts +6 -0
- package/js/checkDestroyPrevious.function.js +62 -0
- package/js/checkDestroyPrevious.function.js.map +1 -0
- package/js/destroyTag.function.d.ts +5 -0
- package/js/destroyTag.function.js +18 -0
- package/js/destroyTag.function.js.map +1 -0
- package/js/elementInitCheck.d.ts +1 -1
- package/js/getCallback.d.ts +1 -1
- package/js/getCallback.js +16 -15
- package/js/getCallback.js.map +1 -1
- package/js/hasTagSupportChanged.function.d.ts +6 -6
- package/js/hasTagSupportChanged.function.js +30 -21
- package/js/hasTagSupportChanged.function.js.map +1 -1
- package/js/html.d.ts +1 -1
- package/js/html.js +1 -1
- package/js/html.js.map +1 -1
- package/js/index.d.ts +22 -27
- package/js/index.js +26 -27
- package/js/index.js.map +1 -1
- package/js/interpolateAttributes.d.ts +2 -3
- package/js/interpolateAttributes.js +1 -127
- package/js/interpolateAttributes.js.map +1 -1
- package/js/interpolateContentTemplates.d.ts +9 -6
- package/js/interpolateContentTemplates.js +18 -28
- package/js/interpolateContentTemplates.js.map +1 -1
- package/js/interpolateElement.d.ts +7 -6
- package/js/interpolateElement.js +13 -10
- package/js/interpolateElement.js.map +1 -1
- package/js/interpolateTemplate.d.ts +22 -7
- package/js/interpolateTemplate.js +65 -27
- package/js/interpolateTemplate.js.map +1 -1
- package/js/isInstance.d.ts +3 -4
- package/js/isInstance.js.map +1 -1
- package/js/isLikeTags.function.d.ts +2 -0
- package/js/isLikeTags.function.js +30 -0
- package/js/isLikeTags.function.js.map +1 -0
- package/js/onDestroy.js +3 -3
- package/js/onDestroy.js.map +1 -1
- package/js/onInit.js +6 -4
- package/js/onInit.js.map +1 -1
- package/js/processAttribute.function.d.ts +3 -0
- package/js/processAttribute.function.js +122 -0
- package/js/processAttribute.function.js.map +1 -0
- package/js/processNewValue.function.d.ts +2 -2
- package/js/processNewValue.function.js +13 -15
- package/js/processNewValue.function.js.map +1 -1
- package/js/processRegularValue.function.d.ts +5 -7
- package/js/processRegularValue.function.js +10 -17
- package/js/processRegularValue.function.js.map +1 -1
- package/js/processSubjectComponent.function.d.ts +6 -6
- package/js/processSubjectComponent.function.js +30 -22
- package/js/processSubjectComponent.function.js.map +1 -1
- package/js/processSubjectValue.function.d.ts +17 -14
- package/js/processSubjectValue.function.js +55 -79
- package/js/processSubjectValue.function.js.map +1 -1
- package/js/processTagArray.d.ts +9 -8
- package/js/processTagArray.js +36 -37
- package/js/processTagArray.js.map +1 -1
- package/js/processTagResult.function.d.ts +7 -8
- package/js/processTagResult.function.js +40 -17
- package/js/processTagResult.function.js.map +1 -1
- package/js/provider.utils.d.ts +1 -1
- package/js/provider.utils.js +19 -8
- package/js/provider.utils.js.map +1 -1
- package/js/providers.js +6 -6
- package/js/providers.js.map +1 -1
- package/js/redrawTag.function.d.ts +5 -8
- package/js/redrawTag.function.js +16 -4
- package/js/redrawTag.function.js.map +1 -1
- package/js/render.d.ts +1 -1
- package/js/render.js.map +1 -1
- package/js/renderExistingTag.function.d.ts +7 -0
- package/js/renderExistingTag.function.js +30 -0
- package/js/renderExistingTag.function.js.map +1 -0
- package/js/renderTagSupport.function.d.ts +4 -0
- package/js/renderTagSupport.function.js +42 -0
- package/js/renderTagSupport.function.js.map +1 -0
- package/js/scanTextAreaValue.function.d.ts +2 -0
- package/js/scanTextAreaValue.function.js +16 -0
- package/js/scanTextAreaValue.function.js.map +1 -0
- package/js/set.function.d.ts +4 -3
- package/js/set.function.js +25 -34
- package/js/set.function.js.map +1 -1
- package/js/setLet.function.d.ts +1 -1
- package/js/setLet.function.js +14 -3
- package/js/setLet.function.js.map +1 -1
- package/js/setProp.function.d.ts +1 -1
- package/js/setProp.function.js +6 -3
- package/js/setProp.function.js.map +1 -1
- package/js/setUse.function.d.ts +11 -11
- package/js/tag.d.ts +6 -4
- package/js/tag.js +78 -71
- package/js/tag.js.map +1 -1
- package/js/tagElement.d.ts +5 -7
- package/js/tagElement.js +20 -31
- package/js/tagElement.js.map +1 -1
- package/js/tagRunner.d.ts +6 -6
- package/js/tagRunner.js +1 -1
- package/js/tagRunner.js.map +1 -1
- package/js/templater.utils.d.ts +23 -12
- package/js/templater.utils.js +55 -40
- package/js/templater.utils.js.map +1 -1
- package/js/updateExistingTag.function.d.ts +4 -4
- package/js/updateExistingTag.function.js +16 -7
- package/js/updateExistingTag.function.js.map +1 -1
- package/js/updateExistingTagComponent.function.d.ts +4 -4
- package/js/updateExistingTagComponent.function.js +105 -39
- package/js/updateExistingTagComponent.function.js.map +1 -1
- package/js/updateExistingValue.function.d.ts +8 -10
- package/js/updateExistingValue.function.js +62 -89
- package/js/updateExistingValue.function.js.map +1 -1
- package/js/watch.function.js +4 -3
- package/js/watch.function.js.map +1 -1
- package/package.json +1 -2
- package/js/CustomError.d.ts +0 -7
- package/js/CustomError.js +0 -9
- package/js/CustomError.js.map +0 -1
- package/js/ElementTarget.interface.d.ts +0 -7
- package/js/ElementTarget.interface.js +0 -2
- package/js/ElementTarget.interface.js.map +0 -1
- package/js/Errors2.d.ts +0 -14
- package/js/Errors2.js +0 -21
- package/js/Errors2.js.map +0 -1
- package/js/gateway/gateway.web.component.d.ts +0 -11
- package/js/gateway/gateway.web.component.js +0 -20
- package/js/gateway/gateway.web.component.js.map +0 -1
- package/js/gateway/index.d.ts +0 -3
- package/js/gateway/index.js +0 -4
- package/js/gateway/index.js.map +0 -1
- package/js/gateway/loadTagGateway.function.d.ts +0 -2
- package/js/gateway/loadTagGateway.function.js +0 -18
- package/js/gateway/loadTagGateway.function.js.map +0 -1
- package/js/gateway/tagGateway.function.d.ts +0 -5
- package/js/gateway/tagGateway.function.js +0 -49
- package/js/gateway/tagGateway.function.js.map +0 -1
- package/js/gateway/tagGateway.utils.d.ts +0 -22
- package/js/gateway/tagGateway.utils.js +0 -137
- package/js/gateway/tagGateway.utils.js.map +0 -1
- package/js/getTagSupport.d.ts +0 -20
- package/js/getTagSupport.js +0 -114
- package/js/getTagSupport.js.map +0 -1
- package/js/renderAppToElement.d.ts +0 -14
- package/js/renderAppToElement.js +0 -57
- package/js/renderAppToElement.js.map +0 -1
- package/js/state.d.ts +0 -22
- package/js/state.js +0 -128
- package/js/state.js.map +0 -1
- package/js/tagGateway.function.d.ts +0 -14
- package/js/tagGateway.function.js +0 -138
- package/js/tagGateway.function.js.map +0 -1
- package/js/updateTag.utils.d.ts +0 -8
- package/js/updateTag.utils.js +0 -83
- package/js/updateTag.utils.js.map +0 -1
- package/taggedjs.js +0 -1
- /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
ADDED
|
@@ -0,0 +1,3612 @@
|
|
|
1
|
+
/******/ var __webpack_modules__ = ({
|
|
2
|
+
|
|
3
|
+
/***/ "./ts/ElementTargetEvent.interface.ts":
|
|
4
|
+
/*!********************************************!*\
|
|
5
|
+
!*** ./ts/ElementTargetEvent.interface.ts ***!
|
|
6
|
+
\********************************************/
|
|
7
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
+
|
|
9
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/***/ }),
|
|
14
|
+
|
|
15
|
+
/***/ "./ts/Subject.ts":
|
|
16
|
+
/*!***********************!*\
|
|
17
|
+
!*** ./ts/Subject.ts ***!
|
|
18
|
+
\***********************/
|
|
19
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20
|
+
|
|
21
|
+
__webpack_require__.r(__webpack_exports__);
|
|
22
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
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);
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
/***/ }),
|
|
74
|
+
|
|
75
|
+
/***/ "./ts/Tag.class.ts":
|
|
76
|
+
/*!*************************!*\
|
|
77
|
+
!*** ./ts/Tag.class.ts ***!
|
|
78
|
+
\*************************/
|
|
79
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
80
|
+
|
|
81
|
+
__webpack_require__.r(__webpack_exports__);
|
|
82
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
83
|
+
/* harmony export */ ArrayValueNeverSet: () => (/* binding */ ArrayValueNeverSet),
|
|
84
|
+
/* harmony export */ Tag: () => (/* binding */ Tag),
|
|
85
|
+
/* harmony export */ escapeSearch: () => (/* binding */ escapeSearch),
|
|
86
|
+
/* harmony export */ escapeVariable: () => (/* binding */ escapeVariable),
|
|
87
|
+
/* harmony export */ variablePrefix: () => (/* binding */ variablePrefix)
|
|
88
|
+
/* harmony export */ });
|
|
89
|
+
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
90
|
+
/* harmony import */ var _render__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./render */ "./ts/render.ts");
|
|
91
|
+
/* harmony import */ var _interpolateElement__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interpolateElement */ "./ts/interpolateElement.ts");
|
|
92
|
+
/* harmony import */ var _interpolateTemplate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./interpolateTemplate */ "./ts/interpolateTemplate.ts");
|
|
93
|
+
/* harmony import */ var _elementDestroyCheck_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./elementDestroyCheck.function */ "./ts/elementDestroyCheck.function.ts");
|
|
94
|
+
/* harmony import */ var _processNewValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./processNewValue.function */ "./ts/processNewValue.function.ts");
|
|
95
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
96
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
const variablePrefix = '__tagvar';
|
|
106
|
+
const escapeVariable = '--' + variablePrefix + '--';
|
|
107
|
+
const prefixSearch = new RegExp(variablePrefix, 'g');
|
|
108
|
+
const escapeSearch = new RegExp(escapeVariable, 'g');
|
|
109
|
+
class ArrayValueNeverSet {
|
|
110
|
+
isArrayValueNeverSet = true;
|
|
111
|
+
}
|
|
112
|
+
class Tag {
|
|
113
|
+
strings;
|
|
114
|
+
values;
|
|
115
|
+
version = 0;
|
|
116
|
+
isTag = true;
|
|
117
|
+
hasLiveElements = false;
|
|
118
|
+
clones = []; // elements on document. Needed at destroy process to know what to destroy
|
|
119
|
+
cloneSubs = []; // subscriptions created by clones
|
|
120
|
+
childTags = []; // tags on me
|
|
121
|
+
tagSupport;
|
|
122
|
+
lastTemplateString = undefined; // used to compare templates for updates
|
|
123
|
+
// only present when a child of a tag
|
|
124
|
+
ownerTag;
|
|
125
|
+
// insertBefore?: Element
|
|
126
|
+
appElement; // only seen on this.getAppElement().appElement
|
|
127
|
+
// present only when an array. Populated by this.key()
|
|
128
|
+
arrayValue = new ArrayValueNeverSet();
|
|
129
|
+
constructor(strings, values) {
|
|
130
|
+
this.strings = strings;
|
|
131
|
+
this.values = values;
|
|
132
|
+
}
|
|
133
|
+
/** Used for array, such as array.map(), calls aka array.map(x => html``.key(x)) */
|
|
134
|
+
key(arrayValue) {
|
|
135
|
+
this.arrayValue = arrayValue;
|
|
136
|
+
return this;
|
|
137
|
+
}
|
|
138
|
+
destroy(options = {
|
|
139
|
+
stagger: 0,
|
|
140
|
+
byParent: false, // Only destroy clones of direct children
|
|
141
|
+
}) {
|
|
142
|
+
if (!this.hasLiveElements) {
|
|
143
|
+
throw new Error('destroying wrong tag');
|
|
144
|
+
}
|
|
145
|
+
const tagSupport = this.tagSupport;
|
|
146
|
+
const global = tagSupport.templater.global;
|
|
147
|
+
// removing is considered rendering. Prevents after event processing of this tag even tho possibly deleted
|
|
148
|
+
// ++this.tagSupport.templater.global.renderCount
|
|
149
|
+
// the isComponent check maybe able to be removed
|
|
150
|
+
const isComponent = tagSupport ? true : false;
|
|
151
|
+
if (isComponent) {
|
|
152
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runBeforeDestroy)(tagSupport, this);
|
|
153
|
+
}
|
|
154
|
+
const childTags = options.byParent ? [] : getChildTagsToDestroy(this.childTags);
|
|
155
|
+
// signify that no further event rendering should take place by making logic think a render occurred during event
|
|
156
|
+
// childTags.forEach(child => ++child.tagSupport.templater.global.renderCount)
|
|
157
|
+
// signify immediately child has been deleted (looked for during event processing)
|
|
158
|
+
childTags.forEach(child => {
|
|
159
|
+
const subGlobal = child.tagSupport.templater.global;
|
|
160
|
+
delete subGlobal.newest;
|
|
161
|
+
subGlobal.deleted = true;
|
|
162
|
+
});
|
|
163
|
+
delete global.oldest;
|
|
164
|
+
delete global.newest;
|
|
165
|
+
global.deleted = true;
|
|
166
|
+
this.hasLiveElements = false;
|
|
167
|
+
delete tagSupport.subject.tag;
|
|
168
|
+
this.destroySubscriptions();
|
|
169
|
+
let mainPromise;
|
|
170
|
+
if (this.ownerTag) {
|
|
171
|
+
this.ownerTag.childTags = this.ownerTag.childTags.filter(child => child !== this);
|
|
172
|
+
}
|
|
173
|
+
if (!options.byParent) {
|
|
174
|
+
const { stagger, promise } = this.destroyClones(options);
|
|
175
|
+
options.stagger = stagger;
|
|
176
|
+
if (promise) {
|
|
177
|
+
mainPromise = promise;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
this.destroyClones();
|
|
182
|
+
}
|
|
183
|
+
if (mainPromise) {
|
|
184
|
+
mainPromise = mainPromise.then(async () => {
|
|
185
|
+
const promises = childTags.map(kid => kid.destroy({ stagger: 0, byParent: true }));
|
|
186
|
+
return Promise.all(promises);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
mainPromise = Promise.all(childTags.map(kid => kid.destroy({ stagger: 0, byParent: true })));
|
|
191
|
+
}
|
|
192
|
+
return mainPromise.then(() => options.stagger);
|
|
193
|
+
}
|
|
194
|
+
destroySubscriptions() {
|
|
195
|
+
this.cloneSubs.forEach(cloneSub => cloneSub.unsubscribe());
|
|
196
|
+
this.cloneSubs.length = 0;
|
|
197
|
+
}
|
|
198
|
+
destroyClones({ stagger } = {
|
|
199
|
+
stagger: 0,
|
|
200
|
+
}) {
|
|
201
|
+
//const promises = this.clones.reverse().map(
|
|
202
|
+
const promises = this.clones.map(clone => this.checkCloneRemoval(clone, stagger)).filter(x => x); // only return promises
|
|
203
|
+
this.clones.length = 0; // tag maybe used for something else
|
|
204
|
+
if (promises.length) {
|
|
205
|
+
return { promise: Promise.all(promises), stagger };
|
|
206
|
+
}
|
|
207
|
+
return { stagger };
|
|
208
|
+
}
|
|
209
|
+
checkCloneRemoval(clone, stagger) {
|
|
210
|
+
let promise;
|
|
211
|
+
const customElm = clone;
|
|
212
|
+
if (customElm.ondestroy) {
|
|
213
|
+
promise = (0,_elementDestroyCheck_function__WEBPACK_IMPORTED_MODULE_4__.elementDestroyCheck)(customElm, stagger);
|
|
214
|
+
}
|
|
215
|
+
const next = () => {
|
|
216
|
+
clone.parentNode?.removeChild(clone);
|
|
217
|
+
const ownerTag = this.ownerTag;
|
|
218
|
+
if (ownerTag) {
|
|
219
|
+
// Sometimes my clones were first registered to my owner, remove them from owner
|
|
220
|
+
ownerTag.clones = ownerTag.clones.filter(compareClone => compareClone !== clone);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
if (promise instanceof Promise) {
|
|
224
|
+
return promise.then(next);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
next();
|
|
228
|
+
}
|
|
229
|
+
return promise;
|
|
230
|
+
}
|
|
231
|
+
getTemplate() {
|
|
232
|
+
const string = this.strings.map((string, index) => {
|
|
233
|
+
const safeString = string.replace(prefixSearch, escapeVariable);
|
|
234
|
+
const endString = safeString + (this.values.length > index ? `{${variablePrefix}${index}}` : '');
|
|
235
|
+
// const trimString = index === 0 || index === this.strings.length-1 ? endString.trim() : endString
|
|
236
|
+
const trimString = endString.replace(/>\s*/g, '>').replace(/\s*</g, '<');
|
|
237
|
+
return trimString;
|
|
238
|
+
}).join('');
|
|
239
|
+
const interpolation = (0,_interpolateElement__WEBPACK_IMPORTED_MODULE_2__.interpolateString)(string);
|
|
240
|
+
this.lastTemplateString = interpolation.string;
|
|
241
|
+
return {
|
|
242
|
+
interpolation,
|
|
243
|
+
// string,
|
|
244
|
+
string: interpolation.string,
|
|
245
|
+
strings: this.strings,
|
|
246
|
+
values: this.values,
|
|
247
|
+
context: this.tagSupport.templater.global.context || {},
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
isLikeTag(tag) {
|
|
251
|
+
return (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_7__.isLikeTags)(this, tag);
|
|
252
|
+
const { string } = tag.getTemplate();
|
|
253
|
+
// TODO: most likely remove?
|
|
254
|
+
if (!this.lastTemplateString) {
|
|
255
|
+
throw new Error('no template here');
|
|
256
|
+
}
|
|
257
|
+
const stringMatched = string === this.lastTemplateString;
|
|
258
|
+
if (!stringMatched || tag.values.length !== this.values.length) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
const allVarsMatch = tag.values.every((value, index) => {
|
|
262
|
+
const compareTo = this.values[index];
|
|
263
|
+
const isFunctions = value instanceof Function && compareTo instanceof Function;
|
|
264
|
+
if (isFunctions) {
|
|
265
|
+
const stringMatch = value.toString() === compareTo.toString();
|
|
266
|
+
if (stringMatch) {
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
return true;
|
|
272
|
+
});
|
|
273
|
+
if (allVarsMatch) {
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
updateByTag(tag) {
|
|
279
|
+
if (!this.tagSupport.templater.global.oldest) {
|
|
280
|
+
throw new Error('no oldest here');
|
|
281
|
+
}
|
|
282
|
+
if (!this.hasLiveElements) {
|
|
283
|
+
throw new Error('trying to update a tag with no elements on stage');
|
|
284
|
+
}
|
|
285
|
+
this.tagSupport.templater.global.newest = tag;
|
|
286
|
+
if (!this.tagSupport.templater.global.context) {
|
|
287
|
+
throw new Error('issue back here');
|
|
288
|
+
}
|
|
289
|
+
this.updateConfig(tag.strings, tag.values);
|
|
290
|
+
}
|
|
291
|
+
updateConfig(strings, values) {
|
|
292
|
+
this.strings = strings;
|
|
293
|
+
this.updateValues(values);
|
|
294
|
+
}
|
|
295
|
+
update() {
|
|
296
|
+
return this.updateContext(this.tagSupport.templater.global.context);
|
|
297
|
+
}
|
|
298
|
+
updateValues(values) {
|
|
299
|
+
this.values = values;
|
|
300
|
+
return this.updateContext(this.tagSupport.templater.global.context);
|
|
301
|
+
}
|
|
302
|
+
updateContext(context) {
|
|
303
|
+
this.strings.map((_string, index) => {
|
|
304
|
+
const variableName = variablePrefix + index;
|
|
305
|
+
const hasValue = this.values.length > index;
|
|
306
|
+
const value = this.values[index];
|
|
307
|
+
// is something already there?
|
|
308
|
+
const exists = variableName in context;
|
|
309
|
+
if (exists) {
|
|
310
|
+
return updateContextItem(context, variableName, value);
|
|
311
|
+
}
|
|
312
|
+
if (!hasValue) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
// 🆕 First time values below
|
|
316
|
+
context[variableName] = (0,_processNewValue_function__WEBPACK_IMPORTED_MODULE_5__.processNewValue)(hasValue, value, this);
|
|
317
|
+
});
|
|
318
|
+
return context;
|
|
319
|
+
}
|
|
320
|
+
getAppElement() {
|
|
321
|
+
let tag = this;
|
|
322
|
+
while (tag.ownerTag) {
|
|
323
|
+
tag = tag.ownerTag;
|
|
324
|
+
}
|
|
325
|
+
return tag;
|
|
326
|
+
}
|
|
327
|
+
/** Used during HMR only where static content itself could have been edited */
|
|
328
|
+
rebuild() {
|
|
329
|
+
// const insertBefore = this.insertBefore
|
|
330
|
+
const insertBefore = this.tagSupport.templater.global.insertBefore;
|
|
331
|
+
if (!insertBefore) {
|
|
332
|
+
const err = new Error('Cannot rebuild. Previous insertBefore element is not defined on tag');
|
|
333
|
+
err.tag = this;
|
|
334
|
+
throw err;
|
|
335
|
+
}
|
|
336
|
+
this.buildBeforeElement(insertBefore, {
|
|
337
|
+
forceElement: true,
|
|
338
|
+
counts: { added: 0, removed: 0 }, test: false,
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
buildBeforeElement(insertBefore, options = {
|
|
342
|
+
forceElement: false,
|
|
343
|
+
counts: { added: 0, removed: 0 },
|
|
344
|
+
test: false
|
|
345
|
+
}) {
|
|
346
|
+
if (!insertBefore.parentNode) {
|
|
347
|
+
throw new Error('no parent before removing clones');
|
|
348
|
+
}
|
|
349
|
+
this.tagSupport.templater.global.oldest = this;
|
|
350
|
+
this.tagSupport.templater.global.newest = this;
|
|
351
|
+
this.tagSupport.subject.tag = this;
|
|
352
|
+
this.hasLiveElements = true;
|
|
353
|
+
// remove old clones
|
|
354
|
+
if (this.clones.length) {
|
|
355
|
+
this.clones.forEach(clone => this.checkCloneRemoval(clone, 0));
|
|
356
|
+
}
|
|
357
|
+
// this.insertBefore = insertBefore
|
|
358
|
+
this.tagSupport.templater.global.insertBefore = insertBefore;
|
|
359
|
+
// const context = this.tagSupport.memory.context // this.update()
|
|
360
|
+
const context = this.update();
|
|
361
|
+
const template = this.getTemplate();
|
|
362
|
+
if (!insertBefore.parentNode) {
|
|
363
|
+
throw new Error('no parent before building tag');
|
|
364
|
+
}
|
|
365
|
+
const elementContainer = document.createElement('div');
|
|
366
|
+
elementContainer.id = 'tag-temp-holder';
|
|
367
|
+
// render content with a first child that we can know is our first element
|
|
368
|
+
elementContainer.innerHTML = `<template id="temp-template-tag-wrap">${template.string}</template>`;
|
|
369
|
+
// Search/replace innerHTML variables but don't interpolate tag components just yet
|
|
370
|
+
const { tagComponents } = (0,_interpolateElement__WEBPACK_IMPORTED_MODULE_2__.interpolateElement)(elementContainer, context, template, this, // ownerTag,
|
|
371
|
+
{
|
|
372
|
+
forceElement: options.forceElement,
|
|
373
|
+
counts: options.counts
|
|
374
|
+
}, options.test);
|
|
375
|
+
if (!insertBefore.parentNode) {
|
|
376
|
+
throw new Error('no parent building tag');
|
|
377
|
+
}
|
|
378
|
+
afterInterpolateElement(elementContainer, insertBefore, this, // ownerTag
|
|
379
|
+
context, options);
|
|
380
|
+
// this.clones.push(...clones)
|
|
381
|
+
// Any tag components that were found should be processed AFTER the owner processes its elements. Avoid double processing of elements attributes like (oninit)=${}
|
|
382
|
+
let isForceElement = options.forceElement;
|
|
383
|
+
tagComponents.forEach(tagComponent => {
|
|
384
|
+
// const preClones = this.clones.map(clone => clone)
|
|
385
|
+
(0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_3__.subscribeToTemplate)(tagComponent.insertBefore, // temporary,
|
|
386
|
+
tagComponent.subject, tagComponent.ownerTag, options.counts, { isForceElement });
|
|
387
|
+
if (!insertBefore.parentNode) {
|
|
388
|
+
throw new Error('no parent building tag components');
|
|
389
|
+
}
|
|
390
|
+
afterInterpolateElement(elementContainer, insertBefore, this, context, options);
|
|
391
|
+
// remove component clones from ownerTag as they will belong to the components they live on
|
|
392
|
+
/*
|
|
393
|
+
if( preClones.length ) {
|
|
394
|
+
this.clones = this.clones.filter(cloneFilter => !preClones.find(clone => clone === cloneFilter))
|
|
395
|
+
}
|
|
396
|
+
*/
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
function afterInterpolateElement(container, insertBefore, ownerTag,
|
|
401
|
+
// preClones: Clones,
|
|
402
|
+
context, options) {
|
|
403
|
+
const clones = (0,_render__WEBPACK_IMPORTED_MODULE_1__.buildClones)(container, insertBefore);
|
|
404
|
+
ownerTag.clones.push(...clones);
|
|
405
|
+
clones.forEach(clone => (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_3__.afterElmBuild)(clone, options, context, ownerTag));
|
|
406
|
+
return clones;
|
|
407
|
+
}
|
|
408
|
+
function getChildTagsToDestroy(childTags, allTags = []) {
|
|
409
|
+
for (let index = childTags.length - 1; index >= 0; --index) {
|
|
410
|
+
const cTag = childTags[index];
|
|
411
|
+
if (allTags.find(x => x === cTag)) {
|
|
412
|
+
// TODO: Lets find why a child tag is attached twice to owner
|
|
413
|
+
throw new Error('child tag registered twice for delete');
|
|
414
|
+
}
|
|
415
|
+
allTags.push(cTag);
|
|
416
|
+
childTags.splice(index, 1);
|
|
417
|
+
getChildTagsToDestroy(cTag.childTags, allTags);
|
|
418
|
+
}
|
|
419
|
+
return allTags;
|
|
420
|
+
}
|
|
421
|
+
function updateContextItem(context, variableName, value) {
|
|
422
|
+
const subject = context[variableName];
|
|
423
|
+
const tag = subject.tag;
|
|
424
|
+
if (tag) {
|
|
425
|
+
const oldTemp = tag.tagSupport.templater;
|
|
426
|
+
const oldWrap = oldTemp.wrapper; // tag versus component
|
|
427
|
+
if (value.global !== oldTemp.global) {
|
|
428
|
+
if (oldWrap && (0,_isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagComponent)(value)) {
|
|
429
|
+
const oldValueFn = oldWrap.original;
|
|
430
|
+
const newValueFn = value.wrapper?.original;
|
|
431
|
+
const fnMatched = oldValueFn === newValueFn;
|
|
432
|
+
if (fnMatched) {
|
|
433
|
+
value.global = oldTemp.global;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
// return updateExistingValue(subject, value, this)
|
|
439
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_6__.isSubjectInstance)(value)) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
subject.set(value); // listeners will evaluate updated values to possibly update display(s)
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
/***/ }),
|
|
448
|
+
|
|
449
|
+
/***/ "./ts/TagSupport.class.ts":
|
|
450
|
+
/*!********************************!*\
|
|
451
|
+
!*** ./ts/TagSupport.class.ts ***!
|
|
452
|
+
\********************************/
|
|
453
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
454
|
+
|
|
455
|
+
__webpack_require__.r(__webpack_exports__);
|
|
456
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
457
|
+
/* harmony export */ BaseTagSupport: () => (/* binding */ BaseTagSupport),
|
|
458
|
+
/* harmony export */ TagSupport: () => (/* binding */ TagSupport)
|
|
459
|
+
/* harmony export */ });
|
|
460
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
461
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
class BaseTagSupport {
|
|
465
|
+
templater;
|
|
466
|
+
subject;
|
|
467
|
+
isApp = true;
|
|
468
|
+
propsConfig;
|
|
469
|
+
memory = {
|
|
470
|
+
// context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}
|
|
471
|
+
state: {
|
|
472
|
+
newest: [],
|
|
473
|
+
},
|
|
474
|
+
};
|
|
475
|
+
constructor(templater, subject) {
|
|
476
|
+
this.templater = templater;
|
|
477
|
+
this.subject = subject;
|
|
478
|
+
const children = this.templater.children; // children tags passed in as arguments
|
|
479
|
+
const props = this.templater.props; // natural props
|
|
480
|
+
const latestCloned = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(props); // alterProps(props, templater)
|
|
481
|
+
this.propsConfig = {
|
|
482
|
+
latest: props,
|
|
483
|
+
latestCloned, // assume its HTML children and then detect
|
|
484
|
+
clonedProps: latestCloned, // maybe duplicate
|
|
485
|
+
lastClonedKidValues: children.value.map(kid => {
|
|
486
|
+
const cloneValues = cloneValueArray(kid.values);
|
|
487
|
+
return cloneValues;
|
|
488
|
+
})
|
|
489
|
+
};
|
|
490
|
+
// if the latest props are not HTML children, then clone the props for later render cycles to compare
|
|
491
|
+
if (!(0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagInstance)(props)) {
|
|
492
|
+
this.propsConfig.latestCloned = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(latestCloned);
|
|
493
|
+
this.propsConfig.clonedProps = this.propsConfig.latestCloned;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
function cloneValueArray(values) {
|
|
498
|
+
return values.map((value) => {
|
|
499
|
+
const tag = value;
|
|
500
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagInstance)(tag)) {
|
|
501
|
+
return cloneValueArray(tag.values);
|
|
502
|
+
}
|
|
503
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(tag)) {
|
|
504
|
+
const tagComponent = tag;
|
|
505
|
+
return (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(tagComponent.props);
|
|
506
|
+
}
|
|
507
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagArray)(tag)) {
|
|
508
|
+
return cloneValueArray(tag);
|
|
509
|
+
}
|
|
510
|
+
return (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(value);
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
class TagSupport extends BaseTagSupport {
|
|
514
|
+
ownerTagSupport;
|
|
515
|
+
templater;
|
|
516
|
+
subject;
|
|
517
|
+
isApp = false;
|
|
518
|
+
constructor(ownerTagSupport, templater, subject) {
|
|
519
|
+
super(templater, subject);
|
|
520
|
+
this.ownerTagSupport = ownerTagSupport;
|
|
521
|
+
this.templater = templater;
|
|
522
|
+
this.subject = subject;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
/***/ }),
|
|
528
|
+
|
|
529
|
+
/***/ "./ts/TemplaterResult.class.ts":
|
|
530
|
+
/*!*************************************!*\
|
|
531
|
+
!*** ./ts/TemplaterResult.class.ts ***!
|
|
532
|
+
\*************************************/
|
|
533
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
534
|
+
|
|
535
|
+
__webpack_require__.r(__webpack_exports__);
|
|
536
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
537
|
+
/* harmony export */ TemplaterResult: () => (/* binding */ TemplaterResult),
|
|
538
|
+
/* harmony export */ renderWithSupport: () => (/* binding */ renderWithSupport)
|
|
539
|
+
/* harmony export */ });
|
|
540
|
+
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
541
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
542
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
543
|
+
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
class TemplaterResult {
|
|
549
|
+
props;
|
|
550
|
+
children;
|
|
551
|
+
isTag = false; // when true, is basic tag non-component
|
|
552
|
+
tagged;
|
|
553
|
+
wrapper;
|
|
554
|
+
global = {
|
|
555
|
+
newestTemplater: this,
|
|
556
|
+
context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}
|
|
557
|
+
providers: [],
|
|
558
|
+
/** Indicator of re-rending. Saves from double rending something already rendered */
|
|
559
|
+
renderCount: 0,
|
|
560
|
+
deleted: false
|
|
561
|
+
};
|
|
562
|
+
tagSupport;
|
|
563
|
+
constructor(props, children) {
|
|
564
|
+
this.props = props;
|
|
565
|
+
this.children = children;
|
|
566
|
+
}
|
|
567
|
+
/*
|
|
568
|
+
redraw?: (
|
|
569
|
+
force?: boolean, // force children to redraw
|
|
570
|
+
) => Tag
|
|
571
|
+
*/
|
|
572
|
+
isTemplater = true;
|
|
573
|
+
}
|
|
574
|
+
function renderWithSupport(tagSupport, existingTag, subject, ownerTag) {
|
|
575
|
+
const wrapTagSupport = tagSupport; // this.tagSupport
|
|
576
|
+
/* BEFORE RENDER */
|
|
577
|
+
const runtimeOwnerTag = existingTag?.ownerTag || ownerTag;
|
|
578
|
+
if (existingTag) {
|
|
579
|
+
wrapTagSupport.memory.state.newest = [...existingTag.tagSupport.memory.state.newest];
|
|
580
|
+
wrapTagSupport.templater.global = existingTag.tagSupport.templater.global;
|
|
581
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runBeforeRedraw)(wrapTagSupport, existingTag);
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
if (!wrapTagSupport) {
|
|
585
|
+
throw new Error('63521');
|
|
586
|
+
}
|
|
587
|
+
// first time render
|
|
588
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runBeforeRender)(wrapTagSupport, runtimeOwnerTag);
|
|
589
|
+
// TODO: Logic below most likely could live within providers.ts inside the runBeforeRender function
|
|
590
|
+
const providers = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
591
|
+
providers.ownerTag = runtimeOwnerTag;
|
|
592
|
+
}
|
|
593
|
+
/* END: BEFORE RENDER */
|
|
594
|
+
const templater = wrapTagSupport.templater;
|
|
595
|
+
const retag = templater.wrapper(wrapTagSupport, subject);
|
|
596
|
+
/* AFTER */
|
|
597
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runAfterRender)(wrapTagSupport, retag);
|
|
598
|
+
const isLikeTag = !existingTag || (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__.isLikeTags)(existingTag, retag);
|
|
599
|
+
if (!isLikeTag) {
|
|
600
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_3__.destroyTagMemory)(existingTag, subject);
|
|
601
|
+
delete templater.global.oldest;
|
|
602
|
+
delete templater.global.newest;
|
|
603
|
+
delete subject.tag;
|
|
604
|
+
templater.global.insertBefore = existingTag.tagSupport.templater.global.insertBefore;
|
|
605
|
+
}
|
|
606
|
+
retag.ownerTag = runtimeOwnerTag;
|
|
607
|
+
wrapTagSupport.templater.global.newest = retag;
|
|
608
|
+
if (wrapTagSupport.templater.global.oldest && !wrapTagSupport.templater.global.oldest.hasLiveElements) {
|
|
609
|
+
throw new Error('56513540');
|
|
610
|
+
}
|
|
611
|
+
if (wrapTagSupport.templater.global.oldest && !wrapTagSupport.templater.global.oldest.hasLiveElements) {
|
|
612
|
+
throw new Error('5555 - 10');
|
|
613
|
+
}
|
|
614
|
+
return retag;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
/***/ }),
|
|
619
|
+
|
|
620
|
+
/***/ "./ts/ValueSubject.ts":
|
|
621
|
+
/*!****************************!*\
|
|
622
|
+
!*** ./ts/ValueSubject.ts ***!
|
|
623
|
+
\****************************/
|
|
624
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
625
|
+
|
|
626
|
+
__webpack_require__.r(__webpack_exports__);
|
|
627
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
628
|
+
/* harmony export */ ValueSubject: () => (/* binding */ ValueSubject)
|
|
629
|
+
/* harmony export */ });
|
|
630
|
+
/* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Subject */ "./ts/Subject.ts");
|
|
631
|
+
|
|
632
|
+
class ValueSubject extends _Subject__WEBPACK_IMPORTED_MODULE_0__.Subject {
|
|
633
|
+
value;
|
|
634
|
+
constructor(value) {
|
|
635
|
+
super(value);
|
|
636
|
+
this.value = value;
|
|
637
|
+
}
|
|
638
|
+
subscribe(callback) {
|
|
639
|
+
const unsubscribe = super.subscribe(callback);
|
|
640
|
+
// Call the callback immediately with the current value
|
|
641
|
+
callback(this.value);
|
|
642
|
+
return unsubscribe;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
/***/ }),
|
|
648
|
+
|
|
649
|
+
/***/ "./ts/alterProps.function.ts":
|
|
650
|
+
/*!***********************************!*\
|
|
651
|
+
!*** ./ts/alterProps.function.ts ***!
|
|
652
|
+
\***********************************/
|
|
653
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
654
|
+
|
|
655
|
+
__webpack_require__.r(__webpack_exports__);
|
|
656
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
657
|
+
/* harmony export */ alterProps: () => (/* binding */ alterProps)
|
|
658
|
+
/* harmony export */ });
|
|
659
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
660
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
/* Used to rewrite props that are functions. When they are called it should cause parent rendering */
|
|
664
|
+
function alterProps(props, templater, ownerSupport) {
|
|
665
|
+
function callback(toCall, callWith) {
|
|
666
|
+
const renderCount = templater.global.renderCount;
|
|
667
|
+
const callbackResult = toCall(...callWith);
|
|
668
|
+
if (templater.global.renderCount > renderCount) {
|
|
669
|
+
throw new Error('already rendered');
|
|
670
|
+
}
|
|
671
|
+
const lastestOwner = ownerSupport.templater.global.newest;
|
|
672
|
+
const newOwner = (0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(lastestOwner.tagSupport, true);
|
|
673
|
+
if (newOwner.tagSupport.templater.global.newest != newOwner) {
|
|
674
|
+
throw new Error('newest assignment issue?');
|
|
675
|
+
}
|
|
676
|
+
return callbackResult;
|
|
677
|
+
}
|
|
678
|
+
const isPropTag = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagInstance)(props);
|
|
679
|
+
const watchProps = isPropTag ? 0 : props;
|
|
680
|
+
const newProps = resetFunctionProps(watchProps, callback);
|
|
681
|
+
return newProps;
|
|
682
|
+
}
|
|
683
|
+
function resetFunctionProps(props, callback) {
|
|
684
|
+
if (typeof (props) !== 'object') {
|
|
685
|
+
return props;
|
|
686
|
+
}
|
|
687
|
+
const newProps = props;
|
|
688
|
+
// BELOW: Do not clone because if first argument is object, the memory ref back is lost
|
|
689
|
+
// const newProps = {...props}
|
|
690
|
+
Object.entries(newProps).forEach(([name, value]) => {
|
|
691
|
+
if (value instanceof Function) {
|
|
692
|
+
const original = newProps[name].original;
|
|
693
|
+
if (original) {
|
|
694
|
+
return; // already previously converted
|
|
695
|
+
}
|
|
696
|
+
newProps[name] = (...args) => {
|
|
697
|
+
return callback(value, args);
|
|
698
|
+
};
|
|
699
|
+
newProps[name].original = value;
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
return newProps;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
/***/ }),
|
|
708
|
+
|
|
709
|
+
/***/ "./ts/bindSubjectCallback.function.ts":
|
|
710
|
+
/*!********************************************!*\
|
|
711
|
+
!*** ./ts/bindSubjectCallback.function.ts ***!
|
|
712
|
+
\********************************************/
|
|
713
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
714
|
+
|
|
715
|
+
__webpack_require__.r(__webpack_exports__);
|
|
716
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
717
|
+
/* harmony export */ bindSubjectCallback: () => (/* binding */ bindSubjectCallback),
|
|
718
|
+
/* harmony export */ runTagCallback: () => (/* binding */ runTagCallback)
|
|
719
|
+
/* harmony export */ });
|
|
720
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
721
|
+
/** File largely responsible for reacting to element events, such as onclick */
|
|
722
|
+
|
|
723
|
+
function bindSubjectCallback(value, tag) {
|
|
724
|
+
// Is this children? No override needed
|
|
725
|
+
if (value.isChildOverride) {
|
|
726
|
+
return value;
|
|
727
|
+
}
|
|
728
|
+
if (!tag.ownerTag && !tag.tagSupport.templater.global.isApp) {
|
|
729
|
+
throw new Error('no ownerTag issue here');
|
|
730
|
+
}
|
|
731
|
+
const subjectFunction = (element, args) => runTagCallback(value, tag, element, args);
|
|
732
|
+
// link back to original. Mostly used for <div oninit ondestroy> animations
|
|
733
|
+
subjectFunction.tagFunction = value;
|
|
734
|
+
return subjectFunction;
|
|
735
|
+
}
|
|
736
|
+
function runTagCallback(value, tag, bindTo, args) {
|
|
737
|
+
const tagSupport = tag.tagSupport;
|
|
738
|
+
const renderCount = tagSupport.templater.global.renderCount;
|
|
739
|
+
const method = value.bind(bindTo);
|
|
740
|
+
const callbackResult = method(...args);
|
|
741
|
+
const sameRenderCount = renderCount === tagSupport.templater.global.renderCount;
|
|
742
|
+
// already rendered OR tag was deleted before event processing
|
|
743
|
+
if (!sameRenderCount || tagSupport.templater.global.deleted) {
|
|
744
|
+
if (callbackResult instanceof Promise) {
|
|
745
|
+
return callbackResult.then(() => {
|
|
746
|
+
return 'promise-no-data-ever'; // tag was deleted during event processing
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
return 'no-data-ever'; // already rendered
|
|
750
|
+
}
|
|
751
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_0__.renderTagSupport)(tagSupport, true);
|
|
752
|
+
if (callbackResult instanceof Promise) {
|
|
753
|
+
return callbackResult.then(() => {
|
|
754
|
+
if (tagSupport.templater.global.deleted) {
|
|
755
|
+
return 'promise-no-data-ever'; // tag was deleted during event processing
|
|
756
|
+
}
|
|
757
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_0__.renderTagSupport)(tagSupport, true);
|
|
758
|
+
return 'promise-no-data-ever';
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
// Caller always expects a Promise
|
|
762
|
+
return 'no-data-ever';
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
/***/ }),
|
|
767
|
+
|
|
768
|
+
/***/ "./ts/checkDestroyPrevious.function.ts":
|
|
769
|
+
/*!*********************************************!*\
|
|
770
|
+
!*** ./ts/checkDestroyPrevious.function.ts ***!
|
|
771
|
+
\*********************************************/
|
|
772
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
773
|
+
|
|
774
|
+
__webpack_require__.r(__webpack_exports__);
|
|
775
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
776
|
+
/* harmony export */ checkDestroyPrevious: () => (/* binding */ checkDestroyPrevious),
|
|
777
|
+
/* harmony export */ destroyArrayTag: () => (/* binding */ destroyArrayTag)
|
|
778
|
+
/* harmony export */ });
|
|
779
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
780
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
781
|
+
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
function checkDestroyPrevious(subject, // existing.value is the old value
|
|
786
|
+
newValue) {
|
|
787
|
+
const existingSubArray = subject;
|
|
788
|
+
const wasArray = existingSubArray.lastArray;
|
|
789
|
+
// no longer an array
|
|
790
|
+
if (wasArray && !(0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagArray)(newValue)) {
|
|
791
|
+
wasArray.forEach(({ tag }) => destroyArrayTag(tag, { added: 0, removed: 0 }));
|
|
792
|
+
delete subject.lastArray;
|
|
793
|
+
return 1;
|
|
794
|
+
}
|
|
795
|
+
const tagSubject = subject;
|
|
796
|
+
const existingTag = tagSubject.tag;
|
|
797
|
+
// no longer tag or component?
|
|
798
|
+
if (existingTag) {
|
|
799
|
+
const isValueTag = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagInstance)(newValue);
|
|
800
|
+
const isSubjectTag = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagInstance)(subject.value);
|
|
801
|
+
if (isSubjectTag && isValueTag) {
|
|
802
|
+
const newTag = newValue;
|
|
803
|
+
if (!(0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_1__.isLikeTags)(newTag, existingTag)) {
|
|
804
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(existingTag, tagSubject);
|
|
805
|
+
return 2;
|
|
806
|
+
}
|
|
807
|
+
return false;
|
|
808
|
+
}
|
|
809
|
+
const isValueTagComponent = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagComponent)(newValue);
|
|
810
|
+
if (isValueTagComponent) {
|
|
811
|
+
return false; // its still a tag component
|
|
812
|
+
}
|
|
813
|
+
// destroy old component, value is not a component
|
|
814
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(existingTag, tagSubject);
|
|
815
|
+
return 3;
|
|
816
|
+
}
|
|
817
|
+
const displaySubject = subject;
|
|
818
|
+
const hasLastValue = 'lastValue' in displaySubject;
|
|
819
|
+
const lastValue = displaySubject.lastValue; // TODO: we maybe able to use displaySubject.value and remove concept of lastValue
|
|
820
|
+
// was simple value but now something bigger
|
|
821
|
+
if (hasLastValue && lastValue !== newValue) {
|
|
822
|
+
destroySimpleValue(displaySubject.template, displaySubject);
|
|
823
|
+
return 4;
|
|
824
|
+
}
|
|
825
|
+
return false;
|
|
826
|
+
}
|
|
827
|
+
function destroyArrayTag(tag, counts) {
|
|
828
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagSupportPast)(tag.tagSupport);
|
|
829
|
+
tag.destroy({
|
|
830
|
+
stagger: counts.removed++,
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
function destroySimpleValue(template, subject) {
|
|
834
|
+
const clone = subject.clone;
|
|
835
|
+
const parent = clone.parentNode;
|
|
836
|
+
// put the template back down
|
|
837
|
+
parent.insertBefore(template, clone);
|
|
838
|
+
parent.removeChild(clone);
|
|
839
|
+
delete subject.clone;
|
|
840
|
+
delete subject.lastValue;
|
|
841
|
+
// subject.template = template
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
/***/ }),
|
|
846
|
+
|
|
847
|
+
/***/ "./ts/deepFunctions.ts":
|
|
848
|
+
/*!*****************************!*\
|
|
849
|
+
!*** ./ts/deepFunctions.ts ***!
|
|
850
|
+
\*****************************/
|
|
851
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
852
|
+
|
|
853
|
+
__webpack_require__.r(__webpack_exports__);
|
|
854
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
855
|
+
/* harmony export */ deepClone: () => (/* binding */ deepClone),
|
|
856
|
+
/* harmony export */ deepEqual: () => (/* binding */ deepEqual)
|
|
857
|
+
/* harmony export */ });
|
|
858
|
+
function deepClone(obj) {
|
|
859
|
+
return makeDeepClone(obj, new WeakMap());
|
|
860
|
+
}
|
|
861
|
+
function makeDeepClone(obj, visited) {
|
|
862
|
+
// If obj is a primitive type or null, return it directly
|
|
863
|
+
if (obj === null || typeof obj !== 'object') {
|
|
864
|
+
return obj;
|
|
865
|
+
}
|
|
866
|
+
// If obj is already visited, return the cloned reference
|
|
867
|
+
if (visited.has(obj)) {
|
|
868
|
+
return visited.get(obj);
|
|
869
|
+
}
|
|
870
|
+
// Handle special cases like Date and RegExp
|
|
871
|
+
if (obj instanceof Date) {
|
|
872
|
+
return new Date(obj);
|
|
873
|
+
}
|
|
874
|
+
if (obj instanceof RegExp) {
|
|
875
|
+
return new RegExp(obj);
|
|
876
|
+
}
|
|
877
|
+
// Create an empty object or array with the same prototype
|
|
878
|
+
const clone = Array.isArray(obj) ? [] : Object.create(Object.getPrototypeOf(obj));
|
|
879
|
+
// Register the cloned object to avoid cyclic references
|
|
880
|
+
visited.set(obj, clone);
|
|
881
|
+
// Clone each property or element of the object or array
|
|
882
|
+
if (Array.isArray(obj)) {
|
|
883
|
+
for (let i = 0; i < obj.length; i++) {
|
|
884
|
+
clone[i] = makeDeepClone(obj[i], visited);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
else {
|
|
888
|
+
for (const key in obj) {
|
|
889
|
+
if (obj.hasOwnProperty(key)) {
|
|
890
|
+
clone[key] = makeDeepClone(obj[key], visited);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
return clone;
|
|
895
|
+
}
|
|
896
|
+
function deepEqual(obj1, obj2) {
|
|
897
|
+
return isDeepEqual(obj1, obj2, new WeakMap());
|
|
898
|
+
}
|
|
899
|
+
function isDeepEqual(obj1, obj2, visited) {
|
|
900
|
+
if (obj1 === obj2 || isSameFunctions(obj1, obj2)) {
|
|
901
|
+
return true;
|
|
902
|
+
}
|
|
903
|
+
if (typeof obj1 !== 'object' ||
|
|
904
|
+
typeof obj2 !== 'object' ||
|
|
905
|
+
obj1 === null ||
|
|
906
|
+
obj2 === null) {
|
|
907
|
+
return false;
|
|
908
|
+
}
|
|
909
|
+
const keys1 = Object.keys(obj1);
|
|
910
|
+
const keys2 = Object.keys(obj2);
|
|
911
|
+
if (keys1.length !== keys2.length) {
|
|
912
|
+
return false;
|
|
913
|
+
}
|
|
914
|
+
// If obj is already visited, return the cloned reference
|
|
915
|
+
if (visited.has(obj1)) {
|
|
916
|
+
return true;
|
|
917
|
+
}
|
|
918
|
+
// Register the cloned object to avoid cyclic references
|
|
919
|
+
visited.set(obj1, 0);
|
|
920
|
+
for (const key of keys1) {
|
|
921
|
+
const keyFound = keys2.includes(key);
|
|
922
|
+
if (!keyFound || !isDeepEqual(obj1[key], obj2[key], visited)) {
|
|
923
|
+
/*
|
|
924
|
+
if(isSameFunctions(obj1[key], obj2[key])) {
|
|
925
|
+
continue
|
|
926
|
+
}
|
|
927
|
+
*/
|
|
928
|
+
return false;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
// Check if obj1 and obj2 are both arrays
|
|
932
|
+
if (Array.isArray(obj1) && Array.isArray(obj2)) {
|
|
933
|
+
if (obj1.length !== obj2.length) {
|
|
934
|
+
return false;
|
|
935
|
+
}
|
|
936
|
+
for (let i = 0; i < obj1.length; i++) {
|
|
937
|
+
if (!isDeepEqual(obj1[i], obj2[i], visited)) {
|
|
938
|
+
return false;
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
else if (Array.isArray(obj1) || Array.isArray(obj2)) {
|
|
943
|
+
// One is an array, and the other is not
|
|
944
|
+
return false;
|
|
945
|
+
}
|
|
946
|
+
return true;
|
|
947
|
+
}
|
|
948
|
+
function isSameFunctions(fn0, fn1) {
|
|
949
|
+
const bothFunction = fn0 instanceof Function && fn1 instanceof Function;
|
|
950
|
+
return bothFunction && fn0.toString() === fn1.toString();
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
/***/ }),
|
|
955
|
+
|
|
956
|
+
/***/ "./ts/destroyTag.function.ts":
|
|
957
|
+
/*!***********************************!*\
|
|
958
|
+
!*** ./ts/destroyTag.function.ts ***!
|
|
959
|
+
\***********************************/
|
|
960
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
961
|
+
|
|
962
|
+
__webpack_require__.r(__webpack_exports__);
|
|
963
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
964
|
+
/* harmony export */ destroyTagMemory: () => (/* binding */ destroyTagMemory),
|
|
965
|
+
/* harmony export */ destroyTagSupportPast: () => (/* binding */ destroyTagSupportPast)
|
|
966
|
+
/* harmony export */ });
|
|
967
|
+
function destroyTagMemory(tag, subject) {
|
|
968
|
+
const oldTagSupport = tag.tagSupport;
|
|
969
|
+
if (subject != tag.tagSupport.subject) {
|
|
970
|
+
throw new Error('fff - subjects do not match');
|
|
971
|
+
}
|
|
972
|
+
delete subject.tag;
|
|
973
|
+
delete tag.tagSupport.subject.tag; // TODO: this line maybe not needed
|
|
974
|
+
// must destroy oldest which is tag with elements on stage
|
|
975
|
+
const oldest = tag.tagSupport.templater.global.oldest;
|
|
976
|
+
oldest.destroy();
|
|
977
|
+
destroyTagSupportPast(oldTagSupport);
|
|
978
|
+
tag.tagSupport.templater.global.context = {};
|
|
979
|
+
}
|
|
980
|
+
function destroyTagSupportPast(oldTagSupport) {
|
|
981
|
+
delete oldTagSupport.templater.global.oldest;
|
|
982
|
+
delete oldTagSupport.templater.global.newest;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
/***/ }),
|
|
987
|
+
|
|
988
|
+
/***/ "./ts/elementDestroyCheck.function.ts":
|
|
989
|
+
/*!********************************************!*\
|
|
990
|
+
!*** ./ts/elementDestroyCheck.function.ts ***!
|
|
991
|
+
\********************************************/
|
|
992
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
993
|
+
|
|
994
|
+
__webpack_require__.r(__webpack_exports__);
|
|
995
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
996
|
+
/* harmony export */ elementDestroyCheck: () => (/* binding */ elementDestroyCheck)
|
|
997
|
+
/* harmony export */ });
|
|
998
|
+
function elementDestroyCheck(nextSibling, stagger) {
|
|
999
|
+
const onDestroyDoubleWrap = nextSibling.ondestroy;
|
|
1000
|
+
if (!onDestroyDoubleWrap) {
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
const onDestroyWrap = onDestroyDoubleWrap.tagFunction;
|
|
1004
|
+
if (!onDestroyWrap) {
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
const onDestroy = onDestroyWrap.tagFunction;
|
|
1008
|
+
if (!onDestroy) {
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
const event = { target: nextSibling, stagger };
|
|
1012
|
+
return onDestroy(event);
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
|
|
1016
|
+
/***/ }),
|
|
1017
|
+
|
|
1018
|
+
/***/ "./ts/elementInitCheck.ts":
|
|
1019
|
+
/*!********************************!*\
|
|
1020
|
+
!*** ./ts/elementInitCheck.ts ***!
|
|
1021
|
+
\********************************/
|
|
1022
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1023
|
+
|
|
1024
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1025
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1026
|
+
/* harmony export */ elementInitCheck: () => (/* binding */ elementInitCheck)
|
|
1027
|
+
/* harmony export */ });
|
|
1028
|
+
function elementInitCheck(nextSibling, counts) {
|
|
1029
|
+
const onInitDoubleWrap = nextSibling.oninit;
|
|
1030
|
+
if (!onInitDoubleWrap) {
|
|
1031
|
+
return counts.added;
|
|
1032
|
+
}
|
|
1033
|
+
const onInitWrap = onInitDoubleWrap.tagFunction;
|
|
1034
|
+
if (!onInitWrap) {
|
|
1035
|
+
return counts.added;
|
|
1036
|
+
}
|
|
1037
|
+
const onInit = onInitWrap.tagFunction;
|
|
1038
|
+
if (!onInit) {
|
|
1039
|
+
return counts.added;
|
|
1040
|
+
}
|
|
1041
|
+
const event = { target: nextSibling, stagger: counts.added };
|
|
1042
|
+
onInit(event);
|
|
1043
|
+
return ++counts.added;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
/***/ }),
|
|
1048
|
+
|
|
1049
|
+
/***/ "./ts/errors.ts":
|
|
1050
|
+
/*!**********************!*\
|
|
1051
|
+
!*** ./ts/errors.ts ***!
|
|
1052
|
+
\**********************/
|
|
1053
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1054
|
+
|
|
1055
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1056
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1057
|
+
/* harmony export */ ArrayNoKeyError: () => (/* binding */ ArrayNoKeyError),
|
|
1058
|
+
/* harmony export */ StateMismatchError: () => (/* binding */ StateMismatchError),
|
|
1059
|
+
/* harmony export */ TagError: () => (/* binding */ TagError)
|
|
1060
|
+
/* harmony export */ });
|
|
1061
|
+
class TagError extends Error {
|
|
1062
|
+
details;
|
|
1063
|
+
constructor(message, errorCode, details = {}) {
|
|
1064
|
+
super(message);
|
|
1065
|
+
this.name = TagError.name;
|
|
1066
|
+
this.details = { ...details, errorCode };
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
class ArrayNoKeyError extends TagError {
|
|
1070
|
+
constructor(message, details) {
|
|
1071
|
+
super(message, 'array-no-key-error', details);
|
|
1072
|
+
this.name = ArrayNoKeyError.name;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
class StateMismatchError extends TagError {
|
|
1076
|
+
constructor(message, details) {
|
|
1077
|
+
super(message, 'state-mismatch-error', details);
|
|
1078
|
+
this.name = StateMismatchError.name;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
|
|
1083
|
+
/***/ }),
|
|
1084
|
+
|
|
1085
|
+
/***/ "./ts/getCallback.ts":
|
|
1086
|
+
/*!***************************!*\
|
|
1087
|
+
!*** ./ts/getCallback.ts ***!
|
|
1088
|
+
\***************************/
|
|
1089
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1090
|
+
|
|
1091
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1092
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1093
|
+
/* harmony export */ getCallback: () => (/* binding */ getCallback)
|
|
1094
|
+
/* harmony export */ });
|
|
1095
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
1096
|
+
/* harmony import */ var _set_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./set.function */ "./ts/set.function.ts");
|
|
1097
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
let innerCallback = (callback) => () => {
|
|
1102
|
+
throw new Error('Callback function was called immediately in sync and must instead be call async');
|
|
1103
|
+
};
|
|
1104
|
+
const getCallback = () => innerCallback;
|
|
1105
|
+
const originalGetter = innerCallback; // getCallback
|
|
1106
|
+
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
1107
|
+
beforeRender: (tagSupport) => initMemory(tagSupport),
|
|
1108
|
+
beforeRedraw: (tagSupport) => initMemory(tagSupport),
|
|
1109
|
+
afterRender: (_tagSupport) => {
|
|
1110
|
+
innerCallback = originalGetter; // prevent crossing callbacks with another tag
|
|
1111
|
+
},
|
|
1112
|
+
});
|
|
1113
|
+
function updateState(stateFrom, stateTo) {
|
|
1114
|
+
stateFrom.forEach((state, index) => {
|
|
1115
|
+
const fromValue = (0,_set_function__WEBPACK_IMPORTED_MODULE_1__.getStateValue)(state);
|
|
1116
|
+
const callback = stateTo[index].callback;
|
|
1117
|
+
if (callback) {
|
|
1118
|
+
callback(fromValue); // set the value
|
|
1119
|
+
}
|
|
1120
|
+
stateTo[index].lastValue = fromValue; // record the value
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
function initMemory(tagSupport) {
|
|
1124
|
+
const oldState = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.stateConfig.array;
|
|
1125
|
+
innerCallback = (callback) => {
|
|
1126
|
+
const trigger = (...args) => triggerStateUpdate(tagSupport, callback, oldState, ...args);
|
|
1127
|
+
return trigger;
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
function triggerStateUpdate(tagSupport, callback, oldState, ...args) {
|
|
1131
|
+
const state = tagSupport.memory.state;
|
|
1132
|
+
const newest = state.newest;
|
|
1133
|
+
// ensure that the oldest has the latest values first
|
|
1134
|
+
updateState(newest, oldState);
|
|
1135
|
+
// run the callback
|
|
1136
|
+
const promise = callback(...args);
|
|
1137
|
+
// send the oldest state changes into the newest
|
|
1138
|
+
updateState(oldState, newest);
|
|
1139
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
1140
|
+
if (promise instanceof Promise) {
|
|
1141
|
+
promise.finally(() => {
|
|
1142
|
+
// send the oldest state changes into the newest
|
|
1143
|
+
updateState(oldState, newest);
|
|
1144
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
/***/ }),
|
|
1151
|
+
|
|
1152
|
+
/***/ "./ts/hasTagSupportChanged.function.ts":
|
|
1153
|
+
/*!*********************************************!*\
|
|
1154
|
+
!*** ./ts/hasTagSupportChanged.function.ts ***!
|
|
1155
|
+
\*********************************************/
|
|
1156
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1157
|
+
|
|
1158
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1159
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1160
|
+
/* harmony export */ hasKidsChanged: () => (/* binding */ hasKidsChanged),
|
|
1161
|
+
/* harmony export */ hasPropChanges: () => (/* binding */ hasPropChanges),
|
|
1162
|
+
/* harmony export */ hasTagSupportChanged: () => (/* binding */ hasTagSupportChanged)
|
|
1163
|
+
/* harmony export */ });
|
|
1164
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
1165
|
+
|
|
1166
|
+
function hasTagSupportChanged(oldTagSupport, newTagSupport, newTemplater) {
|
|
1167
|
+
const sameSupport = oldTagSupport === newTagSupport;
|
|
1168
|
+
const samePropConfig = oldTagSupport.propsConfig === newTagSupport.propsConfig;
|
|
1169
|
+
// const sameProps = oldTagSupport.propsConfig.latest === newTagSupport.propsConfig.latest
|
|
1170
|
+
if (sameSupport) {
|
|
1171
|
+
throw new Error('sameSupport - 22');
|
|
1172
|
+
}
|
|
1173
|
+
if (samePropConfig) {
|
|
1174
|
+
throw new Error('samePropConfig - 22');
|
|
1175
|
+
}
|
|
1176
|
+
if (newTagSupport.templater.isTag || oldTagSupport.templater.isTag || newTemplater.isTag) {
|
|
1177
|
+
throw new Error('trying to compare a basic tag');
|
|
1178
|
+
}
|
|
1179
|
+
const latestProps = newTemplater.props; // newTagSupport.propsConfig.latest
|
|
1180
|
+
const pastCloneProps = oldTagSupport.propsConfig.latestCloned;
|
|
1181
|
+
const propsChanged = hasPropChanges(latestProps, pastCloneProps);
|
|
1182
|
+
// if no changes detected, no need to continue to rendering further tags
|
|
1183
|
+
if (propsChanged) {
|
|
1184
|
+
return propsChanged;
|
|
1185
|
+
}
|
|
1186
|
+
const kidsChanged = hasKidsChanged(oldTagSupport, newTagSupport);
|
|
1187
|
+
// we already know props didn't change and if kids didn't either, than don't render
|
|
1188
|
+
return kidsChanged;
|
|
1189
|
+
}
|
|
1190
|
+
function hasPropChanges(props, // natural props
|
|
1191
|
+
pastCloneProps) {
|
|
1192
|
+
/*
|
|
1193
|
+
const isCommonEqual = props === undefined && props === compareToProps
|
|
1194
|
+
if(isCommonEqual) {
|
|
1195
|
+
return false
|
|
1196
|
+
}
|
|
1197
|
+
*/
|
|
1198
|
+
let castedProps = props;
|
|
1199
|
+
let castedPastProps = pastCloneProps;
|
|
1200
|
+
// check all prop functions match
|
|
1201
|
+
if (typeof (props) === 'object') {
|
|
1202
|
+
if (!pastCloneProps) {
|
|
1203
|
+
return 3;
|
|
1204
|
+
}
|
|
1205
|
+
castedProps = { ...props };
|
|
1206
|
+
castedPastProps = { ...(pastCloneProps || {}) };
|
|
1207
|
+
const allFunctionsMatch = Object.entries(castedProps).every(([key, value]) => {
|
|
1208
|
+
/*if(!(key in (castedPastProps as any))) {
|
|
1209
|
+
return false
|
|
1210
|
+
}*/
|
|
1211
|
+
let compare = castedPastProps[key];
|
|
1212
|
+
if (!(value instanceof Function)) {
|
|
1213
|
+
return 4; // this will be checked in deepEqual
|
|
1214
|
+
}
|
|
1215
|
+
if (!(compare instanceof Function)) {
|
|
1216
|
+
return false; // its a function now but was not before
|
|
1217
|
+
}
|
|
1218
|
+
// ensure we are comparing apples to apples as function get wrapped
|
|
1219
|
+
if (compare.original) {
|
|
1220
|
+
compare = compare.original;
|
|
1221
|
+
}
|
|
1222
|
+
const original = value.original;
|
|
1223
|
+
if (original) {
|
|
1224
|
+
value = value.original;
|
|
1225
|
+
}
|
|
1226
|
+
if (value.toString() !== compare.toString()) {
|
|
1227
|
+
return false; // both are function but not the same
|
|
1228
|
+
}
|
|
1229
|
+
delete castedProps[key]; // its a function and not needed to be compared
|
|
1230
|
+
delete castedPastProps[key]; // its a function and not needed to be compared
|
|
1231
|
+
return 5;
|
|
1232
|
+
});
|
|
1233
|
+
if (!allFunctionsMatch) {
|
|
1234
|
+
return 6; // a change has been detected by function comparisons
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
const isEqual = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(castedPastProps, castedProps);
|
|
1238
|
+
return isEqual ? false : 7; // if equal then no changes
|
|
1239
|
+
}
|
|
1240
|
+
function hasKidsChanged(oldTagSupport, newTagSupport) {
|
|
1241
|
+
const oldCloneKidValues = oldTagSupport.propsConfig.lastClonedKidValues;
|
|
1242
|
+
const newClonedKidValues = newTagSupport.propsConfig.lastClonedKidValues;
|
|
1243
|
+
const everySame = oldCloneKidValues.every((set, index) => {
|
|
1244
|
+
const x = newClonedKidValues[index];
|
|
1245
|
+
return set.every((item, index) => item === x[index]);
|
|
1246
|
+
});
|
|
1247
|
+
return everySame ? false : 9;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
/***/ }),
|
|
1252
|
+
|
|
1253
|
+
/***/ "./ts/html.ts":
|
|
1254
|
+
/*!********************!*\
|
|
1255
|
+
!*** ./ts/html.ts ***!
|
|
1256
|
+
\********************/
|
|
1257
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1258
|
+
|
|
1259
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1260
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1261
|
+
/* harmony export */ html: () => (/* binding */ html)
|
|
1262
|
+
/* harmony export */ });
|
|
1263
|
+
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Tag.class */ "./ts/Tag.class.ts");
|
|
1264
|
+
|
|
1265
|
+
function html(strings, ...values) {
|
|
1266
|
+
return new _Tag_class__WEBPACK_IMPORTED_MODULE_0__.Tag(strings, values);
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
/***/ }),
|
|
1271
|
+
|
|
1272
|
+
/***/ "./ts/inputAttribute.ts":
|
|
1273
|
+
/*!******************************!*\
|
|
1274
|
+
!*** ./ts/inputAttribute.ts ***!
|
|
1275
|
+
\******************************/
|
|
1276
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1277
|
+
|
|
1278
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1279
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1280
|
+
/* harmony export */ inputAttribute: () => (/* binding */ inputAttribute)
|
|
1281
|
+
/* harmony export */ });
|
|
1282
|
+
function inputAttribute(name, value, element) {
|
|
1283
|
+
const names = name.split('.');
|
|
1284
|
+
// style.position = "absolute"
|
|
1285
|
+
if (names[0] === 'style') {
|
|
1286
|
+
element.style[names[1]] = value;
|
|
1287
|
+
}
|
|
1288
|
+
// Example: class.width-full = "true"
|
|
1289
|
+
if (names[0] === 'class') {
|
|
1290
|
+
names.shift();
|
|
1291
|
+
if (value) {
|
|
1292
|
+
names.forEach(name => element.classList.add(name));
|
|
1293
|
+
}
|
|
1294
|
+
else {
|
|
1295
|
+
names.forEach(name => element.classList.remove(name));
|
|
1296
|
+
}
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
/***/ }),
|
|
1303
|
+
|
|
1304
|
+
/***/ "./ts/interpolateAttributes.ts":
|
|
1305
|
+
/*!*************************************!*\
|
|
1306
|
+
!*** ./ts/interpolateAttributes.ts ***!
|
|
1307
|
+
\*************************************/
|
|
1308
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1309
|
+
|
|
1310
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1311
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1312
|
+
/* harmony export */ interpolateAttributes: () => (/* binding */ interpolateAttributes)
|
|
1313
|
+
/* harmony export */ });
|
|
1314
|
+
/* harmony import */ var _processAttribute_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./processAttribute.function */ "./ts/processAttribute.function.ts");
|
|
1315
|
+
|
|
1316
|
+
function howToSetAttribute(element, name, value) {
|
|
1317
|
+
element.setAttribute(name, value);
|
|
1318
|
+
}
|
|
1319
|
+
function howToSetInputValue(element, name, value) {
|
|
1320
|
+
element[name] = value;
|
|
1321
|
+
}
|
|
1322
|
+
function interpolateAttributes(child, scope, ownerTag) {
|
|
1323
|
+
const attrNames = child.getAttributeNames();
|
|
1324
|
+
let howToSet = howToSetAttribute;
|
|
1325
|
+
attrNames.forEach(attrName => {
|
|
1326
|
+
if (child.nodeName === 'INPUT' && attrName === 'value') {
|
|
1327
|
+
howToSet = howToSetInputValue;
|
|
1328
|
+
}
|
|
1329
|
+
const value = child.getAttribute(attrName);
|
|
1330
|
+
(0,_processAttribute_function__WEBPACK_IMPORTED_MODULE_0__.processAttribute)(attrName, value, child, scope, ownerTag, howToSet);
|
|
1331
|
+
howToSet = howToSetAttribute; // put back
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
/***/ }),
|
|
1337
|
+
|
|
1338
|
+
/***/ "./ts/interpolateContentTemplates.ts":
|
|
1339
|
+
/*!*******************************************!*\
|
|
1340
|
+
!*** ./ts/interpolateContentTemplates.ts ***!
|
|
1341
|
+
\*******************************************/
|
|
1342
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1343
|
+
|
|
1344
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1345
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1346
|
+
/* harmony export */ interpolateContentTemplates: () => (/* binding */ interpolateContentTemplates)
|
|
1347
|
+
/* harmony export */ });
|
|
1348
|
+
/* harmony import */ var _interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interpolateTemplate */ "./ts/interpolateTemplate.ts");
|
|
1349
|
+
|
|
1350
|
+
function interpolateContentTemplates(element, context, tag, options, children) {
|
|
1351
|
+
if (!children || element.tagName === 'TEMPLATE') {
|
|
1352
|
+
return { clones: [], tagComponents: [] }; // done
|
|
1353
|
+
}
|
|
1354
|
+
// counting for animation stagger computing
|
|
1355
|
+
const counts = options.counts;
|
|
1356
|
+
const clones = [];
|
|
1357
|
+
const tagComponents = [];
|
|
1358
|
+
const childArray = new Array(...children);
|
|
1359
|
+
childArray.forEach(child => {
|
|
1360
|
+
const { clones: nextClones, tagComponent } = (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__.interpolateTemplate)(child, context, tag, counts, options);
|
|
1361
|
+
clones.push(...nextClones);
|
|
1362
|
+
if (tagComponent) {
|
|
1363
|
+
tagComponents.push(tagComponent);
|
|
1364
|
+
return;
|
|
1365
|
+
}
|
|
1366
|
+
if (child.children) {
|
|
1367
|
+
const nextKids = new Array(...child.children);
|
|
1368
|
+
nextKids.forEach((subChild, index) => {
|
|
1369
|
+
// IF <template end /> its a variable to be processed
|
|
1370
|
+
if (isRenderEndTemplate(subChild)) {
|
|
1371
|
+
const { tagComponent } = (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__.interpolateTemplate)(subChild, context, tag, counts, options);
|
|
1372
|
+
if (tagComponent) {
|
|
1373
|
+
tagComponents.push(tagComponent);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
const { clones: nextClones, tagComponents: nextTagComponent } = interpolateContentTemplates(subChild, context, tag, options, subChild.children);
|
|
1377
|
+
clones.push(...nextClones);
|
|
1378
|
+
tagComponents.push(...nextTagComponent);
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
return { clones, tagComponents };
|
|
1383
|
+
}
|
|
1384
|
+
function isRenderEndTemplate(child) {
|
|
1385
|
+
const isTemplate = child.tagName === 'TEMPLATE';
|
|
1386
|
+
return isTemplate &&
|
|
1387
|
+
child.getAttribute('interpolate') !== undefined &&
|
|
1388
|
+
child.getAttribute('end') !== undefined;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
|
|
1392
|
+
/***/ }),
|
|
1393
|
+
|
|
1394
|
+
/***/ "./ts/interpolateElement.ts":
|
|
1395
|
+
/*!**********************************!*\
|
|
1396
|
+
!*** ./ts/interpolateElement.ts ***!
|
|
1397
|
+
\**********************************/
|
|
1398
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1399
|
+
|
|
1400
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1401
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1402
|
+
/* harmony export */ interpolateElement: () => (/* binding */ interpolateElement),
|
|
1403
|
+
/* harmony export */ interpolateString: () => (/* binding */ interpolateString)
|
|
1404
|
+
/* harmony export */ });
|
|
1405
|
+
/* harmony import */ var _interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interpolateAttributes */ "./ts/interpolateAttributes.ts");
|
|
1406
|
+
/* harmony import */ var _interpolations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./interpolations */ "./ts/interpolations.ts");
|
|
1407
|
+
/* harmony import */ var _interpolateContentTemplates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interpolateContentTemplates */ "./ts/interpolateContentTemplates.ts");
|
|
1408
|
+
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Tag.class */ "./ts/Tag.class.ts");
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
/** Review elements within an element */
|
|
1414
|
+
function interpolateElement(container, context, // variables used to evaluate
|
|
1415
|
+
interpolatedTemplates, tagOwner, options, test = false) {
|
|
1416
|
+
const clones = [];
|
|
1417
|
+
const tagComponents = [];
|
|
1418
|
+
const result = interpolatedTemplates.interpolation;
|
|
1419
|
+
const template = container.children[0];
|
|
1420
|
+
const children = template.content.children;
|
|
1421
|
+
if (result.keys.length) {
|
|
1422
|
+
const { clones: nextClones, tagComponents: nextTagComponents } = (0,_interpolateContentTemplates__WEBPACK_IMPORTED_MODULE_2__.interpolateContentTemplates)(container, context, tagOwner, options, children);
|
|
1423
|
+
clones.push(...nextClones);
|
|
1424
|
+
tagComponents.push(...nextTagComponents);
|
|
1425
|
+
}
|
|
1426
|
+
(0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(container, context, tagOwner);
|
|
1427
|
+
processChildrenAttributes(children, context, tagOwner);
|
|
1428
|
+
return { clones, tagComponents };
|
|
1429
|
+
}
|
|
1430
|
+
function processChildrenAttributes(children, context, ownerTag) {
|
|
1431
|
+
new Array(...children).forEach(child => {
|
|
1432
|
+
(0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(child, context, ownerTag);
|
|
1433
|
+
if (child.children) {
|
|
1434
|
+
processChildrenAttributes(child.children, context, ownerTag);
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
function interpolateString(string) {
|
|
1439
|
+
const result = (0,_interpolations__WEBPACK_IMPORTED_MODULE_1__.interpolateToTemplates)(string);
|
|
1440
|
+
result.string = result.string.replace(_Tag_class__WEBPACK_IMPORTED_MODULE_3__.escapeSearch, _Tag_class__WEBPACK_IMPORTED_MODULE_3__.variablePrefix);
|
|
1441
|
+
return result;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
/***/ }),
|
|
1446
|
+
|
|
1447
|
+
/***/ "./ts/interpolateTemplate.ts":
|
|
1448
|
+
/*!***********************************!*\
|
|
1449
|
+
!*** ./ts/interpolateTemplate.ts ***!
|
|
1450
|
+
\***********************************/
|
|
1451
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1452
|
+
|
|
1453
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1454
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1455
|
+
/* harmony export */ afterElmBuild: () => (/* binding */ afterElmBuild),
|
|
1456
|
+
/* harmony export */ interpolateTemplate: () => (/* binding */ interpolateTemplate),
|
|
1457
|
+
/* harmony export */ subscribeToTemplate: () => (/* binding */ subscribeToTemplate),
|
|
1458
|
+
/* harmony export */ updateBetweenTemplates: () => (/* binding */ updateBetweenTemplates)
|
|
1459
|
+
/* harmony export */ });
|
|
1460
|
+
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Tag.class */ "./ts/Tag.class.ts");
|
|
1461
|
+
/* harmony import */ var _elementInitCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./elementInitCheck */ "./ts/elementInitCheck.ts");
|
|
1462
|
+
/* harmony import */ var _processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./processSubjectValue.function */ "./ts/processSubjectValue.function.ts");
|
|
1463
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
1464
|
+
/* harmony import */ var _scanTextAreaValue_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./scanTextAreaValue.function */ "./ts/scanTextAreaValue.function.ts");
|
|
1465
|
+
/* harmony import */ var _updateExistingValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./updateExistingValue.function */ "./ts/updateExistingValue.function.ts");
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
function interpolateTemplate(insertBefore, // <template end interpolate /> (will be removed)
|
|
1473
|
+
context, // variable scope of {`__tagvar${index}`:'x'}
|
|
1474
|
+
ownerTag, // Tag class
|
|
1475
|
+
counts, // used for animation stagger computing
|
|
1476
|
+
options) {
|
|
1477
|
+
// TODO: THe clones array is useless here
|
|
1478
|
+
const clones = [];
|
|
1479
|
+
if (!insertBefore.hasAttribute('end')) {
|
|
1480
|
+
return { clones }; // only care about <template end>
|
|
1481
|
+
}
|
|
1482
|
+
const variableName = insertBefore.getAttribute('id');
|
|
1483
|
+
if (variableName?.substring(0, _Tag_class__WEBPACK_IMPORTED_MODULE_0__.variablePrefix.length) !== _Tag_class__WEBPACK_IMPORTED_MODULE_0__.variablePrefix) {
|
|
1484
|
+
return { clones }; // ignore, not a tagVar
|
|
1485
|
+
}
|
|
1486
|
+
const existingSubject = context[variableName];
|
|
1487
|
+
const isDynamic = (0,_isInstance__WEBPACK_IMPORTED_MODULE_3__.isTagComponent)(existingSubject.value) || (0,_isInstance__WEBPACK_IMPORTED_MODULE_3__.isTagArray)(existingSubject.value);
|
|
1488
|
+
// process dynamics later
|
|
1489
|
+
if (isDynamic) {
|
|
1490
|
+
return {
|
|
1491
|
+
clones,
|
|
1492
|
+
tagComponent: {
|
|
1493
|
+
variableName,
|
|
1494
|
+
ownerTag,
|
|
1495
|
+
subject: existingSubject,
|
|
1496
|
+
insertBefore
|
|
1497
|
+
}
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
let isForceElement = options.forceElement;
|
|
1501
|
+
subscribeToTemplate(insertBefore, existingSubject, ownerTag, counts, { isForceElement });
|
|
1502
|
+
return { clones };
|
|
1503
|
+
}
|
|
1504
|
+
function subscribeToTemplate(insertBefore, subject, ownerTag, counts, // used for animation stagger computing
|
|
1505
|
+
{ isForceElement }) {
|
|
1506
|
+
let called = false;
|
|
1507
|
+
const callback = (value) => {
|
|
1508
|
+
// const orgInsert = insertBefore
|
|
1509
|
+
const clone = subject.clone;
|
|
1510
|
+
if (clone && clone.parentNode) {
|
|
1511
|
+
insertBefore = clone;
|
|
1512
|
+
}
|
|
1513
|
+
if (called) {
|
|
1514
|
+
(0,_updateExistingValue_function__WEBPACK_IMPORTED_MODULE_5__.updateExistingValue)(subject, value, ownerTag, insertBefore);
|
|
1515
|
+
return;
|
|
1516
|
+
}
|
|
1517
|
+
(0,_processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__.processSubjectValue)(value, subject, insertBefore, ownerTag, {
|
|
1518
|
+
counts: { ...counts },
|
|
1519
|
+
forceElement: isForceElement,
|
|
1520
|
+
});
|
|
1521
|
+
if (isForceElement) {
|
|
1522
|
+
isForceElement = false; // only can happen once
|
|
1523
|
+
}
|
|
1524
|
+
// ownerTag.clones.push(...clones)
|
|
1525
|
+
// ownerTag.clones.push(...nextClones)
|
|
1526
|
+
// clones.push(...nextClones)
|
|
1527
|
+
called = true;
|
|
1528
|
+
};
|
|
1529
|
+
const sub = subject.subscribe(callback);
|
|
1530
|
+
ownerTag.cloneSubs.push(sub);
|
|
1531
|
+
}
|
|
1532
|
+
// Function to update the value of x
|
|
1533
|
+
function updateBetweenTemplates(value, lastFirstChild) {
|
|
1534
|
+
const parent = lastFirstChild.parentNode;
|
|
1535
|
+
// mimic React skipping to display EXCEPT for true does display on page
|
|
1536
|
+
if (value === undefined || value === false || value === null) { // || value === true
|
|
1537
|
+
value = '';
|
|
1538
|
+
}
|
|
1539
|
+
// Insert the new value (never use innerHTML here)
|
|
1540
|
+
const textNode = document.createTextNode(value); // never innerHTML
|
|
1541
|
+
parent.insertBefore(textNode, lastFirstChild);
|
|
1542
|
+
/* remove existing nodes */
|
|
1543
|
+
parent.removeChild(lastFirstChild);
|
|
1544
|
+
return textNode;
|
|
1545
|
+
}
|
|
1546
|
+
function afterElmBuild(elm, options, context, ownerTag) {
|
|
1547
|
+
if (!elm.getAttribute) {
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1550
|
+
const tagName = elm.nodeName; // elm.tagName
|
|
1551
|
+
if (tagName === 'TEXTAREA') {
|
|
1552
|
+
(0,_scanTextAreaValue_function__WEBPACK_IMPORTED_MODULE_4__.scanTextAreaValue)(elm, context, ownerTag);
|
|
1553
|
+
}
|
|
1554
|
+
let diff = options.counts.added;
|
|
1555
|
+
diff = (0,_elementInitCheck__WEBPACK_IMPORTED_MODULE_1__.elementInitCheck)(elm, options.counts) - diff;
|
|
1556
|
+
if (elm.children) {
|
|
1557
|
+
/*
|
|
1558
|
+
const subCounts = {
|
|
1559
|
+
added: options.counts.added, // - diff,
|
|
1560
|
+
removed: options.counts.removed,
|
|
1561
|
+
}
|
|
1562
|
+
*/
|
|
1563
|
+
new Array(...elm.children).forEach((child, index) => {
|
|
1564
|
+
const subOptions = {
|
|
1565
|
+
...options,
|
|
1566
|
+
counts: options.counts,
|
|
1567
|
+
};
|
|
1568
|
+
return afterElmBuild(child, subOptions, context, ownerTag);
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
|
|
1574
|
+
/***/ }),
|
|
1575
|
+
|
|
1576
|
+
/***/ "./ts/interpolations.ts":
|
|
1577
|
+
/*!******************************!*\
|
|
1578
|
+
!*** ./ts/interpolations.ts ***!
|
|
1579
|
+
\******************************/
|
|
1580
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1581
|
+
|
|
1582
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1583
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1584
|
+
/* harmony export */ interpolateReplace: () => (/* binding */ interpolateReplace),
|
|
1585
|
+
/* harmony export */ interpolateToTemplates: () => (/* binding */ interpolateToTemplates)
|
|
1586
|
+
/* harmony export */ });
|
|
1587
|
+
// support arrow functions in attributes
|
|
1588
|
+
const interpolateReplace = /(?:<[^>]*?(?:(?:\s+\w+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+)))*\s*)\/?>)|({__tagvar[^}]+})/g;
|
|
1589
|
+
/** replaces ${x} with <template id="x-start"></template><template id="x-end"></template> */
|
|
1590
|
+
function interpolateToTemplates(template) {
|
|
1591
|
+
const keys = [];
|
|
1592
|
+
const string = template.replace(interpolateReplace, (match, expression) => {
|
|
1593
|
+
if (match.startsWith('<')) {
|
|
1594
|
+
// If the match is an HTML tag, don't replace
|
|
1595
|
+
return match;
|
|
1596
|
+
}
|
|
1597
|
+
const noBraces = expression.substring(1, expression.length - 1);
|
|
1598
|
+
const id = noBraces;
|
|
1599
|
+
keys.push(id);
|
|
1600
|
+
return `<template interpolate end id="${id}"></template>`;
|
|
1601
|
+
});
|
|
1602
|
+
return { string, keys };
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
|
|
1606
|
+
/***/ }),
|
|
1607
|
+
|
|
1608
|
+
/***/ "./ts/isInstance.ts":
|
|
1609
|
+
/*!**************************!*\
|
|
1610
|
+
!*** ./ts/isInstance.ts ***!
|
|
1611
|
+
\**************************/
|
|
1612
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1613
|
+
|
|
1614
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1615
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1616
|
+
/* harmony export */ isSubjectInstance: () => (/* binding */ isSubjectInstance),
|
|
1617
|
+
/* harmony export */ isTagArray: () => (/* binding */ isTagArray),
|
|
1618
|
+
/* harmony export */ isTagComponent: () => (/* binding */ isTagComponent),
|
|
1619
|
+
/* harmony export */ isTagInstance: () => (/* binding */ isTagInstance)
|
|
1620
|
+
/* harmony export */ });
|
|
1621
|
+
function isTagComponent(value) {
|
|
1622
|
+
return value?.isTemplater === true;
|
|
1623
|
+
}
|
|
1624
|
+
function isTagInstance(tag) {
|
|
1625
|
+
return tag?.isTag === true;
|
|
1626
|
+
}
|
|
1627
|
+
function isSubjectInstance(subject) {
|
|
1628
|
+
return (subject?.isSubject === true || subject?.subscribe) ? true : false; // subject?.isSubject === true ||
|
|
1629
|
+
}
|
|
1630
|
+
function isTagArray(value) {
|
|
1631
|
+
return value instanceof Array && value.every(x => isTagInstance(x));
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
|
|
1635
|
+
/***/ }),
|
|
1636
|
+
|
|
1637
|
+
/***/ "./ts/isLikeTags.function.ts":
|
|
1638
|
+
/*!***********************************!*\
|
|
1639
|
+
!*** ./ts/isLikeTags.function.ts ***!
|
|
1640
|
+
\***********************************/
|
|
1641
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1642
|
+
|
|
1643
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1644
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1645
|
+
/* harmony export */ isLikeTags: () => (/* binding */ isLikeTags)
|
|
1646
|
+
/* harmony export */ });
|
|
1647
|
+
function isLikeTags(tag0, tag1) {
|
|
1648
|
+
if (tag0.strings.length !== tag1.strings.length) {
|
|
1649
|
+
return false;
|
|
1650
|
+
}
|
|
1651
|
+
const everyStringMatched = tag0.strings.every((string, index) => tag1.strings[index] === string);
|
|
1652
|
+
if (!everyStringMatched) {
|
|
1653
|
+
return false;
|
|
1654
|
+
}
|
|
1655
|
+
const valuesLengthsMatch = tag0.values.length === tag1.values.length;
|
|
1656
|
+
if (!valuesLengthsMatch) {
|
|
1657
|
+
return false;
|
|
1658
|
+
}
|
|
1659
|
+
const allVarsMatch = tag1.values.every((value, index) => {
|
|
1660
|
+
const compareTo = tag0.values[index];
|
|
1661
|
+
const isFunctions = value instanceof Function && compareTo instanceof Function;
|
|
1662
|
+
if (isFunctions) {
|
|
1663
|
+
const stringMatch = value.toString() === compareTo.toString();
|
|
1664
|
+
if (stringMatch) {
|
|
1665
|
+
return true;
|
|
1666
|
+
}
|
|
1667
|
+
return false;
|
|
1668
|
+
}
|
|
1669
|
+
return true; // deepEqual(value, compareTo)
|
|
1670
|
+
});
|
|
1671
|
+
if (allVarsMatch) {
|
|
1672
|
+
return true;
|
|
1673
|
+
}
|
|
1674
|
+
return false;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
|
|
1678
|
+
/***/ }),
|
|
1679
|
+
|
|
1680
|
+
/***/ "./ts/onDestroy.ts":
|
|
1681
|
+
/*!*************************!*\
|
|
1682
|
+
!*** ./ts/onDestroy.ts ***!
|
|
1683
|
+
\*************************/
|
|
1684
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1685
|
+
|
|
1686
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1687
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1688
|
+
/* harmony export */ onDestroy: () => (/* binding */ onDestroy)
|
|
1689
|
+
/* harmony export */ });
|
|
1690
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
1691
|
+
|
|
1692
|
+
/** When undefined, it means a tag is being built for the first time so do run destroy(s) */
|
|
1693
|
+
let destroyCurrentTagSupport;
|
|
1694
|
+
function onDestroy(callback) {
|
|
1695
|
+
destroyCurrentTagSupport.templater.global.destroyCallback = callback;
|
|
1696
|
+
}
|
|
1697
|
+
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
1698
|
+
beforeRender: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
1699
|
+
beforeRedraw: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
1700
|
+
beforeDestroy: (tagSupport, tag) => {
|
|
1701
|
+
const callback = tagSupport.templater.global.destroyCallback;
|
|
1702
|
+
if (callback) {
|
|
1703
|
+
callback();
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
});
|
|
1707
|
+
|
|
1708
|
+
|
|
1709
|
+
/***/ }),
|
|
1710
|
+
|
|
1711
|
+
/***/ "./ts/onInit.ts":
|
|
1712
|
+
/*!**********************!*\
|
|
1713
|
+
!*** ./ts/onInit.ts ***!
|
|
1714
|
+
\**********************/
|
|
1715
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1716
|
+
|
|
1717
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1718
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1719
|
+
/* harmony export */ onInit: () => (/* binding */ onInit)
|
|
1720
|
+
/* harmony export */ });
|
|
1721
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
1722
|
+
|
|
1723
|
+
function setCurrentTagSupport(support) {
|
|
1724
|
+
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentTemplater = support.templater;
|
|
1725
|
+
}
|
|
1726
|
+
function onInit(callback) {
|
|
1727
|
+
const templater = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentTemplater;
|
|
1728
|
+
if (!templater.global.init) {
|
|
1729
|
+
;
|
|
1730
|
+
templater.global.init = callback;
|
|
1731
|
+
callback(); // fire init
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
1735
|
+
beforeRender: tagSupport => setCurrentTagSupport(tagSupport),
|
|
1736
|
+
beforeRedraw: tagSupport => setCurrentTagSupport(tagSupport),
|
|
1737
|
+
});
|
|
1738
|
+
|
|
1739
|
+
|
|
1740
|
+
/***/ }),
|
|
1741
|
+
|
|
1742
|
+
/***/ "./ts/processAttribute.function.ts":
|
|
1743
|
+
/*!*****************************************!*\
|
|
1744
|
+
!*** ./ts/processAttribute.function.ts ***!
|
|
1745
|
+
\*****************************************/
|
|
1746
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1747
|
+
|
|
1748
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1749
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1750
|
+
/* harmony export */ processAttribute: () => (/* binding */ processAttribute)
|
|
1751
|
+
/* harmony export */ });
|
|
1752
|
+
/* harmony import */ var _inputAttribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./inputAttribute */ "./ts/inputAttribute.ts");
|
|
1753
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
1754
|
+
/* harmony import */ var _bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bindSubjectCallback.function */ "./ts/bindSubjectCallback.function.ts");
|
|
1755
|
+
|
|
1756
|
+
|
|
1757
|
+
|
|
1758
|
+
const startRegX = /^\s*{__tagvar/;
|
|
1759
|
+
const endRegX = /}\s*$/;
|
|
1760
|
+
function isTagVar(value) {
|
|
1761
|
+
return value && value.search(startRegX) >= 0 && value.search(endRegX) >= 0;
|
|
1762
|
+
}
|
|
1763
|
+
function processAttribute(attrName, value, child, scope, ownerTag, howToSet) {
|
|
1764
|
+
if (isTagVar(value)) {
|
|
1765
|
+
return processScopedNameValueAttr(attrName, value, child, scope, ownerTag, howToSet);
|
|
1766
|
+
}
|
|
1767
|
+
if (isTagVar(attrName)) {
|
|
1768
|
+
const contextValueSubject = getContextValueByVarString(scope, attrName);
|
|
1769
|
+
let lastValue;
|
|
1770
|
+
// the above callback gets called immediately since its a ValueSubject()
|
|
1771
|
+
const sub = contextValueSubject.subscribe((value) => {
|
|
1772
|
+
processNameOnlyAttr(value, lastValue, child, ownerTag, howToSet);
|
|
1773
|
+
lastValue = value;
|
|
1774
|
+
});
|
|
1775
|
+
ownerTag.cloneSubs.push(sub); // this is where unsubscribe is picked up
|
|
1776
|
+
child.removeAttribute(attrName);
|
|
1777
|
+
return;
|
|
1778
|
+
}
|
|
1779
|
+
// Non dynamic
|
|
1780
|
+
const isSpecial = isSpecialAttr(attrName);
|
|
1781
|
+
if (isSpecial) {
|
|
1782
|
+
return (0,_inputAttribute__WEBPACK_IMPORTED_MODULE_0__.inputAttribute)(attrName, value, child);
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
function processScopedNameValueAttr(attrName, value, // {__tagVarN}
|
|
1786
|
+
child, scope, ownerTag, howToSet) {
|
|
1787
|
+
// get the code inside the brackets like "variable0" or "{variable0}"
|
|
1788
|
+
const result = getContextValueByVarString(scope, value);
|
|
1789
|
+
return processNameValueAttr(attrName, result, child, ownerTag, howToSet);
|
|
1790
|
+
}
|
|
1791
|
+
function getContextValueByVarString(scope, value) {
|
|
1792
|
+
const code = value.replace('{', '').split('').reverse().join('').replace('}', '').split('').reverse().join('');
|
|
1793
|
+
return scope[code];
|
|
1794
|
+
}
|
|
1795
|
+
function processNameOnlyAttr(attrValue, lastValue, child, ownerTag, howToSet) {
|
|
1796
|
+
if (lastValue && lastValue != attrValue) {
|
|
1797
|
+
if (typeof (lastValue) === 'string') {
|
|
1798
|
+
child.removeAttribute(lastValue);
|
|
1799
|
+
}
|
|
1800
|
+
else if (lastValue instanceof Object) {
|
|
1801
|
+
Object.entries(lastValue).forEach(([name]) => child.removeAttribute(name));
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
if (typeof (attrValue) === 'string') {
|
|
1805
|
+
if (!attrValue.length) {
|
|
1806
|
+
return;
|
|
1807
|
+
}
|
|
1808
|
+
processNameValueAttr(attrValue, '', child, ownerTag, howToSet);
|
|
1809
|
+
return;
|
|
1810
|
+
}
|
|
1811
|
+
if (attrValue instanceof Object) {
|
|
1812
|
+
Object.entries(attrValue).forEach(([name, value]) => processNameValueAttr(name, value, child, ownerTag, howToSet));
|
|
1813
|
+
return;
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
function processNameValueAttr(attrName, result, child, ownerTag, howToSet) {
|
|
1817
|
+
const isSpecial = isSpecialAttr(attrName);
|
|
1818
|
+
// attach as callback?
|
|
1819
|
+
if (result instanceof Function) {
|
|
1820
|
+
const action = function (...args) {
|
|
1821
|
+
const result2 = result(child, args);
|
|
1822
|
+
return result2;
|
|
1823
|
+
};
|
|
1824
|
+
child[attrName].action = action;
|
|
1825
|
+
// child.addEventListener(attrName, action)
|
|
1826
|
+
}
|
|
1827
|
+
// Most every variable comes in here since everything is made a ValueSubject
|
|
1828
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isSubjectInstance)(result)) {
|
|
1829
|
+
child.removeAttribute(attrName);
|
|
1830
|
+
const callback = (newAttrValue) => {
|
|
1831
|
+
if (newAttrValue instanceof Function) {
|
|
1832
|
+
newAttrValue = (0,_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_2__.bindSubjectCallback)(newAttrValue, ownerTag);
|
|
1833
|
+
}
|
|
1834
|
+
return processAttributeSubjectValue(newAttrValue, child, attrName, isSpecial, howToSet);
|
|
1835
|
+
};
|
|
1836
|
+
// 🗞️ Subscribe. Above callback called immediately since its a ValueSubject()
|
|
1837
|
+
const sub = result.subscribe(callback);
|
|
1838
|
+
// Record subscription for later unsubscribe when element destroyed
|
|
1839
|
+
ownerTag.cloneSubs.push(sub);
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
howToSet(child, attrName, result);
|
|
1843
|
+
// child.setAttribute(attrName, result.value)
|
|
1844
|
+
return;
|
|
1845
|
+
}
|
|
1846
|
+
function processAttributeSubjectValue(newAttrValue, child, attrName, isSpecial, howToSet) {
|
|
1847
|
+
if (newAttrValue instanceof Function) {
|
|
1848
|
+
const fun = function (...args) {
|
|
1849
|
+
return newAttrValue(child, args);
|
|
1850
|
+
};
|
|
1851
|
+
// access to original function
|
|
1852
|
+
fun.tagFunction = newAttrValue;
|
|
1853
|
+
child[attrName] = fun;
|
|
1854
|
+
return;
|
|
1855
|
+
}
|
|
1856
|
+
if (isSpecial) {
|
|
1857
|
+
(0,_inputAttribute__WEBPACK_IMPORTED_MODULE_0__.inputAttribute)(attrName, newAttrValue, child);
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
if (newAttrValue) {
|
|
1861
|
+
howToSet(child, attrName, newAttrValue);
|
|
1862
|
+
return;
|
|
1863
|
+
}
|
|
1864
|
+
const isDeadValue = newAttrValue === undefined || newAttrValue === false || newAttrValue === null;
|
|
1865
|
+
if (isDeadValue) {
|
|
1866
|
+
child.removeAttribute(attrName);
|
|
1867
|
+
return;
|
|
1868
|
+
}
|
|
1869
|
+
// value is 0
|
|
1870
|
+
howToSet(child, attrName, newAttrValue);
|
|
1871
|
+
}
|
|
1872
|
+
/** Looking for (class | style) followed by a period */
|
|
1873
|
+
function isSpecialAttr(attrName) {
|
|
1874
|
+
return attrName.search(/^(class|style)(\.)/) >= 0;
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
|
|
1878
|
+
/***/ }),
|
|
1879
|
+
|
|
1880
|
+
/***/ "./ts/processNewValue.function.ts":
|
|
1881
|
+
/*!****************************************!*\
|
|
1882
|
+
!*** ./ts/processNewValue.function.ts ***!
|
|
1883
|
+
\****************************************/
|
|
1884
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1885
|
+
|
|
1886
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1887
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1888
|
+
/* harmony export */ processNewValue: () => (/* binding */ processNewValue)
|
|
1889
|
+
/* harmony export */ });
|
|
1890
|
+
/* harmony import */ var _ValueSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ValueSubject */ "./ts/ValueSubject.ts");
|
|
1891
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
1892
|
+
|
|
1893
|
+
|
|
1894
|
+
function processNewValue(hasValue, value, ownerTag) {
|
|
1895
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value)) {
|
|
1896
|
+
const tagSubject = new _ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1897
|
+
return tagSubject;
|
|
1898
|
+
}
|
|
1899
|
+
if (value instanceof Function) {
|
|
1900
|
+
// return getSubjectFunction(value, ownerTag)
|
|
1901
|
+
return new _ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1902
|
+
}
|
|
1903
|
+
if (!hasValue) {
|
|
1904
|
+
return; // more strings than values, stop here
|
|
1905
|
+
}
|
|
1906
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagInstance)(value)) {
|
|
1907
|
+
value.ownerTag = ownerTag;
|
|
1908
|
+
if (ownerTag.childTags.find(x => x === value)) {
|
|
1909
|
+
throw new Error('about to reattach tag already present - 2');
|
|
1910
|
+
}
|
|
1911
|
+
return new _ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1912
|
+
}
|
|
1913
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isSubjectInstance)(value)) {
|
|
1914
|
+
return value; // its already a value subject
|
|
1915
|
+
}
|
|
1916
|
+
return new _ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
|
|
1920
|
+
/***/ }),
|
|
1921
|
+
|
|
1922
|
+
/***/ "./ts/processRegularValue.function.ts":
|
|
1923
|
+
/*!********************************************!*\
|
|
1924
|
+
!*** ./ts/processRegularValue.function.ts ***!
|
|
1925
|
+
\********************************************/
|
|
1926
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1927
|
+
|
|
1928
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1929
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1930
|
+
/* harmony export */ processRegularValue: () => (/* binding */ processRegularValue)
|
|
1931
|
+
/* harmony export */ });
|
|
1932
|
+
/* harmony import */ var _interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interpolateTemplate */ "./ts/interpolateTemplate.ts");
|
|
1933
|
+
|
|
1934
|
+
function processRegularValue(value, subject, // could be tag via subject.tag
|
|
1935
|
+
template) {
|
|
1936
|
+
subject.template = template;
|
|
1937
|
+
const before = subject.clone || template; // Either the template is on the doc OR its the first element we last put on doc
|
|
1938
|
+
if (subject.lastValue === value) {
|
|
1939
|
+
return; // no need to update display, its the same
|
|
1940
|
+
}
|
|
1941
|
+
subject.lastValue = value;
|
|
1942
|
+
// Processing of regular values
|
|
1943
|
+
const clone = (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__.updateBetweenTemplates)(value, before);
|
|
1944
|
+
subject.clone = clone; // remember single element put down, for future updates
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
|
|
1948
|
+
/***/ }),
|
|
1949
|
+
|
|
1950
|
+
/***/ "./ts/processSubjectComponent.function.ts":
|
|
1951
|
+
/*!************************************************!*\
|
|
1952
|
+
!*** ./ts/processSubjectComponent.function.ts ***!
|
|
1953
|
+
\************************************************/
|
|
1954
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1955
|
+
|
|
1956
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1957
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1958
|
+
/* harmony export */ processSubjectComponent: () => (/* binding */ processSubjectComponent)
|
|
1959
|
+
/* harmony export */ });
|
|
1960
|
+
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
1961
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
1962
|
+
/* harmony import */ var _processTagResult_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./processTagResult.function */ "./ts/processTagResult.function.ts");
|
|
1963
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
1964
|
+
|
|
1965
|
+
|
|
1966
|
+
|
|
1967
|
+
|
|
1968
|
+
function processSubjectComponent(templater, subject, template, ownerTag, options) {
|
|
1969
|
+
// Check if function component is wrapped in a tag() call
|
|
1970
|
+
// TODO: This below check not needed in production mode
|
|
1971
|
+
if (templater.tagged !== true) {
|
|
1972
|
+
const original = templater.wrapper.original;
|
|
1973
|
+
let name = original.name || original.constructor?.name;
|
|
1974
|
+
if (name === 'Function') {
|
|
1975
|
+
name = undefined;
|
|
1976
|
+
}
|
|
1977
|
+
const label = name || original.toString().substring(0, 120);
|
|
1978
|
+
const error = new Error(`Not a tag component. Wrap your function with tag(). Example tag(props => html\`\`) on component:\n\n${label}\n\n`);
|
|
1979
|
+
throw error;
|
|
1980
|
+
}
|
|
1981
|
+
templater.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__.TagSupport(ownerTag.tagSupport, templater, subject);
|
|
1982
|
+
// templater.oldest = subject.tag?.tagSupport.oldest || templater.oldest
|
|
1983
|
+
templater.global.insertBefore = template;
|
|
1984
|
+
let retag = subject.tag;
|
|
1985
|
+
const providers = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
1986
|
+
providers.ownerTag = ownerTag;
|
|
1987
|
+
const isRedraw = !retag || options.forceElement;
|
|
1988
|
+
if (isRedraw) {
|
|
1989
|
+
const preClones = ownerTag.clones.map(clone => clone);
|
|
1990
|
+
retag = (0,_TemplaterResult_class__WEBPACK_IMPORTED_MODULE_0__.renderWithSupport)(templater.tagSupport, subject.tag, // existing tag
|
|
1991
|
+
subject, ownerTag);
|
|
1992
|
+
if (retag.tagSupport.templater.global.newest != retag) {
|
|
1993
|
+
throw new Error('mismatch result newest');
|
|
1994
|
+
}
|
|
1995
|
+
templater.global.newest = retag;
|
|
1996
|
+
if (ownerTag.clones.length > preClones.length) {
|
|
1997
|
+
const myClones = ownerTag.clones.filter(fClone => !preClones.find(clone => clone === fClone));
|
|
1998
|
+
retag.clones.push(...myClones);
|
|
1999
|
+
}
|
|
2000
|
+
if (ownerTag.childTags.find(x => x === retag)) {
|
|
2001
|
+
throw new Error('about to reattach tag already present');
|
|
2002
|
+
}
|
|
2003
|
+
ownerTag.childTags.push(retag);
|
|
2004
|
+
}
|
|
2005
|
+
(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
|
|
2006
|
+
template, // <template end interpolate /> (will be removed)
|
|
2007
|
+
options);
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
|
|
2011
|
+
/***/ }),
|
|
2012
|
+
|
|
2013
|
+
/***/ "./ts/processSubjectValue.function.ts":
|
|
2014
|
+
/*!********************************************!*\
|
|
2015
|
+
!*** ./ts/processSubjectValue.function.ts ***!
|
|
2016
|
+
\********************************************/
|
|
2017
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2018
|
+
|
|
2019
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2020
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2021
|
+
/* harmony export */ applyFakeTemplater: () => (/* binding */ applyFakeTemplater),
|
|
2022
|
+
/* harmony export */ processSubjectValue: () => (/* binding */ processSubjectValue),
|
|
2023
|
+
/* harmony export */ processTag: () => (/* binding */ processTag)
|
|
2024
|
+
/* harmony export */ });
|
|
2025
|
+
/* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/processSubjectComponent.function.ts");
|
|
2026
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
2027
|
+
/* harmony import */ var _processTagArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./processTagArray */ "./ts/processTagArray.ts");
|
|
2028
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
2029
|
+
/* harmony import */ var _ValueSubject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ValueSubject */ "./ts/ValueSubject.ts");
|
|
2030
|
+
/* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/processRegularValue.function.ts");
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
|
|
2036
|
+
|
|
2037
|
+
var ValueTypes;
|
|
2038
|
+
(function (ValueTypes) {
|
|
2039
|
+
ValueTypes["tag"] = "tag";
|
|
2040
|
+
ValueTypes["tagArray"] = "tag-array";
|
|
2041
|
+
ValueTypes["tagComponent"] = "tag-component";
|
|
2042
|
+
ValueTypes["value"] = "value";
|
|
2043
|
+
})(ValueTypes || (ValueTypes = {}));
|
|
2044
|
+
function getValueType(value) {
|
|
2045
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value)) {
|
|
2046
|
+
return ValueTypes.tagComponent;
|
|
2047
|
+
}
|
|
2048
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagInstance)(value)) {
|
|
2049
|
+
return ValueTypes.tag;
|
|
2050
|
+
}
|
|
2051
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagArray)(value)) {
|
|
2052
|
+
return ValueTypes.tagArray;
|
|
2053
|
+
}
|
|
2054
|
+
return ValueTypes.value;
|
|
2055
|
+
}
|
|
2056
|
+
function processSubjectValue(value, subject, // could be tag via result.tag
|
|
2057
|
+
template, // <template end interpolate /> (will be removed)
|
|
2058
|
+
ownerTag, // owner
|
|
2059
|
+
options) {
|
|
2060
|
+
const valueType = getValueType(value);
|
|
2061
|
+
switch (valueType) {
|
|
2062
|
+
case ValueTypes.tag:
|
|
2063
|
+
processTag(value, subject, template, ownerTag);
|
|
2064
|
+
return;
|
|
2065
|
+
case ValueTypes.tagArray:
|
|
2066
|
+
return (0,_processTagArray__WEBPACK_IMPORTED_MODULE_2__.processTagArray)(subject, value, template, ownerTag, options);
|
|
2067
|
+
case ValueTypes.tagComponent:
|
|
2068
|
+
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__.processSubjectComponent)(value, subject, template, ownerTag, options);
|
|
2069
|
+
return;
|
|
2070
|
+
}
|
|
2071
|
+
(0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__.processRegularValue)(value, subject, template);
|
|
2072
|
+
}
|
|
2073
|
+
/** Could be a regular tag or a component. Both are Tag.class */
|
|
2074
|
+
function processTag(tag, subject, // could be tag via result.tag
|
|
2075
|
+
insertBefore, // <template end interpolate /> (will be removed)
|
|
2076
|
+
ownerTag) {
|
|
2077
|
+
// first time seeing this tag?
|
|
2078
|
+
if (!tag.tagSupport) {
|
|
2079
|
+
if (!(0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagInstance)(tag)) {
|
|
2080
|
+
throw new Error('issue non-tag here');
|
|
2081
|
+
}
|
|
2082
|
+
applyFakeTemplater(tag, ownerTag, subject);
|
|
2083
|
+
if (ownerTag.childTags.find(x => x === tag)) {
|
|
2084
|
+
throw new Error('about to reattach tag already present - 5');
|
|
2085
|
+
}
|
|
2086
|
+
ownerTag.childTags.push(tag);
|
|
2087
|
+
}
|
|
2088
|
+
tag.ownerTag = ownerTag;
|
|
2089
|
+
subject.template = insertBefore;
|
|
2090
|
+
tag.buildBeforeElement(insertBefore, {
|
|
2091
|
+
counts: { added: 0, removed: 0 },
|
|
2092
|
+
forceElement: true, test: false,
|
|
2093
|
+
});
|
|
2094
|
+
}
|
|
2095
|
+
function applyFakeTemplater(tag, ownerTag, subject) {
|
|
2096
|
+
if (!ownerTag) {
|
|
2097
|
+
throw new Error('no owner error');
|
|
2098
|
+
}
|
|
2099
|
+
const fakeTemplater = getFakeTemplater();
|
|
2100
|
+
tag.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__.TagSupport(ownerTag.tagSupport, fakeTemplater, // the template is provided via html`` call
|
|
2101
|
+
subject);
|
|
2102
|
+
fakeTemplater.global.oldest = tag;
|
|
2103
|
+
fakeTemplater.global.newest = tag;
|
|
2104
|
+
fakeTemplater.tagSupport = tag.tagSupport;
|
|
2105
|
+
// asking me to render will cause my parent to render
|
|
2106
|
+
tag.ownerTag = ownerTag;
|
|
2107
|
+
}
|
|
2108
|
+
function getFakeTemplater() {
|
|
2109
|
+
return {
|
|
2110
|
+
global: {
|
|
2111
|
+
renderCount: 0,
|
|
2112
|
+
providers: [],
|
|
2113
|
+
context: {},
|
|
2114
|
+
},
|
|
2115
|
+
children: new _ValueSubject__WEBPACK_IMPORTED_MODULE_4__.ValueSubject([]), // no children
|
|
2116
|
+
props: {},
|
|
2117
|
+
isTag: true,
|
|
2118
|
+
};
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
|
|
2122
|
+
/***/ }),
|
|
2123
|
+
|
|
2124
|
+
/***/ "./ts/processTagArray.ts":
|
|
2125
|
+
/*!*******************************!*\
|
|
2126
|
+
!*** ./ts/processTagArray.ts ***!
|
|
2127
|
+
\*******************************/
|
|
2128
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2129
|
+
|
|
2130
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2131
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2132
|
+
/* harmony export */ processTagArray: () => (/* binding */ processTagArray)
|
|
2133
|
+
/* harmony export */ });
|
|
2134
|
+
/* harmony import */ var _ValueSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ValueSubject */ "./ts/ValueSubject.ts");
|
|
2135
|
+
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors */ "./ts/errors.ts");
|
|
2136
|
+
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./checkDestroyPrevious.function */ "./ts/checkDestroyPrevious.function.ts");
|
|
2137
|
+
/* harmony import */ var _processSubjectValue_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processSubjectValue.function */ "./ts/processSubjectValue.function.ts");
|
|
2138
|
+
|
|
2139
|
+
|
|
2140
|
+
|
|
2141
|
+
|
|
2142
|
+
function processTagArray(subject, value, // arry of Tag classes
|
|
2143
|
+
template, // <template end interpolate />
|
|
2144
|
+
ownerTag, options) {
|
|
2145
|
+
const clones = ownerTag.clones; // []
|
|
2146
|
+
let lastArray = subject.lastArray = subject.lastArray || [];
|
|
2147
|
+
subject.template = template;
|
|
2148
|
+
let removed = 0;
|
|
2149
|
+
/** 🗑️ remove previous items first */
|
|
2150
|
+
lastArray = subject.lastArray = subject.lastArray.filter((item, index) => {
|
|
2151
|
+
const newLength = value.length - 1;
|
|
2152
|
+
const at = index - removed;
|
|
2153
|
+
const lessLength = newLength < at;
|
|
2154
|
+
const subTag = value[index - removed];
|
|
2155
|
+
const subArrayValue = subTag?.arrayValue;
|
|
2156
|
+
const destroyItem = lessLength || !areLikeValues(subArrayValue, item.tag.arrayValue);
|
|
2157
|
+
if (destroyItem) {
|
|
2158
|
+
const last = lastArray[index];
|
|
2159
|
+
const tag = last.tag;
|
|
2160
|
+
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_2__.destroyArrayTag)(tag, options.counts);
|
|
2161
|
+
last.deleted = true;
|
|
2162
|
+
++removed;
|
|
2163
|
+
++options.counts.removed;
|
|
2164
|
+
return false;
|
|
2165
|
+
}
|
|
2166
|
+
return true;
|
|
2167
|
+
});
|
|
2168
|
+
// const masterBefore = template || (template as any).clone
|
|
2169
|
+
const before = template || subject.value.insertBefore || template.clone;
|
|
2170
|
+
value.forEach((subTag, index) => {
|
|
2171
|
+
const previous = lastArray[index];
|
|
2172
|
+
const previousSupport = previous?.tag.tagSupport;
|
|
2173
|
+
const fakeSubject = new _ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject({});
|
|
2174
|
+
(0,_processSubjectValue_function__WEBPACK_IMPORTED_MODULE_3__.applyFakeTemplater)(subTag, ownerTag, fakeSubject);
|
|
2175
|
+
if (previousSupport) {
|
|
2176
|
+
subTag.tagSupport.templater.global = previousSupport.templater.global;
|
|
2177
|
+
previousSupport.templater.global.newest = subTag;
|
|
2178
|
+
}
|
|
2179
|
+
// check for html``.key()
|
|
2180
|
+
const keyNotSet = subTag.arrayValue;
|
|
2181
|
+
if (keyNotSet?.isArrayValueNeverSet) {
|
|
2182
|
+
const details = {
|
|
2183
|
+
template: subTag.getTemplate().string,
|
|
2184
|
+
array: value,
|
|
2185
|
+
ownerTagContent: ownerTag.lastTemplateString,
|
|
2186
|
+
};
|
|
2187
|
+
const message = 'Use html`...`.key(item) instead of html`...` to template an Array';
|
|
2188
|
+
console.error(message, details);
|
|
2189
|
+
const err = new _errors__WEBPACK_IMPORTED_MODULE_1__.ArrayNoKeyError(message, details);
|
|
2190
|
+
throw err;
|
|
2191
|
+
}
|
|
2192
|
+
const couldBeSame = lastArray.length > index;
|
|
2193
|
+
if (couldBeSame) {
|
|
2194
|
+
const isSame = areLikeValues(previous.tag.arrayValue, subTag.arrayValue);
|
|
2195
|
+
if (isSame) {
|
|
2196
|
+
subTag.tagSupport = subTag.tagSupport || previous.tag.tagSupport;
|
|
2197
|
+
const oldest = previous.tag.tagSupport.templater.global.oldest;
|
|
2198
|
+
oldest.updateByTag(subTag);
|
|
2199
|
+
return [];
|
|
2200
|
+
}
|
|
2201
|
+
processAddTagArrayItem(before, subTag, index, options, lastArray, true);
|
|
2202
|
+
throw new Error('item should be back');
|
|
2203
|
+
// return [] // removed: item should have been previously deleted and will be added back
|
|
2204
|
+
}
|
|
2205
|
+
processAddTagArrayItem(before, subTag, index, options, lastArray, true);
|
|
2206
|
+
ownerTag.childTags.push(subTag);
|
|
2207
|
+
});
|
|
2208
|
+
return clones;
|
|
2209
|
+
}
|
|
2210
|
+
function processAddTagArrayItem(before, subTag, index, options, lastArray, test) {
|
|
2211
|
+
const lastValue = {
|
|
2212
|
+
tag: subTag, index
|
|
2213
|
+
};
|
|
2214
|
+
// Added to previous array
|
|
2215
|
+
lastArray.push(lastValue);
|
|
2216
|
+
const counts = {
|
|
2217
|
+
added: options.counts.added + index,
|
|
2218
|
+
removed: options.counts.removed,
|
|
2219
|
+
};
|
|
2220
|
+
const lastFirstChild = before; // tag.clones[0] // insertBefore.lastFirstChild
|
|
2221
|
+
if (!lastFirstChild.parentNode) {
|
|
2222
|
+
throw new Error('issue adding array item');
|
|
2223
|
+
}
|
|
2224
|
+
subTag.buildBeforeElement(lastFirstChild, { counts, forceElement: options.forceElement, test });
|
|
2225
|
+
}
|
|
2226
|
+
/** compare two values. If both values are arrays then the items will be compared */
|
|
2227
|
+
function areLikeValues(valueA, valueB) {
|
|
2228
|
+
if (valueA === valueB) {
|
|
2229
|
+
return true;
|
|
2230
|
+
}
|
|
2231
|
+
const bothArrays = valueA instanceof Array && valueB instanceof Array;
|
|
2232
|
+
const matchLengths = bothArrays && valueA.length == valueB.length;
|
|
2233
|
+
if (matchLengths) {
|
|
2234
|
+
return valueA.every((item, index) => item == valueB[index]);
|
|
2235
|
+
}
|
|
2236
|
+
return false;
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
|
|
2240
|
+
/***/ }),
|
|
2241
|
+
|
|
2242
|
+
/***/ "./ts/processTagResult.function.ts":
|
|
2243
|
+
/*!*****************************************!*\
|
|
2244
|
+
!*** ./ts/processTagResult.function.ts ***!
|
|
2245
|
+
\*****************************************/
|
|
2246
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2247
|
+
|
|
2248
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2249
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2250
|
+
/* harmony export */ processTagResult: () => (/* binding */ processTagResult)
|
|
2251
|
+
/* harmony export */ });
|
|
2252
|
+
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
2253
|
+
|
|
2254
|
+
function processTagResult(tag, subject, // used for recording past and current value
|
|
2255
|
+
insertBefore, // <template end interpolate />
|
|
2256
|
+
{ counts, forceElement, }) {
|
|
2257
|
+
if (!insertBefore.parentNode) {
|
|
2258
|
+
throw new Error('before here processTagResult');
|
|
2259
|
+
}
|
|
2260
|
+
// *if appears we already have seen
|
|
2261
|
+
const subjectTag = subject;
|
|
2262
|
+
const existingTag = subjectTag.tag;
|
|
2263
|
+
const previousTag = existingTag?.tagSupport.templater.global.oldest || undefined; // || tag.tagSupport.oldest // subjectTag.tag
|
|
2264
|
+
const justUpdate = previousTag; // && !forceElement
|
|
2265
|
+
if (previousTag) {
|
|
2266
|
+
if (justUpdate) {
|
|
2267
|
+
const areLike = previousTag.isLikeTag(tag);
|
|
2268
|
+
// are we just updating an if we already had?
|
|
2269
|
+
if (areLike) {
|
|
2270
|
+
// components
|
|
2271
|
+
if (subject instanceof Function) {
|
|
2272
|
+
const newTag = subject(previousTag.tagSupport);
|
|
2273
|
+
previousTag.updateByTag(newTag);
|
|
2274
|
+
if (!newTag.tagSupport.templater.global.oldest) {
|
|
2275
|
+
throw new Error('maybe 0');
|
|
2276
|
+
}
|
|
2277
|
+
subjectTag.tag = newTag;
|
|
2278
|
+
if (!newTag.hasLiveElements) {
|
|
2279
|
+
throw new Error('44444 - 2');
|
|
2280
|
+
}
|
|
2281
|
+
return;
|
|
2282
|
+
}
|
|
2283
|
+
previousTag.updateByTag(tag);
|
|
2284
|
+
if (!tag.tagSupport.templater.global.oldest) {
|
|
2285
|
+
throw new Error('maybe 1');
|
|
2286
|
+
}
|
|
2287
|
+
subjectTag.tag = tag;
|
|
2288
|
+
if (!tag.hasLiveElements) {
|
|
2289
|
+
throw new Error('44444 - 3');
|
|
2290
|
+
}
|
|
2291
|
+
return;
|
|
2292
|
+
}
|
|
2293
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_0__.destroyTagMemory)(previousTag, subject);
|
|
2294
|
+
throw new Error('585 - think we never get here');
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
tag.buildBeforeElement(insertBefore, {
|
|
2298
|
+
counts,
|
|
2299
|
+
forceElement, test: false,
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
|
|
2304
|
+
/***/ }),
|
|
2305
|
+
|
|
2306
|
+
/***/ "./ts/provider.utils.ts":
|
|
2307
|
+
/*!******************************!*\
|
|
2308
|
+
!*** ./ts/provider.utils.ts ***!
|
|
2309
|
+
\******************************/
|
|
2310
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2311
|
+
|
|
2312
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2313
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2314
|
+
/* harmony export */ providersChangeCheck: () => (/* binding */ providersChangeCheck)
|
|
2315
|
+
/* harmony export */ });
|
|
2316
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
2317
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
2318
|
+
|
|
2319
|
+
|
|
2320
|
+
function providersChangeCheck(tag) {
|
|
2321
|
+
const global = tag.tagSupport.templater.global;
|
|
2322
|
+
const providersWithChanges = global.providers.filter(provider => !(0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(provider.instance, provider.clone));
|
|
2323
|
+
// reset clones
|
|
2324
|
+
providersWithChanges.forEach(provider => {
|
|
2325
|
+
const appElement = tag.getAppElement();
|
|
2326
|
+
handleProviderChanges(appElement, provider);
|
|
2327
|
+
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
2328
|
+
});
|
|
2329
|
+
}
|
|
2330
|
+
function handleProviderChanges(appElement, provider) {
|
|
2331
|
+
const tagsWithProvider = getTagsWithProvider(appElement, provider);
|
|
2332
|
+
tagsWithProvider.forEach(({ tag, renderCount, provider }) => {
|
|
2333
|
+
if (tag.tagSupport.templater.global.deleted) {
|
|
2334
|
+
return; // i was deleted after another tag processed
|
|
2335
|
+
}
|
|
2336
|
+
const notRendered = renderCount === tag.tagSupport.templater.global.renderCount;
|
|
2337
|
+
if (notRendered) {
|
|
2338
|
+
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
2339
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(tag.tagSupport, false);
|
|
2340
|
+
}
|
|
2341
|
+
});
|
|
2342
|
+
}
|
|
2343
|
+
function getTagsWithProvider(tag, provider, memory = []) {
|
|
2344
|
+
const global = tag.tagSupport.templater.global;
|
|
2345
|
+
const compare = global.providers;
|
|
2346
|
+
const hasProvider = compare.find(xProvider => xProvider.constructMethod === provider.constructMethod);
|
|
2347
|
+
if (hasProvider) {
|
|
2348
|
+
memory.push({
|
|
2349
|
+
tag,
|
|
2350
|
+
renderCount: global.renderCount,
|
|
2351
|
+
provider: hasProvider,
|
|
2352
|
+
});
|
|
2353
|
+
}
|
|
2354
|
+
tag.childTags.forEach(child => getTagsWithProvider(child, provider, memory));
|
|
2355
|
+
memory.forEach(({ tag }) => {
|
|
2356
|
+
if (tag.tagSupport.templater.global.deleted) {
|
|
2357
|
+
throw new Error('do not get here - 0');
|
|
2358
|
+
}
|
|
2359
|
+
});
|
|
2360
|
+
return memory;
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
|
|
2364
|
+
/***/ }),
|
|
2365
|
+
|
|
2366
|
+
/***/ "./ts/providers.ts":
|
|
2367
|
+
/*!*************************!*\
|
|
2368
|
+
!*** ./ts/providers.ts ***!
|
|
2369
|
+
\*************************/
|
|
2370
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2371
|
+
|
|
2372
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2373
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2374
|
+
/* harmony export */ providers: () => (/* binding */ providers)
|
|
2375
|
+
/* harmony export */ });
|
|
2376
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
2377
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
2378
|
+
|
|
2379
|
+
|
|
2380
|
+
// TODO: rename
|
|
2381
|
+
_setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig = {
|
|
2382
|
+
providers: [],
|
|
2383
|
+
//currentTagSupport: undefined as TagSupport | undefined,
|
|
2384
|
+
ownerTag: undefined,
|
|
2385
|
+
};
|
|
2386
|
+
function get(constructMethod) {
|
|
2387
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
2388
|
+
const providers = config.providers;
|
|
2389
|
+
return providers.find(provider => provider.constructMethod === constructMethod);
|
|
2390
|
+
}
|
|
2391
|
+
const providers = {
|
|
2392
|
+
create: (constructMethod) => {
|
|
2393
|
+
const existing = get(constructMethod);
|
|
2394
|
+
if (existing) {
|
|
2395
|
+
existing.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(existing.instance);
|
|
2396
|
+
return existing.instance;
|
|
2397
|
+
}
|
|
2398
|
+
// Providers with provider requirements just need to use providers.create() and providers.inject()
|
|
2399
|
+
const instance = constructMethod.constructor ? new constructMethod() : constructMethod();
|
|
2400
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
2401
|
+
config.providers.push({
|
|
2402
|
+
constructMethod,
|
|
2403
|
+
instance,
|
|
2404
|
+
clone: (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(instance)
|
|
2405
|
+
});
|
|
2406
|
+
return instance;
|
|
2407
|
+
},
|
|
2408
|
+
/**
|
|
2409
|
+
* @template T
|
|
2410
|
+
* @param {(new (...args: any[]) => T) | () => T} constructor
|
|
2411
|
+
* @returns {T}
|
|
2412
|
+
*/
|
|
2413
|
+
inject: (constructor) => {
|
|
2414
|
+
const oldValue = get(constructor);
|
|
2415
|
+
if (oldValue) {
|
|
2416
|
+
return oldValue.instance;
|
|
2417
|
+
}
|
|
2418
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
2419
|
+
let owner = {
|
|
2420
|
+
ownerTag: config.ownerTag
|
|
2421
|
+
};
|
|
2422
|
+
while (owner.ownerTag) {
|
|
2423
|
+
const ownerProviders = owner.ownerTag.tagSupport.templater.global.providers;
|
|
2424
|
+
const provider = ownerProviders.find(provider => {
|
|
2425
|
+
if (provider.constructMethod === constructor) {
|
|
2426
|
+
return true;
|
|
2427
|
+
}
|
|
2428
|
+
});
|
|
2429
|
+
if (provider) {
|
|
2430
|
+
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance); // keep a copy of the latest before any change occur
|
|
2431
|
+
config.providers.push(provider);
|
|
2432
|
+
return provider.instance;
|
|
2433
|
+
}
|
|
2434
|
+
owner = owner.ownerTag; // cause reloop
|
|
2435
|
+
}
|
|
2436
|
+
const msg = `Could not inject provider: ${constructor.name} ${constructor}`;
|
|
2437
|
+
console.warn(`${msg}. Available providers`, config.providers);
|
|
2438
|
+
throw new Error(msg);
|
|
2439
|
+
}
|
|
2440
|
+
};
|
|
2441
|
+
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse)({
|
|
2442
|
+
beforeRender: (tagSupport, ownerTag) => {
|
|
2443
|
+
run(tagSupport, ownerTag);
|
|
2444
|
+
},
|
|
2445
|
+
beforeRedraw: (tagSupport, tag) => {
|
|
2446
|
+
run(tagSupport, tag.ownerTag);
|
|
2447
|
+
},
|
|
2448
|
+
afterRender: (tagSupport) => {
|
|
2449
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
2450
|
+
tagSupport.templater.global.providers = [...config.providers];
|
|
2451
|
+
config.providers.length = 0;
|
|
2452
|
+
}
|
|
2453
|
+
});
|
|
2454
|
+
function run(tagSupport, ownerTag) {
|
|
2455
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
2456
|
+
// config.currentTagSupport = tagSupport
|
|
2457
|
+
config.ownerTag = ownerTag;
|
|
2458
|
+
if (tagSupport.templater.global.providers.length) {
|
|
2459
|
+
config.providers.length = 0;
|
|
2460
|
+
config.providers.push(...tagSupport.templater.global.providers);
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
|
|
2465
|
+
/***/ }),
|
|
2466
|
+
|
|
2467
|
+
/***/ "./ts/render.ts":
|
|
2468
|
+
/*!**********************!*\
|
|
2469
|
+
!*** ./ts/render.ts ***!
|
|
2470
|
+
\**********************/
|
|
2471
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2472
|
+
|
|
2473
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2474
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2475
|
+
/* harmony export */ buildClones: () => (/* binding */ buildClones)
|
|
2476
|
+
/* harmony export */ });
|
|
2477
|
+
function buildClones(temporary, insertBefore) {
|
|
2478
|
+
const clones = [];
|
|
2479
|
+
const template = temporary.children[0];
|
|
2480
|
+
let nextSibling = template.content.firstChild;
|
|
2481
|
+
while (nextSibling) {
|
|
2482
|
+
const nextNextSibling = nextSibling.nextSibling;
|
|
2483
|
+
buildSibling(nextSibling, insertBefore);
|
|
2484
|
+
clones.push(nextSibling);
|
|
2485
|
+
nextSibling = nextNextSibling;
|
|
2486
|
+
}
|
|
2487
|
+
return clones;
|
|
2488
|
+
}
|
|
2489
|
+
function buildSibling(nextSibling, insertBefore) {
|
|
2490
|
+
const parentNode = insertBefore.parentNode;
|
|
2491
|
+
parentNode.insertBefore(nextSibling, insertBefore);
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
|
|
2495
|
+
/***/ }),
|
|
2496
|
+
|
|
2497
|
+
/***/ "./ts/renderExistingTag.function.ts":
|
|
2498
|
+
/*!******************************************!*\
|
|
2499
|
+
!*** ./ts/renderExistingTag.function.ts ***!
|
|
2500
|
+
\******************************************/
|
|
2501
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2502
|
+
|
|
2503
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2504
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2505
|
+
/* harmony export */ renderExistingTag: () => (/* binding */ renderExistingTag)
|
|
2506
|
+
/* harmony export */ });
|
|
2507
|
+
/* harmony import */ var _provider_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./provider.utils */ "./ts/provider.utils.ts");
|
|
2508
|
+
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
2509
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
2510
|
+
|
|
2511
|
+
|
|
2512
|
+
|
|
2513
|
+
/** Returns true when rendering owner is not needed. Returns false when rendering owner should occur */
|
|
2514
|
+
function renderExistingTag(oldestTag, // existing tag already there
|
|
2515
|
+
newTemplater, tagSupport, subject) {
|
|
2516
|
+
newTemplater.global = subject.tag.tagSupport.templater.global;
|
|
2517
|
+
if (!oldestTag.hasLiveElements) {
|
|
2518
|
+
throw new Error('1080 - should have live elements');
|
|
2519
|
+
}
|
|
2520
|
+
const preRenderCount = tagSupport.templater.global.renderCount;
|
|
2521
|
+
(0,_provider_utils__WEBPACK_IMPORTED_MODULE_0__.providersChangeCheck)(oldestTag);
|
|
2522
|
+
// When the providers were checked, a render to myself occurred and I do not need to re-render again
|
|
2523
|
+
const latestTag = tagSupport.templater.global.newest;
|
|
2524
|
+
if (preRenderCount !== tagSupport.templater.global.renderCount) {
|
|
2525
|
+
oldestTag.updateByTag(latestTag);
|
|
2526
|
+
return latestTag;
|
|
2527
|
+
}
|
|
2528
|
+
const oldTemplater = tagSupport.templater || newTemplater;
|
|
2529
|
+
const redraw = (0,_TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__.renderWithSupport)(newTemplater.tagSupport, subject.tag || oldTemplater.global.newest || oldTemplater.global.oldest, // hmmmmmm, why not newest?
|
|
2530
|
+
subject, oldestTag.ownerTag);
|
|
2531
|
+
const oldest = tagSupport.templater.global.oldest || oldestTag;
|
|
2532
|
+
redraw.tagSupport.templater.global.oldest = oldest;
|
|
2533
|
+
if ((0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__.isLikeTags)(latestTag, redraw)) {
|
|
2534
|
+
subject.tag = redraw;
|
|
2535
|
+
oldest.updateByTag(redraw);
|
|
2536
|
+
}
|
|
2537
|
+
return redraw;
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
|
|
2541
|
+
/***/ }),
|
|
2542
|
+
|
|
2543
|
+
/***/ "./ts/renderTagSupport.function.ts":
|
|
2544
|
+
/*!*****************************************!*\
|
|
2545
|
+
!*** ./ts/renderTagSupport.function.ts ***!
|
|
2546
|
+
\*****************************************/
|
|
2547
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2548
|
+
|
|
2549
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2550
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2551
|
+
/* harmony export */ renderTagSupport: () => (/* binding */ renderTagSupport)
|
|
2552
|
+
/* harmony export */ });
|
|
2553
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
2554
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
2555
|
+
/* harmony import */ var _renderExistingTag_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./renderExistingTag.function */ "./ts/renderExistingTag.function.ts");
|
|
2556
|
+
|
|
2557
|
+
|
|
2558
|
+
|
|
2559
|
+
/** Main function used by all other callers to render/update display of a tag component */
|
|
2560
|
+
function renderTagSupport(tagSupport, renderUp) {
|
|
2561
|
+
const global = tagSupport.templater.global;
|
|
2562
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagInstance)(tagSupport.templater)) {
|
|
2563
|
+
const newTag = global.newest;
|
|
2564
|
+
const ownerTag = newTag.ownerTag;
|
|
2565
|
+
++global.renderCount;
|
|
2566
|
+
return renderTagSupport(ownerTag.tagSupport, true);
|
|
2567
|
+
}
|
|
2568
|
+
// const oldTagSetup = this
|
|
2569
|
+
const subject = tagSupport.subject;
|
|
2570
|
+
const templater = tagSupport.templater; // oldTagSetup.templater // templater
|
|
2571
|
+
const subjectTag = subject.tag;
|
|
2572
|
+
const newest = subjectTag?.tagSupport.templater.global.newest;
|
|
2573
|
+
let ownerTag;
|
|
2574
|
+
let selfPropChange = false;
|
|
2575
|
+
const shouldRenderUp = renderUp && newest;
|
|
2576
|
+
if (shouldRenderUp) {
|
|
2577
|
+
ownerTag = newest.ownerTag;
|
|
2578
|
+
if (ownerTag) {
|
|
2579
|
+
const nowProps = templater.props;
|
|
2580
|
+
const latestProps = newest.tagSupport.propsConfig.latestCloned;
|
|
2581
|
+
selfPropChange = !(0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(nowProps, latestProps);
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
const useTagSupport = global.newest?.tagSupport; // oldTagSetup
|
|
2585
|
+
if (!templater.global.oldest) {
|
|
2586
|
+
throw new Error('already causing trouble');
|
|
2587
|
+
}
|
|
2588
|
+
const tag = (0,_renderExistingTag_function__WEBPACK_IMPORTED_MODULE_2__.renderExistingTag)(templater.global.oldest, templater, useTagSupport, subject);
|
|
2589
|
+
const renderOwner = ownerTag && selfPropChange;
|
|
2590
|
+
if (renderOwner) {
|
|
2591
|
+
const ownerTagSupport = ownerTag.tagSupport;
|
|
2592
|
+
renderTagSupport(ownerTagSupport, true);
|
|
2593
|
+
return tag;
|
|
2594
|
+
}
|
|
2595
|
+
return tag;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
|
|
2599
|
+
/***/ }),
|
|
2600
|
+
|
|
2601
|
+
/***/ "./ts/scanTextAreaValue.function.ts":
|
|
2602
|
+
/*!******************************************!*\
|
|
2603
|
+
!*** ./ts/scanTextAreaValue.function.ts ***!
|
|
2604
|
+
\******************************************/
|
|
2605
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2606
|
+
|
|
2607
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2608
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2609
|
+
/* harmony export */ scanTextAreaValue: () => (/* binding */ scanTextAreaValue)
|
|
2610
|
+
/* harmony export */ });
|
|
2611
|
+
/* harmony import */ var _processAttribute_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./processAttribute.function */ "./ts/processAttribute.function.ts");
|
|
2612
|
+
|
|
2613
|
+
const search = new RegExp('\\s*<template interpolate end id="__tagvar(\\d{1,4})"([^>]*)></template>(\\s*)');
|
|
2614
|
+
function scanTextAreaValue(textarea, context, ownerTag) {
|
|
2615
|
+
const value = textarea.value;
|
|
2616
|
+
if (value.search(search) >= 0) {
|
|
2617
|
+
const match = value.match(/__tagvar(\d{1,4})/);
|
|
2618
|
+
const token = match ? match[0] : '';
|
|
2619
|
+
const dynamic = '{' + token + '}';
|
|
2620
|
+
textarea.value = '';
|
|
2621
|
+
textarea.setAttribute('text-var-value', dynamic);
|
|
2622
|
+
const howToSet = (_elm, _name, value) => textarea.value = value;
|
|
2623
|
+
(0,_processAttribute_function__WEBPACK_IMPORTED_MODULE_0__.processAttribute)('text-var-value', dynamic, // realValue, // context[token].value,
|
|
2624
|
+
textarea, context, ownerTag, howToSet);
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
|
|
2629
|
+
/***/ }),
|
|
2630
|
+
|
|
2631
|
+
/***/ "./ts/set.function.ts":
|
|
2632
|
+
/*!****************************!*\
|
|
2633
|
+
!*** ./ts/set.function.ts ***!
|
|
2634
|
+
\****************************/
|
|
2635
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2636
|
+
|
|
2637
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2638
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2639
|
+
/* harmony export */ StateEchoBack: () => (/* binding */ StateEchoBack),
|
|
2640
|
+
/* harmony export */ getStateValue: () => (/* binding */ getStateValue),
|
|
2641
|
+
/* harmony export */ set: () => (/* binding */ set)
|
|
2642
|
+
/* harmony export */ });
|
|
2643
|
+
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./errors */ "./ts/errors.ts");
|
|
2644
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
2645
|
+
|
|
2646
|
+
|
|
2647
|
+
// TODO: rename
|
|
2648
|
+
_setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig = {
|
|
2649
|
+
array: [], // state memory on the first render
|
|
2650
|
+
// rearray: [] as StateConfigArray, // state memory to be used before the next render
|
|
2651
|
+
};
|
|
2652
|
+
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse)({
|
|
2653
|
+
beforeRender: (tagSupport) => initState(tagSupport),
|
|
2654
|
+
beforeRedraw: (tagSupport) => initState(tagSupport),
|
|
2655
|
+
afterRender: (tagSupport) => {
|
|
2656
|
+
const state = tagSupport.memory.state;
|
|
2657
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2658
|
+
const rearray = config.rearray;
|
|
2659
|
+
if (rearray.length) {
|
|
2660
|
+
if (rearray.length !== config.array.length) {
|
|
2661
|
+
const message = `States lengths has changed ${rearray.length} !== ${config.array.length}. Typically occurs when a function is intended to be wrapped with a tag() call`;
|
|
2662
|
+
const details = {
|
|
2663
|
+
oldStates: config.array,
|
|
2664
|
+
newStates: config.rearray,
|
|
2665
|
+
component: tagSupport.templater?.wrapper.original,
|
|
2666
|
+
};
|
|
2667
|
+
const error = new _errors__WEBPACK_IMPORTED_MODULE_0__.StateMismatchError(message, details);
|
|
2668
|
+
console.warn(message, details);
|
|
2669
|
+
throw error;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
delete config.rearray; // clean up any previous runs
|
|
2673
|
+
state.newest = config.array; // [...config.array]
|
|
2674
|
+
state.newest.forEach(item => item.lastValue = getStateValue(item)); // set last values
|
|
2675
|
+
config.array = [];
|
|
2676
|
+
}
|
|
2677
|
+
});
|
|
2678
|
+
function getStateValue(
|
|
2679
|
+
// state: StateConfig,
|
|
2680
|
+
state) {
|
|
2681
|
+
const callback = state.callback;
|
|
2682
|
+
if (!callback) {
|
|
2683
|
+
return state.defaultValue;
|
|
2684
|
+
}
|
|
2685
|
+
const oldState = callback(StateEchoBack); // get value and set to undefined
|
|
2686
|
+
const [oldValue] = oldState;
|
|
2687
|
+
const [checkValue] = callback(oldValue); // set back to original value
|
|
2688
|
+
if (checkValue !== StateEchoBack) {
|
|
2689
|
+
const message = 'State property not used correctly. Second item in array is not setting value as expected.\n\n' +
|
|
2690
|
+
'For "let" state use `let name = state(default)(x => [name, name = x])`\n\n' +
|
|
2691
|
+
'For "const" state use `const name = state(default)()`\n\n' +
|
|
2692
|
+
'Problem state:\n' + (callback ? callback.toString() : JSON.stringify(state)) + '\n';
|
|
2693
|
+
console.error(message, { state, callback, oldState, oldValue, checkValue });
|
|
2694
|
+
throw new Error(message);
|
|
2695
|
+
}
|
|
2696
|
+
// state.lastValue = oldValue
|
|
2697
|
+
return oldValue;
|
|
2698
|
+
}
|
|
2699
|
+
class StateEchoBack {
|
|
2700
|
+
}
|
|
2701
|
+
function initState(tagSupport) {
|
|
2702
|
+
const state = tagSupport.memory.state;
|
|
2703
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2704
|
+
// TODO: This guard may no longer be needed
|
|
2705
|
+
if (config.rearray) {
|
|
2706
|
+
const message = 'last state not cleared. Possibly in the middle of rendering one component and another is trying to render';
|
|
2707
|
+
console.error(message, {
|
|
2708
|
+
config,
|
|
2709
|
+
component: tagSupport.templater?.wrapper.original,
|
|
2710
|
+
wasInMiddleOf: config.tagSupport?.templater.wrapper.original,
|
|
2711
|
+
state,
|
|
2712
|
+
expectedClearArray: config.rearray,
|
|
2713
|
+
});
|
|
2714
|
+
throw new _errors__WEBPACK_IMPORTED_MODULE_0__.StateMismatchError(message, {
|
|
2715
|
+
config,
|
|
2716
|
+
component: tagSupport.templater?.wrapper.original,
|
|
2717
|
+
state,
|
|
2718
|
+
expectedClearArray: config.rearray,
|
|
2719
|
+
});
|
|
2720
|
+
}
|
|
2721
|
+
// TODO: this maybe redundant and not needed
|
|
2722
|
+
config.rearray = []; // .length = 0
|
|
2723
|
+
if (state?.newest.length) {
|
|
2724
|
+
state.newest.map(state => getStateValue(state));
|
|
2725
|
+
config.rearray.push(...state.newest);
|
|
2726
|
+
}
|
|
2727
|
+
config.tagSupport = tagSupport;
|
|
2728
|
+
}
|
|
2729
|
+
/** Used for variables that need to remain the same variable during render passes */
|
|
2730
|
+
function set(defaultValue) {
|
|
2731
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2732
|
+
let getSetMethod;
|
|
2733
|
+
const rearray = config.rearray;
|
|
2734
|
+
const restate = rearray[config.array.length];
|
|
2735
|
+
if (restate) {
|
|
2736
|
+
let oldValue = getStateValue(restate);
|
|
2737
|
+
getSetMethod = ((x) => [oldValue, oldValue = x]);
|
|
2738
|
+
const push = {
|
|
2739
|
+
get: () => getStateValue(push),
|
|
2740
|
+
callback: getSetMethod,
|
|
2741
|
+
lastValue: oldValue,
|
|
2742
|
+
defaultValue: restate.defaultValue,
|
|
2743
|
+
};
|
|
2744
|
+
config.array.push(push);
|
|
2745
|
+
return oldValue;
|
|
2746
|
+
}
|
|
2747
|
+
// State first time run
|
|
2748
|
+
const defaultFn = defaultValue instanceof Function ? defaultValue : () => defaultValue;
|
|
2749
|
+
let initValue = defaultFn();
|
|
2750
|
+
getSetMethod = ((x) => [initValue, initValue = x]);
|
|
2751
|
+
const push = {
|
|
2752
|
+
get: () => getStateValue(push),
|
|
2753
|
+
callback: getSetMethod,
|
|
2754
|
+
lastValue: initValue,
|
|
2755
|
+
defaultValue: initValue,
|
|
2756
|
+
};
|
|
2757
|
+
config.array.push(push);
|
|
2758
|
+
return initValue;
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
|
|
2762
|
+
/***/ }),
|
|
2763
|
+
|
|
2764
|
+
/***/ "./ts/setLet.function.ts":
|
|
2765
|
+
/*!*******************************!*\
|
|
2766
|
+
!*** ./ts/setLet.function.ts ***!
|
|
2767
|
+
\*******************************/
|
|
2768
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2769
|
+
|
|
2770
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2771
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2772
|
+
/* harmony export */ setLet: () => (/* binding */ setLet)
|
|
2773
|
+
/* harmony export */ });
|
|
2774
|
+
/* harmony import */ var _set_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./set.function */ "./ts/set.function.ts");
|
|
2775
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
2776
|
+
|
|
2777
|
+
|
|
2778
|
+
/** Used for variables that need to remain the same variable during render passes */
|
|
2779
|
+
function setLet(defaultValue) {
|
|
2780
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2781
|
+
const rearray = config.rearray;
|
|
2782
|
+
let getSetMethod;
|
|
2783
|
+
const restate = rearray[config.array.length];
|
|
2784
|
+
if (restate) {
|
|
2785
|
+
let oldValue = (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(restate);
|
|
2786
|
+
getSetMethod = ((x) => [oldValue, oldValue = x]);
|
|
2787
|
+
const push = {
|
|
2788
|
+
get: () => (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2789
|
+
callback: getSetMethod,
|
|
2790
|
+
lastValue: oldValue,
|
|
2791
|
+
defaultValue: restate.defaultValue,
|
|
2792
|
+
};
|
|
2793
|
+
config.array.push(push);
|
|
2794
|
+
return makeStateResult(oldValue, push);
|
|
2795
|
+
}
|
|
2796
|
+
// State first time run
|
|
2797
|
+
const defaultFn = defaultValue instanceof Function ? defaultValue : () => defaultValue;
|
|
2798
|
+
let initValue = defaultFn();
|
|
2799
|
+
getSetMethod = ((x) => [initValue, initValue = x]);
|
|
2800
|
+
const push = {
|
|
2801
|
+
get: () => (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2802
|
+
callback: getSetMethod,
|
|
2803
|
+
lastValue: initValue,
|
|
2804
|
+
defaultValue: initValue,
|
|
2805
|
+
};
|
|
2806
|
+
config.array.push(push);
|
|
2807
|
+
return makeStateResult(initValue, push);
|
|
2808
|
+
}
|
|
2809
|
+
function makeStateResult(initValue, push) {
|
|
2810
|
+
// return initValue
|
|
2811
|
+
const result = (y) => {
|
|
2812
|
+
push.callback = y || (x => [initValue, initValue = x]);
|
|
2813
|
+
return initValue;
|
|
2814
|
+
};
|
|
2815
|
+
return result;
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
|
|
2819
|
+
/***/ }),
|
|
2820
|
+
|
|
2821
|
+
/***/ "./ts/setProp.function.ts":
|
|
2822
|
+
/*!********************************!*\
|
|
2823
|
+
!*** ./ts/setProp.function.ts ***!
|
|
2824
|
+
\********************************/
|
|
2825
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2826
|
+
|
|
2827
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2828
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2829
|
+
/* harmony export */ setProp: () => (/* binding */ setProp)
|
|
2830
|
+
/* harmony export */ });
|
|
2831
|
+
/* harmony import */ var _set_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./set.function */ "./ts/set.function.ts");
|
|
2832
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
2833
|
+
|
|
2834
|
+
|
|
2835
|
+
/** Used for variables that need to remain the same variable during render passes */
|
|
2836
|
+
function setProp(getSet) {
|
|
2837
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2838
|
+
const rearray = config.rearray;
|
|
2839
|
+
const [propValue] = getSet(undefined);
|
|
2840
|
+
getSet(propValue); // restore original value instead of undefined
|
|
2841
|
+
const restate = rearray[config.array.length];
|
|
2842
|
+
if (restate) {
|
|
2843
|
+
let watchValue = restate.watch;
|
|
2844
|
+
let oldValue = (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(restate);
|
|
2845
|
+
const push = {
|
|
2846
|
+
get: () => (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2847
|
+
callback: getSet,
|
|
2848
|
+
lastValue: oldValue,
|
|
2849
|
+
watch: restate.watch,
|
|
2850
|
+
};
|
|
2851
|
+
// has the prop value changed?
|
|
2852
|
+
if (propValue != watchValue) {
|
|
2853
|
+
push.watch = propValue;
|
|
2854
|
+
oldValue = push.lastValue = propValue;
|
|
2855
|
+
}
|
|
2856
|
+
config.array.push(push);
|
|
2857
|
+
getSet(oldValue);
|
|
2858
|
+
return oldValue;
|
|
2859
|
+
}
|
|
2860
|
+
const push = {
|
|
2861
|
+
get: () => (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2862
|
+
callback: getSet,
|
|
2863
|
+
lastValue: propValue,
|
|
2864
|
+
watch: propValue,
|
|
2865
|
+
};
|
|
2866
|
+
config.array.push(push);
|
|
2867
|
+
return propValue;
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
|
|
2871
|
+
/***/ }),
|
|
2872
|
+
|
|
2873
|
+
/***/ "./ts/setUse.function.ts":
|
|
2874
|
+
/*!*******************************!*\
|
|
2875
|
+
!*** ./ts/setUse.function.ts ***!
|
|
2876
|
+
\*******************************/
|
|
2877
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2878
|
+
|
|
2879
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2880
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2881
|
+
/* harmony export */ setUse: () => (/* binding */ setUse)
|
|
2882
|
+
/* harmony export */ });
|
|
2883
|
+
const tagUse = [];
|
|
2884
|
+
function setUse(use) {
|
|
2885
|
+
// must provide defaults
|
|
2886
|
+
const useMe = {
|
|
2887
|
+
beforeRender: use.beforeRender || (() => undefined),
|
|
2888
|
+
beforeRedraw: use.beforeRedraw || (() => undefined),
|
|
2889
|
+
afterRender: use.afterRender || (() => undefined),
|
|
2890
|
+
beforeDestroy: use.beforeDestroy || (() => undefined),
|
|
2891
|
+
};
|
|
2892
|
+
setUse.tagUse.push(useMe);
|
|
2893
|
+
}
|
|
2894
|
+
setUse.tagUse = tagUse;
|
|
2895
|
+
setUse.memory = {};
|
|
2896
|
+
|
|
2897
|
+
|
|
2898
|
+
/***/ }),
|
|
2899
|
+
|
|
2900
|
+
/***/ "./ts/tag.ts":
|
|
2901
|
+
/*!*******************!*\
|
|
2902
|
+
!*** ./ts/tag.ts ***!
|
|
2903
|
+
\*******************/
|
|
2904
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2905
|
+
|
|
2906
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2907
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2908
|
+
/* harmony export */ tag: () => (/* binding */ tag),
|
|
2909
|
+
/* harmony export */ tags: () => (/* binding */ tags)
|
|
2910
|
+
/* harmony export */ });
|
|
2911
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
2912
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
2913
|
+
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
2914
|
+
/* harmony import */ var _ValueSubject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ValueSubject */ "./ts/ValueSubject.ts");
|
|
2915
|
+
/* harmony import */ var _bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bindSubjectCallback.function */ "./ts/bindSubjectCallback.function.ts");
|
|
2916
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
2917
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
2918
|
+
/* harmony import */ var _alterProps_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./alterProps.function */ "./ts/alterProps.function.ts");
|
|
2919
|
+
|
|
2920
|
+
|
|
2921
|
+
|
|
2922
|
+
|
|
2923
|
+
|
|
2924
|
+
|
|
2925
|
+
|
|
2926
|
+
|
|
2927
|
+
const tags = [];
|
|
2928
|
+
let tagCount = 0;
|
|
2929
|
+
/** Wraps a tag component in a state manager and always push children to last argument as an array */
|
|
2930
|
+
// export function tag<T>(a: T): T;
|
|
2931
|
+
function tag(tagComponent) {
|
|
2932
|
+
const result = (function tagWrapper(props, children) {
|
|
2933
|
+
const isPropTag = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagInstance)(props) || (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagArray)(props);
|
|
2934
|
+
if (isPropTag) {
|
|
2935
|
+
children = props;
|
|
2936
|
+
props = undefined;
|
|
2937
|
+
}
|
|
2938
|
+
const { childSubject, madeSubject } = kidsToTagArraySubject(children);
|
|
2939
|
+
childSubject.isChildSubject = true;
|
|
2940
|
+
const templater = new _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_2__.TemplaterResult(props, childSubject);
|
|
2941
|
+
const innerTagWrap = getTagWrap(templater, madeSubject);
|
|
2942
|
+
innerTagWrap.original = tagComponent;
|
|
2943
|
+
templater.tagged = true;
|
|
2944
|
+
templater.wrapper = innerTagWrap;
|
|
2945
|
+
return templater;
|
|
2946
|
+
}); // we override the function provided and pretend original is what's returned
|
|
2947
|
+
updateResult(result, tagComponent);
|
|
2948
|
+
// group tags together and have hmr pickup
|
|
2949
|
+
updateComponent(tagComponent);
|
|
2950
|
+
tags.push(tagComponent);
|
|
2951
|
+
return result;
|
|
2952
|
+
}
|
|
2953
|
+
function kidsToTagArraySubject(children) {
|
|
2954
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isSubjectInstance)(children)) {
|
|
2955
|
+
return { childSubject: children, madeSubject: false };
|
|
2956
|
+
}
|
|
2957
|
+
const kidArray = children;
|
|
2958
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagArray)(kidArray)) {
|
|
2959
|
+
return { childSubject: new _ValueSubject__WEBPACK_IMPORTED_MODULE_3__.ValueSubject(children), madeSubject: true };
|
|
2960
|
+
}
|
|
2961
|
+
const kid = children;
|
|
2962
|
+
if (kid) {
|
|
2963
|
+
kid.arrayValue = 0;
|
|
2964
|
+
return { childSubject: new _ValueSubject__WEBPACK_IMPORTED_MODULE_3__.ValueSubject([kid]), madeSubject: true };
|
|
2965
|
+
}
|
|
2966
|
+
return {
|
|
2967
|
+
childSubject: new _ValueSubject__WEBPACK_IMPORTED_MODULE_3__.ValueSubject([]),
|
|
2968
|
+
madeSubject: true
|
|
2969
|
+
};
|
|
2970
|
+
}
|
|
2971
|
+
function updateResult(result, tagComponent) {
|
|
2972
|
+
result.isTag = true;
|
|
2973
|
+
result.original = tagComponent;
|
|
2974
|
+
}
|
|
2975
|
+
function updateComponent(tagComponent) {
|
|
2976
|
+
tagComponent.tags = tags;
|
|
2977
|
+
tagComponent.setUse = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse;
|
|
2978
|
+
tagComponent.tagIndex = tagCount++; // needed for things like HMR
|
|
2979
|
+
}
|
|
2980
|
+
/** creates/returns a function that when called then calls the original component function */
|
|
2981
|
+
function getTagWrap(templater, madeSubject) {
|
|
2982
|
+
const innerTagWrap = function (oldTagSetup, subject) {
|
|
2983
|
+
const global = oldTagSetup.templater.global;
|
|
2984
|
+
global.newestTemplater = templater;
|
|
2985
|
+
++global.renderCount;
|
|
2986
|
+
templater.global = global;
|
|
2987
|
+
const childSubject = templater.children;
|
|
2988
|
+
const lastArray = global.oldest?.tagSupport.templater.children.lastArray;
|
|
2989
|
+
if (lastArray) {
|
|
2990
|
+
childSubject.lastArray = lastArray;
|
|
2991
|
+
}
|
|
2992
|
+
const originalFunction = innerTagWrap.original;
|
|
2993
|
+
// const oldTagSetup = templater.tagSupport
|
|
2994
|
+
const oldest = templater.global.oldest;
|
|
2995
|
+
if (oldest && !oldest.hasLiveElements) {
|
|
2996
|
+
throw new Error('issue already 22');
|
|
2997
|
+
}
|
|
2998
|
+
let props = templater.props;
|
|
2999
|
+
const ownerTagSupport = oldTagSetup.ownerTagSupport;
|
|
3000
|
+
const oldTemplater = ownerTagSupport?.templater;
|
|
3001
|
+
const oldLatest = oldTemplater?.global.newest;
|
|
3002
|
+
const newestOwnerTemplater = oldLatest?.tagSupport.templater;
|
|
3003
|
+
if (oldLatest && !newestOwnerTemplater) {
|
|
3004
|
+
throw new Error('what to do here?');
|
|
3005
|
+
}
|
|
3006
|
+
let castedProps = (0,_alterProps_function__WEBPACK_IMPORTED_MODULE_7__.alterProps)(props, newestOwnerTemplater, oldTagSetup.ownerTagSupport);
|
|
3007
|
+
const clonedProps = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_5__.deepClone)(props); // castedProps
|
|
3008
|
+
// CALL ORIGINAL COMPONENT FUNCTION
|
|
3009
|
+
const tag = originalFunction(castedProps, childSubject);
|
|
3010
|
+
tag.version = global.renderCount;
|
|
3011
|
+
tag.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_6__.TagSupport(oldTagSetup.ownerTagSupport, templater, subject);
|
|
3012
|
+
tag.tagSupport.propsConfig = {
|
|
3013
|
+
latest: props, // castedProps
|
|
3014
|
+
latestCloned: clonedProps,
|
|
3015
|
+
clonedProps: clonedProps,
|
|
3016
|
+
lastClonedKidValues: tag.tagSupport.propsConfig.lastClonedKidValues,
|
|
3017
|
+
};
|
|
3018
|
+
tag.tagSupport.memory = oldTagSetup.memory; // state handover
|
|
3019
|
+
if (madeSubject) {
|
|
3020
|
+
childSubject.value.forEach(kid => {
|
|
3021
|
+
kid.values.forEach((value, index) => {
|
|
3022
|
+
if (!(value instanceof Function)) {
|
|
3023
|
+
return;
|
|
3024
|
+
}
|
|
3025
|
+
const valuesValue = kid.values[index];
|
|
3026
|
+
if (valuesValue.isChildOverride) {
|
|
3027
|
+
return; // already overwritten
|
|
3028
|
+
}
|
|
3029
|
+
// all functions need to report to me
|
|
3030
|
+
kid.values[index] = function (...args) {
|
|
3031
|
+
const ownerTag = tag.ownerTag;
|
|
3032
|
+
(0,_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_4__.runTagCallback)(value, // callback
|
|
3033
|
+
ownerTag, this, // bindTo
|
|
3034
|
+
args);
|
|
3035
|
+
};
|
|
3036
|
+
valuesValue.isChildOverride = true;
|
|
3037
|
+
});
|
|
3038
|
+
});
|
|
3039
|
+
}
|
|
3040
|
+
return tag;
|
|
3041
|
+
};
|
|
3042
|
+
return innerTagWrap;
|
|
3043
|
+
}
|
|
3044
|
+
|
|
3045
|
+
|
|
3046
|
+
/***/ }),
|
|
3047
|
+
|
|
3048
|
+
/***/ "./ts/tagElement.ts":
|
|
3049
|
+
/*!**************************!*\
|
|
3050
|
+
!*** ./ts/tagElement.ts ***!
|
|
3051
|
+
\**************************/
|
|
3052
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3053
|
+
|
|
3054
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3055
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3056
|
+
/* harmony export */ applyTagUpdater: () => (/* binding */ applyTagUpdater),
|
|
3057
|
+
/* harmony export */ tagElement: () => (/* binding */ tagElement)
|
|
3058
|
+
/* harmony export */ });
|
|
3059
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3060
|
+
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
3061
|
+
/* harmony import */ var _ValueSubject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ValueSubject */ "./ts/ValueSubject.ts");
|
|
3062
|
+
|
|
3063
|
+
|
|
3064
|
+
|
|
3065
|
+
const appElements = [];
|
|
3066
|
+
function tagElement(app, // (...args: unknown[]) => TemplaterResult,
|
|
3067
|
+
element, props) {
|
|
3068
|
+
const appElmIndex = appElements.findIndex(appElm => appElm.element === element);
|
|
3069
|
+
if (appElmIndex >= 0) {
|
|
3070
|
+
appElements[appElmIndex].tag.destroy();
|
|
3071
|
+
appElements.splice(appElmIndex, 1);
|
|
3072
|
+
// an element already had an app on it
|
|
3073
|
+
console.warn('Found and destroyed app element already rendered to element', { element });
|
|
3074
|
+
}
|
|
3075
|
+
// Create the app which returns [props, runOneTimeFunction]
|
|
3076
|
+
const wrapper = app(props);
|
|
3077
|
+
// have a function setup and call the tagWrapper with (props, {update, async, on})
|
|
3078
|
+
const result = applyTagUpdater(wrapper);
|
|
3079
|
+
const { tag } = result;
|
|
3080
|
+
// TODO: is the below needed?
|
|
3081
|
+
tag.appElement = element;
|
|
3082
|
+
tag.tagSupport.templater.global.isApp = true;
|
|
3083
|
+
const templateElm = document.createElement('template');
|
|
3084
|
+
templateElm.setAttribute('id', 'app-tag-' + appElements.length);
|
|
3085
|
+
templateElm.setAttribute('app-tag-detail', appElements.length.toString());
|
|
3086
|
+
element.appendChild(templateElm);
|
|
3087
|
+
tag.buildBeforeElement(templateElm);
|
|
3088
|
+
wrapper.global.oldest = tag;
|
|
3089
|
+
wrapper.global.newest = tag;
|
|
3090
|
+
if (!tag.hasLiveElements) {
|
|
3091
|
+
throw new Error('x');
|
|
3092
|
+
}
|
|
3093
|
+
;
|
|
3094
|
+
element.setUse = app.original.setUse;
|
|
3095
|
+
appElements.push({ element, tag });
|
|
3096
|
+
return { tag, tags: app.original.tags };
|
|
3097
|
+
}
|
|
3098
|
+
function applyTagUpdater(wrapper) {
|
|
3099
|
+
const subject = new _ValueSubject__WEBPACK_IMPORTED_MODULE_2__.ValueSubject({});
|
|
3100
|
+
const tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__.BaseTagSupport(wrapper, subject);
|
|
3101
|
+
wrapper.tagSupport = tagSupport;
|
|
3102
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_1__.runBeforeRender)(tagSupport, undefined);
|
|
3103
|
+
// Call the apps function for our tag templater
|
|
3104
|
+
const tag = wrapper.wrapper(tagSupport, subject);
|
|
3105
|
+
// wrapper.global.oldest = tag
|
|
3106
|
+
// wrapper.global.newest = tag
|
|
3107
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_1__.runAfterRender)(tagSupport, tag);
|
|
3108
|
+
return { tag, tagSupport };
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3111
|
+
|
|
3112
|
+
/***/ }),
|
|
3113
|
+
|
|
3114
|
+
/***/ "./ts/tagRunner.ts":
|
|
3115
|
+
/*!*************************!*\
|
|
3116
|
+
!*** ./ts/tagRunner.ts ***!
|
|
3117
|
+
\*************************/
|
|
3118
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3119
|
+
|
|
3120
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3121
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3122
|
+
/* harmony export */ runAfterRender: () => (/* binding */ runAfterRender),
|
|
3123
|
+
/* harmony export */ runBeforeDestroy: () => (/* binding */ runBeforeDestroy),
|
|
3124
|
+
/* harmony export */ runBeforeRedraw: () => (/* binding */ runBeforeRedraw),
|
|
3125
|
+
/* harmony export */ runBeforeRender: () => (/* binding */ runBeforeRender)
|
|
3126
|
+
/* harmony export */ });
|
|
3127
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
3128
|
+
// TODO: This should be more like `new TaggedJs().use({})`
|
|
3129
|
+
|
|
3130
|
+
// Life cycle 1
|
|
3131
|
+
function runBeforeRender(tagSupport, tagOwner) {
|
|
3132
|
+
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeRender(tagSupport, tagOwner));
|
|
3133
|
+
}
|
|
3134
|
+
// Life cycle 2
|
|
3135
|
+
function runAfterRender(tagSupport, tag) {
|
|
3136
|
+
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.afterRender(tagSupport, tag));
|
|
3137
|
+
}
|
|
3138
|
+
// Life cycle 3
|
|
3139
|
+
function runBeforeRedraw(tagSupport, tag) {
|
|
3140
|
+
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeRedraw(tagSupport, tag));
|
|
3141
|
+
}
|
|
3142
|
+
// Life cycle 4 - end of life
|
|
3143
|
+
function runBeforeDestroy(tagSupport, tag) {
|
|
3144
|
+
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeDestroy(tagSupport, tag));
|
|
3145
|
+
}
|
|
3146
|
+
|
|
3147
|
+
|
|
3148
|
+
/***/ }),
|
|
3149
|
+
|
|
3150
|
+
/***/ "./ts/updateExistingTagComponent.function.ts":
|
|
3151
|
+
/*!***************************************************!*\
|
|
3152
|
+
!*** ./ts/updateExistingTagComponent.function.ts ***!
|
|
3153
|
+
\***************************************************/
|
|
3154
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3155
|
+
|
|
3156
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3157
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3158
|
+
/* harmony export */ updateExistingTagComponent: () => (/* binding */ updateExistingTagComponent)
|
|
3159
|
+
/* harmony export */ });
|
|
3160
|
+
/* harmony import */ var _hasTagSupportChanged_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hasTagSupportChanged.function */ "./ts/hasTagSupportChanged.function.ts");
|
|
3161
|
+
/* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/processSubjectComponent.function.ts");
|
|
3162
|
+
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
3163
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
3164
|
+
|
|
3165
|
+
|
|
3166
|
+
|
|
3167
|
+
|
|
3168
|
+
function updateExistingTagComponent(ownerTag, templater, subject, insertBefore) {
|
|
3169
|
+
let existingTag = subject.tag;
|
|
3170
|
+
/*
|
|
3171
|
+
if(existingTag && !existingTag.hasLiveElements) {
|
|
3172
|
+
throw new Error('issue already began')
|
|
3173
|
+
}
|
|
3174
|
+
*/
|
|
3175
|
+
const oldWrapper = existingTag.tagSupport.templater.wrapper;
|
|
3176
|
+
const newWrapper = templater.wrapper;
|
|
3177
|
+
let isSameTag = false;
|
|
3178
|
+
if (templater.global.oldest && !templater.global.oldest.hasLiveElements) {
|
|
3179
|
+
throw new Error('88893434');
|
|
3180
|
+
}
|
|
3181
|
+
if (oldWrapper && newWrapper) {
|
|
3182
|
+
const oldFunction = oldWrapper.original;
|
|
3183
|
+
const newFunction = newWrapper.original;
|
|
3184
|
+
isSameTag = oldFunction === newFunction;
|
|
3185
|
+
}
|
|
3186
|
+
const oldTagSupport = existingTag.tagSupport;
|
|
3187
|
+
const oldGlobal = oldTagSupport.templater.global;
|
|
3188
|
+
const globalInsert = oldGlobal.insertBefore;
|
|
3189
|
+
const oldInsertBefore = globalInsert?.parentNode ? globalInsert : insertBefore;
|
|
3190
|
+
if (!oldInsertBefore.parentNode) {
|
|
3191
|
+
throw new Error('stop here no parent node update existing tag');
|
|
3192
|
+
}
|
|
3193
|
+
if (!isSameTag) {
|
|
3194
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(oldTagSupport.templater.global.oldest, subject);
|
|
3195
|
+
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_1__.processSubjectComponent)(templater, subject, oldInsertBefore, ownerTag, {
|
|
3196
|
+
forceElement: false,
|
|
3197
|
+
counts: { added: 0, removed: 0 },
|
|
3198
|
+
});
|
|
3199
|
+
return;
|
|
3200
|
+
}
|
|
3201
|
+
else {
|
|
3202
|
+
const newTagSupport = templater.tagSupport;
|
|
3203
|
+
const hasChanged = (0,_hasTagSupportChanged_function__WEBPACK_IMPORTED_MODULE_0__.hasTagSupportChanged)(oldTagSupport, newTagSupport, templater);
|
|
3204
|
+
if (!hasChanged) {
|
|
3205
|
+
return; // its the same tag component
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
const oldestTag = templater.global.oldest; // oldTagSupport.oldest as Tag // existingTag
|
|
3209
|
+
const previous = templater.global.newest;
|
|
3210
|
+
if (!previous || !oldestTag) {
|
|
3211
|
+
throw new Error('how no previous or oldest nor newest?');
|
|
3212
|
+
}
|
|
3213
|
+
const newTag = (0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_3__.renderTagSupport)(templater.tagSupport, false);
|
|
3214
|
+
existingTag = subject.tag;
|
|
3215
|
+
const newOldest = newTag.tagSupport.templater.global.oldest;
|
|
3216
|
+
const hasOldest = newOldest ? true : false;
|
|
3217
|
+
if (!hasOldest) {
|
|
3218
|
+
return buildNewTag(newTag, oldInsertBefore, oldTagSupport, subject);
|
|
3219
|
+
}
|
|
3220
|
+
if (newOldest && templater.children.value.length) {
|
|
3221
|
+
const oldKidsSub = newOldest.tagSupport.templater.children;
|
|
3222
|
+
oldKidsSub.set(templater.children.value);
|
|
3223
|
+
}
|
|
3224
|
+
// const newTag = tempResult.newest as Tag
|
|
3225
|
+
if (previous && !oldestTag) {
|
|
3226
|
+
throw new Error('bad elders');
|
|
3227
|
+
}
|
|
3228
|
+
// detect if both the function is the same and the return is the same
|
|
3229
|
+
const isLikeTag = isSameTag && previous.isLikeTag(newTag);
|
|
3230
|
+
if (previous && !oldestTag) {
|
|
3231
|
+
throw new Error('bad elders');
|
|
3232
|
+
}
|
|
3233
|
+
let oldest = oldTagSupport.templater.global.oldest;
|
|
3234
|
+
if (isLikeTag) {
|
|
3235
|
+
if (!newTag.tagSupport.templater.global.oldest) {
|
|
3236
|
+
throw new Error('maybe 6');
|
|
3237
|
+
}
|
|
3238
|
+
subject.tag = newTag;
|
|
3239
|
+
oldestTag.updateByTag(newTag); // the oldest tag has element references
|
|
3240
|
+
return;
|
|
3241
|
+
}
|
|
3242
|
+
else {
|
|
3243
|
+
// Although function looked the same it returned a different html result
|
|
3244
|
+
if (isSameTag && existingTag) {
|
|
3245
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(existingTag, subject);
|
|
3246
|
+
newTag.tagSupport.templater.global.context = {}; // do not share previous outputs
|
|
3247
|
+
}
|
|
3248
|
+
oldest = undefined;
|
|
3249
|
+
}
|
|
3250
|
+
if (!oldest) {
|
|
3251
|
+
buildNewTag(newTag, oldTagSupport.templater.global.insertBefore, oldTagSupport, subject);
|
|
3252
|
+
}
|
|
3253
|
+
oldTagSupport.templater.global.newest = newTag;
|
|
3254
|
+
return;
|
|
3255
|
+
}
|
|
3256
|
+
function checkStateChanged(state) {
|
|
3257
|
+
return !state.newest.every(state => {
|
|
3258
|
+
const lastValue = state.lastValue;
|
|
3259
|
+
const nowValue = state.get();
|
|
3260
|
+
const matched = lastValue === nowValue;
|
|
3261
|
+
if (matched) {
|
|
3262
|
+
return true;
|
|
3263
|
+
}
|
|
3264
|
+
return false;
|
|
3265
|
+
});
|
|
3266
|
+
}
|
|
3267
|
+
function buildNewTag(newTag, oldInsertBefore, oldTagSupport, subject) {
|
|
3268
|
+
newTag.buildBeforeElement(oldInsertBefore, {
|
|
3269
|
+
forceElement: true,
|
|
3270
|
+
counts: { added: 0, removed: 0 }, test: false,
|
|
3271
|
+
});
|
|
3272
|
+
newTag.tagSupport.templater.global.oldest = newTag;
|
|
3273
|
+
newTag.tagSupport.templater.global.newest = newTag;
|
|
3274
|
+
oldTagSupport.templater.global.oldest = newTag;
|
|
3275
|
+
oldTagSupport.templater.global.newest = newTag;
|
|
3276
|
+
if (!newTag.tagSupport.templater.global.oldest) {
|
|
3277
|
+
throw new Error('maybe 5');
|
|
3278
|
+
}
|
|
3279
|
+
subject.tag = newTag;
|
|
3280
|
+
if (!newTag.hasLiveElements) {
|
|
3281
|
+
throw new Error('44444 - 5');
|
|
3282
|
+
}
|
|
3283
|
+
return;
|
|
3284
|
+
}
|
|
3285
|
+
|
|
3286
|
+
|
|
3287
|
+
/***/ }),
|
|
3288
|
+
|
|
3289
|
+
/***/ "./ts/updateExistingValue.function.ts":
|
|
3290
|
+
/*!********************************************!*\
|
|
3291
|
+
!*** ./ts/updateExistingValue.function.ts ***!
|
|
3292
|
+
\********************************************/
|
|
3293
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3294
|
+
|
|
3295
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3296
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3297
|
+
/* harmony export */ updateExistingValue: () => (/* binding */ updateExistingValue)
|
|
3298
|
+
/* harmony export */ });
|
|
3299
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3300
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
3301
|
+
/* harmony import */ var _processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./processSubjectValue.function */ "./ts/processSubjectValue.function.ts");
|
|
3302
|
+
/* harmony import */ var _processTagArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processTagArray */ "./ts/processTagArray.ts");
|
|
3303
|
+
/* harmony import */ var _updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./updateExistingTagComponent.function */ "./ts/updateExistingTagComponent.function.ts");
|
|
3304
|
+
/* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/processRegularValue.function.ts");
|
|
3305
|
+
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./checkDestroyPrevious.function */ "./ts/checkDestroyPrevious.function.ts");
|
|
3306
|
+
/* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/processSubjectComponent.function.ts");
|
|
3307
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
3308
|
+
/* harmony import */ var _bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./bindSubjectCallback.function */ "./ts/bindSubjectCallback.function.ts");
|
|
3309
|
+
|
|
3310
|
+
|
|
3311
|
+
|
|
3312
|
+
|
|
3313
|
+
|
|
3314
|
+
|
|
3315
|
+
|
|
3316
|
+
|
|
3317
|
+
|
|
3318
|
+
|
|
3319
|
+
function updateExistingValue(subject, value, ownerTag, insertBefore) {
|
|
3320
|
+
const subjectTag = subject;
|
|
3321
|
+
const isComponent = (0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value);
|
|
3322
|
+
const oldInsertBefore = subject.template || subjectTag.tag?.tagSupport.templater.global.insertBefore || subject.clone;
|
|
3323
|
+
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_6__.checkDestroyPrevious)(subject, value);
|
|
3324
|
+
// handle already seen tag components
|
|
3325
|
+
if (isComponent) {
|
|
3326
|
+
const templater = value;
|
|
3327
|
+
// When was something before component
|
|
3328
|
+
if (!subjectTag.tag) {
|
|
3329
|
+
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_7__.processSubjectComponent)(templater, subjectTag, oldInsertBefore, ownerTag, {
|
|
3330
|
+
forceElement: true,
|
|
3331
|
+
counts: { added: 0, removed: 0 },
|
|
3332
|
+
});
|
|
3333
|
+
return subjectTag;
|
|
3334
|
+
}
|
|
3335
|
+
templater.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__.TagSupport(
|
|
3336
|
+
// subjectTag.tag.tagSupport.ownerTagSupport,
|
|
3337
|
+
ownerTag.tagSupport, templater, subjectTag);
|
|
3338
|
+
(0,_updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_4__.updateExistingTagComponent)(ownerTag, templater, // latest value
|
|
3339
|
+
subjectTag, insertBefore);
|
|
3340
|
+
return subjectTag;
|
|
3341
|
+
}
|
|
3342
|
+
// was component but no longer
|
|
3343
|
+
const tag = subjectTag.tag;
|
|
3344
|
+
if (tag) {
|
|
3345
|
+
handleStillTag(tag, subject, value, ownerTag);
|
|
3346
|
+
return subjectTag;
|
|
3347
|
+
}
|
|
3348
|
+
// its another tag array
|
|
3349
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagArray)(value)) {
|
|
3350
|
+
(0,_processTagArray__WEBPACK_IMPORTED_MODULE_3__.processTagArray)(subject, value, oldInsertBefore, ownerTag, { counts: {
|
|
3351
|
+
added: 0,
|
|
3352
|
+
removed: 0,
|
|
3353
|
+
} });
|
|
3354
|
+
return subject;
|
|
3355
|
+
}
|
|
3356
|
+
// now its a function
|
|
3357
|
+
if (value instanceof Function) {
|
|
3358
|
+
// const newSubject = getSubjectFunction(value, ownerTag)
|
|
3359
|
+
const bound = (0,_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_9__.bindSubjectCallback)(value, ownerTag);
|
|
3360
|
+
subject.set(bound);
|
|
3361
|
+
return subject;
|
|
3362
|
+
}
|
|
3363
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagInstance)(value)) {
|
|
3364
|
+
subjectTag.template = oldInsertBefore;
|
|
3365
|
+
(0,_processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__.processTag)(value, subjectTag, subjectTag.template, ownerTag);
|
|
3366
|
+
return subjectTag;
|
|
3367
|
+
}
|
|
3368
|
+
// we have been given a subject
|
|
3369
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isSubjectInstance)(value)) {
|
|
3370
|
+
return value;
|
|
3371
|
+
}
|
|
3372
|
+
// This will cause all other values to render
|
|
3373
|
+
(0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__.processRegularValue)(value, subject, oldInsertBefore);
|
|
3374
|
+
return subjectTag;
|
|
3375
|
+
}
|
|
3376
|
+
function handleStillTag(existingTag, subject, value, ownerTag) {
|
|
3377
|
+
// TODO: We shouldn't need both of these
|
|
3378
|
+
const isSameTag = value && (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_8__.isLikeTags)(existingTag, value);
|
|
3379
|
+
const isSameTag2 = value && value.getTemplate && existingTag.isLikeTag(value);
|
|
3380
|
+
const tag = value;
|
|
3381
|
+
if (!tag.tagSupport) {
|
|
3382
|
+
(0,_processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__.applyFakeTemplater)(tag, ownerTag, subject);
|
|
3383
|
+
}
|
|
3384
|
+
if (isSameTag) {
|
|
3385
|
+
existingTag.updateByTag(tag);
|
|
3386
|
+
return;
|
|
3387
|
+
}
|
|
3388
|
+
if (isSameTag || isSameTag2) {
|
|
3389
|
+
return (0,_processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__.processTag)(value, subject, subject.template, ownerTag);
|
|
3390
|
+
}
|
|
3391
|
+
return (0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__.processRegularValue)(value, subject, subject.template);
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3394
|
+
|
|
3395
|
+
/***/ }),
|
|
3396
|
+
|
|
3397
|
+
/***/ "./ts/watch.function.ts":
|
|
3398
|
+
/*!******************************!*\
|
|
3399
|
+
!*** ./ts/watch.function.ts ***!
|
|
3400
|
+
\******************************/
|
|
3401
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3402
|
+
|
|
3403
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3404
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3405
|
+
/* harmony export */ watch: () => (/* binding */ watch)
|
|
3406
|
+
/* harmony export */ });
|
|
3407
|
+
/* harmony import */ var _setLet_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setLet.function */ "./ts/setLet.function.ts");
|
|
3408
|
+
|
|
3409
|
+
/** When an item in watch array changes, callback function will be triggered */
|
|
3410
|
+
function watch(currentValues, callback) {
|
|
3411
|
+
let previousValues = (0,_setLet_function__WEBPACK_IMPORTED_MODULE_0__.setLet)(undefined)(x => [previousValues, previousValues = x]);
|
|
3412
|
+
if (previousValues === undefined) {
|
|
3413
|
+
callback(currentValues, previousValues);
|
|
3414
|
+
// const result = {currentValues, previousValues}
|
|
3415
|
+
previousValues = currentValues;
|
|
3416
|
+
return currentValues;
|
|
3417
|
+
}
|
|
3418
|
+
const allExact = currentValues.every((item, index) => item === previousValues[index]);
|
|
3419
|
+
if (allExact) {
|
|
3420
|
+
return currentValues;
|
|
3421
|
+
}
|
|
3422
|
+
callback(currentValues, previousValues);
|
|
3423
|
+
previousValues.length = 0;
|
|
3424
|
+
previousValues.push(...currentValues);
|
|
3425
|
+
return currentValues;
|
|
3426
|
+
}
|
|
3427
|
+
|
|
3428
|
+
|
|
3429
|
+
/***/ })
|
|
3430
|
+
|
|
3431
|
+
/******/ });
|
|
3432
|
+
/************************************************************************/
|
|
3433
|
+
/******/ // The module cache
|
|
3434
|
+
/******/ var __webpack_module_cache__ = {};
|
|
3435
|
+
/******/
|
|
3436
|
+
/******/ // The require function
|
|
3437
|
+
/******/ function __webpack_require__(moduleId) {
|
|
3438
|
+
/******/ // Check if module is in cache
|
|
3439
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
3440
|
+
/******/ if (cachedModule !== undefined) {
|
|
3441
|
+
/******/ return cachedModule.exports;
|
|
3442
|
+
/******/ }
|
|
3443
|
+
/******/ // Create a new module (and put it into the cache)
|
|
3444
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
3445
|
+
/******/ // no module.id needed
|
|
3446
|
+
/******/ // no module.loaded needed
|
|
3447
|
+
/******/ exports: {}
|
|
3448
|
+
/******/ };
|
|
3449
|
+
/******/
|
|
3450
|
+
/******/ // Execute the module function
|
|
3451
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
3452
|
+
/******/
|
|
3453
|
+
/******/ // Return the exports of the module
|
|
3454
|
+
/******/ return module.exports;
|
|
3455
|
+
/******/ }
|
|
3456
|
+
/******/
|
|
3457
|
+
/************************************************************************/
|
|
3458
|
+
/******/ /* webpack/runtime/define property getters */
|
|
3459
|
+
/******/ (() => {
|
|
3460
|
+
/******/ // define getter functions for harmony exports
|
|
3461
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
3462
|
+
/******/ for(var key in definition) {
|
|
3463
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
3464
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
3465
|
+
/******/ }
|
|
3466
|
+
/******/ }
|
|
3467
|
+
/******/ };
|
|
3468
|
+
/******/ })();
|
|
3469
|
+
/******/
|
|
3470
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
3471
|
+
/******/ (() => {
|
|
3472
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
3473
|
+
/******/ })();
|
|
3474
|
+
/******/
|
|
3475
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
3476
|
+
/******/ (() => {
|
|
3477
|
+
/******/ // define __esModule on exports
|
|
3478
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
3479
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
3480
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3481
|
+
/******/ }
|
|
3482
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
3483
|
+
/******/ };
|
|
3484
|
+
/******/ })();
|
|
3485
|
+
/******/
|
|
3486
|
+
/************************************************************************/
|
|
3487
|
+
var __webpack_exports__ = {};
|
|
3488
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
3489
|
+
(() => {
|
|
3490
|
+
/*!*********************!*\
|
|
3491
|
+
!*** ./ts/index.ts ***!
|
|
3492
|
+
\*********************/
|
|
3493
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3494
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3495
|
+
/* harmony export */ ArrayNoKeyError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_4__.ArrayNoKeyError),
|
|
3496
|
+
/* harmony export */ BaseTagSupport: () => (/* reexport safe */ _TagSupport_class__WEBPACK_IMPORTED_MODULE_9__.BaseTagSupport),
|
|
3497
|
+
/* harmony export */ StateMismatchError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_4__.StateMismatchError),
|
|
3498
|
+
/* harmony export */ Subject: () => (/* reexport safe */ _Subject__WEBPACK_IMPORTED_MODULE_5__.Subject),
|
|
3499
|
+
/* harmony export */ Tag: () => (/* reexport safe */ _Tag_class__WEBPACK_IMPORTED_MODULE_11__.Tag),
|
|
3500
|
+
/* harmony export */ TagError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_4__.TagError),
|
|
3501
|
+
/* harmony export */ TagSupport: () => (/* reexport safe */ _TagSupport_class__WEBPACK_IMPORTED_MODULE_9__.TagSupport),
|
|
3502
|
+
/* harmony export */ ValueSubject: () => (/* reexport safe */ _ValueSubject__WEBPACK_IMPORTED_MODULE_7__.ValueSubject),
|
|
3503
|
+
/* harmony export */ getCallback: () => (/* reexport safe */ _getCallback__WEBPACK_IMPORTED_MODULE_20__.getCallback),
|
|
3504
|
+
/* harmony export */ hmr: () => (/* binding */ hmr),
|
|
3505
|
+
/* harmony export */ html: () => (/* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_3__.html),
|
|
3506
|
+
/* harmony export */ interpolateElement: () => (/* reexport safe */ _interpolateElement__WEBPACK_IMPORTED_MODULE_10__.interpolateElement),
|
|
3507
|
+
/* harmony export */ interpolateString: () => (/* reexport safe */ _interpolateElement__WEBPACK_IMPORTED_MODULE_10__.interpolateString),
|
|
3508
|
+
/* harmony export */ isSubjectInstance: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isSubjectInstance),
|
|
3509
|
+
/* harmony export */ isTagArray: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagArray),
|
|
3510
|
+
/* harmony export */ isTagComponent: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagComponent),
|
|
3511
|
+
/* harmony export */ isTagInstance: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagInstance),
|
|
3512
|
+
/* harmony export */ onDestroy: () => (/* reexport safe */ _onDestroy__WEBPACK_IMPORTED_MODULE_19__.onDestroy),
|
|
3513
|
+
/* harmony export */ onInit: () => (/* reexport safe */ _onInit__WEBPACK_IMPORTED_MODULE_18__.onInit),
|
|
3514
|
+
/* harmony export */ providers: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_14__.providers),
|
|
3515
|
+
/* harmony export */ runBeforeRender: () => (/* reexport safe */ _tagRunner__WEBPACK_IMPORTED_MODULE_12__.runBeforeRender),
|
|
3516
|
+
/* harmony export */ set: () => (/* reexport safe */ _set_function__WEBPACK_IMPORTED_MODULE_15__.set),
|
|
3517
|
+
/* harmony export */ setLet: () => (/* reexport safe */ _setLet_function__WEBPACK_IMPORTED_MODULE_16__.setLet),
|
|
3518
|
+
/* harmony export */ setProp: () => (/* reexport safe */ _setProp_function__WEBPACK_IMPORTED_MODULE_17__.setProp),
|
|
3519
|
+
/* harmony export */ setUse: () => (/* reexport safe */ _setUse_function__WEBPACK_IMPORTED_MODULE_13__.setUse),
|
|
3520
|
+
/* harmony export */ tag: () => (/* reexport safe */ _tag__WEBPACK_IMPORTED_MODULE_2__.tag),
|
|
3521
|
+
/* harmony export */ tagElement: () => (/* reexport safe */ _tagElement__WEBPACK_IMPORTED_MODULE_0__.tagElement),
|
|
3522
|
+
/* harmony export */ tags: () => (/* reexport safe */ _tag__WEBPACK_IMPORTED_MODULE_2__.tags),
|
|
3523
|
+
/* harmony export */ watch: () => (/* reexport safe */ _watch_function__WEBPACK_IMPORTED_MODULE_8__.watch)
|
|
3524
|
+
/* harmony export */ });
|
|
3525
|
+
/* harmony import */ var _tagElement__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tagElement */ "./ts/tagElement.ts");
|
|
3526
|
+
/* harmony import */ var _ElementTargetEvent_interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ElementTargetEvent.interface */ "./ts/ElementTargetEvent.interface.ts");
|
|
3527
|
+
/* harmony import */ var _tag__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./tag */ "./ts/tag.ts");
|
|
3528
|
+
/* harmony import */ var _html__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./html */ "./ts/html.ts");
|
|
3529
|
+
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./errors */ "./ts/errors.ts");
|
|
3530
|
+
/* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Subject */ "./ts/Subject.ts");
|
|
3531
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
3532
|
+
/* harmony import */ var _ValueSubject__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ValueSubject */ "./ts/ValueSubject.ts");
|
|
3533
|
+
/* harmony import */ var _watch_function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./watch.function */ "./ts/watch.function.ts");
|
|
3534
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3535
|
+
/* harmony import */ var _interpolateElement__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./interpolateElement */ "./ts/interpolateElement.ts");
|
|
3536
|
+
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Tag.class */ "./ts/Tag.class.ts");
|
|
3537
|
+
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
3538
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
3539
|
+
/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./providers */ "./ts/providers.ts");
|
|
3540
|
+
/* harmony import */ var _set_function__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./set.function */ "./ts/set.function.ts");
|
|
3541
|
+
/* harmony import */ var _setLet_function__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./setLet.function */ "./ts/setLet.function.ts");
|
|
3542
|
+
/* harmony import */ var _setProp_function__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./setProp.function */ "./ts/setProp.function.ts");
|
|
3543
|
+
/* harmony import */ var _onInit__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./onInit */ "./ts/onInit.ts");
|
|
3544
|
+
/* harmony import */ var _onDestroy__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./onDestroy */ "./ts/onDestroy.ts");
|
|
3545
|
+
/* harmony import */ var _getCallback__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./getCallback */ "./ts/getCallback.ts");
|
|
3546
|
+
// import { redrawTag } from "./redrawTag.function"
|
|
3547
|
+
|
|
3548
|
+
|
|
3549
|
+
|
|
3550
|
+
|
|
3551
|
+
|
|
3552
|
+
|
|
3553
|
+
|
|
3554
|
+
|
|
3555
|
+
|
|
3556
|
+
|
|
3557
|
+
// export * from "./redrawTag.function"
|
|
3558
|
+
|
|
3559
|
+
// TODO: export *
|
|
3560
|
+
|
|
3561
|
+
|
|
3562
|
+
|
|
3563
|
+
|
|
3564
|
+
/* hooks */
|
|
3565
|
+
// TODO: export *
|
|
3566
|
+
|
|
3567
|
+
|
|
3568
|
+
|
|
3569
|
+
|
|
3570
|
+
|
|
3571
|
+
|
|
3572
|
+
|
|
3573
|
+
/* end: hooks */
|
|
3574
|
+
const hmr = {
|
|
3575
|
+
tagElement: _tagElement__WEBPACK_IMPORTED_MODULE_0__.tagElement,
|
|
3576
|
+
// redrawTag
|
|
3577
|
+
};
|
|
3578
|
+
|
|
3579
|
+
})();
|
|
3580
|
+
|
|
3581
|
+
var __webpack_exports__ArrayNoKeyError = __webpack_exports__.ArrayNoKeyError;
|
|
3582
|
+
var __webpack_exports__BaseTagSupport = __webpack_exports__.BaseTagSupport;
|
|
3583
|
+
var __webpack_exports__StateMismatchError = __webpack_exports__.StateMismatchError;
|
|
3584
|
+
var __webpack_exports__Subject = __webpack_exports__.Subject;
|
|
3585
|
+
var __webpack_exports__Tag = __webpack_exports__.Tag;
|
|
3586
|
+
var __webpack_exports__TagError = __webpack_exports__.TagError;
|
|
3587
|
+
var __webpack_exports__TagSupport = __webpack_exports__.TagSupport;
|
|
3588
|
+
var __webpack_exports__ValueSubject = __webpack_exports__.ValueSubject;
|
|
3589
|
+
var __webpack_exports__getCallback = __webpack_exports__.getCallback;
|
|
3590
|
+
var __webpack_exports__hmr = __webpack_exports__.hmr;
|
|
3591
|
+
var __webpack_exports__html = __webpack_exports__.html;
|
|
3592
|
+
var __webpack_exports__interpolateElement = __webpack_exports__.interpolateElement;
|
|
3593
|
+
var __webpack_exports__interpolateString = __webpack_exports__.interpolateString;
|
|
3594
|
+
var __webpack_exports__isSubjectInstance = __webpack_exports__.isSubjectInstance;
|
|
3595
|
+
var __webpack_exports__isTagArray = __webpack_exports__.isTagArray;
|
|
3596
|
+
var __webpack_exports__isTagComponent = __webpack_exports__.isTagComponent;
|
|
3597
|
+
var __webpack_exports__isTagInstance = __webpack_exports__.isTagInstance;
|
|
3598
|
+
var __webpack_exports__onDestroy = __webpack_exports__.onDestroy;
|
|
3599
|
+
var __webpack_exports__onInit = __webpack_exports__.onInit;
|
|
3600
|
+
var __webpack_exports__providers = __webpack_exports__.providers;
|
|
3601
|
+
var __webpack_exports__runBeforeRender = __webpack_exports__.runBeforeRender;
|
|
3602
|
+
var __webpack_exports__set = __webpack_exports__.set;
|
|
3603
|
+
var __webpack_exports__setLet = __webpack_exports__.setLet;
|
|
3604
|
+
var __webpack_exports__setProp = __webpack_exports__.setProp;
|
|
3605
|
+
var __webpack_exports__setUse = __webpack_exports__.setUse;
|
|
3606
|
+
var __webpack_exports__tag = __webpack_exports__.tag;
|
|
3607
|
+
var __webpack_exports__tagElement = __webpack_exports__.tagElement;
|
|
3608
|
+
var __webpack_exports__tags = __webpack_exports__.tags;
|
|
3609
|
+
var __webpack_exports__watch = __webpack_exports__.watch;
|
|
3610
|
+
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__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 };
|
|
3611
|
+
|
|
3612
|
+
//# sourceMappingURL=bundle.js.map
|