taggedjs 2.4.17 → 2.4.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.js +1314 -1241
- package/bundle.js.map +1 -1
- package/js/Clones.type.d.ts +1 -1
- package/js/Tag.class.d.ts +5 -40
- package/js/Tag.class.js +2 -347
- package/js/Tag.class.js.map +1 -1
- package/js/TagSupport.class.d.ts +40 -6
- package/js/TagSupport.class.js +268 -30
- package/js/TagSupport.class.js.map +1 -1
- package/js/TemplaterResult.class.d.ts +13 -13
- package/js/TemplaterResult.class.js +34 -45
- package/js/TemplaterResult.class.js.map +1 -1
- package/js/afterInterpolateElement.function.d.ts +4 -0
- package/js/afterInterpolateElement.function.js +14 -0
- package/js/afterInterpolateElement.function.js.map +1 -0
- package/js/alterProps.function.d.ts +2 -4
- package/js/alterProps.function.js +7 -15
- package/js/alterProps.function.js.map +1 -1
- package/js/bindSubjectCallback.function.js +0 -3
- package/js/bindSubjectCallback.function.js.map +1 -1
- package/js/checkDestroyPrevious.function.d.ts +5 -5
- package/js/checkDestroyPrevious.function.js +20 -17
- package/js/checkDestroyPrevious.function.js.map +1 -1
- package/js/cloneValueArray.function.d.ts +2 -0
- package/js/cloneValueArray.function.js +19 -0
- package/js/cloneValueArray.function.js.map +1 -0
- package/js/deepFunctions.js +36 -29
- package/js/deepFunctions.js.map +1 -1
- package/js/destroy.support.d.ts +6 -0
- package/js/destroy.support.js +10 -0
- package/js/destroy.support.js.map +1 -0
- package/js/destroyTag.function.d.ts +2 -3
- package/js/destroyTag.function.js +7 -11
- package/js/destroyTag.function.js.map +1 -1
- package/js/hasTagSupportChanged.function.js +0 -12
- package/js/hasTagSupportChanged.function.js.map +1 -1
- package/js/index.d.ts +2 -1
- package/js/index.js +2 -1
- package/js/index.js.map +1 -1
- package/js/interpolateTemplate.js +0 -3
- package/js/interpolateTemplate.js.map +1 -1
- package/js/interpolations/bindSubjectCallback.function.d.ts +7 -0
- package/js/interpolations/bindSubjectCallback.function.js +40 -0
- package/js/interpolations/bindSubjectCallback.function.js.map +1 -0
- package/js/interpolations/elementInitCheck.d.ts +2 -0
- package/js/interpolations/elementInitCheck.js +18 -0
- package/js/interpolations/elementInitCheck.js.map +1 -0
- package/js/interpolations/inputAttribute.d.ts +1 -0
- package/js/interpolations/inputAttribute.js +19 -0
- package/js/interpolations/inputAttribute.js.map +1 -0
- package/js/interpolations/interpolateAttributes.d.ts +4 -0
- package/js/interpolations/interpolateAttributes.js +20 -0
- package/js/interpolations/interpolateAttributes.js.map +1 -0
- package/js/interpolations/interpolateContentTemplates.d.ts +9 -0
- package/js/interpolations/interpolateContentTemplates.js +42 -0
- package/js/interpolations/interpolateContentTemplates.js.map +1 -0
- package/js/interpolations/interpolateElement.d.ts +14 -0
- package/js/interpolations/interpolateElement.js +36 -0
- package/js/interpolations/interpolateElement.js.map +1 -0
- package/js/interpolations/interpolateTemplate.d.ts +32 -0
- package/js/interpolations/interpolateTemplate.js +80 -0
- package/js/interpolations/interpolateTemplate.js.map +1 -0
- package/js/interpolations/interpolations.d.ts +7 -0
- package/js/interpolations/interpolations.js +18 -0
- package/js/interpolations/interpolations.js.map +1 -0
- package/js/interpolations/processAttribute.function.d.ts +5 -0
- package/js/interpolations/processAttribute.function.js +122 -0
- package/js/interpolations/processAttribute.function.js.map +1 -0
- package/js/interpolations/scanTextAreaValue.function.d.ts +3 -0
- package/js/interpolations/scanTextAreaValue.function.js +16 -0
- package/js/interpolations/scanTextAreaValue.function.js.map +1 -0
- package/js/interpolations.js +1 -2
- package/js/interpolations.js.map +1 -1
- package/js/isInstance.d.ts +4 -1
- package/js/isInstance.js +12 -4
- package/js/isInstance.js.map +1 -1
- package/js/isLikeTags.function.d.ts +3 -1
- package/js/isLikeTags.function.js +15 -6
- package/js/isLikeTags.function.js.map +1 -1
- package/js/processNewValue.function.d.ts +3 -2
- package/js/processNewValue.function.js +27 -11
- package/js/processNewValue.function.js.map +1 -1
- package/js/processRegularValue.function.d.ts +1 -1
- package/js/processSubjectComponent.function.d.ts +5 -5
- package/js/processSubjectComponent.function.js +26 -34
- package/js/processSubjectComponent.function.js.map +1 -1
- package/js/processSubjectValue.function.d.ts +11 -7
- package/js/processSubjectValue.function.js +20 -7
- package/js/processSubjectValue.function.js.map +1 -1
- package/js/processTag.function.d.ts +8 -4
- package/js/processTag.function.js +23 -39
- package/js/processTag.function.js.map +1 -1
- package/js/processTagArray.d.ts +6 -4
- package/js/processTagArray.js +41 -39
- package/js/processTagArray.js.map +1 -1
- package/js/processTagResult.function.d.ts +4 -4
- package/js/processTagResult.function.js +14 -30
- package/js/processTagResult.function.js.map +1 -1
- package/js/renderExistingTag.function.d.ts +6 -6
- package/js/renderExistingTag.function.js +26 -22
- package/js/renderExistingTag.function.js.map +1 -1
- package/js/renderTagSupport.function.d.ts +2 -3
- package/js/renderTagSupport.function.js +17 -20
- package/js/renderTagSupport.function.js.map +1 -1
- package/js/setTagPlaceholder.function.d.ts +2 -0
- package/js/setTagPlaceholder.function.js +8 -0
- package/js/setTagPlaceholder.function.js.map +1 -0
- package/js/state/callbackMaker.function.d.ts +2 -2
- package/js/state/callbackMaker.function.js +4 -5
- package/js/state/callbackMaker.function.js.map +1 -1
- package/js/state/onDestroy.js +2 -2
- package/js/state/onDestroy.js.map +1 -1
- package/js/state/onInit.js +4 -5
- package/js/state/onInit.js.map +1 -1
- package/js/state/provider.utils.d.ts +2 -2
- package/js/state/provider.utils.js +11 -16
- package/js/state/provider.utils.js.map +1 -1
- package/js/state/providers.d.ts +8 -3
- package/js/state/providers.js +15 -18
- package/js/state/providers.js.map +1 -1
- package/js/state/setUse.function.d.ts +12 -10
- package/js/state/setUse.function.js.map +1 -1
- package/js/state/state.utils.d.ts +1 -3
- package/js/state/state.utils.js +19 -13
- package/js/state/state.utils.js.map +1 -1
- package/js/state/watch.function.d.ts +6 -1
- package/js/state/watch.function.js +8 -3
- package/js/state/watch.function.js.map +1 -1
- package/js/subject/Subject.class.d.ts +10 -6
- package/js/subject/Subject.class.js +26 -10
- package/js/subject/Subject.class.js.map +1 -1
- package/js/subject/Subject.utils.d.ts +7 -5
- package/js/subject/Subject.utils.js.map +1 -1
- package/js/subject/ValueSubject.d.ts +2 -2
- package/js/subject/ValueSubject.js +1 -1
- package/js/subject/ValueSubject.js.map +1 -1
- package/js/subject/combineLatest.function.js.map +1 -1
- package/js/subject.types.d.ts +18 -0
- package/js/subject.types.js +2 -0
- package/js/subject.types.js.map +1 -0
- package/js/tag.d.ts +1 -1
- package/js/tag.js +25 -31
- package/js/tag.js.map +1 -1
- package/js/tagElement.d.ts +3 -7
- package/js/tagElement.js +24 -24
- package/js/tagElement.js.map +1 -1
- package/js/tagRunner.d.ts +7 -6
- package/js/tagRunner.js +16 -8
- package/js/tagRunner.js.map +1 -1
- package/js/updateBeforeTemplate.function.d.ts +1 -1
- package/js/updateBeforeTemplate.function.js.map +1 -1
- package/js/updateContextItem.function.d.ts +3 -0
- package/js/updateContextItem.function.js +43 -0
- package/js/updateContextItem.function.js.map +1 -0
- package/js/updateExistingTagComponent.function.d.ts +4 -4
- package/js/updateExistingTagComponent.function.js +49 -87
- package/js/updateExistingTagComponent.function.js.map +1 -1
- package/js/updateExistingValue.function.d.ts +2 -7
- package/js/updateExistingValue.function.js +94 -50
- package/js/updateExistingValue.function.js.map +1 -1
- package/package.json +1 -1
- /package/js/{errors.d.ts → Errors.d.ts} +0 -0
- /package/js/{errors.js → Errors.js} +0 -0
- /package/js/{errors.js.map → Errors.js.map} +0 -0
package/bundle.js
CHANGED
|
@@ -25,44 +25,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
25
25
|
/* harmony export */ escapeVariable: () => (/* binding */ escapeVariable),
|
|
26
26
|
/* harmony export */ variablePrefix: () => (/* binding */ variablePrefix)
|
|
27
27
|
/* harmony export */ });
|
|
28
|
-
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
29
|
-
/* harmony import */ var _render__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./render */ "./ts/render.ts");
|
|
30
|
-
/* harmony import */ var _interpolateElement__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interpolateElement */ "./ts/interpolateElement.ts");
|
|
31
|
-
/* harmony import */ var _interpolateTemplate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./interpolateTemplate */ "./ts/interpolateTemplate.ts");
|
|
32
|
-
/* harmony import */ var _elementDestroyCheck_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./elementDestroyCheck.function */ "./ts/elementDestroyCheck.function.ts");
|
|
33
|
-
/* harmony import */ var _processNewValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./processNewValue.function */ "./ts/processNewValue.function.ts");
|
|
34
|
-
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
35
|
-
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
36
|
-
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./checkDestroyPrevious.function */ "./ts/checkDestroyPrevious.function.ts");
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
28
|
const variablePrefix = '__tagvar';
|
|
47
29
|
const escapeVariable = '--' + variablePrefix + '--';
|
|
48
|
-
const prefixSearch = new RegExp(variablePrefix, 'g');
|
|
49
30
|
const escapeSearch = new RegExp(escapeVariable, 'g');
|
|
50
31
|
class Tag {
|
|
51
32
|
strings;
|
|
52
33
|
values;
|
|
53
|
-
|
|
54
|
-
isTag = true;
|
|
55
|
-
hasLiveElements = false;
|
|
56
|
-
clones = []; // elements on document. Needed at destroy process to know what to destroy
|
|
57
|
-
childTags = []; // tags on me
|
|
58
|
-
tagSupport;
|
|
59
|
-
lastTemplateString = undefined; // used to compare templates for updates
|
|
60
|
-
// only present when a child of a tag
|
|
61
|
-
ownerTag;
|
|
62
|
-
// insertBefore?: Element
|
|
63
|
-
appElement; // only seen on this.getAppElement().appElement
|
|
34
|
+
isTagClass = true;
|
|
64
35
|
// present only when an array. Populated by Tag.key()
|
|
65
36
|
memory = {};
|
|
37
|
+
templater;
|
|
66
38
|
constructor(strings, values) {
|
|
67
39
|
this.strings = strings;
|
|
68
40
|
this.values = values;
|
|
@@ -72,39 +44,141 @@ class Tag {
|
|
|
72
44
|
this.memory.arrayValue = arrayValue;
|
|
73
45
|
return this;
|
|
74
46
|
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/***/ }),
|
|
51
|
+
|
|
52
|
+
/***/ "./ts/TagSupport.class.ts":
|
|
53
|
+
/*!********************************!*\
|
|
54
|
+
!*** ./ts/TagSupport.class.ts ***!
|
|
55
|
+
\********************************/
|
|
56
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
57
|
+
|
|
58
|
+
__webpack_require__.r(__webpack_exports__);
|
|
59
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
60
|
+
/* harmony export */ BaseTagSupport: () => (/* binding */ BaseTagSupport),
|
|
61
|
+
/* harmony export */ TagSupport: () => (/* binding */ TagSupport)
|
|
62
|
+
/* harmony export */ });
|
|
63
|
+
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Tag.class */ "./ts/Tag.class.ts");
|
|
64
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
65
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
66
|
+
/* harmony import */ var _cloneValueArray_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./cloneValueArray.function */ "./ts/cloneValueArray.function.ts");
|
|
67
|
+
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./checkDestroyPrevious.function */ "./ts/checkDestroyPrevious.function.ts");
|
|
68
|
+
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
69
|
+
/* harmony import */ var _destroy_support__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./destroy.support */ "./ts/destroy.support.ts");
|
|
70
|
+
/* harmony import */ var _elementDestroyCheck_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./elementDestroyCheck.function */ "./ts/elementDestroyCheck.function.ts");
|
|
71
|
+
/* harmony import */ var _updateContextItem_function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./updateContextItem.function */ "./ts/updateContextItem.function.ts");
|
|
72
|
+
/* harmony import */ var _processNewValue_function__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./processNewValue.function */ "./ts/processNewValue.function.ts");
|
|
73
|
+
/* harmony import */ var _setTagPlaceholder_function__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./setTagPlaceholder.function */ "./ts/setTagPlaceholder.function.ts");
|
|
74
|
+
/* harmony import */ var _interpolations_interpolateElement__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./interpolations/interpolateElement */ "./ts/interpolations/interpolateElement.ts");
|
|
75
|
+
/* harmony import */ var _interpolations_interpolateTemplate__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./interpolations/interpolateTemplate */ "./ts/interpolations/interpolateTemplate.ts");
|
|
76
|
+
/* harmony import */ var _afterInterpolateElement_function__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./afterInterpolateElement.function */ "./ts/afterInterpolateElement.function.ts");
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
const prefixSearch = new RegExp(_Tag_class__WEBPACK_IMPORTED_MODULE_0__.variablePrefix, 'g');
|
|
92
|
+
/** used only for apps, otherwise use TagSupport */
|
|
93
|
+
class BaseTagSupport {
|
|
94
|
+
templater;
|
|
95
|
+
subject;
|
|
96
|
+
isApp = true;
|
|
97
|
+
appElement; // only seen on this.getAppElement().appElement
|
|
98
|
+
propsConfig;
|
|
99
|
+
// stays with current render
|
|
100
|
+
memory = {
|
|
101
|
+
// context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}
|
|
102
|
+
state: [],
|
|
103
|
+
};
|
|
104
|
+
// travels with all rerenderings
|
|
105
|
+
global = {
|
|
106
|
+
context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}
|
|
107
|
+
providers: [],
|
|
108
|
+
/** Indicator of re-rending. Saves from double rending something already rendered */
|
|
109
|
+
renderCount: 0,
|
|
110
|
+
deleted: false,
|
|
111
|
+
subscriptions: []
|
|
112
|
+
};
|
|
113
|
+
constructor(templater, subject) {
|
|
114
|
+
this.templater = templater;
|
|
115
|
+
this.subject = subject;
|
|
116
|
+
const children = templater.children; // children tags passed in as arguments
|
|
117
|
+
const kidValue = children.value;
|
|
118
|
+
const props = templater.props; // natural props
|
|
119
|
+
const latestCloned = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_1__.deepClone)(props);
|
|
120
|
+
this.propsConfig = {
|
|
121
|
+
latest: props,
|
|
122
|
+
latestCloned, // assume its HTML children and then detect
|
|
123
|
+
lastClonedKidValues: kidValue.map(kid => {
|
|
124
|
+
const cloneValues = (0,_cloneValueArray_function__WEBPACK_IMPORTED_MODULE_3__.cloneValueArray)(kid.values);
|
|
125
|
+
return cloneValues;
|
|
126
|
+
})
|
|
127
|
+
};
|
|
128
|
+
// if the latest props are not HTML children, then clone the props for later render cycles to compare
|
|
129
|
+
if (!(0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagTemplater)(props) && !(0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagClass)(props)) {
|
|
130
|
+
this.propsConfig.latestCloned = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_1__.deepClone)(latestCloned);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
class TagSupport extends BaseTagSupport {
|
|
135
|
+
templater;
|
|
136
|
+
ownerTagSupport;
|
|
137
|
+
subject;
|
|
138
|
+
version;
|
|
139
|
+
isApp = false;
|
|
140
|
+
hasLiveElements = false;
|
|
141
|
+
childTags = []; // tags on me
|
|
142
|
+
clones = []; // elements on document. Needed at destroy process to know what to destroy
|
|
143
|
+
// may not be needed anymore?
|
|
144
|
+
strings;
|
|
145
|
+
values;
|
|
146
|
+
lastTemplateString = undefined; // used to compare templates for updates
|
|
147
|
+
constructor(templater, // at runtime rendering of a tag, it needs to be married to a new TagSupport()
|
|
148
|
+
ownerTagSupport, subject, version = 0) {
|
|
149
|
+
super(templater, subject);
|
|
150
|
+
this.templater = templater;
|
|
151
|
+
this.ownerTagSupport = ownerTagSupport;
|
|
152
|
+
this.subject = subject;
|
|
153
|
+
this.version = version;
|
|
154
|
+
}
|
|
75
155
|
destroy(options = {
|
|
76
156
|
stagger: 0,
|
|
77
157
|
byParent: false, // Only destroy clones of direct children
|
|
78
158
|
}) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
const tagSupport = this.tagSupport;
|
|
83
|
-
const global = tagSupport.templater.global;
|
|
84
|
-
// removing is considered rendering. Prevents after event processing of this tag even tho possibly deleted
|
|
85
|
-
// ++this.tagSupport.templater.global.renderCount
|
|
86
|
-
const subject = tagSupport.subject;
|
|
159
|
+
const global = this.global;
|
|
160
|
+
const subject = this.subject;
|
|
87
161
|
// put back down the template tag
|
|
88
162
|
const insertBefore = global.insertBefore;
|
|
89
163
|
if (insertBefore.nodeName === 'TEMPLATE') {
|
|
90
164
|
const placeholder = global.placeholder;
|
|
91
165
|
if (placeholder && !('arrayValue' in this.memory)) {
|
|
92
166
|
if (!options.byParent) {
|
|
93
|
-
(0,
|
|
167
|
+
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_4__.restoreTagMarker)(this, insertBefore);
|
|
94
168
|
}
|
|
95
169
|
}
|
|
96
170
|
}
|
|
97
171
|
delete global.placeholder;
|
|
98
172
|
// the isComponent check maybe able to be removed
|
|
99
|
-
const isComponent =
|
|
173
|
+
const isComponent = (0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagComponent)(this) ? true : false;
|
|
100
174
|
if (isComponent) {
|
|
101
|
-
(0,
|
|
175
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_5__.runBeforeDestroy)(this, this);
|
|
102
176
|
}
|
|
103
|
-
const childTags = options.byParent ? [] : getChildTagsToDestroy(this.childTags);
|
|
177
|
+
const childTags = options.byParent ? [] : (0,_destroy_support__WEBPACK_IMPORTED_MODULE_6__.getChildTagsToDestroy)(this.childTags);
|
|
104
178
|
// signify that no further event rendering should take place by making logic think a render occurred during event
|
|
105
179
|
// signify immediately child has been deleted (looked for during event processing)
|
|
106
180
|
childTags.forEach(child => {
|
|
107
|
-
const subGlobal = child.
|
|
181
|
+
const subGlobal = child.global;
|
|
108
182
|
delete subGlobal.newest;
|
|
109
183
|
subGlobal.deleted = true;
|
|
110
184
|
});
|
|
@@ -112,11 +186,11 @@ class Tag {
|
|
|
112
186
|
delete global.newest;
|
|
113
187
|
global.deleted = true;
|
|
114
188
|
this.hasLiveElements = false;
|
|
115
|
-
delete subject.
|
|
189
|
+
delete subject.tagSupport;
|
|
116
190
|
this.destroySubscriptions();
|
|
117
191
|
let mainPromise;
|
|
118
|
-
if (this.
|
|
119
|
-
this.
|
|
192
|
+
if (this.ownerTagSupport) {
|
|
193
|
+
this.ownerTagSupport.childTags = this.ownerTagSupport.childTags.filter(child => child !== this);
|
|
120
194
|
}
|
|
121
195
|
if (!options.byParent) {
|
|
122
196
|
const { stagger, promise } = this.destroyClones(options);
|
|
@@ -140,7 +214,7 @@ class Tag {
|
|
|
140
214
|
return mainPromise.then(() => options.stagger);
|
|
141
215
|
}
|
|
142
216
|
destroySubscriptions() {
|
|
143
|
-
const global = this.
|
|
217
|
+
const global = this.global;
|
|
144
218
|
global.subscriptions.forEach(cloneSub => cloneSub.unsubscribe());
|
|
145
219
|
global.subscriptions.length = 0;
|
|
146
220
|
}
|
|
@@ -160,14 +234,14 @@ class Tag {
|
|
|
160
234
|
let promise;
|
|
161
235
|
const customElm = clone;
|
|
162
236
|
if (customElm.ondestroy) {
|
|
163
|
-
promise = (0,
|
|
237
|
+
promise = (0,_elementDestroyCheck_function__WEBPACK_IMPORTED_MODULE_7__.elementDestroyCheck)(customElm, stagger);
|
|
164
238
|
}
|
|
165
239
|
const next = () => {
|
|
166
240
|
clone.parentNode?.removeChild(clone);
|
|
167
|
-
const
|
|
168
|
-
if (
|
|
241
|
+
const ownerSupport = this.ownerTagSupport;
|
|
242
|
+
if (ownerSupport) {
|
|
169
243
|
// Sometimes my clones were first registered to my owner, remove them from owner
|
|
170
|
-
|
|
244
|
+
ownerSupport.clones = ownerSupport.clones.filter(compareClone => compareClone !== clone);
|
|
171
245
|
}
|
|
172
246
|
};
|
|
173
247
|
if (promise instanceof Promise) {
|
|
@@ -178,305 +252,127 @@ class Tag {
|
|
|
178
252
|
}
|
|
179
253
|
return promise;
|
|
180
254
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const safeString = string.replace(prefixSearch, escapeVariable);
|
|
184
|
-
const endString = safeString + (this.values.length > index ? `{${variablePrefix}${index}}` : '');
|
|
185
|
-
// const trimString = index === 0 || index === this.strings.length-1 ? endString.trim() : endString
|
|
186
|
-
const trimString = endString.replace(/>\s*/g, '>').replace(/\s*</g, '<');
|
|
187
|
-
return trimString;
|
|
188
|
-
}).join('');
|
|
189
|
-
const interpolation = (0,_interpolateElement__WEBPACK_IMPORTED_MODULE_2__.interpolateString)(string);
|
|
190
|
-
this.lastTemplateString = interpolation.string;
|
|
191
|
-
return {
|
|
192
|
-
interpolation,
|
|
193
|
-
// string,
|
|
194
|
-
string: interpolation.string,
|
|
195
|
-
strings: this.strings,
|
|
196
|
-
values: this.values,
|
|
197
|
-
context: this.tagSupport.templater.global.context || {},
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
isLikeTag(tag) {
|
|
201
|
-
return (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_7__.isLikeTags)(this, tag);
|
|
255
|
+
update() {
|
|
256
|
+
return this.updateContext(this.global.context);
|
|
202
257
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
if (!this.hasLiveElements) {
|
|
208
|
-
throw new Error('trying to update a tag with no elements on stage');
|
|
209
|
-
}
|
|
210
|
-
this.tagSupport.templater.global.newest = tag;
|
|
211
|
-
if (!this.tagSupport.templater.global.context) {
|
|
212
|
-
throw new Error('issue back here');
|
|
213
|
-
}
|
|
214
|
-
this.updateConfig(tag.strings, tag.values);
|
|
258
|
+
updateBy(tagSupport) {
|
|
259
|
+
const tempTag = tagSupport.templater.tag;
|
|
260
|
+
this.updateConfig(tempTag.strings, tempTag.values);
|
|
215
261
|
}
|
|
216
262
|
updateConfig(strings, values) {
|
|
217
263
|
this.strings = strings;
|
|
218
264
|
this.updateValues(values);
|
|
219
265
|
}
|
|
220
|
-
update() {
|
|
221
|
-
return this.updateContext(this.tagSupport.templater.global.context);
|
|
222
|
-
}
|
|
223
266
|
updateValues(values) {
|
|
224
267
|
this.values = values;
|
|
225
|
-
return this.updateContext(this.
|
|
268
|
+
return this.updateContext(this.global.context);
|
|
226
269
|
}
|
|
227
270
|
updateContext(context) {
|
|
228
|
-
this.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
271
|
+
const thisTag = this.templater.tag;
|
|
272
|
+
const strings = this.strings || thisTag.strings;
|
|
273
|
+
const values = this.values || thisTag.values;
|
|
274
|
+
strings.map((_string, index) => {
|
|
275
|
+
const variableName = _Tag_class__WEBPACK_IMPORTED_MODULE_0__.variablePrefix + index;
|
|
276
|
+
const hasValue = values.length > index;
|
|
277
|
+
const value = values[index];
|
|
232
278
|
// is something already there?
|
|
233
279
|
const exists = variableName in context;
|
|
234
280
|
if (exists) {
|
|
235
|
-
return updateContextItem(context, variableName, value);
|
|
281
|
+
return (0,_updateContextItem_function__WEBPACK_IMPORTED_MODULE_8__.updateContextItem)(context, variableName, value);
|
|
236
282
|
}
|
|
237
283
|
if (!hasValue) {
|
|
238
284
|
return;
|
|
239
285
|
}
|
|
240
286
|
// 🆕 First time values below
|
|
241
|
-
context[variableName] = (0,
|
|
287
|
+
context[variableName] = (0,_processNewValue_function__WEBPACK_IMPORTED_MODULE_9__.processNewValue)(hasValue, value, this);
|
|
242
288
|
});
|
|
243
289
|
return context;
|
|
244
290
|
}
|
|
245
|
-
|
|
246
|
-
let tag = this;
|
|
247
|
-
while (tag.ownerTag) {
|
|
248
|
-
tag = tag.ownerTag;
|
|
249
|
-
}
|
|
250
|
-
return tag;
|
|
251
|
-
}
|
|
252
|
-
/** Used during HMR only where static content itself could have been edited */
|
|
253
|
-
rebuild() {
|
|
254
|
-
// const insertBefore = this.insertBefore
|
|
255
|
-
const insertBefore = this.tagSupport.templater.global.insertBefore;
|
|
256
|
-
if (!insertBefore) {
|
|
257
|
-
const err = new Error('Cannot rebuild. Previous insertBefore element is not defined on tag');
|
|
258
|
-
err.tag = this;
|
|
259
|
-
throw err;
|
|
260
|
-
}
|
|
261
|
-
this.buildBeforeElement(insertBefore, {
|
|
262
|
-
forceElement: true,
|
|
263
|
-
counts: { added: 0, removed: 0 },
|
|
264
|
-
});
|
|
265
|
-
}
|
|
291
|
+
/** Function that kicks off actually putting tags down as HTML elements */
|
|
266
292
|
buildBeforeElement(insertBefore, options = {
|
|
267
293
|
forceElement: false,
|
|
268
294
|
counts: { added: 0, removed: 0 },
|
|
269
295
|
}) {
|
|
270
|
-
const subject = this.
|
|
271
|
-
const
|
|
272
|
-
const global = thisTemplater.global;
|
|
296
|
+
const subject = this.subject;
|
|
297
|
+
const global = this.global;
|
|
273
298
|
global.insertBefore = insertBefore;
|
|
274
299
|
if (!global.placeholder) {
|
|
275
|
-
|
|
276
|
-
throw new Error(' no template at insertBefore');
|
|
277
|
-
global.placeholder = insertBefore;
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
setTagPlaceholder(global);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
if (!global.placeholder?.parentNode) {
|
|
284
|
-
throw new Error('????');
|
|
300
|
+
(0,_setTagPlaceholder_function__WEBPACK_IMPORTED_MODULE_10__.setTagPlaceholder)(global);
|
|
285
301
|
}
|
|
286
302
|
const placeholderElm = global.placeholder;
|
|
287
303
|
global.oldest = this;
|
|
288
304
|
global.newest = this;
|
|
289
|
-
subject.
|
|
305
|
+
subject.tagSupport = this;
|
|
290
306
|
this.hasLiveElements = true;
|
|
291
307
|
// remove old clones
|
|
292
308
|
if (this.clones.length) {
|
|
293
309
|
this.clones.forEach(clone => this.checkCloneRemoval(clone, 0));
|
|
294
310
|
}
|
|
295
311
|
global.insertBefore = insertBefore;
|
|
296
|
-
// const context = this.tagSupport.memory.context // this.update()
|
|
297
312
|
const context = this.update();
|
|
298
313
|
const template = this.getTemplate();
|
|
299
|
-
if (!placeholderElm.parentNode) {
|
|
300
|
-
throw new Error('no parent before building tag');
|
|
301
|
-
}
|
|
302
314
|
const elementContainer = document.createElement('div');
|
|
303
315
|
elementContainer.id = 'tag-temp-holder';
|
|
304
316
|
// render content with a first child that we can know is our first element
|
|
305
317
|
elementContainer.innerHTML = `<template id="temp-template-tag-wrap">${template.string}</template>`;
|
|
306
318
|
// Search/replace innerHTML variables but don't interpolate tag components just yet
|
|
307
|
-
const { tagComponents } = (0,
|
|
319
|
+
const { tagComponents } = (0,_interpolations_interpolateElement__WEBPACK_IMPORTED_MODULE_11__.interpolateElement)(elementContainer, context, template, this, // ownerSupport,
|
|
308
320
|
{
|
|
309
321
|
forceElement: options.forceElement,
|
|
310
322
|
counts: options.counts
|
|
311
323
|
});
|
|
312
|
-
|
|
313
|
-
throw new Error('no parent after building tag');
|
|
314
|
-
}
|
|
315
|
-
afterInterpolateElement(elementContainer, placeholderElm, this, // ownerTag
|
|
324
|
+
(0,_afterInterpolateElement_function__WEBPACK_IMPORTED_MODULE_13__.afterInterpolateElement)(elementContainer, placeholderElm, this, // ownerSupport
|
|
316
325
|
context, options);
|
|
317
|
-
if (!global.placeholder?.parentNode) {
|
|
318
|
-
throw new Error('???? - 2');
|
|
319
|
-
}
|
|
320
326
|
// Any tag components that were found should be processed AFTER the owner processes its elements. Avoid double processing of elements attributes like (oninit)=${}
|
|
321
327
|
let isForceElement = options.forceElement;
|
|
322
328
|
tagComponents.forEach(tagComponent => {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
const placeholderElm = tagGlobal.placeholder; // global.placeholderElm
|
|
326
|
-
if (!placeholderElm && !insertBefore.parentNode) {
|
|
327
|
-
throw new Error('no parent building tag components');
|
|
328
|
-
}
|
|
329
|
-
if (!global.placeholder?.parentNode) {
|
|
330
|
-
throw new Error('???? - 3');
|
|
331
|
-
}
|
|
332
|
-
(0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_3__.subscribeToTemplate)(tagComponent.insertBefore, tagComponent.subject, tagComponent.ownerTag, options.counts, { isForceElement });
|
|
333
|
-
if (!global.placeholder?.parentNode) {
|
|
334
|
-
throw new Error('???? - 4');
|
|
335
|
-
}
|
|
336
|
-
afterInterpolateElement(elementContainer, tagComponent.insertBefore, tagComponent.ownerTag, // this, // ownerTag
|
|
329
|
+
(0,_interpolations_interpolateTemplate__WEBPACK_IMPORTED_MODULE_12__.subscribeToTemplate)(tagComponent.insertBefore, tagComponent.subject, tagComponent.ownerSupport, options.counts, { isForceElement });
|
|
330
|
+
(0,_afterInterpolateElement_function__WEBPACK_IMPORTED_MODULE_13__.afterInterpolateElement)(elementContainer, tagComponent.insertBefore, tagComponent.ownerSupport, // this, // ownerTag
|
|
337
331
|
context, options);
|
|
338
|
-
if (!global.placeholder?.parentNode) {
|
|
339
|
-
throw new Error('???? - 5');
|
|
340
|
-
}
|
|
341
332
|
});
|
|
342
333
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
return
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
for (let index = childTags.length - 1; index >= 0; --index) {
|
|
364
|
-
const cTag = childTags[index];
|
|
365
|
-
if (allTags.find(x => x === cTag)) {
|
|
366
|
-
// TODO: Lets find why a child tag is attached twice to owner
|
|
367
|
-
throw new Error('child tag registered twice for delete');
|
|
368
|
-
}
|
|
369
|
-
allTags.push(cTag);
|
|
370
|
-
childTags.splice(index, 1);
|
|
371
|
-
getChildTagsToDestroy(cTag.childTags, allTags);
|
|
372
|
-
}
|
|
373
|
-
return allTags;
|
|
374
|
-
}
|
|
375
|
-
function updateContextItem(context, variableName, value) {
|
|
376
|
-
const subject = context[variableName];
|
|
377
|
-
const tag = subject.tag;
|
|
378
|
-
if (tag) {
|
|
379
|
-
const oldTemp = tag.tagSupport.templater;
|
|
380
|
-
if (value && value.global !== oldTemp.global) {
|
|
381
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagComponent)(value)) {
|
|
382
|
-
shareTemplaterGlobal(oldTemp, value);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
// return updateExistingValue(subject, value, this)
|
|
387
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_6__.isSubjectInstance)(value)) {
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
subject.set(value); // listeners will evaluate updated values to possibly update display(s)
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
function shareTemplaterGlobal(oldTemp, value) {
|
|
394
|
-
const oldWrap = oldTemp.wrapper; // tag versus component
|
|
395
|
-
const oldValueFn = oldWrap.original;
|
|
396
|
-
const newValueFn = value.wrapper?.original;
|
|
397
|
-
const fnMatched = oldValueFn === newValueFn;
|
|
398
|
-
if (fnMatched) {
|
|
399
|
-
value.global = oldTemp.global;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
/***/ }),
|
|
405
|
-
|
|
406
|
-
/***/ "./ts/TagSupport.class.ts":
|
|
407
|
-
/*!********************************!*\
|
|
408
|
-
!*** ./ts/TagSupport.class.ts ***!
|
|
409
|
-
\********************************/
|
|
410
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
411
|
-
|
|
412
|
-
__webpack_require__.r(__webpack_exports__);
|
|
413
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
414
|
-
/* harmony export */ BaseTagSupport: () => (/* binding */ BaseTagSupport),
|
|
415
|
-
/* harmony export */ TagSupport: () => (/* binding */ TagSupport)
|
|
416
|
-
/* harmony export */ });
|
|
417
|
-
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
418
|
-
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
class BaseTagSupport {
|
|
422
|
-
templater;
|
|
423
|
-
subject;
|
|
424
|
-
isApp = true;
|
|
425
|
-
propsConfig;
|
|
426
|
-
memory = {
|
|
427
|
-
// context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}
|
|
428
|
-
state: {
|
|
429
|
-
newest: [],
|
|
430
|
-
},
|
|
431
|
-
};
|
|
432
|
-
constructor(templater, subject) {
|
|
433
|
-
this.templater = templater;
|
|
434
|
-
this.subject = subject;
|
|
435
|
-
const children = this.templater.children; // children tags passed in as arguments
|
|
436
|
-
const props = this.templater.props; // natural props
|
|
437
|
-
const latestCloned = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(props); // alterProps(props, templater)
|
|
438
|
-
this.propsConfig = {
|
|
439
|
-
latest: props,
|
|
440
|
-
latestCloned, // assume its HTML children and then detect
|
|
441
|
-
clonedProps: latestCloned, // maybe duplicate
|
|
442
|
-
lastClonedKidValues: children.value.map(kid => {
|
|
443
|
-
const cloneValues = cloneValueArray(kid.values);
|
|
444
|
-
return cloneValues;
|
|
445
|
-
})
|
|
334
|
+
getTemplate() {
|
|
335
|
+
const thisTag = this.templater.tag;
|
|
336
|
+
const strings = this.strings || thisTag.strings;
|
|
337
|
+
const values = this.values || thisTag.values;
|
|
338
|
+
const string = strings.map((string, index) => {
|
|
339
|
+
const safeString = string.replace(prefixSearch, _Tag_class__WEBPACK_IMPORTED_MODULE_0__.escapeVariable);
|
|
340
|
+
const endString = safeString + (values.length > index ? `{${_Tag_class__WEBPACK_IMPORTED_MODULE_0__.variablePrefix}${index}}` : '');
|
|
341
|
+
// const trimString = index === 0 || index === this.strings.length-1 ? endString.trim() : endString
|
|
342
|
+
const trimString = endString.replace(/>\s*/g, '>').replace(/\s*</g, '<');
|
|
343
|
+
return trimString;
|
|
344
|
+
}).join('');
|
|
345
|
+
const interpolation = (0,_interpolations_interpolateElement__WEBPACK_IMPORTED_MODULE_11__.interpolateString)(string);
|
|
346
|
+
this.lastTemplateString = interpolation.string;
|
|
347
|
+
return {
|
|
348
|
+
interpolation,
|
|
349
|
+
// string,
|
|
350
|
+
string: interpolation.string,
|
|
351
|
+
strings,
|
|
352
|
+
values,
|
|
353
|
+
context: this.global.context || {},
|
|
446
354
|
};
|
|
447
|
-
// if the latest props are not HTML children, then clone the props for later render cycles to compare
|
|
448
|
-
if (!(0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagInstance)(props)) {
|
|
449
|
-
this.propsConfig.latestCloned = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(latestCloned);
|
|
450
|
-
this.propsConfig.clonedProps = this.propsConfig.latestCloned;
|
|
451
|
-
}
|
|
452
355
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
const
|
|
457
|
-
if (
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
const tagComponent = tag;
|
|
462
|
-
return (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(tagComponent.props);
|
|
356
|
+
/** Used during HMR only where static content itself could have been edited */
|
|
357
|
+
rebuild() {
|
|
358
|
+
// const insertBefore = this.insertBefore
|
|
359
|
+
const insertBefore = this.global.insertBefore;
|
|
360
|
+
if (!insertBefore) {
|
|
361
|
+
const err = new Error('Cannot rebuild. Previous insertBefore element is not defined on tag');
|
|
362
|
+
err.tag = this;
|
|
363
|
+
throw err;
|
|
463
364
|
}
|
|
464
|
-
|
|
465
|
-
|
|
365
|
+
this.buildBeforeElement(insertBefore, {
|
|
366
|
+
forceElement: true,
|
|
367
|
+
counts: { added: 0, removed: 0 },
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
getAppElement() {
|
|
371
|
+
let tag = this;
|
|
372
|
+
while (tag.ownerTagSupport) {
|
|
373
|
+
tag = tag.ownerTagSupport;
|
|
466
374
|
}
|
|
467
|
-
return
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
class TagSupport extends BaseTagSupport {
|
|
471
|
-
ownerTagSupport;
|
|
472
|
-
templater;
|
|
473
|
-
subject;
|
|
474
|
-
isApp = false;
|
|
475
|
-
constructor(ownerTagSupport, templater, subject) {
|
|
476
|
-
super(templater, subject);
|
|
477
|
-
this.ownerTagSupport = ownerTagSupport;
|
|
478
|
-
this.templater = templater;
|
|
479
|
-
this.subject = subject;
|
|
375
|
+
return tag;
|
|
480
376
|
}
|
|
481
377
|
}
|
|
482
378
|
|
|
@@ -505,77 +401,95 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
505
401
|
class TemplaterResult {
|
|
506
402
|
props;
|
|
507
403
|
children;
|
|
508
|
-
|
|
404
|
+
isTemplater = true;
|
|
509
405
|
tagged;
|
|
510
406
|
wrapper;
|
|
511
|
-
|
|
512
|
-
newestTemplater: this,
|
|
513
|
-
context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}
|
|
514
|
-
providers: [],
|
|
515
|
-
/** Indicator of re-rending. Saves from double rending something already rendered */
|
|
516
|
-
renderCount: 0,
|
|
517
|
-
deleted: false,
|
|
518
|
-
subscriptions: []
|
|
519
|
-
};
|
|
520
|
-
tagSupport;
|
|
407
|
+
tag;
|
|
521
408
|
constructor(props, children) {
|
|
522
409
|
this.props = props;
|
|
523
410
|
this.children = children;
|
|
524
411
|
}
|
|
525
|
-
/*
|
|
526
|
-
redraw?: (
|
|
527
|
-
force?: boolean, // force children to redraw
|
|
528
|
-
) => Tag
|
|
529
|
-
*/
|
|
530
|
-
isTemplater = true;
|
|
531
412
|
}
|
|
532
|
-
function renderWithSupport(tagSupport,
|
|
533
|
-
|
|
413
|
+
function renderWithSupport(tagSupport, // new
|
|
414
|
+
lastSupport, // previous
|
|
415
|
+
subject, // events & memory
|
|
416
|
+
ownerSupport) {
|
|
534
417
|
/* BEFORE RENDER */
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
418
|
+
const lastOwnerSupport = lastSupport?.ownerTagSupport;
|
|
419
|
+
const runtimeOwnerSupport = lastOwnerSupport || ownerSupport;
|
|
420
|
+
if (lastSupport) {
|
|
421
|
+
const lastState = lastSupport.memory.state;
|
|
422
|
+
const memory = tagSupport.memory;
|
|
423
|
+
memory.state = [...lastState];
|
|
424
|
+
tagSupport.global = lastSupport.global;
|
|
425
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runBeforeRedraw)(tagSupport, lastSupport);
|
|
540
426
|
}
|
|
541
427
|
else {
|
|
542
|
-
if (!wrapTagSupport) {
|
|
543
|
-
throw new Error('63521');
|
|
544
|
-
}
|
|
545
428
|
// first time render
|
|
546
|
-
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runBeforeRender)(
|
|
429
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runBeforeRender)(tagSupport, runtimeOwnerSupport);
|
|
547
430
|
// TODO: Logic below most likely could live within providers.ts inside the runBeforeRender function
|
|
548
431
|
const providers = _state__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
549
|
-
providers.
|
|
432
|
+
providers.ownerSupport = runtimeOwnerSupport;
|
|
550
433
|
}
|
|
551
434
|
/* END: BEFORE RENDER */
|
|
552
|
-
const templater =
|
|
435
|
+
const templater = tagSupport.templater;
|
|
436
|
+
const subTag = subject.tagSupport;
|
|
553
437
|
// NEW TAG CREATED HERE
|
|
554
|
-
const
|
|
438
|
+
const wrapper = templater.wrapper;
|
|
439
|
+
const reSupport = wrapper(tagSupport, subject);
|
|
555
440
|
/* AFTER */
|
|
556
|
-
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runAfterRender)(
|
|
557
|
-
const isLikeTag = !
|
|
441
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runAfterRender)(tagSupport, reSupport);
|
|
442
|
+
const isLikeTag = !lastSupport || (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__.isLikeTags)(lastSupport, reSupport);
|
|
558
443
|
if (!isLikeTag) {
|
|
559
|
-
destroyUnlikeTags(
|
|
444
|
+
destroyUnlikeTags(lastSupport, reSupport, subject);
|
|
560
445
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
return
|
|
446
|
+
reSupport.ownerTagSupport = (ownerSupport || lastOwnerSupport);
|
|
447
|
+
tagSupport.global.newest = reSupport;
|
|
448
|
+
return reSupport;
|
|
564
449
|
}
|
|
565
|
-
function destroyUnlikeTags(
|
|
566
|
-
|
|
450
|
+
function destroyUnlikeTags(lastSupport, // old
|
|
451
|
+
reSupport, // new
|
|
567
452
|
subject) {
|
|
568
|
-
const oldGlobal =
|
|
453
|
+
const oldGlobal = lastSupport.global;
|
|
569
454
|
const insertBefore = oldGlobal.insertBefore;
|
|
570
|
-
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_3__.destroyTagMemory)(
|
|
571
|
-
//
|
|
572
|
-
|
|
573
|
-
const global =
|
|
455
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_3__.destroyTagMemory)(lastSupport, subject);
|
|
456
|
+
// when a tag is destroyed, disconnect the globals
|
|
457
|
+
reSupport.global = { ...oldGlobal }; // break memory references
|
|
458
|
+
const global = reSupport.global;
|
|
574
459
|
global.insertBefore = insertBefore;
|
|
575
460
|
global.deleted = false;
|
|
576
461
|
delete global.oldest;
|
|
577
462
|
delete global.newest;
|
|
578
|
-
delete subject.
|
|
463
|
+
delete subject.tagSupport;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
/***/ }),
|
|
468
|
+
|
|
469
|
+
/***/ "./ts/afterInterpolateElement.function.ts":
|
|
470
|
+
/*!************************************************!*\
|
|
471
|
+
!*** ./ts/afterInterpolateElement.function.ts ***!
|
|
472
|
+
\************************************************/
|
|
473
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
474
|
+
|
|
475
|
+
__webpack_require__.r(__webpack_exports__);
|
|
476
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
477
|
+
/* harmony export */ afterInterpolateElement: () => (/* binding */ afterInterpolateElement)
|
|
478
|
+
/* harmony export */ });
|
|
479
|
+
/* harmony import */ var _render__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./render */ "./ts/render.ts");
|
|
480
|
+
/* harmony import */ var _interpolations_interpolateTemplate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./interpolations/interpolateTemplate */ "./ts/interpolations/interpolateTemplate.ts");
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
function afterInterpolateElement(container, insertBefore, tagSupport,
|
|
484
|
+
// preClones: Clones,
|
|
485
|
+
context, options) {
|
|
486
|
+
const clones = (0,_render__WEBPACK_IMPORTED_MODULE_0__.buildClones)(container, insertBefore);
|
|
487
|
+
if (!clones.length) {
|
|
488
|
+
return clones;
|
|
489
|
+
}
|
|
490
|
+
clones.forEach(clone => (0,_interpolations_interpolateTemplate__WEBPACK_IMPORTED_MODULE_1__.afterElmBuild)(clone, options, context, tagSupport));
|
|
491
|
+
tagSupport.clones.push(...clones);
|
|
492
|
+
return clones;
|
|
579
493
|
}
|
|
580
494
|
|
|
581
495
|
|
|
@@ -597,11 +511,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
597
511
|
|
|
598
512
|
|
|
599
513
|
/* Used to rewrite props that are functions. When they are called it should cause parent rendering */
|
|
600
|
-
function alterProps(props,
|
|
514
|
+
function alterProps(props, ownerSupport) {
|
|
601
515
|
function callback(toCall, callWith) {
|
|
602
|
-
return callbackPropOwner(toCall, callWith,
|
|
516
|
+
return callbackPropOwner(toCall, callWith, ownerSupport);
|
|
603
517
|
}
|
|
604
|
-
const isPropTag = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.
|
|
518
|
+
const isPropTag = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTag)(props);
|
|
605
519
|
const watchProps = isPropTag ? 0 : props;
|
|
606
520
|
const newProps = resetFunctionProps(watchProps, callback);
|
|
607
521
|
return newProps;
|
|
@@ -630,81 +544,14 @@ function resetFunctionProps(props, callback) {
|
|
|
630
544
|
});
|
|
631
545
|
return newProps;
|
|
632
546
|
}
|
|
633
|
-
function callbackPropOwner(toCall, callWith,
|
|
634
|
-
ownerSupport) {
|
|
635
|
-
const renderCount = templater.global.renderCount;
|
|
547
|
+
function callbackPropOwner(toCall, callWith, ownerSupport) {
|
|
636
548
|
const callbackResult = toCall(...callWith);
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
}
|
|
640
|
-
const lastestOwner = ownerSupport.templater.global.newest;
|
|
641
|
-
const newOwner = (0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(lastestOwner.tagSupport, true);
|
|
642
|
-
if (newOwner.tagSupport.templater.global.newest != newOwner) {
|
|
643
|
-
throw new Error('newest assignment issue?');
|
|
644
|
-
}
|
|
549
|
+
const lastestOwner = ownerSupport.global.newest;
|
|
550
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(lastestOwner, true);
|
|
645
551
|
return callbackResult;
|
|
646
552
|
}
|
|
647
553
|
|
|
648
554
|
|
|
649
|
-
/***/ }),
|
|
650
|
-
|
|
651
|
-
/***/ "./ts/bindSubjectCallback.function.ts":
|
|
652
|
-
/*!********************************************!*\
|
|
653
|
-
!*** ./ts/bindSubjectCallback.function.ts ***!
|
|
654
|
-
\********************************************/
|
|
655
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
656
|
-
|
|
657
|
-
__webpack_require__.r(__webpack_exports__);
|
|
658
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
659
|
-
/* harmony export */ bindSubjectCallback: () => (/* binding */ bindSubjectCallback),
|
|
660
|
-
/* harmony export */ runTagCallback: () => (/* binding */ runTagCallback)
|
|
661
|
-
/* harmony export */ });
|
|
662
|
-
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
663
|
-
/** File largely responsible for reacting to element events, such as onclick */
|
|
664
|
-
|
|
665
|
-
function bindSubjectCallback(value, tag) {
|
|
666
|
-
// Is this children? No override needed
|
|
667
|
-
if (value.isChildOverride) {
|
|
668
|
-
return value;
|
|
669
|
-
}
|
|
670
|
-
if (!tag.ownerTag && !tag.tagSupport.templater.global.isApp) {
|
|
671
|
-
throw new Error('no ownerTag issue here');
|
|
672
|
-
}
|
|
673
|
-
const subjectFunction = (element, args) => runTagCallback(value, tag, element, args);
|
|
674
|
-
// link back to original. Mostly used for <div oninit ondestroy> animations
|
|
675
|
-
subjectFunction.tagFunction = value;
|
|
676
|
-
return subjectFunction;
|
|
677
|
-
}
|
|
678
|
-
function runTagCallback(value, tag, bindTo, args) {
|
|
679
|
-
const tagSupport = tag.tagSupport;
|
|
680
|
-
const renderCount = tagSupport.templater.global.renderCount;
|
|
681
|
-
const method = value.bind(bindTo);
|
|
682
|
-
const callbackResult = method(...args);
|
|
683
|
-
const sameRenderCount = renderCount === tagSupport.templater.global.renderCount;
|
|
684
|
-
// already rendered OR tag was deleted before event processing
|
|
685
|
-
if (!sameRenderCount || tagSupport.templater.global.deleted) {
|
|
686
|
-
if (callbackResult instanceof Promise) {
|
|
687
|
-
return callbackResult.then(() => {
|
|
688
|
-
return 'promise-no-data-ever'; // tag was deleted during event processing
|
|
689
|
-
});
|
|
690
|
-
}
|
|
691
|
-
return 'no-data-ever'; // already rendered
|
|
692
|
-
}
|
|
693
|
-
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_0__.renderTagSupport)(tagSupport, true);
|
|
694
|
-
if (callbackResult instanceof Promise) {
|
|
695
|
-
return callbackResult.then(() => {
|
|
696
|
-
if (tagSupport.templater.global.deleted) {
|
|
697
|
-
return 'promise-no-data-ever'; // tag was deleted during event processing
|
|
698
|
-
}
|
|
699
|
-
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_0__.renderTagSupport)(tagSupport, true);
|
|
700
|
-
return 'promise-no-data-ever';
|
|
701
|
-
});
|
|
702
|
-
}
|
|
703
|
-
// Caller always expects a Promise
|
|
704
|
-
return 'no-data-ever';
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
|
|
708
555
|
/***/ }),
|
|
709
556
|
|
|
710
557
|
/***/ "./ts/checkDestroyPrevious.function.ts":
|
|
@@ -737,22 +584,22 @@ newValue, insertBefore) {
|
|
|
737
584
|
delete arraySubject.lastArray;
|
|
738
585
|
delete arraySubject.placeholder;
|
|
739
586
|
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_3__.insertAfter)(insertBefore, placeholderElm);
|
|
740
|
-
wasArray.forEach(({
|
|
587
|
+
wasArray.forEach(({ tagSupport }) => destroyArrayTag(tagSupport, { added: 0, removed: 0 }));
|
|
741
588
|
return 'array';
|
|
742
589
|
}
|
|
743
590
|
const tagSubject = subject;
|
|
744
|
-
const
|
|
591
|
+
const lastSupport = tagSubject.tagSupport;
|
|
745
592
|
// no longer tag or component?
|
|
746
|
-
if (
|
|
747
|
-
const isValueTag = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.
|
|
748
|
-
const isSubjectTag = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.
|
|
593
|
+
if (lastSupport) {
|
|
594
|
+
const isValueTag = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTag)(newValue);
|
|
595
|
+
const isSubjectTag = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTag)(subject.value);
|
|
749
596
|
if (isSubjectTag && isValueTag) {
|
|
750
597
|
const newTag = newValue;
|
|
751
598
|
// its a different tag now
|
|
752
|
-
if (!(0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_1__.isLikeTags)(newTag,
|
|
599
|
+
if (!(0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_1__.isLikeTags)(newTag, lastSupport)) {
|
|
753
600
|
// put template back down
|
|
754
|
-
restoreTagMarker(
|
|
755
|
-
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(
|
|
601
|
+
restoreTagMarker(lastSupport, insertBefore);
|
|
602
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(lastSupport, tagSubject);
|
|
756
603
|
return 2;
|
|
757
604
|
}
|
|
758
605
|
return false;
|
|
@@ -762,9 +609,9 @@ newValue, insertBefore) {
|
|
|
762
609
|
return false; // its still a tag component
|
|
763
610
|
}
|
|
764
611
|
// put template back down
|
|
765
|
-
restoreTagMarker(
|
|
612
|
+
restoreTagMarker(lastSupport, insertBefore);
|
|
766
613
|
// destroy old component, value is not a component
|
|
767
|
-
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(
|
|
614
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(lastSupport, tagSubject);
|
|
768
615
|
return 'different-tag';
|
|
769
616
|
}
|
|
770
617
|
const displaySubject = subject;
|
|
@@ -773,15 +620,18 @@ newValue, insertBefore) {
|
|
|
773
620
|
// was simple value but now something bigger
|
|
774
621
|
if (hasLastValue && lastValue !== newValue) {
|
|
775
622
|
destroySimpleValue(insertBefore, displaySubject);
|
|
776
|
-
return
|
|
623
|
+
return 'changed-simple-value';
|
|
777
624
|
}
|
|
778
625
|
return false;
|
|
779
626
|
}
|
|
780
|
-
function destroyArrayTag(
|
|
781
|
-
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagSupportPast)(
|
|
782
|
-
|
|
627
|
+
function destroyArrayTag(tagSupport, counts) {
|
|
628
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagSupportPast)(tagSupport);
|
|
629
|
+
tagSupport.destroy({
|
|
783
630
|
stagger: counts.removed++,
|
|
784
631
|
});
|
|
632
|
+
const insertBefore = tagSupport.global.insertBefore;
|
|
633
|
+
const parentNode = insertBefore.parentNode;
|
|
634
|
+
parentNode.removeChild(insertBefore);
|
|
785
635
|
}
|
|
786
636
|
function destroySimpleValue(insertBefore, // always a template tag
|
|
787
637
|
subject) {
|
|
@@ -793,8 +643,8 @@ subject) {
|
|
|
793
643
|
delete subject.clone;
|
|
794
644
|
delete subject.lastValue;
|
|
795
645
|
}
|
|
796
|
-
function restoreTagMarker(
|
|
797
|
-
const global =
|
|
646
|
+
function restoreTagMarker(lastSupport, insertBefore) {
|
|
647
|
+
const global = lastSupport.global;
|
|
798
648
|
const placeholderElm = global.placeholder;
|
|
799
649
|
if (placeholderElm) {
|
|
800
650
|
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_3__.insertAfter)(insertBefore, placeholderElm);
|
|
@@ -802,6 +652,40 @@ function restoreTagMarker(existingTag, insertBefore) {
|
|
|
802
652
|
}
|
|
803
653
|
|
|
804
654
|
|
|
655
|
+
/***/ }),
|
|
656
|
+
|
|
657
|
+
/***/ "./ts/cloneValueArray.function.ts":
|
|
658
|
+
/*!****************************************!*\
|
|
659
|
+
!*** ./ts/cloneValueArray.function.ts ***!
|
|
660
|
+
\****************************************/
|
|
661
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
662
|
+
|
|
663
|
+
__webpack_require__.r(__webpack_exports__);
|
|
664
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
665
|
+
/* harmony export */ cloneValueArray: () => (/* binding */ cloneValueArray)
|
|
666
|
+
/* harmony export */ });
|
|
667
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
668
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
function cloneValueArray(values) {
|
|
672
|
+
return values.map((value) => {
|
|
673
|
+
const tag = value;
|
|
674
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value)) {
|
|
675
|
+
const tagComponent = value;
|
|
676
|
+
return (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(tagComponent.props);
|
|
677
|
+
}
|
|
678
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagClass)(tag) || (0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagTemplater)(tag)) {
|
|
679
|
+
return cloneValueArray(tag.values);
|
|
680
|
+
}
|
|
681
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagArray)(tag)) {
|
|
682
|
+
return cloneValueArray(tag);
|
|
683
|
+
}
|
|
684
|
+
return (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(value);
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
|
|
805
689
|
/***/ }),
|
|
806
690
|
|
|
807
691
|
/***/ "./ts/deepFunctions.ts":
|
|
@@ -857,51 +741,58 @@ function deepEqual(obj1, obj2) {
|
|
|
857
741
|
return isDeepEqual(obj1, obj2, new WeakMap());
|
|
858
742
|
}
|
|
859
743
|
function isDeepEqual(obj1, obj2, visited) {
|
|
860
|
-
|
|
744
|
+
const directEqual = obj1 === obj2;
|
|
745
|
+
if (directEqual || isSameFunctions(obj1, obj2)) {
|
|
861
746
|
return true;
|
|
862
747
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
748
|
+
// If obj is already visited, return the cloned reference
|
|
749
|
+
if (visited.has(obj1)) {
|
|
750
|
+
return true;
|
|
751
|
+
}
|
|
752
|
+
if (typeof obj1 === 'object' && typeof obj2 === 'object') {
|
|
753
|
+
// both are dates and were already determined not the same
|
|
754
|
+
if (obj1 instanceof Date && obj2 instanceof Date) {
|
|
755
|
+
return false;
|
|
756
|
+
}
|
|
757
|
+
// Register the cloned object to avoid cyclic references
|
|
758
|
+
visited.set(obj1, 0);
|
|
759
|
+
// Check if obj1 and obj2 are both arrays
|
|
760
|
+
if (Array.isArray(obj1) && Array.isArray(obj2)) {
|
|
761
|
+
return isArrayDeepEqual(obj1, obj2, visited);
|
|
762
|
+
}
|
|
763
|
+
else if (Array.isArray(obj1) || Array.isArray(obj2)) {
|
|
764
|
+
// One is an array, and the other is not
|
|
765
|
+
return false;
|
|
766
|
+
}
|
|
767
|
+
return isObjectDeepEqual(obj1, obj2, visited);
|
|
868
768
|
}
|
|
769
|
+
return false;
|
|
770
|
+
}
|
|
771
|
+
function isObjectDeepEqual(obj1, obj2, visited) {
|
|
869
772
|
const keys1 = Object.keys(obj1);
|
|
870
773
|
const keys2 = Object.keys(obj2);
|
|
774
|
+
if (keys1.length === 0 && keys2.length === 0) {
|
|
775
|
+
return true;
|
|
776
|
+
}
|
|
871
777
|
if (keys1.length !== keys2.length) {
|
|
872
778
|
return false;
|
|
873
779
|
}
|
|
874
|
-
// If obj is already visited, return the cloned reference
|
|
875
|
-
if (visited.has(obj1)) {
|
|
876
|
-
return true;
|
|
877
|
-
}
|
|
878
|
-
// Register the cloned object to avoid cyclic references
|
|
879
|
-
visited.set(obj1, 0);
|
|
880
780
|
for (const key of keys1) {
|
|
881
781
|
const keyFound = keys2.includes(key);
|
|
882
782
|
if (!keyFound || !isDeepEqual(obj1[key], obj2[key], visited)) {
|
|
883
|
-
/*
|
|
884
|
-
if(isSameFunctions(obj1[key], obj2[key])) {
|
|
885
|
-
continue
|
|
886
|
-
}
|
|
887
|
-
*/
|
|
888
783
|
return false;
|
|
889
784
|
}
|
|
890
785
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
786
|
+
return true;
|
|
787
|
+
}
|
|
788
|
+
function isArrayDeepEqual(obj1, obj2, visited) {
|
|
789
|
+
if (obj1.length !== obj2.length) {
|
|
790
|
+
return false;
|
|
791
|
+
}
|
|
792
|
+
for (let i = 0; i < obj1.length; i++) {
|
|
793
|
+
if (!isDeepEqual(obj1[i], obj2[i], visited)) {
|
|
894
794
|
return false;
|
|
895
795
|
}
|
|
896
|
-
for (let i = 0; i < obj1.length; i++) {
|
|
897
|
-
if (!isDeepEqual(obj1[i], obj2[i], visited)) {
|
|
898
|
-
return false;
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
else if (Array.isArray(obj1) || Array.isArray(obj2)) {
|
|
903
|
-
// One is an array, and the other is not
|
|
904
|
-
return false;
|
|
905
796
|
}
|
|
906
797
|
return true;
|
|
907
798
|
}
|
|
@@ -911,6 +802,29 @@ function isSameFunctions(fn0, fn1) {
|
|
|
911
802
|
}
|
|
912
803
|
|
|
913
804
|
|
|
805
|
+
/***/ }),
|
|
806
|
+
|
|
807
|
+
/***/ "./ts/destroy.support.ts":
|
|
808
|
+
/*!*******************************!*\
|
|
809
|
+
!*** ./ts/destroy.support.ts ***!
|
|
810
|
+
\*******************************/
|
|
811
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
812
|
+
|
|
813
|
+
__webpack_require__.r(__webpack_exports__);
|
|
814
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
815
|
+
/* harmony export */ getChildTagsToDestroy: () => (/* binding */ getChildTagsToDestroy)
|
|
816
|
+
/* harmony export */ });
|
|
817
|
+
function getChildTagsToDestroy(childTags, allTags = []) {
|
|
818
|
+
for (let index = childTags.length - 1; index >= 0; --index) {
|
|
819
|
+
const cTag = childTags[index];
|
|
820
|
+
allTags.push(cTag);
|
|
821
|
+
childTags.splice(index, 1);
|
|
822
|
+
getChildTagsToDestroy(cTag.childTags, allTags);
|
|
823
|
+
}
|
|
824
|
+
return allTags;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
|
|
914
828
|
/***/ }),
|
|
915
829
|
|
|
916
830
|
/***/ "./ts/destroyTag.function.ts":
|
|
@@ -924,22 +838,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
924
838
|
/* harmony export */ destroyTagMemory: () => (/* binding */ destroyTagMemory),
|
|
925
839
|
/* harmony export */ destroyTagSupportPast: () => (/* binding */ destroyTagSupportPast)
|
|
926
840
|
/* harmony export */ });
|
|
927
|
-
function destroyTagMemory(
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
throw new Error('fff - subjects do not match');
|
|
931
|
-
}
|
|
932
|
-
delete subject.tag;
|
|
933
|
-
delete oldTagSupport.subject.tag; // TODO: this line maybe not needed
|
|
841
|
+
function destroyTagMemory(oldTagSupport, subject) {
|
|
842
|
+
delete subject.tagSupport;
|
|
843
|
+
delete oldTagSupport.subject.tagSupport; // TODO: this line maybe not needed
|
|
934
844
|
// must destroy oldest which is tag with elements on stage
|
|
935
|
-
const oldest = oldTagSupport.
|
|
845
|
+
const oldest = oldTagSupport.global.oldest;
|
|
936
846
|
oldest.destroy();
|
|
937
847
|
destroyTagSupportPast(oldTagSupport);
|
|
938
|
-
oldTagSupport.
|
|
848
|
+
oldTagSupport.global.context = {};
|
|
939
849
|
}
|
|
940
850
|
function destroyTagSupportPast(oldTagSupport) {
|
|
941
|
-
delete oldTagSupport.
|
|
942
|
-
delete oldTagSupport.
|
|
851
|
+
delete oldTagSupport.global.oldest;
|
|
852
|
+
delete oldTagSupport.global.newest;
|
|
943
853
|
}
|
|
944
854
|
|
|
945
855
|
|
|
@@ -965,42 +875,11 @@ function elementDestroyCheck(nextSibling, stagger) {
|
|
|
965
875
|
return;
|
|
966
876
|
}
|
|
967
877
|
const onDestroy = onDestroyWrap.tagFunction;
|
|
968
|
-
if (!onDestroy) {
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
const event = { target: nextSibling, stagger };
|
|
972
|
-
return onDestroy(event);
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
/***/ }),
|
|
977
|
-
|
|
978
|
-
/***/ "./ts/elementInitCheck.ts":
|
|
979
|
-
/*!********************************!*\
|
|
980
|
-
!*** ./ts/elementInitCheck.ts ***!
|
|
981
|
-
\********************************/
|
|
982
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
983
|
-
|
|
984
|
-
__webpack_require__.r(__webpack_exports__);
|
|
985
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
986
|
-
/* harmony export */ elementInitCheck: () => (/* binding */ elementInitCheck)
|
|
987
|
-
/* harmony export */ });
|
|
988
|
-
function elementInitCheck(nextSibling, counts) {
|
|
989
|
-
const onInitDoubleWrap = nextSibling.oninit;
|
|
990
|
-
if (!onInitDoubleWrap) {
|
|
991
|
-
return counts.added;
|
|
992
|
-
}
|
|
993
|
-
const onInitWrap = onInitDoubleWrap.tagFunction;
|
|
994
|
-
if (!onInitWrap) {
|
|
995
|
-
return counts.added;
|
|
996
|
-
}
|
|
997
|
-
const onInit = onInitWrap.tagFunction;
|
|
998
|
-
if (!onInit) {
|
|
999
|
-
return counts.added;
|
|
878
|
+
if (!onDestroy) {
|
|
879
|
+
return;
|
|
1000
880
|
}
|
|
1001
|
-
const event = { target: nextSibling, stagger
|
|
1002
|
-
|
|
1003
|
-
return ++counts.added;
|
|
881
|
+
const event = { target: nextSibling, stagger };
|
|
882
|
+
return onDestroy(event);
|
|
1004
883
|
}
|
|
1005
884
|
|
|
1006
885
|
|
|
@@ -1064,18 +943,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1064
943
|
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
1065
944
|
|
|
1066
945
|
function hasTagSupportChanged(oldTagSupport, newTagSupport, newTemplater) {
|
|
1067
|
-
const sameSupport = oldTagSupport === newTagSupport;
|
|
1068
|
-
const samePropConfig = oldTagSupport.propsConfig === newTagSupport.propsConfig;
|
|
1069
|
-
// const sameProps = oldTagSupport.propsConfig.latest === newTagSupport.propsConfig.latest
|
|
1070
|
-
if (sameSupport) {
|
|
1071
|
-
throw new Error('sameSupport - 22');
|
|
1072
|
-
}
|
|
1073
|
-
if (samePropConfig) {
|
|
1074
|
-
throw new Error('samePropConfig - 22');
|
|
1075
|
-
}
|
|
1076
|
-
if (newTagSupport.templater.isTag || oldTagSupport.templater.isTag || newTemplater.isTag) {
|
|
1077
|
-
throw new Error('trying to compare a basic tag');
|
|
1078
|
-
}
|
|
1079
946
|
const latestProps = newTemplater.props; // newTagSupport.propsConfig.latest
|
|
1080
947
|
const pastCloneProps = oldTagSupport.propsConfig.latestCloned;
|
|
1081
948
|
const propsChanged = hasPropChanges(latestProps, pastCloneProps);
|
|
@@ -1166,10 +1033,115 @@ function html(strings, ...values) {
|
|
|
1166
1033
|
|
|
1167
1034
|
/***/ }),
|
|
1168
1035
|
|
|
1169
|
-
/***/ "./ts/
|
|
1170
|
-
|
|
1171
|
-
!*** ./ts/
|
|
1172
|
-
|
|
1036
|
+
/***/ "./ts/insertAfter.function.ts":
|
|
1037
|
+
/*!************************************!*\
|
|
1038
|
+
!*** ./ts/insertAfter.function.ts ***!
|
|
1039
|
+
\************************************/
|
|
1040
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1041
|
+
|
|
1042
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1043
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1044
|
+
/* harmony export */ insertAfter: () => (/* binding */ insertAfter)
|
|
1045
|
+
/* harmony export */ });
|
|
1046
|
+
// Function to insert element after reference element
|
|
1047
|
+
function insertAfter(newNode, referenceNode) {
|
|
1048
|
+
const parentNode = referenceNode.parentNode;
|
|
1049
|
+
parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
/***/ }),
|
|
1054
|
+
|
|
1055
|
+
/***/ "./ts/interpolations/bindSubjectCallback.function.ts":
|
|
1056
|
+
/*!***********************************************************!*\
|
|
1057
|
+
!*** ./ts/interpolations/bindSubjectCallback.function.ts ***!
|
|
1058
|
+
\***********************************************************/
|
|
1059
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1060
|
+
|
|
1061
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1062
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1063
|
+
/* harmony export */ bindSubjectCallback: () => (/* binding */ bindSubjectCallback),
|
|
1064
|
+
/* harmony export */ runTagCallback: () => (/* binding */ runTagCallback)
|
|
1065
|
+
/* harmony export */ });
|
|
1066
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
1067
|
+
/** File largely responsible for reacting to element events, such as onclick */
|
|
1068
|
+
|
|
1069
|
+
function bindSubjectCallback(value, tagSupport) {
|
|
1070
|
+
// Is this children? No override needed
|
|
1071
|
+
if (value.isChildOverride) {
|
|
1072
|
+
return value;
|
|
1073
|
+
}
|
|
1074
|
+
const subjectFunction = (element, args) => runTagCallback(value, tagSupport, element, args);
|
|
1075
|
+
// link back to original. Mostly used for <div oninit ondestroy> animations
|
|
1076
|
+
subjectFunction.tagFunction = value;
|
|
1077
|
+
return subjectFunction;
|
|
1078
|
+
}
|
|
1079
|
+
function runTagCallback(value, tagSupport, bindTo, args) {
|
|
1080
|
+
const renderCount = tagSupport.global.renderCount;
|
|
1081
|
+
const method = value.bind(bindTo);
|
|
1082
|
+
const callbackResult = method(...args);
|
|
1083
|
+
const sameRenderCount = renderCount === tagSupport.global.renderCount;
|
|
1084
|
+
// already rendered OR tag was deleted before event processing
|
|
1085
|
+
if (!sameRenderCount || tagSupport.global.deleted) {
|
|
1086
|
+
if (callbackResult instanceof Promise) {
|
|
1087
|
+
return callbackResult.then(() => {
|
|
1088
|
+
return 'promise-no-data-ever'; // tag was deleted during event processing
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
return 'no-data-ever'; // already rendered
|
|
1092
|
+
}
|
|
1093
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_0__.renderTagSupport)(tagSupport, true);
|
|
1094
|
+
if (callbackResult instanceof Promise) {
|
|
1095
|
+
return callbackResult.then(() => {
|
|
1096
|
+
if (tagSupport.global.deleted) {
|
|
1097
|
+
return 'promise-no-data-ever'; // tag was deleted during event processing
|
|
1098
|
+
}
|
|
1099
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_0__.renderTagSupport)(tagSupport, true);
|
|
1100
|
+
return 'promise-no-data-ever';
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
// Caller always expects a Promise
|
|
1104
|
+
return 'no-data-ever';
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
/***/ }),
|
|
1109
|
+
|
|
1110
|
+
/***/ "./ts/interpolations/elementInitCheck.ts":
|
|
1111
|
+
/*!***********************************************!*\
|
|
1112
|
+
!*** ./ts/interpolations/elementInitCheck.ts ***!
|
|
1113
|
+
\***********************************************/
|
|
1114
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1115
|
+
|
|
1116
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1117
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1118
|
+
/* harmony export */ elementInitCheck: () => (/* binding */ elementInitCheck)
|
|
1119
|
+
/* harmony export */ });
|
|
1120
|
+
function elementInitCheck(nextSibling, counts) {
|
|
1121
|
+
const onInitDoubleWrap = nextSibling.oninit;
|
|
1122
|
+
if (!onInitDoubleWrap) {
|
|
1123
|
+
return counts.added;
|
|
1124
|
+
}
|
|
1125
|
+
const onInitWrap = onInitDoubleWrap.tagFunction;
|
|
1126
|
+
if (!onInitWrap) {
|
|
1127
|
+
return counts.added;
|
|
1128
|
+
}
|
|
1129
|
+
const onInit = onInitWrap.tagFunction;
|
|
1130
|
+
if (!onInit) {
|
|
1131
|
+
return counts.added;
|
|
1132
|
+
}
|
|
1133
|
+
const event = { target: nextSibling, stagger: counts.added };
|
|
1134
|
+
onInit(event);
|
|
1135
|
+
return ++counts.added;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
/***/ }),
|
|
1140
|
+
|
|
1141
|
+
/***/ "./ts/interpolations/inputAttribute.ts":
|
|
1142
|
+
/*!*********************************************!*\
|
|
1143
|
+
!*** ./ts/interpolations/inputAttribute.ts ***!
|
|
1144
|
+
\*********************************************/
|
|
1173
1145
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1174
1146
|
|
|
1175
1147
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -1198,36 +1170,17 @@ function inputAttribute(name, value, element) {
|
|
|
1198
1170
|
|
|
1199
1171
|
/***/ }),
|
|
1200
1172
|
|
|
1201
|
-
/***/ "./ts/
|
|
1202
|
-
|
|
1203
|
-
!*** ./ts/
|
|
1204
|
-
|
|
1205
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1206
|
-
|
|
1207
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1208
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1209
|
-
/* harmony export */ insertAfter: () => (/* binding */ insertAfter)
|
|
1210
|
-
/* harmony export */ });
|
|
1211
|
-
// Function to insert element after reference element
|
|
1212
|
-
function insertAfter(newNode, referenceNode) {
|
|
1213
|
-
const parentNode = referenceNode.parentNode;
|
|
1214
|
-
parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
/***/ }),
|
|
1219
|
-
|
|
1220
|
-
/***/ "./ts/interpolateAttributes.ts":
|
|
1221
|
-
/*!*************************************!*\
|
|
1222
|
-
!*** ./ts/interpolateAttributes.ts ***!
|
|
1223
|
-
\*************************************/
|
|
1173
|
+
/***/ "./ts/interpolations/interpolateAttributes.ts":
|
|
1174
|
+
/*!****************************************************!*\
|
|
1175
|
+
!*** ./ts/interpolations/interpolateAttributes.ts ***!
|
|
1176
|
+
\****************************************************/
|
|
1224
1177
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1225
1178
|
|
|
1226
1179
|
__webpack_require__.r(__webpack_exports__);
|
|
1227
1180
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1228
1181
|
/* harmony export */ interpolateAttributes: () => (/* binding */ interpolateAttributes)
|
|
1229
1182
|
/* harmony export */ });
|
|
1230
|
-
/* harmony import */ var _processAttribute_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./processAttribute.function */ "./ts/processAttribute.function.ts");
|
|
1183
|
+
/* harmony import */ var _processAttribute_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./processAttribute.function */ "./ts/interpolations/processAttribute.function.ts");
|
|
1231
1184
|
|
|
1232
1185
|
function howToSetAttribute(element, name, value) {
|
|
1233
1186
|
element.setAttribute(name, value);
|
|
@@ -1235,7 +1188,7 @@ function howToSetAttribute(element, name, value) {
|
|
|
1235
1188
|
function howToSetInputValue(element, name, value) {
|
|
1236
1189
|
element[name] = value;
|
|
1237
1190
|
}
|
|
1238
|
-
function interpolateAttributes(child, scope,
|
|
1191
|
+
function interpolateAttributes(child, scope, ownerSupport) {
|
|
1239
1192
|
const attrNames = child.getAttributeNames();
|
|
1240
1193
|
let howToSet = howToSetAttribute;
|
|
1241
1194
|
attrNames.forEach(attrName => {
|
|
@@ -1243,7 +1196,7 @@ function interpolateAttributes(child, scope, ownerTag) {
|
|
|
1243
1196
|
howToSet = howToSetInputValue;
|
|
1244
1197
|
}
|
|
1245
1198
|
const value = child.getAttribute(attrName);
|
|
1246
|
-
(0,_processAttribute_function__WEBPACK_IMPORTED_MODULE_0__.processAttribute)(attrName, value, child, scope,
|
|
1199
|
+
(0,_processAttribute_function__WEBPACK_IMPORTED_MODULE_0__.processAttribute)(attrName, value, child, scope, ownerSupport, howToSet);
|
|
1247
1200
|
howToSet = howToSetAttribute; // put back
|
|
1248
1201
|
});
|
|
1249
1202
|
}
|
|
@@ -1251,19 +1204,19 @@ function interpolateAttributes(child, scope, ownerTag) {
|
|
|
1251
1204
|
|
|
1252
1205
|
/***/ }),
|
|
1253
1206
|
|
|
1254
|
-
/***/ "./ts/interpolateContentTemplates.ts":
|
|
1255
|
-
|
|
1256
|
-
!*** ./ts/interpolateContentTemplates.ts ***!
|
|
1257
|
-
|
|
1207
|
+
/***/ "./ts/interpolations/interpolateContentTemplates.ts":
|
|
1208
|
+
/*!**********************************************************!*\
|
|
1209
|
+
!*** ./ts/interpolations/interpolateContentTemplates.ts ***!
|
|
1210
|
+
\**********************************************************/
|
|
1258
1211
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1259
1212
|
|
|
1260
1213
|
__webpack_require__.r(__webpack_exports__);
|
|
1261
1214
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1262
1215
|
/* harmony export */ interpolateContentTemplates: () => (/* binding */ interpolateContentTemplates)
|
|
1263
1216
|
/* harmony export */ });
|
|
1264
|
-
/* harmony import */ var _interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interpolateTemplate */ "./ts/interpolateTemplate.ts");
|
|
1217
|
+
/* harmony import */ var _interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interpolateTemplate */ "./ts/interpolations/interpolateTemplate.ts");
|
|
1265
1218
|
|
|
1266
|
-
function interpolateContentTemplates(element, context,
|
|
1219
|
+
function interpolateContentTemplates(element, context, tagSupport, options, children) {
|
|
1267
1220
|
if (!children || element.tagName === 'TEMPLATE') {
|
|
1268
1221
|
return { clones: [], tagComponents: [] }; // done
|
|
1269
1222
|
}
|
|
@@ -1273,7 +1226,7 @@ function interpolateContentTemplates(element, context, tag, options, children) {
|
|
|
1273
1226
|
const tagComponents = [];
|
|
1274
1227
|
const childArray = new Array(...children);
|
|
1275
1228
|
childArray.forEach(child => {
|
|
1276
|
-
const { clones: nextClones, tagComponent } = (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__.interpolateTemplate)(child, context,
|
|
1229
|
+
const { clones: nextClones, tagComponent } = (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__.interpolateTemplate)(child, context, tagSupport, counts, options);
|
|
1277
1230
|
clones.push(...nextClones);
|
|
1278
1231
|
if (tagComponent) {
|
|
1279
1232
|
tagComponents.push(tagComponent);
|
|
@@ -1284,12 +1237,12 @@ function interpolateContentTemplates(element, context, tag, options, children) {
|
|
|
1284
1237
|
nextKids.forEach((subChild, index) => {
|
|
1285
1238
|
// IF <template end /> its a variable to be processed
|
|
1286
1239
|
if (isRenderEndTemplate(subChild)) {
|
|
1287
|
-
const { tagComponent } = (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__.interpolateTemplate)(subChild, context,
|
|
1240
|
+
const { tagComponent } = (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__.interpolateTemplate)(subChild, context, tagSupport, counts, options);
|
|
1288
1241
|
if (tagComponent) {
|
|
1289
1242
|
tagComponents.push(tagComponent);
|
|
1290
1243
|
}
|
|
1291
1244
|
}
|
|
1292
|
-
const { clones: nextClones, tagComponents: nextTagComponent } = interpolateContentTemplates(subChild, context,
|
|
1245
|
+
const { clones: nextClones, tagComponents: nextTagComponent } = interpolateContentTemplates(subChild, context, tagSupport, options, subChild.children);
|
|
1293
1246
|
clones.push(...nextClones);
|
|
1294
1247
|
tagComponents.push(...nextTagComponent);
|
|
1295
1248
|
});
|
|
@@ -1307,10 +1260,10 @@ function isRenderEndTemplate(child) {
|
|
|
1307
1260
|
|
|
1308
1261
|
/***/ }),
|
|
1309
1262
|
|
|
1310
|
-
/***/ "./ts/interpolateElement.ts":
|
|
1311
|
-
|
|
1312
|
-
!*** ./ts/interpolateElement.ts ***!
|
|
1313
|
-
|
|
1263
|
+
/***/ "./ts/interpolations/interpolateElement.ts":
|
|
1264
|
+
/*!*************************************************!*\
|
|
1265
|
+
!*** ./ts/interpolations/interpolateElement.ts ***!
|
|
1266
|
+
\*************************************************/
|
|
1314
1267
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1315
1268
|
|
|
1316
1269
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -1318,10 +1271,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1318
1271
|
/* harmony export */ interpolateElement: () => (/* binding */ interpolateElement),
|
|
1319
1272
|
/* harmony export */ interpolateString: () => (/* binding */ interpolateString)
|
|
1320
1273
|
/* harmony export */ });
|
|
1321
|
-
/* harmony import */ var _interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interpolateAttributes */ "./ts/interpolateAttributes.ts");
|
|
1322
|
-
/* harmony import */ var _interpolations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./interpolations */ "./ts/interpolations.ts");
|
|
1323
|
-
/* harmony import */ var _interpolateContentTemplates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interpolateContentTemplates */ "./ts/interpolateContentTemplates.ts");
|
|
1324
|
-
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*!
|
|
1274
|
+
/* harmony import */ var _interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interpolateAttributes */ "./ts/interpolations/interpolateAttributes.ts");
|
|
1275
|
+
/* harmony import */ var _interpolations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./interpolations */ "./ts/interpolations/interpolations.ts");
|
|
1276
|
+
/* harmony import */ var _interpolateContentTemplates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interpolateContentTemplates */ "./ts/interpolations/interpolateContentTemplates.ts");
|
|
1277
|
+
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Tag.class */ "./ts/Tag.class.ts");
|
|
1325
1278
|
|
|
1326
1279
|
|
|
1327
1280
|
|
|
@@ -1329,26 +1282,26 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1329
1282
|
/** Review elements within an element */
|
|
1330
1283
|
function interpolateElement(container, // element containing innerHTML to review interpolations
|
|
1331
1284
|
context, // variables used to evaluate
|
|
1332
|
-
interpolatedTemplates,
|
|
1285
|
+
interpolatedTemplates, ownerSupport, options) {
|
|
1333
1286
|
const clones = [];
|
|
1334
1287
|
const tagComponents = [];
|
|
1335
1288
|
const result = interpolatedTemplates.interpolation;
|
|
1336
1289
|
const template = container.children[0];
|
|
1337
1290
|
const children = template.content.children;
|
|
1338
1291
|
if (result.keys.length) {
|
|
1339
|
-
const { clones: nextClones, tagComponents: nextTagComponents } = (0,_interpolateContentTemplates__WEBPACK_IMPORTED_MODULE_2__.interpolateContentTemplates)(container, context,
|
|
1292
|
+
const { clones: nextClones, tagComponents: nextTagComponents } = (0,_interpolateContentTemplates__WEBPACK_IMPORTED_MODULE_2__.interpolateContentTemplates)(container, context, ownerSupport, options, children);
|
|
1340
1293
|
clones.push(...nextClones);
|
|
1341
1294
|
tagComponents.push(...nextTagComponents);
|
|
1342
1295
|
}
|
|
1343
|
-
(0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(container, context,
|
|
1344
|
-
processChildrenAttributes(children, context,
|
|
1296
|
+
(0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(container, context, ownerSupport);
|
|
1297
|
+
processChildrenAttributes(children, context, ownerSupport);
|
|
1345
1298
|
return { clones, tagComponents };
|
|
1346
1299
|
}
|
|
1347
|
-
function processChildrenAttributes(children, context,
|
|
1300
|
+
function processChildrenAttributes(children, context, ownerSupport) {
|
|
1348
1301
|
new Array(...children).forEach(child => {
|
|
1349
|
-
(0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(child, context,
|
|
1302
|
+
(0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(child, context, ownerSupport);
|
|
1350
1303
|
if (child.children) {
|
|
1351
|
-
processChildrenAttributes(child.children, context,
|
|
1304
|
+
processChildrenAttributes(child.children, context, ownerSupport);
|
|
1352
1305
|
}
|
|
1353
1306
|
});
|
|
1354
1307
|
}
|
|
@@ -1361,10 +1314,10 @@ function interpolateString(string) {
|
|
|
1361
1314
|
|
|
1362
1315
|
/***/ }),
|
|
1363
1316
|
|
|
1364
|
-
/***/ "./ts/interpolateTemplate.ts":
|
|
1365
|
-
|
|
1366
|
-
!*** ./ts/interpolateTemplate.ts ***!
|
|
1367
|
-
|
|
1317
|
+
/***/ "./ts/interpolations/interpolateTemplate.ts":
|
|
1318
|
+
/*!**************************************************!*\
|
|
1319
|
+
!*** ./ts/interpolations/interpolateTemplate.ts ***!
|
|
1320
|
+
\**************************************************/
|
|
1368
1321
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1369
1322
|
|
|
1370
1323
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -1373,12 +1326,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1373
1326
|
/* harmony export */ interpolateTemplate: () => (/* binding */ interpolateTemplate),
|
|
1374
1327
|
/* harmony export */ subscribeToTemplate: () => (/* binding */ subscribeToTemplate)
|
|
1375
1328
|
/* harmony export */ });
|
|
1376
|
-
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*!
|
|
1377
|
-
/* harmony import */ var _elementInitCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./elementInitCheck */ "./ts/elementInitCheck.ts");
|
|
1378
|
-
/* harmony import */ var _processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*!
|
|
1379
|
-
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*!
|
|
1380
|
-
/* harmony import */ var _scanTextAreaValue_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./scanTextAreaValue.function */ "./ts/scanTextAreaValue.function.ts");
|
|
1381
|
-
/* harmony import */ var _updateExistingValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*!
|
|
1329
|
+
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Tag.class */ "./ts/Tag.class.ts");
|
|
1330
|
+
/* harmony import */ var _elementInitCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./elementInitCheck */ "./ts/interpolations/elementInitCheck.ts");
|
|
1331
|
+
/* harmony import */ var _processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../processSubjectValue.function */ "./ts/processSubjectValue.function.ts");
|
|
1332
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../isInstance */ "./ts/isInstance.ts");
|
|
1333
|
+
/* harmony import */ var _scanTextAreaValue_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./scanTextAreaValue.function */ "./ts/interpolations/scanTextAreaValue.function.ts");
|
|
1334
|
+
/* harmony import */ var _updateExistingValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../updateExistingValue.function */ "./ts/updateExistingValue.function.ts");
|
|
1382
1335
|
|
|
1383
1336
|
|
|
1384
1337
|
|
|
@@ -1387,7 +1340,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1387
1340
|
|
|
1388
1341
|
function interpolateTemplate(insertBefore, // <template end interpolate /> (will be removed)
|
|
1389
1342
|
context, // variable scope of {`__tagvar${index}`:'x'}
|
|
1390
|
-
|
|
1343
|
+
ownerSupport, // Tag class
|
|
1391
1344
|
counts, // used for animation stagger computing
|
|
1392
1345
|
options) {
|
|
1393
1346
|
// TODO: THe clones array is useless here
|
|
@@ -1407,56 +1360,44 @@ options) {
|
|
|
1407
1360
|
clones,
|
|
1408
1361
|
tagComponent: {
|
|
1409
1362
|
variableName,
|
|
1410
|
-
|
|
1363
|
+
ownerSupport,
|
|
1411
1364
|
subject: existingSubject,
|
|
1412
1365
|
insertBefore
|
|
1413
1366
|
}
|
|
1414
1367
|
};
|
|
1415
1368
|
}
|
|
1416
1369
|
let isForceElement = options.forceElement;
|
|
1417
|
-
subscribeToTemplate(insertBefore, existingSubject,
|
|
1370
|
+
subscribeToTemplate(insertBefore, existingSubject, ownerSupport, counts, { isForceElement });
|
|
1418
1371
|
return { clones };
|
|
1419
1372
|
}
|
|
1420
|
-
function subscribeToTemplate(insertBefore, subject,
|
|
1373
|
+
function subscribeToTemplate(insertBefore, subject, ownerSupport, counts, // used for animation stagger computing
|
|
1421
1374
|
{ isForceElement }) {
|
|
1422
1375
|
let called = false;
|
|
1423
1376
|
const callback = (value) => {
|
|
1424
|
-
// const orgInsert = insertBefore
|
|
1425
|
-
/*
|
|
1426
|
-
const clone = (subject as DisplaySubject).clone
|
|
1427
|
-
if(clone && clone.parentNode) {
|
|
1428
|
-
insertBefore = clone
|
|
1429
|
-
}
|
|
1430
|
-
*/
|
|
1431
1377
|
if (called) {
|
|
1432
|
-
(0,_updateExistingValue_function__WEBPACK_IMPORTED_MODULE_5__.updateExistingValue)(subject, value,
|
|
1378
|
+
(0,_updateExistingValue_function__WEBPACK_IMPORTED_MODULE_5__.updateExistingValue)(subject, value, ownerSupport, insertBefore);
|
|
1433
1379
|
return;
|
|
1434
1380
|
}
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
}
|
|
1438
|
-
(0,_processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__.processSubjectValue)(value, subject, insertBefore, ownerTag, {
|
|
1381
|
+
const templater = value;
|
|
1382
|
+
(0,_processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__.processSubjectValue)(templater, subject, insertBefore, ownerSupport, {
|
|
1439
1383
|
counts: { ...counts },
|
|
1440
1384
|
forceElement: isForceElement,
|
|
1441
1385
|
});
|
|
1442
1386
|
if (isForceElement) {
|
|
1443
1387
|
isForceElement = false; // only can happen once
|
|
1444
1388
|
}
|
|
1445
|
-
// ownerTag.clones.push(...clones)
|
|
1446
|
-
// ownerTag.clones.push(...nextClones)
|
|
1447
|
-
// clones.push(...nextClones)
|
|
1448
1389
|
called = true;
|
|
1449
1390
|
};
|
|
1450
1391
|
const sub = subject.subscribe(callback);
|
|
1451
|
-
|
|
1392
|
+
ownerSupport.global.subscriptions.push(sub);
|
|
1452
1393
|
}
|
|
1453
|
-
function afterElmBuild(elm, options, context,
|
|
1394
|
+
function afterElmBuild(elm, options, context, ownerSupport) {
|
|
1454
1395
|
if (!elm.getAttribute) {
|
|
1455
1396
|
return;
|
|
1456
1397
|
}
|
|
1457
1398
|
const tagName = elm.nodeName; // elm.tagName
|
|
1458
1399
|
if (tagName === 'TEXTAREA') {
|
|
1459
|
-
(0,_scanTextAreaValue_function__WEBPACK_IMPORTED_MODULE_4__.scanTextAreaValue)(elm, context,
|
|
1400
|
+
(0,_scanTextAreaValue_function__WEBPACK_IMPORTED_MODULE_4__.scanTextAreaValue)(elm, context, ownerSupport);
|
|
1460
1401
|
}
|
|
1461
1402
|
let diff = options.counts.added;
|
|
1462
1403
|
diff = (0,_elementInitCheck__WEBPACK_IMPORTED_MODULE_1__.elementInitCheck)(elm, options.counts) - diff;
|
|
@@ -1466,7 +1407,7 @@ function afterElmBuild(elm, options, context, ownerTag) {
|
|
|
1466
1407
|
...options,
|
|
1467
1408
|
counts: options.counts,
|
|
1468
1409
|
};
|
|
1469
|
-
return afterElmBuild(child, subOptions, context,
|
|
1410
|
+
return afterElmBuild(child, subOptions, context, ownerSupport);
|
|
1470
1411
|
});
|
|
1471
1412
|
}
|
|
1472
1413
|
}
|
|
@@ -1474,10 +1415,10 @@ function afterElmBuild(elm, options, context, ownerTag) {
|
|
|
1474
1415
|
|
|
1475
1416
|
/***/ }),
|
|
1476
1417
|
|
|
1477
|
-
/***/ "./ts/interpolations.ts":
|
|
1478
|
-
|
|
1479
|
-
!*** ./ts/interpolations.ts ***!
|
|
1480
|
-
|
|
1418
|
+
/***/ "./ts/interpolations/interpolations.ts":
|
|
1419
|
+
/*!*********************************************!*\
|
|
1420
|
+
!*** ./ts/interpolations/interpolations.ts ***!
|
|
1421
|
+
\*********************************************/
|
|
1481
1422
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1482
1423
|
|
|
1483
1424
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -1497,9 +1438,8 @@ function interpolateToTemplates(template) {
|
|
|
1497
1438
|
}
|
|
1498
1439
|
const noBraces = expression.substring(1, expression.length - 1);
|
|
1499
1440
|
const id = noBraces;
|
|
1500
|
-
const name = 'template-' + template.length;
|
|
1501
1441
|
keys.push(id);
|
|
1502
|
-
return `<template interpolate end id="${id}"
|
|
1442
|
+
return `<template interpolate end id="${id}"></template>`;
|
|
1503
1443
|
});
|
|
1504
1444
|
return { string, keys };
|
|
1505
1445
|
}
|
|
@@ -1507,91 +1447,19 @@ function interpolateToTemplates(template) {
|
|
|
1507
1447
|
|
|
1508
1448
|
/***/ }),
|
|
1509
1449
|
|
|
1510
|
-
/***/ "./ts/
|
|
1511
|
-
|
|
1512
|
-
!*** ./ts/
|
|
1513
|
-
|
|
1514
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1515
|
-
|
|
1516
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1517
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1518
|
-
/* harmony export */ isSubjectInstance: () => (/* binding */ isSubjectInstance),
|
|
1519
|
-
/* harmony export */ isTagArray: () => (/* binding */ isTagArray),
|
|
1520
|
-
/* harmony export */ isTagComponent: () => (/* binding */ isTagComponent),
|
|
1521
|
-
/* harmony export */ isTagInstance: () => (/* binding */ isTagInstance)
|
|
1522
|
-
/* harmony export */ });
|
|
1523
|
-
function isTagComponent(value) {
|
|
1524
|
-
return value?.isTemplater === true;
|
|
1525
|
-
}
|
|
1526
|
-
function isTagInstance(tag) {
|
|
1527
|
-
return tag?.isTag === true;
|
|
1528
|
-
}
|
|
1529
|
-
function isSubjectInstance(subject) {
|
|
1530
|
-
return (subject?.isSubject === true || subject?.subscribe) ? true : false; // subject?.isSubject === true ||
|
|
1531
|
-
}
|
|
1532
|
-
function isTagArray(value) {
|
|
1533
|
-
return value instanceof Array && value.every(x => isTagInstance(x));
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
/***/ }),
|
|
1538
|
-
|
|
1539
|
-
/***/ "./ts/isLikeTags.function.ts":
|
|
1540
|
-
/*!***********************************!*\
|
|
1541
|
-
!*** ./ts/isLikeTags.function.ts ***!
|
|
1542
|
-
\***********************************/
|
|
1543
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1544
|
-
|
|
1545
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1546
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1547
|
-
/* harmony export */ isLikeTags: () => (/* binding */ isLikeTags)
|
|
1548
|
-
/* harmony export */ });
|
|
1549
|
-
function isLikeTags(tag0, tag1) {
|
|
1550
|
-
if (tag0.strings.length !== tag1.strings.length) {
|
|
1551
|
-
return false;
|
|
1552
|
-
}
|
|
1553
|
-
const everyStringMatched = tag0.strings.every((string, index) => tag1.strings[index] === string);
|
|
1554
|
-
if (!everyStringMatched) {
|
|
1555
|
-
return false;
|
|
1556
|
-
}
|
|
1557
|
-
const valuesLengthsMatch = tag0.values.length === tag1.values.length;
|
|
1558
|
-
if (!valuesLengthsMatch) {
|
|
1559
|
-
return false;
|
|
1560
|
-
}
|
|
1561
|
-
const allVarsMatch = tag1.values.every((value, index) => {
|
|
1562
|
-
const compareTo = tag0.values[index];
|
|
1563
|
-
const isFunctions = value instanceof Function && compareTo instanceof Function;
|
|
1564
|
-
if (isFunctions) {
|
|
1565
|
-
const stringMatch = value.toString() === compareTo.toString();
|
|
1566
|
-
if (stringMatch) {
|
|
1567
|
-
return true;
|
|
1568
|
-
}
|
|
1569
|
-
return false;
|
|
1570
|
-
}
|
|
1571
|
-
return true; // deepEqual(value, compareTo)
|
|
1572
|
-
});
|
|
1573
|
-
if (allVarsMatch) {
|
|
1574
|
-
return true;
|
|
1575
|
-
}
|
|
1576
|
-
return false;
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
/***/ }),
|
|
1581
|
-
|
|
1582
|
-
/***/ "./ts/processAttribute.function.ts":
|
|
1583
|
-
/*!*****************************************!*\
|
|
1584
|
-
!*** ./ts/processAttribute.function.ts ***!
|
|
1585
|
-
\*****************************************/
|
|
1450
|
+
/***/ "./ts/interpolations/processAttribute.function.ts":
|
|
1451
|
+
/*!********************************************************!*\
|
|
1452
|
+
!*** ./ts/interpolations/processAttribute.function.ts ***!
|
|
1453
|
+
\********************************************************/
|
|
1586
1454
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1587
1455
|
|
|
1588
1456
|
__webpack_require__.r(__webpack_exports__);
|
|
1589
1457
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1590
1458
|
/* harmony export */ processAttribute: () => (/* binding */ processAttribute)
|
|
1591
1459
|
/* harmony export */ });
|
|
1592
|
-
/* harmony import */ var _inputAttribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./inputAttribute */ "./ts/inputAttribute.ts");
|
|
1593
|
-
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*!
|
|
1594
|
-
/* harmony import */ var _bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bindSubjectCallback.function */ "./ts/bindSubjectCallback.function.ts");
|
|
1460
|
+
/* harmony import */ var _inputAttribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./inputAttribute */ "./ts/interpolations/inputAttribute.ts");
|
|
1461
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../isInstance */ "./ts/isInstance.ts");
|
|
1462
|
+
/* harmony import */ var _bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bindSubjectCallback.function */ "./ts/interpolations/bindSubjectCallback.function.ts");
|
|
1595
1463
|
|
|
1596
1464
|
|
|
1597
1465
|
|
|
@@ -1600,19 +1468,19 @@ const endRegX = /}\s*$/;
|
|
|
1600
1468
|
function isTagVar(value) {
|
|
1601
1469
|
return value && value.search(startRegX) >= 0 && value.search(endRegX) >= 0;
|
|
1602
1470
|
}
|
|
1603
|
-
function processAttribute(attrName, value, child, scope,
|
|
1471
|
+
function processAttribute(attrName, value, child, scope, ownerSupport, howToSet) {
|
|
1604
1472
|
if (isTagVar(value)) {
|
|
1605
|
-
return processScopedNameValueAttr(attrName, value, child, scope,
|
|
1473
|
+
return processScopedNameValueAttr(attrName, value, child, scope, ownerSupport, howToSet);
|
|
1606
1474
|
}
|
|
1607
1475
|
if (isTagVar(attrName)) {
|
|
1608
1476
|
const contextValueSubject = getContextValueByVarString(scope, attrName);
|
|
1609
1477
|
let lastValue;
|
|
1610
1478
|
// the above callback gets called immediately since its a ValueSubject()
|
|
1611
1479
|
const sub = contextValueSubject.subscribe((value) => {
|
|
1612
|
-
processNameOnlyAttr(value, lastValue, child,
|
|
1480
|
+
processNameOnlyAttr(value, lastValue, child, ownerSupport, howToSet);
|
|
1613
1481
|
lastValue = value;
|
|
1614
1482
|
});
|
|
1615
|
-
|
|
1483
|
+
ownerSupport.global.subscriptions.push(sub); // this is where unsubscribe is picked up
|
|
1616
1484
|
child.removeAttribute(attrName);
|
|
1617
1485
|
return;
|
|
1618
1486
|
}
|
|
@@ -1623,16 +1491,16 @@ function processAttribute(attrName, value, child, scope, ownerTag, howToSet) {
|
|
|
1623
1491
|
}
|
|
1624
1492
|
}
|
|
1625
1493
|
function processScopedNameValueAttr(attrName, value, // {__tagVarN}
|
|
1626
|
-
child, scope,
|
|
1494
|
+
child, scope, ownerSupport, howToSet) {
|
|
1627
1495
|
// get the code inside the brackets like "variable0" or "{variable0}"
|
|
1628
1496
|
const result = getContextValueByVarString(scope, value);
|
|
1629
|
-
return processNameValueAttr(attrName, result, child,
|
|
1497
|
+
return processNameValueAttr(attrName, result, child, ownerSupport, howToSet);
|
|
1630
1498
|
}
|
|
1631
1499
|
function getContextValueByVarString(scope, value) {
|
|
1632
1500
|
const code = value.replace('{', '').split('').reverse().join('').replace('}', '').split('').reverse().join('');
|
|
1633
1501
|
return scope[code];
|
|
1634
1502
|
}
|
|
1635
|
-
function processNameOnlyAttr(attrValue, lastValue, child,
|
|
1503
|
+
function processNameOnlyAttr(attrValue, lastValue, child, ownerSupport, howToSet) {
|
|
1636
1504
|
if (lastValue && lastValue != attrValue) {
|
|
1637
1505
|
if (typeof (lastValue) === 'string') {
|
|
1638
1506
|
child.removeAttribute(lastValue);
|
|
@@ -1645,15 +1513,15 @@ function processNameOnlyAttr(attrValue, lastValue, child, ownerTag, howToSet) {
|
|
|
1645
1513
|
if (!attrValue.length) {
|
|
1646
1514
|
return;
|
|
1647
1515
|
}
|
|
1648
|
-
processNameValueAttr(attrValue, '', child,
|
|
1516
|
+
processNameValueAttr(attrValue, '', child, ownerSupport, howToSet);
|
|
1649
1517
|
return;
|
|
1650
1518
|
}
|
|
1651
1519
|
if (attrValue instanceof Object) {
|
|
1652
|
-
Object.entries(attrValue).forEach(([name, value]) => processNameValueAttr(name, value, child,
|
|
1520
|
+
Object.entries(attrValue).forEach(([name, value]) => processNameValueAttr(name, value, child, ownerSupport, howToSet));
|
|
1653
1521
|
return;
|
|
1654
1522
|
}
|
|
1655
1523
|
}
|
|
1656
|
-
function processNameValueAttr(attrName, result, child,
|
|
1524
|
+
function processNameValueAttr(attrName, result, child, ownerSupport, howToSet) {
|
|
1657
1525
|
const isSpecial = isSpecialAttr(attrName);
|
|
1658
1526
|
// attach as callback?
|
|
1659
1527
|
if (result instanceof Function) {
|
|
@@ -1669,49 +1537,170 @@ function processNameValueAttr(attrName, result, child, ownerTag, howToSet) {
|
|
|
1669
1537
|
child.removeAttribute(attrName);
|
|
1670
1538
|
const callback = (newAttrValue) => {
|
|
1671
1539
|
if (newAttrValue instanceof Function) {
|
|
1672
|
-
newAttrValue = (0,_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_2__.bindSubjectCallback)(newAttrValue,
|
|
1540
|
+
newAttrValue = (0,_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_2__.bindSubjectCallback)(newAttrValue, ownerSupport);
|
|
1673
1541
|
}
|
|
1674
1542
|
return processAttributeSubjectValue(newAttrValue, child, attrName, isSpecial, howToSet);
|
|
1675
1543
|
};
|
|
1676
1544
|
// 🗞️ Subscribe. Above callback called immediately since its a ValueSubject()
|
|
1677
1545
|
const sub = result.subscribe(callback);
|
|
1678
1546
|
// Record subscription for later unsubscribe when element destroyed
|
|
1679
|
-
|
|
1547
|
+
ownerSupport.global.subscriptions.push(sub);
|
|
1680
1548
|
return;
|
|
1681
1549
|
}
|
|
1682
1550
|
howToSet(child, attrName, result);
|
|
1683
1551
|
// child.setAttribute(attrName, result.value)
|
|
1684
1552
|
return;
|
|
1685
1553
|
}
|
|
1686
|
-
function processAttributeSubjectValue(newAttrValue, child, attrName, isSpecial, howToSet) {
|
|
1687
|
-
if (newAttrValue instanceof Function) {
|
|
1688
|
-
const fun = function (...args) {
|
|
1689
|
-
return newAttrValue(child, args);
|
|
1690
|
-
};
|
|
1691
|
-
// access to original function
|
|
1692
|
-
fun.tagFunction = newAttrValue;
|
|
1693
|
-
child[attrName] = fun;
|
|
1694
|
-
return;
|
|
1554
|
+
function processAttributeSubjectValue(newAttrValue, child, attrName, isSpecial, howToSet) {
|
|
1555
|
+
if (newAttrValue instanceof Function) {
|
|
1556
|
+
const fun = function (...args) {
|
|
1557
|
+
return newAttrValue(child, args);
|
|
1558
|
+
};
|
|
1559
|
+
// access to original function
|
|
1560
|
+
fun.tagFunction = newAttrValue;
|
|
1561
|
+
child[attrName] = fun;
|
|
1562
|
+
return;
|
|
1563
|
+
}
|
|
1564
|
+
if (isSpecial) {
|
|
1565
|
+
(0,_inputAttribute__WEBPACK_IMPORTED_MODULE_0__.inputAttribute)(attrName, newAttrValue, child);
|
|
1566
|
+
return;
|
|
1567
|
+
}
|
|
1568
|
+
if (newAttrValue) {
|
|
1569
|
+
howToSet(child, attrName, newAttrValue);
|
|
1570
|
+
return;
|
|
1571
|
+
}
|
|
1572
|
+
const isDeadValue = [undefined, false, null].includes(newAttrValue);
|
|
1573
|
+
if (isDeadValue) {
|
|
1574
|
+
child.removeAttribute(attrName);
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1577
|
+
// value is 0
|
|
1578
|
+
howToSet(child, attrName, newAttrValue);
|
|
1579
|
+
}
|
|
1580
|
+
/** Looking for (class | style) followed by a period */
|
|
1581
|
+
function isSpecialAttr(attrName) {
|
|
1582
|
+
return attrName.search(/^(class|style)(\.)/) >= 0;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
|
|
1586
|
+
/***/ }),
|
|
1587
|
+
|
|
1588
|
+
/***/ "./ts/interpolations/scanTextAreaValue.function.ts":
|
|
1589
|
+
/*!*********************************************************!*\
|
|
1590
|
+
!*** ./ts/interpolations/scanTextAreaValue.function.ts ***!
|
|
1591
|
+
\*********************************************************/
|
|
1592
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1593
|
+
|
|
1594
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1595
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1596
|
+
/* harmony export */ scanTextAreaValue: () => (/* binding */ scanTextAreaValue)
|
|
1597
|
+
/* harmony export */ });
|
|
1598
|
+
/* harmony import */ var _processAttribute_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./processAttribute.function */ "./ts/interpolations/processAttribute.function.ts");
|
|
1599
|
+
|
|
1600
|
+
const search = new RegExp('\\s*<template interpolate end id="__tagvar(\\d{1,4})"([^>]*)></template>(\\s*)');
|
|
1601
|
+
function scanTextAreaValue(textarea, context, ownerSupport) {
|
|
1602
|
+
const value = textarea.value;
|
|
1603
|
+
if (value.search(search) >= 0) {
|
|
1604
|
+
const match = value.match(/__tagvar(\d{1,4})/);
|
|
1605
|
+
const token = match ? match[0] : '';
|
|
1606
|
+
const dynamic = '{' + token + '}';
|
|
1607
|
+
textarea.value = '';
|
|
1608
|
+
textarea.setAttribute('text-var-value', dynamic);
|
|
1609
|
+
const howToSet = (_elm, _name, value) => textarea.value = value;
|
|
1610
|
+
(0,_processAttribute_function__WEBPACK_IMPORTED_MODULE_0__.processAttribute)('text-var-value', dynamic, // realValue, // context[token].value,
|
|
1611
|
+
textarea, context, ownerSupport, howToSet);
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
|
|
1616
|
+
/***/ }),
|
|
1617
|
+
|
|
1618
|
+
/***/ "./ts/isInstance.ts":
|
|
1619
|
+
/*!**************************!*\
|
|
1620
|
+
!*** ./ts/isInstance.ts ***!
|
|
1621
|
+
\**************************/
|
|
1622
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1623
|
+
|
|
1624
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1625
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1626
|
+
/* harmony export */ isSubjectInstance: () => (/* binding */ isSubjectInstance),
|
|
1627
|
+
/* harmony export */ isTag: () => (/* binding */ isTag),
|
|
1628
|
+
/* harmony export */ isTagArray: () => (/* binding */ isTagArray),
|
|
1629
|
+
/* harmony export */ isTagClass: () => (/* binding */ isTagClass),
|
|
1630
|
+
/* harmony export */ isTagComponent: () => (/* binding */ isTagComponent),
|
|
1631
|
+
/* harmony export */ isTagTemplater: () => (/* binding */ isTagTemplater)
|
|
1632
|
+
/* harmony export */ });
|
|
1633
|
+
function isTagComponent(value) {
|
|
1634
|
+
return value?.wrapper?.original instanceof Function;
|
|
1635
|
+
}
|
|
1636
|
+
function isTag(value) {
|
|
1637
|
+
return isTagTemplater(value) || isTagClass(value);
|
|
1638
|
+
}
|
|
1639
|
+
function isTagTemplater(value) {
|
|
1640
|
+
const templater = value;
|
|
1641
|
+
return templater?.isTemplater === true && templater.wrapper === undefined;
|
|
1642
|
+
}
|
|
1643
|
+
function isTagClass(value) {
|
|
1644
|
+
const templater = value;
|
|
1645
|
+
return templater?.isTagClass === true;
|
|
1646
|
+
}
|
|
1647
|
+
function isSubjectInstance(subject) {
|
|
1648
|
+
return (subject?.isSubject === true || subject?.subscribe) ? true : false; // subject?.isSubject === true ||
|
|
1649
|
+
}
|
|
1650
|
+
function isTagArray(value) {
|
|
1651
|
+
return value instanceof Array && value.every(x => isTagClass(x) || isTagTemplater(x));
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
/***/ }),
|
|
1656
|
+
|
|
1657
|
+
/***/ "./ts/isLikeTags.function.ts":
|
|
1658
|
+
/*!***********************************!*\
|
|
1659
|
+
!*** ./ts/isLikeTags.function.ts ***!
|
|
1660
|
+
\***********************************/
|
|
1661
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1662
|
+
|
|
1663
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1664
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1665
|
+
/* harmony export */ isLikeTags: () => (/* binding */ isLikeTags)
|
|
1666
|
+
/* harmony export */ });
|
|
1667
|
+
function isLikeTags(tagSupport0, // new
|
|
1668
|
+
tagSupport1) {
|
|
1669
|
+
const templater0 = tagSupport0.templater;
|
|
1670
|
+
const templater1 = tagSupport1.templater;
|
|
1671
|
+
const tag0 = templater0?.tag || tagSupport0;
|
|
1672
|
+
const tag1 = templater1.tag;
|
|
1673
|
+
const strings0 = tag0.strings;
|
|
1674
|
+
const strings1 = tagSupport1.strings || tag1.strings;
|
|
1675
|
+
if (strings0.length !== strings1.length) {
|
|
1676
|
+
return false;
|
|
1695
1677
|
}
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
return;
|
|
1678
|
+
const everyStringMatched = strings0.every((string, index) => strings1[index] === string);
|
|
1679
|
+
if (!everyStringMatched) {
|
|
1680
|
+
return false;
|
|
1699
1681
|
}
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1682
|
+
const values0 = tagSupport0.values || tag0.values;
|
|
1683
|
+
const values1 = tagSupport1.values || tag1.values;
|
|
1684
|
+
const valuesLengthsMatch = values0.length === values1.length;
|
|
1685
|
+
if (!valuesLengthsMatch) {
|
|
1686
|
+
return false;
|
|
1703
1687
|
}
|
|
1704
|
-
const
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1688
|
+
const allVarsMatch = values1.every((value, index) => {
|
|
1689
|
+
const compareTo = values0[index];
|
|
1690
|
+
const isFunctions = value instanceof Function && compareTo instanceof Function;
|
|
1691
|
+
if (isFunctions) {
|
|
1692
|
+
const stringMatch = value.toString() === compareTo.toString();
|
|
1693
|
+
if (stringMatch) {
|
|
1694
|
+
return true;
|
|
1695
|
+
}
|
|
1696
|
+
return false;
|
|
1697
|
+
}
|
|
1698
|
+
return true; // deepEqual(value, compareTo)
|
|
1699
|
+
});
|
|
1700
|
+
if (allVarsMatch) {
|
|
1701
|
+
return true;
|
|
1708
1702
|
}
|
|
1709
|
-
|
|
1710
|
-
howToSet(child, attrName, newAttrValue);
|
|
1711
|
-
}
|
|
1712
|
-
/** Looking for (class | style) followed by a period */
|
|
1713
|
-
function isSpecialAttr(attrName) {
|
|
1714
|
-
return attrName.search(/^(class|style)(\.)/) >= 0;
|
|
1703
|
+
return false;
|
|
1715
1704
|
}
|
|
1716
1705
|
|
|
1717
1706
|
|
|
@@ -1729,32 +1718,50 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1729
1718
|
/* harmony export */ });
|
|
1730
1719
|
/* harmony import */ var _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subject/ValueSubject */ "./ts/subject/ValueSubject.ts");
|
|
1731
1720
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
1721
|
+
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
1722
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
1732
1723
|
|
|
1733
1724
|
|
|
1734
|
-
|
|
1725
|
+
|
|
1726
|
+
|
|
1727
|
+
function processNewValue(hasValue, value, ownerSupport) {
|
|
1735
1728
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value)) {
|
|
1736
1729
|
const tagSubject = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1737
1730
|
return tagSubject;
|
|
1738
1731
|
}
|
|
1739
1732
|
if (value instanceof Function) {
|
|
1740
|
-
// return getSubjectFunction(value, ownerTag)
|
|
1741
1733
|
return new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1742
1734
|
}
|
|
1743
1735
|
if (!hasValue) {
|
|
1744
|
-
return
|
|
1736
|
+
return new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(undefined);
|
|
1745
1737
|
}
|
|
1746
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1738
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagTemplater)(value)) {
|
|
1739
|
+
const templater = value;
|
|
1740
|
+
const tag = templater.tag;
|
|
1741
|
+
return processNewTag(tag, ownerSupport);
|
|
1742
|
+
}
|
|
1743
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagClass)(value)) {
|
|
1744
|
+
return processNewTag(value, ownerSupport);
|
|
1752
1745
|
}
|
|
1746
|
+
// is already a value subject?
|
|
1753
1747
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isSubjectInstance)(value)) {
|
|
1754
|
-
return value;
|
|
1748
|
+
return value;
|
|
1755
1749
|
}
|
|
1756
1750
|
return new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1757
1751
|
}
|
|
1752
|
+
function processNewTag(value, ownerSupport) {
|
|
1753
|
+
const tag = value;
|
|
1754
|
+
let templater = tag.templater;
|
|
1755
|
+
if (!templater) {
|
|
1756
|
+
const children = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject([]);
|
|
1757
|
+
templater = new _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_2__.TemplaterResult(undefined, children);
|
|
1758
|
+
templater.tag = tag;
|
|
1759
|
+
tag.templater = templater;
|
|
1760
|
+
}
|
|
1761
|
+
const subject = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(templater);
|
|
1762
|
+
const tagSupport = subject.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__.TagSupport(templater, ownerSupport, subject);
|
|
1763
|
+
return subject;
|
|
1764
|
+
}
|
|
1758
1765
|
|
|
1759
1766
|
|
|
1760
1767
|
/***/ }),
|
|
@@ -1806,11 +1813,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1806
1813
|
|
|
1807
1814
|
|
|
1808
1815
|
|
|
1809
|
-
function processSubjectComponent(templater, subject, insertBefore,
|
|
1816
|
+
function processSubjectComponent(templater, subject, insertBefore, ownerSupport, options) {
|
|
1810
1817
|
// Check if function component is wrapped in a tag() call
|
|
1811
1818
|
// TODO: This below check not needed in production mode
|
|
1812
1819
|
if (templater.tagged !== true) {
|
|
1813
|
-
const
|
|
1820
|
+
const wrapper = templater.wrapper;
|
|
1821
|
+
const original = wrapper.original;
|
|
1814
1822
|
let name = original.name || original.constructor?.name;
|
|
1815
1823
|
if (name === 'Function') {
|
|
1816
1824
|
name = undefined;
|
|
@@ -1819,44 +1827,35 @@ function processSubjectComponent(templater, subject, insertBefore, ownerTag, opt
|
|
|
1819
1827
|
const error = new Error(`Not a tag component. Wrap your function with tag(). Example tag(props => html\`\`) on component:\n\n${label}\n\n`);
|
|
1820
1828
|
throw error;
|
|
1821
1829
|
}
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
}
|
|
1827
|
-
templater.global.insertBefore = insertBefore;
|
|
1828
|
-
let retag = subject.tag;
|
|
1830
|
+
const tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__.TagSupport(templater, ownerSupport, subject);
|
|
1831
|
+
let reSupport = subject.tagSupport;
|
|
1832
|
+
const global = tagSupport.global = reSupport?.global || tagSupport.global;
|
|
1833
|
+
global.insertBefore = insertBefore;
|
|
1829
1834
|
const providers = _state__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
1830
|
-
providers.
|
|
1831
|
-
const
|
|
1832
|
-
if (
|
|
1833
|
-
|
|
1835
|
+
providers.ownerSupport = ownerSupport;
|
|
1836
|
+
const isRender = !reSupport || options.forceElement;
|
|
1837
|
+
if (isRender) {
|
|
1838
|
+
const support = reSupport || tagSupport;
|
|
1839
|
+
reSupport = renderSubjectComponent(subject, support, ownerSupport);
|
|
1834
1840
|
}
|
|
1835
|
-
(0,_processTagResult_function__WEBPACK_IMPORTED_MODULE_2__.processTagResult)(
|
|
1841
|
+
(0,_processTagResult_function__WEBPACK_IMPORTED_MODULE_2__.processTagResult)(reSupport, subject, // The element set here will be removed from document. Also result.tag will be added in here
|
|
1836
1842
|
insertBefore, // <template end interpolate /> (will be removed)
|
|
1837
1843
|
options);
|
|
1838
|
-
return
|
|
1844
|
+
return reSupport;
|
|
1839
1845
|
}
|
|
1840
|
-
function
|
|
1841
|
-
const preClones =
|
|
1842
|
-
|
|
1843
|
-
subject,
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
+
function renderSubjectComponent(subject, reSupport, ownerSupport) {
|
|
1847
|
+
const preClones = ownerSupport.clones.map(clone => clone);
|
|
1848
|
+
reSupport = (0,_TemplaterResult_class__WEBPACK_IMPORTED_MODULE_0__.renderWithSupport)(reSupport, subject.tagSupport, // existing tag
|
|
1849
|
+
subject, ownerSupport);
|
|
1850
|
+
reSupport.global.newest = reSupport;
|
|
1851
|
+
// ??? - mirroring add 0
|
|
1852
|
+
// reSupport.ownerTagSupport = ownerSupport
|
|
1853
|
+
if (ownerSupport.clones.length > preClones.length) {
|
|
1854
|
+
const myClones = ownerSupport.clones.filter(fClone => !preClones.find(clone => clone === fClone));
|
|
1855
|
+
reSupport.clones.push(...myClones);
|
|
1846
1856
|
}
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
const myClones = ownerTag.clones.filter(fClone => !preClones.find(clone => clone === fClone));
|
|
1850
|
-
retag.clones.push(...myClones);
|
|
1851
|
-
if (myClones.find(x => x === insertBefore)) {
|
|
1852
|
-
throw new Error('way back here we add marker');
|
|
1853
|
-
}
|
|
1854
|
-
}
|
|
1855
|
-
if (ownerTag.childTags.find(x => x === retag)) {
|
|
1856
|
-
throw new Error('about to reattach tag already present');
|
|
1857
|
-
}
|
|
1858
|
-
ownerTag.childTags.push(retag);
|
|
1859
|
-
return retag;
|
|
1857
|
+
ownerSupport.childTags.push(reSupport);
|
|
1858
|
+
return reSupport;
|
|
1860
1859
|
}
|
|
1861
1860
|
|
|
1862
1861
|
|
|
@@ -1885,6 +1884,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1885
1884
|
var ValueTypes;
|
|
1886
1885
|
(function (ValueTypes) {
|
|
1887
1886
|
ValueTypes["tag"] = "tag";
|
|
1887
|
+
ValueTypes["templater"] = "templater";
|
|
1888
1888
|
ValueTypes["tagArray"] = "tag-array";
|
|
1889
1889
|
ValueTypes["tagComponent"] = "tag-component";
|
|
1890
1890
|
ValueTypes["value"] = "value";
|
|
@@ -1893,7 +1893,10 @@ function getValueType(value) {
|
|
|
1893
1893
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value)) {
|
|
1894
1894
|
return ValueTypes.tagComponent;
|
|
1895
1895
|
}
|
|
1896
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.
|
|
1896
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagTemplater)(value)) {
|
|
1897
|
+
return ValueTypes.templater;
|
|
1898
|
+
}
|
|
1899
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagClass)(value)) {
|
|
1897
1900
|
return ValueTypes.tag;
|
|
1898
1901
|
}
|
|
1899
1902
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagArray)(value)) {
|
|
@@ -1901,19 +1904,28 @@ function getValueType(value) {
|
|
|
1901
1904
|
}
|
|
1902
1905
|
return ValueTypes.value;
|
|
1903
1906
|
}
|
|
1907
|
+
// export type ExistingValue = TemplaterResult | Tag[] | TagSupport | Function | Subject<unknown> | RegularValue | Tag
|
|
1904
1908
|
function processSubjectValue(value, subject, // could be tag via result.tag
|
|
1905
1909
|
insertBefore, // <template end interpolate /> (will be removed)
|
|
1906
|
-
|
|
1910
|
+
ownerSupport, // owner
|
|
1907
1911
|
options) {
|
|
1908
1912
|
const valueType = getValueType(value);
|
|
1909
1913
|
switch (valueType) {
|
|
1914
|
+
case ValueTypes.templater:
|
|
1915
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_4__.processTag)(value, insertBefore, ownerSupport, subject);
|
|
1916
|
+
return;
|
|
1910
1917
|
case ValueTypes.tag:
|
|
1911
|
-
|
|
1918
|
+
const tag = value;
|
|
1919
|
+
let templater = tag.templater;
|
|
1920
|
+
if (!templater) {
|
|
1921
|
+
templater = (0,_processTag_function__WEBPACK_IMPORTED_MODULE_4__.tagFakeTemplater)(tag);
|
|
1922
|
+
}
|
|
1923
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_4__.processTag)(templater, insertBefore, ownerSupport, subject);
|
|
1912
1924
|
return;
|
|
1913
1925
|
case ValueTypes.tagArray:
|
|
1914
|
-
return (0,_processTagArray__WEBPACK_IMPORTED_MODULE_2__.processTagArray)(subject, value, insertBefore,
|
|
1926
|
+
return (0,_processTagArray__WEBPACK_IMPORTED_MODULE_2__.processTagArray)(subject, value, insertBefore, ownerSupport, options);
|
|
1915
1927
|
case ValueTypes.tagComponent:
|
|
1916
|
-
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__.processSubjectComponent)(value, subject, insertBefore,
|
|
1928
|
+
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__.processSubjectComponent)(value, subject, insertBefore, ownerSupport, options);
|
|
1917
1929
|
return;
|
|
1918
1930
|
}
|
|
1919
1931
|
(0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_3__.processRegularValue)(value, subject, insertBefore);
|
|
@@ -1930,68 +1942,53 @@ options) {
|
|
|
1930
1942
|
|
|
1931
1943
|
__webpack_require__.r(__webpack_exports__);
|
|
1932
1944
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1933
|
-
/* harmony export */
|
|
1934
|
-
/* harmony export */ processTag: () => (/* binding */ processTag)
|
|
1945
|
+
/* harmony export */ getFakeTemplater: () => (/* binding */ getFakeTemplater),
|
|
1946
|
+
/* harmony export */ processTag: () => (/* binding */ processTag),
|
|
1947
|
+
/* harmony export */ setupNewTemplater: () => (/* binding */ setupNewTemplater),
|
|
1948
|
+
/* harmony export */ tagFakeTemplater: () => (/* binding */ tagFakeTemplater)
|
|
1935
1949
|
/* harmony export */ });
|
|
1936
|
-
/* harmony import */ var
|
|
1937
|
-
/* harmony import */ var
|
|
1938
|
-
/* harmony import */ var _subject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./subject */ "./ts/subject/index.ts");
|
|
1939
|
-
|
|
1950
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
1951
|
+
/* harmony import */ var _subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./subject */ "./ts/subject/index.ts");
|
|
1940
1952
|
|
|
1941
1953
|
|
|
1942
1954
|
/** Could be a regular tag or a component. Both are Tag.class */
|
|
1943
|
-
function processTag(
|
|
1944
|
-
|
|
1955
|
+
function processTag(templater, insertBefore, ownerSupport, // owner
|
|
1956
|
+
subject) {
|
|
1957
|
+
let tagSupport = subject.tagSupport;
|
|
1945
1958
|
// first time seeing this tag?
|
|
1946
|
-
if (!
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
ownerTag.childTags.push(tag);
|
|
1955
|
-
}
|
|
1956
|
-
tag.ownerTag = ownerTag;
|
|
1957
|
-
if (insertBefore.tagName !== 'TEMPLATE') {
|
|
1958
|
-
throw new Error(`processTag.function.ts - insertBefore is not TEMPLATE ${insertBefore.tagName}`);
|
|
1959
|
-
}
|
|
1960
|
-
tag.buildBeforeElement(insertBefore, {
|
|
1959
|
+
if (!tagSupport) {
|
|
1960
|
+
tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__.TagSupport(templater, ownerSupport, subject);
|
|
1961
|
+
setupNewTemplater(tagSupport, ownerSupport, subject);
|
|
1962
|
+
ownerSupport.childTags.push(tagSupport);
|
|
1963
|
+
}
|
|
1964
|
+
subject.tagSupport = tagSupport;
|
|
1965
|
+
tagSupport.ownerTagSupport = ownerSupport;
|
|
1966
|
+
tagSupport.buildBeforeElement(insertBefore, {
|
|
1961
1967
|
counts: { added: 0, removed: 0 },
|
|
1962
1968
|
forceElement: true,
|
|
1963
1969
|
});
|
|
1964
1970
|
}
|
|
1965
|
-
function
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
}
|
|
1969
|
-
const fakeTemplater = getFakeTemplater();
|
|
1970
|
-
tag.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_1__.TagSupport(ownerTag.tagSupport, fakeTemplater, // the template is provided via html`` call
|
|
1971
|
-
subject);
|
|
1972
|
-
fakeTemplater.global.oldest = tag;
|
|
1973
|
-
fakeTemplater.global.newest = tag;
|
|
1974
|
-
fakeTemplater.tagSupport = tag.tagSupport;
|
|
1971
|
+
function setupNewTemplater(tagSupport, ownerSupport, subject) {
|
|
1972
|
+
tagSupport.global.oldest = tagSupport;
|
|
1973
|
+
tagSupport.global.newest = tagSupport;
|
|
1975
1974
|
// asking me to render will cause my parent to render
|
|
1976
|
-
|
|
1975
|
+
tagSupport.ownerTagSupport = ownerSupport;
|
|
1976
|
+
subject.tagSupport = tagSupport;
|
|
1977
|
+
}
|
|
1978
|
+
function tagFakeTemplater(tag) {
|
|
1979
|
+
const templater = getFakeTemplater();
|
|
1980
|
+
templater.tag = tag;
|
|
1981
|
+
tag.templater = templater;
|
|
1982
|
+
return templater;
|
|
1977
1983
|
}
|
|
1978
1984
|
function getFakeTemplater() {
|
|
1979
1985
|
return {
|
|
1980
|
-
|
|
1981
|
-
renderCount: 0,
|
|
1982
|
-
providers: [],
|
|
1983
|
-
context: {},
|
|
1984
|
-
subscriptions: [],
|
|
1985
|
-
deleted: false,
|
|
1986
|
-
newestTemplater: {},
|
|
1987
|
-
},
|
|
1988
|
-
children: new _subject__WEBPACK_IMPORTED_MODULE_2__.ValueSubject([]), // no children
|
|
1986
|
+
children: new _subject__WEBPACK_IMPORTED_MODULE_1__.ValueSubject([]), // no children
|
|
1989
1987
|
props: {},
|
|
1990
1988
|
isTag: true,
|
|
1991
1989
|
isTemplater: false,
|
|
1992
1990
|
tagged: false,
|
|
1993
|
-
wrapper: (() => undefined),
|
|
1994
|
-
tagSupport: {},
|
|
1991
|
+
// wrapper: (() => undefined) as unknown as Wrapper,
|
|
1995
1992
|
};
|
|
1996
1993
|
}
|
|
1997
1994
|
|
|
@@ -2012,14 +2009,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2012
2009
|
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors */ "./ts/errors.ts");
|
|
2013
2010
|
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./checkDestroyPrevious.function */ "./ts/checkDestroyPrevious.function.ts");
|
|
2014
2011
|
/* harmony import */ var _processTag_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processTag.function */ "./ts/processTag.function.ts");
|
|
2012
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
2013
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
2014
|
+
|
|
2015
|
+
|
|
2015
2016
|
|
|
2016
2017
|
|
|
2017
2018
|
|
|
2018
2019
|
|
|
2019
2020
|
function processTagArray(subject, value, // arry of Tag classes
|
|
2020
2021
|
insertBefore, // <template end interpolate />
|
|
2021
|
-
|
|
2022
|
-
const clones =
|
|
2022
|
+
ownerSupport, options) {
|
|
2023
|
+
const clones = ownerSupport.clones; // []
|
|
2023
2024
|
let lastArray = subject.lastArray = subject.lastArray || [];
|
|
2024
2025
|
if (!subject.placeholder) {
|
|
2025
2026
|
setPlaceholderElm(insertBefore, subject);
|
|
@@ -2031,14 +2032,17 @@ ownerTag, options) {
|
|
|
2031
2032
|
const newLength = value.length - 1;
|
|
2032
2033
|
const at = index - removed;
|
|
2033
2034
|
const lessLength = newLength < at;
|
|
2034
|
-
const
|
|
2035
|
-
const
|
|
2036
|
-
const tag =
|
|
2037
|
-
const
|
|
2035
|
+
const subValue = value[index - removed];
|
|
2036
|
+
const subTag = subValue;
|
|
2037
|
+
// const tag = subTag?.templater.tag as Tag
|
|
2038
|
+
const lastTag = item.tagSupport.templater.tag;
|
|
2039
|
+
const newArrayValue = subTag?.memory.arrayValue;
|
|
2040
|
+
const lastArrayValue = lastTag.memory.arrayValue;
|
|
2041
|
+
const destroyItem = lessLength || !areLikeValues(newArrayValue, lastArrayValue);
|
|
2038
2042
|
if (destroyItem) {
|
|
2039
2043
|
const last = lastArray[index];
|
|
2040
|
-
const
|
|
2041
|
-
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_2__.destroyArrayTag)(
|
|
2044
|
+
const tagSupport = last.tagSupport;
|
|
2045
|
+
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_2__.destroyArrayTag)(tagSupport, options.counts);
|
|
2042
2046
|
last.deleted = true;
|
|
2043
2047
|
++removed;
|
|
2044
2048
|
++options.counts.removed;
|
|
@@ -2046,22 +2050,28 @@ ownerTag, options) {
|
|
|
2046
2050
|
}
|
|
2047
2051
|
return true;
|
|
2048
2052
|
});
|
|
2049
|
-
value.forEach((
|
|
2053
|
+
value.forEach((item, index) => {
|
|
2050
2054
|
const previous = lastArray[index];
|
|
2051
|
-
const previousSupport = previous?.
|
|
2052
|
-
const
|
|
2053
|
-
(0,
|
|
2055
|
+
const previousSupport = previous?.tagSupport;
|
|
2056
|
+
const subTag = item;
|
|
2057
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_5__.isTagClass)(subTag) && !subTag.templater) {
|
|
2058
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_3__.tagFakeTemplater)(subTag);
|
|
2059
|
+
}
|
|
2060
|
+
const tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_4__.TagSupport(subTag.templater, ownerSupport, new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(undefined));
|
|
2061
|
+
// tagSupport.templater = subTag.templater
|
|
2054
2062
|
if (previousSupport) {
|
|
2055
|
-
|
|
2056
|
-
|
|
2063
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_3__.setupNewTemplater)(tagSupport, ownerSupport, previousSupport.subject);
|
|
2064
|
+
const global = previousSupport.global;
|
|
2065
|
+
tagSupport.global = global;
|
|
2066
|
+
global.newest = tagSupport;
|
|
2057
2067
|
}
|
|
2058
2068
|
// check for html``.key()
|
|
2059
2069
|
const keySet = 'arrayValue' in subTag.memory;
|
|
2060
2070
|
if (!keySet) {
|
|
2061
2071
|
const details = {
|
|
2062
|
-
template:
|
|
2072
|
+
template: tagSupport.getTemplate().string,
|
|
2063
2073
|
array: value,
|
|
2064
|
-
ownerTagContent:
|
|
2074
|
+
ownerTagContent: ownerSupport.lastTemplateString,
|
|
2065
2075
|
};
|
|
2066
2076
|
const message = 'Use html`...`.key(item) instead of html`...` to template an Array';
|
|
2067
2077
|
console.error(message, details);
|
|
@@ -2070,22 +2080,15 @@ ownerTag, options) {
|
|
|
2070
2080
|
}
|
|
2071
2081
|
const couldBeSame = lastArray.length > index;
|
|
2072
2082
|
if (couldBeSame) {
|
|
2073
|
-
const prevSupport = previous.
|
|
2074
|
-
const prevGlobal = prevSupport.
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
// TODO: should not get here?
|
|
2083
|
-
processAddTagArrayItem(runtimeInsertBefore, subTag, index, options, lastArray);
|
|
2084
|
-
throw new Error('item should be back');
|
|
2085
|
-
// return [] // removed: item should have been previously deleted and will be added back
|
|
2086
|
-
}
|
|
2087
|
-
processAddTagArrayItem(runtimeInsertBefore, subTag, index, options, lastArray);
|
|
2088
|
-
ownerTag.childTags.push(subTag);
|
|
2083
|
+
const prevSupport = previous.tagSupport;
|
|
2084
|
+
const prevGlobal = prevSupport.global;
|
|
2085
|
+
// subTag.tagSupport = subTag.tagSupport || prevSupport
|
|
2086
|
+
const oldest = prevGlobal.oldest;
|
|
2087
|
+
oldest.updateBy(tagSupport);
|
|
2088
|
+
return [];
|
|
2089
|
+
}
|
|
2090
|
+
processAddTagArrayItem(runtimeInsertBefore, tagSupport, index, options, lastArray);
|
|
2091
|
+
ownerSupport.childTags.push(tagSupport);
|
|
2089
2092
|
});
|
|
2090
2093
|
return clones;
|
|
2091
2094
|
}
|
|
@@ -2099,9 +2102,9 @@ function setPlaceholderElm(insertBefore, subject) {
|
|
|
2099
2102
|
parentNode.insertBefore(placeholder, insertBefore);
|
|
2100
2103
|
parentNode.removeChild(insertBefore);
|
|
2101
2104
|
}
|
|
2102
|
-
function processAddTagArrayItem(before,
|
|
2105
|
+
function processAddTagArrayItem(before, tagSupport, index, options, lastArray) {
|
|
2103
2106
|
const lastValue = {
|
|
2104
|
-
|
|
2107
|
+
tagSupport, index
|
|
2105
2108
|
};
|
|
2106
2109
|
// Added to previous array
|
|
2107
2110
|
lastArray.push(lastValue);
|
|
@@ -2109,12 +2112,10 @@ function processAddTagArrayItem(before, subTag, index, options, lastArray) {
|
|
|
2109
2112
|
added: options.counts.added + index,
|
|
2110
2113
|
removed: options.counts.removed,
|
|
2111
2114
|
};
|
|
2112
|
-
if (!before.parentNode) {
|
|
2113
|
-
throw new Error('issue adding array item');
|
|
2114
|
-
}
|
|
2115
2115
|
const newTempElm = document.createElement('template');
|
|
2116
|
-
before.parentNode
|
|
2117
|
-
|
|
2116
|
+
const parent = before.parentNode;
|
|
2117
|
+
parent.insertBefore(newTempElm, before);
|
|
2118
|
+
tagSupport.buildBeforeElement(newTempElm, // before,
|
|
2118
2119
|
{ counts, forceElement: options.forceElement });
|
|
2119
2120
|
}
|
|
2120
2121
|
/** compare two values. If both values are arrays then the items will be compared */
|
|
@@ -2143,49 +2144,33 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2143
2144
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2144
2145
|
/* harmony export */ processTagResult: () => (/* binding */ processTagResult)
|
|
2145
2146
|
/* harmony export */ });
|
|
2146
|
-
function processTagResult(
|
|
2147
|
+
function processTagResult(tagSupport, subject, // used for recording past and current value
|
|
2147
2148
|
insertBefore, // <template end interpolate />
|
|
2148
2149
|
{ counts, forceElement, }) {
|
|
2149
|
-
if (!insertBefore.parentNode) {
|
|
2150
|
-
throw new Error(`before here processTagResult ${insertBefore.nodeName}`);
|
|
2151
|
-
}
|
|
2152
2150
|
// *if appears we already have seen
|
|
2153
2151
|
const subjectTag = subject;
|
|
2154
|
-
const
|
|
2155
|
-
const
|
|
2156
|
-
const justUpdate =
|
|
2157
|
-
if (
|
|
2158
|
-
|
|
2159
|
-
const areLike = previousTag.isLikeTag(tag)
|
|
2160
|
-
|
|
2161
|
-
// are we just updating an if we already had?
|
|
2162
|
-
if(areLike) {
|
|
2163
|
-
return processTagResultUpdate(tag, subjectTag, previousTag)
|
|
2164
|
-
}
|
|
2165
|
-
*/
|
|
2166
|
-
return processTagResultUpdate(tag, subjectTag, previousTag);
|
|
2167
|
-
}
|
|
2168
|
-
/*
|
|
2169
|
-
if(insertBefore.nodeName !== 'TEMPLATE') {
|
|
2170
|
-
throw new Error(`processTagResult.function.ts insertBefore is not template ${insertBefore.nodeName}`)
|
|
2152
|
+
const lastSupport = subjectTag.tagSupport;
|
|
2153
|
+
const prevSupport = lastSupport?.global.oldest || undefined; // || tag.tagSupport.oldest // subjectTag.tag
|
|
2154
|
+
const justUpdate = prevSupport; // && !forceElement
|
|
2155
|
+
if (prevSupport && justUpdate) {
|
|
2156
|
+
return processTagResultUpdate(tagSupport, subjectTag, prevSupport);
|
|
2171
2157
|
}
|
|
2172
|
-
|
|
2173
|
-
tag.buildBeforeElement(insertBefore, {
|
|
2158
|
+
tagSupport.buildBeforeElement(insertBefore, {
|
|
2174
2159
|
counts,
|
|
2175
2160
|
forceElement,
|
|
2176
2161
|
});
|
|
2177
2162
|
}
|
|
2178
|
-
function processTagResultUpdate(
|
|
2179
|
-
|
|
2163
|
+
function processTagResultUpdate(tagSupport, subject, // used for recording past and current value
|
|
2164
|
+
prevSupport) {
|
|
2180
2165
|
// components
|
|
2181
2166
|
if (subject instanceof Function) {
|
|
2182
|
-
const
|
|
2183
|
-
|
|
2184
|
-
subject.
|
|
2167
|
+
const newSupport = subject(prevSupport);
|
|
2168
|
+
prevSupport.updateBy(newSupport);
|
|
2169
|
+
subject.tagSupport = newSupport;
|
|
2185
2170
|
return;
|
|
2186
2171
|
}
|
|
2187
|
-
|
|
2188
|
-
subject.
|
|
2172
|
+
prevSupport.updateBy(tagSupport);
|
|
2173
|
+
subject.tagSupport = tagSupport;
|
|
2189
2174
|
return;
|
|
2190
2175
|
}
|
|
2191
2176
|
|
|
@@ -2239,31 +2224,35 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2239
2224
|
|
|
2240
2225
|
|
|
2241
2226
|
/** Returns true when rendering owner is not needed. Returns false when rendering owner should occur */
|
|
2242
|
-
function renderExistingTag(
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2227
|
+
function renderExistingTag(oldestSupport, // oldest with elements on html
|
|
2228
|
+
newSupport, // new to be rendered
|
|
2229
|
+
ownerSupport, // ownerSupport
|
|
2230
|
+
subject) {
|
|
2231
|
+
const lastSupport = subject.tagSupport;
|
|
2232
|
+
const global = lastSupport.global;
|
|
2233
|
+
// share point between renders
|
|
2234
|
+
newSupport.global = global;
|
|
2235
|
+
const preRenderCount = global.renderCount;
|
|
2236
|
+
(0,_state_provider_utils__WEBPACK_IMPORTED_MODULE_0__.providersChangeCheck)(oldestSupport);
|
|
2251
2237
|
// When the providers were checked, a render to myself occurred and I do not need to re-render again
|
|
2252
|
-
const
|
|
2253
|
-
if (preRenderCount !==
|
|
2254
|
-
|
|
2255
|
-
return
|
|
2238
|
+
const prevSupport = global.newest;
|
|
2239
|
+
if (preRenderCount !== global.renderCount) {
|
|
2240
|
+
oldestSupport.updateBy(prevSupport);
|
|
2241
|
+
return prevSupport; // already rendered during triggered events
|
|
2256
2242
|
}
|
|
2257
|
-
|
|
2258
|
-
const toRedrawTag =
|
|
2259
|
-
const
|
|
2260
|
-
const
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2243
|
+
// ??? changed during mirroring - lastSupport keeps having less info than newest
|
|
2244
|
+
// const toRedrawTag = lastSupport || prevSupport || tagSupport.global.oldest
|
|
2245
|
+
const toRedrawTag = prevSupport || lastSupport || global.oldest;
|
|
2246
|
+
const reSupport = (0,_TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__.renderWithSupport)(newSupport, toRedrawTag, subject,
|
|
2247
|
+
// oldestSupport,
|
|
2248
|
+
ownerSupport);
|
|
2249
|
+
const oldest = global.oldest || oldestSupport;
|
|
2250
|
+
reSupport.global.oldest = oldest;
|
|
2251
|
+
if ((0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__.isLikeTags)(prevSupport, reSupport)) {
|
|
2252
|
+
subject.tagSupport = reSupport;
|
|
2253
|
+
oldest.updateBy(reSupport);
|
|
2265
2254
|
}
|
|
2266
|
-
return
|
|
2255
|
+
return reSupport;
|
|
2267
2256
|
}
|
|
2268
2257
|
|
|
2269
2258
|
|
|
@@ -2280,44 +2269,40 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2280
2269
|
/* harmony export */ renderTagSupport: () => (/* binding */ renderTagSupport)
|
|
2281
2270
|
/* harmony export */ });
|
|
2282
2271
|
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
2283
|
-
/* harmony import */ var
|
|
2284
|
-
/* harmony import */ var _renderExistingTag_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./renderExistingTag.function */ "./ts/renderExistingTag.function.ts");
|
|
2285
|
-
|
|
2272
|
+
/* harmony import */ var _renderExistingTag_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./renderExistingTag.function */ "./ts/renderExistingTag.function.ts");
|
|
2286
2273
|
|
|
2287
2274
|
|
|
2288
2275
|
/** Main function used by all other callers to render/update display of a tag component */
|
|
2289
2276
|
function renderTagSupport(tagSupport, renderUp) {
|
|
2290
|
-
const global = tagSupport.
|
|
2291
|
-
|
|
2277
|
+
const global = tagSupport.global;
|
|
2278
|
+
const templater = tagSupport.templater;
|
|
2279
|
+
// is it just a vanilla tag, not component?
|
|
2280
|
+
if (!templater.wrapper) { // || isTagTemplater(templater)
|
|
2292
2281
|
const newTag = global.newest;
|
|
2293
|
-
const ownerTag = newTag.
|
|
2282
|
+
const ownerTag = newTag.ownerTagSupport;
|
|
2294
2283
|
++global.renderCount;
|
|
2295
|
-
return renderTagSupport(ownerTag
|
|
2284
|
+
return renderTagSupport(ownerTag, true);
|
|
2296
2285
|
}
|
|
2297
|
-
// const oldTagSetup = this
|
|
2298
2286
|
const subject = tagSupport.subject;
|
|
2299
|
-
const
|
|
2300
|
-
|
|
2301
|
-
const newest = subjectTag?.tagSupport.templater.global.newest;
|
|
2302
|
-
let ownerTag;
|
|
2287
|
+
const newest = global.newest;
|
|
2288
|
+
let ownerSupport;
|
|
2303
2289
|
let selfPropChange = false;
|
|
2304
2290
|
const shouldRenderUp = renderUp && newest;
|
|
2305
2291
|
if (shouldRenderUp) {
|
|
2306
|
-
|
|
2307
|
-
if (
|
|
2292
|
+
ownerSupport = newest.ownerTagSupport;
|
|
2293
|
+
if (ownerSupport) {
|
|
2308
2294
|
const nowProps = templater.props;
|
|
2309
|
-
const latestProps = newest.
|
|
2295
|
+
const latestProps = newest.propsConfig.latestCloned;
|
|
2310
2296
|
selfPropChange = !(0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(nowProps, latestProps);
|
|
2311
2297
|
}
|
|
2312
2298
|
}
|
|
2313
|
-
const useTagSupport = global.newest
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
const
|
|
2318
|
-
const renderOwner = ownerTag && selfPropChange;
|
|
2299
|
+
// const useTagSupport = global.newest as TagSupport // oldTagSetup
|
|
2300
|
+
const oldest = tagSupport.global.oldest;
|
|
2301
|
+
const tag = (0,_renderExistingTag_function__WEBPACK_IMPORTED_MODULE_1__.renderExistingTag)(oldest, tagSupport, ownerSupport, // useTagSupport,
|
|
2302
|
+
subject);
|
|
2303
|
+
const renderOwner = ownerSupport && selfPropChange;
|
|
2319
2304
|
if (renderOwner) {
|
|
2320
|
-
const ownerTagSupport =
|
|
2305
|
+
const ownerTagSupport = ownerSupport;
|
|
2321
2306
|
renderTagSupport(ownerTagSupport, true);
|
|
2322
2307
|
return tag;
|
|
2323
2308
|
}
|
|
@@ -2327,31 +2312,22 @@ function renderTagSupport(tagSupport, renderUp) {
|
|
|
2327
2312
|
|
|
2328
2313
|
/***/ }),
|
|
2329
2314
|
|
|
2330
|
-
/***/ "./ts/
|
|
2315
|
+
/***/ "./ts/setTagPlaceholder.function.ts":
|
|
2331
2316
|
/*!******************************************!*\
|
|
2332
|
-
!*** ./ts/
|
|
2317
|
+
!*** ./ts/setTagPlaceholder.function.ts ***!
|
|
2333
2318
|
\******************************************/
|
|
2334
2319
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2335
2320
|
|
|
2336
2321
|
__webpack_require__.r(__webpack_exports__);
|
|
2337
2322
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2338
|
-
/* harmony export */
|
|
2323
|
+
/* harmony export */ setTagPlaceholder: () => (/* binding */ setTagPlaceholder)
|
|
2339
2324
|
/* harmony export */ });
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
const
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
const match = value.match(/__tagvar(\d{1,4})/);
|
|
2347
|
-
const token = match ? match[0] : '';
|
|
2348
|
-
const dynamic = '{' + token + '}';
|
|
2349
|
-
textarea.value = '';
|
|
2350
|
-
textarea.setAttribute('text-var-value', dynamic);
|
|
2351
|
-
const howToSet = (_elm, _name, value) => textarea.value = value;
|
|
2352
|
-
(0,_processAttribute_function__WEBPACK_IMPORTED_MODULE_0__.processAttribute)('text-var-value', dynamic, // realValue, // context[token].value,
|
|
2353
|
-
textarea, context, ownerTag, howToSet);
|
|
2354
|
-
}
|
|
2325
|
+
function setTagPlaceholder(global) {
|
|
2326
|
+
const insertBefore = global.insertBefore;
|
|
2327
|
+
const placeholder = global.placeholder = document.createTextNode('');
|
|
2328
|
+
const parentNode = insertBefore.parentNode;
|
|
2329
|
+
parentNode.insertBefore(placeholder, insertBefore);
|
|
2330
|
+
parentNode.removeChild(insertBefore);
|
|
2355
2331
|
}
|
|
2356
2332
|
|
|
2357
2333
|
|
|
@@ -2375,7 +2351,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2375
2351
|
|
|
2376
2352
|
|
|
2377
2353
|
|
|
2378
|
-
let innerCallback = (callback) => (
|
|
2354
|
+
let innerCallback = (callback) => (a, b, c, d, e, f) => {
|
|
2379
2355
|
throw new _errors__WEBPACK_IMPORTED_MODULE_3__.SyncCallbackError('Callback function was called immediately in sync and must instead be call async');
|
|
2380
2356
|
};
|
|
2381
2357
|
const callbackMaker = () => innerCallback;
|
|
@@ -2406,18 +2382,17 @@ function initMemory(tagSupport) {
|
|
|
2406
2382
|
}
|
|
2407
2383
|
function triggerStateUpdate(tagSupport, callback, oldState, ...args) {
|
|
2408
2384
|
const state = tagSupport.memory.state;
|
|
2409
|
-
const newest = state.newest;
|
|
2410
2385
|
// ensure that the oldest has the latest values first
|
|
2411
|
-
updateState(
|
|
2386
|
+
updateState(state, oldState);
|
|
2412
2387
|
// run the callback
|
|
2413
2388
|
const promise = callback(...args);
|
|
2414
2389
|
// send the oldest state changes into the newest
|
|
2415
|
-
updateState(oldState,
|
|
2390
|
+
updateState(oldState, state);
|
|
2416
2391
|
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
2417
2392
|
if (promise instanceof Promise) {
|
|
2418
2393
|
promise.finally(() => {
|
|
2419
2394
|
// send the oldest state changes into the newest
|
|
2420
|
-
updateState(oldState,
|
|
2395
|
+
updateState(oldState, state);
|
|
2421
2396
|
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
2422
2397
|
});
|
|
2423
2398
|
}
|
|
@@ -2538,13 +2513,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2538
2513
|
/** When undefined, it means a tag is being built for the first time so do run destroy(s) */
|
|
2539
2514
|
let destroyCurrentTagSupport;
|
|
2540
2515
|
function onDestroy(callback) {
|
|
2541
|
-
destroyCurrentTagSupport.
|
|
2516
|
+
destroyCurrentTagSupport.global.destroyCallback = callback;
|
|
2542
2517
|
}
|
|
2543
2518
|
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
2544
2519
|
beforeRender: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
2545
2520
|
beforeRedraw: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
2546
2521
|
beforeDestroy: (tagSupport, tag) => {
|
|
2547
|
-
const callback = tagSupport.
|
|
2522
|
+
const callback = tagSupport.global.destroyCallback;
|
|
2548
2523
|
if (callback) {
|
|
2549
2524
|
callback();
|
|
2550
2525
|
}
|
|
@@ -2567,13 +2542,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2567
2542
|
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2568
2543
|
|
|
2569
2544
|
function setCurrentTagSupport(support) {
|
|
2570
|
-
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.
|
|
2545
|
+
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentSupport = support;
|
|
2571
2546
|
}
|
|
2572
2547
|
function onInit(callback) {
|
|
2573
|
-
const
|
|
2574
|
-
if (!
|
|
2575
|
-
;
|
|
2576
|
-
templater.global.init = callback;
|
|
2548
|
+
const tagSupport = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentSupport;
|
|
2549
|
+
if (!tagSupport.global.init) {
|
|
2550
|
+
tagSupport.global.init = callback;
|
|
2577
2551
|
callback(); // fire init
|
|
2578
2552
|
}
|
|
2579
2553
|
}
|
|
@@ -2599,46 +2573,41 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2599
2573
|
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
2600
2574
|
|
|
2601
2575
|
|
|
2602
|
-
function providersChangeCheck(
|
|
2603
|
-
const global =
|
|
2576
|
+
function providersChangeCheck(tagSupport) {
|
|
2577
|
+
const global = tagSupport.global;
|
|
2604
2578
|
const providersWithChanges = global.providers.filter(provider => !(0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(provider.instance, provider.clone));
|
|
2605
2579
|
// reset clones
|
|
2606
2580
|
providersWithChanges.forEach(provider => {
|
|
2607
|
-
const appElement =
|
|
2581
|
+
const appElement = tagSupport.getAppElement();
|
|
2608
2582
|
handleProviderChanges(appElement, provider);
|
|
2609
2583
|
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
2610
2584
|
});
|
|
2611
2585
|
}
|
|
2612
2586
|
function handleProviderChanges(appElement, provider) {
|
|
2613
2587
|
const tagsWithProvider = getTagsWithProvider(appElement, provider);
|
|
2614
|
-
tagsWithProvider.forEach(({
|
|
2615
|
-
if (
|
|
2588
|
+
tagsWithProvider.forEach(({ tagSupport, renderCount, provider }) => {
|
|
2589
|
+
if (tagSupport.global.deleted) {
|
|
2616
2590
|
return; // i was deleted after another tag processed
|
|
2617
2591
|
}
|
|
2618
|
-
const notRendered = renderCount ===
|
|
2592
|
+
const notRendered = renderCount === tagSupport.global.renderCount;
|
|
2619
2593
|
if (notRendered) {
|
|
2620
2594
|
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
2621
|
-
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(
|
|
2595
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(tagSupport, false);
|
|
2622
2596
|
}
|
|
2623
2597
|
});
|
|
2624
2598
|
}
|
|
2625
|
-
function getTagsWithProvider(
|
|
2626
|
-
const global =
|
|
2599
|
+
function getTagsWithProvider(tagSupport, provider, memory = []) {
|
|
2600
|
+
const global = tagSupport.global;
|
|
2627
2601
|
const compare = global.providers;
|
|
2628
2602
|
const hasProvider = compare.find(xProvider => xProvider.constructMethod === provider.constructMethod);
|
|
2629
2603
|
if (hasProvider) {
|
|
2630
2604
|
memory.push({
|
|
2631
|
-
|
|
2605
|
+
tagSupport,
|
|
2632
2606
|
renderCount: global.renderCount,
|
|
2633
2607
|
provider: hasProvider,
|
|
2634
2608
|
});
|
|
2635
2609
|
}
|
|
2636
|
-
|
|
2637
|
-
memory.forEach(({ tag }) => {
|
|
2638
|
-
if (tag.tagSupport.templater.global.deleted) {
|
|
2639
|
-
throw new Error('do not get here - 0');
|
|
2640
|
-
}
|
|
2641
|
-
});
|
|
2610
|
+
tagSupport.childTags.forEach(child => getTagsWithProvider(child, provider, memory));
|
|
2642
2611
|
return memory;
|
|
2643
2612
|
}
|
|
2644
2613
|
|
|
@@ -2659,11 +2628,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2659
2628
|
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2660
2629
|
|
|
2661
2630
|
|
|
2662
|
-
// TODO: rename
|
|
2663
2631
|
_setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig = {
|
|
2664
2632
|
providers: [],
|
|
2665
|
-
|
|
2666
|
-
ownerTag: undefined,
|
|
2633
|
+
ownerSupport: undefined,
|
|
2667
2634
|
};
|
|
2668
2635
|
function get(constructMethod) {
|
|
2669
2636
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
@@ -2678,7 +2645,7 @@ const providers = {
|
|
|
2678
2645
|
return existing.instance;
|
|
2679
2646
|
}
|
|
2680
2647
|
// Providers with provider requirements just need to use providers.create() and providers.inject()
|
|
2681
|
-
const instance = constructMethod
|
|
2648
|
+
const instance = 'prototype' in constructMethod ? new constructMethod() : constructMethod();
|
|
2682
2649
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
2683
2650
|
config.providers.push({
|
|
2684
2651
|
constructMethod,
|
|
@@ -2699,10 +2666,10 @@ const providers = {
|
|
|
2699
2666
|
}
|
|
2700
2667
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
2701
2668
|
let owner = {
|
|
2702
|
-
|
|
2669
|
+
ownerTagSupport: config.ownerSupport
|
|
2703
2670
|
};
|
|
2704
|
-
while (owner.
|
|
2705
|
-
const ownerProviders = owner.
|
|
2671
|
+
while (owner.ownerTagSupport) {
|
|
2672
|
+
const ownerProviders = owner.ownerTagSupport.global.providers;
|
|
2706
2673
|
const provider = ownerProviders.find(provider => {
|
|
2707
2674
|
if (provider.constructMethod === constructor) {
|
|
2708
2675
|
return true;
|
|
@@ -2713,7 +2680,7 @@ const providers = {
|
|
|
2713
2680
|
config.providers.push(provider);
|
|
2714
2681
|
return provider.instance;
|
|
2715
2682
|
}
|
|
2716
|
-
owner = owner.
|
|
2683
|
+
owner = owner.ownerTagSupport; // cause reloop
|
|
2717
2684
|
}
|
|
2718
2685
|
const msg = `Could not inject provider: ${constructor.name} ${constructor}`;
|
|
2719
2686
|
console.warn(`${msg}. Available providers`, config.providers);
|
|
@@ -2721,25 +2688,24 @@ const providers = {
|
|
|
2721
2688
|
}
|
|
2722
2689
|
};
|
|
2723
2690
|
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse)({
|
|
2724
|
-
beforeRender: (tagSupport,
|
|
2725
|
-
run(tagSupport,
|
|
2691
|
+
beforeRender: (tagSupport, ownerSupport) => {
|
|
2692
|
+
run(tagSupport, ownerSupport);
|
|
2726
2693
|
},
|
|
2727
|
-
beforeRedraw: (tagSupport,
|
|
2728
|
-
run(tagSupport,
|
|
2694
|
+
beforeRedraw: (tagSupport, newTagSupport) => {
|
|
2695
|
+
run(tagSupport, newTagSupport.ownerTagSupport);
|
|
2729
2696
|
},
|
|
2730
2697
|
afterRender: (tagSupport) => {
|
|
2731
2698
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
2732
|
-
tagSupport.
|
|
2699
|
+
tagSupport.global.providers = [...config.providers];
|
|
2733
2700
|
config.providers.length = 0;
|
|
2734
2701
|
}
|
|
2735
2702
|
});
|
|
2736
|
-
function run(tagSupport,
|
|
2703
|
+
function run(tagSupport, ownerSupport) {
|
|
2737
2704
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
if (tagSupport.templater.global.providers.length) {
|
|
2705
|
+
config.ownerSupport = ownerSupport;
|
|
2706
|
+
if (tagSupport.global.providers.length) {
|
|
2741
2707
|
config.providers.length = 0;
|
|
2742
|
-
config.providers.push(...tagSupport.
|
|
2708
|
+
config.providers.push(...tagSupport.global.providers);
|
|
2743
2709
|
}
|
|
2744
2710
|
}
|
|
2745
2711
|
|
|
@@ -2894,20 +2860,23 @@ _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig = {
|
|
|
2894
2860
|
array: [], // state memory on the first render
|
|
2895
2861
|
// rearray: [] as StateConfigArray, // state memory to be used before the next render
|
|
2896
2862
|
};
|
|
2863
|
+
const beforeRender = (tagSupport) => initState(tagSupport);
|
|
2897
2864
|
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse)({
|
|
2898
|
-
beforeRender
|
|
2899
|
-
beforeRedraw:
|
|
2865
|
+
beforeRender,
|
|
2866
|
+
beforeRedraw: beforeRender,
|
|
2900
2867
|
afterRender: (tagSupport) => {
|
|
2901
|
-
const
|
|
2868
|
+
const memory = tagSupport.memory;
|
|
2869
|
+
const state = memory.state;
|
|
2902
2870
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2903
2871
|
const rearray = config.rearray;
|
|
2904
2872
|
if (rearray.length) {
|
|
2905
2873
|
if (rearray.length !== config.array.length) {
|
|
2906
2874
|
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`;
|
|
2875
|
+
const wrapper = tagSupport.templater?.wrapper;
|
|
2907
2876
|
const details = {
|
|
2908
2877
|
oldStates: config.array,
|
|
2909
2878
|
newStates: config.rearray,
|
|
2910
|
-
|
|
2879
|
+
tagFunction: wrapper.original,
|
|
2911
2880
|
};
|
|
2912
2881
|
const error = new _errors__WEBPACK_IMPORTED_MODULE_0__.StateMismatchError(message, details);
|
|
2913
2882
|
console.warn(message, details);
|
|
@@ -2915,8 +2884,8 @@ _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig = {
|
|
|
2915
2884
|
}
|
|
2916
2885
|
}
|
|
2917
2886
|
delete config.rearray; // clean up any previous runs
|
|
2918
|
-
state
|
|
2919
|
-
state.
|
|
2887
|
+
memory.state = config.array; // [...config.array]
|
|
2888
|
+
memory.state.forEach(item => item.lastValue = getStateValue(item)); // set last values
|
|
2920
2889
|
config.array = [];
|
|
2921
2890
|
}
|
|
2922
2891
|
});
|
|
@@ -2944,30 +2913,33 @@ state) {
|
|
|
2944
2913
|
class StateEchoBack {
|
|
2945
2914
|
}
|
|
2946
2915
|
function initState(tagSupport) {
|
|
2947
|
-
const
|
|
2916
|
+
const memory = tagSupport.memory;
|
|
2917
|
+
const state = memory.state;
|
|
2948
2918
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2949
2919
|
// TODO: This guard may no longer be needed
|
|
2950
2920
|
if (config.rearray) {
|
|
2921
|
+
const wrapper = tagSupport.templater?.wrapper;
|
|
2922
|
+
const wasWrapper = config.tagSupport?.templater.wrapper;
|
|
2951
2923
|
const message = 'last state not cleared. Possibly in the middle of rendering one component and another is trying to render';
|
|
2952
2924
|
console.error(message, {
|
|
2953
2925
|
config,
|
|
2954
|
-
|
|
2955
|
-
wasInMiddleOf:
|
|
2926
|
+
tagFunction: wrapper.original,
|
|
2927
|
+
wasInMiddleOf: wasWrapper.original,
|
|
2956
2928
|
state,
|
|
2957
2929
|
expectedClearArray: config.rearray,
|
|
2958
2930
|
});
|
|
2959
2931
|
throw new _errors__WEBPACK_IMPORTED_MODULE_0__.StateMismatchError(message, {
|
|
2960
2932
|
config,
|
|
2961
|
-
|
|
2933
|
+
tagFunction: wrapper.original,
|
|
2962
2934
|
state,
|
|
2963
2935
|
expectedClearArray: config.rearray,
|
|
2964
2936
|
});
|
|
2965
2937
|
}
|
|
2966
2938
|
// TODO: this maybe redundant and not needed
|
|
2967
2939
|
config.rearray = []; // .length = 0
|
|
2968
|
-
if (state?.
|
|
2969
|
-
state.
|
|
2970
|
-
config.rearray.push(...state
|
|
2940
|
+
if (state?.length) {
|
|
2941
|
+
state.forEach(state => getStateValue(state));
|
|
2942
|
+
config.rearray.push(...state);
|
|
2971
2943
|
}
|
|
2972
2944
|
config.tagSupport = tagSupport;
|
|
2973
2945
|
}
|
|
@@ -2987,12 +2959,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2987
2959
|
/* harmony export */ });
|
|
2988
2960
|
/* harmony import */ var _letState_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./letState.function */ "./ts/state/letState.function.ts");
|
|
2989
2961
|
|
|
2990
|
-
/**
|
|
2962
|
+
/**
|
|
2963
|
+
* When an item in watch array changes, callback function will be triggered. Does not trigger on initial watch setup.
|
|
2964
|
+
* @param currentValues T[]
|
|
2965
|
+
* @param callback WatchCallback
|
|
2966
|
+
* @returns T[]
|
|
2967
|
+
*/
|
|
2991
2968
|
function watch(currentValues, callback) {
|
|
2992
2969
|
let previousValues = (0,_letState_function__WEBPACK_IMPORTED_MODULE_0__.letState)(undefined)(x => [previousValues, previousValues = x]);
|
|
2970
|
+
// First time running watch?
|
|
2993
2971
|
if (previousValues === undefined) {
|
|
2994
|
-
callback(currentValues, previousValues)
|
|
2995
|
-
// const result = {currentValues, previousValues}
|
|
2972
|
+
// callback(currentValues, previousValues) // do not call during init
|
|
2996
2973
|
previousValues = currentValues;
|
|
2997
2974
|
return currentValues;
|
|
2998
2975
|
}
|
|
@@ -3021,15 +2998,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3021
2998
|
/* harmony export */ });
|
|
3022
2999
|
class Subject {
|
|
3023
3000
|
value;
|
|
3001
|
+
onSubscription;
|
|
3024
3002
|
methods = [];
|
|
3025
3003
|
isSubject = true;
|
|
3026
3004
|
subscribers = [];
|
|
3027
3005
|
subscribeWith;
|
|
3028
3006
|
// unsubcount = 0 // 🔬 testing
|
|
3029
|
-
constructor(value) {
|
|
3007
|
+
constructor(value, onSubscription) {
|
|
3030
3008
|
this.value = value;
|
|
3009
|
+
this.onSubscription = onSubscription;
|
|
3031
3010
|
}
|
|
3032
3011
|
subscribe(callback) {
|
|
3012
|
+
const subscription = getSubscription(this, callback);
|
|
3033
3013
|
// are we within a pipe?
|
|
3034
3014
|
const subscribeWith = this.subscribeWith;
|
|
3035
3015
|
if (subscribeWith) {
|
|
@@ -3037,33 +3017,42 @@ class Subject {
|
|
|
3037
3017
|
if (this.methods.length) {
|
|
3038
3018
|
const orgCallback = callback;
|
|
3039
3019
|
callback = (value) => {
|
|
3040
|
-
runPipedMethods(value, this.methods, lastValue => orgCallback(lastValue));
|
|
3020
|
+
runPipedMethods(value, this.methods, lastValue => orgCallback(lastValue, subscription));
|
|
3041
3021
|
};
|
|
3042
3022
|
}
|
|
3043
3023
|
return subscribeWith(callback);
|
|
3044
3024
|
}
|
|
3045
|
-
this.subscribers.push(
|
|
3046
|
-
SubjectClass.globalSubs.push(
|
|
3047
|
-
|
|
3025
|
+
this.subscribers.push(subscription);
|
|
3026
|
+
SubjectClass.globalSubs.push(subscription); // 🔬 testing
|
|
3027
|
+
if (this.onSubscription) {
|
|
3028
|
+
this.onSubscription(subscription);
|
|
3029
|
+
}
|
|
3048
3030
|
return subscription;
|
|
3049
3031
|
}
|
|
3050
3032
|
set(value) {
|
|
3051
3033
|
this.value = value;
|
|
3052
3034
|
// Notify all subscribers with the new value
|
|
3053
|
-
this.subscribers.forEach(
|
|
3054
|
-
callback.value = value
|
|
3055
|
-
callback(value);
|
|
3035
|
+
this.subscribers.forEach(sub => {
|
|
3036
|
+
// (sub.callback as any).value = value
|
|
3037
|
+
sub.callback(value, sub);
|
|
3056
3038
|
});
|
|
3057
3039
|
}
|
|
3058
3040
|
next = this.set;
|
|
3059
3041
|
toPromise() {
|
|
3060
3042
|
return new Promise((res, rej) => {
|
|
3061
|
-
|
|
3043
|
+
this.subscribe((x, subscription) => {
|
|
3062
3044
|
subscription.unsubscribe();
|
|
3063
3045
|
res(x);
|
|
3064
3046
|
});
|
|
3065
3047
|
});
|
|
3066
3048
|
}
|
|
3049
|
+
// like toPromise but faster
|
|
3050
|
+
toCallback(callback) {
|
|
3051
|
+
this.subscribe((x, subscription) => {
|
|
3052
|
+
subscription.unsubscribe();
|
|
3053
|
+
callback(x);
|
|
3054
|
+
});
|
|
3055
|
+
}
|
|
3067
3056
|
pipe(...operations) {
|
|
3068
3057
|
const subject = new Subject();
|
|
3069
3058
|
subject.methods = operations;
|
|
@@ -3072,7 +3061,7 @@ class Subject {
|
|
|
3072
3061
|
}
|
|
3073
3062
|
}
|
|
3074
3063
|
function removeSubFromArray(subscribers, callback) {
|
|
3075
|
-
const index = subscribers.
|
|
3064
|
+
const index = subscribers.findIndex(sub => sub.callback === callback);
|
|
3076
3065
|
if (index !== -1) {
|
|
3077
3066
|
subscribers.splice(index, 1);
|
|
3078
3067
|
}
|
|
@@ -3087,6 +3076,7 @@ function getSubscription(subject, callback) {
|
|
|
3087
3076
|
const subscription = () => {
|
|
3088
3077
|
subscription.unsubscribe();
|
|
3089
3078
|
};
|
|
3079
|
+
subscription.callback = callback;
|
|
3090
3080
|
subscription.subscriptions = [];
|
|
3091
3081
|
// Return a function to unsubscribe from the BehaviorSubject
|
|
3092
3082
|
subscription.unsubscribe = () => {
|
|
@@ -3103,6 +3093,9 @@ function getSubscription(subject, callback) {
|
|
|
3103
3093
|
subscription.subscriptions.push(sub);
|
|
3104
3094
|
return subscription;
|
|
3105
3095
|
};
|
|
3096
|
+
subscription.next = (value) => {
|
|
3097
|
+
callback(value, subscription);
|
|
3098
|
+
};
|
|
3106
3099
|
return subscription;
|
|
3107
3100
|
}
|
|
3108
3101
|
function runPipedMethods(value, methods, onComplete) {
|
|
@@ -3146,7 +3139,7 @@ class ValueSubject extends _Subject_class__WEBPACK_IMPORTED_MODULE_0__.Subject {
|
|
|
3146
3139
|
subscribe(callback) {
|
|
3147
3140
|
const subscription = super.subscribe(callback);
|
|
3148
3141
|
// Call the callback immediately with the current value
|
|
3149
|
-
callback(this.value);
|
|
3142
|
+
callback(this.value, subscription);
|
|
3150
3143
|
return subscription;
|
|
3151
3144
|
}
|
|
3152
3145
|
}
|
|
@@ -3280,7 +3273,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3280
3273
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
3281
3274
|
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "./ts/state/index.ts");
|
|
3282
3275
|
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
3283
|
-
/* harmony import */ var
|
|
3276
|
+
/* harmony import */ var _interpolations_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./interpolations/bindSubjectCallback.function */ "./ts/interpolations/bindSubjectCallback.function.ts");
|
|
3284
3277
|
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
3285
3278
|
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3286
3279
|
/* harmony import */ var _alterProps_function__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./alterProps.function */ "./ts/alterProps.function.ts");
|
|
@@ -3298,8 +3291,10 @@ let tagCount = 0;
|
|
|
3298
3291
|
/** Wraps a tag component in a state manager and always push children to last argument as an array */
|
|
3299
3292
|
// export function tag<T>(a: T): T;
|
|
3300
3293
|
function tag(tagComponent) {
|
|
3294
|
+
/** function developer triggers */
|
|
3301
3295
|
const result = (function tagWrapper(props, children) {
|
|
3302
|
-
|
|
3296
|
+
// is the props argument actually children?
|
|
3297
|
+
const isPropTag = (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagClass)(props) || (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagTemplater)(props) || (0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagArray)(props);
|
|
3303
3298
|
if (isPropTag) {
|
|
3304
3299
|
children = props;
|
|
3305
3300
|
props = undefined;
|
|
@@ -3307,6 +3302,7 @@ function tag(tagComponent) {
|
|
|
3307
3302
|
const { childSubject, madeSubject } = kidsToTagArraySubject(children);
|
|
3308
3303
|
childSubject.isChildSubject = true;
|
|
3309
3304
|
const templater = new _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_2__.TemplaterResult(props, childSubject);
|
|
3305
|
+
// attach memory back to original function that contains developer display logic
|
|
3310
3306
|
const innerTagWrap = getTagWrap(templater, madeSubject);
|
|
3311
3307
|
innerTagWrap.original = tagComponent;
|
|
3312
3308
|
templater.tagged = true;
|
|
@@ -3317,6 +3313,7 @@ function tag(tagComponent) {
|
|
|
3317
3313
|
// group tags together and have hmr pickup
|
|
3318
3314
|
updateComponent(tagComponent);
|
|
3319
3315
|
tags.push(tagComponent);
|
|
3316
|
+
// fake the return as being (props?, children?) => TemplaterResult
|
|
3320
3317
|
return result;
|
|
3321
3318
|
}
|
|
3322
3319
|
function kidsToTagArraySubject(children) {
|
|
@@ -3346,45 +3343,35 @@ function updateComponent(tagComponent) {
|
|
|
3346
3343
|
tagComponent.setUse = _state__WEBPACK_IMPORTED_MODULE_1__.setUse;
|
|
3347
3344
|
tagComponent.tagIndex = tagCount++; // needed for things like HMR
|
|
3348
3345
|
}
|
|
3349
|
-
/** creates/returns a function that when called then calls the original component function
|
|
3346
|
+
/** creates/returns a function that when called then calls the original component function
|
|
3347
|
+
* Gets used as templater.wrapper()
|
|
3348
|
+
*/
|
|
3350
3349
|
function getTagWrap(templater, madeSubject) {
|
|
3350
|
+
// this function gets called by taggedjs
|
|
3351
3351
|
const innerTagWrap = function (oldTagSetup, subject) {
|
|
3352
|
-
const global = oldTagSetup.
|
|
3353
|
-
global.newestTemplater = templater;
|
|
3352
|
+
const global = oldTagSetup.global;
|
|
3354
3353
|
++global.renderCount;
|
|
3355
|
-
templater.global = global;
|
|
3356
3354
|
const childSubject = templater.children;
|
|
3357
|
-
const lastArray = global.oldest?.
|
|
3355
|
+
const lastArray = global.oldest?.templater.children.lastArray;
|
|
3358
3356
|
if (lastArray) {
|
|
3359
3357
|
childSubject.lastArray = lastArray;
|
|
3360
3358
|
}
|
|
3361
3359
|
const originalFunction = innerTagWrap.original;
|
|
3362
|
-
// const oldTagSetup = templater.tagSupport
|
|
3363
|
-
const oldest = templater.global.oldest;
|
|
3364
|
-
if (oldest && !oldest.hasLiveElements) {
|
|
3365
|
-
throw new Error('issue already 22');
|
|
3366
|
-
}
|
|
3367
3360
|
let props = templater.props;
|
|
3368
|
-
|
|
3369
|
-
const oldTemplater = ownerTagSupport?.templater;
|
|
3370
|
-
const oldLatest = oldTemplater?.global.newest;
|
|
3371
|
-
const newestOwnerTemplater = oldLatest?.tagSupport.templater;
|
|
3372
|
-
if (oldLatest && !newestOwnerTemplater) {
|
|
3373
|
-
throw new Error('what to do here?');
|
|
3374
|
-
}
|
|
3375
|
-
let castedProps = (0,_alterProps_function__WEBPACK_IMPORTED_MODULE_6__.alterProps)(props, newestOwnerTemplater, oldTagSetup.ownerTagSupport);
|
|
3361
|
+
let castedProps = (0,_alterProps_function__WEBPACK_IMPORTED_MODULE_6__.alterProps)(props, oldTagSetup.ownerTagSupport);
|
|
3376
3362
|
const clonedProps = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_4__.deepClone)(props); // castedProps
|
|
3377
3363
|
// CALL ORIGINAL COMPONENT FUNCTION
|
|
3378
3364
|
const tag = originalFunction(castedProps, childSubject);
|
|
3379
|
-
tag.
|
|
3380
|
-
tag
|
|
3381
|
-
|
|
3382
|
-
|
|
3365
|
+
tag.templater = templater;
|
|
3366
|
+
templater.tag = tag;
|
|
3367
|
+
const tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_5__.TagSupport(templater, oldTagSetup.ownerTagSupport, subject, global.renderCount);
|
|
3368
|
+
tagSupport.global = global;
|
|
3369
|
+
tagSupport.propsConfig = {
|
|
3370
|
+
latest: props,
|
|
3383
3371
|
latestCloned: clonedProps,
|
|
3384
|
-
|
|
3385
|
-
lastClonedKidValues: tag.tagSupport.propsConfig.lastClonedKidValues,
|
|
3372
|
+
lastClonedKidValues: tagSupport.propsConfig.lastClonedKidValues,
|
|
3386
3373
|
};
|
|
3387
|
-
|
|
3374
|
+
tagSupport.memory = oldTagSetup.memory; // state handover
|
|
3388
3375
|
if (madeSubject) {
|
|
3389
3376
|
childSubject.value.forEach(kid => {
|
|
3390
3377
|
kid.values.forEach((value, index) => {
|
|
@@ -3397,16 +3384,16 @@ function getTagWrap(templater, madeSubject) {
|
|
|
3397
3384
|
}
|
|
3398
3385
|
// all functions need to report to me
|
|
3399
3386
|
kid.values[index] = function (...args) {
|
|
3400
|
-
const
|
|
3401
|
-
(0,
|
|
3402
|
-
|
|
3387
|
+
const ownerSupport = tagSupport.ownerTagSupport;
|
|
3388
|
+
(0,_interpolations_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_3__.runTagCallback)(value, // callback
|
|
3389
|
+
ownerSupport, this, // bindTo
|
|
3403
3390
|
args);
|
|
3404
3391
|
};
|
|
3405
3392
|
valuesValue.isChildOverride = true;
|
|
3406
3393
|
});
|
|
3407
3394
|
});
|
|
3408
3395
|
}
|
|
3409
|
-
return
|
|
3396
|
+
return tagSupport;
|
|
3410
3397
|
};
|
|
3411
3398
|
return innerTagWrap;
|
|
3412
3399
|
}
|
|
@@ -3422,7 +3409,7 @@ function getTagWrap(templater, madeSubject) {
|
|
|
3422
3409
|
|
|
3423
3410
|
__webpack_require__.r(__webpack_exports__);
|
|
3424
3411
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3425
|
-
/* harmony export */
|
|
3412
|
+
/* harmony export */ runWrapper: () => (/* binding */ runWrapper),
|
|
3426
3413
|
/* harmony export */ tagElement: () => (/* binding */ tagElement)
|
|
3427
3414
|
/* harmony export */ });
|
|
3428
3415
|
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
@@ -3436,7 +3423,7 @@ function tagElement(app, // (...args: unknown[]) => TemplaterResult,
|
|
|
3436
3423
|
element, props) {
|
|
3437
3424
|
const appElmIndex = appElements.findIndex(appElm => appElm.element === element);
|
|
3438
3425
|
if (appElmIndex >= 0) {
|
|
3439
|
-
appElements[appElmIndex].
|
|
3426
|
+
appElements[appElmIndex].tagSupport.destroy();
|
|
3440
3427
|
appElements.splice(appElmIndex, 1);
|
|
3441
3428
|
// an element already had an app on it
|
|
3442
3429
|
console.warn('Found and destroyed app element already rendered to element', { element });
|
|
@@ -3444,37 +3431,37 @@ element, props) {
|
|
|
3444
3431
|
// Create the app which returns [props, runOneTimeFunction]
|
|
3445
3432
|
const wrapper = app(props);
|
|
3446
3433
|
// have a function setup and call the tagWrapper with (props, {update, async, on})
|
|
3447
|
-
const
|
|
3448
|
-
const { tag } = result;
|
|
3434
|
+
const tagSupport = runWrapper(wrapper);
|
|
3449
3435
|
// TODO: is the below needed?
|
|
3450
|
-
|
|
3451
|
-
|
|
3436
|
+
tagSupport.appElement = element;
|
|
3437
|
+
tagSupport.isApp = true;
|
|
3438
|
+
tagSupport.global.isApp = true;
|
|
3452
3439
|
const templateElm = document.createElement('template');
|
|
3453
3440
|
templateElm.setAttribute('id', 'app-tag-' + appElements.length);
|
|
3454
3441
|
templateElm.setAttribute('app-tag-detail', appElements.length.toString());
|
|
3455
3442
|
element.appendChild(templateElm);
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
if (!tag.hasLiveElements) {
|
|
3460
|
-
throw new Error('x');
|
|
3461
|
-
}
|
|
3462
|
-
;
|
|
3443
|
+
tagSupport.buildBeforeElement(templateElm);
|
|
3444
|
+
tagSupport.global.oldest = tagSupport;
|
|
3445
|
+
tagSupport.global.newest = tagSupport;
|
|
3463
3446
|
element.setUse = app.original.setUse;
|
|
3464
|
-
appElements.push({ element,
|
|
3465
|
-
return {
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3447
|
+
appElements.push({ element, tagSupport });
|
|
3448
|
+
return {
|
|
3449
|
+
tagSupport,
|
|
3450
|
+
tags: app.original.tags,
|
|
3451
|
+
};
|
|
3452
|
+
}
|
|
3453
|
+
function runWrapper(templater) {
|
|
3454
|
+
let newSupport = {};
|
|
3455
|
+
const subject = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_2__.ValueSubject(newSupport);
|
|
3456
|
+
newSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__.BaseTagSupport(templater, subject);
|
|
3457
|
+
subject.set(templater);
|
|
3458
|
+
subject.tagSupport = newSupport;
|
|
3459
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_1__.runBeforeRender)(newSupport, undefined);
|
|
3472
3460
|
// Call the apps function for our tag templater
|
|
3473
|
-
const
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
return { tag, tagSupport };
|
|
3461
|
+
const wrapper = templater.wrapper;
|
|
3462
|
+
const tagSupport = wrapper(newSupport, subject);
|
|
3463
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_1__.runAfterRender)(newSupport, tagSupport);
|
|
3464
|
+
return tagSupport;
|
|
3478
3465
|
}
|
|
3479
3466
|
|
|
3480
3467
|
|
|
@@ -3491,26 +3478,36 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3491
3478
|
/* harmony export */ runAfterRender: () => (/* binding */ runAfterRender),
|
|
3492
3479
|
/* harmony export */ runBeforeDestroy: () => (/* binding */ runBeforeDestroy),
|
|
3493
3480
|
/* harmony export */ runBeforeRedraw: () => (/* binding */ runBeforeRedraw),
|
|
3494
|
-
/* harmony export */ runBeforeRender: () => (/* binding */ runBeforeRender)
|
|
3481
|
+
/* harmony export */ runBeforeRender: () => (/* binding */ runBeforeRender),
|
|
3482
|
+
/* harmony export */ tagClosed$: () => (/* binding */ tagClosed$)
|
|
3495
3483
|
/* harmony export */ });
|
|
3496
3484
|
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./state */ "./ts/state/index.ts");
|
|
3485
|
+
/* harmony import */ var _subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./subject */ "./ts/subject/index.ts");
|
|
3497
3486
|
// TODO: This should be more like `new TaggedJs().use({})`
|
|
3498
3487
|
|
|
3488
|
+
|
|
3489
|
+
// Emits event at the end of a tag being rendered. Use tagClosed$.toPromise() to render a tag after a current tag is done rendering
|
|
3490
|
+
const tagClosed$ = new _subject__WEBPACK_IMPORTED_MODULE_1__.Subject(undefined, subscription => {
|
|
3491
|
+
if (!_state__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.stateConfig.rearray) {
|
|
3492
|
+
subscription.next(); // we are not currently processing so process now
|
|
3493
|
+
}
|
|
3494
|
+
});
|
|
3499
3495
|
// Life cycle 1
|
|
3500
|
-
function runBeforeRender(tagSupport,
|
|
3501
|
-
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeRender(tagSupport,
|
|
3496
|
+
function runBeforeRender(tagSupport, ownerSupport) {
|
|
3497
|
+
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeRender(tagSupport, ownerSupport));
|
|
3502
3498
|
}
|
|
3503
3499
|
// Life cycle 2
|
|
3504
|
-
function runAfterRender(tagSupport,
|
|
3505
|
-
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.afterRender(tagSupport,
|
|
3500
|
+
function runAfterRender(tagSupport, ownerTagSupport) {
|
|
3501
|
+
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.afterRender(tagSupport, ownerTagSupport));
|
|
3502
|
+
tagClosed$.next(ownerTagSupport);
|
|
3506
3503
|
}
|
|
3507
3504
|
// Life cycle 3
|
|
3508
|
-
function runBeforeRedraw(tagSupport,
|
|
3509
|
-
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeRedraw(tagSupport,
|
|
3505
|
+
function runBeforeRedraw(tagSupport, ownerTagSupport) {
|
|
3506
|
+
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeRedraw(tagSupport, ownerTagSupport));
|
|
3510
3507
|
}
|
|
3511
3508
|
// Life cycle 4 - end of life
|
|
3512
|
-
function runBeforeDestroy(tagSupport,
|
|
3513
|
-
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeDestroy(tagSupport,
|
|
3509
|
+
function runBeforeDestroy(tagSupport, ownerTagSupport) {
|
|
3510
|
+
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeDestroy(tagSupport, ownerTagSupport));
|
|
3514
3511
|
}
|
|
3515
3512
|
|
|
3516
3513
|
|
|
@@ -3543,6 +3540,64 @@ function updateBeforeTemplate(value, lastFirstChild) {
|
|
|
3543
3540
|
}
|
|
3544
3541
|
|
|
3545
3542
|
|
|
3543
|
+
/***/ }),
|
|
3544
|
+
|
|
3545
|
+
/***/ "./ts/updateContextItem.function.ts":
|
|
3546
|
+
/*!******************************************!*\
|
|
3547
|
+
!*** ./ts/updateContextItem.function.ts ***!
|
|
3548
|
+
\******************************************/
|
|
3549
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3550
|
+
|
|
3551
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3552
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3553
|
+
/* harmony export */ updateContextItem: () => (/* binding */ updateContextItem)
|
|
3554
|
+
/* harmony export */ });
|
|
3555
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
3556
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3557
|
+
|
|
3558
|
+
|
|
3559
|
+
function updateContextItem(context, variableName, value) {
|
|
3560
|
+
const subject = context[variableName];
|
|
3561
|
+
const tagSubject = subject;
|
|
3562
|
+
const tagSupport = tagSubject.tagSupport;
|
|
3563
|
+
if (tagSupport) {
|
|
3564
|
+
if (value) {
|
|
3565
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagComponent)(value)) {
|
|
3566
|
+
const templater = value;
|
|
3567
|
+
let newSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_1__.TagSupport(templater, tagSupport.ownerTagSupport, subject);
|
|
3568
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagComponent)(tagSupport)) {
|
|
3569
|
+
shareTemplaterGlobal(tagSupport, newSupport);
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isSubjectInstance)(value)) {
|
|
3575
|
+
return;
|
|
3576
|
+
}
|
|
3577
|
+
// listeners will evaluate updated values to possibly update display(s)
|
|
3578
|
+
subject.set(value);
|
|
3579
|
+
return;
|
|
3580
|
+
}
|
|
3581
|
+
function shareTemplaterGlobal(oldTagSupport, tagSupport) {
|
|
3582
|
+
const oldTemp = oldTagSupport.templater;
|
|
3583
|
+
const oldWrap = oldTemp.wrapper; // tag versus component
|
|
3584
|
+
const oldValueFn = oldWrap.original;
|
|
3585
|
+
const templater = tagSupport.templater;
|
|
3586
|
+
const newWrapper = templater.wrapper;
|
|
3587
|
+
const newValueFn = newWrapper?.original;
|
|
3588
|
+
const fnMatched = oldValueFn === newValueFn;
|
|
3589
|
+
if (fnMatched) {
|
|
3590
|
+
tagSupport.global = oldTagSupport.global;
|
|
3591
|
+
// ??? new mirroring transfer state
|
|
3592
|
+
const newest = oldTagSupport.global.newest;
|
|
3593
|
+
if (newest) {
|
|
3594
|
+
const prevState = newest.memory.state;
|
|
3595
|
+
tagSupport.memory.state = [...prevState];
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3600
|
+
|
|
3546
3601
|
/***/ }),
|
|
3547
3602
|
|
|
3548
3603
|
/***/ "./ts/updateExistingTagComponent.function.ts":
|
|
@@ -3560,139 +3615,102 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3560
3615
|
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
3561
3616
|
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
3562
3617
|
/* harmony import */ var _alterProps_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./alterProps.function */ "./ts/alterProps.function.ts");
|
|
3618
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
3563
3619
|
|
|
3564
3620
|
|
|
3565
3621
|
|
|
3566
3622
|
|
|
3567
3623
|
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3624
|
+
|
|
3625
|
+
function updateExistingTagComponent(ownerSupport, tagSupport, // lastest
|
|
3626
|
+
subject, insertBefore) {
|
|
3627
|
+
// ??? changed during mirroring
|
|
3628
|
+
// let lastSupport = subject.tagSupport
|
|
3629
|
+
let lastSupport = subject.tagSupport?.global.newest; // || subject.tagSupport
|
|
3630
|
+
let oldestTag = lastSupport.global.oldest;
|
|
3631
|
+
const oldWrapper = lastSupport.templater.wrapper;
|
|
3632
|
+
const newWrapper = tagSupport.templater.wrapper;
|
|
3572
3633
|
let isSameTag = false;
|
|
3573
3634
|
if (oldWrapper && newWrapper) {
|
|
3574
3635
|
const oldFunction = oldWrapper.original;
|
|
3575
3636
|
const newFunction = newWrapper.original;
|
|
3576
3637
|
isSameTag = oldFunction === newFunction;
|
|
3577
3638
|
}
|
|
3578
|
-
const
|
|
3579
|
-
const oldGlobal = oldTagSupport.templater.global;
|
|
3580
|
-
// const placeholderElm = ownerTag.tagSupport.templater.global.placeholderElm
|
|
3581
|
-
const placeholderElm = oldGlobal.placeholder;
|
|
3582
|
-
if (placeholderElm) {
|
|
3583
|
-
if (!placeholderElm.parentNode) {
|
|
3584
|
-
throw new Error('stop here no subject parent node update existing tag');
|
|
3585
|
-
}
|
|
3586
|
-
}
|
|
3639
|
+
const templater = tagSupport.templater;
|
|
3587
3640
|
if (!isSameTag) {
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
insertBefore, // oldInsertBefore,
|
|
3592
|
-
ownerTag, {
|
|
3641
|
+
const oldestSupport = lastSupport.global.oldest;
|
|
3642
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(oldestSupport, subject);
|
|
3643
|
+
return (0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_1__.processSubjectComponent)(templater, subject, insertBefore, ownerSupport, {
|
|
3593
3644
|
forceElement: false,
|
|
3594
3645
|
counts: { added: 0, removed: 0 },
|
|
3595
3646
|
});
|
|
3596
3647
|
}
|
|
3597
3648
|
else {
|
|
3598
|
-
const
|
|
3599
|
-
const hasChanged = (0,_hasTagSupportChanged_function__WEBPACK_IMPORTED_MODULE_0__.hasTagSupportChanged)(oldTagSupport, newTagSupport, templater);
|
|
3649
|
+
const hasChanged = (0,_hasTagSupportChanged_function__WEBPACK_IMPORTED_MODULE_0__.hasTagSupportChanged)(lastSupport, tagSupport, templater);
|
|
3600
3650
|
if (!hasChanged) {
|
|
3601
3651
|
// if the new props are an object then implicitly since no change, the old props are an object
|
|
3602
3652
|
const newProps = templater.props;
|
|
3603
3653
|
if (newProps && typeof (newProps) === 'object') {
|
|
3604
|
-
|
|
3605
|
-
// const oldProps = existingTag.tagSupport.propsConfig.latestCloned as Record<string,any> // newestTag.props as Record<string, any>
|
|
3606
|
-
syncFunctionProps(templater, existingTag, ownerTag, newProps);
|
|
3654
|
+
syncFunctionProps(lastSupport, ownerSupport, newProps);
|
|
3607
3655
|
}
|
|
3608
|
-
return
|
|
3656
|
+
return lastSupport; // its the same tag component
|
|
3609
3657
|
}
|
|
3610
3658
|
}
|
|
3611
|
-
const
|
|
3612
|
-
const
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
}
|
|
3616
|
-
const newTag = (0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_3__.renderTagSupport)(templater.tagSupport, false);
|
|
3617
|
-
existingTag = subject.tag;
|
|
3618
|
-
const newOldest = newTag.tagSupport.templater.global.oldest;
|
|
3659
|
+
const previous = lastSupport.global.newest;
|
|
3660
|
+
const newSupport = (0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_3__.renderTagSupport)(tagSupport, false);
|
|
3661
|
+
lastSupport = subject.tagSupport;
|
|
3662
|
+
const newOldest = newSupport.global.oldest;
|
|
3619
3663
|
const hasOldest = newOldest ? true : false;
|
|
3620
3664
|
if (!hasOldest) {
|
|
3621
|
-
return buildNewTag(
|
|
3622
|
-
// ??? newly changed
|
|
3623
|
-
insertBefore, // oldInsertBefore,
|
|
3624
|
-
oldTagSupport, subject);
|
|
3665
|
+
return buildNewTag(newSupport, insertBefore, lastSupport, subject);
|
|
3625
3666
|
}
|
|
3626
3667
|
if (newOldest && templater.children.value.length) {
|
|
3627
|
-
const oldKidsSub = newOldest.
|
|
3668
|
+
const oldKidsSub = newOldest.templater.children;
|
|
3628
3669
|
oldKidsSub.set(templater.children.value);
|
|
3629
3670
|
}
|
|
3630
|
-
// const newTag = tempResult.newest as Tag
|
|
3631
|
-
if (previous && !oldestTag) {
|
|
3632
|
-
throw new Error('bad elders');
|
|
3633
|
-
}
|
|
3634
3671
|
// detect if both the function is the same and the return is the same
|
|
3635
|
-
const isLikeTag = isSameTag &&
|
|
3636
|
-
if (previous && !oldestTag) {
|
|
3637
|
-
throw new Error('bad elders');
|
|
3638
|
-
}
|
|
3639
|
-
let oldest = oldTagSupport.templater.global.oldest;
|
|
3672
|
+
const isLikeTag = isSameTag && (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_5__.isLikeTags)(previous, newSupport);
|
|
3640
3673
|
if (isLikeTag) {
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
subject.tag = newTag;
|
|
3645
|
-
oldestTag.updateByTag(newTag); // the oldest tag has element references
|
|
3646
|
-
return newTag;
|
|
3674
|
+
subject.tagSupport = newSupport;
|
|
3675
|
+
oldestTag.updateBy(newSupport); // the oldest tag has element references
|
|
3676
|
+
return newSupport;
|
|
3647
3677
|
}
|
|
3648
3678
|
else {
|
|
3649
3679
|
// Although function looked the same it returned a different html result
|
|
3650
|
-
if (isSameTag &&
|
|
3651
|
-
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(
|
|
3652
|
-
|
|
3680
|
+
if (isSameTag && lastSupport) {
|
|
3681
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(lastSupport, subject);
|
|
3682
|
+
newSupport.global.context = {}; // do not share previous outputs
|
|
3653
3683
|
}
|
|
3654
|
-
|
|
3684
|
+
oldestTag = undefined;
|
|
3655
3685
|
}
|
|
3656
|
-
if (!
|
|
3657
|
-
|
|
3686
|
+
if (!oldestTag) {
|
|
3687
|
+
lastSupport = newSupport;
|
|
3688
|
+
buildNewTag(newSupport, lastSupport.global.insertBefore, lastSupport, subject);
|
|
3658
3689
|
}
|
|
3659
|
-
|
|
3660
|
-
return
|
|
3661
|
-
}
|
|
3662
|
-
function checkStateChanged(state) {
|
|
3663
|
-
return !state.newest.every(state => {
|
|
3664
|
-
const lastValue = state.lastValue;
|
|
3665
|
-
const nowValue = state.get();
|
|
3666
|
-
const matched = lastValue === nowValue;
|
|
3667
|
-
if (matched) {
|
|
3668
|
-
return true;
|
|
3669
|
-
}
|
|
3670
|
-
return false;
|
|
3671
|
-
});
|
|
3690
|
+
lastSupport.global.newest = newSupport;
|
|
3691
|
+
return newSupport;
|
|
3672
3692
|
}
|
|
3673
|
-
function buildNewTag(
|
|
3674
|
-
|
|
3693
|
+
function buildNewTag(newSupport, oldInsertBefore, oldTagSupport, subject) {
|
|
3694
|
+
newSupport.buildBeforeElement(oldInsertBefore, {
|
|
3675
3695
|
forceElement: true,
|
|
3676
3696
|
counts: { added: 0, removed: 0 },
|
|
3677
3697
|
});
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
oldTagSupport.
|
|
3681
|
-
oldTagSupport.
|
|
3682
|
-
subject.
|
|
3683
|
-
return
|
|
3684
|
-
}
|
|
3685
|
-
function syncFunctionProps(
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
const priorProps =
|
|
3689
|
-
const
|
|
3690
|
-
const ownerSupport = oldLatest.tagSupport;
|
|
3698
|
+
newSupport.global.oldest = newSupport;
|
|
3699
|
+
newSupport.global.newest = newSupport;
|
|
3700
|
+
oldTagSupport.global.oldest = newSupport;
|
|
3701
|
+
oldTagSupport.global.newest = newSupport;
|
|
3702
|
+
subject.tagSupport = newSupport;
|
|
3703
|
+
return newSupport;
|
|
3704
|
+
}
|
|
3705
|
+
function syncFunctionProps(lastSupport, ownerSupport, newProps) {
|
|
3706
|
+
lastSupport = lastSupport.global.newest || lastSupport;
|
|
3707
|
+
const priorPropConfig = lastSupport.propsConfig;
|
|
3708
|
+
const priorProps = priorPropConfig.latestCloned;
|
|
3709
|
+
const prevSupport = ownerSupport.global.newest;
|
|
3691
3710
|
Object.entries(priorProps).forEach(([name, value]) => {
|
|
3692
3711
|
if (!(value instanceof Function)) {
|
|
3693
3712
|
return;
|
|
3694
3713
|
}
|
|
3695
|
-
const newOriginal = value.original;
|
|
3696
3714
|
// TODO: The code below maybe irrelevant
|
|
3697
3715
|
const newCallback = newProps[name];
|
|
3698
3716
|
const original = newCallback.original;
|
|
@@ -3702,7 +3720,7 @@ function syncFunctionProps(templater, existingTag, ownerTag, newProps) {
|
|
|
3702
3720
|
// Currently, call self but over parent state changes, I may need to call a newer parent tag owner
|
|
3703
3721
|
priorProps[name].toCall = (...args) => {
|
|
3704
3722
|
return (0,_alterProps_function__WEBPACK_IMPORTED_MODULE_4__.callbackPropOwner)(newCallback, // value, // newOriginal,
|
|
3705
|
-
args,
|
|
3723
|
+
args, prevSupport);
|
|
3706
3724
|
};
|
|
3707
3725
|
return;
|
|
3708
3726
|
});
|
|
@@ -3722,15 +3740,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3722
3740
|
/* harmony export */ updateExistingValue: () => (/* binding */ updateExistingValue)
|
|
3723
3741
|
/* harmony export */ });
|
|
3724
3742
|
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3725
|
-
/* harmony import */ var
|
|
3726
|
-
/* harmony import */ var
|
|
3727
|
-
/* harmony import */ var
|
|
3728
|
-
/* harmony import */ var
|
|
3729
|
-
/* harmony import */ var
|
|
3730
|
-
/* harmony import */ var
|
|
3731
|
-
/* harmony import */ var
|
|
3732
|
-
/* harmony import */ var
|
|
3733
|
-
/* harmony import */ var
|
|
3743
|
+
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
3744
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
3745
|
+
/* harmony import */ var _processTagArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processTagArray */ "./ts/processTagArray.ts");
|
|
3746
|
+
/* harmony import */ var _updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./updateExistingTagComponent.function */ "./ts/updateExistingTagComponent.function.ts");
|
|
3747
|
+
/* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/processRegularValue.function.ts");
|
|
3748
|
+
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./checkDestroyPrevious.function */ "./ts/checkDestroyPrevious.function.ts");
|
|
3749
|
+
/* harmony import */ var _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./subject/ValueSubject */ "./ts/subject/ValueSubject.ts");
|
|
3750
|
+
/* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/processSubjectComponent.function.ts");
|
|
3751
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
3752
|
+
/* harmony import */ var _interpolations_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./interpolations/bindSubjectCallback.function */ "./ts/interpolations/bindSubjectCallback.function.ts");
|
|
3753
|
+
/* harmony import */ var _processTag_function__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./processTag.function */ "./ts/processTag.function.ts");
|
|
3754
|
+
/* harmony import */ var _insertAfter_function__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./insertAfter.function */ "./ts/insertAfter.function.ts");
|
|
3755
|
+
|
|
3756
|
+
|
|
3734
3757
|
|
|
3735
3758
|
|
|
3736
3759
|
|
|
@@ -3741,88 +3764,130 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3741
3764
|
|
|
3742
3765
|
|
|
3743
3766
|
|
|
3744
|
-
|
|
3767
|
+
|
|
3768
|
+
function updateExistingValue(subject, value, ownerSupport, insertBefore) {
|
|
3745
3769
|
const subjectTag = subject;
|
|
3746
|
-
const isComponent = (0,
|
|
3747
|
-
(0,
|
|
3770
|
+
const isComponent = (0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagComponent)(value);
|
|
3771
|
+
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_6__.checkDestroyPrevious)(subject, value, insertBefore);
|
|
3748
3772
|
// handle already seen tag components
|
|
3749
3773
|
if (isComponent) {
|
|
3750
|
-
|
|
3751
|
-
// When was something before component
|
|
3752
|
-
if (!subjectTag.tag) {
|
|
3753
|
-
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_6__.processSubjectComponent)(templater, subjectTag, insertBefore, // oldInsertBefore as InsertBefore,
|
|
3754
|
-
ownerTag, {
|
|
3755
|
-
forceElement: true,
|
|
3756
|
-
counts: { added: 0, removed: 0 },
|
|
3757
|
-
});
|
|
3758
|
-
return subjectTag;
|
|
3759
|
-
}
|
|
3760
|
-
templater.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__.TagSupport(
|
|
3761
|
-
// subjectTag.tag.tagSupport.ownerTagSupport,
|
|
3762
|
-
ownerTag.tagSupport, templater, subjectTag);
|
|
3763
|
-
(0,_updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_3__.updateExistingTagComponent)(ownerTag, templater, // latest value
|
|
3764
|
-
subjectTag, insertBefore);
|
|
3765
|
-
return subjectTag;
|
|
3774
|
+
return prepareUpdateToComponent(value, subjectTag, insertBefore, ownerSupport);
|
|
3766
3775
|
}
|
|
3767
3776
|
// was component but no longer
|
|
3768
|
-
const
|
|
3769
|
-
if (
|
|
3770
|
-
handleStillTag(
|
|
3777
|
+
const tagSupport = subjectTag.tagSupport;
|
|
3778
|
+
if (tagSupport) {
|
|
3779
|
+
handleStillTag(subject, value, ownerSupport);
|
|
3771
3780
|
return subjectTag;
|
|
3772
3781
|
}
|
|
3773
3782
|
// its another tag array
|
|
3774
|
-
if ((0,
|
|
3775
|
-
(0,
|
|
3776
|
-
|
|
3783
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagArray)(value)) {
|
|
3784
|
+
(0,_processTagArray__WEBPACK_IMPORTED_MODULE_3__.processTagArray)(subject, value, insertBefore, // oldInsertBefore as InsertBefore,
|
|
3785
|
+
ownerSupport, { counts: {
|
|
3777
3786
|
added: 0,
|
|
3778
3787
|
removed: 0,
|
|
3779
3788
|
} });
|
|
3780
3789
|
return subject;
|
|
3781
3790
|
}
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
const bound = (0,_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_8__.bindSubjectCallback)(value, ownerTag);
|
|
3786
|
-
subject.set(bound);
|
|
3787
|
-
return subject;
|
|
3791
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagTemplater)(value)) {
|
|
3792
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_11__.processTag)(value, insertBefore, ownerSupport, subjectTag);
|
|
3793
|
+
return subjectTag;
|
|
3788
3794
|
}
|
|
3789
|
-
if ((0,
|
|
3790
|
-
|
|
3791
|
-
|
|
3795
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagClass)(value)) {
|
|
3796
|
+
const tag = value;
|
|
3797
|
+
let templater = tag.templater;
|
|
3798
|
+
if (!templater) {
|
|
3799
|
+
templater = (0,_processTag_function__WEBPACK_IMPORTED_MODULE_11__.getFakeTemplater)();
|
|
3800
|
+
tag.templater = templater;
|
|
3801
|
+
templater.tag = tag;
|
|
3792
3802
|
}
|
|
3793
|
-
(0,
|
|
3803
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_11__.processTag)(templater, insertBefore, ownerSupport, subjectTag);
|
|
3794
3804
|
return subjectTag;
|
|
3795
3805
|
}
|
|
3796
3806
|
// we have been given a subject
|
|
3797
|
-
if ((0,
|
|
3807
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isSubjectInstance)(value)) {
|
|
3798
3808
|
return value;
|
|
3799
3809
|
}
|
|
3810
|
+
// now its a function
|
|
3811
|
+
if (value instanceof Function) {
|
|
3812
|
+
const bound = (0,_interpolations_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_10__.bindSubjectCallback)(value, ownerSupport);
|
|
3813
|
+
subject.set(bound);
|
|
3814
|
+
return subject;
|
|
3815
|
+
}
|
|
3800
3816
|
// This will cause all other values to render
|
|
3801
|
-
(0,
|
|
3802
|
-
// ??? - changed to insertBefore for tag switching with template removal
|
|
3803
|
-
insertBefore // oldInsertBefore as InsertBefore,
|
|
3804
|
-
);
|
|
3817
|
+
(0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__.processRegularValue)(value, subject, insertBefore);
|
|
3805
3818
|
return subjectTag;
|
|
3806
3819
|
}
|
|
3807
|
-
function handleStillTag(
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
const
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3820
|
+
function handleStillTag(subject, value, ownerSupport) {
|
|
3821
|
+
const lastSupport = subject.tagSupport;
|
|
3822
|
+
let templater = value;
|
|
3823
|
+
const isClass = (0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagClass)(value);
|
|
3824
|
+
if (isClass) {
|
|
3825
|
+
const tag = value;
|
|
3826
|
+
templater = tag.templater;
|
|
3827
|
+
if (!templater) {
|
|
3828
|
+
const children = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_7__.ValueSubject([]);
|
|
3829
|
+
templater = new _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__.TemplaterResult(undefined, children);
|
|
3830
|
+
templater.tag = tag;
|
|
3831
|
+
tag.templater = templater;
|
|
3832
|
+
}
|
|
3833
|
+
}
|
|
3834
|
+
const valueSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__.TagSupport(templater, ownerSupport, subject);
|
|
3835
|
+
if (isClass) {
|
|
3836
|
+
valueSupport.global = lastSupport.global;
|
|
3837
|
+
}
|
|
3838
|
+
const isSameTag = value && (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_9__.isLikeTags)(lastSupport, valueSupport);
|
|
3839
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagTemplater)(value)) {
|
|
3840
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_11__.setupNewTemplater)(valueSupport, ownerSupport, subject);
|
|
3814
3841
|
}
|
|
3815
3842
|
if (isSameTag) {
|
|
3816
|
-
|
|
3843
|
+
lastSupport.updateBy(valueSupport);
|
|
3817
3844
|
return;
|
|
3818
3845
|
}
|
|
3819
|
-
if (isSameTag
|
|
3820
|
-
const subjectTag = subject
|
|
3821
|
-
const global =
|
|
3846
|
+
if (isSameTag) {
|
|
3847
|
+
// const subjectTag = subject as TagSubject
|
|
3848
|
+
const global = lastSupport.global;
|
|
3822
3849
|
const insertBefore = global.insertBefore;
|
|
3823
|
-
return (0,
|
|
3850
|
+
return (0,_processTag_function__WEBPACK_IMPORTED_MODULE_11__.processTag)(templater, insertBefore, ownerSupport, subject);
|
|
3824
3851
|
}
|
|
3825
|
-
return (0,
|
|
3852
|
+
return (0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__.processRegularValue)(value, subject, subject.insertBefore);
|
|
3853
|
+
}
|
|
3854
|
+
function prepareUpdateToComponent(templater, subjectTag, insertBefore, ownerSupport) {
|
|
3855
|
+
// When was something before component
|
|
3856
|
+
if (!subjectTag.tagSupport) {
|
|
3857
|
+
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_8__.processSubjectComponent)(templater, subjectTag, insertBefore, // oldInsertBefore as InsertBefore,
|
|
3858
|
+
ownerSupport, {
|
|
3859
|
+
forceElement: true,
|
|
3860
|
+
counts: { added: 0, removed: 0 },
|
|
3861
|
+
});
|
|
3862
|
+
return subjectTag;
|
|
3863
|
+
}
|
|
3864
|
+
const tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__.TagSupport(templater, ownerSupport, subjectTag);
|
|
3865
|
+
// ??? new mirroring
|
|
3866
|
+
const subjectSup = subjectTag.tagSupport;
|
|
3867
|
+
// const prevSupport = (subjectSup.global.newest || subjectSup) as TagSupport
|
|
3868
|
+
const prevSupport = subjectSup.global.newest;
|
|
3869
|
+
if (prevSupport) {
|
|
3870
|
+
const newestState = prevSupport.memory.state;
|
|
3871
|
+
tagSupport.memory.state = [...newestState];
|
|
3872
|
+
}
|
|
3873
|
+
else {
|
|
3874
|
+
const placeholder = subjectSup.global.placeholder;
|
|
3875
|
+
if (placeholder && !insertBefore.parentNode) {
|
|
3876
|
+
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_12__.insertAfter)(insertBefore, placeholder);
|
|
3877
|
+
delete subjectSup.global.placeholder;
|
|
3878
|
+
}
|
|
3879
|
+
// insertBefore = subjectSup.global.placeholder || insertBefore
|
|
3880
|
+
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_8__.processSubjectComponent)(templater, subjectTag, insertBefore, ownerSupport, {
|
|
3881
|
+
forceElement: true,
|
|
3882
|
+
counts: { added: 0, removed: 0 },
|
|
3883
|
+
});
|
|
3884
|
+
return subjectTag;
|
|
3885
|
+
}
|
|
3886
|
+
tagSupport.global = subjectSup.global;
|
|
3887
|
+
subjectTag.tagSupport = tagSupport;
|
|
3888
|
+
(0,_updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_4__.updateExistingTagComponent)(ownerSupport, tagSupport, // latest value
|
|
3889
|
+
subjectTag, insertBefore);
|
|
3890
|
+
return subjectTag;
|
|
3826
3891
|
}
|
|
3827
3892
|
|
|
3828
3893
|
|
|
@@ -3905,16 +3970,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3905
3970
|
/* harmony export */ combineLatest: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.combineLatest),
|
|
3906
3971
|
/* harmony export */ hmr: () => (/* binding */ hmr),
|
|
3907
3972
|
/* harmony export */ html: () => (/* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_3__.html),
|
|
3908
|
-
/* harmony export */ interpolateElement: () => (/* reexport safe */
|
|
3909
|
-
/* harmony export */ interpolateString: () => (/* reexport safe */
|
|
3973
|
+
/* harmony export */ interpolateElement: () => (/* reexport safe */ _interpolations_interpolateElement__WEBPACK_IMPORTED_MODULE_9__.interpolateElement),
|
|
3974
|
+
/* harmony export */ interpolateString: () => (/* reexport safe */ _interpolations_interpolateElement__WEBPACK_IMPORTED_MODULE_9__.interpolateString),
|
|
3910
3975
|
/* harmony export */ isSubjectInstance: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isSubjectInstance),
|
|
3976
|
+
/* harmony export */ isTag: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTag),
|
|
3911
3977
|
/* harmony export */ isTagArray: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagArray),
|
|
3978
|
+
/* harmony export */ isTagClass: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagClass),
|
|
3912
3979
|
/* harmony export */ isTagComponent: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagComponent),
|
|
3913
|
-
/* harmony export */
|
|
3980
|
+
/* harmony export */ isTagTemplater: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagTemplater),
|
|
3914
3981
|
/* harmony export */ letState: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.letState),
|
|
3915
3982
|
/* harmony export */ onDestroy: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.onDestroy),
|
|
3916
3983
|
/* harmony export */ onInit: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.onInit),
|
|
3917
3984
|
/* harmony export */ providers: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.providers),
|
|
3985
|
+
/* harmony export */ renderTagSupport: () => (/* reexport safe */ _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_12__.renderTagSupport),
|
|
3918
3986
|
/* harmony export */ runBeforeRender: () => (/* reexport safe */ _tagRunner__WEBPACK_IMPORTED_MODULE_11__.runBeforeRender),
|
|
3919
3987
|
/* harmony export */ setProp: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.setProp),
|
|
3920
3988
|
/* harmony export */ setUse: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.setUse),
|
|
@@ -3936,9 +4004,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3936
4004
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
3937
4005
|
/* harmony import */ var _state_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./state/index */ "./ts/state/index.ts");
|
|
3938
4006
|
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3939
|
-
/* harmony import */ var
|
|
4007
|
+
/* harmony import */ var _interpolations_interpolateElement__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./interpolations/interpolateElement */ "./ts/interpolations/interpolateElement.ts");
|
|
3940
4008
|
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Tag.class */ "./ts/Tag.class.ts");
|
|
3941
4009
|
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
4010
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
3942
4011
|
// import { redrawTag } from "./redrawTag.function"
|
|
3943
4012
|
|
|
3944
4013
|
|
|
@@ -3955,6 +4024,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3955
4024
|
|
|
3956
4025
|
|
|
3957
4026
|
|
|
4027
|
+
|
|
3958
4028
|
const hmr = {
|
|
3959
4029
|
tagElement: _tagElement__WEBPACK_IMPORTED_MODULE_0__.tagElement,
|
|
3960
4030
|
// redrawTag
|
|
@@ -3978,13 +4048,16 @@ var __webpack_exports__html = __webpack_exports__.html;
|
|
|
3978
4048
|
var __webpack_exports__interpolateElement = __webpack_exports__.interpolateElement;
|
|
3979
4049
|
var __webpack_exports__interpolateString = __webpack_exports__.interpolateString;
|
|
3980
4050
|
var __webpack_exports__isSubjectInstance = __webpack_exports__.isSubjectInstance;
|
|
4051
|
+
var __webpack_exports__isTag = __webpack_exports__.isTag;
|
|
3981
4052
|
var __webpack_exports__isTagArray = __webpack_exports__.isTagArray;
|
|
4053
|
+
var __webpack_exports__isTagClass = __webpack_exports__.isTagClass;
|
|
3982
4054
|
var __webpack_exports__isTagComponent = __webpack_exports__.isTagComponent;
|
|
3983
|
-
var
|
|
4055
|
+
var __webpack_exports__isTagTemplater = __webpack_exports__.isTagTemplater;
|
|
3984
4056
|
var __webpack_exports__letState = __webpack_exports__.letState;
|
|
3985
4057
|
var __webpack_exports__onDestroy = __webpack_exports__.onDestroy;
|
|
3986
4058
|
var __webpack_exports__onInit = __webpack_exports__.onInit;
|
|
3987
4059
|
var __webpack_exports__providers = __webpack_exports__.providers;
|
|
4060
|
+
var __webpack_exports__renderTagSupport = __webpack_exports__.renderTagSupport;
|
|
3988
4061
|
var __webpack_exports__runBeforeRender = __webpack_exports__.runBeforeRender;
|
|
3989
4062
|
var __webpack_exports__setProp = __webpack_exports__.setProp;
|
|
3990
4063
|
var __webpack_exports__setUse = __webpack_exports__.setUse;
|
|
@@ -3996,6 +4069,6 @@ var __webpack_exports__watch = __webpack_exports__.watch;
|
|
|
3996
4069
|
var __webpack_exports__willCallback = __webpack_exports__.willCallback;
|
|
3997
4070
|
var __webpack_exports__willPromise = __webpack_exports__.willPromise;
|
|
3998
4071
|
var __webpack_exports__willSubscribe = __webpack_exports__.willSubscribe;
|
|
3999
|
-
export { __webpack_exports__ArrayNoKeyError as ArrayNoKeyError, __webpack_exports__BaseTagSupport as BaseTagSupport, __webpack_exports__StateMismatchError as StateMismatchError, __webpack_exports__Subject as Subject, __webpack_exports__SyncCallbackError as SyncCallbackError, __webpack_exports__Tag as Tag, __webpack_exports__TagError as TagError, __webpack_exports__TagSupport as TagSupport, __webpack_exports__ValueSubject as ValueSubject, __webpack_exports__callbackMaker as callbackMaker, __webpack_exports__combineLatest as combineLatest, __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,
|
|
4072
|
+
export { __webpack_exports__ArrayNoKeyError as ArrayNoKeyError, __webpack_exports__BaseTagSupport as BaseTagSupport, __webpack_exports__StateMismatchError as StateMismatchError, __webpack_exports__Subject as Subject, __webpack_exports__SyncCallbackError as SyncCallbackError, __webpack_exports__Tag as Tag, __webpack_exports__TagError as TagError, __webpack_exports__TagSupport as TagSupport, __webpack_exports__ValueSubject as ValueSubject, __webpack_exports__callbackMaker as callbackMaker, __webpack_exports__combineLatest as combineLatest, __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__isTag as isTag, __webpack_exports__isTagArray as isTagArray, __webpack_exports__isTagClass as isTagClass, __webpack_exports__isTagComponent as isTagComponent, __webpack_exports__isTagTemplater as isTagTemplater, __webpack_exports__letState as letState, __webpack_exports__onDestroy as onDestroy, __webpack_exports__onInit as onInit, __webpack_exports__providers as providers, __webpack_exports__renderTagSupport as renderTagSupport, __webpack_exports__runBeforeRender as runBeforeRender, __webpack_exports__setProp as setProp, __webpack_exports__setUse as setUse, __webpack_exports__state as state, __webpack_exports__tag as tag, __webpack_exports__tagElement as tagElement, __webpack_exports__tags as tags, __webpack_exports__watch as watch, __webpack_exports__willCallback as willCallback, __webpack_exports__willPromise as willPromise, __webpack_exports__willSubscribe as willSubscribe };
|
|
4000
4073
|
|
|
4001
4074
|
//# sourceMappingURL=bundle.js.map
|