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/js/TagSupport.class.js
CHANGED
|
@@ -1,64 +1,302 @@
|
|
|
1
|
+
import { escapeVariable, variablePrefix } from './Tag.class';
|
|
1
2
|
import { deepClone } from './deepFunctions';
|
|
2
|
-
import {
|
|
3
|
+
import { isTagClass, isTagComponent, isTagTemplater } from './isInstance';
|
|
4
|
+
import { cloneValueArray } from './cloneValueArray.function';
|
|
5
|
+
import { restoreTagMarker } from './checkDestroyPrevious.function';
|
|
6
|
+
import { runBeforeDestroy } from './tagRunner';
|
|
7
|
+
import { getChildTagsToDestroy } from './destroy.support';
|
|
8
|
+
import { elementDestroyCheck } from './elementDestroyCheck.function';
|
|
9
|
+
import { updateContextItem } from './updateContextItem.function';
|
|
10
|
+
import { processNewValue } from './processNewValue.function';
|
|
11
|
+
import { setTagPlaceholder } from './setTagPlaceholder.function';
|
|
12
|
+
import { interpolateElement, interpolateString } from './interpolations/interpolateElement';
|
|
13
|
+
import { subscribeToTemplate } from './interpolations/interpolateTemplate';
|
|
14
|
+
import { afterInterpolateElement } from './afterInterpolateElement.function';
|
|
15
|
+
const prefixSearch = new RegExp(variablePrefix, 'g');
|
|
16
|
+
/** used only for apps, otherwise use TagSupport */
|
|
3
17
|
export class BaseTagSupport {
|
|
4
18
|
templater;
|
|
5
19
|
subject;
|
|
6
20
|
isApp = true;
|
|
21
|
+
appElement; // only seen on this.getAppElement().appElement
|
|
7
22
|
propsConfig;
|
|
23
|
+
// stays with current render
|
|
8
24
|
memory = {
|
|
9
25
|
// context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}
|
|
10
|
-
state:
|
|
11
|
-
|
|
12
|
-
|
|
26
|
+
state: [],
|
|
27
|
+
};
|
|
28
|
+
// travels with all rerenderings
|
|
29
|
+
global = {
|
|
30
|
+
context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}
|
|
31
|
+
providers: [],
|
|
32
|
+
/** Indicator of re-rending. Saves from double rending something already rendered */
|
|
33
|
+
renderCount: 0,
|
|
34
|
+
deleted: false,
|
|
35
|
+
subscriptions: []
|
|
13
36
|
};
|
|
14
37
|
constructor(templater, subject) {
|
|
15
38
|
this.templater = templater;
|
|
16
39
|
this.subject = subject;
|
|
17
|
-
const children =
|
|
18
|
-
const
|
|
19
|
-
const
|
|
40
|
+
const children = templater.children; // children tags passed in as arguments
|
|
41
|
+
const kidValue = children.value;
|
|
42
|
+
const props = templater.props; // natural props
|
|
43
|
+
const latestCloned = deepClone(props);
|
|
20
44
|
this.propsConfig = {
|
|
21
45
|
latest: props,
|
|
22
46
|
latestCloned, // assume its HTML children and then detect
|
|
23
|
-
|
|
24
|
-
lastClonedKidValues: children.value.map(kid => {
|
|
47
|
+
lastClonedKidValues: kidValue.map(kid => {
|
|
25
48
|
const cloneValues = cloneValueArray(kid.values);
|
|
26
49
|
return cloneValues;
|
|
27
50
|
})
|
|
28
51
|
};
|
|
29
52
|
// if the latest props are not HTML children, then clone the props for later render cycles to compare
|
|
30
|
-
if (!
|
|
53
|
+
if (!isTagTemplater(props) && !isTagClass(props)) {
|
|
31
54
|
this.propsConfig.latestCloned = deepClone(latestCloned);
|
|
32
|
-
this.propsConfig.clonedProps = this.propsConfig.latestCloned;
|
|
33
55
|
}
|
|
34
56
|
}
|
|
35
57
|
}
|
|
36
|
-
function cloneValueArray(values) {
|
|
37
|
-
return values.map((value) => {
|
|
38
|
-
const tag = value;
|
|
39
|
-
if (isTagInstance(tag)) {
|
|
40
|
-
return cloneValueArray(tag.values);
|
|
41
|
-
}
|
|
42
|
-
if (isTagComponent(tag)) {
|
|
43
|
-
const tagComponent = tag;
|
|
44
|
-
return deepClone(tagComponent.props);
|
|
45
|
-
}
|
|
46
|
-
if (isTagArray(tag)) {
|
|
47
|
-
return cloneValueArray(tag);
|
|
48
|
-
}
|
|
49
|
-
return deepClone(value);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
58
|
export class TagSupport extends BaseTagSupport {
|
|
53
|
-
ownerTagSupport;
|
|
54
59
|
templater;
|
|
60
|
+
ownerTagSupport;
|
|
55
61
|
subject;
|
|
62
|
+
version;
|
|
56
63
|
isApp = false;
|
|
57
|
-
|
|
64
|
+
hasLiveElements = false;
|
|
65
|
+
childTags = []; // tags on me
|
|
66
|
+
clones = []; // elements on document. Needed at destroy process to know what to destroy
|
|
67
|
+
// may not be needed anymore?
|
|
68
|
+
strings;
|
|
69
|
+
values;
|
|
70
|
+
lastTemplateString = undefined; // used to compare templates for updates
|
|
71
|
+
constructor(templater, // at runtime rendering of a tag, it needs to be married to a new TagSupport()
|
|
72
|
+
ownerTagSupport, subject, version = 0) {
|
|
58
73
|
super(templater, subject);
|
|
59
|
-
this.ownerTagSupport = ownerTagSupport;
|
|
60
74
|
this.templater = templater;
|
|
75
|
+
this.ownerTagSupport = ownerTagSupport;
|
|
61
76
|
this.subject = subject;
|
|
77
|
+
this.version = version;
|
|
78
|
+
}
|
|
79
|
+
destroy(options = {
|
|
80
|
+
stagger: 0,
|
|
81
|
+
byParent: false, // Only destroy clones of direct children
|
|
82
|
+
}) {
|
|
83
|
+
const global = this.global;
|
|
84
|
+
const subject = this.subject;
|
|
85
|
+
// put back down the template tag
|
|
86
|
+
const insertBefore = global.insertBefore;
|
|
87
|
+
if (insertBefore.nodeName === 'TEMPLATE') {
|
|
88
|
+
const placeholder = global.placeholder;
|
|
89
|
+
if (placeholder && !('arrayValue' in this.memory)) {
|
|
90
|
+
if (!options.byParent) {
|
|
91
|
+
restoreTagMarker(this, insertBefore);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
delete global.placeholder;
|
|
96
|
+
// the isComponent check maybe able to be removed
|
|
97
|
+
const isComponent = isTagComponent(this) ? true : false;
|
|
98
|
+
if (isComponent) {
|
|
99
|
+
runBeforeDestroy(this, this);
|
|
100
|
+
}
|
|
101
|
+
const childTags = options.byParent ? [] : getChildTagsToDestroy(this.childTags);
|
|
102
|
+
// signify that no further event rendering should take place by making logic think a render occurred during event
|
|
103
|
+
// signify immediately child has been deleted (looked for during event processing)
|
|
104
|
+
childTags.forEach(child => {
|
|
105
|
+
const subGlobal = child.global;
|
|
106
|
+
delete subGlobal.newest;
|
|
107
|
+
subGlobal.deleted = true;
|
|
108
|
+
});
|
|
109
|
+
delete global.oldest;
|
|
110
|
+
delete global.newest;
|
|
111
|
+
global.deleted = true;
|
|
112
|
+
this.hasLiveElements = false;
|
|
113
|
+
delete subject.tagSupport;
|
|
114
|
+
this.destroySubscriptions();
|
|
115
|
+
let mainPromise;
|
|
116
|
+
if (this.ownerTagSupport) {
|
|
117
|
+
this.ownerTagSupport.childTags = this.ownerTagSupport.childTags.filter(child => child !== this);
|
|
118
|
+
}
|
|
119
|
+
if (!options.byParent) {
|
|
120
|
+
const { stagger, promise } = this.destroyClones(options);
|
|
121
|
+
options.stagger = stagger;
|
|
122
|
+
if (promise) {
|
|
123
|
+
mainPromise = promise;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
this.destroyClones();
|
|
128
|
+
}
|
|
129
|
+
if (mainPromise) {
|
|
130
|
+
mainPromise = mainPromise.then(async () => {
|
|
131
|
+
const promises = childTags.map(kid => kid.destroy({ stagger: 0, byParent: true }));
|
|
132
|
+
return Promise.all(promises);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
mainPromise = Promise.all(childTags.map(kid => kid.destroy({ stagger: 0, byParent: true })));
|
|
137
|
+
}
|
|
138
|
+
return mainPromise.then(() => options.stagger);
|
|
139
|
+
}
|
|
140
|
+
destroySubscriptions() {
|
|
141
|
+
const global = this.global;
|
|
142
|
+
global.subscriptions.forEach(cloneSub => cloneSub.unsubscribe());
|
|
143
|
+
global.subscriptions.length = 0;
|
|
144
|
+
}
|
|
145
|
+
destroyClones({ stagger } = {
|
|
146
|
+
stagger: 0,
|
|
147
|
+
}) {
|
|
148
|
+
//const promises = this.clones.reverse().map(
|
|
149
|
+
const promises = this.clones.map(clone => this.checkCloneRemoval(clone, stagger)).filter(x => x); // only return promises
|
|
150
|
+
this.clones.length = 0; // tag maybe used for something else
|
|
151
|
+
if (promises.length) {
|
|
152
|
+
return { promise: Promise.all(promises), stagger };
|
|
153
|
+
}
|
|
154
|
+
return { stagger };
|
|
155
|
+
}
|
|
156
|
+
/** Reviews elements for the presences of ondestroy */
|
|
157
|
+
checkCloneRemoval(clone, stagger) {
|
|
158
|
+
let promise;
|
|
159
|
+
const customElm = clone;
|
|
160
|
+
if (customElm.ondestroy) {
|
|
161
|
+
promise = elementDestroyCheck(customElm, stagger);
|
|
162
|
+
}
|
|
163
|
+
const next = () => {
|
|
164
|
+
clone.parentNode?.removeChild(clone);
|
|
165
|
+
const ownerSupport = this.ownerTagSupport;
|
|
166
|
+
if (ownerSupport) {
|
|
167
|
+
// Sometimes my clones were first registered to my owner, remove them from owner
|
|
168
|
+
ownerSupport.clones = ownerSupport.clones.filter(compareClone => compareClone !== clone);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
if (promise instanceof Promise) {
|
|
172
|
+
return promise.then(next);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
next();
|
|
176
|
+
}
|
|
177
|
+
return promise;
|
|
178
|
+
}
|
|
179
|
+
update() {
|
|
180
|
+
return this.updateContext(this.global.context);
|
|
181
|
+
}
|
|
182
|
+
updateBy(tagSupport) {
|
|
183
|
+
const tempTag = tagSupport.templater.tag;
|
|
184
|
+
this.updateConfig(tempTag.strings, tempTag.values);
|
|
185
|
+
}
|
|
186
|
+
updateConfig(strings, values) {
|
|
187
|
+
this.strings = strings;
|
|
188
|
+
this.updateValues(values);
|
|
189
|
+
}
|
|
190
|
+
updateValues(values) {
|
|
191
|
+
this.values = values;
|
|
192
|
+
return this.updateContext(this.global.context);
|
|
193
|
+
}
|
|
194
|
+
updateContext(context) {
|
|
195
|
+
const thisTag = this.templater.tag;
|
|
196
|
+
const strings = this.strings || thisTag.strings;
|
|
197
|
+
const values = this.values || thisTag.values;
|
|
198
|
+
strings.map((_string, index) => {
|
|
199
|
+
const variableName = variablePrefix + index;
|
|
200
|
+
const hasValue = values.length > index;
|
|
201
|
+
const value = values[index];
|
|
202
|
+
// is something already there?
|
|
203
|
+
const exists = variableName in context;
|
|
204
|
+
if (exists) {
|
|
205
|
+
return updateContextItem(context, variableName, value);
|
|
206
|
+
}
|
|
207
|
+
if (!hasValue) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
// 🆕 First time values below
|
|
211
|
+
context[variableName] = processNewValue(hasValue, value, this);
|
|
212
|
+
});
|
|
213
|
+
return context;
|
|
214
|
+
}
|
|
215
|
+
/** Function that kicks off actually putting tags down as HTML elements */
|
|
216
|
+
buildBeforeElement(insertBefore, options = {
|
|
217
|
+
forceElement: false,
|
|
218
|
+
counts: { added: 0, removed: 0 },
|
|
219
|
+
}) {
|
|
220
|
+
const subject = this.subject;
|
|
221
|
+
const global = this.global;
|
|
222
|
+
global.insertBefore = insertBefore;
|
|
223
|
+
if (!global.placeholder) {
|
|
224
|
+
setTagPlaceholder(global);
|
|
225
|
+
}
|
|
226
|
+
const placeholderElm = global.placeholder;
|
|
227
|
+
global.oldest = this;
|
|
228
|
+
global.newest = this;
|
|
229
|
+
subject.tagSupport = this;
|
|
230
|
+
this.hasLiveElements = true;
|
|
231
|
+
// remove old clones
|
|
232
|
+
if (this.clones.length) {
|
|
233
|
+
this.clones.forEach(clone => this.checkCloneRemoval(clone, 0));
|
|
234
|
+
}
|
|
235
|
+
global.insertBefore = insertBefore;
|
|
236
|
+
const context = this.update();
|
|
237
|
+
const template = this.getTemplate();
|
|
238
|
+
const elementContainer = document.createElement('div');
|
|
239
|
+
elementContainer.id = 'tag-temp-holder';
|
|
240
|
+
// render content with a first child that we can know is our first element
|
|
241
|
+
elementContainer.innerHTML = `<template id="temp-template-tag-wrap">${template.string}</template>`;
|
|
242
|
+
// Search/replace innerHTML variables but don't interpolate tag components just yet
|
|
243
|
+
const { tagComponents } = interpolateElement(elementContainer, context, template, this, // ownerSupport,
|
|
244
|
+
{
|
|
245
|
+
forceElement: options.forceElement,
|
|
246
|
+
counts: options.counts
|
|
247
|
+
});
|
|
248
|
+
afterInterpolateElement(elementContainer, placeholderElm, this, // ownerSupport
|
|
249
|
+
context, options);
|
|
250
|
+
// Any tag components that were found should be processed AFTER the owner processes its elements. Avoid double processing of elements attributes like (oninit)=${}
|
|
251
|
+
let isForceElement = options.forceElement;
|
|
252
|
+
tagComponents.forEach(tagComponent => {
|
|
253
|
+
subscribeToTemplate(tagComponent.insertBefore, tagComponent.subject, tagComponent.ownerSupport, options.counts, { isForceElement });
|
|
254
|
+
afterInterpolateElement(elementContainer, tagComponent.insertBefore, tagComponent.ownerSupport, // this, // ownerTag
|
|
255
|
+
context, options);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
getTemplate() {
|
|
259
|
+
const thisTag = this.templater.tag;
|
|
260
|
+
const strings = this.strings || thisTag.strings;
|
|
261
|
+
const values = this.values || thisTag.values;
|
|
262
|
+
const string = strings.map((string, index) => {
|
|
263
|
+
const safeString = string.replace(prefixSearch, escapeVariable);
|
|
264
|
+
const endString = safeString + (values.length > index ? `{${variablePrefix}${index}}` : '');
|
|
265
|
+
// const trimString = index === 0 || index === this.strings.length-1 ? endString.trim() : endString
|
|
266
|
+
const trimString = endString.replace(/>\s*/g, '>').replace(/\s*</g, '<');
|
|
267
|
+
return trimString;
|
|
268
|
+
}).join('');
|
|
269
|
+
const interpolation = interpolateString(string);
|
|
270
|
+
this.lastTemplateString = interpolation.string;
|
|
271
|
+
return {
|
|
272
|
+
interpolation,
|
|
273
|
+
// string,
|
|
274
|
+
string: interpolation.string,
|
|
275
|
+
strings,
|
|
276
|
+
values,
|
|
277
|
+
context: this.global.context || {},
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
/** Used during HMR only where static content itself could have been edited */
|
|
281
|
+
rebuild() {
|
|
282
|
+
// const insertBefore = this.insertBefore
|
|
283
|
+
const insertBefore = this.global.insertBefore;
|
|
284
|
+
if (!insertBefore) {
|
|
285
|
+
const err = new Error('Cannot rebuild. Previous insertBefore element is not defined on tag');
|
|
286
|
+
err.tag = this;
|
|
287
|
+
throw err;
|
|
288
|
+
}
|
|
289
|
+
this.buildBeforeElement(insertBefore, {
|
|
290
|
+
forceElement: true,
|
|
291
|
+
counts: { added: 0, removed: 0 },
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
getAppElement() {
|
|
295
|
+
let tag = this;
|
|
296
|
+
while (tag.ownerTagSupport) {
|
|
297
|
+
tag = tag.ownerTagSupport;
|
|
298
|
+
}
|
|
299
|
+
return tag;
|
|
62
300
|
}
|
|
63
301
|
}
|
|
64
302
|
//# sourceMappingURL=TagSupport.class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagSupport.class.js","sourceRoot":"","sources":["../ts/TagSupport.class.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAMxE,MAAM,OAAO,cAAc;IAmBhB;IACA;IAnBT,KAAK,GAAG,IAAI,CAAA;IAEZ,WAAW,CAMV;IAED,MAAM,GAAc;QAClB,mHAAmH;QACnH,KAAK,EAAE;YACL,MAAM,EAAE,EAAsB;SAC/B;KACF,CAAA;IAED,YACS,SAA0B,EAC1B,OAAmB;QADnB,cAAS,GAAT,SAAS,CAAiB;QAC1B,YAAO,GAAP,OAAO,CAAY;QAE1B,MAAM,QAAQ,GAAgB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAA,CAAC,uCAAuC;QAC7F,MAAM,KAAK,GAAU,IAAI,CAAC,SAAS,CAAC,KAAK,CAAA,CAAE,gBAAgB;QAE3D,MAAM,YAAY,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
|
+
import { BaseTagSupport, TagSupport } from './TagSupport.class';
|
|
3
3
|
import { Props } from './Props';
|
|
4
4
|
import { TagChildren } from './tag';
|
|
5
|
-
import { Provider } from './providers';
|
|
6
|
-
import { OnDestroyCallback } from './onDestroy';
|
|
7
|
-
import { TagSubject } from './
|
|
8
|
-
import { OnInitCallback } from './onInit';
|
|
5
|
+
import { Provider } from './state/providers';
|
|
6
|
+
import { OnDestroyCallback } from './state/onDestroy';
|
|
7
|
+
import { TagSubject } from './subject.types';
|
|
8
|
+
import { OnInitCallback } from './state/onInit';
|
|
9
9
|
import { Subscription } from './subject/Subject.utils';
|
|
10
10
|
import { InsertBefore } from './Clones.type';
|
|
11
|
-
export type Wrapper = ((tagSupport: BaseTagSupport, subject: TagSubject) =>
|
|
11
|
+
export type Wrapper = ((tagSupport: BaseTagSupport, subject: TagSubject) => TagSupport) & {
|
|
12
12
|
original: () => Tag;
|
|
13
13
|
};
|
|
14
14
|
export type TagGlobal = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
newest?: Tag;
|
|
15
|
+
oldest?: TagSupport;
|
|
16
|
+
newest?: TagSupport;
|
|
18
17
|
context: Context;
|
|
19
18
|
providers: Provider[];
|
|
20
19
|
/** Indicator of re-rending. Saves from double rending something already rendered */
|
|
@@ -23,19 +22,20 @@ export type TagGlobal = {
|
|
|
23
22
|
isApp?: boolean;
|
|
24
23
|
insertBefore?: InsertBefore;
|
|
25
24
|
placeholder?: Text;
|
|
26
|
-
subscriptions: Subscription[];
|
|
25
|
+
subscriptions: Subscription<any>[];
|
|
27
26
|
destroyCallback?: OnDestroyCallback;
|
|
28
27
|
init?: OnInitCallback;
|
|
29
28
|
};
|
|
30
29
|
export declare class TemplaterResult {
|
|
31
30
|
props: Props;
|
|
32
31
|
children: TagChildren;
|
|
33
|
-
|
|
32
|
+
isTemplater: boolean;
|
|
34
33
|
tagged: boolean;
|
|
35
|
-
wrapper
|
|
36
|
-
|
|
37
|
-
tagSupport: BaseTagSupport;
|
|
34
|
+
wrapper?: Wrapper;
|
|
35
|
+
tag?: Tag;
|
|
38
36
|
constructor(props: Props, children: TagChildren);
|
|
39
|
-
isTemplater: boolean;
|
|
40
37
|
}
|
|
41
|
-
export declare function renderWithSupport(tagSupport: BaseTagSupport,
|
|
38
|
+
export declare function renderWithSupport(tagSupport: BaseTagSupport, // new
|
|
39
|
+
lastSupport: TagSupport | undefined, // previous
|
|
40
|
+
subject: TagSubject, // events & memory
|
|
41
|
+
ownerSupport?: TagSupport): TagSupport;
|
|
@@ -1,80 +1,69 @@
|
|
|
1
1
|
import { runAfterRender, runBeforeRedraw, runBeforeRender } from './tagRunner';
|
|
2
|
-
import { setUse } from './
|
|
2
|
+
import { setUse } from './state';
|
|
3
3
|
import { isLikeTags } from './isLikeTags.function';
|
|
4
4
|
import { destroyTagMemory } from './destroyTag.function';
|
|
5
5
|
export class TemplaterResult {
|
|
6
6
|
props;
|
|
7
7
|
children;
|
|
8
|
-
|
|
8
|
+
isTemplater = true;
|
|
9
9
|
tagged;
|
|
10
10
|
wrapper;
|
|
11
|
-
|
|
12
|
-
newestTemplater: this,
|
|
13
|
-
context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}
|
|
14
|
-
providers: [],
|
|
15
|
-
/** Indicator of re-rending. Saves from double rending something already rendered */
|
|
16
|
-
renderCount: 0,
|
|
17
|
-
deleted: false,
|
|
18
|
-
subscriptions: []
|
|
19
|
-
};
|
|
20
|
-
tagSupport;
|
|
11
|
+
tag;
|
|
21
12
|
constructor(props, children) {
|
|
22
13
|
this.props = props;
|
|
23
14
|
this.children = children;
|
|
24
15
|
}
|
|
25
|
-
/*
|
|
26
|
-
redraw?: (
|
|
27
|
-
force?: boolean, // force children to redraw
|
|
28
|
-
) => Tag
|
|
29
|
-
*/
|
|
30
|
-
isTemplater = true;
|
|
31
16
|
}
|
|
32
|
-
export function renderWithSupport(tagSupport,
|
|
33
|
-
|
|
17
|
+
export function renderWithSupport(tagSupport, // new
|
|
18
|
+
lastSupport, // previous
|
|
19
|
+
subject, // events & memory
|
|
20
|
+
ownerSupport) {
|
|
34
21
|
/* BEFORE RENDER */
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
const lastOwnerSupport = lastSupport?.ownerTagSupport;
|
|
23
|
+
const runtimeOwnerSupport = lastOwnerSupport || ownerSupport;
|
|
24
|
+
if (lastSupport) {
|
|
25
|
+
const lastState = lastSupport.memory.state;
|
|
26
|
+
const memory = tagSupport.memory;
|
|
27
|
+
memory.state = [...lastState];
|
|
28
|
+
tagSupport.global = lastSupport.global;
|
|
29
|
+
runBeforeRedraw(tagSupport, lastSupport);
|
|
40
30
|
}
|
|
41
31
|
else {
|
|
42
|
-
if (!wrapTagSupport) {
|
|
43
|
-
throw new Error('63521');
|
|
44
|
-
}
|
|
45
32
|
// first time render
|
|
46
|
-
runBeforeRender(
|
|
33
|
+
runBeforeRender(tagSupport, runtimeOwnerSupport);
|
|
47
34
|
// TODO: Logic below most likely could live within providers.ts inside the runBeforeRender function
|
|
48
35
|
const providers = setUse.memory.providerConfig;
|
|
49
|
-
providers.
|
|
36
|
+
providers.ownerSupport = runtimeOwnerSupport;
|
|
50
37
|
}
|
|
51
38
|
/* END: BEFORE RENDER */
|
|
52
|
-
const templater =
|
|
39
|
+
const templater = tagSupport.templater;
|
|
40
|
+
const subTag = subject.tagSupport;
|
|
53
41
|
// NEW TAG CREATED HERE
|
|
54
|
-
const
|
|
42
|
+
const wrapper = templater.wrapper;
|
|
43
|
+
const reSupport = wrapper(tagSupport, subject);
|
|
55
44
|
/* AFTER */
|
|
56
|
-
runAfterRender(
|
|
57
|
-
const isLikeTag = !
|
|
45
|
+
runAfterRender(tagSupport, reSupport);
|
|
46
|
+
const isLikeTag = !lastSupport || isLikeTags(lastSupport, reSupport);
|
|
58
47
|
if (!isLikeTag) {
|
|
59
|
-
destroyUnlikeTags(
|
|
48
|
+
destroyUnlikeTags(lastSupport, reSupport, subject);
|
|
60
49
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return
|
|
50
|
+
reSupport.ownerTagSupport = (ownerSupport || lastOwnerSupport);
|
|
51
|
+
tagSupport.global.newest = reSupport;
|
|
52
|
+
return reSupport;
|
|
64
53
|
}
|
|
65
|
-
function destroyUnlikeTags(
|
|
66
|
-
|
|
54
|
+
function destroyUnlikeTags(lastSupport, // old
|
|
55
|
+
reSupport, // new
|
|
67
56
|
subject) {
|
|
68
|
-
const oldGlobal =
|
|
57
|
+
const oldGlobal = lastSupport.global;
|
|
69
58
|
const insertBefore = oldGlobal.insertBefore;
|
|
70
|
-
destroyTagMemory(
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
const global =
|
|
59
|
+
destroyTagMemory(lastSupport, subject);
|
|
60
|
+
// when a tag is destroyed, disconnect the globals
|
|
61
|
+
reSupport.global = { ...oldGlobal }; // break memory references
|
|
62
|
+
const global = reSupport.global;
|
|
74
63
|
global.insertBefore = insertBefore;
|
|
75
64
|
global.deleted = false;
|
|
76
65
|
delete global.oldest;
|
|
77
66
|
delete global.newest;
|
|
78
|
-
delete subject.
|
|
67
|
+
delete subject.tagSupport;
|
|
79
68
|
}
|
|
80
69
|
//# sourceMappingURL=TemplaterResult.class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplaterResult.class.js","sourceRoot":"","sources":["../ts/TemplaterResult.class.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"TemplaterResult.class.js","sourceRoot":"","sources":["../ts/TemplaterResult.class.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAMhC,OAA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AO,GAAG,SAAS,CAAC,OAAkB,CAAA;IAC5C,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAE9C,WAAW;IAEX,cAAc,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;IAErC,MAAM,SAAS,GAAG,CAAC,WAAW,IAAI,UAAU,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;IACpE,IAAG,CAAC,SAAS,EAAE,CAAC;QACd,iBAAiB,CACf,WAAW,EACX,SAAS,EACT,OAAO,CACR,CAAA;IACH,CAAC;IAED,SAAS,CAAC,eAAe,GAAG,CAAC,YAAY,IAAI,gBAAgB,CAAe,CAAA;IAC5E,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,CAAA;IAEpC,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,iBAAiB,CACxB,WAAuB,EAAE,MAAM;AAC/B,SAAqB,EAAE,MAAM;AAC7B,OAAmB;IAEnB,MAAM,SAAS,GAAG,WAAW,CAAC,MAAM,CAAA;IACpC,MAAM,YAAY,GAAG,SAAS,CAAC,YAAuB,CAAA;IAEtD,gBAAgB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;IAEtC,kDAAkD;IAClD,SAAS,CAAC,MAAM,GAAG,EAAC,GAAG,SAAS,EAAC,CAAA,CAAC,0BAA0B;IAC5D,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAA;IAE/B,MAAM,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,MAAM,CAAC,OAAO,GAAG,KAAK,CAAA;IAEtB,OAAO,MAAM,CAAC,MAAM,CAAA;IACpB,OAAO,MAAM,CAAC,MAAM,CAAA;IACpB,OAAQ,OAAyB,CAAC,UAAU,CAAA;AAC9C,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { InsertBefore } from './Clones.type';
|
|
2
|
+
import { Context, ElementBuildOptions } from './Tag.class';
|
|
3
|
+
import { TagSupport } from './TagSupport.class';
|
|
4
|
+
export declare function afterInterpolateElement(container: Element, insertBefore: InsertBefore, tagSupport: TagSupport, context: Context, options: ElementBuildOptions): ChildNode[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { buildClones } from './render';
|
|
2
|
+
import { afterElmBuild } from './interpolations/interpolateTemplate';
|
|
3
|
+
export function afterInterpolateElement(container, insertBefore, tagSupport,
|
|
4
|
+
// preClones: Clones,
|
|
5
|
+
context, options) {
|
|
6
|
+
const clones = buildClones(container, insertBefore);
|
|
7
|
+
if (!clones.length) {
|
|
8
|
+
return clones;
|
|
9
|
+
}
|
|
10
|
+
clones.forEach(clone => afterElmBuild(clone, options, context, tagSupport));
|
|
11
|
+
tagSupport.clones.push(...clones);
|
|
12
|
+
return clones;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=afterInterpolateElement.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"afterInterpolateElement.function.js","sourceRoot":"","sources":["../ts/afterInterpolateElement.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAA;AAKpE,MAAM,UAAU,uBAAuB,CACrC,SAAkB,EAClB,YAA0B,EAC1B,UAAsB;AACtB,qBAAqB;AACrB,OAAgB,EAChB,OAA4B;IAE5B,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,EAAE,YAAY,CAAC,CAAA;IACnD,IAAG,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,MAAM,CAAA;IACf,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAA;IAC3E,UAAU,CAAC,MAAM,CAAC,IAAI,CAAE,GAAG,MAAM,CAAE,CAAA;IAEnC,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Props } from './Props';
|
|
2
2
|
import { TagSupport } from './TagSupport.class';
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function callbackPropOwner(toCall: (...args: any[]) => any, callWith: any, templater: TemplaterResult, // only used to prevent rendering double
|
|
6
|
-
ownerSupport: TagSupport): any;
|
|
3
|
+
export declare function alterProps(props: Props, ownerSupport: TagSupport): any;
|
|
4
|
+
export declare function callbackPropOwner(toCall: (...args: any[]) => any, callWith: any, ownerSupport: TagSupport): any;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isTag } from './isInstance';
|
|
2
2
|
import { renderTagSupport } from './renderTagSupport.function';
|
|
3
3
|
/* Used to rewrite props that are functions. When they are called it should cause parent rendering */
|
|
4
|
-
export function alterProps(props,
|
|
4
|
+
export function alterProps(props, ownerSupport) {
|
|
5
5
|
function callback(toCall, callWith) {
|
|
6
|
-
return callbackPropOwner(toCall, callWith,
|
|
6
|
+
return callbackPropOwner(toCall, callWith, ownerSupport);
|
|
7
7
|
}
|
|
8
|
-
const isPropTag =
|
|
8
|
+
const isPropTag = isTag(props);
|
|
9
9
|
const watchProps = isPropTag ? 0 : props;
|
|
10
10
|
const newProps = resetFunctionProps(watchProps, callback);
|
|
11
11
|
return newProps;
|
|
@@ -34,18 +34,10 @@ function resetFunctionProps(props, callback) {
|
|
|
34
34
|
});
|
|
35
35
|
return newProps;
|
|
36
36
|
}
|
|
37
|
-
export function callbackPropOwner(toCall, callWith,
|
|
38
|
-
ownerSupport) {
|
|
39
|
-
const renderCount = templater.global.renderCount;
|
|
37
|
+
export function callbackPropOwner(toCall, callWith, ownerSupport) {
|
|
40
38
|
const callbackResult = toCall(...callWith);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
const lastestOwner = ownerSupport.templater.global.newest;
|
|
45
|
-
const newOwner = renderTagSupport(lastestOwner.tagSupport, true);
|
|
46
|
-
if (newOwner.tagSupport.templater.global.newest != newOwner) {
|
|
47
|
-
throw new Error('newest assignment issue?');
|
|
48
|
-
}
|
|
39
|
+
const lastestOwner = ownerSupport.global.newest;
|
|
40
|
+
renderTagSupport(lastestOwner, true);
|
|
49
41
|
return callbackResult;
|
|
50
42
|
}
|
|
51
43
|
//# sourceMappingURL=alterProps.function.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alterProps.function.js","sourceRoot":"","sources":["../ts/alterProps.function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"alterProps.function.js","sourceRoot":"","sources":["../ts/alterProps.function.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,qGAAqG;AACrG,MAAM,UAAU,UAAU,CACxB,KAAY,EACZ,YAAwB;IAExB,SAAS,QAAQ,CACf,MAA+B,EAC/B,QAAmB;QAEnB,OAAO,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAA;IAC1D,CAAC;IAED,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,CAAA;IAC9B,MAAM,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IACxC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IAEzD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,SAAS,kBAAkB,CACzB,KAAU,EACV,QAAiD;IAEjD,IAAG,OAAM,CAAC,KAAK,CAAC,KAAG,QAAQ,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,CAAA;IACtB,uFAAuF;IACvF,+BAA+B;IAE/B,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;QACjD,IAAG,KAAK,YAAY,QAAQ,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAA;YAExC,IAAG,QAAQ,EAAE,CAAC;gBACZ,OAAM,CAAC,+BAA+B;YACxC,CAAC;YAED,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;gBAClC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA,CAAC,wDAAwD;YAChG,CAAC,CAAA;YAED,kGAAkG;YAClG,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YACjE,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,GAAG,KAAK,CAAA;YAE/B,OAAM;QACR,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,MAA+B,EAC/B,QAAa,EACb,YAAwB;IAExB,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAA;IAC1C,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,MAAoB,CAAA;IAE7D,gBAAgB,CACd,YAAY,EACZ,IAAI,CACL,CAAA;IAED,OAAO,cAAc,CAAA;AACvB,CAAC"}
|
|
@@ -5,9 +5,6 @@ export function bindSubjectCallback(value, tag) {
|
|
|
5
5
|
if (value.isChildOverride) {
|
|
6
6
|
return value;
|
|
7
7
|
}
|
|
8
|
-
if (!tag.ownerTag && !tag.tagSupport.templater.global.isApp) {
|
|
9
|
-
throw new Error('no ownerTag issue here');
|
|
10
|
-
}
|
|
11
8
|
const subjectFunction = (element, args) => runTagCallback(value, tag, element, args);
|
|
12
9
|
// link back to original. Mostly used for <div oninit ondestroy> animations
|
|
13
10
|
subjectFunction.tagFunction = value;
|