taggedjs 2.4.2 → 2.4.10

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