taggedjs 2.4.16 → 2.4.31
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 +1851 -1732
- package/bundle.js.map +1 -1
- package/js/Clones.type.d.ts +1 -1
- package/js/{errors.d.ts → Errors.d.ts} +3 -0
- package/js/{errors.js → Errors.js} +6 -0
- package/js/{errors.js.map → Errors.js.map} +1 -1
- package/js/Tag.class.d.ts +6 -41
- 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 +16 -16
- package/js/TemplaterResult.class.js +35 -46
- 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 +3 -10
- package/js/index.js +3 -13
- package/js/index.js.map +1 -1
- package/js/interpolateTemplate.js +0 -5
- 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 +27 -35
- 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 +27 -23
- 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 +3 -0
- package/js/state/callbackMaker.function.js +51 -0
- package/js/state/callbackMaker.function.js.map +1 -0
- package/js/state/getCallback.d.ts +3 -0
- package/js/state/getCallback.js +51 -0
- package/js/state/getCallback.js.map +1 -0
- package/js/state/index.d.ts +10 -0
- package/js/state/index.js +10 -0
- package/js/state/index.js.map +1 -0
- package/js/state/letState.function.d.ts +3 -0
- package/js/state/letState.function.js +42 -0
- package/js/state/letState.function.js.map +1 -0
- package/js/state/onDestroy.d.ts +2 -0
- package/js/state/onDestroy.js +17 -0
- package/js/state/onDestroy.js.map +1 -0
- package/js/state/onInit.d.ts +2 -0
- package/js/state/onInit.js +16 -0
- package/js/state/onInit.js.map +1 -0
- package/js/state/provider.utils.d.ts +2 -0
- package/js/state/provider.utils.js +40 -0
- package/js/state/provider.utils.js.map +1 -0
- package/js/state/providers.d.ts +23 -0
- package/js/state/providers.js +83 -0
- package/js/state/providers.js.map +1 -0
- package/js/state/setProp.function.d.ts +3 -0
- package/js/state/setProp.function.js +37 -0
- package/js/state/setProp.function.js.map +1 -0
- package/js/state/setUse.function.d.ts +25 -0
- package/js/state/setUse.function.js +14 -0
- package/js/state/setUse.function.js.map +1 -0
- package/js/state/state.function.d.ts +2 -0
- package/js/state/state.function.js +34 -0
- package/js/state/state.function.js.map +1 -0
- package/js/state/state.utils.d.ts +20 -0
- package/js/state/state.utils.js +91 -0
- package/js/state/state.utils.js.map +1 -0
- package/js/state/watch.function.d.ts +8 -0
- package/js/state/watch.function.js +25 -0
- package/js/state/watch.function.js.map +1 -0
- package/js/subject/Subject.class.d.ts +10 -6
- package/js/subject/Subject.class.js +29 -13
- 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.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 +26 -32
- 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 +17 -9
- 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 -88
- 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/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,404 +252,244 @@ 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
|
|
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 || {},
|
|
354
|
+
};
|
|
357
355
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
// TODO: Lets find why a child tag is attached twice to owner
|
|
367
|
-
throw new Error('child tag registered twice for delete');
|
|
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;
|
|
368
364
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
365
|
+
this.buildBeforeElement(insertBefore, {
|
|
366
|
+
forceElement: true,
|
|
367
|
+
counts: { added: 0, removed: 0 },
|
|
368
|
+
});
|
|
372
369
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
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
|
-
}
|
|
370
|
+
getAppElement() {
|
|
371
|
+
let tag = this;
|
|
372
|
+
while (tag.ownerTagSupport) {
|
|
373
|
+
tag = tag.ownerTagSupport;
|
|
384
374
|
}
|
|
375
|
+
return tag;
|
|
385
376
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
/***/ }),
|
|
381
|
+
|
|
382
|
+
/***/ "./ts/TemplaterResult.class.ts":
|
|
383
|
+
/*!*************************************!*\
|
|
384
|
+
!*** ./ts/TemplaterResult.class.ts ***!
|
|
385
|
+
\*************************************/
|
|
386
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
387
|
+
|
|
388
|
+
__webpack_require__.r(__webpack_exports__);
|
|
389
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
390
|
+
/* harmony export */ TemplaterResult: () => (/* binding */ TemplaterResult),
|
|
391
|
+
/* harmony export */ renderWithSupport: () => (/* binding */ renderWithSupport)
|
|
392
|
+
/* harmony export */ });
|
|
393
|
+
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
394
|
+
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "./ts/state/index.ts");
|
|
395
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
396
|
+
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
class TemplaterResult {
|
|
402
|
+
props;
|
|
403
|
+
children;
|
|
404
|
+
isTemplater = true;
|
|
405
|
+
tagged;
|
|
406
|
+
wrapper;
|
|
407
|
+
tag;
|
|
408
|
+
constructor(props, children) {
|
|
409
|
+
this.props = props;
|
|
410
|
+
this.children = children;
|
|
389
411
|
}
|
|
390
|
-
subject.set(value); // listeners will evaluate updated values to possibly update display(s)
|
|
391
|
-
return;
|
|
392
412
|
}
|
|
393
|
-
function
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
413
|
+
function renderWithSupport(tagSupport, // new
|
|
414
|
+
lastSupport, // previous
|
|
415
|
+
subject, // events & memory
|
|
416
|
+
ownerSupport) {
|
|
417
|
+
/* BEFORE RENDER */
|
|
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);
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
// first time render
|
|
429
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runBeforeRender)(tagSupport, runtimeOwnerSupport);
|
|
430
|
+
// TODO: Logic below most likely could live within providers.ts inside the runBeforeRender function
|
|
431
|
+
const providers = _state__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
432
|
+
providers.ownerSupport = runtimeOwnerSupport;
|
|
433
|
+
}
|
|
434
|
+
/* END: BEFORE RENDER */
|
|
435
|
+
const templater = tagSupport.templater;
|
|
436
|
+
const subTag = subject.tagSupport;
|
|
437
|
+
// NEW TAG CREATED HERE
|
|
438
|
+
const wrapper = templater.wrapper;
|
|
439
|
+
const reSupport = wrapper(tagSupport, subject);
|
|
440
|
+
/* AFTER */
|
|
441
|
+
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runAfterRender)(tagSupport, reSupport);
|
|
442
|
+
const isLikeTag = !lastSupport || (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__.isLikeTags)(lastSupport, reSupport);
|
|
443
|
+
if (!isLikeTag) {
|
|
444
|
+
destroyUnlikeTags(lastSupport, reSupport, subject);
|
|
400
445
|
}
|
|
446
|
+
reSupport.ownerTagSupport = (ownerSupport || lastOwnerSupport);
|
|
447
|
+
tagSupport.global.newest = reSupport;
|
|
448
|
+
return reSupport;
|
|
449
|
+
}
|
|
450
|
+
function destroyUnlikeTags(lastSupport, // old
|
|
451
|
+
reSupport, // new
|
|
452
|
+
subject) {
|
|
453
|
+
const oldGlobal = lastSupport.global;
|
|
454
|
+
const insertBefore = oldGlobal.insertBefore;
|
|
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;
|
|
459
|
+
global.insertBefore = insertBefore;
|
|
460
|
+
global.deleted = false;
|
|
461
|
+
delete global.oldest;
|
|
462
|
+
delete global.newest;
|
|
463
|
+
delete subject.tagSupport;
|
|
401
464
|
}
|
|
402
465
|
|
|
403
466
|
|
|
404
467
|
/***/ }),
|
|
405
468
|
|
|
406
|
-
/***/ "./ts/
|
|
407
|
-
|
|
408
|
-
!*** ./ts/
|
|
409
|
-
|
|
469
|
+
/***/ "./ts/afterInterpolateElement.function.ts":
|
|
470
|
+
/*!************************************************!*\
|
|
471
|
+
!*** ./ts/afterInterpolateElement.function.ts ***!
|
|
472
|
+
\************************************************/
|
|
410
473
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
411
474
|
|
|
412
475
|
__webpack_require__.r(__webpack_exports__);
|
|
413
476
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
414
|
-
/* harmony export */
|
|
415
|
-
/* harmony export */ TagSupport: () => (/* binding */ TagSupport)
|
|
477
|
+
/* harmony export */ afterInterpolateElement: () => (/* binding */ afterInterpolateElement)
|
|
416
478
|
/* harmony export */ });
|
|
417
|
-
/* harmony import */ var
|
|
418
|
-
/* harmony import */ var
|
|
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");
|
|
419
481
|
|
|
420
482
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
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
|
-
})
|
|
446
|
-
};
|
|
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
|
-
}
|
|
453
|
-
}
|
|
454
|
-
function cloneValueArray(values) {
|
|
455
|
-
return values.map((value) => {
|
|
456
|
-
const tag = value;
|
|
457
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagInstance)(tag)) {
|
|
458
|
-
return cloneValueArray(tag.values);
|
|
459
|
-
}
|
|
460
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(tag)) {
|
|
461
|
-
const tagComponent = tag;
|
|
462
|
-
return (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(tagComponent.props);
|
|
463
|
-
}
|
|
464
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagArray)(tag)) {
|
|
465
|
-
return cloneValueArray(tag);
|
|
466
|
-
}
|
|
467
|
-
return (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(value);
|
|
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;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
/***/ }),
|
|
485
|
-
|
|
486
|
-
/***/ "./ts/TemplaterResult.class.ts":
|
|
487
|
-
/*!*************************************!*\
|
|
488
|
-
!*** ./ts/TemplaterResult.class.ts ***!
|
|
489
|
-
\*************************************/
|
|
490
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
491
|
-
|
|
492
|
-
__webpack_require__.r(__webpack_exports__);
|
|
493
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
494
|
-
/* harmony export */ TemplaterResult: () => (/* binding */ TemplaterResult),
|
|
495
|
-
/* harmony export */ renderWithSupport: () => (/* binding */ renderWithSupport)
|
|
496
|
-
/* harmony export */ });
|
|
497
|
-
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
498
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
499
|
-
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
500
|
-
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
class TemplaterResult {
|
|
506
|
-
props;
|
|
507
|
-
children;
|
|
508
|
-
isTag = false; // when true, is basic tag non-component
|
|
509
|
-
tagged;
|
|
510
|
-
wrapper;
|
|
511
|
-
global = {
|
|
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;
|
|
521
|
-
constructor(props, children) {
|
|
522
|
-
this.props = props;
|
|
523
|
-
this.children = children;
|
|
524
|
-
}
|
|
525
|
-
/*
|
|
526
|
-
redraw?: (
|
|
527
|
-
force?: boolean, // force children to redraw
|
|
528
|
-
) => Tag
|
|
529
|
-
*/
|
|
530
|
-
isTemplater = true;
|
|
531
|
-
}
|
|
532
|
-
function renderWithSupport(tagSupport, existingTag, subject, ownerTag) {
|
|
533
|
-
const wrapTagSupport = tagSupport; // this.tagSupport
|
|
534
|
-
/* BEFORE RENDER */
|
|
535
|
-
const runtimeOwnerTag = existingTag?.ownerTag || ownerTag;
|
|
536
|
-
if (existingTag) {
|
|
537
|
-
wrapTagSupport.memory.state.newest = [...existingTag.tagSupport.memory.state.newest];
|
|
538
|
-
wrapTagSupport.templater.global = existingTag.tagSupport.templater.global;
|
|
539
|
-
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runBeforeRedraw)(wrapTagSupport, existingTag);
|
|
540
|
-
}
|
|
541
|
-
else {
|
|
542
|
-
if (!wrapTagSupport) {
|
|
543
|
-
throw new Error('63521');
|
|
544
|
-
}
|
|
545
|
-
// first time render
|
|
546
|
-
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runBeforeRender)(wrapTagSupport, runtimeOwnerTag);
|
|
547
|
-
// TODO: Logic below most likely could live within providers.ts inside the runBeforeRender function
|
|
548
|
-
const providers = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
549
|
-
providers.ownerTag = runtimeOwnerTag;
|
|
550
|
-
}
|
|
551
|
-
/* END: BEFORE RENDER */
|
|
552
|
-
const templater = wrapTagSupport.templater;
|
|
553
|
-
// NEW TAG CREATED HERE
|
|
554
|
-
const retag = templater.wrapper(wrapTagSupport, subject);
|
|
555
|
-
/* AFTER */
|
|
556
|
-
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runAfterRender)(wrapTagSupport, retag);
|
|
557
|
-
const isLikeTag = !existingTag || (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__.isLikeTags)(existingTag, retag);
|
|
558
|
-
if (!isLikeTag) {
|
|
559
|
-
destroyUnlikeTags(existingTag, templater, subject);
|
|
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;
|
|
560
489
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
return
|
|
564
|
-
}
|
|
565
|
-
function destroyUnlikeTags(existingTag, // old
|
|
566
|
-
templater, // new
|
|
567
|
-
subject) {
|
|
568
|
-
const oldGlobal = existingTag.tagSupport.templater.global;
|
|
569
|
-
const insertBefore = oldGlobal.insertBefore;
|
|
570
|
-
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_3__.destroyTagMemory)(existingTag, subject);
|
|
571
|
-
// ??? - new so that when a tag is destroy the unlike does not carry the destroy signifier
|
|
572
|
-
templater.global = { ...templater.global }; // break memory references
|
|
573
|
-
const global = templater.global;
|
|
574
|
-
global.insertBefore = insertBefore;
|
|
575
|
-
global.deleted = false;
|
|
576
|
-
delete global.oldest;
|
|
577
|
-
delete global.newest;
|
|
578
|
-
delete subject.tag;
|
|
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
|
|
|
@@ -975,48 +885,18 @@ function elementDestroyCheck(nextSibling, stagger) {
|
|
|
975
885
|
|
|
976
886
|
/***/ }),
|
|
977
887
|
|
|
978
|
-
/***/ "./ts/
|
|
979
|
-
|
|
980
|
-
!*** ./ts/
|
|
981
|
-
|
|
888
|
+
/***/ "./ts/errors.ts":
|
|
889
|
+
/*!**********************!*\
|
|
890
|
+
!*** ./ts/errors.ts ***!
|
|
891
|
+
\**********************/
|
|
982
892
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
983
893
|
|
|
984
894
|
__webpack_require__.r(__webpack_exports__);
|
|
985
895
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
986
|
-
/* harmony export */
|
|
987
|
-
/* harmony export */
|
|
988
|
-
|
|
989
|
-
|
|
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;
|
|
1000
|
-
}
|
|
1001
|
-
const event = { target: nextSibling, stagger: counts.added };
|
|
1002
|
-
onInit(event);
|
|
1003
|
-
return ++counts.added;
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
/***/ }),
|
|
1008
|
-
|
|
1009
|
-
/***/ "./ts/errors.ts":
|
|
1010
|
-
/*!**********************!*\
|
|
1011
|
-
!*** ./ts/errors.ts ***!
|
|
1012
|
-
\**********************/
|
|
1013
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1014
|
-
|
|
1015
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1016
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1017
|
-
/* harmony export */ ArrayNoKeyError: () => (/* binding */ ArrayNoKeyError),
|
|
1018
|
-
/* harmony export */ StateMismatchError: () => (/* binding */ StateMismatchError),
|
|
1019
|
-
/* harmony export */ TagError: () => (/* binding */ TagError)
|
|
896
|
+
/* harmony export */ ArrayNoKeyError: () => (/* binding */ ArrayNoKeyError),
|
|
897
|
+
/* harmony export */ StateMismatchError: () => (/* binding */ StateMismatchError),
|
|
898
|
+
/* harmony export */ SyncCallbackError: () => (/* binding */ SyncCallbackError),
|
|
899
|
+
/* harmony export */ TagError: () => (/* binding */ TagError)
|
|
1020
900
|
/* harmony export */ });
|
|
1021
901
|
class TagError extends Error {
|
|
1022
902
|
details;
|
|
@@ -1038,71 +918,10 @@ class StateMismatchError extends TagError {
|
|
|
1038
918
|
this.name = StateMismatchError.name;
|
|
1039
919
|
}
|
|
1040
920
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
/***/ "./ts/getCallback.ts":
|
|
1046
|
-
/*!***************************!*\
|
|
1047
|
-
!*** ./ts/getCallback.ts ***!
|
|
1048
|
-
\***************************/
|
|
1049
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1050
|
-
|
|
1051
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1052
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1053
|
-
/* harmony export */ getCallback: () => (/* binding */ getCallback)
|
|
1054
|
-
/* harmony export */ });
|
|
1055
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
1056
|
-
/* harmony import */ var _set_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./set.function */ "./ts/set.function.ts");
|
|
1057
|
-
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
let innerCallback = (callback) => () => {
|
|
1062
|
-
throw new Error('Callback function was called immediately in sync and must instead be call async');
|
|
1063
|
-
};
|
|
1064
|
-
const getCallback = () => innerCallback;
|
|
1065
|
-
const originalGetter = innerCallback; // getCallback
|
|
1066
|
-
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
1067
|
-
beforeRender: (tagSupport) => initMemory(tagSupport),
|
|
1068
|
-
beforeRedraw: (tagSupport) => initMemory(tagSupport),
|
|
1069
|
-
afterRender: (_tagSupport) => {
|
|
1070
|
-
innerCallback = originalGetter; // prevent crossing callbacks with another tag
|
|
1071
|
-
},
|
|
1072
|
-
});
|
|
1073
|
-
function updateState(stateFrom, stateTo) {
|
|
1074
|
-
stateFrom.forEach((state, index) => {
|
|
1075
|
-
const fromValue = (0,_set_function__WEBPACK_IMPORTED_MODULE_1__.getStateValue)(state);
|
|
1076
|
-
const callback = stateTo[index].callback;
|
|
1077
|
-
if (callback) {
|
|
1078
|
-
callback(fromValue); // set the value
|
|
1079
|
-
}
|
|
1080
|
-
stateTo[index].lastValue = fromValue; // record the value
|
|
1081
|
-
});
|
|
1082
|
-
}
|
|
1083
|
-
function initMemory(tagSupport) {
|
|
1084
|
-
const oldState = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.stateConfig.array;
|
|
1085
|
-
innerCallback = (callback) => {
|
|
1086
|
-
const trigger = (...args) => triggerStateUpdate(tagSupport, callback, oldState, ...args);
|
|
1087
|
-
return trigger;
|
|
1088
|
-
};
|
|
1089
|
-
}
|
|
1090
|
-
function triggerStateUpdate(tagSupport, callback, oldState, ...args) {
|
|
1091
|
-
const state = tagSupport.memory.state;
|
|
1092
|
-
const newest = state.newest;
|
|
1093
|
-
// ensure that the oldest has the latest values first
|
|
1094
|
-
updateState(newest, oldState);
|
|
1095
|
-
// run the callback
|
|
1096
|
-
const promise = callback(...args);
|
|
1097
|
-
// send the oldest state changes into the newest
|
|
1098
|
-
updateState(oldState, newest);
|
|
1099
|
-
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
1100
|
-
if (promise instanceof Promise) {
|
|
1101
|
-
promise.finally(() => {
|
|
1102
|
-
// send the oldest state changes into the newest
|
|
1103
|
-
updateState(oldState, newest);
|
|
1104
|
-
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
1105
|
-
});
|
|
921
|
+
class SyncCallbackError extends TagError {
|
|
922
|
+
constructor(message, details) {
|
|
923
|
+
super(message, 'sync-callback-error', details);
|
|
924
|
+
this.name = SyncCallbackError.name;
|
|
1106
925
|
}
|
|
1107
926
|
}
|
|
1108
927
|
|
|
@@ -1124,18 +943,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1124
943
|
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
1125
944
|
|
|
1126
945
|
function hasTagSupportChanged(oldTagSupport, newTagSupport, newTemplater) {
|
|
1127
|
-
const sameSupport = oldTagSupport === newTagSupport;
|
|
1128
|
-
const samePropConfig = oldTagSupport.propsConfig === newTagSupport.propsConfig;
|
|
1129
|
-
// const sameProps = oldTagSupport.propsConfig.latest === newTagSupport.propsConfig.latest
|
|
1130
|
-
if (sameSupport) {
|
|
1131
|
-
throw new Error('sameSupport - 22');
|
|
1132
|
-
}
|
|
1133
|
-
if (samePropConfig) {
|
|
1134
|
-
throw new Error('samePropConfig - 22');
|
|
1135
|
-
}
|
|
1136
|
-
if (newTagSupport.templater.isTag || oldTagSupport.templater.isTag || newTemplater.isTag) {
|
|
1137
|
-
throw new Error('trying to compare a basic tag');
|
|
1138
|
-
}
|
|
1139
946
|
const latestProps = newTemplater.props; // newTagSupport.propsConfig.latest
|
|
1140
947
|
const pastCloneProps = oldTagSupport.propsConfig.latestCloned;
|
|
1141
948
|
const propsChanged = hasPropChanges(latestProps, pastCloneProps);
|
|
@@ -1226,10 +1033,115 @@ function html(strings, ...values) {
|
|
|
1226
1033
|
|
|
1227
1034
|
/***/ }),
|
|
1228
1035
|
|
|
1229
|
-
/***/ "./ts/
|
|
1230
|
-
|
|
1231
|
-
!*** ./ts/
|
|
1232
|
-
|
|
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
|
+
\*********************************************/
|
|
1233
1145
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1234
1146
|
|
|
1235
1147
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -1258,36 +1170,17 @@ function inputAttribute(name, value, element) {
|
|
|
1258
1170
|
|
|
1259
1171
|
/***/ }),
|
|
1260
1172
|
|
|
1261
|
-
/***/ "./ts/
|
|
1262
|
-
|
|
1263
|
-
!*** ./ts/
|
|
1264
|
-
|
|
1265
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1266
|
-
|
|
1267
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1268
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1269
|
-
/* harmony export */ insertAfter: () => (/* binding */ insertAfter)
|
|
1270
|
-
/* harmony export */ });
|
|
1271
|
-
// Function to insert element after reference element
|
|
1272
|
-
function insertAfter(newNode, referenceNode) {
|
|
1273
|
-
const parentNode = referenceNode.parentNode;
|
|
1274
|
-
parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
/***/ }),
|
|
1279
|
-
|
|
1280
|
-
/***/ "./ts/interpolateAttributes.ts":
|
|
1281
|
-
/*!*************************************!*\
|
|
1282
|
-
!*** ./ts/interpolateAttributes.ts ***!
|
|
1283
|
-
\*************************************/
|
|
1173
|
+
/***/ "./ts/interpolations/interpolateAttributes.ts":
|
|
1174
|
+
/*!****************************************************!*\
|
|
1175
|
+
!*** ./ts/interpolations/interpolateAttributes.ts ***!
|
|
1176
|
+
\****************************************************/
|
|
1284
1177
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1285
1178
|
|
|
1286
1179
|
__webpack_require__.r(__webpack_exports__);
|
|
1287
1180
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1288
1181
|
/* harmony export */ interpolateAttributes: () => (/* binding */ interpolateAttributes)
|
|
1289
1182
|
/* harmony export */ });
|
|
1290
|
-
/* 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");
|
|
1291
1184
|
|
|
1292
1185
|
function howToSetAttribute(element, name, value) {
|
|
1293
1186
|
element.setAttribute(name, value);
|
|
@@ -1295,7 +1188,7 @@ function howToSetAttribute(element, name, value) {
|
|
|
1295
1188
|
function howToSetInputValue(element, name, value) {
|
|
1296
1189
|
element[name] = value;
|
|
1297
1190
|
}
|
|
1298
|
-
function interpolateAttributes(child, scope,
|
|
1191
|
+
function interpolateAttributes(child, scope, ownerSupport) {
|
|
1299
1192
|
const attrNames = child.getAttributeNames();
|
|
1300
1193
|
let howToSet = howToSetAttribute;
|
|
1301
1194
|
attrNames.forEach(attrName => {
|
|
@@ -1303,7 +1196,7 @@ function interpolateAttributes(child, scope, ownerTag) {
|
|
|
1303
1196
|
howToSet = howToSetInputValue;
|
|
1304
1197
|
}
|
|
1305
1198
|
const value = child.getAttribute(attrName);
|
|
1306
|
-
(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);
|
|
1307
1200
|
howToSet = howToSetAttribute; // put back
|
|
1308
1201
|
});
|
|
1309
1202
|
}
|
|
@@ -1311,19 +1204,19 @@ function interpolateAttributes(child, scope, ownerTag) {
|
|
|
1311
1204
|
|
|
1312
1205
|
/***/ }),
|
|
1313
1206
|
|
|
1314
|
-
/***/ "./ts/interpolateContentTemplates.ts":
|
|
1315
|
-
|
|
1316
|
-
!*** ./ts/interpolateContentTemplates.ts ***!
|
|
1317
|
-
|
|
1207
|
+
/***/ "./ts/interpolations/interpolateContentTemplates.ts":
|
|
1208
|
+
/*!**********************************************************!*\
|
|
1209
|
+
!*** ./ts/interpolations/interpolateContentTemplates.ts ***!
|
|
1210
|
+
\**********************************************************/
|
|
1318
1211
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1319
1212
|
|
|
1320
1213
|
__webpack_require__.r(__webpack_exports__);
|
|
1321
1214
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1322
1215
|
/* harmony export */ interpolateContentTemplates: () => (/* binding */ interpolateContentTemplates)
|
|
1323
1216
|
/* harmony export */ });
|
|
1324
|
-
/* 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");
|
|
1325
1218
|
|
|
1326
|
-
function interpolateContentTemplates(element, context,
|
|
1219
|
+
function interpolateContentTemplates(element, context, tagSupport, options, children) {
|
|
1327
1220
|
if (!children || element.tagName === 'TEMPLATE') {
|
|
1328
1221
|
return { clones: [], tagComponents: [] }; // done
|
|
1329
1222
|
}
|
|
@@ -1333,7 +1226,7 @@ function interpolateContentTemplates(element, context, tag, options, children) {
|
|
|
1333
1226
|
const tagComponents = [];
|
|
1334
1227
|
const childArray = new Array(...children);
|
|
1335
1228
|
childArray.forEach(child => {
|
|
1336
|
-
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);
|
|
1337
1230
|
clones.push(...nextClones);
|
|
1338
1231
|
if (tagComponent) {
|
|
1339
1232
|
tagComponents.push(tagComponent);
|
|
@@ -1344,12 +1237,12 @@ function interpolateContentTemplates(element, context, tag, options, children) {
|
|
|
1344
1237
|
nextKids.forEach((subChild, index) => {
|
|
1345
1238
|
// IF <template end /> its a variable to be processed
|
|
1346
1239
|
if (isRenderEndTemplate(subChild)) {
|
|
1347
|
-
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);
|
|
1348
1241
|
if (tagComponent) {
|
|
1349
1242
|
tagComponents.push(tagComponent);
|
|
1350
1243
|
}
|
|
1351
1244
|
}
|
|
1352
|
-
const { clones: nextClones, tagComponents: nextTagComponent } = interpolateContentTemplates(subChild, context,
|
|
1245
|
+
const { clones: nextClones, tagComponents: nextTagComponent } = interpolateContentTemplates(subChild, context, tagSupport, options, subChild.children);
|
|
1353
1246
|
clones.push(...nextClones);
|
|
1354
1247
|
tagComponents.push(...nextTagComponent);
|
|
1355
1248
|
});
|
|
@@ -1367,10 +1260,10 @@ function isRenderEndTemplate(child) {
|
|
|
1367
1260
|
|
|
1368
1261
|
/***/ }),
|
|
1369
1262
|
|
|
1370
|
-
/***/ "./ts/interpolateElement.ts":
|
|
1371
|
-
|
|
1372
|
-
!*** ./ts/interpolateElement.ts ***!
|
|
1373
|
-
|
|
1263
|
+
/***/ "./ts/interpolations/interpolateElement.ts":
|
|
1264
|
+
/*!*************************************************!*\
|
|
1265
|
+
!*** ./ts/interpolations/interpolateElement.ts ***!
|
|
1266
|
+
\*************************************************/
|
|
1374
1267
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1375
1268
|
|
|
1376
1269
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -1378,10 +1271,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1378
1271
|
/* harmony export */ interpolateElement: () => (/* binding */ interpolateElement),
|
|
1379
1272
|
/* harmony export */ interpolateString: () => (/* binding */ interpolateString)
|
|
1380
1273
|
/* harmony export */ });
|
|
1381
|
-
/* harmony import */ var _interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interpolateAttributes */ "./ts/interpolateAttributes.ts");
|
|
1382
|
-
/* harmony import */ var _interpolations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./interpolations */ "./ts/interpolations.ts");
|
|
1383
|
-
/* harmony import */ var _interpolateContentTemplates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interpolateContentTemplates */ "./ts/interpolateContentTemplates.ts");
|
|
1384
|
-
/* 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");
|
|
1385
1278
|
|
|
1386
1279
|
|
|
1387
1280
|
|
|
@@ -1389,26 +1282,26 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1389
1282
|
/** Review elements within an element */
|
|
1390
1283
|
function interpolateElement(container, // element containing innerHTML to review interpolations
|
|
1391
1284
|
context, // variables used to evaluate
|
|
1392
|
-
interpolatedTemplates,
|
|
1285
|
+
interpolatedTemplates, ownerSupport, options) {
|
|
1393
1286
|
const clones = [];
|
|
1394
1287
|
const tagComponents = [];
|
|
1395
1288
|
const result = interpolatedTemplates.interpolation;
|
|
1396
1289
|
const template = container.children[0];
|
|
1397
1290
|
const children = template.content.children;
|
|
1398
1291
|
if (result.keys.length) {
|
|
1399
|
-
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);
|
|
1400
1293
|
clones.push(...nextClones);
|
|
1401
1294
|
tagComponents.push(...nextTagComponents);
|
|
1402
1295
|
}
|
|
1403
|
-
(0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(container, context,
|
|
1404
|
-
processChildrenAttributes(children, context,
|
|
1296
|
+
(0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(container, context, ownerSupport);
|
|
1297
|
+
processChildrenAttributes(children, context, ownerSupport);
|
|
1405
1298
|
return { clones, tagComponents };
|
|
1406
1299
|
}
|
|
1407
|
-
function processChildrenAttributes(children, context,
|
|
1300
|
+
function processChildrenAttributes(children, context, ownerSupport) {
|
|
1408
1301
|
new Array(...children).forEach(child => {
|
|
1409
|
-
(0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(child, context,
|
|
1302
|
+
(0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(child, context, ownerSupport);
|
|
1410
1303
|
if (child.children) {
|
|
1411
|
-
processChildrenAttributes(child.children, context,
|
|
1304
|
+
processChildrenAttributes(child.children, context, ownerSupport);
|
|
1412
1305
|
}
|
|
1413
1306
|
});
|
|
1414
1307
|
}
|
|
@@ -1421,10 +1314,10 @@ function interpolateString(string) {
|
|
|
1421
1314
|
|
|
1422
1315
|
/***/ }),
|
|
1423
1316
|
|
|
1424
|
-
/***/ "./ts/interpolateTemplate.ts":
|
|
1425
|
-
|
|
1426
|
-
!*** ./ts/interpolateTemplate.ts ***!
|
|
1427
|
-
|
|
1317
|
+
/***/ "./ts/interpolations/interpolateTemplate.ts":
|
|
1318
|
+
/*!**************************************************!*\
|
|
1319
|
+
!*** ./ts/interpolations/interpolateTemplate.ts ***!
|
|
1320
|
+
\**************************************************/
|
|
1428
1321
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1429
1322
|
|
|
1430
1323
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -1433,12 +1326,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1433
1326
|
/* harmony export */ interpolateTemplate: () => (/* binding */ interpolateTemplate),
|
|
1434
1327
|
/* harmony export */ subscribeToTemplate: () => (/* binding */ subscribeToTemplate)
|
|
1435
1328
|
/* harmony export */ });
|
|
1436
|
-
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*!
|
|
1437
|
-
/* harmony import */ var _elementInitCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./elementInitCheck */ "./ts/elementInitCheck.ts");
|
|
1438
|
-
/* harmony import */ var _processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*!
|
|
1439
|
-
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*!
|
|
1440
|
-
/* harmony import */ var _scanTextAreaValue_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./scanTextAreaValue.function */ "./ts/scanTextAreaValue.function.ts");
|
|
1441
|
-
/* 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");
|
|
1442
1335
|
|
|
1443
1336
|
|
|
1444
1337
|
|
|
@@ -1447,7 +1340,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1447
1340
|
|
|
1448
1341
|
function interpolateTemplate(insertBefore, // <template end interpolate /> (will be removed)
|
|
1449
1342
|
context, // variable scope of {`__tagvar${index}`:'x'}
|
|
1450
|
-
|
|
1343
|
+
ownerSupport, // Tag class
|
|
1451
1344
|
counts, // used for animation stagger computing
|
|
1452
1345
|
options) {
|
|
1453
1346
|
// TODO: THe clones array is useless here
|
|
@@ -1467,58 +1360,44 @@ options) {
|
|
|
1467
1360
|
clones,
|
|
1468
1361
|
tagComponent: {
|
|
1469
1362
|
variableName,
|
|
1470
|
-
|
|
1363
|
+
ownerSupport,
|
|
1471
1364
|
subject: existingSubject,
|
|
1472
1365
|
insertBefore
|
|
1473
1366
|
}
|
|
1474
1367
|
};
|
|
1475
1368
|
}
|
|
1476
1369
|
let isForceElement = options.forceElement;
|
|
1477
|
-
subscribeToTemplate(insertBefore, existingSubject,
|
|
1370
|
+
subscribeToTemplate(insertBefore, existingSubject, ownerSupport, counts, { isForceElement });
|
|
1478
1371
|
return { clones };
|
|
1479
1372
|
}
|
|
1480
|
-
function subscribeToTemplate(insertBefore, subject,
|
|
1373
|
+
function subscribeToTemplate(insertBefore, subject, ownerSupport, counts, // used for animation stagger computing
|
|
1481
1374
|
{ isForceElement }) {
|
|
1482
1375
|
let called = false;
|
|
1483
1376
|
const callback = (value) => {
|
|
1484
|
-
// const orgInsert = insertBefore
|
|
1485
|
-
/*
|
|
1486
|
-
const clone = (subject as DisplaySubject).clone
|
|
1487
|
-
if(clone && clone.parentNode) {
|
|
1488
|
-
insertBefore = clone
|
|
1489
|
-
}
|
|
1490
|
-
*/
|
|
1491
1377
|
if (called) {
|
|
1492
|
-
(0,_updateExistingValue_function__WEBPACK_IMPORTED_MODULE_5__.updateExistingValue)(subject, value,
|
|
1378
|
+
(0,_updateExistingValue_function__WEBPACK_IMPORTED_MODULE_5__.updateExistingValue)(subject, value, ownerSupport, insertBefore);
|
|
1493
1379
|
return;
|
|
1494
1380
|
}
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
}
|
|
1498
|
-
const global = ownerTag.tagSupport.templater.global;
|
|
1499
|
-
const pre = global.placeholder?.parentNode;
|
|
1500
|
-
(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, {
|
|
1501
1383
|
counts: { ...counts },
|
|
1502
1384
|
forceElement: isForceElement,
|
|
1503
1385
|
});
|
|
1504
1386
|
if (isForceElement) {
|
|
1505
1387
|
isForceElement = false; // only can happen once
|
|
1506
1388
|
}
|
|
1507
|
-
// ownerTag.clones.push(...clones)
|
|
1508
|
-
// ownerTag.clones.push(...nextClones)
|
|
1509
|
-
// clones.push(...nextClones)
|
|
1510
1389
|
called = true;
|
|
1511
1390
|
};
|
|
1512
1391
|
const sub = subject.subscribe(callback);
|
|
1513
|
-
|
|
1392
|
+
ownerSupport.global.subscriptions.push(sub);
|
|
1514
1393
|
}
|
|
1515
|
-
function afterElmBuild(elm, options, context,
|
|
1394
|
+
function afterElmBuild(elm, options, context, ownerSupport) {
|
|
1516
1395
|
if (!elm.getAttribute) {
|
|
1517
1396
|
return;
|
|
1518
1397
|
}
|
|
1519
1398
|
const tagName = elm.nodeName; // elm.tagName
|
|
1520
1399
|
if (tagName === 'TEXTAREA') {
|
|
1521
|
-
(0,_scanTextAreaValue_function__WEBPACK_IMPORTED_MODULE_4__.scanTextAreaValue)(elm, context,
|
|
1400
|
+
(0,_scanTextAreaValue_function__WEBPACK_IMPORTED_MODULE_4__.scanTextAreaValue)(elm, context, ownerSupport);
|
|
1522
1401
|
}
|
|
1523
1402
|
let diff = options.counts.added;
|
|
1524
1403
|
diff = (0,_elementInitCheck__WEBPACK_IMPORTED_MODULE_1__.elementInitCheck)(elm, options.counts) - diff;
|
|
@@ -1528,7 +1407,7 @@ function afterElmBuild(elm, options, context, ownerTag) {
|
|
|
1528
1407
|
...options,
|
|
1529
1408
|
counts: options.counts,
|
|
1530
1409
|
};
|
|
1531
|
-
return afterElmBuild(child, subOptions, context,
|
|
1410
|
+
return afterElmBuild(child, subOptions, context, ownerSupport);
|
|
1532
1411
|
});
|
|
1533
1412
|
}
|
|
1534
1413
|
}
|
|
@@ -1536,10 +1415,10 @@ function afterElmBuild(elm, options, context, ownerTag) {
|
|
|
1536
1415
|
|
|
1537
1416
|
/***/ }),
|
|
1538
1417
|
|
|
1539
|
-
/***/ "./ts/interpolations.ts":
|
|
1540
|
-
|
|
1541
|
-
!*** ./ts/interpolations.ts ***!
|
|
1542
|
-
|
|
1418
|
+
/***/ "./ts/interpolations/interpolations.ts":
|
|
1419
|
+
/*!*********************************************!*\
|
|
1420
|
+
!*** ./ts/interpolations/interpolations.ts ***!
|
|
1421
|
+
\*********************************************/
|
|
1543
1422
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1544
1423
|
|
|
1545
1424
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -1559,9 +1438,8 @@ function interpolateToTemplates(template) {
|
|
|
1559
1438
|
}
|
|
1560
1439
|
const noBraces = expression.substring(1, expression.length - 1);
|
|
1561
1440
|
const id = noBraces;
|
|
1562
|
-
const name = 'template-' + template.length;
|
|
1563
1441
|
keys.push(id);
|
|
1564
|
-
return `<template interpolate end id="${id}"
|
|
1442
|
+
return `<template interpolate end id="${id}"></template>`;
|
|
1565
1443
|
});
|
|
1566
1444
|
return { string, keys };
|
|
1567
1445
|
}
|
|
@@ -1569,194 +1447,60 @@ function interpolateToTemplates(template) {
|
|
|
1569
1447
|
|
|
1570
1448
|
/***/ }),
|
|
1571
1449
|
|
|
1572
|
-
/***/ "./ts/
|
|
1573
|
-
|
|
1574
|
-
!*** ./ts/
|
|
1575
|
-
|
|
1450
|
+
/***/ "./ts/interpolations/processAttribute.function.ts":
|
|
1451
|
+
/*!********************************************************!*\
|
|
1452
|
+
!*** ./ts/interpolations/processAttribute.function.ts ***!
|
|
1453
|
+
\********************************************************/
|
|
1576
1454
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1577
1455
|
|
|
1578
1456
|
__webpack_require__.r(__webpack_exports__);
|
|
1579
1457
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1580
|
-
/* harmony export */
|
|
1581
|
-
/* harmony export */ isTagArray: () => (/* binding */ isTagArray),
|
|
1582
|
-
/* harmony export */ isTagComponent: () => (/* binding */ isTagComponent),
|
|
1583
|
-
/* harmony export */ isTagInstance: () => (/* binding */ isTagInstance)
|
|
1458
|
+
/* harmony export */ processAttribute: () => (/* binding */ processAttribute)
|
|
1584
1459
|
/* harmony export */ });
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
function isTagInstance(tag) {
|
|
1589
|
-
return tag?.isTag === true;
|
|
1590
|
-
}
|
|
1591
|
-
function isSubjectInstance(subject) {
|
|
1592
|
-
return (subject?.isSubject === true || subject?.subscribe) ? true : false; // subject?.isSubject === true ||
|
|
1593
|
-
}
|
|
1594
|
-
function isTagArray(value) {
|
|
1595
|
-
return value instanceof Array && value.every(x => isTagInstance(x));
|
|
1596
|
-
}
|
|
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");
|
|
1597
1463
|
|
|
1598
1464
|
|
|
1599
|
-
/***/ }),
|
|
1600
|
-
|
|
1601
|
-
/***/ "./ts/isLikeTags.function.ts":
|
|
1602
|
-
/*!***********************************!*\
|
|
1603
|
-
!*** ./ts/isLikeTags.function.ts ***!
|
|
1604
|
-
\***********************************/
|
|
1605
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1606
1465
|
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1466
|
+
const startRegX = /^\s*{__tagvar/;
|
|
1467
|
+
const endRegX = /}\s*$/;
|
|
1468
|
+
function isTagVar(value) {
|
|
1469
|
+
return value && value.search(startRegX) >= 0 && value.search(endRegX) >= 0;
|
|
1470
|
+
}
|
|
1471
|
+
function processAttribute(attrName, value, child, scope, ownerSupport, howToSet) {
|
|
1472
|
+
if (isTagVar(value)) {
|
|
1473
|
+
return processScopedNameValueAttr(attrName, value, child, scope, ownerSupport, howToSet);
|
|
1614
1474
|
}
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1475
|
+
if (isTagVar(attrName)) {
|
|
1476
|
+
const contextValueSubject = getContextValueByVarString(scope, attrName);
|
|
1477
|
+
let lastValue;
|
|
1478
|
+
// the above callback gets called immediately since its a ValueSubject()
|
|
1479
|
+
const sub = contextValueSubject.subscribe((value) => {
|
|
1480
|
+
processNameOnlyAttr(value, lastValue, child, ownerSupport, howToSet);
|
|
1481
|
+
lastValue = value;
|
|
1482
|
+
});
|
|
1483
|
+
ownerSupport.global.subscriptions.push(sub); // this is where unsubscribe is picked up
|
|
1484
|
+
child.removeAttribute(attrName);
|
|
1485
|
+
return;
|
|
1618
1486
|
}
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
const allVarsMatch = tag1.values.every((value, index) => {
|
|
1624
|
-
const compareTo = tag0.values[index];
|
|
1625
|
-
const isFunctions = value instanceof Function && compareTo instanceof Function;
|
|
1626
|
-
if (isFunctions) {
|
|
1627
|
-
const stringMatch = value.toString() === compareTo.toString();
|
|
1628
|
-
if (stringMatch) {
|
|
1629
|
-
return true;
|
|
1630
|
-
}
|
|
1631
|
-
return false;
|
|
1632
|
-
}
|
|
1633
|
-
return true; // deepEqual(value, compareTo)
|
|
1634
|
-
});
|
|
1635
|
-
if (allVarsMatch) {
|
|
1636
|
-
return true;
|
|
1637
|
-
}
|
|
1638
|
-
return false;
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
/***/ }),
|
|
1643
|
-
|
|
1644
|
-
/***/ "./ts/onDestroy.ts":
|
|
1645
|
-
/*!*************************!*\
|
|
1646
|
-
!*** ./ts/onDestroy.ts ***!
|
|
1647
|
-
\*************************/
|
|
1648
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1649
|
-
|
|
1650
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1651
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1652
|
-
/* harmony export */ onDestroy: () => (/* binding */ onDestroy)
|
|
1653
|
-
/* harmony export */ });
|
|
1654
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
1655
|
-
|
|
1656
|
-
/** When undefined, it means a tag is being built for the first time so do run destroy(s) */
|
|
1657
|
-
let destroyCurrentTagSupport;
|
|
1658
|
-
function onDestroy(callback) {
|
|
1659
|
-
destroyCurrentTagSupport.templater.global.destroyCallback = callback;
|
|
1660
|
-
}
|
|
1661
|
-
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
1662
|
-
beforeRender: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
1663
|
-
beforeRedraw: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
1664
|
-
beforeDestroy: (tagSupport, tag) => {
|
|
1665
|
-
const callback = tagSupport.templater.global.destroyCallback;
|
|
1666
|
-
if (callback) {
|
|
1667
|
-
callback();
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
});
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
/***/ }),
|
|
1674
|
-
|
|
1675
|
-
/***/ "./ts/onInit.ts":
|
|
1676
|
-
/*!**********************!*\
|
|
1677
|
-
!*** ./ts/onInit.ts ***!
|
|
1678
|
-
\**********************/
|
|
1679
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1680
|
-
|
|
1681
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1682
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1683
|
-
/* harmony export */ onInit: () => (/* binding */ onInit)
|
|
1684
|
-
/* harmony export */ });
|
|
1685
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
1686
|
-
|
|
1687
|
-
function setCurrentTagSupport(support) {
|
|
1688
|
-
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentTemplater = support.templater;
|
|
1689
|
-
}
|
|
1690
|
-
function onInit(callback) {
|
|
1691
|
-
const templater = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentTemplater;
|
|
1692
|
-
if (!templater.global.init) {
|
|
1693
|
-
;
|
|
1694
|
-
templater.global.init = callback;
|
|
1695
|
-
callback(); // fire init
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
1699
|
-
beforeRender: tagSupport => setCurrentTagSupport(tagSupport),
|
|
1700
|
-
beforeRedraw: tagSupport => setCurrentTagSupport(tagSupport),
|
|
1701
|
-
});
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
/***/ }),
|
|
1705
|
-
|
|
1706
|
-
/***/ "./ts/processAttribute.function.ts":
|
|
1707
|
-
/*!*****************************************!*\
|
|
1708
|
-
!*** ./ts/processAttribute.function.ts ***!
|
|
1709
|
-
\*****************************************/
|
|
1710
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1711
|
-
|
|
1712
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1713
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1714
|
-
/* harmony export */ processAttribute: () => (/* binding */ processAttribute)
|
|
1715
|
-
/* harmony export */ });
|
|
1716
|
-
/* harmony import */ var _inputAttribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./inputAttribute */ "./ts/inputAttribute.ts");
|
|
1717
|
-
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
1718
|
-
/* harmony import */ var _bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bindSubjectCallback.function */ "./ts/bindSubjectCallback.function.ts");
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
const startRegX = /^\s*{__tagvar/;
|
|
1723
|
-
const endRegX = /}\s*$/;
|
|
1724
|
-
function isTagVar(value) {
|
|
1725
|
-
return value && value.search(startRegX) >= 0 && value.search(endRegX) >= 0;
|
|
1726
|
-
}
|
|
1727
|
-
function processAttribute(attrName, value, child, scope, ownerTag, howToSet) {
|
|
1728
|
-
if (isTagVar(value)) {
|
|
1729
|
-
return processScopedNameValueAttr(attrName, value, child, scope, ownerTag, howToSet);
|
|
1730
|
-
}
|
|
1731
|
-
if (isTagVar(attrName)) {
|
|
1732
|
-
const contextValueSubject = getContextValueByVarString(scope, attrName);
|
|
1733
|
-
let lastValue;
|
|
1734
|
-
// the above callback gets called immediately since its a ValueSubject()
|
|
1735
|
-
const sub = contextValueSubject.subscribe((value) => {
|
|
1736
|
-
processNameOnlyAttr(value, lastValue, child, ownerTag, howToSet);
|
|
1737
|
-
lastValue = value;
|
|
1738
|
-
});
|
|
1739
|
-
ownerTag.tagSupport.templater.global.subscriptions.push(sub); // this is where unsubscribe is picked up
|
|
1740
|
-
child.removeAttribute(attrName);
|
|
1741
|
-
return;
|
|
1742
|
-
}
|
|
1743
|
-
// Non dynamic
|
|
1744
|
-
const isSpecial = isSpecialAttr(attrName);
|
|
1745
|
-
if (isSpecial) {
|
|
1746
|
-
return (0,_inputAttribute__WEBPACK_IMPORTED_MODULE_0__.inputAttribute)(attrName, value, child);
|
|
1487
|
+
// Non dynamic
|
|
1488
|
+
const isSpecial = isSpecialAttr(attrName);
|
|
1489
|
+
if (isSpecial) {
|
|
1490
|
+
return (0,_inputAttribute__WEBPACK_IMPORTED_MODULE_0__.inputAttribute)(attrName, value, child);
|
|
1747
1491
|
}
|
|
1748
1492
|
}
|
|
1749
1493
|
function processScopedNameValueAttr(attrName, value, // {__tagVarN}
|
|
1750
|
-
child, scope,
|
|
1494
|
+
child, scope, ownerSupport, howToSet) {
|
|
1751
1495
|
// get the code inside the brackets like "variable0" or "{variable0}"
|
|
1752
1496
|
const result = getContextValueByVarString(scope, value);
|
|
1753
|
-
return processNameValueAttr(attrName, result, child,
|
|
1497
|
+
return processNameValueAttr(attrName, result, child, ownerSupport, howToSet);
|
|
1754
1498
|
}
|
|
1755
1499
|
function getContextValueByVarString(scope, value) {
|
|
1756
1500
|
const code = value.replace('{', '').split('').reverse().join('').replace('}', '').split('').reverse().join('');
|
|
1757
1501
|
return scope[code];
|
|
1758
1502
|
}
|
|
1759
|
-
function processNameOnlyAttr(attrValue, lastValue, child,
|
|
1503
|
+
function processNameOnlyAttr(attrValue, lastValue, child, ownerSupport, howToSet) {
|
|
1760
1504
|
if (lastValue && lastValue != attrValue) {
|
|
1761
1505
|
if (typeof (lastValue) === 'string') {
|
|
1762
1506
|
child.removeAttribute(lastValue);
|
|
@@ -1769,15 +1513,15 @@ function processNameOnlyAttr(attrValue, lastValue, child, ownerTag, howToSet) {
|
|
|
1769
1513
|
if (!attrValue.length) {
|
|
1770
1514
|
return;
|
|
1771
1515
|
}
|
|
1772
|
-
processNameValueAttr(attrValue, '', child,
|
|
1516
|
+
processNameValueAttr(attrValue, '', child, ownerSupport, howToSet);
|
|
1773
1517
|
return;
|
|
1774
1518
|
}
|
|
1775
1519
|
if (attrValue instanceof Object) {
|
|
1776
|
-
Object.entries(attrValue).forEach(([name, value]) => processNameValueAttr(name, value, child,
|
|
1520
|
+
Object.entries(attrValue).forEach(([name, value]) => processNameValueAttr(name, value, child, ownerSupport, howToSet));
|
|
1777
1521
|
return;
|
|
1778
1522
|
}
|
|
1779
1523
|
}
|
|
1780
|
-
function processNameValueAttr(attrName, result, child,
|
|
1524
|
+
function processNameValueAttr(attrName, result, child, ownerSupport, howToSet) {
|
|
1781
1525
|
const isSpecial = isSpecialAttr(attrName);
|
|
1782
1526
|
// attach as callback?
|
|
1783
1527
|
if (result instanceof Function) {
|
|
@@ -1793,14 +1537,14 @@ function processNameValueAttr(attrName, result, child, ownerTag, howToSet) {
|
|
|
1793
1537
|
child.removeAttribute(attrName);
|
|
1794
1538
|
const callback = (newAttrValue) => {
|
|
1795
1539
|
if (newAttrValue instanceof Function) {
|
|
1796
|
-
newAttrValue = (0,_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_2__.bindSubjectCallback)(newAttrValue,
|
|
1540
|
+
newAttrValue = (0,_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_2__.bindSubjectCallback)(newAttrValue, ownerSupport);
|
|
1797
1541
|
}
|
|
1798
1542
|
return processAttributeSubjectValue(newAttrValue, child, attrName, isSpecial, howToSet);
|
|
1799
1543
|
};
|
|
1800
1544
|
// 🗞️ Subscribe. Above callback called immediately since its a ValueSubject()
|
|
1801
1545
|
const sub = result.subscribe(callback);
|
|
1802
1546
|
// Record subscription for later unsubscribe when element destroyed
|
|
1803
|
-
|
|
1547
|
+
ownerSupport.global.subscriptions.push(sub);
|
|
1804
1548
|
return;
|
|
1805
1549
|
}
|
|
1806
1550
|
howToSet(child, attrName, result);
|
|
@@ -1839,6 +1583,127 @@ function isSpecialAttr(attrName) {
|
|
|
1839
1583
|
}
|
|
1840
1584
|
|
|
1841
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;
|
|
1677
|
+
}
|
|
1678
|
+
const everyStringMatched = strings0.every((string, index) => strings1[index] === string);
|
|
1679
|
+
if (!everyStringMatched) {
|
|
1680
|
+
return false;
|
|
1681
|
+
}
|
|
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;
|
|
1687
|
+
}
|
|
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;
|
|
1702
|
+
}
|
|
1703
|
+
return false;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
|
|
1842
1707
|
/***/ }),
|
|
1843
1708
|
|
|
1844
1709
|
/***/ "./ts/processNewValue.function.ts":
|
|
@@ -1853,32 +1718,50 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1853
1718
|
/* harmony export */ });
|
|
1854
1719
|
/* harmony import */ var _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subject/ValueSubject */ "./ts/subject/ValueSubject.ts");
|
|
1855
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");
|
|
1723
|
+
|
|
1724
|
+
|
|
1856
1725
|
|
|
1857
1726
|
|
|
1858
|
-
function processNewValue(hasValue, value,
|
|
1727
|
+
function processNewValue(hasValue, value, ownerSupport) {
|
|
1859
1728
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value)) {
|
|
1860
1729
|
const tagSubject = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1861
1730
|
return tagSubject;
|
|
1862
1731
|
}
|
|
1863
1732
|
if (value instanceof Function) {
|
|
1864
|
-
// return getSubjectFunction(value, ownerTag)
|
|
1865
1733
|
return new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1866
1734
|
}
|
|
1867
1735
|
if (!hasValue) {
|
|
1868
|
-
return
|
|
1736
|
+
return new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(undefined);
|
|
1869
1737
|
}
|
|
1870
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
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);
|
|
1876
1745
|
}
|
|
1746
|
+
// is already a value subject?
|
|
1877
1747
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isSubjectInstance)(value)) {
|
|
1878
|
-
return value;
|
|
1748
|
+
return value;
|
|
1879
1749
|
}
|
|
1880
1750
|
return new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
1881
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
|
+
}
|
|
1882
1765
|
|
|
1883
1766
|
|
|
1884
1767
|
/***/ }),
|
|
@@ -1923,18 +1806,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1923
1806
|
/* harmony export */ processSubjectComponent: () => (/* binding */ processSubjectComponent)
|
|
1924
1807
|
/* harmony export */ });
|
|
1925
1808
|
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
1926
|
-
/* harmony import */ var
|
|
1809
|
+
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "./ts/state/index.ts");
|
|
1927
1810
|
/* harmony import */ var _processTagResult_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./processTagResult.function */ "./ts/processTagResult.function.ts");
|
|
1928
1811
|
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
1929
1812
|
|
|
1930
1813
|
|
|
1931
1814
|
|
|
1932
1815
|
|
|
1933
|
-
function processSubjectComponent(templater, subject, insertBefore,
|
|
1816
|
+
function processSubjectComponent(templater, subject, insertBefore, ownerSupport, options) {
|
|
1934
1817
|
// Check if function component is wrapped in a tag() call
|
|
1935
1818
|
// TODO: This below check not needed in production mode
|
|
1936
1819
|
if (templater.tagged !== true) {
|
|
1937
|
-
const
|
|
1820
|
+
const wrapper = templater.wrapper;
|
|
1821
|
+
const original = wrapper.original;
|
|
1938
1822
|
let name = original.name || original.constructor?.name;
|
|
1939
1823
|
if (name === 'Function') {
|
|
1940
1824
|
name = undefined;
|
|
@@ -1943,44 +1827,35 @@ function processSubjectComponent(templater, subject, insertBefore, ownerTag, opt
|
|
|
1943
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`);
|
|
1944
1828
|
throw error;
|
|
1945
1829
|
}
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
}
|
|
1959
|
-
(0,_processTagResult_function__WEBPACK_IMPORTED_MODULE_2__.processTagResult)(retag, subject, // The element set here will be removed from document. Also result.tag will be added in here
|
|
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;
|
|
1834
|
+
const providers = _state__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
1835
|
+
providers.ownerSupport = ownerSupport;
|
|
1836
|
+
const isRender = !reSupport || options.forceElement;
|
|
1837
|
+
if (isRender) {
|
|
1838
|
+
const support = reSupport || tagSupport;
|
|
1839
|
+
reSupport = renderSubjectComponent(subject, support, ownerSupport);
|
|
1840
|
+
}
|
|
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
|
|
1960
1842
|
insertBefore, // <template end interpolate /> (will be removed)
|
|
1961
1843
|
options);
|
|
1962
|
-
return
|
|
1844
|
+
return reSupport;
|
|
1963
1845
|
}
|
|
1964
|
-
function
|
|
1965
|
-
const preClones =
|
|
1966
|
-
|
|
1967
|
-
subject,
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
retag.clones.push(...myClones);
|
|
1975
|
-
if (myClones.find(x => x === insertBefore)) {
|
|
1976
|
-
throw new Error('way back here we add marker');
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
if (ownerTag.childTags.find(x => x === retag)) {
|
|
1980
|
-
throw new Error('about to reattach tag already present');
|
|
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);
|
|
1981
1856
|
}
|
|
1982
|
-
|
|
1983
|
-
return
|
|
1857
|
+
ownerSupport.childTags.push(reSupport);
|
|
1858
|
+
return reSupport;
|
|
1984
1859
|
}
|
|
1985
1860
|
|
|
1986
1861
|
|
|
@@ -2009,6 +1884,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2009
1884
|
var ValueTypes;
|
|
2010
1885
|
(function (ValueTypes) {
|
|
2011
1886
|
ValueTypes["tag"] = "tag";
|
|
1887
|
+
ValueTypes["templater"] = "templater";
|
|
2012
1888
|
ValueTypes["tagArray"] = "tag-array";
|
|
2013
1889
|
ValueTypes["tagComponent"] = "tag-component";
|
|
2014
1890
|
ValueTypes["value"] = "value";
|
|
@@ -2017,7 +1893,10 @@ function getValueType(value) {
|
|
|
2017
1893
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value)) {
|
|
2018
1894
|
return ValueTypes.tagComponent;
|
|
2019
1895
|
}
|
|
2020
|
-
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)) {
|
|
2021
1900
|
return ValueTypes.tag;
|
|
2022
1901
|
}
|
|
2023
1902
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagArray)(value)) {
|
|
@@ -2025,19 +1904,28 @@ function getValueType(value) {
|
|
|
2025
1904
|
}
|
|
2026
1905
|
return ValueTypes.value;
|
|
2027
1906
|
}
|
|
1907
|
+
// export type ExistingValue = TemplaterResult | Tag[] | TagSupport | Function | Subject<unknown> | RegularValue | Tag
|
|
2028
1908
|
function processSubjectValue(value, subject, // could be tag via result.tag
|
|
2029
1909
|
insertBefore, // <template end interpolate /> (will be removed)
|
|
2030
|
-
|
|
1910
|
+
ownerSupport, // owner
|
|
2031
1911
|
options) {
|
|
2032
1912
|
const valueType = getValueType(value);
|
|
2033
1913
|
switch (valueType) {
|
|
1914
|
+
case ValueTypes.templater:
|
|
1915
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_4__.processTag)(value, insertBefore, ownerSupport, subject);
|
|
1916
|
+
return;
|
|
2034
1917
|
case ValueTypes.tag:
|
|
2035
|
-
|
|
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);
|
|
2036
1924
|
return;
|
|
2037
1925
|
case ValueTypes.tagArray:
|
|
2038
|
-
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);
|
|
2039
1927
|
case ValueTypes.tagComponent:
|
|
2040
|
-
(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);
|
|
2041
1929
|
return;
|
|
2042
1930
|
}
|
|
2043
1931
|
(0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_3__.processRegularValue)(value, subject, insertBefore);
|
|
@@ -2054,68 +1942,53 @@ options) {
|
|
|
2054
1942
|
|
|
2055
1943
|
__webpack_require__.r(__webpack_exports__);
|
|
2056
1944
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2057
|
-
/* harmony export */
|
|
2058
|
-
/* 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)
|
|
2059
1949
|
/* harmony export */ });
|
|
2060
|
-
/* harmony import */ var
|
|
2061
|
-
/* harmony import */ var
|
|
2062
|
-
/* harmony import */ var _subject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./subject */ "./ts/subject/index.ts");
|
|
2063
|
-
|
|
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");
|
|
2064
1952
|
|
|
2065
1953
|
|
|
2066
1954
|
/** Could be a regular tag or a component. Both are Tag.class */
|
|
2067
|
-
function processTag(
|
|
2068
|
-
|
|
1955
|
+
function processTag(templater, insertBefore, ownerSupport, // owner
|
|
1956
|
+
subject) {
|
|
1957
|
+
let tagSupport = subject.tagSupport;
|
|
2069
1958
|
// first time seeing this tag?
|
|
2070
|
-
if (!
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
ownerTag.childTags.push(tag);
|
|
2079
|
-
}
|
|
2080
|
-
tag.ownerTag = ownerTag;
|
|
2081
|
-
if (insertBefore.tagName !== 'TEMPLATE') {
|
|
2082
|
-
throw new Error(`processTag.function.ts - insertBefore is not TEMPLATE ${insertBefore.tagName}`);
|
|
2083
|
-
}
|
|
2084
|
-
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, {
|
|
2085
1967
|
counts: { added: 0, removed: 0 },
|
|
2086
1968
|
forceElement: true,
|
|
2087
1969
|
});
|
|
2088
1970
|
}
|
|
2089
|
-
function
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
}
|
|
2093
|
-
const fakeTemplater = getFakeTemplater();
|
|
2094
|
-
tag.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_1__.TagSupport(ownerTag.tagSupport, fakeTemplater, // the template is provided via html`` call
|
|
2095
|
-
subject);
|
|
2096
|
-
fakeTemplater.global.oldest = tag;
|
|
2097
|
-
fakeTemplater.global.newest = tag;
|
|
2098
|
-
fakeTemplater.tagSupport = tag.tagSupport;
|
|
1971
|
+
function setupNewTemplater(tagSupport, ownerSupport, subject) {
|
|
1972
|
+
tagSupport.global.oldest = tagSupport;
|
|
1973
|
+
tagSupport.global.newest = tagSupport;
|
|
2099
1974
|
// asking me to render will cause my parent to render
|
|
2100
|
-
|
|
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;
|
|
2101
1983
|
}
|
|
2102
1984
|
function getFakeTemplater() {
|
|
2103
1985
|
return {
|
|
2104
|
-
|
|
2105
|
-
renderCount: 0,
|
|
2106
|
-
providers: [],
|
|
2107
|
-
context: {},
|
|
2108
|
-
subscriptions: [],
|
|
2109
|
-
deleted: false,
|
|
2110
|
-
newestTemplater: {},
|
|
2111
|
-
},
|
|
2112
|
-
children: new _subject__WEBPACK_IMPORTED_MODULE_2__.ValueSubject([]), // no children
|
|
1986
|
+
children: new _subject__WEBPACK_IMPORTED_MODULE_1__.ValueSubject([]), // no children
|
|
2113
1987
|
props: {},
|
|
2114
1988
|
isTag: true,
|
|
2115
1989
|
isTemplater: false,
|
|
2116
1990
|
tagged: false,
|
|
2117
|
-
wrapper: (() => undefined),
|
|
2118
|
-
tagSupport: {},
|
|
1991
|
+
// wrapper: (() => undefined) as unknown as Wrapper,
|
|
2119
1992
|
};
|
|
2120
1993
|
}
|
|
2121
1994
|
|
|
@@ -2136,14 +2009,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2136
2009
|
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors */ "./ts/errors.ts");
|
|
2137
2010
|
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./checkDestroyPrevious.function */ "./ts/checkDestroyPrevious.function.ts");
|
|
2138
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
|
+
|
|
2139
2016
|
|
|
2140
2017
|
|
|
2141
2018
|
|
|
2142
2019
|
|
|
2143
2020
|
function processTagArray(subject, value, // arry of Tag classes
|
|
2144
2021
|
insertBefore, // <template end interpolate />
|
|
2145
|
-
|
|
2146
|
-
const clones =
|
|
2022
|
+
ownerSupport, options) {
|
|
2023
|
+
const clones = ownerSupport.clones; // []
|
|
2147
2024
|
let lastArray = subject.lastArray = subject.lastArray || [];
|
|
2148
2025
|
if (!subject.placeholder) {
|
|
2149
2026
|
setPlaceholderElm(insertBefore, subject);
|
|
@@ -2155,14 +2032,17 @@ ownerTag, options) {
|
|
|
2155
2032
|
const newLength = value.length - 1;
|
|
2156
2033
|
const at = index - removed;
|
|
2157
2034
|
const lessLength = newLength < at;
|
|
2158
|
-
const
|
|
2159
|
-
const
|
|
2160
|
-
const tag =
|
|
2161
|
-
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);
|
|
2162
2042
|
if (destroyItem) {
|
|
2163
2043
|
const last = lastArray[index];
|
|
2164
|
-
const
|
|
2165
|
-
(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);
|
|
2166
2046
|
last.deleted = true;
|
|
2167
2047
|
++removed;
|
|
2168
2048
|
++options.counts.removed;
|
|
@@ -2170,22 +2050,28 @@ ownerTag, options) {
|
|
|
2170
2050
|
}
|
|
2171
2051
|
return true;
|
|
2172
2052
|
});
|
|
2173
|
-
value.forEach((
|
|
2053
|
+
value.forEach((item, index) => {
|
|
2174
2054
|
const previous = lastArray[index];
|
|
2175
|
-
const previousSupport = previous?.
|
|
2176
|
-
const
|
|
2177
|
-
(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
|
|
2178
2062
|
if (previousSupport) {
|
|
2179
|
-
|
|
2180
|
-
|
|
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;
|
|
2181
2067
|
}
|
|
2182
2068
|
// check for html``.key()
|
|
2183
2069
|
const keySet = 'arrayValue' in subTag.memory;
|
|
2184
2070
|
if (!keySet) {
|
|
2185
2071
|
const details = {
|
|
2186
|
-
template:
|
|
2072
|
+
template: tagSupport.getTemplate().string,
|
|
2187
2073
|
array: value,
|
|
2188
|
-
ownerTagContent:
|
|
2074
|
+
ownerTagContent: ownerSupport.lastTemplateString,
|
|
2189
2075
|
};
|
|
2190
2076
|
const message = 'Use html`...`.key(item) instead of html`...` to template an Array';
|
|
2191
2077
|
console.error(message, details);
|
|
@@ -2194,22 +2080,15 @@ ownerTag, options) {
|
|
|
2194
2080
|
}
|
|
2195
2081
|
const couldBeSame = lastArray.length > index;
|
|
2196
2082
|
if (couldBeSame) {
|
|
2197
|
-
const prevSupport = previous.
|
|
2198
|
-
const prevGlobal = prevSupport.
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
// TODO: should not get here?
|
|
2207
|
-
processAddTagArrayItem(runtimeInsertBefore, subTag, index, options, lastArray);
|
|
2208
|
-
throw new Error('item should be back');
|
|
2209
|
-
// return [] // removed: item should have been previously deleted and will be added back
|
|
2210
|
-
}
|
|
2211
|
-
processAddTagArrayItem(runtimeInsertBefore, subTag, index, options, lastArray);
|
|
2212
|
-
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);
|
|
2213
2092
|
});
|
|
2214
2093
|
return clones;
|
|
2215
2094
|
}
|
|
@@ -2223,9 +2102,9 @@ function setPlaceholderElm(insertBefore, subject) {
|
|
|
2223
2102
|
parentNode.insertBefore(placeholder, insertBefore);
|
|
2224
2103
|
parentNode.removeChild(insertBefore);
|
|
2225
2104
|
}
|
|
2226
|
-
function processAddTagArrayItem(before,
|
|
2105
|
+
function processAddTagArrayItem(before, tagSupport, index, options, lastArray) {
|
|
2227
2106
|
const lastValue = {
|
|
2228
|
-
|
|
2107
|
+
tagSupport, index
|
|
2229
2108
|
};
|
|
2230
2109
|
// Added to previous array
|
|
2231
2110
|
lastArray.push(lastValue);
|
|
@@ -2233,12 +2112,10 @@ function processAddTagArrayItem(before, subTag, index, options, lastArray) {
|
|
|
2233
2112
|
added: options.counts.added + index,
|
|
2234
2113
|
removed: options.counts.removed,
|
|
2235
2114
|
};
|
|
2236
|
-
if (!before.parentNode) {
|
|
2237
|
-
throw new Error('issue adding array item');
|
|
2238
|
-
}
|
|
2239
2115
|
const newTempElm = document.createElement('template');
|
|
2240
|
-
before.parentNode
|
|
2241
|
-
|
|
2116
|
+
const parent = before.parentNode;
|
|
2117
|
+
parent.insertBefore(newTempElm, before);
|
|
2118
|
+
tagSupport.buildBeforeElement(newTempElm, // before,
|
|
2242
2119
|
{ counts, forceElement: options.forceElement });
|
|
2243
2120
|
}
|
|
2244
2121
|
/** compare two values. If both values are arrays then the items will be compared */
|
|
@@ -2267,134 +2144,493 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2267
2144
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2268
2145
|
/* harmony export */ processTagResult: () => (/* binding */ processTagResult)
|
|
2269
2146
|
/* harmony export */ });
|
|
2270
|
-
function processTagResult(
|
|
2147
|
+
function processTagResult(tagSupport, subject, // used for recording past and current value
|
|
2271
2148
|
insertBefore, // <template end interpolate />
|
|
2272
2149
|
{ counts, forceElement, }) {
|
|
2273
|
-
if (!insertBefore.parentNode) {
|
|
2274
|
-
throw new Error(`before here processTagResult ${insertBefore.nodeName}`);
|
|
2275
|
-
}
|
|
2276
2150
|
// *if appears we already have seen
|
|
2277
2151
|
const subjectTag = subject;
|
|
2278
|
-
const
|
|
2279
|
-
const
|
|
2280
|
-
const justUpdate =
|
|
2281
|
-
if (
|
|
2282
|
-
|
|
2283
|
-
const areLike = previousTag.isLikeTag(tag)
|
|
2284
|
-
|
|
2285
|
-
// are we just updating an if we already had?
|
|
2286
|
-
if(areLike) {
|
|
2287
|
-
return processTagResultUpdate(tag, subjectTag, previousTag)
|
|
2288
|
-
}
|
|
2289
|
-
*/
|
|
2290
|
-
return processTagResultUpdate(tag, subjectTag, previousTag);
|
|
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);
|
|
2291
2157
|
}
|
|
2292
|
-
|
|
2293
|
-
if(insertBefore.nodeName !== 'TEMPLATE') {
|
|
2294
|
-
throw new Error(`processTagResult.function.ts insertBefore is not template ${insertBefore.nodeName}`)
|
|
2295
|
-
}
|
|
2296
|
-
*/
|
|
2297
|
-
tag.buildBeforeElement(insertBefore, {
|
|
2158
|
+
tagSupport.buildBeforeElement(insertBefore, {
|
|
2298
2159
|
counts,
|
|
2299
2160
|
forceElement,
|
|
2300
2161
|
});
|
|
2301
2162
|
}
|
|
2302
|
-
function processTagResultUpdate(
|
|
2303
|
-
|
|
2163
|
+
function processTagResultUpdate(tagSupport, subject, // used for recording past and current value
|
|
2164
|
+
prevSupport) {
|
|
2304
2165
|
// components
|
|
2305
2166
|
if (subject instanceof Function) {
|
|
2306
|
-
const
|
|
2307
|
-
|
|
2308
|
-
subject.
|
|
2167
|
+
const newSupport = subject(prevSupport);
|
|
2168
|
+
prevSupport.updateBy(newSupport);
|
|
2169
|
+
subject.tagSupport = newSupport;
|
|
2309
2170
|
return;
|
|
2310
2171
|
}
|
|
2311
|
-
|
|
2312
|
-
subject.
|
|
2172
|
+
prevSupport.updateBy(tagSupport);
|
|
2173
|
+
subject.tagSupport = tagSupport;
|
|
2313
2174
|
return;
|
|
2314
2175
|
}
|
|
2315
2176
|
|
|
2316
2177
|
|
|
2317
2178
|
/***/ }),
|
|
2318
2179
|
|
|
2319
|
-
/***/ "./ts/
|
|
2320
|
-
|
|
2321
|
-
!*** ./ts/
|
|
2322
|
-
|
|
2180
|
+
/***/ "./ts/render.ts":
|
|
2181
|
+
/*!**********************!*\
|
|
2182
|
+
!*** ./ts/render.ts ***!
|
|
2183
|
+
\**********************/
|
|
2323
2184
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2324
2185
|
|
|
2325
2186
|
__webpack_require__.r(__webpack_exports__);
|
|
2326
2187
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2327
|
-
/* harmony export */
|
|
2188
|
+
/* harmony export */ buildClones: () => (/* binding */ buildClones)
|
|
2189
|
+
/* harmony export */ });
|
|
2190
|
+
function buildClones(temporary, insertBefore) {
|
|
2191
|
+
const clones = [];
|
|
2192
|
+
const template = temporary.children[0];
|
|
2193
|
+
let nextSibling = template.content.firstChild;
|
|
2194
|
+
while (nextSibling) {
|
|
2195
|
+
const nextNextSibling = nextSibling.nextSibling;
|
|
2196
|
+
buildSibling(nextSibling, insertBefore);
|
|
2197
|
+
clones.push(nextSibling);
|
|
2198
|
+
nextSibling = nextNextSibling;
|
|
2199
|
+
}
|
|
2200
|
+
return clones;
|
|
2201
|
+
}
|
|
2202
|
+
function buildSibling(nextSibling, insertBefore) {
|
|
2203
|
+
const parentNode = insertBefore.parentNode;
|
|
2204
|
+
parentNode.insertBefore(nextSibling, insertBefore);
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
|
|
2208
|
+
/***/ }),
|
|
2209
|
+
|
|
2210
|
+
/***/ "./ts/renderExistingTag.function.ts":
|
|
2211
|
+
/*!******************************************!*\
|
|
2212
|
+
!*** ./ts/renderExistingTag.function.ts ***!
|
|
2213
|
+
\******************************************/
|
|
2214
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2215
|
+
|
|
2216
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2217
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2218
|
+
/* harmony export */ renderExistingTag: () => (/* binding */ renderExistingTag)
|
|
2219
|
+
/* harmony export */ });
|
|
2220
|
+
/* harmony import */ var _state_provider_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./state/provider.utils */ "./ts/state/provider.utils.ts");
|
|
2221
|
+
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
2222
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
2223
|
+
|
|
2224
|
+
|
|
2225
|
+
|
|
2226
|
+
/** Returns true when rendering owner is not needed. Returns false when rendering owner should occur */
|
|
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);
|
|
2237
|
+
// When the providers were checked, a render to myself occurred and I do not need to re-render again
|
|
2238
|
+
const prevSupport = global.newest;
|
|
2239
|
+
if (preRenderCount !== global.renderCount) {
|
|
2240
|
+
oldestSupport.updateBy(prevSupport);
|
|
2241
|
+
return prevSupport; // already rendered during triggered events
|
|
2242
|
+
}
|
|
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);
|
|
2254
|
+
}
|
|
2255
|
+
return reSupport;
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
|
|
2259
|
+
/***/ }),
|
|
2260
|
+
|
|
2261
|
+
/***/ "./ts/renderTagSupport.function.ts":
|
|
2262
|
+
/*!*****************************************!*\
|
|
2263
|
+
!*** ./ts/renderTagSupport.function.ts ***!
|
|
2264
|
+
\*****************************************/
|
|
2265
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2266
|
+
|
|
2267
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2268
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2269
|
+
/* harmony export */ renderTagSupport: () => (/* binding */ renderTagSupport)
|
|
2328
2270
|
/* harmony export */ });
|
|
2329
2271
|
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
2330
|
-
/* harmony import */ var
|
|
2272
|
+
/* harmony import */ var _renderExistingTag_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./renderExistingTag.function */ "./ts/renderExistingTag.function.ts");
|
|
2273
|
+
|
|
2274
|
+
|
|
2275
|
+
/** Main function used by all other callers to render/update display of a tag component */
|
|
2276
|
+
function renderTagSupport(tagSupport, renderUp) {
|
|
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)
|
|
2281
|
+
const newTag = global.newest;
|
|
2282
|
+
const ownerTag = newTag.ownerTagSupport;
|
|
2283
|
+
++global.renderCount;
|
|
2284
|
+
return renderTagSupport(ownerTag, true);
|
|
2285
|
+
}
|
|
2286
|
+
const subject = tagSupport.subject;
|
|
2287
|
+
const newest = global.newest;
|
|
2288
|
+
let ownerSupport;
|
|
2289
|
+
let selfPropChange = false;
|
|
2290
|
+
const shouldRenderUp = renderUp && newest;
|
|
2291
|
+
if (shouldRenderUp) {
|
|
2292
|
+
ownerSupport = newest.ownerTagSupport;
|
|
2293
|
+
if (ownerSupport) {
|
|
2294
|
+
const nowProps = templater.props;
|
|
2295
|
+
const latestProps = newest.propsConfig.latestCloned;
|
|
2296
|
+
selfPropChange = !(0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(nowProps, latestProps);
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
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;
|
|
2304
|
+
if (renderOwner) {
|
|
2305
|
+
const ownerTagSupport = ownerSupport;
|
|
2306
|
+
renderTagSupport(ownerTagSupport, true);
|
|
2307
|
+
return tag;
|
|
2308
|
+
}
|
|
2309
|
+
return tag;
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
|
|
2313
|
+
/***/ }),
|
|
2314
|
+
|
|
2315
|
+
/***/ "./ts/setTagPlaceholder.function.ts":
|
|
2316
|
+
/*!******************************************!*\
|
|
2317
|
+
!*** ./ts/setTagPlaceholder.function.ts ***!
|
|
2318
|
+
\******************************************/
|
|
2319
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2320
|
+
|
|
2321
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2322
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2323
|
+
/* harmony export */ setTagPlaceholder: () => (/* binding */ setTagPlaceholder)
|
|
2324
|
+
/* harmony export */ });
|
|
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);
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
|
|
2334
|
+
/***/ }),
|
|
2335
|
+
|
|
2336
|
+
/***/ "./ts/state/callbackMaker.function.ts":
|
|
2337
|
+
/*!********************************************!*\
|
|
2338
|
+
!*** ./ts/state/callbackMaker.function.ts ***!
|
|
2339
|
+
\********************************************/
|
|
2340
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2341
|
+
|
|
2342
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2343
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2344
|
+
/* harmony export */ callbackMaker: () => (/* binding */ callbackMaker)
|
|
2345
|
+
/* harmony export */ });
|
|
2346
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2347
|
+
/* harmony import */ var _state_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state.utils */ "./ts/state/state.utils.ts");
|
|
2348
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
2349
|
+
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../errors */ "./ts/errors.ts");
|
|
2350
|
+
|
|
2351
|
+
|
|
2352
|
+
|
|
2353
|
+
|
|
2354
|
+
let innerCallback = (callback) => (a, b, c, d, e, f) => {
|
|
2355
|
+
throw new _errors__WEBPACK_IMPORTED_MODULE_3__.SyncCallbackError('Callback function was called immediately in sync and must instead be call async');
|
|
2356
|
+
};
|
|
2357
|
+
const callbackMaker = () => innerCallback;
|
|
2358
|
+
const originalGetter = innerCallback; // callbackMaker
|
|
2359
|
+
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
2360
|
+
beforeRender: (tagSupport) => initMemory(tagSupport),
|
|
2361
|
+
beforeRedraw: (tagSupport) => initMemory(tagSupport),
|
|
2362
|
+
afterRender: (_tagSupport) => {
|
|
2363
|
+
innerCallback = originalGetter; // prevent crossing callbacks with another tag
|
|
2364
|
+
},
|
|
2365
|
+
});
|
|
2366
|
+
function updateState(stateFrom, stateTo) {
|
|
2367
|
+
stateFrom.forEach((state, index) => {
|
|
2368
|
+
const fromValue = (0,_state_utils__WEBPACK_IMPORTED_MODULE_1__.getStateValue)(state);
|
|
2369
|
+
const callback = stateTo[index].callback;
|
|
2370
|
+
if (callback) {
|
|
2371
|
+
callback(fromValue); // set the value
|
|
2372
|
+
}
|
|
2373
|
+
stateTo[index].lastValue = fromValue; // record the value
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2376
|
+
function initMemory(tagSupport) {
|
|
2377
|
+
const oldState = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.stateConfig.array;
|
|
2378
|
+
innerCallback = (callback) => {
|
|
2379
|
+
const trigger = (...args) => triggerStateUpdate(tagSupport, callback, oldState, ...args);
|
|
2380
|
+
return trigger;
|
|
2381
|
+
};
|
|
2382
|
+
}
|
|
2383
|
+
function triggerStateUpdate(tagSupport, callback, oldState, ...args) {
|
|
2384
|
+
const state = tagSupport.memory.state;
|
|
2385
|
+
// ensure that the oldest has the latest values first
|
|
2386
|
+
updateState(state, oldState);
|
|
2387
|
+
// run the callback
|
|
2388
|
+
const promise = callback(...args);
|
|
2389
|
+
// send the oldest state changes into the newest
|
|
2390
|
+
updateState(oldState, state);
|
|
2391
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
2392
|
+
if (promise instanceof Promise) {
|
|
2393
|
+
promise.finally(() => {
|
|
2394
|
+
// send the oldest state changes into the newest
|
|
2395
|
+
updateState(oldState, state);
|
|
2396
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
2397
|
+
});
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
|
|
2402
|
+
/***/ }),
|
|
2403
|
+
|
|
2404
|
+
/***/ "./ts/state/index.ts":
|
|
2405
|
+
/*!***************************!*\
|
|
2406
|
+
!*** ./ts/state/index.ts ***!
|
|
2407
|
+
\***************************/
|
|
2408
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2409
|
+
|
|
2410
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2411
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2412
|
+
/* harmony export */ callbackMaker: () => (/* reexport safe */ _callbackMaker_function__WEBPACK_IMPORTED_MODULE_6__.callbackMaker),
|
|
2413
|
+
/* harmony export */ letState: () => (/* reexport safe */ _letState_function__WEBPACK_IMPORTED_MODULE_3__.letState),
|
|
2414
|
+
/* harmony export */ onDestroy: () => (/* reexport safe */ _onDestroy__WEBPACK_IMPORTED_MODULE_8__.onDestroy),
|
|
2415
|
+
/* harmony export */ onInit: () => (/* reexport safe */ _onInit__WEBPACK_IMPORTED_MODULE_7__.onInit),
|
|
2416
|
+
/* harmony export */ providers: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_5__.providers),
|
|
2417
|
+
/* harmony export */ setProp: () => (/* reexport safe */ _setProp_function__WEBPACK_IMPORTED_MODULE_4__.setProp),
|
|
2418
|
+
/* harmony export */ setUse: () => (/* reexport safe */ _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse),
|
|
2419
|
+
/* harmony export */ state: () => (/* reexport safe */ _state_function__WEBPACK_IMPORTED_MODULE_2__.state),
|
|
2420
|
+
/* harmony export */ watch: () => (/* reexport safe */ _watch_function__WEBPACK_IMPORTED_MODULE_0__.watch)
|
|
2421
|
+
/* harmony export */ });
|
|
2422
|
+
/* harmony import */ var _watch_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./watch.function */ "./ts/state/watch.function.ts");
|
|
2423
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2424
|
+
/* harmony import */ var _state_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./state.function */ "./ts/state/state.function.ts");
|
|
2425
|
+
/* harmony import */ var _letState_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./letState.function */ "./ts/state/letState.function.ts");
|
|
2426
|
+
/* harmony import */ var _setProp_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./setProp.function */ "./ts/state/setProp.function.ts");
|
|
2427
|
+
/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./providers */ "./ts/state/providers.ts");
|
|
2428
|
+
/* harmony import */ var _callbackMaker_function__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./callbackMaker.function */ "./ts/state/callbackMaker.function.ts");
|
|
2429
|
+
/* harmony import */ var _onInit__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./onInit */ "./ts/state/onInit.ts");
|
|
2430
|
+
/* harmony import */ var _onDestroy__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./onDestroy */ "./ts/state/onDestroy.ts");
|
|
2431
|
+
|
|
2432
|
+
|
|
2433
|
+
|
|
2434
|
+
|
|
2435
|
+
|
|
2436
|
+
|
|
2437
|
+
|
|
2438
|
+
|
|
2439
|
+
|
|
2440
|
+
|
|
2441
|
+
|
|
2442
|
+
/***/ }),
|
|
2443
|
+
|
|
2444
|
+
/***/ "./ts/state/letState.function.ts":
|
|
2445
|
+
/*!***************************************!*\
|
|
2446
|
+
!*** ./ts/state/letState.function.ts ***!
|
|
2447
|
+
\***************************************/
|
|
2448
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2449
|
+
|
|
2450
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2451
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2452
|
+
/* harmony export */ letState: () => (/* binding */ letState)
|
|
2453
|
+
/* harmony export */ });
|
|
2454
|
+
/* harmony import */ var _state_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./state.utils */ "./ts/state/state.utils.ts");
|
|
2455
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2456
|
+
|
|
2457
|
+
|
|
2458
|
+
/** Used for variables that need to remain the same variable during render passes */
|
|
2459
|
+
function letState(defaultValue) {
|
|
2460
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2461
|
+
const rearray = config.rearray;
|
|
2462
|
+
let getSetMethod;
|
|
2463
|
+
const restate = rearray[config.array.length];
|
|
2464
|
+
if (restate) {
|
|
2465
|
+
let oldValue = (0,_state_utils__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(restate);
|
|
2466
|
+
getSetMethod = ((x) => [oldValue, oldValue = x]);
|
|
2467
|
+
const push = {
|
|
2468
|
+
get: () => (0,_state_utils__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2469
|
+
callback: getSetMethod,
|
|
2470
|
+
lastValue: oldValue,
|
|
2471
|
+
defaultValue: restate.defaultValue,
|
|
2472
|
+
};
|
|
2473
|
+
config.array.push(push);
|
|
2474
|
+
return makeStateResult(oldValue, push);
|
|
2475
|
+
}
|
|
2476
|
+
// State first time run
|
|
2477
|
+
const defaultFn = defaultValue instanceof Function ? defaultValue : () => defaultValue;
|
|
2478
|
+
let initValue = defaultFn();
|
|
2479
|
+
getSetMethod = ((x) => [initValue, initValue = x]);
|
|
2480
|
+
const push = {
|
|
2481
|
+
get: () => (0,_state_utils__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2482
|
+
callback: getSetMethod,
|
|
2483
|
+
lastValue: initValue,
|
|
2484
|
+
defaultValue: initValue,
|
|
2485
|
+
};
|
|
2486
|
+
config.array.push(push);
|
|
2487
|
+
return makeStateResult(initValue, push);
|
|
2488
|
+
}
|
|
2489
|
+
function makeStateResult(initValue, push) {
|
|
2490
|
+
// return initValue
|
|
2491
|
+
const result = (y) => {
|
|
2492
|
+
push.callback = y || (x => [initValue, initValue = x]);
|
|
2493
|
+
return initValue;
|
|
2494
|
+
};
|
|
2495
|
+
return result;
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
|
|
2499
|
+
/***/ }),
|
|
2500
|
+
|
|
2501
|
+
/***/ "./ts/state/onDestroy.ts":
|
|
2502
|
+
/*!*******************************!*\
|
|
2503
|
+
!*** ./ts/state/onDestroy.ts ***!
|
|
2504
|
+
\*******************************/
|
|
2505
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2506
|
+
|
|
2507
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2508
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2509
|
+
/* harmony export */ onDestroy: () => (/* binding */ onDestroy)
|
|
2510
|
+
/* harmony export */ });
|
|
2511
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2512
|
+
|
|
2513
|
+
/** When undefined, it means a tag is being built for the first time so do run destroy(s) */
|
|
2514
|
+
let destroyCurrentTagSupport;
|
|
2515
|
+
function onDestroy(callback) {
|
|
2516
|
+
destroyCurrentTagSupport.global.destroyCallback = callback;
|
|
2517
|
+
}
|
|
2518
|
+
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
2519
|
+
beforeRender: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
2520
|
+
beforeRedraw: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
2521
|
+
beforeDestroy: (tagSupport, tag) => {
|
|
2522
|
+
const callback = tagSupport.global.destroyCallback;
|
|
2523
|
+
if (callback) {
|
|
2524
|
+
callback();
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
});
|
|
2528
|
+
|
|
2529
|
+
|
|
2530
|
+
/***/ }),
|
|
2531
|
+
|
|
2532
|
+
/***/ "./ts/state/onInit.ts":
|
|
2533
|
+
/*!****************************!*\
|
|
2534
|
+
!*** ./ts/state/onInit.ts ***!
|
|
2535
|
+
\****************************/
|
|
2536
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2537
|
+
|
|
2538
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2539
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2540
|
+
/* harmony export */ onInit: () => (/* binding */ onInit)
|
|
2541
|
+
/* harmony export */ });
|
|
2542
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2543
|
+
|
|
2544
|
+
function setCurrentTagSupport(support) {
|
|
2545
|
+
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentSupport = support;
|
|
2546
|
+
}
|
|
2547
|
+
function onInit(callback) {
|
|
2548
|
+
const tagSupport = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentSupport;
|
|
2549
|
+
if (!tagSupport.global.init) {
|
|
2550
|
+
tagSupport.global.init = callback;
|
|
2551
|
+
callback(); // fire init
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
2555
|
+
beforeRender: tagSupport => setCurrentTagSupport(tagSupport),
|
|
2556
|
+
beforeRedraw: tagSupport => setCurrentTagSupport(tagSupport),
|
|
2557
|
+
});
|
|
2558
|
+
|
|
2559
|
+
|
|
2560
|
+
/***/ }),
|
|
2561
|
+
|
|
2562
|
+
/***/ "./ts/state/provider.utils.ts":
|
|
2563
|
+
/*!************************************!*\
|
|
2564
|
+
!*** ./ts/state/provider.utils.ts ***!
|
|
2565
|
+
\************************************/
|
|
2566
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2567
|
+
|
|
2568
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2569
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2570
|
+
/* harmony export */ providersChangeCheck: () => (/* binding */ providersChangeCheck)
|
|
2571
|
+
/* harmony export */ });
|
|
2572
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../deepFunctions */ "./ts/deepFunctions.ts");
|
|
2573
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
2331
2574
|
|
|
2332
2575
|
|
|
2333
|
-
function providersChangeCheck(
|
|
2334
|
-
const global =
|
|
2576
|
+
function providersChangeCheck(tagSupport) {
|
|
2577
|
+
const global = tagSupport.global;
|
|
2335
2578
|
const providersWithChanges = global.providers.filter(provider => !(0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(provider.instance, provider.clone));
|
|
2336
2579
|
// reset clones
|
|
2337
2580
|
providersWithChanges.forEach(provider => {
|
|
2338
|
-
const appElement =
|
|
2581
|
+
const appElement = tagSupport.getAppElement();
|
|
2339
2582
|
handleProviderChanges(appElement, provider);
|
|
2340
2583
|
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
2341
2584
|
});
|
|
2342
2585
|
}
|
|
2343
2586
|
function handleProviderChanges(appElement, provider) {
|
|
2344
2587
|
const tagsWithProvider = getTagsWithProvider(appElement, provider);
|
|
2345
|
-
tagsWithProvider.forEach(({
|
|
2346
|
-
if (
|
|
2588
|
+
tagsWithProvider.forEach(({ tagSupport, renderCount, provider }) => {
|
|
2589
|
+
if (tagSupport.global.deleted) {
|
|
2347
2590
|
return; // i was deleted after another tag processed
|
|
2348
2591
|
}
|
|
2349
|
-
const notRendered = renderCount ===
|
|
2592
|
+
const notRendered = renderCount === tagSupport.global.renderCount;
|
|
2350
2593
|
if (notRendered) {
|
|
2351
2594
|
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
2352
|
-
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(
|
|
2595
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(tagSupport, false);
|
|
2353
2596
|
}
|
|
2354
2597
|
});
|
|
2355
2598
|
}
|
|
2356
|
-
function getTagsWithProvider(
|
|
2357
|
-
const global =
|
|
2599
|
+
function getTagsWithProvider(tagSupport, provider, memory = []) {
|
|
2600
|
+
const global = tagSupport.global;
|
|
2358
2601
|
const compare = global.providers;
|
|
2359
2602
|
const hasProvider = compare.find(xProvider => xProvider.constructMethod === provider.constructMethod);
|
|
2360
2603
|
if (hasProvider) {
|
|
2361
2604
|
memory.push({
|
|
2362
|
-
|
|
2605
|
+
tagSupport,
|
|
2363
2606
|
renderCount: global.renderCount,
|
|
2364
2607
|
provider: hasProvider,
|
|
2365
2608
|
});
|
|
2366
2609
|
}
|
|
2367
|
-
|
|
2368
|
-
memory.forEach(({ tag }) => {
|
|
2369
|
-
if (tag.tagSupport.templater.global.deleted) {
|
|
2370
|
-
throw new Error('do not get here - 0');
|
|
2371
|
-
}
|
|
2372
|
-
});
|
|
2610
|
+
tagSupport.childTags.forEach(child => getTagsWithProvider(child, provider, memory));
|
|
2373
2611
|
return memory;
|
|
2374
2612
|
}
|
|
2375
2613
|
|
|
2376
2614
|
|
|
2377
2615
|
/***/ }),
|
|
2378
2616
|
|
|
2379
|
-
/***/ "./ts/providers.ts":
|
|
2380
|
-
|
|
2381
|
-
!*** ./ts/providers.ts ***!
|
|
2382
|
-
|
|
2617
|
+
/***/ "./ts/state/providers.ts":
|
|
2618
|
+
/*!*******************************!*\
|
|
2619
|
+
!*** ./ts/state/providers.ts ***!
|
|
2620
|
+
\*******************************/
|
|
2383
2621
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2384
2622
|
|
|
2385
2623
|
__webpack_require__.r(__webpack_exports__);
|
|
2386
2624
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2387
2625
|
/* harmony export */ providers: () => (/* binding */ providers)
|
|
2388
2626
|
/* harmony export */ });
|
|
2389
|
-
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*!
|
|
2390
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
2627
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../deepFunctions */ "./ts/deepFunctions.ts");
|
|
2628
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2391
2629
|
|
|
2392
2630
|
|
|
2393
|
-
// TODO: rename
|
|
2394
2631
|
_setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig = {
|
|
2395
2632
|
providers: [],
|
|
2396
|
-
|
|
2397
|
-
ownerTag: undefined,
|
|
2633
|
+
ownerSupport: undefined,
|
|
2398
2634
|
};
|
|
2399
2635
|
function get(constructMethod) {
|
|
2400
2636
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
@@ -2430,10 +2666,10 @@ const providers = {
|
|
|
2430
2666
|
}
|
|
2431
2667
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
2432
2668
|
let owner = {
|
|
2433
|
-
|
|
2669
|
+
ownerTagSupport: config.ownerSupport
|
|
2434
2670
|
};
|
|
2435
|
-
while (owner.
|
|
2436
|
-
const ownerProviders = owner.
|
|
2671
|
+
while (owner.ownerTagSupport) {
|
|
2672
|
+
const ownerProviders = owner.ownerTagSupport.global.providers;
|
|
2437
2673
|
const provider = ownerProviders.find(provider => {
|
|
2438
2674
|
if (provider.constructMethod === constructor) {
|
|
2439
2675
|
return true;
|
|
@@ -2444,7 +2680,7 @@ const providers = {
|
|
|
2444
2680
|
config.providers.push(provider);
|
|
2445
2681
|
return provider.instance;
|
|
2446
2682
|
}
|
|
2447
|
-
owner = owner.
|
|
2683
|
+
owner = owner.ownerTagSupport; // cause reloop
|
|
2448
2684
|
}
|
|
2449
2685
|
const msg = `Could not inject provider: ${constructor.name} ${constructor}`;
|
|
2450
2686
|
console.warn(`${msg}. Available providers`, config.providers);
|
|
@@ -2452,210 +2688,171 @@ const providers = {
|
|
|
2452
2688
|
}
|
|
2453
2689
|
};
|
|
2454
2690
|
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse)({
|
|
2455
|
-
beforeRender: (tagSupport,
|
|
2456
|
-
run(tagSupport,
|
|
2691
|
+
beforeRender: (tagSupport, ownerSupport) => {
|
|
2692
|
+
run(tagSupport, ownerSupport);
|
|
2457
2693
|
},
|
|
2458
|
-
beforeRedraw: (tagSupport,
|
|
2459
|
-
run(tagSupport,
|
|
2694
|
+
beforeRedraw: (tagSupport, newTagSupport) => {
|
|
2695
|
+
run(tagSupport, newTagSupport.ownerTagSupport);
|
|
2460
2696
|
},
|
|
2461
2697
|
afterRender: (tagSupport) => {
|
|
2462
2698
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
2463
|
-
tagSupport.
|
|
2699
|
+
tagSupport.global.providers = [...config.providers];
|
|
2464
2700
|
config.providers.length = 0;
|
|
2465
2701
|
}
|
|
2466
2702
|
});
|
|
2467
|
-
function run(tagSupport,
|
|
2703
|
+
function run(tagSupport, ownerSupport) {
|
|
2468
2704
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
if (tagSupport.templater.global.providers.length) {
|
|
2705
|
+
config.ownerSupport = ownerSupport;
|
|
2706
|
+
if (tagSupport.global.providers.length) {
|
|
2472
2707
|
config.providers.length = 0;
|
|
2473
|
-
config.providers.push(...tagSupport.
|
|
2474
|
-
}
|
|
2475
|
-
}
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
/***/ }),
|
|
2479
|
-
|
|
2480
|
-
/***/ "./ts/render.ts":
|
|
2481
|
-
/*!**********************!*\
|
|
2482
|
-
!*** ./ts/render.ts ***!
|
|
2483
|
-
\**********************/
|
|
2484
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2485
|
-
|
|
2486
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2487
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2488
|
-
/* harmony export */ buildClones: () => (/* binding */ buildClones)
|
|
2489
|
-
/* harmony export */ });
|
|
2490
|
-
function buildClones(temporary, insertBefore) {
|
|
2491
|
-
const clones = [];
|
|
2492
|
-
const template = temporary.children[0];
|
|
2493
|
-
let nextSibling = template.content.firstChild;
|
|
2494
|
-
while (nextSibling) {
|
|
2495
|
-
const nextNextSibling = nextSibling.nextSibling;
|
|
2496
|
-
buildSibling(nextSibling, insertBefore);
|
|
2497
|
-
clones.push(nextSibling);
|
|
2498
|
-
nextSibling = nextNextSibling;
|
|
2708
|
+
config.providers.push(...tagSupport.global.providers);
|
|
2499
2709
|
}
|
|
2500
|
-
return clones;
|
|
2501
|
-
}
|
|
2502
|
-
function buildSibling(nextSibling, insertBefore) {
|
|
2503
|
-
const parentNode = insertBefore.parentNode;
|
|
2504
|
-
parentNode.insertBefore(nextSibling, insertBefore);
|
|
2505
2710
|
}
|
|
2506
2711
|
|
|
2507
2712
|
|
|
2508
2713
|
/***/ }),
|
|
2509
2714
|
|
|
2510
|
-
/***/ "./ts/
|
|
2511
|
-
|
|
2512
|
-
!*** ./ts/
|
|
2513
|
-
|
|
2715
|
+
/***/ "./ts/state/setProp.function.ts":
|
|
2716
|
+
/*!**************************************!*\
|
|
2717
|
+
!*** ./ts/state/setProp.function.ts ***!
|
|
2718
|
+
\**************************************/
|
|
2514
2719
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2515
2720
|
|
|
2516
2721
|
__webpack_require__.r(__webpack_exports__);
|
|
2517
2722
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2518
|
-
/* harmony export */
|
|
2723
|
+
/* harmony export */ setProp: () => (/* binding */ setProp)
|
|
2519
2724
|
/* harmony export */ });
|
|
2520
|
-
/* harmony import */ var
|
|
2521
|
-
/* harmony import */ var
|
|
2522
|
-
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
2523
|
-
|
|
2725
|
+
/* harmony import */ var _state_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./state.utils */ "./ts/state/state.utils.ts");
|
|
2726
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2524
2727
|
|
|
2525
2728
|
|
|
2526
|
-
/**
|
|
2527
|
-
function
|
|
2528
|
-
|
|
2529
|
-
const
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2729
|
+
/** Used for variables that need to remain the same variable during render passes */
|
|
2730
|
+
function setProp(getSet) {
|
|
2731
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2732
|
+
const rearray = config.rearray;
|
|
2733
|
+
const [propValue] = getSet(undefined);
|
|
2734
|
+
getSet(propValue); // restore original value instead of undefined
|
|
2735
|
+
const restate = rearray[config.array.length];
|
|
2736
|
+
if (restate) {
|
|
2737
|
+
let watchValue = restate.watch;
|
|
2738
|
+
let oldValue = (0,_state_utils__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(restate);
|
|
2739
|
+
const push = {
|
|
2740
|
+
get: () => (0,_state_utils__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2741
|
+
callback: getSet,
|
|
2742
|
+
lastValue: oldValue,
|
|
2743
|
+
watch: restate.watch,
|
|
2744
|
+
};
|
|
2745
|
+
// has the prop value changed?
|
|
2746
|
+
if (propValue != watchValue) {
|
|
2747
|
+
push.watch = propValue;
|
|
2748
|
+
oldValue = push.lastValue = propValue;
|
|
2749
|
+
}
|
|
2750
|
+
config.array.push(push);
|
|
2751
|
+
getSet(oldValue);
|
|
2752
|
+
return oldValue;
|
|
2550
2753
|
}
|
|
2551
|
-
|
|
2754
|
+
const push = {
|
|
2755
|
+
get: () => (0,_state_utils__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2756
|
+
callback: getSet,
|
|
2757
|
+
lastValue: propValue,
|
|
2758
|
+
watch: propValue,
|
|
2759
|
+
};
|
|
2760
|
+
config.array.push(push);
|
|
2761
|
+
return propValue;
|
|
2552
2762
|
}
|
|
2553
2763
|
|
|
2554
2764
|
|
|
2555
2765
|
/***/ }),
|
|
2556
2766
|
|
|
2557
|
-
/***/ "./ts/
|
|
2558
|
-
|
|
2559
|
-
!*** ./ts/
|
|
2560
|
-
|
|
2767
|
+
/***/ "./ts/state/setUse.function.ts":
|
|
2768
|
+
/*!*************************************!*\
|
|
2769
|
+
!*** ./ts/state/setUse.function.ts ***!
|
|
2770
|
+
\*************************************/
|
|
2561
2771
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2562
2772
|
|
|
2563
2773
|
__webpack_require__.r(__webpack_exports__);
|
|
2564
2774
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2565
|
-
/* harmony export */
|
|
2775
|
+
/* harmony export */ setUse: () => (/* binding */ setUse)
|
|
2566
2776
|
/* harmony export */ });
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
const newTag = global.newest;
|
|
2578
|
-
const ownerTag = newTag.ownerTag;
|
|
2579
|
-
++global.renderCount;
|
|
2580
|
-
return renderTagSupport(ownerTag.tagSupport, true);
|
|
2581
|
-
}
|
|
2582
|
-
// const oldTagSetup = this
|
|
2583
|
-
const subject = tagSupport.subject;
|
|
2584
|
-
const templater = tagSupport.templater; // oldTagSetup.templater // templater
|
|
2585
|
-
const subjectTag = subject.tag;
|
|
2586
|
-
const newest = subjectTag?.tagSupport.templater.global.newest;
|
|
2587
|
-
let ownerTag;
|
|
2588
|
-
let selfPropChange = false;
|
|
2589
|
-
const shouldRenderUp = renderUp && newest;
|
|
2590
|
-
if (shouldRenderUp) {
|
|
2591
|
-
ownerTag = newest.ownerTag;
|
|
2592
|
-
if (ownerTag) {
|
|
2593
|
-
const nowProps = templater.props;
|
|
2594
|
-
const latestProps = newest.tagSupport.propsConfig.latestCloned;
|
|
2595
|
-
selfPropChange = !(0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(nowProps, latestProps);
|
|
2596
|
-
}
|
|
2597
|
-
}
|
|
2598
|
-
const useTagSupport = global.newest?.tagSupport; // oldTagSetup
|
|
2599
|
-
if (!templater.global.oldest) {
|
|
2600
|
-
throw new Error('already causing trouble');
|
|
2601
|
-
}
|
|
2602
|
-
const tag = (0,_renderExistingTag_function__WEBPACK_IMPORTED_MODULE_2__.renderExistingTag)(templater.global.oldest, templater, useTagSupport, subject);
|
|
2603
|
-
const renderOwner = ownerTag && selfPropChange;
|
|
2604
|
-
if (renderOwner) {
|
|
2605
|
-
const ownerTagSupport = ownerTag.tagSupport;
|
|
2606
|
-
renderTagSupport(ownerTagSupport, true);
|
|
2607
|
-
return tag;
|
|
2608
|
-
}
|
|
2609
|
-
return tag;
|
|
2777
|
+
const tagUse = [];
|
|
2778
|
+
function setUse(use) {
|
|
2779
|
+
// must provide defaults
|
|
2780
|
+
const useMe = {
|
|
2781
|
+
beforeRender: use.beforeRender || (() => undefined),
|
|
2782
|
+
beforeRedraw: use.beforeRedraw || (() => undefined),
|
|
2783
|
+
afterRender: use.afterRender || (() => undefined),
|
|
2784
|
+
beforeDestroy: use.beforeDestroy || (() => undefined),
|
|
2785
|
+
};
|
|
2786
|
+
setUse.tagUse.push(useMe);
|
|
2610
2787
|
}
|
|
2788
|
+
setUse.tagUse = tagUse;
|
|
2789
|
+
setUse.memory = {};
|
|
2611
2790
|
|
|
2612
2791
|
|
|
2613
2792
|
/***/ }),
|
|
2614
2793
|
|
|
2615
|
-
/***/ "./ts/
|
|
2616
|
-
|
|
2617
|
-
!*** ./ts/
|
|
2618
|
-
|
|
2794
|
+
/***/ "./ts/state/state.function.ts":
|
|
2795
|
+
/*!************************************!*\
|
|
2796
|
+
!*** ./ts/state/state.function.ts ***!
|
|
2797
|
+
\************************************/
|
|
2619
2798
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2620
2799
|
|
|
2621
2800
|
__webpack_require__.r(__webpack_exports__);
|
|
2622
2801
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2623
|
-
/* harmony export */
|
|
2802
|
+
/* harmony export */ state: () => (/* binding */ state)
|
|
2624
2803
|
/* harmony export */ });
|
|
2625
|
-
/* harmony import */ var
|
|
2804
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2805
|
+
/* harmony import */ var _state_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state.utils */ "./ts/state/state.utils.ts");
|
|
2626
2806
|
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2807
|
+
|
|
2808
|
+
/** Used for variables that need to remain the same variable during render passes */
|
|
2809
|
+
function state(defaultValue) {
|
|
2810
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.stateConfig;
|
|
2811
|
+
let getSetMethod;
|
|
2812
|
+
const rearray = config.rearray;
|
|
2813
|
+
const restate = rearray[config.array.length];
|
|
2814
|
+
if (restate) {
|
|
2815
|
+
let oldValue = (0,_state_utils__WEBPACK_IMPORTED_MODULE_1__.getStateValue)(restate);
|
|
2816
|
+
getSetMethod = ((x) => [oldValue, oldValue = x]);
|
|
2817
|
+
const push = {
|
|
2818
|
+
get: () => (0,_state_utils__WEBPACK_IMPORTED_MODULE_1__.getStateValue)(push),
|
|
2819
|
+
callback: getSetMethod,
|
|
2820
|
+
lastValue: oldValue,
|
|
2821
|
+
defaultValue: restate.defaultValue,
|
|
2822
|
+
};
|
|
2823
|
+
config.array.push(push);
|
|
2824
|
+
return oldValue;
|
|
2639
2825
|
}
|
|
2826
|
+
// State first time run
|
|
2827
|
+
const defaultFn = defaultValue instanceof Function ? defaultValue : () => defaultValue;
|
|
2828
|
+
let initValue = defaultFn();
|
|
2829
|
+
getSetMethod = ((x) => [initValue, initValue = x]);
|
|
2830
|
+
const push = {
|
|
2831
|
+
get: () => (0,_state_utils__WEBPACK_IMPORTED_MODULE_1__.getStateValue)(push),
|
|
2832
|
+
callback: getSetMethod,
|
|
2833
|
+
lastValue: initValue,
|
|
2834
|
+
defaultValue: initValue,
|
|
2835
|
+
};
|
|
2836
|
+
config.array.push(push);
|
|
2837
|
+
return initValue;
|
|
2640
2838
|
}
|
|
2641
2839
|
|
|
2642
2840
|
|
|
2643
2841
|
/***/ }),
|
|
2644
2842
|
|
|
2645
|
-
/***/ "./ts/
|
|
2646
|
-
|
|
2647
|
-
!*** ./ts/
|
|
2648
|
-
|
|
2843
|
+
/***/ "./ts/state/state.utils.ts":
|
|
2844
|
+
/*!*********************************!*\
|
|
2845
|
+
!*** ./ts/state/state.utils.ts ***!
|
|
2846
|
+
\*********************************/
|
|
2649
2847
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2650
2848
|
|
|
2651
2849
|
__webpack_require__.r(__webpack_exports__);
|
|
2652
2850
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2653
2851
|
/* harmony export */ StateEchoBack: () => (/* binding */ StateEchoBack),
|
|
2654
|
-
/* harmony export */ getStateValue: () => (/* binding */ getStateValue)
|
|
2655
|
-
/* harmony export */ set: () => (/* binding */ set)
|
|
2852
|
+
/* harmony export */ getStateValue: () => (/* binding */ getStateValue)
|
|
2656
2853
|
/* harmony export */ });
|
|
2657
|
-
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*!
|
|
2658
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
2854
|
+
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../errors */ "./ts/errors.ts");
|
|
2855
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2659
2856
|
|
|
2660
2857
|
|
|
2661
2858
|
// TODO: rename
|
|
@@ -2663,20 +2860,23 @@ _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig = {
|
|
|
2663
2860
|
array: [], // state memory on the first render
|
|
2664
2861
|
// rearray: [] as StateConfigArray, // state memory to be used before the next render
|
|
2665
2862
|
};
|
|
2863
|
+
const beforeRender = (tagSupport) => initState(tagSupport);
|
|
2666
2864
|
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse)({
|
|
2667
|
-
beforeRender
|
|
2668
|
-
beforeRedraw:
|
|
2865
|
+
beforeRender,
|
|
2866
|
+
beforeRedraw: beforeRender,
|
|
2669
2867
|
afterRender: (tagSupport) => {
|
|
2670
|
-
const
|
|
2868
|
+
const memory = tagSupport.memory;
|
|
2869
|
+
const state = memory.state;
|
|
2671
2870
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2672
2871
|
const rearray = config.rearray;
|
|
2673
2872
|
if (rearray.length) {
|
|
2674
2873
|
if (rearray.length !== config.array.length) {
|
|
2675
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;
|
|
2676
2876
|
const details = {
|
|
2677
2877
|
oldStates: config.array,
|
|
2678
2878
|
newStates: config.rearray,
|
|
2679
|
-
|
|
2879
|
+
tagFunction: wrapper.original,
|
|
2680
2880
|
};
|
|
2681
2881
|
const error = new _errors__WEBPACK_IMPORTED_MODULE_0__.StateMismatchError(message, details);
|
|
2682
2882
|
console.warn(message, details);
|
|
@@ -2684,8 +2884,8 @@ _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig = {
|
|
|
2684
2884
|
}
|
|
2685
2885
|
}
|
|
2686
2886
|
delete config.rearray; // clean up any previous runs
|
|
2687
|
-
state
|
|
2688
|
-
state.
|
|
2887
|
+
memory.state = config.array; // [...config.array]
|
|
2888
|
+
memory.state.forEach(item => item.lastValue = getStateValue(item)); // set last values
|
|
2689
2889
|
config.array = [];
|
|
2690
2890
|
}
|
|
2691
2891
|
});
|
|
@@ -2700,213 +2900,88 @@ state) {
|
|
|
2700
2900
|
const [oldValue] = oldState;
|
|
2701
2901
|
const [checkValue] = callback(oldValue); // set back to original value
|
|
2702
2902
|
if (checkValue !== StateEchoBack) {
|
|
2703
|
-
const message = 'State property not used correctly. Second item in array is not setting value as expected.\n\n' +
|
|
2704
|
-
'For "let" state use `let name = state(default)(x => [name, name = x])`\n\n' +
|
|
2705
|
-
'For "const" state use `const name = state(default)()`\n\n' +
|
|
2706
|
-
'Problem state:\n' + (callback ? callback.toString() : JSON.stringify(state)) + '\n';
|
|
2707
|
-
console.error(message, { state, callback, oldState, oldValue, checkValue });
|
|
2708
|
-
throw new Error(message);
|
|
2709
|
-
}
|
|
2710
|
-
// state.lastValue = oldValue
|
|
2711
|
-
return oldValue;
|
|
2712
|
-
}
|
|
2713
|
-
class StateEchoBack {
|
|
2714
|
-
}
|
|
2715
|
-
function initState(tagSupport) {
|
|
2716
|
-
const state = tagSupport.memory.state;
|
|
2717
|
-
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2718
|
-
// TODO: This guard may no longer be needed
|
|
2719
|
-
if (config.rearray) {
|
|
2720
|
-
const message = 'last state not cleared. Possibly in the middle of rendering one component and another is trying to render';
|
|
2721
|
-
console.error(message, {
|
|
2722
|
-
config,
|
|
2723
|
-
component: tagSupport.templater?.wrapper.original,
|
|
2724
|
-
wasInMiddleOf: config.tagSupport?.templater.wrapper.original,
|
|
2725
|
-
state,
|
|
2726
|
-
expectedClearArray: config.rearray,
|
|
2727
|
-
});
|
|
2728
|
-
throw new _errors__WEBPACK_IMPORTED_MODULE_0__.StateMismatchError(message, {
|
|
2729
|
-
config,
|
|
2730
|
-
component: tagSupport.templater?.wrapper.original,
|
|
2731
|
-
state,
|
|
2732
|
-
expectedClearArray: config.rearray,
|
|
2733
|
-
});
|
|
2734
|
-
}
|
|
2735
|
-
// TODO: this maybe redundant and not needed
|
|
2736
|
-
config.rearray = []; // .length = 0
|
|
2737
|
-
if (state?.newest.length) {
|
|
2738
|
-
state.newest.map(state => getStateValue(state));
|
|
2739
|
-
config.rearray.push(...state.newest);
|
|
2740
|
-
}
|
|
2741
|
-
config.tagSupport = tagSupport;
|
|
2742
|
-
}
|
|
2743
|
-
/** Used for variables that need to remain the same variable during render passes */
|
|
2744
|
-
function set(defaultValue) {
|
|
2745
|
-
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2746
|
-
let getSetMethod;
|
|
2747
|
-
const rearray = config.rearray;
|
|
2748
|
-
const restate = rearray[config.array.length];
|
|
2749
|
-
if (restate) {
|
|
2750
|
-
let oldValue = getStateValue(restate);
|
|
2751
|
-
getSetMethod = ((x) => [oldValue, oldValue = x]);
|
|
2752
|
-
const push = {
|
|
2753
|
-
get: () => getStateValue(push),
|
|
2754
|
-
callback: getSetMethod,
|
|
2755
|
-
lastValue: oldValue,
|
|
2756
|
-
defaultValue: restate.defaultValue,
|
|
2757
|
-
};
|
|
2758
|
-
config.array.push(push);
|
|
2759
|
-
return oldValue;
|
|
2760
|
-
}
|
|
2761
|
-
// State first time run
|
|
2762
|
-
const defaultFn = defaultValue instanceof Function ? defaultValue : () => defaultValue;
|
|
2763
|
-
let initValue = defaultFn();
|
|
2764
|
-
getSetMethod = ((x) => [initValue, initValue = x]);
|
|
2765
|
-
const push = {
|
|
2766
|
-
get: () => getStateValue(push),
|
|
2767
|
-
callback: getSetMethod,
|
|
2768
|
-
lastValue: initValue,
|
|
2769
|
-
defaultValue: initValue,
|
|
2770
|
-
};
|
|
2771
|
-
config.array.push(push);
|
|
2772
|
-
return initValue;
|
|
2773
|
-
}
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
/***/ }),
|
|
2777
|
-
|
|
2778
|
-
/***/ "./ts/setLet.function.ts":
|
|
2779
|
-
/*!*******************************!*\
|
|
2780
|
-
!*** ./ts/setLet.function.ts ***!
|
|
2781
|
-
\*******************************/
|
|
2782
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2783
|
-
|
|
2784
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2785
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2786
|
-
/* harmony export */ setLet: () => (/* binding */ setLet)
|
|
2787
|
-
/* harmony export */ });
|
|
2788
|
-
/* harmony import */ var _set_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./set.function */ "./ts/set.function.ts");
|
|
2789
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
/** Used for variables that need to remain the same variable during render passes */
|
|
2793
|
-
function setLet(defaultValue) {
|
|
2794
|
-
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2795
|
-
const rearray = config.rearray;
|
|
2796
|
-
let getSetMethod;
|
|
2797
|
-
const restate = rearray[config.array.length];
|
|
2798
|
-
if (restate) {
|
|
2799
|
-
let oldValue = (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(restate);
|
|
2800
|
-
getSetMethod = ((x) => [oldValue, oldValue = x]);
|
|
2801
|
-
const push = {
|
|
2802
|
-
get: () => (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2803
|
-
callback: getSetMethod,
|
|
2804
|
-
lastValue: oldValue,
|
|
2805
|
-
defaultValue: restate.defaultValue,
|
|
2806
|
-
};
|
|
2807
|
-
config.array.push(push);
|
|
2808
|
-
return makeStateResult(oldValue, push);
|
|
2903
|
+
const message = 'State property not used correctly. Second item in array is not setting value as expected.\n\n' +
|
|
2904
|
+
'For "let" state use `let name = state(default)(x => [name, name = x])`\n\n' +
|
|
2905
|
+
'For "const" state use `const name = state(default)()`\n\n' +
|
|
2906
|
+
'Problem state:\n' + (callback ? callback.toString() : JSON.stringify(state)) + '\n';
|
|
2907
|
+
console.error(message, { state, callback, oldState, oldValue, checkValue });
|
|
2908
|
+
throw new Error(message);
|
|
2809
2909
|
}
|
|
2810
|
-
//
|
|
2811
|
-
|
|
2812
|
-
let initValue = defaultFn();
|
|
2813
|
-
getSetMethod = ((x) => [initValue, initValue = x]);
|
|
2814
|
-
const push = {
|
|
2815
|
-
get: () => (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2816
|
-
callback: getSetMethod,
|
|
2817
|
-
lastValue: initValue,
|
|
2818
|
-
defaultValue: initValue,
|
|
2819
|
-
};
|
|
2820
|
-
config.array.push(push);
|
|
2821
|
-
return makeStateResult(initValue, push);
|
|
2910
|
+
// state.lastValue = oldValue
|
|
2911
|
+
return oldValue;
|
|
2822
2912
|
}
|
|
2823
|
-
|
|
2824
|
-
// return initValue
|
|
2825
|
-
const result = (y) => {
|
|
2826
|
-
push.callback = y || (x => [initValue, initValue = x]);
|
|
2827
|
-
return initValue;
|
|
2828
|
-
};
|
|
2829
|
-
return result;
|
|
2913
|
+
class StateEchoBack {
|
|
2830
2914
|
}
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
/***/ "./ts/setProp.function.ts":
|
|
2836
|
-
/*!********************************!*\
|
|
2837
|
-
!*** ./ts/setProp.function.ts ***!
|
|
2838
|
-
\********************************/
|
|
2839
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2840
|
-
|
|
2841
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2842
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2843
|
-
/* harmony export */ setProp: () => (/* binding */ setProp)
|
|
2844
|
-
/* harmony export */ });
|
|
2845
|
-
/* harmony import */ var _set_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./set.function */ "./ts/set.function.ts");
|
|
2846
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
/** Used for variables that need to remain the same variable during render passes */
|
|
2850
|
-
function setProp(getSet) {
|
|
2915
|
+
function initState(tagSupport) {
|
|
2916
|
+
const memory = tagSupport.memory;
|
|
2917
|
+
const state = memory.state;
|
|
2851
2918
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
}
|
|
2870
|
-
config.array.push(push);
|
|
2871
|
-
getSet(oldValue);
|
|
2872
|
-
return oldValue;
|
|
2919
|
+
// TODO: This guard may no longer be needed
|
|
2920
|
+
if (config.rearray) {
|
|
2921
|
+
const wrapper = tagSupport.templater?.wrapper;
|
|
2922
|
+
const wasWrapper = config.tagSupport?.templater.wrapper;
|
|
2923
|
+
const message = 'last state not cleared. Possibly in the middle of rendering one component and another is trying to render';
|
|
2924
|
+
console.error(message, {
|
|
2925
|
+
config,
|
|
2926
|
+
tagFunction: wrapper.original,
|
|
2927
|
+
wasInMiddleOf: wasWrapper.original,
|
|
2928
|
+
state,
|
|
2929
|
+
expectedClearArray: config.rearray,
|
|
2930
|
+
});
|
|
2931
|
+
throw new _errors__WEBPACK_IMPORTED_MODULE_0__.StateMismatchError(message, {
|
|
2932
|
+
config,
|
|
2933
|
+
tagFunction: wrapper.original,
|
|
2934
|
+
state,
|
|
2935
|
+
expectedClearArray: config.rearray,
|
|
2936
|
+
});
|
|
2873
2937
|
}
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
}
|
|
2880
|
-
config.
|
|
2881
|
-
return propValue;
|
|
2938
|
+
// TODO: this maybe redundant and not needed
|
|
2939
|
+
config.rearray = []; // .length = 0
|
|
2940
|
+
if (state?.length) {
|
|
2941
|
+
state.forEach(state => getStateValue(state));
|
|
2942
|
+
config.rearray.push(...state);
|
|
2943
|
+
}
|
|
2944
|
+
config.tagSupport = tagSupport;
|
|
2882
2945
|
}
|
|
2883
2946
|
|
|
2884
2947
|
|
|
2885
2948
|
/***/ }),
|
|
2886
2949
|
|
|
2887
|
-
/***/ "./ts/
|
|
2888
|
-
|
|
2889
|
-
!*** ./ts/
|
|
2890
|
-
|
|
2950
|
+
/***/ "./ts/state/watch.function.ts":
|
|
2951
|
+
/*!************************************!*\
|
|
2952
|
+
!*** ./ts/state/watch.function.ts ***!
|
|
2953
|
+
\************************************/
|
|
2891
2954
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2892
2955
|
|
|
2893
2956
|
__webpack_require__.r(__webpack_exports__);
|
|
2894
2957
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2895
|
-
/* harmony export */
|
|
2958
|
+
/* harmony export */ watch: () => (/* binding */ watch)
|
|
2896
2959
|
/* harmony export */ });
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2960
|
+
/* harmony import */ var _letState_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./letState.function */ "./ts/state/letState.function.ts");
|
|
2961
|
+
|
|
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
|
+
*/
|
|
2968
|
+
function watch(currentValues, callback) {
|
|
2969
|
+
let previousValues = (0,_letState_function__WEBPACK_IMPORTED_MODULE_0__.letState)(undefined)(x => [previousValues, previousValues = x]);
|
|
2970
|
+
// First time running watch?
|
|
2971
|
+
if (previousValues === undefined) {
|
|
2972
|
+
// callback(currentValues, previousValues) // do not call during init
|
|
2973
|
+
previousValues = currentValues;
|
|
2974
|
+
return currentValues;
|
|
2975
|
+
}
|
|
2976
|
+
const allExact = currentValues.every((item, index) => item === previousValues[index]);
|
|
2977
|
+
if (allExact) {
|
|
2978
|
+
return currentValues;
|
|
2979
|
+
}
|
|
2980
|
+
callback(currentValues, previousValues);
|
|
2981
|
+
previousValues.length = 0;
|
|
2982
|
+
previousValues.push(...currentValues);
|
|
2983
|
+
return currentValues;
|
|
2907
2984
|
}
|
|
2908
|
-
setUse.tagUse = tagUse;
|
|
2909
|
-
setUse.memory = {};
|
|
2910
2985
|
|
|
2911
2986
|
|
|
2912
2987
|
/***/ }),
|
|
@@ -2923,49 +2998,61 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2923
2998
|
/* harmony export */ });
|
|
2924
2999
|
class Subject {
|
|
2925
3000
|
value;
|
|
3001
|
+
onSubscription;
|
|
2926
3002
|
methods = [];
|
|
2927
3003
|
isSubject = true;
|
|
2928
3004
|
subscribers = [];
|
|
2929
3005
|
subscribeWith;
|
|
2930
3006
|
// unsubcount = 0 // 🔬 testing
|
|
2931
|
-
constructor(value) {
|
|
3007
|
+
constructor(value, onSubscription) {
|
|
2932
3008
|
this.value = value;
|
|
3009
|
+
this.onSubscription = onSubscription;
|
|
2933
3010
|
}
|
|
2934
3011
|
subscribe(callback) {
|
|
3012
|
+
const subscription = getSubscription(this, callback);
|
|
2935
3013
|
// are we within a pipe?
|
|
2936
3014
|
const subscribeWith = this.subscribeWith;
|
|
2937
3015
|
if (subscribeWith) {
|
|
2938
3016
|
// are we in a pipe?
|
|
2939
3017
|
if (this.methods.length) {
|
|
2940
3018
|
const orgCallback = callback;
|
|
2941
|
-
callback = (value
|
|
2942
|
-
runPipedMethods(value,
|
|
3019
|
+
callback = (value) => {
|
|
3020
|
+
runPipedMethods(value, this.methods, lastValue => orgCallback(lastValue, subscription));
|
|
2943
3021
|
};
|
|
2944
3022
|
}
|
|
2945
3023
|
return subscribeWith(callback);
|
|
2946
3024
|
}
|
|
2947
|
-
this.subscribers.push(
|
|
2948
|
-
SubjectClass.globalSubs.push(
|
|
2949
|
-
|
|
3025
|
+
this.subscribers.push(subscription);
|
|
3026
|
+
SubjectClass.globalSubs.push(subscription); // 🔬 testing
|
|
3027
|
+
if (this.onSubscription) {
|
|
3028
|
+
this.onSubscription(subscription);
|
|
3029
|
+
}
|
|
2950
3030
|
return subscription;
|
|
2951
3031
|
}
|
|
2952
3032
|
set(value) {
|
|
2953
3033
|
this.value = value;
|
|
2954
3034
|
// Notify all subscribers with the new value
|
|
2955
|
-
this.subscribers.forEach(
|
|
2956
|
-
callback.value = value
|
|
2957
|
-
callback(value);
|
|
3035
|
+
this.subscribers.forEach(sub => {
|
|
3036
|
+
// (sub.callback as any).value = value
|
|
3037
|
+
sub.callback(value, sub);
|
|
2958
3038
|
});
|
|
2959
3039
|
}
|
|
2960
3040
|
next = this.set;
|
|
2961
3041
|
toPromise() {
|
|
2962
3042
|
return new Promise((res, rej) => {
|
|
2963
|
-
|
|
3043
|
+
this.subscribe((x, subscription) => {
|
|
2964
3044
|
subscription.unsubscribe();
|
|
2965
3045
|
res(x);
|
|
2966
3046
|
});
|
|
2967
3047
|
});
|
|
2968
3048
|
}
|
|
3049
|
+
// like toPromise but faster
|
|
3050
|
+
toCallback(callback) {
|
|
3051
|
+
this.subscribe((x, subscription) => {
|
|
3052
|
+
subscription.unsubscribe();
|
|
3053
|
+
callback(x);
|
|
3054
|
+
});
|
|
3055
|
+
}
|
|
2969
3056
|
pipe(...operations) {
|
|
2970
3057
|
const subject = new Subject();
|
|
2971
3058
|
subject.methods = operations;
|
|
@@ -2974,7 +3061,7 @@ class Subject {
|
|
|
2974
3061
|
}
|
|
2975
3062
|
}
|
|
2976
3063
|
function removeSubFromArray(subscribers, callback) {
|
|
2977
|
-
const index = subscribers.
|
|
3064
|
+
const index = subscribers.findIndex(sub => sub.callback === callback);
|
|
2978
3065
|
if (index !== -1) {
|
|
2979
3066
|
subscribers.splice(index, 1);
|
|
2980
3067
|
}
|
|
@@ -2989,6 +3076,7 @@ function getSubscription(subject, callback) {
|
|
|
2989
3076
|
const subscription = () => {
|
|
2990
3077
|
subscription.unsubscribe();
|
|
2991
3078
|
};
|
|
3079
|
+
subscription.callback = callback;
|
|
2992
3080
|
subscription.subscriptions = [];
|
|
2993
3081
|
// Return a function to unsubscribe from the BehaviorSubject
|
|
2994
3082
|
subscription.unsubscribe = () => {
|
|
@@ -3005,14 +3093,17 @@ function getSubscription(subject, callback) {
|
|
|
3005
3093
|
subscription.subscriptions.push(sub);
|
|
3006
3094
|
return subscription;
|
|
3007
3095
|
};
|
|
3096
|
+
subscription.next = (value) => {
|
|
3097
|
+
callback(value, subscription);
|
|
3098
|
+
};
|
|
3008
3099
|
return subscription;
|
|
3009
3100
|
}
|
|
3010
|
-
function runPipedMethods(value,
|
|
3101
|
+
function runPipedMethods(value, methods, onComplete) {
|
|
3011
3102
|
const cloneMethods = [...methods];
|
|
3012
3103
|
const firstMethod = cloneMethods.shift();
|
|
3013
3104
|
const next = (newValue) => {
|
|
3014
3105
|
if (cloneMethods.length) {
|
|
3015
|
-
return runPipedMethods(newValue,
|
|
3106
|
+
return runPipedMethods(newValue, cloneMethods, onComplete);
|
|
3016
3107
|
}
|
|
3017
3108
|
onComplete(newValue);
|
|
3018
3109
|
// return newValue = next
|
|
@@ -3180,9 +3271,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3180
3271
|
/* harmony export */ tags: () => (/* binding */ tags)
|
|
3181
3272
|
/* harmony export */ });
|
|
3182
3273
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
3183
|
-
/* harmony import */ var
|
|
3274
|
+
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "./ts/state/index.ts");
|
|
3184
3275
|
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
3185
|
-
/* harmony import */ var
|
|
3276
|
+
/* harmony import */ var _interpolations_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./interpolations/bindSubjectCallback.function */ "./ts/interpolations/bindSubjectCallback.function.ts");
|
|
3186
3277
|
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
3187
3278
|
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3188
3279
|
/* harmony import */ var _alterProps_function__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./alterProps.function */ "./ts/alterProps.function.ts");
|
|
@@ -3200,8 +3291,10 @@ let tagCount = 0;
|
|
|
3200
3291
|
/** Wraps a tag component in a state manager and always push children to last argument as an array */
|
|
3201
3292
|
// export function tag<T>(a: T): T;
|
|
3202
3293
|
function tag(tagComponent) {
|
|
3294
|
+
/** function developer triggers */
|
|
3203
3295
|
const result = (function tagWrapper(props, children) {
|
|
3204
|
-
|
|
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);
|
|
3205
3298
|
if (isPropTag) {
|
|
3206
3299
|
children = props;
|
|
3207
3300
|
props = undefined;
|
|
@@ -3209,6 +3302,7 @@ function tag(tagComponent) {
|
|
|
3209
3302
|
const { childSubject, madeSubject } = kidsToTagArraySubject(children);
|
|
3210
3303
|
childSubject.isChildSubject = true;
|
|
3211
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
|
|
3212
3306
|
const innerTagWrap = getTagWrap(templater, madeSubject);
|
|
3213
3307
|
innerTagWrap.original = tagComponent;
|
|
3214
3308
|
templater.tagged = true;
|
|
@@ -3219,6 +3313,7 @@ function tag(tagComponent) {
|
|
|
3219
3313
|
// group tags together and have hmr pickup
|
|
3220
3314
|
updateComponent(tagComponent);
|
|
3221
3315
|
tags.push(tagComponent);
|
|
3316
|
+
// fake the return as being (props?, children?) => TemplaterResult
|
|
3222
3317
|
return result;
|
|
3223
3318
|
}
|
|
3224
3319
|
function kidsToTagArraySubject(children) {
|
|
@@ -3245,48 +3340,38 @@ function updateResult(result, tagComponent) {
|
|
|
3245
3340
|
}
|
|
3246
3341
|
function updateComponent(tagComponent) {
|
|
3247
3342
|
tagComponent.tags = tags;
|
|
3248
|
-
tagComponent.setUse =
|
|
3343
|
+
tagComponent.setUse = _state__WEBPACK_IMPORTED_MODULE_1__.setUse;
|
|
3249
3344
|
tagComponent.tagIndex = tagCount++; // needed for things like HMR
|
|
3250
3345
|
}
|
|
3251
|
-
/** 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
|
+
*/
|
|
3252
3349
|
function getTagWrap(templater, madeSubject) {
|
|
3350
|
+
// this function gets called by taggedjs
|
|
3253
3351
|
const innerTagWrap = function (oldTagSetup, subject) {
|
|
3254
|
-
const global = oldTagSetup.
|
|
3255
|
-
global.newestTemplater = templater;
|
|
3352
|
+
const global = oldTagSetup.global;
|
|
3256
3353
|
++global.renderCount;
|
|
3257
|
-
templater.global = global;
|
|
3258
3354
|
const childSubject = templater.children;
|
|
3259
|
-
const lastArray = global.oldest?.
|
|
3355
|
+
const lastArray = global.oldest?.templater.children.lastArray;
|
|
3260
3356
|
if (lastArray) {
|
|
3261
3357
|
childSubject.lastArray = lastArray;
|
|
3262
3358
|
}
|
|
3263
3359
|
const originalFunction = innerTagWrap.original;
|
|
3264
|
-
// const oldTagSetup = templater.tagSupport
|
|
3265
|
-
const oldest = templater.global.oldest;
|
|
3266
|
-
if (oldest && !oldest.hasLiveElements) {
|
|
3267
|
-
throw new Error('issue already 22');
|
|
3268
|
-
}
|
|
3269
3360
|
let props = templater.props;
|
|
3270
|
-
|
|
3271
|
-
const oldTemplater = ownerTagSupport?.templater;
|
|
3272
|
-
const oldLatest = oldTemplater?.global.newest;
|
|
3273
|
-
const newestOwnerTemplater = oldLatest?.tagSupport.templater;
|
|
3274
|
-
if (oldLatest && !newestOwnerTemplater) {
|
|
3275
|
-
throw new Error('what to do here?');
|
|
3276
|
-
}
|
|
3277
|
-
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);
|
|
3278
3362
|
const clonedProps = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_4__.deepClone)(props); // castedProps
|
|
3279
3363
|
// CALL ORIGINAL COMPONENT FUNCTION
|
|
3280
3364
|
const tag = originalFunction(castedProps, childSubject);
|
|
3281
|
-
tag.
|
|
3282
|
-
tag
|
|
3283
|
-
|
|
3284
|
-
|
|
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,
|
|
3285
3371
|
latestCloned: clonedProps,
|
|
3286
|
-
|
|
3287
|
-
lastClonedKidValues: tag.tagSupport.propsConfig.lastClonedKidValues,
|
|
3372
|
+
lastClonedKidValues: tagSupport.propsConfig.lastClonedKidValues,
|
|
3288
3373
|
};
|
|
3289
|
-
|
|
3374
|
+
tagSupport.memory = oldTagSetup.memory; // state handover
|
|
3290
3375
|
if (madeSubject) {
|
|
3291
3376
|
childSubject.value.forEach(kid => {
|
|
3292
3377
|
kid.values.forEach((value, index) => {
|
|
@@ -3299,16 +3384,16 @@ function getTagWrap(templater, madeSubject) {
|
|
|
3299
3384
|
}
|
|
3300
3385
|
// all functions need to report to me
|
|
3301
3386
|
kid.values[index] = function (...args) {
|
|
3302
|
-
const
|
|
3303
|
-
(0,
|
|
3304
|
-
|
|
3387
|
+
const ownerSupport = tagSupport.ownerTagSupport;
|
|
3388
|
+
(0,_interpolations_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_3__.runTagCallback)(value, // callback
|
|
3389
|
+
ownerSupport, this, // bindTo
|
|
3305
3390
|
args);
|
|
3306
3391
|
};
|
|
3307
3392
|
valuesValue.isChildOverride = true;
|
|
3308
3393
|
});
|
|
3309
3394
|
});
|
|
3310
3395
|
}
|
|
3311
|
-
return
|
|
3396
|
+
return tagSupport;
|
|
3312
3397
|
};
|
|
3313
3398
|
return innerTagWrap;
|
|
3314
3399
|
}
|
|
@@ -3324,7 +3409,7 @@ function getTagWrap(templater, madeSubject) {
|
|
|
3324
3409
|
|
|
3325
3410
|
__webpack_require__.r(__webpack_exports__);
|
|
3326
3411
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3327
|
-
/* harmony export */
|
|
3412
|
+
/* harmony export */ runWrapper: () => (/* binding */ runWrapper),
|
|
3328
3413
|
/* harmony export */ tagElement: () => (/* binding */ tagElement)
|
|
3329
3414
|
/* harmony export */ });
|
|
3330
3415
|
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
@@ -3338,7 +3423,7 @@ function tagElement(app, // (...args: unknown[]) => TemplaterResult,
|
|
|
3338
3423
|
element, props) {
|
|
3339
3424
|
const appElmIndex = appElements.findIndex(appElm => appElm.element === element);
|
|
3340
3425
|
if (appElmIndex >= 0) {
|
|
3341
|
-
appElements[appElmIndex].
|
|
3426
|
+
appElements[appElmIndex].tagSupport.destroy();
|
|
3342
3427
|
appElements.splice(appElmIndex, 1);
|
|
3343
3428
|
// an element already had an app on it
|
|
3344
3429
|
console.warn('Found and destroyed app element already rendered to element', { element });
|
|
@@ -3346,37 +3431,37 @@ element, props) {
|
|
|
3346
3431
|
// Create the app which returns [props, runOneTimeFunction]
|
|
3347
3432
|
const wrapper = app(props);
|
|
3348
3433
|
// have a function setup and call the tagWrapper with (props, {update, async, on})
|
|
3349
|
-
const
|
|
3350
|
-
const { tag } = result;
|
|
3434
|
+
const tagSupport = runWrapper(wrapper);
|
|
3351
3435
|
// TODO: is the below needed?
|
|
3352
|
-
|
|
3353
|
-
|
|
3436
|
+
tagSupport.appElement = element;
|
|
3437
|
+
tagSupport.isApp = true;
|
|
3438
|
+
tagSupport.global.isApp = true;
|
|
3354
3439
|
const templateElm = document.createElement('template');
|
|
3355
3440
|
templateElm.setAttribute('id', 'app-tag-' + appElements.length);
|
|
3356
3441
|
templateElm.setAttribute('app-tag-detail', appElements.length.toString());
|
|
3357
3442
|
element.appendChild(templateElm);
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
if (!tag.hasLiveElements) {
|
|
3362
|
-
throw new Error('x');
|
|
3363
|
-
}
|
|
3364
|
-
;
|
|
3443
|
+
tagSupport.buildBeforeElement(templateElm);
|
|
3444
|
+
tagSupport.global.oldest = tagSupport;
|
|
3445
|
+
tagSupport.global.newest = tagSupport;
|
|
3365
3446
|
element.setUse = app.original.setUse;
|
|
3366
|
-
appElements.push({ element,
|
|
3367
|
-
return {
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
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);
|
|
3374
3460
|
// Call the apps function for our tag templater
|
|
3375
|
-
const
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
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;
|
|
3380
3465
|
}
|
|
3381
3466
|
|
|
3382
3467
|
|
|
@@ -3393,26 +3478,36 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3393
3478
|
/* harmony export */ runAfterRender: () => (/* binding */ runAfterRender),
|
|
3394
3479
|
/* harmony export */ runBeforeDestroy: () => (/* binding */ runBeforeDestroy),
|
|
3395
3480
|
/* harmony export */ runBeforeRedraw: () => (/* binding */ runBeforeRedraw),
|
|
3396
|
-
/* harmony export */ runBeforeRender: () => (/* binding */ runBeforeRender)
|
|
3481
|
+
/* harmony export */ runBeforeRender: () => (/* binding */ runBeforeRender),
|
|
3482
|
+
/* harmony export */ tagClosed$: () => (/* binding */ tagClosed$)
|
|
3397
3483
|
/* harmony export */ });
|
|
3398
|
-
/* harmony import */ var
|
|
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");
|
|
3399
3486
|
// TODO: This should be more like `new TaggedJs().use({})`
|
|
3400
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
|
+
});
|
|
3401
3495
|
// Life cycle 1
|
|
3402
|
-
function runBeforeRender(tagSupport,
|
|
3403
|
-
|
|
3496
|
+
function runBeforeRender(tagSupport, ownerSupport) {
|
|
3497
|
+
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeRender(tagSupport, ownerSupport));
|
|
3404
3498
|
}
|
|
3405
3499
|
// Life cycle 2
|
|
3406
|
-
function runAfterRender(tagSupport,
|
|
3407
|
-
|
|
3500
|
+
function runAfterRender(tagSupport, ownerTagSupport) {
|
|
3501
|
+
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.afterRender(tagSupport, ownerTagSupport));
|
|
3502
|
+
tagClosed$.next(ownerTagSupport);
|
|
3408
3503
|
}
|
|
3409
3504
|
// Life cycle 3
|
|
3410
|
-
function runBeforeRedraw(tagSupport,
|
|
3411
|
-
|
|
3505
|
+
function runBeforeRedraw(tagSupport, ownerTagSupport) {
|
|
3506
|
+
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeRedraw(tagSupport, ownerTagSupport));
|
|
3412
3507
|
}
|
|
3413
3508
|
// Life cycle 4 - end of life
|
|
3414
|
-
function runBeforeDestroy(tagSupport,
|
|
3415
|
-
|
|
3509
|
+
function runBeforeDestroy(tagSupport, ownerTagSupport) {
|
|
3510
|
+
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeDestroy(tagSupport, ownerTagSupport));
|
|
3416
3511
|
}
|
|
3417
3512
|
|
|
3418
3513
|
|
|
@@ -3445,6 +3540,64 @@ function updateBeforeTemplate(value, lastFirstChild) {
|
|
|
3445
3540
|
}
|
|
3446
3541
|
|
|
3447
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
|
+
|
|
3448
3601
|
/***/ }),
|
|
3449
3602
|
|
|
3450
3603
|
/***/ "./ts/updateExistingTagComponent.function.ts":
|
|
@@ -3462,140 +3615,102 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3462
3615
|
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
3463
3616
|
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
3464
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");
|
|
3465
3619
|
|
|
3466
3620
|
|
|
3467
3621
|
|
|
3468
3622
|
|
|
3469
3623
|
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
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;
|
|
3474
3633
|
let isSameTag = false;
|
|
3475
3634
|
if (oldWrapper && newWrapper) {
|
|
3476
3635
|
const oldFunction = oldWrapper.original;
|
|
3477
3636
|
const newFunction = newWrapper.original;
|
|
3478
3637
|
isSameTag = oldFunction === newFunction;
|
|
3479
3638
|
}
|
|
3480
|
-
const
|
|
3481
|
-
const oldGlobal = oldTagSupport.templater.global;
|
|
3482
|
-
const globalInsert = oldGlobal.insertBefore;
|
|
3483
|
-
// const placeholderElm = ownerTag.tagSupport.templater.global.placeholderElm
|
|
3484
|
-
const placeholderElm = oldGlobal.placeholder;
|
|
3485
|
-
if (placeholderElm) {
|
|
3486
|
-
if (!placeholderElm.parentNode) {
|
|
3487
|
-
throw new Error('stop here no subject parent node update existing tag');
|
|
3488
|
-
}
|
|
3489
|
-
}
|
|
3639
|
+
const templater = tagSupport.templater;
|
|
3490
3640
|
if (!isSameTag) {
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
insertBefore, // oldInsertBefore,
|
|
3495
|
-
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, {
|
|
3496
3644
|
forceElement: false,
|
|
3497
3645
|
counts: { added: 0, removed: 0 },
|
|
3498
3646
|
});
|
|
3499
3647
|
}
|
|
3500
3648
|
else {
|
|
3501
|
-
const
|
|
3502
|
-
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);
|
|
3503
3650
|
if (!hasChanged) {
|
|
3504
3651
|
// if the new props are an object then implicitly since no change, the old props are an object
|
|
3505
3652
|
const newProps = templater.props;
|
|
3506
3653
|
if (newProps && typeof (newProps) === 'object') {
|
|
3507
|
-
|
|
3508
|
-
// const oldProps = existingTag.tagSupport.propsConfig.latestCloned as Record<string,any> // newestTag.props as Record<string, any>
|
|
3509
|
-
syncFunctionProps(templater, existingTag, ownerTag, newProps);
|
|
3654
|
+
syncFunctionProps(lastSupport, ownerSupport, newProps);
|
|
3510
3655
|
}
|
|
3511
|
-
return
|
|
3656
|
+
return lastSupport; // its the same tag component
|
|
3512
3657
|
}
|
|
3513
3658
|
}
|
|
3514
|
-
const
|
|
3515
|
-
const
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
}
|
|
3519
|
-
const newTag = (0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_3__.renderTagSupport)(templater.tagSupport, false);
|
|
3520
|
-
existingTag = subject.tag;
|
|
3521
|
-
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;
|
|
3522
3663
|
const hasOldest = newOldest ? true : false;
|
|
3523
3664
|
if (!hasOldest) {
|
|
3524
|
-
return buildNewTag(
|
|
3525
|
-
// ??? newly changed
|
|
3526
|
-
insertBefore, // oldInsertBefore,
|
|
3527
|
-
oldTagSupport, subject);
|
|
3665
|
+
return buildNewTag(newSupport, insertBefore, lastSupport, subject);
|
|
3528
3666
|
}
|
|
3529
3667
|
if (newOldest && templater.children.value.length) {
|
|
3530
|
-
const oldKidsSub = newOldest.
|
|
3668
|
+
const oldKidsSub = newOldest.templater.children;
|
|
3531
3669
|
oldKidsSub.set(templater.children.value);
|
|
3532
3670
|
}
|
|
3533
|
-
// const newTag = tempResult.newest as Tag
|
|
3534
|
-
if (previous && !oldestTag) {
|
|
3535
|
-
throw new Error('bad elders');
|
|
3536
|
-
}
|
|
3537
3671
|
// detect if both the function is the same and the return is the same
|
|
3538
|
-
const isLikeTag = isSameTag &&
|
|
3539
|
-
if (previous && !oldestTag) {
|
|
3540
|
-
throw new Error('bad elders');
|
|
3541
|
-
}
|
|
3542
|
-
let oldest = oldTagSupport.templater.global.oldest;
|
|
3672
|
+
const isLikeTag = isSameTag && (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_5__.isLikeTags)(previous, newSupport);
|
|
3543
3673
|
if (isLikeTag) {
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
subject.tag = newTag;
|
|
3548
|
-
oldestTag.updateByTag(newTag); // the oldest tag has element references
|
|
3549
|
-
return newTag;
|
|
3674
|
+
subject.tagSupport = newSupport;
|
|
3675
|
+
oldestTag.updateBy(newSupport); // the oldest tag has element references
|
|
3676
|
+
return newSupport;
|
|
3550
3677
|
}
|
|
3551
3678
|
else {
|
|
3552
3679
|
// Although function looked the same it returned a different html result
|
|
3553
|
-
if (isSameTag &&
|
|
3554
|
-
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(
|
|
3555
|
-
|
|
3680
|
+
if (isSameTag && lastSupport) {
|
|
3681
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(lastSupport, subject);
|
|
3682
|
+
newSupport.global.context = {}; // do not share previous outputs
|
|
3556
3683
|
}
|
|
3557
|
-
|
|
3684
|
+
oldestTag = undefined;
|
|
3558
3685
|
}
|
|
3559
|
-
if (!
|
|
3560
|
-
|
|
3686
|
+
if (!oldestTag) {
|
|
3687
|
+
lastSupport = newSupport;
|
|
3688
|
+
buildNewTag(newSupport, lastSupport.global.insertBefore, lastSupport, subject);
|
|
3561
3689
|
}
|
|
3562
|
-
|
|
3563
|
-
return
|
|
3564
|
-
}
|
|
3565
|
-
function checkStateChanged(state) {
|
|
3566
|
-
return !state.newest.every(state => {
|
|
3567
|
-
const lastValue = state.lastValue;
|
|
3568
|
-
const nowValue = state.get();
|
|
3569
|
-
const matched = lastValue === nowValue;
|
|
3570
|
-
if (matched) {
|
|
3571
|
-
return true;
|
|
3572
|
-
}
|
|
3573
|
-
return false;
|
|
3574
|
-
});
|
|
3690
|
+
lastSupport.global.newest = newSupport;
|
|
3691
|
+
return newSupport;
|
|
3575
3692
|
}
|
|
3576
|
-
function buildNewTag(
|
|
3577
|
-
|
|
3693
|
+
function buildNewTag(newSupport, oldInsertBefore, oldTagSupport, subject) {
|
|
3694
|
+
newSupport.buildBeforeElement(oldInsertBefore, {
|
|
3578
3695
|
forceElement: true,
|
|
3579
3696
|
counts: { added: 0, removed: 0 },
|
|
3580
3697
|
});
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
oldTagSupport.
|
|
3584
|
-
oldTagSupport.
|
|
3585
|
-
subject.
|
|
3586
|
-
return
|
|
3587
|
-
}
|
|
3588
|
-
function syncFunctionProps(
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
const priorProps =
|
|
3592
|
-
const
|
|
3593
|
-
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;
|
|
3594
3710
|
Object.entries(priorProps).forEach(([name, value]) => {
|
|
3595
3711
|
if (!(value instanceof Function)) {
|
|
3596
3712
|
return;
|
|
3597
3713
|
}
|
|
3598
|
-
const newOriginal = value.original;
|
|
3599
3714
|
// TODO: The code below maybe irrelevant
|
|
3600
3715
|
const newCallback = newProps[name];
|
|
3601
3716
|
const original = newCallback.original;
|
|
@@ -3605,7 +3720,7 @@ function syncFunctionProps(templater, existingTag, ownerTag, newProps) {
|
|
|
3605
3720
|
// Currently, call self but over parent state changes, I may need to call a newer parent tag owner
|
|
3606
3721
|
priorProps[name].toCall = (...args) => {
|
|
3607
3722
|
return (0,_alterProps_function__WEBPACK_IMPORTED_MODULE_4__.callbackPropOwner)(newCallback, // value, // newOriginal,
|
|
3608
|
-
args,
|
|
3723
|
+
args, prevSupport);
|
|
3609
3724
|
};
|
|
3610
3725
|
return;
|
|
3611
3726
|
});
|
|
@@ -3625,15 +3740,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3625
3740
|
/* harmony export */ updateExistingValue: () => (/* binding */ updateExistingValue)
|
|
3626
3741
|
/* harmony export */ });
|
|
3627
3742
|
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3628
|
-
/* harmony import */ var
|
|
3629
|
-
/* harmony import */ var
|
|
3630
|
-
/* harmony import */ var
|
|
3631
|
-
/* harmony import */ var
|
|
3632
|
-
/* harmony import */ var
|
|
3633
|
-
/* harmony import */ var
|
|
3634
|
-
/* harmony import */ var
|
|
3635
|
-
/* harmony import */ var
|
|
3636
|
-
/* 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");
|
|
3637
3755
|
|
|
3638
3756
|
|
|
3639
3757
|
|
|
@@ -3644,122 +3762,132 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3644
3762
|
|
|
3645
3763
|
|
|
3646
3764
|
|
|
3647
|
-
|
|
3765
|
+
|
|
3766
|
+
|
|
3767
|
+
|
|
3768
|
+
function updateExistingValue(subject, value, ownerSupport, insertBefore) {
|
|
3648
3769
|
const subjectTag = subject;
|
|
3649
|
-
const isComponent = (0,
|
|
3650
|
-
(0,
|
|
3770
|
+
const isComponent = (0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagComponent)(value);
|
|
3771
|
+
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_6__.checkDestroyPrevious)(subject, value, insertBefore);
|
|
3651
3772
|
// handle already seen tag components
|
|
3652
3773
|
if (isComponent) {
|
|
3653
|
-
|
|
3654
|
-
// When was something before component
|
|
3655
|
-
if (!subjectTag.tag) {
|
|
3656
|
-
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_6__.processSubjectComponent)(templater, subjectTag, insertBefore, // oldInsertBefore as InsertBefore,
|
|
3657
|
-
ownerTag, {
|
|
3658
|
-
forceElement: true,
|
|
3659
|
-
counts: { added: 0, removed: 0 },
|
|
3660
|
-
});
|
|
3661
|
-
return subjectTag;
|
|
3662
|
-
}
|
|
3663
|
-
templater.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__.TagSupport(
|
|
3664
|
-
// subjectTag.tag.tagSupport.ownerTagSupport,
|
|
3665
|
-
ownerTag.tagSupport, templater, subjectTag);
|
|
3666
|
-
(0,_updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_3__.updateExistingTagComponent)(ownerTag, templater, // latest value
|
|
3667
|
-
subjectTag, insertBefore);
|
|
3668
|
-
return subjectTag;
|
|
3774
|
+
return prepareUpdateToComponent(value, subjectTag, insertBefore, ownerSupport);
|
|
3669
3775
|
}
|
|
3670
3776
|
// was component but no longer
|
|
3671
|
-
const
|
|
3672
|
-
if (
|
|
3673
|
-
handleStillTag(
|
|
3777
|
+
const tagSupport = subjectTag.tagSupport;
|
|
3778
|
+
if (tagSupport) {
|
|
3779
|
+
handleStillTag(subject, value, ownerSupport);
|
|
3674
3780
|
return subjectTag;
|
|
3675
3781
|
}
|
|
3676
3782
|
// its another tag array
|
|
3677
|
-
if ((0,
|
|
3678
|
-
(0,
|
|
3679
|
-
|
|
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: {
|
|
3680
3786
|
added: 0,
|
|
3681
3787
|
removed: 0,
|
|
3682
3788
|
} });
|
|
3683
3789
|
return subject;
|
|
3684
3790
|
}
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
const bound = (0,_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_8__.bindSubjectCallback)(value, ownerTag);
|
|
3689
|
-
subject.set(bound);
|
|
3690
|
-
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;
|
|
3691
3794
|
}
|
|
3692
|
-
if ((0,
|
|
3693
|
-
|
|
3694
|
-
|
|
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;
|
|
3695
3802
|
}
|
|
3696
|
-
(0,
|
|
3803
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_11__.processTag)(templater, insertBefore, ownerSupport, subjectTag);
|
|
3697
3804
|
return subjectTag;
|
|
3698
3805
|
}
|
|
3699
3806
|
// we have been given a subject
|
|
3700
|
-
if ((0,
|
|
3807
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isSubjectInstance)(value)) {
|
|
3701
3808
|
return value;
|
|
3702
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
|
+
}
|
|
3703
3816
|
// This will cause all other values to render
|
|
3704
|
-
(0,
|
|
3705
|
-
// ??? - changed to insertBefore for tag switching with template removal
|
|
3706
|
-
insertBefore // oldInsertBefore as InsertBefore,
|
|
3707
|
-
);
|
|
3817
|
+
(0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__.processRegularValue)(value, subject, insertBefore);
|
|
3708
3818
|
return subjectTag;
|
|
3709
3819
|
}
|
|
3710
|
-
function handleStillTag(
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
const
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
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);
|
|
3717
3841
|
}
|
|
3718
3842
|
if (isSameTag) {
|
|
3719
|
-
|
|
3843
|
+
lastSupport.updateBy(valueSupport);
|
|
3720
3844
|
return;
|
|
3721
3845
|
}
|
|
3722
|
-
if (isSameTag
|
|
3723
|
-
const subjectTag = subject
|
|
3724
|
-
const global =
|
|
3846
|
+
if (isSameTag) {
|
|
3847
|
+
// const subjectTag = subject as TagSubject
|
|
3848
|
+
const global = lastSupport.global;
|
|
3725
3849
|
const insertBefore = global.insertBefore;
|
|
3726
|
-
return (0,
|
|
3850
|
+
return (0,_processTag_function__WEBPACK_IMPORTED_MODULE_11__.processTag)(templater, insertBefore, ownerSupport, subject);
|
|
3727
3851
|
}
|
|
3728
|
-
return (0,
|
|
3852
|
+
return (0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__.processRegularValue)(value, subject, subject.insertBefore);
|
|
3729
3853
|
}
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
__webpack_require__.r(__webpack_exports__);
|
|
3741
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3742
|
-
/* harmony export */ watch: () => (/* binding */ watch)
|
|
3743
|
-
/* harmony export */ });
|
|
3744
|
-
/* harmony import */ var _setLet_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setLet.function */ "./ts/setLet.function.ts");
|
|
3745
|
-
|
|
3746
|
-
/** When an item in watch array changes, callback function will be triggered */
|
|
3747
|
-
function watch(currentValues, callback) {
|
|
3748
|
-
let previousValues = (0,_setLet_function__WEBPACK_IMPORTED_MODULE_0__.setLet)(undefined)(x => [previousValues, previousValues = x]);
|
|
3749
|
-
if (previousValues === undefined) {
|
|
3750
|
-
callback(currentValues, previousValues);
|
|
3751
|
-
// const result = {currentValues, previousValues}
|
|
3752
|
-
previousValues = currentValues;
|
|
3753
|
-
return currentValues;
|
|
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;
|
|
3754
3863
|
}
|
|
3755
|
-
const
|
|
3756
|
-
|
|
3757
|
-
|
|
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];
|
|
3758
3872
|
}
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
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;
|
|
3763
3891
|
}
|
|
3764
3892
|
|
|
3765
3893
|
|
|
@@ -3833,32 +3961,36 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3833
3961
|
/* harmony export */ BaseTagSupport: () => (/* reexport safe */ _TagSupport_class__WEBPACK_IMPORTED_MODULE_8__.BaseTagSupport),
|
|
3834
3962
|
/* harmony export */ StateMismatchError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_4__.StateMismatchError),
|
|
3835
3963
|
/* harmony export */ Subject: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.Subject),
|
|
3964
|
+
/* harmony export */ SyncCallbackError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_4__.SyncCallbackError),
|
|
3836
3965
|
/* harmony export */ Tag: () => (/* reexport safe */ _Tag_class__WEBPACK_IMPORTED_MODULE_10__.Tag),
|
|
3837
3966
|
/* harmony export */ TagError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_4__.TagError),
|
|
3838
3967
|
/* harmony export */ TagSupport: () => (/* reexport safe */ _TagSupport_class__WEBPACK_IMPORTED_MODULE_8__.TagSupport),
|
|
3839
3968
|
/* harmony export */ ValueSubject: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.ValueSubject),
|
|
3969
|
+
/* harmony export */ callbackMaker: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.callbackMaker),
|
|
3840
3970
|
/* harmony export */ combineLatest: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.combineLatest),
|
|
3841
|
-
/* harmony export */ getCallback: () => (/* reexport safe */ _getCallback__WEBPACK_IMPORTED_MODULE_19__.getCallback),
|
|
3842
3971
|
/* harmony export */ hmr: () => (/* binding */ hmr),
|
|
3843
3972
|
/* harmony export */ html: () => (/* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_3__.html),
|
|
3844
|
-
/* harmony export */ interpolateElement: () => (/* reexport safe */
|
|
3845
|
-
/* 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),
|
|
3846
3975
|
/* harmony export */ isSubjectInstance: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isSubjectInstance),
|
|
3976
|
+
/* harmony export */ isTag: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTag),
|
|
3847
3977
|
/* harmony export */ isTagArray: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagArray),
|
|
3978
|
+
/* harmony export */ isTagClass: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagClass),
|
|
3848
3979
|
/* harmony export */ isTagComponent: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagComponent),
|
|
3849
|
-
/* harmony export */
|
|
3850
|
-
/* harmony export */
|
|
3851
|
-
/* harmony export */
|
|
3852
|
-
/* harmony export */
|
|
3980
|
+
/* harmony export */ isTagTemplater: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagTemplater),
|
|
3981
|
+
/* harmony export */ letState: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.letState),
|
|
3982
|
+
/* harmony export */ onDestroy: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.onDestroy),
|
|
3983
|
+
/* harmony export */ onInit: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.onInit),
|
|
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),
|
|
3853
3986
|
/* harmony export */ runBeforeRender: () => (/* reexport safe */ _tagRunner__WEBPACK_IMPORTED_MODULE_11__.runBeforeRender),
|
|
3854
|
-
/* harmony export */
|
|
3855
|
-
/* harmony export */
|
|
3856
|
-
/* harmony export */
|
|
3857
|
-
/* harmony export */ setUse: () => (/* reexport safe */ _setUse_function__WEBPACK_IMPORTED_MODULE_12__.setUse),
|
|
3987
|
+
/* harmony export */ setProp: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.setProp),
|
|
3988
|
+
/* harmony export */ setUse: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.setUse),
|
|
3989
|
+
/* harmony export */ state: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.state),
|
|
3858
3990
|
/* harmony export */ tag: () => (/* reexport safe */ _tag__WEBPACK_IMPORTED_MODULE_2__.tag),
|
|
3859
3991
|
/* harmony export */ tagElement: () => (/* reexport safe */ _tagElement__WEBPACK_IMPORTED_MODULE_0__.tagElement),
|
|
3860
3992
|
/* harmony export */ tags: () => (/* reexport safe */ _tag__WEBPACK_IMPORTED_MODULE_2__.tags),
|
|
3861
|
-
/* harmony export */ watch: () => (/* reexport safe */
|
|
3993
|
+
/* harmony export */ watch: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.watch),
|
|
3862
3994
|
/* harmony export */ willCallback: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.willCallback),
|
|
3863
3995
|
/* harmony export */ willPromise: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.willPromise),
|
|
3864
3996
|
/* harmony export */ willSubscribe: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.willSubscribe)
|
|
@@ -3870,19 +4002,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3870
4002
|
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./errors */ "./ts/errors.ts");
|
|
3871
4003
|
/* harmony import */ var _subject_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./subject/index */ "./ts/subject/index.ts");
|
|
3872
4004
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
3873
|
-
/* harmony import */ var
|
|
4005
|
+
/* harmony import */ var _state_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./state/index */ "./ts/state/index.ts");
|
|
3874
4006
|
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3875
|
-
/* harmony import */ var
|
|
4007
|
+
/* harmony import */ var _interpolations_interpolateElement__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./interpolations/interpolateElement */ "./ts/interpolations/interpolateElement.ts");
|
|
3876
4008
|
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Tag.class */ "./ts/Tag.class.ts");
|
|
3877
4009
|
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
3878
|
-
/* harmony import */ var
|
|
3879
|
-
/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./providers */ "./ts/providers.ts");
|
|
3880
|
-
/* harmony import */ var _set_function__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./set.function */ "./ts/set.function.ts");
|
|
3881
|
-
/* harmony import */ var _setLet_function__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./setLet.function */ "./ts/setLet.function.ts");
|
|
3882
|
-
/* harmony import */ var _setProp_function__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./setProp.function */ "./ts/setProp.function.ts");
|
|
3883
|
-
/* harmony import */ var _onInit__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./onInit */ "./ts/onInit.ts");
|
|
3884
|
-
/* harmony import */ var _onDestroy__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./onDestroy */ "./ts/onDestroy.ts");
|
|
3885
|
-
/* harmony import */ var _getCallback__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./getCallback */ "./ts/getCallback.ts");
|
|
4010
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
3886
4011
|
// import { redrawTag } from "./redrawTag.function"
|
|
3887
4012
|
|
|
3888
4013
|
|
|
@@ -3900,16 +4025,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3900
4025
|
|
|
3901
4026
|
|
|
3902
4027
|
|
|
3903
|
-
/* hooks */
|
|
3904
|
-
// TODO: export *
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
/* end: hooks */
|
|
3913
4028
|
const hmr = {
|
|
3914
4029
|
tagElement: _tagElement__WEBPACK_IMPORTED_MODULE_0__.tagElement,
|
|
3915
4030
|
// redrawTag
|
|
@@ -3921,28 +4036,32 @@ var __webpack_exports__ArrayNoKeyError = __webpack_exports__.ArrayNoKeyError;
|
|
|
3921
4036
|
var __webpack_exports__BaseTagSupport = __webpack_exports__.BaseTagSupport;
|
|
3922
4037
|
var __webpack_exports__StateMismatchError = __webpack_exports__.StateMismatchError;
|
|
3923
4038
|
var __webpack_exports__Subject = __webpack_exports__.Subject;
|
|
4039
|
+
var __webpack_exports__SyncCallbackError = __webpack_exports__.SyncCallbackError;
|
|
3924
4040
|
var __webpack_exports__Tag = __webpack_exports__.Tag;
|
|
3925
4041
|
var __webpack_exports__TagError = __webpack_exports__.TagError;
|
|
3926
4042
|
var __webpack_exports__TagSupport = __webpack_exports__.TagSupport;
|
|
3927
4043
|
var __webpack_exports__ValueSubject = __webpack_exports__.ValueSubject;
|
|
4044
|
+
var __webpack_exports__callbackMaker = __webpack_exports__.callbackMaker;
|
|
3928
4045
|
var __webpack_exports__combineLatest = __webpack_exports__.combineLatest;
|
|
3929
|
-
var __webpack_exports__getCallback = __webpack_exports__.getCallback;
|
|
3930
4046
|
var __webpack_exports__hmr = __webpack_exports__.hmr;
|
|
3931
4047
|
var __webpack_exports__html = __webpack_exports__.html;
|
|
3932
4048
|
var __webpack_exports__interpolateElement = __webpack_exports__.interpolateElement;
|
|
3933
4049
|
var __webpack_exports__interpolateString = __webpack_exports__.interpolateString;
|
|
3934
4050
|
var __webpack_exports__isSubjectInstance = __webpack_exports__.isSubjectInstance;
|
|
4051
|
+
var __webpack_exports__isTag = __webpack_exports__.isTag;
|
|
3935
4052
|
var __webpack_exports__isTagArray = __webpack_exports__.isTagArray;
|
|
4053
|
+
var __webpack_exports__isTagClass = __webpack_exports__.isTagClass;
|
|
3936
4054
|
var __webpack_exports__isTagComponent = __webpack_exports__.isTagComponent;
|
|
3937
|
-
var
|
|
4055
|
+
var __webpack_exports__isTagTemplater = __webpack_exports__.isTagTemplater;
|
|
4056
|
+
var __webpack_exports__letState = __webpack_exports__.letState;
|
|
3938
4057
|
var __webpack_exports__onDestroy = __webpack_exports__.onDestroy;
|
|
3939
4058
|
var __webpack_exports__onInit = __webpack_exports__.onInit;
|
|
3940
4059
|
var __webpack_exports__providers = __webpack_exports__.providers;
|
|
4060
|
+
var __webpack_exports__renderTagSupport = __webpack_exports__.renderTagSupport;
|
|
3941
4061
|
var __webpack_exports__runBeforeRender = __webpack_exports__.runBeforeRender;
|
|
3942
|
-
var __webpack_exports__set = __webpack_exports__.set;
|
|
3943
|
-
var __webpack_exports__setLet = __webpack_exports__.setLet;
|
|
3944
4062
|
var __webpack_exports__setProp = __webpack_exports__.setProp;
|
|
3945
4063
|
var __webpack_exports__setUse = __webpack_exports__.setUse;
|
|
4064
|
+
var __webpack_exports__state = __webpack_exports__.state;
|
|
3946
4065
|
var __webpack_exports__tag = __webpack_exports__.tag;
|
|
3947
4066
|
var __webpack_exports__tagElement = __webpack_exports__.tagElement;
|
|
3948
4067
|
var __webpack_exports__tags = __webpack_exports__.tags;
|
|
@@ -3950,6 +4069,6 @@ var __webpack_exports__watch = __webpack_exports__.watch;
|
|
|
3950
4069
|
var __webpack_exports__willCallback = __webpack_exports__.willCallback;
|
|
3951
4070
|
var __webpack_exports__willPromise = __webpack_exports__.willPromise;
|
|
3952
4071
|
var __webpack_exports__willSubscribe = __webpack_exports__.willSubscribe;
|
|
3953
|
-
export { __webpack_exports__ArrayNoKeyError as ArrayNoKeyError, __webpack_exports__BaseTagSupport as BaseTagSupport, __webpack_exports__StateMismatchError as StateMismatchError, __webpack_exports__Subject as Subject, __webpack_exports__Tag as Tag, __webpack_exports__TagError as TagError, __webpack_exports__TagSupport as TagSupport, __webpack_exports__ValueSubject as ValueSubject,
|
|
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 };
|
|
3954
4073
|
|
|
3955
4074
|
//# sourceMappingURL=bundle.js.map
|